Skip to content

Commit

Permalink
SLSCMN-16 SNS handler fn type (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarman authored Dec 22, 2023
1 parent db6c3f7 commit 999fca6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
LambdaMiddyfyOptions,
ScheduledHandlerFn,
ScheduledMiddyfyOptions,
SNSHandlerFn,
SNSMiddyfyOptions,
SQSMiddyfyOptions,
} from './middyfy';
Expand Down
9 changes: 7 additions & 2 deletions src/utils/middyfy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Context,
ScheduledEvent,
SQSHandler,
SNSHandler,
SNSEvent,
} from 'aws-lambda';
import { ObjectSchema } from 'joi';

Expand All @@ -30,6 +30,11 @@ export type APIGatewayHandlerFn = (
*/
export type ScheduledHandlerFn = (event: ScheduledEvent, context: Context) => Promise<void>;

/**
* The AWS Lambda handler function signature for SNS events.
*/
export type SNSHandlerFn = (event: SNSEvent, context: Context) => Promise<void>;

/**
* A Lambda function for invocation by another Lambda function.
*/
Expand Down Expand Up @@ -81,7 +86,7 @@ export type ScheduledMiddyfyOptions = MiddyfyOptions<ScheduledHandlerFn> & {
/**
* Options for middyfied SNS event handler functions.
*/
export type SNSMiddyfyOptions = MiddyfyOptions<SNSHandler> & {
export type SNSMiddyfyOptions = MiddyfyOptions<SNSHandlerFn> & {
eventSchema?: ObjectSchema;
};

Expand Down

0 comments on commit 999fca6

Please sign in to comment.