ddd-ts-kit 0.90.0 → 0.92.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 (746) hide show
  1. package/CHANGELOG.md +474 -0
  2. package/README.fr.md +53 -17
  3. package/README.md +49 -15
  4. package/dist/acceptance/lock-acceptance.d.ts.map +1 -1
  5. package/dist/acceptance/lock-acceptance.js +2 -1
  6. package/dist/acceptance/lock-acceptance.js.map +1 -1
  7. package/dist/alias/index.d.ts +2 -1
  8. package/dist/alias/index.d.ts.map +1 -1
  9. package/dist/alias/index.js +1 -0
  10. package/dist/alias/index.js.map +1 -1
  11. package/dist/alias/mapper-target-text.d.ts +4 -0
  12. package/dist/alias/mapper-target-text.d.ts.map +1 -0
  13. package/dist/alias/mapper-target-text.js +5 -0
  14. package/dist/alias/mapper-target-text.js.map +1 -0
  15. package/dist/alias/module-name-mapper.d.ts +5 -2
  16. package/dist/alias/module-name-mapper.d.ts.map +1 -1
  17. package/dist/alias/module-name-mapper.js +5 -2
  18. package/dist/alias/module-name-mapper.js.map +1 -1
  19. package/dist/check/alias/test-runners.js +8 -3
  20. package/dist/check/alias/test-runners.js.map +1 -1
  21. package/dist/check/baseline/apply-baseline.d.ts +14 -0
  22. package/dist/check/baseline/apply-baseline.d.ts.map +1 -0
  23. package/dist/check/baseline/apply-baseline.js +30 -0
  24. package/dist/check/baseline/apply-baseline.js.map +1 -0
  25. package/dist/check/baseline/baseline-following-moves.d.ts +9 -0
  26. package/dist/check/baseline/baseline-following-moves.d.ts.map +1 -0
  27. package/dist/check/baseline/baseline-following-moves.js +10 -0
  28. package/dist/check/baseline/baseline-following-moves.js.map +1 -0
  29. package/dist/check/baseline/baseline-move.d.ts +6 -0
  30. package/dist/check/baseline/baseline-move.d.ts.map +1 -0
  31. package/dist/check/baseline/baseline-move.js +2 -0
  32. package/dist/check/baseline/baseline-move.js.map +1 -0
  33. package/dist/check/baseline/baseline-text.d.ts +4 -0
  34. package/dist/check/baseline/baseline-text.d.ts.map +1 -0
  35. package/dist/check/baseline/baseline-text.js +12 -0
  36. package/dist/check/baseline/baseline-text.js.map +1 -0
  37. package/dist/check/baseline/baseline.d.ts +6 -0
  38. package/dist/check/baseline/baseline.d.ts.map +1 -0
  39. package/dist/check/baseline/baseline.js +2 -0
  40. package/dist/check/baseline/baseline.js.map +1 -0
  41. package/dist/check/baseline/moved-baseline-text.d.ts +4 -0
  42. package/dist/check/baseline/moved-baseline-text.d.ts.map +1 -0
  43. package/dist/check/baseline/moved-baseline-text.js +13 -0
  44. package/dist/check/baseline/moved-baseline-text.js.map +1 -0
  45. package/dist/check/baseline/parse-baseline.d.ts +4 -0
  46. package/dist/check/baseline/parse-baseline.d.ts.map +1 -0
  47. package/dist/check/baseline/parse-baseline.js +19 -0
  48. package/dist/check/baseline/parse-baseline.js.map +1 -0
  49. package/dist/check/baseline/pruned-baseline.d.ts +5 -0
  50. package/dist/check/baseline/pruned-baseline.d.ts.map +1 -0
  51. package/dist/check/baseline/pruned-baseline.js +14 -0
  52. package/dist/check/baseline/pruned-baseline.js.map +1 -0
  53. package/dist/check/baseline/read-baseline.d.ts +6 -0
  54. package/dist/check/baseline/read-baseline.d.ts.map +1 -0
  55. package/dist/check/baseline/read-baseline.js +11 -0
  56. package/dist/check/baseline/read-baseline.js.map +1 -0
  57. package/dist/check/baseline/recorded-baseline.d.ts +5 -0
  58. package/dist/check/baseline/recorded-baseline.d.ts.map +1 -0
  59. package/dist/check/baseline/recorded-baseline.js +11 -0
  60. package/dist/check/baseline/recorded-baseline.js.map +1 -0
  61. package/dist/check/baseline/renamed-files.d.ts +8 -0
  62. package/dist/check/baseline/renamed-files.d.ts.map +1 -0
  63. package/dist/check/baseline/renamed-files.js +23 -0
  64. package/dist/check/baseline/renamed-files.js.map +1 -0
  65. package/dist/check/baseline/write-baseline.d.ts +4 -0
  66. package/dist/check/baseline/write-baseline.d.ts.map +1 -0
  67. package/dist/check/baseline/write-baseline.js +9 -0
  68. package/dist/check/baseline/write-baseline.js.map +1 -0
  69. package/dist/check/canonical/stray-entry.d.ts.map +1 -1
  70. package/dist/check/canonical/stray-entry.js +5 -1
  71. package/dist/check/canonical/stray-entry.js.map +1 -1
  72. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  73. package/dist/check/catalogue/architecture-rules.js +4 -0
  74. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  75. package/dist/check/commands/check-command.d.ts.map +1 -1
  76. package/dist/check/commands/check-command.js +46 -1
  77. package/dist/check/commands/check-command.js.map +1 -1
  78. package/dist/check/commands/check-file-command.d.ts +5 -0
  79. package/dist/check/commands/check-file-command.d.ts.map +1 -1
  80. package/dist/check/commands/check-file-command.js +27 -6
  81. package/dist/check/commands/check-file-command.js.map +1 -1
  82. package/dist/check/event-sourcing/read-stored-shape.d.ts +2 -0
  83. package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
  84. package/dist/check/event-sourcing/read-stored-shape.js +3 -1
  85. package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
  86. package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
  87. package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
  88. package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
  89. package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
  90. package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
  91. package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
  92. package/dist/check/explain/nest-docs.d.ts +3 -0
  93. package/dist/check/explain/nest-docs.d.ts.map +1 -0
  94. package/dist/check/explain/nest-docs.js +31 -0
  95. package/dist/check/explain/nest-docs.js.map +1 -0
  96. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  97. package/dist/check/explain/rule-docs.js +2 -0
  98. package/dist/check/explain/rule-docs.js.map +1 -1
  99. package/dist/check/fixtures/alias-declared-fixtures.js +1 -1
  100. package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
  101. package/dist/check/fixtures/authz-declared-fixtures.js +1 -1
  102. package/dist/check/fixtures/authz-declared-fixtures.js.map +1 -1
  103. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  104. package/dist/check/fixtures/fixtures.js +4 -0
  105. package/dist/check/fixtures/fixtures.js.map +1 -1
  106. package/dist/check/fixtures/nest-controllers-fixtures.d.ts +3 -0
  107. package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -0
  108. package/dist/check/fixtures/nest-controllers-fixtures.js +104 -0
  109. package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -0
  110. package/dist/check/fixtures/nest-fixtures.d.ts +3 -0
  111. package/dist/check/fixtures/nest-fixtures.d.ts.map +1 -0
  112. package/dist/check/fixtures/nest-fixtures.js +59 -0
  113. package/dist/check/fixtures/nest-fixtures.js.map +1 -0
  114. package/dist/check/nest/nest-equivalents-of.d.ts +14 -0
  115. package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -0
  116. package/dist/check/nest/nest-equivalents-of.js +124 -0
  117. package/dist/check/nest/nest-equivalents-of.js.map +1 -0
  118. package/dist/check/project/load-project.d.ts +2 -0
  119. package/dist/check/project/load-project.d.ts.map +1 -1
  120. package/dist/check/project/load-project.js +7 -3
  121. package/dist/check/project/load-project.js.map +1 -1
  122. package/dist/check/rules/nest-controllers-current.d.ts +3 -0
  123. package/dist/check/rules/nest-controllers-current.d.ts.map +1 -0
  124. package/dist/check/rules/nest-controllers-current.js +54 -0
  125. package/dist/check/rules/nest-controllers-current.js.map +1 -0
  126. package/dist/check/rules/nest-no-parallel-pipeline.d.ts +3 -0
  127. package/dist/check/rules/nest-no-parallel-pipeline.d.ts.map +1 -0
  128. package/dist/check/rules/nest-no-parallel-pipeline.js +70 -0
  129. package/dist/check/rules/nest-no-parallel-pipeline.js.map +1 -0
  130. package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
  131. package/dist/check/support/is-generated-context-file.js +4 -1
  132. package/dist/check/support/is-generated-context-file.js.map +1 -1
  133. package/dist/commands/docs.d.ts.map +1 -1
  134. package/dist/commands/docs.js +13 -5
  135. package/dist/commands/docs.js.map +1 -1
  136. package/dist/commands/drizzle-generate.d.ts.map +1 -1
  137. package/dist/commands/drizzle-generate.js +21 -1
  138. package/dist/commands/drizzle-generate.js.map +1 -1
  139. package/dist/commands/generate.js +2 -0
  140. package/dist/commands/generate.js.map +1 -1
  141. package/dist/commands/init.d.ts.map +1 -1
  142. package/dist/commands/init.js +1 -0
  143. package/dist/commands/init.js.map +1 -1
  144. package/dist/commands/prisma-generate.d.ts +7 -0
  145. package/dist/commands/prisma-generate.d.ts.map +1 -0
  146. package/dist/commands/prisma-generate.js +23 -0
  147. package/dist/commands/prisma-generate.js.map +1 -0
  148. package/dist/commands/typeorm-generate.d.ts +10 -0
  149. package/dist/commands/typeorm-generate.d.ts.map +1 -0
  150. package/dist/commands/typeorm-generate.js +37 -0
  151. package/dist/commands/typeorm-generate.js.map +1 -0
  152. package/dist/config/config.d.ts +6 -0
  153. package/dist/config/config.d.ts.map +1 -1
  154. package/dist/config/index.d.ts +1 -1
  155. package/dist/config/index.d.ts.map +1 -1
  156. package/dist/config/index.js +1 -1
  157. package/dist/config/index.js.map +1 -1
  158. package/dist/config/parse-config.js +1 -0
  159. package/dist/config/parse-config.js.map +1 -1
  160. package/dist/config/parse-stack.d.ts.map +1 -1
  161. package/dist/config/parse-stack.js +2 -1
  162. package/dist/config/parse-stack.js.map +1 -1
  163. package/dist/config/serialize-config.js +9 -2
  164. package/dist/config/serialize-config.js.map +1 -1
  165. package/dist/config/stack.d.ts +18 -5
  166. package/dist/config/stack.d.ts.map +1 -1
  167. package/dist/config/stack.js +5 -2
  168. package/dist/config/stack.js.map +1 -1
  169. package/dist/describe/guard-errors.d.ts +3 -0
  170. package/dist/describe/guard-errors.d.ts.map +1 -0
  171. package/dist/describe/guard-errors.js +10 -0
  172. package/dist/describe/guard-errors.js.map +1 -0
  173. package/dist/describe/no-group.d.ts +4 -0
  174. package/dist/describe/no-group.d.ts.map +1 -0
  175. package/dist/describe/no-group.js +3 -0
  176. package/dist/describe/no-group.js.map +1 -0
  177. package/dist/describe/read-controllers.d.ts +1 -1
  178. package/dist/describe/read-controllers.d.ts.map +1 -1
  179. package/dist/describe/read-controllers.js +12 -19
  180. package/dist/describe/read-controllers.js.map +1 -1
  181. package/dist/describe/read-nest-controller-routes.d.ts +16 -0
  182. package/dist/describe/read-nest-controller-routes.d.ts.map +1 -0
  183. package/dist/describe/read-nest-controller-routes.js +117 -0
  184. package/dist/describe/read-nest-controller-routes.js.map +1 -0
  185. package/dist/describe/schema-class-of.d.ts +3 -0
  186. package/dist/describe/schema-class-of.d.ts.map +1 -0
  187. package/dist/describe/schema-class-of.js +10 -0
  188. package/dist/describe/schema-class-of.js.map +1 -0
  189. package/dist/dev/refresh-declarations.d.ts.map +1 -1
  190. package/dist/dev/refresh-declarations.js +4 -1
  191. package/dist/dev/refresh-declarations.js.map +1 -1
  192. package/dist/docs/declared-stored-events.d.ts +6 -2
  193. package/dist/docs/declared-stored-events.d.ts.map +1 -1
  194. package/dist/docs/declared-stored-events.js +4 -3
  195. package/dist/docs/declared-stored-events.js.map +1 -1
  196. package/dist/docs/emptily-recorded-stored-events.d.ts +6 -0
  197. package/dist/docs/emptily-recorded-stored-events.d.ts.map +1 -0
  198. package/dist/docs/emptily-recorded-stored-events.js +12 -0
  199. package/dist/docs/emptily-recorded-stored-events.js.map +1 -0
  200. package/dist/docs/refuse-unreadable-stored-events.d.ts +7 -0
  201. package/dist/docs/refuse-unreadable-stored-events.d.ts.map +1 -0
  202. package/dist/docs/refuse-unreadable-stored-events.js +27 -0
  203. package/dist/docs/refuse-unreadable-stored-events.js.map +1 -0
  204. package/dist/docs/write-docs.d.ts.map +1 -1
  205. package/dist/docs/write-docs.js +2 -0
  206. package/dist/docs/write-docs.js.map +1 -1
  207. package/dist/docs/write-stored-events-lock.d.ts +3 -2
  208. package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
  209. package/dist/docs/write-stored-events-lock.js +5 -2
  210. package/dist/docs/write-stored-events-lock.js.map +1 -1
  211. package/dist/file-moves/move-files.d.ts.map +1 -1
  212. package/dist/file-moves/move-files.js +10 -0
  213. package/dist/file-moves/move-files.js.map +1 -1
  214. package/dist/generate/kind.d.ts +2 -0
  215. package/dist/generate/kind.d.ts.map +1 -1
  216. package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
  217. package/dist/generate/kinds/aggregate-kind.js +6 -2
  218. package/dist/generate/kinds/aggregate-kind.js.map +1 -1
  219. package/dist/generate/kinds/assert-event-store.d.ts +4 -0
  220. package/dist/generate/kinds/assert-event-store.d.ts.map +1 -0
  221. package/dist/generate/kinds/assert-event-store.js +10 -0
  222. package/dist/generate/kinds/assert-event-store.js.map +1 -0
  223. package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts +9 -0
  224. package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -0
  225. package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +49 -0
  226. package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -0
  227. package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
  228. package/dist/generate/kinds/file-upload-kind.js +9 -2
  229. package/dist/generate/kinds/file-upload-kind.js.map +1 -1
  230. package/dist/generate/kinds/form-kind.d.ts.map +1 -1
  231. package/dist/generate/kinds/form-kind.js +15 -11
  232. package/dist/generate/kinds/form-kind.js.map +1 -1
  233. package/dist/generate/kinds/generate-event-sourced-repository.d.ts +11 -0
  234. package/dist/generate/kinds/generate-event-sourced-repository.d.ts.map +1 -0
  235. package/dist/generate/kinds/generate-event-sourced-repository.js +48 -0
  236. package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -0
  237. package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
  238. package/dist/generate/kinds/generate-repository.js +5 -0
  239. package/dist/generate/kinds/generate-repository.js.map +1 -1
  240. package/dist/generate/kinds/is-event-sourced.d.ts +9 -0
  241. package/dist/generate/kinds/is-event-sourced.d.ts.map +1 -0
  242. package/dist/generate/kinds/is-event-sourced.js +11 -0
  243. package/dist/generate/kinds/is-event-sourced.js.map +1 -0
  244. package/dist/generate/kinds/presentation/controller-source.d.ts +11 -3
  245. package/dist/generate/kinds/presentation/controller-source.d.ts.map +1 -1
  246. package/dist/generate/kinds/presentation/controller-source.js +25 -4
  247. package/dist/generate/kinds/presentation/controller-source.js.map +1 -1
  248. package/dist/generate/kinds/property-kind.d.ts +3 -0
  249. package/dist/generate/kinds/property-kind.d.ts.map +1 -0
  250. package/dist/generate/kinds/property-kind.js +51 -0
  251. package/dist/generate/kinds/property-kind.js.map +1 -0
  252. package/dist/generate/kinds/repository-kind.js +1 -1
  253. package/dist/generate/kinds/repository-kind.js.map +1 -1
  254. package/dist/generate/kinds/representation-kind.d.ts.map +1 -1
  255. package/dist/generate/kinds/representation-kind.js +4 -3
  256. package/dist/generate/kinds/representation-kind.js.map +1 -1
  257. package/dist/generate/kinds/route/nest-controller-vars.d.ts +11 -0
  258. package/dist/generate/kinds/route/nest-controller-vars.d.ts.map +1 -0
  259. package/dist/generate/kinds/route/nest-controller-vars.js +91 -0
  260. package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -0
  261. package/dist/generate/kinds/route/nest-search-vars.d.ts +6 -0
  262. package/dist/generate/kinds/route/nest-search-vars.d.ts.map +1 -0
  263. package/dist/generate/kinds/route/nest-search-vars.js +18 -0
  264. package/dist/generate/kinds/route/nest-search-vars.js.map +1 -0
  265. package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
  266. package/dist/generate/kinds/route/route-vars.js +1 -9
  267. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  268. package/dist/generate/kinds/route/success-status.d.ts +5 -0
  269. package/dist/generate/kinds/route/success-status.d.ts.map +1 -0
  270. package/dist/generate/kinds/route/success-status.js +11 -0
  271. package/dist/generate/kinds/route/success-status.js.map +1 -0
  272. package/dist/generate/kinds/route/write-nest-controller.d.ts +8 -0
  273. package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -0
  274. package/dist/generate/kinds/route/write-nest-controller.js +50 -0
  275. package/dist/generate/kinds/route/write-nest-controller.js.map +1 -0
  276. package/dist/generate/kinds/route-kind.d.ts.map +1 -1
  277. package/dist/generate/kinds/route-kind.js +6 -1
  278. package/dist/generate/kinds/route-kind.js.map +1 -1
  279. package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -1
  280. package/dist/generate/kinds/wire-repository-on-first-use.js +2 -1
  281. package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -1
  282. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
  283. package/dist/generate/kinds/write-event-sourced-aggregate.js +5 -13
  284. package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
  285. package/dist/generate/kinds.d.ts.map +1 -1
  286. package/dist/generate/kinds.js +2 -0
  287. package/dist/generate/kinds.js.map +1 -1
  288. package/dist/generate/refresh-docs.d.ts.map +1 -1
  289. package/dist/generate/refresh-docs.js +2 -0
  290. package/dist/generate/refresh-docs.js.map +1 -1
  291. package/dist/generate/shared-writes.d.ts.map +1 -1
  292. package/dist/generate/shared-writes.js +5 -0
  293. package/dist/generate/shared-writes.js.map +1 -1
  294. package/dist/help/notes.d.ts +1 -1
  295. package/dist/help/notes.d.ts.map +1 -1
  296. package/dist/help/notes.js +3 -1
  297. package/dist/help/notes.js.map +1 -1
  298. package/dist/help/usage.d.ts +1 -1
  299. package/dist/help/usage.d.ts.map +1 -1
  300. package/dist/help/usage.js +7 -3
  301. package/dist/help/usage.js.map +1 -1
  302. package/dist/init/agent-permissions.js +12 -6
  303. package/dist/init/agent-permissions.js.map +1 -1
  304. package/dist/init/files/audit-files.js +1 -1
  305. package/dist/init/files/audit-files.js.map +1 -1
  306. package/dist/init/files/auth-files.js +4 -0
  307. package/dist/init/files/auth-files.js.map +1 -1
  308. package/dist/init/files/persistence-files.d.ts.map +1 -1
  309. package/dist/init/files/persistence-files.js +2 -0
  310. package/dist/init/files/persistence-files.js.map +1 -1
  311. package/dist/init/files/platform-files.js +1 -0
  312. package/dist/init/files/platform-files.js.map +1 -1
  313. package/dist/init/knip-vars.d.ts.map +1 -1
  314. package/dist/init/knip-vars.js +14 -5
  315. package/dist/init/knip-vars.js.map +1 -1
  316. package/dist/init/manifest/database-scripts.d.ts.map +1 -1
  317. package/dist/init/manifest/database-scripts.js +10 -4
  318. package/dist/init/manifest/database-scripts.js.map +1 -1
  319. package/dist/init/manifest/dependencies-against-stack.d.ts +18 -0
  320. package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -0
  321. package/dist/init/manifest/dependencies-against-stack.js +99 -0
  322. package/dist/init/manifest/dependencies-against-stack.js.map +1 -0
  323. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  324. package/dist/init/manifest/dependencies-for.js +19 -3
  325. package/dist/init/manifest/dependencies-for.js.map +1 -1
  326. package/dist/init/manifest/scripts-for.js +5 -2
  327. package/dist/init/manifest/scripts-for.js.map +1 -1
  328. package/dist/init/manifest/versions.d.ts.map +1 -1
  329. package/dist/init/manifest/versions.js +40 -30
  330. package/dist/init/manifest/versions.js.map +1 -1
  331. package/dist/init/run-init.d.ts.map +1 -1
  332. package/dist/init/run-init.js +14 -1
  333. package/dist/init/run-init.js.map +1 -1
  334. package/dist/init/stack/resolve-queue.d.ts +4 -10
  335. package/dist/init/stack/resolve-queue.d.ts.map +1 -1
  336. package/dist/init/stack/resolve-queue.js +7 -11
  337. package/dist/init/stack/resolve-queue.js.map +1 -1
  338. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  339. package/dist/init/stack/resolve-stack.js +30 -9
  340. package/dist/init/stack/resolve-stack.js.map +1 -1
  341. package/dist/init/stack/stack-options.d.ts +2 -0
  342. package/dist/init/stack/stack-options.d.ts.map +1 -1
  343. package/dist/init/template-vars.js +1 -1
  344. package/dist/init/template-vars.js.map +1 -1
  345. package/dist/init/write-type-script-configs.d.ts.map +1 -1
  346. package/dist/init/write-type-script-configs.js +4 -1
  347. package/dist/init/write-type-script-configs.js.map +1 -1
  348. package/dist/markers/insert-in-region.js +1 -1
  349. package/dist/markers/insert-in-region.js.map +1 -1
  350. package/dist/merge/lost/untouched-by-branch.d.ts +12 -0
  351. package/dist/merge/lost/untouched-by-branch.d.ts.map +1 -0
  352. package/dist/merge/lost/untouched-by-branch.js +22 -0
  353. package/dist/merge/lost/untouched-by-branch.js.map +1 -0
  354. package/dist/merge/lost/verify-merge.d.ts.map +1 -1
  355. package/dist/merge/lost/verify-merge.js +6 -1
  356. package/dist/merge/lost/verify-merge.js.map +1 -1
  357. package/dist/migration/audit-guard/append-audit-guard.d.ts +18 -0
  358. package/dist/migration/audit-guard/append-audit-guard.d.ts.map +1 -0
  359. package/dist/migration/audit-guard/append-audit-guard.js +27 -0
  360. package/dist/migration/audit-guard/append-audit-guard.js.map +1 -0
  361. package/dist/migration/audit-guard/audit-guard-statements-of.d.ts +7 -0
  362. package/dist/migration/audit-guard/audit-guard-statements-of.d.ts.map +1 -0
  363. package/dist/migration/audit-guard/audit-guard-statements-of.js +18 -0
  364. package/dist/migration/audit-guard/audit-guard-statements-of.js.map +1 -0
  365. package/dist/migration/audit-guard/audit-schema-created.d.ts +3 -0
  366. package/dist/migration/audit-guard/audit-schema-created.d.ts.map +1 -0
  367. package/dist/migration/audit-guard/audit-schema-created.js +9 -0
  368. package/dist/migration/audit-guard/audit-schema-created.js.map +1 -0
  369. package/dist/migration/audit-guard/generate-guarded.d.ts +16 -0
  370. package/dist/migration/audit-guard/generate-guarded.d.ts.map +1 -0
  371. package/dist/migration/audit-guard/generate-guarded.js +22 -0
  372. package/dist/migration/audit-guard/generate-guarded.js.map +1 -0
  373. package/dist/migration/audit-guard/guard-marker.d.ts +3 -0
  374. package/dist/migration/audit-guard/guard-marker.d.ts.map +1 -0
  375. package/dist/migration/audit-guard/guard-marker.js +3 -0
  376. package/dist/migration/audit-guard/guard-marker.js.map +1 -0
  377. package/dist/migration/audit-guard/guarded-text.d.ts +5 -0
  378. package/dist/migration/audit-guard/guarded-text.d.ts.map +1 -0
  379. package/dist/migration/audit-guard/guarded-text.js +26 -0
  380. package/dist/migration/audit-guard/guarded-text.js.map +1 -0
  381. package/dist/migration/audit-guard/migrations-under.d.ts +3 -0
  382. package/dist/migration/audit-guard/migrations-under.d.ts.map +1 -0
  383. package/dist/migration/audit-guard/migrations-under.js +15 -0
  384. package/dist/migration/audit-guard/migrations-under.js.map +1 -0
  385. package/dist/migration/audit-guard/run-orm-tool.d.ts +3 -0
  386. package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -0
  387. package/dist/migration/audit-guard/run-orm-tool.js +13 -0
  388. package/dist/migration/audit-guard/run-orm-tool.js.map +1 -0
  389. package/dist/migration/audit-guard/schemas-first.d.ts +6 -0
  390. package/dist/migration/audit-guard/schemas-first.d.ts.map +1 -0
  391. package/dist/migration/audit-guard/schemas-first.js +17 -0
  392. package/dist/migration/audit-guard/schemas-first.js.map +1 -0
  393. package/dist/migration/audit-guard/schemas-if-missing.d.ts +7 -0
  394. package/dist/migration/audit-guard/schemas-if-missing.d.ts.map +1 -0
  395. package/dist/migration/audit-guard/schemas-if-missing.js +9 -0
  396. package/dist/migration/audit-guard/schemas-if-missing.js.map +1 -0
  397. package/dist/migration/audit-guard/type-only-imports.d.ts +6 -0
  398. package/dist/migration/audit-guard/type-only-imports.d.ts.map +1 -0
  399. package/dist/migration/audit-guard/type-only-imports.js +8 -0
  400. package/dist/migration/audit-guard/type-only-imports.js.map +1 -0
  401. package/dist/migration/format-as-the-project.d.ts +4 -0
  402. package/dist/migration/format-as-the-project.d.ts.map +1 -0
  403. package/dist/migration/format-as-the-project.js +27 -0
  404. package/dist/migration/format-as-the-project.js.map +1 -0
  405. package/dist/migration/format-written-files.d.ts.map +1 -1
  406. package/dist/migration/format-written-files.js +2 -24
  407. package/dist/migration/format-written-files.js.map +1 -1
  408. package/dist/migration/index.d.ts +8 -0
  409. package/dist/migration/index.d.ts.map +1 -1
  410. package/dist/migration/index.js +8 -0
  411. package/dist/migration/index.js.map +1 -1
  412. package/dist/nest-controllers/controllers-file.d.ts +3 -0
  413. package/dist/nest-controllers/controllers-file.d.ts.map +1 -0
  414. package/dist/nest-controllers/controllers-file.js +5 -0
  415. package/dist/nest-controllers/controllers-file.js.map +1 -0
  416. package/dist/nest-controllers/nest-answer.d.ts +8 -0
  417. package/dist/nest-controllers/nest-answer.d.ts.map +1 -0
  418. package/dist/nest-controllers/nest-answer.js +2 -0
  419. package/dist/nest-controllers/nest-answer.js.map +1 -0
  420. package/dist/nest-controllers/nest-controller-entry.d.ts +18 -0
  421. package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -0
  422. package/dist/nest-controllers/nest-controller-entry.js +2 -0
  423. package/dist/nest-controllers/nest-controller-entry.js.map +1 -0
  424. package/dist/nest-controllers/nest-controllers-in.d.ts +6 -0
  425. package/dist/nest-controllers/nest-controllers-in.d.ts.map +1 -0
  426. package/dist/nest-controllers/nest-controllers-in.js +108 -0
  427. package/dist/nest-controllers/nest-controllers-in.js.map +1 -0
  428. package/dist/nest-controllers/nest-read-type.d.ts +12 -0
  429. package/dist/nest-controllers/nest-read-type.d.ts.map +1 -0
  430. package/dist/nest-controllers/nest-read-type.js +2 -0
  431. package/dist/nest-controllers/nest-read-type.js.map +1 -0
  432. package/dist/nest-controllers/nest-request-part.d.ts +9 -0
  433. package/dist/nest-controllers/nest-request-part.d.ts.map +1 -0
  434. package/dist/nest-controllers/nest-request-part.js +2 -0
  435. package/dist/nest-controllers/nest-request-part.js.map +1 -0
  436. package/dist/nest-controllers/parameters-of.d.ts +8 -0
  437. package/dist/nest-controllers/parameters-of.d.ts.map +1 -0
  438. package/dist/nest-controllers/parameters-of.js +32 -0
  439. package/dist/nest-controllers/parameters-of.js.map +1 -0
  440. package/dist/nest-controllers/project-files.d.ts +6 -0
  441. package/dist/nest-controllers/project-files.d.ts.map +1 -0
  442. package/dist/nest-controllers/project-files.js +2 -0
  443. package/dist/nest-controllers/project-files.js.map +1 -0
  444. package/dist/nest-controllers/read-nest-controllers.d.ts +12 -0
  445. package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -0
  446. package/dist/nest-controllers/read-nest-controllers.js +17 -0
  447. package/dist/nest-controllers/read-nest-controllers.js.map +1 -0
  448. package/dist/nest-controllers/refresh-nest-controllers.d.ts +9 -0
  449. package/dist/nest-controllers/refresh-nest-controllers.d.ts.map +1 -0
  450. package/dist/nest-controllers/refresh-nest-controllers.js +32 -0
  451. package/dist/nest-controllers/refresh-nest-controllers.js.map +1 -0
  452. package/dist/nest-controllers/render-controllers-file.d.ts +9 -0
  453. package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -0
  454. package/dist/nest-controllers/render-controllers-file.js +72 -0
  455. package/dist/nest-controllers/render-controllers-file.js.map +1 -0
  456. package/dist/platform-folders/platform-folders.d.ts.map +1 -1
  457. package/dist/platform-folders/platform-folders.js +10 -0
  458. package/dist/platform-folders/platform-folders.js.map +1 -1
  459. package/dist/platform-layout/platform-layout.d.ts +3 -0
  460. package/dist/platform-layout/platform-layout.d.ts.map +1 -1
  461. package/dist/platform-layout/platform-layout.js +3 -0
  462. package/dist/platform-layout/platform-layout.js.map +1 -1
  463. package/dist/presets/apply-preset.d.ts.map +1 -1
  464. package/dist/presets/apply-preset.js +22 -2
  465. package/dist/presets/apply-preset.js.map +1 -1
  466. package/dist/presets/identity-preset.d.ts.map +1 -1
  467. package/dist/presets/identity-preset.js +4 -1
  468. package/dist/presets/identity-preset.js.map +1 -1
  469. package/dist/presets/identity-refusal.d.ts.map +1 -1
  470. package/dist/presets/identity-refusal.js +14 -8
  471. package/dist/presets/identity-refusal.js.map +1 -1
  472. package/dist/presets/lay-out-prisma-models.d.ts +8 -0
  473. package/dist/presets/lay-out-prisma-models.d.ts.map +1 -0
  474. package/dist/presets/lay-out-prisma-models.js +51 -0
  475. package/dist/presets/lay-out-prisma-models.js.map +1 -0
  476. package/dist/presets/preset-files.d.ts.map +1 -1
  477. package/dist/presets/preset-files.js +6 -1
  478. package/dist/presets/preset-files.js.map +1 -1
  479. package/dist/presets/preset.d.ts +11 -0
  480. package/dist/presets/preset.d.ts.map +1 -1
  481. package/dist/run.d.ts.map +1 -1
  482. package/dist/run.js +4 -0
  483. package/dist/run.js.map +1 -1
  484. package/dist/sdk/client-files.d.ts +5 -3
  485. package/dist/sdk/client-files.d.ts.map +1 -1
  486. package/dist/sdk/client-files.js +8 -3
  487. package/dist/sdk/client-files.js.map +1 -1
  488. package/dist/sdk/client-manifest.d.ts +3 -0
  489. package/dist/sdk/client-manifest.d.ts.map +1 -1
  490. package/dist/sdk/client-manifest.js +15 -2
  491. package/dist/sdk/client-manifest.js.map +1 -1
  492. package/dist/sdk/client-operation.d.ts +6 -0
  493. package/dist/sdk/client-operation.d.ts.map +1 -1
  494. package/dist/sdk/read-operation.d.ts.map +1 -1
  495. package/dist/sdk/read-operation.js +6 -0
  496. package/dist/sdk/read-operation.js.map +1 -1
  497. package/dist/sdk/render-orpc.d.ts +8 -0
  498. package/dist/sdk/render-orpc.d.ts.map +1 -0
  499. package/dist/sdk/render-orpc.js +42 -0
  500. package/dist/sdk/render-orpc.js.map +1 -0
  501. package/dist/sdk/render-readme.d.ts +3 -0
  502. package/dist/sdk/render-readme.d.ts.map +1 -1
  503. package/dist/sdk/render-readme.js +46 -0
  504. package/dist/sdk/render-readme.js.map +1 -1
  505. package/dist/sdk/render-trpc.d.ts +9 -0
  506. package/dist/sdk/render-trpc.d.ts.map +1 -0
  507. package/dist/sdk/render-trpc.js +36 -0
  508. package/dist/sdk/render-trpc.js.map +1 -0
  509. package/dist/sdk/rpc-packages.d.ts +7 -0
  510. package/dist/sdk/rpc-packages.d.ts.map +1 -0
  511. package/dist/sdk/rpc-packages.js +9 -0
  512. package/dist/sdk/rpc-packages.js.map +1 -0
  513. package/dist/sdk/rpc.d.ts +4 -0
  514. package/dist/sdk/rpc.d.ts.map +1 -0
  515. package/dist/sdk/rpc.js +2 -0
  516. package/dist/sdk/rpc.js.map +1 -0
  517. package/dist/sdk/write-clients.d.ts.map +1 -1
  518. package/dist/sdk/write-clients.js +18 -3
  519. package/dist/sdk/write-clients.js.map +1 -1
  520. package/dist/stack/alias-vars.d.ts.map +1 -1
  521. package/dist/stack/alias-vars.js +2 -2
  522. package/dist/stack/alias-vars.js.map +1 -1
  523. package/dist/stack/audit-vars.js +1 -1
  524. package/dist/stack/audit-vars.js.map +1 -1
  525. package/dist/stack/authentication-vars.d.ts.map +1 -1
  526. package/dist/stack/authentication-vars.js +8 -2
  527. package/dist/stack/authentication-vars.js.map +1 -1
  528. package/dist/stack/cache-vars.d.ts +5 -1
  529. package/dist/stack/cache-vars.d.ts.map +1 -1
  530. package/dist/stack/cache-vars.js +9 -3
  531. package/dist/stack/cache-vars.js.map +1 -1
  532. package/dist/stack/stack-vars.d.ts +1 -1
  533. package/dist/stack/stack-vars.d.ts.map +1 -1
  534. package/dist/stack/stack-vars.js +11 -6
  535. package/dist/stack/stack-vars.js.map +1 -1
  536. package/dist/version.d.ts +1 -1
  537. package/dist/version.js +1 -1
  538. package/dist/worker/briefing-of.d.ts.map +1 -1
  539. package/dist/worker/briefing-of.js +2 -4
  540. package/dist/worker/briefing-of.js.map +1 -1
  541. package/dist/worker/resume-message.d.ts.map +1 -1
  542. package/dist/worker/resume-message.js +1 -2
  543. package/dist/worker/resume-message.js.map +1 -1
  544. package/package.json +6 -4
  545. package/templates/architecture/extractable.declared.spec.ts.tpl +22 -17
  546. package/templates/architecture/extractable.manual.spec.ts.tpl +14 -9
  547. package/templates/architecture/extractable.tsyringe.spec.ts.tpl +19 -14
  548. package/templates/background-job/wiring.manual.tpl +1 -1
  549. package/templates/command/wiring.manual.tpl +1 -1
  550. package/templates/context/module.manual.ts.tpl +52 -10
  551. package/templates/erasure-handler/wiring.manual.tpl +1 -1
  552. package/templates/event-handler/wiring.manual.tpl +1 -1
  553. package/templates/file-upload/wiring.manual.tpl +1 -1
  554. package/templates/init/docker/env.example.tpl +1 -1
  555. package/templates/init/e2e/auth-environment.passport.ts.tpl +6 -0
  556. package/templates/init/e2e/create-credentials.passport.ts.tpl +47 -0
  557. package/templates/init/jest.config.js.tpl +6 -0
  558. package/templates/init/platform/auth/authentication/actor-of-token.ts.tpl +15 -0
  559. package/templates/init/platform/auth/authentication/bearer-strategy.ts.tpl +29 -0
  560. package/templates/init/platform/auth/authentication/create-authenticator.passport.ts.tpl +13 -0
  561. package/templates/init/platform/composition/compose-application.manual.ts.tpl +55 -2
  562. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
  563. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
  564. package/templates/init/platform/composition/platform-error-mapper.ts.tpl +9 -0
  565. package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +11 -0
  566. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +14 -5
  567. package/templates/init/platform/config/app-config.ts.tpl +2 -2
  568. package/templates/init/platform/config/load-config.ts.tpl +2 -2
  569. package/templates/init/platform/database/open-persistence.memory.ts.tpl +10 -0
  570. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +6 -1
  571. package/templates/init/platform/database/persistence-over.knex.ts.tpl +6 -1
  572. package/templates/init/platform/database/persistence-over.prisma.ts.tpl +12 -1
  573. package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +28 -1
  574. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +131 -0
  575. package/templates/init/platform/database/persistence.memory.ts.tpl +7 -1
  576. package/templates/init/platform/database/persistence.orm.ts.tpl +16 -3
  577. package/templates/init/platform/database/schema.drizzle.ts.tpl +11 -1
  578. package/templates/init/platform/database/schema.prisma.tpl +5 -2
  579. package/templates/init/platform/database/schema.typeorm.ts.tpl +17 -3
  580. package/templates/init/platform/database/table-statements.drizzle.ts.tpl +36 -0
  581. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +18 -6
  582. package/templates/init/platform/files/bind-files.tsyringe.ts.tpl +1 -1
  583. package/templates/init/platform/files/create-files.ts.tpl +1 -1
  584. package/templates/init/platform/http/create-app-module.ts.tpl +20 -0
  585. package/templates/init/platform/http/start-http-server.express.ts.tpl +58 -2
  586. package/templates/init/platform/http/start-http-server.fastify.ts.tpl +50 -2
  587. package/templates/init/platform/http/start-http-server.hono.ts.tpl +60 -1
  588. package/templates/init/platform/http/start-http-server.nest.ts.tpl +67 -4
  589. package/templates/init/platform/jobs/create-background-work.ts.tpl +2 -2
  590. package/templates/init/rules/infrastructure.md.tpl +3 -0
  591. package/templates/init/rules/presentation.md.tpl +7 -0
  592. package/templates/integration-event/wiring.manual.tpl +1 -1
  593. package/templates/integration-handler/wiring.manual.tpl +1 -1
  594. package/templates/job/wiring.manual.tpl +1 -1
  595. package/templates/nest-controller/controller.search.ts.tpl +38 -0
  596. package/templates/nest-controller/controller.spec.ts.tpl +57 -0
  597. package/templates/nest-controller/controller.ts.tpl +49 -0
  598. package/templates/nest-controller/upload.spec.ts.tpl +47 -0
  599. package/templates/nest-controller/upload.ts.tpl +25 -0
  600. package/templates/pipeline/biome.json.tpl +2 -2
  601. package/templates/pipeline/eslint.config.mjs.tpl +6 -0
  602. package/templates/pipeline/knip.json.tpl +4 -8
  603. package/templates/pipeline/package-scripts.json +2 -2
  604. package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +271 -0
  605. package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +10 -0
  606. package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +10 -0
  607. package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +10 -0
  608. package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +10 -0
  609. package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +10 -0
  610. package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +10 -0
  611. package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +10 -0
  612. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +6 -0
  613. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +12 -0
  614. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +6 -0
  615. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +12 -0
  616. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +6 -0
  617. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +12 -0
  618. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +6 -0
  619. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +12 -0
  620. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +6 -0
  621. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +12 -0
  622. package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +6 -0
  623. package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +12 -0
  624. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +6 -0
  625. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +12 -0
  626. package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +6 -0
  627. package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +12 -0
  628. package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +6 -0
  629. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +12 -0
  630. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +6 -0
  631. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +12 -0
  632. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +6 -0
  633. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +12 -0
  634. package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +4 -0
  635. package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +4 -0
  636. package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +4 -0
  637. package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +4 -0
  638. package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +10 -1
  639. package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +10 -1
  640. package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +10 -1
  641. package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +10 -1
  642. package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +10 -1
  643. package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +10 -1
  644. package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +10 -1
  645. package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +12 -0
  646. package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +6 -0
  647. package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +9 -0
  648. package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +9 -0
  649. package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +9 -0
  650. package/templates/presets/identity/context/infrastructure/persistence/account.mapper.prisma.ts.tpl +36 -0
  651. package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.prisma.ts.tpl +19 -0
  652. package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.prisma.ts.tpl +48 -0
  653. package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +9 -0
  654. package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +9 -0
  655. package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +9 -0
  656. package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +9 -0
  657. package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +9 -0
  658. package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +9 -0
  659. package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.prisma.ts.tpl +43 -0
  660. package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.prisma.ts.tpl +20 -0
  661. package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +9 -0
  662. package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +9 -0
  663. package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +9 -0
  664. package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +9 -0
  665. package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +9 -0
  666. package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +9 -0
  667. package/templates/presets/identity/context/infrastructure/persistence/member.mapper.prisma.ts.tpl +34 -0
  668. package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.prisma.ts.tpl +26 -0
  669. package/templates/presets/identity/context/infrastructure/persistence/prisma-account.repository.prisma.ts.tpl +63 -0
  670. package/templates/presets/identity/context/infrastructure/persistence/prisma-delegation.repository.prisma.ts.tpl +81 -0
  671. package/templates/presets/identity/context/infrastructure/persistence/prisma-invitation.repository.prisma.ts.tpl +69 -0
  672. package/templates/presets/identity/context/infrastructure/persistence/prisma-member.repository.prisma.ts.tpl +80 -0
  673. package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation.repository.prisma.ts.tpl +63 -0
  674. package/templates/presets/identity/context/infrastructure/persistence/prisma-search-members-reader.repository.prisma.ts.tpl +82 -0
  675. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.nest-routes.ts.tpl +31 -0
  676. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.nest-routes.ts.tpl +44 -0
  677. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.nest-routes.ts.tpl +56 -0
  678. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.nest-routes.ts.tpl +54 -0
  679. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.nest-routes.ts.tpl +32 -0
  680. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.nest-routes.ts.tpl +43 -0
  681. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.nest-routes.ts.tpl +25 -0
  682. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.nest-routes.ts.tpl +37 -0
  683. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.nest-routes.ts.tpl +31 -0
  684. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.nest-routes.ts.tpl +31 -0
  685. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.nest-routes.ts.tpl +31 -0
  686. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.nest-routes.ts.tpl +42 -0
  687. package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +3 -3
  688. package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +5 -5
  689. package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +5 -5
  690. package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +5 -5
  691. package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +4 -4
  692. package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +8 -8
  693. package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +108 -0
  694. package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.nest-routes.ts.tpl +70 -0
  695. package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.nest-routes.ts.tpl +70 -0
  696. package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.nest-routes.ts.tpl +57 -0
  697. package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.nest-routes.ts.tpl +70 -0
  698. package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.nest-routes.ts.tpl +70 -0
  699. package/templates/presets/identity/context/test/unit/invite-member.controller.spec.nest-routes.ts.tpl +70 -0
  700. package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.nest-routes.ts.tpl +70 -0
  701. package/templates/presets/identity/context/test/unit/provision-account.controller.spec.nest-routes.ts.tpl +99 -0
  702. package/templates/presets/identity/context/test/unit/remove-member.controller.spec.nest-routes.ts.tpl +57 -0
  703. package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.nest-routes.ts.tpl +57 -0
  704. package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.nest-routes.ts.tpl +57 -0
  705. package/templates/presets/identity/context/test/unit/search-members.controller.spec.nest-routes.ts.tpl +54 -0
  706. package/templates/presets/identity/context/test/worlds/__context__.world.explicit.ts.tpl +332 -0
  707. package/templates/presets/identity/explicit/access-policies.wiring.tpl +16 -0
  708. package/templates/presets/identity/prisma/models.prisma.tpl +128 -0
  709. package/templates/process/timeout-job.wiring.manual.tpl +1 -1
  710. package/templates/property/value-object.properties.spec.ts.tpl +38 -0
  711. package/templates/query/search.wiring.manual.tpl +1 -1
  712. package/templates/query/wiring.manual.tpl +1 -1
  713. package/templates/repository/contract.spec.ts.tpl +1 -3
  714. package/templates/repository/event-sourced/contract.spec.ts.tpl +36 -0
  715. package/templates/repository/event-sourced/fake.ts.tpl +24 -0
  716. package/templates/repository/event-sourced/repository.ts.tpl +38 -0
  717. package/templates/repository/event-sourced-first-use.wiring.manual.tpl +4 -0
  718. package/templates/repository/event-sourced.wiring.tsyringe.tpl +6 -0
  719. package/templates/repository/first-use.wiring.manual.tpl +1 -1
  720. package/templates/sdk/orpc.ts.tpl +46 -0
  721. package/templates/sdk/trpc.ts.tpl +86 -0
  722. /package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/{deactivate-account.controller.ts.tpl → deactivate-account.controller.kit-routes.ts.tpl} +0 -0
  723. /package/templates/presets/identity/context/presentation/http/accounts/provision-account/{provision-account.controller.ts.tpl → provision-account.controller.kit-routes.ts.tpl} +0 -0
  724. /package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/{accept-invitation.controller.ts.tpl → accept-invitation.controller.kit-routes.ts.tpl} +0 -0
  725. /package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/{decline-invitation.controller.ts.tpl → decline-invitation.controller.kit-routes.ts.tpl} +0 -0
  726. /package/templates/presets/identity/context/presentation/http/organisations/change-member-role/{change-member-role.controller.ts.tpl → change-member-role.controller.kit-routes.ts.tpl} +0 -0
  727. /package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/{grant-delegation.controller.ts.tpl → grant-delegation.controller.kit-routes.ts.tpl} +0 -0
  728. /package/templates/presets/identity/context/presentation/http/organisations/invite-member/{invite-member.controller.ts.tpl → invite-member.controller.kit-routes.ts.tpl} +0 -0
  729. /package/templates/presets/identity/context/presentation/http/organisations/open-organisation/{open-organisation.controller.ts.tpl → open-organisation.controller.kit-routes.ts.tpl} +0 -0
  730. /package/templates/presets/identity/context/presentation/http/organisations/remove-member/{remove-member.controller.ts.tpl → remove-member.controller.kit-routes.ts.tpl} +0 -0
  731. /package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/{revoke-delegation.controller.ts.tpl → revoke-delegation.controller.kit-routes.ts.tpl} +0 -0
  732. /package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/{revoke-invitation.controller.ts.tpl → revoke-invitation.controller.kit-routes.ts.tpl} +0 -0
  733. /package/templates/presets/identity/context/presentation/http/organisations/search-members/{search-members.controller.ts.tpl → search-members.controller.kit-routes.ts.tpl} +0 -0
  734. /package/templates/presets/identity/context/test/unit/{accept-invitation.controller.spec.ts.tpl → accept-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  735. /package/templates/presets/identity/context/test/unit/{change-member-role.controller.spec.ts.tpl → change-member-role.controller.spec.kit-routes.ts.tpl} +0 -0
  736. /package/templates/presets/identity/context/test/unit/{deactivate-account.controller.spec.ts.tpl → deactivate-account.controller.spec.kit-routes.ts.tpl} +0 -0
  737. /package/templates/presets/identity/context/test/unit/{decline-invitation.controller.spec.ts.tpl → decline-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  738. /package/templates/presets/identity/context/test/unit/{grant-delegation.controller.spec.ts.tpl → grant-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
  739. /package/templates/presets/identity/context/test/unit/{invite-member.controller.spec.ts.tpl → invite-member.controller.spec.kit-routes.ts.tpl} +0 -0
  740. /package/templates/presets/identity/context/test/unit/{open-organisation.controller.spec.ts.tpl → open-organisation.controller.spec.kit-routes.ts.tpl} +0 -0
  741. /package/templates/presets/identity/context/test/unit/{provision-account.controller.spec.ts.tpl → provision-account.controller.spec.kit-routes.ts.tpl} +0 -0
  742. /package/templates/presets/identity/context/test/unit/{remove-member.controller.spec.ts.tpl → remove-member.controller.spec.kit-routes.ts.tpl} +0 -0
  743. /package/templates/presets/identity/context/test/unit/{revoke-delegation.controller.spec.ts.tpl → revoke-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
  744. /package/templates/presets/identity/context/test/unit/{revoke-invitation.controller.spec.ts.tpl → revoke-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  745. /package/templates/presets/identity/context/test/unit/{search-members.controller.spec.ts.tpl → search-members.controller.spec.kit-routes.ts.tpl} +0 -0
  746. /package/templates/presets/identity/context/test/worlds/{__context__.world.ts.tpl → __context__.world.declared.ts.tpl} +0 -0
@@ -21,24 +21,29 @@ describe('A bounded context is a deployable unit in waiting', () => {
21
21
  ).not.toThrow();
22
22
  });
23
23
 
24
- it.each(contexts)(
25
- '%s wires alone from its declarations, on the kernel and the platform, with no other context',
26
- (_name, module) => {
27
- expect(() =>
28
- createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
29
- ).not.toThrow();
30
- },
31
- );
24
+ // Jest refuses a table without rows: until the first context joins the project, its cases wait.
25
+ if (contexts.length === 0) {
26
+ it.todo('wires each context alone, with its scheduled jobs, once the project has one');
27
+ } else {
28
+ it.each(contexts)(
29
+ '%s wires alone from its declarations, on the kernel and the platform, with no other context',
30
+ (_name, module) => {
31
+ expect(() =>
32
+ createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
33
+ ).not.toThrow();
34
+ },
35
+ );
32
36
 
33
- it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
34
- const application = createTestApplication({
35
- modules: [platformTestModule, authorization, module],
36
- authorization: 'optional',
37
- });
37
+ it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
38
+ const application = createTestApplication({
39
+ modules: [platformTestModule, authorization, module],
40
+ authorization: 'optional',
41
+ });
38
42
 
39
- const jobs = application.describe().jobs.map((job) => job.name);
43
+ const jobs = application.describe().jobs.map((job) => job.name);
40
44
 
41
- expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
42
- expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
43
- });
45
+ expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
46
+ expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
47
+ });
48
+ }
44
49
  });
@@ -16,17 +16,22 @@ describe('A bounded context is a deployable unit in waiting', () => {
16
16
  expect(() => createPlatform(inertPersistence(), { events: inProcessEvents() })).not.toThrow();
17
17
  });
18
18
 
19
- it.each(contexts)('%s wires alone, on the platform, with no other context', (name, module) => {
20
- const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
19
+ // Jest refuses a table without rows: until the first context joins the project, its cases wait.
20
+ if (contexts.length === 0) {
21
+ it.todo('wires each context alone, with its scheduled jobs, once the project has one');
22
+ } else {
23
+ it.each(contexts)('%s wires alone, on the platform, with no other context', (name, module) => {
24
+ const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
21
25
 
22
- expect(module(platform).name).toBe(name);
23
- });
26
+ expect(module(platform).name).toBe(name);
27
+ });
24
28
 
25
- it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
26
- const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
29
+ it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
30
+ const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
27
31
 
28
- module(platform);
32
+ module(platform);
29
33
 
30
- expect(platform.jobs.describe().filter((job) => !job.name.startsWith(name + '.'))).toEqual([]);
31
- });
34
+ expect(platform.jobs.describe().filter((job) => !job.name.startsWith(name + '.'))).toEqual([]);
35
+ });
36
+ }
32
37
  });
@@ -21,21 +21,26 @@ describe('A bounded context is a deployable unit in waiting', () => {
21
21
  ).not.toThrow();
22
22
  });
23
23
 
24
- it.each(contexts)('%s wires alone, on the kernel and the platform, with no other context', (_name, module) => {
25
- expect(() =>
26
- createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
27
- ).not.toThrow();
28
- });
29
-
30
- it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
31
- const application = createTestApplication({
32
- modules: [platformTestModule, authorization, module],
33
- authorization: 'optional',
24
+ // Jest refuses a table without rows: until the first context joins the project, its cases wait.
25
+ if (contexts.length === 0) {
26
+ it.todo('wires each context alone, with its scheduled jobs, once the project has one');
27
+ } else {
28
+ it.each(contexts)('%s wires alone, on the kernel and the platform, with no other context', (_name, module) => {
29
+ expect(() =>
30
+ createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
31
+ ).not.toThrow();
34
32
  });
35
33
 
36
- const jobs = application.describe().jobs.map((job) => job.name);
34
+ it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
35
+ const application = createTestApplication({
36
+ modules: [platformTestModule, authorization, module],
37
+ authorization: 'optional',
38
+ });
37
39
 
38
- expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
39
- expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
40
- });
40
+ const jobs = application.describe().jobs.map((job) => job.name);
41
+
42
+ expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
43
+ expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
44
+ });
45
+ }
41
46
  });
@@ -1,4 +1,4 @@
1
1
  @@imports
2
2
  import { {{name.pascal}}BackgroundJob } from '{{alias.context}}/application/background/{{name.kebab}}.background-job{{alias.ext}}';
3
- @@registrations
3
+ @@jobs
4
4
  platform.backgroundJobs.register({{name.pascal}}BackgroundJob, [platform.commands]);
@@ -3,7 +3,7 @@
3
3
  {{access.permissionsImport}}
4
4
  import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
5
5
  import { {{name.pascal}}Handler } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.handler{{alias.ext}}';
6
- @@registrations
6
+ @@handlers
7
7
  {{#if command.hasAggregate}}
8
8
  platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler({{aggregate.camel}}Repository, platform.ids, platform.clock{{#if access.policy}}, platform.access{{/if}}), { context: '{{context.kebab}}' });
9
9
  {{/if}}
@@ -1,4 +1,8 @@
1
1
  import type { UseCaseDeclaration } from '@ddd-ts-kit/auth';
2
+ {{#if routes.nest}}
3
+ import type { Type } from '@nestjs/common';
4
+ import { {{context.camel}}Controllers } from '{{alias.context}}/{{context.kebab}}.controllers{{alias.ext}}';
5
+ {{/if}}
2
6
  {{#if http.any}}
3
7
  import type { Route } from '@ddd-ts-kit/http';
4
8
  {{/if}}
@@ -12,23 +16,61 @@ export interface {{context.pascal}}Wiring {
12
16
  {{#if http.any}}
13
17
  readonly routes: readonly Route[];
14
18
  {{/if}}
19
+ {{#if routes.nest}}
20
+ /** Its Nest controllers, listed by the generated `{{context.kebab}}.controllers.ts`: Nest builds them, the kit serves their methods. */
21
+ readonly controllers: readonly Type<unknown>[];
22
+ {{/if}}
15
23
  }
16
24
 
17
25
  export function {{context.camel}}Module(platform: Platform): {{context.pascal}}Wiring {
18
- // ddd-ts-kit:registrations
19
- // /ddd-ts-kit:registrations
26
+ registerHandlers(platform);
27
+ registerReactions(platform);
28
+ registerJobs(platform);
20
29
 
21
30
  return {
22
31
  name: '{{context.kebab}}',
23
- useCases: [
24
- // ddd-ts-kit:authorization
25
- // /ddd-ts-kit:authorization
26
- ],
32
+ useCases: declaredUseCases(),
27
33
  {{#if http.any}}
28
- routes: [
29
- // ddd-ts-kit:routes
30
- // /ddd-ts-kit:routes
31
- ],
34
+ routes: routesOf(platform),
35
+ {{/if}}
36
+ {{#if routes.nest}}
37
+ controllers: {{context.camel}}Controllers,
32
38
  {{/if}}
33
39
  };
34
40
  }
41
+
42
+ /** The command and query handlers of the context, with the repositories and readers they are given. */
43
+ function registerHandlers(platform: Platform): void {
44
+ // ddd-ts-kit:handlers
45
+ // /ddd-ts-kit:handlers
46
+ }
47
+
48
+ /** What the context does when an event happens: its own events and those of the other contexts. */
49
+ function registerReactions(platform: Platform): void {
50
+ // ddd-ts-kit:reactions
51
+ // /ddd-ts-kit:reactions
52
+ }
53
+
54
+ /** The jobs of the context, scheduled and in the background. */
55
+ function registerJobs(platform: Platform): void {
56
+ // ddd-ts-kit:jobs
57
+ // /ddd-ts-kit:jobs
58
+ }
59
+
60
+ /** What each use case requires, or that it is public. */
61
+ function declaredUseCases(): UseCaseDeclaration[] {
62
+ return [
63
+ // ddd-ts-kit:authorization
64
+ // /ddd-ts-kit:authorization
65
+ ];
66
+ }
67
+ {{#if http.any}}
68
+
69
+ /** The routes the context answers, over the buses of the platform. */
70
+ function routesOf(platform: Platform): Route[] {
71
+ return [
72
+ // ddd-ts-kit:routes
73
+ // /ddd-ts-kit:routes
74
+ ];
75
+ }
76
+ {{/if}}
@@ -8,7 +8,7 @@ import { on, subscribeAll } from '@ddd-ts-kit/events';
8
8
  import { dataSubjectErasedV1 } from '@ddd-ts-kit/kernel';
9
9
  import { {{personal.names.adapter}} } from '{{alias.context}}/infrastructure/persistence/{{personal.names.adapterKebab}}.repository{{alias.ext}}';
10
10
  import { DataSubjectErasedIntegrationHandler } from '{{alias.context}}/application/integration/handlers/data-subject-erased.integration-handler{{alias.ext}}';
11
- @@registrations
11
+ @@reactions
12
12
  const dataSubjectErasedIntegrationHandler = new DataSubjectErasedIntegrationHandler(platform.adapter(new {{personal.names.adapter}}(platform.persistence.database{{#if tenant.scoped}}, platform.scope{{/if}}), { kind: 'repository', context: '{{context.kebab}}', token: '{{personal.names.port}}' }));
13
13
 
14
14
  {{#if consumer.transactional}}
@@ -1,7 +1,7 @@
1
1
  @@imports
2
2
  import { {{handler.pascal}}EventHandler } from '{{alias.context}}/application/event-handlers/{{handler.kebab}}.event-handler{{alias.ext}}';
3
3
  import { {{event.pascal}} } from '{{alias.context}}/domain/events/{{event.kebab}}.event{{alias.ext}}';
4
- @@registrations
4
+ @@reactions
5
5
  const {{handler.camel}}EventHandler = platform.adapter(new {{handler.pascal}}EventHandler(), { kind: 'domain-event-handler', context: '{{context.kebab}}' });
6
6
 
7
7
  {{#if handler.afterCommit}}
@@ -3,7 +3,7 @@
3
3
  {{access.permissionsImport}}
4
4
  import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
5
5
  import { {{name.pascal}}Handler } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.handler{{alias.ext}}';
6
- @@registrations
6
+ @@handlers
7
7
  platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler(platform.files.staging), { context: '{{context.kebab}}' });
8
8
  @@authorization
9
9
  {{access.manualDeclaration}}
@@ -77,7 +77,7 @@ KAFKA_BROKERS=localhost:9092
77
77
  NATS_PORT=4222
78
78
  NATS_URL=nats://localhost:4222
79
79
  {{/if}}
80
- {{#if authn.jwt}}
80
+ {{#if authn.jwks}}
81
81
 
82
82
  # Authentication: the issuer of the tokens, the audience this service answers to, the keys of the issuer.
83
83
  AUTH_ISSUER=https://id.example.com/realms/app
@@ -0,0 +1,6 @@
1
+ /** What the configuration of the application needs to be valid in a test; no key is ever fetched. */
2
+ export const authEnvironment = {
3
+ AUTH_ISSUER: 'https://issuer.e2e.test',
4
+ AUTH_AUDIENCE: 'e2e',
5
+ AUTH_JWKS_URI: 'https://issuer.e2e.test/keys',
6
+ };
@@ -0,0 +1,47 @@
1
+ import type { Authenticator } from '@ddd-ts-kit/auth';
2
+ import { passportAuthenticator } from '@ddd-ts-kit/auth/passport';
3
+ import type { HttpHeaders } from '@ddd-ts-kit/testing/e2e';
4
+ import { SignJWT, exportSPKI, generateKeyPair, type CryptoKey } from 'jose';
5
+ import { actorOfToken } from '{{alias.platform}}/auth/authentication/actor-of-token{{alias.ext}}';
6
+ import { bearerStrategy } from '{{alias.platform}}/auth/authentication/bearer-strategy{{alias.ext}}';
7
+ import { authEnvironment } from '{{alias.test}}/e2e/support/auth-environment{{alias.ext}}';
8
+
9
+ const issuer = authEnvironment.AUTH_ISSUER;
10
+ const audience = authEnvironment.AUTH_AUDIENCE;
11
+
12
+ /** Who a test calls as: the subject, the roles and the tenant its token carries. */
13
+ export interface TestActor {
14
+ readonly id: string;
15
+ readonly roles?: readonly string[];
16
+ readonly tenantId?: string;
17
+ }
18
+
19
+ export interface Credentials {
20
+ /** The strategy of the platform, on a key pair made for this run: tokens are signed here, verified by the application. */
21
+ readonly authenticator: Authenticator;
22
+
23
+ headersOf(actor: TestActor): Promise<HttpHeaders>;
24
+ }
25
+
26
+ export async function createCredentials(): Promise<Credentials> {
27
+ const { publicKey, privateKey } = await generateKeyPair('RS256', { extractable: true });
28
+ const strategy = bearerStrategy({ issuer, audience, publicKey: await exportSPKI(publicKey) });
29
+
30
+ return {
31
+ authenticator: passportAuthenticator(strategy, { actorOf: actorOfToken }),
32
+ headersOf: async (actor) => ({ authorization: 'Bearer ' + (await tokenOf(actor, privateKey)) }),
33
+ };
34
+ }
35
+
36
+ function tokenOf(actor: TestActor, key: CryptoKey): Promise<string> {
37
+ const claims = { roles: actor.roles ?? [], ...(actor.tenantId === undefined ? {} : { tenant_id: actor.tenantId }) };
38
+
39
+ return new SignJWT(claims)
40
+ .setProtectedHeader({ alg: 'RS256' })
41
+ .setSubject(actor.id)
42
+ .setIssuer(issuer)
43
+ .setAudience(audience)
44
+ .setIssuedAt()
45
+ .setExpirationTime('5m')
46
+ .sign(key);
47
+ }
@@ -6,8 +6,14 @@ export default {
6
6
  // Jest does not read tsconfig: the import aliases of its "paths", repeated here, and held equal by `ddd-ts-kit check` (imports/alias-declared).
7
7
  moduleNameMapper: {
8
8
  {{alias.jestMapper}}
9
+ {{#if orm.prisma}}
10
+ // The client `prisma generate` writes names its own modules with `.js`: they are TypeScript sources, which Jest transforms.
11
+ '^(\\.{1,2}/.*)\\.js$': '$1',
12
+ {{/if}}
9
13
  },
10
14
  testMatch: ['<rootDir>/{{config.sourceRoot}}/**/*.spec.ts', '<rootDir>/test/architecture/**/*.spec.ts'],
15
+ // A hook opens the test database (PGlite started and its tables created, or a server reached): on a busy machine it outlasts the 5 seconds Jest gives a test and its hooks, as Vitest is given 60.
16
+ testTimeout: 60_000,
11
17
  // Each spec file is held to the time budget of its level ("budget" in ddd-ts-kit.config.json, the reference when it is absent): the slowest named at the end of the run, a file over its budget fails it.
12
18
  reporters: ['default', '@ddd-ts-kit/testing/budget/jest'],
13
19
  // A pull request names the contexts its change reaches (DDD_TS_KIT_AFFECTED, from `ddd-ts-kit affected`): the specs of the others are left to the default branch.
@@ -0,0 +1,15 @@
1
+ import { InvalidCredentialError, actorOfClaims } from '@ddd-ts-kit/auth';
2
+ import type { Actor } from '@ddd-ts-kit/kernel';
3
+
4
+ /**
5
+ * The actor the payload of a verified token stands for, as the kit reads claims: `sub`, the roles
6
+ * (`realm_access.roles`, `roles`, then `scope`), the tenant (`tenant_id`) and the profile. Change it
7
+ * here when the tokens of the issuer say these elsewhere.
8
+ */
9
+ export function actorOfToken(payload: unknown): Actor {
10
+ if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {
11
+ throw new InvalidCredentialError('NO_CLAIMS');
12
+ }
13
+
14
+ return actorOfClaims({ ...payload });
15
+ }
@@ -0,0 +1,29 @@
1
+ import { passportJwtSecret } from 'jwks-rsa';
2
+ import { ExtractJwt, Strategy } from 'passport-jwt';
3
+
4
+ /** Who issues the tokens and whom they are for, with where the keys that sign them are. */
5
+ export type BearerTokens = {
6
+ readonly issuer: string;
7
+ readonly audience: string;
8
+ } & ({ readonly jwksUri: string } | { readonly publicKey: string });
9
+
10
+ const ALGORITHMS = ['RS256', 'PS256', 'ES256'] as const;
11
+
12
+ /**
13
+ * The strategy of Passport that verifies a bearer token: its signature, against the key set the
14
+ * issuer publishes (or one public key, as the end-to-end tests sign with), its issuer, its
15
+ * audience, its expiry. It hands the payload on as the user; `actorOfToken` reads it.
16
+ */
17
+ export function bearerStrategy(tokens: BearerTokens): Strategy {
18
+ const verified = { jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), issuer: tokens.issuer, audience: tokens.audience, algorithms: [...ALGORITHMS] };
19
+ const handOn = (payload: unknown, done: (error: unknown, user?: unknown) => void): void => done(null, payload);
20
+
21
+ if ('publicKey' in tokens) {
22
+ return new Strategy({ ...verified, secretOrKey: tokens.publicKey }, handOn);
23
+ }
24
+
25
+ return new Strategy(
26
+ { ...verified, secretOrKeyProvider: passportJwtSecret({ jwksUri: tokens.jwksUri, cache: true, rateLimit: true }) },
27
+ handOn,
28
+ );
29
+ }
@@ -0,0 +1,13 @@
1
+ import type { Authenticator } from '@ddd-ts-kit/auth';
2
+ import { passportAuthenticator } from '@ddd-ts-kit/auth/passport';
3
+ import { actorOfToken } from '{{alias.platform}}/auth/authentication/actor-of-token{{alias.ext}}';
4
+ import { bearerStrategy } from '{{alias.platform}}/auth/authentication/bearer-strategy{{alias.ext}}';
5
+ import type { AppConfig } from '{{alias.platform}}/config/app-config{{alias.ext}}';
6
+
7
+ /**
8
+ * Verifies the bearer token with the strategy of Passport of the platform, against the keys the
9
+ * issuer publishes; the guards of the routes and the permissions of the use cases then decide.
10
+ */
11
+ export function createAuthenticator(config: AppConfig): Authenticator {
12
+ return passportAuthenticator(bearerStrategy(config.auth), { actorOf: actorOfToken });
13
+ }
@@ -9,7 +9,13 @@ import type { UseCaseDeclaration } from '@ddd-ts-kit/auth';
9
9
  import { subscribeAll } from '@ddd-ts-kit/events';
10
10
  {{/if}}
11
11
  {{#if http.any}}
12
- import { createErrorMapper, defineRoutes, type Route } from '@ddd-ts-kit/http';
12
+ import { defineRoutes, type Route } from '@ddd-ts-kit/http';
13
+ {{/if}}
14
+ {{#if routes.nest}}
15
+ import type { Type } from '@nestjs/common';
16
+ import { type NestControllers, nestControllers } from '@ddd-ts-kit/http/nest';
17
+ import { CommandBus, QueryBus } from '@ddd-ts-kit/kernel';
18
+ import { classSchema } from '@ddd-ts-kit/validation/class-validator';
13
19
  {{/if}}
14
20
  {{#if audit.archive}}
15
21
  import { ArchiveAuditEntries } from '@ddd-ts-kit/audit';
@@ -39,6 +45,9 @@ import { withForms } from '{{alias.platform}}/http/with-forms{{alias.ext}}';
39
45
  import { relateSystemActors } from '{{alias.platform}}/auth/relationships/relate-system-actors{{alias.ext}}';
40
46
  {{/if}}
41
47
  import { createPlatform } from '{{alias.platform}}/composition/create-platform{{alias.ext}}';
48
+ {{#if http.any}}
49
+ import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
50
+ {{/if}}
42
51
  import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
43
52
  {{#if files.http}}
44
53
  import { fileRoutes } from '{{alias.platform}}/files/file-routes{{alias.ext}}';
@@ -58,6 +67,10 @@ interface ContextWiring {
58
67
  {{#if http.any}}
59
68
  readonly routes: readonly Route[];
60
69
  {{/if}}
70
+ {{#if routes.nest}}
71
+ /** Its Nest controllers, which Nest builds and the kit serves. */
72
+ readonly controllers?: readonly Type<unknown>[];
73
+ {{/if}}
61
74
  }
62
75
 
63
76
  {{#if http.any}}
@@ -84,6 +97,10 @@ export interface Application {
84
97
  /** Authenticates every request and runs it inside the execution scope. */
85
98
  readonly boundary: HttpBoundary;
86
99
  {{/if}}
100
+ {{#if routes.nest}}
101
+ /** The Nest controllers of the contexts: their routes are among `routes`, Nest builds them with the buses they inject. */
102
+ readonly controllers: NestControllers;
103
+ {{/if}}
87
104
  {{#if files.http}}
88
105
  /** The routes that answer the signed links of a storage the application serves itself; mounted before any body parser. */
89
106
  readonly fileRoutes: readonly Route[];
@@ -136,6 +153,9 @@ export function composeApplication(
136
153
  {{/unless}}
137
154
 
138
155
  platform.protection.declare(contexts.flatMap((context) => context.useCases));
156
+ {{#if routes.nest}}
157
+ const controllers = controllersOf(contexts, platform);
158
+ {{/if}}
139
159
  {{#if presentation.any}}
140
160
  // What the server answers in and which fields each caller sees: the forms and the contract are given the same.
141
161
  const presentation = presentationOf(platform.access, clock);
@@ -144,15 +164,28 @@ export function composeApplication(
144
164
  return {
145
165
  {{#if http.any}}
146
166
  {{#if presentation.forms}}
167
+ {{#if routes.nest}}
168
+ routes: withForms(defineRoutes(...contexts.map((context) => context.routes), controllers.routes), presentation),
169
+ {{/if}}
170
+ {{#unless routes.nest}}
147
171
  routes: withForms(defineRoutes(...contexts.map((context) => context.routes)), presentation),
172
+ {{/unless}}
148
173
  {{/if}}
149
174
  {{#unless presentation.forms}}
175
+ {{#if routes.nest}}
176
+ routes: defineRoutes(...contexts.map((context) => context.routes), controllers.routes),
177
+ {{/if}}
178
+ {{#unless routes.nest}}
150
179
  routes: defineRoutes(...contexts.map((context) => context.routes)),
151
180
  {{/unless}}
181
+ {{/unless}}
182
+ {{#if routes.nest}}
183
+ controllers,
184
+ {{/if}}
152
185
  boundary: httpBoundary({
153
186
  authenticator: options.authenticator,
154
187
  executionScope: platform.scope,
155
- errorMapper: createErrorMapper(),
188
+ errorMapper: platformErrorMapper(),
156
189
  clock,
157
190
  logger,
158
191
  {{#if audit.on}}
@@ -290,3 +323,23 @@ function purgeExpiredEveryNight(platform: Platform): void {
290
323
  });
291
324
  }
292
325
  {{/if}}
326
+ {{#if routes.nest}}
327
+
328
+ /** The Nest controllers of the contexts: their routes now, their instances built by Nest when the server starts, with the buses of the platform. */
329
+ function controllersOf(contexts: readonly ContextWiring[], platform: Platform): NestControllers {
330
+ return nestControllers(
331
+ contexts.flatMap((context) => context.controllers ?? []),
332
+ {
333
+ providers: [
334
+ { provide: CommandBus, useValue: platform.commands },
335
+ { provide: QueryBus, useValue: platform.queries },
336
+ ],
337
+ // A DTO without a decorated field yet accepts the empty object alone: whitelist and forbidNonWhitelisted refuse any field.
338
+ schemaOfClass: (dto) => classSchema(dto, { validator: { forbidUnknownValues: false } }),
339
+ {{#if authn.none}}
340
+ security: ['developmentActor'],
341
+ {{/if}}
342
+ },
343
+ );
344
+ }
345
+ {{/if}}
@@ -114,7 +114,7 @@ export function layFoundations(persistence: Persistence, options: PlatformOption
114
114
  {{#unless audit.on}}
115
115
  decisions: logDecisions(logger),
116
116
  {{#if eventSourcing.on}}
117
- eventSourcing: createEventSourcing(persistence),
117
+ eventSourcing: createEventSourcing(persistence{{#if tenancy.any}}, scope{{/if}}),
118
118
  {{/if}}
119
119
  {{/unless}}
120
120
  };
@@ -83,7 +83,7 @@ export function layFoundations(persistence: Persistence, options: Observed): Fou
83
83
  {{#unless audit.on}}
84
84
  decisions: logDecisions(logger),
85
85
  {{#if eventSourcing.on}}
86
- eventSourcing: createEventSourcing(persistence),
86
+ eventSourcing: createEventSourcing(persistence{{#if tenancy.any}}, scope{{/if}}),
87
87
  {{/if}}
88
88
  {{/unless}}
89
89
  };
@@ -0,0 +1,9 @@
1
+ import { createErrorMapper, type ErrorMapper } from '@ddd-ts-kit/http';
2
+
3
+ /**
4
+ * What a refusal becomes on the wire. The application and the test platform bind this one mapper,
5
+ * so a route spec answers what the running application answers: map your own errors here, once.
6
+ */
7
+ export function platformErrorMapper(): ErrorMapper {
8
+ return createErrorMapper();
9
+ }
@@ -1,3 +1,6 @@
1
+ {{#if http.any}}
2
+ import { ErrorMapper } from '@ddd-ts-kit/http';
3
+ {{/if}}
1
4
  {{#if eventSourcing.on}}
2
5
  import { defineContextModule, type ModuleBuilder } from '@ddd-ts-kit/di';
3
6
  import {
@@ -21,6 +24,9 @@ import { defineContextModule } from '@ddd-ts-kit/di';
21
24
  import { InMemoryFileStorage } from '@ddd-ts-kit/kernel';
22
25
  {{/if}}
23
26
  {{/unless}}
27
+ {{#if http.any}}
28
+ import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
29
+ {{/if}}
24
30
  {{#if persistence.packagedToken}}
25
31
  import { {{persistence.token}} } from '{{persistence.tokenPackage}}';
26
32
  {{/if}}
@@ -42,6 +48,11 @@ export const platformTestModule = defineContextModule({
42
48
  throw new Error('A handler spec has no database: give a fake for the repository it uses.');
43
49
  });
44
50
 
51
+ {{/if}}
52
+ {{#if http.any}}
53
+ // The mapper of the application: a route spec answers what the running application answers.
54
+ builder.bind(ErrorMapper).toValue(platformErrorMapper());
55
+
45
56
  {{/if}}
46
57
  {{#if files.any}}
47
58
  // The files a handler spec stores stay in the memory of the test.
@@ -11,13 +11,16 @@ import { defineContextModule, type ContextModule } from '@ddd-ts-kit/di';
11
11
  import { OutboxStore } from '@ddd-ts-kit/events';
12
12
  {{/if}}
13
13
  {{#if http.any}}
14
- import { ErrorMapper, createErrorMapper } from '@ddd-ts-kit/http';
14
+ import { ErrorMapper } from '@ddd-ts-kit/http';
15
15
  {{/if}}
16
16
  {{#if cache.redis}}
17
17
  {{#if broker.external}}
18
18
  import {
19
19
  Cache,
20
20
  EventSubscribers,
21
+ {{#if queue.processTable}}
22
+ ExecutionScope,
23
+ {{/if}}
21
24
  Lock,
22
25
  Metrics,
23
26
  ProcessedEventStore,
@@ -35,6 +38,9 @@ import {
35
38
  {{#if errors.sentry}}
36
39
  import {
37
40
  Cache,
41
+ {{#if queue.processTable}}
42
+ ExecutionScope,
43
+ {{/if}}
38
44
  Lock,
39
45
  Metrics,
40
46
  ProcessedEventStore,
@@ -47,7 +53,7 @@ import {
47
53
  } from '@ddd-ts-kit/kernel';
48
54
  {{/if}}
49
55
  {{#unless errors.sentry}}
50
- import { Cache, Lock, Metrics, ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}RateLimiter, UnitOfWork } from '@ddd-ts-kit/kernel';
56
+ import { Cache, {{#if queue.processTable}}ExecutionScope, {{/if}}Lock, Metrics, ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}RateLimiter, UnitOfWork } from '@ddd-ts-kit/kernel';
51
57
  {{/unless}}
52
58
  {{/unless}}
53
59
  {{/if}}
@@ -56,7 +62,7 @@ import { {{#if broker.external}}EventSubscribers, {{/if}}ProcessedEventStore, Un
56
62
  {{/unless}}
57
63
  {{#unless cache.redis}}
58
64
  {{#if queue.processTable}}
59
- import { ProcessStore } from '@ddd-ts-kit/kernel';
65
+ import { ExecutionScope, ProcessStore } from '@ddd-ts-kit/kernel';
60
66
  {{/if}}
61
67
  {{/unless}}
62
68
  {{#if queue.redis}}
@@ -73,6 +79,9 @@ import { Database } from '{{alias.platform}}/database/database{{alias.ext}}';
73
79
  {{/if}}
74
80
  import type { ConsumerTrace } from '@ddd-ts-kit/tracing';
75
81
  import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
82
+ {{#if http.any}}
83
+ import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
84
+ {{/if}}
76
85
  import type { EventProvider } from '{{alias.platform}}/events/event-provider{{alias.ext}}';
77
86
  import type { LogSettings } from '{{alias.platform}}/observability/create-logger{{alias.ext}}';
78
87
  {{#if cache.redis}}
@@ -141,13 +150,13 @@ export function platformModule(persistence: Persistence, options: PlatformOption
141
150
  builder.rebind(JobStore).toValue(persistence.jobs);
142
151
  {{/if}}
143
152
  {{#if queue.processTable}}
144
- builder.rebind(ProcessStore).toValue(persistence.processes);
153
+ builder.rebind(ProcessStore).toFactory((resolve) => persistence.processes(resolve(ExecutionScope)));
145
154
  {{/if}}
146
155
  {{#if broker.external}}
147
156
  builder.rebind(EventSubscribers).toValue({ forContext: (name) => options.events.forConsumer(name) });
148
157
  {{/if}}
149
158
  {{#if http.any}}
150
- builder.bind(ErrorMapper).toValue(createErrorMapper());
159
+ builder.bind(ErrorMapper).toValue(platformErrorMapper());
151
160
  {{/if}}
152
161
  // Cross-cutting behaviour stays out of the contexts. Inside the span and the dispatch the kernel module puts around a binding, outside the aspects a binding states for itself (`ownPolicy`).
153
162
  builder.around(['external', 'gateway'], () => defaultPolicy(options.resilience ?? defaultResilienceSettings));