@aws-amplify/auth
Version:
Auth category of aws-amplify
1 lines • 1.81 kB
Source Map (JSON)
{"version":3,"file":"regionParsers.mjs","sources":["../../../../src/foundation/parsers/regionParsers.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthError } from '../../errors/AuthError';\nexport function getRegionFromUserPoolId(userPoolId) {\n const region = userPoolId?.split('_')[0];\n if (!userPoolId ||\n userPoolId.indexOf('_') < 0 ||\n !region ||\n typeof region !== 'string')\n throw new AuthError({\n name: 'InvalidUserPoolId',\n message: 'Invalid user pool id provided.',\n });\n return region;\n}\nexport function getRegionFromIdentityPoolId(identityPoolId) {\n if (!identityPoolId || !identityPoolId.includes(':')) {\n throw new AuthError({\n name: 'InvalidIdentityPoolIdException',\n message: 'Invalid identity pool id provided.',\n recoverySuggestion: 'Make sure a valid identityPoolId is given in the config.',\n });\n }\n return identityPoolId.split(':')[0];\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,SAAS,uBAAuB,CAAC,UAAU,EAAE;AACpD,IAAI,MAAM,MAAM,GAAG,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5C,IAAI,IAAI,CAAC,UAAU;AACnB,QAAQ,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;AACnC,QAAQ,CAAC,MAAM;AACf,QAAQ,OAAO,MAAM,KAAK,QAAQ;AAClC,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC5B,YAAY,IAAI,EAAE,mBAAmB;AACrC,YAAY,OAAO,EAAE,gCAAgC;AACrD,SAAS,CAAC;AACV,IAAI,OAAO,MAAM;AACjB;AACO,SAAS,2BAA2B,CAAC,cAAc,EAAE;AAC5D,IAAI,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC1D,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC5B,YAAY,IAAI,EAAE,gCAAgC;AAClD,YAAY,OAAO,EAAE,oCAAoC;AACzD,YAAY,kBAAkB,EAAE,0DAA0D;AAC1F,SAAS,CAAC;AACV;AACA,IAAI,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvC;;;;"}