From 999fca69afac13bd27fcd5f93e54632299736768 Mon Sep 17 00:00:00 2001 From: Matthew Warman Date: Fri, 22 Dec 2023 10:58:29 -0500 Subject: [PATCH] SLSCMN-16 SNS handler fn type (#16) --- src/utils/index.ts | 1 + src/utils/middyfy.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index a46e61c..e882e21 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -13,6 +13,7 @@ export { LambdaMiddyfyOptions, ScheduledHandlerFn, ScheduledMiddyfyOptions, + SNSHandlerFn, SNSMiddyfyOptions, SQSMiddyfyOptions, } from './middyfy'; diff --git a/src/utils/middyfy.ts b/src/utils/middyfy.ts index 2fb8820..84b3f86 100644 --- a/src/utils/middyfy.ts +++ b/src/utils/middyfy.ts @@ -8,7 +8,7 @@ import { Context, ScheduledEvent, SQSHandler, - SNSHandler, + SNSEvent, } from 'aws-lambda'; import { ObjectSchema } from 'joi'; @@ -30,6 +30,11 @@ export type APIGatewayHandlerFn = ( */ export type ScheduledHandlerFn = (event: ScheduledEvent, context: Context) => Promise; +/** + * The AWS Lambda handler function signature for SNS events. + */ +export type SNSHandlerFn = (event: SNSEvent, context: Context) => Promise; + /** * A Lambda function for invocation by another Lambda function. */ @@ -81,7 +86,7 @@ export type ScheduledMiddyfyOptions = MiddyfyOptions & { /** * Options for middyfied SNS event handler functions. */ -export type SNSMiddyfyOptions = MiddyfyOptions & { +export type SNSMiddyfyOptions = MiddyfyOptions & { eventSchema?: ObjectSchema; };