ddd-ts-kit 0.88.0 → 0.90.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 (735) hide show
  1. package/CHANGELOG.md +626 -0
  2. package/README.fr.md +86 -31
  3. package/README.md +81 -28
  4. package/dist/check/canonical/roles.d.ts.map +1 -1
  5. package/dist/check/canonical/roles.js +4 -1
  6. package/dist/check/canonical/roles.js.map +1 -1
  7. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  8. package/dist/check/catalogue/architecture-rules.js +12 -0
  9. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  10. package/dist/check/catalogue/default-severities.d.ts.map +1 -1
  11. package/dist/check/catalogue/default-severities.js +5 -0
  12. package/dist/check/catalogue/default-severities.js.map +1 -1
  13. package/dist/check/catalogue/delegated-rules.js +1 -1
  14. package/dist/check/catalogue/delegated-rules.js.map +1 -1
  15. package/dist/check/catalogue/eslint-only-rules.d.ts.map +1 -1
  16. package/dist/check/catalogue/eslint-only-rules.js +24 -0
  17. package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
  18. package/dist/check/configuration/config-inspection.d.ts +2 -2
  19. package/dist/check/configuration/config-inspection.d.ts.map +1 -1
  20. package/dist/check/configuration/config-inspection.js +5 -4
  21. package/dist/check/configuration/config-inspection.js.map +1 -1
  22. package/dist/check/configuration/measure-settings.d.ts +10 -0
  23. package/dist/check/configuration/measure-settings.d.ts.map +1 -0
  24. package/dist/check/configuration/measure-settings.js +17 -0
  25. package/dist/check/configuration/measure-settings.js.map +1 -0
  26. package/dist/check/explain/privacy-docs.d.ts +3 -0
  27. package/dist/check/explain/privacy-docs.d.ts.map +1 -0
  28. package/dist/check/explain/privacy-docs.js +52 -0
  29. package/dist/check/explain/privacy-docs.js.map +1 -0
  30. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  31. package/dist/check/explain/rule-docs.js +2 -0
  32. package/dist/check/explain/rule-docs.js.map +1 -1
  33. package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
  34. package/dist/check/explain/tenancy-docs.js +13 -3
  35. package/dist/check/explain/tenancy-docs.js.map +1 -1
  36. package/dist/check/explain/tree-docs.d.ts.map +1 -1
  37. package/dist/check/explain/tree-docs.js +11 -0
  38. package/dist/check/explain/tree-docs.js.map +1 -1
  39. package/dist/check/explain/wiring-docs.js +1 -1
  40. package/dist/check/explain/wiring-docs.js.map +1 -1
  41. package/dist/check/fixtures/budget-fixtures.d.ts +3 -0
  42. package/dist/check/fixtures/budget-fixtures.d.ts.map +1 -0
  43. package/dist/check/fixtures/budget-fixtures.js +43 -0
  44. package/dist/check/fixtures/budget-fixtures.js.map +1 -0
  45. package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
  46. package/dist/check/fixtures/declarations-fixtures.js +17 -3
  47. package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
  48. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  49. package/dist/check/fixtures/fixtures.js +6 -0
  50. package/dist/check/fixtures/fixtures.js.map +1 -1
  51. package/dist/check/fixtures/mutation-fixtures.d.ts +3 -0
  52. package/dist/check/fixtures/mutation-fixtures.d.ts.map +1 -0
  53. package/dist/check/fixtures/mutation-fixtures.js +81 -0
  54. package/dist/check/fixtures/mutation-fixtures.js.map +1 -0
  55. package/dist/check/fixtures/privacy-fixtures.d.ts +3 -0
  56. package/dist/check/fixtures/privacy-fixtures.d.ts.map +1 -0
  57. package/dist/check/fixtures/privacy-fixtures.js +198 -0
  58. package/dist/check/fixtures/privacy-fixtures.js.map +1 -0
  59. package/dist/check/fixtures/tenancy-bypass.d.ts +24 -0
  60. package/dist/check/fixtures/tenancy-bypass.d.ts.map +1 -0
  61. package/dist/check/fixtures/tenancy-bypass.js +22 -0
  62. package/dist/check/fixtures/tenancy-bypass.js.map +1 -0
  63. package/dist/check/fixtures/tenancy-config.d.ts +3 -0
  64. package/dist/check/fixtures/tenancy-config.d.ts.map +1 -0
  65. package/dist/check/fixtures/tenancy-config.js +7 -0
  66. package/dist/check/fixtures/tenancy-config.js.map +1 -0
  67. package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
  68. package/dist/check/fixtures/tenancy-fixtures.js +31 -41
  69. package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
  70. package/dist/check/fixtures/tenancy-prisma-fixtures.d.ts +4 -0
  71. package/dist/check/fixtures/tenancy-prisma-fixtures.d.ts.map +1 -0
  72. package/dist/check/fixtures/tenancy-prisma-fixtures.js +73 -0
  73. package/dist/check/fixtures/tenancy-prisma-fixtures.js.map +1 -0
  74. package/dist/check/fixtures/tenancy-typeorm-fixtures.d.ts +4 -0
  75. package/dist/check/fixtures/tenancy-typeorm-fixtures.d.ts.map +1 -0
  76. package/dist/check/fixtures/tenancy-typeorm-fixtures.js +88 -0
  77. package/dist/check/fixtures/tenancy-typeorm-fixtures.js.map +1 -0
  78. package/dist/check/mutation/stryker-settings.d.ts +8 -0
  79. package/dist/check/mutation/stryker-settings.d.ts.map +1 -0
  80. package/dist/check/mutation/stryker-settings.js +74 -0
  81. package/dist/check/mutation/stryker-settings.js.map +1 -0
  82. package/dist/check/privacy/column-definitions-in.d.ts +15 -0
  83. package/dist/check/privacy/column-definitions-in.d.ts.map +1 -0
  84. package/dist/check/privacy/column-definitions-in.js +32 -0
  85. package/dist/check/privacy/column-definitions-in.js.map +1 -0
  86. package/dist/check/privacy/declares-name.d.ts +4 -0
  87. package/dist/check/privacy/declares-name.d.ts.map +1 -0
  88. package/dist/check/privacy/declares-name.js +7 -0
  89. package/dist/check/privacy/declares-name.js.map +1 -0
  90. package/dist/check/privacy/personal-declarations-of.d.ts +15 -0
  91. package/dist/check/privacy/personal-declarations-of.d.ts.map +1 -0
  92. package/dist/check/privacy/personal-declarations-of.js +33 -0
  93. package/dist/check/privacy/personal-declarations-of.js.map +1 -0
  94. package/dist/check/privacy/personal-term-of.d.ts +3 -0
  95. package/dist/check/privacy/personal-term-of.d.ts.map +1 -0
  96. package/dist/check/privacy/personal-term-of.js +10 -0
  97. package/dist/check/privacy/personal-term-of.js.map +1 -0
  98. package/dist/check/privacy/personal-vocabulary.d.ts +9 -0
  99. package/dist/check/privacy/personal-vocabulary.d.ts.map +1 -0
  100. package/dist/check/privacy/personal-vocabulary.js +37 -0
  101. package/dist/check/privacy/personal-vocabulary.js.map +1 -0
  102. package/dist/check/privacy/prisma-columns-of.d.ts +17 -0
  103. package/dist/check/privacy/prisma-columns-of.d.ts.map +1 -0
  104. package/dist/check/privacy/prisma-columns-of.js +58 -0
  105. package/dist/check/privacy/prisma-columns-of.js.map +1 -0
  106. package/dist/check/privacy/privacy-judged.d.ts +8 -0
  107. package/dist/check/privacy/privacy-judged.d.ts.map +1 -0
  108. package/dist/check/privacy/privacy-judged.js +9 -0
  109. package/dist/check/privacy/privacy-judged.js.map +1 -0
  110. package/dist/check/privacy/published-events-of.d.ts +29 -0
  111. package/dist/check/privacy/published-events-of.d.ts.map +1 -0
  112. package/dist/check/privacy/published-events-of.js +80 -0
  113. package/dist/check/privacy/published-events-of.js.map +1 -0
  114. package/dist/check/privacy/same-name.d.ts +3 -0
  115. package/dist/check/privacy/same-name.d.ts.map +1 -0
  116. package/dist/check/privacy/same-name.js +6 -0
  117. package/dist/check/privacy/same-name.js.map +1 -0
  118. package/dist/check/privacy/vocabulary-of.d.ts +4 -0
  119. package/dist/check/privacy/vocabulary-of.d.ts.map +1 -0
  120. package/dist/check/privacy/vocabulary-of.js +10 -0
  121. package/dist/check/privacy/vocabulary-of.js.map +1 -0
  122. package/dist/check/privacy/words-of-name.d.ts +3 -0
  123. package/dist/check/privacy/words-of-name.d.ts.map +1 -0
  124. package/dist/check/privacy/words-of-name.js +9 -0
  125. package/dist/check/privacy/words-of-name.js.map +1 -0
  126. package/dist/check/rules/config-valid.js +1 -1
  127. package/dist/check/rules/config-valid.js.map +1 -1
  128. package/dist/check/rules/declarations-port-adapter-wired.d.ts.map +1 -1
  129. package/dist/check/rules/declarations-port-adapter-wired.js +21 -2
  130. package/dist/check/rules/declarations-port-adapter-wired.js.map +1 -1
  131. package/dist/check/rules/governance-recorded-deviation.d.ts.map +1 -1
  132. package/dist/check/rules/governance-recorded-deviation.js +20 -2
  133. package/dist/check/rules/governance-recorded-deviation.js.map +1 -1
  134. package/dist/check/rules/privacy-declared-field.d.ts +11 -0
  135. package/dist/check/rules/privacy-declared-field.d.ts.map +1 -0
  136. package/dist/check/rules/privacy-declared-field.js +63 -0
  137. package/dist/check/rules/privacy-declared-field.js.map +1 -0
  138. package/dist/check/rules/privacy-erasure-reaches-copies.d.ts +10 -0
  139. package/dist/check/rules/privacy-erasure-reaches-copies.d.ts.map +1 -0
  140. package/dist/check/rules/privacy-erasure-reaches-copies.js +46 -0
  141. package/dist/check/rules/privacy-erasure-reaches-copies.js.map +1 -0
  142. package/dist/check/rules/privacy-event-payload-declared.d.ts +10 -0
  143. package/dist/check/rules/privacy-event-payload-declared.d.ts.map +1 -0
  144. package/dist/check/rules/privacy-event-payload-declared.js +39 -0
  145. package/dist/check/rules/privacy-event-payload-declared.js.map +1 -0
  146. package/dist/check/rules/privacy-no-personal-data-in-logs.d.ts +12 -0
  147. package/dist/check/rules/privacy-no-personal-data-in-logs.d.ts.map +1 -0
  148. package/dist/check/rules/privacy-no-personal-data-in-logs.js +57 -0
  149. package/dist/check/rules/privacy-no-personal-data-in-logs.js.map +1 -0
  150. package/dist/check/rules/privacy-subject-is-opaque.d.ts +9 -0
  151. package/dist/check/rules/privacy-subject-is-opaque.d.ts.map +1 -0
  152. package/dist/check/rules/privacy-subject-is-opaque.js +50 -0
  153. package/dist/check/rules/privacy-subject-is-opaque.js.map +1 -0
  154. package/dist/check/rules/tenancy-scoped-statement.d.ts.map +1 -1
  155. package/dist/check/rules/tenancy-scoped-statement.js +6 -2
  156. package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
  157. package/dist/check/rules/test-mutation-governed.d.ts +3 -0
  158. package/dist/check/rules/test-mutation-governed.d.ts.map +1 -0
  159. package/dist/check/rules/test-mutation-governed.js +12 -0
  160. package/dist/check/rules/test-mutation-governed.js.map +1 -0
  161. package/dist/check/tenancy/accessor-uses.d.ts +13 -0
  162. package/dist/check/tenancy/accessor-uses.d.ts.map +1 -0
  163. package/dist/check/tenancy/accessor-uses.js +19 -0
  164. package/dist/check/tenancy/accessor-uses.js.map +1 -0
  165. package/dist/check/tenancy/declaration-of.d.ts +7 -0
  166. package/dist/check/tenancy/declaration-of.d.ts.map +1 -0
  167. package/dist/check/tenancy/declaration-of.js +11 -0
  168. package/dist/check/tenancy/declaration-of.js.map +1 -0
  169. package/dist/check/tenancy/declared-in-arguments.d.ts +13 -0
  170. package/dist/check/tenancy/declared-in-arguments.d.ts.map +1 -0
  171. package/dist/check/tenancy/declared-in-arguments.js +25 -0
  172. package/dist/check/tenancy/declared-in-arguments.js.map +1 -0
  173. package/dist/check/tenancy/declared-with.d.ts +3 -1
  174. package/dist/check/tenancy/declared-with.d.ts.map +1 -1
  175. package/dist/check/tenancy/declared-with.js +4 -3
  176. package/dist/check/tenancy/declared-with.js.map +1 -1
  177. package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
  178. package/dist/check/tenancy/drizzle-unscoped.js +4 -3
  179. package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
  180. package/dist/check/tenancy/executor-uses.d.ts +3 -10
  181. package/dist/check/tenancy/executor-uses.d.ts.map +1 -1
  182. package/dist/check/tenancy/executor-uses.js +3 -11
  183. package/dist/check/tenancy/executor-uses.js.map +1 -1
  184. package/dist/check/tenancy/prisma-unscoped.d.ts +7 -0
  185. package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -0
  186. package/dist/check/tenancy/prisma-unscoped.js +60 -0
  187. package/dist/check/tenancy/prisma-unscoped.js.map +1 -0
  188. package/dist/check/tenancy/typeorm-unscoped.d.ts +7 -0
  189. package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -0
  190. package/dist/check/tenancy/typeorm-unscoped.js +103 -0
  191. package/dist/check/tenancy/typeorm-unscoped.js.map +1 -0
  192. package/dist/check/tenancy/unscoped-read-models.js +2 -2
  193. package/dist/check/tenancy/unscoped-read-models.js.map +1 -1
  194. package/dist/commands/docs.d.ts.map +1 -1
  195. package/dist/commands/docs.js +23 -1
  196. package/dist/commands/docs.js.map +1 -1
  197. package/dist/commands/doctor.d.ts.map +1 -1
  198. package/dist/commands/doctor.js +4 -2
  199. package/dist/commands/doctor.js.map +1 -1
  200. package/dist/commands/generate.js +9 -1
  201. package/dist/commands/generate.js.map +1 -1
  202. package/dist/commands/init.d.ts.map +1 -1
  203. package/dist/commands/init.js +4 -0
  204. package/dist/commands/init.js.map +1 -1
  205. package/dist/commands/lint.d.ts +3 -2
  206. package/dist/commands/lint.d.ts.map +1 -1
  207. package/dist/commands/lint.js +16 -4
  208. package/dist/commands/lint.js.map +1 -1
  209. package/dist/commands/mutation.d.ts +14 -0
  210. package/dist/commands/mutation.d.ts.map +1 -0
  211. package/dist/commands/mutation.js +62 -0
  212. package/dist/commands/mutation.js.map +1 -0
  213. package/dist/config/budget-levels.d.ts +3 -0
  214. package/dist/config/budget-levels.d.ts.map +1 -0
  215. package/dist/config/budget-levels.js +3 -0
  216. package/dist/config/budget-levels.js.map +1 -0
  217. package/dist/config/budget-problems.d.ts +10 -0
  218. package/dist/config/budget-problems.d.ts.map +1 -0
  219. package/dist/config/budget-problems.js +61 -0
  220. package/dist/config/budget-problems.js.map +1 -0
  221. package/dist/config/budget.d.ts +10 -0
  222. package/dist/config/budget.d.ts.map +1 -0
  223. package/dist/config/budget.js +2 -0
  224. package/dist/config/budget.js.map +1 -0
  225. package/dist/config/config.d.ts +16 -0
  226. package/dist/config/config.d.ts.map +1 -1
  227. package/dist/config/index.d.ts +7 -1
  228. package/dist/config/index.d.ts.map +1 -1
  229. package/dist/config/index.js +7 -1
  230. package/dist/config/index.js.map +1 -1
  231. package/dist/config/is-duration.d.ts +3 -0
  232. package/dist/config/is-duration.d.ts.map +1 -0
  233. package/dist/config/is-duration.js +5 -0
  234. package/dist/config/is-duration.js.map +1 -0
  235. package/dist/config/is-reference-budget.d.ts +4 -0
  236. package/dist/config/is-reference-budget.d.ts.map +1 -0
  237. package/dist/config/is-reference-budget.js +8 -0
  238. package/dist/config/is-reference-budget.js.map +1 -0
  239. package/dist/config/is-reference-mutation.d.ts +4 -0
  240. package/dist/config/is-reference-mutation.d.ts.map +1 -0
  241. package/dist/config/is-reference-mutation.js +7 -0
  242. package/dist/config/is-reference-mutation.js.map +1 -0
  243. package/dist/config/mutation-layers.d.ts +3 -0
  244. package/dist/config/mutation-layers.d.ts.map +1 -0
  245. package/dist/config/mutation-layers.js +3 -0
  246. package/dist/config/mutation-layers.js.map +1 -0
  247. package/dist/config/mutation-problems.d.ts +10 -0
  248. package/dist/config/mutation-problems.d.ts.map +1 -0
  249. package/dist/config/mutation-problems.js +46 -0
  250. package/dist/config/mutation-problems.js.map +1 -0
  251. package/dist/config/mutation.d.ts +4 -0
  252. package/dist/config/mutation.d.ts.map +1 -0
  253. package/dist/config/mutation.js +2 -0
  254. package/dist/config/mutation.js.map +1 -0
  255. package/dist/config/parse-budget.d.ts +4 -0
  256. package/dist/config/parse-budget.d.ts.map +1 -0
  257. package/dist/config/parse-budget.js +17 -0
  258. package/dist/config/parse-budget.js.map +1 -0
  259. package/dist/config/parse-config.d.ts.map +1 -1
  260. package/dist/config/parse-config.js +6 -0
  261. package/dist/config/parse-config.js.map +1 -1
  262. package/dist/config/parse-mutation.d.ts +4 -0
  263. package/dist/config/parse-mutation.d.ts.map +1 -0
  264. package/dist/config/parse-mutation.js +16 -0
  265. package/dist/config/parse-mutation.js.map +1 -0
  266. package/dist/config/parse-privacy.d.ts +4 -0
  267. package/dist/config/parse-privacy.d.ts.map +1 -0
  268. package/dist/config/parse-privacy.js +12 -0
  269. package/dist/config/parse-privacy.js.map +1 -0
  270. package/dist/config/parse-stack.d.ts.map +1 -1
  271. package/dist/config/parse-stack.js +4 -1
  272. package/dist/config/parse-stack.js.map +1 -1
  273. package/dist/config/reference-budget.d.ts +8 -0
  274. package/dist/config/reference-budget.d.ts.map +1 -0
  275. package/dist/config/reference-budget.js +7 -0
  276. package/dist/config/reference-budget.js.map +1 -0
  277. package/dist/config/reference-mutation.d.ts +10 -0
  278. package/dist/config/reference-mutation.d.ts.map +1 -0
  279. package/dist/config/reference-mutation.js +9 -0
  280. package/dist/config/reference-mutation.js.map +1 -0
  281. package/dist/config/serialize-config.d.ts.map +1 -1
  282. package/dist/config/serialize-config.js +13 -1
  283. package/dist/config/serialize-config.js.map +1 -1
  284. package/dist/config/stack.d.ts +17 -0
  285. package/dist/config/stack.d.ts.map +1 -1
  286. package/dist/config/stack.js +2 -0
  287. package/dist/config/stack.js.map +1 -1
  288. package/dist/docs/behaviour-page.d.ts +8 -0
  289. package/dist/docs/behaviour-page.d.ts.map +1 -0
  290. package/dist/docs/behaviour-page.js +83 -0
  291. package/dist/docs/behaviour-page.js.map +1 -0
  292. package/dist/docs/context-facts.d.ts +8 -0
  293. package/dist/docs/context-facts.d.ts.map +1 -1
  294. package/dist/docs/counts-of.d.ts +10 -0
  295. package/dist/docs/counts-of.d.ts.map +1 -0
  296. package/dist/docs/counts-of.js +14 -0
  297. package/dist/docs/counts-of.js.map +1 -0
  298. package/dist/docs/declared-table-of.d.ts +14 -0
  299. package/dist/docs/declared-table-of.d.ts.map +1 -0
  300. package/dist/docs/declared-table-of.js +39 -0
  301. package/dist/docs/declared-table-of.js.map +1 -0
  302. package/dist/docs/ensure-personal-data-region.d.ts +7 -0
  303. package/dist/docs/ensure-personal-data-region.d.ts.map +1 -0
  304. package/dist/docs/ensure-personal-data-region.js +21 -0
  305. package/dist/docs/ensure-personal-data-region.js.map +1 -0
  306. package/dist/docs/page-section.d.ts +12 -0
  307. package/dist/docs/page-section.d.ts.map +1 -0
  308. package/dist/docs/page-section.js +2 -0
  309. package/dist/docs/page-section.js.map +1 -0
  310. package/dist/docs/personal-data-lines.d.ts +7 -0
  311. package/dist/docs/personal-data-lines.d.ts.map +1 -0
  312. package/dist/docs/personal-data-lines.js +29 -0
  313. package/dist/docs/personal-data-lines.js.map +1 -0
  314. package/dist/docs/personal-declarations-in.d.ts +13 -0
  315. package/dist/docs/personal-declarations-in.d.ts.map +1 -0
  316. package/dist/docs/personal-declarations-in.js +66 -0
  317. package/dist/docs/personal-declarations-in.js.map +1 -0
  318. package/dist/docs/personal-table-cells.d.ts +12 -0
  319. package/dist/docs/personal-table-cells.d.ts.map +1 -0
  320. package/dist/docs/personal-table-cells.js +13 -0
  321. package/dist/docs/personal-table-cells.js.map +1 -0
  322. package/dist/docs/personal-table-facts.d.ts +17 -0
  323. package/dist/docs/personal-table-facts.d.ts.map +1 -0
  324. package/dist/docs/personal-table-facts.js +2 -0
  325. package/dist/docs/personal-table-facts.js.map +1 -0
  326. package/dist/docs/privacy-register-lines.d.ts +7 -0
  327. package/dist/docs/privacy-register-lines.d.ts.map +1 -0
  328. package/dist/docs/privacy-register-lines.js +34 -0
  329. package/dist/docs/privacy-register-lines.js.map +1 -0
  330. package/dist/docs/read-context.d.ts.map +1 -1
  331. package/dist/docs/read-context.js +17 -1
  332. package/dist/docs/read-context.js.map +1 -1
  333. package/dist/docs/read-personal-data.d.ts +12 -0
  334. package/dist/docs/read-personal-data.d.ts.map +1 -0
  335. package/dist/docs/read-personal-data.js +22 -0
  336. package/dist/docs/read-personal-data.js.map +1 -0
  337. package/dist/docs/refresh-context-doc.d.ts.map +1 -1
  338. package/dist/docs/refresh-context-doc.js +9 -1
  339. package/dist/docs/refresh-context-doc.js.map +1 -1
  340. package/dist/docs/rules-in.d.ts +25 -0
  341. package/dist/docs/rules-in.d.ts.map +1 -0
  342. package/dist/docs/rules-in.js +83 -0
  343. package/dist/docs/rules-in.js.map +1 -0
  344. package/dist/docs/write-behaviour.d.ts +10 -0
  345. package/dist/docs/write-behaviour.d.ts.map +1 -0
  346. package/dist/docs/write-behaviour.js +97 -0
  347. package/dist/docs/write-behaviour.js.map +1 -0
  348. package/dist/docs/write-docs.d.ts +12 -2
  349. package/dist/docs/write-docs.d.ts.map +1 -1
  350. package/dist/docs/write-docs.js +8 -2
  351. package/dist/docs/write-docs.js.map +1 -1
  352. package/dist/docs/write-privacy-register.d.ts +9 -0
  353. package/dist/docs/write-privacy-register.d.ts.map +1 -0
  354. package/dist/docs/write-privacy-register.js +26 -0
  355. package/dist/docs/write-privacy-register.js.map +1 -0
  356. package/dist/doctor/diagnose.d.ts +2 -1
  357. package/dist/doctor/diagnose.d.ts.map +1 -1
  358. package/dist/doctor/diagnose.js +4 -1
  359. package/dist/doctor/diagnose.js.map +1 -1
  360. package/dist/doctor/doctor-finding.d.ts +3 -2
  361. package/dist/doctor/doctor-finding.d.ts.map +1 -1
  362. package/dist/doctor/format-diagnosis.js +4 -1
  363. package/dist/doctor/format-diagnosis.js.map +1 -1
  364. package/dist/doctor/override-findings.d.ts +10 -0
  365. package/dist/doctor/override-findings.d.ts.map +1 -0
  366. package/dist/doctor/override-findings.js +87 -0
  367. package/dist/doctor/override-findings.js.map +1 -0
  368. package/dist/generate/kind.d.ts +14 -0
  369. package/dist/generate/kind.d.ts.map +1 -1
  370. package/dist/generate/kinds/acceptance-kind.js +5 -1
  371. package/dist/generate/kinds/acceptance-kind.js.map +1 -1
  372. package/dist/generate/kinds/background/spec-family.d.ts +8 -0
  373. package/dist/generate/kinds/background/spec-family.d.ts.map +1 -0
  374. package/dist/generate/kinds/background/spec-family.js +9 -0
  375. package/dist/generate/kinds/background/spec-family.js.map +1 -0
  376. package/dist/generate/kinds/background-job-kind.d.ts.map +1 -1
  377. package/dist/generate/kinds/background-job-kind.js +6 -4
  378. package/dist/generate/kinds/background-job-kind.js.map +1 -1
  379. package/dist/generate/kinds/command-kind.d.ts.map +1 -1
  380. package/dist/generate/kinds/command-kind.js +4 -0
  381. package/dist/generate/kinds/command-kind.js.map +1 -1
  382. package/dist/generate/kinds/erasure-handler-kind.d.ts +3 -0
  383. package/dist/generate/kinds/erasure-handler-kind.d.ts.map +1 -0
  384. package/dist/generate/kinds/erasure-handler-kind.js +46 -0
  385. package/dist/generate/kinds/erasure-handler-kind.js.map +1 -0
  386. package/dist/generate/kinds/generate-repository.d.ts +2 -1
  387. package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
  388. package/dist/generate/kinds/generate-repository.js +14 -11
  389. package/dist/generate/kinds/generate-repository.js.map +1 -1
  390. package/dist/generate/kinds/personal-data/class-header.d.ts +3 -0
  391. package/dist/generate/kinds/personal-data/class-header.d.ts.map +1 -0
  392. package/dist/generate/kinds/personal-data/class-header.js +7 -0
  393. package/dist/generate/kinds/personal-data/class-header.js.map +1 -0
  394. package/dist/generate/kinds/personal-data/column-lines.d.ts +4 -0
  395. package/dist/generate/kinds/personal-data/column-lines.d.ts.map +1 -0
  396. package/dist/generate/kinds/personal-data/column-lines.js +5 -0
  397. package/dist/generate/kinds/personal-data/column-lines.js.map +1 -0
  398. package/dist/generate/kinds/personal-data/declare-personal-data.d.ts +12 -0
  399. package/dist/generate/kinds/personal-data/declare-personal-data.d.ts.map +1 -0
  400. package/dist/generate/kinds/personal-data/declare-personal-data.js +73 -0
  401. package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -0
  402. package/dist/generate/kinds/personal-data/fields-line.d.ts +3 -0
  403. package/dist/generate/kinds/personal-data/fields-line.d.ts.map +1 -0
  404. package/dist/generate/kinds/personal-data/fields-line.js +7 -0
  405. package/dist/generate/kinds/personal-data/fields-line.js.map +1 -0
  406. package/dist/generate/kinds/personal-data/personal-column.d.ts +7 -0
  407. package/dist/generate/kinds/personal-data/personal-column.d.ts.map +1 -0
  408. package/dist/generate/kinds/personal-data/personal-column.js +5 -0
  409. package/dist/generate/kinds/personal-data/personal-column.js.map +1 -0
  410. package/dist/generate/kinds/personal-data/personal-names.d.ts +21 -0
  411. package/dist/generate/kinds/personal-data/personal-names.d.ts.map +1 -0
  412. package/dist/generate/kinds/personal-data/personal-names.js +41 -0
  413. package/dist/generate/kinds/personal-data/personal-names.js.map +1 -0
  414. package/dist/generate/kinds/personal-data/personal-request-of.d.ts +18 -0
  415. package/dist/generate/kinds/personal-data/personal-request-of.d.ts.map +1 -0
  416. package/dist/generate/kinds/personal-data/personal-request-of.js +109 -0
  417. package/dist/generate/kinds/personal-data/personal-request-of.js.map +1 -0
  418. package/dist/generate/kinds/personal-data/personal-vars.d.ts +9 -0
  419. package/dist/generate/kinds/personal-data/personal-vars.d.ts.map +1 -0
  420. package/dist/generate/kinds/personal-data/personal-vars.js +107 -0
  421. package/dist/generate/kinds/personal-data/personal-vars.js.map +1 -0
  422. package/dist/generate/kinds/personal-data/property-of.d.ts +3 -0
  423. package/dist/generate/kinds/personal-data/property-of.d.ts.map +1 -0
  424. package/dist/generate/kinds/personal-data/property-of.js +5 -0
  425. package/dist/generate/kinds/personal-data/property-of.js.map +1 -0
  426. package/dist/generate/kinds/personal-data/row-object.d.ts +3 -0
  427. package/dist/generate/kinds/personal-data/row-object.d.ts.map +1 -0
  428. package/dist/generate/kinds/personal-data/row-object.js +5 -0
  429. package/dist/generate/kinds/personal-data/row-object.js.map +1 -0
  430. package/dist/generate/kinds/process-kind.d.ts.map +1 -1
  431. package/dist/generate/kinds/process-kind.js +5 -3
  432. package/dist/generate/kinds/process-kind.js.map +1 -1
  433. package/dist/generate/kinds/repository-kind.d.ts.map +1 -1
  434. package/dist/generate/kinds/repository-kind.js +6 -3
  435. package/dist/generate/kinds/repository-kind.js.map +1 -1
  436. package/dist/generate/kinds/repository-prefix.d.ts +5 -0
  437. package/dist/generate/kinds/repository-prefix.d.ts.map +1 -0
  438. package/dist/generate/kinds/repository-prefix.js +11 -0
  439. package/dist/generate/kinds/repository-prefix.js.map +1 -0
  440. package/dist/generate/kinds/state-machine/state-machine-vars.js +3 -1
  441. package/dist/generate/kinds/state-machine/state-machine-vars.js.map +1 -1
  442. package/dist/generate/kinds/wire-repository-on-first-use.d.ts +10 -0
  443. package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -0
  444. package/dist/generate/kinds/wire-repository-on-first-use.js +14 -0
  445. package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -0
  446. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts +2 -1
  447. package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
  448. package/dist/generate/kinds/write-event-sourced-aggregate.js +13 -2
  449. package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
  450. package/dist/generate/kinds.d.ts.map +1 -1
  451. package/dist/generate/kinds.js +2 -0
  452. package/dist/generate/kinds.js.map +1 -1
  453. package/dist/generate/refresh-docs.d.ts +2 -1
  454. package/dist/generate/refresh-docs.d.ts.map +1 -1
  455. package/dist/generate/refresh-docs.js +2 -2
  456. package/dist/generate/refresh-docs.js.map +1 -1
  457. package/dist/help/notes.d.ts +1 -1
  458. package/dist/help/notes.d.ts.map +1 -1
  459. package/dist/help/notes.js +19 -1
  460. package/dist/help/notes.js.map +1 -1
  461. package/dist/help/usage.d.ts +1 -1
  462. package/dist/help/usage.d.ts.map +1 -1
  463. package/dist/help/usage.js +4 -3
  464. package/dist/help/usage.js.map +1 -1
  465. package/dist/init/files/event-sourcing-files.d.ts +9 -0
  466. package/dist/init/files/event-sourcing-files.d.ts.map +1 -0
  467. package/dist/init/files/event-sourcing-files.js +18 -0
  468. package/dist/init/files/event-sourcing-files.js.map +1 -0
  469. package/dist/init/files/init-files.d.ts.map +1 -1
  470. package/dist/init/files/init-files.js +4 -0
  471. package/dist/init/files/init-files.js.map +1 -1
  472. package/dist/init/files/platform-files.js +6 -1
  473. package/dist/init/files/platform-files.js.map +1 -1
  474. package/dist/init/files/privacy-files.d.ts +10 -0
  475. package/dist/init/files/privacy-files.d.ts.map +1 -0
  476. package/dist/init/files/privacy-files.js +24 -0
  477. package/dist/init/files/privacy-files.js.map +1 -0
  478. package/dist/init/files/project-files.d.ts.map +1 -1
  479. package/dist/init/files/project-files.js +5 -0
  480. package/dist/init/files/project-files.js.map +1 -1
  481. package/dist/init/files/script-files.d.ts +1 -0
  482. package/dist/init/files/script-files.d.ts.map +1 -1
  483. package/dist/init/files/script-files.js +8 -0
  484. package/dist/init/files/script-files.js.map +1 -1
  485. package/dist/init/knip-vars.d.ts.map +1 -1
  486. package/dist/init/knip-vars.js +1 -0
  487. package/dist/init/knip-vars.js.map +1 -1
  488. package/dist/init/manifest/database-scripts.d.ts.map +1 -1
  489. package/dist/init/manifest/database-scripts.js +9 -3
  490. package/dist/init/manifest/database-scripts.js.map +1 -1
  491. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  492. package/dist/init/manifest/dependencies-for.js +6 -2
  493. package/dist/init/manifest/dependencies-for.js.map +1 -1
  494. package/dist/init/manifest/overrides-for.d.ts +7 -0
  495. package/dist/init/manifest/overrides-for.d.ts.map +1 -0
  496. package/dist/init/manifest/overrides-for.js +9 -0
  497. package/dist/init/manifest/overrides-for.js.map +1 -0
  498. package/dist/init/manifest/pinned-below-a-fix.d.ts +14 -0
  499. package/dist/init/manifest/pinned-below-a-fix.d.ts.map +1 -0
  500. package/dist/init/manifest/pinned-below-a-fix.js +20 -0
  501. package/dist/init/manifest/pinned-below-a-fix.js.map +1 -0
  502. package/dist/init/manifest/scripts-for.js +17 -0
  503. package/dist/init/manifest/scripts-for.js.map +1 -1
  504. package/dist/init/manifest/test-scripts.d.ts.map +1 -1
  505. package/dist/init/manifest/test-scripts.js +3 -0
  506. package/dist/init/manifest/test-scripts.js.map +1 -1
  507. package/dist/init/manifest/versions.d.ts.map +1 -1
  508. package/dist/init/manifest/versions.js +28 -25
  509. package/dist/init/manifest/versions.js.map +1 -1
  510. package/dist/init/manifest/write-overrides.d.ts +9 -0
  511. package/dist/init/manifest/write-overrides.d.ts.map +1 -0
  512. package/dist/init/manifest/write-overrides.js +56 -0
  513. package/dist/init/manifest/write-overrides.js.map +1 -0
  514. package/dist/init/rewire-personal-data.d.ts +10 -0
  515. package/dist/init/rewire-personal-data.d.ts.map +1 -0
  516. package/dist/init/rewire-personal-data.js +32 -0
  517. package/dist/init/rewire-personal-data.js.map +1 -0
  518. package/dist/init/run-init.d.ts.map +1 -1
  519. package/dist/init/run-init.js +8 -3
  520. package/dist/init/run-init.js.map +1 -1
  521. package/dist/init/stack/resolve-personal-data.d.ts +10 -0
  522. package/dist/init/stack/resolve-personal-data.d.ts.map +1 -0
  523. package/dist/init/stack/resolve-personal-data.js +22 -0
  524. package/dist/init/stack/resolve-personal-data.js.map +1 -0
  525. package/dist/init/stack/resolve-queue.d.ts +4 -3
  526. package/dist/init/stack/resolve-queue.d.ts.map +1 -1
  527. package/dist/init/stack/resolve-queue.js +6 -8
  528. package/dist/init/stack/resolve-queue.js.map +1 -1
  529. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  530. package/dist/init/stack/resolve-stack.js +2 -0
  531. package/dist/init/stack/resolve-stack.js.map +1 -1
  532. package/dist/init/stack/resolve-tenancy.d.ts +3 -3
  533. package/dist/init/stack/resolve-tenancy.js +5 -5
  534. package/dist/init/stack/resolve-tenancy.js.map +1 -1
  535. package/dist/init/stack/stack-options.d.ts +4 -0
  536. package/dist/init/stack/stack-options.d.ts.map +1 -1
  537. package/dist/init/write-contracts.d.ts +2 -1
  538. package/dist/init/write-contracts.d.ts.map +1 -1
  539. package/dist/init/write-contracts.js +6 -3
  540. package/dist/init/write-contracts.js.map +1 -1
  541. package/dist/lint/eslint-in-project.d.ts +3 -2
  542. package/dist/lint/eslint-in-project.d.ts.map +1 -1
  543. package/dist/lint/eslint-in-project.js +5 -3
  544. package/dist/lint/eslint-in-project.js.map +1 -1
  545. package/dist/lint/lint-cache-of.d.ts +7 -0
  546. package/dist/lint/lint-cache-of.d.ts.map +1 -0
  547. package/dist/lint/lint-cache-of.js +47 -0
  548. package/dist/lint/lint-cache-of.js.map +1 -0
  549. package/dist/lint/lint-run.d.ts +2 -0
  550. package/dist/lint/lint-run.d.ts.map +1 -1
  551. package/dist/mutation/changed-files.d.ts +7 -0
  552. package/dist/mutation/changed-files.d.ts.map +1 -0
  553. package/dist/mutation/changed-files.js +15 -0
  554. package/dist/mutation/changed-files.js.map +1 -0
  555. package/dist/mutation/format-mutation.d.ts +4 -0
  556. package/dist/mutation/format-mutation.d.ts.map +1 -0
  557. package/dist/mutation/format-mutation.js +29 -0
  558. package/dist/mutation/format-mutation.js.map +1 -0
  559. package/dist/mutation/format-survivors.d.ts +8 -0
  560. package/dist/mutation/format-survivors.d.ts.map +1 -0
  561. package/dist/mutation/format-survivors.js +19 -0
  562. package/dist/mutation/format-survivors.js.map +1 -0
  563. package/dist/mutation/mutation-report-file.d.ts +3 -0
  564. package/dist/mutation/mutation-report-file.d.ts.map +1 -0
  565. package/dist/mutation/mutation-report-file.js +3 -0
  566. package/dist/mutation/mutation-report-file.js.map +1 -0
  567. package/dist/mutation/mutation-scores.d.ts +35 -0
  568. package/dist/mutation/mutation-scores.d.ts.map +1 -0
  569. package/dist/mutation/mutation-scores.js +55 -0
  570. package/dist/mutation/mutation-scores.js.map +1 -0
  571. package/dist/mutation/read-mutation-report.d.ts +16 -0
  572. package/dist/mutation/read-mutation-report.d.ts.map +1 -0
  573. package/dist/mutation/read-mutation-report.js +38 -0
  574. package/dist/mutation/read-mutation-report.js.map +1 -0
  575. package/dist/mutation/survivors.d.ts +19 -0
  576. package/dist/mutation/survivors.d.ts.map +1 -0
  577. package/dist/mutation/survivors.js +24 -0
  578. package/dist/mutation/survivors.js.map +1 -0
  579. package/dist/platform-layout/platform-layout.d.ts +2 -0
  580. package/dist/platform-layout/platform-layout.d.ts.map +1 -1
  581. package/dist/platform-layout/platform-layout.js +2 -0
  582. package/dist/platform-layout/platform-layout.js.map +1 -1
  583. package/dist/presets/apply-preset.js +2 -1
  584. package/dist/presets/apply-preset.js.map +1 -1
  585. package/dist/presets/identity-preset.d.ts.map +1 -1
  586. package/dist/presets/identity-preset.js +17 -1
  587. package/dist/presets/identity-preset.js.map +1 -1
  588. package/dist/presets/preset-files.d.ts.map +1 -1
  589. package/dist/presets/preset-files.js +1 -0
  590. package/dist/presets/preset-files.js.map +1 -1
  591. package/dist/presets/preset-step.d.ts +3 -1
  592. package/dist/presets/preset-step.d.ts.map +1 -1
  593. package/dist/run.d.ts.map +1 -1
  594. package/dist/run.js +2 -0
  595. package/dist/run.js.map +1 -1
  596. package/dist/stack/audit-vars.d.ts +1 -1
  597. package/dist/stack/audit-vars.d.ts.map +1 -1
  598. package/dist/stack/audit-vars.js +26 -8
  599. package/dist/stack/audit-vars.js.map +1 -1
  600. package/dist/stack/stack-vars.d.ts.map +1 -1
  601. package/dist/stack/stack-vars.js +45 -3
  602. package/dist/stack/stack-vars.js.map +1 -1
  603. package/dist/version.d.ts +1 -1
  604. package/dist/version.js +1 -1
  605. package/package.json +4 -2
  606. package/templates/background-job/background-job.spec.buses.ts.tpl +57 -0
  607. package/templates/background-job/wiring.manual.tpl +4 -0
  608. package/templates/context/CONTEXT.md.tpl +5 -0
  609. package/templates/controller/guard.spec.ts.tpl +2 -2
  610. package/templates/docs/asyncapi.privacy.json.tpl +100 -0
  611. package/templates/docs/event-catalog.privacy.md +18 -0
  612. package/templates/docs/privacy-register.md.tpl +25 -0
  613. package/templates/erasure-handler/erasure-handler.declared.ts.tpl +22 -0
  614. package/templates/erasure-handler/erasure-handler.spec.ts.tpl +36 -0
  615. package/templates/erasure-handler/erasure-handler.ts.tpl +20 -0
  616. package/templates/erasure-handler/wiring.manual.tpl +23 -0
  617. package/templates/erasure-handler/wiring.tsyringe.tpl +6 -0
  618. package/templates/init/README.md.tpl +43 -3
  619. package/templates/init/gitignore.tpl +3 -0
  620. package/templates/init/jest.config.js.tpl +2 -0
  621. package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +19 -1
  622. package/templates/init/platform/audit/create-audit.ts.tpl +28 -6
  623. package/templates/init/platform/composition/compose-application.manual.ts.tpl +64 -6
  624. package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +12 -0
  625. package/templates/init/platform/composition/create-platform.manual.ts.tpl +7 -3
  626. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +14 -2
  627. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +17 -1
  628. package/templates/init/platform/composition/platform-options.manual.ts.tpl +4 -1
  629. package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +36 -0
  630. package/templates/init/platform/composition/platform.manual.ts.tpl +16 -0
  631. package/templates/init/platform/database/open-persistence.memory.ts.tpl +20 -0
  632. package/templates/init/platform/database/open-test-database.prisma.ts.tpl +13 -2
  633. package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +21 -1
  634. package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +17 -1
  635. package/templates/init/platform/database/persistence-over.knex.ts.tpl +20 -1
  636. package/templates/init/platform/database/persistence-over.prisma.ts.tpl +45 -1
  637. package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +14 -1
  638. package/templates/init/platform/database/persistence.memory.ts.tpl +9 -0
  639. package/templates/init/platform/database/persistence.orm.ts.tpl +9 -1
  640. package/templates/init/platform/database/schema.drizzle.ts.tpl +18 -3
  641. package/templates/init/platform/database/schema.knex.ts.tpl +8 -1
  642. package/templates/init/platform/database/schema.prisma.tpl +182 -1
  643. package/templates/init/platform/database/schema.typeorm.ts.tpl +32 -1
  644. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +36 -0
  645. package/templates/init/platform/event-sourcing/event-sourcing.module.ts.tpl +22 -0
  646. package/templates/init/platform/jobs/background-jobs.ts.tpl +21 -0
  647. package/templates/init/platform/jobs/create-background-work.ts.tpl +147 -0
  648. package/templates/init/platform/jobs/job-settings.ts.tpl +11 -0
  649. package/templates/init/platform/privacy/data-subject-copies.manual.ts.tpl +14 -0
  650. package/templates/init/platform/privacy/data-subject-copies.tsyringe.ts.tpl +13 -0
  651. package/templates/init/platform/privacy/data-subject-exports.manual.ts.tpl +14 -0
  652. package/templates/init/platform/privacy/data-subject-exports.tsyringe.ts.tpl +13 -0
  653. package/templates/init/platform/privacy/privacy.module.tsyringe.ts.tpl +20 -0
  654. package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +100 -0
  655. package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +104 -0
  656. package/templates/init/platform/privacy/run-export.manual.ts.tpl +64 -0
  657. package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +71 -0
  658. package/templates/init/platform/privacy/run-purge.manual.ts.tpl +39 -0
  659. package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +45 -0
  660. package/templates/init/rules/infrastructure.md.tpl +1 -1
  661. package/templates/init/rules/tests.md.tpl +1 -1
  662. package/templates/init/scripts/events.ts.tpl +12 -0
  663. package/templates/init/scripts/privacy-erase.manual.ts.tpl +78 -0
  664. package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +78 -0
  665. package/templates/init/scripts/privacy-export.manual.ts.tpl +79 -0
  666. package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +79 -0
  667. package/templates/init/scripts/privacy-purge.manual.ts.tpl +48 -0
  668. package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +48 -0
  669. package/templates/personal-data/adapter-field.tpl +4 -0
  670. package/templates/personal-data/copies.manual.tpl +4 -0
  671. package/templates/personal-data/copies.tsyringe.tpl +4 -0
  672. package/templates/personal-data/declaration.drizzle.ts.tpl +22 -0
  673. package/templates/personal-data/declaration.knex.ts.tpl +24 -0
  674. package/templates/personal-data/declaration.prisma.ts.tpl +24 -0
  675. package/templates/personal-data/declaration.typeorm.ts.tpl +21 -0
  676. package/templates/personal-data/erasure.drizzle.ts.tpl +43 -0
  677. package/templates/personal-data/erasure.knex.ts.tpl +41 -0
  678. package/templates/personal-data/erasure.prisma.ts.tpl +43 -0
  679. package/templates/personal-data/erasure.typeorm.ts.tpl +41 -0
  680. package/templates/personal-data/export-fake.ts.tpl +24 -0
  681. package/templates/personal-data/export-port.ts.tpl +8 -0
  682. package/templates/personal-data/export.drizzle.ts.tpl +43 -0
  683. package/templates/personal-data/export.knex.ts.tpl +41 -0
  684. package/templates/personal-data/export.prisma.ts.tpl +43 -0
  685. package/templates/personal-data/export.typeorm.ts.tpl +41 -0
  686. package/templates/personal-data/exports.manual.tpl +4 -0
  687. package/templates/personal-data/exports.tsyringe.tpl +4 -0
  688. package/templates/personal-data/fake.ts.tpl +26 -0
  689. package/templates/personal-data/port.ts.tpl +8 -0
  690. package/templates/personal-data/spec.ts.tpl +280 -0
  691. package/templates/personal-data/wiring.tsyringe.tpl +12 -0
  692. package/templates/pipeline/github/workflows/ci.yml.tpl +62 -0
  693. package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +64 -2
  694. package/templates/pipeline/jest.mutation.config.js.tpl +8 -0
  695. package/templates/pipeline/knip.json.tpl +1 -1
  696. package/templates/pipeline/lefthook.yml +6 -0
  697. package/templates/pipeline/package-scripts.json +1 -1
  698. package/templates/pipeline/stryker.config.mjs.tpl +25 -0
  699. package/templates/pipeline/vitest.config.ts.tpl +2 -0
  700. package/templates/pipeline/vitest.mutation.config.ts.tpl +29 -0
  701. package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.drizzle.ts.tpl +17 -0
  702. package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.knex.ts.tpl +19 -0
  703. package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.drizzle.ts.tpl +18 -0
  704. package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.knex.ts.tpl +20 -0
  705. package/templates/presets/identity/context/test/unit/account-deactivated.integration-handler.spec.ts.tpl +4 -2
  706. package/templates/presets/identity/context/test/unit/deactivate-account.handler.spec.ts.tpl +7 -5
  707. package/templates/presets/identity/context/test/unit/environment-identity-provider-connection.adapter.spec.ts.tpl +7 -3
  708. package/templates/presets/identity/context/test/unit/invite-member.handler.spec.ts.tpl +7 -7
  709. package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl +4 -2
  710. package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl +5 -3
  711. package/templates/presets/identity/context/test/unit/organisation-opened.integration-handler.spec.ts.tpl +4 -2
  712. package/templates/presets/identity/context/test/unit/revoke-invitation.handler.spec.ts.tpl +7 -5
  713. package/templates/process/process.spec.ts.tpl +6 -3
  714. package/templates/process/timeout-job.spec.buses.ts.tpl +42 -0
  715. package/templates/process/timeout-job.wiring.manual.tpl +4 -0
  716. package/templates/repository/drizzle/mapper.ts.tpl +10 -0
  717. package/templates/repository/drizzle/table.tpl +6 -0
  718. package/templates/repository/knex/mapper.ts.tpl +10 -0
  719. package/templates/repository/knex/row.ts.tpl +3 -0
  720. package/templates/repository/knex/table.tpl +3 -0
  721. package/templates/repository/prisma/mapper.ts.tpl +16 -1
  722. package/templates/repository/prisma/model.tpl +9 -0
  723. package/templates/repository/prisma/repository.ts.tpl +55 -0
  724. package/templates/repository/typeorm/mapper.ts.tpl +10 -0
  725. package/templates/repository/typeorm/repository.ts.tpl +48 -0
  726. package/templates/repository/typeorm/row.ts.tpl +9 -1
  727. package/templates/repository/typeorm/table.tpl +27 -0
  728. package/templates/value-object/value-object.spec.ts.tpl +1 -0
  729. package/dist/generate/kinds/background/require-container.d.ts +0 -7
  730. package/dist/generate/kinds/background/require-container.d.ts.map +0 -1
  731. package/dist/generate/kinds/background/require-container.js +0 -13
  732. package/dist/generate/kinds/background/require-container.js.map +0 -1
  733. /package/templates/background-job/{background-job.spec.ts.tpl → background-job.spec.tsyringe.ts.tpl} +0 -0
  734. /package/templates/process/{timeout-job.spec.ts.tpl → timeout-job.spec.tsyringe.ts.tpl} +0 -0
  735. /package/templates/repository/{wiring.manual.tpl → first-use.wiring.manual.tpl} +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,632 @@ What each version changes for someone who uses the kit. The packages of `package
4
4
  together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
5
5
  list the pull requests behind it.
6
6
 
7
+ ## 0.90.0
8
+
9
+ **A generated project forces qs `^6.16.0`, and multer `^2.5.0` on Nest, where its stack still pins the vulnerable versions; one on Fastify asks for `fastify` `^5.12.7`.** Stryker 10.1 asks for `typed-rest-client` 2.3, which asks for qs 6.15.1 exactly (three denials of service, moderate), and `@nestjs/platform-express`, up to 12.2.0, asks for multer 2.4.0 exactly (a denial of service through a pending `fileFilter`, high). `init` forces the fixed versions in `overrides` of `package.json` under npm, and of `pnpm-workspace.yaml` under pnpm, which reads nothing of `package.json`. An override the project already sets for one of them is kept, and said, unless `--force`. Fastify 5.12.2 to 5.12.5 let a request header go around the validation of a schema whose `propertyNames` reads it by case (low).
10
+
11
+ To move: `npx ddd-ts-kit init` adds the overrides (or write them by hand: `"overrides": { "qs": "^6.16.0", "multer": "^2.5.0" }` in `package.json` under npm, the same entries under `overrides:` of `pnpm-workspace.yaml` under pnpm, multer on Nest alone), then `npm install` (`pnpm install`). Check that `npm ls qs multer` (`pnpm why qs multer`) shows no qs below 6.16 and no multer below 2.5; a copy left older moves with `npm update qs multer`. In a project on Fastify, install `fastify@^5.12.7`.
12
+
13
+ **The background jobs and the process instances live in the database on Prisma too:
14
+ `PrismaJobStore` and `PrismaProcessStore`, and `init --orm prisma --queue database`.** The two
15
+ stores of `@ddd-ts-kit/prisma` are held to `jobStoreContract` and `processStoreContract`, on PGlite
16
+ and on PostgreSQL. A job enqueued by a command is written by the transaction of that command, so it
17
+ exists if and only if the command committed; a claim selects the due rows `FOR UPDATE SKIP LOCKED`,
18
+ the one raw statement of the store, and leases them in a short transaction; an idempotency key is
19
+ unique per job name and tenant. A step of a process manager saves its instance in the transaction
20
+ of its unit of work, refused with `ConcurrencyError` at a stale version. Their models ship in
21
+ `prisma/jobs-and-processes.postgresql.prisma`; the checkpoint of a job and the state of an
22
+ instance are JSON in a text field, since Prisma Client writes a SQL `NULL` to a `Json` field only
23
+ through the sentinel of the generated client. `init` writes the `BackgroundJob` and
24
+ `ProcessInstance` models in the `messaging` schema of `prisma/schema.prisma` and binds the stores in
25
+ `persistence-over.ts`; on Prisma with tsyringe `--queue` now defaults to `database`, as on Knex and
26
+ Drizzle, and with `--queue redis` the process instances stay in the database.
27
+
28
+ To move: a project on Prisma that keeps its jobs in memory and wants them in the database runs
29
+ `init --force --queue database` on a clean tree, then `npm run db:generate <name>` for the two new
30
+ tables.
31
+
32
+ **The four rules that read what a test says are errors: `test/title-states-a-rule`, `test/no-logic`, `test/assertion-present` and `test/refusal-by-code`.** They were warnings in 0.89, listed by `ddd-ts-kit lint` after its report without failing it; `recommended` of the ESLint plugin and `ddd-ts-kit rules` now give them `error`, as `strict` did, and the lint fails on them.
33
+
34
+ To move: before upgrading, run `npm run lint` on 0.89 and take up what it lists under these four rules: rename a title that says `should` or names a method, move a loop to an `it.each` and a decision to a builder or a fake, replace a `toThrow('message')` by the code of the refusal, and write `it.todo` where a test has no body. A project that keeps one of them a warning sets `"rules": { "test/no-logic": "warn" }` in `ddd-ts-kit.config.json`, rule by rule.
35
+
36
+ **`ddd-ts-kit doctor` says when an override `init` writes is missing, or no longer needed.** `init` forces qs `^6.16.0`, and multer `^2.5.0` on Nest, under a dependency that pins them below a security fix; nothing removed such an override from a project once that dependency was fixed, and it would hold the package back when a later major is asked for. `doctor` now reads, on what is installed, the range the parent asks for (`typed-rest-client` under `@stryker-mutator/core`, `@nestjs/platform-express`), found from the real place of each package under npm and under pnpm, against the overrides of `package.json` or of `pnpm-workspace.yaml`: `override <name>: missing` while the parent still pins the package below the fix and the project does not force it, which fails `--strict`; `override <name>: no longer needed` once the parent asks for the fixed version itself, said without failing it.
37
+
38
+ To move: run `npx ddd-ts-kit doctor` after an install; remove an override it says is no longer needed from the file it names, then install again.
39
+
40
+ ## 0.89.0
41
+
42
+ **`clean/one-export-per-file` runs under the JS plugin API of Oxlint.** The rule walked the
43
+ tree of a file through a node a parser may leave null (the body of a declaration without one),
44
+ which the parser of ESLint never does and the one of Oxlint does: under Oxlint the rule stopped
45
+ on 2,494 of the files of the kit with `Cannot convert undefined or null to object`. The walker
46
+ now walks nothing for what is not a node. The plugin as a whole runs under
47
+ `oxlint --type-aware` with `jsPlugins` set to `@ddd-ts-kit/eslint-plugin`, which stays a trial:
48
+ the API is alpha, and `no-redeclare` of Oxlint contradicts the compiler on a class and an
49
+ interface of one name.
50
+
51
+ **`clean/stepdown` reports on a JavaScript file too.** The rule kept the references of a function
52
+ that the scope manager of typescript-eslint marks as values; the scope manager of the default
53
+ parser of ESLint, which lints a `.mjs`, `.cjs` or `.js` file, marks nothing, so on such a file the
54
+ rule found no caller and reported nothing. A reference the parser does not qualify is a value
55
+ now. The preset of the kit applies the rule to TypeScript sources only; a project that applies it
56
+ to its scripts as well sees what it reports there from this version on.
57
+
58
+ **`ddd-ts-kit lint` keeps the cache of ESLint, and the pipeline of a project restores it.** The
59
+ command lints with the cache of ESLint keyed by the content of each file (`.eslintcache/`, ignored
60
+ by git): a second run on a tree that did not change lints the files that changed since, in a
61
+ second or two instead of the whole project. The cache keys on the files and the config, not on the
62
+ rules as installed, so the command drops it when the lockfile, `eslint.config.mjs` or
63
+ `ddd-ts-kit.config.json` changed since it was written. The lint job of the pipeline `init` writes
64
+ restores, on a pull request or a merge request, the cache the default branch wrote last for the
65
+ same lockfile and config, and the default branch and the night lint everything and write it: a
66
+ type changed in another file is seen there. `ddd-ts-kit lint --no-cache` lints every file again.
67
+
68
+ To move, by hand, not with `init --force`, which rewrites far more than the pipeline: add
69
+ `.eslintcache/` to `.gitignore`; in `.github/workflows/ci.yml`, give the lint job the two steps of
70
+ the template (`actions/cache/restore` of `.eslintcache/` before the lint, on a pull request only,
71
+ keyed by the lockfile, `eslint.config.mjs` and `ddd-ts-kit.config.json` with a prefix fallback;
72
+ `actions/cache/save` after it, on the default branch and the night only), as
73
+ `node_modules/ddd-ts-kit/templates/pipeline/github/workflows/ci.yml.tpl` writes them; in
74
+ `.gitlab-ci.yml`, add the second `cache:` entry of the lint job (`.eslintcache/`, keyed by the
75
+ lockfile and `eslint.config.mjs`, `policy: $LINT_CACHE_POLICY`) and the `LINT_CACHE_POLICY` variable
76
+ of each workflow rule (`pull` on a merge request, `pull-push` on the default branch and the night),
77
+ as `templates/pipeline/gitlab/gitlab-ci.yml.tpl` writes them.
78
+
79
+ **A proposal page says what privacy by design asks of the kit beyond event sourcing, and the
80
+ pull requests that build it.** `docs/proposals/privacy-by-design.md` verifies what the kit
81
+ erases today (the personal values of stored events, by crypto-shredding, with a dated audit
82
+ entry) and what nothing of the kit erases, exports, retains or inventories: the aggregates kept
83
+ as rows on the four ORMs, the read models, the copies a person leaves in the contexts that
84
+ consumed its events, the masks of the audit trail. It designs one declaration of the personal
85
+ fields, read by ports with an adapter per ORM, by generators, by a generated register and by
86
+ `privacy/*` rules, nothing of it mandatory for a project without personal data; cuts the work
87
+ into pull requests in merge order, the example first; and says what a tool can never guarantee,
88
+ with the wording that follows for the README. The glossary of the translations gains the terms
89
+ of the page. Nothing of the code changes.
90
+
91
+ **The scheduling example erases a person from every copy the contexts keep, not from the sealed
92
+ words alone.** `npm run erase:patient` destroyed the key the words of a patient were sealed with
93
+ and rebuilt the projections, and left the person named and reachable in the tables: the person of
94
+ `identity` (name and address), the contact of `notification`, the notes the staff wrote on their
95
+ appointments, the reasons of their cancellations, the documents attached to those appointments and
96
+ the name the practitioner directory of `scheduling` copied. The erasure now reaches each of them,
97
+ network by network (`NETWORKS`), after the key and before the rebuilds: `identity` forgets the
98
+ person (`PersonRepository.erase`), `notification` deletes the contact, `scheduling` replaces the
99
+ notes and the reasons by `[erased]` and deletes the documents from the file storage
100
+ (`KnexPatientErasure`). The report of the script counts the rows each copy reached; a copy that
101
+ fails does not stop the others and running the script again completes the erasure; a run again
102
+ once nothing is left is refused and recorded. The README of the example says what an erasure does
103
+ not reach: the events published before it, the backups, the opaque ids of the audit trail. The
104
+ first part of the proposal [privacy by design](../docs/proposals/privacy-by-design.md) built; the
105
+ hand-written steps are the specification of the erasure port the next parts bring to the kit.
106
+
107
+ **A proposal specifies a second example, spend management on the most popular stack.** `docs/proposals/spend-management-example.md` runs the stack NestJS, class-validator, Jest, Prisma, Kafka, Redis, S3, shared-table tenancy, Keycloak, ABAC, Winston, Scalar through `init --dry-run` and lists what the kit refuses today on it: the queue and the processes on `--di nest`, the shared-table tenancy, the jobs table and the SQL audit trail on Prisma, the identity preset on Nest, Prisma and the explicit style. It specifies those fixes first, then the example (seven bounded contexts on expense reports, corporate cards, approvals, budgets, reimbursements and the ledger), then what the repository gains; MySQL is left out with the list of what it would take. Nothing is built by this change.
108
+
109
+ **The kernel declares the personal fields of a table and erases a data subject end to end: the
110
+ key, every copy in every tenant, the rebuilds.** `personalFields(table, { subject, fields,
111
+ erasure, files? })` says, next to the mapper, which columns of a table are personal, whose they
112
+ are and how the rows of a subject are erased, `row` deleted or `pseudonymise` read as `[erased]`,
113
+ the files they name deleted from the storage. Two ports a context extends and names, as it extends
114
+ `Repository`: `PersonalDataErasure` (`erase(subject)` answers the rows reached, none the second
115
+ time) and `PersonalDataExport` (`exportOf(subject)` answers one `PersonalDataRecord` per row,
116
+ each personal column as plain data). `eraseDataSubject`, lifted from the scheduling example,
117
+ destroys the key, erases every copy in every tenant (`inEachTenant` runs a copy in the context of
118
+ the work given each tenant, since a write of tenant data is never widened), rebuilds the
119
+ projections fed by the store, and reports `{ erased, copies, rebuilt }`; a copy that fails does
120
+ not stop the others, and running the erasure again completes it; a subject that is not an opaque
121
+ identifier is refused before any key is touched, and an id nothing is left of is refused before
122
+ the rebuilds; `keys` may be left out, as in a project whose aggregates are rows and seal nothing:
123
+ the copies alone are erased, and the report says no key was destroyed. `InMemoryPersonalData` implements both ports over one declaration, and
124
+ `personalDataErasureContract` and `personalDataExportContract` of `@ddd-ts-kit/testing` hold it
125
+ and every adapter to the same behaviour. The adapters of the persistence packages, the platform
126
+ folder `init` writes and the register come with the next parts of
127
+ [privacy by design](../docs/proposals/privacy-by-design.md). The persistence skill says it.
128
+
129
+ **The audit trail masks a personal value under the key of the person it belongs to, so that
130
+ erasing the person makes its masks meaningless.** `subjectMasker(keys)` of `@ddd-ts-kit/audit` is
131
+ an `AuditMasker` over the `SubjectKeyStore` of the kernel, the same keys that seal the personal
132
+ values of the stored events: each mask is an HMAC under a key derived from the key of the data
133
+ subject (HKDF, labelled for the trail), written `<keyId>:<hex>`; `SubjectKeyStore.erase` destroys
134
+ the key, and the masks made with it become tokens nobody can recompute while the entries and the
135
+ chain stay as they are. A masked field says whose its value is, `masked('patientEmail', { subject:
136
+ 'patientId' })` or `subjectOf: (command) => ...`; `auditMiddleware` refuses, at wiring time, a
137
+ masked field that names none when the masker is keyed per data subject
138
+ (`MissingDataSubjectError`), and the masker refuses a subject that is not an opaque identifier
139
+ before any key is created (`MaskingSubjectNotAnIdError`): a name or an email named as the subject
140
+ would be written into the key store in clear. `hmacMasker` under one secret stays as it was.
141
+
142
+ What a masker or a declaration written by hand sees: `MaskingSubject` gains `dataSubject`, set
143
+ only for a masked field declared with `subject` or `subjectOf`; `AuditProjection` gains
144
+ `subjects`, the data subject of each masked value by field, which `auditedFields` fills and a
145
+ projection of your own may fill; `AuditedMessage` gains `subjectless`, optional, the masked fields
146
+ that name no subject, which `auditedFields` lists and a declaration of your own may leave out;
147
+ `AuditMasker` gains `requiresDataSubject`, optional, which a masker keyed per person sets so that
148
+ the middleware checks the declarations at wiring time. Nothing existing changes shape or meaning.
149
+ Part 2 of [privacy by design](../docs/proposals/privacy-by-design.md).
150
+
151
+ **`init` writes `src/platform/privacy/` with `--privacy on`, the default with an ORM, and wires the
152
+ event store with `--event-sourcing on`: a generated project erases and exports a data subject from
153
+ its first minute, and pays no table it did not ask for.** Two choices of the stack, recorded as
154
+ `stack.privacy` and `stack.eventSourcing`, each changed later by `init --force`.
155
+
156
+ `--privacy on` writes `src/platform/privacy/`: a context that erases or exports what it keeps of a
157
+ person lists its port in `data-subject-copies.ts` or `data-subject-exports.ts`; `run-erasure.ts`
158
+ opens an execution context of origin `cli` with the operator as actor and runs `eraseDataSubject`
159
+ of the kernel over the copies, in every tenant with `--tenancy shared-table` (`inEachTenant`);
160
+ `run-export.ts` gathers every record. Two scripts answer the requests: `npm run privacy:erase --
161
+ <subject-id> [--operator <who-asks>]` and `npm run privacy:export -- <subject-id>`, on the sources
162
+ with the variables of `.env`, the tenants named by `TENANTS`. What they cannot reach is said where
163
+ they are written: backups, logs, exports and a copy no context declared. No HTTP command erases yet.
164
+ A project without personal data takes `--privacy off` and gets none of it.
165
+
166
+ `--event-sourcing on`, off unless asked, since keeping an aggregate as its events is a choice made
167
+ per aggregate: `Persistence` gains `eventSourcing` (`create<Orm>EventSourcing` in the `event_store`
168
+ schema, whose five tables the schema file of Knex, Drizzle, Prisma and TypeORM then declares; the
169
+ in-memory stores without a database), and `src/platform/event-sourcing/` holds the `SubjectKeyStore`
170
+ of that store, wrapped by `auditedSubjectKeys` of `@ddd-ts-kit/audit` when the audit trail is on, so
171
+ that every erasure leaves a dated entry, and the `PersonalDataCipher` over it; `event-sourcing.module.ts`
172
+ binds `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` and `PersonalDataCipher`
173
+ on tsyringe, the hand-wired `Platform` carries them as `platform.eventSourcing`, and
174
+ `platform-test.module.ts` binds the in-memory stores, so a handler spec of an event-sourced
175
+ aggregate needs no fake. With both choices on, the erasure destroys the key first. The event store
176
+ of the kit runs on PostgreSQL through the four ORM packages: `--event-sourcing on` is refused with
177
+ `--orm custom`, with what to bind instead, and `generate aggregate --event-sourced` is refused
178
+ while the project has no event store, with the `init --force --event-sourcing on` to run. The
179
+ architecture reference (section 2), the CLI README, the config reference, the event sourcing page,
180
+ the persistence skill and the stack criteria say it.
181
+
182
+ To move: a project generated before this version keeps its platform as it is; `npx ddd-ts-kit init
183
+ --force --privacy on` writes the privacy folder and the two scripts, `npx ddd-ts-kit init --force
184
+ --event-sourcing on` the event store, then a migration creates the tables of the `event_store`
185
+ schema (`npm run db:generate event-store`).
186
+
187
+ **The erasure of a data subject from the tables of a context exists on the four ORMs, from the
188
+ `personalFields` declarations.** `KnexPersonalDataErasure`, `DrizzlePersonalDataErasure`,
189
+ `PrismaPersonalDataErasure` and `TypeOrmPersonalDataErasure` implement the `PersonalDataErasure`
190
+ port of the kernel over the unit of work of their package: the files the rows name are deleted
191
+ from the storage first, then the rows of the subject are deleted (`row`) or pseudonymised
192
+ (`pseudonymise`: a text column reads `[erased]`, a column of any other type nothing, a file column
193
+ nothing), and the rows reached are counted, none the second time. With the `tenant` option every
194
+ statement is confined to the tenant of the work and never widened by an elevation. A subject that
195
+ is not an opaque identifier is refused before any statement; a declaration that names file columns
196
+ without a file storage is refused when the adapter is built, and one that names a column or a
197
+ property the table does not have is refused before any file or row is touched. The types of the columns decide how a
198
+ column is pseudonymised (`pseudonymisedValueOf` of the kernel, the one rule the four follow), read
199
+ from the database on Knex and Prisma, from the table definition on Drizzle, from the entity on
200
+ TypeORM: a personal column that is not a text has to accept null, and a declaration that would
201
+ pseudonymise one that does not is refused before any file or row is touched
202
+ (`NotNullablePersonalColumnError`), so that an erasure never deletes the files of a person and
203
+ leaves their rows in clear. The four pass
204
+ `personalDataErasureContract` of `@ddd-ts-kit/testing`, on PGlite and PostgreSQL. Part 3 of
205
+ [privacy by design](../docs/proposals/privacy-by-design.md); the generator writes the declarations
206
+ in part 5, and the example adopts the adapter in part 11.
207
+
208
+ **The background jobs and the process managers run on a platform wired by hand: NestJS and `--di manual` gain `--queue database|redis`, `generate background-job` and `generate process`.** The platform of a project whose contexts are wired in a module file gains `src/platform/jobs/create-background-work.ts`, which builds the queue a use case enqueues through (`platform.jobQueue`), the worker that consumes it (`platform.backgroundJobs`) and the runner of the process managers (`platform.processes`) on the store `stack.queue` names: the jobs table of Knex or Drizzle, the server of the cache with Redis, the memory of the process otherwise, each job traced and its failures reported as on tsyringe. `init --queue database` and `--queue redis` are accepted with every container (the default stays `database` on Knex or Drizzle with tsyringe, `memory` otherwise), the application starts and stops the worker with its jobs, and `generate background-job` and `generate process` register the job in `<context>.module.ts` (`platform.backgroundJobs.register(..)`) with a spec built on the test buses of `@ddd-ts-kit/testing`, where they were refused before. The generated matrix runs background work on every stack, Nest with the jobs in the database and on Redis among them.
209
+
210
+ To move: a project on Nest or wired by hand that initialised before this version keeps its queue in memory; `init --force --queue database` (Knex or Drizzle) or `--queue redis` (with `--cache redis`) writes `create-background-work.ts` and the stores, then `generate background-job` works as on tsyringe. `PlatformOptions` gains `queues` (concurrency per queue, polling interval, grace period of the worker).
211
+
212
+ **The shared-table tenancy reaches Prisma and TypeORM: `init --tenancy shared-table` and `generate repository --tenant-scoped` work on the four ORMs, and `tenancy/scoped-statement` judges their adapters.** `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm` gain `tenantWhere(scope)`, spread into the where of every read (the tenant of the work, or the tenants an elevation of platform staff reaches), and `ownTenantWhere(scope)`, spread into the where of every update and delete (the one tenant of the work, which an elevation never widens); an inserted row spreads `tenantScopeOf`. Their outbox keeps the tenant of each event so that its consumers run in that tenant: `tenant: true` on `PrismaOutboxStore`, with the `tenantId` field the shipped fragment leaves commented out, and `outboxEntity({ tenant: true })` on TypeORM. Their read model stores take the `tenant` option of the Knex and Drizzle ones: every row written in the tenant of the work, every read, search and write confined to it, the copy of a rebuild included. Both repositories pass `tenantIsolationContract` of `@ddd-ts-kit/testing`, both outboxes the outbox contract with the tenant. `init` accepts `--tenancy shared-table` with `--orm prisma` and `--orm typeorm`: the generated repositories read with `findFirst` or `findOneBy` and `tenantWhere`, write with `ownTenantWhere`, name the tenant on the insert, declare `tenant_id` and an index that starts with it (the Prisma model, `tenantColumn()` on TypeORM), and the generated outbox keeps the tenant. The rule `tenancy/scoped-statement` reads a Prisma statement on the client (a read without `tenantWhere`, a write without `ownTenantWhere`, a create without `tenantScopeOf`, `findUnique` and `upsert`, raw SQL, the client held in a variable) and a TypeORM statement on the manager (the same, `save` and `upsert`, a query builder without the condition, a row handed to `insertIgnoringConflict` that names no tenant, `query`), and a read model store of the four ORMs built without its `tenant`. The generated matrix gains a Prisma and a TypeORM stack on shared tables.
213
+
214
+ To move: a Prisma or TypeORM project that confined its statements by hand with `tenantScopeOf` keeps working; `tenantWhere` in the where of its reads lets an elevation of platform staff read across tenants, and the rule asks for it once the project records `"stack.tenancy": "shared-table"`. A multi-tenant project on Prisma adds `tenantId String? @map("tenant_id")` to its outbox model, migrates, and gives `PrismaOutboxStore` `tenant: true`; on TypeORM it builds its outbox with `outboxEntity({ schema, tenant: true })` and generates the migration that adds the column.
215
+
216
+ **`generate repository --personal <column>,...` declares what a table keeps of a person, and writes the
217
+ erasure of its context: one command, and `npm run privacy:erase` reaches the new copy.** The named
218
+ columns join the storage and the row type of the aggregate as nullable text (the mapper writes them
219
+ empty until the aggregate carries them), and `<aggregate>.personal-fields.ts` declares them next to
220
+ the mapper with `personalFields` of the kernel: the subject column, `id` unless `--subject` names the
221
+ column that holds the id of the person, the fields, and `pseudonymise` unless `--erasure row` asks for
222
+ the row to be deleted; the declaration is spelled as the erasure of the ORM reads it, SQL names on
223
+ Knex and Prisma, properties on Drizzle and TypeORM. The first table of a context that declares
224
+ personal data brings the erasure of the context: the port
225
+ `application/ports/<context>-personal-data-erasure.port.ts` (`extends PersonalDataErasure`), the
226
+ adapter `<orm>-<context>-personal-data-erasure.repository.ts` over `<Orm>PersonalDataErasure` of the
227
+ ORM package (confined to the tenant of the work on a tenant-scoped repository), its fake, a spec that
228
+ saves two people through the repository and proves the erasure on the test database, the binding
229
+ where the context binds its adapters (the decorator in the declared style, the module file otherwise,
230
+ the factory of the hand-wired platform wrapped like any other adapter) and its line in
231
+ `src/platform/privacy/data-subject-copies.ts`. A second table of the same context joins the
232
+ declarations of that adapter. `*.personal-fields.ts` is a file of `infrastructure/persistence/` the
233
+ `naming/suffix` rule knows. Refused before anything is written: a project whose `stack.privacy` is
234
+ off (`init --force --privacy on`), `--orm none` or `custom` (no erasure adapter of the kit reads the
235
+ declaration), a column that is not one, a column the table keeps for itself, a subject listed as
236
+ personal, a mode that does not exist, `--subject` or `--erasure` without `--personal`. The CLI README,
237
+ the scaffold and persistence skills, the architecture reference and the proposal say it; a projection
238
+ keeps its rows in a read model store, not in a table of its own, so its declaration waits for the
239
+ register.
240
+
241
+ Proven end to end on generated projects: through the composed application (the container of
242
+ tsyringe, the platform wired by hand under Nest), two contexts and three tables, one person erased
243
+ from all of them in one run, in every tenant of a multi-tenant project or in the tenants given, the
244
+ key of the event store first when the project has one. That run uncovered a fault of the Knex erasure
245
+ adapter the direct tests could not see: bound in an application, every method of an adapter is
246
+ wrapped by tracing and by the aspects, and a helper that answered a query builder was awaited and its
247
+ chain broken; the helper is a function now, and the Knex spec runs the adapter wrapped the way the
248
+ platform binds it. `init --force`, which rewrites `data-subject-copies.ts`, lists the erasure of each
249
+ context again, as the port or as the factory of the hand-wired platform. The new concept page
250
+ [Personal data in a generated project](../docs/concepts/personal-data.md) draws the erasure end to
251
+ end, what stays out of reach and what the tool does not decide, in both languages.
252
+
253
+ **Mutation testing runs on a project of the kit, with Stryker 10.1.1 and its Vitest runner.** The
254
+ documentation said it did not: Stryker 10.0 executed no test per mutant under Vitest 5. Measured
255
+ on 2026-10-24 on the example application, 10.1.1 runs the tests per mutant and kills 1347 of the
256
+ 1441 mutants of the domain layer of its four contexts in 8 minutes, a score of 94.5%; the
257
+ pipeline README holds the measure, the configuration to run it by hand (no checker, the unit
258
+ specs alone, the domain layer as `mutate`) and what shipping it as a scheduled job with a floor
259
+ per context would take. The kit ships no gate yet.
260
+
261
+ **The right of access and to portability comes built in: `KnexPersonalDataExport`,
262
+ `DrizzlePersonalDataExport`, `PrismaPersonalDataExport` and `TypeOrmPersonalDataExport` read the same
263
+ `personalFields` declarations as the erasure, `exportDataSubject` of the kernel gathers every export
264
+ into one dated document, `auditedPersonalDataExport` of the audit package leaves the entry of each
265
+ handover, and `generate repository --personal` writes the export of a context beside its erasure.**
266
+ Each adapter answers one `PersonalDataRecord` per row about the subject in every declared table, under
267
+ `<name>.<table>`, with the personal columns and the keys of the files as plain data, no other column
268
+ and nothing of anyone else; the same `tenant` option confines every statement to the tenant of the
269
+ work, a subject that is not an opaque identifier is refused before any statement, and each passes
270
+ `personalDataExportContract`, whose `source` now reads the name of the exporter alone or followed by
271
+ the table. `exportDataSubject(subject, { exports, inEveryTenant, clock, isKnown })` answers a
272
+ `PersonalDataExportDocument`: `format` (`ddd-ts-kit/personal-data-export@1`), `subject`, `exportedAt`,
273
+ `records`; the exports run in the order listed and one that fails stops the gathering, a mistyped id
274
+ is refused when `isKnown` denies it rather than answered with an empty document, and
275
+ `recordsInEachTenant(scope, tenants)` reaches every tenant as `inEachTenant` does for an erasure
276
+ (both over `eachTenant`). `auditedPersonalDataExport(port, trail, { scope, clock, ids })` wraps a
277
+ port so that every `exportOf` writes an entry of category `data-access` and action
278
+ `personal-data:export` (`PERSONAL_DATA_EXPORT_ACTION`), with the subject as resource, the context,
279
+ the number of records and never the values, before the records are handed over: when the entry
280
+ cannot be written, nothing is handed over. In a generated project, `src/platform/privacy/run-export.ts`
281
+ runs `exportDataSubject` over the exports, each wrapped when the trail is on, and
282
+ `scripts/privacy-export.ts` prints the document as JSON; `generate repository <ctx> <Aggregate>
283
+ --personal <column>,...` writes, once per context, the export port (`extends PersonalDataExport`),
284
+ the adapter over `<Orm>PersonalDataExport`, its fake and its line in `data-subject-exports.ts`, bound
285
+ where the context binds its adapters, and one spec `test/integration/<context>-personal-data.spec.ts`
286
+ proves the erasure and the export; a second table joins the declarations of both adapters, and
287
+ `init --force` lists the exports again. The concept page draws the export end to end with its
288
+ diagram, in both languages, and the kernel, audit, ORM and CLI READMEs, the audit trail page, the
289
+ proposal and the skills say it.
290
+
291
+ **Mutation testing of the domain layer runs every night, each context held to a floor.** `init`
292
+ writes `stryker.config.mjs`, which spreads `governedMutation()` of `@ddd-ts-kit/testing/mutation`:
293
+ the domain layer of every context mutated, at its level and in the modules of its model, the
294
+ texts of refusals left out by an ignorer the kit ships, since a refusal is asserted by its code and
295
+ never by its text, every other string measured, the static mutants ignored, those of code that runs
296
+ once when the module loads, the floor as
297
+ `thresholds`; and `vitest.mutation.config.ts`, the unit specs alone. `npm run test:mutation` runs
298
+ Stryker, then `ddd-ts-kit mutation`, a new command that reads `reports/mutation/mutation.json` and
299
+ holds the domain of each context to the `mutation` floor of `ddd-ts-kit.config.json`, 80 by the
300
+ reference (a lower floor is a recorded deviation, `"what": "mutation.domain"`), and exits 1 under
301
+ it; the ignored mutants of each context are shown beside its score, since a rule written as a
302
+ declaration is never mutated and its test is its only proof. The pipelines of GitHub and GitLab get a
303
+ `mutation` job that runs it when the schedule fires, never on a pull or merge request, and keeps
304
+ the report as an artifact. A new rule, `test/mutation-governed`, refuses a `mutate`,
305
+ `mutator`, `ignorers`, `ignoreStatic` or `thresholds` written by hand in a Stryker config, and a
306
+ Stryker config that does not read the kit. The example application and the pipeline of the kit run
307
+ the same job. On both runners: a project on Jest gets `jest.mutation.config.js` in place of the
308
+ Vitest one, and its Stryker config passes the ES modules flag to the processes that run the specs.
309
+
310
+ To move: `npm i -D @stryker-mutator/core @stryker-mutator/vitest-runner` (`jest-runner` on Jest),
311
+ copy `stryker.config.mjs` and `vitest.mutation.config.ts` or `jest.mutation.config.js` from a
312
+ freshly initialised project (or run `init --force` on a copy and take the two files and the
313
+ `test:mutation` script), add the
314
+ `mutation` job to your pipeline from `pipeline/github/workflows/ci.yml` or
315
+ `pipeline/gitlab/.gitlab-ci.yml`, list `vitest.mutation.config.ts` under `vitest.config` of
316
+ `knip.json`, and add `.stryker-tmp/` and `/reports/mutation/` to `.gitignore`. Run
317
+ `npm run test:mutation` once: a context under 80 names the rules its tests do not state.
318
+
319
+ **Six rules of `@ddd-ts-kit/eslint-plugin` hold the shape of a test.** The testing skill asked
320
+ for it and nothing checked it: a test is named after the rule it proves, holds no logic, asserts an
321
+ outcome, asserts a refusal by its code, never by a snapshot, and every test runs. Each is a rule
322
+ of the architecture reference now, on every test file of the project (`*.spec.ts`, `*.test.ts`,
323
+ the `test/` of a context), read by ESLint alone: `test/no-only-no-skip` (no `.only`, `.skip`, `fit`,
324
+ `xit`, `xdescribe`, no `.skipIf` or `.runIf` on a constant), `test/title-states-a-rule` (the title of an `it`
325
+ in lower case, what the subject does, after the rows and the criterion it cites, never `should`,
326
+ `test`, `works` nor a method or a class; a `describe` named after the unit),
327
+ `test/no-logic` (no `if`, `switch`, ternary, loop or `try` in a test), `test/assertion-present`
328
+ (an `expect`, an `expect...` or `assert...` helper, or `thenEvents`, `thenError`, `thenState` in
329
+ every test; `it('title')` without a body written `it.todo`), `test/refusal-by-code` (`toThrow`
330
+ with a message, a regular expression, a class or nothing reported in the specs of the model and of
331
+ the application, not in those of the adapters and of the platform; `thenError`, `expectRefusal`,
332
+ `rejects.toMatchObject({ code })` and `expectProblem` instead, and `rejects.toBe(outage)` for a
333
+ failure the test injected) and
334
+ `test/no-snapshot`. `ddd-ts-kit rules` lists them as checked by the plugin, `ddd-ts-kit explain`
335
+ explains each, the config sets their severity under `rules`. The `it.todo` left in a spec was
336
+ already a marker `ddd-ts-kit todo` lists and `story --gate close` refuses while it belongs to the
337
+ story: the testing strategy and the skill now say so. The example application and the templates
338
+ follow the six rules; the rules of the agents on tests (`.claude/rules/tests.md`,
339
+ `.github/instructions/tests.instructions.md`) name them.
340
+
341
+ To move: run `npm run lint`. `test/no-only-no-skip` and `test/no-snapshot` are errors, as nothing
342
+ legitimate trips them; the four rules that read what a test says, `test/title-states-a-rule`,
343
+ `test/no-logic`, `test/assertion-present` and `test/refusal-by-code`, are warnings until 0.90.0,
344
+ listed by `ddd-ts-kit lint` after its report without failing it. Rename a title that says
345
+ `should` or names a method, move a loop to an `it.each` and a decision to a builder or a fake,
346
+ replace a `toThrow('message')` by the code of the refusal, and write `it.todo` where a test has
347
+ no body. A project that wants none of a rule sets it to `off` under `rules` of
348
+ `ddd-ts-kit.config.json`.
349
+
350
+ **A pull request gets a reading of its mutation score, the night keeps the whole measure.** The
351
+ pipelines of GitHub and GitLab get a `mutation-changed` job on a pull or merge request: it reuses
352
+ the report of the last night for what the change leaves alone (Stryker's incremental mode, turned
353
+ on by `governedMutation()` when `DDD_TS_KIT_MUTATION_SINCE` names the merge base of the change,
354
+ the results kept in `reports/mutation/incremental.json` beside the report), runs everything again
355
+ when the change touches code the tests lean on and Stryker does not diff (a fake, a builder, a
356
+ world, the platform, a dependency), and lists the survivors of the files the change touched:
357
+ `ddd-ts-kit mutation` reads the same variable (`--changed <ref>` says it by hand) and exits 0
358
+ whatever the scores, a reading and never a gate, so that `npm run test:mutation` is the one script
359
+ of the night and of a pull request. `ddd-ts-kit mutation --survivors` lists every survivor of the
360
+ report, where, what mutator and what the code became. `test/mutation-governed` also refuses `incremental` and `force` written by
361
+ hand.
362
+
363
+ To move: add the `mutation-changed` job to your pipeline from `pipeline/github/workflows/ci.yml` or
364
+ `pipeline/gitlab/.gitlab-ci.yml`; nothing else changes, the Stryker config spreads
365
+ `governedMutation()` already.
366
+
367
+ **The invariants of a value object are stated as properties, with fast-check.** `fast-check` joins
368
+ the development dependencies with the first property (`npm i -D fast-check`, under Vitest as under
369
+ Jest: a project without a property carries no dead dependency); `fc.assert(fc.property(..))` is an
370
+ assertion for `test/assertion-present`; and the spec `generate value-object` writes ends with a
371
+ planned rule, `keeps its invariants for any value a generator can produce, as a property`, to remind
372
+ of it. A property states a law of the model once and checks it on generated values, the failing one
373
+ printed with its seed and shrunk to the smallest: two ranges overlap in both directions or in none,
374
+ a slot is held at least until it ends, a parse then a format gives the value back. The example
375
+ states four on its ranges and slots. A property is for a law, an invariant, a symmetry, a round trip,
376
+ an idempotence; the orchestration of a use case is stated by its scenarios. The testing skill and
377
+ the testing strategy say when and how.
378
+
379
+ To move: `npm i -D fast-check`, then state the first law a value object of yours holds for every
380
+ value.
381
+
382
+ **An erasure now reaches beyond the database the platform holds: `privacy:erase` announces
383
+ `privacy.data-subject.erased` through the outbox once every copy is erased, `generate
384
+ erasure-handler <context>` writes the idempotent handler of a context that erases its own copy, and
385
+ an integration event says which fields of its payload are personal, and whose.** The event is
386
+ `dataSubjectErasedV1` of `@ddd-ts-kit/kernel`, version 1, `{ subjectId, erasedAt }`:
387
+ the id of the person and nobody else, the operator staying in the audit trail that the correlation id
388
+ of the event leads to, a name or an email refused at `create` (`InvalidDataSubjectErasedError`). It lives
389
+ in the kernel because the application layer of every context handles it, and it is shaped as a
390
+ definition of `@ddd-ts-kit/events`, so that the registry, the catalog, AsyncAPI, `on`, `consume`,
391
+ `@IntegrationEventHandler` and the container take it as any other. A generated project with
392
+ `--privacy on` publishes it at the end of `runErasure`, once per tenant with shared tables, never
393
+ after a failed erasure, and lists it in its event catalog and AsyncAPI document with the contexts
394
+ that consume it. `generate erasure-handler <context>` writes
395
+ `application/integration/handlers/data-subject-erased.integration-handler.ts` over the
396
+ `<Context>PersonalDataErasure` of the context, its spec on the fake, and its subscription under the
397
+ consumer name `<context>.data-subject-erased`: the decorator in the declared style, the module file
398
+ of an explicit context, the hand-wired platform with the adapter wrapped as any other (in a
399
+ transaction behind a broker); it refuses a context that has no erasure yet. `defineIntegrationEvent`
400
+ takes `personal: { subject, fields }`, checked against the fields the payload schema documents (no
401
+ field, a field twice, a personal subject or an unknown path is refused), written by the catalog
402
+ under the payload and by AsyncAPI as `x-personal-data` on the message. The events, kernel and CLI
403
+ READMEs, the concept page and its diagram, the proposal and the persistence and integration event
404
+ skills say it, in English and in French.
405
+
406
+ **The mutation score holds the application layer too, at a floor of its own.** `governedMutation()`
407
+ mutates the application layer of every context beside its domain, at its level and in the modules
408
+ of its model, and `ddd-ts-kit mutation` scores each layer of each context against its floor: the
409
+ `mutation` key of `ddd-ts-kit.config.json` takes `"application"` beside `"domain"`, 75 by the
410
+ reference, five below the domain as the coverage reference steps down from one layer to the next,
411
+ and lowering it is a recorded deviation (`"what": "mutation.application"`). The use cases hold
412
+ rules the domain does not: the permission a command requires, the idempotence of a handler, the
413
+ event it publishes, the refusal it relays; a survivor there is a rule no test states as much as in
414
+ an aggregate. On the example the application layer scores 95.7, its lowest context 93.5, and the
415
+ run grows by twenty seconds: the initial test run is what the night pays for, not the mutants.
416
+
417
+ To move: nothing, unless a context sits under 75 on its application layer: `npm run test:mutation`
418
+ names the survivors to read, a test to write for each rule, or a deviation to record.
419
+
420
+ **The audit trail of a generated project on Prisma or TypeORM is kept in its database, no longer in
421
+ the memory of the process: `@ddd-ts-kit/audit/prisma` and `@ddd-ts-kit/audit/typeorm` give
422
+ `PrismaAuditTrail` and `TypeOrmAuditTrail`, held to the same contract as the Knex and Drizzle
423
+ stores.** Until now `--orm prisma` and `--orm typeorm` started on an `InMemoryAuditTrail` behind a
424
+ `TODO(platform)`, so the proof of every command, decision, erasure, export and purge was lost when
425
+ the process stopped. The four stores share one PostgreSQL implementation (the hash chain, the head
426
+ locked per chain, the entries written at the commit of the unit of work). `auditPrismaModels(schema)`
427
+ gives the two Prisma models and `auditEntities({ schema })` the two TypeORM entities; their specs
428
+ prove that, created by the migrations of a project, they give the columns, the keys and the
429
+ indexes of `createAuditTables`. On Prisma the statements are raw ones on the client of the unit of
430
+ work, an append inside a transaction takes a savepoint, a failure of the database comes back with
431
+ its SQLSTATE as `code`, and the reader asks PostgreSQL for the instant in UTC, since the adapter of
432
+ pg reads a `timestamptz` without the offset of the session (the shared reader does so for every
433
+ store). `init --audit on` with Prisma or TypeORM writes the models in `prisma/schema.prisma` (the
434
+ `audit` schema added to the datasource) or the entities in `schema.ts`, binds the store in
435
+ `create-audit.ts`, adds `npm run db:audit-guard` for the append-only guard to paste in a
436
+ migration, and the test databases install that guard and leave the trail out of `reset()`.
437
+
438
+ To move: a project on Prisma or TypeORM with `--audit on` runs `init --force` to get the store, then
439
+ generates a migration for the two tables and adds one holding what `npm run db:audit-guard`
440
+ prints.
441
+
442
+ **Each spec file is held to the time budget of its level.** The reporter of the test runner the kit
443
+ ships, `@ddd-ts-kit/testing/budget/vitest` and `@ddd-ts-kit/testing/budget/jest`, named in the runner
444
+ config `init` writes and passed with `--reporter` where the pipeline names its reporters, reads the
445
+ `budget` key of `ddd-ts-kit.config.json`, five seconds for a unit spec file and thirty for an
446
+ integration spec file by the reference, names the slowest spec of each level at the end of every run,
447
+ and warns when a spec file took more than its budget, its tests and hooks timed, the loading of its modules left out; `"enforce": true` under `budget` makes it fail the run, once the measures of a project are stable, since a duration depends on the load of the machine as much as on the spec. A unit
448
+ spec of a context runs the model and the use cases on fakes; an integration spec of a context, and a
449
+ spec of the platform, opens a database or reaches a server; the specs of the application outside the
450
+ contexts (end to end, acceptance, architecture) are not held. A slow spec hides a world rebuilt per
451
+ test, I/O behind a fake, or a wait: lowering a budget is free, raising one above the reference is a
452
+ recorded deviation (`"what": "budget.unit"`), and a budget that is no duration is reported by
453
+ `config/valid`. On the example, the slowest unit spec takes 1.6 seconds and the slowest integration
454
+ spec 11, under load.
455
+
456
+ To move: name the reporter in your runner config, `reporters: ['default', '@ddd-ts-kit/testing/budget/vitest']`
457
+ (or `budget/jest`), and in the commands of your pipeline that pass `--reporter`.
458
+
459
+ **The oldest entries of the audit trail leave the database for the file storage, verified and
460
+ anchored: `archiveBefore(date, { files, clock })` on the four SQL stores and on
461
+ `InMemoryAuditTrail`, and a generated project archives every month what is older than the twelve
462
+ whole months it keeps online.** Each entry keeps the identifiers of a person, and a trail grows
463
+ for as long as the system lives (GDPR article 5(1)(e)). For each chain, in one transaction
464
+ holding its head, the entries after the last archive and older than the date are verified from
465
+ the anchor of the archive before them, written to one file (`audit-archives/<chain>/<from>-<to>.ndjson`,
466
+ one canonical JSON per line), recorded in the new `audit_archives` table with their last hash
467
+ and the SHA-256 of the file, then deleted: the guard of the trail lets a `DELETE` through only
468
+ for entries an archive covers, and refuses any change to the archives. A chain that does not
469
+ verify is refused (`AuditArchiveRefusedError`) and keeps every entry. `archivesOf(chain)` lists
470
+ the archives, `verifyArchive(text, archive, previous)` checks a file again, and `verifyChain`
471
+ takes `after`, the anchor the entries left in the database start from. `ArchiveAuditEntries` is
472
+ the scheduled job; `init` registers it as `audit.archive` (first day of the month, 04:00 UTC,
473
+ `JOB_AUDIT_ARCHIVE_ENABLED=false` switches it off) when the trail is in a database and the
474
+ project keeps files in a storage, and declares the archives with the rest of the trail on the
475
+ four ORMs. Archiving moves, it does not erase: how long the files are kept is the controller's
476
+ decision.
477
+
478
+ To move: a trail created before this version adds the archives once, in a migration:
479
+ `addAuditArchives(knex, { schema: 'audit' })` on Knex; on Drizzle, Prisma and TypeORM, `init
480
+ --force` declares the table, the migration of the ORM creates it, and a migration of your own
481
+ runs the statements of `auditArchiveUpgradeStatements('audit')` (the guard that lets archived
482
+ entries go, and the guard of the archives). Until then, `archiveBefore` fails on the missing
483
+ table and the job reports the failed run.
484
+
485
+ **In a context wired by hand (`--di manual`, `--di nest`), `generate repository` no longer creates
486
+ the repository in the module file: the first `generate command --aggregate` that needs it does, and
487
+ the next one finds it there.** Until now the module file of a context with a repository and no
488
+ command yet held a constant nothing read, and its import, which the lint of the project refused
489
+ (`no-unused-vars`). `declarations/port-adapter-wired` agrees: an adapter whose port no class needs
490
+ yet (no file outside the infrastructure and the tests names it, but the one that declares it) is not
491
+ reported, since nothing misses it at run time.
492
+
493
+ To move: nothing. A module file written by an earlier version keeps its constant; the next command
494
+ on the same aggregate finds it and adds nothing.
495
+
496
+ **What a table keeps of a person can now be kept for a set time: `personalFields` takes a
497
+ `retention`, the erasure adapters of the four ORMs purge what outlived it, and a generated project
498
+ runs that purge every night, audited.** `retention: { after, days | months | years }` counts the
499
+ period from a date column of the row that is not personal data, one positive unit (refused
500
+ otherwise); a row whose date is empty never expires. The kernel adds the port
501
+ `PersonalDataRetention` (`purgeExpired(now)`), `purgeExpiredPersonalData(now, retentions)`, which
502
+ runs every copy at one instant and answers the rows each reached, `expiredBefore` and
503
+ `isPersonalDataRetention`; `InMemoryPersonalData` implements it, and
504
+ `personalDataRetentionContract` of `@ddd-ts-kit/testing` holds every adapter to it. The erasure
505
+ adapters of Knex, Drizzle, Prisma and TypeORM implement `purgeExpired` from the same declarations,
506
+ as the declaration says, files first, in the tenant of the work or in every tenant when the work
507
+ names none: the one write of the kit across tenants, chosen because a tenant left out of a list
508
+ would keep what it should not, bounded to an erasure by the date of the row, and written in the
509
+ multitenancy page. `auditedPersonalDataRetention` of `@ddd-ts-kit/audit` records each purge (`data-access`,
510
+ `personal-data:purge`, the context, `changes: { rows }`, no person). `generate repository ...
511
+ --personal ... --retention <column>:<n><d|m|y>` writes the retention in the declaration, adds a
512
+ column that dates the end of the relation to the storage as a nullable timestamp, empty while it
513
+ lasts (it refuses `registered_at` and the other columns the table keeps for itself: counted from the
514
+ registration, the purge would erase people who are still customers), and proves the purge in the
515
+ generated spec. `init --privacy on` writes `src/platform/privacy/run-purge.ts`, schedules
516
+ `privacy.purge-expired` every night at 03:00 UTC (the privacy module on tsyringe, the platform wired
517
+ by hand), switched off by `JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false`, and the script `privacy:purge`.
518
+ The concept page, the kernel, audit, ORM and CLI READMEs, the proposal and the skills say it, in
519
+ English and in French.
520
+
521
+ To move: `init --force` on a project with `--privacy on` writes the purge runner, the job and the
522
+ script; a declaration without `retention` purges nothing.
523
+
524
+ **`ddd-ts-kit docs` writes the register of personal data from the code: a Personal data section in
525
+ each `CONTEXT.md`, and with `--privacy on` the file `docs/privacy/register.md`, held to the code by
526
+ `docs --check`.** It reads every `personalFields` call of `infrastructure/persistence/*.personal-fields.ts`,
527
+ the one `generate repository --personal` writes or one written by hand (several per file), and the
528
+ `personal` option of the integration events. Each table is one row: the column that names the
529
+ person, the personal columns and files, what an erasure does (`pseudonymised`, `row deleted`), how
530
+ long the rows are kept (`36 months after ended_at`, or `until erased`); the columns are named as the
531
+ database names them on the four ORMs, a Drizzle or TypeORM declaration read back through the table it
532
+ names. The register adds the integration events that carry personal data and the contexts
533
+ downstream of their producer. It is not the record of processing activities of GDPR article 30:
534
+ the purposes, the lawful basis, the recipients outside the system and what the code does not purge
535
+ are sections around the markers that the controller writes and `docs` keeps.
536
+
537
+ To move: nothing to do. The next `npx ddd-ts-kit docs` (or `generate`) of a project with
538
+ `stack.privacy: "on"` creates `docs/privacy/register.md`, and adds the Personal data section to the
539
+ `CONTEXT.md` of each context that declares personal data; commit both, `docs --check` holds them
540
+ from then on.
541
+
542
+ **`ddd-ts-kit check` holds a project whose `stack.privacy` is `on` to its declarations of personal
543
+ data, with five new rules, all warnings: `privacy/declared-field`, `privacy/event-payload-declared`,
544
+ `privacy/erasure-reaches-copies`, `privacy/subject-is-opaque` and `privacy/no-personal-data-in-logs`.**
545
+ The erasure, the export, the retention and the register read the `personalFields` declarations and
546
+ the `personal` option of the integration events, never the columns: a copy of a person nobody
547
+ declared is a copy nobody erases, and nothing failed until now.
548
+
549
+ - `privacy/declared-field`: a column of a table of a context (Knex, Drizzle, TypeORM, and the Prisma
550
+ models in the schema of the context) whose name holds a word of the personal vocabulary and that
551
+ no declaration of its context names.
552
+ - `privacy/event-payload-declared`: a field of the payload of an integration event named like
553
+ personal data that its `personal` option does not list.
554
+ - `privacy/erasure-reaches-copies`: a context that consumes an event carrying personal data (a
555
+ handler, a projection, a process manager) and declares no `PersonalDataErasure` and handles no
556
+ `privacy.data-subject.erased`.
557
+ - `privacy/subject-is-opaque`: the subject of a declaration or of an event that is personal data
558
+ itself, or one of its personal fields.
559
+ - `privacy/no-personal-data-in-logs`: a call to the logger or to the metrics that names a declared
560
+ personal field.
561
+
562
+ The identity preset declares what it keeps of people when `stack.privacy` is `on`: the address and
563
+ the name of an account (pseudonymised when the person is erased) and the address an invitation was
564
+ sent to (the row deleted thirty days after the invitation expired, by the nightly purge), with the
565
+ erasure and the export of the context written and listed in the platform, not confined to a tenant
566
+ since its tables belong to none.
567
+
568
+ The vocabulary is the one of the kit (`email`, `phone`, `first_name`, `birth_date`, `address`,
569
+ `iban`, `ip_address` and the others listed in the configuration reference); the new config key
570
+ `privacy`, `{ "vocabulary": [...], "allow": [...] }`, adds the words of the business and removes a
571
+ word that never names a person in the project. A project with `stack.privacy` off, or whose config
572
+ predates the choice, is not judged.
573
+
574
+ To move: nothing blocks. `npx ddd-ts-kit check --rule privacy/declared-field` (and the four others)
575
+ lists what to take up: declare the column (`generate repository ... --personal`), list the field in
576
+ `personal: { subject, fields }`, erase the copy (`generate erasure-handler` for a service of its own),
577
+ or record a column that holds nothing of a person, `// ddd-ts-kit-disable-next-line
578
+ privacy/declared-field -- ADR-NNNN: <why>` or a word of `privacy.allow`. The rules stay warnings:
579
+ they read names, never contents, so a column `address` of a warehouse is reported as well as the
580
+ address of a person; no later version turns them into errors. A team that wants them blocking sets
581
+ `"rules": { "privacy/declared-field": "error" }` in ddd-ts-kit.config.json, rule by rule.
582
+
583
+ **The monthly archive of the audit trail runs by default only when the files of the project are in
584
+ an object store, and no entry leaves the database before its file reads back from the storage as it
585
+ was written.** An archive removes the entries from the database; with `--storage local`, the default
586
+ of `init`, the files are on the disk of the server, which a redeployment may wipe and a backup may
587
+ not reach, and the proof of who did what would be lost a year after going live. A generated project
588
+ with `--storage s3` keeps the job on (`JOB_AUDIT_ARCHIVE_ENABLED=false` switches it off); one with
589
+ `--storage local` writes it off, and `JOB_AUDIT_ARCHIVE_ENABLED=true` switches it on once that disk
590
+ is durable and backed up, which `job-settings.ts` says next to the line. `archiveBefore` of the
591
+ four SQL stores and of `InMemoryAuditTrail` reads each file back and checks its digest before the
592
+ entries are removed: a storage that did not keep it is refused with the new
593
+ `AuditArchiveNotStoredError`, and the trail keeps every entry.
594
+
595
+ To move: a project generated with `--storage local` by the previous version has the job on; change
596
+ its line of `src/platform/jobs/job-settings.ts` to
597
+ `'audit.archive': { enabled: environment['JOB_AUDIT_ARCHIVE_ENABLED'] === 'true' }`, or keep it on
598
+ where the files already land on a durable, backed-up disk.
599
+
600
+ **The scheduling example declares what it keeps of people and erases and exports it through the
601
+ ports of the kit: `personalFields` in each context, a `PersonalDataErasure` and a
602
+ `PersonalDataExport` per context over the adapters of `@ddd-ts-kit/knex`, `eraseDataSubject` and
603
+ `exportDataSubject` of the kernel, and the register and the privacy rules on.** The persons of
604
+ identity and the contacts of notification are deleted, the notes, the cancellation reasons, the
605
+ documents and the copied names of scheduling pseudonymised; notification keeps its own erasure,
606
+ which deletes a contact under a stamp so that a redelivered announcement does not bring the address
607
+ back. The hand-written erasure engine of the example is gone, its platform folder is
608
+ `src/platform/privacy/`, `npm run erase:patient` becomes `npm run privacy:erase`, and `npm run
609
+ privacy:export` hands over one dated document of what every context keeps of a person, every
610
+ handover audited. `identity.person.registered` and `identity.practice.member-added` declare their
611
+ personal fields, so the event catalog and AsyncAPI say so; `docs/privacy/register.md` is generated,
612
+ with the sections a controller writes filled in as an illustration.
613
+
614
+ To move: nothing for a project. For a reader of the example: run `npm run privacy:erase` where
615
+ `npm run erase:patient` was run; the report names each copy by its context (`identity`,
616
+ `notification`, `scheduling`) and counts the rows reached.
617
+
618
+ **The tests are read back as a document: `ddd-ts-kit docs` writes `docs/behaviour/`, one page per
619
+ context of what its tests state.** Each page lists, in the words of the test titles, the rules of
620
+ the context grouped as the specs group them (`describe` and `it`, a table of cases as one rule), with
621
+ the role of each spec (`slot (value object), in calendars`), a planned rule (`it.todo`) and a spec
622
+ put aside said so, and the counts; `docs/behaviour/application.md` does the same for the specs
623
+ outside the contexts (end to end, acceptance, architecture) and `docs/behaviour/README.md` indexes
624
+ them. `npm run docs:generate` writes them with the other generated documents, the pre-commit hook `init` writes regenerates and adds them when a spec is staged, with `ddd-ts-kit docs --behaviour`, which writes those pages alone, and `docs --check` holds them
625
+ current, so a spec whose title changed never reaches the trunk without its page. This
626
+ is the reading the business asks of Gherkin, without a second language to keep in step: the title of
627
+ a test, which `test/title-states-a-rule` makes a rule, is the sentence. Under `generate --local-only`
628
+ the pages are left to the trunk, as every shared file is.
629
+
630
+ To move: run `npm run docs:generate` once and commit `docs/behaviour/`; add the `behaviour pages`
631
+ job to the `pre-commit` of your `lefthook.yml` from `pipeline/lefthook.yml`.
632
+
7
633
  ## 0.88.0
8
634
 
9
635
  **The code list and the permission set of a context sit at its root: `<context>.codes.ts` and `<context>.permissions.ts`.** They are one per context, whatever its modules, so they now sit next to `CONTEXT.md` and `<context>.declarations.ts` instead of `domain/errors/codes.ts` and `application/authorization/<context>.permissions.ts`. `domain/errors/` holds the refusal classes, `application/authorization/` the policies, and a folder that held the code list or the permission set alone is gone. In a context divided into modules, `domain/` and `application/` now hold nothing but their modules. Every rule reads the two files as it read them in their role folder: `<context>.codes.ts` is the code list of the domain for `errors/*`, `naming/suffix` and the layer rules, `<context>.permissions.ts` the permission set of the application for `authz/*`. `ddd-ts-kit check`, the ESLint plugin and the generated `.dependency-cruiser.cjs` follow (the domain may import the code list of its context, the application both files). The generators, the templates, the identity preset and `error-factories` write them at the root, and knip is told of the code types as `src/contexts/*/*.codes.ts`, and also where 0.86 and 0.87 kept them as long as one context still holds its list there (`init`, `generate` and `context-layout` keep the two patterns in step with the tree). `ddd-ts-kit context-layout [<context>...] [--dry-run]` is new: it moves the two files of every context, or of the ones named, from where 0.86 and 0.87 wrote them to the root, rewrites every import of them under the source root, `test/` and `scripts/`, removes a role folder the move leaves empty, writes again what derives from the tree (`.dependency-cruiser.cjs`, the generated declarations) and tells knip of the code lists where they now are; it says each file it wrote, `--dry-run` included.