ddd-ts-kit 0.89.0 → 0.91.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 (463) hide show
  1. package/CHANGELOG.md +318 -0
  2. package/README.fr.md +58 -12
  3. package/README.md +54 -11
  4. package/dist/alias/index.d.ts +2 -1
  5. package/dist/alias/index.d.ts.map +1 -1
  6. package/dist/alias/index.js +1 -0
  7. package/dist/alias/index.js.map +1 -1
  8. package/dist/alias/mapper-target-text.d.ts +4 -0
  9. package/dist/alias/mapper-target-text.d.ts.map +1 -0
  10. package/dist/alias/mapper-target-text.js +5 -0
  11. package/dist/alias/mapper-target-text.js.map +1 -0
  12. package/dist/alias/module-name-mapper.d.ts +5 -2
  13. package/dist/alias/module-name-mapper.d.ts.map +1 -1
  14. package/dist/alias/module-name-mapper.js +5 -2
  15. package/dist/alias/module-name-mapper.js.map +1 -1
  16. package/dist/check/alias/test-runners.js +8 -3
  17. package/dist/check/alias/test-runners.js.map +1 -1
  18. package/dist/check/baseline/apply-baseline.d.ts +14 -0
  19. package/dist/check/baseline/apply-baseline.d.ts.map +1 -0
  20. package/dist/check/baseline/apply-baseline.js +30 -0
  21. package/dist/check/baseline/apply-baseline.js.map +1 -0
  22. package/dist/check/baseline/baseline-following-moves.d.ts +9 -0
  23. package/dist/check/baseline/baseline-following-moves.d.ts.map +1 -0
  24. package/dist/check/baseline/baseline-following-moves.js +10 -0
  25. package/dist/check/baseline/baseline-following-moves.js.map +1 -0
  26. package/dist/check/baseline/baseline-move.d.ts +6 -0
  27. package/dist/check/baseline/baseline-move.d.ts.map +1 -0
  28. package/dist/check/baseline/baseline-move.js +2 -0
  29. package/dist/check/baseline/baseline-move.js.map +1 -0
  30. package/dist/check/baseline/baseline-text.d.ts +4 -0
  31. package/dist/check/baseline/baseline-text.d.ts.map +1 -0
  32. package/dist/check/baseline/baseline-text.js +12 -0
  33. package/dist/check/baseline/baseline-text.js.map +1 -0
  34. package/dist/check/baseline/baseline.d.ts +6 -0
  35. package/dist/check/baseline/baseline.d.ts.map +1 -0
  36. package/dist/check/baseline/baseline.js +2 -0
  37. package/dist/check/baseline/baseline.js.map +1 -0
  38. package/dist/check/baseline/moved-baseline-text.d.ts +4 -0
  39. package/dist/check/baseline/moved-baseline-text.d.ts.map +1 -0
  40. package/dist/check/baseline/moved-baseline-text.js +13 -0
  41. package/dist/check/baseline/moved-baseline-text.js.map +1 -0
  42. package/dist/check/baseline/parse-baseline.d.ts +4 -0
  43. package/dist/check/baseline/parse-baseline.d.ts.map +1 -0
  44. package/dist/check/baseline/parse-baseline.js +19 -0
  45. package/dist/check/baseline/parse-baseline.js.map +1 -0
  46. package/dist/check/baseline/pruned-baseline.d.ts +5 -0
  47. package/dist/check/baseline/pruned-baseline.d.ts.map +1 -0
  48. package/dist/check/baseline/pruned-baseline.js +14 -0
  49. package/dist/check/baseline/pruned-baseline.js.map +1 -0
  50. package/dist/check/baseline/read-baseline.d.ts +6 -0
  51. package/dist/check/baseline/read-baseline.d.ts.map +1 -0
  52. package/dist/check/baseline/read-baseline.js +11 -0
  53. package/dist/check/baseline/read-baseline.js.map +1 -0
  54. package/dist/check/baseline/recorded-baseline.d.ts +5 -0
  55. package/dist/check/baseline/recorded-baseline.d.ts.map +1 -0
  56. package/dist/check/baseline/recorded-baseline.js +11 -0
  57. package/dist/check/baseline/recorded-baseline.js.map +1 -0
  58. package/dist/check/baseline/renamed-files.d.ts +8 -0
  59. package/dist/check/baseline/renamed-files.d.ts.map +1 -0
  60. package/dist/check/baseline/renamed-files.js +23 -0
  61. package/dist/check/baseline/renamed-files.js.map +1 -0
  62. package/dist/check/baseline/write-baseline.d.ts +4 -0
  63. package/dist/check/baseline/write-baseline.d.ts.map +1 -0
  64. package/dist/check/baseline/write-baseline.js +9 -0
  65. package/dist/check/baseline/write-baseline.js.map +1 -0
  66. package/dist/check/canonical/stray-entry.d.ts.map +1 -1
  67. package/dist/check/canonical/stray-entry.js +5 -1
  68. package/dist/check/canonical/stray-entry.js.map +1 -1
  69. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  70. package/dist/check/catalogue/architecture-rules.js +4 -0
  71. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  72. package/dist/check/catalogue/default-severities.d.ts.map +1 -1
  73. package/dist/check/catalogue/default-severities.js +0 -4
  74. package/dist/check/catalogue/default-severities.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/explain/nest-docs.d.ts +3 -0
  83. package/dist/check/explain/nest-docs.d.ts.map +1 -0
  84. package/dist/check/explain/nest-docs.js +31 -0
  85. package/dist/check/explain/nest-docs.js.map +1 -0
  86. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  87. package/dist/check/explain/rule-docs.js +2 -0
  88. package/dist/check/explain/rule-docs.js.map +1 -1
  89. package/dist/check/fixtures/alias-declared-fixtures.js +1 -1
  90. package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
  91. package/dist/check/fixtures/authz-declared-fixtures.js +1 -1
  92. package/dist/check/fixtures/authz-declared-fixtures.js.map +1 -1
  93. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  94. package/dist/check/fixtures/fixtures.js +4 -0
  95. package/dist/check/fixtures/fixtures.js.map +1 -1
  96. package/dist/check/fixtures/nest-controllers-fixtures.d.ts +3 -0
  97. package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -0
  98. package/dist/check/fixtures/nest-controllers-fixtures.js +86 -0
  99. package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -0
  100. package/dist/check/fixtures/nest-fixtures.d.ts +3 -0
  101. package/dist/check/fixtures/nest-fixtures.d.ts.map +1 -0
  102. package/dist/check/fixtures/nest-fixtures.js +59 -0
  103. package/dist/check/fixtures/nest-fixtures.js.map +1 -0
  104. package/dist/check/nest/nest-equivalents-of.d.ts +14 -0
  105. package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -0
  106. package/dist/check/nest/nest-equivalents-of.js +119 -0
  107. package/dist/check/nest/nest-equivalents-of.js.map +1 -0
  108. package/dist/check/project/load-project.d.ts +2 -0
  109. package/dist/check/project/load-project.d.ts.map +1 -1
  110. package/dist/check/project/load-project.js +7 -3
  111. package/dist/check/project/load-project.js.map +1 -1
  112. package/dist/check/rules/nest-controllers-current.d.ts +3 -0
  113. package/dist/check/rules/nest-controllers-current.d.ts.map +1 -0
  114. package/dist/check/rules/nest-controllers-current.js +43 -0
  115. package/dist/check/rules/nest-controllers-current.js.map +1 -0
  116. package/dist/check/rules/nest-no-parallel-pipeline.d.ts +3 -0
  117. package/dist/check/rules/nest-no-parallel-pipeline.d.ts.map +1 -0
  118. package/dist/check/rules/nest-no-parallel-pipeline.js +70 -0
  119. package/dist/check/rules/nest-no-parallel-pipeline.js.map +1 -0
  120. package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
  121. package/dist/check/support/is-generated-context-file.js +4 -1
  122. package/dist/check/support/is-generated-context-file.js.map +1 -1
  123. package/dist/commands/doctor.d.ts.map +1 -1
  124. package/dist/commands/doctor.js +4 -2
  125. package/dist/commands/doctor.js.map +1 -1
  126. package/dist/commands/init.d.ts.map +1 -1
  127. package/dist/commands/init.js +1 -0
  128. package/dist/commands/init.js.map +1 -1
  129. package/dist/config/config.d.ts +6 -0
  130. package/dist/config/config.d.ts.map +1 -1
  131. package/dist/config/index.d.ts +1 -1
  132. package/dist/config/index.d.ts.map +1 -1
  133. package/dist/config/index.js +1 -1
  134. package/dist/config/index.js.map +1 -1
  135. package/dist/config/parse-config.js +1 -0
  136. package/dist/config/parse-config.js.map +1 -1
  137. package/dist/config/parse-stack.d.ts.map +1 -1
  138. package/dist/config/parse-stack.js +2 -1
  139. package/dist/config/parse-stack.js.map +1 -1
  140. package/dist/config/serialize-config.js +9 -2
  141. package/dist/config/serialize-config.js.map +1 -1
  142. package/dist/config/stack.d.ts +17 -4
  143. package/dist/config/stack.d.ts.map +1 -1
  144. package/dist/config/stack.js +4 -1
  145. package/dist/config/stack.js.map +1 -1
  146. package/dist/dev/refresh-declarations.d.ts.map +1 -1
  147. package/dist/dev/refresh-declarations.js +4 -1
  148. package/dist/dev/refresh-declarations.js.map +1 -1
  149. package/dist/docs/write-docs.d.ts.map +1 -1
  150. package/dist/docs/write-docs.js +2 -0
  151. package/dist/docs/write-docs.js.map +1 -1
  152. package/dist/doctor/diagnose.d.ts +2 -1
  153. package/dist/doctor/diagnose.d.ts.map +1 -1
  154. package/dist/doctor/diagnose.js +4 -1
  155. package/dist/doctor/diagnose.js.map +1 -1
  156. package/dist/doctor/doctor-finding.d.ts +3 -2
  157. package/dist/doctor/doctor-finding.d.ts.map +1 -1
  158. package/dist/doctor/format-diagnosis.js +4 -1
  159. package/dist/doctor/format-diagnosis.js.map +1 -1
  160. package/dist/doctor/override-findings.d.ts +10 -0
  161. package/dist/doctor/override-findings.d.ts.map +1 -0
  162. package/dist/doctor/override-findings.js +87 -0
  163. package/dist/doctor/override-findings.js.map +1 -0
  164. package/dist/file-moves/move-files.d.ts.map +1 -1
  165. package/dist/file-moves/move-files.js +10 -0
  166. package/dist/file-moves/move-files.js.map +1 -1
  167. package/dist/generate/kinds/property-kind.d.ts +3 -0
  168. package/dist/generate/kinds/property-kind.d.ts.map +1 -0
  169. package/dist/generate/kinds/property-kind.js +51 -0
  170. package/dist/generate/kinds/property-kind.js.map +1 -0
  171. package/dist/generate/kinds/route/nest-controller-vars.d.ts +11 -0
  172. package/dist/generate/kinds/route/nest-controller-vars.d.ts.map +1 -0
  173. package/dist/generate/kinds/route/nest-controller-vars.js +97 -0
  174. package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -0
  175. package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
  176. package/dist/generate/kinds/route/route-vars.js +1 -9
  177. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  178. package/dist/generate/kinds/route/success-status.d.ts +5 -0
  179. package/dist/generate/kinds/route/success-status.d.ts.map +1 -0
  180. package/dist/generate/kinds/route/success-status.js +11 -0
  181. package/dist/generate/kinds/route/success-status.js.map +1 -0
  182. package/dist/generate/kinds/route/write-nest-controller.d.ts +8 -0
  183. package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -0
  184. package/dist/generate/kinds/route/write-nest-controller.js +52 -0
  185. package/dist/generate/kinds/route/write-nest-controller.js.map +1 -0
  186. package/dist/generate/kinds/route-kind.d.ts.map +1 -1
  187. package/dist/generate/kinds/route-kind.js +6 -1
  188. package/dist/generate/kinds/route-kind.js.map +1 -1
  189. package/dist/generate/kinds.d.ts.map +1 -1
  190. package/dist/generate/kinds.js +2 -0
  191. package/dist/generate/kinds.js.map +1 -1
  192. package/dist/generate/refresh-docs.d.ts.map +1 -1
  193. package/dist/generate/refresh-docs.js +2 -0
  194. package/dist/generate/refresh-docs.js.map +1 -1
  195. package/dist/generate/shared-writes.d.ts.map +1 -1
  196. package/dist/generate/shared-writes.js +5 -0
  197. package/dist/generate/shared-writes.js.map +1 -1
  198. package/dist/help/notes.d.ts +1 -1
  199. package/dist/help/notes.d.ts.map +1 -1
  200. package/dist/help/notes.js +3 -1
  201. package/dist/help/notes.js.map +1 -1
  202. package/dist/help/usage.d.ts +1 -1
  203. package/dist/help/usage.d.ts.map +1 -1
  204. package/dist/help/usage.js +4 -2
  205. package/dist/help/usage.js.map +1 -1
  206. package/dist/init/agent-permissions.js +2 -0
  207. package/dist/init/agent-permissions.js.map +1 -1
  208. package/dist/init/files/audit-files.js +1 -1
  209. package/dist/init/files/audit-files.js.map +1 -1
  210. package/dist/init/files/persistence-files.d.ts.map +1 -1
  211. package/dist/init/files/persistence-files.js +2 -0
  212. package/dist/init/files/persistence-files.js.map +1 -1
  213. package/dist/init/knip-vars.d.ts.map +1 -1
  214. package/dist/init/knip-vars.js +10 -2
  215. package/dist/init/knip-vars.js.map +1 -1
  216. package/dist/init/manifest/dependencies-against-stack.d.ts +18 -0
  217. package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -0
  218. package/dist/init/manifest/dependencies-against-stack.js +95 -0
  219. package/dist/init/manifest/dependencies-against-stack.js.map +1 -0
  220. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  221. package/dist/init/manifest/dependencies-for.js +12 -2
  222. package/dist/init/manifest/dependencies-for.js.map +1 -1
  223. package/dist/init/manifest/overrides-for.d.ts +7 -0
  224. package/dist/init/manifest/overrides-for.d.ts.map +1 -0
  225. package/dist/init/manifest/overrides-for.js +9 -0
  226. package/dist/init/manifest/overrides-for.js.map +1 -0
  227. package/dist/init/manifest/pinned-below-a-fix.d.ts +14 -0
  228. package/dist/init/manifest/pinned-below-a-fix.d.ts.map +1 -0
  229. package/dist/init/manifest/pinned-below-a-fix.js +20 -0
  230. package/dist/init/manifest/pinned-below-a-fix.js.map +1 -0
  231. package/dist/init/manifest/scripts-for.js +5 -2
  232. package/dist/init/manifest/scripts-for.js.map +1 -1
  233. package/dist/init/manifest/versions.d.ts.map +1 -1
  234. package/dist/init/manifest/versions.js +31 -25
  235. package/dist/init/manifest/versions.js.map +1 -1
  236. package/dist/init/manifest/write-overrides.d.ts +9 -0
  237. package/dist/init/manifest/write-overrides.d.ts.map +1 -0
  238. package/dist/init/manifest/write-overrides.js +56 -0
  239. package/dist/init/manifest/write-overrides.js.map +1 -0
  240. package/dist/init/run-init.d.ts.map +1 -1
  241. package/dist/init/run-init.js +19 -3
  242. package/dist/init/run-init.js.map +1 -1
  243. package/dist/init/stack/resolve-queue.d.ts +4 -10
  244. package/dist/init/stack/resolve-queue.d.ts.map +1 -1
  245. package/dist/init/stack/resolve-queue.js +7 -11
  246. package/dist/init/stack/resolve-queue.js.map +1 -1
  247. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  248. package/dist/init/stack/resolve-stack.js +23 -4
  249. package/dist/init/stack/resolve-stack.js.map +1 -1
  250. package/dist/init/stack/stack-options.d.ts +2 -0
  251. package/dist/init/stack/stack-options.d.ts.map +1 -1
  252. package/dist/nest-controllers/controllers-file.d.ts +3 -0
  253. package/dist/nest-controllers/controllers-file.d.ts.map +1 -0
  254. package/dist/nest-controllers/controllers-file.js +5 -0
  255. package/dist/nest-controllers/controllers-file.js.map +1 -0
  256. package/dist/nest-controllers/nest-answer.d.ts +16 -0
  257. package/dist/nest-controllers/nest-answer.d.ts.map +1 -0
  258. package/dist/nest-controllers/nest-answer.js +2 -0
  259. package/dist/nest-controllers/nest-answer.js.map +1 -0
  260. package/dist/nest-controllers/nest-controller-entry.d.ts +16 -0
  261. package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -0
  262. package/dist/nest-controllers/nest-controller-entry.js +2 -0
  263. package/dist/nest-controllers/nest-controller-entry.js.map +1 -0
  264. package/dist/nest-controllers/read-nest-controllers.d.ts +15 -0
  265. package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -0
  266. package/dist/nest-controllers/read-nest-controllers.js +89 -0
  267. package/dist/nest-controllers/read-nest-controllers.js.map +1 -0
  268. package/dist/nest-controllers/refresh-nest-controllers.d.ts +9 -0
  269. package/dist/nest-controllers/refresh-nest-controllers.d.ts.map +1 -0
  270. package/dist/nest-controllers/refresh-nest-controllers.js +32 -0
  271. package/dist/nest-controllers/refresh-nest-controllers.js.map +1 -0
  272. package/dist/nest-controllers/render-controllers-file.d.ts +8 -0
  273. package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -0
  274. package/dist/nest-controllers/render-controllers-file.js +56 -0
  275. package/dist/nest-controllers/render-controllers-file.js.map +1 -0
  276. package/dist/platform-folders/platform-folders.d.ts.map +1 -1
  277. package/dist/platform-folders/platform-folders.js +10 -0
  278. package/dist/platform-folders/platform-folders.js.map +1 -1
  279. package/dist/presets/apply-preset.d.ts.map +1 -1
  280. package/dist/presets/apply-preset.js +22 -2
  281. package/dist/presets/apply-preset.js.map +1 -1
  282. package/dist/presets/identity-preset.d.ts.map +1 -1
  283. package/dist/presets/identity-preset.js +4 -1
  284. package/dist/presets/identity-preset.js.map +1 -1
  285. package/dist/presets/identity-refusal.d.ts.map +1 -1
  286. package/dist/presets/identity-refusal.js +11 -5
  287. package/dist/presets/identity-refusal.js.map +1 -1
  288. package/dist/presets/lay-out-prisma-models.d.ts +8 -0
  289. package/dist/presets/lay-out-prisma-models.d.ts.map +1 -0
  290. package/dist/presets/lay-out-prisma-models.js +51 -0
  291. package/dist/presets/lay-out-prisma-models.js.map +1 -0
  292. package/dist/presets/preset-files.d.ts.map +1 -1
  293. package/dist/presets/preset-files.js +3 -0
  294. package/dist/presets/preset-files.js.map +1 -1
  295. package/dist/presets/preset.d.ts +11 -0
  296. package/dist/presets/preset.d.ts.map +1 -1
  297. package/dist/sdk/client-files.d.ts +5 -3
  298. package/dist/sdk/client-files.d.ts.map +1 -1
  299. package/dist/sdk/client-files.js +8 -3
  300. package/dist/sdk/client-files.js.map +1 -1
  301. package/dist/sdk/client-manifest.d.ts +3 -0
  302. package/dist/sdk/client-manifest.d.ts.map +1 -1
  303. package/dist/sdk/client-manifest.js +15 -2
  304. package/dist/sdk/client-manifest.js.map +1 -1
  305. package/dist/sdk/client-operation.d.ts +6 -0
  306. package/dist/sdk/client-operation.d.ts.map +1 -1
  307. package/dist/sdk/read-operation.d.ts.map +1 -1
  308. package/dist/sdk/read-operation.js +6 -0
  309. package/dist/sdk/read-operation.js.map +1 -1
  310. package/dist/sdk/render-orpc.d.ts +8 -0
  311. package/dist/sdk/render-orpc.d.ts.map +1 -0
  312. package/dist/sdk/render-orpc.js +42 -0
  313. package/dist/sdk/render-orpc.js.map +1 -0
  314. package/dist/sdk/render-readme.d.ts +3 -0
  315. package/dist/sdk/render-readme.d.ts.map +1 -1
  316. package/dist/sdk/render-readme.js +46 -0
  317. package/dist/sdk/render-readme.js.map +1 -1
  318. package/dist/sdk/render-trpc.d.ts +9 -0
  319. package/dist/sdk/render-trpc.d.ts.map +1 -0
  320. package/dist/sdk/render-trpc.js +36 -0
  321. package/dist/sdk/render-trpc.js.map +1 -0
  322. package/dist/sdk/rpc-packages.d.ts +7 -0
  323. package/dist/sdk/rpc-packages.d.ts.map +1 -0
  324. package/dist/sdk/rpc-packages.js +9 -0
  325. package/dist/sdk/rpc-packages.js.map +1 -0
  326. package/dist/sdk/rpc.d.ts +4 -0
  327. package/dist/sdk/rpc.d.ts.map +1 -0
  328. package/dist/sdk/rpc.js +2 -0
  329. package/dist/sdk/rpc.js.map +1 -0
  330. package/dist/sdk/write-clients.d.ts.map +1 -1
  331. package/dist/sdk/write-clients.js +18 -3
  332. package/dist/sdk/write-clients.js.map +1 -1
  333. package/dist/stack/alias-vars.d.ts.map +1 -1
  334. package/dist/stack/alias-vars.js +2 -2
  335. package/dist/stack/alias-vars.js.map +1 -1
  336. package/dist/stack/audit-vars.js +1 -1
  337. package/dist/stack/audit-vars.js.map +1 -1
  338. package/dist/stack/cache-vars.d.ts +5 -1
  339. package/dist/stack/cache-vars.d.ts.map +1 -1
  340. package/dist/stack/cache-vars.js +9 -3
  341. package/dist/stack/cache-vars.js.map +1 -1
  342. package/dist/stack/stack-vars.d.ts +1 -1
  343. package/dist/stack/stack-vars.d.ts.map +1 -1
  344. package/dist/stack/stack-vars.js +11 -6
  345. package/dist/stack/stack-vars.js.map +1 -1
  346. package/dist/version.d.ts +1 -1
  347. package/dist/version.js +1 -1
  348. package/package.json +4 -4
  349. package/templates/architecture/extractable.declared.spec.ts.tpl +22 -17
  350. package/templates/architecture/extractable.manual.spec.ts.tpl +14 -9
  351. package/templates/architecture/extractable.tsyringe.spec.ts.tpl +19 -14
  352. package/templates/context/module.manual.ts.tpl +11 -0
  353. package/templates/init/jest.config.js.tpl +6 -0
  354. package/templates/init/platform/composition/compose-application.manual.ts.tpl +50 -0
  355. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +9 -3
  356. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +1 -1
  357. package/templates/init/platform/database/persistence-over.knex.ts.tpl +1 -1
  358. package/templates/init/platform/database/persistence-over.prisma.ts.tpl +30 -1
  359. package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +23 -1
  360. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +113 -0
  361. package/templates/init/platform/database/persistence.orm.ts.tpl +8 -3
  362. package/templates/init/platform/database/schema.prisma.tpl +53 -0
  363. package/templates/init/platform/database/schema.typeorm.ts.tpl +17 -3
  364. package/templates/init/platform/database/table-statements.drizzle.ts.tpl +36 -0
  365. package/templates/init/platform/files/bind-files.tsyringe.ts.tpl +1 -1
  366. package/templates/init/platform/files/create-files.ts.tpl +1 -1
  367. package/templates/init/platform/http/create-app-module.ts.tpl +20 -0
  368. package/templates/init/platform/http/start-http-server.express.ts.tpl +48 -1
  369. package/templates/init/platform/http/start-http-server.fastify.ts.tpl +50 -2
  370. package/templates/init/platform/http/start-http-server.hono.ts.tpl +60 -1
  371. package/templates/init/platform/http/start-http-server.nest.ts.tpl +61 -3
  372. package/templates/init/platform/jobs/create-background-work.ts.tpl +2 -2
  373. package/templates/init/rules/infrastructure.md.tpl +3 -0
  374. package/templates/init/rules/presentation.md.tpl +7 -0
  375. package/templates/nest-controller/controller.spec.ts.tpl +57 -0
  376. package/templates/nest-controller/controller.ts.tpl +65 -0
  377. package/templates/pipeline/knip.json.tpl +4 -8
  378. package/templates/pipeline/package-scripts.json +1 -1
  379. package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +254 -0
  380. package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +10 -0
  381. package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +10 -0
  382. package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +10 -0
  383. package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +10 -0
  384. package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +10 -0
  385. package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +10 -0
  386. package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +10 -0
  387. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +6 -0
  388. package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +12 -0
  389. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +6 -0
  390. package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +12 -0
  391. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +6 -0
  392. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +12 -0
  393. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +6 -0
  394. package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +12 -0
  395. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +6 -0
  396. package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +12 -0
  397. package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +6 -0
  398. package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +12 -0
  399. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +6 -0
  400. package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +12 -0
  401. package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +6 -0
  402. package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +12 -0
  403. package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +6 -0
  404. package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +12 -0
  405. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +6 -0
  406. package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +12 -0
  407. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +6 -0
  408. package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +12 -0
  409. package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +4 -0
  410. package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +4 -0
  411. package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +4 -0
  412. package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +4 -0
  413. package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +10 -1
  414. package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +10 -1
  415. package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +10 -1
  416. package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +10 -1
  417. package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +10 -1
  418. package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +10 -1
  419. package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +10 -1
  420. package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +12 -0
  421. package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +6 -0
  422. package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +9 -0
  423. package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +9 -0
  424. package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +9 -0
  425. package/templates/presets/identity/context/infrastructure/persistence/account.mapper.prisma.ts.tpl +36 -0
  426. package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.prisma.ts.tpl +19 -0
  427. package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.prisma.ts.tpl +48 -0
  428. package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +9 -0
  429. package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +9 -0
  430. package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +9 -0
  431. package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +9 -0
  432. package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +9 -0
  433. package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +9 -0
  434. package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.prisma.ts.tpl +43 -0
  435. package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.prisma.ts.tpl +20 -0
  436. package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +9 -0
  437. package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +9 -0
  438. package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +9 -0
  439. package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +9 -0
  440. package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +9 -0
  441. package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +9 -0
  442. package/templates/presets/identity/context/infrastructure/persistence/member.mapper.prisma.ts.tpl +34 -0
  443. package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.prisma.ts.tpl +26 -0
  444. package/templates/presets/identity/context/infrastructure/persistence/prisma-account.repository.prisma.ts.tpl +63 -0
  445. package/templates/presets/identity/context/infrastructure/persistence/prisma-delegation.repository.prisma.ts.tpl +81 -0
  446. package/templates/presets/identity/context/infrastructure/persistence/prisma-invitation.repository.prisma.ts.tpl +69 -0
  447. package/templates/presets/identity/context/infrastructure/persistence/prisma-member.repository.prisma.ts.tpl +80 -0
  448. package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation.repository.prisma.ts.tpl +63 -0
  449. package/templates/presets/identity/context/infrastructure/persistence/prisma-search-members-reader.repository.prisma.ts.tpl +82 -0
  450. package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +3 -3
  451. package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +5 -5
  452. package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +5 -5
  453. package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +5 -5
  454. package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +3 -3
  455. package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +8 -8
  456. package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +95 -0
  457. package/templates/presets/identity/context/test/worlds/__context__.world.explicit.ts.tpl +332 -0
  458. package/templates/presets/identity/explicit/access-policies.wiring.tpl +16 -0
  459. package/templates/presets/identity/prisma/models.prisma.tpl +128 -0
  460. package/templates/property/value-object.properties.spec.ts.tpl +38 -0
  461. package/templates/sdk/orpc.ts.tpl +46 -0
  462. package/templates/sdk/trpc.ts.tpl +86 -0
  463. /package/templates/presets/identity/context/test/worlds/{__context__.world.ts.tpl → __context__.world.declared.ts.tpl} +0 -0
package/README.md CHANGED
@@ -82,8 +82,11 @@ of the project write them for a project without a route or an integration event
82
82
  `"openapi": { "format": "json" }` of the config), so that the first commit holds them and
83
83
  `docs:check` passes at once; a contract that is already there is
84
84
  left alone, `--force` included. An existing `package.json` is merged: missing scripts and
85
- dependencies are added, yours are kept and mentioned in the notes. Run again later, `init` keeps
86
- the stack recorded in the config.
85
+ dependencies are added, yours are kept and mentioned in the notes. The first time, the notes also
86
+ name each dependency the stack about to be written contradicts, and the flag that keeps it
87
+ (`package.json depends on fastify, and the project is written for --http express: pass --http
88
+ fastify to keep it.`), a dry run included: run `init --dry-run` first on an existing project.
89
+ Run again later, `init` keeps the stack recorded in the config.
87
90
 
88
91
  `init --force` on a project that is already initialised rewrites the files `init` owns and keeps
89
92
  the config: the contexts and their upstreams, the rules, the limits, the deviations and every
@@ -125,6 +128,11 @@ recorded under `stack.packageManager`. pnpm is pinned in `package.json` and prov
125
128
  `pnpm-workspace.yaml` says that no dependency runs a build script unless allowed by name. Both are
126
129
  proven by a real install of a generated project, its build and its `verify`. The kit is installed
127
130
  from the registry either way.
131
+ The project forces the versions that close a vulnerability its stack still pins below the fix, in
132
+ `overrides` of `package.json` under npm and of `pnpm-workspace.yaml` under pnpm, which reads
133
+ nothing of `package.json`: qs `^6.16.0`, which Stryker asks for at 6.15.1 through
134
+ `typed-rest-client`, and under `--http nest` multer `^2.5.0`, which `@nestjs/platform-express`
135
+ asks for at 2.4.0. An override the project already sets for one of them is kept, and said.
128
136
 
129
137
  **Pipelines.** A pull or merge request runs the unit specs, the integration specs and the lint of
130
138
  the contexts its change reaches through the context map ([`ddd-ts-kit affected`](#affected)); types,
@@ -446,7 +454,9 @@ schema per route, an identifier answer included, as 0.1 to 0.5 wrote them.
446
454
  `generate value-object` writes a `create` that returns the value object or throws the refusal of
447
455
  its concept, and a spec that asserts it with `expectRefusal(() => ..)`. `--value-objects result`,
448
456
  or a config without the key, keeps a `create` returning a `Result` that the caller unwraps, as 0.1
449
- to 0.5 wrote it; `value-objects` moves a project from one to the other.
457
+ to 0.5 wrote it; `value-objects` moves a project from one to the other. `generate property` writes
458
+ the laws of an existing value object as a spec on generated values, in either form, and adds
459
+ `fast-check` to the development dependencies when it is missing.
450
460
 
451
461
  **Domain events leave with the save.** A generated command handler builds or loads its aggregate,
452
462
  calls one intention method, `await repository.save(aggregate)` and returns: no `pullEvents()`, and
@@ -539,14 +549,14 @@ config, `docsUi`, `ci` and `logger` included.
539
549
  | `--event-sourcing on` | recorded as `stack.eventSourcing`, `off` unless asked: `Persistence` gains `eventSourcing` (`create<Orm>EventSourcing` in the `event_store` schema, whose five tables the schema file declares; the in-memory stores with `--orm none`), and `src/platform/event-sourcing/`: `create-event-sourcing.ts` (`EventSourcing`: the stores, the `SubjectKeyStore` wrapped by `auditedSubjectKeys` with `--audit on`, and the `PersonalDataCipher` over it) and, on tsyringe, `event-sourcing.module.ts` (binds `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` and `PersonalDataCipher`, so an event-sourced repository adapter names them in its constructor; the hand-wired `Platform` carries them as `platform.eventSourcing`); `platform-test.module.ts` binds the in-memory stores, so a handler spec of an event-sourced aggregate needs no fake. `generate aggregate --event-sourced` is refused without it, with the `init --force --event-sourcing on` to run. Refused with `--orm custom`: the event store of the kit runs on PostgreSQL through the four ORM packages |
540
550
  | `--privacy on` | recorded as `stack.privacy`, `on` when there is an ORM: `src/platform/privacy/`, with `data-subject-copies.ts` and `data-subject-exports.ts` (the ports, or the adapters by hand, of the contexts that extend `PersonalDataErasure` and `PersonalDataExport`, between markers; `generate repository --personal` lists the erasure and the export of a context there), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, tenants? })`: an execution context of origin `cli` with the operator as actor, the key of the subject when the project has an event store, then `eraseDataSubject` of the kernel over the copies, `inEachTenant` with `--tenancy shared-table`, then `privacy.data-subject.erased` published through the outbox, once per tenant) and `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })`: `exportDataSubject` of the kernel over the exports, each wrapped by `auditedPersonalDataExport` with `--audit on`, `recordsInEachTenant` with `--tenancy shared-table`, one dated `PersonalDataExportDocument`), and the two scripts below. `docs/privacy/register.md`, the register of personal data `ddd-ts-kit docs` keeps (see `docs` below). A project without personal data takes `--privacy off` and pays nothing. No HTTP command erases yet: the two scripts are the entry points |
541
551
  | `--tenancy shared-table` | recorded as `stack.tenancy`; the four ORMs. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` (Knex), `tenantCondition` and `ownTenantCondition` (Drizzle), `tenantWhere` and `ownTenantWhere` (Prisma, TypeORM); the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, `tenantOutboxTable`, the `tenantId` field of the Prisma model and `PrismaOutboxStore`'s `tenant: true`, `outboxEntity({ tenant: true })`), so consumers run in it; `tenancy/scoped-statement` judges the adapters. Row-level security, schema per tenant and database per tenant are refused, with what to wire by hand ([Multitenancy](../../docs/concepts/multitenancy.md)) |
542
- | `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex or Drizzle with tsyringe): `createJobTable` and `createProcessTable`, or `jobsTable` and `processesTable`, in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform binds `JobStore` and `ProcessStore` to them (the platform module on tsyringe, `jobs/create-background-work.ts` where the platform is wired by hand), so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default otherwise): nothing is written, both stay in the process. Refused: `database` with another ORM, `redis` without the cache |
552
+ | `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex, Drizzle, Prisma and TypeORM, whatever the container): the tables of the ORM package (`createJobTable` and `createProcessTable`, `jobsTable` and `processesTable`, the `BackgroundJob` and `ProcessInstance` models, `jobEntity` and `processEntity`) in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform binds `JobStore` and `ProcessStore` to them (the platform module on tsyringe, `jobs/create-background-work.ts` where the platform is wired by hand or under Nest), so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default with a custom persistence or none): nothing is written, both stay in the process. Refused: `database` with another ORM, `redis` without the cache |
543
553
  | `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices`: the cache bound to the kernel `Cache`, the limiter to `RateLimiter`, the lock to `Lock`, which keeps a scheduled job to one instance, the relay signal as the `wakeOn` of the outbox relay with `relayWakeUpMiddleware` on the command bus), `http/too-many-requests-for.ts` (one sliding window per caller address, 429 `application/problem+json` with `retry-after`; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` on the HTTP server, `REDIS_URL` validated, a compose service `cache` running Dragonfly with a healthcheck. Without a server (tools, tests without `REDIS_URL`) the same ports stay in the memory of the process |
544
554
  | `--http-cache varnish` | a compose service `varnish` (Varnish 9.1.0, reaching the API on `host.docker.internal`) with its VCL in `docker/varnish/default.vcl` (only answers whose `Cache-Control` allows them by `max-age` or `s-maxage` are kept, filed under their `xkey` tags, purged by `PURGE` from the machine of Varnish or with `VARNISH_PURGE_KEY`, `x-cache: HIT\|MISS`), `VARNISH_URL` and `VARNISH_PURGE_KEY` validated, `cacheTags: { header: CacheTagHeader.xkey }` in the HTTP boundary, and the outbox relay of `main.ts` and of every `generate service` entry point publishing through `PurgingPublisher` with `VarnishCachePurger` (the end-to-end application records the purges in `purges`); on `--di manual` and `nest` the platform gains `cacheInvalidation`; with `--tenancy`, the tags of the answers and the purges are filed under the tenant (`perTenant`) and the tenant of a request is read from `x-tenant-id`. Needs an HTTP framework and `--events outbox`: a purge is a row of the outbox |
545
555
  | `--errors sentry` | unexpected failures reported to Sentry or GlitchTip (one protocol, only the DSN differs) through the kernel `ErrorReporter`, bound to `@ddd-ts-kit/sentry`. `src/platform/observability/errors.ts` (`initSentry` on the validated configuration, then `reportProcessFailures`), the second import of `main.ts`, of `apps/<context>/main.ts` and of `apps/worker/main.ts`, right after `tracing.ts`; `errors` handed to `composeApplication`, which gives it to the kernel module on tsyringe (`errorReporter`, flushed by `container.stop()` before the logger, `errorReportingMiddleware` first on both buses, the default scheduler observing with `reportFailedRuns`) or to `createPlatform` by hand (the same middleware, `onRun: reportFailedRuns(errors)`, `platform.errors`, flushed two seconds at most when the application stops); `reportHttpErrors` in `auth/authentication/http-boundary.ts` for every request answered 5xx; `DeadLetterReports` on the `onFailure` hook of a provided broker (`createEventProvider(config, errors)`, with `observing` around each consumer) and of the outbox relay. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (default: `NODE_ENV`), `SENTRY_RELEASE` and `SENTRY_SCRUB_MESSAGES` validated in `config/load-config.ts` as `errorReporting`: without a DSN the application starts and reports nothing; a DSN that is not a URL refuses the start. Dependencies `@ddd-ts-kit/sentry` and `@sentry/node`. A compose profile `errors` running GlitchTip 6.2.6 with its own PostgreSQL and Valkey (`GLITCHTIP_PORT`, loopback only, development bootstrap), and a section of the generated README saying how to read its DSN. The tools and the tests compose the application without a reporter. It goes with every other choice of the stack; with `--errors none` nothing of this is written |
546
556
  | `--authn keycloak` | a compose service `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profile `identity`) and `docker/keycloak/<project>-realm.json`: the API client, a public client `<project>-local` with the direct grant, its audience and `tenant_id` mappers, the realm role `admin`, and the demo users `demo-admin` and `demo-user`, for local development only |
547
557
  | `--storage local\|s3` | recorded as `stack.storage`: where the content of files lives, never in the database. `src/platform/config/read-files.ts` and `src/platform/files/open-files.ts`, one per choice: `local`, a directory in development (`FILES_DIRECTORY`, `.data/files`) and the signed links answered by the application under `/files` (`FILES_PUBLIC_URL` and `FILES_SIGNING_SECRET` required in production); `s3`, a bucket of any provider of the S3 protocol through `@ddd-ts-kit/s3` (the `S3_*` variables, MinIO in the compose stack); the memory of the process in the tests and the tools, either way. With `--di tsyringe`: `files/bind-files.ts`, `files/files.module.ts` and `files/staging-uploads.ts`; with hand wiring `files/create-files.ts`; with an HTTP stack `files/file-routes.ts`. They bind `FileStorage`, `FileKeys`, `FileScanner` and `FileStaging`, register the hourly purge of staged files and stage the file a command carries before its transaction; `generate file-upload` needs them. `--storage none` writes none of this ([File storage](../../docs/concepts/file-storage.md)) |
548
558
  | `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, and for `--broker` `create-event-provider.ts`: `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, with `aggregate-key-of.ts` for per-aggregate order), `NatsEventBus` (`NATS_URL`) or `RedisStreamsEventBus` of `@ddd-ts-kit/redis/event-bus` (`REDIS_URL`: Redis, Dragonfly or Valkey), each with one subscriber per consuming context (`forConsumer`), `assertTopology` at start, its address validated and a compose service with a healthcheck; or `custom-event-bus.ts` with its `eventBusContract` spec. `start-outbox-relay.ts` with the outbox. `--broker redis` with `--cache redis` is one server and one compose service, `cache`; alone, the service is `streams` |
549
- | `src/platform/database/` | `persistence.ts` (`interface Persistence`: unit of work, outbox and processed-event stores of the ORM package, the storage handle), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, the connection (`connect-to-database.ts`, `create-client.ts` or `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, the schema of what the kit stores for the application), `open-test-database.ts` (PostgreSQL in process, or the server named by a URL; with Vitest each spec opens a copy of the cluster `test/support/test-database-template.ts`, the global setup of the run, initialised once, and creates its tables there; with drizzle from `table-statements.ts`, the SQL of the tables of `schema.ts`, since drizzle-kit writes migrations, not tables). The storage class a repository adapter names in its dependency list: `database.ts` with drizzle and prisma (`abstract class Database extends` the context type of the ORM package), `KnexContext` of `@ddd-ts-kit/knex`, `TypeOrmContext` of `@ddd-ts-kit/typeorm` |
559
+ | `src/platform/database/` | `persistence.ts` (`interface Persistence`: unit of work, outbox and processed-event stores of the ORM package, the storage handle), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, the connection (`connect-to-database.ts`, `create-client.ts` or `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, the schema of what the kit stores for the application), `open-test-database.ts` (PostgreSQL in process, or the server named by a URL; with Vitest each spec opens a copy of the cluster `test/support/test-database-template.ts`, the global setup of the run, initialised once, and creates its tables there; with drizzle from `table-statements.ts`, the SQL of the tables of `schema.ts`, since drizzle-kit writes migrations, not tables, its unique indexes included), `persistence.contract.spec.ts` (the outbox, processed-event, job and process stores as the platform wires them, held to the contracts of `@ddd-ts-kit/testing` with what the stack turns on: the tenant under `--tenancy`, the unit of work). The storage class a repository adapter names in its dependency list: `database.ts` with drizzle and prisma (`abstract class Database extends` the context type of the ORM package), `KnexContext` of `@ddd-ts-kit/knex`, `TypeOrmContext` of `@ddd-ts-kit/typeorm` |
550
560
  | migration tooling | `drizzle.config.ts`, `knexfile.js` and `migrations/00000000000000_initial.js`, `prisma/schema.prisma` and `prisma.config.ts`, or `data-source.ts` |
551
561
  | `scripts/openapi.ts`, `scripts/events.ts` | write `openapi/openapi.yaml` (one file per document of `openapi.documents`), `docs/integration/asyncapi.yaml` and `docs/integration/event-catalog.md`, in JSON under `openapi.format: json`; `--check` fails on a difference |
552
562
  | `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | with `--privacy on`, the two requests of a data subject, answered from the command line on the sources with the variables of `.env` (`npm run privacy:erase -- <subject-id> [--operator <who-asks>]`, `npm run privacy:export -- <subject-id> > export.json`): the erasure destroys the key of the subject first when the project has an event store (`--event-sourcing on`: its stored events read as erased; audited with `--audit on`), then erases every copy listed in `src/platform/privacy/data-subject-copies.ts`; `privacy:purge` runs by hand what the job `privacy.purge-expired` runs every night at 03:00 UTC, the purge of what outlived its retention (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` switches the job off); the export gathers every record listed in `data-subject-exports.ts` into one dated JSON document (`format`, `subject`, `exportedAt`, `records`), the export of each context audited with `--audit on`, never the values (every run leaves its entry, a trial included: try it on a test subject). With `--tenancy shared-table`, `TENANTS` names the tenants, comma separated: a write of tenant data is never widened. Neither reaches backups, logs or a copy no context declared |
@@ -1527,14 +1537,23 @@ the workspace installs, its packages resolved as Node does, from the project up;
1527
1537
  `engines.node` accepts (`nvm use`), `npm ci`, the packages of the kit upgraded together,
1528
1538
  `git submodule update --init --recursive`.
1529
1539
 
1540
+ Last, on what is installed, the overrides `init` writes under a dependency that pins a package
1541
+ below a security fix (qs under Stryker, multer under Nest): the range the installed parent asks
1542
+ for, found from the real place of each package as Node finds it, against the overrides of
1543
+ `package.json` under npm or of `pnpm-workspace.yaml` under pnpm. An override the project lacks
1544
+ while the parent still pins the package below the fix is `missing`, and `init` adds it; one the
1545
+ project keeps once the parent asks for the fixed version itself is `no longer needed`, to remove,
1546
+ as it would hold the package back when a later major is asked for. A chain that is not installed
1547
+ is not judged.
1548
+
1530
1549
  `--strict` exits 1 while something is missing or at another range, or while the checkout cannot
1531
1550
  run the project: a Node outside `engines.node`, no `node_modules`, a package of the kit not
1532
- installed or at another version, a submodule not initialised. A script written otherwise, a hook
1533
- this clone has not installed, a Node `.nvmrc` does not name while `engines.node` accepts it, and a
1534
- lockfile changed since the install (a checkout may rewrite it with what `node_modules` already
1535
- holds) are said without failing it. `--json` prints `{ version, findings: [{ area, name, problem,
1551
+ installed or at another version, a submodule not initialised, an override missing. A script
1552
+ written otherwise, a hook this clone has not installed, a Node `.nvmrc` does not name while
1553
+ `engines.node` accepts it, a lockfile changed since the install (a checkout may rewrite it with
1554
+ what `node_modules` already holds), and an override no longer needed are said without failing it. `--json` prints `{ version, findings: [{ area, name, problem,
1536
1555
  expected, found }] }`, `area` being `script`, `package`, `permission`, `hook`, `guidance`, `node`,
1537
- `install` or `submodule`.
1556
+ `install`, `submodule` or `override`.
1538
1557
 
1539
1558
  ## worker-scope
1540
1559
 
@@ -1896,6 +1915,7 @@ generated pipelines wire all three.
1896
1915
  ```
1897
1916
  ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab]
1898
1917
  [--changed-since <git-ref>] [--explain] [--self]
1918
+ ddd-ts-kit check --baseline write|prune
1899
1919
  ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]
1900
1920
  ddd-ts-kit check --commit-size [--staged] [--strict]
1901
1921
  ```
@@ -1955,6 +1975,23 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1955
1975
  `ddd-ts-kit explain <rule-id>` prints the same kind of bad and good example for every rule.
1956
1976
 
1957
1977
  - `paths` and `--changed-since` limit what is reported, not what is analysed.
1978
+ - `--baseline write` records the errors a project already has, counted by file and by rule, in
1979
+ `ddd-ts-kit-baseline.json` (the shape of `eslint-suppressions.json`), for a codebase that adopts
1980
+ the kit; commit it. From then on `check` and `check-file` (the hook of the agent) leave quiet the
1981
+ errors of a rule in a file while they are no more than the baseline records, and report all of
1982
+ them once they are more; `check` fails when a recorded count is no longer reached, until
1983
+ `--baseline prune` lowers it, so that the baseline only shrinks. Warnings are not recorded: they
1984
+ fail nothing. Writing a baseline is a decision of the project owner, who runs `--baseline write`
1985
+ in a terminal: the guard of the plugin refuses the command and any direct edit of the file to an
1986
+ agent, under Claude Code, Codex and Copilot alike, and the permissions `init` writes ask before
1987
+ both for an agent without the plugin. A command the guard does not read (a script of the
1988
+ project that writes the file) is not caught: the review reads the diff of the baseline, which
1989
+ should only shrink. `--baseline prune` needs no one. A file that moves keeps its counts: the
1990
+ commands of the kit that move files (`move-to-module`, `context-layout`, `platform-folders`)
1991
+ carry its entry to the new path, and `--baseline prune` follows the renames git sees since the
1992
+ baseline was committed (a `git mv`); a file moved otherwise reports its errors at its new path,
1993
+ and its old entry fails until the owner writes the baseline again. A baseline makes old errors quiet; it does
1994
+ not make a tree outside the canonical one checkable.
1958
1995
  `--changed-since` runs `git diff --name-only --relative <ref>...` in the project.
1959
1996
  - `--format github` prints `::error file=...,line=...::` annotations.
1960
1997
  - `--explain` follows the violations with each rule they report, once, with its description and
@@ -2053,6 +2090,8 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
2053
2090
  | `authz/fields-by-schema` | under `application/queries/`: `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, a comparison with a `role`, `isAdmin` |
2054
2091
  | `aspects/outside-in` | an import of `@ddd-ts-kit/aspects/decorators` outside `infrastructure/` of a context and the platform directory: `presentation/`, the module file, `published-language/`, the shared kernel, `main.ts`, any other source (`domain/` and `application/` are reported by the two `layer/*` rules instead) |
2055
2092
  | `tracing/platform-only` | an import of `@ddd-ts-kit/tracing` or of an `@opentelemetry/*` package outside the platform directory, `main.ts` and `apps/`, tests included |
2093
+ | `nest/no-parallel-pipeline` | in `presentation/`, `infrastructure/` or the module file of a context, tests apart: an import of a controller Nest serves (its route and parameter decorators, unless the file imports `KitRoute` or `KitRoutes` of `@ddd-ts-kit/http/nest`), the raw request or answer, a guard, a pipe, an exception filter or an `HttpException`, an interceptor or the `Logger` of `@nestjs/common`, a bare import of it, or an import of a package of Nest whose work the kit does (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` and the others of section 3 of ARCHITECTURE.md); the message names what the kit does in its place; under the source root outside the contexts, tests apart: a file that imports `Controller` of `@nestjs/common`, neither `KitRoute` nor `KitRoutes`, and names `CommandBus` or `QueryBus` or imports a file of a context |
2094
+ | `nest/controllers-current` | with `"stack.routes": "nest"`: a `<context>.controllers.ts` that differs from what the Nest controllers of the context and the signatures of their methods give, or is missing; a route method that answers no DTO class, `Accepted` or `void` and declares no `response` in `@KitRoute` |
2056
2095
  | `tenancy/scoped-statement` | with `stack.tenancy` other than `none`, in `infrastructure/` of a context, tests aside: on Knex the executor used other than as an argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) and any `.raw(`; on Drizzle, statement by statement, a read, update or delete on the executor whose where has no `tenantCondition(` nor `ownTenantCondition(` (inline or in the local it is given), an insert whose row has no `tenantScopeOf(`, a relational query (`executor().query`), a raw `execute(`, or the executor held in a variable; on Prisma, statement by statement on the client, a read (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) whose where spreads no `tenantWhere(`, an update or a delete whose where spreads no `ownTenantWhere(`, a create whose data spreads no `tenantScopeOf(` (inline or in a local the arguments name), `findUnique(`, `upsert(`, a raw query (`$queryRaw`, `$executeRaw`), or the client held in a variable; on TypeORM the same on the manager (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, the row handed to `insertIgnoringConflict(`, a query builder whose where carries no condition, `save(`, `upsert(`, `query(`); on the four, a read model store built without its `tenant` option. A where built by another function is not followed |
2057
2096
  | `standard/no-parallel-interface` | a class, interface or type alias declared as `ILogger`, `AppLogger`, `LoggerService`, `LoggerInterface`, `IMetrics`, `MetricsService`, `ICache`, `CacheService`, `UserContext`, `CurrentUser`, `AuthContext`, `RequestContext` (outside `presentation/` and the platform), `UserSession`, `AuthSession`, `SessionData`, `PaginatedResult`, `PageResult`, `PaginatedResponse`, `Paginated`, `PaginationParams`, `PageParams`, `AuditLog`, `AuditLogEntry`, `AuditRecord`, `IJobScheduler`, `JobSchedulerService`, `CronScheduler`, `TaskScheduler`, `IScheduledJob`, `CronJob`, `ScheduledTask`, `BackgroundJob`, `IErrorReporter`, `ErrorReporterService`, `ErrorTracker`, `ExceptionReporter`, `CrashReporter`, `CacheInvalidator`, `CacheInvalidationService`, `CachePurgeService`, `CdnPurger`, `I` followed by a standard name (`IClock`, `IIdGenerator`, `IUnitOfWork`, `ISession`, ...) or a name of `standardInterfaces`; a class that implements or extends the standard interface is an adapter and is not reported |
2058
2097
  | `events/outbox-required` | `stack.events` other than `outbox` with an ORM and no `stack.events` deviation; in `domain/` and `application/`, the import of a broker client or of a bus or relay implementation; a publisher depending on more than `IntegrationEventPublisher`; a platform module that hands out a publisher and never names `OutboxPublisher` |
@@ -2215,12 +2254,16 @@ import is judged by every boundary rule exactly as the relative path to the same
2215
2254
  ## check-file
2216
2255
 
2217
2256
  ```
2218
- ddd-ts-kit check-file <path>
2257
+ ddd-ts-kit check-file <path> [--content-from <file>] [--rule <id>]...
2219
2258
  ```
2220
2259
 
2221
2260
  Runs the per-file rules (layers, contexts, naming, events, language, purity, clean code, mocks,
2222
2261
  composition, suppressions) on one file without walking the project: meant for an editor or
2223
2262
  agent hook after each write. A file that is not a source of the project is ignored.
2263
+ `--content-from <file>` judges the text of that file as the content of `<path>`, which need not
2264
+ exist yet: what a session is about to write, as the guard of the plugin reads it before the write
2265
+ under `"dependenciesBeforeWrite": true`. `--rule` narrows the rules; the baseline of the project
2266
+ applies as for a file on disk.
2224
2267
 
2225
2268
  ## lint
2226
2269
 
@@ -8,7 +8,8 @@ export type { BuildLayout } from './build-layout.js';
8
8
  export { DEFAULT_BUILD_LAYOUT } from './default-build-layout.js';
9
9
  export { directoryAlias } from './directory-alias.js';
10
10
  export { FIXED_ALIAS_ROOTS } from './fixed-alias-roots.js';
11
- export { moduleNameMapper } from './module-name-mapper.js';
11
+ export { moduleNameMapper, type MapperTarget } from './module-name-mapper.js';
12
+ export { mapperTargetText } from './mapper-target-text.js';
12
13
  export { specifierOf } from './specifier-of.js';
13
14
  export { specifierSuffix } from './specifier-suffix.js';
14
15
  export { toAlias } from './to-alias.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -7,6 +7,7 @@ export { DEFAULT_BUILD_LAYOUT } from './default-build-layout.js';
7
7
  export { directoryAlias } from './directory-alias.js';
8
8
  export { FIXED_ALIAS_ROOTS } from './fixed-alias-roots.js';
9
9
  export { moduleNameMapper } from './module-name-mapper.js';
10
+ export { mapperTargetText } from './mapper-target-text.js';
10
11
  export { specifierOf } from './specifier-of.js';
11
12
  export { specifierSuffix } from './specifier-suffix.js';
12
13
  export { toAlias } from './to-alias.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAA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Ae,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { MapperTarget } from './module-name-mapper.js';
2
+ /** A target of the mapper as `jest.config.js` writes it: one path, or the paths tried in order. */
3
+ export declare function mapperTargetText(target: MapperTarget): string;
4
+ //# sourceMappingURL=mapper-target-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper-target-text.d.ts","sourceRoot":"","sources":["../../src/alias/mapper-target-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,5 @@
1
+ /** A target of the mapper as `jest.config.js` writes it: one path, or the paths tried in order. */
2
+ export function mapperTargetText(target) {
3
+ return typeof target === 'string' ? `'${target}'` : `[${target.map((path) => `'${path}'`).join(', ')}]`;
4
+ }
5
+ //# sourceMappingURL=mapper-target-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper-target-text.js","sourceRoot":"","sources":["../../src/alias/mapper-target-text.ts"],"names":[],"mappings":"AAEA,mGAAmG;AACnG,MAAM,UAAU,gBAAgB,CAAC,MAAoB;IACnD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1G,CAAC"}
@@ -1,8 +1,11 @@
1
1
  import type { AliasRoot } from './alias-root.js';
2
+ /** Where jest looks for the source of an alias specifier, in order. */
3
+ export type MapperTarget = string | readonly string[];
2
4
  /**
3
5
  * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias
4
6
  * specifier, written with `suffix` (the `.js` of the compiled file, or nothing), answers the
5
- * TypeScript source and nothing else.
7
+ * TypeScript source and nothing else. Without an ending, a specifier can name a directory, whose
8
+ * barrel jest then finds after the file: `$1.ts`, then `$1/index.ts`.
6
9
  */
7
- export declare function moduleNameMapper(roots: readonly AliasRoot[], suffix: string): Record<string, string>;
10
+ export declare function moduleNameMapper(roots: readonly AliasRoot[], suffix: string): Record<string, MapperTarget>;
8
11
  //# sourceMappingURL=module-name-mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-name-mapper.d.ts","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASpG"}
1
+ {"version":3,"file":"module-name-mapper.d.ts","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAW1G"}
@@ -2,13 +2,16 @@ const SPECIAL = /[.*+?^${}()|[\]\\]/g;
2
2
  /**
3
3
  * The `moduleNameMapper` of jest for these roots, which does not read tsconfig: an alias
4
4
  * specifier, written with `suffix` (the `.js` of the compiled file, or nothing), answers the
5
- * TypeScript source and nothing else.
5
+ * TypeScript source and nothing else. Without an ending, a specifier can name a directory, whose
6
+ * barrel jest then finds after the file: `$1.ts`, then `$1/index.ts`.
6
7
  */
7
8
  export function moduleNameMapper(roots, suffix) {
8
9
  const ending = suffix.replace(SPECIAL, String.raw `\$&`);
9
10
  return Object.fromEntries(roots.map(({ prefix, directory }) => [
10
11
  `^${prefix.replace(SPECIAL, String.raw `\$&`)}(.*)${ending}$`,
11
- `<rootDir>/${directory}/$1.ts`,
12
+ suffix === ''
13
+ ? [`<rootDir>/${directory}/$1.ts`, `<rootDir>/${directory}/$1/index.ts`]
14
+ : `<rootDir>/${directory}/$1.ts`,
12
15
  ]));
13
16
  }
14
17
  //# sourceMappingURL=module-name-mapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-name-mapper.js","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA2B,EAAE,MAAc;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,OAAO,MAAM,GAAG;QAC5D,aAAa,SAAS,QAAQ;KAC/B,CAAC,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"module-name-mapper.js","sourceRoot":"","sources":["../../src/alias/module-name-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAKtC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA2B,EAAE,MAAc;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAA,KAAK,CAAC,OAAO,MAAM,GAAG;QAC5D,MAAM,KAAK,EAAE;YACX,CAAC,CAAC,CAAC,aAAa,SAAS,QAAQ,EAAE,aAAa,SAAS,cAAc,CAAC;YACxE,CAAC,CAAC,aAAa,SAAS,QAAQ;KACnC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import { moduleNameMapper, specifierSuffix } from '../../alias/index.js';
2
+ import { mapperTargetText, moduleNameMapper, specifierSuffix } from '../../alias/index.js';
3
3
  import { escapeRegExp } from '../text/escape-reg-exp.js';
4
4
  import { ALIAS_FILES } from './alias-files.js';
5
5
  import { readProjectFile } from './read-project-file.js';
@@ -34,13 +34,18 @@ function jest({ report, roots, project }, file, text) {
34
34
  return Object.entries(moduleNameMapper(roots, specifierSuffix(project.config.importExtension)))
35
35
  .filter(([pattern, target]) => !mapped(text, pattern, target))
36
36
  .map(([pattern, target]) => {
37
- const entry = `'${pattern.replaceAll('\\', '\\\\')}': '${target}'`;
37
+ const entry = `'${pattern.replaceAll('\\', '\\\\')}': ${mapperTargetText(target)}`;
38
38
  return report({ file, line: 1 }, `${file} does not map the import alias "${pattern}" as ${TYPE_CHECK} declares it.`, `Write ${entry} under "moduleNameMapper": jest does not read tsconfig, so the mapping is repeated there, with the ending "importExtension" gives an import, and a spec would otherwise fail on its first alias import or load another file.`);
39
39
  });
40
40
  }
41
+ /** Whether the config maps `pattern` to `target`: one path, or the same paths in the same order, however they are laid out. */
41
42
  function mapped(text, pattern, target) {
42
43
  const written = escapeRegExp(pattern.replaceAll('\\', '\\\\'));
43
- return new RegExp(`['"]${written}['"]\\s*:\\s*['"]${escapeRegExp(target)}['"]`).test(text);
44
+ const quoted = (path) => `['"]${escapeRegExp(path)}['"]`;
45
+ const value = typeof target === 'string'
46
+ ? quoted(target)
47
+ : String.raw `\[\s*${target.map(quoted).join(String.raw `\s*,\s*`)}\s*,?\s*\]`;
48
+ return new RegExp(`['"]${written}['"]\\s*:\\s*${value}`).test(text);
44
49
  }
45
50
  function rootFiles(root) {
46
51
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"test-runners.js","sourceRoot":"","sources":["../../../src/check/alias/test-runners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,aAAa,GAAG,gEAAgE,CAAC;AACvF,mFAAmF;AACnF,MAAM,eAAe,GAAG,2CAA2C,CAAC;AACpE,MAAM,cAAc,GAAG,8BAA8B,CAAC;AACtD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB;IAC9C,OAAO,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5D,IAAI,MAAM,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC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ement {
4
+ /** Whether an entry the run no longer reaches is an error: only when every rule ran on every file. */
5
+ readonly stale: boolean;
6
+ }
7
+ /**
8
+ * The findings a baseline leaves: the errors of a rule in a file stay quiet while they are no more
9
+ * than the baseline records, and are all reported once they are more, as ESLint does with its bulk
10
+ * suppressions. A count the run no longer reaches is an error of its own, so that the baseline
11
+ * only shrinks: `check --baseline prune` lowers it.
12
+ */
13
+ export declare function applyBaseline(violations: readonly Violation[], baseline: Baseline, judgement: BaselineJudgement): Violation[];
14
+ //# sourceMappingURL=apply-baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-baseline.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/apply-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,MAAM,WAAW,iBAAiB;IAChC,sGAAsG;IACtG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,iBAAiB,GAC3B,SAAS,EAAE,CAWb"}
@@ -0,0 +1,30 @@
1
+ import { BASELINE_FILE } from './read-baseline.js';
2
+ import { recordedBaseline } from './recorded-baseline.js';
3
+ /**
4
+ * The findings a baseline leaves: the errors of a rule in a file stay quiet while they are no more
5
+ * than the baseline records, and are all reported once they are more, as ESLint does with its bulk
6
+ * suppressions. A count the run no longer reaches is an error of its own, so that the baseline
7
+ * only shrinks: `check --baseline prune` lowers it.
8
+ */
9
+ export function applyBaseline(violations, baseline, judgement) {
10
+ const found = recordedBaseline(violations);
11
+ const quiet = (violation) => violation.severity === 'error' &&
12
+ (found[violation.file]?.[violation.ruleId]?.count ?? 0) <=
13
+ (baseline[violation.file]?.[violation.ruleId]?.count ?? 0);
14
+ const kept = violations.filter((violation) => !quiet(violation));
15
+ return judgement.stale ? [...kept, ...staleEntries(baseline, found)] : kept;
16
+ }
17
+ function staleEntries(baseline, found) {
18
+ return Object.entries(baseline).flatMap(([file, rules]) => Object.entries(rules)
19
+ .map(([ruleId, { count }]) => ({ ruleId, count, now: found[file]?.[ruleId]?.count ?? 0 }))
20
+ .filter(({ count, now }) => now < count)
21
+ .map(({ ruleId, count, now }) => ({
22
+ ruleId,
23
+ severity: 'error',
24
+ file,
25
+ line: 1,
26
+ message: `${BASELINE_FILE} records ${count} error${count === 1 ? '' : 's'} of ${ruleId} in this file, and the file has ${now}: the baseline only shrinks.`,
27
+ fix: 'Run `ddd-ts-kit check --baseline prune` and commit the baseline it lowers.',
28
+ })));
29
+ }
30
+ //# sourceMappingURL=apply-baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-baseline.js","sourceRoot":"","sources":["../../../src/check/baseline/apply-baseline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAgC,EAChC,QAAkB,EAClB,SAA4B;IAE5B,MAAM,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE3C,MAAM,KAAK,GAAG,CAAC,SAAoB,EAAW,EAAE,CAC9C,SAAS,CAAC,QAAQ,KAAK,OAAO;QAC9B,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;YACrD,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAE/D,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC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moved: the counts of a moved file go to its new path, never raised, so
5
+ * that moving code into the canonical tree, which adopting the kit is made of, silences nothing new
6
+ * and lets nothing old out.
7
+ */
8
+ export declare function baselineFollowingMoves(baseline: Baseline, moves: readonly BaselineMove[]): Baseline;
9
+ //# sourceMappingURL=baseline-following-moves.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-following-moves.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/baseline-following-moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,QAAQ,CAMnG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The baseline once files moved: the counts of a moved file go to its new path, never raised, so
3
+ * that moving code into the canonical tree, which adopting the kit is made of, silences nothing new
4
+ * and lets nothing old out.
5
+ */
6
+ export function baselineFollowingMoves(baseline, moves) {
7
+ const destination = new Map(moves.filter(({ to }) => baseline[to] === undefined).map(({ from, to }) => [from, to]));
8
+ return Object.fromEntries(Object.entries(baseline).map(([file, rules]) => [destination.get(file) ?? file, rules]));
9
+ }
10
+ //# sourceMappingURL=baseline-following-moves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-following-moves.js","sourceRoot":"","sources":["../../../src/check/baseline/baseline-following-moves.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAkB,EAAE,KAA8B;IACvF,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAU,CAAC,CAChG,CAAC;IAEF,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACrH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** One file moved, both paths from the project root. */
2
+ export interface BaselineMove {
3
+ readonly from: string;
4
+ readonly to: string;
5
+ }
6
+ //# sourceMappingURL=baseline-move.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-move.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/baseline-move.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=baseline-move.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-move.js","sourceRoot":"","sources":["../../../src/check/baseline/baseline-move.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { Baseline } from './baseline.js';
2
+ /** The baseline as written, its files and rules in order, so that a change of it reads as a diff. */
3
+ export declare function baselineText(baseline: Baseline): string;
4
+ //# sourceMappingURL=baseline-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-text.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/baseline-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAE1D,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAQvD"}
@@ -0,0 +1,12 @@
1
+ import { formatJson } from '../../json/format-json.js';
2
+ /** The baseline as written, its files and rules in order, so that a change of it reads as a diff. */
3
+ export function baselineText(baseline) {
4
+ const ordered = Object.fromEntries(Object.keys(baseline)
5
+ .sort()
6
+ .map((file) => [file, Object.fromEntries(Object.entries(baseline[file] ?? {}).sort(byKey))]));
7
+ return formatJson(ordered);
8
+ }
9
+ function byKey([one], [other]) {
10
+ return one.localeCompare(other);
11
+ }
12
+ //# sourceMappingURL=baseline-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-text.js","sourceRoot":"","sources":["../../../src/check/baseline/baseline-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,qGAAqG;AACrG,MAAM,UAAU,YAAY,CAAC,QAAkB;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SAClB,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAC/F,CAAC;IAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,KAAK,CAAC,CAAC,GAAG,CAA0B,EAAE,CAAC,KAAK,CAA0B;IAC7E,OAAO,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** For each file, for each rule, how many errors the project had when the baseline was written. */
2
+ export type Baseline = Readonly<Record<string, Readonly<Record<string, BaselineEntry>>>>;
3
+ export interface BaselineEntry {
4
+ readonly count: number;
5
+ }
6
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/baseline.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../../src/check/baseline/baseline.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { BaselineMove } from './baseline-move.js';
2
+ /** The text of the baseline once files moved, or nothing when the project has none or no moved file is in it. */
3
+ export declare function movedBaselineText(text: string | undefined, moves: readonly BaselineMove[]): string | undefined;
4
+ //# sourceMappingURL=moved-baseline-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moved-baseline-text.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/moved-baseline-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAKpD,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,GAAG,SAAS,CAS9G"}
@@ -0,0 +1,13 @@
1
+ import { baselineFollowingMoves } from './baseline-following-moves.js';
2
+ import { baselineText } from './baseline-text.js';
3
+ import { parseBaseline } from './parse-baseline.js';
4
+ /** The text of the baseline once files moved, or nothing when the project has none or no moved file is in it. */
5
+ export function movedBaselineText(text, moves) {
6
+ if (text === undefined) {
7
+ return undefined;
8
+ }
9
+ const baseline = parseBaseline(text);
10
+ const followed = baselineFollowingMoves(baseline, moves);
11
+ return moves.some(({ from }) => baseline[from] !== undefined) ? baselineText(followed) : undefined;
12
+ }
13
+ //# sourceMappingURL=moved-baseline-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moved-baseline-text.js","sourceRoot":"","sources":["../../../src/check/baseline/moved-baseline-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,iHAAiH;AACjH,MAAM,UAAU,iBAAiB,CAAC,IAAwB,EAAE,KAA8B;IACxF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrG,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Baseline } from './baseline.js';
2
+ /** The baseline a text holds: each file maps each rule id to a positive count. */
3
+ export declare function parseBaseline(text: string): Baseline;
4
+ //# sourceMappingURL=parse-baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-baseline.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/parse-baseline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAE1D,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAWpD"}
@@ -0,0 +1,19 @@
1
+ import { CliError } from '../../cli-error.js';
2
+ /** The baseline a text holds: each file maps each rule id to a positive count. */
3
+ export function parseBaseline(text) {
4
+ const parsed = JSON.parse(text);
5
+ if (!isBaseline(parsed)) {
6
+ throw new CliError('ddd-ts-kit-baseline.json is not a baseline: each file maps each rule id to { "count": <n> }.', 'Write it again with `ddd-ts-kit check --baseline write`.');
7
+ }
8
+ return parsed;
9
+ }
10
+ function isBaseline(value) {
11
+ return (isObject(value) && Object.values(value).every((rules) => isObject(rules) && Object.values(rules).every(isEntry)));
12
+ }
13
+ function isEntry(value) {
14
+ return isObject(value) && Number.isInteger(value['count']) && Number(value['count']) > 0;
15
+ }
16
+ function isObject(value) {
17
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
18
+ }
19
+ //# sourceMappingURL=parse-baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-baseline.js","sourceRoot":"","sources":["../../../src/check/baseline/parse-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,kFAAkF;AAClF,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,QAAQ,CAChB,8FAA8F,EAC9F,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CACjH,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Violation } from '../model/violation.js';
2
+ import type { Baseline } from './baseline.js';
3
+ /** The baseline lowered to the errors a run still finds, never raised: an entry fixed away leaves it. */
4
+ export declare function prunedBaseline(baseline: Baseline, violations: readonly Violation[]): Baseline;
5
+ //# sourceMappingURL=pruned-baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pruned-baseline.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/pruned-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,yGAAyG;AACzG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,QAAQ,CAQ7F"}
@@ -0,0 +1,14 @@
1
+ import { recordedBaseline } from './recorded-baseline.js';
2
+ /** The baseline lowered to the errors a run still finds, never raised: an entry fixed away leaves it. */
3
+ export function prunedBaseline(baseline, violations) {
4
+ const found = recordedBaseline(violations);
5
+ return Object.fromEntries(Object.entries(baseline)
6
+ .map(([file, rules]) => [file, lowered(rules, found[file] ?? {})])
7
+ .filter(([, rules]) => Object.keys(rules).length > 0));
8
+ }
9
+ function lowered(rules, found) {
10
+ return Object.fromEntries(Object.entries(rules)
11
+ .map(([ruleId, { count }]) => [ruleId, { count: Math.min(count, found[ruleId]?.count ?? 0) }])
12
+ .filter(([, { count }]) => count > 0));
13
+ }
14
+ //# sourceMappingURL=pruned-baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pruned-baseline.js","sourceRoot":"","sources":["../../../src/check/baseline/pruned-baseline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,yGAAyG;AACzG,MAAM,UAAU,cAAc,CAAC,QAAkB,EAAE,UAAgC;IACjF,MAAM,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE3C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAU,CAAC;SAC1E,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CACxD,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAuB,EAAE,KAAuB;IAC/D,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SAClB,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,CAAU,CAAC;SACtG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Baseline } from './baseline.js';
2
+ /** Where a project records the errors it already had, beside its config, in the shape of eslint-suppressions.json. */
3
+ export declare const BASELINE_FILE = "ddd-ts-kit-baseline.json";
4
+ /** The baseline of the project, or nothing when it has none. */
5
+ export declare function readBaseline(root: string): Baseline | undefined;
6
+ //# sourceMappingURL=read-baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-baseline.d.ts","sourceRoot":"","sources":["../../../src/check/baseline/read-baseline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,sHAAsH;AACtH,eAAO,MAAM,aAAa,6BAA6B,CAAC;AAExD,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAI/D"}