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
@@ -0,0 +1,16 @@
1
+ import type { Io } from '../../commands/io.js';
2
+ import type { GuardedOrm } from './guarded-text.js';
3
+ export interface GuardedGeneration {
4
+ readonly root: string;
5
+ readonly orm: GuardedOrm;
6
+ /** Where the tool writes its migrations, and what a migration is named. */
7
+ readonly folder: string;
8
+ readonly migration: RegExp;
9
+ /** Runs the tool of the ORM and answers its exit code. */
10
+ readonly generate: () => number;
11
+ /** Brings what the tool wrote to the rules of the project, the guard added: its imports, its format. */
12
+ readonly tidy?: (written: readonly string[]) => void;
13
+ }
14
+ /** The tool of the ORM writes a migration; with an audit trail, the one that creates it is made append-only; then it is tidied. */
15
+ export declare function generateGuarded(generation: GuardedGeneration, io: Io): number;
16
+ //# sourceMappingURL=generate-guarded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-guarded.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/generate-guarded.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;IAChC,wGAAwG;IACxG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;CACtD;AAED,mIAAmI;AACnI,wBAAgB,eAAe,CAAC,UAAU,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAmB7E"}
@@ -0,0 +1,22 @@
1
+ import { readConfig } from '../../config/index.js';
2
+ import { writtenPaths } from '../written-paths.js';
3
+ import { appendAuditGuard } from './append-audit-guard.js';
4
+ import { auditGuardStatementsOf } from './audit-guard-statements-of.js';
5
+ import { migrationsUnder } from './migrations-under.js';
6
+ /** The tool of the ORM writes a migration; with an audit trail, the one that creates it is made append-only; then it is tidied. */
7
+ export function generateGuarded(generation, io) {
8
+ const { root, orm, folder, migration } = generation;
9
+ const before = migrationsUnder(root, folder, migration);
10
+ const code = generation.generate();
11
+ if (code !== 0) {
12
+ return code;
13
+ }
14
+ const after = migrationsUnder(root, folder, migration);
15
+ const written = writtenPaths(before, after);
16
+ if (readConfig(root).config.stack.audit === 'on') {
17
+ appendAuditGuard({ root, orm, written, migrations: [...after.keys()] }, auditGuardStatementsOf(root, orm), io);
18
+ }
19
+ generation.tidy?.(written);
20
+ return code;
21
+ }
22
+ //# sourceMappingURL=generate-guarded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-guarded.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/generate-guarded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAcrD,mIAAmI;AACnI,MAAM,UAAU,eAAe,CAAC,UAA6B,EAAE,EAAM;IACnE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;IACpD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IAEnC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE5C,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACjD,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,sBAAsB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACjH,CAAC;IAED,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** A name the statements of the guard always hold: a migration that has it is guarded already. */
2
+ export declare const GUARD_MARKER = "audit_entries_append_only";
3
+ //# sourceMappingURL=guard-marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard-marker.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/guard-marker.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,eAAO,MAAM,YAAY,8BAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** A name the statements of the guard always hold: a migration that has it is guarded already. */
2
+ export const GUARD_MARKER = 'audit_entries_append_only';
3
+ //# sourceMappingURL=guard-marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard-marker.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/guard-marker.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,YAAY,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** The tools whose migrations know no trigger: each is written in the dialect of its migrations. */
2
+ export type GuardedOrm = 'drizzle' | 'prisma' | 'typeorm';
3
+ /** The migration that creates the audit entries, the statements of the guard after what it does. */
4
+ export declare function guardedText(orm: GuardedOrm, migration: string, statements: readonly string[]): string;
5
+ //# sourceMappingURL=guarded-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarded-text.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/guarded-text.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAI1D,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAUrG"}
@@ -0,0 +1,26 @@
1
+ const BREAKPOINT = '\n--> statement-breakpoint\n';
2
+ /** The migration that creates the audit entries, the statements of the guard after what it does. */
3
+ export function guardedText(orm, migration, statements) {
4
+ if (orm === 'drizzle') {
5
+ return `${migration.trimEnd()}${BREAKPOINT}${statements.map((statement) => `${statement};`).join(BREAKPOINT)}\n`;
6
+ }
7
+ if (orm === 'prisma') {
8
+ return `${migration.trimEnd()}\n\n-- The audit trail is append-only: @ddd-ts-kit/audit refuses to rewrite it.\n${statements.map((statement) => `${statement};`).join('\n\n')}\n`;
9
+ }
10
+ return inTheUpOfAClass(migration, statements);
11
+ }
12
+ /** A TypeORM migration: one `queryRunner.query` per statement, at the end of `up`. */
13
+ function inTheUpOfAClass(migration, statements) {
14
+ const down = migration.indexOf('public async down(');
15
+ const endOfUp = down === -1 ? -1 : migration.lastIndexOf('}', down);
16
+ if (endOfUp === -1) {
17
+ throw new Error('The migration holds no `up` and `down` methods to add the audit guard to.');
18
+ }
19
+ const line = migration.lastIndexOf('\n', endOfUp) + 1;
20
+ const calls = statements.map((statement) => ` await queryRunner.query(\`${escaped(statement)}\`);\n`).join('');
21
+ return `${migration.slice(0, line)}${calls}${migration.slice(line)}`;
22
+ }
23
+ function escaped(statement) {
24
+ return statement.replaceAll('\\', '\\\\').replaceAll('`', '\\`').replaceAll('${', '\\${');
25
+ }
26
+ //# sourceMappingURL=guarded-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarded-text.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/guarded-text.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,GAAG,8BAA8B,CAAC;AAElD,oGAAoG;AACpG,MAAM,UAAU,WAAW,CAAC,GAAe,EAAE,SAAiB,EAAE,UAA6B;IAC3F,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IACnH,CAAC;IAED,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QACrB,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,oFAAoF,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACnL,CAAC;IAED,OAAO,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,sFAAsF;AACtF,SAAS,eAAe,CAAC,SAAiB,EAAE,UAA6B;IACvE,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEpE,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IAC/F,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,qCAAqC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEtH,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,OAAO,CAAC,SAAiB;IAChC,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The migrations under a folder of the project, by their path from the root (POSIX separators), with their content. */
2
+ export declare function migrationsUnder(root: string, folder: string, migration: RegExp): Map<string, string>;
3
+ //# sourceMappingURL=migrations-under.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations-under.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/migrations-under.ts"],"names":[],"mappings":"AAGA,wHAAwH;AACxH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAepG"}
@@ -0,0 +1,15 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ /** The migrations under a folder of the project, by their path from the root (POSIX separators), with their content. */
4
+ export function migrationsUnder(root, folder, migration) {
5
+ const directory = path.join(root, folder);
6
+ if (!fs.existsSync(directory)) {
7
+ return new Map();
8
+ }
9
+ const files = fs
10
+ .readdirSync(directory, { recursive: true, withFileTypes: true })
11
+ .filter((entry) => entry.isFile() && migration.test(entry.name))
12
+ .map((entry) => path.join(entry.parentPath, entry.name));
13
+ return new Map(files.sort().map((file) => [path.relative(root, file).split(path.sep).join('/'), fs.readFileSync(file, 'utf8')]));
14
+ }
15
+ //# sourceMappingURL=migrations-under.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations-under.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/migrations-under.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,wHAAwH;AACxH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAc,EAAE,SAAiB;IAC7E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,EAAE;SACb,WAAW,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SAChE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC/D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAE3D,OAAO,IAAI,GAAG,CACZ,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CACjH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Runs the CLI of an ORM installed in the project with the node that runs this one, in the terminal of the caller. */
2
+ export declare function runOrmTool(root: string, bin: string, args: readonly string[]): number;
3
+ //# sourceMappingURL=run-orm-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-orm-tool.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/run-orm-tool.ts"],"names":[],"mappings":"AAKA,uHAAuH;AACvH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAWrF"}
@@ -0,0 +1,13 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { CliError } from '../../cli-error.js';
5
+ /** Runs the CLI of an ORM installed in the project with the node that runs this one, in the terminal of the caller. */
6
+ export function runOrmTool(root, bin, args) {
7
+ const entry = path.join(root, 'node_modules', bin);
8
+ if (!fs.existsSync(entry)) {
9
+ throw new CliError(`${bin.split('/')[0] ?? bin} is not installed in ${root}.`, 'Run `npm install` in the project first.');
10
+ }
11
+ return spawnSync(process.execPath, [entry, ...args], { cwd: root, stdio: 'inherit' }).status ?? 1;
12
+ }
13
+ //# sourceMappingURL=run-orm-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-orm-tool.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/run-orm-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,uHAAuH;AACvH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,GAAW,EAAE,IAAuB;IAC3E,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;IAEnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,QAAQ,CAChB,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,wBAAwB,IAAI,GAAG,EAC1D,yCAAyC,CAC1C,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;AACpG,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A migration TypeORM wrote, which creates tables in schemas it never creates (TypeORM writes no
3
+ * `CREATE SCHEMA`): each of them created first, if it does not exist, at the start of `up`.
4
+ */
5
+ export declare function schemasFirst(migration: string): string;
6
+ //# sourceMappingURL=schemas-first.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas-first.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/schemas-first.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAetD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A migration TypeORM wrote, which creates tables in schemas it never creates (TypeORM writes no
3
+ * `CREATE SCHEMA`): each of them created first, if it does not exist, at the start of `up`.
4
+ */
5
+ export function schemasFirst(migration) {
6
+ const schemas = [...new Set([...migration.matchAll(/CREATE TABLE "(\w+)"\."\w+"/g)].map((match) => match[1] ?? ''))];
7
+ const up = /public async up\([^)]*\): Promise<void> \{\n/.exec(migration);
8
+ if (schemas.length === 0 || up === null) {
9
+ return migration;
10
+ }
11
+ const at = up.index + up[0].length;
12
+ const created = schemas
13
+ .map((schema) => ` await queryRunner.query(\`CREATE SCHEMA IF NOT EXISTS "${schema}"\`);\n`)
14
+ .join('');
15
+ return `${migration.slice(0, at)}${created}${migration.slice(at)}`;
16
+ }
17
+ //# sourceMappingURL=schemas-first.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas-first.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/schemas-first.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACrH,MAAM,EAAE,GAAG,8CAA8C,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE1E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEnC,MAAM,OAAO,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,kEAAkE,MAAM,SAAS,CAAC;SAClG,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AACrE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A migration drizzle-kit wrote, its `CREATE SCHEMA` made idempotent: a schema created before by
3
+ * hand, by another tool or by a migration of a project generated earlier, is left as it is
4
+ * instead of failing the migration.
5
+ */
6
+ export declare function schemasIfMissing(migration: string): string;
7
+ //# sourceMappingURL=schemas-if-missing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas-if-missing.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/schemas-if-missing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A migration drizzle-kit wrote, its `CREATE SCHEMA` made idempotent: a schema created before by
3
+ * hand, by another tool or by a migration of a project generated earlier, is left as it is
4
+ * instead of failing the migration.
5
+ */
6
+ export function schemasIfMissing(migration) {
7
+ return migration.replace(/CREATE SCHEMA (?!IF NOT EXISTS)/g, 'CREATE SCHEMA IF NOT EXISTS ');
8
+ }
9
+ //# sourceMappingURL=schemas-if-missing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas-if-missing.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/schemas-if-missing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,OAAO,SAAS,CAAC,OAAO,CAAC,kCAAkC,EAAE,8BAA8B,CAAC,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A migration TypeORM wrote, its import of `MigrationInterface` and `QueryRunner` made type-only,
3
+ * as `verbatimModuleSyntax` asks of an import that names types alone.
4
+ */
5
+ export declare function typeOnlyImports(migration: string): string;
6
+ //# sourceMappingURL=type-only-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-only-imports.d.ts","sourceRoot":"","sources":["../../../src/migration/audit-guard/type-only-imports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A migration TypeORM wrote, its import of `MigrationInterface` and `QueryRunner` made type-only,
3
+ * as `verbatimModuleSyntax` asks of an import that names types alone.
4
+ */
5
+ export function typeOnlyImports(migration) {
6
+ return migration.replace(/^import \{([^}]*)\} from ["']typeorm["'];?$/m, "import type {$1} from 'typeorm';");
7
+ }
8
+ //# sourceMappingURL=type-only-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-only-imports.js","sourceRoot":"","sources":["../../../src/migration/audit-guard/type-only-imports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,OAAO,CAAC,8CAA8C,EAAE,kCAAkC,CAAC,CAAC;AAC/G,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Io } from '../commands/io.js';
2
+ /** Formats files with the formatter of the project, the way its format script does; a formatter that fails or is missing is reported. */
3
+ export declare function formatAsTheProject(root: string, files: readonly string[], io: Io): void;
4
+ //# sourceMappingURL=format-as-the-project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-as-the-project.d.ts","sourceRoot":"","sources":["../../src/migration/format-as-the-project.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAMzC,yIAAyI;AACzI,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CA4BvF"}
@@ -0,0 +1,27 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { findProjectFormatter } from './find-project-formatter.js';
3
+ /** Enough of a failing formatter to read the cause. */
4
+ const TAIL_LINES = 20;
5
+ /** Formats files with the formatter of the project, the way its format script does; a formatter that fails or is missing is reported. */
6
+ export function formatAsTheProject(root, files, io) {
7
+ if (files.length === 0) {
8
+ return;
9
+ }
10
+ const formatter = findProjectFormatter(root);
11
+ if (typeof formatter === 'string') {
12
+ io.out(`Not formatted (${formatter}): ${files.join(', ')}.`);
13
+ return;
14
+ }
15
+ const run = spawnSync(process.execPath, [formatter.bin, ...formatter.args, ...files], {
16
+ cwd: root,
17
+ encoding: 'utf8',
18
+ stdio: ['ignore', 'pipe', 'pipe'],
19
+ });
20
+ if (run.status === 0) {
21
+ io.out(`Formatted with ${formatter.name}, as the format script does: ${files.join(', ')}.`);
22
+ return;
23
+ }
24
+ const printed = `${run.stdout}${run.stderr}`.trimEnd().split('\n').slice(-TAIL_LINES).join('\n');
25
+ io.err(`Warning: ${formatter.name} failed on ${files.join(', ')}; format them before committing.\n${printed}`);
26
+ }
27
+ //# sourceMappingURL=format-as-the-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-as-the-project.js","sourceRoot":"","sources":["../../src/migration/format-as-the-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,uDAAuD;AACvD,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,yIAAyI;AACzI,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAwB,EAAE,EAAM;IAC/E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,EAAE,CAAC,GAAG,CAAC,kBAAkB,SAAS,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE7D,OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE;QACpF,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,EAAE,CAAC,GAAG,CAAC,kBAAkB,SAAS,CAAC,IAAI,gCAAgC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5F,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjG,EAAE,CAAC,GAAG,CAAC,YAAY,SAAS,CAAC,IAAI,cAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;AACjH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-written-files.d.ts","sourceRoot":"","sources":["../../src/migration/format-written-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CA8BlF"}
1
+ {"version":3,"file":"format-written-files.d.ts","sourceRoot":"","sources":["../../src/migration/format-written-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAMlF"}
@@ -1,32 +1,10 @@
1
- import { spawnSync } from 'node:child_process';
2
- import { findProjectFormatter } from './find-project-formatter.js';
3
- /** Enough of a failing formatter to read the cause. */
4
- const TAIL_LINES = 20;
1
+ import { formatAsTheProject } from './format-as-the-project.js';
5
2
  /**
6
3
  * Formats the snapshot and the journal drizzle-kit wrote under `meta/` as the project formats its
7
4
  * files, so that its format gate passes on them; the SQL is left as drizzle-kit wrote it. A
8
5
  * formatter that fails or is missing is reported: the migration is written either way.
9
6
  */
10
7
  export function formatWrittenFiles({ root, paths }, io) {
11
- const json = paths.filter((file) => file.includes('/meta/') && file.endsWith('.json'));
12
- if (json.length === 0) {
13
- return;
14
- }
15
- const formatter = findProjectFormatter(root);
16
- if (typeof formatter === 'string') {
17
- io.out(`Not formatted (${formatter}): ${json.join(', ')}.`);
18
- return;
19
- }
20
- const run = spawnSync(process.execPath, [formatter.bin, ...formatter.args, ...json], {
21
- cwd: root,
22
- encoding: 'utf8',
23
- stdio: ['ignore', 'pipe', 'pipe'],
24
- });
25
- if (run.status === 0) {
26
- io.out(`Formatted with ${formatter.name}, as the format script does: ${json.join(', ')}.`);
27
- return;
28
- }
29
- const printed = `${run.stdout}${run.stderr}`.trimEnd().split('\n').slice(-TAIL_LINES).join('\n');
30
- io.err(`Warning: ${formatter.name} failed on ${json.join(', ')}; format them before committing.\n${printed}`);
8
+ formatAsTheProject(root, paths.filter((file) => file.includes('/meta/') && file.endsWith('.json')), io);
31
9
  }
32
10
  //# sourceMappingURL=format-written-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-written-files.js","sourceRoot":"","sources":["../../src/migration/format-written-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,uDAAuD;AACvD,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAoB,EAAE,EAAM;IAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAEvF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,EAAE,CAAC,GAAG,CAAC,kBAAkB,SAAS,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5D,OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE;QACnF,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,EAAE,CAAC,GAAG,CAAC,kBAAkB,SAAS,CAAC,IAAI,gCAAgC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE3F,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjG,EAAE,CAAC,GAAG,CAAC,YAAY,SAAS,CAAC,IAAI,cAAc,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;AAChH,CAAC"}
1
+ {"version":3,"file":"format-written-files.js","sourceRoot":"","sources":["../../src/migration/format-written-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAoB,EAAE,EAAM;IAC1E,kBAAkB,CAChB,IAAI,EACJ,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EACzE,EAAE,CACH,CAAC;AACJ,CAAC"}
@@ -3,4 +3,12 @@ export { generateDrizzleMigration } from './generate-drizzle-migration.js';
3
3
  export { primaryKeyOrderFindings } from './primary-key-order-findings.js';
4
4
  export { replayDrizzleMigrations } from './replay-drizzle-migrations.js';
5
5
  export { tidyWrittenMigration } from './tidy-written-migration.js';
6
+ export { appendAuditGuard } from './audit-guard/append-audit-guard.js';
7
+ export { auditGuardStatementsOf } from './audit-guard/audit-guard-statements-of.js';
8
+ export { generateGuarded } from './audit-guard/generate-guarded.js';
9
+ export { runOrmTool } from './audit-guard/run-orm-tool.js';
10
+ export { formatAsTheProject } from './format-as-the-project.js';
11
+ export { typeOnlyImports } from './audit-guard/type-only-imports.js';
12
+ export { schemasFirst } from './audit-guard/schemas-first.js';
13
+ export { schemasIfMissing } from './audit-guard/schemas-if-missing.js';
6
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -3,4 +3,12 @@ export { generateDrizzleMigration } from './generate-drizzle-migration.js';
3
3
  export { primaryKeyOrderFindings } from './primary-key-order-findings.js';
4
4
  export { replayDrizzleMigrations } from './replay-drizzle-migrations.js';
5
5
  export { tidyWrittenMigration } from './tidy-written-migration.js';
6
+ export { appendAuditGuard } from './audit-guard/append-audit-guard.js';
7
+ export { auditGuardStatementsOf } from './audit-guard/audit-guard-statements-of.js';
8
+ export { generateGuarded } from './audit-guard/generate-guarded.js';
9
+ export { runOrmTool } from './audit-guard/run-orm-tool.js';
10
+ export { formatAsTheProject } from './format-as-the-project.js';
11
+ export { typeOnlyImports } from './audit-guard/type-only-imports.js';
12
+ export { schemasFirst } from './audit-guard/schemas-first.js';
13
+ export { schemasIfMissing } from './audit-guard/schemas-if-missing.js';
6
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The generated file at the root of a context that lists its Nest controllers and what their methods answer. */
2
+ export declare function controllersFile(context: string): string;
3
+ //# sourceMappingURL=controllers-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers-file.d.ts","sourceRoot":"","sources":["../../src/nest-controllers/controllers-file.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -0,0 +1,5 @@
1
+ /** The generated file at the root of a context that lists its Nest controllers and what their methods answer. */
2
+ export function controllersFile(context) {
3
+ return `${context}.controllers.ts`;
4
+ }
5
+ //# sourceMappingURL=controllers-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controllers-file.js","sourceRoot":"","sources":["../../src/nest-controllers/controllers-file.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,GAAG,OAAO,iBAAiB,CAAC;AACrC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { NestReadType } from './nest-read-type.js';
2
+ /** What a method of a Nest controller answers, as its signature says it. */
3
+ export type NestAnswer = {
4
+ readonly kind: 'none';
5
+ } | {
6
+ readonly kind: 'accepted';
7
+ } | NestReadType;
8
+ //# sourceMappingURL=nest-answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-answer.d.ts","sourceRoot":"","sources":["../../src/nest-controllers/nest-answer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nest-answer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-answer.js","sourceRoot":"","sources":["../../src/nest-controllers/nest-answer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { NestAnswer } from './nest-answer.js';
2
+ import type { NestRequestPart } from './nest-request-part.js';
3
+ /** A Nest controller of a context the kit serves, and what the signature of each of its route methods says. */
4
+ export interface NestControllerEntry {
5
+ readonly file: string;
6
+ readonly className: string;
7
+ readonly specifier: string;
8
+ readonly methods: readonly NestRouteMethod[];
9
+ }
10
+ /** A route method of a Nest controller: what its signature says it takes and answers, and whether `@KitRoute` says its answer instead. */
11
+ export interface NestRouteMethod {
12
+ readonly name: string;
13
+ readonly line: number;
14
+ readonly request: readonly NestRequestPart[];
15
+ readonly answer: NestAnswer;
16
+ readonly declaresResponse: boolean;
17
+ }
18
+ //# sourceMappingURL=nest-controller-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-controller-entry.d.ts","sourceRoot":"","sources":["../../src/nest-controllers/nest-controller-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,+GAA+G;AAC/G,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C;AAED,0IAA0I;AAC1I,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nest-controller-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-controller-entry.js","sourceRoot":"","sources":["../../src/nest-controllers/nest-controller-entry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { Config } from '../config/index.js';
2
+ import type { NestControllerEntry } from './nest-controller-entry.js';
3
+ import type { ProjectFiles } from './project-files.js';
4
+ /** The Nest controllers the kit serves in one file, with what the signature of each route method says. */
5
+ export declare function nestControllersIn(files: ProjectFiles, config: Config, file: string): NestControllerEntry[];
6
+ //# sourceMappingURL=nest-controllers-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest-controllers-in.d.ts","sourceRoot":"","sources":["../../src/nest-controllers/nest-controllers-in.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,yBAAyB,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAuBpD,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAqB1G"}
@@ -0,0 +1,108 @@
1
+ import { specifierOf } from '../alias/index.js';
2
+ import { aliasRoots } from '../alias/alias-roots.js';
3
+ import { scan } from '../check/scan/scan.js';
4
+ import { readStructure } from '../check/structure/read-structure.js';
5
+ import { parametersOf } from './parameters-of.js';
6
+ const NEST = '@nestjs/common';
7
+ const BRIDGE = '@ddd-ts-kit/http/nest';
8
+ const ROUTE_DECORATOR = /@(?:Get|Post|Put|Patch|Delete|Head|Options)\s*\(/;
9
+ const RETURN_TYPE = /\)\s*:\s*([\s\S]+?)\s*$/;
10
+ const PROMISED = /^Promise\s*<([\s\S]+)>$/;
11
+ const TYPE_NAME = /^[A-Z][\w$]*$/;
12
+ const CONTROLLER = /@Controller\s*\(/;
13
+ const DECLARED_RESPONSE = /@KitRoute\s*\(\s*\{[\s\S]*\bresponse\s*:/;
14
+ const DECLARED_REQUEST = /@KitRoute\s*\(\s*\{[\s\S]*\brequest\s*:\s*\{([^}]*)\}/;
15
+ /** A parameter that takes a part of the request whole: `@Body() body: IssueInvoiceBody`. */
16
+ const WHOLE_PART = /^@(Body|Query|Param|Headers)\s*\(\s*\)\s*(?:(?:public|private|protected|readonly)\s+)*[\w$]+\??\s*:\s*([\s\S]+)$/;
17
+ const SOURCES = {
18
+ Body: 'body',
19
+ Query: 'query',
20
+ Param: 'params',
21
+ Headers: 'headers',
22
+ };
23
+ /** The Nest controllers the kit serves in one file, with what the signature of each route method says. */
24
+ export function nestControllersIn(files, config, file) {
25
+ const text = files.read(file) ?? '';
26
+ const scanned = scan(text);
27
+ const { imports } = scanned;
28
+ if (!imports.some(({ specifier }) => specifier === NEST) || !imports.some(({ specifier }) => specifier === BRIDGE)) {
29
+ return [];
30
+ }
31
+ const reading = { files, config, imports, text, code: scanned.code };
32
+ return readStructure(scanned)
33
+ .classes.filter(({ isExported, start }) => isExported && CONTROLLER.test(scanned.code.slice(Math.max(0, start - 400), start)))
34
+ .map((shape) => ({
35
+ file,
36
+ className: shape.name,
37
+ specifier: specifierOf(config, file),
38
+ methods: routeMethodsOf(shape, reading),
39
+ }));
40
+ }
41
+ /** The methods of the class that carry a route decorator of Nest, each with what its signature takes and answers. */
42
+ function routeMethodsOf(shape, reading) {
43
+ let previous = shape.bodyStart;
44
+ return shape.methods.flatMap((method) => {
45
+ const decorators = reading.code.slice(previous, method.start);
46
+ previous = method.end;
47
+ if (method.isConstructor || !ROUTE_DECORATOR.test(decorators)) {
48
+ return [];
49
+ }
50
+ const signature = reading.text.slice(method.start, method.bodyStart);
51
+ const written = RETURN_TYPE.exec(signature)?.[1];
52
+ return [
53
+ {
54
+ name: method.name,
55
+ line: method.line,
56
+ request: requestOf(method, decorators, reading),
57
+ answer: written === undefined ? { kind: 'unread', text: 'no return type' } : answerOf(written, reading),
58
+ declaresResponse: DECLARED_RESPONSE.test(decorators),
59
+ },
60
+ ];
61
+ });
62
+ }
63
+ /** The parts of the request the parameters take whole, each with its type and whether `@KitRoute` gives it. */
64
+ function requestOf({ start, bodyStart }, decorators, reading) {
65
+ const declared = DECLARED_REQUEST.exec(decorators)?.[1] ?? '';
66
+ return parametersOf(reading.text.slice(start, bodyStart), reading.code.slice(start, bodyStart)).flatMap((parameter) => {
67
+ const [, decorator = '', type = ''] = WHOLE_PART.exec(parameter) ?? [];
68
+ const source = SOURCES[decorator];
69
+ return source === undefined
70
+ ? []
71
+ : [{ source, type: typeOf(type.trim(), reading), declared: givesPart(declared, source) }];
72
+ });
73
+ }
74
+ /** Whether the members of `request` of `@KitRoute` name that part, written in full (`query: schema`) or short (`query`). */
75
+ function givesPart(members, source) {
76
+ return new RegExp(`(?:^|,)\\s*${source}\\s*(?::|,|$)`).test(members.trim());
77
+ }
78
+ function answerOf(written, reading) {
79
+ const type = (PROMISED.exec(written)?.[1] ?? written).trim();
80
+ if (type === 'void' || type === 'undefined') {
81
+ return { kind: 'none' };
82
+ }
83
+ if (type === 'Accepted' && importOf(type, reading)?.specifier === '@ddd-ts-kit/http') {
84
+ return { kind: 'accepted' };
85
+ }
86
+ const read = typeOf(type, reading);
87
+ return read.kind === 'class' ? read : { kind: 'unread', text: written };
88
+ }
89
+ /** A DTO class imported by its name from a file of the project, else a type the kit cannot read. */
90
+ function typeOf(type, reading) {
91
+ const imported = importOf(type, reading);
92
+ return imported !== undefined && isClassAt(reading, imported.specifier, type)
93
+ ? { kind: 'class', name: type, specifier: imported.specifier }
94
+ : { kind: 'unread', text: type };
95
+ }
96
+ function importOf(type, { imports }) {
97
+ return TYPE_NAME.test(type) ? imports.find(({ names }) => names.includes(type)) : undefined;
98
+ }
99
+ /** Whether the file an alias names exports a class of that name: an interface or a type has no schema to read. */
100
+ function isClassAt({ files, config }, specifier, name) {
101
+ const root = aliasRoots(config).find(({ prefix }) => specifier.startsWith(prefix));
102
+ if (root === undefined) {
103
+ return false;
104
+ }
105
+ const file = `${root.directory}/${specifier.slice(root.prefix.length).replace(/\.js$/, '')}.ts`;
106
+ return new RegExp(`export\\s+(?:abstract\\s+)?class\\s+${name}\\b`).test(files.read(file) ?? '');
107
+ }
108
+ //# sourceMappingURL=nest-controllers-in.js.map