@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
@@ -19,6 +19,7 @@ import {
19
19
  } from '../../clients/middleware/retry';
20
20
  import { getAmplifyUserAgent } from '../../Platform';
21
21
  import { observeFrameworkChanges } from '../../Platform/detectFramework';
22
+ import { AmplifyUrl } from '../../utils/amplifyUrl';
22
23
 
23
24
  /**
24
25
  * The service name used to sign requests if the API requires authentication.
@@ -29,7 +30,9 @@ const SERVICE_NAME = 'cognito-identity';
29
30
  * The endpoint resolver function that returns the endpoint URL for a given region.
30
31
  */
31
32
  const endpointResolver = ({ region }: EndpointResolverOptions) => ({
32
- url: new URL(`https://cognito-identity.${region}.${getDnsSuffix(region)}`),
33
+ url: new AmplifyUrl(
34
+ `https://cognito-identity.${region}.${getDnsSuffix(region)}`
35
+ ),
33
36
  });
34
37
 
35
38
  /**
@@ -9,6 +9,7 @@ import {
9
9
  import { parseJsonError } from '../../clients/serde/json';
10
10
  import type { EndpointResolverOptions, Headers } from '../../clients/types';
11
11
  import { getAmplifyUserAgent } from '../../Platform';
12
+ import { AmplifyUrl } from '../../utils/amplifyUrl';
12
13
 
13
14
  /**
14
15
  * The service name used to sign requests if the API requires authentication.
@@ -19,7 +20,7 @@ const SERVICE_NAME = 'mobiletargeting';
19
20
  * The endpoint resolver function that returns the endpoint URL for a given region.
20
21
  */
21
22
  const endpointResolver = ({ region }: EndpointResolverOptions) => ({
22
- url: new URL(`https://pinpoint.${region}.${getDnsSuffix(region)}`),
23
+ url: new AmplifyUrl(`https://pinpoint.${region}.${getDnsSuffix(region)}`),
23
24
  });
24
25
 
25
26
  /**
@@ -15,6 +15,7 @@ import type {
15
15
  GetInAppMessagesCommandInput as GetInAppMessagesInput,
16
16
  GetInAppMessagesCommandOutput as GetInAppMessagesOutput,
17
17
  } from './types';
18
+ import { AmplifyUrl } from '../../utils/amplifyUrl';
18
19
 
19
20
  export type { GetInAppMessagesInput, GetInAppMessagesOutput };
20
21
 
@@ -23,7 +24,7 @@ const getInAppMessagesSerializer = (
23
24
  endpoint: Endpoint
24
25
  ): HttpRequest => {
25
26
  const headers = getSharedHeaders();
26
- const url = new URL(endpoint.url);
27
+ const url = new AmplifyUrl(endpoint.url);
27
28
  url.pathname = `v1/apps/${extendedEncodeURIComponent(
28
29
  ApplicationId
29
30
  )}/endpoints/${extendedEncodeURIComponent(EndpointId)}/inappmessages`;
@@ -16,6 +16,7 @@ import type {
16
16
  PutEventsCommandInput as PutEventsInput,
17
17
  PutEventsCommandOutput as PutEventsOutput,
18
18
  } from './types';
19
+ import { AmplifyUrl } from '../../utils/amplifyUrl';
19
20
 
20
21
  export type { PutEventsInput, PutEventsOutput };
21
22
 
@@ -25,7 +26,7 @@ const putEventsSerializer = (
25
26
  ): HttpRequest => {
26
27
  assert(!!ApplicationId, PinpointValidationErrorCode.NoAppId);
27
28
  const headers = getSharedHeaders();
28
- const url = new URL(endpoint.url);
29
+ const url = new AmplifyUrl(endpoint.url);
29
30
  url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/events`;
30
31
  const body = JSON.stringify(EventsRequest ?? {});
31
32
  return { method: 'POST', headers, url, body };
@@ -15,6 +15,7 @@ import type {
15
15
  UpdateEndpointCommandInput as UpdateEndpointInput,
16
16
  UpdateEndpointCommandOutput as UpdateEndpointOutput,
17
17
  } from './types';
18
+ import { AmplifyUrl } from '../../utils/amplifyUrl';
18
19
 
19
20
  export type { UpdateEndpointInput, UpdateEndpointOutput };
20
21
 
@@ -23,7 +24,7 @@ const updateEndpointSerializer = (
23
24
  endpoint: Endpoint
24
25
  ): HttpRequest => {
25
26
  const headers = getSharedHeaders();
26
- const url = new URL(endpoint.url);
27
+ const url = new AmplifyUrl(endpoint.url);
27
28
  url.pathname = `v1/apps/${extendedEncodeURIComponent(
28
29
  ApplicationId
29
30
  )}/endpoints/${extendedEncodeURIComponent(EndpointId)}`;
@@ -1,8 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import './polyfills';
5
-
6
4
  // TODO: V6 replace Signer
7
5
  export { signRequest } from './signRequest';
8
6
  export { presignUrl } from './presignUrl';
@@ -15,6 +15,7 @@ import {
15
15
  } from './constants';
16
16
  import { getSigningValues } from './utils/getSigningValues';
17
17
  import { getSignature } from './utils/getSignature';
18
+ import { AmplifyUrl } from '../../../../../utils/amplifyUrl';
18
19
 
19
20
  /**
20
21
  * Given a `Presignable` object, returns a Signature Version 4 presigned `URL` object.
@@ -33,7 +34,7 @@ export const presignUrl = (
33
34
 
34
35
  // create the request to sign
35
36
  // @ts-ignore URL constructor accepts a URL object
36
- const presignedUrl = new URL(url);
37
+ const presignedUrl = new AmplifyUrl(url);
37
38
  Object.entries({
38
39
  [ALGORITHM_QUERY_PARAM]: SHA256_ALGORITHM_IDENTIFIER,
39
40
  [CREDENTIAL_QUERY_PARAM]: `${accessKeyId}/${credentialScope}`,
@@ -0,0 +1,20 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { createAssertionFunction } from './createAssertionFunction';
5
+ import { AmplifyErrorCode, AmplifyErrorMap, AssertionFunction } from '../types';
6
+
7
+ const amplifyErrorMap: AmplifyErrorMap<AmplifyErrorCode> = {
8
+ [AmplifyErrorCode.NoEndpointId]: {
9
+ message: 'Endpoint ID was not found and was unable to be created.',
10
+ },
11
+ [AmplifyErrorCode.PlatformNotSupported]: {
12
+ message: 'Function not supported on current platform.',
13
+ },
14
+ [AmplifyErrorCode.Unknown]: {
15
+ message: 'An unknown error occurred.',
16
+ },
17
+ };
18
+
19
+ export const assert: AssertionFunction<AmplifyErrorCode> =
20
+ createAssertionFunction(amplifyErrorMap);
@@ -4,3 +4,4 @@
4
4
  export { AmplifyError } from './AmplifyError';
5
5
  export { createAssertionFunction } from './createAssertionFunction';
6
6
  export { PlatformNotSupportedError } from './PlatformNotSupportedError';
7
+ export { assert } from './errorHelpers';
package/src/index.ts CHANGED
@@ -60,10 +60,14 @@ export {
60
60
  export { KeyValueStorageInterface } from './types';
61
61
 
62
62
  // Cache exports
63
- import { BrowserStorageCache } from './Cache/BrowserStorageCache';
64
- export { InMemoryCache } from './Cache/InMemoryCache';
65
- export { BrowserStorageCache };
66
- export { BrowserStorageCache as Cache }; // Maintain interoperability with React Native
63
+ export { Cache } from './Cache';
64
+ export { CacheConfig } from './Cache/types';
67
65
 
68
66
  // Internationalization utilities
69
67
  export { I18n } from './I18n';
68
+
69
+ // Logging utilities
70
+ export { ConsoleLogger } from './Logger';
71
+
72
+ // Service worker
73
+ export { ServiceWorker } from './ServiceWorker';
@@ -20,6 +20,8 @@ export {
20
20
  } from './utils';
21
21
  export { parseAWSExports } from './parseAWSExports';
22
22
  export { LegacyConfig } from './singleton/types';
23
+ export { amplifyUuid } from './utils/amplifyUuid';
24
+ export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
23
25
 
24
26
  // Auth utilities
25
27
  export {
@@ -38,13 +40,10 @@ export {
38
40
  JwtPayload,
39
41
  AuthStandardAttributeKey,
40
42
  AuthVerifiableAttributeKey,
43
+ AWSCredentials,
41
44
  } from './singleton/Auth/types';
42
45
 
43
- // Logging utilities
44
- export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
45
-
46
46
  // Platform & user-agent utilities
47
- export { ClientDevice } from './ClientDevice';
48
47
  export {
49
48
  Platform,
50
49
  getAmplifyUserAgentObject,
@@ -66,16 +65,14 @@ export {
66
65
  PushNotificationAction,
67
66
  StorageAction,
68
67
  SetCustomUserAgentInput,
68
+ StorageUserAgentInput,
69
+ AuthUserAgentInput,
70
+ InAppMessagingUserAgentInput,
71
+ GeoUserAgentInput,
69
72
  } from './Platform/types';
70
73
  export { setCustomUserAgent } from './Platform/customUserAgent';
71
74
 
72
- // Service worker
73
- export { ServiceWorker } from './ServiceWorker';
74
-
75
- // Other utilities & constants
76
- export { BackgroundProcessManager } from './BackgroundProcessManager';
77
- export { Mutex } from './Mutex';
78
- export { Reachability } from './Reachability';
75
+ // Error handling
79
76
  export {
80
77
  AmplifyError,
81
78
  PlatformNotSupportedError,
@@ -88,6 +85,11 @@ export {
88
85
  AssertionFunction,
89
86
  ServiceError,
90
87
  } from './types';
88
+
89
+ // Other utilities & constants
90
+ export { BackgroundProcessManager } from './BackgroundProcessManager';
91
+ export { Mutex } from './Mutex';
92
+ export { Reachability } from './Reachability';
91
93
  export {
92
94
  INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER,
93
95
  USER_AGENT_HEADER,
@@ -99,3 +101,7 @@ export { getCrypto } from './utils/globalHelpers';
99
101
 
100
102
  // Hub
101
103
  export { HubInternal } from './Hub';
104
+
105
+ // Session listener
106
+ export { sessionListener } from './utils/sessionListener';
107
+ export { SessionState } from './utils/sessionListener/types';
@@ -6,6 +6,7 @@ import {
6
6
  AuthStandardAttributeKey,
7
7
  AuthConfigUserAttributes,
8
8
  } from './singleton/Auth/types';
9
+
9
10
  import { ResourcesConfig } from './singleton/types';
10
11
 
11
12
  const logger = new Logger('parseAWSExports');
@@ -36,6 +37,8 @@ export const parseAWSExports = (
36
37
  aws_appsync_authenticationType,
37
38
  aws_appsync_graphqlEndpoint,
38
39
  aws_appsync_region,
40
+ aws_bots,
41
+ aws_bots_config,
39
42
  aws_cognito_identity_pool_id,
40
43
  aws_cognito_sign_up_verification_method,
41
44
  aws_cognito_mfa_configuration,
@@ -71,20 +74,36 @@ export const parseAWSExports = (
71
74
  }
72
75
 
73
76
  // Notifications
74
- if (Notifications) {
75
- if (Notifications.InAppMessaging?.AWSPinpoint) {
76
- const { appId, region } = Notifications.InAppMessaging.AWSPinpoint;
77
- amplifyConfig.Notifications = {
78
- InAppMessaging: {
79
- Pinpoint: {
80
- appId,
81
- region,
82
- },
77
+ const { InAppMessaging, Push } = Notifications ?? {};
78
+ if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {
79
+ amplifyConfig.Notifications = {};
80
+ if (InAppMessaging?.AWSPinpoint) {
81
+ const { appId, region } = InAppMessaging.AWSPinpoint;
82
+ amplifyConfig.Notifications.InAppMessaging = {
83
+ Pinpoint: {
84
+ appId,
85
+ region,
86
+ },
87
+ };
88
+ }
89
+ if (Push?.AWSPinpoint) {
90
+ const { appId, region } = Push.AWSPinpoint;
91
+ amplifyConfig.Notifications.PushNotification = {
92
+ Pinpoint: {
93
+ appId,
94
+ region,
83
95
  },
84
96
  };
85
97
  }
86
98
  }
87
99
 
100
+ // Interactions
101
+ if (Array.isArray(aws_bots_config)) {
102
+ amplifyConfig.Interactions = {
103
+ LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),
104
+ };
105
+ }
106
+
88
107
  // API
89
108
  if (aws_appsync_graphqlEndpoint) {
90
109
  const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Credentials } from '@aws-sdk/types';
4
+ import { AWSCredentials } from '../../../libraryUtils';
5
5
  import { getEventBuffer } from '../utils/getEventBuffer';
6
6
  import {
7
7
  BUFFER_SIZE,
@@ -13,7 +13,7 @@ import {
13
13
  export const flushEvents = (
14
14
  appId: string,
15
15
  region: string,
16
- credentials: Credentials,
16
+ credentials: AWSCredentials,
17
17
  identityId?: string,
18
18
  userAgentValue?: string
19
19
  ) => {
@@ -1,18 +1,16 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { v4 as uuid } from 'uuid';
4
+ import { amplifyUuid } from '../../../utils/amplifyUuid';
5
5
  import { PinpointRecordInput, PinpointSession } from '../types';
6
- import { getEndpointId } from '../utils';
6
+ import { resolveEndpointId } from '../utils';
7
7
  import {
8
8
  BUFFER_SIZE,
9
9
  FLUSH_INTERVAL,
10
10
  FLUSH_SIZE,
11
11
  RESEND_LIMIT,
12
12
  } from '../utils/constants';
13
- import { updateEndpoint } from './updateEndpoint';
14
13
  import { getEventBuffer } from '../utils/getEventBuffer';
15
- import { AmplifyError } from '../../../errors';
16
14
 
17
15
  // TODO(v6) Refactor when we add support for session tracking & `autoTrack`
18
16
  let session: PinpointSession;
@@ -23,6 +21,7 @@ let session: PinpointSession;
23
21
  export const record = async ({
24
22
  appId,
25
23
  category,
24
+ channelType,
26
25
  credentials,
27
26
  event,
28
27
  identityId,
@@ -30,8 +29,7 @@ export const record = async ({
30
29
  userAgentValue,
31
30
  }: PinpointRecordInput): Promise<void> => {
32
31
  const timestampISOString = new Date().toISOString();
33
- const eventId = uuid();
34
- let endpointId = await getEndpointId(appId, category);
32
+ const eventId = amplifyUuid();
35
33
 
36
34
  // Prepare event buffer if required
37
35
  const buffer = getEventBuffer({
@@ -46,31 +44,19 @@ export const record = async ({
46
44
  userAgentValue,
47
45
  });
48
46
 
49
- // Prepare a Pinpoint endpoint via updateEndpoint if one does not already exist, which will generate and cache an
50
- // endpoint ID between calls
51
- if (!endpointId) {
52
- await updateEndpoint({
53
- appId,
54
- category,
55
- credentials,
56
- identityId,
57
- region,
58
- userAgentValue,
59
- });
60
-
61
- endpointId = await getEndpointId(appId, category);
62
- }
63
-
64
- if (!endpointId) {
65
- throw new AmplifyError({
66
- name: 'ENDPOINT_NOT_CREATED',
67
- message: 'Endpoint was not created.',
68
- });
69
- }
47
+ const endpointId = await resolveEndpointId({
48
+ appId,
49
+ category,
50
+ channelType,
51
+ credentials,
52
+ identityId,
53
+ region,
54
+ userAgentValue,
55
+ });
70
56
 
71
57
  // Generate session if required
72
58
  if (!session) {
73
- const sessionId = uuid();
59
+ const sessionId = amplifyUuid();
74
60
 
75
61
  session = {
76
62
  Id: sessionId,
@@ -1,8 +1,8 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { v4 as uuidv4 } from 'uuid';
5
- import { ClientDevice } from '../../../ClientDevice';
4
+ import { amplifyUuid } from '../../../utils/amplifyUuid';
5
+ import { getClientInfo } from '../../../utils/getClientInfo';
6
6
  import {
7
7
  updateEndpoint as clientUpdateEndpoint,
8
8
  UpdateEndpointInput,
@@ -29,7 +29,7 @@ export const updateEndpoint = async ({
29
29
  }: PinpointUpdateEndpointInput): Promise<void> => {
30
30
  const endpointId = await getEndpointId(appId, category);
31
31
  // only generate a new endpoint id if one was not found in cache
32
- const createdEndpointId = !endpointId ? uuidv4() : undefined;
32
+ const createdEndpointId = !endpointId ? amplifyUuid() : undefined;
33
33
  const {
34
34
  customProperties,
35
35
  demographic,
@@ -39,7 +39,7 @@ export const updateEndpoint = async ({
39
39
  name,
40
40
  plan,
41
41
  } = userProfile ?? {};
42
- const clientInfo = ClientDevice.clientInfo();
42
+ const clientInfo = getClientInfo();
43
43
  const mergedDemographic = {
44
44
  appVersion: clientInfo.appVersion,
45
45
  make: clientInfo.make,
@@ -59,7 +59,7 @@ export const updateEndpoint = async ({
59
59
  ApplicationId: appId,
60
60
  EndpointId: endpointId ?? createdEndpointId,
61
61
  EndpointRequest: {
62
- RequestId: uuidv4(),
62
+ RequestId: amplifyUuid(),
63
63
  EffectiveDate: new Date().toISOString(),
64
64
  ChannelType: channelType,
65
65
  Address: address,
@@ -93,6 +93,6 @@ export const updateEndpoint = async ({
93
93
  await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);
94
94
  // if we had to create an endpoint id, we need to now cache it
95
95
  if (!!createdEndpointId) {
96
- cacheEndpointId(appId, category, createdEndpointId);
96
+ return cacheEndpointId(appId, category, createdEndpointId);
97
97
  }
98
98
  };
@@ -2,5 +2,9 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export * from './apis';
5
- export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
6
- export { getEndpointId } from './utils';
5
+ export {
6
+ PinpointAnalyticsEvent,
7
+ PinpointServiceOptions,
8
+ UpdateEndpointException,
9
+ } from './types';
10
+ export { resolveEndpointId } from './utils';
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export enum UpdateEndpointException {
5
+ BadRequestException = 'BadRequestException',
6
+ ForbiddenException = 'ForbiddenException',
7
+ InternalServerErrorException = 'InternalServerErrorException',
8
+ MethodNotAllowedException = 'MethodNotAllowedException',
9
+ NotFoundException = 'NotFoundException',
10
+ PayloadTooLargeException = 'PayloadTooLargeException',
11
+ TooManyRequestsException = 'TooManyRequestsException',
12
+ }
@@ -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
 
4
+ export { UpdateEndpointException } from './errors';
4
5
  export * from './pinpoint';
@@ -6,10 +6,11 @@ import { UserProfile } from '../../../types';
6
6
 
7
7
  export type SupportedCategory =
8
8
  | 'Analytics'
9
+ | 'Core'
9
10
  | 'InAppMessaging'
10
11
  | 'PushNotification';
11
12
 
12
- export type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
13
+ type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
13
14
 
14
15
  export type PinpointProviderConfig = {
15
16
  Pinpoint?: {
@@ -39,6 +40,7 @@ export type PinpointAnalyticsEvent = {
39
40
  type PinpointCommonParameters = {
40
41
  appId: string;
41
42
  category: SupportedCategory;
43
+ channelType?: SupportedChannelType;
42
44
  credentials: Required<AuthSession>['credentials'];
43
45
  identityId?: AuthSession['identityId'];
44
46
  region: string;
@@ -47,7 +49,6 @@ type PinpointCommonParameters = {
47
49
 
48
50
  export type PinpointUpdateEndpointInput = PinpointCommonParameters &
49
51
  PinpointServiceOptions & {
50
- channelType?: SupportedChannelType;
51
52
  userId?: string;
52
53
  userProfile?: UserProfile;
53
54
  };
@@ -4,3 +4,4 @@
4
4
  export { cacheEndpointId } from './cacheEndpointId';
5
5
  export { getCacheKey } from './getCacheKey';
6
6
  export { getEndpointId } from './getEndpointId';
7
+ export { resolveEndpointId } from './resolveEndpointId';
@@ -0,0 +1,46 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { assert } from '../../../errors';
5
+ import { AmplifyErrorCode } from '../../../types';
6
+ import { updateEndpoint } from '../apis';
7
+ import { PinpointUpdateEndpointInput } from '../types';
8
+ import { getEndpointId } from './getEndpointId';
9
+
10
+ /**
11
+ * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
12
+ * which will generate and cache an endpoint id between calls.
13
+ *
14
+ * @internal
15
+ */
16
+ export const resolveEndpointId = async ({
17
+ address,
18
+ appId,
19
+ category,
20
+ channelType,
21
+ credentials,
22
+ identityId,
23
+ region,
24
+ userAgentValue,
25
+ }: PinpointUpdateEndpointInput) => {
26
+ let endpointId = await getEndpointId(appId, category);
27
+
28
+ if (!endpointId) {
29
+ await updateEndpoint({
30
+ address,
31
+ appId,
32
+ category,
33
+ channelType,
34
+ credentials,
35
+ identityId,
36
+ region,
37
+ userAgentValue,
38
+ });
39
+
40
+ endpointId = await getEndpointId(appId, category);
41
+ }
42
+
43
+ assert(!!endpointId, AmplifyErrorCode.NoEndpointId);
44
+
45
+ return endpointId;
46
+ };
@@ -4,24 +4,23 @@ import { AuthClass } from './Auth';
4
4
  import { Hub, AMPLIFY_SYMBOL } from '../Hub';
5
5
  import { LegacyConfig, LibraryOptions, ResourcesConfig } from './types';
6
6
  import { parseAWSExports } from '../parseAWSExports';
7
-
8
- // TODO(v6): add default AuthTokenStore for each platform
7
+ import { deepFreeze } from '../utils';
9
8
 
10
9
  export class AmplifyClass {
11
10
  resourcesConfig: ResourcesConfig;
12
11
  libraryOptions: LibraryOptions;
12
+
13
13
  /**
14
14
  * Cross-category Auth utilities.
15
15
  *
16
16
  * @internal
17
17
  */
18
18
  public readonly Auth: AuthClass;
19
+
19
20
  constructor() {
20
21
  this.resourcesConfig = {};
21
- this.Auth = new AuthClass();
22
-
23
- // TODO(v6): add default providers for getting started
24
22
  this.libraryOptions = {};
23
+ this.Auth = new AuthClass();
25
24
  }
26
25
 
27
26
  /**
@@ -55,6 +54,9 @@ export class AmplifyClass {
55
54
  libraryOptions
56
55
  );
57
56
 
57
+ // Make resource config immutable
58
+ this.resourcesConfig = deepFreeze(this.resourcesConfig);
59
+
58
60
  this.Auth.configure(this.resourcesConfig.Auth!, this.libraryOptions.Auth);
59
61
 
60
62
  Hub.dispatch(
@@ -71,10 +73,10 @@ export class AmplifyClass {
71
73
  /**
72
74
  * Provides access to the current back-end resource configuration for the Library.
73
75
  *
74
- * @returns Returns the current back-end resource configuration.
76
+ * @returns Returns the immutable back-end resource configuration.
75
77
  */
76
- getConfig(): ResourcesConfig {
77
- return JSON.parse(JSON.stringify(this.resourcesConfig));
78
+ getConfig(): Readonly<ResourcesConfig> {
79
+ return this.resourcesConfig;
78
80
  }
79
81
  }
80
82
 
@@ -113,12 +113,12 @@ export type AuthIdentityPoolConfig = {
113
113
  Cognito: CognitoIdentityPoolConfig & {
114
114
  userPoolClientId?: never;
115
115
  userPoolId?: never;
116
+ userPoolEndpoint?: never;
116
117
  loginWith?: never;
117
118
  signUpVerificationMethod?: never;
118
119
  userAttributes?: never;
119
120
  mfa?: never;
120
121
  passwordFormat?: never;
121
- endpoint?: never;
122
122
  };
123
123
  };
124
124
 
@@ -137,6 +137,7 @@ export type AuthUserPoolConfig = {
137
137
  export type CognitoUserPoolConfig = {
138
138
  userPoolClientId: string;
139
139
  userPoolId: string;
140
+ userPoolEndpoint?: string;
140
141
  signUpVerificationMethod?: 'code' | 'link';
141
142
  loginWith?: {
142
143
  oauth?: OAuthConfig;
@@ -157,7 +158,6 @@ export type CognitoUserPoolConfig = {
157
158
  requireNumbers?: boolean;
158
159
  requireSpecialCharacters?: boolean;
159
160
  };
160
- endpoint?: string;
161
161
  };
162
162
 
163
163
  export type OAuthConfig = {
@@ -217,7 +217,7 @@ export type AWSCredentialsAndIdentityId = {
217
217
  identityId?: string;
218
218
  };
219
219
 
220
- type AWSCredentials = {
220
+ export type AWSCredentials = {
221
221
  accessKeyId: string;
222
222
  secretAccessKey: string;
223
223
  sessionToken?: string;
@@ -0,0 +1,27 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Cache instance options
6
+ */
7
+ export interface CacheConfig {
8
+ /** Prepend to key to avoid conflicts */
9
+ keyPrefix: string;
10
+
11
+ /** Cache capacity, in bytes */
12
+ capacityInBytes: number;
13
+
14
+ /** Max size of one item */
15
+ itemMaxSize: number;
16
+
17
+ /** Time to live, in milliseconds */
18
+ defaultTTL: number;
19
+
20
+ /** Warn when over threshold percentage of capacity, maximum 1 */
21
+ warningThreshold: number;
22
+
23
+ /** default priority number put on cached items */
24
+ defaultPriority: number;
25
+
26
+ storage?: Storage;
27
+ }