@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,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; } });
package/lib/I18n/I18n.js CHANGED
@@ -15,7 +15,6 @@ var __assign = (this && this.__assign) || function () {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.I18n = void 0;
17
17
  var Logger_1 = require("../Logger");
18
- var singleton_1 = require("../singleton");
19
18
  var logger = new Logger_1.ConsoleLogger('I18n');
20
19
  /**
21
20
  * Language translation utility.
@@ -44,11 +43,7 @@ var I18n = /** @class */ (function () {
44
43
  * Sets the default language from the configuration when required.
45
44
  */
46
45
  I18n.prototype.setDefaultLanguage = function () {
47
- if (!this._lang) {
48
- var i18nConfig = singleton_1.Amplify.getConfig().I18n;
49
- this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
50
- }
51
- // Default to window language if not set in config
46
+ // Default to window language if not set in instance
52
47
  if (!this._lang &&
53
48
  typeof window !== 'undefined' &&
54
49
  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 {};
@@ -88,7 +88,14 @@ var DataStoreAction;
88
88
  })(DataStoreAction = exports.DataStoreAction || (exports.DataStoreAction = {}));
89
89
  var GeoAction;
90
90
  (function (GeoAction) {
91
- GeoAction["None"] = "0";
91
+ GeoAction["SearchByText"] = "0";
92
+ GeoAction["SearchByCoordinates"] = "1";
93
+ GeoAction["SearchForSuggestions"] = "2";
94
+ GeoAction["SearchByPlaceId"] = "3";
95
+ GeoAction["SaveGeofences"] = "4";
96
+ GeoAction["GetGeofence"] = "5";
97
+ GeoAction["ListGeofences"] = "6";
98
+ GeoAction["DeleteGeofences"] = "7";
92
99
  })(GeoAction = exports.GeoAction || (exports.GeoAction = {}));
93
100
  var InAppMessagingAction;
94
101
  (function (InAppMessagingAction) {
@@ -112,7 +119,8 @@ var PubSubAction;
112
119
  })(PubSubAction = exports.PubSubAction || (exports.PubSubAction = {}));
113
120
  var PushNotificationAction;
114
121
  (function (PushNotificationAction) {
115
- PushNotificationAction["None"] = "0";
122
+ PushNotificationAction["InitializePushNotifications"] = "1";
123
+ PushNotificationAction["IdentifyUser"] = "2";
116
124
  })(PushNotificationAction = exports.PushNotificationAction || (exports.PushNotificationAction = {}));
117
125
  var StorageAction;
118
126
  (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";
@@ -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-api-v6-models.8035dfc.0+8035dfc';
5
+ exports.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,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");
@@ -9,7 +20,12 @@ var Reachability = exports.Reachability = /** @class */ (function () {
9
20
  function Reachability() {
10
21
  }
11
22
  Reachability.prototype.networkMonitor = function (_) {
12
- var globalObj = (0, libraryUtils_1.isWebWorker)() ? self : window;
23
+ var globalObj = (0, libraryUtils_1.isWebWorker)()
24
+ ? self
25
+ : typeof window !== 'undefined' && window;
26
+ if (!globalObj) {
27
+ return (0, rxjs_1.from)([{ online: true }]);
28
+ }
13
29
  return new rxjs_1.Observable(function (observer) {
14
30
  observer.next({ online: globalObj.navigator.onLine });
15
31
  var notifyOnline = function () { return observer.next({ online: true }); };
@@ -24,6 +40,31 @@ var Reachability = exports.Reachability = /** @class */ (function () {
24
40
  };
25
41
  });
26
42
  };
43
+ // expose observers to simulate offline mode for integration testing
44
+ Reachability._observerOverride = function (status) {
45
+ var e_1, _a;
46
+ var _loop_1 = function (observer) {
47
+ if (observer.closed) {
48
+ this_1._observers = this_1._observers.filter(function (_observer) { return _observer !== observer; });
49
+ return "continue";
50
+ }
51
+ (observer === null || observer === void 0 ? void 0 : observer.next) && observer.next(status);
52
+ };
53
+ var this_1 = this;
54
+ try {
55
+ for (var _b = __values(this._observers), _c = _b.next(); !_c.done; _c = _b.next()) {
56
+ var observer = _c.value;
57
+ _loop_1(observer);
58
+ }
59
+ }
60
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
61
+ finally {
62
+ try {
63
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
64
+ }
65
+ finally { if (e_1) throw e_1.error; }
66
+ }
67
+ };
27
68
  Reachability._observers = [];
28
69
  return Reachability;
29
70
  }());
@@ -1,13 +1,50 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ var __generator = (this && this.__generator) || function (thisArg, body) {
14
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
15
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
16
+ function verb(n) { return function (v) { return step([n, v]); }; }
17
+ function step(op) {
18
+ if (f) throw new TypeError("Generator is already executing.");
19
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
20
+ 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;
21
+ if (y = 0, t) op = [op[0] & 2, t.value];
22
+ switch (op[0]) {
23
+ case 0: case 1: t = op; break;
24
+ case 4: _.label++; return { value: op[1], done: false };
25
+ case 5: _.label++; y = op[1]; op = [0]; continue;
26
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
27
+ default:
28
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
29
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
30
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
31
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
32
+ if (t[2]) _.ops.pop();
33
+ _.trys.pop(); continue;
34
+ }
35
+ op = body.call(thisArg, _);
36
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
37
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
38
+ }
39
+ };
4
40
  Object.defineProperty(exports, "__esModule", { value: true });
5
41
  exports.ServiceWorkerClass = void 0;
6
42
  var Logger_1 = require("../Logger");
7
43
  var utils_1 = require("../utils");
8
- var Amplify_1 = require("../Amplify");
9
44
  var errors_1 = require("../errors");
10
45
  var errorHelpers_1 = require("./errorHelpers");
46
+ var pinpoint_1 = require("../providers/pinpoint");
47
+ var singleton_1 = require("../singleton");
11
48
  /**
12
49
  * Provides a means to registering a service worker in the browser
13
50
  * and communicating with it via postMessage events.
@@ -176,19 +213,37 @@ var ServiceWorkerClass = /** @class */ (function () {
176
213
  **/
177
214
  ServiceWorkerClass.prototype._setupListeners = function () {
178
215
  var _this = this;
179
- this.serviceWorker.addEventListener('statechange', function (event) {
180
- var currentState = _this.serviceWorker.state;
181
- _this._logger.debug("ServiceWorker statechange: ".concat(currentState));
182
- Amplify_1.Amplify.Analytics;
183
- if (isAmplifyWithAnalytics(Amplify_1.Amplify)) {
184
- Amplify_1.Amplify.Analytics.record({
185
- name: 'ServiceWorker',
186
- attributes: {
187
- state: currentState,
188
- },
189
- });
190
- }
191
- });
216
+ this.serviceWorker.addEventListener('statechange', function (event) { return __awaiter(_this, void 0, void 0, function () {
217
+ var currentState, _a, appId, region, credentials;
218
+ var _b, _c;
219
+ return __generator(this, function (_d) {
220
+ switch (_d.label) {
221
+ case 0:
222
+ currentState = this.serviceWorker.state;
223
+ this._logger.debug("ServiceWorker statechange: ".concat(currentState));
224
+ _a = (_c = (_b = singleton_1.Amplify.getConfig().Analytics) === null || _b === void 0 ? void 0 : _b.Pinpoint) !== null && _c !== void 0 ? _c : {}, appId = _a.appId, region = _a.region;
225
+ return [4 /*yield*/, (0, singleton_1.fetchAuthSession)()];
226
+ case 1:
227
+ credentials = (_d.sent()).credentials;
228
+ if (appId && region && credentials) {
229
+ // Pinpoint is configured, record an event
230
+ (0, pinpoint_1.record)({
231
+ appId: appId,
232
+ region: region,
233
+ category: 'Core',
234
+ credentials: credentials,
235
+ event: {
236
+ name: 'ServiceWorker',
237
+ attributes: {
238
+ state: currentState,
239
+ },
240
+ },
241
+ });
242
+ }
243
+ return [2 /*return*/];
244
+ }
245
+ });
246
+ }); });
192
247
  this.serviceWorker.addEventListener('message', function (event) {
193
248
  _this._logger.debug("ServiceWorker message event: ".concat(event));
194
249
  });
@@ -196,6 +251,3 @@ var ServiceWorkerClass = /** @class */ (function () {
196
251
  return ServiceWorkerClass;
197
252
  }());
198
253
  exports.ServiceWorkerClass = ServiceWorkerClass;
199
- function isAmplifyWithAnalytics(amplify) {
200
- return amplify.Analytics && typeof amplify.Analytics.record === 'function';
201
- }
@@ -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,18 +1,6 @@
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
- /**
5
- * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
8
- * the License. A copy of the License is located at
9
- *
10
- * http://aws.amazon.com/apache2.0/
11
- *
12
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
14
- * and limitations under the License.
15
- */
16
4
  Object.defineProperty(exports, "__esModule", { value: true });
17
5
  exports.ServiceWorker = void 0;
18
6
  var ServiceWorker_1 = require("./ServiceWorker");
@@ -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
  };