ddd-ts-kit 0.91.0 → 0.93.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 (484) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/README.fr.md +27 -18
  3. package/README.md +24 -15
  4. package/dist/acceptance/check-locked-files.d.ts +25 -0
  5. package/dist/acceptance/check-locked-files.d.ts.map +1 -0
  6. package/dist/acceptance/check-locked-files.js +84 -0
  7. package/dist/acceptance/check-locked-files.js.map +1 -0
  8. package/dist/acceptance/lock-acceptance.d.ts.map +1 -1
  9. package/dist/acceptance/lock-acceptance.js +2 -1
  10. package/dist/acceptance/lock-acceptance.js.map +1 -1
  11. package/dist/acceptance/scenarios-in.d.ts +4 -0
  12. package/dist/acceptance/scenarios-in.d.ts.map +1 -1
  13. package/dist/acceptance/scenarios-in.js +2 -2
  14. package/dist/acceptance/scenarios-in.js.map +1 -1
  15. package/dist/check/event-sourcing/read-stored-shape.d.ts +2 -0
  16. package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
  17. package/dist/check/event-sourcing/read-stored-shape.js +3 -1
  18. package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
  19. package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
  20. package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
  21. package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
  22. package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
  23. package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
  24. package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
  25. package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -1
  26. package/dist/check/fixtures/nest-controllers-fixtures.js +21 -3
  27. package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -1
  28. package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -1
  29. package/dist/check/nest/nest-equivalents-of.js +7 -2
  30. package/dist/check/nest/nest-equivalents-of.js.map +1 -1
  31. package/dist/check/rules/nest-controllers-current.d.ts.map +1 -1
  32. package/dist/check/rules/nest-controllers-current.js +13 -2
  33. package/dist/check/rules/nest-controllers-current.js.map +1 -1
  34. package/dist/commands/acceptance.d.ts.map +1 -1
  35. package/dist/commands/acceptance.js +14 -0
  36. package/dist/commands/acceptance.js.map +1 -1
  37. package/dist/commands/docs.d.ts.map +1 -1
  38. package/dist/commands/docs.js +13 -5
  39. package/dist/commands/docs.js.map +1 -1
  40. package/dist/commands/drizzle-generate.d.ts.map +1 -1
  41. package/dist/commands/drizzle-generate.js +21 -1
  42. package/dist/commands/drizzle-generate.js.map +1 -1
  43. package/dist/commands/generate.js +4 -0
  44. package/dist/commands/generate.js.map +1 -1
  45. package/dist/commands/prisma-generate.d.ts +7 -0
  46. package/dist/commands/prisma-generate.d.ts.map +1 -0
  47. package/dist/commands/prisma-generate.js +23 -0
  48. package/dist/commands/prisma-generate.js.map +1 -0
  49. package/dist/commands/typeorm-generate.d.ts +10 -0
  50. package/dist/commands/typeorm-generate.d.ts.map +1 -0
  51. package/dist/commands/typeorm-generate.js +37 -0
  52. package/dist/commands/typeorm-generate.js.map +1 -0
  53. package/dist/commit/run-git.d.ts +5 -1
  54. package/dist/commit/run-git.d.ts.map +1 -1
  55. package/dist/commit/run-git.js +19 -2
  56. package/dist/commit/run-git.js.map +1 -1
  57. package/dist/config/stack.d.ts +1 -1
  58. package/dist/config/stack.d.ts.map +1 -1
  59. package/dist/config/stack.js +1 -1
  60. package/dist/config/stack.js.map +1 -1
  61. package/dist/controllers/finish-migration.js +4 -2
  62. package/dist/controllers/finish-migration.js.map +1 -1
  63. package/dist/describe/guard-errors.d.ts +3 -0
  64. package/dist/describe/guard-errors.d.ts.map +1 -0
  65. package/dist/describe/guard-errors.js +10 -0
  66. package/dist/describe/guard-errors.js.map +1 -0
  67. package/dist/describe/no-group.d.ts +4 -0
  68. package/dist/describe/no-group.d.ts.map +1 -0
  69. package/dist/describe/no-group.js +3 -0
  70. package/dist/describe/no-group.js.map +1 -0
  71. package/dist/describe/read-controllers.d.ts +1 -1
  72. package/dist/describe/read-controllers.d.ts.map +1 -1
  73. package/dist/describe/read-controllers.js +12 -19
  74. package/dist/describe/read-controllers.js.map +1 -1
  75. package/dist/describe/read-nest-controller-routes.d.ts +16 -0
  76. package/dist/describe/read-nest-controller-routes.d.ts.map +1 -0
  77. package/dist/describe/read-nest-controller-routes.js +117 -0
  78. package/dist/describe/read-nest-controller-routes.js.map +1 -0
  79. package/dist/describe/schema-class-of.d.ts +3 -0
  80. package/dist/describe/schema-class-of.d.ts.map +1 -0
  81. package/dist/describe/schema-class-of.js +10 -0
  82. package/dist/describe/schema-class-of.js.map +1 -0
  83. package/dist/docs/behaviour-page.d.ts.map +1 -1
  84. package/dist/docs/behaviour-page.js +9 -1
  85. package/dist/docs/behaviour-page.js.map +1 -1
  86. package/dist/docs/declared-stored-events.d.ts +6 -2
  87. package/dist/docs/declared-stored-events.d.ts.map +1 -1
  88. package/dist/docs/declared-stored-events.js +4 -3
  89. package/dist/docs/declared-stored-events.js.map +1 -1
  90. package/dist/docs/emptily-recorded-stored-events.d.ts +6 -0
  91. package/dist/docs/emptily-recorded-stored-events.d.ts.map +1 -0
  92. package/dist/docs/emptily-recorded-stored-events.js +12 -0
  93. package/dist/docs/emptily-recorded-stored-events.js.map +1 -0
  94. package/dist/docs/refuse-unreadable-stored-events.d.ts +7 -0
  95. package/dist/docs/refuse-unreadable-stored-events.d.ts.map +1 -0
  96. package/dist/docs/refuse-unreadable-stored-events.js +27 -0
  97. package/dist/docs/refuse-unreadable-stored-events.js.map +1 -0
  98. package/dist/docs/write-stored-events-lock.d.ts +3 -2
  99. package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
  100. package/dist/docs/write-stored-events-lock.js +5 -2
  101. package/dist/docs/write-stored-events-lock.js.map +1 -1
  102. package/dist/generate/kind.d.ts +4 -0
  103. package/dist/generate/kind.d.ts.map +1 -1
  104. package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
  105. package/dist/generate/kinds/aggregate-kind.js +6 -2
  106. package/dist/generate/kinds/aggregate-kind.js.map +1 -1
  107. package/dist/generate/kinds/assert-event-store.d.ts +4 -0
  108. package/dist/generate/kinds/assert-event-store.d.ts.map +1 -0
  109. package/dist/generate/kinds/assert-event-store.js +10 -0
  110. package/dist/generate/kinds/assert-event-store.js.map +1 -0
  111. package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts +9 -0
  112. package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -0
  113. package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +49 -0
  114. package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -0
  115. package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
  116. package/dist/generate/kinds/file-upload-kind.js +9 -2
  117. package/dist/generate/kinds/file-upload-kind.js.map +1 -1
  118. package/dist/generate/kinds/form-kind.d.ts.map +1 -1
  119. package/dist/generate/kinds/form-kind.js +15 -11
  120. package/dist/generate/kinds/form-kind.js.map +1 -1
  121. package/dist/generate/kinds/generate-event-sourced-repository.d.ts +11 -0
  122. package/dist/generate/kinds/generate-event-sourced-repository.d.ts.map +1 -0
  123. package/dist/generate/kinds/generate-event-sourced-repository.js +48 -0
  124. package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -0
  125. package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
  126. package/dist/generate/kinds/generate-repository.js +5 -0
  127. package/dist/generate/kinds/generate-repository.js.map +1 -1
  128. package/dist/generate/kinds/is-event-sourced.d.ts +9 -0
  129. package/dist/generate/kinds/is-event-sourced.d.ts.map +1 -0
  130. package/dist/generate/kinds/is-event-sourced.js +11 -0
  131. package/dist/generate/kinds/is-event-sourced.js.map +1 -0
  132. package/dist/generate/kinds/job/job-vars.d.ts +4 -1
  133. package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
  134. package/dist/generate/kinds/job/job-vars.js +11 -1
  135. package/dist/generate/kinds/job/job-vars.js.map +1 -1
  136. package/dist/generate/kinds/job-kind.js +20 -3
  137. package/dist/generate/kinds/job-kind.js.map +1 -1
  138. package/dist/generate/kinds/presentation/controller-source.d.ts +11 -3
  139. package/dist/generate/kinds/presentation/controller-source.d.ts.map +1 -1
  140. package/dist/generate/kinds/presentation/controller-source.js +25 -4
  141. package/dist/generate/kinds/presentation/controller-source.js.map +1 -1
  142. package/dist/generate/kinds/repository-kind.js +1 -1
  143. package/dist/generate/kinds/repository-kind.js.map +1 -1
  144. package/dist/generate/kinds/representation-kind.d.ts.map +1 -1
  145. package/dist/generate/kinds/representation-kind.js +4 -3
  146. package/dist/generate/kinds/representation-kind.js.map +1 -1
  147. package/dist/generate/kinds/route/nest-controller-vars.d.ts +2 -2
  148. package/dist/generate/kinds/route/nest-controller-vars.js +3 -9
  149. package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -1
  150. package/dist/generate/kinds/route/nest-search-vars.d.ts +6 -0
  151. package/dist/generate/kinds/route/nest-search-vars.d.ts.map +1 -0
  152. package/dist/generate/kinds/route/nest-search-vars.js +18 -0
  153. package/dist/generate/kinds/route/nest-search-vars.js.map +1 -0
  154. package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -1
  155. package/dist/generate/kinds/route/write-nest-controller.js +6 -8
  156. package/dist/generate/kinds/route/write-nest-controller.js.map +1 -1
  157. package/dist/generate/kinds/route-kind.js +1 -1
  158. package/dist/generate/kinds/route-kind.js.map +1 -1
  159. package/dist/generate/kinds/service-kind.d.ts.map +1 -1
  160. package/dist/generate/kinds/service-kind.js +30 -3
  161. package/dist/generate/kinds/service-kind.js.map +1 -1
  162. package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -1
  163. package/dist/generate/kinds/wire-repository-on-first-use.js +2 -1
  164. package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -1
  165. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
  166. package/dist/generate/kinds/write-event-sourced-aggregate.js +5 -13
  167. package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
  168. package/dist/help/notes.d.ts +1 -1
  169. package/dist/help/notes.d.ts.map +1 -1
  170. package/dist/help/notes.js +3 -1
  171. package/dist/help/notes.js.map +1 -1
  172. package/dist/help/usage.d.ts +1 -1
  173. package/dist/help/usage.d.ts.map +1 -1
  174. package/dist/help/usage.js +3 -1
  175. package/dist/help/usage.js.map +1 -1
  176. package/dist/init/agent-permissions.js +10 -6
  177. package/dist/init/agent-permissions.js.map +1 -1
  178. package/dist/init/files/auth-files.js +4 -0
  179. package/dist/init/files/auth-files.js.map +1 -1
  180. package/dist/init/files/inert-persistence-file.d.ts +5 -0
  181. package/dist/init/files/inert-persistence-file.d.ts.map +1 -0
  182. package/dist/init/files/inert-persistence-file.js +16 -0
  183. package/dist/init/files/inert-persistence-file.js.map +1 -0
  184. package/dist/init/files/platform-files.js +7 -1
  185. package/dist/init/files/platform-files.js.map +1 -1
  186. package/dist/init/knip-vars.js +4 -3
  187. package/dist/init/knip-vars.js.map +1 -1
  188. package/dist/init/manifest/database-scripts.d.ts.map +1 -1
  189. package/dist/init/manifest/database-scripts.js +10 -4
  190. package/dist/init/manifest/database-scripts.js.map +1 -1
  191. package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
  192. package/dist/init/manifest/dependencies-against-stack.js +5 -1
  193. package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
  194. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  195. package/dist/init/manifest/dependencies-for.js +7 -1
  196. package/dist/init/manifest/dependencies-for.js.map +1 -1
  197. package/dist/init/manifest/versions.d.ts.map +1 -1
  198. package/dist/init/manifest/versions.js +34 -30
  199. package/dist/init/manifest/versions.js.map +1 -1
  200. package/dist/init/stack/resolve-stack.js +9 -7
  201. package/dist/init/stack/resolve-stack.js.map +1 -1
  202. package/dist/init/template-vars.js +1 -1
  203. package/dist/init/template-vars.js.map +1 -1
  204. package/dist/init/write-type-script-configs.d.ts.map +1 -1
  205. package/dist/init/write-type-script-configs.js +4 -1
  206. package/dist/init/write-type-script-configs.js.map +1 -1
  207. package/dist/markers/insert-in-region.js +1 -1
  208. package/dist/markers/insert-in-region.js.map +1 -1
  209. package/dist/measures/branch-commits.d.ts +4 -2
  210. package/dist/measures/branch-commits.d.ts.map +1 -1
  211. package/dist/measures/branch-commits.js +32 -8
  212. package/dist/measures/branch-commits.js.map +1 -1
  213. package/dist/measures/timeline-of.d.ts +3 -2
  214. package/dist/measures/timeline-of.d.ts.map +1 -1
  215. package/dist/measures/timeline-of.js +37 -8
  216. package/dist/measures/timeline-of.js.map +1 -1
  217. package/dist/merge/lost/untouched-by-branch.d.ts +12 -0
  218. package/dist/merge/lost/untouched-by-branch.d.ts.map +1 -0
  219. package/dist/merge/lost/untouched-by-branch.js +22 -0
  220. package/dist/merge/lost/untouched-by-branch.js.map +1 -0
  221. package/dist/merge/lost/verify-merge.d.ts.map +1 -1
  222. package/dist/merge/lost/verify-merge.js +6 -1
  223. package/dist/merge/lost/verify-merge.js.map +1 -1
  224. package/dist/migration/audit-guard/append-audit-guard.d.ts +18 -0
  225. package/dist/migration/audit-guard/append-audit-guard.d.ts.map +1 -0
  226. package/dist/migration/audit-guard/append-audit-guard.js +27 -0
  227. package/dist/migration/audit-guard/append-audit-guard.js.map +1 -0
  228. package/dist/migration/audit-guard/audit-guard-statements-of.d.ts +7 -0
  229. package/dist/migration/audit-guard/audit-guard-statements-of.d.ts.map +1 -0
  230. package/dist/migration/audit-guard/audit-guard-statements-of.js +18 -0
  231. package/dist/migration/audit-guard/audit-guard-statements-of.js.map +1 -0
  232. package/dist/migration/audit-guard/audit-schema-created.d.ts +3 -0
  233. package/dist/migration/audit-guard/audit-schema-created.d.ts.map +1 -0
  234. package/dist/migration/audit-guard/audit-schema-created.js +9 -0
  235. package/dist/migration/audit-guard/audit-schema-created.js.map +1 -0
  236. package/dist/migration/audit-guard/generate-guarded.d.ts +16 -0
  237. package/dist/migration/audit-guard/generate-guarded.d.ts.map +1 -0
  238. package/dist/migration/audit-guard/generate-guarded.js +22 -0
  239. package/dist/migration/audit-guard/generate-guarded.js.map +1 -0
  240. package/dist/migration/audit-guard/guard-marker.d.ts +3 -0
  241. package/dist/migration/audit-guard/guard-marker.d.ts.map +1 -0
  242. package/dist/migration/audit-guard/guard-marker.js +3 -0
  243. package/dist/migration/audit-guard/guard-marker.js.map +1 -0
  244. package/dist/migration/audit-guard/guarded-text.d.ts +5 -0
  245. package/dist/migration/audit-guard/guarded-text.d.ts.map +1 -0
  246. package/dist/migration/audit-guard/guarded-text.js +26 -0
  247. package/dist/migration/audit-guard/guarded-text.js.map +1 -0
  248. package/dist/migration/audit-guard/migrations-under.d.ts +3 -0
  249. package/dist/migration/audit-guard/migrations-under.d.ts.map +1 -0
  250. package/dist/migration/audit-guard/migrations-under.js +15 -0
  251. package/dist/migration/audit-guard/migrations-under.js.map +1 -0
  252. package/dist/migration/audit-guard/run-orm-tool.d.ts +3 -0
  253. package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -0
  254. package/dist/migration/audit-guard/run-orm-tool.js +13 -0
  255. package/dist/migration/audit-guard/run-orm-tool.js.map +1 -0
  256. package/dist/migration/audit-guard/schemas-first.d.ts +6 -0
  257. package/dist/migration/audit-guard/schemas-first.d.ts.map +1 -0
  258. package/dist/migration/audit-guard/schemas-first.js +17 -0
  259. package/dist/migration/audit-guard/schemas-first.js.map +1 -0
  260. package/dist/migration/audit-guard/schemas-if-missing.d.ts +7 -0
  261. package/dist/migration/audit-guard/schemas-if-missing.d.ts.map +1 -0
  262. package/dist/migration/audit-guard/schemas-if-missing.js +9 -0
  263. package/dist/migration/audit-guard/schemas-if-missing.js.map +1 -0
  264. package/dist/migration/audit-guard/type-only-imports.d.ts +6 -0
  265. package/dist/migration/audit-guard/type-only-imports.d.ts.map +1 -0
  266. package/dist/migration/audit-guard/type-only-imports.js +8 -0
  267. package/dist/migration/audit-guard/type-only-imports.js.map +1 -0
  268. package/dist/migration/format-as-the-project.d.ts +4 -0
  269. package/dist/migration/format-as-the-project.d.ts.map +1 -0
  270. package/dist/migration/format-as-the-project.js +27 -0
  271. package/dist/migration/format-as-the-project.js.map +1 -0
  272. package/dist/migration/format-written-files.d.ts.map +1 -1
  273. package/dist/migration/format-written-files.js +2 -24
  274. package/dist/migration/format-written-files.js.map +1 -1
  275. package/dist/migration/index.d.ts +8 -0
  276. package/dist/migration/index.d.ts.map +1 -1
  277. package/dist/migration/index.js +8 -0
  278. package/dist/migration/index.js.map +1 -1
  279. package/dist/nest-controllers/nest-answer.d.ts +2 -10
  280. package/dist/nest-controllers/nest-answer.d.ts.map +1 -1
  281. package/dist/nest-controllers/nest-controller-entry.d.ts +4 -2
  282. package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -1
  283. package/dist/nest-controllers/nest-controllers-in.d.ts +6 -0
  284. package/dist/nest-controllers/nest-controllers-in.d.ts.map +1 -0
  285. package/dist/nest-controllers/nest-controllers-in.js +108 -0
  286. package/dist/nest-controllers/nest-controllers-in.js.map +1 -0
  287. package/dist/nest-controllers/nest-read-type.d.ts +12 -0
  288. package/dist/nest-controllers/nest-read-type.d.ts.map +1 -0
  289. package/dist/nest-controllers/nest-read-type.js +2 -0
  290. package/dist/nest-controllers/nest-read-type.js.map +1 -0
  291. package/dist/nest-controllers/nest-request-part.d.ts +9 -0
  292. package/dist/nest-controllers/nest-request-part.d.ts.map +1 -0
  293. package/dist/nest-controllers/nest-request-part.js +2 -0
  294. package/dist/nest-controllers/nest-request-part.js.map +1 -0
  295. package/dist/nest-controllers/parameters-of.d.ts +8 -0
  296. package/dist/nest-controllers/parameters-of.d.ts.map +1 -0
  297. package/dist/nest-controllers/parameters-of.js +32 -0
  298. package/dist/nest-controllers/parameters-of.js.map +1 -0
  299. package/dist/nest-controllers/project-files.d.ts +6 -0
  300. package/dist/nest-controllers/project-files.d.ts.map +1 -0
  301. package/dist/nest-controllers/project-files.js +2 -0
  302. package/dist/nest-controllers/project-files.js.map +1 -0
  303. package/dist/nest-controllers/read-nest-controllers.d.ts +6 -9
  304. package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -1
  305. package/dist/nest-controllers/read-nest-controllers.js +10 -82
  306. package/dist/nest-controllers/read-nest-controllers.js.map +1 -1
  307. package/dist/nest-controllers/render-controllers-file.d.ts +4 -3
  308. package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -1
  309. package/dist/nest-controllers/render-controllers-file.js +45 -29
  310. package/dist/nest-controllers/render-controllers-file.js.map +1 -1
  311. package/dist/platform-layout/platform-layout.d.ts +5 -0
  312. package/dist/platform-layout/platform-layout.d.ts.map +1 -1
  313. package/dist/platform-layout/platform-layout.js +5 -0
  314. package/dist/platform-layout/platform-layout.js.map +1 -1
  315. package/dist/presets/identity-refusal.js +3 -3
  316. package/dist/presets/identity-refusal.js.map +1 -1
  317. package/dist/presets/no-flags.d.ts.map +1 -1
  318. package/dist/presets/no-flags.js +1 -0
  319. package/dist/presets/no-flags.js.map +1 -1
  320. package/dist/presets/preset-files.d.ts.map +1 -1
  321. package/dist/presets/preset-files.js +3 -1
  322. package/dist/presets/preset-files.js.map +1 -1
  323. package/dist/progress/build-next-of.d.ts +9 -0
  324. package/dist/progress/build-next-of.d.ts.map +1 -0
  325. package/dist/progress/build-next-of.js +22 -0
  326. package/dist/progress/build-next-of.js.map +1 -0
  327. package/dist/progress/format-progress.d.ts.map +1 -1
  328. package/dist/progress/format-progress.js +3 -0
  329. package/dist/progress/format-progress.js.map +1 -1
  330. package/dist/progress/progress.d.ts +3 -1
  331. package/dist/progress/progress.d.ts.map +1 -1
  332. package/dist/progress/read-progress.d.ts.map +1 -1
  333. package/dist/progress/read-progress.js +7 -2
  334. package/dist/progress/read-progress.js.map +1 -1
  335. package/dist/run.d.ts.map +1 -1
  336. package/dist/run.js +4 -0
  337. package/dist/run.js.map +1 -1
  338. package/dist/stack/authentication-vars.d.ts.map +1 -1
  339. package/dist/stack/authentication-vars.js +8 -2
  340. package/dist/stack/authentication-vars.js.map +1 -1
  341. package/dist/version.d.ts +1 -1
  342. package/dist/version.js +1 -1
  343. package/dist/worker/briefing-of.d.ts.map +1 -1
  344. package/dist/worker/briefing-of.js +2 -4
  345. package/dist/worker/briefing-of.js.map +1 -1
  346. package/dist/worker/resume-message.d.ts.map +1 -1
  347. package/dist/worker/resume-message.js +1 -2
  348. package/dist/worker/resume-message.js.map +1 -1
  349. package/package.json +6 -4
  350. package/templates/architecture/extractable.declared.spec.ts.tpl +2 -2
  351. package/templates/architecture/extractable.manual.spec.ts.tpl +2 -2
  352. package/templates/architecture/extractable.tsyringe.spec.ts.tpl +2 -2
  353. package/templates/architecture/hosting.declared.spec.ts.tpl +69 -0
  354. package/templates/architecture/hosting.manual.spec.ts.tpl +57 -0
  355. package/templates/architecture/hosting.tsyringe.spec.ts.tpl +69 -0
  356. package/templates/background-job/wiring.manual.tpl +1 -1
  357. package/templates/command/wiring.manual.tpl +1 -1
  358. package/templates/context/module.manual.ts.tpl +41 -10
  359. package/templates/erasure-handler/wiring.manual.tpl +1 -1
  360. package/templates/event-handler/wiring.manual.tpl +1 -1
  361. package/templates/file-upload/wiring.manual.tpl +1 -1
  362. package/templates/init/docker/env.example.tpl +9 -1
  363. package/templates/init/e2e/auth-environment.passport.ts.tpl +6 -0
  364. package/templates/init/e2e/create-credentials.passport.ts.tpl +47 -0
  365. package/templates/init/gitignore.tpl +3 -0
  366. package/templates/init/main.ts.tpl +27 -20
  367. package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +11 -3
  368. package/templates/init/platform/auth/authentication/actor-of-token.ts.tpl +15 -0
  369. package/templates/init/platform/auth/authentication/bearer-strategy.ts.tpl +29 -0
  370. package/templates/init/platform/auth/authentication/create-authenticator.passport.ts.tpl +13 -0
  371. package/templates/init/platform/composition/compose-application.manual.ts.tpl +30 -6
  372. package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +47 -65
  373. package/templates/init/platform/composition/context-selection.tsyringe.ts.tpl +17 -0
  374. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +16 -1
  375. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
  376. package/templates/init/platform/composition/platform-error-mapper.ts.tpl +9 -0
  377. package/templates/init/platform/composition/platform-options.manual.ts.tpl +9 -0
  378. package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +11 -0
  379. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +5 -2
  380. package/templates/init/platform/composition/routes-of.tsyringe.ts.tpl +51 -0
  381. package/templates/init/platform/config/app-config.ts.tpl +9 -2
  382. package/templates/init/platform/config/load-config.ts.tpl +27 -2
  383. package/templates/init/platform/database/open-persistence.memory.ts.tpl +10 -0
  384. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +5 -0
  385. package/templates/init/platform/database/persistence-over.knex.ts.tpl +5 -0
  386. package/templates/init/platform/database/persistence-over.prisma.ts.tpl +5 -0
  387. package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +5 -0
  388. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +18 -0
  389. package/templates/init/platform/database/persistence.memory.ts.tpl +7 -1
  390. package/templates/init/platform/database/persistence.orm.ts.tpl +9 -1
  391. package/templates/init/platform/database/schema.drizzle.ts.tpl +11 -1
  392. package/templates/init/platform/database/schema.prisma.tpl +2 -1
  393. package/templates/init/platform/database/schema.typeorm.ts.tpl +1 -1
  394. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +18 -6
  395. package/templates/init/platform/files/files.module.tsyringe.ts.tpl +6 -2
  396. package/templates/init/platform/http/start-http-server.express.ts.tpl +10 -1
  397. package/templates/init/platform/http/start-http-server.nest.ts.tpl +6 -1
  398. package/templates/init/platform/jobs/job-settings.ts.tpl +13 -3
  399. package/templates/init/platform/privacy/privacy.module.tsyringe.ts.tpl +9 -6
  400. package/templates/init/platform/redis/open-redis.ts.tpl +13 -8
  401. package/templates/init/rules/presentation.md.tpl +1 -1
  402. package/templates/integration-event/wiring.manual.tpl +1 -1
  403. package/templates/integration-handler/wiring.manual.tpl +1 -1
  404. package/templates/job/job.declared.ts.tpl +1 -1
  405. package/templates/job/job.spec.buses.ts.tpl +3 -0
  406. package/templates/job/job.spec.tsyringe.ts.tpl +29 -1
  407. package/templates/job/wiring.manual.tpl +4 -1
  408. package/templates/job/wiring.tsyringe.tpl +1 -1
  409. package/templates/nest-controller/controller.search.ts.tpl +38 -0
  410. package/templates/nest-controller/controller.ts.tpl +1 -17
  411. package/templates/nest-controller/upload.spec.ts.tpl +47 -0
  412. package/templates/nest-controller/upload.ts.tpl +25 -0
  413. package/templates/pipeline/biome.json.tpl +9 -2
  414. package/templates/pipeline/eslint.config.mjs.tpl +6 -0
  415. package/templates/pipeline/knip.json.tpl +1 -0
  416. package/templates/pipeline/package-scripts.json +2 -2
  417. package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +17 -0
  418. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.nest-routes.ts.tpl +31 -0
  419. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.nest-routes.ts.tpl +44 -0
  420. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.nest-routes.ts.tpl +56 -0
  421. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.nest-routes.ts.tpl +54 -0
  422. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.nest-routes.ts.tpl +32 -0
  423. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.nest-routes.ts.tpl +43 -0
  424. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.nest-routes.ts.tpl +25 -0
  425. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.nest-routes.ts.tpl +37 -0
  426. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.nest-routes.ts.tpl +31 -0
  427. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.nest-routes.ts.tpl +31 -0
  428. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.nest-routes.ts.tpl +31 -0
  429. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.nest-routes.ts.tpl +42 -0
  430. package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +1 -1
  431. package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +13 -0
  432. package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.nest-routes.ts.tpl +70 -0
  433. package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.nest-routes.ts.tpl +70 -0
  434. package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.nest-routes.ts.tpl +57 -0
  435. package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.nest-routes.ts.tpl +70 -0
  436. package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.nest-routes.ts.tpl +70 -0
  437. package/templates/presets/identity/context/test/unit/invite-member.controller.spec.nest-routes.ts.tpl +70 -0
  438. package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.nest-routes.ts.tpl +70 -0
  439. package/templates/presets/identity/context/test/unit/provision-account.controller.spec.nest-routes.ts.tpl +99 -0
  440. package/templates/presets/identity/context/test/unit/remove-member.controller.spec.nest-routes.ts.tpl +57 -0
  441. package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.nest-routes.ts.tpl +57 -0
  442. package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.nest-routes.ts.tpl +57 -0
  443. package/templates/presets/identity/context/test/unit/search-members.controller.spec.nest-routes.ts.tpl +54 -0
  444. package/templates/process/timeout-job.wiring.manual.tpl +1 -1
  445. package/templates/query/search.wiring.manual.tpl +1 -1
  446. package/templates/query/wiring.manual.tpl +1 -1
  447. package/templates/repository/contract.spec.ts.tpl +1 -3
  448. package/templates/repository/event-sourced/contract.spec.ts.tpl +36 -0
  449. package/templates/repository/event-sourced/fake.ts.tpl +24 -0
  450. package/templates/repository/event-sourced/repository.ts.tpl +38 -0
  451. package/templates/repository/event-sourced-first-use.wiring.manual.tpl +4 -0
  452. package/templates/repository/event-sourced.wiring.tsyringe.tpl +6 -0
  453. package/templates/repository/first-use.wiring.manual.tpl +1 -1
  454. package/templates/service/compose.tpl +1 -1
  455. package/templates/service/extracted-name.tpl +2 -0
  456. package/templates/service/extracted.declared.tpl +6 -0
  457. package/templates/service/extracted.manual.tpl +2 -0
  458. package/templates/service/extracted.tsyringe.tpl +6 -0
  459. package/templates/service/main.ts.tpl +5 -1
  460. package/templates/worker/main.ts.tpl +20 -13
  461. /package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/{deactivate-account.controller.ts.tpl → deactivate-account.controller.kit-routes.ts.tpl} +0 -0
  462. /package/templates/presets/identity/context/presentation/http/accounts/provision-account/{provision-account.controller.ts.tpl → provision-account.controller.kit-routes.ts.tpl} +0 -0
  463. /package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/{accept-invitation.controller.ts.tpl → accept-invitation.controller.kit-routes.ts.tpl} +0 -0
  464. /package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/{decline-invitation.controller.ts.tpl → decline-invitation.controller.kit-routes.ts.tpl} +0 -0
  465. /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
  466. /package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/{grant-delegation.controller.ts.tpl → grant-delegation.controller.kit-routes.ts.tpl} +0 -0
  467. /package/templates/presets/identity/context/presentation/http/organisations/invite-member/{invite-member.controller.ts.tpl → invite-member.controller.kit-routes.ts.tpl} +0 -0
  468. /package/templates/presets/identity/context/presentation/http/organisations/open-organisation/{open-organisation.controller.ts.tpl → open-organisation.controller.kit-routes.ts.tpl} +0 -0
  469. /package/templates/presets/identity/context/presentation/http/organisations/remove-member/{remove-member.controller.ts.tpl → remove-member.controller.kit-routes.ts.tpl} +0 -0
  470. /package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/{revoke-delegation.controller.ts.tpl → revoke-delegation.controller.kit-routes.ts.tpl} +0 -0
  471. /package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/{revoke-invitation.controller.ts.tpl → revoke-invitation.controller.kit-routes.ts.tpl} +0 -0
  472. /package/templates/presets/identity/context/presentation/http/organisations/search-members/{search-members.controller.ts.tpl → search-members.controller.kit-routes.ts.tpl} +0 -0
  473. /package/templates/presets/identity/context/test/unit/{accept-invitation.controller.spec.ts.tpl → accept-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  474. /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
  475. /package/templates/presets/identity/context/test/unit/{deactivate-account.controller.spec.ts.tpl → deactivate-account.controller.spec.kit-routes.ts.tpl} +0 -0
  476. /package/templates/presets/identity/context/test/unit/{decline-invitation.controller.spec.ts.tpl → decline-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  477. /package/templates/presets/identity/context/test/unit/{grant-delegation.controller.spec.ts.tpl → grant-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
  478. /package/templates/presets/identity/context/test/unit/{invite-member.controller.spec.ts.tpl → invite-member.controller.spec.kit-routes.ts.tpl} +0 -0
  479. /package/templates/presets/identity/context/test/unit/{open-organisation.controller.spec.ts.tpl → open-organisation.controller.spec.kit-routes.ts.tpl} +0 -0
  480. /package/templates/presets/identity/context/test/unit/{provision-account.controller.spec.ts.tpl → provision-account.controller.spec.kit-routes.ts.tpl} +0 -0
  481. /package/templates/presets/identity/context/test/unit/{remove-member.controller.spec.ts.tpl → remove-member.controller.spec.kit-routes.ts.tpl} +0 -0
  482. /package/templates/presets/identity/context/test/unit/{revoke-delegation.controller.spec.ts.tpl → revoke-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
  483. /package/templates/presets/identity/context/test/unit/{revoke-invitation.controller.spec.ts.tpl → revoke-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
  484. /package/templates/presets/identity/context/test/unit/{search-members.controller.spec.ts.tpl → search-members.controller.spec.kit-routes.ts.tpl} +0 -0
@@ -17,8 +17,8 @@ import { platformPath } from '../platform-path.js';
17
17
  export const jobKind = {
18
18
  name: 'job',
19
19
  aliases: [],
20
- usage: 'job <context> <Name> (--every <duration> | --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--term "<Term>=<meaning>"]...',
21
- summary: 'A job run by time that sends one command as its own system actor, its spec, its registration, its switch in the job settings of the platform and, where the authorization model makes it one line, the grant of that actor.',
20
+ usage: 'job <context> <Name> (--every <duration> | --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--global] [--term "<Term>=<meaning>"]...',
21
+ summary: 'A job run by time (once per tenant under tenancy, or `--global`) that sends one command as its own system actor, its spec, its registration, its switch in the job settings of the platform and, where the authorization model makes it one line, the grant of that actor.',
22
22
  positionals: ['context', 'Name'],
23
23
  writesShared: true,
24
24
  textFlags: ['command'],
@@ -31,11 +31,28 @@ export const jobKind = {
31
31
  const context = vars(scope, {
32
32
  name: named(name),
33
33
  spec: specVars(scope, { protected: false }),
34
- job: jobVars(scope, { name, schedule, command }),
34
+ job: jobVars(scope, { name, schedule, command, tenancy: tenancyOf(scope, name) }),
35
35
  });
36
36
  writeJob(scope, name, context);
37
37
  },
38
38
  };
39
+ /**
40
+ * Under tenancy a job runs once per tenant unless `--global` says it works across them: a global job
41
+ * runs in no tenant, and a tenant-scoped repository refuses to be read there.
42
+ */
43
+ function tenancyOf(scope, name) {
44
+ const { global } = scope.flags;
45
+ if (scope.config.stack.tenancy === 'none') {
46
+ if (global) {
47
+ throw new CliError('--global means nothing in a project without tenancy.', `Every job runs once there: drop --global from \`generate job ${scope.context.kebab} ${name.pascal}\`.`);
48
+ }
49
+ return undefined;
50
+ }
51
+ scope.ws.note(global
52
+ ? `${name.pascal}Job is global (\`tenancy: 'global'\`): it runs once per occurrence, in no tenant, so a tenant-scoped repository refuses it. Drop --global for a job that works one tenant at a time.`
53
+ : `${name.pascal}Job runs per tenant (\`tenancy: 'per-tenant'\`): once per tenant of the TenantDirectory (TENANTS) for each occurrence, each run in the scope of its tenant. Pass --global for work across tenants.`);
54
+ return global ? 'global' : 'per-tenant';
55
+ }
39
56
  function commandNamed(scope, name) {
40
57
  const { commandName } = scope.flags;
41
58
  if (commandName !== undefined && commandName.trim() !== '') {
@@ -1 +1 @@
1
- {"version":3,"file":"job-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/job-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,OAAO,GAAS;IAC3B,IAAI,EAA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CAChB,wBAAwB,EACxB,oGAAoG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,yCAAyC,CAChL,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAY,EAAE,IAAU,EAAE,OAAsB;IAChE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;QACnB,CAAC,gBAAgB,EAAE,0BAA0B,IAAI,CAAC,KAAK,SAAS,CAAC;QACjE;YACE,gBAAgB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,SAAS;YACpF,aAAa,IAAI,CAAC,KAAK,cAAc;SACtC;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5B,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,KAAK,EAAE,sBAAsB,CAAC,EAAE,cAAc,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC"}
@@ -1,13 +1,21 @@
1
1
  /**
2
2
  * Edits of the source of a controller written by the generator, which keep its shape: one more
3
- * name in an import, one more option of `@Controller`, a declaration before the class.
3
+ * name in an import, one more option of `@Controller` (of `@KitRoute` of its method, for a Nest
4
+ * controller), a declaration before the class.
4
5
  */
5
6
  export declare const controllerSource: {
6
7
  /** Adds `name` (`type Name` for a type) to the import of `module`, or a new import line after the last one. */
7
8
  withImport(source: string, name: string, module: string): string;
8
- /** Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation. */
9
+ /** Whether it is a Nest controller the kit serves: its options are those of `@KitRoute` of its method. */
10
+ isNest(source: string): boolean;
11
+ /** The DTO class of the body a Nest controller takes whole (`@Body() body: IssueInvoiceBody`), if it takes one. */
12
+ nestBody(source: string): string | undefined;
13
+ /**
14
+ * Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation; to a
15
+ * Nest controller, at the top of `@KitRoute({ ... })` of its method.
16
+ */
9
17
  withOption(source: string, line: string): string;
10
- /** Puts a declaration right before the decorator of the class. */
18
+ /** Puts a declaration right before the decorator of the class, and before the comment that documents the class. */
11
19
  beforeController(source: string, declaration: string): string;
12
20
  };
13
21
  //# sourceMappingURL=controller-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller-source.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,+GAA+G;IAC/G,UAAU,SAAS,MAAM,QAAQ,MAAM,UAAU,MAAM,GAAG,MAAM;IAoChE,gGAAgG;IAChG,UAAU,SAAS,MAAM,QAAQ,MAAM,GAAG,MAAM;IAYhD,kEAAkE;IAClE,gBAAgB,SAAS,MAAM,eAAe,MAAM,GAAG,MAAM;CAK9D,CAAC"}
1
+ {"version":3,"file":"controller-source.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IAC3B,+GAA+G;IAC/G,UAAU,SAAS,MAAM,QAAQ,MAAM,UAAU,MAAM,GAAG,MAAM;IAoChE,0GAA0G;IAC1G,MAAM,SAAS,MAAM,GAAG,OAAO;IAI/B,mHAAmH;IACnH,QAAQ,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS;IAI5C;;;OAGG;IACH,UAAU,SAAS,MAAM,QAAQ,MAAM,GAAG,MAAM;IAoBhD,mHAAmH;IACnH,gBAAgB,SAAS,MAAM,eAAe,MAAM,GAAG,MAAM;CAO9D,CAAC"}
@@ -1,6 +1,9 @@
1
+ const NEST_ROUTE = /^([ \t]*)@KitRoute\(\{[ \t]*$/m;
2
+ const NEST_BODY = /@Body\(\)\s+(?:readonly\s+)?[\w$]+\s*:\s*([\w$]+)/;
1
3
  /**
2
4
  * Edits of the source of a controller written by the generator, which keep its shape: one more
3
- * name in an import, one more option of `@Controller`, a declaration before the class.
5
+ * name in an import, one more option of `@Controller` (of `@KitRoute` of its method, for a Nest
6
+ * controller), a declaration before the class.
4
7
  */
5
8
  export const controllerSource = {
6
9
  /** Adds `name` (`type Name` for a type) to the import of `module`, or a new import line after the last one. */
@@ -26,8 +29,24 @@ export const controllerSource = {
26
29
  const types = added.filter((part) => part.startsWith('type ')).sort();
27
30
  return source.replace(written[0], `import ${typeOnly ? 'type ' : ''}{ ${[...values, ...types].join(', ')} } from '${module}';`);
28
31
  },
29
- /** Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation. */
32
+ /** Whether it is a Nest controller the kit serves: its options are those of `@KitRoute` of its method. */
33
+ isNest(source) {
34
+ return source.includes("from '@ddd-ts-kit/http/nest'");
35
+ },
36
+ /** The DTO class of the body a Nest controller takes whole (`@Body() body: IssueInvoiceBody`), if it takes one. */
37
+ nestBody(source) {
38
+ return NEST_BODY.exec(source)?.[1];
39
+ },
40
+ /**
41
+ * Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation; to a
42
+ * Nest controller, at the top of `@KitRoute({ ... })` of its method.
43
+ */
30
44
  withOption(source, line) {
45
+ const route = NEST_ROUTE.exec(source);
46
+ if (route !== null) {
47
+ const end = route.index + route[0].length;
48
+ return `${source.slice(0, end)}\n${route[1] ?? ''} ${line}${source.slice(end)}`;
49
+ }
31
50
  const summary = /^(\s*)summary:.*$/m.exec(source);
32
51
  if (summary === null) {
33
52
  return source;
@@ -35,9 +54,11 @@ export const controllerSource = {
35
54
  const end = summary.index + summary[0].length;
36
55
  return `${source.slice(0, end)}\n${summary[1] ?? ''}${line}${source.slice(end)}`;
37
56
  },
38
- /** Puts a declaration right before the decorator of the class. */
57
+ /** Puts a declaration right before the decorator of the class, and before the comment that documents the class. */
39
58
  beforeController(source, declaration) {
40
- const at = source.indexOf('@Controller(');
59
+ const decorator = source.indexOf('@Controller(');
60
+ const documented = /\/\*\*(?:(?!\*\/)[\s\S])*\*\/\s*$/.exec(source.slice(0, decorator));
61
+ const at = documented === null ? decorator : documented.index;
41
62
  return `${source.slice(0, at)}${declaration}\n${source.slice(at)}`;
42
63
  },
43
64
  };
@@ -1 +1 @@
1
- {"version":3,"file":"controller-source.js","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,+GAA+G;IAC/G,UAAU,CAAC,MAAc,EAAE,IAAY,EAAE,MAAc;QACrD,MAAM,OAAO,GAAG,IAAI,MAAM,CACxB,MAAM,CAAC,GAAG,CAAA,4CAA4C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CACxF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,UAAU,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,MAAM,EAAE,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;YAEtF,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAEzD,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,QAAQ,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9H,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAC7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,MAAc,EAAE,IAAY;QACrC,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAE9C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IACnF,CAAC;IAED,kEAAkE;IAClE,gBAAgB,CAAC,MAAc,EAAE,WAAmB;QAClD,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAE1C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACrE,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"controller-source.js","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,MAAM,SAAS,GAAG,mDAAmD,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,+GAA+G;IAC/G,UAAU,CAAC,MAAc,EAAE,IAAY,EAAE,MAAc;QACrD,MAAM,OAAO,GAAG,IAAI,MAAM,CACxB,MAAM,CAAC,GAAG,CAAA,4CAA4C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CACxF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,UAAU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I,EAAE,KAAK,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACnF,CAAC;QAED,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAE9C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IACnF,CAAC;IAED,mHAAmH;IACnH,gBAAgB,CAAC,MAAc,EAAE,WAAmB;QAClD,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,mCAAmC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QACxF,MAAM,EAAE,GAAG,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QAE9D,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACrE,CAAC;CACF,CAAC"}
@@ -6,7 +6,7 @@ export const repositoryKind = {
6
6
  name: 'repository',
7
7
  aliases: [],
8
8
  usage: 'repository <context> <Aggregate> [--tenant-scoped] [--personal <column>,<column>... [--subject <column>] [--erasure pseudonymise|row] [--retention <column>:<n><d|m|y>]]',
9
- summary: "A repository port (an abstract class of the domain), its in-memory fake, the adapter of the project's ORM with its mapper, the contract suite both pass, and its registration; with --personal, the declaration of the personal columns of its table, and the erasure and the export of the context that read it, and with --retention how long the rows keep it before the nightly purge erases them.",
9
+ summary: "A repository port (an abstract class of the domain), its in-memory fake, the adapter of the project's ORM with its mapper, the contract suite both pass, and its registration; on an event-sourced aggregate, the adapter over EventSourcedRepository with the codec of its stored events, no table; with --personal, the declaration of the personal columns of its table, and the erasure and the export of the context that read it, and with --retention how long the rows keep it before the nightly purge erases them.",
10
10
  positionals: ['context', 'Aggregate'],
11
11
  writesShared: true,
12
12
  run: (request) => {
@@ -1 +1 @@
1
- {"version":3,"file":"repository-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/repository-kind.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,EAAE;IACX,KAAK,EACH,0KAA0K;IAC5K,OAAO,EACL,wYAAwY;IAC1Y,WAAW,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;IACrC,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAEjC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAErD,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"repository-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/repository-kind.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,EAAE;IACX,KAAK,EACH,0KAA0K;IAC5K,OAAO,EACL,8fAA8f;IAChgB,WAAW,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;IACrC,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAEjC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAErD,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"representation-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAUpC,eAAO,MAAM,kBAAkB,EAAE,IAkChC,CAAC"}
1
+ {"version":3,"file":"representation-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAUpC,eAAO,MAAM,kBAAkB,EAAE,IAmChC,CAAC"}
@@ -11,7 +11,7 @@ export const representationKind = {
11
11
  name: 'representation',
12
12
  aliases: [],
13
13
  usage: 'representation <context> <UseCase> <xml|csv|media/type>[,...]',
14
- summary: 'Makes a controller answer in more media types than JSON: `produces` in `@Controller`, and `consumes` of XML for a route that receives a body. The request chooses by its Accept header when "stack.representations" is "negotiated"; the contract lists every media type.',
14
+ summary: 'Makes a controller answer in more media types than JSON: `produces` in `@Controller` (`@KitRoute` of a Nest controller), and `consumes` of XML for a route that receives a body. The request chooses by its Accept header when "stack.representations" is "negotiated"; the contract lists every media type.',
15
15
  positionals: ['context', 'UseCase', 'media'],
16
16
  writesShared: false,
17
17
  run: (request) => {
@@ -22,11 +22,12 @@ export const representationKind = {
22
22
  if (/^\s*produces:/m.test(source)) {
23
23
  throw new CliError(`${useCase.pascal}Controller already declares what it produces.`, 'Edit its `produces` in the controller.');
24
24
  }
25
- const receivesXml = media.includes(XML) && /^\s*body[,:]/m.test(source);
25
+ const receivesBody = controllerSource.nestBody(source) !== undefined || /^\s*body[,:]/m.test(source);
26
+ const receivesXml = media.includes(XML) && receivesBody;
26
27
  const produced = controllerSource.withOption(source, `produces: [${media.map((type) => `'${type}'`).join(', ')}],`);
27
28
  scope.ws.update(file, receivesXml ? controllerSource.withOption(produced, `consumes: ['${XML}'],`) : produced);
28
29
  if (receivesXml) {
29
- scope.ws.note(`The route now also reads its body in XML (\`consumes: ['${XML}']\`), and answers 415 to another media type: remove \`consumes\` from @Controller if only the answer was to be XML.`);
30
+ scope.ws.note(`The route now also reads its body in XML (\`consumes: ['${XML}']\`), and answers 415 to another media type: remove \`consumes\` from ${controllerSource.isNest(source) ? '@KitRoute' : '@Controller'} if only the answer was to be XML.`);
30
31
  }
31
32
  tellWhatIsLeft(scope, { media, source });
32
33
  },
@@ -1 +1 @@
1
- {"version":3,"file":"representation-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAA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IAAI,IAAI,KAAK,kBAAkB,CAAC,CAAC;IAE1G,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,IAAI,QAAQ,CAChB,IAAI,OAAO,qCAAqC,EAChD,kGAAkG,CACnG,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,cAAc,CACrB,KAAmC,EACnC,EAAE,KAAK,EAAE,MAAM,EAAgD;IAE/D,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/E,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,wLAAwL,CACzL,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,KAAK,YAAY,EAAE,CAAC;QACxD,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,gFAAgF,WAAW,iEAAiE,CAC7J,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -4,8 +4,8 @@ import type { ControllerPlan } from './controller-plan.js';
4
4
  /**
5
5
  * What the template of a Nest controller reads, over what the template of a controller of the kit
6
6
  * reads: the decorators of Nest it is written with, the parameters of its method, and the bus Nest
7
- * injects by its class. What it answers is read from its signature by `ddd-ts-kit` into the
8
- * `<context>.controllers.ts` of its context.
7
+ * injects by its class. What it takes and answers is read from its signature by `ddd-ts-kit` into
8
+ * the `<context>.controllers.ts` of its context.
9
9
  */
10
10
  export declare function nestControllerVars(scope: Scope, plan: ControllerPlan): RenderContext;
11
11
  //# sourceMappingURL=nest-controller-vars.d.ts.map
@@ -5,8 +5,8 @@ import { successStatus } from './success-status.js';
5
5
  /**
6
6
  * What the template of a Nest controller reads, over what the template of a controller of the kit
7
7
  * reads: the decorators of Nest it is written with, the parameters of its method, and the bus Nest
8
- * injects by its class. What it answers is read from its signature by `ddd-ts-kit` into the
9
- * `<context>.controllers.ts` of its context.
8
+ * injects by its class. What it takes and answers is read from its signature by `ddd-ts-kit` into
9
+ * the `<context>.controllers.ts` of its context.
10
10
  */
11
11
  export function nestControllerVars(scope, plan) {
12
12
  const types = controllerTypes(scope, plan);
@@ -34,7 +34,6 @@ function importVars(scope, plan, types) {
34
34
  nestImports: fromNest.sort().join(', '),
35
35
  importsFromTheKit: fromTheKit.length > 0,
36
36
  kitImports: fromTheKit.join(', '),
37
- readsSchemas: types.hasTypedParams || types.hasBody,
38
37
  bridgeImports: [...(useCase.isProtected ? ['CurrentActor'] : []), 'KitRoute', 'KitRoutes'].join(', '),
39
38
  kernelImports: useCase.isProtected ? `${busType}, type Actor` : busType,
40
39
  };
@@ -59,15 +58,10 @@ function declarationVars(scope, { group, endpoint }, httpCode) {
59
58
  nestShared: group === undefined ? `tags: ['${scope.context.kebab}'], guards: [Public]` : `group: ${group.name.pascal}Routes`,
60
59
  };
61
60
  }
62
- /** What the method reads, and the message it sends through the bus the constructor injects. */
61
+ /** The parameters of the method, whose types `ddd-ts-kit` reads into the schemas of the route, and the message it sends through the bus the constructor injects. */
63
62
  function methodVars({ name, useCase }, types) {
64
63
  const busType = busTypeOf(useCase.isQuery);
65
64
  return {
66
- readsRequest: types.hasTypedParams || types.hasBody,
67
- nestRequest: [
68
- ...(types.hasTypedParams ? ['params: paramsSchema'] : []),
69
- ...(types.hasBody ? ['body: bodySchema'] : []),
70
- ].join(', '),
71
65
  nestParameters: [
72
66
  ...(types.hasTypedParams ? [`@Param() params: ${name.pascal}Params`] : []),
73
67
  ...(types.hasBody ? [`@Body() body: ${name.pascal}Body`] : []),
@@ -1 +1 @@
1
- {"version":3,"file":"nest-controller-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-controller-vars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE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AAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACjE,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,eAAe,EAAE,WAAW,OAAO,sBAAsB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,EAAE;QAC/G,WAAW,EAAE,OAAO,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG;KAC7E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAkB;IACvD,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAEpD,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,qEAAqE;AACrE,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;AAC/D,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB;IACjC,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { RenderContext } from '../../../templating/index.js';
2
+ import type { Name } from '../../../naming/index.js';
3
+ import type { ControllerPlan } from './controller-plan.js';
4
+ /** What the template of a Nest controller of a search reads: the imports of a page and the name of one line. */
5
+ export declare function nestSearchVars(name: Name, { endpoint, group, cache }: ControllerPlan): RenderContext;
6
+ //# sourceMappingURL=nest-search-vars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-search-vars.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-search-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,cAAc,GAAG,aAAa,CAepG"}
@@ -0,0 +1,18 @@
1
+ import { searchedElements } from '../../searched-elements.js';
2
+ /** What the template of a Nest controller of a search reads: the imports of a page and the name of one line. */
3
+ export function nestSearchVars(name, { endpoint, group, cache }) {
4
+ const method = `${endpoint.method.charAt(0)}${endpoint.method.slice(1).toLowerCase()}`;
5
+ return {
6
+ ...searchedElements(name),
7
+ nestImports: ['Controller', method, 'Inject', 'Query'].sort().join(', '),
8
+ kitImports: [
9
+ ...(cache === undefined ? [] : ['CacheScope']),
10
+ 'pageQuerySchema',
11
+ 'pageResponse',
12
+ 'pageSchemaOf',
13
+ ...(group === undefined ? ['Public'] : []),
14
+ 'type PageBody',
15
+ ].join(', '),
16
+ };
17
+ }
18
+ //# sourceMappingURL=nest-search-vars.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-search-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-search-vars.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,gHAAgH;AAChH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAkB;IACnF,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;IAEvF,OAAO;QACL,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACzB,WAAW,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;QACxE,UAAU,EAAE;YACV,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;YAC9C,iBAAiB;YACjB,cAAc;YACd,cAAc;YACd,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1C,eAAe;SAChB,CAAC,IAAI,CAAC,IAAI,CAAC;KACb,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"write-nest-controller.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAsB5E"}
1
+ {"version":3,"file":"write-nest-controller.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAuB5E"}
@@ -1,4 +1,3 @@
1
- import { CliError } from '../../../cli-error.js';
2
1
  import { emit } from '../../emit.js';
3
2
  import { named } from '../../named.js';
4
3
  import { vars } from '../../vars.js';
@@ -6,17 +5,19 @@ import { wire } from '../../wire.js';
6
5
  import { dtoClasses } from './dto-classes.js';
7
6
  import { groupVars } from './group-vars.js';
8
7
  import { nestControllerVars } from './nest-controller-vars.js';
8
+ import { nestSearchVars } from './nest-search-vars.js';
9
9
  import { sharesSchemas } from './shares-schemas.js';
10
10
  /**
11
11
  * Writes a Nest controller in its folder, its DTO classes beside it, its spec and its group when it
12
12
  * is new, and lists it in the module of its context, for Nest to build it and the kit to serve it.
13
13
  */
14
14
  export function writeNestController(scope, plan) {
15
- assertWritable(scope, plan);
15
+ assertWritable(scope);
16
16
  const { name, group } = plan;
17
17
  const context = vars(scope, {
18
18
  name: named(name),
19
19
  route: nestControllerVars(scope, { ...plan, withMapper: false, withSerializer: false }),
20
+ ...(plan.useCase.isSearch ? { search: nestSearchVars(name, plan) } : {}),
20
21
  ...(group === undefined
21
22
  ? {}
22
23
  : {
@@ -31,11 +32,8 @@ export function writeNestController(scope, plan) {
31
32
  emit(scope, context, outputsOf(scope, plan));
32
33
  wire(scope, 'nest-controller', context);
33
34
  }
34
- /** A search pages through its answer, which a Nest controller is not written for; its method maps by itself. */
35
- function assertWritable(scope, { useCase }) {
36
- if (useCase.isSearch) {
37
- throw new CliError(`${useCase.message} is a search: a Nest controller is not written for it yet.`, 'Generate it as a controller of the kit, which a Nest project serves too: `ddd-ts-kit generate controller ...`.');
38
- }
35
+ /** The method of a Nest controller maps its input and its answer itself. */
36
+ function assertWritable(scope) {
39
37
  if (scope.flags.mapper || scope.flags.serializer) {
40
38
  scope.ws.note('--mapper and --serializer are left out: the method of a Nest controller maps its input and its answer itself.');
41
39
  }
@@ -44,7 +42,7 @@ function outputsOf(scope, { name, group, useCase, endpoint, folder }) {
44
42
  const beside = (role) => `${folder}/${name.kebab}.${role}.ts`;
45
43
  return [
46
44
  ...(group === undefined || group.exists ? [] : [['controller/group.ts.tpl', `${group.file}.ts`]]),
47
- ['nest-controller/controller.ts.tpl', beside('controller')],
45
+ [`nest-controller/controller${useCase.isSearch ? '.search' : ''}.ts.tpl`, beside('controller')],
48
46
  ...dtoClasses(endpoint, useCase, sharesSchemas(scope.config)).map((role) => [`route/dto.${role}.ts.tpl`, beside(role)]),
49
47
  ['nest-controller/controller.spec.ts.tpl', `test/unit/${name.kebab}.controller.spec.ts`],
50
48
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"write-nest-controller.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAY,EAAE,IAAoB;IACpE,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,IAAI,EAAE,KAAK,CAAC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AC,KAAK,IAAI,IAAI,KAAK,CAAC;IAE9E,OAAO;QACL,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,EAAE,GAAG,KAAK,CAAC,IAAI,KAAK,CAAkB,CAAC,CAAC;QAClH,CAAC,6BAA6B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/F,GAAG,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAC/D,CAAC,IAAI,EAAU,EAAE,CAAC,CAAC,aAAa,IAAI,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAC7D;QACD,CAAC,wCAAwC,EAAE,aAAa,IAAI,CAAC,KAAK,qBAAqB,CAAC;KACzF,CAAC;AACJ,CAAC"}
@@ -21,7 +21,7 @@ export const routeKind = {
21
21
  name: 'route',
22
22
  aliases: [],
23
23
  usage: `route ${USAGE}`,
24
- summary: 'An HTTP route calling an existing use case through its bus, with its spec: under "stack.routes": "controllers", a controller class in its folder, behind the guards of its route group; under "functions", a defineRoute function and its registration; under "nest", a Nest controller whose method carries @KitRoute, listed in the module of its context.',
24
+ summary: 'An HTTP route calling an existing use case through its bus, with its spec: under "stack.routes": "controllers", a controller class in its folder, behind the guards of its route group; under "functions", a defineRoute function and its registration; under "nest", a Nest controller whose method takes and answers what its signature names, listed in the generated <context>.controllers.ts.',
25
25
  positionals: ['context', 'UseCaseName'],
26
26
  writesShared: false,
27
27
  run: (request) => {
@@ -1 +1 @@
1
- {"version":3,"file":"route-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/route-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,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O,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhH,OAAO;QACL,CAAC,eAAe,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,SAAS,EAAE,qBAAqB,IAAI,CAAC,KAAK,WAAW,CAAC;QAC9G,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAU,EAAE,CAAC,CAAC,aAAa,IAAI,SAAS,EAAE,qBAAqB,IAAI,CAAC,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC;QAC7G,CAAC,yBAAyB,EAAE,aAAa,IAAI,CAAC,KAAK,gBAAgB,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,0HAA0H;AAC1H,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,GAAG,SAAS;IACZ,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,cAAc,KAAK,EAAE;IAC5B,OAAO,EACL,uKAAuK;IACzK,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;CACpE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"service-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AASpC,eAAO,MAAM,WAAW,EAAE,IA2BzB,CAAC"}
1
+ {"version":3,"file":"service-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAepC,eAAO,MAAM,WAAW,EAAE,IAgCzB,CAAC"}
@@ -1,32 +1,59 @@
1
1
  import { CONFIG_FILE } from '../../config/index.js';
2
+ import { inertPersistenceFile } from '../../init/files/inert-persistence-file.js';
2
3
  import { renderTemplate } from '../../templating/index.js';
3
4
  import { openScope } from '../open-scope.js';
5
+ import { applyWiring } from '../apply-wiring.js';
6
+ import { platformPath } from '../platform-path.js';
4
7
  import { vars } from '../vars.js';
8
+ import { wiringFamily } from '../wiring-family.js';
5
9
  import { addComposeService } from './extraction/add-compose-service.js';
6
10
  import { editJson } from './extraction/edit-json.js';
7
11
  import { EntryPoint } from './extraction/entry-point.js';
8
12
  import { recordOf } from './extraction/record-of.js';
9
13
  import { serviceSelection } from './extraction/service-selection.js';
14
+ const HOSTING_PROOF = 'test/architecture/hosting.spec.ts';
10
15
  export const serviceKind = {
11
16
  name: 'service',
12
17
  aliases: [],
13
18
  usage: 'service <context>',
14
- summary: 'The context run alone, with its scheduled jobs: its entry point under apps/, a start script, a compose service, and `deployable` in the config.',
19
+ summary: 'The context run alone, with its scheduled jobs: its entry point under apps/, a start script, a compose service, `deployable` in the config, and its departure from the whole application (consumers, processes and jobs run once).',
15
20
  positionals: ['context'],
16
21
  writesShared: true,
17
22
  run: (request) => {
18
23
  const scope = openScope(request);
19
24
  const { ws, config, context } = scope;
20
25
  const entry = new EntryPoint(config, context.kebab);
21
- const service = { ...serviceSelection(scope), portVariable: `{${context.constant}_PORT:-3001}` };
26
+ const service = { ...serviceSelection(scope), portVariable: `\${${context.constant}_PORT:-3001}` };
22
27
  ws.create(entry.source, renderTemplate('service/main.ts.tpl', vars(scope, { service })));
23
28
  entry.declareIn(ws);
24
29
  editJson(ws, CONFIG_FILE, (raw) => markDeployable(raw, context.kebab));
25
30
  addComposeService(ws, context.kebab, renderTemplate('service/compose.tpl', vars(scope, { service })));
31
+ leaveTheWholeApplication(scope);
26
32
  ws.note(`Build the image of the service with \`docker build --build-arg ENTRY=${entry.compiled} .\`, or start it with \`docker compose --profile services up ${context.kebab}\`.`);
27
- ws.note(`The service takes the scheduled jobs of ${context.kebab} with it: it runs them unless RUN_JOBS=false, and no job of another context.`);
33
+ ws.note(`The service takes the scheduled jobs of ${context.kebab} with it: it runs them unless RUN_JOBS=false, and no job of another context nor of the platform (audit.archive, privacy.purge-expired stay with the whole application).`);
34
+ ws.note(`${context.pascal} leaves the application of src/main.ts and the worker: \`hostedContexts\` of the composition root omits it, so its consumers, its processes, its jobs and its routes run in the service only. \`everyContext\` stays the full list for the contracts and the end-to-end tests. Set the same DEPLOYMENT_NAME in every container, and a different OTEL_SERVICE_NAME.`);
28
35
  },
29
36
  };
37
+ /**
38
+ * The context stops being hosted by the whole application: the root of `main.ts` and of the worker
39
+ * composes `hostedContexts`, the settings of its jobs leave the whole application, and a proof
40
+ * composes both roots and checks that nothing is registered twice.
41
+ */
42
+ function leaveTheWholeApplication(scope) {
43
+ const { ws, config } = scope;
44
+ const rendered = vars(scope, {});
45
+ applyWiring(ws, platformPath(scope, 'composition/compose-application.ts'), renderTemplate(`service/extracted.${wiringFamily(config)}.tpl`, rendered));
46
+ applyWiring(ws, platformPath(scope, 'jobs/job-settings.ts'), renderTemplate('service/extracted-name.tpl', rendered));
47
+ const inert = inertPersistenceFile(config);
48
+ // A project without HTTP on tsyringe composes nothing without a database until now: the proof needs the inert one.
49
+ if (inert !== undefined && !ws.exists(inert[0])) {
50
+ ws.create(inert[0], renderTemplate(inert[1], rendered));
51
+ }
52
+ if (!ws.exists(HOSTING_PROOF)) {
53
+ ws.create(HOSTING_PROOF, renderTemplate(`architecture/hosting.${wiringFamily(config)}.spec.ts.tpl`, rendered));
54
+ }
55
+ applyWiring(ws, HOSTING_PROOF, renderTemplate('service/extracted-name.tpl', rendered));
56
+ }
30
57
  function markDeployable(raw, context) {
31
58
  const contexts = recordOf(raw['contexts']);
32
59
  raw['contexts'] = { ...contexts, [context]: { ...recordOf(contexts[context]), deployable: true } };
@@ -1 +1 @@
1
- {"version":3,"file":"service-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO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,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,wBAAwB,YAAY,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjH,CAAC;IAED,WAAW,CAAC,EAAE,EAAE,aAAa,EAAE,cAAc,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,cAAc,CAAC,GAA4B,EAAE,OAAe;IACnE,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAE3C,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;AACrG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wire-repository-on-first-use.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKtC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAM5E"}
1
+ {"version":3,"file":"wire-repository-on-first-use.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMtC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAM5E"}
@@ -1,6 +1,7 @@
1
1
  import { named } from '../named.js';
2
2
  import { vars } from '../vars.js';
3
3
  import { wire } from '../wire.js';
4
+ import { isEventSourced } from './is-event-sourced.js';
4
5
  import { repositoryPrefix } from './repository-prefix.js';
5
6
  /**
6
7
  * The repository of an aggregate, created in the module file of a hand-wired context by the first
@@ -9,6 +10,6 @@ import { repositoryPrefix } from './repository-prefix.js';
9
10
  * families bind the repository to its port, where nothing is created before it is resolved.
10
11
  */
11
12
  export function wireRepositoryOnFirstUse(scope, aggregate) {
12
- wire(scope, 'repository/first-use', vars(scope, { aggregate: named(aggregate), adapter: repositoryPrefix(scope.config.stack.orm) }));
13
+ wire(scope, isEventSourced(scope, aggregate) ? 'repository/event-sourced-first-use' : 'repository/first-use', vars(scope, { aggregate: named(aggregate), adapter: repositoryPrefix(scope.config.stack.orm) }));
13
14
  }
14
15
  //# sourceMappingURL=wire-repository-on-first-use.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wire-repository-on-first-use.js","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY,EAAE,SAAe;IACpE,IAAI,CACF,KAAK,EACL,sBAAsB,EACtB,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAChG,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"wire-repository-on-first-use.js","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY,EAAE,SAAe;IACpE,IAAI,CACF,KAAK,EACL,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,sBAAsB,EAChG,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAChG,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"write-event-sourced-aggregate.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/write-event-sourced-aggregate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAOtC;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAkBzE"}
1
+ {"version":3,"file":"write-event-sourced-aggregate.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/write-event-sourced-aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAQtC;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAkBzE"}