@aws-amplify/core 6.0.1-preview-testing.be90020.0 → 6.0.1-ssr-api.df60e41.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/internals/aws-clients/pinpoint/package.json +4 -4
- package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
- package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +11 -0
- package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
- 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 +14 -31
- package/lib/Cache/StorageCache.js +41 -106
- package/lib/Cache/StorageCache.native.d.ts +19 -0
- package/lib/Cache/StorageCache.native.js +62 -0
- package/lib/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- 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 -1
- package/lib/Cache/types/index.js +1 -1
- package/lib/Cache/{Utils → utils}/CacheList.d.ts +1 -1
- 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 +7 -0
- package/lib/Hub/index.js +44 -77
- package/lib/Hub/types/AuthTypes.d.ts +19 -0
- package/lib/I18n/I18n.d.ts +3 -19
- package/lib/I18n/I18n.js +25 -60
- package/lib/I18n/errorHelpers.d.ts +5 -0
- package/lib/I18n/errorHelpers.js +16 -0
- package/lib/I18n/index.d.ts +3 -15
- package/lib/I18n/index.js +28 -56
- package/lib/I18n/types.d.ts +1 -4
- package/lib/I18n/types.js +5 -9
- package/lib/Logger/ConsoleLogger.js +54 -130
- package/{lib-esm/Util → lib/Mutex}/Mutex.d.ts +2 -15
- package/lib/{Util → Mutex}/Mutex.js +17 -20
- 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/Platform/customUserAgent.d.ts +16 -0
- package/lib/Platform/customUserAgent.js +57 -0
- package/lib/Platform/detectFramework.js +12 -13
- package/lib/Platform/detection/Angular.js +4 -5
- package/lib/Platform/detection/Expo.js +1 -1
- package/lib/Platform/detection/Next.js +1 -1
- package/lib/Platform/detection/Nuxt.js +1 -1
- package/lib/Platform/detection/React.js +5 -5
- package/lib/Platform/detection/Svelte.js +2 -2
- package/lib/Platform/detection/Vue.js +1 -1
- package/lib/Platform/detection/Web.js +1 -1
- package/lib/Platform/detection/helpers.js +7 -7
- package/lib/Platform/detection/index.js +13 -13
- package/lib/Platform/index.js +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/{Util → Reachability}/Reachability.native.js +14 -20
- 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.js +86 -112
- 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/{Util → Signer}/DateUtils.js +10 -27
- package/lib/{Signer.js → Signer/Signer.js} +50 -52
- package/lib/Signer/index.d.ts +1 -0
- package/lib/Signer/index.js +7 -0
- package/lib/adapterCore/error/AmplifyServerContextError.d.ts +1 -1
- package/lib/adapterCore/error/AmplifyServerContextError.js +9 -27
- package/lib/adapterCore/serverContext/serverContext.js +8 -8
- package/lib/adapterCore/serverContext/serverContextRegistry.js +6 -6
- package/lib/awsClients/cognitoIdentity/base.js +67 -0
- package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
- package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.js +39 -0
- package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
- package/lib/awsClients/cognitoIdentity/getId.js +30 -0
- package/lib/awsClients/cognitoIdentity/types.js +4 -0
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +12 -14
- package/lib/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib/awsClients/pinpoint/errorHelpers.js +16 -0
- package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
- package/lib/awsClients/pinpoint/getInAppMessages.js +34 -0
- package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/putEvents.d.ts +4 -3
- package/lib/awsClients/pinpoint/putEvents.js +37 -0
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
- package/lib/awsClients/pinpoint/updateEndpoint.js +38 -0
- package/lib/clients/endpoints/getDnsSuffix.js +7 -29
- package/lib/clients/handlers/authenticated.js +5 -5
- package/lib/clients/handlers/fetch.js +41 -97
- package/lib/clients/handlers/unauthenticated.js +4 -4
- package/lib/clients/internal/composeServiceApi.js +17 -67
- package/lib/clients/internal/composeTransferHandler.js +9 -11
- package/lib/clients/middleware/retry/defaultRetryDecider.js +18 -75
- package/lib/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib/clients/middleware/retry/jitteredBackoff.js +5 -5
- package/lib/clients/middleware/retry/middleware.js +61 -125
- package/lib/clients/middleware/signing/middleware.js +24 -86
- package/lib/clients/middleware/signing/signer/signatureV4/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/http.d.ts +17 -1
- package/lib/clients/utils/memoization.js +3 -3
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +18 -0
- package/lib/{Util/Errors.d.ts → errors/AmplifyError.d.ts} +2 -9
- 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 +7 -7
- package/lib/index.js +17 -16
- package/lib/libraryUtils.d.ts +20 -16
- package/lib/libraryUtils.js +60 -69
- package/lib/parseAWSExports.js +172 -35
- 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 +1 -0
- package/lib/providers/pinpoint/apis/index.js +3 -1
- package/lib/providers/pinpoint/apis/record.d.ts +1 -1
- package/lib/providers/pinpoint/apis/record.js +58 -109
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
- package/lib/providers/pinpoint/apis/updateEndpoint.js +65 -110
- package/lib/providers/pinpoint/index.d.ts +2 -1
- package/lib/providers/pinpoint/index.js +5 -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 +1 -0
- package/lib/providers/pinpoint/types/index.js +3 -0
- package/lib/providers/pinpoint/types/pinpoint.d.ts +7 -4
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +111 -197
- package/lib/providers/pinpoint/utils/cacheEndpointId.js +12 -49
- package/lib/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib/providers/pinpoint/utils/getEndpointId.js +7 -51
- package/lib/providers/pinpoint/utils/getEventBuffer.js +19 -21
- package/lib/providers/pinpoint/utils/index.d.ts +1 -0
- package/lib/providers/pinpoint/utils/index.js +3 -1
- package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
- package/lib/{RNComponents → providers/pinpoint/utils}/isAppInForeground.js +1 -4
- 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/singleton/API/types.d.ts +73 -0
- package/lib/singleton/API/types.js +2 -0
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +34 -93
- package/lib/singleton/Analytics/types.d.ts +4 -1
- package/lib/singleton/Auth/index.js +48 -115
- package/lib/singleton/Auth/types.d.ts +31 -4
- 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 +1 -1
- package/lib/singleton/Auth/utils/index.js +30 -46
- 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/apis/clearCredentials.js +1 -1
- package/lib/singleton/apis/fetchAuthSession.js +3 -3
- package/lib/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib/singleton/apis/server/fetchAuthSession.js +3 -3
- package/lib/singleton/types.d.ts +12 -1
- package/{lib-esm/StorageHelper/cookieStorage.d.ts → lib/storage/CookieStorage.d.ts} +4 -3
- 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-esm/StorageHelper/localStorage.d.ts → lib/storage/DefaultStorage.native.d.ts} +6 -5
- 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/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- 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 +4 -1
- package/lib/types/errors.d.ts +9 -3
- package/lib/types/errors.js +7 -0
- package/lib/types/storage.d.ts +3 -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/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/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
- package/lib/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +9 -9
- package/{lib-esm/ClientDevice/browser.d.ts → lib/utils/getClientInfo/getClientInfo.d.ts} +1 -9
- package/lib/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
- package/lib/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +14 -14
- 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/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
- 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 +14 -31
- package/lib-esm/Cache/StorageCache.js +40 -106
- package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
- package/lib-esm/Cache/StorageCache.native.js +58 -0
- package/lib-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- 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 -1
- package/lib-esm/Cache/types/index.js +1 -1
- package/lib-esm/Cache/{Utils → utils}/CacheList.d.ts +1 -1
- package/lib-esm/Cache/{Utils → utils}/CacheList.js +46 -84
- 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 +7 -0
- package/lib-esm/Hub/index.js +42 -76
- package/lib-esm/Hub/types/AuthTypes.d.ts +19 -0
- package/lib-esm/I18n/I18n.d.ts +3 -19
- package/lib-esm/I18n/I18n.js +24 -60
- package/lib-esm/I18n/errorHelpers.d.ts +5 -0
- package/lib-esm/I18n/errorHelpers.js +13 -0
- package/lib-esm/I18n/index.d.ts +3 -15
- package/lib-esm/I18n/index.js +26 -55
- package/lib-esm/I18n/types.d.ts +1 -4
- package/lib-esm/I18n/types.js +3 -8
- package/lib-esm/Logger/ConsoleLogger.js +53 -129
- package/{lib/Util → lib-esm/Mutex}/Mutex.d.ts +2 -15
- package/lib-esm/{Util → Mutex}/Mutex.js +15 -20
- 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/Platform/customUserAgent.d.ts +16 -0
- package/lib-esm/Platform/customUserAgent.js +52 -0
- package/lib-esm/Platform/detectFramework.js +11 -12
- package/lib-esm/Platform/detection/Angular.js +3 -4
- package/lib-esm/Platform/detection/React.js +4 -4
- package/lib-esm/Platform/detection/Svelte.js +1 -1
- package/lib-esm/Platform/detection/helpers.js +7 -7
- package/lib-esm/Platform/detection/index.js +3 -3
- package/lib-esm/Platform/index.js +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/{Util → Reachability}/Reachability.native.js +11 -16
- 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.js +78 -105
- 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/{Util → Signer}/DateUtils.js +11 -28
- package/lib-esm/Signer/Signer.js +124 -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 +1 -1
- package/lib-esm/adapterCore/error/AmplifyServerContextError.js +9 -28
- package/lib-esm/adapterCore/serverContext/serverContext.js +6 -6
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +7 -7
- package/lib-esm/awsClients/cognitoIdentity/base.js +62 -0
- package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
- package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.js +36 -0
- package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
- package/lib-esm/awsClients/cognitoIdentity/getId.js +27 -0
- package/lib-esm/awsClients/cognitoIdentity/types.js +3 -0
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +9 -11
- package/lib-esm/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib-esm/awsClients/pinpoint/errorHelpers.js +13 -0
- package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
- package/lib-esm/awsClients/pinpoint/getInAppMessages.js +31 -0
- package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/putEvents.d.ts +4 -3
- package/lib-esm/awsClients/pinpoint/putEvents.js +34 -0
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
- 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.js +1 -1
- package/lib-esm/clients/handlers/fetch.js +40 -96
- package/lib-esm/clients/handlers/unauthenticated.js +1 -1
- package/lib-esm/clients/internal/composeServiceApi.js +17 -67
- package/lib-esm/clients/internal/composeTransferHandler.js +9 -11
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -74
- package/lib-esm/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +5 -5
- 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/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 +5 -5
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +8 -12
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +5 -9
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +5 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +6 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +13 -14
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
- package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +1 -1
- package/lib-esm/clients/middleware/signing/utils/isClockSkewed.js +3 -5
- package/lib-esm/clients/middleware/userAgent/middleware.js +14 -63
- package/lib-esm/clients/serde/json.js +29 -95
- package/lib-esm/clients/serde/responseInfo.js +11 -17
- package/lib-esm/clients/types/http.d.ts +17 -1
- package/lib-esm/clients/utils/memoization.js +3 -3
- package/lib-esm/constants.d.ts +4 -0
- package/lib-esm/constants.js +15 -0
- package/lib-esm/{Util/Errors.d.ts → errors/AmplifyError.d.ts} +2 -9
- 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 +7 -7
- package/lib-esm/index.js +7 -6
- package/lib-esm/libraryUtils.d.ts +20 -16
- package/lib-esm/libraryUtils.js +21 -18
- package/lib-esm/parseAWSExports.js +171 -34
- 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 +1 -0
- package/lib-esm/providers/pinpoint/apis/index.js +1 -0
- package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/record.js +56 -107
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +64 -109
- package/lib-esm/providers/pinpoint/index.d.ts +2 -1
- package/lib-esm/providers/pinpoint/index.js +2 -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 +1 -0
- package/lib-esm/providers/pinpoint/types/index.js +1 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +7 -4
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +110 -197
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +10 -47
- package/lib-esm/providers/pinpoint/utils/constants.js +4 -4
- package/lib-esm/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib-esm/providers/pinpoint/utils/getEndpointId.js +5 -49
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +17 -19
- package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/index.js +1 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -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/singleton/API/types.d.ts +73 -0
- package/lib-esm/singleton/API/types.js +1 -0
- package/lib-esm/singleton/Amplify.d.ts +2 -2
- package/lib-esm/singleton/Amplify.js +32 -92
- package/lib-esm/singleton/Analytics/types.d.ts +4 -1
- package/lib-esm/singleton/Auth/index.js +48 -116
- package/lib-esm/singleton/Auth/types.d.ts +31 -4
- 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 +1 -1
- package/lib-esm/singleton/Auth/utils/index.js +28 -44
- 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/apis/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/server/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/types.d.ts +12 -1
- package/{lib/StorageHelper/cookieStorage.d.ts → lib-esm/storage/CookieStorage.d.ts} +4 -3
- 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/StorageHelper/localStorage.d.ts → lib-esm/storage/DefaultStorage.native.d.ts} +6 -5
- 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/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- 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 +4 -1
- package/lib-esm/types/errors.d.ts +9 -3
- package/lib-esm/types/errors.js +6 -1
- package/lib-esm/types/storage.d.ts +3 -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/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/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
- package/lib-esm/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +6 -6
- package/{lib/ClientDevice/browser.d.ts → lib-esm/utils/getClientInfo/getClientInfo.d.ts} +1 -9
- package/lib-esm/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
- package/lib-esm/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +11 -11
- package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +18 -28
- 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/{Util/StringUtils.d.ts → utils/urlSafeDecode.d.ts} +0 -1
- package/lib-esm/utils/urlSafeDecode.js +6 -0
- package/{lib/Util/StringUtils.d.ts → lib-esm/utils/urlSafeEncode.d.ts} +0 -1
- package/lib-esm/utils/urlSafeEncode.js +8 -0
- package/package.json +18 -45
- package/src/BackgroundProcessManager/BackgroundManagerNotOpenError.ts +8 -0
- package/src/{Util → BackgroundProcessManager}/BackgroundProcessManager.ts +4 -58
- 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 -158
- 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 +1 -1
- package/src/Cache/{Utils → utils}/CacheList.ts +185 -198
- package/src/Cache/utils/cacheHelpers.ts +52 -0
- package/src/Cache/utils/errorHelpers.ts +26 -0
- package/src/Cache/{Utils → utils}/index.ts +4 -5
- package/src/Hub/index.ts +11 -2
- package/src/Hub/types/AuthTypes.ts +12 -1
- package/src/I18n/I18n.ts +4 -25
- package/src/I18n/errorHelpers.ts +18 -0
- package/src/I18n/index.ts +9 -33
- package/src/I18n/types.ts +1 -4
- package/src/Logger/ConsoleLogger.ts +1 -1
- package/src/{Util → Mutex}/Mutex.ts +2 -20
- package/src/Mutex/index.ts +4 -0
- package/src/Mutex/types.ts +20 -0
- package/src/Platform/customUserAgent.ts +75 -0
- package/src/Platform/index.ts +14 -1
- package/src/Platform/types.ts +84 -39
- package/src/Platform/version.ts +1 -1
- package/src/{Util → Reachability}/Reachability.native.ts +7 -12
- 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 +39 -48
- package/src/ServiceWorker/errorHelpers.ts +26 -0
- package/src/ServiceWorker/index.ts +0 -12
- package/src/{Util → Signer}/DateUtils.ts +1 -1
- package/src/{Signer.ts → Signer/Signer.ts} +5 -4
- package/src/Signer/index.ts +4 -0
- package/src/adapterCore/error/AmplifyServerContextError.ts +1 -1
- package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.ts +4 -1
- package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/base.ts +2 -1
- package/src/awsClients/pinpoint/errorHelpers.ts +19 -0
- package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.ts +2 -1
- package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.ts +4 -7
- package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.ts +2 -1
- package/src/clients/handlers/fetch.ts +5 -1
- package/src/clients/middleware/retry/jitteredBackoff.ts +1 -1
- package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
- package/src/clients/types/http.ts +19 -1
- package/src/{Util/Constants.ts → constants.ts} +0 -11
- package/src/{Util/Errors.ts → errors/AmplifyError.ts} +2 -18
- 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/index.ts +16 -11
- package/src/libraryUtils.ts +61 -57
- package/src/parseAWSExports.ts +214 -14
- 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 +1 -0
- package/src/providers/pinpoint/apis/record.ts +36 -33
- package/src/providers/pinpoint/apis/updateEndpoint.ts +26 -10
- package/src/providers/pinpoint/index.ts +6 -1
- package/src/providers/pinpoint/types/errors.ts +12 -0
- package/src/providers/pinpoint/types/index.ts +1 -0
- package/src/providers/pinpoint/types/pinpoint.ts +7 -3
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +21 -13
- package/src/providers/pinpoint/utils/index.ts +1 -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/singleton/API/types.ts +90 -0
- package/src/singleton/Amplify.ts +10 -8
- package/src/singleton/Analytics/types.ts +7 -1
- package/src/singleton/Auth/types.ts +53 -4
- package/src/singleton/Auth/utils/errorHelpers.ts +37 -0
- package/src/singleton/Auth/utils/index.ts +35 -38
- 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/types.ts +15 -7
- 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/{StorageHelper/sessionStorage.ts → storage/KeyValueStorage.ts} +15 -18
- 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 +4 -1
- package/src/types/errors.ts +15 -3
- package/src/types/storage.ts +4 -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/deepFreeze.ts +16 -0
- package/src/utils/generateRandomString.ts +16 -0
- package/src/{ClientDevice/android.ts → utils/getClientInfo/getClientInfo.android.ts} +2 -2
- package/src/{ClientDevice/ios.ts → utils/getClientInfo/getClientInfo.ios.ts} +3 -3
- package/src/{ClientDevice/browser.ts → utils/getClientInfo/getClientInfo.ts} +4 -16
- 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/{Util/Retry.ts → utils/retry/retry.ts} +4 -44
- 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/{Util/StringUtils.ts → utils/urlSafeDecode.ts} +0 -6
- package/src/utils/urlSafeEncode.ts +9 -0
- package/lib/Amplify.d.ts +0 -29
- package/lib/Amplify.js +0 -118
- package/lib/AwsClients/CognitoIdentity/base.js +0 -114
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +0 -83
- package/lib/AwsClients/CognitoIdentity/getId.js +0 -73
- package/lib/AwsClients/Pinpoint/getInAppMessages.js +0 -77
- package/lib/AwsClients/Pinpoint/putEvents.js +0 -84
- package/lib/AwsClients/Pinpoint/updateEndpoint.js +0 -81
- package/lib/Cache/AsyncStorageCache.js +0 -744
- package/lib/Cache/BrowserStorageCache.d.ts +0 -166
- package/lib/Cache/BrowserStorageCache.js +0 -469
- package/lib/Cache/InMemoryCache.d.ts +0 -129
- package/lib/Cache/InMemoryCache.js +0 -349
- package/lib/Cache/Utils/CacheList.js +0 -196
- package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
- package/lib/Cache/Utils/CacheUtils.js +0 -88
- package/lib/Cache/Utils/index.d.ts +0 -2
- package/lib/Cache/Utils/index.js +0 -16
- package/lib/Cache/reactnative.d.ts +0 -3
- package/lib/Cache/reactnative.js +0 -8
- package/lib/Cache/types/Cache.d.ts +0 -55
- 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/reactnative.d.ts +0 -7
- package/lib/ClientDevice/reactnative.js +0 -24
- package/lib/RNComponents/index.d.ts +0 -6
- package/lib/RNComponents/index.js +0 -16
- package/lib/RNComponents/reactnative.d.ts +0 -3
- package/lib/RNComponents/reactnative.js +0 -14
- package/lib/StorageHelper/cookieStorage.js +0 -167
- package/lib/StorageHelper/inMemoryStorage.d.ts +0 -10
- package/lib/StorageHelper/inMemoryStorage.js +0 -82
- package/lib/StorageHelper/index.d.ts +0 -45
- package/lib/StorageHelper/index.js +0 -83
- package/lib/StorageHelper/localStorage.js +0 -114
- package/lib/StorageHelper/reactnative.d.ts +0 -83
- package/lib/StorageHelper/reactnative.js +0 -250
- package/lib/StorageHelper/sessionStorage.js +0 -114
- package/lib/Util/BackgroundProcessManager.js +0 -449
- package/lib/Util/Constants.d.ts +0 -12
- package/lib/Util/Constants.js +0 -29
- package/lib/Util/Errors.js +0 -62
- package/lib/Util/JS.d.ts +0 -29
- package/lib/Util/JS.js +0 -214
- package/lib/Util/Reachability.d.ts +0 -13
- package/lib/Util/Reachability.js +0 -69
- package/lib/Util/Reachability.native.d.ts +0 -12
- package/lib/Util/Retry.d.ts +0 -21
- package/lib/Util/Retry.js +0 -205
- package/lib/Util/StringUtils.js +0 -17
- package/lib/Util/errors/AssertError.d.ts +0 -2
- package/lib/Util/errors/AssertError.js +0 -11
- package/lib/Util/index.d.ts +0 -7
- package/lib/Util/index.js +0 -31
- 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-esm/Amplify.d.ts +0 -29
- package/lib-esm/Amplify.js +0 -115
- package/lib-esm/AwsClients/CognitoIdentity/base.js +0 -109
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +0 -80
- package/lib-esm/AwsClients/CognitoIdentity/getId.js +0 -70
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +0 -74
- package/lib-esm/AwsClients/Pinpoint/putEvents.js +0 -81
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +0 -78
- package/lib-esm/Cache/AsyncStorageCache.js +0 -737
- package/lib-esm/Cache/BrowserStorageCache.d.ts +0 -166
- package/lib-esm/Cache/BrowserStorageCache.js +0 -466
- package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
- package/lib-esm/Cache/InMemoryCache.js +0 -346
- package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
- package/lib-esm/Cache/Utils/CacheUtils.js +0 -81
- package/lib-esm/Cache/Utils/index.d.ts +0 -2
- package/lib-esm/Cache/Utils/index.js +0 -4
- package/lib-esm/Cache/reactnative.d.ts +0 -3
- package/lib-esm/Cache/reactnative.js +0 -6
- package/lib-esm/Cache/types/Cache.d.ts +0 -55
- package/lib-esm/ClientDevice/index.d.ts +0 -23
- package/lib-esm/ClientDevice/index.js +0 -15
- package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
- package/lib-esm/ClientDevice/reactnative.js +0 -21
- package/lib-esm/RNComponents/index.d.ts +0 -6
- package/lib-esm/RNComponents/index.js +0 -13
- package/lib-esm/RNComponents/isAppInForeground.js +0 -6
- package/lib-esm/RNComponents/reactnative.d.ts +0 -3
- package/lib-esm/RNComponents/reactnative.js +0 -6
- package/lib-esm/Signer.js +0 -127
- package/lib-esm/StorageHelper/cookieStorage.js +0 -141
- package/lib-esm/StorageHelper/inMemoryStorage.d.ts +0 -10
- package/lib-esm/StorageHelper/inMemoryStorage.js +0 -79
- package/lib-esm/StorageHelper/index.d.ts +0 -45
- package/lib-esm/StorageHelper/index.js +0 -76
- package/lib-esm/StorageHelper/localStorage.js +0 -111
- package/lib-esm/StorageHelper/reactnative.d.ts +0 -83
- package/lib-esm/StorageHelper/reactnative.js +0 -244
- package/lib-esm/StorageHelper/sessionStorage.js +0 -111
- package/lib-esm/Util/BackgroundProcessManager.js +0 -446
- package/lib-esm/Util/Constants.d.ts +0 -12
- package/lib-esm/Util/Constants.js +0 -26
- package/lib-esm/Util/Errors.js +0 -57
- package/lib-esm/Util/JS.d.ts +0 -29
- package/lib-esm/Util/JS.js +0 -199
- package/lib-esm/Util/Reachability.d.ts +0 -13
- package/lib-esm/Util/Reachability.js +0 -64
- package/lib-esm/Util/Reachability.native.d.ts +0 -12
- package/lib-esm/Util/Retry.d.ts +0 -21
- package/lib-esm/Util/Retry.js +0 -198
- package/lib-esm/Util/StringUtils.js +0 -12
- package/lib-esm/Util/errors/AssertError.d.ts +0 -2
- package/lib-esm/Util/errors/AssertError.js +0 -7
- 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/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 -106
- package/src/Cache/AsyncStorageCache.ts +0 -500
- package/src/Cache/BrowserStorageCache.ts +0 -517
- package/src/Cache/CHANGELOG.md +0 -1239
- package/src/Cache/InMemoryCache.ts +0 -354
- package/src/Cache/Utils/CacheUtils.ts +0 -92
- package/src/Cache/reactnative.ts +0 -9
- package/src/Cache/types/Cache.ts +0 -75
- package/src/ClientDevice/index.ts +0 -14
- package/src/ClientDevice/reactnative.ts +0 -18
- package/src/RNComponents/index.ts +0 -16
- package/src/RNComponents/isAppInForeground.ts +0 -8
- package/src/RNComponents/reactnative.ts +0 -6
- package/src/StorageHelper/cookieStorage.ts +0 -99
- package/src/StorageHelper/inMemoryStorage.ts +0 -32
- package/src/StorageHelper/index.ts +0 -78
- package/src/StorageHelper/localStorage.ts +0 -60
- package/src/StorageHelper/reactnative.ts +0 -182
- package/src/Util/JS.ts +0 -255
- package/src/Util/Reachability.ts +0 -58
- package/src/Util/errors/AssertError.ts +0 -11
- package/src/Util/index.ts +0 -23
- package/src/clients/middleware/signing/signer/signatureV4/index.native.ts +0 -10
- /package/lib/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
- /package/lib/{Cache/types/Cache.js → Mutex/types.js} +0 -0
- /package/lib/{Util → Signer}/DateUtils.d.ts +0 -0
- /package/lib/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
- /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +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}/base.d.ts +0 -0
- /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.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-esm/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
- /package/lib-esm/{Cache/types/Cache.js → Mutex/types.js} +0 -0
- /package/lib-esm/{Util → Signer}/DateUtils.d.ts +0 -0
- /package/lib-esm/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +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}/base.d.ts +0 -0
- /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.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/{RNComponents → providers/pinpoint/utils}/isAppInForeground.d.ts +0 -0
- /package/{lib/RNComponents/isAppInForeground.d.ts → lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts} +0 -0
- /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.ts +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}/index.ts +0 -0
- /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/types.ts +0 -0
|
@@ -1,43 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (m) return m.call(o);
|
|
6
|
-
if (o && typeof o.length === "number") return {
|
|
7
|
-
next: function () {
|
|
8
|
-
if (o && i >= o.length) o = void 0;
|
|
9
|
-
return { value: o && o[i++], done: !o };
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
13
|
-
};
|
|
14
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
15
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
16
|
-
if (!m) return o;
|
|
17
|
-
var i = m.call(o), r, ar = [], e;
|
|
18
|
-
try {
|
|
19
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
20
|
-
}
|
|
21
|
-
catch (error) { e = { error: error }; }
|
|
22
|
-
finally {
|
|
23
|
-
try {
|
|
24
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
25
|
-
}
|
|
26
|
-
finally { if (e) throw e.error; }
|
|
27
|
-
}
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
31
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
32
|
-
if (ar || !(i in from)) {
|
|
33
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
34
|
-
ar[i] = from[i];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
38
|
-
};
|
|
39
|
-
import { AWS_CLOUDWATCH_CATEGORY } from '../Util/Constants';
|
|
40
|
-
var LOG_LEVELS = {
|
|
3
|
+
import { AWS_CLOUDWATCH_CATEGORY } from '../constants';
|
|
4
|
+
const LOG_LEVELS = {
|
|
41
5
|
VERBOSE: 1,
|
|
42
6
|
DEBUG: 2,
|
|
43
7
|
INFO: 3,
|
|
@@ -56,32 +20,31 @@ export var LOG_TYPE;
|
|
|
56
20
|
* Write logs
|
|
57
21
|
* @class Logger
|
|
58
22
|
*/
|
|
59
|
-
|
|
23
|
+
class ConsoleLogger {
|
|
60
24
|
/**
|
|
61
25
|
* @constructor
|
|
62
26
|
* @param {string} name - Name of the logger
|
|
63
27
|
*/
|
|
64
|
-
|
|
65
|
-
if (level === void 0) { level = LOG_TYPE.WARN; }
|
|
28
|
+
constructor(name, level = LOG_TYPE.WARN) {
|
|
66
29
|
this.name = name;
|
|
67
30
|
this.level = level;
|
|
68
31
|
this._pluggables = [];
|
|
69
32
|
}
|
|
70
|
-
|
|
33
|
+
_padding(n) {
|
|
71
34
|
return n < 10 ? '0' + n : '' + n;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
35
|
+
}
|
|
36
|
+
_ts() {
|
|
37
|
+
const dt = new Date();
|
|
75
38
|
return ([this._padding(dt.getMinutes()), this._padding(dt.getSeconds())].join(':') +
|
|
76
39
|
'.' +
|
|
77
40
|
dt.getMilliseconds());
|
|
78
|
-
}
|
|
79
|
-
|
|
41
|
+
}
|
|
42
|
+
configure(config) {
|
|
80
43
|
if (!config)
|
|
81
44
|
return this._config;
|
|
82
45
|
this._config = config;
|
|
83
46
|
return this._config;
|
|
84
|
-
}
|
|
47
|
+
}
|
|
85
48
|
/**
|
|
86
49
|
* Write log
|
|
87
50
|
* @method
|
|
@@ -89,156 +52,117 @@ export var ConsoleLogger = /** @class */ (function () {
|
|
|
89
52
|
* @param {LOG_TYPE|string} type - log type, default INFO
|
|
90
53
|
* @param {string|object} msg - Logging message or object
|
|
91
54
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var msg = [];
|
|
95
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
96
|
-
msg[_i - 1] = arguments[_i];
|
|
97
|
-
}
|
|
98
|
-
var logger_level_name = this.level;
|
|
55
|
+
_log(type, ...msg) {
|
|
56
|
+
let logger_level_name = this.level;
|
|
99
57
|
if (ConsoleLogger.LOG_LEVEL) {
|
|
100
58
|
logger_level_name = ConsoleLogger.LOG_LEVEL;
|
|
101
59
|
}
|
|
102
60
|
if (typeof window !== 'undefined' && window.LOG_LEVEL) {
|
|
103
61
|
logger_level_name = window.LOG_LEVEL;
|
|
104
62
|
}
|
|
105
|
-
|
|
106
|
-
|
|
63
|
+
const logger_level = LOG_LEVELS[logger_level_name];
|
|
64
|
+
const type_level = LOG_LEVELS[type];
|
|
107
65
|
if (!(type_level >= logger_level)) {
|
|
108
66
|
// Do nothing if type is not greater than or equal to logger level (handle undefined)
|
|
109
67
|
return;
|
|
110
68
|
}
|
|
111
|
-
|
|
69
|
+
let log = console.log.bind(console);
|
|
112
70
|
if (type === LOG_TYPE.ERROR && console.error) {
|
|
113
71
|
log = console.error.bind(console);
|
|
114
72
|
}
|
|
115
73
|
if (type === LOG_TYPE.WARN && console.warn) {
|
|
116
74
|
log = console.warn.bind(console);
|
|
117
75
|
}
|
|
118
|
-
|
|
119
|
-
|
|
76
|
+
const prefix = `[${type}] ${this._ts()} ${this.name}`;
|
|
77
|
+
let message = '';
|
|
120
78
|
if (msg.length === 1 && typeof msg[0] === 'string') {
|
|
121
|
-
message =
|
|
79
|
+
message = `${prefix} - ${msg[0]}`;
|
|
122
80
|
log(message);
|
|
123
81
|
}
|
|
124
82
|
else if (msg.length === 1) {
|
|
125
|
-
message =
|
|
83
|
+
message = `${prefix} ${msg[0]}`;
|
|
126
84
|
log(prefix, msg[0]);
|
|
127
85
|
}
|
|
128
86
|
else if (typeof msg[0] === 'string') {
|
|
129
|
-
|
|
87
|
+
let obj = msg.slice(1);
|
|
130
88
|
if (obj.length === 1) {
|
|
131
89
|
obj = obj[0];
|
|
132
90
|
}
|
|
133
|
-
message =
|
|
134
|
-
log(
|
|
91
|
+
message = `${prefix} - ${msg[0]} ${obj}`;
|
|
92
|
+
log(`${prefix} - ${msg[0]}`, obj);
|
|
135
93
|
}
|
|
136
94
|
else {
|
|
137
|
-
message =
|
|
95
|
+
message = `${prefix} ${msg}`;
|
|
138
96
|
log(prefix, msg);
|
|
139
97
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var logEvent = { message: message, timestamp: Date.now() };
|
|
144
|
-
plugin.pushLogs([logEvent]);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
148
|
-
finally {
|
|
149
|
-
try {
|
|
150
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
151
|
-
}
|
|
152
|
-
finally { if (e_1) throw e_1.error; }
|
|
98
|
+
for (const plugin of this._pluggables) {
|
|
99
|
+
const logEvent = { message, timestamp: Date.now() };
|
|
100
|
+
plugin.pushLogs([logEvent]);
|
|
153
101
|
}
|
|
154
|
-
}
|
|
102
|
+
}
|
|
155
103
|
/**
|
|
156
104
|
* Write General log. Default to INFO
|
|
157
105
|
* @method
|
|
158
106
|
* @memeberof Logger
|
|
159
107
|
* @param {string|object} msg - Logging message or object
|
|
160
108
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
msg[_i] = arguments[_i];
|
|
165
|
-
}
|
|
166
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.INFO], __read(msg), false));
|
|
167
|
-
};
|
|
109
|
+
log(...msg) {
|
|
110
|
+
this._log(LOG_TYPE.INFO, ...msg);
|
|
111
|
+
}
|
|
168
112
|
/**
|
|
169
113
|
* Write INFO log
|
|
170
114
|
* @method
|
|
171
115
|
* @memeberof Logger
|
|
172
116
|
* @param {string|object} msg - Logging message or object
|
|
173
117
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
msg[_i] = arguments[_i];
|
|
178
|
-
}
|
|
179
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.INFO], __read(msg), false));
|
|
180
|
-
};
|
|
118
|
+
info(...msg) {
|
|
119
|
+
this._log(LOG_TYPE.INFO, ...msg);
|
|
120
|
+
}
|
|
181
121
|
/**
|
|
182
122
|
* Write WARN log
|
|
183
123
|
* @method
|
|
184
124
|
* @memeberof Logger
|
|
185
125
|
* @param {string|object} msg - Logging message or object
|
|
186
126
|
*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
msg[_i] = arguments[_i];
|
|
191
|
-
}
|
|
192
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.WARN], __read(msg), false));
|
|
193
|
-
};
|
|
127
|
+
warn(...msg) {
|
|
128
|
+
this._log(LOG_TYPE.WARN, ...msg);
|
|
129
|
+
}
|
|
194
130
|
/**
|
|
195
131
|
* Write ERROR log
|
|
196
132
|
* @method
|
|
197
133
|
* @memeberof Logger
|
|
198
134
|
* @param {string|object} msg - Logging message or object
|
|
199
135
|
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
msg[_i] = arguments[_i];
|
|
204
|
-
}
|
|
205
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.ERROR], __read(msg), false));
|
|
206
|
-
};
|
|
136
|
+
error(...msg) {
|
|
137
|
+
this._log(LOG_TYPE.ERROR, ...msg);
|
|
138
|
+
}
|
|
207
139
|
/**
|
|
208
140
|
* Write DEBUG log
|
|
209
141
|
* @method
|
|
210
142
|
* @memeberof Logger
|
|
211
143
|
* @param {string|object} msg - Logging message or object
|
|
212
144
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
msg[_i] = arguments[_i];
|
|
217
|
-
}
|
|
218
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.DEBUG], __read(msg), false));
|
|
219
|
-
};
|
|
145
|
+
debug(...msg) {
|
|
146
|
+
this._log(LOG_TYPE.DEBUG, ...msg);
|
|
147
|
+
}
|
|
220
148
|
/**
|
|
221
149
|
* Write VERBOSE log
|
|
222
150
|
* @method
|
|
223
151
|
* @memeberof Logger
|
|
224
152
|
* @param {string|object} msg - Logging message or object
|
|
225
153
|
*/
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
this._log.apply(this, __spreadArray([LOG_TYPE.VERBOSE], __read(msg), false));
|
|
232
|
-
};
|
|
233
|
-
ConsoleLogger.prototype.addPluggable = function (pluggable) {
|
|
154
|
+
verbose(...msg) {
|
|
155
|
+
this._log(LOG_TYPE.VERBOSE, ...msg);
|
|
156
|
+
}
|
|
157
|
+
addPluggable(pluggable) {
|
|
234
158
|
if (pluggable && pluggable.getCategoryName() === AWS_CLOUDWATCH_CATEGORY) {
|
|
235
159
|
this._pluggables.push(pluggable);
|
|
236
160
|
pluggable.configure(this._config);
|
|
237
161
|
}
|
|
238
|
-
}
|
|
239
|
-
|
|
162
|
+
}
|
|
163
|
+
listPluggables() {
|
|
240
164
|
return this._pluggables;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
ConsoleLogger.LOG_LEVEL = null;
|
|
168
|
+
export { ConsoleLogger };
|
|
@@ -21,20 +21,8 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
27
|
-
isLocked(): boolean;
|
|
28
|
-
}
|
|
29
|
-
declare namespace MutexInterface {
|
|
30
|
-
interface Releaser {
|
|
31
|
-
(): void;
|
|
32
|
-
}
|
|
33
|
-
interface Worker<T> {
|
|
34
|
-
(): Promise<T> | T;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
declare class Mutex implements MutexInterface {
|
|
24
|
+
import { MutexInterface } from './types';
|
|
25
|
+
export declare class Mutex implements MutexInterface {
|
|
38
26
|
isLocked(): boolean;
|
|
39
27
|
acquire(): Promise<MutexInterface.Releaser>;
|
|
40
28
|
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
@@ -42,4 +30,3 @@ declare class Mutex implements MutexInterface {
|
|
|
42
30
|
private _queue;
|
|
43
31
|
private _pending;
|
|
44
32
|
}
|
|
45
|
-
export default Mutex;
|
|
@@ -23,27 +23,24 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
24
|
* THE SOFTWARE.
|
|
25
25
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
export class Mutex {
|
|
27
|
+
constructor() {
|
|
28
28
|
this._queue = [];
|
|
29
29
|
this._pending = false;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
isLocked() {
|
|
32
32
|
return this._pending;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var ticket = new Promise(function (resolve) {
|
|
37
|
-
return _this._queue.push(resolve);
|
|
38
|
-
});
|
|
33
|
+
}
|
|
34
|
+
acquire() {
|
|
35
|
+
const ticket = new Promise(resolve => this._queue.push(resolve));
|
|
39
36
|
if (!this._pending) {
|
|
40
37
|
this._dispatchNext();
|
|
41
38
|
}
|
|
42
39
|
return ticket;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return this.acquire().then(
|
|
46
|
-
|
|
40
|
+
}
|
|
41
|
+
runExclusive(callback) {
|
|
42
|
+
return this.acquire().then(release => {
|
|
43
|
+
let result;
|
|
47
44
|
try {
|
|
48
45
|
result = callback();
|
|
49
46
|
}
|
|
@@ -51,13 +48,13 @@ var Mutex = /** @class */ (function () {
|
|
|
51
48
|
release();
|
|
52
49
|
throw e;
|
|
53
50
|
}
|
|
54
|
-
return Promise.resolve(result).then(
|
|
51
|
+
return Promise.resolve(result).then((x) => (release(), x), e => {
|
|
55
52
|
release();
|
|
56
53
|
throw e;
|
|
57
54
|
});
|
|
58
55
|
});
|
|
59
|
-
}
|
|
60
|
-
|
|
56
|
+
}
|
|
57
|
+
_dispatchNext() {
|
|
61
58
|
if (this._queue.length > 0) {
|
|
62
59
|
this._pending = true;
|
|
63
60
|
this._queue.shift()(this._dispatchNext.bind(this));
|
|
@@ -65,7 +62,5 @@ var Mutex = /** @class */ (function () {
|
|
|
65
62
|
else {
|
|
66
63
|
this._pending = false;
|
|
67
64
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}());
|
|
71
|
-
export default Mutex;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Mutex } from './Mutex';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface MutexInterface {
|
|
2
|
+
acquire(): Promise<MutexInterface.Releaser>;
|
|
3
|
+
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
4
|
+
isLocked(): boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace MutexInterface {
|
|
7
|
+
interface Releaser {
|
|
8
|
+
(): void;
|
|
9
|
+
}
|
|
10
|
+
interface Worker<T> {
|
|
11
|
+
(): Promise<T> | T;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdditionalDetails, SetCustomUserAgentInput } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
|
|
4
|
+
* clean up any custom state set with this API.
|
|
5
|
+
*
|
|
6
|
+
* @note
|
|
7
|
+
* This API operates globally. Calling this API multiple times will result in the most recently set values for a
|
|
8
|
+
* particular API being used.
|
|
9
|
+
*
|
|
10
|
+
* @note
|
|
11
|
+
* This utility IS NOT compatible with SSR.
|
|
12
|
+
*
|
|
13
|
+
* @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setCustomUserAgent: (input: SetCustomUserAgentInput) => (() => void);
|
|
16
|
+
export declare const getCustomUserAgent: (category: string, api: string) => AdditionalDetails | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Maintains custom user-agent state set by external consumers.
|
|
4
|
+
const customUserAgentState = {};
|
|
5
|
+
/**
|
|
6
|
+
* Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
|
|
7
|
+
* clean up any custom state set with this API.
|
|
8
|
+
*
|
|
9
|
+
* @note
|
|
10
|
+
* This API operates globally. Calling this API multiple times will result in the most recently set values for a
|
|
11
|
+
* particular API being used.
|
|
12
|
+
*
|
|
13
|
+
* @note
|
|
14
|
+
* This utility IS NOT compatible with SSR.
|
|
15
|
+
*
|
|
16
|
+
* @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
|
|
17
|
+
*/
|
|
18
|
+
export const setCustomUserAgent = (input) => {
|
|
19
|
+
// Save custom user-agent state & increment reference counter
|
|
20
|
+
// TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373
|
|
21
|
+
customUserAgentState[input.category] = input.apis.reduce((acc, api) => ({
|
|
22
|
+
...acc,
|
|
23
|
+
[api]: {
|
|
24
|
+
refCount: acc[api]?.refCount ? acc[api].refCount + 1 : 1,
|
|
25
|
+
additionalDetails: input.additionalDetails,
|
|
26
|
+
},
|
|
27
|
+
}), customUserAgentState[input.category] ?? {});
|
|
28
|
+
// Callback that cleans up state for APIs recorded by this call
|
|
29
|
+
let cleanUpCallbackCalled = false;
|
|
30
|
+
const cleanUpCallback = () => {
|
|
31
|
+
// Only allow the cleanup callback to be called once
|
|
32
|
+
if (cleanUpCallbackCalled) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
cleanUpCallbackCalled = true;
|
|
36
|
+
input.apis.forEach(api => {
|
|
37
|
+
const apiRefCount = customUserAgentState[input.category][api].refCount;
|
|
38
|
+
if (apiRefCount > 1) {
|
|
39
|
+
customUserAgentState[input.category][api].refCount = apiRefCount - 1;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
delete customUserAgentState[input.category][api];
|
|
43
|
+
// Clean up category if no more APIs set
|
|
44
|
+
if (!Object.keys(customUserAgentState[input.category]).length) {
|
|
45
|
+
delete customUserAgentState[input.category];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
return cleanUpCallback;
|
|
51
|
+
};
|
|
52
|
+
export const getCustomUserAgent = (category, api) => customUserAgentState[category]?.[api]?.additionalDetails;
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
import { Framework } from './types';
|
|
4
4
|
import { detect } from './detection';
|
|
5
5
|
// We want to cache detection since the framework won't change
|
|
6
|
-
|
|
7
|
-
export
|
|
6
|
+
let frameworkCache;
|
|
7
|
+
export const frameworkChangeObservers = [];
|
|
8
8
|
// Setup the detection reset tracking / timeout delays
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
var _a;
|
|
9
|
+
let resetTriggered = false;
|
|
10
|
+
const SSR_RESET_TIMEOUT = 10; // ms
|
|
11
|
+
const WEB_RESET_TIMEOUT = 10; // ms
|
|
12
|
+
const PRIME_FRAMEWORK_DELAY = 1000; // ms
|
|
13
|
+
export const detectFramework = () => {
|
|
15
14
|
if (!frameworkCache) {
|
|
16
15
|
frameworkCache = detect();
|
|
17
16
|
if (resetTriggered) {
|
|
@@ -20,13 +19,13 @@ export var detectFramework = function () {
|
|
|
20
19
|
// So we don't need to notify the observers again so the observer
|
|
21
20
|
// can be removed after the final notice.
|
|
22
21
|
while (frameworkChangeObservers.length) {
|
|
23
|
-
|
|
22
|
+
frameworkChangeObservers.pop()?.();
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
else {
|
|
27
26
|
// The first run of detectFramework:
|
|
28
27
|
// Every time we update the cache, call each observer function
|
|
29
|
-
frameworkChangeObservers.forEach(
|
|
28
|
+
frameworkChangeObservers.forEach(fcn => fcn());
|
|
30
29
|
}
|
|
31
30
|
// Retry once for either Unknown type after a delay (explained below)
|
|
32
31
|
resetTimeout(Framework.ServerSideUnknown, SSR_RESET_TIMEOUT);
|
|
@@ -37,7 +36,7 @@ export var detectFramework = function () {
|
|
|
37
36
|
/**
|
|
38
37
|
* @internal Setup observer callback that will be called everytime the framework changes
|
|
39
38
|
*/
|
|
40
|
-
export
|
|
39
|
+
export const observeFrameworkChanges = (fcn) => {
|
|
41
40
|
// When the `frameworkCache` won't be updated again, we ignore all incoming
|
|
42
41
|
// observers.
|
|
43
42
|
if (resetTriggered) {
|
|
@@ -56,7 +55,7 @@ export function clearCache() {
|
|
|
56
55
|
// non-framework detection result for all requests.
|
|
57
56
|
function resetTimeout(framework, delay) {
|
|
58
57
|
if (frameworkCache === framework && !resetTriggered) {
|
|
59
|
-
setTimeout(
|
|
58
|
+
setTimeout(() => {
|
|
60
59
|
clearCache();
|
|
61
60
|
resetTriggered = true;
|
|
62
61
|
setTimeout(detectFramework, PRIME_FRAMEWORK_DELAY);
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
import { documentExists, processExists, windowExists } from './helpers';
|
|
4
4
|
// Tested with @angular/core 16.0.0
|
|
5
5
|
export function angularWebDetect() {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const angularVersionSetInDocument = Boolean(documentExists() && document.querySelector('[ng-version]'));
|
|
7
|
+
const angularContentSetInWindow = Boolean(
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
windowExists() && typeof window['ng'] !== 'undefined');
|
|
10
10
|
return angularVersionSetInDocument || angularContentSetInWindow;
|
|
11
11
|
}
|
|
12
12
|
export function angularSSRDetect() {
|
|
13
|
-
var _a;
|
|
14
13
|
return ((processExists() &&
|
|
15
14
|
typeof process.env === 'object' &&
|
|
16
|
-
|
|
15
|
+
process.env['npm_lifecycle_script']?.startsWith('ng ')) ||
|
|
17
16
|
false);
|
|
18
17
|
}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
import { documentExists, processExists } from './helpers';
|
|
4
4
|
// Tested with react 18.2 - built using Vite
|
|
5
5
|
export function reactWebDetect() {
|
|
6
|
-
|
|
6
|
+
const elementKeyPrefixedWithReact = (key) => {
|
|
7
7
|
return key.startsWith('_react') || key.startsWith('__react');
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
const elementIsReactEnabled = (element) => {
|
|
10
10
|
return Object.keys(element).find(elementKeyPrefixedWithReact);
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
const allElementsWithId = () => Array.from(document.querySelectorAll('[id]'));
|
|
13
13
|
return documentExists() && allElementsWithId().some(elementIsReactEnabled);
|
|
14
14
|
}
|
|
15
15
|
export function reactSSRDetect() {
|
|
16
16
|
return (processExists() &&
|
|
17
17
|
typeof process.env !== 'undefined' &&
|
|
18
|
-
!!Object.keys(process.env).find(
|
|
18
|
+
!!Object.keys(process.env).find(key => key.includes('react')));
|
|
19
19
|
}
|
|
20
20
|
// use the some
|
|
@@ -8,5 +8,5 @@ export function svelteWebDetect() {
|
|
|
8
8
|
export function svelteSSRDetect() {
|
|
9
9
|
return (processExists() &&
|
|
10
10
|
typeof process.env !== 'undefined' &&
|
|
11
|
-
!!Object.keys(process.env).find(
|
|
11
|
+
!!Object.keys(process.env).find(key => key.includes('svelte')));
|
|
12
12
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export
|
|
3
|
+
export const globalExists = () => {
|
|
4
4
|
return typeof global !== 'undefined';
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export const globalThisExists = () => {
|
|
7
7
|
return typeof globalThis !== 'undefined';
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export const windowExists = () => {
|
|
10
10
|
return typeof window !== 'undefined';
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export const documentExists = () => {
|
|
13
13
|
return typeof document !== 'undefined';
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export const processExists = () => {
|
|
16
16
|
return typeof process !== 'undefined';
|
|
17
17
|
};
|
|
18
|
-
export
|
|
19
|
-
return !!Object.keys(object).find(
|
|
18
|
+
export const keyPrefixMatch = (object, prefix) => {
|
|
19
|
+
return !!Object.keys(object).find(key => key.startsWith(prefix));
|
|
20
20
|
};
|
|
@@ -11,7 +11,7 @@ import { reactNativeDetect } from './ReactNative';
|
|
|
11
11
|
import { expoDetect } from './Expo';
|
|
12
12
|
import { webDetect } from './Web';
|
|
13
13
|
// These are in the order of detection where when both are detectable, the early Framework will be reported
|
|
14
|
-
|
|
14
|
+
const detectionMap = [
|
|
15
15
|
// First, detect mobile
|
|
16
16
|
{ platform: Framework.Expo, detectionMethod: expoDetect },
|
|
17
17
|
{ platform: Framework.ReactNative, detectionMethod: reactNativeDetect },
|
|
@@ -32,6 +32,6 @@ var detectionMap = [
|
|
|
32
32
|
{ platform: Framework.SvelteSSR, detectionMethod: svelteSSRDetect },
|
|
33
33
|
];
|
|
34
34
|
export function detect() {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
return (detectionMap.find(detectionEntry => detectionEntry.detectionMethod())
|
|
36
|
+
?.platform || Framework.ServerSideUnknown);
|
|
37
37
|
}
|