@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
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
CloudWatchLogsClient,
|
|
6
|
-
CreateLogGroupCommand,
|
|
7
|
-
CreateLogGroupCommandInput,
|
|
8
|
-
CreateLogGroupCommandOutput,
|
|
9
|
-
CreateLogStreamCommand,
|
|
10
|
-
CreateLogStreamCommandInput,
|
|
11
|
-
CreateLogStreamCommandOutput,
|
|
12
|
-
DescribeLogGroupsCommand,
|
|
13
|
-
DescribeLogGroupsCommandInput,
|
|
14
|
-
DescribeLogGroupsCommandOutput,
|
|
15
|
-
DescribeLogStreamsCommand,
|
|
16
|
-
DescribeLogStreamsCommandInput,
|
|
17
|
-
DescribeLogStreamsCommandOutput,
|
|
18
|
-
GetLogEventsCommand,
|
|
19
|
-
GetLogEventsCommandInput,
|
|
20
|
-
GetLogEventsCommandOutput,
|
|
21
|
-
InputLogEvent,
|
|
22
|
-
LogGroup,
|
|
23
|
-
LogStream,
|
|
24
|
-
PutLogEventsCommand,
|
|
25
|
-
PutLogEventsCommandInput,
|
|
26
|
-
PutLogEventsCommandOutput,
|
|
27
|
-
} from '@aws-sdk/client-cloudwatch-logs';
|
|
28
|
-
import {
|
|
29
|
-
AWSCloudWatchProviderOptions,
|
|
30
|
-
CloudWatchDataTracker,
|
|
31
|
-
LoggingProvider,
|
|
32
|
-
} from '../types/types';
|
|
33
|
-
import { Credentials } from '../..';
|
|
34
|
-
import { ConsoleLogger as Logger } from '../Logger';
|
|
35
|
-
import { getAmplifyUserAgentObject } from '../Platform';
|
|
36
|
-
import { parseAWSExports } from '../parseAWSExports';
|
|
37
|
-
import {
|
|
38
|
-
AWS_CLOUDWATCH_BASE_BUFFER_SIZE,
|
|
39
|
-
AWS_CLOUDWATCH_CATEGORY,
|
|
40
|
-
AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE,
|
|
41
|
-
AWS_CLOUDWATCH_MAX_EVENT_SIZE,
|
|
42
|
-
AWS_CLOUDWATCH_PROVIDER_NAME,
|
|
43
|
-
NO_CREDS_ERROR_STRING,
|
|
44
|
-
RETRY_ERROR_CODES,
|
|
45
|
-
} from '../Util/Constants';
|
|
46
|
-
|
|
47
|
-
const logger = new Logger('AWSCloudWatch');
|
|
48
|
-
|
|
49
|
-
class AWSCloudWatchProvider implements LoggingProvider {
|
|
50
|
-
static readonly PROVIDER_NAME = AWS_CLOUDWATCH_PROVIDER_NAME;
|
|
51
|
-
static readonly CATEGORY = AWS_CLOUDWATCH_CATEGORY;
|
|
52
|
-
|
|
53
|
-
private _config: AWSCloudWatchProviderOptions;
|
|
54
|
-
private _dataTracker: CloudWatchDataTracker;
|
|
55
|
-
private _currentLogBatch: InputLogEvent[];
|
|
56
|
-
private _timer;
|
|
57
|
-
private _nextSequenceToken: string | undefined;
|
|
58
|
-
|
|
59
|
-
constructor(config?: AWSCloudWatchProviderOptions) {
|
|
60
|
-
this.configure(config);
|
|
61
|
-
this._dataTracker = {
|
|
62
|
-
eventUploadInProgress: false,
|
|
63
|
-
logEvents: [],
|
|
64
|
-
};
|
|
65
|
-
this._currentLogBatch = [];
|
|
66
|
-
this._initiateLogPushInterval();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public getProviderName(): string {
|
|
70
|
-
return AWSCloudWatchProvider.PROVIDER_NAME;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public getCategoryName(): string {
|
|
74
|
-
return AWSCloudWatchProvider.CATEGORY;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public getLogQueue(): InputLogEvent[] {
|
|
78
|
-
return this._dataTracker.logEvents;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public configure(
|
|
82
|
-
config?: AWSCloudWatchProviderOptions
|
|
83
|
-
): AWSCloudWatchProviderOptions {
|
|
84
|
-
if (!config) return this._config || {};
|
|
85
|
-
|
|
86
|
-
const conf = Object.assign(
|
|
87
|
-
{},
|
|
88
|
-
this._config,
|
|
89
|
-
parseAWSExports(config).Logging,
|
|
90
|
-
config
|
|
91
|
-
);
|
|
92
|
-
this._config = conf;
|
|
93
|
-
|
|
94
|
-
return this._config;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public async createLogGroup(
|
|
98
|
-
params: CreateLogGroupCommandInput
|
|
99
|
-
): Promise<CreateLogGroupCommandOutput> {
|
|
100
|
-
logger.debug(
|
|
101
|
-
'creating new log group in CloudWatch - ',
|
|
102
|
-
params.logGroupName
|
|
103
|
-
);
|
|
104
|
-
const cmd = new CreateLogGroupCommand(params);
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const credentialsOK = await this._ensureCredentials();
|
|
108
|
-
if (!credentialsOK) {
|
|
109
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const client = this._initCloudWatchLogs();
|
|
113
|
-
const output = await client.send(cmd);
|
|
114
|
-
return output;
|
|
115
|
-
} catch (error) {
|
|
116
|
-
logger.error(`error creating log group - ${error}`);
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public async getLogGroups(
|
|
122
|
-
params: DescribeLogGroupsCommandInput
|
|
123
|
-
): Promise<DescribeLogGroupsCommandOutput> {
|
|
124
|
-
logger.debug('getting list of log groups');
|
|
125
|
-
|
|
126
|
-
const cmd = new DescribeLogGroupsCommand(params);
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
const credentialsOK = await this._ensureCredentials();
|
|
130
|
-
if (!credentialsOK) {
|
|
131
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const client = this._initCloudWatchLogs();
|
|
135
|
-
const output = await client.send(cmd);
|
|
136
|
-
return output;
|
|
137
|
-
} catch (error) {
|
|
138
|
-
logger.error(`error getting log group - ${error}`);
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public async createLogStream(
|
|
144
|
-
params: CreateLogStreamCommandInput
|
|
145
|
-
): Promise<CreateLogStreamCommandOutput> {
|
|
146
|
-
logger.debug(
|
|
147
|
-
'creating new log stream in CloudWatch - ',
|
|
148
|
-
params.logStreamName
|
|
149
|
-
);
|
|
150
|
-
const cmd = new CreateLogStreamCommand(params);
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
const credentialsOK = await this._ensureCredentials();
|
|
154
|
-
if (!credentialsOK) {
|
|
155
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const client = this._initCloudWatchLogs();
|
|
159
|
-
const output = await client.send(cmd);
|
|
160
|
-
return output;
|
|
161
|
-
} catch (error) {
|
|
162
|
-
logger.error(`error creating log stream - ${error}`);
|
|
163
|
-
throw error;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
public async getLogStreams(
|
|
168
|
-
params: DescribeLogStreamsCommandInput
|
|
169
|
-
): Promise<DescribeLogStreamsCommandOutput> {
|
|
170
|
-
logger.debug('getting list of log streams');
|
|
171
|
-
const cmd = new DescribeLogStreamsCommand(params);
|
|
172
|
-
|
|
173
|
-
try {
|
|
174
|
-
const credentialsOK = await this._ensureCredentials();
|
|
175
|
-
if (!credentialsOK) {
|
|
176
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const client = this._initCloudWatchLogs();
|
|
180
|
-
const output = await client.send(cmd);
|
|
181
|
-
return output;
|
|
182
|
-
} catch (error) {
|
|
183
|
-
logger.error(`error getting log stream - ${error}`);
|
|
184
|
-
throw error;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public async getLogEvents(
|
|
189
|
-
params: GetLogEventsCommandInput
|
|
190
|
-
): Promise<GetLogEventsCommandOutput> {
|
|
191
|
-
logger.debug('getting log events from stream - ', params.logStreamName);
|
|
192
|
-
const cmd = new GetLogEventsCommand(params);
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
const credentialsOK = await this._ensureCredentials();
|
|
196
|
-
if (!credentialsOK) {
|
|
197
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const client = this._initCloudWatchLogs();
|
|
201
|
-
const output = await client.send(cmd);
|
|
202
|
-
return output;
|
|
203
|
-
} catch (error) {
|
|
204
|
-
logger.error(`error getting log events - ${error}`);
|
|
205
|
-
throw error;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public pushLogs(logs: InputLogEvent[]): void {
|
|
210
|
-
logger.debug('pushing log events to Cloudwatch...');
|
|
211
|
-
this._dataTracker.logEvents = [...this._dataTracker.logEvents, ...logs];
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
private async _validateLogGroupExistsAndCreate(
|
|
215
|
-
logGroupName: string
|
|
216
|
-
): Promise<LogGroup> {
|
|
217
|
-
if (this._dataTracker.verifiedLogGroup) {
|
|
218
|
-
return this._dataTracker.verifiedLogGroup;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
const credentialsOK = await this._ensureCredentials();
|
|
223
|
-
if (!credentialsOK) {
|
|
224
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const currGroups = await this.getLogGroups({
|
|
228
|
-
logGroupNamePrefix: logGroupName,
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
if (!(typeof currGroups === 'string') && currGroups.logGroups) {
|
|
232
|
-
const foundGroups = currGroups.logGroups.filter(
|
|
233
|
-
group => group.logGroupName === logGroupName
|
|
234
|
-
);
|
|
235
|
-
if (foundGroups.length > 0) {
|
|
236
|
-
this._dataTracker.verifiedLogGroup = foundGroups[0];
|
|
237
|
-
|
|
238
|
-
return foundGroups[0];
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* If we get to this point, it means that the specified log group does not exist
|
|
244
|
-
* and we should create it.
|
|
245
|
-
*/
|
|
246
|
-
await this.createLogGroup({ logGroupName });
|
|
247
|
-
|
|
248
|
-
return null;
|
|
249
|
-
} catch (err) {
|
|
250
|
-
const errString = `failure during log group search: ${err}`;
|
|
251
|
-
logger.error(errString);
|
|
252
|
-
throw err;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
private async _validateLogStreamExists(
|
|
257
|
-
logGroupName: string,
|
|
258
|
-
logStreamName: string
|
|
259
|
-
): Promise<LogStream> {
|
|
260
|
-
try {
|
|
261
|
-
const credentialsOK = await this._ensureCredentials();
|
|
262
|
-
if (!credentialsOK) {
|
|
263
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const currStreams = await this.getLogStreams({
|
|
267
|
-
logGroupName,
|
|
268
|
-
logStreamNamePrefix: logStreamName,
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
if (currStreams.logStreams) {
|
|
272
|
-
const foundStreams = currStreams.logStreams.filter(
|
|
273
|
-
stream => stream.logStreamName === logStreamName
|
|
274
|
-
);
|
|
275
|
-
if (foundStreams.length > 0) {
|
|
276
|
-
this._nextSequenceToken = foundStreams[0].uploadSequenceToken;
|
|
277
|
-
|
|
278
|
-
return foundStreams[0];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* If we get to this point, it means that the specified stream does not
|
|
284
|
-
* exist, and we should create it now.
|
|
285
|
-
*/
|
|
286
|
-
await this.createLogStream({
|
|
287
|
-
logGroupName,
|
|
288
|
-
logStreamName,
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
return null;
|
|
292
|
-
} catch (err) {
|
|
293
|
-
const errString = `failure during log stream search: ${err}`;
|
|
294
|
-
logger.error(errString);
|
|
295
|
-
throw err;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
private async _sendLogEvents(
|
|
300
|
-
params: PutLogEventsCommandInput
|
|
301
|
-
): Promise<PutLogEventsCommandOutput> {
|
|
302
|
-
try {
|
|
303
|
-
const credentialsOK = await this._ensureCredentials();
|
|
304
|
-
if (!credentialsOK) {
|
|
305
|
-
throw new Error(NO_CREDS_ERROR_STRING);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
logger.debug('sending log events to stream - ', params.logStreamName);
|
|
309
|
-
const cmd = new PutLogEventsCommand(params);
|
|
310
|
-
const client = this._initCloudWatchLogs();
|
|
311
|
-
const output = await client.send(cmd);
|
|
312
|
-
|
|
313
|
-
return output;
|
|
314
|
-
} catch (err) {
|
|
315
|
-
const errString = `failure during log push: ${err}`;
|
|
316
|
-
logger.error(errString);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
private _initCloudWatchLogs() {
|
|
321
|
-
return new CloudWatchLogsClient({
|
|
322
|
-
region: this._config.region,
|
|
323
|
-
credentials: this._config.credentials,
|
|
324
|
-
customUserAgent: getAmplifyUserAgentObject(),
|
|
325
|
-
endpoint: this._config.endpoint,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
private async _ensureCredentials() {
|
|
330
|
-
return await Credentials.get()
|
|
331
|
-
.then(credentials => {
|
|
332
|
-
if (!credentials) return false;
|
|
333
|
-
const cred = Credentials.shear(credentials);
|
|
334
|
-
logger.debug('set credentials for logging', cred);
|
|
335
|
-
this._config.credentials = cred;
|
|
336
|
-
|
|
337
|
-
return true;
|
|
338
|
-
})
|
|
339
|
-
.catch(error => {
|
|
340
|
-
logger.warn('ensure credentials error', error);
|
|
341
|
-
return false;
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
private async _getNextSequenceToken(): Promise<string> {
|
|
346
|
-
if (this._nextSequenceToken && this._nextSequenceToken.length > 0) {
|
|
347
|
-
return this._nextSequenceToken;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* A sequence token will not exist if any of the following are true:
|
|
352
|
-
* ...the log group does not exist
|
|
353
|
-
* ...the log stream does not exist
|
|
354
|
-
* ...the log stream does exist but has no logs written to it yet
|
|
355
|
-
*/
|
|
356
|
-
try {
|
|
357
|
-
await this._validateLogGroupExistsAndCreate(this._config.logGroupName);
|
|
358
|
-
|
|
359
|
-
this._nextSequenceToken = undefined;
|
|
360
|
-
|
|
361
|
-
const logStream = await this._validateLogStreamExists(
|
|
362
|
-
this._config.logGroupName,
|
|
363
|
-
this._config.logStreamName
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
if (logStream) {
|
|
367
|
-
this._nextSequenceToken = logStream.uploadSequenceToken;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return this._nextSequenceToken;
|
|
371
|
-
} catch (err) {
|
|
372
|
-
logger.error(`failure while getting next sequence token: ${err}`);
|
|
373
|
-
throw err;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
private async _safeUploadLogEvents(): Promise<PutLogEventsCommandOutput> {
|
|
378
|
-
try {
|
|
379
|
-
/**
|
|
380
|
-
* CloudWatch has restrictions on the size of the log events that get sent up.
|
|
381
|
-
* We need to track both the size of each event and the total size of the batch
|
|
382
|
-
* of logs.
|
|
383
|
-
*
|
|
384
|
-
* We also need to ensure that the logs in the batch are sorted in chronological order.
|
|
385
|
-
* https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
|
|
386
|
-
*/
|
|
387
|
-
const seqToken = await this._getNextSequenceToken();
|
|
388
|
-
const logBatch =
|
|
389
|
-
this._currentLogBatch.length === 0
|
|
390
|
-
? this._getBufferedBatchOfLogs()
|
|
391
|
-
: this._currentLogBatch;
|
|
392
|
-
|
|
393
|
-
const putLogsPayload: PutLogEventsCommandInput = {
|
|
394
|
-
logGroupName: this._config.logGroupName,
|
|
395
|
-
logStreamName: this._config.logStreamName,
|
|
396
|
-
logEvents: logBatch,
|
|
397
|
-
sequenceToken: seqToken,
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
this._dataTracker.eventUploadInProgress = true;
|
|
401
|
-
const sendLogEventsResponse = await this._sendLogEvents(putLogsPayload);
|
|
402
|
-
|
|
403
|
-
this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
|
|
404
|
-
this._dataTracker.eventUploadInProgress = false;
|
|
405
|
-
this._currentLogBatch = [];
|
|
406
|
-
|
|
407
|
-
return sendLogEventsResponse;
|
|
408
|
-
} catch (err) {
|
|
409
|
-
logger.error(`error during _safeUploadLogEvents: ${err}`);
|
|
410
|
-
|
|
411
|
-
if (RETRY_ERROR_CODES.includes(err.name)) {
|
|
412
|
-
this._getNewSequenceTokenAndSubmit({
|
|
413
|
-
logEvents: this._currentLogBatch,
|
|
414
|
-
logGroupName: this._config.logGroupName,
|
|
415
|
-
logStreamName: this._config.logStreamName,
|
|
416
|
-
});
|
|
417
|
-
} else {
|
|
418
|
-
this._dataTracker.eventUploadInProgress = false;
|
|
419
|
-
throw err;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
private _getBufferedBatchOfLogs(): InputLogEvent[] {
|
|
425
|
-
/**
|
|
426
|
-
* CloudWatch has restrictions on the size of the log events that get sent up.
|
|
427
|
-
* We need to track both the size of each event and the total size of the batch
|
|
428
|
-
* of logs.
|
|
429
|
-
*
|
|
430
|
-
* We also need to ensure that the logs in the batch are sorted in chronological order.
|
|
431
|
-
* https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
|
|
432
|
-
*/
|
|
433
|
-
let currentEventIdx = 0;
|
|
434
|
-
let totalByteSize = 0;
|
|
435
|
-
|
|
436
|
-
while (currentEventIdx < this._dataTracker.logEvents.length) {
|
|
437
|
-
const currentEvent = this._dataTracker.logEvents[currentEventIdx];
|
|
438
|
-
const eventSize = currentEvent
|
|
439
|
-
? new TextEncoder().encode(currentEvent.message).length +
|
|
440
|
-
AWS_CLOUDWATCH_BASE_BUFFER_SIZE
|
|
441
|
-
: 0;
|
|
442
|
-
if (eventSize > AWS_CLOUDWATCH_MAX_EVENT_SIZE) {
|
|
443
|
-
const errString = `Log entry exceeds maximum size for CloudWatch logs. Log size: ${eventSize}. Truncating log message.`;
|
|
444
|
-
logger.warn(errString);
|
|
445
|
-
|
|
446
|
-
currentEvent.message = currentEvent.message.substring(0, eventSize);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (totalByteSize + eventSize > AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE)
|
|
450
|
-
break;
|
|
451
|
-
totalByteSize += eventSize;
|
|
452
|
-
currentEventIdx++;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
this._currentLogBatch = this._dataTracker.logEvents.splice(
|
|
456
|
-
0,
|
|
457
|
-
currentEventIdx
|
|
458
|
-
);
|
|
459
|
-
|
|
460
|
-
return this._currentLogBatch;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
private async _getNewSequenceTokenAndSubmit(
|
|
464
|
-
payload: PutLogEventsCommandInput
|
|
465
|
-
): Promise<PutLogEventsCommandOutput> {
|
|
466
|
-
try {
|
|
467
|
-
this._nextSequenceToken = undefined;
|
|
468
|
-
this._dataTracker.eventUploadInProgress = true;
|
|
469
|
-
|
|
470
|
-
const seqToken = await this._getNextSequenceToken();
|
|
471
|
-
payload.sequenceToken = seqToken;
|
|
472
|
-
const sendLogEventsRepsonse = await this._sendLogEvents(payload);
|
|
473
|
-
|
|
474
|
-
this._dataTracker.eventUploadInProgress = false;
|
|
475
|
-
this._currentLogBatch = [];
|
|
476
|
-
|
|
477
|
-
return sendLogEventsRepsonse;
|
|
478
|
-
} catch (err) {
|
|
479
|
-
logger.error(
|
|
480
|
-
`error when retrying log submission with new sequence token: ${err}`
|
|
481
|
-
);
|
|
482
|
-
this._dataTracker.eventUploadInProgress = false;
|
|
483
|
-
|
|
484
|
-
throw err;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
private _initiateLogPushInterval(): void {
|
|
489
|
-
if (this._timer) {
|
|
490
|
-
clearInterval(this._timer);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
this._timer = setInterval(async () => {
|
|
494
|
-
try {
|
|
495
|
-
if (this._getDocUploadPermissibility()) {
|
|
496
|
-
await this._safeUploadLogEvents();
|
|
497
|
-
}
|
|
498
|
-
} catch (err) {
|
|
499
|
-
logger.error(
|
|
500
|
-
`error when calling _safeUploadLogEvents in the timer interval - ${err}`
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
}, 2000);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
private _getDocUploadPermissibility(): boolean {
|
|
507
|
-
return (
|
|
508
|
-
(this._dataTracker.logEvents.length !== 0 ||
|
|
509
|
-
this._currentLogBatch.length !== 0) &&
|
|
510
|
-
!this._dataTracker.eventUploadInProgress
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
export { AWSCloudWatchProvider };
|
package/src/Providers/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { browserOrNode } from '../JS';
|
|
5
|
-
import { StorageHelper } from '../StorageHelper';
|
|
6
|
-
|
|
7
|
-
export const Linking = {};
|
|
8
|
-
export const AppState = {
|
|
9
|
-
addEventListener: (action, handler) => undefined,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// if not in react native, just use local storage
|
|
13
|
-
export const AsyncStorage = browserOrNode().isBrowser
|
|
14
|
-
? new StorageHelper().getStorage()
|
|
15
|
-
: undefined;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Linking, AppState } from 'react-native';
|
|
5
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
-
export { Linking, AppState, AsyncStorage };
|
package/src/Signer.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { DateUtils } from './Util';
|
|
5
|
-
import {
|
|
6
|
-
presignUrl,
|
|
7
|
-
signRequest,
|
|
8
|
-
TOKEN_QUERY_PARAM,
|
|
9
|
-
} from './clients/middleware/signing/signer/signatureV4';
|
|
10
|
-
|
|
11
|
-
const IOT_SERVICE_NAME = 'iotdevicegateway';
|
|
12
|
-
// Best practice regex to parse the service and region from an AWS endpoint
|
|
13
|
-
const AWS_ENDPOINT_REGEX = /([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(.cn)?$/;
|
|
14
|
-
|
|
15
|
-
export class Signer {
|
|
16
|
-
/**
|
|
17
|
-
* Sign a HTTP request, add 'Authorization' header to request param
|
|
18
|
-
* @method sign
|
|
19
|
-
* @memberof Signer
|
|
20
|
-
* @static
|
|
21
|
-
*
|
|
22
|
-
* @param {object} request - HTTP request object
|
|
23
|
-
<pre>
|
|
24
|
-
request: {
|
|
25
|
-
method: GET | POST | PUT ...
|
|
26
|
-
url: ...,
|
|
27
|
-
headers: {
|
|
28
|
-
header1: ...
|
|
29
|
-
},
|
|
30
|
-
data: data
|
|
31
|
-
}
|
|
32
|
-
</pre>
|
|
33
|
-
* @param {object} access_info - AWS access credential info
|
|
34
|
-
<pre>
|
|
35
|
-
access_info: {
|
|
36
|
-
access_key: ...,
|
|
37
|
-
secret_key: ...,
|
|
38
|
-
session_token: ...
|
|
39
|
-
}
|
|
40
|
-
</pre>
|
|
41
|
-
* @param {object} [service_info] - AWS service type and region, optional,
|
|
42
|
-
* if not provided then parse out from url
|
|
43
|
-
<pre>
|
|
44
|
-
service_info: {
|
|
45
|
-
service: ...,
|
|
46
|
-
region: ...
|
|
47
|
-
}
|
|
48
|
-
</pre>
|
|
49
|
-
*
|
|
50
|
-
* @returns {object} Signed HTTP request
|
|
51
|
-
*/
|
|
52
|
-
static sign(request, accessInfo, serviceInfo) {
|
|
53
|
-
request.headers = request.headers || {};
|
|
54
|
-
|
|
55
|
-
if (request.body && !request.data) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
'The attribute "body" was found on the request object. Please use the attribute "data" instead.'
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const requestToSign = {
|
|
62
|
-
...request,
|
|
63
|
-
body: request.data,
|
|
64
|
-
url: new URL(request.url as string),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const options = getOptions(requestToSign, accessInfo, serviceInfo);
|
|
68
|
-
const signedRequest: any = signRequest(requestToSign, options);
|
|
69
|
-
// Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property
|
|
70
|
-
// back to a string so as not to disrupt consumers of Signer.
|
|
71
|
-
signedRequest.url = signedRequest.url.toString();
|
|
72
|
-
// HTTP headers should be case insensitive but, to maintain parity with the previous Signer implementation and
|
|
73
|
-
// limit the impact of this implementation swap, replace lowercased headers with title cased ones.
|
|
74
|
-
signedRequest.headers.Authorization = signedRequest.headers.authorization;
|
|
75
|
-
signedRequest.headers['X-Amz-Security-Token'] =
|
|
76
|
-
signedRequest.headers['x-amz-security-token'];
|
|
77
|
-
delete signedRequest.headers.authorization;
|
|
78
|
-
delete signedRequest.headers['x-amz-security-token'];
|
|
79
|
-
return signedRequest;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
static signUrl(
|
|
83
|
-
urlToSign: string,
|
|
84
|
-
accessInfo: any,
|
|
85
|
-
serviceInfo?: any,
|
|
86
|
-
expiration?: number
|
|
87
|
-
): string;
|
|
88
|
-
static signUrl(
|
|
89
|
-
request: any,
|
|
90
|
-
accessInfo: any,
|
|
91
|
-
serviceInfo?: any,
|
|
92
|
-
expiration?: number
|
|
93
|
-
): string;
|
|
94
|
-
static signUrl(
|
|
95
|
-
urlOrRequest: string | any,
|
|
96
|
-
accessInfo: any,
|
|
97
|
-
serviceInfo?: any,
|
|
98
|
-
expiration?: number
|
|
99
|
-
): string {
|
|
100
|
-
const urlToSign: string =
|
|
101
|
-
typeof urlOrRequest === 'object' ? urlOrRequest.url : urlOrRequest;
|
|
102
|
-
const method: string =
|
|
103
|
-
typeof urlOrRequest === 'object' ? urlOrRequest.method : 'GET';
|
|
104
|
-
const body: any =
|
|
105
|
-
typeof urlOrRequest === 'object' ? urlOrRequest.body : undefined;
|
|
106
|
-
|
|
107
|
-
const presignable = {
|
|
108
|
-
body,
|
|
109
|
-
method,
|
|
110
|
-
url: new URL(urlToSign),
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const options = getOptions(
|
|
114
|
-
presignable,
|
|
115
|
-
accessInfo,
|
|
116
|
-
serviceInfo,
|
|
117
|
-
expiration
|
|
118
|
-
);
|
|
119
|
-
const signedUrl = presignUrl(presignable, options);
|
|
120
|
-
if (
|
|
121
|
-
accessInfo.session_token &&
|
|
122
|
-
!sessionTokenRequiredInSigning(options.signingService)
|
|
123
|
-
) {
|
|
124
|
-
signedUrl.searchParams.append(
|
|
125
|
-
TOKEN_QUERY_PARAM,
|
|
126
|
-
accessInfo.session_token
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
return signedUrl.toString();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const getOptions = (request, accessInfo, serviceInfo, expiration?) => {
|
|
134
|
-
const { access_key, secret_key, session_token } = accessInfo ?? {};
|
|
135
|
-
const { region: urlRegion, service: urlService } = parseServiceInfo(
|
|
136
|
-
request.url
|
|
137
|
-
);
|
|
138
|
-
const { region = urlRegion, service = urlService } = serviceInfo ?? {};
|
|
139
|
-
const credentials = {
|
|
140
|
-
accessKeyId: access_key,
|
|
141
|
-
secretAccessKey: secret_key,
|
|
142
|
-
...(sessionTokenRequiredInSigning(service)
|
|
143
|
-
? { sessionToken: session_token }
|
|
144
|
-
: {}),
|
|
145
|
-
};
|
|
146
|
-
return {
|
|
147
|
-
credentials,
|
|
148
|
-
signingDate: DateUtils.getDateWithClockOffset(),
|
|
149
|
-
signingRegion: region,
|
|
150
|
-
signingService: service,
|
|
151
|
-
...(expiration && { expiration }),
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// TODO: V6 investigate whether add to custom clients' general signer implementation.
|
|
156
|
-
const parseServiceInfo = (url: URL) => {
|
|
157
|
-
const host = url.host;
|
|
158
|
-
const matched = host.match(AWS_ENDPOINT_REGEX) ?? [];
|
|
159
|
-
let parsed = matched.slice(1, 3);
|
|
160
|
-
|
|
161
|
-
if (parsed[1] === 'es') {
|
|
162
|
-
// Elastic Search
|
|
163
|
-
parsed = parsed.reverse();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
service: parsed[0],
|
|
168
|
-
region: parsed[1],
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// IoT service does not allow the session token in the canonical request
|
|
173
|
-
// https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html
|
|
174
|
-
// TODO: V6 investigate whether add to custom clients' general signer implementation.
|
|
175
|
-
const sessionTokenRequiredInSigning = (service: string) =>
|
|
176
|
-
service !== IOT_SERVICE_NAME;
|