@aws-amplify/core 6.0.1-console-preview.5f040a2.0 → 6.0.1-console-preview.23dc225.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/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +497 -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/Hub/index.d.ts +7 -0
- package/lib/Hub/index.js +8 -1
- package/lib/Platform/customUserAgent.d.ts +16 -0
- package/lib/Platform/customUserAgent.js +70 -0
- package/lib/Platform/index.js +10 -1
- package/lib/Platform/types.d.ts +33 -1
- package/lib/Platform/types.js +1 -0
- 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 +36 -0
- 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/index.d.ts +2 -5
- package/lib/index.js +3 -6
- package/lib/libraryUtils.d.ts +7 -5
- package/lib/libraryUtils.js +11 -6
- package/lib/parseAWSExports.js +75 -14
- package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -2
- package/lib/providers/pinpoint/apis/record.js +3 -3
- package/lib/providers/pinpoint/apis/updateEndpoint.js +6 -6
- package/lib/singleton/API/types.d.ts +4 -3
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +6 -5
- package/lib/singleton/Auth/types.d.ts +28 -1
- package/lib/singleton/Cache/types.d.ts +18 -0
- package/lib/singleton/Cache/types.js +4 -0
- package/lib/singleton/types.d.ts +3 -1
- 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/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-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-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
- package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +496 -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/Hub/index.d.ts +7 -0
- package/lib-esm/Hub/index.js +7 -0
- package/lib-esm/Platform/customUserAgent.d.ts +16 -0
- package/lib-esm/Platform/customUserAgent.js +65 -0
- package/lib-esm/Platform/index.js +10 -1
- package/lib-esm/Platform/types.d.ts +33 -1
- package/lib-esm/Platform/types.js +1 -0
- 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 +36 -0
- 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/index.d.ts +2 -5
- package/lib-esm/index.js +1 -4
- package/lib-esm/libraryUtils.d.ts +7 -5
- package/lib-esm/libraryUtils.js +5 -3
- package/lib-esm/parseAWSExports.js +75 -14
- package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -2
- package/lib-esm/providers/pinpoint/apis/record.js +3 -3
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +6 -6
- package/lib-esm/singleton/API/types.d.ts +4 -3
- 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 +28 -1
- package/lib-esm/singleton/Cache/types.d.ts +18 -0
- package/lib-esm/singleton/Cache/types.js +3 -0
- package/lib-esm/singleton/types.d.ts +3 -1
- 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/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/package.json +7 -17
- package/src/Cache/StorageCache.native.ts +65 -0
- package/src/Cache/StorageCache.ts +61 -158
- package/src/Cache/StorageCacheCommon.ts +581 -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 +1 -1
- 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/Hub/index.ts +8 -0
- package/src/Platform/customUserAgent.ts +75 -0
- package/src/Platform/index.ts +14 -1
- package/src/Platform/types.ts +45 -1
- package/src/Platform/version.ts +1 -1
- package/src/Reachability/Reachability.ts +14 -0
- 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/index.ts +3 -4
- package/src/libraryUtils.ts +17 -10
- package/src/parseAWSExports.ts +76 -13
- package/src/providers/pinpoint/apis/flushEvents.ts +2 -2
- package/src/providers/pinpoint/apis/record.ts +3 -3
- package/src/providers/pinpoint/apis/updateEndpoint.ts +6 -6
- package/src/singleton/API/types.ts +4 -3
- package/src/singleton/Amplify.ts +10 -8
- package/src/singleton/Auth/types.ts +50 -1
- package/src/singleton/Cache/types.ts +27 -0
- package/src/singleton/types.ts +3 -1
- package/src/storage/DefaultStorage.ts +2 -2
- package/src/storage/utils.ts +1 -1
- 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/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/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/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
|
@@ -1,15 +1,17 @@
|
|
|
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 {
|
|
4
|
+
export { amplifyUuid } from './utils/amplifyUuid';
|
|
5
|
+
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
5
6
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
6
7
|
export { isTokenExpired } from './singleton/Auth';
|
|
7
|
-
export {
|
|
8
|
+
export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
|
|
8
9
|
export { Signer } from './Signer';
|
|
10
|
+
export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials } from './singleton/Auth/types';
|
|
9
11
|
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
10
|
-
export { ClientDevice } from './ClientDevice';
|
|
11
12
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
12
|
-
export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
|
|
13
|
+
export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
|
|
14
|
+
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
13
15
|
export { ServiceWorker } from './ServiceWorker';
|
|
14
16
|
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
15
17
|
export { Mutex } from './Mutex';
|
|
@@ -21,4 +23,4 @@ export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
|
|
21
23
|
export { AMPLIFY_SYMBOL } from './Hub';
|
|
22
24
|
export { base64Decoder, base64Encoder } from './utils/convert';
|
|
23
25
|
export { getCrypto } from './utils/globalHelpers';
|
|
24
|
-
export {
|
|
26
|
+
export { HubInternal } from './Hub';
|
package/lib-esm/libraryUtils.js
CHANGED
|
@@ -7,16 +7,18 @@ 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
16
|
// Logging utilities
|
|
15
17
|
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
16
|
-
// Platform &
|
|
17
|
-
export { ClientDevice } from './ClientDevice';
|
|
18
|
+
// Platform & user-agent utilities
|
|
18
19
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
19
20
|
export { ApiAction, AuthAction, AnalyticsAction, Category, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
|
|
21
|
+
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
20
22
|
// Service worker
|
|
21
23
|
export { ServiceWorker } from './ServiceWorker';
|
|
22
24
|
// Other utilities & constants
|
|
@@ -31,4 +33,4 @@ export { AMPLIFY_SYMBOL } from './Hub';
|
|
|
31
33
|
export { base64Decoder, base64Encoder } from './utils/convert';
|
|
32
34
|
export { getCrypto } from './utils/globalHelpers';
|
|
33
35
|
// Hub
|
|
34
|
-
export {
|
|
36
|
+
export { HubInternal } from './Hub';
|
|
@@ -9,6 +9,31 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
12
37
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
13
38
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
39
|
import { ConsoleLogger as Logger } from './Logger';
|
|
@@ -30,9 +55,9 @@ var authTypeMapping = {
|
|
|
30
55
|
* @returns A {@link ResourcesConfig} object.
|
|
31
56
|
*/
|
|
32
57
|
export var parseAWSExports = function (config) {
|
|
33
|
-
var _a;
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
34
59
|
if (config === void 0) { config = {}; }
|
|
35
|
-
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_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;
|
|
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;
|
|
36
61
|
var amplifyConfig = {};
|
|
37
62
|
// Analytics
|
|
38
63
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -46,7 +71,7 @@ export var parseAWSExports = function (config) {
|
|
|
46
71
|
// Notifications
|
|
47
72
|
if (Notifications) {
|
|
48
73
|
if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
|
|
49
|
-
var
|
|
74
|
+
var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
|
|
50
75
|
amplifyConfig.Notifications = {
|
|
51
76
|
InAppMessaging: {
|
|
52
77
|
Pinpoint: {
|
|
@@ -73,12 +98,50 @@ export var parseAWSExports = function (config) {
|
|
|
73
98
|
};
|
|
74
99
|
}
|
|
75
100
|
// Auth
|
|
101
|
+
var mfaConfig = aws_cognito_mfa_configuration
|
|
102
|
+
? {
|
|
103
|
+
status: aws_cognito_mfa_configuration &&
|
|
104
|
+
aws_cognito_mfa_configuration.toLowerCase(),
|
|
105
|
+
totpEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _b !== void 0 ? _b : false,
|
|
106
|
+
smsEnabled: (_c = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _c !== void 0 ? _c : false,
|
|
107
|
+
}
|
|
108
|
+
: undefined;
|
|
109
|
+
var passwordFormatConfig = aws_cognito_password_protection_settings
|
|
110
|
+
? {
|
|
111
|
+
minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
|
|
112
|
+
requireLowercase: (_e = (_d = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _d === void 0 ? void 0 : _d.includes('REQUIRES_LOWERCASE')) !== null && _e !== void 0 ? _e : false,
|
|
113
|
+
requireUppercase: (_g = (_f = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _f === void 0 ? void 0 : _f.includes('REQUIRES_UPPERCASE')) !== null && _g !== void 0 ? _g : false,
|
|
114
|
+
requireNumbers: (_j = (_h = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _h === void 0 ? void 0 : _h.includes('REQUIRES_NUMBERS')) !== null && _j !== void 0 ? _j : false,
|
|
115
|
+
requireSpecialCharacters: (_l = (_k = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _k === void 0 ? void 0 : _k.includes('REQUIRES_SYMBOLS')) !== null && _l !== void 0 ? _l : false,
|
|
116
|
+
}
|
|
117
|
+
: undefined;
|
|
118
|
+
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)));
|
|
119
|
+
var userAttributesConfig = mergedUserAttributes.map(function (s) {
|
|
120
|
+
var _a;
|
|
121
|
+
return (_a = {},
|
|
122
|
+
_a[s.toLowerCase()] = {
|
|
123
|
+
required: true, // All user attributes generated by the CLI will be required
|
|
124
|
+
},
|
|
125
|
+
_a);
|
|
126
|
+
});
|
|
127
|
+
var loginWithEmailEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _m !== void 0 ? _m : false;
|
|
128
|
+
var loginWithPhoneEnabled = (_o = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _o !== void 0 ? _o : false;
|
|
76
129
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
77
130
|
amplifyConfig.Auth = {
|
|
78
|
-
Cognito:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
131
|
+
Cognito: {
|
|
132
|
+
identityPoolId: aws_cognito_identity_pool_id,
|
|
133
|
+
allowGuestAccess: aws_mandatory_sign_in !== 'enable',
|
|
134
|
+
signUpVerificationMethod: aws_cognito_sign_up_verification_method,
|
|
135
|
+
userAttributes: userAttributesConfig,
|
|
136
|
+
userPoolClientId: aws_user_pools_web_client_id,
|
|
137
|
+
userPoolId: aws_user_pools_id,
|
|
138
|
+
mfa: mfaConfig,
|
|
139
|
+
passwordFormat: passwordFormatConfig,
|
|
140
|
+
loginWith: __assign({ username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true, email: loginWithEmailEnabled, phone: loginWithPhoneEnabled }, (oauth &&
|
|
141
|
+
Object.keys(oauth).length > 0 && {
|
|
142
|
+
oauth: getOAuthConfig(oauth),
|
|
143
|
+
})),
|
|
144
|
+
},
|
|
82
145
|
};
|
|
83
146
|
}
|
|
84
147
|
// Storage
|
|
@@ -116,12 +179,10 @@ var getRedirectUrl = function (redirectStr) {
|
|
|
116
179
|
var getOAuthConfig = function (_a) {
|
|
117
180
|
var domain = _a.domain, scope = _a.scope, redirectSignIn = _a.redirectSignIn, redirectSignOut = _a.redirectSignOut, responseType = _a.responseType;
|
|
118
181
|
return ({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
responseType: responseType,
|
|
125
|
-
},
|
|
182
|
+
domain: domain,
|
|
183
|
+
scopes: scope,
|
|
184
|
+
redirectSignIn: getRedirectUrl(redirectSignIn),
|
|
185
|
+
redirectSignOut: getRedirectUrl(redirectSignOut),
|
|
186
|
+
responseType: responseType,
|
|
126
187
|
});
|
|
127
188
|
};
|
|
@@ -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;
|
|
@@ -36,7 +36,7 @@ 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 {
|
|
39
|
+
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
40
40
|
import { getEndpointId } from '../utils';
|
|
41
41
|
import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';
|
|
42
42
|
import { updateEndpoint } from './updateEndpoint';
|
|
@@ -55,7 +55,7 @@ export var record = function (_a) {
|
|
|
55
55
|
switch (_b.label) {
|
|
56
56
|
case 0:
|
|
57
57
|
timestampISOString = new Date().toISOString();
|
|
58
|
-
eventId =
|
|
58
|
+
eventId = amplifyUuid();
|
|
59
59
|
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
60
60
|
case 1:
|
|
61
61
|
endpointId = _b.sent();
|
|
@@ -94,7 +94,7 @@ export var record = function (_a) {
|
|
|
94
94
|
}
|
|
95
95
|
// Generate session if required
|
|
96
96
|
if (!session) {
|
|
97
|
-
sessionId =
|
|
97
|
+
sessionId = amplifyUuid();
|
|
98
98
|
session = {
|
|
99
99
|
Id: sessionId,
|
|
100
100
|
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
|
}
|
|
@@ -3,8 +3,9 @@ export type LibraryAPIOptions = {
|
|
|
3
3
|
GraphQL?: {
|
|
4
4
|
headers?: (options: {
|
|
5
5
|
query: string;
|
|
6
|
-
variables
|
|
6
|
+
variables?: Record<string, DocumentType>;
|
|
7
7
|
}) => Promise<Headers>;
|
|
8
|
+
withCredentials?: boolean;
|
|
8
9
|
};
|
|
9
10
|
REST?: {
|
|
10
11
|
headers?: (options: {
|
|
@@ -37,7 +38,7 @@ type APIGraphQLConfig = {
|
|
|
37
38
|
/**
|
|
38
39
|
* Default auth mode for all the API calls to given service.
|
|
39
40
|
*/
|
|
40
|
-
defaultAuthMode:
|
|
41
|
+
defaultAuthMode: GraphQLAuthMode;
|
|
41
42
|
};
|
|
42
43
|
type APIRestConfig = {
|
|
43
44
|
/**
|
|
@@ -62,7 +63,7 @@ export type APIConfig = {
|
|
|
62
63
|
REST?: Record<string, APIRestConfig>;
|
|
63
64
|
GraphQL?: APIGraphQLConfig;
|
|
64
65
|
};
|
|
65
|
-
export type
|
|
66
|
+
export type GraphQLAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'lambda' | 'none';
|
|
66
67
|
/**
|
|
67
68
|
* Type representing a plain JavaScript object that can be serialized to JSON.
|
|
68
69
|
*/
|
|
@@ -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
|
}());
|
|
@@ -50,6 +50,11 @@ export type AuthTokens = {
|
|
|
50
50
|
idToken?: JWT;
|
|
51
51
|
accessToken: JWT;
|
|
52
52
|
};
|
|
53
|
+
export type AuthStandardAttributeKey = 'address' | 'birthdate' | 'email_verified' | 'family_name' | 'gender' | 'given_name' | 'locale' | 'middle_name' | 'name' | 'nickname' | 'phone_number_verified' | 'picture' | 'preferred_username' | 'profile' | 'sub' | 'updated_at' | 'website' | 'zoneinfo' | AuthVerifiableAttributeKey;
|
|
54
|
+
export type AuthVerifiableAttributeKey = 'email' | 'phone_number';
|
|
55
|
+
export type AuthConfigUserAttributes = Partial<Record<AuthStandardAttributeKey, {
|
|
56
|
+
required: boolean;
|
|
57
|
+
}>>;
|
|
53
58
|
export type AuthConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
|
|
54
59
|
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
55
60
|
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
@@ -59,6 +64,11 @@ export type AuthIdentityPoolConfig = {
|
|
|
59
64
|
userPoolClientId?: never;
|
|
60
65
|
userPoolId?: never;
|
|
61
66
|
loginWith?: never;
|
|
67
|
+
signUpVerificationMethod?: never;
|
|
68
|
+
userAttributes?: never;
|
|
69
|
+
mfa?: never;
|
|
70
|
+
passwordFormat?: never;
|
|
71
|
+
endpoint?: never;
|
|
62
72
|
};
|
|
63
73
|
};
|
|
64
74
|
export type CognitoIdentityPoolConfig = {
|
|
@@ -77,7 +87,24 @@ export type CognitoUserPoolConfig = {
|
|
|
77
87
|
signUpVerificationMethod?: 'code' | 'link';
|
|
78
88
|
loginWith?: {
|
|
79
89
|
oauth?: OAuthConfig;
|
|
90
|
+
username?: boolean;
|
|
91
|
+
email?: boolean;
|
|
92
|
+
phone?: boolean;
|
|
80
93
|
};
|
|
94
|
+
userAttributes?: AuthConfigUserAttributes;
|
|
95
|
+
mfa?: {
|
|
96
|
+
status?: 'on' | 'off' | 'optional';
|
|
97
|
+
totpEnabled?: boolean;
|
|
98
|
+
smsEnabled?: boolean;
|
|
99
|
+
};
|
|
100
|
+
passwordFormat?: {
|
|
101
|
+
minLength?: number;
|
|
102
|
+
requireLowercase?: boolean;
|
|
103
|
+
requireUppercase?: boolean;
|
|
104
|
+
requireNumbers?: boolean;
|
|
105
|
+
requireSpecialCharacters?: boolean;
|
|
106
|
+
};
|
|
107
|
+
endpoint?: string;
|
|
81
108
|
};
|
|
82
109
|
export type OAuthConfig = {
|
|
83
110
|
domain: string;
|
|
@@ -119,7 +146,7 @@ export type AWSCredentialsAndIdentityId = {
|
|
|
119
146
|
credentials: AWSCredentials;
|
|
120
147
|
identityId?: string;
|
|
121
148
|
};
|
|
122
|
-
type AWSCredentials = {
|
|
149
|
+
export type AWSCredentials = {
|
|
123
150
|
accessKeyId: string;
|
|
124
151
|
secretAccessKey: string;
|
|
125
152
|
sessionToken?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache instance options
|
|
3
|
+
*/
|
|
4
|
+
export interface CacheConfig {
|
|
5
|
+
/** Prepend to key to avoid conflicts */
|
|
6
|
+
keyPrefix: string;
|
|
7
|
+
/** Cache capacity, in bytes */
|
|
8
|
+
capacityInBytes: number;
|
|
9
|
+
/** Max size of one item */
|
|
10
|
+
itemMaxSize: number;
|
|
11
|
+
/** Time to live, in milliseconds */
|
|
12
|
+
defaultTTL: number;
|
|
13
|
+
/** Warn when over threshold percentage of capacity, maximum 1 */
|
|
14
|
+
warningThreshold: number;
|
|
15
|
+
/** default priority number put on cached items */
|
|
16
|
+
defaultPriority: number;
|
|
17
|
+
storage?: Storage;
|
|
18
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { APIConfig, LibraryAPIOptions } from './API/types';
|
|
2
2
|
import { AnalyticsConfig } from './Analytics/types';
|
|
3
3
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
4
|
+
import { CacheConfig } from './Cache/types';
|
|
4
5
|
import { GeoConfig } from './Geo/types';
|
|
5
6
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
6
7
|
import { I18nConfig } from '../I18n/types';
|
|
@@ -15,6 +16,7 @@ export type ResourcesConfig = {
|
|
|
15
16
|
API?: APIConfig;
|
|
16
17
|
Analytics?: AnalyticsConfig;
|
|
17
18
|
Auth?: AuthConfig;
|
|
19
|
+
Cache?: CacheConfig;
|
|
18
20
|
I18n?: I18nConfig;
|
|
19
21
|
Notifications?: NotificationsConfig;
|
|
20
22
|
Storage?: StorageConfig;
|
|
@@ -26,4 +28,4 @@ export type LibraryOptions = {
|
|
|
26
28
|
Storage?: LibraryStorageOptions;
|
|
27
29
|
ssr?: boolean;
|
|
28
30
|
};
|
|
29
|
-
export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
|
|
31
|
+
export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, CacheConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
|
|
@@ -16,14 +16,14 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
};
|
|
17
17
|
})();
|
|
18
18
|
import { KeyValueStorage } from './KeyValueStorage';
|
|
19
|
-
import {
|
|
19
|
+
import { getLocalStorageWithFallback } from './utils';
|
|
20
20
|
/**
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
23
23
|
var DefaultStorage = /** @class */ (function (_super) {
|
|
24
24
|
__extends(DefaultStorage, _super);
|
|
25
25
|
function DefaultStorage() {
|
|
26
|
-
return _super.call(this,
|
|
26
|
+
return _super.call(this, getLocalStorageWithFallback()) || this;
|
|
27
27
|
}
|
|
28
28
|
return DefaultStorage;
|
|
29
29
|
}(KeyValueStorage));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getLocalStorageWithFallback: () => Storage;
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
package/lib-esm/storage/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ import { InMemoryStorage } from './InMemoryStorage';
|
|
|
5
5
|
* @internal
|
|
6
6
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
7
7
|
*/
|
|
8
|
-
export var
|
|
8
|
+
export var getLocalStorageWithFallback = function () {
|
|
9
9
|
return typeof window !== 'undefined' && window.localStorage
|
|
10
10
|
? window.localStorage
|
|
11
11
|
: new InMemoryStorage();
|