@daiso-tech/core 0.33.0 → 0.35.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 (365) hide show
  1. package/README.md +66 -45
  2. package/dist/async/_module-exports.d.ts +1 -1
  3. package/dist/async/_module-exports.js +1 -1
  4. package/dist/async/_module-exports.js.map +1 -1
  5. package/dist/async/async.errors.d.ts +27 -19
  6. package/dist/async/async.errors.js +33 -20
  7. package/dist/async/async.errors.js.map +1 -1
  8. package/dist/async/backof-policies/_shared.d.ts +6 -2
  9. package/dist/async/backof-policies/_shared.js +1 -0
  10. package/dist/async/backof-policies/_shared.js.map +1 -1
  11. package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +2 -2
  12. package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
  13. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +2 -2
  14. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
  15. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +2 -2
  16. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
  17. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +2 -2
  18. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
  19. package/dist/async/middlewares/_module.d.ts +8 -0
  20. package/dist/async/middlewares/_module.js +9 -0
  21. package/dist/async/middlewares/_module.js.map +1 -0
  22. package/dist/async/middlewares/_shared.d.ts +10 -0
  23. package/dist/async/middlewares/_shared.js +5 -0
  24. package/dist/async/middlewares/_shared.js.map +1 -0
  25. package/dist/async/middlewares/bulkhead/_module.d.ts +1 -0
  26. package/dist/async/middlewares/bulkhead/_module.js +2 -0
  27. package/dist/async/middlewares/bulkhead/_module.js.map +1 -0
  28. package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +80 -0
  29. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +46 -0
  30. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +1 -0
  31. package/dist/async/middlewares/dynamic/_module.d.ts +1 -0
  32. package/dist/async/middlewares/dynamic/_module.js +2 -0
  33. package/dist/async/middlewares/dynamic/_module.js.map +1 -0
  34. package/dist/async/middlewares/dynamic/dynamic.middleware.d.ts +34 -0
  35. package/dist/async/middlewares/dynamic/dynamic.middleware.js +36 -0
  36. package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +1 -0
  37. package/dist/async/middlewares/fallback/_module.d.ts +1 -0
  38. package/dist/async/middlewares/fallback/_module.js +2 -0
  39. package/dist/async/middlewares/fallback/_module.js.map +1 -0
  40. package/dist/async/middlewares/fallback/fallback.middleware.d.ts +78 -0
  41. package/dist/async/middlewares/fallback/fallback.middleware.js +52 -0
  42. package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -0
  43. package/dist/async/middlewares/hedging/_module.d.ts +2 -0
  44. package/dist/async/middlewares/hedging/_module.js +3 -0
  45. package/dist/async/middlewares/hedging/_module.js.map +1 -0
  46. package/dist/async/middlewares/hedging/_shared.d.ts +93 -0
  47. package/dist/async/middlewares/hedging/_shared.js +5 -0
  48. package/dist/async/middlewares/hedging/_shared.js.map +1 -0
  49. package/dist/async/middlewares/hedging/concurrent-hedging/_module.d.ts +1 -0
  50. package/dist/async/middlewares/hedging/concurrent-hedging/_module.js +2 -0
  51. package/dist/async/middlewares/hedging/concurrent-hedging/_module.js.map +1 -0
  52. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +51 -0
  53. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +138 -0
  54. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +1 -0
  55. package/dist/async/middlewares/hedging/sequential-hedging/_module.d.ts +1 -0
  56. package/dist/async/middlewares/hedging/sequential-hedging/_module.js +2 -0
  57. package/dist/async/middlewares/hedging/sequential-hedging/_module.js.map +1 -0
  58. package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts +51 -0
  59. package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +104 -0
  60. package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +1 -0
  61. package/dist/async/middlewares/observe/_module.d.ts +1 -0
  62. package/dist/async/middlewares/observe/_module.js +2 -0
  63. package/dist/async/middlewares/observe/_module.js.map +1 -0
  64. package/dist/async/middlewares/observe/observe.middleware.d.ts +130 -0
  65. package/dist/async/middlewares/observe/observe.middleware.js +80 -0
  66. package/dist/async/middlewares/observe/observe.middleware.js.map +1 -0
  67. package/dist/async/middlewares/retry/_module.d.ts +1 -0
  68. package/dist/async/middlewares/retry/_module.js +2 -0
  69. package/dist/async/middlewares/retry/_module.js.map +1 -0
  70. package/dist/async/middlewares/retry/retry.middleware.d.ts +117 -0
  71. package/dist/async/middlewares/retry/retry.middleware.js +82 -0
  72. package/dist/async/middlewares/retry/retry.middleware.js.map +1 -0
  73. package/dist/async/middlewares/timeout/_module.d.ts +1 -0
  74. package/dist/async/middlewares/timeout/_module.js +2 -0
  75. package/dist/async/middlewares/timeout/_module.js.map +1 -0
  76. package/dist/async/middlewares/timeout/timeout.middleware.d.ts +83 -0
  77. package/dist/async/middlewares/timeout/timeout.middleware.js +60 -0
  78. package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -0
  79. package/dist/async/utilities/_module.d.ts +3 -4
  80. package/dist/async/utilities/_module.js +3 -4
  81. package/dist/async/utilities/_module.js.map +1 -1
  82. package/dist/async/utilities/abort-and-fail/_module.d.ts +1 -0
  83. package/dist/async/utilities/abort-and-fail/_module.js +2 -0
  84. package/dist/async/utilities/abort-and-fail/_module.js.map +1 -0
  85. package/dist/async/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
  86. package/dist/async/utilities/{abort → abort-and-fail}/abort-and-fail.js +6 -6
  87. package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
  88. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +37 -194
  89. package/dist/async/utilities/lazy-promise/lazy-promise.js +62 -359
  90. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  91. package/dist/async/utilities/promise-queue/_module.d.ts +1 -0
  92. package/dist/async/utilities/promise-queue/_module.js +2 -0
  93. package/dist/async/utilities/promise-queue/_module.js.map +1 -0
  94. package/dist/async/utilities/promise-queue/promise-queue.d.ts +32 -0
  95. package/dist/async/utilities/promise-queue/promise-queue.js +107 -0
  96. package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -0
  97. package/dist/async/utilities/timeout-and-fail/_module.d.ts +1 -0
  98. package/dist/async/utilities/timeout-and-fail/_module.js +2 -0
  99. package/dist/async/utilities/timeout-and-fail/_module.js.map +1 -0
  100. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
  101. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +19 -0
  102. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
  103. package/dist/cache/contracts/cache-adapter.contract.d.ts +14 -14
  104. package/dist/cache/contracts/cache-factory.contract.d.ts +3 -3
  105. package/dist/cache/contracts/cache.contract.d.ts +73 -73
  106. package/dist/cache/contracts/cache.errors.d.ts +7 -7
  107. package/dist/cache/contracts/cache.errors.js +7 -7
  108. package/dist/cache/contracts/cache.events.d.ts +54 -58
  109. package/dist/cache/contracts/cache.events.js +6 -104
  110. package/dist/cache/contracts/cache.events.js.map +1 -1
  111. package/dist/cache/contracts/database-cache-adapter.contract.d.ts +16 -16
  112. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +3 -3
  113. package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +2 -2
  114. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +3 -9
  115. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -9
  116. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  117. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +4 -4
  118. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
  119. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +2 -2
  120. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +2 -2
  121. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +3 -3
  122. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
  123. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +3 -3
  124. package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +2 -2
  125. package/dist/cache/implementations/derivables/cache/cache.d.ts +26 -27
  126. package/dist/cache/implementations/derivables/cache/cache.js +102 -91
  127. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  128. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +5 -4
  129. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +2 -1
  130. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  131. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +3 -3
  132. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +2 -2
  133. package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +3 -3
  134. package/dist/cache/implementations/test-utilities/cache.test-suite.js +140 -149
  135. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  136. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +3 -3
  137. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -2
  138. package/dist/collection/contracts/_shared/compartor.type.d.ts +1 -1
  139. package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +1 -1
  140. package/dist/collection/contracts/_shared/ensure-map.type.d.ts +1 -1
  141. package/dist/collection/contracts/_shared/ensure-record.type.d.ts +1 -1
  142. package/dist/collection/contracts/_shared/foreach.type.d.ts +2 -2
  143. package/dist/collection/contracts/_shared/map.type.d.ts +2 -2
  144. package/dist/collection/contracts/_shared/modifier.type.d.ts +2 -2
  145. package/dist/collection/contracts/_shared/predicate.type.d.ts +7 -7
  146. package/dist/collection/contracts/_shared/reduce.type.d.ts +2 -2
  147. package/dist/collection/contracts/_shared/tap.type.d.ts +2 -2
  148. package/dist/collection/contracts/_shared/transform.type.d.ts +2 -2
  149. package/dist/collection/contracts/async-collection.contract.d.ts +109 -198
  150. package/dist/collection/contracts/collection.contract.d.ts +103 -103
  151. package/dist/collection/contracts/collection.errors.d.ts +11 -11
  152. package/dist/collection/contracts/collection.errors.js +11 -11
  153. package/dist/collection/implementations/_shared.d.ts +8 -8
  154. package/dist/collection/implementations/_shared.js +8 -8
  155. package/dist/collection/implementations/async-iterable-collection/_shared/_module.d.ts +0 -4
  156. package/dist/collection/implementations/async-iterable-collection/_shared/_module.js +0 -4
  157. package/dist/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
  158. package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js +21 -19
  159. package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
  160. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +15 -19
  161. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +15 -30
  162. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  163. package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -3
  164. package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js +18 -20
  165. package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  166. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +11 -12
  167. package/dist/collection/implementations/iterable-collection/iterable-collection.js +11 -12
  168. package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  169. package/dist/collection/implementations/list-collection/list-collection.d.ts +11 -11
  170. package/dist/collection/implementations/list-collection/list-collection.js +24 -30
  171. package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
  172. package/dist/event-bus/contracts/_module-exports.d.ts +0 -1
  173. package/dist/event-bus/contracts/_module-exports.js +0 -1
  174. package/dist/event-bus/contracts/_module-exports.js.map +1 -1
  175. package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +13 -8
  176. package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +6 -7
  177. package/dist/event-bus/contracts/event-bus-factory.contract.js.map +1 -1
  178. package/dist/event-bus/contracts/event-bus.contract.d.ts +30 -41
  179. package/dist/event-bus/contracts/event-bus.errors.d.ts +8 -8
  180. package/dist/event-bus/contracts/event-bus.errors.js +8 -8
  181. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -3
  182. package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +3 -3
  183. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -2
  184. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -2
  185. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -3
  186. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +2 -2
  187. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +15 -15
  188. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +32 -32
  189. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  190. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +17 -10
  191. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +13 -6
  192. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  193. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +3 -5
  194. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +15 -22
  195. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
  196. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +3 -5
  197. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +189 -209
  198. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  199. package/dist/lock/contracts/database-lock-adapter.contract.d.ts +9 -9
  200. package/dist/lock/contracts/lock-adapter.contract.d.ts +7 -7
  201. package/dist/lock/contracts/lock-provider-factory.contract.d.ts +4 -4
  202. package/dist/lock/contracts/lock-provider.contract.d.ts +14 -14
  203. package/dist/lock/contracts/lock.contract.d.ts +22 -22
  204. package/dist/lock/contracts/lock.errors.d.ts +10 -10
  205. package/dist/lock/contracts/lock.errors.js +10 -10
  206. package/dist/lock/contracts/lock.events.d.ts +45 -54
  207. package/dist/lock/contracts/lock.events.js +9 -91
  208. package/dist/lock/contracts/lock.events.js.map +1 -1
  209. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +5 -5
  210. package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +4 -4
  211. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +3 -3
  212. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +3 -3
  213. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +5 -5
  214. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +4 -4
  215. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +2 -2
  216. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +2 -2
  217. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +3 -3
  218. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +3 -3
  219. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +5 -5
  220. package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +4 -4
  221. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +33 -33
  222. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +30 -30
  223. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  224. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +2 -2
  225. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  226. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +3 -3
  227. package/dist/lock/implementations/derivables/lock-provider/lock.js +77 -58
  228. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  229. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +5 -4
  230. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +2 -1
  231. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  232. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +3 -3
  233. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +2 -2
  234. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +3 -3
  235. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +2 -2
  236. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +3 -3
  237. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +214 -214
  238. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  239. package/dist/serde/contracts/deserializer.contract.d.ts +2 -2
  240. package/dist/serde/contracts/flexible-serde-adapter.contract.d.ts +4 -4
  241. package/dist/serde/contracts/flexible-serde.contract.d.ts +8 -19
  242. package/dist/serde/contracts/serde.contract.d.ts +2 -2
  243. package/dist/serde/contracts/serde.errors.d.ts +4 -4
  244. package/dist/serde/contracts/serde.errors.js +4 -4
  245. package/dist/serde/contracts/serializable.contract.d.ts +2 -2
  246. package/dist/serde/contracts/serializer.contract.d.ts +2 -2
  247. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
  248. package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -2
  249. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +1 -1
  250. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +1 -1
  251. package/dist/serde/implementations/derivables/serde.d.ts +4 -35
  252. package/dist/serde/implementations/derivables/serde.js +2 -47
  253. package/dist/serde/implementations/derivables/serde.js.map +1 -1
  254. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +3 -3
  255. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +2 -2
  256. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +3 -3
  257. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +2 -2
  258. package/dist/utilities/classes/_module.d.ts +1 -1
  259. package/dist/utilities/classes/_module.js +1 -1
  260. package/dist/utilities/classes/_module.js.map +1 -1
  261. package/dist/utilities/classes/hooks/_module.d.ts +3 -0
  262. package/dist/utilities/classes/hooks/_module.js +4 -0
  263. package/dist/utilities/classes/hooks/_module.js.map +1 -0
  264. package/dist/utilities/classes/hooks/async-hooks.d.ts +209 -0
  265. package/dist/utilities/classes/hooks/async-hooks.js +145 -0
  266. package/dist/utilities/classes/hooks/async-hooks.js.map +1 -0
  267. package/dist/utilities/classes/hooks/hooks.d.ts +139 -0
  268. package/dist/utilities/classes/hooks/hooks.js +116 -0
  269. package/dist/utilities/classes/hooks/hooks.js.map +1 -0
  270. package/dist/utilities/classes/hooks/types.d.ts +9 -0
  271. package/dist/utilities/classes/hooks/types.js +5 -0
  272. package/dist/utilities/classes/hooks/types.js.map +1 -0
  273. package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +3 -3
  274. package/dist/utilities/classes/key-prefixer/key-prefixer.js +4 -4
  275. package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
  276. package/dist/utilities/classes/time-span/time-span.d.ts +5 -5
  277. package/dist/utilities/classes/time-span/time-span.js +5 -5
  278. package/dist/utilities/contracts/_module.d.ts +0 -1
  279. package/dist/utilities/contracts/_module.js +0 -1
  280. package/dist/utilities/contracts/_module.js.map +1 -1
  281. package/dist/utilities/contracts/deinitizable.contract.d.ts +1 -1
  282. package/dist/utilities/contracts/initizable.contract.d.ts +1 -1
  283. package/dist/utilities/contracts/prunable.contract.d.ts +1 -1
  284. package/dist/utilities/contracts/serialized-error.contract.d.ts +1 -1
  285. package/dist/utilities/contracts/sqlite-database.contract.d.ts +2 -2
  286. package/dist/utilities/errors.d.ts +5 -5
  287. package/dist/utilities/errors.js +5 -5
  288. package/dist/utilities/functions/factory.js +3 -3
  289. package/dist/utilities/functions/factory.js.map +1 -1
  290. package/dist/utilities/functions/invokable.d.ts +9 -5
  291. package/dist/utilities/functions/invokable.js +12 -2
  292. package/dist/utilities/functions/invokable.js.map +1 -1
  293. package/dist/utilities/functions/lazy.d.ts +5 -0
  294. package/dist/utilities/functions/lazy.js +12 -3
  295. package/dist/utilities/functions/lazy.js.map +1 -1
  296. package/dist/utilities/types/async-iterable-value.type.d.ts +1 -1
  297. package/dist/utilities/types/at-least-one.type.d.ts +1 -1
  298. package/dist/utilities/types/factory.type.d.ts +8 -8
  299. package/dist/utilities/types/invokable.type.d.ts +3 -3
  300. package/dist/utilities/types/items.type.d.ts +1 -1
  301. package/dist/utilities/types/lazy.type.d.ts +5 -5
  302. package/dist/utilities/types/none-func.type.d.ts +1 -1
  303. package/dist/utilities/types/one-or-more.type.d.ts +1 -1
  304. package/dist/utilities/types/promiseable.type.d.ts +1 -1
  305. package/dist/utilities/types/result.type.d.ts +1 -1
  306. package/package.json +22 -2
  307. package/dist/async/async.events.d.ts +0 -105
  308. package/dist/async/async.events.js +0 -82
  309. package/dist/async/async.events.js.map +0 -1
  310. package/dist/async/utilities/abort/_module.d.ts +0 -2
  311. package/dist/async/utilities/abort/_module.js +0 -3
  312. package/dist/async/utilities/abort/_module.js.map +0 -1
  313. package/dist/async/utilities/abort/abort-and-fail.d.ts +0 -4
  314. package/dist/async/utilities/abort/abort-and-fail.js.map +0 -1
  315. package/dist/async/utilities/abort/abort.d.ts +0 -9
  316. package/dist/async/utilities/abort/abort.js +0 -18
  317. package/dist/async/utilities/abort/abort.js.map +0 -1
  318. package/dist/async/utilities/delay/_module.d.ts +0 -1
  319. package/dist/async/utilities/delay/_module.js +0 -2
  320. package/dist/async/utilities/delay/_module.js.map +0 -1
  321. package/dist/async/utilities/delay/delay.d.ts +0 -10
  322. package/dist/async/utilities/delay/delay.js +0 -34
  323. package/dist/async/utilities/delay/delay.js.map +0 -1
  324. package/dist/async/utilities/retry/_module.d.ts +0 -2
  325. package/dist/async/utilities/retry/_module.js +0 -3
  326. package/dist/async/utilities/retry/_module.js.map +0 -1
  327. package/dist/async/utilities/retry/retry-or-fail.d.ts +0 -29
  328. package/dist/async/utilities/retry/retry-or-fail.js +0 -39
  329. package/dist/async/utilities/retry/retry-or-fail.js.map +0 -1
  330. package/dist/async/utilities/retry/retry.d.ts +0 -10
  331. package/dist/async/utilities/retry/retry.js +0 -21
  332. package/dist/async/utilities/retry/retry.js.map +0 -1
  333. package/dist/async/utilities/timeout/_module.d.ts +0 -2
  334. package/dist/async/utilities/timeout/_module.js +0 -3
  335. package/dist/async/utilities/timeout/_module.js.map +0 -1
  336. package/dist/async/utilities/timeout/timeout-and-fail.d.ts +0 -5
  337. package/dist/async/utilities/timeout/timeout-and-fail.js +0 -28
  338. package/dist/async/utilities/timeout/timeout-and-fail.js.map +0 -1
  339. package/dist/async/utilities/timeout/timeout.d.ts +0 -10
  340. package/dist/async/utilities/timeout/timeout.js +0 -21
  341. package/dist/async/utilities/timeout/timeout.js.map +0 -1
  342. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -13
  343. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +0 -30
  344. package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
  345. package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +0 -13
  346. package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +0 -36
  347. package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +0 -1
  348. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.d.ts +0 -9
  349. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +0 -39
  350. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +0 -1
  351. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.d.ts +0 -13
  352. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +0 -52
  353. package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +0 -1
  354. package/dist/event-bus/contracts/_shared.d.ts +0 -12
  355. package/dist/event-bus/contracts/_shared.js +0 -15
  356. package/dist/event-bus/contracts/_shared.js.map +0 -1
  357. package/dist/utilities/classes/sync-event-bus/_module.d.ts +0 -1
  358. package/dist/utilities/classes/sync-event-bus/_module.js +0 -2
  359. package/dist/utilities/classes/sync-event-bus/_module.js.map +0 -1
  360. package/dist/utilities/classes/sync-event-bus/sync-event-bus.d.ts +0 -16
  361. package/dist/utilities/classes/sync-event-bus/sync-event-bus.js +0 -53
  362. package/dist/utilities/classes/sync-event-bus/sync-event-bus.js.map +0 -1
  363. package/dist/utilities/contracts/sync-event-bus-listenable.d.ts +0 -13
  364. package/dist/utilities/contracts/sync-event-bus-listenable.js +0 -5
  365. package/dist/utilities/contracts/sync-event-bus-listenable.js.map +0 -1
@@ -4,9 +4,9 @@
4
4
  import type { BaseEvent, EventListenerFn, IEventBusAdapter } from "../../../../event-bus/contracts/_module-exports.js";
5
5
  import { EventEmitter } from "node:events";
6
6
  /**
7
- * To utilize the <i>MemoryEventBusAdapter</i>, you must create instance of it.
7
+ * To utilize the `MemoryEventBusAdapter`, you must create instance of it.
8
8
  *
9
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
9
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
10
10
  * @group Adapters
11
11
  */
12
12
  export declare class MemoryEventBusAdapter implements IEventBusAdapter {
@@ -18,7 +18,7 @@ export declare class MemoryEventBusAdapter implements IEventBusAdapter {
18
18
  *
19
19
  * const eventBusAdapter = new MemoryEventBusAdapter();
20
20
  * ```
21
- * You can also provide an <i>{@link EventEmitter}</i> that will be used for storing the data.
21
+ * You can also provide an {@link EventEmitter | `EventEmitter`} that will be used for storing the data.
22
22
  * @example
23
23
  * ```ts
24
24
  * import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
@@ -3,9 +3,9 @@
3
3
  */
4
4
  import { EventEmitter } from "node:events";
5
5
  /**
6
- * To utilize the <i>MemoryEventBusAdapter</i>, you must create instance of it.
6
+ * To utilize the `MemoryEventBusAdapter`, you must create instance of it.
7
7
  *
8
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
8
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
9
9
  * @group Adapters
10
10
  */
11
11
  export class MemoryEventBusAdapter {
@@ -17,7 +17,7 @@ export class MemoryEventBusAdapter {
17
17
  *
18
18
  * const eventBusAdapter = new MemoryEventBusAdapter();
19
19
  * ```
20
- * You can also provide an <i>{@link EventEmitter}</i> that will be used for storing the data.
20
+ * You can also provide an {@link EventEmitter | `EventEmitter`} that will be used for storing the data.
21
21
  * @example
22
22
  * ```ts
23
23
  * import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
@@ -4,9 +4,9 @@
4
4
  import type { BaseEvent, EventListenerFn } from "../../../../event-bus/contracts/_module-exports.js";
5
5
  import type { IEventBusAdapter } from "../../../../event-bus/contracts/_module-exports.js";
6
6
  /**
7
- * This <i>NoOpEventBusAdapter</i> will do nothing and is used for easily mocking <i>{@link IEventBus}</i> for testing.
7
+ * This `NoOpEventBusAdapter` will do nothing and is used for easily mocking {@link IEventBus | `IEventBus`} for testing.
8
8
  *
9
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
9
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
10
10
  * @group Adapters
11
11
  */
12
12
  export declare class NoOpEventBusAdapter implements IEventBusAdapter {
@@ -2,9 +2,9 @@
2
2
  * @module EventBus
3
3
  */
4
4
  /**
5
- * This <i>NoOpEventBusAdapter</i> will do nothing and is used for easily mocking <i>{@link IEventBus}</i> for testing.
5
+ * This `NoOpEventBusAdapter` will do nothing and is used for easily mocking {@link IEventBus | `IEventBus`} for testing.
6
6
  *
7
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
7
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
8
8
  * @group Adapters
9
9
  */
10
10
  export class NoOpEventBusAdapter {
@@ -6,7 +6,7 @@ import type { BaseEvent, EventListenerFn, IEventBusAdapter } from "../../../../e
6
6
  import type { Redis } from "ioredis";
7
7
  /**
8
8
  *
9
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
9
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
10
10
  * @group Adapters
11
11
  */
12
12
  export type RedisPubSubEventBusAdapterSettings = {
@@ -15,9 +15,9 @@ export type RedisPubSubEventBusAdapterSettings = {
15
15
  serde: ISerde<string>;
16
16
  };
17
17
  /**
18
- * To utilize the <i>RedisPubSubEventBusAdapter</i>, you must install the <i>"ioredis"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, with a <i>{@link SuperJsonSerdeAdapter}</i>.
18
+ * To utilize the `RedisPubSubEventBusAdapter`, you must install the `"ioredis"` package and supply a {@link ISerde | `ISerde<string>`}, with a {@link SuperJsonSerdeAdapter | `SuperJsonSerdeAdapter `}.
19
19
  *
20
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
20
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
21
21
  * @group Adapters
22
22
  */
23
23
  export declare class RedisPubSubEventBusAdapter implements IEventBusAdapter {
@@ -7,9 +7,9 @@ import { RedisSerde,
7
7
  SuperJsonSerdeAdapter, } from "../../../../serde/implementations/adapters/_module-exports.js";
8
8
  import { EventEmitter } from "node:events";
9
9
  /**
10
- * To utilize the <i>RedisPubSubEventBusAdapter</i>, you must install the <i>"ioredis"</i> package and supply a <i>{@link ISerde | ISerde<string> }</i>, with a <i>{@link SuperJsonSerdeAdapter}</i>.
10
+ * To utilize the `RedisPubSubEventBusAdapter`, you must install the `"ioredis"` package and supply a {@link ISerde | `ISerde<string>`}, with a {@link SuperJsonSerdeAdapter | `SuperJsonSerdeAdapter `}.
11
11
  *
12
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/adapters"```
12
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/adapters"`
13
13
  * @group Adapters
14
14
  */
15
15
  export class RedisPubSubEventBusAdapter {
@@ -2,18 +2,18 @@
2
2
  * @module EventBus
3
3
  */
4
4
  import { LazyPromise } from "../../../../async/_module-exports.js";
5
- import type { EventClass, EventInstance, EventListener, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
6
- import { type IEventBus, type IEventBusAdapter, type BaseEvent } from "../../../../event-bus/contracts/_module-exports.js";
5
+ import type { BaseEventMap, EventListener, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
6
+ import { type IEventBus, type IEventBusAdapter } from "../../../../event-bus/contracts/_module-exports.js";
7
7
  import type { KeyPrefixer, Factory, AsyncLazy } from "../../../../utilities/_module-exports.js";
8
8
  /**
9
9
  *
10
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
10
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
11
11
  * @group Derivables
12
12
  */
13
13
  export type EventBusSettingsBase = {
14
14
  keyPrefixer: KeyPrefixer;
15
15
  /**
16
- * You can pass a <i>{@link Factory}</i> of <i>{@link LazyPromise}</i> to configure default settings for all <i>{@link LazyPromise}</i> instances used in the <i>EventBus</i> class.
16
+ * You can pass a {@link Factory | `Factory`} of {@link LazyPromise| `LazyPromise`} to configure default settings for all {@link LazyPromise| `LazyPromise`} instances used in the `EventBus` class.
17
17
  * @default
18
18
  * ```ts
19
19
  * import { LazyPromise } from "@daiso-tech/core/async";
@@ -25,19 +25,19 @@ export type EventBusSettingsBase = {
25
25
  };
26
26
  /**
27
27
  *
28
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
28
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
29
29
  * @group Derivables
30
30
  */
31
31
  export type EventBusSettings = EventBusSettingsBase & {
32
32
  adapter: IEventBusAdapter;
33
33
  };
34
34
  /**
35
- * <i>EventBus</i> class can be derived from any <i>{@link IEventBusAdapter}</i>.
35
+ * `EventBus` class can be derived from any {@link IEventBusAdapter | `IEventBusAdapter`}.
36
36
  *
37
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
37
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
38
38
  * @group Derivables
39
39
  */
40
- export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements IEventBus<TEvents> {
40
+ export declare class EventBus<TEventMap extends BaseEventMap> implements IEventBus<TEventMap> {
41
41
  private readonly store;
42
42
  private readonly adapter;
43
43
  private readonly lazyPromiseFactory;
@@ -57,11 +57,11 @@ export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements
57
57
  */
58
58
  constructor(settings: EventBusSettings);
59
59
  private createLazyPromise;
60
- addListener<TEventClass extends EventClass<TEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
61
- removeListener<TEventClass extends EventClass<TEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
62
- listenOnce<TEventClass extends EventClass<TEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
63
- asPromise<TEventClass extends EventClass<TEvents>>(event: TEventClass): LazyPromise<EventInstance<TEventClass>>;
64
- subscribeOnce<TEventClass extends EventClass<TEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
65
- subscribe<TEventClass extends EventClass<TEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
66
- dispatch(event: TEvents): LazyPromise<void>;
60
+ addListener<TEventName extends keyof TEventMap>(eventName: TEventName, listener: EventListener<TEventMap[TEventName]>): LazyPromise<void>;
61
+ removeListener<TEventName extends keyof TEventMap>(eventName: TEventName, listener: EventListener<TEventMap[TEventName]>): LazyPromise<void>;
62
+ listenOnce<TEventName extends keyof TEventMap>(eventName: TEventName, listener: EventListener<TEventMap[TEventName]>): LazyPromise<void>;
63
+ asPromise<TEventName extends keyof TEventMap>(eventName: TEventName): LazyPromise<TEventMap[TEventName]>;
64
+ subscribeOnce<TEventName extends keyof TEventMap>(eventName: TEventName, listener: EventListener<TEventMap[TEventName]>): LazyPromise<Unsubscribe>;
65
+ subscribe<TEventName extends keyof TEventMap>(eventName: TEventName, listener: EventListener<TEventMap[TEventName]>): LazyPromise<Unsubscribe>;
66
+ dispatch<TEventName extends keyof TEventMap>(eventName: TEventName, event: TEventMap[TEventName]): LazyPromise<void>;
67
67
  }
@@ -3,12 +3,12 @@
3
3
  */
4
4
  import { LazyPromise } from "../../../../async/_module-exports.js";
5
5
  import { UnableToDispatchEventBusError, UnableToRemoveListenerEventBusError, UnableToAddListenerEventBusError, } from "../../../../event-bus/contracts/_module-exports.js";
6
- import { getConstructorName, resolveFactory, resolveInvokable, } from "../../../../utilities/_module-exports.js";
6
+ import { resolveFactory, resolveInvokable, } from "../../../../utilities/_module-exports.js";
7
7
  import { ListenerStore } from "../../../../event-bus/implementations/derivables/event-bus/listener-store.js";
8
8
  /**
9
- * <i>EventBus</i> class can be derived from any <i>{@link IEventBusAdapter}</i>.
9
+ * `EventBus` class can be derived from any {@link IEventBusAdapter | `IEventBusAdapter`}.
10
10
  *
11
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
11
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
12
12
  * @group Derivables
13
13
  */
14
14
  export class EventBus {
@@ -38,38 +38,38 @@ export class EventBus {
38
38
  createLazyPromise(asyncFn) {
39
39
  return this.lazyPromiseFactory(asyncFn);
40
40
  }
41
- addListener(event, listener) {
41
+ addListener(eventName, listener) {
42
42
  return this.createLazyPromise(async () => {
43
- const eventName = this.keyPrefixer.create(event.name);
44
- const resolvedListener = this.store.getOrAdd([eventName.prefixed, listener], resolveInvokable(listener));
43
+ const key = this.keyPrefixer.create(String(eventName));
44
+ const resolvedListener = this.store.getOrAdd([key.prefixed, listener], resolveInvokable(listener));
45
45
  try {
46
- await this.adapter.addListener(eventName.prefixed, resolvedListener);
46
+ await this.adapter.addListener(key.prefixed, resolvedListener);
47
47
  }
48
48
  catch (error) {
49
- this.store.getAndRemove([eventName.prefixed, listener]);
50
- throw new UnableToAddListenerEventBusError(`A listener with name of "${resolvedListener.name}" could not added for "${String(event)}" event`, error);
49
+ this.store.getAndRemove([key.prefixed, listener]);
50
+ throw new UnableToAddListenerEventBusError(`A listener with name of "${String(eventName)}" could not added for "${String(eventName)}" event`, error);
51
51
  }
52
52
  });
53
53
  }
54
- removeListener(event, listener) {
54
+ removeListener(eventName, listener) {
55
55
  return this.createLazyPromise(async () => {
56
- const eventName = this.keyPrefixer.create(event.name);
56
+ const key = this.keyPrefixer.create(String(eventName));
57
57
  const resolvedListener = this.store.getAndRemove([
58
- eventName.prefixed,
58
+ key.prefixed,
59
59
  listener,
60
60
  ]);
61
61
  if (resolvedListener === null) {
62
62
  return;
63
63
  }
64
64
  try {
65
- await this.adapter.removeListener(eventName.prefixed, resolvedListener);
65
+ await this.adapter.removeListener(key.prefixed, resolvedListener);
66
66
  }
67
67
  catch (error) {
68
- throw new UnableToRemoveListenerEventBusError(`A listener with name of "${resolvedListener.name}" could not removed of "${String(event)}" event`, error);
68
+ throw new UnableToRemoveListenerEventBusError(`A listener with name of "${String(eventName)}" could not removed of "${String(eventName)}" event`, error);
69
69
  }
70
70
  });
71
71
  }
72
- listenOnce(event, listener) {
72
+ listenOnce(eventName, listener) {
73
73
  return this.createLazyPromise(async () => {
74
74
  const wrappedListener = async (event_) => {
75
75
  try {
@@ -77,54 +77,54 @@ export class EventBus {
77
77
  await resolvedListener(event_);
78
78
  }
79
79
  finally {
80
- await this.removeListener(event, listener);
80
+ await this.removeListener(eventName, listener);
81
81
  }
82
82
  };
83
- const eventName = this.keyPrefixer.create(event.name);
84
- const resolvedListener = this.store.getOrAdd([eventName.prefixed, listener], wrappedListener);
83
+ const key = this.keyPrefixer.create(String(eventName));
84
+ const resolvedListener = this.store.getOrAdd([key.prefixed, listener], wrappedListener);
85
85
  try {
86
- await this.adapter.addListener(eventName.prefixed, resolvedListener);
86
+ await this.adapter.addListener(key.prefixed, resolvedListener);
87
87
  }
88
88
  catch (error) {
89
- this.store.getAndRemove([eventName.prefixed, listener]);
90
- throw new UnableToAddListenerEventBusError(`A listener with name of "${resolvedListener.name}" could not added for "${String(event)}" event`, error);
89
+ this.store.getAndRemove([key.prefixed, listener]);
90
+ throw new UnableToAddListenerEventBusError(`A listener with name of "${String(eventName)}" could not added for "${String(eventName)}" event`, error);
91
91
  }
92
92
  });
93
93
  }
94
- asPromise(event) {
94
+ asPromise(eventName) {
95
95
  return LazyPromise.fromCallback((resolve, reject) => {
96
- this.listenOnce(event, resolve).then(() => { }, reject);
96
+ this.listenOnce(eventName, resolve).then(() => { }, reject);
97
97
  });
98
98
  }
99
- subscribeOnce(event, listener) {
99
+ subscribeOnce(eventName, listener) {
100
100
  return this.createLazyPromise(async () => {
101
- await this.listenOnce(event, listener);
101
+ await this.listenOnce(eventName, listener);
102
102
  const unsubscribe = () => {
103
103
  return this.createLazyPromise(async () => {
104
- await this.removeListener(event, listener);
104
+ await this.removeListener(eventName, listener);
105
105
  });
106
106
  };
107
107
  return unsubscribe;
108
108
  });
109
109
  }
110
- subscribe(event, listener) {
110
+ subscribe(eventName, listener) {
111
111
  return this.createLazyPromise(async () => {
112
- await this.addListener(event, listener);
112
+ await this.addListener(eventName, listener);
113
113
  const unsubscribe = () => {
114
114
  return this.createLazyPromise(async () => {
115
- await this.removeListener(event, listener);
115
+ await this.removeListener(eventName, listener);
116
116
  });
117
117
  };
118
118
  return unsubscribe;
119
119
  });
120
120
  }
121
- dispatch(event) {
121
+ dispatch(eventName, event) {
122
122
  return this.createLazyPromise(async () => {
123
123
  try {
124
- await this.adapter.dispatch(this.keyPrefixer.create(getConstructorName(event)).prefixed, event);
124
+ await this.adapter.dispatch(this.keyPrefixer.create(String(eventName)).prefixed, event);
125
125
  }
126
126
  catch (error) {
127
- throw new UnableToDispatchEventBusError(`Events of type "${getConstructorName(event)}" could not be dispatched`, error);
127
+ throw new UnableToDispatchEventBusError(`Events of type "${String(eventName)}" could not be dispatched`, error);
128
128
  }
129
129
  });
130
130
  }
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus/event-bus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,EAIH,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,GACnC,MAAM,0CAA0C,CAAC;AAQlD,OAAO,EACH,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EA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C;gBAC/C,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;YACF,OAAO,WAAW,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CACL,KAAkB,EAClB,QAAmD;QAEnD,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;YACrC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACxC,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;oBACrC,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;YACF,OAAO,WAAW,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,KAAc;QACnB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CACvB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAC3D,KAAK,CACR,CAAC;YACN,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACtB,MAAM,IAAI,6BAA6B,CACnC,mBAAmB,kBAAkB,CAAC,KAAK,CAAC,2BAA2B,EACvE,KAAK,CACR,CAAC;YACN,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus/event-bus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,EAGH,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,GACnC,MAAM,0CAA0C,CAAC;AAQlD,OAAO,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iB,CAAC,KAAK,IAAI,EAAE;oBACrC,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;YACF,OAAO,WAAW,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CACL,SAAqB,EACrB,QAA8C;QAE9C,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;YACrC,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC5C,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;oBACrC,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC,CAAC;YACP,CAAC,CAAC;YACF,OAAO,WAAW,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CACJ,SAAqB,EACrB,KAA4B;QAE5B,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC;gBACD,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CACvB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACnD,KAAK,CACR,CAAC;YACN,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACtB,MAAM,IAAI,6BAA6B,CACnC,mBAAmB,MAAM,CAAC,SAAS,CAAC,2BAA2B,EAC/D,KAAK,CACR,CAAC;YACN,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -2,18 +2,18 @@
2
2
  * @module EventBus
3
3
  */
4
4
  import type { LazyPromise } from "../../../../async/_module-exports.js";
5
- import { type IEventBus, type IEventBusFactory, type BaseEvent, type IEventBusAdapter } from "../../../../event-bus/contracts/_module-exports.js";
5
+ import { type IEventBus, type IEventBusFactory, type BaseEventMap, type IEventBusAdapter } from "../../../../event-bus/contracts/_module-exports.js";
6
6
  import { type EventBusSettingsBase } from "../../../../event-bus/implementations/derivables/event-bus/_module.js";
7
7
  import type { AsyncLazy, Factory, KeyPrefixer } from "../../../../utilities/_module-exports.js";
8
8
  /**
9
9
  *
10
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
10
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
11
11
  * @group Derivables
12
12
  */
13
13
  export type EventBusAdapters<TAdapters extends string = string> = Partial<Record<TAdapters, IEventBusAdapter>>;
14
14
  /**
15
15
  *
16
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
16
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
17
17
  * @group Derivables
18
18
  */
19
19
  export type EventBusFactorySettings<TAdapters extends string = string> = EventBusSettingsBase & {
@@ -21,8 +21,9 @@ export type EventBusFactorySettings<TAdapters extends string = string> = EventBu
21
21
  defaultAdapter?: NoInfer<TAdapters>;
22
22
  };
23
23
  /**
24
+ * The `EventBusFactory` class is immutable.
24
25
  *
25
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
26
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
26
27
  * @group Derivables
27
28
  */
28
29
  export declare class EventBusFactory<TAdapters extends string = string> implements IEventBusFactory<TAdapters> {
@@ -113,18 +114,24 @@ export declare class EventBusFactory<TAdapters extends string = string> implemen
113
114
  * defaultAdapter: "memory"
114
115
  * });
115
116
  *
116
- * class AddEvent extends BaseEvent<{ a: number, b: number }> {}
117
+ * type AddEvent = {
118
+ * a: number;
119
+ * b: number;
120
+ * };
121
+ * type EventMap = {
122
+ * add: AddEvent;
123
+ * };
117
124
  *
118
125
  * // Will dispatch AddEvent using the default adapter which is MemoryEventBusAdapter
119
126
  * await eventBusFactory
120
- * .use()
121
- * .dispatch(new AddEvent({ a: 1, b: 2 }));
127
+ * .use<EventMap>()
128
+ * .dispatch("add", { a: 1, b: 2 });
122
129
  *
123
130
  * // Will dispatch AddEvent using the redis adapter which is RedisPubSubEventBusAdapter
124
131
  * await eventBusFactory
125
- * .use("redis")
126
- * .dispatch(new AddEvent({ a: 1, b: 2 }));
132
+ * .use<EventMap>("redis")
133
+ * .dispatch("add", { a: 1, b: 2 });
127
134
  * ```
128
135
  */
129
- use<TEvents extends BaseEvent = BaseEvent>(adapterName?: TAdapters | undefined): IEventBus<TEvents>;
136
+ use<TEventMap extends BaseEventMap>(adapterName?: TAdapters | undefined): IEventBus<TEventMap>;
130
137
  }
@@ -5,8 +5,9 @@ import {} from "../../../../event-bus/contracts/_module-exports.js";
5
5
  import { EventBus, } from "../../../../event-bus/implementations/derivables/event-bus/_module.js";
6
6
  import { DefaultAdapterNotDefinedError, UnregisteredAdapterError, } from "../../../../utilities/_module-exports.js";
7
7
  /**
8
+ * The `EventBusFactory` class is immutable.
8
9
  *
9
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus"```
10
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus"`
10
11
  * @group Derivables
11
12
  */
12
13
  export class EventBusFactory {
@@ -109,17 +110,23 @@ export class EventBusFactory {
109
110
  * defaultAdapter: "memory"
110
111
  * });
111
112
  *
112
- * class AddEvent extends BaseEvent<{ a: number, b: number }> {}
113
+ * type AddEvent = {
114
+ * a: number;
115
+ * b: number;
116
+ * };
117
+ * type EventMap = {
118
+ * add: AddEvent;
119
+ * };
113
120
  *
114
121
  * // Will dispatch AddEvent using the default adapter which is MemoryEventBusAdapter
115
122
  * await eventBusFactory
116
- * .use()
117
- * .dispatch(new AddEvent({ a: 1, b: 2 }));
123
+ * .use<EventMap>()
124
+ * .dispatch("add", { a: 1, b: 2 });
118
125
  *
119
126
  * // Will dispatch AddEvent using the redis adapter which is RedisPubSubEventBusAdapter
120
127
  * await eventBusFactory
121
- * .use("redis")
122
- * .dispatch(new AddEvent({ a: 1, b: 2 }));
128
+ * .use<EventMap>("redis")
129
+ * .dispatch("add", { a: 1, b: 2 });
123
130
  * ```
124
131
  */
125
132
  use(adapterName = this.settings.defaultAdapter) {
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus-factory.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACH,QAAQ,GAEX,MAAM,6DAA6D,CAAC;AAMrE,OAAO,EACH,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AAuBxC;;;;GAIG;AACH,MAAM,OAAO,eAAe;IA6CH;IA1CrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,YACqB,QAA4C;QAA5C,aAAQ,GAAR,QAAQ,CAAoC;IAC9D,CAAC;IAEJ,cAAc,CAAC,WAAwB;QACnC,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,WAAW;SACd,CAAC,CAAC;IACP,CAAC;IAED,qBAAqB,CACjB,OAAkD;QAElD,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,kBAAkB,EAAE,OAAO;SAC9B,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsDG;IACH,GAAG,CACC,cAAqC,IAAI,CAAC,QAAQ,CAAC,cAAc;QAEjE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,6BAA6B,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,QAAQ,CAAC;YAChB,OAAO;YACP,GAAG,IAAI,CAAC,QAAQ;SACnB,CAAC,CAAC;IACP,CAAC;CACJ"}
1
+ {"version":3,"file":"event-bus-factory.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACH,QAAQ,GAEX,MAAM,6DAA6D,CAAC;AAMrE,OAAO,EACH,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AAuBxC;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IA6CH;IA1CrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,YACqB,QAA4C;QAA5C,aAAQ,GAAR,QAAQ,CAAoC;IAC9D,CAAC;IAEJ,cAAc,CAAC,WAAwB;QACnC,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,WAAW;SACd,CAAC,CAAC;IACP,CAAC;IAED,qBAAqB,CACjB,OAAkD;QAElD,OAAO,IAAI,eAAe,CAAC;YACvB,GAAG,IAAI,CAAC,QAAQ;YAChB,kBAAkB,EAAE,OAAO;SAC9B,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACH,GAAG,CACC,cAAqC,IAAI,CAAC,QAAQ,CAAC,cAAc;QAEjE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,IAAI,6BAA6B,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,QAAQ,CAAC;YAChB,OAAO;YACP,GAAG,IAAI,CAAC,QAAQ;SACnB,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -4,24 +4,22 @@
4
4
  import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
5
5
  import type { IEventBusAdapter } from "../../../event-bus/contracts/_module-exports.js";
6
6
  import { type Promisable } from "../../../utilities/_module-exports.js";
7
- import type { IFlexibleSerde } from "../../../serde/contracts/_module-exports.js";
8
7
  /**
9
8
  *
10
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
9
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/test-utilities"`
11
10
  * @group TestUtilities
12
11
  */
13
12
  export type EventBusAdapterTestSuiteSettings = {
14
13
  expect: ExpectStatic;
15
- serde?: IFlexibleSerde;
16
14
  test: TestAPI;
17
15
  describe: SuiteAPI;
18
16
  beforeEach: typeof beforeEach;
19
17
  createAdapter: () => Promisable<IEventBusAdapter>;
20
18
  };
21
19
  /**
22
- * The <i>eventBusAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IEventBusAdapter}</i> with vitest.
20
+ * The `eventBusAdapterTestSuite` function simplifies the process of testing your custom implementation of {@link IEventBusAdapter | `IEventBusAdapter`} with vitest.
23
21
  *
24
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
22
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/test-utilities"`
25
23
  * @group TestUtilities
26
24
  */
27
25
  export declare function eventBusAdapterTestSuite(settings: EventBusAdapterTestSuiteSettings): void;
@@ -2,60 +2,53 @@
2
2
  * @module EventBus
3
3
  */
4
4
  import { describe, } from "vitest";
5
- import { BaseEvent } from "../../../event-bus/contracts/_module-exports.js";
6
5
  import {} from "../../../utilities/_module-exports.js";
7
6
  import { TimeSpan } from "../../../utilities/_module-exports.js";
8
7
  import { LazyPromise } from "../../../async/_module-exports.js";
9
- import { Serde } from "../../../serde/implementations/derivables/_module-exports.js";
10
- import { NoOpSerdeAdapter } from "../../../serde/implementations/adapters/_module-exports.js";
11
8
  /**
12
- * The <i>eventBusAdapterTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IEventBusAdapter}</i> with vitest.
9
+ * The `eventBusAdapterTestSuite` function simplifies the process of testing your custom implementation of {@link IEventBusAdapter | `IEventBusAdapter`} with vitest.
13
10
  *
14
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
11
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/test-utilities"`
15
12
  * @group TestUtilities
16
13
  */
17
14
  export function eventBusAdapterTestSuite(settings) {
18
- const { expect, test, createAdapter, beforeEach, serde = new Serde(new NoOpSerdeAdapter()), } = settings;
15
+ const { expect, test, createAdapter, beforeEach } = settings;
19
16
  let adapter;
20
17
  beforeEach(async () => {
21
18
  adapter = await createAdapter();
22
19
  });
23
20
  const TTL = TimeSpan.fromMilliseconds(50);
24
- class TestEvent extends BaseEvent {
25
- }
26
- serde.registerEvent(TestEvent);
27
21
  describe("method: addListener, removeListener, dispatch", () => {
28
22
  test("Should be null when listener added and event is not triggered", async () => {
29
23
  let result = null;
30
- await adapter.addListener(TestEvent.name, (event) => {
24
+ await adapter.addListener("event", (event) => {
31
25
  result = event;
32
26
  });
33
27
  expect(result).toBeNull();
34
28
  });
35
29
  test("Should be TestEvent when listener added and event is triggered", async () => {
36
30
  let result = null;
37
- await adapter.addListener(TestEvent.name, (event) => {
31
+ await adapter.addListener("event", (event) => {
38
32
  result = event;
39
33
  });
40
- const event = new TestEvent({
41
- type: BaseEvent.name,
42
- });
43
- await adapter.dispatch(TestEvent.name, event);
34
+ const event = {
35
+ type: "event",
36
+ };
37
+ await adapter.dispatch("event", event);
44
38
  await LazyPromise.delay(TTL);
45
39
  expect(result).toEqual(event);
46
- expect(result).toBeInstanceOf(TestEvent);
47
40
  });
48
41
  test("Should be null when listener removed and event is triggered", async () => {
49
42
  let result = null;
50
43
  const listener = (event) => {
51
44
  result = event;
52
45
  };
53
- await adapter.addListener(TestEvent.name, listener);
54
- await adapter.removeListener(TestEvent.name, listener);
55
- const event = new TestEvent({
56
- type: BaseEvent.name,
57
- });
58
- await adapter.dispatch(TestEvent.name, event);
46
+ await adapter.addListener("event", listener);
47
+ await adapter.removeListener("event", listener);
48
+ const event = {
49
+ type: "event",
50
+ };
51
+ await adapter.dispatch("event", event);
59
52
  await LazyPromise.delay(TTL);
60
53
  expect(result).toBeNull();
61
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus-adapter.test-suite.js","sourceRoot":"","sources":["../../../../src/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAKH,QAAQ,GACX,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,uDAAuD,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAgBvF;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACpC,QAA0C;IAE1C,MAAM,EACF,MAAM,EACN,IAAI,EACJ,aAAa,EACb,UAAU,EACV,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,gBAAgB,EAAE,CAAC,GAC5C,GAAG,QAAQ,CAAC;IAEb,IAAI,OAAyB,CAAC;IAC9B,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,QAAQ,C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E,EAAE;gBAClC,MAAM,GAAG,KAAK,CAAC;YACnB,CAAC,CAAC;YACF,MAAM,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACpD,MAAM,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACvD,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC;gBACxB,IAAI,EAAE,SAAS,CAAC,IAAI;aACvB,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC9C,MAAM,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"event-bus-adapter.test-suite.js","sourceRoot":"","sources":["../../../../src/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAKH,QAAQ,GACX,MAAM,QAAQ,CAAC;AAKhB,OAAO,EAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAezD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACpC,QAA0C;IAE1C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAE7D,IAAI,OAAyB,CAAC;IAC9B,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC1C,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AAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACvC,MAAM,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -4,24 +4,22 @@
4
4
  import { type TestAPI, type SuiteAPI, type ExpectStatic, type beforeEach } from "vitest";
5
5
  import { type IEventBus } from "../../../event-bus/contracts/_module-exports.js";
6
6
  import { type Promisable } from "../../../utilities/_module-exports.js";
7
- import type { IFlexibleSerde } from "../../../serde/contracts/_module-exports.js";
8
7
  /**
9
8
  *
10
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
9
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/test-utilities"`
11
10
  * @group TestUtilities
12
11
  */
13
12
  export type EventBusTestSuiteSettings = {
14
13
  expect: ExpectStatic;
15
- serde?: IFlexibleSerde;
16
14
  test: TestAPI;
17
15
  describe: SuiteAPI;
18
16
  beforeEach: typeof beforeEach;
19
17
  createEventBus: () => Promisable<IEventBus>;
20
18
  };
21
19
  /**
22
- * The <i>eventBusTestSuite</i> function simplifies the process of testing your custom implementation of <i>{@link IEventBus}</i> with vitest.
20
+ * The `eventBusTestSuite` function simplifies the process of testing your custom implementation of {@link IEventBus | `IEventBus`} with vitest.
23
21
  *
24
- * IMPORT_PATH: ```"@daiso-tech/core/event-bus/test-utilities"```
22
+ * IMPORT_PATH: `"@daiso-tech/core/event-bus/test-utilities"`
25
23
  * @group TestUtilities
26
24
  */
27
25
  export declare function eventBusTestSuite(settings: EventBusTestSuiteSettings): void;