@aws-amplify/core 6.0.1-api-v6-models.8035dfc.0 → 6.0.1-api-v6-models.572a7b5.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
@@ -41,6 +41,7 @@ var __read = (this && this.__read) || function (o, n) {
41
41
  import { ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, EXPIRES_QUERY_PARAM, HOST_HEADER, SHA256_ALGORITHM_IDENTIFIER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_QUERY_PARAM, } from './constants';
42
42
  import { getSigningValues } from './utils/getSigningValues';
43
43
  import { getSignature } from './utils/getSignature';
44
+ import { AmplifyUrl } from '../../../../../utils/amplifyUrl';
44
45
  /**
45
46
  * Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
46
47
  *
@@ -56,7 +57,7 @@ export var presignUrl = function (_a, _b) {
56
57
  var accessKeyId = signingValues.accessKeyId, credentialScope = signingValues.credentialScope, longDate = signingValues.longDate, sessionToken = signingValues.sessionToken;
57
58
  // create the request to sign
58
59
  // @ts-ignore URL constructor accepts a URL object
59
- var presignedUrl = new URL(url);
60
+ var presignedUrl = new AmplifyUrl(url);
60
61
  Object.entries(__assign(__assign((_c = {}, _c[ALGORITHM_QUERY_PARAM] = SHA256_ALGORITHM_IDENTIFIER, _c[CREDENTIAL_QUERY_PARAM] = "".concat(accessKeyId, "/").concat(credentialScope), _c[AMZ_DATE_QUERY_PARAM] = longDate, _c[SIGNED_HEADERS_QUERY_PARAM] = HOST_HEADER, _c), (expiration && (_d = {}, _d[EXPIRES_QUERY_PARAM] = expiration.toString(), _d))), (sessionToken && (_e = {}, _e[TOKEN_QUERY_PARAM] = sessionToken, _e)))).forEach(function (_a) {
61
62
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
62
63
  presignedUrl.searchParams.append(key, value);
@@ -0,0 +1,2 @@
1
+ import { AmplifyErrorCode, AssertionFunction } from '../types';
2
+ export declare const assert: AssertionFunction<AmplifyErrorCode>;
@@ -0,0 +1,17 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var _a;
4
+ import { createAssertionFunction } from './createAssertionFunction';
5
+ import { AmplifyErrorCode } from '../types';
6
+ var amplifyErrorMap = (_a = {},
7
+ _a[AmplifyErrorCode.NoEndpointId] = {
8
+ message: 'Endpoint ID was not found and was unable to be created.',
9
+ },
10
+ _a[AmplifyErrorCode.PlatformNotSupported] = {
11
+ message: 'Function not supported on current platform.',
12
+ },
13
+ _a[AmplifyErrorCode.Unknown] = {
14
+ message: 'An unknown error occurred.',
15
+ },
16
+ _a);
17
+ export var assert = createAssertionFunction(amplifyErrorMap);
@@ -1,3 +1,4 @@
1
1
  export { AmplifyError } from './AmplifyError';
2
2
  export { createAssertionFunction } from './createAssertionFunction';
3
3
  export { PlatformNotSupportedError } from './PlatformNotSupportedError';
4
+ export { assert } from './errorHelpers';
@@ -3,3 +3,4 @@
3
3
  export { AmplifyError } from './AmplifyError';
4
4
  export { createAssertionFunction } from './createAssertionFunction';
5
5
  export { PlatformNotSupportedError } from './PlatformNotSupportedError';
6
+ export { assert } from './errorHelpers';
@@ -7,8 +7,8 @@ export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCr
7
7
  export { UserProfile } from './types';
8
8
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
9
9
  export { KeyValueStorageInterface } from './types';
10
- import { BrowserStorageCache } from './Cache/BrowserStorageCache';
11
- export { InMemoryCache } from './Cache/InMemoryCache';
12
- export { BrowserStorageCache };
13
- export { BrowserStorageCache as Cache };
10
+ export { Cache } from './Cache';
11
+ export { CacheConfig } from './Cache/types';
14
12
  export { I18n } from './I18n';
13
+ export { ConsoleLogger } from './Logger';
14
+ export { ServiceWorker } from './ServiceWorker';
package/lib-esm/index.js CHANGED
@@ -11,9 +11,10 @@ export { getCredentialsForIdentity, getId, } from './awsClients/cognitoIdentity'
11
11
  // Storage helpers
12
12
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
13
13
  // Cache exports
14
- import { BrowserStorageCache } from './Cache/BrowserStorageCache';
15
- export { InMemoryCache } from './Cache/InMemoryCache';
16
- export { BrowserStorageCache };
17
- export { BrowserStorageCache as Cache }; // Maintain interoperability with React Native
14
+ export { Cache } from './Cache';
18
15
  // Internationalization utilities
19
16
  export { I18n } from './I18n';
17
+ // Logging utilities
18
+ export { ConsoleLogger } from './Logger';
19
+ // Service worker
20
+ export { ServiceWorker } from './ServiceWorker';
@@ -1,25 +1,26 @@
1
1
  export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
2
2
  export { parseAWSExports } from './parseAWSExports';
3
3
  export { LegacyConfig } from './singleton/types';
4
+ export { amplifyUuid } from './utils/amplifyUuid';
5
+ export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
4
6
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
5
7
  export { isTokenExpired } from './singleton/Auth';
6
8
  export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
7
9
  export { Signer } from './Signer';
8
- export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, } from './singleton/Auth/types';
9
- export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
10
- export { ClientDevice } from './ClientDevice';
10
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials, } from './singleton/Auth/types';
11
11
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
12
- export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
12
+ export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, StorageUserAgentInput, AuthUserAgentInput, InAppMessagingUserAgentInput, GeoUserAgentInput, } from './Platform/types';
13
13
  export { setCustomUserAgent } from './Platform/customUserAgent';
14
- export { ServiceWorker } from './ServiceWorker';
14
+ export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
15
+ export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
15
16
  export { BackgroundProcessManager } from './BackgroundProcessManager';
16
17
  export { Mutex } from './Mutex';
17
18
  export { Reachability } from './Reachability';
18
- export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
19
- export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
20
19
  export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
21
20
  export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
22
21
  export { AMPLIFY_SYMBOL } from './Hub';
23
22
  export { base64Decoder, base64Encoder } from './utils/convert';
24
23
  export { getCrypto } from './utils/globalHelpers';
25
24
  export { HubInternal } from './Hub';
25
+ export { sessionListener } from './utils/sessionListener';
26
+ export { SessionState } from './utils/sessionListener/types';
@@ -7,25 +7,23 @@ utils for use throughout the library.
7
7
  // Core utilities
8
8
  export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
9
9
  export { parseAWSExports } from './parseAWSExports';
10
+ export { amplifyUuid } from './utils/amplifyUuid';
11
+ export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
10
12
  // Auth utilities
11
13
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
12
14
  export { isTokenExpired } from './singleton/Auth';
13
15
  export { Signer } from './Signer';
14
- // Logging utilities
15
- export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
16
16
  // Platform & user-agent utilities
17
- export { ClientDevice } from './ClientDevice';
18
17
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
19
18
  export { ApiAction, AuthAction, AnalyticsAction, Category, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
20
19
  export { setCustomUserAgent } from './Platform/customUserAgent';
21
- // Service worker
22
- export { ServiceWorker } from './ServiceWorker';
20
+ // Error handling
21
+ export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
22
+ export { AmplifyErrorCode, } from './types';
23
23
  // Other utilities & constants
24
24
  export { BackgroundProcessManager } from './BackgroundProcessManager';
25
25
  export { Mutex } from './Mutex';
26
26
  export { Reachability } from './Reachability';
27
- export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
28
- export { AmplifyErrorCode, } from './types';
29
27
  export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
30
28
  export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
31
29
  export { AMPLIFY_SYMBOL } from './Hub';
@@ -33,3 +31,5 @@ export { base64Decoder, base64Encoder } from './utils/convert';
33
31
  export { getCrypto } from './utils/globalHelpers';
34
32
  // Hub
35
33
  export { HubInternal } from './Hub';
34
+ // Session listener
35
+ export { sessionListener } from './utils/sessionListener';
@@ -55,9 +55,9 @@ var authTypeMapping = {
55
55
  * @returns A {@link ResourcesConfig} object.
56
56
  */
57
57
  export var parseAWSExports = function (config) {
58
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
59
59
  if (config === void 0) { config = {}; }
60
- var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications, modelIntrospection = config.modelIntrospection;
60
+ var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_bots = config.aws_bots, aws_bots_config = config.aws_bots_config, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications, modelIntrospection = config.modelIntrospection;
61
61
  var amplifyConfig = {};
62
62
  // Analytics
63
63
  if (aws_mobile_analytics_app_id) {
@@ -69,18 +69,33 @@ export var parseAWSExports = function (config) {
69
69
  };
70
70
  }
71
71
  // Notifications
72
- if (Notifications) {
73
- if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
74
- var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
75
- amplifyConfig.Notifications = {
76
- InAppMessaging: {
77
- Pinpoint: {
78
- appId: appId,
79
- region: region,
80
- },
72
+ var _o = Notifications !== null && Notifications !== void 0 ? Notifications : {}, InAppMessaging = _o.InAppMessaging, Push = _o.Push;
73
+ if ((InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) || (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint)) {
74
+ amplifyConfig.Notifications = {};
75
+ if (InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) {
76
+ var _p = InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
77
+ amplifyConfig.Notifications.InAppMessaging = {
78
+ Pinpoint: {
79
+ appId: appId,
80
+ region: region,
81
81
  },
82
82
  };
83
83
  }
84
+ if (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint) {
85
+ var _q = Push.AWSPinpoint, appId = _q.appId, region = _q.region;
86
+ amplifyConfig.Notifications.PushNotification = {
87
+ Pinpoint: {
88
+ appId: appId,
89
+ region: region,
90
+ },
91
+ };
92
+ }
93
+ }
94
+ // Interactions
95
+ if (Array.isArray(aws_bots_config)) {
96
+ amplifyConfig.Interactions = {
97
+ LexV1: Object.fromEntries(aws_bots_config.map(function (bot) { return [bot.name, bot]; })),
98
+ };
84
99
  }
85
100
  // API
86
101
  if (aws_appsync_graphqlEndpoint) {
@@ -105,17 +120,17 @@ export var parseAWSExports = function (config) {
105
120
  ? {
106
121
  status: aws_cognito_mfa_configuration &&
107
122
  aws_cognito_mfa_configuration.toLowerCase(),
108
- totpEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _b !== void 0 ? _b : false,
109
- smsEnabled: (_c = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _c !== void 0 ? _c : false,
123
+ totpEnabled: (_a = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _a !== void 0 ? _a : false,
124
+ smsEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _b !== void 0 ? _b : false,
110
125
  }
111
126
  : undefined;
112
127
  var passwordFormatConfig = aws_cognito_password_protection_settings
113
128
  ? {
114
129
  minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
115
- requireLowercase: (_e = (_d = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _d === void 0 ? void 0 : _d.includes('REQUIRES_LOWERCASE')) !== null && _e !== void 0 ? _e : false,
116
- requireUppercase: (_g = (_f = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _f === void 0 ? void 0 : _f.includes('REQUIRES_UPPERCASE')) !== null && _g !== void 0 ? _g : false,
117
- requireNumbers: (_j = (_h = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _h === void 0 ? void 0 : _h.includes('REQUIRES_NUMBERS')) !== null && _j !== void 0 ? _j : false,
118
- requireSpecialCharacters: (_l = (_k = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _k === void 0 ? void 0 : _k.includes('REQUIRES_SYMBOLS')) !== null && _l !== void 0 ? _l : false,
130
+ requireLowercase: (_d = (_c = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _c === void 0 ? void 0 : _c.includes('REQUIRES_LOWERCASE')) !== null && _d !== void 0 ? _d : false,
131
+ requireUppercase: (_f = (_e = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _e === void 0 ? void 0 : _e.includes('REQUIRES_UPPERCASE')) !== null && _f !== void 0 ? _f : false,
132
+ requireNumbers: (_h = (_g = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _g === void 0 ? void 0 : _g.includes('REQUIRES_NUMBERS')) !== null && _h !== void 0 ? _h : false,
133
+ requireSpecialCharacters: (_k = (_j = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _j === void 0 ? void 0 : _j.includes('REQUIRES_SYMBOLS')) !== null && _k !== void 0 ? _k : false,
119
134
  }
120
135
  : undefined;
121
136
  var mergedUserAttributes = Array.from(new Set(__spreadArray(__spreadArray([], __read((aws_cognito_verification_mechanisms !== null && aws_cognito_verification_mechanisms !== void 0 ? aws_cognito_verification_mechanisms : [])), false), __read((aws_cognito_signup_attributes !== null && aws_cognito_signup_attributes !== void 0 ? aws_cognito_signup_attributes : [])), false)));
@@ -127,8 +142,8 @@ export var parseAWSExports = function (config) {
127
142
  },
128
143
  _a);
129
144
  });
130
- var loginWithEmailEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _m !== void 0 ? _m : false;
131
- var loginWithPhoneEnabled = (_o = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _o !== void 0 ? _o : false;
145
+ var loginWithEmailEnabled = (_l = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _l !== void 0 ? _l : false;
146
+ var loginWithPhoneEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _m !== void 0 ? _m : false;
132
147
  if (aws_cognito_identity_pool_id || aws_user_pools_id) {
133
148
  amplifyConfig.Auth = {
134
149
  Cognito: {
@@ -1,2 +1,2 @@
1
- import { Credentials } from '@aws-sdk/types';
2
- export declare const flushEvents: (appId: string, region: string, credentials: Credentials, identityId?: string, userAgentValue?: string) => void;
1
+ import { AWSCredentials } from '../../../libraryUtils';
2
+ export declare const flushEvents: (appId: string, region: string, credentials: AWSCredentials, identityId?: string, userAgentValue?: string) => void;
@@ -2,4 +2,4 @@ import { PinpointRecordInput } from '../types';
2
2
  /**
3
3
  * @internal
4
4
  */
5
- export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
5
+ export declare const record: ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
@@ -36,29 +36,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
37
  }
38
38
  };
39
- import { v4 as uuid } from 'uuid';
40
- import { getEndpointId } from '../utils';
39
+ import { amplifyUuid } from '../../../utils/amplifyUuid';
40
+ import { resolveEndpointId } from '../utils';
41
41
  import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';
42
- import { updateEndpoint } from './updateEndpoint';
43
42
  import { getEventBuffer } from '../utils/getEventBuffer';
44
- import { AmplifyError } from '../../../errors';
45
43
  // TODO(v6) Refactor when we add support for session tracking & `autoTrack`
46
44
  var session;
47
45
  /**
48
46
  * @internal
49
47
  */
50
48
  export var record = function (_a) {
51
- var appId = _a.appId, category = _a.category, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
49
+ var appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
52
50
  return __awaiter(void 0, void 0, void 0, function () {
53
- var timestampISOString, eventId, endpointId, buffer, sessionId;
51
+ var timestampISOString, eventId, buffer, endpointId, sessionId;
54
52
  return __generator(this, function (_b) {
55
53
  switch (_b.label) {
56
54
  case 0:
57
55
  timestampISOString = new Date().toISOString();
58
- eventId = uuid();
59
- return [4 /*yield*/, getEndpointId(appId, category)];
60
- case 1:
61
- endpointId = _b.sent();
56
+ eventId = amplifyUuid();
62
57
  buffer = getEventBuffer({
63
58
  appId: appId,
64
59
  bufferSize: BUFFER_SIZE,
@@ -70,31 +65,20 @@ export var record = function (_a) {
70
65
  resendLimit: RESEND_LIMIT,
71
66
  userAgentValue: userAgentValue,
72
67
  });
73
- if (!!endpointId) return [3 /*break*/, 4];
74
- return [4 /*yield*/, updateEndpoint({
68
+ return [4 /*yield*/, resolveEndpointId({
75
69
  appId: appId,
76
70
  category: category,
71
+ channelType: channelType,
77
72
  credentials: credentials,
78
73
  identityId: identityId,
79
74
  region: region,
80
75
  userAgentValue: userAgentValue,
81
76
  })];
82
- case 2:
83
- _b.sent();
84
- return [4 /*yield*/, getEndpointId(appId, category)];
85
- case 3:
77
+ case 1:
86
78
  endpointId = _b.sent();
87
- _b.label = 4;
88
- case 4:
89
- if (!endpointId) {
90
- throw new AmplifyError({
91
- name: 'ENDPOINT_NOT_CREATED',
92
- message: 'Endpoint was not created.',
93
- });
94
- }
95
79
  // Generate session if required
96
80
  if (!session) {
97
- sessionId = uuid();
81
+ sessionId = amplifyUuid();
98
82
  session = {
99
83
  Id: sessionId,
100
84
  StartTimestamp: timestampISOString,
@@ -47,8 +47,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
48
  }
49
49
  };
50
- import { v4 as uuidv4 } from 'uuid';
51
- import { ClientDevice } from '../../../ClientDevice';
50
+ import { amplifyUuid } from '../../../utils/amplifyUuid';
51
+ import { getClientInfo } from '../../../utils/getClientInfo';
52
52
  import { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';
53
53
  import { cacheEndpointId, getEndpointId } from '../utils';
54
54
  /**
@@ -63,9 +63,9 @@ export var updateEndpoint = function (_a) {
63
63
  case 0: return [4 /*yield*/, getEndpointId(appId, category)];
64
64
  case 1:
65
65
  endpointId = _c.sent();
66
- createdEndpointId = !endpointId ? uuidv4() : undefined;
66
+ createdEndpointId = !endpointId ? amplifyUuid() : undefined;
67
67
  _b = userProfile !== null && userProfile !== void 0 ? userProfile : {}, customProperties = _b.customProperties, demographic = _b.demographic, email = _b.email, location = _b.location, metrics = _b.metrics, name = _b.name, plan = _b.plan;
68
- clientInfo = ClientDevice.clientInfo();
68
+ clientInfo = getClientInfo();
69
69
  mergedDemographic = __assign({ appVersion: clientInfo.appVersion, make: clientInfo.make, model: clientInfo.model, modelVersion: clientInfo.version, platform: clientInfo.platform }, demographic);
70
70
  shouldAddAttributes = email || customProperties || name || plan;
71
71
  attributes = __assign(__assign(__assign(__assign({}, (email && { email: [email] })), (name && { name: [name] })), (plan && { plan: [plan] })), customProperties);
@@ -73,7 +73,7 @@ export var updateEndpoint = function (_a) {
73
73
  ApplicationId: appId,
74
74
  EndpointId: endpointId !== null && endpointId !== void 0 ? endpointId : createdEndpointId,
75
75
  EndpointRequest: {
76
- RequestId: uuidv4(),
76
+ RequestId: amplifyUuid(),
77
77
  EffectiveDate: new Date().toISOString(),
78
78
  ChannelType: channelType,
79
79
  Address: address,
@@ -109,7 +109,7 @@ export var updateEndpoint = function (_a) {
109
109
  _c.sent();
110
110
  // if we had to create an endpoint id, we need to now cache it
111
111
  if (!!createdEndpointId) {
112
- cacheEndpointId(appId, category, createdEndpointId);
112
+ return [2 /*return*/, cacheEndpointId(appId, category, createdEndpointId)];
113
113
  }
114
114
  return [2 /*return*/];
115
115
  }
@@ -1,3 +1,3 @@
1
1
  export * from './apis';
2
- export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
3
- export { getEndpointId } from './utils';
2
+ export { PinpointAnalyticsEvent, PinpointServiceOptions, UpdateEndpointException, } from './types';
3
+ export { resolveEndpointId } from './utils';
@@ -1,4 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  export * from './apis';
4
- export { getEndpointId } from './utils';
4
+ export { UpdateEndpointException, } from './types';
5
+ export { resolveEndpointId } from './utils';
@@ -0,0 +1,9 @@
1
+ export declare enum UpdateEndpointException {
2
+ BadRequestException = "BadRequestException",
3
+ ForbiddenException = "ForbiddenException",
4
+ InternalServerErrorException = "InternalServerErrorException",
5
+ MethodNotAllowedException = "MethodNotAllowedException",
6
+ NotFoundException = "NotFoundException",
7
+ PayloadTooLargeException = "PayloadTooLargeException",
8
+ TooManyRequestsException = "TooManyRequestsException"
9
+ }
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var UpdateEndpointException;
4
+ (function (UpdateEndpointException) {
5
+ UpdateEndpointException["BadRequestException"] = "BadRequestException";
6
+ UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
7
+ UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
8
+ UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
9
+ UpdateEndpointException["NotFoundException"] = "NotFoundException";
10
+ UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
11
+ UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
12
+ })(UpdateEndpointException || (UpdateEndpointException = {}));
@@ -1 +1,2 @@
1
+ export { UpdateEndpointException } from './errors';
1
2
  export * from './pinpoint';
@@ -1,3 +1,4 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export { UpdateEndpointException } from './errors';
3
4
  export * from './pinpoint';
@@ -1,7 +1,7 @@
1
1
  import { AuthSession } from '../../../singleton/Auth/types';
2
2
  import { UserProfile } from '../../../types';
3
- export type SupportedCategory = 'Analytics' | 'InAppMessaging' | 'PushNotification';
4
- export type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
3
+ export type SupportedCategory = 'Analytics' | 'Core' | 'InAppMessaging' | 'PushNotification';
4
+ type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
5
5
  export type PinpointProviderConfig = {
6
6
  Pinpoint?: {
7
7
  appId: string;
@@ -25,13 +25,13 @@ export type PinpointAnalyticsEvent = {
25
25
  type PinpointCommonParameters = {
26
26
  appId: string;
27
27
  category: SupportedCategory;
28
+ channelType?: SupportedChannelType;
28
29
  credentials: Required<AuthSession>['credentials'];
29
30
  identityId?: AuthSession['identityId'];
30
31
  region: string;
31
32
  userAgentValue?: string;
32
33
  };
33
34
  export type PinpointUpdateEndpointInput = PinpointCommonParameters & PinpointServiceOptions & {
34
- channelType?: SupportedChannelType;
35
35
  userId?: string;
36
36
  userProfile?: UserProfile;
37
37
  };
@@ -1,3 +1,4 @@
1
1
  export { cacheEndpointId } from './cacheEndpointId';
2
2
  export { getCacheKey } from './getCacheKey';
3
3
  export { getEndpointId } from './getEndpointId';
4
+ export { resolveEndpointId } from './resolveEndpointId';
@@ -3,3 +3,4 @@
3
3
  export { cacheEndpointId } from './cacheEndpointId';
4
4
  export { getCacheKey } from './getCacheKey';
5
5
  export { getEndpointId } from './getEndpointId';
6
+ export { resolveEndpointId } from './resolveEndpointId';
@@ -0,0 +1,8 @@
1
+ import { PinpointUpdateEndpointInput } from '../types';
2
+ /**
3
+ * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
4
+ * which will generate and cache an endpoint id between calls.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const resolveEndpointId: ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }: PinpointUpdateEndpointInput) => Promise<string>;
@@ -0,0 +1,81 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
+ };
39
+ import { assert } from '../../../errors';
40
+ import { AmplifyErrorCode } from '../../../types';
41
+ import { updateEndpoint } from '../apis';
42
+ import { getEndpointId } from './getEndpointId';
43
+ /**
44
+ * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
45
+ * which will generate and cache an endpoint id between calls.
46
+ *
47
+ * @internal
48
+ */
49
+ export var resolveEndpointId = function (_a) {
50
+ var address = _a.address, appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
51
+ return __awaiter(void 0, void 0, void 0, function () {
52
+ var endpointId;
53
+ return __generator(this, function (_b) {
54
+ switch (_b.label) {
55
+ case 0: return [4 /*yield*/, getEndpointId(appId, category)];
56
+ case 1:
57
+ endpointId = _b.sent();
58
+ if (!!endpointId) return [3 /*break*/, 4];
59
+ return [4 /*yield*/, updateEndpoint({
60
+ address: address,
61
+ appId: appId,
62
+ category: category,
63
+ channelType: channelType,
64
+ credentials: credentials,
65
+ identityId: identityId,
66
+ region: region,
67
+ userAgentValue: userAgentValue,
68
+ })];
69
+ case 2:
70
+ _b.sent();
71
+ return [4 /*yield*/, getEndpointId(appId, category)];
72
+ case 3:
73
+ endpointId = _b.sent();
74
+ _b.label = 4;
75
+ case 4:
76
+ assert(!!endpointId, AmplifyErrorCode.NoEndpointId);
77
+ return [2 /*return*/, endpointId];
78
+ }
79
+ });
80
+ });
81
+ };
@@ -23,9 +23,9 @@ export declare class AmplifyClass {
23
23
  /**
24
24
  * Provides access to the current back-end resource configuration for the Library.
25
25
  *
26
- * @returns Returns the current back-end resource configuration.
26
+ * @returns Returns the immutable back-end resource configuration.
27
27
  */
28
- getConfig(): ResourcesConfig;
28
+ getConfig(): Readonly<ResourcesConfig>;
29
29
  }
30
30
  /**
31
31
  * The `Amplify` utility is used to configure the library.
@@ -25,13 +25,12 @@ var __values = (this && this.__values) || function(o) {
25
25
  import { AuthClass } from './Auth';
26
26
  import { Hub, AMPLIFY_SYMBOL } from '../Hub';
27
27
  import { parseAWSExports } from '../parseAWSExports';
28
- // TODO(v6): add default AuthTokenStore for each platform
28
+ import { deepFreeze } from '../utils';
29
29
  var AmplifyClass = /** @class */ (function () {
30
30
  function AmplifyClass() {
31
31
  this.resourcesConfig = {};
32
- this.Auth = new AuthClass();
33
- // TODO(v6): add default providers for getting started
34
32
  this.libraryOptions = {};
33
+ this.Auth = new AuthClass();
35
34
  }
36
35
  /**
37
36
  * Configures Amplify for use with your back-end resources.
@@ -53,6 +52,8 @@ var AmplifyClass = /** @class */ (function () {
53
52
  }
54
53
  this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
55
54
  this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
55
+ // Make resource config immutable
56
+ this.resourcesConfig = deepFreeze(this.resourcesConfig);
56
57
  this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
57
58
  Hub.dispatch('core', {
58
59
  event: 'configure',
@@ -62,10 +63,10 @@ var AmplifyClass = /** @class */ (function () {
62
63
  /**
63
64
  * Provides access to the current back-end resource configuration for the Library.
64
65
  *
65
- * @returns Returns the current back-end resource configuration.
66
+ * @returns Returns the immutable back-end resource configuration.
66
67
  */
67
68
  AmplifyClass.prototype.getConfig = function () {
68
- return JSON.parse(JSON.stringify(this.resourcesConfig));
69
+ return this.resourcesConfig;
69
70
  };
70
71
  return AmplifyClass;
71
72
  }());