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
@@ -0,0 +1,41 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { KnexPersonalDataErasure, type KnexContext } from '@ddd-ts-kit/knex';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ // ddd-ts-kit:imports
15
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
16
+ // /ddd-ts-kit:imports
17
+
18
+ /**
19
+ * What {{context.kebab}} keeps of a person in clear, erased from every table declared below as its
20
+ * declaration says: the rows of the person deleted, or their personal columns pseudonymised, the files
21
+ * they name deleted first. Run by `npm run privacy:erase` with the copies of the other contexts, never
22
+ * by a use case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
23
+ */
24
+ {{#if style.declared}}
25
+ @Repository({{personal.names.port}})
26
+ {{/if}}
27
+ {{personal.header}}
28
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
29
+ super(database, {
30
+ name: '{{context.kebab}}',
31
+ declarations: [
32
+ // ddd-ts-kit:personal-fields
33
+ {{aggregate.pascal}}PersonalFields,
34
+ // /ddd-ts-kit:personal-fields
35
+ ],
36
+ {{#if tenant.scoped}}
37
+ tenant: scope,
38
+ {{/if}}
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,43 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { PrismaPersonalDataErasure } from '@ddd-ts-kit/prisma';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ import type { Prisma } from '{{alias.generated}}/prisma/client{{alias.ext}}';
15
+ {{storage.adapterImport}}
16
+ // ddd-ts-kit:imports
17
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
18
+ // /ddd-ts-kit:imports
19
+
20
+ /**
21
+ * What {{context.kebab}} keeps of a person in clear, erased from every table declared below as its
22
+ * declaration says: the rows of the person deleted, or their personal columns pseudonymised, the files
23
+ * they name deleted first. Run by `npm run privacy:erase` with the copies of the other contexts, never
24
+ * by a use case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
25
+ */
26
+ {{#if style.declared}}
27
+ @Repository({{personal.names.port}})
28
+ {{/if}}
29
+ {{personal.header}}
30
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
31
+ super(database, {
32
+ name: '{{context.kebab}}',
33
+ declarations: [
34
+ // ddd-ts-kit:personal-fields
35
+ {{aggregate.pascal}}PersonalFields,
36
+ // /ddd-ts-kit:personal-fields
37
+ ],
38
+ {{#if tenant.scoped}}
39
+ tenant: { scope },
40
+ {{/if}}
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,41 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { TypeOrmPersonalDataErasure, type TypeOrmContext } from '@ddd-ts-kit/typeorm';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ // ddd-ts-kit:imports
15
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
16
+ // /ddd-ts-kit:imports
17
+
18
+ /**
19
+ * What {{context.kebab}} keeps of a person in clear, erased from every table declared below as its
20
+ * declaration says: the rows of the person deleted, or their personal columns pseudonymised, the files
21
+ * they name deleted first. Run by `npm run privacy:erase` with the copies of the other contexts, never
22
+ * by a use case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
23
+ */
24
+ {{#if style.declared}}
25
+ @Repository({{personal.names.port}})
26
+ {{/if}}
27
+ {{personal.header}}
28
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
29
+ super(database, {
30
+ name: '{{context.kebab}}',
31
+ declarations: [
32
+ // ddd-ts-kit:personal-fields
33
+ {{aggregate.pascal}}PersonalFields,
34
+ // /ddd-ts-kit:personal-fields
35
+ ],
36
+ {{#if tenant.scoped}}
37
+ tenant: { scope },
38
+ {{/if}}
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,24 @@
1
+ import type { PersonalDataRecord } from '@ddd-ts-kit/kernel';
2
+ import type { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
3
+
4
+ /** Hands over the records a test gave it of each person, and remembers who was asked. */
5
+ export class {{personal.names.exportFake}} implements {{personal.names.exportPort}} {
6
+ readonly name = '{{context.kebab}}';
7
+
8
+ readonly asked: string[] = [];
9
+
10
+ private readonly records = new Map<string, PersonalDataRecord[]>();
11
+
12
+ /** What the export of this person hands over, as the test arranges it. */
13
+ holds(subject: string, ...records: readonly PersonalDataRecord[]): this {
14
+ this.records.set(subject, [...(this.records.get(subject) ?? []), ...records]);
15
+
16
+ return this;
17
+ }
18
+
19
+ async exportOf(subject: string): Promise<readonly PersonalDataRecord[]> {
20
+ this.asked.push(subject);
21
+
22
+ return this.records.get(subject) ?? [];
23
+ }
24
+ }
@@ -0,0 +1,8 @@
1
+ import { PersonalDataExport } from '@ddd-ts-kit/kernel';
2
+
3
+ /**
4
+ * The right of access and to portability, for what {{context.kebab}} keeps of a person in clear: the columns its
5
+ * tables declare with `personalFields`, handed over as plain data, one record per row. Run by the platform
6
+ * (`npm run privacy:export`) with the exports of the other contexts, never by a use case.
7
+ */
8
+ export abstract class {{personal.names.exportPort}} extends PersonalDataExport {}
@@ -0,0 +1,43 @@
1
+ import type { PgQueryResultHKT } from 'drizzle-orm/pg-core';
2
+ import { DrizzlePersonalDataExport } from '@ddd-ts-kit/drizzle/postgres';
3
+ {{#if tenant.scoped}}
4
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
5
+ {{/if}}
6
+ {{#if style.declared}}
7
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
8
+ {{/if}}
9
+ {{#if style.declared}}
10
+ import { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
11
+ {{/if}}
12
+ {{#unless style.declared}}
13
+ import type { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
14
+ {{/unless}}
15
+ {{storage.adapterImport}}
16
+ // ddd-ts-kit:imports
17
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
18
+ // /ddd-ts-kit:imports
19
+
20
+ /**
21
+ * What {{context.kebab}} keeps of a person in clear, handed over from every table declared below as
22
+ * plain data: one record per row about the person, under `{{context.kebab}}.<table>`, the personal columns
23
+ * alone. Run by `npm run privacy:export` with the exports of the other contexts, never by a use
24
+ * case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
25
+ */
26
+ {{#if style.declared}}
27
+ @Repository({{personal.names.exportPort}})
28
+ {{/if}}
29
+ {{personal.exportHeader}}
30
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
31
+ super(database, {
32
+ name: '{{context.kebab}}',
33
+ declarations: [
34
+ // ddd-ts-kit:personal-fields
35
+ {{aggregate.pascal}}PersonalFields,
36
+ // /ddd-ts-kit:personal-fields
37
+ ],
38
+ {{#if tenant.scoped}}
39
+ tenant: { scope },
40
+ {{/if}}
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,41 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { KnexPersonalDataExport, type KnexContext } from '@ddd-ts-kit/knex';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ // ddd-ts-kit:imports
15
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
16
+ // /ddd-ts-kit:imports
17
+
18
+ /**
19
+ * What {{context.kebab}} keeps of a person in clear, handed over from every table declared below as
20
+ * plain data: one record per row about the person, under `{{context.kebab}}.<table>`, the personal columns
21
+ * alone. Run by `npm run privacy:export` with the exports of the other contexts, never by a use
22
+ * case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
23
+ */
24
+ {{#if style.declared}}
25
+ @Repository({{personal.names.exportPort}})
26
+ {{/if}}
27
+ {{personal.exportHeader}}
28
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
29
+ super(database, {
30
+ name: '{{context.kebab}}',
31
+ declarations: [
32
+ // ddd-ts-kit:personal-fields
33
+ {{aggregate.pascal}}PersonalFields,
34
+ // /ddd-ts-kit:personal-fields
35
+ ],
36
+ {{#if tenant.scoped}}
37
+ tenant: scope,
38
+ {{/if}}
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,43 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { PrismaPersonalDataExport } from '@ddd-ts-kit/prisma';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ import type { Prisma } from '{{alias.generated}}/prisma/client{{alias.ext}}';
15
+ {{storage.adapterImport}}
16
+ // ddd-ts-kit:imports
17
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
18
+ // /ddd-ts-kit:imports
19
+
20
+ /**
21
+ * What {{context.kebab}} keeps of a person in clear, handed over from every table declared below as
22
+ * plain data: one record per row about the person, under `{{context.kebab}}.<table>`, the personal columns
23
+ * alone. Run by `npm run privacy:export` with the exports of the other contexts, never by a use
24
+ * case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
25
+ */
26
+ {{#if style.declared}}
27
+ @Repository({{personal.names.exportPort}})
28
+ {{/if}}
29
+ {{personal.exportHeader}}
30
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
31
+ super(database, {
32
+ name: '{{context.kebab}}',
33
+ declarations: [
34
+ // ddd-ts-kit:personal-fields
35
+ {{aggregate.pascal}}PersonalFields,
36
+ // /ddd-ts-kit:personal-fields
37
+ ],
38
+ {{#if tenant.scoped}}
39
+ tenant: { scope },
40
+ {{/if}}
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,41 @@
1
+ {{#if tenant.scoped}}
2
+ import type { ExecutionScope } from '@ddd-ts-kit/kernel';
3
+ {{/if}}
4
+ {{#if style.declared}}
5
+ import { Repository } from '@ddd-ts-kit/kernel/declarations';
6
+ {{/if}}
7
+ import { TypeOrmPersonalDataExport, type TypeOrmContext } from '@ddd-ts-kit/typeorm';
8
+ {{#if style.declared}}
9
+ import { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
10
+ {{/if}}
11
+ {{#unless style.declared}}
12
+ import type { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
13
+ {{/unless}}
14
+ // ddd-ts-kit:imports
15
+ import { {{aggregate.pascal}}PersonalFields } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}.personal-fields{{alias.ext}}';
16
+ // /ddd-ts-kit:imports
17
+
18
+ /**
19
+ * What {{context.kebab}} keeps of a person in clear, handed over from every table declared below as
20
+ * plain data: one record per row about the person, under `{{context.kebab}}.<table>`, the personal columns
21
+ * alone. Run by `npm run privacy:export` with the exports of the other contexts, never by a use
22
+ * case{{#if tenant.scoped}}; every statement is confined to the tenant of the work{{/if}}.
23
+ */
24
+ {{#if style.declared}}
25
+ @Repository({{personal.names.exportPort}})
26
+ {{/if}}
27
+ {{personal.exportHeader}}
28
+ constructor(database: {{storage.token}}{{#if tenant.scoped}}, scope: ExecutionScope{{/if}}) {
29
+ super(database, {
30
+ name: '{{context.kebab}}',
31
+ declarations: [
32
+ // ddd-ts-kit:personal-fields
33
+ {{aggregate.pascal}}PersonalFields,
34
+ // /ddd-ts-kit:personal-fields
35
+ ],
36
+ {{#if tenant.scoped}}
37
+ tenant: { scope },
38
+ {{/if}}
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,4 @@
1
+ @@imports
2
+ import { {{personal.names.exportAdapter}} } from '{{alias.context}}/infrastructure/persistence/{{personal.names.exportAdapterKebab}}.repository{{alias.ext}}';
3
+ @@exports
4
+ (platform) => platform.adapter(new {{personal.names.exportAdapter}}(platform.persistence.database{{#if tenant.scoped}}, platform.scope{{/if}}), { kind: 'repository', context: '{{context.kebab}}', token: '{{personal.names.exportPort}}' }),
@@ -0,0 +1,4 @@
1
+ @@imports
2
+ import { {{personal.names.exportPort}} } from '{{alias.context}}/application/ports/{{personal.names.exportPortKebab}}.port{{alias.ext}}';
3
+ @@exports
4
+ {{personal.names.exportPort}},
@@ -0,0 +1,26 @@
1
+ import type { {{personal.names.port}} } from '{{alias.context}}/application/ports/{{personal.names.portKebab}}.port{{alias.ext}}';
2
+
3
+ /** Counts the rows each person has, as a test gave them, and forgets them at the first erasure. */
4
+ export class {{personal.names.fake}} implements {{personal.names.port}} {
5
+ readonly name = '{{context.kebab}}';
6
+
7
+ readonly erased: string[] = [];
8
+
9
+ private readonly rows = new Map<string, number>();
10
+
11
+ /** The rows the erasure of this person reaches, as the test arranges them. */
12
+ holds(subject: string, rows: number): this {
13
+ this.rows.set(subject, rows);
14
+
15
+ return this;
16
+ }
17
+
18
+ async erase(subject: string): Promise<number> {
19
+ const reached = this.rows.get(subject) ?? 0;
20
+
21
+ this.rows.delete(subject);
22
+ this.erased.push(subject);
23
+
24
+ return reached;
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ import { PersonalDataErasure } from '@ddd-ts-kit/kernel';
2
+
3
+ /**
4
+ * The right to erasure, for what {{context.kebab}} keeps of a person in clear: the columns its tables declare
5
+ * with `personalFields`, erased or pseudonymised as each declaration says. Run by the platform
6
+ * (`npm run privacy:erase`) with the copies of the other contexts, never by a use case.
7
+ */
8
+ export abstract class {{personal.names.port}} extends PersonalDataErasure {}
@@ -0,0 +1,280 @@
1
+ import { afterAll, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
2
+ {{#if orm.drizzle}}
3
+ import { eq } from 'drizzle-orm';
4
+ {{/if}}
5
+ {{#if orm.knex}}
6
+ import type { Knex } from 'knex';
7
+ {{/if}}
8
+ import {
9
+ {{#if personal.pseudonymise}}
10
+ ERASED_PERSONAL_DATA,
11
+ {{/if}}
12
+ FixedClock,
13
+ FixedExecutionScope,
14
+ executionContext,
15
+ type Actor,
16
+ type ExecutionContext,
17
+ } from '@ddd-ts-kit/kernel';
18
+ import { {{adapter.pascal}}{{aggregate.pascal}}Repository } from '{{alias.context}}/infrastructure/persistence/{{adapter.kebab}}-{{aggregate.kebab}}.repository{{alias.ext}}';
19
+ import { {{personal.names.adapter}} } from '{{alias.context}}/infrastructure/persistence/{{personal.names.adapterKebab}}.repository{{alias.ext}}';
20
+ import { {{personal.names.exportAdapter}} } from '{{alias.context}}/infrastructure/persistence/{{personal.names.exportAdapterKebab}}.repository{{alias.ext}}';
21
+ {{#if orm.knex}}
22
+ import { {{context.constant}}_SCHEMA } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
23
+ import type { {{aggregate.pascal}}Row } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}-row.schema{{alias.ext}}';
24
+ {{/if}}
25
+ {{#if orm.drizzle}}
26
+ import { {{aggregate.tableCamel}} } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
27
+ {{/if}}
28
+ {{#if orm.typeorm}}
29
+ import { {{aggregate.tableCamel}} } from '{{alias.context}}/infrastructure/persistence/{{context.kebab}}.schema{{alias.ext}}';
30
+ import type { {{aggregate.pascal}}Row } from '{{alias.context}}/infrastructure/persistence/{{aggregate.kebab}}-row.schema{{alias.ext}}';
31
+ {{/if}}
32
+ {{#if orm.prisma}}
33
+ import type { Prisma, {{context.pascal}}{{aggregate.pascal}} as {{aggregate.pascal}}Row } from '{{alias.generated}}/prisma/client{{alias.ext}}';
34
+ {{/if}}
35
+ import { openTestDatabase, type TestDatabase } from '{{alias.platform}}/database/open-test-database{{alias.ext}}';
36
+ import { {{aggregate.article}}{{aggregate.pascal}} } from '{{alias.context}}/test/builders/{{aggregate.kebab}}.builder{{alias.ext}}';
37
+ import { {{personal.names.fake}} } from '{{alias.context}}/test/fakes/{{personal.names.portKebab}}.fake{{alias.ext}}';
38
+ import { {{personal.names.exportFake}} } from '{{alias.context}}/test/fakes/{{personal.names.exportPortKebab}}.fake{{alias.ext}}';
39
+
40
+ {{#if orm.drizzle}}
41
+ type {{aggregate.pascal}}Row = typeof {{aggregate.tableCamel}}.$inferSelect;
42
+
43
+ /** What a test writes into the columns of a person: the generated mapper writes none of them yet. */
44
+ type Personal = Partial<typeof {{aggregate.tableCamel}}.$inferInsert>;
45
+ {{/if}}
46
+ {{#if orm.prisma}}
47
+ /** What a test writes into the columns of a person: the generated mapper writes none of them yet. */
48
+ type Personal = Prisma.{{context.pascal}}{{aggregate.pascal}}UpdateInput;
49
+ {{/if}}
50
+ {{#unless orm.drizzle}}
51
+ {{#unless orm.prisma}}
52
+ /** What a test writes into the columns of a person: the generated mapper writes none of them yet. */
53
+ type Personal = Partial<{{aggregate.pascal}}Row>;
54
+ {{/unless}}
55
+ {{/unless}}
56
+
57
+ const clock = new FixedClock(new Date('2026-01-01T00:00:00.000Z'));
58
+ {{#if personal.retains}}
59
+
60
+ /** Long before any retention ends. */
61
+ const LONG_AGO = new Date('2000-01-01T00:00:00.000Z');
62
+ {{/if}}
63
+
64
+ /** What `{{aggregate.table}}` keeps of two people in clear, as a use case would have written it. */
65
+ const OF_ADA: Personal = {{personal.ofAda}};
66
+
67
+ const OF_BOB: Personal = {{personal.ofBob}};
68
+ {{#if personal.pseudonymise}}
69
+
70
+ /** What the row of Ada reads once she is erased: the declaration says `pseudonymise`. */
71
+ const ERASED = {{personal.erased}};
72
+ {{/if}}
73
+
74
+ /** The source every record of `{{aggregate.table}}` names: the context, then the table. */
75
+ const SOURCE = '{{context.kebab}}.{{aggregate.table}}';
76
+
77
+ /** What the export hands over of Ada: the personal columns alone, as plain data. */
78
+ const EXPORTED_OF_ADA = {{personal.exportedOfAda}};
79
+ {{#if personal.pseudonymise}}
80
+
81
+ /** What the export hands over once Ada is erased: what the row reads. */
82
+ const EXPORTED_ERASED = {{personal.exportedErased}};
83
+ {{/if}}
84
+
85
+ let database: TestDatabase;
86
+ let scope: FixedExecutionScope;
87
+ let repository: {{adapter.pascal}}{{aggregate.pascal}}Repository;
88
+ let erasure: {{personal.names.adapter}};
89
+ let exported: {{personal.names.exportAdapter}};
90
+
91
+ beforeAll(async () => {
92
+ database = await openTestDatabase();
93
+ });
94
+
95
+ afterAll(async () => {
96
+ await database.close();
97
+ });
98
+
99
+ beforeEach(async () => {
100
+ await database.reset();
101
+ scope = new FixedExecutionScope(workOf('acme'));
102
+ repository = new {{adapter.pascal}}{{aggregate.pascal}}Repository(database.persistence.database, scope, clock);
103
+ erasure = new {{personal.names.adapter}}(database.persistence.database{{#if tenant.scoped}}, scope{{/if}});
104
+ exported = new {{personal.names.exportAdapter}}(database.persistence.database{{#if tenant.scoped}}, scope{{/if}});
105
+ });
106
+
107
+ describe('{{personal.names.adapter}}', () => {
108
+ it('erases what {{aggregate.table}} keeps of the subject, as the declaration says, and answers the rows it reached', async () => {
109
+ const ada = await saved(OF_ADA);
110
+ const bob = await saved(OF_BOB);
111
+
112
+ expect(await erasure.erase({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}})).toBe(1);
113
+ {{#if personal.pseudonymise}}
114
+ expect(await rowOf(ada)).toMatchObject(ERASED);
115
+ {{/if}}
116
+ {{#if personal.row}}
117
+ expect(await rowOf(ada)).toBeUndefined();
118
+ {{/if}}
119
+ expect(await rowOf(bob)).toMatchObject(OF_BOB);
120
+ });
121
+
122
+ it('reaches nothing the second time: an erasure run again completes one that failed half way', async () => {
123
+ {{#if personal.subjectIsId}}
124
+ const ada = await saved(OF_ADA);
125
+ {{/if}}
126
+ {{#unless personal.subjectIsId}}
127
+ await saved(OF_ADA);
128
+ {{/unless}}
129
+
130
+ await erasure.erase({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}});
131
+
132
+ expect(await erasure.erase({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}})).toBe(0);
133
+ });
134
+ });
135
+
136
+ {{#if personal.retains}}
137
+ describe('{{personal.names.adapter}}, the purge of what outlived its retention', () => {
138
+ it('erases the rows whose retention ended, as the declaration says, and leaves the others', async () => {
139
+ const ada = await saved({ ...OF_ADA, {{personal.retentionRow}}: LONG_AGO });
140
+ const bob = await saved(OF_BOB);
141
+
142
+ expect(await erasure.purgeExpired(clock.now())).toBe(1);
143
+ {{#if personal.pseudonymise}}
144
+ expect(await rowOf(ada)).toMatchObject(ERASED);
145
+ {{/if}}
146
+ {{#if personal.row}}
147
+ expect(await rowOf(ada)).toBeUndefined();
148
+ {{/if}}
149
+ expect(await rowOf(bob)).toMatchObject(OF_BOB);
150
+ expect(await erasure.purgeExpired(clock.now())).toBe(0);
151
+ });
152
+ });
153
+
154
+ {{/if}}
155
+ describe('{{personal.names.exportAdapter}}', () => {
156
+ it('hands over what {{aggregate.table}} keeps of the subject as plain data, under its source, and nothing of the others', async () => {
157
+ {{#if personal.subjectIsId}}
158
+ const ada = await saved(OF_ADA);
159
+
160
+ await saved(OF_BOB);
161
+ {{/if}}
162
+ {{#unless personal.subjectIsId}}
163
+ await saved(OF_ADA);
164
+ await saved(OF_BOB);
165
+ {{/unless}}
166
+
167
+ expect(await exported.exportOf({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}})).toEqual([{ source: SOURCE, values: EXPORTED_OF_ADA }]);
168
+ });
169
+
170
+ it('answers what the row reads once the subject is erased{{#if personal.row}}: nothing, the row is gone{{/if}}', async () => {
171
+ {{#if personal.subjectIsId}}
172
+ const ada = await saved(OF_ADA);
173
+ {{/if}}
174
+ {{#unless personal.subjectIsId}}
175
+ await saved(OF_ADA);
176
+ {{/unless}}
177
+
178
+ await erasure.erase({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}});
179
+
180
+ {{#if personal.pseudonymise}}
181
+ expect(await exported.exportOf({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}})).toEqual([{ source: SOURCE, values: EXPORTED_ERASED }]);
182
+ {{/if}}
183
+ {{#if personal.row}}
184
+ expect(await exported.exportOf({{#if personal.subjectIsId}}ada{{/if}}{{#unless personal.subjectIsId}}'ada'{{/unless}})).toEqual([]);
185
+ {{/if}}
186
+ });
187
+ });
188
+
189
+ describe('{{personal.names.fake}} and {{personal.names.exportFake}}', () => {
190
+ it('counts the rows it holds of a person, and forgets them at the first erasure', async () => {
191
+ const fake = new {{personal.names.fake}}().holds('ada', 2);
192
+
193
+ expect(await fake.erase('ada')).toBe(2);
194
+ expect(await fake.erase('ada')).toBe(0);
195
+ expect(fake.erased).toEqual(['ada', 'ada']);
196
+ });
197
+
198
+ it('hands over the records it holds of a person, and remembers who was asked', async () => {
199
+ const record = { source: SOURCE, values: EXPORTED_OF_ADA };
200
+ const fake = new {{personal.names.exportFake}}().holds('ada', record);
201
+
202
+ expect(await fake.exportOf('ada')).toEqual([record]);
203
+ expect(await fake.exportOf('bob')).toEqual([]);
204
+ expect(fake.asked).toEqual(['ada', 'bob']);
205
+ });
206
+ });
207
+
208
+ /** {{aggregate.article}} {{aggregate.pascal}} saved through its repository, then given what the table keeps of the person. Answers its id. */
209
+ async function saved(personal: Personal): Promise<string> {
210
+ const aggregate = {{aggregate.article}}{{aggregate.pascal}}().build();
211
+
212
+ await repository.save(aggregate);
213
+ await write(aggregate.id, personal);
214
+
215
+ return aggregate.id;
216
+ }
217
+
218
+ {{#if orm.knex}}
219
+ async function write(id: string, personal: Personal): Promise<void> {
220
+ await table().where({ id }).update(personal);
221
+ }
222
+
223
+ async function rowOf(id: string): Promise<{{aggregate.pascal}}Row | undefined> {
224
+ const row = await table().where({ id }).first();
225
+
226
+ return row;
227
+ }
228
+
229
+ /** A function and not a method: a query builder is thenable. */
230
+ function table(): Knex.QueryBuilder<{{aggregate.pascal}}Row, {{aggregate.pascal}}Row[]> {
231
+ const rows = database.persistence.database.executor()<{{aggregate.pascal}}Row, {{aggregate.pascal}}Row[]>('{{aggregate.table}}');
232
+
233
+ return rows.withSchema({{context.constant}}_SCHEMA);
234
+ }
235
+ {{/if}}
236
+ {{#if orm.drizzle}}
237
+ async function write(id: string, personal: Personal): Promise<void> {
238
+ const byId = eq({{aggregate.tableCamel}}.id, id);
239
+
240
+ await database.persistence.database.executor().update({{aggregate.tableCamel}}).set(personal).where(byId);
241
+ }
242
+
243
+ async function rowOf(id: string): Promise<{{aggregate.pascal}}Row | undefined> {
244
+ const byId = eq({{aggregate.tableCamel}}.id, id);
245
+ const [row] = await database.persistence.database.executor().select().from({{aggregate.tableCamel}}).where(byId);
246
+
247
+ return row;
248
+ }
249
+ {{/if}}
250
+ {{#if orm.prisma}}
251
+ async function write(id: string, personal: Personal): Promise<void> {
252
+ const rows = database.persistence.database.client().{{context.camel}}{{aggregate.pascal}};
253
+
254
+ await rows.update({ where: { id }, data: personal });
255
+ }
256
+
257
+ async function rowOf(id: string): Promise<{{aggregate.pascal}}Row | undefined> {
258
+ const rows = database.persistence.database.client().{{context.camel}}{{aggregate.pascal}};
259
+ const row = await rows.findUnique({ where: { id } });
260
+
261
+ return row ?? undefined;
262
+ }
263
+ {{/if}}
264
+ {{#if orm.typeorm}}
265
+ async function write(id: string, personal: Personal): Promise<void> {
266
+ await database.persistence.database.manager().update({{aggregate.tableCamel}}, { id }, personal);
267
+ }
268
+
269
+ async function rowOf(id: string): Promise<{{aggregate.pascal}}Row | undefined> {
270
+ const row = await database.persistence.database.manager().findOneBy({{aggregate.tableCamel}}, { id });
271
+
272
+ return row ?? undefined;
273
+ }
274
+ {{/if}}
275
+
276
+ function workOf(tenantId: string): ExecutionContext {
277
+ const actor: Actor = { id: 'member-of-' + tenantId, type: 'user', tenantId, roles: [], attributes: {} };
278
+
279
+ return executionContext({ correlationId: 'personal-data-spec', actor, origin: 'test' });
280
+ }