@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,29 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
interface LexV1BotConfig {
|
|
5
|
+
alias: string;
|
|
6
|
+
region: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface LexV2BotConfig {
|
|
10
|
+
botId: string;
|
|
11
|
+
aliasId: string;
|
|
12
|
+
localeId: string;
|
|
13
|
+
region: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type InteractionsLexV1Config = {
|
|
17
|
+
LexV1: Record<string, LexV1BotConfig>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type InteractionsLexV2Config = {
|
|
21
|
+
LexV2: Record<string, LexV2BotConfig>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type AtLeastOne<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> &
|
|
25
|
+
U[keyof U];
|
|
26
|
+
|
|
27
|
+
export type InteractionsConfig = AtLeastOne<
|
|
28
|
+
InteractionsLexV1Config & InteractionsLexV2Config
|
|
29
|
+
>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { InAppMessagingConfig } from './InAppMessaging/types';
|
|
5
|
+
import { PushNotificationConfig } from './PushNotification/types';
|
|
5
6
|
|
|
6
7
|
export type NotificationsConfig = {
|
|
7
|
-
InAppMessaging
|
|
8
|
+
InAppMessaging?: InAppMessagingConfig;
|
|
9
|
+
PushNotification?: PushNotificationConfig;
|
|
8
10
|
};
|
package/src/singleton/types.ts
CHANGED
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
StorageAccessLevel,
|
|
19
19
|
StorageConfig,
|
|
20
20
|
} from './Storage/types';
|
|
21
|
-
import { I18nConfig } from '../I18n/types';
|
|
22
21
|
import { NotificationsConfig } from './Notifications/types';
|
|
22
|
+
import { InteractionsConfig } from './Interactions/types';
|
|
23
23
|
|
|
24
24
|
export type LegacyConfig = {
|
|
25
25
|
/**
|
|
@@ -32,10 +32,7 @@ export type ResourcesConfig = {
|
|
|
32
32
|
API?: APIConfig;
|
|
33
33
|
Analytics?: AnalyticsConfig;
|
|
34
34
|
Auth?: AuthConfig;
|
|
35
|
-
|
|
36
|
-
// DataStore?: {};
|
|
37
|
-
I18n?: I18nConfig;
|
|
38
|
-
// Interactions?: {};
|
|
35
|
+
Interactions?: InteractionsConfig;
|
|
39
36
|
Notifications?: NotificationsConfig;
|
|
40
37
|
// Predictions?: {};
|
|
41
38
|
Storage?: StorageConfig;
|
|
@@ -56,6 +53,7 @@ export {
|
|
|
56
53
|
AuthIdentityPoolConfig,
|
|
57
54
|
AuthUserPoolAndIdentityPoolConfig,
|
|
58
55
|
GetCredentialsOptions,
|
|
56
|
+
InteractionsConfig,
|
|
59
57
|
StorageAccessLevel,
|
|
60
58
|
StorageConfig,
|
|
61
59
|
AnalyticsConfig,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
get as getJsCookie,
|
|
6
|
-
remove as removeJsCookie,
|
|
7
|
-
set as setJsCookie,
|
|
8
|
-
} from 'js-cookie';
|
|
4
|
+
import JsCookie from 'js-cookie';
|
|
9
5
|
import {
|
|
10
6
|
CookieStorageData,
|
|
11
7
|
KeyValueStorageInterface,
|
|
@@ -42,20 +38,20 @@ export class CookieStorage implements KeyValueStorageInterface {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
async setItem(key: string, value: string) {
|
|
45
|
-
|
|
41
|
+
JsCookie.set(key, value, this.getData());
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
async getItem(key: string) {
|
|
49
|
-
const item =
|
|
45
|
+
const item = JsCookie.get(key);
|
|
50
46
|
return item ?? null;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
async removeItem(key: string) {
|
|
54
|
-
|
|
50
|
+
JsCookie.remove(key, this.getData());
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
async clear() {
|
|
58
|
-
const cookie =
|
|
54
|
+
const cookie = JsCookie.get();
|
|
59
55
|
const promises = Object.keys(cookie).map(key => this.removeItem(key));
|
|
60
56
|
await Promise.all(promises);
|
|
61
57
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { KeyValueStorage } from './KeyValueStorage';
|
|
5
|
-
import {
|
|
5
|
+
import { getLocalStorageWithFallback } from './utils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export class DefaultStorage extends KeyValueStorage {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(
|
|
12
|
+
super(getLocalStorageWithFallback());
|
|
13
13
|
}
|
|
14
14
|
}
|
package/src/storage/utils.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { InMemoryStorage } from './InMemoryStorage';
|
|
|
7
7
|
* @internal
|
|
8
8
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
9
9
|
*/
|
|
10
|
-
export const
|
|
10
|
+
export const getLocalStorageWithFallback = (): Storage =>
|
|
11
11
|
typeof window !== 'undefined' && window.localStorage
|
|
12
12
|
? window.localStorage
|
|
13
13
|
: new InMemoryStorage();
|
package/src/types/errors.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import './polyfill';
|
|
5
|
+
|
|
6
|
+
const AmplifyUrl = URL;
|
|
7
|
+
const AmplifyUrlSearchParams = URLSearchParams;
|
|
8
|
+
|
|
9
|
+
export { AmplifyUrl, AmplifyUrlSearchParams };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export const deepFreeze = (object: any) => {
|
|
5
|
+
const propNames = Reflect.ownKeys(object);
|
|
6
|
+
|
|
7
|
+
for (const name of propNames) {
|
|
8
|
+
const value = object[name];
|
|
9
|
+
|
|
10
|
+
if ((value && typeof value === 'object') || typeof value === 'function') {
|
|
11
|
+
deepFreeze(value);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return Object.freeze(object);
|
|
16
|
+
};
|
|
@@ -2,11 +2,11 @@
|
|
|
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
|
|
|
7
7
|
const logger = new Logger('DeviceInfo');
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const getClientInfo = () => {
|
|
10
10
|
const dim = Dimensions.get('screen');
|
|
11
11
|
logger.debug(Platform, dim);
|
|
12
12
|
|
|
@@ -2,11 +2,11 @@
|
|
|
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
|
|
|
7
7
|
const logger = new Logger('DeviceInfo');
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const getClientInfo = () => {
|
|
10
10
|
const dim = Dimensions.get('screen');
|
|
11
11
|
logger.debug(Platform, dim);
|
|
12
12
|
const OS = 'ios';
|
|
@@ -21,7 +21,7 @@ export const clientInfo = () => {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
function dimToMake(dim:{height:number
|
|
24
|
+
function dimToMake(dim: { height: number; width: number }) {
|
|
25
25
|
let { height, width } = dim;
|
|
26
26
|
if (height < width) {
|
|
27
27
|
const tmp = height;
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
|
|
5
5
|
const logger = new Logger('ClientDevice_Browser');
|
|
6
6
|
|
|
7
|
-
export function
|
|
7
|
+
export function getClientInfo() {
|
|
8
8
|
if (typeof window === 'undefined') {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
@@ -25,7 +25,7 @@ function browserClientInfo() {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const { platform, product, vendor, userAgent, language } = nav;
|
|
28
|
-
const type =
|
|
28
|
+
const type = getBrowserType(userAgent);
|
|
29
29
|
const timezone = browserTimezone();
|
|
30
30
|
|
|
31
31
|
return {
|
|
@@ -39,24 +39,12 @@ function browserClientInfo() {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function dimension() {
|
|
43
|
-
if (typeof window === 'undefined') {
|
|
44
|
-
logger.warn('No window object available to get browser client info');
|
|
45
|
-
return { width: 320, height: 320 };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
width: window.innerWidth,
|
|
50
|
-
height: window.innerHeight,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
function browserTimezone() {
|
|
55
43
|
const tzMatch = /\(([A-Za-z\s].*)\)/.exec(new Date().toString());
|
|
56
44
|
return tzMatch ? tzMatch[1] || '' : '';
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
|
|
47
|
+
function getBrowserType(userAgent: string) {
|
|
60
48
|
const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(
|
|
61
49
|
userAgent
|
|
62
50
|
);
|
package/src/utils/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
export { generateRandomString } from './generateRandomString';
|
|
5
|
+
export { getClientInfo } from './getClientInfo';
|
|
5
6
|
export { isBrowser } from './isBrowser';
|
|
6
7
|
export { isWebWorker } from './isWebWorker';
|
|
7
8
|
export {
|
|
@@ -13,3 +14,4 @@ export {
|
|
|
13
14
|
} from './retry';
|
|
14
15
|
export { urlSafeDecode } from './urlSafeDecode';
|
|
15
16
|
export { urlSafeEncode } from './urlSafeEncode';
|
|
17
|
+
export { deepFreeze } from './deepFreeze';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { loadAppState } from '@aws-amplify/react-native';
|
|
5
|
+
import {
|
|
6
|
+
SessionStateChangeListener,
|
|
7
|
+
SessionState,
|
|
8
|
+
SessionListenerInterface,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
const stateChangeListeners = new Set<SessionStateChangeListener>();
|
|
12
|
+
const isActive = (appState?: string) => appState === 'active';
|
|
13
|
+
const isInactive = (appState?: string) =>
|
|
14
|
+
appState === 'inactive' || appState === 'background';
|
|
15
|
+
|
|
16
|
+
export class SessionListener implements SessionListenerInterface {
|
|
17
|
+
private currentAppState?: string;
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
this.handleStateChange = this.handleStateChange.bind(this);
|
|
21
|
+
|
|
22
|
+
// Setup state listeners
|
|
23
|
+
loadAppState().addEventListener('change', this.handleStateChange);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public addStateChangeListener(
|
|
27
|
+
listener: SessionStateChangeListener,
|
|
28
|
+
notifyOnAdd: boolean = false
|
|
29
|
+
) {
|
|
30
|
+
stateChangeListeners.add(listener);
|
|
31
|
+
|
|
32
|
+
// Notify new handlers of the current state on add if the current state has been determined
|
|
33
|
+
if (notifyOnAdd && this.currentAppState !== undefined) {
|
|
34
|
+
listener(this.getSessionState());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public removeStateChangeListener(handler: SessionStateChangeListener) {
|
|
39
|
+
stateChangeListeners.delete(handler);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private handleStateChange(nextAppState: string) {
|
|
43
|
+
if (
|
|
44
|
+
(this.currentAppState === undefined ||
|
|
45
|
+
isInactive(this.currentAppState)) &&
|
|
46
|
+
isActive(nextAppState)
|
|
47
|
+
) {
|
|
48
|
+
this.notifyHandlers('started');
|
|
49
|
+
} else if (isActive(this.currentAppState) && isInactive(nextAppState)) {
|
|
50
|
+
this.notifyHandlers('ended');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.currentAppState = nextAppState;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private notifyHandlers(state: SessionState) {
|
|
57
|
+
stateChangeListeners.forEach(listener => {
|
|
58
|
+
listener(state);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private getSessionState() {
|
|
63
|
+
if (isActive(this.currentAppState)) {
|
|
64
|
+
return 'started';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Consider any other app state as ended
|
|
68
|
+
return 'ended';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { isBrowser } from '../isBrowser';
|
|
5
|
+
import { SessionStateChangeListener, SessionListenerInterface } from './types';
|
|
6
|
+
|
|
7
|
+
const stateChangeListeners = new Set<SessionStateChangeListener>();
|
|
8
|
+
|
|
9
|
+
export class SessionListener implements SessionListenerInterface {
|
|
10
|
+
private listenerActive: boolean;
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
this.listenerActive = false;
|
|
14
|
+
this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
|
|
15
|
+
|
|
16
|
+
// Setup state listeners
|
|
17
|
+
if (isBrowser()) {
|
|
18
|
+
document.addEventListener(
|
|
19
|
+
'visibilitychange',
|
|
20
|
+
this.handleVisibilityChange,
|
|
21
|
+
false
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
this.listenerActive = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public addStateChangeListener(
|
|
29
|
+
listener: SessionStateChangeListener,
|
|
30
|
+
notifyOnAdd: boolean = false
|
|
31
|
+
) {
|
|
32
|
+
// No-op if document listener is not active
|
|
33
|
+
if (!this.listenerActive) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
stateChangeListeners.add(listener);
|
|
38
|
+
|
|
39
|
+
// Notify new handlers of the current status on add
|
|
40
|
+
if (notifyOnAdd) {
|
|
41
|
+
listener(this.getSessionState());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public removeStateChangeListener(handler: SessionStateChangeListener) {
|
|
46
|
+
// No-op if document listener is not active
|
|
47
|
+
if (!this.listenerActive) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
stateChangeListeners.delete(handler);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private handleVisibilityChange() {
|
|
55
|
+
this.notifyHandlers();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private notifyHandlers() {
|
|
59
|
+
const sessionState = this.getSessionState();
|
|
60
|
+
|
|
61
|
+
stateChangeListeners.forEach(listener => {
|
|
62
|
+
listener(sessionState);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private getSessionState() {
|
|
67
|
+
if (isBrowser() && document.visibilityState !== 'hidden') {
|
|
68
|
+
return 'started';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// If, for any reason, document is undefined the session will never start
|
|
72
|
+
return 'ended';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export type SessionState = 'started' | 'ended';
|
|
5
|
+
|
|
6
|
+
export type SessionStateChangeListener = (state: SessionState) => void;
|
|
7
|
+
|
|
8
|
+
export interface SessionListenerInterface {
|
|
9
|
+
addStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
10
|
+
removeStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
11
|
+
}
|
package/lib/Amplify.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ConsoleLogger as LoggerClass } from './Logger';
|
|
2
|
-
export declare class AmplifyClass {
|
|
3
|
-
private _components;
|
|
4
|
-
private _config;
|
|
5
|
-
private _modules;
|
|
6
|
-
Auth: null;
|
|
7
|
-
Analytics: null;
|
|
8
|
-
API: null;
|
|
9
|
-
Credentials: null;
|
|
10
|
-
Storage: null;
|
|
11
|
-
I18n: null;
|
|
12
|
-
Cache: null;
|
|
13
|
-
PubSub: null;
|
|
14
|
-
Interactions: null;
|
|
15
|
-
Pushnotification: null;
|
|
16
|
-
UI: null;
|
|
17
|
-
XR: null;
|
|
18
|
-
Predictions: null;
|
|
19
|
-
DataStore: null;
|
|
20
|
-
Geo: null;
|
|
21
|
-
Notifications: null;
|
|
22
|
-
Logger: typeof LoggerClass;
|
|
23
|
-
ServiceWorker: null;
|
|
24
|
-
get config(): any;
|
|
25
|
-
register(comp: any): void;
|
|
26
|
-
configure(config?: any): {};
|
|
27
|
-
addPluggable(pluggable: any): void;
|
|
28
|
-
}
|
|
29
|
-
export declare const Amplify: AmplifyClass;
|
package/lib/Amplify.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.Amplify = exports.AmplifyClass = void 0;
|
|
20
|
-
// @ts-nocheck
|
|
21
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
22
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
23
|
-
var Logger_1 = require("./Logger");
|
|
24
|
-
var logger = new Logger_1.ConsoleLogger('Amplify');
|
|
25
|
-
var AmplifyClass = /** @class */ (function () {
|
|
26
|
-
function AmplifyClass() {
|
|
27
|
-
// Everything that is `register`ed is tracked here
|
|
28
|
-
this._components = [];
|
|
29
|
-
this._config = {};
|
|
30
|
-
// All modules (with `getModuleName()`) are stored here for dependency injection
|
|
31
|
-
this._modules = {};
|
|
32
|
-
// for backward compatibility to avoid breaking change
|
|
33
|
-
// if someone is using like Amplify.Auth
|
|
34
|
-
this.Auth = null;
|
|
35
|
-
this.Analytics = null;
|
|
36
|
-
this.API = null;
|
|
37
|
-
this.Credentials = null;
|
|
38
|
-
this.Storage = null;
|
|
39
|
-
this.I18n = null;
|
|
40
|
-
this.Cache = null;
|
|
41
|
-
this.PubSub = null;
|
|
42
|
-
this.Interactions = null;
|
|
43
|
-
this.Pushnotification = null;
|
|
44
|
-
this.UI = null;
|
|
45
|
-
this.XR = null;
|
|
46
|
-
this.Predictions = null;
|
|
47
|
-
this.DataStore = null;
|
|
48
|
-
this.Geo = null;
|
|
49
|
-
this.Notifications = null;
|
|
50
|
-
this.Logger = Logger_1.ConsoleLogger;
|
|
51
|
-
this.ServiceWorker = null;
|
|
52
|
-
}
|
|
53
|
-
Object.defineProperty(AmplifyClass.prototype, "config", {
|
|
54
|
-
// TODO: update "any" when types are determined
|
|
55
|
-
get: function () {
|
|
56
|
-
return Object.assign({}, this._config);
|
|
57
|
-
},
|
|
58
|
-
enumerable: false,
|
|
59
|
-
configurable: true
|
|
60
|
-
});
|
|
61
|
-
AmplifyClass.prototype.register = function (comp) {
|
|
62
|
-
logger.debug('component registered in amplify', comp);
|
|
63
|
-
this._components.push(comp);
|
|
64
|
-
if (typeof comp.getModuleName === 'function') {
|
|
65
|
-
this._modules[comp.getModuleName()] = comp;
|
|
66
|
-
this[comp.getModuleName()] = comp;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
logger.debug('no getModuleName method for component', comp);
|
|
70
|
-
}
|
|
71
|
-
// Finally configure this new component(category) loaded
|
|
72
|
-
// With the new modularization changes in Amplify V3, all the Amplify
|
|
73
|
-
// component are not loaded/registered right away but when they are
|
|
74
|
-
// imported (and hence instantiated) in the client's app. This ensures
|
|
75
|
-
// that all new components imported get correctly configured with the
|
|
76
|
-
// configuration that Amplify.configure() was called with.
|
|
77
|
-
comp.configure(this._config);
|
|
78
|
-
};
|
|
79
|
-
AmplifyClass.prototype.configure = function (config) {
|
|
80
|
-
var _this = this;
|
|
81
|
-
if (!config)
|
|
82
|
-
return this._config;
|
|
83
|
-
this._config = Object.assign(this._config, config);
|
|
84
|
-
logger.debug('amplify config', this._config);
|
|
85
|
-
// Dependency Injection via property-setting.
|
|
86
|
-
// This avoids introducing a public method/interface/setter that's difficult to remove later.
|
|
87
|
-
// Plus, it reduces `if` statements within the `constructor` and `configure` of each module
|
|
88
|
-
Object.entries(this._modules).forEach(function (_a) {
|
|
89
|
-
var _b = __read(_a, 2), Name = _b[0], comp = _b[1];
|
|
90
|
-
// e.g. Auth.*
|
|
91
|
-
Object.keys(comp).forEach(function (property) {
|
|
92
|
-
// e.g. Auth["Credentials"] = this._modules["Credentials"] when set
|
|
93
|
-
if (_this._modules[property]) {
|
|
94
|
-
comp[property] = _this._modules[property];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
this._components.map(function (comp) {
|
|
99
|
-
comp.configure(_this._config);
|
|
100
|
-
});
|
|
101
|
-
return this._config;
|
|
102
|
-
};
|
|
103
|
-
AmplifyClass.prototype.addPluggable = function (pluggable) {
|
|
104
|
-
if (pluggable &&
|
|
105
|
-
pluggable['getCategory'] &&
|
|
106
|
-
typeof pluggable['getCategory'] === 'function') {
|
|
107
|
-
this._components.map(function (comp) {
|
|
108
|
-
if (comp['addPluggable'] &&
|
|
109
|
-
typeof comp['addPluggable'] === 'function') {
|
|
110
|
-
comp.addPluggable(pluggable);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
return AmplifyClass;
|
|
116
|
-
}());
|
|
117
|
-
exports.AmplifyClass = AmplifyClass;
|
|
118
|
-
exports.Amplify = new AmplifyClass();
|