@aws-amplify/core 6.12.4-unstable.e5a8569.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 +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 +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/clients/handlers/fetch.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":"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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amzSdkRequestHeaderMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/amzSdkRequestHeaderMiddleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AMZ_SDK_REQUEST_HEADER, DEFAULT_RETRY_ATTEMPTS } from './constants';\n/**\n * Middleware injects `amz-sdk-request` header to indicate the retry state at the time an HTTP request is made.\n * This middleware should co-exist with retryMiddleware as it relies on the retryAttempts value in middleware context\n * set by the retry middleware.\n *\n * Example header: `amz-sdk-request: attempt=1; max=3`.\n *\n * This middleware is standalone because of extra headers may conflict with custom endpoint settings(e.g. CORS), we will\n * NOT use this middleware for API categories.\n */\nexport const amzSdkRequestHeaderMiddlewareFactory = ({ maxAttempts = DEFAULT_RETRY_ATTEMPTS }) => (next, context) => {\n return async function amzSdkRequestHeaderMiddleware(request) {\n const attemptsCount = context.attemptsCount ?? 0;\n request.headers[AMZ_SDK_REQUEST_HEADER] =\n `attempt=${attemptsCount + 1}; max=${maxAttempts}`;\n return next(request);\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,oCAAoC,GAAG,CAAC,EAAE,WAAW,GAAG,sBAAsB,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,KAAK;AACrH,IAAI,OAAO,eAAe,6BAA6B,CAAC,OAAO,EAAE;AACjE,QAAQ,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC;AACxD,QAAQ,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC;AAC/C,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC9D,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC;AAC5B,
|
|
1
|
+
{"version":3,"file":"amzSdkRequestHeaderMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/amzSdkRequestHeaderMiddleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AMZ_SDK_REQUEST_HEADER, DEFAULT_RETRY_ATTEMPTS } from './constants';\n/**\n * Middleware injects `amz-sdk-request` header to indicate the retry state at the time an HTTP request is made.\n * This middleware should co-exist with retryMiddleware as it relies on the retryAttempts value in middleware context\n * set by the retry middleware.\n *\n * Example header: `amz-sdk-request: attempt=1; max=3`.\n *\n * This middleware is standalone because of extra headers may conflict with custom endpoint settings(e.g. CORS), we will\n * NOT use this middleware for API categories.\n */\nexport const amzSdkRequestHeaderMiddlewareFactory = ({ maxAttempts = DEFAULT_RETRY_ATTEMPTS }) => (next, context) => {\n return async function amzSdkRequestHeaderMiddleware(request) {\n const attemptsCount = context.attemptsCount ?? 0;\n request.headers[AMZ_SDK_REQUEST_HEADER] =\n `attempt=${attemptsCount + 1}; max=${maxAttempts}`;\n return next(request);\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,oCAAoC,GAAG,CAAC,EAAE,WAAW,GAAG,sBAAsB,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,KAAK;AACrH,IAAI,OAAO,eAAe,6BAA6B,CAAC,OAAO,EAAE;AACjE,QAAQ,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC;AACxD,QAAQ,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC;AAC/C,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC9D,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC;AAC5B,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/retryMiddleware.ts"],"sourcesContent":["import { DEFAULT_RETRY_ATTEMPTS } from './constants';\n/**\n * Middleware that executes the retry logic.\n */\nexport const retryMiddlewareFactory = ({ maxAttempts = DEFAULT_RETRY_ATTEMPTS, retryDecider, computeDelay, abortSignal, }) => {\n if (maxAttempts < 1) {\n throw new Error('maxAttempts must be greater than 0');\n }\n return (next, context) => async function retryMiddleware(request) {\n let error;\n let attemptsCount = context.attemptsCount ?? 0;\n let response;\n // When retry is not needed or max attempts is reached, either error or response will be set. This function handles either cases.\n const handleTerminalErrorOrResponse = () => {\n if (response) {\n addOrIncrementMetadataAttempts(response, attemptsCount);\n return response;\n }\n else {\n addOrIncrementMetadataAttempts(error, attemptsCount);\n throw error;\n }\n };\n while (!abortSignal?.aborted && attemptsCount < maxAttempts) {\n try {\n response = await next(request);\n error = undefined;\n }\n catch (e) {\n error = e;\n response = undefined;\n }\n // context.attemptsCount may be updated after calling next handler which may retry the request by itself.\n attemptsCount =\n (context.attemptsCount ?? 0) > attemptsCount\n ? (context.attemptsCount ?? 0)\n : attemptsCount + 1;\n context.attemptsCount = attemptsCount;\n const { isCredentialsExpiredError, retryable } = await retryDecider(response, error, context);\n if (retryable) {\n // Setting isCredentialsInvalid flag to notify signing middleware to forceRefresh credentials provider.\n context.isCredentialsExpired = !!isCredentialsExpiredError;\n if (!abortSignal?.aborted && attemptsCount < maxAttempts) {\n // prevent sleep for last attempt or cancelled request;\n const delay = computeDelay(attemptsCount);\n await cancellableSleep(delay, abortSignal);\n }\n continue;\n }\n else {\n return handleTerminalErrorOrResponse();\n }\n }\n if (abortSignal?.aborted) {\n throw new Error('Request aborted.');\n }\n else {\n return handleTerminalErrorOrResponse();\n }\n };\n};\nconst cancellableSleep = (timeoutMs, abortSignal) => {\n if (abortSignal?.aborted) {\n return Promise.resolve();\n }\n let timeoutId;\n let sleepPromiseResolveFn;\n const sleepPromise = new Promise(resolve => {\n sleepPromiseResolveFn = resolve;\n timeoutId = setTimeout(resolve, timeoutMs);\n });\n abortSignal?.addEventListener('abort', function cancelSleep(_) {\n clearTimeout(timeoutId);\n abortSignal?.removeEventListener('abort', cancelSleep);\n sleepPromiseResolveFn();\n });\n return sleepPromise;\n};\nconst addOrIncrementMetadataAttempts = (nextHandlerOutput, attempts) => {\n if (Object.prototype.toString.call(nextHandlerOutput) !== '[object Object]') {\n return;\n }\n nextHandlerOutput.$metadata = {\n ...(nextHandlerOutput.$metadata ?? {}),\n attempts,\n };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,EAAE,WAAW,GAAG,sBAAsB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,GAAG,KAAK;AAC9H,IAAI,IAAI,WAAW,GAAG,CAAC,EAAE;AACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC;AAC7D;
|
|
1
|
+
{"version":3,"file":"retryMiddleware.mjs","sources":["../../../../../src/clients/middleware/retry/retryMiddleware.ts"],"sourcesContent":["import { DEFAULT_RETRY_ATTEMPTS } from './constants';\n/**\n * Middleware that executes the retry logic.\n */\nexport const retryMiddlewareFactory = ({ maxAttempts = DEFAULT_RETRY_ATTEMPTS, retryDecider, computeDelay, abortSignal, }) => {\n if (maxAttempts < 1) {\n throw new Error('maxAttempts must be greater than 0');\n }\n return (next, context) => async function retryMiddleware(request) {\n let error;\n let attemptsCount = context.attemptsCount ?? 0;\n let response;\n // When retry is not needed or max attempts is reached, either error or response will be set. This function handles either cases.\n const handleTerminalErrorOrResponse = () => {\n if (response) {\n addOrIncrementMetadataAttempts(response, attemptsCount);\n return response;\n }\n else {\n addOrIncrementMetadataAttempts(error, attemptsCount);\n throw error;\n }\n };\n while (!abortSignal?.aborted && attemptsCount < maxAttempts) {\n try {\n response = await next(request);\n error = undefined;\n }\n catch (e) {\n error = e;\n response = undefined;\n }\n // context.attemptsCount may be updated after calling next handler which may retry the request by itself.\n attemptsCount =\n (context.attemptsCount ?? 0) > attemptsCount\n ? (context.attemptsCount ?? 0)\n : attemptsCount + 1;\n context.attemptsCount = attemptsCount;\n const { isCredentialsExpiredError, retryable } = await retryDecider(response, error, context);\n if (retryable) {\n // Setting isCredentialsInvalid flag to notify signing middleware to forceRefresh credentials provider.\n context.isCredentialsExpired = !!isCredentialsExpiredError;\n if (!abortSignal?.aborted && attemptsCount < maxAttempts) {\n // prevent sleep for last attempt or cancelled request;\n const delay = computeDelay(attemptsCount);\n await cancellableSleep(delay, abortSignal);\n }\n continue;\n }\n else {\n return handleTerminalErrorOrResponse();\n }\n }\n if (abortSignal?.aborted) {\n throw new Error('Request aborted.');\n }\n else {\n return handleTerminalErrorOrResponse();\n }\n };\n};\nconst cancellableSleep = (timeoutMs, abortSignal) => {\n if (abortSignal?.aborted) {\n return Promise.resolve();\n }\n let timeoutId;\n let sleepPromiseResolveFn;\n const sleepPromise = new Promise(resolve => {\n sleepPromiseResolveFn = resolve;\n timeoutId = setTimeout(resolve, timeoutMs);\n });\n abortSignal?.addEventListener('abort', function cancelSleep(_) {\n clearTimeout(timeoutId);\n abortSignal?.removeEventListener('abort', cancelSleep);\n sleepPromiseResolveFn();\n });\n return sleepPromise;\n};\nconst addOrIncrementMetadataAttempts = (nextHandlerOutput, attempts) => {\n if (Object.prototype.toString.call(nextHandlerOutput) !== '[object Object]') {\n return;\n }\n nextHandlerOutput.$metadata = {\n ...(nextHandlerOutput.$metadata ?? {}),\n attempts,\n };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,EAAE,WAAW,GAAG,sBAAsB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,GAAG,KAAK;AAC9H,IAAI,IAAI,WAAW,GAAG,CAAC,EAAE;AACzB,QAAQ,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC;AAC7D,IAAI;AACJ,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,KAAK,eAAe,eAAe,CAAC,OAAO,EAAE;AACtE,QAAQ,IAAI,KAAK;AACjB,QAAQ,IAAI,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC;AACtD,QAAQ,IAAI,QAAQ;AACpB;AACA,QAAQ,MAAM,6BAA6B,GAAG,MAAM;AACpD,YAAY,IAAI,QAAQ,EAAE;AAC1B,gBAAgB,8BAA8B,CAAC,QAAQ,EAAE,aAAa,CAAC;AACvE,gBAAgB,OAAO,QAAQ;AAC/B,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,8BAA8B,CAAC,KAAK,EAAE,aAAa,CAAC;AACpE,gBAAgB,MAAM,KAAK;AAC3B,YAAY;AACZ,QAAQ,CAAC;AACT,QAAQ,OAAO,CAAC,WAAW,EAAE,OAAO,IAAI,aAAa,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AW,EAAE,OAAO,EAAE;AAC9B,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC,IAAI;AACJ,IAAI,IAAI,SAAS;AACjB,IAAI,IAAI,qBAAqB;AAC7B,IAAI,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,IAAI;AAChD,QAAQ,qBAAqB,GAAG,OAAO;AACvC,QAAQ,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC;AAClD,IAAI,CAAC,CAAC;AACN,IAAI,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,SAAS,WAAW,CAAC,CAAC,EAAE;AACnE,QAAQ,YAAY,CAAC,SAAS,CAAC;AAC/B,QAAQ,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC;AAC9D,QAAQ,qBAAqB,EAAE;AAC/B,IAAI,CAAC,CAAC;AACN,IAAI,OAAO,YAAY;AACvB,CAAC;AACD,MAAM,8BAA8B,GAAG,CAAC,iBAAiB,EAAE,QAAQ,KAAK;AACxE,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,iBAAiB,EAAE;AACjF,QAAQ;AACR,IAAI;AACJ,IAAI,iBAAiB,CAAC,SAAS,GAAG;AAClC,QAAQ,IAAI,iBAAiB,CAAC,SAAS,IAAI,EAAE,CAAC;AAC9C,QAAQ,QAAQ;AAChB,KAAK;AACL,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.mjs","sources":["../../../../../src/clients/middleware/signing/middleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { signRequest } from './signer/signatureV4';\nimport { getSkewCorrectedDate } from './utils/getSkewCorrectedDate';\nimport { getUpdatedSystemClockOffset } from './utils/getUpdatedSystemClockOffset';\n/**\n * Middleware that SigV4 signs request with AWS credentials, and correct system clock offset.\n * This middleware is expected to be placed after retry middleware.\n */\nexport const signingMiddlewareFactory = ({ credentials, region, service, uriEscapePath = true, }) => {\n let currentSystemClockOffset;\n return (next, context) => async function signingMiddleware(request) {\n currentSystemClockOffset = currentSystemClockOffset ?? 0;\n const signRequestOptions = {\n credentials: typeof credentials === 'function'\n ? await credentials({\n forceRefresh: !!context?.isCredentialsExpired,\n })\n : credentials,\n signingDate: getSkewCorrectedDate(currentSystemClockOffset),\n signingRegion: region,\n signingService: service,\n uriEscapePath,\n };\n const signedRequest = await signRequest(request, signRequestOptions);\n const response = await next(signedRequest);\n // Update system clock offset if response contains date header, regardless of the status code.\n // non-2xx response will still be returned from next handler instead of thrown, because it's\n // only thrown by the retry middleware.\n const dateString = getDateHeader(response);\n if (dateString) {\n currentSystemClockOffset = getUpdatedSystemClockOffset(Date.parse(dateString), currentSystemClockOffset);\n }\n return response;\n };\n};\nconst getDateHeader = ({ headers } = {}) => headers?.date ?? headers?.Date ?? headers?.['x-amz-date'];\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACY,MAAC,wBAAwB,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,KAAK;AACrG,IAAI,IAAI,wBAAwB;AAChC,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,KAAK,eAAe,iBAAiB,CAAC,OAAO,EAAE;AACxE,QAAQ,wBAAwB,GAAG,wBAAwB,IAAI,CAAC;AAChE,QAAQ,MAAM,kBAAkB,GAAG;AACnC,YAAY,WAAW,EAAE,OAAO,WAAW,KAAK;AAChD,kBAAkB,MAAM,WAAW,CAAC;AACpC,oBAAoB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,oBAAoB;AACjE,iBAAiB;AACjB,kBAAkB,WAAW;AAC7B,YAAY,WAAW,EAAE,oBAAoB,CAAC,wBAAwB,CAAC;AACvE,YAAY,aAAa,EAAE,MAAM;AACjC,YAAY,cAAc,EAAE,OAAO;AACnC,YAAY,aAAa;AACzB,SAAS;AACT,QAAQ,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC;AAC5E,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC;AAClD;AACA;AACA;AACA,QAAQ,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC;AAClD,QAAQ,IAAI,UAAU,EAAE;AACxB,YAAY,wBAAwB,GAAG,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AACpH;
|
|
1
|
+
{"version":3,"file":"middleware.mjs","sources":["../../../../../src/clients/middleware/signing/middleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { signRequest } from './signer/signatureV4';\nimport { getSkewCorrectedDate } from './utils/getSkewCorrectedDate';\nimport { getUpdatedSystemClockOffset } from './utils/getUpdatedSystemClockOffset';\n/**\n * Middleware that SigV4 signs request with AWS credentials, and correct system clock offset.\n * This middleware is expected to be placed after retry middleware.\n */\nexport const signingMiddlewareFactory = ({ credentials, region, service, uriEscapePath = true, }) => {\n let currentSystemClockOffset;\n return (next, context) => async function signingMiddleware(request) {\n currentSystemClockOffset = currentSystemClockOffset ?? 0;\n const signRequestOptions = {\n credentials: typeof credentials === 'function'\n ? await credentials({\n forceRefresh: !!context?.isCredentialsExpired,\n })\n : credentials,\n signingDate: getSkewCorrectedDate(currentSystemClockOffset),\n signingRegion: region,\n signingService: service,\n uriEscapePath,\n };\n const signedRequest = await signRequest(request, signRequestOptions);\n const response = await next(signedRequest);\n // Update system clock offset if response contains date header, regardless of the status code.\n // non-2xx response will still be returned from next handler instead of thrown, because it's\n // only thrown by the retry middleware.\n const dateString = getDateHeader(response);\n if (dateString) {\n currentSystemClockOffset = getUpdatedSystemClockOffset(Date.parse(dateString), currentSystemClockOffset);\n }\n return response;\n };\n};\nconst getDateHeader = ({ headers } = {}) => headers?.date ?? headers?.Date ?? headers?.['x-amz-date'];\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACY,MAAC,wBAAwB,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,KAAK;AACrG,IAAI,IAAI,wBAAwB;AAChC,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,KAAK,eAAe,iBAAiB,CAAC,OAAO,EAAE;AACxE,QAAQ,wBAAwB,GAAG,wBAAwB,IAAI,CAAC;AAChE,QAAQ,MAAM,kBAAkB,GAAG;AACnC,YAAY,WAAW,EAAE,OAAO,WAAW,KAAK;AAChD,kBAAkB,MAAM,WAAW,CAAC;AACpC,oBAAoB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,oBAAoB;AACjE,iBAAiB;AACjB,kBAAkB,WAAW;AAC7B,YAAY,WAAW,EAAE,oBAAoB,CAAC,wBAAwB,CAAC;AACvE,YAAY,aAAa,EAAE,MAAM;AACjC,YAAY,cAAc,EAAE,OAAO;AACnC,YAAY,aAAa;AACzB,SAAS;AACT,QAAQ,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC;AAC5E,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC;AAClD;AACA;AACA;AACA,QAAQ,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC;AAClD,QAAQ,IAAI,UAAU,EAAE;AACxB,YAAY,wBAAwB,GAAG,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AACpH,QAAQ;AACR,QAAQ,OAAO,QAAQ;AACvB,IAAI,CAAC;AACL;AACA,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,IAAI,IAAI,OAAO,GAAG,YAAY,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presignUrl.mjs","sources":["../../../../../../../src/clients/middleware/signing/signer/signatureV4/presignUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyUrl } from '../../../../../utils/amplifyUrl';\nimport { ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, EXPIRES_QUERY_PARAM, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_QUERY_PARAM, } from './constants';\nimport { getSigningValues } from './utils/getSigningValues';\nimport { getSignature } from './utils/getSignature';\n/**\n * Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.\n *\n * @param presignable `Presignable` object containing at least a url to be presigned with authentication query params.\n * @param presignUrlOptions `PresignUrlOptions` object containing values used to construct the signature.\n * @returns A `URL` with authentication query params which can grant temporary access to AWS resources.\n */\nexport const presignUrl = ({ body, method = 'GET', url }, { expiration, ...options }) => {\n const signingValues = getSigningValues(options);\n const { accessKeyId, credentialScope, longDate, sessionToken } = signingValues;\n // create the request to sign\n const presignedUrl = new AmplifyUrl(url);\n Object.entries({\n [ALGORITHM_QUERY_PARAM]: SHA256_ALGORITHM_IDENTIFIER,\n [CREDENTIAL_QUERY_PARAM]: `${accessKeyId}/${credentialScope}`,\n [AMZ_DATE_QUERY_PARAM]: longDate,\n [SIGNED_HEADERS_QUERY_PARAM]: HOST_HEADER,\n ...(expiration && { [EXPIRES_QUERY_PARAM]: expiration.toString() }),\n ...(sessionToken && { [TOKEN_QUERY_PARAM]: sessionToken }),\n }).forEach(([key, value]) => {\n presignedUrl.searchParams.append(key, value);\n });\n const requestToSign = {\n body,\n headers: { [HOST_HEADER]: url.host },\n method,\n url: presignedUrl,\n };\n // calculate and add the signature to the url\n const signature = getSignature(requestToSign, signingValues);\n presignedUrl.searchParams.append(SIGNATURE_QUERY_PARAM, signature);\n return presignedUrl;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,KAAK;AACzF,IAAI,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC;AACnD,IAAI,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,aAAa;AAClF;AACA,IAAI,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC;AAC5C,IAAI,MAAM,CAAC,OAAO,CAAC;AACnB,QAAQ,CAAC,qBAAqB,GAAG,2BAA2B;AAC5D,QAAQ,CAAC,sBAAsB,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;AACrE,QAAQ,CAAC,oBAAoB,GAAG,QAAQ;AACxC,QAAQ,CAAC,0BAA0B,GAAG,WAAW;AACjD,QAAQ,IAAI,UAAU,IAAI,EAAE,CAAC,mBAAmB,GAAG,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC3E,QAAQ,IAAI,YAAY,IAAI,EAAE,CAAC,iBAAiB,GAAG,YAAY,EAAE,CAAC;AAClE,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACjC,QAAQ,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC;AACpD,
|
|
1
|
+
{"version":3,"file":"presignUrl.mjs","sources":["../../../../../../../src/clients/middleware/signing/signer/signatureV4/presignUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyUrl } from '../../../../../utils/amplifyUrl';\nimport { ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, EXPIRES_QUERY_PARAM, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_QUERY_PARAM, } from './constants';\nimport { getSigningValues } from './utils/getSigningValues';\nimport { getSignature } from './utils/getSignature';\n/**\n * Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.\n *\n * @param presignable `Presignable` object containing at least a url to be presigned with authentication query params.\n * @param presignUrlOptions `PresignUrlOptions` object containing values used to construct the signature.\n * @returns A `URL` with authentication query params which can grant temporary access to AWS resources.\n */\nexport const presignUrl = ({ body, method = 'GET', url }, { expiration, ...options }) => {\n const signingValues = getSigningValues(options);\n const { accessKeyId, credentialScope, longDate, sessionToken } = signingValues;\n // create the request to sign\n const presignedUrl = new AmplifyUrl(url);\n Object.entries({\n [ALGORITHM_QUERY_PARAM]: SHA256_ALGORITHM_IDENTIFIER,\n [CREDENTIAL_QUERY_PARAM]: `${accessKeyId}/${credentialScope}`,\n [AMZ_DATE_QUERY_PARAM]: longDate,\n [SIGNED_HEADERS_QUERY_PARAM]: HOST_HEADER,\n ...(expiration && { [EXPIRES_QUERY_PARAM]: expiration.toString() }),\n ...(sessionToken && { [TOKEN_QUERY_PARAM]: sessionToken }),\n }).forEach(([key, value]) => {\n presignedUrl.searchParams.append(key, value);\n });\n const requestToSign = {\n body,\n headers: { [HOST_HEADER]: url.host },\n method,\n url: presignedUrl,\n };\n // calculate and add the signature to the url\n const signature = getSignature(requestToSign, signingValues);\n presignedUrl.searchParams.append(SIGNATURE_QUERY_PARAM, signature);\n return presignedUrl;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,CAAC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AAC;AACtE,IAAI,OAAO,YAAY;AACvB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signRequest.mjs","sources":["../../../../../../../src/clients/middleware/signing/signer/signatureV4/signRequest.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getSignedHeaders } from './utils/getSignedHeaders';\nimport { getSigningValues } from './utils/getSigningValues';\nimport { AMZ_DATE_HEADER, AUTH_HEADER, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, TOKEN_HEADER, } from './constants';\nimport { getSignature } from './utils/getSignature';\n/**\n * Given a `HttpRequest`, returns a Signature Version 4 signed `HttpRequest`.\n *\n * @param request `HttpRequest` to be signed.\n * @param signRequestOptions `SignRequestOptions` object containing values used to construct the signature.\n * @returns A `HttpRequest` with authentication headers which can grant temporary access to AWS resources.\n */\nexport const signRequest = (request, options) => {\n const signingValues = getSigningValues(options);\n const { accessKeyId, credentialScope, longDate, sessionToken } = signingValues;\n // create the request to sign\n const headers = { ...request.headers };\n headers[HOST_HEADER] = request.url.host;\n headers[AMZ_DATE_HEADER] = longDate;\n if (sessionToken) {\n headers[TOKEN_HEADER] = sessionToken;\n }\n const requestToSign = { ...request, headers };\n // calculate and add the signature to the request\n const signature = getSignature(requestToSign, signingValues);\n const credentialEntry = `Credential=${accessKeyId}/${credentialScope}`;\n const signedHeadersEntry = `SignedHeaders=${getSignedHeaders(headers)}`;\n const signatureEntry = `Signature=${signature}`;\n headers[AUTH_HEADER] =\n `${SHA256_ALGORITHM_IDENTIFIER} ${credentialEntry}, ${signedHeadersEntry}, ${signatureEntry}`;\n return requestToSign;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK;AACjD,IAAI,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC;AACnD,IAAI,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,aAAa;AAClF;AACA,IAAI,MAAM,OAAO,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;AAC1C,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI;AAC3C,IAAI,OAAO,CAAC,eAAe,CAAC,GAAG,QAAQ;AACvC,IAAI,IAAI,YAAY,EAAE;AACtB,QAAQ,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY;AAC5C;
|
|
1
|
+
{"version":3,"file":"signRequest.mjs","sources":["../../../../../../../src/clients/middleware/signing/signer/signatureV4/signRequest.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getSignedHeaders } from './utils/getSignedHeaders';\nimport { getSigningValues } from './utils/getSigningValues';\nimport { AMZ_DATE_HEADER, AUTH_HEADER, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, TOKEN_HEADER, } from './constants';\nimport { getSignature } from './utils/getSignature';\n/**\n * Given a `HttpRequest`, returns a Signature Version 4 signed `HttpRequest`.\n *\n * @param request `HttpRequest` to be signed.\n * @param signRequestOptions `SignRequestOptions` object containing values used to construct the signature.\n * @returns A `HttpRequest` with authentication headers which can grant temporary access to AWS resources.\n */\nexport const signRequest = (request, options) => {\n const signingValues = getSigningValues(options);\n const { accessKeyId, credentialScope, longDate, sessionToken } = signingValues;\n // create the request to sign\n const headers = { ...request.headers };\n headers[HOST_HEADER] = request.url.host;\n headers[AMZ_DATE_HEADER] = longDate;\n if (sessionToken) {\n headers[TOKEN_HEADER] = sessionToken;\n }\n const requestToSign = { ...request, headers };\n // calculate and add the signature to the request\n const signature = getSignature(requestToSign, signingValues);\n const credentialEntry = `Credential=${accessKeyId}/${credentialScope}`;\n const signedHeadersEntry = `SignedHeaders=${getSignedHeaders(headers)}`;\n const signatureEntry = `Signature=${signature}`;\n headers[AUTH_HEADER] =\n `${SHA256_ALGORITHM_IDENTIFIER} ${credentialEntry}, ${signedHeadersEntry}, ${signatureEntry}`;\n return requestToSign;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK;AACjD,IAAI,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC;AACnD,IAAI,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,aAAa;AAClF;AACA,IAAI,MAAM,OAAO,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;AAC1C,IAAI,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI;AAC3C,IAAI,OAAO,CAAC,eAAe,CAAC,GAAG,QAAQ;AACvC,IAAI,IAAI,YAAY,EAAE;AACtB,QAAQ,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY;AAC5C,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;AACjD;AACA,IAAI,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,EAAE,aAAa,CAAC;AAChE,IAAI,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;AAC1E,IAAI,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3E,IAAI,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACnD,IAAI,OAAO,CAAC,WAAW,CAAC;AACxB,QAAQ,CAAC,EAAE,2BAA2B,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,kBAAkB,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;AACrG,IAAI,OAAO,aAAa;AACxB;;;;"}
|
package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCanonicalQueryString.mjs","sources":["../../../../../../../../src/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Returns a canonical query string.\n *\n * @param searchParams `searchParams` from the request url.\n * @returns URL-encoded query string parameters, separated by ampersands (&). Percent-encode reserved characters,\n * including the space character. Encode names and values separately. If there are empty parameters, append the equals\n * sign to the parameter name before encoding. After encoding, sort the parameters alphabetically by key name. If there\n * is no query string, use an empty string (\"\").\n *\n * @internal\n */\nexport const getCanonicalQueryString = (searchParams) => Array.from(searchParams)\n .sort(([keyA, valA], [keyB, valB]) => {\n if (keyA === keyB) {\n return valA < valB ? -1 : 1;\n }\n return keyA < keyB ? -1 : 1;\n})\n .map(([key, val]) => `${escapeUri(key)}=${escapeUri(val)}`)\n .join('&');\nconst escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);\nconst hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,CAAC,YAAY,KAAK,KAAK,CAAC,IAAI,CAAC,YAAY;AAChF,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK;AAC1C,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE;AACvB,QAAQ,OAAO,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC;AACnC;
|
|
1
|
+
{"version":3,"file":"getCanonicalQueryString.mjs","sources":["../../../../../../../../src/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Returns a canonical query string.\n *\n * @param searchParams `searchParams` from the request url.\n * @returns URL-encoded query string parameters, separated by ampersands (&). Percent-encode reserved characters,\n * including the space character. Encode names and values separately. If there are empty parameters, append the equals\n * sign to the parameter name before encoding. After encoding, sort the parameters alphabetically by key name. If there\n * is no query string, use an empty string (\"\").\n *\n * @internal\n */\nexport const getCanonicalQueryString = (searchParams) => Array.from(searchParams)\n .sort(([keyA, valA], [keyB, valB]) => {\n if (keyA === keyB) {\n return valA < valB ? -1 : 1;\n }\n return keyA < keyB ? -1 : 1;\n})\n .map(([key, val]) => `${escapeUri(key)}=${escapeUri(val)}`)\n .join('&');\nconst escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);\nconst hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,CAAC,YAAY,KAAK,KAAK,CAAC,IAAI,CAAC,YAAY;AAChF,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK;AAC1C,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE;AACvB,QAAQ,OAAO,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC;AACnC,IAAI;AACJ,IAAI,OAAO,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC;AAC/B,CAAC;AACD,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,KAAK,IAAI,CAAC,GAAG;AACb,MAAM,SAAS,GAAG,CAAC,GAAG,KAAK,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC;AACjF,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;;;;"}
|
package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHashedPayload.mjs","sources":["../../../../../../../../src/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { EMPTY_HASH, UNSIGNED_PAYLOAD } from '../constants';\nimport { getHashedDataAsHex } from './dataHashHelpers';\n/**\n * Returns the hashed payload.\n *\n * @param body `body` (payload) from the request.\n * @returns String created using the payload in the body of the HTTP request as input to a hash function. This string\n * uses lowercase hexadecimal characters. If the payload is empty, return precalculated result of an empty hash.\n *\n * @internal\n */\nexport const getHashedPayload = (body) => {\n // return precalculated empty hash if body is undefined or null\n if (body == null) {\n return EMPTY_HASH;\n }\n if (isSourceData(body)) {\n const hashedData = getHashedDataAsHex(null, body);\n return hashedData;\n }\n // Defined body is not signable. Return unsigned payload which may or may not be accepted by the service.\n return UNSIGNED_PAYLOAD;\n};\nconst isSourceData = (body) => typeof body === 'string' || ArrayBuffer.isView(body) || isArrayBuffer(body);\nconst isArrayBuffer = (arg) => (typeof ArrayBuffer === 'function' && arg instanceof ArrayBuffer) ||\n Object.prototype.toString.call(arg) === '[object ArrayBuffer]';\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,IAAI,KAAK;AAC1C;AACA,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AACtB,QAAQ,OAAO,UAAU;AACzB;
|
|
1
|
+
{"version":3,"file":"getHashedPayload.mjs","sources":["../../../../../../../../src/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { EMPTY_HASH, UNSIGNED_PAYLOAD } from '../constants';\nimport { getHashedDataAsHex } from './dataHashHelpers';\n/**\n * Returns the hashed payload.\n *\n * @param body `body` (payload) from the request.\n * @returns String created using the payload in the body of the HTTP request as input to a hash function. This string\n * uses lowercase hexadecimal characters. If the payload is empty, return precalculated result of an empty hash.\n *\n * @internal\n */\nexport const getHashedPayload = (body) => {\n // return precalculated empty hash if body is undefined or null\n if (body == null) {\n return EMPTY_HASH;\n }\n if (isSourceData(body)) {\n const hashedData = getHashedDataAsHex(null, body);\n return hashedData;\n }\n // Defined body is not signable. Return unsigned payload which may or may not be accepted by the service.\n return UNSIGNED_PAYLOAD;\n};\nconst isSourceData = (body) => typeof body === 'string' || ArrayBuffer.isView(body) || isArrayBuffer(body);\nconst isArrayBuffer = (arg) => (typeof ArrayBuffer === 'function' && arg instanceof ArrayBuffer) ||\n Object.prototype.toString.call(arg) === '[object ArrayBuffer]';\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,IAAI,KAAK;AAC1C;AACA,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AACtB,QAAQ,OAAO,UAAU;AACzB,IAAI;AACJ,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE;AAC5B,QAAQ,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC;AACzD,QAAQ,OAAO,UAAU;AACzB,IAAI;AACJ;AACA,IAAI,OAAO,gBAAgB;AAC3B;AACA,MAAM,YAAY,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC;AAC1G,MAAM,aAAa,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,WAAW,KAAK,UAAU,IAAI,GAAG,YAAY,WAAW;AAC/F,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,sBAAsB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUpdatedSystemClockOffset.mjs","sources":["../../../../../../src/clients/middleware/signing/utils/getUpdatedSystemClockOffset.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isClockSkewed } from './isClockSkewed';\n/**\n * Returns the difference between clock time and the current system time if clock is skewed.\n *\n * @param clockTimeInMilliseconds Clock time in milliseconds.\n * @param currentSystemClockOffset Current system clock offset in milliseconds.\n *\n * @internal\n */\nexport const getUpdatedSystemClockOffset = (clockTimeInMilliseconds, currentSystemClockOffset) => {\n if (isClockSkewed(clockTimeInMilliseconds, currentSystemClockOffset)) {\n return clockTimeInMilliseconds - Date.now();\n }\n return currentSystemClockOffset;\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,KAAK;AAClG,IAAI,IAAI,aAAa,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,EAAE;AAC1E,QAAQ,OAAO,uBAAuB,GAAG,IAAI,CAAC,GAAG,EAAE;AACnD;
|
|
1
|
+
{"version":3,"file":"getUpdatedSystemClockOffset.mjs","sources":["../../../../../../src/clients/middleware/signing/utils/getUpdatedSystemClockOffset.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { isClockSkewed } from './isClockSkewed';\n/**\n * Returns the difference between clock time and the current system time if clock is skewed.\n *\n * @param clockTimeInMilliseconds Clock time in milliseconds.\n * @param currentSystemClockOffset Current system clock offset in milliseconds.\n *\n * @internal\n */\nexport const getUpdatedSystemClockOffset = (clockTimeInMilliseconds, currentSystemClockOffset) => {\n if (isClockSkewed(clockTimeInMilliseconds, currentSystemClockOffset)) {\n return clockTimeInMilliseconds - Date.now();\n }\n return currentSystemClockOffset;\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,KAAK;AAClG,IAAI,IAAI,aAAa,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,EAAE;AAC1E,QAAQ,OAAO,uBAAuB,GAAG,IAAI,CAAC,GAAG,EAAE;AACnD,IAAI;AACJ,IAAI,OAAO,wBAAwB;AACnC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.mjs","sources":["../../../../../src/clients/middleware/userAgent/middleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Middleware injects user agent string to specified header(default to 'x-amz-user-agent'),\n * if the header is not set already.\n *\n * TODO: incorporate new user agent design\n */\nexport const userAgentMiddlewareFactory = ({ userAgentHeader = 'x-amz-user-agent', userAgentValue = '', }) => next => {\n return async function userAgentMiddleware(request) {\n if (userAgentValue.trim().length === 0) {\n const result = await next(request);\n return result;\n }\n else {\n const headerName = userAgentHeader.toLowerCase();\n request.headers[headerName] = request.headers[headerName]\n ? `${request.headers[headerName]} ${userAgentValue}`\n : userAgentValue;\n const response = await next(request);\n return response;\n }\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,0BAA0B,GAAG,CAAC,EAAE,eAAe,GAAG,kBAAkB,EAAE,cAAc,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI;AACtH,IAAI,OAAO,eAAe,mBAAmB,CAAC,OAAO,EAAE;AACvD,QAAQ,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAChD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;AAC9C,YAAY,OAAO,MAAM;AACzB;
|
|
1
|
+
{"version":3,"file":"middleware.mjs","sources":["../../../../../src/clients/middleware/userAgent/middleware.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Middleware injects user agent string to specified header(default to 'x-amz-user-agent'),\n * if the header is not set already.\n *\n * TODO: incorporate new user agent design\n */\nexport const userAgentMiddlewareFactory = ({ userAgentHeader = 'x-amz-user-agent', userAgentValue = '', }) => next => {\n return async function userAgentMiddleware(request) {\n if (userAgentValue.trim().length === 0) {\n const result = await next(request);\n return result;\n }\n else {\n const headerName = userAgentHeader.toLowerCase();\n request.headers[headerName] = request.headers[headerName]\n ? `${request.headers[headerName]} ${userAgentValue}`\n : userAgentValue;\n const response = await next(request);\n return response;\n }\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,0BAA0B,GAAG,CAAC,EAAE,eAAe,GAAG,kBAAkB,EAAE,cAAc,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI;AACtH,IAAI,OAAO,eAAe,mBAAmB,CAAC,OAAO,EAAE;AACvD,QAAQ,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAChD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;AAC9C,YAAY,OAAO,MAAM;AACzB,QAAQ;AACR,aAAa;AACb,YAAY,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,EAAE;AAC5D,YAAY,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU;AACpE,kBAAkB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;AACnE,kBAAkB,cAAc;AAChC,YAAY,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;AAChD,YAAY,OAAO,QAAQ;AAC3B,QAAQ;AACR,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.mjs","sources":["../../../../src/clients/serde/json.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseMetadata } from './responseInfo';\n/**\n * Utility functions for serializing and deserializing of JSON protocol in general(including: REST-JSON, JSON-RPC, etc.)\n */\n/**\n * Error parser for AWS JSON protocol.\n */\nexport const parseJsonError = async (response) => {\n if (!response || response.statusCode < 300) {\n return;\n }\n const body = await parseJsonBody(response);\n const sanitizeErrorCode = (rawValue) => {\n const [cleanValue] = rawValue.toString().split(/[,:]+/);\n if (cleanValue.includes('#')) {\n return cleanValue.split('#')[1];\n }\n return cleanValue;\n };\n const code = sanitizeErrorCode(response.headers['x-amzn-errortype'] ??\n body.code ??\n body.__type ??\n 'UnknownError');\n const message = body.message ?? body.Message ?? 'Unknown error';\n const error = new Error(message);\n return Object.assign(error, {\n name: code,\n $metadata: parseMetadata(response),\n });\n};\n/**\n * Parse JSON response body to JavaScript object.\n */\nexport const parseJsonBody = async (response) => {\n if (!response.body) {\n throw new Error('Missing response payload');\n }\n const output = await response.body.json();\n return Object.assign(output, {\n $metadata: parseMetadata(response),\n });\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,QAAQ,KAAK;AAClD,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAChD,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"json.mjs","sources":["../../../../src/clients/serde/json.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseMetadata } from './responseInfo';\n/**\n * Utility functions for serializing and deserializing of JSON protocol in general(including: REST-JSON, JSON-RPC, etc.)\n */\n/**\n * Error parser for AWS JSON protocol.\n */\nexport const parseJsonError = async (response) => {\n if (!response || response.statusCode < 300) {\n return;\n }\n const body = await parseJsonBody(response);\n const sanitizeErrorCode = (rawValue) => {\n const [cleanValue] = rawValue.toString().split(/[,:]+/);\n if (cleanValue.includes('#')) {\n return cleanValue.split('#')[1];\n }\n return cleanValue;\n };\n const code = sanitizeErrorCode(response.headers['x-amzn-errortype'] ??\n body.code ??\n body.__type ??\n 'UnknownError');\n const message = body.message ?? body.Message ?? 'Unknown error';\n const error = new Error(message);\n return Object.assign(error, {\n name: code,\n $metadata: parseMetadata(response),\n });\n};\n/**\n * Parse JSON response body to JavaScript object.\n */\nexport const parseJsonBody = async (response) => {\n if (!response.body) {\n throw new Error('Missing response payload');\n }\n const output = await response.body.json();\n return Object.assign(output, {\n $metadata: parseMetadata(response),\n });\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,QAAQ,KAAK;AAClD,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAChD,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AAC9C,IAAI,MAAM,iBAAiB,GAAG,CAAC,QAAQ,KAAK;AAC5C,QAAQ,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;AAC/D,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACtC,YAAY,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,QAAQ;AACR,QAAQ,OAAO,UAAU;AACzB,IAAI,CAAC;AACL,IAAI,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACvE,QAAQ,IAAI,CAAC,IAAI;AACjB,QAAQ,IAAI,CAAC,MAAM;AACnB,QAAQ,cAAc,CAAC;AACvB,IAAI,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,eAAe;AACnE,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC;AACpC,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;AAChC,QAAQ,IAAI,EAAE,IAAI;AAClB,QAAQ,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC1C,KAAK,CAAC;AACN;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,OAAO,QAAQ,KAAK;AACjD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;AACxB,QAAQ,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC;AACnD,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;AAC7C,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;AACjC,QAAQ,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC1C,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoization.mjs","sources":["../../../../src/clients/utils/memoization.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Cache the payload of a response body. It allows multiple calls to the body,\n * for example, when reading the body in both retry decider and error deserializer.\n * Caching body is allowed here because we call the body accessor(blob(), json(),\n * etc.) when body is small or streaming implementation is not available(RN).\n *\n * @internal\n */\nexport const withMemoization = (payloadAccessor) => {\n let cached;\n return () => {\n if (!cached) {\n // Explicitly not awaiting. Intermediate await would add overhead and\n // introduce a possible race in the event that this wrapper is called\n // again before the first `payloadAccessor` call resolves.\n cached = payloadAccessor();\n }\n return cached;\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,eAAe,KAAK;AACpD,IAAI,IAAI,MAAM;AACd,IAAI,OAAO,MAAM;AACjB,QAAQ,IAAI,CAAC,MAAM,EAAE;AACrB;AACA;AACA;AACA,YAAY,MAAM,GAAG,eAAe,EAAE;AACtC;
|
|
1
|
+
{"version":3,"file":"memoization.mjs","sources":["../../../../src/clients/utils/memoization.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Cache the payload of a response body. It allows multiple calls to the body,\n * for example, when reading the body in both retry decider and error deserializer.\n * Caching body is allowed here because we call the body accessor(blob(), json(),\n * etc.) when body is small or streaming implementation is not available(RN).\n *\n * @internal\n */\nexport const withMemoization = (payloadAccessor) => {\n let cached;\n return () => {\n if (!cached) {\n // Explicitly not awaiting. Intermediate await would add overhead and\n // introduce a possible race in the event that this wrapper is called\n // again before the first `payloadAccessor` call resolves.\n cached = payloadAccessor();\n }\n return cached;\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,eAAe,KAAK;AACpD,IAAI,IAAI,MAAM;AACd,IAAI,OAAO,MAAM;AACjB,QAAQ,IAAI,CAAC,MAAM,EAAE;AACrB;AACA;AACA;AACA,YAAY,MAAM,GAAG,eAAe,EAAE;AACtC,QAAQ;AACR,QAAQ,OAAO,MAAM;AACrB,IAAI,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIError.mjs","sources":["../../../src/errors/APIError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from './AmplifyError';\n/**\n * Error class for errors that associated with unsuccessful HTTP responses.\n * It's throw by API category REST API handlers and GraphQL query handlers for now.\n */\nexport class ApiError extends AmplifyError {\n /**\n * The unwrapped HTTP response causing the given API error.\n */\n get response() {\n return this._response\n ? replicateApiErrorResponse(this._response)\n : undefined;\n }\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = ApiError;\n Object.setPrototypeOf(this, ApiError.prototype);\n if (params.response) {\n this._response = params.response;\n }\n }\n}\nconst replicateApiErrorResponse = (response) => ({\n ...response,\n headers: { ...response.headers },\n});\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACO,MAAM,QAAQ,SAAS,YAAY,CAAC;AAC3C;AACA;AACA;AACA,IAAI,IAAI,QAAQ,GAAG;AACnB,QAAQ,OAAO,IAAI,CAAC;AACpB,cAAc,yBAAyB,CAAC,IAAI,CAAC,SAAS;AACtD,cAAc,SAAS;AACvB;
|
|
1
|
+
{"version":3,"file":"APIError.mjs","sources":["../../../src/errors/APIError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from './AmplifyError';\n/**\n * Error class for errors that associated with unsuccessful HTTP responses.\n * It's throw by API category REST API handlers and GraphQL query handlers for now.\n */\nexport class ApiError extends AmplifyError {\n /**\n * The unwrapped HTTP response causing the given API error.\n */\n get response() {\n return this._response\n ? replicateApiErrorResponse(this._response)\n : undefined;\n }\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = ApiError;\n Object.setPrototypeOf(this, ApiError.prototype);\n if (params.response) {\n this._response = params.response;\n }\n }\n}\nconst replicateApiErrorResponse = (response) => ({\n ...response,\n headers: { ...response.headers },\n});\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACO,MAAM,QAAQ,SAAS,YAAY,CAAC;AAC3C;AACA;AACA;AACA,IAAI,IAAI,QAAQ,GAAG;AACnB,QAAQ,OAAO,IAAI,CAAC;AACpB,cAAc,yBAAyB,CAAC,IAAI,CAAC,SAAS;AACtD,cAAc,SAAS;AACvB,IAAI;AACJ,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC;AACrB;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,QAAQ;AACnC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;AACvD,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE;AAC7B,YAAY,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ;AAC5C,QAAQ;AACR,IAAI;AACJ;AACA,MAAM,yBAAyB,GAAG,CAAC,QAAQ,MAAM;AACjD,IAAI,GAAG,QAAQ;AACf,IAAI,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE;AACpC,CAAC,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmplifyError.mjs","sources":["../../../src/errors/AmplifyError.ts"],"sourcesContent":["export class AmplifyError extends Error {\n /**\n * Constructs an AmplifyError.\n *\n * @param message text that describes the main problem.\n * @param underlyingError the underlying cause of the error.\n * @param recoverySuggestion suggestion to recover from the error.\n *\n */\n constructor({ message, name, recoverySuggestion, underlyingError, metadata, }) {\n super(message);\n this.name = name;\n this.underlyingError = underlyingError;\n this.recoverySuggestion = recoverySuggestion;\n if (metadata) {\n // If metadata exists, explicitly only record the following properties.\n const { extendedRequestId, httpStatusCode, requestId } = metadata;\n this.metadata = { extendedRequestId, httpStatusCode, requestId };\n }\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = AmplifyError;\n Object.setPrototypeOf(this, AmplifyError.prototype);\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,YAAY,SAAS,KAAK,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,GAAG,EAAE;AACnF,QAAQ,KAAK,CAAC,OAAO,CAAC;AACtB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,eAAe,GAAG,eAAe;AAC9C,QAAQ,IAAI,CAAC,kBAAkB,GAAG,kBAAkB;AACpD,QAAQ,IAAI,QAAQ,EAAE;AACtB;AACA,YAAY,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,QAAQ;AAC7E,YAAY,IAAI,CAAC,QAAQ,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE;AAC5E;
|
|
1
|
+
{"version":3,"file":"AmplifyError.mjs","sources":["../../../src/errors/AmplifyError.ts"],"sourcesContent":["export class AmplifyError extends Error {\n /**\n * Constructs an AmplifyError.\n *\n * @param message text that describes the main problem.\n * @param underlyingError the underlying cause of the error.\n * @param recoverySuggestion suggestion to recover from the error.\n *\n */\n constructor({ message, name, recoverySuggestion, underlyingError, metadata, }) {\n super(message);\n this.name = name;\n this.underlyingError = underlyingError;\n this.recoverySuggestion = recoverySuggestion;\n if (metadata) {\n // If metadata exists, explicitly only record the following properties.\n const { extendedRequestId, httpStatusCode, requestId } = metadata;\n this.metadata = { extendedRequestId, httpStatusCode, requestId };\n }\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = AmplifyError;\n Object.setPrototypeOf(this, AmplifyError.prototype);\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,YAAY,SAAS,KAAK,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,GAAG,EAAE;AACnF,QAAQ,KAAK,CAAC,OAAO,CAAC;AACtB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,eAAe,GAAG,eAAe;AAC9C,QAAQ,IAAI,CAAC,kBAAkB,GAAG,kBAAkB;AACpD,QAAQ,IAAI,QAAQ,EAAE;AACtB;AACA,YAAY,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,QAAQ;AAC7E,YAAY,IAAI,CAAC,QAAQ,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE;AAC5E,QAAQ;AACR;AACA;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,YAAY;AACvC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;AAC3D,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformNotSupportedError.mjs","sources":["../../../src/errors/PlatformNotSupportedError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode } from '../types';\nimport { AmplifyError } from './AmplifyError';\nexport class PlatformNotSupportedError extends AmplifyError {\n constructor() {\n super({\n name: AmplifyErrorCode.PlatformNotSupported,\n message: 'Function not supported on current platform',\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,MAAM,yBAAyB,SAAS,YAAY,CAAC;AAC5D,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,gBAAgB,CAAC,oBAAoB;AACvD,YAAY,OAAO,EAAE,4CAA4C;AACjE,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"PlatformNotSupportedError.mjs","sources":["../../../src/errors/PlatformNotSupportedError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode } from '../types';\nimport { AmplifyError } from './AmplifyError';\nexport class PlatformNotSupportedError extends AmplifyError {\n constructor() {\n super({\n name: AmplifyErrorCode.PlatformNotSupported,\n message: 'Function not supported on current platform',\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,MAAM,yBAAyB,SAAS,YAAY,CAAC;AAC5D,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,gBAAgB,CAAC,oBAAoB;AACvD,YAAY,OAAO,EAAE,4CAA4C;AACjE,SAAS,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAssertionFunction.mjs","sources":["../../../src/errors/createAssertionFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from './AmplifyError';\nexport const createAssertionFunction = (errorMap, AssertionError = AmplifyError) => (assertion, name, additionalContext) => {\n const { message, recoverySuggestion } = errorMap[name];\n if (!assertion) {\n throw new AssertionError({\n name,\n message: additionalContext\n ? `${message} ${additionalContext}`\n : message,\n recoverySuggestion,\n });\n }\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,uBAAuB,GAAG,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,KAAK;AAC5H,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC1D,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,cAAc,CAAC;AACjC,YAAY,IAAI;AAChB,YAAY,OAAO,EAAE;AACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC;AAClD,kBAAkB,OAAO;AACzB,YAAY,kBAAkB;AAC9B,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"createAssertionFunction.mjs","sources":["../../../src/errors/createAssertionFunction.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from './AmplifyError';\nexport const createAssertionFunction = (errorMap, AssertionError = AmplifyError) => (assertion, name, additionalContext) => {\n const { message, recoverySuggestion } = errorMap[name];\n if (!assertion) {\n throw new AssertionError({\n name,\n message: additionalContext\n ? `${message} ${additionalContext}`\n : message,\n recoverySuggestion,\n });\n }\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,uBAAuB,GAAG,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,KAAK;AAC5H,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC1D,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,cAAc,CAAC;AACjC,YAAY,IAAI;AAChB,YAAY,OAAO,EAAE;AACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC;AAClD,kBAAkB,OAAO;AACzB,YAAY,kBAAkB;AAC9B,SAAS,CAAC;AACV,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGetCredentialsForIdentityClient.mjs","sources":["../../../../../../src/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../../../clients';\nimport { composeServiceApi } from '../../../../clients/internal';\nimport { getAmplifyUserAgent } from '../../../../Platform';\nimport { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';\nimport { cognitoIdentityTransferHandler } from './handler';\nimport { createClientSerializer } from './serde';\nexport const createGetCredentialsForIdentityClient = (config) => composeServiceApi(cognitoIdentityTransferHandler, createClientSerializer('GetCredentialsForIdentity'), getCredentialsForIdentityDeserializer, {\n ...DEFAULT_SERVICE_CLIENT_API_CONFIG,\n ...config,\n userAgentValue: getAmplifyUserAgent(),\n});\nconst getCredentialsForIdentityDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n const body = await parseJsonBody(response);\n return {\n IdentityId: body.IdentityId,\n Credentials: deserializeCredentials(body.Credentials),\n $metadata: parseMetadata(response),\n };\n};\nconst deserializeCredentials = ({ Expiration, ...rest } = {}) => ({\n ...rest,\n Expiration: Expiration && new Date(Expiration * 1000),\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOY,MAAC,qCAAqC,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,2BAA2B,CAAC,EAAE,qCAAqC,EAAE;AAC/M,IAAI,GAAG,iCAAiC;AACxC,IAAI,GAAG,MAAM;AACb,IAAI,cAAc,EAAE,mBAAmB,EAAE;AACzC,CAAC;AACD,MAAM,qCAAqC,GAAG,OAAO,QAAQ,KAAK;AAClE,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":"createGetCredentialsForIdentityClient.mjs","sources":["../../../../../../src/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../../../clients';\nimport { composeServiceApi } from '../../../../clients/internal';\nimport { getAmplifyUserAgent } from '../../../../Platform';\nimport { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';\nimport { cognitoIdentityTransferHandler } from './handler';\nimport { createClientSerializer } from './serde';\nexport const createGetCredentialsForIdentityClient = (config) => composeServiceApi(cognitoIdentityTransferHandler, createClientSerializer('GetCredentialsForIdentity'), getCredentialsForIdentityDeserializer, {\n ...DEFAULT_SERVICE_CLIENT_API_CONFIG,\n ...config,\n userAgentValue: getAmplifyUserAgent(),\n});\nconst getCredentialsForIdentityDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n const body = await parseJsonBody(response);\n return {\n IdentityId: body.IdentityId,\n Credentials: deserializeCredentials(body.Credentials),\n $metadata: parseMetadata(response),\n };\n};\nconst deserializeCredentials = ({ Expiration, ...rest } = {}) => ({\n ...rest,\n Expiration: Expiration && new Date(Expiration * 1000),\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOY,MAAC,qCAAqC,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,2BAA2B,CAAC,EAAE,qCAAqC,EAAE;AAC/M,IAAI,GAAG,iCAAiC;AACxC,IAAI,GAAG,MAAM;AACb,IAAI,cAAc,EAAE,mBAAmB,EAAE;AACzC,CAAC;AACD,MAAM,qCAAqC,GAAG,OAAO,QAAQ,KAAK;AAClE,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,IAAI,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AAC9C,IAAI,OAAO;AACX,QAAQ,UAAU,EAAE,IAAI,CAAC,UAAU;AACnC,QAAQ,WAAW,EAAE,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC;AAC7D,QAAQ,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC1C,KAAK;AACL,CAAC;AACD,MAAM,sBAAsB,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM;AAClE,IAAI,GAAG,IAAI;AACX,IAAI,UAAU,EAAE,UAAU,IAAI,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACzD,CAAC,CAAC;;;;"}
|
package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGetIdClient.mjs","sources":["../../../../../../src/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../../../clients';\nimport { composeServiceApi } from '../../../../clients/internal';\nimport { getAmplifyUserAgent } from '../../../../Platform';\nimport { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';\nimport { cognitoIdentityTransferHandler } from './handler';\nimport { createClientSerializer } from './serde';\nexport const createGetIdClient = (config) => composeServiceApi(cognitoIdentityTransferHandler, createClientSerializer('GetId'), getIdDeserializer, {\n ...DEFAULT_SERVICE_CLIENT_API_CONFIG,\n ...config,\n userAgentValue: getAmplifyUserAgent(),\n});\nconst getIdDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n const body = await parseJsonBody(response);\n return {\n IdentityId: body.IdentityId,\n $metadata: parseMetadata(response),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOY,MAAC,iBAAiB,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE;AACnJ,IAAI,GAAG,iCAAiC;AACxC,IAAI,GAAG,MAAM;AACb,IAAI,cAAc,EAAE,mBAAmB,EAAE;AACzC,CAAC;AACD,MAAM,iBAAiB,GAAG,OAAO,QAAQ,KAAK;AAC9C,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":"createGetIdClient.mjs","sources":["../../../../../../src/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../../../clients';\nimport { composeServiceApi } from '../../../../clients/internal';\nimport { getAmplifyUserAgent } from '../../../../Platform';\nimport { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';\nimport { cognitoIdentityTransferHandler } from './handler';\nimport { createClientSerializer } from './serde';\nexport const createGetIdClient = (config) => composeServiceApi(cognitoIdentityTransferHandler, createClientSerializer('GetId'), getIdDeserializer, {\n ...DEFAULT_SERVICE_CLIENT_API_CONFIG,\n ...config,\n userAgentValue: getAmplifyUserAgent(),\n});\nconst getIdDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n const body = await parseJsonBody(response);\n return {\n IdentityId: body.IdentityId,\n $metadata: parseMetadata(response),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOY,MAAC,iBAAiB,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE;AACnJ,IAAI,GAAG,iCAAiC;AACxC,IAAI,GAAG,MAAM;AACb,IAAI,cAAc,EAAE,mBAAmB,EAAE;AACzC,CAAC;AACD,MAAM,iBAAiB,GAAG,OAAO,QAAQ,KAAK;AAC9C,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,IAAI,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AAC9C,IAAI,OAAO;AACX,QAAQ,UAAU,EAAE,IAAI,CAAC,UAAU;AACnC,QAAQ,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC1C,KAAK;AACL,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAWSExports.mjs","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from './Logger';\nimport { AmplifyError } from './errors';\nconst logger = new ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n AWS_LAMBDA: 'lambda',\n // `LAMBDA` is an incorrect value that was added during the v6 rewrite.\n // Keeping it as a valid value until v7 to prevent breaking customers who might\n // be relying on it as a workaround.\n // ref: https://github.com/aws-amplify/amplify-js/pull/12922\n // TODO: @v7 remove next line\n LAMBDA: 'lambda',\n};\n/**\n * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by\n * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.\n *\n * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.\n *\n * @returns An object that conforms to the {@link ResourcesConfig} .\n */\nexport const parseAWSExports = (config = {}) => {\n if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {\n throw new AmplifyError({\n name: 'InvalidParameterException',\n message: 'Invalid config parameter.',\n recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',\n });\n }\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications = {\n InAppMessaging: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications = {\n ...amplifyConfig.Notifications,\n PushNotification: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n if (modelIntrospection) {\n amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;\n }\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\n }), {});\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: !(loginWithEmailEnabled || loginWithPhoneEnabled),\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = {\n LocationService: {\n maps: amazon_location_service.maps,\n geofenceCollections: amazon_location_service.geofenceCollections,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);\n });\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC;AACnD,MAAM,eAAe,GAAG;AACxB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,yBAAyB,EAAE,UAAU;AACzC,IAAI,cAAc,EAAE,MAAM;AAC1B,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,UAAU,EAAE,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,KAAK;AAChD,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE;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KAAK,CAAC;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"parseAWSExports.mjs","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from './Logger';\nimport { AmplifyError } from './errors';\nconst logger = new ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n AWS_LAMBDA: 'lambda',\n // `LAMBDA` is an incorrect value that was added during the v6 rewrite.\n // Keeping it as a valid value until v7 to prevent breaking customers who might\n // be relying on it as a workaround.\n // ref: https://github.com/aws-amplify/amplify-js/pull/12922\n // TODO: @v7 remove next line\n LAMBDA: 'lambda',\n};\n/**\n * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by\n * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.\n *\n * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.\n *\n * @returns An object that conforms to the {@link ResourcesConfig} .\n */\nexport const parseAWSExports = (config = {}) => {\n if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {\n throw new AmplifyError({\n name: 'InvalidParameterException',\n message: 'Invalid config parameter.',\n recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',\n });\n }\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications = {\n InAppMessaging: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications = {\n ...amplifyConfig.Notifications,\n PushNotification: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n if (modelIntrospection) {\n amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;\n }\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\n }), {});\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: !(loginWithEmailEnabled || loginWithPhoneEnabled),\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = {\n LocationService: {\n maps: amazon_location_service.maps,\n geofenceCollections: amazon_location_service.geofenceCollections,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider.charAt(0).toUpperCase() + upd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,IAAI;AACJ,IAAI,OAAO,aAAa;AACxB;AACA,MAAM,cAAc,GAAG,CAAC,WAAW,KAAK,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;AACrE,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,GAAG,MAAM;AAC/F,IAAI,MAAM;AACV,IAAI,MAAM,EAAE,KAAK;AACjB,IAAI,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC;AAClD,IAAI,eAAe,EAAE,cAAc,CAAC,eAAe,CAAC;AACpD,IAAI,YAAY;AAChB,CAAC,CAAC;AACF,MAAM,oBAAoB,GAAG,CAAC,4BAA4B,KAAK;AAC/D,IAAI,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1D,QAAQ,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE;AACtD,QAAQ,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACjF,IAAI,CAAC,CAAC;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n const sanitizedPaths = paths\n ? Object.entries(paths).reduce((acc, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\n }, {})\n : undefined;\n mappedBuckets[name] = {\n bucketName,\n region,\n paths: sanitizedPaths,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM;AAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AAClC;AACA,SAAS,YAAY,CAAC,+BAA+B,EAAE;AACvD,IAAI,IAAI,CAAC,+BAA+B,EAAE;AAC1C,QAAQ,OAAO,SAAS;AACxB;AACA,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,+BAA+B;AAChF,IAAI,OAAO;AACX,QAAQ,EAAE,EAAE;AACZ,YAAY,MAAM,EAAE,WAAW;AAC/B,YAAY,MAAM,EAAE,UAAU;AAC9B,YAAY,OAAO,EAAE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC;AAC5D,SAAS;AACT,KAAK;AACL;AACA,SAAS,SAAS,CAAC,4BAA4B,EAAE;AACjD,IAAI,IAAI,CAAC,4BAA4B,EAAE;AACvC,QAAQ,OAAO,SAAS;AACxB;AACA,IAAI,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,kCAAkC,EAAE,KAAK,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,GAAG,GAAG,4BAA4B;AACxP,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OA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ACvB,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK,EAAE,cAAc;AACjC,SAAS;AACT,KAAK,CAAC;AACN,IAAI,OAAO,aAAa;AACxB;;;;"}
|
|
1
|
+
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n const sanitizedPaths = paths\n ? Object.entries(paths).reduce((acc, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\n }, {})\n : undefined;\n mappedBuckets[name] = {\n bucketName,\n region,\n paths: sanitizedPaths,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM;AAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AAClC;AACA,SAAS,YAAY,CAAC,+BAA+B,EAAE;AACvD,IAAI,IAAI,CA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AS,YAAY,CAAC,gBAAgB,EAAE;AACxC,IAAI,IAAI,gBAAgB,KAAK,UAAU;AACvC,QAAQ,OAAO,UAAU;AACzB,IAAI,IAAI,gBAAgB,KAAK,UAAU;AACvC,QAAQ,OAAO,IAAI;AACnB,IAAI,OAAO,KAAK;AAChB;AACA,SAAS,mBAAmB,CAAC,OAAO,EAAE;AACtC,IAAI,MAAM,aAAa,GAAG,EAAE;AAC5B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;AACtF,QAAQ,IAAI,IAAI,IAAI,aAAa,EAAE;AACnC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,+BAA+B,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAC3F,QAAQ;AACR,QAAQ,MAAM,cAAc,GAAG;AAC/B,cAAc,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAClE,gBAAgB,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,oBAAoB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AACpC,gBAAgB;AAChB,gBAAgB,OAAO,GAAG;AAC1B,YAAY,CAAC,EAAE,EAAE;AACjB,cAAc,SAAS;AACvB,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK,EAAE,cAAc;AACjC,SAAS;AACT,IAAI,CAAC,CAAC;AACN,IAAI,OAAO,aAAa;AACxB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { resolveEndpointId } from '../utils';\nimport { SESSION_START_EVENT, SESSION_STOP_EVENT, } from '../../../utils/sessionListener';\nimport { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';\nimport { getEventBuffer } from '../utils/getEventBuffer';\nlet session;\n/**\n * @internal\n */\nexport const record = async ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, bufferSize, flushInterval, flushSize, resendLimit, }) => {\n let eventSession = session;\n const currentTime = new Date();\n const timestampISOString = currentTime.toISOString();\n const eventId = amplifyUuid();\n // Prepare event buffer if required\n const buffer = getEventBuffer({\n appId,\n region,\n credentials,\n bufferSize: bufferSize ?? BUFFER_SIZE,\n flushInterval: flushInterval ?? FLUSH_INTERVAL,\n flushSize: flushSize ?? FLUSH_SIZE,\n resendLimit: resendLimit ?? RESEND_LIMIT,\n identityId,\n userAgentValue,\n });\n const endpointId = await resolveEndpointId({\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n // Generate session if required\n if (!eventSession || event.name === SESSION_START_EVENT) {\n const sessionId = amplifyUuid();\n session = {\n Id: sessionId,\n StartTimestamp: timestampISOString,\n };\n eventSession = session;\n }\n // Terminate session when required\n if (session && event.name === SESSION_STOP_EVENT) {\n eventSession = {\n ...session,\n StopTimestamp: timestampISOString,\n Duration: currentTime.getTime() - new Date(session.StartTimestamp).getTime(),\n };\n session = undefined;\n }\n // Push event to buffer\n buffer.push({\n eventId,\n endpointId,\n event,\n session: eventSession,\n timestamp: timestampISOString,\n resendLimit: resendLimit ?? RESEND_LIMIT,\n });\n};\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAMA,IAAI,OAAO;AACX;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,GAAG,KAAK;AAC9K,IAAI,IAAI,YAAY,GAAG,OAAO;AAC9B,IAAI,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE;AAClC,IAAI,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW,EAAE;AACxD,IAAI,MAAM,OAAO,GAAG,WAAW,EAAE;AACjC;AACA,IAAI,MAAM,MAAM,GAAG,cAAc,CAAC;AAClC,QAAQ,KAAK;AACb,QAAQ,MAAM;AACd,QAAQ,WAAW;AACnB,QAAQ,UAAU,EAAE,UAAU,IAAI,WAAW;AAC7C,QAAQ,aAAa,EAAE,aAAa,IAAI,cAAc;AACtD,QAAQ,SAAS,EAAE,SAAS,IAAI,UAAU;AAC1C,QAAQ,WAAW,EAAE,WAAW,IAAI,YAAY;AAChD,QAAQ,UAAU;AAClB,QAAQ,cAAc;AACtB,KAAK,CAAC;AACN,IAAI,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;AAC/C,QAAQ,KAAK;AACb,QAAQ,QAAQ;AAChB,QAAQ,WAAW;AACnB,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,cAAc;AACtB,KAAK,CAAC;AACN;AACA,IAAI,IAAI,CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE;AAC7D,QAAQ,MAAM,SAAS,GAAG,WAAW,EAAE;AACvC,QAAQ,OAAO,GAAG;AAClB,YAAY,EAAE,EAAE,SAAS;AACzB,YAAY,cAAc,EAAE,kBAAkB;AAC9C,SAAS;AACT,QAAQ,YAAY,GAAG,OAAO;AAC9B;
|
|
1
|
+
{"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { resolveEndpointId } from '../utils';\nimport { SESSION_START_EVENT, SESSION_STOP_EVENT, } from '../../../utils/sessionListener';\nimport { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';\nimport { getEventBuffer } from '../utils/getEventBuffer';\nlet session;\n/**\n * @internal\n */\nexport const record = async ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, bufferSize, flushInterval, flushSize, resendLimit, }) => {\n let eventSession = session;\n const currentTime = new Date();\n const timestampISOString = currentTime.toISOString();\n const eventId = amplifyUuid();\n // Prepare event buffer if required\n const buffer = getEventBuffer({\n appId,\n region,\n credentials,\n bufferSize: bufferSize ?? BUFFER_SIZE,\n flushInterval: flushInterval ?? FLUSH_INTERVAL,\n flushSize: flushSize ?? FLUSH_SIZE,\n resendLimit: resendLimit ?? RESEND_LIMIT,\n identityId,\n userAgentValue,\n });\n const endpointId = await resolveEndpointId({\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n // Generate session if required\n if (!eventSession || event.name === SESSION_START_EVENT) {\n const sessionId = amplifyUuid();\n session = {\n Id: sessionId,\n StartTimestamp: timestampISOString,\n };\n eventSession = session;\n }\n // Terminate session when required\n if (session && event.name === SESSION_STOP_EVENT) {\n eventSession = {\n ...session,\n StopTimestamp: timestampISOString,\n Duration: currentTime.getTime() - new Date(session.StartTimestamp).getTime(),\n };\n session = undefined;\n }\n // Push event to buffer\n buffer.push({\n eventId,\n endpointId,\n event,\n session: eventSession,\n timestamp: timestampISOString,\n resendLimit: resendLimit ?? RESEND_LIMIT,\n });\n};\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAMA,IAAI,OAAO;AACX;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,GAAG,KAAK;AA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c,CAAC,CAAC,OAAO,EAAE;AACxF,SAAS;AACT,QAAQ,OAAO,GAAG,SAAS;AAC3B,IAAI;AACJ;AACA,IAAI,MAAM,CAAC,IAAI,CAAC;AAChB,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,KAAK;AACb,QAAQ,OAAO,EAAE,YAAY;AAC7B,QAAQ,SAAS,EAAE,kBAAkB;AACrC,QAAQ,WAAW,EAAE,WAAW,IAAI,YAAY;AAChD,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateEndpoint.mjs","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getClientInfo } from '../../../utils/getClientInfo';\nimport { cacheEndpointId } from '../utils/cacheEndpointId';\nimport { clearCreatedEndpointId, createEndpointId, } from '../utils/createEndpointId';\nimport { getEndpointId } from '../utils/getEndpointId';\n/**\n * @internal\n */\nexport const updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await getEndpointId(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId\n ? createEndpointId(appId, category)\n : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n // only automatically populate the endpoint with client info and identity id upon endpoint creation to\n // avoid overwriting the endpoint with these values every time the endpoint is updated\n const demographicsFromClientInfo = {};\n const resolvedUserId = createdEndpointId ? (userId ?? identityId) : userId;\n if (createdEndpointId) {\n const clientInfo = getClientInfo();\n demographicsFromClientInfo.appVersion = clientInfo.appVersion;\n demographicsFromClientInfo.make = clientInfo.make;\n demographicsFromClientInfo.model = clientInfo.model;\n demographicsFromClientInfo.modelVersion = clientInfo.version;\n demographicsFromClientInfo.platform = clientInfo.platform;\n }\n const mergedDemographic = {\n ...demographicsFromClientInfo,\n ...demographic,\n };\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const shouldAddDemographics = createdEndpointId || demographic;\n const shouldAddAttributes = email || customProperties || name || plan;\n const shouldAddUser = resolvedUserId || userAttributes;\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: amplifyUuid(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n ...(shouldAddAttributes && { Attributes: attributes }),\n ...(shouldAddDemographics && {\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n }),\n ...(location && {\n Location: {\n City: location.city,\n Country: location.country,\n Latitude: location.latitude,\n Longitude: location.longitude,\n PostalCode: location.postalCode,\n Region: location.region,\n },\n }),\n Metrics: metrics,\n OptOut: optOut,\n ...(shouldAddUser && {\n User: {\n UserId: resolvedUserId,\n UserAttributes: userAttributes,\n },\n }),\n },\n };\n try {\n await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (createdEndpointId) {\n await cacheEndpointId(appId, category, createdEndpointId);\n }\n }\n finally {\n // at this point, we completely reset the behavior so even if the update was unsuccessful\n // we can just start over with a newly created endpoint id\n if (createdEndpointId) {\n clearCreatedEndpointId(appId, category);\n }\n }\n};\n"],"names":["clientUpdateEndpoint"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAClL,IAAI,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC3D;AACA,IAAI,MAAM,iBAAiB,GAAG,CAAC;AAC/B,UAAU,gBAAgB,CAAC,KAAK,EAAE,QAAQ;AAC1C,UAAU,SAAS;AACnB,IAAI,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,IAAI,EAAE;AACtG;AACA;AACA,IAAI,MAAM,0BAA0B,GAAG,EAAE;AACzC,IAAI,MAAM,cAAc,GAAG,iBAAiB,IAAI,MAAM,IAAI,UAAU,IAAI,MAAM;AAC9E,IAAI,IAAI,iBAAiB,EAAE;AAC3B,QAAQ,MAAM,UAAU,GAAG,aAAa,EAAE;AAC1C,QAAQ,0BAA0B,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU;AACrE,QAAQ,0BAA0B,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI;AACzD,QAAQ,0BAA0B,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;AAC3D,QAAQ,0BAA0B,CAAC,YAAY,GAAG,UAAU,CAAC,OAAO;AACpE,QAAQ,0BAA0B,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ;AACjE;
|
|
1
|
+
{"version":3,"file":"updateEndpoint.mjs","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getClientInfo } from '../../../utils/getClientInfo';\nimport { cacheEndpointId } from '../utils/cacheEndpointId';\nimport { clearCreatedEndpointId, createEndpointId, } from '../utils/createEndpointId';\nimport { getEndpointId } from '../utils/getEndpointId';\n/**\n * @internal\n */\nexport const updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await getEndpointId(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId\n ? createEndpointId(appId, category)\n : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n // only automatically populate the endpoint with client info and identity id upon endpoint creation to\n // avoid overwriting the endpoint with these values every time the endpoint is updated\n const demographicsFromClientInfo = {};\n const resolvedUserId = createdEndpointId ? (userId ?? identityId) : userId;\n if (createdEndpointId) {\n const clientInfo = getClientInfo();\n demographicsFromClientInfo.appVersion = clientInfo.appVersion;\n demographicsFromClientInfo.make = clientInfo.make;\n demographicsFromClientInfo.model = clientInfo.model;\n demographicsFromClientInfo.modelVersion = clientInfo.version;\n demographicsFromClientInfo.platform = clientInfo.platform;\n }\n const mergedDemographic = {\n ...demographicsFromClientInfo,\n ...demographic,\n };\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const shouldAddDemographics = createdEndpointId || demographic;\n const shouldAddAttributes = email || customProperties || name || plan;\n const shouldAddUser = resolvedUserId || userAttributes;\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: amplifyUuid(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n ...(shouldAddAttributes && { Attributes: attributes }),\n ...(shouldAddDemographics && {\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n }),\n ...(location && {\n Location: {\n City: location.city,\n Country: location.country,\n Latitude: location.latitude,\n Longitude: location.longitude,\n PostalCode: location.postalCode,\n Region: location.region,\n },\n }),\n Metrics: metrics,\n OptOut: optOut,\n ...(shouldAddUser && {\n User: {\n UserId: resolvedUserId,\n UserAttributes: userAttributes,\n },\n }),\n },\n };\n try {\n await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (createdEndpointId) {\n await cacheEndpointId(appId, category, createdEndpointId);\n }\n }\n finally {\n // at this point, we completely reset the behavior so even if the update was unsuccessful\n // we can just start over with a newly created endpoint id\n if (createdEndpointId) {\n clearCreatedEndpointId(appId, category);\n }\n }\n};\n"],"names":["clientUpdateEndpoint"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAClL,IAAI,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC3D;AACA,IAAI,MAAM,iBAAiB,GAAG,CAAC;AAC/B,UAAU,gBAAgB,CAAC,KAAK,EAAE,QAAQ;AAC1C,UAAU,SAAS;AACnB,IAAI,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,IAAI,EAAE;AACtG;AACA;AACA,IAAI,MAAM,0BAA0B,GAAG,EAAE;AACzC,IAAI,MAAM,cAAc,GAAG,iBAAiB,IAAI,MAAM,IAAI,UAAU,IAAI,MAAM;AAC9E,IAAI,IAAI,iBAAiB,EAAE;AAC3B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E,EAAE,KAAK,CAAC;AAClF;AACA,QAAQ,IAAI,iBAAiB,EAAE;AAC/B,YAAY,MAAM,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,CAAC;AACrE,QAAQ;AACR,IAAI;AACJ,YAAY;AACZ;AACA;AACA,QAAQ,IAAI,iBAAiB,EAAE;AAC/B,YAAY,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC;AACnD,QAAQ;AACR,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinpointEventBuffer.mjs","sources":["../../../../../src/providers/pinpoint/utils/PinpointEventBuffer.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../../../Logger';\nimport { putEvents, } from '../../../awsClients/pinpoint';\nimport { haveCredentialsChanged } from '../../../utils/haveCredentialsChanged';\nimport { isAppInForeground } from './isAppInForeground';\nconst logger = new ConsoleLogger('PinpointEventBuffer');\nconst RETRYABLE_CODES = [429, 500];\nconst ACCEPTED_CODES = [202];\nexport class PinpointEventBuffer {\n constructor(config) {\n this._interval = undefined;\n this._pause = false;\n this._flush = false;\n this._buffer = [];\n this._config = config;\n this._sendBatch = this._sendBatch.bind(this);\n this._startLoop();\n }\n push(event) {\n if (this._buffer.length >= this._config.bufferSize) {\n logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {\n eventId: event.eventId,\n });\n return;\n }\n this._buffer.push({ [event.eventId]: event });\n }\n pause() {\n this._pause = true;\n }\n resume() {\n this._pause = false;\n }\n flush() {\n this._flush = true;\n }\n identityHasChanged(identityId) {\n return this._config.identityId !== identityId;\n }\n haveCredentialsChanged(credentials) {\n return haveCredentialsChanged(this._config.credentials, credentials);\n }\n flushAll() {\n this._putEvents(this._buffer.splice(0, this._buffer.length));\n }\n _startLoop() {\n if (this._interval) {\n clearInterval(this._interval);\n }\n const { flushInterval } = this._config;\n this._interval = setInterval(this._sendBatch, flushInterval);\n }\n _sendBatch() {\n const bufferLength = this._buffer.length;\n if (this._flush && !bufferLength && this._interval) {\n clearInterval(this._interval);\n }\n if (this._pause || !bufferLength || !isAppInForeground()) {\n return;\n }\n const { flushSize } = this._config;\n const batchSize = Math.min(flushSize, bufferLength);\n const bufferSubset = this._buffer.splice(0, batchSize);\n this._putEvents(bufferSubset);\n }\n async _putEvents(buffer) {\n const eventMap = this._bufferToMap(buffer);\n const batchEventParams = this._generateBatchEventParams(eventMap);\n try {\n const { credentials, region, userAgentValue } = this._config;\n const data = await putEvents({\n credentials,\n region,\n userAgentValue,\n }, batchEventParams);\n this._processPutEventsSuccessResponse(data, eventMap);\n }\n catch (err) {\n this._handlePutEventsFailure(err, eventMap);\n }\n }\n _generateBatchEventParams(eventMap) {\n const batchItem = {};\n Object.values(eventMap).forEach(item => {\n const { event, timestamp, endpointId, eventId, session } = item;\n const { name, attributes, metrics } = event;\n batchItem[endpointId] = {\n Endpoint: {\n ...batchItem[endpointId]?.Endpoint,\n },\n Events: {\n ...batchItem[endpointId]?.Events,\n [eventId]: {\n EventType: name,\n Timestamp: new Date(timestamp).toISOString(),\n Attributes: attributes,\n Metrics: metrics,\n Session: session,\n },\n },\n };\n });\n return {\n ApplicationId: this._config.appId,\n EventsRequest: {\n BatchItem: batchItem,\n },\n };\n }\n _handlePutEventsFailure(err, eventMap) {\n logger.debug('putEvents call to Pinpoint failed.', err);\n const statusCode = err.$metadata && err.$metadata.httpStatusCode;\n if (RETRYABLE_CODES.includes(statusCode)) {\n const retryableEvents = Object.values(eventMap);\n this._retry(retryableEvents);\n }\n }\n _processPutEventsSuccessResponse(data, eventMap) {\n const { Results = {} } = data.EventsResponse ?? {};\n const retryableEvents = [];\n Object.entries(Results).forEach(([_, endpointValues]) => {\n const responses = endpointValues.EventsItemResponse ?? {};\n Object.entries(responses).forEach(([eventId, eventValues]) => {\n const eventObject = eventMap[eventId];\n if (!eventObject) {\n return;\n }\n const { StatusCode, Message } = eventValues ?? {};\n if (StatusCode && ACCEPTED_CODES.includes(StatusCode)) {\n return;\n }\n if (StatusCode && RETRYABLE_CODES.includes(StatusCode)) {\n retryableEvents.push(eventObject);\n return;\n }\n const { name } = eventObject.event;\n logger.warn('Pinpoint event failed to send.', {\n eventId,\n name,\n message: Message,\n });\n });\n });\n if (retryableEvents.length) {\n this._retry(retryableEvents);\n }\n }\n _retry(retryableEvents) {\n // retryable events that haven't reached the resendLimit\n const eligibleEvents = [];\n retryableEvents.forEach((bufferedEvent) => {\n const { eventId } = bufferedEvent;\n const { name } = bufferedEvent.event;\n if (bufferedEvent.resendLimit-- > 0) {\n logger.debug('Resending event.', {\n eventId,\n name,\n remainingAttempts: bufferedEvent.resendLimit,\n });\n eligibleEvents.push({ [eventId]: bufferedEvent });\n return;\n }\n logger.debug('No retry attempts remaining for event.', {\n eventId,\n name,\n });\n });\n // add the events to the front of the buffer\n this._buffer.unshift(...eligibleEvents);\n }\n _bufferToMap(buffer) {\n return buffer.reduce((acc, curVal) => {\n const [[key, value]] = Object.entries(curVal);\n acc[key] = value;\n return acc;\n }, {});\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AAKA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,qBAAqB,CAAC;AACvD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAClC,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC;AACrB,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,QAAQ,IAAI,CAAC,MAAM,GAAG,KAAK;AAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,KAAK;AAC3B,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE;AACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,MAAM;AAC7B,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAA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zD,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAC5B,YAAY,OAAO,GAAG;AACtB,SAAS,EAAE,EAAE,CAAC;AACd;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"PinpointEventBuffer.mjs","sources":["../../../../../src/providers/pinpoint/utils/PinpointEventBuffer.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../../../Logger';\nimport { putEvents, } from '../../../awsClients/pinpoint';\nimport { haveCredentialsChanged } from '../../../utils/haveCredentialsChanged';\nimport { isAppInForeground } from './isAppInForeground';\nconst logger = new ConsoleLogger('PinpointEventBuffer');\nconst RETRYABLE_CODES = [429, 500];\nconst ACCEPTED_CODES = [202];\nexport class PinpointEventBuffer {\n constructor(config) {\n this._interval = undefined;\n this._pause = false;\n this._flush = false;\n this._buffer = [];\n this._config = config;\n this._sendBatch = this._sendBatch.bind(this);\n this._startLoop();\n }\n push(event) {\n if (this._buffer.length >= this._config.bufferSize) {\n logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {\n eventId: event.eventId,\n });\n return;\n }\n this._buffer.push({ [event.eventId]: event });\n }\n pause() {\n this._pause = true;\n }\n resume() {\n this._pause = false;\n }\n flush() {\n this._flush = true;\n }\n identityHasChanged(identityId) {\n return this._config.identityId !== identityId;\n }\n haveCredentialsChanged(credentials) {\n return haveCredentialsChanged(this._config.credentials, credentials);\n }\n flushAll() {\n this._putEvents(this._buffer.splice(0, this._buffer.length));\n }\n _startLoop() {\n if (this._interval) {\n clearInterval(this._interval);\n }\n const { flushInterval } = this._config;\n this._interval = setInterval(this._sendBatch, flushInterval);\n }\n _sendBatch() {\n const bufferLength = this._buffer.length;\n if (this._flush && !bufferLength && this._interval) {\n clearInterval(this._interval);\n }\n if (this._pause || !bufferLength || !isAppInForeground()) {\n return;\n }\n const { flushSize } = this._config;\n const batchSize = Math.min(flushSize, bufferLength);\n const bufferSubset = this._buffer.splice(0, batchSize);\n this._putEvents(bufferSubset);\n }\n async _putEvents(buffer) {\n const eventMap = this._bufferToMap(buffer);\n const batchEventParams = this._generateBatchEventParams(eventMap);\n try {\n const { credentials, region, userAgentValue } = this._config;\n const data = await putEvents({\n credentials,\n region,\n userAgentValue,\n }, batchEventParams);\n this._processPutEventsSuccessResponse(data, eventMap);\n }\n catch (err) {\n this._handlePutEventsFailure(err, eventMap);\n }\n }\n _generateBatchEventParams(eventMap) {\n const batchItem = {};\n Object.values(eventMap).forEach(item => {\n const { event, timestamp, endpointId, eventId, session } = item;\n const { name, attributes, metrics } = event;\n batchItem[endpointId] = {\n Endpoint: {\n ...batchItem[endpointId]?.Endpoint,\n },\n Events: {\n ...batchItem[endpointId]?.Events,\n [eventId]: {\n EventType: name,\n Timestamp: new Date(timestamp).toISOString(),\n Attributes: attributes,\n Metrics: metrics,\n Session: session,\n },\n },\n };\n });\n return {\n ApplicationId: this._config.appId,\n EventsRequest: {\n BatchItem: batchItem,\n },\n };\n }\n _handlePutEventsFailure(err, eventMap) {\n logger.debug('putEvents call to Pinpoint failed.', err);\n const statusCode = err.$metadata && err.$metadata.httpStatusCode;\n if (RETRYABLE_CODES.includes(statusCode)) {\n const retryableEvents = Object.values(eventMap);\n this._retry(retryableEvents);\n }\n }\n _processPutEventsSuccessResponse(data, eventMap) {\n const { Results = {} } = data.EventsResponse ?? {};\n const retryableEvents = [];\n Object.entries(Results).forEach(([_, endpointValues]) => {\n const responses = endpointValues.EventsItemResponse ?? {};\n Object.entries(responses).forEach(([eventId, eventValues]) => {\n const eventObject = eventMap[eventId];\n if (!eventObject) {\n return;\n }\n const { StatusCode, Message } = eventValues ?? {};\n if (StatusCode && ACCEPTED_CODES.includes(StatusCode)) {\n return;\n }\n if (StatusCode && RETRYABLE_CODES.includes(StatusCode)) {\n retryableEvents.push(eventObject);\n return;\n }\n const { name } = eventObject.event;\n logger.warn('Pinpoint event failed to send.', {\n eventId,\n name,\n message: Message,\n });\n });\n });\n if (retryableEvents.length) {\n this._retry(retryableEvents);\n }\n }\n _retry(retryableEvents) {\n // retryable events that haven't reached the resendLimit\n const eligibleEvents = [];\n retryableEvents.forEach((bufferedEvent) => {\n const { eventId } = bufferedEvent;\n const { name } = bufferedEvent.event;\n if (bufferedEvent.resendLimit-- > 0) {\n logger.debug('Resending event.', {\n eventId,\n name,\n remainingAttempts: bufferedEvent.resendLimit,\n });\n eligibleEvents.push({ [eventId]: bufferedEvent });\n return;\n }\n logger.debug('No retry attempts remaining for event.', {\n eventId,\n name,\n });\n });\n // add the events to the front of the buffer\n this._buffer.unshift(...eligibleEvents);\n }\n _bufferToMap(buffer) {\n return buffer.reduce((acc, curVal) => {\n const [[key, value]] = Object.entries(curVal);\n acc[key] = value;\n return acc;\n }, {});\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AAKA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,qBAAqB,CAAC;AACvD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAClC,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC;AACrB,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,IAAI,CAAC,SAAS,GAAG,SAAS;AAClC,QAAQ,IAAI,CAAC,MAAM,GAAG,KAAK;AAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,KAAK;AAC3B,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE;AACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,MAAM;AAC7B,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AACpD,QAAQ,IAAI,CAAC,UAAU,EAAE;AACzB,IAAI;AACJ,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,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OAAO,CAAC,MAAM,CAAC;AACzD,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAC5B,YAAY,OAAO,GAAG;AACtB,QAAQ,CAAC,EAAE,EAAE,CAAC;AACd,IAAI;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/createEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getCacheKey } from './getCacheKey';\nconst createdEndpointIds = {};\n/**\n * Creates an endpoint id and guarantees multiple creations for a category returns the same uuid.\n *\n * @internal\n */\nexport const createEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n if (!createdEndpointIds[cacheKey]) {\n createdEndpointIds[cacheKey] = amplifyUuid();\n }\n return createdEndpointIds[cacheKey];\n};\n/**\n * Clears a created endpoint id for a category.\n *\n * @internal\n */\nexport const clearCreatedEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n delete createdEndpointIds[cacheKey];\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,kBAAkB,GAAG,EAAE;AAC7B;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AACrD,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;AACjD,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;AACvC,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,GAAG,WAAW,EAAE;AACpD;
|
|
1
|
+
{"version":3,"file":"createEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/createEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getCacheKey } from './getCacheKey';\nconst createdEndpointIds = {};\n/**\n * Creates an endpoint id and guarantees multiple creations for a category returns the same uuid.\n *\n * @internal\n */\nexport const createEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n if (!createdEndpointIds[cacheKey]) {\n createdEndpointIds[cacheKey] = amplifyUuid();\n }\n return createdEndpointIds[cacheKey];\n};\n/**\n * Clears a created endpoint id for a category.\n *\n * @internal\n */\nexport const clearCreatedEndpointId = (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n delete createdEndpointIds[cacheKey];\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,MAAM,kBAAkB,GAAG,EAAE;AAC7B;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AACrD,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;AACjD,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;AACvC,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,GAAG,WAAW,EAAE;AACpD,IAAI;AACJ,IAAI,OAAO,kBAAkB,CAAC,QAAQ,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AAC3D,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;AACjD,IAAI,OAAO,kBAAkB,CAAC,QAAQ,CAAC;AACvC;;;;"}
|