@aws-amplify/core 5.8.6-unstable.7762f1a.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
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-amplify/core/internals/adapter-core",
|
|
3
|
+
"types": "../../lib-esm/adapterCore/index.d.ts",
|
|
4
|
+
"main": "../../lib/adapterCore/index.js",
|
|
5
|
+
"module": "../../lib-esm/adapterCore/index.js",
|
|
6
|
+
"react-native": "../../lib-esm/adapterCore/index.js",
|
|
7
|
+
"sideEffects": false
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core/internals/aws-clients/pinpoint",
|
|
3
|
-
"types": "../../../lib-esm/
|
|
4
|
-
"main": "../../../lib/
|
|
5
|
-
"module": "../../../lib-esm/
|
|
6
|
-
"react-native": "../../../lib-esm/
|
|
3
|
+
"types": "../../../lib-esm/awsClients/pinpoint/index.d.ts",
|
|
4
|
+
"main": "../../../lib/awsClients/pinpoint/index.js",
|
|
5
|
+
"module": "../../../lib-esm/awsClients/pinpoint/index.js",
|
|
6
|
+
"react-native": "../../../lib-esm/awsClients/pinpoint/index.js",
|
|
7
7
|
"sideEffects": false
|
|
8
8
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-amplify/core/internals/providers/pinpoint",
|
|
3
|
+
"types": "../../../lib-esm/providers/pinpoint/index.d.ts",
|
|
4
|
+
"main": "../../../lib/providers/pinpoint/index.js",
|
|
5
|
+
"module": "../../../lib-esm/providers/pinpoint/index.js",
|
|
6
|
+
"react-native": "../../../lib-esm/providers/pinpoint/index.js",
|
|
7
|
+
"sideEffects": false
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BackgroundManagerNotOpenError = void 0;
|
|
6
|
+
class BackgroundManagerNotOpenError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(`BackgroundManagerNotOpenError: ${message}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.BackgroundManagerNotOpenError = BackgroundManagerNotOpenError;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { BackgroundProcessManagerState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @private For internal Amplify use.
|
|
4
|
+
*
|
|
5
|
+
* Creates a new scope for promises, observables, and other types of work or
|
|
6
|
+
* processes that may be running in the background. This manager provides
|
|
7
|
+
* an singular entrypoint to request termination and await completion.
|
|
8
|
+
*
|
|
9
|
+
* As work completes on its own prior to close, the manager removes them
|
|
10
|
+
* from the registry to avoid holding references to completed jobs.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BackgroundProcessManager {
|
|
13
|
+
/**
|
|
14
|
+
* A string indicating whether the manager is accepting new work ("Open"),
|
|
15
|
+
* waiting for work to complete ("Closing"), or fully done with all
|
|
16
|
+
* submitted work and *not* accepting new jobs ("Closed").
|
|
17
|
+
*/
|
|
18
|
+
private _state;
|
|
19
|
+
private _closingPromise;
|
|
20
|
+
/**
|
|
21
|
+
* The list of outstanding jobs we'll need to wait for upon `close()`
|
|
22
|
+
*/
|
|
23
|
+
private jobs;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new manager for promises, observables, and other types
|
|
26
|
+
* of work that may be running in the background. This manager provides
|
|
27
|
+
* a centralized mechanism to request termination and await completion.
|
|
28
|
+
*/
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Executes an async `job` function, passing the return value through to
|
|
32
|
+
* the caller, registering it as a running job in the manager. When the
|
|
33
|
+
* manager *closes*, it will `await` the job.
|
|
34
|
+
*
|
|
35
|
+
* @param job The function to execute.
|
|
36
|
+
* @param description Optional description to help identify pending jobs.
|
|
37
|
+
* @returns The return value from the given function.
|
|
38
|
+
*/
|
|
39
|
+
add<T>(job: () => Promise<T>, description?: string): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Executes an async `job` function, passing the return value through to
|
|
42
|
+
* the caller, registering it as a running job in the manager. When the
|
|
43
|
+
* manager *closes*, it will request termination by resolving the
|
|
44
|
+
* provided `onTerminate` promise. It will then `await` the job, so it is
|
|
45
|
+
* important that the job still `resolve()` or `reject()` when responding
|
|
46
|
+
* to a termination request.
|
|
47
|
+
*
|
|
48
|
+
* @param job The function to execute.
|
|
49
|
+
* @param description Optional description to help identify pending jobs.
|
|
50
|
+
* @returns The return value from the given function.
|
|
51
|
+
*/
|
|
52
|
+
add<T>(job: (onTerminate: Promise<void>) => Promise<T>, description?: string): Promise<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Create a no-op job, registers it with the manager, and returns hooks
|
|
55
|
+
* to the caller to signal the job's completion and respond to termination
|
|
56
|
+
* requests.
|
|
57
|
+
*
|
|
58
|
+
* When the manager closes, the no-op job will be `await`-ed, so its
|
|
59
|
+
* important to always `resolve()` or `reject()` when done responding to an
|
|
60
|
+
* `onTerminate` signal.
|
|
61
|
+
* @param description Optional description to help identify pending jobs.
|
|
62
|
+
* @returns Job promise hooks + onTerminate signaling promise
|
|
63
|
+
*/
|
|
64
|
+
add(description?: string): {
|
|
65
|
+
resolve: (value?: unknown) => void;
|
|
66
|
+
reject: (reason?: any) => void;
|
|
67
|
+
onTerminate: Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Adds another job manager to await on at the time of closing. the inner
|
|
71
|
+
* manager's termination is signaled when this manager's `close()` is
|
|
72
|
+
* called for.
|
|
73
|
+
*
|
|
74
|
+
* @param job The inner job manager to await.
|
|
75
|
+
* @param description Optional description to help identify pending jobs.
|
|
76
|
+
*/
|
|
77
|
+
add<T>(job: BackgroundProcessManager, description?: string): Promise<T>;
|
|
78
|
+
/**
|
|
79
|
+
* Adds a **cleaner** function that doesn't immediately get executed.
|
|
80
|
+
* Instead, the caller gets a **terminate** function back. The *cleaner* is
|
|
81
|
+
* invoked only once the mananger *closes* or the returned **terminate**
|
|
82
|
+
* function is called.
|
|
83
|
+
*
|
|
84
|
+
* @param clean The cleanup function.
|
|
85
|
+
* @param description Optional description to help identify pending jobs.
|
|
86
|
+
* @returns A terminate function.
|
|
87
|
+
*/
|
|
88
|
+
addCleaner<T>(clean: () => Promise<T>, description?: string): () => Promise<void>;
|
|
89
|
+
private addFunction;
|
|
90
|
+
private addManager;
|
|
91
|
+
/**
|
|
92
|
+
* Creates and registers a fabricated job for processes that need to operate
|
|
93
|
+
* with callbacks/hooks. The returned `resolve` and `reject`
|
|
94
|
+
* functions can be used to signal the job is done successfully or not.
|
|
95
|
+
* The returned `onTerminate` is a promise that will resolve when the
|
|
96
|
+
* manager is requesting the termination of the job.
|
|
97
|
+
*
|
|
98
|
+
* @param description Optional description to help identify pending jobs.
|
|
99
|
+
* @returns `{ resolve, reject, onTerminate }`
|
|
100
|
+
*/
|
|
101
|
+
private addHook;
|
|
102
|
+
/**
|
|
103
|
+
* Adds a Promise based job to the list of jobs for monitoring and listens
|
|
104
|
+
* for either a success or failure, upon which the job is considered "done"
|
|
105
|
+
* and removed from the registry.
|
|
106
|
+
*
|
|
107
|
+
* @param promise A promise that is on its way to being returned to a
|
|
108
|
+
* caller, which needs to be tracked as a background job.
|
|
109
|
+
* @param terminate The termination function to register, which can be
|
|
110
|
+
* invoked to request the job stop.
|
|
111
|
+
* @param description Optional description to help identify pending jobs.
|
|
112
|
+
*/
|
|
113
|
+
private registerPromise;
|
|
114
|
+
/**
|
|
115
|
+
* The number of jobs being waited on.
|
|
116
|
+
*
|
|
117
|
+
* We don't use this for anything. It's just informational for the caller,
|
|
118
|
+
* and can be used in logging and testing.
|
|
119
|
+
*
|
|
120
|
+
* @returns the number of jobs.
|
|
121
|
+
*/
|
|
122
|
+
get length(): number;
|
|
123
|
+
/**
|
|
124
|
+
* The execution state of the manager. One of:
|
|
125
|
+
*
|
|
126
|
+
* 1. "Open" -> Accepting new jobs
|
|
127
|
+
* 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
|
|
128
|
+
* 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
|
|
129
|
+
*/
|
|
130
|
+
get state(): BackgroundProcessManagerState;
|
|
131
|
+
/**
|
|
132
|
+
* The registered `description` of all still-pending jobs.
|
|
133
|
+
*
|
|
134
|
+
* @returns descriptions as an array.
|
|
135
|
+
*/
|
|
136
|
+
get pending(): (string | undefined)[];
|
|
137
|
+
/**
|
|
138
|
+
* Whether the manager is accepting new jobs.
|
|
139
|
+
*/
|
|
140
|
+
get isOpen(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the manager is rejecting new work, but still waiting for
|
|
143
|
+
* submitted work to complete.
|
|
144
|
+
*/
|
|
145
|
+
get isClosing(): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the manager is rejecting work and done waiting for submitted
|
|
148
|
+
* work to complete.
|
|
149
|
+
*/
|
|
150
|
+
get isClosed(): boolean;
|
|
151
|
+
private closedFailure;
|
|
152
|
+
/**
|
|
153
|
+
* Signals jobs to stop (for those that accept interruptions) and waits
|
|
154
|
+
* for confirmation that jobs have stopped.
|
|
155
|
+
*
|
|
156
|
+
* This immediately puts the manager into a closing state and just begins
|
|
157
|
+
* to reject new work. After all work in the manager is complete, the
|
|
158
|
+
* manager goes into a `Completed` state and `close()` returns.
|
|
159
|
+
*
|
|
160
|
+
* This call is idempotent.
|
|
161
|
+
*
|
|
162
|
+
* If the manager is already closing or closed, `finalCleaup` is not executed.
|
|
163
|
+
*
|
|
164
|
+
* @param onClosed
|
|
165
|
+
* @returns The settled results of each still-running job's promise. If the
|
|
166
|
+
* manager is already closed, this will contain the results as of when the
|
|
167
|
+
* manager's `close()` was called in an `Open` state.
|
|
168
|
+
*/
|
|
169
|
+
close(): Promise<any>;
|
|
170
|
+
/**
|
|
171
|
+
* Signals the manager to start accepting work (again) and returns once
|
|
172
|
+
* the manager is ready to do so.
|
|
173
|
+
*
|
|
174
|
+
* If the state is already `Open`, this call is a no-op.
|
|
175
|
+
*
|
|
176
|
+
* If the state is `Closed`, this call simply updates state and returns.
|
|
177
|
+
*
|
|
178
|
+
* If the state is `Closing`, this call waits for completion before it
|
|
179
|
+
* updates the state and returns.
|
|
180
|
+
*/
|
|
181
|
+
open(): Promise<void>;
|
|
182
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BackgroundProcessManager = void 0;
|
|
6
|
+
const BackgroundManagerNotOpenError_1 = require("./BackgroundManagerNotOpenError");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
/**
|
|
9
|
+
* @private For internal Amplify use.
|
|
10
|
+
*
|
|
11
|
+
* Creates a new scope for promises, observables, and other types of work or
|
|
12
|
+
* processes that may be running in the background. This manager provides
|
|
13
|
+
* an singular entrypoint to request termination and await completion.
|
|
14
|
+
*
|
|
15
|
+
* As work completes on its own prior to close, the manager removes them
|
|
16
|
+
* from the registry to avoid holding references to completed jobs.
|
|
17
|
+
*/
|
|
18
|
+
class BackgroundProcessManager {
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new manager for promises, observables, and other types
|
|
21
|
+
* of work that may be running in the background. This manager provides
|
|
22
|
+
* a centralized mechanism to request termination and await completion.
|
|
23
|
+
*/
|
|
24
|
+
constructor() {
|
|
25
|
+
/**
|
|
26
|
+
* A string indicating whether the manager is accepting new work ("Open"),
|
|
27
|
+
* waiting for work to complete ("Closing"), or fully done with all
|
|
28
|
+
* submitted work and *not* accepting new jobs ("Closed").
|
|
29
|
+
*/
|
|
30
|
+
this._state = types_1.BackgroundProcessManagerState.Open;
|
|
31
|
+
/**
|
|
32
|
+
* The list of outstanding jobs we'll need to wait for upon `close()`
|
|
33
|
+
*/
|
|
34
|
+
this.jobs = new Set();
|
|
35
|
+
}
|
|
36
|
+
add(jobOrDescription, optionalDescription) {
|
|
37
|
+
let job;
|
|
38
|
+
let description;
|
|
39
|
+
if (typeof jobOrDescription === 'string') {
|
|
40
|
+
job = undefined;
|
|
41
|
+
description = jobOrDescription;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
job = jobOrDescription;
|
|
45
|
+
description = optionalDescription;
|
|
46
|
+
}
|
|
47
|
+
const error = this.closedFailure(description);
|
|
48
|
+
if (error)
|
|
49
|
+
return error;
|
|
50
|
+
if (job === undefined) {
|
|
51
|
+
return this.addHook(description);
|
|
52
|
+
}
|
|
53
|
+
else if (typeof job === 'function') {
|
|
54
|
+
return this.addFunction(job, description);
|
|
55
|
+
}
|
|
56
|
+
else if (job instanceof BackgroundProcessManager) {
|
|
57
|
+
return this.addManager(job, description);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error('If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Adds a **cleaner** function that doesn't immediately get executed.
|
|
65
|
+
* Instead, the caller gets a **terminate** function back. The *cleaner* is
|
|
66
|
+
* invoked only once the mananger *closes* or the returned **terminate**
|
|
67
|
+
* function is called.
|
|
68
|
+
*
|
|
69
|
+
* @param clean The cleanup function.
|
|
70
|
+
* @param description Optional description to help identify pending jobs.
|
|
71
|
+
* @returns A terminate function.
|
|
72
|
+
*/
|
|
73
|
+
addCleaner(clean, description) {
|
|
74
|
+
const { resolve, onTerminate } = this.addHook(description);
|
|
75
|
+
const proxy = async () => {
|
|
76
|
+
await clean();
|
|
77
|
+
resolve();
|
|
78
|
+
};
|
|
79
|
+
onTerminate.then(proxy);
|
|
80
|
+
return proxy;
|
|
81
|
+
}
|
|
82
|
+
addFunction(job, description) {
|
|
83
|
+
// the function we call when we want to try to terminate this job.
|
|
84
|
+
let terminate;
|
|
85
|
+
// the promise the job can opt into listening to for termination.
|
|
86
|
+
const onTerminate = new Promise(resolve => {
|
|
87
|
+
terminate = resolve;
|
|
88
|
+
});
|
|
89
|
+
// finally! start the job.
|
|
90
|
+
const jobResult = job(onTerminate);
|
|
91
|
+
// depending on what the job gives back, register the result
|
|
92
|
+
// so we can monitor for completion.
|
|
93
|
+
if (typeof jobResult?.then === 'function') {
|
|
94
|
+
this.registerPromise(jobResult, terminate, description);
|
|
95
|
+
}
|
|
96
|
+
// At the end of the day, or you know, method call, it doesn't matter
|
|
97
|
+
// what the return value is at all; we just pass it through to the
|
|
98
|
+
// caller.
|
|
99
|
+
return jobResult;
|
|
100
|
+
}
|
|
101
|
+
addManager(manager, description) {
|
|
102
|
+
this.addCleaner(async () => await manager.close(), description);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Creates and registers a fabricated job for processes that need to operate
|
|
106
|
+
* with callbacks/hooks. The returned `resolve` and `reject`
|
|
107
|
+
* functions can be used to signal the job is done successfully or not.
|
|
108
|
+
* The returned `onTerminate` is a promise that will resolve when the
|
|
109
|
+
* manager is requesting the termination of the job.
|
|
110
|
+
*
|
|
111
|
+
* @param description Optional description to help identify pending jobs.
|
|
112
|
+
* @returns `{ resolve, reject, onTerminate }`
|
|
113
|
+
*/
|
|
114
|
+
addHook(description) {
|
|
115
|
+
// the resolve/reject functions we'll provide to the caller to signal
|
|
116
|
+
// the state of the job.
|
|
117
|
+
let resolve;
|
|
118
|
+
let reject;
|
|
119
|
+
// the underlying promise we'll use to manage it, pretty much like
|
|
120
|
+
// any other promise.
|
|
121
|
+
const promise = new Promise((res, rej) => {
|
|
122
|
+
resolve = res;
|
|
123
|
+
reject = rej;
|
|
124
|
+
});
|
|
125
|
+
// the function we call when we want to try to terminate this job.
|
|
126
|
+
let terminate;
|
|
127
|
+
// the promise the job can opt into listening to for termination.
|
|
128
|
+
const onTerminate = new Promise(resolveTerminate => {
|
|
129
|
+
terminate = resolveTerminate;
|
|
130
|
+
});
|
|
131
|
+
this.registerPromise(promise, terminate, description);
|
|
132
|
+
return {
|
|
133
|
+
resolve,
|
|
134
|
+
reject,
|
|
135
|
+
onTerminate,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Adds a Promise based job to the list of jobs for monitoring and listens
|
|
140
|
+
* for either a success or failure, upon which the job is considered "done"
|
|
141
|
+
* and removed from the registry.
|
|
142
|
+
*
|
|
143
|
+
* @param promise A promise that is on its way to being returned to a
|
|
144
|
+
* caller, which needs to be tracked as a background job.
|
|
145
|
+
* @param terminate The termination function to register, which can be
|
|
146
|
+
* invoked to request the job stop.
|
|
147
|
+
* @param description Optional description to help identify pending jobs.
|
|
148
|
+
*/
|
|
149
|
+
registerPromise(promise, terminate, description) {
|
|
150
|
+
const jobEntry = { promise, terminate, description };
|
|
151
|
+
this.jobs.add(jobEntry);
|
|
152
|
+
// in all of my testing, it is safe to multi-subscribe to a promise.
|
|
153
|
+
// so, rather than create another layer of promising, we're just going
|
|
154
|
+
// to hook into the promise we already have, and when it's done
|
|
155
|
+
// (successfully or not), we no longer need to wait for it upon close.
|
|
156
|
+
//
|
|
157
|
+
// sorry this is a bit hand-wavy:
|
|
158
|
+
//
|
|
159
|
+
// i believe we use `.then` and `.catch` instead of `.finally` because
|
|
160
|
+
// `.finally` is invoked in a different order in the sequence, and this
|
|
161
|
+
// breaks assumptions throughout and causes failures.
|
|
162
|
+
promise
|
|
163
|
+
.then(() => {
|
|
164
|
+
this.jobs.delete(jobEntry);
|
|
165
|
+
})
|
|
166
|
+
.catch(() => {
|
|
167
|
+
this.jobs.delete(jobEntry);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The number of jobs being waited on.
|
|
172
|
+
*
|
|
173
|
+
* We don't use this for anything. It's just informational for the caller,
|
|
174
|
+
* and can be used in logging and testing.
|
|
175
|
+
*
|
|
176
|
+
* @returns the number of jobs.
|
|
177
|
+
*/
|
|
178
|
+
get length() {
|
|
179
|
+
return this.jobs.size;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The execution state of the manager. One of:
|
|
183
|
+
*
|
|
184
|
+
* 1. "Open" -> Accepting new jobs
|
|
185
|
+
* 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
|
|
186
|
+
* 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
|
|
187
|
+
*/
|
|
188
|
+
get state() {
|
|
189
|
+
return this._state;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The registered `description` of all still-pending jobs.
|
|
193
|
+
*
|
|
194
|
+
* @returns descriptions as an array.
|
|
195
|
+
*/
|
|
196
|
+
get pending() {
|
|
197
|
+
return Array.from(this.jobs).map(job => job.description);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Whether the manager is accepting new jobs.
|
|
201
|
+
*/
|
|
202
|
+
get isOpen() {
|
|
203
|
+
return this._state === types_1.BackgroundProcessManagerState.Open;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Whether the manager is rejecting new work, but still waiting for
|
|
207
|
+
* submitted work to complete.
|
|
208
|
+
*/
|
|
209
|
+
get isClosing() {
|
|
210
|
+
return this._state === types_1.BackgroundProcessManagerState.Closing;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Whether the manager is rejecting work and done waiting for submitted
|
|
214
|
+
* work to complete.
|
|
215
|
+
*/
|
|
216
|
+
get isClosed() {
|
|
217
|
+
return this._state === types_1.BackgroundProcessManagerState.Closed;
|
|
218
|
+
}
|
|
219
|
+
closedFailure(description) {
|
|
220
|
+
if (!this.isOpen) {
|
|
221
|
+
return Promise.reject(new BackgroundManagerNotOpenError_1.BackgroundManagerNotOpenError([
|
|
222
|
+
`The manager is ${this.state}.`,
|
|
223
|
+
`You tried to add "${description}".`,
|
|
224
|
+
`Pending jobs: [\n${this.pending
|
|
225
|
+
.map(t => ' ' + t)
|
|
226
|
+
.join(',\n')}\n]`,
|
|
227
|
+
].join('\n')));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Signals jobs to stop (for those that accept interruptions) and waits
|
|
232
|
+
* for confirmation that jobs have stopped.
|
|
233
|
+
*
|
|
234
|
+
* This immediately puts the manager into a closing state and just begins
|
|
235
|
+
* to reject new work. After all work in the manager is complete, the
|
|
236
|
+
* manager goes into a `Completed` state and `close()` returns.
|
|
237
|
+
*
|
|
238
|
+
* This call is idempotent.
|
|
239
|
+
*
|
|
240
|
+
* If the manager is already closing or closed, `finalCleaup` is not executed.
|
|
241
|
+
*
|
|
242
|
+
* @param onClosed
|
|
243
|
+
* @returns The settled results of each still-running job's promise. If the
|
|
244
|
+
* manager is already closed, this will contain the results as of when the
|
|
245
|
+
* manager's `close()` was called in an `Open` state.
|
|
246
|
+
*/
|
|
247
|
+
async close() {
|
|
248
|
+
if (this.isOpen) {
|
|
249
|
+
this._state = types_1.BackgroundProcessManagerState.Closing;
|
|
250
|
+
for (const job of Array.from(this.jobs)) {
|
|
251
|
+
try {
|
|
252
|
+
job.terminate();
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
// Due to potential races with a job's natural completion, it's
|
|
256
|
+
// reasonable to expect the termination call to fail. Hence,
|
|
257
|
+
// not logging as an error.
|
|
258
|
+
console.warn(`Failed to send termination signal to job. Error: ${error.message}`, job);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// Use `allSettled()` because we want to wait for all to finish. We do
|
|
262
|
+
// not want to stop waiting if there is a failure.
|
|
263
|
+
this._closingPromise = Promise.allSettled(Array.from(this.jobs).map(j => j.promise));
|
|
264
|
+
await this._closingPromise;
|
|
265
|
+
this._state = types_1.BackgroundProcessManagerState.Closed;
|
|
266
|
+
}
|
|
267
|
+
return this._closingPromise;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Signals the manager to start accepting work (again) and returns once
|
|
271
|
+
* the manager is ready to do so.
|
|
272
|
+
*
|
|
273
|
+
* If the state is already `Open`, this call is a no-op.
|
|
274
|
+
*
|
|
275
|
+
* If the state is `Closed`, this call simply updates state and returns.
|
|
276
|
+
*
|
|
277
|
+
* If the state is `Closing`, this call waits for completion before it
|
|
278
|
+
* updates the state and returns.
|
|
279
|
+
*/
|
|
280
|
+
async open() {
|
|
281
|
+
if (this.isClosing) {
|
|
282
|
+
await this.close();
|
|
283
|
+
}
|
|
284
|
+
this._state = types_1.BackgroundProcessManagerState.Open;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.BackgroundProcessManager = BackgroundProcessManager;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BackgroundProcessManager = void 0;
|
|
6
|
+
var BackgroundProcessManager_1 = require("./BackgroundProcessManager");
|
|
7
|
+
Object.defineProperty(exports, "BackgroundProcessManager", { enumerable: true, get: function () { return BackgroundProcessManager_1.BackgroundProcessManager; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All possible states a `BackgroundProcessManager` instance can be in.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum BackgroundProcessManagerState {
|
|
5
|
+
/**
|
|
6
|
+
* Accepting new jobs.
|
|
7
|
+
*/
|
|
8
|
+
Open = "Open",
|
|
9
|
+
/**
|
|
10
|
+
* Not accepting new jobs. Waiting for submitted jobs to complete.
|
|
11
|
+
*/
|
|
12
|
+
Closing = "Closing",
|
|
13
|
+
/**
|
|
14
|
+
* Not accepting new jobs. All submitted jobs are complete.
|
|
15
|
+
*/
|
|
16
|
+
Closed = "Closed"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Completely internal to `BackgroundProcessManager`, and describes the structure of
|
|
20
|
+
* an entry in the jobs registry.
|
|
21
|
+
*/
|
|
22
|
+
export type JobEntry = {
|
|
23
|
+
/**
|
|
24
|
+
* The underlying promise provided by the job function to wait for.
|
|
25
|
+
*/
|
|
26
|
+
promise: Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* Request the termination of the job.
|
|
29
|
+
*/
|
|
30
|
+
terminate: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* An object provided by the caller that can be used to identify the description
|
|
33
|
+
* of the job, which can otherwise be unclear from the `promise` and
|
|
34
|
+
* `terminate` function. The `description` can be a string. (May be extended
|
|
35
|
+
* later to also support object refs.)
|
|
36
|
+
*
|
|
37
|
+
* Useful for troubleshooting why a manager is waiting for long periods of time
|
|
38
|
+
* on `close()`.
|
|
39
|
+
*/
|
|
40
|
+
description?: string;
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BackgroundProcessManagerState = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* All possible states a `BackgroundProcessManager` instance can be in.
|
|
8
|
+
*/
|
|
9
|
+
var BackgroundProcessManagerState;
|
|
10
|
+
(function (BackgroundProcessManagerState) {
|
|
11
|
+
/**
|
|
12
|
+
* Accepting new jobs.
|
|
13
|
+
*/
|
|
14
|
+
BackgroundProcessManagerState["Open"] = "Open";
|
|
15
|
+
/**
|
|
16
|
+
* Not accepting new jobs. Waiting for submitted jobs to complete.
|
|
17
|
+
*/
|
|
18
|
+
BackgroundProcessManagerState["Closing"] = "Closing";
|
|
19
|
+
/**
|
|
20
|
+
* Not accepting new jobs. All submitted jobs are complete.
|
|
21
|
+
*/
|
|
22
|
+
BackgroundProcessManagerState["Closed"] = "Closed";
|
|
23
|
+
})(BackgroundProcessManagerState = exports.BackgroundProcessManagerState || (exports.BackgroundProcessManagerState = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StorageCacheCommon } from './StorageCacheCommon';
|
|
2
|
+
import { Cache, CacheConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Customized storage based on the SessionStorage or LocalStorage with LRU implemented
|
|
5
|
+
*/
|
|
6
|
+
export declare class StorageCache extends StorageCacheCommon implements Cache {
|
|
7
|
+
storage: Storage;
|
|
8
|
+
/**
|
|
9
|
+
* initialize the cache
|
|
10
|
+
* @param config - the configuration of the cache
|
|
11
|
+
*/
|
|
12
|
+
constructor(config?: CacheConfig);
|
|
13
|
+
protected getAllCacheKeys(options?: {
|
|
14
|
+
omitSizeKey?: boolean;
|
|
15
|
+
}): Promise<string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Return a new instance of cache with customized configuration.
|
|
18
|
+
* @param {Object} config - the customized configuration
|
|
19
|
+
* @return {Object} - the new instance of Cache
|
|
20
|
+
*/
|
|
21
|
+
createInstance(config: CacheConfig): Cache;
|
|
22
|
+
}
|