UNPKG

1.39 kBTypeScriptView Raw
1import { Handler } from "../../handler";
2import { BaseTriggerEvent, StringMap } from "./_common";
3
4export type UserStatus =
5 | "UNCONFIRMED"
6 | "CONFIRMED"
7 | "ARCHIVED"
8 | "COMPROMISED"
9 | "UNKNOWN"
10 | "RESET_REQUIRED"
11 | "FORCE_CHANGE_PASSWORD";
12
13export interface BaseUserMigrationTriggerEvent<T extends string> extends BaseTriggerEvent<T> {
14 request: {
15 password: string;
16 validationData?: StringMap | undefined;
17 clientMetadata?: StringMap | undefined;
18 };
19 response: {
20 userAttributes: StringMap;
21 finalUserStatus?: UserStatus | undefined;
22 messageAction?: "RESEND" | "SUPPRESS" | undefined;
23 desiredDeliveryMediums: Array<"SMS" | "EMAIL">;
24 forceAliasCreation?: boolean | undefined;
25 enableSMSMFA?: boolean | undefined;
26 };
27}
28
29export type UserMigrationAuthenticationTriggerEvent = BaseUserMigrationTriggerEvent<"UserMigration_Authentication">;
30
31export type UserMigrationForgotPasswordTriggerEvent = BaseUserMigrationTriggerEvent<"UserMigration_ForgotPassword">;
32
33/**
34 * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-migrate-user.html
35 */
36export type UserMigrationTriggerEvent =
37 | UserMigrationAuthenticationTriggerEvent
38 | UserMigrationForgotPasswordTriggerEvent;
39
40export type UserMigrationTriggerHandler = Handler<UserMigrationTriggerEvent>;