@aws-amplify/core 6.0.1-api-v6-models.8035dfc.0 → 6.0.1-api-v6-models.572a7b5.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/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-esm/Cache/AsyncStorageCache.d.ts → lib/Cache/StorageCacheCommon.d.ts} +124 -99
- package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -432
- 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 +2 -1
- package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib/Cache/utils/cacheHelpers.js +51 -0
- package/lib/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
- package/lib/Cache/{Utils → utils}/errorHelpers.js +0 -4
- package/lib/Cache/utils/index.d.ts +2 -0
- package/lib/Cache/utils/index.js +12 -0
- package/lib/I18n/I18n.js +1 -6
- package/lib/Platform/types.d.ts +18 -8
- package/lib/Platform/types.js +10 -2
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Reachability/Reachability.d.ts +1 -0
- package/lib/Reachability/Reachability.js +42 -1
- package/lib/ServiceWorker/ServiceWorker.js +69 -17
- package/lib/ServiceWorker/index.d.ts +0 -12
- package/lib/ServiceWorker/index.js +0 -12
- package/lib/Signer/Signer.js +3 -2
- package/lib/awsClients/cognitoIdentity/base.js +2 -1
- package/lib/awsClients/pinpoint/base.js +2 -1
- package/lib/awsClients/pinpoint/getInAppMessages.js +2 -1
- package/lib/awsClients/pinpoint/putEvents.js +2 -1
- package/lib/awsClients/pinpoint/updateEndpoint.js +2 -1
- package/lib/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
- package/lib/errors/errorHelpers.d.ts +2 -0
- package/lib/errors/errorHelpers.js +20 -0
- package/lib/errors/index.d.ts +1 -0
- package/lib/errors/index.js +3 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +9 -6
- package/lib/libraryUtils.d.ts +8 -7
- package/lib/libraryUtils.js +17 -17
- package/lib/parseAWSExports.js +34 -19
- package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -2
- 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.js +6 -6
- package/lib/providers/pinpoint/index.d.ts +2 -2
- package/lib/providers/pinpoint/index.js +4 -2
- 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 +3 -3
- package/lib/providers/pinpoint/utils/index.d.ts +1 -0
- package/lib/providers/pinpoint/utils/index.js +3 -1
- package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
- package/lib/providers/pinpoint/utils/resolveEndpointId.js +85 -0
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +6 -5
- package/lib/singleton/Auth/types.d.ts +3 -3
- package/lib/singleton/Cache/types.d.ts +18 -0
- package/lib/singleton/Cache/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/PushNotification/types.d.ts +2 -0
- package/lib/singleton/Notifications/PushNotification/types.js +4 -0
- package/lib/singleton/Notifications/types.d.ts +3 -1
- package/lib/singleton/types.d.ts +3 -3
- package/lib/storage/CookieStorage.js +8 -5
- package/lib/storage/DefaultStorage.js +1 -1
- package/lib/storage/utils.d.ts +1 -1
- package/lib/storage/utils.js +3 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/errors.d.ts +1 -0
- package/lib/types/errors.js +1 -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/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/deepFreeze.d.ts +1 -0
- package/lib/utils/deepFreeze.js +38 -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/{ClientDevice/browser.d.ts → 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/index.d.ts +2 -0
- package/lib/utils/index.js +5 -1
- 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-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/Cache/AsyncStorageCache.d.ts → lib-esm/Cache/StorageCacheCommon.d.ts} +124 -99
- package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +493 -430
- 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 +1 -1
- package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
- package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
- package/lib-esm/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
- package/lib-esm/Cache/{Utils → utils}/errorHelpers.js +0 -4
- package/lib-esm/Cache/utils/index.d.ts +2 -0
- package/lib-esm/Cache/utils/index.js +4 -0
- package/lib-esm/I18n/I18n.js +1 -6
- package/lib-esm/Platform/types.d.ts +18 -8
- package/lib-esm/Platform/types.js +10 -2
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Reachability/Reachability.d.ts +1 -0
- package/lib-esm/Reachability/Reachability.js +43 -2
- package/lib-esm/ServiceWorker/ServiceWorker.js +69 -17
- package/lib-esm/ServiceWorker/index.d.ts +0 -12
- package/lib-esm/ServiceWorker/index.js +0 -12
- package/lib-esm/Signer/Signer.js +3 -2
- package/lib-esm/awsClients/cognitoIdentity/base.js +2 -1
- package/lib-esm/awsClients/pinpoint/base.js +2 -1
- package/lib-esm/awsClients/pinpoint/getInAppMessages.js +2 -1
- package/lib-esm/awsClients/pinpoint/putEvents.js +2 -1
- package/lib-esm/awsClients/pinpoint/updateEndpoint.js +2 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
- package/lib-esm/errors/errorHelpers.d.ts +2 -0
- package/lib-esm/errors/errorHelpers.js +17 -0
- package/lib-esm/errors/index.d.ts +1 -0
- package/lib-esm/errors/index.js +1 -0
- package/lib-esm/index.d.ts +4 -4
- package/lib-esm/index.js +5 -4
- package/lib-esm/libraryUtils.d.ts +8 -7
- package/lib-esm/libraryUtils.js +7 -7
- package/lib-esm/parseAWSExports.js +34 -19
- package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -2
- 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.js +6 -6
- package/lib-esm/providers/pinpoint/index.d.ts +2 -2
- package/lib-esm/providers/pinpoint/index.js +2 -1
- 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 +3 -3
- 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/resolveEndpointId.d.ts +8 -0
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
- package/lib-esm/singleton/Amplify.d.ts +2 -2
- package/lib-esm/singleton/Amplify.js +6 -5
- package/lib-esm/singleton/Auth/types.d.ts +3 -3
- package/lib-esm/singleton/Cache/types.d.ts +18 -0
- package/lib-esm/singleton/Cache/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/PushNotification/types.d.ts +2 -0
- package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
- package/lib-esm/singleton/Notifications/types.d.ts +3 -1
- package/lib-esm/singleton/types.d.ts +3 -3
- package/lib-esm/storage/CookieStorage.js +5 -5
- package/lib-esm/storage/DefaultStorage.js +2 -2
- package/lib-esm/storage/utils.d.ts +1 -1
- package/lib-esm/storage/utils.js +1 -1
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/errors.d.ts +1 -0
- package/lib-esm/types/errors.js +1 -0
- package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
- package/lib-esm/utils/amplifyUrl/index.js +6 -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.native.js +4 -0
- package/lib-esm/utils/deepFreeze.d.ts +1 -0
- package/lib-esm/utils/deepFreeze.js +34 -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-esm/{ClientDevice/browser.d.ts → 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/index.d.ts +2 -0
- package/lib-esm/utils/index.js +2 -0
- 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/package.json +9 -19
- 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 -185
- package/src/Cache/utils/cacheHelpers.ts +52 -0
- package/src/Cache/{Utils → utils}/errorHelpers.ts +0 -4
- package/src/Cache/{Utils → utils}/index.ts +4 -5
- package/src/I18n/I18n.ts +1 -6
- package/src/Platform/types.ts +20 -11
- package/src/Platform/version.ts +1 -1
- package/src/Reachability/Reachability.ts +22 -2
- package/src/ServiceWorker/ServiceWorker.ts +20 -17
- package/src/ServiceWorker/index.ts +0 -12
- package/src/Signer/Signer.ts +3 -2
- package/src/awsClients/cognitoIdentity/base.ts +4 -1
- package/src/awsClients/pinpoint/base.ts +2 -1
- package/src/awsClients/pinpoint/getInAppMessages.ts +2 -1
- package/src/awsClients/pinpoint/putEvents.ts +2 -1
- package/src/awsClients/pinpoint/updateEndpoint.ts +2 -1
- package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -2
- package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
- package/src/errors/errorHelpers.ts +20 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +8 -4
- package/src/libraryUtils.ts +17 -11
- package/src/parseAWSExports.ts +28 -9
- package/src/providers/pinpoint/apis/flushEvents.ts +2 -2
- package/src/providers/pinpoint/apis/record.ts +14 -28
- package/src/providers/pinpoint/apis/updateEndpoint.ts +6 -6
- package/src/providers/pinpoint/index.ts +6 -2
- 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 +3 -2
- package/src/providers/pinpoint/utils/index.ts +1 -0
- package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
- package/src/singleton/Amplify.ts +10 -8
- package/src/singleton/Auth/types.ts +3 -3
- package/src/singleton/Cache/types.ts +27 -0
- package/src/singleton/Interactions/types.ts +29 -0
- package/src/singleton/Notifications/PushNotification/types.ts +6 -0
- package/src/singleton/Notifications/types.ts +3 -1
- package/src/singleton/types.ts +3 -5
- package/src/storage/CookieStorage.ts +5 -9
- package/src/storage/DefaultStorage.ts +2 -2
- package/src/storage/utils.ts +1 -1
- package/src/types/errors.ts +1 -0
- package/src/utils/amplifyUrl/index.ts +9 -0
- package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.ts → utils/amplifyUrl/polyfill.native.ts} +1 -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/deepFreeze.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/index.ts +2 -0
- 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/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 -456
- package/lib/Cache/InMemoryCache.d.ts +0 -129
- package/lib/Cache/InMemoryCache.js +0 -342
- package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
- package/lib/Cache/Utils/CacheUtils.js +0 -86
- 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-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 -453
- package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
- package/lib-esm/Cache/InMemoryCache.js +0 -339
- package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
- package/lib-esm/Cache/Utils/CacheUtils.js +0 -79
- 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/src/Amplify.ts +0 -106
- package/src/Cache/AsyncStorageCache.ts +0 -495
- package/src/Cache/BrowserStorageCache.ts +0 -504
- package/src/Cache/CHANGELOG.md +0 -1239
- package/src/Cache/InMemoryCache.ts +0 -347
- package/src/Cache/Utils/CacheUtils.ts +0 -90
- 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/lib/Cache/types/{Cache.js → cache.js} +0 -0
- package/lib/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +1 -1
- /package/lib-esm/Cache/types/{Cache.js → cache.js} +0 -0
- /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → utils/amplifyUrl/polyfill.d.ts} +0 -0
- /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.js → utils/amplifyUrl/polyfill.js} +0 -0
- /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → utils/amplifyUrl/polyfill.native.d.ts} +0 -0
- /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +0 -0
- /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → lib-esm/utils/amplifyUuid/polyfill.d.ts} +0 -0
- /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.js → lib-esm/utils/amplifyUuid/polyfill.js} +0 -0
- /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → lib-esm/utils/amplifyUuid/polyfill.native.d.ts} +0 -0
- /package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.ts → utils/amplifyUrl/polyfill.ts} +0 -0
package/lib-esm/types/errors.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export var AmplifyErrorCode;
|
|
4
4
|
(function (AmplifyErrorCode) {
|
|
5
|
+
AmplifyErrorCode["NoEndpointId"] = "NoEndpointId";
|
|
5
6
|
AmplifyErrorCode["PlatformNotSupported"] = "PlatformNotSupported";
|
|
6
7
|
AmplifyErrorCode["Unknown"] = "Unknown";
|
|
7
8
|
})(AmplifyErrorCode || (AmplifyErrorCode = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './polyfill';
|
|
2
|
+
declare const AmplifyUrl: {
|
|
3
|
+
new (url: string | URL, base?: string | URL | undefined): URL;
|
|
4
|
+
prototype: URL;
|
|
5
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
revokeObjectURL(url: string): void;
|
|
7
|
+
};
|
|
8
|
+
declare const AmplifyUrlSearchParams: {
|
|
9
|
+
new (init?: string | URLSearchParams | Record<string, string> | string[][] | undefined): URLSearchParams;
|
|
10
|
+
prototype: URLSearchParams;
|
|
11
|
+
toString(): string;
|
|
12
|
+
};
|
|
13
|
+
export { AmplifyUrl, AmplifyUrlSearchParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deepFreeze: (object: any) => any;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __values = (this && this.__values) || function(o) {
|
|
4
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
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
|
+
export var deepFreeze = function (object) {
|
|
15
|
+
var e_1, _a;
|
|
16
|
+
var propNames = Reflect.ownKeys(object);
|
|
17
|
+
try {
|
|
18
|
+
for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
|
|
19
|
+
var name_1 = propNames_1_1.value;
|
|
20
|
+
var value = object[name_1];
|
|
21
|
+
if ((value && typeof value === 'object') || typeof value === 'function') {
|
|
22
|
+
deepFreeze(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
27
|
+
finally {
|
|
28
|
+
try {
|
|
29
|
+
if (propNames_1_1 && !propNames_1_1.done && (_a = propNames_1.return)) _a.call(propNames_1);
|
|
30
|
+
}
|
|
31
|
+
finally { if (e_1) throw e_1.error; }
|
|
32
|
+
}
|
|
33
|
+
return Object.freeze(object);
|
|
34
|
+
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// @ts-ignore: missing type definition
|
|
4
4
|
import { Platform, Dimensions } from 'react-native';
|
|
5
|
-
import { ConsoleLogger as Logger } from '
|
|
5
|
+
import { ConsoleLogger as Logger } from '../../Logger';
|
|
6
6
|
var logger = new Logger('DeviceInfo');
|
|
7
|
-
export var
|
|
7
|
+
export var getClientInfo = function () {
|
|
8
8
|
var dim = Dimensions.get('screen');
|
|
9
9
|
logger.debug(Platform, dim);
|
|
10
10
|
var OS = 'android';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function getClientInfo(): {
|
|
2
2
|
platform?: undefined;
|
|
3
3
|
make?: undefined;
|
|
4
4
|
model?: undefined;
|
|
@@ -15,11 +15,3 @@ export declare function clientInfo(): {
|
|
|
15
15
|
language: string;
|
|
16
16
|
timezone: string;
|
|
17
17
|
};
|
|
18
|
-
export declare function dimension(): {
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
};
|
|
22
|
-
export declare function browserType(userAgent: string): {
|
|
23
|
-
type: string;
|
|
24
|
-
version: string;
|
|
25
|
-
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// @ts-ignore: missing type definition
|
|
4
4
|
import { Platform, Dimensions } from 'react-native';
|
|
5
|
-
import { ConsoleLogger as Logger } from '
|
|
5
|
+
import { ConsoleLogger as Logger } from '../../Logger';
|
|
6
6
|
var logger = new Logger('DeviceInfo');
|
|
7
|
-
export var
|
|
7
|
+
export var getClientInfo = function () {
|
|
8
8
|
var dim = Dimensions.get('screen');
|
|
9
9
|
logger.debug(Platform, dim);
|
|
10
10
|
var OS = 'ios';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { ConsoleLogger as Logger } from '
|
|
3
|
+
import { ConsoleLogger as Logger } from '../../Logger';
|
|
4
4
|
var logger = new Logger('ClientDevice_Browser');
|
|
5
|
-
export function
|
|
5
|
+
export function getClientInfo() {
|
|
6
6
|
if (typeof window === 'undefined') {
|
|
7
7
|
return {};
|
|
8
8
|
}
|
|
@@ -19,7 +19,7 @@ function browserClientInfo() {
|
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
21
|
var platform = nav.platform, product = nav.product, vendor = nav.vendor, userAgent = nav.userAgent, language = nav.language;
|
|
22
|
-
var type =
|
|
22
|
+
var type = getBrowserType(userAgent);
|
|
23
23
|
var timezone = browserTimezone();
|
|
24
24
|
return {
|
|
25
25
|
platform: platform,
|
|
@@ -31,21 +31,11 @@ function browserClientInfo() {
|
|
|
31
31
|
timezone: timezone,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
export function dimension() {
|
|
35
|
-
if (typeof window === 'undefined') {
|
|
36
|
-
logger.warn('No window object available to get browser client info');
|
|
37
|
-
return { width: 320, height: 320 };
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
width: window.innerWidth,
|
|
41
|
-
height: window.innerHeight,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
34
|
function browserTimezone() {
|
|
45
35
|
var tzMatch = /\(([A-Za-z\s].*)\)/.exec(new Date().toString());
|
|
46
36
|
return tzMatch ? tzMatch[1] || '' : '';
|
|
47
37
|
}
|
|
48
|
-
|
|
38
|
+
function getBrowserType(userAgent) {
|
|
49
39
|
var operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(userAgent);
|
|
50
40
|
if (operaMatch) {
|
|
51
41
|
return { type: operaMatch[1], version: operaMatch[2] };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getClientInfo } from './getClientInfo';
|
package/lib-esm/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { generateRandomString } from './generateRandomString';
|
|
2
|
+
export { getClientInfo } from './getClientInfo';
|
|
2
3
|
export { isBrowser } from './isBrowser';
|
|
3
4
|
export { isWebWorker } from './isWebWorker';
|
|
4
5
|
export { NonRetryableError, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, } from './retry';
|
|
5
6
|
export { urlSafeDecode } from './urlSafeDecode';
|
|
6
7
|
export { urlSafeEncode } from './urlSafeEncode';
|
|
8
|
+
export { deepFreeze } from './deepFreeze';
|
package/lib-esm/utils/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { generateRandomString } from './generateRandomString';
|
|
4
|
+
export { getClientInfo } from './getClientInfo';
|
|
4
5
|
export { isBrowser } from './isBrowser';
|
|
5
6
|
export { isWebWorker } from './isWebWorker';
|
|
6
7
|
export { NonRetryableError, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, } from './retry';
|
|
7
8
|
export { urlSafeDecode } from './urlSafeDecode';
|
|
8
9
|
export { urlSafeEncode } from './urlSafeEncode';
|
|
10
|
+
export { deepFreeze } from './deepFreeze';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionStateChangeListener, SessionListenerInterface } from './types';
|
|
2
|
+
export declare class SessionListener implements SessionListenerInterface {
|
|
3
|
+
private listenerActive;
|
|
4
|
+
constructor();
|
|
5
|
+
addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
|
|
6
|
+
removeStateChangeListener(handler: SessionStateChangeListener): void;
|
|
7
|
+
private handleVisibilityChange;
|
|
8
|
+
private notifyHandlers;
|
|
9
|
+
private getSessionState;
|
|
10
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { isBrowser } from '../isBrowser';
|
|
4
|
+
var stateChangeListeners = new Set();
|
|
5
|
+
var SessionListener = /** @class */ (function () {
|
|
6
|
+
function SessionListener() {
|
|
7
|
+
this.listenerActive = false;
|
|
8
|
+
this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
|
|
9
|
+
// Setup state listeners
|
|
10
|
+
if (isBrowser()) {
|
|
11
|
+
document.addEventListener('visibilitychange', this.handleVisibilityChange, false);
|
|
12
|
+
this.listenerActive = true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
|
|
16
|
+
if (notifyOnAdd === void 0) { notifyOnAdd = false; }
|
|
17
|
+
// No-op if document listener is not active
|
|
18
|
+
if (!this.listenerActive) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
stateChangeListeners.add(listener);
|
|
22
|
+
// Notify new handlers of the current status on add
|
|
23
|
+
if (notifyOnAdd) {
|
|
24
|
+
listener(this.getSessionState());
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
SessionListener.prototype.removeStateChangeListener = function (handler) {
|
|
28
|
+
// No-op if document listener is not active
|
|
29
|
+
if (!this.listenerActive) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
stateChangeListeners.delete(handler);
|
|
33
|
+
};
|
|
34
|
+
SessionListener.prototype.handleVisibilityChange = function () {
|
|
35
|
+
this.notifyHandlers();
|
|
36
|
+
};
|
|
37
|
+
SessionListener.prototype.notifyHandlers = function () {
|
|
38
|
+
var sessionState = this.getSessionState();
|
|
39
|
+
stateChangeListeners.forEach(function (listener) {
|
|
40
|
+
listener(sessionState);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
SessionListener.prototype.getSessionState = function () {
|
|
44
|
+
if (isBrowser() && document.visibilityState !== 'hidden') {
|
|
45
|
+
return 'started';
|
|
46
|
+
}
|
|
47
|
+
// If, for any reason, document is undefined the session will never start
|
|
48
|
+
return 'ended';
|
|
49
|
+
};
|
|
50
|
+
return SessionListener;
|
|
51
|
+
}());
|
|
52
|
+
export { SessionListener };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionStateChangeListener, SessionListenerInterface } from './types';
|
|
2
|
+
export declare class SessionListener implements SessionListenerInterface {
|
|
3
|
+
private currentAppState?;
|
|
4
|
+
constructor();
|
|
5
|
+
addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
|
|
6
|
+
removeStateChangeListener(handler: SessionStateChangeListener): void;
|
|
7
|
+
private handleStateChange;
|
|
8
|
+
private notifyHandlers;
|
|
9
|
+
private getSessionState;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { loadAppState } from '@aws-amplify/react-native';
|
|
4
|
+
var stateChangeListeners = new Set();
|
|
5
|
+
var isActive = function (appState) { return appState === 'active'; };
|
|
6
|
+
var isInactive = function (appState) {
|
|
7
|
+
return appState === 'inactive' || appState === 'background';
|
|
8
|
+
};
|
|
9
|
+
var SessionListener = /** @class */ (function () {
|
|
10
|
+
function SessionListener() {
|
|
11
|
+
this.handleStateChange = this.handleStateChange.bind(this);
|
|
12
|
+
// Setup state listeners
|
|
13
|
+
loadAppState().addEventListener('change', this.handleStateChange);
|
|
14
|
+
}
|
|
15
|
+
SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
|
|
16
|
+
if (notifyOnAdd === void 0) { notifyOnAdd = false; }
|
|
17
|
+
stateChangeListeners.add(listener);
|
|
18
|
+
// Notify new handlers of the current state on add if the current state has been determined
|
|
19
|
+
if (notifyOnAdd && this.currentAppState !== undefined) {
|
|
20
|
+
listener(this.getSessionState());
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
SessionListener.prototype.removeStateChangeListener = function (handler) {
|
|
24
|
+
stateChangeListeners.delete(handler);
|
|
25
|
+
};
|
|
26
|
+
SessionListener.prototype.handleStateChange = function (nextAppState) {
|
|
27
|
+
if ((this.currentAppState === undefined ||
|
|
28
|
+
isInactive(this.currentAppState)) &&
|
|
29
|
+
isActive(nextAppState)) {
|
|
30
|
+
this.notifyHandlers('started');
|
|
31
|
+
}
|
|
32
|
+
else if (isActive(this.currentAppState) && isInactive(nextAppState)) {
|
|
33
|
+
this.notifyHandlers('ended');
|
|
34
|
+
}
|
|
35
|
+
this.currentAppState = nextAppState;
|
|
36
|
+
};
|
|
37
|
+
SessionListener.prototype.notifyHandlers = function (state) {
|
|
38
|
+
stateChangeListeners.forEach(function (listener) {
|
|
39
|
+
listener(state);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
SessionListener.prototype.getSessionState = function () {
|
|
43
|
+
if (isActive(this.currentAppState)) {
|
|
44
|
+
return 'started';
|
|
45
|
+
}
|
|
46
|
+
// Consider any other app state as ended
|
|
47
|
+
return 'ended';
|
|
48
|
+
};
|
|
49
|
+
return SessionListener;
|
|
50
|
+
}());
|
|
51
|
+
export { SessionListener };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type SessionState = 'started' | 'ended';
|
|
2
|
+
export type SessionStateChangeListener = (state: SessionState) => void;
|
|
3
|
+
export interface SessionListenerInterface {
|
|
4
|
+
addStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
5
|
+
removeStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.0.1-api-v6-models.
|
|
3
|
+
"version": "6.0.1-api-v6-models.572a7b5.0+572a7b5",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
"./lib/Credentials.js",
|
|
14
14
|
"./lib-esm/I18n/index.js",
|
|
15
15
|
"./lib-esm/Credentials.js",
|
|
16
|
-
"./lib/Cache/
|
|
17
|
-
"./lib/Cache/
|
|
18
|
-
"./lib-esm/Cache/BrowserStorageCache.js",
|
|
19
|
-
"./lib-esm/Cache/AsyncStorageCache.js"
|
|
16
|
+
"./lib/Cache/index.js",
|
|
17
|
+
"./lib-esm/Cache/index.js"
|
|
20
18
|
],
|
|
21
19
|
"scripts": {
|
|
22
20
|
"test": "npm run lint && jest -w 1 --coverage",
|
|
@@ -36,9 +34,7 @@
|
|
|
36
34
|
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 92.36"
|
|
37
35
|
},
|
|
38
36
|
"react-native": {
|
|
39
|
-
"./lib/index": "./lib-esm/index.js"
|
|
40
|
-
"./lib-esm/ClientDevice": "./lib-esm/ClientDevice/reactnative.js",
|
|
41
|
-
"./lib-esm/Cache": "./lib-esm/Cache/reactnative.js"
|
|
37
|
+
"./lib/index": "./lib-esm/index.js"
|
|
42
38
|
},
|
|
43
39
|
"repository": {
|
|
44
40
|
"type": "git",
|
|
@@ -59,17 +55,17 @@
|
|
|
59
55
|
"server"
|
|
60
56
|
],
|
|
61
57
|
"dependencies": {
|
|
62
|
-
"@aws-crypto/sha256-js": "5.
|
|
58
|
+
"@aws-crypto/sha256-js": "5.2.0",
|
|
63
59
|
"@aws-sdk/types": "3.398.0",
|
|
64
60
|
"@smithy/util-hex-encoding": "2.0.0",
|
|
65
|
-
"js-cookie": "^
|
|
61
|
+
"js-cookie": "^3.0.5",
|
|
66
62
|
"rxjs": "^7.8.1",
|
|
67
63
|
"tslib": "^2.5.0",
|
|
68
64
|
"uuid": "^9.0.0"
|
|
69
65
|
},
|
|
70
66
|
"devDependencies": {
|
|
71
|
-
"@aws-amplify/react-native": "1.0.1-api-v6-models.
|
|
72
|
-
"@types/js-cookie": "
|
|
67
|
+
"@aws-amplify/react-native": "1.0.1-api-v6-models.572a7b5.0+572a7b5",
|
|
68
|
+
"@types/js-cookie": "3.0.2",
|
|
73
69
|
"@types/uuid": "^9.0.0",
|
|
74
70
|
"find": "^0.2.7",
|
|
75
71
|
"genversion": "^2.2.0",
|
|
@@ -129,12 +125,6 @@
|
|
|
129
125
|
"path": "./lib-esm/index.js",
|
|
130
126
|
"import": "{ Cache }",
|
|
131
127
|
"limit": "4.13 kB"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"name": "Cache (in-memory)",
|
|
135
|
-
"path": "./lib-esm/index.js",
|
|
136
|
-
"import": "{ InMemoryCache }",
|
|
137
|
-
"limit": "4.15 kB"
|
|
138
128
|
}
|
|
139
129
|
],
|
|
140
130
|
"jest": {
|
|
@@ -179,5 +169,5 @@
|
|
|
179
169
|
"lib-esm"
|
|
180
170
|
]
|
|
181
171
|
},
|
|
182
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "572a7b56d9e87ca779038254de3d68b5c607af07"
|
|
183
173
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { loadAsyncStorage } from '@aws-amplify/react-native';
|
|
5
|
+
import { ConsoleLogger as Logger } from '../Logger';
|
|
6
|
+
import { defaultConfig } from './constants';
|
|
7
|
+
import { StorageCacheCommon } from './StorageCacheCommon';
|
|
8
|
+
import { Cache, CacheConfig } from './types';
|
|
9
|
+
import { getCurrentSizeKey, getCurrentTime } from './utils';
|
|
10
|
+
|
|
11
|
+
const logger = new Logger('StorageCache');
|
|
12
|
+
const AsyncStorage = loadAsyncStorage();
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Customized cache which based on the AsyncStorage with LRU implemented
|
|
16
|
+
*/
|
|
17
|
+
export class StorageCache extends StorageCacheCommon implements Cache {
|
|
18
|
+
/**
|
|
19
|
+
* initialize the cache
|
|
20
|
+
* @param config - the configuration of the cache
|
|
21
|
+
*/
|
|
22
|
+
constructor(config?: CacheConfig) {
|
|
23
|
+
super({ config, keyValueStorage: AsyncStorage });
|
|
24
|
+
|
|
25
|
+
this.getItem = this.getItem.bind(this);
|
|
26
|
+
this.setItem = this.setItem.bind(this);
|
|
27
|
+
this.removeItem = this.removeItem.bind(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected async getAllCacheKeys(options?: { omitSizeKey?: boolean }) {
|
|
31
|
+
const { omitSizeKey } = options ?? {};
|
|
32
|
+
const keys: string[] = [];
|
|
33
|
+
for (const key of await AsyncStorage.getAllKeys()) {
|
|
34
|
+
if (omitSizeKey && key === getCurrentSizeKey(this.config.keyPrefix)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (key?.startsWith(this.config.keyPrefix)) {
|
|
38
|
+
keys.push(key.substring(this.config.keyPrefix.length));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected async getAllStorageKeys() {
|
|
45
|
+
try {
|
|
46
|
+
return AsyncStorage.getAllKeys();
|
|
47
|
+
} catch (e) {
|
|
48
|
+
logger.warn(`getAllKeys failed! ${e}`);
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Return a new instance of cache with customized configuration.
|
|
55
|
+
* @param {Object} config - the customized configuration
|
|
56
|
+
* @return {Object} - the new instance of Cache
|
|
57
|
+
*/
|
|
58
|
+
public createInstance(config: CacheConfig): Cache {
|
|
59
|
+
if (!config.keyPrefix || config.keyPrefix === defaultConfig.keyPrefix) {
|
|
60
|
+
logger.error('invalid keyPrefix, setting keyPrefix with timeStamp');
|
|
61
|
+
config.keyPrefix = getCurrentTime.toString();
|
|
62
|
+
}
|
|
63
|
+
return new StorageCache(config);
|
|
64
|
+
}
|
|
65
|
+
}
|