@aws-amplify/core 6.0.1-api-v6-models.8035dfc.0 → 6.0.1-api-v6-models.3eb7748.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 (341) 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-esm/Cache/AsyncStorageCache.d.ts → lib/Cache/StorageCacheCommon.d.ts} +124 -99
  6. package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -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/I18n/I18n.js +1 -6
  23. package/lib/Platform/types.d.ts +18 -8
  24. package/lib/Platform/types.js +10 -2
  25. package/lib/Platform/version.d.ts +1 -1
  26. package/lib/Platform/version.js +1 -1
  27. package/lib/Reachability/Reachability.d.ts +1 -0
  28. package/lib/Reachability/Reachability.js +42 -1
  29. package/lib/ServiceWorker/ServiceWorker.js +69 -17
  30. package/lib/ServiceWorker/index.d.ts +0 -12
  31. package/lib/ServiceWorker/index.js +0 -12
  32. package/lib/Signer/Signer.js +3 -2
  33. package/lib/awsClients/cognitoIdentity/base.js +2 -1
  34. package/lib/awsClients/pinpoint/base.js +2 -1
  35. package/lib/awsClients/pinpoint/getInAppMessages.js +2 -1
  36. package/lib/awsClients/pinpoint/putEvents.js +2 -1
  37. package/lib/awsClients/pinpoint/updateEndpoint.js +2 -1
  38. package/lib/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  39. package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  40. package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  41. package/lib/errors/errorHelpers.d.ts +2 -0
  42. package/lib/errors/errorHelpers.js +20 -0
  43. package/lib/errors/index.d.ts +1 -0
  44. package/lib/errors/index.js +3 -1
  45. package/lib/index.d.ts +4 -4
  46. package/lib/index.js +9 -6
  47. package/lib/libraryUtils.d.ts +8 -7
  48. package/lib/libraryUtils.js +17 -17
  49. package/lib/parseAWSExports.js +34 -19
  50. package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  51. package/lib/providers/pinpoint/apis/record.d.ts +1 -1
  52. package/lib/providers/pinpoint/apis/record.js +8 -24
  53. package/lib/providers/pinpoint/apis/updateEndpoint.js +6 -6
  54. package/lib/providers/pinpoint/index.d.ts +2 -2
  55. package/lib/providers/pinpoint/index.js +4 -2
  56. package/lib/providers/pinpoint/types/errors.d.ts +9 -0
  57. package/lib/providers/pinpoint/types/errors.js +15 -0
  58. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  59. package/lib/providers/pinpoint/types/index.js +3 -0
  60. package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -3
  61. package/lib/providers/pinpoint/utils/index.d.ts +1 -0
  62. package/lib/providers/pinpoint/utils/index.js +3 -1
  63. package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  64. package/lib/providers/pinpoint/utils/resolveEndpointId.js +85 -0
  65. package/lib/singleton/Amplify.d.ts +2 -2
  66. package/lib/singleton/Amplify.js +6 -5
  67. package/lib/singleton/Auth/types.d.ts +3 -3
  68. package/lib/singleton/Cache/types.d.ts +18 -0
  69. package/lib/singleton/Cache/types.js +4 -0
  70. package/lib/singleton/Interactions/types.d.ts +21 -0
  71. package/lib/singleton/Interactions/types.js +4 -0
  72. package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
  73. package/lib/singleton/Notifications/PushNotification/types.js +4 -0
  74. package/lib/singleton/Notifications/types.d.ts +3 -1
  75. package/lib/singleton/types.d.ts +3 -3
  76. package/lib/storage/CookieStorage.js +8 -5
  77. package/lib/storage/DefaultStorage.js +1 -1
  78. package/lib/storage/utils.d.ts +1 -1
  79. package/lib/storage/utils.js +3 -3
  80. package/lib/tsconfig.tsbuildinfo +1 -1
  81. package/lib/types/errors.d.ts +1 -0
  82. package/lib/types/errors.js +1 -0
  83. package/lib/utils/amplifyUrl/index.d.ts +13 -0
  84. package/lib/utils/amplifyUrl/index.js +10 -0
  85. package/lib/utils/amplifyUrl/polyfill.d.ts +0 -0
  86. package/lib/utils/amplifyUrl/polyfill.js +4 -0
  87. package/lib/utils/amplifyUrl/polyfill.native.d.ts +1 -0
  88. package/lib/utils/amplifyUuid/index.d.ts +3 -0
  89. package/lib/utils/amplifyUuid/index.js +9 -0
  90. package/lib/utils/amplifyUuid/polyfill.d.ts +0 -0
  91. package/lib/utils/amplifyUuid/polyfill.js +4 -0
  92. package/lib/utils/amplifyUuid/polyfill.native.d.ts +1 -0
  93. package/lib/utils/amplifyUuid/polyfill.native.js +6 -0
  94. package/lib/utils/deepFreeze.d.ts +1 -0
  95. package/lib/utils/deepFreeze.js +38 -0
  96. package/lib/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  97. package/lib/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +4 -4
  98. package/lib/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  99. package/lib/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  100. package/lib/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +4 -4
  101. package/lib/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +6 -18
  102. package/lib/utils/getClientInfo/index.d.ts +1 -0
  103. package/lib/utils/getClientInfo/index.js +7 -0
  104. package/lib/utils/index.d.ts +2 -0
  105. package/lib/utils/index.js +5 -1
  106. package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
  107. package/lib/utils/sessionListener/SessionListener.js +55 -0
  108. package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
  109. package/lib/utils/sessionListener/SessionListener.native.js +54 -0
  110. package/lib/utils/sessionListener/index.d.ts +2 -0
  111. package/lib/utils/sessionListener/index.js +7 -0
  112. package/lib/utils/sessionListener/types.d.ts +6 -0
  113. package/lib/utils/sessionListener/types.js +4 -0
  114. package/lib-esm/Cache/StorageCache.d.ts +14 -31
  115. package/lib-esm/Cache/StorageCache.js +97 -102
  116. package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
  117. package/lib-esm/Cache/StorageCache.native.js +161 -0
  118. package/{lib/Cache/AsyncStorageCache.d.ts → lib-esm/Cache/StorageCacheCommon.d.ts} +124 -99
  119. package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +493 -430
  120. package/lib-esm/Cache/constants.d.ts +6 -0
  121. package/lib-esm/Cache/constants.js +14 -0
  122. package/lib-esm/Cache/index.d.ts +2 -0
  123. package/lib-esm/Cache/index.js +4 -0
  124. package/lib-esm/Cache/types/cache.d.ts +38 -0
  125. package/lib-esm/Cache/types/index.d.ts +1 -1
  126. package/lib-esm/Cache/types/index.js +1 -1
  127. package/lib-esm/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  128. package/lib-esm/Cache/{Utils → utils}/CacheList.js +1 -1
  129. package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
  130. package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
  131. package/lib-esm/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
  132. package/lib-esm/Cache/{Utils → utils}/errorHelpers.js +0 -4
  133. package/lib-esm/Cache/utils/index.d.ts +2 -0
  134. package/lib-esm/Cache/utils/index.js +4 -0
  135. package/lib-esm/I18n/I18n.js +1 -6
  136. package/lib-esm/Platform/types.d.ts +18 -8
  137. package/lib-esm/Platform/types.js +10 -2
  138. package/lib-esm/Platform/version.d.ts +1 -1
  139. package/lib-esm/Platform/version.js +1 -1
  140. package/lib-esm/Reachability/Reachability.d.ts +1 -0
  141. package/lib-esm/Reachability/Reachability.js +43 -2
  142. package/lib-esm/ServiceWorker/ServiceWorker.js +69 -17
  143. package/lib-esm/ServiceWorker/index.d.ts +0 -12
  144. package/lib-esm/ServiceWorker/index.js +0 -12
  145. package/lib-esm/Signer/Signer.js +3 -2
  146. package/lib-esm/awsClients/cognitoIdentity/base.js +2 -1
  147. package/lib-esm/awsClients/pinpoint/base.js +2 -1
  148. package/lib-esm/awsClients/pinpoint/getInAppMessages.js +2 -1
  149. package/lib-esm/awsClients/pinpoint/putEvents.js +2 -1
  150. package/lib-esm/awsClients/pinpoint/updateEndpoint.js +2 -1
  151. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  152. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  153. package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  154. package/lib-esm/errors/errorHelpers.d.ts +2 -0
  155. package/lib-esm/errors/errorHelpers.js +17 -0
  156. package/lib-esm/errors/index.d.ts +1 -0
  157. package/lib-esm/errors/index.js +1 -0
  158. package/lib-esm/index.d.ts +4 -4
  159. package/lib-esm/index.js +5 -4
  160. package/lib-esm/libraryUtils.d.ts +8 -7
  161. package/lib-esm/libraryUtils.js +7 -7
  162. package/lib-esm/parseAWSExports.js +34 -19
  163. package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  164. package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
  165. package/lib-esm/providers/pinpoint/apis/record.js +9 -25
  166. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +6 -6
  167. package/lib-esm/providers/pinpoint/index.d.ts +2 -2
  168. package/lib-esm/providers/pinpoint/index.js +2 -1
  169. package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
  170. package/lib-esm/providers/pinpoint/types/errors.js +12 -0
  171. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  172. package/lib-esm/providers/pinpoint/types/index.js +1 -0
  173. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -3
  174. package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
  175. package/lib-esm/providers/pinpoint/utils/index.js +1 -0
  176. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  177. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
  178. package/lib-esm/singleton/Amplify.d.ts +2 -2
  179. package/lib-esm/singleton/Amplify.js +6 -5
  180. package/lib-esm/singleton/Auth/types.d.ts +3 -3
  181. package/lib-esm/singleton/Cache/types.d.ts +18 -0
  182. package/lib-esm/singleton/Cache/types.js +3 -0
  183. package/lib-esm/singleton/Interactions/types.d.ts +21 -0
  184. package/lib-esm/singleton/Interactions/types.js +3 -0
  185. package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
  186. package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
  187. package/lib-esm/singleton/Notifications/types.d.ts +3 -1
  188. package/lib-esm/singleton/types.d.ts +3 -3
  189. package/lib-esm/storage/CookieStorage.js +5 -5
  190. package/lib-esm/storage/DefaultStorage.js +2 -2
  191. package/lib-esm/storage/utils.d.ts +1 -1
  192. package/lib-esm/storage/utils.js +1 -1
  193. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  194. package/lib-esm/types/errors.d.ts +1 -0
  195. package/lib-esm/types/errors.js +1 -0
  196. package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
  197. package/lib-esm/utils/amplifyUrl/index.js +6 -0
  198. package/lib-esm/utils/amplifyUuid/index.d.ts +3 -0
  199. package/lib-esm/utils/amplifyUuid/index.js +6 -0
  200. package/lib-esm/utils/amplifyUuid/polyfill.native.js +4 -0
  201. package/lib-esm/utils/deepFreeze.d.ts +1 -0
  202. package/lib-esm/utils/deepFreeze.js +34 -0
  203. package/lib-esm/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  204. package/lib-esm/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +2 -2
  205. package/lib-esm/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  206. package/lib-esm/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  207. package/lib-esm/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +2 -2
  208. package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +4 -14
  209. package/lib-esm/utils/getClientInfo/index.d.ts +1 -0
  210. package/lib-esm/utils/getClientInfo/index.js +3 -0
  211. package/lib-esm/utils/index.d.ts +2 -0
  212. package/lib-esm/utils/index.js +2 -0
  213. package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
  214. package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
  215. package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
  216. package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
  217. package/lib-esm/utils/sessionListener/index.d.ts +2 -0
  218. package/lib-esm/utils/sessionListener/index.js +4 -0
  219. package/lib-esm/utils/sessionListener/types.d.ts +6 -0
  220. package/lib-esm/utils/sessionListener/types.js +3 -0
  221. package/package.json +9 -19
  222. package/src/Cache/StorageCache.native.ts +65 -0
  223. package/src/Cache/StorageCache.ts +61 -158
  224. package/src/Cache/StorageCacheCommon.ts +577 -0
  225. package/src/Cache/constants.ts +18 -0
  226. package/src/Cache/index.ts +6 -0
  227. package/src/Cache/types/cache.ts +51 -0
  228. package/src/Cache/types/index.ts +4 -4
  229. package/src/Cache/{Utils → utils}/CacheList.ts +185 -185
  230. package/src/Cache/utils/cacheHelpers.ts +52 -0
  231. package/src/Cache/{Utils → utils}/errorHelpers.ts +0 -4
  232. package/src/Cache/{Utils → utils}/index.ts +4 -5
  233. package/src/I18n/I18n.ts +1 -6
  234. package/src/Platform/types.ts +20 -11
  235. package/src/Platform/version.ts +1 -1
  236. package/src/Reachability/Reachability.ts +22 -2
  237. package/src/ServiceWorker/ServiceWorker.ts +20 -17
  238. package/src/ServiceWorker/index.ts +0 -12
  239. package/src/Signer/Signer.ts +3 -2
  240. package/src/awsClients/cognitoIdentity/base.ts +4 -1
  241. package/src/awsClients/pinpoint/base.ts +2 -1
  242. package/src/awsClients/pinpoint/getInAppMessages.ts +2 -1
  243. package/src/awsClients/pinpoint/putEvents.ts +2 -1
  244. package/src/awsClients/pinpoint/updateEndpoint.ts +2 -1
  245. package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -2
  246. package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
  247. package/src/errors/errorHelpers.ts +20 -0
  248. package/src/errors/index.ts +1 -0
  249. package/src/index.ts +8 -4
  250. package/src/libraryUtils.ts +17 -11
  251. package/src/parseAWSExports.ts +28 -9
  252. package/src/providers/pinpoint/apis/flushEvents.ts +2 -2
  253. package/src/providers/pinpoint/apis/record.ts +14 -28
  254. package/src/providers/pinpoint/apis/updateEndpoint.ts +6 -6
  255. package/src/providers/pinpoint/index.ts +6 -2
  256. package/src/providers/pinpoint/types/errors.ts +12 -0
  257. package/src/providers/pinpoint/types/index.ts +1 -0
  258. package/src/providers/pinpoint/types/pinpoint.ts +3 -2
  259. package/src/providers/pinpoint/utils/index.ts +1 -0
  260. package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
  261. package/src/singleton/Amplify.ts +10 -8
  262. package/src/singleton/Auth/types.ts +3 -3
  263. package/src/singleton/Cache/types.ts +27 -0
  264. package/src/singleton/Interactions/types.ts +29 -0
  265. package/src/singleton/Notifications/PushNotification/types.ts +6 -0
  266. package/src/singleton/Notifications/types.ts +3 -1
  267. package/src/singleton/types.ts +3 -5
  268. package/src/storage/CookieStorage.ts +5 -9
  269. package/src/storage/DefaultStorage.ts +2 -2
  270. package/src/storage/utils.ts +1 -1
  271. package/src/types/errors.ts +1 -0
  272. package/src/utils/amplifyUrl/index.ts +9 -0
  273. package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.ts → utils/amplifyUrl/polyfill.native.ts} +1 -0
  274. package/src/utils/amplifyUuid/index.ts +9 -0
  275. package/src/utils/amplifyUuid/polyfill.native.ts +6 -0
  276. package/src/utils/amplifyUuid/polyfill.ts +4 -0
  277. package/src/utils/deepFreeze.ts +16 -0
  278. package/src/{ClientDevice/android.ts → utils/getClientInfo/getClientInfo.android.ts} +2 -2
  279. package/src/{ClientDevice/ios.ts → utils/getClientInfo/getClientInfo.ios.ts} +3 -3
  280. package/src/{ClientDevice/browser.ts → utils/getClientInfo/getClientInfo.ts} +4 -16
  281. package/src/utils/getClientInfo/index.ts +4 -0
  282. package/src/utils/index.ts +2 -0
  283. package/src/utils/sessionListener/SessionListener.native.ts +70 -0
  284. package/src/utils/sessionListener/SessionListener.ts +74 -0
  285. package/src/utils/sessionListener/index.ts +6 -0
  286. package/src/utils/sessionListener/types.ts +11 -0
  287. package/lib/Amplify.d.ts +0 -29
  288. package/lib/Amplify.js +0 -118
  289. package/lib/Cache/BrowserStorageCache.d.ts +0 -166
  290. package/lib/Cache/BrowserStorageCache.js +0 -456
  291. package/lib/Cache/InMemoryCache.d.ts +0 -129
  292. package/lib/Cache/InMemoryCache.js +0 -342
  293. package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
  294. package/lib/Cache/Utils/CacheUtils.js +0 -86
  295. package/lib/Cache/Utils/index.d.ts +0 -2
  296. package/lib/Cache/Utils/index.js +0 -16
  297. package/lib/Cache/reactnative.d.ts +0 -3
  298. package/lib/Cache/reactnative.js +0 -8
  299. package/lib/Cache/types/Cache.d.ts +0 -55
  300. package/lib/ClientDevice/index.d.ts +0 -23
  301. package/lib/ClientDevice/index.js +0 -18
  302. package/lib/ClientDevice/reactnative.d.ts +0 -7
  303. package/lib/ClientDevice/reactnative.js +0 -24
  304. package/lib-esm/Amplify.d.ts +0 -29
  305. package/lib-esm/Amplify.js +0 -115
  306. package/lib-esm/Cache/BrowserStorageCache.d.ts +0 -166
  307. package/lib-esm/Cache/BrowserStorageCache.js +0 -453
  308. package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
  309. package/lib-esm/Cache/InMemoryCache.js +0 -339
  310. package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
  311. package/lib-esm/Cache/Utils/CacheUtils.js +0 -79
  312. package/lib-esm/Cache/Utils/index.d.ts +0 -2
  313. package/lib-esm/Cache/Utils/index.js +0 -4
  314. package/lib-esm/Cache/reactnative.d.ts +0 -3
  315. package/lib-esm/Cache/reactnative.js +0 -6
  316. package/lib-esm/Cache/types/Cache.d.ts +0 -55
  317. package/lib-esm/ClientDevice/index.d.ts +0 -23
  318. package/lib-esm/ClientDevice/index.js +0 -15
  319. package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
  320. package/lib-esm/ClientDevice/reactnative.js +0 -21
  321. package/src/Amplify.ts +0 -106
  322. package/src/Cache/AsyncStorageCache.ts +0 -495
  323. package/src/Cache/BrowserStorageCache.ts +0 -504
  324. package/src/Cache/CHANGELOG.md +0 -1239
  325. package/src/Cache/InMemoryCache.ts +0 -347
  326. package/src/Cache/Utils/CacheUtils.ts +0 -90
  327. package/src/Cache/reactnative.ts +0 -9
  328. package/src/Cache/types/Cache.ts +0 -75
  329. package/src/ClientDevice/index.ts +0 -14
  330. package/src/ClientDevice/reactnative.ts +0 -18
  331. package/lib/Cache/types/{Cache.js → cache.js} +0 -0
  332. package/lib/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +1 -1
  333. /package/lib-esm/Cache/types/{Cache.js → cache.js} +0 -0
  334. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → utils/amplifyUrl/polyfill.d.ts} +0 -0
  335. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.js → utils/amplifyUrl/polyfill.js} +0 -0
  336. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → utils/amplifyUrl/polyfill.native.d.ts} +0 -0
  337. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +0 -0
  338. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → lib-esm/utils/amplifyUuid/polyfill.d.ts} +0 -0
  339. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.js → lib-esm/utils/amplifyUuid/polyfill.js} +0 -0
  340. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → lib-esm/utils/amplifyUuid/polyfill.native.d.ts} +0 -0
  341. /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,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,2 @@
1
+ import { StorageCache } from './StorageCache';
2
+ export declare const Cache: StorageCache;
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { StorageCache } from './StorageCache';
4
+ export var Cache = new 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';
@@ -1,3 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- export * from './Cache';
3
+ export * from './cache';
@@ -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;
@@ -178,4 +178,4 @@ var CacheList = /** @class */ (function () {
178
178
  };
179
179
  return CacheList;
180
180
  }());
181
- export default CacheList;
181
+ export { 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,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
+ };
@@ -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
  }
@@ -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
  },
@@ -0,0 +1,2 @@
1
+ export { getByteLength, getCurrentSizeKey, getCurrentTime, isInteger, } from './cacheHelpers';
2
+ export { CacheList } from './CacheList';
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { getByteLength, getCurrentSizeKey, getCurrentTime, isInteger, } from './cacheHelpers';
4
+ export { CacheList } from './CacheList';
@@ -12,7 +12,6 @@ var __assign = (this && this.__assign) || function () {
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
14
  import { ConsoleLogger as Logger } from '../Logger';
15
- import { Amplify } from '../singleton';
16
15
  var logger = new Logger('I18n');
17
16
  /**
18
17
  * Language translation utility.
@@ -41,11 +40,7 @@ var I18n = /** @class */ (function () {
41
40
  * Sets the default language from the configuration when required.
42
41
  */
43
42
  I18n.prototype.setDefaultLanguage = function () {
44
- if (!this._lang) {
45
- var i18nConfig = Amplify.getConfig().I18n;
46
- this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
47
- }
48
- // Default to window language if not set in config
43
+ // Default to window language if not set in instance
49
44
  if (!this._lang &&
50
45
  typeof window !== 'undefined' &&
51
46
  window &&
@@ -73,7 +73,14 @@ export declare enum DataStoreAction {
73
73
  GraphQl = "2"
74
74
  }
75
75
  export declare enum GeoAction {
76
- None = "0"
76
+ SearchByText = "0",
77
+ SearchByCoordinates = "1",
78
+ SearchForSuggestions = "2",
79
+ SearchByPlaceId = "3",
80
+ SaveGeofences = "4",
81
+ GetGeofence = "5",
82
+ ListGeofences = "6",
83
+ DeleteGeofences = "7"
77
84
  }
78
85
  export declare enum InAppMessagingAction {
79
86
  SyncMessages = "1",
@@ -92,7 +99,8 @@ export declare enum PubSubAction {
92
99
  Subscribe = "1"
93
100
  }
94
101
  export declare enum PushNotificationAction {
95
- None = "0"
102
+ InitializePushNotifications = "1",
103
+ IdentifyUser = "2"
96
104
  }
97
105
  export declare enum StorageAction {
98
106
  UploadData = "1",
@@ -139,23 +147,25 @@ export type CategoryUserAgentStateMap = Record<string, {
139
147
  }>;
140
148
  export type CustomUserAgentStateMap = Record<string, CategoryUserAgentStateMap>;
141
149
  export type AdditionalDetails = [string, string?][];
142
- type StorageUserAgentInput = {
150
+ export type StorageUserAgentInput = {
143
151
  category: Category.Storage;
144
152
  apis: StorageAction[];
153
+ additionalDetails: AdditionalDetails;
145
154
  };
146
- type AuthUserAgentInput = {
155
+ export type AuthUserAgentInput = {
147
156
  category: Category.Auth;
148
157
  apis: AuthAction[];
158
+ additionalDetails: AdditionalDetails;
149
159
  };
150
- type InAppMessagingUserAgentInput = {
160
+ export type InAppMessagingUserAgentInput = {
151
161
  category: Category.InAppMessaging;
152
162
  apis: InAppMessagingAction[];
163
+ additionalDetails: AdditionalDetails;
153
164
  };
154
- type GeoUserAgentInput = {
165
+ export type GeoUserAgentInput = {
155
166
  category: Category.Geo;
156
167
  apis: GeoAction[];
157
- };
158
- export type SetCustomUserAgentInput = (StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput) & {
159
168
  additionalDetails: AdditionalDetails;
160
169
  };
170
+ export type SetCustomUserAgentInput = StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput;
161
171
  export {};
@@ -85,7 +85,14 @@ export var DataStoreAction;
85
85
  })(DataStoreAction || (DataStoreAction = {}));
86
86
  export var GeoAction;
87
87
  (function (GeoAction) {
88
- GeoAction["None"] = "0";
88
+ GeoAction["SearchByText"] = "0";
89
+ GeoAction["SearchByCoordinates"] = "1";
90
+ GeoAction["SearchForSuggestions"] = "2";
91
+ GeoAction["SearchByPlaceId"] = "3";
92
+ GeoAction["SaveGeofences"] = "4";
93
+ GeoAction["GetGeofence"] = "5";
94
+ GeoAction["ListGeofences"] = "6";
95
+ GeoAction["DeleteGeofences"] = "7";
89
96
  })(GeoAction || (GeoAction = {}));
90
97
  export var InAppMessagingAction;
91
98
  (function (InAppMessagingAction) {
@@ -109,7 +116,8 @@ export var PubSubAction;
109
116
  })(PubSubAction || (PubSubAction = {}));
110
117
  export var PushNotificationAction;
111
118
  (function (PushNotificationAction) {
112
- PushNotificationAction["None"] = "0";
119
+ PushNotificationAction["InitializePushNotifications"] = "1";
120
+ PushNotificationAction["IdentifyUser"] = "2";
113
121
  })(PushNotificationAction || (PushNotificationAction = {}));
114
122
  export var StorageAction;
115
123
  (function (StorageAction) {
@@ -1 +1 @@
1
- export declare const version = "6.0.1-api-v6-models.8035dfc.0+8035dfc";
1
+ export declare const version = "6.0.1-api-v6-models.3eb7748.0+3eb7748";
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export var version = '6.0.1-api-v6-models.8035dfc.0+8035dfc';
2
+ export var version = '6.0.1-api-v6-models.3eb7748.0+3eb7748';
@@ -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,12 +1,28 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { Observable } from 'rxjs';
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
+ };
14
+ import { Observable, from } from 'rxjs';
4
15
  import { isWebWorker } from '../libraryUtils';
5
16
  export var Reachability = /** @class */ (function () {
6
17
  function Reachability() {
7
18
  }
8
19
  Reachability.prototype.networkMonitor = function (_) {
9
- var globalObj = isWebWorker() ? self : window;
20
+ var globalObj = isWebWorker()
21
+ ? self
22
+ : typeof window !== 'undefined' && window;
23
+ if (!globalObj) {
24
+ return from([{ online: true }]);
25
+ }
10
26
  return new Observable(function (observer) {
11
27
  observer.next({ online: globalObj.navigator.onLine });
12
28
  var notifyOnline = function () { return observer.next({ online: true }); };
@@ -21,6 +37,31 @@ export var Reachability = /** @class */ (function () {
21
37
  };
22
38
  });
23
39
  };
40
+ // expose observers to simulate offline mode for integration testing
41
+ Reachability._observerOverride = function (status) {
42
+ var e_1, _a;
43
+ var _loop_1 = function (observer) {
44
+ if (observer.closed) {
45
+ this_1._observers = this_1._observers.filter(function (_observer) { return _observer !== observer; });
46
+ return "continue";
47
+ }
48
+ (observer === null || observer === void 0 ? void 0 : observer.next) && observer.next(status);
49
+ };
50
+ var this_1 = this;
51
+ try {
52
+ for (var _b = __values(this._observers), _c = _b.next(); !_c.done; _c = _b.next()) {
53
+ var observer = _c.value;
54
+ _loop_1(observer);
55
+ }
56
+ }
57
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
58
+ finally {
59
+ try {
60
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
61
+ }
62
+ finally { if (e_1) throw e_1.error; }
63
+ }
64
+ };
24
65
  Reachability._observers = [];
25
66
  return Reachability;
26
67
  }());
@@ -1,10 +1,47 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
3
39
  import { ConsoleLogger as Logger } from '../Logger';
4
40
  import { isBrowser } from '../utils';
5
- import { Amplify } from '../Amplify';
6
41
  import { AmplifyError } from '../errors';
7
42
  import { assert, ServiceWorkerErrorCode } from './errorHelpers';
43
+ import { record } from '../providers/pinpoint';
44
+ import { Amplify, fetchAuthSession } from '../singleton';
8
45
  /**
9
46
  * Provides a means to registering a service worker in the browser
10
47
  * and communicating with it via postMessage events.
@@ -173,19 +210,37 @@ var ServiceWorkerClass = /** @class */ (function () {
173
210
  **/
174
211
  ServiceWorkerClass.prototype._setupListeners = function () {
175
212
  var _this = this;
176
- this.serviceWorker.addEventListener('statechange', function (event) {
177
- var currentState = _this.serviceWorker.state;
178
- _this._logger.debug("ServiceWorker statechange: ".concat(currentState));
179
- Amplify.Analytics;
180
- if (isAmplifyWithAnalytics(Amplify)) {
181
- Amplify.Analytics.record({
182
- name: 'ServiceWorker',
183
- attributes: {
184
- state: currentState,
185
- },
186
- });
187
- }
188
- });
213
+ this.serviceWorker.addEventListener('statechange', function (event) { return __awaiter(_this, void 0, void 0, function () {
214
+ var currentState, _a, appId, region, credentials;
215
+ var _b, _c;
216
+ return __generator(this, function (_d) {
217
+ switch (_d.label) {
218
+ case 0:
219
+ currentState = this.serviceWorker.state;
220
+ this._logger.debug("ServiceWorker statechange: ".concat(currentState));
221
+ _a = (_c = (_b = Amplify.getConfig().Analytics) === null || _b === void 0 ? void 0 : _b.Pinpoint) !== null && _c !== void 0 ? _c : {}, appId = _a.appId, region = _a.region;
222
+ return [4 /*yield*/, fetchAuthSession()];
223
+ case 1:
224
+ credentials = (_d.sent()).credentials;
225
+ if (appId && region && credentials) {
226
+ // Pinpoint is configured, record an event
227
+ record({
228
+ appId: appId,
229
+ region: region,
230
+ category: 'Core',
231
+ credentials: credentials,
232
+ event: {
233
+ name: 'ServiceWorker',
234
+ attributes: {
235
+ state: currentState,
236
+ },
237
+ },
238
+ });
239
+ }
240
+ return [2 /*return*/];
241
+ }
242
+ });
243
+ }); });
189
244
  this.serviceWorker.addEventListener('message', function (event) {
190
245
  _this._logger.debug("ServiceWorker message event: ".concat(event));
191
246
  });
@@ -193,6 +248,3 @@ var ServiceWorkerClass = /** @class */ (function () {
193
248
  return ServiceWorkerClass;
194
249
  }());
195
250
  export { ServiceWorkerClass };
196
- function isAmplifyWithAnalytics(amplify) {
197
- return amplify.Analytics && typeof amplify.Analytics.record === 'function';
198
- }
@@ -1,13 +1 @@
1
- /**
2
- * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
- * the License. A copy of the License is located at
6
- *
7
- * http://aws.amazon.com/apache2.0/
8
- *
9
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
- * and limitations under the License.
12
- */
13
1
  export { ServiceWorkerClass as ServiceWorker } from './ServiceWorker';
@@ -1,15 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
7
- * the License. A copy of the License is located at
8
- *
9
- * http://aws.amazon.com/apache2.0/
10
- *
11
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
13
- * and limitations under the License.
14
- */
15
3
  export { ServiceWorkerClass as ServiceWorker } from './ServiceWorker';
@@ -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 URL(request.url) });
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 URL(urlToSign),
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 URL("https://cognito-identity.".concat(region, ".").concat(getDnsSuffix(region))),
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 URL("https://pinpoint.".concat(region, ".").concat(getDnsSuffix(region))),
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 URL(endpoint.url);
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 URL(endpoint.url);
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 URL(endpoint.url);
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 };
@@ -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';
@@ -1,6 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import './polyfills';
4
3
  // TODO: V6 replace Signer
5
4
  export { signRequest } from './signRequest';
6
5
  export { presignUrl } from './presignUrl';