@aws-amplify/core 6.12.4-unstable.d6f1422.0 → 6.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BackgroundProcessManager/BackgroundManagerNotOpenError.js.map +1 -1
- package/dist/cjs/BackgroundProcessManager/BackgroundProcessManager.js.map +1 -1
- package/dist/cjs/BackgroundProcessManager/index.js.map +1 -1
- package/dist/cjs/Cache/StorageCache.js.map +1 -1
- package/dist/cjs/Cache/StorageCache.native.js.map +1 -1
- package/dist/cjs/Cache/StorageCacheCommon.js.map +1 -1
- package/dist/cjs/Cache/utils/CacheList.js.map +1 -1
- package/dist/cjs/Cache/utils/cacheHelpers.js.map +1 -1
- package/dist/cjs/Cache/utils/index.js.map +1 -1
- package/dist/cjs/Hub/index.js.map +1 -1
- package/dist/cjs/I18n/I18n.js.map +1 -1
- package/dist/cjs/I18n/index.js.map +1 -1
- package/dist/cjs/I18n/types.js.map +1 -1
- package/dist/cjs/Logger/ConsoleLogger.js.map +1 -1
- package/dist/cjs/Logger/index.js.map +1 -1
- package/dist/cjs/Mutex/Mutex.js.map +1 -1
- package/dist/cjs/Mutex/index.js.map +1 -1
- package/dist/cjs/Platform/customUserAgent.js.map +1 -1
- package/dist/cjs/Platform/detectFramework.js.map +1 -1
- package/dist/cjs/Platform/detection/React.js.map +1 -1
- package/dist/cjs/Platform/index.js.map +1 -1
- package/dist/cjs/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/Reachability/Reachability.js.map +1 -1
- package/dist/cjs/Reachability/Reachability.native.js.map +1 -1
- package/dist/cjs/Reachability/index.js.map +1 -1
- package/dist/cjs/ServiceWorker/ServiceWorker.js.map +1 -1
- package/dist/cjs/ServiceWorker/index.js.map +1 -1
- package/dist/cjs/Signer/DateUtils.js.map +1 -1
- package/dist/cjs/Signer/Signer.js.map +1 -1
- package/dist/cjs/Signer/index.js.map +1 -1
- package/dist/cjs/adapterCore/error/AmplifyServerContextError.js.map +1 -1
- package/dist/cjs/adapterCore/error/index.js.map +1 -1
- package/dist/cjs/adapterCore/index.js.map +1 -1
- package/dist/cjs/adapterCore/serverContext/index.js.map +1 -1
- package/dist/cjs/adapterCore/serverContext/serverContext.js.map +1 -1
- package/dist/cjs/adapterCore/serverContext/serverContextRegistry.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/base.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/getInAppMessages.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/index.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/putEvents.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/updateEndpoint.js.map +1 -1
- package/dist/cjs/clients/endpoints/getDnsSuffix.js.map +1 -1
- package/dist/cjs/clients/endpoints/index.js.map +1 -1
- package/dist/cjs/clients/handlers/fetch.js.map +1 -1
- package/dist/cjs/clients/index.js.map +1 -1
- package/dist/cjs/clients/internal/composeServiceApi.js.map +1 -1
- package/dist/cjs/clients/internal/composeTransferHandler.js.map +1 -1
- package/dist/cjs/clients/internal/index.js.map +1 -1
- package/dist/cjs/clients/middleware/retry/amzSdkInvocationIdHeaderMiddleware.js.map +1 -1
- package/dist/cjs/clients/middleware/retry/amzSdkRequestHeaderMiddleware.js.map +1 -1
- package/dist/cjs/clients/middleware/retry/index.js.map +1 -1
- package/dist/cjs/clients/middleware/retry/retryMiddleware.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/index.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/middleware.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/signer/signatureV4/index.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/signer/signatureV4/presignUrl.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/signer/signatureV4/signRequest.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js.map +1 -1
- package/dist/cjs/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js.map +1 -1
- package/dist/cjs/clients/middleware/userAgent/index.js.map +1 -1
- package/dist/cjs/clients/middleware/userAgent/middleware.js.map +1 -1
- package/dist/cjs/clients/serde/index.js.map +1 -1
- package/dist/cjs/clients/serde/json.js.map +1 -1
- package/dist/cjs/clients/utils/memoization.js.map +1 -1
- package/dist/cjs/errors/APIError.js.map +1 -1
- package/dist/cjs/errors/AmplifyError.js.map +1 -1
- package/dist/cjs/errors/PlatformNotSupportedError.js.map +1 -1
- package/dist/cjs/errors/createAssertionFunction.js.map +1 -1
- package/dist/cjs/errors/index.js.map +1 -1
- package/dist/cjs/foundation/factories/middleware/index.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/index.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/index.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/libraryUtils.js.map +1 -1
- package/dist/cjs/parseAWSExports.js.map +1 -1
- package/dist/cjs/parseAmplifyOutputs.js.map +1 -1
- package/dist/cjs/providers/pinpoint/apis/index.js.map +1 -1
- package/dist/cjs/providers/pinpoint/apis/record.js.map +1 -1
- package/dist/cjs/providers/pinpoint/apis/updateEndpoint.js.map +1 -1
- package/dist/cjs/providers/pinpoint/index.js.map +1 -1
- package/dist/cjs/providers/pinpoint/types/index.js.map +1 -1
- package/dist/cjs/providers/pinpoint/utils/PinpointEventBuffer.js.map +1 -1
- package/dist/cjs/providers/pinpoint/utils/createEndpointId.js.map +1 -1
- package/dist/cjs/providers/pinpoint/utils/getEventBuffer.js.map +1 -1
- package/dist/cjs/providers/pinpoint/utils/index.js.map +1 -1
- package/dist/cjs/providers/pinpoint/utils/resolveEndpointId.js.map +1 -1
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/singleton/Amplify.js.map +1 -1
- package/dist/cjs/singleton/Auth/index.js +2 -2
- package/dist/cjs/singleton/Auth/index.js.map +1 -1
- package/dist/cjs/singleton/Auth/utils/index.js.map +1 -1
- package/dist/cjs/singleton/apis/fetchAuthSession.js +2 -2
- package/dist/cjs/singleton/apis/fetchAuthSession.js.map +1 -1
- package/dist/cjs/singleton/index.js.map +1 -1
- package/dist/cjs/storage/CookieStorage.js.map +1 -1
- package/dist/cjs/storage/DefaultStorage.js.map +1 -1
- package/dist/cjs/storage/DefaultStorage.native.js.map +1 -1
- package/dist/cjs/storage/InMemoryStorage.js.map +1 -1
- package/dist/cjs/storage/KeyValueStorage.js.map +1 -1
- package/dist/cjs/storage/SessionStorage.js.map +1 -1
- package/dist/cjs/storage/SyncKeyValueStorage.js.map +1 -1
- package/dist/cjs/storage/SyncSessionStorage.js.map +1 -1
- package/dist/cjs/storage/index.js.map +1 -1
- package/dist/cjs/storage/utils.js.map +1 -1
- package/dist/cjs/utils/WordArray.js.map +1 -1
- package/dist/cjs/utils/convert/base64/base64Decoder.js.map +1 -1
- package/dist/cjs/utils/convert/base64/base64Encoder.js.map +1 -1
- package/dist/cjs/utils/convert/index.js.map +1 -1
- package/dist/cjs/utils/deDupeAsyncFunction.js.map +1 -1
- package/dist/cjs/utils/deepFreeze.js.map +1 -1
- package/dist/cjs/utils/deviceName/index.js.map +1 -1
- package/dist/cjs/utils/generateRandomString.js.map +1 -1
- package/dist/cjs/utils/getClientInfo/getClientInfo.ios.js.map +1 -1
- package/dist/cjs/utils/getClientInfo/getClientInfo.js.map +1 -1
- package/dist/cjs/utils/getClientInfo/index.js.map +1 -1
- package/dist/cjs/utils/globalHelpers/index.js.map +1 -1
- package/dist/cjs/utils/globalHelpers/index.native.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/isWebWorker.js.map +1 -1
- package/dist/cjs/utils/parseAmplifyConfig.js.map +1 -1
- package/dist/cjs/utils/queuedStorage/createQueuedStorage.js.map +1 -1
- package/dist/cjs/utils/queuedStorage/createQueuedStorage.native.js.map +1 -1
- package/dist/cjs/utils/queuedStorage/index.js.map +1 -1
- package/dist/cjs/utils/retry/NonRetryableError.js.map +1 -1
- package/dist/cjs/utils/retry/index.js.map +1 -1
- package/dist/cjs/utils/retry/jitteredBackoff.js.map +1 -1
- package/dist/cjs/utils/retry/retry.js.map +1 -1
- package/dist/cjs/utils/sessionListener/SessionListener.js.map +1 -1
- package/dist/cjs/utils/sessionListener/SessionListener.native.js.map +1 -1
- package/dist/cjs/utils/sessionListener/index.js.map +1 -1
- package/dist/esm/BackgroundProcessManager/BackgroundManagerNotOpenError.mjs.map +1 -1
- package/dist/esm/BackgroundProcessManager/BackgroundProcessManager.mjs.map +1 -1
- package/dist/esm/Cache/StorageCache.mjs.map +1 -1
- package/dist/esm/Cache/StorageCache.native.mjs.map +1 -1
- package/dist/esm/Cache/StorageCacheCommon.mjs.map +1 -1
- package/dist/esm/Cache/utils/CacheList.mjs.map +1 -1
- package/dist/esm/Cache/utils/cacheHelpers.mjs.map +1 -1
- package/dist/esm/Hub/index.mjs.map +1 -1
- package/dist/esm/I18n/I18n.mjs.map +1 -1
- package/dist/esm/I18n/index.mjs.map +1 -1
- package/dist/esm/I18n/types.mjs.map +1 -1
- package/dist/esm/Logger/ConsoleLogger.mjs.map +1 -1
- package/dist/esm/Mutex/Mutex.mjs.map +1 -1
- package/dist/esm/Platform/customUserAgent.mjs.map +1 -1
- package/dist/esm/Platform/detectFramework.mjs.map +1 -1
- package/dist/esm/Platform/detection/React.mjs.map +1 -1
- package/dist/esm/Platform/index.mjs.map +1 -1
- package/dist/esm/Platform/version.d.ts +1 -1
- package/dist/esm/Platform/version.mjs +1 -1
- package/dist/esm/Platform/version.mjs.map +1 -1
- package/dist/esm/Reachability/Reachability.mjs.map +1 -1
- package/dist/esm/Reachability/Reachability.native.mjs.map +1 -1
- package/dist/esm/ServiceWorker/ServiceWorker.mjs.map +1 -1
- package/dist/esm/Signer/DateUtils.mjs.map +1 -1
- package/dist/esm/Signer/Signer.mjs.map +1 -1
- package/dist/esm/adapterCore/error/AmplifyServerContextError.mjs.map +1 -1
- package/dist/esm/adapterCore/serverContext/serverContext.mjs.map +1 -1
- package/dist/esm/adapterCore/serverContext/serverContextRegistry.mjs.map +1 -1
- package/dist/esm/awsClients/pinpoint/base.mjs.map +1 -1
- package/dist/esm/awsClients/pinpoint/getInAppMessages.mjs.map +1 -1
- package/dist/esm/awsClients/pinpoint/putEvents.mjs.map +1 -1
- package/dist/esm/awsClients/pinpoint/updateEndpoint.mjs.map +1 -1
- package/dist/esm/clients/endpoints/getDnsSuffix.mjs.map +1 -1
- package/dist/esm/clients/handlers/fetch.mjs.map +1 -1
- package/dist/esm/clients/internal/composeServiceApi.mjs.map +1 -1
- package/dist/esm/clients/internal/composeTransferHandler.mjs.map +1 -1
- package/dist/esm/clients/middleware/retry/amzSdkInvocationIdHeaderMiddleware.mjs.map +1 -1
- package/dist/esm/clients/middleware/retry/amzSdkRequestHeaderMiddleware.mjs.map +1 -1
- package/dist/esm/clients/middleware/retry/retryMiddleware.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/middleware.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/presignUrl.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/signRequest.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.mjs.map +1 -1
- package/dist/esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.mjs.map +1 -1
- package/dist/esm/clients/middleware/userAgent/middleware.mjs.map +1 -1
- package/dist/esm/clients/serde/json.mjs.map +1 -1
- package/dist/esm/clients/utils/memoization.mjs.map +1 -1
- package/dist/esm/errors/APIError.mjs.map +1 -1
- package/dist/esm/errors/AmplifyError.mjs.map +1 -1
- package/dist/esm/errors/PlatformNotSupportedError.mjs.map +1 -1
- package/dist/esm/errors/createAssertionFunction.mjs.map +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs.map +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs.map +1 -1
- package/dist/esm/parseAWSExports.mjs.map +1 -1
- package/dist/esm/parseAmplifyOutputs.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/apis/record.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/apis/updateEndpoint.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/utils/PinpointEventBuffer.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/utils/createEndpointId.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/utils/getEventBuffer.mjs.map +1 -1
- package/dist/esm/providers/pinpoint/utils/resolveEndpointId.mjs.map +1 -1
- package/dist/esm/singleton/Amplify.mjs.map +1 -1
- package/dist/esm/singleton/Auth/index.d.ts +2 -2
- package/dist/esm/singleton/Auth/index.mjs +2 -2
- package/dist/esm/singleton/Auth/index.mjs.map +1 -1
- package/dist/esm/singleton/Auth/utils/index.mjs.map +1 -1
- package/dist/esm/singleton/apis/fetchAuthSession.d.ts +2 -2
- package/dist/esm/singleton/apis/fetchAuthSession.mjs +2 -2
- package/dist/esm/singleton/apis/fetchAuthSession.mjs.map +1 -1
- package/dist/esm/storage/CookieStorage.mjs.map +1 -1
- package/dist/esm/storage/DefaultStorage.mjs.map +1 -1
- package/dist/esm/storage/DefaultStorage.native.mjs.map +1 -1
- package/dist/esm/storage/InMemoryStorage.mjs.map +1 -1
- package/dist/esm/storage/KeyValueStorage.mjs.map +1 -1
- package/dist/esm/storage/SessionStorage.mjs.map +1 -1
- package/dist/esm/storage/SyncKeyValueStorage.mjs.map +1 -1
- package/dist/esm/storage/SyncSessionStorage.mjs.map +1 -1
- package/dist/esm/storage/utils.mjs.map +1 -1
- package/dist/esm/utils/WordArray.mjs.map +1 -1
- package/dist/esm/utils/convert/base64/base64Decoder.mjs.map +1 -1
- package/dist/esm/utils/convert/base64/base64Encoder.mjs.map +1 -1
- package/dist/esm/utils/deDupeAsyncFunction.mjs.map +1 -1
- package/dist/esm/utils/deepFreeze.mjs.map +1 -1
- package/dist/esm/utils/generateRandomString.mjs.map +1 -1
- package/dist/esm/utils/getClientInfo/getClientInfo.ios.mjs.map +1 -1
- package/dist/esm/utils/getClientInfo/getClientInfo.mjs.map +1 -1
- package/dist/esm/utils/globalHelpers/index.mjs.map +1 -1
- package/dist/esm/utils/globalHelpers/index.native.mjs.map +1 -1
- package/dist/esm/utils/isWebWorker.mjs.map +1 -1
- package/dist/esm/utils/parseAmplifyConfig.mjs.map +1 -1
- package/dist/esm/utils/queuedStorage/createQueuedStorage.mjs.map +1 -1
- package/dist/esm/utils/queuedStorage/createQueuedStorage.native.mjs.map +1 -1
- package/dist/esm/utils/retry/NonRetryableError.mjs.map +1 -1
- package/dist/esm/utils/retry/jitteredBackoff.mjs.map +1 -1
- package/dist/esm/utils/retry/retry.mjs.map +1 -1
- package/dist/esm/utils/sessionListener/SessionListener.mjs.map +1 -1
- package/dist/esm/utils/sessionListener/SessionListener.native.mjs.map +1 -1
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/singleton/Auth/index.ts +2 -2
- package/src/singleton/apis/fetchAuthSession.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/I18n/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../Logger';\nimport { I18n as I18nClass } from './I18n';\nimport { I18nErrorCode, assert } from './errorHelpers';\nconst logger = new ConsoleLogger('I18n');\nlet _config = { language: null };\nlet _i18n = null;\n/**\n * Export I18n APIs\n */\nexport class I18n {\n /**\n * @static\n * @method\n * Configure I18n part\n * @param {Object} config - Configuration of the I18n\n */\n static configure(config) {\n logger.debug('configure I18n');\n if (!config) {\n return _config;\n }\n _config = Object.assign({}, _config, config.I18n || config);\n I18n.createInstance();\n return _config;\n }\n static getModuleName() {\n return 'I18n';\n }\n /**\n * @static\n * @method\n * Create an instance of I18n for the library\n */\n static createInstance() {\n logger.debug('create I18n instance');\n if (_i18n) {\n return;\n }\n _i18n = new I18nClass();\n }\n /**\n * @static @method\n * Explicitly setting language\n * @param {String} lang\n */\n static setLanguage(lang) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.setLanguage(lang);\n }\n /**\n * @static @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n static get(key, defVal) {\n if (!I18n.checkConfig()) {\n return typeof defVal === 'undefined' ? key : defVal;\n }\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n return _i18n.get(key, defVal);\n }\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {String} language - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n static putVocabulariesForLanguage(language, vocabularies) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.putVocabulariesForLanguage(language, vocabularies);\n }\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n static putVocabularies(vocabularies) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.putVocabularies(vocabularies);\n }\n static checkConfig() {\n if (!_i18n) {\n I18n.createInstance();\n }\n return true;\n }\n}\n// Create an instance of I18n in the static class\nI18n.createInstance();\n"],"names":["I18nClass"],"mappings":";;;;AAAA;AACA;AAIA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;AACxC,IAAI,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;AAChC,IAAI,KAAK,GAAG,IAAI;AAChB;AACA;AACA;AACO,MAAM,IAAI,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,SAAS,CAAC,MAAM,EAAE;AAC7B,QAAQ,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC;AACtC,QAAQ,IAAI,CAAC,MAAM,EAAE;AACrB,YAAY,OAAO,OAAO;AAC1B;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/I18n/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../Logger';\nimport { I18n as I18nClass } from './I18n';\nimport { I18nErrorCode, assert } from './errorHelpers';\nconst logger = new ConsoleLogger('I18n');\nlet _config = { language: null };\nlet _i18n = null;\n/**\n * Export I18n APIs\n */\nexport class I18n {\n /**\n * @static\n * @method\n * Configure I18n part\n * @param {Object} config - Configuration of the I18n\n */\n static configure(config) {\n logger.debug('configure I18n');\n if (!config) {\n return _config;\n }\n _config = Object.assign({}, _config, config.I18n || config);\n I18n.createInstance();\n return _config;\n }\n static getModuleName() {\n return 'I18n';\n }\n /**\n * @static\n * @method\n * Create an instance of I18n for the library\n */\n static createInstance() {\n logger.debug('create I18n instance');\n if (_i18n) {\n return;\n }\n _i18n = new I18nClass();\n }\n /**\n * @static @method\n * Explicitly setting language\n * @param {String} lang\n */\n static setLanguage(lang) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.setLanguage(lang);\n }\n /**\n * @static @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n static get(key, defVal) {\n if (!I18n.checkConfig()) {\n return typeof defVal === 'undefined' ? key : defVal;\n }\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n return _i18n.get(key, defVal);\n }\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {String} language - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n static putVocabulariesForLanguage(language, vocabularies) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.putVocabulariesForLanguage(language, vocabularies);\n }\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n static putVocabularies(vocabularies) {\n I18n.checkConfig();\n assert(!!_i18n, I18nErrorCode.NotConfigured);\n _i18n.putVocabularies(vocabularies);\n }\n static checkConfig() {\n if (!_i18n) {\n I18n.createInstance();\n }\n return true;\n }\n}\n// Create an instance of I18n in the static class\nI18n.createInstance();\n"],"names":["I18nClass"],"mappings":";;;;AAAA;AACA;AAIA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;AACxC,IAAI,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;AAChC,IAAI,KAAK,GAAG,IAAI;AAChB;AACA;AACA;AACO,MAAM,IAAI,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,SAAS,CAAC,MAAM,EAAE;AAC7B,QAAQ,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC;AACtC,QAAQ,IAAI,CAAC,MAAM,EAAE;AACrB,YAAY,OAAO,OAAO;AAC1B,QAAQ;AACR,QAAQ,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC;AACnE,QAAQ,IAAI,CAAC,cAAc,EAAE;AAC7B,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,OAAO,aAAa,GAAG;AAC3B,QAAQ,OAAO,MAAM;AACrB,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,cAAc,GAAG;AAC5B,QAAQ,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC;AAC5C,QAAQ,IAAI,KAA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AI;AACJ,IAAI,OAAO,WAAW,GAAG;AACzB,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,IAAI,CAAC,cAAc,EAAE;AACjC,QAAQ;AACR,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ;AACA;AACA,IAAI,CAAC,cAAc,EAAE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sources":["../../../src/I18n/types.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport class I18nConfig {\n constructor() {\n this.language = null;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,UAAU,CAAC;AACxB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI;AAC5B;
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../src/I18n/types.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport class I18nConfig {\n constructor() {\n this.language = null;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,UAAU,CAAC;AACxB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,QAAQ,GAAG,IAAI;AAC5B,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLogger.mjs","sources":["../../../src/Logger/ConsoleLogger.ts"],"sourcesContent":["/* eslint-disable no-console */\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AWS_CLOUDWATCH_CATEGORY } from '../constants';\nimport { LogType } from './types';\nconst LOG_LEVELS = {\n VERBOSE: 1,\n DEBUG: 2,\n INFO: 3,\n WARN: 4,\n ERROR: 5,\n NONE: 6,\n};\n/**\n * Write logs\n * @class Logger\n */\nexport class ConsoleLogger {\n /**\n * @constructor\n * @param {string} name - Name of the logger\n */\n constructor(name, level = LogType.WARN) {\n this.name = name;\n this.level = level;\n this._pluggables = [];\n }\n _padding(n) {\n return n < 10 ? '0' + n : '' + n;\n }\n _ts() {\n const dt = new Date();\n return ([this._padding(dt.getMinutes()), this._padding(dt.getSeconds())].join(':') +\n '.' +\n dt.getMilliseconds());\n }\n configure(config) {\n if (!config)\n return this._config;\n this._config = config;\n return this._config;\n }\n /**\n * Write log\n * @method\n * @memeberof Logger\n * @param {LogType|string} type - log type, default INFO\n * @param {string|object} msg - Logging message or object\n */\n _log(type, ...msg) {\n let loggerLevelName = this.level;\n if (ConsoleLogger.LOG_LEVEL) {\n loggerLevelName = ConsoleLogger.LOG_LEVEL;\n }\n if (typeof window !== 'undefined' && window.LOG_LEVEL) {\n loggerLevelName = window.LOG_LEVEL;\n }\n const loggerLevel = LOG_LEVELS[loggerLevelName];\n const typeLevel = LOG_LEVELS[type];\n if (!(typeLevel >= loggerLevel)) {\n // Do nothing if type is not greater than or equal to logger level (handle undefined)\n return;\n }\n let log = console.log.bind(console);\n if (type === LogType.ERROR && console.error) {\n log = console.error.bind(console);\n }\n if (type === LogType.WARN && console.warn) {\n log = console.warn.bind(console);\n }\n if (ConsoleLogger.BIND_ALL_LOG_LEVELS) {\n if (type === LogType.INFO && console.info) {\n log = console.info.bind(console);\n }\n if (type === LogType.DEBUG && console.debug) {\n log = console.debug.bind(console);\n }\n }\n const prefix = `[${type}] ${this._ts()} ${this.name}`;\n let message = '';\n if (msg.length === 1 && typeof msg[0] === 'string') {\n message = `${prefix} - ${msg[0]}`;\n log(message);\n }\n else if (msg.length === 1) {\n message = `${prefix} ${msg[0]}`;\n log(prefix, msg[0]);\n }\n else if (typeof msg[0] === 'string') {\n let obj = msg.slice(1);\n if (obj.length === 1) {\n obj = obj[0];\n }\n message = `${prefix} - ${msg[0]} ${obj}`;\n log(`${prefix} - ${msg[0]}`, obj);\n }\n else {\n message = `${prefix} ${msg}`;\n log(prefix, msg);\n }\n for (const plugin of this._pluggables) {\n const logEvent = { message, timestamp: Date.now() };\n plugin.pushLogs([logEvent]);\n }\n }\n /**\n * Write General log. Default to INFO\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n log(...msg) {\n this._log(LogType.INFO, ...msg);\n }\n /**\n * Write INFO log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n info(...msg) {\n this._log(LogType.INFO, ...msg);\n }\n /**\n * Write WARN log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n warn(...msg) {\n this._log(LogType.WARN, ...msg);\n }\n /**\n * Write ERROR log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n error(...msg) {\n this._log(LogType.ERROR, ...msg);\n }\n /**\n * Write DEBUG log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n debug(...msg) {\n this._log(LogType.DEBUG, ...msg);\n }\n /**\n * Write VERBOSE log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n verbose(...msg) {\n this._log(LogType.VERBOSE, ...msg);\n }\n addPluggable(pluggable) {\n if (pluggable && pluggable.getCategoryName() === AWS_CLOUDWATCH_CATEGORY) {\n this._pluggables.push(pluggable);\n pluggable.configure(this._config);\n }\n }\n listPluggables() {\n return this._pluggables;\n }\n}\nConsoleLogger.LOG_LEVEL = null;\nConsoleLogger.BIND_ALL_LOG_LEVELS = false;\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AAGA,MAAM,UAAU,GAAG;AACnB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,KAAK,EAAE,CAAC;AACZ,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,KAAK,EAAE,CAAC;AACZ,IAAI,IAAI,EAAE,CAAC;AACX,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,aAAa,CAAC;AAC3B;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE;AAC5C,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,WAAW,GAAG,EAAE;AAC7B;
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.mjs","sources":["../../../src/Logger/ConsoleLogger.ts"],"sourcesContent":["/* eslint-disable no-console */\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AWS_CLOUDWATCH_CATEGORY } from '../constants';\nimport { LogType } from './types';\nconst LOG_LEVELS = {\n VERBOSE: 1,\n DEBUG: 2,\n INFO: 3,\n WARN: 4,\n ERROR: 5,\n NONE: 6,\n};\n/**\n * Write logs\n * @class Logger\n */\nexport class ConsoleLogger {\n /**\n * @constructor\n * @param {string} name - Name of the logger\n */\n constructor(name, level = LogType.WARN) {\n this.name = name;\n this.level = level;\n this._pluggables = [];\n }\n _padding(n) {\n return n < 10 ? '0' + n : '' + n;\n }\n _ts() {\n const dt = new Date();\n return ([this._padding(dt.getMinutes()), this._padding(dt.getSeconds())].join(':') +\n '.' +\n dt.getMilliseconds());\n }\n configure(config) {\n if (!config)\n return this._config;\n this._config = config;\n return this._config;\n }\n /**\n * Write log\n * @method\n * @memeberof Logger\n * @param {LogType|string} type - log type, default INFO\n * @param {string|object} msg - Logging message or object\n */\n _log(type, ...msg) {\n let loggerLevelName = this.level;\n if (ConsoleLogger.LOG_LEVEL) {\n loggerLevelName = ConsoleLogger.LOG_LEVEL;\n }\n if (typeof window !== 'undefined' && window.LOG_LEVEL) {\n loggerLevelName = window.LOG_LEVEL;\n }\n const loggerLevel = LOG_LEVELS[loggerLevelName];\n const typeLevel = LOG_LEVELS[type];\n if (!(typeLevel >= loggerLevel)) {\n // Do nothing if type is not greater than or equal to logger level (handle undefined)\n return;\n }\n let log = console.log.bind(console);\n if (type === LogType.ERROR && console.error) {\n log = console.error.bind(console);\n }\n if (type === LogType.WARN && console.warn) {\n log = console.warn.bind(console);\n }\n if (ConsoleLogger.BIND_ALL_LOG_LEVELS) {\n if (type === LogType.INFO && console.info) {\n log = console.info.bind(console);\n }\n if (type === LogType.DEBUG && console.debug) {\n log = console.debug.bind(console);\n }\n }\n const prefix = `[${type}] ${this._ts()} ${this.name}`;\n let message = '';\n if (msg.length === 1 && typeof msg[0] === 'string') {\n message = `${prefix} - ${msg[0]}`;\n log(message);\n }\n else if (msg.length === 1) {\n message = `${prefix} ${msg[0]}`;\n log(prefix, msg[0]);\n }\n else if (typeof msg[0] === 'string') {\n let obj = msg.slice(1);\n if (obj.length === 1) {\n obj = obj[0];\n }\n message = `${prefix} - ${msg[0]} ${obj}`;\n log(`${prefix} - ${msg[0]}`, obj);\n }\n else {\n message = `${prefix} ${msg}`;\n log(prefix, msg);\n }\n for (const plugin of this._pluggables) {\n const logEvent = { message, timestamp: Date.now() };\n plugin.pushLogs([logEvent]);\n }\n }\n /**\n * Write General log. Default to INFO\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n log(...msg) {\n this._log(LogType.INFO, ...msg);\n }\n /**\n * Write INFO log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n info(...msg) {\n this._log(LogType.INFO, ...msg);\n }\n /**\n * Write WARN log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n warn(...msg) {\n this._log(LogType.WARN, ...msg);\n }\n /**\n * Write ERROR log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n error(...msg) {\n this._log(LogType.ERROR, ...msg);\n }\n /**\n * Write DEBUG log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n debug(...msg) {\n this._log(LogType.DEBUG, ...msg);\n }\n /**\n * Write VERBOSE log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n verbose(...msg) {\n this._log(LogType.VERBOSE, ...msg);\n }\n addPluggable(pluggable) {\n if (pluggable && pluggable.getCategoryName() === AWS_CLOUDWATCH_CATEGORY) {\n this._pluggables.push(pluggable);\n pluggable.configure(this._config);\n }\n }\n listPluggables() {\n return this._pluggables;\n }\n}\nConsoleLogger.LOG_LEVEL = null;\nConsoleLogger.BIND_ALL_LOG_LEVELS = false;\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AAGA,MAAM,UAAU,GAAG;AACnB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,KAAK,EAAE,CAAC;AACZ,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,KAAK,EAAE,CAAC;AACZ,IAAI,IAAI,EAAE,CAAC;AACX,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,aAAa,CAAC;AAC3B;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE;AAC5C,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK;AAC1B,QAAQ,IAAI,CAAC,WAAW,GAAG,EAAE;AAC7B,IAAI;AACJ,IAAI,QAAQ,CAAC,CAAC,EAAE;AAChB,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AACxC,IAAI;AACJ,IAAI,GAAG,GAAG;AACV,QAAQ,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE;AAC7B,QAAQ,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1F,YAAY,GAAG;AACf,YAAY,EAAE,CAAC,eAAe,EAAE;AAChC,IAAI;AACJ,IAAI,SAAS,CAAC,MAAM,EA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AK,EAAE,GAAG,GAAG,CAAC;AACxC,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE;AAClB,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC;AACxC,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,GAAG,EAAE;AACpB,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAC1C,IAAI;AACJ,IAAI,YAAY,CAAC,SAAS,EAAE;AAC5B,QAAQ,IAAI,SAAS,IAAI,SAAS,CAAC,eAAe,EAAE,KAAK,uBAAuB,EAAE;AAClF,YAAY,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC;AAC5C,YAAY,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7C,QAAQ;AACR,IAAI;AACJ,IAAI,cAAc,GAAG;AACrB,QAAQ,OAAO,IAAI,CAAC,WAAW;AAC/B,IAAI;AACJ;AACA,aAAa,CAAC,SAAS,GAAG,IAAI;AAC9B,aAAa,CAAC,mBAAmB,GAAG,KAAK;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutex.mjs","sources":["../../../src/Mutex/Mutex.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Christian Speckner <cnspeckn@googlemail.com>\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport class Mutex {\n constructor() {\n this._queue = [];\n this._pending = false;\n }\n isLocked() {\n return this._pending;\n }\n acquire() {\n const ticket = new Promise(resolve => this._queue.push(resolve));\n if (!this._pending) {\n this._dispatchNext();\n }\n return ticket;\n }\n runExclusive(callback) {\n return this.acquire().then(release => {\n let result;\n try {\n result = callback();\n }\n catch (e) {\n release();\n throw e;\n }\n return Promise.resolve(result).then((x) => {\n release();\n return x;\n }, e => {\n release();\n throw e;\n });\n });\n }\n _dispatchNext() {\n if (this._queue.length > 0) {\n this._pending = true;\n this._queue.shift()(this._dispatchNext.bind(this));\n }\n else {\n this._pending = false;\n }\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,KAAK,CAAC;AACnB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE;AACxB,QAAQ,IAAI,CAAC,QAAQ,GAAG,KAAK;AAC7B;
|
|
1
|
+
{"version":3,"file":"Mutex.mjs","sources":["../../../src/Mutex/Mutex.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Christian Speckner <cnspeckn@googlemail.com>\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport class Mutex {\n constructor() {\n this._queue = [];\n this._pending = false;\n }\n isLocked() {\n return this._pending;\n }\n acquire() {\n const ticket = new Promise(resolve => this._queue.push(resolve));\n if (!this._pending) {\n this._dispatchNext();\n }\n return ticket;\n }\n runExclusive(callback) {\n return this.acquire().then(release => {\n let result;\n try {\n result = callback();\n }\n catch (e) {\n release();\n throw e;\n }\n return Promise.resolve(result).then((x) => {\n release();\n return x;\n }, e => {\n release();\n throw e;\n });\n });\n }\n _dispatchNext() {\n if (this._queue.length > 0) {\n this._pending = true;\n this._queue.shift()(this._dispatchNext.bind(this));\n }\n else {\n this._pending = false;\n }\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AQ,GAAG,IAAI;AAChC,YAAY,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9D,QAAQ;AACR,aAAa;AACb,YAAY,IAAI,CAAC,QAAQ,GAAG,KAAK;AACjC,QAAQ;AACR,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customUserAgent.mjs","sources":["../../../src/Platform/customUserAgent.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// Maintains custom user-agent state set by external consumers.\nconst customUserAgentState = {};\n/**\n * Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to\n * clean up any custom state set with this API.\n *\n * @note\n * This API operates globally. Calling this API multiple times will result in the most recently set values for a\n * particular API being used.\n *\n * @note\n * This utility IS NOT compatible with SSR.\n *\n * @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.\n */\nexport const setCustomUserAgent = (input) => {\n // Save custom user-agent state & increment reference counter\n // TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373\n customUserAgentState[input.category] = input.apis.reduce((acc, api) => ({\n ...acc,\n [api]: {\n refCount: acc[api]?.refCount ? acc[api].refCount + 1 : 1,\n additionalDetails: input.additionalDetails,\n },\n }), customUserAgentState[input.category] ?? {});\n // Callback that cleans up state for APIs recorded by this call\n let cleanUpCallbackCalled = false;\n const cleanUpCallback = () => {\n // Only allow the cleanup callback to be called once\n if (cleanUpCallbackCalled) {\n return;\n }\n cleanUpCallbackCalled = true;\n input.apis.forEach(api => {\n const apiRefCount = customUserAgentState[input.category][api].refCount;\n if (apiRefCount > 1) {\n customUserAgentState[input.category][api].refCount = apiRefCount - 1;\n }\n else {\n delete customUserAgentState[input.category][api];\n // Clean up category if no more APIs set\n if (!Object.keys(customUserAgentState[input.category]).length) {\n delete customUserAgentState[input.category];\n }\n }\n });\n };\n return cleanUpCallback;\n};\nexport const getCustomUserAgent = (category, api) => customUserAgentState[category]?.[api]?.additionalDetails;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,EAAE;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C;AACA;AACA,IAAI,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM;AAC5E,QAAQ,GAAG,GAAG;AACd,QAAQ,CAAC,GAAG,GAAG;AACf,YAAY,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC;AACpE,YAAY,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;AACtD,SAAS;AACT,KAAK,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACnD;AACA,IAAI,IAAI,qBAAqB,GAAG,KAAK;AACrC,IAAI,MAAM,eAAe,GAAG,MAAM;AAClC;AACA,QAAQ,IAAI,qBAAqB,EAAE;AACnC,YAAY;AACZ;
|
|
1
|
+
{"version":3,"file":"customUserAgent.mjs","sources":["../../../src/Platform/customUserAgent.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// Maintains custom user-agent state set by external consumers.\nconst customUserAgentState = {};\n/**\n * Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to\n * clean up any custom state set with this API.\n *\n * @note\n * This API operates globally. Calling this API multiple times will result in the most recently set values for a\n * particular API being used.\n *\n * @note\n * This utility IS NOT compatible with SSR.\n *\n * @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.\n */\nexport const setCustomUserAgent = (input) => {\n // Save custom user-agent state & increment reference counter\n // TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373\n customUserAgentState[input.category] = input.apis.reduce((acc, api) => ({\n ...acc,\n [api]: {\n refCount: acc[api]?.refCount ? acc[api].refCount + 1 : 1,\n additionalDetails: input.additionalDetails,\n },\n }), customUserAgentState[input.category] ?? {});\n // Callback that cleans up state for APIs recorded by this call\n let cleanUpCallbackCalled = false;\n const cleanUpCallback = () => {\n // Only allow the cleanup callback to be called once\n if (cleanUpCallbackCalled) {\n return;\n }\n cleanUpCallbackCalled = true;\n input.apis.forEach(api => {\n const apiRefCount = customUserAgentState[input.category][api].refCount;\n if (apiRefCount > 1) {\n customUserAgentState[input.category][api].refCount = apiRefCount - 1;\n }\n else {\n delete customUserAgentState[input.category][api];\n // Clean up category if no more APIs set\n if (!Object.keys(customUserAgentState[input.category]).length) {\n delete customUserAgentState[input.category];\n }\n }\n });\n };\n return cleanUpCallback;\n};\nexport const getCustomUserAgent = (category, api) => customUserAgentState[category]?.[api]?.additionalDetails;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,EAAE;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK;AAC7C;AACA;AACA,IAAI,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM;AAC5E,QAAQ,GAAG,GAAG;AACd,QAAQ,CAAC,GAAG,GAAG;AACf,YAAY,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC;AACpE,YAAY,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;AACtD,SAAS;AACT,KAAK,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACnD;AACA,IAAI,IAAI,qBAAqB,GAAG,KAAK;AACrC,IAAI,MAAM,eAAe,GAAG,MAAM;AAClC;AACA,QAAQ,IAAI,qBAAqB,EAAE;AACnC,YAAY;AACZ,QAAQ;AACR,QAAQ,qBAAqB,GAAG,IAAI;AACpC,QAAQ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;AAClC,YAAY,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ;AAClF,YAAY,IAAI,WAAW,GAAG,CAAC,EAAE;AACjC,gBAAgB,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,WAAW,GAAG,CAAC;AACpF,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,OAAO,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC;AAChE;AACA,gBAAgB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE;AAC/E,oBAAoB,OAAO,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC;AAC/D,gBAAgB;AAChB,YAAY;AACZ,QAAQ,CAAC,CAAC;AACV,IAAI,CAAC;AACL,IAAI,OAAO,eAAe;AAC1B;AACY,MAAC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,oBAAoB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,EAAE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectFramework.mjs","sources":["../../../src/Platform/detectFramework.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Framework } from './types';\nimport { detect } from './detection';\n// We want to cache detection since the framework won't change\nlet frameworkCache;\nexport const frameworkChangeObservers = [];\n// Setup the detection reset tracking / timeout delays\nlet resetTriggered = false;\nconst SSR_RESET_TIMEOUT = 10; // ms\nconst WEB_RESET_TIMEOUT = 10; // ms\nconst PRIME_FRAMEWORK_DELAY = 1000; // ms\nexport const detectFramework = () => {\n if (!frameworkCache) {\n frameworkCache = detect();\n if (resetTriggered) {\n // The final run of detectFramework:\n // Starting from this point, the `frameworkCache` becomes \"final\".\n // So we don't need to notify the observers again so the observer\n // can be removed after the final notice.\n while (frameworkChangeObservers.length) {\n frameworkChangeObservers.pop()?.();\n }\n }\n else {\n // The first run of detectFramework:\n // Every time we update the cache, call each observer function\n frameworkChangeObservers.forEach(fcn => {\n fcn();\n });\n }\n // Retry once for either Unknown type after a delay (explained below)\n resetTimeout(Framework.ServerSideUnknown, SSR_RESET_TIMEOUT);\n resetTimeout(Framework.WebUnknown, WEB_RESET_TIMEOUT);\n }\n return frameworkCache;\n};\n/**\n * @internal Setup observer callback that will be called everytime the framework changes\n */\nexport const observeFrameworkChanges = (fcn) => {\n // When the `frameworkCache` won't be updated again, we ignore all incoming\n // observers.\n if (resetTriggered) {\n return;\n }\n frameworkChangeObservers.push(fcn);\n};\nexport function clearCache() {\n frameworkCache = undefined;\n}\n// For a framework type and a delay amount, setup the event to re-detect\n// During the runtime boot, it is possible that framework detection will\n// be triggered before the framework has made modifications to the\n// global/window/etc needed for detection. When no framework is detected\n// we will reset and try again to ensure we don't use a cached\n// non-framework detection result for all requests.\nfunction resetTimeout(framework, delay) {\n if (frameworkCache === framework && !resetTriggered) {\n setTimeout(() => {\n clearCache();\n resetTriggered = true;\n setTimeout(detectFramework, PRIME_FRAMEWORK_DELAY);\n }, delay);\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA,IAAI,cAAc;AACN,MAAC,wBAAwB,GAAG;AACxC;AACA,IAAI,cAAc,GAAG,KAAK;AAC1B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACvB,MAAC,eAAe,GAAG,MAAM;AACrC,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB,QAAQ,cAAc,GAAG,MAAM,EAAE;AACjC,QAAQ,IAAI,cAAc,EAAE;AAC5B;AACA;AACA;AACA;AACA,YAAY,OAAO,wBAAwB,CAAC,MAAM,EAAE;AACpD,gBAAgB,wBAAwB,CAAC,GAAG,EAAE,IAAI;AAClD;
|
|
1
|
+
{"version":3,"file":"detectFramework.mjs","sources":["../../../src/Platform/detectFramework.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Framework } from './types';\nimport { detect } from './detection';\n// We want to cache detection since the framework won't change\nlet frameworkCache;\nexport const frameworkChangeObservers = [];\n// Setup the detection reset tracking / timeout delays\nlet resetTriggered = false;\nconst SSR_RESET_TIMEOUT = 10; // ms\nconst WEB_RESET_TIMEOUT = 10; // ms\nconst PRIME_FRAMEWORK_DELAY = 1000; // ms\nexport const detectFramework = () => {\n if (!frameworkCache) {\n frameworkCache = detect();\n if (resetTriggered) {\n // The final run of detectFramework:\n // Starting from this point, the `frameworkCache` becomes \"final\".\n // So we don't need to notify the observers again so the observer\n // can be removed after the final notice.\n while (frameworkChangeObservers.length) {\n frameworkChangeObservers.pop()?.();\n }\n }\n else {\n // The first run of detectFramework:\n // Every time we update the cache, call each observer function\n frameworkChangeObservers.forEach(fcn => {\n fcn();\n });\n }\n // Retry once for either Unknown type after a delay (explained below)\n resetTimeout(Framework.ServerSideUnknown, SSR_RESET_TIMEOUT);\n resetTimeout(Framework.WebUnknown, WEB_RESET_TIMEOUT);\n }\n return frameworkCache;\n};\n/**\n * @internal Setup observer callback that will be called everytime the framework changes\n */\nexport const observeFrameworkChanges = (fcn) => {\n // When the `frameworkCache` won't be updated again, we ignore all incoming\n // observers.\n if (resetTriggered) {\n return;\n }\n frameworkChangeObservers.push(fcn);\n};\nexport function clearCache() {\n frameworkCache = undefined;\n}\n// For a framework type and a delay amount, setup the event to re-detect\n// During the runtime boot, it is possible that framework detection will\n// be triggered before the framework has made modifications to the\n// global/window/etc needed for detection. When no framework is detected\n// we will reset and try again to ensure we don't use a cached\n// non-framework detection result for all requests.\nfunction resetTimeout(framework, delay) {\n if (frameworkCache === framework && !resetTriggered) {\n setTimeout(() => {\n clearCache();\n resetTriggered = true;\n setTimeout(detectFramework, PRIME_FRAMEWORK_DELAY);\n }, delay);\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA,IAAI,cAAc;AACN,MAAC,wBAAwB,GAAG;AACxC;AACA,IAAI,cAAc,GAAG,KAAK;AAC1B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACvB,MAAC,eAAe,GAAG,MAAM;AACrC,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB,QAAQ,cAAc,GAAG,MAAM,EAAE;AACjC,QAAQ,IAAI,cAAc,EAAE;AAC5B;AACA;AACA;AACA;AACA,YAAY,OAAO,wBAAwB,CAAC,MAAM,EAAE;AACpD,gBAAgB,wBAAwB,CAAC,GAAG,EAAE,IAAI;AAClD,YAAY;AACZ,QAAQ;AACR,aAAa;AACb;AACA;AACA,YAAY,wBAAwB,CAAC,OAAO,CAAC,GAAG,IAAI;AACpD,gBAAgB,GAAG,EAAE;AACrB,YAAY,CAAC,CAAC;AACd,QAAQ;AACR;AACA,QAAQ,YAAY,CAAC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;AACpE,QAAQ,YAAY,CAAC,SAAS,CAAC,UAAU,EAAE,iBAAiB,CAAC;AAC7D,IAAI;AACJ,IAAI,OAAO,cAAc;AACzB;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,CAAC,GAAG,KAAK;AAChD;AACA;AACA,IAAI,IAAI,cAAc,EAAE;AACxB,QAAQ;AACR,IAAI;AACJ,IAAI,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC;AACtC;AACO,SAAS,UAAU,GAAG;AAC7B,IAAI,cAAc,GAAG,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE;AACxC,IAAI,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,cAAc,EAAE;AACzD,QAAQ,UAAU,CAAC,MAAM;AACzB,YAAY,UAAU,EAAE;AACxB,YAAY,cAAc,GAAG,IAAI;AACjC,YAAY,UAAU,CAAC,eAAe,EAAE,qBAAqB,CAAC;AAC9D,QAAQ,CAAC,EAAE,KAAK,CAAC;AACjB,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"React.mjs","sources":["../../../../src/Platform/detection/React.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { documentExists, processExists } from './helpers';\n// Tested with react 18.2 - built using Vite\nexport function reactWebDetect() {\n const elementKeyPrefixedWithReact = (key) => {\n return key.startsWith('_react') || key.startsWith('__react');\n };\n const elementIsReactEnabled = (element) => {\n return Object.keys(element).find(elementKeyPrefixedWithReact);\n };\n const allElementsWithId = () => Array.from(document.querySelectorAll('[id]'));\n return documentExists() && allElementsWithId().some(elementIsReactEnabled);\n}\nexport function reactSSRDetect() {\n return (processExists() &&\n typeof process.env !== 'undefined' &&\n !!Object.keys(process.env).find(key => key.includes('react')));\n}\n// use the some\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACO,SAAS,cAAc,GAAG;AACjC,IAAI,MAAM,2BAA2B,GAAG,CAAC,GAAG,KAAK;AACjD,QAAQ,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;AACpE,
|
|
1
|
+
{"version":3,"file":"React.mjs","sources":["../../../../src/Platform/detection/React.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { documentExists, processExists } from './helpers';\n// Tested with react 18.2 - built using Vite\nexport function reactWebDetect() {\n const elementKeyPrefixedWithReact = (key) => {\n return key.startsWith('_react') || key.startsWith('__react');\n };\n const elementIsReactEnabled = (element) => {\n return Object.keys(element).find(elementKeyPrefixedWithReact);\n };\n const allElementsWithId = () => Array.from(document.querySelectorAll('[id]'));\n return documentExists() && allElementsWithId().some(elementIsReactEnabled);\n}\nexport function reactSSRDetect() {\n return (processExists() &&\n typeof process.env !== 'undefined' &&\n !!Object.keys(process.env).find(key => key.includes('react')));\n}\n// use the some\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACO,SAAS,cAAc,GAAG;AACjC,IAAI,MAAM,2BAA2B,GAAG,CAAC,GAAG,KAAK;AACjD,QAAQ,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;AACpE,IAAI,CAAC;AACL,IAAI,MAAM,qBAAqB,GAAG,CAAC,OAAO,KAAK;AAC/C,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC;AACrE,IAAI,CAAC;AACL,IAAI,MAAM,iBAAiB,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACjF,IAAI,OAAO,cAAc,EAAE,IAAI,iBAAiB,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC;AAC9E;AACO,SAAS,cAAc,GAAG;AACjC,IAAI,QAAQ,aAAa,EAAE;AAC3B,QAAQ,OAAO,OAAO,CAAC,GAAG,KAAK,WAAW;AAC1C,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACrE;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/Platform/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Framework } from './types';\nimport { version } from './version';\nimport { detectFramework, observeFrameworkChanges } from './detectFramework';\nimport { getCustomUserAgent } from './customUserAgent';\nconst BASE_USER_AGENT = `aws-amplify`;\n/** Sanitize Amplify version string be removing special character + and character post the special character */\nexport const sanitizeAmplifyVersion = (amplifyVersion) => amplifyVersion.replace(/\\+.*/, '');\nclass PlatformBuilder {\n constructor() {\n this.userAgent = `${BASE_USER_AGENT}/${sanitizeAmplifyVersion(version)}`;\n }\n get framework() {\n return detectFramework();\n }\n get isReactNative() {\n return (this.framework === Framework.ReactNative ||\n this.framework === Framework.Expo);\n }\n observeFrameworkChanges(fcn) {\n observeFrameworkChanges(fcn);\n }\n}\nexport const Platform = new PlatformBuilder();\nexport const getAmplifyUserAgentObject = ({ category, action, } = {}) => {\n const userAgent = [\n [BASE_USER_AGENT, sanitizeAmplifyVersion(version)],\n ];\n if (category) {\n userAgent.push([category, action]);\n }\n userAgent.push(['framework', detectFramework()]);\n if (category && action) {\n const customState = getCustomUserAgent(category, action);\n if (customState) {\n customState.forEach(state => {\n userAgent.push(state);\n });\n }\n }\n return userAgent;\n};\nexport const getAmplifyUserAgent = (customUserAgentDetails) => {\n const userAgent = getAmplifyUserAgentObject(customUserAgentDetails);\n const userAgentString = userAgent\n .map(([agentKey, agentValue]) => agentKey && agentValue ? `${agentKey}/${agentValue}` : agentKey)\n .join(' ');\n return userAgentString;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA,MAAM,eAAe,GAAG,CAAC,WAAW,CAAC;AACrC;AACY,MAAC,sBAAsB,GAAG,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;AAC3F,MAAM,eAAe,CAAC;AACtB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC;AAChF;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/Platform/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Framework } from './types';\nimport { version } from './version';\nimport { detectFramework, observeFrameworkChanges } from './detectFramework';\nimport { getCustomUserAgent } from './customUserAgent';\nconst BASE_USER_AGENT = `aws-amplify`;\n/** Sanitize Amplify version string be removing special character + and character post the special character */\nexport const sanitizeAmplifyVersion = (amplifyVersion) => amplifyVersion.replace(/\\+.*/, '');\nclass PlatformBuilder {\n constructor() {\n this.userAgent = `${BASE_USER_AGENT}/${sanitizeAmplifyVersion(version)}`;\n }\n get framework() {\n return detectFramework();\n }\n get isReactNative() {\n return (this.framework === Framework.ReactNative ||\n this.framework === Framework.Expo);\n }\n observeFrameworkChanges(fcn) {\n observeFrameworkChanges(fcn);\n }\n}\nexport const Platform = new PlatformBuilder();\nexport const getAmplifyUserAgentObject = ({ category, action, } = {}) => {\n const userAgent = [\n [BASE_USER_AGENT, sanitizeAmplifyVersion(version)],\n ];\n if (category) {\n userAgent.push([category, action]);\n }\n userAgent.push(['framework', detectFramework()]);\n if (category && action) {\n const customState = getCustomUserAgent(category, action);\n if (customState) {\n customState.forEach(state => {\n userAgent.push(state);\n });\n }\n }\n return userAgent;\n};\nexport const getAmplifyUserAgent = (customUserAgentDetails) => {\n const userAgent = getAmplifyUserAgentObject(customUserAgentDetails);\n const userAgentString = userAg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Q,MAAM,WAAW,GAAG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC;AAChE,QAAQ,IAAI,WAAW,EAAE;AACzB,YAAY,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI;AACzC,gBAAgB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AACrC,YAAY,CAAC,CAAC;AACd,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,SAAS;AACpB;AACY,MAAC,mBAAmB,GAAG,CAAC,sBAAsB,KAAK;AAC/D,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,sBAAsB,CAAC;AACvE,IAAI,MAAM,eAAe,GAAG;AAC5B,SAAS,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,QAAQ,IAAI,UAAU,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,QAAQ;AACxG,SAAS,IAAI,CAAC,GAAG,CAAC;AAClB,IAAI,OAAO,eAAe;AAC1B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.15.4
|
|
1
|
+
export declare const version = "6.15.4";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.15.4
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.15.4';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reachability.mjs","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, from } from 'rxjs';\nimport { isWebWorker } from '../utils';\nexport class Reachability {\n networkMonitor(_) {\n const globalObj = isWebWorker()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return from([{ online: true }]);\n }\n return new Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => {\n observer.next({ online: true });\n };\n const notifyOffline = () => {\n observer.next({ online: false });\n };\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAGO,MAAM,YAAY,CAAC;AAC1B,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,WAAW;AACrC,cAAc;AACd,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM;AACrD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3C;
|
|
1
|
+
{"version":3,"file":"Reachability.mjs","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, from } from 'rxjs';\nimport { isWebWorker } from '../utils';\nexport class Reachability {\n networkMonitor(_) {\n const globalObj = isWebWorker()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return from([{ online: true }]);\n }\n return new Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => {\n observer.next({ online: true });\n };\n const notifyOffline = () => {\n observer.next({ online: false });\n };\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAGO,MAAM,YAAY,CAAC;AAC1B,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,WAAW;AACrC,cAAc;AACd,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM;AACrD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3C,QAAQ;AACR,QAAQ,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAI;AAC1C,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;AACjE,YAAY,MAAM,YAAY,GAAG,MAAM;AACvC,gBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC/C,YAAY,CAAC;AACb,YAAY,MAAM,aAAa,GAAG,MAAM;AACxC,gBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAChD,YAAY,CAAC;AACb,YAAY,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC;AAC9D,YAAY,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC;AAChE,YAAY,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;AAClD,YAAY,OAAO,MAAM;AACzB,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC;AACrE,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC;AACvE,gBAAgB,YAAY,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC;AAC7G,YAAY,CAAC;AACb,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;AACA,IAAI,OAAO,iBAAiB,CAAC,MAAM,EAAE;AACrC,QAAQ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AAChD,YAAY,IAAI,QAAQ,CAAC,MAAM,EAAE;AACjC,gBAAgB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC;AAC7F,gBAAgB;AAChB,YAAY;AACZ,YAAY,QAAQ,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;AACnD,QAAQ;AACR,IAAI;AACJ;AACA,YAAY,CAAC,UAAU,GAAG,EAAE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reachability.native.mjs","sources":["../../../src/Reachability/Reachability.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable } from 'rxjs';\nimport { ConsoleLogger } from '../Logger';\nconst logger = new ConsoleLogger('Reachability', 'DEBUG');\nexport class Reachability {\n networkMonitor(netInfo) {\n /**\n * Here netinfo refers to @react-native-community/netinfo\n * This is needed in React Native to enable network detection\n * We do not import it in Core so that Apps that do not use DataStore\n * Do not need to install and link this dependency\n * When using Reachability in React Native, pass NetInfo as a param to networkMonitor\n */\n if (!(netInfo && netInfo.addEventListener)) {\n throw new Error('NetInfo must be passed to networkMonitor to enable reachability in React Native');\n }\n return new Observable(observer => {\n logger.log('subscribing to reachability in React Native');\n const unsubscribe = netInfo.addEventListener(({ isInternetReachable }) => {\n // `isInternetReachable` can sometimes be `null` initially, so we want\n // to make sure it is a boolean first before sending it to the observer.\n if (typeof isInternetReachable === 'boolean') {\n const online = isInternetReachable;\n logger.log('Notifying reachability change', online);\n observer.next({ online });\n }\n });\n return () => {\n unsubscribe();\n };\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,cAAc,EAAE,OAAO,CAAC;AAClD,MAAM,YAAY,CAAC;AAC1B,IAAI,cAAc,CAAC,OAAO,EAAE;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAI,EAAE,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,EAAE;AACpD,YAAY,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC;AAC9G;
|
|
1
|
+
{"version":3,"file":"Reachability.native.mjs","sources":["../../../src/Reachability/Reachability.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable } from 'rxjs';\nimport { ConsoleLogger } from '../Logger';\nconst logger = new ConsoleLogger('Reachability', 'DEBUG');\nexport class Reachability {\n networkMonitor(netInfo) {\n /**\n * Here netinfo refers to @react-native-community/netinfo\n * This is needed in React Native to enable network detection\n * We do not import it in Core so that Apps that do not use DataStore\n * Do not need to install and link this dependency\n * When using Reachability in React Native, pass NetInfo as a param to networkMonitor\n */\n if (!(netInfo && netInfo.addEventListener)) {\n throw new Error('NetInfo must be passed to networkMonitor to enable reachability in React Native');\n }\n return new Observable(observer => {\n logger.log('subscribing to reachability in React Native');\n const unsubscribe = netInfo.addEventListener(({ isInternetReachable }) => {\n // `isInternetReachable` can sometimes be `null` initially, so we want\n // to make sure it is a boolean first before sending it to the observer.\n if (typeof isInternetReachable === 'boolean') {\n const online = isInternetReachable;\n logger.log('Notifying reachability change', online);\n observer.next({ online });\n }\n });\n return () => {\n unsubscribe();\n };\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,cAAc,EAAE,OAAO,CAAC;AAClD,MAAM,YAAY,CAAC;AAC1B,IAAI,cAAc,CAAC,OAAO,EAAE;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,IAAI,EAAE,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,EAAE;AACpD,YAAY,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC;AAC9G,QAAQ;AACR,QAAQ,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAI;AAC1C,YAAY,MAAM,CAAC,GAAG,CAAC,6CAA6C,CAAC;AACrE,YAAY,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK;AACtF;AACA;AACA,gBAAgB,IAAI,OAAO,mBAAmB,KAAK,SAAS,EAAE;AAC9D,oBAAoB,MAAM,MAAM,GAAG,mBAAmB;AACtD,oBAAoB,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC;AACvE,oBAAoB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;AAC7C,gBAAgB;AAChB,YAAY,CAAC,CAAC;AACd,YAAY,OAAO,MAAM;AACzB,gBAAgB,WAAW,EAAE;AAC7B,YAAY,CAAC;AACb,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceWorker.mjs","sources":["../../../src/ServiceWorker/ServiceWorker.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../Logger';\nimport { isBrowser } from '../utils';\nimport { AmplifyError } from '../errors';\nimport { record } from '../providers/pinpoint';\nimport { Amplify, fetchAuthSession } from '../singleton';\nimport { ServiceWorkerErrorCode, assert } from './errorHelpers';\n/**\n * Provides a means to registering a service worker in the browser\n * and communicating with it via postMessage events.\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/\n *\n * postMessage events are currently not supported in all browsers. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n *\n * At the minmum this class will register the service worker and listen\n * and attempt to dispatch messages on state change and record analytics\n * events based on the service worker lifecycle.\n */\nexport class ServiceWorkerClass {\n constructor() {\n // The AWS Amplify logger\n this._logger = new ConsoleLogger('ServiceWorker');\n }\n /**\n * Get the currently active service worker\n */\n get serviceWorker() {\n assert(this._serviceWorker !== undefined, ServiceWorkerErrorCode.UndefinedInstance);\n return this._serviceWorker;\n }\n /**\n * Register the service-worker.js file in the browser\n * Make sure the service-worker.js is part of the build\n * for example with Angular, modify the angular-cli.json file\n * and add to \"assets\" array \"service-worker.js\"\n * @param {string} filePath Service worker file. Defaults to \"/service-worker.js\"\n * @param {string} scope The service worker scope. Defaults to \"/\"\n * - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n * @returns {Promise}\n *\t- resolve(ServiceWorkerRegistration)\n *\t- reject(Error)\n **/\n register(filePath = '/service-worker.js', scope = '/') {\n this._logger.debug(`registering ${filePath}`);\n this._logger.debug(`registering service worker with scope ${scope}`);\n return new Promise((resolve, reject) => {\n if (navigator && 'serviceWorker' in navigator) {\n navigator.serviceWorker\n .register(filePath, {\n scope,\n })\n .then(registration => {\n if (registration.installing) {\n this._serviceWorker = registration.installing;\n }\n else if (registration.waiting) {\n this._serviceWorker = registration.waiting;\n }\n else if (registration.active) {\n this._serviceWorker = registration.active;\n }\n this._registration = registration;\n this._setupListeners();\n this._logger.debug(`Service Worker Registration Success: ${registration}`);\n resolve(registration);\n })\n .catch(error => {\n this._logger.debug(`Service Worker Registration Failed ${error}`);\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n underlyingError: error,\n }));\n });\n }\n else {\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Enable web push notifications. If not subscribed, a new subscription will\n * be created and registered.\n * \tTest Push Server: https://web-push-codelab.glitch.me/\n * \tPush Server Libraries: https://github.com/web-push-libs/\n * \tAPI Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/\n * @param publicKey\n * @returns {Promise}\n * \t- resolve(PushSubscription)\n * - reject(Error)\n */\n enablePush(publicKey) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._publicKey = publicKey;\n return new Promise((resolve, reject) => {\n if (isBrowser()) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._registration.pushManager.getSubscription().then(subscription => {\n if (subscription) {\n this._subscription = subscription;\n this._logger.debug(`User is subscribed to push: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n }\n else {\n this._logger.debug(`User is NOT subscribed to push`);\n return this._registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this._urlB64ToUint8Array(publicKey),\n })\n .then(pushManagerSubscription => {\n this._subscription = pushManagerSubscription;\n this._logger.debug(`User subscribed: ${JSON.stringify(pushManagerSubscription)}`);\n resolve(pushManagerSubscription);\n })\n .catch(error => {\n this._logger.error(error);\n });\n }\n });\n }\n else {\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Convert a base64 encoded string to a Uint8 array for the push server key\n * @param base64String\n */\n _urlB64ToUint8Array(base64String) {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding)\n .replace(/-/g, '+')\n .replace(/_/g, '/');\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n }\n /**\n * Send a message to the service worker. The service worker needs\n * to implement `self.addEventListener('message') to handle the\n * message. This ***currently*** does not work in Safari or IE.\n * @param {object | string} message An arbitrary JSON object or string message to send to the service worker\n *\t- see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n * @returns {Promise}\n **/\n send(message) {\n if (this._serviceWorker) {\n this._serviceWorker.postMessage(typeof message === 'object' ? JSON.stringify(message) : message);\n }\n }\n /**\n * Listen for service worker state change and message events\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state\n **/\n _setupListeners() {\n this.serviceWorker.addEventListener('statechange', async () => {\n const currentState = this.serviceWorker.state;\n this._logger.debug(`ServiceWorker statechange: ${currentState}`);\n const { appId, region, bufferSize, flushInterval, flushSize, resendLimit, } = Amplify.getConfig().Analytics?.Pinpoint ?? {};\n const { credentials } = await fetchAuthSession();\n if (appId && region && credentials) {\n // Pinpoint is configured, record an event\n record({\n appId,\n region,\n category: 'Core',\n credentials,\n bufferSize,\n flushInterval,\n flushSize,\n resendLimit,\n event: {\n name: 'ServiceWorker',\n attributes: {\n state: currentState,\n },\n },\n });\n }\n });\n this.serviceWorker.addEventListener('message', event => {\n this._logger.debug(`ServiceWorker message event: ${event}`);\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,GAAG;AAClB;AACA,QAAQ,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,eAAe,CAAC;AACzD;AACA;AACA;AACA;AACA,IAAI,IAAI,aAAa,GAAG;AACxB,QAAQ,MAAM,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,sBAAsB,CAAC,iBAAiB,CAAC;AAC3F,QAAQ,OAAO,IAAI,CAAC,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MAAM;AAC1B,oBAAoB,QAAQ,EAAE,MAAM;AACpC,oBAAoB,WAAW;AAC/B,oBAAoB,UAAU;AAC9B,oBAAoB,aAAa;AACjC,oBAAoB,SAAS;AAC7B,oBAAoB,WAAW;AAC/B,oBAAoB,KAAK,EAAE;AAC3B,wBAAwB,IAAI,EAAE,eAAe;AAC7C,wBAAwB,UAAU,EAAE;AACpC,4BAA4B,KAAK,EAAE,YAAY;AAC/C,yBAAyB;AACzB,qBAAqB;AACrB,iBAAiB,CAAC;AAClB;AACA,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,IAAI;AAChE,YAAY,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC,CAAC;AACvE,SAAS,CAAC;AACV;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"ServiceWorker.mjs","sources":["../../../src/ServiceWorker/ServiceWorker.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../Logger';\nimport { isBrowser } from '../utils';\nimport { AmplifyError } from '../errors';\nimport { record } from '../providers/pinpoint';\nimport { Amplify, fetchAuthSession } from '../singleton';\nimport { ServiceWorkerErrorCode, assert } from './errorHelpers';\n/**\n * Provides a means to registering a service worker in the browser\n * and communicating with it via postMessage events.\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/\n *\n * postMessage events are currently not supported in all browsers. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n *\n * At the minmum this class will register the service worker and listen\n * and attempt to dispatch messages on state change and record analytics\n * events based on the service worker lifecycle.\n */\nexport class ServiceWorkerClass {\n constructor() {\n // The AWS Amplify logger\n this._logger = new ConsoleLogger('ServiceWorker');\n }\n /**\n * Get the currently active service worker\n */\n get serviceWorker() {\n assert(this._serviceWorker !== undefined, ServiceWorkerErrorCode.UndefinedInstance);\n return this._serviceWorker;\n }\n /**\n * Register the service-worker.js file in the browser\n * Make sure the service-worker.js is part of the build\n * for example with Angular, modify the angular-cli.json file\n * and add to \"assets\" array \"service-worker.js\"\n * @param {string} filePath Service worker file. Defaults to \"/service-worker.js\"\n * @param {string} scope The service worker scope. Defaults to \"/\"\n * - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n * @returns {Promise}\n *\t- resolve(ServiceWorkerRegistration)\n *\t- reject(Error)\n **/\n register(filePath = '/service-worker.js', scope = '/') {\n this._logger.debug(`registering ${filePath}`);\n this._logger.debug(`registering service worker with scope ${scope}`);\n return new Promise((resolve, reject) => {\n if (navigator && 'serviceWorker' in navigator) {\n navigator.serviceWorker\n .register(filePath, {\n scope,\n })\n .then(registration => {\n if (registration.installing) {\n this._serviceWorker = registration.installing;\n }\n else if (registration.waiting) {\n this._serviceWorker = registration.waiting;\n }\n else if (registration.active) {\n this._serviceWorker = registration.active;\n }\n this._registration = registration;\n this._setupListeners();\n this._logger.debug(`Service Worker Registration Success: ${registration}`);\n resolve(registration);\n })\n .catch(error => {\n this._logger.debug(`Service Worker Registration Failed ${error}`);\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n underlyingError: error,\n }));\n });\n }\n else {\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Enable web push notifications. If not subscribed, a new subscription will\n * be created and registered.\n * \tTest Push Server: https://web-push-codelab.glitch.me/\n * \tPush Server Libraries: https://github.com/web-push-libs/\n * \tAPI Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/\n * @param publicKey\n * @returns {Promise}\n * \t- resolve(PushSubscription)\n * - reject(Error)\n */\n enablePush(publicKey) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._publicKey = publicKey;\n return new Promise((resolve, reject) => {\n if (isBrowser()) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._registration.pushManager.getSubscription().then(subscription => {\n if (subscription) {\n this._subscription = subscription;\n this._logger.debug(`User is subscribed to push: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n }\n else {\n this._logger.debug(`User is NOT subscribed to push`);\n return this._registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this._urlB64ToUint8Array(publicKey),\n })\n .then(pushManagerSubscription => {\n this._subscription = pushManagerSubscription;\n this._logger.debug(`User subscribed: ${JSON.stringify(pushManagerSubscription)}`);\n resolve(pushManagerSubscription);\n })\n .catch(error => {\n this._logger.error(error);\n });\n }\n });\n }\n else {\n reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Convert a base64 encoded string to a Uint8 array for the push server key\n * @param base64String\n */\n _urlB64ToUint8Array(base64String) {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding)\n .replace(/-/g, '+')\n .replace(/_/g, '/');\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n }\n /**\n * Send a message to the service worker. The service worker needs\n * to implement `self.addEventListener('message') to handle the\n * message. This ***currently*** does not work in Safari or IE.\n * @param {object | string} message An arbitrary JSON object or string message to send to the service worker\n *\t- see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n * @returns {Promise}\n **/\n send(message) {\n if (this._serviceWorker) {\n this._serviceWorker.postMessage(typeof message === 'object' ? JSON.stringify(message) : message);\n }\n }\n /**\n * Listen for service worker state change and message events\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state\n **/\n _setupListeners() {\n this.serviceWorker.addEventListener('statechange', async () => {\n const currentState = this.serviceWorker.state;\n this._logger.debug(`ServiceWorker statechange: ${currentState}`);\n const { appId, region, bufferSize, flushInterval, flushSize, resendLimit, } = Amplify.getConfig().Analytics?.Pinpoint ?? {};\n const { credentials } = await fetchAuthSession();\n if (appId && region && credentials) {\n // Pinpoint is configured, record an event\n record({\n appId,\n region,\n category: 'Core',\n credentials,\n bufferSize,\n flushInterval,\n flushSize,\n resendLimit,\n event: {\n name: 'ServiceWorker',\n attributes: {\n state: currentState,\n },\n },\n });\n }\n });\n this.serviceWorker.addEventListener('message', event => {\n this._logger.debug(`ServiceWorker message event: ${event}`);\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,GAAG;AAClB;AACA,QAAQ,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,eAAe,CAAC;AACzD,IAAI;AACJ;AACA;AACA;AACA,IAAI,IAAI,aAAa,GAAG;AACxB,QAAQ,MAAM,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,sBAAsB,CAAC,iBAAiB,CAAC;AAC3F,QAAQ,OAAO,IAAI,CAAC,cAAc;AAClC,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,CAAC,QAAQ,GAAG,oBAAoB,EAAE,KAAK,GAAG,GAAG,EAAE;AAC3D,QAAQ,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AACrD,QAAQ,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,IAAI,SAAS,IAAI,eAAe,IAAI,SAAS,EAAE;AAC3D,gBAAgB,SAAS,C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AAC;AAClB,YAAY;AACZ,QAAQ,CAAC,CAAC;AACV,QAAQ,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,IAAI;AAChE,YAAY,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC,CAAC;AACvE,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateUtils.mjs","sources":["../../../src/Signer/DateUtils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Date & time utility functions to abstract the `aws-sdk` away from users.\n * (v2 => v3 modularization is a breaking change)\n *\n * @see https://github.com/aws/aws-sdk-js/blob/6edf586dcc1de7fe8fbfbbd9a0d2b1847921e6e1/lib/util.js#L262\n */\nconst FIVE_MINUTES_IN_MS = 1000 * 60 * 5;\n/**\n * This utility is intended to be deprecated and replaced by `signRequest` and `presignUrl` functions from\n * `clients/middleware/signing/signer/signatureV4`.\n *\n * TODO: refactor the logics here into `signRequest` and `presignUrl` functions and remove this class.\n *\n * @internal\n * @deprecated\n */\nexport const DateUtils = {\n /**\n * Milliseconds to offset the date to compensate for clock skew between device & services\n */\n clockOffset: 0,\n getDateWithClockOffset() {\n if (DateUtils.clockOffset) {\n return new Date(new Date().getTime() + DateUtils.clockOffset);\n }\n else {\n return new Date();\n }\n },\n /**\n * @returns {number} Clock offset in milliseconds\n */\n getClockOffset() {\n return DateUtils.clockOffset;\n },\n getHeaderStringFromDate(date = DateUtils.getDateWithClockOffset()) {\n return date.toISOString().replace(/[:-]|\\.\\d{3}/g, '');\n },\n getDateFromHeaderString(header) {\n const [, year, month, day, hour, minute, second] = header.match(/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2}).+/);\n return new Date(Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)));\n },\n isClockSkewed(serverDate) {\n // API gateway permits client calls that are off by no more than ±5 minutes\n return (Math.abs(serverDate.getTime() - DateUtils.getDateWithClockOffset().getTime()) >= FIVE_MINUTES_IN_MS);\n },\n isClockSkewError(error) {\n if (!error.response || !error.response.headers) {\n return false;\n }\n const { headers } = error.response;\n return Boolean(['BadRequestException', 'InvalidSignatureException'].includes(headers['x-amzn-errortype']) &&\n (headers.date || headers.Date));\n },\n /**\n * @param {number} offset Clock offset in milliseconds\n */\n setClockOffset(offset) {\n DateUtils.clockOffset = offset;\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB;AACA;AACA;AACA,IAAI,WAAW,EAAE,CAAC;AAClB,IAAI,sBAAsB,GAAG;AAC7B,QAAQ,IAAI,SAAS,CAAC,WAAW,EAAE;AACnC,YAAY,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC;AACzE;
|
|
1
|
+
{"version":3,"file":"DateUtils.mjs","sources":["../../../src/Signer/DateUtils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Date & time utility functions to abstract the `aws-sdk` away from users.\n * (v2 => v3 modularization is a breaking change)\n *\n * @see https://github.com/aws/aws-sdk-js/blob/6edf586dcc1de7fe8fbfbbd9a0d2b1847921e6e1/lib/util.js#L262\n */\nconst FIVE_MINUTES_IN_MS = 1000 * 60 * 5;\n/**\n * This utility is intended to be deprecated and replaced by `signRequest` and `presignUrl` functions from\n * `clients/middleware/signing/signer/signatureV4`.\n *\n * TODO: refactor the logics here into `signRequest` and `presignUrl` functions and remove this class.\n *\n * @internal\n * @deprecated\n */\nexport const DateUtils = {\n /**\n * Milliseconds to offset the date to compensate for clock skew between device & services\n */\n clockOffset: 0,\n getDateWithClockOffset() {\n if (DateUtils.clockOffset) {\n return new Date(new Date().getTime() + DateUtils.clockOffset);\n }\n else {\n return new Date();\n }\n },\n /**\n * @returns {number} Clock offset in milliseconds\n */\n getClockOffset() {\n return DateUtils.clockOffset;\n },\n getHeaderStringFromDate(date = DateUtils.getDateWithClockOffset()) {\n return date.toISOString().replace(/[:-]|\\.\\d{3}/g, '');\n },\n getDateFromHeaderString(header) {\n const [, year, month, day, hour, minute, second] = header.match(/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2}).+/);\n return new Date(Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)));\n },\n isClockSkewed(serverDate) {\n // API gateway permits client calls that are off by no more than ±5 minutes\n return (Math.abs(serverDate.getTime() - DateUtils.getDateWithClockOffset().getTime()) >= FIVE_MINUTES_IN_MS);\n },\n isClockSkewError(error) {\n if (!error.response || !error.response.headers) {\n return false;\n }\n const { headers } = error.response;\n return Boolean(['BadRequestException', 'InvalidSignatureException'].includes(headers['x-amzn-errortype']) &&\n (headers.date || headers.Date));\n },\n /**\n * @param {number} offset Clock offset in milliseconds\n */\n setClockOffset(offset) {\n DateUtils.clockOffset = offset;\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB;AACA;AACA;AACA,IAAI,WAAW,EAAE,CAAC;AAClB,IAAI,sBAAsB,GAAG;AAC7B,QAAQ,IAAI,SAAS,CAAC,WAAW,EAAE;AACnC,YAAY,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CA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AE,GAAG,KAAK,CAAC,QAAQ;AAC1C,QAAQ,OAAO,OAAO,CAAC,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACjH,aAAa,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3C,IAAI,CAAC;AACL;AACA;AACA;AACA,IAAI,cAAc,CAAC,MAAM,EAAE;AAC3B,QAAQ,SAAS,CAAC,WAAW,GAAG,MAAM;AACtC,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signer.mjs","sources":["../../../src/Signer/Signer.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { TOKEN_QUERY_PARAM, presignUrl, signRequest, } from '../clients/middleware/signing/signer/signatureV4';\nimport { AmplifyUrl } from '../utils/amplifyUrl';\nimport { DateUtils } from './DateUtils';\nconst IOT_SERVICE_NAME = 'iotdevicegateway';\n// Best practice regex to parse the service and region from an AWS endpoint\nconst AWS_ENDPOINT_REGEX = /([^.]+)\\.(?:([^.]*)\\.)?amazonaws\\.com(.cn)?$/;\n/**\n * This class is intended to be deprecated and replaced by `signRequest` and `presignUrl` functions from\n * `clients/middleware/signing/signer/signatureV4`.\n *\n * TODO: refactor the logics here into `signRequest` and `presignUrl` functions and remove this class.\n *\n * @internal\n * @deprecated\n */\nexport class Signer {\n /**\n * Sign a HTTP request, add 'Authorization' header to request param\n * @method sign\n * @memberof Signer\n * @static\n *\n * @param {object} request - HTTP request object\n <pre>\n request: {\n method: GET | POST | PUT ...\n url: ...,\n headers: {\n header1: ...\n },\n data: data\n }\n </pre>\n * @param {object} access_info - AWS access credential info\n <pre>\n access_info: {\n access_key: ...,\n secret_key: ...,\n session_token: ...\n }\n </pre>\n * @param {object} [service_info] - AWS service type and region, optional,\n * if not provided then parse out from url\n <pre>\n service_info: {\n service: ...,\n region: ...\n }\n </pre>\n *\n * @returns {object} Signed HTTP request\n */\n static sign(request, accessInfo, serviceInfo) {\n request.headers = request.headers || {};\n if (request.body && !request.data) {\n throw new Error('The attribute \"body\" was found on the request object. Please use the attribute \"data\" instead.');\n }\n const requestToSign = {\n ...request,\n body: request.data,\n url: new AmplifyUrl(request.url),\n };\n const options = getOptions(requestToSign, accessInfo, serviceInfo);\n const signedRequest = signRequest(requestToSign, options);\n // Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property\n // back to a string so as not to disrupt consumers of Signer.\n signedRequest.url = signedRequest.url.toString();\n // HTTP headers should be case insensitive but, to maintain parity with the previous Signer implementation and\n // limit the impact of this implementation swap, replace lowercased headers with title cased ones.\n signedRequest.headers.Authorization = signedRequest.headers.authorization;\n signedRequest.headers['X-Amz-Security-Token'] =\n signedRequest.headers['x-amz-security-token'];\n delete signedRequest.headers.authorization;\n delete signedRequest.headers['x-amz-security-token'];\n return signedRequest;\n }\n static signUrl(urlOrRequest, accessInfo, serviceInfo, expiration) {\n const urlToSign = typeof urlOrRequest === 'object' ? urlOrRequest.url : urlOrRequest;\n const method = typeof urlOrRequest === 'object' ? urlOrRequest.method : 'GET';\n const body = typeof urlOrRequest === 'object' ? urlOrRequest.body : undefined;\n const presignable = {\n body,\n method,\n url: new AmplifyUrl(urlToSign),\n };\n const options = getOptions(presignable, accessInfo, serviceInfo, expiration);\n const signedUrl = presignUrl(presignable, options);\n if (accessInfo.session_token &&\n !sessionTokenRequiredInSigning(options.signingService)) {\n signedUrl.searchParams.append(TOKEN_QUERY_PARAM, accessInfo.session_token);\n }\n return signedUrl.toString();\n }\n}\nconst getOptions = (request, accessInfo, serviceInfo, expiration) => {\n const { access_key, secret_key, session_token } = accessInfo ?? {};\n const { region: urlRegion, service: urlService } = parseServiceInfo(request.url);\n const { region = urlRegion, service = urlService } = serviceInfo ?? {};\n const credentials = {\n accessKeyId: access_key,\n secretAccessKey: secret_key,\n ...(sessionTokenRequiredInSigning(service)\n ? { sessionToken: session_token }\n : {}),\n };\n return {\n credentials,\n signingDate: DateUtils.getDateWithClockOffset(),\n signingRegion: region,\n signingService: service,\n ...(expiration && { expiration }),\n };\n};\nconst parseServiceInfo = (url) => {\n const { host } = url;\n const matched = host.match(AWS_ENDPOINT_REGEX) ?? [];\n let parsed = matched.slice(1, 3);\n if (parsed[1] === 'es') {\n // Elastic Search\n parsed = parsed.reverse();\n }\n return {\n service: parsed[0],\n region: parsed[1],\n };\n};\n// IoT service does not allow the session token in the canonical request\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\nconst sessionTokenRequiredInSigning = (service) => service !== IOT_SERVICE_NAME;\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAIA,MAAM,gBAAgB,GAAG,kBAAkB;AAC3C;AACA,MAAM,kBAAkB,GAAG,8CAA8C;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,MAAM,CAAC;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE;AAClD,QAAQ,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE;AAC/C,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;AAC3C,YAAY,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC;AAC7H;
|
|
1
|
+
{"version":3,"file":"Signer.mjs","sources":["../../../src/Signer/Signer.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { TOKEN_QUERY_PARAM, presignUrl, signRequest, } from '../clients/middleware/signing/signer/signatureV4';\nimport { AmplifyUrl } from '../utils/amplifyUrl';\nimport { DateUtils } from './DateUtils';\nconst IOT_SERVICE_NAME = 'iotdevicegateway';\n// Best practice regex to parse the service and region from an AWS endpoint\nconst AWS_ENDPOINT_REGEX = /([^.]+)\\.(?:([^.]*)\\.)?amazonaws\\.com(.cn)?$/;\n/**\n * This class is intended to be deprecated and replaced by `signRequest` and `presignUrl` functions from\n * `clients/middleware/signing/signer/signatureV4`.\n *\n * TODO: refactor the logics here into `signRequest` and `presignUrl` functions and remove this class.\n *\n * @internal\n * @deprecated\n */\nexport class Signer {\n /**\n * Sign a HTTP request, add 'Authorization' header to request param\n * @method sign\n * @memberof Signer\n * @static\n *\n * @param {object} request - HTTP request object\n <pre>\n request: {\n method: GET | POST | PUT ...\n url: ...,\n headers: {\n header1: ...\n },\n data: data\n }\n </pre>\n * @param {object} access_info - AWS access credential info\n <pre>\n access_info: {\n access_key: ...,\n secret_key: ...,\n session_token: ...\n }\n </pre>\n * @param {object} [service_info] - AWS service type and region, optional,\n * if not provided then parse out from url\n <pre>\n service_info: {\n service: ...,\n region: ...\n }\n </pre>\n *\n * @returns {object} Signed HTTP request\n */\n static sign(request, accessInfo, serviceInfo) {\n request.headers = request.headers || {};\n if (request.body && !request.data) {\n throw new Error('The attribute \"body\" was found on the request object. Please use the attribute \"data\" instead.');\n }\n const requestToSign = {\n ...request,\n body: request.data,\n url: new AmplifyUrl(request.url),\n };\n const options = getOptions(requestToSign, accessInfo, serviceInfo);\n const signedRequest = signRequest(requestToSign, options);\n // Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property\n // back to a string so as not to disrupt consumers of Signer.\n signedRequest.url = signedRequest.url.toString();\n // HTTP headers should be case insensitive but, to maintain parity with the previous Signer implementation and\n // limit the impact of this implementation swap, replace lowercased headers with title cased ones.\n signedRequest.headers.Authorization = signedRequest.headers.authorization;\n signedRequest.headers['X-Amz-Security-Token'] =\n signedRequest.headers['x-amz-security-token'];\n delete signedRequest.headers.authorization;\n delete signedRequest.headers['x-amz-security-token'];\n return signedRequest;\n }\n static signUrl(urlOrRequest, accessInfo, serviceInfo, expiration) {\n const urlToSign = typeof urlOrRequest === 'object' ? urlOrRequest.url : urlOrRequest;\n const method = typeof urlOrRequest === 'object' ? urlOrRequest.method : 'GET';\n const body = typeof urlOrRequest === 'object' ? urlOrRequest.body : undefined;\n const presignable = {\n body,\n method,\n url: new AmplifyUrl(urlToSign),\n };\n const options = getOptions(presignable, accessInfo, serviceInfo, expiration);\n const signedUrl = presignUrl(presignable, options);\n if (accessInfo.session_token &&\n !sessionTokenRequiredInSigning(options.signingService)) {\n signedUrl.searchParams.append(TOKEN_QUERY_PARAM, accessInfo.session_token);\n }\n return signedUrl.toString();\n }\n}\nconst getOptions = (request, accessInfo, serviceInfo, expiration) => {\n const { access_key, secret_key, session_token } = accessInfo ?? {};\n const { region: urlRegion, service: urlService } = parseServiceInfo(request.url);\n const { region = urlRegion, service = urlService } = serviceInfo ?? {};\n const credentials = {\n accessKeyId: access_key,\n secretAccessKey: secret_key,\n ...(sessionTokenRequiredInSigning(service)\n ? { sessionToken: session_token }\n : {}),\n };\n return {\n credentials,\n signingDate: DateUtils.getDateWithClockOffset(),\n signingRegion: region,\n signingService: service,\n ...(expiration && { expiration }),\n };\n};\nconst parseServiceInfo = (url) => {\n const { host } = url;\n const matched = host.match(AWS_ENDPOINT_REGEX) ?? [];\n let parsed = matched.slice(1, 3);\n if (parsed[1] === 'es') {\n // Elastic Search\n parsed = parsed.reverse();\n }\n return {\n service: parsed[0],\n region: parsed[1],\n };\n};\n// IoT service does not allow the session token in the canonical request\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\nconst sessionTokenRequiredInSigning = (service) => service !== IOT_SERVICE_NAME;\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAIA,MAAM,gBAAgB,GAAG,kBAAkB;AAC3C;AACA,MAAM,kBAAkB,GAAG,8CA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ourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nexport class AmplifyServerContextError extends AmplifyError {\n constructor({ message, recoverySuggestion, underlyingError, }) {\n super({\n name: 'AmplifyServerContextError',\n message,\n recoverySuggestion,\n underlyingError,\n });\n }\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AAEO,MAAM,yBAAyB,SAAS,YAAY,CAAC;AAC5D,IAAI,WAAW,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,eAAe,GAAG,EAAE;AACnE,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,2BAA2B;AAC7C,YAAY,OAAO;AACnB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;AAC3B,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"AmplifyServerContextError.mjs","sources":["../../../../src/adapterCore/error/AmplifyServerContextError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nexport class AmplifyServerContextError extends AmplifyError {\n constructor({ message, recoverySuggestion, underlyingError, }) {\n super({\n name: 'AmplifyServerContextError',\n message,\n recoverySuggestion,\n underlyingError,\n });\n }\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AAEO,MAAM,yBAAyB,SAAS,YAAY,CAAC;AAC5D,IAAI,WAAW,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,eAAe,GAAG,EAAE;AACnE,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,2BAA2B;AAC7C,YAAY,OAAO;AACnB,YAAY,kBAAkB;AAC9B,YAAY,eAAe;AAC3B,SAAS,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverContext.mjs","sources":["../../../../src/adapterCore/serverContext/serverContext.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyClass } from '../../singleton';\nimport { AmplifyServerContextError } from '../error';\nimport { serverContextRegistry } from './serverContextRegistry';\n/**\n * Creates an Amplify server context.\n * @param amplifyConfig The Amplify resource config.\n * @param libraryOptions The Amplify library options.\n * @returns The Amplify server context spec.\n */\nexport const createAmplifyServerContext = (amplifyConfig, libraryOptions) => {\n const amplify = new AmplifyClass();\n amplify.configure(amplifyConfig, libraryOptions);\n return serverContextRegistry.register({\n amplify,\n });\n};\n/**\n * Returns an Amplify server context.\n * @param contextSpec The context spec used to get the Amplify server context.\n * @returns The Amplify server context.\n */\nexport const getAmplifyServerContext = (contextSpec) => {\n assertContextSpec(contextSpec);\n const context = serverContextRegistry.get(contextSpec);\n if (context) {\n return context;\n }\n throw new AmplifyServerContextError({\n message: 'Attempted to get the Amplify Server Context that may have been destroyed.',\n recoverySuggestion: 'Ensure always call Amplify APIs within `runWithAmplifyServerContext` function, and do not attempt to reuse `contextSpec` object.',\n });\n};\n/**\n * Destroys an Amplify server context.\n * @param contextSpec The context spec used to destroy the Amplify server context.\n */\nexport const destroyAmplifyServerContext = (contextSpec) => {\n serverContextRegistry.deregister(contextSpec);\n};\nconst assertContextSpec = (contextSpec) => {\n let invalid = false;\n if (!Object.prototype.hasOwnProperty.call(contextSpec, 'token')) {\n invalid = true;\n }\n else if (!Object.prototype.hasOwnProperty.call(contextSpec.token, 'value')) {\n invalid = true;\n }\n else if (Object.prototype.toString.call(contextSpec.token.value) !==\n '[object Symbol]') {\n invalid = true;\n }\n if (invalid) {\n throw new AmplifyServerContextError({\n message: 'Invalid `contextSpec`.',\n recoverySuggestion: 'Ensure to use the `contextSpec` object injected by `runWithAmplifyServerContext` function.',\n });\n }\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,0BAA0B,GAAG,CAAC,aAAa,EAAE,cAAc,KAAK;AAC7E,IAAI,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE;AACtC,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;AACpD,IAAI,OAAO,qBAAqB,CAAC,QAAQ,CAAC;AAC1C,QAAQ,OAAO;AACf,KAAK,CAAC;AACN;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,CAAC,WAAW,KAAK;AACxD,IAAI,iBAAiB,CAAC,WAAW,CAAC;AAClC,IAAI,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC;AAC1D,IAAI,IAAI,OAAO,EAAE;AACjB,QAAQ,OAAO,OAAO;AACtB;
|
|
1
|
+
{"version":3,"file":"serverContext.mjs","sources":["../../../../src/adapterCore/serverContext/serverContext.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyClass } from '../../singleton';\nimport { AmplifyServerContextError } from '../error';\nimport { serverContextRegistry } from './serverContextRegistry';\n/**\n * Creates an Amplify server context.\n * @param amplifyConfig The Amplify resource config.\n * @param libraryOptions The Amplify library options.\n * @returns The Amplify server context spec.\n */\nexport const createAmplifyServerContext = (amplifyConfig, libraryOptions) => {\n const amplify = new AmplifyClass();\n amplify.configure(amplifyConfig, libraryOptions);\n return serverContextRegistry.register({\n amplify,\n });\n};\n/**\n * Returns an Amplify server context.\n * @param contextSpec The context spec used to get the Amplify server context.\n * @returns The Amplify server context.\n */\nexport const getAmplifyServerContext = (contextSpec) => {\n assertContextSpec(contextSpec);\n const context = serverContextRegistry.get(contextSpec);\n if (context) {\n return context;\n }\n throw new AmplifyServerContextError({\n message: 'Attempted to get the Amplify Server Context that may have been destroyed.',\n recoverySuggestion: 'Ensure always call Amplify APIs within `runWithAmplifyServerContext` function, and do not attempt to reuse `contextSpec` object.',\n });\n};\n/**\n * Destroys an Amplify server context.\n * @param contextSpec The context spec used to destroy the Amplify server context.\n */\nexport const destroyAmplifyServerContext = (contextSpec) => {\n serverContextRegistry.deregister(contextSpec);\n};\nconst assertContextSpec = (contextSpec) => {\n let invalid = false;\n if (!Object.prototype.hasOwnProperty.call(contextSpec, 'token')) {\n invalid = true;\n }\n else if (!Object.prototype.hasOwnProperty.call(contextSpec.token, 'value')) {\n invalid = true;\n }\n else if (Object.prototype.toString.call(contextSpec.token.value) !==\n '[object Symbol]') {\n invalid = true;\n }\n if (invalid) {\n throw new AmplifyServerContextError({\n message: 'Invalid `contextSpec`.',\n recoverySuggestion: 'Ensure to use the `contextSpec` object injected by `runWithAmplifyServerContext` function.',\n });\n }\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,0BAA0B,GAAG,CAAC,aAAa,EAAE,cAAc,KAAK;AAC7E,IAAI,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE;AACtC,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;AACpD,IAAI,OAAO,qBAAqB,CAAC,QAAQ,CAAC;AAC1C,QAAQ,OAAO;AACf,KAAK,CAAC;AACN;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,CAAC,WAAW,KAAK;AACxD,IAAI,iBAAiB,CAAC,WAAW,CAAC;AAClC,IAAI,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC;AAC1D,IAAI,IAAI,OAAO,EAAE;AACjB,QAAQ,OAAO,OAAO;AACtB,IAAI;AACJ,IAAI,MAAM,IAAI,yBAAyB,CAAC;AACxC,QAAQ,OAAO,EAAE,2EAA2E;AAC5F,QAAQ,kBAAkB,EAAE,kIAAkI;AAC9J,KAAK,CAAC;AACN;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,WAAW,KAAK;AAC5D,IAAI,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAC;AACjD;AACA,MAAM,iBAAiB,GAAG,CAAC,WAAW,KAAK;AAC3C,IAAI,IAAI,OAAO,GAAG,KAAK;AACvB,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;AACrE,QAAQ,OAAO,GAAG,IAAI;AACtB,IAAI;AACJ,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;AAChF,QAAQ,OAAO,GAAG,IAAI;AACtB,IAAI;AACJ,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;AACpE,QAAQ,iBAAiB,EAAE;AAC3B,QAAQ,OAAO,GAAG,IAAI;AACtB,IAAI;AACJ,IAAI,IAAI,OAAO,EAAE;AACjB,QAAQ,MAAM,IAAI,yBAAyB,CAAC;AAC5C,YAAY,OAAO,EAAE,wBAAwB;AAC7C,YAAY,kBAAkB,EAAE,4FAA4F;AAC5H,SAAS,CAAC;AACV,IAAI;AACJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,
|
|
1
|
+
{"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,IAAI,CAAC;AACL,IAAI,UAAU,CAAC,WAAW,EAAE;AAC5B,QAAQ,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;AAChD,IAAI,CAAC;AACL,IAAI,GAAG,CAAC,WAAW,EAAE;AACrB,QAAQ,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7C,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.mjs","sources":["../../../../src/awsClients/pinpoint/base.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getDnsSuffix } from '../../clients/endpoints';\nimport { getRetryDecider, jitteredBackoff, } from '../../clients/middleware/retry';\nimport { parseJsonError } from '../../clients/serde/json';\nimport { getAmplifyUserAgent } from '../../Platform';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nconst SERVICE_NAME = 'mobiletargeting';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region.\n */\nconst endpointResolver = ({ region }) => ({\n url: new AmplifyUrl(`https://pinpoint.${region}.${getDnsSuffix(region)}`),\n});\n/**\n * @internal\n */\nexport const defaultConfig = {\n service: SERVICE_NAME,\n endpointResolver,\n retryDecider: getRetryDecider(parseJsonError),\n computeDelay: jitteredBackoff,\n get userAgentValue() {\n return getAmplifyUserAgent();\n },\n};\n/**\n * @internal\n */\nexport const getSharedHeaders = () => ({\n 'content-type': 'application/json',\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA,MAAM,YAAY,GAAG,iBAAiB;AACtC;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM;AAC1C,IAAI,GAAG,EAAE,IAAI,UAAU,CAAC,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AACF;AACA;AACA;AACY,MAAC,aAAa,GAAG;AAC7B,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,gBAAgB;AACpB,IAAI,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC;AACjD,IAAI,YAAY,EAAE,eAAe;AACjC,IAAI,IAAI,cAAc,GAAG;AACzB,QAAQ,OAAO,mBAAmB,EAAE;AACpC,
|
|
1
|
+
{"version":3,"file":"base.mjs","sources":["../../../../src/awsClients/pinpoint/base.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getDnsSuffix } from '../../clients/endpoints';\nimport { getRetryDecider, jitteredBackoff, } from '../../clients/middleware/retry';\nimport { parseJsonError } from '../../clients/serde/json';\nimport { getAmplifyUserAgent } from '../../Platform';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\n/**\n * The service name used to sign requests if the API requires authentication.\n */\nconst SERVICE_NAME = 'mobiletargeting';\n/**\n * The endpoint resolver function that returns the endpoint URL for a given region.\n */\nconst endpointResolver = ({ region }) => ({\n url: new AmplifyUrl(`https://pinpoint.${region}.${getDnsSuffix(region)}`),\n});\n/**\n * @internal\n */\nexport const defaultConfig = {\n service: SERVICE_NAME,\n endpointResolver,\n retryDecider: getRetryDecider(parseJsonError),\n computeDelay: jitteredBackoff,\n get userAgentValue() {\n return getAmplifyUserAgent();\n },\n};\n/**\n * @internal\n */\nexport const getSharedHeaders = () => ({\n 'content-type': 'application/json',\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA,MAAM,YAAY,GAAG,iBAAiB;AACtC;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM;AAC1C,IAAI,GAAG,EAAE,IAAI,UAAU,CAAC,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AACF;AACA;AACA;AACY,MAAC,aAAa,GAAG;AAC7B,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,gBAAgB;AACpB,IAAI,YAAY,EAAE,eAAe,CAAC,cAAc,CAAC;AACjD,IAAI,YAAY,EAAE,eAAe;AACjC,IAAI,IAAI,cAAc,GAAG;AACzB,QAAQ,OAAO,mBAAmB,EAAE;AACpC,IAAI,CAAC;AACL;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,OAAO;AACvC,IAAI,cAAc,EAAE,kBAAkB;AACtC,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInAppMessages.mjs","sources":["../../../../src/awsClients/pinpoint/getInAppMessages.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nconst getInAppMessagesSerializer = ({ ApplicationId = '', EndpointId = '' }, endpoint) => {\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/endpoints/${extendedEncodeURIComponent(EndpointId)}/inappmessages`;\n return { method: 'GET', headers, url };\n};\nconst getInAppMessagesDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { InAppMessageCampaigns } = await parseJsonBody(response);\n return {\n InAppMessagesResponse: { InAppMessageCampaigns },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const getInAppMessages = composeServiceApi(authenticatedHandler, getInAppMessagesSerializer, getInAppMessagesDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAOA,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE,QAAQ,KAAK;AAC1F,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC;AAC3I,IAAI,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE;AAC1C,CAAC;AACD,MAAM,4BAA4B,GAAG,OAAO,QAAQ,KAAK;AACzD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB;
|
|
1
|
+
{"version":3,"file":"getInAppMessages.mjs","sources":["../../../../src/awsClients/pinpoint/getInAppMessages.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nconst getInAppMessagesSerializer = ({ ApplicationId = '', EndpointId = '' }, endpoint) => {\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/endpoints/${extendedEncodeURIComponent(EndpointId)}/inappmessages`;\n return { method: 'GET', headers, url };\n};\nconst getInAppMessagesDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { InAppMessageCampaigns } = await parseJsonBody(response);\n return {\n InAppMessagesResponse: { InAppMessageCampaigns },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const getInAppMessages = composeServiceApi(authenticatedHandler, getInAppMessagesSerializer, getInAppMessagesDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAOA,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE,QAAQ,KAAK;AAC1F,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC;AAC3I,IAAI,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE;AAC1C,CAAC;AACD,MAAM,4BAA4B,GAAG,OAAO,QAAQ,KAAK;AACzD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AACvE,QAAQ,OAAO;AACf,YAAY,qBAAqB,EAAE,EAAE,qBAAqB,EAAE;AAC5D,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,SAAS;AACT,IAAI;AACJ,CAAC;AACD;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,iBAAiB,CAAC,oBAAoB,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,aAAa;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"putEvents.mjs","sources":["../../../../src/awsClients/pinpoint/putEvents.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nimport { PinpointValidationErrorCode, assert } from './errorHelpers';\nconst putEventsSerializer = ({ ApplicationId, EventsRequest }, endpoint) => {\n assert(!!ApplicationId, PinpointValidationErrorCode.NoAppId);\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/events`;\n const body = JSON.stringify(EventsRequest ?? {});\n return { method: 'POST', headers, url, body };\n};\nconst putEventsDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { Results } = await parseJsonBody(response);\n return {\n EventsResponse: { Results },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const putEvents = composeServiceApi(authenticatedHandler, putEventsSerializer, putEventsDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAQA,MAAM,mBAAmB,GAAG,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,QAAQ,KAAK;AAC5E,IAAI,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,2BAA2B,CAAC,OAAO,CAAC;AAChE,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC;AAChF,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC;AACpD,IAAI,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE;AACjD,CAAC;AACD,MAAM,qBAAqB,GAAG,OAAO,QAAQ,KAAK;AAClD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB;
|
|
1
|
+
{"version":3,"file":"putEvents.mjs","sources":["../../../../src/awsClients/pinpoint/putEvents.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nimport { PinpointValidationErrorCode, assert } from './errorHelpers';\nconst putEventsSerializer = ({ ApplicationId, EventsRequest }, endpoint) => {\n assert(!!ApplicationId, PinpointValidationErrorCode.NoAppId);\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/events`;\n const body = JSON.stringify(EventsRequest ?? {});\n return { method: 'POST', headers, url, body };\n};\nconst putEventsDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { Results } = await parseJsonBody(response);\n return {\n EventsResponse: { Results },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const putEvents = composeServiceApi(authenticatedHandler, putEventsSerializer, putEventsDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAQA,MAAM,mBAAmB,GAAG,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,QAAQ,KAAK;AAC5E,IAAI,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,2BAA2B,CAAC,OAAO,CAAC;AAChE,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC;AAChF,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC;AACpD,IAAI,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE;AACjD,CAAC;AACD,MAAM,qBAAqB,GAAG,OAAO,QAAQ,KAAK;AAClD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AACzD,QAAQ,OAAO;AACf,YAAY,cAAc,EAAE,EAAE,OAAO,EAAE;AACvC,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,SAAS;AACT,IAAI;AACJ,CAAC;AACD;AACA;AACA;AACY,MAAC,SAAS,GAAG,iBAAiB,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateEndpoint.mjs","sources":["../../../../src/awsClients/pinpoint/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nconst updateEndpointSerializer = ({ ApplicationId = '', EndpointId = '', EndpointRequest }, endpoint) => {\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/endpoints/${extendedEncodeURIComponent(EndpointId)}`;\n const body = JSON.stringify(EndpointRequest);\n return { method: 'PUT', headers, url, body };\n};\nconst updateEndpointDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { Message, RequestID } = await parseJsonBody(response);\n return {\n MessageBody: {\n Message,\n RequestID,\n },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const updateEndpoint = composeServiceApi(authenticatedHandler, updateEndpointSerializer, updateEndpointDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAOA,MAAM,wBAAwB,GAAG,CAAC,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,QAAQ,KAAK;AACzG,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7H,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;AAChD,IAAI,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE;AAChD,CAAC;AACD,MAAM,0BAA0B,GAAG,OAAO,QAAQ,KAAK;AACvD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB;
|
|
1
|
+
{"version":3,"file":"updateEndpoint.mjs","sources":["../../../../src/awsClients/pinpoint/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { authenticatedHandler } from '../../clients/handlers/aws/authenticated';\nimport { composeServiceApi } from '../../clients/internal/composeServiceApi';\nimport { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';\nimport { AmplifyUrl } from '../../utils/amplifyUrl';\nimport { defaultConfig, getSharedHeaders } from './base';\nconst updateEndpointSerializer = ({ ApplicationId = '', EndpointId = '', EndpointRequest }, endpoint) => {\n const headers = getSharedHeaders();\n const url = new AmplifyUrl(endpoint.url);\n url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/endpoints/${extendedEncodeURIComponent(EndpointId)}`;\n const body = JSON.stringify(EndpointRequest);\n return { method: 'PUT', headers, url, body };\n};\nconst updateEndpointDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const { Message, RequestID } = await parseJsonBody(response);\n return {\n MessageBody: {\n Message,\n RequestID,\n },\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const updateEndpoint = composeServiceApi(authenticatedHandler, updateEndpointSerializer, updateEndpointDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAOA,MAAM,wBAAwB,GAAG,CAAC,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,QAAQ,KAAK;AACzG,IAAI,MAAM,OAAO,GAAG,gBAAgB,EAAE;AACtC,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5C,IAAI,GAAG,CAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7H,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;AAChD,IAAI,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE;AAChD,CAAC;AACD,MAAM,0BAA0B,GAAG,OAAO,QAAQ,KAAK;AACvD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;AACpD,QAAQ,MAAM,KAAK;AACnB,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AACpE,QAAQ,OAAO;AACf,YAAY,WAAW,EAAE;AACzB,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,aAAa;AACb,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,SAAS;AACT,IAAI;AACJ,CAAC;AACD;AACA;AACA;AACY,MAAC,cAAc,GAAG,iBAAiB,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,aAAa;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDnsSuffix.mjs","sources":["../../../../src/clients/endpoints/getDnsSuffix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { defaultPartition, partitionsInfo } from './partitions';\n/**\n * Get the AWS Services endpoint URL's DNS suffix for a given region. A typical AWS regional service endpoint URL will\n * follow this pattern: {endpointPrefix}.{region}.{dnsSuffix}. For example, the endpoint URL for Cognito Identity in\n * us-east-1 will be cognito-identity.us-east-1.amazonaws.com. Here the DnsSuffix is `amazonaws.com`.\n *\n * @param region\n * @returns The DNS suffix\n *\n * @internal\n */\nexport const getDnsSuffix = (region) => {\n const { partitions } = partitionsInfo;\n for (const { regions, outputs, regionRegex } of partitions) {\n const regex = new RegExp(regionRegex);\n if (regions.includes(region) || regex.test(region)) {\n return outputs.dnsSuffix;\n }\n }\n return defaultPartition.outputs.dnsSuffix;\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,MAAM,KAAK;AACxC,IAAI,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc;AACzC,IAAI,KAAK,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,UAAU,EAAE;AAChE,QAAQ,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC;AAC7C,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AAC5D,YAAY,OAAO,OAAO,CAAC,SAAS;AACpC;
|
|
1
|
+
{"version":3,"file":"getDnsSuffix.mjs","sources":["../../../../src/clients/endpoints/getDnsSuffix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { defaultPartition, partitionsInfo } from './partitions';\n/**\n * Get the AWS Services endpoint URL's DNS suffix for a given region. A typical AWS regional service endpoint URL will\n * follow this pattern: {endpointPrefix}.{region}.{dnsSuffix}. For example, the endpoint URL for Cognito Identity in\n * us-east-1 will be cognito-identity.us-east-1.amazonaws.com. Here the DnsSuffix is `amazonaws.com`.\n *\n * @param region\n * @returns The DNS suffix\n *\n * @internal\n */\nexport const getDnsSuffix = (region) => {\n const { partitions } = partitionsInfo;\n for (const { regions, outputs, regionRegex } of partitions) {\n const regex = new RegExp(regionRegex);\n if (regions.includes(region) || regex.test(region)) {\n return outputs.dnsSuffix;\n }\n }\n return defaultPartition.outputs.dnsSuffix;\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,MAAM,KAAK;AACxC,IAAI,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc;AACzC,IAAI,KAAK,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,UAAU,EAAE;AAChE,QAAQ,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC;AAC7C,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AAC5D,YAAY,OAAO,OAAO,CAAC,SAAS;AACpC,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,SAAS;AAC7C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.mjs","sources":["../../../../src/clients/handlers/fetch.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nimport { withMemoization } from '../utils/memoization';\nimport { AmplifyErrorCode } from '../../types';\nconst shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nexport const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new AmplifyError({\n name: AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: withMemoization(() => resp.text()),\n blob: withMemoization(() => resp.blob()),\n json: withMemoization(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIA,MAAM,cAAc,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AAClF;AACY,MAAC,oBAAoB,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK;AAClI,IAAI,IAAI,IAAI;AACZ,IAAI,IAAI;AACR,QAAQ,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;AAChC,YAAY,MAAM;AAClB,YAAY,OAAO;AACnB,YAAY,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;AAC3D,YAAY,MAAM,EAAE,WAAW;AAC/B,YAAY,KAAK;AACjB,YAAY,WAAW,EAAE,0BAA0B,GAAG,SAAS,GAAG,aAAa;AAC/E,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"fetch.mjs","sources":["../../../../src/clients/handlers/fetch.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nimport { withMemoization } from '../utils/memoization';\nimport { AmplifyErrorCode } from '../../types';\nconst shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nexport const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new AmplifyError({\n name: AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: withMemoization(() => resp.text()),\n blob: withMemoization(() => resp.blob()),\n json: withMemoization(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIA,MAAM,cAAc,GAAG,CAAC,MA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;AACA;AACA,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE;AACzD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,YAAY;AACvB,QAAQ,IAAI,EAAE,aAAa;AAC3B,KAAK;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeServiceApi.mjs","sources":["../../../../src/clients/internal/composeServiceApi.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.\n * A service API handler is composed with:\n * * A transfer handler\n * * A serializer function\n * * A deserializer function\n * * A default config object\n *\n * The returned service API handler, when called, will trigger the following workflow:\n * 1. When calling the service API handler function, the default config object is merged into the input config\n * object to assign the default values of some omitted configs, resulting to a resolved config object.\n * 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and\n * API input object resulting to an endpoint instance.\n * 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request\n * instance.\n * 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.\n * 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).\n * 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and\n * return to the caller.\n *\n *\n * @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.\n * @param serializer Async function for converting object in defined input shape into HTTP request targeting a given\n * \tendpoint.\n * @param deserializer Async function for converting HTTP response into output object in defined output shape, or error\n * \tshape.\n * @param defaultConfig object containing default options to be consumed by transfer handler, serializer and\n * deserializer.\n * @returns a async service API handler function that accepts a config object and input object in defined shape, returns\n * \tan output object in defined shape. It may also throw error instance in defined shape in deserializer. The config\n * object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver\n * function's input options type, region string. The config object property will be marked as optional if it's also\n * \tdefined in defaultConfig.\n *\n * @internal\n */\nexport const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We need to allow different endpoints based on both given config(other than region) and input.\n // However for most of non-S3 services, region is the only input for endpoint resolver.\n const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);\n // Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.\n // Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).\n // They will be populated automatically by browser, or node-fetch polyfill.\n const request = await serializer(input, endpoint);\n const response = await transferHandler(request, {\n ...resolvedConfig,\n });\n return deserializer(response);\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,KAAK;AAC/F,IAAI,OAAO,OAAO,MAAM,EAAE,KAAK,KAAK;AACpC,QAAQ,MAAM,cAAc,GAAG;AAC/B,YAAY,GAAG,aAAa;AAC5B,YAAY,GAAG,MAAM;AACrB,SAAS;AACT;AACA;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC;AACrF;AACA;AACA;AACA,QAAQ,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC;AACzD,QAAQ,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE;AACxD,YAAY,GAAG,cAAc;AAC7B,SAAS,CAAC;AACV,QAAQ,OAAO,YAAY,CAAC,QAAQ,CAAC;AACrC,
|
|
1
|
+
{"version":3,"file":"composeServiceApi.mjs","sources":["../../../../src/clients/internal/composeServiceApi.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a service API handler that accepts input as defined shape and responds conforming to defined output shape.\n * A service API handler is composed with:\n * * A transfer handler\n * * A serializer function\n * * A deserializer function\n * * A default config object\n *\n * The returned service API handler, when called, will trigger the following workflow:\n * 1. When calling the service API handler function, the default config object is merged into the input config\n * object to assign the default values of some omitted configs, resulting to a resolved config object.\n * 2. The `endpointResolver` function from the default config object will be invoked with the resolved config object and\n * API input object resulting to an endpoint instance.\n * 3. The serializer function is invoked with API input object and the endpoint instance resulting to an HTTP request\n * instance.\n * 4. The HTTP request instance and the resolved config object is passed to the transfer handler function.\n * 5. The transfer handler function resolves to an HTTP response instance(can be either successful or failed status code).\n * 6. The deserializer function is invoked with the HTTP response instance resulting to the API output object, and\n * return to the caller.\n *\n *\n * @param transferHandler Async function for dispatching HTTP requests and returning HTTP response.\n * @param serializer Async function for converting object in defined input shape into HTTP request targeting a given\n * \tendpoint.\n * @param deserializer Async function for converting HTTP response into output object in defined output shape, or error\n * \tshape.\n * @param defaultConfig object containing default options to be consumed by transfer handler, serializer and\n * deserializer.\n * @returns a async service API handler function that accepts a config object and input object in defined shape, returns\n * \tan output object in defined shape. It may also throw error instance in defined shape in deserializer. The config\n * object type is composed with options type of transferHandler, endpointResolver function as well as endpointResolver\n * function's input options type, region string. The config object property will be marked as optional if it's also\n * \tdefined in defaultConfig.\n *\n * @internal\n */\nexport const composeServiceApi = (transferHandler, serializer, deserializer, defaultConfig) => {\n return async (config, input) => {\n const resolvedConfig = {\n ...defaultConfig,\n ...config,\n };\n // We need to allow different endpoints based on both given config(other than region) and input.\n // However for most of non-S3 services, region is the only input for endpoint resolver.\n const endpoint = await resolvedConfig.endpointResolver(resolvedConfig, input);\n // Unlike AWS SDK clients, a serializer should NOT populate the `host` or `content-length` headers.\n // Both of these headers are prohibited per Spec(https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name).\n // They will be populated automatically by browser, or node-fetch polyfill.\n const request = await serializer(input, endpoint);\n const response = await transferHandler(request, {\n ...resolvedConfig,\n });\n return deserializer(response);\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,KAAK;AAC/F,IAAI,OAAO,OAAO,MAAM,EAAE,KAAK,KAAK;AACpC,QAAQ,MAAM,cAAc,GAAG;AAC/B,YAAY,GAAG,aAAa;AAC5B,YAAY,GAAG,MAAM;AACrB,SAAS;AACT;AACA;AACA,QAAQ,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC;AACrF;AACA;AACA;AACA,QAAQ,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC;AACzD,QAAQ,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE;AACxD,YAAY,GAAG,cAAc;AAC7B,SAAS,CAAC;AACV,QAAQ,OAAO,YAAY,CAAC,QAAQ,CAAC;AACrC,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeTransferHandler.mjs","sources":["../../../../src/clients/internal/composeTransferHandler.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a transfer handler with a core transfer handler and a list of middleware.\n * @param coreHandler Core transfer handler\n * @param middleware\tList of middleware\n * @returns A transfer handler whose option type is the union of the core\n * \ttransfer handler's option type and the middleware's option type.\n * @internal\n */\nexport const composeTransferHandler = (coreHandler, middleware) => (request, options) => {\n const context = {};\n let composedHandler = (composeHandlerRequest) => coreHandler(composeHandlerRequest, options);\n for (let i = middleware.length - 1; i >= 0; i--) {\n const m = middleware[i];\n const resolvedMiddleware = m(options);\n composedHandler = resolvedMiddleware(composedHandler, context);\n }\n return composedHandler(request);\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,WAAW,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE,OAAO,KAAK;AACzF,IAAI,MAAM,OAAO,GAAG,EAAE;AACtB,IAAI,IAAI,eAAe,GAAG,CAAC,qBAAqB,KAAK,WAAW,CAAC,qBAAqB,EAAE,OAAO,CAAC;AAChG,IAAI,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AACrD,QAAQ,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AAC/B,QAAQ,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,CAAC;AAC7C,QAAQ,eAAe,GAAG,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC;AACtE;
|
|
1
|
+
{"version":3,"file":"composeTransferHandler.mjs","sources":["../../../../src/clients/internal/composeTransferHandler.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Compose a transfer handler with a core transfer handler and a list of middleware.\n * @param coreHandler Core transfer handler\n * @param middleware\tList of middleware\n * @returns A transfer handler whose option type is the union of the core\n * \ttransfer handler's option type and the middleware's option type.\n * @internal\n */\nexport const composeTransferHandler = (coreHandler, middleware) => (request, options) => {\n const context = {};\n let composedHandler = (composeHandlerRequest) => coreHandler(composeHandlerRequest, options);\n for (let i = middleware.length - 1; i >= 0; i--) {\n const m = middleware[i];\n const resolvedMiddleware = m(options);\n composedHandler = resolvedMiddleware(composedHandler, context);\n }\n return composedHandler(request);\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,WAAW,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE,OAAO,KAAK;AACzF,IAAI,MAAM,OAAO,GAAG,EAAE;AACtB,IAAI,IAAI,eAAe,GAAG,CAAC,qBAAqB,KAAK,WAAW,CAAC,qBAAqB,EAAE,OAAO,CAAC;AAChG,IAAI,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;AACrD,QAAQ,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AAC/B,QAAQ,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,CAAC;AAC7C,QAAQ,eAAe,GAAG,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC;AACtE,IAAI;AACJ,IAAI,OAAO,eAAe,CAAC,OAAO,CAAC;AACnC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amzSdkInvocationIdHeaderMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/amzSdkInvocationIdHeaderMiddleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../libraryUtils';\nimport { AMZ_SDK_INVOCATION_ID_HEADER } from './constants';\n/**\n * Middleware injects a UUID string to `amz-sdk-invocation-id` header.\n * if the header is not set already. This header is helpful to provide\n * observability to group the requests caused by automatic retry.\n *\n * This middleware is standalone because of extra UUID dependency, we will\n * NOT use this middleware for API categories.\n *\n * Ref: https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/1.0.9/http-client/aws.smithy.kotlin.runtime.http.operation/-http-operation-context/-sdk-invocation-id.html\n */\nexport const amzSdkInvocationIdHeaderMiddlewareFactory = () => next => {\n return async function amzSdkInvocationIdHeaderMiddleware(request) {\n if (!request.headers[AMZ_SDK_INVOCATION_ID_HEADER]) {\n request.headers[AMZ_SDK_INVOCATION_ID_HEADER] = amplifyUuid();\n }\n return next(request);\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,yCAAyC,GAAG,MAAM,IAAI,IAAI;AACvE,IAAI,OAAO,eAAe,kCAAkC,CAAC,OAAO,EAAE;AACtE,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE;AAC5D,YAAY,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,WAAW,EAAE;AACzE;
|
|
1
|
+
{"version":3,"file":"amzSdkInvocationIdHeaderMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/amzSdkInvocationIdHeaderMiddleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../libraryUtils';\nimport { AMZ_SDK_INVOCATION_ID_HEADER } from './constants';\n/**\n * Middleware injects a UUID string to `amz-sdk-invocation-id` header.\n * if the header is not set already. This header is helpful to provide\n * observability to group the requests caused by automatic retry.\n *\n * This middleware is standalone because of extra UUID dependency, we will\n * NOT use this middleware for API categories.\n *\n * Ref: https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/1.0.9/http-client/aws.smithy.kotlin.runtime.http.operation/-http-operation-context/-sdk-invocation-id.html\n */\nexport const amzSdkInvocationIdHeaderMiddlewareFactory = () => next => {\n return async function amzSdkInvocationIdHeaderMiddleware(request) {\n if (!request.headers[AMZ_SDK_INVOCATION_ID_HEADER]) {\n request.headers[AMZ_SDK_INVOCATION_ID_HEADER] = amplifyUuid();\n }\n return next(request);\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,yCAAyC,GAAG,MAAM,IAAI,IAAI;AACvE,IAAI,OAAO,eAAe,kCAAkC,CAAC,OAAO,EAAE;AACtE,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE;AAC5D,YAAY,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,WAAW,EAAE;AACzE,QAAQ;AACR,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC;AAC5B,IAAI,CAAC;AACL;;;;"}
|