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; };