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