@ddd-ts-kit/kernel 0.113.2 → 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 +70 -62
  2. package/README.md +65 -57
  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 +4 -4
  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,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,OA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AA6H;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"}