@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
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from '../../clients/middleware/retry';
|
|
20
20
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
21
21
|
import { observeFrameworkChanges } from '../../Platform/detectFramework';
|
|
22
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* The service name used to sign requests if the API requires authentication.
|
|
@@ -29,7 +30,9 @@ const SERVICE_NAME = 'cognito-identity';
|
|
|
29
30
|
* The endpoint resolver function that returns the endpoint URL for a given region.
|
|
30
31
|
*/
|
|
31
32
|
const endpointResolver = ({ region }: EndpointResolverOptions) => ({
|
|
32
|
-
url: new
|
|
33
|
+
url: new AmplifyUrl(
|
|
34
|
+
`https://cognito-identity.${region}.${getDnsSuffix(region)}`
|
|
35
|
+
),
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
/**
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { parseJsonError } from '../../clients/serde/json';
|
|
10
10
|
import type { EndpointResolverOptions, Headers } from '../../clients/types';
|
|
11
11
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
12
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* The service name used to sign requests if the API requires authentication.
|
|
@@ -19,7 +20,7 @@ const SERVICE_NAME = 'mobiletargeting';
|
|
|
19
20
|
* The endpoint resolver function that returns the endpoint URL for a given region.
|
|
20
21
|
*/
|
|
21
22
|
const endpointResolver = ({ region }: EndpointResolverOptions) => ({
|
|
22
|
-
url: new
|
|
23
|
+
url: new AmplifyUrl(`https://pinpoint.${region}.${getDnsSuffix(region)}`),
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
GetInAppMessagesCommandInput as GetInAppMessagesInput,
|
|
16
16
|
GetInAppMessagesCommandOutput as GetInAppMessagesOutput,
|
|
17
17
|
} from './types';
|
|
18
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
18
19
|
|
|
19
20
|
export type { GetInAppMessagesInput, GetInAppMessagesOutput };
|
|
20
21
|
|
|
@@ -23,7 +24,7 @@ const getInAppMessagesSerializer = (
|
|
|
23
24
|
endpoint: Endpoint
|
|
24
25
|
): HttpRequest => {
|
|
25
26
|
const headers = getSharedHeaders();
|
|
26
|
-
const url = new
|
|
27
|
+
const url = new AmplifyUrl(endpoint.url);
|
|
27
28
|
url.pathname = `v1/apps/${extendedEncodeURIComponent(
|
|
28
29
|
ApplicationId
|
|
29
30
|
)}/endpoints/${extendedEncodeURIComponent(EndpointId)}/inappmessages`;
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
PutEventsCommandInput as PutEventsInput,
|
|
17
17
|
PutEventsCommandOutput as PutEventsOutput,
|
|
18
18
|
} from './types';
|
|
19
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
19
20
|
|
|
20
21
|
export type { PutEventsInput, PutEventsOutput };
|
|
21
22
|
|
|
@@ -25,7 +26,7 @@ const putEventsSerializer = (
|
|
|
25
26
|
): HttpRequest => {
|
|
26
27
|
assert(!!ApplicationId, PinpointValidationErrorCode.NoAppId);
|
|
27
28
|
const headers = getSharedHeaders();
|
|
28
|
-
const url = new
|
|
29
|
+
const url = new AmplifyUrl(endpoint.url);
|
|
29
30
|
url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/events`;
|
|
30
31
|
const body = JSON.stringify(EventsRequest ?? {});
|
|
31
32
|
return { method: 'POST', headers, url, body };
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
UpdateEndpointCommandInput as UpdateEndpointInput,
|
|
16
16
|
UpdateEndpointCommandOutput as UpdateEndpointOutput,
|
|
17
17
|
} from './types';
|
|
18
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
18
19
|
|
|
19
20
|
export type { UpdateEndpointInput, UpdateEndpointOutput };
|
|
20
21
|
|
|
@@ -23,7 +24,7 @@ const updateEndpointSerializer = (
|
|
|
23
24
|
endpoint: Endpoint
|
|
24
25
|
): HttpRequest => {
|
|
25
26
|
const headers = getSharedHeaders();
|
|
26
|
-
const url = new
|
|
27
|
+
const url = new AmplifyUrl(endpoint.url);
|
|
27
28
|
url.pathname = `v1/apps/${extendedEncodeURIComponent(
|
|
28
29
|
ApplicationId
|
|
29
30
|
)}/endpoints/${extendedEncodeURIComponent(EndpointId)}`;
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from './constants';
|
|
16
16
|
import { getSigningValues } from './utils/getSigningValues';
|
|
17
17
|
import { getSignature } from './utils/getSignature';
|
|
18
|
+
import { AmplifyUrl } from '../../../../../utils/amplifyUrl';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
|
|
@@ -33,7 +34,7 @@ export const presignUrl = (
|
|
|
33
34
|
|
|
34
35
|
// create the request to sign
|
|
35
36
|
// @ts-ignore URL constructor accepts a URL object
|
|
36
|
-
const presignedUrl = new
|
|
37
|
+
const presignedUrl = new AmplifyUrl(url);
|
|
37
38
|
Object.entries({
|
|
38
39
|
[ALGORITHM_QUERY_PARAM]: SHA256_ALGORITHM_IDENTIFIER,
|
|
39
40
|
[CREDENTIAL_QUERY_PARAM]: `${accessKeyId}/${credentialScope}`,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { createAssertionFunction } from './createAssertionFunction';
|
|
5
|
+
import { AmplifyErrorCode, AmplifyErrorMap, AssertionFunction } from '../types';
|
|
6
|
+
|
|
7
|
+
const amplifyErrorMap: AmplifyErrorMap<AmplifyErrorCode> = {
|
|
8
|
+
[AmplifyErrorCode.NoEndpointId]: {
|
|
9
|
+
message: 'Endpoint ID was not found and was unable to be created.',
|
|
10
|
+
},
|
|
11
|
+
[AmplifyErrorCode.PlatformNotSupported]: {
|
|
12
|
+
message: 'Function not supported on current platform.',
|
|
13
|
+
},
|
|
14
|
+
[AmplifyErrorCode.Unknown]: {
|
|
15
|
+
message: 'An unknown error occurred.',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const assert: AssertionFunction<AmplifyErrorCode> =
|
|
20
|
+
createAssertionFunction(amplifyErrorMap);
|
package/src/errors/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -60,10 +60,14 @@ export {
|
|
|
60
60
|
export { KeyValueStorageInterface } from './types';
|
|
61
61
|
|
|
62
62
|
// Cache exports
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
export { BrowserStorageCache };
|
|
66
|
-
export { BrowserStorageCache as Cache }; // Maintain interoperability with React Native
|
|
63
|
+
export { Cache } from './Cache';
|
|
64
|
+
export { CacheConfig } from './Cache/types';
|
|
67
65
|
|
|
68
66
|
// Internationalization utilities
|
|
69
67
|
export { I18n } from './I18n';
|
|
68
|
+
|
|
69
|
+
// Logging utilities
|
|
70
|
+
export { ConsoleLogger } from './Logger';
|
|
71
|
+
|
|
72
|
+
// Service worker
|
|
73
|
+
export { ServiceWorker } from './ServiceWorker';
|
package/src/libraryUtils.ts
CHANGED
|
@@ -20,6 +20,8 @@ export {
|
|
|
20
20
|
} from './utils';
|
|
21
21
|
export { parseAWSExports } from './parseAWSExports';
|
|
22
22
|
export { LegacyConfig } from './singleton/types';
|
|
23
|
+
export { amplifyUuid } from './utils/amplifyUuid';
|
|
24
|
+
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
23
25
|
|
|
24
26
|
// Auth utilities
|
|
25
27
|
export {
|
|
@@ -38,13 +40,10 @@ export {
|
|
|
38
40
|
JwtPayload,
|
|
39
41
|
AuthStandardAttributeKey,
|
|
40
42
|
AuthVerifiableAttributeKey,
|
|
43
|
+
AWSCredentials,
|
|
41
44
|
} from './singleton/Auth/types';
|
|
42
45
|
|
|
43
|
-
// Logging utilities
|
|
44
|
-
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
45
|
-
|
|
46
46
|
// Platform & user-agent utilities
|
|
47
|
-
export { ClientDevice } from './ClientDevice';
|
|
48
47
|
export {
|
|
49
48
|
Platform,
|
|
50
49
|
getAmplifyUserAgentObject,
|
|
@@ -66,16 +65,14 @@ export {
|
|
|
66
65
|
PushNotificationAction,
|
|
67
66
|
StorageAction,
|
|
68
67
|
SetCustomUserAgentInput,
|
|
68
|
+
StorageUserAgentInput,
|
|
69
|
+
AuthUserAgentInput,
|
|
70
|
+
InAppMessagingUserAgentInput,
|
|
71
|
+
GeoUserAgentInput,
|
|
69
72
|
} from './Platform/types';
|
|
70
73
|
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
71
74
|
|
|
72
|
-
//
|
|
73
|
-
export { ServiceWorker } from './ServiceWorker';
|
|
74
|
-
|
|
75
|
-
// Other utilities & constants
|
|
76
|
-
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
77
|
-
export { Mutex } from './Mutex';
|
|
78
|
-
export { Reachability } from './Reachability';
|
|
75
|
+
// Error handling
|
|
79
76
|
export {
|
|
80
77
|
AmplifyError,
|
|
81
78
|
PlatformNotSupportedError,
|
|
@@ -88,6 +85,11 @@ export {
|
|
|
88
85
|
AssertionFunction,
|
|
89
86
|
ServiceError,
|
|
90
87
|
} from './types';
|
|
88
|
+
|
|
89
|
+
// Other utilities & constants
|
|
90
|
+
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
91
|
+
export { Mutex } from './Mutex';
|
|
92
|
+
export { Reachability } from './Reachability';
|
|
91
93
|
export {
|
|
92
94
|
INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER,
|
|
93
95
|
USER_AGENT_HEADER,
|
|
@@ -99,3 +101,7 @@ export { getCrypto } from './utils/globalHelpers';
|
|
|
99
101
|
|
|
100
102
|
// Hub
|
|
101
103
|
export { HubInternal } from './Hub';
|
|
104
|
+
|
|
105
|
+
// Session listener
|
|
106
|
+
export { sessionListener } from './utils/sessionListener';
|
|
107
|
+
export { SessionState } from './utils/sessionListener/types';
|
package/src/parseAWSExports.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
AuthStandardAttributeKey,
|
|
7
7
|
AuthConfigUserAttributes,
|
|
8
8
|
} from './singleton/Auth/types';
|
|
9
|
+
|
|
9
10
|
import { ResourcesConfig } from './singleton/types';
|
|
10
11
|
|
|
11
12
|
const logger = new Logger('parseAWSExports');
|
|
@@ -36,6 +37,8 @@ export const parseAWSExports = (
|
|
|
36
37
|
aws_appsync_authenticationType,
|
|
37
38
|
aws_appsync_graphqlEndpoint,
|
|
38
39
|
aws_appsync_region,
|
|
40
|
+
aws_bots,
|
|
41
|
+
aws_bots_config,
|
|
39
42
|
aws_cognito_identity_pool_id,
|
|
40
43
|
aws_cognito_sign_up_verification_method,
|
|
41
44
|
aws_cognito_mfa_configuration,
|
|
@@ -71,20 +74,36 @@ export const parseAWSExports = (
|
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
// Notifications
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
const { InAppMessaging, Push } = Notifications ?? {};
|
|
78
|
+
if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {
|
|
79
|
+
amplifyConfig.Notifications = {};
|
|
80
|
+
if (InAppMessaging?.AWSPinpoint) {
|
|
81
|
+
const { appId, region } = InAppMessaging.AWSPinpoint;
|
|
82
|
+
amplifyConfig.Notifications.InAppMessaging = {
|
|
83
|
+
Pinpoint: {
|
|
84
|
+
appId,
|
|
85
|
+
region,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (Push?.AWSPinpoint) {
|
|
90
|
+
const { appId, region } = Push.AWSPinpoint;
|
|
91
|
+
amplifyConfig.Notifications.PushNotification = {
|
|
92
|
+
Pinpoint: {
|
|
93
|
+
appId,
|
|
94
|
+
region,
|
|
83
95
|
},
|
|
84
96
|
};
|
|
85
97
|
}
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
// Interactions
|
|
101
|
+
if (Array.isArray(aws_bots_config)) {
|
|
102
|
+
amplifyConfig.Interactions = {
|
|
103
|
+
LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
88
107
|
// API
|
|
89
108
|
if (aws_appsync_graphqlEndpoint) {
|
|
90
109
|
const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];
|
|
@@ -1,7 +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 {
|
|
4
|
+
import { AWSCredentials } from '../../../libraryUtils';
|
|
5
5
|
import { getEventBuffer } from '../utils/getEventBuffer';
|
|
6
6
|
import {
|
|
7
7
|
BUFFER_SIZE,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
export const flushEvents = (
|
|
14
14
|
appId: string,
|
|
15
15
|
region: string,
|
|
16
|
-
credentials:
|
|
16
|
+
credentials: AWSCredentials,
|
|
17
17
|
identityId?: string,
|
|
18
18
|
userAgentValue?: string
|
|
19
19
|
) => {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
5
5
|
import { PinpointRecordInput, PinpointSession } from '../types';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveEndpointId } from '../utils';
|
|
7
7
|
import {
|
|
8
8
|
BUFFER_SIZE,
|
|
9
9
|
FLUSH_INTERVAL,
|
|
10
10
|
FLUSH_SIZE,
|
|
11
11
|
RESEND_LIMIT,
|
|
12
12
|
} from '../utils/constants';
|
|
13
|
-
import { updateEndpoint } from './updateEndpoint';
|
|
14
13
|
import { getEventBuffer } from '../utils/getEventBuffer';
|
|
15
|
-
import { AmplifyError } from '../../../errors';
|
|
16
14
|
|
|
17
15
|
// TODO(v6) Refactor when we add support for session tracking & `autoTrack`
|
|
18
16
|
let session: PinpointSession;
|
|
@@ -23,6 +21,7 @@ let session: PinpointSession;
|
|
|
23
21
|
export const record = async ({
|
|
24
22
|
appId,
|
|
25
23
|
category,
|
|
24
|
+
channelType,
|
|
26
25
|
credentials,
|
|
27
26
|
event,
|
|
28
27
|
identityId,
|
|
@@ -30,8 +29,7 @@ export const record = async ({
|
|
|
30
29
|
userAgentValue,
|
|
31
30
|
}: PinpointRecordInput): Promise<void> => {
|
|
32
31
|
const timestampISOString = new Date().toISOString();
|
|
33
|
-
const eventId =
|
|
34
|
-
let endpointId = await getEndpointId(appId, category);
|
|
32
|
+
const eventId = amplifyUuid();
|
|
35
33
|
|
|
36
34
|
// Prepare event buffer if required
|
|
37
35
|
const buffer = getEventBuffer({
|
|
@@ -46,31 +44,19 @@ export const record = async ({
|
|
|
46
44
|
userAgentValue,
|
|
47
45
|
});
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
userAgentValue,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
endpointId = await getEndpointId(appId, category);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!endpointId) {
|
|
65
|
-
throw new AmplifyError({
|
|
66
|
-
name: 'ENDPOINT_NOT_CREATED',
|
|
67
|
-
message: 'Endpoint was not created.',
|
|
68
|
-
});
|
|
69
|
-
}
|
|
47
|
+
const endpointId = await resolveEndpointId({
|
|
48
|
+
appId,
|
|
49
|
+
category,
|
|
50
|
+
channelType,
|
|
51
|
+
credentials,
|
|
52
|
+
identityId,
|
|
53
|
+
region,
|
|
54
|
+
userAgentValue,
|
|
55
|
+
});
|
|
70
56
|
|
|
71
57
|
// Generate session if required
|
|
72
58
|
if (!session) {
|
|
73
|
-
const sessionId =
|
|
59
|
+
const sessionId = amplifyUuid();
|
|
74
60
|
|
|
75
61
|
session = {
|
|
76
62
|
Id: sessionId,
|
|
@@ -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
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
5
|
+
import { getClientInfo } from '../../../utils/getClientInfo';
|
|
6
6
|
import {
|
|
7
7
|
updateEndpoint as clientUpdateEndpoint,
|
|
8
8
|
UpdateEndpointInput,
|
|
@@ -29,7 +29,7 @@ export const updateEndpoint = async ({
|
|
|
29
29
|
}: PinpointUpdateEndpointInput): Promise<void> => {
|
|
30
30
|
const endpointId = await getEndpointId(appId, category);
|
|
31
31
|
// only generate a new endpoint id if one was not found in cache
|
|
32
|
-
const createdEndpointId = !endpointId ?
|
|
32
|
+
const createdEndpointId = !endpointId ? amplifyUuid() : undefined;
|
|
33
33
|
const {
|
|
34
34
|
customProperties,
|
|
35
35
|
demographic,
|
|
@@ -39,7 +39,7 @@ export const updateEndpoint = async ({
|
|
|
39
39
|
name,
|
|
40
40
|
plan,
|
|
41
41
|
} = userProfile ?? {};
|
|
42
|
-
const clientInfo =
|
|
42
|
+
const clientInfo = getClientInfo();
|
|
43
43
|
const mergedDemographic = {
|
|
44
44
|
appVersion: clientInfo.appVersion,
|
|
45
45
|
make: clientInfo.make,
|
|
@@ -59,7 +59,7 @@ export const updateEndpoint = async ({
|
|
|
59
59
|
ApplicationId: appId,
|
|
60
60
|
EndpointId: endpointId ?? createdEndpointId,
|
|
61
61
|
EndpointRequest: {
|
|
62
|
-
RequestId:
|
|
62
|
+
RequestId: amplifyUuid(),
|
|
63
63
|
EffectiveDate: new Date().toISOString(),
|
|
64
64
|
ChannelType: channelType,
|
|
65
65
|
Address: address,
|
|
@@ -93,6 +93,6 @@ export const updateEndpoint = async ({
|
|
|
93
93
|
await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);
|
|
94
94
|
// if we had to create an endpoint id, we need to now cache it
|
|
95
95
|
if (!!createdEndpointId) {
|
|
96
|
-
cacheEndpointId(appId, category, createdEndpointId);
|
|
96
|
+
return cacheEndpointId(appId, category, createdEndpointId);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
export * from './apis';
|
|
5
|
-
export {
|
|
6
|
-
|
|
5
|
+
export {
|
|
6
|
+
PinpointAnalyticsEvent,
|
|
7
|
+
PinpointServiceOptions,
|
|
8
|
+
UpdateEndpointException,
|
|
9
|
+
} from './types';
|
|
10
|
+
export { resolveEndpointId } from './utils';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export enum UpdateEndpointException {
|
|
5
|
+
BadRequestException = 'BadRequestException',
|
|
6
|
+
ForbiddenException = 'ForbiddenException',
|
|
7
|
+
InternalServerErrorException = 'InternalServerErrorException',
|
|
8
|
+
MethodNotAllowedException = 'MethodNotAllowedException',
|
|
9
|
+
NotFoundException = 'NotFoundException',
|
|
10
|
+
PayloadTooLargeException = 'PayloadTooLargeException',
|
|
11
|
+
TooManyRequestsException = 'TooManyRequestsException',
|
|
12
|
+
}
|
|
@@ -6,10 +6,11 @@ import { UserProfile } from '../../../types';
|
|
|
6
6
|
|
|
7
7
|
export type SupportedCategory =
|
|
8
8
|
| 'Analytics'
|
|
9
|
+
| 'Core'
|
|
9
10
|
| 'InAppMessaging'
|
|
10
11
|
| 'PushNotification';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
|
|
13
14
|
|
|
14
15
|
export type PinpointProviderConfig = {
|
|
15
16
|
Pinpoint?: {
|
|
@@ -39,6 +40,7 @@ export type PinpointAnalyticsEvent = {
|
|
|
39
40
|
type PinpointCommonParameters = {
|
|
40
41
|
appId: string;
|
|
41
42
|
category: SupportedCategory;
|
|
43
|
+
channelType?: SupportedChannelType;
|
|
42
44
|
credentials: Required<AuthSession>['credentials'];
|
|
43
45
|
identityId?: AuthSession['identityId'];
|
|
44
46
|
region: string;
|
|
@@ -47,7 +49,6 @@ type PinpointCommonParameters = {
|
|
|
47
49
|
|
|
48
50
|
export type PinpointUpdateEndpointInput = PinpointCommonParameters &
|
|
49
51
|
PinpointServiceOptions & {
|
|
50
|
-
channelType?: SupportedChannelType;
|
|
51
52
|
userId?: string;
|
|
52
53
|
userProfile?: UserProfile;
|
|
53
54
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../../errors';
|
|
5
|
+
import { AmplifyErrorCode } from '../../../types';
|
|
6
|
+
import { updateEndpoint } from '../apis';
|
|
7
|
+
import { PinpointUpdateEndpointInput } from '../types';
|
|
8
|
+
import { getEndpointId } from './getEndpointId';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
|
|
12
|
+
* which will generate and cache an endpoint id between calls.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export const resolveEndpointId = async ({
|
|
17
|
+
address,
|
|
18
|
+
appId,
|
|
19
|
+
category,
|
|
20
|
+
channelType,
|
|
21
|
+
credentials,
|
|
22
|
+
identityId,
|
|
23
|
+
region,
|
|
24
|
+
userAgentValue,
|
|
25
|
+
}: PinpointUpdateEndpointInput) => {
|
|
26
|
+
let endpointId = await getEndpointId(appId, category);
|
|
27
|
+
|
|
28
|
+
if (!endpointId) {
|
|
29
|
+
await updateEndpoint({
|
|
30
|
+
address,
|
|
31
|
+
appId,
|
|
32
|
+
category,
|
|
33
|
+
channelType,
|
|
34
|
+
credentials,
|
|
35
|
+
identityId,
|
|
36
|
+
region,
|
|
37
|
+
userAgentValue,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
endpointId = await getEndpointId(appId, category);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
assert(!!endpointId, AmplifyErrorCode.NoEndpointId);
|
|
44
|
+
|
|
45
|
+
return endpointId;
|
|
46
|
+
};
|
package/src/singleton/Amplify.ts
CHANGED
|
@@ -4,24 +4,23 @@ import { AuthClass } from './Auth';
|
|
|
4
4
|
import { Hub, AMPLIFY_SYMBOL } from '../Hub';
|
|
5
5
|
import { LegacyConfig, LibraryOptions, ResourcesConfig } from './types';
|
|
6
6
|
import { parseAWSExports } from '../parseAWSExports';
|
|
7
|
-
|
|
8
|
-
// TODO(v6): add default AuthTokenStore for each platform
|
|
7
|
+
import { deepFreeze } from '../utils';
|
|
9
8
|
|
|
10
9
|
export class AmplifyClass {
|
|
11
10
|
resourcesConfig: ResourcesConfig;
|
|
12
11
|
libraryOptions: LibraryOptions;
|
|
12
|
+
|
|
13
13
|
/**
|
|
14
14
|
* Cross-category Auth utilities.
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
public readonly Auth: AuthClass;
|
|
19
|
+
|
|
19
20
|
constructor() {
|
|
20
21
|
this.resourcesConfig = {};
|
|
21
|
-
this.Auth = new AuthClass();
|
|
22
|
-
|
|
23
|
-
// TODO(v6): add default providers for getting started
|
|
24
22
|
this.libraryOptions = {};
|
|
23
|
+
this.Auth = new AuthClass();
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
/**
|
|
@@ -55,6 +54,9 @@ export class AmplifyClass {
|
|
|
55
54
|
libraryOptions
|
|
56
55
|
);
|
|
57
56
|
|
|
57
|
+
// Make resource config immutable
|
|
58
|
+
this.resourcesConfig = deepFreeze(this.resourcesConfig);
|
|
59
|
+
|
|
58
60
|
this.Auth.configure(this.resourcesConfig.Auth!, this.libraryOptions.Auth);
|
|
59
61
|
|
|
60
62
|
Hub.dispatch(
|
|
@@ -71,10 +73,10 @@ export class AmplifyClass {
|
|
|
71
73
|
/**
|
|
72
74
|
* Provides access to the current back-end resource configuration for the Library.
|
|
73
75
|
*
|
|
74
|
-
* @returns Returns the
|
|
76
|
+
* @returns Returns the immutable back-end resource configuration.
|
|
75
77
|
*/
|
|
76
|
-
getConfig(): ResourcesConfig {
|
|
77
|
-
return
|
|
78
|
+
getConfig(): Readonly<ResourcesConfig> {
|
|
79
|
+
return this.resourcesConfig;
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -113,12 +113,12 @@ export type AuthIdentityPoolConfig = {
|
|
|
113
113
|
Cognito: CognitoIdentityPoolConfig & {
|
|
114
114
|
userPoolClientId?: never;
|
|
115
115
|
userPoolId?: never;
|
|
116
|
+
userPoolEndpoint?: never;
|
|
116
117
|
loginWith?: never;
|
|
117
118
|
signUpVerificationMethod?: never;
|
|
118
119
|
userAttributes?: never;
|
|
119
120
|
mfa?: never;
|
|
120
121
|
passwordFormat?: never;
|
|
121
|
-
endpoint?: never;
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
124
|
|
|
@@ -137,6 +137,7 @@ export type AuthUserPoolConfig = {
|
|
|
137
137
|
export type CognitoUserPoolConfig = {
|
|
138
138
|
userPoolClientId: string;
|
|
139
139
|
userPoolId: string;
|
|
140
|
+
userPoolEndpoint?: string;
|
|
140
141
|
signUpVerificationMethod?: 'code' | 'link';
|
|
141
142
|
loginWith?: {
|
|
142
143
|
oauth?: OAuthConfig;
|
|
@@ -157,7 +158,6 @@ export type CognitoUserPoolConfig = {
|
|
|
157
158
|
requireNumbers?: boolean;
|
|
158
159
|
requireSpecialCharacters?: boolean;
|
|
159
160
|
};
|
|
160
|
-
endpoint?: string;
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
export type OAuthConfig = {
|
|
@@ -217,7 +217,7 @@ export type AWSCredentialsAndIdentityId = {
|
|
|
217
217
|
identityId?: string;
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
type AWSCredentials = {
|
|
220
|
+
export type AWSCredentials = {
|
|
221
221
|
accessKeyId: string;
|
|
222
222
|
secretAccessKey: string;
|
|
223
223
|
sessionToken?: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Cache instance options
|
|
6
|
+
*/
|
|
7
|
+
export interface CacheConfig {
|
|
8
|
+
/** Prepend to key to avoid conflicts */
|
|
9
|
+
keyPrefix: string;
|
|
10
|
+
|
|
11
|
+
/** Cache capacity, in bytes */
|
|
12
|
+
capacityInBytes: number;
|
|
13
|
+
|
|
14
|
+
/** Max size of one item */
|
|
15
|
+
itemMaxSize: number;
|
|
16
|
+
|
|
17
|
+
/** Time to live, in milliseconds */
|
|
18
|
+
defaultTTL: number;
|
|
19
|
+
|
|
20
|
+
/** Warn when over threshold percentage of capacity, maximum 1 */
|
|
21
|
+
warningThreshold: number;
|
|
22
|
+
|
|
23
|
+
/** default priority number put on cached items */
|
|
24
|
+
defaultPriority: number;
|
|
25
|
+
|
|
26
|
+
storage?: Storage;
|
|
27
|
+
}
|