ddd-ts-kit 0.105.0 → 0.107.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 +132 -0
- package/README.fr.md +63 -46
- package/README.md +61 -45
- package/dist/check/baseline/renamed-files.d.ts.map +1 -1
- package/dist/check/baseline/renamed-files.js +2 -1
- package/dist/check/baseline/renamed-files.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -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 +1 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/commands/changed-files.d.ts.map +1 -1
- package/dist/check/commands/changed-files.js +2 -1
- package/dist/check/commands/changed-files.js.map +1 -1
- package/dist/check/explain/privacy-docs.d.ts.map +1 -1
- package/dist/check/explain/privacy-docs.js +13 -0
- package/dist/check/explain/privacy-docs.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts +3 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.js +86 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.js.map +1 -0
- package/dist/check/privacy/clear-snapshot-values-in.d.ts +13 -0
- package/dist/check/privacy/clear-snapshot-values-in.d.ts.map +1 -0
- package/dist/check/privacy/clear-snapshot-values-in.js +36 -0
- package/dist/check/privacy/clear-snapshot-values-in.js.map +1 -0
- package/dist/check/privacy/is-snapshot-mapper.d.ts +4 -0
- package/dist/check/privacy/is-snapshot-mapper.d.ts.map +1 -0
- package/dist/check/privacy/is-snapshot-mapper.js +11 -0
- package/dist/check/privacy/is-snapshot-mapper.js.map +1 -0
- package/dist/check/project/git-ignored.d.ts.map +1 -1
- package/dist/check/project/git-ignored.js +2 -1
- package/dist/check/project/git-ignored.js.map +1 -1
- package/dist/check/rules/authz-declared.d.ts.map +1 -1
- package/dist/check/rules/authz-declared.js +2 -1
- package/dist/check/rules/authz-declared.js.map +1 -1
- package/dist/check/rules/privacy-declared-field.d.ts +2 -1
- package/dist/check/rules/privacy-declared-field.d.ts.map +1 -1
- package/dist/check/rules/privacy-declared-field.js +4 -1
- package/dist/check/rules/privacy-declared-field.js.map +1 -1
- package/dist/check/rules/privacy-snapshot-sealed.d.ts +9 -0
- package/dist/check/rules/privacy-snapshot-sealed.d.ts.map +1 -0
- package/dist/check/rules/privacy-snapshot-sealed.js +34 -0
- package/dist/check/rules/privacy-snapshot-sealed.js.map +1 -0
- package/dist/commit/git-arguments.d.ts +9 -0
- package/dist/commit/git-arguments.d.ts.map +1 -0
- package/dist/commit/git-arguments.js +46 -0
- package/dist/commit/git-arguments.js.map +1 -0
- package/dist/commit/run-git.d.ts.map +1 -1
- package/dist/commit/run-git.js +2 -1
- package/dist/commit/run-git.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/kit-container.d.ts +6 -0
- package/dist/config/kit-container.d.ts.map +1 -0
- package/dist/config/kit-container.js +10 -0
- package/dist/config/kit-container.js.map +1 -0
- package/dist/config/stack.d.ts +1 -1
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/doctor/format-diagnosis.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.js +10 -2
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/hook-findings.d.ts +2 -1
- package/dist/doctor/hook-findings.d.ts.map +1 -1
- package/dist/doctor/hook-findings.js +27 -3
- package/dist/doctor/hook-findings.js.map +1 -1
- package/dist/doctor/permission-findings.js +1 -0
- package/dist/doctor/permission-findings.js.map +1 -1
- package/dist/generate/concept-role.d.ts +2 -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 +4 -1
- package/dist/generate/concept.js.map +1 -1
- package/dist/generate/di-entry.d.ts +4 -0
- package/dist/generate/di-entry.d.ts.map +1 -0
- package/dist/generate/di-entry.js +5 -0
- package/dist/generate/di-entry.js.map +1 -0
- package/dist/generate/di-imports.d.ts +4 -0
- package/dist/generate/di-imports.d.ts.map +1 -0
- package/dist/generate/di-imports.js +12 -0
- package/dist/generate/di-imports.js.map +1 -0
- package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.js +3 -2
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/background/spec-family.d.ts +1 -1
- package/dist/generate/kinds/background/spec-family.d.ts.map +1 -1
- package/dist/generate/kinds/background/spec-family.js +2 -1
- package/dist/generate/kinds/background/spec-family.js.map +1 -1
- package/dist/generate/kinds/birth-names.js +1 -1
- package/dist/generate/kinds/birth-names.js.map +1 -1
- package/dist/generate/kinds/command-outputs.d.ts.map +1 -1
- package/dist/generate/kinds/command-outputs.js +2 -1
- package/dist/generate/kinds/command-outputs.js.map +1 -1
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +1 -0
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/existing-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/existing-aggregate.js +1 -0
- package/dist/generate/kinds/existing-aggregate.js.map +1 -1
- package/dist/generate/kinds/extraction/service-selection.d.ts.map +1 -1
- package/dist/generate/kinds/extraction/service-selection.js +2 -1
- package/dist/generate/kinds/extraction/service-selection.js.map +1 -1
- package/dist/generate/kinds/gateway-kind.js +1 -1
- package/dist/generate/kinds/gateway-kind.js.map +1 -1
- package/dist/generate/kinds/import-assembler.d.ts.map +1 -1
- package/dist/generate/kinds/import-assembler.js +11 -2
- package/dist/generate/kinds/import-assembler.js.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.d.ts.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.js +8 -4
- package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
- package/dist/generate/kinds/job-kind.d.ts.map +1 -1
- package/dist/generate/kinds/job-kind.js +2 -1
- package/dist/generate/kinds/job-kind.js.map +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -1
- package/dist/generate/kinds/query-kind.js +1 -1
- package/dist/generate/kinds/query-kind.js.map +1 -1
- package/dist/generate/kinds/query-outputs.d.ts.map +1 -1
- package/dist/generate/kinds/query-outputs.js +2 -1
- package/dist/generate/kinds/query-outputs.js.map +1 -1
- package/dist/generate/kinds/test-world-kind.d.ts.map +1 -1
- package/dist/generate/kinds/test-world-kind.js +3 -2
- package/dist/generate/kinds/test-world-kind.js.map +1 -1
- package/dist/generate/kinds/world/context-fakes.d.ts.map +1 -1
- package/dist/generate/kinds/world/context-fakes.js +2 -1
- package/dist/generate/kinds/world/context-fakes.js.map +1 -1
- package/dist/generate/kinds/world/world-arrangement.d.ts.map +1 -1
- package/dist/generate/kinds/world/world-arrangement.js +2 -1
- package/dist/generate/kinds/world/world-arrangement.js.map +1 -1
- package/dist/generate/kinds/world/world-vars.d.ts.map +1 -1
- package/dist/generate/kinds/world/world-vars.js +2 -1
- package/dist/generate/kinds/world/world-vars.js.map +1 -1
- package/dist/generate/label.js +1 -1
- package/dist/generate/label.js.map +1 -1
- package/dist/generate/spec-vars.d.ts.map +1 -1
- package/dist/generate/spec-vars.js +2 -1
- package/dist/generate/spec-vars.js.map +1 -1
- package/dist/generate/wiring-family.d.ts +1 -1
- package/dist/generate/wiring-family.d.ts.map +1 -1
- package/dist/generate/wiring-family.js +2 -1
- package/dist/generate/wiring-family.js.map +1 -1
- package/dist/generate/wirings.js +2 -2
- package/dist/generate/wirings.js.map +1 -1
- package/dist/help/usage.js +1 -1
- package/dist/init/add-presets.d.ts +8 -0
- package/dist/init/add-presets.d.ts.map +1 -0
- package/dist/init/add-presets.js +17 -0
- package/dist/init/add-presets.js.map +1 -0
- package/dist/init/agent-permissions.js +2 -0
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/audit-files.js +1 -1
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/auth-files.js +2 -2
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/event-sourcing-files.js +1 -1
- package/dist/init/files/event-sourcing-files.js.map +1 -1
- package/dist/init/files/family-of.d.ts +1 -1
- package/dist/init/files/family-of.d.ts.map +1 -1
- package/dist/init/files/family-of.js +2 -1
- package/dist/init/files/family-of.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.js +2 -2
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/files/privacy-files.js +1 -1
- package/dist/init/files/privacy-files.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.js +5 -1
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +4 -0
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +28 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/manifest/write-manifest.js +1 -1
- package/dist/init/manifest/write-manifest.js.map +1 -1
- package/dist/init/regulated-sandbox.d.ts +5 -3
- package/dist/init/regulated-sandbox.d.ts.map +1 -1
- package/dist/init/regulated-sandbox.js +6 -3
- package/dist/init/regulated-sandbox.js.map +1 -1
- package/dist/init/rewire-personal-data.js +1 -1
- package/dist/init/rewire-personal-data.js.map +1 -1
- package/dist/init/rewire-preset.d.ts +1 -1
- package/dist/init/rewire-preset.d.ts.map +1 -1
- package/dist/init/rewire-preset.js +5 -2
- package/dist/init/rewire-preset.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +13 -5
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +1 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/resolve-style.d.ts +1 -1
- package/dist/init/stack/resolve-style.js +4 -4
- package/dist/init/stack/resolve-style.js.map +1 -1
- package/dist/init/subfolder-of.d.ts +3 -0
- package/dist/init/subfolder-of.d.ts.map +1 -0
- package/dist/init/subfolder-of.js +7 -0
- package/dist/init/subfolder-of.js.map +1 -0
- package/dist/init/subfolder-sentence.d.ts +6 -0
- package/dist/init/subfolder-sentence.d.ts.map +1 -0
- package/dist/init/subfolder-sentence.js +13 -0
- package/dist/init/subfolder-sentence.js.map +1 -0
- package/dist/init/validation-dependencies.d.ts.map +1 -1
- package/dist/init/validation-dependencies.js +3 -1
- package/dist/init/validation-dependencies.js.map +1 -1
- package/dist/layout/fit-statement.js +16 -2
- package/dist/layout/fit-statement.js.map +1 -1
- package/dist/merge/git-process.d.ts.map +1 -1
- package/dist/merge/git-process.js +2 -1
- package/dist/merge/git-process.js.map +1 -1
- package/dist/merge/lost/revision-files.d.ts.map +1 -1
- package/dist/merge/lost/revision-files.js +6 -1
- package/dist/merge/lost/revision-files.js.map +1 -1
- package/dist/merge/lost/side-hunks.d.ts.map +1 -1
- package/dist/merge/lost/side-hunks.js +2 -1
- package/dist/merge/lost/side-hunks.js.map +1 -1
- package/dist/merge/object-bytes.d.ts.map +1 -1
- package/dist/merge/object-bytes.js +2 -1
- package/dist/merge/object-bytes.js.map +1 -1
- package/dist/naming/parse-concept-name.d.ts +2 -0
- package/dist/naming/parse-concept-name.d.ts.map +1 -1
- package/dist/naming/parse-concept-name.js +4 -1
- package/dist/naming/parse-concept-name.js.map +1 -1
- package/dist/naming/parse-context-name.d.ts.map +1 -1
- package/dist/naming/parse-context-name.js +2 -0
- package/dist/naming/parse-context-name.js.map +1 -1
- package/dist/naming/refuse-windows-reserved.d.ts +7 -0
- package/dist/naming/refuse-windows-reserved.d.ts.map +1 -0
- package/dist/naming/refuse-windows-reserved.js +14 -0
- package/dist/naming/refuse-windows-reserved.js.map +1 -0
- package/dist/package-manager/package-manager-vars.d.ts +1 -1
- package/dist/package-manager/package-manager-vars.js +2 -2
- package/dist/package-manager/package-manager-vars.js.map +1 -1
- package/dist/package-manager/pinned-package-managers.d.ts +2 -2
- package/dist/package-manager/pinned-package-managers.js +2 -2
- package/dist/plan/copy-of-project.d.ts.map +1 -1
- package/dist/plan/copy-of-project.js +2 -1
- package/dist/plan/copy-of-project.js.map +1 -1
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +2 -0
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/identity-refusal.d.ts.map +1 -1
- package/dist/presets/identity-refusal.js +4 -3
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/organisations-as-audit-chains.d.ts +10 -0
- package/dist/presets/organisations-as-audit-chains.d.ts.map +1 -0
- package/dist/presets/organisations-as-audit-chains.js +30 -0
- package/dist/presets/organisations-as-audit-chains.js.map +1 -0
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +7 -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 +8 -5
- package/templates/architecture/{extractable.tsyringe.spec.ts.tpl → extractable.container.spec.ts.tpl} +2 -1
- package/templates/architecture/extractable.declared.spec.ts.tpl +2 -1
- package/templates/controller/guard.spec.ts.tpl +20 -15
- package/templates/controller/guard.ts.tpl +3 -5
- package/templates/docs/privacy-register.md.tpl +1 -1
- package/templates/init/README.md.tpl +8 -6
- package/templates/init/docker/Dockerfile.tpl +7 -7
- package/templates/init/docker/env.example.tpl +2 -0
- package/templates/init/e2e/create-credentials.keycloak.ts.tpl +1 -0
- package/templates/init/e2e/start-application.database.ts.tpl +5 -5
- package/templates/init/e2e/start-application.memory.ts.tpl +5 -5
- package/templates/init/main.ts.tpl +1 -0
- package/templates/init/platform/auth/relationships/create-tuple-store.contract.spec.ts.tpl +11 -1
- package/templates/init/platform/auth/relationships/create-tuple-store.ts.tpl +16 -1
- package/templates/init/platform/composition/{compose-application.tsyringe.ts.tpl → compose-application.container.ts.tpl} +5 -9
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +4 -2
- package/templates/init/platform/events/start-outbox-relay.ts.tpl +5 -1
- package/templates/init/platform/observability/create-logger.stdout.ts.tpl +2 -2
- package/templates/init/platform/observability/create-metrics.ts.tpl +6 -3
- package/templates/init/platform/resilience/adapters-with-own-policy.ts.tpl +1 -1
- package/templates/init/platform/resilience/default-policy.ts.tpl +1 -1
- package/templates/init/rules/platform.md.tpl +3 -3
- package/templates/init/rules/tests.md.tpl +2 -2
- package/templates/pipeline/biome.json.tpl +1 -1
- package/templates/pipeline/github/actions/setup/action.yml.tpl +3 -2
- package/templates/pipeline/github/workflows/ci.yml.tpl +4 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +6 -2
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +6 -4
- package/templates/presets/identity/context/test/integration/organisation-tenant-directory.spec.ts.tpl +7 -6
- package/templates/presets/identity/context/test/worlds/__context__.world.declared.ts.tpl +2 -1
- package/templates/presets/identity/design.md.tpl +4 -2
- package/templates/presets/identity/e2e/support.wiring.tpl +4 -4
- package/templates/presets/identity/platform/organisation-of-command.ts.tpl +36 -0
- package/templates/repository/event-sourced/repository.ts.tpl +1 -1
- package/templates/repository/knex/mapper.ts.tpl +1 -1
- package/templates/repository/typeorm/table.tpl +2 -2
- package/templates/sdk/runtime.ts.tpl +10 -1
- package/templates/service/main.ts.tpl +1 -0
- /package/templates/adapter/{simulated.wiring.tsyringe.tpl → simulated.wiring.container.tpl} +0 -0
- /package/templates/adapter/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/architecture/{hosting.tsyringe.spec.ts.tpl → hosting.container.spec.ts.tpl} +0 -0
- /package/templates/architecture/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/background-job/{background-job.spec.tsyringe.ts.tpl → background-job.spec.container.ts.tpl} +0 -0
- /package/templates/background-job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/command/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
- /package/templates/command/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/context/{module.tsyringe.ts.tpl → module.container.ts.tpl} +0 -0
- /package/templates/context/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/controller/{routes.tsyringe.tpl → routes.container.tpl} +0 -0
- /package/templates/erasure-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/event-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/file-upload/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/gateway/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/init/platform/audit/{audit.module.tsyringe.ts.tpl → audit.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/auth/authorization/{authorization.tsyringe.ts.tpl → authorization.container.ts.tpl} +0 -0
- /package/templates/init/platform/buses/{create-command-bus.tsyringe.ts.tpl → create-command-bus.container.ts.tpl} +0 -0
- /package/templates/init/platform/buses/{create-query-bus.tsyringe.ts.tpl → create-query-bus.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{context-selection.tsyringe.ts.tpl → context-selection.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{lay-foundations.tsyringe.ts.tpl → lay-foundations.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{platform-test.module.tsyringe.ts.tpl → platform-test.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{platform.module.tsyringe.ts.tpl → platform.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{routes-of.tsyringe.ts.tpl → routes-of.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{bind-files.tsyringe.ts.tpl → bind-files.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{files.module.tsyringe.ts.tpl → files.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{staging-uploads.tsyringe.ts.tpl → staging-uploads.container.ts.tpl} +0 -0
- /package/templates/init/platform/jobs/{housekeeping.module.tsyringe.ts.tpl → housekeeping.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{data-subject-copies.tsyringe.ts.tpl → data-subject-copies.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{data-subject-exports.tsyringe.ts.tpl → data-subject-exports.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{privacy.module.tsyringe.ts.tpl → privacy.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-erasure.tsyringe.ts.tpl → run-erasure.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-export.tsyringe.ts.tpl → run-export.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-purge.tsyringe.ts.tpl → run-purge.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-erase.tsyringe.ts.tpl → privacy-erase.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-export.tsyringe.ts.tpl → privacy-export.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-purge.tsyringe.ts.tpl → privacy-purge.container.ts.tpl} +0 -0
- /package/templates/integration-event/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/integration-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/job/{job.spec.tsyringe.ts.tpl → job.spec.container.ts.tpl} +0 -0
- /package/templates/job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/module/{module-file.tsyringe.ts.tpl → module-file.container.ts.tpl} +0 -0
- /package/templates/module/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/personal-data/{copies.tsyringe.tpl → copies.container.tpl} +0 -0
- /package/templates/personal-data/{exports.tsyringe.tpl → exports.container.tpl} +0 -0
- /package/templates/personal-data/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/process/{timeout-job.spec.tsyringe.ts.tpl → timeout-job.spec.container.ts.tpl} +0 -0
- /package/templates/process/{timeout-job.wiring.tsyringe.tpl → timeout-job.wiring.container.tpl} +0 -0
- /package/templates/projection/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/query/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
- /package/templates/query/{search.handler.spec.tsyringe.ts.tpl → search.handler.spec.container.ts.tpl} +0 -0
- /package/templates/query/{search.wiring.tsyringe.tpl → search.wiring.container.tpl} +0 -0
- /package/templates/query/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/repository/{event-sourced.wiring.tsyringe.tpl → event-sourced.wiring.container.tpl} +0 -0
- /package/templates/repository/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/route/{routes.on-tsyringe.tpl → routes.on-container.tpl} +0 -0
- /package/templates/service/{extracted.tsyringe.tpl → extracted.container.tpl} +0 -0
- /package/templates/test-world/{world.tsyringe.ts.tpl → world.container.ts.tpl} +0 -0
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
{{#unless httpCache.varnish}}
|
|
14
14
|
import type { IntegrationEvent, IntegrationEventSubscriber, JobScheduler } from '@ddd-ts-kit/kernel';
|
|
15
15
|
{{/unless}}
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
import { defineContextModule } from '@ddd-ts-kit/di';
|
|
18
18
|
{{/if}}
|
|
19
19
|
import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
|
|
@@ -21,11 +21,11 @@ import { createHttpClient, settled, type HttpClient, type SettledOptions } from
|
|
|
21
21
|
import { relateSystemActors } from '{{alias.platform}}/auth/relationships/relate-system-actors{{alias.ext}}';
|
|
22
22
|
import { relationTuples } from '{{alias.platform}}/auth/relationships/relation-tuples{{alias.ext}}';
|
|
23
23
|
{{/if}}
|
|
24
|
-
{{#if di.
|
|
24
|
+
{{#if di.container}}
|
|
25
25
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
26
26
|
import type { ContextSelection } from '{{alias.platform}}/composition/context-selection{{alias.ext}}';
|
|
27
27
|
{{/if}}
|
|
28
|
-
{{#unless di.
|
|
28
|
+
{{#unless di.container}}
|
|
29
29
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
30
30
|
{{/unless}}
|
|
31
31
|
import type { AppConfig } from '{{alias.platform}}/config/app-config{{alias.ext}}';
|
|
@@ -270,7 +270,7 @@ function eventsOf(config: AppConfig): EventProvider {
|
|
|
270
270
|
* (an identity provider, a payment service) is answered by its fake of `test/fakes/` here, where
|
|
271
271
|
* the preset or the person who adds it binds it, so that its handlers settle instead of retrying.
|
|
272
272
|
*/
|
|
273
|
-
{{#if di.
|
|
273
|
+
{{#if di.container}}
|
|
274
274
|
function contextsOfTheRun(): ContextSelection {
|
|
275
275
|
const fakes = defineContextModule({
|
|
276
276
|
name: 'end-to-end-fakes',
|
|
@@ -283,7 +283,7 @@ function contextsOfTheRun(): ContextSelection {
|
|
|
283
283
|
return { ...everyContext, modules: [...everyContext.modules, fakes] };
|
|
284
284
|
}
|
|
285
285
|
{{/if}}
|
|
286
|
-
{{#unless di.
|
|
286
|
+
{{#unless di.container}}
|
|
287
287
|
function contextsOfTheRun(): typeof everyContext {
|
|
288
288
|
return everyContext.map((module): (typeof everyContext)[number] => {
|
|
289
289
|
// ddd-ts-kit:e2e-fakes
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
{{#unless httpCache.varnish}}
|
|
14
14
|
import type { IntegrationEvent, IntegrationEventSubscriber, JobScheduler } from '@ddd-ts-kit/kernel';
|
|
15
15
|
{{/unless}}
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
import { defineContextModule } from '@ddd-ts-kit/di';
|
|
18
18
|
{{/if}}
|
|
19
19
|
import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
|
|
20
20
|
{{#if authz.rebac}}
|
|
21
21
|
import { relationTuples } from '{{alias.platform}}/auth/relationships/relation-tuples{{alias.ext}}';
|
|
22
22
|
{{/if}}
|
|
23
|
-
{{#if di.
|
|
23
|
+
{{#if di.container}}
|
|
24
24
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
25
25
|
import type { ContextSelection } from '{{alias.platform}}/composition/context-selection{{alias.ext}}';
|
|
26
26
|
{{/if}}
|
|
27
|
-
{{#unless di.
|
|
27
|
+
{{#unless di.container}}
|
|
28
28
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
29
29
|
{{/unless}}
|
|
30
30
|
{{#if broker.provided}}
|
|
@@ -258,7 +258,7 @@ function eventsOf(config: AppConfig): EventProvider {
|
|
|
258
258
|
* (an identity provider, a payment service) is answered by its fake of `test/fakes/` here, where
|
|
259
259
|
* the preset or the person who adds it binds it, so that its handlers settle instead of retrying.
|
|
260
260
|
*/
|
|
261
|
-
{{#if di.
|
|
261
|
+
{{#if di.container}}
|
|
262
262
|
function contextsOfTheRun(): ContextSelection {
|
|
263
263
|
const fakes = defineContextModule({
|
|
264
264
|
name: 'end-to-end-fakes',
|
|
@@ -271,7 +271,7 @@ function contextsOfTheRun(): ContextSelection {
|
|
|
271
271
|
return { ...everyContext, modules: [...everyContext.modules, fakes] };
|
|
272
272
|
}
|
|
273
273
|
{{/if}}
|
|
274
|
-
{{#unless di.
|
|
274
|
+
{{#unless di.container}}
|
|
275
275
|
function contextsOfTheRun(): typeof everyContext {
|
|
276
276
|
return everyContext.map((module): (typeof everyContext)[number] => {
|
|
277
277
|
// ddd-ts-kit:e2e-fakes
|
|
@@ -4,5 +4,15 @@ import { createTupleStore } from '{{alias.platform}}/auth/relationships/create-t
|
|
|
4
4
|
|
|
5
5
|
relationTupleStoreContract(
|
|
6
6
|
{ describe, it, expect, beforeEach },
|
|
7
|
-
{ name: 'The relation tuple store of the platform', create: createTupleStore },
|
|
7
|
+
{ name: 'The relation tuple store of the platform', create: () => createTupleStore('test') },
|
|
8
8
|
);
|
|
9
|
+
|
|
10
|
+
describe('The relation tuple store of the platform, by environment', () => {
|
|
11
|
+
it.each(['development', 'test'])('starts in memory in %s', (environment) => {
|
|
12
|
+
expect(() => createTupleStore(environment)).not.toThrow();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('refuses production until a store that persists is bound', () => {
|
|
16
|
+
expect(() => createTupleStore('production')).toThrow(/never in production: bind a RelationTupleStore that persists/);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { InMemoryRelationTupleStore, type RelationTupleStore } from '@ddd-ts-kit/auth/rebac';
|
|
2
2
|
|
|
3
|
+
/** Where the tuples may live in memory: nowhere else, production included. */
|
|
4
|
+
const IN_MEMORY_IN = ['development', 'test'];
|
|
5
|
+
|
|
3
6
|
// TODO(platform): answer a persistent store (a table written in the transaction of the change it describes) and hold it to relationTupleStoreContract, as create-tuple-store.contract.spec.ts does for this one.
|
|
4
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Development and test only: the tuples live in this process, so a revocation reaches this
|
|
9
|
+
* instance alone and a restart forgets every grant. It refuses production: bind a
|
|
10
|
+
* RelationTupleStore that persists, an OpenFGA server (`OpenFgaRelationTupleStore` of
|
|
11
|
+
* `@ddd-ts-kit/openfga`) or a table of your database held to `relationTupleStoreContract`.
|
|
12
|
+
*/
|
|
13
|
+
export function createTupleStore(environment: string = process.env['NODE_ENV'] ?? 'development'): RelationTupleStore {
|
|
14
|
+
if (!IN_MEMORY_IN.includes(environment)) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
'The in-memory relation tuple store runs in development and test only, never in production: bind a RelationTupleStore that persists in createTupleStore (OpenFgaRelationTupleStore of @ddd-ts-kit/openfga, or a table of your database held to relationTupleStoreContract)',
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
5
20
|
return new InMemoryRelationTupleStore();
|
|
6
21
|
}
|
|
@@ -7,13 +7,8 @@ import { Access, Authenticator } from '@ddd-ts-kit/auth';
|
|
|
7
7
|
import { Authenticator } from '@ddd-ts-kit/auth';
|
|
8
8
|
{{/unless}}
|
|
9
9
|
{{/if}}
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
kernelModule,
|
|
13
|
-
type Application as Container,
|
|
14
|
-
type ContextModule,
|
|
15
|
-
type JobsOptions,
|
|
16
|
-
} from '@ddd-ts-kit/di';
|
|
10
|
+
import { kernelModule, type Application as Container, type ContextModule, type JobsOptions } from '@ddd-ts-kit/di';
|
|
11
|
+
import { createApplication } from '{{di.entry}}';
|
|
17
12
|
{{#if events.outbox}}
|
|
18
13
|
import { OutboxPublisher } from '@ddd-ts-kit/events';
|
|
19
14
|
{{/if}}
|
|
@@ -29,9 +24,7 @@ import {
|
|
|
29
24
|
{{/if}}
|
|
30
25
|
{{/if}}
|
|
31
26
|
EventBus,
|
|
32
|
-
{{#if http.any}}
|
|
33
27
|
ExecutionScope,
|
|
34
|
-
{{/if}}
|
|
35
28
|
{{#if files.http}}
|
|
36
29
|
FileStorage,
|
|
37
30
|
{{/if}}
|
|
@@ -142,6 +135,7 @@ export interface Application {
|
|
|
142
135
|
/** Where another context, or a test, listens to what this application publishes. */
|
|
143
136
|
readonly eventSubscriber: IntegrationEventSubscriber;
|
|
144
137
|
readonly logger: Logger;
|
|
138
|
+
readonly metrics: Metrics;
|
|
145
139
|
/** Runs a job at once, for a test: `jobs.runNow('<context>.<job>')`. */
|
|
146
140
|
readonly jobs: JobScheduler;
|
|
147
141
|
{{#if cache.rateLimit}}
|
|
@@ -243,6 +237,7 @@ export function composeApplication(
|
|
|
243
237
|
metrics: container.resolve(Metrics),
|
|
244
238
|
cache: container.resolve(Cache),
|
|
245
239
|
clock: container.resolve(Clock),
|
|
240
|
+
scope: container.resolve(ExecutionScope),
|
|
246
241
|
});
|
|
247
242
|
|
|
248
243
|
{{#if audit.route}}
|
|
@@ -372,6 +367,7 @@ function running({ container, options, contexts }: Composed): Application {
|
|
|
372
367
|
eventSubscriber: container.resolve(IntegrationEventSubscriber),
|
|
373
368
|
{{/unless}}
|
|
374
369
|
logger,
|
|
370
|
+
metrics: container.resolve(Metrics),
|
|
375
371
|
jobs: container.resolve(JobScheduler),
|
|
376
372
|
{{#if cache.rateLimit}}
|
|
377
373
|
rateLimiter: container.resolve(RateLimiter),
|
|
@@ -146,6 +146,7 @@ export interface Application {
|
|
|
146
146
|
/** Where another context, or a test, listens to what this application publishes. */
|
|
147
147
|
readonly eventSubscriber: IntegrationEventSubscriber;
|
|
148
148
|
readonly logger: Logger;
|
|
149
|
+
readonly metrics: Platform['metrics'];
|
|
149
150
|
/** Runs a job at once, for a test: `jobs.runNow('<context>.<job>')`. */
|
|
150
151
|
readonly jobs: JobScheduler;
|
|
151
152
|
{{#if cache.rateLimit}}
|
|
@@ -172,9 +173,9 @@ export function composeApplication(
|
|
|
172
173
|
selection: readonly ContextModule[] = everyContext,
|
|
173
174
|
): Application {
|
|
174
175
|
const platform = createPlatform(persistence, options);
|
|
175
|
-
const { logger, metrics, cache, clock } = platform;
|
|
176
|
+
const { logger, metrics, cache, clock, scope } = platform;
|
|
176
177
|
|
|
177
|
-
installAspectRuntime({ logger, metrics, cache, clock });
|
|
178
|
+
installAspectRuntime({ logger, metrics, cache, clock, scope });
|
|
178
179
|
{{#if platformJobs.any}}
|
|
179
180
|
registerPlatformJobs(platform, options);
|
|
180
181
|
{{/if}}
|
|
@@ -234,6 +235,7 @@ export function composeApplication(
|
|
|
234
235
|
eventSubscriber: platform.subscriber,
|
|
235
236
|
{{/unless}}
|
|
236
237
|
logger,
|
|
238
|
+
metrics,
|
|
237
239
|
jobs: platform.jobs,
|
|
238
240
|
{{#if cache.rateLimit}}
|
|
239
241
|
rateLimiter: platform.rateLimiter,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OutboxRelay, type OutboxStore{{#if events.wakeable}}, type RelaySignal{{/if}} } from '@ddd-ts-kit/events';
|
|
2
2
|
{{#if errors.none}}
|
|
3
|
-
import { SystemClock, type IntegrationEventPublisher, type Logger } from '@ddd-ts-kit/kernel';
|
|
3
|
+
import { SystemClock, type IntegrationEventPublisher, type Logger, type Metrics } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{/if}}
|
|
5
5
|
{{#if errors.sentry}}
|
|
6
6
|
import {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type ErrorReporter,
|
|
11
11
|
type IntegrationEventPublisher,
|
|
12
12
|
type Logger,
|
|
13
|
+
type Metrics,
|
|
13
14
|
} from '@ddd-ts-kit/kernel';
|
|
14
15
|
{{/if}}
|
|
15
16
|
{{#if broker.kafka}}
|
|
@@ -24,6 +25,8 @@ export interface OutboxRelayOptions {
|
|
|
24
25
|
/** How many times a publication is tried before its record is declared dead; left out, the default of the relay. */
|
|
25
26
|
readonly maxAttempts?: number;
|
|
26
27
|
readonly logger: Logger;
|
|
28
|
+
/** Where the depth of the outbox goes after each tick (`outbox_pending`, `outbox_failed`, `outbox_dead`); left out (the tests), nowhere. */
|
|
29
|
+
readonly metrics?: Metrics;
|
|
27
30
|
{{#if errors.sentry}}
|
|
28
31
|
/** Where an event whose publication the relay declares dead is reported; left out (the tests), nowhere. */
|
|
29
32
|
readonly errors?: ErrorReporter;
|
|
@@ -48,6 +51,7 @@ export function startOutboxRelay(options: OutboxRelayOptions): RunningRelay {
|
|
|
48
51
|
publisher: options.publisher,
|
|
49
52
|
clock: new SystemClock(),
|
|
50
53
|
...(options.maxAttempts === undefined ? {} : { maxAttempts: options.maxAttempts }),
|
|
54
|
+
...(options.metrics === undefined ? {} : { metrics: options.metrics }),
|
|
51
55
|
{{#if broker.kafka}}
|
|
52
56
|
// The events of one aggregate leave in the order they were stored, under the key Kafka orders them by: it takes a single running relay.
|
|
53
57
|
ordering: 'per-key',
|
|
@@ -14,8 +14,8 @@ export interface LogSettings {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* JSON lines on the standard output,
|
|
18
|
-
*
|
|
17
|
+
* JSON lines on the standard output, the credential keys of the kernel redacted whatever
|
|
18
|
+
* their case (`init --logger pino` or `--logger winston` has a pretty format). Every entry carries
|
|
19
19
|
* what the execution scope knows of the work in progress (correlation id, origin, actor,
|
|
20
20
|
* tenant) and the ids of the active trace, so a request is followed from its log lines to its
|
|
21
21
|
* spans and to its audit entries. `stop()` of the application flushes it, last.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Metrics } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { openTelemetryMetrics } from '@ddd-ts-kit/tracing';
|
|
2
3
|
|
|
3
|
-
//
|
|
4
|
+
// On the meter provider `initTracing` registered (`tracing.ts`, imported first by main.ts): the
|
|
5
|
+
// series leave by OTLP with the spans when `OTEL_EXPORTER_OTLP_ENDPOINT` is set, and are measured
|
|
6
|
+
// by nothing when it is not, nor in the tests.
|
|
4
7
|
export function createMetrics(): Metrics {
|
|
5
|
-
return
|
|
8
|
+
return openTelemetryMetrics({ meterName: '{{project.name}}' });
|
|
6
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The adapters that state their own policy: filled by `ownPolicy` (`own-policy.ts`, which
|
|
3
|
-
* `generate adapter` writes on
|
|
3
|
+
* `generate adapter` writes on a container of the kit), read by `defaultPolicy`, which leaves them alone. The
|
|
4
4
|
* default policy wraps outside the own one, so it finds here the very instance `ownPolicy` returned.
|
|
5
5
|
*/
|
|
6
6
|
export const adaptersWithOwnPolicy = new WeakSet<object>();
|
|
@@ -5,7 +5,7 @@ import type { ResilienceSettings } from '{{alias.platform}}/resilience/resilienc
|
|
|
5
5
|
/**
|
|
6
6
|
* What goes around every adapter that leaves the process (`external`, `gateway`) and states no
|
|
7
7
|
* policy of its own: retries with backoff, and a time limit for each attempt. `forKinds` is the
|
|
8
|
-
* filter: a platform wired by hand gives every adapter to it, the
|
|
8
|
+
* filter: a platform wired by hand gives every adapter to it, the module of the platform only those two kinds.
|
|
9
9
|
*/
|
|
10
10
|
export function defaultPolicy(settings: ResilienceSettings): Aspect {
|
|
11
11
|
const policy = when(
|
|
@@ -13,16 +13,16 @@ paths:
|
|
|
13
13
|
- One folder per concern, no file at the root: `composition/` turns the platform and the contexts into an application, `auth/` holds `authentication/` (who is calling), `authorization/` (what they may do, whatever the model) and the folder of the model, `observability/` the traces, logs, measures{{#if errors.sentry}} and error reports{{/if}}, `jobs/` the settings of the scheduled jobs{{#if audit.route}}, `audit/search-audit-entries/` the read side of the trail{{/if}}. A new file joins the folder of what it answers.
|
|
14
14
|
- `main.ts`, and each `apps/*/main.ts`, imports `platform/observability/tracing.ts` first{{#if errors.sentry}}, `platform/observability/errors.ts` second{{/if}}, then composes the application: nothing else belongs in an entry point.
|
|
15
15
|
- Contexts, routes and registries are added by the generator between `// ddd-ts-kit:` markers: never edit between them, never remove one.
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
- Ports and values are bound by class: `bind(Port).toClass(...)`, `toValue(...)`, or `rebind(Port)` over a default of the kernel module. No token helper, no injection constant; one exported class, interface or function per file.
|
|
18
18
|
- Cross-cutting behaviour lives here: spans through `kernelModule({ instrumentation })` (`composition/lay-foundations.ts`), `around: tracedRoutes()` at the HTTP boundary and `tracedPublisher` for the outbox relay; logs, measures, permissions and audit as bus middlewares (`buses/`); the policy of outbound adapters in `resilience/`.
|
|
19
19
|
{{/if}}
|
|
20
|
-
{{#unless di.
|
|
20
|
+
{{#unless di.container}}
|
|
21
21
|
- One `Platform` is built in `composition/create-platform.ts` and handed to each context; a port or a value is typed by an abstract class. No token helper, no injection constant; one exported class, interface or function per file.
|
|
22
22
|
- Cross-cutting behaviour lives here: spans through the members of `traceApplication()` (`composition/lay-foundations.ts`, handed to the buses and to every adapter by `composition/create-platform.ts`), `around: tracedRoutes()` at the HTTP boundary and `tracedPublisher` for the outbox relay; logs, measures, permissions and audit as bus middlewares (`buses/`); the policy of outbound adapters in `resilience/`.
|
|
23
23
|
{{/unless}}
|
|
24
24
|
{{#if files.any}}
|
|
25
|
-
- Files: `files/open-files.ts` opens the connector of `stack.storage` from `config/read-files.ts`{{#if di.
|
|
25
|
+
- Files: `files/open-files.ts` opens the connector of `stack.storage` from `config/read-files.ts`{{#if di.container}}, `files/files.module.ts` binds the ports and the hourly purge of staged files, `files/staging-uploads.ts` stages the file a command carries on the command bus, before the transaction{{/if}}{{#unless di.container}}, `files/create-files.ts` builds them, `composition/compose-application.ts` registers the hourly purge of staged files and `buses/create-command-bus.ts` stages the file a command carries on the command bus, before the transaction{{/unless}}; the tools and the tests keep files in memory. A scanner of your own (an antivirus) is bound here, never called from a use case.
|
|
26
26
|
{{/if}}
|
|
27
27
|
- `@ddd-ts-kit/tracing` and `@opentelemetry/*` are imported here and nowhere else (`tracing/platform-only`).
|
|
28
28
|
- Logs, spans and error reports carry identifiers and codes only: never arguments, payloads, error messages, nor anything personal beyond the id of the actor.
|
|
@@ -8,11 +8,11 @@ paths:
|
|
|
8
8
|
# Tests
|
|
9
9
|
|
|
10
10
|
- `test/unit/`: aggregates, value objects and domain services without any double, given / when / then on the recorded facts; handlers with the fakes of `test/fakes/`.
|
|
11
|
-
{{#if di.
|
|
11
|
+
{{#if di.container}}
|
|
12
12
|
- A handler spec goes through the test application, `createTestApplication({ modules, fakes: [fake(Port, aFake)] })`: it asserts the stored state, the facts announced with the save and heard at the end of the command (`application.domainEvents`), `application.eventBus.published`, and the refusal (`FORBIDDEN`) of an actor without the permission.
|
|
13
13
|
- A job spec runs the job by its name, `await application.jobs.runNow('<context>.<job>')`, and asserts the command it sent as its system actor.
|
|
14
14
|
{{/if}}
|
|
15
|
-
{{#unless di.
|
|
15
|
+
{{#unless di.container}}
|
|
16
16
|
- A handler spec goes through the buses of `createTestBuses()`, the fake repository wrapped by `dispatching(...)`: it asserts the stored state, the facts announced with the save and heard at the end of the command (`domainEvents`), `publishedEvents()`, and the refusal (`FORBIDDEN`) of an actor without the permission.
|
|
17
17
|
- A job spec runs the job with an occurrence, `await job.run(occurrence)`, and asserts the command it sent as its system actor.
|
|
18
18
|
{{/unless}}
|
|
@@ -15,10 +15,11 @@ runs:
|
|
|
15
15
|
# The newest patch of the release line, not the one the image of the runner holds: a security
|
|
16
16
|
# release of Node reaches the next run.
|
|
17
17
|
check-latest: true
|
|
18
|
-
{{#if pm.
|
|
18
|
+
{{#if pm.pinned}}
|
|
19
19
|
- name: The package manager package.json pins
|
|
20
20
|
shell: bash
|
|
21
|
-
run:
|
|
21
|
+
run: |
|
|
22
|
+
npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
22
23
|
{{/if}}
|
|
23
24
|
# One install per lockfile, shared by every job and every run. The key holds the lockfile and
|
|
24
25
|
# package.json: a hit is what a fresh install of that lockfile gives, and a manifest that left
|
|
@@ -262,6 +262,10 @@ jobs:
|
|
|
262
262
|
mutation-changed:
|
|
263
263
|
name: Mutation score of the change
|
|
264
264
|
needs: install
|
|
265
|
+
# gh run list and gh run download read the runs of the workflow: contents alone is refused on a private repository.
|
|
266
|
+
permissions:
|
|
267
|
+
contents: read
|
|
268
|
+
actions: read
|
|
265
269
|
# A pull request: the report of the last night is reused for what the change leaves alone, and the survivors of the files it touched are listed. A reading, not a gate: the floor is held by the night.
|
|
266
270
|
if: ${{ github.event_name == 'pull_request' }}
|
|
267
271
|
runs-on: ubuntu-26.04
|
|
@@ -75,8 +75,8 @@ default:
|
|
|
75
75
|
- node_modules/
|
|
76
76
|
policy: pull
|
|
77
77
|
before_script:
|
|
78
|
-
{{#if pm.
|
|
79
|
-
-
|
|
78
|
+
{{#if pm.pinned}}
|
|
79
|
+
- npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
80
80
|
{{/if}}
|
|
81
81
|
- test -d node_modules || npm ci
|
|
82
82
|
{{#if orm.prisma}}
|
|
@@ -253,6 +253,10 @@ mutation_changed:
|
|
|
253
253
|
extends: .node
|
|
254
254
|
stage: test
|
|
255
255
|
needs: [install]
|
|
256
|
+
# The image with git, as install: the files of the change are read from the difference with the target branch.
|
|
257
|
+
image: node:24-bookworm
|
|
258
|
+
# A reading, not a gate: a night without a report or a runner that fails leaves the merge request open.
|
|
259
|
+
allow_failure: true
|
|
256
260
|
# A merge request: the report of the last night is reused for what the change leaves alone, and the survivors of the files it touched are listed. A reading, not a gate: the floor is held by the night.
|
|
257
261
|
rules:
|
|
258
262
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"ci:build": "npm run build"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@biomejs/biome": "2.6.
|
|
23
|
+
"@biomejs/biome": "2.6.3",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.107.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "^5.0.3",
|
|
@@ -39,10 +39,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* A person deactivates their own account, which leaves every organisation it belongs to and ends
|
|
42
|
-
* every delegation it gave or received there, in the same unit of work
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* the
|
|
42
|
+
* every delegation it gave or received there, in the same unit of work. This context refuses the
|
|
43
|
+
* account at once; the other contexts read the token, so they refuse it at its next token: a
|
|
44
|
+
* token already issued lives until it expires (300 s in the realm of the kit). A project that
|
|
45
|
+
* wants no window checks the account at the edge. The last owner of an organisation is refused:
|
|
46
|
+
* they appoint another owner first. The provider is asked to disable the person once it is
|
|
47
|
+
* committed (`application/integration/handlers/`).
|
|
46
48
|
*/
|
|
47
49
|
async execute({ actor }: DeactivateAccountCommand): Promise<string> {
|
|
48
50
|
const account = await this.accountRepository.findById(actor.id);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { afterAll, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
|
|
2
|
-
{{#if di.
|
|
3
|
-
import { contextModule,
|
|
2
|
+
{{#if di.container}}
|
|
3
|
+
import { contextModule, kernelModule } from '@ddd-ts-kit/di';
|
|
4
|
+
import { createApplication } from '{{di.entry}}';
|
|
4
5
|
{{/if}}
|
|
5
|
-
{{#if di.
|
|
6
|
+
{{#if di.container}}
|
|
6
7
|
import {
|
|
7
8
|
FixedClock,
|
|
8
9
|
FixedExecutionScope,
|
|
@@ -13,10 +14,10 @@ import {
|
|
|
13
14
|
type ScheduledJob,
|
|
14
15
|
} from '@ddd-ts-kit/kernel';
|
|
15
16
|
{{/if}}
|
|
16
|
-
{{#unless di.
|
|
17
|
+
{{#unless di.container}}
|
|
17
18
|
import { FixedClock, FixedExecutionScope, executionContext, type Actor } from '@ddd-ts-kit/kernel';
|
|
18
19
|
{{/unless}}
|
|
19
|
-
{{#if di.
|
|
20
|
+
{{#if di.container}}
|
|
20
21
|
import { Scheduled } from '@ddd-ts-kit/kernel/declarations';
|
|
21
22
|
{{/if}}
|
|
22
23
|
import { {{preset.adapter.pascal}}OrganisationRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-organisation.repository{{alias.ext}}';
|
|
@@ -67,7 +68,7 @@ describe('{{preset.adapter.pascal}}OrganisationTenantDirectory', () => {
|
|
|
67
68
|
await organisations.save(anOrganisation().identifiedBy('globex').build());
|
|
68
69
|
expect(await directory.tenants()).toEqual(['acme', 'globex']);
|
|
69
70
|
});
|
|
70
|
-
{{#if di.
|
|
71
|
+
{{#if di.container}}
|
|
71
72
|
|
|
72
73
|
it('gives an organisation opened after the boot its run of a per-tenant job', async () => {
|
|
73
74
|
const { organisations, directory } = arrange();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RoleBasedAuthorizer } from '@ddd-ts-kit/auth';
|
|
2
2
|
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
3
3
|
import { anActor } from '@ddd-ts-kit/auth/testing';
|
|
4
|
-
import { contextModule,
|
|
4
|
+
import { contextModule, fake } from '@ddd-ts-kit/di';
|
|
5
|
+
import { createTestApplication } from '{{di.entry}}';
|
|
5
6
|
import type { Actor } from '@ddd-ts-kit/kernel';
|
|
6
7
|
import * as {{context.camel}}Declarations from '{{alias.context}}/{{context.kebab}}.declarations{{alias.ext}}';
|
|
7
8
|
import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
|
|
@@ -9,8 +9,10 @@ what their token says (`PUT /accounts/me`) and refreshed at each later one. No p
|
|
|
9
9
|
of the provider is stored here. The email address of an account is always the one of the token,
|
|
10
10
|
never one a client sends, and one the provider verified (`email_verified`): an invitation is
|
|
11
11
|
matched on it. A deactivated account leaves every organisation and ends every delegation in the
|
|
12
|
-
same unit of work
|
|
13
|
-
|
|
12
|
+
same unit of work; the last owner of an organisation appoints another owner before deactivating.
|
|
13
|
+
This context refuses the account at once, the other contexts at its next token: they read the
|
|
14
|
+
token, and a token already issued lives until it expires (300 s in the realm of the kit). A
|
|
15
|
+
project that wants no window checks the account at the edge.
|
|
14
16
|
|
|
15
17
|
**Organisations, members and roles.** An organisation is opened under its slug, which is its
|
|
16
18
|
identity for good, and its opener is its first owner. A member holds one role, `owner`, `admin`
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
@@imports
|
|
2
|
-
{{#if di.
|
|
2
|
+
{{#if di.container}}
|
|
3
3
|
import { IdentityProviderAdmin } from '{{alias.context}}/application/ports/identity-provider-admin.port{{alias.ext}}';
|
|
4
4
|
{{/if}}
|
|
5
|
-
{{#unless di.
|
|
5
|
+
{{#unless di.container}}
|
|
6
6
|
import { {{context.camel}}Module } from '{{alias.context}}/{{context.kebab}}.module{{alias.ext}}';
|
|
7
7
|
{{/unless}}
|
|
8
8
|
import { FakeIdentityProviderAdmin } from '{{alias.context}}/test/fakes/identity-provider-admin.fake{{alias.ext}}';
|
|
9
9
|
@@e2e-fakes
|
|
10
|
-
{{#if di.
|
|
10
|
+
{{#if di.container}}
|
|
11
11
|
builder.rebind(IdentityProviderAdmin).toValue(new FakeIdentityProviderAdmin());
|
|
12
12
|
{{/if}}
|
|
13
|
-
{{#unless di.
|
|
13
|
+
{{#unless di.container}}
|
|
14
14
|
if (module === {{context.camel}}Module) {
|
|
15
15
|
return (platform) => {{context.camel}}Module(platform, { identityProvider: new FakeIdentityProviderAdmin() });
|
|
16
16
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Message } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/change-member-role/change-member-role.command{{alias.ext}}';
|
|
3
|
+
import { GrantDelegationCommand } from '{{alias.context}}/application/commands/grant-delegation/grant-delegation.command{{alias.ext}}';
|
|
4
|
+
import { InviteMemberCommand } from '{{alias.context}}/application/commands/invite-member/invite-member.command{{alias.ext}}';
|
|
5
|
+
import { OpenOrganisationCommand } from '{{alias.context}}/application/commands/open-organisation/open-organisation.command{{alias.ext}}';
|
|
6
|
+
import { RemoveMemberCommand } from '{{alias.context}}/application/commands/remove-member/remove-member.command{{alias.ext}}';
|
|
7
|
+
import { RevokeDelegationCommand } from '{{alias.context}}/application/commands/revoke-delegation/revoke-delegation.command{{alias.ext}}';
|
|
8
|
+
import { RevokeInvitationCommand } from '{{alias.context}}/application/commands/revoke-invitation/revoke-invitation.command{{alias.ext}}';
|
|
9
|
+
import { OrganisationSlug } from '{{alias.context}}/domain/value-objects/organisation-slug.vo{{alias.ext}}';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The organisation a command of the {{context.kebab}} context acts on, whose audit chain receives its
|
|
13
|
+
* entry once it succeeded, whatever organisation the token of its sender names: the owner of an
|
|
14
|
+
* organisation reads there who opened it, invited, removed, changed a role or lent a right in it.
|
|
15
|
+
* The entry of a failure, and the decision of the authorization, stay in the tenant of the token,
|
|
16
|
+
* since they record what the sender asked. Accepting or declining an invitation names its token
|
|
17
|
+
* only: the organisation it joins reads `{{context.kebab}}.member.joined` in its own chain.
|
|
18
|
+
*/
|
|
19
|
+
export function organisationOfCommand(message: Message): string | undefined {
|
|
20
|
+
if (message instanceof OpenOrganisationCommand) {
|
|
21
|
+
return OrganisationSlug.create(message.organisation.slug).value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (
|
|
25
|
+
message instanceof ChangeMemberRoleCommand ||
|
|
26
|
+
message instanceof GrantDelegationCommand ||
|
|
27
|
+
message instanceof InviteMemberCommand ||
|
|
28
|
+
message instanceof RemoveMemberCommand ||
|
|
29
|
+
message instanceof RevokeDelegationCommand ||
|
|
30
|
+
message instanceof RevokeInvitationCommand
|
|
31
|
+
) {
|
|
32
|
+
return message.organisationId;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
@@ -24,7 +24,7 @@ export class EventStore{{aggregate.pascal}}Repository implements {{aggregate.pas
|
|
|
24
24
|
category: '{{context.kebab}}.{{aggregate.kebab}}',
|
|
25
25
|
serializer: new EventSerializer<{{aggregate.pascal}}Event>({{aggregate.camel}}Events, { cipher }),
|
|
26
26
|
rehydrate: (id, history) => {{aggregate.pascal}}.rehydrate(id, history),
|
|
27
|
-
// TODO(domain): when a stream grows long enough to slow a load, add `snapshots: { ...{{aggregate.camel}}Snapshots, store: snapshots, every: <n> }` (a SnapshotStore injected here, a snapshot mapper with its own shape version): see docs/concepts/event-sourcing.md of ddd-ts-kit.
|
|
27
|
+
// TODO(domain): when a stream grows long enough to slow a load, add `snapshots: { ...{{aggregate.camel}}Snapshots, store: snapshots, every: <n> }` (a SnapshotStore injected here, a snapshot mapper with its own shape version, which seals a personal value with personalData as the events do): see docs/concepts/event-sourcing.md of ddd-ts-kit.
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -12,7 +12,7 @@ export const {{aggregate.pascal}}Mapper = {
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
toRow(saved: {{aggregate.pascal}}): {{aggregate.pascal}}Columns {
|
|
15
|
-
// TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file. A `jsonb` column holding an array or a string takes `
|
|
15
|
+
// TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file. A `jsonb` column holding an array or a string takes `jsonColumn(value)` of `@ddd-ts-kit/knex` on Knex, where the other ORM serialize it.
|
|
16
16
|
{{#if personal.any}}
|
|
17
17
|
return {
|
|
18
18
|
id: saved.id,
|
|
@@ -14,7 +14,7 @@ export const {{aggregate.tableCamel}} = new EntitySchema<{{aggregate.pascal}}Row
|
|
|
14
14
|
{{#if personal.any}}
|
|
15
15
|
{{personal.typeormTable}}
|
|
16
16
|
{{/if}}
|
|
17
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`.
|
|
17
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`. A jsonb field is typed `JsonDocument` of `@ddd-ts-kit/typeorm` or a named interface, never `Record<string, unknown>`, which the insert and the update of TypeORM refuse to compile.
|
|
18
18
|
version: { type: 'int' },
|
|
19
19
|
...tenantColumn(),
|
|
20
20
|
...auditColumns(),
|
|
@@ -32,7 +32,7 @@ export const {{aggregate.tableCamel}} = new EntitySchema<{{aggregate.pascal}}Row
|
|
|
32
32
|
{{#if personal.any}}
|
|
33
33
|
{{personal.typeormTable}}
|
|
34
34
|
{{/if}}
|
|
35
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`.
|
|
35
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`. A jsonb field is typed `JsonDocument` of `@ddd-ts-kit/typeorm` or a named interface, never `Record<string, unknown>`, which the insert and the update of TypeORM refuse to compile.
|
|
36
36
|
version: { type: 'int' },
|
|
37
37
|
...auditColumns(),
|
|
38
38
|
},
|
|
@@ -246,7 +246,16 @@ function texts(values: CallRequest['header']): Record<string, string> {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
function pathOf(template: string, values: CallRequest['path']): string {
|
|
249
|
-
return template.replace(/\{([^}]+)\}/g, (_match, name: string) =>
|
|
249
|
+
return template.replace(/\{([^}]+)\}/g, (_match, name: string) => segmentOf(name, String(values?.[name] ?? '')));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** One segment of the path: empty or a dot segment, a URL would drop it and the call would reach another route. */
|
|
253
|
+
function segmentOf(name: string, value: string): string {
|
|
254
|
+
if (value === '' || value === '.' || value === '..') {
|
|
255
|
+
throw new TypeError(`The path parameter "${name}" is empty or a dot segment: it names no segment of the path.`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return encodeURIComponent(value);
|
|
250
259
|
}
|
|
251
260
|
|
|
252
261
|
/** A list is sent as the parameter repeated, the form OpenAPI calls `explode`. */
|
|
File without changes
|
|
File without changes
|