@aws-amplify/core 5.8.6-api-v6-models.b3abc9b.0 → 6.0.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/README.md +3 -0
- package/internals/adapter-core/package.json +8 -0
- package/internals/aws-clients/pinpoint/package.json +4 -4
- package/internals/providers/pinpoint/package.json +8 -0
- package/internals/utils/package.json +7 -0
- package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
- package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +11 -0
- package/lib/BackgroundProcessManager/BackgroundProcessManager.d.ts +182 -0
- package/lib/BackgroundProcessManager/BackgroundProcessManager.js +287 -0
- package/lib/BackgroundProcessManager/index.d.ts +1 -0
- package/lib/BackgroundProcessManager/index.js +7 -0
- package/lib/BackgroundProcessManager/types.d.ts +41 -0
- package/lib/BackgroundProcessManager/types.js +23 -0
- package/lib/Cache/StorageCache.d.ts +22 -0
- package/lib/Cache/StorageCache.js +56 -0
- package/lib/Cache/StorageCache.native.d.ts +19 -0
- package/lib/Cache/StorageCache.native.js +62 -0
- package/lib/Cache/StorageCacheCommon.d.ts +179 -0
- package/lib/Cache/StorageCacheCommon.js +468 -0
- package/lib/Cache/constants.d.ts +6 -0
- package/lib/Cache/constants.js +17 -0
- package/lib/Cache/index.d.ts +2 -0
- package/lib/Cache/index.js +7 -0
- package/lib/Cache/types/cache.d.ts +38 -0
- package/lib/Cache/types/index.d.ts +1 -0
- package/lib/Cache/types/index.js +19 -0
- package/lib/Cache/utils/CacheList.d.ts +89 -0
- package/lib/Cache/utils/CacheList.js +160 -0
- package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib/Cache/utils/cacheHelpers.js +49 -0
- package/lib/Cache/utils/errorHelpers.d.ts +7 -0
- package/lib/Cache/utils/errorHelpers.js +24 -0
- package/lib/Cache/utils/index.d.ts +2 -0
- package/lib/Cache/utils/index.js +12 -0
- package/lib/Hub/index.d.ts +46 -0
- package/lib/Hub/index.js +118 -0
- package/lib/Hub/types/AuthTypes.d.ts +36 -0
- package/lib/Hub/types/AuthTypes.js +4 -0
- package/lib/Hub/types/HubTypes.d.ts +28 -0
- package/lib/Hub/types/HubTypes.js +4 -0
- package/lib/Hub/types/index.d.ts +2 -0
- package/lib/Hub/types/index.js +20 -0
- package/lib/I18n/I18n.d.ts +14 -10
- package/lib/I18n/I18n.js +29 -40
- package/lib/I18n/errorHelpers.d.ts +5 -0
- package/lib/I18n/errorHelpers.js +16 -0
- package/lib/I18n/index.d.ts +6 -5
- package/lib/I18n/index.js +32 -30
- package/lib/I18n/types.d.ts +2 -2
- package/lib/I18n/types.js +5 -6
- package/lib/Logger/ConsoleLogger.d.ts +11 -11
- package/lib/Logger/ConsoleLogger.js +54 -130
- package/lib/Mutex/Mutex.d.ts +32 -0
- package/lib/Mutex/Mutex.js +70 -0
- package/lib/Mutex/index.d.ts +1 -0
- package/lib/Mutex/index.js +7 -0
- package/lib/Mutex/types.d.ts +13 -0
- package/lib/Mutex/types.js +4 -0
- package/lib/Platform/customUserAgent.d.ts +16 -0
- package/lib/Platform/customUserAgent.js +57 -0
- package/lib/Platform/detectFramework.js +12 -12
- package/lib/Platform/detection/Angular.js +4 -5
- package/lib/Platform/detection/Expo.js +1 -1
- package/lib/Platform/detection/Next.d.ts +1 -1
- package/lib/Platform/detection/Next.js +1 -1
- package/lib/Platform/detection/Nuxt.js +1 -1
- package/lib/Platform/detection/React.js +6 -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 +32 -52
- package/lib/Platform/types.d.ts +75 -8
- package/lib/Platform/types.js +40 -39
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Reachability/Reachability.d.ts +7 -0
- package/lib/Reachability/Reachability.js +42 -0
- package/lib/Reachability/Reachability.native.d.ts +6 -0
- package/lib/Reachability/Reachability.native.js +38 -0
- package/lib/Reachability/index.d.ts +1 -0
- package/lib/Reachability/index.js +7 -0
- package/lib/Reachability/types.d.ts +3 -0
- package/lib/Reachability/types.js +4 -0
- package/lib/ServiceWorker/ServiceWorker.d.ts +4 -4
- package/lib/ServiceWorker/ServiceWorker.js +93 -93
- package/lib/ServiceWorker/errorHelpers.d.ts +7 -0
- package/lib/ServiceWorker/errorHelpers.js +24 -0
- package/lib/ServiceWorker/index.d.ts +0 -12
- package/lib/ServiceWorker/index.js +0 -12
- package/lib/Signer/DateUtils.d.ts +27 -0
- package/lib/Signer/DateUtils.js +66 -0
- package/lib/Signer/Signer.d.ts +63 -0
- package/lib/Signer/Signer.js +135 -0
- package/lib/Signer/index.d.ts +1 -0
- package/lib/Signer/index.js +7 -0
- package/lib/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
- package/lib/adapterCore/error/AmplifyServerContextError.js +17 -0
- package/lib/adapterCore/error/index.d.ts +1 -0
- package/lib/adapterCore/error/index.js +7 -0
- package/lib/adapterCore/index.d.ts +2 -0
- package/lib/adapterCore/index.js +11 -0
- package/lib/adapterCore/serverContext/index.d.ts +2 -0
- package/lib/adapterCore/serverContext/index.js +9 -0
- package/lib/adapterCore/serverContext/serverContext.d.ts +20 -0
- package/lib/adapterCore/serverContext/serverContext.js +42 -0
- package/lib/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
- package/lib/adapterCore/serverContext/serverContextRegistry.js +24 -0
- package/lib/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
- package/lib/adapterCore/serverContext/types/amplifyServer.js +4 -0
- package/lib/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
- package/lib/adapterCore/serverContext/types/cookieStorage.js +4 -0
- package/lib/adapterCore/serverContext/types/index.d.ts +4 -0
- package/lib/adapterCore/serverContext/types/index.js +4 -0
- package/lib/awsClients/cognitoIdentity/base.d.ts +29 -0
- package/lib/awsClients/cognitoIdentity/base.js +67 -0
- package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.d.ts +22 -0
- package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.js +39 -0
- package/lib/awsClients/cognitoIdentity/getId.d.ts +22 -0
- package/lib/awsClients/cognitoIdentity/getId.js +30 -0
- package/lib/awsClients/cognitoIdentity/types.js +4 -0
- package/lib/awsClients/pinpoint/base.d.ts +17 -0
- package/lib/awsClients/pinpoint/base.js +37 -0
- package/lib/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib/awsClients/pinpoint/errorHelpers.js +16 -0
- package/lib/awsClients/pinpoint/getInAppMessages.d.ts +24 -0
- package/lib/awsClients/pinpoint/getInAppMessages.js +34 -0
- package/lib/awsClients/pinpoint/index.d.ts +4 -0
- package/lib/awsClients/pinpoint/putEvents.d.ts +24 -0
- package/lib/awsClients/pinpoint/putEvents.js +37 -0
- package/lib/awsClients/pinpoint/updateEndpoint.d.ts +24 -0
- package/lib/awsClients/pinpoint/updateEndpoint.js +38 -0
- package/lib/clients/endpoints/getDnsSuffix.js +7 -29
- package/lib/clients/handlers/authenticated.d.ts +1 -1
- package/lib/clients/handlers/authenticated.js +5 -5
- package/lib/clients/handlers/fetch.d.ts +0 -1
- package/lib/clients/handlers/fetch.js +42 -97
- package/lib/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib/clients/handlers/unauthenticated.js +4 -4
- package/lib/clients/internal/composeServiceApi.d.ts +8 -3
- package/lib/clients/internal/composeServiceApi.js +17 -67
- package/lib/clients/internal/composeTransferHandler.js +9 -11
- package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
- package/lib/clients/middleware/retry/defaultRetryDecider.js +18 -71
- package/lib/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib/clients/middleware/retry/jitteredBackoff.js +5 -5
- package/lib/clients/middleware/retry/middleware.d.ts +1 -1
- 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 -55
- 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/types/aws.d.ts +1 -1
- package/lib/clients/types/http.d.ts +25 -1
- package/lib/clients/utils/memoization.js +3 -3
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +6 -2
- package/lib/errors/AmplifyError.d.ts +14 -0
- package/lib/errors/AmplifyError.js +26 -0
- package/lib/errors/PlatformNotSupportedError.d.ts +4 -0
- package/lib/errors/PlatformNotSupportedError.js +16 -0
- package/lib/errors/createAssertionFunction.d.ts +3 -0
- package/lib/errors/createAssertionFunction.js +19 -0
- package/lib/errors/errorHelpers.d.ts +2 -0
- package/lib/errors/errorHelpers.js +19 -0
- package/lib/errors/index.d.ts +4 -0
- package/lib/errors/index.js +13 -0
- package/lib/index.d.ts +12 -28
- package/lib/index.js +28 -99
- package/lib/libraryUtils.d.ts +30 -0
- package/lib/libraryUtils.js +102 -0
- package/lib/parseAWSExports.d.ts +10 -2
- package/lib/parseAWSExports.js +195 -54
- package/lib/providers/kinesis/types/index.d.ts +1 -0
- package/lib/providers/kinesis/types/index.js +19 -0
- package/lib/providers/kinesis/types/kinesis.d.ts +9 -0
- package/lib/providers/kinesis/types/kinesis.js +4 -0
- package/lib/providers/kinesis-firehose/types/index.d.ts +1 -0
- package/lib/providers/kinesis-firehose/types/index.js +4 -0
- package/lib/providers/kinesis-firehose/types/kinesis-firehose.d.ts +9 -0
- package/lib/providers/kinesis-firehose/types/kinesis-firehose.js +4 -0
- package/lib/providers/personalize/types/index.d.ts +1 -0
- package/lib/providers/personalize/types/index.js +4 -0
- package/lib/providers/personalize/types/personalize.d.ts +8 -0
- package/lib/providers/personalize/types/personalize.js +4 -0
- package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -0
- package/lib/providers/pinpoint/apis/flushEvents.js +21 -0
- package/lib/providers/pinpoint/apis/index.d.ts +3 -0
- package/lib/providers/pinpoint/apis/index.js +11 -0
- package/lib/providers/pinpoint/apis/record.d.ts +5 -0
- package/lib/providers/pinpoint/apis/record.js +69 -0
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
- package/lib/providers/pinpoint/apis/updateEndpoint.js +75 -0
- package/lib/providers/pinpoint/index.d.ts +3 -0
- package/lib/providers/pinpoint/index.js +24 -0
- package/lib/providers/pinpoint/types/buffer.d.ts +25 -0
- package/lib/providers/pinpoint/types/buffer.js +4 -0
- package/lib/providers/pinpoint/types/errors.d.ts +9 -0
- package/lib/providers/pinpoint/types/errors.js +15 -0
- package/lib/providers/pinpoint/types/index.d.ts +2 -0
- package/lib/providers/pinpoint/types/index.js +22 -0
- package/lib/providers/pinpoint/types/pinpoint.d.ts +43 -0
- package/lib/providers/pinpoint/types/pinpoint.js +4 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +24 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +192 -0
- package/lib/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
- package/lib/providers/pinpoint/utils/cacheEndpointId.js +24 -0
- package/lib/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib/providers/pinpoint/utils/constants.js +10 -0
- package/lib/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
- package/lib/providers/pinpoint/utils/getCacheKey.js +13 -0
- package/lib/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
- package/lib/providers/pinpoint/utils/getEndpointId.js +18 -0
- package/lib/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
- package/lib/providers/pinpoint/utils/getEventBuffer.js +46 -0
- package/lib/providers/pinpoint/utils/index.d.ts +4 -0
- package/lib/providers/pinpoint/utils/index.js +13 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.js +7 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +9 -0
- package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
- package/lib/providers/pinpoint/utils/resolveEndpointId.js +34 -0
- package/lib/server.d.ts +1 -0
- package/lib/server.js +7 -0
- package/lib/singleton/API/types.d.ts +73 -0
- package/lib/singleton/Amplify.d.ts +40 -0
- package/lib/singleton/Amplify.js +65 -0
- package/lib/singleton/Analytics/types.d.ts +9 -0
- package/lib/singleton/Analytics/types.js +4 -0
- package/lib/singleton/Auth/index.d.ts +24 -0
- package/lib/singleton/Auth/index.js +67 -0
- package/lib/singleton/Auth/types.d.ts +155 -0
- package/lib/singleton/Auth/types.js +6 -0
- package/lib/singleton/Auth/utils/errorHelpers.d.ts +8 -0
- package/lib/singleton/Auth/utils/errorHelpers.js +32 -0
- package/lib/singleton/Auth/utils/index.d.ts +5 -0
- package/lib/singleton/Auth/utils/index.js +60 -0
- package/lib/singleton/Cache/types.d.ts +18 -0
- package/lib/singleton/Cache/types.js +4 -0
- package/lib/singleton/Geo/types.d.ts +17 -0
- package/lib/singleton/Geo/types.js +4 -0
- package/lib/singleton/Interactions/types.d.ts +21 -0
- package/lib/singleton/Interactions/types.js +4 -0
- package/lib/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
- package/lib/singleton/Notifications/InAppMessaging/types.js +4 -0
- package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
- package/lib/singleton/Notifications/PushNotification/types.js +4 -0
- package/lib/singleton/Notifications/types.d.ts +6 -0
- package/lib/singleton/Notifications/types.js +4 -0
- package/lib/singleton/Predictions/types.d.ts +49 -0
- package/lib/singleton/Predictions/types.js +4 -0
- package/lib/singleton/Storage/types.d.ts +25 -0
- package/lib/singleton/Storage/types.js +4 -0
- package/lib/singleton/apis/clearCredentials.d.ts +1 -0
- package/lib/singleton/apis/clearCredentials.js +10 -0
- package/lib/singleton/apis/fetchAuthSession.d.ts +2 -0
- package/lib/singleton/apis/fetchAuthSession.js +11 -0
- package/lib/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
- package/lib/singleton/apis/internal/fetchAuthSession.js +9 -0
- package/lib/singleton/apis/server/fetchAuthSession.d.ts +3 -0
- package/lib/singleton/apis/server/fetchAuthSession.js +11 -0
- package/lib/singleton/index.d.ts +3 -0
- package/lib/singleton/index.js +12 -0
- package/lib/singleton/types.d.ts +31 -0
- package/lib/singleton/types.js +4 -0
- package/lib/storage/CookieStorage.d.ts +14 -0
- package/lib/storage/CookieStorage.js +52 -0
- package/lib/storage/CookieStorage.native.d.ts +7 -0
- package/lib/storage/CookieStorage.native.js +15 -0
- package/lib/storage/DefaultStorage.d.ts +7 -0
- package/lib/storage/DefaultStorage.js +16 -0
- package/lib/storage/DefaultStorage.native.d.ts +33 -0
- package/lib/storage/DefaultStorage.native.js +50 -0
- package/lib/storage/InMemoryStorage.d.ts +12 -0
- package/lib/storage/InMemoryStorage.js +35 -0
- package/lib/storage/KeyValueStorage.d.ts +33 -0
- package/lib/storage/KeyValueStorage.js +56 -0
- package/lib/storage/SessionStorage.d.ts +7 -0
- package/lib/storage/SessionStorage.js +16 -0
- package/lib/storage/index.d.ts +7 -0
- package/lib/storage/index.js +14 -0
- package/lib/storage/utils.d.ts +10 -0
- package/lib/storage/utils.js +22 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core.d.ts +42 -0
- package/lib/types/core.js +4 -0
- package/lib/types/errors.d.ts +22 -0
- package/lib/types/errors.js +11 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/index.js +6 -3
- package/lib/types/logging.d.ts +13 -0
- package/lib/types/logging.js +4 -0
- package/lib/types/storage.d.ts +17 -0
- package/lib/types/storage.js +4 -0
- package/lib/utils/WordArray.d.ts +7 -0
- package/lib/utils/WordArray.js +49 -0
- package/lib/utils/amplifyUrl/index.d.ts +13 -0
- package/lib/utils/amplifyUrl/index.js +10 -0
- package/lib/utils/amplifyUrl/polyfill.d.ts +0 -0
- package/lib/utils/amplifyUrl/polyfill.js +4 -0
- package/lib/utils/amplifyUrl/polyfill.native.d.ts +1 -0
- package/lib/utils/amplifyUrl/polyfill.native.js +6 -0
- package/lib/utils/amplifyUuid/index.d.ts +3 -0
- package/lib/utils/amplifyUuid/index.js +9 -0
- package/lib/utils/amplifyUuid/polyfill.d.ts +0 -0
- package/lib/utils/amplifyUuid/polyfill.js +4 -0
- package/lib/utils/amplifyUuid/polyfill.native.d.ts +1 -0
- package/lib/utils/amplifyUuid/polyfill.native.js +6 -0
- package/lib/utils/convert/base64/base64Decoder.d.ts +2 -0
- package/lib/utils/convert/base64/base64Decoder.js +11 -0
- package/lib/utils/convert/base64/base64Encoder.d.ts +2 -0
- package/lib/utils/convert/base64/base64Encoder.js +17 -0
- package/lib/utils/convert/base64/bytesToString.d.ts +1 -0
- package/lib/utils/convert/base64/bytesToString.js +9 -0
- package/lib/utils/convert/index.d.ts +2 -0
- package/lib/utils/convert/index.js +9 -0
- package/lib/utils/convert/types.d.ts +9 -0
- package/lib/utils/convert/types.js +4 -0
- package/lib/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib/utils/cryptoSecureRandomInt.js +16 -0
- package/lib/utils/deepFreeze.d.ts +1 -0
- package/lib/utils/deepFreeze.js +16 -0
- package/lib/utils/generateRandomString.d.ts +1 -0
- package/lib/utils/generateRandomString.js +14 -0
- package/lib/utils/getClientInfo/getClientInfo.android.d.ts +5 -0
- package/lib/utils/getClientInfo/getClientInfo.android.js +21 -0
- package/lib/utils/getClientInfo/getClientInfo.d.ts +17 -0
- package/lib/utils/getClientInfo/getClientInfo.ios.d.ts +7 -0
- package/lib/utils/getClientInfo/getClientInfo.ios.js +63 -0
- package/lib/utils/getClientInfo/getClientInfo.js +68 -0
- package/lib/utils/getClientInfo/index.d.ts +1 -0
- package/lib/utils/getClientInfo/index.js +7 -0
- package/lib/utils/globalHelpers/index.d.ts +3 -0
- package/lib/utils/globalHelpers/index.js +50 -0
- package/lib/utils/globalHelpers/index.native.d.ts +3 -0
- package/lib/utils/globalHelpers/index.native.js +28 -0
- package/lib/utils/index.d.ts +8 -0
- package/lib/utils/index.js +25 -0
- package/lib/utils/isBrowser.d.ts +1 -0
- package/lib/utils/isBrowser.js +7 -0
- package/lib/utils/isWebWorker.d.ts +1 -0
- package/lib/utils/isWebWorker.js +14 -0
- package/lib/utils/retry/NonRetryableError.d.ts +4 -0
- package/lib/utils/retry/NonRetryableError.js +12 -0
- package/lib/utils/retry/constants.d.ts +1 -0
- package/lib/utils/retry/constants.js +6 -0
- package/lib/utils/retry/index.d.ts +5 -0
- package/lib/utils/retry/index.js +15 -0
- package/lib/utils/retry/isNonRetryableError.d.ts +2 -0
- package/lib/utils/retry/isNonRetryableError.js +10 -0
- package/lib/utils/retry/jitteredBackoff.d.ts +6 -0
- package/lib/utils/retry/jitteredBackoff.js +19 -0
- package/lib/utils/retry/jitteredExponentialRetry.d.ts +5 -0
- package/lib/utils/retry/jitteredExponentialRetry.js +14 -0
- package/lib/utils/retry/retry.d.ts +6 -0
- package/lib/utils/retry/retry.js +64 -0
- package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.js +53 -0
- package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.native.js +50 -0
- package/lib/utils/sessionListener/constants.d.ts +2 -0
- package/lib/utils/sessionListener/constants.js +8 -0
- package/lib/utils/sessionListener/index.d.ts +3 -0
- package/lib/utils/sessionListener/index.js +10 -0
- package/lib/utils/sessionListener/types.d.ts +6 -0
- package/lib/utils/sessionListener/types.js +4 -0
- package/lib/utils/urlSafeDecode.d.ts +1 -0
- package/lib/utils/urlSafeDecode.js +10 -0
- package/lib/utils/urlSafeEncode.d.ts +1 -0
- package/lib/utils/urlSafeEncode.js +12 -0
- package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
- package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +7 -0
- package/lib-esm/BackgroundProcessManager/BackgroundProcessManager.d.ts +182 -0
- package/lib-esm/BackgroundProcessManager/BackgroundProcessManager.js +283 -0
- package/lib-esm/BackgroundProcessManager/index.d.ts +1 -0
- package/lib-esm/BackgroundProcessManager/index.js +3 -0
- package/lib-esm/BackgroundProcessManager/types.d.ts +41 -0
- package/lib-esm/BackgroundProcessManager/types.js +20 -0
- package/lib-esm/Cache/StorageCache.d.ts +22 -0
- package/lib-esm/Cache/StorageCache.js +52 -0
- package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
- package/lib-esm/Cache/StorageCache.native.js +58 -0
- package/lib-esm/Cache/StorageCacheCommon.d.ts +179 -0
- package/lib-esm/Cache/StorageCacheCommon.js +464 -0
- package/lib-esm/Cache/constants.d.ts +6 -0
- package/lib-esm/Cache/constants.js +14 -0
- package/lib-esm/Cache/index.d.ts +2 -0
- package/lib-esm/Cache/index.js +4 -0
- package/lib-esm/Cache/types/cache.d.ts +38 -0
- package/lib-esm/Cache/types/index.d.ts +1 -0
- package/lib-esm/Cache/types/index.js +3 -0
- package/lib-esm/Cache/utils/CacheList.d.ts +89 -0
- package/lib-esm/Cache/utils/CacheList.js +156 -0
- package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib-esm/Cache/utils/cacheHelpers.js +42 -0
- package/lib-esm/Cache/utils/errorHelpers.d.ts +7 -0
- package/lib-esm/Cache/utils/errorHelpers.js +21 -0
- package/lib-esm/Cache/utils/index.d.ts +2 -0
- package/lib-esm/Cache/utils/index.js +4 -0
- package/lib-esm/Hub/index.d.ts +46 -0
- package/lib-esm/Hub/index.js +114 -0
- package/lib-esm/Hub/types/AuthTypes.d.ts +36 -0
- package/lib-esm/Hub/types/AuthTypes.js +3 -0
- package/lib-esm/Hub/types/HubTypes.d.ts +28 -0
- package/lib-esm/Hub/types/HubTypes.js +3 -0
- package/lib-esm/Hub/types/index.d.ts +2 -0
- package/lib-esm/Hub/types/index.js +4 -0
- package/lib-esm/I18n/I18n.d.ts +14 -10
- package/lib-esm/I18n/I18n.js +28 -40
- package/lib-esm/I18n/errorHelpers.d.ts +5 -0
- package/lib-esm/I18n/errorHelpers.js +13 -0
- package/lib-esm/I18n/index.d.ts +6 -5
- package/lib-esm/I18n/index.js +30 -29
- package/lib-esm/I18n/types.d.ts +2 -2
- package/lib-esm/I18n/types.js +3 -5
- package/lib-esm/Logger/ConsoleLogger.d.ts +11 -11
- package/lib-esm/Logger/ConsoleLogger.js +53 -129
- package/lib-esm/Mutex/Mutex.d.ts +32 -0
- package/lib-esm/Mutex/Mutex.js +66 -0
- package/lib-esm/Mutex/index.d.ts +1 -0
- package/lib-esm/Mutex/index.js +3 -0
- package/lib-esm/Mutex/types.d.ts +13 -0
- package/lib-esm/Mutex/types.js +3 -0
- package/lib-esm/Platform/customUserAgent.d.ts +16 -0
- package/lib-esm/Platform/customUserAgent.js +52 -0
- package/lib-esm/Platform/detectFramework.js +11 -11
- package/lib-esm/Platform/detection/Angular.js +3 -4
- package/lib-esm/Platform/detection/Next.d.ts +1 -1
- package/lib-esm/Platform/detection/React.js +5 -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 +30 -50
- package/lib-esm/Platform/types.d.ts +75 -8
- package/lib-esm/Platform/types.js +40 -39
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Reachability/Reachability.d.ts +7 -0
- package/lib-esm/Reachability/Reachability.js +39 -0
- package/lib-esm/Reachability/Reachability.native.d.ts +6 -0
- package/lib-esm/Reachability/Reachability.native.js +34 -0
- package/lib-esm/Reachability/index.d.ts +1 -0
- package/lib-esm/Reachability/index.js +3 -0
- package/lib-esm/Reachability/types.d.ts +3 -0
- package/lib-esm/Reachability/types.js +3 -0
- package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -4
- package/lib-esm/ServiceWorker/ServiceWorker.js +90 -91
- package/lib-esm/ServiceWorker/errorHelpers.d.ts +7 -0
- package/lib-esm/ServiceWorker/errorHelpers.js +21 -0
- package/lib-esm/ServiceWorker/index.d.ts +0 -12
- package/lib-esm/ServiceWorker/index.js +0 -12
- package/lib-esm/Signer/DateUtils.d.ts +27 -0
- package/lib-esm/Signer/DateUtils.js +63 -0
- package/lib-esm/Signer/Signer.d.ts +63 -0
- package/lib-esm/Signer/Signer.js +131 -0
- package/lib-esm/Signer/index.d.ts +1 -0
- package/lib-esm/Signer/index.js +3 -0
- package/lib-esm/adapterCore/error/AmplifyServerContextError.d.ts +8 -0
- package/lib-esm/adapterCore/error/AmplifyServerContextError.js +13 -0
- package/lib-esm/adapterCore/error/index.d.ts +1 -0
- package/lib-esm/adapterCore/error/index.js +3 -0
- package/lib-esm/adapterCore/index.d.ts +2 -0
- package/lib-esm/adapterCore/index.js +4 -0
- package/lib-esm/adapterCore/serverContext/index.d.ts +2 -0
- package/lib-esm/adapterCore/serverContext/index.js +3 -0
- package/lib-esm/adapterCore/serverContext/serverContext.d.ts +20 -0
- package/lib-esm/adapterCore/serverContext/serverContext.js +36 -0
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.d.ts +6 -0
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +21 -0
- package/lib-esm/adapterCore/serverContext/types/amplifyServer.d.ts +16 -0
- package/lib-esm/adapterCore/serverContext/types/amplifyServer.js +3 -0
- package/lib-esm/adapterCore/serverContext/types/cookieStorage.d.ts +31 -0
- package/lib-esm/adapterCore/serverContext/types/cookieStorage.js +3 -0
- package/lib-esm/adapterCore/serverContext/types/index.d.ts +4 -0
- package/lib-esm/adapterCore/serverContext/types/index.js +3 -0
- package/lib-esm/awsClients/cognitoIdentity/base.d.ts +29 -0
- package/lib-esm/awsClients/cognitoIdentity/base.js +62 -0
- package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.d.ts +22 -0
- package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.js +36 -0
- package/lib-esm/awsClients/cognitoIdentity/getId.d.ts +22 -0
- package/lib-esm/awsClients/cognitoIdentity/getId.js +27 -0
- package/lib-esm/awsClients/cognitoIdentity/types.js +3 -0
- package/lib-esm/awsClients/pinpoint/base.d.ts +17 -0
- package/lib-esm/awsClients/pinpoint/base.js +33 -0
- package/lib-esm/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib-esm/awsClients/pinpoint/errorHelpers.js +13 -0
- package/lib-esm/awsClients/pinpoint/getInAppMessages.d.ts +24 -0
- package/lib-esm/awsClients/pinpoint/getInAppMessages.js +31 -0
- package/lib-esm/awsClients/pinpoint/index.d.ts +4 -0
- package/lib-esm/awsClients/pinpoint/putEvents.d.ts +24 -0
- package/lib-esm/awsClients/pinpoint/putEvents.js +34 -0
- package/lib-esm/awsClients/pinpoint/updateEndpoint.d.ts +24 -0
- package/lib-esm/awsClients/pinpoint/updateEndpoint.js +35 -0
- package/lib-esm/clients/endpoints/getDnsSuffix.js +6 -28
- package/lib-esm/clients/endpoints/partitions.js +2 -2
- package/lib-esm/clients/handlers/authenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/authenticated.js +1 -1
- package/lib-esm/clients/handlers/fetch.d.ts +0 -1
- package/lib-esm/clients/handlers/fetch.js +41 -96
- package/lib-esm/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/unauthenticated.js +1 -1
- package/lib-esm/clients/internal/composeServiceApi.d.ts +8 -3
- 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.d.ts +1 -1
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -70
- package/lib-esm/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +5 -5
- package/lib-esm/clients/middleware/retry/middleware.d.ts +1 -1
- 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 +18 -52
- package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js +10 -21
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +6 -6
- 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/types/aws.d.ts +1 -1
- package/lib-esm/clients/types/http.d.ts +25 -1
- package/lib-esm/clients/utils/memoization.js +3 -3
- package/lib-esm/constants.d.ts +2 -0
- package/lib-esm/constants.js +7 -3
- package/lib-esm/errors/AmplifyError.d.ts +14 -0
- package/lib-esm/errors/AmplifyError.js +22 -0
- package/lib-esm/errors/PlatformNotSupportedError.d.ts +4 -0
- package/lib-esm/errors/PlatformNotSupportedError.js +12 -0
- package/lib-esm/errors/createAssertionFunction.d.ts +3 -0
- package/lib-esm/errors/createAssertionFunction.js +15 -0
- package/lib-esm/errors/errorHelpers.d.ts +2 -0
- package/lib-esm/errors/errorHelpers.js +16 -0
- package/lib-esm/errors/index.d.ts +4 -0
- package/lib-esm/errors/index.js +6 -0
- package/lib-esm/index.d.ts +12 -28
- package/lib-esm/index.js +15 -27
- package/lib-esm/libraryUtils.d.ts +30 -0
- package/lib-esm/libraryUtils.js +39 -0
- package/lib-esm/parseAWSExports.d.ts +10 -2
- package/lib-esm/parseAWSExports.js +194 -53
- package/lib-esm/providers/kinesis/types/index.d.ts +1 -0
- package/lib-esm/providers/kinesis/types/index.js +3 -0
- package/lib-esm/providers/kinesis/types/kinesis.d.ts +9 -0
- package/lib-esm/providers/kinesis/types/kinesis.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/index.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/types/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +9 -0
- package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.js +3 -0
- package/lib-esm/providers/personalize/types/index.d.ts +1 -0
- package/lib-esm/providers/personalize/types/index.js +3 -0
- package/lib-esm/providers/personalize/types/personalize.d.ts +8 -0
- package/lib-esm/providers/personalize/types/personalize.js +3 -0
- package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -0
- package/lib-esm/providers/pinpoint/apis/flushEvents.js +17 -0
- package/lib-esm/providers/pinpoint/apis/index.d.ts +3 -0
- package/lib-esm/providers/pinpoint/apis/index.js +5 -0
- package/lib-esm/providers/pinpoint/apis/record.d.ts +5 -0
- package/lib-esm/providers/pinpoint/apis/record.js +65 -0
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +5 -0
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +71 -0
- package/lib-esm/providers/pinpoint/index.d.ts +3 -0
- package/lib-esm/providers/pinpoint/index.js +5 -0
- package/lib-esm/providers/pinpoint/types/buffer.d.ts +25 -0
- package/lib-esm/providers/pinpoint/types/buffer.js +3 -0
- package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
- package/lib-esm/providers/pinpoint/types/errors.js +12 -0
- package/lib-esm/providers/pinpoint/types/index.d.ts +2 -0
- package/lib-esm/providers/pinpoint/types/index.js +4 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +43 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.js +3 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +24 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +188 -0
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +20 -0
- package/lib-esm/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib-esm/providers/pinpoint/utils/constants.js +7 -0
- package/lib-esm/providers/pinpoint/utils/getCacheKey.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/getCacheKey.js +9 -0
- package/lib-esm/providers/pinpoint/utils/getEndpointId.d.ts +7 -0
- package/lib-esm/providers/pinpoint/utils/getEndpointId.js +14 -0
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.d.ts +8 -0
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +42 -0
- package/lib-esm/providers/pinpoint/utils/index.d.ts +4 -0
- package/lib-esm/providers/pinpoint/utils/index.js +6 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +5 -0
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +30 -0
- package/lib-esm/server.d.ts +1 -0
- package/lib-esm/server.js +3 -0
- package/lib-esm/singleton/API/types.d.ts +73 -0
- package/lib-esm/singleton/Amplify.d.ts +40 -0
- package/lib-esm/singleton/Amplify.js +61 -0
- package/lib-esm/singleton/Analytics/types.d.ts +9 -0
- package/lib-esm/singleton/Analytics/types.js +3 -0
- package/lib-esm/singleton/Auth/index.d.ts +24 -0
- package/lib-esm/singleton/Auth/index.js +62 -0
- package/lib-esm/singleton/Auth/types.d.ts +155 -0
- package/lib-esm/singleton/Auth/types.js +5 -0
- package/lib-esm/singleton/Auth/utils/errorHelpers.d.ts +8 -0
- package/lib-esm/singleton/Auth/utils/errorHelpers.js +29 -0
- package/lib-esm/singleton/Auth/utils/index.d.ts +5 -0
- package/lib-esm/singleton/Auth/utils/index.js +53 -0
- package/lib-esm/singleton/Cache/types.d.ts +18 -0
- package/lib-esm/singleton/Cache/types.js +3 -0
- package/lib-esm/singleton/Geo/types.d.ts +17 -0
- package/lib-esm/singleton/Geo/types.js +3 -0
- package/lib-esm/singleton/Interactions/types.d.ts +21 -0
- package/lib-esm/singleton/Interactions/types.js +3 -0
- package/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
- package/lib-esm/singleton/Notifications/InAppMessaging/types.js +3 -0
- package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
- package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
- package/lib-esm/singleton/Notifications/types.d.ts +6 -0
- package/lib-esm/singleton/Notifications/types.js +3 -0
- package/lib-esm/singleton/Predictions/types.d.ts +49 -0
- package/lib-esm/singleton/Predictions/types.js +3 -0
- package/lib-esm/singleton/Storage/types.d.ts +25 -0
- package/lib-esm/singleton/Storage/types.js +3 -0
- package/lib-esm/singleton/apis/clearCredentials.d.ts +1 -0
- package/lib-esm/singleton/apis/clearCredentials.js +6 -0
- package/lib-esm/singleton/apis/fetchAuthSession.d.ts +2 -0
- package/lib-esm/singleton/apis/fetchAuthSession.js +7 -0
- package/lib-esm/singleton/apis/internal/fetchAuthSession.d.ts +3 -0
- package/lib-esm/singleton/apis/internal/fetchAuthSession.js +5 -0
- package/lib-esm/singleton/apis/server/fetchAuthSession.d.ts +3 -0
- package/lib-esm/singleton/apis/server/fetchAuthSession.js +7 -0
- package/lib-esm/singleton/index.d.ts +3 -0
- package/lib-esm/singleton/index.js +5 -0
- package/lib-esm/singleton/types.d.ts +31 -0
- package/lib-esm/singleton/types.js +3 -0
- package/lib-esm/storage/CookieStorage.d.ts +14 -0
- package/lib-esm/storage/CookieStorage.js +45 -0
- package/lib-esm/storage/CookieStorage.native.d.ts +7 -0
- package/lib-esm/storage/CookieStorage.native.js +11 -0
- package/lib-esm/storage/DefaultStorage.d.ts +7 -0
- package/lib-esm/storage/DefaultStorage.js +12 -0
- package/lib-esm/storage/DefaultStorage.native.d.ts +33 -0
- package/lib-esm/storage/DefaultStorage.native.js +46 -0
- package/lib-esm/storage/InMemoryStorage.d.ts +12 -0
- package/lib-esm/storage/InMemoryStorage.js +31 -0
- package/lib-esm/storage/KeyValueStorage.d.ts +33 -0
- package/lib-esm/storage/KeyValueStorage.js +52 -0
- package/lib-esm/storage/SessionStorage.d.ts +7 -0
- package/lib-esm/storage/SessionStorage.js +12 -0
- package/lib-esm/storage/index.d.ts +7 -0
- package/lib-esm/storage/index.js +10 -0
- package/lib-esm/storage/utils.d.ts +10 -0
- package/lib-esm/storage/utils.js +17 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/core.d.ts +42 -0
- package/lib-esm/types/core.js +3 -0
- package/lib-esm/types/errors.d.ts +22 -0
- package/lib-esm/types/errors.js +8 -0
- package/lib-esm/types/index.d.ts +4 -1
- package/lib-esm/types/index.js +4 -1
- package/lib-esm/types/logging.d.ts +13 -0
- package/lib-esm/types/logging.js +3 -0
- package/lib-esm/types/storage.d.ts +17 -0
- package/lib-esm/types/storage.js +3 -0
- package/lib-esm/utils/WordArray.d.ts +7 -0
- package/lib-esm/utils/WordArray.js +46 -0
- package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
- package/lib-esm/utils/amplifyUrl/index.js +6 -0
- package/lib-esm/utils/amplifyUrl/polyfill.d.ts +0 -0
- package/lib-esm/utils/amplifyUrl/polyfill.js +4 -0
- package/lib-esm/utils/amplifyUrl/polyfill.native.d.ts +1 -0
- package/lib-esm/utils/amplifyUrl/polyfill.native.js +4 -0
- package/lib-esm/utils/amplifyUuid/index.d.ts +3 -0
- package/lib-esm/utils/amplifyUuid/index.js +6 -0
- package/lib-esm/utils/amplifyUuid/polyfill.d.ts +0 -0
- package/lib-esm/utils/amplifyUuid/polyfill.js +4 -0
- package/lib-esm/utils/amplifyUuid/polyfill.native.d.ts +1 -0
- package/lib-esm/utils/amplifyUuid/polyfill.native.js +4 -0
- package/lib-esm/utils/convert/base64/base64Decoder.d.ts +2 -0
- package/lib-esm/utils/convert/base64/base64Decoder.js +8 -0
- package/lib-esm/utils/convert/base64/base64Encoder.d.ts +2 -0
- package/lib-esm/utils/convert/base64/base64Encoder.js +14 -0
- package/lib-esm/utils/convert/base64/bytesToString.d.ts +1 -0
- package/lib-esm/utils/convert/base64/bytesToString.js +5 -0
- package/lib-esm/utils/convert/index.d.ts +2 -0
- package/lib-esm/utils/convert/index.js +4 -0
- package/lib-esm/utils/convert/types.d.ts +9 -0
- package/lib-esm/utils/convert/types.js +3 -0
- package/lib-esm/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib-esm/utils/cryptoSecureRandomInt.js +12 -0
- package/lib-esm/utils/deepFreeze.d.ts +1 -0
- package/lib-esm/utils/deepFreeze.js +12 -0
- package/lib-esm/utils/generateRandomString.d.ts +1 -0
- package/lib-esm/utils/generateRandomString.js +10 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.android.d.ts +5 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.android.js +17 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.d.ts +17 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.ios.d.ts +7 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.ios.js +59 -0
- package/lib-esm/utils/getClientInfo/getClientInfo.js +64 -0
- package/lib-esm/utils/getClientInfo/index.d.ts +1 -0
- package/lib-esm/utils/getClientInfo/index.js +3 -0
- package/lib-esm/utils/globalHelpers/index.d.ts +3 -0
- package/lib-esm/utils/globalHelpers/index.js +44 -0
- package/lib-esm/utils/globalHelpers/index.native.d.ts +3 -0
- package/lib-esm/utils/globalHelpers/index.native.js +22 -0
- package/lib-esm/utils/index.d.ts +8 -0
- package/lib-esm/utils/index.js +10 -0
- package/lib-esm/utils/isBrowser.d.ts +1 -0
- package/lib-esm/utils/isBrowser.js +3 -0
- package/lib-esm/utils/isWebWorker.d.ts +1 -0
- package/lib-esm/utils/isWebWorker.js +10 -0
- package/lib-esm/utils/retry/NonRetryableError.d.ts +4 -0
- package/lib-esm/utils/retry/NonRetryableError.js +8 -0
- package/lib-esm/utils/retry/constants.d.ts +1 -0
- package/lib-esm/utils/retry/constants.js +3 -0
- package/lib-esm/utils/retry/index.d.ts +5 -0
- package/lib-esm/utils/retry/index.js +7 -0
- package/lib-esm/utils/retry/isNonRetryableError.d.ts +2 -0
- package/lib-esm/utils/retry/isNonRetryableError.js +6 -0
- package/lib-esm/utils/retry/jitteredBackoff.d.ts +6 -0
- package/lib-esm/utils/retry/jitteredBackoff.js +15 -0
- package/lib-esm/utils/retry/jitteredExponentialRetry.d.ts +5 -0
- package/lib-esm/utils/retry/jitteredExponentialRetry.js +10 -0
- package/lib-esm/utils/retry/retry.d.ts +6 -0
- package/lib-esm/utils/retry/retry.js +60 -0
- package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.js +49 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.js +46 -0
- 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 +3 -0
- package/lib-esm/utils/sessionListener/index.js +5 -0
- package/lib-esm/utils/sessionListener/types.d.ts +6 -0
- package/lib-esm/utils/sessionListener/types.js +3 -0
- package/lib-esm/utils/urlSafeDecode.d.ts +1 -0
- package/lib-esm/utils/urlSafeDecode.js +6 -0
- package/lib-esm/utils/urlSafeEncode.d.ts +1 -0
- package/lib-esm/utils/urlSafeEncode.js +8 -0
- package/package.json +39 -70
- package/server/package.json +8 -0
- package/src/BackgroundProcessManager/BackgroundManagerNotOpenError.ts +8 -0
- package/src/BackgroundProcessManager/BackgroundProcessManager.ts +421 -0
- package/src/BackgroundProcessManager/index.ts +4 -0
- package/src/BackgroundProcessManager/types.ts +49 -0
- package/src/Cache/StorageCache.native.ts +65 -0
- package/src/Cache/StorageCache.ts +61 -0
- package/src/Cache/StorageCacheCommon.ts +577 -0
- package/src/Cache/constants.ts +18 -0
- package/src/Cache/index.ts +6 -0
- package/src/Cache/types/cache.ts +51 -0
- package/src/Cache/types/index.ts +4 -0
- package/src/Cache/utils/CacheList.ts +185 -0
- package/src/Cache/utils/cacheHelpers.ts +52 -0
- package/src/Cache/utils/errorHelpers.ts +26 -0
- package/src/Cache/utils/index.ts +10 -0
- package/src/Hub/index.ts +213 -0
- package/src/Hub/types/AuthTypes.ts +23 -0
- package/src/Hub/types/HubTypes.ts +46 -0
- package/src/Hub/types/index.ts +5 -0
- package/src/I18n/I18n.ts +19 -12
- package/src/I18n/errorHelpers.ts +18 -0
- package/src/I18n/index.ts +20 -11
- package/src/I18n/types.ts +1 -1
- package/src/Logger/ConsoleLogger.ts +12 -13
- package/src/Mutex/Mutex.ts +78 -0
- package/src/Mutex/index.ts +4 -0
- package/src/Mutex/types.ts +20 -0
- package/src/Platform/customUserAgent.ts +75 -0
- package/src/Platform/detectFramework.ts +1 -1
- package/src/Platform/detection/React.ts +5 -3
- package/src/Platform/index.ts +14 -1
- package/src/Platform/types.ts +84 -39
- package/src/Platform/version.ts +1 -1
- package/src/Reachability/Reachability.native.ts +46 -0
- package/src/Reachability/Reachability.ts +55 -0
- package/src/Reachability/index.ts +4 -0
- package/src/Reachability/types.ts +6 -0
- package/src/ServiceWorker/ServiceWorker.ts +67 -36
- package/src/ServiceWorker/errorHelpers.ts +26 -0
- package/src/ServiceWorker/index.ts +0 -12
- package/src/Signer/DateUtils.ts +103 -0
- package/src/Signer/Signer.ts +203 -0
- package/src/Signer/index.ts +4 -0
- package/src/adapterCore/error/AmplifyServerContextError.ts +23 -0
- package/src/adapterCore/error/index.ts +4 -0
- package/src/adapterCore/index.ts +11 -0
- package/src/adapterCore/serverContext/index.ts +10 -0
- package/src/adapterCore/serverContext/serverContext.ts +54 -0
- package/src/adapterCore/serverContext/serverContextRegistry.ts +31 -0
- package/src/adapterCore/serverContext/types/amplifyServer.ts +29 -0
- package/src/adapterCore/serverContext/types/cookieStorage.ts +43 -0
- package/src/adapterCore/serverContext/types/index.ts +9 -0
- package/src/awsClients/cognitoIdentity/base.ts +97 -0
- package/src/awsClients/cognitoIdentity/getCredentialsForIdentity.ts +74 -0
- package/src/awsClients/pinpoint/base.ts +42 -0
- package/src/awsClients/pinpoint/errorHelpers.ts +19 -0
- package/src/awsClients/pinpoint/getInAppMessages.ts +57 -0
- package/src/awsClients/pinpoint/index.ts +15 -0
- package/src/awsClients/pinpoint/putEvents.ts +58 -0
- package/src/awsClients/pinpoint/updateEndpoint.ts +61 -0
- package/src/clients/handlers/authenticated.ts +2 -1
- package/src/clients/handlers/fetch.ts +9 -4
- package/src/clients/handlers/unauthenticated.ts +2 -1
- package/src/clients/internal/composeServiceApi.ts +22 -6
- package/src/clients/middleware/retry/defaultRetryDecider.ts +12 -6
- package/src/clients/middleware/retry/isClockSkewError.ts +1 -1
- package/src/clients/middleware/retry/jitteredBackoff.ts +1 -1
- package/src/clients/middleware/retry/middleware.ts +9 -9
- package/src/clients/middleware/signing/middleware.ts +1 -1
- package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -1
- package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
- package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +2 -2
- package/src/clients/serde/responseInfo.ts +2 -1
- package/src/clients/types/aws.ts +4 -1
- package/src/clients/types/http.ts +27 -1
- package/src/constants.ts +7 -0
- package/src/errors/AmplifyError.ts +34 -0
- package/src/errors/PlatformNotSupportedError.ts +14 -0
- package/src/errors/createAssertionFunction.ts +23 -0
- package/src/errors/errorHelpers.ts +20 -0
- package/src/errors/index.ts +7 -0
- package/src/global.d.ts +11 -0
- package/src/index.ts +62 -82
- package/src/libraryUtils.ts +113 -0
- package/src/parseAWSExports.ts +272 -56
- package/src/providers/kinesis/types/index.ts +4 -0
- package/src/providers/kinesis/types/kinesis.ts +12 -0
- package/src/providers/kinesis-firehose/types/index.ts +4 -0
- package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +12 -0
- package/src/providers/personalize/types/index.ts +4 -0
- package/src/providers/personalize/types/personalize.ts +11 -0
- package/src/providers/pinpoint/apis/flushEvents.ts +31 -0
- package/src/providers/pinpoint/apis/index.ts +6 -0
- package/src/providers/pinpoint/apis/record.ts +93 -0
- package/src/providers/pinpoint/apis/updateEndpoint.ts +98 -0
- package/src/providers/pinpoint/index.ts +10 -0
- package/src/providers/pinpoint/types/buffer.ts +32 -0
- package/src/providers/pinpoint/types/errors.ts +12 -0
- package/src/providers/pinpoint/types/index.ts +5 -0
- package/src/providers/pinpoint/types/pinpoint.ts +60 -0
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +256 -0
- package/src/providers/pinpoint/utils/cacheEndpointId.ts +27 -0
- package/src/providers/pinpoint/utils/constants.ts +8 -0
- package/src/providers/pinpoint/utils/getCacheKey.ts +16 -0
- package/src/providers/pinpoint/utils/getEndpointId.ts +20 -0
- package/src/providers/pinpoint/utils/getEventBuffer.ts +60 -0
- package/src/providers/pinpoint/utils/index.ts +7 -0
- package/src/providers/pinpoint/utils/isAppInForeground.native.ts +7 -0
- package/src/providers/pinpoint/utils/isAppInForeground.ts +4 -0
- package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
- package/src/server.ts +4 -0
- package/src/singleton/API/types.ts +90 -0
- package/src/singleton/Amplify.ts +89 -0
- package/src/singleton/Analytics/types.ts +17 -0
- package/src/singleton/Auth/index.ts +103 -0
- package/src/singleton/Auth/types.ts +225 -0
- package/src/singleton/Auth/utils/errorHelpers.ts +37 -0
- package/src/singleton/Auth/utils/index.ts +106 -0
- package/src/singleton/Cache/types.ts +27 -0
- package/src/singleton/Geo/types.ts +20 -0
- package/src/singleton/Interactions/types.ts +29 -0
- package/src/singleton/Notifications/InAppMessaging/types.ts +6 -0
- package/src/singleton/Notifications/PushNotification/types.ts +6 -0
- package/src/singleton/Notifications/types.ts +10 -0
- package/src/singleton/Predictions/types.ts +61 -0
- package/src/singleton/Storage/types.ts +30 -0
- package/src/singleton/apis/clearCredentials.ts +8 -0
- package/src/singleton/apis/fetchAuthSession.ts +12 -0
- package/src/singleton/apis/internal/fetchAuthSession.ts +12 -0
- package/src/singleton/apis/server/fetchAuthSession.ts +16 -0
- package/src/singleton/index.ts +6 -0
- package/src/singleton/types.ts +64 -0
- package/src/storage/CookieStorage.native.ts +13 -0
- package/src/storage/CookieStorage.ts +68 -0
- package/src/storage/DefaultStorage.native.ts +58 -0
- package/src/storage/DefaultStorage.ts +14 -0
- package/src/storage/InMemoryStorage.ts +36 -0
- package/src/storage/KeyValueStorage.ts +57 -0
- package/src/storage/SessionStorage.ts +14 -0
- package/src/storage/index.ts +13 -0
- package/src/storage/utils.ts +22 -0
- package/src/types/core.ts +51 -0
- package/src/types/errors.ts +33 -0
- package/src/types/index.ts +5 -1
- package/src/types/logging.ts +24 -0
- package/src/types/storage.ts +23 -0
- package/src/utils/WordArray.ts +57 -0
- package/src/utils/amplifyUrl/index.ts +9 -0
- package/src/utils/amplifyUrl/polyfill.native.ts +6 -0
- package/src/utils/amplifyUrl/polyfill.ts +4 -0
- package/src/utils/amplifyUuid/index.ts +9 -0
- package/src/utils/amplifyUuid/polyfill.native.ts +6 -0
- package/src/utils/amplifyUuid/polyfill.ts +4 -0
- package/src/utils/convert/base64/base64Decoder.ts +11 -0
- package/src/utils/convert/base64/base64Encoder.ts +18 -0
- package/src/utils/convert/base64/bytesToString.ts +6 -0
- package/src/utils/convert/index.ts +5 -0
- package/src/utils/convert/types.ts +17 -0
- package/src/utils/cryptoSecureRandomInt.ts +14 -0
- package/src/utils/deepFreeze.ts +16 -0
- package/src/utils/generateRandomString.ts +16 -0
- package/src/utils/getClientInfo/getClientInfo.android.ts +21 -0
- package/src/utils/getClientInfo/getClientInfo.ios.ts +64 -0
- package/src/utils/getClientInfo/getClientInfo.ts +81 -0
- package/src/utils/getClientInfo/index.ts +4 -0
- package/src/utils/globalHelpers/index.native.ts +30 -0
- package/src/utils/globalHelpers/index.ts +54 -0
- package/src/utils/index.ts +17 -0
- package/src/utils/isBrowser.ts +5 -0
- package/src/utils/isWebWorker.ts +13 -0
- package/src/utils/retry/NonRetryableError.ts +9 -0
- package/src/utils/retry/constants.ts +4 -0
- package/src/utils/retry/index.ts +8 -0
- package/src/utils/retry/isNonRetryableError.ts +9 -0
- package/src/utils/retry/jitteredBackoff.ts +21 -0
- package/src/utils/retry/jitteredExponentialRetry.ts +18 -0
- package/src/utils/retry/retry.ts +82 -0
- package/src/utils/sessionListener/SessionListener.native.ts +70 -0
- package/src/utils/sessionListener/SessionListener.ts +74 -0
- package/src/utils/sessionListener/constants.ts +6 -0
- package/src/utils/sessionListener/index.ts +7 -0
- package/src/utils/sessionListener/types.ts +11 -0
- package/src/utils/urlSafeDecode.ts +7 -0
- package/src/utils/urlSafeEncode.ts +9 -0
- package/lib/Amplify.d.ts +0 -28
- package/lib/Amplify.js +0 -109
- package/lib/AwsClients/CognitoIdentity/base.d.ts +0 -28
- package/lib/AwsClients/CognitoIdentity/base.js +0 -113
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +0 -23
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +0 -83
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +0 -23
- package/lib/AwsClients/CognitoIdentity/getId.js +0 -73
- package/lib/AwsClients/Pinpoint/base.d.ts +0 -17
- package/lib/AwsClients/Pinpoint/base.js +0 -39
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +0 -23
- package/lib/AwsClients/Pinpoint/getInAppMessages.js +0 -77
- package/lib/AwsClients/Pinpoint/index.d.ts +0 -4
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +0 -23
- package/lib/AwsClients/Pinpoint/putEvents.js +0 -78
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +0 -23
- package/lib/AwsClients/Pinpoint/updateEndpoint.js +0 -81
- package/lib/ClientDevice/android.d.ts +0 -5
- package/lib/ClientDevice/android.js +0 -20
- package/lib/ClientDevice/browser.d.ts +0 -25
- package/lib/ClientDevice/browser.js +0 -80
- package/lib/ClientDevice/index.d.ts +0 -23
- package/lib/ClientDevice/index.js +0 -18
- package/lib/ClientDevice/ios.d.ts +0 -7
- package/lib/ClientDevice/ios.js +0 -62
- package/lib/ClientDevice/reactnative.d.ts +0 -7
- package/lib/ClientDevice/reactnative.js +0 -23
- package/lib/Credentials.d.ts +0 -47
- package/lib/Credentials.js +0 -678
- package/lib/Errors.d.ts +0 -2
- package/lib/Errors.js +0 -13
- package/lib/Hub.d.ts +0 -55
- package/lib/Hub.js +0 -219
- package/lib/JS.d.ts +0 -32
- package/lib/JS.js +0 -221
- package/lib/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib/OAuthHelper/FacebookOAuth.js +0 -124
- package/lib/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib/OAuthHelper/GoogleOAuth.js +0 -133
- package/lib/OAuthHelper/index.d.ts +0 -4
- package/lib/OAuthHelper/index.js +0 -9
- package/lib/Providers/AWSCloudWatchProvider.d.ts +0 -34
- package/lib/Providers/AWSCloudWatchProvider.js +0 -596
- package/lib/Providers/index.d.ts +0 -1
- package/lib/Providers/index.js +0 -7
- package/lib/RNComponents/index.d.ts +0 -5
- package/lib/RNComponents/index.js +0 -15
- package/lib/RNComponents/reactnative.d.ts +0 -3
- package/lib/RNComponents/reactnative.js +0 -13
- package/lib/Signer.d.ts +0 -41
- package/lib/Signer.js +0 -130
- package/lib/StorageHelper/index.d.ts +0 -41
- package/lib/StorageHelper/index.js +0 -75
- package/lib/StorageHelper/reactnative.d.ts +0 -13
- package/lib/StorageHelper/reactnative.js +0 -106
- package/lib/UniversalStorage/index.d.ts +0 -23
- package/lib/UniversalStorage/index.js +0 -112
- package/lib/Util/BackgroundProcessManager.d.ts +0 -204
- package/lib/Util/BackgroundProcessManager.js +0 -448
- package/lib/Util/Constants.d.ts +0 -8
- package/lib/Util/Constants.js +0 -23
- package/lib/Util/DateUtils.d.ts +0 -7
- package/lib/Util/DateUtils.js +0 -75
- package/lib/Util/Mutex.d.ts +0 -45
- package/lib/Util/Mutex.js +0 -73
- package/lib/Util/Reachability.d.ts +0 -13
- package/lib/Util/Reachability.js +0 -70
- package/lib/Util/Reachability.native.d.ts +0 -11
- package/lib/Util/Reachability.native.js +0 -44
- package/lib/Util/Retry.d.ts +0 -21
- package/lib/Util/Retry.js +0 -205
- package/lib/Util/StringUtils.d.ts +0 -2
- package/lib/Util/StringUtils.js +0 -24
- package/lib/Util/index.d.ts +0 -7
- package/lib/Util/index.js +0 -35
- package/lib/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -5
- package/lib/clients/middleware/signing/signer/signatureV4/index.native.js +0 -15
- package/lib/types/types.d.ts +0 -46
- package/lib-esm/Amplify.d.ts +0 -28
- package/lib-esm/Amplify.js +0 -106
- package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +0 -28
- package/lib-esm/AwsClients/CognitoIdentity/base.js +0 -108
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +0 -23
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +0 -80
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +0 -23
- package/lib-esm/AwsClients/CognitoIdentity/getId.js +0 -70
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +0 -17
- package/lib-esm/AwsClients/Pinpoint/base.js +0 -35
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +0 -23
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +0 -74
- package/lib-esm/AwsClients/Pinpoint/index.d.ts +0 -4
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +0 -23
- package/lib-esm/AwsClients/Pinpoint/putEvents.js +0 -75
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +0 -23
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +0 -78
- package/lib-esm/ClientDevice/android.d.ts +0 -5
- package/lib-esm/ClientDevice/android.js +0 -16
- package/lib-esm/ClientDevice/browser.d.ts +0 -25
- package/lib-esm/ClientDevice/browser.js +0 -74
- package/lib-esm/ClientDevice/index.d.ts +0 -23
- package/lib-esm/ClientDevice/index.js +0 -15
- package/lib-esm/ClientDevice/ios.d.ts +0 -7
- package/lib-esm/ClientDevice/ios.js +0 -58
- package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
- package/lib-esm/ClientDevice/reactnative.js +0 -20
- package/lib-esm/Credentials.d.ts +0 -47
- package/lib-esm/Credentials.js +0 -675
- package/lib-esm/Errors.d.ts +0 -2
- package/lib-esm/Errors.js +0 -8
- package/lib-esm/Hub.d.ts +0 -55
- package/lib-esm/Hub.js +0 -216
- package/lib-esm/JS.d.ts +0 -32
- package/lib-esm/JS.js +0 -206
- package/lib-esm/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/FacebookOAuth.js +0 -121
- package/lib-esm/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/GoogleOAuth.js +0 -130
- package/lib-esm/OAuthHelper/index.d.ts +0 -4
- package/lib-esm/OAuthHelper/index.js +0 -6
- package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +0 -34
- package/lib-esm/Providers/AWSCloudWatchProvider.js +0 -593
- package/lib-esm/Providers/index.d.ts +0 -1
- package/lib-esm/Providers/index.js +0 -3
- package/lib-esm/RNComponents/index.d.ts +0 -5
- package/lib-esm/RNComponents/index.js +0 -12
- package/lib-esm/RNComponents/reactnative.d.ts +0 -3
- package/lib-esm/RNComponents/reactnative.js +0 -5
- package/lib-esm/Signer.d.ts +0 -41
- package/lib-esm/Signer.js +0 -127
- package/lib-esm/StorageHelper/index.d.ts +0 -41
- package/lib-esm/StorageHelper/index.js +0 -72
- package/lib-esm/StorageHelper/reactnative.d.ts +0 -13
- package/lib-esm/StorageHelper/reactnative.js +0 -100
- package/lib-esm/UniversalStorage/index.d.ts +0 -23
- package/lib-esm/UniversalStorage/index.js +0 -106
- package/lib-esm/Util/BackgroundProcessManager.d.ts +0 -204
- package/lib-esm/Util/BackgroundProcessManager.js +0 -445
- package/lib-esm/Util/Constants.d.ts +0 -8
- package/lib-esm/Util/Constants.js +0 -14
- package/lib-esm/Util/DateUtils.d.ts +0 -7
- package/lib-esm/Util/DateUtils.js +0 -72
- package/lib-esm/Util/Mutex.d.ts +0 -45
- package/lib-esm/Util/Mutex.js +0 -71
- package/lib-esm/Util/Reachability.d.ts +0 -13
- package/lib-esm/Util/Reachability.js +0 -65
- package/lib-esm/Util/Reachability.native.d.ts +0 -11
- package/lib-esm/Util/Reachability.native.js +0 -39
- package/lib-esm/Util/Retry.d.ts +0 -21
- package/lib-esm/Util/Retry.js +0 -198
- package/lib-esm/Util/StringUtils.d.ts +0 -2
- package/lib-esm/Util/StringUtils.js +0 -19
- package/lib-esm/Util/index.d.ts +0 -7
- package/lib-esm/Util/index.js +0 -9
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -5
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js +0 -8
- package/lib-esm/types/types.d.ts +0 -46
- package/polyfills/URL/index.js +0 -1
- package/polyfills/URL/index.ts +0 -14
- package/polyfills/URL/tsconfig.json +0 -10
- package/polyfills/URL/webpack.config.js +0 -43
- package/src/Amplify.ts +0 -100
- package/src/AwsClients/CognitoIdentity/base.ts +0 -93
- package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +0 -67
- package/src/AwsClients/Pinpoint/base.ts +0 -41
- package/src/AwsClients/Pinpoint/getInAppMessages.ts +0 -56
- package/src/AwsClients/Pinpoint/index.ts +0 -15
- package/src/AwsClients/Pinpoint/putEvents.ts +0 -55
- package/src/AwsClients/Pinpoint/updateEndpoint.ts +0 -60
- package/src/ClientDevice/android.ts +0 -21
- package/src/ClientDevice/browser.ts +0 -93
- package/src/ClientDevice/index.ts +0 -14
- package/src/ClientDevice/ios.ts +0 -64
- package/src/ClientDevice/reactnative.ts +0 -18
- package/src/Credentials.ts +0 -634
- package/src/Errors.ts +0 -9
- package/src/Hub.ts +0 -235
- package/src/JS.ts +0 -259
- package/src/OAuthHelper/FacebookOAuth.ts +0 -83
- package/src/OAuthHelper/GoogleOAuth.ts +0 -94
- package/src/OAuthHelper/index.ts +0 -7
- package/src/Providers/AWSCloudWatchProvider.ts +0 -515
- package/src/Providers/index.ts +0 -3
- package/src/RNComponents/index.ts +0 -15
- package/src/RNComponents/reactnative.ts +0 -6
- package/src/Signer.ts +0 -176
- package/src/StorageHelper/index.ts +0 -73
- package/src/StorageHelper/reactnative.ts +0 -102
- package/src/UniversalStorage/index.ts +0 -119
- package/src/Util/BackgroundProcessManager.ts +0 -451
- package/src/Util/Constants.ts +0 -24
- package/src/Util/DateUtils.ts +0 -86
- package/src/Util/Mutex.ts +0 -96
- package/src/Util/Reachability.native.ts +0 -50
- package/src/Util/Reachability.ts +0 -60
- package/src/Util/Retry.ts +0 -121
- package/src/Util/StringUtils.ts +0 -20
- package/src/Util/index.ts +0 -27
- package/src/clients/middleware/signing/signer/signatureV4/index.native.ts +0 -10
- package/src/types/types.ts +0 -67
- /package/lib/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
- /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
- /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
- /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
- /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
- /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
- /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
- /package/lib/{types → singleton/API}/types.js +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
- /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
- /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
- /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
- /package/lib-esm/{types → singleton/API}/types.js +0 -0
- /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.ts +0 -0
- /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.ts +0 -0
- /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.ts +0 -0
- /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/types.ts +0 -0
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* @private For internal Amplify use.
|
|
5
|
-
*
|
|
6
|
-
* Creates a new scope for promises, observables, and other types of work or
|
|
7
|
-
* processes that may be running in the background. This manager provides
|
|
8
|
-
* an singular entrypoint to request termination and await completion.
|
|
9
|
-
*
|
|
10
|
-
* As work completes on its own prior to close, the manager removes them
|
|
11
|
-
* from the registry to avoid holding references to completed jobs.
|
|
12
|
-
*/
|
|
13
|
-
export class BackgroundProcessManager {
|
|
14
|
-
/**
|
|
15
|
-
* A string indicating whether the manager is accepting new work ("Open"),
|
|
16
|
-
* waiting for work to complete ("Closing"), or fully done with all
|
|
17
|
-
* submitted work and *not* accepting new jobs ("Closed").
|
|
18
|
-
*/
|
|
19
|
-
private _state = BackgroundProcessManagerState.Open;
|
|
20
|
-
|
|
21
|
-
private _closingPromise: Promise<PromiseSettledResult<any>[]> | undefined;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The list of outstanding jobs we'll need to wait for upon `close()`
|
|
25
|
-
*/
|
|
26
|
-
private jobs = new Set<JobEntry>();
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new manager for promises, observables, and other types
|
|
30
|
-
* of work that may be running in the background. This manager provides
|
|
31
|
-
* a centralized mechanism to request termination and await completion.
|
|
32
|
-
*/
|
|
33
|
-
constructor() {}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Executes an async `job` function, passing the return value through to
|
|
37
|
-
* the caller, registering it as a running job in the manager. When the
|
|
38
|
-
* manager *closes*, it will `await` the job.
|
|
39
|
-
*
|
|
40
|
-
* @param job The function to execute.
|
|
41
|
-
* @param description Optional description to help identify pending jobs.
|
|
42
|
-
* @returns The return value from the given function.
|
|
43
|
-
*/
|
|
44
|
-
add<T>(job: () => Promise<T>, description?: string): Promise<T>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Executes an async `job` function, passing the return value through to
|
|
48
|
-
* the caller, registering it as a running job in the manager. When the
|
|
49
|
-
* manager *closes*, it will request termination by resolving the
|
|
50
|
-
* provided `onTerminate` promise. It will then `await` the job, so it is
|
|
51
|
-
* important that the job still `resolve()` or `reject()` when responding
|
|
52
|
-
* to a termination request.
|
|
53
|
-
*
|
|
54
|
-
* @param job The function to execute.
|
|
55
|
-
* @param description Optional description to help identify pending jobs.
|
|
56
|
-
* @returns The return value from the given function.
|
|
57
|
-
*/
|
|
58
|
-
add<T>(
|
|
59
|
-
job: (onTerminate: Promise<void>) => Promise<T>,
|
|
60
|
-
description?: string
|
|
61
|
-
): Promise<T>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Create a no-op job, registers it with the manager, and returns hooks
|
|
65
|
-
* to the caller to signal the job's completion and respond to termination
|
|
66
|
-
* requests.
|
|
67
|
-
*
|
|
68
|
-
* When the manager closes, the no-op job will be `await`-ed, so its
|
|
69
|
-
* important to always `resolve()` or `reject()` when done responding to an
|
|
70
|
-
* `onTerminate` signal.
|
|
71
|
-
* @param description Optional description to help identify pending jobs.
|
|
72
|
-
* @returns Job promise hooks + onTerminate signaling promise
|
|
73
|
-
*/
|
|
74
|
-
add(description?: string): {
|
|
75
|
-
resolve: (value?: unknown) => void;
|
|
76
|
-
reject: (reason?: any) => void;
|
|
77
|
-
onTerminate: Promise<void>;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Adds another job manager to await on at the time of closing. the inner
|
|
82
|
-
* manager's termination is signaled when this manager's `close()` is
|
|
83
|
-
* called for.
|
|
84
|
-
*
|
|
85
|
-
* @param job The inner job manager to await.
|
|
86
|
-
* @param description Optional description to help identify pending jobs.
|
|
87
|
-
*/
|
|
88
|
-
add(job: BackgroundProcessManager, description?: string);
|
|
89
|
-
|
|
90
|
-
add(jobOrDescription?, optionalDescription?) {
|
|
91
|
-
let job;
|
|
92
|
-
let description: string;
|
|
93
|
-
|
|
94
|
-
if (typeof jobOrDescription === 'string') {
|
|
95
|
-
job = undefined;
|
|
96
|
-
description = jobOrDescription;
|
|
97
|
-
} else {
|
|
98
|
-
job = jobOrDescription;
|
|
99
|
-
description = optionalDescription;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const error = this.closedFailure(description);
|
|
103
|
-
if (error) return error;
|
|
104
|
-
|
|
105
|
-
if (job === undefined) {
|
|
106
|
-
return this.addHook(description);
|
|
107
|
-
} else if (typeof job === 'function') {
|
|
108
|
-
return this.addFunction(job, description);
|
|
109
|
-
} else if (job instanceof BackgroundProcessManager) {
|
|
110
|
-
return this.addManager(job, description);
|
|
111
|
-
} else {
|
|
112
|
-
throw new Error(
|
|
113
|
-
'If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.'
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Adds a **cleaner** function that doesn't immediately get executed.
|
|
120
|
-
* Instead, the caller gets a **terminate** function back. The *cleaner* is
|
|
121
|
-
* invoked only once the mananger *closes* or the returned **terminate**
|
|
122
|
-
* function is called.
|
|
123
|
-
*
|
|
124
|
-
* @param clean The cleanup function.
|
|
125
|
-
* @param description Optional description to help identify pending jobs.
|
|
126
|
-
* @returns A terminate function.
|
|
127
|
-
*/
|
|
128
|
-
addCleaner<T>(
|
|
129
|
-
clean: () => Promise<T>,
|
|
130
|
-
description?: string
|
|
131
|
-
): () => Promise<void> {
|
|
132
|
-
const { resolve, onTerminate } = this.addHook(description);
|
|
133
|
-
|
|
134
|
-
const proxy = async () => {
|
|
135
|
-
await clean();
|
|
136
|
-
resolve();
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
onTerminate.then(proxy);
|
|
140
|
-
|
|
141
|
-
return proxy;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private addFunction<T>(
|
|
145
|
-
job: () => Promise<T>,
|
|
146
|
-
description?: string
|
|
147
|
-
): Promise<T>;
|
|
148
|
-
private addFunction<T>(
|
|
149
|
-
job: (onTerminate: Promise<void>) => Promise<T>,
|
|
150
|
-
description?: string
|
|
151
|
-
): Promise<T>;
|
|
152
|
-
private addFunction(job, description) {
|
|
153
|
-
// the function we call when we want to try to terminate this job.
|
|
154
|
-
let terminate;
|
|
155
|
-
|
|
156
|
-
// the promise the job can opt into listening to for termination.
|
|
157
|
-
const onTerminate = new Promise(resolve => {
|
|
158
|
-
terminate = resolve;
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// finally! start the job.
|
|
162
|
-
const jobResult = job(onTerminate);
|
|
163
|
-
|
|
164
|
-
// depending on what the job gives back, register the result
|
|
165
|
-
// so we can monitor for completion.
|
|
166
|
-
if (typeof jobResult?.then === 'function') {
|
|
167
|
-
this.registerPromise(jobResult, terminate, description);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// At the end of the day, or you know, method call, it doesn't matter
|
|
171
|
-
// what the return value is at all; we just pass it through to the
|
|
172
|
-
// caller.
|
|
173
|
-
return jobResult;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
private addManager(manager: BackgroundProcessManager, description?: string) {
|
|
177
|
-
this.addCleaner(async () => await manager.close(), description);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Creates and registers a fabricated job for processes that need to operate
|
|
182
|
-
* with callbacks/hooks. The returned `resolve` and `reject`
|
|
183
|
-
* functions can be used to signal the job is done successfully or not.
|
|
184
|
-
* The returned `onTerminate` is a promise that will resolve when the
|
|
185
|
-
* manager is requesting the termination of the job.
|
|
186
|
-
*
|
|
187
|
-
* @param description Optional description to help identify pending jobs.
|
|
188
|
-
* @returns `{ resolve, reject, onTerminate }`
|
|
189
|
-
*/
|
|
190
|
-
private addHook(description?: string) {
|
|
191
|
-
// the resolve/reject functions we'll provide to the caller to signal
|
|
192
|
-
// the state of the job.
|
|
193
|
-
let resolve!: (value?: unknown) => void;
|
|
194
|
-
let reject!: (reason?: any) => void;
|
|
195
|
-
|
|
196
|
-
// the underlying promise we'll use to manage it, pretty much like
|
|
197
|
-
// any other promise.
|
|
198
|
-
const promise = new Promise((res, rej) => {
|
|
199
|
-
resolve = res;
|
|
200
|
-
reject = rej;
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
// the function we call when we want to try to terminate this job.
|
|
204
|
-
let terminate;
|
|
205
|
-
|
|
206
|
-
// the promise the job can opt into listening to for termination.
|
|
207
|
-
const onTerminate = new Promise(resolveTerminate => {
|
|
208
|
-
terminate = resolveTerminate;
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
this.registerPromise(promise, terminate, description);
|
|
212
|
-
|
|
213
|
-
return {
|
|
214
|
-
resolve,
|
|
215
|
-
reject,
|
|
216
|
-
onTerminate,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Adds a Promise based job to the list of jobs for monitoring and listens
|
|
222
|
-
* for either a success or failure, upon which the job is considered "done"
|
|
223
|
-
* and removed from the registry.
|
|
224
|
-
*
|
|
225
|
-
* @param promise A promise that is on its way to being returned to a
|
|
226
|
-
* caller, which needs to be tracked as a background job.
|
|
227
|
-
* @param terminate The termination function to register, which can be
|
|
228
|
-
* invoked to request the job stop.
|
|
229
|
-
* @param description Optional description to help identify pending jobs.
|
|
230
|
-
*/
|
|
231
|
-
private registerPromise<T extends Promise<any>>(
|
|
232
|
-
promise: T,
|
|
233
|
-
terminate: () => void,
|
|
234
|
-
description?: string
|
|
235
|
-
) {
|
|
236
|
-
const jobEntry = { promise, terminate, description };
|
|
237
|
-
this.jobs.add(jobEntry);
|
|
238
|
-
|
|
239
|
-
// in all of my testing, it is safe to multi-subscribe to a promise.
|
|
240
|
-
// so, rather than create another layer of promising, we're just going
|
|
241
|
-
// to hook into the promise we already have, and when it's done
|
|
242
|
-
// (successfully or not), we no longer need to wait for it upon close.
|
|
243
|
-
|
|
244
|
-
//
|
|
245
|
-
// sorry this is a bit hand-wavy:
|
|
246
|
-
//
|
|
247
|
-
// i believe we use `.then` and `.catch` instead of `.finally` because
|
|
248
|
-
// `.finally` is invoked in a different order in the sequence, and this
|
|
249
|
-
// breaks assumptions throughout and causes failures.
|
|
250
|
-
promise
|
|
251
|
-
.then(() => {
|
|
252
|
-
this.jobs.delete(jobEntry);
|
|
253
|
-
})
|
|
254
|
-
.catch(() => {
|
|
255
|
-
this.jobs.delete(jobEntry);
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* The number of jobs being waited on.
|
|
261
|
-
*
|
|
262
|
-
* We don't use this for anything. It's just informational for the caller,
|
|
263
|
-
* and can be used in logging and testing.
|
|
264
|
-
*
|
|
265
|
-
* @returns the number of jobs.
|
|
266
|
-
*/
|
|
267
|
-
get length() {
|
|
268
|
-
return this.jobs.size;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* The execution state of the manager. One of:
|
|
273
|
-
*
|
|
274
|
-
* 1. "Open" -> Accepting new jobs
|
|
275
|
-
* 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
|
|
276
|
-
* 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
|
|
277
|
-
*/
|
|
278
|
-
get state() {
|
|
279
|
-
return this._state;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* The registered `description` of all still-pending jobs.
|
|
284
|
-
*
|
|
285
|
-
* @returns descriptions as an array.
|
|
286
|
-
*/
|
|
287
|
-
get pending() {
|
|
288
|
-
return Array.from(this.jobs).map(job => job.description);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Whether the manager is accepting new jobs.
|
|
293
|
-
*/
|
|
294
|
-
get isOpen() {
|
|
295
|
-
return this._state === BackgroundProcessManagerState.Open;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Whether the manager is rejecting new work, but still waiting for
|
|
300
|
-
* submitted work to complete.
|
|
301
|
-
*/
|
|
302
|
-
get isClosing() {
|
|
303
|
-
return this._state === BackgroundProcessManagerState.Closing;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Whether the manager is rejecting work and done waiting for submitted
|
|
308
|
-
* work to complete.
|
|
309
|
-
*/
|
|
310
|
-
get isClosed() {
|
|
311
|
-
return this._state === BackgroundProcessManagerState.Closed;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
private closedFailure(description: string) {
|
|
315
|
-
if (!this.isOpen) {
|
|
316
|
-
return Promise.reject(
|
|
317
|
-
new BackgroundManagerNotOpenError(
|
|
318
|
-
[
|
|
319
|
-
`The manager is ${this.state}.`,
|
|
320
|
-
`You tried to add "${description}".`,
|
|
321
|
-
`Pending jobs: [\n${this.pending
|
|
322
|
-
.map(t => ' ' + t)
|
|
323
|
-
.join(',\n')}\n]`,
|
|
324
|
-
].join('\n')
|
|
325
|
-
)
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Signals jobs to stop (for those that accept interruptions) and waits
|
|
332
|
-
* for confirmation that jobs have stopped.
|
|
333
|
-
*
|
|
334
|
-
* This immediately puts the manager into a closing state and just begins
|
|
335
|
-
* to reject new work. After all work in the manager is complete, the
|
|
336
|
-
* manager goes into a `Completed` state and `close()` returns.
|
|
337
|
-
*
|
|
338
|
-
* This call is idempotent.
|
|
339
|
-
*
|
|
340
|
-
* If the manager is already closing or closed, `finalCleaup` is not executed.
|
|
341
|
-
*
|
|
342
|
-
* @param onClosed
|
|
343
|
-
* @returns The settled results of each still-running job's promise. If the
|
|
344
|
-
* manager is already closed, this will contain the results as of when the
|
|
345
|
-
* manager's `close()` was called in an `Open` state.
|
|
346
|
-
*/
|
|
347
|
-
async close() {
|
|
348
|
-
if (this.isOpen) {
|
|
349
|
-
this._state = BackgroundProcessManagerState.Closing;
|
|
350
|
-
for (const job of Array.from(this.jobs)) {
|
|
351
|
-
try {
|
|
352
|
-
job.terminate();
|
|
353
|
-
} catch (error) {
|
|
354
|
-
// Due to potential races with a job's natural completion, it's
|
|
355
|
-
// reasonable to expect the termination call to fail. Hence,
|
|
356
|
-
// not logging as an error.
|
|
357
|
-
console.warn(
|
|
358
|
-
`Failed to send termination signal to job. Error: ${error.message}`,
|
|
359
|
-
job
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Use `allSettled()` because we want to wait for all to finish. We do
|
|
365
|
-
// not want to stop waiting if there is a failure.
|
|
366
|
-
this._closingPromise = Promise.allSettled(
|
|
367
|
-
Array.from(this.jobs).map(j => j.promise)
|
|
368
|
-
);
|
|
369
|
-
|
|
370
|
-
await this._closingPromise;
|
|
371
|
-
this._state = BackgroundProcessManagerState.Closed;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return this._closingPromise as any;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Signals the manager to start accepting work (again) and returns once
|
|
379
|
-
* the manager is ready to do so.
|
|
380
|
-
*
|
|
381
|
-
* If the state is already `Open`, this call is a no-op.
|
|
382
|
-
*
|
|
383
|
-
* If the state is `Closed`, this call simply updates state and returns.
|
|
384
|
-
*
|
|
385
|
-
* If the state is `Closing`, this call waits for completion before it
|
|
386
|
-
* updates the state and returns.
|
|
387
|
-
*/
|
|
388
|
-
async open() {
|
|
389
|
-
if (this.isClosing) {
|
|
390
|
-
await this.close();
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
this._state = BackgroundProcessManagerState.Open;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
*
|
|
399
|
-
*/
|
|
400
|
-
export class BackgroundManagerNotOpenError extends Error {
|
|
401
|
-
constructor(message: string) {
|
|
402
|
-
super(`BackgroundManagerNotOpenError: ${message}`);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* All possible states a `BackgroundProcessManager` instance can be in.
|
|
408
|
-
*/
|
|
409
|
-
export enum BackgroundProcessManagerState {
|
|
410
|
-
/**
|
|
411
|
-
* Accepting new jobs.
|
|
412
|
-
*/
|
|
413
|
-
Open = 'Open',
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Not accepting new jobs. Waiting for submitted jobs to complete.
|
|
417
|
-
*/
|
|
418
|
-
Closing = 'Closing',
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Not accepting new jobs. All submitted jobs are complete.
|
|
422
|
-
*/
|
|
423
|
-
Closed = 'Closed',
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Completely internal to `BackgroundProcessManager`, and describes the structure of
|
|
428
|
-
* an entry in the jobs registry.
|
|
429
|
-
*/
|
|
430
|
-
type JobEntry = {
|
|
431
|
-
/**
|
|
432
|
-
* The underlying promise provided by the job function to wait for.
|
|
433
|
-
*/
|
|
434
|
-
promise: Promise<any>;
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Request the termination of the job.
|
|
438
|
-
*/
|
|
439
|
-
terminate: () => void;
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* An object provided by the caller that can be used to identify the description
|
|
443
|
-
* of the job, which can otherwise be unclear from the `promise` and
|
|
444
|
-
* `terminate` function. The `description` can be a string. (May be extended
|
|
445
|
-
* later to also support object refs.)
|
|
446
|
-
*
|
|
447
|
-
* Useful for troubleshooting why a manager is waiting for long periods of time
|
|
448
|
-
* on `close()`.
|
|
449
|
-
*/
|
|
450
|
-
description?: string;
|
|
451
|
-
};
|
package/src/Util/Constants.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Logging constants
|
|
5
|
-
const AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
|
|
6
|
-
const AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
|
|
7
|
-
const AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
|
|
8
|
-
const AWS_CLOUDWATCH_CATEGORY = 'Logging';
|
|
9
|
-
const AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
|
|
10
|
-
const NO_CREDS_ERROR_STRING = 'No credentials';
|
|
11
|
-
const RETRY_ERROR_CODES = [
|
|
12
|
-
'ResourceNotFoundException',
|
|
13
|
-
'InvalidSequenceTokenException',
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
AWS_CLOUDWATCH_BASE_BUFFER_SIZE,
|
|
18
|
-
AWS_CLOUDWATCH_CATEGORY,
|
|
19
|
-
AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE,
|
|
20
|
-
AWS_CLOUDWATCH_MAX_EVENT_SIZE,
|
|
21
|
-
AWS_CLOUDWATCH_PROVIDER_NAME,
|
|
22
|
-
NO_CREDS_ERROR_STRING,
|
|
23
|
-
RETRY_ERROR_CODES,
|
|
24
|
-
};
|
package/src/Util/DateUtils.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Date & time utility functions to abstract the `aws-sdk` away from users.
|
|
5
|
-
* (v2 => v3 modularization is a breaking change)
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/aws/aws-sdk-js/blob/6edf586dcc1de7fe8fbfbbd9a0d2b1847921e6e1/lib/util.js#L262
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Comment - TODO: remove
|
|
11
|
-
|
|
12
|
-
const FIVE_MINUTES_IN_MS = 1000 * 60 * 5;
|
|
13
|
-
|
|
14
|
-
export const DateUtils = {
|
|
15
|
-
/**
|
|
16
|
-
* Milliseconds to offset the date to compensate for clock skew between device & services
|
|
17
|
-
*/
|
|
18
|
-
clockOffset: 0,
|
|
19
|
-
|
|
20
|
-
getDateWithClockOffset() {
|
|
21
|
-
if (DateUtils.clockOffset) {
|
|
22
|
-
return new Date(new Date().getTime() + DateUtils.clockOffset);
|
|
23
|
-
} else {
|
|
24
|
-
return new Date();
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @returns {number} Clock offset in milliseconds
|
|
30
|
-
*/
|
|
31
|
-
getClockOffset() {
|
|
32
|
-
return DateUtils.clockOffset;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
getHeaderStringFromDate(date: Date = DateUtils.getDateWithClockOffset()) {
|
|
36
|
-
return date.toISOString().replace(/[:\-]|\.\d{3}/g, '');
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
getDateFromHeaderString(header: string) {
|
|
40
|
-
const [, year, month, day, hour, minute, second] = header.match(
|
|
41
|
-
/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return new Date(
|
|
45
|
-
Date.UTC(
|
|
46
|
-
Number(year),
|
|
47
|
-
Number(month) - 1,
|
|
48
|
-
Number(day),
|
|
49
|
-
Number(hour),
|
|
50
|
-
Number(minute),
|
|
51
|
-
Number(second)
|
|
52
|
-
)
|
|
53
|
-
);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
isClockSkewed(serverDate: Date) {
|
|
57
|
-
// API gateway permits client calls that are off by no more than ±5 minutes
|
|
58
|
-
return (
|
|
59
|
-
Math.abs(
|
|
60
|
-
serverDate.getTime() - DateUtils.getDateWithClockOffset().getTime()
|
|
61
|
-
) >= FIVE_MINUTES_IN_MS
|
|
62
|
-
);
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
isClockSkewError(error: any) {
|
|
66
|
-
if (!error.response || !error.response.headers) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const { headers } = error.response;
|
|
71
|
-
|
|
72
|
-
return Boolean(
|
|
73
|
-
['BadRequestException', 'InvalidSignatureException'].includes(
|
|
74
|
-
headers['x-amzn-errortype']
|
|
75
|
-
) &&
|
|
76
|
-
(headers.date || headers.Date)
|
|
77
|
-
);
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @param {number} offset Clock offset in milliseconds
|
|
82
|
-
*/
|
|
83
|
-
setClockOffset(offset: number) {
|
|
84
|
-
DateUtils.clockOffset = offset;
|
|
85
|
-
},
|
|
86
|
-
};
|
package/src/Util/Mutex.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/*!
|
|
4
|
-
* The MIT License (MIT)
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2016 Christian Speckner <cnspeckn@googlemail.com>
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
* in the Software without restriction, including without limitation the rights
|
|
11
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
* furnished to do so, subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in
|
|
16
|
-
* all copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
-
* THE SOFTWARE.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
interface MutexInterface {
|
|
28
|
-
acquire(): Promise<MutexInterface.Releaser>;
|
|
29
|
-
|
|
30
|
-
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
31
|
-
|
|
32
|
-
isLocked(): boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
namespace MutexInterface {
|
|
36
|
-
export interface Releaser {
|
|
37
|
-
(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface Worker<T> {
|
|
41
|
-
(): Promise<T> | T;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
class Mutex implements MutexInterface {
|
|
46
|
-
isLocked(): boolean {
|
|
47
|
-
return this._pending;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
acquire(): Promise<MutexInterface.Releaser> {
|
|
51
|
-
const ticket = new Promise<MutexInterface.Releaser>(resolve =>
|
|
52
|
-
this._queue.push(resolve)
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (!this._pending) {
|
|
56
|
-
this._dispatchNext();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return ticket;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T> {
|
|
63
|
-
return this.acquire().then(release => {
|
|
64
|
-
let result: T | Promise<T>;
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
result = callback();
|
|
68
|
-
} catch (e) {
|
|
69
|
-
release();
|
|
70
|
-
throw e;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return Promise.resolve(result).then(
|
|
74
|
-
(x: T) => (release(), x),
|
|
75
|
-
e => {
|
|
76
|
-
release();
|
|
77
|
-
throw e;
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private _dispatchNext(): void {
|
|
84
|
-
if (this._queue.length > 0) {
|
|
85
|
-
this._pending = true;
|
|
86
|
-
this._queue.shift()!(this._dispatchNext.bind(this));
|
|
87
|
-
} else {
|
|
88
|
-
this._pending = false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private _queue: Array<(release: MutexInterface.Releaser) => void> = [];
|
|
93
|
-
private _pending = false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default Mutex;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import Observable from 'zen-observable-ts';
|
|
4
|
-
import { ConsoleLogger as Logger } from '../Logger';
|
|
5
|
-
|
|
6
|
-
const logger = new Logger('Reachability', 'DEBUG');
|
|
7
|
-
|
|
8
|
-
type NetworkStatus = {
|
|
9
|
-
online: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default class ReachabilityNavigator implements Reachability {
|
|
13
|
-
networkMonitor(netInfo?: any): Observable<NetworkStatus> {
|
|
14
|
-
/**
|
|
15
|
-
* Here netinfo refers to @react-native-community/netinfo
|
|
16
|
-
* This is needed in React Native to enable network detection
|
|
17
|
-
* We do not import it in Core so that Apps that do not use DataStore
|
|
18
|
-
* Do not need to install and link this dependency
|
|
19
|
-
* When using Reachability in React Native, pass NetInfo as a param to networkMonitor
|
|
20
|
-
*/
|
|
21
|
-
if (!(netInfo && netInfo.addEventListener)) {
|
|
22
|
-
throw new Error(
|
|
23
|
-
'NetInfo must be passed to networkMonitor to enable reachability in React Native'
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return new Observable(observer => {
|
|
27
|
-
logger.log('subscribing to reachability in React Native');
|
|
28
|
-
|
|
29
|
-
const unsubscribe = netInfo.addEventListener(
|
|
30
|
-
({ isInternetReachable }) => {
|
|
31
|
-
// `isInternetReachable` can sometimes be `null` initially, so we want
|
|
32
|
-
// to make sure it is a boolean first before sending it to the observer.
|
|
33
|
-
if (typeof isInternetReachable === 'boolean') {
|
|
34
|
-
const online = isInternetReachable;
|
|
35
|
-
logger.log('Notifying reachability change', online);
|
|
36
|
-
observer.next({ online });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return () => {
|
|
42
|
-
unsubscribe();
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface Reachability {
|
|
49
|
-
networkMonitor(netInfo?: any): Observable<NetworkStatus>;
|
|
50
|
-
}
|