ddd-ts-kit 0.90.0 → 0.91.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 +285 -0
- package/README.fr.md +39 -7
- package/README.md +35 -6
- package/dist/alias/index.d.ts +2 -1
- package/dist/alias/index.d.ts.map +1 -1
- package/dist/alias/index.js +1 -0
- package/dist/alias/index.js.map +1 -1
- package/dist/alias/mapper-target-text.d.ts +4 -0
- package/dist/alias/mapper-target-text.d.ts.map +1 -0
- package/dist/alias/mapper-target-text.js +5 -0
- package/dist/alias/mapper-target-text.js.map +1 -0
- package/dist/alias/module-name-mapper.d.ts +5 -2
- package/dist/alias/module-name-mapper.d.ts.map +1 -1
- package/dist/alias/module-name-mapper.js +5 -2
- package/dist/alias/module-name-mapper.js.map +1 -1
- package/dist/check/alias/test-runners.js +8 -3
- package/dist/check/alias/test-runners.js.map +1 -1
- package/dist/check/baseline/apply-baseline.d.ts +14 -0
- package/dist/check/baseline/apply-baseline.d.ts.map +1 -0
- package/dist/check/baseline/apply-baseline.js +30 -0
- package/dist/check/baseline/apply-baseline.js.map +1 -0
- package/dist/check/baseline/baseline-following-moves.d.ts +9 -0
- package/dist/check/baseline/baseline-following-moves.d.ts.map +1 -0
- package/dist/check/baseline/baseline-following-moves.js +10 -0
- package/dist/check/baseline/baseline-following-moves.js.map +1 -0
- package/dist/check/baseline/baseline-move.d.ts +6 -0
- package/dist/check/baseline/baseline-move.d.ts.map +1 -0
- package/dist/check/baseline/baseline-move.js +2 -0
- package/dist/check/baseline/baseline-move.js.map +1 -0
- package/dist/check/baseline/baseline-text.d.ts +4 -0
- package/dist/check/baseline/baseline-text.d.ts.map +1 -0
- package/dist/check/baseline/baseline-text.js +12 -0
- package/dist/check/baseline/baseline-text.js.map +1 -0
- package/dist/check/baseline/baseline.d.ts +6 -0
- package/dist/check/baseline/baseline.d.ts.map +1 -0
- package/dist/check/baseline/baseline.js +2 -0
- package/dist/check/baseline/baseline.js.map +1 -0
- package/dist/check/baseline/moved-baseline-text.d.ts +4 -0
- package/dist/check/baseline/moved-baseline-text.d.ts.map +1 -0
- package/dist/check/baseline/moved-baseline-text.js +13 -0
- package/dist/check/baseline/moved-baseline-text.js.map +1 -0
- package/dist/check/baseline/parse-baseline.d.ts +4 -0
- package/dist/check/baseline/parse-baseline.d.ts.map +1 -0
- package/dist/check/baseline/parse-baseline.js +19 -0
- package/dist/check/baseline/parse-baseline.js.map +1 -0
- package/dist/check/baseline/pruned-baseline.d.ts +5 -0
- package/dist/check/baseline/pruned-baseline.d.ts.map +1 -0
- package/dist/check/baseline/pruned-baseline.js +14 -0
- package/dist/check/baseline/pruned-baseline.js.map +1 -0
- package/dist/check/baseline/read-baseline.d.ts +6 -0
- package/dist/check/baseline/read-baseline.d.ts.map +1 -0
- package/dist/check/baseline/read-baseline.js +11 -0
- package/dist/check/baseline/read-baseline.js.map +1 -0
- package/dist/check/baseline/recorded-baseline.d.ts +5 -0
- package/dist/check/baseline/recorded-baseline.d.ts.map +1 -0
- package/dist/check/baseline/recorded-baseline.js +11 -0
- package/dist/check/baseline/recorded-baseline.js.map +1 -0
- package/dist/check/baseline/renamed-files.d.ts +8 -0
- package/dist/check/baseline/renamed-files.d.ts.map +1 -0
- package/dist/check/baseline/renamed-files.js +23 -0
- package/dist/check/baseline/renamed-files.js.map +1 -0
- package/dist/check/baseline/write-baseline.d.ts +4 -0
- package/dist/check/baseline/write-baseline.d.ts.map +1 -0
- package/dist/check/baseline/write-baseline.js +9 -0
- package/dist/check/baseline/write-baseline.js.map +1 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -1
- package/dist/check/canonical/stray-entry.js +5 -1
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/commands/check-command.d.ts.map +1 -1
- package/dist/check/commands/check-command.js +46 -1
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/commands/check-file-command.d.ts +5 -0
- package/dist/check/commands/check-file-command.d.ts.map +1 -1
- package/dist/check/commands/check-file-command.js +27 -6
- package/dist/check/commands/check-file-command.js.map +1 -1
- package/dist/check/explain/nest-docs.d.ts +3 -0
- package/dist/check/explain/nest-docs.d.ts.map +1 -0
- package/dist/check/explain/nest-docs.js +31 -0
- package/dist/check/explain/nest-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.js +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts +3 -0
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/nest-controllers-fixtures.js +86 -0
- package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -0
- package/dist/check/fixtures/nest-fixtures.d.ts +3 -0
- package/dist/check/fixtures/nest-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/nest-fixtures.js +59 -0
- package/dist/check/fixtures/nest-fixtures.js.map +1 -0
- package/dist/check/nest/nest-equivalents-of.d.ts +14 -0
- package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -0
- package/dist/check/nest/nest-equivalents-of.js +119 -0
- package/dist/check/nest/nest-equivalents-of.js.map +1 -0
- package/dist/check/project/load-project.d.ts +2 -0
- package/dist/check/project/load-project.d.ts.map +1 -1
- package/dist/check/project/load-project.js +7 -3
- package/dist/check/project/load-project.js.map +1 -1
- package/dist/check/rules/nest-controllers-current.d.ts +3 -0
- package/dist/check/rules/nest-controllers-current.d.ts.map +1 -0
- package/dist/check/rules/nest-controllers-current.js +43 -0
- package/dist/check/rules/nest-controllers-current.js.map +1 -0
- package/dist/check/rules/nest-no-parallel-pipeline.d.ts +3 -0
- package/dist/check/rules/nest-no-parallel-pipeline.d.ts.map +1 -0
- package/dist/check/rules/nest-no-parallel-pipeline.js +70 -0
- package/dist/check/rules/nest-no-parallel-pipeline.js.map +1 -0
- package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
- package/dist/check/support/is-generated-context-file.js +4 -1
- package/dist/check/support/is-generated-context-file.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-config.js +1 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/serialize-config.js +9 -2
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/config/stack.d.ts +17 -4
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +4 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +4 -1
- package/dist/dev/refresh-declarations.js.map +1 -1
- 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/file-moves/move-files.d.ts.map +1 -1
- package/dist/file-moves/move-files.js +10 -0
- package/dist/file-moves/move-files.js.map +1 -1
- package/dist/generate/kinds/property-kind.d.ts +3 -0
- package/dist/generate/kinds/property-kind.d.ts.map +1 -0
- package/dist/generate/kinds/property-kind.js +51 -0
- package/dist/generate/kinds/property-kind.js.map +1 -0
- package/dist/generate/kinds/route/nest-controller-vars.d.ts +11 -0
- package/dist/generate/kinds/route/nest-controller-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/nest-controller-vars.js +97 -0
- package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -0
- package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/route-vars.js +1 -9
- package/dist/generate/kinds/route/route-vars.js.map +1 -1
- package/dist/generate/kinds/route/success-status.d.ts +5 -0
- package/dist/generate/kinds/route/success-status.d.ts.map +1 -0
- package/dist/generate/kinds/route/success-status.js +11 -0
- package/dist/generate/kinds/route/success-status.js.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts +8 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.js +52 -0
- package/dist/generate/kinds/route/write-nest-controller.js.map +1 -0
- package/dist/generate/kinds/route-kind.d.ts.map +1 -1
- package/dist/generate/kinds/route-kind.js +6 -1
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +2 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +2 -0
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +5 -0
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +4 -2
- package/dist/help/usage.js.map +1 -1
- 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/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +2 -0
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/knip-vars.d.ts.map +1 -1
- package/dist/init/knip-vars.js +10 -2
- package/dist/init/knip-vars.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts +18 -0
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -0
- package/dist/init/manifest/dependencies-against-stack.js +95 -0
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -0
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +12 -2
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/scripts-for.js +5 -2
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +30 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +14 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-queue.d.ts +4 -10
- package/dist/init/stack/resolve-queue.d.ts.map +1 -1
- package/dist/init/stack/resolve-queue.js +7 -11
- package/dist/init/stack/resolve-queue.js.map +1 -1
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +23 -4
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/nest-controllers/controllers-file.d.ts +3 -0
- package/dist/nest-controllers/controllers-file.d.ts.map +1 -0
- package/dist/nest-controllers/controllers-file.js +5 -0
- package/dist/nest-controllers/controllers-file.js.map +1 -0
- package/dist/nest-controllers/nest-answer.d.ts +16 -0
- package/dist/nest-controllers/nest-answer.d.ts.map +1 -0
- package/dist/nest-controllers/nest-answer.js +2 -0
- package/dist/nest-controllers/nest-answer.js.map +1 -0
- package/dist/nest-controllers/nest-controller-entry.d.ts +16 -0
- package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -0
- package/dist/nest-controllers/nest-controller-entry.js +2 -0
- package/dist/nest-controllers/nest-controller-entry.js.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts +15 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.js +89 -0
- package/dist/nest-controllers/read-nest-controllers.js.map +1 -0
- package/dist/nest-controllers/refresh-nest-controllers.d.ts +9 -0
- package/dist/nest-controllers/refresh-nest-controllers.d.ts.map +1 -0
- package/dist/nest-controllers/refresh-nest-controllers.js +32 -0
- package/dist/nest-controllers/refresh-nest-controllers.js.map +1 -0
- package/dist/nest-controllers/render-controllers-file.d.ts +8 -0
- package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -0
- package/dist/nest-controllers/render-controllers-file.js +56 -0
- package/dist/nest-controllers/render-controllers-file.js.map +1 -0
- package/dist/platform-folders/platform-folders.d.ts.map +1 -1
- package/dist/platform-folders/platform-folders.js +10 -0
- package/dist/platform-folders/platform-folders.js.map +1 -1
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +22 -2
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/identity-preset.d.ts.map +1 -1
- package/dist/presets/identity-preset.js +4 -1
- package/dist/presets/identity-preset.js.map +1 -1
- package/dist/presets/identity-refusal.d.ts.map +1 -1
- package/dist/presets/identity-refusal.js +11 -5
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/lay-out-prisma-models.d.ts +8 -0
- package/dist/presets/lay-out-prisma-models.d.ts.map +1 -0
- package/dist/presets/lay-out-prisma-models.js +51 -0
- package/dist/presets/lay-out-prisma-models.js.map +1 -0
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +3 -0
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/presets/preset.d.ts +11 -0
- package/dist/presets/preset.d.ts.map +1 -1
- package/dist/sdk/client-files.d.ts +5 -3
- package/dist/sdk/client-files.d.ts.map +1 -1
- package/dist/sdk/client-files.js +8 -3
- package/dist/sdk/client-files.js.map +1 -1
- package/dist/sdk/client-manifest.d.ts +3 -0
- package/dist/sdk/client-manifest.d.ts.map +1 -1
- package/dist/sdk/client-manifest.js +15 -2
- package/dist/sdk/client-manifest.js.map +1 -1
- package/dist/sdk/client-operation.d.ts +6 -0
- package/dist/sdk/client-operation.d.ts.map +1 -1
- package/dist/sdk/read-operation.d.ts.map +1 -1
- package/dist/sdk/read-operation.js +6 -0
- package/dist/sdk/read-operation.js.map +1 -1
- package/dist/sdk/render-orpc.d.ts +8 -0
- package/dist/sdk/render-orpc.d.ts.map +1 -0
- package/dist/sdk/render-orpc.js +42 -0
- package/dist/sdk/render-orpc.js.map +1 -0
- package/dist/sdk/render-readme.d.ts +3 -0
- package/dist/sdk/render-readme.d.ts.map +1 -1
- package/dist/sdk/render-readme.js +46 -0
- package/dist/sdk/render-readme.js.map +1 -1
- package/dist/sdk/render-trpc.d.ts +9 -0
- package/dist/sdk/render-trpc.d.ts.map +1 -0
- package/dist/sdk/render-trpc.js +36 -0
- package/dist/sdk/render-trpc.js.map +1 -0
- package/dist/sdk/rpc-packages.d.ts +7 -0
- package/dist/sdk/rpc-packages.d.ts.map +1 -0
- package/dist/sdk/rpc-packages.js +9 -0
- package/dist/sdk/rpc-packages.js.map +1 -0
- package/dist/sdk/rpc.d.ts +4 -0
- package/dist/sdk/rpc.d.ts.map +1 -0
- package/dist/sdk/rpc.js +2 -0
- package/dist/sdk/rpc.js.map +1 -0
- package/dist/sdk/write-clients.d.ts.map +1 -1
- package/dist/sdk/write-clients.js +18 -3
- package/dist/sdk/write-clients.js.map +1 -1
- package/dist/stack/alias-vars.d.ts.map +1 -1
- package/dist/stack/alias-vars.js +2 -2
- package/dist/stack/alias-vars.js.map +1 -1
- package/dist/stack/audit-vars.js +1 -1
- package/dist/stack/audit-vars.js.map +1 -1
- package/dist/stack/cache-vars.d.ts +5 -1
- package/dist/stack/cache-vars.d.ts.map +1 -1
- package/dist/stack/cache-vars.js +9 -3
- package/dist/stack/cache-vars.js.map +1 -1
- package/dist/stack/stack-vars.d.ts +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +11 -6
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/templates/architecture/extractable.declared.spec.ts.tpl +22 -17
- package/templates/architecture/extractable.manual.spec.ts.tpl +14 -9
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +19 -14
- package/templates/context/module.manual.ts.tpl +11 -0
- package/templates/init/jest.config.js.tpl +6 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +50 -0
- package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +9 -3
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +1 -1
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +1 -1
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +7 -1
- package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +23 -1
- package/templates/init/platform/database/persistence.contract.spec.ts.tpl +113 -0
- package/templates/init/platform/database/persistence.orm.ts.tpl +8 -3
- package/templates/init/platform/database/schema.prisma.tpl +3 -1
- package/templates/init/platform/database/schema.typeorm.ts.tpl +17 -3
- package/templates/init/platform/database/table-statements.drizzle.ts.tpl +36 -0
- package/templates/init/platform/files/bind-files.tsyringe.ts.tpl +1 -1
- package/templates/init/platform/files/create-files.ts.tpl +1 -1
- package/templates/init/platform/http/create-app-module.ts.tpl +20 -0
- package/templates/init/platform/http/start-http-server.express.ts.tpl +48 -1
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +50 -2
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +60 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +61 -3
- package/templates/init/platform/jobs/create-background-work.ts.tpl +2 -2
- package/templates/init/rules/infrastructure.md.tpl +3 -0
- package/templates/init/rules/presentation.md.tpl +7 -0
- package/templates/nest-controller/controller.spec.ts.tpl +57 -0
- package/templates/nest-controller/controller.ts.tpl +65 -0
- package/templates/pipeline/knip.json.tpl +4 -8
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +254 -0
- package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +6 -0
- package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.mapper.prisma.ts.tpl +36 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.prisma.ts.tpl +19 -0
- package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.prisma.ts.tpl +48 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.prisma.ts.tpl +43 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.prisma.ts.tpl +20 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/member.mapper.prisma.ts.tpl +34 -0
- package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.prisma.ts.tpl +26 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-account.repository.prisma.ts.tpl +63 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-delegation.repository.prisma.ts.tpl +81 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-invitation.repository.prisma.ts.tpl +69 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-member.repository.prisma.ts.tpl +80 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation.repository.prisma.ts.tpl +63 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-search-members-reader.repository.prisma.ts.tpl +82 -0
- package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +3 -3
- package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +3 -3
- package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +8 -8
- package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +95 -0
- package/templates/presets/identity/context/test/worlds/__context__.world.explicit.ts.tpl +332 -0
- package/templates/presets/identity/explicit/access-policies.wiring.tpl +16 -0
- package/templates/presets/identity/prisma/models.prisma.tpl +128 -0
- package/templates/property/value-object.properties.spec.ts.tpl +38 -0
- package/templates/sdk/orpc.ts.tpl +46 -0
- package/templates/sdk/trpc.ts.tpl +86 -0
- /package/templates/presets/identity/context/test/worlds/{__context__.world.ts.tpl → __context__.world.declared.ts.tpl} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,291 @@ What each version changes for someone who uses the kit. The packages of `package
|
|
|
4
4
|
together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
|
|
5
5
|
list the pull requests behind it.
|
|
6
6
|
|
|
7
|
+
## 0.91.0
|
|
8
|
+
|
|
9
|
+
**The background jobs and the process instances go to the database by default on every ORM of
|
|
10
|
+
the kit and with every container: `TypeOrmJobStore` and `TypeOrmProcessStore`, and one rule for
|
|
11
|
+
`init --queue`.** `@ddd-ts-kit/typeorm` gains the job store and the process store, with their
|
|
12
|
+
tables `jobEntity()` and `processEntity()`, held to `jobStoreContract` and `processStoreContract`
|
|
13
|
+
on PGlite and on PostgreSQL: a job enqueued by a command is written by its transaction, a claim
|
|
14
|
+
takes the due rows `FOR UPDATE SKIP LOCKED`, an idempotency key is unique per job name and tenant,
|
|
15
|
+
a step of a process manager saves its instance in its unit of work. `init --orm typeorm` now
|
|
16
|
+
accepts `--queue database` and writes the two entities in the `messaging` schema. And the default
|
|
17
|
+
of `--queue` no longer depends on the container: `database` on Knex, Drizzle, Prisma and TypeORM
|
|
18
|
+
with tsyringe, Nest or a platform wired by hand, `memory` with a custom persistence or none. Until
|
|
19
|
+
now a project under Nest or wired by hand kept its jobs in memory unless it asked otherwise.
|
|
20
|
+
|
|
21
|
+
To move: nothing for an existing project, whose `stack.queue` is kept. A new project under Nest or
|
|
22
|
+
wired by hand that wants its jobs in memory passes `--queue memory`.
|
|
23
|
+
|
|
24
|
+
**The identity preset is written on Prisma: `init --orm prisma --preset identity`.** The context
|
|
25
|
+
comes with its Prisma adapters (the repositories of the five aggregates, the search reader of the
|
|
26
|
+
members, their mappers over the generated client, the declarations of the personal fields), and
|
|
27
|
+
its models and enums laid out in `prisma/schema.prisma` in place of the ones the generators start:
|
|
28
|
+
the closed vocabularies (the role of a member, the status of an account and of an invitation) are
|
|
29
|
+
enums of the schema, the token of an invitation is unique, and one current membership per account
|
|
30
|
+
and organisation is a partial unique index, `where: { removedAt: null }`, for which the preset
|
|
31
|
+
turns on the `partialIndexes` preview feature of the client generator: a preview feature, which
|
|
32
|
+
Prisma may change without a major version, so after an upgrade of Prisma check that
|
|
33
|
+
`generated/schema.sql` still ends `members_current_idx` with `WHERE ("removed_at" IS NULL)`. The tables belong to no
|
|
34
|
+
tenant, as on Knex and Drizzle. The preset is still refused on TypeORM, the explicit style and
|
|
35
|
+
NestJS.
|
|
36
|
+
|
|
37
|
+
To move: nothing for an existing project. A project on Prisma that wants the context runs
|
|
38
|
+
`ddd-ts-kit generate context identity --preset identity`, then `npm run db:client` and
|
|
39
|
+
`npm run db:generate identity`.
|
|
40
|
+
|
|
41
|
+
**A route is served as an oRPC procedure too, for a typed TypeScript client: `orpcRouter` of `@ddd-ts-kit/http/orpc`.**
|
|
42
|
+
`orpcRouter(routes, options)` turns each route into an oRPC procedure named by its `operationId`,
|
|
43
|
+
for `RPCHandler` of `@orpc/server` (1.15 or later, a new optional peer of `@ddd-ts-kit/http`),
|
|
44
|
+
mounted next to the routes under a prefix such as `/rpc`. Each call runs through `executeRoute`
|
|
45
|
+
with the options of the HTTP adapter: the same guards, principal, tenant, validation,
|
|
46
|
+
permissions, `onError` and `around`. A refusal is an `ORPCError` with the code and the status of
|
|
47
|
+
its problem document, which it carries as its data, and a code the route declares (its own, its
|
|
48
|
+
guards', `VALIDATION_FAILED`, the preconditions) is a defined error for the client. What only HTTP
|
|
49
|
+
carries stays with the routes: an answer has no headers (no `ETag`, no cache policy), JSON is the
|
|
50
|
+
only representation, a route that receives a file or a raw body is not a procedure, and a file or
|
|
51
|
+
a list streamed as it is read is refused with 406 and closed.
|
|
52
|
+
|
|
53
|
+
A list read as it comes and closed before its end now closes its cursor: the pipeline read its
|
|
54
|
+
first item in advance, and stopping the list, as a client that goes away does, left the cursor
|
|
55
|
+
open until it was collected.
|
|
56
|
+
|
|
57
|
+
**`init --rpc orpc` serves the routes of the contexts under `/rpc` as oRPC procedures, and `ddd-ts-kit sdk` gives each client its oRPC contract at `./orpc`.**
|
|
58
|
+
The new key `stack.rpc` (`none`, `orpc`) has `start-http-server.ts` mount `orpcRouter` of
|
|
59
|
+
`@ddd-ts-kit/http/orpc` under `/rpc` on Express, Fastify, Hono and NestJS, with the options of the
|
|
60
|
+
HTTP boundary, and adds `@orpc/server`; it needs an HTTP framework. `ddd-ts-kit sdk` then writes
|
|
61
|
+
`src/orpc.ts` in each client: the oRPC contract of its document (`contract`, `createRpcClient`),
|
|
62
|
+
each procedure named by its `operationId`, its input and answer the types of the HTTP client, its
|
|
63
|
+
refusals the codes of `x-error-codes` with their status, so that `isDefinedError` narrows them.
|
|
64
|
+
`@orpc/client` and `@orpc/contract` become the only dependencies of the client, whose root entry
|
|
65
|
+
still has none; setting the key back to `none` takes them and `src/orpc.ts` away. The kit no longer
|
|
66
|
+
documents oRPC as set aside: it is a second door to the routes, not a pair of the contract.
|
|
67
|
+
|
|
68
|
+
To move: a project that wants the procedures runs `init --force --rpc orpc` on a clean tree (it
|
|
69
|
+
records the key, rewrites `start-http-server.ts` and adds `@orpc/server`), then
|
|
70
|
+
`npx ddd-ts-kit sdk` when it has clients.
|
|
71
|
+
|
|
72
|
+
**The identity preset is written in the explicit style and under NestJS: `init --di manual --preset
|
|
73
|
+
identity` and `init --http nest --di nest --preset identity`.** The classes of the context are written
|
|
74
|
+
without the declarations of the kernel, a policy carrying its name and its permission, and the preset
|
|
75
|
+
lays out `identity.module.ts` whole once the generators ran: its adapters, its use cases with the
|
|
76
|
+
permission each requires, the publishers of its facts, the consumers that keep the identity provider
|
|
77
|
+
in line (each with its consumer name, the processed-event store and the unit of work), and its
|
|
78
|
+
routes, in short functions named after what they wire, the regions of the generators kept. Its
|
|
79
|
+
policies join `access-policies.ts` of the platform, and the world of its specs wires the fakes the
|
|
80
|
+
way the module wires the adapters; `test/unit/identity.module.spec.ts` holds the module itself to its
|
|
81
|
+
use cases, on the platform: each command and query has its handler and its permission, and each
|
|
82
|
+
route is mounted. Under NestJS the routes are mounted with those of the other
|
|
83
|
+
contexts by the app module of the platform. The explicit style stays refused on tsyringe, which
|
|
84
|
+
reads the declarations, and `--dependencies signature` is asked of the declared style only.
|
|
85
|
+
|
|
86
|
+
To move: nothing for an existing project.
|
|
87
|
+
|
|
88
|
+
**A project generated on Jest is green from its first minute, and the kit now runs it: Jest is
|
|
89
|
+
installed in the workspace and one Jest stack joins the stacks its end-to-end suite runs.** Running
|
|
90
|
+
it found what a type check could not: a Jest project listed `@vitest/coverage-v8`, which knip
|
|
91
|
+
refused as unused; knip entered its fakes and worlds through top-level patterns, reported as
|
|
92
|
+
matching nothing before the first context, instead of a `jest` section beside the `vitest` one of
|
|
93
|
+
a Vitest project; the extractability spec of `test/architecture/` gave `it.each` an empty table,
|
|
94
|
+
which Jest refuses, before the first context (it now waits with an `it.todo`); an import of a
|
|
95
|
+
directory (`@/contexts/<context>/published-language`) did not resolve, each alias now mapping to the
|
|
96
|
+
source then to the barrel of the directory; the modules of the Prisma client, written with `.js`,
|
|
97
|
+
did not resolve, now mapped back to their sources; and a hook opening the test database outlasted
|
|
98
|
+
the 5 seconds of Jest, now 60 as on Vitest. The identity preset is held green on NestJS,
|
|
99
|
+
class-validator, Prisma, shared tables and Jest, the stack of the spend management example.
|
|
100
|
+
|
|
101
|
+
To move: in `jest.config.js`, write each alias of `moduleNameMapper` as
|
|
102
|
+
`['<rootDir>/src/$1.ts', '<rootDir>/src/$1/index.ts']` (the check asks for it), add
|
|
103
|
+
`testTimeout: 60_000`, and on Prisma `'^(\\.{1,2}/.*)\\.js$': '$1'`; in `knip.json`, move the
|
|
104
|
+
entries of the fakes and the worlds into a `jest` section with `"config": ["jest.config.js",
|
|
105
|
+
"jest.e2e.config.js", "jest.mutation.config.js"]`; drop `@vitest/coverage-v8` from the dev
|
|
106
|
+
dependencies.
|
|
107
|
+
|
|
108
|
+
**A route is served as a tRPC procedure too: `trpcRouter` of `@ddd-ts-kit/http/trpc`.**
|
|
109
|
+
`trpcRouter(routes, options)` turns each route into a tRPC procedure named by its `operationId`, a
|
|
110
|
+
query for a `GET` route and a mutation for the other methods, for the adapters of `@trpc/server`
|
|
111
|
+
(11.10 or later, a new optional peer of `@ddd-ts-kit/http`), mounted next to the routes under an
|
|
112
|
+
endpoint such as `/trpc`. Each call runs through `executeRoute` with the options of the HTTP
|
|
113
|
+
adapter, as a call of `orpcRouter` does. A refusal is a `TRPCError` of the code tRPC has for its
|
|
114
|
+
status (`UNAUTHORIZED` for 401, `CONFLICT` for 409), with the problem document of the route in
|
|
115
|
+
`data.problem`, whose `code` is the one of the kit: tRPC has a fixed set of codes of its own. What
|
|
116
|
+
only HTTP carries stays with the routes, as over oRPC, and a binary body is refused with 406 too,
|
|
117
|
+
as tRPC answers JSON only.
|
|
118
|
+
|
|
119
|
+
Over oRPC, a file or a streamed list refused with 406 now carries its problem document as `data`,
|
|
120
|
+
as every other refusal does.
|
|
121
|
+
|
|
122
|
+
**`init --rpc trpc` serves the routes of the contexts under `/trpc` as tRPC procedures, and `ddd-ts-kit sdk` gives each client the type of their router at `./trpc`.**
|
|
123
|
+
`stack.rpc` takes a third value, `trpc`: `start-http-server.ts` mounts `trpcRouter` of
|
|
124
|
+
`@ddd-ts-kit/http/trpc` under `/trpc` on Express, Fastify, Hono and NestJS, with the options of
|
|
125
|
+
the HTTP boundary, and adds `@trpc/server`; it needs an HTTP framework, as `orpc` does. `ddd-ts-kit
|
|
126
|
+
sdk` then writes `src/trpc.ts` in each client: `AppRouter`, the type of the router written from
|
|
127
|
+
its document, a query for each `GET` operation and a mutation for the others, their input and
|
|
128
|
+
answer the types of the HTTP client, a refusal carrying its problem document in `data.problem`;
|
|
129
|
+
`createRpcClient` and `isRpcRefusal` call it. A front end imports the client, never the code of
|
|
130
|
+
the server. `@trpc/client` and `@trpc/server` become the only dependencies of the client; moving
|
|
131
|
+
to another value takes them and `src/trpc.ts` away.
|
|
132
|
+
|
|
133
|
+
To move: a project that wants the procedures runs `init --force --rpc trpc` on a clean tree (it
|
|
134
|
+
records the key, rewrites `start-http-server.ts` and adds `@trpc/server`), then
|
|
135
|
+
`npx ddd-ts-kit sdk` when it has clients. A project that served oRPC removes `@orpc/server` from
|
|
136
|
+
its `package.json`: `init` adds the dependencies of a stack, it does not take back those of the
|
|
137
|
+
previous one.
|
|
138
|
+
|
|
139
|
+
**`init` on an existing project names each dependency of its `package.json` the stack about to be written contradicts.** The first `init` of a project that already has a `package.json`, a dry run included, adds a note per key its direct dependencies answer otherwise than the flags (`package.json depends on fastify, and the project is written for --http express: pass --http fastify to keep it.`), for the HTTP framework, the validation library, the injection, the test runner, the ORM, the database, the broker, the authentication, the logger, the error reporter and the storage. Two dependencies that answer one key differently are left to the owner, and said; the rights model is never read from a dependency. Nothing is written by these notes, and an initialised project is not read again. The `bootstrap` skill puts them to the owner.
|
|
140
|
+
|
|
141
|
+
**The instances of the process managers are kept in the tenant of the work on Knex, Drizzle, Prisma and TypeORM alike, under a key that includes the tenant.**
|
|
142
|
+
|
|
143
|
+
`KnexProcessStore`, `DrizzleProcessStore`, `PrismaProcessStore` and `TypeOrmProcessStore` take `tenant` (the `ExecutionScope`): a step loads and changes the instances of its own tenant only, and work that names no tenant is refused with `NoCurrentTenantError`. The table of each package (`createProcessTable`, `processesTable`, the `ProcessInstance` model, `processEntity`) always has `tenant_id`, the empty text outside any tenant, and its primary key is `(tenant_id, name, id)`: two tenants may run an instance under the same correlation key, a month or an invoice number, where the first save of the second was refused before. `processStoreContract` proves it with `storeInTenant`, on the four packages. A project generated with `--tenancy` gives the scope to its process store: `Persistence.processes` is now `(scope) => ProcessStore`.
|
|
144
|
+
|
|
145
|
+
To move: drop `tenant: true` from `createProcessTable` (the option is gone, the column always there); `DrizzleProcessStore` takes its table as `{ table }`. A database created before needs a migration that adds `tenant_id` (`''` for the rows of no tenant, `addTenantColumn` of `@ddd-ts-kit/knex` for those of a tenant) and makes `(tenant_id, name, id)` the primary key; on Prisma, `prisma migrate dev` writes it from the model. In a generated project, `persistence.processes` is called with the execution scope (`persistence.processes(scope)`), as `init` now writes it.
|
|
146
|
+
|
|
147
|
+
**A renamed `operationId` is a breaking change of the API when the routes are served as procedures, and the architecture reviewer says so.**
|
|
148
|
+
With `stack.rpc` set to `orpc` or `trpc`, a procedure is named by the `operationId` of its route
|
|
149
|
+
and called at that name: renaming it, giving a `GET` route another method (a tRPC query becomes a
|
|
150
|
+
mutation) or having a route receive a file breaks a front end already deployed, which answers
|
|
151
|
+
404 or calls it the wrong way. The table "Breaking or not" of the `document` skill lists these
|
|
152
|
+
three changes, the client SDK guide says it, and the `architecture-reviewer` agent reports them
|
|
153
|
+
from the diff of `openapi/`, blocking unless the change says its consumers move with it.
|
|
154
|
+
|
|
155
|
+
**`generate property <context> <ValueObject>` writes the laws of a value object as a spec on generated values.** The spec lands beside the spec of the value object (`test/unit/<name>.vo.properties.spec.ts`), with an arbitrary built on its factory (`any<Name>()`), a first law (the value is equal to the one created again from its own value) and one planned rule per kind of law (an invariant after each operation, a symmetry, a round trip), under Vitest and Jest, for value objects that throw or return a `Result`. `fast-check` joins the development dependencies when the project does not have it yet; that write is a shared one, so a worker confined to its context runs the kind with `--local-only` once fast-check is there. The value object must exist: the refusal names the command that creates it.
|
|
156
|
+
|
|
157
|
+
**`ddd-ts-kit check --baseline write` records the errors an existing codebase already has, and `check` then reports only new ones.** The errors of the checker are counted by file and by rule in `ddd-ts-kit-baseline.json`, the shape of `eslint-suppressions.json`. While a file has no more errors of a rule than the baseline records, `check` and `check-file` (the hook of the agent) leave them quiet; once it has more, all of them are reported. A recorded count the project no longer reaches fails `check` until `check --baseline prune` lowers it, so the baseline only shrinks. Warnings are not recorded. Writing it is a decision of the project owner, who runs the command in a terminal: the guard of the plugin refuses `check --baseline write` and any direct edit of the file to an agent, under Claude Code, Codex and Copilot alike, and the permissions `init` writes ask before both for an agent without the plugin. `check --baseline prune` is free.
|
|
158
|
+
|
|
159
|
+
To move: in a project initialised before this version, run `npx ddd-ts-kit init` again: it adds the two permissions to `.claude/settings.json` and names them.
|
|
160
|
+
|
|
161
|
+
**`ddd-ts-kit check` refuses in a context the tools of Nest that the kit does its own way, and says which tool of the kit to use instead (`nest/no-parallel-pipeline`).**
|
|
162
|
+
The routes of the kit are mounted under Nest, not through its pipeline: a Nest guard, pipe,
|
|
163
|
+
exception filter or interceptor never sees them, and a Nest controller written in a context was
|
|
164
|
+
a route the checker let through, with no declared security, no problem codes and no place in the
|
|
165
|
+
contract (`authz/declared` judged the controllers of the kit only). The new rule, an error,
|
|
166
|
+
reports in `presentation/`, `infrastructure/` and the module file of a context, tests apart: a
|
|
167
|
+
controller and its decorators, a guard, a pipe, an exception filter or an `HttpException`, an
|
|
168
|
+
interceptor or the `Logger` of `@nestjs/common`, and `@nestjs/core`, `@nestjs/swagger`,
|
|
169
|
+
`@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/jwt`, `@nestjs/schedule`, `@nestjs/bull(mq)`,
|
|
170
|
+
`@nestjs/config`, `@nestjs/throttler`, `@nestjs/cache-manager`, `@nestjs/event-emitter`, the ORM
|
|
171
|
+
modules of Nest and `@nestjs/terminus`. Each finding names the tool of the kit in its place. The
|
|
172
|
+
container of Nest (`@Injectable()`, `@Inject()` on an adapter bound as a provider), its WebSocket,
|
|
173
|
+
GraphQL, microservice and testing packages, and everything in the platform are left alone. The
|
|
174
|
+
HTTP frameworks guide gains "Where each tool of Nest goes", and the `wiring` skill `nest.md`.
|
|
175
|
+
|
|
176
|
+
To move: a project with Nest code in a context runs `npx ddd-ts-kit check` and replaces each
|
|
177
|
+
finding by the tool its message names (a Nest controller by `generate route`, a role guard by the
|
|
178
|
+
permission of the use case, an `HttpException` by a refusal of the code list), or moves what is
|
|
179
|
+
not a use case to the platform.
|
|
180
|
+
|
|
181
|
+
**A file that moves keeps the errors `ddd-ts-kit-baseline.json` records for it.** Adopting the kit is made of moving code into the canonical tree: `move-to-module`, `context-layout` and `platform-folders` now carry the entry of each file they move to its new path, and `check --baseline prune`, which an agent may run, follows the renames git sees since the baseline was committed (a `git mv`) before it lowers the counts. A count follows its file and is never raised, so a move silences nothing new. A file moved otherwise (a plain `mv` git does not see as a rename) still reports its errors at its new path, and its old entry fails until the owner writes the baseline again.
|
|
182
|
+
|
|
183
|
+
**A Nest controller is a route of the kit: `@KitRoute` on its method, `createControllersModule` of `@ddd-ts-kit/http/nest` to serve it.**
|
|
184
|
+
A project on NestJS writes its controllers as Nest does (`@Controller`, `@Get`, `@Post`,
|
|
185
|
+
`@Param`, `@Query`, `@Headers`, `@Body` with a DTO class, `@HttpCode`, injection by constructor),
|
|
186
|
+
and adds `@KitRoute({ operationId, summary, guards, errors, response })` to each method,
|
|
187
|
+
`@KitRoutes({ guards, tags, errors })` to the class for what its routes share. The kit, not Nest's
|
|
188
|
+
router, serves the method, through the pipeline of every route: guards, validation of the DTO
|
|
189
|
+
(`schemaOfClass: classSchema`), problem documents, tracing, the contract, and a procedure over
|
|
190
|
+
`/rpc` and `/trpc`. `@CurrentActor()` hands the method the caller the authentication resolved;
|
|
191
|
+
`@RouteContext()` the context of the request. `nestControllerRoutes` gives the same routes without
|
|
192
|
+
Nest's container, for the contract and the procedures. What the kit's pipeline would not run is
|
|
193
|
+
refused when the routes are built: `@UseGuards`, `@UsePipes`, `@UseInterceptors`, `@UseFilters`,
|
|
194
|
+
`@Header`, `@Redirect`, `@Render`, `@Sse`, `@Version`, pipes on a parameter, `@Req`, `@Res`; a
|
|
195
|
+
route with no guard is refused; a controller also among the `controllers` of a Nest module stops
|
|
196
|
+
the start. The metadata Nest's decorators record is read in one place, checked on each read, and
|
|
197
|
+
held by a test on the Nest the kit is released with.
|
|
198
|
+
|
|
199
|
+
**`nest/no-parallel-pipeline` lets a Nest controller the kit serves declare its routes with Nest's decorators, and refuses anywhere a controller Nest serves that reaches a use case.**
|
|
200
|
+
In a context, a file that imports `KitRoute` of `@ddd-ts-kit/http/nest` may use `@Controller`,
|
|
201
|
+
`@Get`, `@Post` and the other methods, `@Param`, `@Query`, `@Headers`, `@Body` and `@HttpCode` of
|
|
202
|
+
Nest: the kit reads them and serves the route through its own pipeline. The raw request and answer
|
|
203
|
+
(`@Req`, `@Res`, `@Header`, `@Redirect`, `@Render`, `@Sse`, uploads), guards, pipes, filters and
|
|
204
|
+
interceptors of Nest stay refused there. Outside the contexts, under the source root and outside
|
|
205
|
+
the tests, a file that imports `Controller` of `@nestjs/common`, not `KitRoute`, and names
|
|
206
|
+
`CommandBus` or `QueryBus` or imports a file of a context is reported: a controller Nest serves
|
|
207
|
+
that reaches a use case has no declared security, no problem codes and no place in the contract,
|
|
208
|
+
and moving it to the platform no longer hides it. A controller of the platform that reaches no
|
|
209
|
+
use case (health, metrics) is left alone.
|
|
210
|
+
|
|
211
|
+
To move: a Nest controller of the platform that sends commands or queries gets `@KitRoute` on each
|
|
212
|
+
method and moves to `createControllersModule`, or becomes a route of the context.
|
|
213
|
+
|
|
214
|
+
**A method of a Nest controller the kit serves that returns a value without `response.body` is refused, instead of answering an empty body.**
|
|
215
|
+
In Nest, what a method returns is the body of the answer; under `@KitRoute` the kit answers the
|
|
216
|
+
body its `response.body` declares, as the contract does, and dropped what an undeclared method
|
|
217
|
+
returned without a word. The routes are now refused when they are built if TypeScript recorded
|
|
218
|
+
that the method returns a value (`design:returntype`, under `emitDecoratorMetadata`), and an
|
|
219
|
+
`async` method, whose recorded type is only `Promise`, is refused at the call: a 500, the reason
|
|
220
|
+
told to `onError`.
|
|
221
|
+
|
|
222
|
+
To move: give `response: { body }` to each `@KitRoute` whose method returns what the caller reads,
|
|
223
|
+
or return nothing.
|
|
224
|
+
|
|
225
|
+
**The guard of the plugin finds the CLI a workspace hoisted to a parent directory.** It looked for `node_modules/.bin/ddd-ts-kit` in the project only, so in a project of an npm or pnpm workspace, whose install lands at the root of the monorepo, it found none and skipped, without a word, every check that needs the CLI: the check of each written file, the refusal to stop while errors remain, the gates of a story. It now looks where Node would, from the project up to the root of the filesystem.
|
|
226
|
+
|
|
227
|
+
To move: in a project of a workspace, the guard now runs those checks. Run `npx ddd-ts-kit check` before updating the plugin: an error it reports would otherwise first appear as a refusal to end a session.
|
|
228
|
+
|
|
229
|
+
**A project generated on an ORM holds the stores of the kit, as its platform wires them, to their contracts; and the test database of a Drizzle project has its unique indexes.**
|
|
230
|
+
|
|
231
|
+
`init` writes `src/platform/database/persistence.contract.spec.ts` on Knex, Drizzle, Prisma and TypeORM: the outbox, processed-event, job and process stores of `Persistence`, on the database of `open-test-database.ts`, run the contracts of `@ddd-ts-kit/testing` with what the stack turns on (`carriesTenant` and `storeInTenant` under `--tenancy`, the unit of work of a step with `--queue database`), and the event store with its snapshots, checkpoints and keys under `--event-sourcing on`. A store bound without the tenant the stack asks for now fails a spec of the project. On Drizzle, `table-statements.ts` creates the unique indexes and constraints of `schema.ts` too: the in-process database of the tests lacked the one of `background_jobs`, so a job enqueued in a spec failed with `there is no unique or exclusion constraint matching the ON CONFLICT specification`.
|
|
232
|
+
|
|
233
|
+
Run for real at night on Prisma (NestJS, Jest, Kafka, shared tables, the jobs in the database) and on TypeORM, installed from the packed kit, three more things came out, now fixed: under Jest, a port that a module file wiring by hand never loads counted as uncovered code and dropped the domain under its floor from the first use case, so the ports (abstract members only, `ports/abstract-class`) are no longer measured, under Vitest or Jest; knip reported `prisma/schema.prisma` as outside the project on Prisma, and `data-source.ts`, which only the TypeORM CLI loads, as unused on TypeORM.
|
|
234
|
+
|
|
235
|
+
To move: on a project generated before, `init --force` writes the spec and the new `table-statements.ts`; a Drizzle project that copied `table-statements.ts` by hand adds `uniqueIndexStatements` from the new template; `knip.json` gets `"prisma/**/*.prisma"` in `project` on Prisma, and the data source in `entry` on TypeORM.
|
|
236
|
+
|
|
237
|
+
**`init --routes nest` makes a Nest controller what `generate route` writes: Nest builds it with the bus it injects, the kit serves it.**
|
|
238
|
+
A new form of `stack.routes`, `nest`, for a project on `--http nest` with class-validator. `generate
|
|
239
|
+
route` writes `<use-case>.controller.ts` with Nest's `@Controller()`, `@Post` or `@Get`, `@Param`,
|
|
240
|
+
`@Body` typed by the DTO classes beside it, `@CurrentActor()` for the caller, the bus injected by
|
|
241
|
+
Nest (`@Inject(CommandBus)`), and `@KitRoute` and `@KitRoutes({ group })` of
|
|
242
|
+
`@ddd-ts-kit/http/nest`; the module of the context lists it under `controllers`, the application
|
|
243
|
+
composes its routes with the others (`nestControllers`), and the Nest module of the platform builds
|
|
244
|
+
it with the buses of the platform (`provideControllers`). The routes keep the guarantees of every
|
|
245
|
+
route: the guards of the group, validation, problem documents, the contract, and the procedures
|
|
246
|
+
over `/rpc` and `/trpc`. A search stays a controller of the kit (`generate controller`), and
|
|
247
|
+
`--mapper` and `--serializer` are left out: the method maps its input and its answer itself.
|
|
248
|
+
|
|
249
|
+
`@ddd-ts-kit/http/nest` gains `nestControllers`, `provideControllers` and `nestControllerRoute`,
|
|
250
|
+
and `@KitRoutes` a `group`, a route group of the kit whose prefix, tags, guards and codes come first.
|
|
251
|
+
|
|
252
|
+
To move: a new Nest project passes `--routes nest`; an existing one keeps its routes, and a context
|
|
253
|
+
that gets Nest controllers needs the `controllers` list of the module file and the composition of
|
|
254
|
+
the platform that `init --force --routes nest` writes.
|
|
255
|
+
|
|
256
|
+
**On trial, `"dependenciesBeforeWrite": true` has the guard of the plugin refuse, before the write, a new import that breaks a dependency rule.** The lines a session is about to add to a TypeScript file (the content of a `Write`, the replacements of an `Edit`, the added lines of a Codex patch), less those the file already held, are judged by `layer/domain-purity`, `layer/application-inward`, `layer/infrastructure-no-presentation`, `layer/presentation-no-infrastructure` and `context/published-language-only`, and the write is refused with the message of the checker, under Claude Code, Codex and Copilot; the file never reaches the disk with the import. The other rules stay after the write. The key is off by default. `ddd-ts-kit check-file` gains `--content-from <file>`, which judges a given text as the content of the path, and `--rule <id>`. Each judged write is recorded, on the machine only, in `.git/ddd-ts-kit/before-write.jsonl` of the repository (the file, the rules refused, the time the check took), so that the trial can be decided on what it did; the example application runs it.
|
|
257
|
+
|
|
258
|
+
**`@KitRoute` is optional: each method of a Nest controller the kit serves that carries a route decorator of Nest is a route, named after the method.**
|
|
259
|
+
`@Post`, `@Get` and the other route decorators of Nest are enough: the route is named by the
|
|
260
|
+
method (`issueInvoice`), summed up by its name as a sentence (`Issue invoice`), behind the guards
|
|
261
|
+
of `@KitRoutes` on the class. `@KitRoute` says only what Nest does not: another name, guards of its
|
|
262
|
+
own, the refusals it answers, the body it answers (a method that returns a value without it is
|
|
263
|
+
still refused, never answered empty). `generate route` under `"stack.routes": "nest"` no longer
|
|
264
|
+
writes the name and the summary, and `nest/no-parallel-pipeline` takes a file that imports
|
|
265
|
+
`KitRoutes` alone for a controller the kit serves. The docs say that a generated controller
|
|
266
|
+
injects the buses only, the providers the platform gives Nest.
|
|
267
|
+
|
|
268
|
+
**A project without a database (`--orm custom` or `none`) and with `--cache redis` compiles again: its outbox relay is woken by its own store alone.**
|
|
269
|
+
|
|
270
|
+
`main.ts` (and the `main.ts` of each extracted service) gave the relay two `wakeOn` keys, the signal of the in-memory persistence and the Redis signal, which TypeScript refuses (`An object literal cannot have multiple properties with the same name`). An outbox kept in the memory of the process is relayed by that process alone, so the Redis signal, which wakes the relay of another process, is no longer created there; with a database it stays. Found by the stacks that now meet every pair of capability values, generated and type-checked at night and before a release.
|
|
271
|
+
|
|
272
|
+
To move: on such a project, `init --force` writes `main.ts` and the Redis services again; by hand, remove `wakeOn: redis.relaySignal` from `main.ts`.
|
|
273
|
+
|
|
274
|
+
**A criterion of a story that states a law over every value of a value object becomes a property.** In the design review of the `story` skill, such a criterion ("never negative", "the total equals the sum of its lines", "overlaps the other in both directions or in none") gets a `Laws: <ValueObject>: <law>` line in the section of its row, and the build of the row states it with `generate property`, the law its title; the criterion keeps its scenarios in the acceptance. Measured on the example before its specs were hardened: the property of symmetry of `Range.overlaps` kills a mutant of a bound (`<` to `<=`) that its examples let through.
|
|
275
|
+
|
|
276
|
+
**What a method of a Nest controller answers is its signature: the kit reads it into a generated `<context>.controllers.ts`, and `@KitRoute` no longer says it.**
|
|
277
|
+
Under `"stack.routes": "nest"`, `ddd-ts-kit generate`, `docs` and the `dev` script write
|
|
278
|
+
`<context>.controllers.ts` at the root of each context: its Nest controllers, each with what its
|
|
279
|
+
route methods answer as their signatures say it (`Promise<IssuedInvoice>` a DTO class,
|
|
280
|
+
`Promise<Accepted>` an identifier, `Promise<void>` nothing), through `withAnswers` of
|
|
281
|
+
`@ddd-ts-kit/http/nest`. The module of the context lists them from that file, so `generate route`
|
|
282
|
+
no longer touches it, and the generated controller declares in `@KitRoute` its validation and its
|
|
283
|
+
refusal codes only, its status through `@HttpCode` of Nest when Nest would answer another. The
|
|
284
|
+
check `nest/controllers-current` keeps the file current and reports a route method whose answer
|
|
285
|
+
the kit cannot read into a schema (an array, an inline type, an interface, no type) and whose
|
|
286
|
+
`@KitRoute` declares no `response`. A DTO without a decorated field accepts the empty object
|
|
287
|
+
alone, as `whitelist` and `forbidNonWhitelisted` refuse any field.
|
|
288
|
+
|
|
289
|
+
To move: a project on `--routes nest` runs `npx ddd-ts-kit docs` once, and its context modules
|
|
290
|
+
list `<context>Controllers` from the generated file in place of their `controllers` list.
|
|
291
|
+
|
|
7
292
|
## 0.90.0
|
|
8
293
|
|
|
9
294
|
**A generated project forces qs `^6.16.0`, and multer `^2.5.0` on Nest, where its stack still pins the vulnerable versions; one on Fastify asks for `fastify` `^5.12.7`.** Stryker 10.1 asks for `typed-rest-client` 2.3, which asks for qs 6.15.1 exactly (three denials of service, moderate), and `@nestjs/platform-express`, up to 12.2.0, asks for multer 2.4.0 exactly (a denial of service through a pending `fileFilter`, high). `init` forces the fixed versions in `overrides` of `package.json` under npm, and of `pnpm-workspace.yaml` under pnpm, which reads nothing of `package.json`. An override the project already sets for one of them is kept, and said, unless `--force`. Fastify 5.12.2 to 5.12.5 let a request header go around the validation of a schema whose `propertyNames` reads it by case (low).
|
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:b4a3668e41eb11a1 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit
|
|
5
5
|
|
|
@@ -88,7 +88,11 @@ générés tels que les scripts du projet les écrivent pour un projet qui n'a e
|
|
|
88
88
|
que le premier *commit* les contienne et que `docs:check` passe d'emblée ; un contrat déjà
|
|
89
89
|
présent est laissé tel quel, `--force` compris. Un `package.json` existant est fusionné : les
|
|
90
90
|
scripts et les dépendances qui manquent sont ajoutés, les vôtres sont gardés et mentionnés dans
|
|
91
|
-
les notes.
|
|
91
|
+
les notes. La première fois, les notes nomment aussi chaque dépendance que la *stack* sur le
|
|
92
|
+
point d'être écrite contredit, et l'option qui la garde (`package.json depends on fastify, and the
|
|
93
|
+
project is written for --http express: pass --http fastify to keep it.`), en *dry run* compris :
|
|
94
|
+
lancez d'abord `init --dry-run` sur un projet existant. Relancé plus tard, `init` garde la
|
|
95
|
+
*stack* enregistrée dans la configuration.
|
|
92
96
|
|
|
93
97
|
`init --force` sur un projet déjà initialisé réécrit les fichiers qui appartiennent à `init` et
|
|
94
98
|
garde la configuration : les contextes et leurs amonts, les règles, les limites, les dérogations
|
|
@@ -469,7 +473,9 @@ réponse d'identifiant comprise, comme 0.1 à 0.5 les écrivaient.
|
|
|
469
473
|
`generate value-object` écrit un `create` qui renvoie l'objet-valeur ou lève le refus de son
|
|
470
474
|
concept, et une *spec* qui le vérifie avec `expectRefusal(() => ..)`. `--value-objects result`,
|
|
471
475
|
ou une configuration sans la clé, garde un `create` qui renvoie un `Result` que l'appelant
|
|
472
|
-
déballe, comme 0.1 à 0.5 l'écrivaient ; `value-objects` fait passer un projet de l'un à l'autre.
|
|
476
|
+
déballe, comme 0.1 à 0.5 l'écrivaient ; `value-objects` fait passer un projet de l'un à l'autre. `generate property`
|
|
477
|
+
écrit les lois d'un *value object* existant comme une *spec* sur des valeurs générées, sous
|
|
478
|
+
l'une ou l'autre forme, et ajoute `fast-check` aux dépendances de développement s'il manque.
|
|
473
479
|
|
|
474
480
|
**Les événements du domaine partent avec la sauvegarde.** Un gestionnaire de commande généré
|
|
475
481
|
construit ou charge son agrégat, appelle une méthode d'intention, `await repository.save(aggregate)`
|
|
@@ -564,14 +570,14 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
|
|
|
564
570
|
| `--event-sourcing on` | enregistré comme `stack.eventSourcing`, `off` sauf demande : `Persistence` gagne `eventSourcing` (`create<Orm>EventSourcing` dans le schéma `event_store`, dont le fichier de schéma déclare les cinq tables ; les stores en mémoire avec `--orm none`), et `src/platform/event-sourcing/` : `create-event-sourcing.ts` (`EventSourcing` : les stores, le `SubjectKeyStore` enveloppé par `auditedSubjectKeys` avec `--audit on`, et le `PersonalDataCipher` par-dessus) et, avec tsyringe, `event-sourcing.module.ts` (lie `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` et `PersonalDataCipher`, pour qu'un adaptateur de *repository* *event-sourced* les nomme dans son constructeur ; la `Platform` câblée à la main les porte comme `platform.eventSourcing`) ; `platform-test.module.ts` lie les stores en mémoire, pour qu'une *spec* de gestionnaire d'un agrégat *event-sourced* n'ait besoin d'aucun *fake*. `generate aggregate --event-sourced` est refusé sans lui, avec le `init --force --event-sourcing on` à lancer. Refusé avec `--orm custom` : l'event store du kit tourne sur PostgreSQL par les quatre paquets d'ORM |
|
|
565
571
|
| `--privacy on` | enregistré comme `stack.privacy`, `on` quand il y a un ORM : `src/platform/privacy/`, avec `data-subject-copies.ts` et `data-subject-exports.ts` (les ports, ou les adaptateurs à la main, des contextes qui étendent `PersonalDataErasure` et `PersonalDataExport`, entre marqueurs ; `generate repository --personal` y liste l'effacement et l'export d'un contexte), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, tenants? })` : un contexte d'exécution d'origine `cli` avec l'opérateur pour acteur, la clé de la personne quand le projet a un event store, puis `eraseDataSubject` du kernel sur les copies, `inEachTenant` avec `--tenancy shared-table`, puis `privacy.data-subject.erased` publié par l'outbox, une fois par *tenant*) et `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })` : `exportDataSubject` du kernel sur les exports, chacun enveloppé par `auditedPersonalDataExport` avec `--audit on`, `recordsInEachTenant` avec `--tenancy shared-table`, un `PersonalDataExportDocument` daté), et les deux scripts ci-dessous. `docs/privacy/register.md`, le registre des données personnelles que `ddd-ts-kit docs` tient (voir `docs` plus bas). Un projet sans donnée personnelle prend `--privacy off` et ne paie rien. Aucune commande HTTP n'efface encore : les deux scripts sont les points d'entrée |
|
|
566
572
|
| `--tenancy shared-table` | enregistré comme `stack.tenancy` ; les quatre ORM. Chaque `generate repository` est cloisonné par *tenant* (comme `--tenant-scoped`), au moyen de `tenantTable` et `ownTenantTable` (Knex), de `tenantCondition` et `ownTenantCondition` (Drizzle), de `tenantWhere` et `ownTenantWhere` (Prisma, TypeORM) ; l'outbox garde le *tenant* de chaque événement (`createOutboxTables(knex, { tenant: true })` et le `tenant: true` de `KnexOutboxStore`, `tenantOutboxTable`, le champ `tenantId` du modèle Prisma et le `tenant: true` de `PrismaOutboxStore`, `outboxEntity({ tenant: true })`), si bien que les consommateurs s'exécutent dans ce *tenant* ; `tenancy/scoped-statement` juge les adaptateurs. La sécurité au niveau des lignes, un schéma par *tenant* et une base par *tenant* sont refusés, avec ce qu'il faut câbler à la main ([Multitenance](../../docs/concepts/multitenancy.fr.md)) |
|
|
567
|
-
| `--queue database\|redis\|memory` | enregistré comme `stack.queue`. `database` (par défaut sur Knex
|
|
573
|
+
| `--queue database\|redis\|memory` | enregistré comme `stack.queue`. `database` (par défaut sur Knex, Drizzle, Prisma et TypeORM, quel que soit le conteneur) : les tables du *package* de l'ORM (`createJobTable` et `createProcessTable`, `jobsTable` et `processesTable`, les modèles `BackgroundJob` et `ProcessInstance`, `jobEntity` et `processEntity`) dans le schéma `messaging`, `Persistence` gagne `jobs` et `processes`, et la plateforme relie `JobStore` et `ProcessStore` à eux (le module de la plateforme sur tsyringe, `jobs/create-background-work.ts` là où la plateforme est câblée à la main ou sous Nest), si bien qu'un *job* mis en file par une commande est écrit dans sa transaction ; `redis` (avec `--cache redis`) : `RedisJobStore` sur la connexion du cache, les processus dans la base de données ; `memory` (par défaut avec une persistance sur mesure ou sans persistance) : rien n'est écrit, les deux restent dans le processus. Refusé : `database` avec un autre ORM, `redis` sans le cache |
|
|
568
574
|
| `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices` : le cache lié au `Cache` du kernel, le limiteur à `RateLimiter`, le verrou à `Lock`, qui réserve un *job* planifié à une seule instance, le signal du relais comme `wakeOn` du relais de l'outbox avec `relayWakeUpMiddleware` sur le bus de commandes), `http/too-many-requests-for.ts` (une fenêtre glissante par adresse d'appelant, 429 `application/problem+json` avec `retry-after` ; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` sur le serveur HTTP, `REDIS_URL` validée, un service compose `cache` qui exécute Dragonfly avec un contrôle de santé. Sans serveur (outils, tests sans `REDIS_URL`), les mêmes ports restent dans la mémoire du processus |
|
|
569
575
|
| `--http-cache varnish` | un service compose `varnish` (Varnish 9.1.0, qui joint l'API sur `host.docker.internal`) avec son VCL dans `docker/varnish/default.vcl` (seules les réponses dont le `Cache-Control` les autorise par `max-age` ou `s-maxage` sont gardées, rangées sous leurs étiquettes `xkey`, purgées par `PURGE` depuis la machine de Varnish ou avec `VARNISH_PURGE_KEY`, `x-cache: HIT\|MISS`), `VARNISH_URL` et `VARNISH_PURGE_KEY` validées, `cacheTags: { header: CacheTagHeader.xkey }` dans la frontière HTTP, et le relais de l'outbox de `main.ts` et de chaque point d'entrée de `generate service` qui publie au moyen de `PurgingPublisher` avec `VarnishCachePurger` (l'application de bout en bout enregistre les purges dans `purges`) ; sur `--di manual` et `nest`, la plateforme gagne `cacheInvalidation` ; avec `--tenancy`, les étiquettes des réponses et les purges sont rangées sous le *tenant* (`perTenant`) et le *tenant* d'une requête HTTP est lu dans `x-tenant-id`. Demande un framework HTTP et `--events outbox` : une purge est une ligne de l'outbox |
|
|
570
576
|
| `--errors sentry` | les échecs inattendus remontés à Sentry ou à GlitchTip (un seul protocole, seul le DSN diffère) au moyen de l'`ErrorReporter` du kernel, lié à `@ddd-ts-kit/sentry`. `src/platform/observability/errors.ts` (`initSentry` sur la configuration validée, puis `reportProcessFailures`), le deuxième import de `main.ts`, de `apps/<context>/main.ts` et de `apps/worker/main.ts`, juste après `tracing.ts` ; `errors` remis à `composeApplication`, qui le donne au module du kernel sur tsyringe (`errorReporter`, vidé par `container.stop()` avant le *logger*, `errorReportingMiddleware` en premier sur les deux bus, le planificateur par défaut qui observe avec `reportFailedRuns`) ou à `createPlatform` à la main (le même *middleware*, `onRun: reportFailedRuns(errors)`, `platform.errors`, vidé en deux secondes au plus quand l'application s'arrête) ; `reportHttpErrors` dans `auth/authentication/http-boundary.ts` pour chaque requête HTTP qui reçoit une réponse 5xx ; `DeadLetterReports` sur le *hook* `onFailure` d'un *broker* fourni (`createEventProvider(config, errors)`, avec `observing` autour de chaque consommateur) et du relais de l'outbox. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (par défaut : `NODE_ENV`), `SENTRY_RELEASE` et `SENTRY_SCRUB_MESSAGES` validées dans `config/load-config.ts` comme `errorReporting` : sans DSN, l'application démarre et ne remonte rien ; un DSN qui n'est pas une URL refuse le démarrage. Dépendances `@ddd-ts-kit/sentry` et `@sentry/node`. Un profil compose `errors` qui exécute GlitchTip 6.2.6 avec son propre PostgreSQL et son propre Valkey (`GLITCHTIP_PORT`, sur la boucle locale seulement, amorçage de développement), et une section du README généré qui dit comment lire son DSN. Les outils et les tests composent l'application sans *reporter*. Il va avec tous les autres choix de la *stack* ; avec `--errors none`, rien de tout cela n'est écrit |
|
|
571
577
|
| `--authn keycloak` | un service compose `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profil `identity`) et `docker/keycloak/<project>-realm.json` : le client de l'API, un client public `<project>-local` avec l'octroi direct, ses *mappers* d'audience et de `tenant_id`, le rôle de realm `admin`, et les utilisateurs de démonstration `demo-admin` et `demo-user`, pour le développement local seulement |
|
|
572
578
|
| `--storage local\|s3` | enregistré comme `stack.storage` : où vit le contenu des fichiers, jamais dans la base de données. `src/platform/config/read-files.ts` et `src/platform/files/open-files.ts`, un par choix : `local`, un répertoire en développement (`FILES_DIRECTORY`, `.data/files`) et les liens signés servis par l'application sous `/files` (`FILES_PUBLIC_URL` et `FILES_SIGNING_SECRET` requises en production) ; `s3`, un bucket de n'importe quel fournisseur du protocole S3 au moyen de `@ddd-ts-kit/s3` (les variables `S3_*`, MinIO dans la stack compose) ; la mémoire du processus dans les tests et les outils, dans les deux cas. Avec `--di tsyringe` : `files/bind-files.ts`, `files/files.module.ts` et `files/staging-uploads.ts` ; en câblage manuel, `files/create-files.ts` ; avec une *stack* HTTP, `files/file-routes.ts`. Ils lient `FileStorage`, `FileKeys`, `FileScanner` et `FileStaging`, enregistrent la purge horaire des fichiers en attente et mettent en attente le fichier que porte une commande avant sa transaction ; `generate file-upload` en a besoin. `--storage none` n'écrit rien de tout cela ([Stockage de fichiers](../../docs/concepts/file-storage.fr.md)) |
|
|
573
579
|
| `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, et pour `--broker` `create-event-provider.ts` : `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, avec `aggregate-key-of.ts` pour l'ordre par agrégat), `NatsEventBus` (`NATS_URL`) ou `RedisStreamsEventBus` de `@ddd-ts-kit/redis/event-bus` (`REDIS_URL` : Redis, Dragonfly ou Valkey), chacun avec un abonné par contexte consommateur (`forConsumer`), `assertTopology` au démarrage, son adresse validée et un service compose avec un contrôle de santé ; ou `custom-event-bus.ts` avec sa *spec* `eventBusContract`. `start-outbox-relay.ts` avec l'outbox. `--broker redis` avec `--cache redis` fait un seul serveur et un seul service compose, `cache` ; seul, le service s'appelle `streams` |
|
|
574
|
-
| `src/platform/database/` | `persistence.ts` (`interface Persistence` : unité de travail, magasins de l'outbox et des événements traités du *package* de l'ORM, la poignée de stockage), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, la connexion (`connect-to-database.ts`, `create-client.ts` ou `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, le schéma de ce que le kit stocke pour l'application), `open-test-database.ts` (PostgreSQL dans le processus, ou le serveur nommé par une URL ; avec Vitest chaque *spec* ouvre une copie du cluster que `test/support/test-database-template.ts`, la mise en place globale de l'exécution, initialise une fois, et y crée ses tables ; avec drizzle depuis `table-statements.ts`, le SQL des tables de `schema.ts`, puisque drizzle-kit écrit des migrations, pas des tables). La classe de stockage qu'un adaptateur de *repository* nomme dans sa liste de dépendances : `database.ts` avec drizzle et prisma (`abstract class Database extends` le type de contexte du *package* de l'ORM), `KnexContext` de `@ddd-ts-kit/knex`, `TypeOrmContext` de `@ddd-ts-kit/typeorm` |
|
|
580
|
+
| `src/platform/database/` | `persistence.ts` (`interface Persistence` : unité de travail, magasins de l'outbox et des événements traités du *package* de l'ORM, la poignée de stockage), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, la connexion (`connect-to-database.ts`, `create-client.ts` ou `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, le schéma de ce que le kit stocke pour l'application), `open-test-database.ts` (PostgreSQL dans le processus, ou le serveur nommé par une URL ; avec Vitest chaque *spec* ouvre une copie du cluster que `test/support/test-database-template.ts`, la mise en place globale de l'exécution, initialise une fois, et y crée ses tables ; avec drizzle depuis `table-statements.ts`, le SQL des tables de `schema.ts`, puisque drizzle-kit écrit des migrations, pas des tables, ses index uniques compris), `persistence.contract.spec.ts` (les stores de l'outbox, des événements traités, des *jobs* et des processus tels que la plateforme les branche, tenus aux contrats de `@ddd-ts-kit/testing` avec ce que la pile active : le *tenant* sous `--tenancy`, l'unité de travail). La classe de stockage qu'un adaptateur de *repository* nomme dans sa liste de dépendances : `database.ts` avec drizzle et prisma (`abstract class Database extends` le type de contexte du *package* de l'ORM), `KnexContext` de `@ddd-ts-kit/knex`, `TypeOrmContext` de `@ddd-ts-kit/typeorm` |
|
|
575
581
|
| outillage des migrations | `drizzle.config.ts`, `knexfile.js` et `migrations/00000000000000_initial.js`, `prisma/schema.prisma` et `prisma.config.ts`, ou `data-source.ts` |
|
|
576
582
|
| `scripts/openapi.ts`, `scripts/events.ts` | écrivent `openapi/openapi.yaml` (un fichier par document de `openapi.documents`), `docs/integration/asyncapi.yaml` et `docs/integration/event-catalog.md`, en JSON sous `openapi.format: json` ; `--check` échoue sur une différence |
|
|
577
583
|
| `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | avec `--privacy on`, les deux demandes d'une personne concernée, traitées en ligne de commande sur les sources avec les variables de `.env` (`npm run privacy:erase -- <subject-id> [--operator <qui-demande>]`, `npm run privacy:export -- <subject-id> > export.json`) : l'effacement détruit d'abord la clé de la personne quand le projet a un event store (`--event-sourcing on` : ses événements stockés se lisent effacés ; audité avec `--audit on`), puis efface chaque copie listée dans `src/platform/privacy/data-subject-copies.ts` ; `privacy:purge` lance à la main ce que le *job* `privacy.purge-expired` lance chaque nuit à 03:00 UTC, la purge de ce qui a dépassé sa durée de conservation (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` coupe le *job*) ; l'export rassemble chaque enregistrement listé dans `data-subject-exports.ts` en un document JSON daté (`format`, `subject`, `exportedAt`, `records`), l'export de chaque contexte audité avec `--audit on`, jamais les valeurs (chaque exécution laisse son entrée, un essai compris : essayez-le sur une personne de test). Avec `--tenancy shared-table`, `TENANTS` nomme les tenants, séparés par des virgules : une écriture de données de tenant n'est jamais élargie. Ni l'un ni l'autre n'atteint les sauvegardes, les journaux ou une copie qu'aucun contexte n'a déclarée |
|
|
@@ -2027,6 +2033,7 @@ ajoute, `lint` ce qu'elle ajoute à ESLint ; les *pipelines* générés câblent
|
|
|
2027
2033
|
```
|
|
2028
2034
|
ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab]
|
|
2029
2035
|
[--changed-since <git-ref>] [--explain] [--self]
|
|
2036
|
+
ddd-ts-kit check --baseline write|prune
|
|
2030
2037
|
ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]
|
|
2031
2038
|
ddd-ts-kit check --commit-size [--staged] [--strict]
|
|
2032
2039
|
```
|
|
@@ -2087,6 +2094,26 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
2087
2094
|
règle.
|
|
2088
2095
|
|
|
2089
2096
|
- `paths` et `--changed-since` limitent ce qui est signalé, pas ce qui est analysé.
|
|
2097
|
+
- `--baseline write` consigne les erreurs qu'un projet a déjà, comptées par fichier et par règle,
|
|
2098
|
+
dans `ddd-ts-kit-baseline.json` (la forme de `eslint-suppressions.json`), pour un code existant
|
|
2099
|
+
qui adopte le kit ; commitez-le. Dès lors, `check` et `check-file` (le *hook* de l'agent) taisent
|
|
2100
|
+
les erreurs d'une règle dans un fichier tant qu'elles ne dépassent pas ce que la *baseline*
|
|
2101
|
+
consigne, et les signalent toutes dès qu'elles le dépassent ; `check` échoue quand un compte
|
|
2102
|
+
consigné n'est plus atteint, jusqu'à ce que `--baseline prune` l'abaisse, pour que la *baseline*
|
|
2103
|
+
ne fasse que rétrécir. Les avertissements ne sont pas consignés : ils ne font rien échouer.
|
|
2104
|
+
Écrire une *baseline* est une décision du *owner* du projet, qui lance `--baseline write` dans
|
|
2105
|
+
un terminal : la garde du *plugin* refuse la commande et toute modification directe du fichier
|
|
2106
|
+
à un agent, sous Claude Code, Codex et Copilot de la même façon, et les permissions qu'écrit
|
|
2107
|
+
`init` demandent avant les deux pour un agent sans le *plugin*. Une commande que la garde ne lit
|
|
2108
|
+
pas (un script du projet qui écrit le fichier) n'est pas interceptée : la revue lit le *diff*
|
|
2109
|
+
de la *baseline*, qui ne doit que rétrécir. `--baseline prune` ne demande personne. Un fichier
|
|
2110
|
+
déplacé garde ses comptes : les commandes du kit qui déplacent des fichiers (`move-to-module`,
|
|
2111
|
+
`context-layout`, `platform-folders`) portent son entrée au nouveau chemin, et `--baseline
|
|
2112
|
+
prune` suit les renommages que git voit depuis le commit de la *baseline* (un `git mv`) ; un
|
|
2113
|
+
fichier déplacé autrement signale ses erreurs à son nouveau chemin, et son ancienne entrée
|
|
2114
|
+
échoue jusqu'à ce que le propriétaire réécrive la *baseline*. Une
|
|
2115
|
+
*baseline* fait taire les anciennes erreurs ; elle ne rend pas vérifiable une arborescence hors
|
|
2116
|
+
de l'arborescence canonique.
|
|
2090
2117
|
`--changed-since` lance `git diff --name-only --relative <ref>...` dans le projet.
|
|
2091
2118
|
- `--format github` affiche des annotations `::error file=...,line=...::`.
|
|
2092
2119
|
- `--explain` fait suivre les violations de chaque règle qu'elles signalent, une fois, avec sa
|
|
@@ -2192,6 +2219,8 @@ règle.
|
|
|
2192
2219
|
| `authz/fields-by-schema` | sous `application/queries/` : `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, une comparaison avec un `role`, `isAdmin` |
|
|
2193
2220
|
| `aspects/outside-in` | un import de `@ddd-ts-kit/aspects/decorators` hors de `infrastructure/` d'un contexte et du répertoire de la plateforme : `presentation/`, le fichier de module, `published-language/`, le noyau partagé, `main.ts`, toute autre source (`domain/` et `application/` sont signalés par les deux règles `layer/*` à la place) |
|
|
2194
2221
|
| `tracing/platform-only` | un import de `@ddd-ts-kit/tracing` ou d'un *package* `@opentelemetry/*` hors du répertoire de la plateforme, de `main.ts` et de `apps/`, tests compris |
|
|
2222
|
+
| `nest/no-parallel-pipeline` | dans `presentation/`, `infrastructure/` ou le fichier de module d'un contexte, tests à part : un import d'un contrôleur que Nest sert (ses décorateurs de route et de paramètres, sauf si le fichier importe `KitRoute` ou `KitRoutes` de `@ddd-ts-kit/http/nest`), de la requête ou de la réponse brutes, d'un *guard*, d'un *pipe*, d'un filtre d'exceptions ou d'une `HttpException`, d'un intercepteur ou du `Logger` de `@nestjs/common`, un import sans nom de celui-ci, ou un import d'un *package* de Nest dont le kit fait le travail (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` et les autres de la section 3 d'ARCHITECTURE.md) ; le message dit ce que le kit fait à sa place ; sous la racine des sources hors des contextes, tests à part : un fichier qui importe `Controller` de `@nestjs/common`, ni `KitRoute` ni `KitRoutes`, et nomme `CommandBus` ou `QueryBus` ou importe un fichier d'un contexte |
|
|
2223
|
+
| `nest/controllers-current` | avec `"stack.routes": "nest"` : un `<context>.controllers.ts` qui diffère de ce que donnent les contrôleurs Nest du contexte et les signatures de leurs méthodes, ou absent ; une méthode de route qui ne répond ni une classe DTO, ni `Accepted`, ni `void`, et ne déclare pas de `response` dans `@KitRoute` |
|
|
2195
2224
|
| `tenancy/scoped-statement` | avec `stack.tenancy` autre que `none`, dans `infrastructure/` d'un contexte, tests mis à part : sur Knex, l'exécuteur utilisé autrement que comme argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) et tout `.raw(` ; sur Drizzle, instruction par instruction, une lecture, une mise à jour ou une suppression sur l'exécuteur dont le where n'a ni `tenantCondition(` ni `ownTenantCondition(` (en ligne ou dans la variable locale qu'il reçoit), une insertion dont la ligne n'a pas de `tenantScopeOf(`, une requête relationnelle (`executor().query`), un `execute(` brut, ou l'exécuteur gardé dans une variable ; sur Prisma, instruction par instruction sur le client, une lecture (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) dont le where ne décompose pas `tenantWhere(`, une mise à jour ou une suppression dont le where ne décompose pas `ownTenantWhere(`, une création dont les données ne décomposent pas `tenantScopeOf(` (en ligne ou dans une variable locale que les arguments nomment), `findUnique(`, `upsert(`, une requête brute (`$queryRaw`, `$executeRaw`), ou le client gardé dans une variable ; sur TypeORM, la même chose sur le *manager* (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, la ligne confiée à `insertIgnoringConflict(`, un *query builder* dont le where ne porte aucune condition, `save(`, `upsert(`, `query(`) ; sur les quatre, un magasin de modèle de lecture construit sans son option `tenant`. Un where construit par une autre fonction n'est pas suivi |
|
|
2196
2225
|
| `standard/no-parallel-interface` | une classe, une interface ou un alias de type déclaré comme `ILogger`, `AppLogger`, `LoggerService`, `LoggerInterface`, `IMetrics`, `MetricsService`, `ICache`, `CacheService`, `UserContext`, `CurrentUser`, `AuthContext`, `RequestContext` (hors de `presentation/` et de la plateforme), `UserSession`, `AuthSession`, `SessionData`, `PaginatedResult`, `PageResult`, `PaginatedResponse`, `Paginated`, `PaginationParams`, `PageParams`, `AuditLog`, `AuditLogEntry`, `AuditRecord`, `IJobScheduler`, `JobSchedulerService`, `CronScheduler`, `TaskScheduler`, `IScheduledJob`, `CronJob`, `ScheduledTask`, `BackgroundJob`, `IErrorReporter`, `ErrorReporterService`, `ErrorTracker`, `ExceptionReporter`, `CrashReporter`, `CacheInvalidator`, `CacheInvalidationService`, `CachePurgeService`, `CdnPurger`, `I` suivi d'un nom standard (`IClock`, `IIdGenerator`, `IUnitOfWork`, `ISession`, ...) ou un nom de `standardInterfaces` ; une classe qui implémente ou étend l'interface standard est un adaptateur et n'est pas signalée |
|
|
2197
2226
|
| `events/outbox-required` | `stack.events` autre que `outbox` avec un ORM et sans dérogation `stack.events` ; dans `domain/` et `application/`, l'import d'un client de *broker* ou d'une implémentation de bus ou de relais ; un *publisher* qui dépend de plus que `IntegrationEventPublisher` ; un module de la plateforme qui distribue un *publisher* et ne nomme jamais `OutboxPublisher` |
|
|
@@ -2374,13 +2403,16 @@ exactement comme le chemin relatif vers le même fichier.
|
|
|
2374
2403
|
## check-file
|
|
2375
2404
|
|
|
2376
2405
|
```
|
|
2377
|
-
ddd-ts-kit check-file <path>
|
|
2406
|
+
ddd-ts-kit check-file <path> [--content-from <file>] [--rule <id>]...
|
|
2378
2407
|
```
|
|
2379
2408
|
|
|
2380
2409
|
Exécute les règles par fichier (couches, contextes, nommage, événements, langage, pureté, code
|
|
2381
2410
|
propre, *mocks*, composition, désactivations) sur un fichier sans parcourir le projet : conçu pour
|
|
2382
2411
|
un *hook* d'éditeur ou d'agent après chaque écriture. Un fichier qui n'est pas une source du
|
|
2383
|
-
projet est ignoré.
|
|
2412
|
+
projet est ignoré. `--content-from <file>` juge le texte de ce fichier comme le contenu de
|
|
2413
|
+
`<path>`, qui n'a pas besoin d'exister encore : ce qu'une session s'apprête à écrire, comme la
|
|
2414
|
+
garde du *plugin* le lit avant l'écriture sous `"dependenciesBeforeWrite": true`. `--rule`
|
|
2415
|
+
restreint les règles ; la *baseline* du projet s'applique comme pour un fichier sur le disque.
|
|
2384
2416
|
|
|
2385
2417
|
## lint
|
|
2386
2418
|
|
package/README.md
CHANGED
|
@@ -82,8 +82,11 @@ of the project write them for a project without a route or an integration event
|
|
|
82
82
|
`"openapi": { "format": "json" }` of the config), so that the first commit holds them and
|
|
83
83
|
`docs:check` passes at once; a contract that is already there is
|
|
84
84
|
left alone, `--force` included. An existing `package.json` is merged: missing scripts and
|
|
85
|
-
dependencies are added, yours are kept and mentioned in the notes.
|
|
86
|
-
the stack
|
|
85
|
+
dependencies are added, yours are kept and mentioned in the notes. The first time, the notes also
|
|
86
|
+
name each dependency the stack about to be written contradicts, and the flag that keeps it
|
|
87
|
+
(`package.json depends on fastify, and the project is written for --http express: pass --http
|
|
88
|
+
fastify to keep it.`), a dry run included: run `init --dry-run` first on an existing project.
|
|
89
|
+
Run again later, `init` keeps the stack recorded in the config.
|
|
87
90
|
|
|
88
91
|
`init --force` on a project that is already initialised rewrites the files `init` owns and keeps
|
|
89
92
|
the config: the contexts and their upstreams, the rules, the limits, the deviations and every
|
|
@@ -451,7 +454,9 @@ schema per route, an identifier answer included, as 0.1 to 0.5 wrote them.
|
|
|
451
454
|
`generate value-object` writes a `create` that returns the value object or throws the refusal of
|
|
452
455
|
its concept, and a spec that asserts it with `expectRefusal(() => ..)`. `--value-objects result`,
|
|
453
456
|
or a config without the key, keeps a `create` returning a `Result` that the caller unwraps, as 0.1
|
|
454
|
-
to 0.5 wrote it; `value-objects` moves a project from one to the other.
|
|
457
|
+
to 0.5 wrote it; `value-objects` moves a project from one to the other. `generate property` writes
|
|
458
|
+
the laws of an existing value object as a spec on generated values, in either form, and adds
|
|
459
|
+
`fast-check` to the development dependencies when it is missing.
|
|
455
460
|
|
|
456
461
|
**Domain events leave with the save.** A generated command handler builds or loads its aggregate,
|
|
457
462
|
calls one intention method, `await repository.save(aggregate)` and returns: no `pullEvents()`, and
|
|
@@ -544,14 +549,14 @@ config, `docsUi`, `ci` and `logger` included.
|
|
|
544
549
|
| `--event-sourcing on` | recorded as `stack.eventSourcing`, `off` unless asked: `Persistence` gains `eventSourcing` (`create<Orm>EventSourcing` in the `event_store` schema, whose five tables the schema file declares; the in-memory stores with `--orm none`), and `src/platform/event-sourcing/`: `create-event-sourcing.ts` (`EventSourcing`: the stores, the `SubjectKeyStore` wrapped by `auditedSubjectKeys` with `--audit on`, and the `PersonalDataCipher` over it) and, on tsyringe, `event-sourcing.module.ts` (binds `EventStore`, `SnapshotStore`, `CheckpointStore`, `SubjectKeyStore` and `PersonalDataCipher`, so an event-sourced repository adapter names them in its constructor; the hand-wired `Platform` carries them as `platform.eventSourcing`); `platform-test.module.ts` binds the in-memory stores, so a handler spec of an event-sourced aggregate needs no fake. `generate aggregate --event-sourced` is refused without it, with the `init --force --event-sourcing on` to run. Refused with `--orm custom`: the event store of the kit runs on PostgreSQL through the four ORM packages |
|
|
545
550
|
| `--privacy on` | recorded as `stack.privacy`, `on` when there is an ORM: `src/platform/privacy/`, with `data-subject-copies.ts` and `data-subject-exports.ts` (the ports, or the adapters by hand, of the contexts that extend `PersonalDataErasure` and `PersonalDataExport`, between markers; `generate repository --personal` lists the erasure and the export of a context there), `run-erasure.ts` (`runErasure(subject, { operator, correlationId, tenants? })`: an execution context of origin `cli` with the operator as actor, the key of the subject when the project has an event store, then `eraseDataSubject` of the kernel over the copies, `inEachTenant` with `--tenancy shared-table`, then `privacy.data-subject.erased` published through the outbox, once per tenant) and `run-export.ts` (`runExport(subject, { operator, correlationId, tenants? })`: `exportDataSubject` of the kernel over the exports, each wrapped by `auditedPersonalDataExport` with `--audit on`, `recordsInEachTenant` with `--tenancy shared-table`, one dated `PersonalDataExportDocument`), and the two scripts below. `docs/privacy/register.md`, the register of personal data `ddd-ts-kit docs` keeps (see `docs` below). A project without personal data takes `--privacy off` and pays nothing. No HTTP command erases yet: the two scripts are the entry points |
|
|
546
551
|
| `--tenancy shared-table` | recorded as `stack.tenancy`; the four ORMs. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` (Knex), `tenantCondition` and `ownTenantCondition` (Drizzle), `tenantWhere` and `ownTenantWhere` (Prisma, TypeORM); the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, `tenantOutboxTable`, the `tenantId` field of the Prisma model and `PrismaOutboxStore`'s `tenant: true`, `outboxEntity({ tenant: true })`), so consumers run in it; `tenancy/scoped-statement` judges the adapters. Row-level security, schema per tenant and database per tenant are refused, with what to wire by hand ([Multitenancy](../../docs/concepts/multitenancy.md)) |
|
|
547
|
-
| `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex
|
|
552
|
+
| `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex, Drizzle, Prisma and TypeORM, whatever the container): the tables of the ORM package (`createJobTable` and `createProcessTable`, `jobsTable` and `processesTable`, the `BackgroundJob` and `ProcessInstance` models, `jobEntity` and `processEntity`) in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform binds `JobStore` and `ProcessStore` to them (the platform module on tsyringe, `jobs/create-background-work.ts` where the platform is wired by hand or under Nest), so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default with a custom persistence or none): nothing is written, both stay in the process. Refused: `database` with another ORM, `redis` without the cache |
|
|
548
553
|
| `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices`: the cache bound to the kernel `Cache`, the limiter to `RateLimiter`, the lock to `Lock`, which keeps a scheduled job to one instance, the relay signal as the `wakeOn` of the outbox relay with `relayWakeUpMiddleware` on the command bus), `http/too-many-requests-for.ts` (one sliding window per caller address, 429 `application/problem+json` with `retry-after`; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` on the HTTP server, `REDIS_URL` validated, a compose service `cache` running Dragonfly with a healthcheck. Without a server (tools, tests without `REDIS_URL`) the same ports stay in the memory of the process |
|
|
549
554
|
| `--http-cache varnish` | a compose service `varnish` (Varnish 9.1.0, reaching the API on `host.docker.internal`) with its VCL in `docker/varnish/default.vcl` (only answers whose `Cache-Control` allows them by `max-age` or `s-maxage` are kept, filed under their `xkey` tags, purged by `PURGE` from the machine of Varnish or with `VARNISH_PURGE_KEY`, `x-cache: HIT\|MISS`), `VARNISH_URL` and `VARNISH_PURGE_KEY` validated, `cacheTags: { header: CacheTagHeader.xkey }` in the HTTP boundary, and the outbox relay of `main.ts` and of every `generate service` entry point publishing through `PurgingPublisher` with `VarnishCachePurger` (the end-to-end application records the purges in `purges`); on `--di manual` and `nest` the platform gains `cacheInvalidation`; with `--tenancy`, the tags of the answers and the purges are filed under the tenant (`perTenant`) and the tenant of a request is read from `x-tenant-id`. Needs an HTTP framework and `--events outbox`: a purge is a row of the outbox |
|
|
550
555
|
| `--errors sentry` | unexpected failures reported to Sentry or GlitchTip (one protocol, only the DSN differs) through the kernel `ErrorReporter`, bound to `@ddd-ts-kit/sentry`. `src/platform/observability/errors.ts` (`initSentry` on the validated configuration, then `reportProcessFailures`), the second import of `main.ts`, of `apps/<context>/main.ts` and of `apps/worker/main.ts`, right after `tracing.ts`; `errors` handed to `composeApplication`, which gives it to the kernel module on tsyringe (`errorReporter`, flushed by `container.stop()` before the logger, `errorReportingMiddleware` first on both buses, the default scheduler observing with `reportFailedRuns`) or to `createPlatform` by hand (the same middleware, `onRun: reportFailedRuns(errors)`, `platform.errors`, flushed two seconds at most when the application stops); `reportHttpErrors` in `auth/authentication/http-boundary.ts` for every request answered 5xx; `DeadLetterReports` on the `onFailure` hook of a provided broker (`createEventProvider(config, errors)`, with `observing` around each consumer) and of the outbox relay. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (default: `NODE_ENV`), `SENTRY_RELEASE` and `SENTRY_SCRUB_MESSAGES` validated in `config/load-config.ts` as `errorReporting`: without a DSN the application starts and reports nothing; a DSN that is not a URL refuses the start. Dependencies `@ddd-ts-kit/sentry` and `@sentry/node`. A compose profile `errors` running GlitchTip 6.2.6 with its own PostgreSQL and Valkey (`GLITCHTIP_PORT`, loopback only, development bootstrap), and a section of the generated README saying how to read its DSN. The tools and the tests compose the application without a reporter. It goes with every other choice of the stack; with `--errors none` nothing of this is written |
|
|
551
556
|
| `--authn keycloak` | a compose service `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profile `identity`) and `docker/keycloak/<project>-realm.json`: the API client, a public client `<project>-local` with the direct grant, its audience and `tenant_id` mappers, the realm role `admin`, and the demo users `demo-admin` and `demo-user`, for local development only |
|
|
552
557
|
| `--storage local\|s3` | recorded as `stack.storage`: where the content of files lives, never in the database. `src/platform/config/read-files.ts` and `src/platform/files/open-files.ts`, one per choice: `local`, a directory in development (`FILES_DIRECTORY`, `.data/files`) and the signed links answered by the application under `/files` (`FILES_PUBLIC_URL` and `FILES_SIGNING_SECRET` required in production); `s3`, a bucket of any provider of the S3 protocol through `@ddd-ts-kit/s3` (the `S3_*` variables, MinIO in the compose stack); the memory of the process in the tests and the tools, either way. With `--di tsyringe`: `files/bind-files.ts`, `files/files.module.ts` and `files/staging-uploads.ts`; with hand wiring `files/create-files.ts`; with an HTTP stack `files/file-routes.ts`. They bind `FileStorage`, `FileKeys`, `FileScanner` and `FileStaging`, register the hourly purge of staged files and stage the file a command carries before its transaction; `generate file-upload` needs them. `--storage none` writes none of this ([File storage](../../docs/concepts/file-storage.md)) |
|
|
553
558
|
| `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, and for `--broker` `create-event-provider.ts`: `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, with `aggregate-key-of.ts` for per-aggregate order), `NatsEventBus` (`NATS_URL`) or `RedisStreamsEventBus` of `@ddd-ts-kit/redis/event-bus` (`REDIS_URL`: Redis, Dragonfly or Valkey), each with one subscriber per consuming context (`forConsumer`), `assertTopology` at start, its address validated and a compose service with a healthcheck; or `custom-event-bus.ts` with its `eventBusContract` spec. `start-outbox-relay.ts` with the outbox. `--broker redis` with `--cache redis` is one server and one compose service, `cache`; alone, the service is `streams` |
|
|
554
|
-
| `src/platform/database/` | `persistence.ts` (`interface Persistence`: unit of work, outbox and processed-event stores of the ORM package, the storage handle), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, the connection (`connect-to-database.ts`, `create-client.ts` or `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, the schema of what the kit stores for the application), `open-test-database.ts` (PostgreSQL in process, or the server named by a URL; with Vitest each spec opens a copy of the cluster `test/support/test-database-template.ts`, the global setup of the run, initialised once, and creates its tables there; with drizzle from `table-statements.ts`, the SQL of the tables of `schema.ts`, since drizzle-kit writes migrations, not tables). The storage class a repository adapter names in its dependency list: `database.ts` with drizzle and prisma (`abstract class Database extends` the context type of the ORM package), `KnexContext` of `@ddd-ts-kit/knex`, `TypeOrmContext` of `@ddd-ts-kit/typeorm` |
|
|
559
|
+
| `src/platform/database/` | `persistence.ts` (`interface Persistence`: unit of work, outbox and processed-event stores of the ORM package, the storage handle), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, the connection (`connect-to-database.ts`, `create-client.ts` or `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, the schema of what the kit stores for the application), `open-test-database.ts` (PostgreSQL in process, or the server named by a URL; with Vitest each spec opens a copy of the cluster `test/support/test-database-template.ts`, the global setup of the run, initialised once, and creates its tables there; with drizzle from `table-statements.ts`, the SQL of the tables of `schema.ts`, since drizzle-kit writes migrations, not tables, its unique indexes included), `persistence.contract.spec.ts` (the outbox, processed-event, job and process stores as the platform wires them, held to the contracts of `@ddd-ts-kit/testing` with what the stack turns on: the tenant under `--tenancy`, the unit of work). The storage class a repository adapter names in its dependency list: `database.ts` with drizzle and prisma (`abstract class Database extends` the context type of the ORM package), `KnexContext` of `@ddd-ts-kit/knex`, `TypeOrmContext` of `@ddd-ts-kit/typeorm` |
|
|
555
560
|
| migration tooling | `drizzle.config.ts`, `knexfile.js` and `migrations/00000000000000_initial.js`, `prisma/schema.prisma` and `prisma.config.ts`, or `data-source.ts` |
|
|
556
561
|
| `scripts/openapi.ts`, `scripts/events.ts` | write `openapi/openapi.yaml` (one file per document of `openapi.documents`), `docs/integration/asyncapi.yaml` and `docs/integration/event-catalog.md`, in JSON under `openapi.format: json`; `--check` fails on a difference |
|
|
557
562
|
| `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | with `--privacy on`, the two requests of a data subject, answered from the command line on the sources with the variables of `.env` (`npm run privacy:erase -- <subject-id> [--operator <who-asks>]`, `npm run privacy:export -- <subject-id> > export.json`): the erasure destroys the key of the subject first when the project has an event store (`--event-sourcing on`: its stored events read as erased; audited with `--audit on`), then erases every copy listed in `src/platform/privacy/data-subject-copies.ts`; `privacy:purge` runs by hand what the job `privacy.purge-expired` runs every night at 03:00 UTC, the purge of what outlived its retention (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` switches the job off); the export gathers every record listed in `data-subject-exports.ts` into one dated JSON document (`format`, `subject`, `exportedAt`, `records`), the export of each context audited with `--audit on`, never the values (every run leaves its entry, a trial included: try it on a test subject). With `--tenancy shared-table`, `TENANTS` names the tenants, comma separated: a write of tenant data is never widened. Neither reaches backups, logs or a copy no context declared |
|
|
@@ -1910,6 +1915,7 @@ generated pipelines wire all three.
|
|
|
1910
1915
|
```
|
|
1911
1916
|
ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab]
|
|
1912
1917
|
[--changed-since <git-ref>] [--explain] [--self]
|
|
1918
|
+
ddd-ts-kit check --baseline write|prune
|
|
1913
1919
|
ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]
|
|
1914
1920
|
ddd-ts-kit check --commit-size [--staged] [--strict]
|
|
1915
1921
|
```
|
|
@@ -1969,6 +1975,23 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
1969
1975
|
`ddd-ts-kit explain <rule-id>` prints the same kind of bad and good example for every rule.
|
|
1970
1976
|
|
|
1971
1977
|
- `paths` and `--changed-since` limit what is reported, not what is analysed.
|
|
1978
|
+
- `--baseline write` records the errors a project already has, counted by file and by rule, in
|
|
1979
|
+
`ddd-ts-kit-baseline.json` (the shape of `eslint-suppressions.json`), for a codebase that adopts
|
|
1980
|
+
the kit; commit it. From then on `check` and `check-file` (the hook of the agent) leave quiet the
|
|
1981
|
+
errors of a rule in a file while they are no more than the baseline records, and report all of
|
|
1982
|
+
them once they are more; `check` fails when a recorded count is no longer reached, until
|
|
1983
|
+
`--baseline prune` lowers it, so that the baseline only shrinks. Warnings are not recorded: they
|
|
1984
|
+
fail nothing. Writing a baseline is a decision of the project owner, who runs `--baseline write`
|
|
1985
|
+
in a terminal: the guard of the plugin refuses the command and any direct edit of the file to an
|
|
1986
|
+
agent, under Claude Code, Codex and Copilot alike, and the permissions `init` writes ask before
|
|
1987
|
+
both for an agent without the plugin. A command the guard does not read (a script of the
|
|
1988
|
+
project that writes the file) is not caught: the review reads the diff of the baseline, which
|
|
1989
|
+
should only shrink. `--baseline prune` needs no one. A file that moves keeps its counts: the
|
|
1990
|
+
commands of the kit that move files (`move-to-module`, `context-layout`, `platform-folders`)
|
|
1991
|
+
carry its entry to the new path, and `--baseline prune` follows the renames git sees since the
|
|
1992
|
+
baseline was committed (a `git mv`); a file moved otherwise reports its errors at its new path,
|
|
1993
|
+
and its old entry fails until the owner writes the baseline again. A baseline makes old errors quiet; it does
|
|
1994
|
+
not make a tree outside the canonical one checkable.
|
|
1972
1995
|
`--changed-since` runs `git diff --name-only --relative <ref>...` in the project.
|
|
1973
1996
|
- `--format github` prints `::error file=...,line=...::` annotations.
|
|
1974
1997
|
- `--explain` follows the violations with each rule they report, once, with its description and
|
|
@@ -2067,6 +2090,8 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
2067
2090
|
| `authz/fields-by-schema` | under `application/queries/`: `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, a comparison with a `role`, `isAdmin` |
|
|
2068
2091
|
| `aspects/outside-in` | an import of `@ddd-ts-kit/aspects/decorators` outside `infrastructure/` of a context and the platform directory: `presentation/`, the module file, `published-language/`, the shared kernel, `main.ts`, any other source (`domain/` and `application/` are reported by the two `layer/*` rules instead) |
|
|
2069
2092
|
| `tracing/platform-only` | an import of `@ddd-ts-kit/tracing` or of an `@opentelemetry/*` package outside the platform directory, `main.ts` and `apps/`, tests included |
|
|
2093
|
+
| `nest/no-parallel-pipeline` | in `presentation/`, `infrastructure/` or the module file of a context, tests apart: an import of a controller Nest serves (its route and parameter decorators, unless the file imports `KitRoute` or `KitRoutes` of `@ddd-ts-kit/http/nest`), the raw request or answer, a guard, a pipe, an exception filter or an `HttpException`, an interceptor or the `Logger` of `@nestjs/common`, a bare import of it, or an import of a package of Nest whose work the kit does (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` and the others of section 3 of ARCHITECTURE.md); the message names what the kit does in its place; under the source root outside the contexts, tests apart: a file that imports `Controller` of `@nestjs/common`, neither `KitRoute` nor `KitRoutes`, and names `CommandBus` or `QueryBus` or imports a file of a context |
|
|
2094
|
+
| `nest/controllers-current` | with `"stack.routes": "nest"`: a `<context>.controllers.ts` that differs from what the Nest controllers of the context and the signatures of their methods give, or is missing; a route method that answers no DTO class, `Accepted` or `void` and declares no `response` in `@KitRoute` |
|
|
2070
2095
|
| `tenancy/scoped-statement` | with `stack.tenancy` other than `none`, in `infrastructure/` of a context, tests aside: on Knex the executor used other than as an argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) and any `.raw(`; on Drizzle, statement by statement, a read, update or delete on the executor whose where has no `tenantCondition(` nor `ownTenantCondition(` (inline or in the local it is given), an insert whose row has no `tenantScopeOf(`, a relational query (`executor().query`), a raw `execute(`, or the executor held in a variable; on Prisma, statement by statement on the client, a read (`findFirst(`, `findMany(`, `count(`, `aggregate(`, `groupBy(`) whose where spreads no `tenantWhere(`, an update or a delete whose where spreads no `ownTenantWhere(`, a create whose data spreads no `tenantScopeOf(` (inline or in a local the arguments name), `findUnique(`, `upsert(`, a raw query (`$queryRaw`, `$executeRaw`), or the client held in a variable; on TypeORM the same on the manager (`find*(`, `count*(`, `update(`, `delete(`, `insert(`, the row handed to `insertIgnoringConflict(`, a query builder whose where carries no condition, `save(`, `upsert(`, `query(`); on the four, a read model store built without its `tenant` option. A where built by another function is not followed |
|
|
2071
2096
|
| `standard/no-parallel-interface` | a class, interface or type alias declared as `ILogger`, `AppLogger`, `LoggerService`, `LoggerInterface`, `IMetrics`, `MetricsService`, `ICache`, `CacheService`, `UserContext`, `CurrentUser`, `AuthContext`, `RequestContext` (outside `presentation/` and the platform), `UserSession`, `AuthSession`, `SessionData`, `PaginatedResult`, `PageResult`, `PaginatedResponse`, `Paginated`, `PaginationParams`, `PageParams`, `AuditLog`, `AuditLogEntry`, `AuditRecord`, `IJobScheduler`, `JobSchedulerService`, `CronScheduler`, `TaskScheduler`, `IScheduledJob`, `CronJob`, `ScheduledTask`, `BackgroundJob`, `IErrorReporter`, `ErrorReporterService`, `ErrorTracker`, `ExceptionReporter`, `CrashReporter`, `CacheInvalidator`, `CacheInvalidationService`, `CachePurgeService`, `CdnPurger`, `I` followed by a standard name (`IClock`, `IIdGenerator`, `IUnitOfWork`, `ISession`, ...) or a name of `standardInterfaces`; a class that implements or extends the standard interface is an adapter and is not reported |
|
|
2072
2097
|
| `events/outbox-required` | `stack.events` other than `outbox` with an ORM and no `stack.events` deviation; in `domain/` and `application/`, the import of a broker client or of a bus or relay implementation; a publisher depending on more than `IntegrationEventPublisher`; a platform module that hands out a publisher and never names `OutboxPublisher` |
|
|
@@ -2229,12 +2254,16 @@ import is judged by every boundary rule exactly as the relative path to the same
|
|
|
2229
2254
|
## check-file
|
|
2230
2255
|
|
|
2231
2256
|
```
|
|
2232
|
-
ddd-ts-kit check-file <path>
|
|
2257
|
+
ddd-ts-kit check-file <path> [--content-from <file>] [--rule <id>]...
|
|
2233
2258
|
```
|
|
2234
2259
|
|
|
2235
2260
|
Runs the per-file rules (layers, contexts, naming, events, language, purity, clean code, mocks,
|
|
2236
2261
|
composition, suppressions) on one file without walking the project: meant for an editor or
|
|
2237
2262
|
agent hook after each write. A file that is not a source of the project is ignored.
|
|
2263
|
+
`--content-from <file>` judges the text of that file as the content of `<path>`, which need not
|
|
2264
|
+
exist yet: what a session is about to write, as the guard of the plugin reads it before the write
|
|
2265
|
+
under `"dependenciesBeforeWrite": true`. `--rule` narrows the rules; the baseline of the project
|
|
2266
|
+
applies as for a file on disk.
|
|
2238
2267
|
|
|
2239
2268
|
## lint
|
|
2240
2269
|
|
package/dist/alias/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export type { BuildLayout } from './build-layout.js';
|
|
|
8
8
|
export { DEFAULT_BUILD_LAYOUT } from './default-build-layout.js';
|
|
9
9
|
export { directoryAlias } from './directory-alias.js';
|
|
10
10
|
export { FIXED_ALIAS_ROOTS } from './fixed-alias-roots.js';
|
|
11
|
-
export { moduleNameMapper } from './module-name-mapper.js';
|
|
11
|
+
export { moduleNameMapper, type MapperTarget } from './module-name-mapper.js';
|
|
12
|
+
export { mapperTargetText } from './mapper-target-text.js';
|
|
12
13
|
export { specifierOf } from './specifier-of.js';
|
|
13
14
|
export { specifierSuffix } from './specifier-suffix.js';
|
|
14
15
|
export { toAlias } from './to-alias.js';
|