ddd-ts-kit 0.100.0 → 0.102.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 (463) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.fr.md +17 -10
  3. package/README.md +16 -9
  4. package/dist/build/emitted-place.d.ts +1 -2
  5. package/dist/build/emitted-place.d.ts.map +1 -1
  6. package/dist/build/emitted-specifier.d.ts +7 -1
  7. package/dist/build/emitted-specifier.d.ts.map +1 -1
  8. package/dist/build/emitted-specifier.js +5 -6
  9. package/dist/build/emitted-specifier.js.map +1 -1
  10. package/dist/build/emitted-target.d.ts +6 -5
  11. package/dist/build/emitted-target.d.ts.map +1 -1
  12. package/dist/build/emitted-target.js +5 -9
  13. package/dist/build/emitted-target.js.map +1 -1
  14. package/dist/build/rewrite-aliases.d.ts.map +1 -1
  15. package/dist/build/rewrite-aliases.js +4 -5
  16. package/dist/build/rewrite-aliases.js.map +1 -1
  17. package/dist/build/rewrite-specifiers.d.ts +7 -6
  18. package/dist/build/rewrite-specifiers.d.ts.map +1 -1
  19. package/dist/build/rewrite-specifiers.js +6 -4
  20. package/dist/build/rewrite-specifiers.js.map +1 -1
  21. package/dist/build/unresolved-problem.d.ts +2 -1
  22. package/dist/build/unresolved-problem.d.ts.map +1 -1
  23. package/dist/build/unresolved-problem.js +2 -2
  24. package/dist/build/unresolved-problem.js.map +1 -1
  25. package/dist/check/business-names/parameter-lists.js +1 -3
  26. package/dist/check/business-names/parameter-lists.js.map +1 -1
  27. package/dist/check/engine/run-check.d.ts +3 -0
  28. package/dist/check/engine/run-check.d.ts.map +1 -1
  29. package/dist/check/engine/run-check.js +1 -1
  30. package/dist/check/engine/run-check.js.map +1 -1
  31. package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
  32. package/dist/check/explain/tenancy-docs.js +13 -3
  33. package/dist/check/explain/tenancy-docs.js.map +1 -1
  34. package/dist/check/fixtures/conjunct-cases.d.ts +11 -0
  35. package/dist/check/fixtures/conjunct-cases.d.ts.map +1 -0
  36. package/dist/check/fixtures/conjunct-cases.js +19 -0
  37. package/dist/check/fixtures/conjunct-cases.js.map +1 -0
  38. package/dist/check/fixtures/privacy-fixtures.d.ts.map +1 -1
  39. package/dist/check/fixtures/privacy-fixtures.js +22 -0
  40. package/dist/check/fixtures/privacy-fixtures.js.map +1 -1
  41. package/dist/check/fixtures/run-fixture.d.ts +3 -2
  42. package/dist/check/fixtures/run-fixture.d.ts.map +1 -1
  43. package/dist/check/fixtures/run-fixture.js +3 -3
  44. package/dist/check/fixtures/run-fixture.js.map +1 -1
  45. package/dist/check/fixtures/run-self-check.js +1 -1
  46. package/dist/check/fixtures/run-self-check.js.map +1 -1
  47. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts +3 -0
  48. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts.map +1 -0
  49. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js +33 -0
  50. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js.map +1 -0
  51. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts +4 -0
  52. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts.map +1 -0
  53. package/dist/check/fixtures/tenancy-conjunct-fixtures.js +12 -0
  54. package/dist/check/fixtures/tenancy-conjunct-fixtures.js.map +1 -0
  55. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts +3 -0
  56. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts.map +1 -0
  57. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js +49 -0
  58. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js.map +1 -0
  59. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts +3 -0
  60. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts.map +1 -0
  61. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js +32 -0
  62. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js.map +1 -0
  63. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts +3 -0
  64. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts.map +1 -0
  65. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js +34 -0
  66. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js.map +1 -0
  67. package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
  68. package/dist/check/fixtures/tenancy-fixtures.js +2 -0
  69. package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
  70. package/dist/check/privacy/published-events-of.d.ts.map +1 -1
  71. package/dist/check/privacy/published-events-of.js +4 -2
  72. package/dist/check/privacy/published-events-of.js.map +1 -1
  73. package/dist/check/rules/clean-one-export-per-file.js +1 -0
  74. package/dist/check/rules/clean-one-export-per-file.js.map +1 -1
  75. package/dist/check/rules/schema-no-duplicate-shape.js +1 -3
  76. package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -1
  77. package/dist/check/rules/tenancy-scoped-statement.js +2 -2
  78. package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
  79. package/dist/check/schemas/class-shapes.d.ts.map +1 -1
  80. package/dist/check/schemas/class-shapes.js +5 -26
  81. package/dist/check/schemas/class-shapes.js.map +1 -1
  82. package/dist/check/structure/class-statements.d.ts +13 -0
  83. package/dist/check/structure/class-statements.d.ts.map +1 -0
  84. package/dist/check/structure/class-statements.js +34 -0
  85. package/dist/check/structure/class-statements.js.map +1 -0
  86. package/dist/check/structure/property-of.d.ts +13 -0
  87. package/dist/check/structure/property-of.d.ts.map +1 -0
  88. package/dist/check/structure/property-of.js +23 -0
  89. package/dist/check/structure/property-of.js.map +1 -0
  90. package/dist/check/tenancy/arguments-of-call.d.ts +3 -0
  91. package/dist/check/tenancy/arguments-of-call.d.ts.map +1 -0
  92. package/dist/check/tenancy/arguments-of-call.js +11 -0
  93. package/dist/check/tenancy/arguments-of-call.js.map +1 -0
  94. package/dist/check/tenancy/bare-expression.d.ts +3 -0
  95. package/dist/check/tenancy/bare-expression.d.ts.map +1 -0
  96. package/dist/check/tenancy/bare-expression.js +9 -0
  97. package/dist/check/tenancy/bare-expression.js.map +1 -0
  98. package/dist/check/tenancy/bracket-depth.d.ts +3 -0
  99. package/dist/check/tenancy/bracket-depth.d.ts.map +1 -0
  100. package/dist/check/tenancy/bracket-depth.js +10 -0
  101. package/dist/check/tenancy/bracket-depth.js.map +1 -0
  102. package/dist/check/tenancy/chain-links.d.ts +17 -0
  103. package/dist/check/tenancy/chain-links.d.ts.map +1 -0
  104. package/dist/check/tenancy/chain-links.js +24 -0
  105. package/dist/check/tenancy/chain-links.js.map +1 -0
  106. package/dist/check/tenancy/choice-branches.d.ts +3 -0
  107. package/dist/check/tenancy/choice-branches.d.ts.map +1 -0
  108. package/dist/check/tenancy/choice-branches.js +39 -0
  109. package/dist/check/tenancy/choice-branches.js.map +1 -0
  110. package/dist/check/tenancy/declaration-before.d.ts +12 -0
  111. package/dist/check/tenancy/declaration-before.d.ts.map +1 -0
  112. package/dist/check/tenancy/declaration-before.js +11 -0
  113. package/dist/check/tenancy/declaration-before.js.map +1 -0
  114. package/dist/check/tenancy/declaration-of.d.ts +1 -5
  115. package/dist/check/tenancy/declaration-of.d.ts.map +1 -1
  116. package/dist/check/tenancy/declaration-of.js +3 -8
  117. package/dist/check/tenancy/declaration-of.js.map +1 -1
  118. package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
  119. package/dist/check/tenancy/drizzle-unscoped.js +16 -3
  120. package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
  121. package/dist/check/tenancy/enclosed-by.d.ts +3 -0
  122. package/dist/check/tenancy/enclosed-by.d.ts.map +1 -0
  123. package/dist/check/tenancy/enclosed-by.js +6 -0
  124. package/dist/check/tenancy/enclosed-by.js.map +1 -0
  125. package/dist/check/tenancy/end-of-enclosing.d.ts +7 -0
  126. package/dist/check/tenancy/end-of-enclosing.d.ts.map +1 -0
  127. package/dist/check/tenancy/end-of-enclosing.js +18 -0
  128. package/dist/check/tenancy/end-of-enclosing.js.map +1 -0
  129. package/dist/check/tenancy/holds-condition.d.ts +14 -0
  130. package/dist/check/tenancy/holds-condition.d.ts.map +1 -0
  131. package/dist/check/tenancy/holds-condition.js +26 -0
  132. package/dist/check/tenancy/holds-condition.js.map +1 -0
  133. package/dist/check/tenancy/is-conjunct.d.ts +8 -0
  134. package/dist/check/tenancy/is-conjunct.d.ts.map +1 -0
  135. package/dist/check/tenancy/is-conjunct.js +17 -0
  136. package/dist/check/tenancy/is-conjunct.js.map +1 -0
  137. package/dist/check/tenancy/is-or-link.d.ts +4 -0
  138. package/dist/check/tenancy/is-or-link.d.ts.map +1 -0
  139. package/dist/check/tenancy/is-or-link.js +7 -0
  140. package/dist/check/tenancy/is-or-link.js.map +1 -0
  141. package/dist/check/tenancy/knex-links-outside-condition.d.ts +11 -0
  142. package/dist/check/tenancy/knex-links-outside-condition.d.ts.map +1 -0
  143. package/dist/check/tenancy/knex-links-outside-condition.js +108 -0
  144. package/dist/check/tenancy/knex-links-outside-condition.js.map +1 -0
  145. package/dist/check/tenancy/knex-unscoped.d.ts +3 -1
  146. package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
  147. package/dist/check/tenancy/knex-unscoped.js +12 -2
  148. package/dist/check/tenancy/knex-unscoped.js.map +1 -1
  149. package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -1
  150. package/dist/check/tenancy/prisma-unscoped.js +15 -10
  151. package/dist/check/tenancy/prisma-unscoped.js.map +1 -1
  152. package/dist/check/tenancy/spreads-at-top.d.ts +9 -0
  153. package/dist/check/tenancy/spreads-at-top.d.ts.map +1 -0
  154. package/dist/check/tenancy/spreads-at-top.js +49 -0
  155. package/dist/check/tenancy/spreads-at-top.js.map +1 -0
  156. package/dist/check/tenancy/top-level-parts.d.ts +3 -0
  157. package/dist/check/tenancy/top-level-parts.d.ts.map +1 -0
  158. package/dist/check/tenancy/top-level-parts.js +13 -0
  159. package/dist/check/tenancy/top-level-parts.js.map +1 -0
  160. package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -1
  161. package/dist/check/tenancy/typeorm-unscoped.js +30 -16
  162. package/dist/check/tenancy/typeorm-unscoped.js.map +1 -1
  163. package/dist/check/tenancy/unconfined-where.d.ts +11 -0
  164. package/dist/check/tenancy/unconfined-where.d.ts.map +1 -0
  165. package/dist/check/tenancy/unconfined-where.js +18 -0
  166. package/dist/check/tenancy/unconfined-where.js.map +1 -0
  167. package/dist/config/read-config.d.ts.map +1 -1
  168. package/dist/config/read-config.js +20 -0
  169. package/dist/config/read-config.js.map +1 -1
  170. package/dist/declared/render-declarations.js +1 -3
  171. package/dist/declared/render-declarations.js.map +1 -1
  172. package/dist/describe/read-controllers.d.ts.map +1 -1
  173. package/dist/describe/read-controllers.js +18 -2
  174. package/dist/describe/read-controllers.js.map +1 -1
  175. package/dist/describe/read-event-definitions.d.ts +2 -0
  176. package/dist/describe/read-event-definitions.d.ts.map +1 -1
  177. package/dist/describe/read-event-definitions.js +1 -0
  178. package/dist/describe/read-event-definitions.js.map +1 -1
  179. package/dist/describe/schema-class-of.js +8 -1
  180. package/dist/describe/schema-class-of.js.map +1 -1
  181. package/dist/digest/tree-at.d.ts.map +1 -1
  182. package/dist/digest/tree-at.js +2 -0
  183. package/dist/digest/tree-at.js.map +1 -1
  184. package/dist/docs/context-sections.js +3 -7
  185. package/dist/docs/context-sections.js.map +1 -1
  186. package/dist/docs/personal-event-lines.d.ts +7 -0
  187. package/dist/docs/personal-event-lines.d.ts.map +1 -0
  188. package/dist/docs/personal-event-lines.js +34 -0
  189. package/dist/docs/personal-event-lines.js.map +1 -0
  190. package/dist/docs/write-docs.d.ts.map +1 -1
  191. package/dist/docs/write-docs.js +2 -0
  192. package/dist/docs/write-docs.js.map +1 -1
  193. package/dist/docs/write-personal-events.d.ts +11 -0
  194. package/dist/docs/write-personal-events.d.ts.map +1 -0
  195. package/dist/docs/write-personal-events.js +28 -0
  196. package/dist/docs/write-personal-events.js.map +1 -0
  197. package/dist/generate/flags-of.d.ts +4 -0
  198. package/dist/generate/flags-of.d.ts.map +1 -0
  199. package/dist/generate/flags-of.js +6 -0
  200. package/dist/generate/flags-of.js.map +1 -0
  201. package/dist/generate/held-to-glossary.d.ts +9 -0
  202. package/dist/generate/held-to-glossary.d.ts.map +1 -0
  203. package/dist/generate/held-to-glossary.js +11 -0
  204. package/dist/generate/held-to-glossary.js.map +1 -0
  205. package/dist/generate/kind-help.d.ts +2 -0
  206. package/dist/generate/kind-help.d.ts.map +1 -1
  207. package/dist/generate/kind-help.js +2 -0
  208. package/dist/generate/kind-help.js.map +1 -1
  209. package/dist/generate/kinds/adapter-kind.js +1 -1
  210. package/dist/generate/kinds/adapter-kind.js.map +1 -1
  211. package/dist/generate/kinds/assert-event-store.d.ts +5 -1
  212. package/dist/generate/kinds/assert-event-store.d.ts.map +1 -1
  213. package/dist/generate/kinds/assert-event-store.js +11 -5
  214. package/dist/generate/kinds/assert-event-store.js.map +1 -1
  215. package/dist/generate/kinds/background/background-job-vars.js +4 -2
  216. package/dist/generate/kinds/background/background-job-vars.js.map +1 -1
  217. package/dist/generate/kinds/background/class-payload-schema.js +3 -3
  218. package/dist/generate/kinds/background/class-payload-schema.js.map +1 -1
  219. package/dist/generate/kinds/background-job-kind.js +1 -1
  220. package/dist/generate/kinds/background-job-kind.js.map +1 -1
  221. package/dist/generate/kinds/builder-kind.js +1 -1
  222. package/dist/generate/kinds/builder-kind.js.map +1 -1
  223. package/dist/generate/kinds/command-kind.js +1 -1
  224. package/dist/generate/kinds/command-kind.js.map +1 -1
  225. package/dist/generate/kinds/declarations-of.d.ts +11 -0
  226. package/dist/generate/kinds/declarations-of.d.ts.map +1 -0
  227. package/dist/generate/kinds/declarations-of.js +17 -0
  228. package/dist/generate/kinds/declarations-of.js.map +1 -0
  229. package/dist/generate/kinds/e2e-kind.js +1 -1
  230. package/dist/generate/kinds/e2e-kind.js.map +1 -1
  231. package/dist/generate/kinds/erasure-handler-kind.js +1 -1
  232. package/dist/generate/kinds/erasure-handler-kind.js.map +1 -1
  233. package/dist/generate/kinds/event-type-as-published.d.ts +11 -0
  234. package/dist/generate/kinds/event-type-as-published.d.ts.map +1 -0
  235. package/dist/generate/kinds/event-type-as-published.js +17 -0
  236. package/dist/generate/kinds/event-type-as-published.js.map +1 -0
  237. package/dist/generate/kinds/form-kind.js +1 -1
  238. package/dist/generate/kinds/form-kind.js.map +1 -1
  239. package/dist/generate/kinds/generate-event-sourced-repository.js +8 -1
  240. package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -1
  241. package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
  242. package/dist/generate/kinds/integration-event-kind.js +2 -9
  243. package/dist/generate/kinds/integration-event-kind.js.map +1 -1
  244. package/dist/generate/kinds/integration-handler-kind.d.ts.map +1 -1
  245. package/dist/generate/kinds/integration-handler-kind.js +30 -14
  246. package/dist/generate/kinds/integration-handler-kind.js.map +1 -1
  247. package/dist/generate/kinds/job-kind.js +1 -1
  248. package/dist/generate/kinds/job-kind.js.map +1 -1
  249. package/dist/generate/kinds/module-kind.js +1 -1
  250. package/dist/generate/kinds/module-kind.js.map +1 -1
  251. package/dist/generate/kinds/parse-version.d.ts +3 -0
  252. package/dist/generate/kinds/parse-version.d.ts.map +1 -0
  253. package/dist/generate/kinds/parse-version.js +9 -0
  254. package/dist/generate/kinds/parse-version.js.map +1 -0
  255. package/dist/generate/kinds/pick-declaration.d.ts +9 -0
  256. package/dist/generate/kinds/pick-declaration.d.ts.map +1 -0
  257. package/dist/generate/kinds/pick-declaration.js +14 -0
  258. package/dist/generate/kinds/pick-declaration.js.map +1 -0
  259. package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
  260. package/dist/generate/kinds/presentation/controller-of.js +15 -5
  261. package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
  262. package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
  263. package/dist/generate/kinds/projection-kind.js +21 -12
  264. package/dist/generate/kinds/projection-kind.js.map +1 -1
  265. package/dist/generate/kinds/property-kind.js +1 -1
  266. package/dist/generate/kinds/property-kind.js.map +1 -1
  267. package/dist/generate/kinds/refuse-unpublished-version.d.ts +7 -0
  268. package/dist/generate/kinds/refuse-unpublished-version.d.ts.map +1 -0
  269. package/dist/generate/kinds/refuse-unpublished-version.js +15 -0
  270. package/dist/generate/kinds/refuse-unpublished-version.js.map +1 -0
  271. package/dist/generate/kinds/repository-kind.js +1 -1
  272. package/dist/generate/kinds/repository-kind.js.map +1 -1
  273. package/dist/generate/kinds/representation-kind.js +1 -1
  274. package/dist/generate/kinds/representation-kind.js.map +1 -1
  275. package/dist/generate/kinds/route/controller-vars.js +1 -1
  276. package/dist/generate/kinds/route/controller-vars.js.map +1 -1
  277. package/dist/generate/kinds/route/message-call.d.ts +6 -2
  278. package/dist/generate/kinds/route/message-call.d.ts.map +1 -1
  279. package/dist/generate/kinds/route/message-call.js +2 -1
  280. package/dist/generate/kinds/route/message-call.js.map +1 -1
  281. package/dist/generate/kinds/route/message-vars.d.ts.map +1 -1
  282. package/dist/generate/kinds/route/message-vars.js +5 -2
  283. package/dist/generate/kinds/route/message-vars.js.map +1 -1
  284. package/dist/generate/kinds/route/route-vars.js +1 -1
  285. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  286. package/dist/generate/kinds/route/spec-vars.d.ts +2 -1
  287. package/dist/generate/kinds/route/spec-vars.d.ts.map +1 -1
  288. package/dist/generate/kinds/route/spec-vars.js +26 -7
  289. package/dist/generate/kinds/route/spec-vars.js.map +1 -1
  290. package/dist/generate/kinds/route/standard-schema-of.d.ts +2 -1
  291. package/dist/generate/kinds/route/standard-schema-of.d.ts.map +1 -1
  292. package/dist/generate/kinds/route/standard-schema-of.js +2 -4
  293. package/dist/generate/kinds/route/standard-schema-of.js.map +1 -1
  294. package/dist/generate/kinds/route-group-kind.js +1 -1
  295. package/dist/generate/kinds/route-group-kind.js.map +1 -1
  296. package/dist/generate/kinds/route-kind.js +2 -2
  297. package/dist/generate/kinds/route-kind.js.map +1 -1
  298. package/dist/generate/kinds/service-kind.js +1 -1
  299. package/dist/generate/kinds/service-kind.js.map +1 -1
  300. package/dist/generate/kinds/state-machine-kind.js +1 -1
  301. package/dist/generate/kinds/state-machine-kind.js.map +1 -1
  302. package/dist/generate/kinds/wanted-event.d.ts +6 -0
  303. package/dist/generate/kinds/wanted-event.d.ts.map +1 -0
  304. package/dist/generate/kinds/wanted-event.js +2 -0
  305. package/dist/generate/kinds/wanted-event.js.map +1 -0
  306. package/dist/generate/refuse-undeclared-flags.d.ts.map +1 -1
  307. package/dist/generate/refuse-undeclared-flags.js +9 -2
  308. package/dist/generate/refuse-undeclared-flags.js.map +1 -1
  309. package/dist/generator-lock/unreadable-lock-refusal.d.ts +4 -0
  310. package/dist/generator-lock/unreadable-lock-refusal.d.ts.map +1 -0
  311. package/dist/generator-lock/unreadable-lock-refusal.js +7 -0
  312. package/dist/generator-lock/unreadable-lock-refusal.js.map +1 -0
  313. package/dist/generator-lock/with-generator-lock.d.ts.map +1 -1
  314. package/dist/generator-lock/with-generator-lock.js +8 -7
  315. package/dist/generator-lock/with-generator-lock.js.map +1 -1
  316. package/dist/help/kind-help-text.d.ts.map +1 -1
  317. package/dist/help/kind-help-text.js +24 -13
  318. package/dist/help/kind-help-text.js.map +1 -1
  319. package/dist/init/files/platform-files.d.ts.map +1 -1
  320. package/dist/init/files/platform-files.js +14 -0
  321. package/dist/init/files/platform-files.js.map +1 -1
  322. package/dist/init/files/privacy-files.d.ts +2 -2
  323. package/dist/init/files/privacy-files.d.ts.map +1 -1
  324. package/dist/init/files/privacy-files.js +3 -2
  325. package/dist/init/files/privacy-files.js.map +1 -1
  326. package/dist/init/manifest/versions.js +24 -24
  327. package/dist/init/stack/http-cache-misfit.d.ts +4 -0
  328. package/dist/init/stack/http-cache-misfit.d.ts.map +1 -0
  329. package/dist/init/stack/http-cache-misfit.js +21 -0
  330. package/dist/init/stack/http-cache-misfit.js.map +1 -0
  331. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  332. package/dist/init/stack/resolve-stack.js +2 -1
  333. package/dist/init/stack/resolve-stack.js.map +1 -1
  334. package/dist/measures/timeline-of.js +1 -0
  335. package/dist/measures/timeline-of.js.map +1 -1
  336. package/dist/progress/format-progress.js +1 -0
  337. package/dist/progress/format-progress.js.map +1 -1
  338. package/dist/sdk/planned-clients.d.ts +2 -2
  339. package/dist/sdk/planned-clients.d.ts.map +1 -1
  340. package/dist/sdk/planned-clients.js +2 -6
  341. package/dist/sdk/planned-clients.js.map +1 -1
  342. package/dist/sdk/set-up-sdk.d.ts.map +1 -1
  343. package/dist/sdk/set-up-sdk.js +3 -2
  344. package/dist/sdk/set-up-sdk.js.map +1 -1
  345. package/dist/stack/stack-vars.js +12 -3
  346. package/dist/stack/stack-vars.js.map +1 -1
  347. package/dist/stories/forecast-merge.js +1 -0
  348. package/dist/stories/forecast-merge.js.map +1 -1
  349. package/dist/version.d.ts +1 -1
  350. package/dist/version.js +1 -1
  351. package/dist/worker/format-resume.d.ts.map +1 -1
  352. package/dist/worker/format-resume.js +5 -0
  353. package/dist/worker/format-resume.js.map +1 -1
  354. package/dist/worker/format-workers.js +5 -0
  355. package/dist/worker/format-workers.js.map +1 -1
  356. package/dist/worker/progress-of.d.ts +8 -3
  357. package/dist/worker/progress-of.d.ts.map +1 -1
  358. package/dist/worker/progress-of.js +2 -16
  359. package/dist/worker/progress-of.js.map +1 -1
  360. package/dist/worker/read-agent-record.d.ts.map +1 -1
  361. package/dist/worker/read-agent-record.js +15 -3
  362. package/dist/worker/read-agent-record.js.map +1 -1
  363. package/dist/worker/read-workers.js +2 -2
  364. package/dist/worker/read-workers.js.map +1 -1
  365. package/dist/worker/readable-progress.d.ts +5 -0
  366. package/dist/worker/readable-progress.d.ts.map +1 -0
  367. package/dist/worker/readable-progress.js +16 -0
  368. package/dist/worker/readable-progress.js.map +1 -0
  369. package/dist/worker/resume-worker.d.ts.map +1 -1
  370. package/dist/worker/resume-worker.js +4 -5
  371. package/dist/worker/resume-worker.js.map +1 -1
  372. package/dist/worker/worker-progress.d.ts +2 -1
  373. package/dist/worker/worker-progress.d.ts.map +1 -1
  374. package/dist/workspace/real-path-of.d.ts +2 -2
  375. package/dist/workspace/real-path-of.d.ts.map +1 -1
  376. package/dist/workspace/real-path-of.js +15 -10
  377. package/dist/workspace/real-path-of.js.map +1 -1
  378. package/package.json +5 -5
  379. package/templates/controller/controller.spec.ts.tpl +19 -0
  380. package/templates/docs/privacy-register.md.tpl +2 -0
  381. package/templates/init/README.md.tpl +13 -4
  382. package/templates/init/docker/env.example.tpl +8 -0
  383. package/templates/init/main.ts.tpl +3 -0
  384. package/templates/init/platform/audit/create-audit.ts.tpl +12 -6
  385. package/templates/init/platform/composition/compose-application.manual.ts.tpl +36 -0
  386. package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +7 -0
  387. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
  388. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
  389. package/templates/init/platform/composition/platform-options.manual.ts.tpl +7 -0
  390. package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
  391. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +7 -0
  392. package/templates/init/platform/config/app-config.ts.tpl +7 -0
  393. package/templates/init/platform/config/load-config.ts.tpl +22 -0
  394. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +14 -3
  395. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +5 -1
  396. package/templates/init/platform/jobs/create-background-work.ts.tpl +12 -0
  397. package/templates/init/platform/jobs/days-before.ts.tpl +8 -0
  398. package/templates/init/platform/jobs/housekeeping.module.tsyringe.ts.tpl +46 -0
  399. package/templates/init/platform/jobs/housekeeping.ts.tpl +24 -0
  400. package/templates/init/platform/jobs/job-settings.ts.tpl +6 -0
  401. package/templates/init/platform/privacy/personal-events.ts.tpl +11 -0
  402. package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +69 -19
  403. package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +69 -8
  404. package/templates/init/platform/privacy/run-export.manual.ts.tpl +2 -2
  405. package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +4 -2
  406. package/templates/init/platform/privacy/run-purge.manual.ts.tpl +3 -2
  407. package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +4 -2
  408. package/templates/init/rules/infrastructure.md.tpl +1 -1
  409. package/templates/init/scripts/privacy-erase.manual.ts.tpl +52 -7
  410. package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +52 -7
  411. package/templates/init/scripts/privacy-export.manual.ts.tpl +4 -0
  412. package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +4 -0
  413. package/templates/init/scripts/privacy-purge.manual.ts.tpl +4 -0
  414. package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +4 -0
  415. package/templates/integration-event/payload.class-validator.ts.tpl +2 -2
  416. package/templates/nest-controller/controller.spec.ts.tpl +25 -0
  417. package/templates/pipeline/package-scripts.json +1 -1
  418. package/templates/pipeline/stryker.config.mjs.tpl +4 -0
  419. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.accepted.class-validator.per-route.ts.tpl +1 -1
  420. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.accepted.class-validator.per-route.ts.tpl +1 -1
  421. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.body.class-validator.ts.tpl +1 -1
  422. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  423. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.body.class-validator.per-route.ts.tpl +1 -1
  424. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  425. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.body.class-validator.per-route.ts.tpl +1 -1
  426. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.accepted.class-validator.per-route.ts.tpl +1 -1
  427. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.body.class-validator.ts.tpl +1 -1
  428. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.params.class-validator.ts.tpl +2 -2
  429. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
  430. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.body.class-validator.ts.tpl +4 -4
  431. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.params.class-validator.ts.tpl +1 -1
  432. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.accepted.class-validator.ts.tpl +2 -2
  433. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.body.class-validator.ts.tpl +2 -2
  434. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.params.class-validator.ts.tpl +1 -1
  435. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.accepted.class-validator.per-route.ts.tpl +1 -1
  436. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.body.class-validator.ts.tpl +2 -2
  437. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.accepted.class-validator.per-route.ts.tpl +1 -1
  438. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.params.class-validator.ts.tpl +2 -2
  439. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
  440. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.params.class-validator.ts.tpl +2 -2
  441. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  442. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.params.class-validator.ts.tpl +2 -2
  443. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.line.class-validator.ts.tpl +6 -6
  444. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.params.class-validator.ts.tpl +1 -1
  445. package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.class-validator.shared.ts.tpl +1 -1
  446. package/templates/presets/identity/context/published-language/account-deactivated.v1.payload.class-validator.ts.tpl +1 -1
  447. package/templates/presets/identity/context/published-language/delegation-granted.v1.payload.class-validator.ts.tpl +7 -7
  448. package/templates/presets/identity/context/published-language/delegation-revoked.v1.payload.class-validator.ts.tpl +4 -4
  449. package/templates/presets/identity/context/published-language/member-joined.v1.payload.class-validator.ts.tpl +4 -4
  450. package/templates/presets/identity/context/published-language/member-removed.v1.payload.class-validator.ts.tpl +4 -4
  451. package/templates/presets/identity/context/published-language/member-role-changed.v1.payload.class-validator.ts.tpl +6 -6
  452. package/templates/presets/identity/context/published-language/organisation-opened.v1.payload.class-validator.ts.tpl +3 -3
  453. package/templates/route/dto.accepted.ts.tpl +1 -1
  454. package/templates/route/dto.answer.ts.tpl +1 -1
  455. package/templates/route/dto.body.ts.tpl +1 -1
  456. package/templates/route/dto.line.ts.tpl +2 -2
  457. package/templates/route/route.spec.ts.tpl +19 -0
  458. package/templates/schema/schema.class-validator.ts.tpl +1 -1
  459. package/templates/worker/main.ts.tpl +3 -0
  460. package/dist/generate/kinds/find-event-declaration.d.ts +0 -8
  461. package/dist/generate/kinds/find-event-declaration.d.ts.map +0 -1
  462. package/dist/generate/kinds/find-event-declaration.js +0 -27
  463. package/dist/generate/kinds/find-event-declaration.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,110 @@ What each version changes for someone who uses the kit. The packages of `package
4
4
  together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
5
5
  list the pull requests behind it.
6
6
 
7
+ ## 0.102.0
8
+
9
+ **A subscription removed while its consumer was starting no longer leaves a consumer without handler, on RabbitMQ and on NATS.** The consumer stayed registered with nothing to handle a message: each one came back at once, in a loop with no delay, until a handler took it or the bus closed. The consumer now leaves as soon as it is registered, and the messages wait in the queue or the stream for the next handler.
10
+
11
+ **A dangling link at `.ddd-ts-kit/lock` no longer hangs a command that takes the generator lock.** The command waited forever, with no message. It now waits as long as for a lock another command holds, then refuses, says what stands there and writes nothing.
12
+
13
+ **`test:mutation` of a project generated on pnpm runs its mutants.** Stryker looks for its plugins beside its own real path, where pnpm's strict layout keeps `core` alone, so the run died in two seconds on `Cannot find TestRunner plugin "vitest"` (and `"jest"`) before any mutant. The generated `stryker.config.mjs` now names the runner of the stack in `plugins`, `@stryker-mutator/vitest-runner` or `@stryker-mutator/jest-runner`; the ignorer of the kit is still appended by `governedMutation()`. An end-to-end spec installs a project with pnpm (Vitest and Jest) and with npm, and runs `test:mutation` on one aggregate.
14
+
15
+ To move: a project already generated on pnpm adds `plugins: ['@stryker-mutator/vitest-runner']` (or `'@stryker-mutator/jest-runner'`) to its `stryker.config.mjs`.
16
+
17
+ **`runCheck` of the `ddd-ts-kit` package takes a `catalogue` option: the rules it judges with, the rules of the kit unless it is given.** It replaces those rules for the run. The commands do not pass it.
18
+
19
+ **The contracts of `@ddd-ts-kit/testing` hold more of what an adapter answers at the edges.** `outboxStoreContract` takes an empty batch, an empty publication and an empty revival as nothing to do, and expects `markFailed` to leave a published record published and to ignore an unknown id. The job store contract expects `false` for the heartbeat of a job the store does not hold. The event store contract loads a consignment again after a refused append and reads the winner's weight. A project that runs these contracts on an adapter of its own may see a new case fail: the case says what the port promises.
20
+
21
+ `controllerRoutes` of `@ddd-ts-kit/http` types the result of a tuple of one controller as a tuple of one route.
22
+
23
+ **The personal data erasure contract also runs a declaration that names no file column: `personalDataErasureContract` of `@ddd-ts-kit/testing` takes a `createWithoutFiles()` option beside `create()`.** Most tables of a context hold no file: the contract now proves that an adapter given such a declaration needs no file storage and still reaches the rows of the subject as the declaration says (erased with `row`, or their personal columns set to null). The four ORM adapters and the in-memory fake pass it.
24
+
25
+ To move: a project that runs `personalDataErasureContract` on an adapter of its own gives it `createWithoutFiles()`, a fresh subject over an empty table whose declaration names no file column, with no file storage handed to the adapter; it is called before each test, as `create()` is.
26
+
27
+ **`StdoutLogger` takes a `stream` option.** The lines go to that stream instead of the standard output, and `flush()` waits for it. A `write` of the project still receives each line and wins over `stream`.
28
+
29
+ **A form refuses a body property whose name holds a dot, when the routes are built.** A field of a form is named by its path, whose segments a dot separates, so `address.line1` read as a nested field: the form lost its constraints and changed its key.
30
+
31
+ To move: rename the property, or keep it out of the body of the form.
32
+
33
+ **A controller whose schema is written inline no longer crashes `describe`, `docs` and `digest`.** `body: z.object({ amount: z.number(), currency: z.string() })` ended in a raw `SyntaxError`. The schema is now reported whole, over several lines included, and a part that closes the options with no comma after it is read too.
34
+
35
+ **A `ddd-ts-kit.config.json` nested more than 32 levels deep is refused with a message.** The command died on a raw `RangeError` when it tried to print such a value, and `digest` did on any commit that held one.
36
+
37
+ **A stored background job keeps who acts, never the profile a credential gave.** `StoredJobQueue` writes the id, the type, the tenant, the roles and the `tenants` attribute of the actor into `enqueued_by`; the email, the username and every other attribute stay with the request, so a job row holds nothing of the person who asked for it. `actorAttributes` of `StoredJobQueue` names an attribute a run needs.
38
+
39
+ To move: a job that reads `execution.actor.attributes` other than `tenants` receives it in its payload, reads the actor again by its id, or names it in `actorAttributes` (`new StoredJobQueue({ ..., actorAttributes: ['department'] })`, in `create-background-work.ts` or the `jobQueue` option of `kernelModule`). Jobs already waiting keep the attributes they were stored with.
40
+
41
+ **A tenant refusal below the edge answers what it means, on every HTTP adapter and RPC procedure, instead of a 500.** `NoCurrentTenantError`, `InvalidTenantIdError` and `EventStreamTenantError` are now `DomainError`s: a caller who names no tenant is answered 403 `FORBIDDEN`, a credential that names an id outside the grammar 404 `NOT_FOUND`, an append to a stream of another tenant 404 `NOT_FOUND`, with no word of the stream or of the id named. Each is logged as a warning and sent to no error tracker.
42
+
43
+ To move: code that told these errors from a refusal by `instanceof DomainError` now sees a refusal. A scheduled or background job refused this way fails its run with `errorCode` `FORBIDDEN` or `NOT_FOUND` instead of `UNEXPECTED_ERROR`, and is no longer sent to the error tracker: an alert on those runs reads the code.
44
+
45
+ **An erasure reaches what the outbox and the job store keep of the person.** `eraseDataSubject` takes `shared`, the copies no tenant confines, run once. `runErasure` gives it `personalEventsInOutbox(store, personalEvents)` of `@ddd-ts-kit/events`, which erases the fields the `personal` option of an event lists in every record that names the person, pending, published or dead, and `jobsOfSubject(store)` of `@ddd-ts-kit/scheduling`, which drops every job enqueued with the person as `subject`, whatever its status: a waiting job does not run, a running one stops at its next heartbeat. Each writes its entry to the audit trail, and the report names them `platform.outbox` and `platform.background-jobs`. `ddd-ts-kit docs` writes `src/platform/privacy/personal-events.ts` from the `personal` options, and `docs --check` holds it to them. `OutboxStore` gains `erasePersonalFields(subject, events)` and `JobStore` gains `eraseSubject(subject)`, on the four ORM, in memory and on Redis, under their contract suites. A pending record goes out with `[erased]` in place of the field: a consumer whose schema refuses that text refuses the event, and nothing of the person leaves. What stays out of reach is a message already delivered, a field no `personal` option lists, and a job that holds a person without naming them as `subject`.
46
+
47
+ To move: `init --force` rewrites `src/platform/privacy/run-erasure.ts`, then run `ddd-ts-kit docs`. A job about a person is enqueued with `{ subject: personId }`. A store of your own implements `erasePersonalFields` (with `erasedPayloadOf` of `@ddd-ts-kit/events`) or `eraseSubject`, and passes `outboxStoreContract` or `jobStoreContract`. With `--di manual`, `Platform` gains `jobStore`, which `create-background-work.ts` hands on.
48
+
49
+ **An erasure that reached nothing announces nobody.** `runErasure` asks `eraseDataSubject` to refuse a subject no copy knows, so `privacy.data-subject.erased` goes out only once something was erased. `privacy:erase` then prints why and exits with code 1: a mistyped id, a tenant the directory does not list, or an erasure already complete. `--rerun` (`rerun: true` of `runErasure`) says this person was erased before: reaching nothing is expected, the exit code is 0 and the erasure is announced again, which completes one that failed before its announcement.
50
+
51
+ To move: a script that runs `privacy:erase` twice for one person passes `--rerun` the second time. `init --force` rewrites `src/platform/privacy/run-erasure.ts` and `scripts/privacy-erase.ts`.
52
+
53
+ **A chain that does not verify stops its own archive, no other.** `archiveBefore` tries every chain, on the four SQL stores and on `InMemoryAuditTrail`, then throws `AuditArchiveRefusedError` once they all ran, with `refusals` (each with its `chain` and its `chainBreak`) and `archives` (what the other chains archived). A failure of the storage still ends the run where it is.
54
+
55
+ To move: `AuditArchiveRefusedError` holds `refusals` in place of `chain` and `chainBreak`, and its constructor takes them. Code that reads `error.chain` reads `error.refusals`.
56
+
57
+ **A chain cut at its tail does not verify against a later checkpoint.** `verifyChain` used to compare a checkpoint with the entry at its position only, so a checkpoint past the last entry was never read. A chain that stops before the last checkpoint given, inside `to` when there is one, is now reported `missing-entry` at the first position gone. Given entries without `chain`, a chain a checkpoint names and no entry holds is reported too. `auditTrailContract` takes `cut`, which removes the end of a chain behind the back of the trail.
58
+
59
+ `verifyChain` still stops at its first break, by decision: past it the chain proves nothing of what comes next. Whoever has looked at a break walks on with `from`, which the documentation now shows.
60
+
61
+ **An audit entry is hashed as the store keeps it, so a chain nobody touched always verifies, whatever text a record held.** A surrogate without its pair has no UTF-8 encoding and PostgreSQL refuses NUL: the entry used to be hashed with the text as it came and stored with something else, or not stored at all. `seal` now puts U+FFFD in their place in every text of the entry, the keys of `changes` and `extensions` and the name of the chain included, before it hashes, on the four SQL stores and on `InMemoryAuditTrail`. A text in `changes` or `extensions` no longer fails the command, and two tenants whose names differ only there share one chain, without a fork. `wellFormed` gives that form to a store of your own, and `auditTrailContract` holds every store to it.
62
+
63
+ A chain that already holds such an entry stays as it is: the text the entry was hashed over is gone, so `verifyChain` keeps reporting `altered-content` at that entry, and a trail is append-only, so nothing repairs it. That chain is not archived from there on; the other chains are. The entries after it verify with `from` set to the position after the break, which trusts that entry.
64
+
65
+ To move: a store of your own, held to `auditTrailContract`, passes every record through `wellFormed` before it hashes.
66
+
67
+ **`verifyChain(trail, { chain, after })` starts after the anchor it is given, so the verification of a chain that has archives holds.** It used to look for sequence 1 all the same and report a `missing-entry` on a chain that was fine, unless `from` said the position again. `from` now defaults to the position after `after`. The plain `verifyChain(trail, { chain })` keeps answering `missing-entry` at sequence 1 on a chain that has archives: the walk does not read the archives on its own, an anchor being what a row says until `verifyArchive` has proved it, so the caller names the one it trusts.
68
+
69
+ **Every erasure leaves its audit entry with its operator, with or without event sourcing.** `auditedPersonalDataErasure(copy, trail, { scope, clock, ids })` of `@ddd-ts-kit/audit` wraps a `PersonalDataCopy`: each run writes `data-access`, `personal-data:erase`, the subject, the name of the copy as `context` and `changes: { rows }`, `0` included, under the actor of the work. `runErasure` wraps every copy when the trail is on, in the three families of dependency injection, beside `auditedSubjectKeys` for the key.
70
+
71
+ To move: `init --force` rewrites `src/platform/privacy/run-erasure.ts`; a project that keeps its file wraps each copy of `copies` with `auditedPersonalDataErasure`.
72
+
73
+ **A failure whose audit entry could not be written is told to the log.** `logLostRecords(logger)` of `@ddd-ts-kit/audit` is an `onLostRecord` that writes one `audit entry lost` line, at level `error`: the category, the action and the reason of the entry, the type and the code of the failure, never its message. A generated project with the trail on passes it to `auditMiddleware`, `auditedSubjectKeys`, `auditedPersonalDataErasure`, `auditedPersonalDataExport` and `auditedPersonalDataRetention`, and the scripts of `--privacy on` now log errors.
74
+
75
+ To move: a generated project calls `createAudit(persistence, source, logger)`, and its `Audit` gains `onLostRecord`. `init --force` writes them; by hand, pass `logLostRecords(logger)` as `onLostRecord` to the sources above.
76
+
77
+ **`tenancy/scoped-statement` holds that the tenant condition is a conjunct of the statement, on the four ORM, and `tenantTable`, `ownTenantTable` and `whereTenant` hold it when the statement is built.** SQL binds `and` before `or`, so an alternative beside the condition is outside it. On Knex the rule reports `.orWhere*`, `.or`, `clearWhere()` and `clear('where')` on a statement of the helpers, on the chain, on a local, on what a function of the file answers and in a `modify`, and the three helpers throw `UngroupedOrError` or `ClearedTenantConditionError` when such a statement is built, whatever the rule can read; the text of a `whereRaw`, and a `knex.raw` given to a where, is kept in parentheses as one conjunct with its bindings; an `orHaving` applies after the where, and is free; their type does not change. On Drizzle the condition is a direct argument of `where` or of `and`, never under `or`, `not` or a `sql` template, and a local of the condition may now be given to `and`. On Prisma the helper is spread at the top of the `where` or of its `AND`, never under `OR`, `NOT` or a relation. On TypeORM the same, a where array spreads it in each entry, a query builder has no `orWhere` at its top, and the condition stands in its last `where` or an `andWhere` after it, since a `where` resets what comes before it. An `or` in a group and-ed with the condition stays correct: the callback of a Knex `where`, `and(tenantCondition(...), or(a, b))`, an `OR` beside the Prisma spread, `new Brackets(...)` in a TypeORM `andWhere`.
78
+
79
+ To move: where `ddd-ts-kit check` now reports a statement, put the alternatives in a group beside the condition, as `ddd-ts-kit explain tenancy/scoped-statement` shows. On Knex, do the same for a statement that throws `UngroupedOrError`, and start a new statement from the helper where one throws `ClearedTenantConditionError`: the helpers refuse at run time what the rule cannot read, such as a builder handed to another function.
80
+
81
+ **The guard holds a worker and the other sessions wherever a file stands, and says what it could not read.** A builder's editor tools are refused outside its worktree from its first call, in the checkout of the conductor, in another worktree and outside every project but the temp directory, with the instruction to name the file under its worktree. A worker's git only reads from any checkout but its own: the conductor alone lands a branch or moves its checkout, and no worker removes a worktree or writes a ref. The shell rules of the test writer, the story gate, the generated files and the baseline judge a place in the project that owns it; the test writer is refused a place only the shell knows, and its `test/` is the root one or the one of a context; what a redirection, `sed -i` or `tee` types in the code of a context on the trunk, or in a new file of a generated role, is refused as the editor tools refuse it. `check --baseline write` is read on the words of the command, through every launcher of the kit and the package scripts of the project.
82
+
83
+ A folder that holds a locked regression spec counts as the spec, and so does a write whose place only the shell knows; `find -exec` is judged by the folders it starts from, and reads through `find` and `xargs` stay free. What a worker's last command and its background commands change outside its scope is compared: a read keeps the note of the worktree, and at the stop the worker goes on once to put a file back, what stays reaching the conductor in `lastStop.outside` of `agent.json`, in its report, in `status --workers` and in `worker-scope --resume`.
84
+
85
+ A line that ends inside a quote, with a here-document that never closes, or that the reader breaks on is refused to a worker. The reader follows a here-document inside `$(...)`, `$'...'` and `$((...))`. The answers of the processes the guard starts are read up to 64 MiB: a `check` past it lets the session finish and says so, and a `git status` past it compares nothing and says so. A generated file put back or deleted (`git checkout`, `git restore`, `git rm`, `rm`) is no longer refused to a session, and `touch -t` no longer reads its date as a target.
86
+
87
+ To move: a worker that ran `git add`, `git commit` or `git merge` without `cd <worktree> &&`, or after `cd <worktree>;`, runs it as `cd <worktree> && ...`. A session that wrote the code of a context on the trunk by the shell opens a worktree, as the editor tools already asked.
88
+
89
+ **The platform purges what it is done with, every night.** `init` schedules `events.purge-published` at 03:30 UTC with an outbox and `jobs.purge-finished` at 03:45 UTC with a stored queue, both in the whole application: a published record and a job that succeeded or was cancelled keep their payload until then. `OUTBOX_RETENTION_DAYS` and `BACKGROUND_JOBS_RETENTION_DAYS` say how long, thirty days by default, `JOB_EVENTS_PURGE_PUBLISHED_ENABLED=false` and `JOB_JOBS_PURGE_FINISHED_ENABLED=false` switch one off in one environment. A dead event and a dead job stay until an operator decides.
90
+
91
+ To move: `init --force` writes `jobs/housekeeping.ts`, `jobs/days-before.ts`, on tsyringe `jobs/housekeeping.module.ts`, and their wiring. A project that purges by a job of its own removes that job, or gives the platform job its retention. A service of its own database schedules the two purges itself: `platformJobs: false` leaves them to the whole application.
92
+
93
+ **In a multi-tenant project, work that names no tenant is refused before it reads or appends to an event stream, and before it finds or cancels a stored job.** An event store given the execution scope now means a project whose streams belong to tenants: `readStream` and `append` refuse work that names no tenant with `NoCurrentTenantError` before any statement, on a stream that exists or not, so no stream is created in no tenant. A stream of another tenant is refused from whatever version it is read, and `EventSourcedRepository.findById` answers it as an id nobody saved. `readAll` and `head` stay open: a subscription applies each event in its tenant. `StoredJobQueue` takes `tenant: true`, which `kernelModule` sets when it is given `tenants`: `find` and `cancel` then refuse work that names no tenant before the store is read. `init --tenancy shared-table` writes both on the four ORM and every wiring, and the tenant suite of `eventStoreContract` proves the rule on every store. A project without tenancy hands neither and is unchanged. `generate aggregate --event-sourced` refuses a context declared `control-plane`, whose data belongs to no tenant.
94
+
95
+ To move: in a multi-tenant project, a global job that reads streams or finds jobs opens `acrossTenants`, and one that appends runs `per-tenant`. Where the platform is wired by hand or on Nest, add `tenant: true` to the `StoredJobQueue` of `src/platform/jobs/create-background-work.ts`. In `src/platform/database/persistence.contract.spec.ts`, `createStore` and `createCompanions` hand `eventSourcing` a `FixedExecutionScope` that names a tenant. A stream stored in no tenant is refused to everyone: give it its tenant in a migration (`addEventStoreTenantColumn(knex, { schema, tenantOfExistingStreams })` on Knex, an `update` of `tenant_id` otherwise). A project without tenancy that hands `scope` to its event store removes it. A custom `EventStore` held to `eventStoreContract` with `createTenantStore` refuses work that names no tenant, and answers its `createStore` in one tenant. An event-sourced aggregate of a `control-plane` context moves to a table.
96
+
97
+ ## 0.101.0
98
+
99
+ **A class the kit writes for class-validator refuses an input that lacks one of its fields, and `classSchema` refuses a class that gives a field an initial value.** A field was written with an initial value (`calendarId = ''`, `refundAmount = 0`, `notifyCustomer = false`), which class-transformer keeps for a field the input lacks: a request without `calendarId` passed `@IsString()` as if it carried an empty one, and a consumer read an integration event without it the same way. Each field is now `declare`d with no initial value (`declare calendarId: string;`), and an optional one is `@IsOptional()` with `declare note?: string;`. This covers the body, path parameter, `Accepted` and `Line` classes `generate route` writes (functions, controllers and Nest routes), the body fields it reads from the constructor of the command, the payload of `generate integration-event`, the optional fields of the payload of `generate background-job` (its required ones already were), and the DTOs and payloads of `init --preset identity`. The spec `generate route` writes for a route that reads its body from the command now sends that body without its first field and expects 422 `VALIDATION_FAILED` with an issue at `body.<field>` among the others (a constraint added to the field keeps it green), whatever the validation library. The `TODO(domain)` of an empty class-validator class says to `declare` its fields, and a nested one is marked `@IsDefined()` when it is required, since `@ValidateNested()` lets a missing object through. `privacy/event-payload-declared` reads a `declare`d member of a payload class and a member written with `public`, `private` or `protected`, which it skipped. `classSchema` of `@ddd-ts-kit/validation/class-validator` throws a `DeclarationError` when a fresh instance of the class holds a value (`reason = ''`, `amount = 0`), naming the class, the fields and the fix; a field written `note?: string` holds none and is let through.
100
+
101
+ To move: rewrite each decorated field of your class-validator DTOs and payloads without an initial value, `@IsString() calendarId = '';` becoming `@IsString() declare calendarId: string;` (and `@IsOptional() declare note?: string;` for an optional one); a field whose absence means a default is made `@IsOptional()` and the route reads it with `?? <default>`. A class left as it is now fails at the first `classSchema(...)`, in the first test or at the first start, with the fields to rewrite named.
102
+
103
+ **The refusal of `--http-cache varnish` names what was passed, or the flag whose default it is, never a flag that was not given.** `init --http-cache varnish --http none` said "cannot be combined with --http none --events outbox" although `--events` was not passed; it now says "needs an HTTP framework to put the cache in front of: this project has --http none". Without the outbox it says "needs --events outbox for its purge requests: this project has --events in-memory", and adds ", the default of --orm none" when `--events` was not passed. The fix line is unchanged.
104
+
105
+ **`generate --help` says which kinds are held to the glossary and what each kind comes after, and `plan-slices` states both rules as the generator applies them.** `generate --help --json` gives every kind `heldToGlossary`, true for the kinds whose usage shows `--term` (`context`, `module`, `aggregate`, `entity`, `value-object`, `state-machine`, `domain-event`, `error`, `domain-error`, `domain-service`, `command`, `query`, `file-upload`, `integration-event`, `integration-handler`, `event-handler`, `projection`, `job`, `background-job`, `process`, `policy`), and `generate <kind> --help` says it in one line beside `--module`: `Held to the glossary: ...` or `Refuses --term: ...`. The refusal of `--term` on a kind that takes none (`generate port does not take --term: it would be ignored.`) now names the kinds that take it in its fix. The summary of each kind that builds on what an earlier command writes ends with that command: `After generate route <context> <UseCase> under "stack.routes": "controllers" or "nest", or generate controller <context> <UseCase>.` for `representation` and `form`, `After generate command ... or generate query ...` for `route` and `controller` (with `--group`, after `generate route-group`), `After generate aggregate ...` for `repository`, `builder` and `state-machine` (and `command --aggregate`), `After generate port ...` for `adapter`, `After generate value-object ...` for `property`, `After generate command ...` for `job` and `background-job`, `After generate integration-event ...` for `projection` and `integration-handler`, the route, handler or job of the use case for `e2e`, `After generate repository ... --personal ...` for `erasure-handler`, `after generate route-group ...` of the parent for `route-group --group`, `After generate context <name>.` for `module`. When a use case has no route, the refusal of `representation` and `form` names `generate route <context> <UseCase> --method <M> --path <path>` first (or `generate controller` with the same flags), where it named `generate controller` alone and without the flags a route requires; when its route is a function, the refusal says so and names `generate controller <context> <UseCase> --method <M> --path <path>`, or `produces` and `form` declared in its `defineRoute` by hand. The `plan-slices` skill says that a row of a kind held to the glossary adds the term for a word the glossary does not define and that the kinds whose `heldToGlossary` is false (all of them listed, `port`, `adapter`, `repository`, `route`, `representation` among them) take no `--term`, where it asked a `--term` of every name; it gives the order of the commands of one row (aggregate before its repository, builder and state machine; command or query before its route; route before its representation and its form; port before its adapter; integration event before its handler; command before its job), the order inside a row being the row's own business while `plan-waves` names the rows to add to `Depends on`; its example table gains a query row run in that order.
106
+
107
+ **`generate integration-handler` takes the event type as `ddd-ts-kit list` prints it, `identity.member.joined@v1`.** `list` shows the published events of a context with their version, and the generator refused that spelling (`"identity.member.joined@v1" is not an event type of "identity"`). The suffix `@v<n>` now names the version the handler reads, the one `--version <n>` would say (the flag is accepted on this kind); the bare type keeps reading the newest version. A suffix and a `--version` that differ are refused, naming both, and so is a version the upstream does not publish, naming the ones it does (`identity.member.joined is published at v1 only.`).
108
+
109
+ `generate projection` takes the same spelling (`billing.invoice.issued@v1` pins the version the projector applies). A version that no declaration of the upstream matches is always refused, never replaced by another: when the upstream publishes nothing at that version the refusal says so and the fix carries `--version <n>`. The versions named by the refusal are read the way `list` reads them, so a file that declares two versions is no longer reported as publishing one. `--version` of `generate integration-event` and the suffix share one parser: only digits are accepted (`1.0` is refused).
110
+
7
111
  ## 0.100.0
8
112
 
9
113
  **`privacy/declared-field` no longer reports a key of an event mapper that `personalData(subject, value)` seals in the same file.** Sealing a value is how an event declares it: the rule read `data.text('<key>')` on the read side as a column and asked for a `personalFields` declaration an event stream cannot have. A key named like personal data and stored in clear in an event mapper is still reported.
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:bd640596d5ebb512 -->
2
+ <!-- translation-of: README.md sha256:5366c7f12122bcaf -->
3
3
 
4
4
  # ddd-ts-kit
5
5
 
@@ -632,7 +632,7 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
632
632
  | `--representations negotiated`, `--forms on` | `src/platform/http/presentation-of.ts` (`Representations.standard()` avec `negotiated`, et `fieldDeciderOf` sur l'`Access` de l'application), décomposé dans la frontière HTTP et donné au script du contrat ; avec `--forms on`, `src/platform/http/with-forms.ts` ajoute `formRoutes` aux routes et `scripts/openapi.ts` écrit `openapi/forms/<operationId>.json`. Les deux sont la valeur par défaut avec une *stack* HTTP ; `json` et `off` les laissent de côté ([docs/CONFIG.fr.md](../../docs/CONFIG.fr.md)) |
633
633
  | `--audit on` | `src/platform/audit/` : `create-audit.ts` (le journal, le `onDecision` de l'autorisation, les refus des gardes à la frontière remis à la frontière HTTP comme `onGuardRefusal`, le *middleware* avant l'unité de travail, les événements d'intégration abonnés sous le nom de consommateur `audit`), `audited-events.ts` (le registre auquel `generate integration-event` ajoute), `audit.module.ts`, et avec une *stack* HTTP le côté lecture : `audit.permissions.ts` (`audit:trail.read`), puis dans `search-audit-entries/` : `search-audit-entries.query.ts`, son gestionnaire, `search-audit-entries.route.ts` ou `.controller.ts` (`GET /audit/entries` : pages par curseur, filtres `actorId`, `action`, `outcome`, `correlationId`), qui commence par le point d'entrée et prend ce qu'il reçoit et répond dans `audit-entries-parameters.ts`, `audit-entries-filter-of.ts`, `audit-entry-view.ts`, `audit-entry-view-of.ts` et `audit-outcomes.ts`. C'est une capacité de la plateforme, pas un contexte délimité : pas de modèle, une requête protégée sur le port `AuditReader`, bornée par le *tenant* de l'acteur (avec `--tenancy shared-table`, par le *tenant* du travail au moyen de `TenantAuditReader` : le personnel de la plateforme ne lit à travers les *tenants* qu'à l'intérieur de `acrossTenants`). Les refus d'un appelant sans identifiant de connexion ne sont pas enregistrés. Un *job* planifié est audité comme une requête HTTP : origine `schedule`, acteur `system:<context>.<job>`. Avec knex, les deux tables et leurs déclencheurs en ajout seul sont créés par la première migration ; avec drizzle, les tables sont dans `schema.ts` et `npm run db:generate` ajoute les instructions des déclencheurs à la migration qui crée les tables (`npm run db:audit-guard` les affiche pour une migration écrite à la main) ; avec prisma et typeorm, les tables sont des modèles de `prisma/schema/schema.prisma` ou des entités de `schema.ts` (`auditPrismaModels`, `auditEntities` de `@ddd-ts-kit/audit`), écrites par `PrismaAuditTrail` et `TypeOrmAuditTrail`, et `npm run db:generate` (par `ddd-ts-kit prisma-generate` ou `typeorm-generate`) ajoute les instructions des déclencheurs à la migration qui crée les tables, `npm run db:audit-guard` les affichant pour une migration écrite à la main ; les bases de test installent ce garde ; avec `custom` ou sans ORM, le journal est un `InMemoryAuditTrail` derrière un `TODO(platform)`. Les bases de test laissent le schéma d'audit hors de `reset()`. Avec le journal en base et `--storage local` ou `s3`, `audit.module.ts` (ou la composition câblée à la main) enregistre `audit.archive` le premier jour de chaque mois à 04:00 UTC : les entrées de plus de douze mois entiers partent dans le stockage sous `audit-archives/`, vérifiées, relues et ancrées (`ArchiveAuditEntries`) ; avec `s3` il tourne sauf `JOB_AUDIT_ARCHIVE_ENABLED=false`, avec `local` seulement avec `JOB_AUDIT_ARCHIVE_ENABLED=true`, puisque l'archive supprime les entrées de la base et que le disque du serveur peut ne pas durer |
634
634
  | `--event-sourcing on` | enregistré comme `stack.eventSourcing`, `off` sauf demande : `Persistence` gagne `eventSourcing` (`create<Orm>EventSourcing` dans le schéma `event_store`, dont le fichier de schéma déclare les cinq tables ; les stores en mémoire avec `--orm none`), et `src/platform/event-sourcing/` : `create-event-sourcing.ts` (`EventSourcing` : les stores, le `SubjectKeyStore` enveloppé par `auditedSubjectKeys` avec `--audit on`, et le `PersonalDataCipher` par-dessus) et, avec tsyringe, `event-sourcing.module.ts` (lie `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` et `PersonalDataCipher`, pour qu'un adaptateur de *repository* *event-sourced* les nomme dans son constructeur ; la `Platform` câblée à la main les porte comme `platform.eventSourcing`) ; `platform-test.module.ts` lie les stores en mémoire, pour qu'une *spec* de gestionnaire d'un agrégat *event-sourced* n'ait besoin d'aucun *fake*. `generate aggregate --event-sourced` est refusé sans lui, avec le `init --force --event-sourcing on` à lancer. Refusé avec `--orm custom` : l'event store du kit tourne sur PostgreSQL par les quatre paquets d'ORM |
635
- | `--privacy on` | enregistré comme `stack.privacy`, `on` quand il y a un ORM : `src/platform/privacy/`, avec `data-subject-copies.ts` et `data-subject-exports.ts` (les ports, ou les adaptateurs à la main, des contextes qui étendent `PersonalDataErasure` et `PersonalDataExport`, entre marqueurs ; `generate repository --personal` y liste l'effacement et l'export d'un contexte), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, tenants? })` : un contexte d'exécution d'origine `cli` avec l'opérateur pour acteur, la clé de la personne quand le projet a un event store, puis `eraseDataSubject` du kernel sur les copies, `inEachTenant` avec `--tenancy shared-table`, puis `privacy.data-subject.erased` publié par l'outbox, une fois par *tenant*) et `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })` : `exportDataSubject` du kernel sur les exports, chacun enveloppé par `auditedPersonalDataExport` avec `--audit on`, `recordsInEachTenant` avec `--tenancy shared-table`, un `PersonalDataExportDocument` daté), et les deux scripts ci-dessous. `docs/privacy/register.md`, le registre des données personnelles que `ddd-ts-kit docs` tient (voir `docs` plus bas). Un projet sans donnée personnelle prend `--privacy off` et ne paie rien. Aucune commande HTTP n'efface encore : les deux scripts sont les points d'entrée |
635
+ | `--privacy on` | enregistré comme `stack.privacy`, `on` quand il y a un ORM : `src/platform/privacy/`, avec `data-subject-copies.ts` et `data-subject-exports.ts` (les ports, ou les adaptateurs à la main, des contextes qui étendent `PersonalDataErasure` et `PersonalDataExport`, entre marqueurs ; `generate repository --personal` y liste l'effacement et l'export d'un contexte), `personal-events.ts` (les événements qui portent des données personnelles, écrits par `docs` depuis leur option `personal`), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, rerun?, tenants? })` : un contexte d'exécution d'origine `cli` avec l'opérateur pour acteur, la clé de la personne quand le projet a un event store, puis `eraseDataSubject` du kernel sur les copies, chacune enveloppée par `auditedPersonalDataErasure` avec `--audit on`, `inEachTenant` avec `--tenancy shared-table`, puis une fois les enregistrements de l'outbox et les *jobs* de la personne, puis `privacy.data-subject.erased` publié par l'outbox, une fois par *tenant*, sauf si rien n'a été atteint) et `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })` : `exportDataSubject` du kernel sur les exports, chacun enveloppé par `auditedPersonalDataExport` avec `--audit on`, `recordsInEachTenant` avec `--tenancy shared-table`, un `PersonalDataExportDocument` daté), et les deux scripts ci-dessous. `docs/privacy/register.md`, le registre des données personnelles que `ddd-ts-kit docs` tient (voir `docs` plus bas). Un projet sans donnée personnelle prend `--privacy off` et ne paie rien. Aucune commande HTTP n'efface encore : les deux scripts sont les points d'entrée |
636
636
  | `--tenancy shared-table` | enregistré comme `stack.tenancy` ; les quatre ORM. Chaque `generate repository` est cloisonné par *tenant* (comme `--tenant-scoped`), au moyen de `tenantTable` et `ownTenantTable` (Knex), de `tenantCondition` et `ownTenantCondition` (Drizzle), de `tenantWhere` et `ownTenantWhere` (Prisma, TypeORM) ; l'outbox garde le *tenant* de chaque événement (`createOutboxTables(knex, { tenant: true })` et le `tenant: true` de `KnexOutboxStore`, `tenantOutboxTable`, le champ `tenantId` du modèle Prisma et le `tenant: true` de `PrismaOutboxStore`, `outboxEntity({ tenant: true })`), si bien que les consommateurs s'exécutent dans ce *tenant* ; `tenancy/scoped-statement` juge les adaptateurs. La sécurité au niveau des lignes, un schéma par *tenant* et une base par *tenant* sont refusés, avec ce qu'il faut câbler à la main ([Multitenance](../../docs/concepts/multitenancy.fr.md)) |
637
637
  | `--queue database\|redis\|memory` | enregistré comme `stack.queue`. `database` (par défaut sur Knex, Drizzle, Prisma et TypeORM, quel que soit le conteneur) : les tables du *package* de l'ORM (`createJobTable` et `createProcessTable`, `jobsTable` et `processesTable`, les modèles `BackgroundJob` et `ProcessInstance`, `jobEntity` et `processEntity`) dans le schéma `messaging`, `Persistence` gagne `jobs` et `processes`, et la plateforme relie `JobStore` et `ProcessStore` à eux (le module de la plateforme sur tsyringe, `jobs/create-background-work.ts` là où la plateforme est câblée à la main ou sous Nest), si bien qu'un *job* mis en file par une commande est écrit dans sa transaction ; `redis` (avec `--cache redis`) : `RedisJobStore` sur la connexion du cache, les processus dans la base de données ; `memory` (par défaut avec une persistance sur mesure ou sans persistance) : rien n'est écrit, les deux restent dans le processus. Refusé : `database` avec un autre ORM, `redis` sans le cache |
638
638
  | `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices` : le cache lié au `Cache` du kernel, le limiteur à `RateLimiter`, le verrou à `Lock`, qui réserve un *job* planifié à une seule instance, le signal du relais comme `wakeOn` du relais de l'outbox avec `relayWakeUpMiddleware` sur le bus de commandes), `http/too-many-requests-for.ts` (une fenêtre glissante par adresse d'appelant, 429 `application/problem+json` avec `retry-after` ; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS` ; l'adresse est celle du socket sauf si `TRUST_PROXY` nomme les proxys placés devant, par sauts ou par adresse, par sauts seulement sur Hono), `GET /health/ready` sur le serveur HTTP, `REDIS_URL` validée, un service compose `cache` qui exécute Dragonfly avec un contrôle de santé. Sans serveur (outils, tests sans `REDIS_URL`), les mêmes ports restent dans la mémoire du processus |
@@ -644,7 +644,7 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
644
644
  | `src/platform/database/` | `persistence.ts` (`interface Persistence` : unité de travail, magasins de l'outbox et des événements traités du *package* de l'ORM, la poignée de stockage), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, la connexion (`connect-to-database.ts`, `create-client.ts` ou `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, le schéma de ce que le kit stocke pour l'application), `open-test-database.ts` (PostgreSQL dans le processus, ou le serveur nommé par une URL ; avec Vitest chaque *spec* ouvre une copie du cluster que `test/support/test-database-template.ts`, la mise en place globale de l'exécution, initialise une fois, et y crée ses tables ; avec drizzle depuis `table-statements.ts`, le SQL des tables de `schema.ts`, puisque drizzle-kit écrit des migrations, pas des tables, ses index uniques compris), `persistence.contract.spec.ts` (les stores de l'outbox, des événements traités, des *jobs* et des processus tels que la plateforme les branche, tenus aux contrats de `@ddd-ts-kit/testing` avec ce que la pile active : le *tenant* sous `--tenancy`, l'unité de travail). La classe de stockage qu'un adaptateur de *repository* nomme dans sa liste de dépendances : `database.ts` avec drizzle et prisma (`abstract class Database extends` le type de contexte du *package* de l'ORM), `KnexContext` de `@ddd-ts-kit/knex`, `TypeOrmContext` de `@ddd-ts-kit/typeorm` |
645
645
  | outillage des migrations | `drizzle.config.ts`, `knexfile.js` et `migrations/00000000000000_initial.js`, `prisma/schema/schema.prisma` (le client, la datasource et les tables de la plateforme ; `generate repository` ajoute le fichier de chaque contexte, `prisma/schema/<context>.prisma`) et `prisma.config.ts`, ou `data-source.ts`. Un projet qui garde le seul `prisma/schema.prisma` des versions antérieures à 0.95 le garde avec son `prisma.config.ts` et son `db:client`, même sous `--force` : `init` n'écrit rien sous `prisma/schema/`, ses notes donnent les étapes du déplacement en nommant les contextes du projet, et `generate repository` refuse jusqu'au déplacement |
646
646
  | `scripts/openapi.ts`, `scripts/events.ts` | écrivent `openapi/openapi.yaml` (un fichier par document de `openapi.documents`), `docs/integration/asyncapi.yaml` et `docs/integration/event-catalog.md`, en JSON sous `openapi.format: json` ; `--check` échoue sur une différence |
647
- | `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | avec `--privacy on`, les deux demandes d'une personne concernée, traitées en ligne de commande sur les sources avec les variables de `.env` (`npm run privacy:erase -- <subject-id> [--operator <qui-demande>]`, `npm run privacy:export -- <subject-id> > export.json`) : l'effacement détruit d'abord la clé de la personne quand le projet a un event store (`--event-sourcing on` : ses événements stockés se lisent effacés ; audité avec `--audit on`), puis efface chaque copie listée dans `src/platform/privacy/data-subject-copies.ts` ; `privacy:purge` lance à la main ce que le *job* `privacy.purge-expired` lance chaque nuit à 03:00 UTC, la purge de ce qui a dépassé sa durée de conservation (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` coupe le *job*) ; l'export rassemble chaque enregistrement listé dans `data-subject-exports.ts` en un document JSON daté (`format`, `subject`, `exportedAt`, `records`), l'export de chaque contexte audité avec `--audit on`, jamais les valeurs (chaque exécution laisse son entrée, un essai compris : essayez-le sur une personne de test). Avec `--tenancy shared-table`, `TENANTS` nomme les tenants, séparés par des virgules : une écriture de données de tenant n'est jamais élargie. Ni l'un ni l'autre n'atteint les sauvegardes, les journaux ou une copie qu'aucun contexte n'a déclarée |
647
+ | `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | avec `--privacy on`, les deux demandes d'une personne concernée, traitées en ligne de commande sur les sources avec les variables de `.env` (`npm run privacy:erase -- <subject-id> [--operator <qui-demande>] [--rerun]`, `npm run privacy:export -- <subject-id> > export.json`) : l'effacement détruit d'abord la clé de la personne quand le projet a un event store (`--event-sourcing on` : ses événements stockés se lisent effacés ; audité avec `--audit on`), puis efface chaque copie listée dans `src/platform/privacy/data-subject-copies.ts`, chacune laissant son entrée avec `--audit on`, et ce que l'outbox et le stockage des *jobs* gardent de la personne ; un id qui n'a rien atteint est refusé, code de sortie 1, et annoncé à personne, sauf si `--rerun` dit que cette personne a déjà été effacée ; `privacy:purge` lance à la main ce que le *job* `privacy.purge-expired` lance chaque nuit à 03:00 UTC, la purge de ce qui a dépassé sa durée de conservation (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` coupe le *job*) ; l'export rassemble chaque enregistrement listé dans `data-subject-exports.ts` en un document JSON daté (`format`, `subject`, `exportedAt`, `records`), l'export de chaque contexte audité avec `--audit on`, jamais les valeurs (chaque exécution laisse son entrée, un essai compris : essayez-le sur une personne de test). Avec `--tenancy shared-table`, `TENANTS` nomme les tenants, séparés par des virgules : une écriture de données de tenant n'est jamais élargie. Ni l'un ni l'autre n'atteint les sauvegardes, les journaux, une copie qu'aucun contexte n'a déclarée, un message déjà livré ou un *job* qui ne nomme aucun `subject` |
648
648
  | `docker-compose.yml`, `.env.example`, `Dockerfile`, `.dockerignore` | la base de données avec un contrôle de santé et un volume nommé, `jaegertracing/jaeger:2.22.0` derrière le profil `observability`, chaque port publié sur 127.0.0.1 seulement (une adresse plus large s'écrit dans l'entrée à dessein, le README du projet dit comment), les ports depuis `.env` ; une image multi-étapes, sans root, avec les seules dépendances de production |
649
649
  | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (l'application entière sur un port libre, sur une base de données dans le processus sauf si `DATABASE_URL` est définie, aucun *job* lancé par le temps ; `settled()` se résout quand l'outbox a relayé ce que les requêtes HTTP ont enregistré ; `publish(events)` remet des événements d'intégration de l'amont à ses gestionnaires, comme le ferait le relais de cet amont), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)` : une trace sans les appels qu'un adaptateur fait sur lui-même, la forme que vérifie `expectSpanTree`) |
650
650
  | `docs/context-map.md`, `docs/integration/README.md` | voir `docs` |
@@ -833,14 +833,14 @@ Next, in this order: the language of the context first, then the business decisi
833
833
  | `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>]` | un téléversement : un contrôleur qui déclare le fichier qu'il reçoit (sa taille et ses types de média dans le contrat, vérifiés au fil du flux), la commande qui le porte comme un `FileUpload`, mis en attente par le bus de commandes avant la transaction, le gestionnaire qui l'enregistre et le promeut avec la validation (commit), et leurs *specs*. Refusé sans `stack.storage` ou sans *stack* HTTP, avec le `init --force --storage local` à lancer |
834
834
  | `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts` : une classe vide qui porte `@RouteGroup`, derrière `Authenticated` sauf si `--public` ou `--role` dit autre chose (`HasRole(Role.Admin)`, le rôle lu dans le vocabulaire de la plateforme, `<platformDir>/auth/authorization/role.ts`, qui le reçoit s'il ne le contient pas) ; avec `--group`, il affine ce groupe et en hérite |
835
835
  | `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts` : une classe de garde déclarée à remplir, et sa *spec* |
836
- | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | ajoute `produces` au `@Controller` du cas d'usage, et `consumes: ['application/xml']` à celui qui reçoit un corps quand XML est demandé ; dit quand CSV a besoin d'une page ou d'une liste en flux, et quand `stack.representations` n'est pas `negotiated` |
836
+ | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | après `generate route` du cas d'usage (un contrôleur sous `"stack.routes": "controllers"` ou `"nest"`) ou `generate controller` : ajoute `produces` au `@Controller` du cas d'usage, et `consumes: ['application/xml']` à celui qui reçoit un corps quand XML est demandé ; dit quand CSV a besoin d'une page ou d'une liste en flux, et quand `stack.representations` n'est pas `negotiated` |
837
837
  | `form` | `<context> <UseCase>` | ajoute `const form = defineForm<Infer<typeof body>>({ ... })` avant le `@Controller` d'un cas d'usage qui reçoit un corps, et `form` à ses options : les indications de son formulaire à `GET /forms/<operationId>` |
838
838
  | `schema` | `<context\|shared-kernel> <Name>` | `presentation/http/shared/<name>.schema.ts` du contexte, ou `presentation/<name>.schema.ts` du noyau partagé : une forme du contrat déclarée une fois (un schéma zod avec `.meta({ id })`, une classe class-validator, ou un schéma enveloppé par `sharedSchema`), à remplir ; les routes l'utilisent en entier, imbriquée ou en partie |
839
839
  | `integration-event` | `<context> <Aggregate> <Fact> [--version n]` | la déclaration `defineIntegrationEvent` dans le langage publié (sa charge utile dans `<event>.v<n>.payload.ts` avec class-validator ou un schéma à vous), l'export de l'index, le *publisher* `application/integration/publishers/<event>.publisher.ts`, une *spec*, l'enregistrement, une ligne de `platform/audit/audited-events.ts` |
840
- | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, une classe `<Name>IntegrationHandler` qui dépend de `CommandBus`, sa *spec*, son abonnement idempotent sous le nom de consommateur `<context>.<name>` ; refusé sauf si l'amont est déclaré |
840
+ | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>[@v<n>]` | `application/integration/handlers/<name>.integration-handler.ts`, une classe `<Name>IntegrationHandler` qui dépend de `CommandBus`, sa *spec*, son abonnement idempotent sous le nom de consommateur `<context>.<name>` ; le type est pris comme `list` l'affiche, avec ou sans `@v<n>` (la version la plus récente sans, `--version <n>` disant la même chose que le suffixe) ; refusé sauf si l'amont est déclaré et publie cette version (une version introuvable est refusée, jamais remplacée par une autre) |
841
841
  | `erasure-handler` | `<context>` | `application/integration/handlers/data-subject-erased.integration-handler.ts`, une classe `DataSubjectErasedIntegrationHandler` qui efface ce que le contexte garde d'une personne par son `<Context>PersonalDataErasure` quand la plateforme annonce `privacy.data-subject.erased` (`dataSubjectErasedV1` du kernel), sa *spec* sur le *fake*, son abonnement idempotent sous le nom de consommateur `<context>.data-subject-erased` (dans une transaction derrière un *broker*) ; pour un contexte qui tourne comme un service à part ou copie des données personnelles depuis des événements. Refusé tant que le contexte n'a pas son effacement (`generate repository --personal`), et refusé sur un contexte en *event sourcing*, dont les valeurs personnelles s'effacent en détruisant la clé du sujet (`eraseDataSubject`) |
842
842
  | `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|after-commit]` | réaction à un événement du domaine du contexte, *spec*, abonnement ; avant la validation (commit) de l'unité de travail par défaut, après elle avec `--phase after-commit` (un effet qu'aucune transaction ne couvre, au plus une fois), et la *spec* exécute la réaction dans cette phase |
843
- | `projection` (`projector`) | `<context> <Name> <event-type>` | un projecteur dans `application/projections/<name>.projection.ts`, déclaré avec `@Projection('<context>.<name>')` et une méthode `@On(definition)` pour l'événement d'intégration, que publie le contexte lui-même ou un amont déclaré, et sa *spec*. Dans le style explicite sur tsyringe, le fichier de module du contexte l'inclut par `builder.include(<Name>Projection)` ; sur une plateforme câblée à la main, la classe est simple et le module la souscrit sous son nom de consommateur. Il tient un seul modèle de lecture : son port est reçu par le constructeur |
843
+ | `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>]` | un projecteur dans `application/projections/<name>.projection.ts`, déclaré avec `@Projection('<context>.<name>')` et une méthode `@On(definition)` pour l'événement d'intégration, que publie le contexte lui-même ou un amont déclaré, et sa *spec* ; le type est pris comme `list` l'affiche, `@v<n>` fixant la version (la plus récente sans). Dans le style explicite sur tsyringe, le fichier de module du contexte l'inclut par `builder.include(<Name>Projection)` ; sur une plateforme câblée à la main, la classe est simple et le module la souscrit sous son nom de consommateur. Il tient un seul modèle de lecture : son port est reçu par le constructeur |
844
844
  | `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, une classe `<Name>Job implements ScheduledJob` qui envoie la commande, en tant que `systemActor('<context>.<name>')` quand elle est protégée, avec `execution.scheduledAt` quand la commande le prend ; `test/unit/<name>.job.spec.ts`, qui exécute le *job* (par son nom sur tsyringe, `application.jobs.runNow` ; `job.run(occurrence)` en câblage manuel) et vérifie la commande qu'il a envoyée ; son enregistrement ; son interrupteur dans `platform/jobs/job-settings.ts` ; l'autorisation de son acteur système (ci-dessous) |
845
845
  | `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, une classe `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` nommée par son `jobName` statique `<context>.<name>`, qui envoie la commande en tant que `execution.actor` quand elle est protégée, suivi d'un champ de `<Name>Payload` par autre paramètre du constructeur de la commande (chaînes, nombres, booléens, littéraux et listes de ceux-ci tels qu'écrits, une `Date` sous forme de son texte ISO ; tout le reste est refusé), et son `payload` statique, le schéma de cette charge utile dans la bibliothèque de validation de la pile (un `z.object` sous zod, une classe de champs décorés sans valeur initiale sous class-validator, un `Type.Object` sous TypeBox, un refus par champ écrit à la main sous Standard Schema et, avec `--validation none`, dans le `BackgroundJobPayloadSchema` du noyau ; un type qu'il ne sait pas vérifier est typé `unknown` avec un `TODO(domain)`), avec lequel le *worker* lit la charge utile stockée avant chaque exécution ; `test/unit/<name>.background-job.spec.ts`, qui le met en file avec une charge utile de chaque champ en tant qu'utilisateur et exécute ce qui est dû, puis le met en file tel qu'une version antérieure le déclarait (`earlierVersionOf` de `@ddd-ts-kit/testing`) et montre le *job* mort avec `INVALID_JOB_PAYLOAD` (à travers l'application de test sur tsyringe, à travers une file et un *worker* en mémoire sur les bus de test sinon) ; son enregistrement (`@Background()`, `builder.backgroundJob(..)` dans le fichier de module sur tsyringe, `platform.backgroundJobs.register(..)` dans le fichier de module d'une plateforme câblée à la main) |
846
846
  | `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (son état, `processName`, `timeoutJob`, `isState`, une première étape qui arme une échéance, une étape qui y met fin à temps, l'étape de l'échéance), `application/background/<name>-timeout.background-job.ts`, qui livre ses expirations au moyen de `ProcessRunner`, et les *specs* des deux (`givenProcess`, la file de l'application de test sur tsyringe, une file et un *runner* en mémoire sur les bus de test sinon) |
@@ -980,7 +980,11 @@ Next, in this order: the language of the context first, then the business decisi
980
980
  aussi ; un mot technique passe quand un terme du glossaire le tient
981
981
  (`--term "Scoring model=<meaning>"` laisse passer `ScoringModel`), parce que le langage du
982
982
  métier l'emporte. `--allow-name` passe outre les trois vérifications ; `check` signalera tout de même ce
983
- que le glossaire ne définit pas.
983
+ que le glossaire ne définit pas. Seuls les genres dont l'usage montre `--term` le prennent
984
+ (`heldToGlossary` dans `generate --help --json`, une ligne de `generate <kind> --help`) ; les
985
+ autres (`port`, `adapter`, `repository`, `route`, `representation`...) nomment ce qu'une
986
+ commande antérieure a nommé ou le nom du concept qu'ils servent, et refusent `--term`, en
987
+ nommant les genres qui le prennent.
984
988
  - Le code généré compile tel quel et passe `check`, le preset ESLint, dependency-cruiser et knip
985
989
  aux sévérités par défaut : un export par fichier, des fichiers bien en dessous de 350 lignes,
986
990
  des membres `private`, la disposition des lignes vides. Chaque endroit qui demande une
@@ -1008,7 +1012,9 @@ Next, in this order: the language of the context first, then the business decisi
1008
1012
  sur une ligne, `file:line gist` (le `text` entier d'une étape).
1009
1013
  - Un genre qui a besoin d'autre chose pour compiler soit le crée (un *repository* ou un événement
1010
1014
  du domaine manquant), soit s'arrête avec la commande qui le crée (un agrégat, un cas d'usage ou
1011
- une route manquant).
1015
+ une route manquant). Son `summary` nomme cette commande, `After generate ...`
1016
+ (`After generate route <context> <UseCase>` pour une `representation`) : les commandes d'une
1017
+ ligne des tranches s'exécutent dans cet ordre.
1012
1018
  - L'enregistrement se fait entre des commentaires marqueurs (`// ddd-ts-kit:<region>` ...
1013
1019
  `// /ddd-ts-kit:<region>`, des commentaires HTML en Markdown). Retirez un marqueur, et le
1014
1020
  générateur affiche ce qu'il faut ajouter à la main.
@@ -1017,7 +1023,8 @@ Next, in this order: the language of the context first, then the business decisi
1017
1023
  - `--local-only` refuse, en nommant les fichiers et sans rien écrire, quand le passage écrirait
1018
1024
  hors de `<contextsDir>/<context>/` et de `test/e2e/*.e2e.spec.ts`. `generate --help --json`
1019
1025
  affiche chaque genre avec son `usage`, ses `aliases`, son `summary` et son `writesShared`, plus
1020
- `shared` et `sharedWhen` : ce qu'il écrit hors de son contexte, et quand ; `generate <kind>
1026
+ `shared` et `sharedWhen` : ce qu'il écrit hors de son contexte, et quand ; `writesInModules`,
1027
+ vrai quand il prend `--module` ; et `heldToGlossary`, vrai quand il prend `--term`. `generate <kind>
1021
1028
  --help --json` affiche ce seul genre, en un objet, et `generate <kind> --help` la même chose en
1022
1029
  texte. Les deux servent un
1023
1030
  build réparti entre des *workers* (voir `worker-scope`).
@@ -2484,7 +2491,7 @@ règle.
2484
2491
  | `tracing/platform-only` | un import de `@ddd-ts-kit/tracing` ou d'un *package* `@opentelemetry/*` hors du répertoire de la plateforme, de `main.ts` et de `apps/`, tests compris |
2485
2492
  | `nest/no-parallel-pipeline` | dans `presentation/`, `infrastructure/` ou le fichier de module d'un contexte, tests à part : un import d'un contrôleur que Nest sert (ses décorateurs de route et de paramètres, sauf si le fichier importe `KitRoute` ou `KitRoutes` de `@ddd-ts-kit/http/nest`), de la requête ou de la réponse brutes, d'un *guard*, d'un *pipe*, d'un filtre d'exceptions ou d'une `HttpException`, d'un intercepteur ou du `Logger` de `@nestjs/common`, un import sans nom de celui-ci, ou un import d'un *package* de Nest dont le kit fait le travail (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` et les autres de la section 3 d'ARCHITECTURE.md) ; le message dit ce que le kit fait à sa place ; sous la racine des sources hors des contextes, tests à part : un fichier qui importe `Controller` de `@nestjs/common`, ni `KitRoute` ni `KitRoutes`, et nomme `CommandBus` ou `QueryBus` ou importe un fichier d'un contexte |
2486
2493
  | `nest/controllers-current` | avec `"stack.routes": "nest"` : un `<context>.controllers.ts` qui diffère de ce que donnent les contrôleurs Nest du contexte et les signatures de leurs méthodes, ou absent ; une partie de la requête prise entière par aucune classe DTO et que `request` de `@KitRoute` ne donne pas ; une méthode de route qui ne répond ni une classe DTO, ni `Accepted`, ni `void`, et ne déclare pas de `response` dans `@KitRoute` |
2487
- | `tenancy/scoped-statement` | avec `stack.tenancy` autre que `none`, dans `infrastructure/` d'un contexte, tests et contexte dont `tenancy` vaut `control-plane` mis à part : sur Knex, l'exécuteur utilisé autrement que comme argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) et tout `.raw(` ; sur Drizzle, instruction par instruction, une lecture, une mise à jour ou une suppression sur l'exécuteur dont le where n'a ni `tenantCondition(` ni `ownTenantCondition(` (en ligne ou dans la variable locale qu'il reçoit), une insertion dont la ligne n'a pas de `tenantScopeOf(`, une requête relationnelle (`executor().query`), un `execute(` brut, ou l'exécuteur gardé dans une variable ; sur Prisma, instruction par instruction sur le client, une lecture (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) dont le where ne décompose pas `tenantWhere(`, une mise à jour ou une suppression dont le where ne décompose pas `ownTenantWhere(`, une création dont les données ne décomposent pas `tenantScopeOf(` (en ligne ou dans une variable locale que les arguments nomment), `findUnique(`, `upsert(`, une requête brute (`$queryRaw`, `$executeRaw`), ou le client gardé dans une variable ; sur TypeORM, la même chose sur le *manager* (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, la ligne confiée à `insertIgnoringConflict(`, un *query builder* dont le where ne porte aucune condition, `save(`, `upsert(`, `query(`) ; sur les quatre, un magasin de modèle de lecture construit sans son option `tenant`. Un where construit par une autre fonction n'est pas suivi |
2494
+ | `tenancy/scoped-statement` | avec `stack.tenancy` autre que `none`, dans `infrastructure/` d'un contexte, tests et contexte dont `tenancy` vaut `control-plane` mis à part : sur Knex, l'exécuteur utilisé autrement que comme argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) et tout `.raw(` ; sur Drizzle, instruction par instruction, une lecture, une mise à jour ou une suppression sur l'exécuteur dont le where n'a ni `tenantCondition(` ni `ownTenantCondition(` (en ligne ou dans la variable locale qu'il reçoit), une insertion dont la ligne n'a pas de `tenantScopeOf(`, une requête relationnelle (`executor().query`), un `execute(` brut, ou l'exécuteur gardé dans une variable ; sur Prisma, instruction par instruction sur le client, une lecture (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) dont le where ne décompose pas `tenantWhere(`, une mise à jour ou une suppression dont le where ne décompose pas `ownTenantWhere(`, une création dont les données ne décomposent pas `tenantScopeOf(` (en ligne ou dans une variable locale que les arguments nomment), `findUnique(`, `upsert(`, une requête brute (`$queryRaw`, `$executeRaw`), ou le client gardé dans une variable ; sur TypeORM, la même chose sur le *manager* (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, la ligne confiée à `insertIgnoringConflict(`, un *query builder* dont le where ne porte aucune condition, `save(`, `upsert(`, `query(`) ; sur les quatre, un magasin de modèle de lecture construit sans son option `tenant`, et une condition du *tenant* qui ne reste pas en `and` avec son instruction : sur Knex `.orWhere*` ou `.or` au sommet d'une instruction de `tenantTable`, `ownTenantTable` ou `whereTenant`, `clearWhere()` ou `clear('where')` sur elle, sur Drizzle la condition sous `or`, `not` ou un gabarit `sql`, sur Prisma l'étalement sous `OR`, `NOT` ou une relation, sur TypeORM de même, un tableau where dont une entrée ne l'étale pas, un `orWhere` au sommet d'un *query builder*, un `where` après celui qui porte la condition. Un where construit par une autre fonction n'est pas suivi |
2488
2495
  | `standard/no-parallel-interface` | une classe, une interface ou un alias de type déclaré comme `ILogger`, `AppLogger`, `LoggerService`, `LoggerInterface`, `IMetrics`, `MetricsService`, `ICache`, `CacheService`, `UserContext`, `CurrentUser`, `AuthContext`, `RequestContext` (hors de `presentation/` et de la plateforme), `UserSession`, `AuthSession`, `SessionData`, `PaginatedResult`, `PageResult`, `PaginatedResponse`, `Paginated`, `PaginationParams`, `PageParams`, `AuditLog`, `AuditLogEntry`, `AuditRecord`, `IJobScheduler`, `JobSchedulerService`, `CronScheduler`, `TaskScheduler`, `IScheduledJob`, `CronJob`, `ScheduledTask`, `BackgroundJob`, `IErrorReporter`, `ErrorReporterService`, `ErrorTracker`, `ExceptionReporter`, `CrashReporter`, `CacheInvalidator`, `CacheInvalidationService`, `CachePurgeService`, `CdnPurger`, `I` suivi d'un nom standard (`IClock`, `IIdGenerator`, `IUnitOfWork`, `ISession`, ...) ou un nom de `standardInterfaces` ; une classe qui implémente ou étend l'interface standard est un adaptateur et n'est pas signalée |
2489
2496
  | `events/outbox-required` | `stack.events` autre que `outbox` avec un ORM et sans dérogation `stack.events` ; dans `domain/` et `application/`, l'import d'un client de *broker* ou d'une implémentation de bus ou de relais ; un *publisher* qui dépend de plus que `IntegrationEventPublisher` ; un module de la plateforme qui distribue un *publisher* et ne nomme jamais `OutboxPublisher` |
2490
2497
  | `events/consumer-idempotent` | une classe de gestionnaire d'événement d'intégration (`application/integration/handlers/*.integration-handler.ts`) qui ne porte pas `@IntegrationEventHandler` et n'est pas non plus enregistrée dans son fichier de module sous un nom de consommateur ; un `@IntegrationEventHandler` dont le `consumer` n'est pas une chaîne littérale non vide ; un `on(` ou un `consume(` libre sans `processed` ; un nom de consommateur utilisé deux fois, dans les déclarations comme dans les enregistrements |
package/README.md CHANGED
@@ -603,7 +603,7 @@ config, `docsUi`, `ci` and `logger` included.
603
603
  | `--representations negotiated`, `--forms on` | `src/platform/http/presentation-of.ts` (`Representations.standard()` with `negotiated`, and `fieldDeciderOf` over the `Access` of the application), spread into the HTTP boundary and given to the contract script; with `--forms on`, `src/platform/http/with-forms.ts` adds `formRoutes` to the routes and `scripts/openapi.ts` writes `openapi/forms/<operationId>.json`. Both are the default with an HTTP stack; `json` and `off` leave them out ([docs/CONFIG.md](../../docs/CONFIG.md)) |
604
604
  | `--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`), then in `search-audit-entries/`: `search-audit-entries.query.ts`, its handler, `search-audit-entries.route.ts` or `.controller.ts` (`GET /audit/entries`: cursor pages, filters `actorId`, `action`, `outcome`, `correlationId`), which starts with the endpoint and takes what it receives and answers from `audit-entries-parameters.ts`, `audit-entries-filter-of.ts`, `audit-entry-view.ts`, `audit-entry-view-of.ts` and `audit-outcomes.ts`. 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:generate` adds the trigger statements to the migration that creates the tables (`npm run db:audit-guard` prints them for a migration by hand); with prisma and typeorm the tables are models of `prisma/schema/schema.prisma` or entities of `schema.ts` (`auditPrismaModels`, `auditEntities` of `@ddd-ts-kit/audit`), written by `PrismaAuditTrail` and `TypeOrmAuditTrail`, and `npm run db:generate` (through `ddd-ts-kit prisma-generate` or `typeorm-generate`) adds the trigger statements to the migration that creates the tables, `npm run db:audit-guard` printing them for a migration by hand; the test databases install that guard; with `custom` or no ORM the trail is an `InMemoryAuditTrail` behind a `TODO(platform)`. The test databases leave the audit schema out of `reset()`. With the trail in a database and `--storage local` or `s3`, `audit.module.ts` (or the hand-wired composition) registers `audit.archive` on the first day of every month at 04:00 UTC: the entries older than twelve whole months move to the storage under `audit-archives/`, verified, read back and anchored (`ArchiveAuditEntries`); with `s3` it runs unless `JOB_AUDIT_ARCHIVE_ENABLED=false`, with `local` only with `JOB_AUDIT_ARCHIVE_ENABLED=true`, since the archive removes the entries from the database and the disk of the server may not last |
605
605
  | `--event-sourcing on` | recorded as `stack.eventSourcing`, `off` unless asked: `Persistence` gains `eventSourcing` (`create<Orm>EventSourcing` in the `event_store` schema, whose five tables the schema file declares; the in-memory stores with `--orm none`), and `src/platform/event-sourcing/`: `create-event-sourcing.ts` (`EventSourcing`: the stores, the `SubjectKeyStore` wrapped by `auditedSubjectKeys` with `--audit on`, and the `PersonalDataCipher` over it) and, on tsyringe, `event-sourcing.module.ts` (binds `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` and `PersonalDataCipher`, so an event-sourced repository adapter names them in its constructor; the hand-wired `Platform` carries them as `platform.eventSourcing`); `platform-test.module.ts` binds the in-memory stores, so a handler spec of an event-sourced aggregate needs no fake. `generate aggregate --event-sourced` is refused without it, with the `init --force --event-sourcing on` to run. Refused with `--orm custom`: the event store of the kit runs on PostgreSQL through the four ORM packages |
606
- | `--privacy on` | recorded as `stack.privacy`, `on` when there is an ORM: `src/platform/privacy/`, with `data-subject-copies.ts` and `data-subject-exports.ts` (the ports, or the adapters by hand, of the contexts that extend `PersonalDataErasure` and `PersonalDataExport`, between markers; `generate repository --personal` lists the erasure and the export of a context there), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, tenants? })`: an execution context of origin `cli` with the operator as actor, the key of the subject when the project has an event store, then `eraseDataSubject` of the kernel over the copies, `inEachTenant` with `--tenancy shared-table`, then `privacy.data-subject.erased` published through the outbox, once per tenant) and `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })`: `exportDataSubject` of the kernel over the exports, each wrapped by `auditedPersonalDataExport` with `--audit on`, `recordsInEachTenant` with `--tenancy shared-table`, one dated `PersonalDataExportDocument`), and the two scripts below. `docs/privacy/register.md`, the register of personal data `ddd-ts-kit docs` keeps (see `docs` below). A project without personal data takes `--privacy off` and pays nothing. No HTTP command erases yet: the two scripts are the entry points |
606
+ | `--privacy on` | recorded as `stack.privacy`, `on` when there is an ORM: `src/platform/privacy/`, with `data-subject-copies.ts` and `data-subject-exports.ts` (the ports, or the adapters by hand, of the contexts that extend `PersonalDataErasure` and `PersonalDataExport`, between markers; `generate repository --personal` lists the erasure and the export of a context there), `personal-events.ts` (the events that carry personal data, written by `docs` from their `personal` option), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, rerun?, tenants? })`: an execution context of origin `cli` with the operator as actor, the key of the subject when the project has an event store, then `eraseDataSubject` of the kernel over the copies, each wrapped by `auditedPersonalDataErasure` with `--audit on`, `inEachTenant` with `--tenancy shared-table`, then once the records of the outbox and the jobs of the person, then `privacy.data-subject.erased` published through the outbox, once per tenant, unless nothing was reached) and `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })`: `exportDataSubject` of the kernel over the exports, each wrapped by `auditedPersonalDataExport` with `--audit on`, `recordsInEachTenant` with `--tenancy shared-table`, one dated `PersonalDataExportDocument`), and the two scripts below. `docs/privacy/register.md`, the register of personal data `ddd-ts-kit docs` keeps (see `docs` below). A project without personal data takes `--privacy off` and pays nothing. No HTTP command erases yet: the two scripts are the entry points |
607
607
  | `--tenancy shared-table` | recorded as `stack.tenancy`; the four ORMs. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` (Knex), `tenantCondition` and `ownTenantCondition` (Drizzle), `tenantWhere` and `ownTenantWhere` (Prisma, TypeORM); the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, `tenantOutboxTable`, the `tenantId` field of the Prisma model and `PrismaOutboxStore`'s `tenant: true`, `outboxEntity({ tenant: true })`), 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)) |
608
608
  | `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex, Drizzle, Prisma and TypeORM, whatever the container): the tables of the ORM package (`createJobTable` and `createProcessTable`, `jobsTable` and `processesTable`, the `BackgroundJob` and `ProcessInstance` models, `jobEntity` and `processEntity`) in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform binds `JobStore` and `ProcessStore` to them (the platform module on tsyringe, `jobs/create-background-work.ts` where the platform is wired by hand or under Nest), 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 with a custom persistence or none): nothing is written, both stay in the process. Refused: `database` with another ORM, `redis` without the cache |
609
609
  | `--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/too-many-requests-for.ts` (one sliding window per caller address, 429 `application/problem+json` with `retry-after`; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`; the address is the socket's unless `TRUST_PROXY` names the proxies in front, by hops or by address, by hops only on Hono), `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 |
@@ -615,7 +615,7 @@ config, `docsUi`, `ci` and `logger` included.
615
615
  | `src/platform/database/` | `persistence.ts` (`interface Persistence`: unit of work, outbox and processed-event stores of the ORM package, the storage handle), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, the connection (`connect-to-database.ts`, `create-client.ts` or `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, the schema of what the kit stores for the application), `open-test-database.ts` (PostgreSQL in process, or the server named by a URL; with Vitest each spec opens a copy of the cluster `test/support/test-database-template.ts`, the global setup of the run, initialised once, and creates its tables there; with drizzle from `table-statements.ts`, the SQL of the tables of `schema.ts`, since drizzle-kit writes migrations, not tables, its unique indexes included), `persistence.contract.spec.ts` (the outbox, processed-event, job and process stores as the platform wires them, held to the contracts of `@ddd-ts-kit/testing` with what the stack turns on: the tenant under `--tenancy`, the unit of work). The storage class a repository adapter names in its dependency list: `database.ts` with drizzle and prisma (`abstract class Database extends` the context type of the ORM package), `KnexContext` of `@ddd-ts-kit/knex`, `TypeOrmContext` of `@ddd-ts-kit/typeorm` |
616
616
  | migration tooling | `drizzle.config.ts`, `knexfile.js` and `migrations/00000000000000_initial.js`, `prisma/schema/schema.prisma` (the client, the datasource and the tables of the platform; `generate repository` adds the file of each context, `prisma/schema/<context>.prisma`) and `prisma.config.ts`, or `data-source.ts`. A project that keeps the one `prisma/schema.prisma` of versions before 0.95 keeps it with its `prisma.config.ts` and its `db:client`, even under `--force`: `init` writes nothing under `prisma/schema/`, its notes give the steps of the move with the contexts of the project named, and `generate repository` refuses until the move |
617
617
  | `scripts/openapi.ts`, `scripts/events.ts` | write `openapi/openapi.yaml` (one file per document of `openapi.documents`), `docs/integration/asyncapi.yaml` and `docs/integration/event-catalog.md`, in JSON under `openapi.format: json`; `--check` fails on a difference |
618
- | `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | with `--privacy on`, the two requests of a data subject, answered from the command line on the sources with the variables of `.env` (`npm run privacy:erase -- <subject-id> [--operator <who-asks>]`, `npm run privacy:export -- <subject-id> > export.json`): the erasure destroys the key of the subject first when the project has an event store (`--event-sourcing on`: its stored events read as erased; audited with `--audit on`), then erases every copy listed in `src/platform/privacy/data-subject-copies.ts`; `privacy:purge` runs by hand what the job `privacy.purge-expired` runs every night at 03:00 UTC, the purge of what outlived its retention (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` switches the job off); the export gathers every record listed in `data-subject-exports.ts` into one dated JSON document (`format`, `subject`, `exportedAt`, `records`), the export of each context audited with `--audit on`, never the values (every run leaves its entry, a trial included: try it on a test subject). With `--tenancy shared-table`, `TENANTS` names the tenants, comma separated: a write of tenant data is never widened. Neither reaches backups, logs or a copy no context declared |
618
+ | `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | with `--privacy on`, the two requests of a data subject, answered from the command line on the sources with the variables of `.env` (`npm run privacy:erase -- <subject-id> [--operator <who-asks>] [--rerun]`, `npm run privacy:export -- <subject-id> > export.json`): the erasure destroys the key of the subject first when the project has an event store (`--event-sourcing on`: its stored events read as erased; audited with `--audit on`), then erases every copy listed in `src/platform/privacy/data-subject-copies.ts`, each leaving its entry with `--audit on`, and what the outbox and the job store keep of the person; an id that reached nothing is refused, exit code 1, and announced to nobody, unless `--rerun` says this person was erased before; `privacy:purge` runs by hand what the job `privacy.purge-expired` runs every night at 03:00 UTC, the purge of what outlived its retention (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` switches the job off); the export gathers every record listed in `data-subject-exports.ts` into one dated JSON document (`format`, `subject`, `exportedAt`, `records`), the export of each context audited with `--audit on`, never the values (every run leaves its entry, a trial included: try it on a test subject). With `--tenancy shared-table`, `TENANTS` names the tenants, comma separated: a write of tenant data is never widened. Neither reaches backups, logs, a copy no context declared, a message already delivered or a job that names no `subject` |
619
619
  | `docker-compose.yml`, `.env.example`, `Dockerfile`, `.dockerignore` | the database with a healthcheck and a named volume, `jaegertracing/jaeger:2.22.0` behind the `observability` profile, every port published on 127.0.0.1 only (a wider address is written in the entry on purpose, the README of the project says how), ports from `.env`; a multi-stage, non-root image with production dependencies only |
620
620
  | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (the whole application on a free port, on an in-process database unless `DATABASE_URL` is set, no job run by time; `settled()` resolves once the outbox has relayed what the requests stored; `publish(events)` hands integration events of an upstream to its handlers, as the relay of that upstream would), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)`: a trace without the calls an adapter makes on itself, the form `expectSpanTree` asserts) |
621
621
  | `docs/context-map.md`, `docs/integration/README.md` | see `docs` |
@@ -797,14 +797,14 @@ Next, in this order: the language of the context first, then the business decisi
797
797
  | `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>]` | an upload: a controller that declares the file it receives (its size and media types in the contract, checked as it streams), the command that carries it as a `FileUpload`, staged by the command bus before the transaction, the handler that records it and promotes it with the commit, and their specs. Refused without `stack.storage` or without an HTTP stack, with the `init --force --storage local` to run |
798
798
  | `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts`: an empty class carrying `@RouteGroup`, behind `Authenticated` unless `--public` or `--role` says otherwise (`HasRole(Role.Admin)`, the role read from the vocabulary of the platform, `<platformDir>/auth/authorization/role.ts`, which gets it when it does not hold it); with `--group` it refines that group and inherits from it |
799
799
  | `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts`: a declared guard class to fill, and its spec |
800
- | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | adds `produces` to the `@Controller` of the use case, and `consumes: ['application/xml']` to one that receives a body when XML is asked; says when CSV needs a page or a streamed list, and when `stack.representations` is not `negotiated` |
800
+ | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | after `generate route` of the use case (a controller under `"stack.routes": "controllers"` or `"nest"`) or `generate controller`: adds `produces` to the `@Controller` of the use case, and `consumes: ['application/xml']` to one that receives a body when XML is asked; says when CSV needs a page or a streamed list, and when `stack.representations` is not `negotiated` |
801
801
  | `form` | `<context> <UseCase>` | adds `const form = defineForm<Infer<typeof body>>({ ... })` before the `@Controller` of a use case that receives a body, and `form` to its options: the hints of its form at `GET /forms/<operationId>` |
802
802
  | `schema` | `<context\|shared-kernel> <Name>` | `presentation/http/shared/<name>.schema.ts` of the context, or `presentation/<name>.schema.ts` of the shared kernel: one shape of the contract declared once (a zod schema with `.meta({ id })`, a class-validator class, or a schema wrapped by `sharedSchema`), to fill; the routes use it whole, nested or in part |
803
803
  | `integration-event` | `<context> <Aggregate> <Fact> [--version n]` | `defineIntegrationEvent` declaration in the published language (its payload in `<event>.v<n>.payload.ts` with class-validator or a schema of your own), index export, the publisher `application/integration/publishers/<event>.publisher.ts`, spec, registration, a line of `platform/audit/audited-events.ts` |
804
- | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, a class `<Name>IntegrationHandler` depending on `CommandBus`, its spec, its idempotent subscription under the consumer name `<context>.<name>`; refused unless the upstream is declared |
804
+ | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>[@v<n>]` | `application/integration/handlers/<name>.integration-handler.ts`, a class `<Name>IntegrationHandler` depending on `CommandBus`, its spec, its idempotent subscription under the consumer name `<context>.<name>`; the type is taken as `list` prints it, with or without `@v<n>` (the newest version without, `--version <n>` saying the same as the suffix); refused unless the upstream is declared and publishes that version (a version that is not found is refused, never replaced by another) |
805
805
  | `erasure-handler` | `<context>` | `application/integration/handlers/data-subject-erased.integration-handler.ts`, a class `DataSubjectErasedIntegrationHandler` that erases what the context keeps of a person through its `<Context>PersonalDataErasure` when the platform announces `privacy.data-subject.erased` (`dataSubjectErasedV1` of the kernel), its spec on the fake, its idempotent subscription under the consumer name `<context>.data-subject-erased` (in a transaction behind a broker); for a context that runs as a service of its own or copies personal data from events. Refused until the context has its erasure (`generate repository --personal`), and refused on an event-sourced context, whose personal values are erased by destroying the key of the subject (`eraseDataSubject`) |
806
806
  | `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|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 |
807
- | `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. In the explicit style on tsyringe the module file of the context includes it with `builder.include(<Name>Projection)`; on a hand-wired platform the class is plain and the module subscribes it under its consumer name. It keeps one read model: its port is received in the constructor |
807
+ | `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>]` | 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; the type is taken as `list` prints it, `@v<n>` pinning the version (the newest without). In the explicit style on tsyringe the module file of the context includes it with `builder.include(<Name>Projection)`; on a hand-wired platform the class is plain and the module subscribes it under its consumer name. It keeps one read model: its port is received in the constructor |
808
808
  | `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/jobs/job-settings.ts`; the grant of its system actor (below) |
809
809
  | `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), and its static `payload`, the schema of that payload in the validation library of the stack (a `z.object` under zod, a class of decorated fields without initial value under class-validator, a `Type.Object` under TypeBox, one refusal per field written by hand under Standard Schema and, with `--validation none`, in the `BackgroundJobPayloadSchema` of the kernel; a type it writes no check for is typed `unknown` with a `TODO(domain)`), which the worker reads the stored payload with before each run; `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user and runs what is due, then enqueues it as an earlier version declared it (`earlierVersionOf` of `@ddd-ts-kit/testing`) and shows the job dead with `INVALID_JOB_PAYLOAD` (through the test application on tsyringe, through a queue and a worker in memory on the test buses otherwise); its registration (`@Background()`, `builder.backgroundJob(..)` in the module file on tsyringe, `platform.backgroundJobs.register(..)` in the module file of a platform wired by hand) |
810
810
  | `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 on tsyringe, a queue and a runner in memory on the test buses otherwise) |
@@ -932,7 +932,11 @@ Next, in this order: the language of the context first, then the business decisi
932
932
  not read as past tense are refused too; a technical word passes when a term of the glossary
933
933
  holds it (`--term "Scoring model=<meaning>"` lets `ScoringModel` through), because the language
934
934
  of the business wins. `--allow-name` overrides the three checks; `check`
935
- will still report what the glossary does not define.
935
+ will still report what the glossary does not define. Only the kinds whose usage shows `--term`
936
+ take it (`heldToGlossary` in `generate --help --json`, a line of `generate <kind> --help`); the
937
+ others (`port`, `adapter`, `repository`, `route`, `representation`...) name what an earlier
938
+ command named or what the concept they serve is called, and refuse `--term`, naming the kinds
939
+ that take it.
936
940
  - Generated code compiles as is and passes `check`, the ESLint preset, dependency-cruiser and knip
937
941
  at the default severities: one export per file, files far under 350 lines, `private` members,
938
942
  the blank-line layout. Every place that needs business knowledge carries a
@@ -956,7 +960,9 @@ Next, in this order: the language of the context first, then the business decisi
956
960
  output prints each place on one line, `file:line gist` (the whole `text` of a step).
957
961
  - A kind that needs something else to compile either creates it (a missing repository or
958
962
  domain event) or stops with the command that creates it (a missing aggregate, use case or
959
- route).
963
+ route). Its `summary` names that command, `After generate ...`
964
+ (`After generate route <context> <UseCase>` for a `representation`): the commands of one row
965
+ of the slices run in that order.
960
966
  - Registration goes between marker comments (`// ddd-ts-kit:<region>` ... `// /ddd-ts-kit:<region>`,
961
967
  HTML comments in Markdown). Remove a marker and the generator prints what to add by hand.
962
968
  - Every `generate` refreshes the generated documentation and `.dependency-cruiser.cjs` when
@@ -964,7 +970,8 @@ Next, in this order: the language of the context first, then the business decisi
964
970
  - `--local-only` refuses, naming the files and writing nothing, when the run would write outside
965
971
  `<contextsDir>/<context>/` and `test/e2e/*.e2e.spec.ts`. `generate --help --json` prints every
966
972
  kind with its `usage`, `aliases`, `summary` and `writesShared`, plus `shared` and `sharedWhen`:
967
- what it writes outside its context, and when; `generate <kind> --help --json` prints that kind
973
+ what it writes outside its context, and when; `writesInModules`, true when it takes `--module`;
974
+ and `heldToGlossary`, true when it takes `--term`. `generate <kind> --help --json` prints that kind
968
975
  alone, as one object, and `generate <kind> --help` the same as text. Both serve a build split between workers (see
969
976
  `worker-scope`).
970
977
  - A fake is an entry point for knip and may have no importer for dependency-cruiser: a port
@@ -2327,7 +2334,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
2327
2334
  | `tracing/platform-only` | an import of `@ddd-ts-kit/tracing` or of an `@opentelemetry/*` package outside the platform directory, `main.ts` and `apps/`, tests included |
2328
2335
  | `nest/no-parallel-pipeline` | in `presentation/`, `infrastructure/` or the module file of a context, tests apart: an import of a controller Nest serves (its route and parameter decorators, unless the file imports `KitRoute` or `KitRoutes` of `@ddd-ts-kit/http/nest`), the raw request or answer, a guard, a pipe, an exception filter or an `HttpException`, an interceptor or the `Logger` of `@nestjs/common`, a bare import of it, or an import of a package of Nest whose work the kit does (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` and the others of section 3 of ARCHITECTURE.md); the message names what the kit does in its place; under the source root outside the contexts, tests apart: a file that imports `Controller` of `@nestjs/common`, neither `KitRoute` nor `KitRoutes`, and names `CommandBus` or `QueryBus` or imports a file of a context |
2329
2336
  | `nest/controllers-current` | with `"stack.routes": "nest"`: a `<context>.controllers.ts` that differs from what the Nest controllers of the context and the signatures of their methods give, or is missing; a part of the request taken whole by no DTO class that `request` of `@KitRoute` does not give; a route method that answers no DTO class, `Accepted` or `void` and declares no `response` in `@KitRoute` |
2330
- | `tenancy/scoped-statement` | with `stack.tenancy` other than `none`, in `infrastructure/` of a context, tests and a context whose `tenancy` is `control-plane` aside: on Knex the executor used other than as an argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) and any `.raw(`; on Drizzle, statement by statement, a read, update or delete on the executor whose where has no `tenantCondition(` nor `ownTenantCondition(` (inline or in the local it is given), an insert whose row has no `tenantScopeOf(`, a relational query (`executor().query`), a raw `execute(`, or the executor held in a variable; on Prisma, statement by statement on the client, a read (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) whose where spreads no `tenantWhere(`, an update or a delete whose where spreads no `ownTenantWhere(`, a create whose data spreads no `tenantScopeOf(` (inline or in a local the arguments name), `findUnique(`, `upsert(`, a raw query (`$queryRaw`, `$executeRaw`), or the client held in a variable; on TypeORM the same on the manager (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, the row handed to `insertIgnoringConflict(`, a query builder whose where carries no condition, `save(`, `upsert(`, `query(`); on the four, a read model store built without its `tenant` option. A where built by another function is not followed |
2337
+ | `tenancy/scoped-statement` | with `stack.tenancy` other than `none`, in `infrastructure/` of a context, tests and a context whose `tenancy` is `control-plane` aside: on Knex the executor used other than as an argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) and any `.raw(`; on Drizzle, statement by statement, a read, update or delete on the executor whose where has no `tenantCondition(` nor `ownTenantCondition(` (inline or in the local it is given), an insert whose row has no `tenantScopeOf(`, a relational query (`executor().query`), a raw `execute(`, or the executor held in a variable; on Prisma, statement by statement on the client, a read (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) whose where spreads no `tenantWhere(`, an update or a delete whose where spreads no `ownTenantWhere(`, a create whose data spreads no `tenantScopeOf(` (inline or in a local the arguments name), `findUnique(`, `upsert(`, a raw query (`$queryRaw`, `$executeRaw`), or the client held in a variable; on TypeORM the same on the manager (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, the row handed to `insertIgnoringConflict(`, a query builder whose where carries no condition, `save(`, `upsert(`, `query(`); on the four, a read model store built without its `tenant` option, and a tenant condition that is no conjunct of its statement: on Knex `.orWhere*` or `.or` at the top of a statement of `tenantTable`, `ownTenantTable` or `whereTenant`, `clearWhere()` or `clear('where')` on it, on Drizzle the condition under `or`, `not` or a `sql` template, on Prisma the spread under `OR`, `NOT` or a relation, on TypeORM the same, a where array with an entry that does not spread it, an `orWhere` at the top of a query builder, a `where` after the one that carries the condition. A where built by another function is not followed |
2331
2338
  | `standard/no-parallel-interface` | a class, interface or type alias declared as `ILogger`, `AppLogger`, `LoggerService`, `LoggerInterface`, `IMetrics`, `MetricsService`, `ICache`, `CacheService`, `UserContext`, `CurrentUser`, `AuthContext`, `RequestContext` (outside `presentation/` and the platform), `UserSession`, `AuthSession`, `SessionData`, `PaginatedResult`, `PageResult`, `PaginatedResponse`, `Paginated`, `PaginationParams`, `PageParams`, `AuditLog`, `AuditLogEntry`, `AuditRecord`, `IJobScheduler`, `JobSchedulerService`, `CronScheduler`, `TaskScheduler`, `IScheduledJob`, `CronJob`, `ScheduledTask`, `BackgroundJob`, `IErrorReporter`, `ErrorReporterService`, `ErrorTracker`, `ExceptionReporter`, `CrashReporter`, `CacheInvalidator`, `CacheInvalidationService`, `CachePurgeService`, `CdnPurger`, `I` followed by a standard name (`IClock`, `IIdGenerator`, `IUnitOfWork`, `ISession`, ...) or a name of `standardInterfaces`; a class that implements or extends the standard interface is an adapter and is not reported |
2332
2339
  | `events/outbox-required` | `stack.events` other than `outbox` with an ORM and no `stack.events` deviation; in `domain/` and `application/`, the import of a broker client or of a bus or relay implementation; a publisher depending on more than `IntegrationEventPublisher`; a platform module that hands out a publisher and never names `OutboxPublisher` |
2333
2340
  | `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 |
@@ -1,7 +1,6 @@
1
- import type { AliasRoot, BuildLayout } from '../alias/index.js';
1
+ import type { BuildLayout } from '../alias/index.js';
2
2
  /** Where the compiler wrote, and what it wrote there. */
3
3
  export interface EmittedPlace {
4
- readonly roots: readonly AliasRoot[];
5
4
  readonly layout: BuildLayout;
6
5
  /** What an alias specifier ends with in the sources: `.js`, or nothing. */
7
6
  readonly suffix: string;
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-place.d.ts","sourceRoot":"","sources":["../../src/build/emitted-place.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvD,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C"}
1
+ {"version":3,"file":"emitted-place.d.ts","sourceRoot":"","sources":["../../src/build/emitted-place.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C"}
@@ -1,4 +1,10 @@
1
+ import type { AliasRoot } from '../alias/index.js';
1
2
  import type { EmittedPlace } from './emitted-place.js';
3
+ /** An alias specifier, with the root whose prefix it starts with. */
4
+ export interface AliasedSpecifier {
5
+ readonly root: AliasRoot;
6
+ readonly specifier: string;
7
+ }
2
8
  /**
3
9
  * The relative specifier that names, from an emitted file, the emitted file an alias specifier
4
10
  * stands for, always with its `.js` extension: Node resolves no other spelling. A directory is
@@ -6,5 +12,5 @@ import type { EmittedPlace } from './emitted-place.js';
6
12
  * file, or when the specifier is not written as the project writes its imports. Both files are
7
13
  * given from the project root.
8
14
  */
9
- export declare function emittedSpecifier(place: EmittedPlace, file: string, specifier: string): string | undefined;
15
+ export declare function emittedSpecifier(place: EmittedPlace, file: string, { root, specifier }: AliasedSpecifier): string | undefined;
10
16
  //# sourceMappingURL=emitted-specifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-specifier.d.ts","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYzG"}
1
+ {"version":3,"file":"emitted-specifier.d.ts","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,MAAM,EACZ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,gBAAgB,GACpC,MAAM,GAAG,SAAS,CAYpB"}
@@ -8,8 +8,8 @@ const DECLARATION = /\.d\.[cm]?ts$/;
8
8
  * file, or when the specifier is not written as the project writes its imports. Both files are
9
9
  * given from the project root.
10
10
  */
11
- export function emittedSpecifier(place, file, specifier) {
12
- const target = candidates(place, specifier).find((candidate) => place.isFile(candidate) || declared(place, file, candidate));
11
+ export function emittedSpecifier(place, file, { root, specifier }) {
12
+ const target = candidates(place, root, specifier).find((candidate) => place.isFile(candidate) || declared(place, file, candidate));
13
13
  if (target === undefined) {
14
14
  return undefined;
15
15
  }
@@ -20,10 +20,9 @@ export function emittedSpecifier(place, file, specifier) {
20
20
  * The files a specifier can stand for: the file of that name, then, in a project that writes no
21
21
  * extension, the `index` of the directory of that name, as the compiler resolves it.
22
22
  */
23
- function candidates(place, specifier) {
24
- const own = emittedTarget(place, specifier);
25
- const inside = place.suffix === '' ? emittedTarget(place, `${specifier.replace(/\/$/, '')}/index`) : undefined;
26
- return [own, inside].filter((candidate) => candidate !== undefined);
23
+ function candidates(place, root, specifier) {
24
+ const own = emittedTarget(place, root, specifier);
25
+ return place.suffix === '' ? [own, emittedTarget(place, root, `${specifier.replace(/\/$/, '')}/index`)] : [own];
27
26
  }
28
27
  /** A declaration file may name a module only its declaration was emitted for. */
29
28
  function declared(place, file, candidate) {
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-specifier.js","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACnF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,IAAI,CAC9C,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAC3E,CAAC;IAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAmB,EAAE,SAAiB;IACxD,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/G,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;AACtE,CAAC;AAED,iFAAiF;AACjF,SAAS,QAAQ,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACpE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC"}
1
+ {"version":3,"file":"emitted-specifier.js","sourceRoot":"","sources":["../../src/build/emitted-specifier.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,GAAG,eAAe,CAAC;AAQpC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAmB,EACnB,IAAY,EACZ,EAAE,IAAI,EAAE,SAAS,EAAoB;IAErC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,IAAI,CACpD,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAC3E,CAAC;IAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAmB,EAAE,IAAe,EAAE,SAAiB;IACzE,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAClH,CAAC;AAED,iFAAiF;AACjF,SAAS,QAAQ,CAAC,KAAmB,EAAE,IAAY,EAAE,SAAiB;IACpE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC"}
@@ -1,9 +1,10 @@
1
+ import type { AliasRoot } from '../alias/index.js';
1
2
  import type { EmittedPlace } from './emitted-place.js';
2
3
  /**
3
- * The emitted file an alias specifier names, from the project root, whether or not it exists;
4
- * nothing when the specifier starts with no alias. One spelling names it: the path of the file
5
- * with the ending the project writes; a specifier written the other way is never guessed. The
6
- * `index` of a directory is the business of the caller.
4
+ * The emitted file an alias specifier of `root` names, from the project root, whether or not it
5
+ * exists. One spelling names it: the path of the file with the ending the project writes; a
6
+ * specifier written the other way is never guessed. The `index` of a directory is the business of
7
+ * the caller.
7
8
  */
8
- export declare function emittedTarget(place: EmittedPlace, specifier: string): string | undefined;
9
+ export declare function emittedTarget(place: EmittedPlace, root: AliasRoot, specifier: string): string;
9
10
  //# sourceMappingURL=emitted-target.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-target.d.ts","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYxF"}
1
+ {"version":3,"file":"emitted-target.d.ts","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM7F"}
@@ -1,15 +1,11 @@
1
1
  import path from 'node:path';
2
2
  /**
3
- * The emitted file an alias specifier names, from the project root, whether or not it exists;
4
- * nothing when the specifier starts with no alias. One spelling names it: the path of the file
5
- * with the ending the project writes; a specifier written the other way is never guessed. The
6
- * `index` of a directory is the business of the caller.
3
+ * The emitted file an alias specifier of `root` names, from the project root, whether or not it
4
+ * exists. One spelling names it: the path of the file with the ending the project writes; a
5
+ * specifier written the other way is never guessed. The `index` of a directory is the business of
6
+ * the caller.
7
7
  */
8
- export function emittedTarget(place, specifier) {
9
- const root = place.roots.find(({ prefix }) => specifier.startsWith(prefix));
10
- if (root === undefined) {
11
- return undefined;
12
- }
8
+ export function emittedTarget(place, root, specifier) {
13
9
  const { rootDir, outDir } = place.layout;
14
10
  const directory = path.posix.join(outDir, path.posix.relative(rootDir, root.directory));
15
11
  const named = path.posix.join(directory, specifier.slice(root.prefix.length));
@@ -1 +1 @@
1
- {"version":3,"file":"emitted-target.js","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,SAAiB;IAClE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9E,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"emitted-target.js","sourceRoot":"","sources":["../../src/build/emitted-target.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,IAAe,EAAE,SAAiB;IACnF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9E,OAAO,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rewrite-aliases.d.ts","sourceRoot":"","sources":["../../src/build/rewrite-aliases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,GAAG,aAAa,CAgC9F"}
1
+ {"version":3,"file":"rewrite-aliases.d.ts","sourceRoot":"","sources":["../../src/build/rewrite-aliases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,GAAG,aAAa,CAiC9F"}