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/dist/stack/stack-vars.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QUEUE_ORMS } from '../config/index.js';
|
|
1
2
|
import { aliasVars } from './alias-vars.js';
|
|
2
3
|
import { auditVars } from './audit-vars.js';
|
|
3
4
|
import { authenticationVars } from './authentication-vars.js';
|
|
@@ -98,7 +99,7 @@ function queueVars(config) {
|
|
|
98
99
|
return {
|
|
99
100
|
...one(queue, ['memory', 'database', 'redis']),
|
|
100
101
|
stored: queue !== 'memory',
|
|
101
|
-
processTable: queue !== 'memory' && (orm
|
|
102
|
+
processTable: queue !== 'memory' && QUEUE_ORMS.includes(orm),
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
105
|
/** How the code is written: its refusals, its shared schemas, its value objects, its closed values. */
|
|
@@ -121,10 +122,10 @@ function routeVars(config) {
|
|
|
121
122
|
const { routes, style, http, audit } = config.stack;
|
|
122
123
|
const declaredControllers = http !== 'none' && style === 'declared';
|
|
123
124
|
return {
|
|
124
|
-
...one(routes, ['controllers', 'functions']),
|
|
125
|
+
...one(routes, ['controllers', 'functions', 'nest']),
|
|
125
126
|
listed: http !== 'none' && !(style === 'declared' && routes === 'controllers'),
|
|
126
127
|
declaredControllers,
|
|
127
|
-
mountsControllers: declaredControllers || (http !== 'none' && audit === 'on' && routes
|
|
128
|
+
mountsControllers: declaredControllers || (http !== 'none' && audit === 'on' && routes !== 'functions'),
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
@@ -147,12 +148,16 @@ function assemblyVars(config) {
|
|
|
147
148
|
discovery: style === 'declared' && assembly === 'discovery',
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
|
-
/** The HTTP framework,
|
|
151
|
+
/** The HTTP framework, the shared cache in front of it, and the procedures served next to it. */
|
|
151
152
|
function edgeVars(config) {
|
|
152
|
-
const { httpCache, tenancy } = config.stack;
|
|
153
|
+
const { httpCache, tenancy, rpc } = config.stack;
|
|
153
154
|
// A multi-tenant application files its tags under the tenant, on the answers and on the purges alike.
|
|
154
155
|
const perTenant = httpCache !== 'none' && tenancy !== 'none';
|
|
155
|
-
return {
|
|
156
|
+
return {
|
|
157
|
+
http: httpVars(config),
|
|
158
|
+
httpCache: { ...one(httpCache, ['none', 'varnish']), perTenant },
|
|
159
|
+
rpc: one(rpc, ['none', 'orpc', 'trpc']),
|
|
160
|
+
};
|
|
156
161
|
}
|
|
157
162
|
function httpVars(config) {
|
|
158
163
|
const { http } = config.stack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,0FAA0F;AAC1F,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KA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ACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.91.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.91.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"description": "Bootstrap, scaffold and verify Domain-Driven Design (DDD), Clean Architecture and hexagonal TypeScript backends on Node.js: project and code generators, architecture checks, OpenAPI and AsyncAPI documents, for developers and AI coding agents (Claude Code, Codex, GitHub Copilot).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../s3/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@ddd-ts-kit/audit": "^0.
|
|
56
|
-
"@ddd-ts-kit/events": "^0.
|
|
57
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
55
|
+
"@ddd-ts-kit/audit": "^0.91.0",
|
|
56
|
+
"@ddd-ts-kit/events": "^0.91.0",
|
|
57
|
+
"@ddd-ts-kit/kernel": "^0.91.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -21,24 +21,29 @@ describe('A bounded context is a deployable unit in waiting', () => {
|
|
|
21
21
|
).not.toThrow();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
// Jest refuses a table without rows: until the first context joins the project, its cases wait.
|
|
25
|
+
if (contexts.length === 0) {
|
|
26
|
+
it.todo('wires each context alone, with its scheduled jobs, once the project has one');
|
|
27
|
+
} else {
|
|
28
|
+
it.each(contexts)(
|
|
29
|
+
'%s wires alone from its declarations, on the kernel and the platform, with no other context',
|
|
30
|
+
(_name, module) => {
|
|
31
|
+
expect(() =>
|
|
32
|
+
createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
|
|
33
|
+
).not.toThrow();
|
|
34
|
+
},
|
|
35
|
+
);
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
|
|
38
|
+
const application = createTestApplication({
|
|
39
|
+
modules: [platformTestModule, authorization, module],
|
|
40
|
+
authorization: 'optional',
|
|
41
|
+
});
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
const jobs = application.describe().jobs.map((job) => job.name);
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
|
|
46
|
+
expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
44
49
|
});
|
|
@@ -16,17 +16,22 @@ describe('A bounded context is a deployable unit in waiting', () => {
|
|
|
16
16
|
expect(() => createPlatform(inertPersistence(), { events: inProcessEvents() })).not.toThrow();
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// Jest refuses a table without rows: until the first context joins the project, its cases wait.
|
|
20
|
+
if (contexts.length === 0) {
|
|
21
|
+
it.todo('wires each context alone, with its scheduled jobs, once the project has one');
|
|
22
|
+
} else {
|
|
23
|
+
it.each(contexts)('%s wires alone, on the platform, with no other context', (name, module) => {
|
|
24
|
+
const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
expect(module(platform).name).toBe(name);
|
|
27
|
+
});
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
|
|
30
|
+
const platform = createPlatform(inertPersistence(), { events: inProcessEvents() });
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
module(platform);
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
expect(platform.jobs.describe().filter((job) => !job.name.startsWith(name + '.'))).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
32
37
|
});
|
|
@@ -21,21 +21,26 @@ describe('A bounded context is a deployable unit in waiting', () => {
|
|
|
21
21
|
).not.toThrow();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
modules: [platformTestModule, authorization, module],
|
|
33
|
-
authorization: 'optional',
|
|
24
|
+
// Jest refuses a table without rows: until the first context joins the project, its cases wait.
|
|
25
|
+
if (contexts.length === 0) {
|
|
26
|
+
it.todo('wires each context alone, with its scheduled jobs, once the project has one');
|
|
27
|
+
} else {
|
|
28
|
+
it.each(contexts)('%s wires alone, on the kernel and the platform, with no other context', (_name, module) => {
|
|
29
|
+
expect(() =>
|
|
30
|
+
createTestApplication({ modules: [platformTestModule, authorization, module], authorization: 'optional' }),
|
|
31
|
+
).not.toThrow();
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
it.each(contexts)('%s takes its scheduled jobs with it, and no job of another context', (name, module) => {
|
|
35
|
+
const application = createTestApplication({
|
|
36
|
+
modules: [platformTestModule, authorization, module],
|
|
37
|
+
authorization: 'optional',
|
|
38
|
+
});
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const jobs = application.describe().jobs.map((job) => job.name);
|
|
41
|
+
|
|
42
|
+
expect(jobs.filter((job) => !job.startsWith(name + '.'))).toEqual([]);
|
|
43
|
+
expect(application.jobs.scheduler.describe().map((job) => job.name)).toEqual(jobs);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
41
46
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { UseCaseDeclaration } from '@ddd-ts-kit/auth';
|
|
2
|
+
{{#if routes.nest}}
|
|
3
|
+
import type { Type } from '@nestjs/common';
|
|
4
|
+
import { {{context.camel}}Controllers } from '{{alias.context}}/{{context.kebab}}.controllers{{alias.ext}}';
|
|
5
|
+
{{/if}}
|
|
2
6
|
{{#if http.any}}
|
|
3
7
|
import type { Route } from '@ddd-ts-kit/http';
|
|
4
8
|
{{/if}}
|
|
@@ -12,6 +16,10 @@ export interface {{context.pascal}}Wiring {
|
|
|
12
16
|
{{#if http.any}}
|
|
13
17
|
readonly routes: readonly Route[];
|
|
14
18
|
{{/if}}
|
|
19
|
+
{{#if routes.nest}}
|
|
20
|
+
/** Its Nest controllers, listed by the generated `{{context.kebab}}.controllers.ts`: Nest builds them, the kit serves their methods. */
|
|
21
|
+
readonly controllers: readonly Type<unknown>[];
|
|
22
|
+
{{/if}}
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export function {{context.camel}}Module(platform: Platform): {{context.pascal}}Wiring {
|
|
@@ -30,5 +38,8 @@ export function {{context.camel}}Module(platform: Platform): {{context.pascal}}W
|
|
|
30
38
|
// /ddd-ts-kit:routes
|
|
31
39
|
],
|
|
32
40
|
{{/if}}
|
|
41
|
+
{{#if routes.nest}}
|
|
42
|
+
controllers: {{context.camel}}Controllers,
|
|
43
|
+
{{/if}}
|
|
33
44
|
};
|
|
34
45
|
}
|
|
@@ -6,8 +6,14 @@ export default {
|
|
|
6
6
|
// Jest does not read tsconfig: the import aliases of its "paths", repeated here, and held equal by `ddd-ts-kit check` (imports/alias-declared).
|
|
7
7
|
moduleNameMapper: {
|
|
8
8
|
{{alias.jestMapper}}
|
|
9
|
+
{{#if orm.prisma}}
|
|
10
|
+
// The client `prisma generate` writes names its own modules with `.js`: they are TypeScript sources, which Jest transforms.
|
|
11
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
12
|
+
{{/if}}
|
|
9
13
|
},
|
|
10
14
|
testMatch: ['<rootDir>/{{config.sourceRoot}}/**/*.spec.ts', '<rootDir>/test/architecture/**/*.spec.ts'],
|
|
15
|
+
// A hook opens the test database (PGlite started and its tables created, or a server reached): on a busy machine it outlasts the 5 seconds Jest gives a test and its hooks, as Vitest is given 60.
|
|
16
|
+
testTimeout: 60_000,
|
|
11
17
|
// Each spec file is held to the time budget of its level ("budget" in ddd-ts-kit.config.json, the reference when it is absent): the slowest named at the end of the run, a file over its budget fails it.
|
|
12
18
|
reporters: ['default', '@ddd-ts-kit/testing/budget/jest'],
|
|
13
19
|
// A pull request names the contexts its change reaches (DDD_TS_KIT_AFFECTED, from `ddd-ts-kit affected`): the specs of the others are left to the default branch.
|
|
@@ -11,6 +11,12 @@ import { subscribeAll } from '@ddd-ts-kit/events';
|
|
|
11
11
|
{{#if http.any}}
|
|
12
12
|
import { createErrorMapper, defineRoutes, type Route } from '@ddd-ts-kit/http';
|
|
13
13
|
{{/if}}
|
|
14
|
+
{{#if routes.nest}}
|
|
15
|
+
import type { Type } from '@nestjs/common';
|
|
16
|
+
import { type NestControllers, nestControllers } from '@ddd-ts-kit/http/nest';
|
|
17
|
+
import { CommandBus, QueryBus } from '@ddd-ts-kit/kernel';
|
|
18
|
+
import { classSchema } from '@ddd-ts-kit/validation/class-validator';
|
|
19
|
+
{{/if}}
|
|
14
20
|
{{#if audit.archive}}
|
|
15
21
|
import { ArchiveAuditEntries } from '@ddd-ts-kit/audit';
|
|
16
22
|
{{/if}}
|
|
@@ -58,6 +64,10 @@ interface ContextWiring {
|
|
|
58
64
|
{{#if http.any}}
|
|
59
65
|
readonly routes: readonly Route[];
|
|
60
66
|
{{/if}}
|
|
67
|
+
{{#if routes.nest}}
|
|
68
|
+
/** Its Nest controllers, which Nest builds and the kit serves. */
|
|
69
|
+
readonly controllers?: readonly Type<unknown>[];
|
|
70
|
+
{{/if}}
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
{{#if http.any}}
|
|
@@ -84,6 +94,10 @@ export interface Application {
|
|
|
84
94
|
/** Authenticates every request and runs it inside the execution scope. */
|
|
85
95
|
readonly boundary: HttpBoundary;
|
|
86
96
|
{{/if}}
|
|
97
|
+
{{#if routes.nest}}
|
|
98
|
+
/** The Nest controllers of the contexts: their routes are among `routes`, Nest builds them with the buses they inject. */
|
|
99
|
+
readonly controllers: NestControllers;
|
|
100
|
+
{{/if}}
|
|
87
101
|
{{#if files.http}}
|
|
88
102
|
/** The routes that answer the signed links of a storage the application serves itself; mounted before any body parser. */
|
|
89
103
|
readonly fileRoutes: readonly Route[];
|
|
@@ -136,6 +150,9 @@ export function composeApplication(
|
|
|
136
150
|
{{/unless}}
|
|
137
151
|
|
|
138
152
|
platform.protection.declare(contexts.flatMap((context) => context.useCases));
|
|
153
|
+
{{#if routes.nest}}
|
|
154
|
+
const controllers = controllersOf(contexts, platform);
|
|
155
|
+
{{/if}}
|
|
139
156
|
{{#if presentation.any}}
|
|
140
157
|
// What the server answers in and which fields each caller sees: the forms and the contract are given the same.
|
|
141
158
|
const presentation = presentationOf(platform.access, clock);
|
|
@@ -144,11 +161,24 @@ export function composeApplication(
|
|
|
144
161
|
return {
|
|
145
162
|
{{#if http.any}}
|
|
146
163
|
{{#if presentation.forms}}
|
|
164
|
+
{{#if routes.nest}}
|
|
165
|
+
routes: withForms(defineRoutes(...contexts.map((context) => context.routes), controllers.routes), presentation),
|
|
166
|
+
{{/if}}
|
|
167
|
+
{{#unless routes.nest}}
|
|
147
168
|
routes: withForms(defineRoutes(...contexts.map((context) => context.routes)), presentation),
|
|
169
|
+
{{/unless}}
|
|
148
170
|
{{/if}}
|
|
149
171
|
{{#unless presentation.forms}}
|
|
172
|
+
{{#if routes.nest}}
|
|
173
|
+
routes: defineRoutes(...contexts.map((context) => context.routes), controllers.routes),
|
|
174
|
+
{{/if}}
|
|
175
|
+
{{#unless routes.nest}}
|
|
150
176
|
routes: defineRoutes(...contexts.map((context) => context.routes)),
|
|
151
177
|
{{/unless}}
|
|
178
|
+
{{/unless}}
|
|
179
|
+
{{#if routes.nest}}
|
|
180
|
+
controllers,
|
|
181
|
+
{{/if}}
|
|
152
182
|
boundary: httpBoundary({
|
|
153
183
|
authenticator: options.authenticator,
|
|
154
184
|
executionScope: platform.scope,
|
|
@@ -290,3 +320,23 @@ function purgeExpiredEveryNight(platform: Platform): void {
|
|
|
290
320
|
});
|
|
291
321
|
}
|
|
292
322
|
{{/if}}
|
|
323
|
+
{{#if routes.nest}}
|
|
324
|
+
|
|
325
|
+
/** The Nest controllers of the contexts: their routes now, their instances built by Nest when the server starts, with the buses of the platform. */
|
|
326
|
+
function controllersOf(contexts: readonly ContextWiring[], platform: Platform): NestControllers {
|
|
327
|
+
return nestControllers(
|
|
328
|
+
contexts.flatMap((context) => context.controllers ?? []),
|
|
329
|
+
{
|
|
330
|
+
providers: [
|
|
331
|
+
{ provide: CommandBus, useValue: platform.commands },
|
|
332
|
+
{ provide: QueryBus, useValue: platform.queries },
|
|
333
|
+
],
|
|
334
|
+
// A DTO without a decorated field yet accepts the empty object alone: whitelist and forbidNonWhitelisted refuse any field.
|
|
335
|
+
schemaOfClass: (dto) => classSchema(dto, { validator: { forbidUnknownValues: false } }),
|
|
336
|
+
{{#if authn.none}}
|
|
337
|
+
security: ['developmentActor'],
|
|
338
|
+
{{/if}}
|
|
339
|
+
},
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
{{/if}}
|
|
@@ -18,6 +18,9 @@ import { ErrorMapper, createErrorMapper } from '@ddd-ts-kit/http';
|
|
|
18
18
|
import {
|
|
19
19
|
Cache,
|
|
20
20
|
EventSubscribers,
|
|
21
|
+
{{#if queue.processTable}}
|
|
22
|
+
ExecutionScope,
|
|
23
|
+
{{/if}}
|
|
21
24
|
Lock,
|
|
22
25
|
Metrics,
|
|
23
26
|
ProcessedEventStore,
|
|
@@ -35,6 +38,9 @@ import {
|
|
|
35
38
|
{{#if errors.sentry}}
|
|
36
39
|
import {
|
|
37
40
|
Cache,
|
|
41
|
+
{{#if queue.processTable}}
|
|
42
|
+
ExecutionScope,
|
|
43
|
+
{{/if}}
|
|
38
44
|
Lock,
|
|
39
45
|
Metrics,
|
|
40
46
|
ProcessedEventStore,
|
|
@@ -47,7 +53,7 @@ import {
|
|
|
47
53
|
} from '@ddd-ts-kit/kernel';
|
|
48
54
|
{{/if}}
|
|
49
55
|
{{#unless errors.sentry}}
|
|
50
|
-
import { Cache, Lock, Metrics, ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}RateLimiter, UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
56
|
+
import { Cache, {{#if queue.processTable}}ExecutionScope, {{/if}}Lock, Metrics, ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}RateLimiter, UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
51
57
|
{{/unless}}
|
|
52
58
|
{{/unless}}
|
|
53
59
|
{{/if}}
|
|
@@ -56,7 +62,7 @@ import { {{#if broker.external}}EventSubscribers, {{/if}}ProcessedEventStore, Un
|
|
|
56
62
|
{{/unless}}
|
|
57
63
|
{{#unless cache.redis}}
|
|
58
64
|
{{#if queue.processTable}}
|
|
59
|
-
import { ProcessStore } from '@ddd-ts-kit/kernel';
|
|
65
|
+
import { ExecutionScope, ProcessStore } from '@ddd-ts-kit/kernel';
|
|
60
66
|
{{/if}}
|
|
61
67
|
{{/unless}}
|
|
62
68
|
{{#if queue.redis}}
|
|
@@ -141,7 +147,7 @@ export function platformModule(persistence: Persistence, options: PlatformOption
|
|
|
141
147
|
builder.rebind(JobStore).toValue(persistence.jobs);
|
|
142
148
|
{{/if}}
|
|
143
149
|
{{#if queue.processTable}}
|
|
144
|
-
builder.rebind(ProcessStore).
|
|
150
|
+
builder.rebind(ProcessStore).toFactory((resolve) => persistence.processes(resolve(ExecutionScope)));
|
|
145
151
|
{{/if}}
|
|
146
152
|
{{#if broker.external}}
|
|
147
153
|
builder.rebind(EventSubscribers).toValue({ forContext: (name) => options.events.forConsumer(name) });
|
|
@@ -42,7 +42,7 @@ export function persistenceOver(connection: DatabaseConnection): Persistence {
|
|
|
42
42
|
jobs: new DrizzleJobStore(unitOfWork, jobs),
|
|
43
43
|
{{/if}}
|
|
44
44
|
{{#if queue.processTable}}
|
|
45
|
-
processes: new DrizzleProcessStore(unitOfWork, processes),
|
|
45
|
+
processes: ({{#if tenancy.any}}tenant{{/if}}) => new DrizzleProcessStore(unitOfWork, { table: processes{{#if tenancy.any}}, tenant{{/if}} }),
|
|
46
46
|
{{/if}}
|
|
47
47
|
{{#if eventSourcing.on}}
|
|
48
48
|
eventSourcing: createDrizzleEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
@@ -48,7 +48,7 @@ export function persistenceOver(connection: DatabaseConnection): Persistence {
|
|
|
48
48
|
jobs: new KnexJobStore(unitOfWork, { schema: MESSAGING_SCHEMA }),
|
|
49
49
|
{{/if}}
|
|
50
50
|
{{#if queue.processTable}}
|
|
51
|
-
processes: new KnexProcessStore(unitOfWork, { schema: MESSAGING_SCHEMA }),
|
|
51
|
+
processes: ({{#if tenancy.any}}tenant{{/if}}) => new KnexProcessStore(unitOfWork, { schema: MESSAGING_SCHEMA{{#if tenancy.any}}, tenant{{/if}} }),
|
|
52
52
|
{{/if}}
|
|
53
53
|
{{#if eventSourcing.on}}
|
|
54
54
|
eventSourcing: createKnexEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
@@ -57,7 +57,13 @@ export function persistenceOver(client: PrismaClient): Persistence {
|
|
|
57
57
|
jobs: new PrismaJobStore(unitOfWork, { delegate: (current) => current.backgroundJob, schema: MESSAGING_SCHEMA }),
|
|
58
58
|
{{/if}}
|
|
59
59
|
{{#if queue.processTable}}
|
|
60
|
-
|
|
60
|
+
{{#if tenancy.any}}
|
|
61
|
+
processes: (tenant) =>
|
|
62
|
+
new PrismaProcessStore(unitOfWork, { delegate: (current) => current.processInstance, tenant }),
|
|
63
|
+
{{/if}}
|
|
64
|
+
{{#unless tenancy.any}}
|
|
65
|
+
processes: () => new PrismaProcessStore(unitOfWork, { delegate: (current) => current.processInstance }),
|
|
66
|
+
{{/unless}}
|
|
61
67
|
{{/if}}
|
|
62
68
|
{{#if eventSourcing.on}}
|
|
63
69
|
eventSourcing: createPrismaEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { DataSource } from 'typeorm';
|
|
2
|
+
{{#if queue.processTable}}
|
|
3
|
+
import {
|
|
4
|
+
{{#if eventSourcing.on}}
|
|
5
|
+
createTypeOrmEventSourcing,
|
|
6
|
+
{{/if}}
|
|
7
|
+
createTypeOrmUnitOfWork,
|
|
8
|
+
{{#if queue.database}}
|
|
9
|
+
TypeOrmJobStore,
|
|
10
|
+
{{/if}}
|
|
11
|
+
TypeOrmOutboxStore,
|
|
12
|
+
TypeOrmProcessedEventStore,
|
|
13
|
+
TypeOrmProcessStore,
|
|
14
|
+
} from '@ddd-ts-kit/typeorm';
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#unless queue.processTable}}
|
|
2
17
|
{{#if eventSourcing.on}}
|
|
3
18
|
import {
|
|
4
19
|
createTypeOrmEventSourcing,
|
|
@@ -10,8 +25,9 @@ import {
|
|
|
10
25
|
{{#unless eventSourcing.on}}
|
|
11
26
|
import { createTypeOrmUnitOfWork, TypeOrmOutboxStore, TypeOrmProcessedEventStore } from '@ddd-ts-kit/typeorm';
|
|
12
27
|
{{/unless}}
|
|
28
|
+
{{/unless}}
|
|
13
29
|
import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
|
|
14
|
-
import { {{#if eventSourcing.on}}EVENT_STORE_SCHEMA, {{/if}}outbox, processedEvents } from '{{alias.platform}}/database/schema{{alias.ext}}';
|
|
30
|
+
import { {{#if eventSourcing.on}}EVENT_STORE_SCHEMA, {{/if}}{{#if queue.database}}jobs, {{/if}}outbox, processedEvents{{#if queue.processTable}}, processes{{/if}} } from '{{alias.platform}}/database/schema{{alias.ext}}';
|
|
15
31
|
|
|
16
32
|
/** One object is the unit of work and what repositories query through; the stores write through its manager. */
|
|
17
33
|
export function persistenceOver(dataSource: DataSource): Persistence {
|
|
@@ -22,6 +38,12 @@ export function persistenceOver(dataSource: DataSource): Persistence {
|
|
|
22
38
|
database: unitOfWork,
|
|
23
39
|
outbox: new TypeOrmOutboxStore(unitOfWork, { entity: outbox }),
|
|
24
40
|
processedEvents: new TypeOrmProcessedEventStore(unitOfWork, { entity: processedEvents }),
|
|
41
|
+
{{#if queue.database}}
|
|
42
|
+
jobs: new TypeOrmJobStore(unitOfWork, { entity: jobs }),
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#if queue.processTable}}
|
|
45
|
+
processes: ({{#if tenancy.any}}tenant{{/if}}) => new TypeOrmProcessStore(unitOfWork, { entity: processes{{#if tenancy.any}}, tenant{{/if}} }),
|
|
46
|
+
{{/if}}
|
|
25
47
|
{{#if eventSourcing.on}}
|
|
26
48
|
eventSourcing: createTypeOrmEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
27
49
|
{{/if}}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
{{#if queue.processTable}}
|
|
3
|
+
import { FixedExecutionScope, executionContext, systemActor } from '@ddd-ts-kit/kernel';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#if queue.database}}
|
|
6
|
+
import {
|
|
7
|
+
{{#if eventSourcing.on}}
|
|
8
|
+
eventStoreContract,
|
|
9
|
+
{{/if}}
|
|
10
|
+
jobStoreContract,
|
|
11
|
+
outboxStoreContract,
|
|
12
|
+
processedEventStoreContract,
|
|
13
|
+
processStoreContract,
|
|
14
|
+
} from '@ddd-ts-kit/testing/contracts';
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#unless queue.database}}
|
|
17
|
+
{{#if queue.processTable}}
|
|
18
|
+
{{#if eventSourcing.on}}
|
|
19
|
+
import {
|
|
20
|
+
eventStoreContract,
|
|
21
|
+
outboxStoreContract,
|
|
22
|
+
processedEventStoreContract,
|
|
23
|
+
processStoreContract,
|
|
24
|
+
} from '@ddd-ts-kit/testing/contracts';
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#unless eventSourcing.on}}
|
|
27
|
+
import { outboxStoreContract, processedEventStoreContract, processStoreContract } from '@ddd-ts-kit/testing/contracts';
|
|
28
|
+
{{/unless}}
|
|
29
|
+
{{/if}}
|
|
30
|
+
{{#unless queue.processTable}}
|
|
31
|
+
import { {{#if eventSourcing.on}}eventStoreContract, {{/if}}outboxStoreContract, processedEventStoreContract } from '@ddd-ts-kit/testing/contracts';
|
|
32
|
+
{{/unless}}
|
|
33
|
+
{{/unless}}
|
|
34
|
+
import { openTestDatabase, type TestDatabase } from '{{alias.platform}}/database/open-test-database{{alias.ext}}';
|
|
35
|
+
import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
|
|
36
|
+
|
|
37
|
+
// The stores of the kit as this platform wires them, held to the contracts of their ports with the
|
|
38
|
+
// capabilities the stack turns on: a store bound without what the stack asks for fails here.
|
|
39
|
+
|
|
40
|
+
const runner = { describe, it, expect, beforeEach, afterEach };
|
|
41
|
+
|
|
42
|
+
let database: TestDatabase;
|
|
43
|
+
|
|
44
|
+
beforeAll(async () => {
|
|
45
|
+
database = await openTestDatabase();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterAll(async () => {
|
|
49
|
+
await database.close();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
outboxStoreContract(runner, {
|
|
53
|
+
name: 'The outbox store of the platform',
|
|
54
|
+
createStore: async () => (await emptied()).outbox,
|
|
55
|
+
leaseMs: 30_000,
|
|
56
|
+
{{#if tenancy.any}}
|
|
57
|
+
carriesTenant: true,
|
|
58
|
+
{{/if}}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
processedEventStoreContract(runner, {
|
|
62
|
+
name: 'The processed-event store of the platform',
|
|
63
|
+
createStore: async () => (await emptied()).processedEvents,
|
|
64
|
+
});
|
|
65
|
+
{{#if eventSourcing.on}}
|
|
66
|
+
|
|
67
|
+
eventStoreContract(runner, {
|
|
68
|
+
name: 'The event store of the platform',
|
|
69
|
+
createStore: async () => (await emptied()).eventSourcing.events,
|
|
70
|
+
createCompanions: async () => (await emptied()).eventSourcing,
|
|
71
|
+
});
|
|
72
|
+
{{/if}}
|
|
73
|
+
{{#if queue.database}}
|
|
74
|
+
|
|
75
|
+
jobStoreContract(runner, {
|
|
76
|
+
name: 'The job store of the platform',
|
|
77
|
+
createStore: async () => (await emptied()).jobs,
|
|
78
|
+
unitOfWork: () => database.persistence.unitOfWork,
|
|
79
|
+
});
|
|
80
|
+
{{/if}}
|
|
81
|
+
{{#if queue.processTable}}
|
|
82
|
+
|
|
83
|
+
{{#if tenancy.any}}
|
|
84
|
+
/** The work of a tenant of its own, beside the two of the contract. */
|
|
85
|
+
{{/if}}
|
|
86
|
+
{{#unless tenancy.any}}
|
|
87
|
+
/** The work of the platform. */
|
|
88
|
+
{{/unless}}
|
|
89
|
+
const work = new FixedExecutionScope(
|
|
90
|
+
{{#if tenancy.any}}
|
|
91
|
+
executionContext({ correlationId: 'contract', actor: systemActor('contract'), origin: 'test', tenantId: 'initech' }),
|
|
92
|
+
{{/if}}
|
|
93
|
+
{{#unless tenancy.any}}
|
|
94
|
+
executionContext({ correlationId: 'contract', actor: systemActor('contract'), origin: 'test' }),
|
|
95
|
+
{{/unless}}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
processStoreContract(runner, {
|
|
99
|
+
name: 'The process store of the platform',
|
|
100
|
+
createStore: async () => (await emptied()).processes(work),
|
|
101
|
+
unitOfWork: () => database.persistence.unitOfWork,
|
|
102
|
+
{{#if tenancy.any}}
|
|
103
|
+
storeInTenant: (scope) => database.persistence.processes(scope),
|
|
104
|
+
{{/if}}
|
|
105
|
+
});
|
|
106
|
+
{{/if}}
|
|
107
|
+
|
|
108
|
+
/** The persistence of the platform, on a database emptied before each test. */
|
|
109
|
+
async function emptied(): Promise<Persistence> {
|
|
110
|
+
await database.reset();
|
|
111
|
+
|
|
112
|
+
return database.persistence;
|
|
113
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OutboxStore } from '@ddd-ts-kit/events';
|
|
2
|
-
import type { {{#if eventSourcing.on}}EventSourcingStores, {{/if}}ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import type { {{#if eventSourcing.on}}EventSourcingStores, {{/if}}{{#if queue.processTable}}ExecutionScope, {{/if}}ProcessedEventStore, {{#if queue.processTable}}ProcessStore, {{/if}}UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
3
3
|
{{#if queue.database}}
|
|
4
4
|
import type { JobStore } from '@ddd-ts-kit/scheduling';
|
|
5
5
|
{{/if}}
|
|
@@ -20,8 +20,13 @@ export interface Persistence {
|
|
|
20
20
|
readonly jobs: JobStore;
|
|
21
21
|
{{/if}}
|
|
22
22
|
{{#if queue.processTable}}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
{{#if tenancy.any}}
|
|
24
|
+
/** The instances of the process managers, saved in the transaction of each step, each in the tenant of the work `scope` runs. */
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#unless tenancy.any}}
|
|
27
|
+
/** The instances of the process managers, saved in the transaction of each step; `scope` serves a multi-tenant project. */
|
|
28
|
+
{{/unless}}
|
|
29
|
+
readonly processes: (scope: ExecutionScope) => ProcessStore;
|
|
25
30
|
{{/if}}
|
|
26
31
|
/** What repositories query through: the transaction of the current unit of work, or the database. */
|
|
27
32
|
readonly database: {{persistence.token}};
|