Skip to content

Commit

Permalink
feat: add mapping for cognito pool migration handler
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaz committed Feb 21, 2021
1 parent cf9c0a9 commit 97564dd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/sls-aws/src/cognito/user-pool-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import type {
Context,
CustomMessageTriggerEvent,
PreSignUpTriggerEvent,
PreTokenGenerationTriggerEvent
PreTokenGenerationTriggerEvent,
UserMigrationTriggerEvent
} from 'aws-lambda'
import { responseOrError } from '../reponse/response-or-error'

Expand Down Expand Up @@ -31,5 +32,17 @@ const cognitoUserPoolCustomMessage = <D, C = never>(
): SlsEnvironment<CustomMessageHandler, C, D> =>
environment<CustomMessageHandler, C, D>(config).successHandler(responseOrError)

export type { PreSignUpHandler, PreTokenGenerationHandler, CustomMessageHandler }
export { cognitoUserPoolPreSignUp, cognitoUserPoolPreTokenGeneration, cognitoUserPoolCustomMessage }
type UserMigrationHandler = Handler<UserMigrationTriggerEvent, Context, Promise<UserMigrationTriggerEvent>>

const cognitoUserPoolMigration = <D, C = never>(
config?: EnvironmentConfig<UserMigrationHandler>
): SlsEnvironment<UserMigrationHandler, C, D> =>
environment<UserMigrationHandler, C, D>(config).successHandler(responseOrError)

export type { PreSignUpHandler, PreTokenGenerationHandler, CustomMessageHandler, UserMigrationHandler }
export {
cognitoUserPoolPreSignUp,
cognitoUserPoolPreTokenGeneration,
cognitoUserPoolCustomMessage,
cognitoUserPoolMigration
}

0 comments on commit 97564dd

Please sign in to comment.