ddd-ts-kit 0.101.0 → 0.103.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 +320 -0
- package/README.fr.md +11 -12
- package/README.md +10 -11
- package/dist/acceptance/check-locked-files.d.ts.map +1 -1
- package/dist/acceptance/check-locked-files.js +6 -3
- package/dist/acceptance/check-locked-files.js.map +1 -1
- package/dist/build/emitted-place.d.ts +1 -2
- package/dist/build/emitted-place.d.ts.map +1 -1
- package/dist/build/emitted-specifier.d.ts +7 -1
- package/dist/build/emitted-specifier.d.ts.map +1 -1
- package/dist/build/emitted-specifier.js +5 -6
- package/dist/build/emitted-specifier.js.map +1 -1
- package/dist/build/emitted-target.d.ts +6 -5
- package/dist/build/emitted-target.d.ts.map +1 -1
- package/dist/build/emitted-target.js +5 -9
- package/dist/build/emitted-target.js.map +1 -1
- package/dist/build/rewrite-aliases.d.ts.map +1 -1
- package/dist/build/rewrite-aliases.js +7 -5
- package/dist/build/rewrite-aliases.js.map +1 -1
- package/dist/build/rewrite-specifiers.d.ts +7 -6
- package/dist/build/rewrite-specifiers.d.ts.map +1 -1
- package/dist/build/rewrite-specifiers.js +6 -4
- package/dist/build/rewrite-specifiers.js.map +1 -1
- package/dist/build/unresolved-problem.d.ts +2 -1
- package/dist/build/unresolved-problem.d.ts.map +1 -1
- package/dist/build/unresolved-problem.js +2 -2
- package/dist/build/unresolved-problem.js.map +1 -1
- package/dist/check/baseline/write-baseline.d.ts.map +1 -1
- package/dist/check/baseline/write-baseline.js +2 -3
- package/dist/check/baseline/write-baseline.js.map +1 -1
- package/dist/check/business-names/parameter-lists.js +1 -3
- package/dist/check/business-names/parameter-lists.js.map +1 -1
- package/dist/check/engine/run-check.d.ts +3 -0
- package/dist/check/engine/run-check.d.ts.map +1 -1
- package/dist/check/engine/run-check.js +1 -1
- package/dist/check/engine/run-check.js.map +1 -1
- package/dist/check/errors/kit-error-codes.d.ts.map +1 -1
- package/dist/check/errors/kit-error-codes.js +1 -0
- package/dist/check/errors/kit-error-codes.js.map +1 -1
- package/dist/check/explain/authz-docs.js +1 -1
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/errors-docs.js +1 -1
- package/dist/check/explain/errors-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/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +13 -1
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/conjunct-cases.d.ts +11 -0
- package/dist/check/fixtures/conjunct-cases.d.ts.map +1 -0
- package/dist/check/fixtures/conjunct-cases.js +19 -0
- package/dist/check/fixtures/conjunct-cases.js.map +1 -0
- package/dist/check/fixtures/run-fixture.d.ts +3 -2
- package/dist/check/fixtures/run-fixture.d.ts.map +1 -1
- package/dist/check/fixtures/run-fixture.js +3 -3
- package/dist/check/fixtures/run-fixture.js.map +1 -1
- package/dist/check/fixtures/run-self-check.js +1 -1
- package/dist/check/fixtures/run-self-check.js.map +1 -1
- package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts +3 -0
- package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js +33 -0
- package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts +4 -0
- package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-fixtures.js +12 -0
- package/dist/check/fixtures/tenancy-conjunct-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts +3 -0
- package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js +49 -0
- package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts +3 -0
- package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js +32 -0
- package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts +3 -0
- package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js +34 -0
- package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +2 -0
- package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
- package/dist/check/rules/authz-policy-asked.d.ts.map +1 -1
- package/dist/check/rules/authz-policy-asked.js +45 -6
- package/dist/check/rules/authz-policy-asked.js.map +1 -1
- package/dist/check/rules/clean-one-export-per-file.js +1 -0
- package/dist/check/rules/clean-one-export-per-file.js.map +1 -1
- package/dist/check/rules/schema-no-duplicate-shape.js +1 -3
- package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.js +2 -2
- package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
- package/dist/check/rules/test-spec-required.d.ts.map +1 -1
- package/dist/check/rules/test-spec-required.js +3 -1
- package/dist/check/rules/test-spec-required.js.map +1 -1
- package/dist/check/scan/named-outside-imports.d.ts +3 -0
- package/dist/check/scan/named-outside-imports.d.ts.map +1 -0
- package/dist/check/scan/named-outside-imports.js +8 -0
- package/dist/check/scan/named-outside-imports.js.map +1 -0
- package/dist/check/scan/star-exports-of.d.ts +3 -0
- package/dist/check/scan/star-exports-of.d.ts.map +1 -0
- package/dist/check/scan/star-exports-of.js +8 -0
- package/dist/check/scan/star-exports-of.js.map +1 -0
- package/dist/check/scan/string-at.d.ts +3 -0
- package/dist/check/scan/string-at.d.ts.map +1 -0
- package/dist/check/scan/string-at.js +5 -0
- package/dist/check/scan/string-at.js.map +1 -0
- package/dist/check/tenancy/arguments-of-call.d.ts +3 -0
- package/dist/check/tenancy/arguments-of-call.d.ts.map +1 -0
- package/dist/check/tenancy/arguments-of-call.js +11 -0
- package/dist/check/tenancy/arguments-of-call.js.map +1 -0
- package/dist/check/tenancy/bare-expression.d.ts +3 -0
- package/dist/check/tenancy/bare-expression.d.ts.map +1 -0
- package/dist/check/tenancy/bare-expression.js +9 -0
- package/dist/check/tenancy/bare-expression.js.map +1 -0
- package/dist/check/tenancy/bracket-depth.d.ts +3 -0
- package/dist/check/tenancy/bracket-depth.d.ts.map +1 -0
- package/dist/check/tenancy/bracket-depth.js +10 -0
- package/dist/check/tenancy/bracket-depth.js.map +1 -0
- package/dist/check/tenancy/chain-links.d.ts +17 -0
- package/dist/check/tenancy/chain-links.d.ts.map +1 -0
- package/dist/check/tenancy/chain-links.js +24 -0
- package/dist/check/tenancy/chain-links.js.map +1 -0
- package/dist/check/tenancy/choice-branches.d.ts +3 -0
- package/dist/check/tenancy/choice-branches.d.ts.map +1 -0
- package/dist/check/tenancy/choice-branches.js +39 -0
- package/dist/check/tenancy/choice-branches.js.map +1 -0
- package/dist/check/tenancy/declaration-before.d.ts +12 -0
- package/dist/check/tenancy/declaration-before.d.ts.map +1 -0
- package/dist/check/tenancy/declaration-before.js +11 -0
- package/dist/check/tenancy/declaration-before.js.map +1 -0
- package/dist/check/tenancy/declaration-of.d.ts +1 -5
- package/dist/check/tenancy/declaration-of.d.ts.map +1 -1
- package/dist/check/tenancy/declaration-of.js +3 -8
- package/dist/check/tenancy/declaration-of.js.map +1 -1
- package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/drizzle-unscoped.js +16 -3
- package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
- package/dist/check/tenancy/enclosed-by.d.ts +3 -0
- package/dist/check/tenancy/enclosed-by.d.ts.map +1 -0
- package/dist/check/tenancy/enclosed-by.js +6 -0
- package/dist/check/tenancy/enclosed-by.js.map +1 -0
- package/dist/check/tenancy/end-of-enclosing.d.ts +7 -0
- package/dist/check/tenancy/end-of-enclosing.d.ts.map +1 -0
- package/dist/check/tenancy/end-of-enclosing.js +18 -0
- package/dist/check/tenancy/end-of-enclosing.js.map +1 -0
- package/dist/check/tenancy/holds-condition.d.ts +14 -0
- package/dist/check/tenancy/holds-condition.d.ts.map +1 -0
- package/dist/check/tenancy/holds-condition.js +26 -0
- package/dist/check/tenancy/holds-condition.js.map +1 -0
- package/dist/check/tenancy/is-conjunct.d.ts +8 -0
- package/dist/check/tenancy/is-conjunct.d.ts.map +1 -0
- package/dist/check/tenancy/is-conjunct.js +17 -0
- package/dist/check/tenancy/is-conjunct.js.map +1 -0
- package/dist/check/tenancy/is-or-link.d.ts +4 -0
- package/dist/check/tenancy/is-or-link.d.ts.map +1 -0
- package/dist/check/tenancy/is-or-link.js +7 -0
- package/dist/check/tenancy/is-or-link.js.map +1 -0
- package/dist/check/tenancy/knex-links-outside-condition.d.ts +11 -0
- package/dist/check/tenancy/knex-links-outside-condition.d.ts.map +1 -0
- package/dist/check/tenancy/knex-links-outside-condition.js +108 -0
- package/dist/check/tenancy/knex-links-outside-condition.js.map +1 -0
- package/dist/check/tenancy/knex-unscoped.d.ts +3 -1
- package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/knex-unscoped.js +12 -2
- package/dist/check/tenancy/knex-unscoped.js.map +1 -1
- package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/prisma-unscoped.js +15 -10
- package/dist/check/tenancy/prisma-unscoped.js.map +1 -1
- package/dist/check/tenancy/spreads-at-top.d.ts +9 -0
- package/dist/check/tenancy/spreads-at-top.d.ts.map +1 -0
- package/dist/check/tenancy/spreads-at-top.js +49 -0
- package/dist/check/tenancy/spreads-at-top.js.map +1 -0
- package/dist/check/tenancy/top-level-parts.d.ts +3 -0
- package/dist/check/tenancy/top-level-parts.d.ts.map +1 -0
- package/dist/check/tenancy/top-level-parts.js +13 -0
- package/dist/check/tenancy/top-level-parts.js.map +1 -0
- package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -1
- package/dist/check/tenancy/typeorm-unscoped.js +30 -16
- package/dist/check/tenancy/typeorm-unscoped.js.map +1 -1
- package/dist/check/tenancy/unconfined-where.d.ts +11 -0
- package/dist/check/tenancy/unconfined-where.d.ts.map +1 -0
- package/dist/check/tenancy/unconfined-where.js +18 -0
- package/dist/check/tenancy/unconfined-where.js.map +1 -0
- package/dist/check/text/closing-bracket.d.ts +6 -0
- package/dist/check/text/closing-bracket.d.ts.map +1 -0
- package/dist/check/text/closing-bracket.js +24 -0
- package/dist/check/text/closing-bracket.js.map +1 -0
- package/dist/commands/depcruise-config.d.ts.map +1 -1
- package/dist/commands/depcruise-config.js +4 -0
- package/dist/commands/depcruise-config.js.map +1 -1
- package/dist/commands/drizzle-generate.d.ts +3 -2
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +14 -6
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +3 -2
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/knex-generate.d.ts +10 -0
- package/dist/commands/knex-generate.d.ts.map +1 -0
- package/dist/commands/knex-generate.js +74 -0
- package/dist/commands/knex-generate.js.map +1 -0
- package/dist/commands/lint.js +15 -0
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/move-to-module.d.ts.map +1 -1
- package/dist/commands/move-to-module.js +3 -0
- package/dist/commands/move-to-module.js.map +1 -1
- package/dist/commands/mutation.js +1 -1
- package/dist/commands/mutation.js.map +1 -1
- package/dist/commands/parse-migration-arguments.d.ts +11 -0
- package/dist/commands/parse-migration-arguments.d.ts.map +1 -0
- package/dist/commands/parse-migration-arguments.js +17 -0
- package/dist/commands/parse-migration-arguments.js.map +1 -0
- package/dist/commands/prisma-generate.d.ts.map +1 -1
- package/dist/commands/prisma-generate.js +5 -11
- package/dist/commands/prisma-generate.js.map +1 -1
- package/dist/commands/typeorm-generate.d.ts +2 -1
- package/dist/commands/typeorm-generate.d.ts.map +1 -1
- package/dist/commands/typeorm-generate.js +5 -2
- package/dist/commands/typeorm-generate.js.map +1 -1
- package/dist/config/read-config.d.ts.map +1 -1
- package/dist/config/read-config.js +20 -0
- package/dist/config/read-config.js.map +1 -1
- package/dist/declared/render-declarations.js +1 -3
- package/dist/declared/render-declarations.js.map +1 -1
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +18 -2
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/schema-class-of.js +8 -1
- package/dist/describe/schema-class-of.js.map +1 -1
- package/dist/digest/tree-at.d.ts.map +1 -1
- package/dist/digest/tree-at.js +2 -0
- package/dist/digest/tree-at.js.map +1 -1
- package/dist/docs/context-sections.js +3 -7
- package/dist/docs/context-sections.js.map +1 -1
- package/dist/docs/personal-event-lines.d.ts +7 -0
- package/dist/docs/personal-event-lines.d.ts.map +1 -0
- package/dist/docs/personal-event-lines.js +34 -0
- package/dist/docs/personal-event-lines.js.map +1 -0
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +2 -0
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/docs/write-personal-events.d.ts +11 -0
- package/dist/docs/write-personal-events.d.ts.map +1 -0
- package/dist/docs/write-personal-events.js +28 -0
- package/dist/docs/write-personal-events.js.map +1 -0
- package/dist/doctor/permission-findings.d.ts.map +1 -1
- package/dist/doctor/permission-findings.js +68 -4
- package/dist/doctor/permission-findings.js.map +1 -1
- package/dist/generate/concept-role.d.ts +10 -0
- package/dist/generate/concept-role.d.ts.map +1 -1
- package/dist/generate/concept.d.ts.map +1 -1
- package/dist/generate/concept.js +5 -1
- package/dist/generate/concept.js.map +1 -1
- package/dist/generate/emit.d.ts +5 -2
- package/dist/generate/emit.d.ts.map +1 -1
- package/dist/generate/emit.js +5 -4
- package/dist/generate/emit.js.map +1 -1
- package/dist/generate/event-names.d.ts.map +1 -1
- package/dist/generate/event-names.js.map +1 -1
- package/dist/generate/files-without-modules.d.ts +8 -0
- package/dist/generate/files-without-modules.d.ts.map +1 -0
- package/dist/generate/files-without-modules.js +12 -0
- package/dist/generate/files-without-modules.js.map +1 -0
- package/dist/generate/grant-permission.js +2 -2
- package/dist/generate/grant-permission.js.map +1 -1
- package/dist/generate/kinds/aggregate-kind.js +4 -4
- package/dist/generate/kinds/aggregate-kind.js.map +1 -1
- package/dist/generate/kinds/assert-event-store.d.ts +5 -1
- package/dist/generate/kinds/assert-event-store.d.ts.map +1 -1
- package/dist/generate/kinds/assert-event-store.js +11 -5
- package/dist/generate/kinds/assert-event-store.js.map +1 -1
- package/dist/generate/kinds/background/background-job-vars.js +4 -2
- package/dist/generate/kinds/background/background-job-vars.js.map +1 -1
- package/dist/generate/kinds/command-kind.d.ts.map +1 -1
- package/dist/generate/kinds/command-kind.js +6 -1
- package/dist/generate/kinds/command-kind.js.map +1 -1
- package/dist/generate/kinds/declare-storage.d.ts.map +1 -1
- package/dist/generate/kinds/declare-storage.js +4 -10
- package/dist/generate/kinds/declare-storage.js.map +1 -1
- package/dist/generate/kinds/domain-event-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-event-kind.js +3 -1
- package/dist/generate/kinds/domain-event-kind.js.map +1 -1
- package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e-kind.js +8 -1
- package/dist/generate/kinds/e2e-kind.js.map +1 -1
- package/dist/generate/kinds/ensure-domain-event.d.ts.map +1 -1
- package/dist/generate/kinds/ensure-domain-event.js +2 -0
- package/dist/generate/kinds/ensure-domain-event.js.map +1 -1
- package/dist/generate/kinds/extraction/add-compose-service.js +1 -1
- package/dist/generate/kinds/extraction/add-compose-service.js.map +1 -1
- package/dist/generate/kinds/extraction/compose-service-of.d.ts +5 -0
- package/dist/generate/kinds/extraction/compose-service-of.d.ts.map +1 -0
- package/dist/generate/kinds/extraction/compose-service-of.js +8 -0
- package/dist/generate/kinds/extraction/compose-service-of.js.map +1 -0
- package/dist/generate/kinds/gateway-kind.js +9 -0
- package/dist/generate/kinds/gateway-kind.js.map +1 -1
- package/dist/generate/kinds/generate-context.d.ts.map +1 -1
- package/dist/generate/kinds/generate-context.js +36 -0
- package/dist/generate/kinds/generate-context.js.map +1 -1
- package/dist/generate/kinds/generate-event-sourced-repository.js +8 -1
- package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -1
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +13 -0
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/query-kind.d.ts.map +1 -1
- package/dist/generate/kinds/query-kind.js +24 -2
- package/dist/generate/kinds/query-kind.js.map +1 -1
- package/dist/generate/kinds/route/controller-vars.js +1 -1
- package/dist/generate/kinds/route/controller-vars.js.map +1 -1
- package/dist/generate/kinds/route/find-use-case.js +1 -1
- package/dist/generate/kinds/route/find-use-case.js.map +1 -1
- package/dist/generate/kinds/route/message-call.d.ts +6 -2
- package/dist/generate/kinds/route/message-call.d.ts.map +1 -1
- package/dist/generate/kinds/route/message-call.js +2 -1
- package/dist/generate/kinds/route/message-call.js.map +1 -1
- package/dist/generate/kinds/route/standard-schema-of.d.ts +2 -1
- package/dist/generate/kinds/route/standard-schema-of.d.ts.map +1 -1
- package/dist/generate/kinds/route/standard-schema-of.js +2 -4
- package/dist/generate/kinds/route/standard-schema-of.js.map +1 -1
- package/dist/generate/kinds/service-kind.d.ts.map +1 -1
- package/dist/generate/kinds/service-kind.js +4 -3
- package/dist/generate/kinds/service-kind.js.map +1 -1
- package/dist/generate/kinds/tables-files.d.ts +3 -0
- package/dist/generate/kinds/tables-files.d.ts.map +1 -0
- package/dist/generate/kinds/tables-files.js +7 -0
- package/dist/generate/kinds/tables-files.js.map +1 -0
- package/dist/generate/kinds/worker-kind.d.ts.map +1 -1
- package/dist/generate/kinds/worker-kind.js +12 -0
- package/dist/generate/kinds/worker-kind.js.map +1 -1
- package/dist/generate/kinds/write-birth.d.ts +8 -0
- package/dist/generate/kinds/write-birth.d.ts.map +1 -0
- package/dist/generate/kinds/write-birth.js +13 -0
- package/dist/generate/kinds/write-birth.js.map +1 -0
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.js +8 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
- package/dist/generate/mark-policy-questions.js +2 -2
- package/dist/generate/mark-policy-questions.js.map +1 -1
- package/dist/generate/permission-name.d.ts +3 -0
- package/dist/generate/permission-name.d.ts.map +1 -0
- package/dist/generate/permission-name.js +3 -0
- package/dist/generate/permission-name.js.map +1 -0
- package/dist/generate/permission-named.d.ts.map +1 -1
- package/dist/generate/permission-named.js +1 -1
- package/dist/generate/permission-named.js.map +1 -1
- package/dist/generate/permission-words.d.ts +7 -0
- package/dist/generate/permission-words.d.ts.map +1 -0
- package/dist/generate/permission-words.js +11 -0
- package/dist/generate/permission-words.js.map +1 -0
- package/dist/generate/refined-by-policy.js +2 -2
- package/dist/generate/refined-by-policy.js.map +1 -1
- package/dist/generate/refuse-stuttering-event.d.ts +8 -0
- package/dist/generate/refuse-stuttering-event.d.ts.map +1 -0
- package/dist/generate/refuse-stuttering-event.js +14 -0
- package/dist/generate/refuse-stuttering-event.js.map +1 -0
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +1 -0
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/generate/spoken-in-language.d.ts +11 -2
- package/dist/generate/spoken-in-language.d.ts.map +1 -1
- package/dist/generate/spoken-in-language.js +27 -12
- package/dist/generate/spoken-in-language.js.map +1 -1
- package/dist/generator-lock/unreadable-lock-refusal.d.ts +4 -0
- package/dist/generator-lock/unreadable-lock-refusal.d.ts.map +1 -0
- package/dist/generator-lock/unreadable-lock-refusal.js +7 -0
- package/dist/generator-lock/unreadable-lock-refusal.js.map +1 -0
- package/dist/generator-lock/with-generator-lock.d.ts.map +1 -1
- package/dist/generator-lock/with-generator-lock.js +8 -7
- package/dist/generator-lock/with-generator-lock.js.map +1 -1
- package/dist/help/flag-notes.d.ts.map +1 -1
- package/dist/help/flag-notes.js +5 -1
- package/dist/help/flag-notes.js.map +1 -1
- package/dist/help/tool-notes.d.ts.map +1 -1
- package/dist/help/tool-notes.js +16 -0
- package/dist/help/tool-notes.js.map +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +1 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/agent-permissions.d.ts.map +1 -1
- package/dist/init/agent-permissions.js +18 -3
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/audit-files.d.ts.map +1 -1
- package/dist/init/files/audit-files.js +1 -0
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +2 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/platform-files.d.ts.map +1 -1
- package/dist/init/files/platform-files.js +14 -0
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/files/privacy-files.d.ts +2 -2
- package/dist/init/files/privacy-files.d.ts.map +1 -1
- package/dist/init/files/privacy-files.js +3 -2
- package/dist/init/files/privacy-files.js.map +1 -1
- package/dist/init/files/script-files.d.ts +4 -1
- package/dist/init/files/script-files.d.ts.map +1 -1
- package/dist/init/files/script-files.js +6 -1
- package/dist/init/files/script-files.js.map +1 -1
- package/dist/init/is-team-file.d.ts +2 -2
- package/dist/init/is-team-file.d.ts.map +1 -1
- package/dist/init/is-team-file.js +5 -3
- package/dist/init/is-team-file.js.map +1 -1
- package/dist/init/keep-regions.d.ts +21 -0
- package/dist/init/keep-regions.d.ts.map +1 -0
- package/dist/init/keep-regions.js +63 -0
- package/dist/init/keep-regions.js.map +1 -0
- package/dist/init/kept-combination-notes.d.ts.map +1 -1
- package/dist/init/kept-combination-notes.js +6 -2
- package/dist/init/kept-combination-notes.js.map +1 -1
- package/dist/init/kept-compose-services.d.ts +6 -0
- package/dist/init/kept-compose-services.d.ts.map +1 -0
- package/dist/init/kept-compose-services.js +42 -0
- package/dist/init/kept-compose-services.js.map +1 -0
- package/dist/init/kept-role-vocabulary.d.ts +3 -0
- package/dist/init/kept-role-vocabulary.d.ts.map +1 -0
- package/dist/init/kept-role-vocabulary.js +7 -0
- package/dist/init/kept-role-vocabulary.js.map +1 -0
- package/dist/init/kept-roles.d.ts +12 -0
- package/dist/init/kept-roles.d.ts.map +1 -0
- package/dist/init/kept-roles.js +29 -0
- package/dist/init/kept-roles.js.map +1 -0
- package/dist/init/kept-wiring.d.ts +22 -0
- package/dist/init/kept-wiring.d.ts.map +1 -0
- package/dist/init/kept-wiring.js +91 -0
- package/dist/init/kept-wiring.js.map +1 -0
- package/dist/init/knip-vars.d.ts.map +1 -1
- package/dist/init/knip-vars.js +5 -1
- 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 +5 -3
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/scripts-for.d.ts.map +1 -1
- package/dist/init/manifest/scripts-for.js +8 -0
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/orphaned-wiring-notes.d.ts +13 -0
- package/dist/init/orphaned-wiring-notes.d.ts.map +1 -0
- package/dist/init/orphaned-wiring-notes.js +42 -0
- package/dist/init/orphaned-wiring-notes.js.map +1 -0
- package/dist/init/profile-hooks.js +1 -1
- package/dist/init/profile-hooks.js.map +1 -1
- package/dist/init/repositories-left-behind.d.ts +12 -0
- package/dist/init/repositories-left-behind.d.ts.map +1 -0
- package/dist/init/repositories-left-behind.js +26 -0
- package/dist/init/repositories-left-behind.js.map +1 -0
- package/dist/init/rewire-audited-events.d.ts +10 -0
- package/dist/init/rewire-audited-events.d.ts.map +1 -0
- package/dist/init/rewire-audited-events.js +32 -0
- package/dist/init/rewire-audited-events.js.map +1 -0
- package/dist/init/rewire-contexts.d.ts +15 -0
- package/dist/init/rewire-contexts.d.ts.map +1 -0
- package/dist/init/rewire-contexts.js +41 -0
- package/dist/init/rewire-contexts.js.map +1 -0
- package/dist/init/rewire-preset.d.ts +9 -0
- package/dist/init/rewire-preset.d.ts.map +1 -0
- package/dist/init/rewire-preset.js +29 -0
- package/dist/init/rewire-preset.js.map +1 -0
- package/dist/init/rewire-tables.d.ts +10 -0
- package/dist/init/rewire-tables.d.ts.map +1 -0
- package/dist/init/rewire-tables.js +54 -0
- package/dist/init/rewire-tables.js.map +1 -0
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +28 -28
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/kept-flag-notes.d.ts +7 -0
- package/dist/init/stack/kept-flag-notes.d.ts.map +1 -0
- package/dist/init/stack/kept-flag-notes.js +24 -0
- package/dist/init/stack/kept-flag-notes.js.map +1 -0
- package/dist/init/stack/refuse-unused-no-outbox.d.ts +4 -0
- package/dist/init/stack/refuse-unused-no-outbox.d.ts.map +1 -0
- package/dist/init/stack/refuse-unused-no-outbox.js +9 -0
- package/dist/init/stack/refuse-unused-no-outbox.js.map +1 -0
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +10 -0
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack-before.d.ts +4 -0
- package/dist/init/stack-before.d.ts.map +1 -0
- package/dist/init/stack-before.js +11 -0
- package/dist/init/stack-before.js.map +1 -0
- package/dist/init/wiring-notes.d.ts +9 -0
- package/dist/init/wiring-notes.d.ts.map +1 -0
- package/dist/init/wiring-notes.js +22 -0
- package/dist/init/wiring-notes.js.map +1 -0
- package/dist/init/with-named-imports.d.ts +8 -0
- package/dist/init/with-named-imports.d.ts.map +1 -0
- package/dist/init/with-named-imports.js +69 -0
- package/dist/init/with-named-imports.js.map +1 -0
- package/dist/init/with-system-grants.d.ts +7 -0
- package/dist/init/with-system-grants.d.ts.map +1 -0
- package/dist/init/with-system-grants.js +26 -0
- package/dist/init/with-system-grants.js.map +1 -0
- package/dist/init/write-local-environment.d.ts +8 -0
- package/dist/init/write-local-environment.d.ts.map +1 -0
- package/dist/init/write-local-environment.js +18 -0
- package/dist/init/write-local-environment.js.map +1 -0
- package/dist/lint/eslint-in-project.d.ts +1 -1
- package/dist/lint/eslint-in-project.d.ts.map +1 -1
- package/dist/lint/eslint-in-project.js +11 -2
- package/dist/lint/eslint-in-project.js.map +1 -1
- package/dist/markers/index.d.ts +3 -0
- package/dist/markers/index.d.ts.map +1 -1
- package/dist/markers/index.js +3 -0
- package/dist/markers/index.js.map +1 -1
- package/dist/markers/region-marker.d.ts +3 -0
- package/dist/markers/region-marker.d.ts.map +1 -0
- package/dist/markers/region-marker.js +3 -0
- package/dist/markers/region-marker.js.map +1 -0
- package/dist/markers/regions-of.d.ts +9 -0
- package/dist/markers/regions-of.d.ts.map +1 -0
- package/dist/markers/regions-of.js +20 -0
- package/dist/markers/regions-of.js.map +1 -0
- package/dist/markers/unpaired-markers.d.ts +3 -0
- package/dist/markers/unpaired-markers.d.ts.map +1 -0
- package/dist/markers/unpaired-markers.js +13 -0
- package/dist/markers/unpaired-markers.js.map +1 -0
- package/dist/measures/timeline-of.js +1 -0
- package/dist/measures/timeline-of.js.map +1 -1
- package/dist/merge/apply-resolutions.d.ts.map +1 -1
- package/dist/merge/apply-resolutions.js +6 -4
- package/dist/merge/apply-resolutions.js.map +1 -1
- package/dist/merge/continue-merge.d.ts.map +1 -1
- package/dist/merge/continue-merge.js +1 -0
- package/dist/merge/continue-merge.js.map +1 -1
- package/dist/merge/ensure-mergeable.js +1 -1
- package/dist/merge/ensure-mergeable.js.map +1 -1
- package/dist/merge/lost/verify-merges.d.ts.map +1 -1
- package/dist/merge/lost/verify-merges.js +4 -0
- package/dist/merge/lost/verify-merges.js.map +1 -1
- package/dist/merge/merge-state.d.ts.map +1 -1
- package/dist/merge/merge-state.js +2 -2
- package/dist/merge/merge-state.js.map +1 -1
- package/dist/merge/merge-trunk.d.ts.map +1 -1
- package/dist/merge/merge-trunk.js +4 -0
- package/dist/merge/merge-trunk.js.map +1 -1
- package/dist/merge/refuse-shallow-history.d.ts +10 -0
- package/dist/merge/refuse-shallow-history.d.ts.map +1 -0
- package/dist/merge/refuse-shallow-history.js +15 -0
- package/dist/merge/refuse-shallow-history.js.map +1 -0
- package/dist/merge/resume-merge.js +2 -2
- package/dist/merge/resume-merge.js.map +1 -1
- package/dist/merge/settle-regions.d.ts.map +1 -1
- package/dist/merge/settle-regions.js +3 -4
- package/dist/merge/settle-regions.js.map +1 -1
- package/dist/migration/audit-guard/append-audit-guard.d.ts +4 -2
- package/dist/migration/audit-guard/append-audit-guard.d.ts.map +1 -1
- package/dist/migration/audit-guard/append-audit-guard.js +18 -3
- package/dist/migration/audit-guard/append-audit-guard.js.map +1 -1
- package/dist/migration/declared-tables.d.ts +8 -0
- package/dist/migration/declared-tables.d.ts.map +1 -0
- package/dist/migration/declared-tables.js +13 -0
- package/dist/migration/declared-tables.js.map +1 -0
- package/dist/migration/find-project-formatter.d.ts.map +1 -1
- package/dist/migration/find-project-formatter.js +2 -1
- package/dist/migration/find-project-formatter.js.map +1 -1
- package/dist/migration/index.d.ts +8 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +8 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/knex-migration-text.d.ts +4 -0
- package/dist/migration/knex-migration-text.d.ts.map +1 -0
- package/dist/migration/knex-migration-text.js +24 -0
- package/dist/migration/knex-migration-text.js.map +1 -0
- package/dist/migration/knex-schema-difference.d.ts +12 -0
- package/dist/migration/knex-schema-difference.d.ts.map +1 -0
- package/dist/migration/knex-schema-difference.js +165 -0
- package/dist/migration/knex-schema-difference.js.map +1 -0
- package/dist/migration/listed-in-index.d.ts +6 -0
- package/dist/migration/listed-in-index.d.ts.map +1 -0
- package/dist/migration/listed-in-index.js +8 -0
- package/dist/migration/listed-in-index.js.map +1 -0
- package/dist/migration/refuse-other-orm.d.ts +8 -0
- package/dist/migration/refuse-other-orm.d.ts.map +1 -0
- package/dist/migration/refuse-other-orm.js +34 -0
- package/dist/migration/refuse-other-orm.js.map +1 -0
- package/dist/migration/required-migration-name.d.ts +3 -0
- package/dist/migration/required-migration-name.d.ts.map +1 -0
- package/dist/migration/required-migration-name.js +11 -0
- package/dist/migration/required-migration-name.js.map +1 -0
- package/dist/migration/warn-dropped-context-tables.d.ts +12 -0
- package/dist/migration/warn-dropped-context-tables.d.ts.map +1 -0
- package/dist/migration/warn-dropped-context-tables.js +88 -0
- package/dist/migration/warn-dropped-context-tables.js.map +1 -0
- package/dist/package-manager/dialects.js +1 -1
- package/dist/package-manager/dialects.js.map +1 -1
- package/dist/package-manager/in-project-dialect.d.ts +8 -0
- package/dist/package-manager/in-project-dialect.d.ts.map +1 -0
- package/dist/package-manager/in-project-dialect.js +22 -0
- package/dist/package-manager/in-project-dialect.js.map +1 -0
- package/dist/presets/adapter-of.d.ts +5 -0
- package/dist/presets/adapter-of.d.ts.map +1 -0
- package/dist/presets/adapter-of.js +6 -0
- package/dist/presets/adapter-of.js.map +1 -0
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +1 -5
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/grant-to-signed-in.d.ts.map +1 -1
- package/dist/presets/grant-to-signed-in.js +1 -24
- package/dist/presets/grant-to-signed-in.js.map +1 -1
- package/dist/presets/identity-terms.d.ts.map +1 -1
- package/dist/presets/identity-terms.js +4 -0
- package/dist/presets/identity-terms.js.map +1 -1
- package/dist/presets/lay-out-prisma-models.js +1 -19
- package/dist/presets/lay-out-prisma-models.js.map +1 -1
- package/dist/presets/organisations-as-tenants.d.ts +2 -2
- package/dist/presets/organisations-as-tenants.d.ts.map +1 -1
- package/dist/presets/organisations-as-tenants.js +46 -2
- package/dist/presets/organisations-as-tenants.js.map +1 -1
- package/dist/presets/preset-named.d.ts +2 -0
- package/dist/presets/preset-named.d.ts.map +1 -1
- package/dist/presets/preset-named.js +1 -1
- package/dist/presets/preset-named.js.map +1 -1
- package/dist/presets/wrap-authorizer.d.ts +4 -0
- package/dist/presets/wrap-authorizer.d.ts.map +1 -0
- package/dist/presets/wrap-authorizer.js +25 -0
- package/dist/presets/wrap-authorizer.js.map +1 -0
- package/dist/prisma-schema/datasource-schemas.d.ts +3 -0
- package/dist/prisma-schema/datasource-schemas.d.ts.map +1 -0
- package/dist/prisma-schema/datasource-schemas.js +5 -0
- package/dist/prisma-schema/datasource-schemas.js.map +1 -0
- package/dist/prisma-schema/index.d.ts +4 -0
- package/dist/prisma-schema/index.d.ts.map +1 -1
- package/dist/prisma-schema/index.js +4 -0
- package/dist/prisma-schema/index.js.map +1 -1
- package/dist/prisma-schema/preview-features-of.d.ts +3 -0
- package/dist/prisma-schema/preview-features-of.d.ts.map +1 -0
- package/dist/prisma-schema/preview-features-of.js +7 -0
- package/dist/prisma-schema/preview-features-of.js.map +1 -0
- package/dist/prisma-schema/with-datasource-schema.d.ts +3 -0
- package/dist/prisma-schema/with-datasource-schema.d.ts.map +1 -0
- package/dist/prisma-schema/with-datasource-schema.js +9 -0
- package/dist/prisma-schema/with-datasource-schema.js.map +1 -0
- package/dist/prisma-schema/with-preview-feature.d.ts +3 -0
- package/dist/prisma-schema/with-preview-feature.d.ts.map +1 -0
- package/dist/prisma-schema/with-preview-feature.js +19 -0
- package/dist/prisma-schema/with-preview-feature.js.map +1 -0
- package/dist/progress/format-progress.js +1 -0
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +10 -1
- package/dist/run.js.map +1 -1
- package/dist/sdk/planned-clients.d.ts +2 -2
- package/dist/sdk/planned-clients.d.ts.map +1 -1
- package/dist/sdk/planned-clients.js +2 -6
- package/dist/sdk/planned-clients.js.map +1 -1
- package/dist/sdk/render-client.js +1 -1
- package/dist/sdk/render-client.js.map +1 -1
- package/dist/sdk/set-up-sdk.d.ts.map +1 -1
- package/dist/sdk/set-up-sdk.js +3 -2
- package/dist/sdk/set-up-sdk.js.map +1 -1
- package/dist/slice/record-verification.d.ts.map +1 -1
- package/dist/slice/record-verification.js +2 -5
- package/dist/slice/record-verification.js.map +1 -1
- package/dist/stack/stack-vars.js +16 -3
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/stories/forecast-merge.js +1 -0
- package/dist/stories/forecast-merge.js.map +1 -1
- package/dist/stories/open-story-scope.d.ts.map +1 -1
- package/dist/stories/open-story-scope.js +2 -4
- package/dist/stories/open-story-scope.js.map +1 -1
- package/dist/story/change-gated.d.ts +3 -3
- package/dist/story/change-gated.d.ts.map +1 -1
- package/dist/story/change-gated.js +13 -7
- package/dist/story/change-gated.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/format-resume.d.ts.map +1 -1
- package/dist/worker/format-resume.js +5 -0
- package/dist/worker/format-resume.js.map +1 -1
- package/dist/worker/format-workers.js +5 -0
- package/dist/worker/format-workers.js.map +1 -1
- package/dist/worker/open-worker-scope.d.ts.map +1 -1
- package/dist/worker/open-worker-scope.js +2 -3
- package/dist/worker/open-worker-scope.js.map +1 -1
- package/dist/worker/progress-of.d.ts +8 -3
- package/dist/worker/progress-of.d.ts.map +1 -1
- package/dist/worker/progress-of.js +2 -16
- package/dist/worker/progress-of.js.map +1 -1
- package/dist/worker/read-agent-record.d.ts.map +1 -1
- package/dist/worker/read-agent-record.js +15 -3
- package/dist/worker/read-agent-record.js.map +1 -1
- package/dist/worker/read-workers.js +2 -2
- package/dist/worker/read-workers.js.map +1 -1
- package/dist/worker/readable-progress.d.ts +5 -0
- package/dist/worker/readable-progress.d.ts.map +1 -0
- package/dist/worker/readable-progress.js +16 -0
- package/dist/worker/readable-progress.js.map +1 -0
- package/dist/worker/resume-worker.d.ts.map +1 -1
- package/dist/worker/resume-worker.js +4 -5
- package/dist/worker/resume-worker.js.map +1 -1
- package/dist/worker/worker-progress.d.ts +2 -1
- package/dist/worker/worker-progress.d.ts.map +1 -1
- package/dist/workspace/real-path-of.d.ts +2 -2
- package/dist/workspace/real-path-of.d.ts.map +1 -1
- package/dist/workspace/real-path-of.js +15 -10
- package/dist/workspace/real-path-of.js.map +1 -1
- package/dist/workspace/write-inside-project.d.ts +8 -0
- package/dist/workspace/write-inside-project.d.ts.map +1 -0
- package/dist/workspace/write-inside-project.js +17 -0
- package/dist/workspace/write-inside-project.js.map +1 -0
- package/package.json +5 -5
- package/templates/aggregate/event-sourced.events.mapper.ts.tpl +5 -1
- package/templates/command/handler.declared.ts.tpl +4 -12
- package/templates/command/handler.ts.tpl +4 -12
- package/templates/docs/privacy-register.md.tpl +2 -0
- package/templates/e2e/e2e.spec.ts.tpl +2 -2
- package/templates/init/README.md.tpl +42 -9
- package/templates/init/docker/docker-compose.yml.tpl +5 -2
- package/templates/init/docker/dockerignore.tpl +1 -0
- package/templates/init/docker/env.example.tpl +16 -1
- package/templates/init/gitignore.tpl +1 -0
- package/templates/init/hooks/change-reference.mjs +96 -17
- package/templates/init/hooks/production-gate.mjs +65 -11
- package/templates/init/jest.config.js.tpl +4 -1
- package/templates/init/main.ts.tpl +3 -0
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +25 -8
- package/templates/init/platform/audit/create-audit-trail.ts.tpl +59 -0
- package/templates/init/platform/audit/create-audit.ts.tpl +13 -52
- package/templates/init/platform/auth/authentication/development-header-authenticator.ts.tpl +7 -3
- package/templates/init/platform/auth/relationships/relationship-schema.ts.tpl +5 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +58 -7
- package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +9 -4
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
- package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
- package/templates/init/platform/composition/platform-options.manual.ts.tpl +7 -0
- package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
- package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +7 -0
- package/templates/init/platform/config/app-config.ts.tpl +16 -0
- package/templates/init/platform/config/load-config.ts.tpl +46 -0
- package/templates/init/platform/database/data-source.typeorm.ts.tpl +6 -0
- package/templates/init/platform/database/gitkeep +0 -0
- package/templates/init/platform/database/knexfile.js.tpl +10 -3
- package/templates/init/platform/database/open-persistence.prisma.ts.tpl +5 -2
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +11 -3
- package/templates/init/platform/database/persistence.contract.spec.ts.tpl +14 -3
- package/templates/init/platform/database/prisma.config.ts.tpl +6 -0
- package/templates/init/platform/database/schema.knex.ts.tpl +4 -3
- package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +5 -1
- package/templates/init/platform/http/start-http-server.express.ts.tpl +9 -6
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +5 -2
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +5 -2
- package/templates/init/platform/jobs/create-background-work.ts.tpl +12 -0
- package/templates/init/platform/jobs/days-before.ts.tpl +8 -0
- package/templates/init/platform/jobs/housekeeping.module.tsyringe.ts.tpl +46 -0
- package/templates/init/platform/jobs/housekeeping.ts.tpl +24 -0
- package/templates/init/platform/jobs/job-settings.ts.tpl +9 -0
- package/templates/init/platform/privacy/personal-events.ts.tpl +11 -0
- package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +69 -19
- package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +69 -8
- package/templates/init/platform/privacy/run-export.manual.ts.tpl +26 -4
- package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +34 -3
- package/templates/init/platform/privacy/run-purge.manual.ts.tpl +3 -2
- package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +4 -2
- package/templates/init/rules/infrastructure.md.tpl +1 -1
- package/templates/init/scripts/audit-verify.ts.tpl +35 -0
- package/templates/init/scripts/privacy-erase.manual.ts.tpl +52 -7
- package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +52 -7
- package/templates/init/scripts/privacy-export.manual.ts.tpl +5 -7
- package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +5 -7
- package/templates/init/scripts/privacy-purge.manual.ts.tpl +4 -0
- package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +4 -0
- package/templates/pipeline/github/dependabot.yml +6 -0
- package/templates/pipeline/github/workflows/ci.yml.tpl +26 -1
- package/templates/pipeline/github/workflows/claude-review.yml +3 -2
- package/templates/pipeline/github/workflows/claude-triage.yml +1 -1
- package/templates/pipeline/github/workflows/codeql.yml +2 -0
- package/templates/pipeline/github/workflows/copilot-setup-steps.yml +2 -0
- package/templates/pipeline/github/workflows/intent-to-spec.yml +12 -4
- package/templates/pipeline/github/workflows/pr-title.yml +2 -0
- package/templates/pipeline/gitlab/claude-review.gitlab-ci.yml.tpl +1 -1
- package/templates/pipeline/knip.json.tpl +1 -4
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/pipeline/renovate.json +11 -0
- package/templates/pipeline/stryker.config.mjs.tpl +4 -0
- package/templates/pipeline/vitest.config.ts.tpl +3 -2
- package/templates/presets/identity/context/__context__.codes.named.ts.tpl +1 -0
- package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +28 -1
- package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +13 -1
- package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +6 -1
- package/templates/presets/identity/context/domain/errors/invitation-withdrawn.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation.error.factories.ts.tpl +8 -0
- package/templates/presets/identity/context/domain/services/role-rights.service.ts.tpl +23 -1
- package/templates/presets/identity/context/infrastructure/persistence/__context__.schema.drizzle.ts.tpl +1 -0
- package/templates/presets/identity/context/infrastructure/persistence/create-__context__-tables.schema.knex.ts.tpl +1 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +6 -2
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +6 -2
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +6 -2
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +6 -2
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +6 -2
- package/templates/presets/identity/context/infrastructure/persistence/invitation-row.schema.knex.ts.tpl +1 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.drizzle.ts.tpl +2 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.knex.ts.tpl +2 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.prisma.ts.tpl +2 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-account.repository.prisma.ts.tpl +8 -5
- package/templates/presets/identity/context/infrastructure/persistence/prisma-delegation.repository.prisma.ts.tpl +8 -5
- package/templates/presets/identity/context/infrastructure/persistence/prisma-invitation.repository.prisma.ts.tpl +8 -5
- package/templates/presets/identity/context/infrastructure/persistence/prisma-member.repository.prisma.ts.tpl +8 -5
- package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation.repository.prisma.ts.tpl +8 -5
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.kit-routes.ts.tpl +1 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.nest-routes.ts.tpl +1 -0
- package/templates/presets/identity/context/test/builders/invitation.builder.ts.tpl +15 -2
- package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +10 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.handler.spec.ts.tpl +114 -4
- package/templates/presets/identity/context/test/worlds/__context__.world.explicit.ts.tpl +1 -1
- package/templates/presets/identity/design.md.tpl +3 -1
- package/templates/presets/identity/prisma/models.prisma.tpl +1 -0
- package/templates/query/reader.fake.ts.tpl +4 -6
- package/templates/query/reader.in-memory.ts.tpl +1 -1
- package/templates/repository/drizzle/repository.ts.tpl +4 -3
- package/templates/repository/knex/table.tpl +1 -1
- package/templates/repository/prisma/repository.ts.tpl +24 -18
- package/templates/state-machine/state-machine.spec.ts.tpl +5 -0
- package/templates/worker/main.ts.tpl +3 -0
- package/templates/init/platform/database/migration.knex.js.tpl +0 -8
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineContextModule, type ContextModule } from '@ddd-ts-kit/di';
|
|
2
|
+
{{#if events.outbox}}
|
|
3
|
+
import { OutboxStore } from '@ddd-ts-kit/events';
|
|
4
|
+
{{/if}}
|
|
5
|
+
import { Clock } from '@ddd-ts-kit/kernel';
|
|
6
|
+
{{#if queue.stored}}
|
|
7
|
+
import { JobStore } from '@ddd-ts-kit/scheduling';
|
|
8
|
+
{{/if}}
|
|
9
|
+
import { daysBefore } from '{{alias.platform}}/jobs/days-before{{alias.ext}}';
|
|
10
|
+
import type { Housekeeping } from '{{alias.platform}}/jobs/housekeeping{{alias.ext}}';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* What the platform is done with, purged every night{{#if events.outbox}}: `events.purge-published` at 03:30 UTC (switched off in
|
|
14
|
+
* one environment with `JOB_EVENTS_PURGE_PUBLISHED_ENABLED=false`){{/if}}{{#if queue.stored}}{{#if events.outbox}},{{/if}}{{#unless events.outbox}}:{{/unless}} `jobs.purge-finished` at 03:45 UTC
|
|
15
|
+
* (`JOB_JOBS_PURGE_FINISHED_ENABLED=false`){{/if}}. A record and a job row keep their payload until then.
|
|
16
|
+
*/
|
|
17
|
+
export function housekeepingModule(
|
|
18
|
+
retention: Housekeeping,
|
|
19
|
+
{ jobs = true }: { readonly jobs?: boolean } = {},
|
|
20
|
+
): ContextModule {
|
|
21
|
+
return defineContextModule({
|
|
22
|
+
name: 'housekeeping',
|
|
23
|
+
register(builder) {
|
|
24
|
+
// Registered by the process that runs the jobs of the platform; a service of the deployment passes `jobs: false`.
|
|
25
|
+
if (!jobs) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
{{#if events.outbox}}
|
|
29
|
+
|
|
30
|
+
builder.job('events.purge-published', { cron: '30 3 * * *', tenancy: 'global' }).handledByFactory((resolve) => ({
|
|
31
|
+
run: async () => {
|
|
32
|
+
await resolve(OutboxStore).purgePublished(daysBefore(resolve(Clock), retention.publishedEventsDays));
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if queue.stored}}
|
|
37
|
+
|
|
38
|
+
builder.job('jobs.purge-finished', { cron: '45 3 * * *', tenancy: 'global' }).handledByFactory((resolve) => ({
|
|
39
|
+
run: async () => {
|
|
40
|
+
await resolve(JobStore).purgeFinished(daysBefore(resolve(Clock), retention.finishedJobsDays));
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
{{/if}}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long the platform keeps what it is done with, in days, read from the environment by
|
|
3
|
+
* `load-config.ts`. A row holds what its payload held: {{#if events.outbox}}`events.purge-published` drops the records of the
|
|
4
|
+
* outbox past that age{{/if}}{{#if events.outbox}}{{#if queue.stored}}, {{/if}}{{/if}}{{#if queue.stored}}`jobs.purge-finished` the jobs that succeeded or were cancelled{{/if}}, every night. What failed for
|
|
5
|
+
* good stays until an operator decides.
|
|
6
|
+
*/
|
|
7
|
+
export interface Housekeeping {
|
|
8
|
+
{{#if events.outbox}}
|
|
9
|
+
readonly publishedEventsDays: number;
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#if queue.stored}}
|
|
12
|
+
readonly finishedJobsDays: number;
|
|
13
|
+
{{/if}}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Left out (the tools, the tests), thirty days of each. */
|
|
17
|
+
export const DEFAULT_HOUSEKEEPING: Housekeeping = {
|
|
18
|
+
{{#if events.outbox}}
|
|
19
|
+
publishedEventsDays: 30,
|
|
20
|
+
{{/if}}
|
|
21
|
+
{{#if queue.stored}}
|
|
22
|
+
finishedJobsDays: 30,
|
|
23
|
+
{{/if}}
|
|
24
|
+
};
|
|
@@ -19,6 +19,9 @@ const extracted: readonly string[] = [
|
|
|
19
19
|
*/
|
|
20
20
|
export function jobSettings(environment: Environment, context?: string): Readonly<Record<string, JobSettings>> {
|
|
21
21
|
const settings: Readonly<Record<string, JobSettings>> = {
|
|
22
|
+
{{#if audit.sql}}
|
|
23
|
+
'audit.verify': { enabled: environment['JOB_AUDIT_VERIFY_ENABLED'] !== 'false' },
|
|
24
|
+
{{/if}}
|
|
22
25
|
{{#if audit.archiveByDefault}}
|
|
23
26
|
'audit.archive': { enabled: environment['JOB_AUDIT_ARCHIVE_ENABLED'] !== 'false' },
|
|
24
27
|
{{/if}}
|
|
@@ -29,6 +32,12 @@ export function jobSettings(environment: Environment, context?: string): Readonl
|
|
|
29
32
|
{{/if}}
|
|
30
33
|
{{#if privacy.on}}
|
|
31
34
|
'privacy.purge-expired': { enabled: environment['JOB_PRIVACY_PURGE_EXPIRED_ENABLED'] !== 'false' },
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if events.outbox}}
|
|
37
|
+
'events.purge-published': { enabled: environment['JOB_EVENTS_PURGE_PUBLISHED_ENABLED'] !== 'false' },
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#if queue.stored}}
|
|
40
|
+
'jobs.purge-finished': { enabled: environment['JOB_JOBS_PURGE_FINISHED_ENABLED'] !== 'false' },
|
|
32
41
|
{{/if}}
|
|
33
42
|
// ddd-ts-kit:jobs
|
|
34
43
|
// /ddd-ts-kit:jobs
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PersonalEvent } from '@ddd-ts-kit/events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The integration events that carry personal data, as the `personal` option of each one declares it:
|
|
5
|
+
* what an erasure looks for in the records of the outbox. Written by `ddd-ts-kit docs`, like the
|
|
6
|
+
* register, and held to the declarations by `docs --check`.
|
|
7
|
+
*/
|
|
8
|
+
export const personalEvents: readonly PersonalEvent[] = [
|
|
9
|
+
// ddd-ts-kit:personal-events
|
|
10
|
+
// /ddd-ts-kit:personal-events
|
|
11
|
+
];
|
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
{{#if
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { auditedPersonalDataErasure } from '@ddd-ts-kit/audit';
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if events.outbox}}
|
|
5
|
+
import { personalEventsInOutbox } from '@ddd-ts-kit/events';
|
|
6
|
+
{{/if}}
|
|
2
7
|
import {
|
|
3
8
|
dataSubjectErasedV1,
|
|
9
|
+
{{#if tenancy.any}}
|
|
4
10
|
eachTenant,
|
|
11
|
+
{{/if}}
|
|
5
12
|
eraseDataSubject,
|
|
6
13
|
executionContext,
|
|
14
|
+
{{#if tenancy.any}}
|
|
7
15
|
inEachTenant,
|
|
8
|
-
type Actor,
|
|
9
|
-
type DataSubjectErasureReport,
|
|
10
|
-
} from '@ddd-ts-kit/kernel';
|
|
11
16
|
{{/if}}
|
|
12
|
-
{{#unless tenancy.any}}
|
|
13
|
-
import {
|
|
14
|
-
dataSubjectErasedV1,
|
|
15
|
-
eraseDataSubject,
|
|
16
|
-
executionContext,
|
|
17
17
|
type Actor,
|
|
18
18
|
type DataSubjectErasureReport,
|
|
19
|
-
}
|
|
19
|
+
{{#if housekeeping.any}}
|
|
20
|
+
type PersonalDataCopy,
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#unless housekeeping.any}}
|
|
23
|
+
{{#if audit.on}}
|
|
24
|
+
type PersonalDataCopy,
|
|
25
|
+
{{/if}}
|
|
20
26
|
{{/unless}}
|
|
27
|
+
} from '@ddd-ts-kit/kernel';
|
|
28
|
+
{{#if queue.stored}}
|
|
29
|
+
import { jobsOfSubject } from '@ddd-ts-kit/scheduling';
|
|
30
|
+
{{/if}}
|
|
21
31
|
import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ext}}';
|
|
22
32
|
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
33
|
+
{{#if events.outbox}}
|
|
34
|
+
import { personalEvents } from '{{alias.platform}}/privacy/personal-events{{alias.ext}}';
|
|
35
|
+
{{/if}}
|
|
23
36
|
|
|
24
37
|
export interface ErasureRequest {
|
|
25
|
-
/** The assembled platform: the {{#if eventSourcing.on}}keys, the {{/if}}scope and the copies come from it. */
|
|
38
|
+
/** The assembled platform: the {{#if eventSourcing.on}}keys, the {{/if}}scope{{#if audit.on}}, the trail{{/if}} and the copies come from it. */
|
|
26
39
|
readonly platform: Platform;
|
|
27
|
-
/** Who asks for the erasure, as typed: the actor of the work{{#if
|
|
40
|
+
/** Who asks for the erasure, as typed: the actor of the work{{#if audit.on}}, named by the entry each copy writes{{/if}}. */
|
|
28
41
|
readonly operator: string;
|
|
29
42
|
/** The correlation of the work: one per erasure. */
|
|
30
43
|
readonly correlationId: string;
|
|
44
|
+
/** This subject was erased before: reaching nothing is expected, and the erasure is announced again, which completes one that failed before its announcement. */
|
|
45
|
+
readonly rerun?: boolean;
|
|
31
46
|
{{#if tenancy.any}}
|
|
32
47
|
/** 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
48
|
readonly tenants: readonly string[];
|
|
@@ -37,8 +52,9 @@ export interface ErasureRequest {
|
|
|
37
52
|
{{#if eventSourcing.on}}
|
|
38
53
|
/**
|
|
39
54
|
* The right to erasure of one data subject, in an execution context of its own (origin `cli`): the
|
|
40
|
-
* key first
|
|
41
|
-
*
|
|
55
|
+
* key first, then every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}{{#if audit.on}}; the key and every
|
|
56
|
+
* copy write their entry to the audit trail, the operator, the subject and the number of rows, never
|
|
57
|
+
* the values{{/if}}. Running it again completes an erasure whose entry or copy failed; a subject that is
|
|
42
58
|
* not an opaque identifier is refused before any key is touched.
|
|
43
59
|
*/
|
|
44
60
|
{{/if}}
|
|
@@ -47,13 +63,19 @@ export interface ErasureRequest {
|
|
|
47
63
|
* The right to erasure of one data subject, in an execution context of its own (origin `cli`):
|
|
48
64
|
* every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}. The aggregates
|
|
49
65
|
* of this project are rows, so no key is destroyed: a copy is erased or pseudonymised where it
|
|
50
|
-
* lies.
|
|
51
|
-
*
|
|
66
|
+
* lies{{#if audit.on}}, and writes its entry to the audit trail, the operator, the subject and the number of
|
|
67
|
+
* rows, never the values{{/if}}. Running it again completes an erasure whose copy failed; a subject that is not an
|
|
68
|
+
* opaque identifier is refused before anything is touched.
|
|
52
69
|
*/
|
|
53
70
|
{{/unless}}
|
|
54
71
|
export function runErasure(subject: string, request: ErasureRequest): Promise<DataSubjectErasureReport> {
|
|
55
72
|
const { platform, operator, correlationId } = request;
|
|
56
73
|
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
74
|
+
{{#if audit.on}}
|
|
75
|
+
const { trail, onLostRecord } = platform.audit;
|
|
76
|
+
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids, onLostRecord };
|
|
77
|
+
const audited = (copy: PersonalDataCopy): PersonalDataCopy => auditedPersonalDataErasure(copy, trail, source);
|
|
78
|
+
{{/if}}
|
|
57
79
|
|
|
58
80
|
return platform.scope.run(context, async () => {
|
|
59
81
|
const report = await eraseDataSubject(subject, {
|
|
@@ -61,7 +83,19 @@ export function runErasure(subject: string, request: ErasureRequest): Promise<Da
|
|
|
61
83
|
// 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
84
|
keys: platform.eventSourcing.subjectKeys,
|
|
63
85
|
{{/if}}
|
|
86
|
+
{{#if audit.on}}
|
|
87
|
+
copies: dataSubjectCopies.map((copy) => audited(copy(platform))),
|
|
88
|
+
{{#if housekeeping.any}}
|
|
89
|
+
shared: platformCopies(platform).map(audited),
|
|
90
|
+
{{/if}}
|
|
91
|
+
{{/if}}
|
|
92
|
+
{{#unless audit.on}}
|
|
64
93
|
copies: dataSubjectCopies.map((copy) => copy(platform)),
|
|
94
|
+
{{#if housekeeping.any}}
|
|
95
|
+
shared: platformCopies(platform),
|
|
96
|
+
{{/if}}
|
|
97
|
+
{{/unless}}
|
|
98
|
+
isKnown: () => Promise.resolve(request.rerun === true),
|
|
65
99
|
{{#if tenancy.any}}
|
|
66
100
|
inEveryTenant: inEachTenant(platform.scope, request.tenants),
|
|
67
101
|
{{/if}}
|
|
@@ -73,12 +107,28 @@ export function runErasure(subject: string, request: ErasureRequest): Promise<Da
|
|
|
73
107
|
});
|
|
74
108
|
}
|
|
75
109
|
|
|
110
|
+
{{#if housekeeping.any}}
|
|
111
|
+
/** What the platform keeps of a person in tables no tenant confines{{#if events.outbox}}: the records of the outbox, by what `personal-events.ts` lists{{/if}}{{#if queue.stored}}{{#if events.outbox}},{{/if}}{{#unless events.outbox}}:{{/unless}} the jobs enqueued with the person as `subject`{{/if}}. */
|
|
112
|
+
function platformCopies(platform: Platform): readonly PersonalDataCopy[] {
|
|
113
|
+
{{#if events.outbox}}
|
|
114
|
+
const outbox = personalEventsInOutbox(platform.persistence.outbox, personalEvents);
|
|
115
|
+
{{/if}}
|
|
116
|
+
{{#if queue.stored}}
|
|
117
|
+
const jobs = jobsOfSubject(platform.jobStore);
|
|
118
|
+
{{/if}}
|
|
119
|
+
|
|
120
|
+
return [{{#if events.outbox}}outbox{{/if}}{{#if events.outbox}}{{#if queue.stored}}, {{/if}}{{/if}}{{#if queue.stored}}jobs{{/if}}];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
{{/if}}
|
|
76
124
|
/**
|
|
77
125
|
* Once every copy is erased, `privacy.data-subject.erased` goes to the outbox{{#if tenancy.any}}, once per tenant{{/if}}: a context that
|
|
78
126
|
* 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.
|
|
127
|
+
* its copy on its side (GDPR article 19). It names the person by id and nobody else{{#if audit.on}}: who asked is in
|
|
128
|
+
* the audit trail, under the correlation id the event carries{{/if}}. The relay of the application delivers it; an erasure that
|
|
129
|
+
* failed publishes nothing, and running it again does. Neither does an erasure that reached nothing:
|
|
130
|
+
* `eraseDataSubject` refuses it (`UnknownDataSubjectError`), a mistyped id or a tenant left out of the
|
|
131
|
+
* list must not tell the others that a person is gone; `rerun` says it is expected.
|
|
82
132
|
*/
|
|
83
133
|
async function announceErasure(subject: string, { platform{{#if tenancy.any}}, tenants{{/if}} }: ErasureRequest): Promise<void> {
|
|
84
134
|
const erasedAt = platform.clock.now();
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
{{#if audit.on}}
|
|
2
|
+
import { AuditTrail, auditedPersonalDataErasure, logLostRecords } from '@ddd-ts-kit/audit';
|
|
3
|
+
{{/if}}
|
|
1
4
|
import type { Application as Container } from '@ddd-ts-kit/di';
|
|
5
|
+
{{#if events.outbox}}
|
|
6
|
+
import { OutboxStore, personalEventsInOutbox } from '@ddd-ts-kit/events';
|
|
7
|
+
{{/if}}
|
|
2
8
|
import {
|
|
3
9
|
Clock,
|
|
4
10
|
ExecutionScope,
|
|
5
11
|
IdGenerator,
|
|
6
12
|
IntegrationEventPublisher,
|
|
13
|
+
{{#if audit.on}}
|
|
14
|
+
Logger,
|
|
15
|
+
{{/if}}
|
|
7
16
|
{{#if eventSourcing.on}}
|
|
8
17
|
SubjectKeyStore,
|
|
9
18
|
{{/if}}
|
|
@@ -18,16 +27,32 @@ import {
|
|
|
18
27
|
{{/if}}
|
|
19
28
|
type Actor,
|
|
20
29
|
type DataSubjectErasureReport,
|
|
30
|
+
{{#if housekeeping.any}}
|
|
31
|
+
type PersonalDataCopy,
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#unless housekeeping.any}}
|
|
34
|
+
{{#if audit.on}}
|
|
35
|
+
type PersonalDataCopy,
|
|
36
|
+
{{/if}}
|
|
37
|
+
{{/unless}}
|
|
21
38
|
} from '@ddd-ts-kit/kernel';
|
|
39
|
+
{{#if queue.stored}}
|
|
40
|
+
import { JobStore, jobsOfSubject } from '@ddd-ts-kit/scheduling';
|
|
41
|
+
{{/if}}
|
|
22
42
|
import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copies{{alias.ext}}';
|
|
43
|
+
{{#if events.outbox}}
|
|
44
|
+
import { personalEvents } from '{{alias.platform}}/privacy/personal-events{{alias.ext}}';
|
|
45
|
+
{{/if}}
|
|
23
46
|
|
|
24
47
|
export interface ErasureRequest {
|
|
25
48
|
/** The composed application: the {{#if eventSourcing.on}}keys and the {{/if}}copies are resolved from it. */
|
|
26
49
|
readonly container: Container;
|
|
27
|
-
/** Who asks for the erasure, as typed: the actor of the work{{#if
|
|
50
|
+
/** Who asks for the erasure, as typed: the actor of the work{{#if audit.on}}, named by the entry each copy writes{{/if}}. */
|
|
28
51
|
readonly operator: string;
|
|
29
52
|
/** The correlation of the work: one per erasure. */
|
|
30
53
|
readonly correlationId: string;
|
|
54
|
+
/** This subject was erased before: reaching nothing is expected, and the erasure is announced again, which completes one that failed before its announcement. */
|
|
55
|
+
readonly rerun?: boolean;
|
|
31
56
|
{{#if tenancy.any}}
|
|
32
57
|
/** 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
58
|
readonly tenants: readonly string[];
|
|
@@ -37,8 +62,9 @@ export interface ErasureRequest {
|
|
|
37
62
|
{{#if eventSourcing.on}}
|
|
38
63
|
/**
|
|
39
64
|
* The right to erasure of one data subject, in an execution context of its own (origin `cli`): the
|
|
40
|
-
* key first
|
|
41
|
-
*
|
|
65
|
+
* key first, then every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}{{#if audit.on}}; the key and every
|
|
66
|
+
* copy write their entry to the audit trail, the operator, the subject and the number of rows, never
|
|
67
|
+
* the values{{/if}}. Running it again completes an erasure whose entry or copy failed; a subject that is
|
|
42
68
|
* not an opaque identifier is refused before any key is touched.
|
|
43
69
|
*/
|
|
44
70
|
{{/if}}
|
|
@@ -47,14 +73,21 @@ export interface ErasureRequest {
|
|
|
47
73
|
* The right to erasure of one data subject, in an execution context of its own (origin `cli`):
|
|
48
74
|
* every copy a context declared in `data-subject-copies.ts`{{#if tenancy.any}}, in every tenant{{/if}}. The aggregates
|
|
49
75
|
* of this project are rows, so no key is destroyed: a copy is erased or pseudonymised where it
|
|
50
|
-
* lies.
|
|
51
|
-
*
|
|
76
|
+
* lies{{#if audit.on}}, and writes its entry to the audit trail, the operator, the subject and the number of
|
|
77
|
+
* rows, never the values{{/if}}. Running it again completes an erasure whose copy failed; a subject that is not an
|
|
78
|
+
* opaque identifier is refused before anything is touched.
|
|
52
79
|
*/
|
|
53
80
|
{{/unless}}
|
|
54
81
|
export function runErasure(subject: string, request: ErasureRequest): Promise<DataSubjectErasureReport> {
|
|
55
82
|
const { container, operator, correlationId } = request;
|
|
56
83
|
const scope = container.resolve(ExecutionScope);
|
|
57
84
|
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
85
|
+
{{#if audit.on}}
|
|
86
|
+
const trail = container.resolve(AuditTrail);
|
|
87
|
+
const onLostRecord = logLostRecords(container.resolve(Logger));
|
|
88
|
+
const source = { scope, clock: container.resolve(Clock), ids: container.resolve(IdGenerator), onLostRecord };
|
|
89
|
+
const audited = (copy: PersonalDataCopy): PersonalDataCopy => auditedPersonalDataErasure(copy, trail, source);
|
|
90
|
+
{{/if}}
|
|
58
91
|
|
|
59
92
|
return scope.run(context, async () => {
|
|
60
93
|
const report = await eraseDataSubject(subject, {
|
|
@@ -62,7 +95,19 @@ export function runErasure(subject: string, request: ErasureRequest): Promise<Da
|
|
|
62
95
|
// 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
96
|
keys: container.resolve(SubjectKeyStore),
|
|
64
97
|
{{/if}}
|
|
98
|
+
{{#if audit.on}}
|
|
99
|
+
copies: dataSubjectCopies.map((copy) => audited(container.resolve(copy))),
|
|
100
|
+
{{#if housekeeping.any}}
|
|
101
|
+
shared: platformCopies(container).map(audited),
|
|
102
|
+
{{/if}}
|
|
103
|
+
{{/if}}
|
|
104
|
+
{{#unless audit.on}}
|
|
65
105
|
copies: dataSubjectCopies.map((copy) => container.resolve(copy)),
|
|
106
|
+
{{#if housekeeping.any}}
|
|
107
|
+
shared: platformCopies(container),
|
|
108
|
+
{{/if}}
|
|
109
|
+
{{/unless}}
|
|
110
|
+
isKnown: () => Promise.resolve(request.rerun === true),
|
|
66
111
|
{{#if tenancy.any}}
|
|
67
112
|
inEveryTenant: inEachTenant(scope, request.tenants),
|
|
68
113
|
{{/if}}
|
|
@@ -74,12 +119,28 @@ export function runErasure(subject: string, request: ErasureRequest): Promise<Da
|
|
|
74
119
|
});
|
|
75
120
|
}
|
|
76
121
|
|
|
122
|
+
{{#if housekeeping.any}}
|
|
123
|
+
/** What the platform keeps of a person in tables no tenant confines{{#if events.outbox}}: the records of the outbox, by what `personal-events.ts` lists{{/if}}{{#if queue.stored}}{{#if events.outbox}},{{/if}}{{#unless events.outbox}}:{{/unless}} the jobs enqueued with the person as `subject`{{/if}}. */
|
|
124
|
+
function platformCopies(container: Container): readonly PersonalDataCopy[] {
|
|
125
|
+
{{#if events.outbox}}
|
|
126
|
+
const outbox = personalEventsInOutbox(container.resolve(OutboxStore), personalEvents);
|
|
127
|
+
{{/if}}
|
|
128
|
+
{{#if queue.stored}}
|
|
129
|
+
const jobs = jobsOfSubject(container.resolve(JobStore));
|
|
130
|
+
{{/if}}
|
|
131
|
+
|
|
132
|
+
return [{{#if events.outbox}}outbox{{/if}}{{#if events.outbox}}{{#if queue.stored}}, {{/if}}{{/if}}{{#if queue.stored}}jobs{{/if}}];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
{{/if}}
|
|
77
136
|
/**
|
|
78
137
|
* Once every copy is erased, `privacy.data-subject.erased` goes to the outbox{{#if tenancy.any}}, once per tenant{{/if}}: a context that
|
|
79
138
|
* 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.
|
|
139
|
+
* its copy on its side (GDPR article 19). It names the person by id and nobody else{{#if audit.on}}: who asked is in
|
|
140
|
+
* the audit trail, under the correlation id the event carries{{/if}}. The relay of the application delivers it; an erasure that
|
|
141
|
+
* failed publishes nothing, and running it again does. Neither does an erasure that reached nothing:
|
|
142
|
+
* `eraseDataSubject` refuses it (`UnknownDataSubjectError`), a mistyped id or a tenant left out of the
|
|
143
|
+
* list must not tell the others that a person is gone; `rerun` says it is expected.
|
|
83
144
|
*/
|
|
84
145
|
async function announceErasure(subject: string, request: ErasureRequest): Promise<void> {
|
|
85
146
|
const { container } = request;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { auditedPersonalDataExport } from '@ddd-ts-kit/audit';
|
|
3
3
|
{{/if}}
|
|
4
4
|
import {
|
|
5
|
+
{{#if eventSourcing.on}}
|
|
6
|
+
EventStorePersonalDataExport,
|
|
7
|
+
{{/if}}
|
|
5
8
|
executionContext,
|
|
6
9
|
exportDataSubject,
|
|
7
10
|
{{#if tenancy.any}}
|
|
@@ -15,7 +18,7 @@ import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ex
|
|
|
15
18
|
import { dataSubjectExports } from '{{alias.platform}}/privacy/data-subject-exports{{alias.ext}}';
|
|
16
19
|
|
|
17
20
|
export interface ExportRequest {
|
|
18
|
-
/** The assembled platform: the scope, the clock{{#if audit.on}}, the trail{{/if}} and the exports come from it. */
|
|
21
|
+
/** The assembled platform: the scope, the clock{{#if audit.on}}, the trail{{/if}}{{#if eventSourcing.on}}, the event store{{/if}} and the exports come from it. */
|
|
19
22
|
readonly platform: Platform;
|
|
20
23
|
/** Who asks for the export, as typed: the actor of the work{{#if audit.on}}, named by the entry each export writes{{/if}}. */
|
|
21
24
|
readonly operator: string;
|
|
@@ -30,7 +33,7 @@ export interface ExportRequest {
|
|
|
30
33
|
/**
|
|
31
34
|
* The right of access and to portability of one data subject (GDPR articles 15 and 20), in an
|
|
32
35
|
* 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
|
|
36
|
+
* `data-subject-exports.ts` keeps of the person{{#if eventSourcing.on}}, and every value the event store keeps sealed with the key of the person{{/if}}{{#if tenancy.any}}, in every tenant{{/if}}, gathered into one dated document
|
|
34
37
|
* of a stable format{{#if audit.on}}; every export writes its entry to the audit trail, the operator, the subject and
|
|
35
38
|
* the number of records, never the values{{/if}}. A subject that is not an opaque identifier is refused
|
|
36
39
|
* before anything is read.
|
|
@@ -39,13 +42,23 @@ export function runExport(subject: string, request: ExportRequest): Promise<Pers
|
|
|
39
42
|
const { platform, operator, correlationId } = request;
|
|
40
43
|
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
41
44
|
{{#if audit.on}}
|
|
42
|
-
const { trail } = platform.audit;
|
|
43
|
-
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids };
|
|
45
|
+
const { trail, onLostRecord } = platform.audit;
|
|
46
|
+
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids, onLostRecord };
|
|
44
47
|
const audited = (port: PersonalDataExport): PersonalDataExport => auditedPersonalDataExport(port, trail, source);
|
|
48
|
+
{{#if eventSourcing.on}}
|
|
49
|
+
const exports = [...dataSubjectExports.map((exported) => exported(platform)), eventStoreExport(platform)].map(audited);
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#unless eventSourcing.on}}
|
|
45
52
|
const exports = dataSubjectExports.map((exported) => audited(exported(platform)));
|
|
53
|
+
{{/unless}}
|
|
46
54
|
{{/if}}
|
|
47
55
|
{{#unless audit.on}}
|
|
56
|
+
{{#if eventSourcing.on}}
|
|
57
|
+
const exports: readonly PersonalDataExport[] = [...dataSubjectExports.map((exported) => exported(platform)), eventStoreExport(platform)];
|
|
58
|
+
{{/if}}
|
|
59
|
+
{{#unless eventSourcing.on}}
|
|
48
60
|
const exports: readonly PersonalDataExport[] = dataSubjectExports.map((exported) => exported(platform));
|
|
61
|
+
{{/unless}}
|
|
49
62
|
{{/unless}}
|
|
50
63
|
|
|
51
64
|
return platform.scope.run(context, () =>
|
|
@@ -59,6 +72,15 @@ export function runExport(subject: string, request: ExportRequest): Promise<Pers
|
|
|
59
72
|
);
|
|
60
73
|
}
|
|
61
74
|
|
|
75
|
+
{{#if eventSourcing.on}}
|
|
76
|
+
/** What the event store keeps of the person: every value sealed with their key, opened, under `platform.event-store.<event type>`. Empty once the key is destroyed. */
|
|
77
|
+
function eventStoreExport(platform: Platform): PersonalDataExport {
|
|
78
|
+
const { events, subjectKeys } = platform.eventSourcing;
|
|
79
|
+
|
|
80
|
+
return new EventStorePersonalDataExport({ name: 'platform.event-store', events, keys: subjectKeys, scope: platform.scope });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
{{/if}}
|
|
62
84
|
function operatorActor(id: string): Actor {
|
|
63
85
|
return { id, type: 'user', roles: [], attributes: {} };
|
|
64
86
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{{#if audit.on}}
|
|
2
|
-
import { AuditTrail, auditedPersonalDataExport } from '@ddd-ts-kit/audit';
|
|
2
|
+
import { AuditTrail, auditedPersonalDataExport, logLostRecords } from '@ddd-ts-kit/audit';
|
|
3
3
|
{{/if}}
|
|
4
4
|
import type { Application as Container } from '@ddd-ts-kit/di';
|
|
5
5
|
import {
|
|
6
6
|
Clock,
|
|
7
|
+
{{#if eventSourcing.on}}
|
|
8
|
+
EventStore,
|
|
9
|
+
EventStorePersonalDataExport,
|
|
10
|
+
{{/if}}
|
|
7
11
|
ExecutionScope,
|
|
8
12
|
{{#if audit.on}}
|
|
9
13
|
IdGenerator,
|
|
14
|
+
Logger,
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if eventSourcing.on}}
|
|
17
|
+
SubjectKeyStore,
|
|
10
18
|
{{/if}}
|
|
11
19
|
executionContext,
|
|
12
20
|
exportDataSubject,
|
|
@@ -35,7 +43,7 @@ export interface ExportRequest {
|
|
|
35
43
|
/**
|
|
36
44
|
* The right of access and to portability of one data subject (GDPR articles 15 and 20), in an
|
|
37
45
|
* 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
|
|
46
|
+
* `data-subject-exports.ts` keeps of the person{{#if eventSourcing.on}}, and every value the event store keeps sealed with the key of the person{{/if}}{{#if tenancy.any}}, in every tenant{{/if}}, gathered into one dated document
|
|
39
47
|
* of a stable format{{#if audit.on}}; every export writes its entry to the audit trail, the operator, the subject and
|
|
40
48
|
* the number of records, never the values{{/if}}. A subject that is not an opaque identifier is refused
|
|
41
49
|
* before anything is read.
|
|
@@ -47,12 +55,23 @@ export function runExport(subject: string, request: ExportRequest): Promise<Pers
|
|
|
47
55
|
const context = executionContext({ correlationId, actor: operatorActor(operator), origin: 'cli' });
|
|
48
56
|
{{#if audit.on}}
|
|
49
57
|
const trail = container.resolve(AuditTrail);
|
|
50
|
-
const
|
|
58
|
+
const onLostRecord = logLostRecords(container.resolve(Logger));
|
|
59
|
+
const source = { scope, clock, ids: container.resolve(IdGenerator), onLostRecord };
|
|
51
60
|
const audited = (port: PersonalDataExport): PersonalDataExport => auditedPersonalDataExport(port, trail, source);
|
|
61
|
+
{{#if eventSourcing.on}}
|
|
62
|
+
const exports = [...dataSubjectExports.map((port) => container.resolve(port)), eventStoreExport(container)].map(audited);
|
|
63
|
+
{{/if}}
|
|
64
|
+
{{#unless eventSourcing.on}}
|
|
52
65
|
const exports = dataSubjectExports.map((port) => audited(container.resolve(port)));
|
|
66
|
+
{{/unless}}
|
|
53
67
|
{{/if}}
|
|
54
68
|
{{#unless audit.on}}
|
|
69
|
+
{{#if eventSourcing.on}}
|
|
70
|
+
const exports: readonly PersonalDataExport[] = [...dataSubjectExports.map((port) => container.resolve(port)), eventStoreExport(container)];
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{#unless eventSourcing.on}}
|
|
55
73
|
const exports: readonly PersonalDataExport[] = dataSubjectExports.map((port) => container.resolve(port));
|
|
74
|
+
{{/unless}}
|
|
56
75
|
{{/unless}}
|
|
57
76
|
|
|
58
77
|
return scope.run(context, () =>
|
|
@@ -66,6 +85,18 @@ export function runExport(subject: string, request: ExportRequest): Promise<Pers
|
|
|
66
85
|
);
|
|
67
86
|
}
|
|
68
87
|
|
|
88
|
+
{{#if eventSourcing.on}}
|
|
89
|
+
/** What the event store keeps of the person: every value sealed with their key, opened, under `platform.event-store.<event type>`. Empty once the key is destroyed. */
|
|
90
|
+
function eventStoreExport(container: Container): PersonalDataExport {
|
|
91
|
+
return new EventStorePersonalDataExport({
|
|
92
|
+
name: 'platform.event-store',
|
|
93
|
+
events: container.resolve(EventStore),
|
|
94
|
+
keys: container.resolve(SubjectKeyStore),
|
|
95
|
+
scope: container.resolve(ExecutionScope),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
{{/if}}
|
|
69
100
|
function operatorActor(id: string): Actor {
|
|
70
101
|
return { id, type: 'user', roles: [], attributes: {} };
|
|
71
102
|
}
|
|
@@ -25,10 +25,11 @@ import { dataSubjectCopies } from '{{alias.platform}}/privacy/data-subject-copie
|
|
|
25
25
|
export function runPurge(platform: Platform): Promise<PersonalDataPurgeReport> {
|
|
26
26
|
const retentions = dataSubjectCopies.map((copy) => copy(platform)).filter(isPersonalDataRetention);
|
|
27
27
|
{{#if audit.on}}
|
|
28
|
-
const
|
|
28
|
+
const { trail, onLostRecord } = platform.audit;
|
|
29
|
+
const source = { scope: platform.scope, clock: platform.clock, ids: platform.ids, onLostRecord };
|
|
29
30
|
|
|
30
31
|
const audited = (port: PersonalDataRetention): PersonalDataRetention =>
|
|
31
|
-
auditedPersonalDataRetention(port,
|
|
32
|
+
auditedPersonalDataRetention(port, trail, source);
|
|
32
33
|
|
|
33
34
|
return purgeExpiredPersonalData(platform.clock.now(), retentions.map(audited));
|
|
34
35
|
{{/if}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if audit.on}}
|
|
2
|
-
import { AuditTrail, auditedPersonalDataRetention } from '@ddd-ts-kit/audit';
|
|
2
|
+
import { AuditTrail, auditedPersonalDataRetention, logLostRecords } from '@ddd-ts-kit/audit';
|
|
3
3
|
{{/if}}
|
|
4
4
|
import type { Resolve } from '@ddd-ts-kit/di';
|
|
5
5
|
import {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
{{#if audit.on}}
|
|
8
8
|
ExecutionScope,
|
|
9
9
|
IdGenerator,
|
|
10
|
+
Logger,
|
|
10
11
|
{{/if}}
|
|
11
12
|
isPersonalDataRetention,
|
|
12
13
|
purgeExpiredPersonalData,
|
|
@@ -31,7 +32,8 @@ export function runPurge(resolve: Resolve): Promise<PersonalDataPurgeReport> {
|
|
|
31
32
|
const retentions = dataSubjectCopies.map((copy) => resolve(copy)).filter(isPersonalDataRetention);
|
|
32
33
|
{{#if audit.on}}
|
|
33
34
|
const trail = resolve(AuditTrail);
|
|
34
|
-
const
|
|
35
|
+
const onLostRecord = logLostRecords(resolve(Logger));
|
|
36
|
+
const source = { scope: resolve(ExecutionScope), clock, ids: resolve(IdGenerator), onLostRecord };
|
|
35
37
|
|
|
36
38
|
const audited = (port: PersonalDataRetention): PersonalDataRetention =>
|
|
37
39
|
auditedPersonalDataRetention(port, trail, source);
|
|
@@ -20,7 +20,7 @@ paths:
|
|
|
20
20
|
- Own tables, in the schema of the context: no join, foreign key or transaction across contexts (`context/extractable`).
|
|
21
21
|
- 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.
|
|
22
22
|
{{#if tenancy.any}}
|
|
23
|
-
- 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; a context none of whose tables belongs to a tenant, since it decides who belongs to which, is declared `"tenancy": "control-plane"` in its entry of `contexts`, with its deviation, never suppressed statement by statement. See `docs/concepts/multitenancy.md` of the kit.
|
|
23
|
+
- 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`). The tenant condition is a conjunct of the statement, since SQL binds `and` before `or`: {{#if orm.knex}}no `.orWhere*` at the top of a statement of `tenantTable` or `ownTenantTable`, alternatives grouped in `.where((either) => either.where(a).orWhere(b))`, no `clearWhere()` or `clear('where')`{{/if}}{{#if orm.drizzle}}a direct argument of `where` or of `and`, never under `or`, `not` or a `sql` template, alternatives beside it in `and(tenantCondition(...), or(a, b))`{{/if}}{{#if orm.prisma}}the spread at the top of the `where`, never under `OR` or `NOT`, an `OR` beside it{{/if}}{{#if orm.typeorm}}the spread at the top of the where and in each entry of a where array, no `orWhere` at the top of a query builder, the condition in its last `where` or an `andWhere` after it, alternatives in `new Brackets(...)` in an `andWhere`{{/if}}. A table of no tenant is a recorded deviation; a context none of whose tables belongs to a tenant, since it decides who belongs to which, is declared `"tenancy": "control-plane"` in its entry of `contexts`, with its deviation, never suppressed statement by statement. See `docs/concepts/multitenancy.md` of the kit.
|
|
24
24
|
{{/if}}
|
|
25
25
|
{{#if style.declared}}
|
|
26
26
|
- 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.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { verifyTrail } from '@ddd-ts-kit/audit';
|
|
2
|
+
import { createAuditTrail } from '{{alias.platform}}/audit/create-audit-trail{{alias.ext}}';
|
|
3
|
+
import { loadConfig } from '{{alias.platform}}/config/load-config{{alias.ext}}';
|
|
4
|
+
import { openPersistence } from '{{alias.platform}}/database/open-persistence{{alias.ext}}';
|
|
5
|
+
{{#if audit.archive}}
|
|
6
|
+
import { openFiles } from '{{alias.platform}}/files/open-files{{alias.ext}}';
|
|
7
|
+
{{/if}}
|
|
8
|
+
|
|
9
|
+
// The verification of the audit trail, from the command line, as the job `audit.verify` runs it
|
|
10
|
+
// every night:
|
|
11
|
+
// npm run audit:verify
|
|
12
|
+
// Every chain, from its last archive to its head: an entry changed, removed, reordered or cut from
|
|
13
|
+
// the end of its chain is a break, reported with its chain and its sequence, and the exit code is 1.
|
|
14
|
+
{{#if audit.archive}}
|
|
15
|
+
// Every archive of each chain is read back from the storage and proved against its row first, then the
|
|
16
|
+
// entries left in the database are verified from the anchor of the last (docs/concepts/audit-trail.md of ddd-ts-kit).
|
|
17
|
+
const config = loadConfig(process.env);
|
|
18
|
+
const persistence = {{persistence.await}}openPersistence(config);
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const verification = await verifyTrail(createAuditTrail(persistence), { files: openFiles(config.files) });
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#unless audit.archive}}
|
|
24
|
+
// The entries left in the database are verified from the genesis of each chain (docs/concepts/audit-trail.md of ddd-ts-kit).
|
|
25
|
+
const persistence = {{persistence.await}}openPersistence(loadConfig(process.env));
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const verification = await verifyTrail(createAuditTrail(persistence));
|
|
29
|
+
{{/unless}}
|
|
30
|
+
|
|
31
|
+
console.log(JSON.stringify(verification, null, 2));
|
|
32
|
+
process.exitCode = verification.valid ? 0 : 1;
|
|
33
|
+
} finally {
|
|
34
|
+
await persistence.close();
|
|
35
|
+
}
|