@ddd-ts-kit/kernel 0.0.0-stage → 0.1.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 (1530) hide show
  1. package/README.md +1086 -2
  2. package/dist/application/actor/actor-attribute.d.ts +2 -0
  3. package/dist/application/actor/actor-attribute.d.ts.map +1 -0
  4. package/dist/application/actor/actor-attribute.js +2 -0
  5. package/dist/application/actor/actor-attribute.js.map +1 -0
  6. package/dist/application/actor/actor-extensions.d.ts +12 -0
  7. package/dist/application/actor/actor-extensions.d.ts.map +1 -0
  8. package/dist/application/actor/actor-extensions.js +2 -0
  9. package/dist/application/actor/actor-extensions.js.map +1 -0
  10. package/dist/application/actor/actor-type.d.ts +2 -0
  11. package/dist/application/actor/actor-type.d.ts.map +1 -0
  12. package/dist/application/actor/actor-type.js +2 -0
  13. package/dist/application/actor/actor-type.js.map +1 -0
  14. package/dist/application/actor/actor.d.ts +15 -0
  15. package/dist/application/actor/actor.d.ts.map +1 -0
  16. package/dist/application/actor/actor.js +2 -0
  17. package/dist/application/actor/actor.js.map +1 -0
  18. package/dist/application/actor/actored.d.ts +6 -0
  19. package/dist/application/actor/actored.d.ts.map +1 -0
  20. package/dist/application/actor/actored.js +2 -0
  21. package/dist/application/actor/actored.js.map +1 -0
  22. package/dist/application/actor/anonymous-actor.d.ts +4 -0
  23. package/dist/application/actor/anonymous-actor.d.ts.map +1 -0
  24. package/dist/application/actor/anonymous-actor.js +11 -0
  25. package/dist/application/actor/anonymous-actor.js.map +1 -0
  26. package/dist/application/actor/authorized-command.d.ts +12 -0
  27. package/dist/application/actor/authorized-command.d.ts.map +1 -0
  28. package/dist/application/actor/authorized-command.js +13 -0
  29. package/dist/application/actor/authorized-command.js.map +1 -0
  30. package/dist/application/actor/authorized-query.d.ts +9 -0
  31. package/dist/application/actor/authorized-query.d.ts.map +1 -0
  32. package/dist/application/actor/authorized-query.js +10 -0
  33. package/dist/application/actor/authorized-query.js.map +1 -0
  34. package/dist/application/actor/is-actor.d.ts +3 -0
  35. package/dist/application/actor/is-actor.d.ts.map +1 -0
  36. package/dist/application/actor/is-actor.js +17 -0
  37. package/dist/application/actor/is-actor.js.map +1 -0
  38. package/dist/application/actor/is-actored.d.ts +3 -0
  39. package/dist/application/actor/is-actored.d.ts.map +1 -0
  40. package/dist/application/actor/is-actored.js +5 -0
  41. package/dist/application/actor/is-actored.js.map +1 -0
  42. package/dist/application/actor/is-anonymous.d.ts +3 -0
  43. package/dist/application/actor/is-anonymous.d.ts.map +1 -0
  44. package/dist/application/actor/is-anonymous.js +4 -0
  45. package/dist/application/actor/is-anonymous.js.map +1 -0
  46. package/dist/application/actor/is-authenticated.d.ts +3 -0
  47. package/dist/application/actor/is-authenticated.d.ts.map +1 -0
  48. package/dist/application/actor/is-authenticated.js +4 -0
  49. package/dist/application/actor/is-authenticated.js.map +1 -0
  50. package/dist/application/actor/is-system.d.ts +3 -0
  51. package/dist/application/actor/is-system.d.ts.map +1 -0
  52. package/dist/application/actor/is-system.js +4 -0
  53. package/dist/application/actor/is-system.js.map +1 -0
  54. package/dist/application/actor/known-actor-attributes.d.ts +7 -0
  55. package/dist/application/actor/known-actor-attributes.d.ts.map +1 -0
  56. package/dist/application/actor/known-actor-attributes.js +2 -0
  57. package/dist/application/actor/known-actor-attributes.js.map +1 -0
  58. package/dist/application/actor/no-current-actor-error.d.ts +5 -0
  59. package/dist/application/actor/no-current-actor-error.d.ts.map +1 -0
  60. package/dist/application/actor/no-current-actor-error.js +8 -0
  61. package/dist/application/actor/no-current-actor-error.js.map +1 -0
  62. package/dist/application/actor/system-actor.d.ts +4 -0
  63. package/dist/application/actor/system-actor.d.ts.map +1 -0
  64. package/dist/application/actor/system-actor.js +10 -0
  65. package/dist/application/actor/system-actor.js.map +1 -0
  66. package/dist/application/audit/audit-actor.d.ts +9 -0
  67. package/dist/application/audit/audit-actor.d.ts.map +1 -0
  68. package/dist/application/audit/audit-actor.js +2 -0
  69. package/dist/application/audit/audit-actor.js.map +1 -0
  70. package/dist/application/audit/audit-category.d.ts +3 -0
  71. package/dist/application/audit/audit-category.d.ts.map +1 -0
  72. package/dist/application/audit/audit-category.js +2 -0
  73. package/dist/application/audit/audit-category.js.map +1 -0
  74. package/dist/application/audit/audit-change.d.ts +4 -0
  75. package/dist/application/audit/audit-change.d.ts.map +1 -0
  76. package/dist/application/audit/audit-change.js +2 -0
  77. package/dist/application/audit/audit-change.js.map +1 -0
  78. package/dist/application/audit/audit-changes.d.ts +4 -0
  79. package/dist/application/audit/audit-changes.d.ts.map +1 -0
  80. package/dist/application/audit/audit-changes.js +2 -0
  81. package/dist/application/audit/audit-changes.js.map +1 -0
  82. package/dist/application/audit/audit-entry-extension-values.d.ts +7 -0
  83. package/dist/application/audit/audit-entry-extension-values.d.ts.map +1 -0
  84. package/dist/application/audit/audit-entry-extension-values.js +2 -0
  85. package/dist/application/audit/audit-entry-extension-values.js.map +1 -0
  86. package/dist/application/audit/audit-entry-extensions.d.ts +10 -0
  87. package/dist/application/audit/audit-entry-extensions.d.ts.map +1 -0
  88. package/dist/application/audit/audit-entry-extensions.js +2 -0
  89. package/dist/application/audit/audit-entry-extensions.js.map +1 -0
  90. package/dist/application/audit/audit-entry.d.ts +45 -0
  91. package/dist/application/audit/audit-entry.d.ts.map +1 -0
  92. package/dist/application/audit/audit-entry.js +2 -0
  93. package/dist/application/audit/audit-entry.js.map +1 -0
  94. package/dist/application/audit/audit-filter.d.ts +24 -0
  95. package/dist/application/audit/audit-filter.d.ts.map +1 -0
  96. package/dist/application/audit/audit-filter.js +2 -0
  97. package/dist/application/audit/audit-filter.js.map +1 -0
  98. package/dist/application/audit/audit-json.d.ts +6 -0
  99. package/dist/application/audit/audit-json.d.ts.map +1 -0
  100. package/dist/application/audit/audit-json.js +2 -0
  101. package/dist/application/audit/audit-json.js.map +1 -0
  102. package/dist/application/audit/audit-outcome.d.ts +2 -0
  103. package/dist/application/audit/audit-outcome.d.ts.map +1 -0
  104. package/dist/application/audit/audit-outcome.js +2 -0
  105. package/dist/application/audit/audit-outcome.js.map +1 -0
  106. package/dist/application/audit/audit-record.d.ts +4 -0
  107. package/dist/application/audit/audit-record.d.ts.map +1 -0
  108. package/dist/application/audit/audit-record.js +2 -0
  109. package/dist/application/audit/audit-record.js.map +1 -0
  110. package/dist/application/audit/audit-resource.d.ts +5 -0
  111. package/dist/application/audit/audit-resource.d.ts.map +1 -0
  112. package/dist/application/audit/audit-resource.js +2 -0
  113. package/dist/application/audit/audit-resource.js.map +1 -0
  114. package/dist/application/audit/audit-scalar.d.ts +2 -0
  115. package/dist/application/audit/audit-scalar.d.ts.map +1 -0
  116. package/dist/application/audit/audit-scalar.js +2 -0
  117. package/dist/application/audit/audit-scalar.js.map +1 -0
  118. package/dist/application/audit/audit-sort-field.d.ts +6 -0
  119. package/dist/application/audit/audit-sort-field.d.ts.map +1 -0
  120. package/dist/application/audit/audit-sort-field.js +2 -0
  121. package/dist/application/audit/audit-sort-field.js.map +1 -0
  122. package/dist/application/audit/audit-stamp.d.ts +8 -0
  123. package/dist/application/audit/audit-stamp.d.ts.map +1 -0
  124. package/dist/application/audit/audit-stamp.js +2 -0
  125. package/dist/application/audit/audit-stamp.js.map +1 -0
  126. package/dist/application/audit/masked-value.d.ts +5 -0
  127. package/dist/application/audit/masked-value.d.ts.map +1 -0
  128. package/dist/application/audit/masked-value.js +2 -0
  129. package/dist/application/audit/masked-value.js.map +1 -0
  130. package/dist/application/audit/no-current-tenant-error.d.ts +5 -0
  131. package/dist/application/audit/no-current-tenant-error.d.ts.map +1 -0
  132. package/dist/application/audit/no-current-tenant-error.js +8 -0
  133. package/dist/application/audit/no-current-tenant-error.js.map +1 -0
  134. package/dist/application/audit/stamp-creation.d.ts +6 -0
  135. package/dist/application/audit/stamp-creation.d.ts.map +1 -0
  136. package/dist/application/audit/stamp-creation.js +7 -0
  137. package/dist/application/audit/stamp-creation.js.map +1 -0
  138. package/dist/application/audit/stamp-update.d.ts +11 -0
  139. package/dist/application/audit/stamp-update.d.ts.map +1 -0
  140. package/dist/application/audit/stamp-update.js +11 -0
  141. package/dist/application/audit/stamp-update.js.map +1 -0
  142. package/dist/application/audit/tenant-scope-of.d.ts +5 -0
  143. package/dist/application/audit/tenant-scope-of.d.ts.map +1 -0
  144. package/dist/application/audit/tenant-scope-of.js +10 -0
  145. package/dist/application/audit/tenant-scope-of.js.map +1 -0
  146. package/dist/application/audit/tenant-scoped.d.ts +5 -0
  147. package/dist/application/audit/tenant-scoped.d.ts.map +1 -0
  148. package/dist/application/audit/tenant-scoped.js +2 -0
  149. package/dist/application/audit/tenant-scoped.js.map +1 -0
  150. package/dist/application/audit/update-stamp.d.ts +4 -0
  151. package/dist/application/audit/update-stamp.d.ts.map +1 -0
  152. package/dist/application/audit/update-stamp.js +2 -0
  153. package/dist/application/audit/update-stamp.js.map +1 -0
  154. package/dist/application/cache/cache-key.d.ts +13 -0
  155. package/dist/application/cache/cache-key.d.ts.map +1 -0
  156. package/dist/application/cache/cache-key.js +8 -0
  157. package/dist/application/cache/cache-key.js.map +1 -0
  158. package/dist/application/criteria/compare-decimals.d.ts +3 -0
  159. package/dist/application/criteria/compare-decimals.d.ts.map +1 -0
  160. package/dist/application/criteria/compare-decimals.js +28 -0
  161. package/dist/application/criteria/compare-decimals.js.map +1 -0
  162. package/dist/application/criteria/compare-values.d.ts +8 -0
  163. package/dist/application/criteria/compare-values.d.ts.map +1 -0
  164. package/dist/application/criteria/compare-values.js +31 -0
  165. package/dist/application/criteria/compare-values.js.map +1 -0
  166. package/dist/application/criteria/criteria-declaration.d.ts +17 -0
  167. package/dist/application/criteria/criteria-declaration.d.ts.map +1 -0
  168. package/dist/application/criteria/criteria-declaration.js +2 -0
  169. package/dist/application/criteria/criteria-declaration.js.map +1 -0
  170. package/dist/application/criteria/criteria-definition-error.d.ts +5 -0
  171. package/dist/application/criteria/criteria-definition-error.d.ts.map +1 -0
  172. package/dist/application/criteria/criteria-definition-error.js +8 -0
  173. package/dist/application/criteria/criteria-definition-error.js.map +1 -0
  174. package/dist/application/criteria/criteria-definition.d.ts +12 -0
  175. package/dist/application/criteria/criteria-definition.d.ts.map +1 -0
  176. package/dist/application/criteria/criteria-definition.js +2 -0
  177. package/dist/application/criteria/criteria-definition.js.map +1 -0
  178. package/dist/application/criteria/criteria-limits.d.ts +12 -0
  179. package/dist/application/criteria/criteria-limits.d.ts.map +1 -0
  180. package/dist/application/criteria/criteria-limits.js +8 -0
  181. package/dist/application/criteria/criteria-limits.js.map +1 -0
  182. package/dist/application/criteria/criteria-plan.d.ts +26 -0
  183. package/dist/application/criteria/criteria-plan.d.ts.map +1 -0
  184. package/dist/application/criteria/criteria-plan.js +2 -0
  185. package/dist/application/criteria/criteria-plan.js.map +1 -0
  186. package/dist/application/criteria/criteria-violation.d.ts +12 -0
  187. package/dist/application/criteria/criteria-violation.d.ts.map +1 -0
  188. package/dist/application/criteria/criteria-violation.js +2 -0
  189. package/dist/application/criteria/criteria-violation.js.map +1 -0
  190. package/dist/application/criteria/criteria.d.ts +38 -0
  191. package/dist/application/criteria/criteria.d.ts.map +1 -0
  192. package/dist/application/criteria/criteria.js +59 -0
  193. package/dist/application/criteria/criteria.js.map +1 -0
  194. package/dist/application/criteria/cursor-values.d.ts +4 -0
  195. package/dist/application/criteria/cursor-values.d.ts.map +1 -0
  196. package/dist/application/criteria/cursor-values.js +2 -0
  197. package/dist/application/criteria/cursor-values.js.map +1 -0
  198. package/dist/application/criteria/define-criteria.d.ts +9 -0
  199. package/dist/application/criteria/define-criteria.d.ts.map +1 -0
  200. package/dist/application/criteria/define-criteria.js +52 -0
  201. package/dist/application/criteria/define-criteria.js.map +1 -0
  202. package/dist/application/criteria/evaluate-criteria.d.ts +11 -0
  203. package/dist/application/criteria/evaluate-criteria.d.ts.map +1 -0
  204. package/dist/application/criteria/evaluate-criteria.js +11 -0
  205. package/dist/application/criteria/evaluate-criteria.js.map +1 -0
  206. package/dist/application/criteria/evaluate-plan.d.ts +5 -0
  207. package/dist/application/criteria/evaluate-plan.d.ts.map +1 -0
  208. package/dist/application/criteria/evaluate-plan.js +8 -0
  209. package/dist/application/criteria/evaluate-plan.js.map +1 -0
  210. package/dist/application/criteria/field-declaration-of.d.ts +4 -0
  211. package/dist/application/criteria/field-declaration-of.d.ts.map +1 -0
  212. package/dist/application/criteria/field-declaration-of.js +44 -0
  213. package/dist/application/criteria/field-declaration-of.js.map +1 -0
  214. package/dist/application/criteria/field-declaration.d.ts +10 -0
  215. package/dist/application/criteria/field-declaration.d.ts.map +1 -0
  216. package/dist/application/criteria/field-declaration.js +2 -0
  217. package/dist/application/criteria/field-declaration.js.map +1 -0
  218. package/dist/application/criteria/field-of.d.ts +9 -0
  219. package/dist/application/criteria/field-of.d.ts.map +1 -0
  220. package/dist/application/criteria/field-of.js +2 -0
  221. package/dist/application/criteria/field-of.js.map +1 -0
  222. package/dist/application/criteria/field-rule.d.ts +18 -0
  223. package/dist/application/criteria/field-rule.d.ts.map +1 -0
  224. package/dist/application/criteria/field-rule.js +2 -0
  225. package/dist/application/criteria/field-rule.js.map +1 -0
  226. package/dist/application/criteria/field-type-of.d.ts +3 -0
  227. package/dist/application/criteria/field-type-of.d.ts.map +1 -0
  228. package/dist/application/criteria/field-type-of.js +2 -0
  229. package/dist/application/criteria/field-type-of.js.map +1 -0
  230. package/dist/application/criteria/field-type.d.ts +6 -0
  231. package/dist/application/criteria/field-type.d.ts.map +1 -0
  232. package/dist/application/criteria/field-type.js +2 -0
  233. package/dist/application/criteria/field-type.js.map +1 -0
  234. package/dist/application/criteria/field-value.d.ts +3 -0
  235. package/dist/application/criteria/field-value.d.ts.map +1 -0
  236. package/dist/application/criteria/field-value.js +2 -0
  237. package/dist/application/criteria/field-value.js.map +1 -0
  238. package/dist/application/criteria/filter-node.d.ts +17 -0
  239. package/dist/application/criteria/filter-node.d.ts.map +1 -0
  240. package/dist/application/criteria/filter-node.js +2 -0
  241. package/dist/application/criteria/filter-node.js.map +1 -0
  242. package/dist/application/criteria/filter-operator.d.ts +2 -0
  243. package/dist/application/criteria/filter-operator.d.ts.map +1 -0
  244. package/dist/application/criteria/filter-operator.js +2 -0
  245. package/dist/application/criteria/filter-operator.js.map +1 -0
  246. package/dist/application/criteria/filter-violations.d.ts +5 -0
  247. package/dist/application/criteria/filter-violations.d.ts.map +1 -0
  248. package/dist/application/criteria/filter-violations.js +75 -0
  249. package/dist/application/criteria/filter-violations.js.map +1 -0
  250. package/dist/application/criteria/filters.d.ts +17 -0
  251. package/dist/application/criteria/filters.d.ts.map +1 -0
  252. package/dist/application/criteria/filters.js +27 -0
  253. package/dist/application/criteria/filters.js.map +1 -0
  254. package/dist/application/criteria/holds.d.ts +7 -0
  255. package/dist/application/criteria/holds.d.ts.map +1 -0
  256. package/dist/application/criteria/holds.js +57 -0
  257. package/dist/application/criteria/holds.js.map +1 -0
  258. package/dist/application/criteria/invalid-criteria-error.d.ts +10 -0
  259. package/dist/application/criteria/invalid-criteria-error.d.ts.map +1 -0
  260. package/dist/application/criteria/invalid-criteria-error.js +12 -0
  261. package/dist/application/criteria/invalid-criteria-error.js.map +1 -0
  262. package/dist/application/criteria/is-value-of.d.ts +4 -0
  263. package/dist/application/criteria/is-value-of.d.ts.map +1 -0
  264. package/dist/application/criteria/is-value-of.js +17 -0
  265. package/dist/application/criteria/is-value-of.js.map +1 -0
  266. package/dist/application/criteria/operand-of.d.ts +4 -0
  267. package/dist/application/criteria/operand-of.d.ts.map +1 -0
  268. package/dist/application/criteria/operand-of.js +2 -0
  269. package/dist/application/criteria/operand-of.js.map +1 -0
  270. package/dist/application/criteria/operator-of.d.ts +6 -0
  271. package/dist/application/criteria/operator-of.d.ts.map +1 -0
  272. package/dist/application/criteria/operator-of.js +2 -0
  273. package/dist/application/criteria/operator-of.js.map +1 -0
  274. package/dist/application/criteria/operators-of-type.d.ts +5 -0
  275. package/dist/application/criteria/operators-of-type.d.ts.map +1 -0
  276. package/dist/application/criteria/operators-of-type.js +14 -0
  277. package/dist/application/criteria/operators-of-type.js.map +1 -0
  278. package/dist/application/criteria/page-of-plan.d.ts +9 -0
  279. package/dist/application/criteria/page-of-plan.d.ts.map +1 -0
  280. package/dist/application/criteria/page-of-plan.js +25 -0
  281. package/dist/application/criteria/page-of-plan.js.map +1 -0
  282. package/dist/application/criteria/page-violations.d.ts +11 -0
  283. package/dist/application/criteria/page-violations.d.ts.map +1 -0
  284. package/dist/application/criteria/page-violations.js +39 -0
  285. package/dist/application/criteria/page-violations.js.map +1 -0
  286. package/dist/application/criteria/plan-criteria.d.ts +11 -0
  287. package/dist/application/criteria/plan-criteria.d.ts.map +1 -0
  288. package/dist/application/criteria/plan-criteria.js +55 -0
  289. package/dist/application/criteria/plan-criteria.js.map +1 -0
  290. package/dist/application/criteria/predicate-of.d.ts +8 -0
  291. package/dist/application/criteria/predicate-of.d.ts.map +1 -0
  292. package/dist/application/criteria/predicate-of.js +38 -0
  293. package/dist/application/criteria/predicate-of.js.map +1 -0
  294. package/dist/application/criteria/predicate.d.ts +23 -0
  295. package/dist/application/criteria/predicate.d.ts.map +1 -0
  296. package/dist/application/criteria/predicate.js +2 -0
  297. package/dist/application/criteria/predicate.js.map +1 -0
  298. package/dist/application/criteria/read-cursor.d.ts +12 -0
  299. package/dist/application/criteria/read-cursor.d.ts.map +1 -0
  300. package/dist/application/criteria/read-cursor.js +48 -0
  301. package/dist/application/criteria/read-cursor.js.map +1 -0
  302. package/dist/application/criteria/read-scope-mapping.d.ts +9 -0
  303. package/dist/application/criteria/read-scope-mapping.d.ts.map +1 -0
  304. package/dist/application/criteria/read-scope-mapping.js +2 -0
  305. package/dist/application/criteria/read-scope-mapping.js.map +1 -0
  306. package/dist/application/criteria/read-scope.d.ts +17 -0
  307. package/dist/application/criteria/read-scope.d.ts.map +1 -0
  308. package/dist/application/criteria/read-scope.js +2 -0
  309. package/dist/application/criteria/read-scope.js.map +1 -0
  310. package/dist/application/criteria/scoped-criteria.d.ts +21 -0
  311. package/dist/application/criteria/scoped-criteria.d.ts.map +1 -0
  312. package/dist/application/criteria/scoped-criteria.js +20 -0
  313. package/dist/application/criteria/scoped-criteria.js.map +1 -0
  314. package/dist/application/criteria/scoped.d.ts +11 -0
  315. package/dist/application/criteria/scoped.d.ts.map +1 -0
  316. package/dist/application/criteria/scoped.js +41 -0
  317. package/dist/application/criteria/scoped.js.map +1 -0
  318. package/dist/application/criteria/seek-predicate.d.ts +11 -0
  319. package/dist/application/criteria/seek-predicate.d.ts.map +1 -0
  320. package/dist/application/criteria/seek-predicate.js +45 -0
  321. package/dist/application/criteria/seek-predicate.js.map +1 -0
  322. package/dist/application/criteria/select-rows.d.ts +5 -0
  323. package/dist/application/criteria/select-rows.d.ts.map +1 -0
  324. package/dist/application/criteria/select-rows.js +29 -0
  325. package/dist/application/criteria/select-rows.js.map +1 -0
  326. package/dist/application/criteria/total-sort.d.ts +8 -0
  327. package/dist/application/criteria/total-sort.d.ts.map +1 -0
  328. package/dist/application/criteria/total-sort.js +12 -0
  329. package/dist/application/criteria/total-sort.js.map +1 -0
  330. package/dist/application/criteria/unmapped-read-scope-error.d.ts +8 -0
  331. package/dist/application/criteria/unmapped-read-scope-error.d.ts.map +1 -0
  332. package/dist/application/criteria/unmapped-read-scope-error.js +11 -0
  333. package/dist/application/criteria/unmapped-read-scope-error.js.map +1 -0
  334. package/dist/application/criteria/validate-criteria.d.ts +9 -0
  335. package/dist/application/criteria/validate-criteria.d.ts.map +1 -0
  336. package/dist/application/criteria/validate-criteria.js +13 -0
  337. package/dist/application/criteria/validate-criteria.js.map +1 -0
  338. package/dist/application/dependency-kind.d.ts +6 -0
  339. package/dist/application/dependency-kind.d.ts.map +1 -0
  340. package/dist/application/dependency-kind.js +2 -0
  341. package/dist/application/dependency-kind.js.map +1 -0
  342. package/dist/application/error-reporting/error-origin.d.ts +7 -0
  343. package/dist/application/error-reporting/error-origin.d.ts.map +1 -0
  344. package/dist/application/error-reporting/error-origin.js +2 -0
  345. package/dist/application/error-reporting/error-origin.js.map +1 -0
  346. package/dist/application/error-reporting/error-report-extension-values.d.ts +6 -0
  347. package/dist/application/error-reporting/error-report-extension-values.d.ts.map +1 -0
  348. package/dist/application/error-reporting/error-report-extension-values.js +2 -0
  349. package/dist/application/error-reporting/error-report-extension-values.js.map +1 -0
  350. package/dist/application/error-reporting/error-report-extensions.d.ts +10 -0
  351. package/dist/application/error-reporting/error-report-extensions.d.ts.map +1 -0
  352. package/dist/application/error-reporting/error-report-extensions.js +2 -0
  353. package/dist/application/error-reporting/error-report-extensions.js.map +1 -0
  354. package/dist/application/error-reporting/error-report-of.d.ts +11 -0
  355. package/dist/application/error-reporting/error-report-of.d.ts.map +1 -0
  356. package/dist/application/error-reporting/error-report-of.js +24 -0
  357. package/dist/application/error-reporting/error-report-of.js.map +1 -0
  358. package/dist/application/error-reporting/error-report.d.ts +24 -0
  359. package/dist/application/error-reporting/error-report.d.ts.map +1 -0
  360. package/dist/application/error-reporting/error-report.js +2 -0
  361. package/dist/application/error-reporting/error-report.js.map +1 -0
  362. package/dist/application/error-reporting/error-severity.d.ts +7 -0
  363. package/dist/application/error-reporting/error-severity.d.ts.map +1 -0
  364. package/dist/application/error-reporting/error-severity.js +2 -0
  365. package/dist/application/error-reporting/error-severity.js.map +1 -0
  366. package/dist/application/error-reporting/is-unexpected-error.d.ts +6 -0
  367. package/dist/application/error-reporting/is-unexpected-error.d.ts.map +1 -0
  368. package/dist/application/error-reporting/is-unexpected-error.js +9 -0
  369. package/dist/application/error-reporting/is-unexpected-error.js.map +1 -0
  370. package/dist/application/error-reporting/report-once.d.ts +11 -0
  371. package/dist/application/error-reporting/report-once.d.ts.map +1 -0
  372. package/dist/application/error-reporting/report-once.js +38 -0
  373. package/dist/application/error-reporting/report-once.js.map +1 -0
  374. package/dist/application/events/after-commit-failure.d.ts +4 -0
  375. package/dist/application/events/after-commit-failure.d.ts.map +1 -0
  376. package/dist/application/events/after-commit-failure.js +2 -0
  377. package/dist/application/events/after-commit-failure.js.map +1 -0
  378. package/dist/application/events/domain-event-callback.d.ts +4 -0
  379. package/dist/application/events/domain-event-callback.d.ts.map +1 -0
  380. package/dist/application/events/domain-event-callback.js +2 -0
  381. package/dist/application/events/domain-event-callback.js.map +1 -0
  382. package/dist/application/events/domain-event-phase.d.ts +14 -0
  383. package/dist/application/events/domain-event-phase.d.ts.map +1 -0
  384. package/dist/application/events/domain-event-phase.js +2 -0
  385. package/dist/application/events/domain-event-phase.js.map +1 -0
  386. package/dist/application/events/domain-event-subscription.d.ts +7 -0
  387. package/dist/application/events/domain-event-subscription.d.ts.map +1 -0
  388. package/dist/application/events/domain-event-subscription.js +2 -0
  389. package/dist/application/events/domain-event-subscription.js.map +1 -0
  390. package/dist/application/events/event-delivery.d.ts +17 -0
  391. package/dist/application/events/event-delivery.d.ts.map +1 -0
  392. package/dist/application/events/event-delivery.js +2 -0
  393. package/dist/application/events/event-delivery.js.map +1 -0
  394. package/dist/application/events/event-execution-options.d.ts +12 -0
  395. package/dist/application/events/event-execution-options.d.ts.map +1 -0
  396. package/dist/application/events/event-execution-options.js +2 -0
  397. package/dist/application/events/event-execution-options.js.map +1 -0
  398. package/dist/application/events/execution-context-of-event.d.ts +9 -0
  399. package/dist/application/events/execution-context-of-event.d.ts.map +1 -0
  400. package/dist/application/events/execution-context-of-event.js +15 -0
  401. package/dist/application/events/execution-context-of-event.js.map +1 -0
  402. package/dist/application/events/in-event-scope.d.ts +6 -0
  403. package/dist/application/events/in-event-scope.d.ts.map +1 -0
  404. package/dist/application/events/in-event-scope.js +6 -0
  405. package/dist/application/events/in-event-scope.js.map +1 -0
  406. package/dist/application/events/integration-event-callback.d.ts +8 -0
  407. package/dist/application/events/integration-event-callback.d.ts.map +1 -0
  408. package/dist/application/events/integration-event-callback.js +2 -0
  409. package/dist/application/events/integration-event-callback.js.map +1 -0
  410. package/dist/application/events/integration-event.d.ts +17 -0
  411. package/dist/application/events/integration-event.d.ts.map +1 -0
  412. package/dist/application/events/integration-event.js +2 -0
  413. package/dist/application/events/integration-event.js.map +1 -0
  414. package/dist/application/events/messaging-system-of.d.ts +8 -0
  415. package/dist/application/events/messaging-system-of.d.ts.map +1 -0
  416. package/dist/application/events/messaging-system-of.js +11 -0
  417. package/dist/application/events/messaging-system-of.js.map +1 -0
  418. package/dist/application/events/scoped-publisher.d.ts +10 -0
  419. package/dist/application/events/scoped-publisher.d.ts.map +1 -0
  420. package/dist/application/events/scoped-publisher.js +21 -0
  421. package/dist/application/events/scoped-publisher.js.map +1 -0
  422. package/dist/application/events/subscription.d.ts +4 -0
  423. package/dist/application/events/subscription.d.ts.map +1 -0
  424. package/dist/application/events/subscription.js +2 -0
  425. package/dist/application/events/subscription.js.map +1 -0
  426. package/dist/application/execution/execution-context-extension-values.d.ts +6 -0
  427. package/dist/application/execution/execution-context-extension-values.d.ts.map +1 -0
  428. package/dist/application/execution/execution-context-extension-values.js +2 -0
  429. package/dist/application/execution/execution-context-extension-values.js.map +1 -0
  430. package/dist/application/execution/execution-context-extensions.d.ts +10 -0
  431. package/dist/application/execution/execution-context-extensions.d.ts.map +1 -0
  432. package/dist/application/execution/execution-context-extensions.js +2 -0
  433. package/dist/application/execution/execution-context-extensions.js.map +1 -0
  434. package/dist/application/execution/execution-context.d.ts +28 -0
  435. package/dist/application/execution/execution-context.d.ts.map +1 -0
  436. package/dist/application/execution/execution-context.js +10 -0
  437. package/dist/application/execution/execution-context.js.map +1 -0
  438. package/dist/application/execution/execution-origin.d.ts +3 -0
  439. package/dist/application/execution/execution-origin.d.ts.map +1 -0
  440. package/dist/application/execution/execution-origin.js +2 -0
  441. package/dist/application/execution/execution-origin.js.map +1 -0
  442. package/dist/application/execution/is-past-deadline.d.ts +3 -0
  443. package/dist/application/execution/is-past-deadline.d.ts.map +1 -0
  444. package/dist/application/execution/is-past-deadline.js +4 -0
  445. package/dist/application/execution/is-past-deadline.js.map +1 -0
  446. package/dist/application/execution/log-fields-of.d.ts +5 -0
  447. package/dist/application/execution/log-fields-of.d.ts.map +1 -0
  448. package/dist/application/execution/log-fields-of.js +12 -0
  449. package/dist/application/execution/log-fields-of.js.map +1 -0
  450. package/dist/application/execution/no-execution-context-error.d.ts +5 -0
  451. package/dist/application/execution/no-execution-context-error.d.ts.map +1 -0
  452. package/dist/application/execution/no-execution-context-error.js +8 -0
  453. package/dist/application/execution/no-execution-context-error.js.map +1 -0
  454. package/dist/application/execution/with-actor.d.ts +8 -0
  455. package/dist/application/execution/with-actor.d.ts.map +1 -0
  456. package/dist/application/execution/with-actor.js +13 -0
  457. package/dist/application/execution/with-actor.js.map +1 -0
  458. package/dist/application/hydration/hydrate.d.ts +10 -0
  459. package/dist/application/hydration/hydrate.d.ts.map +1 -0
  460. package/dist/application/hydration/hydrate.js +11 -0
  461. package/dist/application/hydration/hydrate.js.map +1 -0
  462. package/dist/application/hydration/hydrated-page.d.ts +7 -0
  463. package/dist/application/hydration/hydrated-page.d.ts.map +1 -0
  464. package/dist/application/hydration/hydrated-page.js +2 -0
  465. package/dist/application/hydration/hydrated-page.js.map +1 -0
  466. package/dist/application/hydration/hydration-policy.d.ts +8 -0
  467. package/dist/application/hydration/hydration-policy.d.ts.map +1 -0
  468. package/dist/application/hydration/hydration-policy.js +2 -0
  469. package/dist/application/hydration/hydration-policy.js.map +1 -0
  470. package/dist/application/hydration/hydration-run.d.ts +10 -0
  471. package/dist/application/hydration/hydration-run.d.ts.map +1 -0
  472. package/dist/application/hydration/hydration-run.js +2 -0
  473. package/dist/application/hydration/hydration-run.js.map +1 -0
  474. package/dist/application/hydration/hydration-timeout-error.d.ts +8 -0
  475. package/dist/application/hydration/hydration-timeout-error.d.ts.map +1 -0
  476. package/dist/application/hydration/hydration-timeout-error.js +13 -0
  477. package/dist/application/hydration/hydration-timeout-error.js.map +1 -0
  478. package/dist/application/hydration/hydration-warning.d.ts +6 -0
  479. package/dist/application/hydration/hydration-warning.d.ts.map +1 -0
  480. package/dist/application/hydration/hydration-warning.js +2 -0
  481. package/dist/application/hydration/hydration-warning.js.map +1 -0
  482. package/dist/application/hydration/hydration.d.ts +31 -0
  483. package/dist/application/hydration/hydration.d.ts.map +1 -0
  484. package/dist/application/hydration/hydration.js +82 -0
  485. package/dist/application/hydration/hydration.js.map +1 -0
  486. package/dist/application/hydration/load-relation.d.ts +17 -0
  487. package/dist/application/hydration/load-relation.d.ts.map +1 -0
  488. package/dist/application/hydration/load-relation.js +39 -0
  489. package/dist/application/hydration/load-relation.js.map +1 -0
  490. package/dist/application/hydration/property.d.ts +5 -0
  491. package/dist/application/hydration/property.d.ts.map +1 -0
  492. package/dist/application/hydration/property.js +4 -0
  493. package/dist/application/hydration/property.js.map +1 -0
  494. package/dist/application/lock/acquiring.d.ts +10 -0
  495. package/dist/application/lock/acquiring.d.ts.map +1 -0
  496. package/dist/application/lock/acquiring.js +18 -0
  497. package/dist/application/lock/acquiring.js.map +1 -0
  498. package/dist/application/lock/lock-handle.d.ts +11 -0
  499. package/dist/application/lock/lock-handle.d.ts.map +1 -0
  500. package/dist/application/lock/lock-handle.js +2 -0
  501. package/dist/application/lock/lock-handle.js.map +1 -0
  502. package/dist/application/logging/credential-keys.d.ts +3 -0
  503. package/dist/application/logging/credential-keys.d.ts.map +1 -0
  504. package/dist/application/logging/credential-keys.js +17 -0
  505. package/dist/application/logging/credential-keys.js.map +1 -0
  506. package/dist/application/logging/describe-error-fields.d.ts +9 -0
  507. package/dist/application/logging/describe-error-fields.d.ts.map +1 -0
  508. package/dist/application/logging/describe-error-fields.js +13 -0
  509. package/dist/application/logging/describe-error-fields.js.map +1 -0
  510. package/dist/application/logging/describe-error.d.ts +16 -0
  511. package/dist/application/logging/describe-error.d.ts.map +1 -0
  512. package/dist/application/logging/describe-error.js +34 -0
  513. package/dist/application/logging/describe-error.js.map +1 -0
  514. package/dist/application/logging/error-description.d.ts +13 -0
  515. package/dist/application/logging/error-description.d.ts.map +1 -0
  516. package/dist/application/logging/error-description.js +2 -0
  517. package/dist/application/logging/error-description.js.map +1 -0
  518. package/dist/application/logging/error-identity.d.ts +8 -0
  519. package/dist/application/logging/error-identity.d.ts.map +1 -0
  520. package/dist/application/logging/error-identity.js +2 -0
  521. package/dist/application/logging/error-identity.js.map +1 -0
  522. package/dist/application/logging/identify-error.d.ts +8 -0
  523. package/dist/application/logging/identify-error.d.ts.map +1 -0
  524. package/dist/application/logging/identify-error.js +21 -0
  525. package/dist/application/logging/identify-error.js.map +1 -0
  526. package/dist/application/logging/log-fields.d.ts +24 -0
  527. package/dist/application/logging/log-fields.d.ts.map +1 -0
  528. package/dist/application/logging/log-fields.js +2 -0
  529. package/dist/application/logging/log-fields.js.map +1 -0
  530. package/dist/application/logging/log-level.d.ts +3 -0
  531. package/dist/application/logging/log-level.d.ts.map +1 -0
  532. package/dist/application/logging/log-level.js +2 -0
  533. package/dist/application/logging/log-level.js.map +1 -0
  534. package/dist/application/logging/log-value.d.ts +5 -0
  535. package/dist/application/logging/log-value.d.ts.map +1 -0
  536. package/dist/application/logging/log-value.js +2 -0
  537. package/dist/application/logging/log-value.js.map +1 -0
  538. package/dist/application/logging/redacted.d.ts +3 -0
  539. package/dist/application/logging/redacted.d.ts.map +1 -0
  540. package/dist/application/logging/redacted.js +3 -0
  541. package/dist/application/logging/redacted.js.map +1 -0
  542. package/dist/application/logging/scrubbed-message.d.ts +3 -0
  543. package/dist/application/logging/scrubbed-message.d.ts.map +1 -0
  544. package/dist/application/logging/scrubbed-message.js +3 -0
  545. package/dist/application/logging/scrubbed-message.js.map +1 -0
  546. package/dist/application/logging/unwritable-fields.d.ts +5 -0
  547. package/dist/application/logging/unwritable-fields.d.ts.map +1 -0
  548. package/dist/application/logging/unwritable-fields.js +3 -0
  549. package/dist/application/logging/unwritable-fields.js.map +1 -0
  550. package/dist/application/messaging/bus-middleware.d.ts +5 -0
  551. package/dist/application/messaging/bus-middleware.d.ts.map +1 -0
  552. package/dist/application/messaging/bus-middleware.js +2 -0
  553. package/dist/application/messaging/bus-middleware.js.map +1 -0
  554. package/dist/application/messaging/command-handler.d.ts +6 -0
  555. package/dist/application/messaging/command-handler.d.ts.map +1 -0
  556. package/dist/application/messaging/command-handler.js +2 -0
  557. package/dist/application/messaging/command-handler.js.map +1 -0
  558. package/dist/application/messaging/command.d.ts +7 -0
  559. package/dist/application/messaging/command.d.ts.map +1 -0
  560. package/dist/application/messaging/command.js +5 -0
  561. package/dist/application/messaging/command.js.map +1 -0
  562. package/dist/application/messaging/duplicate-handler-error.d.ts +5 -0
  563. package/dist/application/messaging/duplicate-handler-error.d.ts.map +1 -0
  564. package/dist/application/messaging/duplicate-handler-error.js +7 -0
  565. package/dist/application/messaging/duplicate-handler-error.js.map +1 -0
  566. package/dist/application/messaging/handler-not-found-error.d.ts +5 -0
  567. package/dist/application/messaging/handler-not-found-error.d.ts.map +1 -0
  568. package/dist/application/messaging/handler-not-found-error.js +7 -0
  569. package/dist/application/messaging/handler-not-found-error.js.map +1 -0
  570. package/dist/application/messaging/handler-registration.d.ts +6 -0
  571. package/dist/application/messaging/handler-registration.d.ts.map +1 -0
  572. package/dist/application/messaging/handler-registration.js +2 -0
  573. package/dist/application/messaging/handler-registration.js.map +1 -0
  574. package/dist/application/messaging/message-brands.d.ts +3 -0
  575. package/dist/application/messaging/message-brands.d.ts.map +1 -0
  576. package/dist/application/messaging/message-brands.js +2 -0
  577. package/dist/application/messaging/message-brands.js.map +1 -0
  578. package/dist/application/messaging/message-info.d.ts +7 -0
  579. package/dist/application/messaging/message-info.d.ts.map +1 -0
  580. package/dist/application/messaging/message-info.js +2 -0
  581. package/dist/application/messaging/message-info.js.map +1 -0
  582. package/dist/application/messaging/message-type.d.ts +3 -0
  583. package/dist/application/messaging/message-type.d.ts.map +1 -0
  584. package/dist/application/messaging/message-type.js +2 -0
  585. package/dist/application/messaging/message-type.js.map +1 -0
  586. package/dist/application/messaging/message.d.ts +4 -0
  587. package/dist/application/messaging/message.d.ts.map +1 -0
  588. package/dist/application/messaging/message.js +2 -0
  589. package/dist/application/messaging/message.js.map +1 -0
  590. package/dist/application/messaging/query-handler.d.ts +6 -0
  591. package/dist/application/messaging/query-handler.d.ts.map +1 -0
  592. package/dist/application/messaging/query-handler.js +2 -0
  593. package/dist/application/messaging/query-handler.js.map +1 -0
  594. package/dist/application/messaging/query.d.ts +7 -0
  595. package/dist/application/messaging/query.d.ts.map +1 -0
  596. package/dist/application/messaging/query.js +5 -0
  597. package/dist/application/messaging/query.js.map +1 -0
  598. package/dist/application/messaging/result-of.d.ts +5 -0
  599. package/dist/application/messaging/result-of.d.ts.map +1 -0
  600. package/dist/application/messaging/result-of.js +2 -0
  601. package/dist/application/messaging/result-of.js.map +1 -0
  602. package/dist/application/metrics/counter.d.ts +6 -0
  603. package/dist/application/metrics/counter.d.ts.map +1 -0
  604. package/dist/application/metrics/counter.js +2 -0
  605. package/dist/application/metrics/counter.js.map +1 -0
  606. package/dist/application/metrics/gauge.d.ts +6 -0
  607. package/dist/application/metrics/gauge.d.ts.map +1 -0
  608. package/dist/application/metrics/gauge.js +2 -0
  609. package/dist/application/metrics/gauge.js.map +1 -0
  610. package/dist/application/metrics/histogram.d.ts +6 -0
  611. package/dist/application/metrics/histogram.d.ts.map +1 -0
  612. package/dist/application/metrics/histogram.js +2 -0
  613. package/dist/application/metrics/histogram.js.map +1 -0
  614. package/dist/application/metrics/metric-labels.d.ts +16 -0
  615. package/dist/application/metrics/metric-labels.d.ts.map +1 -0
  616. package/dist/application/metrics/metric-labels.js +2 -0
  617. package/dist/application/metrics/metric-labels.js.map +1 -0
  618. package/dist/application/pagination/cursor-page.d.ts +10 -0
  619. package/dist/application/pagination/cursor-page.d.ts.map +1 -0
  620. package/dist/application/pagination/cursor-page.js +15 -0
  621. package/dist/application/pagination/cursor-page.js.map +1 -0
  622. package/dist/application/pagination/cursor-position.d.ts +3 -0
  623. package/dist/application/pagination/cursor-position.d.ts.map +1 -0
  624. package/dist/application/pagination/cursor-position.js +2 -0
  625. package/dist/application/pagination/cursor-position.js.map +1 -0
  626. package/dist/application/pagination/decode-cursor.d.ts +4 -0
  627. package/dist/application/pagination/decode-cursor.d.ts.map +1 -0
  628. package/dist/application/pagination/decode-cursor.js +24 -0
  629. package/dist/application/pagination/decode-cursor.js.map +1 -0
  630. package/dist/application/pagination/encode-cursor.d.ts +7 -0
  631. package/dist/application/pagination/encode-cursor.d.ts.map +1 -0
  632. package/dist/application/pagination/encode-cursor.js +8 -0
  633. package/dist/application/pagination/encode-cursor.js.map +1 -0
  634. package/dist/application/pagination/invalid-page-request-error.d.ts +6 -0
  635. package/dist/application/pagination/invalid-page-request-error.d.ts.map +1 -0
  636. package/dist/application/pagination/invalid-page-request-error.js +6 -0
  637. package/dist/application/pagination/invalid-page-request-error.js.map +1 -0
  638. package/dist/application/pagination/map-page.d.ts +3 -0
  639. package/dist/application/pagination/map-page.d.ts.map +1 -0
  640. package/dist/application/pagination/map-page.js +5 -0
  641. package/dist/application/pagination/map-page.js.map +1 -0
  642. package/dist/application/pagination/offset-page.d.ts +10 -0
  643. package/dist/application/pagination/offset-page.d.ts.map +1 -0
  644. package/dist/application/pagination/offset-page.js +11 -0
  645. package/dist/application/pagination/offset-page.js.map +1 -0
  646. package/dist/application/pagination/page-limits.d.ts +6 -0
  647. package/dist/application/pagination/page-limits.d.ts.map +1 -0
  648. package/dist/application/pagination/page-limits.js +2 -0
  649. package/dist/application/pagination/page-limits.js.map +1 -0
  650. package/dist/application/pagination/page-of.d.ts +3 -0
  651. package/dist/application/pagination/page-of.d.ts.map +1 -0
  652. package/dist/application/pagination/page-of.js +4 -0
  653. package/dist/application/pagination/page-of.js.map +1 -0
  654. package/dist/application/pagination/page-request.d.ts +17 -0
  655. package/dist/application/pagination/page-request.d.ts.map +1 -0
  656. package/dist/application/pagination/page-request.js +2 -0
  657. package/dist/application/pagination/page-request.js.map +1 -0
  658. package/dist/application/pagination/page.d.ts +7 -0
  659. package/dist/application/pagination/page.d.ts.map +1 -0
  660. package/dist/application/pagination/page.js +2 -0
  661. package/dist/application/pagination/page.js.map +1 -0
  662. package/dist/application/pagination/size-within.d.ts +3 -0
  663. package/dist/application/pagination/size-within.d.ts.map +1 -0
  664. package/dist/application/pagination/size-within.js +9 -0
  665. package/dist/application/pagination/size-within.js.map +1 -0
  666. package/dist/application/pagination/sort-direction.d.ts +2 -0
  667. package/dist/application/pagination/sort-direction.d.ts.map +1 -0
  668. package/dist/application/pagination/sort-direction.js +2 -0
  669. package/dist/application/pagination/sort-direction.js.map +1 -0
  670. package/dist/application/pagination/sort.d.ts +7 -0
  671. package/dist/application/pagination/sort.d.ts.map +1 -0
  672. package/dist/application/pagination/sort.js +2 -0
  673. package/dist/application/pagination/sort.js.map +1 -0
  674. package/dist/application/persistence/optimistic-update.d.ts +20 -0
  675. package/dist/application/persistence/optimistic-update.d.ts.map +1 -0
  676. package/dist/application/persistence/optimistic-update.js +20 -0
  677. package/dist/application/persistence/optimistic-update.js.map +1 -0
  678. package/dist/application/persistence/schema-name-of.d.ts +6 -0
  679. package/dist/application/persistence/schema-name-of.d.ts.map +1 -0
  680. package/dist/application/persistence/schema-name-of.js +12 -0
  681. package/dist/application/persistence/schema-name-of.js.map +1 -0
  682. package/dist/application/ports/actor-context.d.ts +13 -0
  683. package/dist/application/ports/actor-context.d.ts.map +1 -0
  684. package/dist/application/ports/actor-context.js +11 -0
  685. package/dist/application/ports/actor-context.js.map +1 -0
  686. package/dist/application/ports/audit-reader.d.ts +14 -0
  687. package/dist/application/ports/audit-reader.d.ts.map +1 -0
  688. package/dist/application/ports/audit-reader.js +11 -0
  689. package/dist/application/ports/audit-reader.js.map +1 -0
  690. package/dist/application/ports/audit-trail.d.ts +10 -0
  691. package/dist/application/ports/audit-trail.d.ts.map +1 -0
  692. package/dist/application/ports/audit-trail.js +11 -0
  693. package/dist/application/ports/audit-trail.js.map +1 -0
  694. package/dist/application/ports/cache.d.ts +16 -0
  695. package/dist/application/ports/cache.d.ts.map +1 -0
  696. package/dist/application/ports/cache.js +11 -0
  697. package/dist/application/ports/cache.js.map +1 -0
  698. package/dist/application/ports/clock.d.ts +4 -0
  699. package/dist/application/ports/clock.d.ts.map +1 -0
  700. package/dist/application/ports/clock.js +6 -0
  701. package/dist/application/ports/clock.js.map +1 -0
  702. package/dist/application/ports/command-bus.d.ts +10 -0
  703. package/dist/application/ports/command-bus.d.ts.map +1 -0
  704. package/dist/application/ports/command-bus.js +10 -0
  705. package/dist/application/ports/command-bus.js.map +1 -0
  706. package/dist/application/ports/domain-event-dispatcher.d.ts +19 -0
  707. package/dist/application/ports/domain-event-dispatcher.d.ts.map +1 -0
  708. package/dist/application/ports/domain-event-dispatcher.js +11 -0
  709. package/dist/application/ports/domain-event-dispatcher.js.map +1 -0
  710. package/dist/application/ports/error-reporter.d.ts +17 -0
  711. package/dist/application/ports/error-reporter.d.ts.map +1 -0
  712. package/dist/application/ports/error-reporter.js +12 -0
  713. package/dist/application/ports/error-reporter.js.map +1 -0
  714. package/dist/application/ports/event-bus.d.ts +11 -0
  715. package/dist/application/ports/event-bus.d.ts.map +1 -0
  716. package/dist/application/ports/event-bus.js +7 -0
  717. package/dist/application/ports/event-bus.js.map +1 -0
  718. package/dist/application/ports/event-subscribers.d.ts +9 -0
  719. package/dist/application/ports/event-subscribers.d.ts.map +1 -0
  720. package/dist/application/ports/event-subscribers.js +10 -0
  721. package/dist/application/ports/event-subscribers.js.map +1 -0
  722. package/dist/application/ports/execution-scope.d.ts +14 -0
  723. package/dist/application/ports/execution-scope.d.ts.map +1 -0
  724. package/dist/application/ports/execution-scope.js +12 -0
  725. package/dist/application/ports/execution-scope.js.map +1 -0
  726. package/dist/application/ports/id-generator.d.ts +4 -0
  727. package/dist/application/ports/id-generator.d.ts.map +1 -0
  728. package/dist/application/ports/id-generator.js +6 -0
  729. package/dist/application/ports/id-generator.js.map +1 -0
  730. package/dist/application/ports/integration-event-publisher.d.ts +6 -0
  731. package/dist/application/ports/integration-event-publisher.d.ts.map +1 -0
  732. package/dist/application/ports/integration-event-publisher.js +7 -0
  733. package/dist/application/ports/integration-event-publisher.js.map +1 -0
  734. package/dist/application/ports/integration-event-subscriber.d.ts +7 -0
  735. package/dist/application/ports/integration-event-subscriber.d.ts.map +1 -0
  736. package/dist/application/ports/integration-event-subscriber.js +7 -0
  737. package/dist/application/ports/integration-event-subscriber.js.map +1 -0
  738. package/dist/application/ports/job-scheduler.d.ts +22 -0
  739. package/dist/application/ports/job-scheduler.d.ts.map +1 -0
  740. package/dist/application/ports/job-scheduler.js +10 -0
  741. package/dist/application/ports/job-scheduler.js.map +1 -0
  742. package/dist/application/ports/lock.d.ts +16 -0
  743. package/dist/application/ports/lock.d.ts.map +1 -0
  744. package/dist/application/ports/lock.js +11 -0
  745. package/dist/application/ports/lock.js.map +1 -0
  746. package/dist/application/ports/logger.d.ts +41 -0
  747. package/dist/application/ports/logger.d.ts.map +1 -0
  748. package/dist/application/ports/logger.js +24 -0
  749. package/dist/application/ports/logger.js.map +1 -0
  750. package/dist/application/ports/metrics.d.ts +10 -0
  751. package/dist/application/ports/metrics.d.ts.map +1 -0
  752. package/dist/application/ports/metrics.js +7 -0
  753. package/dist/application/ports/metrics.js.map +1 -0
  754. package/dist/application/ports/processed-event-store.d.ts +12 -0
  755. package/dist/application/ports/processed-event-store.d.ts.map +1 -0
  756. package/dist/application/ports/processed-event-store.js +7 -0
  757. package/dist/application/ports/processed-event-store.js.map +1 -0
  758. package/dist/application/ports/query-bus.d.ts +6 -0
  759. package/dist/application/ports/query-bus.d.ts.map +1 -0
  760. package/dist/application/ports/query-bus.js +6 -0
  761. package/dist/application/ports/query-bus.js.map +1 -0
  762. package/dist/application/ports/rate-limiter.d.ts +11 -0
  763. package/dist/application/ports/rate-limiter.d.ts.map +1 -0
  764. package/dist/application/ports/rate-limiter.js +11 -0
  765. package/dist/application/ports/rate-limiter.js.map +1 -0
  766. package/dist/application/ports/read-model-rows.d.ts +15 -0
  767. package/dist/application/ports/read-model-rows.d.ts.map +1 -0
  768. package/dist/application/ports/read-model-rows.js +7 -0
  769. package/dist/application/ports/read-model-rows.js.map +1 -0
  770. package/dist/application/ports/read-model-store.d.ts +24 -0
  771. package/dist/application/ports/read-model-store.d.ts.map +1 -0
  772. package/dist/application/ports/read-model-store.js +11 -0
  773. package/dist/application/ports/read-model-store.js.map +1 -0
  774. package/dist/application/ports/read-model-table.d.ts +29 -0
  775. package/dist/application/ports/read-model-table.d.ts.map +1 -0
  776. package/dist/application/ports/read-model-table.js +8 -0
  777. package/dist/application/ports/read-model-table.js.map +1 -0
  778. package/dist/application/ports/repository.d.ts +13 -0
  779. package/dist/application/ports/repository.d.ts.map +1 -0
  780. package/dist/application/ports/repository.js +10 -0
  781. package/dist/application/ports/repository.js.map +1 -0
  782. package/dist/application/ports/unit-of-work.d.ts +10 -0
  783. package/dist/application/ports/unit-of-work.d.ts.map +1 -0
  784. package/dist/application/ports/unit-of-work.js +12 -0
  785. package/dist/application/ports/unit-of-work.js.map +1 -0
  786. package/dist/application/rate-limit/rate-limit-decision-of.d.ts +12 -0
  787. package/dist/application/rate-limit/rate-limit-decision-of.d.ts.map +1 -0
  788. package/dist/application/rate-limit/rate-limit-decision-of.js +8 -0
  789. package/dist/application/rate-limit/rate-limit-decision-of.js.map +1 -0
  790. package/dist/application/rate-limit/rate-limit-decision.d.ts +8 -0
  791. package/dist/application/rate-limit/rate-limit-decision.d.ts.map +1 -0
  792. package/dist/application/rate-limit/rate-limit-decision.js +2 -0
  793. package/dist/application/rate-limit/rate-limit-decision.js.map +1 -0
  794. package/dist/application/rate-limit/rate-limit.d.ts +6 -0
  795. package/dist/application/rate-limit/rate-limit.d.ts.map +1 -0
  796. package/dist/application/rate-limit/rate-limit.js +2 -0
  797. package/dist/application/rate-limit/rate-limit.js.map +1 -0
  798. package/dist/application/read-model/event-stamp.d.ts +11 -0
  799. package/dist/application/read-model/event-stamp.d.ts.map +1 -0
  800. package/dist/application/read-model/event-stamp.js +2 -0
  801. package/dist/application/read-model/event-stamp.js.map +1 -0
  802. package/dist/application/read-model/is-newer.d.ts +4 -0
  803. package/dist/application/read-model/is-newer.d.ts.map +1 -0
  804. package/dist/application/read-model/is-newer.js +9 -0
  805. package/dist/application/read-model/is-newer.js.map +1 -0
  806. package/dist/application/read-model/projection-rebuild-report.d.ts +9 -0
  807. package/dist/application/read-model/projection-rebuild-report.d.ts.map +1 -0
  808. package/dist/application/read-model/projection-rebuild-report.js +2 -0
  809. package/dist/application/read-model/projection-rebuild-report.js.map +1 -0
  810. package/dist/application/read-model/read-model-source.d.ts +14 -0
  811. package/dist/application/read-model/read-model-source.d.ts.map +1 -0
  812. package/dist/application/read-model/read-model-source.js +2 -0
  813. package/dist/application/read-model/read-model-source.js.map +1 -0
  814. package/dist/application/read-model/read-model-write.d.ts +7 -0
  815. package/dist/application/read-model/read-model-write.d.ts.map +1 -0
  816. package/dist/application/read-model/read-model-write.js +2 -0
  817. package/dist/application/read-model/read-model-write.js.map +1 -0
  818. package/dist/application/read-model/searched-rows.d.ts +6 -0
  819. package/dist/application/read-model/searched-rows.d.ts.map +1 -0
  820. package/dist/application/read-model/searched-rows.js +2 -0
  821. package/dist/application/read-model/searched-rows.js.map +1 -0
  822. package/dist/application/read-model/stamp-of.d.ts +10 -0
  823. package/dist/application/read-model/stamp-of.d.ts.map +1 -0
  824. package/dist/application/read-model/stamp-of.js +12 -0
  825. package/dist/application/read-model/stamp-of.js.map +1 -0
  826. package/dist/application/read-model/stamped-row.d.ts +8 -0
  827. package/dist/application/read-model/stamped-row.d.ts.map +1 -0
  828. package/dist/application/read-model/stamped-row.js +2 -0
  829. package/dist/application/read-model/stamped-row.js.map +1 -0
  830. package/dist/application/read-model/touched-key.d.ts +6 -0
  831. package/dist/application/read-model/touched-key.d.ts.map +1 -0
  832. package/dist/application/read-model/touched-key.js +2 -0
  833. package/dist/application/read-model/touched-key.js.map +1 -0
  834. package/dist/application/scheduling/describe-job-schedule.d.ts +4 -0
  835. package/dist/application/scheduling/describe-job-schedule.d.ts.map +1 -0
  836. package/dist/application/scheduling/describe-job-schedule.js +10 -0
  837. package/dist/application/scheduling/describe-job-schedule.js.map +1 -0
  838. package/dist/application/scheduling/duplicate-job-error.d.ts +6 -0
  839. package/dist/application/scheduling/duplicate-job-error.d.ts.map +1 -0
  840. package/dist/application/scheduling/duplicate-job-error.js +10 -0
  841. package/dist/application/scheduling/duplicate-job-error.js.map +1 -0
  842. package/dist/application/scheduling/duration-text.d.ts +3 -0
  843. package/dist/application/scheduling/duration-text.d.ts.map +1 -0
  844. package/dist/application/scheduling/duration-text.js +2 -0
  845. package/dist/application/scheduling/duration-text.js.map +1 -0
  846. package/dist/application/scheduling/execution-context-of-job.d.ts +13 -0
  847. package/dist/application/scheduling/execution-context-of-job.d.ts.map +1 -0
  848. package/dist/application/scheduling/execution-context-of-job.js +10 -0
  849. package/dist/application/scheduling/execution-context-of-job.js.map +1 -0
  850. package/dist/application/scheduling/invalid-job-schedule-error.d.ts +6 -0
  851. package/dist/application/scheduling/invalid-job-schedule-error.d.ts.map +1 -0
  852. package/dist/application/scheduling/invalid-job-schedule-error.js +9 -0
  853. package/dist/application/scheduling/invalid-job-schedule-error.js.map +1 -0
  854. package/dist/application/scheduling/is-job-name.d.ts +3 -0
  855. package/dist/application/scheduling/is-job-name.d.ts.map +1 -0
  856. package/dist/application/scheduling/is-job-name.js +6 -0
  857. package/dist/application/scheduling/is-job-name.js.map +1 -0
  858. package/dist/application/scheduling/job-definition.d.ts +11 -0
  859. package/dist/application/scheduling/job-definition.d.ts.map +1 -0
  860. package/dist/application/scheduling/job-definition.js +2 -0
  861. package/dist/application/scheduling/job-definition.js.map +1 -0
  862. package/dist/application/scheduling/job-description.d.ts +13 -0
  863. package/dist/application/scheduling/job-description.d.ts.map +1 -0
  864. package/dist/application/scheduling/job-description.js +2 -0
  865. package/dist/application/scheduling/job-description.js.map +1 -0
  866. package/dist/application/scheduling/job-execution.d.ts +12 -0
  867. package/dist/application/scheduling/job-execution.d.ts.map +1 -0
  868. package/dist/application/scheduling/job-execution.js +2 -0
  869. package/dist/application/scheduling/job-execution.js.map +1 -0
  870. package/dist/application/scheduling/job-options.d.ts +25 -0
  871. package/dist/application/scheduling/job-options.d.ts.map +1 -0
  872. package/dist/application/scheduling/job-options.js +2 -0
  873. package/dist/application/scheduling/job-options.js.map +1 -0
  874. package/dist/application/scheduling/job-outcome.d.ts +8 -0
  875. package/dist/application/scheduling/job-outcome.d.ts.map +1 -0
  876. package/dist/application/scheduling/job-outcome.js +2 -0
  877. package/dist/application/scheduling/job-outcome.js.map +1 -0
  878. package/dist/application/scheduling/job-policy.d.ts +6 -0
  879. package/dist/application/scheduling/job-policy.d.ts.map +1 -0
  880. package/dist/application/scheduling/job-policy.js +22 -0
  881. package/dist/application/scheduling/job-policy.js.map +1 -0
  882. package/dist/application/scheduling/job-run.d.ts +13 -0
  883. package/dist/application/scheduling/job-run.d.ts.map +1 -0
  884. package/dist/application/scheduling/job-run.js +2 -0
  885. package/dist/application/scheduling/job-run.js.map +1 -0
  886. package/dist/application/scheduling/job-schedule-of.d.ts +11 -0
  887. package/dist/application/scheduling/job-schedule-of.d.ts.map +1 -0
  888. package/dist/application/scheduling/job-schedule-of.js +18 -0
  889. package/dist/application/scheduling/job-schedule-of.js.map +1 -0
  890. package/dist/application/scheduling/job-schedule.d.ts +22 -0
  891. package/dist/application/scheduling/job-schedule.d.ts.map +1 -0
  892. package/dist/application/scheduling/job-schedule.js +2 -0
  893. package/dist/application/scheduling/job-schedule.js.map +1 -0
  894. package/dist/application/scheduling/job-settings.d.ts +7 -0
  895. package/dist/application/scheduling/job-settings.d.ts.map +1 -0
  896. package/dist/application/scheduling/job-settings.js +2 -0
  897. package/dist/application/scheduling/job-settings.js.map +1 -0
  898. package/dist/application/scheduling/parse-cron.d.ts +3 -0
  899. package/dist/application/scheduling/parse-cron.d.ts.map +1 -0
  900. package/dist/application/scheduling/parse-cron.js +102 -0
  901. package/dist/application/scheduling/parse-cron.js.map +1 -0
  902. package/dist/application/scheduling/parse-duration.d.ts +3 -0
  903. package/dist/application/scheduling/parse-duration.d.ts.map +1 -0
  904. package/dist/application/scheduling/parse-duration.js +16 -0
  905. package/dist/application/scheduling/parse-duration.js.map +1 -0
  906. package/dist/application/scheduling/parse-job-schedule.d.ts +5 -0
  907. package/dist/application/scheduling/parse-job-schedule.d.ts.map +1 -0
  908. package/dist/application/scheduling/parse-job-schedule.js +10 -0
  909. package/dist/application/scheduling/parse-job-schedule.js.map +1 -0
  910. package/dist/application/scheduling/parsed-job-schedule.d.ts +26 -0
  911. package/dist/application/scheduling/parsed-job-schedule.d.ts.map +1 -0
  912. package/dist/application/scheduling/parsed-job-schedule.js +2 -0
  913. package/dist/application/scheduling/parsed-job-schedule.js.map +1 -0
  914. package/dist/application/scheduling/scheduled-job.d.ts +9 -0
  915. package/dist/application/scheduling/scheduled-job.d.ts.map +1 -0
  916. package/dist/application/scheduling/scheduled-job.js +2 -0
  917. package/dist/application/scheduling/scheduled-job.js.map +1 -0
  918. package/dist/application/scheduling/unknown-job-error.d.ts +6 -0
  919. package/dist/application/scheduling/unknown-job-error.d.ts.map +1 -0
  920. package/dist/application/scheduling/unknown-job-error.js +10 -0
  921. package/dist/application/scheduling/unknown-job-error.js.map +1 -0
  922. package/dist/application/session/anonymous-session.d.ts +4 -0
  923. package/dist/application/session/anonymous-session.d.ts.map +1 -0
  924. package/dist/application/session/anonymous-session.js +14 -0
  925. package/dist/application/session/anonymous-session.js.map +1 -0
  926. package/dist/application/session/authentication-method.d.ts +3 -0
  927. package/dist/application/session/authentication-method.d.ts.map +1 -0
  928. package/dist/application/session/authentication-method.js +2 -0
  929. package/dist/application/session/authentication-method.js.map +1 -0
  930. package/dist/application/session/authentication-strength.d.ts +7 -0
  931. package/dist/application/session/authentication-strength.d.ts.map +1 -0
  932. package/dist/application/session/authentication-strength.js +2 -0
  933. package/dist/application/session/authentication-strength.js.map +1 -0
  934. package/dist/application/session/is-expired.d.ts +4 -0
  935. package/dist/application/session/is-expired.d.ts.map +1 -0
  936. package/dist/application/session/is-expired.js +5 -0
  937. package/dist/application/session/is-expired.js.map +1 -0
  938. package/dist/application/session/is-impersonated.d.ts +3 -0
  939. package/dist/application/session/is-impersonated.d.ts.map +1 -0
  940. package/dist/application/session/is-impersonated.js +4 -0
  941. package/dist/application/session/is-impersonated.js.map +1 -0
  942. package/dist/application/session/is-session.d.ts +4 -0
  943. package/dist/application/session/is-session.d.ts.map +1 -0
  944. package/dist/application/session/is-session.js +18 -0
  945. package/dist/application/session/is-session.js.map +1 -0
  946. package/dist/application/session/never-issued.d.ts +2 -0
  947. package/dist/application/session/never-issued.d.ts.map +1 -0
  948. package/dist/application/session/never-issued.js +2 -0
  949. package/dist/application/session/never-issued.js.map +1 -0
  950. package/dist/application/session/session-client.d.ts +6 -0
  951. package/dist/application/session/session-client.d.ts.map +1 -0
  952. package/dist/application/session/session-client.js +2 -0
  953. package/dist/application/session/session-client.js.map +1 -0
  954. package/dist/application/session/session-extension-values.d.ts +6 -0
  955. package/dist/application/session/session-extension-values.d.ts.map +1 -0
  956. package/dist/application/session/session-extension-values.js +2 -0
  957. package/dist/application/session/session-extension-values.js.map +1 -0
  958. package/dist/application/session/session-extensions.d.ts +10 -0
  959. package/dist/application/session/session-extensions.d.ts.map +1 -0
  960. package/dist/application/session/session-extensions.js +2 -0
  961. package/dist/application/session/session-extensions.js.map +1 -0
  962. package/dist/application/session/session.d.ts +27 -0
  963. package/dist/application/session/session.d.ts.map +1 -0
  964. package/dist/application/session/session.js +2 -0
  965. package/dist/application/session/session.js.map +1 -0
  966. package/dist/application/session/system-session.d.ts +4 -0
  967. package/dist/application/session/system-session.d.ts.map +1 -0
  968. package/dist/application/session/system-session.js +14 -0
  969. package/dist/application/session/system-session.js.map +1 -0
  970. package/dist/application/use-case.d.ts +4 -0
  971. package/dist/application/use-case.d.ts.map +1 -0
  972. package/dist/application/use-case.js +2 -0
  973. package/dist/application/use-case.js.map +1 -0
  974. package/dist/declarations/decorators/adapter.d.ts +15 -0
  975. package/dist/declarations/decorators/adapter.d.ts.map +1 -0
  976. package/dist/declarations/decorators/adapter.js +8 -0
  977. package/dist/declarations/decorators/adapter.js.map +1 -0
  978. package/dist/declarations/decorators/assert-named.d.ts +2 -0
  979. package/dist/declarations/decorators/assert-named.d.ts.map +1 -0
  980. package/dist/declarations/decorators/assert-named.js +7 -0
  981. package/dist/declarations/decorators/assert-named.js.map +1 -0
  982. package/dist/declarations/decorators/command-handler.d.ts +15 -0
  983. package/dist/declarations/decorators/command-handler.d.ts.map +1 -0
  984. package/dist/declarations/decorators/command-handler.js +13 -0
  985. package/dist/declarations/decorators/command-handler.js.map +1 -0
  986. package/dist/declarations/decorators/declaring.d.ts +15 -0
  987. package/dist/declarations/decorators/declaring.d.ts.map +1 -0
  988. package/dist/declarations/decorators/declaring.js +26 -0
  989. package/dist/declarations/decorators/declaring.js.map +1 -0
  990. package/dist/declarations/decorators/domain-event-handler.d.ts +30 -0
  991. package/dist/declarations/decorators/domain-event-handler.d.ts.map +1 -0
  992. package/dist/declarations/decorators/domain-event-handler.js +24 -0
  993. package/dist/declarations/decorators/domain-event-handler.js.map +1 -0
  994. package/dist/declarations/decorators/gateway.d.ts +11 -0
  995. package/dist/declarations/decorators/gateway.d.ts.map +1 -0
  996. package/dist/declarations/decorators/gateway.js +5 -0
  997. package/dist/declarations/decorators/gateway.js.map +1 -0
  998. package/dist/declarations/decorators/handling.d.ts +10 -0
  999. package/dist/declarations/decorators/handling.d.ts.map +1 -0
  1000. package/dist/declarations/decorators/handling.js +4 -0
  1001. package/dist/declarations/decorators/handling.js.map +1 -0
  1002. package/dist/declarations/decorators/integration-event-handler.d.ts +30 -0
  1003. package/dist/declarations/decorators/integration-event-handler.d.ts.map +1 -0
  1004. package/dist/declarations/decorators/integration-event-handler.js +21 -0
  1005. package/dist/declarations/decorators/integration-event-handler.js.map +1 -0
  1006. package/dist/declarations/decorators/is-dependencies.d.ts +3 -0
  1007. package/dist/declarations/decorators/is-dependencies.d.ts.map +1 -0
  1008. package/dist/declarations/decorators/is-dependencies.js +4 -0
  1009. package/dist/declarations/decorators/is-dependencies.js.map +1 -0
  1010. package/dist/declarations/decorators/kind-of.d.ts +5 -0
  1011. package/dist/declarations/decorators/kind-of.d.ts.map +1 -0
  1012. package/dist/declarations/decorators/kind-of.js +14 -0
  1013. package/dist/declarations/decorators/kind-of.js.map +1 -0
  1014. package/dist/declarations/decorators/message-declarator.d.ts +8 -0
  1015. package/dist/declarations/decorators/message-declarator.d.ts.map +1 -0
  1016. package/dist/declarations/decorators/message-declarator.js +2 -0
  1017. package/dist/declarations/decorators/message-declarator.js.map +1 -0
  1018. package/dist/declarations/decorators/named.d.ts +5 -0
  1019. package/dist/declarations/decorators/named.d.ts.map +1 -0
  1020. package/dist/declarations/decorators/named.js +2 -0
  1021. package/dist/declarations/decorators/named.js.map +1 -0
  1022. package/dist/declarations/decorators/on.d.ts +19 -0
  1023. package/dist/declarations/decorators/on.d.ts.map +1 -0
  1024. package/dist/declarations/decorators/on.js +32 -0
  1025. package/dist/declarations/decorators/on.js.map +1 -0
  1026. package/dist/declarations/decorators/pending-applications.d.ts +9 -0
  1027. package/dist/declarations/decorators/pending-applications.d.ts.map +1 -0
  1028. package/dist/declarations/decorators/pending-applications.js +18 -0
  1029. package/dist/declarations/decorators/pending-applications.js.map +1 -0
  1030. package/dist/declarations/decorators/policy.d.ts +15 -0
  1031. package/dist/declarations/decorators/policy.d.ts.map +1 -0
  1032. package/dist/declarations/decorators/policy.js +16 -0
  1033. package/dist/declarations/decorators/policy.js.map +1 -0
  1034. package/dist/declarations/decorators/port-options.d.ts +13 -0
  1035. package/dist/declarations/decorators/port-options.d.ts.map +1 -0
  1036. package/dist/declarations/decorators/port-options.js +2 -0
  1037. package/dist/declarations/decorators/port-options.js.map +1 -0
  1038. package/dist/declarations/decorators/projection-method-decorator.d.ts +13 -0
  1039. package/dist/declarations/decorators/projection-method-decorator.d.ts.map +1 -0
  1040. package/dist/declarations/decorators/projection-method-decorator.js +2 -0
  1041. package/dist/declarations/decorators/projection-method-decorator.js.map +1 -0
  1042. package/dist/declarations/decorators/projection.d.ts +10 -0
  1043. package/dist/declarations/decorators/projection.d.ts.map +1 -0
  1044. package/dist/declarations/decorators/projection.js +35 -0
  1045. package/dist/declarations/decorators/projection.js.map +1 -0
  1046. package/dist/declarations/decorators/public.d.ts +14 -0
  1047. package/dist/declarations/decorators/public.d.ts.map +1 -0
  1048. package/dist/declarations/decorators/public.js +9 -0
  1049. package/dist/declarations/decorators/public.js.map +1 -0
  1050. package/dist/declarations/decorators/query-handler.d.ts +11 -0
  1051. package/dist/declarations/decorators/query-handler.d.ts.map +1 -0
  1052. package/dist/declarations/decorators/query-handler.js +9 -0
  1053. package/dist/declarations/decorators/query-handler.js.map +1 -0
  1054. package/dist/declarations/decorators/repository.d.ts +12 -0
  1055. package/dist/declarations/decorators/repository.d.ts.map +1 -0
  1056. package/dist/declarations/decorators/repository.js +5 -0
  1057. package/dist/declarations/decorators/repository.js.map +1 -0
  1058. package/dist/declarations/decorators/requires.d.ts +18 -0
  1059. package/dist/declarations/decorators/requires.d.ts.map +1 -0
  1060. package/dist/declarations/decorators/requires.js +20 -0
  1061. package/dist/declarations/decorators/requires.js.map +1 -0
  1062. package/dist/declarations/decorators/scheduled.d.ts +15 -0
  1063. package/dist/declarations/decorators/scheduled.d.ts.map +1 -0
  1064. package/dist/declarations/decorators/scheduled.js +47 -0
  1065. package/dist/declarations/decorators/scheduled.js.map +1 -0
  1066. package/dist/declarations/decorators/settings.d.ts +2 -0
  1067. package/dist/declarations/decorators/settings.d.ts.map +1 -0
  1068. package/dist/declarations/decorators/settings.js +2 -0
  1069. package/dist/declarations/decorators/settings.js.map +1 -0
  1070. package/dist/declarations/dependencies/class-declarator.d.ts +9 -0
  1071. package/dist/declarations/dependencies/class-declarator.d.ts.map +1 -0
  1072. package/dist/declarations/dependencies/class-declarator.js +2 -0
  1073. package/dist/declarations/dependencies/class-declarator.js.map +1 -0
  1074. package/dist/declarations/dependencies/concrete-dependency.d.ts +5 -0
  1075. package/dist/declarations/dependencies/concrete-dependency.d.ts.map +1 -0
  1076. package/dist/declarations/dependencies/concrete-dependency.js +2 -0
  1077. package/dist/declarations/dependencies/concrete-dependency.js.map +1 -0
  1078. package/dist/declarations/dependencies/dependencies.d.ts +3 -0
  1079. package/dist/declarations/dependencies/dependencies.d.ts.map +1 -0
  1080. package/dist/declarations/dependencies/dependencies.js +2 -0
  1081. package/dist/declarations/dependencies/dependencies.js.map +1 -0
  1082. package/dist/declarations/dependencies/dependency-list.d.ts +8 -0
  1083. package/dist/declarations/dependencies/dependency-list.d.ts.map +1 -0
  1084. package/dist/declarations/dependencies/dependency-list.js +2 -0
  1085. package/dist/declarations/dependencies/dependency-list.js.map +1 -0
  1086. package/dist/declarations/dependencies/dependency-mismatch.d.ts +6 -0
  1087. package/dist/declarations/dependencies/dependency-mismatch.d.ts.map +1 -0
  1088. package/dist/declarations/dependencies/dependency-mismatch.js +2 -0
  1089. package/dist/declarations/dependencies/dependency-mismatch.js.map +1 -0
  1090. package/dist/declarations/dependencies/dependency-tokens.d.ts +6 -0
  1091. package/dist/declarations/dependencies/dependency-tokens.d.ts.map +1 -0
  1092. package/dist/declarations/dependencies/dependency-tokens.js +2 -0
  1093. package/dist/declarations/dependencies/dependency-tokens.js.map +1 -0
  1094. package/dist/declarations/dependencies/matching-dependencies.d.ts +7 -0
  1095. package/dist/declarations/dependencies/matching-dependencies.d.ts.map +1 -0
  1096. package/dist/declarations/dependencies/matching-dependencies.js +2 -0
  1097. package/dist/declarations/dependencies/matching-dependencies.js.map +1 -0
  1098. package/dist/declarations/dependencies/stand-ins.d.ts +9 -0
  1099. package/dist/declarations/dependencies/stand-ins.d.ts.map +1 -0
  1100. package/dist/declarations/dependencies/stand-ins.js +2 -0
  1101. package/dist/declarations/dependencies/stand-ins.js.map +1 -0
  1102. package/dist/declarations/model/access-declaration.d.ts +11 -0
  1103. package/dist/declarations/model/access-declaration.d.ts.map +1 -0
  1104. package/dist/declarations/model/access-declaration.js +2 -0
  1105. package/dist/declarations/model/access-declaration.js.map +1 -0
  1106. package/dist/declarations/model/audited-field-hint.d.ts +6 -0
  1107. package/dist/declarations/model/audited-field-hint.d.ts.map +1 -0
  1108. package/dist/declarations/model/audited-field-hint.js +2 -0
  1109. package/dist/declarations/model/audited-field-hint.js.map +1 -0
  1110. package/dist/declarations/model/binding-aspect-info.d.ts +12 -0
  1111. package/dist/declarations/model/binding-aspect-info.d.ts.map +1 -0
  1112. package/dist/declarations/model/binding-aspect-info.js +2 -0
  1113. package/dist/declarations/model/binding-aspect-info.js.map +1 -0
  1114. package/dist/declarations/model/binding-aspect.d.ts +7 -0
  1115. package/dist/declarations/model/binding-aspect.d.ts.map +1 -0
  1116. package/dist/declarations/model/binding-aspect.js +2 -0
  1117. package/dist/declarations/model/binding-aspect.js.map +1 -0
  1118. package/dist/declarations/model/declaration.d.ts +11 -0
  1119. package/dist/declarations/model/declaration.d.ts.map +1 -0
  1120. package/dist/declarations/model/declaration.js +2 -0
  1121. package/dist/declarations/model/declaration.js.map +1 -0
  1122. package/dist/declarations/model/declared-class.d.ts +3 -0
  1123. package/dist/declarations/model/declared-class.d.ts.map +1 -0
  1124. package/dist/declarations/model/declared-class.js +2 -0
  1125. package/dist/declarations/model/declared-class.js.map +1 -0
  1126. package/dist/declarations/model/declared-policy.d.ts +14 -0
  1127. package/dist/declarations/model/declared-policy.d.ts.map +1 -0
  1128. package/dist/declarations/model/declared-policy.js +2 -0
  1129. package/dist/declarations/model/declared-policy.js.map +1 -0
  1130. package/dist/declarations/model/domain-event-handler-declaration.d.ts +16 -0
  1131. package/dist/declarations/model/domain-event-handler-declaration.d.ts.map +1 -0
  1132. package/dist/declarations/model/domain-event-handler-declaration.js +2 -0
  1133. package/dist/declarations/model/domain-event-handler-declaration.js.map +1 -0
  1134. package/dist/declarations/model/domain-event-handler-use.d.ts +5 -0
  1135. package/dist/declarations/model/domain-event-handler-use.d.ts.map +1 -0
  1136. package/dist/declarations/model/domain-event-handler-use.js +2 -0
  1137. package/dist/declarations/model/domain-event-handler-use.js.map +1 -0
  1138. package/dist/declarations/model/domain-event-handler.d.ts +6 -0
  1139. package/dist/declarations/model/domain-event-handler.d.ts.map +1 -0
  1140. package/dist/declarations/model/domain-event-handler.js +2 -0
  1141. package/dist/declarations/model/domain-event-handler.js.map +1 -0
  1142. package/dist/declarations/model/domain-event-type.d.ts +3 -0
  1143. package/dist/declarations/model/domain-event-type.d.ts.map +1 -0
  1144. package/dist/declarations/model/domain-event-type.js +2 -0
  1145. package/dist/declarations/model/domain-event-type.js.map +1 -0
  1146. package/dist/declarations/model/event-contract.d.ts +14 -0
  1147. package/dist/declarations/model/event-contract.d.ts.map +1 -0
  1148. package/dist/declarations/model/event-contract.js +2 -0
  1149. package/dist/declarations/model/event-contract.js.map +1 -0
  1150. package/dist/declarations/model/handler-declaration.d.ts +12 -0
  1151. package/dist/declarations/model/handler-declaration.d.ts.map +1 -0
  1152. package/dist/declarations/model/handler-declaration.js +2 -0
  1153. package/dist/declarations/model/handler-declaration.js.map +1 -0
  1154. package/dist/declarations/model/integration-event-handler-declaration.d.ts +16 -0
  1155. package/dist/declarations/model/integration-event-handler-declaration.d.ts.map +1 -0
  1156. package/dist/declarations/model/integration-event-handler-declaration.js +2 -0
  1157. package/dist/declarations/model/integration-event-handler-declaration.js.map +1 -0
  1158. package/dist/declarations/model/integration-event-handler-use.d.ts +4 -0
  1159. package/dist/declarations/model/integration-event-handler-use.d.ts.map +1 -0
  1160. package/dist/declarations/model/integration-event-handler-use.js +2 -0
  1161. package/dist/declarations/model/integration-event-handler-use.js.map +1 -0
  1162. package/dist/declarations/model/integration-event-handler.d.ts +9 -0
  1163. package/dist/declarations/model/integration-event-handler.d.ts.map +1 -0
  1164. package/dist/declarations/model/integration-event-handler.js +2 -0
  1165. package/dist/declarations/model/integration-event-handler.js.map +1 -0
  1166. package/dist/declarations/model/job-declaration.d.ts +15 -0
  1167. package/dist/declarations/model/job-declaration.d.ts.map +1 -0
  1168. package/dist/declarations/model/job-declaration.js +2 -0
  1169. package/dist/declarations/model/job-declaration.js.map +1 -0
  1170. package/dist/declarations/model/message-declaration.d.ts +10 -0
  1171. package/dist/declarations/model/message-declaration.d.ts.map +1 -0
  1172. package/dist/declarations/model/message-declaration.js +2 -0
  1173. package/dist/declarations/model/message-declaration.js.map +1 -0
  1174. package/dist/declarations/model/message-handler.d.ts +10 -0
  1175. package/dist/declarations/model/message-handler.d.ts.map +1 -0
  1176. package/dist/declarations/model/message-handler.js +2 -0
  1177. package/dist/declarations/model/message-handler.js.map +1 -0
  1178. package/dist/declarations/model/permission-ref.d.ts +5 -0
  1179. package/dist/declarations/model/permission-ref.d.ts.map +1 -0
  1180. package/dist/declarations/model/permission-ref.js +2 -0
  1181. package/dist/declarations/model/permission-ref.js.map +1 -0
  1182. package/dist/declarations/model/policy-declaration.d.ts +12 -0
  1183. package/dist/declarations/model/policy-declaration.d.ts.map +1 -0
  1184. package/dist/declarations/model/policy-declaration.js +2 -0
  1185. package/dist/declarations/model/policy-declaration.js.map +1 -0
  1186. package/dist/declarations/model/policy-verdict.d.ts +7 -0
  1187. package/dist/declarations/model/policy-verdict.d.ts.map +1 -0
  1188. package/dist/declarations/model/policy-verdict.js +2 -0
  1189. package/dist/declarations/model/policy-verdict.js.map +1 -0
  1190. package/dist/declarations/model/port-declaration.d.ts +16 -0
  1191. package/dist/declarations/model/port-declaration.d.ts.map +1 -0
  1192. package/dist/declarations/model/port-declaration.js +2 -0
  1193. package/dist/declarations/model/port-declaration.js.map +1 -0
  1194. package/dist/declarations/model/projection-application.d.ts +19 -0
  1195. package/dist/declarations/model/projection-application.d.ts.map +1 -0
  1196. package/dist/declarations/model/projection-application.js +2 -0
  1197. package/dist/declarations/model/projection-application.js.map +1 -0
  1198. package/dist/declarations/model/projection-declaration.d.ts +12 -0
  1199. package/dist/declarations/model/projection-declaration.d.ts.map +1 -0
  1200. package/dist/declarations/model/projection-declaration.js +2 -0
  1201. package/dist/declarations/model/projection-declaration.js.map +1 -0
  1202. package/dist/declarations/model/resource-pointer.d.ts +5 -0
  1203. package/dist/declarations/model/resource-pointer.d.ts.map +1 -0
  1204. package/dist/declarations/model/resource-pointer.js +2 -0
  1205. package/dist/declarations/model/resource-pointer.js.map +1 -0
  1206. package/dist/declarations/registry/declaration-error.d.ts +5 -0
  1207. package/dist/declarations/registry/declaration-error.d.ts.map +1 -0
  1208. package/dist/declarations/registry/declaration-error.js +8 -0
  1209. package/dist/declarations/registry/declaration-error.js.map +1 -0
  1210. package/dist/declarations/registry/declaration-of.d.ts +4 -0
  1211. package/dist/declarations/registry/declaration-of.d.ts.map +1 -0
  1212. package/dist/declarations/registry/declaration-of.js +9 -0
  1213. package/dist/declarations/registry/declaration-of.js.map +1 -0
  1214. package/dist/declarations/registry/declared-entry.d.ts +7 -0
  1215. package/dist/declarations/registry/declared-entry.d.ts.map +1 -0
  1216. package/dist/declarations/registry/declared-entry.js +2 -0
  1217. package/dist/declarations/registry/declared-entry.js.map +1 -0
  1218. package/dist/declarations/registry/list-declarations.d.ts +4 -0
  1219. package/dist/declarations/registry/list-declarations.d.ts.map +1 -0
  1220. package/dist/declarations/registry/list-declarations.js +18 -0
  1221. package/dist/declarations/registry/list-declarations.js.map +1 -0
  1222. package/dist/declarations/registry/record.d.ts +4 -0
  1223. package/dist/declarations/registry/record.d.ts.map +1 -0
  1224. package/dist/declarations/registry/record.js +12 -0
  1225. package/dist/declarations/registry/record.js.map +1 -0
  1226. package/dist/declarations/registry/registry.d.ts +8 -0
  1227. package/dist/declarations/registry/registry.d.ts.map +1 -0
  1228. package/dist/declarations/registry/registry.js +26 -0
  1229. package/dist/declarations/registry/registry.js.map +1 -0
  1230. package/dist/declarations/token/describe-token.d.ts +3 -0
  1231. package/dist/declarations/token/describe-token.d.ts.map +1 -0
  1232. package/dist/declarations/token/describe-token.js +4 -0
  1233. package/dist/declarations/token/describe-token.js.map +1 -0
  1234. package/dist/declarations/token/port-defect.d.ts +8 -0
  1235. package/dist/declarations/token/port-defect.d.ts.map +1 -0
  1236. package/dist/declarations/token/port-defect.js +31 -0
  1237. package/dist/declarations/token/port-defect.js.map +1 -0
  1238. package/dist/declarations/token/prototype-of.d.ts +3 -0
  1239. package/dist/declarations/token/prototype-of.d.ts.map +1 -0
  1240. package/dist/declarations/token/prototype-of.js +5 -0
  1241. package/dist/declarations/token/prototype-of.js.map +1 -0
  1242. package/dist/declarations/token/token-identity.d.ts +10 -0
  1243. package/dist/declarations/token/token-identity.d.ts.map +1 -0
  1244. package/dist/declarations/token/token-identity.js +47 -0
  1245. package/dist/declarations/token/token-identity.js.map +1 -0
  1246. package/dist/declarations/token/token.d.ts +7 -0
  1247. package/dist/declarations/token/token.d.ts.map +1 -0
  1248. package/dist/declarations/token/token.js +2 -0
  1249. package/dist/declarations/token/token.js.map +1 -0
  1250. package/dist/declarations.d.ts +63 -0
  1251. package/dist/declarations.d.ts.map +1 -0
  1252. package/dist/declarations.js +20 -0
  1253. package/dist/declarations.js.map +1 -0
  1254. package/dist/domain/aggregate-root.d.ts +25 -0
  1255. package/dist/domain/aggregate-root.d.ts.map +1 -0
  1256. package/dist/domain/aggregate-root.js +31 -0
  1257. package/dist/domain/aggregate-root.js.map +1 -0
  1258. package/dist/domain/domain-event.d.ts +11 -0
  1259. package/dist/domain/domain-event.d.ts.map +1 -0
  1260. package/dist/domain/domain-event.js +2 -0
  1261. package/dist/domain/domain-event.js.map +1 -0
  1262. package/dist/domain/entity.d.ts +7 -0
  1263. package/dist/domain/entity.d.ts.map +1 -0
  1264. package/dist/domain/entity.js +11 -0
  1265. package/dist/domain/entity.js.map +1 -0
  1266. package/dist/domain/errors/concurrency-error.d.ts +9 -0
  1267. package/dist/domain/errors/concurrency-error.d.ts.map +1 -0
  1268. package/dist/domain/errors/concurrency-error.js +11 -0
  1269. package/dist/domain/errors/concurrency-error.js.map +1 -0
  1270. package/dist/domain/errors/conflict-error.d.ts +5 -0
  1271. package/dist/domain/errors/conflict-error.d.ts.map +1 -0
  1272. package/dist/domain/errors/conflict-error.js +5 -0
  1273. package/dist/domain/errors/conflict-error.js.map +1 -0
  1274. package/dist/domain/errors/domain-error.d.ts +11 -0
  1275. package/dist/domain/errors/domain-error.d.ts.map +1 -0
  1276. package/dist/domain/errors/domain-error.js +11 -0
  1277. package/dist/domain/errors/domain-error.js.map +1 -0
  1278. package/dist/domain/errors/invariant-violation.d.ts +5 -0
  1279. package/dist/domain/errors/invariant-violation.d.ts.map +1 -0
  1280. package/dist/domain/errors/invariant-violation.js +5 -0
  1281. package/dist/domain/errors/invariant-violation.js.map +1 -0
  1282. package/dist/domain/errors/not-found-error.d.ts +5 -0
  1283. package/dist/domain/errors/not-found-error.d.ts.map +1 -0
  1284. package/dist/domain/errors/not-found-error.js +5 -0
  1285. package/dist/domain/errors/not-found-error.js.map +1 -0
  1286. package/dist/domain/result/err.d.ts +3 -0
  1287. package/dist/domain/result/err.d.ts.map +1 -0
  1288. package/dist/domain/result/err.js +2 -0
  1289. package/dist/domain/result/err.js.map +1 -0
  1290. package/dist/domain/result/ok.d.ts +3 -0
  1291. package/dist/domain/result/ok.d.ts.map +1 -0
  1292. package/dist/domain/result/ok.js +2 -0
  1293. package/dist/domain/result/ok.js.map +1 -0
  1294. package/dist/domain/result/result.d.ts +11 -0
  1295. package/dist/domain/result/result.d.ts.map +1 -0
  1296. package/dist/domain/result/result.js +2 -0
  1297. package/dist/domain/result/result.js.map +1 -0
  1298. package/dist/domain/result/unwrap.d.ts +3 -0
  1299. package/dist/domain/result/unwrap.d.ts.map +1 -0
  1300. package/dist/domain/result/unwrap.js +7 -0
  1301. package/dist/domain/result/unwrap.js.map +1 -0
  1302. package/dist/domain/value-object.d.ts +11 -0
  1303. package/dist/domain/value-object.d.ts.map +1 -0
  1304. package/dist/domain/value-object.js +39 -0
  1305. package/dist/domain/value-object.js.map +1 -0
  1306. package/dist/index.d.ts +281 -0
  1307. package/dist/index.d.ts.map +1 -0
  1308. package/dist/index.js +281 -0
  1309. package/dist/index.js.map +1 -0
  1310. package/dist/infrastructure/clock/fixed-clock.d.ts +8 -0
  1311. package/dist/infrastructure/clock/fixed-clock.d.ts.map +1 -0
  1312. package/dist/infrastructure/clock/fixed-clock.js +13 -0
  1313. package/dist/infrastructure/clock/fixed-clock.js.map +1 -0
  1314. package/dist/infrastructure/clock/system-clock.d.ts +5 -0
  1315. package/dist/infrastructure/clock/system-clock.d.ts.map +1 -0
  1316. package/dist/infrastructure/clock/system-clock.js +6 -0
  1317. package/dist/infrastructure/clock/system-clock.js.map +1 -0
  1318. package/dist/infrastructure/context/async-local-storage-actor-context.d.ts +10 -0
  1319. package/dist/infrastructure/context/async-local-storage-actor-context.d.ts.map +1 -0
  1320. package/dist/infrastructure/context/async-local-storage-actor-context.js +16 -0
  1321. package/dist/infrastructure/context/async-local-storage-actor-context.js.map +1 -0
  1322. package/dist/infrastructure/context/async-local-storage-execution-scope.d.ts +10 -0
  1323. package/dist/infrastructure/context/async-local-storage-execution-scope.d.ts.map +1 -0
  1324. package/dist/infrastructure/context/async-local-storage-execution-scope.js +16 -0
  1325. package/dist/infrastructure/context/async-local-storage-execution-scope.js.map +1 -0
  1326. package/dist/infrastructure/context/fixed-actor-context.d.ts +15 -0
  1327. package/dist/infrastructure/context/fixed-actor-context.d.ts.map +1 -0
  1328. package/dist/infrastructure/context/fixed-actor-context.js +29 -0
  1329. package/dist/infrastructure/context/fixed-actor-context.js.map +1 -0
  1330. package/dist/infrastructure/context/fixed-execution-scope.d.ts +20 -0
  1331. package/dist/infrastructure/context/fixed-execution-scope.d.ts.map +1 -0
  1332. package/dist/infrastructure/context/fixed-execution-scope.js +42 -0
  1333. package/dist/infrastructure/context/fixed-execution-scope.js.map +1 -0
  1334. package/dist/infrastructure/context/required-actor.d.ts +3 -0
  1335. package/dist/infrastructure/context/required-actor.d.ts.map +1 -0
  1336. package/dist/infrastructure/context/required-actor.js +8 -0
  1337. package/dist/infrastructure/context/required-actor.js.map +1 -0
  1338. package/dist/infrastructure/context/required-execution-context.d.ts +3 -0
  1339. package/dist/infrastructure/context/required-execution-context.d.ts.map +1 -0
  1340. package/dist/infrastructure/context/required-execution-context.js +8 -0
  1341. package/dist/infrastructure/context/required-execution-context.js.map +1 -0
  1342. package/dist/infrastructure/context/restoring.d.ts +2 -0
  1343. package/dist/infrastructure/context/restoring.d.ts.map +1 -0
  1344. package/dist/infrastructure/context/restoring.js +18 -0
  1345. package/dist/infrastructure/context/restoring.js.map +1 -0
  1346. package/dist/infrastructure/context/scoped-actor-context.d.ts +19 -0
  1347. package/dist/infrastructure/context/scoped-actor-context.d.ts.map +1 -0
  1348. package/dist/infrastructure/context/scoped-actor-context.js +35 -0
  1349. package/dist/infrastructure/context/scoped-actor-context.js.map +1 -0
  1350. package/dist/infrastructure/domain-events/announce-domain-events.d.ts +16 -0
  1351. package/dist/infrastructure/domain-events/announce-domain-events.d.ts.map +1 -0
  1352. package/dist/infrastructure/domain-events/announce-domain-events.js +47 -0
  1353. package/dist/infrastructure/domain-events/announce-domain-events.js.map +1 -0
  1354. package/dist/infrastructure/domain-events/dispatch-after-commit.d.ts +8 -0
  1355. package/dist/infrastructure/domain-events/dispatch-after-commit.d.ts.map +1 -0
  1356. package/dist/infrastructure/domain-events/dispatch-after-commit.js +14 -0
  1357. package/dist/infrastructure/domain-events/dispatch-after-commit.js.map +1 -0
  1358. package/dist/infrastructure/domain-events/dispatch-before-commit.d.ts +8 -0
  1359. package/dist/infrastructure/domain-events/dispatch-before-commit.d.ts.map +1 -0
  1360. package/dist/infrastructure/domain-events/dispatch-before-commit.js +16 -0
  1361. package/dist/infrastructure/domain-events/dispatch-before-commit.js.map +1 -0
  1362. package/dist/infrastructure/domain-events/dispatching-on-save.d.ts +20 -0
  1363. package/dist/infrastructure/domain-events/dispatching-on-save.d.ts.map +1 -0
  1364. package/dist/infrastructure/domain-events/dispatching-on-save.js +97 -0
  1365. package/dist/infrastructure/domain-events/dispatching-on-save.js.map +1 -0
  1366. package/dist/infrastructure/domain-events/domain-event-runs.d.ts +9 -0
  1367. package/dist/infrastructure/domain-events/domain-event-runs.d.ts.map +1 -0
  1368. package/dist/infrastructure/domain-events/domain-event-runs.js +27 -0
  1369. package/dist/infrastructure/domain-events/domain-event-runs.js.map +1 -0
  1370. package/dist/infrastructure/domain-events/here.d.ts +3 -0
  1371. package/dist/infrastructure/domain-events/here.d.ts.map +1 -0
  1372. package/dist/infrastructure/domain-events/here.js +5 -0
  1373. package/dist/infrastructure/domain-events/here.js.map +1 -0
  1374. package/dist/infrastructure/domain-events/recorded-aggregates.d.ts +10 -0
  1375. package/dist/infrastructure/domain-events/recorded-aggregates.d.ts.map +1 -0
  1376. package/dist/infrastructure/domain-events/recorded-aggregates.js +15 -0
  1377. package/dist/infrastructure/domain-events/recorded-aggregates.js.map +1 -0
  1378. package/dist/infrastructure/domain-events/report-after-commit-failures.d.ts +16 -0
  1379. package/dist/infrastructure/domain-events/report-after-commit-failures.d.ts.map +1 -0
  1380. package/dist/infrastructure/domain-events/report-after-commit-failures.js +19 -0
  1381. package/dist/infrastructure/domain-events/report-after-commit-failures.js.map +1 -0
  1382. package/dist/infrastructure/domain-events/save-after-commit-error.d.ts +10 -0
  1383. package/dist/infrastructure/domain-events/save-after-commit-error.d.ts.map +1 -0
  1384. package/dist/infrastructure/domain-events/save-after-commit-error.js +13 -0
  1385. package/dist/infrastructure/domain-events/save-after-commit-error.js.map +1 -0
  1386. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts +23 -0
  1387. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts.map +1 -0
  1388. package/dist/infrastructure/domain-events/unit-of-work-scope.js +4 -0
  1389. package/dist/infrastructure/domain-events/unit-of-work-scope.js.map +1 -0
  1390. package/dist/infrastructure/domain-events/unit-of-work-stage.d.ts +8 -0
  1391. package/dist/infrastructure/domain-events/unit-of-work-stage.d.ts.map +1 -0
  1392. package/dist/infrastructure/domain-events/unit-of-work-stage.js +9 -0
  1393. package/dist/infrastructure/domain-events/unit-of-work-stage.js.map +1 -0
  1394. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts +17 -0
  1395. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts.map +1 -0
  1396. package/dist/infrastructure/domain-events/within-unit-of-work.js +41 -0
  1397. package/dist/infrastructure/domain-events/within-unit-of-work.js.map +1 -0
  1398. package/dist/infrastructure/error-reporting/dead-letter-error.d.ts +11 -0
  1399. package/dist/infrastructure/error-reporting/dead-letter-error.d.ts.map +1 -0
  1400. package/dist/infrastructure/error-reporting/dead-letter-error.js +16 -0
  1401. package/dist/infrastructure/error-reporting/dead-letter-error.js.map +1 -0
  1402. package/dist/infrastructure/error-reporting/dead-letter-reports.d.ts +46 -0
  1403. package/dist/infrastructure/error-reporting/dead-letter-reports.d.ts.map +1 -0
  1404. package/dist/infrastructure/error-reporting/dead-letter-reports.js +83 -0
  1405. package/dist/infrastructure/error-reporting/dead-letter-reports.js.map +1 -0
  1406. package/dist/infrastructure/error-reporting/report-process-failures.d.ts +26 -0
  1407. package/dist/infrastructure/error-reporting/report-process-failures.d.ts.map +1 -0
  1408. package/dist/infrastructure/error-reporting/report-process-failures.js +40 -0
  1409. package/dist/infrastructure/error-reporting/report-process-failures.js.map +1 -0
  1410. package/dist/infrastructure/events/idempotent.d.ts +8 -0
  1411. package/dist/infrastructure/events/idempotent.d.ts.map +1 -0
  1412. package/dist/infrastructure/events/idempotent.js +19 -0
  1413. package/dist/infrastructure/events/idempotent.js.map +1 -0
  1414. package/dist/infrastructure/id/sequential-id-generator.d.ts +8 -0
  1415. package/dist/infrastructure/id/sequential-id-generator.d.ts.map +1 -0
  1416. package/dist/infrastructure/id/sequential-id-generator.js +12 -0
  1417. package/dist/infrastructure/id/sequential-id-generator.js.map +1 -0
  1418. package/dist/infrastructure/id/uuid-generator.d.ts +5 -0
  1419. package/dist/infrastructure/id/uuid-generator.d.ts.map +1 -0
  1420. package/dist/infrastructure/id/uuid-generator.js +7 -0
  1421. package/dist/infrastructure/id/uuid-generator.js.map +1 -0
  1422. package/dist/infrastructure/in-memory/any-handler.d.ts +9 -0
  1423. package/dist/infrastructure/in-memory/any-handler.d.ts.map +1 -0
  1424. package/dist/infrastructure/in-memory/any-handler.js +2 -0
  1425. package/dist/infrastructure/in-memory/any-handler.js.map +1 -0
  1426. package/dist/infrastructure/in-memory/error-reporting-middleware.d.ts +12 -0
  1427. package/dist/infrastructure/in-memory/error-reporting-middleware.d.ts.map +1 -0
  1428. package/dist/infrastructure/in-memory/error-reporting-middleware.js +25 -0
  1429. package/dist/infrastructure/in-memory/error-reporting-middleware.js.map +1 -0
  1430. package/dist/infrastructure/in-memory/in-memory-cache.d.ts +23 -0
  1431. package/dist/infrastructure/in-memory/in-memory-cache.d.ts.map +1 -0
  1432. package/dist/infrastructure/in-memory/in-memory-cache.js +49 -0
  1433. package/dist/infrastructure/in-memory/in-memory-cache.js.map +1 -0
  1434. package/dist/infrastructure/in-memory/in-memory-command-bus.d.ts +14 -0
  1435. package/dist/infrastructure/in-memory/in-memory-command-bus.d.ts.map +1 -0
  1436. package/dist/infrastructure/in-memory/in-memory-command-bus.js +15 -0
  1437. package/dist/infrastructure/in-memory/in-memory-command-bus.js.map +1 -0
  1438. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts +26 -0
  1439. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts.map +1 -0
  1440. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js +55 -0
  1441. package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js.map +1 -0
  1442. package/dist/infrastructure/in-memory/in-memory-error-reporter.d.ts +14 -0
  1443. package/dist/infrastructure/in-memory/in-memory-error-reporter.d.ts.map +1 -0
  1444. package/dist/infrastructure/in-memory/in-memory-error-reporter.js +14 -0
  1445. package/dist/infrastructure/in-memory/in-memory-error-reporter.js.map +1 -0
  1446. package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts +19 -0
  1447. package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts.map +1 -0
  1448. package/dist/infrastructure/in-memory/in-memory-event-bus.js +35 -0
  1449. package/dist/infrastructure/in-memory/in-memory-event-bus.js.map +1 -0
  1450. package/dist/infrastructure/in-memory/in-memory-lock.d.ts +16 -0
  1451. package/dist/infrastructure/in-memory/in-memory-lock.d.ts.map +1 -0
  1452. package/dist/infrastructure/in-memory/in-memory-lock.js +32 -0
  1453. package/dist/infrastructure/in-memory/in-memory-lock.js.map +1 -0
  1454. package/dist/infrastructure/in-memory/in-memory-logger.d.ts +40 -0
  1455. package/dist/infrastructure/in-memory/in-memory-logger.d.ts.map +1 -0
  1456. package/dist/infrastructure/in-memory/in-memory-logger.js +68 -0
  1457. package/dist/infrastructure/in-memory/in-memory-logger.js.map +1 -0
  1458. package/dist/infrastructure/in-memory/in-memory-metrics.d.ts +24 -0
  1459. package/dist/infrastructure/in-memory/in-memory-metrics.d.ts.map +1 -0
  1460. package/dist/infrastructure/in-memory/in-memory-metrics.js +60 -0
  1461. package/dist/infrastructure/in-memory/in-memory-metrics.js.map +1 -0
  1462. package/dist/infrastructure/in-memory/in-memory-processed-event-store.d.ts +7 -0
  1463. package/dist/infrastructure/in-memory/in-memory-processed-event-store.d.ts.map +1 -0
  1464. package/dist/infrastructure/in-memory/in-memory-processed-event-store.js +19 -0
  1465. package/dist/infrastructure/in-memory/in-memory-processed-event-store.js.map +1 -0
  1466. package/dist/infrastructure/in-memory/in-memory-query-bus.d.ts +13 -0
  1467. package/dist/infrastructure/in-memory/in-memory-query-bus.d.ts.map +1 -0
  1468. package/dist/infrastructure/in-memory/in-memory-query-bus.js +14 -0
  1469. package/dist/infrastructure/in-memory/in-memory-query-bus.js.map +1 -0
  1470. package/dist/infrastructure/in-memory/in-memory-rate-limiter.d.ts +12 -0
  1471. package/dist/infrastructure/in-memory/in-memory-rate-limiter.d.ts.map +1 -0
  1472. package/dist/infrastructure/in-memory/in-memory-rate-limiter.js +20 -0
  1473. package/dist/infrastructure/in-memory/in-memory-rate-limiter.js.map +1 -0
  1474. package/dist/infrastructure/in-memory/in-memory-read-model-store.d.ts +11 -0
  1475. package/dist/infrastructure/in-memory/in-memory-read-model-store.d.ts.map +1 -0
  1476. package/dist/infrastructure/in-memory/in-memory-read-model-store.js +13 -0
  1477. package/dist/infrastructure/in-memory/in-memory-read-model-store.js.map +1 -0
  1478. package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts +30 -0
  1479. package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts.map +1 -0
  1480. package/dist/infrastructure/in-memory/in-memory-read-model-table.js +91 -0
  1481. package/dist/infrastructure/in-memory/in-memory-read-model-table.js.map +1 -0
  1482. package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts +9 -0
  1483. package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts.map +1 -0
  1484. package/dist/infrastructure/in-memory/in-memory-unit-of-work.js +11 -0
  1485. package/dist/infrastructure/in-memory/in-memory-unit-of-work.js.map +1 -0
  1486. package/dist/infrastructure/in-memory/in-process-bus.d.ts +18 -0
  1487. package/dist/infrastructure/in-memory/in-process-bus.d.ts.map +1 -0
  1488. package/dist/infrastructure/in-memory/in-process-bus.js +37 -0
  1489. package/dist/infrastructure/in-memory/in-process-bus.js.map +1 -0
  1490. package/dist/infrastructure/in-memory/metric-sample.d.ts +8 -0
  1491. package/dist/infrastructure/in-memory/metric-sample.d.ts.map +1 -0
  1492. package/dist/infrastructure/in-memory/metric-sample.js +2 -0
  1493. package/dist/infrastructure/in-memory/metric-sample.js.map +1 -0
  1494. package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts +11 -0
  1495. package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts.map +1 -0
  1496. package/dist/infrastructure/in-memory/unit-of-work-middleware.js +11 -0
  1497. package/dist/infrastructure/in-memory/unit-of-work-middleware.js.map +1 -0
  1498. package/dist/infrastructure/noop/noop-error-reporter.d.ts +7 -0
  1499. package/dist/infrastructure/noop/noop-error-reporter.d.ts.map +1 -0
  1500. package/dist/infrastructure/noop/noop-error-reporter.js +10 -0
  1501. package/dist/infrastructure/noop/noop-error-reporter.js.map +1 -0
  1502. package/dist/infrastructure/noop/noop-logger.d.ts +12 -0
  1503. package/dist/infrastructure/noop/noop-logger.d.ts.map +1 -0
  1504. package/dist/infrastructure/noop/noop-logger.js +25 -0
  1505. package/dist/infrastructure/noop/noop-logger.js.map +1 -0
  1506. package/dist/infrastructure/noop/noop-metrics.d.ts +11 -0
  1507. package/dist/infrastructure/noop/noop-metrics.d.ts.map +1 -0
  1508. package/dist/infrastructure/noop/noop-metrics.js +18 -0
  1509. package/dist/infrastructure/noop/noop-metrics.js.map +1 -0
  1510. package/dist/infrastructure/read-model/postgres-read-model-rebuild.d.ts +35 -0
  1511. package/dist/infrastructure/read-model/postgres-read-model-rebuild.d.ts.map +1 -0
  1512. package/dist/infrastructure/read-model/postgres-read-model-rebuild.js +70 -0
  1513. package/dist/infrastructure/read-model/postgres-read-model-rebuild.js.map +1 -0
  1514. package/dist/infrastructure/read-model/projection-rebuild.d.ts +34 -0
  1515. package/dist/infrastructure/read-model/projection-rebuild.d.ts.map +1 -0
  1516. package/dist/infrastructure/read-model/projection-rebuild.js +88 -0
  1517. package/dist/infrastructure/read-model/projection-rebuild.js.map +1 -0
  1518. package/dist/infrastructure/read-model/sql-run.d.ts +7 -0
  1519. package/dist/infrastructure/read-model/sql-run.d.ts.map +1 -0
  1520. package/dist/infrastructure/read-model/sql-run.js +2 -0
  1521. package/dist/infrastructure/read-model/sql-run.js.map +1 -0
  1522. package/dist/infrastructure/read-model/table-read-model-store.d.ts +23 -0
  1523. package/dist/infrastructure/read-model/table-read-model-store.d.ts.map +1 -0
  1524. package/dist/infrastructure/read-model/table-read-model-store.js +40 -0
  1525. package/dist/infrastructure/read-model/table-read-model-store.js.map +1 -0
  1526. package/dist/infrastructure/read-model/write-if-newer.d.ts +17 -0
  1527. package/dist/infrastructure/read-model/write-if-newer.d.ts.map +1 -0
  1528. package/dist/infrastructure/read-model/write-if-newer.js +32 -0
  1529. package/dist/infrastructure/read-model/write-if-newer.js.map +1 -0
  1530. package/package.json +33 -4
package/README.md CHANGED
@@ -1,3 +1,1087 @@
1
- # Temporary Holding Version
1
+ # @ddd-ts-kit/kernel
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The building blocks every context depends on, and nothing else: no framework, no ORM, no
4
+ logger, no dependency at all. `domain/` and `application/` may import it; it is the only package
5
+ of the kit they may import.
6
+
7
+ ```
8
+ npm i @ddd-ts-kit/kernel
9
+ ```
10
+
11
+ ## What is inside
12
+
13
+ | Area | Exports |
14
+ |---|---|
15
+ | Domain | `Entity`, `AggregateRoot` (version, recorded events), `ValueObject`, `DomainEvent`, `DomainError` with a stable `code` (`InvariantViolation`, `NotFoundError`, `ConflictError`, `ConcurrencyError`), `Result` with `ok`, `err`, `unwrap` |
16
+ | Ports | `Clock`, `IdGenerator`, `UnitOfWork`, `Repository` (abstract classes: each one is its own injection token), `UseCase`, `DependencyKind` (the roles a binding declares, read by di, tracing and aspects: `repository`, `gateway`, `external`, `use-case`, `publisher`, `consumer`, `domain-event-handler`, `job`) |
17
+ | Buses | `Command`, `Query`, `CommandBus`, `QueryBus`, `BusMiddleware`, the in-process `InMemoryCommandBus` and `InMemoryQueryBus` (`register(type, handler, { context })` names the bounded context in `MessageInfo`), `unitOfWorkMiddleware` |
18
+ | Events | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (both at once), `EventSubscribers` (the subscriber of each bounded context), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus`, `DomainEventDispatcher`, `IntegrationEventCallback` and `DomainEventCallback` (the functions a subscriber and a dispatcher are given), `executionContextOfEvent`, `inEventScope`, `scopedPublisher`, `EventDelivery` (what a provider says of one delivery: attempt, last attempt, transport, source, consumer), `messagingSystemOf` |
19
+ | Domain events and the unit of work | `dispatchingOnSave` (the wrapper that makes a repository hand over what the aggregates it is given recorded), `announceDomainEvents`, `withinUnitOfWork` (what every `UnitOfWork.run` is built on: queue, dispatch before the commit, `after-commit` phase), `unitOfWorkStage` and `UnitOfWorkStage`, `DomainEventPhase`, `DomainEventSubscription`, `SaveAfterCommitError`, `AfterCommitFailure`, `reportAfterCommitFailures`, `InMemoryDomainEventDispatcher` |
20
+ | Actor | `Actor`, `AuthorizedCommand`, `AuthorizedQuery`, `ActorContext` |
21
+ | Standard interfaces | `Session`, `ExecutionContext` and `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `Lock`, `RateLimiter`, `Page` and `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` and `AuditEntry` |
22
+ | Scheduled jobs | `JobScheduler`, `ScheduledJob`, `JobExecution`, `JobSchedule`, `JobOptions`, `JobDefinition`, `JobRun`, `JobDescription`, `parseJobSchedule`, `describeJobSchedule`, `jobPolicy`, `executionContextOfJob` |
23
+ | Read side | `Criteria`, `defineCriteria`, `validateCriteria`, `scoped`, `planCriteria`, `evaluateCriteria`, `pageOfPlan`, `hydrate`, `ReadModelStore`, `stampOf`, `TableReadModelStore`, `ProjectionRebuild`, `InMemoryReadModelStore` (see "Criteria", "Hydration" and "Projections") |
24
+ | Persistence helpers | `optimisticUpdate`, `schemaNameOf`, `stampCreation`, `stampUpdate`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
25
+ | Error reporting | `ErrorReporter`, `ErrorReport`, `errorReportOf`, `reportOnce`, `isUnexpectedError`, `errorReportingMiddleware`, `DeadLetterReports`, `reportProcessFailures`, `NoopErrorReporter` |
26
+ | Doubles | `FixedClock`, `SequentialIdGenerator`, `InMemoryUnitOfWork`, `FixedActorContext`, `FixedExecutionScope`, `InMemoryLogger`, `InMemoryMetrics`, `InMemoryErrorReporter`, `InMemoryCache`, `InMemoryLock`, `InMemoryRateLimiter` |
27
+ | Declarations (`@ddd-ts-kit/kernel/declarations`) | `Requires`, `Public`, `CommandHandler`, `QueryHandler`, `IntegrationEventHandler`, `DomainEventHandler`, `Scheduled`, `Projection`, `On`, `Repository`, `Gateway`, `Adapter`, `Policy`, `declarationOf`, `listDeclarations`, `Token`, `describeToken`, `tokenIdentity`, `portDefect` |
28
+
29
+ The rules these blocks serve are in `docs/ARCHITECTURE.md`.
30
+
31
+ ## Domain events and the unit of work
32
+
33
+ An effect of a domain event exists only if the state change that recorded it is committed.
34
+
35
+ An aggregate records its events; nothing in a use case hands them over. A repository wrapped
36
+ by `dispatchingOnSave(repository, () => dispatcher)` pulls them itself, once a method that was
37
+ handed the aggregate has resolved:
38
+
39
+ ```ts
40
+ const orders = dispatchingOnSave(new KnexOrderRepository(db), () => dispatcher);
41
+
42
+ await unitOfWork.run(async () => {
43
+ await orders.save(order); // persisted; the events `order` recorded are queued
44
+ await orders.saveAll([first, second]);
45
+ await orders.remove(order); // a "deleted" event is queued with the removal
46
+ }); // dispatched here, in recording order, before the commit
47
+ ```
48
+
49
+ `kernelModule()` of `@ddd-ts-kit/di` applies it to every binding of kind `repository`, so an
50
+ application never writes this line; the table of what it guarantees (ordering, re-entrancy,
51
+ failures, wrapper order) is in the README of that package. In short:
52
+
53
+ - Inside a unit of work a save only queues, in recording order across all the saves. Once the
54
+ work has returned, still inside the transaction, the queue is dispatched: every handler sees
55
+ every save. Events recorded by handlers that save wait behind the others, in the same order,
56
+ without recursion. Then the transaction commits.
57
+ - The events are pulled only when the call succeeded. The first `before-commit` handler that
58
+ fails rejects the unit of work; so does the work, a later save or the commit. The queued
59
+ events are then dropped and never put back on the aggregates: a retry reloads them.
60
+ - Outside any unit of work the save dispatches before it resolves, `before-commit` handlers
61
+ then `after-commit` ones.
62
+
63
+ `pullEvents()` stays public for this wrapper and for the specs of an aggregate; a use case and
64
+ a repository adapter never call it. An aggregate is recognised by what it does (it has
65
+ `pullEvents`), so a context compiled against another copy of the kernel is followed too.
66
+
67
+ ### Two phases
68
+
69
+ | Phase | Declared | Runs | A failure |
70
+ |---|---|---|---|
71
+ | `before-commit` (default) | `dispatcher.on(name, callback)` | at the end of the unit of work, inside its transaction | fails the command; everything rolls back |
72
+ | `after-commit` | `dispatcher.on(name, callback, { phase: 'after-commit' })` | once the transaction has committed, never when it rolled back, in dispatch order, awaited before the command answers | never fails the command: reported, and the other handlers still run |
73
+
74
+ With declarations the phase is an option of the decorator:
75
+ `@DomainEventHandler(OrderPaid, { name: 'ordering.order.paid', phase: 'after-commit' }, [Cache])`.
76
+
77
+ The `after-commit` phase is at most once: a crash between the commit and the run loses it. What
78
+ must not be lost goes through the outbox as an integration event. A `before-commit` handler
79
+ may only have effects the transaction covers, because the commit can still fail after it ran
80
+ (`domain-events/transactional-before-commit`).
81
+
82
+ `DomainEventDispatcher.dispatch(events, phase?)` runs the handlers of one phase,
83
+ `before-commit` by default. `InMemoryDomainEventDispatcher(failed?)` is told each failure of an
84
+ `after-commit` handler and keeps the last hundred in `afterCommitFailures`, for specs.
85
+ `reportAfterCommitFailures({ reporter, logger, scope? })` is the `failed` to give it wherever a
86
+ logger and an error reporter exist: one `Logger.error` entry ("A domain event handler failed
87
+ after the commit", with `domainEvent`, `errorType`, `errorCode`) and the error handed to the
88
+ `ErrorReporter` under the operation `after-commit <event name>`.
89
+
90
+ An `after-commit` handler that hands an aggregate to a wrapped repository (`save`, `saveAll`,
91
+ `remove(aggregate)`) is refused before the write with `SaveAfterCommitError`: the unit of work
92
+ is over. It sends a command through the `CommandBus`, which opens a unit of work of its own.
93
+ `unitOfWorkStage()` answers `'outside'`, `'open'`, `'before-commit'` or `'after-commit'`.
94
+
95
+ ### A unit of work of your own
96
+
97
+ The queue lives in an `AsyncLocalStorage` scope opened by `withinUnitOfWork(work, transaction)`.
98
+ `InMemoryUnitOfWork` and the units of work of the ORM packages are built on it, so a `run`
99
+ called directly (a consumer, a script) has the timing of a command. `unitOfWorkMiddleware`
100
+ calls it too: a command is covered even with a `UnitOfWork` that does not. A nested `run`, or a
101
+ command sent from inside a unit of work, joins the scope in progress: one dispatch, at the end
102
+ of the outermost, and the `after-commit` phase after the outermost commit. Two concurrent
103
+ commands never share a scope.
104
+
105
+ A `UnitOfWork` written in a project builds `run` on it. `transaction` begins, calls what it is
106
+ given, commits when it resolved and rolls back when it rejected:
107
+
108
+ ```ts
109
+ run<T>(work: () => Promise<T>): Promise<T> {
110
+ return withinUnitOfWork(work, (scoped) => {
111
+ if (this.current.getStore() !== undefined) { // nested: join the transaction
112
+ return scoped();
113
+ }
114
+
115
+ return this.database.transaction((transaction) => this.current.run(transaction, scoped));
116
+ });
117
+ }
118
+ ```
119
+
120
+ `unitOfWorkContract` of `@ddd-ts-kit/testing/contracts` fails an adapter that forgot.
121
+
122
+ ## Declarations
123
+
124
+ A class says what it is, and the composition root is assembled from what the classes say.
125
+ `@ddd-ts-kit/kernel/declarations` holds the decorators that record it. They are pure metadata:
126
+ a declaration instantiates nothing, resolves nothing, reads no configuration and knows no
127
+ container. That is why they live here, where the application layer may import them. Turning
128
+ declarations into bindings is the job of `@ddd-ts-kit/di` (`contextModule`,
129
+ `discoverContext`), and of nothing else.
130
+
131
+ ```ts
132
+ // contexts/ordering/domain/repositories/order.repository.ts
133
+ import { Repository } from '@ddd-ts-kit/kernel';
134
+ import type { Order } from '@/contexts/ordering/domain/aggregates/order.aggregate.js';
135
+
136
+ export abstract class OrderRepository extends Repository<Order> {
137
+ abstract findOpenOf(customerId: string): Promise<readonly Order[]>;
138
+ }
139
+ ```
140
+
141
+ ```ts
142
+ // contexts/ordering/application/commands/place-order/place-order.handler.ts
143
+ import { Clock } from '@ddd-ts-kit/kernel';
144
+ import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
145
+ import { OrderRepository } from '@/contexts/ordering/domain/repositories/order.repository.js';
146
+ import { PlaceOrder } from '@/contexts/ordering/application/commands/place-order/place-order.command.js';
147
+
148
+ @CommandHandler(PlaceOrder, [OrderRepository, Clock])
149
+ export class PlaceOrderHandler implements CommandHandler<PlaceOrder> {
150
+ constructor(
151
+ private readonly orders: OrderRepository,
152
+ private readonly clock: Clock,
153
+ ) {}
154
+
155
+ async execute(command: PlaceOrder): Promise<string> { /* ... */ }
156
+ }
157
+ ```
158
+
159
+ ```ts
160
+ // contexts/ordering/infrastructure/persistence/knex-order.repository.ts
161
+ import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
162
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
163
+ import { Database } from '@/contexts/ordering/application/ports/database.port.js';
164
+ import { OrderRepository } from '@/contexts/ordering/domain/repositories/order.repository.js';
165
+
166
+ @Repository(OrderRepository, [Database, ExecutionScope, Clock])
167
+ export class KnexOrderRepository implements OrderRepository {
168
+ constructor(
169
+ private readonly database: Database,
170
+ private readonly scope: ExecutionScope,
171
+ private readonly clock: Clock,
172
+ ) {}
173
+
174
+ /* findById, save, findOpenOf */
175
+ }
176
+ ```
177
+
178
+ `Repository` is two things under one name, each in its entry: the abstract class a repository
179
+ port extends (main entry, imported by the port) and the decorator of its adapter (this entry,
180
+ imported by the adapter). No file needs both.
181
+
182
+ ### Ports and tokens
183
+
184
+ **A port is an abstract class, and the class is the injection token.** The class names the
185
+ dependency and carries its type: a dependency list is checked against a constructor, and
186
+ `app.resolve(Clock)` answers a `Clock`. `Token<T>` is that type: `abstract new (...args: never) => T`.
187
+ There is no token constant and no token file. A port has one place, one abstract class per file:
188
+
189
+ | Port | File |
190
+ |---|---|
191
+ | a repository of the domain | `domain/repositories/*.repository.ts` |
192
+ | any other port, and a value class | `application/ports/*.port.ts` |
193
+
194
+ ```ts
195
+ // contexts/ordering/application/ports/payment-gateway.port.ts
196
+ export abstract class PaymentGateway {
197
+ abstract charge(orderId: string, amount: Money): Promise<PaymentReceipt>;
198
+ }
199
+ ```
200
+
201
+ **The port rule.** A port has abstract members only: no body, no constructor parameter, no
202
+ private or protected member. A port may extend another port. An adapter `implements` its port
203
+ and never `extends` it. The type stays structural, so a fake, an in-memory class or a plain
204
+ object literal stands for a port without ceremony.
205
+
206
+ **`Repository<A, Id>`** is the contract every repository shares (`findById`, `save`), as an
207
+ abstract class. The repository port of an aggregate extends it and adds its own finders, as
208
+ `OrderRepository` above; the adapter implements that port.
209
+
210
+ **A value that is no port** (a configuration object, a database handle, a list, a primitive)
211
+ is typed by an abstract class too, with `abstract readonly` properties, and a plain object is
212
+ bound to it with `toValue` of `@ddd-ts-kit/di`:
213
+
214
+ ```ts
215
+ // contexts/ordering/application/ports/database.port.ts
216
+ export abstract class Database {
217
+ abstract readonly client: Knex;
218
+ }
219
+
220
+ // contexts/ordering/application/ports/payment-settings.port.ts
221
+ export abstract class PaymentSettings {
222
+ abstract readonly apiKey: string;
223
+ }
224
+
225
+ // composition root
226
+ builder.bind(Database).toValue({ client: knex });
227
+ builder.bind(PaymentSettings).toValue({ apiKey: configuration.paymentApiKey });
228
+ ```
229
+
230
+ That is the one way: no string token, no symbol token, no helper.
231
+
232
+ **Identity across copies.** A class is its own identity, and two copies of a package loaded in
233
+ one process (a duplicated install, a bundle next to `node_modules`) hold two classes. A port
234
+ that declares `static readonly tokenKey = '<package>.<Port>'` is known by that key instead,
235
+ the same in every copy: `tokenIdentity(port)` answers what a container keys by, and
236
+ `describeToken(port)` its name. Every injectable port of the kernel carries one (`kernel.Clock`,
237
+ `kernel.CommandBus`, ...); `Repository<A, Id>` is a base to extend, never a token, and carries
238
+ none.
239
+
240
+ ```ts
241
+ export abstract class PaymentGateway {
242
+ static readonly tokenKey = 'ordering.PaymentGateway';
243
+
244
+ abstract charge(orderId: string, amount: Money): Promise<PaymentReceipt>;
245
+ }
246
+ ```
247
+
248
+ The limit, plainly: **a port of your own that declares no `tokenKey` and is loaded twice is
249
+ two tokens.** What is bound under one copy is not found under the other. An application
250
+ compiled as one program never meets it; a port published in a package that may be installed
251
+ twice, or bundled next to `node_modules`, declares a `tokenKey`. The key is the identity: two
252
+ ports that declare the same key are the same token, so prefix it with the package or the
253
+ context. It is declared, never inherited: a port that extends a keyed port declares its own.
254
+
255
+ When to declare one: only for a port that one process may load from two copies of its package.
256
+ A port of an application, compiled once into one program, never declares a key: the class is
257
+ identity enough, and a key would only be a name to keep unique by hand.
258
+
259
+ A port that extends a port of the kernel declares its key as any other does, without
260
+ `override`: the kernel ports carry theirs as an own property that is not a declared member
261
+ (`kernel.<ClassName>`, set in a static block), so nothing is overridden.
262
+
263
+ ```ts
264
+ export abstract class OrderRepository extends Repository<Order> {
265
+ static readonly tokenKey = 'ordering.OrderRepository';
266
+ }
267
+
268
+ export abstract class BusinessClock extends Clock {
269
+ static readonly tokenKey = 'ordering.BusinessClock';
270
+ }
271
+ ```
272
+
273
+ **What the compiler refuses**, in both decorator modes:
274
+
275
+ - a dependency list that does not name one port per constructor parameter, each of the type of
276
+ its parameter, in order: a missing list, a missing or extra entry, a wrong type, a wrong order;
277
+ - a class that does not implement the port it is declared the adapter of, and an abstract class;
278
+ - a concrete class named where its port is expected: `[InMemoryOrderRepository, Clock]` for a
279
+ parameter typed `OrderRepository`. A list names ports, never what implements them.
280
+
281
+ **What is refused when the file loads**, with a `DeclarationError` from `@Repository`,
282
+ `@Gateway` and `@Adapter`, because the compiler cannot see it:
283
+
284
+ - a port with a body: `TalkativePharmacy implements greet: a port is an abstract class with
285
+ abstract members only`. A member inherited from a parent port counts;
286
+ - an adapter that extends its port: `CornerPharmacy extends Pharmacy: an adapter implements
287
+ its port, it never extends it`.
288
+
289
+ `portDefect(port, implementation)` is that check, answering the reason or `undefined`; a
290
+ container applies it to a binding made by hand. A class bound to itself is no port and is
291
+ left alone.
292
+
293
+ ### The decorators
294
+
295
+ | Decorator | On | Example |
296
+ |---|---|---|
297
+ | `Requires(permission, options?)` | a command or query that carries its actor | `@Requires(permissions['visit.schedule'], { resource: (c: ScheduleVisit) => ({ type: 'patient', id: c.patientId }), audited: ['startsAt'] })` |
298
+ | `Public(options?)` | a command or query anybody may send | `@Public()` |
299
+ | `CommandHandler(Message, [ports])` | the one handler of a command | `@CommandHandler(PlaceOrder, [OrderRepository, Clock])` |
300
+ | `QueryHandler(Message, [ports])` | the one handler of a query | `@QueryHandler(GetOrder, [OrderReadModel])` |
301
+ | `IntegrationEventHandler(definition, { consumer, actorOf? }, [ports])` | the handler of an integration event of another context | `@IntegrationEventHandler(OrderPlaced, { consumer: 'billing.invoice-on-order-placed' }, [CommandBus])` |
302
+ | `DomainEventHandler(Event, { name }, [ports])` | a handler of a domain event of its own context | `@DomainEventHandler(OrderPaid, { name: 'ordering.order.paid' }, [CommandBus])` |
303
+ | `Scheduled(name, schedule and options, [ports])` | a job run by time, which triggers use cases | `@Scheduled('billing.send-reminders', { cron: '0 7 * * 1-5', timeZone: 'Europe/Paris' }, [CommandBus])` |
304
+ | `Projection(name, [ports])` with `On(definition)` on its methods | a projector: the class that keeps one read model up to date | `@Projection('scheduling.appointment-list', [AppointmentList])`, `@On(PaymentCaptured)` |
305
+ | `Repository(Port, options?, [ports])` | the adapter of a repository of the domain | `@Repository(OrderRepository, [Database, ExecutionScope, Clock])` |
306
+ | `Gateway(Port, options?, [ports])` | the adapter of a port that calls another context | `@Gateway(StockGateway, [HttpClient])` |
307
+ | `Adapter(Port, options?, [ports])` | the adapter of any other port | `@Adapter(PaymentGateway, { kind: 'external' }, [PaymentSettings])` |
308
+ | `Policy(permission, { name }, [ports])` | a rule that needs the loaded element | `@Policy(permissions['invoice.void'], { name: 'billing.only-issuer-voids' })` |
309
+
310
+ - **Access is said on the message.** A command extends `Command` or `AuthorizedCommand`, a
311
+ query `Query` or `AuthorizedQuery`: the base class already says which of the two it is, so
312
+ the decorator only says who may send it. `@Requires` is refused by the compiler on a message
313
+ without an actor. `audited` lists the fields an audit trail may record (a name, or
314
+ `{ field, masked: true }`), as plain data; the compiler checks that the message has them.
315
+ - **Dependencies are a list of ports**, checked against the constructor as said above. The
316
+ list is left out for a constructor without parameters. There is no parameter decorator and
317
+ no reflection.
318
+ - **The role is checked too**: a handler of another message or of another result, an event
319
+ handler of another payload, a job without `run` are refused by the compiler.
320
+ - **Options of a repository, a gateway and an adapter**: `transient: true` (one instance per
321
+ resolution instead of one per application), `replaces: true` (takes the place of a binding
322
+ made earlier, such as a default of the kernel module), `aspects: [...]` (wrappers, the first
323
+ outermost); an adapter also takes `kind: 'external' | 'publisher'`.
324
+ - **One name for the decorator and for the shape of its class**: `CommandHandler`,
325
+ `QueryHandler`, `IntegrationEventHandler` and `DomainEventHandler` are each a decorator and a
326
+ type, so one import serves `@IntegrationEventHandler(OrderPlaced, ...)` and
327
+ `implements IntegrationEventHandler<OrderPlacedPayload>`. A job implements `ScheduledJob`.
328
+ - **Names are written, not derived**: the consumer name, the policy name, the job name and the
329
+ name of the domain event survive the renaming of a class, and the empty string is refused.
330
+ - **A declared class is its own token**: `@ddd-ts-kit/di` binds a handler, a job or a policy
331
+ under its class.
332
+
333
+ `declarationOf(Class)` answers what a class declared, as frozen plain data, or `undefined`;
334
+ `listDeclarations()` lists the declared classes the process still holds, for diagnostics. A
335
+ class plays one role: a second declaration on the same class throws `DeclarationError` when
336
+ the file loads, and so does `@Requires` or `@Public` on what is neither a `Command` nor a
337
+ `Query`, and `@Scheduled` with a name or a schedule that cannot be read. A declaration is not
338
+ inherited by a subclass.
339
+
340
+ The names of the main entry differ on purpose: there, `IntegrationEventCallback` and
341
+ `DomainEventCallback` are the plain functions given to `subscribe` and to `on`, and
342
+ `CommandHandler` and `QueryHandler` are the interfaces alone.
343
+
344
+ **Where it is stored.** In one registry per process, reached through `Symbol.for`, with the
345
+ classes held weakly. A context compiled against one copy of the kernel is therefore read by a
346
+ container holding another (a duplicated install, a bundle next to `node_modules`), and a module
347
+ reloaded by a watcher leaves no trace of its former classes. `Symbol.metadata` is not used:
348
+ Node 24 does not define it, and the legacy decorator mode has no context to carry it.
349
+
350
+ **Not in the domain.** `domain/` carries no decorator: aggregates, entities, value objects,
351
+ domain events, domain services and repository ports declare nothing. A domain event is
352
+ named by the handler that reacts to it, not by itself. `@UseCase` does not exist: the
353
+ canonical tree has one handler per command and no application service to bind.
354
+
355
+ ### Integration events and their subscribers
356
+
357
+ `IntegrationEventPublisher` is what use cases publish through, `IntegrationEventSubscriber`
358
+ what handlers are subscribed on, and `EventBus` both at once. `EventSubscribers` gives each
359
+ bounded context its subscriber: `forContext(name)` answers an `IntegrationEventSubscriber`.
360
+ One bus serves every context by default; a broker gives each consuming context its own, so
361
+ that a context extracted into its own process keeps its queues. `@ddd-ts-kit/di` subscribes
362
+ the integration event handlers of a context on `EventSubscribers.forContext(<context name>)`.
363
+
364
+ ### Scheduled
365
+
366
+ ```ts
367
+ // contexts/billing/application/scheduling/send-reminders.job.ts
368
+ @Scheduled('billing.send-reminders', { cron: '0 7 * * 1-5', timeZone: 'Europe/Paris' }, [CommandBus])
369
+ export class SendRemindersJob implements ScheduledJob {
370
+ constructor(private readonly commands: CommandBus) {}
371
+
372
+ async run(execution: JobExecution): Promise<void> {
373
+ await this.commands.execute(new SendReminders(systemActor('billing.send-reminders'), execution.scheduledAt));
374
+ }
375
+ }
376
+ ```
377
+
378
+ A job lives in `application/scheduling/`, in a `*.job.ts` file, and only triggers use cases:
379
+ it receives buses and ports by its dependency list and typically sends one command. The second
380
+ argument is the schedule and, next to it, the options:
381
+
382
+ | Key | Default | |
383
+ |---|---|---|
384
+ | `every` | | an interval, as milliseconds or `'30s'`, `'15m'`, `'2h'`, `'1d'`, aligned on the Unix epoch |
385
+ | `cron`, `timeZone` | `timeZone: 'UTC'` | the five standard fields, on the clocks of an IANA zone |
386
+ | `overlap` | `'skip'` | an occurrence that comes while the previous run is in progress is skipped, or `'queue'`d behind it |
387
+ | `missed` | `'skip'` | occurrences that passed without being reached are dropped, or the latest is `'run-once'` |
388
+ | `timeoutMs` | none | the signal of a longer run is aborted |
389
+ | `jitterMs` | `0` | a random delay before each run |
390
+ | `enabled` | `true` | meant to be overridden by configuration where the job is wired |
391
+ | `singleInstance` | `true` | the scheduler takes the `Lock` of each occurrence |
392
+
393
+ Exactly one of `every` and `cron` is written, and the compiler refuses the rest. The name is
394
+ `<context>.<job-name>` in lower case, unique in the application. `JobExecution` is what `run`
395
+ receives: `scheduledAt`, `startedAt`, `attempt` and an abort `signal`. What the schedules mean
396
+ across a change of clocks, what one instance among several guarantees and how a job is tested
397
+ are in the README of `@ddd-ts-kit/scheduling`.
398
+
399
+ ### Decorator modes
400
+
401
+ Every decorator of this entry works under both decorator modes of TypeScript, and the same
402
+ source line type-checks under both, checks of the role and of the dependency list included.
403
+
404
+ | Stack | `tsconfig.json` |
405
+ |---|---|
406
+ | class-validator, NestJS, TypeORM entities, any library with legacy decorators | `"experimentalDecorators": true` |
407
+ | anything else | leave `experimentalDecorators` unset: standard (TC39) decorators need no flag |
408
+
409
+ One program has one mode, which is why the kit follows the project instead of choosing. A
410
+ class decorator receives the class first in both modes; the standard call adds a context,
411
+ which these decorators do not read. Nothing else differs: no `emitDecoratorMetadata`, no
412
+ `reflect-metadata`, no parameter decorator in either mode. Both are compiled by TypeScript 5,
413
+ 6 and the native TypeScript 7. Under Vitest, legacy decorators need nothing; standard ones
414
+ need `decorators()` of `@ddd-ts-kit/testing/vitest`.
415
+
416
+ ## Standard interfaces
417
+
418
+ Standard means that every project built with the kit has the same shape under the same name, so
419
+ an adapter, a middleware or a dashboard written once fits them all. Extensible means that a
420
+ project adds its own fields without forking the type (see "How to extend").
421
+
422
+ ### Session
423
+
424
+ The authenticated session of an actor, as plain data.
425
+
426
+ | Field | |
427
+ |---|---|
428
+ | `id`, `actor`, `issuedAt`, `expiresAt?` | who, since when, until when |
429
+ | `authenticationMethod` | `none`, `password`, `sso`, `token`, `api-key`, `service`, or a string of the project |
430
+ | `authenticationStrength?` | `{ mfa?, assuranceLevel? }` |
431
+ | `impersonatedBy?` | id of the support actor acting as `actor`; `logFieldsOf` carries it to every log line |
432
+ | `locale?`, `timeZone?`, `client?` | BCP 47 tag, IANA zone, `{ ip?, userAgent? }` as opaque strings |
433
+ | `extensions` | the fields of the project |
434
+
435
+ `isExpired(session, clock.now())`, `isImpersonated(session)`, `anonymousSession()`,
436
+ `systemSession(name, issuedAt?)`, and `isSession(value)`, the structural guard a boundary uses on
437
+ what it received as a principal.
438
+
439
+ ### ExecutionContext and ExecutionScope
440
+
441
+ What every unit of work carries, whatever started it: `correlationId`, `causationId?`, `actor`,
442
+ `session?`, `tenantId?`, `locale?`, `deadline?`, `scheduledAt?` (for a scheduled job, the instant it
443
+ was due), `origin` (`http`, `event`, `schedule`, `cli`, or a string of the project) and `extensions`. `executionContext(init)` builds one and takes the tenant
444
+ of the actor; `withActor(context, actor)` is the same work seen as another actor.
445
+
446
+ `ExecutionScope` (`current()`, `require()`, `run(context, work)`) gives the context of the work
447
+ in progress to code that is not handed it. The boundary sets it once:
448
+
449
+ ```ts
450
+ // presentation or platform: one run per request, consumed event, job
451
+ scope.run(executionContext({ correlationId, actor, session, origin: 'http' }), () => handle(request));
452
+ ```
453
+
454
+ ```ts
455
+ // infrastructure: a repository adapter
456
+ const row = { ...toRow(order), ...stampCreation(scope, clock), ...tenantScopeOf(scope) };
457
+ ```
458
+
459
+ Use cases and the domain never read the scope: they receive the actor, and anything else they
460
+ need, in the command or query (`authz/actor-explicit`). The scope is for loggers, audit columns,
461
+ tenant scoping and outgoing headers.
462
+
463
+ A consumed event opens its own context: `executionContextOfEvent(event, { consumer })` has
464
+ origin `event`, the correlation of the event (its id when it names none), the event as
465
+ `causationId` and `systemActor(consumer)` as actor; `inEventScope(scope, { consumer }, handler)`
466
+ wraps a handler with it. The standard envelope carries no actor, so that no personal data
467
+ travels by default: a project whose envelopes name one passes `actorOf`. On the way out,
468
+ `scopedPublisher(publisher, scope)` stamps the correlation of the work in progress on every
469
+ event published without one, so everything one stimulus causes is found again across processes.
470
+
471
+ `ActorContext` stays, unchanged. `ScopedActorContext` implements it on top of a scope: the
472
+ current actor is the actor of the current execution context, so the two cannot disagree.
473
+ `AsyncLocalStorageExecutionScope` follows the asynchronous call chain; `FixedExecutionScope` is
474
+ the test double, and follows a `FixedActorContext` when given one.
475
+
476
+ ### Logger
477
+
478
+ `debug`, `info`, `warn`, `error(message, fields?)`, `child(fields)`, `isLevelEnabled(level)` and
479
+ `flush()`. `LogFields` spells the well-known keys once: `correlationId`, `causationId`,
480
+ `context`, `actorId`, `tenantId`, `errorType`, `errorCode`, `durationMs`; any other key is
481
+ accepted. A call never throws, whatever the fields: when they cannot be read or serialized the
482
+ entry is written with `UNWRITABLE_FIELDS` (`logError: "unserializable fields"`) in their place.
483
+ The kernel never writes to the console: `NoopLogger` is the default, `InMemoryLogger` records
484
+ `entries` for a test, a JSON lines adapter is in `@ddd-ts-kit/aspects`, and `@ddd-ts-kit/pino`
485
+ and `@ddd-ts-kit/winston` are the adapters of those libraries. The domain and use cases do not
486
+ log.
487
+
488
+ **Errors are log values.** `LogValue` admits an `Error`, so
489
+ `logger.error('payment failed', { error })` compiles as it is, and a project may name the key
490
+ once (`interface LogFields { error?: Error }`, see "Extending"). An `Error` directly under a
491
+ key of the fields is written by every logger as `describeError(error)` describes it, an
492
+ `ErrorDescription`:
493
+
494
+ | Key | |
495
+ |---|---|
496
+ | `type` | the class name |
497
+ | `code` | the `code` of a `DomainError`; absent for any other error |
498
+ | `message` | the message |
499
+ | `stack` | the stack of this error alone |
500
+ | `cause` | the cause, described the same way when it is an `Error`: eight errors deep at most, so a chain that loops ends |
501
+
502
+ Deeper in the fields (inside a nested object or a list) an error is left to the serializer of
503
+ the adapter: pass it under a key. `describeErrorFields(fields)` is the copy of the fields a
504
+ logger writes; an adapter of your own calls it and is held to the result by `loggerContract`.
505
+
506
+ **Messages of unexpected errors can be dropped.** Every logger of the kit takes
507
+ `scrubMessages: true` (`DescribeErrorOptions`): the message of every error that is not a
508
+ `DomainError` becomes `SCRUBBED_MESSAGE` (`[message removed]`) and its stack loses its first
509
+ line, which repeats it. Messages of `DomainError`s are written by the project and stay. It is
510
+ the option of the same name of `@ddd-ts-kit/sentry`, with the same rule and the same marker.
511
+ The default keeps the messages: a log that says `[message removed]` costs every investigation.
512
+
513
+ **What the kit logs on its own never holds a message.** The `logged` aspect,
514
+ `loggingMiddleware` and the job scheduler never hand an error to a logger: they write
515
+ `errorType` and `errorCode`, as `identifyError(error)` gives them, and the error itself goes to
516
+ the `ErrorReporter`. That holds whatever `scrubMessages` says. The full description is for the
517
+ error a project decides to log, in an adapter or a route; scrubbing is its opt-in for logs that
518
+ leave its hands.
519
+
520
+ **`isLevelEnabled(level)`** says whether an entry of that level would be written, for the
521
+ logger and its children. Ask it before building fields that cost; the kit does, in `logged`,
522
+ `loggingMiddleware` and the scheduler. `NoopLogger` answers `false`.
523
+
524
+ **`flush()`** resolves once every entry logged so far, through the logger or a child, was
525
+ handed to its destination, and never rejects. It is called once, when the process stops, after
526
+ the last entry: the application of `@ddd-ts-kit/di` calls it at the end of `stop()`. What is
527
+ logged after a flush is unspecified, and never throws: pino and `StdoutLogger` still write it,
528
+ winston, whose flush ends the logger, drops it. A second call resolves too.
529
+
530
+ `InMemoryLogger` takes `{ level?, fields?, base?, scrubMessages? }` like a real adapter: a
531
+ threshold (default `debug`, every entry), fields read at each entry, fields added to every
532
+ entry. Its `entries` hold what a logger writes: an error passed as a field is recorded as its
533
+ description. `CREDENTIAL_KEYS` and `REDACTED` are the field names and the marker the pino and
534
+ winston adapters redact with; `StdoutLogger` and `InMemoryLogger` redact nothing.
535
+
536
+ ### Metrics
537
+
538
+ `counter(name).increment(labels?, by?)`, `histogram(name).record(value, labels?)`,
539
+ `gauge(name).set(value, labels?)`. Label values come from a small closed set, never an
540
+ identifier. `NoopMetrics` is the default; `InMemoryMetrics` records `samples` and answers
541
+ `counterValue`, `histogramValues` and `gaugeValue` for a subset of labels.
542
+
543
+ ### ErrorReporter
544
+
545
+ `report(error, report)` and `flush(timeoutMs)`: where unexpected failures go to be looked at,
546
+ an error tracker. `report` is synchronous: it queues and returns, never throws and never waits
547
+ for the tracker; `flush` waits for the queue before the process stops and never rejects.
548
+ `ErrorReport` is plain data, identifiers only: `origin`, `operation`, `context`,
549
+ `correlationId`, `traceId`, `actorId`, `tenantId`, `errorCode`, `severity` (`fatal`, `error`,
550
+ `warning`) and the project's `extensions`. `NoopErrorReporter` is the default,
551
+ `InMemoryErrorReporter` records `reports` for a test, and `@ddd-ts-kit/sentry` is the adapter
552
+ for Sentry and GlitchTip.
553
+
554
+ No handler, aggregate or repository calls it: they throw. What stands around them reports,
555
+ each attached from outside:
556
+
557
+ | Capture point | Is | Reports |
558
+ |---|---|---|
559
+ | buses | `errorReportingMiddleware(reporter, scope)`, first on the bus | a command or query failing with anything but a `DomainError`; silent while an event is consumed |
560
+ | HTTP | `reportHttpErrors(reporter)` of `@ddd-ts-kit/http`, as `onError` | every request answered 5xx |
561
+ | jobs | `reportFailedRuns(reporter)` of `@ddd-ts-kit/scheduling`, as `onRun` | a run that failed with anything but a `DomainError` |
562
+ | events | `new DeadLetterReports(reporter)`: `onFailure` on the hook of the provider, `observing(subscriber)` around its subscriber | an event its provider gives up, never a retried delivery |
563
+ | process | `reportProcessFailures(reporter)` | `uncaughtException` and `unhandledRejection`, then exit code 1 after a flush |
564
+
565
+ A `DomainError` is a business refusal and is never reported, unless HTTP answers it as a 5xx or
566
+ it buries an event (a `warning`). All of them go through `reportOnce`: the first capture point
567
+ that sees an error object reports it, the boundaries it crosses afterwards recognise it, so a
568
+ command failing inside a request or a job is one report, named after the command.
569
+ `errorReportOf(error, source, executionContext?)` builds the report: origin, correlation, actor
570
+ and tenant ids come from the execution context, never threaded by hand.
571
+
572
+ ### Cache
573
+
574
+ ```ts
575
+ const quoteKey = (pair: string) => cacheKey<Quote>('quote', pair);
576
+
577
+ await cache.set(quoteKey('EUR-USD'), quote, { ttlMs: 60_000 });
578
+ const hit: Quote | undefined = await cache.get(quoteKey('EUR-USD'));
579
+ ```
580
+
581
+ The key carries the type of its value. `InMemoryCache(clock, { maxEntries? })` expires by the
582
+ `Clock` and is bounded.
583
+
584
+ ### Lock
585
+
586
+ ```ts
587
+ const handle = await lock.acquire('nightly-export', { ttlMs: 60_000, waitMs: 0 });
588
+ if (handle === undefined) { // somebody else holds the key
589
+ return;
590
+ }
591
+ try {
592
+ await exportEverything();
593
+ } finally {
594
+ await handle.release();
595
+ }
596
+ ```
597
+
598
+ A mutex between processes, to avoid doing the same work twice. `acquire` answers `undefined`
599
+ when the key is held, at once or after `waitMs`; the lock frees itself after `ttlMs`; the
600
+ `fencingToken` of a `LockHandle` grows with each acquisition of a key, so a resource that
601
+ remembers the highest one refuses a holder whose lock expired. It is an efficiency tool, never
602
+ the guard of an invariant: what must not happen twice is refused by a database constraint.
603
+
604
+ `InMemoryLock(clock, { retryDelayMs?, sleep? })` excludes inside one process and expires by the
605
+ `Clock`: the fake, and enough for a single instance. The adapter between processes is in
606
+ `@ddd-ts-kit/redis`. `acquiring(attempt, waitMs, waiting)` is the retry loop an adapter shares.
607
+
608
+ ### JobScheduler
609
+
610
+ ```ts
611
+ abstract class JobScheduler {
612
+ abstract register(job: JobDefinition): void; // { name, schedule, run, ...options }
613
+ abstract start(): Promise<void>;
614
+ abstract stop(): Promise<void>; // waits for the runs in progress, then aborts their signal
615
+ abstract runNow(name: string): Promise<JobRun>; // for an operation or a test
616
+ abstract describe(): readonly JobDescription[]; // name, schedule, enabled, running, nextRunAt, lastRun
617
+ }
618
+ ```
619
+
620
+ What runs the declared jobs when they are due. It is not the `Scheduler` of
621
+ `@ddd-ts-kit/aspects`, which is a timer for retry and timeout: this one knows jobs, schedules
622
+ and instances. A `JobRun` is one occurrence and its outcome (`succeeded`, `failed` with the
623
+ code of the error and never its message, `skipped-overlap`, `skipped-locked`, `missed`). A job
624
+ that fails stops neither the scheduler nor the other jobs, and `runNow` answers `failed`
625
+ instead of rejecting: only an unknown name rejects (`UnknownJobError`), and a name registered
626
+ twice throws (`DuplicateJobError`).
627
+
628
+ A run happens inside `ExecutionScope`, in the context `executionContextOfJob(name, { correlationId,
629
+ scheduledAt, deadline? })` builds: origin `schedule`, `systemActor(name)`, a correlation of its
630
+ own, and `scheduledAt`, the instant the run was due, which `ExecutionContext` carries for this
631
+ origin.
632
+
633
+ `parseJobSchedule(schedule)` validates a schedule and answers the form occurrences are
634
+ computed from (`InvalidJobScheduleError`, code `INVALID_JOB_SCHEDULE`, otherwise);
635
+ `describeJobSchedule(schedule)` is its text; `jobPolicy(options)` validates the options and
636
+ fills in the defaults. The kernel holds no scheduler: the in-process one, the computation of
637
+ occurrences and the manual one for tests are `@ddd-ts-kit/scheduling`, and the contract of the
638
+ port is `jobSchedulerContract` of `@ddd-ts-kit/testing/contracts`.
639
+
640
+ ### RateLimiter
641
+
642
+ ```ts
643
+ const decision = await limiter.consume(`password-reset:${accountId}`, { limit: 3, windowMs: 3_600_000 });
644
+ if (!decision.allowed) {
645
+ throw new TooManyAttempts(decision.retryAfterMs);
646
+ }
647
+ ```
648
+
649
+ A sliding window: at any instant, at most `limit` allowed calls in the `windowMs` before it. A
650
+ `RateLimitDecision` is `{ allowed, remaining, retryAfterMs }`; a refused call is not counted.
651
+ The key is whatever is limited: a client, a tenant, a route and an address together.
652
+
653
+ `InMemoryRateLimiter(clock)` counts inside one process; the adapter shared by several instances
654
+ is in `@ddd-ts-kit/redis`. `rateLimitDecisionOf(counted, limit)` turns what an adapter counted
655
+ into the decision.
656
+
657
+ ### Page and PageRequest
658
+
659
+ One shape for every search, in two variants:
660
+
661
+ ```ts
662
+ offsetPage({ offset: 40, limit: 20, sort: [{ field: 'placedAt', direction: 'desc' }] });
663
+ cursorPage({ cursor, limit: 50 });
664
+ // both answer a Page<T>: { items, total?, nextCursor? }
665
+ ```
666
+
667
+ A cursor is opaque to the client and plain to the reader: `encodeCursor(position)` writes the
668
+ sort values of the last item of a page, `decodeCursor(cursor)` reads them back and refuses what
669
+ it did not write. It is not signed: the read port checks the types of what it decodes before
670
+ they reach a statement. **A cursor needs a total order**: append a unique key (the primary key)
671
+ to the sort, in the same direction, put it in the position, and compare the whole tuple. Rows
672
+ that are equal on the sort field otherwise have no defined order, and a page could repeat or
673
+ skip one of them. The adapter packages show the query for each ORM.
674
+
675
+ `offsetPage` and `cursorPage` validate and raise `InvalidPageRequestError`
676
+ (`INVALID_PAGE_REQUEST`) beyond `PageLimits` (default size 20, maximum 100). `pageOf(items, more)`
677
+ and `mapPage(page, map)` build and translate the answer. The sortable fields are a type
678
+ parameter, `PageRequest<'placedAt' | 'total'>`: they differ for each read port, which a global
679
+ augmentation could not express.
680
+
681
+ ### AuditStamp and TenantScoped
682
+
683
+ `AuditStamp` (`createdAt`, `createdBy`, `updatedAt`, `updatedBy`) and `TenantScoped` (`tenantId`)
684
+ are columns of a stored record, not properties of an aggregate. `stampCreation(scope, clock)`,
685
+ `stampUpdate(scope, clock)` and `tenantScopeOf(scope)` fill them in a repository adapter:
686
+
687
+ ```ts
688
+ // insert: who creates is also who last updated
689
+ const row = { ...toRow(order), ...tenantScopeOf(scope), ...stampCreation(scope, clock) };
690
+ // update: the two columns to set, the creation is left alone; the tenant is part of every condition
691
+ await update({ ...toRow(order), ...stampUpdate(scope, clock) }, { id: order.id, ...tenantScopeOf(scope) });
692
+ ```
693
+
694
+ `stampUpdate(stamp, scope, clock)` is the form for an adapter that holds the stored stamp (a
695
+ document store rewriting the whole record): it answers it whole, creation untouched.
696
+ `tenantScopeOf` raises `NoCurrentTenantError` for work that names no tenant, so a statement can
697
+ never run unscoped by omission. Every adapter package names the columns the same way:
698
+ `created_at`, `created_by`, `updated_at`, `updated_by`, `tenant_id`.
699
+
700
+ ### AuditTrail, AuditReader and AuditEntry
701
+
702
+ ```ts
703
+ abstract class AuditTrail {
704
+ abstract record(record: AuditRecord): Promise<void>;
705
+ }
706
+
707
+ abstract class AuditReader {
708
+ abstract search(filter: AuditFilter, page: PageRequest<AuditSortField>): Promise<Page<AuditEntry>>;
709
+ }
710
+ ```
711
+
712
+ The two ports of an audit trail and the shape of one entry (`AuditEntry`, `AuditRecord` for
713
+ what a source hands over, `AuditFilter`, and the types they name), so that code which records
714
+ or lists depends on the kernel alone. `AuditTrail` is append only and is fed by infrastructure
715
+ and cross-cutting code (a bus middleware, the authorization hook, an event subscription), never
716
+ by a use case or an aggregate. `AuditReader` is what a query handler depends on to list
717
+ entries. A project adds fields to every entry through `AuditEntryExtensions`.
718
+
719
+ The kernel holds no implementation: the hash chain, the sources, redaction, verification and
720
+ the stores, the in-memory one included, are `@ddd-ts-kit/audit`.
721
+
722
+ ### Not in the kernel
723
+
724
+ Feature flags have no port here. Their evaluation model (boolean or variant, targeting,
725
+ percentage, who the subject is) differs with each provider, and OpenFeature already is the
726
+ vendor-neutral contract: a project that needs flags declares a port in the context that reads
727
+ them, named after the decision it takes.
728
+
729
+ ## Criteria
730
+
731
+ A read of a read model, described once for every search: filters, a sort, a page. A criteria
732
+ knows field names and nothing of a store. It is not a specification: a specification is a
733
+ business predicate on an aggregate and lives in the domain; a criteria describes a read.
734
+
735
+ ```ts
736
+ // contexts/scheduling/application/ports/appointment-list.port.ts
737
+ import { ReadModelStore, defineCriteria } from '@ddd-ts-kit/kernel';
738
+
739
+ export interface AppointmentRow {
740
+ readonly id: string;
741
+ readonly status: 'booked' | 'confirmed' | 'cancelled';
742
+ readonly startsAt: Date;
743
+ readonly practitionerId: string;
744
+ readonly cancelledAt: Date | null;
745
+ readonly tenantId: string;
746
+ }
747
+
748
+ export const appointmentCriteria = defineCriteria<AppointmentRow>({
749
+ fields: {
750
+ id: { type: 'string' },
751
+ status: { type: 'string', filter: ['eq', 'in'], sortable: true },
752
+ startsAt: { type: 'instant', filter: ['gte', 'lt', 'between'], sortable: true },
753
+ practitionerId: { type: 'string', filter: ['eq'] },
754
+ cancelledAt: { type: 'instant', filter: ['isNull'], nullable: true },
755
+ tenantId: { type: 'string' },
756
+ },
757
+ defaultSort: [{ field: 'startsAt', direction: 'asc' }],
758
+ tieBreaker: 'id',
759
+ limits: { maxPageSize: 50 },
760
+ });
761
+
762
+ export abstract class AppointmentList extends ReadModelStore<AppointmentRow> {}
763
+ ```
764
+
765
+ ```ts
766
+ // contexts/scheduling/application/queries/search-appointments/search-appointments.handler.ts
767
+ const criteria = Criteria.of<AppointmentRow>()
768
+ .where('status', 'in', ['booked', 'confirmed'])
769
+ .where('startsAt', 'gte', query.from)
770
+ .or((any) => any.where('practitionerId', 'eq', query.practitionerId).where('cancelledAt', 'isNull', false))
771
+ .orderBy('startsAt', 'asc')
772
+ .page(query.page);
773
+
774
+ const scope = await this.access.scope(query.actor, permissions['appointment.read'], 'appointment');
775
+
776
+ return this.appointments.search(scoped(criteria, scope, { ids: 'id', filter: { tenantId: 'tenantId' } }));
777
+ ```
778
+
779
+ **Checked by the compiler.** `where` takes a field of the row, an operator that applies to
780
+ what the field holds, and a value of its type: `where('seats', 'contains', '2')`, an order on
781
+ a boolean, `isNull` on a field that is never null, a value outside a union of literals and a
782
+ field hydrated at query time are all refused. The same holds for a declaration: the type of
783
+ each field, its operators and `nullable` are checked against the row.
784
+
785
+ **Checked by the read port.** `validateCriteria(definition, criteria)` answers the violations,
786
+ never throws, and never quotes a value. `planCriteria(definition, criteria)` validates first and
787
+ throws `InvalidCriteriaError` (`INVALID_CRITERIA`): a criteria its definition refuses never
788
+ reaches a statement.
789
+
790
+ | Code | Path | Refused |
791
+ |---|---|---|
792
+ | `unknown_field` | `filter.<field>` | a field the definition does not declare |
793
+ | `operator_not_allowed` | `filter.<field>` | an operator the field does not declare |
794
+ | `invalid_value` | `filter.<field>` | a value that is not of the type of the field, an empty list, a `between` without two values, an empty text to search |
795
+ | `in_list_too_long` | `filter.<field>` | a list above `maxInList` (100) |
796
+ | `too_deep` | `filter` | groups nested deeper than `maxDepth` (1: `or(a, b)`; 2: `or(and(a, b), c)`) |
797
+ | `empty_group` | `filter` | a group without a filter |
798
+ | `too_many_filters` | `filter` | more conditions than `maxFilters` (20) |
799
+ | `unsortable_field` | `sort` | a sort on a field not declared `sortable` (the tie-breaker always is) |
800
+ | `page_too_large` | `page.limit` | a page above `maxPageSize` (100; the default size is 20) |
801
+ | `invalid_cursor` | `page.cursor` | a cursor that is not the `nextCursor` of a page of the same sort |
802
+
803
+ ### What a criteria means
804
+
805
+ The reference is `evaluateCriteria(definition, rows, criteria)`, which runs a criteria over
806
+ rows held in memory and is what a fake of a read port answers with. Every store translator is
807
+ held to the same table by `criteriaContract` of `@ddd-ts-kit/testing/contracts`.
808
+
809
+ | Rule | Meaning |
810
+ |---|---|
811
+ | Types | `string`; `number`; `boolean`; `instant`, a `Date` compared by its time, to the millisecond; `decimal`, a string of digits (`-12.50`) compared as a number without the rounding of a float |
812
+ | `eq`, `ne`, `in` | by value: two instants of the same time are equal whatever the zone they were written in, `10.5` is `10.50` |
813
+ | `gt`, `gte`, `lt`, `lte` | numbers, decimals and instants by value; strings by Unicode code point, so upper case comes before lower case (`'B' < 'a'`); not on a boolean |
814
+ | `between` | both bounds included |
815
+ | `contains`, `startsWith` | on a string only, case sensitive, the text taken literally: `%`, `_` and `\` are characters. A search that ignores case reads a lower-cased column the projection writes |
816
+ | `isNull` | `true` keeps the rows without a value, `false` those with one; only on a field declared `nullable` |
817
+ | A null | never satisfies a comparison, `ne` included; only `isNull` sees it |
818
+ | Conditions | joined by AND |
819
+ | `and`, `or`, `not` | `not` holds on the rows that do not satisfy all its filters, **nulls included**: logic has two values, so `not(room eq 'B')` keeps the rows without a room, where SQL alone would drop them |
820
+ | Sort | the `orderBy` calls, then the sort of the page request for the fields not ordered yet; without any, the `defaultSort` of the definition |
821
+ | Total order | the tie-breaker of the definition ends every sort, in the direction of the last field, unless the sort names it |
822
+ | Null in a sort | the greatest value: last ascending, first descending (the default of PostgreSQL) |
823
+ | `false` and `true` | `false` first ascending |
824
+ | Offset page | the slice and `total`, the count of the filtered rows |
825
+ | Cursor page | no `total`; `nextCursor` when another page follows. The cursor holds the sort values of the last row, is checked against the declared types when it comes back, and belongs to one sort |
826
+ | No page | the first page of the default size |
827
+
828
+ Two things follow from where a store keeps its data, and are written in each adapter README.
829
+ **Strings are ordered by the collation of their column**: the reference is the `"C"` collation
830
+ of PostgreSQL, so a text column that is sorted or compared by range is declared `COLLATE "C"`.
831
+ **A decimal reads back as its column formats it** (`10.5`, or `10.5000` for a fixed scale):
832
+ compare decimals as numbers.
833
+
834
+ ### The scope of the actor
835
+
836
+ `scoped(criteria, accessScope, mapping)` answers a `ScopedCriteria`, which is what a read port
837
+ asks for: a read cannot reach it without a scope. The scope is kept apart from the filters and
838
+ joined to them by AND, so nothing a caller writes, an `or` or a `not` included, widens what the
839
+ actor may read; `refine` changes the criteria and keeps the restriction.
840
+
841
+ | Scope | Becomes |
842
+ |---|---|
843
+ | `{ kind: 'all' }` | nothing: the criteria as it is |
844
+ | `{ kind: 'none' }`, or `ids` without any id | an empty page, without a query |
845
+ | `{ kind: 'ids', ids }` | `in` on the field `mapping.ids` names; the list is the authorizer's and is not bounded by `maxInList` |
846
+ | `{ kind: 'filter', filter }` | one `eq` per entry, on the field `mapping.filter` names for its key |
847
+
848
+ A scope the mapping cannot express throws `UnmappedReadScopeError` instead of reading without
849
+ the restriction, and so does a mapped field the definition does not declare. The fields of a
850
+ scope need no operator in the definition: the read port chose them, not the caller. The scope
851
+ is the shape `AccessScope` of `@ddd-ts-kit/auth`, named `ReadScope` here so that the kernel
852
+ depends on no authorization model.
853
+
854
+ ### For a store
855
+
856
+ `planCriteria` answers a `CriteriaPlan`, plain data a translator renders and nothing else: the
857
+ predicate of the filters and the scope, the predicate of the keyset for a cursor page, the
858
+ total order, the rows to fetch. Negations are already pushed down to the comparisons, so a
859
+ translator renders `and`, `or` and tests; the keyset is a predicate like another, so paging by
860
+ cursor is written once. `pageOfPlan(plan, rows, total?)` turns the rows a query answered into
861
+ the `Page`. The adapter packages hold the translators: `criteriaToKnex`, `criteriaToDrizzle`,
862
+ `criteriaToPrisma`, `criteriaToTypeOrm`.
863
+
864
+ **Limits.** No join: a field of another context is filtered once a projection copied it. No
865
+ aggregation, no full-text search. A long `ids` scope is a long `IN` list: beyond a few
866
+ thousand identifiers, project the right the scope stands for into the read model.
867
+
868
+ ## Hydration
869
+
870
+ Completing the rows of a read with data of another bounded context, at query time, through a
871
+ gateway port: for detail views and small pages whose foreign data must be fresh. A list that
872
+ filters or sorts by the foreign field needs a projection instead.
873
+
874
+ ```ts
875
+ const page = await this.appointments.search(criteria);
876
+
877
+ return hydrate(page)
878
+ .with('practitioner', (row) => row.practitionerId, this.practitioners.byIds)
879
+ .with('location', (row) => row.locationId, this.locations.byIds)
880
+ .orElse('practitioner', unknownPractitioner, { onFailure: 'fallback', timeoutMs: 300 });
881
+ ```
882
+
883
+ `lookup` is `(ids: readonly string[]) => Promise<ReadonlyMap<string, T>>`, a method of the
884
+ gateway port; the `cached` aspect of `@ddd-ts-kit/aspects` goes around the gateway as around
885
+ any other.
886
+
887
+ | Rule | |
888
+ |---|---|
889
+ | Calls | one per relation for the whole page, with each key once; none when no row has a key. Never one per row |
890
+ | Concurrency | the relations are looked up at the same time |
891
+ | Result | the row and the hydrated properties, typed; a `Page` stays a `Page` with the same `total` and `nextCursor`, a list of rows becomes a page of them; `warnings` is added |
892
+ | A row without a key, or unknown on the other side | left without the property, which is typed optional |
893
+ | `orElse(name, fallback)` | every row has the property, typed required: the fallback where nothing was found |
894
+ | A lookup that rejects | fails the whole hydration (policy `fail`, the default), fallback or not |
895
+ | `orElse(name, fallback, { onFailure: 'fallback' })` | the rows take the fallback and `warnings` holds `{ relation, code: 'lookup_failed' }`: never a silent success, never the error message |
896
+ | `timeoutMs` | the lookup is given up after that long (`HydrationTimeoutError`, warning code `lookup_timed_out`), then follows `onFailure` |
897
+
898
+ A hydrated property cannot be named by a criteria definition: `FieldOf<Row>` keeps the fields
899
+ that hold a scalar, and the compiler refuses the rest. The traces show one `gateway
900
+ <Port>.byIds` span per relation, as for any call to a gateway: hydration opens no span itself.
901
+
902
+ ## Projections
903
+
904
+ A projector keeps one read model up to date from events: integration events of upstream
905
+ contexts, domain events of its own. It writes its read model through a port and does nothing
906
+ else: it sends no command and reads no other context.
907
+
908
+ ```ts
909
+ // contexts/scheduling/application/projections/appointment-list.projection.ts
910
+ import { stampOf, type IntegrationEvent } from '@ddd-ts-kit/kernel';
911
+ import { On, Projection } from '@ddd-ts-kit/kernel/declarations';
912
+
913
+ @Projection('scheduling.appointment-list', [AppointmentList])
914
+ export class AppointmentListProjection {
915
+ constructor(private readonly appointments: AppointmentList) {}
916
+
917
+ @On(AppointmentBooked, { name: 'scheduling.appointment.booked' })
918
+ booked(event: AppointmentBooked) {
919
+ return this.appointments.upsertIfNewer(event.aggregateId, stampOf(event), () => rowOf(event));
920
+ }
921
+
922
+ @On(PaymentCaptured)
923
+ paid(event: IntegrationEvent<PaymentCapturedPayload>) {
924
+ return this.appointments.upsertIfNewer(event.payload.appointmentId, stampOf(event), (row) =>
925
+ row === undefined ? undefined : { ...row, paid: true },
926
+ );
927
+ }
928
+
929
+ @On(AppointmentCancelled, { name: 'scheduling.appointment.cancelled' })
930
+ cancelled(event: AppointmentCancelled) {
931
+ return this.appointments.delete(event.aggregateId, stampOf(event));
932
+ }
933
+ }
934
+ ```
935
+
936
+ `@Projection('<context>.<name>', [ports])` is a declaration like the others: both decorator
937
+ modes, the dependency list checked by the compiler, one class per file, in
938
+ `application/projections/`, in a `*.projection.ts` file. `@On(definition)` on a method says
939
+ "this method applies that integration event"; `@On(EventClass, { name })` says it for a domain
940
+ event of the projection's own context. A method that takes another event is refused by the
941
+ compiler, a projection without any `@On` and an `@On` on a class without `@Projection` throw
942
+ when the file loads. A method answers what its store answered, which is how the application
943
+ counts what was applied and what was stale.
944
+
945
+ **Not known to the CLI yet.** The runtime packages hold projections; `ddd-ts-kit` has no
946
+ generator for them and its canonical tree does not list `application/projections/`. In a
947
+ project held by `ddd-ts-kit check`, the directory is refused by `tree/closed` until it is
948
+ declared in `contexts.<name>.extraDirectories` with its decision record, and the generated
949
+ barrel `<context>.declarations.ts` refuses a line for a `*.projection.ts` file
950
+ (`declarations/barrel-current`): the projection is then registered by discovery or with
951
+ `builder.include(...)`, see the README of `@ddd-ts-kit/di`.
952
+
953
+ ### Idempotent and ordered by construction
954
+
955
+ `ReadModelStore<Row>` is the port of a read model: `get`, `upsertIfNewer`, `delete` and
956
+ `search(scopedCriteria)`. Every row carries the stamp of the event that last changed it, and a
957
+ write happens only if its event is newer:
958
+
959
+ | Rule | |
960
+ |---|---|
961
+ | Stamp | `stampOf(event)`: the id and the instant of an integration event; the name, the aggregate and the instant of a domain event; plus `stampOf(event, version)` when the event carries a per-key version |
962
+ | Newer | a greater `version` when both stamps carry one; else a later instant; at the same instant, the greater event id. The same event is never newer than itself |
963
+ | `upsertIfNewer(key, stamp, next)` | writes `next(current)`; `stale` when the row holds this event or a later one; `ignored` when `next` answers `undefined` (a patch of a row that does not exist) |
964
+ | `delete(key, stamp)` | the row is gone for `get` and `search`, and its stamp stays: an older event delivered late does not bring it back, a later one does |
965
+ | Concurrency | a write is conditional on the stamp it read and is read again when another got there first; five attempts, then `ConcurrencyError` and the redelivery of the event |
966
+ | Transaction | the store writes on the executor of the unit of work, so the row and the processed-event mark of the event commit or roll back together |
967
+
968
+ So a redelivery, a duplicate and two events of one key delivered out of order all end on the
969
+ same row. **What this does not give**: an older event skipped as stale is not applied later, so
970
+ an event should carry the state of the fields it sets, or come in order per key (the outbox
971
+ orders per key); a deletion that reaches a row never seen leaves no trace; with instants and
972
+ no version, the order of two events of one key is the order of the clocks that stamped them;
973
+ a version is compared with the version the row holds, so pass one only when every event of a
974
+ row comes from the same stream. One write is one row: an event that concerns many rows lists
975
+ them with a criteria and writes each.
976
+
977
+ `TableReadModelStore` is the one implementation of the port, over a `ReadModelTable` an
978
+ adapter gives (three statements and the query of a plan): `InMemoryReadModelStore` here for
979
+ the fakes, `KnexReadModelStore`, `DrizzleReadModelStore`, `PrismaReadModelStore` and
980
+ `TypeOrmReadModelStore` in the adapter packages, all held to `readModelStoreContract`.
981
+
982
+ ### Rebuild
983
+
984
+ The kit has no event store: a read model is rebuilt from the source of truth, the read
985
+ contract the owning context publishes, behind a gateway port that answers stamped rows.
986
+
987
+ ```ts
988
+ await new ProjectionRebuild({ table: appointments.table, source, unitOfWork }).run();
989
+ // source.export(cursor): a page of { key, row, stamp } and its nextCursor
990
+ // source.lookup(keys): the rows of these keys as they are now
991
+ ```
992
+
993
+ | Step | What happens |
994
+ |---|---|
995
+ | 1 | an empty copy of the table is opened, with its indexes and constraints and the traces of the deleted rows; from then on every write of the projection records its key before it writes |
996
+ | 2 | the export is copied, page by page, into the copy. Events keep being applied to the table, which keeps answering reads |
997
+ | 3 | the recorded keys are read again from the source, in rounds, until few remain |
998
+ | 4 | in one transaction: the writers are held, the last recorded keys are read again, the copy takes the name of the table, the old table is dropped |
999
+
1000
+ The copy is filled from the source alone, never from the table being replaced, so a rebuild
1001
+ repairs rows the projection got wrong. **No event is lost**: an event is delivered after its
1002
+ source committed it, so either the export read its row afterwards, or its key was recorded and
1003
+ read again, or it is applied after the swap to a row whose stamp is older. **No event is
1004
+ applied twice**: an event the source already reflected is `stale` against the stamp its row
1005
+ came with. Both rest on what the source says of each row: the stamp of the last event its
1006
+ state reflects. With the id and instant of that event, or a per-key version, the guarantee is
1007
+ exact; with an `updatedAt` alone, an event of the very same instant is applied once more over
1008
+ the state that already holds it, which is harmless for an event that sets state and wrong for
1009
+ one that counts.
1010
+
1011
+ **The window.** Reads are never interrupted until step 4. Writers wait during step 4, for the
1012
+ time it takes to read the last keys again (at most `settledBelow`, 50 by default, unless the
1013
+ table changes faster than `maxRounds` rounds can follow) and to rename two tables. A write that
1014
+ had started just before fails and is redelivered. A rebuild that fails drops its copy and
1015
+ leaves the table as it was. On PostgreSQL the copy is made `LIKE ... INCLUDING ALL`:
1016
+ privileges granted on the table by name, row security policies and triggers are not copied
1017
+ and are restored by the migration that follows, and the indexes of the copy keep the names
1018
+ PostgreSQL derived for them.
1019
+
1020
+ ### Seen from outside
1021
+
1022
+ Through the ports that exist. `@ddd-ts-kit/di` counts `projection_events_total` by `context`,
1023
+ `projection`, `event` and `result` (`applied`, `stale`, `ignored`, `failed`) on `Metrics`, and
1024
+ sets `projection_last_event_age_ms`, the age of the last event applied when it was: the lag.
1025
+ A projection is subscribed as a consumer under its name, so each delivery is one `process
1026
+ <projection>` span, with the calls to its read model below it, and an event buried after its
1027
+ retries reaches the error reporter as for any consumer.
1028
+
1029
+ ## How to extend
1030
+
1031
+ `Session`, `ExecutionContext`, `Actor`, `AuditEntry` and `ErrorReport` each have an empty interface that a project fills by
1032
+ declaration merging, once, in a declaration file of its platform:
1033
+
1034
+ ```ts
1035
+ // src/platform/kernel-extensions.d.ts
1036
+ import '@ddd-ts-kit/kernel';
1037
+
1038
+ declare module '@ddd-ts-kit/kernel' {
1039
+ interface SessionExtensions {
1040
+ readonly plan: 'free' | 'team';
1041
+ }
1042
+ interface ExecutionContextExtensions {
1043
+ readonly region: string;
1044
+ }
1045
+ interface ActorExtensions {
1046
+ readonly department: string;
1047
+ }
1048
+ interface AuditEntryExtensions {
1049
+ readonly region: 'eu' | 'us';
1050
+ }
1051
+ interface ErrorReportExtensions {
1052
+ readonly deployment: 'blue' | 'green';
1053
+ }
1054
+ interface LogFields {
1055
+ orderId?: string;
1056
+ error?: Error;
1057
+ }
1058
+ interface MetricLabels {
1059
+ region?: 'eu' | 'us' | undefined;
1060
+ }
1061
+ }
1062
+ ```
1063
+
1064
+ ```ts
1065
+ session.extensions.plan; // 'free' | 'team' | undefined
1066
+ context.extensions.region; // string | undefined
1067
+ actor.attributes.department; // string | undefined
1068
+ entry.extensions.region; // 'eu' | 'us' | undefined
1069
+ logger.info('shipped', { orderId: 42 }); // compile error: orderId is a string
1070
+ ```
1071
+
1072
+ - **`extensions`, not top-level fields.** A project field lives under `extensions`, so a
1073
+ standard field added to `Session` or `ExecutionContext` in a later version can never collide
1074
+ with it.
1075
+ - **Optional when read.** `anonymousSession()`, `systemSession()` and `executionContext()` carry
1076
+ no extension, and they must stay truthful in every project: an extension reads as
1077
+ `T | undefined`.
1078
+ - **`Actor` keeps its bag.** Authorizers already read `actor.attributes` by name, and actors
1079
+ travel in messages: `ActorExtensions` gives known attributes a name and a type inside that
1080
+ bag instead of adding a second one. An extension that is not an `ActorAttribute` (a string, a
1081
+ number, a boolean or a list of strings) reads as `never`.
1082
+ - **`AuditEntryExtensions` holds JSON.** An entry is hashed and stored as it is: an extension
1083
+ that is not plain JSON (a `Date`, a class) reads as `never`.
1084
+ - **`LogFields` and `MetricLabels`** take new well-known keys the same way; unknown keys stay
1085
+ allowed.
1086
+ - **Nothing to register.** The augmentation is types only. Adapters of the kit keep compiling:
1087
+ they never read a project extension.