@aws-amplify/core 6.0.1-preview-testing.be90020.0 → 6.0.1-server-generate-client.1e317a1.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 +28 -0
- package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
- package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +13 -56
- 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 +97 -102
- package/lib/Cache/StorageCache.native.d.ts +19 -0
- package/lib/Cache/StorageCache.native.js +164 -0
- package/lib/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -441
- 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 → utils}/CacheList.js +7 -19
- package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib/Cache/utils/cacheHelpers.js +51 -0
- package/lib/Cache/utils/errorHelpers.d.ts +7 -0
- package/lib/Cache/utils/errorHelpers.js +25 -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 +12 -5
- package/lib/Hub/types/AuthTypes.d.ts +19 -0
- package/lib/I18n/I18n.d.ts +3 -19
- package/lib/I18n/I18n.js +1 -21
- package/lib/I18n/errorHelpers.d.ts +5 -0
- package/lib/I18n/errorHelpers.js +17 -0
- package/lib/I18n/index.d.ts +3 -15
- package/lib/I18n/index.js +5 -30
- package/lib/I18n/types.d.ts +1 -4
- package/lib/I18n/types.js +5 -8
- package/lib/Logger/ConsoleLogger.js +2 -2
- package/{lib-esm/Util → lib/Mutex}/Mutex.d.ts +2 -15
- package/lib/{Util → Mutex}/Mutex.js +2 -1
- 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 +70 -0
- package/lib/Platform/index.js +10 -1
- 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/{Util → Reachability}/Reachability.js +24 -23
- package/lib/Reachability/Reachability.native.d.ts +6 -0
- package/lib/{Util → Reachability}/Reachability.native.js +8 -10
- 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 +84 -54
- package/lib/ServiceWorker/errorHelpers.d.ts +7 -0
- package/lib/ServiceWorker/errorHelpers.js +25 -0
- package/lib/ServiceWorker/index.d.ts +0 -12
- package/lib/ServiceWorker/index.js +0 -12
- package/lib/{Signer.js → Signer/Signer.js} +6 -5
- 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 +2 -2
- package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +2 -1
- package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
- package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
- package/lib/awsClients/cognitoIdentity/types.js +4 -0
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +2 -1
- package/lib/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib/awsClients/pinpoint/errorHelpers.js +17 -0
- package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +2 -1
- package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/putEvents.d.ts +4 -3
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +4 -7
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
- package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +2 -1
- package/lib/clients/handlers/fetch.js +2 -1
- package/lib/clients/middleware/retry/jitteredBackoff.js +2 -2
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
- package/lib/clients/types/http.d.ts +17 -1
- 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/{Util/Errors.js → errors/AmplifyError.js} +1 -18
- package/lib/errors/PlatformNotSupportedError.d.ts +4 -0
- package/lib/errors/PlatformNotSupportedError.js +33 -0
- package/lib/errors/createAssertionFunction.d.ts +3 -0
- package/lib/errors/createAssertionFunction.js +22 -0
- package/lib/errors/errorHelpers.d.ts +2 -0
- package/lib/errors/errorHelpers.js +20 -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 +19 -16
- package/lib/libraryUtils.js +57 -69
- package/lib/parseAWSExports.js +144 -13
- 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 +8 -24
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
- package/lib/providers/pinpoint/apis/updateEndpoint.js +15 -13
- 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 +5 -4
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +12 -7
- 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/{StorageHelper/inMemoryStorage.js → providers/pinpoint/utils/resolveEndpointId.js} +44 -41
- package/lib/singleton/API/types.d.ts +165 -0
- package/lib/singleton/API/types.js +12 -0
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +6 -5
- package/lib/singleton/Analytics/types.d.ts +4 -1
- package/lib/singleton/Auth/types.d.ts +29 -2
- package/lib/singleton/Auth/utils/errorHelpers.d.ts +8 -0
- package/lib/singleton/Auth/utils/errorHelpers.js +33 -0
- package/lib/singleton/Auth/utils/index.d.ts +1 -1
- package/lib/singleton/Auth/utils/index.js +21 -36
- 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/types.d.ts +10 -1
- package/{lib-esm/StorageHelper/cookieStorage.d.ts → lib/storage/CookieStorage.d.ts} +4 -3
- package/lib/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +38 -83
- package/lib/storage/CookieStorage.native.d.ts +7 -0
- package/lib/storage/CookieStorage.native.js +32 -0
- package/lib/storage/DefaultStorage.d.ts +7 -0
- package/lib/storage/DefaultStorage.js +33 -0
- package/{lib-esm/StorageHelper/localStorage.d.ts → lib/storage/DefaultStorage.native.d.ts} +6 -5
- package/lib/{StorageHelper/localStorage.js → storage/DefaultStorage.native.js} +25 -43
- package/lib/storage/InMemoryStorage.d.ts +12 -0
- package/lib/storage/InMemoryStorage.js +41 -0
- package/lib/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- package/{lib-esm/StorageHelper/sessionStorage.js → lib/storage/KeyValueStorage.js} +20 -19
- package/lib/storage/SessionStorage.d.ts +7 -0
- package/lib/storage/SessionStorage.js +33 -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 +26 -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 +18 -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 +38 -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} +4 -4
- 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} +4 -4
- package/lib/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +6 -18
- 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 +9 -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 +30 -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 +20 -0
- package/lib/utils/retry/jitteredExponentialRetry.d.ts +5 -0
- package/lib/utils/retry/jitteredExponentialRetry.js +17 -0
- package/lib/utils/retry/retry.d.ts +6 -0
- package/lib/{Util/Retry.js → utils/retry/retry.js} +6 -57
- package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.js +55 -0
- package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.native.js +54 -0
- package/lib/utils/sessionListener/index.d.ts +2 -0
- package/lib/utils/sessionListener/index.js +7 -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/{Util/StringUtils.js → utils/urlSafeDecode.js} +2 -9
- 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 +25 -0
- package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
- package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +4 -47
- 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 +97 -102
- package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
- package/lib-esm/Cache/StorageCache.native.js +161 -0
- package/lib-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -437
- 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 +6 -19
- package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
- package/lib-esm/Cache/utils/errorHelpers.d.ts +7 -0
- package/lib-esm/Cache/utils/errorHelpers.js +22 -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 +9 -2
- 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 +1 -21
- package/lib-esm/I18n/errorHelpers.d.ts +5 -0
- package/lib-esm/I18n/errorHelpers.js +14 -0
- package/lib-esm/I18n/index.d.ts +3 -15
- package/lib-esm/I18n/index.js +5 -30
- package/lib-esm/I18n/types.d.ts +1 -4
- package/lib-esm/I18n/types.js +4 -7
- package/lib-esm/Logger/ConsoleLogger.js +1 -1
- package/{lib/Util → lib-esm/Mutex}/Mutex.d.ts +2 -15
- package/lib-esm/{Util → Mutex}/Mutex.js +1 -1
- 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 +65 -0
- package/lib-esm/Platform/index.js +10 -1
- 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/{Util → Reachability}/Reachability.js +22 -19
- package/lib-esm/Reachability/Reachability.native.d.ts +6 -0
- package/lib-esm/{Util → Reachability}/Reachability.native.js +6 -6
- 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 -48
- package/lib-esm/ServiceWorker/errorHelpers.d.ts +7 -0
- package/lib-esm/ServiceWorker/errorHelpers.js +22 -0
- package/lib-esm/ServiceWorker/index.d.ts +0 -12
- package/lib-esm/ServiceWorker/index.js +0 -12
- package/lib-esm/{Signer.js → Signer/Signer.js} +5 -4
- 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 +1 -1
- package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +2 -1
- package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
- package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
- package/lib-esm/awsClients/cognitoIdentity/types.js +3 -0
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +2 -1
- package/lib-esm/awsClients/pinpoint/errorHelpers.d.ts +5 -0
- package/lib-esm/awsClients/pinpoint/errorHelpers.js +14 -0
- package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +2 -1
- package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/putEvents.d.ts +4 -3
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +4 -7
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
- package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +2 -1
- package/lib-esm/clients/handlers/fetch.js +2 -1
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
- package/lib-esm/clients/types/http.d.ts +17 -1
- package/lib-esm/constants.d.ts +4 -0
- package/lib-esm/{Util/Constants.js → constants.js} +0 -11
- package/lib-esm/{Util/Errors.d.ts → errors/AmplifyError.d.ts} +2 -9
- package/lib-esm/{Util/Errors.js → errors/AmplifyError.js} +0 -15
- package/lib-esm/errors/PlatformNotSupportedError.d.ts +4 -0
- package/lib-esm/errors/PlatformNotSupportedError.js +30 -0
- package/lib-esm/errors/createAssertionFunction.d.ts +3 -0
- package/lib-esm/errors/createAssertionFunction.js +18 -0
- package/lib-esm/errors/errorHelpers.d.ts +2 -0
- package/lib-esm/errors/errorHelpers.js +17 -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 +19 -16
- package/lib-esm/libraryUtils.js +20 -18
- package/lib-esm/parseAWSExports.js +144 -13
- 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 +9 -25
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +14 -12
- 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 +5 -4
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +11 -6
- 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 +81 -0
- package/lib-esm/singleton/API/types.d.ts +165 -0
- package/lib-esm/singleton/API/types.js +9 -0
- package/lib-esm/singleton/Amplify.d.ts +2 -2
- package/lib-esm/singleton/Amplify.js +6 -5
- package/lib-esm/singleton/Analytics/types.d.ts +4 -1
- package/lib-esm/singleton/Auth/types.d.ts +29 -2
- package/lib-esm/singleton/Auth/utils/errorHelpers.d.ts +8 -0
- package/lib-esm/singleton/Auth/utils/errorHelpers.js +30 -0
- package/lib-esm/singleton/Auth/utils/index.d.ts +1 -1
- package/lib-esm/singleton/Auth/utils/index.js +19 -34
- 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/types.d.ts +10 -1
- package/{lib/StorageHelper/cookieStorage.d.ts → lib-esm/storage/CookieStorage.d.ts} +4 -3
- package/lib-esm/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +36 -61
- package/lib-esm/storage/CookieStorage.native.d.ts +7 -0
- package/lib-esm/storage/CookieStorage.native.js +29 -0
- package/lib-esm/storage/DefaultStorage.d.ts +7 -0
- package/lib-esm/storage/DefaultStorage.js +30 -0
- package/{lib/StorageHelper/localStorage.d.ts → lib-esm/storage/DefaultStorage.native.d.ts} +6 -5
- package/{lib/StorageHelper/sessionStorage.js → lib-esm/storage/DefaultStorage.native.js} +24 -45
- package/lib-esm/storage/InMemoryStorage.d.ts +12 -0
- package/lib-esm/storage/InMemoryStorage.js +38 -0
- package/lib-esm/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- package/lib-esm/{StorageHelper/localStorage.js → storage/KeyValueStorage.js} +17 -19
- package/lib-esm/storage/SessionStorage.d.ts +7 -0
- package/lib-esm/storage/SessionStorage.js +30 -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 +21 -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 +15 -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 +34 -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} +2 -2
- 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} +2 -2
- package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +4 -14
- 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 +5 -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 +27 -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 +16 -0
- package/lib-esm/utils/retry/jitteredExponentialRetry.d.ts +5 -0
- package/lib-esm/utils/retry/jitteredExponentialRetry.js +13 -0
- package/lib-esm/utils/retry/retry.d.ts +6 -0
- package/lib-esm/{Util/Retry.js → utils/retry/retry.js} +4 -52
- package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
- package/lib-esm/utils/sessionListener/index.d.ts +2 -0
- package/lib-esm/utils/sessionListener/index.js +4 -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/{Util/StringUtils.js → utils/urlSafeDecode.js} +0 -6
- 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 +12 -26
- 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 +4 -4
- 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 +15 -11
- package/src/libraryUtils.ts +57 -57
- package/src/parseAWSExports.ts +179 -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 +14 -28
- 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 +5 -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 +203 -0
- package/src/singleton/Amplify.ts +10 -8
- package/src/singleton/Analytics/types.ts +7 -1
- package/src/singleton/Auth/types.ts +51 -2
- 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/types.ts +12 -6
- 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/index.ts +6 -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/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/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/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/inMemoryStorage.d.ts +0 -10
- package/lib/StorageHelper/index.d.ts +0 -45
- package/lib/StorageHelper/index.js +0 -83
- package/lib/StorageHelper/reactnative.d.ts +0 -83
- package/lib/StorageHelper/reactnative.js +0 -250
- package/lib/Util/Constants.d.ts +0 -12
- package/lib/Util/Constants.js +0 -29
- 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.native.d.ts +0 -12
- package/lib/Util/Retry.d.ts +0 -21
- 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/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/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/reactnative.d.ts +0 -83
- package/lib-esm/StorageHelper/reactnative.js +0 -244
- package/lib-esm/Util/Constants.d.ts +0 -12
- 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.native.d.ts +0 -12
- package/lib-esm/Util/Retry.d.ts +0 -21
- 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/{Util → Signer}/DateUtils.js +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}/getCredentialsForIdentity.js +0 -0
- /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.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}/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/{Util → Signer}/DateUtils.js +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}/getCredentialsForIdentity.js +0 -0
- /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.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}/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,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __extends = (this && this.__extends) || (function () {
|
|
5
|
-
var extendStatics = function (d, b) {
|
|
6
|
-
extendStatics = Object.setPrototypeOf ||
|
|
7
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
-
return extendStatics(d, b);
|
|
10
|
-
};
|
|
11
|
-
return function (d, b) {
|
|
12
|
-
if (typeof b !== "function" && b !== null)
|
|
13
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
-
extendStatics(d, b);
|
|
15
|
-
function __() { this.constructor = d; }
|
|
16
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
|
-
var __values = (this && this.__values) || function(o) {
|
|
20
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
21
|
-
if (m) return m.call(o);
|
|
22
|
-
if (o && typeof o.length === "number") return {
|
|
23
|
-
next: function () {
|
|
24
|
-
if (o && i >= o.length) o = void 0;
|
|
25
|
-
return { value: o && o[i++], done: !o };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.InMemoryCache = exports.InMemoryCacheClass = void 0;
|
|
32
|
-
var Utils_1 = require("./Utils");
|
|
33
|
-
var StorageCache_1 = require("./StorageCache");
|
|
34
|
-
var Logger_1 = require("../Logger");
|
|
35
|
-
var AssertError_1 = require("../Util/errors/AssertError");
|
|
36
|
-
var Constants_1 = require("../Util/Constants");
|
|
37
|
-
var CacheUtils_1 = require("./Utils/CacheUtils");
|
|
38
|
-
var logger = new Logger_1.ConsoleLogger('InMemoryCache');
|
|
39
|
-
/**
|
|
40
|
-
* Customized in-memory cache with LRU implemented
|
|
41
|
-
* @member cacheObj - object which store items
|
|
42
|
-
* @member cacheList - list of keys in the cache with LRU
|
|
43
|
-
* @member curSizeInBytes - current size of the cache
|
|
44
|
-
* @member maxPriority - max of the priority
|
|
45
|
-
*/
|
|
46
|
-
var InMemoryCacheClass = /** @class */ (function (_super) {
|
|
47
|
-
__extends(InMemoryCacheClass, _super);
|
|
48
|
-
/**
|
|
49
|
-
* initialize the cache
|
|
50
|
-
*
|
|
51
|
-
* @param config - the configuration of the cache
|
|
52
|
-
*/
|
|
53
|
-
function InMemoryCacheClass(config) {
|
|
54
|
-
var _this = _super.call(this, config) || this;
|
|
55
|
-
_this.cacheList = [];
|
|
56
|
-
_this.curSizeInBytes = 0;
|
|
57
|
-
_this.maxPriority = 5;
|
|
58
|
-
_this.getItem = _this.getItem.bind(_this);
|
|
59
|
-
_this.setItem = _this.setItem.bind(_this);
|
|
60
|
-
_this.removeItem = _this.removeItem.bind(_this);
|
|
61
|
-
// initialize list for every priority
|
|
62
|
-
for (var i = 0; i < _this.maxPriority; i += 1) {
|
|
63
|
-
_this.cacheList[i] = new Utils_1.CacheList();
|
|
64
|
-
}
|
|
65
|
-
return _this;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* decrease current size of the cache
|
|
69
|
-
*
|
|
70
|
-
* @param amount - the amount of the cache size which needs to be decreased
|
|
71
|
-
*/
|
|
72
|
-
InMemoryCacheClass.prototype._decreaseCurSizeInBytes = function (amount) {
|
|
73
|
-
this.curSizeInBytes -= amount;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* increase current size of the cache
|
|
77
|
-
*
|
|
78
|
-
* @param amount - the amount of the cache szie which need to be increased
|
|
79
|
-
*/
|
|
80
|
-
InMemoryCacheClass.prototype._increaseCurSizeInBytes = function (amount) {
|
|
81
|
-
this.curSizeInBytes += amount;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* check whether item is expired
|
|
85
|
-
*
|
|
86
|
-
* @param key - the key of the item
|
|
87
|
-
*
|
|
88
|
-
* @return true if the item is expired.
|
|
89
|
-
*/
|
|
90
|
-
InMemoryCacheClass.prototype._isExpired = function (key) {
|
|
91
|
-
var text = Utils_1.CacheObject.getItem(key);
|
|
92
|
-
(0, AssertError_1.asserts)(text !== null, {
|
|
93
|
-
name: Constants_1.STORAGE_CACHE_EXCEPTION,
|
|
94
|
-
message: 'item from storage is null',
|
|
95
|
-
});
|
|
96
|
-
var item = JSON.parse(text);
|
|
97
|
-
if ((0, Utils_1.getCurrTime)() >= item.expires) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* delete item from cache
|
|
104
|
-
*
|
|
105
|
-
* @param prefixedKey - the key of the item
|
|
106
|
-
* @param listIdx - indicates which cache list the key belongs to
|
|
107
|
-
*/
|
|
108
|
-
InMemoryCacheClass.prototype._removeItem = function (prefixedKey, listIdx) {
|
|
109
|
-
// delete the key from the list
|
|
110
|
-
this.cacheList[listIdx].removeItem(prefixedKey);
|
|
111
|
-
// decrease the current size of the cache
|
|
112
|
-
var item = Utils_1.CacheObject.getItem(prefixedKey);
|
|
113
|
-
(0, AssertError_1.asserts)(item !== null, {
|
|
114
|
-
name: Constants_1.STORAGE_CACHE_EXCEPTION,
|
|
115
|
-
message: 'item from storage is null',
|
|
116
|
-
});
|
|
117
|
-
this._decreaseCurSizeInBytes(JSON.parse(item).byteSize);
|
|
118
|
-
// finally remove the item from memory
|
|
119
|
-
Utils_1.CacheObject.removeItem(prefixedKey);
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* put item into cache
|
|
123
|
-
*
|
|
124
|
-
* @param prefixedKey - the key of the item
|
|
125
|
-
* @param itemData - the value of the item
|
|
126
|
-
* @param itemSizeInBytes - the byte size of the item
|
|
127
|
-
* @param listIdx - indicates which cache list the key belongs to
|
|
128
|
-
*/
|
|
129
|
-
InMemoryCacheClass.prototype._setItem = function (prefixedKey, item, listIdx) {
|
|
130
|
-
// insert the key into the list
|
|
131
|
-
this.cacheList[listIdx].insertItem(prefixedKey);
|
|
132
|
-
// increase the current size of the cache
|
|
133
|
-
this._increaseCurSizeInBytes(item.byteSize);
|
|
134
|
-
// finally add the item into memory
|
|
135
|
-
Utils_1.CacheObject.setItem(prefixedKey, JSON.stringify(item));
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* see whether cache is full
|
|
139
|
-
*
|
|
140
|
-
* @param itemSize
|
|
141
|
-
*
|
|
142
|
-
* @return true if cache is full
|
|
143
|
-
*/
|
|
144
|
-
InMemoryCacheClass.prototype._isCacheFull = function (itemSize) {
|
|
145
|
-
return this.curSizeInBytes + itemSize > this.cacheConfig.capacityInBytes;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* check whether the cache contains the key
|
|
149
|
-
*
|
|
150
|
-
* @param key
|
|
151
|
-
*/
|
|
152
|
-
InMemoryCacheClass.prototype.containsKey = function (key) {
|
|
153
|
-
var prefixedKey = this.cacheConfig.keyPrefix + key;
|
|
154
|
-
for (var i = 0; i < this.maxPriority; i += 1) {
|
|
155
|
-
if (this.cacheList[i].containsKey(prefixedKey)) {
|
|
156
|
-
return i + 1;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return -1;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* * Set item into cache. You can put number, string, boolean or object.
|
|
163
|
-
* The cache will first check whether has the same key.
|
|
164
|
-
* If it has, it will delete the old item and then put the new item in
|
|
165
|
-
* The cache will pop out items if it is full
|
|
166
|
-
* You can specify the cache item options. The cache will abort and output a warning:
|
|
167
|
-
* If the key is invalid
|
|
168
|
-
* If the size of the item exceeds itemMaxSize.
|
|
169
|
-
* If the value is undefined
|
|
170
|
-
* If incorrect cache item configuration
|
|
171
|
-
* If error happened with browser storage
|
|
172
|
-
*
|
|
173
|
-
* @param key - the key of the item
|
|
174
|
-
* @param value - the value of the item
|
|
175
|
-
* @param options - optional, the specified meta-data
|
|
176
|
-
*
|
|
177
|
-
* @throws if the item is too big which exceeds the limit of single item size
|
|
178
|
-
* @throws if the key is invalid
|
|
179
|
-
*/
|
|
180
|
-
InMemoryCacheClass.prototype.setItem = function (key, value, options) {
|
|
181
|
-
var prefixedKey = this.cacheConfig.keyPrefix + key;
|
|
182
|
-
// invalid keys
|
|
183
|
-
if (prefixedKey === this.cacheConfig.keyPrefix ||
|
|
184
|
-
prefixedKey === (0, CacheUtils_1.getCurrSizeKey)(this.cacheConfig.keyPrefix)) {
|
|
185
|
-
logger.warn("Invalid key: should not be empty or 'CurSize'");
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (typeof value === 'undefined') {
|
|
189
|
-
logger.warn("The value of item should not be undefined!");
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
var cacheItemOptions = {
|
|
193
|
-
priority: options && options.priority !== undefined
|
|
194
|
-
? options.priority
|
|
195
|
-
: this.cacheConfig.defaultPriority,
|
|
196
|
-
expires: options && options.expires !== undefined
|
|
197
|
-
? options.expires
|
|
198
|
-
: this.cacheConfig.defaultTTL + (0, Utils_1.getCurrTime)(),
|
|
199
|
-
};
|
|
200
|
-
if (cacheItemOptions.priority < 1 || cacheItemOptions.priority > 5) {
|
|
201
|
-
logger.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
var item = this.fillCacheItem(prefixedKey, value, cacheItemOptions);
|
|
205
|
-
// check wether this item is too big;
|
|
206
|
-
if (item.byteSize > this.cacheConfig.itemMaxSize) {
|
|
207
|
-
logger.warn("Item with key: ".concat(key, " you are trying to put into is too big!"));
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
// if key already in the cache, then delete it.
|
|
211
|
-
var presentKeyPrio = this.containsKey(key);
|
|
212
|
-
if (presentKeyPrio !== -1) {
|
|
213
|
-
this._removeItem(prefixedKey, presentKeyPrio - 1);
|
|
214
|
-
}
|
|
215
|
-
// pop out items in the cache when cache is full based on LRU
|
|
216
|
-
// first start from lowest priority cache list
|
|
217
|
-
var cacheListIdx = this.maxPriority - 1;
|
|
218
|
-
while (this._isCacheFull(item.byteSize) && cacheListIdx >= 0) {
|
|
219
|
-
if (!this.cacheList[cacheListIdx].isEmpty()) {
|
|
220
|
-
var popedItemKey = this.cacheList[cacheListIdx].getLastItem();
|
|
221
|
-
this._removeItem(popedItemKey, cacheListIdx);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
cacheListIdx -= 1;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
this._setItem(prefixedKey, item, Number(item.priority) - 1);
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* Get item from cache. It will return null if item doesn’t exist or it has been expired.
|
|
231
|
-
* If you specified callback function in the options,
|
|
232
|
-
* then the function will be executed if no such item in the cache
|
|
233
|
-
* and finally put the return value into cache.
|
|
234
|
-
* Please make sure the callback function will return the value you want to put into the cache.
|
|
235
|
-
* The cache will abort output a warning:
|
|
236
|
-
* If the key is invalid
|
|
237
|
-
*
|
|
238
|
-
* @param key - the key of the item
|
|
239
|
-
* @param options - the options of callback function
|
|
240
|
-
*/
|
|
241
|
-
InMemoryCacheClass.prototype.getItem = function (key, options) {
|
|
242
|
-
var _a;
|
|
243
|
-
var ret = null;
|
|
244
|
-
var prefixedKey = this.cacheConfig.keyPrefix + key;
|
|
245
|
-
if (prefixedKey === this.cacheConfig.keyPrefix ||
|
|
246
|
-
prefixedKey === (0, CacheUtils_1.getCurrSizeKey)(this.cacheConfig.keyPrefix)) {
|
|
247
|
-
logger.warn("Invalid key: should not be empty or 'CurSize'");
|
|
248
|
-
return null;
|
|
249
|
-
}
|
|
250
|
-
// check whether it's in the cachelist
|
|
251
|
-
var presentKeyPrio = this.containsKey(key);
|
|
252
|
-
if (presentKeyPrio !== -1) {
|
|
253
|
-
if (this._isExpired(prefixedKey)) {
|
|
254
|
-
// if expired, remove that item and return null
|
|
255
|
-
this._removeItem(prefixedKey, presentKeyPrio - 1);
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
// if not expired, great, return the value and refresh it
|
|
259
|
-
ret = (_a = Utils_1.CacheObject.getItem(prefixedKey)) !== null && _a !== void 0 ? _a : '';
|
|
260
|
-
var item = JSON.parse(ret);
|
|
261
|
-
this.cacheList[item.priority - 1].refresh(prefixedKey);
|
|
262
|
-
return item.data;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (options && options.callback !== undefined) {
|
|
266
|
-
var val = options.callback();
|
|
267
|
-
if (val !== null) {
|
|
268
|
-
this.setItem(key, val, options);
|
|
269
|
-
}
|
|
270
|
-
return val;
|
|
271
|
-
}
|
|
272
|
-
return null;
|
|
273
|
-
};
|
|
274
|
-
/**
|
|
275
|
-
* remove item from the cache
|
|
276
|
-
*
|
|
277
|
-
* @param key - the key of the item
|
|
278
|
-
*/
|
|
279
|
-
InMemoryCacheClass.prototype.removeItem = function (key) {
|
|
280
|
-
var prefixedKey = this.cacheConfig.keyPrefix + key;
|
|
281
|
-
// check if the key is in the cache
|
|
282
|
-
var presentKeyPrio = this.containsKey(key);
|
|
283
|
-
if (presentKeyPrio !== -1) {
|
|
284
|
-
this._removeItem(prefixedKey, presentKeyPrio - 1);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* clear the entire cache
|
|
289
|
-
*/
|
|
290
|
-
InMemoryCacheClass.prototype.clear = function () {
|
|
291
|
-
var e_1, _a;
|
|
292
|
-
for (var i = 0; i < this.maxPriority; i += 1) {
|
|
293
|
-
try {
|
|
294
|
-
for (var _b = (e_1 = void 0, __values(this.cacheList[i].getKeys())), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
295
|
-
var key = _c.value;
|
|
296
|
-
this._removeItem(key, i);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
300
|
-
finally {
|
|
301
|
-
try {
|
|
302
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
303
|
-
}
|
|
304
|
-
finally { if (e_1) throw e_1.error; }
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
/**
|
|
309
|
-
* Return all the keys in the cache.
|
|
310
|
-
*/
|
|
311
|
-
InMemoryCacheClass.prototype.getAllKeys = function () {
|
|
312
|
-
var e_2, _a;
|
|
313
|
-
var keys = [];
|
|
314
|
-
for (var i = 0; i < this.maxPriority; i += 1) {
|
|
315
|
-
try {
|
|
316
|
-
for (var _b = (e_2 = void 0, __values(this.cacheList[i].getKeys())), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
317
|
-
var key = _c.value;
|
|
318
|
-
keys.push(key.substring(this.cacheConfig.keyPrefix.length));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
322
|
-
finally {
|
|
323
|
-
try {
|
|
324
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
325
|
-
}
|
|
326
|
-
finally { if (e_2) throw e_2.error; }
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return keys;
|
|
330
|
-
};
|
|
331
|
-
/**
|
|
332
|
-
* return the current size of the cache
|
|
333
|
-
*
|
|
334
|
-
* @return the current size of the cache
|
|
335
|
-
*/
|
|
336
|
-
InMemoryCacheClass.prototype.getCacheCurSize = function () {
|
|
337
|
-
return this.curSizeInBytes;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Return a new instance of cache with customized configuration.
|
|
341
|
-
* @param config - the customized configuration
|
|
342
|
-
*/
|
|
343
|
-
InMemoryCacheClass.prototype.createInstance = function (config) {
|
|
344
|
-
return new InMemoryCacheClass(config);
|
|
345
|
-
};
|
|
346
|
-
return InMemoryCacheClass;
|
|
347
|
-
}(StorageCache_1.StorageCache));
|
|
348
|
-
exports.InMemoryCacheClass = InMemoryCacheClass;
|
|
349
|
-
exports.InMemoryCache = new InMemoryCacheClass();
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CacheConfig } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Default cache config
|
|
4
|
-
*/
|
|
5
|
-
export declare const defaultConfig: CacheConfig;
|
|
6
|
-
/**
|
|
7
|
-
* return the byte size of the string
|
|
8
|
-
* @param str
|
|
9
|
-
*/
|
|
10
|
-
export declare function getByteLength(str: string): number;
|
|
11
|
-
/**
|
|
12
|
-
* get current time
|
|
13
|
-
*/
|
|
14
|
-
export declare function getCurrTime(): number;
|
|
15
|
-
/**
|
|
16
|
-
* check if passed value is an integer
|
|
17
|
-
*/
|
|
18
|
-
export declare function isInteger(value?: number): boolean;
|
|
19
|
-
export declare class CacheObject {
|
|
20
|
-
static clear(): void;
|
|
21
|
-
static getItem(key: string): string | null;
|
|
22
|
-
static setItem(key: string, value: string): void;
|
|
23
|
-
static removeItem(key: string): void;
|
|
24
|
-
}
|
|
25
|
-
export declare const getCurrSizeKey: (keyPrefix: string) => string;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getCurrSizeKey = exports.CacheObject = exports.isInteger = exports.getCurrTime = exports.getByteLength = exports.defaultConfig = void 0;
|
|
6
|
-
var StorageHelper_1 = require("../../StorageHelper");
|
|
7
|
-
/**
|
|
8
|
-
* Default cache config
|
|
9
|
-
*/
|
|
10
|
-
exports.defaultConfig = {
|
|
11
|
-
keyPrefix: 'aws-amplify-cache',
|
|
12
|
-
capacityInBytes: 1048576,
|
|
13
|
-
itemMaxSize: 210000,
|
|
14
|
-
defaultTTL: 259200000,
|
|
15
|
-
defaultPriority: 5,
|
|
16
|
-
warningThreshold: 0.8,
|
|
17
|
-
// the storage helper will check if localStorage exists,
|
|
18
|
-
// if not, will use a in-memory object instead
|
|
19
|
-
storage: new StorageHelper_1.StorageHelper().getStorage(),
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* return the byte size of the string
|
|
23
|
-
* @param str
|
|
24
|
-
*/
|
|
25
|
-
function getByteLength(str) {
|
|
26
|
-
var ret = 0;
|
|
27
|
-
ret = str.length;
|
|
28
|
-
for (var i = str.length; i >= 0; i -= 1) {
|
|
29
|
-
var charCode = str.charCodeAt(i);
|
|
30
|
-
if (charCode > 0x7f && charCode <= 0x7ff) {
|
|
31
|
-
ret += 1;
|
|
32
|
-
}
|
|
33
|
-
else if (charCode > 0x7ff && charCode <= 0xffff) {
|
|
34
|
-
ret += 2;
|
|
35
|
-
}
|
|
36
|
-
// trail surrogate
|
|
37
|
-
if (charCode >= 0xdc00 && charCode <= 0xdfff) {
|
|
38
|
-
i -= 1;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return ret;
|
|
42
|
-
}
|
|
43
|
-
exports.getByteLength = getByteLength;
|
|
44
|
-
/**
|
|
45
|
-
* get current time
|
|
46
|
-
*/
|
|
47
|
-
function getCurrTime() {
|
|
48
|
-
var currTime = new Date();
|
|
49
|
-
return currTime.getTime();
|
|
50
|
-
}
|
|
51
|
-
exports.getCurrTime = getCurrTime;
|
|
52
|
-
/**
|
|
53
|
-
* check if passed value is an integer
|
|
54
|
-
*/
|
|
55
|
-
function isInteger(value) {
|
|
56
|
-
if (Number.isInteger) {
|
|
57
|
-
return Number.isInteger(value);
|
|
58
|
-
}
|
|
59
|
-
return _isInteger(value);
|
|
60
|
-
}
|
|
61
|
-
exports.isInteger = isInteger;
|
|
62
|
-
function _isInteger(value) {
|
|
63
|
-
return (typeof value === 'number' && isFinite(value) && Math.floor(value) === value);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* provide an object as the in-memory cache
|
|
67
|
-
*/
|
|
68
|
-
var store = {};
|
|
69
|
-
var CacheObject = /** @class */ (function () {
|
|
70
|
-
function CacheObject() {
|
|
71
|
-
}
|
|
72
|
-
CacheObject.clear = function () {
|
|
73
|
-
store = {};
|
|
74
|
-
};
|
|
75
|
-
CacheObject.getItem = function (key) {
|
|
76
|
-
return store[key] || null;
|
|
77
|
-
};
|
|
78
|
-
CacheObject.setItem = function (key, value) {
|
|
79
|
-
store[key] = value;
|
|
80
|
-
};
|
|
81
|
-
CacheObject.removeItem = function (key) {
|
|
82
|
-
delete store[key];
|
|
83
|
-
};
|
|
84
|
-
return CacheObject;
|
|
85
|
-
}());
|
|
86
|
-
exports.CacheObject = CacheObject;
|
|
87
|
-
var getCurrSizeKey = function (keyPrefix) { return keyPrefix + 'CurSize'; };
|
|
88
|
-
exports.getCurrSizeKey = getCurrSizeKey;
|
package/lib/Cache/Utils/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.CacheList = exports.isInteger = exports.getCurrTime = exports.getByteLength = exports.defaultConfig = exports.CacheObject = void 0;
|
|
9
|
-
var CacheUtils_1 = require("./CacheUtils");
|
|
10
|
-
Object.defineProperty(exports, "CacheObject", { enumerable: true, get: function () { return CacheUtils_1.CacheObject; } });
|
|
11
|
-
Object.defineProperty(exports, "defaultConfig", { enumerable: true, get: function () { return CacheUtils_1.defaultConfig; } });
|
|
12
|
-
Object.defineProperty(exports, "getByteLength", { enumerable: true, get: function () { return CacheUtils_1.getByteLength; } });
|
|
13
|
-
Object.defineProperty(exports, "getCurrTime", { enumerable: true, get: function () { return CacheUtils_1.getCurrTime; } });
|
|
14
|
-
Object.defineProperty(exports, "isInteger", { enumerable: true, get: function () { return CacheUtils_1.isInteger; } });
|
|
15
|
-
var CacheList_1 = require("./CacheList");
|
|
16
|
-
Object.defineProperty(exports, "CacheList", { enumerable: true, get: function () { return __importDefault(CacheList_1).default; } });
|
package/lib/Cache/reactnative.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.Cache = exports.AsyncStorageCache = void 0;
|
|
6
|
-
var AsyncStorageCache_1 = require("./AsyncStorageCache");
|
|
7
|
-
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return AsyncStorageCache_1.Cache; } });
|
|
8
|
-
Object.defineProperty(exports, "AsyncStorageCache", { enumerable: true, get: function () { return AsyncStorageCache_1.AsyncStorageCache; } });
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Interface
|
|
3
|
-
*/
|
|
4
|
-
export interface ICache {
|
|
5
|
-
/** Put item into cache */
|
|
6
|
-
setItem(key: string, value: any, options?: CacheItemOptions): void;
|
|
7
|
-
/** Get item from cache */
|
|
8
|
-
getItem(key: string, options?: CacheItemOptions): any;
|
|
9
|
-
/** Remove item from cache */
|
|
10
|
-
removeItem(key: string): void;
|
|
11
|
-
/** Remove all items from cache */
|
|
12
|
-
clear(): void;
|
|
13
|
-
/** Get all keys form cache */
|
|
14
|
-
getAllKeys(): string[] | Promise<string[]>;
|
|
15
|
-
/** Get current size of the cache */
|
|
16
|
-
getCacheCurSize(): number | Promise<number>;
|
|
17
|
-
/** create a new instance with customized config */
|
|
18
|
-
createInstance(config: CacheConfig): ICache;
|
|
19
|
-
/** change current configuration */
|
|
20
|
-
configure(config: CacheConfig): CacheConfig;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Cache instance options
|
|
24
|
-
*/
|
|
25
|
-
export interface CacheConfig {
|
|
26
|
-
/** Prepend to key to avoid conflicts */
|
|
27
|
-
keyPrefix: string;
|
|
28
|
-
/** Cache capacity, in bytes */
|
|
29
|
-
capacityInBytes: number;
|
|
30
|
-
/** Max size of one item */
|
|
31
|
-
itemMaxSize: number;
|
|
32
|
-
/** Time to live, in milliseconds */
|
|
33
|
-
defaultTTL: number;
|
|
34
|
-
/** Warn when over threshold percentage of capacity, maximum 1 */
|
|
35
|
-
warningThreshold: number;
|
|
36
|
-
/** default priority number put on cached items */
|
|
37
|
-
defaultPriority: number;
|
|
38
|
-
storage?: Storage;
|
|
39
|
-
Cache?: Cache;
|
|
40
|
-
}
|
|
41
|
-
export interface CacheItem {
|
|
42
|
-
key: string;
|
|
43
|
-
data: any;
|
|
44
|
-
timestamp: number;
|
|
45
|
-
visitedTime: number;
|
|
46
|
-
priority: number;
|
|
47
|
-
expires: number;
|
|
48
|
-
type: string;
|
|
49
|
-
byteSize: number;
|
|
50
|
-
}
|
|
51
|
-
export interface CacheItemOptions {
|
|
52
|
-
priority?: number;
|
|
53
|
-
expires?: number;
|
|
54
|
-
callback?: Function;
|
|
55
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare class ClientDevice {
|
|
2
|
-
static clientInfo(): {
|
|
3
|
-
platform?: undefined;
|
|
4
|
-
make?: undefined;
|
|
5
|
-
model?: undefined;
|
|
6
|
-
version?: undefined;
|
|
7
|
-
appVersion?: undefined;
|
|
8
|
-
language?: undefined;
|
|
9
|
-
timezone?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
platform: string;
|
|
12
|
-
make: string;
|
|
13
|
-
model: string;
|
|
14
|
-
version: string;
|
|
15
|
-
appVersion: string;
|
|
16
|
-
language: string;
|
|
17
|
-
timezone: string;
|
|
18
|
-
};
|
|
19
|
-
static dimension(): {
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.ClientDevice = void 0;
|
|
6
|
-
var browser_1 = require("./browser");
|
|
7
|
-
var ClientDevice = /** @class */ (function () {
|
|
8
|
-
function ClientDevice() {
|
|
9
|
-
}
|
|
10
|
-
ClientDevice.clientInfo = function () {
|
|
11
|
-
return (0, browser_1.clientInfo)();
|
|
12
|
-
};
|
|
13
|
-
ClientDevice.dimension = function () {
|
|
14
|
-
return (0, browser_1.dimension)();
|
|
15
|
-
};
|
|
16
|
-
return ClientDevice;
|
|
17
|
-
}());
|
|
18
|
-
exports.ClientDevice = ClientDevice;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientDevice = void 0;
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
// @ts-ignore: missing type definition
|
|
7
|
-
var react_native_1 = require("react-native");
|
|
8
|
-
var ios_1 = require("./ios");
|
|
9
|
-
var android_1 = require("./android");
|
|
10
|
-
var OS = react_native_1.Platform.OS;
|
|
11
|
-
var ClientDevice = /** @class */ (function () {
|
|
12
|
-
function ClientDevice() {
|
|
13
|
-
}
|
|
14
|
-
ClientDevice.clientInfo = function () {
|
|
15
|
-
if (OS === 'ios') {
|
|
16
|
-
return (0, ios_1.clientInfo)();
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return (0, android_1.clientInfo)();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
return ClientDevice;
|
|
23
|
-
}());
|
|
24
|
-
exports.ClientDevice = ClientDevice;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.AsyncStorage = exports.AppState = exports.Linking = void 0;
|
|
6
|
-
var JS_1 = require("../Util/JS");
|
|
7
|
-
var StorageHelper_1 = require("../StorageHelper");
|
|
8
|
-
exports.Linking = {};
|
|
9
|
-
exports.AppState = {
|
|
10
|
-
addEventListener: function (action, handler) { return undefined; },
|
|
11
|
-
currentState: 'active',
|
|
12
|
-
};
|
|
13
|
-
// if not in react native, just use local storage
|
|
14
|
-
exports.AsyncStorage = (0, JS_1.isBrowser)()
|
|
15
|
-
? new StorageHelper_1.StorageHelper().getStorage()
|
|
16
|
-
: undefined;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AsyncStorage = exports.AppState = exports.Linking = void 0;
|
|
7
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
var react_native_1 = require("react-native");
|
|
11
|
-
Object.defineProperty(exports, "Linking", { enumerable: true, get: function () { return react_native_1.Linking; } });
|
|
12
|
-
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return react_native_1.AppState; } });
|
|
13
|
-
var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
14
|
-
exports.AsyncStorage = async_storage_1.default;
|