UNPKG

@aws-amplify/core

Version:
1 lines 1.9 kB
{"version":3,"file":"resolveEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/resolveEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assert } from '../../../errors';\nimport { AmplifyErrorCode } from '../../../types';\nimport { updateEndpoint } from '../apis/updateEndpoint';\nimport { getEndpointId } from './getEndpointId';\n/**\n * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,\n * which will generate and cache an endpoint id between calls.\n *\n * @internal\n */\nexport const resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {\n let endpointId = await getEndpointId(appId, category);\n if (!endpointId) {\n await updateEndpoint({\n address,\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n endpointId = await getEndpointId(appId, category);\n }\n assert(!!endpointId, AmplifyErrorCode.NoEndpointId);\n return endpointId;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AACxI,IAAI,IAAI,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,MAAM,cAAc,CAAC;AAC7B,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxD,IAAI,OAAO,UAAU,CAAC;AACtB;;;;"}