UNPKG

@aws-amplify/core

Version:
1 lines 1.57 kB
{"version":3,"file":"createEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/createEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getCacheKey } from './getCacheKey';\nconst createdEndpointIds = {};\n/**\n * Creates an endpoint id and guarantees multiple creations for a category returns the same uuid.\n *\n * @internal\n */\nexport const createEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n if (!createdEndpointIds[cacheKey]) {\n createdEndpointIds[cacheKey] = amplifyUuid();\n }\n return createdEndpointIds[cacheKey];\n};\n/**\n * Clears a created endpoint id for a category.\n *\n * @internal\n */\nexport const clearCreatedEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n delete createdEndpointIds[cacheKey];\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AACrD,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;AACvC,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,GAAG,WAAW,EAAE,CAAC;AACrD,KAAK;AACL,IAAI,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACxC,EAAE;AACF;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AAC3D,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD,IAAI,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACxC;;;;"}