@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
|
@@ -41,6 +41,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
41
41
|
import { ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, EXPIRES_QUERY_PARAM, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_QUERY_PARAM, } from './constants';
|
|
42
42
|
import { getSigningValues } from './utils/getSigningValues';
|
|
43
43
|
import { getSignature } from './utils/getSignature';
|
|
44
|
+
import { AmplifyUrl } from '../../../../../utils/amplifyUrl';
|
|
44
45
|
/**
|
|
45
46
|
* Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
|
|
46
47
|
*
|
|
@@ -56,7 +57,7 @@ export var presignUrl = function (_a, _b) {
|
|
|
56
57
|
var accessKeyId = signingValues.accessKeyId, credentialScope = signingValues.credentialScope, longDate = signingValues.longDate, sessionToken = signingValues.sessionToken;
|
|
57
58
|
// create the request to sign
|
|
58
59
|
// @ts-ignore URL constructor accepts a URL object
|
|
59
|
-
var presignedUrl = new
|
|
60
|
+
var presignedUrl = new AmplifyUrl(url);
|
|
60
61
|
Object.entries(__assign(__assign((_c = {}, _c[ALGORITHM_QUERY_PARAM] = SHA256_ALGORITHM_IDENTIFIER, _c[CREDENTIAL_QUERY_PARAM] = "".concat(accessKeyId, "/").concat(credentialScope), _c[AMZ_DATE_QUERY_PARAM] = longDate, _c[SIGNED_HEADERS_QUERY_PARAM] = HOST_HEADER, _c), (expiration && (_d = {}, _d[EXPIRES_QUERY_PARAM] = expiration.toString(), _d))), (sessionToken && (_e = {}, _e[TOKEN_QUERY_PARAM] = sessionToken, _e)))).forEach(function (_a) {
|
|
61
62
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
62
63
|
presignedUrl.searchParams.append(key, value);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var _a;
|
|
4
|
+
import { createAssertionFunction } from './createAssertionFunction';
|
|
5
|
+
import { AmplifyErrorCode } from '../types';
|
|
6
|
+
var amplifyErrorMap = (_a = {},
|
|
7
|
+
_a[AmplifyErrorCode.NoEndpointId] = {
|
|
8
|
+
message: 'Endpoint ID was not found and was unable to be created.',
|
|
9
|
+
},
|
|
10
|
+
_a[AmplifyErrorCode.PlatformNotSupported] = {
|
|
11
|
+
message: 'Function not supported on current platform.',
|
|
12
|
+
},
|
|
13
|
+
_a[AmplifyErrorCode.Unknown] = {
|
|
14
|
+
message: 'An unknown error occurred.',
|
|
15
|
+
},
|
|
16
|
+
_a);
|
|
17
|
+
export var assert = createAssertionFunction(amplifyErrorMap);
|
package/lib-esm/errors/index.js
CHANGED
package/lib-esm/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCr
|
|
|
7
7
|
export { UserProfile } from './types';
|
|
8
8
|
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
9
9
|
export { KeyValueStorageInterface } from './types';
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
export { BrowserStorageCache };
|
|
13
|
-
export { BrowserStorageCache as Cache };
|
|
10
|
+
export { Cache } from './Cache';
|
|
11
|
+
export { CacheConfig } from './Cache/types';
|
|
14
12
|
export { I18n } from './I18n';
|
|
13
|
+
export { ConsoleLogger } from './Logger';
|
|
14
|
+
export { ServiceWorker } from './ServiceWorker';
|
package/lib-esm/index.js
CHANGED
|
@@ -11,9 +11,10 @@ export { getCredentialsForIdentity, getId, } from './awsClients/cognitoIdentity'
|
|
|
11
11
|
// Storage helpers
|
|
12
12
|
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
13
13
|
// Cache exports
|
|
14
|
-
|
|
15
|
-
export { InMemoryCache } from './Cache/InMemoryCache';
|
|
16
|
-
export { BrowserStorageCache };
|
|
17
|
-
export { BrowserStorageCache as Cache }; // Maintain interoperability with React Native
|
|
14
|
+
export { Cache } from './Cache';
|
|
18
15
|
// Internationalization utilities
|
|
19
16
|
export { I18n } from './I18n';
|
|
17
|
+
// Logging utilities
|
|
18
|
+
export { ConsoleLogger } from './Logger';
|
|
19
|
+
// Service worker
|
|
20
|
+
export { ServiceWorker } from './ServiceWorker';
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
|
|
2
2
|
export { parseAWSExports } from './parseAWSExports';
|
|
3
3
|
export { LegacyConfig } from './singleton/types';
|
|
4
|
+
export { amplifyUuid } from './utils/amplifyUuid';
|
|
5
|
+
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
4
6
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
5
7
|
export { isTokenExpired } from './singleton/Auth';
|
|
6
8
|
export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
|
|
7
9
|
export { Signer } from './Signer';
|
|
8
|
-
export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, } from './singleton/Auth/types';
|
|
9
|
-
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
10
|
-
export { ClientDevice } from './ClientDevice';
|
|
10
|
+
export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials, } from './singleton/Auth/types';
|
|
11
11
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
12
|
-
export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
|
|
12
|
+
export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, StorageUserAgentInput, AuthUserAgentInput, InAppMessagingUserAgentInput, GeoUserAgentInput, } from './Platform/types';
|
|
13
13
|
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
14
|
-
export {
|
|
14
|
+
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
15
|
+
export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
|
|
15
16
|
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
16
17
|
export { Mutex } from './Mutex';
|
|
17
18
|
export { Reachability } from './Reachability';
|
|
18
|
-
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
19
|
-
export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
|
|
20
19
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
|
|
21
20
|
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
|
22
21
|
export { AMPLIFY_SYMBOL } from './Hub';
|
|
23
22
|
export { base64Decoder, base64Encoder } from './utils/convert';
|
|
24
23
|
export { getCrypto } from './utils/globalHelpers';
|
|
25
24
|
export { HubInternal } from './Hub';
|
|
25
|
+
export { sessionListener } from './utils/sessionListener';
|
|
26
|
+
export { SessionState } from './utils/sessionListener/types';
|
package/lib-esm/libraryUtils.js
CHANGED
|
@@ -7,25 +7,23 @@ utils for use throughout the library.
|
|
|
7
7
|
// Core utilities
|
|
8
8
|
export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
|
|
9
9
|
export { parseAWSExports } from './parseAWSExports';
|
|
10
|
+
export { amplifyUuid } from './utils/amplifyUuid';
|
|
11
|
+
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
10
12
|
// Auth utilities
|
|
11
13
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
12
14
|
export { isTokenExpired } from './singleton/Auth';
|
|
13
15
|
export { Signer } from './Signer';
|
|
14
|
-
// Logging utilities
|
|
15
|
-
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
16
16
|
// Platform & user-agent utilities
|
|
17
|
-
export { ClientDevice } from './ClientDevice';
|
|
18
17
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
19
18
|
export { ApiAction, AuthAction, AnalyticsAction, Category, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
|
|
20
19
|
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
21
|
-
//
|
|
22
|
-
export {
|
|
20
|
+
// Error handling
|
|
21
|
+
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
22
|
+
export { AmplifyErrorCode, } from './types';
|
|
23
23
|
// Other utilities & constants
|
|
24
24
|
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
25
25
|
export { Mutex } from './Mutex';
|
|
26
26
|
export { Reachability } from './Reachability';
|
|
27
|
-
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
28
|
-
export { AmplifyErrorCode, } from './types';
|
|
29
27
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
|
|
30
28
|
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
|
31
29
|
export { AMPLIFY_SYMBOL } from './Hub';
|
|
@@ -33,3 +31,5 @@ export { base64Decoder, base64Encoder } from './utils/convert';
|
|
|
33
31
|
export { getCrypto } from './utils/globalHelpers';
|
|
34
32
|
// Hub
|
|
35
33
|
export { HubInternal } from './Hub';
|
|
34
|
+
// Session listener
|
|
35
|
+
export { sessionListener } from './utils/sessionListener';
|
|
@@ -55,9 +55,9 @@ var authTypeMapping = {
|
|
|
55
55
|
* @returns A {@link ResourcesConfig} object.
|
|
56
56
|
*/
|
|
57
57
|
export var parseAWSExports = function (config) {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
59
59
|
if (config === void 0) { config = {}; }
|
|
60
|
-
var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications, modelIntrospection = config.modelIntrospection;
|
|
60
|
+
var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_bots = config.aws_bots, aws_bots_config = config.aws_bots_config, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications, modelIntrospection = config.modelIntrospection;
|
|
61
61
|
var amplifyConfig = {};
|
|
62
62
|
// Analytics
|
|
63
63
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -69,18 +69,33 @@ export var parseAWSExports = function (config) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
// Notifications
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
var _o = Notifications !== null && Notifications !== void 0 ? Notifications : {}, InAppMessaging = _o.InAppMessaging, Push = _o.Push;
|
|
73
|
+
if ((InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) || (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint)) {
|
|
74
|
+
amplifyConfig.Notifications = {};
|
|
75
|
+
if (InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) {
|
|
76
|
+
var _p = InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
|
|
77
|
+
amplifyConfig.Notifications.InAppMessaging = {
|
|
78
|
+
Pinpoint: {
|
|
79
|
+
appId: appId,
|
|
80
|
+
region: region,
|
|
81
81
|
},
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
+
if (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint) {
|
|
85
|
+
var _q = Push.AWSPinpoint, appId = _q.appId, region = _q.region;
|
|
86
|
+
amplifyConfig.Notifications.PushNotification = {
|
|
87
|
+
Pinpoint: {
|
|
88
|
+
appId: appId,
|
|
89
|
+
region: region,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Interactions
|
|
95
|
+
if (Array.isArray(aws_bots_config)) {
|
|
96
|
+
amplifyConfig.Interactions = {
|
|
97
|
+
LexV1: Object.fromEntries(aws_bots_config.map(function (bot) { return [bot.name, bot]; })),
|
|
98
|
+
};
|
|
84
99
|
}
|
|
85
100
|
// API
|
|
86
101
|
if (aws_appsync_graphqlEndpoint) {
|
|
@@ -105,17 +120,17 @@ export var parseAWSExports = function (config) {
|
|
|
105
120
|
? {
|
|
106
121
|
status: aws_cognito_mfa_configuration &&
|
|
107
122
|
aws_cognito_mfa_configuration.toLowerCase(),
|
|
108
|
-
totpEnabled: (
|
|
109
|
-
smsEnabled: (
|
|
123
|
+
totpEnabled: (_a = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _a !== void 0 ? _a : false,
|
|
124
|
+
smsEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _b !== void 0 ? _b : false,
|
|
110
125
|
}
|
|
111
126
|
: undefined;
|
|
112
127
|
var passwordFormatConfig = aws_cognito_password_protection_settings
|
|
113
128
|
? {
|
|
114
129
|
minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
|
|
115
|
-
requireLowercase: (
|
|
116
|
-
requireUppercase: (
|
|
117
|
-
requireNumbers: (
|
|
118
|
-
requireSpecialCharacters: (
|
|
130
|
+
requireLowercase: (_d = (_c = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _c === void 0 ? void 0 : _c.includes('REQUIRES_LOWERCASE')) !== null && _d !== void 0 ? _d : false,
|
|
131
|
+
requireUppercase: (_f = (_e = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _e === void 0 ? void 0 : _e.includes('REQUIRES_UPPERCASE')) !== null && _f !== void 0 ? _f : false,
|
|
132
|
+
requireNumbers: (_h = (_g = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _g === void 0 ? void 0 : _g.includes('REQUIRES_NUMBERS')) !== null && _h !== void 0 ? _h : false,
|
|
133
|
+
requireSpecialCharacters: (_k = (_j = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _j === void 0 ? void 0 : _j.includes('REQUIRES_SYMBOLS')) !== null && _k !== void 0 ? _k : false,
|
|
119
134
|
}
|
|
120
135
|
: undefined;
|
|
121
136
|
var mergedUserAttributes = Array.from(new Set(__spreadArray(__spreadArray([], __read((aws_cognito_verification_mechanisms !== null && aws_cognito_verification_mechanisms !== void 0 ? aws_cognito_verification_mechanisms : [])), false), __read((aws_cognito_signup_attributes !== null && aws_cognito_signup_attributes !== void 0 ? aws_cognito_signup_attributes : [])), false)));
|
|
@@ -127,8 +142,8 @@ export var parseAWSExports = function (config) {
|
|
|
127
142
|
},
|
|
128
143
|
_a);
|
|
129
144
|
});
|
|
130
|
-
var loginWithEmailEnabled = (
|
|
131
|
-
var loginWithPhoneEnabled = (
|
|
145
|
+
var loginWithEmailEnabled = (_l = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _l !== void 0 ? _l : false;
|
|
146
|
+
var loginWithPhoneEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _m !== void 0 ? _m : false;
|
|
132
147
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
133
148
|
amplifyConfig.Auth = {
|
|
134
149
|
Cognito: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const flushEvents: (appId: string, region: string, credentials:
|
|
1
|
+
import { AWSCredentials } from '../../../libraryUtils';
|
|
2
|
+
export declare const flushEvents: (appId: string, region: string, credentials: AWSCredentials, identityId?: string, userAgentValue?: string) => void;
|
|
@@ -2,4 +2,4 @@ import { PinpointRecordInput } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
|
|
5
|
+
export declare const record: ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
|
|
@@ -36,29 +36,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
39
|
+
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
40
|
+
import { resolveEndpointId } from '../utils';
|
|
41
41
|
import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';
|
|
42
|
-
import { updateEndpoint } from './updateEndpoint';
|
|
43
42
|
import { getEventBuffer } from '../utils/getEventBuffer';
|
|
44
|
-
import { AmplifyError } from '../../../errors';
|
|
45
43
|
// TODO(v6) Refactor when we add support for session tracking & `autoTrack`
|
|
46
44
|
var session;
|
|
47
45
|
/**
|
|
48
46
|
* @internal
|
|
49
47
|
*/
|
|
50
48
|
export var record = function (_a) {
|
|
51
|
-
var appId = _a.appId, category = _a.category, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
|
|
49
|
+
var appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
|
|
52
50
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
-
var timestampISOString, eventId,
|
|
51
|
+
var timestampISOString, eventId, buffer, endpointId, sessionId;
|
|
54
52
|
return __generator(this, function (_b) {
|
|
55
53
|
switch (_b.label) {
|
|
56
54
|
case 0:
|
|
57
55
|
timestampISOString = new Date().toISOString();
|
|
58
|
-
eventId =
|
|
59
|
-
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
60
|
-
case 1:
|
|
61
|
-
endpointId = _b.sent();
|
|
56
|
+
eventId = amplifyUuid();
|
|
62
57
|
buffer = getEventBuffer({
|
|
63
58
|
appId: appId,
|
|
64
59
|
bufferSize: BUFFER_SIZE,
|
|
@@ -70,31 +65,20 @@ export var record = function (_a) {
|
|
|
70
65
|
resendLimit: RESEND_LIMIT,
|
|
71
66
|
userAgentValue: userAgentValue,
|
|
72
67
|
});
|
|
73
|
-
|
|
74
|
-
return [4 /*yield*/, updateEndpoint({
|
|
68
|
+
return [4 /*yield*/, resolveEndpointId({
|
|
75
69
|
appId: appId,
|
|
76
70
|
category: category,
|
|
71
|
+
channelType: channelType,
|
|
77
72
|
credentials: credentials,
|
|
78
73
|
identityId: identityId,
|
|
79
74
|
region: region,
|
|
80
75
|
userAgentValue: userAgentValue,
|
|
81
76
|
})];
|
|
82
|
-
case
|
|
83
|
-
_b.sent();
|
|
84
|
-
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
85
|
-
case 3:
|
|
77
|
+
case 1:
|
|
86
78
|
endpointId = _b.sent();
|
|
87
|
-
_b.label = 4;
|
|
88
|
-
case 4:
|
|
89
|
-
if (!endpointId) {
|
|
90
|
-
throw new AmplifyError({
|
|
91
|
-
name: 'ENDPOINT_NOT_CREATED',
|
|
92
|
-
message: 'Endpoint was not created.',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
79
|
// Generate session if required
|
|
96
80
|
if (!session) {
|
|
97
|
-
sessionId =
|
|
81
|
+
sessionId = amplifyUuid();
|
|
98
82
|
session = {
|
|
99
83
|
Id: sessionId,
|
|
100
84
|
StartTimestamp: timestampISOString,
|
|
@@ -47,8 +47,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
50
|
+
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
51
|
+
import { getClientInfo } from '../../../utils/getClientInfo';
|
|
52
52
|
import { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';
|
|
53
53
|
import { cacheEndpointId, getEndpointId } from '../utils';
|
|
54
54
|
/**
|
|
@@ -63,9 +63,9 @@ export var updateEndpoint = function (_a) {
|
|
|
63
63
|
case 0: return [4 /*yield*/, getEndpointId(appId, category)];
|
|
64
64
|
case 1:
|
|
65
65
|
endpointId = _c.sent();
|
|
66
|
-
createdEndpointId = !endpointId ?
|
|
66
|
+
createdEndpointId = !endpointId ? amplifyUuid() : undefined;
|
|
67
67
|
_b = userProfile !== null && userProfile !== void 0 ? userProfile : {}, customProperties = _b.customProperties, demographic = _b.demographic, email = _b.email, location = _b.location, metrics = _b.metrics, name = _b.name, plan = _b.plan;
|
|
68
|
-
clientInfo =
|
|
68
|
+
clientInfo = getClientInfo();
|
|
69
69
|
mergedDemographic = __assign({ appVersion: clientInfo.appVersion, make: clientInfo.make, model: clientInfo.model, modelVersion: clientInfo.version, platform: clientInfo.platform }, demographic);
|
|
70
70
|
shouldAddAttributes = email || customProperties || name || plan;
|
|
71
71
|
attributes = __assign(__assign(__assign(__assign({}, (email && { email: [email] })), (name && { name: [name] })), (plan && { plan: [plan] })), customProperties);
|
|
@@ -73,7 +73,7 @@ export var updateEndpoint = function (_a) {
|
|
|
73
73
|
ApplicationId: appId,
|
|
74
74
|
EndpointId: endpointId !== null && endpointId !== void 0 ? endpointId : createdEndpointId,
|
|
75
75
|
EndpointRequest: {
|
|
76
|
-
RequestId:
|
|
76
|
+
RequestId: amplifyUuid(),
|
|
77
77
|
EffectiveDate: new Date().toISOString(),
|
|
78
78
|
ChannelType: channelType,
|
|
79
79
|
Address: address,
|
|
@@ -109,7 +109,7 @@ export var updateEndpoint = function (_a) {
|
|
|
109
109
|
_c.sent();
|
|
110
110
|
// if we had to create an endpoint id, we need to now cache it
|
|
111
111
|
if (!!createdEndpointId) {
|
|
112
|
-
cacheEndpointId(appId, category, createdEndpointId);
|
|
112
|
+
return [2 /*return*/, cacheEndpointId(appId, category, createdEndpointId)];
|
|
113
113
|
}
|
|
114
114
|
return [2 /*return*/];
|
|
115
115
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './apis';
|
|
2
|
-
export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
|
|
3
|
-
export {
|
|
2
|
+
export { PinpointAnalyticsEvent, PinpointServiceOptions, UpdateEndpointException, } from './types';
|
|
3
|
+
export { resolveEndpointId } from './utils';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export * from './apis';
|
|
4
|
-
export {
|
|
4
|
+
export { UpdateEndpointException, } from './types';
|
|
5
|
+
export { resolveEndpointId } from './utils';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum UpdateEndpointException {
|
|
2
|
+
BadRequestException = "BadRequestException",
|
|
3
|
+
ForbiddenException = "ForbiddenException",
|
|
4
|
+
InternalServerErrorException = "InternalServerErrorException",
|
|
5
|
+
MethodNotAllowedException = "MethodNotAllowedException",
|
|
6
|
+
NotFoundException = "NotFoundException",
|
|
7
|
+
PayloadTooLargeException = "PayloadTooLargeException",
|
|
8
|
+
TooManyRequestsException = "TooManyRequestsException"
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export var UpdateEndpointException;
|
|
4
|
+
(function (UpdateEndpointException) {
|
|
5
|
+
UpdateEndpointException["BadRequestException"] = "BadRequestException";
|
|
6
|
+
UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
|
|
7
|
+
UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
|
|
8
|
+
UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
|
|
9
|
+
UpdateEndpointException["NotFoundException"] = "NotFoundException";
|
|
10
|
+
UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
|
|
11
|
+
UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
|
|
12
|
+
})(UpdateEndpointException || (UpdateEndpointException = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthSession } from '../../../singleton/Auth/types';
|
|
2
2
|
import { UserProfile } from '../../../types';
|
|
3
|
-
export type SupportedCategory = 'Analytics' | 'InAppMessaging' | 'PushNotification';
|
|
4
|
-
|
|
3
|
+
export type SupportedCategory = 'Analytics' | 'Core' | 'InAppMessaging' | 'PushNotification';
|
|
4
|
+
type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
|
|
5
5
|
export type PinpointProviderConfig = {
|
|
6
6
|
Pinpoint?: {
|
|
7
7
|
appId: string;
|
|
@@ -25,13 +25,13 @@ export type PinpointAnalyticsEvent = {
|
|
|
25
25
|
type PinpointCommonParameters = {
|
|
26
26
|
appId: string;
|
|
27
27
|
category: SupportedCategory;
|
|
28
|
+
channelType?: SupportedChannelType;
|
|
28
29
|
credentials: Required<AuthSession>['credentials'];
|
|
29
30
|
identityId?: AuthSession['identityId'];
|
|
30
31
|
region: string;
|
|
31
32
|
userAgentValue?: string;
|
|
32
33
|
};
|
|
33
34
|
export type PinpointUpdateEndpointInput = PinpointCommonParameters & PinpointServiceOptions & {
|
|
34
|
-
channelType?: SupportedChannelType;
|
|
35
35
|
userId?: string;
|
|
36
36
|
userProfile?: UserProfile;
|
|
37
37
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PinpointUpdateEndpointInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
|
|
4
|
+
* which will generate and cache an endpoint id between calls.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveEndpointId: ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }: PinpointUpdateEndpointInput) => Promise<string>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
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;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
import { assert } from '../../../errors';
|
|
40
|
+
import { AmplifyErrorCode } from '../../../types';
|
|
41
|
+
import { updateEndpoint } from '../apis';
|
|
42
|
+
import { getEndpointId } from './getEndpointId';
|
|
43
|
+
/**
|
|
44
|
+
* Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
|
|
45
|
+
* which will generate and cache an endpoint id between calls.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export var resolveEndpointId = function (_a) {
|
|
50
|
+
var address = _a.address, appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
|
|
51
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var endpointId;
|
|
53
|
+
return __generator(this, function (_b) {
|
|
54
|
+
switch (_b.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, getEndpointId(appId, category)];
|
|
56
|
+
case 1:
|
|
57
|
+
endpointId = _b.sent();
|
|
58
|
+
if (!!endpointId) return [3 /*break*/, 4];
|
|
59
|
+
return [4 /*yield*/, updateEndpoint({
|
|
60
|
+
address: address,
|
|
61
|
+
appId: appId,
|
|
62
|
+
category: category,
|
|
63
|
+
channelType: channelType,
|
|
64
|
+
credentials: credentials,
|
|
65
|
+
identityId: identityId,
|
|
66
|
+
region: region,
|
|
67
|
+
userAgentValue: userAgentValue,
|
|
68
|
+
})];
|
|
69
|
+
case 2:
|
|
70
|
+
_b.sent();
|
|
71
|
+
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
72
|
+
case 3:
|
|
73
|
+
endpointId = _b.sent();
|
|
74
|
+
_b.label = 4;
|
|
75
|
+
case 4:
|
|
76
|
+
assert(!!endpointId, AmplifyErrorCode.NoEndpointId);
|
|
77
|
+
return [2 /*return*/, endpointId];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
@@ -23,9 +23,9 @@ export declare class AmplifyClass {
|
|
|
23
23
|
/**
|
|
24
24
|
* Provides access to the current back-end resource configuration for the Library.
|
|
25
25
|
*
|
|
26
|
-
* @returns Returns the
|
|
26
|
+
* @returns Returns the immutable back-end resource configuration.
|
|
27
27
|
*/
|
|
28
|
-
getConfig(): ResourcesConfig
|
|
28
|
+
getConfig(): Readonly<ResourcesConfig>;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* The `Amplify` utility is used to configure the library.
|
|
@@ -25,13 +25,12 @@ var __values = (this && this.__values) || function(o) {
|
|
|
25
25
|
import { AuthClass } from './Auth';
|
|
26
26
|
import { Hub, AMPLIFY_SYMBOL } from '../Hub';
|
|
27
27
|
import { parseAWSExports } from '../parseAWSExports';
|
|
28
|
-
|
|
28
|
+
import { deepFreeze } from '../utils';
|
|
29
29
|
var AmplifyClass = /** @class */ (function () {
|
|
30
30
|
function AmplifyClass() {
|
|
31
31
|
this.resourcesConfig = {};
|
|
32
|
-
this.Auth = new AuthClass();
|
|
33
|
-
// TODO(v6): add default providers for getting started
|
|
34
32
|
this.libraryOptions = {};
|
|
33
|
+
this.Auth = new AuthClass();
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
36
|
* Configures Amplify for use with your back-end resources.
|
|
@@ -53,6 +52,8 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
53
52
|
}
|
|
54
53
|
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
|
|
55
54
|
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
55
|
+
// Make resource config immutable
|
|
56
|
+
this.resourcesConfig = deepFreeze(this.resourcesConfig);
|
|
56
57
|
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
57
58
|
Hub.dispatch('core', {
|
|
58
59
|
event: 'configure',
|
|
@@ -62,10 +63,10 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
62
63
|
/**
|
|
63
64
|
* Provides access to the current back-end resource configuration for the Library.
|
|
64
65
|
*
|
|
65
|
-
* @returns Returns the
|
|
66
|
+
* @returns Returns the immutable back-end resource configuration.
|
|
66
67
|
*/
|
|
67
68
|
AmplifyClass.prototype.getConfig = function () {
|
|
68
|
-
return
|
|
69
|
+
return this.resourcesConfig;
|
|
69
70
|
};
|
|
70
71
|
return AmplifyClass;
|
|
71
72
|
}());
|