ddd-ts-kit 0.87.0 → 0.88.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 (363) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.fr.md +13 -13
  3. package/README.md +12 -12
  4. package/dist/check/canonical/earlier-context-file.d.ts +15 -0
  5. package/dist/check/canonical/earlier-context-file.d.ts.map +1 -0
  6. package/dist/check/canonical/earlier-context-file.js +33 -0
  7. package/dist/check/canonical/earlier-context-file.js.map +1 -0
  8. package/dist/check/canonical/stray-entry.d.ts.map +1 -1
  9. package/dist/check/canonical/stray-entry.js +11 -9
  10. package/dist/check/canonical/stray-entry.js.map +1 -1
  11. package/dist/check/configuration/module-problems.js +2 -2
  12. package/dist/check/configuration/module-problems.js.map +1 -1
  13. package/dist/check/errors/code-list.d.ts +1 -1
  14. package/dist/check/errors/code-list.d.ts.map +1 -1
  15. package/dist/check/errors/is-codes-file.d.ts +1 -1
  16. package/dist/check/errors/is-codes-file.d.ts.map +1 -1
  17. package/dist/check/errors/is-codes-file.js +1 -1
  18. package/dist/check/errors/is-codes-file.js.map +1 -1
  19. package/dist/check/explain/errors-docs.js +5 -5
  20. package/dist/check/explain/errors-docs.js.map +1 -1
  21. package/dist/check/explain/language-docs.js +1 -1
  22. package/dist/check/explain/language-docs.js.map +1 -1
  23. package/dist/check/explain/module-docs.d.ts.map +1 -1
  24. package/dist/check/explain/module-docs.js +16 -12
  25. package/dist/check/explain/module-docs.js.map +1 -1
  26. package/dist/check/fixtures/authz-granted-fixtures.js +2 -2
  27. package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
  28. package/dist/check/fixtures/authz-scope-narrows-fixtures.js +4 -4
  29. package/dist/check/fixtures/authz-scope-narrows-fixtures.js.map +1 -1
  30. package/dist/check/fixtures/context-file-fixtures.d.ts +4 -0
  31. package/dist/check/fixtures/context-file-fixtures.d.ts.map +1 -0
  32. package/dist/check/fixtures/context-file-fixtures.js +36 -0
  33. package/dist/check/fixtures/context-file-fixtures.js.map +1 -0
  34. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  35. package/dist/check/fixtures/fixtures.js +2 -0
  36. package/dist/check/fixtures/fixtures.js.map +1 -1
  37. package/dist/check/fixtures/module-fixtures.d.ts.map +1 -1
  38. package/dist/check/fixtures/module-fixtures.js +50 -17
  39. package/dist/check/fixtures/module-fixtures.js.map +1 -1
  40. package/dist/check/fixtures/named-refusal-fixtures.js +5 -5
  41. package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -1
  42. package/dist/check/fixtures/vocabulary-fixtures.js +2 -2
  43. package/dist/check/fixtures/vocabulary-fixtures.js.map +1 -1
  44. package/dist/check/project/locate.d.ts.map +1 -1
  45. package/dist/check/project/locate.js +18 -9
  46. package/dist/check/project/locate.js.map +1 -1
  47. package/dist/check/rules/errors-code-listed.js +6 -8
  48. package/dist/check/rules/errors-code-listed.js.map +1 -1
  49. package/dist/check/rules/errors-code-unique.js +2 -2
  50. package/dist/check/rules/errors-code-unique.js.map +1 -1
  51. package/dist/check/rules/errors-known-code.js +2 -2
  52. package/dist/check/rules/errors-known-code.js.map +1 -1
  53. package/dist/check/rules/language-glossary-term.js +1 -1
  54. package/dist/check/rules/language-glossary-term.js.map +1 -1
  55. package/dist/check/rules/module-complete.d.ts.map +1 -1
  56. package/dist/check/rules/module-complete.js +67 -13
  57. package/dist/check/rules/module-complete.js.map +1 -1
  58. package/dist/check/rules/naming-suffix.d.ts.map +1 -1
  59. package/dist/check/rules/naming-suffix.js +12 -9
  60. package/dist/check/rules/naming-suffix.js.map +1 -1
  61. package/dist/check/rules/tree-closed.d.ts.map +1 -1
  62. package/dist/check/rules/tree-closed.js +8 -1
  63. package/dist/check/rules/tree-closed.js.map +1 -1
  64. package/dist/check/support/path-in-context.d.ts +5 -1
  65. package/dist/check/support/path-in-context.d.ts.map +1 -1
  66. package/dist/check/support/path-in-context.js +12 -3
  67. package/dist/check/support/path-in-context.js.map +1 -1
  68. package/dist/commands/context-layout.d.ts +4 -0
  69. package/dist/commands/context-layout.d.ts.map +1 -0
  70. package/dist/commands/context-layout.js +48 -0
  71. package/dist/commands/context-layout.js.map +1 -0
  72. package/dist/commands/generate.js +2 -2
  73. package/dist/commands/generate.js.map +1 -1
  74. package/dist/commands/move-to-module.d.ts.map +1 -1
  75. package/dist/commands/move-to-module.js +2 -0
  76. package/dist/commands/move-to-module.js.map +1 -1
  77. package/dist/config/stack.d.ts +1 -1
  78. package/dist/context-files/context-file-at.d.ts +7 -0
  79. package/dist/context-files/context-file-at.d.ts.map +1 -0
  80. package/dist/context-files/context-file-at.js +9 -0
  81. package/dist/context-files/context-file-at.js.map +1 -0
  82. package/dist/context-files/context-file-placement.d.ts +8 -0
  83. package/dist/context-files/context-file-placement.d.ts.map +1 -0
  84. package/dist/context-files/context-file-placement.js +23 -0
  85. package/dist/context-files/context-file-placement.js.map +1 -0
  86. package/dist/context-files/context-file.d.ts +16 -0
  87. package/dist/context-files/context-file.d.ts.map +1 -0
  88. package/dist/context-files/context-file.js +12 -0
  89. package/dist/context-files/context-file.js.map +1 -0
  90. package/dist/context-files/earlier-place-of.d.ts +7 -0
  91. package/dist/context-files/earlier-place-of.d.ts.map +1 -0
  92. package/dist/context-files/earlier-place-of.js +10 -0
  93. package/dist/context-files/earlier-place-of.js.map +1 -0
  94. package/dist/context-files/index.d.ts +5 -0
  95. package/dist/context-files/index.d.ts.map +1 -0
  96. package/dist/context-files/index.js +5 -0
  97. package/dist/context-files/index.js.map +1 -0
  98. package/dist/context-layout/context-layout.d.ts +19 -0
  99. package/dist/context-layout/context-layout.d.ts.map +1 -0
  100. package/dist/context-layout/context-layout.js +55 -0
  101. package/dist/context-layout/context-layout.js.map +1 -0
  102. package/dist/context-layout/index.d.ts +2 -0
  103. package/dist/context-layout/index.d.ts.map +1 -0
  104. package/dist/context-layout/index.js +2 -0
  105. package/dist/context-layout/index.js.map +1 -0
  106. package/dist/context-layout/module-moves.d.ts +21 -0
  107. package/dist/context-layout/module-moves.d.ts.map +1 -0
  108. package/dist/context-layout/module-moves.js +146 -0
  109. package/dist/context-layout/module-moves.js.map +1 -0
  110. package/dist/controllers/migrate-context.js +20 -15
  111. package/dist/controllers/migrate-context.js.map +1 -1
  112. package/dist/controllers/plan-context.d.ts +5 -1
  113. package/dist/controllers/plan-context.d.ts.map +1 -1
  114. package/dist/controllers/plan-context.js +19 -5
  115. package/dist/controllers/plan-context.js.map +1 -1
  116. package/dist/depcruise/layer-rules.js +21 -7
  117. package/dist/depcruise/layer-rules.js.map +1 -1
  118. package/dist/describe/read-adapters.d.ts.map +1 -1
  119. package/dist/describe/read-adapters.js +6 -4
  120. package/dist/describe/read-adapters.js.map +1 -1
  121. package/dist/describe/read-controllers.d.ts.map +1 -1
  122. package/dist/describe/read-controllers.js +5 -3
  123. package/dist/describe/read-controllers.js.map +1 -1
  124. package/dist/describe/read-errors.d.ts +1 -1
  125. package/dist/describe/read-errors.d.ts.map +1 -1
  126. package/dist/describe/read-errors.js +5 -3
  127. package/dist/describe/read-errors.js.map +1 -1
  128. package/dist/describe/read-routes.d.ts.map +1 -1
  129. package/dist/describe/read-routes.js +5 -5
  130. package/dist/describe/read-routes.js.map +1 -1
  131. package/dist/docs/context-facts.d.ts +1 -1
  132. package/dist/docs/context-facts.d.ts.map +1 -1
  133. package/dist/docs/read-context.d.ts.map +1 -1
  134. package/dist/docs/read-context.js +2 -1
  135. package/dist/docs/read-context.js.map +1 -1
  136. package/dist/docs/refresh-context-doc.js +1 -1
  137. package/dist/docs/refresh-context-doc.js.map +1 -1
  138. package/dist/docs/state-machine-lines.d.ts +1 -1
  139. package/dist/docs/state-machine-lines.d.ts.map +1 -1
  140. package/dist/docs/state-machine-lines.js +6 -2
  141. package/dist/docs/state-machine-lines.js.map +1 -1
  142. package/dist/file-moves/file-move.d.ts +6 -0
  143. package/dist/file-moves/file-move.d.ts.map +1 -0
  144. package/dist/file-moves/file-move.js +2 -0
  145. package/dist/file-moves/file-move.js.map +1 -0
  146. package/dist/file-moves/index.d.ts +3 -0
  147. package/dist/file-moves/index.d.ts.map +1 -0
  148. package/dist/file-moves/index.js +2 -0
  149. package/dist/file-moves/index.js.map +1 -0
  150. package/dist/file-moves/move-files.d.ts +15 -0
  151. package/dist/file-moves/move-files.d.ts.map +1 -0
  152. package/dist/file-moves/move-files.js +37 -0
  153. package/dist/file-moves/move-files.js.map +1 -0
  154. package/dist/generate/errors/codes-list.d.ts +1 -1
  155. package/dist/generate/errors/codes-list.d.ts.map +1 -1
  156. package/dist/generate/errors/write-named-refusal.d.ts +1 -1
  157. package/dist/generate/errors/write-named-refusal.d.ts.map +1 -1
  158. package/dist/generate/errors/write-named-refusal.js +3 -2
  159. package/dist/generate/errors/write-named-refusal.js.map +1 -1
  160. package/dist/generate/kind.d.ts +1 -1
  161. package/dist/generate/kind.d.ts.map +1 -1
  162. package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
  163. package/dist/generate/kinds/adapter-kind.js +22 -2
  164. package/dist/generate/kinds/adapter-kind.js.map +1 -1
  165. package/dist/generate/kinds/error-kind.js +1 -1
  166. package/dist/generate/kinds/error-kind.js.map +1 -1
  167. package/dist/generate/kinds/module-kind.js +1 -1
  168. package/dist/generate/kinds/module-kind.js.map +1 -1
  169. package/dist/generate/kinds/port-kind.d.ts.map +1 -1
  170. package/dist/generate/kinds/port-kind.js +3 -1
  171. package/dist/generate/kinds/port-kind.js.map +1 -1
  172. package/dist/generate/kinds/presentation/controller-of.d.ts +1 -1
  173. package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
  174. package/dist/generate/kinds/presentation/controller-of.js +7 -5
  175. package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
  176. package/dist/generate/permissions-file.d.ts +4 -1
  177. package/dist/generate/permissions-file.d.ts.map +1 -1
  178. package/dist/generate/permissions-file.js +6 -2
  179. package/dist/generate/permissions-file.js.map +1 -1
  180. package/dist/generate/place-context-files.d.ts +9 -0
  181. package/dist/generate/place-context-files.d.ts.map +1 -0
  182. package/dist/generate/place-context-files.js +14 -0
  183. package/dist/generate/place-context-files.js.map +1 -0
  184. package/dist/generate/place-generated-files.d.ts +18 -0
  185. package/dist/generate/place-generated-files.d.ts.map +1 -0
  186. package/dist/generate/{place-in-modules.js → place-generated-files.js} +42 -17
  187. package/dist/generate/place-generated-files.js.map +1 -0
  188. package/dist/generate/refresh-docs.d.ts.map +1 -1
  189. package/dist/generate/refresh-docs.js +3 -0
  190. package/dist/generate/refresh-docs.js.map +1 -1
  191. package/dist/generate/refuse-earlier-layout.d.ts +9 -0
  192. package/dist/generate/refuse-earlier-layout.d.ts.map +1 -0
  193. package/dist/generate/refuse-earlier-layout.js +15 -0
  194. package/dist/generate/refuse-earlier-layout.js.map +1 -0
  195. package/dist/help/notes.d.ts +1 -1
  196. package/dist/help/notes.d.ts.map +1 -1
  197. package/dist/help/notes.js +24 -9
  198. package/dist/help/notes.js.map +1 -1
  199. package/dist/help/usage.d.ts +1 -1
  200. package/dist/help/usage.d.ts.map +1 -1
  201. package/dist/help/usage.js +1 -0
  202. package/dist/help/usage.js.map +1 -1
  203. package/dist/init/manifest/versions.js +24 -24
  204. package/dist/init/run-init.d.ts.map +1 -1
  205. package/dist/init/run-init.js +6 -0
  206. package/dist/init/run-init.js.map +1 -1
  207. package/dist/knip/ignore-code-types-where-they-are.d.ts +11 -0
  208. package/dist/knip/ignore-code-types-where-they-are.d.ts.map +1 -0
  209. package/dist/knip/ignore-code-types-where-they-are.js +56 -0
  210. package/dist/knip/ignore-code-types-where-they-are.js.map +1 -0
  211. package/dist/knip/index.d.ts +2 -0
  212. package/dist/knip/index.d.ts.map +1 -0
  213. package/dist/knip/index.js +2 -0
  214. package/dist/knip/index.js.map +1 -0
  215. package/dist/model-modules/index.d.ts +1 -1
  216. package/dist/model-modules/index.d.ts.map +1 -1
  217. package/dist/model-modules/index.js +1 -1
  218. package/dist/model-modules/index.js.map +1 -1
  219. package/dist/model-modules/into-module.d.ts +5 -1
  220. package/dist/model-modules/into-module.d.ts.map +1 -1
  221. package/dist/model-modules/into-module.js +12 -5
  222. package/dist/model-modules/into-module.js.map +1 -1
  223. package/dist/model-modules/is-context-level.d.ts +5 -3
  224. package/dist/model-modules/is-context-level.d.ts.map +1 -1
  225. package/dist/model-modules/is-context-level.js +17 -4
  226. package/dist/model-modules/is-context-level.js.map +1 -1
  227. package/dist/model-modules/module-layers.d.ts +7 -1
  228. package/dist/model-modules/module-layers.d.ts.map +1 -1
  229. package/dist/model-modules/module-layers.js +8 -2
  230. package/dist/model-modules/module-layers.js.map +1 -1
  231. package/dist/model-modules/module-name-flaw.d.ts +2 -2
  232. package/dist/model-modules/module-name-flaw.js +4 -4
  233. package/dist/model-modules/module-name-flaw.js.map +1 -1
  234. package/dist/model-modules/module-placement.d.ts +5 -1
  235. package/dist/model-modules/module-placement.d.ts.map +1 -1
  236. package/dist/model-modules/module-placement.js +47 -18
  237. package/dist/model-modules/module-placement.js.map +1 -1
  238. package/dist/model-modules/module-split.d.ts +9 -5
  239. package/dist/model-modules/module-split.d.ts.map +1 -1
  240. package/dist/model-modules/module-split.js +30 -13
  241. package/dist/model-modules/module-split.js.map +1 -1
  242. package/dist/model-modules/role-directories-of.d.ts.map +1 -1
  243. package/dist/model-modules/role-directories-of.js +6 -1
  244. package/dist/model-modules/role-directories-of.js.map +1 -1
  245. package/dist/model-modules/role-folders-of.d.ts +1 -1
  246. package/dist/model-modules/role-folders-of.d.ts.map +1 -1
  247. package/dist/model-modules/role-folders-of.js +15 -5
  248. package/dist/model-modules/role-folders-of.js.map +1 -1
  249. package/dist/model-modules/role-folders.d.ts +2 -2
  250. package/dist/model-modules/role-folders.js +2 -2
  251. package/dist/move-to-module/module-move.d.ts +2 -4
  252. package/dist/move-to-module/module-move.d.ts.map +1 -1
  253. package/dist/move-to-module/move-to-module.d.ts +2 -6
  254. package/dist/move-to-module/move-to-module.d.ts.map +1 -1
  255. package/dist/move-to-module/move-to-module.js +2 -31
  256. package/dist/move-to-module/move-to-module.js.map +1 -1
  257. package/dist/move-to-module/moves-into-module.d.ts +1 -1
  258. package/dist/move-to-module/moves-into-module.d.ts.map +1 -1
  259. package/dist/move-to-module/moves-into-module.js +25 -6
  260. package/dist/move-to-module/moves-into-module.js.map +1 -1
  261. package/dist/refusals/code-types-pattern.d.ts +4 -0
  262. package/dist/refusals/code-types-pattern.d.ts.map +1 -0
  263. package/dist/refusals/code-types-pattern.js +6 -0
  264. package/dist/refusals/code-types-pattern.js.map +1 -0
  265. package/dist/refusals/ignore-code-types.d.ts +1 -1
  266. package/dist/refusals/ignore-code-types.d.ts.map +1 -1
  267. package/dist/refusals/ignore-code-types.js +3 -2
  268. package/dist/refusals/ignore-code-types.js.map +1 -1
  269. package/dist/refusals/path-from-contexts.d.ts +1 -1
  270. package/dist/refusals/path-from-contexts.js +2 -2
  271. package/dist/refusals/path-from-contexts.js.map +1 -1
  272. package/dist/refusals/with-codes.d.ts +1 -1
  273. package/dist/refusals/with-codes.d.ts.map +1 -1
  274. package/dist/refusals/with-codes.js +1 -1
  275. package/dist/refusals/with-codes.js.map +1 -1
  276. package/dist/refusals/write-refusal-classes.d.ts.map +1 -1
  277. package/dist/refusals/write-refusal-classes.js +4 -2
  278. package/dist/refusals/write-refusal-classes.js.map +1 -1
  279. package/dist/run.d.ts.map +1 -1
  280. package/dist/run.js +2 -0
  281. package/dist/run.js.map +1 -1
  282. package/dist/version.d.ts +1 -1
  283. package/dist/version.js +1 -1
  284. package/package.json +2 -2
  285. package/templates/command/handler.spec.buses.ts.tpl +1 -1
  286. package/templates/command/handler.spec.tsyringe.ts.tpl +1 -1
  287. package/templates/context/permission-set.tpl +1 -1
  288. package/templates/context/permissions.spec.ts.tpl +1 -1
  289. package/templates/error/refusal.ts.tpl +1 -1
  290. package/templates/file-upload/handler.spec.ts.tpl +1 -1
  291. package/templates/init/rules/application.md.tpl +3 -2
  292. package/templates/init/rules/domain.md.tpl +3 -2
  293. package/templates/init/rules/infrastructure.md.tpl +1 -0
  294. package/templates/init/rules/presentation.md.tpl +2 -1
  295. package/templates/pipeline/knip.json.tpl +1 -1
  296. package/templates/pipeline/package-scripts.json +1 -1
  297. package/templates/policy/policy.declared.ts.tpl +1 -1
  298. package/templates/policy/policy.ts.tpl +1 -1
  299. package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +1 -1
  300. package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +1 -1
  301. package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +1 -1
  302. package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +1 -1
  303. package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +1 -1
  304. package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +1 -1
  305. package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +1 -1
  306. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +1 -1
  307. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +1 -1
  308. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +1 -1
  309. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +1 -1
  310. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +1 -1
  311. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +1 -1
  312. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +1 -1
  313. package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +1 -1
  314. package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +1 -1
  315. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +1 -1
  316. package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +1 -1
  317. package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +1 -1
  318. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +1 -1
  319. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +1 -1
  320. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +1 -1
  321. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +1 -1
  322. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +1 -1
  323. package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +1 -1
  324. package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +1 -1
  325. package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +1 -1
  326. package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +1 -1
  327. package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +1 -1
  328. package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +1 -1
  329. package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +1 -1
  330. package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +1 -1
  331. package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +1 -1
  332. package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +1 -1
  333. package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +1 -1
  334. package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +1 -1
  335. package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +1 -1
  336. package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +1 -1
  337. package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +1 -1
  338. package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +1 -1
  339. package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +1 -1
  340. package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +1 -1
  341. package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +1 -1
  342. package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +1 -1
  343. package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +1 -1
  344. package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +1 -1
  345. package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +1 -1
  346. package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +1 -1
  347. package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +1 -1
  348. package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +1 -1
  349. package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +1 -1
  350. package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +1 -1
  351. package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +1 -1
  352. package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -1
  353. package/templates/query/handler.spec.buses.ts.tpl +1 -1
  354. package/templates/query/handler.spec.tsyringe.ts.tpl +1 -1
  355. package/templates/query/search.handler.declared.ts.tpl +1 -1
  356. package/templates/query/search.handler.spec.buses.ts.tpl +1 -1
  357. package/templates/query/search.handler.spec.tsyringe.ts.tpl +1 -1
  358. package/templates/query/search.handler.ts.tpl +1 -1
  359. package/dist/generate/place-in-modules.d.ts +0 -16
  360. package/dist/generate/place-in-modules.d.ts.map +0 -1
  361. package/dist/generate/place-in-modules.js.map +0 -1
  362. /package/templates/presets/identity/context/{domain/errors/codes.named.ts.tpl → __context__.codes.named.ts.tpl} +0 -0
  363. /package/templates/presets/identity/context/{application/authorization/__context__.permissions.ts.tpl → __context__.permissions.ts.tpl} +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ 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.88.0
8
+
9
+ **The code list and the permission set of a context sit at its root: `<context>.codes.ts` and `<context>.permissions.ts`.** They are one per context, whatever its modules, so they now sit next to `CONTEXT.md` and `<context>.declarations.ts` instead of `domain/errors/codes.ts` and `application/authorization/<context>.permissions.ts`. `domain/errors/` holds the refusal classes, `application/authorization/` the policies, and a folder that held the code list or the permission set alone is gone. In a context divided into modules, `domain/` and `application/` now hold nothing but their modules. Every rule reads the two files as it read them in their role folder: `<context>.codes.ts` is the code list of the domain for `errors/*`, `naming/suffix` and the layer rules, `<context>.permissions.ts` the permission set of the application for `authz/*`. `ddd-ts-kit check`, the ESLint plugin and the generated `.dependency-cruiser.cjs` follow (the domain may import the code list of its context, the application both files). The generators, the templates, the identity preset and `error-factories` write them at the root, and knip is told of the code types as `src/contexts/*/*.codes.ts`, and also where 0.86 and 0.87 kept them as long as one context still holds its list there (`init`, `generate` and `context-layout` keep the two patterns in step with the tree). `ddd-ts-kit context-layout [<context>...] [--dry-run]` is new: it moves the two files of every context, or of the ones named, from where 0.86 and 0.87 wrote them to the root, rewrites every import of them under the source root, `test/` and `scripts/`, removes a role folder the move leaves empty, writes again what derives from the tree (`.dependency-cruiser.cjs`, the generated declarations) and tells knip of the code lists where they now are; it says each file it wrote, `--dry-run` included.
10
+
11
+ To move: run `npx ddd-ts-kit context-layout`, then the formatter, the checks and the tests, and commit the result. The generated `.dependency-cruiser.cjs` changes with this version, and `npm run depcruise` checks it first: `npx ddd-ts-kit depcruise-config --write`, `context-layout` or any `generate` writes it again. Beyond that file, upgrading alone fails nothing: for one minor version, a code list or a permission set still where 0.86 and 0.87 wrote it is accepted. `ddd-ts-kit check` reports it as a warning of `tree/closed` (exit 0) that names the command, and the generators and `init --force` keep writing it where it is, the imports they write included. A file both at the root and in its earlier place is an error. A later minor version reports the earlier places as errors.
12
+
13
+ **A module of the model holds its own layers: `<module>/domain/`, `<module>/application/`, `<module>/infrastructure/`, `<module>/presentation/`, and its specs sit in `test/unit/<module>/`.** In a context divided into modules, everything about one part of the model, its model, its use cases, its adapters and its routes, is now under one folder, instead of `domain/<module>/` and `application/<module>/` with the adapters, routes and specs left organised by technique. What every module shares stays at the level of the context: `CONTEXT.md`, `<context>.codes.ts`, `<context>.permissions.ts`, the generated declarations, `published-language/`, the schema, tables and migrations of its database (the `*.schema.ts` of `infrastructure/persistence/` that are no row schema), its route groups with `guards/` and `shared/`, and `test/fakes/`, `test/builders/` and `test/worlds/`. `ddd-ts-kit check`, the ESLint plugin (its layer rules and the globs of its preset), the generated `.dependency-cruiser.cjs`, the coverage of `@ddd-ts-kit/testing` (each layer of each module held to its threshold), `discoverContext` of `@ddd-ts-kit/di`, the generated declarations (`<module>/<layer>/<layer>.declarations.ts`) and the guard of the plugin read the new layout; every rule reads a file of a module as the same file outside one. `generate ... --module <module>` writes the files of every layer into the module and each spec into the module of the file it is named after, and refuses a file of a layer without `--module` in a context that declares modules. `move-to-module` takes files of any layer and specs, and the specs named after a moved file follow it. `module/complete` reports a file of a layer outside every module and a spec left at the level of the context while its subject sits in a module. A folder at the root of a context that the config does not declare is reported by `tree/closed`, whose fix names `generate module`.
14
+
15
+ The coverage of `@ddd-ts-kit/testing` now holds each layer of each module to its floor on its own (`calendars/domain/`, `waitlist/domain/`), where 0.86 and 0.87 measured `domain/` of the context as one, so a module with few specs no longer hides behind a well tested one: a project whose pipeline passed may fail the coverage of one module right after `context-layout`. Run the coverage once after the move and write the specs of the layer it names; the floors themselves stay those of the `coverage` key of `ddd-ts-kit.config.json`, the same for every context and module (Jest sums a threshold over one folder, so a layer of a module cannot be summed with the same layer of the context).
16
+
17
+ To move: run `npx ddd-ts-kit context-layout`, then the formatter, the checks and the tests, and commit the result. The command moves each module from `domain/<module>/` and `application/<module>/` to its folder, and each adapter, route and spec left at the level of the context to the module of what it imports (a spec to the module of the file it is named after, a file that imports nothing of a module to the module of the files that import it), every import of them under the source root, `test/` and `scripts/` following; a file whose imports name two modules, or none, is listed and stays where it is. For one minor version, a module still where 0.86 and 0.87 put it is read and reported as a warning of `module/complete` that names the command, but the generators refuse to write in such a context until it is moved: a file written in the layout of today would sit apart from the rest of its module.
18
+
19
+ **A study of the velocity of the build, the checks and the tests, with its measures and its plan.**
20
+ The proposal page `docs/proposals/build-and-test-velocity.md` (and its French page) measures
21
+ where the time and the memory of this repository go, on a workstation and in the pipeline, tests
22
+ the levers of Vitest, ESLint, Oxlint, the native compiler and the package managers on this tree,
23
+ summarizes what other teams published about orchestrators, package managers, test selection and
24
+ GitHub Actions, and ends with a plan in order of gain per cost: fewer jobs per pipeline run and
25
+ the heavy families narrowed on a pull request, the compile matrix of five spec files in
26
+ parallel, half the cores and `related` tests before a push, the ESLint content cache, the type
27
+ check of the specs in parallel; Oxlint and arm64 runners to try; pnpm not now; no orchestrator.
28
+ Nothing of the pipeline or of the templates changes in this pull request.
29
+
7
30
  ## 0.87.0
8
31
 
9
32
  **`S3FileStorage.put` stores a file larger than one part.** The SDK read the `size` of the
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:1943e91157120782 -->
2
+ <!-- translation-of: README.md sha256:4274a8d0abcf48c0 -->
3
3
 
4
4
  # ddd-ts-kit
5
5
 
@@ -180,7 +180,7 @@ declare class Invoice extends AggregateRoot {
180
180
  // domain/repositories/invoice.repository.ts
181
181
  export abstract class InvoiceRepository extends Repository<Invoice> {}
182
182
 
183
- // application/authorization/billing.permissions.ts
183
+ // billing.permissions.ts
184
184
  export const billingPermissions = definePermissions('billing', {
185
185
  'invoice.issue': { description: 'Issue invoice' },
186
186
  });
@@ -366,7 +366,7 @@ et l'unique ligne de la racine de composition qui ajoute tout le contexte :
366
366
  **Un refus est une classe à lui.** `init` écrit `"stack.refusals": "named"` : chaque refus d'un
367
367
  contexte est une classe nommée d'après ce qui est refusé, qui étend `DomainRefusal` du kernel,
368
368
  construite par des fabriques (factories) statiques nommées d'après ce sur quoi porte le refus, et
369
- son code se lit dans la liste fermée des codes du contexte, `domain/errors/codes.ts`.
369
+ son code se lit dans la liste fermée des codes du contexte, `<context>.codes.ts`.
370
370
  `generate error <context> <Refusal> <factory>` écrit la classe, son code et la fabrique. Les
371
371
  règles `errors/*` tiennent cette forme. Deux formes antérieures continuent de fonctionner :
372
372
  `--refusals factories`, une classe d'erreur par concept qui étend `ConceptError`, chaque refus une
@@ -380,7 +380,7 @@ La forme qu'écrit `init`, que commence `generate error scheduling SlotTaken for
380
380
  ```ts
381
381
  import { DomainRefusal } from '@ddd-ts-kit/kernel';
382
382
 
383
- // domain/errors/codes.ts : la liste fermée des codes du contexte
383
+ // scheduling.codes.ts : la liste fermée des codes du contexte
384
384
  export const SchedulingCodes = {
385
385
  SlotTaken: 'SLOT_TAKEN',
386
386
  } as const;
@@ -691,7 +691,7 @@ would create src/contexts/notification/application/commands/archive-notification
691
691
  would create src/contexts/notification/application/commands/archive-notification/archive-notification.handler.ts
692
692
  would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
693
693
  would update src/contexts/notification/CONTEXT.md
694
- would update src/contexts/notification/application/authorization/notification.permissions.ts
694
+ would update src/contexts/notification/notification.permissions.ts
695
695
  would update src/contexts/notification/application/application.declarations.ts
696
696
 
697
697
  Next, in this order: the language of the context first, then the business decisions only you can make
@@ -702,7 +702,7 @@ Next, in this order: the language of the context first, then the business decisi
702
702
 
703
703
  | Genre | Arguments | Écrit |
704
704
  |---|---|---|
705
- | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` avec son glossaire, `published-language/index.ts`, l'entrée de configuration, l'enregistrement dans `platform/composition/compose-application.ts` et dans `test/architecture/extractable.spec.ts` ; sur tsyringe, avec HTTP, `presentation/http/<name>.routes.ts` (une fonction des deux bus, dans les deux styles) ; déclaré : le barrel `<name>.declarations.ts` ; explicite et câblage manuel : `<name>.module.ts`. `application/authorization/<name>.permissions.ts` naît avec la première permission, ou tout de suite quand `platform/auth/authorization/permissions.ts` liste les ensembles de permissions (rebac, custom). Avec `--preset`, le contexte est ensuite écrit en entier depuis ce *preset*, sa classification et son objet étant ceux du *preset* sauf si les options disent autre chose ([Presets](#presets)) |
705
+ | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` avec son glossaire, `published-language/index.ts`, l'entrée de configuration, l'enregistrement dans `platform/composition/compose-application.ts` et dans `test/architecture/extractable.spec.ts` ; sur tsyringe, avec HTTP, `presentation/http/<name>.routes.ts` (une fonction des deux bus, dans les deux styles) ; déclaré : le barrel `<name>.declarations.ts` ; explicite et câblage manuel : `<name>.module.ts`. `<name>.permissions.ts`, à la racine du contexte, naît avec la première permission, ou tout de suite quand `platform/auth/authorization/permissions.ts` liste les ensembles de permissions (rebac, custom). Avec `--preset`, le contexte est ensuite écrit en entier depuis ce *preset*, sa classification et son objet étant ceux du *preset* sauf si les options disent autre chose ([Presets](#presets)) |
706
706
  | `aggregate` | `<context> <Name> [--event-sourced]` | agrégat, *builder*, *spec* sur le modèle étant donné / quand / alors ; avec `--event-sourced`, un agrégat sur `EventSourcedAggregate` dont l'état est le rejeu de ses événements, né avec son événement du domaine `Created`, le codec de ses événements stockés dans `infrastructure/persistence/<name>-events.mapper.ts`, un *builder* qui rejoue un historique et une *spec* à partir d'événements donnés, et une note qui nomme le `EventSourcedRepository` auquel délègue son adaptateur de *repository* |
707
707
  | `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, une classe qui étend `Builder` |
708
708
  | `test-world` | `<context> [Name]` | `test/worlds/<name>.world.ts` (le nom est par défaut celui du contexte) : `a<Name>World({ now, idPrefix, given })`, la mise en place que partagent plusieurs *specs* du contexte. Il lit les *fakes* de `test/fakes/` et le port que chacun implémente, les construit, les passe à `given` pour que la *spec* enregistre ce dont elle part, puis à l'application de test (avec `modules`, l'autorisation de la *spec*) ou, câblé à la main, enveloppe les *repositories* des bus de `createTestBuses` par `dispatching` ; il rend chaque *fake* sous le nom de son port. Un *fake* qui attend des arguments de constructeur, ou, avec un conteneur, celui d'un port que rien ne lie ni n'utilise encore, est laissé de côté avec une note |
@@ -710,7 +710,7 @@ Next, in this order: the language of the context first, then the business decisi
710
710
  | `value-object` (`vo`) | `<context> <Name>` | objet-valeur, *spec* |
711
711
  | `vocabulary` | `<context> <Name> --value <value> [--value <value>]...` | `domain/vocabularies/<name>.vocabulary.ts` : un objet `as const` des valeurs, indexé par chaque valeur en PascalCase, et le type union du même nom ; relancé, ajoute les valeurs que le fichier ne contient pas |
712
712
  | `domain-event` | `<context> <Aggregate> <Fact>` | événement nommé `<context>.<aggregate>.<fact>`, *spec* |
713
- | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | sous `"stack.refusals": "named"` : la classe `<Refusal>` dans `domain/errors/<refusal>.error.ts`, qui étend `DomainRefusal` et lit son code dans la liste, son entrée dans `domain/errors/codes.ts` (la liste `<Context>Codes` et son type `<Context>Code`, créés s'ils manquent ; l'entrée est ajoutée à la fin), la fabrique statique `<factory>` et son cas dans `test/unit/<refusal>.error.spec.ts`. Chacun est écrit s'il manque : relancée, la commande ne change rien ; avec une autre fabrique, elle l'ajoute à la classe. `<Refusal>` est en PascalCase (un `Error` final est retiré), nommé avec des termes du glossaire et les qualificatifs d'un refus, `invalid`, `unknown`, `already`, `too`, `no`, `missing` et `required` (`BookingTooLate`) : un mot que le glossaire ne définit pas est refusé, avec le `--term` qui l'ajoute ; `<factory>` commence par `for`, `with`, `because`, `on` ou `at` (`forAccountId`), sinon la commande refuse et propose `for<Factory>`. Le code est le refus en casse de constante (`InsufficientFunds` pose `INSUFFICIENT_FUNDS`), `--code` en donne un autre ; refusé : un code déjà posé dans le contexte. Sous `factories` et `classes`, `<context> <Concept> <refusal>` : une fabrique statique `<refusal>` sur `domain/errors/<concept>.error.ts`, la classe des erreurs de ce concept (créée si elle manque, qui étend `ConceptError`), et son cas dans `test/unit/<concept>.error.spec.ts`. La fabrique est ajoutée après la dernière ; relancée, la commande ne change rien. `<Concept>` est un terme du glossaire (`--term` l'ajoute). Le code est le nom du refus en casse de constante, précédé du concept quand le nom est un seul mot ou un code du kit (`Appointment notFound` pose `APPOINTMENT_NOT_FOUND`) ; `--code` prend l'une des formes qu'accepte `errors/factory-name`. Refusés : un nom comme `create` ou `error1`, et un code déjà posé dans le contexte |
713
+ | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | sous `"stack.refusals": "named"` : la classe `<Refusal>` dans `domain/errors/<refusal>.error.ts`, qui étend `DomainRefusal` et lit son code dans la liste, son entrée dans `<context>.codes.ts` (la liste `<Context>Codes` et son type `<Context>Code`, créés s'ils manquent ; l'entrée est ajoutée à la fin), la fabrique statique `<factory>` et son cas dans `test/unit/<refusal>.error.spec.ts`. Chacun est écrit s'il manque : relancée, la commande ne change rien ; avec une autre fabrique, elle l'ajoute à la classe. `<Refusal>` est en PascalCase (un `Error` final est retiré), nommé avec des termes du glossaire et les qualificatifs d'un refus, `invalid`, `unknown`, `already`, `too`, `no`, `missing` et `required` (`BookingTooLate`) : un mot que le glossaire ne définit pas est refusé, avec le `--term` qui l'ajoute ; `<factory>` commence par `for`, `with`, `because`, `on` ou `at` (`forAccountId`), sinon la commande refuse et propose `for<Factory>`. Le code est le refus en casse de constante (`InsufficientFunds` pose `INSUFFICIENT_FUNDS`), `--code` en donne un autre ; refusé : un code déjà posé dans le contexte. Sous `factories` et `classes`, `<context> <Concept> <refusal>` : une fabrique statique `<refusal>` sur `domain/errors/<concept>.error.ts`, la classe des erreurs de ce concept (créée si elle manque, qui étend `ConceptError`), et son cas dans `test/unit/<concept>.error.spec.ts`. La fabrique est ajoutée après la dernière ; relancée, la commande ne change rien. `<Concept>` est un terme du glossaire (`--term` l'ajoute). Le code est le nom du refus en casse de constante, précédé du concept quand le nom est un seul mot ou un code du kit (`Appointment notFound` pose `APPOINTMENT_NOT_FOUND`) ; `--code` prend l'une des formes qu'accepte `errors/factory-name`. Refusés : un nom comme `create` ou `error1`, et un code déjà posé dans le contexte |
714
714
  | `domain-error` | `<context> <Name> [--code CODE]` | une classe par erreur avec un code stable, *spec* : la forme d'un projet dont la configuration dit `"stack.refusals": "classes"` ou rien. Refusé sous `named` et `factories`, avec la commande `generate error` à lancer à la place |
715
715
  | `domain-service` | `<context> <Name>` | service, *spec* |
716
716
  | `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]...` | le vocabulaire `<Aggregate>Status` (créé depuis `--value`, deux états au moins, ou complété des valeurs qui lui manquent), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle` : chaque valeur un état, la première initiale, les transitions demandées, un `TODO(domain)` pour le refus de l'erreur du concept) et `test/unit/<aggregate>.state-machine.spec.ts` (chaque transition là où elle mène, un refus depuis un état qu'elle ne quitte pas) ; c'est à l'agrégat de l'utiliser |
@@ -1050,7 +1050,7 @@ définir, ou de renommer la classe dans le plan ; `--apply` le redit pour chaque
1050
1050
  fabrique qui ne commence pas par `for`, `with`, `because`, `on` ou `at` puis une majuscule, une
1051
1051
  classe à qui l'on donne deux codes et une fabrique prévue deux fois. Il :
1052
1052
 
1053
- - écrit `domain/errors/codes.ts` dans chaque contexte, la liste `<Context>Codes` avec une entrée
1053
+ - écrit `<context>.codes.ts` dans chaque contexte, la liste `<Context>Codes` avec une entrée
1054
1054
  par classe, et un fichier par classe de refus, `domain/errors/<refusal>.error.ts`, qui étend
1055
1055
  `DomainRefusal` et lit son code dans la liste, avec ses fabriques : chacune garde les
1056
1056
  paramètres, le message et les faits qu'elle avait ;
@@ -1067,7 +1067,7 @@ classe à qui l'on donne deux codes et une fabrique prévue deux fois. Il :
1067
1067
  Il laisse, et le dit avec sa ligne, ce qui nomme encore une classe de concept disparue : un
1068
1068
  `AppointmentError.is(error)` sans code, qui désignait chaque refus du concept (écrivez les refus
1069
1069
  qu'il désigne, `AppointmentEnded.is(error) || ..`), et `CodeOf<typeof AppointmentError>` (écrivez
1070
- l'union des codes qu'il désigne, ou le type des codes de `codes.ts`). Et toujours : lancer le
1070
+ l'union des codes qu'il désigne, ou le type des codes de `<context>.codes.ts`). Et toujours : lancer le
1071
1071
  formateur et les vérifications, décider quels faits un client peut lire là où aucune fabrique
1072
1072
  n'en expose encore, vérifier les faits dans les *specs*, et supprimer le fichier du plan.
1073
1073
  Relancé, il ne trouve plus rien à déplacer. `--json` répond
@@ -2118,7 +2118,7 @@ règle.
2118
2118
  | `events/name-format` | un nom d'événement qui n'est pas `<context>.<aggregate>.<fact>` en kebab-case avec le bon contexte |
2119
2119
  | `events/name-declared-once` | une classe de `domain/events/` sans `static readonly eventName`, ou dont le `readonly name` écrit le nom une seconde fois au lieu de le lire |
2120
2120
  | `events/defined-in-published-language` | `defineIntegrationEvent` hors d'un langage publié, sans charge utile, deux fois pour une même version ; un événement décrit à la main |
2121
- | `language/glossary-term` | une classe du modèle nommée avec un mot que le glossaire de son contexte ne définit pas ; un glossaire vide ; sous `"stack.refusals": "factories"` ou `"named"`, une classe de `domain/errors/` aussi, une classe de refus de `named` ayant droit en plus aux qualificatifs `invalid`, `unknown`, `already`, `too`, `no`, `missing` et `required` (`codes.ts` n'est pas jugé) |
2121
+ | `language/glossary-term` | une classe du modèle nommée avec un mot que le glossaire de son contexte ne définit pas ; un glossaire vide ; sous `"stack.refusals": "factories"` ou `"named"`, une classe de `domain/errors/` aussi, une classe de refus de `named` ayant droit en plus aux qualificatifs `invalid`, `unknown`, `already`, `too`, `no`, `missing` et `required` (`<context>.codes.ts` n'est pas jugé) |
2122
2122
  | `language/declared-vocabulary` | une chaîne littérale dont la valeur est une valeur d'un vocabulaire fermé que le projet déclare (un objet `as const` exporté avec le type union de son nom, un ensemble de permissions de `definePermissions`), hors du fichier qui le déclare, à l'endroit qui parle son langage (son contexte ; la plateforme et les groupes de routes pour la plateforme ; partout pour un identifiant de permission ou le noyau partagé) ; les tests, les langages publiés et le schéma de relations ne sont pas jugés, ni, hors de `domain/`, un mot typé par un autre langage (une clé d'un `Record<T, ..>`, une valeur d'un `Record<.., T>`, `'x' satisfies T`, `T` un type d'un langage publié, d'un paquet ou de `infrastructure/anti-corruption/` ou `infrastructure/external/`) ; sous `"stack.literals": "named"` |
2123
2123
  | `language/no-technical-name` | `Manager`, `Helper`, `Util`, `Utils`, `Data`, `Info`, `Processor`, `Wrapper`, `Impl`, `Base`, `Abstract`, `Dto`, `Entity`, `Model` dans un type déclaré sous `domain/` ou dans un dossier de cas d'usage |
2124
2124
  | `purity/no-system-clock` | `new Date()` sans argument, `Date.now()`, `performance.now()` dans `domain/` ou `application/` |
@@ -2173,11 +2173,11 @@ règle.
2173
2173
  | `ports/value-import` | une classe nommée dans une liste de dépendances, ou donnée à `bind` ou `rebind`, importée avec `import type` ou `import { type X }` |
2174
2174
  | `scheduling/job-triggers-use-case` | dans `application/scheduling/*.job.ts` : une classe exportée qui n'implémente pas `ScheduledJob` ; un `run` qui n'envoie aucune commande (pas d'appel `.execute(`) ; un *repository* dans la liste de dépendances ou le constructeur ; un import de `domain/aggregates/`, `domain/entities/`, `domain/services/` ou `infrastructure/`. Un enregistrement `builder.job(..)` d'une classe qui vit ailleurs |
2175
2175
  | `scheduling/job-name` | le premier argument de `@Scheduled(..)` ou de `.job(..)` qui n'est pas une chaîne littérale `<context>.<job-name>` en kebab-case minuscule avec le contexte de son fichier ; un `systemActor(..)` d'un fichier de *job* qui passe un autre nom ; un même nom de *job* utilisé deux fois dans le projet |
2176
- | `errors/code-unique` | sous `"stack.refusals": "named"` ou `"factories"`, dans le `domain/errors/` d'un contexte : un code posé une seconde fois, par une valeur de `codes.ts`, une fabrique (`refusal('CODE', ..)`) ou une classe (`readonly code = 'CODE'`), avec le fichier et la ligne du premier. Le même code dans deux contextes n'est pas signalé |
2177
- | `errors/code-listed` | sous `"stack.refusals": "named"`, dans le `domain/errors/` d'un contexte : une classe de refus (qui étend `DomainRefusal`) dont le code n'est pas `readonly code = <Context>Codes.<Class>` lu dans le `codes.ts` de son contexte, des classes de refus sans `codes.ts`, une classe que la liste ne contient pas ; dans `codes.ts`, pas de liste `<Context>Codes` ou une liste non déclarée `as const`, une clé qui ne nomme aucune classe de refus du contexte, une valeur qui n'est pas un littéral de chaîne en casse de constante |
2176
+ | `errors/code-unique` | sous `"stack.refusals": "named"` ou `"factories"`, dans le `domain/errors/` d'un contexte : un code posé une seconde fois, par une valeur de `<context>.codes.ts`, une fabrique (`refusal('CODE', ..)`) ou une classe (`readonly code = 'CODE'`), avec le fichier et la ligne du premier. Le même code dans deux contextes n'est pas signalé |
2177
+ | `errors/code-listed` | sous `"stack.refusals": "named"`, dans le `domain/errors/` d'un contexte : une classe de refus (qui étend `DomainRefusal`) dont le code n'est pas `readonly code = <Context>Codes.<Class>` lu dans le `<context>.codes.ts` de son contexte, des classes de refus sans `<context>.codes.ts`, une classe que la liste ne contient pas ; dans `<context>.codes.ts`, pas de liste `<Context>Codes` ou une liste non déclarée `as const`, une clé qui ne nomme aucune classe de refus du contexte, une valeur qui n'est pas un littéral de chaîne en casse de constante |
2178
2178
  | `schema/presentation-only` | sous `"stack.schemas": "shared"` : dans le noyau partagé hors de `presentation/`, un import d'une bibliothèque de validation ; dans `domain/`, `application/`, `infrastructure/`, `published-language/` et le noyau partagé hors de `presentation/`, un import d'un fichier de `presentation/` du noyau partagé |
2179
2179
  | `schema/no-duplicate-shape` | sous `"stack.schemas": "shared"`, dans la couche présentation d'un contexte, ou dans celle-ci et `presentation/` du noyau partagé : une classe DTO ou un schéma objet (`z.object`, `v.object`, `Type.Object`) qui déclare la forme d'un autre, avec l'endroit de l'original (le noyau partagé, puis `presentation/http/shared/`) ; deux contextes ne sont pas comparés, et les paramètres de requête HTTP et les formes qui portent encore un `TODO(domain)` du générateur ne sont pas jugés |
2180
- | `errors/known-code` | sous `"stack.refusals": "named"` ou `"factories"`, dans un `*.route.ts` : un code de la liste `errors` que le `codes.ts` du contexte de la route ne liste pas, qu'aucun refus de ce contexte ne pose, qu'aucune classe hors des contextes ne pose, et qui n'est pas un code du kit |
2180
+ | `errors/known-code` | sous `"stack.refusals": "named"` ou `"factories"`, dans un `*.route.ts` : un code de la liste `errors` que le `<context>.codes.ts` du contexte de la route ne liste pas, qu'aucun refus de ce contexte ne pose, qu'aucune classe hors des contextes ne pose, et qui n'est pas un code du kit |
2181
2181
  | `domain/value-object-class` | sous `"stack.values": "classes"` : dans `domain/value-objects/` d'un contexte ou un `*.vo.ts` du noyau partagé hors de `presentation/`, aucune classe exportée ou une seconde, une classe qui n'étend ni `ValueObject` ni un autre objet-valeur du projet, un constructeur public, une classe concrète sans méthode statique, une fonction, une constante fléchée ou un objet littéral exporté (en ligne, par une liste ou par défaut) ; dans `domain/` et dans le noyau partagé hors de `presentation/`, une fonction exportée qui répond un enregistrement de données : des entrées de données, aucune décomposition, rien qu'un appel du modèle a construit |
2182
2182
 
2183
2183
  D'autres identifiants appartiennent à `@ddd-ts-kit/eslint-plugin`, qui lit l'arbre syntaxique là
package/README.md CHANGED
@@ -165,7 +165,7 @@ declare class Invoice extends AggregateRoot {
165
165
  // domain/repositories/invoice.repository.ts
166
166
  export abstract class InvoiceRepository extends Repository<Invoice> {}
167
167
 
168
- // application/authorization/billing.permissions.ts
168
+ // billing.permissions.ts
169
169
  export const billingPermissions = definePermissions('billing', {
170
170
  'invoice.issue': { description: 'Issue invoice' },
171
171
  });
@@ -349,7 +349,7 @@ and the one line of the composition root that adds the whole context:
349
349
  **A refusal is a class of its own.** `init` writes `"stack.refusals": "named"`: each refusal of
350
350
  a context is a class named after what is refused, extending `DomainRefusal` of the kernel, built
351
351
  by static factories named after what the refusal is about, and its code is read from the closed
352
- list of the codes of the context, `domain/errors/codes.ts`.
352
+ list of the codes of the context, `<context>.codes.ts`.
353
353
  `generate error <context> <Refusal> <factory>` writes the class, its code and the factory. The
354
354
  `errors/*` rules hold that form. Two earlier forms keep working: `--refusals factories`, one error class per concept extending
355
355
  `ConceptError`, each refusal a static factory of it, as `init` wrote it before; and
@@ -362,7 +362,7 @@ The form `init` writes, which `generate error scheduling SlotTaken forCalendar`
362
362
  ```ts
363
363
  import { DomainRefusal } from '@ddd-ts-kit/kernel';
364
364
 
365
- // domain/errors/codes.ts: the closed list of the codes of the context
365
+ // scheduling.codes.ts: the closed list of the codes of the context
366
366
  export const SchedulingCodes = {
367
367
  SlotTaken: 'SLOT_TAKEN',
368
368
  } as const;
@@ -664,7 +664,7 @@ would create src/contexts/notification/application/commands/archive-notification
664
664
  would create src/contexts/notification/application/commands/archive-notification/archive-notification.handler.ts
665
665
  would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
666
666
  would update src/contexts/notification/CONTEXT.md
667
- would update src/contexts/notification/application/authorization/notification.permissions.ts
667
+ would update src/contexts/notification/notification.permissions.ts
668
668
  would update src/contexts/notification/application/application.declarations.ts
669
669
 
670
670
  Next, in this order: the language of the context first, then the business decisions only you can make
@@ -675,7 +675,7 @@ Next, in this order: the language of the context first, then the business decisi
675
675
 
676
676
  | Kind | Arguments | Writes |
677
677
  |---|---|---|
678
- | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/composition/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `application/authorization/<name>.permissions.ts` is born with the first permission, or at once when `platform/auth/authorization/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
678
+ | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/composition/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `<name>.permissions.ts`, at the root of the context, is born with the first permission, or at once when `platform/auth/authorization/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
679
679
  | `aggregate` | `<context> <Name> [--event-sourced]` | aggregate, builder, spec in given / when / then; with `--event-sourced`, an aggregate on `EventSourcedAggregate` whose state is the replay of its events, born with its `Created` domain event, the codec of its stored events in `infrastructure/persistence/<name>-events.mapper.ts`, a builder that replays a history and a spec given events, and a note naming the `EventSourcedRepository` its repository adapter delegates to |
680
680
  | `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, a class extending `Builder` |
681
681
  | `test-world` | `<context> [Name]` | `test/worlds/<name>.world.ts` (the name defaults to the context): `a<Name>World({ now, idPrefix, given })`, the arrangement several specs of the context share. It reads the fakes of `test/fakes/` and the port each one implements, builds them, hands them to `given` so that the spec stores what it starts from, then to the test application (with `modules`, the authorization of the spec) or, wired by hand, wraps the repositories of the buses of `createTestBuses` with `dispatching`; it returns every fake under the name of its port. A fake that needs constructor arguments, or, under a container, stands for a port nothing binds or depends on yet, is left out with a note |
@@ -683,7 +683,7 @@ Next, in this order: the language of the context first, then the business decisi
683
683
  | `value-object` (`vo`) | `<context> <Name>` | value object, spec |
684
684
  | `vocabulary` | `<context> <Name> --value <value> [--value <value>]...` | `domain/vocabularies/<name>.vocabulary.ts`: an object `as const` of the values, keyed by each value in PascalCase, and the union type of the same name; run again, adds the values the file does not hold |
685
685
  | `domain-event` | `<context> <Aggregate> <Fact>` | event named `<context>.<aggregate>.<fact>`, spec |
686
- | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in `domain/errors/codes.ts` (the list `<Context>Codes` and its type `<Context>Code`, created when absent; the entry is added at the end), the static factory `<factory>` and its case in `test/unit/<refusal>.error.spec.ts`. Each is written when absent: run again, the command changes nothing; given another factory, it adds it to the class. `<Refusal>` is in PascalCase (a trailing `Error` is dropped), named with terms of the glossary and the qualifiers of a refusal, `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` (`BookingTooLate`): a word the glossary does not define is refused, with the `--term` that adds it; `<factory>` starts with `for`, `with`, `because`, `on` or `at` (`forAccountId`), else the command refuses and proposes `for<Factory>`. The code is the refusal in constant case (`InsufficientFunds` sets `INSUFFICIENT_FUNDS`), `--code` gives another; refused: a code already set in the context. Under `factories` and `classes`, `<context> <Concept> <refusal>`: a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
686
+ | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in `<context>.codes.ts` (the list `<Context>Codes` and its type `<Context>Code`, created when absent; the entry is added at the end), the static factory `<factory>` and its case in `test/unit/<refusal>.error.spec.ts`. Each is written when absent: run again, the command changes nothing; given another factory, it adds it to the class. `<Refusal>` is in PascalCase (a trailing `Error` is dropped), named with terms of the glossary and the qualifiers of a refusal, `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` (`BookingTooLate`): a word the glossary does not define is refused, with the `--term` that adds it; `<factory>` starts with `for`, `with`, `because`, `on` or `at` (`forAccountId`), else the command refuses and proposes `for<Factory>`. The code is the refusal in constant case (`InsufficientFunds` sets `INSUFFICIENT_FUNDS`), `--code` gives another; refused: a code already set in the context. Under `factories` and `classes`, `<context> <Concept> <refusal>`: a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
687
687
  | `domain-error` | `<context> <Name> [--code CODE]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `named` and `factories`, with the `generate error` command to run instead |
688
688
  | `domain-service` | `<context> <Name>` | service, spec |
689
689
  | `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]...` | the vocabulary `<Aggregate>Status` (created from `--value`, two states at least, or given the values it misses), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle`: every value a state, the first one initial, the transitions asked, a `TODO(domain)` for the refusal of the concept error) and `test/unit/<aggregate>.state-machine.spec.ts` (each transition where it leads, a refusal from a state it does not leave); the aggregate is left to use it |
@@ -997,7 +997,7 @@ for each class it writes.
997
997
  a factory that does not start with `for`, `with`, `because`, `on` or `at` then an upper-case
998
998
  letter, a class given two codes and a factory planned twice. It:
999
999
 
1000
- - writes `domain/errors/codes.ts` in each context, the list `<Context>Codes` with one entry per
1000
+ - writes `<context>.codes.ts` in each context, the list `<Context>Codes` with one entry per
1001
1001
  class, and one file per refusal class, `domain/errors/<refusal>.error.ts`, extending
1002
1002
  `DomainRefusal` and reading its code from the list, with its factories: each keeps the
1003
1003
  parameters, the message and the facts it had;
@@ -1014,7 +1014,7 @@ letter, a class given two codes and a factory planned twice. It:
1014
1014
  It leaves, and says with its line, what still names a concept class that is gone: a bare
1015
1015
  `AppointmentError.is(error)`, which meant every refusal of the concept (write the refusals it
1016
1016
  means, `AppointmentEnded.is(error) || ..`), and `CodeOf<typeof AppointmentError>` (write the
1017
- union of the codes it means, or the code type of `codes.ts`). And always: run the formatter and
1017
+ union of the codes it means, or the code type of `<context>.codes.ts`). And always: run the formatter and
1018
1018
  the checks, decide which facts a client may read where no factory exposes any yet, assert the
1019
1019
  facts in the specs, and delete the plan file. Run again, it finds nothing left to move. `--json`
1020
1020
  answers `{ dryRun, moved, written, removed, manual }`.
@@ -1993,7 +1993,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1993
1993
  | `events/name-format` | an event name that is not `<context>.<aggregate>.<fact>` in kebab-case with the right context |
1994
1994
  | `events/name-declared-once` | a class of `domain/events/` without `static readonly eventName`, or whose `readonly name` writes the name again instead of reading it |
1995
1995
  | `events/defined-in-published-language` | `defineIntegrationEvent` outside a published language, without a payload, twice for one version; an event described by hand |
1996
- | `language/glossary-term` | a class of the model named with a word the glossary of its context does not define; an empty glossary; under `"stack.refusals": "factories"` or `"named"`, a class of `domain/errors/` too, a refusal class of `named` allowed the qualifiers `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` besides (`codes.ts` is not judged) |
1996
+ | `language/glossary-term` | a class of the model named with a word the glossary of its context does not define; an empty glossary; under `"stack.refusals": "factories"` or `"named"`, a class of `domain/errors/` too, a refusal class of `named` allowed the qualifiers `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` besides (`<context>.codes.ts` is not judged) |
1997
1997
  | `language/declared-vocabulary` | a string literal whose value is a value of a closed vocabulary the project declares (an object `as const` exported with the union type of its name, a permission set of `definePermissions`), outside the file that declares it, in the place that speaks its language (its context; the platform and the route groups for the platform; everywhere for a permission id or the shared kernel); tests, published languages and the relationship schema are not judged, nor, outside `domain/`, a word typed by another language (a key of a `Record<T, ..>`, a value of a `Record<.., T>`, `'x' satisfies T`, `T` a type of a published language, of a package or of `infrastructure/anti-corruption/` or `infrastructure/external/`); under `"stack.literals": "named"` |
1998
1998
  | `language/no-technical-name` | `Manager`, `Helper`, `Util`, `Utils`, `Data`, `Info`, `Processor`, `Wrapper`, `Impl`, `Base`, `Abstract`, `Dto`, `Entity`, `Model` in a type declared under `domain/` or in a use case folder |
1999
1999
  | `purity/no-system-clock` | `new Date()` without argument, `Date.now()`, `performance.now()` in `domain/` or `application/` |
@@ -2048,11 +2048,11 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
2048
2048
  | `ports/value-import` | a class named in a dependency list, or given to `bind` or `rebind`, imported with `import type` or `import { type X }` |
2049
2049
  | `scheduling/job-triggers-use-case` | in `application/scheduling/*.job.ts`: an exported class that does not implement `ScheduledJob`; a `run` that sends no command (no `.execute(` call); a repository in the dependency list or the constructor; an import from `domain/aggregates/`, `domain/entities/`, `domain/services/` or `infrastructure/`. A `builder.job(..)` registration of a class that lives elsewhere |
2050
2050
  | `scheduling/job-name` | the first argument of `@Scheduled(..)` or `.job(..)` that is not a string literal `<context>.<job-name>` in lower-case kebab-case with the context of its file; a `systemActor(..)` of a job file passing another name; one job name used twice in the project |
2051
- | `errors/code-unique` | under `"stack.refusals": "named"` or `"factories"`, in the `domain/errors/` of a context: a code set a second time, by a value of `codes.ts`, a factory (`refusal('CODE', ..)`) or a class (`readonly code = 'CODE'`), with the file and line of the first. The same code in two contexts is not reported |
2052
- | `errors/code-listed` | under `"stack.refusals": "named"`, in the `domain/errors/` of a context: a refusal class (extending `DomainRefusal`) whose code is not `readonly code = <Context>Codes.<Class>` from the `codes.ts` of its context, refusal classes and no `codes.ts`, a class the list does not hold; in `codes.ts`, no list `<Context>Codes` or one not declared `as const`, a key that names no refusal class of the context, a value that is not a string literal in constant case |
2051
+ | `errors/code-unique` | under `"stack.refusals": "named"` or `"factories"`, in the `domain/errors/` of a context: a code set a second time, by a value of `<context>.codes.ts`, a factory (`refusal('CODE', ..)`) or a class (`readonly code = 'CODE'`), with the file and line of the first. The same code in two contexts is not reported |
2052
+ | `errors/code-listed` | under `"stack.refusals": "named"`, in the `domain/errors/` of a context: a refusal class (extending `DomainRefusal`) whose code is not `readonly code = <Context>Codes.<Class>` from the `<context>.codes.ts` of its context, refusal classes and no `<context>.codes.ts`, a class the list does not hold; in `<context>.codes.ts`, no list `<Context>Codes` or one not declared `as const`, a key that names no refusal class of the context, a value that is not a string literal in constant case |
2053
2053
  | `schema/presentation-only` | under `"stack.schemas": "shared"`: in the shared kernel outside `presentation/`, an import of a validation library; in `domain/`, `application/`, `infrastructure/`, `published-language/` and the shared kernel outside `presentation/`, an import of a file of `presentation/` of the shared kernel |
2054
2054
  | `schema/no-duplicate-shape` | under `"stack.schemas": "shared"`, in the presentation layer of one context, or in it and `presentation/` of the shared kernel: a DTO class or an object schema (`z.object`, `v.object`, `Type.Object`) declaring the shape of another one, with the place of the original (the shared kernel, then `presentation/http/shared/`); two contexts are not compared, and request parameters and shapes still carrying a `TODO(domain)` of the generator are not judged |
2055
- | `errors/known-code` | under `"stack.refusals": "named"` or `"factories"`, in a `*.route.ts`: a code of the `errors` list that the `codes.ts` of the context of the route does not list, that no refusal of that context sets, that no class outside the contexts sets, and that is not a code of the kit |
2055
+ | `errors/known-code` | under `"stack.refusals": "named"` or `"factories"`, in a `*.route.ts`: a code of the `errors` list that the `<context>.codes.ts` of the context of the route does not list, that no refusal of that context sets, that no class outside the contexts sets, and that is not a code of the kit |
2056
2056
  | `domain/value-object-class` | under `"stack.values": "classes"`: in `domain/value-objects/` of a context or a `*.vo.ts` of the shared kernel outside `presentation/`, no exported class or a second one, a class that extends neither `ValueObject` nor another value object of the project, a public constructor, a concrete class without a static method, an exported function, arrow constant or object literal (inline, listed or by default); in `domain/` and in the shared kernel outside `presentation/`, an exported function that answers a record of data: data entries, no spread, nothing a call of the model built |
2057
2057
 
2058
2058
  More ids belong to `@ddd-ts-kit/eslint-plugin`, which reads the syntax tree where this
@@ -0,0 +1,15 @@
1
+ import type { Config } from '../../config/index.js';
2
+ import type { Flaw } from '../model/flaw.js';
3
+ /** A file of a context still where 0.86 and 0.87 wrote it: a warning while it is the only one, an error next to the one at the root. */
4
+ export interface EarlierContextFile {
5
+ readonly flaw: Flaw;
6
+ readonly severity: 'warn' | 'error';
7
+ }
8
+ /**
9
+ * What `tree/closed` says of a file of a context that 0.86 and 0.87 wrote in a role folder, the code list
10
+ * (`domain/errors/codes.ts`) or the permission set (`application/authorization/<context>.permissions.ts`),
11
+ * now at the root of the context; undefined for any other entry. `entries` are every entry of the
12
+ * contexts, to tell whether the root holds the file already.
13
+ */
14
+ export declare function earlierContextFile(entry: string, config: Config, entries: ReadonlySet<string>): EarlierContextFile | undefined;
15
+ //# sourceMappingURL=earlier-context-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-context-file.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/earlier-context-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,wIAAwI;AACxI,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,kBAAkB,GAAG,SAAS,CA4BhC"}
@@ -0,0 +1,33 @@
1
+ import { CONTEXT_FILES } from '../../context-files/index.js';
2
+ /**
3
+ * What `tree/closed` says of a file of a context that 0.86 and 0.87 wrote in a role folder, the code list
4
+ * (`domain/errors/codes.ts`) or the permission set (`application/authorization/<context>.permissions.ts`),
5
+ * now at the root of the context; undefined for any other entry. `entries` are every entry of the
6
+ * contexts, to tell whether the root holds the file already.
7
+ */
8
+ export function earlierContextFile(entry, config, entries) {
9
+ const [context = '', ...rest] = entry.slice(config.contextsDir.length + 1).split('/');
10
+ const relative = rest.join('/');
11
+ const file = CONTEXT_FILES.find((candidate) => candidate.earlier(context) === relative);
12
+ if (file === undefined || !entry.startsWith(`${config.contextsDir}/`)) {
13
+ return undefined;
14
+ }
15
+ const root = file.root(context);
16
+ if (entries.has(`${config.contextsDir}/${context}/${root}`)) {
17
+ return {
18
+ severity: 'error',
19
+ flaw: {
20
+ message: `"${context}" holds ${relative} next to ${root}: one context has one of each.`,
21
+ fix: `Keep ${root}, move into it what ${relative} holds that it lacks, and delete ${relative}.`,
22
+ },
23
+ };
24
+ }
25
+ return {
26
+ severity: 'warn',
27
+ flaw: {
28
+ message: `${relative} of "${context}" is where 0.86 and 0.87 kept it: it lives at the root of the context now, ${root}. This version reads it where it is, and a later minor version reports it as an error.`,
29
+ fix: 'Run `npx ddd-ts-kit context-layout`, which moves it to the root of its context and rewrites every import of it, then commit the result.',
30
+ },
31
+ };
32
+ }
33
+ //# sourceMappingURL=earlier-context-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-context-file.js","sourceRoot":"","sources":["../../../src/check/canonical/earlier-context-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,MAAc,EACd,OAA4B;IAE5B,MAAM,CAAC,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,C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ceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgB1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAS1E"}
@@ -1,6 +1,7 @@
1
1
  import path from 'node:path';
2
+ import { CONTEXT_FILES } from '../../context-files/index.js';
2
3
  import { barrelFile, dependenciesFile, isDeclarationsFile } from '../../declared/index.js';
3
- import { declaredModules, MODULE_LAYERS, moduleSplit, WITHOUT_MODULE } from '../../model-modules/index.js';
4
+ import { declaredModules, moduleSplit, WITHOUT_MODULE } from '../../model-modules/index.js';
4
5
  import { isCanonicalDirectory } from './is-canonical-directory.js';
5
6
  import { OPEN_DIRECTORIES } from './open-directories.js';
6
7
  import { roleOf } from './role-of.js';
@@ -10,7 +11,8 @@ import { roleOf } from './role-of.js';
10
11
  */
11
12
  export function strayEntry(entry, config) {
12
13
  const placed = place(entry, config);
13
- if (placed === undefined) {
14
+ // The folder of a declared module holds its layers: it is canonical as the context itself is.
15
+ if (placed === undefined || (placed.module !== undefined && placed.inside === '')) {
14
16
  return undefined;
15
17
  }
16
18
  return entry.endsWith('/') ? strayDirectory(placed) : straySource(placed);
@@ -37,12 +39,11 @@ function strayDirectory({ context, inside, module, extras }) {
37
39
  if (isCanonicalDirectory(inside) || coveredByExtra(extras, inside)) {
38
40
  return undefined;
39
41
  }
40
- const [layer = '', folder, ...below] = inside.split('/');
41
- // A folder directly under the layer may be a module the config does not declare yet; one inside a module is not.
42
- if (folder !== undefined && below.length === 0 && MODULE_LAYERS.includes(layer) && module === undefined) {
42
+ // A folder at the root of the context may be a module the config does not declare yet; one inside a module is not.
43
+ if (!inside.includes('/') && module === undefined) {
43
44
  return {
44
45
  message: `"${inside}" is not a directory of the canonical tree.`,
45
- fix: `If ${folder} is a part of the model of ${context}, declare it as a module with \`ddd-ts-kit generate module ${context} ${folder}\`; otherwise move its files to the canonical directory of their role (see \`ddd-ts-kit explain tree/closed\`).`,
46
+ fix: `If ${inside} is a part of the model of ${context}, declare it as a module with \`ddd-ts-kit generate module ${context} ${inside}\`, which gives it its layers (${inside}/domain/, ${inside}/application/...); otherwise move its files to the canonical directory of their role (see \`ddd-ts-kit explain tree/closed\`).`,
46
47
  };
47
48
  }
48
49
  return {
@@ -71,12 +72,13 @@ function straySource(placed) {
71
72
  }
72
73
  function atContextRoot({ context, declared, inside: file }) {
73
74
  const generated = [barrelFile(context), dependenciesFile(context)];
74
- if (file === `${context}.module.ts` || (declared && generated.includes(file))) {
75
+ const ofTheContext = CONTEXT_FILES.map((candidate) => candidate.root(context));
76
+ if (file === `${context}.module.ts` || ofTheContext.includes(file) || (declared && generated.includes(file))) {
75
77
  return undefined;
76
78
  }
77
79
  const allowed = declared
78
- ? `CONTEXT.md, the generated ${generated.join(' or ')} and ${context}.module.ts`
79
- : `CONTEXT.md and ${context}.module.ts`;
80
+ ? `CONTEXT.md, ${ofTheContext.join(', ')}, the generated ${generated.join(' or ')} and ${context}.module.ts`
81
+ : `CONTEXT.md, ${ofTheContext.join(', ')} and ${context}.module.ts`;
80
82
  return {
81
83
  message: `"${file}" sits at the root of the context.`,
82
84
  fix: `Move it into the directory of its role; only ${allowed} live at the root of a context.`,
@@ -1 +1 @@
1
- {"version":3,"file":"stray-entry.js","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA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E,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAU;IAChE,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE/E,IAAI,IAAI,KAAK,GAAG,OAAO,YAAY,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC7G,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,QAAQ;QACtB,CAAC,CAAC,eAAe,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,OAAO,YAAY;QAC5G,CAAC,CAAC,eAAe,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,OAAO,YAAY,CAAC;IAEtE,OAAO;QACL,OAAO,EAAE,IAAI,IAAI,oCAAoC;QACrD,GAAG,EAAE,gDAAgD,OAAO,iCAAiC;KAC9F,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB,EAAE,SAAiB;IAClE,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CACzG,CAAC;AACJ,CAAC"}
@@ -37,14 +37,14 @@ function namingProblems(context, modules) {
37
37
  problems.push({
38
38
  needle: name,
39
39
  message: `The module "${name}" of "${context}" is not written in kebab-case.`,
40
- fix: `Name it as its folder is named, in kebab-case: domain/<module>/ and application/<module>/.`,
40
+ fix: `Name it as its folder is named, in kebab-case: <module>/, holding <module>/domain/, <module>/application/...`,
41
41
  });
42
42
  }
43
43
  else if (reason === 'role-folder') {
44
44
  problems.push({
45
45
  needle: name,
46
46
  message: `The module "${name}" of "${context}" has the name of a role folder.`,
47
- fix: 'A module is a part of the model, named in its language; domain/ and application/ keep their role folders under that name.',
47
+ fix: 'A module is a part of the model, named in its language; its layers keep their role folders under it (<module>/domain/aggregates/).',
48
48
  });
49
49
  }
50
50
  if (classification !== undefined && !isOneOf(CLASSIFICATIONS, classification)) {
@@ -1 +1 @@
1
- {"version":3,"file":"module-problems.js","sourceRoot":"","sources":["../../../src/check/configuration/module-problems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAShD,MAAM,KAAK,GACT,+IAA+I,CAAC;AAElJ;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,EAAE,OAAO,EAAiB,EAAE,OAAgB;IAC1F,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO;YACL;gBACE,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,YAAY,OAAO,4CAA4C,OAAO,YAAY;gBAC3F,GAAG,EAAE,KAAK;aACX;SACF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,E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C,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE;QAClD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAC5C,MAAM,QAAQ,GAAoB,EAAE,CAAC;QAErC,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,iCAAiC;gBAC7E,GAAG,EAAE,8GAA8G;aACpH,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;YACpC,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,kCAAkC;gBAC9E,GAAG,EAAE,oIAAoI;aAC1I,CAAC,CAAC;QACL,CAAC;QAED,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,cAAc,CAAC,EAAE,CAAC;YAC9E,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,6BAA6B,cAAc,IAAI;gBAC3F,GAAG,EAAE,gBAAgB,OAAO,YAAY,IAAI,8BAA8B,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,iEAAiE;aACtK,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { CodeEntry } from './code-entry.js';
2
- /** The closed list of the codes of a context, `export const <Context>Codes = { .. } as const` in `domain/errors/codes.ts`. */
2
+ /** The closed list of the codes of a context, `export const <Context>Codes = { .. } as const` in `<context>.codes.ts`. */
3
3
  export interface CodeList {
4
4
  readonly name: string;
5
5
  readonly line: number;
@@ -1 +1 @@
1
- {"version":3,"file":"code-list.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,8HAA8H;AAC9H,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC"}
1
+ {"version":3,"file":"code-list.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,0HAA0H;AAC1H,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC"}
@@ -1,4 +1,4 @@
1
1
  import type { SourceFile } from '../model/source-file.js';
2
- /** True for the `domain/errors/codes.ts` of a context, the closed list of its codes. */
2
+ /** True for the code list of a context, `<context>.codes.ts` at its root (read as `domain/errors/codes.ts`, where 0.86 and 0.87 kept it). */
3
3
  export declare function isCodesFile(file: SourceFile): boolean;
4
4
  //# sourceMappingURL=is-codes-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-codes-file.d.ts","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWrD"}
1
+ {"version":3,"file":"is-codes-file.d.ts","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,6IAA6I;AAC7I,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWrD"}
@@ -1,4 +1,4 @@
1
- /** True for the `domain/errors/codes.ts` of a context, the closed list of its codes. */
1
+ /** True for the code list of a context, `<context>.codes.ts` at its root (read as `domain/errors/codes.ts`, where 0.86 and 0.87 kept it). */
2
2
  export function isCodesFile(file) {
3
3
  const { location } = file;
4
4
  return (!file.isTest &&
@@ -1 +1 @@
1
- {"version":3,"file":"is-codes-file.js","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,MAAM;QACZ,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,QAAQ,CAAC,KAAK,KAAK,QAAQ;QAC3B,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC/B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAClC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"is-codes-file.js","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAEA,6IAA6I;AAC7I,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,MAAM;QACZ,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,QAAQ,CAAC,KAAK,KAAK,QAAQ;QAC3B,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC/B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAClC,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export const ERRORS_DOCS = {
2
2
  'errors/code-unique': {
3
- why: 'The code is the identity of a refusal for everything outside the domain: the HTTP mapper gives it a status, the OpenAPI document lists it, the audit trail and the span record it as the reason, a client branches on it and a test asserts it. Nothing downstream knows the class or the factory. Two refusals of one context under one code are therefore one refusal for every reader, whatever their messages say. The code is checked per context, since each context owns its language: the same code in two contexts is allowed, and the error mapper of the application gives it one status. Every form is read: the first argument of `refusal(..)` in a factory of a concept class, the `readonly code` field of a class per error, and under "stack.refusals": "named" the values of domain/errors/codes.ts, the code list of the context, where two keys under one value are reported. Judged under "stack.refusals": "factories" and "named": a project whose config does not say was written when an error was a class, and keeps working untouched.',
3
+ why: 'The code is the identity of a refusal for everything outside the domain: the HTTP mapper gives it a status, the OpenAPI document lists it, the audit trail and the span record it as the reason, a client branches on it and a test asserts it. Nothing downstream knows the class or the factory. Two refusals of one context under one code are therefore one refusal for every reader, whatever their messages say. The code is checked per context, since each context owns its language: the same code in two contexts is allowed, and the error mapper of the application gives it one status. Every form is read: the first argument of `refusal(..)` in a factory of a concept class, the `readonly code` field of a class per error, and under "stack.refusals": "named" the values of <context>.codes.ts, the code list of the context, where two keys under one value are reported. Judged under "stack.refusals": "factories" and "named": a project whose config does not say was written when an error was a class, and keeps working untouched.',
4
4
  bad: `export class AppointmentError extends ConceptError {
5
5
  static slotTaken(calendarId: string) {
6
6
  return AppointmentError.refusal('BOOKING_REFUSED', 'The slot is already held.', { calendarId });
@@ -21,8 +21,8 @@ export const ERRORS_DOCS = {
21
21
  }`,
22
22
  },
23
23
  'errors/code-listed': {
24
- why: 'Under "stack.refusals": "named" a refusal is a class of its own, `SlotTaken`, and its code is what everything outside the domain knows it by: the error mapper gives it a status, the OpenAPI document and the client list it, a test asserts it. The codes of a context are therefore one closed list, domain/errors/codes.ts, `export const SchedulingCodes = { SlotTaken: \'SLOT_TAKEN\' } as const`, and each class reads its code from it under its own name, `readonly code = SchedulingCodes.SlotTaken`: the list is the contract of the context in one file, two refusals cannot drift to one code unseen, and the type of each code stays its own literal. Reported: a refusal class (a class of domain/errors/ that extends DomainRefusal, abstract ones aside) without a code, with a code written another way (a string literal, another entry, the list of another context), a context with refusal classes and no codes.ts, a class whose name the list does not hold; in codes.ts, a list missing or not `as const`, a key that names no refusal class of the context (a code nothing raises), and a value that is not a string literal in constant case. The value is usually the name of the class in constant case, but need not be: a migrated project keeps its codes, since the code is the contract. Judged under "stack.refusals": "named" only.',
25
- bad: `// domain/errors/codes.ts
24
+ why: 'Under "stack.refusals": "named" a refusal is a class of its own, `SlotTaken`, and its code is what everything outside the domain knows it by: the error mapper gives it a status, the OpenAPI document and the client list it, a test asserts it. The codes of a context are therefore one closed list, <context>.codes.ts, `export const SchedulingCodes = { SlotTaken: \'SLOT_TAKEN\' } as const`, and each class reads its code from it under its own name, `readonly code = SchedulingCodes.SlotTaken`: the list is the contract of the context in one file, two refusals cannot drift to one code unseen, and the type of each code stays its own literal. Reported: a refusal class (a class of domain/errors/ that extends DomainRefusal, abstract ones aside) without a code, with a code written another way (a string literal, another entry, the list of another context), a context with refusal classes and no codes.ts, a class whose name the list does not hold; in codes.ts, a list missing or not `as const`, a key that names no refusal class of the context (a code nothing raises), and a value that is not a string literal in constant case. The value is usually the name of the class in constant case, but need not be: a migrated project keeps its codes, since the code is the contract. Judged under "stack.refusals": "named" only.',
25
+ bad: `// scheduling.codes.ts
26
26
  export const SchedulingCodes = {
27
27
  SlotTaken: 'SLOT_TAKEN',
28
28
  SlotHeld: 'SLOT_HELD',
@@ -32,7 +32,7 @@ export const SchedulingCodes = {
32
32
  export class SlotTaken extends DomainRefusal {
33
33
  readonly code = 'SLOT_TAKEN';
34
34
  }`,
35
- good: `// domain/errors/codes.ts
35
+ good: `// scheduling.codes.ts
36
36
  export const SchedulingCodes = {
37
37
  SlotTaken: 'SLOT_TAKEN',
38
38
  } as const;
@@ -49,7 +49,7 @@ export class SlotTaken extends DomainRefusal {
49
49
  }`,
50
50
  },
51
51
  'errors/known-code': {
52
- why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when the domain/errors/codes.ts of that context lists it (under "stack.refusals": "named"), when a class outside the contexts (the platform, the shared kernel) does, or when it is a code of the kit: VALIDATION_FAILED, NOT_FOUND, CONFLICT, INVARIANT_VIOLATION, UNAUTHORIZED, FORBIDDEN, NOT_ACCEPTABLE, CONCURRENCY_CONFLICT, INVALID_CRITERIA, INVALID_PAGE_REQUEST, TIMEOUT, CIRCUIT_OPEN, BULKHEAD_FULL, ATTEMPTS_EXHAUSTED, the conditions of a write: PRECONDITION_FAILED, PRECONDITION_REQUIRED, and the refusals of a file: FILE_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, FILE_NOT_FOUND, FILE_REJECTED, INVALID_FILE_KEY. A code another context sets does not count: a context answers with its own language. Judged under "stack.refusals": "factories" and "named".',
52
+ why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when the <context>.codes.ts of that context lists it (under "stack.refusals": "named"), when a class outside the contexts (the platform, the shared kernel) does, or when it is a code of the kit: VALIDATION_FAILED, NOT_FOUND, CONFLICT, INVARIANT_VIOLATION, UNAUTHORIZED, FORBIDDEN, NOT_ACCEPTABLE, CONCURRENCY_CONFLICT, INVALID_CRITERIA, INVALID_PAGE_REQUEST, TIMEOUT, CIRCUIT_OPEN, BULKHEAD_FULL, ATTEMPTS_EXHAUSTED, the conditions of a write: PRECONDITION_FAILED, PRECONDITION_REQUIRED, and the refusals of a file: FILE_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, FILE_NOT_FOUND, FILE_REJECTED, INVALID_FILE_KEY. A code another context sets does not count: a context answers with its own language. Judged under "stack.refusals": "factories" and "named".',
53
53
  bad: `// domain/errors/appointment.error.ts sets 'SLOT_TAKEN'
54
54
  defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_ALREADY_TAKEN'], security: ['bearer'] }, book);`,
55
55
  good: `defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_TAKEN'], security: ['bearer'] }, book);`,
@@ -1 +1 @@
1
- {"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,ogCAAogC;QACzgC,GAAG,EAAE;;;;;;;;EAQP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,yyCAAyyC;QAC9yC,GAAG,EAAE;;;;;;;;;EASP;QACE,IAAI,EAAE;;;;;;;;;;;;;;EAcR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,2oCAA2oC;QAChpC,GAAG,EAAE;iIACwH;QAC7H,IAAI,EAAE,0HAA0H;KACjI;CACF,CAAC"}
1
+ {"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,ggCAAggC;QACrgC,GAAG,EAAE;;;;;;;;EAQP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,qyCAAqyC;QAC1yC,GAAG,EAAE;;;;;;;;;EASP;QACE,IAAI,EAAE;;;;;;;;;;;;;;EAcR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,uoCAAuoC;QAC5oC,GAAG,EAAE;iIACwH;QAC7H,IAAI,EAAE,0HAA0H;KACjI;CACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export const LANGUAGE_DOCS = {
2
2
  'language/glossary-term': {
3
- why: 'The ubiquitous language is the contract between the domain experts and the code. A class named with a word nobody defined is either a concept the experts do not know, or a synonym that will split the vocabulary in two. Writing the term and its meaning first forces the conversation that the name needs. Under "stack.refusals": "factories" or "named" the classes of domain/errors/ are judged too: `AppointmentError` names `Appointment`, `SlotTaken` names `Slot` and `Take`; a refusal class may also use the qualifiers of a refusal, invalid, unknown, already, too, no, missing and required (`BookingTooLate`, `InvalidAppointment`), and domain/errors/codes.ts, which holds no class, is not judged.',
3
+ why: 'The ubiquitous language is the contract between the domain experts and the code. A class named with a word nobody defined is either a concept the experts do not know, or a synonym that will split the vocabulary in two. Writing the term and its meaning first forces the conversation that the name needs. Under "stack.refusals": "factories" or "named" the classes of domain/errors/ are judged too: `AppointmentError` names `Appointment`, `SlotTaken` names `Slot` and `Take`; a refusal class may also use the qualifiers of a refusal, invalid, unknown, already, too, no, missing and required (`BookingTooLate`, `InvalidAppointment`), and <context>.codes.ts, which holds no class, is not judged.',
4
4
  bad: `// CONTEXT.md glossary: Invoice, Issue
5
5
  export class BillDispatcher {}`,
6
6
  good: `// CONTEXT.md glossary: Invoice, Issue
@@ -1 +1 @@
1
- {"version":3,"file":"language-docs.js","sourceRoot":"","sources":["../../../src/check/explain/language-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,wBAAwB,EAAE;QACxB,GAAG,EAAE,wrBAAwrB;QAC7rB,GAAG,EAAE;+BACsB;QAC3B,IAAI,EAAE;oCAC0B;KACjC;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,+OAA+O;QACpP,GAAG,EAAE,gCAAgC;QACrC,IAAI,EAAE,kCAAkC;KACzC;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,y0EAAy0E;QAC90E,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;EAER;KACC;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,iQAAiQ;QACtQ,GAAG,EAAE,4DAA4D;QACjE,IAAI,EAAE,8DAA8D;KACrE;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,4QAA4Q;QACjR,GAAG,EAAE,uEAAuE;QAC5E,IAAI,EAAE,gEAAgE;KACvE;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,2QAA2Q;QAChR,GAAG,EAAE,6DAA6D;QAClE,IAAI,EAAE,yDAAyD;KAChE;CACF,CAAC"}
1
+ {"version":3,"file":"language-docs.js","sourceRoot":"","sources":["../../../src/check/explain/language-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,wBAAwB,EAAE;QACxB,GAAG,EAAE,orBAAorB;QACzrB,GAAG,EAAE;+BACsB;QAC3B,IAAI,EAAE;oCAC0B;KACjC;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,+OAA+O;QACpP,GAAG,EAAE,gCAAgC;QACrC,IAAI,EAAE,kCAAkC;KACzC;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,y0EAAy0E;QAC90E,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;EAER;KACC;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,iQAAiQ;QACtQ,GAAG,EAAE,4DAA4D;QACjE,IAAI,EAAE,8DAA8D;KACrE;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,4QAA4Q;QACjR,GAAG,EAAE,uEAAuE;QAC5E,IAAI,EAAE,gEAAgE;KACvE;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,2QAA2Q;QAChR,GAAG,EAAE,6DAA6D;QAClE,IAAI,EAAE,yDAAyD;KAChE;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"module-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/module-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+BzD,CAAC"}
1
+ {"version":3,"file":"module-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/module-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmCzD,CAAC"}