📦 EqualifyEverything / equalify-api

📄 cognito.ts · 32 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32import { postConfirmationConfirmSignUp, postConfirmationConfirmForgotPassword, customMessageSignUp, customMessageResendCode, customMessageForgotPassword, customMessageVerifyUserAttribute, customMessageUpdateUserAttribute, tokenGeneration } from '#src/cognito/index';

export const cognito = async (event) => {
    if (['TokenGeneration_Authentication', 'TokenGeneration_RefreshTokens', 'TokenGeneration_AuthenticateDevice'].includes(event.triggerSource)) {
        return tokenGeneration(event);
    }
    else if (event.triggerSource === 'PostConfirmation_ConfirmSignUp') {
        return postConfirmationConfirmSignUp(event);
    }
    else if (event.triggerSource === 'PostConfirmation_ConfirmForgotPassword') {
        return postConfirmationConfirmForgotPassword(event);
    }
    else if (event.triggerSource === 'CustomMessage_SignUp') {
        return customMessageSignUp(event);
    }
    else if (event.triggerSource === 'CustomMessage_ResendCode') {
        return customMessageResendCode(event);
    }
    else if (event.triggerSource === 'CustomMessage_ForgotPassword') {
        return customMessageForgotPassword(event);
    }
    else if (event.triggerSource === 'CustomMessage_VerifyUserAttribute') {
        return customMessageVerifyUserAttribute(event);
    }
    else if (event.triggerSource === 'CustomMessage_UpdateUserAttribute') {
        return customMessageUpdateUserAttribute(event);
    }
    else {
        return event;
    }
}