@aws-amplify/core 6.0.1-api-v6-models.ce6e561.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
@@ -1,347 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { CacheList, getCurrTime, CacheObject } from './Utils';
5
-
6
- import { StorageCache } from './StorageCache';
7
- import { ICache, CacheConfig, CacheItem, CacheItemOptions } from './types';
8
- import { ConsoleLogger as Logger } from '../Logger';
9
- import { getCurrSizeKey } from './Utils/CacheUtils';
10
- import { assert, CacheErrorCode } from './Utils/errorHelpers';
11
-
12
- const logger = new Logger('InMemoryCache');
13
-
14
- /**
15
- * Customized in-memory cache with LRU implemented
16
- * @member cacheObj - object which store items
17
- * @member cacheList - list of keys in the cache with LRU
18
- * @member curSizeInBytes - current size of the cache
19
- * @member maxPriority - max of the priority
20
- */
21
- export class InMemoryCacheClass extends StorageCache implements ICache {
22
- private cacheList: CacheList[];
23
- private curSizeInBytes: number;
24
- private maxPriority: number;
25
-
26
- /**
27
- * initialize the cache
28
- *
29
- * @param config - the configuration of the cache
30
- */
31
- constructor(config?: CacheConfig) {
32
- super(config);
33
-
34
- this.cacheList = [];
35
- this.curSizeInBytes = 0;
36
- this.maxPriority = 5;
37
-
38
- this.getItem = this.getItem.bind(this);
39
- this.setItem = this.setItem.bind(this);
40
- this.removeItem = this.removeItem.bind(this);
41
-
42
- // initialize list for every priority
43
- for (let i = 0; i < this.maxPriority; i += 1) {
44
- this.cacheList[i] = new CacheList();
45
- }
46
- }
47
-
48
- /**
49
- * decrease current size of the cache
50
- *
51
- * @param amount - the amount of the cache size which needs to be decreased
52
- */
53
- private _decreaseCurSizeInBytes(amount: number): void {
54
- this.curSizeInBytes -= amount;
55
- }
56
-
57
- /**
58
- * increase current size of the cache
59
- *
60
- * @param amount - the amount of the cache szie which need to be increased
61
- */
62
- private _increaseCurSizeInBytes(amount: number): void {
63
- this.curSizeInBytes += amount;
64
- }
65
-
66
- /**
67
- * check whether item is expired
68
- *
69
- * @param key - the key of the item
70
- *
71
- * @return true if the item is expired.
72
- */
73
- private _isExpired(key: string): boolean {
74
- const text: string | null = CacheObject.getItem(key);
75
-
76
- assert(text !== null, CacheErrorCode.NoCacheItem, `Key: ${key}`);
77
- const item: CacheItem = JSON.parse(text);
78
- if (getCurrTime() >= item.expires) {
79
- return true;
80
- }
81
- return false;
82
- }
83
-
84
- /**
85
- * delete item from cache
86
- *
87
- * @param prefixedKey - the key of the item
88
- * @param listIdx - indicates which cache list the key belongs to
89
- */
90
- private _removeItem(prefixedKey: string, listIdx: number): void {
91
- // delete the key from the list
92
- this.cacheList[listIdx].removeItem(prefixedKey);
93
- // decrease the current size of the cache
94
- const item = CacheObject.getItem(prefixedKey);
95
- assert(item !== null, CacheErrorCode.NoCacheItem, `Key: ${prefixedKey}`);
96
- this._decreaseCurSizeInBytes(JSON.parse(item).byteSize);
97
- // finally remove the item from memory
98
- CacheObject.removeItem(prefixedKey);
99
- }
100
-
101
- /**
102
- * put item into cache
103
- *
104
- * @param prefixedKey - the key of the item
105
- * @param itemData - the value of the item
106
- * @param itemSizeInBytes - the byte size of the item
107
- * @param listIdx - indicates which cache list the key belongs to
108
- */
109
- private _setItem(
110
- prefixedKey: string,
111
- item: CacheItem,
112
- listIdx: number
113
- ): void {
114
- // insert the key into the list
115
- this.cacheList[listIdx].insertItem(prefixedKey);
116
- // increase the current size of the cache
117
- this._increaseCurSizeInBytes(item.byteSize);
118
- // finally add the item into memory
119
- CacheObject.setItem(prefixedKey, JSON.stringify(item));
120
- }
121
-
122
- /**
123
- * see whether cache is full
124
- *
125
- * @param itemSize
126
- *
127
- * @return true if cache is full
128
- */
129
- private _isCacheFull(itemSize: number): boolean {
130
- return this.curSizeInBytes + itemSize > this.cacheConfig.capacityInBytes;
131
- }
132
-
133
- /**
134
- * check whether the cache contains the key
135
- *
136
- * @param key
137
- */
138
- private containsKey(key: string): number {
139
- const prefixedKey: string = this.cacheConfig.keyPrefix + key;
140
- for (let i = 0; i < this.maxPriority; i += 1) {
141
- if (this.cacheList[i].containsKey(prefixedKey)) {
142
- return i + 1;
143
- }
144
- }
145
- return -1;
146
- }
147
-
148
- /**
149
- * * Set item into cache. You can put number, string, boolean or object.
150
- * The cache will first check whether has the same key.
151
- * If it has, it will delete the old item and then put the new item in
152
- * The cache will pop out items if it is full
153
- * You can specify the cache item options. The cache will abort and output a warning:
154
- * If the key is invalid
155
- * If the size of the item exceeds itemMaxSize.
156
- * If the value is undefined
157
- * If incorrect cache item configuration
158
- * If error happened with browser storage
159
- *
160
- * @param key - the key of the item
161
- * @param value - the value of the item
162
- * @param options - optional, the specified meta-data
163
- *
164
- * @throws if the item is too big which exceeds the limit of single item size
165
- * @throws if the key is invalid
166
- */
167
- public setItem(
168
- key: string,
169
- value: object | string | number | boolean,
170
- options?: CacheItemOptions
171
- ): void {
172
- const prefixedKey: string = this.cacheConfig.keyPrefix + key;
173
- // invalid keys
174
- if (
175
- prefixedKey === this.cacheConfig.keyPrefix ||
176
- prefixedKey === getCurrSizeKey(this.cacheConfig.keyPrefix)
177
- ) {
178
- logger.warn(`Invalid key: should not be empty or 'CurSize'`);
179
- return;
180
- }
181
-
182
- if (typeof value === 'undefined') {
183
- logger.warn(`The value of item should not be undefined!`);
184
- return;
185
- }
186
-
187
- const cacheItemOptions = {
188
- priority:
189
- options && options.priority !== undefined
190
- ? options.priority
191
- : this.cacheConfig.defaultPriority,
192
- expires:
193
- options && options.expires !== undefined
194
- ? options.expires
195
- : this.cacheConfig.defaultTTL + getCurrTime(),
196
- };
197
-
198
- if (cacheItemOptions.priority < 1 || cacheItemOptions.priority > 5) {
199
- logger.warn(
200
- `Invalid parameter: priority due to out or range. It should be within 1 and 5.`
201
- );
202
- return;
203
- }
204
-
205
- const item: CacheItem = this.fillCacheItem(
206
- prefixedKey,
207
- value,
208
- cacheItemOptions
209
- );
210
-
211
- // check wether this item is too big;
212
- if (item.byteSize > this.cacheConfig.itemMaxSize) {
213
- logger.warn(
214
- `Item with key: ${key} you are trying to put into is too big!`
215
- );
216
- return;
217
- }
218
-
219
- // if key already in the cache, then delete it.
220
- const presentKeyPrio: number = this.containsKey(key);
221
- if (presentKeyPrio !== -1) {
222
- this._removeItem(prefixedKey, presentKeyPrio - 1);
223
- }
224
-
225
- // pop out items in the cache when cache is full based on LRU
226
- // first start from lowest priority cache list
227
- let cacheListIdx = this.maxPriority - 1;
228
- while (this._isCacheFull(item.byteSize) && cacheListIdx >= 0) {
229
- if (!this.cacheList[cacheListIdx].isEmpty()) {
230
- const popedItemKey = this.cacheList[cacheListIdx].getLastItem();
231
- this._removeItem(popedItemKey, cacheListIdx);
232
- } else {
233
- cacheListIdx -= 1;
234
- }
235
- }
236
-
237
- this._setItem(prefixedKey, item, Number(item.priority) - 1);
238
- }
239
-
240
- /**
241
- * Get item from cache. It will return null if item doesn’t exist or it has been expired.
242
- * If you specified callback function in the options,
243
- * then the function will be executed if no such item in the cache
244
- * and finally put the return value into cache.
245
- * Please make sure the callback function will return the value you want to put into the cache.
246
- * The cache will abort output a warning:
247
- * If the key is invalid
248
- *
249
- * @param key - the key of the item
250
- * @param options - the options of callback function
251
- */
252
- public getItem(key: string, options?: CacheItemOptions): any {
253
- let ret: string | null = null;
254
- const prefixedKey: string = this.cacheConfig.keyPrefix + key;
255
-
256
- if (
257
- prefixedKey === this.cacheConfig.keyPrefix ||
258
- prefixedKey === getCurrSizeKey(this.cacheConfig.keyPrefix)
259
- ) {
260
- logger.warn(`Invalid key: should not be empty or 'CurSize'`);
261
- return null;
262
- }
263
-
264
- // check whether it's in the cachelist
265
- const presentKeyPrio: number = this.containsKey(key);
266
- if (presentKeyPrio !== -1) {
267
- if (this._isExpired(prefixedKey)) {
268
- // if expired, remove that item and return null
269
- this._removeItem(prefixedKey, presentKeyPrio - 1);
270
- } else {
271
- // if not expired, great, return the value and refresh it
272
- ret = CacheObject.getItem(prefixedKey) ?? '';
273
- const item: CacheItem = JSON.parse(ret);
274
- this.cacheList[item.priority - 1].refresh(prefixedKey);
275
- return item.data;
276
- }
277
- }
278
-
279
- if (options && options.callback !== undefined) {
280
- const val: object | string | number | boolean = options.callback();
281
- if (val !== null) {
282
- this.setItem(key, val, options);
283
- }
284
- return val;
285
- }
286
- return null;
287
- }
288
-
289
- /**
290
- * remove item from the cache
291
- *
292
- * @param key - the key of the item
293
- */
294
- public removeItem(key: string): void {
295
- const prefixedKey: string = this.cacheConfig.keyPrefix + key;
296
-
297
- // check if the key is in the cache
298
- const presentKeyPrio: number = this.containsKey(key);
299
- if (presentKeyPrio !== -1) {
300
- this._removeItem(prefixedKey, presentKeyPrio - 1);
301
- }
302
- }
303
-
304
- /**
305
- * clear the entire cache
306
- */
307
- public clear(): void {
308
- for (let i = 0; i < this.maxPriority; i += 1) {
309
- for (const key of this.cacheList[i].getKeys()) {
310
- this._removeItem(key, i);
311
- }
312
- }
313
- }
314
-
315
- /**
316
- * Return all the keys in the cache.
317
- */
318
- public getAllKeys(): string[] {
319
- const keys: string[] = [];
320
- for (let i = 0; i < this.maxPriority; i += 1) {
321
- for (const key of this.cacheList[i].getKeys()) {
322
- keys.push(key.substring(this.cacheConfig.keyPrefix.length));
323
- }
324
- }
325
-
326
- return keys;
327
- }
328
-
329
- /**
330
- * return the current size of the cache
331
- *
332
- * @return the current size of the cache
333
- */
334
- public getCacheCurSize(): number {
335
- return this.curSizeInBytes;
336
- }
337
-
338
- /**
339
- * Return a new instance of cache with customized configuration.
340
- * @param config - the customized configuration
341
- */
342
- public createInstance(config: CacheConfig): ICache {
343
- return new InMemoryCacheClass(config);
344
- }
345
- }
346
-
347
- export const InMemoryCache: ICache = new InMemoryCacheClass();
@@ -1,90 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { CacheConfig } from '../types';
5
- import { getDefaultStorageWithFallback } from '../../storage/utils';
6
- /**
7
- * Default cache config
8
- */
9
- export const defaultConfig: CacheConfig = {
10
- keyPrefix: 'aws-amplify-cache',
11
- capacityInBytes: 1048576, // 1MB
12
- itemMaxSize: 210000, // about 200kb
13
- defaultTTL: 259200000, // about 3 days
14
- defaultPriority: 5,
15
- warningThreshold: 0.8,
16
- storage: getDefaultStorageWithFallback(),
17
- };
18
-
19
- /**
20
- * return the byte size of the string
21
- * @param str
22
- */
23
- export function getByteLength(str: string): number {
24
- let ret: number = 0;
25
- ret = str.length;
26
-
27
- for (let i = str.length; i >= 0; i -= 1) {
28
- const charCode: number = str.charCodeAt(i);
29
- if (charCode > 0x7f && charCode <= 0x7ff) {
30
- ret += 1;
31
- } else if (charCode > 0x7ff && charCode <= 0xffff) {
32
- ret += 2;
33
- }
34
- // trail surrogate
35
- if (charCode >= 0xdc00 && charCode <= 0xdfff) {
36
- i -= 1;
37
- }
38
- }
39
-
40
- return ret;
41
- }
42
-
43
- /**
44
- * get current time
45
- */
46
- export function getCurrTime(): number {
47
- const currTime = new Date();
48
- return currTime.getTime();
49
- }
50
-
51
- /**
52
- * check if passed value is an integer
53
- */
54
- export function isInteger(value?: number): boolean {
55
- if (Number.isInteger) {
56
- return Number.isInteger(value);
57
- }
58
-
59
- return _isInteger(value);
60
- }
61
-
62
- function _isInteger(value?: number): boolean {
63
- return (
64
- typeof value === 'number' && isFinite(value) && Math.floor(value) === value
65
- );
66
- }
67
-
68
- /**
69
- * provide an object as the in-memory cache
70
- */
71
- let store: Record<string, string> = {};
72
- export class CacheObject {
73
- static clear(): void {
74
- store = {};
75
- }
76
-
77
- static getItem(key: string): string | null {
78
- return store[key] || null;
79
- }
80
-
81
- static setItem(key: string, value: string): void {
82
- store[key] = value;
83
- }
84
-
85
- static removeItem(key: string): void {
86
- delete store[key];
87
- }
88
- }
89
-
90
- export const getCurrSizeKey = (keyPrefix: string) => keyPrefix + 'CurSize';
@@ -1,9 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Cache, AsyncStorageCache } from './AsyncStorageCache';
5
-
6
- export { AsyncStorageCache };
7
-
8
- // Standard `Cache` export to maintain interoperability with React Native
9
- export { Cache };
@@ -1,75 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /**
5
- * Cache Interface
6
- */
7
- export interface ICache {
8
- /** Put item into cache */
9
- setItem(key: string, value: any, options?: CacheItemOptions): void;
10
-
11
- /** Get item from cache */
12
- getItem(key: string, options?: CacheItemOptions): any;
13
-
14
- /** Remove item from cache */
15
- removeItem(key: string): void;
16
-
17
- /** Remove all items from cache */
18
- clear(): void;
19
-
20
- /** Get all keys form cache */
21
- getAllKeys(): string[] | Promise<string[]>;
22
-
23
- /** Get current size of the cache */
24
- getCacheCurSize(): number | Promise<number>;
25
-
26
- /** create a new instance with customized config */
27
- createInstance(config: CacheConfig): ICache;
28
-
29
- /** change current configuration */
30
- configure(config: CacheConfig): CacheConfig;
31
- }
32
-
33
- /**
34
- * Cache instance options
35
- */
36
- export interface CacheConfig {
37
- /** Prepend to key to avoid conflicts */
38
- keyPrefix: string;
39
-
40
- /** Cache capacity, in bytes */
41
- capacityInBytes: number;
42
-
43
- /** Max size of one item */
44
- itemMaxSize: number;
45
-
46
- /** Time to live, in milliseconds */
47
- defaultTTL: number;
48
-
49
- /** Warn when over threshold percentage of capacity, maximum 1 */
50
- warningThreshold: number;
51
-
52
- /** default priority number put on cached items */
53
- defaultPriority: number;
54
-
55
- storage?: Storage;
56
-
57
- Cache?: Cache;
58
- }
59
-
60
- export interface CacheItem {
61
- key: string;
62
- data: any;
63
- timestamp: number;
64
- visitedTime: number;
65
- priority: number;
66
- expires: number;
67
- type: string;
68
- byteSize: number;
69
- }
70
-
71
- export interface CacheItemOptions {
72
- priority?: number;
73
- expires?: number;
74
- callback?: Function;
75
- }
@@ -1,14 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { clientInfo, dimension } from './browser';
5
-
6
- export class ClientDevice {
7
- static clientInfo() {
8
- return clientInfo();
9
- }
10
-
11
- static dimension() {
12
- return dimension();
13
- }
14
- }
@@ -1,18 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- // @ts-ignore: missing type definition
4
- import { Platform } from 'react-native';
5
- import { clientInfo as iOSClientInfo } from './ios';
6
- import { clientInfo as androidClientInfo } from './android';
7
-
8
- const { OS } = Platform;
9
-
10
- export class ClientDevice {
11
- static clientInfo() {
12
- if (OS === 'ios') {
13
- return iOSClientInfo();
14
- } else {
15
- return androidClientInfo();
16
- }
17
- }
18
- }
File without changes
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
3
  // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  var react_native_1 = require("@aws-amplify/react-native");
6
6
  (0, react_native_1.loadUrlPolyfill)();
File without changes