diff --git a/package.json b/package.json index 6a087ce..81dfaa4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "@aws-sdk/client-sqs": "^3.474.0", "@aws-sdk/lib-dynamodb": "^3.474.0", "@middy/core": "^4.7.0", - "@middy/event-normalizer": "^4.7.0", "@middy/http-event-normalizer": "^4.7.0", "@middy/http-json-body-parser": "^4.7.0", "@rollup/plugin-commonjs": "^25.0.4", @@ -67,7 +66,6 @@ "@aws-sdk/client-sqs": "^3.474.0", "@aws-sdk/lib-dynamodb": "^3.474.0", "@middy/core": "^4.7.0", - "@middy/event-normalizer": "^4.7.0", "@middy/http-event-normalizer": "^4.7.0", "@middy/http-json-body-parser": "^4.7.0", "http-status": "^1.7.3", diff --git a/src/utils/index.ts b/src/utils/index.ts index e882e21..a46e61c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -13,7 +13,6 @@ export { LambdaMiddyfyOptions, ScheduledHandlerFn, ScheduledMiddyfyOptions, - SNSHandlerFn, SNSMiddyfyOptions, SQSMiddyfyOptions, } from './middyfy'; diff --git a/src/utils/middyfy.ts b/src/utils/middyfy.ts index 84b3f86..d95be43 100644 --- a/src/utils/middyfy.ts +++ b/src/utils/middyfy.ts @@ -1,5 +1,4 @@ import middy from '@middy/core'; -import eventNormalizer from '@middy/event-normalizer'; import httpEventNormalizer from '@middy/http-event-normalizer'; import jsonBodyParser from '@middy/http-json-body-parser'; import { @@ -8,7 +7,7 @@ import { Context, ScheduledEvent, SQSHandler, - SNSEvent, + SNSHandler, } from 'aws-lambda'; import { ObjectSchema } from 'joi'; @@ -30,11 +29,6 @@ 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. */ @@ -86,7 +80,7 @@ export type ScheduledMiddyfyOptions = MiddyfyOptions & { /** * Options for middyfied SNS event handler functions. */ -export type SNSMiddyfyOptions = MiddyfyOptions & { +export type SNSMiddyfyOptions = MiddyfyOptions & { eventSchema?: ObjectSchema; }; @@ -147,7 +141,6 @@ export const middyfyScheduled = (options: ScheduledMiddyfyOptions) => { export const middyfySNS = (options: SNSMiddyfyOptions) => { return middy(options.handler) .use(loggerInitializer()) - .use(eventNormalizer()) .use(validator({ eventSchema: options.eventSchema })); }; @@ -160,7 +153,6 @@ export const middyfySNS = (options: SNSMiddyfyOptions) => { export const middyfySQS = (options: SQSMiddyfyOptions) => { return middy(options.handler) .use(loggerInitializer()) - .use(eventNormalizer()) .use(validator({ eventSchema: options.eventSchema })); };