@daiso-tech/core 0.10.0 → 0.12.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 (453) hide show
  1. package/dist/cjs/_module.js +2 -2
  2. package/dist/cjs/_module.js.map +1 -1
  3. package/dist/cjs/_shared/utilities.js +7 -0
  4. package/dist/cjs/_shared/utilities.js.map +1 -1
  5. package/dist/cjs/cache/contracts/_module.js +22 -0
  6. package/dist/cjs/cache/contracts/_module.js.map +1 -0
  7. package/dist/cjs/{storage/contracts/storage-adapter.contract.js → cache/contracts/cache-adapter.contract.js} +1 -1
  8. package/dist/cjs/cache/contracts/cache-adapter.contract.js.map +1 -0
  9. package/dist/cjs/{storage/contracts/storage-manager.contract.js → cache/contracts/cache-factory.contract.js} +1 -1
  10. package/dist/cjs/cache/contracts/cache-factory.contract.js.map +1 -0
  11. package/dist/cjs/{storage/contracts/storage.contract.js → cache/contracts/cache.contract.js} +1 -1
  12. package/dist/cjs/cache/contracts/cache.contract.js.map +1 -0
  13. package/dist/cjs/cache/contracts/cache.errors.js +32 -0
  14. package/dist/cjs/cache/contracts/cache.errors.js.map +1 -0
  15. package/dist/cjs/cache/contracts/cache.events.js +14 -0
  16. package/dist/cjs/cache/contracts/cache.events.js.map +1 -0
  17. package/dist/cjs/cache/implementations/_module.js +20 -0
  18. package/dist/cjs/cache/implementations/_module.js.map +1 -0
  19. package/dist/cjs/{event-bus/implementations/memory-event-bus-adapter → cache/implementations/_shared}/_module.js +1 -1
  20. package/dist/cjs/cache/implementations/_shared/_module.js.map +1 -0
  21. package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +192 -0
  22. package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -0
  23. package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +1009 -0
  24. package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -0
  25. package/dist/cjs/cache/implementations/adapters/_module.js +22 -0
  26. package/dist/cjs/cache/implementations/adapters/_module.js.map +1 -0
  27. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +18 -0
  28. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +1 -0
  29. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +291 -0
  30. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -0
  31. package/dist/cjs/{event-bus/implementations/redis-event-bus-adapter → cache/implementations/adapters/libsql-cache-adapter}/_module.js +1 -1
  32. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -0
  33. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +61 -0
  34. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -0
  35. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js +18 -0
  36. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -0
  37. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +72 -0
  38. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -0
  39. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js +18 -0
  40. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -0
  41. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +262 -0
  42. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -0
  43. package/dist/cjs/{event-bus/implementations/no-op-event-bus-adapter → cache/implementations/adapters/redis-cache-adapter}/_module.js +1 -1
  44. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -0
  45. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +147 -0
  46. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -0
  47. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js +18 -0
  48. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -0
  49. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +60 -0
  50. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -0
  51. package/dist/cjs/cache/implementations/derivables/_module.js +20 -0
  52. package/dist/cjs/cache/implementations/derivables/_module.js.map +1 -0
  53. package/dist/cjs/cache/implementations/derivables/base-cache.js +262 -0
  54. package/dist/cjs/cache/implementations/derivables/base-cache.js.map +1 -0
  55. package/dist/cjs/cache/implementations/derivables/cache-factory.js +39 -0
  56. package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -0
  57. package/dist/cjs/cache/implementations/derivables/cache.js +191 -0
  58. package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -0
  59. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
  60. package/dist/cjs/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  61. package/dist/cjs/event-bus/contracts/_module.js +2 -1
  62. package/dist/cjs/event-bus/contracts/_module.js.map +1 -1
  63. package/dist/cjs/event-bus/contracts/_shared.js +0 -36
  64. package/dist/cjs/event-bus/contracts/_shared.js.map +1 -1
  65. package/dist/cjs/event-bus/contracts/{event-bus-manager.contract.js → event-bus-factory.contract.js} +1 -1
  66. package/dist/cjs/event-bus/contracts/event-bus-factory.contract.js.map +1 -0
  67. package/dist/cjs/event-bus/contracts/event-bus.errors.js +39 -0
  68. package/dist/cjs/event-bus/contracts/event-bus.errors.js.map +1 -0
  69. package/dist/cjs/event-bus/implementations/_module.js +2 -4
  70. package/dist/cjs/event-bus/implementations/_module.js.map +1 -1
  71. package/dist/cjs/event-bus/implementations/adapters/_module.js +20 -0
  72. package/dist/cjs/event-bus/implementations/adapters/_module.js.map +1 -0
  73. package/dist/cjs/{storage/implementations/redis-storage-adapter → event-bus/implementations/adapters/memory-event-bus-adapter}/_module.js +1 -1
  74. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -0
  75. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
  76. package/dist/cjs/{storage/implementations/_shared/test-utilities → event-bus/implementations/adapters/no-op-event-bus-adapter}/_module.js +1 -1
  77. package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js.map +1 -0
  78. package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
  79. package/dist/cjs/{storage/implementations/memory-storage-adapter → event-bus/implementations/adapters/redis-event-bus-adapter}/_module.js +1 -1
  80. package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +1 -0
  81. package/dist/cjs/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.js +2 -2
  82. package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
  83. package/dist/cjs/event-bus/implementations/{event-bus → derivables}/_module.js +2 -2
  84. package/dist/cjs/event-bus/implementations/derivables/_module.js.map +1 -0
  85. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +39 -0
  86. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -0
  87. package/dist/cjs/event-bus/implementations/{event-bus → derivables}/event-bus.js +11 -8
  88. package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -0
  89. package/dist/cjs/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.js +1 -0
  90. package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +1 -0
  91. package/dist/cjs/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +1 -0
  92. package/dist/cjs/serializer/contracts/_module.js +1 -0
  93. package/dist/cjs/serializer/contracts/_module.js.map +1 -1
  94. package/dist/cjs/serializer/contracts/serializer.contract.js +0 -22
  95. package/dist/cjs/serializer/contracts/serializer.contract.js.map +1 -1
  96. package/dist/cjs/serializer/contracts/serializer.errors.js +25 -0
  97. package/dist/cjs/serializer/contracts/serializer.errors.js.map +1 -0
  98. package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js +3 -3
  99. package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +1 -1
  100. package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js +3 -3
  101. package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js.map +1 -1
  102. package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js +3 -3
  103. package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js.map +1 -1
  104. package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js +21 -21
  105. package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js.map +1 -1
  106. package/dist/cjs/utilities/_module.js +1 -0
  107. package/dist/cjs/utilities/_module.js.map +1 -1
  108. package/dist/cjs/utilities/global-errors.js +25 -0
  109. package/dist/cjs/utilities/global-errors.js.map +1 -0
  110. package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
  111. package/dist/esm/_module.js +2 -2
  112. package/dist/esm/_module.js.map +1 -1
  113. package/dist/esm/_shared/utilities.js +6 -0
  114. package/dist/esm/_shared/utilities.js.map +1 -1
  115. package/dist/esm/cache/contracts/_module.js +6 -0
  116. package/dist/esm/cache/contracts/_module.js.map +1 -0
  117. package/dist/esm/cache/contracts/cache-adapter.contract.js +1 -0
  118. package/dist/esm/cache/contracts/cache-adapter.contract.js.map +1 -0
  119. package/dist/esm/cache/contracts/cache-factory.contract.js +1 -0
  120. package/dist/esm/cache/contracts/cache-factory.contract.js.map +1 -0
  121. package/dist/esm/cache/contracts/cache.contract.js +1 -0
  122. package/dist/esm/cache/contracts/cache.contract.js.map +1 -0
  123. package/dist/esm/cache/contracts/cache.errors.js +25 -0
  124. package/dist/esm/cache/contracts/cache.errors.js.map +1 -0
  125. package/dist/esm/cache/contracts/cache.events.js +11 -0
  126. package/dist/esm/cache/contracts/cache.events.js.map +1 -0
  127. package/dist/esm/cache/implementations/_module.js +4 -0
  128. package/dist/esm/cache/implementations/_module.js.map +1 -0
  129. package/dist/esm/cache/implementations/_shared/_module.js +2 -0
  130. package/dist/esm/cache/implementations/_shared/_module.js.map +1 -0
  131. package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +189 -0
  132. package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -0
  133. package/dist/esm/cache/implementations/_shared/cache.test-suite.js +1006 -0
  134. package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -0
  135. package/dist/esm/cache/implementations/adapters/_module.js +6 -0
  136. package/dist/esm/cache/implementations/adapters/_module.js.map +1 -0
  137. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js +2 -0
  138. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.js.map +1 -0
  139. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +287 -0
  140. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -0
  141. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -0
  142. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -0
  143. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +57 -0
  144. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -0
  145. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js +2 -0
  146. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -0
  147. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +68 -0
  148. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -0
  149. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -0
  150. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -0
  151. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +255 -0
  152. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -0
  153. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js +2 -0
  154. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -0
  155. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +143 -0
  156. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -0
  157. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js +2 -0
  158. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -0
  159. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +56 -0
  160. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -0
  161. package/dist/esm/cache/implementations/derivables/_module.js +4 -0
  162. package/dist/esm/cache/implementations/derivables/_module.js.map +1 -0
  163. package/dist/esm/cache/implementations/derivables/base-cache.js +258 -0
  164. package/dist/esm/cache/implementations/derivables/base-cache.js.map +1 -0
  165. package/dist/esm/cache/implementations/derivables/cache-factory.js +35 -0
  166. package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -0
  167. package/dist/esm/cache/implementations/derivables/cache.js +187 -0
  168. package/dist/esm/cache/implementations/derivables/cache.js.map +1 -0
  169. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.js.map +1 -1
  170. package/dist/esm/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  171. package/dist/esm/event-bus/contracts/_module.js +2 -1
  172. package/dist/esm/event-bus/contracts/_module.js.map +1 -1
  173. package/dist/esm/event-bus/contracts/_shared.js +0 -30
  174. package/dist/esm/event-bus/contracts/_shared.js.map +1 -1
  175. package/dist/esm/event-bus/contracts/event-bus-factory.contract.js +1 -0
  176. package/dist/esm/event-bus/contracts/event-bus-factory.contract.js.map +1 -0
  177. package/dist/esm/event-bus/contracts/event-bus.errors.js +31 -0
  178. package/dist/esm/event-bus/contracts/event-bus.errors.js.map +1 -0
  179. package/dist/esm/event-bus/implementations/_module.js +2 -4
  180. package/dist/esm/event-bus/implementations/_module.js.map +1 -1
  181. package/dist/esm/event-bus/implementations/adapters/_module.js +4 -0
  182. package/dist/esm/event-bus/implementations/adapters/_module.js.map +1 -0
  183. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -0
  184. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -0
  185. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -0
  186. package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js +2 -0
  187. package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.js.map +1 -0
  188. package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -0
  189. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js +2 -0
  190. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +1 -0
  191. package/dist/esm/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.js +2 -2
  192. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +1 -0
  193. package/dist/esm/event-bus/implementations/derivables/_module.js +3 -0
  194. package/dist/esm/event-bus/implementations/derivables/_module.js.map +1 -0
  195. package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +35 -0
  196. package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -0
  197. package/dist/esm/event-bus/implementations/{event-bus → derivables}/event-bus.js +12 -9
  198. package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -0
  199. package/dist/esm/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.js +1 -0
  200. package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +1 -0
  201. package/dist/esm/event-bus/implementations/derivables/with-validation-event-bus-adapter.js.map +1 -0
  202. package/dist/esm/serializer/contracts/_module.js +1 -0
  203. package/dist/esm/serializer/contracts/_module.js.map +1 -1
  204. package/dist/esm/serializer/contracts/serializer.contract.js +0 -18
  205. package/dist/esm/serializer/contracts/serializer.contract.js.map +1 -1
  206. package/dist/esm/serializer/contracts/serializer.errors.js +19 -0
  207. package/dist/esm/serializer/contracts/serializer.errors.js.map +1 -0
  208. package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js +1 -1
  209. package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +1 -1
  210. package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js +1 -1
  211. package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js.map +1 -1
  212. package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js +1 -1
  213. package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js.map +1 -1
  214. package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js +1 -1
  215. package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js.map +1 -1
  216. package/dist/esm/utilities/_module.js +1 -0
  217. package/dist/esm/utilities/_module.js.map +1 -1
  218. package/dist/esm/utilities/global-errors.js +19 -0
  219. package/dist/esm/utilities/global-errors.js.map +1 -0
  220. package/dist/esm/utilities/time-span/time-span.js.map +1 -1
  221. package/dist/types/_module.d.ts +2 -2
  222. package/dist/types/_shared/types.d.ts +4 -0
  223. package/dist/types/_shared/utilities.d.ts +5 -1
  224. package/dist/types/cache/contracts/_module.d.ts +5 -0
  225. package/dist/types/cache/contracts/cache-adapter.contract.d.ts +44 -0
  226. package/dist/types/cache/contracts/cache-factory.contract.d.ts +48 -0
  227. package/dist/types/cache/contracts/cache.contract.d.ts +195 -0
  228. package/dist/types/{storage/contracts/_shared.d.ts → cache/contracts/cache.errors.d.ts} +5 -5
  229. package/dist/types/cache/contracts/cache.events.d.ts +96 -0
  230. package/dist/types/cache/implementations/_module.d.ts +3 -0
  231. package/dist/types/cache/implementations/_shared/_module.d.ts +1 -0
  232. package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +51 -0
  233. package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +60 -0
  234. package/dist/types/cache/implementations/adapters/_module.d.ts +5 -0
  235. package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/_module.d.ts +1 -0
  236. package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +55 -0
  237. package/dist/types/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +1 -0
  238. package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +35 -0
  239. package/dist/types/cache/implementations/adapters/memory-cache-adapter/_module.d.ts +1 -0
  240. package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +20 -0
  241. package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/_module.d.ts +1 -0
  242. package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +41 -0
  243. package/dist/types/cache/implementations/adapters/redis-cache-adapter/_module.d.ts +1 -0
  244. package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +37 -0
  245. package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +1 -0
  246. package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +35 -0
  247. package/dist/types/cache/implementations/derivables/_module.d.ts +3 -0
  248. package/dist/types/cache/implementations/derivables/base-cache.d.ts +57 -0
  249. package/dist/types/cache/implementations/derivables/cache-factory.d.ts +56 -0
  250. package/dist/types/cache/implementations/derivables/cache.d.ts +88 -0
  251. package/dist/types/collection/implementations/async-iterable-collection/_shared/async-error-handler-iterable.d.ts +3 -0
  252. package/dist/types/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -0
  253. package/dist/types/event-bus/contracts/_module.d.ts +2 -1
  254. package/dist/types/event-bus/contracts/_shared.d.ts +0 -30
  255. package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +78 -0
  256. package/dist/types/event-bus/contracts/event-bus.contract.d.ts +21 -18
  257. package/dist/types/event-bus/contracts/event-bus.errors.d.ts +33 -0
  258. package/dist/types/event-bus/implementations/_module.d.ts +2 -4
  259. package/dist/types/event-bus/implementations/adapters/_module.d.ts +3 -0
  260. package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/_module.d.ts +1 -0
  261. package/dist/types/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.d.ts +1 -1
  262. package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/_module.d.ts +1 -0
  263. package/dist/types/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.d.ts +3 -3
  264. package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/_module.d.ts +1 -0
  265. package/dist/types/event-bus/implementations/{redis-event-bus-adapter → adapters/redis-event-bus-adapter}/redis-event-bus-adapter.d.ts +2 -2
  266. package/dist/types/event-bus/implementations/derivables/_module.d.ts +2 -0
  267. package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +47 -0
  268. package/dist/types/event-bus/implementations/{event-bus → derivables}/event-bus.d.ts +8 -7
  269. package/dist/types/serializer/contracts/_module.d.ts +1 -0
  270. package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -18
  271. package/dist/types/serializer/contracts/serializer.errors.d.ts +21 -0
  272. package/dist/types/utilities/_module.d.ts +1 -0
  273. package/dist/types/utilities/global-errors.d.ts +12 -0
  274. package/dist/types/utilities/time-span/time-span.d.ts +2 -0
  275. package/package.json +12 -2
  276. package/dist/cjs/event-bus/contracts/event-bus-manager.contract.js.map +0 -1
  277. package/dist/cjs/event-bus/implementations/event-bus/_module.js.map +0 -1
  278. package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js +0 -31
  279. package/dist/cjs/event-bus/implementations/event-bus/event-bus-manager.js.map +0 -1
  280. package/dist/cjs/event-bus/implementations/event-bus/event-bus.js.map +0 -1
  281. package/dist/cjs/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +0 -1
  282. package/dist/cjs/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +0 -1
  283. package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/_module.js.map +0 -1
  284. package/dist/cjs/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +0 -1
  285. package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +0 -1
  286. package/dist/cjs/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +0 -1
  287. package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/_module.js.map +0 -1
  288. package/dist/cjs/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
  289. package/dist/cjs/storage/contracts/_module.js +0 -22
  290. package/dist/cjs/storage/contracts/_module.js.map +0 -1
  291. package/dist/cjs/storage/contracts/_shared.js +0 -32
  292. package/dist/cjs/storage/contracts/_shared.js.map +0 -1
  293. package/dist/cjs/storage/contracts/storage-adapter.contract.js.map +0 -1
  294. package/dist/cjs/storage/contracts/storage-events.contract.js +0 -14
  295. package/dist/cjs/storage/contracts/storage-events.contract.js.map +0 -1
  296. package/dist/cjs/storage/contracts/storage-manager.contract.js.map +0 -1
  297. package/dist/cjs/storage/contracts/storage.contract.js.map +0 -1
  298. package/dist/cjs/storage/implementations/_module.js +0 -23
  299. package/dist/cjs/storage/implementations/_module.js.map +0 -1
  300. package/dist/cjs/storage/implementations/_shared/test-utilities/_module.js.map +0 -1
  301. package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +0 -298
  302. package/dist/cjs/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +0 -1
  303. package/dist/cjs/storage/implementations/memory-storage-adapter/_module.js.map +0 -1
  304. package/dist/cjs/storage/implementations/memory-storage-adapter/memory-storage-adapter.js +0 -85
  305. package/dist/cjs/storage/implementations/memory-storage-adapter/memory-storage-adapter.js.map +0 -1
  306. package/dist/cjs/storage/implementations/mongodb-storage-adapter/_module.js +0 -6
  307. package/dist/cjs/storage/implementations/mongodb-storage-adapter/_module.js.map +0 -1
  308. package/dist/cjs/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -203
  309. package/dist/cjs/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js.map +0 -1
  310. package/dist/cjs/storage/implementations/redis-storage-adapter/_module.js.map +0 -1
  311. package/dist/cjs/storage/implementations/redis-storage-adapter/redis-storage-adapter.js +0 -228
  312. package/dist/cjs/storage/implementations/redis-storage-adapter/redis-storage-adapter.js.map +0 -1
  313. package/dist/cjs/storage/implementations/sqlite/_module.js +0 -19
  314. package/dist/cjs/storage/implementations/sqlite/_module.js.map +0 -1
  315. package/dist/cjs/storage/implementations/sqlite/_shared/_module.js +0 -18
  316. package/dist/cjs/storage/implementations/sqlite/_shared/_module.js.map +0 -1
  317. package/dist/cjs/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js +0 -190
  318. package/dist/cjs/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js.map +0 -1
  319. package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/_module.js +0 -18
  320. package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/_module.js.map +0 -1
  321. package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +0 -53
  322. package/dist/cjs/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +0 -1
  323. package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/_module.js +0 -18
  324. package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/_module.js.map +0 -1
  325. package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +0 -52
  326. package/dist/cjs/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +0 -1
  327. package/dist/cjs/storage/implementations/storage/_module.js +0 -19
  328. package/dist/cjs/storage/implementations/storage/_module.js.map +0 -1
  329. package/dist/cjs/storage/implementations/storage/storage-manager.js +0 -34
  330. package/dist/cjs/storage/implementations/storage/storage-manager.js.map +0 -1
  331. package/dist/cjs/storage/implementations/storage/storage.js +0 -265
  332. package/dist/cjs/storage/implementations/storage/storage.js.map +0 -1
  333. package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js +0 -255
  334. package/dist/cjs/storage/implementations/storage/with-event-storage-adapter.js.map +0 -1
  335. package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js +0 -53
  336. package/dist/cjs/storage/implementations/storage/with-namespace-storage-adapter.js.map +0 -1
  337. package/dist/cjs/storage/implementations/storage/with-validation-storage-adapter.js +0 -48
  338. package/dist/cjs/storage/implementations/storage/with-validation-storage-adapter.js.map +0 -1
  339. package/dist/esm/event-bus/contracts/event-bus-manager.contract.js +0 -1
  340. package/dist/esm/event-bus/contracts/event-bus-manager.contract.js.map +0 -1
  341. package/dist/esm/event-bus/implementations/event-bus/_module.js +0 -3
  342. package/dist/esm/event-bus/implementations/event-bus/_module.js.map +0 -1
  343. package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js +0 -27
  344. package/dist/esm/event-bus/implementations/event-bus/event-bus-manager.js.map +0 -1
  345. package/dist/esm/event-bus/implementations/event-bus/event-bus.js.map +0 -1
  346. package/dist/esm/event-bus/implementations/event-bus/with-namespace-event-bus-adapter.js.map +0 -1
  347. package/dist/esm/event-bus/implementations/event-bus/with-validation-event-bus-adapter.js.map +0 -1
  348. package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js +0 -2
  349. package/dist/esm/event-bus/implementations/memory-event-bus-adapter/_module.js.map +0 -1
  350. package/dist/esm/event-bus/implementations/memory-event-bus-adapter/memory-event-bus-adapter.js.map +0 -1
  351. package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js +0 -2
  352. package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/_module.js.map +0 -1
  353. package/dist/esm/event-bus/implementations/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +0 -1
  354. package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js +0 -2
  355. package/dist/esm/event-bus/implementations/redis-event-bus-adapter/_module.js.map +0 -1
  356. package/dist/esm/event-bus/implementations/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
  357. package/dist/esm/storage/contracts/_module.js +0 -6
  358. package/dist/esm/storage/contracts/_module.js.map +0 -1
  359. package/dist/esm/storage/contracts/_shared.js +0 -25
  360. package/dist/esm/storage/contracts/_shared.js.map +0 -1
  361. package/dist/esm/storage/contracts/storage-adapter.contract.js +0 -1
  362. package/dist/esm/storage/contracts/storage-adapter.contract.js.map +0 -1
  363. package/dist/esm/storage/contracts/storage-events.contract.js +0 -11
  364. package/dist/esm/storage/contracts/storage-events.contract.js.map +0 -1
  365. package/dist/esm/storage/contracts/storage-manager.contract.js +0 -1
  366. package/dist/esm/storage/contracts/storage-manager.contract.js.map +0 -1
  367. package/dist/esm/storage/contracts/storage.contract.js +0 -1
  368. package/dist/esm/storage/contracts/storage.contract.js.map +0 -1
  369. package/dist/esm/storage/implementations/_module.js +0 -7
  370. package/dist/esm/storage/implementations/_module.js.map +0 -1
  371. package/dist/esm/storage/implementations/_shared/test-utilities/_module.js +0 -2
  372. package/dist/esm/storage/implementations/_shared/test-utilities/_module.js.map +0 -1
  373. package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js +0 -295
  374. package/dist/esm/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.js.map +0 -1
  375. package/dist/esm/storage/implementations/memory-storage-adapter/_module.js +0 -2
  376. package/dist/esm/storage/implementations/memory-storage-adapter/_module.js.map +0 -1
  377. package/dist/esm/storage/implementations/memory-storage-adapter/memory-storage-adapter.js +0 -81
  378. package/dist/esm/storage/implementations/memory-storage-adapter/memory-storage-adapter.js.map +0 -1
  379. package/dist/esm/storage/implementations/mongodb-storage-adapter/_module.js +0 -2
  380. package/dist/esm/storage/implementations/mongodb-storage-adapter/_module.js.map +0 -1
  381. package/dist/esm/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js +0 -196
  382. package/dist/esm/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.js.map +0 -1
  383. package/dist/esm/storage/implementations/redis-storage-adapter/_module.js +0 -2
  384. package/dist/esm/storage/implementations/redis-storage-adapter/_module.js.map +0 -1
  385. package/dist/esm/storage/implementations/redis-storage-adapter/redis-storage-adapter.js +0 -224
  386. package/dist/esm/storage/implementations/redis-storage-adapter/redis-storage-adapter.js.map +0 -1
  387. package/dist/esm/storage/implementations/sqlite/_module.js +0 -3
  388. package/dist/esm/storage/implementations/sqlite/_module.js.map +0 -1
  389. package/dist/esm/storage/implementations/sqlite/_shared/_module.js +0 -2
  390. package/dist/esm/storage/implementations/sqlite/_shared/_module.js.map +0 -1
  391. package/dist/esm/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js +0 -186
  392. package/dist/esm/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.js.map +0 -1
  393. package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/_module.js +0 -2
  394. package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/_module.js.map +0 -1
  395. package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js +0 -49
  396. package/dist/esm/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.js.map +0 -1
  397. package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/_module.js +0 -2
  398. package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/_module.js.map +0 -1
  399. package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js +0 -48
  400. package/dist/esm/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.js.map +0 -1
  401. package/dist/esm/storage/implementations/storage/_module.js +0 -3
  402. package/dist/esm/storage/implementations/storage/_module.js.map +0 -1
  403. package/dist/esm/storage/implementations/storage/storage-manager.js +0 -30
  404. package/dist/esm/storage/implementations/storage/storage-manager.js.map +0 -1
  405. package/dist/esm/storage/implementations/storage/storage.js +0 -261
  406. package/dist/esm/storage/implementations/storage/storage.js.map +0 -1
  407. package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js +0 -251
  408. package/dist/esm/storage/implementations/storage/with-event-storage-adapter.js.map +0 -1
  409. package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js +0 -49
  410. package/dist/esm/storage/implementations/storage/with-namespace-storage-adapter.js.map +0 -1
  411. package/dist/esm/storage/implementations/storage/with-validation-storage-adapter.js +0 -44
  412. package/dist/esm/storage/implementations/storage/with-validation-storage-adapter.js.map +0 -1
  413. package/dist/types/event-bus/contracts/event-bus-manager.contract.d.ts +0 -120
  414. package/dist/types/event-bus/implementations/event-bus/_module.d.ts +0 -2
  415. package/dist/types/event-bus/implementations/event-bus/event-bus-manager.d.ts +0 -26
  416. package/dist/types/event-bus/implementations/memory-event-bus-adapter/_module.d.ts +0 -1
  417. package/dist/types/event-bus/implementations/no-op-event-bus-adapter/_module.d.ts +0 -1
  418. package/dist/types/event-bus/implementations/redis-event-bus-adapter/_module.d.ts +0 -1
  419. package/dist/types/storage/contracts/_module.d.ts +0 -5
  420. package/dist/types/storage/contracts/storage-adapter.contract.d.ts +0 -41
  421. package/dist/types/storage/contracts/storage-events.contract.d.ts +0 -91
  422. package/dist/types/storage/contracts/storage-manager.contract.d.ts +0 -100
  423. package/dist/types/storage/contracts/storage.contract.d.ts +0 -185
  424. package/dist/types/storage/implementations/_module.d.ts +0 -6
  425. package/dist/types/storage/implementations/_shared/test-utilities/_module.d.ts +0 -1
  426. package/dist/types/storage/implementations/_shared/test-utilities/storage-adapter.test-suite.d.ts +0 -36
  427. package/dist/types/storage/implementations/memory-storage-adapter/_module.d.ts +0 -1
  428. package/dist/types/storage/implementations/memory-storage-adapter/memory-storage-adapter.d.ts +0 -18
  429. package/dist/types/storage/implementations/mongodb-storage-adapter/_module.d.ts +0 -1
  430. package/dist/types/storage/implementations/mongodb-storage-adapter/mongodb-storage-adapter.d.ts +0 -43
  431. package/dist/types/storage/implementations/redis-storage-adapter/_module.d.ts +0 -1
  432. package/dist/types/storage/implementations/redis-storage-adapter/redis-storage-adapter.d.ts +0 -38
  433. package/dist/types/storage/implementations/sqlite/_module.d.ts +0 -2
  434. package/dist/types/storage/implementations/sqlite/_shared/_module.d.ts +0 -1
  435. package/dist/types/storage/implementations/sqlite/_shared/base-sqlite-storage-adapter.d.ts +0 -39
  436. package/dist/types/storage/implementations/sqlite/libsql-storage-adapter/_module.d.ts +0 -1
  437. package/dist/types/storage/implementations/sqlite/libsql-storage-adapter/libsql-storage-adapter.d.ts +0 -30
  438. package/dist/types/storage/implementations/sqlite/sqlite-storage-adapter/_module.d.ts +0 -1
  439. package/dist/types/storage/implementations/sqlite/sqlite-storage-adapter/sqlite-storage-adapter.d.ts +0 -30
  440. package/dist/types/storage/implementations/storage/_module.d.ts +0 -2
  441. package/dist/types/storage/implementations/storage/storage-manager.d.ts +0 -29
  442. package/dist/types/storage/implementations/storage/storage.d.ts +0 -114
  443. package/dist/types/storage/implementations/storage/with-event-storage-adapter.d.ts +0 -31
  444. package/dist/types/storage/implementations/storage/with-namespace-storage-adapter.d.ts +0 -24
  445. package/dist/types/storage/implementations/storage/with-validation-storage-adapter.d.ts +0 -22
  446. /package/dist/cjs/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.js +0 -0
  447. /package/dist/cjs/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.js +0 -0
  448. /package/dist/cjs/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.js +0 -0
  449. /package/dist/esm/event-bus/implementations/{memory-event-bus-adapter → adapters/memory-event-bus-adapter}/memory-event-bus-adapter.js +0 -0
  450. /package/dist/esm/event-bus/implementations/{no-op-event-bus-adapter → adapters/no-op-event-bus-adapter}/no-op-event-bus-adapter.js +0 -0
  451. /package/dist/esm/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.js +0 -0
  452. /package/dist/types/event-bus/implementations/{event-bus → derivables}/with-namespace-event-bus-adapter.d.ts +0 -0
  453. /package/dist/types/event-bus/implementations/{event-bus → derivables}/with-validation-event-bus-adapter.d.ts +0 -0
@@ -0,0 +1,195 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import type { IListenable } from "../../event-bus/contracts/_module";
5
+ import type { OneOrMore } from "../../_shared/types";
6
+ import { type AsyncLazyable, type GetOrAddValue } from "../../_shared/types";
7
+ import type { AllCacheEvents } from "../../cache/contracts/_module";
8
+ import type { LazyPromise, TimeSpan } from "../../utilities/_module";
9
+ /**
10
+ * The <i>ICacheListenable</i> contract defines a way for listening <i>{@link ICache}</i> crud operations.
11
+ * @group Contracts
12
+ */
13
+ export type ICacheListenable<TType = unknown> = IListenable<AllCacheEvents<TType>>;
14
+ /**
15
+ * @group Contracts
16
+ */
17
+ export type WithTtlValue<TType> = {
18
+ value: TType;
19
+ /**
20
+ * You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
21
+ */
22
+ ttl?: TimeSpan | null;
23
+ };
24
+ /**
25
+ * The <i>ICache</i> contract defines a way for storing data as key-value pairs independent of data storage.
26
+ * It commes with more convient methods compared to <i>ICacheAdapter</i>.
27
+ * @group Contracts
28
+ */
29
+ export type ICache<TType = unknown> = ICacheListenable & {
30
+ /**
31
+ * The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
32
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
33
+ */
34
+ exists(key: string): LazyPromise<boolean>;
35
+ /**
36
+ * The <i>existsMany</i> method returns true for the <i>keys</i> that are found otherwise false will be returned.
37
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
38
+ */
39
+ existsMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
40
+ /**
41
+ * The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
42
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
43
+ */
44
+ missing(key: string): LazyPromise<boolean>;
45
+ /**
46
+ * The <i>missingMany</i> method returns true for the <i>keys</i> that are not found otherwise false will be returned.
47
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
48
+ */
49
+ missingMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
50
+ /**
51
+ * The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
52
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
53
+ */
54
+ get(key: string): LazyPromise<TType | null>;
55
+ /**
56
+ * The <i>getMany</i> returns the value for the <i>keys</i> that are found otherwise null will be returned.
57
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
58
+ */
59
+ getMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, TType | null>>;
60
+ /**
61
+ * The <i>getOr</i> method returns the value when <i>key</i> is found otherwise <i>defaultValue</i> will be returned.
62
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
63
+ */
64
+ getOr(key: string, defaultValue: AsyncLazyable<TType>): LazyPromise<TType>;
65
+ /**
66
+ * The <i>getOrMany</i> method returns the value for the keys that are found otherwise defaultValue will be returned.
67
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
68
+ */
69
+ getOrMany<TKeys extends string>(keysWithDefaults: Record<TKeys, AsyncLazyable<TType>>): LazyPromise<Record<TKeys, TType>>;
70
+ /**
71
+ * The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
72
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
73
+ * @throws {KeyNotFoundCacheError} {@link KeyNotFoundCacheError}
74
+ */
75
+ getOrFail(key: string): LazyPromise<TType>;
76
+ /**
77
+ * 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.
78
+ * You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
79
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
80
+ */
81
+ add(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
82
+ /**
83
+ * The <i>addMany</i> method adds new keys. Returns true for the keys that where added otherwise false will be returned.
84
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
85
+ */
86
+ addMany<TKeys extends string>(values: Record<TKeys, WithTtlValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
87
+ /**
88
+ * The <i>update</i> method updates the given <i>key</i> with given <i>value</i>. Returns true when key otherwise false will be returned.
89
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
90
+ */
91
+ update(key: string, value: TType): LazyPromise<boolean>;
92
+ /**
93
+ * The <i>updateMany</i> method updates the given keys. Returns true for the keys that where updated otherwise false will be returned.
94
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
95
+ */
96
+ updateMany<TKeys extends string>(values: Record<TKeys, TType>): LazyPromise<Record<TKeys, boolean>>;
97
+ /**
98
+ * The <i>put</i> method replaces the key with given <i>value</i> if found. If the <i>key</i> is not found it will just be added. True is returned if the key is found otherwise false will be returned.
99
+ * You can provide a <i>ttl</i> value. If null is passed, the item will not expire.
100
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
101
+ */
102
+ put(key: string, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
103
+ /**
104
+ * The <i>putMany</i> method replaces the keys that exists. Adds keys that do not exists. Return true for all the keys that where updated otherwise false is returned.
105
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
106
+ */
107
+ putMany<TKeys extends string>(values: Record<TKeys, WithTtlValue<TType>>): LazyPromise<Record<TKeys, boolean>>;
108
+ /**
109
+ * The <i>remove</i> method removes the given <i>key</i> when found. Returns true if the key is found otherwise false is returned.
110
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
111
+ */
112
+ remove(key: string): LazyPromise<boolean>;
113
+ /**
114
+ * The <i>removeMany</i> method removes keys. Returns true for the keys that are removed otherwise false is returned.
115
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
116
+ */
117
+ removeMany<TKeys extends string>(keys: TKeys[]): LazyPromise<Record<TKeys, boolean>>;
118
+ /**
119
+ * The <i>getAndRemove</i> method removes the given <i>key</i> and returns it when found otherwise null will be returned.
120
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
121
+ */
122
+ getAndRemove(key: string): LazyPromise<TType | null>;
123
+ /**
124
+ * The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
125
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
126
+ */
127
+ getOrAdd(key: string, valueToAdd: AsyncLazyable<GetOrAddValue<TType>>, ttl?: TimeSpan | null): LazyPromise<TType>;
128
+ /**
129
+ * The <i>increment</i> method will increment the given <i>key</i> if found otherwise nonthing will occur.
130
+ * Returns true if key is incremented otherwise false will be returned.
131
+ * An error will thrown if the key is not a number.
132
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
133
+ * @throws {TypeCacheError} {@link TypeCacheError}
134
+ */
135
+ increment(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
136
+ /**
137
+ * The <i>decrement</i> method will decrement the given <i>key</i> if found otherwise nonthing will occur.
138
+ * Returns true if key exists otherwise false will be returned.
139
+ * An error will thrown if the key is not a number.
140
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
141
+ * @throws {TypeCacheError} {@link TypeCacheError}
142
+ * An error will thrown if the key is not a number.
143
+ */
144
+ decrement(key: string, value?: Extract<TType, number>): LazyPromise<boolean>;
145
+ /**
146
+ * The <i>clear</i> method removes all the keys in the cache.
147
+ * @throws {UnexpectedCacheError} {@link UnexpectedCacheError}
148
+ */
149
+ clear(): LazyPromise<void>;
150
+ /**
151
+ * The <i>getNamespace</i> method returns the complete namespace.
152
+ * @example
153
+ * ```ts
154
+ * import type { ICache } from "@daiso-tech/core";
155
+ *
156
+ * async function main(cache: ICache) {
157
+ * // Will be "@root"
158
+ * console.log(cache.getNamespace())
159
+ *
160
+ * const cacheA = cache.withNamespace("a");
161
+ *
162
+ * // Will be "@root/a"
163
+ * console.log(cacheA.getNamespace())
164
+ * }
165
+ * ```
166
+ */
167
+ getNamespace(): string;
168
+ };
169
+ /**
170
+ * The <i>INamespacedCache</i> contract defines a way for storing data as key-value pairs independent of data storage.
171
+ * It commes with one extra method which is useful for multitennat applications compared to <i>ICache</i>.
172
+ * @group Contracts
173
+ */
174
+ export type INamespacedCache<TType = unknown> = ICache<TType> & {
175
+ /**
176
+ * The <i>withNamespace</i> method returns new instance of <i>{@link ICache}</i> where all the keys will be prefixed with a given <i>namespace</i>.
177
+ * This useful for multitennat applications.
178
+ * @example
179
+ * ```ts
180
+ * import { type ICache } from "@daiso-tech/core";
181
+ *
182
+ * async function main(cache: ICache): Promise<void> {
183
+ * const cacheA = cache.withNamespace("a");
184
+ * await cacheA.add("a", 1);
185
+ *
186
+ * const cacheB = cache.withNamespace("b");
187
+ * await cacheB.add("b", 2);
188
+ *
189
+ * // Will print { a: 1, b: null }
190
+ * console.log(await cacheA.getMany(["a", "b"]));
191
+ * }
192
+ * ```
193
+ */
194
+ withNamespace(namespace: OneOrMore<string>): ICache<TType>;
195
+ };
@@ -1,27 +1,27 @@
1
1
  /**
2
- * @module Storage
2
+ * @module Cache
3
3
  */
4
4
  /**
5
5
  * @group Errors
6
6
  */
7
- export declare class StorageError extends Error {
7
+ export declare class CacheError extends Error {
8
8
  constructor(message: string, cause?: unknown);
9
9
  }
10
10
  /**
11
11
  * @group Errors
12
12
  */
13
- export declare class UnexpectedStorageError extends StorageError {
13
+ export declare class UnexpectedCacheError extends CacheError {
14
14
  constructor(message: string, cause?: unknown);
15
15
  }
16
16
  /**
17
17
  * @group Errors
18
18
  */
19
- export declare class TypeStorageError extends StorageError {
19
+ export declare class TypeCacheError extends CacheError {
20
20
  constructor(message: string, cause?: unknown);
21
21
  }
22
22
  /**
23
23
  * @group Errors
24
24
  */
25
- export declare class KeyNotFoundStorageError extends StorageError {
25
+ export declare class KeyNotFoundCacheError extends CacheError {
26
26
  constructor(message: string, cause?: unknown);
27
27
  }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import type { TimeSpan } from "../../utilities/_module";
5
+ import type { ICacheAdapter } from "../../cache/contracts/cache-adapter.contract";
6
+ /**
7
+ * Name of all the events of <i>{@link ICache}</i>.
8
+ * @group Events
9
+ */
10
+ export declare const CACHE_EVENTS: {
11
+ readonly KEY_FOUND: "key_found";
12
+ readonly KEY_NOT_FOUND: "key_not_found";
13
+ readonly KEY_ADDED: "key_added";
14
+ readonly KEY_UPDATED: "key_updated";
15
+ readonly KEY_REMOVED: "key_removed";
16
+ readonly KEYS_CLEARED: "keys_cleared";
17
+ readonly KEY_INCREMENTED: "key_incremented";
18
+ readonly KEY_DECREMENTED: "key_decremented";
19
+ };
20
+ /**
21
+ * @group Events
22
+ */
23
+ export type CacheEventNames = (typeof CACHE_EVENTS)[keyof typeof CACHE_EVENTS];
24
+ /**
25
+ * @group Events
26
+ */
27
+ export type CacheEvent = {
28
+ namespace: string;
29
+ adapter: ICacheAdapter<any>;
30
+ };
31
+ /**
32
+ * @group Events
33
+ */
34
+ export type KeyFoundCacheEvent<TType = unknown> = CacheEvent & {
35
+ type: (typeof CACHE_EVENTS)["KEY_FOUND"];
36
+ key: string;
37
+ value: TType;
38
+ };
39
+ /**
40
+ * @group Events
41
+ */
42
+ export type KeyNotFoundCacheEvent = CacheEvent & {
43
+ type: (typeof CACHE_EVENTS)["KEY_NOT_FOUND"];
44
+ key: string;
45
+ };
46
+ /**
47
+ * @group Events
48
+ */
49
+ export type KeyAddedCacheEvent<TType = unknown> = CacheEvent & {
50
+ type: (typeof CACHE_EVENTS)["KEY_ADDED"];
51
+ key: string;
52
+ value: TType;
53
+ ttl: TimeSpan | null;
54
+ };
55
+ /**
56
+ * @group Events
57
+ */
58
+ export type KeyUpdatedCacheEvent<TType = unknown> = CacheEvent & {
59
+ type: (typeof CACHE_EVENTS)["KEY_UPDATED"];
60
+ key: string;
61
+ value: TType;
62
+ };
63
+ /**
64
+ * @group Events
65
+ */
66
+ export type KeyIncrementedCacheEvent = CacheEvent & {
67
+ type: (typeof CACHE_EVENTS)["KEY_INCREMENTED"];
68
+ key: string;
69
+ value: number;
70
+ };
71
+ /**
72
+ * @group Events
73
+ */
74
+ export type KeyDecrementedCacheEvent = CacheEvent & {
75
+ type: (typeof CACHE_EVENTS)["KEY_DECREMENTED"];
76
+ key: string;
77
+ value: number;
78
+ };
79
+ /**
80
+ * @group Events
81
+ */
82
+ export type KeyRemovedCacheEvent = CacheEvent & {
83
+ type: (typeof CACHE_EVENTS)["KEY_REMOVED"];
84
+ key: string;
85
+ };
86
+ /**
87
+ * This event will be triggered when cache is cleared.
88
+ * @group Events
89
+ */
90
+ export type KeysClearedCacheEvent = CacheEvent & {
91
+ type: (typeof CACHE_EVENTS)["KEYS_CLEARED"];
92
+ };
93
+ /**
94
+ * @group Events
95
+ */
96
+ export type AllCacheEvents<TType> = KeyFoundCacheEvent<TType> | KeyNotFoundCacheEvent | KeyAddedCacheEvent<TType> | KeyUpdatedCacheEvent<TType> | KeyRemovedCacheEvent | KeysClearedCacheEvent | KeyIncrementedCacheEvent | KeyDecrementedCacheEvent;
@@ -0,0 +1,3 @@
1
+ export * from "../../cache/implementations/_shared/_module";
2
+ export * from "../../cache/implementations/adapters/_module";
3
+ export * from "../../cache/implementations/derivables/_module";
@@ -0,0 +1 @@
1
+ export * from "../../../cache/implementations/_shared/cache-adapter.test-suite";
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
5
+ import { type ICacheAdapter } from "../../../cache/contracts/_module";
6
+ import { type Promisable } from "../../../_shared/types";
7
+ /**
8
+ * @group Utilities
9
+ */
10
+ export type CacheAdapterTestSuiteSettings = {
11
+ expect: ExpectStatic;
12
+ test: TestAPI;
13
+ describe: SuiteAPI;
14
+ beforeEach: typeof beforeEach;
15
+ createAdapter: () => Promisable<ICacheAdapter>;
16
+ };
17
+ /**
18
+ * The <i>cacheAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link ICacheAdapter}</i>.
19
+ * @group Utilities
20
+ * @example
21
+ * ```ts
22
+ * import { afterEach, beforeEach, describe, expect, test } from "vitest";
23
+ * import { cacheAdapterTestSuite, SqliteCacheAdapter } from "@daiso-tech/core";
24
+ * import Sqlite, { type Database } from "better-sqlite3";
25
+ *
26
+ * describe("class: SqliteCacheAdapter", () => {
27
+ * let database: Database;
28
+ * beforeEach(() => {
29
+ * database = new Sqlite(":memory:");
30
+ * });
31
+ * afterEach(() => {
32
+ * database.close();
33
+ * });
34
+ * cacheAdapterTestSuite({
35
+ * createAdapter: async () => {
36
+ * const cacheAdapter = new SqliteCacheAdapter(database, {
37
+ * tableName: "custom_table",
38
+ * enableTransactions: true,
39
+ * });
40
+ * await cacheAdapter.init();
41
+ * return cacheAdapter;
42
+ * },
43
+ * test,
44
+ * beforeEach,
45
+ * expect,
46
+ * describe,
47
+ * });
48
+ * });
49
+ * ```
50
+ */
51
+ export declare function cacheAdapterTestSuite(settings: CacheAdapterTestSuiteSettings): void;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
5
+ import { type ICache } from "../../../cache/contracts/_module";
6
+ import { type Promisable } from "../../../_shared/types";
7
+ /**
8
+ * @group Utilities
9
+ * @example
10
+ * ```ts
11
+ * import { afterEach, beforeEach, describe, expect, test } from "vitest";
12
+ * import { cacheAdapterTestSuite, SqliteCacheAdapter } from "@daiso-tech/core";
13
+ * import Sqlite, { type Database } from "better-sqlite3";
14
+ *
15
+ * describe("class: Cache", () => {
16
+ * let database: Database;
17
+ * beforeEach(() => {
18
+ * database = new Sqlite(":memory:");
19
+ * });
20
+ * afterEach(() => {
21
+ * database.close();
22
+ * });
23
+ * cacheAdapterTestSuite({
24
+ * createCacheA: async () => {
25
+ * const cacheAdapterA = new SqliteCacheAdapter(database, {
26
+ * tableName: "custom_table",
27
+ * enableTransactions: true,
28
+ * });
29
+ * await cacheAdapterA.init();
30
+ * return new Cache(cacheAdapterA, {
31
+ * rootNamespace: "@a"
32
+ * });
33
+ * },
34
+ * createCacheB: async () => {
35
+ * const cacheAdapterB = new SqliteCacheAdapter(database, {
36
+ * tableName: "custom_table",
37
+ * enableTransactions: true,
38
+ * });
39
+ * await cacheAdapterB.init();
40
+ * return new Cache(cacheAdapterB, {
41
+ * rootNamespace: "@b"
42
+ * });
43
+ * },
44
+ * test,
45
+ * beforeEach,
46
+ * expect,
47
+ * describe,
48
+ * });
49
+ * });
50
+ * ```
51
+ */
52
+ export type CacheTestSuiteSettings = {
53
+ expect: ExpectStatic;
54
+ test: TestAPI;
55
+ describe: SuiteAPI;
56
+ beforeEach: typeof beforeEach;
57
+ createCacheA: () => Promisable<ICache>;
58
+ createCacheB: () => Promisable<ICache>;
59
+ };
60
+ export declare function cacheTestSuite(settings: CacheTestSuiteSettings): void;
@@ -0,0 +1,5 @@
1
+ export * from "../../../cache/implementations/adapters/libsql-cache-adapter/_module";
2
+ export * from "../../../cache/implementations/adapters/memory-cache-adapter/_module";
3
+ export * from "../../../cache/implementations/adapters/mongodb-cache-adapter/_module";
4
+ export * from "../../../cache/implementations/adapters/redis-cache-adapter/_module";
5
+ export * from "../../../cache/implementations/adapters/sqlite-cache-adapter/_module";
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type ICacheAdapter } from "../../../../cache/contracts/_module";
5
+ import { type Kysely } from "kysely";
6
+ import { type ISerializer } from "../../../../serializer/contracts/_module";
7
+ import type { IDeinitizable, IInitizable } from "../../../../_shared/types";
8
+ import { TimeSpan } from "../../../../utilities/_module";
9
+ /**
10
+ * @internal
11
+ */
12
+ type KyselySqliteCacheTable = {
13
+ key: string;
14
+ value: string;
15
+ expiresAt: number | null;
16
+ };
17
+ /**
18
+ * @internal
19
+ */
20
+ type KyselySqliteTables = {
21
+ cache: KyselySqliteCacheTable;
22
+ };
23
+ /**
24
+ * @internal
25
+ */
26
+ type KyselySqliteSettings = {
27
+ serializer: ISerializer<string>;
28
+ enableTransactions: boolean;
29
+ expiredKeysRemovalInterval?: TimeSpan;
30
+ shouldRemoveExpiredKeys?: boolean;
31
+ };
32
+ /**
33
+ * @internal
34
+ */
35
+ export declare class KyselySqliteCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
36
+ private readonly db;
37
+ private readonly serializer;
38
+ private readonly enableTransactions;
39
+ private readonly expiredKeysRemovalInterval;
40
+ private readonly shouldRemoveExpiredKeys;
41
+ private timeoutId;
42
+ constructor(db: Kysely<KyselySqliteTables>, settings: KyselySqliteSettings);
43
+ private withTransaction;
44
+ removeExpiredKeys(): Promise<void>;
45
+ init(): Promise<void>;
46
+ deInit(): Promise<void>;
47
+ get(key: string): Promise<TType | null>;
48
+ add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
49
+ update(key: string, value: TType): Promise<boolean>;
50
+ put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
51
+ remove(key: string): Promise<boolean>;
52
+ increment(key: string, value: number): Promise<boolean>;
53
+ clear(prefix: string): Promise<void>;
54
+ }
55
+ export {};
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter";
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import type { IDeinitizable, IInitizable } from "../../../../_shared/types";
5
+ import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
6
+ import type { ISerializer } from "../../../../serializer/contracts/_module";
7
+ import type { TimeSpan } from "../../../../utilities/_module";
8
+ import type { Client } from "@libsql/client";
9
+ /**
10
+ * @group Adapters
11
+ */
12
+ export type LibsqlCacheAdapterSettings = {
13
+ tableName?: string;
14
+ serializer?: ISerializer<string>;
15
+ enableTransactions?: boolean;
16
+ expiredKeysRemovalInterval?: TimeSpan;
17
+ shouldRemoveExpiredKeys?: boolean;
18
+ };
19
+ /**
20
+ * @group Adapters
21
+ */
22
+ export declare class LibsqlCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable, IDeinitizable {
23
+ private readonly cacheAdapter;
24
+ constructor(client: Client, settings?: LibsqlCacheAdapterSettings);
25
+ removeExpiredKeys(): Promise<void>;
26
+ deInit(): Promise<void>;
27
+ init(): Promise<void>;
28
+ get(key: string): Promise<TType | null>;
29
+ add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
30
+ update(key: string, value: TType): Promise<boolean>;
31
+ put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
32
+ remove(key: string): Promise<boolean>;
33
+ increment(key: string, value: number): Promise<boolean>;
34
+ clear(prefix: string): Promise<void>;
35
+ }
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
5
+ import type { TimeSpan } from "../../../../utilities/_module";
6
+ /**
7
+ * @group Adapters
8
+ */
9
+ export declare class MemoryCacheAdapter<TType> implements ICacheAdapter<TType> {
10
+ private readonly map;
11
+ constructor(map?: Map<string, TType>);
12
+ private readonly timeoutIdMap;
13
+ get(key: string): Promise<TType | null>;
14
+ add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
15
+ update(key: string, value: TType): Promise<boolean>;
16
+ put(key: string, value: TType, _ttl: TimeSpan | null): Promise<boolean>;
17
+ remove(key: string): Promise<boolean>;
18
+ increment(key: string, value: number): Promise<boolean>;
19
+ clear(prefix: string): Promise<void>;
20
+ }
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter";
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
5
+ import type { TimeSpan } from "../../../../utilities/_module";
6
+ import type { IInitizable } from "../../../../_shared/types";
7
+ import type { ObjectId } from "mongodb";
8
+ import { type Collection } from "mongodb";
9
+ import type { ISerializer } from "../../../../serializer/contracts/_module";
10
+ /**
11
+ * @group Adapters
12
+ */
13
+ export type MongodbCacheDocument = {
14
+ _id: ObjectId;
15
+ key: string;
16
+ value: number | string;
17
+ expiresAt: Date | null;
18
+ };
19
+ /**
20
+ * @group Adapters
21
+ */
22
+ export type MongodbCacheAdapterSettings = {
23
+ serializer?: ISerializer<string>;
24
+ };
25
+ /**
26
+ * @group Adapters
27
+ */
28
+ export declare class MongodbCacheAdapter<TType> implements ICacheAdapter<TType>, IInitizable {
29
+ private readonly collection;
30
+ private static isMongodbIncrementError;
31
+ private serializer;
32
+ constructor(collection: Collection<MongodbCacheDocument>, { serializer, }?: MongodbCacheAdapterSettings);
33
+ init(): Promise<void>;
34
+ get(key: string): Promise<TType | null>;
35
+ add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
36
+ update(key: string, value: TType): Promise<boolean>;
37
+ put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
38
+ remove(key: string): Promise<boolean>;
39
+ increment(key: string, value: number): Promise<boolean>;
40
+ clear(prefix: string): Promise<void>;
41
+ }
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @module Cache
3
+ */
4
+ import { type ICacheAdapter } from "../../../../cache/contracts/cache-adapter.contract";
5
+ import type { TimeSpan } from "../../../../utilities/_module";
6
+ import { type Redis, type Result } from "ioredis";
7
+ import type { ISerializer } from "../../../../serializer/contracts/_module";
8
+ declare module "ioredis" {
9
+ interface RedisCommander<Context> {
10
+ daiso_storage_increment(key: string, number: string): Result<number, Context>;
11
+ daiso_storage_put(key: string, value: string): Result<string, Context>;
12
+ daiso_storage_getOrAdd(key: string, valueToAdd: string): Result<string, Context>;
13
+ }
14
+ }
15
+ /**
16
+ * @group Adapters
17
+ */
18
+ export type RedisCacheAdapterSettings = {
19
+ serializer?: ISerializer<string>;
20
+ };
21
+ /**
22
+ * @group Adapters
23
+ */
24
+ export declare class RedisCacheAdapter<TType> implements ICacheAdapter<TType> {
25
+ private readonly client;
26
+ private static isRedisTypeError;
27
+ private serializer;
28
+ constructor(client: Redis, { serializer, }?: RedisCacheAdapterSettings);
29
+ get(key: string): Promise<TType | null>;
30
+ add(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
31
+ update(key: string, value: TType): Promise<boolean>;
32
+ put(key: string, value: TType, ttl: TimeSpan | null): Promise<boolean>;
33
+ remove(key: string): Promise<boolean>;
34
+ private initIncrementCommand;
35
+ increment(key: string, value: number): Promise<boolean>;
36
+ clear(prefix: string): Promise<void>;
37
+ }
@@ -0,0 +1 @@
1
+ export * from "../../../../cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter";