@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.
Files changed (260) hide show
  1. package/lib/Cache/StorageCache.d.ts +14 -31
  2. package/lib/Cache/StorageCache.js +97 -102
  3. package/lib/Cache/StorageCache.native.d.ts +19 -0
  4. package/lib/Cache/StorageCache.native.js +164 -0
  5. package/lib/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  6. package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +497 -432
  7. package/lib/Cache/constants.d.ts +6 -0
  8. package/lib/Cache/constants.js +17 -0
  9. package/lib/Cache/index.d.ts +2 -0
  10. package/lib/Cache/index.js +7 -0
  11. package/lib/Cache/types/cache.d.ts +38 -0
  12. package/lib/Cache/types/index.d.ts +1 -1
  13. package/lib/Cache/types/index.js +1 -1
  14. package/lib/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  15. package/lib/Cache/{Utils → utils}/CacheList.js +2 -1
  16. package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
  17. package/lib/Cache/utils/cacheHelpers.js +51 -0
  18. package/lib/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
  19. package/lib/Cache/{Utils → utils}/errorHelpers.js +0 -4
  20. package/lib/Cache/utils/index.d.ts +2 -0
  21. package/lib/Cache/utils/index.js +12 -0
  22. package/lib/Hub/index.d.ts +7 -0
  23. package/lib/Hub/index.js +8 -1
  24. package/lib/Platform/customUserAgent.d.ts +16 -0
  25. package/lib/Platform/customUserAgent.js +70 -0
  26. package/lib/Platform/index.js +10 -1
  27. package/lib/Platform/types.d.ts +33 -1
  28. package/lib/Platform/types.js +1 -0
  29. package/lib/Platform/version.d.ts +1 -1
  30. package/lib/Platform/version.js +1 -1
  31. package/lib/Reachability/Reachability.d.ts +1 -0
  32. package/lib/Reachability/Reachability.js +36 -0
  33. package/lib/Signer/Signer.js +3 -2
  34. package/lib/awsClients/cognitoIdentity/base.js +2 -1
  35. package/lib/awsClients/pinpoint/base.js +2 -1
  36. package/lib/awsClients/pinpoint/getInAppMessages.js +2 -1
  37. package/lib/awsClients/pinpoint/putEvents.js +2 -1
  38. package/lib/awsClients/pinpoint/updateEndpoint.js +2 -1
  39. package/lib/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  40. package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  41. package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  42. package/lib/index.d.ts +2 -5
  43. package/lib/index.js +3 -6
  44. package/lib/libraryUtils.d.ts +7 -5
  45. package/lib/libraryUtils.js +11 -6
  46. package/lib/parseAWSExports.js +75 -14
  47. package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  48. package/lib/providers/pinpoint/apis/record.js +3 -3
  49. package/lib/providers/pinpoint/apis/updateEndpoint.js +6 -6
  50. package/lib/singleton/API/types.d.ts +4 -3
  51. package/lib/singleton/Amplify.d.ts +2 -2
  52. package/lib/singleton/Amplify.js +6 -5
  53. package/lib/singleton/Auth/types.d.ts +28 -1
  54. package/lib/singleton/Cache/types.d.ts +18 -0
  55. package/lib/singleton/Cache/types.js +4 -0
  56. package/lib/singleton/types.d.ts +3 -1
  57. package/lib/storage/DefaultStorage.js +1 -1
  58. package/lib/storage/utils.d.ts +1 -1
  59. package/lib/storage/utils.js +3 -3
  60. package/lib/tsconfig.tsbuildinfo +1 -1
  61. package/lib/utils/amplifyUrl/index.d.ts +13 -0
  62. package/lib/utils/amplifyUrl/index.js +10 -0
  63. package/lib/utils/amplifyUrl/polyfill.d.ts +0 -0
  64. package/lib/utils/amplifyUrl/polyfill.js +4 -0
  65. package/lib/utils/amplifyUrl/polyfill.native.d.ts +1 -0
  66. package/lib/utils/amplifyUuid/index.d.ts +3 -0
  67. package/lib/utils/amplifyUuid/index.js +9 -0
  68. package/lib/utils/amplifyUuid/polyfill.d.ts +0 -0
  69. package/lib/utils/amplifyUuid/polyfill.js +4 -0
  70. package/lib/utils/amplifyUuid/polyfill.native.d.ts +1 -0
  71. package/lib/utils/amplifyUuid/polyfill.native.js +6 -0
  72. package/lib/utils/deepFreeze.d.ts +1 -0
  73. package/lib/utils/deepFreeze.js +38 -0
  74. package/lib/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  75. package/lib/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +4 -4
  76. package/lib/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  77. package/lib/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  78. package/lib/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +4 -4
  79. package/lib/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +6 -18
  80. package/lib/utils/getClientInfo/index.d.ts +1 -0
  81. package/lib/utils/getClientInfo/index.js +7 -0
  82. package/lib/utils/index.d.ts +2 -0
  83. package/lib/utils/index.js +5 -1
  84. package/lib-esm/Cache/StorageCache.d.ts +14 -31
  85. package/lib-esm/Cache/StorageCache.js +97 -102
  86. package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
  87. package/lib-esm/Cache/StorageCache.native.js +161 -0
  88. package/lib-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  89. package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +496 -430
  90. package/lib-esm/Cache/constants.d.ts +6 -0
  91. package/lib-esm/Cache/constants.js +14 -0
  92. package/lib-esm/Cache/index.d.ts +2 -0
  93. package/lib-esm/Cache/index.js +4 -0
  94. package/lib-esm/Cache/types/cache.d.ts +38 -0
  95. package/lib-esm/Cache/types/index.d.ts +1 -1
  96. package/lib-esm/Cache/types/index.js +1 -1
  97. package/lib-esm/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  98. package/lib-esm/Cache/{Utils → utils}/CacheList.js +1 -1
  99. package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
  100. package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
  101. package/lib-esm/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
  102. package/lib-esm/Cache/{Utils → utils}/errorHelpers.js +0 -4
  103. package/lib-esm/Cache/utils/index.d.ts +2 -0
  104. package/lib-esm/Cache/utils/index.js +4 -0
  105. package/lib-esm/Hub/index.d.ts +7 -0
  106. package/lib-esm/Hub/index.js +7 -0
  107. package/lib-esm/Platform/customUserAgent.d.ts +16 -0
  108. package/lib-esm/Platform/customUserAgent.js +65 -0
  109. package/lib-esm/Platform/index.js +10 -1
  110. package/lib-esm/Platform/types.d.ts +33 -1
  111. package/lib-esm/Platform/types.js +1 -0
  112. package/lib-esm/Platform/version.d.ts +1 -1
  113. package/lib-esm/Platform/version.js +1 -1
  114. package/lib-esm/Reachability/Reachability.d.ts +1 -0
  115. package/lib-esm/Reachability/Reachability.js +36 -0
  116. package/lib-esm/Signer/Signer.js +3 -2
  117. package/lib-esm/awsClients/cognitoIdentity/base.js +2 -1
  118. package/lib-esm/awsClients/pinpoint/base.js +2 -1
  119. package/lib-esm/awsClients/pinpoint/getInAppMessages.js +2 -1
  120. package/lib-esm/awsClients/pinpoint/putEvents.js +2 -1
  121. package/lib-esm/awsClients/pinpoint/updateEndpoint.js +2 -1
  122. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  123. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  124. package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  125. package/lib-esm/index.d.ts +2 -5
  126. package/lib-esm/index.js +1 -4
  127. package/lib-esm/libraryUtils.d.ts +7 -5
  128. package/lib-esm/libraryUtils.js +5 -3
  129. package/lib-esm/parseAWSExports.js +75 -14
  130. package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  131. package/lib-esm/providers/pinpoint/apis/record.js +3 -3
  132. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +6 -6
  133. package/lib-esm/singleton/API/types.d.ts +4 -3
  134. package/lib-esm/singleton/Amplify.d.ts +2 -2
  135. package/lib-esm/singleton/Amplify.js +6 -5
  136. package/lib-esm/singleton/Auth/types.d.ts +28 -1
  137. package/lib-esm/singleton/Cache/types.d.ts +18 -0
  138. package/lib-esm/singleton/Cache/types.js +3 -0
  139. package/lib-esm/singleton/types.d.ts +3 -1
  140. package/lib-esm/storage/DefaultStorage.js +2 -2
  141. package/lib-esm/storage/utils.d.ts +1 -1
  142. package/lib-esm/storage/utils.js +1 -1
  143. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  144. package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
  145. package/lib-esm/utils/amplifyUrl/index.js +6 -0
  146. package/lib-esm/utils/amplifyUuid/index.d.ts +3 -0
  147. package/lib-esm/utils/amplifyUuid/index.js +6 -0
  148. package/lib-esm/utils/amplifyUuid/polyfill.native.js +4 -0
  149. package/lib-esm/utils/deepFreeze.d.ts +1 -0
  150. package/lib-esm/utils/deepFreeze.js +34 -0
  151. package/lib-esm/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  152. package/lib-esm/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +2 -2
  153. package/lib-esm/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  154. package/lib-esm/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  155. package/lib-esm/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +2 -2
  156. package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +4 -14
  157. package/lib-esm/utils/getClientInfo/index.d.ts +1 -0
  158. package/lib-esm/utils/getClientInfo/index.js +3 -0
  159. package/lib-esm/utils/index.d.ts +2 -0
  160. package/lib-esm/utils/index.js +2 -0
  161. package/package.json +7 -17
  162. package/src/Cache/StorageCache.native.ts +65 -0
  163. package/src/Cache/StorageCache.ts +61 -158
  164. package/src/Cache/StorageCacheCommon.ts +581 -0
  165. package/src/Cache/constants.ts +18 -0
  166. package/src/Cache/index.ts +6 -0
  167. package/src/Cache/types/cache.ts +51 -0
  168. package/src/Cache/types/index.ts +1 -1
  169. package/src/Cache/{Utils → utils}/CacheList.ts +185 -185
  170. package/src/Cache/utils/cacheHelpers.ts +52 -0
  171. package/src/Cache/{Utils → utils}/errorHelpers.ts +0 -4
  172. package/src/Cache/{Utils → utils}/index.ts +4 -5
  173. package/src/Hub/index.ts +8 -0
  174. package/src/Platform/customUserAgent.ts +75 -0
  175. package/src/Platform/index.ts +14 -1
  176. package/src/Platform/types.ts +45 -1
  177. package/src/Platform/version.ts +1 -1
  178. package/src/Reachability/Reachability.ts +14 -0
  179. package/src/Signer/Signer.ts +3 -2
  180. package/src/awsClients/cognitoIdentity/base.ts +4 -1
  181. package/src/awsClients/pinpoint/base.ts +2 -1
  182. package/src/awsClients/pinpoint/getInAppMessages.ts +2 -1
  183. package/src/awsClients/pinpoint/putEvents.ts +2 -1
  184. package/src/awsClients/pinpoint/updateEndpoint.ts +2 -1
  185. package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -2
  186. package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
  187. package/src/index.ts +3 -4
  188. package/src/libraryUtils.ts +17 -10
  189. package/src/parseAWSExports.ts +76 -13
  190. package/src/providers/pinpoint/apis/flushEvents.ts +2 -2
  191. package/src/providers/pinpoint/apis/record.ts +3 -3
  192. package/src/providers/pinpoint/apis/updateEndpoint.ts +6 -6
  193. package/src/singleton/API/types.ts +4 -3
  194. package/src/singleton/Amplify.ts +10 -8
  195. package/src/singleton/Auth/types.ts +50 -1
  196. package/src/singleton/Cache/types.ts +27 -0
  197. package/src/singleton/types.ts +3 -1
  198. package/src/storage/DefaultStorage.ts +2 -2
  199. package/src/storage/utils.ts +1 -1
  200. package/src/utils/amplifyUrl/index.ts +9 -0
  201. package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.ts → utils/amplifyUrl/polyfill.native.ts} +1 -0
  202. package/src/utils/amplifyUuid/index.ts +9 -0
  203. package/src/utils/amplifyUuid/polyfill.native.ts +6 -0
  204. package/src/utils/amplifyUuid/polyfill.ts +4 -0
  205. package/src/utils/deepFreeze.ts +16 -0
  206. package/src/{ClientDevice/android.ts → utils/getClientInfo/getClientInfo.android.ts} +2 -2
  207. package/src/{ClientDevice/ios.ts → utils/getClientInfo/getClientInfo.ios.ts} +3 -3
  208. package/src/{ClientDevice/browser.ts → utils/getClientInfo/getClientInfo.ts} +4 -16
  209. package/src/utils/getClientInfo/index.ts +4 -0
  210. package/src/utils/index.ts +2 -0
  211. package/lib/Cache/BrowserStorageCache.d.ts +0 -166
  212. package/lib/Cache/BrowserStorageCache.js +0 -456
  213. package/lib/Cache/InMemoryCache.d.ts +0 -129
  214. package/lib/Cache/InMemoryCache.js +0 -342
  215. package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
  216. package/lib/Cache/Utils/CacheUtils.js +0 -86
  217. package/lib/Cache/Utils/index.d.ts +0 -2
  218. package/lib/Cache/Utils/index.js +0 -16
  219. package/lib/Cache/reactnative.d.ts +0 -3
  220. package/lib/Cache/reactnative.js +0 -8
  221. package/lib/Cache/types/Cache.d.ts +0 -55
  222. package/lib/ClientDevice/index.d.ts +0 -23
  223. package/lib/ClientDevice/index.js +0 -18
  224. package/lib/ClientDevice/reactnative.d.ts +0 -7
  225. package/lib/ClientDevice/reactnative.js +0 -24
  226. package/lib-esm/Cache/BrowserStorageCache.d.ts +0 -166
  227. package/lib-esm/Cache/BrowserStorageCache.js +0 -453
  228. package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
  229. package/lib-esm/Cache/InMemoryCache.js +0 -339
  230. package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
  231. package/lib-esm/Cache/Utils/CacheUtils.js +0 -79
  232. package/lib-esm/Cache/Utils/index.d.ts +0 -2
  233. package/lib-esm/Cache/Utils/index.js +0 -4
  234. package/lib-esm/Cache/reactnative.d.ts +0 -3
  235. package/lib-esm/Cache/reactnative.js +0 -6
  236. package/lib-esm/Cache/types/Cache.d.ts +0 -55
  237. package/lib-esm/ClientDevice/index.d.ts +0 -23
  238. package/lib-esm/ClientDevice/index.js +0 -15
  239. package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
  240. package/lib-esm/ClientDevice/reactnative.js +0 -21
  241. package/src/Cache/AsyncStorageCache.ts +0 -495
  242. package/src/Cache/BrowserStorageCache.ts +0 -504
  243. package/src/Cache/CHANGELOG.md +0 -1239
  244. package/src/Cache/InMemoryCache.ts +0 -347
  245. package/src/Cache/Utils/CacheUtils.ts +0 -90
  246. package/src/Cache/reactnative.ts +0 -9
  247. package/src/Cache/types/Cache.ts +0 -75
  248. package/src/ClientDevice/index.ts +0 -14
  249. package/src/ClientDevice/reactnative.ts +0 -18
  250. package/lib/Cache/types/{Cache.js → cache.js} +0 -0
  251. package/lib/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +1 -1
  252. /package/lib-esm/Cache/types/{Cache.js → cache.js} +0 -0
  253. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → utils/amplifyUrl/polyfill.d.ts} +0 -0
  254. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.js → utils/amplifyUrl/polyfill.js} +0 -0
  255. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → utils/amplifyUrl/polyfill.native.d.ts} +0 -0
  256. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +0 -0
  257. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → lib-esm/utils/amplifyUuid/polyfill.d.ts} +0 -0
  258. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.js → lib-esm/utils/amplifyUuid/polyfill.js} +0 -0
  259. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → lib-esm/utils/amplifyUuid/polyfill.native.d.ts} +0 -0
  260. /package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.ts → utils/amplifyUrl/polyfill.ts} +0 -0
@@ -0,0 +1,6 @@
1
+ import { CacheConfig } from './types';
2
+ /**
3
+ * Default cache config
4
+ */
5
+ export declare const defaultConfig: Omit<CacheConfig, 'storage'>;
6
+ export declare const currentSizeKey = "CurSize";
@@ -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,2 @@
1
+ import { StorageCache } from './StorageCache';
2
+ export declare const Cache: StorageCache;
@@ -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 './Cache';
1
+ export * from './cache';
@@ -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("./Cache"), exports);
19
+ __exportStar(require("./cache"), exports);
@@ -9,7 +9,7 @@
9
9
  * @member hashtable - the hashtable which maps cache key to list node
10
10
  * @member length - length of the list
11
11
  */
12
- export default class CacheList {
12
+ export declare class CacheList {
13
13
  private head;
14
14
  private tail;
15
15
  private hashtable;
@@ -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.default = CacheList;
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;
@@ -1,7 +1,6 @@
1
1
  import { AssertionFunction } from '../../types';
2
2
  export declare enum CacheErrorCode {
3
3
  NoCacheItem = "NoCacheItem",
4
- NoCacheStorage = "NoCacheStorage",
5
4
  NullNextNode = "NullNextNode",
6
5
  NullPreviousNode = "NullPreviousNode"
7
6
  }
@@ -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,2 @@
1
+ export { getByteLength, getCurrentSizeKey, getCurrentTime, isInteger, } from './cacheHelpers';
2
+ export { CacheList } from './CacheList';
@@ -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; } });
@@ -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;
@@ -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;
@@ -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 {};
@@ -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.5f040a2.0+5f040a2";
1
+ export declare const version = "6.0.1-console-preview.23dc225.0+23dc225";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.5f040a2.0+5f040a2';
5
+ exports.version = '6.0.1-console-preview.23dc225.0+23dc225';
@@ -3,4 +3,5 @@ import { NetworkStatus } from './types';
3
3
  export declare class Reachability {
4
4
  private static _observers;
5
5
  networkMonitor(_?: unknown): Observable<NetworkStatus>;
6
+ private static _observerOverride;
6
7
  }
@@ -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
  }());
@@ -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 URL(request.url) });
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 URL(urlToSign),
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 URL("https://cognito-identity.".concat(region, ".").concat((0, clients_1.getDnsSuffix)(region))),
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 URL("https://pinpoint.".concat(region, ".").concat((0, endpoints_1.getDnsSuffix)(region))),
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 URL(endpoint.url);
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 URL(endpoint.url);
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 URL(endpoint.url);
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 };
@@ -1,4 +1,3 @@
1
- import './polyfills';
2
1
  export { signRequest } from './signRequest';
3
2
  export { presignUrl } from './presignUrl';
4
3
  export { TOKEN_QUERY_PARAM } from './constants';
@@ -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 URL(url);
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);