Skip to content

Commit 0721d9e

Browse files
authored
refactor: Alias the alai function (#1209)
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.
1 parent e5db5e6 commit 0721d9e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/services/SQSService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
SendMessageCommandInput,
1515
} from '@aws-sdk/client-sqs';
1616
import { NodeHttpHandler } from '@smithy/node-http-handler';
17-
import alai from 'alai';
17+
import getAccountIDFromContext from 'alai';
1818
import { SQSEvent } from 'aws-lambda';
1919
import { v4 as uuid } from 'uuid';
2020

@@ -246,7 +246,7 @@ export default class SQSService<
246246
REGION,
247247
} = process.env;
248248

249-
this.accountId = (di.context.invokedFunctionArn && alai.parse(di.context))
249+
this.accountId = (di.context.invokedFunctionArn && getAccountIDFromContext.parse(di.context))
250250
|| AWS_ACCOUNT_ID;
251251

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

0 commit comments

Comments
 (0)