@aws-amplify/core 6.0.1-api-v6-models.8035dfc.0 → 6.0.1-api-v6-models.3eb7748.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
|
@@ -0,0 +1,17 @@
|
|
|
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.currentSizeKey = exports.defaultConfig = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Default cache config
|
|
8
|
+
*/
|
|
9
|
+
exports.defaultConfig = {
|
|
10
|
+
keyPrefix: 'aws-amplify-cache',
|
|
11
|
+
capacityInBytes: 1048576,
|
|
12
|
+
itemMaxSize: 210000,
|
|
13
|
+
defaultTTL: 259200000,
|
|
14
|
+
defaultPriority: 5,
|
|
15
|
+
warningThreshold: 0.8,
|
|
16
|
+
};
|
|
17
|
+
exports.currentSizeKey = 'CurSize';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Cache = void 0;
|
|
6
|
+
var StorageCache_1 = require("./StorageCache");
|
|
7
|
+
exports.Cache = new StorageCache_1.StorageCache();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CacheConfig } from '../../singleton/Cache/types';
|
|
2
|
+
export { CacheConfig };
|
|
3
|
+
/**
|
|
4
|
+
* Cache Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface Cache {
|
|
7
|
+
/** Put item into cache */
|
|
8
|
+
setItem(key: string, value: any, options?: CacheItemOptions): Promise<void>;
|
|
9
|
+
/** Get item from cache */
|
|
10
|
+
getItem(key: string, options?: CacheItemOptions): Promise<CacheItem['data']>;
|
|
11
|
+
/** Remove item from cache */
|
|
12
|
+
removeItem(key: string): Promise<void>;
|
|
13
|
+
/** Remove all items from cache */
|
|
14
|
+
clear(): Promise<void>;
|
|
15
|
+
/** Get all keys form cache */
|
|
16
|
+
getAllKeys(): Promise<string[]>;
|
|
17
|
+
/** Get current size of the cache */
|
|
18
|
+
getCurrentCacheSize(): Promise<number>;
|
|
19
|
+
/** create a new instance with customized config */
|
|
20
|
+
createInstance(config: CacheConfig): Cache;
|
|
21
|
+
/** change current configuration */
|
|
22
|
+
configure(config: CacheConfig): CacheConfig;
|
|
23
|
+
}
|
|
24
|
+
export interface CacheItem {
|
|
25
|
+
key: string;
|
|
26
|
+
data: any;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
visitedTime: number;
|
|
29
|
+
priority: number;
|
|
30
|
+
expires: number;
|
|
31
|
+
type: string;
|
|
32
|
+
byteSize: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CacheItemOptions {
|
|
35
|
+
priority?: number;
|
|
36
|
+
expires?: number;
|
|
37
|
+
callback?: Function;
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cache';
|
package/lib/Cache/types/index.js
CHANGED
|
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./cache"), exports);
|
|
@@ -13,6 +13,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
13
13
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CacheList = void 0;
|
|
16
17
|
var errorHelpers_1 = require("./errorHelpers");
|
|
17
18
|
var DoubleLinkedNode = /** @class */ (function () {
|
|
18
19
|
function DoubleLinkedNode(keyVal) {
|
|
@@ -180,4 +181,4 @@ var CacheList = /** @class */ (function () {
|
|
|
180
181
|
};
|
|
181
182
|
return CacheList;
|
|
182
183
|
}());
|
|
183
|
-
exports.
|
|
184
|
+
exports.CacheList = CacheList;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* return the byte size of the string
|
|
3
|
+
* @param str
|
|
4
|
+
*/
|
|
5
|
+
export declare function getByteLength(str: string): number;
|
|
6
|
+
/**
|
|
7
|
+
* get current time
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCurrentTime(): number;
|
|
10
|
+
/**
|
|
11
|
+
* check if passed value is an integer
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInteger(value?: number): boolean;
|
|
14
|
+
export declare const getCurrentSizeKey: (keyPrefix: string) => string;
|
|
@@ -0,0 +1,51 @@
|
|
|
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.getCurrentSizeKey = exports.isInteger = exports.getCurrentTime = exports.getByteLength = void 0;
|
|
6
|
+
var constants_1 = require("../constants");
|
|
7
|
+
/**
|
|
8
|
+
* return the byte size of the string
|
|
9
|
+
* @param str
|
|
10
|
+
*/
|
|
11
|
+
function getByteLength(str) {
|
|
12
|
+
var ret = 0;
|
|
13
|
+
ret = str.length;
|
|
14
|
+
for (var i = str.length; i >= 0; i -= 1) {
|
|
15
|
+
var charCode = str.charCodeAt(i);
|
|
16
|
+
if (charCode > 0x7f && charCode <= 0x7ff) {
|
|
17
|
+
ret += 1;
|
|
18
|
+
}
|
|
19
|
+
else if (charCode > 0x7ff && charCode <= 0xffff) {
|
|
20
|
+
ret += 2;
|
|
21
|
+
}
|
|
22
|
+
// trail surrogate
|
|
23
|
+
if (charCode >= 0xdc00 && charCode <= 0xdfff) {
|
|
24
|
+
i -= 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return ret;
|
|
28
|
+
}
|
|
29
|
+
exports.getByteLength = getByteLength;
|
|
30
|
+
/**
|
|
31
|
+
* get current time
|
|
32
|
+
*/
|
|
33
|
+
function getCurrentTime() {
|
|
34
|
+
var currentTime = new Date();
|
|
35
|
+
return currentTime.getTime();
|
|
36
|
+
}
|
|
37
|
+
exports.getCurrentTime = getCurrentTime;
|
|
38
|
+
/**
|
|
39
|
+
* check if passed value is an integer
|
|
40
|
+
*/
|
|
41
|
+
function isInteger(value) {
|
|
42
|
+
if (Number.isInteger) {
|
|
43
|
+
return Number.isInteger(value);
|
|
44
|
+
}
|
|
45
|
+
return (typeof value === 'number' && isFinite(value) && Math.floor(value) === value);
|
|
46
|
+
}
|
|
47
|
+
exports.isInteger = isInteger;
|
|
48
|
+
var getCurrentSizeKey = function (keyPrefix) {
|
|
49
|
+
return "".concat(keyPrefix).concat(constants_1.currentSizeKey);
|
|
50
|
+
};
|
|
51
|
+
exports.getCurrentSizeKey = getCurrentSizeKey;
|
|
@@ -8,7 +8,6 @@ var errors_1 = require("../../errors");
|
|
|
8
8
|
var CacheErrorCode;
|
|
9
9
|
(function (CacheErrorCode) {
|
|
10
10
|
CacheErrorCode["NoCacheItem"] = "NoCacheItem";
|
|
11
|
-
CacheErrorCode["NoCacheStorage"] = "NoCacheStorage";
|
|
12
11
|
CacheErrorCode["NullNextNode"] = "NullNextNode";
|
|
13
12
|
CacheErrorCode["NullPreviousNode"] = "NullPreviousNode";
|
|
14
13
|
})(CacheErrorCode = exports.CacheErrorCode || (exports.CacheErrorCode = {}));
|
|
@@ -16,9 +15,6 @@ var cacheErrorMap = (_a = {},
|
|
|
16
15
|
_a[CacheErrorCode.NoCacheItem] = {
|
|
17
16
|
message: 'Item not found in the cache storage.',
|
|
18
17
|
},
|
|
19
|
-
_a[CacheErrorCode.NoCacheStorage] = {
|
|
20
|
-
message: 'Storage is not defined in the cache config.',
|
|
21
|
-
},
|
|
22
18
|
_a[CacheErrorCode.NullNextNode] = {
|
|
23
19
|
message: 'Next node is null.',
|
|
24
20
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
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.CacheList = exports.isInteger = exports.getCurrentTime = exports.getCurrentSizeKey = exports.getByteLength = void 0;
|
|
6
|
+
var cacheHelpers_1 = require("./cacheHelpers");
|
|
7
|
+
Object.defineProperty(exports, "getByteLength", { enumerable: true, get: function () { return cacheHelpers_1.getByteLength; } });
|
|
8
|
+
Object.defineProperty(exports, "getCurrentSizeKey", { enumerable: true, get: function () { return cacheHelpers_1.getCurrentSizeKey; } });
|
|
9
|
+
Object.defineProperty(exports, "getCurrentTime", { enumerable: true, get: function () { return cacheHelpers_1.getCurrentTime; } });
|
|
10
|
+
Object.defineProperty(exports, "isInteger", { enumerable: true, get: function () { return cacheHelpers_1.isInteger; } });
|
|
11
|
+
var CacheList_1 = require("./CacheList");
|
|
12
|
+
Object.defineProperty(exports, "CacheList", { enumerable: true, get: function () { return CacheList_1.CacheList; } });
|
package/lib/I18n/I18n.js
CHANGED
|
@@ -15,7 +15,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.I18n = void 0;
|
|
17
17
|
var Logger_1 = require("../Logger");
|
|
18
|
-
var singleton_1 = require("../singleton");
|
|
19
18
|
var logger = new Logger_1.ConsoleLogger('I18n');
|
|
20
19
|
/**
|
|
21
20
|
* Language translation utility.
|
|
@@ -44,11 +43,7 @@ var I18n = /** @class */ (function () {
|
|
|
44
43
|
* Sets the default language from the configuration when required.
|
|
45
44
|
*/
|
|
46
45
|
I18n.prototype.setDefaultLanguage = function () {
|
|
47
|
-
if
|
|
48
|
-
var i18nConfig = singleton_1.Amplify.getConfig().I18n;
|
|
49
|
-
this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
|
|
50
|
-
}
|
|
51
|
-
// Default to window language if not set in config
|
|
46
|
+
// Default to window language if not set in instance
|
|
52
47
|
if (!this._lang &&
|
|
53
48
|
typeof window !== 'undefined' &&
|
|
54
49
|
window &&
|
package/lib/Platform/types.d.ts
CHANGED
|
@@ -73,7 +73,14 @@ export declare enum DataStoreAction {
|
|
|
73
73
|
GraphQl = "2"
|
|
74
74
|
}
|
|
75
75
|
export declare enum GeoAction {
|
|
76
|
-
|
|
76
|
+
SearchByText = "0",
|
|
77
|
+
SearchByCoordinates = "1",
|
|
78
|
+
SearchForSuggestions = "2",
|
|
79
|
+
SearchByPlaceId = "3",
|
|
80
|
+
SaveGeofences = "4",
|
|
81
|
+
GetGeofence = "5",
|
|
82
|
+
ListGeofences = "6",
|
|
83
|
+
DeleteGeofences = "7"
|
|
77
84
|
}
|
|
78
85
|
export declare enum InAppMessagingAction {
|
|
79
86
|
SyncMessages = "1",
|
|
@@ -92,7 +99,8 @@ export declare enum PubSubAction {
|
|
|
92
99
|
Subscribe = "1"
|
|
93
100
|
}
|
|
94
101
|
export declare enum PushNotificationAction {
|
|
95
|
-
|
|
102
|
+
InitializePushNotifications = "1",
|
|
103
|
+
IdentifyUser = "2"
|
|
96
104
|
}
|
|
97
105
|
export declare enum StorageAction {
|
|
98
106
|
UploadData = "1",
|
|
@@ -139,23 +147,25 @@ export type CategoryUserAgentStateMap = Record<string, {
|
|
|
139
147
|
}>;
|
|
140
148
|
export type CustomUserAgentStateMap = Record<string, CategoryUserAgentStateMap>;
|
|
141
149
|
export type AdditionalDetails = [string, string?][];
|
|
142
|
-
type StorageUserAgentInput = {
|
|
150
|
+
export type StorageUserAgentInput = {
|
|
143
151
|
category: Category.Storage;
|
|
144
152
|
apis: StorageAction[];
|
|
153
|
+
additionalDetails: AdditionalDetails;
|
|
145
154
|
};
|
|
146
|
-
type AuthUserAgentInput = {
|
|
155
|
+
export type AuthUserAgentInput = {
|
|
147
156
|
category: Category.Auth;
|
|
148
157
|
apis: AuthAction[];
|
|
158
|
+
additionalDetails: AdditionalDetails;
|
|
149
159
|
};
|
|
150
|
-
type InAppMessagingUserAgentInput = {
|
|
160
|
+
export type InAppMessagingUserAgentInput = {
|
|
151
161
|
category: Category.InAppMessaging;
|
|
152
162
|
apis: InAppMessagingAction[];
|
|
163
|
+
additionalDetails: AdditionalDetails;
|
|
153
164
|
};
|
|
154
|
-
type GeoUserAgentInput = {
|
|
165
|
+
export type GeoUserAgentInput = {
|
|
155
166
|
category: Category.Geo;
|
|
156
167
|
apis: GeoAction[];
|
|
157
|
-
};
|
|
158
|
-
export type SetCustomUserAgentInput = (StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput) & {
|
|
159
168
|
additionalDetails: AdditionalDetails;
|
|
160
169
|
};
|
|
170
|
+
export type SetCustomUserAgentInput = StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput;
|
|
161
171
|
export {};
|
package/lib/Platform/types.js
CHANGED
|
@@ -88,7 +88,14 @@ var DataStoreAction;
|
|
|
88
88
|
})(DataStoreAction = exports.DataStoreAction || (exports.DataStoreAction = {}));
|
|
89
89
|
var GeoAction;
|
|
90
90
|
(function (GeoAction) {
|
|
91
|
-
GeoAction["
|
|
91
|
+
GeoAction["SearchByText"] = "0";
|
|
92
|
+
GeoAction["SearchByCoordinates"] = "1";
|
|
93
|
+
GeoAction["SearchForSuggestions"] = "2";
|
|
94
|
+
GeoAction["SearchByPlaceId"] = "3";
|
|
95
|
+
GeoAction["SaveGeofences"] = "4";
|
|
96
|
+
GeoAction["GetGeofence"] = "5";
|
|
97
|
+
GeoAction["ListGeofences"] = "6";
|
|
98
|
+
GeoAction["DeleteGeofences"] = "7";
|
|
92
99
|
})(GeoAction = exports.GeoAction || (exports.GeoAction = {}));
|
|
93
100
|
var InAppMessagingAction;
|
|
94
101
|
(function (InAppMessagingAction) {
|
|
@@ -112,7 +119,8 @@ var PubSubAction;
|
|
|
112
119
|
})(PubSubAction = exports.PubSubAction || (exports.PubSubAction = {}));
|
|
113
120
|
var PushNotificationAction;
|
|
114
121
|
(function (PushNotificationAction) {
|
|
115
|
-
PushNotificationAction["
|
|
122
|
+
PushNotificationAction["InitializePushNotifications"] = "1";
|
|
123
|
+
PushNotificationAction["IdentifyUser"] = "2";
|
|
116
124
|
})(PushNotificationAction = exports.PushNotificationAction || (exports.PushNotificationAction = {}));
|
|
117
125
|
var StorageAction;
|
|
118
126
|
(function (StorageAction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-api-v6-models.
|
|
1
|
+
export declare const version = "6.0.1-api-v6-models.3eb7748.0+3eb7748";
|
package/lib/Platform/version.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __values = (this && this.__values) || function(o) {
|
|
5
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
6
|
+
if (m) return m.call(o);
|
|
7
|
+
if (o && typeof o.length === "number") return {
|
|
8
|
+
next: function () {
|
|
9
|
+
if (o && i >= o.length) o = void 0;
|
|
10
|
+
return { value: o && o[i++], done: !o };
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
14
|
+
};
|
|
4
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
16
|
exports.Reachability = void 0;
|
|
6
17
|
var rxjs_1 = require("rxjs");
|
|
@@ -9,7 +20,12 @@ var Reachability = exports.Reachability = /** @class */ (function () {
|
|
|
9
20
|
function Reachability() {
|
|
10
21
|
}
|
|
11
22
|
Reachability.prototype.networkMonitor = function (_) {
|
|
12
|
-
var globalObj = (0, libraryUtils_1.isWebWorker)()
|
|
23
|
+
var globalObj = (0, libraryUtils_1.isWebWorker)()
|
|
24
|
+
? self
|
|
25
|
+
: typeof window !== 'undefined' && window;
|
|
26
|
+
if (!globalObj) {
|
|
27
|
+
return (0, rxjs_1.from)([{ online: true }]);
|
|
28
|
+
}
|
|
13
29
|
return new rxjs_1.Observable(function (observer) {
|
|
14
30
|
observer.next({ online: globalObj.navigator.onLine });
|
|
15
31
|
var notifyOnline = function () { return observer.next({ online: true }); };
|
|
@@ -24,6 +40,31 @@ var Reachability = exports.Reachability = /** @class */ (function () {
|
|
|
24
40
|
};
|
|
25
41
|
});
|
|
26
42
|
};
|
|
43
|
+
// expose observers to simulate offline mode for integration testing
|
|
44
|
+
Reachability._observerOverride = function (status) {
|
|
45
|
+
var e_1, _a;
|
|
46
|
+
var _loop_1 = function (observer) {
|
|
47
|
+
if (observer.closed) {
|
|
48
|
+
this_1._observers = this_1._observers.filter(function (_observer) { return _observer !== observer; });
|
|
49
|
+
return "continue";
|
|
50
|
+
}
|
|
51
|
+
(observer === null || observer === void 0 ? void 0 : observer.next) && observer.next(status);
|
|
52
|
+
};
|
|
53
|
+
var this_1 = this;
|
|
54
|
+
try {
|
|
55
|
+
for (var _b = __values(this._observers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
56
|
+
var observer = _c.value;
|
|
57
|
+
_loop_1(observer);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61
|
+
finally {
|
|
62
|
+
try {
|
|
63
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
64
|
+
}
|
|
65
|
+
finally { if (e_1) throw e_1.error; }
|
|
66
|
+
}
|
|
67
|
+
};
|
|
27
68
|
Reachability._observers = [];
|
|
28
69
|
return Reachability;
|
|
29
70
|
}());
|
|
@@ -1,13 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
+
function step(op) {
|
|
18
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
+
switch (op[0]) {
|
|
23
|
+
case 0: case 1: t = op; break;
|
|
24
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
+
default:
|
|
28
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
+
if (t[2]) _.ops.pop();
|
|
33
|
+
_.trys.pop(); continue;
|
|
34
|
+
}
|
|
35
|
+
op = body.call(thisArg, _);
|
|
36
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
4
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
41
|
exports.ServiceWorkerClass = void 0;
|
|
6
42
|
var Logger_1 = require("../Logger");
|
|
7
43
|
var utils_1 = require("../utils");
|
|
8
|
-
var Amplify_1 = require("../Amplify");
|
|
9
44
|
var errors_1 = require("../errors");
|
|
10
45
|
var errorHelpers_1 = require("./errorHelpers");
|
|
46
|
+
var pinpoint_1 = require("../providers/pinpoint");
|
|
47
|
+
var singleton_1 = require("../singleton");
|
|
11
48
|
/**
|
|
12
49
|
* Provides a means to registering a service worker in the browser
|
|
13
50
|
* and communicating with it via postMessage events.
|
|
@@ -176,19 +213,37 @@ var ServiceWorkerClass = /** @class */ (function () {
|
|
|
176
213
|
**/
|
|
177
214
|
ServiceWorkerClass.prototype._setupListeners = function () {
|
|
178
215
|
var _this = this;
|
|
179
|
-
this.serviceWorker.addEventListener('statechange', function (event) {
|
|
180
|
-
var currentState
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
216
|
+
this.serviceWorker.addEventListener('statechange', function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
+
var currentState, _a, appId, region, credentials;
|
|
218
|
+
var _b, _c;
|
|
219
|
+
return __generator(this, function (_d) {
|
|
220
|
+
switch (_d.label) {
|
|
221
|
+
case 0:
|
|
222
|
+
currentState = this.serviceWorker.state;
|
|
223
|
+
this._logger.debug("ServiceWorker statechange: ".concat(currentState));
|
|
224
|
+
_a = (_c = (_b = singleton_1.Amplify.getConfig().Analytics) === null || _b === void 0 ? void 0 : _b.Pinpoint) !== null && _c !== void 0 ? _c : {}, appId = _a.appId, region = _a.region;
|
|
225
|
+
return [4 /*yield*/, (0, singleton_1.fetchAuthSession)()];
|
|
226
|
+
case 1:
|
|
227
|
+
credentials = (_d.sent()).credentials;
|
|
228
|
+
if (appId && region && credentials) {
|
|
229
|
+
// Pinpoint is configured, record an event
|
|
230
|
+
(0, pinpoint_1.record)({
|
|
231
|
+
appId: appId,
|
|
232
|
+
region: region,
|
|
233
|
+
category: 'Core',
|
|
234
|
+
credentials: credentials,
|
|
235
|
+
event: {
|
|
236
|
+
name: 'ServiceWorker',
|
|
237
|
+
attributes: {
|
|
238
|
+
state: currentState,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return [2 /*return*/];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}); });
|
|
192
247
|
this.serviceWorker.addEventListener('message', function (event) {
|
|
193
248
|
_this._logger.debug("ServiceWorker message event: ".concat(event));
|
|
194
249
|
});
|
|
@@ -196,6 +251,3 @@ var ServiceWorkerClass = /** @class */ (function () {
|
|
|
196
251
|
return ServiceWorkerClass;
|
|
197
252
|
}());
|
|
198
253
|
exports.ServiceWorkerClass = ServiceWorkerClass;
|
|
199
|
-
function isAmplifyWithAnalytics(amplify) {
|
|
200
|
-
return amplify.Analytics && typeof amplify.Analytics.record === 'function';
|
|
201
|
-
}
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
5
|
-
* the License. A copy of the License is located at
|
|
6
|
-
*
|
|
7
|
-
* http://aws.amazon.com/apache2.0/
|
|
8
|
-
*
|
|
9
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
11
|
-
* and limitations under the License.
|
|
12
|
-
*/
|
|
13
1
|
export { ServiceWorkerClass as ServiceWorker } from './ServiceWorker';
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
/**
|
|
5
|
-
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
8
|
-
* the License. A copy of the License is located at
|
|
9
|
-
*
|
|
10
|
-
* http://aws.amazon.com/apache2.0/
|
|
11
|
-
*
|
|
12
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
13
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
14
|
-
* and limitations under the License.
|
|
15
|
-
*/
|
|
16
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
5
|
exports.ServiceWorker = void 0;
|
|
18
6
|
var ServiceWorker_1 = require("./ServiceWorker");
|
package/lib/Signer/Signer.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.Signer = void 0;
|
|
17
17
|
var DateUtils_1 = require("./DateUtils");
|
|
18
18
|
var signatureV4_1 = require("../clients/middleware/signing/signer/signatureV4");
|
|
19
|
+
var amplifyUrl_1 = require("../utils/amplifyUrl");
|
|
19
20
|
var IOT_SERVICE_NAME = 'iotdevicegateway';
|
|
20
21
|
// Best practice regex to parse the service and region from an AWS endpoint
|
|
21
22
|
var AWS_ENDPOINT_REGEX = /([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(.cn)?$/;
|
|
@@ -63,7 +64,7 @@ var Signer = /** @class */ (function () {
|
|
|
63
64
|
if (request.body && !request.data) {
|
|
64
65
|
throw new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');
|
|
65
66
|
}
|
|
66
|
-
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new
|
|
67
|
+
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new amplifyUrl_1.AmplifyUrl(request.url) });
|
|
67
68
|
var options = getOptions(requestToSign, accessInfo, serviceInfo);
|
|
68
69
|
var signedRequest = (0, signatureV4_1.signRequest)(requestToSign, options);
|
|
69
70
|
// Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property
|
|
@@ -85,7 +86,7 @@ var Signer = /** @class */ (function () {
|
|
|
85
86
|
var presignable = {
|
|
86
87
|
body: body,
|
|
87
88
|
method: method,
|
|
88
|
-
url: new
|
|
89
|
+
url: new amplifyUrl_1.AmplifyUrl(urlToSign),
|
|
89
90
|
};
|
|
90
91
|
var options = getOptions(presignable, accessInfo, serviceInfo, expiration);
|
|
91
92
|
var signedUrl = (0, signatureV4_1.presignUrl)(presignable, options);
|
|
@@ -44,6 +44,7 @@ var composeTransferHandler_1 = require("../../clients/internal/composeTransferHa
|
|
|
44
44
|
var retry_1 = require("../../clients/middleware/retry");
|
|
45
45
|
var Platform_1 = require("../../Platform");
|
|
46
46
|
var detectFramework_1 = require("../../Platform/detectFramework");
|
|
47
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
47
48
|
/**
|
|
48
49
|
* The service name used to sign requests if the API requires authentication.
|
|
49
50
|
*/
|
|
@@ -54,7 +55,7 @@ var SERVICE_NAME = 'cognito-identity';
|
|
|
54
55
|
var endpointResolver = function (_a) {
|
|
55
56
|
var region = _a.region;
|
|
56
57
|
return ({
|
|
57
|
-
url: new
|
|
58
|
+
url: new amplifyUrl_1.AmplifyUrl("https://cognito-identity.".concat(region, ".").concat((0, clients_1.getDnsSuffix)(region))),
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
61
|
/**
|
|
@@ -7,6 +7,7 @@ var endpoints_1 = require("../../clients/endpoints");
|
|
|
7
7
|
var retry_1 = require("../../clients/middleware/retry");
|
|
8
8
|
var json_1 = require("../../clients/serde/json");
|
|
9
9
|
var Platform_1 = require("../../Platform");
|
|
10
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
10
11
|
/**
|
|
11
12
|
* The service name used to sign requests if the API requires authentication.
|
|
12
13
|
*/
|
|
@@ -17,7 +18,7 @@ var SERVICE_NAME = 'mobiletargeting';
|
|
|
17
18
|
var endpointResolver = function (_a) {
|
|
18
19
|
var region = _a.region;
|
|
19
20
|
return ({
|
|
20
|
-
url: new
|
|
21
|
+
url: new amplifyUrl_1.AmplifyUrl("https://pinpoint.".concat(region, ".").concat((0, endpoints_1.getDnsSuffix)(region))),
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
@@ -44,10 +44,11 @@ var composeServiceApi_1 = require("../../clients/internal/composeServiceApi");
|
|
|
44
44
|
var extendedEncodeURIComponent_1 = require("../../clients/middleware/signing/utils/extendedEncodeURIComponent");
|
|
45
45
|
var serde_1 = require("../../clients/serde");
|
|
46
46
|
var base_1 = require("./base");
|
|
47
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
47
48
|
var getInAppMessagesSerializer = function (_a, endpoint) {
|
|
48
49
|
var _b = _a.ApplicationId, ApplicationId = _b === void 0 ? '' : _b, _c = _a.EndpointId, EndpointId = _c === void 0 ? '' : _c;
|
|
49
50
|
var headers = (0, base_1.getSharedHeaders)();
|
|
50
|
-
var url = new
|
|
51
|
+
var url = new amplifyUrl_1.AmplifyUrl(endpoint.url);
|
|
51
52
|
url.pathname = "v1/apps/".concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(ApplicationId), "/endpoints/").concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(EndpointId), "/inappmessages");
|
|
52
53
|
return { method: 'GET', headers: headers, url: url };
|
|
53
54
|
};
|