From 0721d9e918f32f9d8ba3fc14dc002c9305c6765f Mon Sep 17 00:00:00 2001 From: Corin Ashwell Date: Thu, 8 Aug 2024 15:08:39 +0100 Subject: [PATCH] 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. --- src/services/SQSService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/SQSService.ts b/src/services/SQSService.ts index 9e52eed..d5aaf54 100644 --- a/src/services/SQSService.ts +++ b/src/services/SQSService.ts @@ -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'; @@ -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)) {