ddd-ts-kit 0.88.0 → 0.89.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.
- package/CHANGELOG.md +593 -0
- package/README.fr.md +67 -26
- package/README.md +62 -23
- package/dist/check/canonical/roles.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +4 -1
- package/dist/check/canonical/roles.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +12 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +9 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/catalogue/delegated-rules.js +1 -1
- package/dist/check/catalogue/delegated-rules.js.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.d.ts.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +24 -0
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/configuration/config-inspection.d.ts +2 -2
- package/dist/check/configuration/config-inspection.d.ts.map +1 -1
- package/dist/check/configuration/config-inspection.js +5 -4
- package/dist/check/configuration/config-inspection.js.map +1 -1
- package/dist/check/configuration/measure-settings.d.ts +10 -0
- package/dist/check/configuration/measure-settings.d.ts.map +1 -0
- package/dist/check/configuration/measure-settings.js +17 -0
- package/dist/check/configuration/measure-settings.js.map +1 -0
- package/dist/check/explain/privacy-docs.d.ts +3 -0
- package/dist/check/explain/privacy-docs.d.ts.map +1 -0
- package/dist/check/explain/privacy-docs.js +52 -0
- package/dist/check/explain/privacy-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
- package/dist/check/explain/tenancy-docs.js +13 -3
- package/dist/check/explain/tenancy-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +11 -0
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.js +1 -1
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/budget-fixtures.d.ts +3 -0
- package/dist/check/fixtures/budget-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/budget-fixtures.js +43 -0
- package/dist/check/fixtures/budget-fixtures.js.map +1 -0
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +17 -3
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +6 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/mutation-fixtures.d.ts +3 -0
- package/dist/check/fixtures/mutation-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/mutation-fixtures.js +81 -0
- package/dist/check/fixtures/mutation-fixtures.js.map +1 -0
- package/dist/check/fixtures/privacy-fixtures.d.ts +3 -0
- package/dist/check/fixtures/privacy-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/privacy-fixtures.js +198 -0
- package/dist/check/fixtures/privacy-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-bypass.d.ts +24 -0
- package/dist/check/fixtures/tenancy-bypass.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-bypass.js +22 -0
- package/dist/check/fixtures/tenancy-bypass.js.map +1 -0
- package/dist/check/fixtures/tenancy-config.d.ts +3 -0
- package/dist/check/fixtures/tenancy-config.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-config.js +7 -0
- package/dist/check/fixtures/tenancy-config.js.map +1 -0
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +31 -41
- package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
- package/dist/check/fixtures/tenancy-prisma-fixtures.d.ts +4 -0
- package/dist/check/fixtures/tenancy-prisma-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-prisma-fixtures.js +73 -0
- package/dist/check/fixtures/tenancy-prisma-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-typeorm-fixtures.d.ts +4 -0
- package/dist/check/fixtures/tenancy-typeorm-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-typeorm-fixtures.js +88 -0
- package/dist/check/fixtures/tenancy-typeorm-fixtures.js.map +1 -0
- package/dist/check/mutation/stryker-settings.d.ts +8 -0
- package/dist/check/mutation/stryker-settings.d.ts.map +1 -0
- package/dist/check/mutation/stryker-settings.js +74 -0
- package/dist/check/mutation/stryker-settings.js.map +1 -0
- package/dist/check/privacy/column-definitions-in.d.ts +15 -0
- package/dist/check/privacy/column-definitions-in.d.ts.map +1 -0
- package/dist/check/privacy/column-definitions-in.js +32 -0
- package/dist/check/privacy/column-definitions-in.js.map +1 -0
- package/dist/check/privacy/declares-name.d.ts +4 -0
- package/dist/check/privacy/declares-name.d.ts.map +1 -0
- package/dist/check/privacy/declares-name.js +7 -0
- package/dist/check/privacy/declares-name.js.map +1 -0
- package/dist/check/privacy/personal-declarations-of.d.ts +15 -0
- package/dist/check/privacy/personal-declarations-of.d.ts.map +1 -0
- package/dist/check/privacy/personal-declarations-of.js +33 -0
- package/dist/check/privacy/personal-declarations-of.js.map +1 -0
- package/dist/check/privacy/personal-term-of.d.ts +3 -0
- package/dist/check/privacy/personal-term-of.d.ts.map +1 -0
- package/dist/check/privacy/personal-term-of.js +10 -0
- package/dist/check/privacy/personal-term-of.js.map +1 -0
- package/dist/check/privacy/personal-vocabulary.d.ts +9 -0
- package/dist/check/privacy/personal-vocabulary.d.ts.map +1 -0
- package/dist/check/privacy/personal-vocabulary.js +37 -0
- package/dist/check/privacy/personal-vocabulary.js.map +1 -0
- package/dist/check/privacy/prisma-columns-of.d.ts +17 -0
- package/dist/check/privacy/prisma-columns-of.d.ts.map +1 -0
- package/dist/check/privacy/prisma-columns-of.js +58 -0
- package/dist/check/privacy/prisma-columns-of.js.map +1 -0
- package/dist/check/privacy/privacy-judged.d.ts +8 -0
- package/dist/check/privacy/privacy-judged.d.ts.map +1 -0
- package/dist/check/privacy/privacy-judged.js +9 -0
- package/dist/check/privacy/privacy-judged.js.map +1 -0
- package/dist/check/privacy/published-events-of.d.ts +29 -0
- package/dist/check/privacy/published-events-of.d.ts.map +1 -0
- package/dist/check/privacy/published-events-of.js +80 -0
- package/dist/check/privacy/published-events-of.js.map +1 -0
- package/dist/check/privacy/same-name.d.ts +3 -0
- package/dist/check/privacy/same-name.d.ts.map +1 -0
- package/dist/check/privacy/same-name.js +6 -0
- package/dist/check/privacy/same-name.js.map +1 -0
- package/dist/check/privacy/vocabulary-of.d.ts +4 -0
- package/dist/check/privacy/vocabulary-of.d.ts.map +1 -0
- package/dist/check/privacy/vocabulary-of.js +10 -0
- package/dist/check/privacy/vocabulary-of.js.map +1 -0
- package/dist/check/privacy/words-of-name.d.ts +3 -0
- package/dist/check/privacy/words-of-name.d.ts.map +1 -0
- package/dist/check/privacy/words-of-name.js +9 -0
- package/dist/check/privacy/words-of-name.js.map +1 -0
- package/dist/check/rules/config-valid.js +1 -1
- package/dist/check/rules/config-valid.js.map +1 -1
- package/dist/check/rules/declarations-port-adapter-wired.d.ts.map +1 -1
- package/dist/check/rules/declarations-port-adapter-wired.js +21 -2
- package/dist/check/rules/declarations-port-adapter-wired.js.map +1 -1
- package/dist/check/rules/governance-recorded-deviation.d.ts.map +1 -1
- package/dist/check/rules/governance-recorded-deviation.js +20 -2
- package/dist/check/rules/governance-recorded-deviation.js.map +1 -1
- package/dist/check/rules/privacy-declared-field.d.ts +11 -0
- package/dist/check/rules/privacy-declared-field.d.ts.map +1 -0
- package/dist/check/rules/privacy-declared-field.js +63 -0
- package/dist/check/rules/privacy-declared-field.js.map +1 -0
- package/dist/check/rules/privacy-erasure-reaches-copies.d.ts +10 -0
- package/dist/check/rules/privacy-erasure-reaches-copies.d.ts.map +1 -0
- package/dist/check/rules/privacy-erasure-reaches-copies.js +46 -0
- package/dist/check/rules/privacy-erasure-reaches-copies.js.map +1 -0
- package/dist/check/rules/privacy-event-payload-declared.d.ts +10 -0
- package/dist/check/rules/privacy-event-payload-declared.d.ts.map +1 -0
- package/dist/check/rules/privacy-event-payload-declared.js +39 -0
- package/dist/check/rules/privacy-event-payload-declared.js.map +1 -0
- package/dist/check/rules/privacy-no-personal-data-in-logs.d.ts +12 -0
- package/dist/check/rules/privacy-no-personal-data-in-logs.d.ts.map +1 -0
- package/dist/check/rules/privacy-no-personal-data-in-logs.js +57 -0
- package/dist/check/rules/privacy-no-personal-data-in-logs.js.map +1 -0
- package/dist/check/rules/privacy-subject-is-opaque.d.ts +9 -0
- package/dist/check/rules/privacy-subject-is-opaque.d.ts.map +1 -0
- package/dist/check/rules/privacy-subject-is-opaque.js +50 -0
- package/dist/check/rules/privacy-subject-is-opaque.js.map +1 -0
- package/dist/check/rules/tenancy-scoped-statement.d.ts.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.js +6 -2
- package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
- package/dist/check/rules/test-mutation-governed.d.ts +3 -0
- package/dist/check/rules/test-mutation-governed.d.ts.map +1 -0
- package/dist/check/rules/test-mutation-governed.js +12 -0
- package/dist/check/rules/test-mutation-governed.js.map +1 -0
- package/dist/check/tenancy/accessor-uses.d.ts +13 -0
- package/dist/check/tenancy/accessor-uses.d.ts.map +1 -0
- package/dist/check/tenancy/accessor-uses.js +19 -0
- package/dist/check/tenancy/accessor-uses.js.map +1 -0
- package/dist/check/tenancy/declaration-of.d.ts +7 -0
- package/dist/check/tenancy/declaration-of.d.ts.map +1 -0
- package/dist/check/tenancy/declaration-of.js +11 -0
- package/dist/check/tenancy/declaration-of.js.map +1 -0
- package/dist/check/tenancy/declared-in-arguments.d.ts +13 -0
- package/dist/check/tenancy/declared-in-arguments.d.ts.map +1 -0
- package/dist/check/tenancy/declared-in-arguments.js +25 -0
- package/dist/check/tenancy/declared-in-arguments.js.map +1 -0
- package/dist/check/tenancy/declared-with.d.ts +3 -1
- package/dist/check/tenancy/declared-with.d.ts.map +1 -1
- package/dist/check/tenancy/declared-with.js +4 -3
- package/dist/check/tenancy/declared-with.js.map +1 -1
- package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/drizzle-unscoped.js +4 -3
- package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
- package/dist/check/tenancy/executor-uses.d.ts +3 -10
- package/dist/check/tenancy/executor-uses.d.ts.map +1 -1
- package/dist/check/tenancy/executor-uses.js +3 -11
- package/dist/check/tenancy/executor-uses.js.map +1 -1
- package/dist/check/tenancy/prisma-unscoped.d.ts +7 -0
- package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -0
- package/dist/check/tenancy/prisma-unscoped.js +60 -0
- package/dist/check/tenancy/prisma-unscoped.js.map +1 -0
- package/dist/check/tenancy/typeorm-unscoped.d.ts +7 -0
- package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -0
- package/dist/check/tenancy/typeorm-unscoped.js +103 -0
- package/dist/check/tenancy/typeorm-unscoped.js.map +1 -0
- package/dist/check/tenancy/unscoped-read-models.js +2 -2
- package/dist/check/tenancy/unscoped-read-models.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +23 -1
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/generate.js +9 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lint.d.ts +3 -2
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +16 -4
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/mutation.d.ts +14 -0
- package/dist/commands/mutation.d.ts.map +1 -0
- package/dist/commands/mutation.js +62 -0
- package/dist/commands/mutation.js.map +1 -0
- package/dist/config/budget-levels.d.ts +3 -0
- package/dist/config/budget-levels.d.ts.map +1 -0
- package/dist/config/budget-levels.js +3 -0
- package/dist/config/budget-levels.js.map +1 -0
- package/dist/config/budget-problems.d.ts +10 -0
- package/dist/config/budget-problems.d.ts.map +1 -0
- package/dist/config/budget-problems.js +61 -0
- package/dist/config/budget-problems.js.map +1 -0
- package/dist/config/budget.d.ts +10 -0
- package/dist/config/budget.d.ts.map +1 -0
- package/dist/config/budget.js +2 -0
- package/dist/config/budget.js.map +1 -0
- package/dist/config/config.d.ts +16 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/index.d.ts +7 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +7 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/is-duration.d.ts +3 -0
- package/dist/config/is-duration.d.ts.map +1 -0
- package/dist/config/is-duration.js +5 -0
- package/dist/config/is-duration.js.map +1 -0
- package/dist/config/is-reference-budget.d.ts +4 -0
- package/dist/config/is-reference-budget.d.ts.map +1 -0
- package/dist/config/is-reference-budget.js +8 -0
- package/dist/config/is-reference-budget.js.map +1 -0
- package/dist/config/is-reference-mutation.d.ts +4 -0
- package/dist/config/is-reference-mutation.d.ts.map +1 -0
- package/dist/config/is-reference-mutation.js +7 -0
- package/dist/config/is-reference-mutation.js.map +1 -0
- package/dist/config/mutation-layers.d.ts +3 -0
- package/dist/config/mutation-layers.d.ts.map +1 -0
- package/dist/config/mutation-layers.js +3 -0
- package/dist/config/mutation-layers.js.map +1 -0
- package/dist/config/mutation-problems.d.ts +10 -0
- package/dist/config/mutation-problems.d.ts.map +1 -0
- package/dist/config/mutation-problems.js +46 -0
- package/dist/config/mutation-problems.js.map +1 -0
- package/dist/config/mutation.d.ts +4 -0
- package/dist/config/mutation.d.ts.map +1 -0
- package/dist/config/mutation.js +2 -0
- package/dist/config/mutation.js.map +1 -0
- package/dist/config/parse-budget.d.ts +4 -0
- package/dist/config/parse-budget.d.ts.map +1 -0
- package/dist/config/parse-budget.js +17 -0
- package/dist/config/parse-budget.js.map +1 -0
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +6 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-mutation.d.ts +4 -0
- package/dist/config/parse-mutation.d.ts.map +1 -0
- package/dist/config/parse-mutation.js +16 -0
- package/dist/config/parse-mutation.js.map +1 -0
- package/dist/config/parse-privacy.d.ts +4 -0
- package/dist/config/parse-privacy.d.ts.map +1 -0
- package/dist/config/parse-privacy.js +12 -0
- package/dist/config/parse-privacy.js.map +1 -0
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +4 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/reference-budget.d.ts +8 -0
- package/dist/config/reference-budget.d.ts.map +1 -0
- package/dist/config/reference-budget.js +7 -0
- package/dist/config/reference-budget.js.map +1 -0
- package/dist/config/reference-mutation.d.ts +10 -0
- package/dist/config/reference-mutation.d.ts.map +1 -0
- package/dist/config/reference-mutation.js +9 -0
- package/dist/config/reference-mutation.js.map +1 -0
- package/dist/config/serialize-config.d.ts.map +1 -1
- package/dist/config/serialize-config.js +13 -1
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/config/stack.d.ts +17 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +2 -0
- package/dist/config/stack.js.map +1 -1
- package/dist/docs/behaviour-page.d.ts +8 -0
- package/dist/docs/behaviour-page.d.ts.map +1 -0
- package/dist/docs/behaviour-page.js +83 -0
- package/dist/docs/behaviour-page.js.map +1 -0
- package/dist/docs/context-facts.d.ts +8 -0
- package/dist/docs/context-facts.d.ts.map +1 -1
- package/dist/docs/counts-of.d.ts +10 -0
- package/dist/docs/counts-of.d.ts.map +1 -0
- package/dist/docs/counts-of.js +14 -0
- package/dist/docs/counts-of.js.map +1 -0
- package/dist/docs/declared-table-of.d.ts +14 -0
- package/dist/docs/declared-table-of.d.ts.map +1 -0
- package/dist/docs/declared-table-of.js +39 -0
- package/dist/docs/declared-table-of.js.map +1 -0
- package/dist/docs/ensure-personal-data-region.d.ts +7 -0
- package/dist/docs/ensure-personal-data-region.d.ts.map +1 -0
- package/dist/docs/ensure-personal-data-region.js +21 -0
- package/dist/docs/ensure-personal-data-region.js.map +1 -0
- package/dist/docs/page-section.d.ts +12 -0
- package/dist/docs/page-section.d.ts.map +1 -0
- package/dist/docs/page-section.js +2 -0
- package/dist/docs/page-section.js.map +1 -0
- package/dist/docs/personal-data-lines.d.ts +7 -0
- package/dist/docs/personal-data-lines.d.ts.map +1 -0
- package/dist/docs/personal-data-lines.js +29 -0
- package/dist/docs/personal-data-lines.js.map +1 -0
- package/dist/docs/personal-declarations-in.d.ts +13 -0
- package/dist/docs/personal-declarations-in.d.ts.map +1 -0
- package/dist/docs/personal-declarations-in.js +66 -0
- package/dist/docs/personal-declarations-in.js.map +1 -0
- package/dist/docs/personal-table-cells.d.ts +12 -0
- package/dist/docs/personal-table-cells.d.ts.map +1 -0
- package/dist/docs/personal-table-cells.js +13 -0
- package/dist/docs/personal-table-cells.js.map +1 -0
- package/dist/docs/personal-table-facts.d.ts +17 -0
- package/dist/docs/personal-table-facts.d.ts.map +1 -0
- package/dist/docs/personal-table-facts.js +2 -0
- package/dist/docs/personal-table-facts.js.map +1 -0
- package/dist/docs/privacy-register-lines.d.ts +7 -0
- package/dist/docs/privacy-register-lines.d.ts.map +1 -0
- package/dist/docs/privacy-register-lines.js +34 -0
- package/dist/docs/privacy-register-lines.js.map +1 -0
- package/dist/docs/read-context.d.ts.map +1 -1
- package/dist/docs/read-context.js +17 -1
- package/dist/docs/read-context.js.map +1 -1
- package/dist/docs/read-personal-data.d.ts +12 -0
- package/dist/docs/read-personal-data.d.ts.map +1 -0
- package/dist/docs/read-personal-data.js +22 -0
- package/dist/docs/read-personal-data.js.map +1 -0
- package/dist/docs/refresh-context-doc.d.ts.map +1 -1
- package/dist/docs/refresh-context-doc.js +9 -1
- package/dist/docs/refresh-context-doc.js.map +1 -1
- package/dist/docs/rules-in.d.ts +25 -0
- package/dist/docs/rules-in.d.ts.map +1 -0
- package/dist/docs/rules-in.js +83 -0
- package/dist/docs/rules-in.js.map +1 -0
- package/dist/docs/write-behaviour.d.ts +10 -0
- package/dist/docs/write-behaviour.d.ts.map +1 -0
- package/dist/docs/write-behaviour.js +97 -0
- package/dist/docs/write-behaviour.js.map +1 -0
- package/dist/docs/write-docs.d.ts +12 -2
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +8 -2
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/docs/write-privacy-register.d.ts +9 -0
- package/dist/docs/write-privacy-register.d.ts.map +1 -0
- package/dist/docs/write-privacy-register.js +26 -0
- package/dist/docs/write-privacy-register.js.map +1 -0
- package/dist/generate/kind.d.ts +14 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/acceptance-kind.js +5 -1
- package/dist/generate/kinds/acceptance-kind.js.map +1 -1
- package/dist/generate/kinds/background/spec-family.d.ts +8 -0
- package/dist/generate/kinds/background/spec-family.d.ts.map +1 -0
- package/dist/generate/kinds/background/spec-family.js +9 -0
- package/dist/generate/kinds/background/spec-family.js.map +1 -0
- package/dist/generate/kinds/background-job-kind.d.ts.map +1 -1
- package/dist/generate/kinds/background-job-kind.js +6 -4
- package/dist/generate/kinds/background-job-kind.js.map +1 -1
- package/dist/generate/kinds/command-kind.d.ts.map +1 -1
- package/dist/generate/kinds/command-kind.js +4 -0
- package/dist/generate/kinds/command-kind.js.map +1 -1
- package/dist/generate/kinds/erasure-handler-kind.d.ts +3 -0
- package/dist/generate/kinds/erasure-handler-kind.d.ts.map +1 -0
- package/dist/generate/kinds/erasure-handler-kind.js +46 -0
- package/dist/generate/kinds/erasure-handler-kind.js.map +1 -0
- package/dist/generate/kinds/generate-repository.d.ts +2 -1
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +14 -11
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/personal-data/class-header.d.ts +3 -0
- package/dist/generate/kinds/personal-data/class-header.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/class-header.js +7 -0
- package/dist/generate/kinds/personal-data/class-header.js.map +1 -0
- package/dist/generate/kinds/personal-data/column-lines.d.ts +4 -0
- package/dist/generate/kinds/personal-data/column-lines.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/column-lines.js +5 -0
- package/dist/generate/kinds/personal-data/column-lines.js.map +1 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.d.ts +12 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.js +73 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -0
- package/dist/generate/kinds/personal-data/fields-line.d.ts +3 -0
- package/dist/generate/kinds/personal-data/fields-line.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/fields-line.js +7 -0
- package/dist/generate/kinds/personal-data/fields-line.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-column.d.ts +7 -0
- package/dist/generate/kinds/personal-data/personal-column.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-column.js +5 -0
- package/dist/generate/kinds/personal-data/personal-column.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-names.d.ts +21 -0
- package/dist/generate/kinds/personal-data/personal-names.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-names.js +41 -0
- package/dist/generate/kinds/personal-data/personal-names.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of.d.ts +18 -0
- package/dist/generate/kinds/personal-data/personal-request-of.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of.js +109 -0
- package/dist/generate/kinds/personal-data/personal-request-of.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts +9 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-vars.js +107 -0
- package/dist/generate/kinds/personal-data/personal-vars.js.map +1 -0
- package/dist/generate/kinds/personal-data/property-of.d.ts +3 -0
- package/dist/generate/kinds/personal-data/property-of.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/property-of.js +5 -0
- package/dist/generate/kinds/personal-data/property-of.js.map +1 -0
- package/dist/generate/kinds/personal-data/row-object.d.ts +3 -0
- package/dist/generate/kinds/personal-data/row-object.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/row-object.js +5 -0
- package/dist/generate/kinds/personal-data/row-object.js.map +1 -0
- package/dist/generate/kinds/process-kind.d.ts.map +1 -1
- package/dist/generate/kinds/process-kind.js +5 -3
- package/dist/generate/kinds/process-kind.js.map +1 -1
- package/dist/generate/kinds/repository-kind.d.ts.map +1 -1
- package/dist/generate/kinds/repository-kind.js +6 -3
- package/dist/generate/kinds/repository-kind.js.map +1 -1
- package/dist/generate/kinds/repository-prefix.d.ts +5 -0
- package/dist/generate/kinds/repository-prefix.d.ts.map +1 -0
- package/dist/generate/kinds/repository-prefix.js +11 -0
- package/dist/generate/kinds/repository-prefix.js.map +1 -0
- package/dist/generate/kinds/state-machine/state-machine-vars.js +3 -1
- package/dist/generate/kinds/state-machine/state-machine-vars.js.map +1 -1
- package/dist/generate/kinds/wire-repository-on-first-use.d.ts +10 -0
- package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -0
- package/dist/generate/kinds/wire-repository-on-first-use.js +14 -0
- package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts +2 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.js +13 -2
- package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +2 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts +2 -1
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +2 -2
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +16 -0
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +4 -3
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/event-sourcing-files.d.ts +9 -0
- package/dist/init/files/event-sourcing-files.d.ts.map +1 -0
- package/dist/init/files/event-sourcing-files.js +18 -0
- package/dist/init/files/event-sourcing-files.js.map +1 -0
- package/dist/init/files/init-files.d.ts.map +1 -1
- package/dist/init/files/init-files.js +4 -0
- package/dist/init/files/init-files.js.map +1 -1
- package/dist/init/files/platform-files.js +6 -1
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/files/privacy-files.d.ts +10 -0
- package/dist/init/files/privacy-files.d.ts.map +1 -0
- package/dist/init/files/privacy-files.js +24 -0
- package/dist/init/files/privacy-files.js.map +1 -0
- package/dist/init/files/project-files.d.ts.map +1 -1
- package/dist/init/files/project-files.js +5 -0
- package/dist/init/files/project-files.js.map +1 -1
- package/dist/init/files/script-files.d.ts +1 -0
- package/dist/init/files/script-files.d.ts.map +1 -1
- package/dist/init/files/script-files.js +8 -0
- package/dist/init/files/script-files.js.map +1 -1
- package/dist/init/knip-vars.d.ts.map +1 -1
- package/dist/init/knip-vars.js +1 -0
- package/dist/init/knip-vars.js.map +1 -1
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +9 -3
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +6 -2
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/scripts-for.js +17 -0
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/test-scripts.d.ts.map +1 -1
- package/dist/init/manifest/test-scripts.js +3 -0
- package/dist/init/manifest/test-scripts.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +27 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/rewire-personal-data.d.ts +10 -0
- package/dist/init/rewire-personal-data.d.ts.map +1 -0
- package/dist/init/rewire-personal-data.js +32 -0
- package/dist/init/rewire-personal-data.js.map +1 -0
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +3 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-personal-data.d.ts +10 -0
- package/dist/init/stack/resolve-personal-data.d.ts.map +1 -0
- package/dist/init/stack/resolve-personal-data.js +22 -0
- package/dist/init/stack/resolve-personal-data.js.map +1 -0
- package/dist/init/stack/resolve-queue.d.ts +4 -3
- package/dist/init/stack/resolve-queue.d.ts.map +1 -1
- package/dist/init/stack/resolve-queue.js +4 -6
- package/dist/init/stack/resolve-queue.js.map +1 -1
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +2 -0
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/resolve-tenancy.d.ts +3 -3
- package/dist/init/stack/resolve-tenancy.js +5 -5
- package/dist/init/stack/resolve-tenancy.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +4 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/init/write-contracts.d.ts +2 -1
- package/dist/init/write-contracts.d.ts.map +1 -1
- package/dist/init/write-contracts.js +6 -3
- package/dist/init/write-contracts.js.map +1 -1
- package/dist/lint/eslint-in-project.d.ts +3 -2
- package/dist/lint/eslint-in-project.d.ts.map +1 -1
- package/dist/lint/eslint-in-project.js +5 -3
- package/dist/lint/eslint-in-project.js.map +1 -1
- package/dist/lint/lint-cache-of.d.ts +7 -0
- package/dist/lint/lint-cache-of.d.ts.map +1 -0
- package/dist/lint/lint-cache-of.js +47 -0
- package/dist/lint/lint-cache-of.js.map +1 -0
- package/dist/lint/lint-run.d.ts +2 -0
- package/dist/lint/lint-run.d.ts.map +1 -1
- package/dist/mutation/changed-files.d.ts +7 -0
- package/dist/mutation/changed-files.d.ts.map +1 -0
- package/dist/mutation/changed-files.js +15 -0
- package/dist/mutation/changed-files.js.map +1 -0
- package/dist/mutation/format-mutation.d.ts +4 -0
- package/dist/mutation/format-mutation.d.ts.map +1 -0
- package/dist/mutation/format-mutation.js +29 -0
- package/dist/mutation/format-mutation.js.map +1 -0
- package/dist/mutation/format-survivors.d.ts +8 -0
- package/dist/mutation/format-survivors.d.ts.map +1 -0
- package/dist/mutation/format-survivors.js +19 -0
- package/dist/mutation/format-survivors.js.map +1 -0
- package/dist/mutation/mutation-report-file.d.ts +3 -0
- package/dist/mutation/mutation-report-file.d.ts.map +1 -0
- package/dist/mutation/mutation-report-file.js +3 -0
- package/dist/mutation/mutation-report-file.js.map +1 -0
- package/dist/mutation/mutation-scores.d.ts +35 -0
- package/dist/mutation/mutation-scores.d.ts.map +1 -0
- package/dist/mutation/mutation-scores.js +55 -0
- package/dist/mutation/mutation-scores.js.map +1 -0
- package/dist/mutation/read-mutation-report.d.ts +16 -0
- package/dist/mutation/read-mutation-report.d.ts.map +1 -0
- package/dist/mutation/read-mutation-report.js +38 -0
- package/dist/mutation/read-mutation-report.js.map +1 -0
- package/dist/mutation/survivors.d.ts +19 -0
- package/dist/mutation/survivors.d.ts.map +1 -0
- package/dist/mutation/survivors.js +24 -0
- package/dist/mutation/survivors.js.map +1 -0
- package/dist/platform-layout/platform-layout.d.ts +2 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -1
- package/dist/platform-layout/platform-layout.js +2 -0
- package/dist/platform-layout/platform-layout.js.map +1 -1
- package/dist/presets/apply-preset.js +2 -1
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/identity-preset.d.ts.map +1 -1
- package/dist/presets/identity-preset.js +17 -1
- package/dist/presets/identity-preset.js.map +1 -1
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +1 -0
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/presets/preset-step.d.ts +3 -1
- package/dist/presets/preset-step.d.ts.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/stack/audit-vars.d.ts +1 -1
- package/dist/stack/audit-vars.d.ts.map +1 -1
- package/dist/stack/audit-vars.js +26 -8
- package/dist/stack/audit-vars.js.map +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +44 -2
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -2
- package/templates/background-job/background-job.spec.buses.ts.tpl +57 -0
- package/templates/background-job/wiring.manual.tpl +4 -0
- package/templates/context/CONTEXT.md.tpl +5 -0
- package/templates/controller/guard.spec.ts.tpl +2 -2
- package/templates/docs/asyncapi.privacy.json.tpl +100 -0
- package/templates/docs/event-catalog.privacy.md +18 -0
- package/templates/docs/privacy-register.md.tpl +25 -0
- package/templates/erasure-handler/erasure-handler.declared.ts.tpl +22 -0
- package/templates/erasure-handler/erasure-handler.spec.ts.tpl +36 -0
- package/templates/erasure-handler/erasure-handler.ts.tpl +20 -0
- package/templates/erasure-handler/wiring.manual.tpl +23 -0
- package/templates/erasure-handler/wiring.tsyringe.tpl +6 -0
- package/templates/init/README.md.tpl +43 -3
- package/templates/init/gitignore.tpl +3 -0
- package/templates/init/jest.config.js.tpl +2 -0
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +19 -1
- package/templates/init/platform/audit/create-audit.ts.tpl +28 -6
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +64 -6
- package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +12 -0
- package/templates/init/platform/composition/create-platform.manual.ts.tpl +7 -3
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +14 -2
- package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +17 -1
- package/templates/init/platform/composition/platform-options.manual.ts.tpl +4 -1
- package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +36 -0
- package/templates/init/platform/composition/platform.manual.ts.tpl +16 -0
- package/templates/init/platform/database/open-persistence.memory.ts.tpl +20 -0
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +13 -2
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +21 -1
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +17 -1
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +20 -1
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +21 -0
- package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +14 -1
- package/templates/init/platform/database/persistence.memory.ts.tpl +9 -0
- package/templates/init/platform/database/persistence.orm.ts.tpl +9 -1
- package/templates/init/platform/database/schema.drizzle.ts.tpl +18 -3
- package/templates/init/platform/database/schema.knex.ts.tpl +8 -1
- package/templates/init/platform/database/schema.prisma.tpl +131 -1
- package/templates/init/platform/database/schema.typeorm.ts.tpl +32 -1
- package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +36 -0
- package/templates/init/platform/event-sourcing/event-sourcing.module.ts.tpl +22 -0
- package/templates/init/platform/jobs/background-jobs.ts.tpl +21 -0
- package/templates/init/platform/jobs/create-background-work.ts.tpl +147 -0
- package/templates/init/platform/jobs/job-settings.ts.tpl +11 -0
- package/templates/init/platform/privacy/data-subject-copies.manual.ts.tpl +14 -0
- package/templates/init/platform/privacy/data-subject-copies.tsyringe.ts.tpl +13 -0
- package/templates/init/platform/privacy/data-subject-exports.manual.ts.tpl +14 -0
- package/templates/init/platform/privacy/data-subject-exports.tsyringe.ts.tpl +13 -0
- package/templates/init/platform/privacy/privacy.module.tsyringe.ts.tpl +20 -0
- package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +100 -0
- package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +104 -0
- package/templates/init/platform/privacy/run-export.manual.ts.tpl +64 -0
- package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +71 -0
- package/templates/init/platform/privacy/run-purge.manual.ts.tpl +39 -0
- package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +45 -0
- package/templates/init/rules/infrastructure.md.tpl +1 -1
- package/templates/init/rules/tests.md.tpl +1 -1
- package/templates/init/scripts/events.ts.tpl +12 -0
- package/templates/init/scripts/privacy-erase.manual.ts.tpl +78 -0
- package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +78 -0
- package/templates/init/scripts/privacy-export.manual.ts.tpl +79 -0
- package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +79 -0
- package/templates/init/scripts/privacy-purge.manual.ts.tpl +48 -0
- package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +48 -0
- package/templates/personal-data/adapter-field.tpl +4 -0
- package/templates/personal-data/copies.manual.tpl +4 -0
- package/templates/personal-data/copies.tsyringe.tpl +4 -0
- package/templates/personal-data/declaration.drizzle.ts.tpl +22 -0
- package/templates/personal-data/declaration.knex.ts.tpl +24 -0
- package/templates/personal-data/declaration.prisma.ts.tpl +24 -0
- package/templates/personal-data/declaration.typeorm.ts.tpl +21 -0
- package/templates/personal-data/erasure.drizzle.ts.tpl +43 -0
- package/templates/personal-data/erasure.knex.ts.tpl +41 -0
- package/templates/personal-data/erasure.prisma.ts.tpl +43 -0
- package/templates/personal-data/erasure.typeorm.ts.tpl +41 -0
- package/templates/personal-data/export-fake.ts.tpl +24 -0
- package/templates/personal-data/export-port.ts.tpl +8 -0
- package/templates/personal-data/export.drizzle.ts.tpl +43 -0
- package/templates/personal-data/export.knex.ts.tpl +41 -0
- package/templates/personal-data/export.prisma.ts.tpl +43 -0
- package/templates/personal-data/export.typeorm.ts.tpl +41 -0
- package/templates/personal-data/exports.manual.tpl +4 -0
- package/templates/personal-data/exports.tsyringe.tpl +4 -0
- package/templates/personal-data/fake.ts.tpl +26 -0
- package/templates/personal-data/port.ts.tpl +8 -0
- package/templates/personal-data/spec.ts.tpl +280 -0
- package/templates/personal-data/wiring.tsyringe.tpl +12 -0
- package/templates/pipeline/github/workflows/ci.yml.tpl +62 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +64 -2
- package/templates/pipeline/jest.mutation.config.js.tpl +8 -0
- package/templates/pipeline/knip.json.tpl +1 -1
- package/templates/pipeline/lefthook.yml +6 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/stryker.config.mjs.tpl +25 -0
- package/templates/pipeline/vitest.config.ts.tpl +2 -0
- package/templates/pipeline/vitest.mutation.config.ts.tpl +29 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.drizzle.ts.tpl +17 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.knex.ts.tpl +19 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.drizzle.ts.tpl +18 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.knex.ts.tpl +20 -0
- package/templates/presets/identity/context/test/unit/account-deactivated.integration-handler.spec.ts.tpl +4 -2
- package/templates/presets/identity/context/test/unit/deactivate-account.handler.spec.ts.tpl +7 -5
- package/templates/presets/identity/context/test/unit/environment-identity-provider-connection.adapter.spec.ts.tpl +7 -3
- package/templates/presets/identity/context/test/unit/invite-member.handler.spec.ts.tpl +7 -7
- package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl +4 -2
- package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl +5 -3
- package/templates/presets/identity/context/test/unit/organisation-opened.integration-handler.spec.ts.tpl +4 -2
- package/templates/presets/identity/context/test/unit/revoke-invitation.handler.spec.ts.tpl +7 -5
- package/templates/process/process.spec.ts.tpl +6 -3
- package/templates/process/timeout-job.spec.buses.ts.tpl +42 -0
- package/templates/process/timeout-job.wiring.manual.tpl +4 -0
- package/templates/repository/drizzle/mapper.ts.tpl +10 -0
- package/templates/repository/drizzle/table.tpl +6 -0
- package/templates/repository/knex/mapper.ts.tpl +10 -0
- package/templates/repository/knex/row.ts.tpl +3 -0
- package/templates/repository/knex/table.tpl +3 -0
- package/templates/repository/prisma/mapper.ts.tpl +16 -1
- package/templates/repository/prisma/model.tpl +9 -0
- package/templates/repository/prisma/repository.ts.tpl +55 -0
- package/templates/repository/typeorm/mapper.ts.tpl +10 -0
- package/templates/repository/typeorm/repository.ts.tpl +48 -0
- package/templates/repository/typeorm/row.ts.tpl +9 -1
- package/templates/repository/typeorm/table.tpl +27 -0
- package/templates/value-object/value-object.spec.ts.tpl +1 -0
- package/dist/generate/kinds/background/require-container.d.ts +0 -7
- package/dist/generate/kinds/background/require-container.d.ts.map +0 -1
- package/dist/generate/kinds/background/require-container.js +0 -13
- package/dist/generate/kinds/background/require-container.js.map +0 -1
- /package/templates/background-job/{background-job.spec.ts.tpl → background-job.spec.tsyringe.ts.tpl} +0 -0
- /package/templates/process/{timeout-job.spec.ts.tpl → timeout-job.spec.tsyringe.ts.tpl} +0 -0
- /package/templates/repository/{wiring.manual.tpl → first-use.wiring.manual.tpl} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineContextModule, type ContextModule } from '@ddd-ts-kit/di';
|
|
2
|
+
import { runPurge } from '{{alias.platform}}/privacy/run-purge{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Privacy as a capability of the platform: every night at 03:00 UTC, the rows that outlived the
|
|
6
|
+
* retention their declaration gives are purged (`privacy.purge-expired`, switched off in one
|
|
7
|
+
* environment with `JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false`).
|
|
8
|
+
*/
|
|
9
|
+
export function privacyModule(): ContextModule {
|
|
10
|
+
return defineContextModule({
|
|
11
|
+
name: 'privacy',
|
|
12
|
+
register(builder) {
|
|
13
|
+
builder.job('privacy.purge-expired', { cron: '0 3 * * *' }).handledByFactory((resolve) => ({
|
|
14
|
+
run: async () => {
|
|
15
|
+
await runPurge(resolve);
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{{#if tenancy.any}}
|
|
2
|
+
import {
|
|
3
|
+
dataSubjectErasedV1,
|
|
4
|
+
eachTenant,
|
|
5
|
+
eraseDataSubject,
|
|
6
|
+
executionContext,
|
|
7
|
+
inEachTenant,
|
|
8
|
+
type Actor,
|
|
9
|
+
type DataSubjectErasureReport,
|
|
10
|
+
} from '@ddd-ts-kit/kernel';
|
|
11
|
+
{{/if}}
|
|
12
|
+
{{#unless tenancy.any}}
|
|
13
|
+
import {
|
|
14
|
+
dataSubjectErasedV1,
|
|
15
|
+
eraseDataSubject,
|
|
16
|
+
executionContext,
|
|
17
|
+
type Actor,
|
|
18
|
+
type DataSubjectErasureReport,
|
|
19
|
+
} from '@ddd-ts-kit/kernel';
|
|
20
|
+
{{/unless}}
|
|
21
|
+
import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ext}}';
|
|
22
|
+
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
23
|
+
|
|
24
|
+
export interface ErasureRequest {
|
|
25
|
+
/** The assembled platform: the {{#if eventSourcing.on}}keys, the {{/if}}scope and the copies come from it. */
|
|
26
|
+
readonly platform: Platform;
|
|
27
|
+
/** Who asks for the erasure, as typed: the actor of the work{{#if eventSourcing.on}}{{#if audit.on}}, named by the entry the audited keys write{{/if}}{{/if}}. */
|
|
28
|
+
readonly operator: string;
|
|
29
|
+
/** The correlation of the work: one per erasure. */
|
|
30
|
+
readonly correlationId: string;
|
|
31
|
+
{{#if tenancy.any}}
|
|
32
|
+
/** The tenants the deployment serves: the copies are erased in each one, in an execution context of that tenant, since a write of tenant data is never widened. */
|
|
33
|
+
readonly tenants: readonly string[];
|
|
34
|
+
{{/if}}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
{{#if eventSourcing.on}}
|
|
38
|
+
/**
|
|
39
|
+
* The right to erasure of one data subject, in an execution context of its own (origin `cli`): the
|
|
40
|
+
* key first{{#if audit.on}}, with its audit entry{{/if}}, then every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in
|
|
41
|
+
* every tenant{{/if}}. Running it again completes an erasure whose entry or copy failed; a subject that is
|
|
42
|
+
* not an opaque identifier is refused before any key is touched.
|
|
43
|
+
*/
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#unless eventSourcing.on}}
|
|
46
|
+
/**
|
|
47
|
+
* The right to erasure of one data subject, in an execution context of its own (origin `cli`):
|
|
48
|
+
* every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}. The aggregates
|
|
49
|
+
* of this project are rows, so no key is destroyed: a copy is erased or pseudonymised where it
|
|
50
|
+
* lies. Running it again completes an erasure whose copy failed; a subject that is not an opaque
|
|
51
|
+
* identifier is refused before anything is touched.
|
|
52
|
+
*/
|
|
53
|
+
{{/unless}}
|
|
54
|
+
export function runErasure(subject: string, request: ErasureRequest): Promise<DataSubjectErasureReport> {
|
|
55
|
+
const { platform, operator, correlationId } = request;
|
|
56
|
+
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
57
|
+
|
|
58
|
+
return platform.scope.run(context, async () => {
|
|
59
|
+
const report = await eraseDataSubject(subject, {
|
|
60
|
+
{{#if eventSourcing.on}}
|
|
61
|
+
// TODO(platform): once a projection is fed by the event store, give `rebuilds` the rebuild of each one: a projection keeps a clear copy of the person until it is rebuilt.
|
|
62
|
+
keys: platform.eventSourcing.subjectKeys,
|
|
63
|
+
{{/if}}
|
|
64
|
+
copies: dataSubjectCopies.map((copy) => copy(platform)),
|
|
65
|
+
{{#if tenancy.any}}
|
|
66
|
+
inEveryTenant: inEachTenant(platform.scope, request.tenants),
|
|
67
|
+
{{/if}}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await announceErasure(subject, request);
|
|
71
|
+
|
|
72
|
+
return report;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Once every copy is erased, `privacy.data-subject.erased` goes to the outbox{{#if tenancy.any}}, once per tenant{{/if}}: a context that
|
|
78
|
+
* runs as a service of its own, or a system that copied the person from an integration event, erases
|
|
79
|
+
* its copy on its side (GDPR article 19). It names the person by id and nobody else: who asked is in
|
|
80
|
+
* the audit trail, under the correlation id the event carries. The relay of the application delivers it; an erasure that
|
|
81
|
+
* failed publishes nothing, and running it again does.
|
|
82
|
+
*/
|
|
83
|
+
async function announceErasure(subject: string, { platform{{#if tenancy.any}}, tenants{{/if}} }: ErasureRequest): Promise<void> {
|
|
84
|
+
const erasedAt = platform.clock.now();
|
|
85
|
+
const payload = { subjectId: subject, erasedAt: erasedAt.toISOString() };
|
|
86
|
+
const event = () => dataSubjectErasedV1.create(payload, { id: platform.ids.next(), occurredAt: erasedAt });
|
|
87
|
+
const publish = () => platform.publisher.publish([event()]);
|
|
88
|
+
{{#if tenancy.any}}
|
|
89
|
+
|
|
90
|
+
await eachTenant(platform.scope, tenants, publish);
|
|
91
|
+
{{/if}}
|
|
92
|
+
{{#unless tenancy.any}}
|
|
93
|
+
|
|
94
|
+
await publish();
|
|
95
|
+
{{/unless}}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function operatorActor(id: string): Actor {
|
|
99
|
+
return { id, type: 'user', roles: [], attributes: {} };
|
|
100
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Application as Container } from '@ddd-ts-kit/di';
|
|
2
|
+
import {
|
|
3
|
+
Clock,
|
|
4
|
+
ExecutionScope,
|
|
5
|
+
IdGenerator,
|
|
6
|
+
IntegrationEventPublisher,
|
|
7
|
+
{{#if eventSourcing.on}}
|
|
8
|
+
SubjectKeyStore,
|
|
9
|
+
{{/if}}
|
|
10
|
+
dataSubjectErasedV1,
|
|
11
|
+
{{#if tenancy.any}}
|
|
12
|
+
eachTenant,
|
|
13
|
+
{{/if}}
|
|
14
|
+
eraseDataSubject,
|
|
15
|
+
executionContext,
|
|
16
|
+
{{#if tenancy.any}}
|
|
17
|
+
inEachTenant,
|
|
18
|
+
{{/if}}
|
|
19
|
+
type Actor,
|
|
20
|
+
type DataSubjectErasureReport,
|
|
21
|
+
} from '@ddd-ts-kit/kernel';
|
|
22
|
+
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
23
|
+
|
|
24
|
+
export interface ErasureRequest {
|
|
25
|
+
/** The composed application: the {{#if eventSourcing.on}}keys and the {{/if}}copies are resolved from it. */
|
|
26
|
+
readonly container: Container;
|
|
27
|
+
/** Who asks for the erasure, as typed: the actor of the work{{#if eventSourcing.on}}{{#if audit.on}}, named by the entry the audited keys write{{/if}}{{/if}}. */
|
|
28
|
+
readonly operator: string;
|
|
29
|
+
/** The correlation of the work: one per erasure. */
|
|
30
|
+
readonly correlationId: string;
|
|
31
|
+
{{#if tenancy.any}}
|
|
32
|
+
/** The tenants the deployment serves: the copies are erased in each one, in an execution context of that tenant, since a write of tenant data is never widened. */
|
|
33
|
+
readonly tenants: readonly string[];
|
|
34
|
+
{{/if}}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
{{#if eventSourcing.on}}
|
|
38
|
+
/**
|
|
39
|
+
* The right to erasure of one data subject, in an execution context of its own (origin `cli`): the
|
|
40
|
+
* key first{{#if audit.on}}, with its audit entry{{/if}}, then every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in
|
|
41
|
+
* every tenant{{/if}}. Running it again completes an erasure whose entry or copy failed; a subject that is
|
|
42
|
+
* not an opaque identifier is refused before any key is touched.
|
|
43
|
+
*/
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#unless eventSourcing.on}}
|
|
46
|
+
/**
|
|
47
|
+
* The right to erasure of one data subject, in an execution context of its own (origin `cli`):
|
|
48
|
+
* every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}. The aggregates
|
|
49
|
+
* of this project are rows, so no key is destroyed: a copy is erased or pseudonymised where it
|
|
50
|
+
* lies. Running it again completes an erasure whose copy failed; a subject that is not an opaque
|
|
51
|
+
* identifier is refused before anything is touched.
|
|
52
|
+
*/
|
|
53
|
+
{{/unless}}
|
|
54
|
+
export function runErasure(subject: string, request: ErasureRequest): Promise<DataSubjectErasureReport> {
|
|
55
|
+
const { container, operator, correlationId } = request;
|
|
56
|
+
const scope = container.resolve(ExecutionScope);
|
|
57
|
+
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
58
|
+
|
|
59
|
+
return scope.run(context, async () => {
|
|
60
|
+
const report = await eraseDataSubject(subject, {
|
|
61
|
+
{{#if eventSourcing.on}}
|
|
62
|
+
// TODO(platform): once a projection is fed by the event store, give `rebuilds` the rebuild of each one: a projection keeps a clear copy of the person until it is rebuilt.
|
|
63
|
+
keys: container.resolve(SubjectKeyStore),
|
|
64
|
+
{{/if}}
|
|
65
|
+
copies: dataSubjectCopies.map((copy) => container.resolve(copy)),
|
|
66
|
+
{{#if tenancy.any}}
|
|
67
|
+
inEveryTenant: inEachTenant(scope, request.tenants),
|
|
68
|
+
{{/if}}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await announceErasure(subject, request);
|
|
72
|
+
|
|
73
|
+
return report;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Once every copy is erased, `privacy.data-subject.erased` goes to the outbox{{#if tenancy.any}}, once per tenant{{/if}}: a context that
|
|
79
|
+
* runs as a service of its own, or a system that copied the person from an integration event, erases
|
|
80
|
+
* its copy on its side (GDPR article 19). It names the person by id and nobody else: who asked is in
|
|
81
|
+
* the audit trail, under the correlation id the event carries. The relay of the application delivers it; an erasure that
|
|
82
|
+
* failed publishes nothing, and running it again does.
|
|
83
|
+
*/
|
|
84
|
+
async function announceErasure(subject: string, request: ErasureRequest): Promise<void> {
|
|
85
|
+
const { container } = request;
|
|
86
|
+
const publisher = container.resolve(IntegrationEventPublisher);
|
|
87
|
+
const ids = container.resolve(IdGenerator);
|
|
88
|
+
const erasedAt = container.resolve(Clock).now();
|
|
89
|
+
const payload = { subjectId: subject, erasedAt: erasedAt.toISOString() };
|
|
90
|
+
const event = () => dataSubjectErasedV1.create(payload, { id: ids.next(), occurredAt: erasedAt });
|
|
91
|
+
const publish = () => publisher.publish([event()]);
|
|
92
|
+
{{#if tenancy.any}}
|
|
93
|
+
|
|
94
|
+
await eachTenant(container.resolve(ExecutionScope), request.tenants, publish);
|
|
95
|
+
{{/if}}
|
|
96
|
+
{{#unless tenancy.any}}
|
|
97
|
+
|
|
98
|
+
await publish();
|
|
99
|
+
{{/unless}}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function operatorActor(id: string): Actor {
|
|
103
|
+
return { id, type: 'user', roles: [], attributes: {} };
|
|
104
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { auditedPersonalDataExport } from '@ddd-ts-kit/audit';
|
|
3
|
+
{{/if}}
|
|
4
|
+
import {
|
|
5
|
+
executionContext,
|
|
6
|
+
exportDataSubject,
|
|
7
|
+
{{#if tenancy.any}}
|
|
8
|
+
recordsInEachTenant,
|
|
9
|
+
{{/if}}
|
|
10
|
+
type Actor,
|
|
11
|
+
type PersonalDataExport,
|
|
12
|
+
type PersonalDataExportDocument,
|
|
13
|
+
} from '@ddd-ts-kit/kernel';
|
|
14
|
+
import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ext}}';
|
|
15
|
+
import { dataSubjectExports } from '{{alias.platform}}/privacy/data-subject-exports{{alias.ext}}';
|
|
16
|
+
|
|
17
|
+
export interface ExportRequest {
|
|
18
|
+
/** The assembled platform: the scope, the clock{{#if audit.on}}, the trail{{/if}} and the exports come from it. */
|
|
19
|
+
readonly platform: Platform;
|
|
20
|
+
/** Who asks for the export, as typed: the actor of the work{{#if audit.on}}, named by the entry each export writes{{/if}}. */
|
|
21
|
+
readonly operator: string;
|
|
22
|
+
/** The correlation of the work: one per export. */
|
|
23
|
+
readonly correlationId: string;
|
|
24
|
+
{{#if tenancy.any}}
|
|
25
|
+
/** The tenants the deployment serves: the records are gathered in each one, in an execution context of that tenant, since a read of tenant data is confined to it. */
|
|
26
|
+
readonly tenants: readonly string[];
|
|
27
|
+
{{/if}}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The right of access and to portability of one data subject (GDPR articles 15 and 20), in an
|
|
32
|
+
* execution context of its own (origin `cli`): every record each context declared in
|
|
33
|
+
* `data-subject-exports.ts` keeps of the person{{#if tenancy.any}}, in every tenant{{/if}}, gathered into one dated document
|
|
34
|
+
* of a stable format{{#if audit.on}}; every export writes its entry to the audit trail, the operator, the subject and
|
|
35
|
+
* the number of records, never the values{{/if}}. A subject that is not an opaque identifier is refused
|
|
36
|
+
* before anything is read.
|
|
37
|
+
*/
|
|
38
|
+
export function runExport(subject: string, request: ExportRequest): Promise<PersonalDataExportDocument> {
|
|
39
|
+
const { platform, operator, correlationId } = request;
|
|
40
|
+
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
41
|
+
{{#if audit.on}}
|
|
42
|
+
const { trail } = platform.audit;
|
|
43
|
+
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids };
|
|
44
|
+
const audited = (port: PersonalDataExport): PersonalDataExport => auditedPersonalDataExport(port, trail, source);
|
|
45
|
+
const exports = dataSubjectExports.map((exported) => audited(exported(platform)));
|
|
46
|
+
{{/if}}
|
|
47
|
+
{{#unless audit.on}}
|
|
48
|
+
const exports: readonly PersonalDataExport[] = dataSubjectExports.map((exported) => exported(platform));
|
|
49
|
+
{{/unless}}
|
|
50
|
+
|
|
51
|
+
return platform.scope.run(context, () =>
|
|
52
|
+
exportDataSubject(subject, {
|
|
53
|
+
exports,
|
|
54
|
+
clock: platform.clock,
|
|
55
|
+
{{#if tenancy.any}}
|
|
56
|
+
inEveryTenant: recordsInEachTenant(platform.scope, request.tenants),
|
|
57
|
+
{{/if}}
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function operatorActor(id: string): Actor {
|
|
63
|
+
return { id, type: 'user', roles: [], attributes: {} };
|
|
64
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { AuditTrail, auditedPersonalDataExport } from '@ddd-ts-kit/audit';
|
|
3
|
+
{{/if}}
|
|
4
|
+
import type { Application as Container } from '@ddd-ts-kit/di';
|
|
5
|
+
import {
|
|
6
|
+
Clock,
|
|
7
|
+
ExecutionScope,
|
|
8
|
+
{{#if audit.on}}
|
|
9
|
+
IdGenerator,
|
|
10
|
+
{{/if}}
|
|
11
|
+
executionContext,
|
|
12
|
+
exportDataSubject,
|
|
13
|
+
{{#if tenancy.any}}
|
|
14
|
+
recordsInEachTenant,
|
|
15
|
+
{{/if}}
|
|
16
|
+
type Actor,
|
|
17
|
+
type PersonalDataExport,
|
|
18
|
+
type PersonalDataExportDocument,
|
|
19
|
+
} from '@ddd-ts-kit/kernel';
|
|
20
|
+
import { dataSubjectExports } from '{{alias.platform}}/privacy/data-subject-exports{{alias.ext}}';
|
|
21
|
+
|
|
22
|
+
export interface ExportRequest {
|
|
23
|
+
/** The composed application: the exports are resolved from it. */
|
|
24
|
+
readonly container: Container;
|
|
25
|
+
/** Who asks for the export, as typed: the actor of the work{{#if audit.on}}, named by the entry each export writes{{/if}}. */
|
|
26
|
+
readonly operator: string;
|
|
27
|
+
/** The correlation of the work: one per export. */
|
|
28
|
+
readonly correlationId: string;
|
|
29
|
+
{{#if tenancy.any}}
|
|
30
|
+
/** The tenants the deployment serves: the records are gathered in each one, in an execution context of that tenant, since a read of tenant data is confined to it. */
|
|
31
|
+
readonly tenants: readonly string[];
|
|
32
|
+
{{/if}}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The right of access and to portability of one data subject (GDPR articles 15 and 20), in an
|
|
37
|
+
* execution context of its own (origin `cli`): every record each context declared in
|
|
38
|
+
* `data-subject-exports.ts` keeps of the person{{#if tenancy.any}}, in every tenant{{/if}}, gathered into one dated document
|
|
39
|
+
* of a stable format{{#if audit.on}}; every export writes its entry to the audit trail, the operator, the subject and
|
|
40
|
+
* the number of records, never the values{{/if}}. A subject that is not an opaque identifier is refused
|
|
41
|
+
* before anything is read.
|
|
42
|
+
*/
|
|
43
|
+
export function runExport(subject: string, request: ExportRequest): Promise<PersonalDataExportDocument> {
|
|
44
|
+
const { container, operator, correlationId } = request;
|
|
45
|
+
const scope = container.resolve(ExecutionScope);
|
|
46
|
+
const clock = container.resolve(Clock);
|
|
47
|
+
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
48
|
+
{{#if audit.on}}
|
|
49
|
+
const trail = container.resolve(AuditTrail);
|
|
50
|
+
const source = { scope, clock, ids: container.resolve(IdGenerator) };
|
|
51
|
+
const audited = (port: PersonalDataExport): PersonalDataExport => auditedPersonalDataExport(port, trail, source);
|
|
52
|
+
const exports = dataSubjectExports.map((port) => audited(container.resolve(port)));
|
|
53
|
+
{{/if}}
|
|
54
|
+
{{#unless audit.on}}
|
|
55
|
+
const exports: readonly PersonalDataExport[] = dataSubjectExports.map((port) => container.resolve(port));
|
|
56
|
+
{{/unless}}
|
|
57
|
+
|
|
58
|
+
return scope.run(context, () =>
|
|
59
|
+
exportDataSubject(subject, {
|
|
60
|
+
exports,
|
|
61
|
+
clock,
|
|
62
|
+
{{#if tenancy.any}}
|
|
63
|
+
inEveryTenant: recordsInEachTenant(scope, request.tenants),
|
|
64
|
+
{{/if}}
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function operatorActor(id: string): Actor {
|
|
70
|
+
return { id, type: 'user', roles: [], attributes: {} };
|
|
71
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { auditedPersonalDataRetention } from '@ddd-ts-kit/audit';
|
|
3
|
+
import {
|
|
4
|
+
isPersonalDataRetention,
|
|
5
|
+
purgeExpiredPersonalData,
|
|
6
|
+
type PersonalDataPurgeReport,
|
|
7
|
+
type PersonalDataRetention,
|
|
8
|
+
} from '@ddd-ts-kit/kernel';
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{#unless audit.on}}
|
|
11
|
+
import { isPersonalDataRetention, purgeExpiredPersonalData, type PersonalDataPurgeReport } from '@ddd-ts-kit/kernel';
|
|
12
|
+
{{/unless}}
|
|
13
|
+
import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ext}}';
|
|
14
|
+
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The storage limitation of the application (GDPR article 5(1)(e)): every copy listed in
|
|
18
|
+
* `data-subject-copies.ts` purges the rows that outlived the retention their declaration gives,
|
|
19
|
+
* deleted or pseudonymised as it says{{#if tenancy.any}}, in every tenant: the work of the job names none, and a
|
|
20
|
+
* tenant left out of a list would keep what it should not{{/if}}{{#if audit.on}}; each purge writes its entry to the audit
|
|
21
|
+
* trail, the number of rows and no person{{/if}}. Run every night by the job `privacy.purge-expired` and by
|
|
22
|
+
* `npm run privacy:purge`, each in an execution context of its own. A copy that fails does not stop
|
|
23
|
+
* the others; the next run completes it.
|
|
24
|
+
*/
|
|
25
|
+
export function runPurge(platform: Platform): Promise<PersonalDataPurgeReport> {
|
|
26
|
+
const retentions = dataSubjectCopies.map((copy) => copy(platform)).filter(isPersonalDataRetention);
|
|
27
|
+
{{#if audit.on}}
|
|
28
|
+
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids };
|
|
29
|
+
|
|
30
|
+
const audited = (port: PersonalDataRetention): PersonalDataRetention =>
|
|
31
|
+
auditedPersonalDataRetention(port, platform.audit.trail, source);
|
|
32
|
+
|
|
33
|
+
return purgeExpiredPersonalData(platform.clock.now(), retentions.map(audited));
|
|
34
|
+
{{/if}}
|
|
35
|
+
{{#unless audit.on}}
|
|
36
|
+
|
|
37
|
+
return purgeExpiredPersonalData(platform.clock.now(), retentions);
|
|
38
|
+
{{/unless}}
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { AuditTrail, auditedPersonalDataRetention } from '@ddd-ts-kit/audit';
|
|
3
|
+
{{/if}}
|
|
4
|
+
import type { Resolve } from '@ddd-ts-kit/di';
|
|
5
|
+
import {
|
|
6
|
+
Clock,
|
|
7
|
+
{{#if audit.on}}
|
|
8
|
+
ExecutionScope,
|
|
9
|
+
IdGenerator,
|
|
10
|
+
{{/if}}
|
|
11
|
+
isPersonalDataRetention,
|
|
12
|
+
purgeExpiredPersonalData,
|
|
13
|
+
type PersonalDataPurgeReport,
|
|
14
|
+
{{#if audit.on}}
|
|
15
|
+
type PersonalDataRetention,
|
|
16
|
+
{{/if}}
|
|
17
|
+
} from '@ddd-ts-kit/kernel';
|
|
18
|
+
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The storage limitation of the application (GDPR article 5(1)(e)): every copy listed in
|
|
22
|
+
* `data-subject-copies.ts` purges the rows that outlived the retention their declaration gives,
|
|
23
|
+
* deleted or pseudonymised as it says{{#if tenancy.any}}, in every tenant: the work of the job names none, and a
|
|
24
|
+
* tenant left out of a list would keep what it should not{{/if}}{{#if audit.on}}; each purge writes its entry to the audit
|
|
25
|
+
* trail, the number of rows and no person{{/if}}. Run every night by the job `privacy.purge-expired` and by
|
|
26
|
+
* `npm run privacy:purge`, each in an execution context of its own. A copy that fails does not stop
|
|
27
|
+
* the others; the next run completes it.
|
|
28
|
+
*/
|
|
29
|
+
export function runPurge(resolve: Resolve): Promise<PersonalDataPurgeReport> {
|
|
30
|
+
const clock = resolve(Clock);
|
|
31
|
+
const retentions = dataSubjectCopies.map((copy) => resolve(copy)).filter(isPersonalDataRetention);
|
|
32
|
+
{{#if audit.on}}
|
|
33
|
+
const trail = resolve(AuditTrail);
|
|
34
|
+
const source = { scope: resolve(ExecutionScope), clock, ids: resolve(IdGenerator) };
|
|
35
|
+
|
|
36
|
+
const audited = (port: PersonalDataRetention): PersonalDataRetention =>
|
|
37
|
+
auditedPersonalDataRetention(port, trail, source);
|
|
38
|
+
|
|
39
|
+
return purgeExpiredPersonalData(clock.now(), retentions.map(audited));
|
|
40
|
+
{{/if}}
|
|
41
|
+
{{#unless audit.on}}
|
|
42
|
+
|
|
43
|
+
return purgeExpiredPersonalData(clock.now(), retentions);
|
|
44
|
+
{{/unless}}
|
|
45
|
+
}
|
|
@@ -16,7 +16,7 @@ paths:
|
|
|
16
16
|
- Own tables, in the schema of the context: no join, foreign key or transaction across contexts (`context/extractable`).
|
|
17
17
|
- Audit columns and the tenant column are stamped from the execution scope with the kernel helpers (`stampCreation`, `stampUpdate`, `tenantScopeOf`), never handed over by a use case.
|
|
18
18
|
{{#if tenancy.any}}
|
|
19
|
-
- Tenant data is reached through the helpers of the ORM package, never straight from the executor: {{#if orm.knex}}`tenantTable` to read, `ownTenantTable` to update or delete{{/if}}{{#if orm.drizzle}}`tenantCondition` in the condition of a read, `ownTenantCondition` in that of an update or a delete{{/if}}, the tenant named on every insert (`tenancy/scoped-statement`). A table of no tenant is a recorded deviation. See `docs/concepts/multitenancy.md` of the kit.
|
|
19
|
+
- Tenant data is reached through the helpers of the ORM package, never straight from the executor: {{#if orm.knex}}`tenantTable` to read, `ownTenantTable` to update or delete{{/if}}{{#if orm.drizzle}}`tenantCondition` in the condition of a read, `ownTenantCondition` in that of an update or a delete{{/if}}{{#if orm.prisma}}`tenantWhere` spread into the where of a read (`findFirst`, never `findUnique`: the tenant is not part of the key), `ownTenantWhere` into that of an update or a delete{{/if}}{{#if orm.typeorm}}`tenantWhere` spread into the where of a read, `ownTenantWhere` into the criteria of an update or a delete, never `save` or `upsert`{{/if}}, the tenant named on every insert, a read model store built with its `tenant` (`tenancy/scoped-statement`). A table of no tenant is a recorded deviation. See `docs/concepts/multitenancy.md` of the kit.
|
|
20
20
|
{{/if}}
|
|
21
21
|
{{#if style.declared}}
|
|
22
22
|
- An adapter declares itself on its class, one per file (`declarations/role-declared`): `@Repository(InvoiceRepository)`, `@Gateway(Port)` or `@Adapter(Port, { kind })`. What it is given is what its constructor takes, each parameter typed by one class (`{{persistence.tokenOrNone}}`, `ExecutionScope`, `Clock`, a port, an abstract class the platform binds to a value) and nothing listed in the decorator (`declarations/constructor-injection`); an adapter that extends a class of a package writes its own constructor.
|
|
@@ -19,7 +19,7 @@ paths:
|
|
|
19
19
|
- `test/integration/`: adapters against the real dependency, and the contract suites every adapter and fake of a port must pass.
|
|
20
20
|
- A fake is a working in-memory implementation, not a mock with expectations: no `vi.mock`, `vi.fn`, `vi.spyOn` (`test/no-mocks`). Test data comes from the builders of `test/builders/`.
|
|
21
21
|
- The arrangement several specs of a context share, the test application or the buses with the fakes, is a world of `test/worlds/` written by `npx ddd-ts-kit generate test-world <context>`: `a<Name>World({ now, idPrefix, given })` returns every fake under the name of its port, `given` storing what the spec starts from. `test/unit/` and `test/integration/` hold specs only (`test/helper-placed`).
|
|
22
|
-
- Name tests after the behaviour, in the words of the business: "refuses to issue an invoice without lines", not "should throw". Arrange, act, assert, separated by a blank line; one behaviour per test.
|
|
22
|
+
- Name tests after the behaviour, in the words of the business: "refuses to issue an invoice without lines", not "should throw". Arrange, act, assert, separated by a blank line; one behaviour per test. `npm run lint` holds the shape: the title states the rule (`test/title-states-a-rule`), no `if` or loop in a test (`test/no-logic`), an assertion in every test (`test/assertion-present`), a refusal asserted by its code, never by a message (`test/refusal-by-code`), no snapshot (`test/no-snapshot`), no `.only` or `.skip` (`test/no-only-no-skip`).
|
|
23
23
|
- Every aggregate, value object, domain service, handler, event handler and integration event handler has a spec named after its file (`test/spec-required`).
|
|
24
24
|
- Coverage is a floor per context and layer, read from `coverage` in `ddd-ts-kit.config.json` and held by `npm run verify` (`npm run test:coverage`): a layer under its threshold gets the test that is missing. No `exclude` in the runner config, no `v8 ignore` or `istanbul ignore` comment without `-- ADR-NNNN: <reason>` (`test/coverage-governed`); a rate proves that code ran, never that a test asserts anything.
|
|
25
25
|
- An `it.todo` left by the generator names a behaviour still to prove: replace it by a real test, do not delete it. `npx ddd-ts-kit todo <context>` lists what remains.
|
|
@@ -2,6 +2,9 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createEventRegistry, generateEventCatalog, type AnyIntegrationEventDefinition } from '@ddd-ts-kit/events';
|
|
4
4
|
import { generateAsyncApi } from '@ddd-ts-kit/events/asyncapi';
|
|
5
|
+
{{#if privacy.on}}
|
|
6
|
+
import { dataSubjectErasedV1 } from '@ddd-ts-kit/kernel';
|
|
7
|
+
{{/if}}
|
|
5
8
|
import { contractFormat, stringifyContract } from 'ddd-ts-kit/dist/contracts.js';
|
|
6
9
|
|
|
7
10
|
// Generates docs/integration/asyncapi.yaml (asyncapi.json under "openapi.format": "json" in
|
|
@@ -19,7 +22,16 @@ const PENDING = 'x-ddd-ts-kit-pending';
|
|
|
19
22
|
|
|
20
23
|
/** The type of each declaration by the name its published language exports it under, `invoiceIssuedV1`: what a handler reads with `invoiceIssuedV1.type`. */
|
|
21
24
|
const typesByName = new Map<string, string>();
|
|
25
|
+
{{#if privacy.on}}
|
|
26
|
+
|
|
27
|
+
// The erasure of a data subject, which the platform publishes: `privacy:erase` announces it once every copy is erased.
|
|
28
|
+
typesByName.set('dataSubjectErasedV1', dataSubjectErasedV1.type);
|
|
29
|
+
|
|
30
|
+
const registry = createEventRegistry([...(await declaredEvents()), dataSubjectErasedV1]);
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{#unless privacy.on}}
|
|
22
33
|
const registry = createEventRegistry(await declaredEvents());
|
|
34
|
+
{{/unless}}
|
|
23
35
|
|
|
24
36
|
const generated: Readonly<Record<string, string>> = {
|
|
25
37
|
[`asyncapi.${format}`]: stringifyContract(
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
{{#if http.any}}
|
|
5
|
+
import { offlineAuthenticator } from '{{alias.platform}}/auth/authentication/offline-authenticator{{alias.ext}}';
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { composeApplication } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
8
|
+
{{#if persistence.needsUrl}}
|
|
9
|
+
import { loadConfig } from '{{alias.platform}}/config/load-config{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
11
|
+
import { openPersistence } from '{{alias.platform}}/database/open-persistence{{alias.ext}}';
|
|
12
|
+
import { inProcessEvents } from '{{alias.platform}}/events/in-process-events{{alias.ext}}';
|
|
13
|
+
import { runErasure } from '{{alias.platform}}/privacy/run-erasure{{alias.ext}}';
|
|
14
|
+
|
|
15
|
+
// The right to erasure of one data subject (GDPR, article 17), from the command line:
|
|
16
|
+
// npm run privacy:erase -- <subject-id> [--operator <who-asks>]
|
|
17
|
+
{{#if eventSourcing.on}}
|
|
18
|
+
// The key of the subject is destroyed first, so every personal value of its stored events reads as
|
|
19
|
+
// erased{{#if audit.on}}, and the erasure leaves a dated entry in the audit trail{{/if}}; then every copy a context declared in
|
|
20
|
+
// src/platform/privacy/data-subject-copies.ts is erased{{#if tenancy.any}}, in each tenant of TENANTS (comma separated){{/if}}.
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#unless eventSourcing.on}}
|
|
23
|
+
// Every copy a context declared in src/platform/privacy/data-subject-copies.ts is erased or
|
|
24
|
+
// pseudonymised where it lies{{#if tenancy.any}}, in each tenant of TENANTS (comma separated){{/if}}: the aggregates of
|
|
25
|
+
// this project are rows, so there is no key to destroy.
|
|
26
|
+
{{/unless}}
|
|
27
|
+
// The report says what was reached. Running it again completes an erasure that failed half way.
|
|
28
|
+
// What this script cannot reach: backups, logs, exports and the copies no context declared.
|
|
29
|
+
const { positionals, values } = parseArgs({
|
|
30
|
+
allowPositionals: true,
|
|
31
|
+
options: { operator: { type: 'string', default: os.userInfo().username } },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const [subject] = positionals;
|
|
35
|
+
|
|
36
|
+
if (subject === undefined || positionals.length > 1) {
|
|
37
|
+
console.error('Usage: npm run privacy:erase -- <subject-id> [--operator <who-asks>]');
|
|
38
|
+
process.exit(2);
|
|
39
|
+
}
|
|
40
|
+
{{#if tenancy.any}}
|
|
41
|
+
|
|
42
|
+
const tenants = (process.env['TENANTS'] ?? '').split(',').map((tenant) => tenant.trim()).filter((tenant) => tenant !== '');
|
|
43
|
+
|
|
44
|
+
if (tenants.length === 0) {
|
|
45
|
+
console.error('TENANTS names the tenants the copies are erased in, comma separated: a write of tenant data is never widened.');
|
|
46
|
+
process.exit(2);
|
|
47
|
+
}
|
|
48
|
+
{{/if}}
|
|
49
|
+
|
|
50
|
+
{{#if persistence.needsUrl}}
|
|
51
|
+
const persistence = {{persistence.await}}openPersistence(loadConfig(process.env));
|
|
52
|
+
{{/if}}
|
|
53
|
+
{{#unless persistence.needsUrl}}
|
|
54
|
+
const persistence = openPersistence();
|
|
55
|
+
{{/unless}}
|
|
56
|
+
|
|
57
|
+
const application = composeApplication(persistence, {
|
|
58
|
+
events: inProcessEvents(),
|
|
59
|
+
{{#if http.any}}
|
|
60
|
+
authenticator: offlineAuthenticator,
|
|
61
|
+
{{/if}}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const report = await runErasure(subject, {
|
|
66
|
+
platform: application.platform,
|
|
67
|
+
operator: values.operator,
|
|
68
|
+
correlationId: randomUUID(),
|
|
69
|
+
{{#if tenancy.any}}
|
|
70
|
+
tenants,
|
|
71
|
+
{{/if}}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
console.log(JSON.stringify(report, null, 2));
|
|
75
|
+
} finally {
|
|
76
|
+
await application.stop();
|
|
77
|
+
await persistence.close();
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
{{#if http.any}}
|
|
5
|
+
import { offlineAuthenticator } from '{{alias.platform}}/auth/authentication/offline-authenticator{{alias.ext}}';
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { composeApplication } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
8
|
+
{{#if persistence.needsUrl}}
|
|
9
|
+
import { loadConfig } from '{{alias.platform}}/config/load-config{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
11
|
+
import { openPersistence } from '{{alias.platform}}/database/open-persistence{{alias.ext}}';
|
|
12
|
+
import { inProcessEvents } from '{{alias.platform}}/events/in-process-events{{alias.ext}}';
|
|
13
|
+
import { runErasure } from '{{alias.platform}}/privacy/run-erasure{{alias.ext}}';
|
|
14
|
+
|
|
15
|
+
// The right to erasure of one data subject (GDPR, article 17), from the command line:
|
|
16
|
+
// npm run privacy:erase -- <subject-id> [--operator <who-asks>]
|
|
17
|
+
{{#if eventSourcing.on}}
|
|
18
|
+
// The key of the subject is destroyed first, so every personal value of its stored events reads as
|
|
19
|
+
// erased{{#if audit.on}}, and the erasure leaves a dated entry in the audit trail{{/if}}; then every copy a context declared in
|
|
20
|
+
// src/platform/privacy/data-subject-copies.ts is erased{{#if tenancy.any}}, in each tenant of TENANTS (comma separated){{/if}}.
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#unless eventSourcing.on}}
|
|
23
|
+
// Every copy a context declared in src/platform/privacy/data-subject-copies.ts is erased or
|
|
24
|
+
// pseudonymised where it lies{{#if tenancy.any}}, in each tenant of TENANTS (comma separated){{/if}}: the aggregates of
|
|
25
|
+
// this project are rows, so there is no key to destroy.
|
|
26
|
+
{{/unless}}
|
|
27
|
+
// The report says what was reached. Running it again completes an erasure that failed half way.
|
|
28
|
+
// What this script cannot reach: backups, logs, exports and the copies no context declared.
|
|
29
|
+
const { positionals, values } = parseArgs({
|
|
30
|
+
allowPositionals: true,
|
|
31
|
+
options: { operator: { type: 'string', default: os.userInfo().username } },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const [subject] = positionals;
|
|
35
|
+
|
|
36
|
+
if (subject === undefined || positionals.length > 1) {
|
|
37
|
+
console.error('Usage: npm run privacy:erase -- <subject-id> [--operator <who-asks>]');
|
|
38
|
+
process.exit(2);
|
|
39
|
+
}
|
|
40
|
+
{{#if tenancy.any}}
|
|
41
|
+
|
|
42
|
+
const tenants = (process.env['TENANTS'] ?? '').split(',').map((tenant) => tenant.trim()).filter((tenant) => tenant !== '');
|
|
43
|
+
|
|
44
|
+
if (tenants.length === 0) {
|
|
45
|
+
console.error('TENANTS names the tenants the copies are erased in, comma separated: a write of tenant data is never widened.');
|
|
46
|
+
process.exit(2);
|
|
47
|
+
}
|
|
48
|
+
{{/if}}
|
|
49
|
+
|
|
50
|
+
{{#if persistence.needsUrl}}
|
|
51
|
+
const persistence = {{persistence.await}}openPersistence(loadConfig(process.env));
|
|
52
|
+
{{/if}}
|
|
53
|
+
{{#unless persistence.needsUrl}}
|
|
54
|
+
const persistence = openPersistence();
|
|
55
|
+
{{/unless}}
|
|
56
|
+
|
|
57
|
+
const application = composeApplication(persistence, {
|
|
58
|
+
events: inProcessEvents(),
|
|
59
|
+
{{#if http.any}}
|
|
60
|
+
authenticator: offlineAuthenticator,
|
|
61
|
+
{{/if}}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const report = await runErasure(subject, {
|
|
66
|
+
container: application.container,
|
|
67
|
+
operator: values.operator,
|
|
68
|
+
correlationId: randomUUID(),
|
|
69
|
+
{{#if tenancy.any}}
|
|
70
|
+
tenants,
|
|
71
|
+
{{/if}}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
console.log(JSON.stringify(report, null, 2));
|
|
75
|
+
} finally {
|
|
76
|
+
await application.stop();
|
|
77
|
+
await persistence.close();
|
|
78
|
+
}
|