ddd-ts-kit 0.82.0 → 0.83.1

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 (479) hide show
  1. package/CHANGELOG.md +103 -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/stack/resolve-stack.js +2 -2
  215. package/dist/init/stack/resolve-stack.js.map +1 -1
  216. package/dist/presets/identity-refusal.js +1 -1
  217. package/dist/presets/identity-refusal.js.map +1 -1
  218. package/dist/presets/identity-terms.d.ts.map +1 -1
  219. package/dist/presets/identity-terms.js +30 -0
  220. package/dist/presets/identity-terms.js.map +1 -1
  221. package/dist/presets/preset-files.d.ts.map +1 -1
  222. package/dist/presets/preset-files.js +4 -1
  223. package/dist/presets/preset-files.js.map +1 -1
  224. package/dist/refusals/aggregates-of.d.ts +10 -0
  225. package/dist/refusals/aggregates-of.d.ts.map +1 -0
  226. package/dist/refusals/aggregates-of.js +9 -0
  227. package/dist/refusals/aggregates-of.js.map +1 -0
  228. package/dist/refusals/applied-moves.d.ts +7 -0
  229. package/dist/refusals/applied-moves.d.ts.map +1 -0
  230. package/dist/refusals/applied-moves.js +2 -0
  231. package/dist/refusals/applied-moves.js.map +1 -0
  232. package/dist/refusals/apply-named-plan.d.ts +19 -0
  233. package/dist/refusals/apply-named-plan.d.ts.map +1 -0
  234. package/dist/refusals/apply-named-plan.js +46 -0
  235. package/dist/refusals/apply-named-plan.js.map +1 -0
  236. package/dist/refusals/apply-plan.d.ts.map +1 -1
  237. package/dist/refusals/apply-plan.js +21 -25
  238. package/dist/refusals/apply-plan.js.map +1 -1
  239. package/dist/refusals/code-without-imports.d.ts +3 -0
  240. package/dist/refusals/code-without-imports.d.ts.map +1 -0
  241. package/dist/refusals/code-without-imports.js +9 -0
  242. package/dist/refusals/code-without-imports.js.map +1 -0
  243. package/dist/refusals/concept-error-class.d.ts +26 -0
  244. package/dist/refusals/concept-error-class.d.ts.map +1 -0
  245. package/dist/refusals/concept-error-class.js +2 -0
  246. package/dist/refusals/concept-error-class.js.map +1 -0
  247. package/dist/refusals/concept-errors.d.ts +6 -0
  248. package/dist/refusals/concept-errors.d.ts.map +1 -0
  249. package/dist/refusals/concept-errors.js +16 -0
  250. package/dist/refusals/concept-errors.js.map +1 -0
  251. package/dist/refusals/concept-imports.d.ts +8 -0
  252. package/dist/refusals/concept-imports.d.ts.map +1 -0
  253. package/dist/refusals/concept-imports.js +33 -0
  254. package/dist/refusals/concept-imports.js.map +1 -0
  255. package/dist/refusals/concept-leftovers.d.ts +5 -0
  256. package/dist/refusals/concept-leftovers.d.ts.map +1 -0
  257. package/dist/refusals/concept-leftovers.js +26 -0
  258. package/dist/refusals/concept-leftovers.js.map +1 -0
  259. package/dist/refusals/concept-named.d.ts +3 -0
  260. package/dist/refusals/concept-named.d.ts.map +1 -0
  261. package/dist/refusals/concept-named.js +13 -0
  262. package/dist/refusals/concept-named.js.map +1 -0
  263. package/dist/refusals/concerns.d.ts +16 -0
  264. package/dist/refusals/concerns.d.ts.map +1 -0
  265. package/dist/refusals/concerns.js +9 -0
  266. package/dist/refusals/concerns.js.map +1 -0
  267. package/dist/refusals/cut-factories.d.ts +7 -0
  268. package/dist/refusals/cut-factories.d.ts.map +1 -0
  269. package/dist/refusals/cut-factories.js +30 -0
  270. package/dist/refusals/cut-factories.js.map +1 -0
  271. package/dist/refusals/earlier-guidance.d.ts +8 -0
  272. package/dist/refusals/earlier-guidance.d.ts.map +1 -0
  273. package/dist/refusals/earlier-guidance.js +21 -0
  274. package/dist/refusals/earlier-guidance.js.map +1 -0
  275. package/dist/refusals/factory-for-parameter.d.ts +7 -0
  276. package/dist/refusals/factory-for-parameter.d.ts.map +1 -0
  277. package/dist/refusals/factory-for-parameter.js +17 -0
  278. package/dist/refusals/factory-for-parameter.js.map +1 -0
  279. package/dist/refusals/first-parameter.d.ts +6 -0
  280. package/dist/refusals/first-parameter.d.ts.map +1 -0
  281. package/dist/refusals/first-parameter.js +12 -0
  282. package/dist/refusals/first-parameter.js.map +1 -0
  283. package/dist/refusals/ignore-code-types.d.ts +10 -0
  284. package/dist/refusals/ignore-code-types.d.ts.map +1 -0
  285. package/dist/refusals/ignore-code-types.js +53 -0
  286. package/dist/refusals/ignore-code-types.js.map +1 -0
  287. package/dist/refusals/imports-used-by.d.ts +6 -0
  288. package/dist/refusals/imports-used-by.d.ts.map +1 -0
  289. package/dist/refusals/imports-used-by.js +32 -0
  290. package/dist/refusals/imports-used-by.js.map +1 -0
  291. package/dist/refusals/leave-origins.d.ts +10 -0
  292. package/dist/refusals/leave-origins.d.ts.map +1 -0
  293. package/dist/refusals/leave-origins.js +35 -0
  294. package/dist/refusals/leave-origins.js.map +1 -0
  295. package/dist/refusals/legacy-move.d.ts +5 -0
  296. package/dist/refusals/legacy-move.d.ts.map +1 -0
  297. package/dist/refusals/legacy-move.js +14 -0
  298. package/dist/refusals/legacy-move.js.map +1 -0
  299. package/dist/refusals/markdown-files.d.ts +4 -0
  300. package/dist/refusals/markdown-files.d.ts.map +1 -0
  301. package/dist/refusals/markdown-files.js +13 -0
  302. package/dist/refusals/markdown-files.js.map +1 -0
  303. package/dist/refusals/member-start.d.ts +3 -0
  304. package/dist/refusals/member-start.d.ts.map +1 -0
  305. package/dist/refusals/member-start.js +14 -0
  306. package/dist/refusals/member-start.js.map +1 -0
  307. package/dist/refusals/migration-targets.d.ts +3 -0
  308. package/dist/refusals/migration-targets.d.ts.map +1 -0
  309. package/dist/refusals/migration-targets.js +3 -0
  310. package/dist/refusals/migration-targets.js.map +1 -0
  311. package/dist/refusals/move-named-specs.d.ts +16 -0
  312. package/dist/refusals/move-named-specs.d.ts.map +1 -0
  313. package/dist/refusals/move-named-specs.js +119 -0
  314. package/dist/refusals/move-named-specs.js.map +1 -0
  315. package/dist/refusals/move.d.ts +6 -1
  316. package/dist/refusals/move.d.ts.map +1 -1
  317. package/dist/refusals/named-move.d.ts +23 -0
  318. package/dist/refusals/named-move.d.ts.map +1 -0
  319. package/dist/refusals/named-move.js +2 -0
  320. package/dist/refusals/named-move.js.map +1 -0
  321. package/dist/refusals/named-moves.d.ts +10 -0
  322. package/dist/refusals/named-moves.d.ts.map +1 -0
  323. package/dist/refusals/named-moves.js +64 -0
  324. package/dist/refusals/named-moves.js.map +1 -0
  325. package/dist/refusals/named-plan.d.ts +7 -0
  326. package/dist/refusals/named-plan.d.ts.map +1 -0
  327. package/dist/refusals/named-plan.js +2 -0
  328. package/dist/refusals/named-plan.js.map +1 -0
  329. package/dist/refusals/own-factory.d.ts +14 -0
  330. package/dist/refusals/own-factory.d.ts.map +1 -0
  331. package/dist/refusals/own-factory.js +38 -0
  332. package/dist/refusals/own-factory.js.map +1 -0
  333. package/dist/refusals/plan-target.d.ts +7 -0
  334. package/dist/refusals/plan-target.d.ts.map +1 -0
  335. package/dist/refusals/plan-target.js +13 -0
  336. package/dist/refusals/plan-target.js.map +1 -0
  337. package/dist/refusals/planned-refusal.d.ts +13 -0
  338. package/dist/refusals/planned-refusal.d.ts.map +1 -0
  339. package/dist/refusals/planned-refusal.js +2 -0
  340. package/dist/refusals/planned-refusal.js.map +1 -0
  341. package/dist/refusals/propose-named-plan.d.ts +25 -0
  342. package/dist/refusals/propose-named-plan.d.ts.map +1 -0
  343. package/dist/refusals/propose-named-plan.js +67 -0
  344. package/dist/refusals/propose-named-plan.js.map +1 -0
  345. package/dist/refusals/propose-plan.d.ts.map +1 -1
  346. package/dist/refusals/propose-plan.js +3 -19
  347. package/dist/refusals/propose-plan.js.map +1 -1
  348. package/dist/refusals/read-concept-error.d.ts +9 -0
  349. package/dist/refusals/read-concept-error.d.ts.map +1 -0
  350. package/dist/refusals/read-concept-error.js +51 -0
  351. package/dist/refusals/read-concept-error.js.map +1 -0
  352. package/dist/refusals/read-named-plan.d.ts +4 -0
  353. package/dist/refusals/read-named-plan.d.ts.map +1 -0
  354. package/dist/refusals/read-named-plan.js +57 -0
  355. package/dist/refusals/read-named-plan.js.map +1 -0
  356. package/dist/refusals/refusal-class-file.d.ts +15 -0
  357. package/dist/refusals/refusal-class-file.d.ts.map +1 -0
  358. package/dist/refusals/refusal-class-file.js +38 -0
  359. package/dist/refusals/refusal-class-file.js.map +1 -0
  360. package/dist/refusals/rename-concept.d.ts +7 -0
  361. package/dist/refusals/rename-concept.d.ts.map +1 -0
  362. package/dist/refusals/rename-concept.js +15 -0
  363. package/dist/refusals/rename-concept.js.map +1 -0
  364. package/dist/refusals/render-factory.d.ts +1 -1
  365. package/dist/refusals/render-factory.d.ts.map +1 -1
  366. package/dist/refusals/render-factory.js +3 -2
  367. package/dist/refusals/render-factory.js.map +1 -1
  368. package/dist/refusals/rewrite-concept-usages.d.ts +11 -0
  369. package/dist/refusals/rewrite-concept-usages.d.ts.map +1 -0
  370. package/dist/refusals/rewrite-concept-usages.js +61 -0
  371. package/dist/refusals/rewrite-concept-usages.js.map +1 -0
  372. package/dist/refusals/rewrite-named-usages.d.ts +9 -0
  373. package/dist/refusals/rewrite-named-usages.d.ts.map +1 -0
  374. package/dist/refusals/rewrite-named-usages.js +14 -0
  375. package/dist/refusals/rewrite-named-usages.js.map +1 -0
  376. package/dist/refusals/rewrite-usages.d.ts.map +1 -1
  377. package/dist/refusals/rewrite-usages.js +10 -6
  378. package/dist/refusals/rewrite-usages.js.map +1 -1
  379. package/dist/refusals/say-refusals.d.ts +3 -0
  380. package/dist/refusals/say-refusals.d.ts.map +1 -0
  381. package/dist/refusals/say-refusals.js +8 -0
  382. package/dist/refusals/say-refusals.js.map +1 -0
  383. package/dist/refusals/split-concept-spec.d.ts +19 -0
  384. package/dist/refusals/split-concept-spec.d.ts.map +1 -0
  385. package/dist/refusals/split-concept-spec.js +74 -0
  386. package/dist/refusals/split-concept-spec.js.map +1 -0
  387. package/dist/refusals/stale-mentions.d.ts +10 -0
  388. package/dist/refusals/stale-mentions.d.ts.map +1 -0
  389. package/dist/refusals/stale-mentions.js +41 -0
  390. package/dist/refusals/stale-mentions.js.map +1 -0
  391. package/dist/refusals/undefined-words.d.ts +15 -0
  392. package/dist/refusals/undefined-words.d.ts.map +1 -0
  393. package/dist/refusals/undefined-words.js +26 -0
  394. package/dist/refusals/undefined-words.js.map +1 -0
  395. package/dist/refusals/with-codes.d.ts +11 -0
  396. package/dist/refusals/with-codes.d.ts.map +1 -0
  397. package/dist/refusals/with-codes.js +46 -0
  398. package/dist/refusals/with-codes.js.map +1 -0
  399. package/dist/refusals/with-imports.d.ts +3 -0
  400. package/dist/refusals/with-imports.d.ts.map +1 -0
  401. package/dist/refusals/with-imports.js +8 -0
  402. package/dist/refusals/with-imports.js.map +1 -0
  403. package/dist/refusals/write-refusal-classes.d.ts +9 -0
  404. package/dist/refusals/write-refusal-classes.d.ts.map +1 -0
  405. package/dist/refusals/write-refusal-classes.js +23 -0
  406. package/dist/refusals/write-refusal-classes.js.map +1 -0
  407. package/dist/stack/stack-vars.js +1 -1
  408. package/dist/stack/stack-vars.js.map +1 -1
  409. package/dist/version.d.ts +1 -1
  410. package/dist/version.js +1 -1
  411. package/package.json +2 -2
  412. package/templates/aggregate/aggregate.ts.tpl +3 -0
  413. package/templates/aggregate/event-sourced.aggregate.ts.tpl +3 -0
  414. package/templates/command/handler.declared.ts.tpl +3 -0
  415. package/templates/command/handler.ts.tpl +3 -0
  416. package/templates/entity/entity.ts.tpl +3 -0
  417. package/templates/error/codes.ts.tpl +5 -0
  418. package/templates/error/refusal-case.spec.ts.tpl +8 -0
  419. package/templates/error/refusal-factory.ts.tpl +4 -0
  420. package/templates/error/refusal.spec.ts.tpl +7 -0
  421. package/templates/error/refusal.ts.tpl +8 -0
  422. package/templates/init/rules/domain.md.tpl +9 -2
  423. package/templates/init/rules/presentation.md.tpl +3 -0
  424. package/templates/pipeline/knip.json.tpl +5 -0
  425. package/templates/pipeline/package-scripts.json +1 -1
  426. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +22 -0
  427. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +16 -0
  428. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +16 -0
  429. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +16 -0
  430. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +10 -0
  431. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +16 -0
  432. package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +10 -0
  433. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +16 -0
  434. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +10 -0
  435. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +10 -0
  436. package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +16 -0
  437. package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +28 -0
  438. package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +27 -0
  439. package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +31 -0
  440. package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +13 -0
  441. package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +10 -0
  442. package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +13 -0
  443. package/templates/presets/identity/context/domain/errors/codes.named.ts.tpl +33 -0
  444. package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +10 -0
  445. package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +10 -0
  446. package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +13 -0
  447. package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +10 -0
  448. package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +12 -0
  449. package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +10 -0
  450. package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +13 -0
  451. package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +10 -0
  452. package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +10 -0
  453. package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +10 -0
  454. package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +13 -0
  455. package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +13 -0
  456. package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +13 -0
  457. package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +13 -0
  458. package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +12 -0
  459. package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +10 -0
  460. package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +10 -0
  461. package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +12 -0
  462. package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +12 -0
  463. package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +12 -0
  464. package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +10 -0
  465. package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +11 -0
  466. package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +13 -0
  467. package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +12 -0
  468. package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +16 -0
  469. package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +10 -0
  470. package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +10 -0
  471. package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +10 -0
  472. package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +10 -0
  473. package/templates/state-machine/state-machine.ts.tpl +5 -0
  474. package/templates/value-object/value-object.ts.tpl +6 -0
  475. /package/templates/presets/identity/context/domain/errors/{account.error.ts.tpl → account.error.factories.ts.tpl} +0 -0
  476. /package/templates/presets/identity/context/domain/errors/{delegation.error.ts.tpl → delegation.error.factories.ts.tpl} +0 -0
  477. /package/templates/presets/identity/context/domain/errors/{invitation.error.ts.tpl → invitation.error.factories.ts.tpl} +0 -0
  478. /package/templates/presets/identity/context/domain/errors/{member.error.ts.tpl → member.error.factories.ts.tpl} +0 -0
  479. /package/templates/presets/identity/context/domain/errors/{organisation.error.ts.tpl → organisation.error.factories.ts.tpl} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,GA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EAAE,CAAC;AACtG,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc;IAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAE9B,OAAO;QACL,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5D,GAAG,EAAE,IAAI,KAAK,MAAM;QACpB,KAAK,EAAE,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.82.0";
1
+ export declare const VERSION = "0.83.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.82.0';
1
+ export const VERSION = '0.83.1';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-ts-kit",
3
- "version": "0.82.0",
3
+ "version": "0.83.1",
4
4
  "description": "Bootstrap, scaffold and verify Domain-Driven Design (DDD), Clean Architecture and hexagonal TypeScript backends on Node.js: project and code generators, architecture checks, OpenAPI and AsyncAPI documents, for developers and AI coding agents (Claude Code, Codex, GitHub Copilot).",
5
5
  "keywords": [
6
6
  "ddd",
@@ -52,6 +52,6 @@
52
52
  "clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../s3/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
53
53
  },
54
54
  "devDependencies": {
55
- "@ddd-ts-kit/kernel": "^0.82.0"
55
+ "@ddd-ts-kit/kernel": "^0.83.1"
56
56
  }
57
57
  }
@@ -14,6 +14,9 @@ export class {{name.pascal}} extends AggregateRoot<string> {
14
14
  }
15
15
 
16
16
  static create(id: string, now: Date): {{name.pascal}} {
17
+ {{#if refusals.named}}
18
+ // TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal named after it when one is violated: `throw <Refusal>.for<Fact>(...)`, written with `ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`.
19
+ {{/if}}
17
20
  {{#if refusals.factories}}
18
21
  // TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal of its error class when one is violated: `throw {{name.pascal}}Error.<refusal>(...)`, added with `ddd-ts-kit generate error {{context.kebab}} {{name.pascal}} <refusal>`.
19
22
  {{/if}}
@@ -16,6 +16,9 @@ export class {{name.pascal}} extends EventSourcedAggregate<{{name.pascal}}Event,
16
16
  }
17
17
 
18
18
  static create(id: string, now: Date): {{name.pascal}} {
19
+ {{#if refusals.named}}
20
+ // TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal named after it when one is violated: `throw <Refusal>.for<Fact>(...)`, written with `ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`.
21
+ {{/if}}
19
22
  {{#if refusals.factories}}
20
23
  // TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal of its error class when one is violated: `throw {{name.pascal}}Error.<refusal>(...)`, added with `ddd-ts-kit generate error {{context.kebab}} {{name.pascal}} <refusal>`.
21
24
  {{/if}}
@@ -28,6 +28,9 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
28
28
  await this.access.authorize(command.actor, {{access.reference}}, command);
29
29
 
30
30
  {{/if}}
31
+ {{#if refusals.named}}
32
+ // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its refusal when there is none, `Unknown{{aggregate.pascal}}.for{{aggregate.pascal}}(id)` (`ddd-ts-kit generate error {{context.kebab}} Unknown{{aggregate.pascal}} for{{aggregate.pascal}}`), call ONE intention method). The events it records leave with the save: nothing else to do here.
33
+ {{/if}}
31
34
  {{#if refusals.factories}}
32
35
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
33
36
  {{/if}}
@@ -26,6 +26,9 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
26
26
  await this.access.authorize(command.actor, {{access.reference}}, command);
27
27
 
28
28
  {{/if}}
29
+ {{#if refusals.named}}
30
+ // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its refusal when there is none, `Unknown{{aggregate.pascal}}.for{{aggregate.pascal}}(id)` (`ddd-ts-kit generate error {{context.kebab}} Unknown{{aggregate.pascal}} for{{aggregate.pascal}}`), call ONE intention method). The events it records leave with the save: nothing else to do here.
31
+ {{/if}}
29
32
  {{#if refusals.factories}}
30
33
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
31
34
  {{/if}}
@@ -13,6 +13,9 @@ export class {{name.pascal}} extends Entity<string> {
13
13
  }
14
14
 
15
15
  static create(id: string, state: {{name.pascal}}State): {{name.pascal}} {
16
+ {{#if refusals.named}}
17
+ // TODO(domain): check the invariants {{name.pascal}} guards on its own and throw the refusal named after one when it is violated (`ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`); invariants spanning several entities belong to the aggregate root.
18
+ {{/if}}
16
19
  {{#if refusals.factories}}
17
20
  // TODO(domain): check the invariants {{name.pascal}} guards on its own and throw a refusal of the error class of its aggregate when one is violated (`ddd-ts-kit generate error {{context.kebab}} <Concept> <refusal>`); invariants spanning several entities belong to the aggregate root.
18
21
  {{/if}}
@@ -0,0 +1,5 @@
1
+ export const {{codes.list}} = {
2
+ {{name.pascal}}: '{{error.code}}',
3
+ } as const;
4
+
5
+ export type {{codes.type}} = (typeof {{codes.list}})[keyof typeof {{codes.list}}];
@@ -0,0 +1,8 @@
1
+ it('refuses {{factory.words}} with the code {{error.code}}', () => {
2
+ const error = {{name.pascal}}.{{factory.camel}}();
3
+
4
+ expect(error).toBeInstanceOf(DomainRefusal);
5
+ expect(error.code).toBe('{{error.code}}');
6
+ expect(error.message).toBe('{{name.title}}.');
7
+ expect(error.facts).toEqual({});
8
+ });
@@ -0,0 +1,4 @@
1
+ static {{factory.camel}}() {
2
+ // TODO(domain): take as parameters what `{{factory.camel}}` names and the facts that explain the refusal (which {{context.words}} rule, which value), give them as the second argument and write a message a domain expert would recognise; a fact reaches the client only when named: `.exposing('<fact>')`. The code is the stable contract.
3
+ return {{name.pascal}}.refusal('{{name.title}}.');
4
+ }
@@ -0,0 +1,7 @@
1
+ import { describe, expect, it } from '{{tests.module}}';
2
+ import { DomainRefusal } from '@ddd-ts-kit/kernel';
3
+ import { {{name.pascal}} } from '{{alias.context}}/domain/errors/{{name.kebab}}.error{{alias.ext}}';
4
+
5
+ describe('{{name.pascal}}', () => {
6
+ {{error.case}}
7
+ });
@@ -0,0 +1,8 @@
1
+ import { DomainRefusal } from '@ddd-ts-kit/kernel';
2
+ import { {{codes.list}} } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
3
+
4
+ export class {{name.pascal}} extends DomainRefusal {
5
+ readonly code = {{codes.list}}.{{name.pascal}};
6
+
7
+ {{error.factory}}
8
+ }
@@ -15,6 +15,10 @@ paths:
15
15
  - A closed list of values (a status, a kind, a role of the model) is a vocabulary, `npx ddd-ts-kit generate vocabulary <context> <Name> --value <value>...`: code reads `AppointmentStatus.NoShow`, never the string (`language/declared-vocabulary`).
16
16
  - No number without a name: 0, 1, -1 and an index only; a duration, a limit or a rate is a constant of the module (`const MINUTES_PER_HOUR = 60;`) or a value object (`clean/no-magic-number`).
17
17
  {{/if}}
18
+ {{#if refusals.named}}
19
+ - A violated invariant throws a refusal built by a static factory of the class named after it, never `new` and never a bare `Error`: `throw InvoiceAlreadyIssued.forInvoice(this.id)` (`errors/through-factory`, `domain/no-generic-error`). One class per refusal in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal`, named after what is refused and never `...Error`, no constructor (`errors/constructor-not-public`); a factory is named after what the refusal is about, `for`, `with`, `because`, `on` or `at` then a capital letter, no digit: `forInvoice`, `withNotice`, `becauseOf` (`errors/factory-name`). The class reads its code from the closed list of its context, `domain/errors/codes.ts`, `readonly code = BillingCodes.InvoiceAlreadyIssued;`: one entry per refusal class and no other, in constant case (`errors/code-listed`), one code per refusal (`errors/code-unique`). The code is the contract a client reads: a renamed class keeps it.
20
+ - A factory takes the facts of the refusal as typed parameters and gives them to `refusal(message, facts)`. Facts are private: one reaches a client only when the factory names it, `.exposing('<fact>')`, and never when it identifies a person. A caught refusal is recognised with `InvoiceAlreadyIssued.is(error)`.
21
+ {{/if}}
18
22
  {{#if refusals.factories}}
19
23
  - A violated invariant throws a refusal built by a static factory of the error class of its concept, never `new` and never a bare `Error`: `throw InvoiceError.alreadyIssued(this.id)` (`errors/through-factory`, `domain/no-generic-error`). One class per concept of the glossary in `domain/errors/`, extending `ConceptError`, no constructor (`errors/constructor-not-public`); a factory is named after the refusal and its code says the same words (`errors/factory-name`), one code per refusal of the context (`errors/code-unique`).
20
24
  - A factory takes the facts of the refusal as typed parameters and gives them to `refusal(code, message, facts)`. Facts are private: one reaches a client only when the factory names it, `.exposing('<fact>')`, and never when it identifies a person.
@@ -23,16 +27,19 @@ paths:
23
27
  - A violated invariant throws a `DomainError` of `domain/errors/` with a stable `code`, never a bare `Error` (`domain/no-generic-error`).
24
28
  {{/if}}
25
29
  {{#if valueObjects.throwing}}
26
- - A value object refuses in `create` as the rest of the domain does: it returns the value object or throws the refusal of the concept it describes{{#if refusals.factories}} (`throw PersonError.invalidEmail(raw)`){{/if}}. The caller takes the value as it is, with no `unwrap`; a spec asserts the refusal with `expectRefusal(() => Email.create(raw), 'INVALID_EMAIL')`.
30
+ - A value object refuses in `create` as the rest of the domain does: it returns the value object or throws the refusal of the concept it describes{{#if refusals.named}} (`throw InvalidEmail.forAddress(raw)`){{/if}}{{#if refusals.factories}} (`throw PersonError.invalidEmail(raw)`){{/if}}. The caller takes the value as it is, with no `unwrap`; a spec asserts the refusal with `expectRefusal(() => Email.create(raw), 'INVALID_EMAIL')`.
27
31
  {{/if}}
28
32
  {{#if valueObjects.result}}
29
- - A value object returns its refusals in the `Result` of `create`{{#if refusals.factories}}: `err(PersonError.invalidEmail(raw))`{{/if}}; the caller unwraps it with `unwrap(..)` of the kernel. `npx ddd-ts-kit value-objects` moves the project to factories that throw.
33
+ - A value object returns its refusals in the `Result` of `create`{{#if refusals.named}}: `err(InvalidEmail.forAddress(raw))`{{/if}}{{#if refusals.factories}}: `err(PersonError.invalidEmail(raw))`{{/if}}; the caller unwraps it with `unwrap(..)` of the kernel. `npx ddd-ts-kit value-objects` moves the project to factories that throw.
30
34
  {{/if}}
31
35
  - Domain events are named in the past tense, `<context>.<aggregate>.<fact>` (`events/name-format`), declared once on the class, `static readonly eventName`, which `readonly name` reads (`events/name-declared-once`), and recorded by the aggregate (`this.record(...)`). They leave with the save: nothing here dispatches them.
32
36
  - An aggregate whose history is the business can be event-sourced, chosen per aggregate (`generate aggregate <context> <Name> --event-sourced`): it extends `EventSourcedAggregate`, a command checks the invariants then `this.record(...)`, and only its `apply<Fact>` methods (and `restore`, for a snapshot) change the state (`event-sourcing/state-in-apply`). Its events are named in the past tense (`event-sourcing/past-tense`). The other aggregates keep their state in tables.
33
37
  - A repository here is a port: an abstract class extending the kernel `Repository<Aggregate>`, abstract members only (`ports/abstract-class`). A domain service is stateless.
34
38
  - Time and identifiers come in as parameters (`purity/*`); nothing here knows the acting user or its rights (`authz/in-application`).
35
39
  - One concept per file, with the suffix of its role: `.aggregate.ts`, `.entity.ts`, `.vo.ts`, `.vocabulary.ts`, `.event.ts`, `.error.ts`, `.repository.ts`, `.service.ts` (`naming/suffix`, `naming/one-concept-per-file`).
40
+ {{#if refusals.named}}
41
+ - The language first, with `/ddd-ts-kit:glossary`. Then create with `npx ddd-ts-kit generate aggregate|entity|value-object|vocabulary|domain-event|domain-service|repository ... --json`, a refusal with `npx ddd-ts-kit generate error <context> <Refusal> <factory> --json` (it writes the class and its code in `codes.ts` when absent, adds the factory, and its case to the spec), and fill the `TODO(domain)` places it lists.
42
+ {{/if}}
36
43
  {{#if refusals.factories}}
37
44
  - The language first, with `/ddd-ts-kit:glossary`. Then create with `npx ddd-ts-kit generate aggregate|entity|value-object|vocabulary|domain-event|domain-service|repository ... --json`, a refusal with `npx ddd-ts-kit generate error <context> <Concept> <refusal> --json` (it adds the factory to the class of the concept, and its case to the spec), and fill the `TODO(domain)` places it lists.
38
45
  {{/if}}
@@ -21,6 +21,9 @@ paths:
21
21
  {{/if}}
22
22
  - Imports `application/` (and domain types for mapping), never `infrastructure/` (`layer/presentation-no-infrastructure`).
23
23
  - Input shape is validated here with the schema library of the project, behind the `Schema` port. Business rules are not validated here.
24
+ {{#if refusals.named}}
25
+ - Every route says who may call it (its group or its guards for a controller, `security` for a function) and the codes of the refusals it can answer in `errors`, as the `codes.ts` of its context lists them (`errors/known-code`); the mapping from code to status lives in one place, the error mapper. A client reads the `code`, under `facts` only what a factory exposed, and the message of the refusal as `detail` unless it quotes a fact that is not exposed.
26
+ {{/if}}
24
27
  {{#if refusals.factories}}
25
28
  - Every route says who may call it (its group or its guards for a controller, `security` for a function) and the codes of the refusals it can answer in `errors`, as their factories set them (`errors/known-code`); the mapping from code to status lives in one place, the error mapper. A client reads the `code`, under `facts` only what a factory exposed, and the message of the refusal as `detail` unless it quotes a fact that is not exposed.
26
29
  {{/if}}
@@ -15,6 +15,11 @@
15
15
  "ignoreDependencies": {{knip.ignored}},
16
16
  {{/if}}
17
17
  "ignoreExportsUsedInFile": true,
18
+ {{#if refusals.named}}
19
+ "ignoreIssues": {
20
+ "{{config.contextsDir}}/*/domain/errors/codes.ts": ["types"]
21
+ },
22
+ {{/if}}
18
23
  "vitest": {
19
24
  "config": ["vitest.config.ts"{{knip.e2eConfig}}],
20
25
  "entry": [
@@ -23,7 +23,7 @@
23
23
  "@biomejs/biome": "2.5.15",
24
24
  "@commitlint/cli": "^21.2.3",
25
25
  "@commitlint/config-conventional": "^21.2.3",
26
- "@ddd-ts-kit/eslint-plugin": "^0.82.0",
26
+ "@ddd-ts-kit/eslint-plugin": "^0.83.1",
27
27
  "@eslint/js": "^10.0.1",
28
28
  "@typescript/native": "npm:typescript@~7.0.2",
29
29
  "@vitest/coverage-v8": "5.0.3",
@@ -1,9 +1,16 @@
1
1
  import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
2
2
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
3
3
  import { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
4
+ {{#unless refusals.named}}
4
5
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
5
6
  import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
6
7
  import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
8
+ {{/unless}}
9
+ {{#if refusals.named}}
10
+ import { AlreadyMember } from '{{alias.context}}/domain/errors/already-member.error{{alias.ext}}';
11
+ import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
12
+ import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
13
+ {{/if}}
7
14
  import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
8
15
  import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
9
16
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
@@ -27,11 +34,21 @@ export class AcceptInvitationHandler implements CommandHandler<AcceptInvitationC
27
34
  const account = await this.accountRepository.findById(actor.id);
28
35
 
29
36
  if (invitation === undefined) {
37
+ {{#if refusals.named}}
38
+ throw UnknownInvitation.forReference();
39
+ {{/if}}
40
+ {{#unless refusals.named}}
30
41
  throw InvitationError.notFound();
42
+ {{/unless}}
31
43
  }
32
44
 
33
45
  if (account === undefined) {
46
+ {{#if refusals.named}}
47
+ throw UnknownAccount.forAccount(actor.id);
48
+ {{/if}}
49
+ {{#unless refusals.named}}
34
50
  throw AccountError.notFound(actor.id);
51
+ {{/unless}}
35
52
  }
36
53
 
37
54
  account.assertActive();
@@ -42,7 +59,12 @@ export class AcceptInvitationHandler implements CommandHandler<AcceptInvitationC
42
59
  invitation.accept(account, now);
43
60
 
44
61
  if ((await this.memberRepository.findOf(organisationId, account.id)) !== undefined) {
62
+ {{#if refusals.named}}
63
+ throw AlreadyMember.forMembership(organisationId, account.id);
64
+ {{/if}}
65
+ {{#unless refusals.named}}
45
66
  throw MemberError.alreadyMember(organisationId, account.id);
67
+ {{/unless}}
46
68
  }
47
69
 
48
70
  await this.invitationRepository.save(invitation);
@@ -3,8 +3,14 @@ import type { Clock } from '@ddd-ts-kit/kernel';
3
3
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
4
  import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
5
5
  import type { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
6
+ {{#unless refusals.named}}
6
7
  import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
7
8
  import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
9
+ {{/unless}}
10
+ {{#if refusals.named}}
11
+ import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
12
+ import { UnknownOrganisation } from '{{alias.context}}/domain/errors/unknown-organisation.error{{alias.ext}}';
13
+ {{/if}}
8
14
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
9
15
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
10
16
  import type { OrganisationRepository } from '{{alias.context}}/domain/repositories/organisation.repository{{alias.ext}}';
@@ -61,11 +67,21 @@ export class ChangeMemberRoleHandler implements CommandHandler<ChangeMemberRoleC
61
67
  const member = await this.memberRepository.findOf(organisationId, accountId);
62
68
 
63
69
  if (organisation === undefined) {
70
+ {{#if refusals.named}}
71
+ throw UnknownOrganisation.forOrganisation(organisationId);
72
+ {{/if}}
73
+ {{#unless refusals.named}}
64
74
  throw OrganisationError.notFound(organisationId);
75
+ {{/unless}}
65
76
  }
66
77
 
67
78
  if (member === undefined) {
79
+ {{#if refusals.named}}
80
+ throw UnknownMember.forMembership(organisationId, accountId);
81
+ {{/if}}
82
+ {{#unless refusals.named}}
68
83
  throw MemberError.notFound(organisationId, accountId);
84
+ {{/unless}}
69
85
  }
70
86
 
71
87
  return { organisation, member };
@@ -1,8 +1,14 @@
1
1
  import type { Clock } from '@ddd-ts-kit/kernel';
2
2
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
3
3
  import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
4
+ {{#unless refusals.named}}
4
5
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
5
6
  import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
7
+ {{/unless}}
8
+ {{#if refusals.named}}
9
+ import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
10
+ import { UnknownOrganisation } from '{{alias.context}}/domain/errors/unknown-organisation.error{{alias.ext}}';
11
+ {{/if}}
6
12
  import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
7
13
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
8
14
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
@@ -30,7 +36,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
30
36
  const account = await this.accountRepository.findById(actor.id);
31
37
 
32
38
  if (account === undefined) {
39
+ {{#if refusals.named}}
40
+ throw UnknownAccount.forAccount(actor.id);
41
+ {{/if}}
42
+ {{#unless refusals.named}}
33
43
  throw AccountError.notFound(actor.id);
44
+ {{/unless}}
34
45
  }
35
46
 
36
47
  const now = this.clock.now();
@@ -52,7 +63,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
52
63
  const organisation = await this.organisationRepository.findById(organisationId);
53
64
 
54
65
  if (organisation === undefined) {
66
+ {{#if refusals.named}}
67
+ throw UnknownOrganisation.forOrganisation(organisationId);
68
+ {{/if}}
69
+ {{#unless refusals.named}}
55
70
  throw OrganisationError.notFound(organisationId);
71
+ {{/unless}}
56
72
  }
57
73
 
58
74
  const owners = await this.memberRepository.countOwners(organisationId);
@@ -1,7 +1,13 @@
1
1
  import type { Clock } from '@ddd-ts-kit/kernel';
2
2
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
3
+ {{#unless refusals.named}}
3
4
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
4
5
  import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
6
+ {{/unless}}
7
+ {{#if refusals.named}}
8
+ import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
9
+ import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
10
+ {{/if}}
5
11
  import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
6
12
  import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
7
13
  import { DeclineInvitationCommand } from '{{alias.context}}/application/commands/decline-invitation/decline-invitation.command{{alias.ext}}';
@@ -21,11 +27,21 @@ export class DeclineInvitationHandler implements CommandHandler<DeclineInvitatio
21
27
  const account = await this.accountRepository.findById(actor.id);
22
28
 
23
29
  if (invitation === undefined) {
30
+ {{#if refusals.named}}
31
+ throw UnknownInvitation.forReference();
32
+ {{/if}}
33
+ {{#unless refusals.named}}
24
34
  throw InvitationError.notFound();
35
+ {{/unless}}
25
36
  }
26
37
 
27
38
  if (account === undefined) {
39
+ {{#if refusals.named}}
40
+ throw UnknownAccount.forAccount(actor.id);
41
+ {{/if}}
42
+ {{#unless refusals.named}}
28
43
  throw AccountError.notFound(actor.id);
44
+ {{/unless}}
29
45
  }
30
46
 
31
47
  invitation.decline(account, this.clock.now());
@@ -2,7 +2,12 @@ import type { Access } from '@ddd-ts-kit/auth';
2
2
  import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
3
3
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
4
  import { Delegation } from '{{alias.context}}/domain/aggregates/delegation.aggregate{{alias.ext}}';
5
+ {{#unless refusals.named}}
5
6
  import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
7
+ {{/unless}}
8
+ {{#if refusals.named}}
9
+ import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
10
+ {{/if}}
6
11
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
7
12
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
8
13
  import { RoleRightsService } from '{{alias.context}}/domain/services/role-rights.service{{alias.ext}}';
@@ -29,7 +34,12 @@ export class GrantDelegationHandler implements CommandHandler<GrantDelegationCom
29
34
  await this.access.authorize(actor, {{context.camel}}Permissions['delegation.grant'], held);
30
35
 
31
36
  if ((await this.memberRepository.findOf(organisationId, terms.delegateId)) === undefined) {
37
+ {{#if refusals.named}}
38
+ throw UnknownMember.forMembership(organisationId, terms.delegateId);
39
+ {{/if}}
40
+ {{#unless refusals.named}}
32
41
  throw MemberError.notFound(organisationId, terms.delegateId);
42
+ {{/unless}}
33
43
  }
34
44
 
35
45
  const period = DelegationPeriod.create(terms.startsAt, terms.endsAt);
@@ -2,8 +2,14 @@ import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
2
2
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
3
3
  import { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
4
4
  import { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
5
+ {{#unless refusals.named}}
5
6
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
6
7
  import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
8
+ {{/unless}}
9
+ {{#if refusals.named}}
10
+ import { OrganisationSlugTaken } from '{{alias.context}}/domain/errors/organisation-slug-taken.error{{alias.ext}}';
11
+ import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
12
+ {{/if}}
7
13
  import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
8
14
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
9
15
  import type { OrganisationRepository } from '{{alias.context}}/domain/repositories/organisation.repository{{alias.ext}}';
@@ -29,13 +35,23 @@ export class OpenOrganisationHandler implements CommandHandler<OpenOrganisationC
29
35
  const opener = await this.accountRepository.findById(actor.id);
30
36
 
31
37
  if (opener === undefined) {
38
+ {{#if refusals.named}}
39
+ throw UnknownAccount.forAccount(actor.id);
40
+ {{/if}}
41
+ {{#unless refusals.named}}
32
42
  throw AccountError.notFound(actor.id);
43
+ {{/unless}}
33
44
  }
34
45
 
35
46
  opener.assertActive();
36
47
 
37
48
  if ((await this.organisationRepository.findById(slug.value)) !== undefined) {
49
+ {{#if refusals.named}}
50
+ throw OrganisationSlugTaken.forSlug(slug.value);
51
+ {{/if}}
52
+ {{#unless refusals.named}}
38
53
  throw OrganisationError.slugTaken(slug.value);
54
+ {{/unless}}
39
55
  }
40
56
 
41
57
  const now = this.clock.now();
@@ -1,7 +1,12 @@
1
1
  import type { Clock } from '@ddd-ts-kit/kernel';
2
2
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
3
3
  import { Account } from '{{alias.context}}/domain/aggregates/account.aggregate{{alias.ext}}';
4
+ {{#unless refusals.named}}
4
5
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
6
+ {{/unless}}
7
+ {{#if refusals.named}}
8
+ import { EmailNotVerified } from '{{alias.context}}/domain/errors/email-not-verified.error{{alias.ext}}';
9
+ {{/if}}
5
10
  import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
6
11
  import { DisplayName } from '{{alias.context}}/domain/value-objects/display-name.vo{{alias.ext}}';
7
12
  import { EmailAddress } from '{{alias.context}}/domain/value-objects/email-address.vo{{alias.ext}}';
@@ -21,7 +26,12 @@ export class ProvisionAccountHandler implements CommandHandler<ProvisionAccountC
21
26
  */
22
27
  async execute({ actor, profile }: ProvisionAccountCommand): Promise<string> {
23
28
  if (!profile.emailVerified) {
29
+ {{#if refusals.named}}
30
+ throw EmailNotVerified.forAccount(actor.id);
31
+ {{/if}}
32
+ {{#unless refusals.named}}
24
33
  throw AccountError.emailNotVerified(actor.id);
34
+ {{/unless}}
25
35
  }
26
36
 
27
37
  const current = { email: EmailAddress.create(profile.email), displayName: DisplayName.create(profile.displayName) };
@@ -3,8 +3,14 @@ import type { Clock } from '@ddd-ts-kit/kernel';
3
3
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
4
  import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
5
5
  import type { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
6
+ {{#unless refusals.named}}
6
7
  import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
7
8
  import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
9
+ {{/unless}}
10
+ {{#if refusals.named}}
11
+ import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
12
+ import { UnknownOrganisation } from '{{alias.context}}/domain/errors/unknown-organisation.error{{alias.ext}}';
13
+ {{/if}}
8
14
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
9
15
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
10
16
  import type { OrganisationRepository } from '{{alias.context}}/domain/repositories/organisation.repository{{alias.ext}}';
@@ -60,11 +66,21 @@ export class RemoveMemberHandler implements CommandHandler<RemoveMemberCommand>
60
66
  const member = await this.memberRepository.findOf(organisationId, accountId);
61
67
 
62
68
  if (organisation === undefined) {
69
+ {{#if refusals.named}}
70
+ throw UnknownOrganisation.forOrganisation(organisationId);
71
+ {{/if}}
72
+ {{#unless refusals.named}}
63
73
  throw OrganisationError.notFound(organisationId);
74
+ {{/unless}}
64
75
  }
65
76
 
66
77
  if (member === undefined) {
78
+ {{#if refusals.named}}
79
+ throw UnknownMember.forMembership(organisationId, accountId);
80
+ {{/if}}
81
+ {{#unless refusals.named}}
67
82
  throw MemberError.notFound(organisationId, accountId);
83
+ {{/unless}}
68
84
  }
69
85
 
70
86
  return { organisation, member };
@@ -1,7 +1,12 @@
1
1
  import type { Access } from '@ddd-ts-kit/auth';
2
2
  import type { Clock } from '@ddd-ts-kit/kernel';
3
3
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
+ {{#unless refusals.named}}
4
5
  import { DelegationError } from '{{alias.context}}/domain/errors/delegation.error{{alias.ext}}';
6
+ {{/unless}}
7
+ {{#if refusals.named}}
8
+ import { UnknownDelegation } from '{{alias.context}}/domain/errors/unknown-delegation.error{{alias.ext}}';
9
+ {{/if}}
5
10
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
6
11
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
7
12
  import { RoleRightsService } from '{{alias.context}}/domain/services/role-rights.service{{alias.ext}}';
@@ -28,7 +33,12 @@ export class RevokeDelegationHandler implements CommandHandler<RevokeDelegationC
28
33
  const delegation = await this.delegationRepository.findById(delegationId);
29
34
 
30
35
  if (delegation?.organisationId !== organisationId) {
36
+ {{#if refusals.named}}
37
+ throw UnknownDelegation.forDelegation(delegationId);
38
+ {{/if}}
39
+ {{#unless refusals.named}}
31
40
  throw DelegationError.notFound(delegationId);
41
+ {{/unless}}
32
42
  }
33
43
 
34
44
  delegation.revoke(now);
@@ -1,7 +1,12 @@
1
1
  import type { Access } from '@ddd-ts-kit/auth';
2
2
  import type { Clock } from '@ddd-ts-kit/kernel';
3
3
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
+ {{#unless refusals.named}}
4
5
  import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
6
+ {{/unless}}
7
+ {{#if refusals.named}}
8
+ import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
9
+ {{/if}}
5
10
  import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
6
11
  import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
7
12
  import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
@@ -31,7 +36,12 @@ export class RevokeInvitationHandler implements CommandHandler<RevokeInvitationC
31
36
  const invitation = await this.invitationRepository.findById(invitationId);
32
37
 
33
38
  if (invitation?.organisationId !== organisationId) {
39
+ {{#if refusals.named}}
40
+ throw UnknownInvitation.forReference();
41
+ {{/if}}
42
+ {{#unless refusals.named}}
34
43
  throw InvitationError.notFound();
44
+ {{/unless}}
35
45
  }
36
46
 
37
47
  invitation.revoke(now);
@@ -1,5 +1,11 @@
1
1
  import { AggregateRoot } from '@ddd-ts-kit/kernel';
2
+ {{#unless refusals.named}}
2
3
  import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
4
+ {{/unless}}
5
+ {{#if refusals.named}}
6
+ import { AccountAlreadyDeactivated } from '{{alias.context}}/domain/errors/account-already-deactivated.error{{alias.ext}}';
7
+ import { DeactivatedAccount } from '{{alias.context}}/domain/errors/deactivated-account.error{{alias.ext}}';
8
+ {{/if}}
3
9
  import { AccountDeactivated } from '{{alias.context}}/domain/events/account-deactivated.event{{alias.ext}}';
4
10
  import { AccountProvisioned } from '{{alias.context}}/domain/events/account-provisioned.event{{alias.ext}}';
5
11
  import type { DisplayName } from '{{alias.context}}/domain/value-objects/display-name.vo{{alias.ext}}';
@@ -56,7 +62,12 @@ export class Account extends AggregateRoot<string> {
56
62
  /** The person signs in no more; their memberships and their history stay. */
57
63
  deactivate(now: Date): void {
58
64
  if (!this.isActive) {
65
+ {{#if refusals.named}}
66
+ throw AccountAlreadyDeactivated.forAccount(this.id);
67
+ {{/if}}
68
+ {{#unless refusals.named}}
59
69
  throw AccountError.alreadyDeactivated(this.id);
70
+ {{/unless}}
60
71
  }
61
72
 
62
73
  this.state = { ...this.state, status: AccountStatus.Deactivated, deactivatedAt: now };
@@ -66,7 +77,12 @@ export class Account extends AggregateRoot<string> {
66
77
  /** Refuses every intention of a deactivated account. */
67
78
  assertActive(): void {
68
79
  if (!this.isActive) {
80
+ {{#if refusals.named}}
81
+ throw DeactivatedAccount.forAccount(this.id);
82
+ {{/if}}
83
+ {{#unless refusals.named}}
69
84
  throw AccountError.deactivated(this.id);
85
+ {{/unless}}
70
86
  }
71
87
  }
72
88