@daiso-tech/core 0.26.0 → 0.27.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 (275) hide show
  1. package/README.md +10 -0
  2. package/dist/async/utilities/delay/delay.d.ts +1 -12
  3. package/dist/async/utilities/delay/delay.js +1 -12
  4. package/dist/async/utilities/delay/delay.js.map +1 -1
  5. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +99 -65
  6. package/dist/async/utilities/lazy-promise/lazy-promise.js +151 -111
  7. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  8. package/dist/cache/contracts/_module-exports.d.ts +1 -0
  9. package/dist/cache/contracts/_module-exports.js +1 -0
  10. package/dist/cache/contracts/_module-exports.js.map +1 -1
  11. package/dist/cache/contracts/cache-adapter.contract.d.ts +19 -21
  12. package/dist/cache/contracts/cache-adapter.contract.js +1 -4
  13. package/dist/cache/contracts/cache-adapter.contract.js.map +1 -1
  14. package/dist/cache/contracts/cache-factory.contract.d.ts +1 -1
  15. package/dist/cache/contracts/cache.contract.d.ts +52 -88
  16. package/dist/cache/contracts/cache.contract.js +1 -2
  17. package/dist/cache/contracts/cache.contract.js.map +1 -1
  18. package/dist/cache/contracts/cache.errors.js +2 -5
  19. package/dist/cache/contracts/cache.errors.js.map +1 -1
  20. package/dist/cache/contracts/cache.events.d.ts +10 -10
  21. package/dist/cache/contracts/cache.events.js +2 -5
  22. package/dist/cache/contracts/cache.events.js.map +1 -1
  23. package/dist/cache/contracts/database-cache-adapter.contract.d.ts +89 -0
  24. package/dist/cache/contracts/database-cache-adapter.contract.js +5 -0
  25. package/dist/cache/contracts/database-cache-adapter.contract.js.map +1 -0
  26. package/dist/cache/implementations/adapters/_module-exports.d.ts +0 -1
  27. package/dist/cache/implementations/adapters/_module-exports.js +0 -1
  28. package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
  29. package/dist/cache/implementations/adapters/{kysely-sqlite-cache-adapter → kysely-cache-adapter}/_module.d.ts +1 -1
  30. package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js +2 -0
  31. package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js.map +1 -0
  32. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +73 -0
  33. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +224 -0
  34. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -0
  35. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +29 -39
  36. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +45 -54
  37. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
  38. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +17 -33
  39. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +43 -52
  40. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  41. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.d.ts +13 -0
  42. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js +38 -0
  43. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js.map +1 -0
  44. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +27 -33
  45. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +145 -197
  46. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  47. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.d.ts +13 -0
  48. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js +39 -0
  49. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js.map +1 -0
  50. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +16 -22
  51. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +51 -132
  52. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  53. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.d.ts +13 -0
  54. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js +69 -0
  55. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js.map +1 -0
  56. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +29 -40
  57. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +46 -55
  58. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
  59. package/dist/cache/implementations/derivables/_module-exports.d.ts +1 -1
  60. package/dist/cache/implementations/derivables/_module-exports.js +1 -1
  61. package/dist/cache/implementations/derivables/_module-exports.js.map +1 -1
  62. package/dist/cache/implementations/derivables/cache/_module.d.ts +1 -0
  63. package/dist/cache/implementations/derivables/cache/_module.js +1 -0
  64. package/dist/cache/implementations/derivables/cache/_module.js.map +1 -1
  65. package/dist/cache/implementations/derivables/cache/cache.d.ts +122 -565
  66. package/dist/cache/implementations/derivables/cache/cache.js +342 -854
  67. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  68. package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +21 -0
  69. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +110 -0
  70. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -0
  71. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.d.ts +9 -0
  72. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js +20 -0
  73. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -0
  74. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +65 -104
  75. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +101 -85
  76. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  77. package/dist/cache/implementations/test-utilities/_module-exports.d.ts +1 -0
  78. package/dist/cache/implementations/test-utilities/_module-exports.js +1 -0
  79. package/dist/cache/implementations/test-utilities/_module-exports.js.map +1 -1
  80. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +9 -11
  81. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +246 -247
  82. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
  83. package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +16 -30
  84. package/dist/cache/implementations/test-utilities/cache.test-suite.js +271 -996
  85. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  86. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +60 -0
  87. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +698 -0
  88. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -0
  89. package/dist/collection/contracts/async-collection.contract.d.ts +2 -3
  90. package/dist/collection/contracts/async-collection.contract.js +1 -12
  91. package/dist/collection/contracts/async-collection.contract.js.map +1 -1
  92. package/dist/collection/contracts/collection.contract.d.ts +1 -1
  93. package/dist/collection/contracts/collection.errors.d.ts +1 -1
  94. package/dist/collection/contracts/collection.errors.js +3 -6
  95. package/dist/collection/contracts/collection.errors.js.map +1 -1
  96. package/dist/collection/implementations/_shared.d.ts +4 -4
  97. package/dist/collection/implementations/_shared.js +6 -9
  98. package/dist/collection/implementations/_shared.js.map +1 -1
  99. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +2 -2
  100. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -1
  101. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +1 -1
  102. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +6 -5
  103. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  104. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +1 -1
  105. package/dist/collection/implementations/iterable-collection/iterable-collection.js +1 -1
  106. package/dist/collection/implementations/list-collection/list-collection.d.ts +1 -1
  107. package/dist/collection/implementations/list-collection/list-collection.js +1 -1
  108. package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +0 -9
  109. package/dist/event-bus/contracts/event-bus.contract.d.ts +5 -5
  110. package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
  111. package/dist/event-bus/contracts/event-bus.errors.js +2 -5
  112. package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
  113. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +9 -29
  114. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +14 -35
  115. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
  116. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -3
  117. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -7
  118. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
  119. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +8 -15
  120. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +15 -34
  121. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
  122. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +78 -267
  123. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +119 -323
  124. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  125. package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +13 -0
  126. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +42 -0
  127. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -0
  128. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +70 -96
  129. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +100 -90
  130. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  131. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +2 -48
  132. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +31 -122
  133. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
  134. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +2 -50
  135. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +41 -89
  136. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  137. package/dist/lock/contracts/database-lock-adapter.contract.d.ts +0 -9
  138. package/dist/lock/contracts/lock-adapter.contract.d.ts +0 -9
  139. package/dist/lock/contracts/lock-provider.contract.d.ts +1 -1
  140. package/dist/lock/contracts/lock.errors.js +2 -5
  141. package/dist/lock/contracts/lock.errors.js.map +1 -1
  142. package/dist/lock/contracts/lock.events.js +2 -5
  143. package/dist/lock/contracts/lock.events.js.map +1 -1
  144. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +0 -5
  145. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -21
  146. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
  147. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +11 -16
  148. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +11 -20
  149. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -1
  150. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +7 -26
  151. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +7 -35
  152. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
  153. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +13 -20
  154. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +13 -37
  155. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
  156. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +4 -22
  157. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +4 -31
  158. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
  159. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +12 -17
  160. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +12 -21
  161. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
  162. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +0 -2
  163. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +2 -8
  164. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
  165. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +9 -0
  166. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +17 -0
  167. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -0
  168. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +115 -372
  169. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +197 -455
  170. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  171. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +15 -17
  172. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +42 -40
  173. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  174. package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +3 -3
  175. package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +1 -1
  176. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +30 -754
  177. package/dist/lock/implementations/derivables/lock-provider/lock.js +94 -812
  178. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  179. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +58 -161
  180. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +116 -122
  181. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  182. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +4 -5
  183. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +172 -247
  184. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
  185. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +5 -8
  186. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +93 -98
  187. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
  188. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -20
  189. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +133 -137
  190. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  191. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +1 -2
  192. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +1 -1
  193. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
  194. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -1
  195. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +1 -2
  196. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +1 -1
  197. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +1 -2
  198. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +1 -1
  199. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +2 -2
  200. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +2 -2
  201. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
  202. package/dist/serde/implementations/derivables/serde.d.ts +14 -14
  203. package/dist/serde/implementations/derivables/serde.js +14 -15
  204. package/dist/serde/implementations/derivables/serde.js.map +1 -1
  205. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +4 -4
  206. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +3 -3
  207. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +5 -5
  208. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +4 -4
  209. package/dist/utilities/_module-exports.d.ts +1 -2
  210. package/dist/utilities/_module-exports.js +1 -2
  211. package/dist/utilities/_module-exports.js.map +1 -1
  212. package/dist/utilities/classes/_module.d.ts +4 -0
  213. package/dist/utilities/classes/_module.js +5 -0
  214. package/dist/utilities/classes/_module.js.map +1 -0
  215. package/dist/utilities/classes/key-prefixer/_module.d.ts +2 -0
  216. package/dist/utilities/classes/key-prefixer/_module.js +3 -0
  217. package/dist/utilities/classes/key-prefixer/_module.js.map +1 -0
  218. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +28 -0
  219. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js +5 -0
  220. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js.map +1 -0
  221. package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +73 -0
  222. package/dist/utilities/classes/key-prefixer/key-prefixer.js +135 -0
  223. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -0
  224. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.d.ts +1 -0
  225. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js +2 -0
  226. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js.map +1 -0
  227. package/dist/utilities/classes/kysely-table-name-transformer-plugin/kysely-table-name-transformer-plugin.js.map +1 -0
  228. package/dist/utilities/classes/pipeline/_module.d.ts +1 -0
  229. package/dist/utilities/classes/pipeline/_module.js +2 -0
  230. package/dist/utilities/classes/pipeline/_module.js.map +1 -0
  231. package/dist/utilities/{pipeline → classes/pipeline}/pipeline.d.ts +3 -2
  232. package/dist/utilities/{pipeline → classes/pipeline}/pipeline.js +3 -2
  233. package/dist/utilities/classes/pipeline/pipeline.js.map +1 -0
  234. package/dist/utilities/classes/time-span/_module.d.ts +1 -0
  235. package/dist/utilities/classes/time-span/_module.js +2 -0
  236. package/dist/utilities/classes/time-span/_module.js.map +1 -0
  237. package/dist/utilities/{time-span → classes/time-span}/time-span.d.ts +2 -1
  238. package/dist/utilities/{time-span → classes/time-span}/time-span.js +1 -0
  239. package/dist/utilities/classes/time-span/time-span.js.map +1 -0
  240. package/dist/utilities/contracts/_module.d.ts +2 -1
  241. package/dist/utilities/contracts/_module.js +2 -1
  242. package/dist/utilities/contracts/_module.js.map +1 -1
  243. package/dist/utilities/contracts/prunable.contract.d.ts +11 -0
  244. package/dist/utilities/contracts/prunable.contract.js +5 -0
  245. package/dist/utilities/contracts/prunable.contract.js.map +1 -0
  246. package/dist/utilities/functions.d.ts +30 -2
  247. package/dist/utilities/functions.js +66 -4
  248. package/dist/utilities/functions.js.map +1 -1
  249. package/dist/utilities/types.d.ts +47 -14
  250. package/package.json +14 -13
  251. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +0 -2
  252. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +0 -1
  253. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +0 -61
  254. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +0 -318
  255. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +0 -1
  256. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +0 -1
  257. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +0 -2
  258. package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +0 -1
  259. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +0 -22
  260. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +0 -39
  261. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +0 -1
  262. package/dist/utilities/kysely/_module.d.ts +0 -1
  263. package/dist/utilities/kysely/_module.js +0 -2
  264. package/dist/utilities/kysely/_module.js.map +0 -1
  265. package/dist/utilities/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
  266. package/dist/utilities/pipeline/_module.d.ts +0 -1
  267. package/dist/utilities/pipeline/_module.js +0 -2
  268. package/dist/utilities/pipeline/_module.js.map +0 -1
  269. package/dist/utilities/pipeline/pipeline.js.map +0 -1
  270. package/dist/utilities/time-span/_module.d.ts +0 -1
  271. package/dist/utilities/time-span/_module.js +0 -2
  272. package/dist/utilities/time-span/_module.js.map +0 -1
  273. package/dist/utilities/time-span/time-span.js.map +0 -1
  274. /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.d.ts +0 -0
  275. /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.js +0 -0
@@ -12,6 +12,7 @@ TimeoutAsyncError,
12
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
13
  RetryAsyncError, } from "../../../async/async.errors.js";
14
14
  import { resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
15
+ import { delay } from "../../../async/utilities/_module.js";
15
16
  /**
16
17
  * The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
17
18
  * The class includes helpful methods
@@ -38,20 +39,38 @@ export class LazyPromise {
38
39
  * The <i>wrapFn</i> is convience method used for wrapping a async method with a <i>LazyPromise</i>.
39
40
  * @example
40
41
  * ```ts
41
- * import { LazyPromise, TimeSpan } from "@daiso-tech/core";
42
+ * import { LazyPromise } from "@daiso-tech/core/async";
43
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
42
44
  * import { readFile as readFileNodeJs } from "node:fs/promises";
43
45
  *
44
- * const readFile = LazyPromise.wrapFn(readFileNodeJs, {
45
- * retryAttempts: 3
46
- * });
46
+ * const readFile = LazyPromise.wrapFn(readFileNodeJs);
47
47
  *
48
- * (async () => {
49
- * await readFile("none_existing_file.txt").timeout(TimeSpan.fromMinutes(1));
50
- * })();
48
+ * const file = await readFile("none_existing_file.txt")
49
+ * .setRetryAttempts(4)
50
+ * .timeout(TimeSpan.fromMinutes(1));
51
51
  * ```
52
52
  */
53
- static wrapFn(fn) {
54
- return (...parameters) => new LazyPromise(() => fn(...parameters));
53
+ static wrapFn(fn, settings) {
54
+ return (...parameters) => new LazyPromise(() => fn(...parameters), settings);
55
+ }
56
+ /**
57
+ * The <i>delay</i> method creates a <i>{@link LazyPromise}</i> that will be fulfilled after given <i>time</i>.
58
+ *
59
+ * @throws {AsyncError} {@link AsyncError}
60
+ * @throws {AbortAsyncError} {@link AbortAsyncError}
61
+ * @example
62
+ * ```ts
63
+ * import { LazyPromise } from "@daiso-tech/core/async";
64
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
65
+ *
66
+ * console.log("a");
67
+ * await LazyPromise.delay(TimeSpan.fromSeconds(2));
68
+ * console.log("b");
69
+ */
70
+ static delay(time) {
71
+ return new LazyPromise(async () => {
72
+ await delay(time);
73
+ });
55
74
  }
56
75
  /**
57
76
  * The <i>all<i> method works similarly to <i>{@link Promise.all}</i> with the key distinction that it operates lazily.
@@ -78,64 +97,70 @@ export class LazyPromise {
78
97
  return new LazyPromise(async () => Promise.any(promises));
79
98
  }
80
99
  promise = null;
81
- attempts = null;
82
- backoffPolicy_ = null;
83
- retryPolicy_ = null;
84
- abortSignal = null;
85
- time = null;
86
100
  asyncFn;
101
+ settings;
87
102
  /**
88
103
  * @example
89
104
  * ```ts
90
- * import { LazyPromise } from "@daiso-tech/core";
105
+ * import { LazyPromise } from "@daiso-tech/core/async";
91
106
  *
92
- * (async () => {
93
- * const promise = new LazyPromise(async () => {
94
- * console.log("I am lazy");
95
- * });
96
- * // "I am lazy" will only logged when awaited or then method i called.
97
- * await promise;
98
- * })();
107
+ * const promise = new LazyPromise(async () => {
108
+ * console.log("I am lazy");
109
+ * });
110
+ *
111
+ * // "I am lazy" will only logged when awaited or then method i called.
112
+ * await promise;
99
113
  */
100
- constructor(asyncFn) {
114
+ constructor(asyncFn, settings = {}) {
101
115
  this.asyncFn = () => resolveAsyncLazyable(asyncFn);
116
+ this.settings = {
117
+ retryAttempts: null,
118
+ backoffPolicy: null,
119
+ retryPolicy: null,
120
+ abortSignal: null,
121
+ timeout: null,
122
+ onFinally: () => { },
123
+ onSuccess: (_value) => { },
124
+ onError: () => { },
125
+ ...settings,
126
+ };
102
127
  }
103
128
  applyTimeout() {
104
- if (this.time !== null) {
129
+ if (this.settings.timeout !== null) {
105
130
  const oldAsyncFn = this.asyncFn;
106
131
  const newAsyncFn = () => {
107
- if (this.time === null) {
132
+ if (this.settings.timeout === null) {
108
133
  throw new Error(`LazyPromise["time"] field is null`);
109
134
  }
110
- return timeoutAndFail(oldAsyncFn, this.time);
135
+ return timeoutAndFail(oldAsyncFn, this.settings.timeout);
111
136
  };
112
137
  this.asyncFn = newAsyncFn;
113
138
  }
114
139
  }
115
140
  applyRetry() {
116
- if (this.attempts !== null) {
141
+ if (this.settings.retryAttempts !== null) {
117
142
  const oldAsyncFn = this.asyncFn;
118
143
  const newAsyncFn = () => {
119
- if (this.attempts === null) {
144
+ if (this.settings.retryAttempts === null) {
120
145
  throw new Error(`LazyPromise["attempts"] field is null`);
121
146
  }
122
147
  return retryOrFail(oldAsyncFn, {
123
- backoffPolicy: this.backoffPolicy_ ?? undefined,
124
- retryPolicy: this.retryPolicy_ ?? undefined,
125
- maxAttempts: this.attempts,
148
+ backoffPolicy: this.settings.backoffPolicy ?? undefined,
149
+ retryPolicy: this.settings.retryPolicy ?? undefined,
150
+ maxAttempts: this.settings.retryAttempts,
126
151
  });
127
152
  };
128
153
  this.asyncFn = newAsyncFn;
129
154
  }
130
155
  }
131
156
  applyAbort() {
132
- if (this.abortSignal !== null) {
157
+ if (this.settings.abortSignal !== null) {
133
158
  const oldAsyncFn = this.asyncFn;
134
159
  const newAsyncFn = () => {
135
- if (this.abortSignal === null) {
160
+ if (this.settings.abortSignal === null) {
136
161
  throw new Error(`LazyPromise["abortSignal"] field is null`);
137
162
  }
138
- return abortAndFail(oldAsyncFn, this.abortSignal);
163
+ return abortAndFail(oldAsyncFn, this.settings.abortSignal);
139
164
  };
140
165
  this.asyncFn = newAsyncFn;
141
166
  }
@@ -164,7 +189,7 @@ export class LazyPromise {
164
189
  * The <i>setRetryAttempts</i> method is used for setting max retry attempts.
165
190
  * @example
166
191
  * ```ts
167
- * import { LazyPromise } from "@daiso-tech/core";
192
+ * import { LazyPromise } from "@daiso-tech/core/async";
168
193
  *
169
194
  * const promise =
170
195
  * new LazyPromise(async () => {
@@ -172,21 +197,22 @@ export class LazyPromise {
172
197
  * throw new Error("Error occured!");
173
198
  * })
174
199
  * .setRetryAttempts(3)
175
- * (async () => {
176
- * // Will log "A" 3 times and then retry error will be thrown.
177
- * await promise;
178
- * })();
200
+ *
201
+ * // Will log "A" 3 times and then retry error will be thrown.
202
+ * await promise;
179
203
  * ```
180
204
  */
181
205
  setRetryAttempts(attempts) {
182
- this.attempts = attempts;
183
- return this;
206
+ return new LazyPromise(this.asyncFn, {
207
+ ...this.settings,
208
+ retryAttempts: attempts,
209
+ });
184
210
  }
185
211
  /**
186
212
  * The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
187
- * @example
188
213
  * ```ts
189
- * import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core";
214
+ * import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
215
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
190
216
  *
191
217
  * const promise =
192
218
  * new LazyPromise(async () => {
@@ -195,21 +221,22 @@ export class LazyPromise {
195
221
  * })
196
222
  * .setRetryAttempts(3)
197
223
  * .setBackoffPolicy(linearBackoffPolicy())
198
- * (async () => {
199
- * // Will log "A" 3 times and then retry error will be thrown.
200
- * await promise;
201
- * })();
224
+ *
225
+ * // Will log "A" 3 times and then retry error will be thrown.
226
+ * await promise;
202
227
  * ```
203
228
  */
204
229
  setBackoffPolicy(policy) {
205
- this.backoffPolicy_ = policy;
206
- return this;
230
+ return new LazyPromise(this.asyncFn, {
231
+ ...this.settings,
232
+ backoffPolicy: policy,
233
+ });
207
234
  }
208
235
  /**
209
236
  * The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
210
237
  * @example
211
238
  * ```ts
212
- * import { LazyPromise } from "@daiso-tech/core";
239
+ * import { LazyPromise } from "@daiso-tech/core/async";
213
240
  *
214
241
  * class ErrorA extends Error {}
215
242
  *
@@ -221,113 +248,126 @@ export class LazyPromise {
221
248
  * .setRetryAttempts(3)
222
249
  * // Will only retry an error that is instance ErrorA
223
250
  * .setRetryPolicy(error => error instanceof ErrorA)
224
- * (async () => {
225
- * // Will log "A" 1 time and then error will be thrown.
226
- * await promise;
227
- * })();
251
+ *
252
+ * // Will log "A" 1 time and then error will be thrown.
253
+ * await promise;
228
254
  * ```
229
255
  */
230
256
  setRetryPolicy(policy) {
231
- this.retryPolicy_ = policy;
232
- return this;
257
+ return new LazyPromise(this.asyncFn, {
258
+ ...this.settings,
259
+ retryPolicy: policy,
260
+ });
233
261
  }
234
262
  /**
235
263
  * The <i>setTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
236
264
  * @example
237
265
  * ```ts
238
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
266
+ * import { LazyPromise } from "@daiso-tech/core/async";
267
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
239
268
  *
240
269
  * const promise =
241
270
  * new LazyPromise(async () => {
242
- * await delay(TimeSpan.fromMinutes(1));
271
+ * await LazyPromise.delay(TimeSpan.fromMinutes(1));
243
272
  * })
244
273
  * .setTimeout(TimeSpan.fromSeconds(1));
245
- * (async () => {
246
- * // An timeout error will be thrown.
247
- * await promise;
248
- * })();
274
+ *
275
+ * // An timeout error will be thrown.
276
+ * await promise;
249
277
  * ```
250
278
  */
251
279
  setTimeout(time) {
252
- this.time = time;
253
- return this;
280
+ return new LazyPromise(this.asyncFn, {
281
+ ...this.settings,
282
+ timeout: time,
283
+ });
254
284
  }
255
285
  /**
256
286
  * The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
257
287
  * @example
258
288
  * ```ts
259
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
289
+ * import { LazyPromise } from "@daiso-tech/core";
290
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
260
291
  *
261
292
  * const abortController = new AbortController();
262
293
  * const promise =
263
294
  * new LazyPromise(async () => {
264
- * await delay(TimeSpan.fromMinutes(1));
295
+ * await LazyPromise.delay(TimeSpan.fromMinutes(1));
265
296
  * })
266
297
  * .setAbortSignal(abortController.signal);
267
- * (async () => {
268
- * setTimeout(() => {
269
- * abortController.abort();
270
- * }, 1000);
271
- * // An timeout error will be thrown.
272
- * await promise;
273
- * })();
298
+ *
299
+ * setTimeout(() => {
300
+ * abortController.abort();
301
+ * }, 1000);
302
+ *
303
+ * // An timeout error will be thrown.
304
+ * await promise;
274
305
  * ```
275
306
  */
276
307
  setAbortSignal(abortSignal) {
277
- this.abortSignal = abortSignal;
278
- return this;
308
+ return new LazyPromise(this.asyncFn, {
309
+ ...this.settings,
310
+ abortSignal,
311
+ });
312
+ }
313
+ onFinally(cb) {
314
+ return new LazyPromise(this.asyncFn, {
315
+ ...this.settings,
316
+ onFinally: cb,
317
+ });
318
+ }
319
+ onSuccess(cb) {
320
+ return new LazyPromise(this.asyncFn, {
321
+ ...this.settings,
322
+ onSuccess: cb,
323
+ });
324
+ }
325
+ onError(cb) {
326
+ return new LazyPromise(this.asyncFn, {
327
+ ...this.settings,
328
+ onError: cb,
329
+ });
279
330
  }
280
331
  /**
281
332
  * The <i>defer</i> method executes the <i>LazyPromise</i> without awaiting it.
282
333
  * @example
283
334
  * ```ts
284
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
335
+ * import { LazyPromise } from "@daiso-tech/core";
336
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
285
337
  *
286
338
  * const promise =
287
339
  * new LazyPromise(async () => {
288
- * await delay(TimeSpan.fromSeconds(1));
340
+ * await LazyPromise.delay(TimeSpan.fromSeconds(1));
289
341
  * // Will be loged after one second
290
342
  * console.log("Done !");
291
343
  * });
344
+ *
292
345
  * promise.defer();
346
+ *
293
347
  * // Will be logged immediately
294
348
  * console.log("Hello");
349
+ * await LazyPromise.delay(TimeSpan.fromSeconds(2));
295
350
  * ```
296
351
  */
297
- defer(callbacks = {}) {
298
- const { onSucces, onError, onFinally } = callbacks;
299
- let onSuccesHandler;
300
- if (onSucces || onFinally) {
301
- onSuccesHandler = async (value) => {
302
- try {
303
- if (onSucces !== undefined) {
304
- await onSucces(value);
305
- }
306
- return value;
307
- }
308
- finally {
309
- if (onFinally !== undefined) {
310
- await onFinally();
311
- }
312
- }
313
- };
314
- }
315
- let onErrorHandler;
316
- if (onError || onFinally) {
317
- onErrorHandler = async (error) => {
318
- try {
319
- if (onError !== undefined) {
320
- await onError(error);
321
- }
322
- return error;
323
- }
324
- finally {
325
- if (onFinally !== undefined) {
326
- await onFinally();
327
- }
328
- }
329
- };
330
- }
352
+ defer() {
353
+ const onSuccesHandler = async (value) => {
354
+ try {
355
+ await this.settings.onSuccess(value);
356
+ return value;
357
+ }
358
+ finally {
359
+ await this.settings.onFinally();
360
+ }
361
+ };
362
+ const onErrorHandler = async (error) => {
363
+ try {
364
+ await this.settings.onError(error);
365
+ return error;
366
+ }
367
+ finally {
368
+ await this.settings.onFinally();
369
+ }
370
+ };
331
371
  this.then(onSuccesHandler, onErrorHandler);
332
372
  }
333
373
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO;AACH,6DAA6D;AAC7D,eAAe;AACf,6DAA6D;AAC7D,iBAAiB;AACjB,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;AAYxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,CACT,EAA2C;QAE3C,OAAO,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAG,CAAS,QAA+B;QAC9C,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CACb,QAA+B;QAE/B,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,O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AC;wBAAS,CAAC;oBACP,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;wBAC1B,MAAM,SAAS,EAAE,CAAC;oBACtB,CAAC;gBACL,CAAC;YACL,CAAC,CAAC;QACN,CAAC;QAED,IAAI,cAAkE,CAAC;QACvE,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;YACvB,cAAc,GAAG,KAAK,EAAE,KAAc,EAAoB,EAAE;gBACxD,IAAI,CAAC;oBACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;wBACxB,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;oBACzB,CAAC;oBACD,OAAO,KAAK,CAAC;gBACjB,CAAC;wBAAS,CAAC;oBACP,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;wBAC1B,MAAM,SAAS,EAAE,CAAC;oBACtB,CAAC;gBACL,CAAC;YACL,CAAC,CAAC;QACN,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;CACJ"}
1
+ {"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO;AACH,6DAA6D;AAC7D,eAAe;AACf,6DAA6D;AAC7D,iBAAiB;AACjB,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAmCrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,CAC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AAC,OAAO,EAAE;YACjC,GAAG,IAAI,CAAC,QAAQ;YAChB,OAAO,EAAE,EAAE;SACd,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK;QACD,MAAM,eAAe,GAAG,KAAK,EAAE,KAAa,EAAmB,EAAE;YAC7D,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrC,OAAO,KAAK,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,cAAc,GAAG,KAAK,EAAE,KAAc,EAAoB,EAAE;YAC9D,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;CACJ"}
@@ -3,3 +3,4 @@ export * from "../../cache/contracts/cache-factory.contract.js";
3
3
  export * from "../../cache/contracts/cache.contract.js";
4
4
  export * from "../../cache/contracts/cache.errors.js";
5
5
  export * from "../../cache/contracts/cache.events.js";
6
+ export * from "../../cache/contracts/database-cache-adapter.contract.js";
@@ -3,4 +3,5 @@ export * from "../../cache/contracts/cache-factory.contract.js";
3
3
  export * from "../../cache/contracts/cache.contract.js";
4
4
  export * from "../../cache/contracts/cache.errors.js";
5
5
  export * from "../../cache/contracts/cache.events.js";
6
+ export * from "../../cache/contracts/database-cache-adapter.contract.js";
6
7
  //# sourceMappingURL=_module-exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/cache/contracts/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../src/cache/contracts/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sDAAsD,CAAC"}
@@ -3,54 +3,52 @@
3
3
  */
4
4
  import type { TimeSpan } from "../../utilities/_module-exports.js";
5
5
  /**
6
- * The <i>ICacheAdapter</i> contract defines a way for storing data as key-value pairs independent of data storage.
7
- * This contract is not meant to be used directly, instead you should use <i>{@link ICache}</i> contract.
6
+ * The <i>ICacheAdapter</i> contract defines a way for key-value pairs independent of data storage.
8
7
  *
9
8
  * IMPORT_PATH: ```"@daiso-tech/core/cache/contracts"```
10
9
  * @group Contracts
11
10
  */
12
11
  export type ICacheAdapter<TType = unknown> = {
13
12
  /**
14
- * The <i>get</i> returns the <i>key</i> value if found otherwise null will be returned.
13
+ * The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
15
14
  */
16
15
  get(key: string): PromiseLike<TType | null>;
17
16
  /**
18
- * The <i>add</i> method add a new <i>key</i>. Returns true if the <i>key</i> where added otherwise false will be returned.
19
- * You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
17
+ * The <i>getAndRemove</i> method returns the value when <i>key</i> is found otherwise null will be returned.
18
+ * The key will be removed after it is returned.
20
19
  */
21
- add(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
20
+ getAndRemove(key: string): PromiseLike<TType | null>;
22
21
  /**
23
- * The <i>update</i> method updates a <i>key</i>. Returns true if the <i>key</i> where updated otherwise false will be returned.
22
+ * The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned.
23
+ * You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
24
24
  */
25
- update(key: string, value: TType): PromiseLike<boolean>;
25
+ add(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
26
26
  /**
27
- * The <i>put</i> method replaces a <i>key</i> if the <i>key</i> exists including the ttl value or adds <i>key</i> that do not exists with a given <i>ttl</i>.
27
+ * The <i>put</i> method replaces th given <i>key</i> with the given <i>value</i> and <i>ttl</i> if the <i>key</i> exists othwerwise it will add the given <i>value</i> and <i>ttl</i>.
28
28
  * Returns true if the <i>key</i> where replaced otherwise false is returned.
29
- * You must provide a <i>ttl</i> value. If null is passed, the item will not expire.
30
29
  */
31
30
  put(key: string, value: TType, ttl: TimeSpan | null): PromiseLike<boolean>;
32
31
  /**
33
- * The <i>remove</i> method removes a <i>key</i>. Returns true if the <i>key</i> is removed otherwise false is returned.
32
+ * The <i>update</i> method updates the given <i>key</i> with given <i>value</i>. Returns true if the <i>key</i> where updated otherwise false will be returned.
34
33
  */
35
- remove(key: string): PromiseLike<boolean>;
34
+ update(key: string, value: TType): PromiseLike<boolean>;
36
35
  /**
37
- * The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
38
- * Returns true if key is incremented otherwise false will be returned.
36
+ * The <i>increment</i> method increments the given <i>key</i> with given <i>value</i>. Returns true if the <i>key</i> where incremented otherwise false will be returned.
37
+ * If <i>values</i> is not defined then it will increment the key with 1.
39
38
  * An error will thrown if the key is not a number.
40
39
  * @throws {TypeCacheError} {@link TypeCacheError}
41
40
  */
42
41
  increment(key: string, value: number): PromiseLike<boolean>;
43
42
  /**
44
- * The <i>clear</i> method removes all keys that starts <i>prefix</i>.
43
+ * The <i>removeMany</i> method removes many keys. Returns true if one of the keys where deleted otherwise false is returned.
45
44
  */
46
- clear(): PromiseLike<void>;
45
+ removeMany(keys: string[]): PromiseLike<boolean>;
47
46
  /**
48
- * The <i>getGroup</i> method returns the group name.
47
+ * The <i>removeAll</i> method removes all keys from the cache.
49
48
  */
50
- getGroup(): string;
49
+ removeAll(): PromiseLike<void>;
51
50
  /**
52
- * The <i>withGroup</i> method returns a new <i>{@link ICacheAdapter}</i> instance that groups keys together.
53
- * Only keys in the same group will be updated, removed, or retrieved, leaving keys outside the group unaffected.
51
+ * The <i>removeByKeyPrefix</i> method removes all the keys in the cache that starts with the given <i>prefix</i>.
54
52
  */
55
- withGroup(group: string): ICacheAdapter<TType>;
53
+ removeByKeyPrefix(prefix: string): PromiseLike<void>;
56
54
  };
@@ -1,5 +1,2 @@
1
- /**
2
- * @module Cache
3
- */
4
- import {} from "../../cache/contracts/cache.errors.js";
1
+ export {};
5
2
  //# sourceMappingURL=cache-adapter.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAGN,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"cache-adapter.contract.js","sourceRoot":"","sources":["../../../src/cache/contracts/cache-adapter.contract.ts"],"names":[],"mappings":""}
@@ -11,7 +11,7 @@ import type { IGroupableCache } from "../../cache/contracts/cache.contract.js";
11
11
  export type ICacheFactory<TAdapters extends string = string> = {
12
12
  /**
13
13
  * The <i>use</i> method will throw an error if you provide it unregisted adapter.
14
- * If no default adapter is defined an error will be thrown by <i>use</i> method.
14
+ * If no default adapter is defined an error will be thrown.
15
15
  * @throws {UnregisteredAdapterError} {@link UnregisteredAdapterError}
16
16
  * @throws {DefaultAdapterNotDefinedError} {@link DefaultAdapterNotDefinedError}
17
17
  */