Skip to content

Commit

Permalink
refactor: Alias the alai function (#1209)
Browse files Browse the repository at this point in the history
The `alai` function works using the Lambda context object to parse the
invoked function name. As an acronym for AWS Lambda Account ID it is not
particularly memorable or descriptive. This PR aliases the function as
`getAccountIDFromContext` to make it a little more understandable.

Tests pass.
  • Loading branch information
corinja authored Aug 8, 2024
1 parent e5db5e6 commit 0721d9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/SQSService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SendMessageCommandInput,
} from '@aws-sdk/client-sqs';
import { NodeHttpHandler } from '@smithy/node-http-handler';
import alai from 'alai';
import getAccountIDFromContext from 'alai';
import { SQSEvent } from 'aws-lambda';
import { v4 as uuid } from 'uuid';

Expand Down Expand Up @@ -246,7 +246,7 @@ export default class SQSService<
REGION,
} = process.env;

this.accountId = (di.context.invokedFunctionArn && alai.parse(di.context))
this.accountId = (di.context.invokedFunctionArn && getAccountIDFromContext.parse(di.context))
|| AWS_ACCOUNT_ID;

if (di.isOffline && !Object.values(SQS_OFFLINE_MODES).includes(offlineMode)) {
Expand Down

0 comments on commit 0721d9e

Please sign in to comment.