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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { {{route.nestImports}} } from '@nestjs/common';
|
|
2
|
+
{{#if route.importsFromTheKit}}
|
|
3
|
+
import { {{route.kitImports}} } from '@ddd-ts-kit/http';
|
|
4
|
+
{{/if}}
|
|
5
|
+
import { {{route.bridgeImports}} } from '@ddd-ts-kit/http/nest';
|
|
6
|
+
import { {{route.kernelImports}} } from '@ddd-ts-kit/kernel';
|
|
7
|
+
{{#if route.readsSchemas}}
|
|
8
|
+
import { classSchema } from '@ddd-ts-kit/validation/class-validator';
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{route.imports}}
|
|
11
|
+
|
|
12
|
+
{{#if route.hasParams}}
|
|
13
|
+
const paramsSchema = classSchema({{name.pascal}}Params);
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{#if route.hasBody}}
|
|
16
|
+
// TODO(domain): once {{name.pascal}}Body has its decorated fields, drop the second argument: it only lets a class without any decorated field through.
|
|
17
|
+
const bodySchema = classSchema({{name.pascal}}Body, { validator: { forbidUnknownValues: false } });
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{#if route.readsSchemas}}
|
|
20
|
+
|
|
21
|
+
{{/if}}
|
|
22
|
+
/** Built by Nest with the bus it injects, served by the kit: what each method answers is read from its signature. */
|
|
23
|
+
@Controller()
|
|
24
|
+
@KitRoutes({ {{route.nestShared}} })
|
|
25
|
+
export class {{name.pascal}}Controller {
|
|
26
|
+
constructor({{route.nestConstructor}}) {}
|
|
27
|
+
|
|
28
|
+
@{{route.nestMethod}}({{route.nestPath}})
|
|
29
|
+
{{#if route.hasHttpCode}}
|
|
30
|
+
@HttpCode({{route.nestHttpCode}})
|
|
31
|
+
{{/if}}
|
|
32
|
+
@KitRoute({
|
|
33
|
+
{{#if route.readsRequest}}
|
|
34
|
+
request: { {{route.nestRequest}} },
|
|
35
|
+
{{/if}}
|
|
36
|
+
// TODO(domain): list the codes of the refusals "{{name.words}}" can raise, as their factories set them, so that they appear in the contract with their status (`errors/known-code`).
|
|
37
|
+
errors: [],
|
|
38
|
+
{{#if route.cached}}
|
|
39
|
+
cache: {{route.cache}},
|
|
40
|
+
{{/if}}
|
|
41
|
+
})
|
|
42
|
+
{{#if route.isQuery}}
|
|
43
|
+
async {{name.camel}}({{route.nestParameters}}): Promise<{{route.answerType}}> {
|
|
44
|
+
// TODO(domain): build the query from the parameters; the caller is already there.
|
|
45
|
+
// TODO(domain): map the answer of the query to the public fields.
|
|
46
|
+
await this.{{route.bus}}.execute({{route.nestMessage}});
|
|
47
|
+
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#if route.returnsId}}
|
|
52
|
+
async {{name.camel}}({{route.nestParameters}}): Promise<{{route.acceptedType}}> {
|
|
53
|
+
// TODO(domain): build the command from the parameters (body, params); the caller is already there.
|
|
54
|
+
const id = await this.{{route.bus}}.execute({{route.nestMessage}});
|
|
55
|
+
|
|
56
|
+
return { id };
|
|
57
|
+
}
|
|
58
|
+
{{/if}}
|
|
59
|
+
{{#if route.returnsNothing}}
|
|
60
|
+
async {{name.camel}}({{route.nestParameters}}): Promise<void> {
|
|
61
|
+
// TODO(domain): build the command from the parameters (body, params); the caller is already there.
|
|
62
|
+
await this.{{route.bus}}.execute({{route.nestMessage}});
|
|
63
|
+
}
|
|
64
|
+
{{/if}}
|
|
65
|
+
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://unpkg.com/knip@6/schema.json",
|
|
3
3
|
"entry": [
|
|
4
|
-
{{#if tests.jest}}
|
|
5
|
-
"{{config.contextsDir}}/*/test/fakes/*.ts",
|
|
6
|
-
"{{config.contextsDir}}/*/test/worlds/*.ts",
|
|
7
|
-
{{/if}}
|
|
8
4
|
{{#if knip.apps}}
|
|
9
5
|
"{{config.sourceRoot}}/apps/*/main.ts",
|
|
10
6
|
{{/if}}
|
|
11
|
-
"scripts/*.ts"{{knip.e2eEntry}}
|
|
7
|
+
"scripts/*.ts"{{knip.e2eEntry}}{{knip.toolEntry}}
|
|
12
8
|
],
|
|
13
|
-
"project": ["{{config.sourceRoot}}/**/*.ts", "scripts/**/*.ts"{{knip.e2eProject}}],
|
|
9
|
+
"project": ["{{config.sourceRoot}}/**/*.ts", "scripts/**/*.ts"{{knip.e2eProject}}{{#if orm.prisma}}, "prisma/**/*.prisma"{{/if}}],
|
|
14
10
|
{{#if knip.ignores}}
|
|
15
11
|
"ignoreDependencies": {{knip.ignored}},
|
|
16
12
|
{{/if}}
|
|
@@ -20,8 +16,8 @@
|
|
|
20
16
|
"{{config.contextsDir}}/*/*.codes.ts": ["types"]
|
|
21
17
|
},
|
|
22
18
|
{{/if}}
|
|
23
|
-
"
|
|
24
|
-
"config": [
|
|
19
|
+
"{{knip.runner}}": {
|
|
20
|
+
"config": [{{knip.runnerConfigs}}],
|
|
25
21
|
"entry": [
|
|
26
22
|
"{{config.sourceRoot}}/**/*.spec.ts",
|
|
27
23
|
"{{config.contextsDir}}/*/test/fakes/*.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.91.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { UseCaseDeclaration } from '@ddd-ts-kit/auth';
|
|
2
|
+
import type { Route } from '@ddd-ts-kit/http';
|
|
3
|
+
import type { Actored, DomainEvent, Message } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import type { Platform } from '{{alias.platform}}/composition/platform{{alias.ext}}';
|
|
5
|
+
// ddd-ts-kit:imports
|
|
6
|
+
import { requires, type RequirementOptions } from '@ddd-ts-kit/auth';
|
|
7
|
+
import { on, subscribeAll } from '@ddd-ts-kit/events';
|
|
8
|
+
import { controllerRoutes } from '@ddd-ts-kit/http';
|
|
9
|
+
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
10
|
+
import { {{preset.adapter.pascal}}AccountRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-account.repository{{alias.ext}}';
|
|
11
|
+
import { {{preset.adapter.pascal}}OrganisationRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-organisation.repository{{alias.ext}}';
|
|
12
|
+
import { {{preset.adapter.pascal}}MemberRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-member.repository{{alias.ext}}';
|
|
13
|
+
import { {{preset.adapter.pascal}}InvitationRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-invitation.repository{{alias.ext}}';
|
|
14
|
+
import { {{preset.adapter.pascal}}DelegationRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-delegation.repository{{alias.ext}}';
|
|
15
|
+
import { {{preset.adapter.pascal}}SearchMembersReader } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-search-members-reader.repository{{alias.ext}}';
|
|
16
|
+
import { CryptoInvitationTokens } from '{{alias.context}}/infrastructure/external/crypto-invitation-tokens.adapter{{alias.ext}}';
|
|
17
|
+
import { EnvironmentIdentityProviderConnection } from '{{alias.context}}/infrastructure/external/environment-identity-provider-connection.adapter{{alias.ext}}';
|
|
18
|
+
import { KeycloakIdentityProviderAdmin } from '{{alias.context}}/infrastructure/external/keycloak-identity-provider-admin.adapter{{alias.ext}}';
|
|
19
|
+
import { AcceptInvitationCommand } from '{{alias.context}}/application/commands/accept-invitation/accept-invitation.command{{alias.ext}}';
|
|
20
|
+
import { AcceptInvitationHandler } from '{{alias.context}}/application/commands/accept-invitation/accept-invitation.handler{{alias.ext}}';
|
|
21
|
+
import { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/change-member-role/change-member-role.command{{alias.ext}}';
|
|
22
|
+
import { ChangeMemberRoleHandler } from '{{alias.context}}/application/commands/change-member-role/change-member-role.handler{{alias.ext}}';
|
|
23
|
+
import { DeactivateAccountCommand } from '{{alias.context}}/application/commands/deactivate-account/deactivate-account.command{{alias.ext}}';
|
|
24
|
+
import { DeactivateAccountHandler } from '{{alias.context}}/application/commands/deactivate-account/deactivate-account.handler{{alias.ext}}';
|
|
25
|
+
import { DeclineInvitationCommand } from '{{alias.context}}/application/commands/decline-invitation/decline-invitation.command{{alias.ext}}';
|
|
26
|
+
import { DeclineInvitationHandler } from '{{alias.context}}/application/commands/decline-invitation/decline-invitation.handler{{alias.ext}}';
|
|
27
|
+
import { GrantDelegationCommand } from '{{alias.context}}/application/commands/grant-delegation/grant-delegation.command{{alias.ext}}';
|
|
28
|
+
import { GrantDelegationHandler } from '{{alias.context}}/application/commands/grant-delegation/grant-delegation.handler{{alias.ext}}';
|
|
29
|
+
import { InviteMemberCommand } from '{{alias.context}}/application/commands/invite-member/invite-member.command{{alias.ext}}';
|
|
30
|
+
import { InviteMemberHandler } from '{{alias.context}}/application/commands/invite-member/invite-member.handler{{alias.ext}}';
|
|
31
|
+
import { OpenOrganisationCommand } from '{{alias.context}}/application/commands/open-organisation/open-organisation.command{{alias.ext}}';
|
|
32
|
+
import { OpenOrganisationHandler } from '{{alias.context}}/application/commands/open-organisation/open-organisation.handler{{alias.ext}}';
|
|
33
|
+
import { ProvisionAccountCommand } from '{{alias.context}}/application/commands/provision-account/provision-account.command{{alias.ext}}';
|
|
34
|
+
import { ProvisionAccountHandler } from '{{alias.context}}/application/commands/provision-account/provision-account.handler{{alias.ext}}';
|
|
35
|
+
import { RemoveMemberCommand } from '{{alias.context}}/application/commands/remove-member/remove-member.command{{alias.ext}}';
|
|
36
|
+
import { RemoveMemberHandler } from '{{alias.context}}/application/commands/remove-member/remove-member.handler{{alias.ext}}';
|
|
37
|
+
import { RevokeDelegationCommand } from '{{alias.context}}/application/commands/revoke-delegation/revoke-delegation.command{{alias.ext}}';
|
|
38
|
+
import { RevokeDelegationHandler } from '{{alias.context}}/application/commands/revoke-delegation/revoke-delegation.handler{{alias.ext}}';
|
|
39
|
+
import { RevokeInvitationCommand } from '{{alias.context}}/application/commands/revoke-invitation/revoke-invitation.command{{alias.ext}}';
|
|
40
|
+
import { RevokeInvitationHandler } from '{{alias.context}}/application/commands/revoke-invitation/revoke-invitation.handler{{alias.ext}}';
|
|
41
|
+
import { SearchMembersQuery } from '{{alias.context}}/application/queries/search-members/search-members.query{{alias.ext}}';
|
|
42
|
+
import { SearchMembersHandler } from '{{alias.context}}/application/queries/search-members/search-members.handler{{alias.ext}}';
|
|
43
|
+
import { AccountDeactivatedIntegrationHandler } from '{{alias.context}}/application/integration/handlers/account-deactivated.integration-handler{{alias.ext}}';
|
|
44
|
+
import { accountDeactivatedV1 } from '{{alias.context}}/published-language/account-deactivated.v1.integration-event{{alias.ext}}';
|
|
45
|
+
import { MemberJoinedIntegrationHandler } from '{{alias.context}}/application/integration/handlers/member-joined.integration-handler{{alias.ext}}';
|
|
46
|
+
import { memberJoinedV1 } from '{{alias.context}}/published-language/member-joined.v1.integration-event{{alias.ext}}';
|
|
47
|
+
import { MemberRemovedIntegrationHandler } from '{{alias.context}}/application/integration/handlers/member-removed.integration-handler{{alias.ext}}';
|
|
48
|
+
import { memberRemovedV1 } from '{{alias.context}}/published-language/member-removed.v1.integration-event{{alias.ext}}';
|
|
49
|
+
import { OrganisationOpenedIntegrationHandler } from '{{alias.context}}/application/integration/handlers/organisation-opened.integration-handler{{alias.ext}}';
|
|
50
|
+
import { organisationOpenedV1 } from '{{alias.context}}/published-language/organisation-opened.v1.integration-event{{alias.ext}}';
|
|
51
|
+
import { DeactivateAccountController } from '{{alias.context}}/presentation/http/accounts/deactivate-account/deactivate-account.controller{{alias.ext}}';
|
|
52
|
+
import { ProvisionAccountController } from '{{alias.context}}/presentation/http/accounts/provision-account/provision-account.controller{{alias.ext}}';
|
|
53
|
+
import { AcceptInvitationController } from '{{alias.context}}/presentation/http/invitations/accept-invitation/accept-invitation.controller{{alias.ext}}';
|
|
54
|
+
import { DeclineInvitationController } from '{{alias.context}}/presentation/http/invitations/decline-invitation/decline-invitation.controller{{alias.ext}}';
|
|
55
|
+
import { ChangeMemberRoleController } from '{{alias.context}}/presentation/http/organisations/change-member-role/change-member-role.controller{{alias.ext}}';
|
|
56
|
+
import { GrantDelegationController } from '{{alias.context}}/presentation/http/organisations/grant-delegation/grant-delegation.controller{{alias.ext}}';
|
|
57
|
+
import { InviteMemberController } from '{{alias.context}}/presentation/http/organisations/invite-member/invite-member.controller{{alias.ext}}';
|
|
58
|
+
import { OpenOrganisationController } from '{{alias.context}}/presentation/http/organisations/open-organisation/open-organisation.controller{{alias.ext}}';
|
|
59
|
+
import { RemoveMemberController } from '{{alias.context}}/presentation/http/organisations/remove-member/remove-member.controller{{alias.ext}}';
|
|
60
|
+
import { RevokeDelegationController } from '{{alias.context}}/presentation/http/organisations/revoke-delegation/revoke-delegation.controller{{alias.ext}}';
|
|
61
|
+
import { RevokeInvitationController } from '{{alias.context}}/presentation/http/organisations/revoke-invitation/revoke-invitation.controller{{alias.ext}}';
|
|
62
|
+
import { SearchMembersController } from '{{alias.context}}/presentation/http/organisations/search-members/search-members.controller{{alias.ext}}';
|
|
63
|
+
import { AccountDeactivatedPublisher } from '{{alias.context}}/application/integration/publishers/account-deactivated.publisher{{alias.ext}}';
|
|
64
|
+
import { AccountDeactivated } from '{{alias.context}}/domain/events/account-deactivated.event{{alias.ext}}';
|
|
65
|
+
import { OrganisationOpenedPublisher } from '{{alias.context}}/application/integration/publishers/organisation-opened.publisher{{alias.ext}}';
|
|
66
|
+
import { OrganisationOpened } from '{{alias.context}}/domain/events/organisation-opened.event{{alias.ext}}';
|
|
67
|
+
import { MemberJoinedPublisher } from '{{alias.context}}/application/integration/publishers/member-joined.publisher{{alias.ext}}';
|
|
68
|
+
import { MemberJoined } from '{{alias.context}}/domain/events/member-joined.event{{alias.ext}}';
|
|
69
|
+
import { MemberRoleChangedPublisher } from '{{alias.context}}/application/integration/publishers/member-role-changed.publisher{{alias.ext}}';
|
|
70
|
+
import { MemberRoleChanged } from '{{alias.context}}/domain/events/member-role-changed.event{{alias.ext}}';
|
|
71
|
+
import { MemberRemovedPublisher } from '{{alias.context}}/application/integration/publishers/member-removed.publisher{{alias.ext}}';
|
|
72
|
+
import { MemberRemoved } from '{{alias.context}}/domain/events/member-removed.event{{alias.ext}}';
|
|
73
|
+
import { DelegationGrantedPublisher } from '{{alias.context}}/application/integration/publishers/delegation-granted.publisher{{alias.ext}}';
|
|
74
|
+
import { DelegationGranted } from '{{alias.context}}/domain/events/delegation-granted.event{{alias.ext}}';
|
|
75
|
+
import { DelegationRevokedPublisher } from '{{alias.context}}/application/integration/publishers/delegation-revoked.publisher{{alias.ext}}';
|
|
76
|
+
import { DelegationRevoked } from '{{alias.context}}/domain/events/delegation-revoked.event{{alias.ext}}';
|
|
77
|
+
// /ddd-ts-kit:imports
|
|
78
|
+
|
|
79
|
+
export interface {{context.pascal}}Wiring {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly useCases: readonly UseCaseDeclaration[];
|
|
82
|
+
readonly routes: readonly Route[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Every use case of the context is asked of the context as a whole: inside an organisation, its policies decide. */
|
|
86
|
+
const IN_THE_CONTEXT: RequirementOptions<Message & Actored> = { resource: () => ({ type: 'context', id: '{{context.kebab}}' }) };
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* What the declarations of the context say in the declared style: its adapters, its use cases,
|
|
90
|
+
* the facts it publishes, the consumers that keep the identity provider in line, and its routes.
|
|
91
|
+
*/
|
|
92
|
+
export function {{context.camel}}Module(platform: Platform): {{context.pascal}}Wiring {
|
|
93
|
+
const adapters = adaptersOf(platform);
|
|
94
|
+
|
|
95
|
+
registerAccountsAndOrganisations(platform, adapters);
|
|
96
|
+
registerInvitations(platform, adapters);
|
|
97
|
+
registerMembersAndDelegations(platform, adapters);
|
|
98
|
+
publishTheFacts(platform);
|
|
99
|
+
keepTheProviderInLine(platform, adapters);
|
|
100
|
+
// ddd-ts-kit:registrations
|
|
101
|
+
// /ddd-ts-kit:registrations
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
name: '{{context.kebab}}',
|
|
105
|
+
useCases: [
|
|
106
|
+
// ddd-ts-kit:authorization
|
|
107
|
+
requires(AcceptInvitationCommand, {{context.camel}}Permissions['invitation.accept'], IN_THE_CONTEXT),
|
|
108
|
+
requires(ChangeMemberRoleCommand, {{context.camel}}Permissions['member.change-role'], IN_THE_CONTEXT),
|
|
109
|
+
requires(DeactivateAccountCommand, {{context.camel}}Permissions['account.deactivate'], IN_THE_CONTEXT),
|
|
110
|
+
requires(DeclineInvitationCommand, {{context.camel}}Permissions['invitation.decline'], IN_THE_CONTEXT),
|
|
111
|
+
requires(GrantDelegationCommand, {{context.camel}}Permissions['delegation.grant'], IN_THE_CONTEXT),
|
|
112
|
+
requires(InviteMemberCommand, {{context.camel}}Permissions['member.invite'], IN_THE_CONTEXT),
|
|
113
|
+
requires(OpenOrganisationCommand, {{context.camel}}Permissions['organisation.open'], IN_THE_CONTEXT),
|
|
114
|
+
requires(ProvisionAccountCommand, {{context.camel}}Permissions['account.provision'], IN_THE_CONTEXT),
|
|
115
|
+
requires(RemoveMemberCommand, {{context.camel}}Permissions['member.remove'], IN_THE_CONTEXT),
|
|
116
|
+
requires(RevokeDelegationCommand, {{context.camel}}Permissions['delegation.revoke'], IN_THE_CONTEXT),
|
|
117
|
+
requires(RevokeInvitationCommand, {{context.camel}}Permissions['invitation.revoke'], IN_THE_CONTEXT),
|
|
118
|
+
requires(SearchMembersQuery, {{context.camel}}Permissions['member.search'], IN_THE_CONTEXT),
|
|
119
|
+
// /ddd-ts-kit:authorization
|
|
120
|
+
],
|
|
121
|
+
routes: [
|
|
122
|
+
// ddd-ts-kit:routes
|
|
123
|
+
...controllerRoutes([new DeactivateAccountController(platform.commands)]),
|
|
124
|
+
...controllerRoutes([new ProvisionAccountController(platform.commands)]),
|
|
125
|
+
...controllerRoutes([new AcceptInvitationController(platform.commands)]),
|
|
126
|
+
...controllerRoutes([new DeclineInvitationController(platform.commands)]),
|
|
127
|
+
...controllerRoutes([new ChangeMemberRoleController(platform.commands)]),
|
|
128
|
+
...controllerRoutes([new GrantDelegationController(platform.commands)]),
|
|
129
|
+
...controllerRoutes([new InviteMemberController(platform.commands)]),
|
|
130
|
+
...controllerRoutes([new OpenOrganisationController(platform.commands)]),
|
|
131
|
+
...controllerRoutes([new RemoveMemberController(platform.commands)]),
|
|
132
|
+
...controllerRoutes([new RevokeDelegationController(platform.commands)]),
|
|
133
|
+
...controllerRoutes([new RevokeInvitationController(platform.commands)]),
|
|
134
|
+
...controllerRoutes([new SearchMembersController(platform.queries)]),
|
|
135
|
+
// /ddd-ts-kit:routes
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** The adapters of the ports of the context, each observed and protected by the platform. */
|
|
141
|
+
function adaptersOf(platform: Platform) {
|
|
142
|
+
const { persistence, scope, clock } = platform;
|
|
143
|
+
const as = (kind: 'repository' | 'external', token: string) => ({ kind, context: '{{context.kebab}}', token });
|
|
144
|
+
const connection = new EnvironmentIdentityProviderConnection();
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
accounts: platform.adapter(new {{preset.adapter.pascal}}AccountRepository(persistence.database, scope, clock), as('repository', 'AccountRepository')),
|
|
148
|
+
organisations: platform.adapter(new {{preset.adapter.pascal}}OrganisationRepository(persistence.database, scope, clock), as('repository', 'OrganisationRepository')),
|
|
149
|
+
members: platform.adapter(new {{preset.adapter.pascal}}MemberRepository(persistence.database, scope, clock), as('repository', 'MemberRepository')),
|
|
150
|
+
invitations: platform.adapter(new {{preset.adapter.pascal}}InvitationRepository(persistence.database, scope, clock), as('repository', 'InvitationRepository')),
|
|
151
|
+
delegations: platform.adapter(new {{preset.adapter.pascal}}DelegationRepository(persistence.database, scope, clock), as('repository', 'DelegationRepository')),
|
|
152
|
+
reader: platform.adapter(new {{preset.adapter.pascal}}SearchMembersReader(persistence.database), as('repository', 'SearchMembersReader')),
|
|
153
|
+
tokens: platform.adapter(new CryptoInvitationTokens(), as('external', 'InvitationTokens')),
|
|
154
|
+
identityProvider: platform.adapter(new KeycloakIdentityProviderAdmin(connection), as('external', 'IdentityProviderAdmin')),
|
|
155
|
+
access: platform.access,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
type Adapters = ReturnType<typeof adaptersOf>;
|
|
160
|
+
|
|
161
|
+
function registerAccountsAndOrganisations({ commands, ids, clock }: Platform, adapters: Adapters): void {
|
|
162
|
+
const { accounts, organisations, members, delegations } = adapters;
|
|
163
|
+
const own = { context: '{{context.kebab}}' };
|
|
164
|
+
|
|
165
|
+
commands.register(ProvisionAccountCommand, new ProvisionAccountHandler(accounts, clock), own);
|
|
166
|
+
commands.register(DeactivateAccountCommand, new DeactivateAccountHandler(accounts, organisations, members, delegations, clock), own);
|
|
167
|
+
commands.register(OpenOrganisationCommand, new OpenOrganisationHandler(organisations, members, accounts, ids, clock), own);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function registerInvitations({ commands, ids, clock }: Platform, adapters: Adapters): void {
|
|
171
|
+
const { accounts, members, invitations, delegations, tokens, access } = adapters;
|
|
172
|
+
const own = { context: '{{context.kebab}}' };
|
|
173
|
+
|
|
174
|
+
commands.register(InviteMemberCommand, new InviteMemberHandler(invitations, members, delegations, tokens, access, ids, clock), own);
|
|
175
|
+
commands.register(AcceptInvitationCommand, new AcceptInvitationHandler(invitations, members, accounts, tokens, ids, clock), own);
|
|
176
|
+
commands.register(DeclineInvitationCommand, new DeclineInvitationHandler(invitations, accounts, tokens, clock), own);
|
|
177
|
+
commands.register(RevokeInvitationCommand, new RevokeInvitationHandler(invitations, members, delegations, access, clock), own);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function registerMembersAndDelegations({ commands, queries, ids, clock }: Platform, adapters: Adapters): void {
|
|
181
|
+
const { organisations, members, delegations, reader, access } = adapters;
|
|
182
|
+
const own = { context: '{{context.kebab}}' };
|
|
183
|
+
|
|
184
|
+
commands.register(ChangeMemberRoleCommand, new ChangeMemberRoleHandler(organisations, members, delegations, access, clock), own);
|
|
185
|
+
commands.register(RemoveMemberCommand, new RemoveMemberHandler(organisations, members, delegations, access, clock), own);
|
|
186
|
+
commands.register(GrantDelegationCommand, new GrantDelegationHandler(delegations, members, access, ids, clock), own);
|
|
187
|
+
commands.register(RevokeDelegationCommand, new RevokeDelegationHandler(delegations, members, access, clock), own);
|
|
188
|
+
queries.register(SearchMembersQuery, new SearchMembersHandler(reader, members, delegations, access, clock), own);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The facts the context announces, published as the integration events of its published language through the outbox. */
|
|
192
|
+
function publishTheFacts(platform: Platform): void {
|
|
193
|
+
const { publisher, ids } = platform;
|
|
194
|
+
|
|
195
|
+
announce(platform, AccountDeactivated, new AccountDeactivatedPublisher(publisher, ids));
|
|
196
|
+
announce(platform, OrganisationOpened, new OrganisationOpenedPublisher(publisher, ids));
|
|
197
|
+
announce(platform, MemberJoined, new MemberJoinedPublisher(publisher, ids));
|
|
198
|
+
announce(platform, MemberRoleChanged, new MemberRoleChangedPublisher(publisher, ids));
|
|
199
|
+
announce(platform, MemberRemoved, new MemberRemovedPublisher(publisher, ids));
|
|
200
|
+
announce(platform, DelegationGranted, new DelegationGrantedPublisher(publisher, ids));
|
|
201
|
+
announce(platform, DelegationRevoked, new DelegationRevokedPublisher(publisher, ids));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Hands the events of one class to their publisher, observed by the platform as a handler of the context. */
|
|
205
|
+
function announce<Fact extends DomainEvent>(
|
|
206
|
+
platform: Platform,
|
|
207
|
+
fact: (abstract new (...args: never[]) => Fact) & { readonly eventName: string },
|
|
208
|
+
publisher: { handle(event: Fact): Promise<void> },
|
|
209
|
+
): void {
|
|
210
|
+
const observed = platform.adapter(publisher, { kind: 'domain-event-handler', context: '{{context.kebab}}' });
|
|
211
|
+
|
|
212
|
+
platform.domainEvents.on(fact.eventName, async (event) => {
|
|
213
|
+
if (event instanceof fact) {
|
|
214
|
+
await observed.handle(event);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** The consumers that bring the identity provider in line with what the context publishes, each event handled once. */
|
|
220
|
+
function keepTheProviderInLine(platform: Platform, { members, identityProvider }: Adapters): void {
|
|
221
|
+
const { processedEvents: processed, unitOfWork } = platform.persistence;
|
|
222
|
+
const { scope } = platform;
|
|
223
|
+
const accountDeactivatedIntegrationHandler = new AccountDeactivatedIntegrationHandler(identityProvider);
|
|
224
|
+
const memberJoinedIntegrationHandler = new MemberJoinedIntegrationHandler(members, identityProvider);
|
|
225
|
+
const memberRemovedIntegrationHandler = new MemberRemovedIntegrationHandler(members, identityProvider);
|
|
226
|
+
const organisationOpenedIntegrationHandler = new OrganisationOpenedIntegrationHandler(identityProvider);
|
|
227
|
+
|
|
228
|
+
subscribeAll(platform.subscriber, [
|
|
229
|
+
on(accountDeactivatedV1, (event) => accountDeactivatedIntegrationHandler.handle(event), {
|
|
230
|
+
consumer: '{{context.kebab}}.provider-disables-account',
|
|
231
|
+
processed,
|
|
232
|
+
unitOfWork,
|
|
233
|
+
scope,
|
|
234
|
+
}),
|
|
235
|
+
on(memberJoinedV1, (event) => memberJoinedIntegrationHandler.handle(event), {
|
|
236
|
+
consumer: '{{context.kebab}}.provider-follows-joined-member',
|
|
237
|
+
processed,
|
|
238
|
+
unitOfWork,
|
|
239
|
+
scope,
|
|
240
|
+
}),
|
|
241
|
+
on(memberRemovedV1, (event) => memberRemovedIntegrationHandler.handle(event), {
|
|
242
|
+
consumer: '{{context.kebab}}.provider-follows-removed-member',
|
|
243
|
+
processed,
|
|
244
|
+
unitOfWork,
|
|
245
|
+
scope,
|
|
246
|
+
}),
|
|
247
|
+
on(organisationOpenedV1, (event) => organisationOpenedIntegrationHandler.handle(event), {
|
|
248
|
+
consumer: '{{context.kebab}}.provider-opens-organisation',
|
|
249
|
+
processed,
|
|
250
|
+
unitOfWork,
|
|
251
|
+
scope,
|
|
252
|
+
}),
|
|
253
|
+
]);
|
|
254
|
+
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account changes the roles of an organisation where it manages the members. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['member.change-role'], { name: '{{context.kebab}}.change-member-roles' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class ChangeMemberRolesPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.change-member-roles';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['member.change-role'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account lends rights in an organisation where its role lets it delegate. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['delegation.grant'], { name: '{{context.kebab}}.grant-delegations' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class GrantDelegationsPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.grant-delegations';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['delegation.grant'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account invites to an organisation when its role, or a delegation, lets it invite there. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['member.invite'], { name: '{{context.kebab}}.invite-members' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class InviteMembersPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.invite-members';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['member.invite'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account searches the members of an organisation it belongs to. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['member.search'], { name: '{{context.kebab}}.read-members' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class ReadMembersPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.read-members';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['member.search'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account removes members of an organisation where it manages the members. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['member.remove'], { name: '{{context.kebab}}.remove-members' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class RemoveMembersPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.remove-members';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['member.remove'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account revokes the delegations of an organisation where its role lets it delegate. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['delegation.revoke'], { name: '{{context.kebab}}.revoke-delegations' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class RevokeDelegationsPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.revoke-delegations';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['delegation.revoke'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { isAuthenticated, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Policy } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
3
5
|
import { OrganisationRights } from '{{alias.context}}/domain/value-objects/organisation-rights.vo{{alias.ext}}';
|
|
4
6
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
5
7
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
6
8
|
|
|
7
9
|
/** An account takes back the invitations of an organisation where it may invite. */
|
|
10
|
+
{{#if style.declared}}
|
|
8
11
|
@Policy({{context.camel}}Permissions['invitation.revoke'], { name: '{{context.kebab}}.revoke-invitations' })
|
|
12
|
+
{{/if}}
|
|
9
13
|
export class RevokeInvitationsPolicy {
|
|
14
|
+
{{#unless style.declared}}
|
|
15
|
+
readonly name = '{{context.kebab}}.revoke-invitations';
|
|
16
|
+
|
|
17
|
+
readonly permission = {{context.camel}}Permissions['invitation.revoke'];
|
|
18
|
+
|
|
19
|
+
{{/unless}}
|
|
10
20
|
appliesTo(subject: unknown): subject is OrganisationRights {
|
|
11
21
|
return subject instanceof OrganisationRights;
|
|
12
22
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { AuthorizedCommand, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Requires } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#if style.declared}}
|
|
3
6
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
7
|
+
{{/if}}
|
|
4
8
|
|
|
5
9
|
/** Accepts the invitation of this token, addressed to the actor: the actor becomes a member. */
|
|
10
|
+
{{#if style.declared}}
|
|
6
11
|
@Requires({{context.camel}}Permissions['invitation.accept'], { resource: () => ({ type: 'context', id: '{{context.kebab}}' }) })
|
|
12
|
+
{{/if}}
|
|
7
13
|
export class AcceptInvitationCommand extends AuthorizedCommand<string> {
|
|
8
14
|
constructor(
|
|
9
15
|
actor: Actor,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#unless style.declared}}
|
|
6
|
+
import type { CommandHandler } from '@ddd-ts-kit/kernel';
|
|
7
|
+
{{/unless}}
|
|
3
8
|
import { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
4
9
|
{{#unless refusals.named}}
|
|
5
10
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
@@ -14,10 +19,17 @@ import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invit
|
|
|
14
19
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
15
20
|
import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
|
|
16
21
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
22
|
+
{{#if style.declared}}
|
|
17
23
|
import { AcceptInvitationCommand } from '{{alias.context}}/application/commands/accept-invitation/accept-invitation.command{{alias.ext}}';
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#unless style.declared}}
|
|
26
|
+
import type { AcceptInvitationCommand } from '{{alias.context}}/application/commands/accept-invitation/accept-invitation.command{{alias.ext}}';
|
|
27
|
+
{{/unless}}
|
|
18
28
|
import type { InvitationTokens } from '{{alias.context}}/application/ports/invitation-tokens.port{{alias.ext}}';
|
|
19
29
|
|
|
30
|
+
{{#if style.declared}}
|
|
20
31
|
@CommandHandler(AcceptInvitationCommand)
|
|
32
|
+
{{/if}}
|
|
21
33
|
export class AcceptInvitationHandler implements CommandHandler<AcceptInvitationCommand> {
|
|
22
34
|
constructor(
|
|
23
35
|
private readonly invitationRepository: InvitationRepository,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { AuthorizedCommand, type Actor } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Requires } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#if style.declared}}
|
|
3
6
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
7
|
+
{{/if}}
|
|
4
8
|
import type { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vocabulary{{alias.ext}}';
|
|
5
9
|
|
|
6
10
|
/** Changes the role of a member of an organisation. */
|
|
11
|
+
{{#if style.declared}}
|
|
7
12
|
@Requires({{context.camel}}Permissions['member.change-role'], { resource: () => ({ type: 'context', id: '{{context.kebab}}' }) })
|
|
13
|
+
{{/if}}
|
|
8
14
|
export class ChangeMemberRoleCommand extends AuthorizedCommand<string> {
|
|
9
15
|
constructor(
|
|
10
16
|
actor: Actor,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Access } from '@ddd-ts-kit/auth';
|
|
2
2
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{#if style.declared}}
|
|
3
4
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#unless style.declared}}
|
|
7
|
+
import type { CommandHandler } from '@ddd-ts-kit/kernel';
|
|
8
|
+
{{/unless}}
|
|
4
9
|
import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
5
10
|
import type { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
|
|
6
11
|
{{#unless refusals.named}}
|
|
@@ -18,9 +23,16 @@ import { RoleRightsService, type HeldRights } from '{{alias.context}}/domain/ser
|
|
|
18
23
|
import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.vocabulary{{alias.ext}}';
|
|
19
24
|
import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vocabulary{{alias.ext}}';
|
|
20
25
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
26
|
+
{{#if style.declared}}
|
|
21
27
|
import { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/change-member-role/change-member-role.command{{alias.ext}}';
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#unless style.declared}}
|
|
30
|
+
import type { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/change-member-role/change-member-role.command{{alias.ext}}';
|
|
31
|
+
{{/unless}}
|
|
22
32
|
|
|
33
|
+
{{#if style.declared}}
|
|
23
34
|
@CommandHandler(ChangeMemberRoleCommand)
|
|
35
|
+
{{/if}}
|
|
24
36
|
export class ChangeMemberRoleHandler implements CommandHandler<ChangeMemberRoleCommand> {
|
|
25
37
|
constructor(
|
|
26
38
|
private readonly organisationRepository: OrganisationRepository,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { AuthorizedCommand } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#if style.declared}}
|
|
2
3
|
import { Requires } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{#if style.declared}}
|
|
3
6
|
import { {{context.camel}}Permissions } from '{{alias.context}}/{{context.kebab}}.permissions{{alias.ext}}';
|
|
7
|
+
{{/if}}
|
|
4
8
|
|
|
5
9
|
/** Deactivates the account of the person who asks. */
|
|
10
|
+
{{#if style.declared}}
|
|
6
11
|
@Requires({{context.camel}}Permissions['account.deactivate'], { resource: () => ({ type: 'context', id: '{{context.kebab}}' }) })
|
|
12
|
+
{{/if}}
|
|
7
13
|
export class DeactivateAccountCommand extends AuthorizedCommand<string> {}
|