ddd-ts-kit 0.14.0 → 0.16.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 (500) hide show
  1. package/README.md +31 -2
  2. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  3. package/dist/check/catalogue/architecture-rules.js +2 -0
  4. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  5. package/dist/check/explain/domain-docs.d.ts +3 -0
  6. package/dist/check/explain/domain-docs.d.ts.map +1 -0
  7. package/dist/check/explain/domain-docs.js +30 -0
  8. package/dist/check/explain/domain-docs.js.map +1 -0
  9. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  10. package/dist/check/explain/rule-docs.js +2 -0
  11. package/dist/check/explain/rule-docs.js.map +1 -1
  12. package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
  13. package/dist/check/explain/tenancy-docs.js +3 -1
  14. package/dist/check/explain/tenancy-docs.js.map +1 -1
  15. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  16. package/dist/check/fixtures/fixtures.js +4 -0
  17. package/dist/check/fixtures/fixtures.js.map +1 -1
  18. package/dist/check/fixtures/model-function-fixtures.d.ts +4 -0
  19. package/dist/check/fixtures/model-function-fixtures.d.ts.map +1 -0
  20. package/dist/check/fixtures/model-function-fixtures.js +52 -0
  21. package/dist/check/fixtures/model-function-fixtures.js.map +1 -0
  22. package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
  23. package/dist/check/fixtures/tenancy-fixtures.js +28 -0
  24. package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
  25. package/dist/check/fixtures/value-object-file-fixtures.d.ts +4 -0
  26. package/dist/check/fixtures/value-object-file-fixtures.d.ts.map +1 -0
  27. package/dist/check/fixtures/value-object-file-fixtures.js +54 -0
  28. package/dist/check/fixtures/value-object-file-fixtures.js.map +1 -0
  29. package/dist/check/fixtures/value-object-files.d.ts +34 -0
  30. package/dist/check/fixtures/value-object-files.d.ts.map +1 -0
  31. package/dist/check/fixtures/value-object-files.js +46 -0
  32. package/dist/check/fixtures/value-object-files.js.map +1 -0
  33. package/dist/check/rules/domain-value-object-class.d.ts +3 -0
  34. package/dist/check/rules/domain-value-object-class.d.ts.map +1 -0
  35. package/dist/check/rules/domain-value-object-class.js +21 -0
  36. package/dist/check/rules/domain-value-object-class.js.map +1 -0
  37. package/dist/check/structure/class-body-brace.d.ts +6 -0
  38. package/dist/check/structure/class-body-brace.d.ts.map +1 -0
  39. package/dist/check/structure/class-body-brace.js +22 -0
  40. package/dist/check/structure/class-body-brace.js.map +1 -0
  41. package/dist/check/structure/read-structure.d.ts.map +1 -1
  42. package/dist/check/structure/read-structure.js +3 -1
  43. package/dist/check/structure/read-structure.js.map +1 -1
  44. package/dist/check/tenancy/knex-unscoped.d.ts +6 -1
  45. package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
  46. package/dist/check/tenancy/knex-unscoped.js +19 -6
  47. package/dist/check/tenancy/knex-unscoped.js.map +1 -1
  48. package/dist/check/tenancy/raw-reaches-rows.d.ts +8 -0
  49. package/dist/check/tenancy/raw-reaches-rows.d.ts.map +1 -0
  50. package/dist/check/tenancy/raw-reaches-rows.js +91 -0
  51. package/dist/check/tenancy/raw-reaches-rows.js.map +1 -0
  52. package/dist/check/tenancy/raw-sql-text.d.ts +9 -0
  53. package/dist/check/tenancy/raw-sql-text.d.ts.map +1 -0
  54. package/dist/check/tenancy/raw-sql-text.js +29 -0
  55. package/dist/check/tenancy/raw-sql-text.js.map +1 -0
  56. package/dist/check/values/answered-literals.d.ts +8 -0
  57. package/dist/check/values/answered-literals.d.ts.map +1 -0
  58. package/dist/check/values/answered-literals.js +20 -0
  59. package/dist/check/values/answered-literals.js.map +1 -0
  60. package/dist/check/values/arrow-body.d.ts +4 -0
  61. package/dist/check/values/arrow-body.d.ts.map +1 -0
  62. package/dist/check/values/arrow-body.js +52 -0
  63. package/dist/check/values/arrow-body.js.map +1 -0
  64. package/dist/check/values/entry-role.d.ts +10 -0
  65. package/dist/check/values/entry-role.d.ts.map +1 -0
  66. package/dist/check/values/entry-role.js +40 -0
  67. package/dist/check/values/entry-role.js.map +1 -0
  68. package/dist/check/values/exported-function-body.d.ts +9 -0
  69. package/dist/check/values/exported-function-body.d.ts.map +1 -0
  70. package/dist/check/values/exported-function-body.js +29 -0
  71. package/dist/check/values/exported-function-body.js.map +1 -0
  72. package/dist/check/values/exported-values.d.ts +9 -0
  73. package/dist/check/values/exported-values.d.ts.map +1 -0
  74. package/dist/check/values/exported-values.js +48 -0
  75. package/dist/check/values/exported-values.js.map +1 -0
  76. package/dist/check/values/extends-value-object.d.ts +9 -0
  77. package/dist/check/values/extends-value-object.d.ts.map +1 -0
  78. package/dist/check/values/extends-value-object.js +25 -0
  79. package/dist/check/values/extends-value-object.js.map +1 -0
  80. package/dist/check/values/function-body.d.ts +10 -0
  81. package/dist/check/values/function-body.d.ts.map +1 -0
  82. package/dist/check/values/function-body.js +2 -0
  83. package/dist/check/values/function-body.js.map +1 -0
  84. package/dist/check/values/generate-hint.d.ts +4 -0
  85. package/dist/check/values/generate-hint.d.ts.map +1 -0
  86. package/dist/check/values/generate-hint.js +8 -0
  87. package/dist/check/values/generate-hint.js.map +1 -0
  88. package/dist/check/values/initializer-of.d.ts +3 -0
  89. package/dist/check/values/initializer-of.d.ts.map +1 -0
  90. package/dist/check/values/initializer-of.js +15 -0
  91. package/dist/check/values/initializer-of.js.map +1 -0
  92. package/dist/check/values/is-model-file.d.ts +8 -0
  93. package/dist/check/values/is-model-file.d.ts.map +1 -0
  94. package/dist/check/values/is-model-file.js +15 -0
  95. package/dist/check/values/is-model-file.js.map +1 -0
  96. package/dist/check/values/is-value-object-file.d.ts +7 -0
  97. package/dist/check/values/is-value-object-file.d.ts.map +1 -0
  98. package/dist/check/values/is-value-object-file.js +14 -0
  99. package/dist/check/values/is-value-object-file.js.map +1 -0
  100. package/dist/check/values/javascript-globals.d.ts +3 -0
  101. package/dist/check/values/javascript-globals.d.ts.map +1 -0
  102. package/dist/check/values/javascript-globals.js +22 -0
  103. package/dist/check/values/javascript-globals.js.map +1 -0
  104. package/dist/check/values/literal-at.d.ts +3 -0
  105. package/dist/check/values/literal-at.d.ts.map +1 -0
  106. package/dist/check/values/literal-at.js +7 -0
  107. package/dist/check/values/literal-at.js.map +1 -0
  108. package/dist/check/values/local-declaration.d.ts +8 -0
  109. package/dist/check/values/local-declaration.d.ts.map +1 -0
  110. package/dist/check/values/local-declaration.js +31 -0
  111. package/dist/check/values/local-declaration.js.map +1 -0
  112. package/dist/check/values/nested-bodies.d.ts +8 -0
  113. package/dist/check/values/nested-bodies.d.ts.map +1 -0
  114. package/dist/check/values/nested-bodies.js +28 -0
  115. package/dist/check/values/nested-bodies.js.map +1 -0
  116. package/dist/check/values/plain-value-functions.d.ts +10 -0
  117. package/dist/check/values/plain-value-functions.d.ts.map +1 -0
  118. package/dist/check/values/plain-value-functions.js +33 -0
  119. package/dist/check/values/plain-value-functions.js.map +1 -0
  120. package/dist/check/values/returns-package-type.d.ts +9 -0
  121. package/dist/check/values/returns-package-type.d.ts.map +1 -0
  122. package/dist/check/values/returns-package-type.js +12 -0
  123. package/dist/check/values/returns-package-type.js.map +1 -0
  124. package/dist/check/values/stands-for-a-value.d.ts +9 -0
  125. package/dist/check/values/stands-for-a-value.d.ts.map +1 -0
  126. package/dist/check/values/stands-for-a-value.js +28 -0
  127. package/dist/check/values/stands-for-a-value.js.map +1 -0
  128. package/dist/check/values/value-object-file-findings.d.ts +5 -0
  129. package/dist/check/values/value-object-file-findings.d.ts.map +1 -0
  130. package/dist/check/values/value-object-file-findings.js +96 -0
  131. package/dist/check/values/value-object-file-findings.js.map +1 -0
  132. package/dist/commands/generate.js +2 -0
  133. package/dist/commands/generate.js.map +1 -1
  134. package/dist/commands/init.d.ts.map +1 -1
  135. package/dist/commands/init.js +12 -1
  136. package/dist/commands/init.js.map +1 -1
  137. package/dist/config/index.d.ts +1 -1
  138. package/dist/config/index.d.ts.map +1 -1
  139. package/dist/config/index.js +1 -1
  140. package/dist/config/index.js.map +1 -1
  141. package/dist/config/parse-stack.d.ts.map +1 -1
  142. package/dist/config/parse-stack.js +2 -1
  143. package/dist/config/parse-stack.js.map +1 -1
  144. package/dist/config/stack.d.ts +8 -0
  145. package/dist/config/stack.d.ts.map +1 -1
  146. package/dist/config/stack.js +1 -0
  147. package/dist/config/stack.js.map +1 -1
  148. package/dist/declared/injection/laid-out-calls.d.ts +7 -0
  149. package/dist/declared/injection/laid-out-calls.d.ts.map +1 -0
  150. package/dist/declared/injection/laid-out-calls.js +14 -0
  151. package/dist/declared/injection/laid-out-calls.js.map +1 -0
  152. package/dist/declared/render-barrel.d.ts.map +1 -1
  153. package/dist/declared/render-barrel.js +2 -1
  154. package/dist/declared/render-barrel.js.map +1 -1
  155. package/dist/declared/render-dependencies-file.d.ts.map +1 -1
  156. package/dist/declared/render-dependencies-file.js +2 -1
  157. package/dist/declared/render-dependencies-file.js.map +1 -1
  158. package/dist/generate/kind.d.ts +2 -0
  159. package/dist/generate/kind.d.ts.map +1 -1
  160. package/dist/generate/kinds/context-kind.d.ts.map +1 -1
  161. package/dist/generate/kinds/context-kind.js +13 -6
  162. package/dist/generate/kinds/context-kind.js.map +1 -1
  163. package/dist/generate/kinds/next-adr-number.d.ts +4 -0
  164. package/dist/generate/kinds/next-adr-number.d.ts.map +1 -0
  165. package/dist/generate/kinds/next-adr-number.js +7 -0
  166. package/dist/generate/kinds/next-adr-number.js.map +1 -0
  167. package/dist/generate/kinds/write-adr.js +3 -6
  168. package/dist/generate/kinds/write-adr.js.map +1 -1
  169. package/dist/help/usage.d.ts +1 -1
  170. package/dist/help/usage.d.ts.map +1 -1
  171. package/dist/help/usage.js +2 -2
  172. package/dist/init/manifest/versions.js +24 -24
  173. package/dist/init/run-init.d.ts +2 -0
  174. package/dist/init/run-init.d.ts.map +1 -1
  175. package/dist/init/run-init.js +15 -1
  176. package/dist/init/run-init.js.map +1 -1
  177. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  178. package/dist/init/stack/resolve-stack.js +3 -1
  179. package/dist/init/stack/resolve-stack.js.map +1 -1
  180. package/dist/init/stack/stack-options.d.ts +2 -0
  181. package/dist/init/stack/stack-options.d.ts.map +1 -1
  182. package/dist/presets/apply-preset.d.ts +15 -0
  183. package/dist/presets/apply-preset.d.ts.map +1 -0
  184. package/dist/presets/apply-preset.js +94 -0
  185. package/dist/presets/apply-preset.js.map +1 -0
  186. package/dist/presets/grant-to-signed-in.d.ts +9 -0
  187. package/dist/presets/grant-to-signed-in.d.ts.map +1 -0
  188. package/dist/presets/grant-to-signed-in.js +61 -0
  189. package/dist/presets/grant-to-signed-in.js.map +1 -0
  190. package/dist/presets/identity-preset.d.ts +9 -0
  191. package/dist/presets/identity-preset.d.ts.map +1 -0
  192. package/dist/presets/identity-preset.js +44 -0
  193. package/dist/presets/identity-preset.js.map +1 -0
  194. package/dist/presets/identity-refusal.d.ts +5 -0
  195. package/dist/presets/identity-refusal.d.ts.map +1 -0
  196. package/dist/presets/identity-refusal.js +29 -0
  197. package/dist/presets/identity-refusal.js.map +1 -0
  198. package/dist/presets/identity-terms.d.ts +4 -0
  199. package/dist/presets/identity-terms.d.ts.map +1 -0
  200. package/dist/presets/identity-terms.js +57 -0
  201. package/dist/presets/identity-terms.js.map +1 -0
  202. package/dist/presets/no-flags.d.ts +4 -0
  203. package/dist/presets/no-flags.d.ts.map +1 -0
  204. package/dist/presets/no-flags.js +18 -0
  205. package/dist/presets/no-flags.js.map +1 -0
  206. package/dist/presets/organisations-as-tenants.d.ts +9 -0
  207. package/dist/presets/organisations-as-tenants.d.ts.map +1 -0
  208. package/dist/presets/organisations-as-tenants.js +43 -0
  209. package/dist/presets/organisations-as-tenants.js.map +1 -0
  210. package/dist/presets/preset-decision.d.ts +8 -0
  211. package/dist/presets/preset-decision.d.ts.map +1 -0
  212. package/dist/presets/preset-decision.js +19 -0
  213. package/dist/presets/preset-decision.js.map +1 -0
  214. package/dist/presets/preset-file.d.ts +13 -0
  215. package/dist/presets/preset-file.d.ts.map +1 -0
  216. package/dist/presets/preset-file.js +2 -0
  217. package/dist/presets/preset-file.js.map +1 -0
  218. package/dist/presets/preset-files.d.ts +9 -0
  219. package/dist/presets/preset-files.d.ts.map +1 -0
  220. package/dist/presets/preset-files.js +34 -0
  221. package/dist/presets/preset-files.js.map +1 -0
  222. package/dist/presets/preset-named.d.ts +3 -0
  223. package/dist/presets/preset-named.d.ts.map +1 -0
  224. package/dist/presets/preset-named.js +12 -0
  225. package/dist/presets/preset-named.js.map +1 -0
  226. package/dist/presets/preset-refusal.d.ts +6 -0
  227. package/dist/presets/preset-refusal.d.ts.map +1 -0
  228. package/dist/presets/preset-refusal.js +2 -0
  229. package/dist/presets/preset-refusal.js.map +1 -0
  230. package/dist/presets/preset-step.d.ts +8 -0
  231. package/dist/presets/preset-step.d.ts.map +1 -0
  232. package/dist/presets/preset-step.js +2 -0
  233. package/dist/presets/preset-step.js.map +1 -0
  234. package/dist/presets/preset.d.ts +36 -0
  235. package/dist/presets/preset.d.ts.map +1 -0
  236. package/dist/presets/preset.js +2 -0
  237. package/dist/presets/preset.js.map +1 -0
  238. package/dist/presets/with-authorizer-import.d.ts +6 -0
  239. package/dist/presets/with-authorizer-import.d.ts.map +1 -0
  240. package/dist/presets/with-authorizer-import.js +27 -0
  241. package/dist/presets/with-authorizer-import.js.map +1 -0
  242. package/dist/stack/stack-vars.js +2 -1
  243. package/dist/stack/stack-vars.js.map +1 -1
  244. package/dist/version.d.ts +1 -1
  245. package/dist/version.js +1 -1
  246. package/dist/workspace/workspace.d.ts +2 -0
  247. package/dist/workspace/workspace.d.ts.map +1 -1
  248. package/dist/workspace/workspace.js +4 -0
  249. package/dist/workspace/workspace.js.map +1 -1
  250. package/package.json +2 -2
  251. package/templates/init/rules/domain.md.tpl +1 -1
  252. package/templates/pipeline/package-scripts.json +1 -1
  253. package/templates/presets/identity/context/application/authorization/__context__.permissions.ts.tpl +23 -0
  254. package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +17 -0
  255. package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +17 -0
  256. package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +17 -0
  257. package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +17 -0
  258. package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +17 -0
  259. package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +17 -0
  260. package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +17 -0
  261. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +14 -0
  262. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +56 -0
  263. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +17 -0
  264. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +82 -0
  265. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +7 -0
  266. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +69 -0
  267. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +14 -0
  268. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +36 -0
  269. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +21 -0
  270. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +43 -0
  271. package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +16 -0
  272. package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +53 -0
  273. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +14 -0
  274. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +50 -0
  275. package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +14 -0
  276. package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +41 -0
  277. package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +15 -0
  278. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +79 -0
  279. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +15 -0
  280. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +39 -0
  281. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +15 -0
  282. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +42 -0
  283. package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +19 -0
  284. package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +33 -0
  285. package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +30 -0
  286. package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +19 -0
  287. package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +24 -0
  288. package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +36 -0
  289. package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +33 -0
  290. package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +33 -0
  291. package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +33 -0
  292. package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +35 -0
  293. package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +32 -0
  294. package/templates/presets/identity/context/application/ports/identity-provider-admin.port.ts.tpl +17 -0
  295. package/templates/presets/identity/context/application/ports/identity-provider-connection.port.ts.tpl +14 -0
  296. package/templates/presets/identity/context/application/ports/invitation-tokens.port.ts.tpl +7 -0
  297. package/templates/presets/identity/context/application/ports/search-members-reader.port.ts.tpl +10 -0
  298. package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +33 -0
  299. package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +19 -0
  300. package/templates/presets/identity/context/application/queries/search-members/search-members.result.ts.tpl +17 -0
  301. package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +92 -0
  302. package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +117 -0
  303. package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +128 -0
  304. package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +149 -0
  305. package/templates/presets/identity/context/domain/aggregates/organisation.aggregate.ts.tpl +52 -0
  306. package/templates/presets/identity/context/domain/errors/account.error.ts.tpl +40 -0
  307. package/templates/presets/identity/context/domain/errors/delegation.error.ts.tpl +45 -0
  308. package/templates/presets/identity/context/domain/errors/invitation.error.ts.tpl +30 -0
  309. package/templates/presets/identity/context/domain/errors/member.error.ts.tpl +50 -0
  310. package/templates/presets/identity/context/domain/errors/organisation.error.ts.tpl +32 -0
  311. package/templates/presets/identity/context/domain/events/account-deactivated.event.ts.tpl +13 -0
  312. package/templates/presets/identity/context/domain/events/account-provisioned.event.ts.tpl +17 -0
  313. package/templates/presets/identity/context/domain/events/delegation-granted.event.ts.tpl +22 -0
  314. package/templates/presets/identity/context/domain/events/delegation-revoked.event.ts.tpl +18 -0
  315. package/templates/presets/identity/context/domain/events/invitation-accepted.event.ts.tpl +17 -0
  316. package/templates/presets/identity/context/domain/events/invitation-declined.event.ts.tpl +16 -0
  317. package/templates/presets/identity/context/domain/events/invitation-issued.event.ts.tpl +22 -0
  318. package/templates/presets/identity/context/domain/events/invitation-revoked.event.ts.tpl +16 -0
  319. package/templates/presets/identity/context/domain/events/member-joined.event.ts.tpl +19 -0
  320. package/templates/presets/identity/context/domain/events/member-removed.event.ts.tpl +19 -0
  321. package/templates/presets/identity/context/domain/events/member-role-changed.event.ts.tpl +22 -0
  322. package/templates/presets/identity/context/domain/events/organisation-opened.event.ts.tpl +17 -0
  323. package/templates/presets/identity/context/domain/repositories/account.repository.ts.tpl +5 -0
  324. package/templates/presets/identity/context/domain/repositories/delegation.repository.ts.tpl +10 -0
  325. package/templates/presets/identity/context/domain/repositories/invitation.repository.ts.tpl +7 -0
  326. package/templates/presets/identity/context/domain/repositories/member.repository.ts.tpl +13 -0
  327. package/templates/presets/identity/context/domain/repositories/organisation.repository.ts.tpl +5 -0
  328. package/templates/presets/identity/context/domain/services/role-rights.service.ts.tpl +59 -0
  329. package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +42 -0
  330. package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +29 -0
  331. package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +31 -0
  332. package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +29 -0
  333. package/templates/presets/identity/context/domain/value-objects/organisation-rights.vo.ts.tpl +43 -0
  334. package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +30 -0
  335. package/templates/presets/identity/context/domain/vocabularies/account-status.vocabulary.ts.tpl +7 -0
  336. package/templates/presets/identity/context/domain/vocabularies/invitation-status.vocabulary.ts.tpl +9 -0
  337. package/templates/presets/identity/context/domain/vocabularies/member-right.vocabulary.ts.tpl +9 -0
  338. package/templates/presets/identity/context/domain/vocabularies/member-role.vocabulary.ts.tpl +8 -0
  339. package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +20 -0
  340. package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +37 -0
  341. package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +149 -0
  342. package/templates/presets/identity/context/infrastructure/persistence/__context__.schema.drizzle.ts.tpl +102 -0
  343. package/templates/presets/identity/context/infrastructure/persistence/account-row.schema.knex.ts.tpl +15 -0
  344. package/templates/presets/identity/context/infrastructure/persistence/account.mapper.drizzle.ts.tpl +38 -0
  345. package/templates/presets/identity/context/infrastructure/persistence/account.mapper.knex.ts.tpl +33 -0
  346. package/templates/presets/identity/context/infrastructure/persistence/create-__context__-tables.schema.knex.ts.tpl +107 -0
  347. package/templates/presets/identity/context/infrastructure/persistence/delegation-row.schema.knex.ts.tpl +17 -0
  348. package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.drizzle.ts.tpl +50 -0
  349. package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.knex.ts.tpl +45 -0
  350. package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +59 -0
  351. package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +77 -0
  352. package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +65 -0
  353. package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +84 -0
  354. package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +59 -0
  355. package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +53 -0
  356. package/templates/presets/identity/context/infrastructure/persistence/invitation-row.schema.knex.ts.tpl +20 -0
  357. package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.drizzle.ts.tpl +45 -0
  358. package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.knex.ts.tpl +40 -0
  359. package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +61 -0
  360. package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +80 -0
  361. package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +67 -0
  362. package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +82 -0
  363. package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +61 -0
  364. package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +77 -0
  365. package/templates/presets/identity/context/infrastructure/persistence/member-row.schema.knex.ts.tpl +15 -0
  366. package/templates/presets/identity/context/infrastructure/persistence/member.mapper.drizzle.ts.tpl +36 -0
  367. package/templates/presets/identity/context/infrastructure/persistence/member.mapper.knex.ts.tpl +31 -0
  368. package/templates/presets/identity/context/infrastructure/persistence/organisation-row.schema.knex.ts.tpl +12 -0
  369. package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.drizzle.ts.tpl +28 -0
  370. package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.knex.ts.tpl +26 -0
  371. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.accepted.class-validator.per-route.ts.tpl +6 -0
  372. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.ts.tpl +71 -0
  373. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.accepted.class-validator.per-route.ts.tpl +6 -0
  374. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.body.class-validator.ts.tpl +9 -0
  375. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.ts.tpl +85 -0
  376. package/templates/presets/identity/context/presentation/http/accounts.routes.ts.tpl +5 -0
  377. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
  378. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.body.class-validator.per-route.ts.tpl +8 -0
  379. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.ts.tpl +100 -0
  380. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
  381. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.body.class-validator.per-route.ts.tpl +8 -0
  382. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.ts.tpl +98 -0
  383. package/templates/presets/identity/context/presentation/http/invitations.routes.ts.tpl +5 -0
  384. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.accepted.class-validator.per-route.ts.tpl +6 -0
  385. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.body.class-validator.ts.tpl +7 -0
  386. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.ts.tpl +83 -0
  387. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.params.class-validator.ts.tpl +11 -0
  388. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.accepted.class-validator.per-route.ts.tpl +6 -0
  389. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.body.class-validator.ts.tpl +18 -0
  390. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.ts.tpl +103 -0
  391. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.params.class-validator.ts.tpl +7 -0
  392. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.accepted.class-validator.ts.tpl +10 -0
  393. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.body.class-validator.ts.tpl +10 -0
  394. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.ts.tpl +65 -0
  395. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.params.class-validator.ts.tpl +7 -0
  396. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.accepted.class-validator.per-route.ts.tpl +6 -0
  397. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.body.class-validator.ts.tpl +12 -0
  398. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.ts.tpl +79 -0
  399. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.accepted.class-validator.per-route.ts.tpl +6 -0
  400. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.ts.tpl +73 -0
  401. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.params.class-validator.ts.tpl +11 -0
  402. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.accepted.class-validator.per-route.ts.tpl +6 -0
  403. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.ts.tpl +73 -0
  404. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.params.class-validator.ts.tpl +11 -0
  405. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.accepted.class-validator.per-route.ts.tpl +6 -0
  406. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.ts.tpl +73 -0
  407. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.params.class-validator.ts.tpl +11 -0
  408. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.ts.tpl +86 -0
  409. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.line.class-validator.ts.tpl +22 -0
  410. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.params.class-validator.ts.tpl +7 -0
  411. package/templates/presets/identity/context/presentation/http/organisations.routes.ts.tpl +5 -0
  412. package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.class-validator.shared.ts.tpl +9 -0
  413. package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.zod.shared.ts.tpl +9 -0
  414. package/templates/presets/identity/context/published-language/account-deactivated.v1.integration-event.ts.tpl +33 -0
  415. package/templates/presets/identity/context/published-language/account-deactivated.v1.payload.class-validator.ts.tpl +7 -0
  416. package/templates/presets/identity/context/published-language/delegation-granted.v1.integration-event.ts.tpl +39 -0
  417. package/templates/presets/identity/context/published-language/delegation-granted.v1.payload.class-validator.ts.tpl +28 -0
  418. package/templates/presets/identity/context/published-language/delegation-revoked.v1.integration-event.ts.tpl +36 -0
  419. package/templates/presets/identity/context/published-language/delegation-revoked.v1.payload.class-validator.ts.tpl +16 -0
  420. package/templates/presets/identity/context/published-language/member-joined.v1.integration-event.ts.tpl +36 -0
  421. package/templates/presets/identity/context/published-language/member-joined.v1.payload.class-validator.ts.tpl +16 -0
  422. package/templates/presets/identity/context/published-language/member-removed.v1.integration-event.ts.tpl +36 -0
  423. package/templates/presets/identity/context/published-language/member-removed.v1.payload.class-validator.ts.tpl +18 -0
  424. package/templates/presets/identity/context/published-language/member-role-changed.v1.integration-event.ts.tpl +38 -0
  425. package/templates/presets/identity/context/published-language/member-role-changed.v1.payload.class-validator.ts.tpl +24 -0
  426. package/templates/presets/identity/context/published-language/organisation-opened.v1.integration-event.ts.tpl +35 -0
  427. package/templates/presets/identity/context/published-language/organisation-opened.v1.payload.class-validator.ts.tpl +13 -0
  428. package/templates/presets/identity/context/test/builders/account.builder.ts.tpl +59 -0
  429. package/templates/presets/identity/context/test/builders/delegation.builder.ts.tpl +67 -0
  430. package/templates/presets/identity/context/test/builders/invitation.builder.ts.tpl +60 -0
  431. package/templates/presets/identity/context/test/builders/member.builder.ts.tpl +59 -0
  432. package/templates/presets/identity/context/test/builders/organisation.builder.ts.tpl +44 -0
  433. package/templates/presets/identity/context/test/fakes/account.repository.fake.ts.tpl +10 -0
  434. package/templates/presets/identity/context/test/fakes/delegation.repository.fake.ts.tpl +26 -0
  435. package/templates/presets/identity/context/test/fakes/identity-provider-admin.fake.ts.tpl +41 -0
  436. package/templates/presets/identity/context/test/fakes/invitation-tokens.fake.ts.tpl +18 -0
  437. package/templates/presets/identity/context/test/fakes/invitation.repository.fake.ts.tpl +14 -0
  438. package/templates/presets/identity/context/test/fakes/member.repository.fake.ts.tpl +29 -0
  439. package/templates/presets/identity/context/test/fakes/organisation.repository.fake.ts.tpl +10 -0
  440. package/templates/presets/identity/context/test/fakes/search-members-reader.fake.ts.tpl +25 -0
  441. package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +48 -0
  442. package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +84 -0
  443. package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +76 -0
  444. package/templates/presets/identity/context/test/integration/keycloak-identity-provider-admin.adapter.spec.ts.tpl +123 -0
  445. package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +92 -0
  446. package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +46 -0
  447. package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +86 -0
  448. package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.ts.tpl +57 -0
  449. package/templates/presets/identity/context/test/unit/accept-invitation.handler.spec.ts.tpl +69 -0
  450. package/templates/presets/identity/context/test/unit/account-deactivated.integration-handler.spec.ts.tpl +24 -0
  451. package/templates/presets/identity/context/test/unit/account-deactivated.publisher.spec.ts.tpl +25 -0
  452. package/templates/presets/identity/context/test/unit/account.aggregate.spec.ts.tpl +72 -0
  453. package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.ts.tpl +57 -0
  454. package/templates/presets/identity/context/test/unit/change-member-role.handler.spec.ts.tpl +135 -0
  455. package/templates/presets/identity/context/test/unit/crypto-invitation-tokens.adapter.spec.ts.tpl +15 -0
  456. package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.ts.tpl +44 -0
  457. package/templates/presets/identity/context/test/unit/deactivate-account.handler.spec.ts.tpl +106 -0
  458. package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.ts.tpl +57 -0
  459. package/templates/presets/identity/context/test/unit/decline-invitation.handler.spec.ts.tpl +40 -0
  460. package/templates/presets/identity/context/test/unit/delegation-granted.publisher.spec.ts.tpl +36 -0
  461. package/templates/presets/identity/context/test/unit/delegation-period.vo.spec.ts.tpl +32 -0
  462. package/templates/presets/identity/context/test/unit/delegation-revoked.publisher.spec.ts.tpl +35 -0
  463. package/templates/presets/identity/context/test/unit/delegation.aggregate.spec.ts.tpl +111 -0
  464. package/templates/presets/identity/context/test/unit/display-name.vo.spec.ts.tpl +13 -0
  465. package/templates/presets/identity/context/test/unit/email-address.vo.spec.ts.tpl +24 -0
  466. package/templates/presets/identity/context/test/unit/environment-identity-provider-connection.adapter.spec.ts.tpl +41 -0
  467. package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.ts.tpl +57 -0
  468. package/templates/presets/identity/context/test/unit/grant-delegation.handler.spec.ts.tpl +66 -0
  469. package/templates/presets/identity/context/test/unit/identity-application.ts.tpl +79 -0
  470. package/templates/presets/identity/context/test/unit/invitation.aggregate.spec.ts.tpl +118 -0
  471. package/templates/presets/identity/context/test/unit/invite-member.controller.spec.ts.tpl +57 -0
  472. package/templates/presets/identity/context/test/unit/invite-member.handler.spec.ts.tpl +110 -0
  473. package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl +38 -0
  474. package/templates/presets/identity/context/test/unit/member-joined.publisher.spec.ts.tpl +36 -0
  475. package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl +45 -0
  476. package/templates/presets/identity/context/test/unit/member-removed.publisher.spec.ts.tpl +35 -0
  477. package/templates/presets/identity/context/test/unit/member-role-changed.publisher.spec.ts.tpl +36 -0
  478. package/templates/presets/identity/context/test/unit/member.aggregate.spec.ts.tpl +142 -0
  479. package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.ts.tpl +57 -0
  480. package/templates/presets/identity/context/test/unit/open-organisation.handler.spec.ts.tpl +52 -0
  481. package/templates/presets/identity/context/test/unit/organisation-name.vo.spec.ts.tpl +13 -0
  482. package/templates/presets/identity/context/test/unit/organisation-opened.integration-handler.spec.ts.tpl +24 -0
  483. package/templates/presets/identity/context/test/unit/organisation-opened.publisher.spec.ts.tpl +35 -0
  484. package/templates/presets/identity/context/test/unit/organisation-rights.vo.spec.ts.tpl +23 -0
  485. package/templates/presets/identity/context/test/unit/organisation-slug.vo.spec.ts.tpl +17 -0
  486. package/templates/presets/identity/context/test/unit/organisation.aggregate.spec.ts.tpl +33 -0
  487. package/templates/presets/identity/context/test/unit/provision-account.controller.spec.ts.tpl +73 -0
  488. package/templates/presets/identity/context/test/unit/provision-account.handler.spec.ts.tpl +65 -0
  489. package/templates/presets/identity/context/test/unit/remove-member.controller.spec.ts.tpl +44 -0
  490. package/templates/presets/identity/context/test/unit/remove-member.handler.spec.ts.tpl +125 -0
  491. package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.ts.tpl +44 -0
  492. package/templates/presets/identity/context/test/unit/revoke-delegation.handler.spec.ts.tpl +51 -0
  493. package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.ts.tpl +44 -0
  494. package/templates/presets/identity/context/test/unit/revoke-invitation.handler.spec.ts.tpl +44 -0
  495. package/templates/presets/identity/context/test/unit/role-rights.service.spec.ts.tpl +54 -0
  496. package/templates/presets/identity/context/test/unit/search-members.controller.spec.ts.tpl +43 -0
  497. package/templates/presets/identity/context/test/unit/search-members.handler.spec.ts.tpl +38 -0
  498. package/templates/presets/identity/decision.md.tpl +37 -0
  499. package/templates/presets/identity/design.md.tpl +71 -0
  500. package/templates/presets/signed-in-grants.ts.tpl +12 -0
package/README.md CHANGED
@@ -52,12 +52,14 @@ ddd-ts-kit init [--http express|fastify|hono|nest|none]
52
52
  [--style declared|explicit] [--assembly barrel|discovery]
53
53
  [--dependencies signature|listed] [--refusals factories|classes]
54
54
  [--routes controllers|functions] [--value-objects throwing|result]
55
- [--literals named|free] [--tenancy none|shared-table] [--queue database|redis|memory]
55
+ [--literals named|free] [--values classes|free] [--tenancy none|shared-table]
56
+ [--queue database|redis|memory]
56
57
  [--schemas shared|per-route]
57
58
  [--package-manager npm|pnpm]
58
59
  [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
59
60
  [--import-extension none|js] [--sdk]
60
61
  [--context <name>:<core|supporting|generic>]...
62
+ [--preset identity]...
61
63
  [--dry-run] [--force]
62
64
  ```
63
65
 
@@ -262,6 +264,32 @@ and `@typescript/native` (`npm:typescript@~7.0.2`), which `build` and `typecheck
262
264
  `init` and `generate context` start with the language: the first entry of `next` is the glossary
263
265
  of the context to fill in.
264
266
 
267
+ ### Presets
268
+
269
+ `--preset identity` (on `init`, or on `generate context`; once per project) writes a whole bounded
270
+ context instead of an empty one: who the people of the application are, the organisations they
271
+ belong to and in which role. Accounts are provisioned from the identity provider at the first
272
+ sign-in (no password is kept), organisations (the tenants under `--tenancy shared-table`),
273
+ members with roles of a declared vocabulary, invitations by token with an expiry, delegations of
274
+ rights for a period; permissions, policies, the published language (member joined, role changed,
275
+ account deactivated...), a search, controllers, specs with builders and fakes, the adapters of
276
+ the ORM, and the port to the administration API of the identity provider, kept in line at least
277
+ once by the consumers of the published facts, with a Keycloak adapter given as a recipe (proven
278
+ against a server that answers as Keycloak does, not against Keycloak in the pipeline). Nobody
279
+ changes their own role or acts above it, whatever a delegation lends; a deactivated account
280
+ leaves its organisations; an address the provider did not verify provisions no account. On `init` without a `--context` of its name, the context `identity` is declared
281
+ `generic`. Every signed-in person holds the permissions of the context whatever `--authz` says:
282
+ the grant `'identity:*'` of `platform/auth/signed-in-grants.ts`, answered by
283
+ `SignedInGrantsAuthorizer` before the model in `createAuthorizer`. With tenants, the tables of
284
+ the context belong to none, under a decision record the preset writes, and with `--authn
285
+ keycloak` the authenticator reads the `organization` claim as the tenants of the person
286
+ (another authenticator gets a next step saying what to map). The preset is written for
287
+ `declared` with `signature` dependencies, `factories`, `throwing` value objects, `controllers`,
288
+ Knex or Drizzle on PostgreSQL, Zod or class-validator, Express or Fastify, and a token verifier
289
+ (`jwt` or `keycloak`); another stack is refused with what to change, and so is a second context
290
+ written from the same preset. Why, and which other contexts deserve one:
291
+ [Bootstrap with well-designed contexts](../../docs/guides/bootstrap-with-well-designed-contexts.md).
292
+
265
293
  ## generate (alias g)
266
294
 
267
295
  ```
@@ -271,7 +299,7 @@ ddd-ts-kit generate --help --json
271
299
 
272
300
  | Kind | Arguments | Writes |
273
301
  |---|---|---|
274
- | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]...` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `application/authorization/<name>.permissions.ts` is born with the first permission, or at once when `platform/auth/permissions.ts` lists the permission sets (rebac, custom) |
302
+ | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `application/authorization/<name>.permissions.ts` is born with the first permission, or at once when `platform/auth/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
275
303
  | `aggregate` | `<context> <Name>` | aggregate, builder, spec in given / when / then |
276
304
  | `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, a class extending `Builder` |
277
305
  | `entity` | `<context> <Name>` | entity, spec |
@@ -816,6 +844,7 @@ saying what to do instead. Exit code 1 when there is at least one error.
816
844
  | `schema/presentation-only` | under `"stack.schemas": "shared"`: in the shared kernel outside `presentation/`, an import of a validation library; in `domain/`, `application/`, `infrastructure/`, `published-language/` and the shared kernel outside `presentation/`, an import of a file of `presentation/` of the shared kernel |
817
845
  | `schema/no-duplicate-shape` | under `"stack.schemas": "shared"`, in the presentation layer of one context, or in it and `presentation/` of the shared kernel: a DTO class or an object schema (`z.object`, `v.object`, `Type.Object`) declaring the shape of another one, with the place of the original (the shared kernel, then `presentation/http/shared/`); two contexts are not compared, and request parameters and shapes still carrying a `TODO(domain)` of the generator are not judged |
818
846
  | `errors/known-code` | under `"stack.refusals": "factories"`, in a `*.route.ts`: a code of the `errors` list that no refusal of the context of the route sets, that no class outside the contexts sets, and that is not a code of the kit |
847
+ | `domain/value-object-class` | under `"stack.values": "classes"`: in `domain/value-objects/` of a context or a `*.vo.ts` of the shared kernel outside `presentation/`, no exported class or a second one, a class that extends neither `ValueObject` nor another value object of the project, a public constructor, a concrete class without a static method, an exported function, arrow constant or object literal (inline, listed or by default); in `domain/` and in the shared kernel outside `presentation/`, an exported function that answers a record of data: data entries, no spread, nothing a call of the model built |
819
848
 
820
849
  More ids belong to `@ddd-ts-kit/eslint-plugin`, which reads the syntax tree where this
821
850
  checker reads text: `domain/aggregate-encapsulation`, `domain/value-object-immutability`,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAgF7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA+E7C,CAAC"}
1
+ {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAiF7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EAgF7C,CAAC"}
@@ -25,6 +25,7 @@ import { declarationsConstructorInjection } from '../rules/declarations-construc
25
25
  import { declarationsRoleDeclared } from '../rules/declarations-role-declared.js';
26
26
  import { domainEventsDispatchedOnSave } from '../rules/domain-events-dispatched-on-save.js';
27
27
  import { domainEventsTransactionalBeforeCommit } from '../rules/domain-events-transactional-before-commit.js';
28
+ import { domainValueObjectClass } from '../rules/domain-value-object-class.js';
28
29
  import { errorsCodeUnique } from '../rules/errors-code-unique.js';
29
30
  import { eventSourcingPastTense } from '../rules/event-sourcing-past-tense.js';
30
31
  import { eventSourcingProjectionNeverAppends } from '../rules/event-sourcing-projection-never-appends.js';
@@ -116,6 +117,7 @@ export const ARCHITECTURE_RULES = [
116
117
  cleanBraces,
117
118
  cleanOneExportPerFile,
118
119
  cleanFileSize,
120
+ domainValueObjectClass,
119
121
  eventsOutboxRequired,
120
122
  eventsConsumerIdempotent,
121
123
  domainEventsDispatchedOnSave,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CA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;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
1
+ {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OA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} from '../model/rule-doc.js';
2
+ export declare const DOMAIN_DOCS: Readonly<Record<string, RuleDoc>>;
3
+ //# sourceMappingURL=domain-docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/domain-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzD,CAAC"}
@@ -0,0 +1,30 @@
1
+ export const DOMAIN_DOCS = {
2
+ 'domain/value-object-class': {
3
+ why: 'A value of the model is a class extending ValueObject of the kernel, never a function that builds a plain object. The class compares by value with no identity (equals), checks its invariants once, in the static factory that is the only way in through a private constructor, keeps its behaviour next to its data, refuses an invalid input with the factory of the error of its concept, freezes its props, and is recognised with instanceof by a boundary mapper. A function answering { amount, currency } gives none of that: every caller re-validates, compares field by field, and the operations of the value scatter. So a file of domain/value-objects/ (or a *.vo.ts of the shared kernel) exports one class extending ValueObject, directly or through another value object of the project, with a private or protected constructor and static factories, and no function, arrow constant or object literal; the types of its props may be exported. In domain/ and in the shared kernel outside presentation/, an exported function that answers a record of data (data entries, no spread, nothing a call or new of the model built) is reported. A domain service, a state machine, a specification answering a boolean or an object of functions, a record of value objects the function builds, a record derived by a spread and a function declaring a return type of a package answer something else and are not concerned; a decision answered as a plain record is a value, written as a class or thrown as a refusal. The rule holds under "stack.values": "classes", which init writes; a config that does not say keeps the free form of 0.15.',
4
+ bad: `// domain/value-objects/money.vo.ts
5
+ export type Money = { readonly amount: number; readonly currency: string };
6
+
7
+ export const money = (amount: number, currency: string): Money => ({ amount, currency });`,
8
+ good: `// domain/value-objects/money.vo.ts (npx ddd-ts-kit generate value-object billing Money)
9
+ export type MoneyProps = { readonly amount: number; readonly currency: string };
10
+
11
+ export class Money extends ValueObject<MoneyProps> {
12
+ private constructor(props: MoneyProps) {
13
+ super(props);
14
+ }
15
+
16
+ static of(amount: number, currency: string): Money {
17
+ if (!Number.isInteger(amount)) {
18
+ throw InvoiceError.invalidAmount(amount);
19
+ }
20
+
21
+ return new Money({ amount, currency });
22
+ }
23
+
24
+ add(other: Money): Money {
25
+ return Money.of(this.props.amount + other.props.amount, this.props.currency);
26
+ }
27
+ }`,
28
+ },
29
+ };
30
+ //# sourceMappingURL=domain-docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-docs.js","sourceRoot":"","sources":["../../../src/check/explain/domain-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,2BAA2B,EAAE;QAC3B,GAAG,EAAE,8kDAA8kD;QACnlD,GAAG,EAAE;;;0FAGiF;QACtF,IAAI,EAAE;;;;;;;;;;;;;;;;;;;EAmBR;KACC;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rule-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAqBpD,oGAAoG;AACpG,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBvD,CAAC"}
1
+ {"version":3,"file":"rule-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAsBpD,oGAAoG;AACpG,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBvD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { AUTHZ_DOCS } from './authz-docs.js';
2
2
  import { CLEAN_DOCS } from './clean-docs.js';
3
3
  import { CONTEXT_DOCS } from './context-docs.js';
4
+ import { DOMAIN_DOCS } from './domain-docs.js';
4
5
  import { ERRORS_DOCS } from './errors-docs.js';
5
6
  import { EVENT_SOURCING_DOCS } from './event-sourcing-docs.js';
6
7
  import { EVENTS_DOCS } from './events-docs.js';
@@ -22,6 +23,7 @@ export const RULE_DOCS = {
22
23
  ...AUTHZ_DOCS,
23
24
  ...CLEAN_DOCS,
24
25
  ...CONTEXT_DOCS,
26
+ ...DOMAIN_DOCS,
25
27
  ...ERRORS_DOCS,
26
28
  ...EVENT_SOURCING_DOCS,
27
29
  ...EVENTS_DOCS,
@@ -1 +1 @@
1
- {"version":3,"file":"rule-docs.js","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC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M,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,GAAG,UAAU;IACb,GAAG,UAAU;IACb,GAAG,YAAY;IACf,GAAG,WAAW;IACd,GAAG,WAAW;IACd,GAAG,mBAAmB;IACtB,GAAG,WAAW;IACd,GAAG,YAAY;IACf,GAAG,aAAa;IAChB,GAAG,UAAU;IACb,GAAG,WAAW;IACd,GAAG,cAAc;IACjB,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,GAAG,eAAe;IAClB,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,SAAS;IACZ,GAAG,WAAW;CACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tenancy-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tenancy-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAa1D,CAAC"}
1
+ {"version":3,"file":"tenancy-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tenancy-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAe1D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export const TENANCY_DOCS = {
2
2
  'tenancy/scoped-statement': {
3
- why: 'On shared tables, one statement without its tenant condition reads or overwrites the data of every tenant: the most common and the most damaging leak of a multi-tenant application. The kit puts the condition in one place, the helpers of the ORM package, which read the tenant from the execution scope, refuse work that names none, widen reads only under an audited elevation and never widen writes. A table reached straight from the executor bypasses all of it. Judged in a project whose "stack.tenancy" is not "none": the infrastructure of the contexts, tests aside. Checked by text, statement by statement: on Knex the executor used other than as the argument of a helper, and raw SQL; on Drizzle a read, update or delete whose where carries no tenant condition (inline or in the local it is given), an insert whose row names no tenant, a relational query or a raw execute; on both, a read model store built without its tenant option. A where built by another function is not followed: inline it, or record a deviation.',
3
+ why: 'On shared tables, one statement without its tenant condition reads or overwrites the data of every tenant: the most common and the most damaging leak of a multi-tenant application. The kit puts the condition in one place, the helpers of the ORM package, which read the tenant from the execution scope, refuse work that names none, widen reads only under an audited elevation and never widen writes. A table reached straight from the executor bypasses all of it. Judged in a project whose "stack.tenancy" is not "none": the infrastructure of the contexts, tests aside. Checked by text, statement by statement: on Knex the executor used other than as the argument of a helper, and raw SQL that may reach rows by itself: a word that reads or writes rows (`select`, `from`, `join`, `insert`, `update`, `delete`, `values`, `call`...) or starts a statement (`table`, `with`, `do`...), a call to a function that is not a known expression (an aggregate, a cast, arithmetic, text), a text that is not a literal or a template that interpolates; a statement of the schema (`create`, `alter`, `drop`, `comment`) with no word of rows, and an aggregate in a select, reach no row by themselves; on Drizzle a read, update or delete whose where carries no tenant condition (inline or in the local it is given), an insert whose row names no tenant, a relational query or a raw execute; on both, a read model store built without its tenant option. A where built by another function is not followed: inline it, or record a deviation.',
4
4
  bad: `// infrastructure/persistence/knex-invoice.repository.ts
5
5
  const row = await this.database.executor()<InvoiceRow, InvoiceRow[]>('invoices').where({ id }).first();
6
6
  const all = await this.database.executor().from('invoices').where({ status }); // the executor chained
@@ -9,6 +9,8 @@ await this.database.executor().select().from(invoices).where(eq(invoices.id, id)
9
9
  await this.database.executor().query.invoices.findMany(); // a relational query cannot carry the condition`,
10
10
  good: `const row = await tenantTable<InvoiceRow>(this.database, this.scope, INVOICES).where({ id }).first();
11
11
  await ownTenantTable<InvoiceRow>(this.database, this.scope, INVOICES).where({ id, version }).update(changes);
12
+ const grouped = tenantTable(this.database, this.scope, INVOICES).select('status', this.database.executor().raw('sum(amount) as due')).groupBy('status');
13
+ const pages = await derivedTable(this.database, grouped, 'dues').orderBy('due', 'desc').limit(20);
12
14
  await this.database.executor().select().from(invoices).where(and(eq(invoices.id, id), tenantCondition(invoices.tenantId, this.scope)));`,
13
15
  },
14
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tenancy-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tenancy-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAsC;IAC7D,0BAA0B,EAAE;QAC1B,GAAG,EAAE,+/BAA+/B;QACpgC,GAAG,EAAE;;;;;2GAKkG;QACvG,IAAI,EAAE;;wIAE8H;KACrI;CACF,CAAC"}
1
+ {"version":3,"file":"tenancy-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tenancy-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAsC;IAC7D,0BAA0B,EAAE;QAC1B,GAAG,EAAE,2+CAA2+C;QACh/C,GAAG,EAAE;;;;;2GAKkG;QACvG,IAAI,EAAE;;;;wIAI8H;KACrI;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAsCtC,CAAC"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAwCtC,CAAC"}
@@ -35,6 +35,8 @@ import { TENANCY_FIXTURES } from './tenancy-fixtures.js';
35
35
  import { TEST_FIXTURES } from './test-fixtures.js';
36
36
  import { TRACING_FIXTURES } from './tracing-fixtures.js';
37
37
  import { TREE_FIXTURES } from './tree-fixtures.js';
38
+ import { MODEL_FUNCTION_FIXTURES } from './model-function-fixtures.js';
39
+ import { VALUE_OBJECT_FILE_FIXTURES } from './value-object-file-fixtures.js';
38
40
  /**
39
41
  * Mini-projects proving each rule both ways. They ship with the CLI so that
40
42
  * `ddd-ts-kit check --self` can verify an installed build, and the test suite
@@ -78,5 +80,7 @@ export const FIXTURES = [
78
80
  ...TEST_FIXTURES,
79
81
  ...TRACING_FIXTURES,
80
82
  ...TREE_FIXTURES,
83
+ ...VALUE_OBJECT_FILE_FIXTURES,
84
+ ...MODEL_FUNCTION_FIXTURES,
81
85
  ];
82
86
  //# sourceMappingURL=fixtures.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,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AAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,GAAG,uBAAuB;IAC1B,GAAG,uBAAuB;IAC1B,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,oBAAoB;IACvB,GAAG,eAAe;IAClB,GAAG,8BAA8B;IACjC,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,qBAAqB;IACxB,GAAG,sBAAsB;IACzB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,uBAAuB;IAC1B,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,mBAAmB;IACtB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,aAAa;CACjB,CAAC"}
1
+ {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"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cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,mBAAmB;IACtB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,0BAA0B;IAC7B,GAAG,uBAAuB;CAC3B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Fixture } from './fixture.js';
2
+ /** What `domain/value-object-class` says of the functions of `domain/` and of the shared kernel. */
3
+ export declare const MODEL_FUNCTION_FIXTURES: readonly Fixture[];
4
+ //# sourceMappingURL=model-function-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-function-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/model-function-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqB5C,oGAAoG;AACpG,eAAO,MAAM,uBAAuB,EAAE,SAAS,OAAO,EAsGrD,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { PATHS } from './paths.js';
2
+ import { project } from './project.js';
3
+ import { SAMPLES } from './samples.js';
4
+ import { VALUE_FILES, VALUES } from './value-object-files.js';
5
+ const { RULE, SERVICE, SHARED_PLAIN, PLAIN } = VALUES;
6
+ const { classes, service } = VALUE_FILES;
7
+ const { BILLING } = PATHS;
8
+ const passing = (name, files) => ({ ruleId: RULE, name, expect: 'pass', files });
9
+ const failing = (name, content) => ({
10
+ ruleId: RULE,
11
+ name,
12
+ expect: { file: SERVICE },
13
+ files: classes(service(content)),
14
+ });
15
+ const MACHINE = `${BILLING}/domain/state-machines/invoice.state-machine.ts`;
16
+ /** What `domain/value-object-class` says of the functions of `domain/` and of the shared kernel. */
17
+ export const MODEL_FUNCTION_FIXTURES = [
18
+ passing('domain functions that answer a value object, a boolean, or a plain object only inside a callback', classes(service('export function invoiceTotal(lines: readonly Money[]): Money {\n const rows = lines.map((line) => {\n return { line, cents: 0 };\n });\n\n return rows.reduce((sum, { line }) => sum.add(line), Money.of(0));\n}\n'))),
19
+ passing('a specification answering an object of functions, literal or built from local closures', classes(service('export const invoiceTotal = (floor: Money) => {\n const isSatisfiedBy = (total: Money): boolean => total.equals(floor);\n\n return {\n isSatisfiedBy,\n describe(): string {\n return String(floor);\n },\n };\n};\n'))),
20
+ passing('a function that takes value objects and answers a record of value objects it builds', classes(service('export const invoiceTotal = (total: Money) => ({ first: Money.of(1), rest: total.add(total) });\n'))),
21
+ passing('a function that derives a record from another with a spread, as a reducer does', classes(service('type InvoiceState = { readonly status: string };\n\nexport const invoiceTotal = (state: InvoiceState, status: string): InvoiceState => ({ ...state, status });\n'))),
22
+ passing('a state machine declaration and a domain service class whose method answers an object', classes({
23
+ [MACHINE]: "import { defineStateMachine } from '@ddd-ts-kit/kernel';\n\nexport const invoiceLifecycle = defineStateMachine({\n states: ['draft', 'issued'],\n initial: ['draft'],\n transitions: { issue: { from: ['draft'], to: 'issued' } },\n refused: () => ({ code: 'REFUSED' }),\n});\n",
24
+ [`${BILLING}/test/unit/invoice.state-machine.spec.ts`]: SAMPLES.SPEC,
25
+ [`${BILLING}/domain/services/invoice-issue.service.ts`]: 'export class InvoiceIssueService {\n issue(): { cents: number } {\n return { cents: 0 };\n }\n}\n',
26
+ [`${BILLING}/test/unit/invoice-issue.service.spec.ts`]: SAMPLES.SPEC,
27
+ })),
28
+ passing('a spec and a presentation file of the shared kernel, outside the model, may build a plain object', classes({
29
+ [`${BILLING}/test/unit/money.spec.ts`]: `import { it } from 'vitest';\n\n${PLAIN}\nit('builds', () => money(1, 'EUR'));\n`,
30
+ 'src/shared-kernel/presentation/money.ts': PLAIN,
31
+ })),
32
+ passing('a helper of the shared kernel that answers a type of a package', classes({
33
+ 'src/shared-kernel/storable-stamp.ts': "import type { EventStamp } from '@ddd-ts-kit/kernel';\n\nexport function storableStamp(stamp: EventStamp): EventStamp {\n return { eventId: stamp.eventId, occurredAt: new Date(0), version: 1 };\n}\n",
34
+ })),
35
+ passing('a domain function written as a value, in a project whose config does not say "values"', project(service(PLAIN))),
36
+ failing('a domain function that builds a plain object', 'export function invoiceTotal(lines: readonly Money[], currency: string) {\n const cents = Math.round(lines.length);\n\n return { cents, currency };\n}\n'),
37
+ failing('a domain arrow function that answers a plain object', 'export const invoiceTotal = (line: Money, currency: string) => ({ line, currency });\n'),
38
+ failing('a domain constant bound to a function expression that builds a plain object', 'export const invoiceTotal = function (cents: number) {\n return { cents, currency: 0 };\n};\n'),
39
+ failing('a generic domain arrow function that answers a plain object', 'export const invoiceTotal = <T,>(cents: T) => ({ cents, currency: 0 });\n'),
40
+ failing('a domain function exported by an export list', 'export { invoiceTotal };\n\nfunction invoiceTotal(cents: number, currency: string) {\n return { cents, currency };\n}\n'),
41
+ failing('a domain arrow function exported by an export list', 'const invoiceTotal = (cents: number, currency: string) => ({ cents, currency });\n\nexport { invoiceTotal };\n'),
42
+ failing('a domain arrow function exported by default', 'export default (cents: number) => ({ cents, currency: 0 });\n'),
43
+ failing('a decision answered as a plain record', "export const invoiceTotal = (reason: string) => {\n return { kind: 'refused' as const, reason };\n};\n"),
44
+ failing('a value written as a record of data and closures', 'export const invoiceTotal = (cents: number) => ({ cents, doubled: (): number => cents * 2 });\n'),
45
+ {
46
+ ruleId: RULE,
47
+ name: 'a value of the shared kernel written as a function in a file not named *.vo.ts',
48
+ expect: { file: SHARED_PLAIN },
49
+ files: classes({ [SHARED_PLAIN]: PLAIN }),
50
+ },
51
+ ];
52
+ //# sourceMappingURL=model-function-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-function-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/model-function-f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{"version":3,"file":"tenancy-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/tenancy-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAsF5C,eAAO,MAAM,gBAAgB,EAAE,SAAS,OAAO,EAwF9C,CAAC"}
1
+ {"version":3,"file":"tenancy-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/tenancy-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAkG5C,eAAO,MAAM,gBAAgB,EAAE,SAAS,OAAO,EAqH9C,CAAC"}
@@ -53,6 +53,17 @@ const DRIZZLE_UNSCOPED = `export class DrizzleInvoiceRepository {
53
53
  }
54
54
  }
55
55
  `;
56
+ /** Aggregates over the rows `tenantTable` confines: raw expressions that reach no table themselves. */
57
+ const RAW_EXPRESSIONS = `export class KnexInvoiceRepository {
58
+ totals() {
59
+ return tenantTable(this.database, this.scope, INVOICES).select(
60
+ this.database.executor().raw('(count(*) filter (where paid))::integer as paid'),
61
+ this.database.executor().raw('coalesce(sum(round(amount)) filter (where state = any(?)), 0)::numeric(12, 2) as due', [states]),
62
+ this.database.executor().raw("customer_id || ' from ' || day as label"),
63
+ );
64
+ }
65
+ }
66
+ `;
56
67
  const tenancy = (orm, value = 'shared-table') => ({
57
68
  [CONFIG_FILE]: config({ stack: { orm, tenancy: value } }),
58
69
  });
@@ -99,6 +110,23 @@ export const TENANCY_FIXTURES = [
99
110
  bypass('knex', 'a select chained on the executor', "return this.database.executor().select('id').from('invoices');"),
100
111
  bypass('knex', 'a table reached by table()', "return this.database.executor().table('invoices');"),
101
112
  bypass('knex', 'raw SQL', "return this.database.executor().raw('select * from invoices');"),
113
+ bypass('knex', 'raw SQL in a template', 'return this.database.executor().raw(`select * from ${INVOICES}`);'),
114
+ bypass('knex', 'raw SQL whose text is not a literal', 'return this.database.executor().raw(statement);'),
115
+ bypass('knex', 'raw SQL completed by an interpolation', 'return this.database.executor().raw(`${statement} where id = ?`, [id]);'),
116
+ bypass('knex', 'raw SQL that names a table alone', "return this.database.executor().raw('table invoices');"),
117
+ bypass('knex', 'raw SQL that starts with a common table', "return this.database.executor().raw('with due as (table invoices) table due');"),
118
+ bypass('knex', 'raw SQL of values', "return this.database.executor().raw('values (1), (2)');"),
119
+ bypass('knex', 'raw SQL that calls a procedure', "return this.database.executor().raw('call purge_invoices()');"),
120
+ bypass('knex', 'raw SQL that calls a function', "return this.database.executor().raw('purge_all()');"),
121
+ {
122
+ ruleId: RULE,
123
+ name: 'knex: a raw expression in the select of a confined statement, and a constraint of the schema',
124
+ expect: 'pass',
125
+ files: project({
126
+ [KNEX_ADAPTER]: RAW_EXPRESSIONS,
127
+ [`${PATHS.BILLING}/infrastructure/persistence/create-billing-tables.schema.ts`]: "export const holdOnce = (knex: Knex) => knex.raw('alter table ??.?? add constraint held_once exclude using gist (desk with =)', [S, T]);\n",
128
+ }, tenancy('knex')),
129
+ },
102
130
  bypass('knex', 'the executor held in a variable', "const db = this.database.executor();\n\n return db('invoices');"),
103
131
  {
104
132
  ruleId: RULE,
@@ -1 +1 @@
1
- {"version":3,"file":"tenancy-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/tenancy-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,YAAY,GAAG,GAAG,KAAK,CAAC,OAAO,wDAAwD,CAAC;AAC9F,MAAM,eAAe,GAAG,GAAG,KAAK,CAAC,OAAO,2DAA2D,CAAC;AAEpG,MAAM,WAAW,GAAG;;;;;;;;;;;CAWnB,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MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,gEAAgE;QACtE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAC1E;IACD;QACE,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,qFAAqF;QAC3F,MAAM,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;QACjC,KAAK,EAAE,OAAO,CACZ;YACE,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC,OAAO,CACvC,wBAAwB,EACxB,wGAAwG,CACzG;SACF,EACD,OAAO,CAAC,SAAS,CAAC,CACnB;KACF;IACD,MAAM,CACJ,SAAS,EACT,gCAAgC,EAChC,iEAAiE,CAClE;IACD,MAAM,CAAC,SAAS,EAAE,oBAAoB,EAAE,4DAA4D,CAAC;IACrG,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,uEAAuE,CAAC;IACrG,SAAS,CACP,0BAA0B,EAC1B,4JAA4J,EAC5J,EAAE,IAAI,EAAE,UAAU,EAAE,CACrB;IACD,SAAS,CACP,uCAAuC,EACvC,4LAA4L,EAC5L,EAAE,IAAI,EAAE,UAAU,EAAE,CACrB;IACD,SAAS,CACP,uBAAuB,EACvB,kMAAkM,EAClM,MAAM,CACP;IACD;QACE,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,0DAA0D;QAChE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;KACzG;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Fixture } from './fixture.js';
2
+ /** What `domain/value-object-class` says of the files of `domain/value-objects/` and of the `*.vo.ts` of the shared kernel. */
3
+ export declare const VALUE_OBJECT_FILE_FIXTURES: readonly Fixture[];
4
+ //# sourceMappingURL=value-object-file-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object-file-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/value-object-file-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAsB5C,+HAA+H;AAC/H,eAAO,MAAM,0BAA0B,EAAE,SAAS,OAAO,EA2FxD,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { PATHS } from './paths.js';
2
+ import { project } from './project.js';
3
+ import { SAMPLES } from './samples.js';
4
+ import { VALUE_FILES, VALUES } from './value-object-files.js';
5
+ const { RULE, MONEY, INVOICE_MONEY, SHARED, PROPS, PRIVATE, OF, PLAIN, KERNEL } = VALUES;
6
+ const { classes, money, VALUE_OBJECT, valueObject } = VALUE_FILES;
7
+ const passing = (name, files) => ({ ruleId: RULE, name, expect: 'pass', files });
8
+ /** A value object file holding `content`: the rule reports it in that file. */
9
+ const failing = (name, content, also) => ({
10
+ ruleId: RULE,
11
+ name,
12
+ expect: { file: MONEY },
13
+ ...(also === undefined ? {} : { also }),
14
+ files: classes(valueObject(content)),
15
+ });
16
+ const PROTECTED = ' protected constructor(props: MoneyProps) {\n super(props);\n }\n\n';
17
+ /** What `domain/value-object-class` says of the files of `domain/value-objects/` and of the `*.vo.ts` of the shared kernel. */
18
+ export const VALUE_OBJECT_FILE_FIXTURES = [
19
+ passing('a value object class with a private constructor, a static factory and the type of its props', classes(valueObject(VALUE_OBJECT))),
20
+ passing('a value object extending another one of the project, and one of the shared kernel', classes({
21
+ ...valueObject(money(PROTECTED, '').replace('export class Money', 'export abstract class Money')),
22
+ [INVOICE_MONEY]: `${VALUES.IMPORT_MONEY}export class InvoiceMoney extends Money {\n static due(cents: number): InvoiceMoney {\n return new InvoiceMoney({ cents });\n }\n}\n`,
23
+ [`${PATHS.BILLING}/test/unit/invoice-money.vo.spec.ts`]: SAMPLES.SPEC,
24
+ [SHARED]: VALUE_OBJECT,
25
+ })),
26
+ passing('a concrete value object with a protected constructor, and one that declares none', classes({
27
+ ...valueObject(money(PROTECTED, VALUES.OF)),
28
+ [INVOICE_MONEY]: `${KERNEL}\nexport class InvoiceMoney extends ValueObject<{ readonly cents: number }> {\n static zero(): InvoiceMoney {\n return new InvoiceMoney({ cents: 0 });\n }\n}\n`,
29
+ [`${PATHS.BILLING}/test/unit/invoice-money.vo.spec.ts`]: SAMPLES.SPEC,
30
+ })),
31
+ passing('a value object class exported after its declaration, by `export default`', classes(valueObject(`${VALUE_OBJECT.replace('export class Money', 'class Money')}\nexport default Money;\n`))),
32
+ passing('a value object file written as a function, in a project whose config does not say "values"', project(valueObject(`${PROPS}\n${PLAIN}`))),
33
+ failing('a value object file holding an arrow function that builds a plain object', `${PROPS}\n${PLAIN}`),
34
+ failing('a value object class that does not extend ValueObject', money(' private constructor(private readonly props: MoneyProps) {}\n\n', OF, '')),
35
+ failing('a value object class with a public constructor', money(' constructor(props: MoneyProps) {\n super(props);\n }\n\n', OF)),
36
+ failing('a value object class without a static factory', money(PRIVATE, '')),
37
+ failing('a value object file that also exports a function', `${VALUE_OBJECT}\nexport function zero(): Money {\n return Money.of(0);\n}\n`, ['clean/one-export-per-file']),
38
+ failing('a value object file that exports a function by an export list', `${VALUE_OBJECT}\nexport { zero };\n\nfunction zero(): Money {\n return Money.of(0);\n}\n`, ['clean/one-export-per-file']),
39
+ failing('a value object file that exports an arrow constant by an export list', `${VALUE_OBJECT}\nconst zero = (): Money => Money.of(0);\n\nexport { zero };\n`, ['clean/one-export-per-file']),
40
+ failing('a value object file that exports a constant bound to a function expression', `${VALUE_OBJECT}\nexport const zero = function (): Money {\n return Money.of(0);\n};\n`, ['clean/one-export-per-file']),
41
+ failing('a value object file that also exports an object literal', `${VALUE_OBJECT}\nexport const ZERO = { cents: 0 };\n`),
42
+ failing('a value object file that exports a parenthesized object literal', `${VALUE_OBJECT}\nexport const ZERO = ({ cents: 0 });\n`),
43
+ failing('a value object file that exports an object literal `as const`', `${VALUE_OBJECT}\nexport const ZERO = { cents: 0 } as const;\n`),
44
+ failing('a value object file that exports an object literal that `satisfies` its props', `${VALUE_OBJECT}\nexport const ZERO = { cents: 0 } satisfies MoneyProps;\n`),
45
+ failing('a value object file whose default export is an object literal', `${VALUE_OBJECT}\nexport default { cents: 0 };\n`),
46
+ failing('a value object file that exports a second class', `${VALUE_OBJECT}\nexport class InvoiceMoney extends ValueObject<MoneyProps> {\n static of(): InvoiceMoney {\n return new InvoiceMoney({ cents: 0 });\n }\n}\n`, ['clean/one-export-per-file', 'naming/one-concept-per-file']),
47
+ {
48
+ ruleId: RULE,
49
+ name: 'a value object of the shared kernel written as a function',
50
+ expect: { file: SHARED },
51
+ files: classes({ [SHARED]: PLAIN }),
52
+ },
53
+ ];
54
+ //# sourceMappingURL=value-object-file-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object-file-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/value-object-file-fixtures.ts"],"names":[],"mappings":"AACA,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,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;AACzF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;AAElE,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,KAAuB,EAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EA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2B,EAAE,6BAA6B,CAAC,CAC7D;IACD;QACE,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,2DAA2D;QACjE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QACxB,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KACpC;CACF,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { FixtureFiles } from './fixture-files.js';
2
+ /** The files and sources the fixtures of `domain/value-object-class` share. */
3
+ export declare const VALUES: {
4
+ readonly RULE: 'domain/value-object-class';
5
+ readonly MONEY: "src/contexts/billing/domain/value-objects/money.vo.ts";
6
+ readonly INVOICE_MONEY: "src/contexts/billing/domain/value-objects/invoice-money.vo.ts";
7
+ readonly SERVICE: "src/contexts/billing/domain/services/invoice-total.service.ts";
8
+ readonly SHARED: 'src/shared-kernel/money.vo.ts';
9
+ readonly SHARED_PLAIN: 'src/shared-kernel/money.ts';
10
+ readonly KERNEL: "import { ValueObject } from '@ddd-ts-kit/kernel';\n";
11
+ readonly PROPS: 'export type MoneyProps = {\n readonly cents: number;\n};\n';
12
+ readonly PRIVATE: ' private constructor(props: MoneyProps) {\n super(props);\n }\n\n';
13
+ readonly OF: ' static of(cents: number): Money {\n return new Money({ cents });\n }\n\n';
14
+ readonly PLAIN: 'export const money = (cents: number, currency: string) => ({ cents, currency });\n';
15
+ readonly IMPORT_MONEY: "import { Money } from '@/contexts/billing/domain/value-objects/money.vo.js';\n\n";
16
+ };
17
+ /** The builders of the fixtures of `domain/value-object-class`. */
18
+ export declare const VALUE_FILES: {
19
+ money: typeof money;
20
+ classes: typeof classes;
21
+ service: typeof service;
22
+ valueObject: typeof valueObject;
23
+ VALUE_OBJECT: string;
24
+ };
25
+ /** `Money`, a class of `money.vo.ts` with the constructor, the factories and the heritage given. */
26
+ declare function money(constructor: string, factory: string, base?: string): string;
27
+ /** A project that writes its values as classes, as `init` writes it, holding `files`. */
28
+ declare function classes(files: FixtureFiles): FixtureFiles;
29
+ /** The value object and a domain service holding `content`, each with its spec. */
30
+ declare function service(content: string): FixtureFiles;
31
+ /** `money.vo.ts` holding `content`, with its spec. */
32
+ declare function valueObject(content: string): FixtureFiles;
33
+ export {};
34
+ //# sourceMappingURL=value-object-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object-files.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/value-object-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvD,+EAA+E;AAC/E,eAAO,MAAM,MAAM;aACjB,IAAI,EAAE,2BAA2B;aACjC,KAAK;aACL,aAAa;aACb,OAAO;aACP,MAAM,EAAE,+BAA+B;aACvC,YAAY,EAAE,4BAA4B;aAC1C,MAAM,EAAE,qDAAqD;aAC7D,KAAK,EAAE,6DAA6D;aACpE,OAAO,EAAE,wEAAwE;aACjF,EAAE,EAAE,gFAAgF;aACpF,KAAK,EAAE,oFAAoF;aAC3F,YAAY,EAAE,kFAAkF;CACxF,CAAC;AAKX,mEAAmE;AACnE,eAAO,MAAM,WAAW;;;;;;CAAyD,CAAC;AAElF,oGAAoG;AACpG,iBAAS,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,SAAqC,GAAG,MAAM,CAEtG;AAED,yFAAyF;AACzF,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAElD;AAED,mFAAmF;AACnF,iBAAS,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAM9C;AAED,sDAAsD;AACtD,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAElD"}
@@ -0,0 +1,46 @@
1
+ import { CONFIG_FILE } from '../../config/index.js';
2
+ import { config } from './config.js';
3
+ import { PATHS } from './paths.js';
4
+ import { project } from './project.js';
5
+ import { SAMPLES } from './samples.js';
6
+ const { BILLING } = PATHS;
7
+ /** The files and sources the fixtures of `domain/value-object-class` share. */
8
+ export const VALUES = {
9
+ RULE: 'domain/value-object-class',
10
+ MONEY: `${BILLING}/domain/value-objects/money.vo.ts`,
11
+ INVOICE_MONEY: `${BILLING}/domain/value-objects/invoice-money.vo.ts`,
12
+ SERVICE: `${BILLING}/domain/services/invoice-total.service.ts`,
13
+ SHARED: 'src/shared-kernel/money.vo.ts',
14
+ SHARED_PLAIN: 'src/shared-kernel/money.ts',
15
+ KERNEL: "import { ValueObject } from '@ddd-ts-kit/kernel';\n",
16
+ PROPS: 'export type MoneyProps = {\n readonly cents: number;\n};\n',
17
+ PRIVATE: ' private constructor(props: MoneyProps) {\n super(props);\n }\n\n',
18
+ OF: ' static of(cents: number): Money {\n return new Money({ cents });\n }\n\n',
19
+ PLAIN: 'export const money = (cents: number, currency: string) => ({ cents, currency });\n',
20
+ IMPORT_MONEY: "import { Money } from '@/contexts/billing/domain/value-objects/money.vo.js';\n\n",
21
+ };
22
+ /** The value object every passing fixture starts from: a private constructor and a static factory. */
23
+ const VALUE_OBJECT = money(VALUES.PRIVATE, VALUES.OF);
24
+ /** The builders of the fixtures of `domain/value-object-class`. */
25
+ export const VALUE_FILES = { money, classes, service, valueObject, VALUE_OBJECT };
26
+ /** `Money`, a class of `money.vo.ts` with the constructor, the factories and the heritage given. */
27
+ function money(constructor, factory, base = 'extends ValueObject<MoneyProps> ') {
28
+ return `${VALUES.KERNEL}\n${VALUES.PROPS}\nexport class Money ${base}{\n${constructor}${factory} add(other: Money): Money {\n return Money.of(this.props.cents + other.props.cents);\n }\n}\n`;
29
+ }
30
+ /** A project that writes its values as classes, as `init` writes it, holding `files`. */
31
+ function classes(files) {
32
+ return project(files, { [CONFIG_FILE]: config({ stack: { values: 'classes' } }) });
33
+ }
34
+ /** The value object and a domain service holding `content`, each with its spec. */
35
+ function service(content) {
36
+ return {
37
+ ...valueObject(VALUE_OBJECT),
38
+ [VALUES.SERVICE]: `${VALUES.IMPORT_MONEY}${content}`,
39
+ [`${BILLING}/test/unit/invoice-total.service.spec.ts`]: SAMPLES.SPEC,
40
+ };
41
+ }
42
+ /** `money.vo.ts` holding `content`, with its spec. */
43
+ function valueObject(content) {
44
+ return { [VALUES.MONEY]: content, [`${BILLING}/test/unit/money.vo.spec.ts`]: SAMPLES.SPEC };
45
+ }
46
+ //# sourceMappingURL=value-object-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-object-files.js","sourceRoot":"","sources":["../../../src/check/fixtures/value-object-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAE1B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,GAAG,OAAO,mCAAmC;IACpD,aAAa,EAAE,GAAG,OAAO,2CAA2C;IACpE,OAAO,EAAE,GAAG,OAAO,2CAA2C;IAC9D,MAAM,EAAE,+BAA+B;IACvC,YAAY,EAAE,4BAA4B;IAC1C,MAAM,EAAE,qDAAqD;IAC7D,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,wEAAwE;IACjF,EAAE,EAAE,gFAAgF;IACpF,KAAK,EAAE,oFAAoF;IAC3F,YAAY,EAAE,kFAAkF;CACxF,CAAC;AAEX,sGAAsG;AACtG,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAEtD,mEAAmE;AACnE,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AAElF,oGAAoG;AACpG,SAAS,KAAK,CAAC,WAAmB,EAAE,OAAe,EAAE,IAAI,GAAG,kCAAkC;IAC5F,OAAO,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,wBAAwB,IAAI,MAAM,WAAW,GAAG,OAAO,oGAAoG,CAAC;AACtM,CAAC;AAED,yFAAyF;AACzF,SAAS,OAAO,CAAC,KAAmB;IAClC,OAAO,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC;AAED,mFAAmF;AACnF,SAAS,OAAO,CAAC,OAAe;IAC9B,OAAO;QACL,GAAG,WAAW,CAAC,YAAY,CAAC;QAC5B,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,GAAG,OAAO,EAAE;QACpD,CAAC,GAAG,OAAO,0CAA0C,CAAC,EAAE,OAAO,CAAC,IAAI;KACrE,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,6BAA6B,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from '../model/rule.js';
2
+ export declare const domainValueObjectClass: Rule;
3
+ //# sourceMappingURL=domain-value-object-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-value-object-class.d.ts","sourceRoot":"","sources":["../../../src/check/rules/domain-value-object-class.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,eAAO,MAAM,sBAAsB,EAAE,IAQpC,CAAC"}