@aws-amplify/core
Version:
Core category of aws-amplify
22 lines (20 loc) • 974 B
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Creates the per-context identity handle attached to every branded
* {@link AmplifyContext} by the context producers (`createAmplifyContext`,
* `bridgeAmplifyClass`, the singleton `configure()` path, and the testing
* mock factory).
*
* Each call returns a **frozen** `{ value }` object carrying a **unique**
* `Symbol()` — a plain (non-registry) symbol, so no two contexts ever share a
* token. See {@link AmplifyContextToken} for why the token exists (structural
* compatibility with `@aws-amplify/data-schema`'s `ContextSpec` duck-check);
* runtime context identification stays on the `AMPLIFY_CONTEXT_BRAND` symbol
* and must not involve the token.
*/
function createAmplifyContextToken() {
return Object.freeze({ value: Symbol('amplifyContextToken') });
}
export { createAmplifyContextToken };
//# sourceMappingURL=contextToken.mjs.map