@daiso-tech/core 0.39.0 → 0.41.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 (679) hide show
  1. package/dist/backoff-policies/_module-exports.d.ts +5 -0
  2. package/dist/backoff-policies/_module-exports.js +6 -0
  3. package/dist/backoff-policies/_module-exports.js.map +1 -0
  4. package/dist/{async/backof-policies → backoff-policies}/_shared.d.ts +6 -7
  5. package/dist/{async/backof-policies → backoff-policies}/_shared.js +1 -1
  6. package/dist/backoff-policies/_shared.js.map +1 -0
  7. package/dist/backoff-policies/constant-backoff-policy/_module.d.ts +1 -0
  8. package/dist/backoff-policies/constant-backoff-policy/_module.js +2 -0
  9. package/dist/backoff-policies/constant-backoff-policy/_module.js.map +1 -0
  10. package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.d.ts +6 -8
  11. package/dist/{async/backof-policies → backoff-policies}/constant-backoff-policy/constant-backoff-policy.js +8 -10
  12. package/dist/backoff-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  13. package/dist/backoff-policies/exponential-backoff-policy/_module.d.ts +1 -0
  14. package/dist/backoff-policies/exponential-backoff-policy/_module.js +2 -0
  15. package/dist/backoff-policies/exponential-backoff-policy/_module.js.map +1 -0
  16. package/dist/{async/backof-policies → backoff-policies}/exponential-backoff-policy/exponential-backoff-policy.d.ts +7 -9
  17. package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js +30 -0
  18. package/dist/backoff-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  19. package/dist/backoff-policies/linear-backoff-policy/_module.d.ts +1 -0
  20. package/dist/backoff-policies/linear-backoff-policy/_module.js +2 -0
  21. package/dist/backoff-policies/linear-backoff-policy/_module.js.map +1 -0
  22. package/dist/{async/backof-policies → backoff-policies}/linear-backoff-policy/linear-backoff-policy.d.ts +7 -9
  23. package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js +30 -0
  24. package/dist/backoff-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  25. package/dist/backoff-policies/polynomial-backoff-policy/_module.d.ts +1 -0
  26. package/dist/backoff-policies/polynomial-backoff-policy/_module.js +2 -0
  27. package/dist/backoff-policies/polynomial-backoff-policy/_module.js.map +1 -0
  28. package/dist/{async/backof-policies → backoff-policies}/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +7 -9
  29. package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +30 -0
  30. package/dist/backoff-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  31. package/dist/cache/contracts/cache-adapter.contract.d.ts +12 -12
  32. package/dist/cache/contracts/cache.contract.d.ts +22 -22
  33. package/dist/cache/contracts/cache.errors.d.ts +7 -14
  34. package/dist/cache/contracts/cache.errors.js +12 -24
  35. package/dist/cache/contracts/cache.errors.js.map +1 -1
  36. package/dist/cache/contracts/cache.events.d.ts +1 -1
  37. package/dist/cache/contracts/database-cache-adapter.contract.d.ts +10 -10
  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 +10 -10
  48. package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
  49. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +1 -1
  50. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
  51. package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  52. package/dist/cache/implementations/derivables/cache/cache.d.ts +38 -43
  53. package/dist/cache/implementations/derivables/cache/cache.js +106 -101
  54. package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
  55. package/dist/cache/implementations/derivables/cache/database-cache-adapter.d.ts +1 -1
  56. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js +3 -3
  57. package/dist/cache/implementations/derivables/cache/database-cache-adapter.js.map +1 -1
  58. package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +6 -8
  59. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +5 -15
  60. package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
  61. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +1 -1
  62. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +48 -48
  63. package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js.map +1 -1
  64. package/dist/cache/implementations/test-utilities/cache.test-suite.js +107 -107
  65. package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
  66. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -1
  67. package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js.map +1 -1
  68. package/dist/collection/contracts/async-collection.contract.d.ts +43 -43
  69. package/dist/collection/contracts/collection.contract.d.ts +15 -1
  70. package/dist/collection/contracts/collection.contract.js +1 -3
  71. package/dist/collection/contracts/collection.contract.js.map +1 -1
  72. package/dist/collection/contracts/collection.errors.d.ts +4 -13
  73. package/dist/collection/contracts/collection.errors.js +4 -16
  74. package/dist/collection/contracts/collection.errors.js.map +1 -1
  75. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.d.ts +6 -0
  76. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js +3 -0
  77. package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js.map +1 -1
  78. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +40 -51
  79. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +31 -37
  80. package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  81. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.d.ts +3 -0
  82. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js +6 -0
  83. package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js.map +1 -1
  84. package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +3 -3
  85. package/dist/collection/implementations/iterable-collection/iterable-collection.js +5 -2
  86. package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  87. package/dist/collection/implementations/list-collection/list-collection.d.ts +3 -3
  88. package/dist/collection/implementations/list-collection/list-collection.js +5 -2
  89. package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
  90. package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +3 -3
  91. package/dist/event-bus/contracts/event-bus.contract.d.ts +10 -10
  92. package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +3 -3
  93. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -6
  94. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +7 -9
  95. package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
  96. package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +18 -24
  97. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +51 -51
  98. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  99. package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +11 -4
  100. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +17 -12
  101. package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -1
  102. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +1 -3
  103. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +4 -8
  104. package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
  105. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +36 -37
  106. package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
  107. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +86 -674
  108. package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
  109. package/dist/hooks/_module-exports.d.ts +3 -0
  110. package/dist/hooks/_module-exports.js +4 -0
  111. package/dist/hooks/_module-exports.js.map +1 -0
  112. package/dist/{utilities/classes/hooks → hooks}/async-hooks.d.ts +15 -26
  113. package/dist/{utilities/classes/hooks → hooks}/async-hooks.js +4 -6
  114. package/dist/hooks/async-hooks.js.map +1 -0
  115. package/dist/{utilities/classes/hooks → hooks}/hooks.d.ts +11 -18
  116. package/dist/{utilities/classes/hooks → hooks}/hooks.js +4 -5
  117. package/dist/hooks/hooks.js.map +1 -0
  118. package/dist/{utilities/classes/hooks → hooks}/types.d.ts +2 -3
  119. package/dist/hooks/types.js +5 -0
  120. package/dist/hooks/types.js.map +1 -0
  121. package/dist/lock/contracts/_module-exports.d.ts +4 -2
  122. package/dist/lock/contracts/_module-exports.js +4 -2
  123. package/dist/lock/contracts/_module-exports.js.map +1 -1
  124. package/dist/lock/contracts/database-lock-adapter.contract.d.ts +59 -14
  125. package/dist/lock/contracts/lock-adapter.contract.d.ts +22 -10
  126. package/dist/lock/contracts/lock-provider.contract.d.ts +5 -5
  127. package/dist/lock/contracts/lock-state.contract.d.ts +52 -0
  128. package/dist/lock/contracts/lock-state.contract.js +14 -0
  129. package/dist/lock/contracts/lock-state.contract.js.map +1 -0
  130. package/dist/lock/contracts/lock.contract.d.ts +72 -58
  131. package/dist/lock/contracts/lock.errors.d.ts +18 -15
  132. package/dist/lock/contracts/lock.errors.js +22 -17
  133. package/dist/lock/contracts/lock.errors.js.map +1 -1
  134. package/dist/lock/contracts/lock.events.d.ts +21 -37
  135. package/dist/lock/contracts/lock.events.js +2 -2
  136. package/dist/lock/contracts/lock.events.js.map +1 -1
  137. package/dist/lock/contracts/types.d.ts +11 -0
  138. package/dist/lock/contracts/types.js +5 -0
  139. package/dist/lock/contracts/types.js.map +1 -0
  140. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +33 -13
  141. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +182 -56
  142. package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
  143. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +25 -9
  144. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +80 -36
  145. package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js.map +1 -1
  146. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +11 -12
  147. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +164 -79
  148. package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
  149. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +7 -6
  150. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +7 -4
  151. package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -1
  152. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +27 -9
  153. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +87 -32
  154. package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
  155. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.d.ts +7 -6
  156. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js +56 -24
  157. package/dist/lock/implementations/derivables/lock-provider/database-lock-adapter.js.map +1 -1
  158. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.d.ts +2 -2
  159. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js +7 -7
  160. package/dist/lock/implementations/derivables/lock-provider/is-database-lock-adapter.js.map +1 -1
  161. package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +29 -39
  162. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +31 -35
  163. package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
  164. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +5 -8
  165. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +27 -23
  166. package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
  167. package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +38 -33
  168. package/dist/lock/implementations/derivables/lock-provider/lock.js +178 -234
  169. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  170. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.d.ts +9 -0
  171. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js +12 -0
  172. package/dist/lock/implementations/derivables/lock-provider/resolve-database-lock-adapter.js.map +1 -0
  173. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +12 -13
  174. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +7 -16
  175. package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
  176. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +312 -191
  177. package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
  178. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +1 -1
  179. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +378 -95
  180. package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
  181. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +15 -5
  182. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +3110 -1611
  183. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  184. package/dist/namespace/_module-exports.d.ts +1 -0
  185. package/dist/namespace/_module-exports.js +2 -0
  186. package/dist/namespace/_module-exports.js.map +1 -0
  187. package/dist/namespace/namespace.d.ts +87 -0
  188. package/dist/namespace/namespace.js +117 -0
  189. package/dist/namespace/namespace.js.map +1 -0
  190. package/dist/resilience/_module-exports.d.ts +2 -0
  191. package/dist/resilience/_module-exports.js +3 -0
  192. package/dist/resilience/_module-exports.js.map +1 -0
  193. package/dist/resilience/middlewares/_module.d.ts +5 -0
  194. package/dist/resilience/middlewares/_module.js +6 -0
  195. package/dist/resilience/middlewares/_module.js.map +1 -0
  196. package/dist/resilience/middlewares/dynamic/_module.d.ts +1 -0
  197. package/dist/resilience/middlewares/dynamic/_module.js +2 -0
  198. package/dist/resilience/middlewares/dynamic/_module.js.map +1 -0
  199. package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.d.ts +6 -6
  200. package/dist/{async → resilience}/middlewares/dynamic/dynamic.middleware.js +5 -5
  201. package/dist/resilience/middlewares/dynamic/dynamic.middleware.js.map +1 -0
  202. package/dist/resilience/middlewares/fallback/_module.d.ts +2 -0
  203. package/dist/resilience/middlewares/fallback/_module.js +3 -0
  204. package/dist/resilience/middlewares/fallback/_module.js.map +1 -0
  205. package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.d.ts +9 -9
  206. package/dist/{async → resilience}/middlewares/fallback/fallback.middleware.js +7 -6
  207. package/dist/resilience/middlewares/fallback/fallback.middleware.js.map +1 -0
  208. package/dist/{async → resilience}/middlewares/fallback/fallback.types.d.ts +7 -6
  209. package/dist/{async → resilience}/middlewares/fallback/fallback.types.js +1 -1
  210. package/dist/resilience/middlewares/fallback/fallback.types.js.map +1 -0
  211. package/dist/resilience/middlewares/observe/_module.d.ts +2 -0
  212. package/dist/resilience/middlewares/observe/_module.js +3 -0
  213. package/dist/resilience/middlewares/observe/_module.js.map +1 -0
  214. package/dist/{async → resilience}/middlewares/observe/observe.middleware.d.ts +13 -11
  215. package/dist/{async → resilience}/middlewares/observe/observe.middleware.js +14 -10
  216. package/dist/resilience/middlewares/observe/observe.middleware.js.map +1 -0
  217. package/dist/{async → resilience}/middlewares/observe/observe.types.d.ts +13 -12
  218. package/dist/resilience/middlewares/observe/observe.types.js +5 -0
  219. package/dist/resilience/middlewares/observe/observe.types.js.map +1 -0
  220. package/dist/resilience/middlewares/retry/_module.d.ts +2 -0
  221. package/dist/resilience/middlewares/retry/_module.js +3 -0
  222. package/dist/resilience/middlewares/retry/_module.js.map +1 -0
  223. package/dist/{async → resilience}/middlewares/retry/retry.middleware.d.ts +12 -9
  224. package/dist/{async → resilience}/middlewares/retry/retry.middleware.js +19 -15
  225. package/dist/resilience/middlewares/retry/retry.middleware.js.map +1 -0
  226. package/dist/{async → resilience}/middlewares/retry/retry.types.d.ts +14 -12
  227. package/dist/resilience/middlewares/retry/retry.types.js +7 -0
  228. package/dist/resilience/middlewares/retry/retry.types.js.map +1 -0
  229. package/dist/resilience/middlewares/timeout/_module.d.ts +2 -0
  230. package/dist/resilience/middlewares/timeout/_module.js +3 -0
  231. package/dist/resilience/middlewares/timeout/_module.js.map +1 -0
  232. package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.d.ts +9 -7
  233. package/dist/{async → resilience}/middlewares/timeout/timeout.middleware.js +12 -11
  234. package/dist/resilience/middlewares/timeout/timeout.middleware.js.map +1 -0
  235. package/dist/{async → resilience}/middlewares/timeout/timeout.type.d.ts +10 -9
  236. package/dist/resilience/middlewares/timeout/timeout.type.js +5 -0
  237. package/dist/resilience/middlewares/timeout/timeout.type.js.map +1 -0
  238. package/dist/resilience/resilience.errors.d.ts +40 -0
  239. package/dist/resilience/resilience.errors.js +48 -0
  240. package/dist/resilience/resilience.errors.js.map +1 -0
  241. package/dist/resilience/utilities/_module.d.ts +2 -0
  242. package/dist/resilience/utilities/_module.js +3 -0
  243. package/dist/resilience/utilities/_module.js.map +1 -0
  244. package/dist/resilience/utilities/abort-and-fail/_module.d.ts +1 -0
  245. package/dist/resilience/utilities/abort-and-fail/_module.js +2 -0
  246. package/dist/resilience/utilities/abort-and-fail/_module.js.map +1 -0
  247. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
  248. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js +51 -0
  249. package/dist/resilience/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
  250. package/dist/resilience/utilities/timeout-and-fail/_module.d.ts +1 -0
  251. package/dist/resilience/utilities/timeout-and-fail/_module.js +2 -0
  252. package/dist/resilience/utilities/timeout-and-fail/_module.js.map +1 -0
  253. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
  254. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js +23 -0
  255. package/dist/resilience/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
  256. package/dist/semaphore/contracts/_module-exports.d.ts +9 -0
  257. package/dist/semaphore/contracts/_module-exports.js +10 -0
  258. package/dist/semaphore/contracts/_module-exports.js.map +1 -0
  259. package/dist/semaphore/contracts/database-semaphore-adapter.contract.d.ts +90 -0
  260. package/dist/semaphore/contracts/database-semaphore-adapter.contract.js +5 -0
  261. package/dist/semaphore/contracts/database-semaphore-adapter.contract.js.map +1 -0
  262. package/dist/semaphore/contracts/semaphore-adapter.contract.d.ts +61 -0
  263. package/dist/semaphore/contracts/semaphore-adapter.contract.js +5 -0
  264. package/dist/semaphore/contracts/semaphore-adapter.contract.js.map +1 -0
  265. package/dist/semaphore/contracts/semaphore-provider-factory.contract.d.ts +19 -0
  266. package/dist/semaphore/contracts/semaphore-provider-factory.contract.js +9 -0
  267. package/dist/semaphore/contracts/semaphore-provider-factory.contract.js.map +1 -0
  268. package/dist/semaphore/contracts/semaphore-provider.contract.d.ts +50 -0
  269. package/dist/semaphore/contracts/semaphore-provider.contract.js +5 -0
  270. package/dist/semaphore/contracts/semaphore-provider.contract.js.map +1 -0
  271. package/dist/semaphore/contracts/semaphore-state.contract.d.ts +70 -0
  272. package/dist/semaphore/contracts/semaphore-state.contract.js +15 -0
  273. package/dist/semaphore/contracts/semaphore-state.contract.js.map +1 -0
  274. package/dist/semaphore/contracts/semaphore.contract.d.ts +127 -0
  275. package/dist/semaphore/contracts/semaphore.contract.js +5 -0
  276. package/dist/semaphore/contracts/semaphore.contract.js.map +1 -0
  277. package/dist/semaphore/contracts/semaphore.errors.d.ts +52 -0
  278. package/dist/semaphore/contracts/semaphore.errors.js +63 -0
  279. package/dist/semaphore/contracts/semaphore.errors.js.map +1 -0
  280. package/dist/semaphore/contracts/semaphore.events.d.ts +101 -0
  281. package/dist/semaphore/contracts/semaphore.events.js +19 -0
  282. package/dist/semaphore/contracts/semaphore.events.js.map +1 -0
  283. package/dist/semaphore/contracts/types.d.ts +11 -0
  284. package/dist/semaphore/contracts/types.js +5 -0
  285. package/dist/semaphore/contracts/types.js.map +1 -0
  286. package/dist/semaphore/implementations/adapters/_module-exports.d.ts +5 -0
  287. package/dist/semaphore/implementations/adapters/_module-exports.js +6 -0
  288. package/dist/semaphore/implementations/adapters/_module-exports.js.map +1 -0
  289. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.d.ts +1 -0
  290. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js +2 -0
  291. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/_module.js.map +1 -0
  292. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.d.ts +97 -0
  293. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js +313 -0
  294. package/dist/semaphore/implementations/adapters/kysely-semaphore-adapter/kysely-semaphore-adapter.js.map +1 -0
  295. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.d.ts +1 -0
  296. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js +2 -0
  297. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/_module.js.map +1 -0
  298. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.d.ts +49 -0
  299. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js +141 -0
  300. package/dist/semaphore/implementations/adapters/memory-semaphore-adapter/memory-semaphore-adapter.js.map +1 -0
  301. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.d.ts +1 -0
  302. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js +2 -0
  303. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/_module.js.map +1 -0
  304. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.d.ts +80 -0
  305. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js +390 -0
  306. package/dist/semaphore/implementations/adapters/mongodb-semaphore-adapter/mongodb-semaphore-adapter.js.map +1 -0
  307. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.d.ts +1 -0
  308. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js +2 -0
  309. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/_module.js.map +1 -0
  310. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.d.ts +18 -0
  311. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js +30 -0
  312. package/dist/semaphore/implementations/adapters/no-op-semaphore-adapter/no-op-semaphore-adapter.js.map +1 -0
  313. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.d.ts +1 -0
  314. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js +2 -0
  315. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/_module.js.map +1 -0
  316. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.d.ts +48 -0
  317. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js +338 -0
  318. package/dist/semaphore/implementations/adapters/redis-semaphore-adapter/redis-semaphore-adapter.js.map +1 -0
  319. package/dist/semaphore/implementations/derivables/_module-exports.d.ts +2 -0
  320. package/dist/semaphore/implementations/derivables/_module-exports.js +3 -0
  321. package/dist/semaphore/implementations/derivables/_module-exports.js.map +1 -0
  322. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.d.ts +1 -0
  323. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js +2 -0
  324. package/dist/semaphore/implementations/derivables/semaphore-provider/_module.js.map +1 -0
  325. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.d.ts +17 -0
  326. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js +74 -0
  327. package/dist/semaphore/implementations/derivables/semaphore-provider/database-semaphore-adapter.js.map +1 -0
  328. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.d.ts +8 -0
  329. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js +15 -0
  330. package/dist/semaphore/implementations/derivables/semaphore-provider/is-database-semaphore-adapter.js.map +1 -0
  331. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.d.ts +8 -0
  332. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js +15 -0
  333. package/dist/semaphore/implementations/derivables/semaphore-provider/resolve-database-semaphore-adapter.js.map +1 -0
  334. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.d.ts +149 -0
  335. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js +135 -0
  336. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-provider.js.map +1 -0
  337. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.d.ts +41 -0
  338. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js +77 -0
  339. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore-serde-transformer.js.map +1 -0
  340. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.d.ts +83 -0
  341. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js +336 -0
  342. package/dist/semaphore/implementations/derivables/semaphore-provider/semaphore.js.map +1 -0
  343. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.d.ts +1 -0
  344. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js +2 -0
  345. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/_module.js.map +1 -0
  346. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.d.ts +40 -0
  347. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js +67 -0
  348. package/dist/semaphore/implementations/derivables/semaphore-provider-factory/semaphore-provider-factory.js.map +1 -0
  349. package/dist/semaphore/implementations/test-utilities/_module-exports.d.ts +3 -0
  350. package/dist/semaphore/implementations/test-utilities/_module-exports.js +4 -0
  351. package/dist/semaphore/implementations/test-utilities/_module-exports.js.map +1 -0
  352. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.d.ts +59 -0
  353. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js +536 -0
  354. package/dist/semaphore/implementations/test-utilities/database-semaphore-adapter.test-suite.js.map +1 -0
  355. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.d.ts +59 -0
  356. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js +961 -0
  357. package/dist/semaphore/implementations/test-utilities/semaphore-adapter.test-suite.js.map +1 -0
  358. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.d.ts +67 -0
  359. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js +4981 -0
  360. package/dist/semaphore/implementations/test-utilities/semaphore-provider.test-suite.js.map +1 -0
  361. package/dist/serde/contracts/_module-exports.d.ts +0 -1
  362. package/dist/serde/contracts/_module-exports.js +0 -1
  363. package/dist/serde/contracts/_module-exports.js.map +1 -1
  364. package/dist/serde/contracts/flexible-serde.contract.d.ts +21 -5
  365. package/dist/serde/contracts/serde.errors.d.ts +14 -11
  366. package/dist/serde/contracts/serde.errors.js +15 -14
  367. package/dist/serde/contracts/serde.errors.js.map +1 -1
  368. package/dist/serde/implementations/adapters/_module-exports.d.ts +0 -3
  369. package/dist/serde/implementations/adapters/_module-exports.js +0 -3
  370. package/dist/serde/implementations/adapters/_module-exports.js.map +1 -1
  371. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +6 -0
  372. package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
  373. package/dist/serde/implementations/derivables/serde-transformers.d.ts +38 -30
  374. package/dist/serde/implementations/derivables/serde-transformers.js +62 -20
  375. package/dist/serde/implementations/derivables/serde-transformers.js.map +1 -1
  376. package/dist/serde/implementations/derivables/serde.d.ts +12 -3
  377. package/dist/serde/implementations/derivables/serde.js +5 -2
  378. package/dist/serde/implementations/derivables/serde.js.map +1 -1
  379. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +85 -1
  380. package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js.map +1 -1
  381. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +85 -1
  382. package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js.map +1 -1
  383. package/dist/shared-lock/contracts/_module-exports.d.ts +10 -0
  384. package/dist/shared-lock/contracts/_module-exports.js +11 -0
  385. package/dist/shared-lock/contracts/_module-exports.js.map +1 -0
  386. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.d.ts +145 -0
  387. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js +5 -0
  388. package/dist/shared-lock/contracts/database-shared-lock-adapter.contract.js.map +1 -0
  389. package/dist/shared-lock/contracts/shared-lock-adapter.contract.d.ts +96 -0
  390. package/dist/shared-lock/contracts/shared-lock-adapter.contract.js +5 -0
  391. package/dist/shared-lock/contracts/shared-lock-adapter.contract.js.map +1 -0
  392. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.d.ts +19 -0
  393. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js +9 -0
  394. package/dist/shared-lock/contracts/shared-lock-provider-factory.contract.js.map +1 -0
  395. package/dist/shared-lock/contracts/shared-lock-provider.contract.d.ts +53 -0
  396. package/dist/shared-lock/contracts/shared-lock-provider.contract.js +5 -0
  397. package/dist/shared-lock/contracts/shared-lock-provider.contract.js.map +1 -0
  398. package/dist/shared-lock/contracts/shared-lock-state.contract.d.ts +133 -0
  399. package/dist/shared-lock/contracts/shared-lock-state.contract.js +33 -0
  400. package/dist/shared-lock/contracts/shared-lock-state.contract.js.map +1 -0
  401. package/dist/shared-lock/contracts/shared-lock.contract.d.ts +222 -0
  402. package/dist/shared-lock/contracts/shared-lock.contract.js +13 -0
  403. package/dist/shared-lock/contracts/shared-lock.contract.js.map +1 -0
  404. package/dist/shared-lock/contracts/shared-lock.errors.d.ts +124 -0
  405. package/dist/shared-lock/contracts/shared-lock.errors.js +136 -0
  406. package/dist/shared-lock/contracts/shared-lock.errors.js.map +1 -0
  407. package/dist/shared-lock/contracts/shared-lock.events.d.ts +205 -0
  408. package/dist/shared-lock/contracts/shared-lock.events.js +43 -0
  409. package/dist/shared-lock/contracts/shared-lock.events.js.map +1 -0
  410. package/dist/shared-lock/contracts/types.d.ts +10 -0
  411. package/dist/shared-lock/contracts/types.js +5 -0
  412. package/dist/shared-lock/contracts/types.js.map +1 -0
  413. package/dist/shared-lock/implementations/adapters/_module-exports.d.ts +5 -0
  414. package/dist/shared-lock/implementations/adapters/_module-exports.js +6 -0
  415. package/dist/shared-lock/implementations/adapters/_module-exports.js.map +1 -0
  416. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.d.ts +1 -0
  417. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js +2 -0
  418. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/_module.js.map +1 -0
  419. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.d.ts +114 -0
  420. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js +496 -0
  421. package/dist/shared-lock/implementations/adapters/kysely-shared-lock-adapter/kysely-shared-lock-adapter.js.map +1 -0
  422. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.d.ts +1 -0
  423. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js +2 -0
  424. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/_module.js.map +1 -0
  425. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.d.ts +79 -0
  426. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js +347 -0
  427. package/dist/shared-lock/implementations/adapters/memory-shared-lock-adapter/memory-shared-lock-adapter.js.map +1 -0
  428. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.d.ts +1 -0
  429. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js +2 -0
  430. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/_module.js.map +1 -0
  431. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.d.ts +112 -0
  432. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js +805 -0
  433. package/dist/shared-lock/implementations/adapters/mongodb-shared-lock-adapter/mongodb-shared-lock-adapter.js.map +1 -0
  434. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.d.ts +1 -0
  435. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js +2 -0
  436. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/_module.js.map +1 -0
  437. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.d.ts +23 -0
  438. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js +42 -0
  439. package/dist/shared-lock/implementations/adapters/no-op-shared-lock-adapter/no-op-shared-lock-adapter.js.map +1 -0
  440. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.d.ts +1 -0
  441. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js +2 -0
  442. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/_module.js.map +1 -0
  443. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.d.ts +79 -0
  444. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js +630 -0
  445. package/dist/shared-lock/implementations/adapters/redis-shared-lock-adapter/redis-shared-lock-adapter.js.map +1 -0
  446. package/dist/shared-lock/implementations/derivables/_module-exports.d.ts +2 -0
  447. package/dist/shared-lock/implementations/derivables/_module-exports.js +3 -0
  448. package/dist/shared-lock/implementations/derivables/_module-exports.js.map +1 -0
  449. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.d.ts +1 -0
  450. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js +2 -0
  451. package/dist/shared-lock/implementations/derivables/shared-lock-provider/_module.js.map +1 -0
  452. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.d.ts +27 -0
  453. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js +208 -0
  454. package/dist/shared-lock/implementations/derivables/shared-lock-provider/database-shared-lock-adapter.js.map +1 -0
  455. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.d.ts +8 -0
  456. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js +12 -0
  457. package/dist/shared-lock/implementations/derivables/shared-lock-provider/is-database-shared-lock-adapter.js.map +1 -0
  458. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.d.ts +8 -0
  459. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js +15 -0
  460. package/dist/shared-lock/implementations/derivables/shared-lock-provider/resolve-database-shared-lock-adapter.js.map +1 -0
  461. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.d.ts +190 -0
  462. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js +177 -0
  463. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-provider.js.map +1 -0
  464. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.d.ts +41 -0
  465. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js +77 -0
  466. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock-serde-transformer.js.map +1 -0
  467. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.d.ts +95 -0
  468. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js +542 -0
  469. package/dist/shared-lock/implementations/derivables/shared-lock-provider/shared-lock.js.map +1 -0
  470. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.d.ts +1 -0
  471. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js +2 -0
  472. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/_module.js.map +1 -0
  473. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.d.ts +97 -0
  474. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js +128 -0
  475. package/dist/shared-lock/implementations/derivables/shared-lock-provider-factory/shared-lock-provider-factory.js.map +1 -0
  476. package/dist/shared-lock/implementations/test-utilities/_module-exports.d.ts +3 -0
  477. package/dist/shared-lock/implementations/test-utilities/_module-exports.js +4 -0
  478. package/dist/shared-lock/implementations/test-utilities/_module-exports.js.map +1 -0
  479. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.d.ts +59 -0
  480. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js +944 -0
  481. package/dist/shared-lock/implementations/test-utilities/database-shared-lock-adapter.test-suite.js.map +1 -0
  482. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.d.ts +59 -0
  483. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js +1921 -0
  484. package/dist/shared-lock/implementations/test-utilities/shared-lock-adapter.test-suite.js.map +1 -0
  485. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.d.ts +67 -0
  486. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js +9833 -0
  487. package/dist/shared-lock/implementations/test-utilities/shared-lock-provider.test-suite.js.map +1 -0
  488. package/dist/task/_module-exports.d.ts +1 -0
  489. package/dist/task/_module-exports.js +2 -0
  490. package/dist/task/_module-exports.js.map +1 -0
  491. package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.d.ts +1 -1
  492. package/dist/{async/utilities/abort-and-fail → task}/abort-and-fail.js +1 -1
  493. package/dist/task/abort-and-fail.js.map +1 -0
  494. package/dist/task/task.d.ts +194 -0
  495. package/dist/task/task.js +212 -0
  496. package/dist/task/task.js.map +1 -0
  497. package/dist/time-span/contracts/_module-exports.d.ts +1 -0
  498. package/dist/time-span/contracts/_module-exports.js +2 -0
  499. package/dist/time-span/contracts/_module-exports.js.map +1 -0
  500. package/dist/time-span/contracts/time-span.contract.d.ts +19 -0
  501. package/dist/time-span/contracts/time-span.contract.js +10 -0
  502. package/dist/time-span/contracts/time-span.contract.js.map +1 -0
  503. package/dist/time-span/implementations/_module-exports.d.ts +1 -0
  504. package/dist/time-span/implementations/_module-exports.js +2 -0
  505. package/dist/time-span/implementations/_module-exports.js.map +1 -0
  506. package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.d.ts +49 -11
  507. package/dist/{utilities/classes/time-span → time-span/implementations}/time-span.js +33 -11
  508. package/dist/time-span/implementations/time-span.js.map +1 -0
  509. package/dist/utilities/classes/_module.d.ts +0 -3
  510. package/dist/utilities/classes/_module.js +0 -3
  511. package/dist/utilities/classes/_module.js.map +1 -1
  512. package/dist/utilities/contracts/_module.d.ts +1 -1
  513. package/dist/utilities/contracts/_module.js +1 -1
  514. package/dist/utilities/contracts/_module.js.map +1 -1
  515. package/dist/utilities/contracts/comparable.contract.d.ts +49 -0
  516. package/dist/utilities/contracts/comparable.contract.js +5 -0
  517. package/dist/utilities/contracts/comparable.contract.js.map +1 -0
  518. package/dist/utilities/contracts/deinitizable.contract.d.ts +1 -1
  519. package/dist/utilities/contracts/initizable.contract.d.ts +1 -1
  520. package/dist/utilities/contracts/prunable.contract.d.ts +1 -1
  521. package/dist/utilities/functions/is-standard-schema.d.ts +6 -0
  522. package/dist/utilities/functions/is-standard-schema.js +6 -0
  523. package/dist/utilities/functions/is-standard-schema.js.map +1 -1
  524. package/dist/utilities/functions/lazy.d.ts +3 -3
  525. package/dist/utilities/functions/lazy.js +3 -3
  526. package/dist/utilities/functions/lazy.js.map +1 -1
  527. package/dist/utilities/functions/option.d.ts +3 -0
  528. package/dist/utilities/functions/option.js +3 -0
  529. package/dist/utilities/functions/option.js.map +1 -1
  530. package/dist/utilities/functions/validate.d.ts +5 -0
  531. package/dist/utilities/functions/validate.js +5 -0
  532. package/dist/utilities/functions/validate.js.map +1 -1
  533. package/dist/utilities/types/any-class.type.d.ts +6 -0
  534. package/dist/utilities/types/any-class.type.js +3 -0
  535. package/dist/utilities/types/any-class.type.js.map +1 -1
  536. package/package.json +67 -5
  537. package/dist/async/_module-exports.d.ts +0 -4
  538. package/dist/async/_module-exports.js +0 -5
  539. package/dist/async/_module-exports.js.map +0 -1
  540. package/dist/async/async.errors.d.ts +0 -47
  541. package/dist/async/async.errors.js +0 -61
  542. package/dist/async/async.errors.js.map +0 -1
  543. package/dist/async/backof-policies/_module.d.ts +0 -5
  544. package/dist/async/backof-policies/_module.js +0 -6
  545. package/dist/async/backof-policies/_module.js.map +0 -1
  546. package/dist/async/backof-policies/_shared.js.map +0 -1
  547. package/dist/async/backof-policies/constant-backoff-policy/_module.d.ts +0 -1
  548. package/dist/async/backof-policies/constant-backoff-policy/_module.js +0 -2
  549. package/dist/async/backof-policies/constant-backoff-policy/_module.js.map +0 -1
  550. package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +0 -1
  551. package/dist/async/backof-policies/exponential-backoff-policy/_module.d.ts +0 -1
  552. package/dist/async/backof-policies/exponential-backoff-policy/_module.js +0 -2
  553. package/dist/async/backof-policies/exponential-backoff-policy/_module.js.map +0 -1
  554. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +0 -35
  555. package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +0 -1
  556. package/dist/async/backof-policies/linear-backoff-policy/_module.d.ts +0 -1
  557. package/dist/async/backof-policies/linear-backoff-policy/_module.js +0 -2
  558. package/dist/async/backof-policies/linear-backoff-policy/_module.js.map +0 -1
  559. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +0 -35
  560. package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +0 -1
  561. package/dist/async/backof-policies/polynomial-backoff-policy/_module.d.ts +0 -1
  562. package/dist/async/backof-policies/polynomial-backoff-policy/_module.js +0 -2
  563. package/dist/async/backof-policies/polynomial-backoff-policy/_module.js.map +0 -1
  564. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +0 -35
  565. package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +0 -1
  566. package/dist/async/middlewares/_module.d.ts +0 -7
  567. package/dist/async/middlewares/_module.js +0 -8
  568. package/dist/async/middlewares/_module.js.map +0 -1
  569. package/dist/async/middlewares/bulkhead/_module.d.ts +0 -1
  570. package/dist/async/middlewares/bulkhead/_module.js +0 -2
  571. package/dist/async/middlewares/bulkhead/_module.js.map +0 -1
  572. package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +0 -80
  573. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +0 -46
  574. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +0 -1
  575. package/dist/async/middlewares/dynamic/_module.d.ts +0 -1
  576. package/dist/async/middlewares/dynamic/_module.js +0 -2
  577. package/dist/async/middlewares/dynamic/_module.js.map +0 -1
  578. package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +0 -1
  579. package/dist/async/middlewares/fallback/_module.d.ts +0 -2
  580. package/dist/async/middlewares/fallback/_module.js +0 -3
  581. package/dist/async/middlewares/fallback/_module.js.map +0 -1
  582. package/dist/async/middlewares/fallback/fallback.middleware.js.map +0 -1
  583. package/dist/async/middlewares/fallback/fallback.types.js.map +0 -1
  584. package/dist/async/middlewares/hedging/_module.d.ts +0 -2
  585. package/dist/async/middlewares/hedging/_module.js +0 -3
  586. package/dist/async/middlewares/hedging/_module.js.map +0 -1
  587. package/dist/async/middlewares/hedging/hedging.types.d.ts +0 -121
  588. package/dist/async/middlewares/hedging/hedging.types.js +0 -6
  589. package/dist/async/middlewares/hedging/hedging.types.js.map +0 -1
  590. package/dist/async/middlewares/hedging/sequential-hedging.middleware.d.ts +0 -51
  591. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js +0 -133
  592. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js.map +0 -1
  593. package/dist/async/middlewares/observe/_module.d.ts +0 -2
  594. package/dist/async/middlewares/observe/_module.js +0 -3
  595. package/dist/async/middlewares/observe/_module.js.map +0 -1
  596. package/dist/async/middlewares/observe/observe.middleware.js.map +0 -1
  597. package/dist/async/middlewares/observe/observe.types.js +0 -6
  598. package/dist/async/middlewares/observe/observe.types.js.map +0 -1
  599. package/dist/async/middlewares/retry/_module.d.ts +0 -2
  600. package/dist/async/middlewares/retry/_module.js +0 -3
  601. package/dist/async/middlewares/retry/_module.js.map +0 -1
  602. package/dist/async/middlewares/retry/retry.middleware.js.map +0 -1
  603. package/dist/async/middlewares/retry/retry.types.js +0 -7
  604. package/dist/async/middlewares/retry/retry.types.js.map +0 -1
  605. package/dist/async/middlewares/timeout/_module.d.ts +0 -2
  606. package/dist/async/middlewares/timeout/_module.js +0 -3
  607. package/dist/async/middlewares/timeout/_module.js.map +0 -1
  608. package/dist/async/middlewares/timeout/timeout.middleware.js.map +0 -1
  609. package/dist/async/middlewares/timeout/timeout.type.js +0 -6
  610. package/dist/async/middlewares/timeout/timeout.type.js.map +0 -1
  611. package/dist/async/utilities/_module.d.ts +0 -4
  612. package/dist/async/utilities/_module.js +0 -5
  613. package/dist/async/utilities/_module.js.map +0 -1
  614. package/dist/async/utilities/abort-and-fail/_module.d.ts +0 -1
  615. package/dist/async/utilities/abort-and-fail/_module.js +0 -2
  616. package/dist/async/utilities/abort-and-fail/_module.js.map +0 -1
  617. package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +0 -1
  618. package/dist/async/utilities/lazy-promise/_module.d.ts +0 -1
  619. package/dist/async/utilities/lazy-promise/_module.js +0 -2
  620. package/dist/async/utilities/lazy-promise/_module.js.map +0 -1
  621. package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +0 -153
  622. package/dist/async/utilities/lazy-promise/lazy-promise.js +0 -176
  623. package/dist/async/utilities/lazy-promise/lazy-promise.js.map +0 -1
  624. package/dist/async/utilities/promise-queue/_module.d.ts +0 -1
  625. package/dist/async/utilities/promise-queue/_module.js +0 -2
  626. package/dist/async/utilities/promise-queue/_module.js.map +0 -1
  627. package/dist/async/utilities/promise-queue/promise-queue.d.ts +0 -32
  628. package/dist/async/utilities/promise-queue/promise-queue.js +0 -118
  629. package/dist/async/utilities/promise-queue/promise-queue.js.map +0 -1
  630. package/dist/async/utilities/timeout-and-fail/_module.d.ts +0 -1
  631. package/dist/async/utilities/timeout-and-fail/_module.js +0 -2
  632. package/dist/async/utilities/timeout-and-fail/_module.js.map +0 -1
  633. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +0 -7
  634. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +0 -22
  635. package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +0 -1
  636. package/dist/lock/implementations/derivables/lock-provider/lock-state.d.ts +0 -40
  637. package/dist/lock/implementations/derivables/lock-provider/lock-state.js +0 -60
  638. package/dist/lock/implementations/derivables/lock-provider/lock-state.js.map +0 -1
  639. package/dist/serde/contracts/serializable.contract.d.ts +0 -12
  640. package/dist/serde/contracts/serializable.contract.js +0 -5
  641. package/dist/serde/contracts/serializable.contract.js.map +0 -1
  642. package/dist/serde/implementations/adapters/mongodb-serde/_module.d.ts +0 -1
  643. package/dist/serde/implementations/adapters/mongodb-serde/_module.js +0 -2
  644. package/dist/serde/implementations/adapters/mongodb-serde/_module.js.map +0 -1
  645. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.d.ts +0 -13
  646. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js +0 -38
  647. package/dist/serde/implementations/adapters/mongodb-serde/mongodb-serde.js.map +0 -1
  648. package/dist/serde/implementations/adapters/redis-serde/_module.d.ts +0 -1
  649. package/dist/serde/implementations/adapters/redis-serde/_module.js +0 -2
  650. package/dist/serde/implementations/adapters/redis-serde/_module.js.map +0 -1
  651. package/dist/serde/implementations/adapters/redis-serde/redis-serde.d.ts +0 -13
  652. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js +0 -39
  653. package/dist/serde/implementations/adapters/redis-serde/redis-serde.js.map +0 -1
  654. package/dist/serde/implementations/adapters/sql-serde/_module.d.ts +0 -1
  655. package/dist/serde/implementations/adapters/sql-serde/_module.js +0 -2
  656. package/dist/serde/implementations/adapters/sql-serde/_module.js.map +0 -1
  657. package/dist/serde/implementations/adapters/sql-serde/sql-serde.d.ts +0 -13
  658. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js +0 -39
  659. package/dist/serde/implementations/adapters/sql-serde/sql-serde.js.map +0 -1
  660. package/dist/utilities/classes/hooks/_module.d.ts +0 -3
  661. package/dist/utilities/classes/hooks/_module.js +0 -4
  662. package/dist/utilities/classes/hooks/_module.js.map +0 -1
  663. package/dist/utilities/classes/hooks/async-hooks.js.map +0 -1
  664. package/dist/utilities/classes/hooks/hooks.js.map +0 -1
  665. package/dist/utilities/classes/hooks/types.js +0 -5
  666. package/dist/utilities/classes/hooks/types.js.map +0 -1
  667. package/dist/utilities/classes/namespace/_module.d.ts +0 -1
  668. package/dist/utilities/classes/namespace/_module.js +0 -2
  669. package/dist/utilities/classes/namespace/_module.js.map +0 -1
  670. package/dist/utilities/classes/namespace/namespace.d.ts +0 -85
  671. package/dist/utilities/classes/namespace/namespace.js +0 -125
  672. package/dist/utilities/classes/namespace/namespace.js.map +0 -1
  673. package/dist/utilities/classes/time-span/_module.d.ts +0 -1
  674. package/dist/utilities/classes/time-span/_module.js +0 -2
  675. package/dist/utilities/classes/time-span/_module.js.map +0 -1
  676. package/dist/utilities/classes/time-span/time-span.js.map +0 -1
  677. package/dist/utilities/contracts/serialized-error.contract.d.ts +0 -13
  678. package/dist/utilities/contracts/serialized-error.contract.js +0 -5
  679. package/dist/utilities/contracts/serialized-error.contract.js.map +0 -1
@@ -26,6 +26,7 @@ export class RedisLockAdapter {
26
26
  this.initAquireCommand();
27
27
  this.initReleaseCommand();
28
28
  this.initRefreshComand();
29
+ this.initGetStateComand();
29
30
  }
30
31
  initAquireCommand() {
31
32
  if (typeof this.database.daiso_lock_acquire === "function") {
@@ -35,22 +36,23 @@ export class RedisLockAdapter {
35
36
  numberOfKeys: 1,
36
37
  lua: `
37
38
  local key = KEYS[1];
38
- local owner = ARGV[1];
39
- local ttl = ARGV[2]
40
-
41
- local hasKey = redis.call("exists", key)
42
- if hasKey == 1 then
43
- return 0
39
+ local lockId = ARGV[1];
40
+
41
+ -- Expiration time as unix timestamp in ms
42
+ local expiration = tonumber(ARGV[2]);
43
+
44
+ if redis.call("exists", key) == 1 then
45
+ return redis.call("get", key) == lockId;
44
46
  end
45
47
 
46
- if ttl == "null" then
47
- redis.call("set", key, owner, "nx")
48
+ if expiration == nil then
49
+ redis.call("set", key, lockId, "nx");
48
50
  else
49
- redis.call("set", key, owner, "px", ttl, "nx")
51
+ redis.call("set", key, lockId, "pxat", expiration, "nx");
50
52
  end
51
53
 
52
- return 1
53
- `,
54
+ return 1;
55
+ `,
54
56
  });
55
57
  }
56
58
  initReleaseCommand() {
@@ -61,16 +63,21 @@ export class RedisLockAdapter {
61
63
  numberOfKeys: 1,
62
64
  lua: `
63
65
  local key = KEYS[1];
64
- local owner = ARGV[1];
66
+ local lockId = ARGV[1];
65
67
 
66
- local owner_ = redis.call("get", key)
67
- if owner_ == owner then
68
- redis.call("del", key)
69
- return 1
68
+ if redis.call("exists", key) == 0 then
69
+ return 0
70
+ end
71
+
72
+ local isNotCurrentOwner = redis.call("get", key) ~= lockId
73
+ if isNotCurrentOwner then
74
+ return 0
70
75
  end
76
+
77
+ redis.call("del", key)
71
78
 
72
- return 0
73
- `,
79
+ return 1
80
+ `,
74
81
  });
75
82
  }
76
83
  initRefreshComand() {
@@ -80,33 +87,81 @@ export class RedisLockAdapter {
80
87
  this.database.defineCommand("daiso_lock_refresh", {
81
88
  numberOfKeys: 1,
82
89
  lua: `
90
+ -- Arguments
83
91
  local key = KEYS[1];
84
- local owner = ARGV[1];
85
- local ttl = ARGV[2]
92
+ local lockId = ARGV[1];
86
93
 
87
- local owner_ = redis.call("get", key)
88
- if owner_ == owner then
89
- redis.call("pexpire", key, ttl)
90
- return 1
94
+ -- Expiration time as unix timestamp in ms
95
+ local expiration = tonumber(ARGV[2]);
96
+
97
+ if redis.call("exists", key) == 0 then
98
+ return 0
91
99
  end
92
- return 0
100
+
101
+ local isNotCurrentOwner = redis.call("get", key) ~= lockId
102
+ if redis.call("get", key) ~= lockId then
103
+ return 0
104
+ end
105
+
106
+ local currentExpiration = redis.call("pttl", key)
107
+ local isUnexpireable = currentExpiration == -1
108
+ if isUnexpireable then
109
+ return 0
110
+ end
111
+
112
+ redis.call("pexpireat", key, expiration)
113
+ return 1
114
+ `,
115
+ });
116
+ }
117
+ initGetStateComand() {
118
+ if (typeof this.database.daiso_lock_get_state === "function") {
119
+ return;
120
+ }
121
+ this.database.defineCommand("daiso_lock_get_state", {
122
+ numberOfKeys: 1,
123
+ lua: `
124
+ -- Arguments
125
+ local key = KEYS[1];
126
+
127
+ if tonumber(redis.call("exists", key)) == 0 then
128
+ return cjson.encode(nil);
129
+ end
130
+
131
+ local state = {
132
+ owner = redis.call("get", key),
133
+ expiration = tonumber(redis.call("pexpiretime", key))
134
+ };
135
+
136
+ return cjson.encode(state);
93
137
  `,
94
138
  });
95
139
  }
96
- async acquire(key, owner, ttl) {
97
- const result = await this.database.daiso_lock_acquire(key, owner, String(ttl?.toMilliseconds() ?? null));
140
+ async acquire(key, lockId, ttl) {
141
+ const result = await this.database.daiso_lock_acquire(key, lockId, ttl?.toEndDate().getTime() ?? null);
98
142
  return result === 1;
99
143
  }
100
- async release(key, owner) {
101
- const result = await this.database.daiso_lock_release(key, owner);
144
+ async release(key, lockId) {
145
+ const result = await this.database.daiso_lock_release(key, lockId);
102
146
  return result === 1;
103
147
  }
104
148
  async forceRelease(key) {
105
- await this.database.del(key);
149
+ const result = await this.database.del(key);
150
+ return result > 0;
106
151
  }
107
- async refresh(key, owner, ttl) {
108
- const result = await this.database.daiso_lock_refresh(key, owner, ttl.toMilliseconds().toString());
152
+ async refresh(key, lockId, ttl) {
153
+ const result = await this.database.daiso_lock_refresh(key, lockId, ttl.toEndDate().getTime());
109
154
  return result === 1;
110
155
  }
156
+ async getState(key) {
157
+ const json = JSON.parse(await this.database.daiso_lock_get_state(key));
158
+ if (json === null) {
159
+ return null;
160
+ }
161
+ return {
162
+ owner: json.owner,
163
+ expiration: json.expiration === -1 ? null : new Date(json.expiration),
164
+ };
165
+ }
111
166
  }
112
167
  //# sourceMappingURL=redis-lock-adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuBH;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IAWI;IAV7B;;;;;;;;;OASG;IACH,YAA6B,QAAe;QAAf,aAAQ,GAAR,QAAQ,CAAO;QACxC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAEO,iBAAiB;QACrB,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC;YACf,GAAG,EAAE;;;;;;;;;;;;;;;;;iBAiBA;SACR,CAAC,CAAC;IACP,CAAC;IAEO,kBAAkB;QACtB,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC;YACf,GAAG,EAAE;;;;;;;;;;;iBAWA;SACR,CAAC,CAAC;IACP,CAAC;IAEO,iBAAiB;QACrB,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC;YACf,GAAG,EAAE;;;;;;;;;;;aAWJ;SACJ,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CACT,GAAW,EACX,KAAa,EACb,GAAoB;QAEpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CACjD,GAAG,EACH,KAAK,EACL,MAAM,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,IAAI,CAAC,CACxC,CAAC;QACF,OAAO,MAAM,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa;QACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,MAAM,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,GAAa;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CACjD,GAAG,EACH,KAAK,EACL,GAAG,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,CAClC,CAAC;QACF,OAAO,MAAM,KAAK,CAAC,CAAC;IACxB,CAAC;CACJ"}
1
+ {"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.ts"],"names":[],"mappings":"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"}
@@ -1,16 +1,17 @@
1
1
  /**
2
2
  * @module Lock
3
3
  */
4
- import { type TimeSpan } from "../../../../utilities/_module-exports.js";
5
- import type { IDatabaseLockAdapter, ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
4
+ import { type IDatabaseLockAdapter, type ILockAdapter, type ILockAdapterState } from "../../../../lock/contracts/_module-exports.js";
5
+ import type { TimeSpan } from "../../../../time-span/implementations/_module-exports.js";
6
6
  /**
7
7
  * @internal
8
8
  */
9
9
  export declare class DatabaseLockAdapter implements ILockAdapter {
10
10
  private readonly adapter;
11
11
  constructor(adapter: IDatabaseLockAdapter);
12
- acquire(key: string, owner: string, ttl: TimeSpan | null): Promise<boolean>;
13
- release(key: string, owner: string): Promise<boolean>;
14
- forceRelease(key: string): Promise<void>;
15
- refresh(key: string, owner: string, ttl: TimeSpan): Promise<boolean>;
12
+ acquire(key: string, lockId: string, ttl: TimeSpan | null): Promise<boolean>;
13
+ release(key: string, lockId: string): Promise<boolean>;
14
+ forceRelease(key: string): Promise<boolean>;
15
+ refresh(key: string, lockId: string, ttl: TimeSpan): Promise<boolean>;
16
+ getState(key: string): Promise<ILockAdapterState | null>;
16
17
  }
@@ -1,7 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
1
2
  /**
2
3
  * @module Lock
3
4
  */
4
- import { UnexpectedError } from "../../../../utilities/_module-exports.js";
5
+ import {} from "../../../../lock/contracts/_module-exports.js";
5
6
  /**
6
7
  * @internal
7
8
  */
@@ -10,36 +11,67 @@ export class DatabaseLockAdapter {
10
11
  constructor(adapter) {
11
12
  this.adapter = adapter;
12
13
  }
13
- async acquire(key, owner, ttl) {
14
- const expiration = ttl?.toEndDate() ?? null;
15
- try {
16
- // An error will be thrown if the lock already exists
17
- await this.adapter.insert(key, owner, expiration);
18
- return true;
19
- }
20
- catch (error) {
21
- if (error instanceof UnexpectedError) {
22
- throw error;
14
+ async acquire(key, lockId, ttl) {
15
+ return await this.adapter.transaction(async (trx) => {
16
+ const lockData = await trx.find(key);
17
+ if (lockData === null) {
18
+ await trx.upsert(key, lockId, ttl?.toEndDate() ?? null);
19
+ return true;
23
20
  }
24
- const result = await this.adapter.update(key, owner, expiration);
25
- return result > 0;
26
- }
21
+ if (lockData.owner === lockId) {
22
+ return true;
23
+ }
24
+ if (lockData.expiration === null) {
25
+ return false;
26
+ }
27
+ if (lockData.expiration <= new Date()) {
28
+ await trx.upsert(key, lockId, ttl?.toEndDate() ?? null);
29
+ return true;
30
+ }
31
+ return lockData.expiration <= new Date();
32
+ });
27
33
  }
28
- async release(key, owner) {
29
- const lock = await this.adapter.find(key);
30
- if (lock === null) {
34
+ async release(key, lockId) {
35
+ const lockData = await this.adapter.removeIfOwner(key, lockId);
36
+ if (lockData === null) {
37
+ return false;
38
+ }
39
+ const { expiration } = lockData;
40
+ const hasNoExpiration = expiration === null;
41
+ if (hasNoExpiration) {
31
42
  return true;
32
43
  }
33
- await this.adapter.remove(key, owner);
34
- const isOwner = lock.owner === owner;
35
- return isOwner;
44
+ const { owner } = lockData;
45
+ const isNotExpired = expiration > new Date();
46
+ const isCurrentOwner = lockId === owner;
47
+ return isNotExpired && isCurrentOwner;
36
48
  }
37
49
  async forceRelease(key) {
38
- await this.adapter.remove(key, null);
50
+ const lockData = await this.adapter.remove(key);
51
+ if (lockData === null) {
52
+ return false;
53
+ }
54
+ if (lockData.expiration === null) {
55
+ return true;
56
+ }
57
+ return lockData.expiration > new Date();
58
+ }
59
+ async refresh(key, lockId, ttl) {
60
+ const updateCount = await this.adapter.updateExpiration(key, lockId, ttl.toEndDate());
61
+ return Number(updateCount) > 0;
39
62
  }
40
- async refresh(key, owner, ttl) {
41
- const result = await this.adapter.refresh(key, owner, ttl.toEndDate());
42
- return result > 0;
63
+ async getState(key) {
64
+ const lockData = await this.adapter.find(key);
65
+ if (lockData === null) {
66
+ return null;
67
+ }
68
+ if (lockData.expiration === null) {
69
+ return lockData;
70
+ }
71
+ if (lockData.expiration <= new Date()) {
72
+ return null;
73
+ }
74
+ return lockData;
43
75
  }
44
76
  }
45
77
  //# sourceMappingURL=database-lock-adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/database-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AAMhF;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACC;IAA7B,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE9D,KAAK,CAAC,OAAO,CACT,GAAW,EACX,KAAa,EACb,GAAoB;QAEpB,MAAM,UAAU,GAAG,GAAG,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC;QAE5C,IAAI,CAAC;YACD,qDAAqD;YACrD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;gBACnC,MAAM,KAAK,CAAC;YAChB,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YACjE,OAAO,MAAM,GAAG,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;QACrC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa,EAAE,GAAa;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;QACvE,OAAO,MAAM,GAAG,CAAC,CAAC;IACtB,CAAC;CACJ"}
1
+ {"version":3,"file":"database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/database-lock-adapter.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE;;GAEG;AAEH,OAAO,EAIN,MAAM,qCAAqC,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACC;IAA7B,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE9D,KAAK,CAAC,OAAO,CACT,GAAW,EACX,MAAc,EACd,GAAoB;QAEpB,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAU,KAAK,EAAE,GAAG,EAAE,EAAE;YACzD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACpB,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC;gBACxD,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI,QAAQ,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;gBAC5B,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,IAAI,QAAQ,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;gBACpC,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,CAAC;gBACxD,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,OAAO,QAAQ,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,MAAc;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/D,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;QAChC,MAAM,eAAe,GAAG,UAAU,KAAK,IAAI,CAAC;QAC5C,IAAI,eAAe,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;QAC3B,MAAM,YAAY,GAAG,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7C,MAAM,cAAc,GAAG,MAAM,KAAK,KAAK,CAAC;QACxC,OAAO,YAAY,IAAI,cAAc,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,QAAQ,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAO,CACT,GAAW,EACX,MAAc,EACd,GAAa;QAEb,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CACnD,GAAG,EACH,MAAM,EACN,GAAG,CAAC,SAAS,EAAE,CAClB,CAAC;QACF,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAW;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,QAAQ,CAAC;QACpB,CAAC;QACD,IAAI,QAAQ,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
@@ -2,8 +2,8 @@
2
2
  * @module Lock
3
3
  */
4
4
  import type { IDatabaseLockAdapter } from "../../../../lock/contracts/_module-exports.js";
5
- import type { ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
5
+ import type { LockAdapterVariants } from "../../../../lock/contracts/_module-exports.js";
6
6
  /**
7
7
  * @internal
8
8
  */
9
- export declare function isDatabaseLockAdapter(adapter: ILockAdapter | IDatabaseLockAdapter): adapter is IDatabaseLockAdapter;
9
+ export declare function isDatabaseLockAdapter(adapter: LockAdapterVariants): adapter is IDatabaseLockAdapter;
@@ -3,14 +3,14 @@
3
3
  */
4
4
  export function isDatabaseLockAdapter(adapter) {
5
5
  const adapter_ = adapter;
6
- return (typeof adapter_["insert"] === "function" &&
7
- adapter_["insert"].length === 3 &&
8
- typeof adapter_["update"] === "function" &&
9
- adapter_["update"].length === 3 &&
6
+ return (typeof adapter_["transaction"] === "function" &&
7
+ adapter_["transaction"].length === 1 &&
10
8
  typeof adapter_["remove"] === "function" &&
11
- adapter_["remove"].length === 2 &&
12
- typeof adapter_["refresh"] === "function" &&
13
- adapter_["refresh"].length === 3 &&
9
+ adapter_["remove"].length === 1 &&
10
+ typeof adapter_["removeIfOwner"] === "function" &&
11
+ adapter_["removeIfOwner"].length === 2 &&
12
+ typeof adapter_["updateExpiration"] === "function" &&
13
+ adapter_["updateExpiration"].length === 3 &&
14
14
  typeof adapter_["find"] === "function" &&
15
15
  adapter_["find"].length === 1);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/is-database-lock-adapter.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACjC,OAA4C;IAE5C,MAAM,QAAQ,GAAG,OAEhB,CAAC;IACF,OAAO,CACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/B,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,UAAU;QACzC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC;QAChC,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,UAAU;QACtC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAChC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"is-database-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/derivables/lock-provider/is-database-lock-adapter.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACjC,OAA4B;IAE5B,MAAM,QAAQ,GAAG,OAEhB,CAAC;IAEF,OAAO,CACH,OAAO,QAAQ,CAAC,aAAa,CAAC,KAAK,UAAU;QAC7C,QAAQ,CAAC,aAAa,CAAC,CAAC,MAAM,KAAK,CAAC;QACpC,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,UAAU;QACxC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC/B,OAAO,QAAQ,CAAC,eAAe,CAAC,KAAK,UAAU;QAC/C,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,KAAK,CAAC;QACtC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,KAAK,UAAU;QAClD,QAAQ,CAAC,kBAAkB,CAAC,CAAC,MAAM,KAAK,CAAC;QACzC,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,UAAU;QACtC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAChC,CAAC;AACN,CAAC"}
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * @module Lock
3
3
  */
4
- import { TimeSpan, type Factory, type AsyncLazy, type Invokable } from "../../../../utilities/_module-exports.js";
5
- import { Namespace, type OneOrMore } from "../../../../utilities/_module-exports.js";
6
- import type { IDatabaseLockAdapter, LockEventMap } from "../../../../lock/contracts/_module-exports.js";
7
- import { type ILock, type LockProviderCreateSettings, type ILockProvider, type ILockAdapter } from "../../../../lock/contracts/_module-exports.js";
8
- import { LazyPromise } from "../../../../async/_module-exports.js";
4
+ import { type Invokable } from "../../../../utilities/_module-exports.js";
5
+ import { type OneOrMore } from "../../../../utilities/_module-exports.js";
6
+ import type { LockAdapterVariants, LockEventMap } from "../../../../lock/contracts/_module-exports.js";
7
+ import { type ILock, type LockProviderCreateSettings, type ILockProvider } from "../../../../lock/contracts/_module-exports.js";
8
+ import type { Task } from "../../../../task/_module-exports.js";
9
9
  import type { EventListener, IEventBus, Unsubscribe } from "../../../../event-bus/contracts/_module-exports.js";
10
10
  import type { ISerderRegister } from "../../../../serde/contracts/_module-exports.js";
11
+ import type { ITimeSpan } from "../../../../time-span/contracts/_module-exports.js";
12
+ import { Namespace } from "../../../../namespace/_module-exports.js";
11
13
  /**
12
14
  *
13
15
  * IMPORT_PATH: `"@daiso-tech/core/lock"`
@@ -17,31 +19,21 @@ export type LockProviderSettingsBase = {
17
19
  /**
18
20
  * @default
19
21
  * ```ts
20
- * import { Namespace } from "@daiso-tech/core/utilities";
22
+ * import { Namespace } from "@daiso-tech/core/namespace";
21
23
  *
22
- * new Namespace(["@", "lock"])
24
+ * new Namespace("@lock")
23
25
  * ```
24
26
  */
25
27
  namespace?: Namespace;
26
- /**
27
- * 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.
28
- * @default
29
- * ```ts
30
- * import { LazyPromise } from "@daiso-tech/core/async";
31
- *
32
- * (invokable) => new LazyPromise(invokable)
33
- * ```
34
- */
35
- lazyPromiseFactory?: Factory<AsyncLazy<any>, LazyPromise<any>>;
36
28
  serde: OneOrMore<ISerderRegister>;
37
29
  /**
38
30
  * @default ""
39
31
  */
40
32
  serdeTransformerName?: string;
41
33
  /**
42
- * You can pass your owner id generator function.
34
+ * You can pass your lock id id generator function.
43
35
  */
44
- createOwnerId?: Invokable<[], string>;
36
+ createLockId?: Invokable<[], string>;
45
37
  /**
46
38
  * @default
47
39
  * ```ts
@@ -61,7 +53,7 @@ export type LockProviderSettingsBase = {
61
53
  * TimeSpan.fromMinutes(5);
62
54
  * ```
63
55
  */
64
- defaultTtl?: TimeSpan | null;
56
+ defaultTtl?: ITimeSpan | null;
65
57
  /**
66
58
  * The default refresh time used in the {@link ILock | `ILock`} `acquireBlocking` and `runBlocking` methods.
67
59
  * @default
@@ -69,7 +61,7 @@ export type LockProviderSettingsBase = {
69
61
  * TimeSpan.fromSeconds(1);
70
62
  * ```
71
63
  */
72
- defaultBlockingInterval?: TimeSpan;
64
+ defaultBlockingInterval?: ITimeSpan;
73
65
  /**
74
66
  * The default refresh time used in the {@link ILock | `ILock`} `acquireBlocking` and `runBlocking` methods.
75
67
  * @default
@@ -77,29 +69,29 @@ export type LockProviderSettingsBase = {
77
69
  * TimeSpan.fromMinutes(1);
78
70
  * ```
79
71
  */
80
- defaultBlockingTime?: TimeSpan;
72
+ defaultBlockingTime?: ITimeSpan;
81
73
  /**
82
74
  * The default refresh time used in the {@link ILock | `ILock`} `referesh` method.
83
75
  * ```ts
84
76
  * TimeSpan.fromMinutes(5);
85
77
  * ```
86
78
  */
87
- defaultRefreshTime?: TimeSpan;
79
+ defaultRefreshTime?: ITimeSpan;
88
80
  };
89
81
  /**
90
82
  *
91
83
  * IMPORT_PATH: `"@daiso-tech/core/lock"`
92
84
  * @group Derivables
93
85
  */
94
- export type LockAdapter = ILockAdapter | IDatabaseLockAdapter;
86
+ export type LockProviderSettings = LockProviderSettingsBase & {
87
+ adapter: LockAdapterVariants;
88
+ };
95
89
  /**
96
90
  *
97
91
  * IMPORT_PATH: `"@daiso-tech/core/lock"`
98
92
  * @group Derivables
99
93
  */
100
- export type LockProviderSettings = LockProviderSettingsBase & {
101
- adapter: LockAdapter;
102
- };
94
+ export declare const DEFAULT_LOCK_PROVIDER_NAMESPACE: Namespace;
103
95
  /**
104
96
  * `LockProvider` class can be derived from any {@link ILockAdapter | `ILockAdapter`} or {@link IDatabaseLockAdapter | `IDatabaseLockAdapter`}.
105
97
  *
@@ -111,17 +103,16 @@ export type LockProviderSettings = LockProviderSettingsBase & {
111
103
  * @group Derivables
112
104
  */
113
105
  export declare class LockProvider implements ILockProvider {
114
- private lockStore;
115
106
  private readonly eventBus;
107
+ private readonly originalAdapter;
116
108
  private readonly adapter;
117
109
  private readonly namespace;
118
- private readonly createOwnerId;
110
+ private readonly creatLockId;
119
111
  private readonly defaultTtl;
120
112
  private readonly defaultBlockingInterval;
121
113
  private readonly defaultBlockingTime;
122
114
  private readonly defaultRefreshTime;
123
115
  private readonly serde;
124
- private readonly lazyPromiseFactory;
125
116
  private readonly serdeTransformerName;
126
117
  /**
127
118
  * @example
@@ -152,39 +143,38 @@ export declare class LockProvider implements ILockProvider {
152
143
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
153
144
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
154
145
  */
155
- addListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
146
+ addListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): Task<void>;
156
147
  /**
157
148
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
158
149
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
159
150
  */
160
- removeListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
151
+ removeListener<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): Task<void>;
161
152
  /**
162
153
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
163
154
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
164
155
  */
165
- listenOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<void>;
156
+ listenOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): Task<void>;
166
157
  /**
167
158
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
168
159
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
169
160
  */
170
- asPromise<TEventName extends keyof LockEventMap>(eventName: TEventName): LazyPromise<LockEventMap[TEventName]>;
161
+ asPromise<TEventName extends keyof LockEventMap>(eventName: TEventName): Task<LockEventMap[TEventName]>;
171
162
  /**
172
163
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
173
164
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
174
165
  */
175
- subscribeOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<Unsubscribe>;
166
+ subscribeOnce<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): Task<Unsubscribe>;
176
167
  /**
177
168
  * You can listen to the following {@link LockEventMap | `LockEventMap`} of all {@link ILock | `ILock`} instances created by the {@link ILockProvider | `ILockProvider`}.
178
169
  * To understand how this method works, refer to {@link IEventListenable | `IEventListenable `}.
179
170
  */
180
- subscribe<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): LazyPromise<Unsubscribe>;
181
- private createLazyPromise;
171
+ subscribe<TEventName extends keyof LockEventMap>(eventName: TEventName, listener: EventListener<LockEventMap[TEventName]>): Task<Unsubscribe>;
182
172
  /**
183
173
  * @example
184
174
  * ```ts
185
175
  * import { LockProvider } from "@daiso-tech/core/lock";
186
176
  * import { MemoryLockAdapter } from "@daiso-tech/core/lock/adapters";
187
- * import { Namespace } from "@daiso-tech/core/utilities";
177
+ * import { Namespace } from "@daiso-tech/core/namespace";
188
178
  * import { Serde } from "@daiso-tech/core/serde";
189
179
  * import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
190
180
  *
@@ -197,5 +187,5 @@ export declare class LockProvider implements ILockProvider {
197
187
  * const lock = lockProvider.create("a");
198
188
  * ```
199
189
  */
200
- create(key: OneOrMore<string>, settings?: LockProviderCreateSettings): ILock;
190
+ create(key: string, settings?: LockProviderCreateSettings): ILock;
201
191
  }