@aws-amplify/core 6.0.1-api-v6-models.9351bcf.0 → 6.0.1-api-v6-models.58f2536.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/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -21
- package/lib/BackgroundProcessManager/BackgroundProcessManager.js +126 -245
- package/lib/Cache/StorageCache.js +32 -92
- package/lib/Cache/StorageCache.native.js +38 -140
- package/lib/Cache/StorageCacheCommon.js +271 -600
- package/lib/Cache/index.js +1 -1
- package/lib/Cache/utils/CacheList.js +42 -66
- package/lib/Cache/utils/cacheHelpers.js +6 -8
- package/lib/Cache/utils/errorHelpers.js +6 -7
- package/lib/Hub/index.js +34 -74
- package/lib/I18n/I18n.js +24 -39
- package/lib/I18n/errorHelpers.js +4 -5
- package/lib/I18n/index.js +24 -27
- package/lib/I18n/types.js +3 -4
- package/lib/Logger/ConsoleLogger.js +53 -129
- package/lib/Mutex/Mutex.js +15 -19
- package/lib/Platform/customUserAgent.js +13 -26
- package/lib/Platform/detectFramework.js +12 -13
- package/lib/Platform/detection/Angular.js +4 -5
- package/lib/Platform/detection/Expo.js +1 -1
- package/lib/Platform/detection/Next.js +1 -1
- package/lib/Platform/detection/Nuxt.js +1 -1
- package/lib/Platform/detection/React.js +5 -5
- package/lib/Platform/detection/Svelte.js +2 -2
- package/lib/Platform/detection/Vue.js +1 -1
- package/lib/Platform/detection/Web.js +1 -1
- package/lib/Platform/detection/helpers.js +7 -7
- package/lib/Platform/detection/index.js +13 -13
- package/lib/Platform/index.js +26 -55
- package/lib/Platform/types.d.ts +1 -1
- package/lib/Platform/types.js +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Reachability/Reachability.js +20 -48
- package/lib/Reachability/Reachability.native.js +12 -16
- package/lib/ServiceWorker/ServiceWorker.js +80 -136
- package/lib/ServiceWorker/errorHelpers.js +6 -7
- package/lib/Signer/DateUtils.d.ts +9 -0
- package/lib/Signer/DateUtils.js +19 -28
- package/lib/Signer/Signer.d.ts +9 -0
- package/lib/Signer/Signer.js +58 -54
- package/lib/adapterCore/error/AmplifyServerContextError.js +9 -27
- package/lib/adapterCore/serverContext/serverContext.js +8 -8
- package/lib/adapterCore/serverContext/serverContextRegistry.js +6 -6
- package/lib/awsClients/cognitoIdentity/base.js +25 -73
- package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.js +24 -68
- package/lib/awsClients/cognitoIdentity/getId.js +19 -62
- package/lib/awsClients/pinpoint/base.js +12 -15
- package/lib/awsClients/pinpoint/errorHelpers.js +4 -5
- package/lib/awsClients/pinpoint/getInAppMessages.js +24 -68
- package/lib/awsClients/pinpoint/putEvents.js +26 -70
- package/lib/awsClients/pinpoint/updateEndpoint.js +28 -72
- package/lib/clients/endpoints/getDnsSuffix.js +7 -29
- package/lib/clients/handlers/authenticated.js +5 -5
- package/lib/clients/handlers/fetch.js +41 -98
- package/lib/clients/handlers/unauthenticated.js +4 -4
- package/lib/clients/internal/composeServiceApi.js +17 -67
- package/lib/clients/internal/composeTransferHandler.js +9 -11
- package/lib/clients/middleware/retry/defaultRetryDecider.js +18 -75
- package/lib/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib/clients/middleware/retry/jitteredBackoff.js +5 -5
- package/lib/clients/middleware/retry/middleware.js +61 -125
- package/lib/clients/middleware/signing/middleware.js +24 -86
- package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +21 -56
- package/lib/clients/middleware/signing/signer/signatureV4/signRequest.js +14 -25
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +7 -7
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +13 -17
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +2 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +7 -11
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +9 -10
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +8 -8
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +15 -16
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +2 -4
- package/lib/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
- package/lib/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
- package/lib/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +2 -2
- package/lib/clients/middleware/signing/utils/isClockSkewed.js +4 -6
- package/lib/clients/middleware/userAgent/middleware.js +14 -63
- package/lib/clients/serde/json.js +30 -96
- package/lib/clients/serde/responseInfo.js +12 -18
- package/lib/clients/utils/memoization.js +3 -3
- package/lib/constants.js +1 -1
- package/lib/errors/AmplifyError.js +9 -28
- package/lib/errors/PlatformNotSupportedError.js +7 -24
- package/lib/errors/createAssertionFunction.js +12 -15
- package/lib/errors/errorHelpers.js +7 -8
- package/lib/index.d.ts +1 -1
- package/lib/libraryUtils.d.ts +4 -0
- package/lib/libraryUtils.js +13 -3
- package/lib/parseAWSExports.js +109 -100
- package/lib/providers/kinesis/types/kinesis.d.ts +1 -1
- package/lib/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
- package/lib/providers/personalize/types/personalize.d.ts +1 -1
- package/lib/providers/pinpoint/apis/flushEvents.js +8 -8
- package/lib/providers/pinpoint/apis/record.js +58 -93
- package/lib/providers/pinpoint/apis/updateEndpoint.js +65 -112
- package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -1
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +105 -196
- package/lib/providers/pinpoint/utils/cacheEndpointId.js +12 -49
- package/lib/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib/providers/pinpoint/utils/getEndpointId.js +7 -51
- package/lib/providers/pinpoint/utils/getEventBuffer.js +19 -21
- package/lib/providers/pinpoint/utils/isAppInForeground.js +1 -1
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +2 -2
- package/lib/providers/pinpoint/utils/resolveEndpointId.js +20 -71
- package/lib/singleton/Amplify.d.ts +4 -0
- package/lib/singleton/Amplify.js +21 -103
- package/lib/singleton/Analytics/types.d.ts +5 -1
- package/lib/singleton/Auth/index.js +48 -115
- package/lib/singleton/Auth/types.d.ts +2 -2
- package/lib/singleton/Auth/utils/errorHelpers.js +7 -8
- package/lib/singleton/Auth/utils/index.js +18 -19
- package/lib/singleton/Predictions/types.d.ts +49 -0
- package/lib/singleton/Predictions/types.js +4 -0
- package/lib/singleton/apis/clearCredentials.js +1 -1
- package/lib/singleton/apis/fetchAuthSession.js +3 -3
- package/lib/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib/singleton/apis/server/fetchAuthSession.js +3 -3
- package/lib/singleton/types.d.ts +3 -1
- package/lib/storage/CookieStorage.js +29 -99
- package/lib/storage/CookieStorage.native.js +5 -22
- package/lib/storage/DefaultStorage.js +6 -23
- package/lib/storage/DefaultStorage.native.js +18 -64
- package/lib/storage/InMemoryStorage.js +17 -23
- package/lib/storage/KeyValueStorage.js +24 -80
- package/lib/storage/SessionStorage.js +6 -23
- package/lib/storage/index.js +4 -4
- package/lib/storage/utils.js +7 -11
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/WordArray.d.ts +7 -0
- package/lib/utils/WordArray.js +49 -0
- package/lib/utils/amplifyUrl/index.js +2 -2
- package/lib/utils/amplifyUrl/polyfill.native.js +1 -1
- package/lib/utils/amplifyUuid/index.d.ts +1 -1
- package/lib/utils/amplifyUuid/index.js +2 -2
- package/lib/utils/amplifyUuid/polyfill.native.js +1 -1
- package/lib/utils/convert/base64/base64Decoder.js +2 -2
- package/lib/utils/convert/base64/base64Encoder.js +5 -6
- package/lib/utils/convert/base64/bytesToString.js +1 -1
- package/lib/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib/utils/cryptoSecureRandomInt.js +16 -0
- package/lib/utils/deepFreeze.js +6 -28
- package/lib/utils/generateRandomString.js +4 -4
- package/lib/utils/getClientInfo/getClientInfo.android.js +7 -7
- package/lib/utils/getClientInfo/getClientInfo.ios.js +12 -12
- package/lib/utils/getClientInfo/getClientInfo.js +16 -16
- package/lib/utils/globalHelpers/index.js +4 -4
- package/lib/utils/globalHelpers/index.native.js +6 -6
- package/lib/utils/isBrowser.js +1 -3
- package/lib/utils/isWebWorker.js +2 -2
- package/lib/utils/retry/NonRetryableError.js +5 -23
- package/lib/utils/retry/isNonRetryableError.js +2 -2
- package/lib/utils/retry/jitteredBackoff.js +6 -7
- package/lib/utils/retry/jitteredExponentialRetry.js +4 -7
- package/lib/utils/retry/retry.js +50 -140
- package/lib/utils/sessionListener/SessionListener.js +17 -19
- package/lib/utils/sessionListener/SessionListener.native.js +18 -22
- package/lib/utils/sessionListener/constants.d.ts +2 -0
- package/lib/utils/sessionListener/constants.js +8 -0
- package/lib/utils/sessionListener/index.d.ts +1 -0
- package/lib/utils/sessionListener/index.js +5 -2
- package/lib/utils/urlSafeDecode.js +2 -2
- package/lib/utils/urlSafeEncode.js +1 -1
- package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -22
- package/lib-esm/BackgroundProcessManager/BackgroundProcessManager.js +124 -244
- package/lib-esm/Cache/StorageCache.js +26 -87
- package/lib-esm/Cache/StorageCache.native.js +33 -136
- package/lib-esm/Cache/StorageCacheCommon.js +267 -597
- package/lib-esm/Cache/constants.js +2 -2
- package/lib-esm/Cache/index.js +1 -1
- package/lib-esm/Cache/utils/CacheList.js +41 -66
- package/lib-esm/Cache/utils/cacheHelpers.js +5 -7
- package/lib-esm/Cache/utils/errorHelpers.js +6 -7
- package/lib-esm/Hub/index.js +34 -75
- package/lib-esm/I18n/I18n.js +23 -39
- package/lib-esm/I18n/errorHelpers.js +4 -5
- package/lib-esm/I18n/index.js +21 -25
- package/lib-esm/I18n/types.js +3 -5
- package/lib-esm/Logger/ConsoleLogger.js +52 -128
- package/lib-esm/Mutex/Mutex.js +15 -20
- package/lib-esm/Platform/customUserAgent.js +13 -26
- package/lib-esm/Platform/detectFramework.js +11 -12
- package/lib-esm/Platform/detection/Angular.js +3 -4
- package/lib-esm/Platform/detection/React.js +4 -4
- package/lib-esm/Platform/detection/Svelte.js +1 -1
- package/lib-esm/Platform/detection/helpers.js +7 -7
- package/lib-esm/Platform/detection/index.js +3 -3
- package/lib-esm/Platform/index.js +23 -52
- package/lib-esm/Platform/types.d.ts +1 -1
- package/lib-esm/Platform/types.js +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Reachability/Reachability.js +18 -46
- package/lib-esm/Reachability/Reachability.native.js +10 -15
- package/lib-esm/ServiceWorker/ServiceWorker.js +74 -131
- package/lib-esm/ServiceWorker/errorHelpers.js +6 -7
- package/lib-esm/Signer/DateUtils.d.ts +9 -0
- package/lib-esm/Signer/DateUtils.js +20 -29
- package/lib-esm/Signer/Signer.d.ts +9 -0
- package/lib-esm/Signer/Signer.js +54 -51
- package/lib-esm/adapterCore/error/AmplifyServerContextError.js +8 -27
- package/lib-esm/adapterCore/serverContext/serverContext.js +6 -6
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +7 -7
- package/lib-esm/awsClients/cognitoIdentity/base.js +21 -69
- package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.js +22 -66
- package/lib-esm/awsClients/cognitoIdentity/getId.js +17 -60
- package/lib-esm/awsClients/pinpoint/base.js +8 -11
- package/lib-esm/awsClients/pinpoint/errorHelpers.js +4 -5
- package/lib-esm/awsClients/pinpoint/getInAppMessages.js +19 -63
- package/lib-esm/awsClients/pinpoint/putEvents.js +20 -64
- package/lib-esm/awsClients/pinpoint/updateEndpoint.js +23 -67
- package/lib-esm/clients/endpoints/getDnsSuffix.js +6 -28
- package/lib-esm/clients/endpoints/partitions.js +2 -2
- package/lib-esm/clients/handlers/authenticated.js +1 -1
- package/lib-esm/clients/handlers/fetch.js +40 -97
- package/lib-esm/clients/handlers/unauthenticated.js +1 -1
- package/lib-esm/clients/internal/composeServiceApi.js +17 -67
- package/lib-esm/clients/internal/composeTransferHandler.js +9 -11
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -74
- package/lib-esm/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +4 -4
- package/lib-esm/clients/middleware/retry/middleware.js +61 -125
- package/lib-esm/clients/middleware/signing/middleware.js +21 -83
- package/lib-esm/clients/middleware/signing/signer/signatureV4/constants.js +17 -17
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +17 -52
- package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js +10 -21
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +5 -5
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +8 -12
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +5 -9
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +5 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +6 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +13 -14
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
- package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +1 -1
- package/lib-esm/clients/middleware/signing/utils/isClockSkewed.js +3 -5
- package/lib-esm/clients/middleware/userAgent/middleware.js +14 -63
- package/lib-esm/clients/serde/json.js +29 -95
- package/lib-esm/clients/serde/responseInfo.js +11 -17
- package/lib-esm/clients/utils/memoization.js +3 -3
- package/lib-esm/constants.js +5 -5
- package/lib-esm/errors/AmplifyError.js +9 -29
- package/lib-esm/errors/PlatformNotSupportedError.js +5 -23
- package/lib-esm/errors/createAssertionFunction.js +11 -14
- package/lib-esm/errors/errorHelpers.js +6 -7
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/libraryUtils.d.ts +4 -0
- package/lib-esm/libraryUtils.js +4 -0
- package/lib-esm/parseAWSExports.js +108 -99
- package/lib-esm/providers/kinesis/types/kinesis.d.ts +1 -1
- package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
- package/lib-esm/providers/personalize/types/personalize.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/flushEvents.js +6 -6
- package/lib-esm/providers/pinpoint/apis/record.js +54 -89
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +61 -108
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -1
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +102 -194
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +10 -47
- package/lib-esm/providers/pinpoint/utils/constants.js +4 -4
- package/lib-esm/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib-esm/providers/pinpoint/utils/getEndpointId.js +5 -49
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +17 -19
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +1 -1
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +1 -1
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +16 -67
- package/lib-esm/singleton/Amplify.d.ts +4 -0
- package/lib-esm/singleton/Amplify.js +18 -101
- package/lib-esm/singleton/Analytics/types.d.ts +5 -1
- package/lib-esm/singleton/Auth/index.js +48 -116
- package/lib-esm/singleton/Auth/types.d.ts +2 -2
- package/lib-esm/singleton/Auth/utils/errorHelpers.js +7 -8
- package/lib-esm/singleton/Auth/utils/index.js +16 -17
- package/lib-esm/singleton/Predictions/types.d.ts +49 -0
- package/lib-esm/singleton/Predictions/types.js +3 -0
- package/lib-esm/singleton/apis/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/server/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/types.d.ts +3 -1
- package/lib-esm/storage/CookieStorage.js +28 -99
- package/lib-esm/storage/CookieStorage.native.js +4 -22
- package/lib-esm/storage/DefaultStorage.js +4 -22
- package/lib-esm/storage/DefaultStorage.native.js +17 -64
- package/lib-esm/storage/InMemoryStorage.js +17 -24
- package/lib-esm/storage/KeyValueStorage.js +23 -80
- package/lib-esm/storage/SessionStorage.js +4 -22
- package/lib-esm/storage/index.js +3 -3
- package/lib-esm/storage/utils.js +6 -10
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/utils/WordArray.d.ts +7 -0
- package/lib-esm/utils/WordArray.js +46 -0
- package/lib-esm/utils/amplifyUrl/index.js +2 -2
- package/lib-esm/utils/amplifyUuid/index.d.ts +1 -1
- package/lib-esm/utils/amplifyUuid/index.js +1 -1
- package/lib-esm/utils/convert/base64/base64Decoder.js +2 -2
- package/lib-esm/utils/convert/base64/base64Encoder.js +4 -5
- package/lib-esm/utils/convert/base64/bytesToString.js +1 -1
- package/lib-esm/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib-esm/utils/cryptoSecureRandomInt.js +12 -0
- package/lib-esm/utils/deepFreeze.js +6 -28
- package/lib-esm/utils/generateRandomString.js +4 -4
- package/lib-esm/utils/getClientInfo/getClientInfo.android.js +5 -5
- package/lib-esm/utils/getClientInfo/getClientInfo.ios.js +10 -10
- package/lib-esm/utils/getClientInfo/getClientInfo.js +15 -15
- package/lib-esm/utils/globalHelpers/index.js +3 -3
- package/lib-esm/utils/globalHelpers/index.native.js +4 -4
- package/lib-esm/utils/isBrowser.js +1 -3
- package/lib-esm/utils/isWebWorker.js +2 -2
- package/lib-esm/utils/retry/NonRetryableError.js +5 -24
- package/lib-esm/utils/retry/constants.js +1 -1
- package/lib-esm/utils/retry/isNonRetryableError.js +2 -2
- package/lib-esm/utils/retry/jitteredBackoff.js +5 -6
- package/lib-esm/utils/retry/jitteredExponentialRetry.js +1 -4
- package/lib-esm/utils/retry/retry.js +48 -138
- package/lib-esm/utils/sessionListener/SessionListener.js +16 -19
- package/lib-esm/utils/sessionListener/SessionListener.native.js +17 -22
- package/lib-esm/utils/sessionListener/constants.d.ts +2 -0
- package/lib-esm/utils/sessionListener/constants.js +5 -0
- package/lib-esm/utils/sessionListener/index.d.ts +1 -0
- package/lib-esm/utils/sessionListener/index.js +2 -1
- package/lib-esm/utils/urlSafeDecode.js +2 -2
- package/lib-esm/utils/urlSafeEncode.js +1 -1
- package/package.json +11 -24
- package/src/Cache/types/index.ts +4 -4
- package/src/Platform/types.ts +1 -1
- package/src/Platform/version.ts +1 -1
- package/src/Signer/DateUtils.ts +10 -2
- package/src/Signer/Signer.ts +9 -2
- package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -1
- package/src/index.ts +1 -0
- package/src/libraryUtils.ts +7 -1
- package/src/parseAWSExports.ts +45 -6
- package/src/providers/kinesis/types/kinesis.ts +1 -1
- package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +1 -1
- package/src/providers/personalize/types/personalize.ts +1 -1
- package/src/providers/pinpoint/apis/record.ts +22 -5
- package/src/providers/pinpoint/types/pinpoint.ts +3 -1
- package/src/singleton/Amplify.ts +9 -52
- package/src/singleton/Analytics/types.ts +9 -4
- package/src/singleton/Auth/types.ts +2 -2
- package/src/singleton/Predictions/types.ts +61 -0
- package/src/singleton/types.ts +3 -1
- package/src/utils/WordArray.ts +57 -0
- package/src/utils/amplifyUuid/index.ts +1 -1
- package/src/utils/cryptoSecureRandomInt.ts +14 -0
- package/src/utils/sessionListener/constants.ts +6 -0
- package/src/utils/sessionListener/index.ts +1 -0
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __extends = (this && this.__extends) || (function () {
|
|
5
|
-
var extendStatics = function (d, b) {
|
|
6
|
-
extendStatics = Object.setPrototypeOf ||
|
|
7
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
-
return extendStatics(d, b);
|
|
10
|
-
};
|
|
11
|
-
return function (d, b) {
|
|
12
|
-
if (typeof b !== "function" && b !== null)
|
|
13
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
-
extendStatics(d, b);
|
|
15
|
-
function __() { this.constructor = d; }
|
|
16
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
5
|
exports.AmplifyServerContextError = void 0;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var message = _a.message, recoverySuggestion = _a.recoverySuggestion, underlyingError = _a.underlyingError;
|
|
26
|
-
return _super.call(this, {
|
|
6
|
+
const errors_1 = require("../../errors");
|
|
7
|
+
class AmplifyServerContextError extends errors_1.AmplifyError {
|
|
8
|
+
constructor({ message, recoverySuggestion, underlyingError, }) {
|
|
9
|
+
super({
|
|
27
10
|
name: 'AmplifyServerContextError',
|
|
28
|
-
message
|
|
29
|
-
recoverySuggestion
|
|
30
|
-
underlyingError
|
|
31
|
-
})
|
|
11
|
+
message,
|
|
12
|
+
recoverySuggestion,
|
|
13
|
+
underlyingError,
|
|
14
|
+
});
|
|
32
15
|
}
|
|
33
|
-
|
|
34
|
-
}(errors_1.AmplifyError));
|
|
16
|
+
}
|
|
35
17
|
exports.AmplifyServerContextError = AmplifyServerContextError;
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.destroyAmplifyServerContext = exports.getAmplifyServerContext = exports.createAmplifyServerContext = void 0;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const serverContextRegistry_1 = require("./serverContextRegistry");
|
|
7
|
+
const singleton_1 = require("../../singleton");
|
|
8
8
|
/**
|
|
9
9
|
* Creates an Amplify server context.
|
|
10
10
|
* @param amplifyConfig The Amplify resource config.
|
|
11
11
|
* @param libraryOptions The Amplify library options.
|
|
12
12
|
* @returns The Amplify server context spec.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const createAmplifyServerContext = (amplifyConfig, libraryOptions) => {
|
|
15
|
+
const amplify = new singleton_1.AmplifyClass();
|
|
16
16
|
amplify.configure(amplifyConfig, libraryOptions);
|
|
17
17
|
return serverContextRegistry_1.serverContextRegistry.register({
|
|
18
|
-
amplify
|
|
18
|
+
amplify,
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
exports.createAmplifyServerContext = createAmplifyServerContext;
|
|
@@ -24,8 +24,8 @@ exports.createAmplifyServerContext = createAmplifyServerContext;
|
|
|
24
24
|
* @param contextSpec The context spec used to get the Amplify server context.
|
|
25
25
|
* @returns The Amplify server context.
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const getAmplifyServerContext = (contextSpec) => {
|
|
28
|
+
const context = serverContextRegistry_1.serverContextRegistry.get(contextSpec);
|
|
29
29
|
if (context) {
|
|
30
30
|
return context;
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ exports.getAmplifyServerContext = getAmplifyServerContext;
|
|
|
36
36
|
* Destroys an Amplify server context.
|
|
37
37
|
* @param contextSpec The context spec used to destroy the Amplify server context.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
const destroyAmplifyServerContext = (contextSpec) => {
|
|
40
40
|
serverContextRegistry_1.serverContextRegistry.deregister(contextSpec);
|
|
41
41
|
};
|
|
42
42
|
exports.destroyAmplifyServerContext = destroyAmplifyServerContext;
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.serverContextRegistry = void 0;
|
|
6
|
-
|
|
6
|
+
const storage = new WeakMap();
|
|
7
7
|
function createToken() {
|
|
8
8
|
return {
|
|
9
9
|
value: Symbol('AmplifyServerContextToken'),
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
exports.serverContextRegistry = {
|
|
13
|
-
register
|
|
14
|
-
|
|
13
|
+
register(context) {
|
|
14
|
+
const token = createToken();
|
|
15
15
|
storage.set(token, context);
|
|
16
|
-
return { token
|
|
16
|
+
return { token };
|
|
17
17
|
},
|
|
18
|
-
deregister
|
|
18
|
+
deregister(contextSpec) {
|
|
19
19
|
return storage.delete(contextSpec.token);
|
|
20
20
|
},
|
|
21
|
-
get
|
|
21
|
+
get(contextSpec) {
|
|
22
22
|
return storage.get(contextSpec.token);
|
|
23
23
|
},
|
|
24
24
|
};
|
|
@@ -1,76 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
-
function step(op) {
|
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
-
switch (op[0]) {
|
|
23
|
-
case 0: case 1: t = op; break;
|
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
-
default:
|
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
-
if (t[2]) _.ops.pop();
|
|
33
|
-
_.trys.pop(); continue;
|
|
34
|
-
}
|
|
35
|
-
op = body.call(thisArg, _);
|
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
5
|
exports.buildHttpRpcRequest = exports.getSharedHeaders = exports.defaultConfig = exports.cognitoIdentityTransferHandler = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
6
|
+
const clients_1 = require("../../clients");
|
|
7
|
+
const composeTransferHandler_1 = require("../../clients/internal/composeTransferHandler");
|
|
8
|
+
const retry_1 = require("../../clients/middleware/retry");
|
|
9
|
+
const Platform_1 = require("../../Platform");
|
|
10
|
+
const detectFramework_1 = require("../../Platform/detectFramework");
|
|
11
|
+
const amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
48
12
|
/**
|
|
49
13
|
* The service name used to sign requests if the API requires authentication.
|
|
50
14
|
*/
|
|
51
|
-
|
|
15
|
+
const SERVICE_NAME = 'cognito-identity';
|
|
52
16
|
/**
|
|
53
17
|
* The endpoint resolver function that returns the endpoint URL for a given region.
|
|
54
18
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
url: new amplifyUrl_1.AmplifyUrl("https://cognito-identity.".concat(region, ".").concat((0, clients_1.getDnsSuffix)(region))),
|
|
59
|
-
});
|
|
60
|
-
};
|
|
19
|
+
const endpointResolver = ({ region }) => ({
|
|
20
|
+
url: new amplifyUrl_1.AmplifyUrl(`https://cognito-identity.${region}.${(0, clients_1.getDnsSuffix)(region)}`),
|
|
21
|
+
});
|
|
61
22
|
/**
|
|
62
23
|
* A Cognito Identity-specific middleware that disables caching for all requests.
|
|
63
24
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
request.headers['cache-control'] = 'no-store';
|
|
69
|
-
return [2 /*return*/, next(request)];
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
}; };
|
|
25
|
+
const disableCacheMiddleware = () => (next, context) => async function disableCacheMiddleware(request) {
|
|
26
|
+
request.headers['cache-control'] = 'no-store';
|
|
27
|
+
return next(request);
|
|
28
|
+
};
|
|
74
29
|
/**
|
|
75
30
|
* A Cognito Identity-specific transfer handler that does NOT sign requests, and
|
|
76
31
|
* disables caching.
|
|
@@ -83,33 +38,30 @@ exports.cognitoIdentityTransferHandler = (0, composeTransferHandler_1.composeTra
|
|
|
83
38
|
*/
|
|
84
39
|
exports.defaultConfig = {
|
|
85
40
|
service: SERVICE_NAME,
|
|
86
|
-
endpointResolver
|
|
41
|
+
endpointResolver,
|
|
87
42
|
retryDecider: (0, retry_1.getRetryDecider)(clients_1.parseJsonError),
|
|
88
43
|
computeDelay: retry_1.jitteredBackoff,
|
|
89
44
|
userAgentValue: (0, Platform_1.getAmplifyUserAgent)(),
|
|
90
45
|
cache: 'no-store',
|
|
91
46
|
};
|
|
92
|
-
(0, detectFramework_1.observeFrameworkChanges)(
|
|
47
|
+
(0, detectFramework_1.observeFrameworkChanges)(() => {
|
|
93
48
|
exports.defaultConfig.userAgentValue = (0, Platform_1.getAmplifyUserAgent)();
|
|
94
49
|
});
|
|
95
50
|
/**
|
|
96
51
|
* @internal
|
|
97
52
|
*/
|
|
98
|
-
|
|
53
|
+
const getSharedHeaders = (operation) => ({
|
|
99
54
|
'content-type': 'application/x-amz-json-1.1',
|
|
100
|
-
'x-amz-target':
|
|
101
|
-
});
|
|
55
|
+
'x-amz-target': `AWSCognitoIdentityService.${operation}`,
|
|
56
|
+
});
|
|
102
57
|
exports.getSharedHeaders = getSharedHeaders;
|
|
103
58
|
/**
|
|
104
59
|
* @internal
|
|
105
60
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
method: 'POST',
|
|
113
|
-
});
|
|
114
|
-
};
|
|
61
|
+
const buildHttpRpcRequest = ({ url }, headers, body) => ({
|
|
62
|
+
headers,
|
|
63
|
+
url,
|
|
64
|
+
body,
|
|
65
|
+
method: 'POST',
|
|
66
|
+
});
|
|
115
67
|
exports.buildHttpRpcRequest = buildHttpRpcRequest;
|
|
@@ -1,79 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
-
function step(op) {
|
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
-
switch (op[0]) {
|
|
23
|
-
case 0: case 1: t = op; break;
|
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
-
default:
|
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
-
if (t[2]) _.ops.pop();
|
|
33
|
-
_.trys.pop(); continue;
|
|
34
|
-
}
|
|
35
|
-
op = body.call(thisArg, _);
|
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
5
|
exports.getCredentialsForIdentity = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
6
|
+
const base_1 = require("./base");
|
|
7
|
+
const clients_1 = require("../../clients");
|
|
8
|
+
const internal_1 = require("../../clients/internal");
|
|
9
|
+
const getCredentialsForIdentitySerializer = (input, endpoint) => {
|
|
10
|
+
const headers = (0, base_1.getSharedHeaders)('GetCredentialsForIdentity');
|
|
11
|
+
const body = JSON.stringify(input);
|
|
48
12
|
return (0, base_1.buildHttpRpcRequest)(endpoint, headers, body);
|
|
49
13
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Credentials: deserializeCredentials(body.Credentials),
|
|
66
|
-
$metadata: (0, clients_1.parseMetadata)(response),
|
|
67
|
-
}];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}); };
|
|
71
|
-
var deserializeCredentials = function (_a) {
|
|
72
|
-
var _b = _a === void 0 ? {} : _a, AccessKeyId = _b.AccessKeyId, SecretKey = _b.SecretKey, SessionToken = _b.SessionToken, Expiration = _b.Expiration;
|
|
14
|
+
const getCredentialsForIdentityDeserializer = async (response) => {
|
|
15
|
+
if (response.statusCode >= 300) {
|
|
16
|
+
const error = await (0, clients_1.parseJsonError)(response);
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const body = await (0, clients_1.parseJsonBody)(response);
|
|
21
|
+
return {
|
|
22
|
+
IdentityId: body.IdentityId,
|
|
23
|
+
Credentials: deserializeCredentials(body.Credentials),
|
|
24
|
+
$metadata: (0, clients_1.parseMetadata)(response),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const deserializeCredentials = ({ AccessKeyId, SecretKey, SessionToken, Expiration, } = {}) => {
|
|
73
29
|
return {
|
|
74
|
-
AccessKeyId
|
|
75
|
-
SecretKey
|
|
76
|
-
SessionToken
|
|
30
|
+
AccessKeyId,
|
|
31
|
+
SecretKey,
|
|
32
|
+
SessionToken,
|
|
77
33
|
Expiration: Expiration && new Date(Expiration * 1000),
|
|
78
34
|
};
|
|
79
35
|
};
|
|
@@ -1,72 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
-
function step(op) {
|
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
-
switch (op[0]) {
|
|
23
|
-
case 0: case 1: t = op; break;
|
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
-
default:
|
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
-
if (t[2]) _.ops.pop();
|
|
33
|
-
_.trys.pop(); continue;
|
|
34
|
-
}
|
|
35
|
-
op = body.call(thisArg, _);
|
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
5
|
exports.getId = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
6
|
+
const base_1 = require("./base");
|
|
7
|
+
const clients_1 = require("../../clients");
|
|
8
|
+
const internal_1 = require("../../clients/internal");
|
|
9
|
+
const getIdSerializer = (input, endpoint) => {
|
|
10
|
+
const headers = (0, base_1.getSharedHeaders)('GetId');
|
|
11
|
+
const body = JSON.stringify(input);
|
|
48
12
|
return (0, base_1.buildHttpRpcRequest)(endpoint, headers, body);
|
|
49
13
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return [2 /*return*/, {
|
|
64
|
-
IdentityId: body.IdentityId,
|
|
65
|
-
$metadata: (0, clients_1.parseMetadata)(response),
|
|
66
|
-
}];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}); };
|
|
14
|
+
const getIdDeserializer = async (response) => {
|
|
15
|
+
if (response.statusCode >= 300) {
|
|
16
|
+
const error = await (0, clients_1.parseJsonError)(response);
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const body = await (0, clients_1.parseJsonBody)(response);
|
|
21
|
+
return {
|
|
22
|
+
IdentityId: body.IdentityId,
|
|
23
|
+
$metadata: (0, clients_1.parseMetadata)(response),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
70
27
|
/**
|
|
71
28
|
* @internal
|
|
72
29
|
*/
|
|
@@ -3,30 +3,27 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.getSharedHeaders = exports.defaultConfig = void 0;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const endpoints_1 = require("../../clients/endpoints");
|
|
7
|
+
const retry_1 = require("../../clients/middleware/retry");
|
|
8
|
+
const json_1 = require("../../clients/serde/json");
|
|
9
|
+
const Platform_1 = require("../../Platform");
|
|
10
|
+
const amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
11
11
|
/**
|
|
12
12
|
* The service name used to sign requests if the API requires authentication.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
const SERVICE_NAME = 'mobiletargeting';
|
|
15
15
|
/**
|
|
16
16
|
* The endpoint resolver function that returns the endpoint URL for a given region.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
url: new amplifyUrl_1.AmplifyUrl("https://pinpoint.".concat(region, ".").concat((0, endpoints_1.getDnsSuffix)(region))),
|
|
22
|
-
});
|
|
23
|
-
};
|
|
18
|
+
const endpointResolver = ({ region }) => ({
|
|
19
|
+
url: new amplifyUrl_1.AmplifyUrl(`https://pinpoint.${region}.${(0, endpoints_1.getDnsSuffix)(region)}`),
|
|
20
|
+
});
|
|
24
21
|
/**
|
|
25
22
|
* @internal
|
|
26
23
|
*/
|
|
27
24
|
exports.defaultConfig = {
|
|
28
25
|
service: SERVICE_NAME,
|
|
29
|
-
endpointResolver
|
|
26
|
+
endpointResolver,
|
|
30
27
|
retryDecider: (0, retry_1.getRetryDecider)(json_1.parseJsonError),
|
|
31
28
|
computeDelay: retry_1.jitteredBackoff,
|
|
32
29
|
userAgentValue: (0, Platform_1.getAmplifyUserAgent)(),
|
|
@@ -34,7 +31,7 @@ exports.defaultConfig = {
|
|
|
34
31
|
/**
|
|
35
32
|
* @internal
|
|
36
33
|
*/
|
|
37
|
-
|
|
34
|
+
const getSharedHeaders = () => ({
|
|
38
35
|
'content-type': 'application/json',
|
|
39
|
-
});
|
|
36
|
+
});
|
|
40
37
|
exports.getSharedHeaders = getSharedHeaders;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var _a;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
5
|
exports.assert = exports.PinpointValidationErrorCode = void 0;
|
|
7
|
-
|
|
6
|
+
const errors_1 = require("../../errors");
|
|
8
7
|
var PinpointValidationErrorCode;
|
|
9
8
|
(function (PinpointValidationErrorCode) {
|
|
10
9
|
PinpointValidationErrorCode["NoAppId"] = "NoAppId";
|
|
11
10
|
})(PinpointValidationErrorCode = exports.PinpointValidationErrorCode || (exports.PinpointValidationErrorCode = {}));
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const pinpointValidationErrorMap = {
|
|
12
|
+
[PinpointValidationErrorCode.NoAppId]: {
|
|
14
13
|
message: 'Missing application id.',
|
|
15
14
|
},
|
|
16
|
-
|
|
15
|
+
};
|
|
17
16
|
exports.assert = (0, errors_1.createAssertionFunction)(pinpointValidationErrorMap);
|
|
@@ -1,77 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
-
function step(op) {
|
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
-
switch (op[0]) {
|
|
23
|
-
case 0: case 1: t = op; break;
|
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
-
default:
|
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
-
if (t[2]) _.ops.pop();
|
|
33
|
-
_.trys.pop(); continue;
|
|
34
|
-
}
|
|
35
|
-
op = body.call(thisArg, _);
|
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
5
|
exports.getInAppMessages = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
6
|
+
const authenticated_1 = require("../../clients/handlers/authenticated");
|
|
7
|
+
const composeServiceApi_1 = require("../../clients/internal/composeServiceApi");
|
|
8
|
+
const extendedEncodeURIComponent_1 = require("../../clients/middleware/signing/utils/extendedEncodeURIComponent");
|
|
9
|
+
const serde_1 = require("../../clients/serde");
|
|
10
|
+
const base_1 = require("./base");
|
|
11
|
+
const amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
12
|
+
const getInAppMessagesSerializer = ({ ApplicationId = '', EndpointId = '' }, endpoint) => {
|
|
13
|
+
const headers = (0, base_1.getSharedHeaders)();
|
|
14
|
+
const url = new amplifyUrl_1.AmplifyUrl(endpoint.url);
|
|
15
|
+
url.pathname = `v1/apps/${(0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(ApplicationId)}/endpoints/${(0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(EndpointId)}/inappmessages`;
|
|
16
|
+
return { method: 'GET', headers, url };
|
|
17
|
+
};
|
|
18
|
+
const getInAppMessagesDeserializer = async (response) => {
|
|
19
|
+
if (response.statusCode >= 300) {
|
|
20
|
+
const error = await (0, serde_1.parseJsonError)(response);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const { InAppMessageCampaigns } = await (0, serde_1.parseJsonBody)(response);
|
|
25
|
+
return {
|
|
26
|
+
InAppMessagesResponse: { InAppMessageCampaigns },
|
|
27
|
+
$metadata: (0, serde_1.parseMetadata)(response),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
54
30
|
};
|
|
55
|
-
var getInAppMessagesDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var error, InAppMessageCampaigns;
|
|
57
|
-
return __generator(this, function (_a) {
|
|
58
|
-
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
61
|
-
return [4 /*yield*/, (0, serde_1.parseJsonError)(response)];
|
|
62
|
-
case 1:
|
|
63
|
-
error = _a.sent();
|
|
64
|
-
throw error;
|
|
65
|
-
case 2: return [4 /*yield*/, (0, serde_1.parseJsonBody)(response)];
|
|
66
|
-
case 3:
|
|
67
|
-
InAppMessageCampaigns = (_a.sent()).InAppMessageCampaigns;
|
|
68
|
-
return [2 /*return*/, {
|
|
69
|
-
InAppMessagesResponse: { InAppMessageCampaigns: InAppMessageCampaigns },
|
|
70
|
-
$metadata: (0, serde_1.parseMetadata)(response),
|
|
71
|
-
}];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}); };
|
|
75
31
|
/**
|
|
76
32
|
* @internal
|
|
77
33
|
*/
|