From 0960fdde3b302b19dc7390d20ae63211d81feebb Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Tue, 31 Oct 2023 11:21:57 -0700 Subject: [PATCH] fix(core): remove used symbol and remove usage of Symbol.for --- packages/core/src/Hub/index.ts | 4 ++-- packages/core/src/constants.ts | 11 ----------- packages/core/src/libraryUtils.ts | 5 +---- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/packages/core/src/Hub/index.ts b/packages/core/src/Hub/index.ts index d226a9f1b78..6f6cb907140 100644 --- a/packages/core/src/Hub/index.ts +++ b/packages/core/src/Hub/index.ts @@ -16,8 +16,8 @@ import { } from './types'; export const AMPLIFY_SYMBOL = ( - typeof Symbol !== 'undefined' && typeof Symbol.for === 'function' - ? Symbol.for('amplify_default') + typeof Symbol !== 'undefined' + ? Symbol('amplify_default') : '@@amplify_default' ) as Symbol; diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 3a202d31da4..82e84497f40 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -4,17 +4,6 @@ // Logging constants export const AWS_CLOUDWATCH_CATEGORY = 'Logging'; -/** - * This Symbol is used to reference an internal-only PubSub provider that - * is used for AppSync/GraphQL subscriptions in the API category. - */ -const hasSymbol = - typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'; - -export const INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = hasSymbol - ? Symbol.for('INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER') - : '@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER'; - export const USER_AGENT_HEADER = 'x-amz-user-agent'; // Error exception code constants diff --git a/packages/core/src/libraryUtils.ts b/packages/core/src/libraryUtils.ts index 0eed9202d67..bbaa20143fe 100644 --- a/packages/core/src/libraryUtils.ts +++ b/packages/core/src/libraryUtils.ts @@ -90,10 +90,7 @@ export { export { BackgroundProcessManager } from './BackgroundProcessManager'; export { Mutex } from './Mutex'; export { Reachability } from './Reachability'; -export { - INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, - USER_AGENT_HEADER, -} from './constants'; +export { USER_AGENT_HEADER } from './constants'; export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession'; export { AMPLIFY_SYMBOL } from './Hub'; export { base64Decoder, base64Encoder } from './utils/convert';