UNPKG

@aws-amplify/auth

Version:
1 lines 3.19 kB
{"version":3,"file":"createSignUpClient.mjs","sources":["../../../../../../src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';\nimport { parseJsonBody, parseJsonError, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { validationErrorMap } from '../../../../common/AuthErrorStrings';\nimport { AuthError } from '../../../../errors/AuthError';\nimport { AuthValidationErrorCode } from '../../../../errors/types/validation';\nimport { assertServiceError } from '../../../../errors/utils/assertServiceError';\nimport { SignUpException } from '../../../../providers/cognito/types/errors';\nimport { createUserPoolSerializer } from './shared/serde';\nimport { cognitoUserPoolTransferHandler } from './shared/handler';\nimport { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';\nexport const createSignUpClientDeserializer = () => async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n assertServiceError(error);\n if (\n // Missing Password Error\n // 1 validation error detected: Value at 'password'failed to satisfy constraint: Member must not be null\n error.name === SignUpException.InvalidParameterException &&\n /'password'/.test(error.message) &&\n /Member must not be null/.test(error.message)) {\n const name = AuthValidationErrorCode.EmptySignUpPassword;\n const { message, recoverySuggestion } = validationErrorMap[name];\n throw new AuthError({\n name,\n message,\n recoverySuggestion,\n });\n }\n throw new AuthError({ name: error.name, message: error.message });\n }\n return parseJsonBody(response);\n};\nexport const createSignUpClient = (config) => composeServiceApi(cognitoUserPoolTransferHandler, createUserPoolSerializer('SignUp'), createSignUpClientDeserializer(), {\n ...DEFAULT_SERVICE_CLIENT_API_CONFIG,\n ...config,\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;AAWY,MAAC,8BAA8B,GAAG,MAAM,OAAO,QAAQ,KAAK;AACxE,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,kBAAkB,CAAC,KAAK,CAAC;AACjC,QAAQ;AACR;AACA;AACA,QAAQ,KAAK,CAAC,IAAI,KAAK,eAAe,CAAC,yBAAyB;AAChE,YAAY,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5C,YAAY,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;AAC3D,YAAY,MAAM,IAAI,GAAG,uBAAuB,CAAC,mBAAmB;AACpE,YAAY,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC;AAC5E,YAAY,MAAM,IAAI,SAAS,CAAC;AAChC,gBAAgB,IAAI;AACpB,gBAAgB,OAAO;AACvB,gBAAgB,kBAAkB;AAClC,aAAa,CAAC;AACd;AACA,QAAQ,MAAM,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;AACzE;AACA,IAAI,OAAO,aAAa,CAAC,QAAQ,CAAC;AAClC;AACY,MAAC,kBAAkB,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,8BAA8B,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAAE,8BAA8B,EAAE,EAAE;AACtK,IAAI,GAAG,iCAAiC;AACxC,IAAI,GAAG,MAAM;AACb,CAAC;;;;"}