@daiso-tech/core 0.40.0 → 0.41.1

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 (672) hide show
  1. package/README.md +8 -1
  2. package/dist/backoff-policies/_module-exports.d.ts +5 -0
  3. package/dist/backoff-policies/_module-exports.js +6 -0
  4. package/dist/backoff-policies/_module-exports.js.map +1 -0
  5. package/dist/{async/backof-policies → backoff-policies}/_shared.d.ts +6 -7
  6. package/dist/{async/backof-policies → backoff-policies}/_shared.js +1 -1
  7. package/dist/backoff-policies/_shared.js.map +1 -0
  8. package/dist/backoff-policies/constant-backoff-policy/_module.d.ts +1 -0
  9. package/dist/backoff-policies/constant-backoff-policy/_module.js +2 -0
  10. package/dist/backoff-policies/constant-backoff-policy/_module.js.map +1 -0
  11. package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.d.ts +6 -8
  12. package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.js +8 -10
  13. package/dist/backoff-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  14. package/dist/backoff-policies/exponential-backoff-policy/_module.d.ts +1 -0
  15. package/dist/backoff-policies/exponential-backoff-policy/_module.js +2 -0
  16. package/dist/backoff-policies/exponential-backoff-policy/_module.js.map +1 -0
  17. package/dist/{async/backof-policies → backoff-policies}/exponential-backoff-policy/exponential-backoff-policy.d.ts +7 -9
  18. package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js +30 -0
  19. package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  20. package/dist/backoff-policies/linear-backoff-policy/_module.d.ts +1 -0
  21. package/dist/backoff-policies/linear-backoff-policy/_module.js +2 -0
  22. package/dist/backoff-policies/linear-backoff-policy/_module.js.map +1 -0
  23. package/dist/{async/backof-policies → backoff-policies}/linear-backoff-policy/linear-backoff-policy.d.ts +7 -9
  24. package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js +30 -0
  25. package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  26. package/dist/backoff-policies/polynomial-backoff-policy/_module.d.ts +1 -0
  27. package/dist/backoff-policies/polynomial-backoff-policy/_module.js +2 -0
  28. package/dist/backoff-policies/polynomial-backoff-policy/_module.js.map +1 -0
  29. package/dist/{async/backof-policies → backoff-policies}/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +7 -9
  30. package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +30 -0
  31. package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  32. package/dist/cache/contracts/cache-adapter.contract.d.ts +3 -3
  33. package/dist/cache/contracts/cache.contract.d.ts +22 -22
  34. package/dist/cache/contracts/cache.errors.d.ts +7 -14
  35. package/dist/cache/contracts/cache.errors.js +12 -24
  36. package/dist/cache/contracts/cache.errors.js.map +1 -1
  37. package/dist/cache/contracts/cache.events.d.ts +1 -1
  38. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +1 -1
  39. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +4 -4
  40. package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -1
  41. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +1 -1
  42. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +2 -2
  43. package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  44. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +3 -2
  45. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
  46. package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  47. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +1 -1
  48. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +1 -1
  49. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
  50. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  51. package/dist/cache/implementations/derivables/cache/cache.d.ts +38 -43
  52. package/dist/cache/implementations/derivables/cache/cache.js +106 -101
  53. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  54. package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +1 -1
  55. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +3 -3
  56. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -1
  57. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +6 -8
  58. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +5 -15
  59. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  60. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +1 -1
  61. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +48 -48
  62. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
  63. package/dist/cache/implementations/test-utilities/cache.test-suite.js +107 -107
  64. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  65. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -1
  66. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -1
  67. package/dist/collection/contracts/async-collection.contract.d.ts +43 -43
  68. package/dist/collection/contracts/collection.contract.d.ts +15 -1
  69. package/dist/collection/contracts/collection.contract.js +1 -3
  70. package/dist/collection/contracts/collection.contract.js.map +1 -1
  71. package/dist/collection/contracts/collection.errors.d.ts +4 -13
  72. package/dist/collection/contracts/collection.errors.js +4 -16
  73. package/dist/collection/contracts/collection.errors.js.map +1 -1
  74. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.d.ts +6 -0
  75. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js +3 -0
  76. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js.map +1 -1
  77. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +40 -51
  78. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +31 -37
  79. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  80. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.d.ts +3 -0
  81. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js +6 -0
  82. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js.map +1 -1
  83. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +3 -3
  84. package/dist/collection/implementations/iterable-collection/iterable-collection.js +5 -2
  85. package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  86. package/dist/collection/implementations/list-collection/list-collection.d.ts +3 -3
  87. package/dist/collection/implementations/list-collection/list-collection.js +5 -2
  88. package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
  89. package/dist/event-bus/contracts/event-bus.contract.d.ts +10 -10
  90. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -6
  91. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +7 -9
  92. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
  93. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +17 -24
  94. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +32 -32
  95. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  96. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +1 -3
  97. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +4 -8
  98. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  99. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +34 -32
  100. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
  101. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +195 -190
  102. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  103. package/dist/hooks/_module-exports.d.ts +3 -0
  104. package/dist/hooks/_module-exports.js +4 -0
  105. package/dist/hooks/_module-exports.js.map +1 -0
  106. package/dist/{utilities/classes/hooks → hooks}/async-hooks.d.ts +15 -26
  107. package/dist/{utilities/classes/hooks → hooks}/async-hooks.js +4 -6
  108. package/dist/hooks/async-hooks.js.map +1 -0
  109. package/dist/{utilities/classes/hooks → hooks}/hooks.d.ts +11 -18
  110. package/dist/{utilities/classes/hooks → hooks}/hooks.js +4 -5
  111. package/dist/hooks/hooks.js.map +1 -0
  112. package/dist/{utilities/classes/hooks → hooks}/types.d.ts +2 -3
  113. package/dist/hooks/types.js +5 -0
  114. package/dist/hooks/types.js.map +1 -0
  115. package/dist/lock/contracts/_module-exports.d.ts +4 -2
  116. package/dist/lock/contracts/_module-exports.js +4 -2
  117. package/dist/lock/contracts/_module-exports.js.map +1 -1
  118. package/dist/lock/contracts/database-lock-adapter.contract.d.ts +24 -17
  119. package/dist/lock/contracts/lock-adapter.contract.d.ts +15 -24
  120. package/dist/lock/contracts/lock-adapter.contract.js +1 -10
  121. package/dist/lock/contracts/lock-adapter.contract.js.map +1 -1
  122. package/dist/lock/contracts/lock-provider.contract.d.ts +5 -5
  123. package/dist/lock/contracts/lock-state.contract.d.ts +52 -0
  124. package/dist/lock/contracts/lock-state.contract.js +14 -0
  125. package/dist/lock/contracts/lock-state.contract.js.map +1 -0
  126. package/dist/lock/contracts/lock.contract.d.ts +64 -55
  127. package/dist/lock/contracts/lock.errors.d.ts +13 -20
  128. package/dist/lock/contracts/lock.errors.js +19 -26
  129. package/dist/lock/contracts/lock.errors.js.map +1 -1
  130. package/dist/lock/contracts/lock.events.d.ts +21 -49
  131. package/dist/lock/contracts/lock.events.js +2 -3
  132. package/dist/lock/contracts/lock.events.js.map +1 -1
  133. package/dist/lock/contracts/types.d.ts +11 -0
  134. package/dist/lock/contracts/types.js +5 -0
  135. package/dist/lock/contracts/types.js.map +1 -0
  136. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +21 -19
  137. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +92 -61
  138. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
  139. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +8 -5
  140. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +33 -13
  141. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
  142. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +7 -8
  143. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +33 -20
  144. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
  145. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +6 -5
  146. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +7 -5
  147. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -1
  148. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +26 -8
  149. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +61 -28
  150. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
  151. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +6 -5
  152. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +33 -33
  153. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
  154. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +2 -2
  155. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +4 -6
  156. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -1
  157. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +29 -39
  158. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +31 -35
  159. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  160. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +5 -8
  161. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +27 -23
  162. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  163. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +38 -34
  164. package/dist/lock/implementations/derivables/lock-provider/lock.js +182 -257
  165. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  166. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.d.ts +9 -0
  167. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js +12 -0
  168. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js.map +1 -0
  169. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +12 -13
  170. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +7 -16
  171. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  172. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +310 -207
  173. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
  174. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +1 -1
  175. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +376 -292
  176. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
  177. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -5
  178. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +3285 -2976
  179. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  180. package/dist/namespace/_module-exports.d.ts +1 -0
  181. package/dist/namespace/_module-exports.js +2 -0
  182. package/dist/namespace/_module-exports.js.map +1 -0
  183. package/dist/namespace/namespace.d.ts +87 -0
  184. package/dist/namespace/namespace.js +117 -0
  185. package/dist/namespace/namespace.js.map +1 -0
  186. package/dist/resilience/_module-exports.d.ts +2 -0
  187. package/dist/resilience/_module-exports.js +3 -0
  188. package/dist/resilience/_module-exports.js.map +1 -0
  189. package/dist/resilience/middlewares/_module.d.ts +5 -0
  190. package/dist/resilience/middlewares/_module.js +6 -0
  191. package/dist/resilience/middlewares/_module.js.map +1 -0
  192. package/dist/resilience/middlewares/dynamic/_module.d.ts +1 -0
  193. package/dist/resilience/middlewares/dynamic/_module.js +2 -0
  194. package/dist/resilience/middlewares/dynamic/_module.js.map +1 -0
  195. package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.d.ts +6 -6
  196. package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.js +5 -5
  197. package/dist/resilience/middlewares/dynamic/dynamic.middleware.js.map +1 -0
  198. package/dist/resilience/middlewares/fallback/_module.d.ts +2 -0
  199. package/dist/resilience/middlewares/fallback/_module.js +3 -0
  200. package/dist/resilience/middlewares/fallback/_module.js.map +1 -0
  201. package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.d.ts +9 -9
  202. package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.js +7 -6
  203. package/dist/resilience/middlewares/fallback/fallback.middleware.js.map +1 -0
  204. package/dist/{async → resilience}/middlewares/fallback/fallback.types.d.ts +7 -6
  205. package/dist/{async → resilience}/middlewares/fallback/fallback.types.js +1 -1
  206. package/dist/resilience/middlewares/fallback/fallback.types.js.map +1 -0
  207. package/dist/resilience/middlewares/observe/_module.d.ts +2 -0
  208. package/dist/resilience/middlewares/observe/_module.js +3 -0
  209. package/dist/resilience/middlewares/observe/_module.js.map +1 -0
  210. package/dist/{async → resilience}/middlewares/observe/observe.middleware.d.ts +13 -11
  211. package/dist/{async → resilience}/middlewares/observe/observe.middleware.js +14 -10
  212. package/dist/resilience/middlewares/observe/observe.middleware.js.map +1 -0
  213. package/dist/{async → resilience}/middlewares/observe/observe.types.d.ts +13 -12
  214. package/dist/resilience/middlewares/observe/observe.types.js +5 -0
  215. package/dist/resilience/middlewares/observe/observe.types.js.map +1 -0
  216. package/dist/resilience/middlewares/retry/_module.d.ts +2 -0
  217. package/dist/resilience/middlewares/retry/_module.js +3 -0
  218. package/dist/resilience/middlewares/retry/_module.js.map +1 -0
  219. package/dist/{async → resilience}/middlewares/retry/retry.middleware.d.ts +12 -9
  220. package/dist/{async → resilience}/middlewares/retry/retry.middleware.js +19 -15
  221. package/dist/resilience/middlewares/retry/retry.middleware.js.map +1 -0
  222. package/dist/{async → resilience}/middlewares/retry/retry.types.d.ts +14 -12
  223. package/dist/resilience/middlewares/retry/retry.types.js +7 -0
  224. package/dist/resilience/middlewares/retry/retry.types.js.map +1 -0
  225. package/dist/resilience/middlewares/timeout/_module.d.ts +2 -0
  226. package/dist/resilience/middlewares/timeout/_module.js +3 -0
  227. package/dist/resilience/middlewares/timeout/_module.js.map +1 -0
  228. package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.d.ts +9 -7
  229. package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.js +12 -11
  230. package/dist/resilience/middlewares/timeout/timeout.middleware.js.map +1 -0
  231. package/dist/{async → resilience}/middlewares/timeout/timeout.type.d.ts +10 -9
  232. package/dist/resilience/middlewares/timeout/timeout.type.js +5 -0
  233. package/dist/resilience/middlewares/timeout/timeout.type.js.map +1 -0
  234. package/dist/resilience/resilience.errors.d.ts +40 -0
  235. package/dist/resilience/resilience.errors.js +48 -0
  236. package/dist/resilience/resilience.errors.js.map +1 -0
  237. package/dist/resilience/utilities/_module.d.ts +2 -0
  238. package/dist/resilience/utilities/_module.js +3 -0
  239. package/dist/resilience/utilities/_module.js.map +1 -0
  240. package/dist/resilience/utilities/abort-and-fail/_module.d.ts +1 -0
  241. package/dist/resilience/utilities/abort-and-fail/_module.js +2 -0
  242. package/dist/resilience/utilities/abort-and-fail/_module.js.map +1 -0
  243. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
  244. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js +51 -0
  245. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
  246. package/dist/resilience/utilities/timeout-and-fail/_module.d.ts +1 -0
  247. package/dist/resilience/utilities/timeout-and-fail/_module.js +2 -0
  248. package/dist/resilience/utilities/timeout-and-fail/_module.js.map +1 -0
  249. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
  250. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js +23 -0
  251. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
  252. package/dist/semaphore/contracts/_module-exports.d.ts +9 -0
  253. package/dist/semaphore/contracts/_module-exports.js +10 -0
  254. package/dist/semaphore/contracts/_module-exports.js.map +1 -0
  255. package/dist/semaphore/contracts/database-semaphore-adapter.contract.d.ts +90 -0
  256. package/dist/semaphore/contracts/database-semaphore-adapter.contract.js +5 -0
  257. package/dist/semaphore/contracts/database-semaphore-adapter.contract.js.map +1 -0
  258. package/dist/semaphore/contracts/semaphore-adapter.contract.d.ts +61 -0
  259. package/dist/semaphore/contracts/semaphore-adapter.contract.js +5 -0
  260. package/dist/semaphore/contracts/semaphore-adapter.contract.js.map +1 -0
  261. package/dist/semaphore/contracts/semaphore-provider-factory.contract.d.ts +19 -0
  262. package/dist/semaphore/contracts/semaphore-provider-factory.contract.js +9 -0
  263. package/dist/semaphore/contracts/semaphore-provider-factory.contract.js.map +1 -0
  264. package/dist/semaphore/contracts/semaphore-provider.contract.d.ts +50 -0
  265. package/dist/semaphore/contracts/semaphore-provider.contract.js +5 -0
  266. package/dist/semaphore/contracts/semaphore-provider.contract.js.map +1 -0
  267. package/dist/semaphore/contracts/semaphore-state.contract.d.ts +70 -0
  268. package/dist/semaphore/contracts/semaphore-state.contract.js +15 -0
  269. package/dist/semaphore/contracts/semaphore-state.contract.js.map +1 -0
  270. package/dist/semaphore/contracts/semaphore.contract.d.ts +127 -0
  271. package/dist/semaphore/contracts/semaphore.contract.js +5 -0
  272. package/dist/semaphore/contracts/semaphore.contract.js.map +1 -0
  273. package/dist/semaphore/contracts/semaphore.errors.d.ts +52 -0
  274. package/dist/semaphore/contracts/semaphore.errors.js +63 -0
  275. package/dist/semaphore/contracts/semaphore.errors.js.map +1 -0
  276. package/dist/semaphore/contracts/semaphore.events.d.ts +101 -0
  277. package/dist/semaphore/contracts/semaphore.events.js +19 -0
  278. package/dist/semaphore/contracts/semaphore.events.js.map +1 -0
  279. package/dist/semaphore/contracts/types.d.ts +11 -0
  280. package/dist/semaphore/contracts/types.js +5 -0
  281. package/dist/semaphore/contracts/types.js.map +1 -0
  282. package/dist/semaphore/implementations/adapters/_module-exports.d.ts +5 -0
  283. package/dist/semaphore/implementations/adapters/_module-exports.js +6 -0
  284. package/dist/semaphore/implementations/adapters/_module-exports.js.map +1 -0
  285. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.d.ts +1 -0
  286. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js +2 -0
  287. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js.map +1 -0
  288. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.d.ts +97 -0
  289. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js +313 -0
  290. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js.map +1 -0
  291. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.d.ts +1 -0
  292. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js +2 -0
  293. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js.map +1 -0
  294. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.d.ts +49 -0
  295. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js +141 -0
  296. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js.map +1 -0
  297. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.d.ts +1 -0
  298. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js +2 -0
  299. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js.map +1 -0
  300. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.d.ts +80 -0
  301. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js +390 -0
  302. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js.map +1 -0
  303. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.d.ts +1 -0
  304. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js +2 -0
  305. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js.map +1 -0
  306. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.d.ts +18 -0
  307. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js +30 -0
  308. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js.map +1 -0
  309. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.d.ts +1 -0
  310. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js +2 -0
  311. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js.map +1 -0
  312. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.d.ts +48 -0
  313. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js +338 -0
  314. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js.map +1 -0
  315. package/dist/semaphore/implementations/derivables/_module-exports.d.ts +2 -0
  316. package/dist/semaphore/implementations/derivables/_module-exports.js +3 -0
  317. package/dist/semaphore/implementations/derivables/_module-exports.js.map +1 -0
  318. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.d.ts +1 -0
  319. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js +2 -0
  320. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js.map +1 -0
  321. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.d.ts +17 -0
  322. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js +74 -0
  323. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js.map +1 -0
  324. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.d.ts +8 -0
  325. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js +15 -0
  326. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js.map +1 -0
  327. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.d.ts +8 -0
  328. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js +15 -0
  329. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js.map +1 -0
  330. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.d.ts +149 -0
  331. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js +135 -0
  332. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js.map +1 -0
  333. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.d.ts +41 -0
  334. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js +77 -0
  335. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js.map +1 -0
  336. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.d.ts +83 -0
  337. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js +336 -0
  338. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js.map +1 -0
  339. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.d.ts +1 -0
  340. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js +2 -0
  341. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js.map +1 -0
  342. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.d.ts +40 -0
  343. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js +67 -0
  344. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js.map +1 -0
  345. package/dist/semaphore/implementations/test-utilities/_module-exports.d.ts +3 -0
  346. package/dist/semaphore/implementations/test-utilities/_module-exports.js +4 -0
  347. package/dist/semaphore/implementations/test-utilities/_module-exports.js.map +1 -0
  348. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.d.ts +59 -0
  349. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js +536 -0
  350. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js.map +1 -0
  351. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.d.ts +59 -0
  352. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js +961 -0
  353. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js.map +1 -0
  354. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.d.ts +67 -0
  355. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js +4981 -0
  356. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js.map +1 -0
  357. package/dist/serde/contracts/_module-exports.d.ts +0 -1
  358. package/dist/serde/contracts/_module-exports.js +0 -1
  359. package/dist/serde/contracts/_module-exports.js.map +1 -1
  360. package/dist/serde/contracts/flexible-serde.contract.d.ts +21 -5
  361. package/dist/serde/contracts/serde.errors.d.ts +14 -11
  362. package/dist/serde/contracts/serde.errors.js +15 -14
  363. package/dist/serde/contracts/serde.errors.js.map +1 -1
  364. package/dist/serde/implementations/adapters/_module-exports.d.ts +0 -3
  365. package/dist/serde/implementations/adapters/_module-exports.js +0 -3
  366. package/dist/serde/implementations/adapters/_module-exports.js.map +1 -1
  367. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +6 -0
  368. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
  369. package/dist/serde/implementations/derivables/serde-transformers.d.ts +38 -30
  370. package/dist/serde/implementations/derivables/serde-transformers.js +62 -20
  371. package/dist/serde/implementations/derivables/serde-transformers.js.map +1 -1
  372. package/dist/serde/implementations/derivables/serde.d.ts +12 -3
  373. package/dist/serde/implementations/derivables/serde.js +5 -2
  374. package/dist/serde/implementations/derivables/serde.js.map +1 -1
  375. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +85 -1
  376. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js.map +1 -1
  377. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +85 -1
  378. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js.map +1 -1
  379. package/dist/shared-lock/contracts/_module-exports.d.ts +10 -0
  380. package/dist/shared-lock/contracts/_module-exports.js +11 -0
  381. package/dist/shared-lock/contracts/_module-exports.js.map +1 -0
  382. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.d.ts +145 -0
  383. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js +5 -0
  384. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js.map +1 -0
  385. package/dist/shared-lock/contracts/shared-lock-adapter.contract.d.ts +96 -0
  386. package/dist/shared-lock/contracts/shared-lock-adapter.contract.js +5 -0
  387. package/dist/shared-lock/contracts/shared-lock-adapter.contract.js.map +1 -0
  388. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.d.ts +19 -0
  389. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js +9 -0
  390. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js.map +1 -0
  391. package/dist/shared-lock/contracts/shared-lock-provider.contract.d.ts +53 -0
  392. package/dist/shared-lock/contracts/shared-lock-provider.contract.js +5 -0
  393. package/dist/shared-lock/contracts/shared-lock-provider.contract.js.map +1 -0
  394. package/dist/shared-lock/contracts/shared-lock-state.contract.d.ts +133 -0
  395. package/dist/shared-lock/contracts/shared-lock-state.contract.js +33 -0
  396. package/dist/shared-lock/contracts/shared-lock-state.contract.js.map +1 -0
  397. package/dist/shared-lock/contracts/shared-lock.contract.d.ts +222 -0
  398. package/dist/shared-lock/contracts/shared-lock.contract.js +13 -0
  399. package/dist/shared-lock/contracts/shared-lock.contract.js.map +1 -0
  400. package/dist/shared-lock/contracts/shared-lock.errors.d.ts +124 -0
  401. package/dist/shared-lock/contracts/shared-lock.errors.js +136 -0
  402. package/dist/shared-lock/contracts/shared-lock.errors.js.map +1 -0
  403. package/dist/shared-lock/contracts/shared-lock.events.d.ts +205 -0
  404. package/dist/shared-lock/contracts/shared-lock.events.js +43 -0
  405. package/dist/shared-lock/contracts/shared-lock.events.js.map +1 -0
  406. package/dist/shared-lock/contracts/types.d.ts +10 -0
  407. package/dist/shared-lock/contracts/types.js +5 -0
  408. package/dist/shared-lock/contracts/types.js.map +1 -0
  409. package/dist/shared-lock/implementations/adapters/_module-exports.d.ts +5 -0
  410. package/dist/shared-lock/implementations/adapters/_module-exports.js +6 -0
  411. package/dist/shared-lock/implementations/adapters/_module-exports.js.map +1 -0
  412. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.d.ts +1 -0
  413. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js +2 -0
  414. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js.map +1 -0
  415. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.d.ts +114 -0
  416. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js +496 -0
  417. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js.map +1 -0
  418. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.d.ts +1 -0
  419. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js +2 -0
  420. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js.map +1 -0
  421. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.d.ts +79 -0
  422. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js +347 -0
  423. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js.map +1 -0
  424. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.d.ts +1 -0
  425. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js +2 -0
  426. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js.map +1 -0
  427. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.d.ts +112 -0
  428. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js +805 -0
  429. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js.map +1 -0
  430. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.d.ts +1 -0
  431. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js +2 -0
  432. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js.map +1 -0
  433. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.d.ts +23 -0
  434. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js +42 -0
  435. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js.map +1 -0
  436. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.d.ts +1 -0
  437. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js +2 -0
  438. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js.map +1 -0
  439. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.d.ts +79 -0
  440. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js +630 -0
  441. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js.map +1 -0
  442. package/dist/shared-lock/implementations/derivables/_module-exports.d.ts +2 -0
  443. package/dist/shared-lock/implementations/derivables/_module-exports.js +3 -0
  444. package/dist/shared-lock/implementations/derivables/_module-exports.js.map +1 -0
  445. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.d.ts +1 -0
  446. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js +2 -0
  447. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js.map +1 -0
  448. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.d.ts +27 -0
  449. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js +208 -0
  450. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js.map +1 -0
  451. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.d.ts +8 -0
  452. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js +12 -0
  453. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js.map +1 -0
  454. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.d.ts +8 -0
  455. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js +15 -0
  456. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js.map +1 -0
  457. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.d.ts +190 -0
  458. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js +177 -0
  459. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js.map +1 -0
  460. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.d.ts +41 -0
  461. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js +77 -0
  462. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js.map +1 -0
  463. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.d.ts +95 -0
  464. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js +542 -0
  465. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js.map +1 -0
  466. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.d.ts +1 -0
  467. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js +2 -0
  468. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js.map +1 -0
  469. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.d.ts +97 -0
  470. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js +128 -0
  471. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js.map +1 -0
  472. package/dist/shared-lock/implementations/test-utilities/_module-exports.d.ts +3 -0
  473. package/dist/shared-lock/implementations/test-utilities/_module-exports.js +4 -0
  474. package/dist/shared-lock/implementations/test-utilities/_module-exports.js.map +1 -0
  475. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.d.ts +59 -0
  476. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js +944 -0
  477. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js.map +1 -0
  478. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.d.ts +59 -0
  479. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js +1921 -0
  480. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js.map +1 -0
  481. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.d.ts +67 -0
  482. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js +9833 -0
  483. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js.map +1 -0
  484. package/dist/task/_module-exports.d.ts +1 -0
  485. package/dist/task/_module-exports.js +2 -0
  486. package/dist/task/_module-exports.js.map +1 -0
  487. package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.d.ts +1 -1
  488. package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.js +1 -1
  489. package/dist/task/abort-and-fail.js.map +1 -0
  490. package/dist/task/task.d.ts +194 -0
  491. package/dist/task/task.js +212 -0
  492. package/dist/task/task.js.map +1 -0
  493. package/dist/time-span/contracts/_module-exports.d.ts +1 -0
  494. package/dist/time-span/contracts/_module-exports.js +2 -0
  495. package/dist/time-span/contracts/_module-exports.js.map +1 -0
  496. package/dist/time-span/contracts/time-span.contract.d.ts +19 -0
  497. package/dist/time-span/contracts/time-span.contract.js +10 -0
  498. package/dist/time-span/contracts/time-span.contract.js.map +1 -0
  499. package/dist/time-span/implementations/_module-exports.d.ts +1 -0
  500. package/dist/time-span/implementations/_module-exports.js +2 -0
  501. package/dist/time-span/implementations/_module-exports.js.map +1 -0
  502. package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.d.ts +49 -11
  503. package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.js +33 -11
  504. package/dist/time-span/implementations/time-span.js.map +1 -0
  505. package/dist/utilities/classes/_module.d.ts +0 -3
  506. package/dist/utilities/classes/_module.js +0 -3
  507. package/dist/utilities/classes/_module.js.map +1 -1
  508. package/dist/utilities/contracts/_module.d.ts +1 -1
  509. package/dist/utilities/contracts/_module.js +1 -1
  510. package/dist/utilities/contracts/_module.js.map +1 -1
  511. package/dist/utilities/contracts/comparable.contract.d.ts +49 -0
  512. package/dist/utilities/contracts/comparable.contract.js +5 -0
  513. package/dist/utilities/contracts/comparable.contract.js.map +1 -0
  514. package/dist/utilities/functions/is-standard-schema.d.ts +6 -0
  515. package/dist/utilities/functions/is-standard-schema.js +6 -0
  516. package/dist/utilities/functions/is-standard-schema.js.map +1 -1
  517. package/dist/utilities/functions/lazy.d.ts +3 -3
  518. package/dist/utilities/functions/lazy.js +3 -3
  519. package/dist/utilities/functions/lazy.js.map +1 -1
  520. package/dist/utilities/functions/option.d.ts +3 -0
  521. package/dist/utilities/functions/option.js +3 -0
  522. package/dist/utilities/functions/option.js.map +1 -1
  523. package/dist/utilities/functions/validate.d.ts +5 -0
  524. package/dist/utilities/functions/validate.js +5 -0
  525. package/dist/utilities/functions/validate.js.map +1 -1
  526. package/dist/utilities/types/any-class.type.d.ts +6 -0
  527. package/dist/utilities/types/any-class.type.js +3 -0
  528. package/dist/utilities/types/any-class.type.js.map +1 -1
  529. package/package.json +67 -5
  530. package/dist/async/_module-exports.d.ts +0 -4
  531. package/dist/async/_module-exports.js +0 -5
  532. package/dist/async/_module-exports.js.map +0 -1
  533. package/dist/async/async.errors.d.ts +0 -47
  534. package/dist/async/async.errors.js +0 -61
  535. package/dist/async/async.errors.js.map +0 -1
  536. package/dist/async/backof-policies/_module.d.ts +0 -5
  537. package/dist/async/backof-policies/_module.js +0 -6
  538. package/dist/async/backof-policies/_module.js.map +0 -1
  539. package/dist/async/backof-policies/_shared.js.map +0 -1
  540. package/dist/async/backof-policies/constant-backoff-policy/_module.d.ts +0 -1
  541. package/dist/async/backof-policies/constant-backoff-policy/_module.js +0 -2
  542. package/dist/async/backof-policies/constant-backoff-policy/_module.js.map +0 -1
  543. package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
  544. package/dist/async/backof-policies/exponential-backoff-policy/_module.d.ts +0 -1
  545. package/dist/async/backof-policies/exponential-backoff-policy/_module.js +0 -2
  546. package/dist/async/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
  547. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +0 -35
  548. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
  549. package/dist/async/backof-policies/linear-backoff-policy/_module.d.ts +0 -1
  550. package/dist/async/backof-policies/linear-backoff-policy/_module.js +0 -2
  551. package/dist/async/backof-policies/linear-backoff-policy/_module.js.map +0 -1
  552. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +0 -35
  553. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
  554. package/dist/async/backof-policies/polynomial-backoff-policy/_module.d.ts +0 -1
  555. package/dist/async/backof-policies/polynomial-backoff-policy/_module.js +0 -2
  556. package/dist/async/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
  557. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +0 -35
  558. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
  559. package/dist/async/middlewares/_module.d.ts +0 -7
  560. package/dist/async/middlewares/_module.js +0 -8
  561. package/dist/async/middlewares/_module.js.map +0 -1
  562. package/dist/async/middlewares/bulkhead/_module.d.ts +0 -1
  563. package/dist/async/middlewares/bulkhead/_module.js +0 -2
  564. package/dist/async/middlewares/bulkhead/_module.js.map +0 -1
  565. package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +0 -80
  566. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +0 -46
  567. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +0 -1
  568. package/dist/async/middlewares/dynamic/_module.d.ts +0 -1
  569. package/dist/async/middlewares/dynamic/_module.js +0 -2
  570. package/dist/async/middlewares/dynamic/_module.js.map +0 -1
  571. package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +0 -1
  572. package/dist/async/middlewares/fallback/_module.d.ts +0 -2
  573. package/dist/async/middlewares/fallback/_module.js +0 -3
  574. package/dist/async/middlewares/fallback/_module.js.map +0 -1
  575. package/dist/async/middlewares/fallback/fallback.middleware.js.map +0 -1
  576. package/dist/async/middlewares/fallback/fallback.types.js.map +0 -1
  577. package/dist/async/middlewares/hedging/_module.d.ts +0 -2
  578. package/dist/async/middlewares/hedging/_module.js +0 -3
  579. package/dist/async/middlewares/hedging/_module.js.map +0 -1
  580. package/dist/async/middlewares/hedging/hedging.types.d.ts +0 -121
  581. package/dist/async/middlewares/hedging/hedging.types.js +0 -6
  582. package/dist/async/middlewares/hedging/hedging.types.js.map +0 -1
  583. package/dist/async/middlewares/hedging/sequential-hedging.middleware.d.ts +0 -51
  584. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js +0 -133
  585. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js.map +0 -1
  586. package/dist/async/middlewares/observe/_module.d.ts +0 -2
  587. package/dist/async/middlewares/observe/_module.js +0 -3
  588. package/dist/async/middlewares/observe/_module.js.map +0 -1
  589. package/dist/async/middlewares/observe/observe.middleware.js.map +0 -1
  590. package/dist/async/middlewares/observe/observe.types.js +0 -6
  591. package/dist/async/middlewares/observe/observe.types.js.map +0 -1
  592. package/dist/async/middlewares/retry/_module.d.ts +0 -2
  593. package/dist/async/middlewares/retry/_module.js +0 -3
  594. package/dist/async/middlewares/retry/_module.js.map +0 -1
  595. package/dist/async/middlewares/retry/retry.middleware.js.map +0 -1
  596. package/dist/async/middlewares/retry/retry.types.js +0 -7
  597. package/dist/async/middlewares/retry/retry.types.js.map +0 -1
  598. package/dist/async/middlewares/timeout/_module.d.ts +0 -2
  599. package/dist/async/middlewares/timeout/_module.js +0 -3
  600. package/dist/async/middlewares/timeout/_module.js.map +0 -1
  601. package/dist/async/middlewares/timeout/timeout.middleware.js.map +0 -1
  602. package/dist/async/middlewares/timeout/timeout.type.js +0 -6
  603. package/dist/async/middlewares/timeout/timeout.type.js.map +0 -1
  604. package/dist/async/utilities/_module.d.ts +0 -4
  605. package/dist/async/utilities/_module.js +0 -5
  606. package/dist/async/utilities/_module.js.map +0 -1
  607. package/dist/async/utilities/abort-and-fail/_module.d.ts +0 -1
  608. package/dist/async/utilities/abort-and-fail/_module.js +0 -2
  609. package/dist/async/utilities/abort-and-fail/_module.js.map +0 -1
  610. package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +0 -1
  611. package/dist/async/utilities/lazy-promise/_module.d.ts +0 -1
  612. package/dist/async/utilities/lazy-promise/_module.js +0 -2
  613. package/dist/async/utilities/lazy-promise/_module.js.map +0 -1
  614. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +0 -153
  615. package/dist/async/utilities/lazy-promise/lazy-promise.js +0 -176
  616. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +0 -1
  617. package/dist/async/utilities/promise-queue/_module.d.ts +0 -1
  618. package/dist/async/utilities/promise-queue/_module.js +0 -2
  619. package/dist/async/utilities/promise-queue/_module.js.map +0 -1
  620. package/dist/async/utilities/promise-queue/promise-queue.d.ts +0 -32
  621. package/dist/async/utilities/promise-queue/promise-queue.js +0 -118
  622. package/dist/async/utilities/promise-queue/promise-queue.js.map +0 -1
  623. package/dist/async/utilities/timeout-and-fail/_module.d.ts +0 -1
  624. package/dist/async/utilities/timeout-and-fail/_module.js +0 -2
  625. package/dist/async/utilities/timeout-and-fail/_module.js.map +0 -1
  626. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +0 -7
  627. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +0 -22
  628. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +0 -1
  629. package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +0 -40
  630. package/dist/lock/implementations/derivables/lock-provider/lock-state.js +0 -60
  631. package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +0 -1
  632. package/dist/serde/contracts/serializable.contract.d.ts +0 -12
  633. package/dist/serde/contracts/serializable.contract.js +0 -5
  634. package/dist/serde/contracts/serializable.contract.js.map +0 -1
  635. package/dist/serde/implementations/adapters/mongodb-serde/_module.d.ts +0 -1
  636. package/dist/serde/implementations/adapters/mongodb-serde/_module.js +0 -2
  637. package/dist/serde/implementations/adapters/mongodb-serde/_module.js.map +0 -1
  638. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.d.ts +0 -13
  639. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +0 -38
  640. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +0 -1
  641. package/dist/serde/implementations/adapters/redis-serde/_module.d.ts +0 -1
  642. package/dist/serde/implementations/adapters/redis-serde/_module.js +0 -2
  643. package/dist/serde/implementations/adapters/redis-serde/_module.js.map +0 -1
  644. package/dist/serde/implementations/adapters/redis-serde/redis-serde.d.ts +0 -13
  645. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +0 -39
  646. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +0 -1
  647. package/dist/serde/implementations/adapters/sql-serde/_module.d.ts +0 -1
  648. package/dist/serde/implementations/adapters/sql-serde/_module.js +0 -2
  649. package/dist/serde/implementations/adapters/sql-serde/_module.js.map +0 -1
  650. package/dist/serde/implementations/adapters/sql-serde/sql-serde.d.ts +0 -13
  651. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +0 -39
  652. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +0 -1
  653. package/dist/utilities/classes/hooks/_module.d.ts +0 -3
  654. package/dist/utilities/classes/hooks/_module.js +0 -4
  655. package/dist/utilities/classes/hooks/_module.js.map +0 -1
  656. package/dist/utilities/classes/hooks/async-hooks.js.map +0 -1
  657. package/dist/utilities/classes/hooks/hooks.js.map +0 -1
  658. package/dist/utilities/classes/hooks/types.js +0 -5
  659. package/dist/utilities/classes/hooks/types.js.map +0 -1
  660. package/dist/utilities/classes/namespace/_module.d.ts +0 -1
  661. package/dist/utilities/classes/namespace/_module.js +0 -2
  662. package/dist/utilities/classes/namespace/_module.js.map +0 -1
  663. package/dist/utilities/classes/namespace/namespace.d.ts +0 -85
  664. package/dist/utilities/classes/namespace/namespace.js +0 -125
  665. package/dist/utilities/classes/namespace/namespace.js.map +0 -1
  666. package/dist/utilities/classes/time-span/_module.d.ts +0 -1
  667. package/dist/utilities/classes/time-span/_module.js +0 -2
  668. package/dist/utilities/classes/time-span/_module.js.map +0 -1
  669. package/dist/utilities/classes/time-span/time-span.js.map +0 -1
  670. package/dist/utilities/contracts/serialized-error.contract.d.ts +0 -13
  671. package/dist/utilities/contracts/serialized-error.contract.js +0 -5
  672. package/dist/utilities/contracts/serialized-error.contract.js.map +0 -1
@@ -1,133 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import { AsyncHooks, callErrorPolicyOnThrow, callErrorPolicyOnValue, callInvokable, isInvokable, optionNone, optionSome, resolveOneOrMore, UnexpectedError, } from "../../../utilities/_module-exports.js";
5
- import {} from "../../../async/middlewares/hedging/hedging.types.js";
6
- /**
7
- * @internal
8
- */
9
- function resolveFunctions(primaryFn, fallbacks, middlewares, signalBinder) {
10
- const resolvedFallbacks = resolveOneOrMore(fallbacks).map((fallback, index) => {
11
- if (isInvokable(fallback)) {
12
- return {
13
- name: `fallback-${String(index + 1)}`,
14
- invokable: fallback,
15
- };
16
- }
17
- return fallback;
18
- });
19
- return [
20
- {
21
- name: "__primary",
22
- invokable: primaryFn,
23
- },
24
- ...resolvedFallbacks,
25
- ].map((namedFn) => ({
26
- name: namedFn.name,
27
- invokable: new AsyncHooks(namedFn.invokable, middlewares, {
28
- signalBinder,
29
- }),
30
- }));
31
- }
32
- /**
33
- * The `sequentialHedging` middleware executes the primary function and all fallback functions sequentially.
34
- * It returns the result of the first successful function and automatically cancels all remaining functions.
35
- * If all function fail than last error is thrown.
36
- *
37
- * IMPORT_PATH: `"@daiso-tech/core/async"`
38
- * @group Middlewares
39
- * @throws {HedgingAsyncError} {@link HedgingAsyncError}
40
- *
41
- * @example
42
- * ```ts
43
- * import { sequentialHedging } from "@daiso-tech/core/async";
44
- * import { AsyncHooks } from "@daiso-tech/core/utilities";
45
- *
46
- * async function fn1(signal?: AbortSignal): Promise<unknown> {
47
- * const response = await fetch("ENDPOINT-1", { signal });
48
- * return await response.json();
49
- * }
50
- * async function fn2(signal?: AbortSignal): Promise<unknown> {
51
- * const response = await fetch("ENDPOINT-2", { signal });
52
- * return await response.json();
53
- * }
54
- * async function fn3(signal?: AbortSignal): Promise<unknown> {
55
- * const response = await fetch("ENDPOINT-3", { signal });
56
- * return await response.json();
57
- * }
58
- * const fetchData = new AsyncHooks(fn1, [
59
- * sequentialHedging({
60
- * fallbacks: [
61
- * fn2,
62
- * fn3
63
- * ]
64
- * })
65
- * ], {
66
- * signalBinder: {
67
- * getSignal: (args) => args[0],
68
- * forwardSignal: (args, signal) => {
69
- * args[0] = signal;
70
- * }
71
- * }
72
- * });
73
- *
74
- * console.log(await fetchData.invoke());
75
- * ```
76
- */
77
- export function sequentialHedging(settings) {
78
- const { middlewares = [], fallbacks, errorPolicy, onHedgingAttempt = () => { }, onHedgingError = () => { }, } = settings;
79
- return async (args, next, { context, signal, signalBinder }) => {
80
- const funcs = resolveFunctions(next, fallbacks, middlewares, signalBinder);
81
- let lastError = optionNone();
82
- for (const { name, invokable: func } of funcs) {
83
- try {
84
- if (signal.aborted) {
85
- break;
86
- }
87
- callInvokable(onHedgingAttempt, {
88
- args,
89
- context,
90
- name,
91
- });
92
- const value = await callInvokable(func, ...args);
93
- // Handle hedging if an Result type is returned
94
- if (!(await callErrorPolicyOnValue(errorPolicy, value))) {
95
- return value;
96
- }
97
- // We can cast type here because callErrorPolicyOnValue ensures the value is a ResultFailure
98
- const resultFailure = value;
99
- callInvokable(onHedgingError, {
100
- args,
101
- context,
102
- error: resultFailure.error,
103
- name,
104
- });
105
- lastError = optionSome(resultFailure.error);
106
- // Handle hedging if an error is thrown
107
- }
108
- catch (error) {
109
- if (signal.aborted) {
110
- break;
111
- }
112
- if (await callErrorPolicyOnThrow(errorPolicy, error)) {
113
- lastError = optionSome(error);
114
- }
115
- else {
116
- throw error;
117
- }
118
- callInvokable(onHedgingError, {
119
- args,
120
- context,
121
- error,
122
- name,
123
- });
124
- lastError = optionSome(error);
125
- }
126
- }
127
- if (lastError.type === "none") {
128
- throw new UnexpectedError("!!__MESSAGE__!!");
129
- }
130
- throw lastError.value;
131
- };
132
- }
133
- //# sourceMappingURL=sequential-hedging.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequential-hedging.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/hedging/sequential-hedging.middleware.ts"],"names":[],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- export * from "../../../async/middlewares/observe/observe.middleware.js";
2
- export * from "../../../async/middlewares/observe/observe.types.js";
@@ -1,3 +0,0 @@
1
- export * from "../../../async/middlewares/observe/observe.middleware.js";
2
- export * from "../../../async/middlewares/observe/observe.types.js";
3
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/observe/_module.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC;AAClE,cAAc,8CAA8C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"observe.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/observe/observe.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,QAAQ,EACR,MAAM,EACN,QAAQ,GAGX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,aAAa,GAEhB,MAAM,gCAAgC,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,MAAM,UAAU,OAAO,CAKnB,QAAmE;IAEnE,MAAM,EACF,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EACpB,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,GACvB,GAAG,QAAQ,CAAC;IACb,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC;YACD,aAAa,CAAC,OAAO,EAAE;gBACnB,IAAI;gBACJ,OAAO;aACV,CAAC,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAExC,6CAA6C;YAC7C,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACxB,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;oBACtC,aAAa,CAAC,SAAS,EAAE;wBACrB,IAAI;wBACJ,OAAO;wBACP,WAAW,EACP,WAAW,CAAC,KAAoC;qBACvD,CAAC,CAAC;oBACH,OAAO,WAAW,CAAC;gBACvB,CAAC;gBAED,aAAa,CAAC,OAAO,EAAE;oBACnB,IAAI;oBACJ,OAAO;oBACP,KAAK,EAAE,WAAW,CAAC,KAAK;iBAC3B,CAAC,CAAC;gBACH,OAAO,WAAW,CAAC;YACvB,CAAC;YAED,aAAa,CAAC,SAAS,EAAE;gBACrB,IAAI;gBACJ,OAAO;gBACP,WAAW,EAAE,WAA0C;aAC1D,CAAC,CAAC;YACH,OAAO,WAAW,CAAC;QACvB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,aAAa,CAAC,OAAO,EAAE;gBACnB,IAAI;gBACJ,OAAO;gBACP,KAAK;aACR,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QAChB,CAAC;gBAAS,CAAC;YACP,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC;YACzB,aAAa,CAAC,SAAS,EAAE;gBACrB,OAAO;gBACP,aAAa,EAAE,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;aACjD,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import {} from "../../../utilities/_module-exports.js";
5
- import {} from "../../../utilities/_module-exports.js";
6
- //# sourceMappingURL=observe.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"observe.types.js","sourceRoot":"","sources":["../../../../src/async/middlewares/observe/observe.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAoB,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAkB,MAAM,gCAAgC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "../../../async/middlewares/retry/retry.middleware.js";
2
- export * from "../../../async/middlewares/retry/retry.types.js";
@@ -1,3 +0,0 @@
1
- export * from "../../../async/middlewares/retry/retry.middleware.js";
2
- export * from "../../../async/middlewares/retry/retry.types.js";
3
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/retry/_module.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/retry/retry.middleware.ts"],"names":[],"mappings":"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"}
@@ -1,7 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import {} from "../../../utilities/_module-exports.js";
5
- import {} from "../../../async/backof-policies/_module.js";
6
- import {} from "../../../utilities/_module-exports.js";
7
- //# sourceMappingURL=retry.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.types.js","sourceRoot":"","sources":["../../../../src/async/middlewares/retry/retry.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAGN,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAsB,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAA4B,MAAM,gCAAgC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "../../../async/middlewares/timeout/timeout.middleware.js";
2
- export * from "../../../async/middlewares/timeout/timeout.type.js";
@@ -1,3 +0,0 @@
1
- export * from "../../../async/middlewares/timeout/timeout.middleware.js";
2
- export * from "../../../async/middlewares/timeout/timeout.type.js";
3
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/middlewares/timeout/_module.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC;AAClE,cAAc,6CAA6C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeout.middleware.js","sourceRoot":"","sources":["../../../../src/async/middlewares/timeout/timeout.middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAON,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,OAAO,CAKnB,WAA4D,EAAE;IAE9D,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EAAE,GAC9D,QAAQ,CAAC;IACb,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QACpD,IAAI,CAAC;YACD,OAAO,MAAM,cAAc,CACvB,IAAI,CAAC,GAAG,IAAI,CAAC,EACb,QAAQ,EACR,CAAC,KAAc,EAAE,EAAE;gBACf,KAAK,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,EACD,MAAM,CACT,CAAC;QACN,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;gBACrC,aAAa,CAAC,SAAS,EAAE;oBACrB,IAAI;oBACJ,OAAO;oBACP,QAAQ;iBACX,CAAC,CAAC;YACP,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC,CAAC;AACN,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import {} from "../../../utilities/_module-exports.js";
5
- import {} from "../../../utilities/_module-exports.js";
6
- //# sourceMappingURL=timeout.type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeout.type.js","sourceRoot":"","sources":["../../../../src/async/middlewares/timeout/timeout.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAoB,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAkB,MAAM,gCAAgC,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from "../../async/utilities/abort-and-fail/_module.js";
2
- export * from "../../async/utilities/lazy-promise/_module.js";
3
- export * from "../../async/utilities/promise-queue/_module.js";
4
- export * from "../../async/utilities/timeout-and-fail/_module.js";
@@ -1,5 +0,0 @@
1
- export * from "../../async/utilities/abort-and-fail/_module.js";
2
- export * from "../../async/utilities/lazy-promise/_module.js";
3
- export * from "../../async/utilities/promise-queue/_module.js";
4
- export * from "../../async/utilities/timeout-and-fail/_module.js";
5
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/async/utilities/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC"}
@@ -1 +0,0 @@
1
- export * from "../../../async/utilities/abort-and-fail/abort-and-fail.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../async/utilities/abort-and-fail/abort-and-fail.js";
2
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/abort-and-fail/_module.ts"],"names":[],"mappings":"AAAA,cAAc,oDAAoD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"abort-and-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/abort-and-fail/abort-and-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,SAAS,oBAAoB,CACzB,WAAwB;IAKxB,IAAI,OAAO,GAAsC,IAAI,CAAC;IACtD,SAAS,KAAK;QACV,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO;YACH,2EAA2E;YAC3E,OAAO,EAAE,OAAO,CAAC,MAAM,CAAS,WAAW,CAAC,MAAM,CAAC;YACnD,KAAK;SACR,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,OAAO,GAAG,MAAM,CAAC;YACjB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACtB,KAAK,EAAE,CAAC;gBACR,OAAO;YACX,CAAC;YACD,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE;gBACzC,IAAI,EAAE,IAAI;aACb,CAAC,CAAC;QACP,CAAC,CAAC;QACF,KAAK;KACR,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAC9B,OAA4B,EAC5B,WAAwB;IAExB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,WAAW,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,GACxC,oBAAoB,CAAS,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC;QACD,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC7D,CAAC;YAAS,CAAC;QACP,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- export * from "../../../async/utilities/lazy-promise/lazy-promise.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../async/utilities/lazy-promise/lazy-promise.js";
2
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/_module.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC"}
@@ -1,153 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import { type AsyncLazy, type AsyncMiddleware, type Invokable, type InvokableFn, type OneOrMore, type Promisable, type TimeSpan } from "../../../utilities/_module-exports.js";
5
- /**
6
- *
7
- * IMPORT_PATH: `"@daiso-tech/core/async"`
8
- * @group Utilities
9
- */
10
- export type LazyPromiseResolve<TValue> = InvokableFn<[
11
- value: Promisable<TValue>
12
- ], void>;
13
- /**
14
- *
15
- * IMPORT_PATH: `"@daiso-tech/core/async"`
16
- * @group Utilities
17
- */
18
- export type LazyPromiseReject = InvokableFn<[error: unknown], void>;
19
- /**
20
- *
21
- * IMPORT_PATH: `"@daiso-tech/core/async"`
22
- * @group Utilities
23
- */
24
- export type LazyPromiseCallback<TValue> = InvokableFn<[
25
- resolve: LazyPromiseResolve<TValue>,
26
- reject: LazyPromiseReject
27
- ], Promisable<void>>;
28
- /**
29
- * The `LazyPromise` class is used for creating lazy {@link PromiseLike | `PromiseLike`} object that will only execute when awaited or when `then` method is called.
30
- * Note the class is immutable.
31
- *
32
- * IMPORT_PATH: `"@daiso-tech/core/async"`
33
- * @group Utilities
34
- */
35
- export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
36
- /**
37
- * The `wrapFn` is convience method used for wrapping async {@link Invokable | `Invokable`} with a `LazyPromise`.
38
- * @example
39
- * ```ts
40
- * import { LazyPromise, retry } from "@daiso-tech/core/async";
41
- * import { TimeSpan } from "@daiso-tech/core/utilities";
42
- * import { readFile as readFileNodeJs } from "node:fs/promises";
43
- *
44
- * const readFile = LazyPromise.wrapFn(readFileNodeJs);
45
- *
46
- * const file = await readFile("none_existing_file.txt");
47
- * ```
48
- */
49
- static wrapFn<TArgs extends unknown[], TReturn>(fn: Invokable<TArgs, Promisable<TReturn>>): InvokableFn<TArgs, LazyPromise<TReturn>>;
50
- /**
51
- * The `delay` method creates a {@link LazyPromise | `LazyPromise`} that will be fulfilled after given `time`.
52
- *
53
- * @example
54
- * ```ts
55
- * import { LazyPromise } from "@daiso-tech/core/async";
56
- * import { TimeSpan } from "@daiso-tech/core/utilities";
57
- *
58
- * console.log("a");
59
- * await LazyPromise.delay(TimeSpan.fromSeconds(2));
60
- * console.log("b");
61
- * ```
62
- */
63
- static delay(time: TimeSpan, abortSignal?: AbortSignal): LazyPromise<void>;
64
- /**
65
- * The `all` method works similarly to {@link Promise.all | `Promise.all`} with the key distinction that it operates lazily.
66
- */
67
- static all<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue[]>;
68
- /**
69
- * The `allSettled` method works similarly to {@link Promise.allSettled | `Promise.allSettled`} with the key distinction that it operates lazily.
70
- */
71
- static allSettled<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<PromiseSettledResult<TValue>[]>;
72
- /**
73
- * The `race` method works similarly to {@link Promise.race | `Promise.race`} with the key distinction that it operates lazily.
74
- */
75
- static race<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue>;
76
- /**
77
- * The `any` method works similarly to {@link Promise.any | `Promise.any`} with the key distinction that it operates lazily.
78
- */
79
- static any<TValue>(promises: LazyPromise<TValue>[]): LazyPromise<TValue>;
80
- /**
81
- * The `fromCallback` is convience method used for wrapping Node js callback functions with a `LazyPromise`.
82
- * @example
83
- * ```ts
84
- * import { LazyPromise } from "@daiso-tech/core/async";
85
- * import { readFile } from "node:fs";
86
- *
87
- * const lazyPromise = LazyPromise.fromCallback<Buffer | string>((resolve, reject) => {
88
- * readFile("FILE_PATH", (err, data) => {
89
- * if (err !== null) {
90
- * reject(err);
91
- * return;
92
- * }
93
- * resolve(data);
94
- * });
95
- * });
96
- * const file = await lazyPromise;
97
- * console.log(file);
98
- * ```
99
- */
100
- static fromCallback<TValue>(callback: LazyPromiseCallback<TValue>): LazyPromise<TValue>;
101
- private promise;
102
- private readonly invokable;
103
- /**
104
- * @example
105
- * ```ts
106
- * import { LazyPromise, retryMiddleware } from "@daiso-tech/core/async";
107
- *
108
- * const promise = new LazyPromise(async () => {
109
- * console.log("I am lazy");
110
- * },
111
- * // You can also pass in one AsyncMiddleware or multiple (as an Array).
112
- * retry()
113
- * );
114
- *
115
- * // "I am lazy" will only logged when awaited or then method i called.
116
- * await promise;
117
- * ```
118
- *
119
- * You can pass sync or async {@link Invokable | `Invokable`}.
120
- */
121
- constructor(invokable: AsyncLazy<TValue>, middlewares?: OneOrMore<AsyncMiddleware<[], TValue>>);
122
- /**
123
- * The `pipe` method returns a new `LazyPromise` instance with the additional `middlewares` applied.
124
- */
125
- pipe(middlewares: OneOrMore<AsyncMiddleware<[], TValue>>): LazyPromise<TValue>;
126
- /**
127
- * The `pipeWhen` method conditionally applies additional `middlewares`, returning a new `LazyPromise` instance only if the specified condition is met.
128
- */
129
- pipeWhen(condition: boolean, middlewares: OneOrMore<AsyncMiddleware<[], TValue>>): LazyPromise<TValue>;
130
- then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
131
- /**
132
- * The `defer` method executes the `LazyPromise` without awaiting it.
133
- * @example
134
- * ```ts
135
- * import { LazyPromise } from "@daiso-tech/core/async";
136
- * import { TimeSpan } from "@daiso-tech/core/utilities";
137
- *
138
- * const promise =
139
- * new LazyPromise(async () => {
140
- * await LazyPromise.delay(TimeSpan.fromSeconds(1));
141
- * // Will be loged after one second
142
- * console.log("Done !");
143
- * });
144
- *
145
- * promise.defer();
146
- *
147
- * // Will be logged immediately
148
- * console.log("Hello");
149
- * await LazyPromise.delay(TimeSpan.fromSeconds(2));
150
- * ```
151
- */
152
- defer(): void;
153
- }
@@ -1,176 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import { AsyncHooks, callInvokable, resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
5
- import { abortAndFail } from "../../../async/utilities/abort-and-fail/_module.js";
6
- /**
7
- * The `LazyPromise` class is used for creating lazy {@link PromiseLike | `PromiseLike`} object that will only execute when awaited or when `then` method is called.
8
- * Note the class is immutable.
9
- *
10
- * IMPORT_PATH: `"@daiso-tech/core/async"`
11
- * @group Utilities
12
- */
13
- export class LazyPromise {
14
- /**
15
- * The `wrapFn` is convience method used for wrapping async {@link Invokable | `Invokable`} with a `LazyPromise`.
16
- * @example
17
- * ```ts
18
- * import { LazyPromise, retry } from "@daiso-tech/core/async";
19
- * import { TimeSpan } from "@daiso-tech/core/utilities";
20
- * import { readFile as readFileNodeJs } from "node:fs/promises";
21
- *
22
- * const readFile = LazyPromise.wrapFn(readFileNodeJs);
23
- *
24
- * const file = await readFile("none_existing_file.txt");
25
- * ```
26
- */
27
- static wrapFn(fn) {
28
- return (...parameters) => new LazyPromise(() => callInvokable(fn, ...parameters));
29
- }
30
- /**
31
- * The `delay` method creates a {@link LazyPromise | `LazyPromise`} that will be fulfilled after given `time`.
32
- *
33
- * @example
34
- * ```ts
35
- * import { LazyPromise } from "@daiso-tech/core/async";
36
- * import { TimeSpan } from "@daiso-tech/core/utilities";
37
- *
38
- * console.log("a");
39
- * await LazyPromise.delay(TimeSpan.fromSeconds(2));
40
- * console.log("b");
41
- * ```
42
- */
43
- static delay(time, abortSignal = new AbortController().signal) {
44
- return new LazyPromise(async () => {
45
- let timeoutId = null;
46
- try {
47
- await abortAndFail(new Promise((resolve) => {
48
- timeoutId = setTimeout(() => {
49
- resolve();
50
- }, time.toMilliseconds());
51
- }), abortSignal);
52
- }
53
- finally {
54
- if (timeoutId !== null) {
55
- clearTimeout(timeoutId);
56
- }
57
- }
58
- });
59
- }
60
- /**
61
- * The `all` method works similarly to {@link Promise.all | `Promise.all`} with the key distinction that it operates lazily.
62
- */
63
- static all(promises) {
64
- return new LazyPromise(async () => Promise.all(promises));
65
- }
66
- /**
67
- * The `allSettled` method works similarly to {@link Promise.allSettled | `Promise.allSettled`} with the key distinction that it operates lazily.
68
- */
69
- static allSettled(promises) {
70
- return new LazyPromise(async () => Promise.allSettled(promises));
71
- }
72
- /**
73
- * The `race` method works similarly to {@link Promise.race | `Promise.race`} with the key distinction that it operates lazily.
74
- */
75
- static race(promises) {
76
- return new LazyPromise(async () => Promise.race(promises));
77
- }
78
- /**
79
- * The `any` method works similarly to {@link Promise.any | `Promise.any`} with the key distinction that it operates lazily.
80
- */
81
- static any(promises) {
82
- return new LazyPromise(async () => Promise.any(promises));
83
- }
84
- /**
85
- * The `fromCallback` is convience method used for wrapping Node js callback functions with a `LazyPromise`.
86
- * @example
87
- * ```ts
88
- * import { LazyPromise } from "@daiso-tech/core/async";
89
- * import { readFile } from "node:fs";
90
- *
91
- * const lazyPromise = LazyPromise.fromCallback<Buffer | string>((resolve, reject) => {
92
- * readFile("FILE_PATH", (err, data) => {
93
- * if (err !== null) {
94
- * reject(err);
95
- * return;
96
- * }
97
- * resolve(data);
98
- * });
99
- * });
100
- * const file = await lazyPromise;
101
- * console.log(file);
102
- * ```
103
- */
104
- static fromCallback(callback) {
105
- return new LazyPromise(() => new Promise((resolve, reject) => {
106
- callback(resolve, reject);
107
- }));
108
- }
109
- promise = null;
110
- invokable;
111
- /**
112
- * @example
113
- * ```ts
114
- * import { LazyPromise, retryMiddleware } from "@daiso-tech/core/async";
115
- *
116
- * const promise = new LazyPromise(async () => {
117
- * console.log("I am lazy");
118
- * },
119
- * // You can also pass in one AsyncMiddleware or multiple (as an Array).
120
- * retry()
121
- * );
122
- *
123
- * // "I am lazy" will only logged when awaited or then method i called.
124
- * await promise;
125
- * ```
126
- *
127
- * You can pass sync or async {@link Invokable | `Invokable`}.
128
- */
129
- constructor(invokable, middlewares = []) {
130
- this.invokable = new AsyncHooks(() => resolveAsyncLazyable(invokable), middlewares);
131
- }
132
- /**
133
- * The `pipe` method returns a new `LazyPromise` instance with the additional `middlewares` applied.
134
- */
135
- pipe(middlewares) {
136
- return new LazyPromise(this.invokable.pipe(middlewares));
137
- }
138
- /**
139
- * The `pipeWhen` method conditionally applies additional `middlewares`, returning a new `LazyPromise` instance only if the specified condition is met.
140
- */
141
- pipeWhen(condition, middlewares) {
142
- return new LazyPromise(this.invokable.pipeWhen(condition, middlewares));
143
- }
144
- then(onfulfilled, onrejected) {
145
- if (this.promise === null) {
146
- this.promise = this.invokable.invoke();
147
- }
148
- // eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
149
- return this.promise.then(onfulfilled, onrejected);
150
- }
151
- /**
152
- * The `defer` method executes the `LazyPromise` without awaiting it.
153
- * @example
154
- * ```ts
155
- * import { LazyPromise } from "@daiso-tech/core/async";
156
- * import { TimeSpan } from "@daiso-tech/core/utilities";
157
- *
158
- * const promise =
159
- * new LazyPromise(async () => {
160
- * await LazyPromise.delay(TimeSpan.fromSeconds(1));
161
- * // Will be loged after one second
162
- * console.log("Done !");
163
- * });
164
- *
165
- * promise.defer();
166
- *
167
- * // Will be logged immediately
168
- * console.log("Hello");
169
- * await LazyPromise.delay(TimeSpan.fromSeconds(2));
170
- * ```
171
- */
172
- defer() {
173
- this.then(() => { });
174
- }
175
- }
176
- //# sourceMappingURL=lazy-promise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"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"}
@@ -1 +0,0 @@
1
- export * from "../../../async/utilities/promise-queue/promise-queue.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../async/utilities/promise-queue/promise-queue.js";
2
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/utilities/promise-queue/_module.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC"}