ddd-ts-kit 0.82.0 → 0.83.2

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 (488) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/README.fr.md +128 -60
  3. package/README.md +124 -59
  4. package/dist/check/canonical/role.d.ts +2 -0
  5. package/dist/check/canonical/role.d.ts.map +1 -1
  6. package/dist/check/canonical/roles.js +1 -1
  7. package/dist/check/canonical/roles.js.map +1 -1
  8. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  9. package/dist/check/catalogue/architecture-rules.js +2 -0
  10. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  11. package/dist/check/catalogue/eslint-only-rules.js +3 -3
  12. package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
  13. package/dist/check/errors/builds-through-factories.d.ts +4 -1
  14. package/dist/check/errors/builds-through-factories.d.ts.map +1 -1
  15. package/dist/check/errors/builds-through-factories.js +6 -2
  16. package/dist/check/errors/builds-through-factories.js.map +1 -1
  17. package/dist/check/errors/code-entry.d.ts +8 -0
  18. package/dist/check/errors/code-entry.d.ts.map +1 -0
  19. package/dist/check/errors/code-entry.js +2 -0
  20. package/dist/check/errors/code-entry.js.map +1 -0
  21. package/dist/check/errors/code-list-name.d.ts +3 -0
  22. package/dist/check/errors/code-list-name.d.ts.map +1 -0
  23. package/dist/check/errors/code-list-name.js +6 -0
  24. package/dist/check/errors/code-list-name.js.map +1 -0
  25. package/dist/check/errors/code-list.d.ts +10 -0
  26. package/dist/check/errors/code-list.d.ts.map +1 -0
  27. package/dist/check/errors/code-list.js +2 -0
  28. package/dist/check/errors/code-list.js.map +1 -0
  29. package/dist/check/errors/codes-set-in.d.ts +9 -0
  30. package/dist/check/errors/codes-set-in.d.ts.map +1 -0
  31. package/dist/check/errors/codes-set-in.js +15 -0
  32. package/dist/check/errors/codes-set-in.js.map +1 -0
  33. package/dist/check/errors/error-codes.d.ts +2 -0
  34. package/dist/check/errors/error-codes.d.ts.map +1 -1
  35. package/dist/check/errors/error-codes.js +8 -0
  36. package/dist/check/errors/error-codes.js.map +1 -1
  37. package/dist/check/errors/is-codes-file.d.ts +4 -0
  38. package/dist/check/errors/is-codes-file.d.ts.map +1 -0
  39. package/dist/check/errors/is-codes-file.js +11 -0
  40. package/dist/check/errors/is-codes-file.js.map +1 -0
  41. package/dist/check/errors/is-error-file.d.ts +4 -0
  42. package/dist/check/errors/is-error-file.d.ts.map +1 -0
  43. package/dist/check/errors/is-error-file.js +6 -0
  44. package/dist/check/errors/is-error-file.js.map +1 -0
  45. package/dist/check/errors/listed-codes.d.ts +5 -0
  46. package/dist/check/errors/listed-codes.d.ts.map +1 -0
  47. package/dist/check/errors/listed-codes.js +12 -0
  48. package/dist/check/errors/listed-codes.js.map +1 -0
  49. package/dist/check/errors/names-refusals.d.ts +4 -0
  50. package/dist/check/errors/names-refusals.d.ts.map +1 -0
  51. package/dist/check/errors/names-refusals.js +5 -0
  52. package/dist/check/errors/names-refusals.js.map +1 -0
  53. package/dist/check/errors/read-code-list.d.ts +5 -0
  54. package/dist/check/errors/read-code-list.d.ts.map +1 -0
  55. package/dist/check/errors/read-code-list.js +32 -0
  56. package/dist/check/errors/read-code-list.js.map +1 -0
  57. package/dist/check/errors/refusal-classes.d.ts +8 -0
  58. package/dist/check/errors/refusal-classes.d.ts.map +1 -0
  59. package/dist/check/errors/refusal-classes.js +9 -0
  60. package/dist/check/errors/refusal-classes.js.map +1 -0
  61. package/dist/check/event-sourcing/declared-shape.d.ts +7 -1
  62. package/dist/check/event-sourcing/declared-shape.d.ts.map +1 -1
  63. package/dist/check/event-sourcing/declared-shape.js +12 -4
  64. package/dist/check/event-sourcing/declared-shape.js.map +1 -1
  65. package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
  66. package/dist/check/event-sourcing/read-stored-shape.js +10 -2
  67. package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
  68. package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
  69. package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
  70. package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
  71. package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
  72. package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
  73. package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
  74. package/dist/check/explain/errors-docs.d.ts.map +1 -1
  75. package/dist/check/explain/errors-docs.js +30 -2
  76. package/dist/check/explain/errors-docs.js.map +1 -1
  77. package/dist/check/explain/language-docs.js +1 -1
  78. package/dist/check/explain/language-docs.js.map +1 -1
  79. package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
  80. package/dist/check/fixtures/authz-policy-fixtures.js +11 -0
  81. package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
  82. package/dist/check/fixtures/errors-fixtures.d.ts.map +1 -1
  83. package/dist/check/fixtures/errors-fixtures.js +1 -1
  84. package/dist/check/fixtures/errors-fixtures.js.map +1 -1
  85. package/dist/check/fixtures/errors-route.d.ts +3 -0
  86. package/dist/check/fixtures/errors-route.d.ts.map +1 -0
  87. package/dist/check/fixtures/errors-route.js +6 -0
  88. package/dist/check/fixtures/errors-route.js.map +1 -0
  89. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  90. package/dist/check/fixtures/fixtures.js +2 -0
  91. package/dist/check/fixtures/fixtures.js.map +1 -1
  92. package/dist/check/fixtures/named-refusal-fixtures.d.ts +4 -0
  93. package/dist/check/fixtures/named-refusal-fixtures.d.ts.map +1 -0
  94. package/dist/check/fixtures/named-refusal-fixtures.js +210 -0
  95. package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -0
  96. package/dist/check/language/refusal-qualifiers.d.ts +8 -0
  97. package/dist/check/language/refusal-qualifiers.d.ts.map +1 -0
  98. package/dist/check/language/refusal-qualifiers.js +16 -0
  99. package/dist/check/language/refusal-qualifiers.js.map +1 -0
  100. package/dist/check/language/unknown-words.d.ts +2 -2
  101. package/dist/check/language/unknown-words.d.ts.map +1 -1
  102. package/dist/check/language/unknown-words.js +3 -2
  103. package/dist/check/language/unknown-words.js.map +1 -1
  104. package/dist/check/rules/authz-policy-asked.js +5 -2
  105. package/dist/check/rules/authz-policy-asked.js.map +1 -1
  106. package/dist/check/rules/errors-code-listed.d.ts +3 -0
  107. package/dist/check/rules/errors-code-listed.d.ts.map +1 -0
  108. package/dist/check/rules/errors-code-listed.js +160 -0
  109. package/dist/check/rules/errors-code-listed.js.map +1 -0
  110. package/dist/check/rules/errors-code-unique.d.ts.map +1 -1
  111. package/dist/check/rules/errors-code-unique.js +13 -8
  112. package/dist/check/rules/errors-code-unique.js.map +1 -1
  113. package/dist/check/rules/errors-known-code.d.ts.map +1 -1
  114. package/dist/check/rules/errors-known-code.js +17 -7
  115. package/dist/check/rules/errors-known-code.js.map +1 -1
  116. package/dist/check/rules/event-sourcing-upcaster-required.js +14 -4
  117. package/dist/check/rules/event-sourcing-upcaster-required.js.map +1 -1
  118. package/dist/check/rules/language-glossary-term.d.ts.map +1 -1
  119. package/dist/check/rules/language-glossary-term.js +10 -3
  120. package/dist/check/rules/language-glossary-term.js.map +1 -1
  121. package/dist/check/rules/naming-suffix.js +1 -1
  122. package/dist/check/rules/naming-suffix.js.map +1 -1
  123. package/dist/commands/docs.d.ts.map +1 -1
  124. package/dist/commands/docs.js +16 -7
  125. package/dist/commands/docs.js.map +1 -1
  126. package/dist/commands/error-factories.d.ts +4 -2
  127. package/dist/commands/error-factories.d.ts.map +1 -1
  128. package/dist/commands/error-factories.js +74 -17
  129. package/dist/commands/error-factories.js.map +1 -1
  130. package/dist/config/open-api-problems.js +7 -6
  131. package/dist/config/open-api-problems.js.map +1 -1
  132. package/dist/config/stack.d.ts +9 -6
  133. package/dist/config/stack.d.ts.map +1 -1
  134. package/dist/config/stack.js +1 -1
  135. package/dist/config/stack.js.map +1 -1
  136. package/dist/describe/context-description.d.ts +7 -2
  137. package/dist/describe/context-description.d.ts.map +1 -1
  138. package/dist/describe/exposed-by.d.ts +7 -0
  139. package/dist/describe/exposed-by.d.ts.map +1 -0
  140. package/dist/describe/exposed-by.js +11 -0
  141. package/dist/describe/exposed-by.js.map +1 -0
  142. package/dist/describe/read-errors.d.ts +3 -1
  143. package/dist/describe/read-errors.d.ts.map +1 -1
  144. package/dist/describe/read-errors.js +18 -11
  145. package/dist/describe/read-errors.js.map +1 -1
  146. package/dist/describe/read-refusals.d.ts +11 -0
  147. package/dist/describe/read-refusals.d.ts.map +1 -0
  148. package/dist/describe/read-refusals.js +41 -0
  149. package/dist/describe/read-refusals.js.map +1 -0
  150. package/dist/describe/reference-lines.d.ts.map +1 -1
  151. package/dist/describe/reference-lines.js +18 -2
  152. package/dist/describe/reference-lines.js.map +1 -1
  153. package/dist/docs/formerly-recorded-stored-events.d.ts +9 -0
  154. package/dist/docs/formerly-recorded-stored-events.d.ts.map +1 -0
  155. package/dist/docs/formerly-recorded-stored-events.js +17 -0
  156. package/dist/docs/formerly-recorded-stored-events.js.map +1 -0
  157. package/dist/docs/write-stored-events-lock.d.ts +3 -2
  158. package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
  159. package/dist/docs/write-stored-events-lock.js +10 -4
  160. package/dist/docs/write-stored-events-lock.js.map +1 -1
  161. package/dist/generate/concept.d.ts.map +1 -1
  162. package/dist/generate/concept.js +3 -29
  163. package/dist/generate/concept.js.map +1 -1
  164. package/dist/generate/errors/add-code.d.ts +13 -0
  165. package/dist/generate/errors/add-code.d.ts.map +1 -0
  166. package/dist/generate/errors/add-code.js +18 -0
  167. package/dist/generate/errors/add-code.js.map +1 -0
  168. package/dist/generate/errors/codes-list.d.ts +10 -0
  169. package/dist/generate/errors/codes-list.d.ts.map +1 -0
  170. package/dist/generate/errors/codes-list.js +25 -0
  171. package/dist/generate/errors/codes-list.js.map +1 -0
  172. package/dist/generate/errors/error-code-pattern.d.ts +3 -0
  173. package/dist/generate/errors/error-code-pattern.d.ts.map +1 -0
  174. package/dist/generate/errors/error-code-pattern.js +3 -0
  175. package/dist/generate/errors/error-code-pattern.js.map +1 -0
  176. package/dist/generate/errors/factory-prefix.d.ts +3 -0
  177. package/dist/generate/errors/factory-prefix.d.ts.map +1 -0
  178. package/dist/generate/errors/factory-prefix.js +3 -0
  179. package/dist/generate/errors/factory-prefix.js.map +1 -0
  180. package/dist/generate/errors/named-refusal-code.d.ts +17 -0
  181. package/dist/generate/errors/named-refusal-code.d.ts.map +1 -0
  182. package/dist/generate/errors/named-refusal-code.js +42 -0
  183. package/dist/generate/errors/named-refusal-code.js.map +1 -0
  184. package/dist/generate/errors/refusal-class-name.d.ts +8 -0
  185. package/dist/generate/errors/refusal-class-name.d.ts.map +1 -0
  186. package/dist/generate/errors/refusal-class-name.js +16 -0
  187. package/dist/generate/errors/refusal-class-name.js.map +1 -0
  188. package/dist/generate/errors/refusal-factory-name.d.ts +4 -0
  189. package/dist/generate/errors/refusal-factory-name.d.ts.map +1 -0
  190. package/dist/generate/errors/refusal-factory-name.js +15 -0
  191. package/dist/generate/errors/refusal-factory-name.js.map +1 -0
  192. package/dist/generate/errors/write-named-refusal.d.ts +18 -0
  193. package/dist/generate/errors/write-named-refusal.d.ts.map +1 -0
  194. package/dist/generate/errors/write-named-refusal.js +89 -0
  195. package/dist/generate/errors/write-named-refusal.js.map +1 -0
  196. package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
  197. package/dist/generate/kinds/domain-error-kind.js +12 -5
  198. package/dist/generate/kinds/domain-error-kind.js.map +1 -1
  199. package/dist/generate/kinds/error-kind.d.ts.map +1 -1
  200. package/dist/generate/kinds/error-kind.js +27 -12
  201. package/dist/generate/kinds/error-kind.js.map +1 -1
  202. package/dist/generate/spoken-in-language.d.ts +9 -0
  203. package/dist/generate/spoken-in-language.d.ts.map +1 -0
  204. package/dist/generate/spoken-in-language.js +39 -0
  205. package/dist/generate/spoken-in-language.js.map +1 -0
  206. package/dist/help/notes.d.ts +1 -1
  207. package/dist/help/notes.d.ts.map +1 -1
  208. package/dist/help/notes.js +11 -5
  209. package/dist/help/notes.js.map +1 -1
  210. package/dist/help/usage.d.ts +1 -1
  211. package/dist/help/usage.d.ts.map +1 -1
  212. package/dist/help/usage.js +2 -2
  213. package/dist/init/manifest/versions.js +24 -24
  214. package/dist/init/run-init.js +1 -1
  215. package/dist/init/run-init.js.map +1 -1
  216. package/dist/init/stack/resolve-stack.js +2 -2
  217. package/dist/init/stack/resolve-stack.js.map +1 -1
  218. package/dist/init/write-contracts.d.ts +9 -2
  219. package/dist/init/write-contracts.d.ts.map +1 -1
  220. package/dist/init/write-contracts.js +14 -4
  221. package/dist/init/write-contracts.js.map +1 -1
  222. package/dist/presets/identity-refusal.js +1 -1
  223. package/dist/presets/identity-refusal.js.map +1 -1
  224. package/dist/presets/identity-terms.d.ts.map +1 -1
  225. package/dist/presets/identity-terms.js +30 -0
  226. package/dist/presets/identity-terms.js.map +1 -1
  227. package/dist/presets/preset-files.d.ts.map +1 -1
  228. package/dist/presets/preset-files.js +4 -1
  229. package/dist/presets/preset-files.js.map +1 -1
  230. package/dist/refusals/aggregates-of.d.ts +10 -0
  231. package/dist/refusals/aggregates-of.d.ts.map +1 -0
  232. package/dist/refusals/aggregates-of.js +9 -0
  233. package/dist/refusals/aggregates-of.js.map +1 -0
  234. package/dist/refusals/applied-moves.d.ts +7 -0
  235. package/dist/refusals/applied-moves.d.ts.map +1 -0
  236. package/dist/refusals/applied-moves.js +2 -0
  237. package/dist/refusals/applied-moves.js.map +1 -0
  238. package/dist/refusals/apply-named-plan.d.ts +19 -0
  239. package/dist/refusals/apply-named-plan.d.ts.map +1 -0
  240. package/dist/refusals/apply-named-plan.js +46 -0
  241. package/dist/refusals/apply-named-plan.js.map +1 -0
  242. package/dist/refusals/apply-plan.d.ts.map +1 -1
  243. package/dist/refusals/apply-plan.js +21 -25
  244. package/dist/refusals/apply-plan.js.map +1 -1
  245. package/dist/refusals/code-without-imports.d.ts +3 -0
  246. package/dist/refusals/code-without-imports.d.ts.map +1 -0
  247. package/dist/refusals/code-without-imports.js +9 -0
  248. package/dist/refusals/code-without-imports.js.map +1 -0
  249. package/dist/refusals/concept-error-class.d.ts +26 -0
  250. package/dist/refusals/concept-error-class.d.ts.map +1 -0
  251. package/dist/refusals/concept-error-class.js +2 -0
  252. package/dist/refusals/concept-error-class.js.map +1 -0
  253. package/dist/refusals/concept-errors.d.ts +6 -0
  254. package/dist/refusals/concept-errors.d.ts.map +1 -0
  255. package/dist/refusals/concept-errors.js +16 -0
  256. package/dist/refusals/concept-errors.js.map +1 -0
  257. package/dist/refusals/concept-imports.d.ts +8 -0
  258. package/dist/refusals/concept-imports.d.ts.map +1 -0
  259. package/dist/refusals/concept-imports.js +33 -0
  260. package/dist/refusals/concept-imports.js.map +1 -0
  261. package/dist/refusals/concept-leftovers.d.ts +5 -0
  262. package/dist/refusals/concept-leftovers.d.ts.map +1 -0
  263. package/dist/refusals/concept-leftovers.js +26 -0
  264. package/dist/refusals/concept-leftovers.js.map +1 -0
  265. package/dist/refusals/concept-named.d.ts +3 -0
  266. package/dist/refusals/concept-named.d.ts.map +1 -0
  267. package/dist/refusals/concept-named.js +13 -0
  268. package/dist/refusals/concept-named.js.map +1 -0
  269. package/dist/refusals/concerns.d.ts +16 -0
  270. package/dist/refusals/concerns.d.ts.map +1 -0
  271. package/dist/refusals/concerns.js +9 -0
  272. package/dist/refusals/concerns.js.map +1 -0
  273. package/dist/refusals/cut-factories.d.ts +7 -0
  274. package/dist/refusals/cut-factories.d.ts.map +1 -0
  275. package/dist/refusals/cut-factories.js +30 -0
  276. package/dist/refusals/cut-factories.js.map +1 -0
  277. package/dist/refusals/earlier-guidance.d.ts +8 -0
  278. package/dist/refusals/earlier-guidance.d.ts.map +1 -0
  279. package/dist/refusals/earlier-guidance.js +21 -0
  280. package/dist/refusals/earlier-guidance.js.map +1 -0
  281. package/dist/refusals/factory-for-parameter.d.ts +7 -0
  282. package/dist/refusals/factory-for-parameter.d.ts.map +1 -0
  283. package/dist/refusals/factory-for-parameter.js +17 -0
  284. package/dist/refusals/factory-for-parameter.js.map +1 -0
  285. package/dist/refusals/first-parameter.d.ts +6 -0
  286. package/dist/refusals/first-parameter.d.ts.map +1 -0
  287. package/dist/refusals/first-parameter.js +12 -0
  288. package/dist/refusals/first-parameter.js.map +1 -0
  289. package/dist/refusals/ignore-code-types.d.ts +10 -0
  290. package/dist/refusals/ignore-code-types.d.ts.map +1 -0
  291. package/dist/refusals/ignore-code-types.js +53 -0
  292. package/dist/refusals/ignore-code-types.js.map +1 -0
  293. package/dist/refusals/imports-used-by.d.ts +6 -0
  294. package/dist/refusals/imports-used-by.d.ts.map +1 -0
  295. package/dist/refusals/imports-used-by.js +32 -0
  296. package/dist/refusals/imports-used-by.js.map +1 -0
  297. package/dist/refusals/leave-origins.d.ts +10 -0
  298. package/dist/refusals/leave-origins.d.ts.map +1 -0
  299. package/dist/refusals/leave-origins.js +35 -0
  300. package/dist/refusals/leave-origins.js.map +1 -0
  301. package/dist/refusals/legacy-move.d.ts +5 -0
  302. package/dist/refusals/legacy-move.d.ts.map +1 -0
  303. package/dist/refusals/legacy-move.js +14 -0
  304. package/dist/refusals/legacy-move.js.map +1 -0
  305. package/dist/refusals/markdown-files.d.ts +4 -0
  306. package/dist/refusals/markdown-files.d.ts.map +1 -0
  307. package/dist/refusals/markdown-files.js +13 -0
  308. package/dist/refusals/markdown-files.js.map +1 -0
  309. package/dist/refusals/member-start.d.ts +3 -0
  310. package/dist/refusals/member-start.d.ts.map +1 -0
  311. package/dist/refusals/member-start.js +14 -0
  312. package/dist/refusals/member-start.js.map +1 -0
  313. package/dist/refusals/migration-targets.d.ts +3 -0
  314. package/dist/refusals/migration-targets.d.ts.map +1 -0
  315. package/dist/refusals/migration-targets.js +3 -0
  316. package/dist/refusals/migration-targets.js.map +1 -0
  317. package/dist/refusals/move-named-specs.d.ts +16 -0
  318. package/dist/refusals/move-named-specs.d.ts.map +1 -0
  319. package/dist/refusals/move-named-specs.js +119 -0
  320. package/dist/refusals/move-named-specs.js.map +1 -0
  321. package/dist/refusals/move.d.ts +6 -1
  322. package/dist/refusals/move.d.ts.map +1 -1
  323. package/dist/refusals/named-move.d.ts +23 -0
  324. package/dist/refusals/named-move.d.ts.map +1 -0
  325. package/dist/refusals/named-move.js +2 -0
  326. package/dist/refusals/named-move.js.map +1 -0
  327. package/dist/refusals/named-moves.d.ts +10 -0
  328. package/dist/refusals/named-moves.d.ts.map +1 -0
  329. package/dist/refusals/named-moves.js +64 -0
  330. package/dist/refusals/named-moves.js.map +1 -0
  331. package/dist/refusals/named-plan.d.ts +7 -0
  332. package/dist/refusals/named-plan.d.ts.map +1 -0
  333. package/dist/refusals/named-plan.js +2 -0
  334. package/dist/refusals/named-plan.js.map +1 -0
  335. package/dist/refusals/own-factory.d.ts +14 -0
  336. package/dist/refusals/own-factory.d.ts.map +1 -0
  337. package/dist/refusals/own-factory.js +38 -0
  338. package/dist/refusals/own-factory.js.map +1 -0
  339. package/dist/refusals/plan-target.d.ts +7 -0
  340. package/dist/refusals/plan-target.d.ts.map +1 -0
  341. package/dist/refusals/plan-target.js +13 -0
  342. package/dist/refusals/plan-target.js.map +1 -0
  343. package/dist/refusals/planned-refusal.d.ts +13 -0
  344. package/dist/refusals/planned-refusal.d.ts.map +1 -0
  345. package/dist/refusals/planned-refusal.js +2 -0
  346. package/dist/refusals/planned-refusal.js.map +1 -0
  347. package/dist/refusals/propose-named-plan.d.ts +25 -0
  348. package/dist/refusals/propose-named-plan.d.ts.map +1 -0
  349. package/dist/refusals/propose-named-plan.js +67 -0
  350. package/dist/refusals/propose-named-plan.js.map +1 -0
  351. package/dist/refusals/propose-plan.d.ts.map +1 -1
  352. package/dist/refusals/propose-plan.js +3 -19
  353. package/dist/refusals/propose-plan.js.map +1 -1
  354. package/dist/refusals/read-concept-error.d.ts +9 -0
  355. package/dist/refusals/read-concept-error.d.ts.map +1 -0
  356. package/dist/refusals/read-concept-error.js +51 -0
  357. package/dist/refusals/read-concept-error.js.map +1 -0
  358. package/dist/refusals/read-named-plan.d.ts +4 -0
  359. package/dist/refusals/read-named-plan.d.ts.map +1 -0
  360. package/dist/refusals/read-named-plan.js +57 -0
  361. package/dist/refusals/read-named-plan.js.map +1 -0
  362. package/dist/refusals/refusal-class-file.d.ts +15 -0
  363. package/dist/refusals/refusal-class-file.d.ts.map +1 -0
  364. package/dist/refusals/refusal-class-file.js +38 -0
  365. package/dist/refusals/refusal-class-file.js.map +1 -0
  366. package/dist/refusals/rename-concept.d.ts +7 -0
  367. package/dist/refusals/rename-concept.d.ts.map +1 -0
  368. package/dist/refusals/rename-concept.js +15 -0
  369. package/dist/refusals/rename-concept.js.map +1 -0
  370. package/dist/refusals/render-factory.d.ts +1 -1
  371. package/dist/refusals/render-factory.d.ts.map +1 -1
  372. package/dist/refusals/render-factory.js +3 -2
  373. package/dist/refusals/render-factory.js.map +1 -1
  374. package/dist/refusals/rewrite-concept-usages.d.ts +11 -0
  375. package/dist/refusals/rewrite-concept-usages.d.ts.map +1 -0
  376. package/dist/refusals/rewrite-concept-usages.js +61 -0
  377. package/dist/refusals/rewrite-concept-usages.js.map +1 -0
  378. package/dist/refusals/rewrite-named-usages.d.ts +9 -0
  379. package/dist/refusals/rewrite-named-usages.d.ts.map +1 -0
  380. package/dist/refusals/rewrite-named-usages.js +14 -0
  381. package/dist/refusals/rewrite-named-usages.js.map +1 -0
  382. package/dist/refusals/rewrite-usages.d.ts.map +1 -1
  383. package/dist/refusals/rewrite-usages.js +10 -6
  384. package/dist/refusals/rewrite-usages.js.map +1 -1
  385. package/dist/refusals/say-refusals.d.ts +3 -0
  386. package/dist/refusals/say-refusals.d.ts.map +1 -0
  387. package/dist/refusals/say-refusals.js +8 -0
  388. package/dist/refusals/say-refusals.js.map +1 -0
  389. package/dist/refusals/split-concept-spec.d.ts +19 -0
  390. package/dist/refusals/split-concept-spec.d.ts.map +1 -0
  391. package/dist/refusals/split-concept-spec.js +74 -0
  392. package/dist/refusals/split-concept-spec.js.map +1 -0
  393. package/dist/refusals/stale-mentions.d.ts +10 -0
  394. package/dist/refusals/stale-mentions.d.ts.map +1 -0
  395. package/dist/refusals/stale-mentions.js +41 -0
  396. package/dist/refusals/stale-mentions.js.map +1 -0
  397. package/dist/refusals/undefined-words.d.ts +15 -0
  398. package/dist/refusals/undefined-words.d.ts.map +1 -0
  399. package/dist/refusals/undefined-words.js +26 -0
  400. package/dist/refusals/undefined-words.js.map +1 -0
  401. package/dist/refusals/with-codes.d.ts +11 -0
  402. package/dist/refusals/with-codes.d.ts.map +1 -0
  403. package/dist/refusals/with-codes.js +46 -0
  404. package/dist/refusals/with-codes.js.map +1 -0
  405. package/dist/refusals/with-imports.d.ts +3 -0
  406. package/dist/refusals/with-imports.d.ts.map +1 -0
  407. package/dist/refusals/with-imports.js +8 -0
  408. package/dist/refusals/with-imports.js.map +1 -0
  409. package/dist/refusals/write-refusal-classes.d.ts +9 -0
  410. package/dist/refusals/write-refusal-classes.d.ts.map +1 -0
  411. package/dist/refusals/write-refusal-classes.js +23 -0
  412. package/dist/refusals/write-refusal-classes.js.map +1 -0
  413. package/dist/stack/stack-vars.js +1 -1
  414. package/dist/stack/stack-vars.js.map +1 -1
  415. package/dist/version.d.ts +1 -1
  416. package/dist/version.js +1 -1
  417. package/package.json +2 -2
  418. package/templates/aggregate/aggregate.ts.tpl +3 -0
  419. package/templates/aggregate/event-sourced.aggregate.ts.tpl +3 -0
  420. package/templates/command/handler.declared.ts.tpl +3 -0
  421. package/templates/command/handler.ts.tpl +3 -0
  422. package/templates/entity/entity.ts.tpl +3 -0
  423. package/templates/error/codes.ts.tpl +5 -0
  424. package/templates/error/refusal-case.spec.ts.tpl +8 -0
  425. package/templates/error/refusal-factory.ts.tpl +4 -0
  426. package/templates/error/refusal.spec.ts.tpl +7 -0
  427. package/templates/error/refusal.ts.tpl +8 -0
  428. package/templates/init/rules/domain.md.tpl +9 -2
  429. package/templates/init/rules/presentation.md.tpl +3 -0
  430. package/templates/init/scripts/events.ts.tpl +19 -1
  431. package/templates/init/scripts/openapi.ts.tpl +19 -1
  432. package/templates/pipeline/knip.json.tpl +5 -0
  433. package/templates/pipeline/package-scripts.json +1 -1
  434. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +22 -0
  435. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +16 -0
  436. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +16 -0
  437. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +16 -0
  438. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +10 -0
  439. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +16 -0
  440. package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +10 -0
  441. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +16 -0
  442. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +10 -0
  443. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +10 -0
  444. package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +16 -0
  445. package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +28 -0
  446. package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +27 -0
  447. package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +31 -0
  448. package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +13 -0
  449. package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +10 -0
  450. package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +13 -0
  451. package/templates/presets/identity/context/domain/errors/codes.named.ts.tpl +33 -0
  452. package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +10 -0
  453. package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +10 -0
  454. package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +13 -0
  455. package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +10 -0
  456. package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +12 -0
  457. package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +10 -0
  458. package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +13 -0
  459. package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +10 -0
  460. package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +10 -0
  461. package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +10 -0
  462. package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +13 -0
  463. package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +13 -0
  464. package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +13 -0
  465. package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +13 -0
  466. package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +12 -0
  467. package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +10 -0
  468. package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +10 -0
  469. package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +12 -0
  470. package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +12 -0
  471. package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +12 -0
  472. package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +10 -0
  473. package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +11 -0
  474. package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +13 -0
  475. package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +12 -0
  476. package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +16 -0
  477. package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +10 -0
  478. package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +10 -0
  479. package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +10 -0
  480. package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +10 -0
  481. package/templates/presets/identity/context/test/unit/provision-account.controller.spec.ts.tpl +13 -0
  482. package/templates/state-machine/state-machine.ts.tpl +5 -0
  483. package/templates/value-object/value-object.ts.tpl +6 -0
  484. /package/templates/presets/identity/context/domain/errors/{account.error.ts.tpl → account.error.factories.ts.tpl} +0 -0
  485. /package/templates/presets/identity/context/domain/errors/{delegation.error.ts.tpl → delegation.error.factories.ts.tpl} +0 -0
  486. /package/templates/presets/identity/context/domain/errors/{invitation.error.ts.tpl → invitation.error.factories.ts.tpl} +0 -0
  487. /package/templates/presets/identity/context/domain/errors/{member.error.ts.tpl → member.error.factories.ts.tpl} +0 -0
  488. /package/templates/presets/identity/context/domain/errors/{organisation.error.ts.tpl → organisation.error.factories.ts.tpl} +0 -0
package/README.md CHANGED
@@ -61,7 +61,7 @@ ddd-ts-kit init [--http express|fastify|hono|nest|none]
61
61
  [--http-cache none|varnish] [--storage local|s3|none] [--audit on|off]
62
62
  [--errors none|sentry] [--logger stdout|pino|winston]
63
63
  [--style declared|explicit] [--assembly barrel|discovery]
64
- [--dependencies signature|listed] [--refusals factories|classes]
64
+ [--dependencies signature|listed] [--refusals named|factories|classes]
65
65
  [--routes controllers|functions] [--value-objects throwing|result]
66
66
  [--literals named|free] [--values classes|free] [--tenancy none|shared-table]
67
67
  [--queue database|redis|memory]
@@ -332,33 +332,48 @@ injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
332
332
  and the one line of the composition root that adds the whole context:
333
333
  `contextModule('notification', notificationDeclarations)` in `src/platform/compose-application.ts`.
334
334
 
335
- **Domain errors are built by factories.** `init` writes `"stack.refusals": "factories"`: a
336
- context has one error class per concept, extending `ConceptError` of the kernel, and
337
- `generate error <context> <Concept> <refusal>` adds a static factory to it. The `errors/*`
338
- rules hold that form. `--refusals classes`, or a config without the key, keeps one class per
339
- error built with `new`, as 0.1 and 0.2 wrote them; `error-factories` moves a project from one
340
- to the other.
335
+ **A refusal is a class of its own.** `init` writes `"stack.refusals": "named"`: each refusal of
336
+ a context is a class named after what is refused, extending `DomainRefusal` of the kernel, built
337
+ by static factories named after what the refusal is about, and its code is read from the closed
338
+ list of the codes of the context, `domain/errors/codes.ts`.
339
+ `generate error <context> <Refusal> <factory>` writes the class, its code and the factory. The
340
+ `errors/*` rules hold that form. Two earlier forms keep working: `--refusals factories`, one error class per concept extending
341
+ `ConceptError`, each refusal a static factory of it, as `init` wrote it before; and
342
+ `--refusals classes`, or a config without the key, one class per error built with `new`, as 0.1
343
+ and 0.2 wrote them. `error-factories` moves a project from either to `named`.
341
344
 
342
- The older form, under `"stack.refusals": "classes"`: one class per error.
345
+ The form `init` writes, which `generate error scheduling SlotTaken forCalendar` starts:
343
346
 
344
347
  <!-- checked sample -->
345
348
  ```ts
346
- import { DomainError } from '@ddd-ts-kit/kernel';
349
+ import { DomainRefusal } from '@ddd-ts-kit/kernel';
350
+
351
+ // domain/errors/codes.ts: the closed list of the codes of the context
352
+ export const SchedulingCodes = {
353
+ SlotTaken: 'SLOT_TAKEN',
354
+ } as const;
355
+
356
+ export type SchedulingCode = (typeof SchedulingCodes)[keyof typeof SchedulingCodes];
347
357
 
348
358
  // domain/errors/slot-taken.error.ts
349
- export class SlotTakenError extends DomainError {
350
- readonly code = 'SLOT_TAKEN';
359
+ export class SlotTaken extends DomainRefusal {
360
+ readonly code = SchedulingCodes.SlotTaken;
351
361
 
352
- constructor(readonly calendarId: string) {
353
- super(`The slot of calendar ${calendarId} is already held.`);
362
+ static forCalendar(calendarId: string) {
363
+ return SlotTaken.refusal(`The slot of calendar ${calendarId} is already held.`, { calendarId });
354
364
  }
355
365
  }
356
366
 
357
- const refusal = new SlotTakenError('calendar-1');
367
+ const refusal = SlotTaken.forCalendar('calendar-1');
368
+
369
+ // what catches it tells the refusal by its class, and reads its facts
370
+ if (SlotTaken.is(refusal)) {
371
+ console.log(refusal.facts.calendarId);
372
+ }
358
373
  ```
359
374
 
360
- The form `init` writes: one class per concept of the glossary, one factory per refusal, which
361
- `generate error scheduling Appointment slotTaken` adds.
375
+ Under `"stack.refusals": "factories"`: one class per concept of the glossary, one factory per
376
+ refusal, which `generate error scheduling Appointment slotTaken` adds.
362
377
 
363
378
  <!-- checked sample -->
364
379
  ```ts
@@ -379,6 +394,24 @@ if (AppointmentError.is(refusal, 'SLOT_TAKEN')) {
379
394
  }
380
395
  ```
381
396
 
397
+ The oldest form, under `"stack.refusals": "classes"`: one class per error.
398
+
399
+ <!-- checked sample -->
400
+ ```ts
401
+ import { DomainError } from '@ddd-ts-kit/kernel';
402
+
403
+ // domain/errors/slot-taken.error.ts
404
+ export class SlotTakenError extends DomainError {
405
+ readonly code = 'SLOT_TAKEN';
406
+
407
+ constructor(readonly calendarId: string) {
408
+ super(`The slot of calendar ${calendarId} is already held.`);
409
+ }
410
+ }
411
+
412
+ const refusal = new SlotTakenError('calendar-1');
413
+ ```
414
+
382
415
  **A route is a controller class.** `init` writes `"stack.routes": "controllers"`: each route is
383
416
  one class with one method, in a folder of its own, behind the guards of its route group, and a
384
417
  declared context lists no route: its controllers reach the application through its generated
@@ -422,15 +455,16 @@ write the save, and nothing after it:
422
455
 
423
456
  <!-- checked sample -->
424
457
  ```ts
425
- import { type Actor, AggregateRoot, AuthorizedCommand, type Clock, type CommandHandler, ConceptError, Repository } from '@ddd-ts-kit/kernel';
458
+ import { type Actor, AggregateRoot, AuthorizedCommand, type Clock, type CommandHandler, DomainRefusal, Repository } from '@ddd-ts-kit/kernel';
426
459
 
427
460
  declare class Invoice extends AggregateRoot {
428
461
  /** Makes the invoice final and records InvoiceIssued, which waits in the aggregate. */
429
462
  issue(now: Date): void;
430
463
  }
431
464
 
432
- declare class InvoiceError extends ConceptError {
433
- static notFound(invoiceId: string): InvoiceError;
465
+ declare class UnknownInvoice extends DomainRefusal {
466
+ readonly code: 'INVOICE_NOT_FOUND';
467
+ static forInvoice(invoiceId: string): UnknownInvoice;
434
468
  }
435
469
 
436
470
  export abstract class InvoiceRepository extends Repository<Invoice> {}
@@ -454,7 +488,7 @@ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand>
454
488
  const invoice = await this.invoiceRepository.findById(command.invoiceId);
455
489
 
456
490
  if (invoice === undefined) {
457
- throw InvoiceError.notFound(command.invoiceId);
491
+ throw UnknownInvoice.forInvoice(command.invoiceId);
458
492
  }
459
493
 
460
494
  invoice.issue(this.clock.now());
@@ -618,8 +652,8 @@ Next, in this order: the language of the context first, then the business decisi
618
652
  | `value-object` (`vo`) | `<context> <Name>` | value object, spec |
619
653
  | `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 |
620
654
  | `domain-event` | `<context> <Aggregate> <Fact>` | event named `<context>.<aggregate>.<fact>`, spec |
621
- | `error` (`refusal`) | `<context> <Concept> <refusal> [--code CODE] [--term ...]...` | a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
622
- | `domain-error` | `<context> <Name> [--code CODE]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `factories`, with the `generate error` command to run instead |
655
+ | `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 |
656
+ | `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 |
623
657
  | `domain-service` | `<context> <Name>` | service, spec |
624
658
  | `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 |
625
659
  | `repository` | `<context> <Aggregate> [--tenant-scoped]` | the port `domain/repositories/<name>.repository.ts` (`abstract class <Name>Repository extends Repository<<Name>>`), the adapter of the project's ORM (`implements` the port) with its mapper and table (or model), a fake, one `repositoryContract` spec run on both, registration |
@@ -887,44 +921,74 @@ serializer, give the groups their guards, hold the guards in the specs.
887
921
  ## error-factories
888
922
 
889
923
  ```
890
- ddd-ts-kit error-factories --plan
924
+ ddd-ts-kit error-factories --plan [--to named|factories]
891
925
  ddd-ts-kit error-factories --apply [--dry-run]
892
926
  ```
893
927
 
894
- Moves a project from one class per error (`new SlotTakenError(..)`) to static factories on one
895
- error class per concept (`AppointmentError.slotTaken(..)`), in two steps, because which concept
896
- a refusal is about is a decision of the model.
897
-
898
- `--plan` writes `error-factories.plan.json`: per context, one entry per class of
928
+ Moves the refusals of a project to one class per refusal (`--to named`, the default), from one
929
+ class per error (`new SlotTakenError(..)`) or from the factories of one error class per concept
930
+ (`AppointmentError.slotTaken(..)`), to `SlotTaken.forCalendar(..)`. In two steps, because the
931
+ name of a refusal and of its factory are decisions of the model.
932
+
933
+ `--plan` writes `error-factories.plan.json`, `{ "to": "named", "contexts": { .. } }`: per
934
+ context, one entry per refusal, with what builds it today (`from`: `SlotTakenError`,
935
+ `AppointmentError.ended`), its file, its code, which is kept, the class proposed for it (`class`:
936
+ the PascalCase of its code, `APPOINTMENT_ENDED` gives `AppointmentEnded`, and `X_NOT_FOUND` gives
937
+ `UnknownX`) and its factory (`factory`: `for` and its first parameter, an `Id` suffix dropped,
938
+ `appointmentId` gives `forAppointment`, `cause` gives `becauseOf`; else `for` and the concept or
939
+ the aggregate the class is named after). Edit the names
940
+ you want otherwise: two entries under one class are two factories of it, under its one code. A
941
+ factory whose code is not a string literal is left out of the plan, and moves by hand. A class
942
+ is named with terms of the glossary of its context, as `language/glossary-term` judges every
943
+ class of `domain/errors/` under `named`, the qualifiers of a refusal aside: for each proposed
944
+ class whose name uses a word the glossary does not define, `--plan` says, under "Left to you",
945
+ which words and where to define them, or to rename the class in the plan; `--apply` says it again
946
+ for each class it writes.
947
+
948
+ `--apply` follows the plan, and refuses a class that is not in PascalCase or ends with `Error`,
949
+ a factory that does not start with `for`, `with`, `because`, `on` or `at` then an upper-case
950
+ letter, a class given two codes and a factory planned twice. It:
951
+
952
+ - writes `domain/errors/codes.ts` in each context, the list `<Context>Codes` with one entry per
953
+ class, and one file per refusal class, `domain/errors/<refusal>.error.ts`, extending
954
+ `DomainRefusal` and reading its code from the list, with its factories: each keeps the
955
+ parameters, the message and the facts it had;
956
+ - moves each case of a spec to `test/unit/<refusal>.error.spec.ts`;
957
+ - rewrites every file under the source root and `test/`: `AppointmentError.ended(a, b)` becomes
958
+ `AppointmentEnded.forAppointment(a, b)`, `AppointmentError.is(error, 'APPOINTMENT_ENDED')`
959
+ becomes `AppointmentEnded.is(error)`, `new SlotTakenError(..)` becomes
960
+ `SlotTaken.forCalendar(..)`, and the name of a class per error becomes the name of its class
961
+ everywhere else (assertions, `instanceof`, types), imports included. Comments and strings are
962
+ left alone;
963
+ - removes the classes per error it moved, and the concept classes left empty;
964
+ - sets `"stack.refusals": "named"` in the config.
965
+
966
+ It leaves, and says with its line, what still names a concept class that is gone: a bare
967
+ `AppointmentError.is(error)`, which meant every refusal of the concept (write the refusals it
968
+ means, `AppointmentEnded.is(error) || ..`), and `CodeOf<typeof AppointmentError>` (write the
969
+ union of the codes it means, or the code type of `codes.ts`). And always: run the formatter and
970
+ the checks, decide which facts a client may read where no factory exposes any yet, assert the
971
+ facts in the specs, and delete the plan file. Run again, it finds nothing left to move. `--json`
972
+ answers `{ dryRun, moved, written, removed, manual }`.
973
+
974
+ `--to factories` is the earlier move, from one class per error to static factories on one error
975
+ class per concept, in the same two steps. `--plan --to factories` writes one entry per class of
899
976
  `domain/errors/` that extends `DomainError`, with its code, the concept proposed for it (the
900
- aggregate its name starts or ends with, empty when none does) and the factory name that says
901
- its code (`APPOINTMENT_NOT_FOUND` on `Appointment` gives `notFound`). Edit it: every entry
902
- needs a `concept`, a term of the glossary.
903
-
904
- `--apply` follows the plan and refuses an entry without a concept, a vague factory name or one
905
- that does not say the code. It:
906
-
907
- - writes `domain/errors/<concept>.error.ts`, a class extending `ConceptError` with one factory
908
- per class moved there: the parameters of the constructor, the message it gave to `super`, and
909
- as facts the parameters that are plain data (text, numbers, booleans, dates);
910
- - removes each class and its spec, whose cases go under `describe('<factory>')` in
911
- `test/unit/<concept>.error.spec.ts`;
912
- - rewrites every file under the source root and `test/`: `new X(..)` becomes
913
- `<Concept>Error.<factory>(..)`, `thenError(X)` and `thenError(X, code)` become
914
- `thenError('<CODE>')`, `toThrow(X)` and `expect.any(X)` become an assertion on the code,
915
- `toBeInstanceOf(X)` becomes `toMatchObject({ code })`, `e instanceof X` becomes
916
- `<Concept>Error.is(e, '<CODE>')`, an import of the class becomes the import of its concept
917
- class, and a type names the concept class. A class of the same name in two contexts goes to
918
- the concept of its own. Comments and strings are left alone;
919
- - sets `"stack.refusals": "factories"` in the config.
920
-
921
- It leaves, and says: a class that has members of its own, reads `this` in its constructor or
922
- gives options to `super` (written by hand); a place where a class stood as a value it cannot
923
- translate; a property of the error that became a fact (`error.personId` is now
924
- `error.facts.personId`); a factory with more than three parameters. And always: which facts a
925
- client may read (none is exposed), the factories that still take a sentence as only parameter,
926
- and the facts to assert in the specs. Run the formatter afterwards. Run again, it finds nothing
927
- left to move. `--json` answers `{ dryRun, moved, written, removed, manual }`.
977
+ aggregate its name starts or ends with, empty when none does) and the factory name that says its
978
+ code (`APPOINTMENT_NOT_FOUND` on `Appointment` gives `notFound`); every entry needs a `concept`,
979
+ a term of the glossary. `--apply` then refuses an entry without a concept, a vague factory name
980
+ or one that does not say the code. It writes `domain/errors/<concept>.error.ts`, a class
981
+ extending `ConceptError` with one factory per class moved there (the parameters of the
982
+ constructor, the message it gave to `super`, and as facts the parameters that are plain data),
983
+ moves the cases of the specs under `describe('<factory>')` in `test/unit/<concept>.error.spec.ts`,
984
+ rewrites every usage (`new X(..)` becomes `<Concept>Error.<factory>(..)`, `thenError(X)` becomes
985
+ `thenError('<CODE>')`, `toThrow(X)` and `expect.any(X)` an assertion on the code,
986
+ `toBeInstanceOf(X)` `toMatchObject({ code })`, `e instanceof X` `<Concept>Error.is(e, '<CODE>')`)
987
+ and sets `"stack.refusals": "factories"`. It leaves, and says: a class that has members of its
988
+ own, reads `this` in its constructor or gives options to `super`; a place where a class stood as
989
+ a value it cannot translate; a property of the error that became a fact (`error.personId` is now
990
+ `error.facts.personId`); a factory with more than three parameters; the factories that still
991
+ take a sentence as only parameter.
928
992
 
929
993
  ## build-aliases
930
994
 
@@ -1647,7 +1711,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1647
1711
  | `events/name-format` | an event name that is not `<context>.<aggregate>.<fact>` in kebab-case with the right context |
1648
1712
  | `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 |
1649
1713
  | `events/defined-in-published-language` | `defineIntegrationEvent` outside a published language, without a payload, twice for one version; an event described by hand |
1650
- | `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"`, an error class of `domain/errors/` too |
1714
+ | `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) |
1651
1715
  | `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"` |
1652
1716
  | `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 |
1653
1717
  | `purity/no-system-clock` | `new Date()` without argument, `Date.now()`, `performance.now()` in `domain/` or `application/` |
@@ -1701,10 +1765,11 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1701
1765
  | `ports/value-import` | a class named in a dependency list, or given to `bind` or `rebind`, imported with `import type` or `import { type X }` |
1702
1766
  | `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 |
1703
1767
  | `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 |
1704
- | `errors/code-unique` | under `"stack.refusals": "factories"`, in the `domain/errors/` of a context: a code set a second time, by a factory (`refusal('CODE', ..)`) or by a class (`readonly code = 'CODE'`), with the file and line of the first. The same code in two contexts is not reported |
1768
+ | `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 |
1769
+ | `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 |
1705
1770
  | `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 |
1706
1771
  | `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 |
1707
- | `errors/known-code` | under `"stack.refusals": "factories"`, in a `*.route.ts`: a code of the `errors` list that no refusal of the context of the route sets, that no class outside the contexts sets, and that is not a code of the kit |
1772
+ | `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 |
1708
1773
  | `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 |
1709
1774
 
1710
1775
  More ids belong to `@ddd-ts-kit/eslint-plugin`, which reads the syntax tree where this
@@ -3,6 +3,8 @@ export interface Role {
3
3
  readonly directory: string;
4
4
  /** Accepted file suffixes; empty when the role only requires kebab-case. */
5
5
  readonly suffixes: readonly string[];
6
+ /** Whole file names the role accepts besides its suffixes: the code list `codes.ts` of `domain/errors`. */
7
+ readonly files?: readonly string[];
6
8
  /** Counted by naming/one-concept-per-file when true. */
7
9
  readonly oneConcept?: boolean;
8
10
  /** Suffixes whose files need a spec (test/spec-required). */
@@ -1 +1 @@
1
- {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/role.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,wDAAwD;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC"}
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/role.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,wDAAwD;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC"}
@@ -6,7 +6,7 @@ export const ROLES = [
6
6
  { directory: 'domain/value-objects', suffixes: ['.vo.ts'], oneConcept: true, specFor: ['.vo.ts'] },
7
7
  { directory: 'domain/vocabularies', suffixes: ['.vocabulary.ts'], oneConcept: true },
8
8
  { directory: 'domain/events', suffixes: ['.event.ts'], oneConcept: true },
9
- { directory: 'domain/errors', suffixes: ['.error.ts'] },
9
+ { directory: 'domain/errors', suffixes: ['.error.ts'], files: ['codes.ts'] },
10
10
  { directory: 'domain/repositories', suffixes: ['.repository.ts'] },
11
11
  { directory: 'domain/services', suffixes: ['.service.ts'], specFor: ['.service.ts'] },
12
12
  {
@@ -1 +1 @@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EAAE;IACnH,EAAE,SAAS,EAAE,yBAAyB,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtD,EAAE,SAAS,EAAE,gCAAgC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7D,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,CAAC,EAAE;IACtG,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;IAClE,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvD;QACE,SAAS,EAAE,uBAAuB;QAClC,QAAQ,EAAE;YACR,gBAAgB;YAChB,YAAY;YACZ,WAAW;YACX,aAAa;YACb,UAAU;YACV,cAAc;YACd,YAAY;YACZ,UAAU;YACV,YAAY;YACZ,gBAAgB;SACjB;KACF;IACD,EAAE,SAAS,EAAE,kBAAkB,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/C,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,aAAa,CAAC,EAAE;IACzD,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE;CACtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA2F7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA0F7C,CAAC"}
1
+ {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA4F7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA2F7C,CAAC"}
@@ -30,6 +30,7 @@ import { declarationsRoleDeclared } from '../rules/declarations-role-declared.js
30
30
  import { domainEventsDispatchedOnSave } from '../rules/domain-events-dispatched-on-save.js';
31
31
  import { domainEventsTransactionalBeforeCommit } from '../rules/domain-events-transactional-before-commit.js';
32
32
  import { domainValueObjectClass } from '../rules/domain-value-object-class.js';
33
+ import { errorsCodeListed } from '../rules/errors-code-listed.js';
33
34
  import { errorsCodeUnique } from '../rules/errors-code-unique.js';
34
35
  import { eventSourcingPastTense } from '../rules/event-sourcing-past-tense.js';
35
36
  import { eventSourcingProjectionNeverAppends } from '../rules/event-sourcing-projection-never-appends.js';
@@ -173,6 +174,7 @@ export const ARCHITECTURE_RULES = [
173
174
  importsExtension,
174
175
  importsAliasDeclared,
175
176
  errorsCodeUnique,
177
+ errorsCodeListed,
176
178
  errorsKnownCode,
177
179
  persistenceMigrationHistory,
178
180
  persistenceNoFileContent,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE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C;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,4BAA4B;IAC5B,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,0BAA0B;IAC1B,qBAAqB;CACtB,CAAC"}
1
+ {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAA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,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,4BAA4B;IAC5B,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,0BAA0B;IAC1B,qBAAqB;CACtB,CAAC"}
@@ -17,15 +17,15 @@ export const ESLINT_ONLY_RULES = [
17
17
  },
18
18
  {
19
19
  id: 'errors/through-factory',
20
- description: 'Under "stack.refusals": "factories", a domain error is built by a static factory of its concept class: no `new` of a class of domain/errors/ outside that class.',
20
+ description: 'Under "stack.refusals": "factories" or "named", a domain error is built by a static factory of its class: no `new` of a class of domain/errors/ outside that class, nor of a class extending DomainRefusal.',
21
21
  },
22
22
  {
23
23
  id: 'errors/constructor-not-public',
24
- description: 'Under "stack.refusals": "factories", the constructor of an error class of domain/errors/ is not public: the class extends ConceptError and declares none, or declares it private or protected.',
24
+ description: 'Under "stack.refusals": "factories" or "named", the constructor of an error class of domain/errors/ is not public: the class extends ConceptError or DomainRefusal and declares none, or declares it private or protected.',
25
25
  },
26
26
  {
27
27
  id: 'errors/factory-name',
28
- description: 'Under "stack.refusals": "factories", a static factory of an error class is named after the refusal, never `create`, `make`, `of` or `error1`, and its code is that name in constant case, alone or with the name of the concept.',
28
+ description: 'Under "stack.refusals": "factories", a static factory of an error class is named after the refusal, never `create`, `make`, `of` or `error1`, and its code is that name in constant case, alone or with the name of the concept. Under "named", the class is named after the refusal, never `...Error`, and a factory after what the refusal is about: for, with, because, on or at, then an upper-case letter, no digit.',
29
29
  },
30
30
  {
31
31
  id: 'clean/no-magic-number',
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-only-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqE;IACjG;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,0GAA0G;KAC7G;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EAAE,kGAAkG;KAChH;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,sGAAsG;KACpH;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EACT,kKAAkK;KACrK;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,gMAAgM;KACnM;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,WAAW,EACT,kOAAkO;KACrO;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,WAAW,EACT,gLAAgL;KACnL;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,WAAW,EAAE,6EAA6E;KAC3F;IACD,EAAE,EAAE,EAAE,sCAAsC,EAAE,WAAW,EAAE,oDAAoD,EAAE;IACjH;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,sHAAsH;KACzH;IACD;QACE,EAAE,EAAE,mCAAmC;QACvC,WAAW,EACT,kKAAkK;KACrK;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EACT,wMAAwM;KAC3M;IACD;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,uHAAuH;KAC1H;CACF,CAAC"}
1
+ {"version":3,"file":"eslint-only-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqE;IACjG;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,0GAA0G;KAC7G;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EAAE,kGAAkG;KAChH;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,sGAAsG;KACpH;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EACT,6MAA6M;KAChN;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,4NAA4N;KAC/N;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,WAAW,EACT,2ZAA2Z;KAC9Z;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,WAAW,EACT,gLAAgL;KACnL;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,WAAW,EAAE,6EAA6E;KAC3F;IACD,EAAE,EAAE,EAAE,sCAAsC,EAAE,WAAW,EAAE,oDAAoD,EAAE;IACjH;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,sHAAsH;KACzH;IACD;QACE,EAAE,EAAE,mCAAmC;QACvC,WAAW,EACT,kKAAkK;KACrK;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EACT,wMAAwM;KAC3M;IACD;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,uHAAuH;KAC1H;CACF,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import type { Project } from '../model/project.js';
2
- /** The `errors/*` rules judge a project that says it builds its refusals through factories; one that does not say keeps the form of 0.2. */
2
+ /**
3
+ * The `errors/*` rules judge a project that says it builds its refusals through factories, of a
4
+ * class per concept (`factories`) or of a class per refusal (`named`); one that does not say keeps the form of 0.2.
5
+ */
3
6
  export declare function buildsThroughFactories(project: Project): boolean;
4
7
  //# sourceMappingURL=builds-through-factories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builds-through-factories.d.ts","sourceRoot":"","sources":["../../../src/check/errors/builds-through-factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,4IAA4I;AAC5I,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEhE"}
1
+ {"version":3,"file":"builds-through-factories.d.ts","sourceRoot":"","sources":["../../../src/check/errors/builds-through-factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAIhE"}
@@ -1,5 +1,9 @@
1
- /** The `errors/*` rules judge a project that says it builds its refusals through factories; one that does not say keeps the form of 0.2. */
1
+ /**
2
+ * The `errors/*` rules judge a project that says it builds its refusals through factories, of a
3
+ * class per concept (`factories`) or of a class per refusal (`named`); one that does not say keeps the form of 0.2.
4
+ */
2
5
  export function buildsThroughFactories(project) {
3
- return project.config.stack.refusals === 'factories';
6
+ const { refusals } = project.config.stack;
7
+ return refusals === 'factories' || refusals === 'named';
4
8
  }
5
9
  //# sourceMappingURL=builds-through-factories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builds-through-factories.js","sourceRoot":"","sources":["../../../src/check/errors/builds-through-factories.ts"],"names":[],"mappings":"AAEA,4IAA4I;AAC5I,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,WAAW,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"builds-through-factories.js","sourceRoot":"","sources":["../../../src/check/errors/builds-through-factories.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAE1C,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,OAAO,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** One entry of the code list of a context: the refusal class it names, and the code it gives it. */
2
+ export interface CodeEntry {
3
+ readonly key: string;
4
+ /** The code when it is written as one string literal; undefined for anything else. */
5
+ readonly code: string | undefined;
6
+ readonly line: number;
7
+ }
8
+ //# sourceMappingURL=code-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-entry.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-entry.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=code-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-entry.js","sourceRoot":"","sources":["../../../src/check/errors/code-entry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** The name of the code list of a context: `SchedulingCodes` for `scheduling`, `OrderTakingCodes` for `order-taking`. */
2
+ export declare function codeListName(context: string): string;
3
+ //# sourceMappingURL=code-list-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-list-name.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-list-name.ts"],"names":[],"mappings":"AAEA,yHAAyH;AACzH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,6 @@
1
+ import { toName } from '../../naming/index.js';
2
+ /** The name of the code list of a context: `SchedulingCodes` for `scheduling`, `OrderTakingCodes` for `order-taking`. */
3
+ export function codeListName(context) {
4
+ return `${toName(context).pascal}Codes`;
5
+ }
6
+ //# sourceMappingURL=code-list-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-list-name.js","sourceRoot":"","sources":["../../../src/check/errors/code-list-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,yHAAyH;AACzH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,10 @@
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`. */
3
+ export interface CodeList {
4
+ readonly name: string;
5
+ readonly line: number;
6
+ /** True when the object is declared `as const`, which keeps each code its own literal type. */
7
+ readonly constant: boolean;
8
+ readonly entries: readonly CodeEntry[];
9
+ }
10
+ //# sourceMappingURL=code-list.d.ts.map
@@ -0,0 +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,iBAAiB,CAAC;AAEjD,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=code-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-list.js","sourceRoot":"","sources":["../../../src/check/errors/code-list.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { SourceFile } from '../model/source-file.js';
2
+ import type { ErrorCode } from './error-code.js';
3
+ /**
4
+ * Every code a source sets: those its refusals give themselves, and, for the code list of a
5
+ * context, those it holds. A refusal class sets its code through that list only: a code it writes
6
+ * another way is the business of `errors/code-listed`, and would else count twice.
7
+ */
8
+ export declare function codesSetIn(file: SourceFile): ErrorCode[];
9
+ //# sourceMappingURL=codes-set-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes-set-in.d.ts","sourceRoot":"","sources":["../../../src/check/errors/codes-set-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,CAMxD"}
@@ -0,0 +1,15 @@
1
+ import { errorCodes } from './error-codes.js';
2
+ import { listedCodes } from './listed-codes.js';
3
+ import { refusalClasses } from './refusal-classes.js';
4
+ /**
5
+ * Every code a source sets: those its refusals give themselves, and, for the code list of a
6
+ * context, those it holds. A refusal class sets its code through that list only: a code it writes
7
+ * another way is the business of `errors/code-listed`, and would else count twice.
8
+ */
9
+ export function codesSetIn(file) {
10
+ const { scan } = file;
11
+ const named = refusalClasses(scan).map((shape) => ({ from: shape.line, to: scan.lineAt(shape.end) }));
12
+ const own = errorCodes(scan).filter(({ line }) => !named.some(({ from, to }) => line >= from && line <= to));
13
+ return [...own, ...listedCodes(file)].sort((a, b) => a.line - b.line);
14
+ }
15
+ //# sourceMappingURL=codes-set-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes-set-in.js","sourceRoot":"","sources":["../../../src/check/errors/codes-set-in.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACtG,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAE7G,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC"}
@@ -3,6 +3,8 @@ import type { ErrorCode } from './error-code.js';
3
3
  /**
4
4
  * The codes a source gives to its refusals, in both forms: the first argument of
5
5
  * `.refusal('CODE', ..)` in a factory, and the `readonly code = 'CODE'` field of a class per error.
6
+ * The factories of a `DomainRefusal` give `refusal(..)` the message, never the code: their class
7
+ * reads its code from the list of its context, which `listedCodes` reads.
6
8
  */
7
9
  export declare function errorCodes(scan: Scan): ErrorCode[];
8
10
  //# sourceMappingURL=error-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../../src/check/errors/error-codes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,CAelD"}
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../../src/check/errors/error-codes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,CAwBlD"}
@@ -1,13 +1,21 @@
1
1
  import { wholeLiteral } from '../declarations/whole-literal.js';
2
2
  import { callArguments } from '../text/call-arguments.js';
3
+ import { refusalClasses } from './refusal-classes.js';
3
4
  const REFUSAL_CALL = /\.\s*refusal\s*\(/g;
4
5
  const CODE_FIELD = /\breadonly\s+code\s*(?::[^=;]+)?=\s*/g;
5
6
  /**
6
7
  * The codes a source gives to its refusals, in both forms: the first argument of
7
8
  * `.refusal('CODE', ..)` in a factory, and the `readonly code = 'CODE'` field of a class per error.
9
+ * The factories of a `DomainRefusal` give `refusal(..)` the message, never the code: their class
10
+ * reads its code from the list of its context, which `listedCodes` reads.
8
11
  */
9
12
  export function errorCodes(scan) {
13
+ const named = refusalClasses(scan);
14
+ const inNamedRefusal = (offset) => named.some((shape) => offset > shape.bodyStart && offset < shape.end);
10
15
  const built = [...scan.code.matchAll(REFUSAL_CALL)].flatMap((match) => {
16
+ if (inNamedRefusal(match.index)) {
17
+ return [];
18
+ }
11
19
  const [code] = callArguments(scan.code, match.index + match[0].length - 1);
12
20
  const literal = code === undefined ? undefined : wholeLiteral(scan, code);
13
21
  return literal === undefined ? [] : [{ code: literal, line: scan.lineAt(match.index) }];