ddd-ts-kit 0.9.0 → 0.11.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 (395) hide show
  1. package/README.md +17 -3
  2. package/dist/check/canonical/roles.d.ts.map +1 -1
  3. package/dist/check/canonical/roles.js +18 -0
  4. package/dist/check/canonical/roles.js.map +1 -1
  5. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  6. package/dist/check/catalogue/architecture-rules.js +14 -0
  7. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  8. package/dist/check/event-sourcing/declared-shape.d.ts +13 -0
  9. package/dist/check/event-sourcing/declared-shape.d.ts.map +1 -0
  10. package/dist/check/event-sourcing/declared-shape.js +100 -0
  11. package/dist/check/event-sourcing/declared-shape.js.map +1 -0
  12. package/dist/check/event-sourcing/event-sourced-classes.d.ts +5 -0
  13. package/dist/check/event-sourcing/event-sourced-classes.d.ts.map +1 -0
  14. package/dist/check/event-sourcing/event-sourced-classes.js +13 -0
  15. package/dist/check/event-sourcing/event-sourced-classes.js.map +1 -0
  16. package/dist/check/event-sourcing/fact-words.d.ts +6 -0
  17. package/dist/check/event-sourcing/fact-words.d.ts.map +1 -0
  18. package/dist/check/event-sourcing/fact-words.js +10 -0
  19. package/dist/check/event-sourcing/fact-words.js.map +1 -0
  20. package/dist/check/event-sourcing/is-apply-method.d.ts +3 -0
  21. package/dist/check/event-sourcing/is-apply-method.d.ts.map +1 -0
  22. package/dist/check/event-sourcing/is-apply-method.js +6 -0
  23. package/dist/check/event-sourcing/is-apply-method.js.map +1 -0
  24. package/dist/check/event-sourcing/kernel-names.d.ts +8 -0
  25. package/dist/check/event-sourcing/kernel-names.d.ts.map +1 -0
  26. package/dist/check/event-sourcing/kernel-names.js +7 -0
  27. package/dist/check/event-sourcing/kernel-names.js.map +1 -0
  28. package/dist/check/event-sourcing/read-stored-events-lock.d.ts +5 -0
  29. package/dist/check/event-sourcing/read-stored-events-lock.d.ts.map +1 -0
  30. package/dist/check/event-sourcing/read-stored-events-lock.js +25 -0
  31. package/dist/check/event-sourcing/read-stored-events-lock.js.map +1 -0
  32. package/dist/check/event-sourcing/read-stored-shape.d.ts +12 -0
  33. package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -0
  34. package/dist/check/event-sourcing/read-stored-shape.js +46 -0
  35. package/dist/check/event-sourcing/read-stored-shape.js.map +1 -0
  36. package/dist/check/event-sourcing/state-writes.d.ts +3 -0
  37. package/dist/check/event-sourcing/state-writes.d.ts.map +1 -0
  38. package/dist/check/event-sourcing/state-writes.js +11 -0
  39. package/dist/check/event-sourcing/state-writes.js.map +1 -0
  40. package/dist/check/event-sourcing/stored-event-declaration.d.ts +18 -0
  41. package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -0
  42. package/dist/check/event-sourcing/stored-event-declaration.js +2 -0
  43. package/dist/check/event-sourcing/stored-event-declaration.js.map +1 -0
  44. package/dist/check/event-sourcing/stored-event-declarations.d.ts +9 -0
  45. package/dist/check/event-sourcing/stored-event-declarations.d.ts.map +1 -0
  46. package/dist/check/event-sourcing/stored-event-declarations.js +64 -0
  47. package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -0
  48. package/dist/check/event-sourcing/stored-events-lock-file.d.ts +3 -0
  49. package/dist/check/event-sourcing/stored-events-lock-file.d.ts.map +1 -0
  50. package/dist/check/event-sourcing/stored-events-lock-file.js +3 -0
  51. package/dist/check/event-sourcing/stored-events-lock-file.js.map +1 -0
  52. package/dist/check/event-sourcing/stored-shape.d.ts +7 -0
  53. package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -0
  54. package/dist/check/event-sourcing/stored-shape.js +2 -0
  55. package/dist/check/event-sourcing/stored-shape.js.map +1 -0
  56. package/dist/check/event-sourcing/words-of.d.ts +3 -0
  57. package/dist/check/event-sourcing/words-of.d.ts.map +1 -0
  58. package/dist/check/event-sourcing/words-of.js +9 -0
  59. package/dist/check/event-sourcing/words-of.js.map +1 -0
  60. package/dist/check/events/event-name-resolver.d.ts +6 -0
  61. package/dist/check/events/event-name-resolver.d.ts.map +1 -0
  62. package/dist/check/events/event-name-resolver.js +21 -0
  63. package/dist/check/events/event-name-resolver.js.map +1 -0
  64. package/dist/check/explain/event-sourcing-docs.d.ts +3 -0
  65. package/dist/check/explain/event-sourcing-docs.d.ts.map +1 -0
  66. package/dist/check/explain/event-sourcing-docs.js +62 -0
  67. package/dist/check/explain/event-sourcing-docs.js.map +1 -0
  68. package/dist/check/explain/lifecycle-docs.d.ts +3 -0
  69. package/dist/check/explain/lifecycle-docs.d.ts.map +1 -0
  70. package/dist/check/explain/lifecycle-docs.js +33 -0
  71. package/dist/check/explain/lifecycle-docs.js.map +1 -0
  72. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  73. package/dist/check/explain/rule-docs.js +4 -0
  74. package/dist/check/explain/rule-docs.js.map +1 -1
  75. package/dist/check/fixtures/event-sourcing-fixtures.d.ts +3 -0
  76. package/dist/check/fixtures/event-sourcing-fixtures.d.ts.map +1 -0
  77. package/dist/check/fixtures/event-sourcing-fixtures.js +199 -0
  78. package/dist/check/fixtures/event-sourcing-fixtures.js.map +1 -0
  79. package/dist/check/fixtures/event-sourcing-projection-fixtures.d.ts +3 -0
  80. package/dist/check/fixtures/event-sourcing-projection-fixtures.d.ts.map +1 -0
  81. package/dist/check/fixtures/event-sourcing-projection-fixtures.js +48 -0
  82. package/dist/check/fixtures/event-sourcing-projection-fixtures.js.map +1 -0
  83. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  84. package/dist/check/fixtures/fixtures.js +4 -0
  85. package/dist/check/fixtures/fixtures.js.map +1 -1
  86. package/dist/check/fixtures/lifecycle-fixtures.d.ts +3 -0
  87. package/dist/check/fixtures/lifecycle-fixtures.d.ts.map +1 -0
  88. package/dist/check/fixtures/lifecycle-fixtures.js +90 -0
  89. package/dist/check/fixtures/lifecycle-fixtures.js.map +1 -0
  90. package/dist/check/lifecycle/is-aggregate-file.d.ts +4 -0
  91. package/dist/check/lifecycle/is-aggregate-file.d.ts.map +1 -0
  92. package/dist/check/lifecycle/is-aggregate-file.js +6 -0
  93. package/dist/check/lifecycle/is-aggregate-file.js.map +1 -0
  94. package/dist/check/lifecycle/machines-imported.d.ts +4 -0
  95. package/dist/check/lifecycle/machines-imported.d.ts.map +1 -0
  96. package/dist/check/lifecycle/machines-imported.js +11 -0
  97. package/dist/check/lifecycle/machines-imported.js.map +1 -0
  98. package/dist/check/lifecycle/shorthand-status-writes.d.ts +7 -0
  99. package/dist/check/lifecycle/shorthand-status-writes.d.ts.map +1 -0
  100. package/dist/check/lifecycle/shorthand-status-writes.js +34 -0
  101. package/dist/check/lifecycle/shorthand-status-writes.js.map +1 -0
  102. package/dist/check/lifecycle/status-writes.d.ts +14 -0
  103. package/dist/check/lifecycle/status-writes.d.ts.map +1 -0
  104. package/dist/check/lifecycle/status-writes.js +29 -0
  105. package/dist/check/lifecycle/status-writes.js.map +1 -0
  106. package/dist/check/rules/event-sourcing-past-tense.d.ts +3 -0
  107. package/dist/check/rules/event-sourcing-past-tense.d.ts.map +1 -0
  108. package/dist/check/rules/event-sourcing-past-tense.js +31 -0
  109. package/dist/check/rules/event-sourcing-past-tense.js.map +1 -0
  110. package/dist/check/rules/event-sourcing-projection-never-appends.d.ts +3 -0
  111. package/dist/check/rules/event-sourcing-projection-never-appends.d.ts.map +1 -0
  112. package/dist/check/rules/event-sourcing-projection-never-appends.js +54 -0
  113. package/dist/check/rules/event-sourcing-projection-never-appends.js.map +1 -0
  114. package/dist/check/rules/event-sourcing-state-in-apply.d.ts +3 -0
  115. package/dist/check/rules/event-sourcing-state-in-apply.d.ts.map +1 -0
  116. package/dist/check/rules/event-sourcing-state-in-apply.js +34 -0
  117. package/dist/check/rules/event-sourcing-state-in-apply.js.map +1 -0
  118. package/dist/check/rules/event-sourcing-store-behind-repository.d.ts +3 -0
  119. package/dist/check/rules/event-sourcing-store-behind-repository.d.ts.map +1 -0
  120. package/dist/check/rules/event-sourcing-store-behind-repository.js +34 -0
  121. package/dist/check/rules/event-sourcing-store-behind-repository.js.map +1 -0
  122. package/dist/check/rules/event-sourcing-upcaster-required.d.ts +3 -0
  123. package/dist/check/rules/event-sourcing-upcaster-required.d.ts.map +1 -0
  124. package/dist/check/rules/event-sourcing-upcaster-required.js +79 -0
  125. package/dist/check/rules/event-sourcing-upcaster-required.js.map +1 -0
  126. package/dist/check/rules/lifecycle-status-through-machine.d.ts +3 -0
  127. package/dist/check/rules/lifecycle-status-through-machine.d.ts.map +1 -0
  128. package/dist/check/rules/lifecycle-status-through-machine.js +55 -0
  129. package/dist/check/rules/lifecycle-status-through-machine.js.map +1 -0
  130. package/dist/check/rules/process-sends-commands-only.d.ts +3 -0
  131. package/dist/check/rules/process-sends-commands-only.d.ts.map +1 -0
  132. package/dist/check/rules/process-sends-commands-only.js +39 -0
  133. package/dist/check/rules/process-sends-commands-only.js.map +1 -0
  134. package/dist/commands/docs.d.ts.map +1 -1
  135. package/dist/commands/docs.js +44 -11
  136. package/dist/commands/docs.js.map +1 -1
  137. package/dist/commands/format-context.d.ts.map +1 -1
  138. package/dist/commands/format-context.js +1 -1
  139. package/dist/commands/format-context.js.map +1 -1
  140. package/dist/commands/generate.js +4 -0
  141. package/dist/commands/generate.js.map +1 -1
  142. package/dist/commands/init.d.ts.map +1 -1
  143. package/dist/commands/init.js +1 -0
  144. package/dist/commands/init.js.map +1 -1
  145. package/dist/config/index.d.ts +1 -1
  146. package/dist/config/index.d.ts.map +1 -1
  147. package/dist/config/index.js +1 -1
  148. package/dist/config/index.js.map +1 -1
  149. package/dist/config/parse-stack.d.ts.map +1 -1
  150. package/dist/config/parse-stack.js +2 -1
  151. package/dist/config/parse-stack.js.map +1 -1
  152. package/dist/config/stack.d.ts +10 -0
  153. package/dist/config/stack.d.ts.map +1 -1
  154. package/dist/config/stack.js +1 -0
  155. package/dist/config/stack.js.map +1 -1
  156. package/dist/declared/declared-role.d.ts.map +1 -1
  157. package/dist/declared/declared-role.js +1 -0
  158. package/dist/declared/declared-role.js.map +1 -1
  159. package/dist/describe/context-description.d.ts +8 -0
  160. package/dist/describe/context-description.d.ts.map +1 -1
  161. package/dist/describe/describe-context.d.ts.map +1 -1
  162. package/dist/describe/describe-context.js +4 -0
  163. package/dist/describe/describe-context.js.map +1 -1
  164. package/dist/describe/format-description.d.ts.map +1 -1
  165. package/dist/describe/format-description.js +17 -2
  166. package/dist/describe/format-description.js.map +1 -1
  167. package/dist/docs/background-job-facts.d.ts +7 -0
  168. package/dist/docs/background-job-facts.d.ts.map +1 -0
  169. package/dist/docs/background-job-facts.js +2 -0
  170. package/dist/docs/background-job-facts.js.map +1 -0
  171. package/dist/docs/context-facts.d.ts +11 -0
  172. package/dist/docs/context-facts.d.ts.map +1 -1
  173. package/dist/docs/declared-stored-events.d.ts +9 -0
  174. package/dist/docs/declared-stored-events.d.ts.map +1 -0
  175. package/dist/docs/declared-stored-events.js +22 -0
  176. package/dist/docs/declared-stored-events.js.map +1 -0
  177. package/dist/docs/object-properties.d.ts +11 -0
  178. package/dist/docs/object-properties.d.ts.map +1 -0
  179. package/dist/docs/object-properties.js +21 -0
  180. package/dist/docs/object-properties.js.map +1 -0
  181. package/dist/docs/process-facts.d.ts +8 -0
  182. package/dist/docs/process-facts.d.ts.map +1 -0
  183. package/dist/docs/process-facts.js +2 -0
  184. package/dist/docs/process-facts.js.map +1 -0
  185. package/dist/docs/read-background-jobs.d.ts +5 -0
  186. package/dist/docs/read-background-jobs.d.ts.map +1 -0
  187. package/dist/docs/read-background-jobs.js +16 -0
  188. package/dist/docs/read-background-jobs.js.map +1 -0
  189. package/dist/docs/read-context.d.ts.map +1 -1
  190. package/dist/docs/read-context.js +16 -0
  191. package/dist/docs/read-context.js.map +1 -1
  192. package/dist/docs/read-processes.d.ts +5 -0
  193. package/dist/docs/read-processes.d.ts.map +1 -0
  194. package/dist/docs/read-processes.js +22 -0
  195. package/dist/docs/read-processes.js.map +1 -0
  196. package/dist/docs/read-state-machines.d.ts +10 -0
  197. package/dist/docs/read-state-machines.d.ts.map +1 -0
  198. package/dist/docs/read-state-machines.js +81 -0
  199. package/dist/docs/read-state-machines.js.map +1 -0
  200. package/dist/docs/read-vocabularies.d.ts +4 -0
  201. package/dist/docs/read-vocabularies.d.ts.map +1 -0
  202. package/dist/docs/read-vocabularies.js +14 -0
  203. package/dist/docs/read-vocabularies.js.map +1 -0
  204. package/dist/docs/refresh-context-doc.d.ts +1 -1
  205. package/dist/docs/refresh-context-doc.d.ts.map +1 -1
  206. package/dist/docs/refresh-context-doc.js +33 -4
  207. package/dist/docs/refresh-context-doc.js.map +1 -1
  208. package/dist/docs/state-machine-facts.d.ts +18 -0
  209. package/dist/docs/state-machine-facts.d.ts.map +1 -0
  210. package/dist/docs/state-machine-facts.js +2 -0
  211. package/dist/docs/state-machine-facts.js.map +1 -0
  212. package/dist/docs/state-machine-lines.d.ts +8 -0
  213. package/dist/docs/state-machine-lines.d.ts.map +1 -0
  214. package/dist/docs/state-machine-lines.js +32 -0
  215. package/dist/docs/state-machine-lines.js.map +1 -0
  216. package/dist/docs/unrecorded-stored-events.d.ts +9 -0
  217. package/dist/docs/unrecorded-stored-events.d.ts.map +1 -0
  218. package/dist/docs/unrecorded-stored-events.js +17 -0
  219. package/dist/docs/unrecorded-stored-events.js.map +1 -0
  220. package/dist/docs/write-docs.d.ts +1 -2
  221. package/dist/docs/write-docs.d.ts.map +1 -1
  222. package/dist/docs/write-docs.js +1 -2
  223. package/dist/docs/write-docs.js.map +1 -1
  224. package/dist/docs/write-stored-events-lock.d.ts +12 -0
  225. package/dist/docs/write-stored-events-lock.d.ts.map +1 -0
  226. package/dist/docs/write-stored-events-lock.js +41 -0
  227. package/dist/docs/write-stored-events-lock.js.map +1 -0
  228. package/dist/generate/event-names.d.ts +2 -0
  229. package/dist/generate/event-names.d.ts.map +1 -1
  230. package/dist/generate/event-names.js +1 -0
  231. package/dist/generate/event-names.js.map +1 -1
  232. package/dist/generate/kind.d.ts +4 -0
  233. package/dist/generate/kind.d.ts.map +1 -1
  234. package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
  235. package/dist/generate/kinds/aggregate-kind.js +8 -2
  236. package/dist/generate/kinds/aggregate-kind.js.map +1 -1
  237. package/dist/generate/kinds/background/background-job-vars.d.ts +7 -0
  238. package/dist/generate/kinds/background/background-job-vars.d.ts.map +1 -0
  239. package/dist/generate/kinds/background/background-job-vars.js +29 -0
  240. package/dist/generate/kinds/background/background-job-vars.js.map +1 -0
  241. package/dist/generate/kinds/background/job-import.d.ts +8 -0
  242. package/dist/generate/kinds/background/job-import.d.ts.map +1 -0
  243. package/dist/generate/kinds/background/job-import.js +17 -0
  244. package/dist/generate/kinds/background/job-import.js.map +1 -0
  245. package/dist/generate/kinds/background/payload-field.d.ts +18 -0
  246. package/dist/generate/kinds/background/payload-field.d.ts.map +1 -0
  247. package/dist/generate/kinds/background/payload-field.js +52 -0
  248. package/dist/generate/kinds/background/payload-field.js.map +1 -0
  249. package/dist/generate/kinds/background/require-container.d.ts +7 -0
  250. package/dist/generate/kinds/background/require-container.d.ts.map +1 -0
  251. package/dist/generate/kinds/background/require-container.js +13 -0
  252. package/dist/generate/kinds/background/require-container.js.map +1 -0
  253. package/dist/generate/kinds/background-job-kind.d.ts +3 -0
  254. package/dist/generate/kinds/background-job-kind.d.ts.map +1 -0
  255. package/dist/generate/kinds/background-job-kind.js +49 -0
  256. package/dist/generate/kinds/background-job-kind.js.map +1 -0
  257. package/dist/generate/kinds/domain-event-kind.d.ts.map +1 -1
  258. package/dist/generate/kinds/domain-event-kind.js +5 -2
  259. package/dist/generate/kinds/domain-event-kind.js.map +1 -1
  260. package/dist/generate/kinds/event-vars.d.ts.map +1 -1
  261. package/dist/generate/kinds/event-vars.js +6 -1
  262. package/dist/generate/kinds/event-vars.js.map +1 -1
  263. package/dist/generate/kinds/extend-event-sourced-aggregate.d.ts +9 -0
  264. package/dist/generate/kinds/extend-event-sourced-aggregate.d.ts.map +1 -0
  265. package/dist/generate/kinds/extend-event-sourced-aggregate.js +67 -0
  266. package/dist/generate/kinds/extend-event-sourced-aggregate.js.map +1 -0
  267. package/dist/generate/kinds/job/command-input.d.ts +11 -0
  268. package/dist/generate/kinds/job/command-input.d.ts.map +1 -0
  269. package/dist/generate/kinds/job/command-input.js +13 -0
  270. package/dist/generate/kinds/job/command-input.js.map +1 -0
  271. package/dist/generate/kinds/job/granted-in-spec.d.ts +6 -0
  272. package/dist/generate/kinds/job/granted-in-spec.d.ts.map +1 -0
  273. package/dist/generate/kinds/job/granted-in-spec.js +18 -0
  274. package/dist/generate/kinds/job/granted-in-spec.js.map +1 -0
  275. package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
  276. package/dist/generate/kinds/job/job-vars.js +1 -17
  277. package/dist/generate/kinds/job/job-vars.js.map +1 -1
  278. package/dist/generate/kinds/job/read-sent-command.d.ts +8 -2
  279. package/dist/generate/kinds/job/read-sent-command.d.ts.map +1 -1
  280. package/dist/generate/kinds/job/read-sent-command.js +18 -12
  281. package/dist/generate/kinds/job/read-sent-command.js.map +1 -1
  282. package/dist/generate/kinds/job/sent-command.d.ts +4 -1
  283. package/dist/generate/kinds/job/sent-command.d.ts.map +1 -1
  284. package/dist/generate/kinds/process-kind.d.ts +3 -0
  285. package/dist/generate/kinds/process-kind.d.ts.map +1 -0
  286. package/dist/generate/kinds/process-kind.js +39 -0
  287. package/dist/generate/kinds/process-kind.js.map +1 -0
  288. package/dist/generate/kinds/state-machine/parse-transitions.d.ts +4 -0
  289. package/dist/generate/kinds/state-machine/parse-transitions.d.ts.map +1 -0
  290. package/dist/generate/kinds/state-machine/parse-transitions.js +24 -0
  291. package/dist/generate/kinds/state-machine/parse-transitions.js.map +1 -0
  292. package/dist/generate/kinds/state-machine/requested-transition.d.ts +9 -0
  293. package/dist/generate/kinds/state-machine/requested-transition.d.ts.map +1 -0
  294. package/dist/generate/kinds/state-machine/requested-transition.js +2 -0
  295. package/dist/generate/kinds/state-machine/requested-transition.js.map +1 -0
  296. package/dist/generate/kinds/state-machine/state-machine-vars.d.ts +12 -0
  297. package/dist/generate/kinds/state-machine/state-machine-vars.d.ts.map +1 -0
  298. package/dist/generate/kinds/state-machine/state-machine-vars.js +44 -0
  299. package/dist/generate/kinds/state-machine/state-machine-vars.js.map +1 -0
  300. package/dist/generate/kinds/state-machine/status-vocabulary.d.ts +9 -0
  301. package/dist/generate/kinds/state-machine/status-vocabulary.d.ts.map +1 -0
  302. package/dist/generate/kinds/state-machine/status-vocabulary.js +26 -0
  303. package/dist/generate/kinds/state-machine/status-vocabulary.js.map +1 -0
  304. package/dist/generate/kinds/state-machine-kind.d.ts +3 -0
  305. package/dist/generate/kinds/state-machine-kind.d.ts.map +1 -0
  306. package/dist/generate/kinds/state-machine-kind.js +33 -0
  307. package/dist/generate/kinds/state-machine-kind.js.map +1 -0
  308. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts +8 -0
  309. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -0
  310. package/dist/generate/kinds/write-event-sourced-aggregate.js +24 -0
  311. package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -0
  312. package/dist/generate/kinds.d.ts.map +1 -1
  313. package/dist/generate/kinds.js +6 -0
  314. package/dist/generate/kinds.js.map +1 -1
  315. package/dist/generate/vocabulary/held-entries.d.ts +4 -0
  316. package/dist/generate/vocabulary/held-entries.d.ts.map +1 -0
  317. package/dist/generate/vocabulary/held-entries.js +6 -0
  318. package/dist/generate/vocabulary/held-entries.js.map +1 -0
  319. package/dist/generate/vocabulary/vocabulary-text.d.ts.map +1 -1
  320. package/dist/generate/vocabulary/vocabulary-text.js +2 -2
  321. package/dist/generate/vocabulary/vocabulary-text.js.map +1 -1
  322. package/dist/help/notes.d.ts +1 -1
  323. package/dist/help/notes.d.ts.map +1 -1
  324. package/dist/help/notes.js +3 -0
  325. package/dist/help/notes.js.map +1 -1
  326. package/dist/help/usage.d.ts +1 -1
  327. package/dist/help/usage.d.ts.map +1 -1
  328. package/dist/help/usage.js +2 -2
  329. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  330. package/dist/init/manifest/dependencies-for.js +2 -0
  331. package/dist/init/manifest/dependencies-for.js.map +1 -1
  332. package/dist/init/manifest/versions.js +24 -24
  333. package/dist/init/manifest/versions.js.map +1 -1
  334. package/dist/init/stack/resolve-queue.d.ts +13 -0
  335. package/dist/init/stack/resolve-queue.d.ts.map +1 -0
  336. package/dist/init/stack/resolve-queue.js +25 -0
  337. package/dist/init/stack/resolve-queue.js.map +1 -0
  338. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  339. package/dist/init/stack/resolve-stack.js +2 -0
  340. package/dist/init/stack/resolve-stack.js.map +1 -1
  341. package/dist/init/stack/stack-options.d.ts +2 -0
  342. package/dist/init/stack/stack-options.d.ts.map +1 -1
  343. package/dist/naming/index.d.ts +2 -0
  344. package/dist/naming/index.d.ts.map +1 -1
  345. package/dist/naming/index.js +2 -0
  346. package/dist/naming/index.js.map +1 -1
  347. package/dist/naming/is-past-fact.d.ts +7 -0
  348. package/dist/naming/is-past-fact.d.ts.map +1 -0
  349. package/dist/naming/is-past-fact.js +18 -0
  350. package/dist/naming/is-past-fact.js.map +1 -0
  351. package/dist/naming/is-past-word.d.ts +3 -0
  352. package/dist/naming/is-past-word.d.ts.map +1 -0
  353. package/dist/naming/is-past-word.js +113 -0
  354. package/dist/naming/is-past-word.js.map +1 -0
  355. package/dist/naming/looks-like-past-fact.d.ts +1 -1
  356. package/dist/naming/looks-like-past-fact.d.ts.map +1 -1
  357. package/dist/naming/looks-like-past-fact.js +3 -66
  358. package/dist/naming/looks-like-past-fact.js.map +1 -1
  359. package/dist/stack/stack-vars.d.ts.map +1 -1
  360. package/dist/stack/stack-vars.js +13 -0
  361. package/dist/stack/stack-vars.js.map +1 -1
  362. package/dist/version.d.ts +1 -1
  363. package/dist/version.d.ts.map +1 -1
  364. package/dist/version.js +1 -1
  365. package/dist/version.js.map +1 -1
  366. package/package.json +2 -2
  367. package/templates/aggregate/event-sourced.aggregate.spec.ts.tpl +26 -0
  368. package/templates/aggregate/event-sourced.aggregate.ts.tpl +61 -0
  369. package/templates/aggregate/event-sourced.events.mapper.ts.tpl +15 -0
  370. package/templates/background-job/background-job.declared.ts.tpl +26 -0
  371. package/templates/background-job/background-job.spec.ts.tpl +63 -0
  372. package/templates/background-job/background-job.ts.tpl +24 -0
  373. package/templates/background-job/wiring.tsyringe.tpl +5 -0
  374. package/templates/builder/event-sourced.builder.ts.tpl +36 -0
  375. package/templates/context/CONTEXT.md.tpl +15 -0
  376. package/templates/init/CLAUDE.md.tpl +1 -1
  377. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +20 -1
  378. package/templates/init/platform/database/persistence-over.knex.ts.tpl +18 -1
  379. package/templates/init/platform/database/persistence.orm.ts.tpl +12 -1
  380. package/templates/init/platform/database/schema.drizzle.ts.tpl +12 -2
  381. package/templates/init/platform/database/schema.knex.ts.tpl +7 -1
  382. package/templates/init/platform/platform.module.tsyringe.ts.tpl +43 -3
  383. package/templates/init/platform/redis/open-redis.ts.tpl +37 -1
  384. package/templates/init/rules/application.md.tpl +4 -2
  385. package/templates/init/rules/domain.md.tpl +2 -0
  386. package/templates/init/rules/infrastructure.md.tpl +1 -0
  387. package/templates/pipeline/package-scripts.json +1 -1
  388. package/templates/process/process.spec.ts.tpl +44 -0
  389. package/templates/process/process.ts.tpl +41 -0
  390. package/templates/process/timeout-job.declared.ts.tpl +18 -0
  391. package/templates/process/timeout-job.spec.ts.tpl +43 -0
  392. package/templates/process/timeout-job.ts.tpl +16 -0
  393. package/templates/process/timeout-job.wiring.tsyringe.tpl +5 -0
  394. package/templates/state-machine/state-machine.spec.ts.tpl +16 -0
  395. package/templates/state-machine/state-machine.ts.tpl +16 -0
package/README.md CHANGED
@@ -51,7 +51,7 @@ ddd-ts-kit init [--http express|fastify|nest|none]
51
51
  [--style declared|explicit] [--assembly barrel|discovery]
52
52
  [--dependencies signature|listed] [--refusals factories|classes]
53
53
  [--routes controllers|functions] [--value-objects throwing|result]
54
- [--literals named|free] [--tenancy none|shared-table]
54
+ [--literals named|free] [--tenancy none|shared-table] [--queue database|redis|memory]
55
55
  [--package-manager npm|pnpm]
56
56
  [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
57
57
  [--import-extension none|js] [--sdk]
@@ -195,6 +195,7 @@ config, `docsUi`, `ci` and `logger` included.
195
195
  | `src/platform/auth/` | `create-authenticator.ts` (`--authn jwt`: `JwtAuthenticator` on `AUTH_ISSUER`, `AUTH_AUDIENCE`, `AUTH_JWKS_URI`; `--authn keycloak`: `keycloakAuthenticator` on `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_AUDIENCE` and the optional `KEYCLOAK_CLIENT_ID`; `--authn none`: `development-header-authenticator.ts`, which reads `x-development-actor` and throws in production), `principal-of.ts`, `security-schemes.ts`, `offline-authenticator.ts`, `http-boundary.ts` (`resolvePrincipal` answering a `Session`, `executionScope`, `errorMapper` and `onError`, spread into the mount options: every request runs inside the execution scope, with its correlation id), `create-authorizer.ts` and the files of the model (`roles.ts`, with the role `system` every system actor holds; `attribute-policies.ts`; `relationship-schema.ts`, `create-tuple-store.ts` and its contract spec, `relation-tuples.ts`, `relate-system-actors.ts`, `permission-mapping.ts` and `permissions.ts`; `custom-authorizer.ts`, its `authorizerContract` spec and `permissions.ts`), `authorization.ts` (`authorizationModule` with tsyringe) or `use-case-protection.ts` (the guard of the hand-wired buses), `access-policies.ts`, and with `--audit off` `log-decisions.ts` (one log entry per decision, ids and codes only). Without an HTTP stack there is no authenticator and no boundary |
196
196
  | `--audit on` | `src/platform/audit/`: `create-audit.ts` (the trail, the `onDecision` of the authorization, the refusals of the guards at the edge given to the HTTP boundary as `onGuardRefusal`, the middleware before the unit of work, the integration events subscribed under the consumer name `audit`), `audited-events.ts` (the registry `generate integration-event` adds to), `audit.module.ts`, and with an HTTP stack the read side: `audit.permissions.ts` (`audit:trail.read`), `search-audit-entries.query.ts`, its handler, `search-audit-entries.route.ts` (`GET /audit/entries`: cursor pages, filters `actorId`, `action`, `outcome`, `correlationId`). It is a capability of the platform, not a bounded context: no model, one protected query over the `AuditReader` port, bounded by the tenant of the actor (with `--tenancy shared-table`, by the tenant of the work through `TenantAuditReader`: platform staff read across tenants only inside `acrossTenants`). The refusals of a caller without a credential are not recorded. A scheduled job is audited like a request: origin `schedule`, actor `system:<context>.<job>`. With knex the two tables and their append-only triggers are created by the first migration; with drizzle the tables are in `schema.ts` and `npm run db:audit-guard` prints the trigger statements for a custom migration; with prisma, typeorm, `custom` or no ORM the trail is an `InMemoryAuditTrail` behind a `TODO(platform)`. The test databases leave the audit schema out of `reset()` |
197
197
  | `--tenancy shared-table` | recorded as `stack.tenancy`; Knex or Drizzle only. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` or `tenantCondition` and `ownTenantCondition`; the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, or `tenantOutboxTable`), so consumers run in it; `tenancy/scoped-statement` judges the adapters. Row-level security, schema per tenant and database per tenant are refused, with what to wire by hand ([Multitenancy](../../docs/concepts/multitenancy.md)) |
198
+ | `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex or Drizzle with tsyringe): `createJobTable` and `createProcessTable`, or `jobsTable` and `processesTable`, in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform module rebinds `JobStore` and `ProcessStore` to them, so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default otherwise): nothing is written, the kernel module keeps both in the process. Refused off tsyringe, `database` with another ORM, `redis` without the cache |
198
199
  | `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices`: the cache bound to the kernel `Cache`, the limiter to `RateLimiter`, the lock to `Lock`, which keeps a scheduled job to one instance, the relay signal as the `wakeOn` of the outbox relay with `relayWakeUpMiddleware` on the command bus), `http/refusal-for.ts` (one sliding window per caller address, 429 `application/problem+json` with `retry-after`; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` on the HTTP server, `REDIS_URL` validated, a compose service `cache` running Dragonfly with a healthcheck. Without a server (tools, tests without `REDIS_URL`) the same ports stay in the memory of the process |
199
200
  | `--errors sentry` | unexpected failures reported to Sentry or GlitchTip (one protocol, only the DSN differs) through the kernel `ErrorReporter`, bound to `@ddd-ts-kit/sentry`. `src/platform/errors.ts` (`initSentry` on the validated configuration, then `reportProcessFailures`), the second import of `main.ts`, of `apps/<context>/main.ts` and of `apps/worker/main.ts`, right after `tracing.ts`; `errors` handed to `composeApplication`, which gives it to the kernel module on tsyringe (`errorReporter`, flushed by `container.stop()` before the logger, `errorReportingMiddleware` first on both buses, the default scheduler observing with `reportFailedRuns`) or to `createPlatform` by hand (the same middleware, `onRun: reportFailedRuns(errors)`, `platform.errors`, flushed two seconds at most when the application stops); `reportHttpErrors` in `auth/http-boundary.ts` for every request answered 5xx; `DeadLetterReports` on the `onFailure` hook of a provided broker (`createEventProvider(config, errors)`, with `observing` around each consumer) and of the outbox relay. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (default: `NODE_ENV`), `SENTRY_RELEASE` and `SENTRY_SCRUB_MESSAGES` validated in `config/load-config.ts` as `errorReporting`: without a DSN the application starts and reports nothing; a DSN that is not a URL refuses the start. Dependencies `@ddd-ts-kit/sentry` and `@sentry/node`. A compose profile `errors` running GlitchTip 6.2.6 with its own PostgreSQL and Valkey (`GLITCHTIP_PORT`, loopback only, development bootstrap), and a section of the generated README saying how to read its DSN. The tools and the tests compose the application without a reporter. It goes with every other choice of the stack; with `--errors none` nothing of this is written |
200
201
  | `--authn keycloak` | a compose service `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profile `identity`) and `docker/keycloak/<project>-realm.json`: the API client, a public client `<project>-local` with the direct grant, its audience and `tenant_id` mappers, the realm role `admin`, and the demo users `demo-admin` and `demo-user`, for local development only |
@@ -269,6 +270,7 @@ ddd-ts-kit generate --help --json
269
270
  | `error` (`refusal`) | `<context> <Concept> <refusal> [--code CODE] [--term ...]...` | a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
270
271
  | `domain-error` | `<context> <Name> [--code CODE]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `factories`, with the `generate error` command to run instead |
271
272
  | `domain-service` | `<context> <Name>` | service, spec |
273
+ | `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]...` | the vocabulary `<Aggregate>Status` (created from `--value`, two states at least, or given the values it misses), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle`: every value a state, the first one initial, the transitions asked, a `TODO(domain)` for the refusal of the concept error) and `test/unit/<aggregate>.state-machine.spec.ts` (each transition where it leads, a refusal from a state it does not leave); the aggregate is left to use it |
272
274
  | `repository` | `<context> <Aggregate> [--tenant-scoped]` | the port `domain/repositories/<name>.repository.ts` (`abstract class <Name>Repository extends Repository<<Name>>`), the adapter of the project's ORM (`implements` the port) with its mapper and table (or model), a fake, one `repositoryContract` spec run on both, registration |
273
275
  | `command` | `<context> <UseCaseName> (--permission <aggregate>.<action> \| --public) [--aggregate <Name>]` | `<use-case>.command.ts` on `AuthorizedCommand` (plain `Command` when public), `<use-case>.handler.ts` (it builds the aggregate, saves it and answers: the events leave with the save), spec through the bus with the refusal of an actor who lacks the permission, registration with `.requires(...)` or `.public()` (and the repository when missing). A generated command answers `void` or the identifier of its aggregate, so no `<use-case>.result.ts` is written |
274
276
  | `query` | `<context> <UseCaseName> (--permission <aggregate>.<action> \| --public) [--search]` | `<use-case>.query.ts` on `AuthorizedQuery` (plain `Query` when public), `<use-case>.result.ts`, `<use-case>.handler.ts`, the read port `application/ports/<use-case>-reader.port.ts` (an abstract class), its in-memory adapter, fake, spec, registration on the query bus. With `--search` (needs `--permission`): a kernel `PageRequest` in the query, the item, the sort and `Page<Item>` in the result file, a handler that asks `Access.scope` and hands the scope to the read port, an in-memory reader paging by offset or cursor |
@@ -282,6 +284,8 @@ ddd-ts-kit generate --help --json
282
284
  | `event-handler` | `<context> <Aggregate> <Fact> [--phase after-commit]` | reaction to a domain event of the context, spec, subscription; before the commit of the unit of work by default, after it with `--phase after-commit` (an effect no transaction covers, at most once), and the spec runs the reaction in that phase |
283
285
  | `projection` (`projector`) | `<context> <Name> <event-type>` | a projector in `application/projections/<name>.projection.ts`, declared with `@Projection('<context>.<name>')` and one `@On(definition)` method for the integration event, which the context itself or a declared upstream publishes, and its spec; declared style only. It keeps one read model: its port is received in the constructor |
284
286
  | `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, a class `<Name>Job implements ScheduledJob` that sends the command, as `systemActor('<context>.<name>')` when it is protected, with `execution.scheduledAt` when the command takes it; `test/unit/<name>.job.spec.ts`, which runs the job (by name on tsyringe, `application.jobs.runNow`; `job.run(occurrence)` with hand wiring) and asserts the command it sent; its registration; its switch in `platform/job-settings.ts`; the grant of its system actor (below) |
287
+ | `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, a class `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` named by its static `jobName` `<context>.<name>`, that sends the command as `execution.actor` when it is protected, followed by one field of `<Name>Payload` per other parameter of the constructor of the command (strings, numbers, booleans, literals and lists of them as written, a `Date` as its ISO text; anything else is refused); `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user holding the permission and runs what is due; its registration (`@Background()`, or `builder.backgroundJob(..)` in the module file). `--di tsyringe` only |
288
+ | `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (its state, `processName`, `timeoutJob`, `isState`, a first step that arms a deadline, a step that ends it in time, the step of the deadline), `application/background/<name>-timeout.background-job.ts`, which delivers its timeouts through `ProcessRunner`, and the specs of both (`givenProcess`, the queue of the test application). `--di tsyringe` only |
285
289
  | `acl` | `<context> <upstreamOrSystemName>` | translator in `infrastructure/anti-corruption/`, spec |
286
290
  | `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` driving the route of the use case: 401 without a credential, 403 without the permission, the documented status with it; for a command, one more test asserts the trace of the request, exact on names and structure, with `installTestTracing()` and `expectSpanTree(storyOf(trace), [...])` of `@ddd-ts-kit/tracing/testing` (`POST /invoices`, then `command IssueInvoiceCommand`, then `repository InvoiceRepository.save`); needs the route |
287
291
  | `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, spec; declared: the class carries `@Policy(permission, { name })` and nothing else is written; explicit: registration in `platform/auth/access-policies.ts` |
@@ -418,7 +422,7 @@ Templates are plain files in `templates/<kind>/`, with `{{name.pascal}}`, `{{nam
418
422
  ## docs
419
423
 
420
424
  ```
421
- ddd-ts-kit docs [--check]
425
+ ddd-ts-kit docs [--check] [--stored-events]
422
426
  ```
423
427
 
424
428
  Regenerates what is derived from the config and the code, and nothing else:
@@ -439,7 +443,12 @@ Regenerates what is derived from the config and the code, and nothing else:
439
443
  - `docs/integration/README.md`, created once and never rewritten; its Provider section starts with
440
444
  the strategy of the chosen broker.
441
445
 
442
- `--check` writes nothing, names each stale file and exits 1. The event catalog and the
446
+ `--stored-events` also records in `stored-events.lock.json` the shape of each version of a stored
447
+ event declared in the codecs of `infrastructure/persistence/`, never rewriting a recorded version:
448
+ run it once the shape of a version is final.
449
+
450
+ `--check` writes nothing, names each stale file and each declared stored-event version not
451
+ recorded in `stored-events.lock.json`, and exits 1. The event catalog and the
443
452
  AsyncAPI document need the code of the project to run, so they are produced by
444
453
  `scripts/events.ts` (`npm run events:generate`, part of `npm run docs:generate`).
445
454
 
@@ -771,6 +780,11 @@ saying what to do instead. Exit code 1 when there is at least one error.
771
780
  | `events/consumer-idempotent` | an integration event handler class (`application/integration/handlers/*.integration-handler.ts`) that neither carries `@IntegrationEventHandler` nor is registered in its module file under a consumer name; an `@IntegrationEventHandler` whose `consumer` is not a non-empty string literal; a free `on(` or `consume(` without `processed`; a consumer name used twice, in declarations and registrations alike |
772
781
  | `domain-events/dispatched-on-save` | a call of `pullEvents()` in `application/` or `infrastructure/` of a context; `DomainEventDispatcher` imported, listed as a dependency or received by a constructor in `application/commands/`, `application/queries/` or a repository adapter. The module file, the tests, the platform and `main.ts` are left alone |
773
782
  | `domain-events/transactional-before-commit` | a domain event handler (a class of `application/event-handlers/*.event-handler.ts` or `application/integration/publishers/*.publisher.ts`, or any class carrying `@DomainEventHandler`) that runs before the commit and depends on `Cache`, `Lock`, `RateLimiter`, `JobScheduler` or `EventBus` of the kernel, on a port of `application/ports/` that is not a persistence port (no adapter under `infrastructure/persistence/`, or one anywhere else under `infrastructure/`), on anything imported from `infrastructure/`, another context, the platform or a package other than `@ddd-ts-kit/kernel` and `@ddd-ts-kit/auth`; an after-commit handler (`phase: 'after-commit'` in its decorator, or in the third argument of every `.on(` of the module file that mentions it) depending on `IntegrationEventPublisher`. `check-file` leaves the adapters of a port to the whole check |
783
+ | `event-sourcing/state-in-apply` | in a class of `domain/aggregates/` extending `EventSourcedAggregate`, a write to something of `this` (assignment, increment, mutating call) outside the constructor, static methods, `apply<Fact>` methods and `restore`; `this.record(..)` inside an apply method |
784
+ | `event-sourcing/past-tense` | in a file of `domain/aggregates/` holding an event-sourced aggregate, a name imported from `domain/events/` whose fact (the words after the name of the aggregate) holds no past participle, or only one spelled like its imperative at its head (`SetPrice`) |
785
+ | `event-sourcing/store-behind-repository` | `EventStore`, `SnapshotStore`, `CheckpointStore`, `EventSourcedRepository`, `EventSerializer`, `CatchUpSubscription` or `InMemoryEventStore` imported in `domain/` or `application/` |
786
+ | `event-sourcing/projection-never-appends` | in `application/projections/` or a file declaring `@Projection`, `EventStore` or `EventSourcedRepository` imported; in a projection declared `{ feed: 'event-store' }`, anything of `domain/repositories/` too |
787
+ | `event-sourcing/upcaster-required` | a `defineStoredEvent` whose `encode` names no type, or a type not declared in the file, or a type it reaches that the file does not declare; a version above 1 without an upcaster from each version below; a version below the last one recorded in `stored-events.lock.json`, or a recorded version whose shape changed. `ddd-ts-kit docs --stored-events` records new versions and never rewrites one; `docs --check` fails while a declared version is unrecorded |
774
788
  | `context/extractable` | a module file importing another context outside its published language; persistence importing another context's infrastructure or naming its schema; a handler importing another context's repository; `export let` or an exported `new Map`, `Set`, `WeakMap` at module level; `deployable: true` without `apps/<context>/main.ts`; in the declared style, a role file importing anything of a port file of another context |
775
789
  | `governance/recorded-deviation` | a `ddd-ts-kit-disable` or `eslint-disable` comment whose reason names no `ADR-<number>` with a file `docs/adr/<number>-*.md`; a rule set to `off` (or to `warn` below its default), an extra directory, an extra allowed package, a `guard` other than `enforce` or `stack.events` off the outbox, without a `deviations` entry `{ what, adr, reason }` pointing to an existing record |
776
790
  | `declarations/role-declared` | declared style only: a role file (other than `*.command.ts` and `*.query.ts`, held by `authz/declared`; `*.job.ts` under `application/scheduling/` with `@Scheduled` and `*.publisher.ts` with `@DomainEventHandler` are roles) exporting no class with the decorator of its suffix and folder, or one carrying another declaration; a declared class in a file that is not a role file; a `consumer` or `name` option that is missing, empty, a variable, a concatenation or a template with a substitution; a `@DomainEventHandler` name that differs from the `name` literal of the imported event class; any declaration decorator on a class under `domain/` |
@@ -1 +1 @@
1
- {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/roles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,qEAAqE;AACrE,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAmEhC,CAAC"}
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/roles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,qEAAqE;AACrE,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAqFhC,CAAC"}
@@ -9,6 +9,12 @@ export const ROLES = [
9
9
  { directory: 'domain/errors', suffixes: ['.error.ts'] },
10
10
  { directory: 'domain/repositories', suffixes: ['.repository.ts'] },
11
11
  { directory: 'domain/services', suffixes: ['.service.ts'], specFor: ['.service.ts'] },
12
+ {
13
+ directory: 'domain/state-machines',
14
+ suffixes: ['.state-machine.ts'],
15
+ oneConcept: true,
16
+ specFor: ['.state-machine.ts'],
17
+ },
12
18
  {
13
19
  directory: 'application/commands/*',
14
20
  suffixes: ['.command.ts', '.handler.ts', '.result.ts'],
@@ -30,6 +36,18 @@ export const ROLES = [
30
36
  specFor: ['.event-handler.ts'],
31
37
  },
32
38
  { directory: 'application/scheduling', suffixes: ['.job.ts'], oneConcept: true, specFor: ['.job.ts'] },
39
+ {
40
+ directory: 'application/processes',
41
+ suffixes: ['.process.ts'],
42
+ oneConcept: true,
43
+ specFor: ['.process.ts'],
44
+ },
45
+ {
46
+ directory: 'application/background',
47
+ suffixes: ['.background-job.ts'],
48
+ oneConcept: true,
49
+ specFor: ['.background-job.ts'],
50
+ },
33
51
  {
34
52
  directory: 'application/projections',
35
53
  suffixes: ['.projection.ts'],
@@ -1 +1 @@
1
- {"version":3,"file":"roles.js","sourceRoot":"","sources":["../../../src/check/canonical/roles.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,MAAM,CAAC,MAAM,KAAK,GAAoB;IACpC,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjD,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC,eAAe,CAAC,EAAE,UAAU,EA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architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAsE7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EAqE7C,CAAC"}
1
+ {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA6E7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA4E7C,CAAC"}
@@ -25,6 +25,11 @@ import { declarationsRoleDeclared } from '../rules/declarations-role-declared.js
25
25
  import { domainEventsDispatchedOnSave } from '../rules/domain-events-dispatched-on-save.js';
26
26
  import { domainEventsTransactionalBeforeCommit } from '../rules/domain-events-transactional-before-commit.js';
27
27
  import { errorsCodeUnique } from '../rules/errors-code-unique.js';
28
+ import { eventSourcingPastTense } from '../rules/event-sourcing-past-tense.js';
29
+ import { eventSourcingProjectionNeverAppends } from '../rules/event-sourcing-projection-never-appends.js';
30
+ import { eventSourcingStateInApply } from '../rules/event-sourcing-state-in-apply.js';
31
+ import { eventSourcingStoreBehindRepository } from '../rules/event-sourcing-store-behind-repository.js';
32
+ import { eventSourcingUpcasterRequired } from '../rules/event-sourcing-upcaster-required.js';
28
33
  import { errorsKnownCode } from '../rules/errors-known-code.js';
29
34
  import { filesPortNotConnector } from '../rules/files-port-not-connector.js';
30
35
  import { eventsConsumerIdempotent } from '../rules/events-consumer-idempotent.js';
@@ -39,6 +44,7 @@ import { languageDeclaredVocabulary } from '../rules/language-declared-vocabular
39
44
  import { languageGlossaryTerm } from '../rules/language-glossary-term.js';
40
45
  import { languageNoTechnicalName } from '../rules/language-no-technical-name.js';
41
46
  import { layerApplicationInward } from '../rules/layer-application-inward.js';
47
+ import { lifecycleStatusThroughMachine } from '../rules/lifecycle-status-through-machine.js';
42
48
  import { layerDomainPurity } from '../rules/layer-domain-purity.js';
43
49
  import { layerInfrastructureNoPresentation } from '../rules/layer-infrastructure-no-presentation.js';
44
50
  import { layerPresentationNoInfrastructure } from '../rules/layer-presentation-no-infrastructure.js';
@@ -52,6 +58,7 @@ import { portsImplementsNeverExtends } from '../rules/ports-implements-never-ext
52
58
  import { portsNoConcreteDependency } from '../rules/ports-no-concrete-dependency.js';
53
59
  import { portsNoTokenConstant } from '../rules/ports-no-token-constant.js';
54
60
  import { portsValueImport } from '../rules/ports-value-import.js';
61
+ import { processSendsCommandsOnly } from '../rules/process-sends-commands-only.js';
55
62
  import { purityNoAmbientRandomness } from '../rules/purity-no-ambient-randomness.js';
56
63
  import { purityNoEnvironment } from '../rules/purity-no-environment.js';
57
64
  import { purityNoSystemClock } from '../rules/purity-no-system-clock.js';
@@ -108,6 +115,11 @@ export const ARCHITECTURE_RULES = [
108
115
  eventsConsumerIdempotent,
109
116
  domainEventsDispatchedOnSave,
110
117
  domainEventsTransactionalBeforeCommit,
118
+ eventSourcingStateInApply,
119
+ eventSourcingPastTense,
120
+ eventSourcingStoreBehindRepository,
121
+ eventSourcingProjectionNeverAppends,
122
+ eventSourcingUpcasterRequired,
111
123
  contextExtractable,
112
124
  authzDeclared,
113
125
  authzInApplication,
@@ -127,6 +139,8 @@ export const ARCHITECTURE_RULES = [
127
139
  portsNoConcreteDependency,
128
140
  portsValueImport,
129
141
  schedulingJobTriggersUseCase,
142
+ lifecycleStatusThroughMachine,
143
+ processSendsCommandsOnly,
130
144
  schedulingJobName,
131
145
  importsAliasOnly,
132
146
  importsExtension,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;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gB;IAChB,gCAAgC;IAChC,WAAW;IACX,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
1
+ {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,i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AiC;IACjC,4BAA4B;IAC5B,2BAA2B;IAC3B,mCAAmC;IACnC,cAAc;IACd,UAAU;IACV,cAAc;IACd,YAAY;IACZ,uBAAuB;IACvB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,gCAAgC;IAChC,WAAW;IACX,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Scan } from '../scan/scan.js';
2
+ /** One type of a file as a stored shape reads it: its members, and the named types they use. */
3
+ export interface DeclaredShape {
4
+ /** Each member without its whitespace, literals kept, sorted. */
5
+ readonly members: readonly string[];
6
+ readonly references: readonly string[];
7
+ }
8
+ /**
9
+ * The shape the file declares under `typeName`: an interface, an object type, an enum, or any
10
+ * other alias up to its semicolon. `undefined` when the file declares no such type.
11
+ */
12
+ export declare function declaredShape(scan: Scan, typeName: string): DeclaredShape | undefined;
13
+ //# sourceMappingURL=declared-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-shape.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/declared-shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAYD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgBrF"}
@@ -0,0 +1,100 @@
1
+ import { matchingBracket } from '../text/matching-bracket.js';
2
+ import { splitTopLevel } from '../text/split-top-level.js';
3
+ /** Words of a type that name no declaration: keywords, primitives, and the generic types of the language. */
4
+ const NOT_DECLARED = new Set([
5
+ ...['readonly', 'extends', 'keyof', 'typeof', 'infer', 'unique', 'symbol', 'in', 'is', 'as', 'any', 'void'],
6
+ ...['string', 'number', 'boolean', 'bigint', 'null', 'undefined', 'unknown', 'never', 'object', 'true', 'false'],
7
+ ...['Array', 'ReadonlyArray', 'Readonly', 'Record', 'Partial', 'Required', 'Pick', 'Omit', 'NonNullable', 'Date'],
8
+ ]);
9
+ /** A word of the type that is not a member name (`name:` or `name?:`) nor a method (`name(`). */
10
+ const TYPE_WORD = /(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$])(?!\s*\??\s*[:(])/g;
11
+ /**
12
+ * The shape the file declares under `typeName`: an interface, an object type, an enum, or any
13
+ * other alias up to its semicolon. `undefined` when the file declares no such type.
14
+ */
15
+ export function declaredShape(scan, typeName) {
16
+ const declared = new RegExp(`(?<![\\w$.])(?<!import\\s+)(interface|type|enum)\\s+${typeName}(?![\\w$])`).exec(scan.code);
17
+ if (declared === null) {
18
+ return undefined;
19
+ }
20
+ const from = declared.index + declared[0].length;
21
+ const [start, end] = bodyOf(scan.code, from);
22
+ return {
23
+ members: membersOf(scan, start, end).sort(),
24
+ references: declared[1] === 'enum' ? [] : typeWords(scan.code.slice(from, end), typeParameters(scan.code, from)),
25
+ };
26
+ }
27
+ /** The named types a piece of a type uses, its own type parameters aside; the members of an enum are values, never types. */
28
+ function typeWords(text, parameters) {
29
+ return [...text.matchAll(TYPE_WORD)]
30
+ .map(([word]) => word)
31
+ .filter((word) => !NOT_DECLARED.has(word) && !parameters.has(word));
32
+ }
33
+ /** The names `<T, U extends X = Y>` declares right after the name of the type. */
34
+ function typeParameters(code, from) {
35
+ const open = /^\s*</.exec(code.slice(from));
36
+ if (open === null) {
37
+ return new Set();
38
+ }
39
+ const start = from + open[0].length;
40
+ const list = code.slice(start, closingAngle(code, start));
41
+ return new Set(splitTopLevel(list).flatMap(({ code: part }) => /^[A-Za-z_$][\w$]*/.exec(part)?.[0] ?? []));
42
+ }
43
+ /** Offset of the `>` closing the list of type parameters that starts at `from`. */
44
+ function closingAngle(code, from) {
45
+ let depth = 0;
46
+ for (let at = from; at < code.length; at += 1) {
47
+ const char = code.charAt(at);
48
+ depth += char === '<' ? 1 : 0;
49
+ if (char === '>' && (depth -= 1) < 0) {
50
+ return at;
51
+ }
52
+ }
53
+ return code.length;
54
+ }
55
+ /** Between the braces of an interface, an object type or an enum; after `=` up to `;` for any other alias. */
56
+ function bodyOf(code, from) {
57
+ const header = /^[^{=;]*(?:=\s*)?/.exec(code.slice(from))?.[0] ?? '';
58
+ const at = from + header.length;
59
+ if (code.charAt(at) === '{') {
60
+ return [at + 1, matchingBracket(code, at)];
61
+ }
62
+ let depth = 0;
63
+ for (let end = at; end < code.length; end += 1) {
64
+ depth += depthChange(code.charAt(end));
65
+ if (depth === 0 && code.charAt(end) === ';') {
66
+ return [at, end];
67
+ }
68
+ }
69
+ return [at, code.length];
70
+ }
71
+ /** The members between two offsets, split at the separators of depth zero, each without its whitespace, literals kept. */
72
+ function membersOf(scan, from, to) {
73
+ const members = [];
74
+ let current = '';
75
+ let depth = 0;
76
+ for (let at = from; at < to; at += 1) {
77
+ const literal = scan.strings.find((record) => record.start === at);
78
+ const char = scan.code.charAt(at);
79
+ if (literal !== undefined) {
80
+ current += JSON.stringify(literal.value);
81
+ at = literal.end - 1;
82
+ }
83
+ else if (depth === 0 && ';,\n'.includes(char)) {
84
+ members.push(current);
85
+ current = '';
86
+ }
87
+ else {
88
+ depth += depthChange(char);
89
+ current += /\s/.test(char) ? '' : char;
90
+ }
91
+ }
92
+ return [...members, current].filter((member) => member !== '');
93
+ }
94
+ function depthChange(char) {
95
+ if ('([{'.includes(char)) {
96
+ return 1;
97
+ }
98
+ return ')]}'.includes(char) ? -1 : 0;
99
+ }
100
+ //# sourceMappingURL=declared-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-shape.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/declared-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAS3D,6GAA6G;AAC7G,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC;IAC3G,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;IAChH,GA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model/source-file.js';
2
+ import type { ClassShape } from '../structure/class-shape.js';
3
+ /** The classes of a production file of `domain/aggregates/` that extend `EventSourcedAggregate` of the kernel. */
4
+ export declare function eventSourcedClasses(file: SourceFile): readonly ClassShape[];
5
+ //# sourceMappingURL=event-sourced-classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-sourced-classes.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/event-sourced-classes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,UAAU,EAAE,CAa3E"}
@@ -0,0 +1,13 @@
1
+ const BASE = 'EventSourcedAggregate';
2
+ /** The classes of a production file of `domain/aggregates/` that extend `EventSourcedAggregate` of the kernel. */
3
+ export function eventSourcedClasses(file) {
4
+ const { location } = file;
5
+ if (location.area !== 'context' ||
6
+ file.isTest ||
7
+ location.layer !== 'domain' ||
8
+ location.inside[0] !== 'aggregates') {
9
+ return [];
10
+ }
11
+ return file.structure.classes.filter((shape) => shape.superclass === BASE);
12
+ }
13
+ //# sourceMappingURL=event-sourced-classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-sourced-classes.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/event-sourced-classes.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAErC,kHAAkH;AAClH,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAClD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,IACE,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,IAAI,CAAC,MAAM;QACX,QAAQ,CAAC,KAAK,KAAK,QAAQ;QAC3B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,YAAY,EACnC,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The words of the fact an event names, after the name of its aggregate: `InvoiceIssued` of
3
+ * `Invoice` is `issued`. The whole name when it does not start with the name of an aggregate.
4
+ */
5
+ export declare function factWords(eventName: string, aggregates: readonly string[]): string[];
6
+ //# sourceMappingURL=fact-words.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fact-words.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/fact-words.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAMpF"}
@@ -0,0 +1,10 @@
1
+ import { wordsOf } from './words-of.js';
2
+ /**
3
+ * The words of the fact an event names, after the name of its aggregate: `InvoiceIssued` of
4
+ * `Invoice` is `issued`. The whole name when it does not start with the name of an aggregate.
5
+ */
6
+ export function factWords(eventName, aggregates) {
7
+ const owner = aggregates.find((aggregate) => eventName.startsWith(aggregate) && /^[A-Z]/.test(eventName.slice(aggregate.length)));
8
+ return wordsOf(owner === undefined ? eventName : eventName.slice(owner.length));
9
+ }
10
+ //# sourceMappingURL=fact-words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fact-words.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/fact-words.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,UAA6B;IACxE,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAC3B,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CACnG,CAAC;IAEF,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** An apply method changes the state for one event; `restore` takes the state of a snapshot. */
2
+ export declare function isApplyMethod(name: string): boolean;
3
+ //# sourceMappingURL=is-apply-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-apply-method.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/is-apply-method.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD"}
@@ -0,0 +1,6 @@
1
+ const APPLY = /^apply[A-Z]/;
2
+ /** An apply method changes the state for one event; `restore` takes the state of a snapshot. */
3
+ export function isApplyMethod(name) {
4
+ return APPLY.test(name) || name === 'restore';
5
+ }
6
+ //# sourceMappingURL=is-apply-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-apply-method.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/is-apply-method.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,aAAa,CAAC;AAE5B,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,CAAC;AAChD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { SourceFile } from '../model/source-file.js';
2
+ export interface NamedImport {
3
+ readonly name: string;
4
+ readonly line: number;
5
+ }
6
+ /** The names a file imports from `@ddd-ts-kit/kernel`, any entry, among `wanted`. */
7
+ export declare function kernelNames(file: SourceFile, wanted: ReadonlySet<string>): NamedImport[];
8
+ //# sourceMappingURL=kernel-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-names.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/kernel-names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE,CAMxF"}
@@ -0,0 +1,7 @@
1
+ /** The names a file imports from `@ddd-ts-kit/kernel`, any entry, among `wanted`. */
2
+ export function kernelNames(file, wanted) {
3
+ return file.imports.flatMap(({ target, names, line }) => target.kind === 'package' && target.name.startsWith('@ddd-ts-kit/kernel')
4
+ ? names.filter((name) => wanted.has(name)).map((name) => ({ name, line }))
5
+ : []);
6
+ }
7
+ //# sourceMappingURL=kernel-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-names.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/kernel-names.ts"],"names":[],"mappings":"AAOA,qFAAqF;AACrF,MAAM,UAAU,WAAW,CAAC,IAAgB,EAAE,MAA2B;IACvE,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CACtD,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACvE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC,CAAC,EAAE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** The stored shapes a project has published: by event name, the fingerprint of each version. Written by `ddd-ts-kit docs --stored-events`, read by `event-sourcing/upcaster-required`. */
2
+ export type StoredEventsLock = Readonly<Record<string, Readonly<Record<string, string>>>>;
3
+ /** The lock of the project, empty when there is none or it cannot be read as one. */
4
+ export declare function readStoredEventsLock(root: string): StoredEventsLock;
5
+ //# sourceMappingURL=read-stored-events-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-stored-events-lock.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/read-stored-events-lock.ts"],"names":[],"mappings":"AAIA,2LAA2L;AAC3L,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1F,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAqBnE"}
@@ -0,0 +1,25 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { STORED_EVENTS_LOCK } from './stored-events-lock-file.js';
4
+ /** The lock of the project, empty when there is none or it cannot be read as one. */
5
+ export function readStoredEventsLock(root) {
6
+ let parsed;
7
+ try {
8
+ parsed = JSON.parse(fs.readFileSync(path.join(root, STORED_EVENTS_LOCK), 'utf8'));
9
+ }
10
+ catch {
11
+ return {};
12
+ }
13
+ return isRecord(parsed)
14
+ ? Object.fromEntries(Object.entries(parsed).map(([name, versions]) => [
15
+ name,
16
+ isRecord(versions)
17
+ ? Object.fromEntries(Object.entries(versions).filter((entry) => typeof entry[1] === 'string'))
18
+ : {},
19
+ ]))
20
+ : {};
21
+ }
22
+ function isRecord(value) {
23
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
24
+ }
25
+ //# sourceMappingURL=read-stored-events-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-stored-events-lock.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/read-stored-events-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKlE,qFAAqF;AACrF,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,IAAI,MAAe,CAAC;IAEpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC;QACrB,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;YAC/C,IAAI;YACJ,QAAQ,CAAC,QAAQ,CAAC;gBAChB,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CACpG;gBACH,CAAC,CAAC,EAAE;SACP,CAAC,CACH;QACH,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Scan } from '../scan/scan.js';
2
+ import type { StoredShape } from './stored-shape.js';
3
+ /**
4
+ * The shape a type declares in the file, with the shapes of the named types it reaches that the
5
+ * same file declares: members of each body, comments left out, whitespace outside literals
6
+ * removed, sorted. Two declarations of the same fields have the same fingerprint whatever their
7
+ * layout and order; any other change of a field, of its type, of a literal in it or of a type it
8
+ * names gives another one. A named type the file does not declare is listed as unresolved: its
9
+ * changes would not move the fingerprint. `undefined` when the file declares no such type.
10
+ */
11
+ export declare function readStoredShape(scan: Scan, typeName: string): StoredShape | undefined;
12
+ //# sourceMappingURL=read-stored-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-stored-shape.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/read-stored-shape.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CA8BrF"}
@@ -0,0 +1,46 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { declaredShape } from './declared-shape.js';
3
+ /**
4
+ * Stored shapes the kit itself owns and keeps readable across its releases: named in a data
5
+ * type, they are not declared in the codec file.
6
+ */
7
+ const KIT_STORED_TYPES = new Set(['PersonalValue']);
8
+ /**
9
+ * The shape a type declares in the file, with the shapes of the named types it reaches that the
10
+ * same file declares: members of each body, comments left out, whitespace outside literals
11
+ * removed, sorted. Two declarations of the same fields have the same fingerprint whatever their
12
+ * layout and order; any other change of a field, of its type, of a literal in it or of a type it
13
+ * names gives another one. A named type the file does not declare is listed as unresolved: its
14
+ * changes would not move the fingerprint. `undefined` when the file declares no such type.
15
+ */
16
+ export function readStoredShape(scan, typeName) {
17
+ const root = declaredShape(scan, typeName);
18
+ if (root === undefined) {
19
+ return undefined;
20
+ }
21
+ const nested = [];
22
+ const unresolved = [];
23
+ const seen = new Set([typeName]);
24
+ const pending = [...root.references];
25
+ for (let name = pending.shift(); name !== undefined; name = pending.shift()) {
26
+ if (seen.has(name) || KIT_STORED_TYPES.has(name)) {
27
+ continue;
28
+ }
29
+ seen.add(name);
30
+ const shape = declaredShape(scan, name);
31
+ if (shape === undefined) {
32
+ unresolved.push(name);
33
+ }
34
+ else {
35
+ nested.push(`${name}=${shape.members.join(';')}`);
36
+ pending.push(...shape.references);
37
+ }
38
+ }
39
+ return { fingerprint: digest(root.members, nested), unresolved };
40
+ }
41
+ /** A shape that names no type of the file keeps the digest of its members alone. */
42
+ function digest(members, nested) {
43
+ const text = nested.length === 0 ? members.join(';') : `${members.join(';')}|${[...nested].sort().join('|')}`;
44
+ return `sha256:${createHash('sha256').update(text).digest('hex').slice(0, 16)}`;
45
+ }
46
+ //# sourceMappingURL=read-stored-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-stored-shape.js","sourceRoot":"","sources":["../../../src/check/event-sourcing/read-stored-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU,EAAE,QAAgB;IAC1D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAa,EAAE,C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AM,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAE9G,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AAClF,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The offsets in `code` where something of `this` is written: an assignment, an increment or a mutating call. */
2
+ export declare function stateWrites(code: string, from: number, to: number): number[];
3
+ //# sourceMappingURL=state-writes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-writes.d.ts","sourceRoot":"","sources":["../../../src/check/event-sourcing/state-writes.ts"],"names":[],"mappings":"AAQA,kHAAkH;AAClH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAM5E"}
@@ -0,0 +1,11 @@
1
+ const ASSIGNMENT = /(?<![\w$.])this\s*\.\s*[\w$]+(?:\s*(?:\.\s*[\w$]+|\[[^\]]*\]))*\s*(?:\*\*|>>>|<<|>>|&&|\|\||\?\?|[-+*/%&|^])?=(?![=>])/g;
2
+ const INCREMENT = /(?:\+\+|--)\s*this\s*\.|(?<![\w$.])this\s*\.\s*[\w$]+(?:\s*\.\s*[\w$]+)*\s*(?:\+\+|--)/g;
3
+ const MUTATOR = /(?<![\w$.])this\s*\.\s*[\w$]+(?:\s*\.\s*[\w$]+)*\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin|set|add|delete|clear)\s*\(/g;
4
+ /** The offsets in `code` where something of `this` is written: an assignment, an increment or a mutating call. */
5
+ export function stateWrites(code, from, to) {
6
+ const body = code.slice(from, to);
7
+ return [ASSIGNMENT, INCREMENT, MUTATOR]
8
+ .flatMap((pattern) => [...body.matchAll(pattern)].map((match) => from + match.index))
9
+ .sort((a, b) => a - b);
10
+ }
11
+ //# sourceMappingURL=state-writes.js.map