ddd-ts-kit 0.16.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/README.fr.md +14 -15
  2. package/README.md +13 -13
  3. package/dist/affected/reach-of.js +1 -1
  4. package/dist/affected/reach-of.js.map +1 -1
  5. package/dist/check/business-names/closing-parenthesis.d.ts +3 -0
  6. package/dist/check/business-names/closing-parenthesis.d.ts.map +1 -0
  7. package/dist/check/business-names/closing-parenthesis.js +16 -0
  8. package/dist/check/business-names/closing-parenthesis.js.map +1 -0
  9. package/dist/check/business-names/declared-bindings.d.ts +4 -0
  10. package/dist/check/business-names/declared-bindings.d.ts.map +1 -0
  11. package/dist/check/business-names/declared-bindings.js +41 -0
  12. package/dist/check/business-names/declared-bindings.js.map +1 -0
  13. package/dist/check/business-names/generic-words-of.d.ts +4 -0
  14. package/dist/check/business-names/generic-words-of.d.ts.map +1 -0
  15. package/dist/check/business-names/generic-words-of.js +7 -0
  16. package/dist/check/business-names/generic-words-of.js.map +1 -0
  17. package/dist/check/business-names/generic-words.d.ts +7 -0
  18. package/dist/check/business-names/generic-words.d.ts.map +1 -0
  19. package/dist/check/business-names/generic-words.js +26 -0
  20. package/dist/check/business-names/generic-words.js.map +1 -0
  21. package/dist/check/business-names/identifier-at.d.ts +3 -0
  22. package/dist/check/business-names/identifier-at.d.ts.map +1 -0
  23. package/dist/check/business-names/identifier-at.js +6 -0
  24. package/dist/check/business-names/identifier-at.js.map +1 -0
  25. package/dist/check/business-names/judges-names.d.ts +7 -0
  26. package/dist/check/business-names/judges-names.d.ts.map +1 -0
  27. package/dist/check/business-names/judges-names.js +14 -0
  28. package/dist/check/business-names/judges-names.js.map +1 -0
  29. package/dist/check/business-names/named-binding.d.ts +12 -0
  30. package/dist/check/business-names/named-binding.d.ts.map +1 -0
  31. package/dist/check/business-names/named-binding.js +2 -0
  32. package/dist/check/business-names/named-binding.js.map +1 -0
  33. package/dist/check/business-names/named-bindings.d.ts +4 -0
  34. package/dist/check/business-names/named-bindings.d.ts.map +1 -0
  35. package/dist/check/business-names/named-bindings.js +8 -0
  36. package/dist/check/business-names/named-bindings.js.map +1 -0
  37. package/dist/check/business-names/opening-bracket.d.ts +3 -0
  38. package/dist/check/business-names/opening-bracket.d.ts.map +1 -0
  39. package/dist/check/business-names/opening-bracket.js +16 -0
  40. package/dist/check/business-names/opening-bracket.js.map +1 -0
  41. package/dist/check/business-names/parameter-bindings.d.ts +4 -0
  42. package/dist/check/business-names/parameter-bindings.d.ts.map +1 -0
  43. package/dist/check/business-names/parameter-bindings.js +28 -0
  44. package/dist/check/business-names/parameter-bindings.js.map +1 -0
  45. package/dist/check/business-names/parameter-lists.d.ts +14 -0
  46. package/dist/check/business-names/parameter-lists.d.ts.map +1 -0
  47. package/dist/check/business-names/parameter-lists.js +109 -0
  48. package/dist/check/business-names/parameter-lists.js.map +1 -0
  49. package/dist/check/business-names/pattern-bindings.d.ts +7 -0
  50. package/dist/check/business-names/pattern-bindings.d.ts.map +1 -0
  51. package/dist/check/business-names/pattern-bindings.js +31 -0
  52. package/dist/check/business-names/pattern-bindings.js.map +1 -0
  53. package/dist/check/business-names/property-bindings.d.ts +7 -0
  54. package/dist/check/business-names/property-bindings.d.ts.map +1 -0
  55. package/dist/check/business-names/property-bindings.js +31 -0
  56. package/dist/check/business-names/property-bindings.js.map +1 -0
  57. package/dist/check/business-names/suggested-name.d.ts +8 -0
  58. package/dist/check/business-names/suggested-name.d.ts.map +1 -0
  59. package/dist/check/business-names/suggested-name.js +28 -0
  60. package/dist/check/business-names/suggested-name.js.map +1 -0
  61. package/dist/check/business-names/top-level-separator.d.ts +3 -0
  62. package/dist/check/business-names/top-level-separator.d.ts.map +1 -0
  63. package/dist/check/business-names/top-level-separator.js +23 -0
  64. package/dist/check/business-names/top-level-separator.js.map +1 -0
  65. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  66. package/dist/check/catalogue/architecture-rules.js +4 -0
  67. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  68. package/dist/check/declarations/declared-event-handlers.d.ts +4 -9
  69. package/dist/check/declarations/declared-event-handlers.d.ts.map +1 -1
  70. package/dist/check/declarations/declared-event-handlers.js +5 -5
  71. package/dist/check/declarations/declared-event-handlers.js.map +1 -1
  72. package/dist/check/declarations/option-of.d.ts +0 -2
  73. package/dist/check/declarations/option-of.d.ts.map +1 -1
  74. package/dist/check/declarations/option-of.js +1 -7
  75. package/dist/check/declarations/option-of.js.map +1 -1
  76. package/dist/check/explain/authz-docs.d.ts.map +1 -1
  77. package/dist/check/explain/authz-docs.js +14 -1
  78. package/dist/check/explain/authz-docs.js.map +1 -1
  79. package/dist/check/explain/events-docs.d.ts.map +1 -1
  80. package/dist/check/explain/events-docs.js +31 -11
  81. package/dist/check/explain/events-docs.js.map +1 -1
  82. package/dist/check/explain/ports-docs.d.ts.map +1 -1
  83. package/dist/check/explain/ports-docs.js +11 -9
  84. package/dist/check/explain/ports-docs.js.map +1 -1
  85. package/dist/check/explain/scheduling-docs.d.ts.map +1 -1
  86. package/dist/check/explain/scheduling-docs.js +10 -5
  87. package/dist/check/explain/scheduling-docs.js.map +1 -1
  88. package/dist/check/explain/tree-docs.d.ts.map +1 -1
  89. package/dist/check/explain/tree-docs.js +11 -0
  90. package/dist/check/explain/tree-docs.js.map +1 -1
  91. package/dist/check/explain/wiring-docs.js +4 -4
  92. package/dist/check/explain/wiring-docs.js.map +1 -1
  93. package/dist/check/fixtures/authz-policy-fixtures.d.ts +3 -0
  94. package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -0
  95. package/dist/check/fixtures/authz-policy-fixtures.js +97 -0
  96. package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -0
  97. package/dist/check/fixtures/business-name-fixtures.d.ts +3 -0
  98. package/dist/check/fixtures/business-name-fixtures.d.ts.map +1 -0
  99. package/dist/check/fixtures/business-name-fixtures.js +98 -0
  100. package/dist/check/fixtures/business-name-fixtures.js.map +1 -0
  101. package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
  102. package/dist/check/fixtures/declarations-fixtures.js +2 -42
  103. package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
  104. package/dist/check/fixtures/declared.d.ts.map +1 -1
  105. package/dist/check/fixtures/declared.js +3 -3
  106. package/dist/check/fixtures/declared.js.map +1 -1
  107. package/dist/check/fixtures/domain-events-fixtures.js +1 -1
  108. package/dist/check/fixtures/domain-events-fixtures.js.map +1 -1
  109. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  110. package/dist/check/fixtures/fixtures.js +4 -0
  111. package/dist/check/fixtures/fixtures.js.map +1 -1
  112. package/dist/check/rules/authz-policy-asked.d.ts +3 -0
  113. package/dist/check/rules/authz-policy-asked.d.ts.map +1 -0
  114. package/dist/check/rules/authz-policy-asked.js +184 -0
  115. package/dist/check/rules/authz-policy-asked.js.map +1 -0
  116. package/dist/check/rules/declarations-role-declared.d.ts.map +1 -1
  117. package/dist/check/rules/declarations-role-declared.js +4 -35
  118. package/dist/check/rules/declarations-role-declared.js.map +1 -1
  119. package/dist/check/rules/events-consumer-idempotent.js +3 -3
  120. package/dist/check/rules/events-consumer-idempotent.js.map +1 -1
  121. package/dist/check/rules/naming-business-name.d.ts +3 -0
  122. package/dist/check/rules/naming-business-name.d.ts.map +1 -0
  123. package/dist/check/rules/naming-business-name.js +41 -0
  124. package/dist/check/rules/naming-business-name.js.map +1 -0
  125. package/dist/config/config.d.ts +8 -0
  126. package/dist/config/config.d.ts.map +1 -1
  127. package/dist/config/parse-business-names.d.ts +4 -0
  128. package/dist/config/parse-business-names.d.ts.map +1 -0
  129. package/dist/config/parse-business-names.js +14 -0
  130. package/dist/config/parse-business-names.js.map +1 -0
  131. package/dist/config/parse-config.d.ts.map +1 -1
  132. package/dist/config/parse-config.js +2 -0
  133. package/dist/config/parse-config.js.map +1 -1
  134. package/dist/config/serialize-config.js +9 -1
  135. package/dist/config/serialize-config.js.map +1 -1
  136. package/dist/generate/emit.d.ts.map +1 -1
  137. package/dist/generate/emit.js +2 -14
  138. package/dist/generate/emit.js.map +1 -1
  139. package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts +9 -0
  140. package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts.map +1 -0
  141. package/dist/generate/kinds/ask-policy-in-generated-use-case.js +102 -0
  142. package/dist/generate/kinds/ask-policy-in-generated-use-case.js.map +1 -0
  143. package/dist/generate/kinds/assert-declares-its-name.d.ts +9 -0
  144. package/dist/generate/kinds/assert-declares-its-name.d.ts.map +1 -0
  145. package/dist/generate/kinds/assert-declares-its-name.js +16 -0
  146. package/dist/generate/kinds/assert-declares-its-name.js.map +1 -0
  147. package/dist/generate/kinds/command-context.d.ts +12 -0
  148. package/dist/generate/kinds/command-context.d.ts.map +1 -0
  149. package/dist/generate/kinds/command-context.js +18 -0
  150. package/dist/generate/kinds/command-context.js.map +1 -0
  151. package/dist/generate/kinds/command-kind.d.ts.map +1 -1
  152. package/dist/generate/kinds/command-kind.js +7 -24
  153. package/dist/generate/kinds/command-kind.js.map +1 -1
  154. package/dist/generate/kinds/command-outputs.d.ts +6 -0
  155. package/dist/generate/kinds/command-outputs.d.ts.map +1 -0
  156. package/dist/generate/kinds/command-outputs.js +13 -0
  157. package/dist/generate/kinds/command-outputs.js.map +1 -0
  158. package/dist/generate/kinds/declares-its-name.d.ts +5 -0
  159. package/dist/generate/kinds/declares-its-name.d.ts.map +1 -0
  160. package/dist/generate/kinds/declares-its-name.js +7 -0
  161. package/dist/generate/kinds/declares-its-name.js.map +1 -0
  162. package/dist/generate/kinds/event-file-of.d.ts +5 -0
  163. package/dist/generate/kinds/event-file-of.d.ts.map +1 -0
  164. package/dist/generate/kinds/event-file-of.js +5 -0
  165. package/dist/generate/kinds/event-file-of.js.map +1 -0
  166. package/dist/generate/kinds/event-handler-kind.d.ts.map +1 -1
  167. package/dist/generate/kinds/event-handler-kind.js +2 -0
  168. package/dist/generate/kinds/event-handler-kind.js.map +1 -1
  169. package/dist/generate/kinds/event-name-reference.d.ts +4 -3
  170. package/dist/generate/kinds/event-name-reference.d.ts.map +1 -1
  171. package/dist/generate/kinds/event-name-reference.js +6 -6
  172. package/dist/generate/kinds/event-name-reference.js.map +1 -1
  173. package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
  174. package/dist/generate/kinds/integration-event-kind.js +2 -0
  175. package/dist/generate/kinds/integration-event-kind.js.map +1 -1
  176. package/dist/generate/kinds/policy-kind.d.ts.map +1 -1
  177. package/dist/generate/kinds/policy-kind.js +2 -0
  178. package/dist/generate/kinds/policy-kind.js.map +1 -1
  179. package/dist/generate/kinds/query-context.d.ts +9 -0
  180. package/dist/generate/kinds/query-context.d.ts.map +1 -0
  181. package/dist/generate/kinds/query-context.js +27 -0
  182. package/dist/generate/kinds/query-context.js.map +1 -0
  183. package/dist/generate/kinds/query-kind.d.ts.map +1 -1
  184. package/dist/generate/kinds/query-kind.js +16 -51
  185. package/dist/generate/kinds/query-kind.js.map +1 -1
  186. package/dist/generate/kinds/query-outputs.d.ts +8 -0
  187. package/dist/generate/kinds/query-outputs.d.ts.map +1 -0
  188. package/dist/generate/kinds/query-outputs.js +20 -0
  189. package/dist/generate/kinds/query-outputs.js.map +1 -0
  190. package/dist/generate/kinds/reader-file.d.ts +8 -0
  191. package/dist/generate/kinds/reader-file.d.ts.map +1 -0
  192. package/dist/generate/kinds/reader-file.js +9 -0
  193. package/dist/generate/kinds/reader-file.js.map +1 -0
  194. package/dist/generate/kinds/route/write-controller.d.ts.map +1 -1
  195. package/dist/generate/kinds/route/write-controller.js +2 -1
  196. package/dist/generate/kinds/route/write-controller.js.map +1 -1
  197. package/dist/generate/kinds/route-kind.d.ts.map +1 -1
  198. package/dist/generate/kinds/route-kind.js +2 -1
  199. package/dist/generate/kinds/route-kind.js.map +1 -1
  200. package/dist/generate/mark-policy-questions.d.ts +10 -0
  201. package/dist/generate/mark-policy-questions.d.ts.map +1 -0
  202. package/dist/generate/mark-policy-questions.js +76 -0
  203. package/dist/generate/mark-policy-questions.js.map +1 -0
  204. package/dist/generate/permission-pattern.d.ts +4 -0
  205. package/dist/generate/permission-pattern.d.ts.map +1 -0
  206. package/dist/generate/permission-pattern.js +7 -0
  207. package/dist/generate/permission-pattern.js.map +1 -0
  208. package/dist/generate/refined-by-policy.d.ts +4 -0
  209. package/dist/generate/refined-by-policy.d.ts.map +1 -0
  210. package/dist/generate/refined-by-policy.js +9 -0
  211. package/dist/generate/refined-by-policy.js.map +1 -0
  212. package/dist/generate/rendered.d.ts +5 -0
  213. package/dist/generate/rendered.d.ts.map +1 -0
  214. package/dist/generate/rendered.js +18 -0
  215. package/dist/generate/rendered.js.map +1 -0
  216. package/dist/generate/searched-elements.d.ts +13 -0
  217. package/dist/generate/searched-elements.d.ts.map +1 -0
  218. package/dist/generate/searched-elements.js +63 -0
  219. package/dist/generate/searched-elements.js.map +1 -0
  220. package/dist/generate/wire.d.ts.map +1 -1
  221. package/dist/generate/wire.js +3 -25
  222. package/dist/generate/wire.js.map +1 -1
  223. package/dist/generate/wirings.d.ts +8 -0
  224. package/dist/generate/wirings.d.ts.map +1 -0
  225. package/dist/generate/wirings.js +28 -0
  226. package/dist/generate/wirings.js.map +1 -0
  227. package/dist/init/copilot-instruction.d.ts +6 -0
  228. package/dist/init/copilot-instruction.d.ts.map +1 -0
  229. package/dist/init/copilot-instruction.js +15 -0
  230. package/dist/init/copilot-instruction.js.map +1 -0
  231. package/dist/init/files/guidance-files.d.ts +1 -0
  232. package/dist/init/files/guidance-files.d.ts.map +1 -1
  233. package/dist/init/files/guidance-files.js +4 -3
  234. package/dist/init/files/guidance-files.js.map +1 -1
  235. package/dist/init/files/layer-rules.d.ts +3 -0
  236. package/dist/init/files/layer-rules.d.ts.map +1 -0
  237. package/dist/init/files/layer-rules.js +11 -0
  238. package/dist/init/files/layer-rules.js.map +1 -0
  239. package/dist/init/files/pipeline-files.d.ts.map +1 -1
  240. package/dist/init/files/pipeline-files.js +2 -0
  241. package/dist/init/files/pipeline-files.js.map +1 -1
  242. package/dist/init/json-object.d.ts +3 -0
  243. package/dist/init/json-object.d.ts.map +1 -0
  244. package/dist/init/json-object.js +12 -0
  245. package/dist/init/json-object.js.map +1 -0
  246. package/dist/init/manifest/versions.js +24 -24
  247. package/dist/init/run-init.d.ts.map +1 -1
  248. package/dist/init/run-init.js +4 -0
  249. package/dist/init/run-init.js.map +1 -1
  250. package/dist/init/write-agent-settings.d.ts.map +1 -1
  251. package/dist/init/write-agent-settings.js +3 -10
  252. package/dist/init/write-agent-settings.js.map +1 -1
  253. package/dist/init/write-copilot-instructions.d.ts +7 -0
  254. package/dist/init/write-copilot-instructions.d.ts.map +1 -0
  255. package/dist/init/write-copilot-instructions.js +16 -0
  256. package/dist/init/write-copilot-instructions.js.map +1 -0
  257. package/dist/init/write-copilot-settings.d.ts +8 -0
  258. package/dist/init/write-copilot-settings.d.ts.map +1 -0
  259. package/dist/init/write-copilot-settings.js +36 -0
  260. package/dist/init/write-copilot-settings.js.map +1 -0
  261. package/dist/markers/index.d.ts +1 -0
  262. package/dist/markers/index.d.ts.map +1 -1
  263. package/dist/markers/index.js +1 -0
  264. package/dist/markers/index.js.map +1 -1
  265. package/dist/markers/replace-in-region.d.ts +10 -0
  266. package/dist/markers/replace-in-region.d.ts.map +1 -0
  267. package/dist/markers/replace-in-region.js +30 -0
  268. package/dist/markers/replace-in-region.js.map +1 -0
  269. package/dist/naming/index.d.ts +2 -0
  270. package/dist/naming/index.d.ts.map +1 -1
  271. package/dist/naming/index.js +2 -0
  272. package/dist/naming/index.js.map +1 -1
  273. package/dist/naming/plural.d.ts +3 -0
  274. package/dist/naming/plural.d.ts.map +1 -0
  275. package/dist/naming/plural.js +8 -0
  276. package/dist/naming/plural.js.map +1 -0
  277. package/dist/naming/singular.d.ts +3 -0
  278. package/dist/naming/singular.d.ts.map +1 -0
  279. package/dist/naming/singular.js +11 -0
  280. package/dist/naming/singular.js.map +1 -0
  281. package/dist/naming/to-name.d.ts.map +1 -1
  282. package/dist/naming/to-name.js +1 -6
  283. package/dist/naming/to-name.js.map +1 -1
  284. package/dist/sdk/agent-instruction.d.ts +1 -1
  285. package/dist/sdk/agent-instruction.js +1 -1
  286. package/dist/sdk/instruct-agents.d.ts +1 -1
  287. package/dist/sdk/instruct-agents.d.ts.map +1 -1
  288. package/dist/sdk/instruct-agents.js +12 -8
  289. package/dist/sdk/instruct-agents.js.map +1 -1
  290. package/dist/version.d.ts +1 -1
  291. package/dist/version.js +1 -1
  292. package/package.json +24 -3
  293. package/templates/command/handler.declared.ts.tpl +32 -3
  294. package/templates/command/handler.spec.buses.ts.tpl +24 -1
  295. package/templates/command/handler.ts.tpl +32 -3
  296. package/templates/command/wiring.manual.tpl +2 -2
  297. package/templates/command/wiring.tsyringe.tpl +5 -2
  298. package/templates/controller/controller.search.ts.tpl +1 -1
  299. package/templates/event-handler/event-handler.declared.ts.tpl +1 -1
  300. package/templates/init/AGENTS.md.tpl +46 -0
  301. package/templates/init/CLAUDE.md.tpl +2 -45
  302. package/templates/init/README.md.tpl +1 -1
  303. package/templates/init/rules/application.md.tpl +2 -2
  304. package/templates/init/rules/domain.md.tpl +1 -1
  305. package/templates/init/scripts/events.ts.tpl +6 -6
  306. package/templates/init/scripts/openapi.ts.tpl +2 -2
  307. package/templates/integration-event/publisher.declared.ts.tpl +1 -1
  308. package/templates/pipeline/github/workflows/copilot-setup-steps.yml +26 -0
  309. package/templates/pipeline/package-scripts.json +1 -1
  310. package/templates/policy/policy.declared.ts.tpl +1 -1
  311. package/templates/policy/policy.ts.tpl +1 -1
  312. package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +1 -1
  313. package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +1 -1
  314. package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +1 -1
  315. package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +1 -1
  316. package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +1 -1
  317. package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +1 -1
  318. package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +1 -1
  319. package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +2 -2
  320. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.ts.tpl +2 -2
  321. package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +1 -1
  322. package/templates/query/handler.declared.ts.tpl +19 -0
  323. package/templates/query/handler.spec.buses.ts.tpl +21 -0
  324. package/templates/query/handler.ts.tpl +19 -0
  325. package/templates/query/search.reader.fake.ts.tpl +1 -1
  326. package/templates/query/search.reader.in-memory.ts.tpl +20 -18
  327. package/templates/query/wiring.manual.tpl +1 -1
  328. package/templates/query/wiring.tsyringe.tpl +4 -1
  329. package/templates/route/route.search.ts.tpl +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"events-docs.js","sourceRoot":"","sources":["../../../src/check/explain/events-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,2LAA2L;QAChM,GAAG,EAAE,kCAAkC;QACvC,IAAI,EAAE,2CAA2C;KAClD;IACD,sCAAsC,EAAE;QACtC,GAAG,EAAE,2UAA2U;QAChV,GAAG,EAAE;uEAC8D;QACnE,IAAI,EAAE;;;IAGN;KACD;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,wVAAwV;QAC7V,GAAG,EAAE;;;qDAG4C;QACjD,IAAI,EAAE;;;yDAG+C;KACtD;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,mlBAAmlB;QACxlB,GAAG,EAAE;;;qFAG4E;QACjF,IAAI,EAAE;;;;;;qCAM2B;KAClC;IACD,kCAAkC,EAAE;QAClC,GAAG,EAAE,svBAAsvB;QAC3vB,GAAG,EAAE;;;sDAG6C;QAClD,IAAI,EAAE;;;;qCAI2B;KAClC;IACD,2CAA2C,EAAE;QAC3C,GAAG,EAAE,uxDAAuxD;QAC5xD,GAAG,EAAE;;;;2HAIkH;QACvH,IAAI,EAAE;;;;;;;;;;;;uCAY6B;KACpC;CACF,CAAC"}
1
+ {"version":3,"file":"events-docs.js","sourceRoot":"","sources":["../../../src/check/explain/events-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,2LAA2L;QAChM,GAAG,EAAE,kCAAkC;QACvC,IAAI,EAAE,2CAA2C;KAClD;IACD,sCAAsC,EAAE;QACtC,GAAG,EAAE,2UAA2U;QAChV,GAAG,EAAE;uEAC8D;QACnE,IAAI,EAAE;;;IAGN;KACD;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,wVAAwV;QAC7V,GAAG,EAAE;;;qDAG4C;QACjD,IAAI,EAAE;;;yDAG+C;KACtD;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,mlBAAmlB;QACxlB,GAAG,EAAE;;;uEAG8D;QACnE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,kCAAkC,EAAE;QAClC,GAAG,EAAE,svBAAsvB;QAC3vB,GAAG,EAAE;;;;sDAI6C;QAClD,IAAI,EAAE;;;;;qCAK2B;KAClC;IACD,2CAA2C,EAAE;QAC3C,GAAG,EAAE,uxDAAuxD;QAC5xD,GAAG,EAAE;;;;;;;;;;sFAU6E;QAClF,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;EAsBR;KACC;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ports-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/ports-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0ExD,CAAC"}
1
+ {"version":3,"file":"ports-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/ports-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4ExD,CAAC"}
@@ -17,12 +17,12 @@ export abstract class InvoiceRepository extends Repository<Invoice> {}`,
17
17
  'ports/implements-never-extends': {
18
18
  why: 'An adapter says which contract it honours with `implements`, and the compiler holds it to that contract. Extending the port instead would inherit from a class that holds nothing, make the adapter a second port for the container, and is refused when the binding is registered. The rule reads the class behind @Repository, @Gateway and @Adapter, the class given to bind(P).toClass(C) or rebind(P).toClass(C), and every class of infrastructure/ that extends a class of a port file. A class bound to itself is no port and is left alone.',
19
19
  bad: `// infrastructure/persistence/knex-invoice.repository.ts
20
- @Repository(InvoiceRepository, [Database, ExecutionScope, Clock])
20
+ @Repository(InvoiceRepository)
21
21
  export class KnexInvoiceRepository extends InvoiceRepository {}
22
22
  // billing.module.ts
23
23
  builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]); // class StripePaymentGateway {}`,
24
24
  good: `// infrastructure/persistence/knex-invoice.repository.ts
25
- @Repository(InvoiceRepository, [Database, ExecutionScope, Clock])
25
+ @Repository(InvoiceRepository)
26
26
  export class KnexInvoiceRepository implements InvoiceRepository {}
27
27
  // infrastructure/external/stripe-payment.gateway.ts
28
28
  export class StripePaymentGateway implements PaymentGateway {}`,
@@ -31,15 +31,15 @@ export class StripePaymentGateway implements PaymentGateway {}`,
31
31
  why: 'The abstract class of a port is its injection token: it names the dependency, carries its type and lets the compiler check a dependency list against a constructor. A constant beside it (a token() call, a Symbol, a string, an UPPER_SNAKE_CASE name in a list) is a second name for the same thing that nothing ties to the type, and a file of tokens is one more place to keep in step with the ports. There is one way to name a dependency: the class.',
32
32
  bad: `// application/ports/billing.ports.ts
33
33
  export const INVOICE_REPOSITORY = token<InvoiceRepository>('billing.InvoiceRepository');
34
- // application/commands/issue-invoice/issue-invoice.handler.ts
35
- @CommandHandler(IssueInvoiceCommand, [INVOICE_REPOSITORY, CLOCK])
36
- // billing.module.ts
34
+ // billing.module.ts, explicit style
35
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [INVOICE_REPOSITORY, CLOCK]);
37
36
  builder.bind(Symbol.for('billing.PaymentGateway')).toClass(StripePaymentGateway, []);`,
38
37
  good: `// domain/repositories/invoice.repository.ts
39
38
  export abstract class InvoiceRepository extends Repository<Invoice> {}
40
39
  // application/commands/issue-invoice/issue-invoice.handler.ts
41
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])
42
- // billing.module.ts
40
+ @CommandHandler(IssueInvoiceCommand)
41
+ constructor(private readonly invoices: InvoiceRepository, private readonly clock: Clock) {}
42
+ // billing.module.ts, explicit style
43
43
  builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]);`,
44
44
  },
45
45
  'ports/no-concrete-dependency': {
@@ -66,11 +66,13 @@ export class IssueInvoiceHandler {
66
66
  bad: `import type { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
67
67
  import { type Clock } from '@ddd-ts-kit/kernel';
68
68
 
69
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])`,
69
+ // billing.module.ts, explicit style
70
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [InvoiceRepository, Clock]);`,
70
71
  good: `import { Clock } from '@ddd-ts-kit/kernel';
71
72
  import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
72
73
 
73
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])`,
74
+ // billing.module.ts, explicit style
75
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [InvoiceRepository, Clock]);`,
74
76
  },
75
77
  };
76
78
  //# sourceMappingURL=ports-docs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ports-docs.js","sourceRoot":"","sources":["../../../src/check/explain/ports-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,sBAAsB,EAAE;QACtB,GAAG,EAAE,kmBAAkmB;QACvmB,GAAG,EAAE;;;;;EAKP;QACE,IAAI,EAAE;;;;;uEAK6D;KACpE;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,shBAAshB;QAC3hB,GAAG,EAAE;;;;kHAIyG;QAC9G,IAAI,EAAE;;;;+DAIqD;KAC5D;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,+bAA+b;QACpc,GAAG,EAAE;;;;;sFAK6E;QAClF,IAAI,EAAE;;;;;+EAKqE;KAC5E;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,omBAAomB;QACzmB,GAAG,EAAE;;;;;;;;qGAQ4F;QACjG,IAAI,EAAE;;;;;;EAMR;KACC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,4WAA4W;QACjX,GAAG,EAAE;;;iEAGwD;QAC7D,IAAI,EAAE;;;iEAGuD;KAC9D;CACF,CAAC"}
1
+ {"version":3,"file":"ports-docs.js","sourceRoot":"","sources":["../../../src/check/explain/ports-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,sBAAsB,EAAE;QACtB,GAAG,EAAE,kmBAAkmB;QACvmB,GAAG,EAAE;;;;;EAKP;QACE,IAAI,EAAE;;;;;uEAK6D;KACpE;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,shBAAshB;QAC3hB,GAAG,EAAE;;;;kHAIyG;QAC9G,IAAI,EAAE;;;;+DAIqD;KAC5D;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,+bAA+b;QACpc,GAAG,EAAE;;;;sFAI6E;QAClF,IAAI,EAAE;;;;;;+EAMqE;KAC5E;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,omBAAomB;QACzmB,GAAG,EAAE;;;;;;;;qGAQ4F;QACjG,IAAI,EAAE;;;;;;EAMR;KACC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,4WAA4W;QACjX,GAAG,EAAE;;;;iGAIwF;QAC7F,IAAI,EAAE;;;;iGAIuF;KAC9F;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scheduling-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/scheduling-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmC7D,CAAC"}
1
+ {"version":3,"file":"scheduling-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/scheduling-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwC7D,CAAC"}
@@ -4,8 +4,13 @@ export const SCHEDULING_DOCS = {
4
4
  bad: `// application/scheduling/send-reminders.job.ts
5
5
  import { Invoice } from '@/contexts/billing/domain/aggregates/invoice.aggregate';
6
6
 
7
- @Scheduled('billing.send-reminders', { every: '15m' }, [InvoiceRepository, Mailer])
7
+ @Scheduled('billing.send-reminders', { every: '15m' })
8
8
  export class SendRemindersJob {
9
+ constructor(
10
+ private readonly invoices: InvoiceRepository,
11
+ private readonly mailer: Mailer,
12
+ ) {}
13
+
9
14
  async run(): Promise<void> {
10
15
  for (const invoice of await this.invoices.findOverdue()) {
11
16
  await this.mailer.remind(invoice);
@@ -13,7 +18,7 @@ export class SendRemindersJob {
13
18
  }
14
19
  }`,
15
20
  good: `// application/scheduling/send-reminders.job.ts
16
- @Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
21
+ @Scheduled('billing.send-reminders', { every: '15m' })
17
22
  export class SendRemindersJob implements ScheduledJob {
18
23
  constructor(private readonly commands: CommandBus) {}
19
24
 
@@ -24,12 +29,12 @@ export class SendRemindersJob implements ScheduledJob {
24
29
  },
25
30
  'scheduling/job-name': {
26
31
  why: 'The name of a job is its identity everywhere a run leaves a trace: the scheduler and its lock, the settings that enable or reschedule it, the logs, the metrics and the audit trail, where the job is the system actor of the command it sends. It is written once as a string literal, `<context>.<job-name>` in lower-case kebab-case, so that it survives the renaming of a class and tells which context owns the job. Two jobs under one name share a lock and overwrite each other, so a name is unique in the project.',
27
- bad: `@Scheduled(JOB_NAME, { every: '15m' }, [CommandBus])
28
- @Scheduled('SendReminders', { every: '15m' }, [CommandBus])
32
+ bad: `@Scheduled(JOB_NAME, { every: '15m' })
33
+ @Scheduled('SendReminders', { every: '15m' })
29
34
  // in contexts/billing
30
35
  builder.job('shipping.send-reminders', { every: '15m' }).handledBy(SendRemindersJob, [CommandBus]);
31
36
  new SendRemindersCommand(systemActor('billing.reminders'), execution.scheduledAt);`,
32
- good: `@Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
37
+ good: `@Scheduled('billing.send-reminders', { every: '15m' })
33
38
  builder.job('billing.send-reminders', { every: '15m' }).handledBy(SendRemindersJob, [CommandBus]);
34
39
  new SendRemindersCommand(systemActor('billing.send-reminders'), execution.scheduledAt);`,
35
40
  },
@@ -1 +1 @@
1
- {"version":3,"file":"scheduling-docs.js","sourceRoot":"","sources":["../../../src/check/explain/scheduling-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAsC;IAChE,kCAAkC,EAAE;QAClC,GAAG,EAAE,2dAA2d;QAChe,GAAG,EAAE;;;;;;;;;;EAUP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,+fAA+f;QACpgB,GAAG,EAAE;;;;mFAI0E;QAC/E,IAAI,EAAE;;wFAE8E;KACrF;CACF,CAAC"}
1
+ {"version":3,"file":"scheduling-docs.js","sourceRoot":"","sources":["../../../src/check/explain/scheduling-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAsC;IAChE,kCAAkC,EAAE;QAClC,GAAG,EAAE,2dAA2d;QAChe,GAAG,EAAE;;;;;;;;;;;;;;;EAeP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,+fAA+f;QACpgB,GAAG,EAAE;;;;mFAI0E;QAC/E,IAAI,EAAE;;wFAE8E;KACrF;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkFvD,CAAC"}
1
+ {"version":3,"file":"tree-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6FvD,CAAC"}
@@ -32,6 +32,17 @@ abstract searchByCustomer(customerId: string): Promise<readonly InvoiceLine[]>;
32
32
  abstract findById(id: string): Promise<InvoiceLine | undefined>;
33
33
  // application/queries/search-invoices/search-invoices.query.ts
34
34
  export class SearchInvoicesQuery {}`,
35
+ },
36
+ 'naming/business-name': {
37
+ why: 'The code of the model is read by people who speak the business, and it is the ubiquitous language written down: a handler that loads an appointment and calls it target, data or item makes every reader translate it back, and hides which concept a line handles. A generic name also spreads, because the next line copies it: the command handler templates of the kit wrote target until 0.17, and forty handlers of the example inherited it. Judged: a variable, a loop variable, a destructured binding, a parameter (of a function, a method, a signature or an arrow) and a property (of a class, an interface or a type of an object) under domain/ and application/ of a context, and in the shared kernel outside presentation/, named target, targets, data, item, items, obj, object, thing, things, stuff, info, element, el, tmp, temp, foo, bar or baz; "businessNames": { "words": [..] } replaces the list and { "allow": [..] } removes words from it. A key of an object literal follows the type it is written for and is not judged, nor infrastructure, presentation, the platform and the tests. npx eslint --fix renames a variable built by X.create(..) or new X(..), or read from a repository, with every use of it; a loop variable is reported with the singular of its collection.',
38
+ bad: `const target = await this.appointmentRepository.findById(command.appointmentId);
39
+ for (const target of due) {
40
+ target.expire(now);
41
+ }`,
42
+ good: `const appointment = await this.appointmentRepository.findById(command.appointmentId);
43
+ for (const reminder of dueReminders) {
44
+ reminder.send(now);
45
+ }`,
35
46
  },
36
47
  'naming/one-concept-per-file': {
37
48
  why: 'One concept per file keeps the file name truthful and the diff of a change small. A second class in an aggregate file is usually an entity or a value object that deserves its own name and its own tests. In the declared style a role file is found by its name and holds one declared class: a second class carrying a declaration decorator in the same file is reported, whatever the role.',
@@ -1 +1 @@
1
- {"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE,icAAic;QACtc,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;kEACwD;KAC/D;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,4OAA4O;QACjP,GAAG,EAAE,6GAA6G;QAClH,IAAI,EAAE,6GAA6G;KACpH;IACD,eAAe,EAAE;QACf,GAAG,EAAE,y3BAAy3B;QAC93B,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE;;;;qEAI2D;KAClE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,kyBAAkyB;QACvyB,GAAG,EAAE;;;;kCAIyB;QAC9B,IAAI,EAAE;;;;;oCAK0B;KACjC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,kYAAkY;QACvY,GAAG,EAAE;;;;;;;2CAOkC;QACvC,IAAI,EAAE;;;4BAGkB;KACzB;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,kPAAkP;QACvP,GAAG,EAAE,kFAAkF;QACvF,IAAI,EAAE,qCAAqC;KAC5C;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,y9BAAy9B;QAC99B,GAAG,EAAE;;;uBAGc;QACnB,IAAI,EAAE;;;;;;uFAM6E;KACpF;IACD,eAAe,EAAE;QACf,GAAG,EAAE,4SAA4S;QACjT,GAAG,EAAE;gDACuC;QAC5C,IAAI,EAAE;qDAC2C;KAClD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,gUAAgU;QACrU,GAAG,EAAE,iFAAiF;QACtF,IAAI,EAAE;8BACoB;KAC3B;CACF,CAAC"}
1
+ {"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE,icAAic;QACtc,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;kEACwD;KAC/D;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,4OAA4O;QACjP,GAAG,EAAE,6GAA6G;QAClH,IAAI,EAAE,6GAA6G;KACpH;IACD,eAAe,EAAE;QACf,GAAG,EAAE,y3BAAy3B;QAC93B,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE;;;;qEAI2D;KAClE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,kyBAAkyB;QACvyB,GAAG,EAAE;;;;kCAIyB;QAC9B,IAAI,EAAE;;;;;oCAK0B;KACjC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,svCAAsvC;QAC3vC,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;;EAGR;KACC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,kYAAkY;QACvY,GAAG,EAAE;;;;;;;2CAOkC;QACvC,IAAI,EAAE;;;4BAGkB;KACzB;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,kPAAkP;QACvP,GAAG,EAAE,kFAAkF;QACvF,IAAI,EAAE,qCAAqC;KAC5C;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,y9BAAy9B;QAC99B,GAAG,EAAE;;;uBAGc;QACnB,IAAI,EAAE;;;;;;uFAM6E;KACpF;IACD,eAAe,EAAE;QACf,GAAG,EAAE,4SAA4S;QACjT,GAAG,EAAE;gDACuC;QAC5C,IAAI,EAAE;qDAC2C;KAClD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,gUAAgU;QACrU,GAAG,EAAE,iFAAiF;QACtF,IAAI,EAAE;8BACoB;KAC3B;CACF,CAAC"}
@@ -14,11 +14,11 @@ export class PgInvoiceRepository implements InvoiceRepository {}
14
14
  contextModule('billing', billingDeclarations);`,
15
15
  },
16
16
  'declarations/role-declared': {
17
- why: 'In the declared style nothing lists the classes of a context: a class is registered because its file has the name of a role and its decorator says which one. A role file whose class declares nothing, or declares another role, is wired nowhere and nobody is told. The names a declaration writes (a consumer, a policy, a domain event; the name of a job is held by scheduling/job-name) are identities kept in stores and logs, so they are literals, and the name of a domain event handler is the one its event carries. The domain declares nothing: a decorator there would make the model depend on its own wiring. Checked in declared-style projects only.',
17
+ why: 'In the declared style nothing lists the classes of a context: a class is registered because its file has the name of a role and its decorator says which one. A role file whose class declares nothing, or declares another role, is wired nowhere and nobody is told. The names a declaration writes (a consumer, a policy; the name of a job is held by scheduling/job-name) are identities kept in stores and logs, so they are literals; a domain event handler writes none, it is attached under the name its event class declares once, static readonly eventName. The domain declares nothing: a decorator there would make the model depend on its own wiring. Checked in declared-style projects only.',
18
18
  bad: `// application/commands/issue-invoice/issue-invoice.handler.ts
19
19
  export class IssueInvoiceHandler {}
20
- // application/event-handlers/invoice-issued.event-handler.ts
21
- @DomainEventHandler(InvoiceIssued, { name: EVENT_NAME })
20
+ // application/policies/only-issuer-voids.policy.ts
21
+ @Policy(billingPermissions['invoice.void'], { name: POLICY_NAME })
22
22
  // domain/aggregates/invoice.aggregate.ts
23
23
  @Repository(InvoiceRepository)
24
24
  export class Invoice {}`,
@@ -26,7 +26,7 @@ export class Invoice {}`,
26
26
  @CommandHandler(IssueInvoiceCommand)
27
27
  export class IssueInvoiceHandler {}
28
28
  // application/event-handlers/invoice-issued.event-handler.ts
29
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' })
29
+ @DomainEventHandler(InvoiceIssued)
30
30
  export class InvoiceIssuedEventHandler {}`,
31
31
  },
32
32
  'declarations/barrel-current': {
@@ -1 +1 @@
1
- {"version":3,"file":"wiring-docs.js","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,4BAA4B,EAAE;QAC5B,GAAG,EAAE,qnBAAqnB;QAC1nB,GAAG,EAAE;;;sCAG6B;QAClC,IAAI,EAAE;;;;;;+CAMqC;KAC5C;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,0oBAA0oB;QAC/oB,GAAG,EAAE;;;;;;wBAMe;QACpB,IAAI,EAAE;;;;;0CAKgC;KACvC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,60BAA60B;QACl1B,GAAG,EAAE;;;;oDAI2C;QAChD,IAAI,EAAE;;;;;2DAKiD;KACxD;IACD,oCAAoC,EAAE;QACpC,GAAG,EAAE,omCAAomC;QACzmC,GAAG,EAAE;;;;;;;;;iEASwD;QAC7D,IAAI,EAAE;;;;;;;EAOR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,kXAAkX;QACvX,GAAG,EAAE;;uEAE8D;QACnE,IAAI,EAAE;;2IAEiI;KACxI;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,qMAAqM;QAC1M,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,qGAAqG;KAC5G;CACF,CAAC"}
1
+ {"version":3,"file":"wiring-docs.js","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,4BAA4B,EAAE;QAC5B,GAAG,EAAE,qnBAAqnB;QAC1nB,GAAG,EAAE;;;sCAG6B;QAClC,IAAI,EAAE;;;;;;+CAMqC;KAC5C;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,irBAAirB;QACtrB,GAAG,EAAE;;;;;;wBAMe;QACpB,IAAI,EAAE;;;;;0CAKgC;KACvC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,60BAA60B;QACl1B,GAAG,EAAE;;;;oDAI2C;QAChD,IAAI,EAAE;;;;;2DAKiD;KACxD;IACD,oCAAoC,EAAE;QACpC,GAAG,EAAE,omCAAomC;QACzmC,GAAG,EAAE;;;;;;;;;iEASwD;QAC7D,IAAI,EAAE;;;;;;;EAOR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,kXAAkX;QACvX,GAAG,EAAE;;uEAE8D;QACnE,IAAI,EAAE;;2IAEiI;KACxI;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,qMAAqM;QAC1M,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,qGAAqG;KAC5G;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Fixture } from './fixture.js';
2
+ export declare const AUTHZ_POLICY_FIXTURES: readonly Fixture[];
3
+ //# sourceMappingURL=authz-policy-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authz-policy-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA0C5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,OAAO,EA6DnD,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { handler } from './handler.js';
2
+ import { PATHS } from './paths.js';
3
+ import { project } from './project.js';
4
+ import { signatureProject } from './signature-project.js';
5
+ import { source } from './source.js';
6
+ const { BARREL, COMMAND, HANDLER, MODULE, POLICY } = PATHS;
7
+ /** The barrel the generator derives once the handler takes `Access` and the repository in its constructor. */
8
+ const BARREL_OF_THE_POLICY = source("import { injected } from '@ddd-ts-kit/kernel/declarations';", "import { IssueInvoiceHandler } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.js';", "import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';", "import { Access } from '@ddd-ts-kit/auth';", '', "export * from '@/contexts/billing/application/authorization/only-issuer-voids.policy.js';", "export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command.js';", "export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.js';", '', 'injected(IssueInvoiceHandler, [Access, InvoiceRepository]);');
9
+ const ISSUE_POLICY = [
10
+ "import { Policy } from '@ddd-ts-kit/kernel/declarations';",
11
+ '',
12
+ "@Policy(billingPermissions['invoice.issue'], { name: 'billing.only-issuer-voids' })",
13
+ 'export class OnlyIssuerVoidsPolicy {}',
14
+ '',
15
+ ].join('\n');
16
+ const EXPLICIT_MODULE = [
17
+ 'export function billingModule(builder: Builder): void {',
18
+ " builder.command(IssueInvoiceCommand).requires(billingPermissions['invoice.issue']).handledBy(IssueInvoiceHandler, [Access]);",
19
+ '}',
20
+ '',
21
+ ].join('\n');
22
+ const DEFINED_POLICY = "export const onlyAccountantIssues = definePolicy<unknown>({\n name: 'only-accountant-issues',\n permission: billingPermissions['invoice.issue'],\n allows: (actor) => isAuthenticated(actor),\n});\n";
23
+ export const AUTHZ_POLICY_FIXTURES = [
24
+ {
25
+ ruleId: 'authz/policy-asked',
26
+ name: 'a policy of the permission, asked by the handler once it holds the element',
27
+ expect: 'pass',
28
+ files: withPolicy(declaredHandler(" await this.access.authorize(command.actor, billingPermissions['invoice.issue'], command);")),
29
+ },
30
+ {
31
+ ruleId: 'authz/policy-asked',
32
+ name: 'a policy of the permission the handler never asks',
33
+ expect: { file: HANDLER },
34
+ files: withPolicy(declaredHandler(' await this.invoices.save(command);')),
35
+ },
36
+ {
37
+ ruleId: 'authz/policy-asked',
38
+ name: 'a handler still carrying the TODO(domain) the generator left where the policy is asked',
39
+ expect: 'pass',
40
+ files: withPolicy(declaredHandler(" // TODO(domain): a policy refines billingPermissions['invoice.issue']: load the element this command acts on, then ask it.\n await this.invoices.save(command);")),
41
+ },
42
+ {
43
+ ruleId: 'authz/policy-asked',
44
+ name: 'a handler naming the permission in a comment only',
45
+ expect: { file: HANDLER },
46
+ files: withPolicy(declaredHandler(" // billingPermissions['invoice.issue'] is decided by the bus\n await this.access.authorize(command.actor, billingPermissions['invoice.void'], command);")),
47
+ },
48
+ {
49
+ ruleId: 'authz/policy-asked',
50
+ name: 'wired by hand: a policy defined as a value, asked by the handler',
51
+ expect: 'pass',
52
+ files: project({
53
+ [MODULE]: EXPLICIT_MODULE,
54
+ [COMMAND]: 'export class IssueInvoiceCommand {}\n',
55
+ [POLICY]: DEFINED_POLICY,
56
+ ...handler("export class IssueInvoiceHandler {\n async execute(command: IssueInvoiceCommand): Promise<void> {\n await this.access.decide(command.actor, billingPermissions['invoice.issue'], command);\n }\n}\n"),
57
+ }),
58
+ },
59
+ {
60
+ ruleId: 'authz/policy-asked',
61
+ name: 'wired by hand: a policy defined as a value the handler never asks',
62
+ expect: { file: HANDLER },
63
+ files: project({
64
+ [MODULE]: EXPLICIT_MODULE,
65
+ [COMMAND]: 'export class IssueInvoiceCommand {}\n',
66
+ [POLICY]: DEFINED_POLICY,
67
+ ...handler('export class IssueInvoiceHandler {\n async execute(command: IssueInvoiceCommand): Promise<void> {\n await this.invoices.save(command);\n }\n}\n'),
68
+ }),
69
+ },
70
+ ];
71
+ /** The declared issue-invoice handler, given the body of `execute`. */
72
+ function declaredHandler(body) {
73
+ return [
74
+ "import type { Access } from '@ddd-ts-kit/auth';",
75
+ "import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';",
76
+ "import type { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';",
77
+ "import { IssueInvoiceCommand } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command.js';",
78
+ '',
79
+ '@CommandHandler(IssueInvoiceCommand)',
80
+ 'export class IssueInvoiceHandler {',
81
+ ' constructor(',
82
+ ' private readonly access: Access,',
83
+ ' private readonly invoices: InvoiceRepository,',
84
+ ' ) {}',
85
+ '',
86
+ ' async execute(command: IssueInvoiceCommand): Promise<void> {',
87
+ body,
88
+ ' }',
89
+ '}',
90
+ '',
91
+ ].join('\n');
92
+ }
93
+ /** The declared issue-invoice use case whose permission a policy refines, its handler written with `body`. */
94
+ function withPolicy(body) {
95
+ return signatureProject(body, { [POLICY]: ISSUE_POLICY, [BARREL]: BARREL_OF_THE_POLICY });
96
+ }
97
+ //# sourceMappingURL=authz-policy-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authz-policy-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;AAE3D,8GAA8G;AAC9G,MAAM,oBAAoB,GAAG,MAAM,CACjC,6DAA6D,EAC7D,uHAAuH,EACvH,mGAAmG,EACnG,4CAA4C,EAC5C,EAAE,EACF,2FAA2F,EAC3F,iGAAiG,EACjG,iGAAiG,EACjG,E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AAO,CACR,0MAA0M,CAC3M;SACF,CAAC;KACH;IACD;QACE,MAAM,EAAE,oBAAoB;QAC5B,IAAI,EAAE,mEAAmE;QACzE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACzB,KAAK,EAAE,OAAO,CAAC;YACb,CAAC,MAAM,CAAC,EAAE,eAAe;YACzB,CAAC,OAAO,CAAC,EAAE,uCAAuC;YAClD,CAAC,MAAM,CAAC,EAAE,cAAc;YACxB,GAAG,OAAO,CACR,sJAAsJ,CACvJ;SACF,CAAC;KACH;CACF,CAAC;AAEF,uEAAuE;AACvE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO;QACL,iDAAiD;QACjD,mEAAmE;QACnE,wGAAwG;QACxG,uHAAuH;QACvH,EAAE;QACF,sCAAsC;QACtC,oCAAoC;QACpC,gBAAgB;QAChB,sCAAsC;QACtC,mDAAmD;QACnD,QAAQ;QACR,EAAE;QACF,gEAAgE;QAChE,IAAI;QACJ,KAAK;QACL,GAAG;QACH,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,8GAA8G;AAC9G,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Fixture } from './fixture.js';
2
+ export declare const BUSINESS_NAME_FIXTURES: readonly Fixture[];
3
+ //# sourceMappingURL=business-name-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-name-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/business-name-fixtures.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAgC5C,eAAO,MAAM,sBAAsB,EAAE,SAAS,OAAO,EA4IpD,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { CONFIG_FILE } from '../../config/index.js';
2
+ import { aggregate } from './aggregate.js';
3
+ import { config } from './config.js';
4
+ import { handler } from './handler.js';
5
+ import { PATHS } from './paths.js';
6
+ import { project } from './project.js';
7
+ import { source } from './source.js';
8
+ const { ADAPTER, AGGREGATE, BILLING, HANDLER } = PATHS;
9
+ const RULE = 'naming/business-name';
10
+ const SHARED = 'src/shared-kernel/period.ts';
11
+ const SPEC = `${BILLING}/test/unit/invoice-lines.spec.ts`;
12
+ /** A handler written in the words of the business: a variable, a loop, a destructuring, a parameter, a property. */
13
+ const NAMED = source('export class IssueInvoiceHandler {', ' private readonly issued: string[] = [];', '', ' async execute(command: IssueInvoiceCommand): Promise<string> {', ' const { invoiceId, lines } = command;', ' const invoice = await this.invoiceRepository.findById(invoiceId);', '', ' for (const line of lines) {', ' invoice.add(line);', ' }', '', ' this.issued.push(invoice.id);', '', ' return invoice.id;', ' }', '}');
14
+ export const BUSINESS_NAME_FIXTURES = [
15
+ {
16
+ ruleId: RULE,
17
+ name: 'a handler and an aggregate that speak the language of the context, the keys of an object literal',
18
+ expect: 'pass',
19
+ files: project({
20
+ ...handler(NAMED),
21
+ ...aggregate(source('export class Invoice {', ' private readonly lines: InvoiceLine[] = [];', '', ' add(line: InvoiceLine): void {', ' this.lines.push(line);', ' }', '', ' toLines(): readonly Line[] {', ' return this.lines.map((line) => ({ item: line.label, data: line.amount }));', ' }', '}')),
22
+ }),
23
+ },
24
+ {
25
+ ruleId: RULE,
26
+ name: 'infrastructure, presentation, the platform and the tests are not judged',
27
+ expect: 'pass',
28
+ files: project({
29
+ [ADAPTER]: source('export class InMemoryInvoiceRepository {', ' private readonly items: string[] = [];', '', ' save(target: string): void {', ' this.items.push(target);', ' }', '}'),
30
+ [`${BILLING}/presentation/http/shared/invoice-line.serializer.ts`]: source('export class InvoiceLineSerializer {', ' serialize(item: InvoiceLine): string {', ' return item.label;', ' }', '}'),
31
+ 'src/platform/buses/logged.ts': source('export function logged(info: MessageInfo): string {', ' return info.name;', '}'),
32
+ [SPEC]: source("import { expect, it } from 'vitest';", '', "it('adds a line', () => {", ' const target = anInvoice();', '', ' expect(target.lines).toEqual([]);', '});'),
33
+ }),
34
+ },
35
+ {
36
+ ruleId: RULE,
37
+ name: 'a word the config allows, and a list the config replaces',
38
+ expect: 'pass',
39
+ files: project(handler(generic('const invoice =', 'const data =').replaceAll('invoice.', 'data.')), {
40
+ [CONFIG_FILE]: config({ businessNames: { words: ['data', 'record'], allow: ['data'] } }),
41
+ }),
42
+ },
43
+ {
44
+ ruleId: RULE,
45
+ name: 'a variable read from a repository named target',
46
+ expect: { file: HANDLER },
47
+ files: project(handler(generic('const invoice =', 'const target =').replaceAll('invoice.', 'target.'))),
48
+ },
49
+ {
50
+ ruleId: RULE,
51
+ name: 'a loop variable named item',
52
+ expect: { file: HANDLER },
53
+ files: project(handler(generic(' for (const line of lines) {\n invoice.add(line);', ' for (const item of lines) {\n invoice.add(item);'))),
54
+ },
55
+ {
56
+ ruleId: RULE,
57
+ name: 'a destructured binding named data',
58
+ expect: { file: HANDLER },
59
+ files: project(handler(generic('const { invoiceId, lines } = command;', 'const { invoiceId, lines: data } = command;'))),
60
+ },
61
+ {
62
+ ruleId: RULE,
63
+ name: 'a parameter of an aggregate named element',
64
+ expect: { file: AGGREGATE },
65
+ files: project(aggregate(source('export class Invoice {', ' add(element: InvoiceLine): void {', ' this.record(element);', ' }', '}'))),
66
+ },
67
+ {
68
+ ruleId: RULE,
69
+ name: 'a property of an aggregate named info',
70
+ expect: { file: AGGREGATE },
71
+ files: project(aggregate(source('export class Invoice {', ' private readonly info: string = "";', '}'))),
72
+ },
73
+ {
74
+ ruleId: RULE,
75
+ name: 'a property of an interface of the shared kernel named things',
76
+ expect: { file: SHARED },
77
+ files: project({ [SHARED]: source('export interface Period {', ' readonly things: readonly string[];', '}') }),
78
+ },
79
+ {
80
+ ruleId: RULE,
81
+ name: 'the parameter of an arrow named obj, in a handler',
82
+ expect: { file: HANDLER },
83
+ files: project(handler(generic(' this.issued.push(invoice.id);', ' lines.forEach((obj) => invoice.add(obj));'))),
84
+ },
85
+ {
86
+ ruleId: RULE,
87
+ name: 'a word the config adds to the list',
88
+ expect: { file: HANDLER },
89
+ files: project(handler(generic('const invoice =', 'const record =').replaceAll('invoice.', 'record.')), {
90
+ [CONFIG_FILE]: config({ businessNames: { words: ['record'] } }),
91
+ }),
92
+ },
93
+ ];
94
+ /** The same handler with one binding named by a generic word, what the line of `NAMED` becomes. */
95
+ function generic(line, written) {
96
+ return NAMED.replace(line, written);
97
+ }
98
+ //# sourceMappingURL=business-name-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"business-name-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/business-name-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAEvD,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAC7C,MAAM,IAAI,GAAG,GAAG,OAAO,kCAAkC,CAAC;AAE1D,oHAAoH;AACpH,MAAM,KAAK,GAAG,MAAM,CAClB,oCAAoC,EACpC,2CAA2C,EAC3C,EAAE,EACF,kEAAkE,EAClE,2CAA2C,EAC3C,uEAAuE,EACvE,EAAE,EACF,iCAAiC,EACjC,0BAA0B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,MAAM,qBAAqB,EAAE,SAAS,OAAO,EAiLnD,CAAC"}
1
+ {"version":3,"file":"declarations-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/declarations-fixtures.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA2B5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,OAAO,EAyInD,CAAC"}
@@ -11,7 +11,6 @@ import { SAMPLES } from './samples.js';
11
11
  import { withoutFile } from './without-file.js';
12
12
  const { ADAPTER, AGGREGATE, BARREL, BILLING, COMMAND, EVENT, EVENT_HANDLER, EVENT_HANDLER_SPEC, HANDLER, INTEGRATION_HANDLER, INTEGRATION_HANDLER_SPEC, JOB, JOB_SPEC, MODULE, POLICY, } = PATHS;
13
13
  const { SPEC } = SAMPLES;
14
- const STATIC_EVENT = "export class InvoiceIssued {\n static readonly eventName = 'billing.invoice.issued';\n\n readonly name = InvoiceIssued.eventName;\n}\n";
15
14
  export const DECLARATIONS_FIXTURES = [
16
15
  {
17
16
  ruleId: 'declarations/role-declared',
@@ -52,15 +51,6 @@ export const DECLARATIONS_FIXTURES = [
52
51
  [POLICY]: "import { Policy } from '@ddd-ts-kit/kernel/declarations';\n\n@Policy(billingPermissions['invoice.void'], { name: POLICY_NAME })\nexport class OnlyIssuerVoidsPolicy {}\n",
53
52
  }),
54
53
  },
55
- {
56
- ruleId: 'declarations/role-declared',
57
- name: 'a domain event handler named by a template with a substitution',
58
- expect: { file: EVENT_HANDLER },
59
- files: declaredProject({
60
- [EVENT_HANDLER]: "import { DomainEventHandler } from '@ddd-ts-kit/kernel/declarations';\n\n@DomainEventHandler(InvoiceIssued, { name: `${CONTEXT}.invoice.issued` })\nexport class InvoiceIssuedEventHandler {}\n",
61
- [EVENT_HANDLER_SPEC]: SPEC,
62
- }),
63
- },
64
54
  {
65
55
  ruleId: 'declarations/role-declared',
66
56
  name: 'an integration event handler whose consumer name is a variable',
@@ -73,41 +63,11 @@ export const DECLARATIONS_FIXTURES = [
73
63
  },
74
64
  {
75
65
  ruleId: 'declarations/role-declared',
76
- name: 'a domain event handler reading the name its event class declares',
66
+ name: 'a domain event handler attached under the name its event class declares',
77
67
  expect: 'pass',
78
- files: declaredProject({
79
- [EVENT]: STATIC_EVENT,
80
- [EVENT_HANDLER]: DECLARED.eventHandler.replace("'billing.invoice.issued'", 'InvoiceIssued.eventName'),
81
- [EVENT_HANDLER_SPEC]: SPEC,
82
- }),
83
- },
84
- {
85
- ruleId: 'declarations/role-declared',
86
- name: 'a domain event handler reading the name of another event class',
87
- expect: { file: EVENT_HANDLER },
88
- files: declaredProject({
89
- [EVENT]: STATIC_EVENT,
90
- [EVENT_HANDLER]: DECLARED.eventHandler.replace("'billing.invoice.issued'", 'InvoiceSent.eventName'),
91
- [EVENT_HANDLER_SPEC]: SPEC,
92
- }),
93
- },
94
- {
95
- ruleId: 'declarations/role-declared',
96
- name: 'a domain event handler written under another name than the one its event class declares once',
97
- expect: { file: EVENT_HANDLER },
98
- files: declaredProject({
99
- [EVENT]: STATIC_EVENT,
100
- [EVENT_HANDLER]: DECLARED.eventHandler.replace('billing.invoice.issued', 'billing.invoice.sent'),
101
- [EVENT_HANDLER_SPEC]: SPEC,
102
- }),
103
- },
104
- {
105
- ruleId: 'declarations/role-declared',
106
- name: 'a domain event handler written under another name than the one its event carries',
107
- expect: { file: EVENT_HANDLER },
108
68
  files: declaredProject({
109
69
  [EVENT]: DECLARED.event,
110
- [EVENT_HANDLER]: DECLARED.eventHandler.replace('billing.invoice.issued', 'billing.invoice.sent'),
70
+ [EVENT_HANDLER]: DECLARED.eventHandler,
111
71
  [EVENT_HANDLER_SPEC]: SPEC,
112
72
  }),
113
73
  },
@@ -1 +1 @@
1
- {"version":3,"file":"declarations-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/declarations-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAA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eAAe,CAAC,gBAAgB,EAAE;YACvC,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,OAAO,CAC/B,6FAA6F,EAC7F,EAAE,CACH;SACF,CAAC;KACH;IACD;QACE,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,6CAA6C;QACnD,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QACxB,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;KAC1E;IACD;QACE,MAAM,EAAE,4BAA4B;QACpC,IAAI,EAAE,8CAA8C;QACpD,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;QACrB,KAAK,EAAE,eAAe,CAAC;YACrB,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,wEAAwE,EAAE,EAAE,CAAC;YACzG,CAAC,QAAQ,CAAC,EAAE,IAAI;SACjB,CAAC;KACH;CACF,CAAC"}
1
+ {"version":3,"file":"declarations-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/declarations-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EA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G,CAAC,OAAO,CAAC,wEAAwE,EAAE,EAAE,CAAC;YACzG,CAAC,QAAQ,CAAC,EAAE,IAAI;SACjB,CAAC;KACH;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"declared.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/declared.ts"],"names":[],"mappings":"AAIA,0FAA0F;AAC1F,eAAO,MAAM,QAAQ;aACnB,cAAc;aAMd,IAAI;aACJ,OAAO;aAMP,OAAO;aASP,KAAK;aACL,YAAY;aAMZ,kBAAkB;aAYlB,KAAK;aACL,YAAY;aAOZ,SAAS;aAQT,MAAM;aAMN,GAAG;aAaH,UAAU;aASV,OAAO;aAQP,OAAO;CAOC,CAAC"}
1
+ {"version":3,"file":"declared.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/declared.ts"],"names":[],"mappings":"AAIA,0FAA0F;AAC1F,eAAO,MAAM,QAAQ;aACnB,cAAc;aAMd,IAAI;aACJ,OAAO;aAMP,OAAO;aASP,KAAK;aACL,YAAY;aAMZ,kBAAkB;aAYlB,KAAK;aAOL,YAAY;aAOZ,SAAS;aAQT,MAAM;aAMN,GAAG;aAaH,UAAU;aASV,OAAO;aAQP,OAAO;CAOC,CAAC"}
@@ -9,9 +9,9 @@ export const DECLARED = {
9
9
  query: source(`import { Public } from ${DECLARATIONS};`, '', '@Public()', 'export class InvoicesIssuedQuery {}'),
10
10
  queryHandler: source(`import { QueryHandler } from ${DECLARATIONS};`, '', '@QueryHandler(InvoicesIssuedQuery, [])', 'export class InvoicesIssuedHandler implements QueryHandler<InvoicesIssuedQuery> {}'),
11
11
  integrationHandler: source("import { CommandBus } from '@ddd-ts-kit/kernel';", `import { IntegrationEventHandler } from ${DECLARATIONS};`, "import { productListedV1 } from '@/contexts/catalog/published-language/index.js';", '', '@IntegrationEventHandler(', ' productListedV1,', " { consumer: 'billing.product-listed' },", ' [CommandBus],', ')', 'export class ProductListedIntegrationHandler {}'),
12
- event: source('export class InvoiceIssued {', " readonly name = 'billing.invoice.issued';", '}'),
13
- eventHandler: source(`import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', "@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' })", 'export class InvoiceIssuedEventHandler {}'),
14
- publisher: source("import { IntegrationEventPublisher } from '@ddd-ts-kit/kernel';", `import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', "@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [IntegrationEventPublisher])", 'export class InvoiceIssuedPublisher {}'),
12
+ event: source('export class InvoiceIssued {', " static readonly eventName = 'billing.invoice.issued';", '', ' readonly name = InvoiceIssued.eventName;', '}'),
13
+ eventHandler: source(`import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', '@DomainEventHandler(InvoiceIssued)', 'export class InvoiceIssuedEventHandler {}'),
14
+ publisher: source("import { IntegrationEventPublisher } from '@ddd-ts-kit/kernel';", `import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', '@DomainEventHandler(InvoiceIssued, [IntegrationEventPublisher])', 'export class InvoiceIssuedPublisher {}'),
15
15
  policy: source(`import { Policy } from ${DECLARATIONS};`, '', "@Policy(billingPermissions['invoice.void'], { name: 'billing.only-issuer-voids' })", 'export class OnlyIssuerVoidsPolicy {}'),
16
16
  job: source("import { CommandBus, systemActor } from '@ddd-ts-kit/kernel';", `import { Scheduled, type JobExecution, type ScheduledJob } from ${DECLARATIONS};`, '', "@Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])", 'export class SendRemindersJob implements ScheduledJob {', ' constructor(private readonly commands: CommandBus) {}', '', ' async run(execution: JobExecution): Promise<void> {', " await this.commands.execute(new SendRemindersCommand(systemActor('billing.send-reminders'), execution.scheduledAt));", ' }', '}'),
17
17
  repository: source("import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';", `import { Repository } from ${DECLARATIONS};`, "import { Database } from '@/platform/database.js';", "import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';", '', '@Repository(InvoiceRepository, [Database, ExecutionScope, Clock])', 'export class InMemoryInvoiceRepository implements InvoiceRepository {}'),
@@ -1 +1 @@
1
- {"version":3,"file":"declared.js","sourceRoot":"","sources":["../../../src/check/fixtures/declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,YAAY,GAAG,mCAAmC,CAAC;AAEzD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc,EAAE,MAAM,CACpB,kDAAkD,EAClD,2FAA2F,EAC3F,EAAE,EACF,wEAAwE,CACzE;IACD,IAAI,EAAE,MAAM,CAAC,wCAAwC,EAAE,sDAAsD,EAAE,GAAG,CAAC;IACnH,OAAO,EAAE,MAAM,CACb,4BAA4B,YAAY,GAAG,EAC3C,EAAE,EACF,gDAAgD,EAChD,qCAAqC,CACtC;IACD,OAAO,EAAE,MAAM,CACb,6CAA6C,EAC7C,kCAAkC,YAAY,GAAG,EACjD,mGAAmG,EACnG,uHAAuH,EACvH,EAAE,EACF,kEAAkE,EAClE,oFAAoF,CACrF;IACD,KAAK,EAAE,MAAM,CAAC,0BAA0B,YAAY,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,qCAAqC,CAAC;IAChH,YAAY,EAAE,MAAM,CAClB,gCAAgC,YAAY,GAAG,EAC/C,EAAE,EACF,wCAAwC,EACxC,oFAAoF,CACrF;IACD,kBAAkB,EAAE,MAAM,CACxB,kDAAkD,EAClD,2CAA2C,YAAY,GAAG,EAC1D,mFAAmF,EACnF,EAAE,EACF,2BAA2B,EAC3B,oBAAoB,EACpB,2CAA2C,EAC3C,iBAAiB,EACjB,GAAG,EACH,iDAAiD,CAClD;IACD,KAAK,EAAE,MAAM,CAAC,8BAA8B,EAAE,6CAA6C,EAAE,GAAG,CAAC;IACjG,YAAY,EAAE,MAAM,CAClB,sCAAsC,YAAY,GAAG,EACrD,2FAA2F,EAC3F,EAAE,EACF,wEAAwE,EACxE,2CAA2C,CAC5C;IACD,SAAS,EAAE,MAAM,CACf,iEAAiE,EACjE,sCAAsC,YAAY,GAAG,EACrD,2FAA2F,EAC3F,EAAE,EACF,qGAAqG,EACrG,wCAAwC,CACzC;IACD,MAAM,EAAE,MAAM,CACZ,0BAA0B,YAAY,GAAG,EACzC,EAAE,EACF,oFAAoF,EACpF,uCAAuC,CACxC;IACD,GAAG,EAAE,MAAM,CACT,+DAA+D,EAC/D,mEAAmE,YAAY,GAAG,EAClF,EAAE,EACF,sEAAsE,EACtE,yDAAyD,EACzD,yDAAyD,EACzD,EAAE,EACF,uDAAuD,EACvD,0HAA0H,EAC1H,KAAK,EACL,GAAG,CACJ;IACD,UAAU,EAAE,MAAM,CAChB,6DAA6D,EAC7D,8BAA8B,YAAY,GAAG,EAC7C,oDAAoD,EACpD,mGAAmG,EACnG,EAAE,EACF,mEAAmE,EACnE,wEAAwE,CACzE;IACD,OAAO,EAAE,MAAM,CACb,2BAA2B,YAAY,GAAG,EAC1C,8EAA8E,EAC9E,2GAA2G,EAC3G,EAAE,EACF,uDAAuD,EACvD,6EAA6E,CAC9E;IACD,OAAO,EAAE,MAAM,CACb,2BAA2B,YAAY,GAAG,EAC1C,gGAAgG,EAChG,EAAE,EACF,gDAAgD,EAChD,gEAAgE,CACjE;CACO,CAAC"}
1
+ {"version":3,"file":"declared.js","sourceRoot":"","sources":["../../../src/check/fixtures/declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,YAAY,GAAG,mCAAmC,CAAC;AAEzD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc,EAAE,MAAM,CACpB,kDAA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,EACF,sEAAsE,EACtE,yDAAyD,EACzD,yDAAyD,EACzD,EAAE,EACF,uDAAuD,EACvD,0HAA0H,EAC1H,KAAK,EACL,GAAG,CACJ;IACD,UAAU,EAAE,MAAM,CAChB,6DAA6D,EAC7D,8BAA8B,YAAY,GAAG,EAC7C,oDAAoD,EACpD,mGAAmG,EACnG,EAAE,EACF,mEAAmE,EACnE,wEAAwE,CACzE;IACD,OAAO,EAAE,MAAM,CACb,2BAA2B,YAAY,GAAG,EAC1C,8EAA8E,EAC9E,2GAA2G,EAC3G,EAAE,EACF,uDAAuD,EACvD,6EAA6E,CAC9E;IACD,OAAO,EAAE,MAAM,CACb,2BAA2B,YAAY,GAAG,EAC1C,gGAAgG,EAChG,EAAE,EACF,gDAAgD,EAChD,gEAAgE,CACjE;CACO,CAAC"}
@@ -12,7 +12,7 @@ const TRANSACTIONAL = 'domain-events/transactional-before-commit';
12
12
  const KERNEL = "'@ddd-ts-kit/kernel'";
13
13
  const DECLARATIONS = "'@ddd-ts-kit/kernel/declarations'";
14
14
  const SAVING_ADAPTER = source(`import { Repository } from ${DECLARATIONS};`, "import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';", '', '@Repository(InvoiceRepository, [])', 'export class InMemoryInvoiceRepository implements InvoiceRepository {', ' async save(invoice: Invoice): Promise<void> {', ' await this.dispatch(invoice.pullEvents());', ' }', '}');
15
- const PULLING_EVENT_HANDLER = source(`import { DomainEventDispatcher } from ${KERNEL};`, `import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', "@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [DomainEventDispatcher])", 'export class InvoiceIssuedEventHandler {', ' async handle(event: InvoiceIssued): Promise<void> {', ' await this.dispatcher.dispatch(event.invoice.pullEvents());', ' }', '}');
15
+ const PULLING_EVENT_HANDLER = source(`import { DomainEventDispatcher } from ${KERNEL};`, `import { DomainEventHandler } from ${DECLARATIONS};`, "import { InvoiceIssued } from '@/contexts/billing/domain/events/invoice-issued.event.js';", '', '@DomainEventHandler(InvoiceIssued, [DomainEventDispatcher])', 'export class InvoiceIssuedEventHandler {', ' async handle(event: InvoiceIssued): Promise<void> {', ' await this.dispatcher.dispatch(event.invoice.pullEvents());', ' }', '}');
16
16
  const DISPATCHED_ON_SAVE = [
17
17
  {
18
18
  ruleId: RULE,