@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
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
export { Hub } from './Hub';
|
|
2
2
|
export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
|
|
3
3
|
export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
|
|
4
|
-
export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
|
|
4
|
+
export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, CacheConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
|
|
5
5
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
6
6
|
export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
|
|
7
7
|
export { UserProfile } from './types';
|
|
8
8
|
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
9
9
|
export { KeyValueStorageInterface } from './types';
|
|
10
|
-
|
|
11
|
-
export { InMemoryCache } from './Cache/InMemoryCache';
|
|
12
|
-
export { BrowserStorageCache };
|
|
13
|
-
export { BrowserStorageCache as Cache };
|
|
10
|
+
export { Cache } from './Cache';
|
|
14
11
|
export { I18n } from './I18n';
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.I18n = exports.Cache = exports.
|
|
5
|
+
exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
|
|
6
6
|
/*
|
|
7
7
|
This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
|
|
8
8
|
*/
|
|
@@ -25,11 +25,8 @@ Object.defineProperty(exports, "defaultStorage", { enumerable: true, get: functi
|
|
|
25
25
|
Object.defineProperty(exports, "sessionStorage", { enumerable: true, get: function () { return storage_1.sessionStorage; } });
|
|
26
26
|
Object.defineProperty(exports, "sharedInMemoryStorage", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });
|
|
27
27
|
// Cache exports
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
|
|
31
|
-
var InMemoryCache_1 = require("./Cache/InMemoryCache");
|
|
32
|
-
Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: function () { return InMemoryCache_1.InMemoryCache; } });
|
|
28
|
+
var Cache_1 = require("./Cache");
|
|
29
|
+
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.Cache; } });
|
|
33
30
|
// Internationalization utilities
|
|
34
31
|
var I18n_1 = require("./I18n");
|
|
35
32
|
Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
|
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -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/libraryUtils.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
5
|
+
exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.ServiceWorker = exports.setCustomUserAgent = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.AmplifyUrlSearchParams = exports.AmplifyUrl = exports.amplifyUuid = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
|
|
6
|
+
exports.HubInternal = exports.getCrypto = exports.base64Encoder = exports.base64Decoder = exports.AMPLIFY_SYMBOL = void 0;
|
|
7
7
|
/*
|
|
8
8
|
This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
|
|
9
9
|
utils for use throughout the library.
|
|
@@ -22,6 +22,11 @@ Object.defineProperty(exports, "urlSafeDecode", { enumerable: true, get: functio
|
|
|
22
22
|
Object.defineProperty(exports, "urlSafeEncode", { enumerable: true, get: function () { return utils_1.urlSafeEncode; } });
|
|
23
23
|
var parseAWSExports_1 = require("./parseAWSExports");
|
|
24
24
|
Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
|
|
25
|
+
var amplifyUuid_1 = require("./utils/amplifyUuid");
|
|
26
|
+
Object.defineProperty(exports, "amplifyUuid", { enumerable: true, get: function () { return amplifyUuid_1.amplifyUuid; } });
|
|
27
|
+
var amplifyUrl_1 = require("./utils/amplifyUrl");
|
|
28
|
+
Object.defineProperty(exports, "AmplifyUrl", { enumerable: true, get: function () { return amplifyUrl_1.AmplifyUrl; } });
|
|
29
|
+
Object.defineProperty(exports, "AmplifyUrlSearchParams", { enumerable: true, get: function () { return amplifyUrl_1.AmplifyUrlSearchParams; } });
|
|
25
30
|
// Auth utilities
|
|
26
31
|
var utils_2 = require("./singleton/Auth/utils");
|
|
27
32
|
Object.defineProperty(exports, "decodeJWT", { enumerable: true, get: function () { return utils_2.decodeJWT; } });
|
|
@@ -36,9 +41,7 @@ Object.defineProperty(exports, "Signer", { enumerable: true, get: function () {
|
|
|
36
41
|
var Logger_1 = require("./Logger");
|
|
37
42
|
Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
|
|
38
43
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
|
|
39
|
-
// Platform &
|
|
40
|
-
var ClientDevice_1 = require("./ClientDevice");
|
|
41
|
-
Object.defineProperty(exports, "ClientDevice", { enumerable: true, get: function () { return ClientDevice_1.ClientDevice; } });
|
|
44
|
+
// Platform & user-agent utilities
|
|
42
45
|
var Platform_1 = require("./Platform");
|
|
43
46
|
Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return Platform_1.Platform; } });
|
|
44
47
|
Object.defineProperty(exports, "getAmplifyUserAgentObject", { enumerable: true, get: function () { return Platform_1.getAmplifyUserAgentObject; } });
|
|
@@ -57,6 +60,8 @@ Object.defineProperty(exports, "PredictionsAction", { enumerable: true, get: fun
|
|
|
57
60
|
Object.defineProperty(exports, "PubSubAction", { enumerable: true, get: function () { return types_1.PubSubAction; } });
|
|
58
61
|
Object.defineProperty(exports, "PushNotificationAction", { enumerable: true, get: function () { return types_1.PushNotificationAction; } });
|
|
59
62
|
Object.defineProperty(exports, "StorageAction", { enumerable: true, get: function () { return types_1.StorageAction; } });
|
|
63
|
+
var customUserAgent_1 = require("./Platform/customUserAgent");
|
|
64
|
+
Object.defineProperty(exports, "setCustomUserAgent", { enumerable: true, get: function () { return customUserAgent_1.setCustomUserAgent; } });
|
|
60
65
|
// Service worker
|
|
61
66
|
var ServiceWorker_1 = require("./ServiceWorker");
|
|
62
67
|
Object.defineProperty(exports, "ServiceWorker", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });
|
|
@@ -87,4 +92,4 @@ var globalHelpers_1 = require("./utils/globalHelpers");
|
|
|
87
92
|
Object.defineProperty(exports, "getCrypto", { enumerable: true, get: function () { return globalHelpers_1.getCrypto; } });
|
|
88
93
|
// Hub
|
|
89
94
|
var Hub_2 = require("./Hub");
|
|
90
|
-
Object.defineProperty(exports, "
|
|
95
|
+
Object.defineProperty(exports, "HubInternal", { enumerable: true, get: function () { return Hub_2.HubInternal; } });
|
package/lib/parseAWSExports.js
CHANGED
|
@@ -10,6 +10,31 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
13
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
39
|
exports.parseAWSExports = void 0;
|
|
15
40
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -33,9 +58,9 @@ var authTypeMapping = {
|
|
|
33
58
|
* @returns A {@link ResourcesConfig} object.
|
|
34
59
|
*/
|
|
35
60
|
var parseAWSExports = function (config) {
|
|
36
|
-
var _a;
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
37
62
|
if (config === void 0) { config = {}; }
|
|
38
|
-
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;
|
|
63
|
+
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;
|
|
39
64
|
var amplifyConfig = {};
|
|
40
65
|
// Analytics
|
|
41
66
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -49,7 +74,7 @@ var parseAWSExports = function (config) {
|
|
|
49
74
|
// Notifications
|
|
50
75
|
if (Notifications) {
|
|
51
76
|
if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
|
|
52
|
-
var
|
|
77
|
+
var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
|
|
53
78
|
amplifyConfig.Notifications = {
|
|
54
79
|
InAppMessaging: {
|
|
55
80
|
Pinpoint: {
|
|
@@ -76,12 +101,50 @@ var parseAWSExports = function (config) {
|
|
|
76
101
|
};
|
|
77
102
|
}
|
|
78
103
|
// Auth
|
|
104
|
+
var mfaConfig = aws_cognito_mfa_configuration
|
|
105
|
+
? {
|
|
106
|
+
status: aws_cognito_mfa_configuration &&
|
|
107
|
+
aws_cognito_mfa_configuration.toLowerCase(),
|
|
108
|
+
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,
|
|
109
|
+
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,
|
|
110
|
+
}
|
|
111
|
+
: undefined;
|
|
112
|
+
var passwordFormatConfig = aws_cognito_password_protection_settings
|
|
113
|
+
? {
|
|
114
|
+
minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
|
|
115
|
+
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,
|
|
116
|
+
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,
|
|
117
|
+
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,
|
|
118
|
+
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,
|
|
119
|
+
}
|
|
120
|
+
: undefined;
|
|
121
|
+
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)));
|
|
122
|
+
var userAttributesConfig = mergedUserAttributes.map(function (s) {
|
|
123
|
+
var _a;
|
|
124
|
+
return (_a = {},
|
|
125
|
+
_a[s.toLowerCase()] = {
|
|
126
|
+
required: true, // All user attributes generated by the CLI will be required
|
|
127
|
+
},
|
|
128
|
+
_a);
|
|
129
|
+
});
|
|
130
|
+
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;
|
|
131
|
+
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;
|
|
79
132
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
80
133
|
amplifyConfig.Auth = {
|
|
81
|
-
Cognito:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
134
|
+
Cognito: {
|
|
135
|
+
identityPoolId: aws_cognito_identity_pool_id,
|
|
136
|
+
allowGuestAccess: aws_mandatory_sign_in !== 'enable',
|
|
137
|
+
signUpVerificationMethod: aws_cognito_sign_up_verification_method,
|
|
138
|
+
userAttributes: userAttributesConfig,
|
|
139
|
+
userPoolClientId: aws_user_pools_web_client_id,
|
|
140
|
+
userPoolId: aws_user_pools_id,
|
|
141
|
+
mfa: mfaConfig,
|
|
142
|
+
passwordFormat: passwordFormatConfig,
|
|
143
|
+
loginWith: __assign({ username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true, email: loginWithEmailEnabled, phone: loginWithPhoneEnabled }, (oauth &&
|
|
144
|
+
Object.keys(oauth).length > 0 && {
|
|
145
|
+
oauth: getOAuthConfig(oauth),
|
|
146
|
+
})),
|
|
147
|
+
},
|
|
85
148
|
};
|
|
86
149
|
}
|
|
87
150
|
// Storage
|
|
@@ -120,12 +183,10 @@ var getRedirectUrl = function (redirectStr) {
|
|
|
120
183
|
var getOAuthConfig = function (_a) {
|
|
121
184
|
var domain = _a.domain, scope = _a.scope, redirectSignIn = _a.redirectSignIn, redirectSignOut = _a.redirectSignOut, responseType = _a.responseType;
|
|
122
185
|
return ({
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
responseType: responseType,
|
|
129
|
-
},
|
|
186
|
+
domain: domain,
|
|
187
|
+
scopes: scope,
|
|
188
|
+
redirectSignIn: getRedirectUrl(redirectSignIn),
|
|
189
|
+
redirectSignOut: getRedirectUrl(redirectSignOut),
|
|
190
|
+
responseType: responseType,
|
|
130
191
|
});
|
|
131
192
|
};
|
|
@@ -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;
|
|
@@ -39,7 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.record = void 0;
|
|
42
|
-
var
|
|
42
|
+
var amplifyUuid_1 = require("../../../utils/amplifyUuid");
|
|
43
43
|
var utils_1 = require("../utils");
|
|
44
44
|
var constants_1 = require("../utils/constants");
|
|
45
45
|
var updateEndpoint_1 = require("./updateEndpoint");
|
|
@@ -58,7 +58,7 @@ var record = function (_a) {
|
|
|
58
58
|
switch (_b.label) {
|
|
59
59
|
case 0:
|
|
60
60
|
timestampISOString = new Date().toISOString();
|
|
61
|
-
eventId = (0,
|
|
61
|
+
eventId = (0, amplifyUuid_1.amplifyUuid)();
|
|
62
62
|
return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
|
|
63
63
|
case 1:
|
|
64
64
|
endpointId = _b.sent();
|
|
@@ -97,7 +97,7 @@ var record = function (_a) {
|
|
|
97
97
|
}
|
|
98
98
|
// Generate session if required
|
|
99
99
|
if (!session) {
|
|
100
|
-
sessionId = (0,
|
|
100
|
+
sessionId = (0, amplifyUuid_1.amplifyUuid)();
|
|
101
101
|
session = {
|
|
102
102
|
Id: sessionId,
|
|
103
103
|
StartTimestamp: timestampISOString,
|
|
@@ -50,8 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
};
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.updateEndpoint = void 0;
|
|
53
|
-
var
|
|
54
|
-
var
|
|
53
|
+
var amplifyUuid_1 = require("../../../utils/amplifyUuid");
|
|
54
|
+
var getClientInfo_1 = require("../../../utils/getClientInfo");
|
|
55
55
|
var pinpoint_1 = require("../../../awsClients/pinpoint");
|
|
56
56
|
var utils_1 = require("../utils");
|
|
57
57
|
/**
|
|
@@ -66,9 +66,9 @@ var updateEndpoint = function (_a) {
|
|
|
66
66
|
case 0: return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
|
|
67
67
|
case 1:
|
|
68
68
|
endpointId = _c.sent();
|
|
69
|
-
createdEndpointId = !endpointId ? (0,
|
|
69
|
+
createdEndpointId = !endpointId ? (0, amplifyUuid_1.amplifyUuid)() : undefined;
|
|
70
70
|
_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;
|
|
71
|
-
clientInfo =
|
|
71
|
+
clientInfo = (0, getClientInfo_1.getClientInfo)();
|
|
72
72
|
mergedDemographic = __assign({ appVersion: clientInfo.appVersion, make: clientInfo.make, model: clientInfo.model, modelVersion: clientInfo.version, platform: clientInfo.platform }, demographic);
|
|
73
73
|
shouldAddAttributes = email || customProperties || name || plan;
|
|
74
74
|
attributes = __assign(__assign(__assign(__assign({}, (email && { email: [email] })), (name && { name: [name] })), (plan && { plan: [plan] })), customProperties);
|
|
@@ -76,7 +76,7 @@ var updateEndpoint = function (_a) {
|
|
|
76
76
|
ApplicationId: appId,
|
|
77
77
|
EndpointId: endpointId !== null && endpointId !== void 0 ? endpointId : createdEndpointId,
|
|
78
78
|
EndpointRequest: {
|
|
79
|
-
RequestId: (0,
|
|
79
|
+
RequestId: (0, amplifyUuid_1.amplifyUuid)(),
|
|
80
80
|
EffectiveDate: new Date().toISOString(),
|
|
81
81
|
ChannelType: channelType,
|
|
82
82
|
Address: address,
|
|
@@ -112,7 +112,7 @@ var updateEndpoint = function (_a) {
|
|
|
112
112
|
_c.sent();
|
|
113
113
|
// if we had to create an endpoint id, we need to now cache it
|
|
114
114
|
if (!!createdEndpointId) {
|
|
115
|
-
(0, utils_1.cacheEndpointId)(appId, category, createdEndpointId);
|
|
115
|
+
return [2 /*return*/, (0, utils_1.cacheEndpointId)(appId, category, createdEndpointId)];
|
|
116
116
|
}
|
|
117
117
|
return [2 /*return*/];
|
|
118
118
|
}
|
|
@@ -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.
|
package/lib/singleton/Amplify.js
CHANGED
|
@@ -28,13 +28,12 @@ exports.Amplify = exports.AmplifyClass = void 0;
|
|
|
28
28
|
var Auth_1 = require("./Auth");
|
|
29
29
|
var Hub_1 = require("../Hub");
|
|
30
30
|
var parseAWSExports_1 = require("../parseAWSExports");
|
|
31
|
-
|
|
31
|
+
var utils_1 = require("../utils");
|
|
32
32
|
var AmplifyClass = /** @class */ (function () {
|
|
33
33
|
function AmplifyClass() {
|
|
34
34
|
this.resourcesConfig = {};
|
|
35
|
-
this.Auth = new Auth_1.AuthClass();
|
|
36
|
-
// TODO(v6): add default providers for getting started
|
|
37
35
|
this.libraryOptions = {};
|
|
36
|
+
this.Auth = new Auth_1.AuthClass();
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Configures Amplify for use with your back-end resources.
|
|
@@ -56,6 +55,8 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
56
55
|
}
|
|
57
56
|
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
|
|
58
57
|
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
58
|
+
// Make resource config immutable
|
|
59
|
+
this.resourcesConfig = (0, utils_1.deepFreeze)(this.resourcesConfig);
|
|
59
60
|
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
60
61
|
Hub_1.Hub.dispatch('core', {
|
|
61
62
|
event: 'configure',
|
|
@@ -65,10 +66,10 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
65
66
|
/**
|
|
66
67
|
* Provides access to the current back-end resource configuration for the Library.
|
|
67
68
|
*
|
|
68
|
-
* @returns Returns the
|
|
69
|
+
* @returns Returns the immutable back-end resource configuration.
|
|
69
70
|
*/
|
|
70
71
|
AmplifyClass.prototype.getConfig = function () {
|
|
71
|
-
return
|
|
72
|
+
return this.resourcesConfig;
|
|
72
73
|
};
|
|
73
74
|
return AmplifyClass;
|
|
74
75
|
}());
|
|
@@ -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
|
+
}
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -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, };
|
|
@@ -26,7 +26,7 @@ var utils_1 = require("./utils");
|
|
|
26
26
|
var DefaultStorage = /** @class */ (function (_super) {
|
|
27
27
|
__extends(DefaultStorage, _super);
|
|
28
28
|
function DefaultStorage() {
|
|
29
|
-
return _super.call(this, (0, utils_1.
|
|
29
|
+
return _super.call(this, (0, utils_1.getLocalStorageWithFallback)()) || this;
|
|
30
30
|
}
|
|
31
31
|
return DefaultStorage;
|
|
32
32
|
}(KeyValueStorage_1.KeyValueStorage));
|
package/lib/storage/utils.d.ts
CHANGED
|
@@ -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/storage/utils.js
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getSessionStorageWithFallback = exports.
|
|
5
|
+
exports.getSessionStorageWithFallback = exports.getLocalStorageWithFallback = void 0;
|
|
6
6
|
var InMemoryStorage_1 = require("./InMemoryStorage");
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
10
10
|
*/
|
|
11
|
-
var
|
|
11
|
+
var getLocalStorageWithFallback = function () {
|
|
12
12
|
return typeof window !== 'undefined' && window.localStorage
|
|
13
13
|
? window.localStorage
|
|
14
14
|
: new InMemoryStorage_1.InMemoryStorage();
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
16
|
+
exports.getLocalStorageWithFallback = getLocalStorageWithFallback;
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|