@ddd-ts-kit/kernel 0.114.1 → 0.115.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 (319) hide show
  1. package/README.fr.md +67 -59
  2. package/README.md +62 -54
  3. package/dist/application/audit/restamped.d.ts +9 -0
  4. package/dist/application/audit/restamped.d.ts.map +1 -0
  5. package/dist/application/audit/restamped.js +9 -0
  6. package/dist/application/audit/restamped.js.map +1 -0
  7. package/dist/application/audit/stamp-update.d.ts +1 -6
  8. package/dist/application/audit/stamp-update.d.ts.map +1 -1
  9. package/dist/application/audit/stamp-update.js +2 -8
  10. package/dist/application/audit/stamp-update.js.map +1 -1
  11. package/dist/application/background/enqueued-job.d.ts +1 -1
  12. package/dist/application/background/enqueued-job.d.ts.map +1 -1
  13. package/dist/application/error-reporting/report-once.d.ts.map +1 -1
  14. package/dist/application/error-reporting/report-once.js +2 -6
  15. package/dist/application/error-reporting/report-once.js.map +1 -1
  16. package/dist/application/event-sourcing/event-envelope.d.ts +2 -1
  17. package/dist/application/event-sourcing/event-envelope.d.ts.map +1 -1
  18. package/dist/application/event-sourcing/event-to-append.d.ts +1 -1
  19. package/dist/application/event-sourcing/event-to-append.d.ts.map +1 -1
  20. package/dist/application/execution/with-actor.d.ts +2 -2
  21. package/dist/application/execution/with-actor.js +3 -3
  22. package/dist/application/execution/with-actor.js.map +1 -1
  23. package/dist/application/files/stored-file.d.ts +3 -3
  24. package/dist/application/files/stored-file.d.ts.map +1 -1
  25. package/dist/application/hydration/hydration.d.ts.map +1 -1
  26. package/dist/application/hydration/hydration.js +3 -2
  27. package/dist/application/hydration/hydration.js.map +1 -1
  28. package/dist/application/logging/hidden-keys.d.ts +8 -0
  29. package/dist/application/logging/hidden-keys.d.ts.map +1 -0
  30. package/dist/application/logging/hidden-keys.js +10 -0
  31. package/dist/application/logging/hidden-keys.js.map +1 -0
  32. package/dist/application/logging/index.d.ts +1 -0
  33. package/dist/application/logging/index.d.ts.map +1 -1
  34. package/dist/application/logging/index.js +1 -0
  35. package/dist/application/logging/index.js.map +1 -1
  36. package/dist/application/observation/safely.d.ts +6 -0
  37. package/dist/application/observation/safely.d.ts.map +1 -0
  38. package/dist/application/observation/safely.js +13 -0
  39. package/dist/application/observation/safely.js.map +1 -0
  40. package/dist/application/persistence/append-changes.d.ts +1 -0
  41. package/dist/application/persistence/append-changes.d.ts.map +1 -1
  42. package/dist/application/persistence/append-changes.js +7 -6
  43. package/dist/application/persistence/append-changes.js.map +1 -1
  44. package/dist/application/persistence/optimistic-update.d.ts +6 -2
  45. package/dist/application/persistence/optimistic-update.d.ts.map +1 -1
  46. package/dist/application/persistence/optimistic-update.js +11 -3
  47. package/dist/application/persistence/optimistic-update.js.map +1 -1
  48. package/dist/application/ports/domain-event-dispatcher.d.ts +1 -1
  49. package/dist/application/ports/domain-event-dispatcher.js +1 -1
  50. package/dist/application/ports/logger.d.ts +3 -3
  51. package/dist/application/ports/unit-of-work.d.ts +1 -1
  52. package/dist/application/ports/unit-of-work.js +1 -1
  53. package/dist/application/read-model/stamp-of.d.ts +11 -4
  54. package/dist/application/read-model/stamp-of.d.ts.map +1 -1
  55. package/dist/application/read-model/stamp-of.js +10 -8
  56. package/dist/application/read-model/stamp-of.js.map +1 -1
  57. package/dist/application/session/anonymous-session.d.ts.map +1 -1
  58. package/dist/application/session/anonymous-session.js +4 -2
  59. package/dist/application/session/anonymous-session.js.map +1 -1
  60. package/dist/application/session/never-issued.d.ts +2 -1
  61. package/dist/application/session/never-issued.d.ts.map +1 -1
  62. package/dist/application/session/never-issued.js +4 -1
  63. package/dist/application/session/never-issued.js.map +1 -1
  64. package/dist/application/session/system-session.d.ts.map +1 -1
  65. package/dist/application/session/system-session.js +2 -2
  66. package/dist/application/session/system-session.js.map +1 -1
  67. package/dist/application/undecided/index.d.ts +3 -0
  68. package/dist/application/undecided/index.d.ts.map +1 -0
  69. package/dist/application/undecided/index.js +3 -0
  70. package/dist/application/undecided/index.js.map +1 -0
  71. package/dist/application/undecided/undecided-error.d.ts +12 -0
  72. package/dist/application/undecided/undecided-error.d.ts.map +1 -0
  73. package/dist/application/undecided/undecided-error.js +15 -0
  74. package/dist/application/undecided/undecided-error.js.map +1 -0
  75. package/dist/application/undecided/undecided.d.ts +7 -0
  76. package/dist/application/undecided/undecided.d.ts.map +1 -0
  77. package/dist/application/undecided/undecided.js +9 -0
  78. package/dist/application/undecided/undecided.js.map +1 -0
  79. package/dist/domain/aggregate-root.d.ts +6 -13
  80. package/dist/domain/aggregate-root.d.ts.map +1 -1
  81. package/dist/domain/aggregate-root.js +10 -16
  82. package/dist/domain/aggregate-root.js.map +1 -1
  83. package/dist/domain/aggregate-tracking.d.ts +30 -0
  84. package/dist/domain/aggregate-tracking.d.ts.map +1 -0
  85. package/dist/domain/aggregate-tracking.js +48 -0
  86. package/dist/domain/aggregate-tracking.js.map +1 -0
  87. package/dist/domain/domain-event.d.ts +4 -0
  88. package/dist/domain/domain-event.d.ts.map +1 -1
  89. package/dist/domain/domain-event.js.map +1 -1
  90. package/dist/domain/errors/domain-error.d.ts.map +1 -1
  91. package/dist/domain/errors/domain-error.js +2 -1
  92. package/dist/domain/errors/domain-error.js.map +1 -1
  93. package/dist/domain/errors/factual-refusal.d.ts.map +1 -1
  94. package/dist/domain/errors/factual-refusal.js +3 -0
  95. package/dist/domain/errors/factual-refusal.js.map +1 -1
  96. package/dist/domain/errors/kit-codes.d.ts +2 -0
  97. package/dist/domain/errors/kit-codes.d.ts.map +1 -1
  98. package/dist/domain/errors/kit-codes.js +2 -0
  99. package/dist/domain/errors/kit-codes.js.map +1 -1
  100. package/dist/domain/event-id-of.d.ts +8 -0
  101. package/dist/domain/event-id-of.d.ts.map +1 -0
  102. package/dist/domain/event-id-of.js +10 -0
  103. package/dist/domain/event-id-of.js.map +1 -0
  104. package/dist/domain/event-rank.d.ts +8 -0
  105. package/dist/domain/event-rank.d.ts.map +1 -0
  106. package/dist/domain/event-rank.js +8 -0
  107. package/dist/domain/event-rank.js.map +1 -0
  108. package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts +0 -1
  109. package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts.map +1 -1
  110. package/dist/domain/event-sourcing/event-sourced-aggregate.js +4 -8
  111. package/dist/domain/event-sourcing/event-sourced-aggregate.js.map +1 -1
  112. package/dist/domain/named-domain-event.d.ts +11 -4
  113. package/dist/domain/named-domain-event.d.ts.map +1 -1
  114. package/dist/domain/named-domain-event.js +14 -3
  115. package/dist/domain/named-domain-event.js.map +1 -1
  116. package/dist/domain/rank-of.d.ts +8 -0
  117. package/dist/domain/rank-of.d.ts.map +1 -0
  118. package/dist/domain/rank-of.js +14 -0
  119. package/dist/domain/rank-of.js.map +1 -0
  120. package/dist/domain/ranked.d.ts +10 -0
  121. package/dist/domain/ranked.d.ts.map +1 -0
  122. package/dist/domain/ranked.js +19 -0
  123. package/dist/domain/ranked.js.map +1 -0
  124. package/dist/domain/result/unwrap.d.ts +1 -0
  125. package/dist/domain/result/unwrap.d.ts.map +1 -1
  126. package/dist/domain/result/unwrap.js +4 -1
  127. package/dist/domain/result/unwrap.js.map +1 -1
  128. package/dist/domain/state-machine/state-machine.d.ts +4 -0
  129. package/dist/domain/state-machine/state-machine.d.ts.map +1 -1
  130. package/dist/domain/state-machine/state-machine.js +14 -4
  131. package/dist/domain/state-machine/state-machine.js.map +1 -1
  132. package/dist/domain/value-object/frozen-copy.d.ts +8 -0
  133. package/dist/domain/value-object/frozen-copy.d.ts.map +1 -0
  134. package/dist/domain/value-object/frozen-copy.js +34 -0
  135. package/dist/domain/value-object/frozen-copy.js.map +1 -0
  136. package/dist/domain/value-object/index.d.ts +2 -0
  137. package/dist/domain/value-object/index.d.ts.map +1 -0
  138. package/dist/domain/value-object/index.js +2 -0
  139. package/dist/domain/value-object/index.js.map +1 -0
  140. package/dist/domain/value-object/is-plain-record.d.ts +3 -0
  141. package/dist/domain/value-object/is-plain-record.d.ts.map +1 -0
  142. package/dist/domain/value-object/is-plain-record.js +9 -0
  143. package/dist/domain/value-object/is-plain-record.js.map +1 -0
  144. package/dist/domain/value-object/same-value.d.ts +8 -0
  145. package/dist/domain/value-object/same-value.d.ts.map +1 -0
  146. package/dist/domain/value-object/same-value.js +43 -0
  147. package/dist/domain/value-object/same-value.js.map +1 -0
  148. package/dist/domain/value-object/value-object.d.ts +28 -0
  149. package/dist/domain/value-object/value-object.d.ts.map +1 -0
  150. package/dist/domain/value-object/value-object.js +24 -0
  151. package/dist/domain/value-object/value-object.js.map +1 -0
  152. package/dist/index.d.ts +9 -12
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.js +9 -12
  155. package/dist/index.js.map +1 -1
  156. package/dist/infrastructure/aggregates/aggregate-mapper.d.ts +21 -0
  157. package/dist/infrastructure/aggregates/aggregate-mapper.d.ts.map +1 -0
  158. package/dist/infrastructure/aggregates/aggregate-mapper.js +18 -0
  159. package/dist/infrastructure/aggregates/aggregate-mapper.js.map +1 -0
  160. package/dist/infrastructure/aggregates/aggregate-save.d.ts +22 -0
  161. package/dist/infrastructure/aggregates/aggregate-save.d.ts.map +1 -0
  162. package/dist/infrastructure/aggregates/aggregate-save.js +2 -0
  163. package/dist/infrastructure/aggregates/aggregate-save.js.map +1 -0
  164. package/dist/infrastructure/aggregates/as-found.d.ts +8 -0
  165. package/dist/infrastructure/aggregates/as-found.d.ts.map +1 -0
  166. package/dist/infrastructure/aggregates/as-found.js +2 -0
  167. package/dist/infrastructure/aggregates/as-found.js.map +1 -0
  168. package/dist/infrastructure/aggregates/give-back.d.ts +9 -0
  169. package/dist/infrastructure/aggregates/give-back.d.ts.map +1 -0
  170. package/dist/infrastructure/aggregates/give-back.js +13 -0
  171. package/dist/infrastructure/aggregates/give-back.js.map +1 -0
  172. package/dist/infrastructure/aggregates/index.d.ts +7 -0
  173. package/dist/infrastructure/aggregates/index.d.ts.map +1 -0
  174. package/dist/infrastructure/aggregates/index.js +7 -0
  175. package/dist/infrastructure/aggregates/index.js.map +1 -0
  176. package/dist/infrastructure/aggregates/loaded-at.d.ts +8 -0
  177. package/dist/infrastructure/aggregates/loaded-at.d.ts.map +1 -0
  178. package/dist/infrastructure/aggregates/loaded-at.js +12 -0
  179. package/dist/infrastructure/aggregates/loaded-at.js.map +1 -0
  180. package/dist/infrastructure/aggregates/noted-as-found.d.ts +8 -0
  181. package/dist/infrastructure/aggregates/noted-as-found.d.ts.map +1 -0
  182. package/dist/infrastructure/aggregates/noted-as-found.js +15 -0
  183. package/dist/infrastructure/aggregates/noted-as-found.js.map +1 -0
  184. package/dist/infrastructure/aggregates/recorded-events-of.d.ts +4 -0
  185. package/dist/infrastructure/aggregates/recorded-events-of.d.ts.map +1 -0
  186. package/dist/infrastructure/aggregates/recorded-events-of.js +6 -0
  187. package/dist/infrastructure/aggregates/recorded-events-of.js.map +1 -0
  188. package/dist/infrastructure/aggregates/save-aggregate-row.d.ts +23 -0
  189. package/dist/infrastructure/aggregates/save-aggregate-row.d.ts.map +1 -0
  190. package/dist/infrastructure/aggregates/save-aggregate-row.js +17 -0
  191. package/dist/infrastructure/aggregates/save-aggregate-row.js.map +1 -0
  192. package/dist/infrastructure/aggregates/stored-at.d.ts +7 -0
  193. package/dist/infrastructure/aggregates/stored-at.d.ts.map +1 -0
  194. package/dist/infrastructure/aggregates/stored-at.js +14 -0
  195. package/dist/infrastructure/aggregates/stored-at.js.map +1 -0
  196. package/dist/infrastructure/aggregates/take-recorded-events.d.ts +9 -0
  197. package/dist/infrastructure/aggregates/take-recorded-events.d.ts.map +1 -0
  198. package/dist/infrastructure/aggregates/take-recorded-events.js +17 -0
  199. package/dist/infrastructure/aggregates/take-recorded-events.js.map +1 -0
  200. package/dist/infrastructure/aggregates/unstored-events-of.d.ts +4 -0
  201. package/dist/infrastructure/aggregates/unstored-events-of.d.ts.map +1 -0
  202. package/dist/infrastructure/aggregates/unstored-events-of.js +7 -0
  203. package/dist/infrastructure/aggregates/unstored-events-of.js.map +1 -0
  204. package/dist/infrastructure/clock/fixed-clock.d.ts +2 -1
  205. package/dist/infrastructure/clock/fixed-clock.d.ts.map +1 -1
  206. package/dist/infrastructure/clock/fixed-clock.js +5 -4
  207. package/dist/infrastructure/clock/fixed-clock.js.map +1 -1
  208. package/dist/infrastructure/context/scoped-actor-context.d.ts.map +1 -1
  209. package/dist/infrastructure/context/scoped-actor-context.js +2 -6
  210. package/dist/infrastructure/context/scoped-actor-context.js.map +1 -1
  211. package/dist/infrastructure/domain-events/announce-domain-events.d.ts +1 -1
  212. package/dist/infrastructure/domain-events/announce-domain-events.js +1 -1
  213. package/dist/infrastructure/domain-events/dispatching-on-save.d.ts +1 -1
  214. package/dist/infrastructure/domain-events/dispatching-on-save.d.ts.map +1 -1
  215. package/dist/infrastructure/domain-events/dispatching-on-save.js +3 -2
  216. package/dist/infrastructure/domain-events/dispatching-on-save.js.map +1 -1
  217. package/dist/infrastructure/domain-events/index.d.ts +13 -0
  218. package/dist/infrastructure/domain-events/index.d.ts.map +1 -0
  219. package/dist/infrastructure/domain-events/index.js +13 -0
  220. package/dist/infrastructure/domain-events/index.js.map +1 -0
  221. package/dist/infrastructure/domain-events/recorded-aggregates.d.ts +2 -5
  222. package/dist/infrastructure/domain-events/recorded-aggregates.d.ts.map +1 -1
  223. package/dist/infrastructure/domain-events/recorded-aggregates.js +3 -5
  224. package/dist/infrastructure/domain-events/recorded-aggregates.js.map +1 -1
  225. package/dist/infrastructure/domain-events/unit-of-work-aborted-error.d.ts +10 -0
  226. package/dist/infrastructure/domain-events/unit-of-work-aborted-error.d.ts.map +1 -0
  227. package/dist/infrastructure/domain-events/unit-of-work-aborted-error.js +13 -0
  228. package/dist/infrastructure/domain-events/unit-of-work-aborted-error.js.map +1 -0
  229. package/dist/infrastructure/domain-events/unit-of-work-over.d.ts +43 -0
  230. package/dist/infrastructure/domain-events/unit-of-work-over.d.ts.map +1 -0
  231. package/dist/infrastructure/domain-events/unit-of-work-over.js +132 -0
  232. package/dist/infrastructure/domain-events/unit-of-work-over.js.map +1 -0
  233. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts +9 -1
  234. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts.map +1 -1
  235. package/dist/infrastructure/domain-events/unit-of-work-scope.js.map +1 -1
  236. package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.d.ts +8 -0
  237. package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.d.ts.map +1 -0
  238. package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.js +11 -0
  239. package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.js.map +1 -0
  240. package/dist/infrastructure/domain-events/when-committed.d.ts.map +1 -1
  241. package/dist/infrastructure/domain-events/when-committed.js +2 -9
  242. package/dist/infrastructure/domain-events/when-committed.js.map +1 -1
  243. package/dist/infrastructure/event-sourcing/aggregate-id-of.d.ts +4 -0
  244. package/dist/infrastructure/event-sourcing/aggregate-id-of.d.ts.map +1 -0
  245. package/dist/infrastructure/event-sourcing/aggregate-id-of.js +6 -0
  246. package/dist/infrastructure/event-sourcing/aggregate-id-of.js.map +1 -0
  247. package/dist/infrastructure/event-sourcing/event-serializer.d.ts +3 -4
  248. package/dist/infrastructure/event-sourcing/event-serializer.d.ts.map +1 -1
  249. package/dist/infrastructure/event-sourcing/event-serializer.js +10 -12
  250. package/dist/infrastructure/event-sourcing/event-serializer.js.map +1 -1
  251. package/dist/infrastructure/event-sourcing/event-store-personal-data-export.d.ts.map +1 -1
  252. package/dist/infrastructure/event-sourcing/event-store-personal-data-export.js +1 -5
  253. package/dist/infrastructure/event-sourcing/event-store-personal-data-export.js.map +1 -1
  254. package/dist/infrastructure/events/idempotent.d.ts.map +1 -1
  255. package/dist/infrastructure/events/idempotent.js +9 -3
  256. package/dist/infrastructure/events/idempotent.js.map +1 -1
  257. package/dist/infrastructure/in-memory/as-json-carries.d.ts +9 -0
  258. package/dist/infrastructure/in-memory/as-json-carries.d.ts.map +1 -0
  259. package/dist/infrastructure/in-memory/as-json-carries.js +12 -0
  260. package/dist/infrastructure/in-memory/as-json-carries.js.map +1 -0
  261. package/dist/infrastructure/in-memory/composite-key.d.ts +6 -0
  262. package/dist/infrastructure/in-memory/composite-key.d.ts.map +1 -0
  263. package/dist/infrastructure/in-memory/composite-key.js +8 -0
  264. package/dist/infrastructure/in-memory/composite-key.js.map +1 -0
  265. package/dist/infrastructure/in-memory/in-memory-cache.d.ts +3 -1
  266. package/dist/infrastructure/in-memory/in-memory-cache.d.ts.map +1 -1
  267. package/dist/infrastructure/in-memory/in-memory-cache.js +7 -3
  268. package/dist/infrastructure/in-memory/in-memory-cache.js.map +1 -1
  269. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts +0 -1
  270. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts.map +1 -1
  271. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js +2 -9
  272. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js.map +1 -1
  273. package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts +7 -14
  274. package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts.map +1 -1
  275. package/dist/infrastructure/in-memory/in-memory-event-bus.js +17 -9
  276. package/dist/infrastructure/in-memory/in-memory-event-bus.js.map +1 -1
  277. package/dist/infrastructure/in-memory/in-memory-event-store.d.ts +1 -0
  278. package/dist/infrastructure/in-memory/in-memory-event-store.d.ts.map +1 -1
  279. package/dist/infrastructure/in-memory/in-memory-event-store.js +11 -10
  280. package/dist/infrastructure/in-memory/in-memory-event-store.js.map +1 -1
  281. package/dist/infrastructure/in-memory/in-memory-process-store.d.ts.map +1 -1
  282. package/dist/infrastructure/in-memory/in-memory-process-store.js +4 -6
  283. package/dist/infrastructure/in-memory/in-memory-process-store.js.map +1 -1
  284. package/dist/infrastructure/in-memory/in-memory-processed-event-store.d.ts.map +1 -1
  285. package/dist/infrastructure/in-memory/in-memory-processed-event-store.js +3 -6
  286. package/dist/infrastructure/in-memory/in-memory-processed-event-store.js.map +1 -1
  287. package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts +4 -2
  288. package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts.map +1 -1
  289. package/dist/infrastructure/in-memory/in-memory-unit-of-work.js +6 -4
  290. package/dist/infrastructure/in-memory/in-memory-unit-of-work.js.map +1 -1
  291. package/dist/infrastructure/in-memory/in-process-bus.d.ts +1 -0
  292. package/dist/infrastructure/in-memory/in-process-bus.d.ts.map +1 -1
  293. package/dist/infrastructure/in-memory/in-process-bus.js +4 -3
  294. package/dist/infrastructure/in-memory/in-process-bus.js.map +1 -1
  295. package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts +5 -5
  296. package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts.map +1 -1
  297. package/dist/infrastructure/in-memory/unit-of-work-middleware.js +13 -4
  298. package/dist/infrastructure/in-memory/unit-of-work-middleware.js.map +1 -1
  299. package/package.json +1 -1
  300. package/dist/domain/event-sourcing/unstored-events.d.ts +0 -8
  301. package/dist/domain/event-sourcing/unstored-events.d.ts.map +0 -1
  302. package/dist/domain/event-sourcing/unstored-events.js +0 -7
  303. package/dist/domain/event-sourcing/unstored-events.js.map +0 -1
  304. package/dist/domain/value-object.d.ts +0 -12
  305. package/dist/domain/value-object.d.ts.map +0 -1
  306. package/dist/domain/value-object.js +0 -40
  307. package/dist/domain/value-object.js.map +0 -1
  308. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts +0 -25
  309. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts.map +0 -1
  310. package/dist/infrastructure/domain-events/within-unit-of-work.js +0 -85
  311. package/dist/infrastructure/domain-events/within-unit-of-work.js.map +0 -1
  312. package/dist/infrastructure/event-sourcing/stored-origins.d.ts +0 -5
  313. package/dist/infrastructure/event-sourcing/stored-origins.d.ts.map +0 -1
  314. package/dist/infrastructure/event-sourcing/stored-origins.js +0 -3
  315. package/dist/infrastructure/event-sourcing/stored-origins.js.map +0 -1
  316. package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +0 -11
  317. package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +0 -1
  318. package/dist/infrastructure/event-sourcing/stored-stamp-of.js +0 -15
  319. package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +0 -1
@@ -1,9 +1,11 @@
1
1
  import type { UnitOfWork } from '../../application/ports/unit-of-work.js';
2
2
  /**
3
- * No transaction to open: runs the work as is, and nothing is undone when it fails. The domain
4
- * events are dispatched at its end all the same. Real adapters wrap a DB transaction.
3
+ * No transaction to open: runs the work as is, and nothing is undone when it fails, the version
4
+ * of the aggregates it saved no more than what the fakes stored. The domain events are dispatched
5
+ * at its end all the same. Real adapters wrap a DB transaction.
5
6
  */
6
7
  export declare class InMemoryUnitOfWork implements UnitOfWork {
8
+ private readonly unitOfWork;
7
9
  run<T>(work: () => Promise<T>): Promise<T>;
8
10
  }
9
11
  //# sourceMappingURL=in-memory-unit-of-work.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-unit-of-work.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-unit-of-work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGvE;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,UAAU;IACnD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzC;CACF"}
1
+ {"version":3,"file":"in-memory-unit-of-work.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-unit-of-work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGvE;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,UAAU;IACnD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0D;IAErF,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzC;CACF"}
@@ -1,11 +1,13 @@
1
- import { withinUnitOfWork } from '../domain-events/within-unit-of-work.js';
1
+ import { unitOfWorkOver } from '../domain-events/unit-of-work-over.js';
2
2
  /**
3
- * No transaction to open: runs the work as is, and nothing is undone when it fails. The domain
4
- * events are dispatched at its end all the same. Real adapters wrap a DB transaction.
3
+ * No transaction to open: runs the work as is, and nothing is undone when it fails, the version
4
+ * of the aggregates it saved no more than what the fakes stored. The domain events are dispatched
5
+ * at its end all the same. Real adapters wrap a DB transaction.
5
6
  */
6
7
  export class InMemoryUnitOfWork {
8
+ unitOfWork = unitOfWorkOver((work) => work(), { rollsBack: false });
7
9
  run(work) {
8
- return withinUnitOfWork(work, (scoped) => scoped());
10
+ return this.unitOfWork.run(work);
9
11
  }
10
12
  }
11
13
  //# sourceMappingURL=in-memory-unit-of-work.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-unit-of-work.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-unit-of-work.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,GAAG,CAAI,IAAsB;QAC3B,OAAO,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;CACF"}
1
+ {"version":3,"file":"in-memory-unit-of-work.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-memory-unit-of-work.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACZ,UAAU,GAAG,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAErF,GAAG,CAAI,IAAsB;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -20,6 +20,7 @@ export declare class InProcessBus {
20
20
  */
21
21
  aroundHandler(middleware: BusMiddleware): this;
22
22
  protected add(type: MessageType<Message>, handler: AnyHandler, registration?: HandlerRegistration): void;
23
+ /** Answers a promise whatever fails: a handler that throws before its first `await` rejects, as one that throws after it. */
23
24
  protected dispatch<M extends Message>(message: M): Promise<ResultOf<M>>;
24
25
  }
25
26
  //# sourceMappingURL=in-process-bus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-process-bus.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-process-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAGhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,YAAY;IASX,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IAEvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IAEnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAEtD,YAA6B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAI;IAE1D,GAAG,CAAC,UAAU,EAAE,aAAa,GA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C,UAAU,EAAE,aAAa,GAAG,IAAI,CAI7C;IAED,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,GAAE,mBAAwB,GAAG,IAAI,CAU3G;IAED,6HAA6H;IAC7H,UAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAiB5E;CACF"}
@@ -31,15 +31,16 @@ export class InProcessBus {
31
31
  this.contexts.set(type, registration.context);
32
32
  }
33
33
  }
34
- dispatch(message) {
34
+ /** Answers a promise whatever fails: a handler that throws before its first `await` rejects, as one that throws after it. */
35
+ async dispatch(message) {
35
36
  const context = this.contexts.get(message.constructor);
36
37
  const name = message.constructor.name;
37
38
  const info = { kind: this.kind, name, ...(context === undefined ? {} : { context }) };
38
39
  const handler = this.handlers.get(message.constructor);
39
40
  if (!handler) {
40
- return Promise.reject(new HandlerNotFoundError(info));
41
+ throw new HandlerNotFoundError(info);
41
42
  }
42
- const run = [...this.middlewares, ...this.aroundHandlers].reduceRight((next, middleware) => () => middleware(message, next, info), () => handler.execute(message));
43
+ const run = [...this.middlewares, ...this.aroundHandlers].reduceRight((next, middleware) => () => middleware(message, next, info), async () => handler.execute(message));
43
44
  // eslint-disable-next-line ddd-ts-kit/clean-no-escape-hatch -- handlers of every message type share one map and middlewares answer unknown: the link between a message and its result is only known to register()
44
45
  return run();
45
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"in-process-bus.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/in-process-bus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAQ3F,MAAM,OAAO,YAAY;IASM,IAAI;IARhB,QAAQ,GAAG,IAAI,GAAG,EAAuB,C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WAAW,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,WAAW,CACnE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAC3D,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CACrC,CAAC;QAEF,kNAAkN;QAClN,OAAO,GAAG,EAA0B,CAAC;IACvC,CAAC;CACF"}
@@ -1,11 +1,11 @@
1
1
  import type { BusMiddleware } from '../../application/messaging/bus-middleware.js';
2
+ import type { UnitOfWork } from '../../application/ports/unit-of-work.js';
2
3
  /**
3
4
  * Runs every command inside one unit of work. Queries are left alone: they do not write. The
4
5
  * domain events its saves recorded are dispatched once the handler has returned, before the
5
- * commit, whatever the unit of work given: one that does not call `withinUnitOfWork` itself is
6
- * covered here. A command sent from inside a unit of work joins it.
6
+ * commit: the unit of work does it, the one every adapter builds on `unitOfWorkOver`, and one
7
+ * that does not is refused before the handler runs (`UnscopedUnitOfWorkError`). A command sent
8
+ * from inside a unit of work joins it.
7
9
  */
8
- export declare function unitOfWorkMiddleware(unitOfWork: {
9
- run<T>(work: () => Promise<T>): Promise<T>;
10
- }): BusMiddleware;
10
+ export declare function unitOfWorkMiddleware(unitOfWork: Pick<UnitOfWork, 'run'>): BusMiddleware;
11
11
  //# sourceMappingURL=unit-of-work-middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unit-of-work-middleware.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/unit-of-work-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAGhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE;IAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,aAAa,CAG9G"}
1
+ {"version":3,"file":"unit-of-work-middleware.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/unit-of-work-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAIvE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,aAAa,CAEvF"}
@@ -1,11 +1,20 @@
1
- import { withinUnitOfWork } from '../domain-events/within-unit-of-work.js';
1
+ import { unitOfWorkStage } from '../domain-events/unit-of-work-stage.js';
2
+ import { UnscopedUnitOfWorkError } from '../domain-events/unscoped-unit-of-work-error.js';
2
3
  /**
3
4
  * Runs every command inside one unit of work. Queries are left alone: they do not write. The
4
5
  * domain events its saves recorded are dispatched once the handler has returned, before the
5
- * commit, whatever the unit of work given: one that does not call `withinUnitOfWork` itself is
6
- * covered here. A command sent from inside a unit of work joins it.
6
+ * commit: the unit of work does it, the one every adapter builds on `unitOfWorkOver`, and one
7
+ * that does not is refused before the handler runs (`UnscopedUnitOfWorkError`). A command sent
8
+ * from inside a unit of work joins it.
7
9
  */
8
10
  export function unitOfWorkMiddleware(unitOfWork) {
9
- return (_message, next, info) => info.kind === 'command' ? withinUnitOfWork(next, (scoped) => unitOfWork.run(scoped)) : next();
11
+ return (_message, next, info) => (info.kind === 'command' ? unitOfWork.run(() => scoped(next)) : next());
12
+ }
13
+ async function scoped(next) {
14
+ const stage = unitOfWorkStage();
15
+ if (stage !== 'open' && stage !== 'before-commit') {
16
+ throw new UnscopedUnitOfWorkError();
17
+ }
18
+ return next();
10
19
  }
11
20
  //# sourceMappingURL=unit-of-work-middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unit-of-work-middleware.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/unit-of-work-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA0D;IAC7F,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAC9B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAClG,CAAC"}
1
+ {"version":3,"file":"unit-of-work-middleware.js","sourceRoot":"","sources":["../../../src/infrastructure/in-memory/unit-of-work-middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAmC;IACtE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3G,CAAC;AAED,KAAK,UAAU,MAAM,CAAI,IAAsB;IAC7C,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,eAAe,EAAE,CAAC;QAClD,MAAM,IAAI,uBAAuB,EAAE,CAAC;IACtC,CAAC;IAED,OAAO,IAAI,EAAE,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/kernel",
3
- "version": "0.114.1",
3
+ "version": "0.115.0",
4
4
  "description": "Framework-agnostic Domain-Driven Design (DDD) building blocks for TypeScript: aggregates, entities, value objects, domain events, CQRS command and query buses, unit of work and application ports, with an in-memory event bus.",
5
5
  "keywords": [
6
6
  "ddd",
@@ -1,8 +0,0 @@
1
- import type { DomainEvent } from '../domain-event.js';
2
- /**
3
- * The events an event-sourced aggregate recorded since it was loaded or last stored, kept out of
4
- * the aggregate so that nothing public exposes them: the aggregate adds, `appendChanges` hands
5
- * them to the store and clears them.
6
- */
7
- export declare const unstoredEvents: WeakMap<object, DomainEvent[]>;
8
- //# sourceMappingURL=unstored-events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unstored-events.d.ts","sourceRoot":"","sources":["../../../src/domain/event-sourcing/unstored-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,cAAc,gCAAuC,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * The events an event-sourced aggregate recorded since it was loaded or last stored, kept out of
3
- * the aggregate so that nothing public exposes them: the aggregate adds, `appendChanges` hands
4
- * them to the store and clears them.
5
- */
6
- export const unstoredEvents = new WeakMap();
7
- //# sourceMappingURL=unstored-events.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unstored-events.js","sourceRoot":"","sources":["../../../src/domain/event-sourcing/unstored-events.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,EAAyB,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Immutable, compared by value, valid at construction. Subclass with a private constructor and
3
- * a `create` factory that validates, then returns the value object or throws the refusal of its
4
- * concept (or returns a `Result`, in a project that says `"stack.valueObjects": "result"`).
5
- */
6
- export declare abstract class ValueObject<Props extends Record<string, unknown>> {
7
- protected readonly props: Readonly<Props>;
8
- protected constructor(props: Props);
9
- equals(other: ValueObject<Props> | undefined | null): boolean;
10
- toJSON(): Props;
11
- }
12
- //# sourceMappingURL=value-object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"value-object.d.ts","sourceRoot":"","sources":["../../src/domain/value-object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,8BAAsB,WAAW,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,SAAS,aAAa,KAAK,EAAE,KAAK,EAEjC;IAED,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAM5D;IAED,MAAM,IAAI,KAAK,CAEd;CACF"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Immutable, compared by value, valid at construction. Subclass with a private constructor and
3
- * a `create` factory that validates, then returns the value object or throws the refusal of its
4
- * concept (or returns a `Result`, in a project that says `"stack.valueObjects": "result"`).
5
- */
6
- export class ValueObject {
7
- props;
8
- constructor(props) {
9
- this.props = Object.freeze({ ...props });
10
- }
11
- equals(other) {
12
- if (other === undefined || other === null || other.constructor !== this.constructor) {
13
- return false;
14
- }
15
- return structurallyEqual(this.props, other.props);
16
- }
17
- toJSON() {
18
- return this.props;
19
- }
20
- }
21
- function structurallyEqual(a, b) {
22
- if (Object.is(a, b)) {
23
- return true;
24
- }
25
- if (a instanceof Date && b instanceof Date) {
26
- return a.getTime() === b.getTime();
27
- }
28
- if (Array.isArray(a) && Array.isArray(b)) {
29
- return a.length === b.length && a.every((item, i) => structurallyEqual(item, b[i]));
30
- }
31
- if (isRecord(a) && isRecord(b)) {
32
- const keys = Object.keys(a);
33
- return keys.length === Object.keys(b).length && keys.every((key) => key in b && structurallyEqual(a[key], b[key]));
34
- }
35
- return false;
36
- }
37
- function isRecord(value) {
38
- return typeof value === 'object' && value !== null;
39
- }
40
- //# sourceMappingURL=value-object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"value-object.js","sourceRoot":"","sources":["../../src/domain/value-object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAgB,WAAW;IACZ,KAAK,CAAkB;IAE1C,YAAsB,KAAY;QAChC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,KAA4C;QACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YACpF,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,CAAU,EAAE,CAAU;IAC/C,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QAC3C,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * What every `UnitOfWork.run` is made of. `transaction` runs what it is given atomically: it
3
- * begins, calls it, and commits when it resolved or rolls back when it rejected.
4
- *
5
- * The domain events of the aggregates saved by `work` wait in the scope of this unit of work,
6
- * in recording order across the saves. Once `work` has returned they are dispatched, still
7
- * inside `transaction`: the handlers see every save, and what they save or append to the outbox
8
- * commits with the rest. A handler that fails, like `work` that fails, rejects the whole: the
9
- * transaction rolls back, the waiting events are dropped and never come back on the aggregates.
10
- * The steps handed to `atCommit` are applied last, still inside `transaction`; when it rejects,
11
- * those applied are undone. Once `transaction` has resolved, and only then, the `after-commit`
12
- * handlers run, then the work handed to `afterCommit`.
13
- *
14
- * A deadlock or a serialization failure the database raised anywhere in the transaction, on the
15
- * statement it chose, rejects the outermost unit of work as a `TransactionConflictError`, a
16
- * `ConcurrencyError` whose `cause` is the error of the driver: the caller runs it again. A
17
- * transaction its ORM could not start in time, the pool being busy, or ended for running too
18
- * long rejects it as a `TransactionTimeoutError` (`SERVICE_UNAVAILABLE`), the same way.
19
- *
20
- * Called inside a unit of work already running on the same asynchronous call chain it joins it:
21
- * `transaction(work)` and nothing else, so one dispatch, at the end of the outermost. Two
22
- * concurrent calls never share a scope.
23
- */
24
- export declare function withinUnitOfWork<T>(work: () => Promise<T>, transaction: (work: () => Promise<T>) => Promise<T>): Promise<T>;
25
- //# sourceMappingURL=within-unit-of-work.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"within-unit-of-work.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/within-unit-of-work.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAClD,OAAO,CAAC,CAAC,CAAC,CAsBZ"}
@@ -1,85 +0,0 @@
1
- import { TransactionConflictError } from '../../domain/errors/transaction-conflict-error.js';
2
- import { isTransactionConflict } from '../persistence/is-transaction-conflict.js';
3
- import { isTransactionTimeout } from '../persistence/is-transaction-timeout.js';
4
- import { TransactionTimeoutError } from '../persistence/transaction-timeout-error.js';
5
- import { dispatchAfterCommit } from './dispatch-after-commit.js';
6
- import { dispatchBeforeCommit } from './dispatch-before-commit.js';
7
- import { unitOfWorkScope } from './unit-of-work-scope.js';
8
- /**
9
- * What every `UnitOfWork.run` is made of. `transaction` runs what it is given atomically: it
10
- * begins, calls it, and commits when it resolved or rolls back when it rejected.
11
- *
12
- * The domain events of the aggregates saved by `work` wait in the scope of this unit of work,
13
- * in recording order across the saves. Once `work` has returned they are dispatched, still
14
- * inside `transaction`: the handlers see every save, and what they save or append to the outbox
15
- * commits with the rest. A handler that fails, like `work` that fails, rejects the whole: the
16
- * transaction rolls back, the waiting events are dropped and never come back on the aggregates.
17
- * The steps handed to `atCommit` are applied last, still inside `transaction`; when it rejects,
18
- * those applied are undone. Once `transaction` has resolved, and only then, the `after-commit`
19
- * handlers run, then the work handed to `afterCommit`.
20
- *
21
- * A deadlock or a serialization failure the database raised anywhere in the transaction, on the
22
- * statement it chose, rejects the outermost unit of work as a `TransactionConflictError`, a
23
- * `ConcurrencyError` whose `cause` is the error of the driver: the caller runs it again. A
24
- * transaction its ORM could not start in time, the pool being busy, or ended for running too
25
- * long rejects it as a `TransactionTimeoutError` (`SERVICE_UNAVAILABLE`), the same way.
26
- *
27
- * Called inside a unit of work already running on the same asynchronous call chain it joins it:
28
- * `transaction(work)` and nothing else, so one dispatch, at the end of the outermost. Two
29
- * concurrent calls never share a scope.
30
- */
31
- export async function withinUnitOfWork(work, transaction) {
32
- if (isRunning(unitOfWorkScope.getStore())) {
33
- return transaction(work);
34
- }
35
- const scope = openScope();
36
- const applied = [];
37
- const result = await unitOfWorkScope
38
- .run(scope, () => transaction(() => thenDispatched(work, scope, applied)))
39
- .catch(async (error) => {
40
- await undone(applied);
41
- throw translated(error);
42
- })
43
- .finally(() => {
44
- scope.stage = 'closed';
45
- scope.queue.length = 0;
46
- });
47
- await afterTheCommit(scope);
48
- return result;
49
- }
50
- /** What the database said of the transaction, in the words of the kernel; any other failure as it is. */
51
- function translated(error) {
52
- if (isTransactionConflict(error)) {
53
- return new TransactionConflictError(error);
54
- }
55
- return isTransactionTimeout(error) ? new TransactionTimeoutError(error) : error;
56
- }
57
- function isRunning(scope) {
58
- return scope?.kind === 'unit-of-work' && (scope.stage === 'open' || scope.stage === 'before-commit');
59
- }
60
- function openScope() {
61
- return { kind: 'unit-of-work', stage: 'open', queue: [], dispatched: [], committed: [], atCommit: [] };
62
- }
63
- async function thenDispatched(work, scope, applied) {
64
- const result = await work();
65
- await dispatchBeforeCommit(scope);
66
- for (const step of scope.atCommit ?? []) {
67
- await step.apply();
68
- applied.push(step);
69
- }
70
- return result;
71
- }
72
- /** Newest first; an undo that fails reported itself, and the others still run. */
73
- async function undone(applied) {
74
- for (const step of [...applied].reverse()) {
75
- await step.undo().catch(() => undefined);
76
- }
77
- }
78
- /** The `after-commit` handlers, then the work handed to `afterCommit`; a rejection is dropped, the work reported its own. */
79
- async function afterTheCommit(scope) {
80
- await dispatchAfterCommit(scope);
81
- for (const work of scope.committed ?? []) {
82
- await work().catch(() => undefined);
83
- }
84
- }
85
- //# sourceMappingURL=within-unit-of-work.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"within-unit-of-work.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/within-unit-of-work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAwB,MAAM,sBAAsB,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAsB,EACtB,WAAmD;IAEnD,IAAI,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;QAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,eAAe;SACjC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;SACzE,KAAK,CAAC,KAAK,EAAE,KAAc,EAAE,EAAE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MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kFAAkF;AAClF,KAAK,UAAU,MAAM,CAAC,OAA8B;IAClD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,6HAA6H;AAC7H,KAAK,UAAU,cAAc,CAAC,KAAsB;IAClD,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { StoredEvent } from '../../application/event-sourcing/stored-event.js';
2
- import type { DomainEvent } from '../../domain/domain-event.js';
3
- /** The stored event each domain event was read from, for `storedStampOf`. */
4
- export declare const storedOrigins: WeakMap<DomainEvent, StoredEvent>;
5
- //# sourceMappingURL=stored-origins.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stored-origins.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/stored-origins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,6EAA6E;AAC7E,eAAO,MAAM,aAAa,mCAA0C,CAAC"}
@@ -1,3 +0,0 @@
1
- /** The stored event each domain event was read from, for `storedStampOf`. */
2
- export const storedOrigins = new WeakMap();
3
- //# sourceMappingURL=stored-origins.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stored-origins.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/stored-origins.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,EAA4B,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { EventStamp } from '../../application/read-model/event-stamp.js';
2
- import type { DomainEvent } from '../../domain/domain-event.js';
3
- /**
4
- * The stamp of a domain event read from an event store, for the row of a read model it changes:
5
- * the id of the stored event, its instant and its version in its stream, so that the rows of one
6
- * stream are ordered by the stream and not by clocks. `undefined` for an event that was not read
7
- * from a store (dispatched by a save): a projection fed both ways falls back to `stampOf`,
8
- * and its keys should then see one kind of stamp each, since two kinds are ordered by their instants.
9
- */
10
- export declare function storedStampOf(event: DomainEvent): EventStamp | undefined;
11
- //# sourceMappingURL=stored-stamp-of.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stored-stamp-of.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/stored-stamp-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG7D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAMxE"}
@@ -1,15 +0,0 @@
1
- import { storedOrigins } from './stored-origins.js';
2
- /**
3
- * The stamp of a domain event read from an event store, for the row of a read model it changes:
4
- * the id of the stored event, its instant and its version in its stream, so that the rows of one
5
- * stream are ordered by the stream and not by clocks. `undefined` for an event that was not read
6
- * from a store (dispatched by a save): a projection fed both ways falls back to `stampOf`,
7
- * and its keys should then see one kind of stamp each, since two kinds are ordered by their instants.
8
- */
9
- export function storedStampOf(event) {
10
- const stored = storedOrigins.get(event);
11
- return stored === undefined
12
- ? undefined
13
- : { eventId: stored.id, occurredAt: stored.occurredAt, version: stored.version };
14
- }
15
- //# sourceMappingURL=stored-stamp-of.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stored-stamp-of.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/stored-stamp-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAkB;IAC9C,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACrF,CAAC"}