@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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Default cache config
|
|
5
|
+
*/
|
|
6
|
+
export var defaultConfig = {
|
|
7
|
+
keyPrefix: 'aws-amplify-cache',
|
|
8
|
+
capacityInBytes: 1048576,
|
|
9
|
+
itemMaxSize: 210000,
|
|
10
|
+
defaultTTL: 259200000,
|
|
11
|
+
defaultPriority: 5,
|
|
12
|
+
warningThreshold: 0.8,
|
|
13
|
+
};
|
|
14
|
+
export var currentSizeKey = 'CurSize';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CacheConfig } from '../../singleton/Cache/types';
|
|
2
|
+
export { CacheConfig };
|
|
3
|
+
/**
|
|
4
|
+
* Cache Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface Cache {
|
|
7
|
+
/** Put item into cache */
|
|
8
|
+
setItem(key: string, value: any, options?: CacheItemOptions): Promise<void>;
|
|
9
|
+
/** Get item from cache */
|
|
10
|
+
getItem(key: string, options?: CacheItemOptions): Promise<CacheItem['data']>;
|
|
11
|
+
/** Remove item from cache */
|
|
12
|
+
removeItem(key: string): Promise<void>;
|
|
13
|
+
/** Remove all items from cache */
|
|
14
|
+
clear(): Promise<void>;
|
|
15
|
+
/** Get all keys form cache */
|
|
16
|
+
getAllKeys(): Promise<string[]>;
|
|
17
|
+
/** Get current size of the cache */
|
|
18
|
+
getCurrentCacheSize(): Promise<number>;
|
|
19
|
+
/** create a new instance with customized config */
|
|
20
|
+
createInstance(config: CacheConfig): Cache;
|
|
21
|
+
/** change current configuration */
|
|
22
|
+
configure(config: CacheConfig): CacheConfig;
|
|
23
|
+
}
|
|
24
|
+
export interface CacheItem {
|
|
25
|
+
key: string;
|
|
26
|
+
data: any;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
visitedTime: number;
|
|
29
|
+
priority: number;
|
|
30
|
+
expires: number;
|
|
31
|
+
type: string;
|
|
32
|
+
byteSize: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CacheItemOptions {
|
|
35
|
+
priority?: number;
|
|
36
|
+
expires?: number;
|
|
37
|
+
callback?: Function;
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cache';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* return the byte size of the string
|
|
3
|
+
* @param str
|
|
4
|
+
*/
|
|
5
|
+
export declare function getByteLength(str: string): number;
|
|
6
|
+
/**
|
|
7
|
+
* get current time
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCurrentTime(): number;
|
|
10
|
+
/**
|
|
11
|
+
* check if passed value is an integer
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInteger(value?: number): boolean;
|
|
14
|
+
export declare const getCurrentSizeKey: (keyPrefix: string) => string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { currentSizeKey } from '../constants';
|
|
4
|
+
/**
|
|
5
|
+
* return the byte size of the string
|
|
6
|
+
* @param str
|
|
7
|
+
*/
|
|
8
|
+
export function getByteLength(str) {
|
|
9
|
+
var ret = 0;
|
|
10
|
+
ret = str.length;
|
|
11
|
+
for (var i = str.length; i >= 0; i -= 1) {
|
|
12
|
+
var charCode = str.charCodeAt(i);
|
|
13
|
+
if (charCode > 0x7f && charCode <= 0x7ff) {
|
|
14
|
+
ret += 1;
|
|
15
|
+
}
|
|
16
|
+
else if (charCode > 0x7ff && charCode <= 0xffff) {
|
|
17
|
+
ret += 2;
|
|
18
|
+
}
|
|
19
|
+
// trail surrogate
|
|
20
|
+
if (charCode >= 0xdc00 && charCode <= 0xdfff) {
|
|
21
|
+
i -= 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return ret;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* get current time
|
|
28
|
+
*/
|
|
29
|
+
export function getCurrentTime() {
|
|
30
|
+
var currentTime = new Date();
|
|
31
|
+
return currentTime.getTime();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* check if passed value is an integer
|
|
35
|
+
*/
|
|
36
|
+
export function isInteger(value) {
|
|
37
|
+
if (Number.isInteger) {
|
|
38
|
+
return Number.isInteger(value);
|
|
39
|
+
}
|
|
40
|
+
return (typeof value === 'number' && isFinite(value) && Math.floor(value) === value);
|
|
41
|
+
}
|
|
42
|
+
export var getCurrentSizeKey = function (keyPrefix) {
|
|
43
|
+
return "".concat(keyPrefix).concat(currentSizeKey);
|
|
44
|
+
};
|
|
@@ -5,7 +5,6 @@ import { createAssertionFunction } from '../../errors';
|
|
|
5
5
|
export var CacheErrorCode;
|
|
6
6
|
(function (CacheErrorCode) {
|
|
7
7
|
CacheErrorCode["NoCacheItem"] = "NoCacheItem";
|
|
8
|
-
CacheErrorCode["NoCacheStorage"] = "NoCacheStorage";
|
|
9
8
|
CacheErrorCode["NullNextNode"] = "NullNextNode";
|
|
10
9
|
CacheErrorCode["NullPreviousNode"] = "NullPreviousNode";
|
|
11
10
|
})(CacheErrorCode || (CacheErrorCode = {}));
|
|
@@ -13,9 +12,6 @@ var cacheErrorMap = (_a = {},
|
|
|
13
12
|
_a[CacheErrorCode.NoCacheItem] = {
|
|
14
13
|
message: 'Item not found in the cache storage.',
|
|
15
14
|
},
|
|
16
|
-
_a[CacheErrorCode.NoCacheStorage] = {
|
|
17
|
-
message: 'Storage is not defined in the cache config.',
|
|
18
|
-
},
|
|
19
15
|
_a[CacheErrorCode.NullNextNode] = {
|
|
20
16
|
message: 'Next node is null.',
|
|
21
17
|
},
|
package/lib-esm/Hub/index.d.ts
CHANGED
|
@@ -37,3 +37,10 @@ export declare class HubClass {
|
|
|
37
37
|
private _toListeners;
|
|
38
38
|
}
|
|
39
39
|
export declare const Hub: HubClass;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*
|
|
43
|
+
* Internal hub used for core Amplify functionality. Not intended for use outside of Amplify.
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export declare const HubInternal: HubClass;
|
package/lib-esm/Hub/index.js
CHANGED
|
@@ -146,3 +146,10 @@ export { HubClass };
|
|
|
146
146
|
pseudo Singleton for the main messaging bus, however you can still create
|
|
147
147
|
your own instance of HubClass() for a separate "private bus" of events.*/
|
|
148
148
|
export var Hub = new HubClass('__default__');
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
*
|
|
152
|
+
* Internal hub used for core Amplify functionality. Not intended for use outside of Amplify.
|
|
153
|
+
*
|
|
154
|
+
*/
|
|
155
|
+
export var HubInternal = new HubClass('internal-hub');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdditionalDetails, SetCustomUserAgentInput } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
|
|
4
|
+
* clean up any custom state set with this API.
|
|
5
|
+
*
|
|
6
|
+
* @note
|
|
7
|
+
* This API operates globally. Calling this API multiple times will result in the most recently set values for a
|
|
8
|
+
* particular API being used.
|
|
9
|
+
*
|
|
10
|
+
* @note
|
|
11
|
+
* This utility IS NOT compatible with SSR.
|
|
12
|
+
*
|
|
13
|
+
* @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setCustomUserAgent: (input: SetCustomUserAgentInput) => (() => void);
|
|
16
|
+
export declare const getCustomUserAgent: (category: string, api: string) => AdditionalDetails | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
// Maintains custom user-agent state set by external consumers.
|
|
15
|
+
var customUserAgentState = {};
|
|
16
|
+
/**
|
|
17
|
+
* Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
|
|
18
|
+
* clean up any custom state set with this API.
|
|
19
|
+
*
|
|
20
|
+
* @note
|
|
21
|
+
* This API operates globally. Calling this API multiple times will result in the most recently set values for a
|
|
22
|
+
* particular API being used.
|
|
23
|
+
*
|
|
24
|
+
* @note
|
|
25
|
+
* This utility IS NOT compatible with SSR.
|
|
26
|
+
*
|
|
27
|
+
* @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
|
|
28
|
+
*/
|
|
29
|
+
export var setCustomUserAgent = function (input) {
|
|
30
|
+
var _a;
|
|
31
|
+
// Save custom user-agent state & increment reference counter
|
|
32
|
+
// TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373
|
|
33
|
+
customUserAgentState[input.category] = input.apis.reduce(function (acc, api) {
|
|
34
|
+
var _a;
|
|
35
|
+
var _b;
|
|
36
|
+
return (__assign(__assign({}, acc), (_a = {}, _a[api] = {
|
|
37
|
+
refCount: ((_b = acc[api]) === null || _b === void 0 ? void 0 : _b.refCount) ? acc[api].refCount + 1 : 1,
|
|
38
|
+
additionalDetails: input.additionalDetails,
|
|
39
|
+
}, _a)));
|
|
40
|
+
}, (_a = customUserAgentState[input.category]) !== null && _a !== void 0 ? _a : {});
|
|
41
|
+
// Callback that cleans up state for APIs recorded by this call
|
|
42
|
+
var cleanUpCallbackCalled = false;
|
|
43
|
+
var cleanUpCallback = function () {
|
|
44
|
+
// Only allow the cleanup callback to be called once
|
|
45
|
+
if (cleanUpCallbackCalled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
cleanUpCallbackCalled = true;
|
|
49
|
+
input.apis.forEach(function (api) {
|
|
50
|
+
var apiRefCount = customUserAgentState[input.category][api].refCount;
|
|
51
|
+
if (apiRefCount > 1) {
|
|
52
|
+
customUserAgentState[input.category][api].refCount = apiRefCount - 1;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
delete customUserAgentState[input.category][api];
|
|
56
|
+
// Clean up category if no more APIs set
|
|
57
|
+
if (!Object.keys(customUserAgentState[input.category]).length) {
|
|
58
|
+
delete customUserAgentState[input.category];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
return cleanUpCallback;
|
|
64
|
+
};
|
|
65
|
+
export var getCustomUserAgent = function (category, api) { var _a, _b; return (_b = (_a = customUserAgentState[category]) === null || _a === void 0 ? void 0 : _a[api]) === null || _b === void 0 ? void 0 : _b.additionalDetails; };
|
|
@@ -19,6 +19,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
19
19
|
import { Framework } from './types';
|
|
20
20
|
import { version } from './version';
|
|
21
21
|
import { detectFramework, observeFrameworkChanges } from './detectFramework';
|
|
22
|
+
import { getCustomUserAgent } from './customUserAgent';
|
|
22
23
|
var BASE_USER_AGENT = "aws-amplify";
|
|
23
24
|
var PlatformBuilder = /** @class */ (function () {
|
|
24
25
|
function PlatformBuilder() {
|
|
@@ -52,6 +53,14 @@ export var getAmplifyUserAgentObject = function (_a) {
|
|
|
52
53
|
userAgent.push([category, action]);
|
|
53
54
|
}
|
|
54
55
|
userAgent.push(['framework', detectFramework()]);
|
|
56
|
+
if (category && action) {
|
|
57
|
+
var customState = getCustomUserAgent(category, action);
|
|
58
|
+
if (customState) {
|
|
59
|
+
customState.forEach(function (state) {
|
|
60
|
+
userAgent.push(state);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
55
64
|
return userAgent;
|
|
56
65
|
};
|
|
57
66
|
export var getAmplifyUserAgent = function (customUserAgentDetails) {
|
|
@@ -59,7 +68,7 @@ export var getAmplifyUserAgent = function (customUserAgentDetails) {
|
|
|
59
68
|
var userAgentString = userAgent
|
|
60
69
|
.map(function (_a) {
|
|
61
70
|
var _b = __read(_a, 2), agentKey = _b[0], agentValue = _b[1];
|
|
62
|
-
return "".concat(agentKey, "/").concat(agentValue);
|
|
71
|
+
return agentKey && agentValue ? "".concat(agentKey, "/").concat(agentValue) : agentKey;
|
|
63
72
|
})
|
|
64
73
|
.join(' ');
|
|
65
74
|
return userAgentString;
|
|
@@ -77,7 +77,8 @@ export declare enum GeoAction {
|
|
|
77
77
|
}
|
|
78
78
|
export declare enum InAppMessagingAction {
|
|
79
79
|
SyncMessages = "1",
|
|
80
|
-
IdentifyUser = "2"
|
|
80
|
+
IdentifyUser = "2",
|
|
81
|
+
DispatchEvent = "3"
|
|
81
82
|
}
|
|
82
83
|
export declare enum InteractionsAction {
|
|
83
84
|
None = "0"
|
|
@@ -126,4 +127,35 @@ export type CustomUserAgentDetails = (CustomUserAgentDetailsBase & {
|
|
|
126
127
|
category?: never;
|
|
127
128
|
action?: never;
|
|
128
129
|
}) | UserAgentDetailsWithCategory<Category.API> | UserAgentDetailsWithCategory<Category.Auth> | UserAgentDetailsWithCategory<Category.Analytics> | UserAgentDetailsWithCategory<Category.DataStore> | UserAgentDetailsWithCategory<Category.Geo> | UserAgentDetailsWithCategory<Category.Interactions> | UserAgentDetailsWithCategory<Category.InAppMessaging> | UserAgentDetailsWithCategory<Category.Predictions> | UserAgentDetailsWithCategory<Category.PubSub> | UserAgentDetailsWithCategory<Category.PushNotification> | UserAgentDetailsWithCategory<Category.Storage>;
|
|
130
|
+
/**
|
|
131
|
+
* `refCount` tracks how many consumers have set state for a particular API to avoid it being cleared before all
|
|
132
|
+
* consumers are done using it.
|
|
133
|
+
*
|
|
134
|
+
* Category -> Action -> Custom State
|
|
135
|
+
*/
|
|
136
|
+
export type CategoryUserAgentStateMap = Record<string, {
|
|
137
|
+
refCount: number;
|
|
138
|
+
additionalDetails: AdditionalDetails;
|
|
139
|
+
}>;
|
|
140
|
+
export type CustomUserAgentStateMap = Record<string, CategoryUserAgentStateMap>;
|
|
141
|
+
export type AdditionalDetails = [string, string?][];
|
|
142
|
+
type StorageUserAgentInput = {
|
|
143
|
+
category: Category.Storage;
|
|
144
|
+
apis: StorageAction[];
|
|
145
|
+
};
|
|
146
|
+
type AuthUserAgentInput = {
|
|
147
|
+
category: Category.Auth;
|
|
148
|
+
apis: AuthAction[];
|
|
149
|
+
};
|
|
150
|
+
type InAppMessagingUserAgentInput = {
|
|
151
|
+
category: Category.InAppMessaging;
|
|
152
|
+
apis: InAppMessagingAction[];
|
|
153
|
+
};
|
|
154
|
+
type GeoUserAgentInput = {
|
|
155
|
+
category: Category.Geo;
|
|
156
|
+
apis: GeoAction[];
|
|
157
|
+
};
|
|
158
|
+
export type SetCustomUserAgentInput = (StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput) & {
|
|
159
|
+
additionalDetails: AdditionalDetails;
|
|
160
|
+
};
|
|
129
161
|
export {};
|
|
@@ -91,6 +91,7 @@ export var InAppMessagingAction;
|
|
|
91
91
|
(function (InAppMessagingAction) {
|
|
92
92
|
InAppMessagingAction["SyncMessages"] = "1";
|
|
93
93
|
InAppMessagingAction["IdentifyUser"] = "2";
|
|
94
|
+
InAppMessagingAction["DispatchEvent"] = "3";
|
|
94
95
|
})(InAppMessagingAction || (InAppMessagingAction = {}));
|
|
95
96
|
export var InteractionsAction;
|
|
96
97
|
(function (InteractionsAction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.23dc225.0+23dc225";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export var version = '6.0.1-console-preview.
|
|
2
|
+
export var version = '6.0.1-console-preview.23dc225.0+23dc225';
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __values = (this && this.__values) || function(o) {
|
|
4
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
5
|
+
if (m) return m.call(o);
|
|
6
|
+
if (o && typeof o.length === "number") return {
|
|
7
|
+
next: function () {
|
|
8
|
+
if (o && i >= o.length) o = void 0;
|
|
9
|
+
return { value: o && o[i++], done: !o };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
13
|
+
};
|
|
3
14
|
import { Observable } from 'rxjs';
|
|
4
15
|
import { isWebWorker } from '../libraryUtils';
|
|
5
16
|
export var Reachability = /** @class */ (function () {
|
|
@@ -21,6 +32,31 @@ export var Reachability = /** @class */ (function () {
|
|
|
21
32
|
};
|
|
22
33
|
});
|
|
23
34
|
};
|
|
35
|
+
// expose observers to simulate offline mode for integration testing
|
|
36
|
+
Reachability._observerOverride = function (status) {
|
|
37
|
+
var e_1, _a;
|
|
38
|
+
var _loop_1 = function (observer) {
|
|
39
|
+
if (observer.closed) {
|
|
40
|
+
this_1._observers = this_1._observers.filter(function (_observer) { return _observer !== observer; });
|
|
41
|
+
return "continue";
|
|
42
|
+
}
|
|
43
|
+
(observer === null || observer === void 0 ? void 0 : observer.next) && observer.next(status);
|
|
44
|
+
};
|
|
45
|
+
var this_1 = this;
|
|
46
|
+
try {
|
|
47
|
+
for (var _b = __values(this._observers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
48
|
+
var observer = _c.value;
|
|
49
|
+
_loop_1(observer);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
53
|
+
finally {
|
|
54
|
+
try {
|
|
55
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
56
|
+
}
|
|
57
|
+
finally { if (e_1) throw e_1.error; }
|
|
58
|
+
}
|
|
59
|
+
};
|
|
24
60
|
Reachability._observers = [];
|
|
25
61
|
return Reachability;
|
|
26
62
|
}());
|
package/lib-esm/Signer/Signer.js
CHANGED
|
@@ -13,6 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
import { DateUtils } from './DateUtils';
|
|
15
15
|
import { presignUrl, signRequest, TOKEN_QUERY_PARAM, } from '../clients/middleware/signing/signer/signatureV4';
|
|
16
|
+
import { AmplifyUrl } from '../utils/amplifyUrl';
|
|
16
17
|
var IOT_SERVICE_NAME = 'iotdevicegateway';
|
|
17
18
|
// Best practice regex to parse the service and region from an AWS endpoint
|
|
18
19
|
var AWS_ENDPOINT_REGEX = /([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(.cn)?$/;
|
|
@@ -60,7 +61,7 @@ var Signer = /** @class */ (function () {
|
|
|
60
61
|
if (request.body && !request.data) {
|
|
61
62
|
throw new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');
|
|
62
63
|
}
|
|
63
|
-
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new
|
|
64
|
+
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new AmplifyUrl(request.url) });
|
|
64
65
|
var options = getOptions(requestToSign, accessInfo, serviceInfo);
|
|
65
66
|
var signedRequest = signRequest(requestToSign, options);
|
|
66
67
|
// Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property
|
|
@@ -82,7 +83,7 @@ var Signer = /** @class */ (function () {
|
|
|
82
83
|
var presignable = {
|
|
83
84
|
body: body,
|
|
84
85
|
method: method,
|
|
85
|
-
url: new
|
|
86
|
+
url: new AmplifyUrl(urlToSign),
|
|
86
87
|
};
|
|
87
88
|
var options = getOptions(presignable, accessInfo, serviceInfo, expiration);
|
|
88
89
|
var signedUrl = presignUrl(presignable, options);
|
|
@@ -41,6 +41,7 @@ import { composeTransferHandler } from '../../clients/internal/composeTransferHa
|
|
|
41
41
|
import { jitteredBackoff, getRetryDecider, } from '../../clients/middleware/retry';
|
|
42
42
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
43
43
|
import { observeFrameworkChanges } from '../../Platform/detectFramework';
|
|
44
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
44
45
|
/**
|
|
45
46
|
* The service name used to sign requests if the API requires authentication.
|
|
46
47
|
*/
|
|
@@ -51,7 +52,7 @@ var SERVICE_NAME = 'cognito-identity';
|
|
|
51
52
|
var endpointResolver = function (_a) {
|
|
52
53
|
var region = _a.region;
|
|
53
54
|
return ({
|
|
54
|
-
url: new
|
|
55
|
+
url: new AmplifyUrl("https://cognito-identity.".concat(region, ".").concat(getDnsSuffix(region))),
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
58
|
/**
|
|
@@ -4,6 +4,7 @@ import { getDnsSuffix } from '../../clients/endpoints';
|
|
|
4
4
|
import { jitteredBackoff, getRetryDecider, } from '../../clients/middleware/retry';
|
|
5
5
|
import { parseJsonError } from '../../clients/serde/json';
|
|
6
6
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
7
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
7
8
|
/**
|
|
8
9
|
* The service name used to sign requests if the API requires authentication.
|
|
9
10
|
*/
|
|
@@ -14,7 +15,7 @@ var SERVICE_NAME = 'mobiletargeting';
|
|
|
14
15
|
var endpointResolver = function (_a) {
|
|
15
16
|
var region = _a.region;
|
|
16
17
|
return ({
|
|
17
|
-
url: new
|
|
18
|
+
url: new AmplifyUrl("https://pinpoint.".concat(region, ".").concat(getDnsSuffix(region))),
|
|
18
19
|
});
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
@@ -41,10 +41,11 @@ import { composeServiceApi } from '../../clients/internal/composeServiceApi';
|
|
|
41
41
|
import { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';
|
|
42
42
|
import { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';
|
|
43
43
|
import { defaultConfig, getSharedHeaders } from './base';
|
|
44
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
44
45
|
var getInAppMessagesSerializer = function (_a, endpoint) {
|
|
45
46
|
var _b = _a.ApplicationId, ApplicationId = _b === void 0 ? '' : _b, _c = _a.EndpointId, EndpointId = _c === void 0 ? '' : _c;
|
|
46
47
|
var headers = getSharedHeaders();
|
|
47
|
-
var url = new
|
|
48
|
+
var url = new AmplifyUrl(endpoint.url);
|
|
48
49
|
url.pathname = "v1/apps/".concat(extendedEncodeURIComponent(ApplicationId), "/endpoints/").concat(extendedEncodeURIComponent(EndpointId), "/inappmessages");
|
|
49
50
|
return { method: 'GET', headers: headers, url: url };
|
|
50
51
|
};
|
|
@@ -42,11 +42,12 @@ import { extendedEncodeURIComponent } from '../../clients/middleware/signing/uti
|
|
|
42
42
|
import { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';
|
|
43
43
|
import { defaultConfig, getSharedHeaders } from './base';
|
|
44
44
|
import { assert, PinpointValidationErrorCode } from './errorHelpers';
|
|
45
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
45
46
|
var putEventsSerializer = function (_a, endpoint) {
|
|
46
47
|
var ApplicationId = _a.ApplicationId, EventsRequest = _a.EventsRequest;
|
|
47
48
|
assert(!!ApplicationId, PinpointValidationErrorCode.NoAppId);
|
|
48
49
|
var headers = getSharedHeaders();
|
|
49
|
-
var url = new
|
|
50
|
+
var url = new AmplifyUrl(endpoint.url);
|
|
50
51
|
url.pathname = "v1/apps/".concat(extendedEncodeURIComponent(ApplicationId), "/events");
|
|
51
52
|
var body = JSON.stringify(EventsRequest !== null && EventsRequest !== void 0 ? EventsRequest : {});
|
|
52
53
|
return { method: 'POST', headers: headers, url: url, body: body };
|
|
@@ -41,10 +41,11 @@ import { composeServiceApi } from '../../clients/internal/composeServiceApi';
|
|
|
41
41
|
import { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';
|
|
42
42
|
import { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';
|
|
43
43
|
import { defaultConfig, getSharedHeaders } from './base';
|
|
44
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
44
45
|
var updateEndpointSerializer = function (_a, endpoint) {
|
|
45
46
|
var _b = _a.ApplicationId, ApplicationId = _b === void 0 ? '' : _b, _c = _a.EndpointId, EndpointId = _c === void 0 ? '' : _c, EndpointRequest = _a.EndpointRequest;
|
|
46
47
|
var headers = getSharedHeaders();
|
|
47
|
-
var url = new
|
|
48
|
+
var url = new AmplifyUrl(endpoint.url);
|
|
48
49
|
url.pathname = "v1/apps/".concat(extendedEncodeURIComponent(ApplicationId), "/endpoints/").concat(extendedEncodeURIComponent(EndpointId));
|
|
49
50
|
var body = JSON.stringify(EndpointRequest);
|
|
50
51
|
return { method: 'PUT', headers: headers, url: url, body: body };
|
|
@@ -41,6 +41,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
41
41
|
import { ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, EXPIRES_QUERY_PARAM, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_QUERY_PARAM, } from './constants';
|
|
42
42
|
import { getSigningValues } from './utils/getSigningValues';
|
|
43
43
|
import { getSignature } from './utils/getSignature';
|
|
44
|
+
import { AmplifyUrl } from '../../../../../utils/amplifyUrl';
|
|
44
45
|
/**
|
|
45
46
|
* Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
|
|
46
47
|
*
|
|
@@ -56,7 +57,7 @@ export var presignUrl = function (_a, _b) {
|
|
|
56
57
|
var accessKeyId = signingValues.accessKeyId, credentialScope = signingValues.credentialScope, longDate = signingValues.longDate, sessionToken = signingValues.sessionToken;
|
|
57
58
|
// create the request to sign
|
|
58
59
|
// @ts-ignore URL constructor accepts a URL object
|
|
59
|
-
var presignedUrl = new
|
|
60
|
+
var presignedUrl = new AmplifyUrl(url);
|
|
60
61
|
Object.entries(__assign(__assign((_c = {}, _c[ALGORITHM_QUERY_PARAM] = SHA256_ALGORITHM_IDENTIFIER, _c[CREDENTIAL_QUERY_PARAM] = "".concat(accessKeyId, "/").concat(credentialScope), _c[AMZ_DATE_QUERY_PARAM] = longDate, _c[SIGNED_HEADERS_QUERY_PARAM] = HOST_HEADER, _c), (expiration && (_d = {}, _d[EXPIRES_QUERY_PARAM] = expiration.toString(), _d))), (sessionToken && (_e = {}, _e[TOKEN_QUERY_PARAM] = sessionToken, _e)))).forEach(function (_a) {
|
|
61
62
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
62
63
|
presignedUrl.searchParams.append(key, value);
|
package/lib-esm/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-esm/index.js
CHANGED
|
@@ -11,9 +11,6 @@ export { getCredentialsForIdentity, getId, } from './awsClients/cognitoIdentity'
|
|
|
11
11
|
// Storage helpers
|
|
12
12
|
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
13
13
|
// Cache exports
|
|
14
|
-
|
|
15
|
-
export { InMemoryCache } from './Cache/InMemoryCache';
|
|
16
|
-
export { BrowserStorageCache };
|
|
17
|
-
export { BrowserStorageCache as Cache }; // Maintain interoperability with React Native
|
|
14
|
+
export { Cache } from './Cache';
|
|
18
15
|
// Internationalization utilities
|
|
19
16
|
export { I18n } from './I18n';
|