@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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.currentSizeKey = exports.defaultConfig = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Default cache config
|
|
8
|
+
*/
|
|
9
|
+
exports.defaultConfig = {
|
|
10
|
+
keyPrefix: 'aws-amplify-cache',
|
|
11
|
+
capacityInBytes: 1048576,
|
|
12
|
+
itemMaxSize: 210000,
|
|
13
|
+
defaultTTL: 259200000,
|
|
14
|
+
defaultPriority: 5,
|
|
15
|
+
warningThreshold: 0.8,
|
|
16
|
+
};
|
|
17
|
+
exports.currentSizeKey = 'CurSize';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Cache = void 0;
|
|
6
|
+
var StorageCache_1 = require("./StorageCache");
|
|
7
|
+
exports.Cache = new StorageCache_1.StorageCache();
|
|
@@ -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';
|
package/lib/Cache/types/index.js
CHANGED
|
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./cache"), exports);
|
|
@@ -13,6 +13,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
13
13
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CacheList = void 0;
|
|
16
17
|
var errorHelpers_1 = require("./errorHelpers");
|
|
17
18
|
var DoubleLinkedNode = /** @class */ (function () {
|
|
18
19
|
function DoubleLinkedNode(keyVal) {
|
|
@@ -180,4 +181,4 @@ var CacheList = /** @class */ (function () {
|
|
|
180
181
|
};
|
|
181
182
|
return CacheList;
|
|
182
183
|
}());
|
|
183
|
-
exports.
|
|
184
|
+
exports.CacheList = CacheList;
|
|
@@ -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,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getCurrentSizeKey = exports.isInteger = exports.getCurrentTime = exports.getByteLength = void 0;
|
|
6
|
+
var constants_1 = require("../constants");
|
|
7
|
+
/**
|
|
8
|
+
* return the byte size of the string
|
|
9
|
+
* @param str
|
|
10
|
+
*/
|
|
11
|
+
function getByteLength(str) {
|
|
12
|
+
var ret = 0;
|
|
13
|
+
ret = str.length;
|
|
14
|
+
for (var i = str.length; i >= 0; i -= 1) {
|
|
15
|
+
var charCode = str.charCodeAt(i);
|
|
16
|
+
if (charCode > 0x7f && charCode <= 0x7ff) {
|
|
17
|
+
ret += 1;
|
|
18
|
+
}
|
|
19
|
+
else if (charCode > 0x7ff && charCode <= 0xffff) {
|
|
20
|
+
ret += 2;
|
|
21
|
+
}
|
|
22
|
+
// trail surrogate
|
|
23
|
+
if (charCode >= 0xdc00 && charCode <= 0xdfff) {
|
|
24
|
+
i -= 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return ret;
|
|
28
|
+
}
|
|
29
|
+
exports.getByteLength = getByteLength;
|
|
30
|
+
/**
|
|
31
|
+
* get current time
|
|
32
|
+
*/
|
|
33
|
+
function getCurrentTime() {
|
|
34
|
+
var currentTime = new Date();
|
|
35
|
+
return currentTime.getTime();
|
|
36
|
+
}
|
|
37
|
+
exports.getCurrentTime = getCurrentTime;
|
|
38
|
+
/**
|
|
39
|
+
* check if passed value is an integer
|
|
40
|
+
*/
|
|
41
|
+
function isInteger(value) {
|
|
42
|
+
if (Number.isInteger) {
|
|
43
|
+
return Number.isInteger(value);
|
|
44
|
+
}
|
|
45
|
+
return (typeof value === 'number' && isFinite(value) && Math.floor(value) === value);
|
|
46
|
+
}
|
|
47
|
+
exports.isInteger = isInteger;
|
|
48
|
+
var getCurrentSizeKey = function (keyPrefix) {
|
|
49
|
+
return "".concat(keyPrefix).concat(constants_1.currentSizeKey);
|
|
50
|
+
};
|
|
51
|
+
exports.getCurrentSizeKey = getCurrentSizeKey;
|
|
@@ -8,7 +8,6 @@ var errors_1 = require("../../errors");
|
|
|
8
8
|
var CacheErrorCode;
|
|
9
9
|
(function (CacheErrorCode) {
|
|
10
10
|
CacheErrorCode["NoCacheItem"] = "NoCacheItem";
|
|
11
|
-
CacheErrorCode["NoCacheStorage"] = "NoCacheStorage";
|
|
12
11
|
CacheErrorCode["NullNextNode"] = "NullNextNode";
|
|
13
12
|
CacheErrorCode["NullPreviousNode"] = "NullPreviousNode";
|
|
14
13
|
})(CacheErrorCode = exports.CacheErrorCode || (exports.CacheErrorCode = {}));
|
|
@@ -16,9 +15,6 @@ var cacheErrorMap = (_a = {},
|
|
|
16
15
|
_a[CacheErrorCode.NoCacheItem] = {
|
|
17
16
|
message: 'Item not found in the cache storage.',
|
|
18
17
|
},
|
|
19
|
-
_a[CacheErrorCode.NoCacheStorage] = {
|
|
20
|
-
message: 'Storage is not defined in the cache config.',
|
|
21
|
-
},
|
|
22
18
|
_a[CacheErrorCode.NullNextNode] = {
|
|
23
19
|
message: 'Next node is null.',
|
|
24
20
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.CacheList = exports.isInteger = exports.getCurrentTime = exports.getCurrentSizeKey = exports.getByteLength = void 0;
|
|
6
|
+
var cacheHelpers_1 = require("./cacheHelpers");
|
|
7
|
+
Object.defineProperty(exports, "getByteLength", { enumerable: true, get: function () { return cacheHelpers_1.getByteLength; } });
|
|
8
|
+
Object.defineProperty(exports, "getCurrentSizeKey", { enumerable: true, get: function () { return cacheHelpers_1.getCurrentSizeKey; } });
|
|
9
|
+
Object.defineProperty(exports, "getCurrentTime", { enumerable: true, get: function () { return cacheHelpers_1.getCurrentTime; } });
|
|
10
|
+
Object.defineProperty(exports, "isInteger", { enumerable: true, get: function () { return cacheHelpers_1.isInteger; } });
|
|
11
|
+
var CacheList_1 = require("./CacheList");
|
|
12
|
+
Object.defineProperty(exports, "CacheList", { enumerable: true, get: function () { return CacheList_1.CacheList; } });
|
package/lib/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/Hub/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
38
38
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.Hub = exports.HubClass = exports.AMPLIFY_SYMBOL = void 0;
|
|
41
|
+
exports.HubInternal = exports.Hub = exports.HubClass = exports.AMPLIFY_SYMBOL = void 0;
|
|
42
42
|
var Logger_1 = require("../Logger");
|
|
43
43
|
var constants_1 = require("../constants");
|
|
44
44
|
var errors_1 = require("../errors");
|
|
@@ -149,3 +149,10 @@ exports.HubClass = HubClass;
|
|
|
149
149
|
pseudo Singleton for the main messaging bus, however you can still create
|
|
150
150
|
your own instance of HubClass() for a separate "private bus" of events.*/
|
|
151
151
|
exports.Hub = new HubClass('__default__');
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
*
|
|
155
|
+
* Internal hub used for core Amplify functionality. Not intended for use outside of Amplify.
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
158
|
+
exports.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,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __assign = (this && this.__assign) || function () {
|
|
5
|
+
__assign = Object.assign || function(t) {
|
|
6
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
+
s = arguments[i];
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
+
t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getCustomUserAgent = exports.setCustomUserAgent = void 0;
|
|
17
|
+
// Maintains custom user-agent state set by external consumers.
|
|
18
|
+
var customUserAgentState = {};
|
|
19
|
+
/**
|
|
20
|
+
* Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
|
|
21
|
+
* clean up any custom state set with this API.
|
|
22
|
+
*
|
|
23
|
+
* @note
|
|
24
|
+
* This API operates globally. Calling this API multiple times will result in the most recently set values for a
|
|
25
|
+
* particular API being used.
|
|
26
|
+
*
|
|
27
|
+
* @note
|
|
28
|
+
* This utility IS NOT compatible with SSR.
|
|
29
|
+
*
|
|
30
|
+
* @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
|
|
31
|
+
*/
|
|
32
|
+
var setCustomUserAgent = function (input) {
|
|
33
|
+
var _a;
|
|
34
|
+
// Save custom user-agent state & increment reference counter
|
|
35
|
+
// TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373
|
|
36
|
+
customUserAgentState[input.category] = input.apis.reduce(function (acc, api) {
|
|
37
|
+
var _a;
|
|
38
|
+
var _b;
|
|
39
|
+
return (__assign(__assign({}, acc), (_a = {}, _a[api] = {
|
|
40
|
+
refCount: ((_b = acc[api]) === null || _b === void 0 ? void 0 : _b.refCount) ? acc[api].refCount + 1 : 1,
|
|
41
|
+
additionalDetails: input.additionalDetails,
|
|
42
|
+
}, _a)));
|
|
43
|
+
}, (_a = customUserAgentState[input.category]) !== null && _a !== void 0 ? _a : {});
|
|
44
|
+
// Callback that cleans up state for APIs recorded by this call
|
|
45
|
+
var cleanUpCallbackCalled = false;
|
|
46
|
+
var cleanUpCallback = function () {
|
|
47
|
+
// Only allow the cleanup callback to be called once
|
|
48
|
+
if (cleanUpCallbackCalled) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
cleanUpCallbackCalled = true;
|
|
52
|
+
input.apis.forEach(function (api) {
|
|
53
|
+
var apiRefCount = customUserAgentState[input.category][api].refCount;
|
|
54
|
+
if (apiRefCount > 1) {
|
|
55
|
+
customUserAgentState[input.category][api].refCount = apiRefCount - 1;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
delete customUserAgentState[input.category][api];
|
|
59
|
+
// Clean up category if no more APIs set
|
|
60
|
+
if (!Object.keys(customUserAgentState[input.category]).length) {
|
|
61
|
+
delete customUserAgentState[input.category];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return cleanUpCallback;
|
|
67
|
+
};
|
|
68
|
+
exports.setCustomUserAgent = setCustomUserAgent;
|
|
69
|
+
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; };
|
|
70
|
+
exports.getCustomUserAgent = getCustomUserAgent;
|
package/lib/Platform/index.js
CHANGED
|
@@ -22,6 +22,7 @@ exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platfo
|
|
|
22
22
|
var types_1 = require("./types");
|
|
23
23
|
var version_1 = require("./version");
|
|
24
24
|
var detectFramework_1 = require("./detectFramework");
|
|
25
|
+
var customUserAgent_1 = require("./customUserAgent");
|
|
25
26
|
var BASE_USER_AGENT = "aws-amplify";
|
|
26
27
|
var PlatformBuilder = /** @class */ (function () {
|
|
27
28
|
function PlatformBuilder() {
|
|
@@ -55,6 +56,14 @@ var getAmplifyUserAgentObject = function (_a) {
|
|
|
55
56
|
userAgent.push([category, action]);
|
|
56
57
|
}
|
|
57
58
|
userAgent.push(['framework', (0, detectFramework_1.detectFramework)()]);
|
|
59
|
+
if (category && action) {
|
|
60
|
+
var customState = (0, customUserAgent_1.getCustomUserAgent)(category, action);
|
|
61
|
+
if (customState) {
|
|
62
|
+
customState.forEach(function (state) {
|
|
63
|
+
userAgent.push(state);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
58
67
|
return userAgent;
|
|
59
68
|
};
|
|
60
69
|
exports.getAmplifyUserAgentObject = getAmplifyUserAgentObject;
|
|
@@ -63,7 +72,7 @@ var getAmplifyUserAgent = function (customUserAgentDetails) {
|
|
|
63
72
|
var userAgentString = userAgent
|
|
64
73
|
.map(function (_a) {
|
|
65
74
|
var _b = __read(_a, 2), agentKey = _b[0], agentValue = _b[1];
|
|
66
|
-
return "".concat(agentKey, "/").concat(agentValue);
|
|
75
|
+
return agentKey && agentValue ? "".concat(agentKey, "/").concat(agentValue) : agentKey;
|
|
67
76
|
})
|
|
68
77
|
.join(' ');
|
|
69
78
|
return userAgentString;
|
package/lib/Platform/types.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/Platform/types.js
CHANGED
|
@@ -94,6 +94,7 @@ var InAppMessagingAction;
|
|
|
94
94
|
(function (InAppMessagingAction) {
|
|
95
95
|
InAppMessagingAction["SyncMessages"] = "1";
|
|
96
96
|
InAppMessagingAction["IdentifyUser"] = "2";
|
|
97
|
+
InAppMessagingAction["DispatchEvent"] = "3";
|
|
97
98
|
})(InAppMessagingAction = exports.InAppMessagingAction || (exports.InAppMessagingAction = {}));
|
|
98
99
|
var InteractionsAction;
|
|
99
100
|
(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";
|
package/lib/Platform/version.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __values = (this && this.__values) || function(o) {
|
|
5
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
6
|
+
if (m) return m.call(o);
|
|
7
|
+
if (o && typeof o.length === "number") return {
|
|
8
|
+
next: function () {
|
|
9
|
+
if (o && i >= o.length) o = void 0;
|
|
10
|
+
return { value: o && o[i++], done: !o };
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
14
|
+
};
|
|
4
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
16
|
exports.Reachability = void 0;
|
|
6
17
|
var rxjs_1 = require("rxjs");
|
|
@@ -24,6 +35,31 @@ var Reachability = exports.Reachability = /** @class */ (function () {
|
|
|
24
35
|
};
|
|
25
36
|
});
|
|
26
37
|
};
|
|
38
|
+
// expose observers to simulate offline mode for integration testing
|
|
39
|
+
Reachability._observerOverride = function (status) {
|
|
40
|
+
var e_1, _a;
|
|
41
|
+
var _loop_1 = function (observer) {
|
|
42
|
+
if (observer.closed) {
|
|
43
|
+
this_1._observers = this_1._observers.filter(function (_observer) { return _observer !== observer; });
|
|
44
|
+
return "continue";
|
|
45
|
+
}
|
|
46
|
+
(observer === null || observer === void 0 ? void 0 : observer.next) && observer.next(status);
|
|
47
|
+
};
|
|
48
|
+
var this_1 = this;
|
|
49
|
+
try {
|
|
50
|
+
for (var _b = __values(this._observers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
51
|
+
var observer = _c.value;
|
|
52
|
+
_loop_1(observer);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
56
|
+
finally {
|
|
57
|
+
try {
|
|
58
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
59
|
+
}
|
|
60
|
+
finally { if (e_1) throw e_1.error; }
|
|
61
|
+
}
|
|
62
|
+
};
|
|
27
63
|
Reachability._observers = [];
|
|
28
64
|
return Reachability;
|
|
29
65
|
}());
|
package/lib/Signer/Signer.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.Signer = void 0;
|
|
17
17
|
var DateUtils_1 = require("./DateUtils");
|
|
18
18
|
var signatureV4_1 = require("../clients/middleware/signing/signer/signatureV4");
|
|
19
|
+
var amplifyUrl_1 = require("../utils/amplifyUrl");
|
|
19
20
|
var IOT_SERVICE_NAME = 'iotdevicegateway';
|
|
20
21
|
// Best practice regex to parse the service and region from an AWS endpoint
|
|
21
22
|
var AWS_ENDPOINT_REGEX = /([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(.cn)?$/;
|
|
@@ -63,7 +64,7 @@ var Signer = /** @class */ (function () {
|
|
|
63
64
|
if (request.body && !request.data) {
|
|
64
65
|
throw new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');
|
|
65
66
|
}
|
|
66
|
-
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new
|
|
67
|
+
var requestToSign = __assign(__assign({}, request), { body: request.data, url: new amplifyUrl_1.AmplifyUrl(request.url) });
|
|
67
68
|
var options = getOptions(requestToSign, accessInfo, serviceInfo);
|
|
68
69
|
var signedRequest = (0, signatureV4_1.signRequest)(requestToSign, options);
|
|
69
70
|
// Prior to using `signRequest`, Signer accepted urls as strings and outputted urls as string. Coerce the property
|
|
@@ -85,7 +86,7 @@ var Signer = /** @class */ (function () {
|
|
|
85
86
|
var presignable = {
|
|
86
87
|
body: body,
|
|
87
88
|
method: method,
|
|
88
|
-
url: new
|
|
89
|
+
url: new amplifyUrl_1.AmplifyUrl(urlToSign),
|
|
89
90
|
};
|
|
90
91
|
var options = getOptions(presignable, accessInfo, serviceInfo, expiration);
|
|
91
92
|
var signedUrl = (0, signatureV4_1.presignUrl)(presignable, options);
|
|
@@ -44,6 +44,7 @@ var composeTransferHandler_1 = require("../../clients/internal/composeTransferHa
|
|
|
44
44
|
var retry_1 = require("../../clients/middleware/retry");
|
|
45
45
|
var Platform_1 = require("../../Platform");
|
|
46
46
|
var detectFramework_1 = require("../../Platform/detectFramework");
|
|
47
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
47
48
|
/**
|
|
48
49
|
* The service name used to sign requests if the API requires authentication.
|
|
49
50
|
*/
|
|
@@ -54,7 +55,7 @@ var SERVICE_NAME = 'cognito-identity';
|
|
|
54
55
|
var endpointResolver = function (_a) {
|
|
55
56
|
var region = _a.region;
|
|
56
57
|
return ({
|
|
57
|
-
url: new
|
|
58
|
+
url: new amplifyUrl_1.AmplifyUrl("https://cognito-identity.".concat(region, ".").concat((0, clients_1.getDnsSuffix)(region))),
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
61
|
/**
|
|
@@ -7,6 +7,7 @@ var endpoints_1 = require("../../clients/endpoints");
|
|
|
7
7
|
var retry_1 = require("../../clients/middleware/retry");
|
|
8
8
|
var json_1 = require("../../clients/serde/json");
|
|
9
9
|
var Platform_1 = require("../../Platform");
|
|
10
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
10
11
|
/**
|
|
11
12
|
* The service name used to sign requests if the API requires authentication.
|
|
12
13
|
*/
|
|
@@ -17,7 +18,7 @@ var SERVICE_NAME = 'mobiletargeting';
|
|
|
17
18
|
var endpointResolver = function (_a) {
|
|
18
19
|
var region = _a.region;
|
|
19
20
|
return ({
|
|
20
|
-
url: new
|
|
21
|
+
url: new amplifyUrl_1.AmplifyUrl("https://pinpoint.".concat(region, ".").concat((0, endpoints_1.getDnsSuffix)(region))),
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
@@ -44,10 +44,11 @@ var composeServiceApi_1 = require("../../clients/internal/composeServiceApi");
|
|
|
44
44
|
var extendedEncodeURIComponent_1 = require("../../clients/middleware/signing/utils/extendedEncodeURIComponent");
|
|
45
45
|
var serde_1 = require("../../clients/serde");
|
|
46
46
|
var base_1 = require("./base");
|
|
47
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
47
48
|
var getInAppMessagesSerializer = function (_a, endpoint) {
|
|
48
49
|
var _b = _a.ApplicationId, ApplicationId = _b === void 0 ? '' : _b, _c = _a.EndpointId, EndpointId = _c === void 0 ? '' : _c;
|
|
49
50
|
var headers = (0, base_1.getSharedHeaders)();
|
|
50
|
-
var url = new
|
|
51
|
+
var url = new amplifyUrl_1.AmplifyUrl(endpoint.url);
|
|
51
52
|
url.pathname = "v1/apps/".concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(ApplicationId), "/endpoints/").concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(EndpointId), "/inappmessages");
|
|
52
53
|
return { method: 'GET', headers: headers, url: url };
|
|
53
54
|
};
|
|
@@ -45,11 +45,12 @@ var extendedEncodeURIComponent_1 = require("../../clients/middleware/signing/uti
|
|
|
45
45
|
var serde_1 = require("../../clients/serde");
|
|
46
46
|
var base_1 = require("./base");
|
|
47
47
|
var errorHelpers_1 = require("./errorHelpers");
|
|
48
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
48
49
|
var putEventsSerializer = function (_a, endpoint) {
|
|
49
50
|
var ApplicationId = _a.ApplicationId, EventsRequest = _a.EventsRequest;
|
|
50
51
|
(0, errorHelpers_1.assert)(!!ApplicationId, errorHelpers_1.PinpointValidationErrorCode.NoAppId);
|
|
51
52
|
var headers = (0, base_1.getSharedHeaders)();
|
|
52
|
-
var url = new
|
|
53
|
+
var url = new amplifyUrl_1.AmplifyUrl(endpoint.url);
|
|
53
54
|
url.pathname = "v1/apps/".concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(ApplicationId), "/events");
|
|
54
55
|
var body = JSON.stringify(EventsRequest !== null && EventsRequest !== void 0 ? EventsRequest : {});
|
|
55
56
|
return { method: 'POST', headers: headers, url: url, body: body };
|
|
@@ -44,10 +44,11 @@ var composeServiceApi_1 = require("../../clients/internal/composeServiceApi");
|
|
|
44
44
|
var extendedEncodeURIComponent_1 = require("../../clients/middleware/signing/utils/extendedEncodeURIComponent");
|
|
45
45
|
var serde_1 = require("../../clients/serde");
|
|
46
46
|
var base_1 = require("./base");
|
|
47
|
+
var amplifyUrl_1 = require("../../utils/amplifyUrl");
|
|
47
48
|
var updateEndpointSerializer = function (_a, endpoint) {
|
|
48
49
|
var _b = _a.ApplicationId, ApplicationId = _b === void 0 ? '' : _b, _c = _a.EndpointId, EndpointId = _c === void 0 ? '' : _c, EndpointRequest = _a.EndpointRequest;
|
|
49
50
|
var headers = (0, base_1.getSharedHeaders)();
|
|
50
|
-
var url = new
|
|
51
|
+
var url = new amplifyUrl_1.AmplifyUrl(endpoint.url);
|
|
51
52
|
url.pathname = "v1/apps/".concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(ApplicationId), "/endpoints/").concat((0, extendedEncodeURIComponent_1.extendedEncodeURIComponent)(EndpointId));
|
|
52
53
|
var body = JSON.stringify(EndpointRequest);
|
|
53
54
|
return { method: 'PUT', headers: headers, url: url, body: body };
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.getHashedPayload = exports.TOKEN_QUERY_PARAM = exports.presignUrl = exports.signRequest = void 0;
|
|
6
|
-
require("./polyfills");
|
|
7
6
|
// TODO: V6 replace Signer
|
|
8
7
|
var signRequest_1 = require("./signRequest");
|
|
9
8
|
Object.defineProperty(exports, "signRequest", { enumerable: true, get: function () { return signRequest_1.signRequest; } });
|
|
@@ -44,6 +44,7 @@ exports.presignUrl = void 0;
|
|
|
44
44
|
var constants_1 = require("./constants");
|
|
45
45
|
var getSigningValues_1 = require("./utils/getSigningValues");
|
|
46
46
|
var getSignature_1 = require("./utils/getSignature");
|
|
47
|
+
var amplifyUrl_1 = require("../../../../../utils/amplifyUrl");
|
|
47
48
|
/**
|
|
48
49
|
* Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
|
|
49
50
|
*
|
|
@@ -59,7 +60,7 @@ var presignUrl = function (_a, _b) {
|
|
|
59
60
|
var accessKeyId = signingValues.accessKeyId, credentialScope = signingValues.credentialScope, longDate = signingValues.longDate, sessionToken = signingValues.sessionToken;
|
|
60
61
|
// create the request to sign
|
|
61
62
|
// @ts-ignore URL constructor accepts a URL object
|
|
62
|
-
var presignedUrl = new
|
|
63
|
+
var presignedUrl = new amplifyUrl_1.AmplifyUrl(url);
|
|
63
64
|
Object.entries(__assign(__assign((_c = {}, _c[constants_1.ALGORITHM_QUERY_PARAM] = constants_1.SHA256_ALGORITHM_IDENTIFIER, _c[constants_1.CREDENTIAL_QUERY_PARAM] = "".concat(accessKeyId, "/").concat(credentialScope), _c[constants_1.AMZ_DATE_QUERY_PARAM] = longDate, _c[constants_1.SIGNED_HEADERS_QUERY_PARAM] = constants_1.HOST_HEADER, _c), (expiration && (_d = {}, _d[constants_1.EXPIRES_QUERY_PARAM] = expiration.toString(), _d))), (sessionToken && (_e = {}, _e[constants_1.TOKEN_QUERY_PARAM] = sessionToken, _e)))).forEach(function (_a) {
|
|
64
65
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
65
66
|
presignedUrl.searchParams.append(key, value);
|