@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
@@ -3,20 +3,20 @@
3
3
  */
4
4
  import { TimeSpan, type Factory, type AsyncLazy } from "../../../../utilities/_module-exports.js";
5
5
  import { KeyPrefixer, type OneOrMore } from "../../../../utilities/_module-exports.js";
6
- import type { IDatabaseLockAdapter, LockEvents } from "../../../../lock/contracts/_module-exports.js";
6
+ import type { IDatabaseLockAdapter, LockEventMap } from "../../../../lock/contracts/_module-exports.js";
7
7
  import { type ILock, type LockProviderCreateSettings, type ILockProvider, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
8
8
  import { LazyPromise } from "../../../../async/_module-exports.js";
9
- import type { EventClass, EventInstance, EventListener, IEventBus, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
9
+ import type { EventListener, IEventBus, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
10
10
  import type { IFlexibleSerde } from "../../../../serde/contracts/_module-exports.js";
11
11
  /**
12
12
  *
13
- * IMPORT_PATH: ```"@daiso-tech/core/lock"```
13
+ * IMPORT_PATH: `"@daiso-tech/core/lock"`
14
14
  * @group Derivables
15
15
  */
16
16
  export type LockProviderSettingsBase = {
17
17
  keyPrefixer: KeyPrefixer;
18
18
  /**
19
- * 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>LockProvider</i> class.
19
+ * You can pass a {@link Factory | `Factory`} of {@link LazyPromise| `LazyPromise`} to configure default settings for all {@link LazyPromise| `LazyPromise`} instances used in the `LockProvider` class.
20
20
  * @default
21
21
  * ```ts
22
22
  * import { LazyPromise } from "@daiso-tech/core/async";
@@ -47,9 +47,9 @@ export type LockProviderSettingsBase = {
47
47
  * })
48
48
  * ```
49
49
  */
50
- eventBus?: IEventBus<any>;
50
+ eventBus?: IEventBus;
51
51
  /**
52
- * You can decide the default ttl value for <i>{@link ILock}</i> expiration. If null is passed then no ttl will be used by default.
52
+ * You can decide the default ttl value for {@link ILock | `ILock`} expiration. If null is passed then no ttl will be used by default.
53
53
  * @default
54
54
  * ```ts
55
55
  * TimeSpan.fromMinutes(5);
@@ -57,7 +57,7 @@ export type LockProviderSettingsBase = {
57
57
  */
58
58
  defaultTtl?: TimeSpan | null;
59
59
  /**
60
- * The default refresh time used in the <i>{@link ILock}</i> <i>acquireBlocking</i> and <i>runBlocking</i> methods.
60
+ * The default refresh time used in the {@link ILock | `ILock`} `acquireBlocking` and `runBlocking` methods.
61
61
  * @default
62
62
  * ```ts
63
63
  * TimeSpan.fromSeconds(1);
@@ -65,7 +65,7 @@ export type LockProviderSettingsBase = {
65
65
  */
66
66
  defaultBlockingInterval?: TimeSpan;
67
67
  /**
68
- * The default refresh time used in the <i>{@link ILock}</i> <i>acquireBlocking</i> and <i>runBlocking</i> methods.
68
+ * The default refresh time used in the {@link ILock | `ILock`} `acquireBlocking` and `runBlocking` methods.
69
69
  * @default
70
70
  * ```ts
71
71
  * TimeSpan.fromMinutes(1);
@@ -73,7 +73,7 @@ export type LockProviderSettingsBase = {
73
73
  */
74
74
  defaultBlockingTime?: TimeSpan;
75
75
  /**
76
- * The default refresh time used in the <i>{@link ILock}</i> <i>referesh</i> method.
76
+ * The default refresh time used in the {@link ILock | `ILock`} `referesh` method.
77
77
  * ```ts
78
78
  * TimeSpan.fromMinutes(5);
79
79
  * ```
@@ -82,26 +82,26 @@ export type LockProviderSettingsBase = {
82
82
  };
83
83
  /**
84
84
  *
85
- * IMPORT_PATH: ```"@daiso-tech/core/lock"```
85
+ * IMPORT_PATH: `"@daiso-tech/core/lock"`
86
86
  * @group Derivables
87
87
  */
88
88
  export type LockAdapter = ILockAdapter | IDatabaseLockAdapter;
89
89
  /**
90
90
  *
91
- * IMPORT_PATH: ```"@daiso-tech/core/lock"```
91
+ * IMPORT_PATH: `"@daiso-tech/core/lock"`
92
92
  * @group Derivables
93
93
  */
94
94
  export type LockProviderSettings = LockProviderSettingsBase & {
95
95
  adapter: LockAdapter;
96
96
  };
97
97
  /**
98
- * <i>LockProvider</i> class can be derived from any <i>{@link ILockAdapter}</i> or <i>{@link IDatabaseLockAdapter}</i>.
98
+ * `LockProvider` class can be derived from any {@link ILockAdapter | `ILockAdapter`} or {@link IDatabaseLockAdapter | `IDatabaseLockAdapter`}.
99
99
  *
100
- * Note the <i>{@link ILock}</i> instances created by the <i>LockProvider</i> class are serializable and deserializable,
100
+ * Note the {@link ILock | `ILock`} instances created by the `LockProvider` class are serializable and deserializable,
101
101
  * allowing them to be seamlessly transferred across different servers, processes, and databases.
102
- * This can be done directly using <i>{@link IFlexibleSerde}</i> or indirectly through components that rely on <i>{@link IFlexibleSerde}</i> internally.
102
+ * This can be done directly using {@link IFlexibleSerde | `IFlexibleSerde`} or indirectly through components that rely on {@link IFlexibleSerde | `IFlexibleSerde`} internally.
103
103
  *
104
- * IMPORT_PATH: ```"@daiso-tech/core/lock"```
104
+ * IMPORT_PATH: `"@daiso-tech/core/lock"`
105
105
  * @group Derivables
106
106
  */
107
107
  export declare class LockProvider implements ILockProvider {
@@ -145,35 +145,35 @@ export declare class LockProvider implements ILockProvider {
145
145
  constructor(settings: LockProviderSettings);
146
146
  private registerToSerde;
147
147
  /**
148
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
149
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
148
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
149
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
150
150
  */
151
- addListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
151
+ addListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
152
152
  /**
153
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
154
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
153
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
154
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
155
155
  */
156
- removeListener<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
156
+ removeListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
157
157
  /**
158
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
159
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
158
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
159
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
160
160
  */
161
- listenOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<void>;
161
+ listenOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
162
162
  /**
163
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
164
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
163
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
164
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
165
165
  */
166
- asPromise<TEventClass extends EventClass<LockEvents>>(event: TEventClass): LazyPromise<EventInstance<TEventClass>>;
166
+ asPromise<TEventName extends keyof LockEventMap>(eventName: TEventName): LazyPromise<LockEventMap[TEventName]>;
167
167
  /**
168
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
169
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
168
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
169
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
170
170
  */
171
- subscribeOnce<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
171
+ subscribeOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<Unsubscribe>;
172
172
  /**
173
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
174
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
173
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
174
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
175
175
  */
176
- subscribe<TEventClass extends EventClass<LockEvents>>(event: TEventClass, listener: EventListener<EventInstance<TEventClass>>): LazyPromise<Unsubscribe>;
176
+ subscribe<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<Unsubscribe>;
177
177
  private createLazyPromise;
178
178
  /**
179
179
  * @example
@@ -14,13 +14,13 @@ import { isDatabaseLockAdapter } from "../../../../lock/implementations/derivabl
14
14
  import { DatabaseLockAdapter } from "../../../../lock/implementations/derivables/lock-provider/database-lock-adapter.js";
15
15
  import { LockSerdeTransformer } from "../../../../lock/implementations/derivables/lock-provider/lock-serde-transformer.js";
16
16
  /**
17
- * <i>LockProvider</i> class can be derived from any <i>{@link ILockAdapter}</i> or <i>{@link IDatabaseLockAdapter}</i>.
17
+ * `LockProvider` class can be derived from any {@link ILockAdapter | `ILockAdapter`} or {@link IDatabaseLockAdapter | `IDatabaseLockAdapter`}.
18
18
  *
19
- * Note the <i>{@link ILock}</i> instances created by the <i>LockProvider</i> class are serializable and deserializable,
19
+ * Note the {@link ILock | `ILock`} instances created by the `LockProvider` class are serializable and deserializable,
20
20
  * allowing them to be seamlessly transferred across different servers, processes, and databases.
21
- * This can be done directly using <i>{@link IFlexibleSerde}</i> or indirectly through components that rely on <i>{@link IFlexibleSerde}</i> internally.
21
+ * This can be done directly using {@link IFlexibleSerde | `IFlexibleSerde`} or indirectly through components that rely on {@link IFlexibleSerde | `IFlexibleSerde`} internally.
22
22
  *
23
- * IMPORT_PATH: ```"@daiso-tech/core/lock"```
23
+ * IMPORT_PATH: `"@daiso-tech/core/lock"`
24
24
  * @group Derivables
25
25
  */
26
26
  export class LockProvider {
@@ -87,7 +87,7 @@ export class LockProvider {
87
87
  registerToSerde() {
88
88
  const transformer = new LockSerdeTransformer({
89
89
  adapter: this.adapter,
90
- createLazyPromise: this.createLazyPromise.bind(this),
90
+ createLazyPromise: (asyncFn) => this.createLazyPromise(asyncFn),
91
91
  defaultBlockingInterval: this.defaultBlockingInterval,
92
92
  defaultBlockingTime: this.defaultBlockingTime,
93
93
  defaultRefreshTime: this.defaultRefreshTime,
@@ -101,46 +101,46 @@ export class LockProvider {
101
101
  }
102
102
  }
103
103
  /**
104
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
105
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
104
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
105
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
106
106
  */
107
- addListener(event, listener) {
108
- return this.eventBus.addListener(event, listener);
107
+ addListener(eventName, listener) {
108
+ return this.eventBus.addListener(eventName, listener);
109
109
  }
110
110
  /**
111
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
112
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
111
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
112
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
113
113
  */
114
- removeListener(event, listener) {
115
- return this.eventBus.removeListener(event, listener);
114
+ removeListener(eventName, listener) {
115
+ return this.eventBus.removeListener(eventName, listener);
116
116
  }
117
117
  /**
118
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
119
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
118
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
119
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
120
120
  */
121
- listenOnce(event, listener) {
122
- return this.eventBus.listenOnce(event, listener);
121
+ listenOnce(eventName, listener) {
122
+ return this.eventBus.listenOnce(eventName, listener);
123
123
  }
124
124
  /**
125
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
126
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
125
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
126
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
127
127
  */
128
- asPromise(event) {
129
- return this.eventBus.asPromise(event);
128
+ asPromise(eventName) {
129
+ return this.eventBus.asPromise(eventName);
130
130
  }
131
131
  /**
132
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
133
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
132
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
133
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
134
134
  */
135
- subscribeOnce(event, listener) {
136
- return this.eventBus.subscribeOnce(event, listener);
135
+ subscribeOnce(eventName, listener) {
136
+ return this.eventBus.subscribeOnce(eventName, listener);
137
137
  }
138
138
  /**
139
- * You can listen to the following <i>{@link LockEvents}</i> of all <i>{@link ILock}</i> instances created by the <i>{@link ILockProvider}</i>.
140
- * To understand how this method works, refer to <i>{@link IEventListenable}</i>.
139
+ * You can listen to the following {@link LockEvents | `LockEvents`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
140
+ * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
141
141
  */
142
- subscribe(event, listener) {
143
- return this.eventBus.subscribe(event, listener);
142
+ subscribe(eventName, listener) {
143
+ return this.eventBus.subscribe(eventName, listener);
144
144
  }
145
145
  createLazyPromise(asyncFn) {
146
146
  return new LazyPromise(asyncFn);
@@ -168,7 +168,7 @@ export class LockProvider {
168
168
  const keyObj = this.keyPrefixer.create(key);
169
169
  return new Lock({
170
170
  adapter: this.adapter,
171
- createLazyPromise: this.createLazyPromise.bind(this),
171
+ createLazyPromise: (asyncFn) => this.createLazyPromise(asyncFn),
172
172
  lockState: new LockState(this.lockStore, keyObj.prefixed),
173
173
  eventDispatcher: this.eventBus,
174
174
  key: keyObj,
@@ -1 +1 @@
1
- {"version":3,"file":"lock-provider.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,QAAQ,EACR,IAAI,EAIJ,cAAc,EACd,gBAAgB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAkB,MAAM,gCAAgC,CAAC;AAK7E,OAAO,EAKN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;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,EAAE;QAEzC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,GACzD,QAAQ,CAAC;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,IAAI,IAAI,CAAC;YACZ,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;YACpD,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG;YACH,cAAc,EAAE,IAAI;YACpB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;CACJ"}
1
+ {"version":3,"file":"lock-provider.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,QAAQ,EACR,IAAI,EAIJ,cAAc,EACd,gBAAgB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAkB,MAAM,gCAAgC,CAAC;AAK7E,OAAO,EAKN,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAUzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2DAA2D,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,yDAA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AAM,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,IAAI,IAAI,CAAC;YACZ,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC/D,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG;YACH,cAAc,EAAE,IAAI;YACpB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -4,7 +4,7 @@
4
4
  import type { ISerdeTransformer } from "../../../../serde/contracts/_module-exports.js";
5
5
  import { Lock, type ISerializedLock } from "../../../../lock/implementations/derivables/lock-provider/lock.js";
6
6
  import type { OneOrMore } from "../../../../utilities/_module-exports.js";
7
- import type { ILockAdapter, LockEvents } from "../../../../lock/contracts/_module-exports.js";
7
+ import type { ILockAdapter, LockEventMap } from "../../../../lock/contracts/_module-exports.js";
8
8
  import { type ILockStore } from "../../../../lock/implementations/derivables/lock-provider/lock-state.js";
9
9
  import { TimeSpan, type KeyPrefixer } from "../../../../utilities/_module-exports.js";
10
10
  import type { LazyPromise } from "../../../../async/_module-exports.js";
@@ -20,7 +20,7 @@ export type LockSerdeTransformerSettings = {
20
20
  defaultBlockingInterval: TimeSpan;
21
21
  defaultBlockingTime: TimeSpan;
22
22
  defaultRefreshTime: TimeSpan;
23
- eventBus: IEventBus<LockEvents>;
23
+ eventBus: IEventBus<LockEventMap>;
24
24
  serdeTransformerName: string;
25
25
  };
26
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"lock-serde-transformer.js","sourceRoot":"","s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YAAY,IAAI,IAAI,kBAAkB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC;IAC5E,CAAC;IAED,WAAW,CAAC,eAAgC;QACxC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,eAAe,CAAC;QAChE,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE5C,OAAO,IAAI,IAAI,CAAC;YACZ,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;YACxD,cAAc;YACd,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CAAC,iBAAuB;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;CACJ"}
1
+ {"version":3,"file":"lock-serde-transformer.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/lock-serde-transformer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,IAAI,GAEP,MAAM,yDAAyD,CAAC;AAMjE,OAAO,EACH,SAAS,GAEZ,MAAM,+DAA+D,CAAC;AACvE,OAAO,EACH,kBAAkB,EAClB,QAAQ,GAEX,MAAM,gCAAgC,CAAC;AAqBxC;;GAEG;AACH,MAAM,OAAO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;QAE5C,OAAO,IAAI,IAAI,CAAC;YACZ,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YACzD,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,GAAG,EAAE,MAAM;YACX,KAAK;YACL,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;YACxD,cAAc;YACd,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CAAC,iBAAuB;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;CACJ"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { TimeSpan } from "../../../../utilities/_module-exports.js";
5
5
  import { type Key, type AsyncLazy, type OneOrMore, type Result } from "../../../../utilities/_module-exports.js";
6
- import { KeyAlreadyAcquiredLockError, type AquireBlockingSettings, type LockEvents } from "../../../../lock/contracts/_module-exports.js";
6
+ import { KeyAlreadyAcquiredLockError, type AquireBlockingSettings, type LockEventMap } from "../../../../lock/contracts/_module-exports.js";
7
7
  import { type ILock, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
8
8
  import { LazyPromise } from "../../../../async/_module-exports.js";
9
9
  import type { IEventDispatcher } from "../../../../event-bus/contracts/_module-exports.js";
@@ -24,7 +24,7 @@ export type LockSettings = {
24
24
  createLazyPromise: <TValue = void>(asyncFn: () => PromiseLike<TValue>) => LazyPromise<TValue>;
25
25
  adapter: ILockAdapter;
26
26
  lockState: LockState;
27
- eventDispatcher: IEventDispatcher<LockEvents>;
27
+ eventDispatcher: IEventDispatcher<LockEventMap>;
28
28
  key: Key;
29
29
  owner: OneOrMore<string>;
30
30
  ttl: TimeSpan | null;
@@ -34,7 +34,7 @@ export type LockSettings = {
34
34
  defaultRefreshTime: TimeSpan;
35
35
  };
36
36
  /**
37
- * IMPORTANT: This class is not intended to be instantiated directly, instead it should be created by the <i>LockProvider</i> class instance.
37
+ * IMPORTANT: This class is not intended to be instantiated directly, instead it should be created by the `LockProvider` class instance.
38
38
  * @group Derivables
39
39
  */
40
40
  export declare class Lock implements ILock {
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import { resolveLazyable, } from "../../../../utilities/_module-exports.js";
5
5
  import { resolveOneOrMoreStr } from "../../../../utilities/_module-exports.js";
6
- import { KeyAcquiredLockEvent, KeyAlreadyAcquiredLockError, KeyAlreadyAcquiredLockEvent, KeyForceReleasedLockEvent, KeyRefreshedLockEvent, KeyReleasedLockEvent, UnableToAquireLockError, UnexpectedErrorLockEvent, UnownedRefreshLockError, UnownedRefreshLockEvent, UnownedReleaseLockError, UnownedReleaseLockEvent, } from "../../../../lock/contracts/_module-exports.js";
6
+ import { KeyAlreadyAcquiredLockError, LOCK_EVENTS, UnableToAquireLockError, UnableToReleaseLockError, UnownedRefreshLockError, UnownedReleaseLockError, } from "../../../../lock/contracts/_module-exports.js";
7
7
  import {} from "../../../../lock/contracts/_module-exports.js";
8
8
  import { LazyPromise } from "../../../../async/_module-exports.js";
9
9
  /**
10
- * IMPORTANT: This class is not intended to be instantiated directly, instead it should be created by the <i>LockProvider</i> class instance.
10
+ * IMPORTANT: This class is not intended to be instantiated directly, instead it should be created by the `LockProvider` class instance.
11
11
  * @group Derivables
12
12
  */
13
13
  export class Lock {
@@ -64,7 +64,7 @@ export class Lock {
64
64
  finally {
65
65
  await this.release();
66
66
  }
67
- }).setRetryPolicy((error) => error instanceof UnableToAquireLockError);
67
+ });
68
68
  }
69
69
  runOrFail(asyncFn) {
70
70
  return this.createLazyPromise(async () => {
@@ -75,8 +75,7 @@ export class Lock {
75
75
  finally {
76
76
  await this.release();
77
77
  }
78
- }).setRetryPolicy((error) => error instanceof UnableToAquireLockError ||
79
- error instanceof KeyAlreadyAcquiredLockError);
78
+ });
80
79
  }
81
80
  runBlocking(asyncFn, settings) {
82
81
  return this.createLazyPromise(async () => {
@@ -93,7 +92,7 @@ export class Lock {
93
92
  finally {
94
93
  await this.release();
95
94
  }
96
- }).setRetryPolicy((error) => error instanceof UnableToAquireLockError);
95
+ });
97
96
  }
98
97
  runBlockingOrFail(asyncFn, settings) {
99
98
  return new LazyPromise(async () => {
@@ -104,43 +103,48 @@ export class Lock {
104
103
  finally {
105
104
  await this.release();
106
105
  }
107
- }).setRetryPolicy((error) => error instanceof UnableToAquireLockError);
106
+ });
108
107
  }
109
108
  acquire() {
110
109
  return this.createLazyPromise(async () => {
110
+ const prevState = this.lockState.get()?.getTime() ?? null;
111
111
  try {
112
112
  this.lockState.remove();
113
113
  const hasAquired = await this.adapter.acquire(this.key.prefixed, this.owner, this.ttl);
114
114
  if (hasAquired) {
115
115
  this.lockState.set(this.ttl);
116
- const event = new KeyAcquiredLockEvent({
116
+ const event = {
117
117
  key: this.key.resolved,
118
118
  owner: this.owner,
119
119
  ttl: this.ttl,
120
- });
121
- this.eventDispatcher.dispatch(event).defer();
122
- this.eventDispatcher.dispatch(event).defer();
120
+ };
121
+ this.eventDispatcher
122
+ .dispatch(LOCK_EVENTS.ACQUIRED, event)
123
+ .defer();
123
124
  }
124
125
  else {
125
- const event = new KeyAlreadyAcquiredLockEvent({
126
+ const event = {
126
127
  key: this.key.resolved,
127
128
  owner: this.owner,
128
- });
129
- this.eventDispatcher.dispatch(event).defer();
130
- this.eventDispatcher.dispatch(event).defer();
129
+ };
130
+ this.eventDispatcher
131
+ .dispatch(LOCK_EVENTS.NOT_AVAILABLE, event)
132
+ .defer();
131
133
  }
132
134
  return hasAquired;
133
135
  }
134
136
  catch (error) {
135
- const event = new UnexpectedErrorLockEvent({
137
+ this.lockState.set(prevState);
138
+ const event = {
136
139
  key: this.key.resolved,
137
140
  owner: this.owner,
138
141
  ttl: this.ttl,
139
142
  error,
140
- });
141
- this.eventDispatcher.dispatch(event).defer();
142
- this.eventDispatcher.dispatch(event).defer();
143
- throw error;
143
+ };
144
+ this.eventDispatcher
145
+ .dispatch(LOCK_EVENTS.UNEXPECTED_ERROR, event)
146
+ .defer();
147
+ throw new UnableToAquireLockError(`A Lock with name of "${this.key.resolved}" could not be acquired.`, error);
144
148
  }
145
149
  });
146
150
  }
@@ -176,37 +180,42 @@ export class Lock {
176
180
  }
177
181
  release() {
178
182
  return this.createLazyPromise(async () => {
183
+ const prevState = this.lockState.get()?.getTime() ?? null;
179
184
  try {
180
185
  const hasReleased = await this.adapter.release(this.key.prefixed, this.owner);
181
186
  if (hasReleased) {
182
187
  this.lockState.remove();
183
- const event = new KeyReleasedLockEvent({
188
+ const event = {
184
189
  key: this.key.resolved,
185
190
  owner: this.owner,
186
- });
187
- this.eventDispatcher.dispatch(event).defer();
188
- this.eventDispatcher.dispatch(event).defer();
191
+ };
192
+ this.eventDispatcher
193
+ .dispatch(LOCK_EVENTS.RELEASED, event)
194
+ .defer();
189
195
  }
190
196
  else {
191
- const event = new UnownedReleaseLockEvent({
197
+ const event = {
192
198
  key: this.key.resolved,
193
199
  owner: this.owner,
194
- });
195
- this.eventDispatcher.dispatch(event).defer();
196
- this.eventDispatcher.dispatch(event).defer();
200
+ };
201
+ this.eventDispatcher
202
+ .dispatch(LOCK_EVENTS.UNOWNED_RELEASE_TRY, event)
203
+ .defer();
197
204
  }
198
205
  return hasReleased;
199
206
  }
200
207
  catch (error) {
201
- const event = new UnexpectedErrorLockEvent({
208
+ this.lockState.set(prevState);
209
+ const event = {
202
210
  key: this.key.resolved,
203
211
  owner: this.owner,
204
212
  ttl: this.ttl,
205
213
  error,
206
- });
207
- this.eventDispatcher.dispatch(event).defer();
208
- this.eventDispatcher.dispatch(event).defer();
209
- throw error;
214
+ };
215
+ this.eventDispatcher
216
+ .dispatch(LOCK_EVENTS.UNEXPECTED_ERROR, event)
217
+ .defer();
218
+ throw new UnableToReleaseLockError(`A Lock with name of "${this.key.resolved}" could not be released.`, error);
210
219
  }
211
220
  });
212
221
  }
@@ -220,25 +229,29 @@ export class Lock {
220
229
  }
221
230
  forceRelease() {
222
231
  return this.createLazyPromise(async () => {
232
+ const prevState = this.lockState.get()?.getTime() ?? null;
223
233
  try {
224
234
  await this.adapter.forceRelease(this.key.prefixed);
225
235
  this.lockState.remove();
226
- const event = new KeyForceReleasedLockEvent({
236
+ const event = {
227
237
  key: this.key.resolved,
228
- });
229
- this.eventDispatcher.dispatch(event).defer();
230
- this.eventDispatcher.dispatch(event).defer();
238
+ };
239
+ this.eventDispatcher
240
+ .dispatch(LOCK_EVENTS.FORCE_RELEASED, event)
241
+ .defer();
231
242
  }
232
243
  catch (error) {
233
- const event = new UnexpectedErrorLockEvent({
244
+ this.lockState.set(prevState);
245
+ const event = {
234
246
  key: this.key.resolved,
235
247
  owner: this.owner,
236
248
  ttl: this.ttl,
237
249
  error,
238
- });
239
- this.eventDispatcher.dispatch(event).defer();
240
- this.eventDispatcher.dispatch(event).defer();
241
- throw error;
250
+ };
251
+ this.eventDispatcher
252
+ .dispatch(LOCK_EVENTS.UNEXPECTED_ERROR, event)
253
+ .defer();
254
+ throw new UnableToReleaseLockError(`A Lock with name of "${this.key.resolved}" could not be released.`, error);
242
255
  }
243
256
  });
244
257
  }
@@ -249,14 +262,15 @@ export class Lock {
249
262
  return this.lockState.isExpired();
250
263
  }
251
264
  catch (error) {
252
- const event = new UnexpectedErrorLockEvent({
265
+ const event = {
253
266
  key: this.key.resolved,
254
267
  owner: this.owner,
255
268
  ttl: this.ttl,
256
269
  error,
257
- });
258
- this.eventDispatcher.dispatch(event).defer();
259
- this.eventDispatcher.dispatch(event).defer();
270
+ };
271
+ this.eventDispatcher
272
+ .dispatch(LOCK_EVENTS.UNEXPECTED_ERROR, event)
273
+ .defer();
260
274
  throw error;
261
275
  }
262
276
  });
@@ -269,37 +283,42 @@ export class Lock {
269
283
  }
270
284
  refresh(ttl = this.defaultRefreshTime) {
271
285
  return this.createLazyPromise(async () => {
286
+ const prevState = this.lockState.get()?.getTime() ?? null;
272
287
  try {
273
288
  const hasRefreshed = await this.adapter.refresh(this.key.prefixed, this.owner, ttl);
274
289
  if (hasRefreshed) {
275
- const event = new KeyRefreshedLockEvent({
290
+ const event = {
276
291
  key: this.key.resolved,
277
292
  owner: this.owner,
278
293
  ttl,
279
- });
294
+ };
280
295
  this.lockState.set(ttl);
281
- this.eventDispatcher.dispatch(event).defer();
282
- this.eventDispatcher.dispatch(event).defer();
296
+ this.eventDispatcher
297
+ .dispatch(LOCK_EVENTS.REFRESHED, event)
298
+ .defer();
283
299
  }
284
300
  else {
285
- const event = new UnownedRefreshLockEvent({
301
+ const event = {
286
302
  key: this.key.resolved,
287
303
  owner: this.owner,
288
- });
289
- this.eventDispatcher.dispatch(event).defer();
290
- this.eventDispatcher.dispatch(event).defer();
304
+ };
305
+ this.eventDispatcher
306
+ .dispatch(LOCK_EVENTS.UNOWNED_REFRESH_TRY, event)
307
+ .defer();
291
308
  }
292
309
  return hasRefreshed;
293
310
  }
294
311
  catch (error) {
295
- const event = new UnexpectedErrorLockEvent({
312
+ this.lockState.set(prevState);
313
+ const event = {
296
314
  key: this.key.resolved,
297
315
  owner: this.owner,
298
316
  ttl: this.ttl,
299
317
  error,
300
- });
301
- this.eventDispatcher.dispatch(event).defer();
302
- this.eventDispatcher.dispatch(event).defer();
318
+ };
319
+ this.eventDispatcher
320
+ .dispatch(LOCK_EVENTS.UNEXPECTED_ERROR, event)
321
+ .defer();
303
322
  throw error;
304
323
  }
305
324
  });