@daiso-tech/core 0.26.1 → 0.28.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 (289) hide show
  1. package/README.md +13 -3
  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 +143 -71
  6. package/dist/async/utilities/lazy-promise/lazy-promise.js +223 -142
  7. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  8. package/dist/async/utilities/retry/retry-or-fail.d.ts +2 -0
  9. package/dist/async/utilities/retry/retry-or-fail.js.map +1 -1
  10. package/dist/cache/contracts/_module-exports.d.ts +1 -0
  11. package/dist/cache/contracts/_module-exports.js +1 -0
  12. package/dist/cache/contracts/_module-exports.js.map +1 -1
  13. package/dist/cache/contracts/cache-adapter.contract.d.ts +19 -21
  14. package/dist/cache/contracts/cache-adapter.contract.js +1 -4
  15. package/dist/cache/contracts/cache-adapter.contract.js.map +1 -1
  16. package/dist/cache/contracts/cache-factory.contract.d.ts +1 -1
  17. package/dist/cache/contracts/cache.contract.d.ts +144 -96
  18. package/dist/cache/contracts/cache.contract.js +1 -2
  19. package/dist/cache/contracts/cache.contract.js.map +1 -1
  20. package/dist/cache/contracts/cache.errors.js +2 -5
  21. package/dist/cache/contracts/cache.errors.js.map +1 -1
  22. package/dist/cache/contracts/cache.events.d.ts +10 -10
  23. package/dist/cache/contracts/cache.events.js +2 -5
  24. package/dist/cache/contracts/cache.events.js.map +1 -1
  25. package/dist/cache/contracts/database-cache-adapter.contract.d.ts +89 -0
  26. package/dist/cache/contracts/database-cache-adapter.contract.js +5 -0
  27. package/dist/cache/contracts/database-cache-adapter.contract.js.map +1 -0
  28. package/dist/cache/implementations/adapters/{kysely-sqlite-cache-adapter → kysely-cache-adapter}/_module.d.ts +1 -1
  29. package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js +2 -0
  30. package/dist/cache/implementations/adapters/kysely-cache-adapter/_module.js.map +1 -0
  31. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +73 -0
  32. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +224 -0
  33. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -0
  34. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +29 -39
  35. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +45 -54
  36. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
  37. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +17 -33
  38. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +43 -52
  39. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  40. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.d.ts +13 -0
  41. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js +38 -0
  42. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-serde.js.map +1 -0
  43. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +27 -33
  44. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +145 -197
  45. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  46. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +14 -13
  47. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +19 -17
  48. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
  49. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.d.ts +13 -0
  50. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js +39 -0
  51. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-serde.js.map +1 -0
  52. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +16 -22
  53. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +51 -132
  54. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  55. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.d.ts +13 -0
  56. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js +69 -0
  57. package/dist/cache/implementations/adapters/redis-cache-adapter/utilities.js.map +1 -0
  58. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +29 -41
  59. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +46 -55
  60. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
  61. package/dist/cache/implementations/derivables/_module-exports.d.ts +1 -1
  62. package/dist/cache/implementations/derivables/_module-exports.js +1 -1
  63. package/dist/cache/implementations/derivables/_module-exports.js.map +1 -1
  64. package/dist/cache/implementations/derivables/cache/_module.d.ts +1 -0
  65. package/dist/cache/implementations/derivables/cache/_module.js +1 -0
  66. package/dist/cache/implementations/derivables/cache/_module.js.map +1 -1
  67. package/dist/cache/implementations/derivables/cache/cache.d.ts +269 -507
  68. package/dist/cache/implementations/derivables/cache/cache.js +538 -822
  69. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  70. package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +21 -0
  71. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +110 -0
  72. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -0
  73. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.d.ts +9 -0
  74. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js +20 -0
  75. package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -0
  76. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +69 -105
  77. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +117 -87
  78. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  79. package/dist/cache/implementations/test-utilities/_module-exports.d.ts +1 -0
  80. package/dist/cache/implementations/test-utilities/_module-exports.js +1 -0
  81. package/dist/cache/implementations/test-utilities/_module-exports.js.map +1 -1
  82. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +9 -11
  83. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +246 -247
  84. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
  85. package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +16 -30
  86. package/dist/cache/implementations/test-utilities/cache.test-suite.js +271 -996
  87. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  88. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +60 -0
  89. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +698 -0
  90. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -0
  91. package/dist/collection/contracts/async-collection.contract.d.ts +2 -3
  92. package/dist/collection/contracts/async-collection.contract.js +1 -12
  93. package/dist/collection/contracts/async-collection.contract.js.map +1 -1
  94. package/dist/collection/contracts/collection.contract.d.ts +1 -1
  95. package/dist/collection/contracts/collection.errors.d.ts +1 -1
  96. package/dist/collection/contracts/collection.errors.js +3 -6
  97. package/dist/collection/contracts/collection.errors.js.map +1 -1
  98. package/dist/collection/implementations/_shared.d.ts +4 -4
  99. package/dist/collection/implementations/_shared.js +6 -9
  100. package/dist/collection/implementations/_shared.js.map +1 -1
  101. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +2 -2
  102. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +1 -1
  103. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +5 -21
  104. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +12 -8
  105. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  106. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +1 -1
  107. package/dist/collection/implementations/iterable-collection/iterable-collection.js +1 -1
  108. package/dist/collection/implementations/list-collection/list-collection.d.ts +1 -1
  109. package/dist/collection/implementations/list-collection/list-collection.js +1 -1
  110. package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +0 -9
  111. package/dist/event-bus/contracts/event-bus.contract.d.ts +5 -5
  112. package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
  113. package/dist/event-bus/contracts/event-bus.errors.js +2 -5
  114. package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
  115. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +9 -29
  116. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +14 -35
  117. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
  118. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -4
  119. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -8
  120. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
  121. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +8 -15
  122. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +15 -34
  123. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
  124. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +85 -289
  125. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +128 -325
  126. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  127. package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +13 -0
  128. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +42 -0
  129. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -0
  130. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +103 -86
  131. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +135 -77
  132. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  133. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +2 -48
  134. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +31 -122
  135. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
  136. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +2 -50
  137. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +41 -89
  138. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  139. package/dist/lock/contracts/database-lock-adapter.contract.d.ts +0 -9
  140. package/dist/lock/contracts/lock-adapter.contract.d.ts +0 -9
  141. package/dist/lock/contracts/lock-provider.contract.d.ts +20 -6
  142. package/dist/lock/contracts/lock.contract.d.ts +37 -8
  143. package/dist/lock/contracts/lock.errors.js +2 -5
  144. package/dist/lock/contracts/lock.errors.js.map +1 -1
  145. package/dist/lock/contracts/lock.events.js +2 -5
  146. package/dist/lock/contracts/lock.events.js.map +1 -1
  147. package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -0
  148. package/dist/lock/implementations/adapters/_module-exports.js +1 -0
  149. package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
  150. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +0 -5
  151. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -21
  152. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
  153. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +11 -16
  154. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +11 -20
  155. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +1 -1
  156. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +7 -26
  157. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +7 -35
  158. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
  159. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +13 -20
  160. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +13 -37
  161. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
  162. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.d.ts +1 -0
  163. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js +2 -0
  164. package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js.map +1 -0
  165. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +17 -0
  166. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +24 -0
  167. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -0
  168. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +4 -22
  169. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +4 -31
  170. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
  171. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +14 -20
  172. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +12 -21
  173. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
  174. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +0 -2
  175. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +2 -8
  176. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
  177. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +1 -5
  178. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -1
  179. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +181 -369
  180. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +259 -407
  181. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  182. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +15 -17
  183. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +42 -40
  184. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  185. package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +3 -3
  186. package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +1 -1
  187. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +194 -680
  188. package/dist/lock/implementations/derivables/lock-provider/lock.js +284 -744
  189. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  190. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +106 -143
  191. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +173 -101
  192. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  193. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +4 -5
  194. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +172 -247
  195. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
  196. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +5 -8
  197. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +93 -98
  198. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
  199. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -20
  200. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +295 -145
  201. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  202. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +1 -2
  203. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +1 -1
  204. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +3 -2
  205. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -1
  206. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js.map +1 -1
  207. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +1 -2
  208. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +1 -1
  209. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +1 -2
  210. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +1 -1
  211. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +2 -2
  212. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +2 -2
  213. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
  214. package/dist/serde/implementations/derivables/serde.d.ts +14 -14
  215. package/dist/serde/implementations/derivables/serde.js +14 -15
  216. package/dist/serde/implementations/derivables/serde.js.map +1 -1
  217. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +4 -4
  218. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +3 -3
  219. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +5 -5
  220. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +4 -4
  221. package/dist/utilities/_module-exports.d.ts +2 -3
  222. package/dist/utilities/_module-exports.js +2 -3
  223. package/dist/utilities/_module-exports.js.map +1 -1
  224. package/dist/utilities/classes/_module.d.ts +4 -0
  225. package/dist/utilities/classes/_module.js +5 -0
  226. package/dist/utilities/classes/_module.js.map +1 -0
  227. package/dist/utilities/classes/key-prefixer/_module.d.ts +2 -0
  228. package/dist/utilities/classes/key-prefixer/_module.js +3 -0
  229. package/dist/utilities/classes/key-prefixer/_module.js.map +1 -0
  230. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +28 -0
  231. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js +5 -0
  232. package/dist/utilities/classes/key-prefixer/key-prefixer.contract.js.map +1 -0
  233. package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +73 -0
  234. package/dist/utilities/classes/key-prefixer/key-prefixer.js +135 -0
  235. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -0
  236. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.d.ts +1 -0
  237. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js +2 -0
  238. package/dist/utilities/classes/kysely-table-name-transformer-plugin/_module.js.map +1 -0
  239. package/dist/utilities/classes/kysely-table-name-transformer-plugin/kysely-table-name-transformer-plugin.js.map +1 -0
  240. package/dist/utilities/classes/pipeline/_module.d.ts +1 -0
  241. package/dist/utilities/classes/pipeline/_module.js +2 -0
  242. package/dist/utilities/classes/pipeline/_module.js.map +1 -0
  243. package/dist/utilities/{pipeline → classes/pipeline}/pipeline.d.ts +3 -2
  244. package/dist/utilities/{pipeline → classes/pipeline}/pipeline.js +3 -2
  245. package/dist/utilities/classes/pipeline/pipeline.js.map +1 -0
  246. package/dist/utilities/classes/time-span/_module.d.ts +1 -0
  247. package/dist/utilities/classes/time-span/_module.js +2 -0
  248. package/dist/utilities/classes/time-span/_module.js.map +1 -0
  249. package/dist/utilities/{time-span → classes/time-span}/time-span.d.ts +2 -1
  250. package/dist/utilities/{time-span → classes/time-span}/time-span.js +1 -0
  251. package/dist/utilities/classes/time-span/time-span.js.map +1 -0
  252. package/dist/utilities/{_constants.d.ts → constants.d.ts} +0 -3
  253. package/dist/utilities/constants.js +5 -0
  254. package/dist/utilities/constants.js.map +1 -0
  255. package/dist/utilities/contracts/_module.d.ts +3 -1
  256. package/dist/utilities/contracts/_module.js +3 -1
  257. package/dist/utilities/contracts/_module.js.map +1 -1
  258. package/dist/utilities/contracts/prunable.contract.d.ts +11 -0
  259. package/dist/utilities/contracts/prunable.contract.js +5 -0
  260. package/dist/utilities/contracts/prunable.contract.js.map +1 -0
  261. package/dist/utilities/contracts/sqlite-database.contract.d.ts +26 -0
  262. package/dist/utilities/contracts/sqlite-database.contract.js +5 -0
  263. package/dist/utilities/contracts/sqlite-database.contract.js.map +1 -0
  264. package/dist/utilities/functions.d.ts +34 -2
  265. package/dist/utilities/functions.js +72 -4
  266. package/dist/utilities/functions.js.map +1 -1
  267. package/dist/utilities/types.d.ts +49 -16
  268. package/package.json +14 -13
  269. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +0 -2
  270. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +0 -1
  271. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +0 -61
  272. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +0 -318
  273. package/dist/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +0 -1
  274. package/dist/utilities/_constants.js +0 -8
  275. package/dist/utilities/_constants.js.map +0 -1
  276. package/dist/utilities/kysely/_module.d.ts +0 -1
  277. package/dist/utilities/kysely/_module.js +0 -2
  278. package/dist/utilities/kysely/_module.js.map +0 -1
  279. package/dist/utilities/kysely/kysely-table-name-transformer-plugin.js.map +0 -1
  280. package/dist/utilities/pipeline/_module.d.ts +0 -1
  281. package/dist/utilities/pipeline/_module.js +0 -2
  282. package/dist/utilities/pipeline/_module.js.map +0 -1
  283. package/dist/utilities/pipeline/pipeline.js.map +0 -1
  284. package/dist/utilities/time-span/_module.d.ts +0 -1
  285. package/dist/utilities/time-span/_module.js +0 -2
  286. package/dist/utilities/time-span/_module.js.map +0 -1
  287. package/dist/utilities/time-span/time-span.js.map +0 -1
  288. /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.d.ts +0 -0
  289. /package/dist/utilities/{kysely → classes/kysely-table-name-transformer-plugin}/kysely-table-name-transformer-plugin.js +0 -0
@@ -11,7 +11,8 @@ AbortAsyncError,
11
11
  TimeoutAsyncError,
12
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
13
  RetryAsyncError, } from "../../../async/async.errors.js";
14
- import { resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
14
+ import { removeUndefinedProperties, 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,71 +97,95 @@ 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 = removeUndefinedProperties({
117
+ retryAttempts: null,
118
+ backoffPolicy: null,
119
+ retryPolicy: null,
120
+ retryTimeout: null,
121
+ totalTimeout: null,
122
+ abortSignal: null,
123
+ onFinally: () => { },
124
+ onSuccess: (_value) => { },
125
+ onError: () => { },
126
+ ...settings,
127
+ });
102
128
  }
103
- applyTimeout() {
104
- if (this.time !== null) {
105
- const oldAsyncFn = this.asyncFn;
106
- const newAsyncFn = () => {
107
- if (this.time === null) {
108
- throw new Error(`LazyPromise["time"] field is null`);
109
- }
110
- return timeoutAndFail(oldAsyncFn, this.time);
111
- };
112
- this.asyncFn = newAsyncFn;
129
+ applyRetryTimeout() {
130
+ if (this.settings.retryTimeout === null) {
131
+ return;
113
132
  }
133
+ const oldAsyncFn = this.asyncFn;
134
+ const newAsyncFn = () => {
135
+ if (this.settings.retryTimeout === null) {
136
+ throw new Error(`LazyPromise["time"] field is null`);
137
+ }
138
+ return timeoutAndFail(oldAsyncFn, this.settings.retryTimeout);
139
+ };
140
+ this.asyncFn = newAsyncFn;
114
141
  }
115
142
  applyRetry() {
116
- if (this.attempts !== null) {
117
- const oldAsyncFn = this.asyncFn;
118
- const newAsyncFn = () => {
119
- if (this.attempts === null) {
120
- throw new Error(`LazyPromise["attempts"] field is null`);
121
- }
122
- return retryOrFail(oldAsyncFn, {
123
- backoffPolicy: this.backoffPolicy_ ?? undefined,
124
- retryPolicy: this.retryPolicy_ ?? undefined,
125
- maxAttempts: this.attempts,
126
- });
127
- };
128
- this.asyncFn = newAsyncFn;
143
+ if (this.settings.retryAttempts === null) {
144
+ return;
129
145
  }
146
+ this.applyRetryTimeout();
147
+ const oldAsyncFn = this.asyncFn;
148
+ const newAsyncFn = () => {
149
+ if (this.settings.retryAttempts === null) {
150
+ throw new Error(`LazyPromise["attempts"] field is null`);
151
+ }
152
+ return retryOrFail(oldAsyncFn, {
153
+ backoffPolicy: this.settings.backoffPolicy ?? undefined,
154
+ retryPolicy: this.settings.retryPolicy ?? undefined,
155
+ maxAttempts: this.settings.retryAttempts,
156
+ });
157
+ };
158
+ this.asyncFn = newAsyncFn;
159
+ }
160
+ applyTotalTimeout() {
161
+ if (this.settings.totalTimeout === null) {
162
+ return;
163
+ }
164
+ const oldAsyncFn = this.asyncFn;
165
+ const newAsyncFn = () => {
166
+ if (this.settings.totalTimeout === null) {
167
+ throw new Error(`LazyPromise["time"] field is null`);
168
+ }
169
+ return timeoutAndFail(oldAsyncFn, this.settings.totalTimeout);
170
+ };
171
+ this.asyncFn = newAsyncFn;
130
172
  }
131
173
  applyAbort() {
132
- if (this.abortSignal !== null) {
133
- const oldAsyncFn = this.asyncFn;
134
- const newAsyncFn = () => {
135
- if (this.abortSignal === null) {
136
- throw new Error(`LazyPromise["abortSignal"] field is null`);
137
- }
138
- return abortAndFail(oldAsyncFn, this.abortSignal);
139
- };
140
- this.asyncFn = newAsyncFn;
174
+ if (this.settings.abortSignal === null) {
175
+ return;
141
176
  }
177
+ const oldAsyncFn = this.asyncFn;
178
+ const newAsyncFn = () => {
179
+ if (this.settings.abortSignal === null) {
180
+ throw new Error(`LazyPromise["abortSignal"] field is null`);
181
+ }
182
+ return abortAndFail(oldAsyncFn, this.settings.abortSignal);
183
+ };
184
+ this.asyncFn = newAsyncFn;
142
185
  }
143
186
  applySettings() {
144
- this.applyTimeout();
145
187
  this.applyRetry();
188
+ this.applyTotalTimeout();
146
189
  this.applyAbort();
147
190
  }
148
191
  /**
@@ -161,10 +204,10 @@ export class LazyPromise {
161
204
  return this.promise.then(onfulfilled, onrejected);
162
205
  }
163
206
  /**
164
- * The <i>setRetryAttempts</i> method is used for setting max retry attempts.
165
- * @example
207
+ * The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
166
208
  * ```ts
167
- * import { LazyPromise } from "@daiso-tech/core";
209
+ * import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
210
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
168
211
  *
169
212
  * const promise =
170
213
  * new LazyPromise(async () => {
@@ -172,21 +215,23 @@ export class LazyPromise {
172
215
  * throw new Error("Error occured!");
173
216
  * })
174
217
  * .setRetryAttempts(3)
175
- * (async () => {
176
- * // Will log "A" 3 times and then retry error will be thrown.
177
- * await promise;
178
- * })();
218
+ * .setBackoffPolicy(linearBackoffPolicy())
219
+ *
220
+ * // Will log "A" 3 times and then retry error will be thrown.
221
+ * await promise;
179
222
  * ```
180
223
  */
181
- setRetryAttempts(attempts) {
182
- this.attempts = attempts;
183
- return this;
224
+ setBackoffPolicy(policy) {
225
+ return new LazyPromise(this.asyncFn, {
226
+ ...this.settings,
227
+ backoffPolicy: policy,
228
+ });
184
229
  }
185
230
  /**
186
- * The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
231
+ * The <i>setRetryAttempts</i> method is used for setting max retry attempts.
187
232
  * @example
188
233
  * ```ts
189
- * import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core";
234
+ * import { LazyPromise } from "@daiso-tech/core/async";
190
235
  *
191
236
  * const promise =
192
237
  * new LazyPromise(async () => {
@@ -194,22 +239,22 @@ export class LazyPromise {
194
239
  * throw new Error("Error occured!");
195
240
  * })
196
241
  * .setRetryAttempts(3)
197
- * .setBackoffPolicy(linearBackoffPolicy())
198
- * (async () => {
199
- * // Will log "A" 3 times and then retry error will be thrown.
200
- * await promise;
201
- * })();
242
+ *
243
+ * // Will log "A" 3 times and then retry error will be thrown.
244
+ * await promise;
202
245
  * ```
203
246
  */
204
- setBackoffPolicy(policy) {
205
- this.backoffPolicy_ = policy;
206
- return this;
247
+ setRetryAttempts(attempts) {
248
+ return new LazyPromise(this.asyncFn, {
249
+ ...this.settings,
250
+ retryAttempts: attempts,
251
+ });
207
252
  }
208
253
  /**
209
254
  * The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
210
255
  * @example
211
256
  * ```ts
212
- * import { LazyPromise } from "@daiso-tech/core";
257
+ * import { LazyPromise } from "@daiso-tech/core/async";
213
258
  *
214
259
  * class ErrorA extends Error {}
215
260
  *
@@ -221,113 +266,149 @@ export class LazyPromise {
221
266
  * .setRetryAttempts(3)
222
267
  * // Will only retry an error that is instance ErrorA
223
268
  * .setRetryPolicy(error => error instanceof ErrorA)
224
- * (async () => {
225
- * // Will log "A" 1 time and then error will be thrown.
226
- * await promise;
227
- * })();
269
+ *
270
+ * // Will log "A" 1 time and then error will be thrown.
271
+ * await promise;
228
272
  * ```
229
273
  */
230
274
  setRetryPolicy(policy) {
231
- this.retryPolicy_ = policy;
232
- return this;
275
+ return new LazyPromise(this.asyncFn, {
276
+ ...this.settings,
277
+ retryPolicy: policy,
278
+ });
233
279
  }
234
280
  /**
235
- * The <i>setTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
281
+ * The <i>setRetryTimeout</i> method aborts the each retry if it exceeds the given <i>time</i>.
236
282
  * @example
237
283
  * ```ts
238
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
284
+ * import { LazyPromise } from "@daiso-tech/core/async";
285
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
239
286
  *
240
287
  * const promise =
241
288
  * new LazyPromise(async () => {
242
- * await delay(TimeSpan.fromMinutes(1));
289
+ * await LazyPromise.delay(TimeSpan.fromMinutes(1));
243
290
  * })
244
- * .setTimeout(TimeSpan.fromSeconds(1));
245
- * (async () => {
246
- * // An timeout error will be thrown.
247
- * await promise;
248
- * })();
291
+ * .setRetryTimeout(TimeSpan.fromSeconds(1));
292
+ *
293
+ * // An timeout error will be thrown.
294
+ * await promise;
249
295
  * ```
250
296
  */
251
- setTimeout(time) {
252
- this.time = time;
253
- return this;
297
+ setRetryTimeout(time) {
298
+ return new LazyPromise(this.asyncFn, {
299
+ ...this.settings,
300
+ retryTimeout: time,
301
+ });
302
+ }
303
+ /**
304
+ * The <i>setTotalTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
305
+ * @example
306
+ * ```ts
307
+ * import { LazyPromise } from "@daiso-tech/core/async";
308
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
309
+ *
310
+ * const promise =
311
+ * new LazyPromise(async () => {
312
+ * await LazyPromise.delay(TimeSpan.fromMinutes(1));
313
+ * })
314
+ * .setRetryTimeout(TimeSpan.fromSeconds(1));
315
+ *
316
+ * // An timeout error will be thrown.
317
+ * await promise;
318
+ * ```
319
+ */
320
+ setTotalTimeout(time) {
321
+ return new LazyPromise(this.asyncFn, {
322
+ ...this.settings,
323
+ totalTimeout: time,
324
+ });
254
325
  }
255
326
  /**
256
327
  * The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
257
328
  * @example
258
329
  * ```ts
259
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
330
+ * import { LazyPromise } from "@daiso-tech/core";
331
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
260
332
  *
261
333
  * const abortController = new AbortController();
262
334
  * const promise =
263
335
  * new LazyPromise(async () => {
264
- * await delay(TimeSpan.fromMinutes(1));
336
+ * await LazyPromise.delay(TimeSpan.fromMinutes(1));
265
337
  * })
266
338
  * .setAbortSignal(abortController.signal);
267
- * (async () => {
268
- * setTimeout(() => {
269
- * abortController.abort();
270
- * }, 1000);
271
- * // An timeout error will be thrown.
272
- * await promise;
273
- * })();
339
+ *
340
+ * setTimeout(() => {
341
+ * abortController.abort();
342
+ * }, 1000);
343
+ *
344
+ * // An timeout error will be thrown.
345
+ * await promise;
274
346
  * ```
275
347
  */
276
348
  setAbortSignal(abortSignal) {
277
- this.abortSignal = abortSignal;
278
- return this;
349
+ return new LazyPromise(this.asyncFn, {
350
+ ...this.settings,
351
+ abortSignal,
352
+ });
353
+ }
354
+ onFinally(cb) {
355
+ return new LazyPromise(this.asyncFn, {
356
+ ...this.settings,
357
+ onFinally: cb,
358
+ });
359
+ }
360
+ onSuccess(cb) {
361
+ return new LazyPromise(this.asyncFn, {
362
+ ...this.settings,
363
+ onSuccess: cb,
364
+ });
365
+ }
366
+ onError(cb) {
367
+ return new LazyPromise(this.asyncFn, {
368
+ ...this.settings,
369
+ onError: cb,
370
+ });
279
371
  }
280
372
  /**
281
373
  * The <i>defer</i> method executes the <i>LazyPromise</i> without awaiting it.
282
374
  * @example
283
375
  * ```ts
284
- * import { LazyPromise, delay, TimeSpan } from "@daiso-tech/core";
376
+ * import { LazyPromise } from "@daiso-tech/core";
377
+ * import { TimeSpan } from "@daiso-tech/core/utilities";
285
378
  *
286
379
  * const promise =
287
380
  * new LazyPromise(async () => {
288
- * await delay(TimeSpan.fromSeconds(1));
381
+ * await LazyPromise.delay(TimeSpan.fromSeconds(1));
289
382
  * // Will be loged after one second
290
383
  * console.log("Done !");
291
384
  * });
385
+ *
292
386
  * promise.defer();
387
+ *
293
388
  * // Will be logged immediately
294
389
  * console.log("Hello");
390
+ * await LazyPromise.delay(TimeSpan.fromSeconds(2));
295
391
  * ```
296
392
  */
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
- }
393
+ defer() {
394
+ const onSuccesHandler = async (value) => {
395
+ try {
396
+ await this.settings.onSuccess(value);
397
+ return value;
398
+ }
399
+ finally {
400
+ await this.settings.onFinally();
401
+ }
402
+ };
403
+ const onErrorHandler = async (error) => {
404
+ try {
405
+ await this.settings.onError(error);
406
+ return error;
407
+ }
408
+ finally {
409
+ await this.settings.onFinally();
410
+ }
411
+ };
331
412
  this.then(onSuccesHandler, onErrorHandler);
332
413
  }
333
414
  }
@@ -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,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAS,QAA+B;QAC/C,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC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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,yBAAyB,EACzB,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA0DrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,CACT,EAA2C,EAC3C,QAAuC;QAEvC,OAAO,CAAC,GAAG,UAAU,EAAE,EAAE,CACrB,IAAI,WAAW,CAAU,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,QAAQ,CAAC,C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AM,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"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @module Async
3
3
  */
4
+ import { TimeSpan } from "../../../utilities/_module-exports.js";
4
5
  import type { BackoffPolicy } from "../../../async/backof-policies/_module.js";
5
6
  /**
6
7
  *
@@ -20,6 +21,7 @@ export type RetrySettings = {
20
21
  maxAttempts?: number;
21
22
  backoffPolicy?: BackoffPolicy;
22
23
  retryPolicy?: RetryPolicy;
24
+ timeout?: TimeSpan | null;
23
25
  };
24
26
  /**
25
27
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"retry-or-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/retry-or-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAwB1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,OAAkC,EAClC,WAA0B,EAAE;IAE5B,MAAM,EACF,WAAW,GAAG,CAAC,EACf,aAAa,GAAG,wBAAwB,EAAE,EAC1C,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,GAC3B,GAAG,QAAQ,CAAC;IACb,IAAI,MAAe,CAAC;IACpB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACtD,IAAI,CAAC;YACD,OAAO,MAAM,OAAO,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAc,EAAE,CAA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KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACtD,IAAI,CAAC;YACD,OAAO,MAAM,OAAO,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,GAAG,KAAK,CAAC;YACf,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;gBACnC,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;IAED,IAAI,YAAY,GAAG,oCAAoC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IACnF,IAAI,MAAM,EAAE,CAAC;QACT,YAAY,GAAG,GAAG,YAAY,+BAA+B,MAAM,CAAC,MAAiB,CAAC,GAAG,CAAC;IAC9F,CAAC;IACD,MAAM,IAAI,eAAe,CAAC,YAAY,EAAE;QACpC,KAAK,EAAE,MAAM;QACb,WAAW;KACd,CAAC,CAAC;AACP,CAAC"}
@@ -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
  };