UNPKG

@aws-amplify/core

Version:
1 lines 1.3 kB
{"version":3,"file":"serverContextRegistry.mjs","sources":["../../../../src/adapterCore/serverContext/serverContextRegistry.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst storage = new WeakMap();\nfunction createToken() {\n return {\n value: Symbol('AmplifyServerContextToken'),\n };\n}\nexport const serverContextRegistry = {\n register(context) {\n const token = createToken();\n storage.set(token, context);\n return { token };\n },\n deregister(contextSpec) {\n return storage.delete(contextSpec.token);\n },\n get(contextSpec) {\n return storage.get(contextSpec.token);\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;AAC7B,SAAS,WAAW,GAAG;AACvB,IAAI,OAAO;AACX,QAAQ,KAAK,EAAE,MAAM,CAAC,2BAA2B,CAAC;AAClD,KAAK;AACL;AACY,MAAC,qBAAqB,GAAG;AACrC,IAAI,QAAQ,CAAC,OAAO,EAAE;AACtB,QAAQ,MAAM,KAAK,GAAG,WAAW,EAAE;AACnC,QAAQ,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC;AACnC,QAAQ,OAAO,EAAE,KAAK,EAAE;AACxB,KAAK;AACL,IAAI,UAAU,CAAC,WAAW,EAAE;AAC5B,QAAQ,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;AAChD,KAAK;AACL,IAAI,GAAG,CAAC,WAAW,EAAE;AACrB,QAAQ,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7C,KAAK;AACL;;;;"}