ddd-ts-kit 0.91.0 → 0.92.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 +189 -0
- package/README.fr.md +16 -12
- package/README.md +15 -10
- package/dist/acceptance/lock-acceptance.d.ts.map +1 -1
- package/dist/acceptance/lock-acceptance.js +2 -1
- package/dist/acceptance/lock-acceptance.js.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.js +3 -1
- package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
- package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
- package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
- package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.js +21 -3
- package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -1
- package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -1
- package/dist/check/nest/nest-equivalents-of.js +7 -2
- package/dist/check/nest/nest-equivalents-of.js.map +1 -1
- package/dist/check/rules/nest-controllers-current.d.ts.map +1 -1
- package/dist/check/rules/nest-controllers-current.js +13 -2
- package/dist/check/rules/nest-controllers-current.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -5
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +21 -1
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/prisma-generate.d.ts +7 -0
- package/dist/commands/prisma-generate.d.ts.map +1 -0
- package/dist/commands/prisma-generate.js +23 -0
- package/dist/commands/prisma-generate.js.map +1 -0
- package/dist/commands/typeorm-generate.d.ts +10 -0
- package/dist/commands/typeorm-generate.d.ts.map +1 -0
- package/dist/commands/typeorm-generate.js +37 -0
- package/dist/commands/typeorm-generate.js.map +1 -0
- package/dist/config/stack.d.ts +1 -1
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/guard-errors.d.ts +3 -0
- package/dist/describe/guard-errors.d.ts.map +1 -0
- package/dist/describe/guard-errors.js +10 -0
- package/dist/describe/guard-errors.js.map +1 -0
- package/dist/describe/no-group.d.ts +4 -0
- package/dist/describe/no-group.d.ts.map +1 -0
- package/dist/describe/no-group.js +3 -0
- package/dist/describe/no-group.js.map +1 -0
- package/dist/describe/read-controllers.d.ts +1 -1
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +12 -19
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/read-nest-controller-routes.d.ts +16 -0
- package/dist/describe/read-nest-controller-routes.d.ts.map +1 -0
- package/dist/describe/read-nest-controller-routes.js +117 -0
- package/dist/describe/read-nest-controller-routes.js.map +1 -0
- package/dist/describe/schema-class-of.d.ts +3 -0
- package/dist/describe/schema-class-of.d.ts.map +1 -0
- package/dist/describe/schema-class-of.js +10 -0
- package/dist/describe/schema-class-of.js.map +1 -0
- package/dist/docs/declared-stored-events.d.ts +6 -2
- package/dist/docs/declared-stored-events.d.ts.map +1 -1
- package/dist/docs/declared-stored-events.js +4 -3
- package/dist/docs/declared-stored-events.js.map +1 -1
- package/dist/docs/emptily-recorded-stored-events.d.ts +6 -0
- package/dist/docs/emptily-recorded-stored-events.d.ts.map +1 -0
- package/dist/docs/emptily-recorded-stored-events.js +12 -0
- package/dist/docs/emptily-recorded-stored-events.js.map +1 -0
- package/dist/docs/refuse-unreadable-stored-events.d.ts +7 -0
- package/dist/docs/refuse-unreadable-stored-events.d.ts.map +1 -0
- package/dist/docs/refuse-unreadable-stored-events.js +27 -0
- package/dist/docs/refuse-unreadable-stored-events.js.map +1 -0
- package/dist/docs/write-stored-events-lock.d.ts +3 -2
- package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
- package/dist/docs/write-stored-events-lock.js +5 -2
- package/dist/docs/write-stored-events-lock.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.js +6 -2
- package/dist/generate/kinds/aggregate-kind.js.map +1 -1
- package/dist/generate/kinds/assert-event-store.d.ts +4 -0
- package/dist/generate/kinds/assert-event-store.d.ts.map +1 -0
- package/dist/generate/kinds/assert-event-store.js +10 -0
- package/dist/generate/kinds/assert-event-store.js.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts +9 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +49 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -0
- package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload-kind.js +9 -2
- package/dist/generate/kinds/file-upload-kind.js.map +1 -1
- package/dist/generate/kinds/form-kind.d.ts.map +1 -1
- package/dist/generate/kinds/form-kind.js +15 -11
- package/dist/generate/kinds/form-kind.js.map +1 -1
- package/dist/generate/kinds/generate-event-sourced-repository.d.ts +11 -0
- package/dist/generate/kinds/generate-event-sourced-repository.d.ts.map +1 -0
- package/dist/generate/kinds/generate-event-sourced-repository.js +48 -0
- package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -0
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +5 -0
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/is-event-sourced.d.ts +9 -0
- package/dist/generate/kinds/is-event-sourced.d.ts.map +1 -0
- package/dist/generate/kinds/is-event-sourced.js +11 -0
- package/dist/generate/kinds/is-event-sourced.js.map +1 -0
- package/dist/generate/kinds/presentation/controller-source.d.ts +11 -3
- package/dist/generate/kinds/presentation/controller-source.d.ts.map +1 -1
- package/dist/generate/kinds/presentation/controller-source.js +25 -4
- package/dist/generate/kinds/presentation/controller-source.js.map +1 -1
- package/dist/generate/kinds/repository-kind.js +1 -1
- package/dist/generate/kinds/repository-kind.js.map +1 -1
- package/dist/generate/kinds/representation-kind.d.ts.map +1 -1
- package/dist/generate/kinds/representation-kind.js +4 -3
- package/dist/generate/kinds/representation-kind.js.map +1 -1
- package/dist/generate/kinds/route/nest-controller-vars.d.ts +2 -2
- package/dist/generate/kinds/route/nest-controller-vars.js +3 -9
- package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -1
- package/dist/generate/kinds/route/nest-search-vars.d.ts +6 -0
- package/dist/generate/kinds/route/nest-search-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/nest-search-vars.js +18 -0
- package/dist/generate/kinds/route/nest-search-vars.js.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -1
- package/dist/generate/kinds/route/write-nest-controller.js +6 -8
- package/dist/generate/kinds/route/write-nest-controller.js.map +1 -1
- package/dist/generate/kinds/route-kind.js +1 -1
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -1
- package/dist/generate/kinds/wire-repository-on-first-use.js +2 -1
- package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.js +5 -13
- package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +3 -1
- package/dist/help/notes.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 +3 -1
- package/dist/help/usage.js.map +1 -1
- package/dist/init/agent-permissions.js +10 -6
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/auth-files.js +4 -0
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/platform-files.js +1 -0
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/knip-vars.js +4 -3
- package/dist/init/knip-vars.js.map +1 -1
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +10 -4
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.js +5 -1
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +7 -1
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +34 -30
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +9 -7
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/template-vars.js +1 -1
- package/dist/init/template-vars.js.map +1 -1
- package/dist/init/write-type-script-configs.d.ts.map +1 -1
- package/dist/init/write-type-script-configs.js +4 -1
- package/dist/init/write-type-script-configs.js.map +1 -1
- package/dist/markers/insert-in-region.js +1 -1
- package/dist/markers/insert-in-region.js.map +1 -1
- package/dist/merge/lost/untouched-by-branch.d.ts +12 -0
- package/dist/merge/lost/untouched-by-branch.d.ts.map +1 -0
- package/dist/merge/lost/untouched-by-branch.js +22 -0
- package/dist/merge/lost/untouched-by-branch.js.map +1 -0
- package/dist/merge/lost/verify-merge.d.ts.map +1 -1
- package/dist/merge/lost/verify-merge.js +6 -1
- package/dist/merge/lost/verify-merge.js.map +1 -1
- package/dist/migration/audit-guard/append-audit-guard.d.ts +18 -0
- package/dist/migration/audit-guard/append-audit-guard.d.ts.map +1 -0
- package/dist/migration/audit-guard/append-audit-guard.js +27 -0
- package/dist/migration/audit-guard/append-audit-guard.js.map +1 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.d.ts +7 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.d.ts.map +1 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.js +18 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.js.map +1 -0
- package/dist/migration/audit-guard/audit-schema-created.d.ts +3 -0
- package/dist/migration/audit-guard/audit-schema-created.d.ts.map +1 -0
- package/dist/migration/audit-guard/audit-schema-created.js +9 -0
- package/dist/migration/audit-guard/audit-schema-created.js.map +1 -0
- package/dist/migration/audit-guard/generate-guarded.d.ts +16 -0
- package/dist/migration/audit-guard/generate-guarded.d.ts.map +1 -0
- package/dist/migration/audit-guard/generate-guarded.js +22 -0
- package/dist/migration/audit-guard/generate-guarded.js.map +1 -0
- package/dist/migration/audit-guard/guard-marker.d.ts +3 -0
- package/dist/migration/audit-guard/guard-marker.d.ts.map +1 -0
- package/dist/migration/audit-guard/guard-marker.js +3 -0
- package/dist/migration/audit-guard/guard-marker.js.map +1 -0
- package/dist/migration/audit-guard/guarded-text.d.ts +5 -0
- package/dist/migration/audit-guard/guarded-text.d.ts.map +1 -0
- package/dist/migration/audit-guard/guarded-text.js +26 -0
- package/dist/migration/audit-guard/guarded-text.js.map +1 -0
- package/dist/migration/audit-guard/migrations-under.d.ts +3 -0
- package/dist/migration/audit-guard/migrations-under.d.ts.map +1 -0
- package/dist/migration/audit-guard/migrations-under.js +15 -0
- package/dist/migration/audit-guard/migrations-under.js.map +1 -0
- package/dist/migration/audit-guard/run-orm-tool.d.ts +3 -0
- package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -0
- package/dist/migration/audit-guard/run-orm-tool.js +13 -0
- package/dist/migration/audit-guard/run-orm-tool.js.map +1 -0
- package/dist/migration/audit-guard/schemas-first.d.ts +6 -0
- package/dist/migration/audit-guard/schemas-first.d.ts.map +1 -0
- package/dist/migration/audit-guard/schemas-first.js +17 -0
- package/dist/migration/audit-guard/schemas-first.js.map +1 -0
- package/dist/migration/audit-guard/schemas-if-missing.d.ts +7 -0
- package/dist/migration/audit-guard/schemas-if-missing.d.ts.map +1 -0
- package/dist/migration/audit-guard/schemas-if-missing.js +9 -0
- package/dist/migration/audit-guard/schemas-if-missing.js.map +1 -0
- package/dist/migration/audit-guard/type-only-imports.d.ts +6 -0
- package/dist/migration/audit-guard/type-only-imports.d.ts.map +1 -0
- package/dist/migration/audit-guard/type-only-imports.js +8 -0
- package/dist/migration/audit-guard/type-only-imports.js.map +1 -0
- package/dist/migration/format-as-the-project.d.ts +4 -0
- package/dist/migration/format-as-the-project.d.ts.map +1 -0
- package/dist/migration/format-as-the-project.js +27 -0
- package/dist/migration/format-as-the-project.js.map +1 -0
- package/dist/migration/format-written-files.d.ts.map +1 -1
- package/dist/migration/format-written-files.js +2 -24
- package/dist/migration/format-written-files.js.map +1 -1
- package/dist/migration/index.d.ts +8 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +8 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/nest-controllers/nest-answer.d.ts +2 -10
- package/dist/nest-controllers/nest-answer.d.ts.map +1 -1
- package/dist/nest-controllers/nest-controller-entry.d.ts +4 -2
- package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -1
- package/dist/nest-controllers/nest-controllers-in.d.ts +6 -0
- package/dist/nest-controllers/nest-controllers-in.d.ts.map +1 -0
- package/dist/nest-controllers/nest-controllers-in.js +108 -0
- package/dist/nest-controllers/nest-controllers-in.js.map +1 -0
- package/dist/nest-controllers/nest-read-type.d.ts +12 -0
- package/dist/nest-controllers/nest-read-type.d.ts.map +1 -0
- package/dist/nest-controllers/nest-read-type.js +2 -0
- package/dist/nest-controllers/nest-read-type.js.map +1 -0
- package/dist/nest-controllers/nest-request-part.d.ts +9 -0
- package/dist/nest-controllers/nest-request-part.d.ts.map +1 -0
- package/dist/nest-controllers/nest-request-part.js +2 -0
- package/dist/nest-controllers/nest-request-part.js.map +1 -0
- package/dist/nest-controllers/parameters-of.d.ts +8 -0
- package/dist/nest-controllers/parameters-of.d.ts.map +1 -0
- package/dist/nest-controllers/parameters-of.js +32 -0
- package/dist/nest-controllers/parameters-of.js.map +1 -0
- package/dist/nest-controllers/project-files.d.ts +6 -0
- package/dist/nest-controllers/project-files.d.ts.map +1 -0
- package/dist/nest-controllers/project-files.js +2 -0
- package/dist/nest-controllers/project-files.js.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts +6 -9
- package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -1
- package/dist/nest-controllers/read-nest-controllers.js +10 -82
- package/dist/nest-controllers/read-nest-controllers.js.map +1 -1
- package/dist/nest-controllers/render-controllers-file.d.ts +4 -3
- package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -1
- package/dist/nest-controllers/render-controllers-file.js +45 -29
- package/dist/nest-controllers/render-controllers-file.js.map +1 -1
- package/dist/platform-layout/platform-layout.d.ts +3 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -1
- package/dist/platform-layout/platform-layout.js +3 -0
- package/dist/platform-layout/platform-layout.js.map +1 -1
- package/dist/presets/identity-refusal.js +3 -3
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +3 -1
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/dist/stack/authentication-vars.d.ts.map +1 -1
- package/dist/stack/authentication-vars.js +8 -2
- package/dist/stack/authentication-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.d.ts.map +1 -1
- package/dist/worker/briefing-of.js +2 -4
- package/dist/worker/briefing-of.js.map +1 -1
- package/dist/worker/resume-message.d.ts.map +1 -1
- package/dist/worker/resume-message.js +1 -2
- package/dist/worker/resume-message.js.map +1 -1
- package/package.json +6 -4
- package/templates/background-job/wiring.manual.tpl +1 -1
- package/templates/command/wiring.manual.tpl +1 -1
- package/templates/context/module.manual.ts.tpl +41 -10
- package/templates/erasure-handler/wiring.manual.tpl +1 -1
- package/templates/event-handler/wiring.manual.tpl +1 -1
- package/templates/file-upload/wiring.manual.tpl +1 -1
- package/templates/init/docker/env.example.tpl +1 -1
- package/templates/init/e2e/auth-environment.passport.ts.tpl +6 -0
- package/templates/init/e2e/create-credentials.passport.ts.tpl +47 -0
- package/templates/init/platform/auth/authentication/actor-of-token.ts.tpl +15 -0
- package/templates/init/platform/auth/authentication/bearer-strategy.ts.tpl +29 -0
- package/templates/init/platform/auth/authentication/create-authenticator.passport.ts.tpl +13 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +5 -2
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
- package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
- package/templates/init/platform/composition/platform-error-mapper.ts.tpl +9 -0
- package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +11 -0
- package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +5 -2
- package/templates/init/platform/config/app-config.ts.tpl +2 -2
- package/templates/init/platform/config/load-config.ts.tpl +2 -2
- package/templates/init/platform/database/open-persistence.memory.ts.tpl +10 -0
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +5 -0
- package/templates/init/platform/database/persistence.contract.spec.ts.tpl +18 -0
- package/templates/init/platform/database/persistence.memory.ts.tpl +7 -1
- package/templates/init/platform/database/persistence.orm.ts.tpl +9 -1
- package/templates/init/platform/database/schema.drizzle.ts.tpl +11 -1
- package/templates/init/platform/database/schema.prisma.tpl +2 -1
- package/templates/init/platform/database/schema.typeorm.ts.tpl +1 -1
- package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +18 -6
- package/templates/init/platform/http/start-http-server.express.ts.tpl +10 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +6 -1
- package/templates/init/rules/presentation.md.tpl +1 -1
- package/templates/integration-event/wiring.manual.tpl +1 -1
- package/templates/integration-handler/wiring.manual.tpl +1 -1
- package/templates/job/wiring.manual.tpl +1 -1
- package/templates/nest-controller/controller.search.ts.tpl +38 -0
- package/templates/nest-controller/controller.ts.tpl +1 -17
- package/templates/nest-controller/upload.spec.ts.tpl +47 -0
- package/templates/nest-controller/upload.ts.tpl +25 -0
- package/templates/pipeline/biome.json.tpl +2 -2
- package/templates/pipeline/eslint.config.mjs.tpl +6 -0
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +17 -0
- package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.nest-routes.ts.tpl +44 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.nest-routes.ts.tpl +56 -0
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.nest-routes.ts.tpl +54 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.nest-routes.ts.tpl +32 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.nest-routes.ts.tpl +43 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.nest-routes.ts.tpl +25 -0
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.nest-routes.ts.tpl +37 -0
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.nest-routes.ts.tpl +42 -0
- package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +13 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/invite-member.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/provision-account.controller.spec.nest-routes.ts.tpl +99 -0
- package/templates/presets/identity/context/test/unit/remove-member.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/search-members.controller.spec.nest-routes.ts.tpl +54 -0
- package/templates/process/timeout-job.wiring.manual.tpl +1 -1
- package/templates/query/search.wiring.manual.tpl +1 -1
- package/templates/query/wiring.manual.tpl +1 -1
- package/templates/repository/contract.spec.ts.tpl +1 -3
- package/templates/repository/event-sourced/contract.spec.ts.tpl +36 -0
- package/templates/repository/event-sourced/fake.ts.tpl +24 -0
- package/templates/repository/event-sourced/repository.ts.tpl +38 -0
- package/templates/repository/event-sourced-first-use.wiring.manual.tpl +4 -0
- package/templates/repository/event-sourced.wiring.tsyringe.tpl +6 -0
- package/templates/repository/first-use.wiring.manual.tpl +1 -1
- /package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/{deactivate-account.controller.ts.tpl → deactivate-account.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/accounts/provision-account/{provision-account.controller.ts.tpl → provision-account.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/{accept-invitation.controller.ts.tpl → accept-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/{decline-invitation.controller.ts.tpl → decline-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/change-member-role/{change-member-role.controller.ts.tpl → change-member-role.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/{grant-delegation.controller.ts.tpl → grant-delegation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/invite-member/{invite-member.controller.ts.tpl → invite-member.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/open-organisation/{open-organisation.controller.ts.tpl → open-organisation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/remove-member/{remove-member.controller.ts.tpl → remove-member.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/{revoke-delegation.controller.ts.tpl → revoke-delegation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/{revoke-invitation.controller.ts.tpl → revoke-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/search-members/{search-members.controller.ts.tpl → search-members.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{accept-invitation.controller.spec.ts.tpl → accept-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{change-member-role.controller.spec.ts.tpl → change-member-role.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{deactivate-account.controller.spec.ts.tpl → deactivate-account.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{decline-invitation.controller.spec.ts.tpl → decline-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{grant-delegation.controller.spec.ts.tpl → grant-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{invite-member.controller.spec.ts.tpl → invite-member.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{open-organisation.controller.spec.ts.tpl → open-organisation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{provision-account.controller.spec.ts.tpl → provision-account.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{remove-member.controller.spec.ts.tpl → remove-member.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{revoke-delegation.controller.spec.ts.tpl → revoke-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{revoke-invitation.controller.spec.ts.tpl → revoke-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{search-members.controller.spec.ts.tpl → search-members.controller.spec.kit-routes.ts.tpl} +0 -0
|
@@ -9,7 +9,7 @@ import type { UseCaseDeclaration } from '@ddd-ts-kit/auth';
|
|
|
9
9
|
import { subscribeAll } from '@ddd-ts-kit/events';
|
|
10
10
|
{{/if}}
|
|
11
11
|
{{#if http.any}}
|
|
12
|
-
import {
|
|
12
|
+
import { defineRoutes, type Route } from '@ddd-ts-kit/http';
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{#if routes.nest}}
|
|
15
15
|
import type { Type } from '@nestjs/common';
|
|
@@ -45,6 +45,9 @@ import { withForms } from '{{alias.platform}}/http/with-forms{{alias.ext}}';
|
|
|
45
45
|
import { relateSystemActors } from '{{alias.platform}}/auth/relationships/relate-system-actors{{alias.ext}}';
|
|
46
46
|
{{/if}}
|
|
47
47
|
import { createPlatform } from '{{alias.platform}}/composition/create-platform{{alias.ext}}';
|
|
48
|
+
{{#if http.any}}
|
|
49
|
+
import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
|
|
50
|
+
{{/if}}
|
|
48
51
|
import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
|
|
49
52
|
{{#if files.http}}
|
|
50
53
|
import { fileRoutes } from '{{alias.platform}}/files/file-routes{{alias.ext}}';
|
|
@@ -182,7 +185,7 @@ export function composeApplication(
|
|
|
182
185
|
boundary: httpBoundary({
|
|
183
186
|
authenticator: options.authenticator,
|
|
184
187
|
executionScope: platform.scope,
|
|
185
|
-
errorMapper:
|
|
188
|
+
errorMapper: platformErrorMapper(),
|
|
186
189
|
clock,
|
|
187
190
|
logger,
|
|
188
191
|
{{#if audit.on}}
|
|
@@ -114,7 +114,7 @@ export function layFoundations(persistence: Persistence, options: PlatformOption
|
|
|
114
114
|
{{#unless audit.on}}
|
|
115
115
|
decisions: logDecisions(logger),
|
|
116
116
|
{{#if eventSourcing.on}}
|
|
117
|
-
eventSourcing: createEventSourcing(persistence),
|
|
117
|
+
eventSourcing: createEventSourcing(persistence{{#if tenancy.any}}, scope{{/if}}),
|
|
118
118
|
{{/if}}
|
|
119
119
|
{{/unless}}
|
|
120
120
|
};
|
|
@@ -83,7 +83,7 @@ export function layFoundations(persistence: Persistence, options: Observed): Fou
|
|
|
83
83
|
{{#unless audit.on}}
|
|
84
84
|
decisions: logDecisions(logger),
|
|
85
85
|
{{#if eventSourcing.on}}
|
|
86
|
-
eventSourcing: createEventSourcing(persistence),
|
|
86
|
+
eventSourcing: createEventSourcing(persistence{{#if tenancy.any}}, scope{{/if}}),
|
|
87
87
|
{{/if}}
|
|
88
88
|
{{/unless}}
|
|
89
89
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createErrorMapper, type ErrorMapper } from '@ddd-ts-kit/http';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a refusal becomes on the wire. The application and the test platform bind this one mapper,
|
|
5
|
+
* so a route spec answers what the running application answers: map your own errors here, once.
|
|
6
|
+
*/
|
|
7
|
+
export function platformErrorMapper(): ErrorMapper {
|
|
8
|
+
return createErrorMapper();
|
|
9
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
{{#if http.any}}
|
|
2
|
+
import { ErrorMapper } from '@ddd-ts-kit/http';
|
|
3
|
+
{{/if}}
|
|
1
4
|
{{#if eventSourcing.on}}
|
|
2
5
|
import { defineContextModule, type ModuleBuilder } from '@ddd-ts-kit/di';
|
|
3
6
|
import {
|
|
@@ -21,6 +24,9 @@ import { defineContextModule } from '@ddd-ts-kit/di';
|
|
|
21
24
|
import { InMemoryFileStorage } from '@ddd-ts-kit/kernel';
|
|
22
25
|
{{/if}}
|
|
23
26
|
{{/unless}}
|
|
27
|
+
{{#if http.any}}
|
|
28
|
+
import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
|
|
29
|
+
{{/if}}
|
|
24
30
|
{{#if persistence.packagedToken}}
|
|
25
31
|
import { {{persistence.token}} } from '{{persistence.tokenPackage}}';
|
|
26
32
|
{{/if}}
|
|
@@ -42,6 +48,11 @@ export const platformTestModule = defineContextModule({
|
|
|
42
48
|
throw new Error('A handler spec has no database: give a fake for the repository it uses.');
|
|
43
49
|
});
|
|
44
50
|
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#if http.any}}
|
|
53
|
+
// The mapper of the application: a route spec answers what the running application answers.
|
|
54
|
+
builder.bind(ErrorMapper).toValue(platformErrorMapper());
|
|
55
|
+
|
|
45
56
|
{{/if}}
|
|
46
57
|
{{#if files.any}}
|
|
47
58
|
// The files a handler spec stores stay in the memory of the test.
|
|
@@ -11,7 +11,7 @@ import { defineContextModule, type ContextModule } from '@ddd-ts-kit/di';
|
|
|
11
11
|
import { OutboxStore } from '@ddd-ts-kit/events';
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{#if http.any}}
|
|
14
|
-
import { ErrorMapper
|
|
14
|
+
import { ErrorMapper } from '@ddd-ts-kit/http';
|
|
15
15
|
{{/if}}
|
|
16
16
|
{{#if cache.redis}}
|
|
17
17
|
{{#if broker.external}}
|
|
@@ -79,6 +79,9 @@ import { Database } from '{{alias.platform}}/database/database{{alias.ext}}';
|
|
|
79
79
|
{{/if}}
|
|
80
80
|
import type { ConsumerTrace } from '@ddd-ts-kit/tracing';
|
|
81
81
|
import type { Persistence } from '{{alias.platform}}/database/persistence{{alias.ext}}';
|
|
82
|
+
{{#if http.any}}
|
|
83
|
+
import { platformErrorMapper } from '{{alias.platform}}/composition/platform-error-mapper{{alias.ext}}';
|
|
84
|
+
{{/if}}
|
|
82
85
|
import type { EventProvider } from '{{alias.platform}}/events/event-provider{{alias.ext}}';
|
|
83
86
|
import type { LogSettings } from '{{alias.platform}}/observability/create-logger{{alias.ext}}';
|
|
84
87
|
{{#if cache.redis}}
|
|
@@ -153,7 +156,7 @@ export function platformModule(persistence: Persistence, options: PlatformOption
|
|
|
153
156
|
builder.rebind(EventSubscribers).toValue({ forContext: (name) => options.events.forConsumer(name) });
|
|
154
157
|
{{/if}}
|
|
155
158
|
{{#if http.any}}
|
|
156
|
-
builder.bind(ErrorMapper).toValue(
|
|
159
|
+
builder.bind(ErrorMapper).toValue(platformErrorMapper());
|
|
157
160
|
{{/if}}
|
|
158
161
|
// Cross-cutting behaviour stays out of the contexts. Inside the span and the dispatch the kernel module puts around a binding, outside the aspects a binding states for itself (`ownPolicy`).
|
|
159
162
|
builder.around(['external', 'gateway'], () => defaultPolicy(options.resilience ?? defaultResilienceSettings));
|
|
@@ -32,7 +32,7 @@ export interface AppConfig {
|
|
|
32
32
|
{{#if docs.any}}
|
|
33
33
|
readonly docsEnabled: boolean;
|
|
34
34
|
{{/if}}
|
|
35
|
-
{{#if authn.
|
|
35
|
+
{{#if authn.jwks}}
|
|
36
36
|
readonly auth: AuthConfig;
|
|
37
37
|
{{/if}}
|
|
38
38
|
{{#if authn.keycloak}}
|
|
@@ -99,7 +99,7 @@ interface KeycloakConfig {
|
|
|
99
99
|
readonly clientId?: string;
|
|
100
100
|
}
|
|
101
101
|
{{/if}}
|
|
102
|
-
{{#if authn.
|
|
102
|
+
{{#if authn.jwks}}
|
|
103
103
|
|
|
104
104
|
/** Where tokens come from and whom they are for: the issuer, the audience this service answers to, the keys of the issuer. */
|
|
105
105
|
interface AuthConfig {
|
|
@@ -47,7 +47,7 @@ export function loadConfig(variables: Variables): AppConfig {
|
|
|
47
47
|
{{#if broker.addressed}}
|
|
48
48
|
{{broker.key}}: env.{{broker.reader}}('{{broker.variable}}'),
|
|
49
49
|
{{/if}}
|
|
50
|
-
{{#if authn.
|
|
50
|
+
{{#if authn.jwks}}
|
|
51
51
|
auth: readAuth(env),
|
|
52
52
|
{{/if}}
|
|
53
53
|
{{#if authn.keycloak}}
|
|
@@ -134,7 +134,7 @@ function readErrorReporting(env: Environment, environment: string): AppConfig['e
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
{{/if}}
|
|
137
|
-
{{#if authn.
|
|
137
|
+
{{#if authn.jwks}}
|
|
138
138
|
|
|
139
139
|
function readAuth(env: Environment): AppConfig['auth'] {
|
|
140
140
|
return {
|
|
@@ -43,12 +43,22 @@ export function openPersistence(): Persistence {
|
|
|
43
43
|
{{/unless}}
|
|
44
44
|
processedEvents: new InMemoryProcessedEventStore(),
|
|
45
45
|
{{#if eventSourcing.on}}
|
|
46
|
+
{{#if tenancy.any}}
|
|
47
|
+
eventSourcing: (scope) => ({
|
|
48
|
+
events: new InMemoryEventStore(scope),
|
|
49
|
+
snapshots: new InMemorySnapshotStore(),
|
|
50
|
+
checkpoints: new InMemoryCheckpointStore(),
|
|
51
|
+
subjectKeys: new InMemorySubjectKeyStore(),
|
|
52
|
+
}),
|
|
53
|
+
{{/if}}
|
|
54
|
+
{{#unless tenancy.any}}
|
|
46
55
|
eventSourcing: {
|
|
47
56
|
events: new InMemoryEventStore(),
|
|
48
57
|
snapshots: new InMemorySnapshotStore(),
|
|
49
58
|
checkpoints: new InMemoryCheckpointStore(),
|
|
50
59
|
subjectKeys: new InMemorySubjectKeyStore(),
|
|
51
60
|
},
|
|
61
|
+
{{/unless}}
|
|
52
62
|
{{/if}}
|
|
53
63
|
close: () => Promise.resolve(),
|
|
54
64
|
};
|
|
@@ -45,7 +45,12 @@ export function persistenceOver(connection: DatabaseConnection): Persistence {
|
|
|
45
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
|
+
{{#if tenancy.any}}
|
|
49
|
+
eventSourcing: (scope) => createDrizzleEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA, scope }),
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#unless tenancy.any}}
|
|
48
52
|
eventSourcing: createDrizzleEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
53
|
+
{{/unless}}
|
|
49
54
|
{{/if}}
|
|
50
55
|
close: () => connection.close(),
|
|
51
56
|
};
|
|
@@ -51,7 +51,12 @@ export function persistenceOver(connection: DatabaseConnection): Persistence {
|
|
|
51
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
|
+
{{#if tenancy.any}}
|
|
55
|
+
eventSourcing: (scope) => createKnexEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA, scope }),
|
|
56
|
+
{{/if}}
|
|
57
|
+
{{#unless tenancy.any}}
|
|
54
58
|
eventSourcing: createKnexEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
59
|
+
{{/unless}}
|
|
55
60
|
{{/if}}
|
|
56
61
|
close: () => connection.close(),
|
|
57
62
|
};
|
|
@@ -66,7 +66,12 @@ export function persistenceOver(client: PrismaClient): Persistence {
|
|
|
66
66
|
{{/unless}}
|
|
67
67
|
{{/if}}
|
|
68
68
|
{{#if eventSourcing.on}}
|
|
69
|
+
{{#if tenancy.any}}
|
|
70
|
+
eventSourcing: (scope) => createPrismaEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA, scope }),
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{#unless tenancy.any}}
|
|
69
73
|
eventSourcing: createPrismaEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
74
|
+
{{/unless}}
|
|
70
75
|
{{/if}}
|
|
71
76
|
close: () => client.$disconnect(),
|
|
72
77
|
};
|
|
@@ -45,7 +45,12 @@ export function persistenceOver(dataSource: DataSource): Persistence {
|
|
|
45
45
|
processes: ({{#if tenancy.any}}tenant{{/if}}) => new TypeOrmProcessStore(unitOfWork, { entity: processes{{#if tenancy.any}}, tenant{{/if}} }),
|
|
46
46
|
{{/if}}
|
|
47
47
|
{{#if eventSourcing.on}}
|
|
48
|
+
{{#if tenancy.any}}
|
|
49
|
+
eventSourcing: (scope) => createTypeOrmEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA, scope }),
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#unless tenancy.any}}
|
|
48
52
|
eventSourcing: createTypeOrmEventSourcing(unitOfWork, { schema: EVENT_STORE_SCHEMA }),
|
|
53
|
+
{{/unless}}
|
|
49
54
|
{{/if}}
|
|
50
55
|
close: async () => {
|
|
51
56
|
if (dataSource.isInitialized) {
|
|
@@ -2,6 +2,13 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from
|
|
|
2
2
|
{{#if queue.processTable}}
|
|
3
3
|
import { FixedExecutionScope, executionContext, systemActor } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{/if}}
|
|
5
|
+
{{#unless queue.processTable}}
|
|
6
|
+
{{#if tenancy.any}}
|
|
7
|
+
{{#if eventSourcing.on}}
|
|
8
|
+
import { FixedExecutionScope } from '@ddd-ts-kit/kernel';
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{/unless}}
|
|
5
12
|
{{#if queue.database}}
|
|
6
13
|
import {
|
|
7
14
|
{{#if eventSourcing.on}}
|
|
@@ -66,8 +73,19 @@ processedEventStoreContract(runner, {
|
|
|
66
73
|
|
|
67
74
|
eventStoreContract(runner, {
|
|
68
75
|
name: 'The event store of the platform',
|
|
76
|
+
{{#if tenancy.any}}
|
|
77
|
+
createStore: async () => (await emptied()).eventSourcing(new FixedExecutionScope()).events,
|
|
78
|
+
createCompanions: async () => (await emptied()).eventSourcing(new FixedExecutionScope()),
|
|
79
|
+
createTenantStore: async () => {
|
|
80
|
+
const scope = new FixedExecutionScope();
|
|
81
|
+
|
|
82
|
+
return { scope, store: (await emptied()).eventSourcing(scope).events };
|
|
83
|
+
},
|
|
84
|
+
{{/if}}
|
|
85
|
+
{{#unless tenancy.any}}
|
|
69
86
|
createStore: async () => (await emptied()).eventSourcing.events,
|
|
70
87
|
createCompanions: async () => (await emptied()).eventSourcing,
|
|
88
|
+
{{/unless}}
|
|
71
89
|
});
|
|
72
90
|
{{/if}}
|
|
73
91
|
{{#if queue.database}}
|
|
@@ -5,7 +5,7 @@ import type { OutboxStore, RelaySignal } from '@ddd-ts-kit/events';
|
|
|
5
5
|
import type { OutboxStore } from '@ddd-ts-kit/events';
|
|
6
6
|
{{/unless}}
|
|
7
7
|
{{#if eventSourcing.on}}
|
|
8
|
-
import type { EventSourcingStores, ProcessedEventStore, UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
8
|
+
import type { EventSourcingStores, {{#if tenancy.any}}ExecutionScope, {{/if}}ProcessedEventStore, UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
9
9
|
{{/if}}
|
|
10
10
|
{{#unless eventSourcing.on}}
|
|
11
11
|
import type { ProcessedEventStore, UnitOfWork } from '@ddd-ts-kit/kernel';
|
|
@@ -22,7 +22,13 @@ export interface Persistence {
|
|
|
22
22
|
readonly processedEvents: ProcessedEventStore;
|
|
23
23
|
{{#if eventSourcing.on}}
|
|
24
24
|
/** The event store, the snapshots, the checkpoints and the keys of the data subjects: what an event-sourced aggregate is saved through, and what seals its personal values. */
|
|
25
|
+
{{#if tenancy.any}}
|
|
26
|
+
/** Given the execution scope, each stream keeps the tenant of the work that first appended to it. */
|
|
27
|
+
readonly eventSourcing: (scope: ExecutionScope) => EventSourcingStores;
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#unless tenancy.any}}
|
|
25
30
|
readonly eventSourcing: EventSourcingStores;
|
|
31
|
+
{{/unless}}
|
|
26
32
|
{{/if}}
|
|
27
33
|
|
|
28
34
|
close(): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OutboxStore } from '@ddd-ts-kit/events';
|
|
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';
|
|
2
|
+
import type { {{#if eventSourcing.on}}EventSourcingStores, {{/if}}{{#if queue.processTable}}ExecutionScope, {{/if}}{{#unless queue.processTable}}{{#if tenancy.any}}{{#if eventSourcing.on}}ExecutionScope, {{/if}}{{/if}}{{/unless}}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}}
|
|
@@ -35,8 +35,16 @@ export interface Persistence {
|
|
|
35
35
|
* The event store, the snapshots, the checkpoints of the projections it feeds and the keys of the
|
|
36
36
|
* data subjects, in the `event_store` schema: what an event-sourced aggregate is loaded and saved
|
|
37
37
|
* through, and what seals its personal values. The platform binds each store to its port.
|
|
38
|
+
{{#if tenancy.any}}
|
|
39
|
+
* It is given the execution scope: each stream keeps the tenant of the work that first appended to it.
|
|
40
|
+
{{/if}}
|
|
38
41
|
*/
|
|
42
|
+
{{#if tenancy.any}}
|
|
43
|
+
readonly eventSourcing: (scope: ExecutionScope) => EventSourcingStores;
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#unless tenancy.any}}
|
|
39
46
|
readonly eventSourcing: EventSourcingStores;
|
|
47
|
+
{{/unless}}
|
|
40
48
|
{{/if}}
|
|
41
49
|
|
|
42
50
|
close(): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pgSchema } from 'drizzle-orm/pg-core';
|
|
1
2
|
{{#if audit.on}}
|
|
2
3
|
import { auditArchivesTable, auditChainsTable, auditEntriesTable } from '@ddd-ts-kit/audit/drizzle';
|
|
3
4
|
{{/if}}
|
|
@@ -11,6 +12,9 @@ import { {{#if eventSourcing.on}}eventStoreTables, {{/if}}{{#if queue.database}}
|
|
|
11
12
|
/** The schema of what the kit stores for the application: the outbox and the processed events{{#if queue.database}}, the background jobs{{/if}}{{#if queue.processTable}}, the process instances{{/if}}. */
|
|
12
13
|
export const MESSAGING_SCHEMA = 'messaging';
|
|
13
14
|
|
|
15
|
+
/** Exported, so that drizzle-kit writes its `CREATE SCHEMA` before the first table it holds. */
|
|
16
|
+
export const messaging = pgSchema(MESSAGING_SCHEMA);
|
|
17
|
+
|
|
14
18
|
{{#if tenancy.any}}
|
|
15
19
|
/** It keeps the tenant of each event, so that its consumers run in that tenant. */
|
|
16
20
|
export const outbox = tenantOutboxTable(MESSAGING_SCHEMA);
|
|
@@ -34,7 +38,10 @@ export const processes = processesTable(MESSAGING_SCHEMA);
|
|
|
34
38
|
/** The schema of the audit trail. */
|
|
35
39
|
export const AUDIT_SCHEMA = 'audit';
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
/** Exported, so that drizzle-kit writes its `CREATE SCHEMA` before the first table it holds. */
|
|
42
|
+
export const audit = pgSchema(AUDIT_SCHEMA);
|
|
43
|
+
|
|
44
|
+
// drizzle-kit writes no trigger: `npm run db:generate <name>` adds the statements that make the audit trail append-only (UPDATE, DELETE and TRUNCATE refused) to the migration that creates it; `npm run db:audit-guard` prints them for a migration written by hand.
|
|
38
45
|
export const auditEntries = auditEntriesTable(AUDIT_SCHEMA);
|
|
39
46
|
export const auditChains = auditChainsTable(AUDIT_SCHEMA);
|
|
40
47
|
/** One row per range of a chain moved to the storage of files: the anchor the chain goes on from. */
|
|
@@ -45,6 +52,9 @@ export const auditArchives = auditArchivesTable(AUDIT_SCHEMA);
|
|
|
45
52
|
/** The schema of the event store: the events, the snapshots, the checkpoints and the keys of the data subjects. It records no tenant. */
|
|
46
53
|
export const EVENT_STORE_SCHEMA = 'event_store';
|
|
47
54
|
|
|
55
|
+
/** Exported, so that drizzle-kit writes its `CREATE SCHEMA` before the first table it holds. */
|
|
56
|
+
export const eventStoreSchema = pgSchema(EVENT_STORE_SCHEMA);
|
|
57
|
+
|
|
48
58
|
const eventStore = eventStoreTables(EVENT_STORE_SCHEMA);
|
|
49
59
|
|
|
50
60
|
export const storedEventsHead = eventStore.head;
|
|
@@ -126,6 +126,7 @@ model StoredEvent {
|
|
|
126
126
|
data Json
|
|
127
127
|
metadata Json
|
|
128
128
|
occurredAt DateTime @map("occurred_at") @db.Timestamptz(3)
|
|
129
|
+
tenantId String? @map("tenant_id")
|
|
129
130
|
recordedAt DateTime @default(now()) @map("recorded_at") @db.Timestamptz(3)
|
|
130
131
|
|
|
131
132
|
@@unique([stream, version])
|
|
@@ -166,7 +167,7 @@ model SubjectKey {
|
|
|
166
167
|
{{/if}}
|
|
167
168
|
{{#if audit.on}}
|
|
168
169
|
|
|
169
|
-
//
|
|
170
|
+
// Prisma writes no trigger: `npm run db:generate <name>` adds the statements that make the audit trail append-only (UPDATE, DELETE and TRUNCATE refused) to the migration that creates it; `npm run db:audit-guard` prints them for a migration written by hand.
|
|
170
171
|
/// The audit trail of @ddd-ts-kit/audit: written by PrismaAuditTrail with raw statements, append-only once the guard is migrated.
|
|
171
172
|
model AuditEntry {
|
|
172
173
|
id String @unique
|
|
@@ -38,7 +38,7 @@ export const eventStore = eventStoreEntities({ schema: EVENT_STORE_SCHEMA });
|
|
|
38
38
|
/** The schema of the audit trail. */
|
|
39
39
|
export const AUDIT_SCHEMA = 'audit';
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// TypeORM writes no trigger: `npm run db:generate migrations/<name>` adds the statements that make the audit trail append-only (UPDATE, DELETE and TRUNCATE refused) to the migration that creates it; `npm run db:audit-guard` prints them for a migration written by hand.
|
|
42
42
|
export const auditTrail = auditEntities({ schema: AUDIT_SCHEMA });
|
|
43
43
|
|
|
44
44
|
{{/if}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{#if audit.on}}
|
|
2
2
|
import { auditedSubjectKeys, type AuditSource } from '@ddd-ts-kit/audit';
|
|
3
3
|
{{/if}}
|
|
4
|
-
import { PersonalDataCipher, type EventSourcingStores } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import { PersonalDataCipher, type EventSourcingStores{{#if tenancy.any}}, type ExecutionScope{{/if}} } from '@ddd-ts-kit/kernel';
|
|
5
5
|
{{#if audit.on}}
|
|
6
6
|
import type { Audit } from '{{alias.platform}}/audit/create-audit{{alias.ext}}';
|
|
7
7
|
{{/if}}
|
|
@@ -22,15 +22,27 @@ export interface EventSourcing extends EventSourcingStores {
|
|
|
22
22
|
|
|
23
23
|
{{#if audit.on}}
|
|
24
24
|
export function createEventSourcing(persistence: Persistence, audit: Audit, source: AuditSource): EventSourcing {
|
|
25
|
-
|
|
25
|
+
{{#if tenancy.any}}
|
|
26
|
+
const stores = persistence.eventSourcing(source.scope);
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#unless tenancy.any}}
|
|
29
|
+
const stores = persistence.eventSourcing;
|
|
30
|
+
{{/unless}}
|
|
31
|
+
const subjectKeys = auditedSubjectKeys(stores.subjectKeys, audit.trail, source);
|
|
26
32
|
|
|
27
|
-
return { ...
|
|
33
|
+
return { ...stores, subjectKeys, cipher: new PersonalDataCipher(subjectKeys) };
|
|
28
34
|
}
|
|
29
35
|
{{/if}}
|
|
30
36
|
{{#unless audit.on}}
|
|
31
|
-
export function createEventSourcing(persistence: Persistence): EventSourcing {
|
|
32
|
-
|
|
37
|
+
export function createEventSourcing(persistence: Persistence{{#if tenancy.any}}, scope: ExecutionScope{{/if}}): EventSourcing {
|
|
38
|
+
{{#if tenancy.any}}
|
|
39
|
+
const stores = persistence.eventSourcing(scope);
|
|
40
|
+
{{/if}}
|
|
41
|
+
{{#unless tenancy.any}}
|
|
42
|
+
const stores = persistence.eventSourcing;
|
|
43
|
+
{{/unless}}
|
|
44
|
+
const { subjectKeys } = stores;
|
|
33
45
|
|
|
34
|
-
return { ...
|
|
46
|
+
return { ...stores, cipher: new PersonalDataCipher(subjectKeys) };
|
|
35
47
|
}
|
|
36
48
|
{{/unless}}
|
|
@@ -48,7 +48,16 @@ export async function startHttpServer(served: Served, config: AppConfig): Promis
|
|
|
48
48
|
// Before the JSON parser, which would read first a JSON file sent through a signed link.
|
|
49
49
|
mountExpress(app, served.fileRoutes, served.boundary);
|
|
50
50
|
{{/if}}
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
// The bytes of a JSON body are kept for a controller that declares `rawBody` (a signed webhook).
|
|
53
|
+
app.use(
|
|
54
|
+
express.json({
|
|
55
|
+
verify: (request, _response, bytes) => {
|
|
56
|
+
Object.assign(request, { rawBody: bytes });
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
|
|
52
61
|
{{#unless rpc.none}}
|
|
53
62
|
serveProcedures(app, served);
|
|
54
63
|
{{/unless}}
|
|
@@ -73,10 +73,15 @@ export async function startHttpServer(served: Served, config: AppConfig): Promis
|
|
|
73
73
|
{{#if routes.nest}}
|
|
74
74
|
const app = await NestFactory.create(createAppModule(routes, served.boundary, served.controllers), {
|
|
75
75
|
logger: ['error', 'warn'],
|
|
76
|
+
// Keeps the bytes of the body for a controller that declares `rawBody` (a signed webhook).
|
|
77
|
+
rawBody: true,
|
|
76
78
|
});
|
|
77
79
|
{{/if}}
|
|
78
80
|
{{#unless routes.nest}}
|
|
79
|
-
const app = await NestFactory.create(createAppModule(routes, served.boundary), {
|
|
81
|
+
const app = await NestFactory.create(createAppModule(routes, served.boundary), {
|
|
82
|
+
logger: ['error', 'warn'],
|
|
83
|
+
rawBody: true,
|
|
84
|
+
});
|
|
80
85
|
{{/unless}}
|
|
81
86
|
|
|
82
87
|
{{#if cache.rateLimit}}
|
|
@@ -19,7 +19,7 @@ paths:
|
|
|
19
19
|
{{/if}}
|
|
20
20
|
{{#if routes.nest}}
|
|
21
21
|
- A route is a Nest controller the kit serves: `<use-case>.controller.ts` in `presentation/http/<resource>/<use-case>/`, `@Controller()` and `@KitRoutes({ group: <Resource>Routes })` on the class, `@Post`, `@Get`... of Nest on its method, which names the route (its `operationId`) after the method, and `@KitRoute({ request, response, errors })` of `@ddd-ts-kit/http/nest` for what Nest does not say. The method reads `@Param()`, `@Query()`, `@Headers()`, `@Body()` typed by the DTO classes beside it, and the caller with `@CurrentActor()`; it builds the command or the query and sends it through the bus the constructor injects (`@Inject(CommandBus)`), nothing else: the buses are the only providers the platform gives Nest for the controllers. Nest builds the controller (the module of the context lists it under `controllers`), the kit serves it: guards of the group, validation by `request`, problem documents, the contract.
|
|
22
|
-
- A method answers what its signature says: a DTO class (`Promise<<UseCase>Answer>`), `Accepted` or `void`, which `ddd-ts-kit` reads into the generated `<context>.controllers.ts` the module lists (`nest/controllers-current` keeps it current); any other
|
|
22
|
+
- A method takes and answers what its signature says: a part of the request taken whole by a DTO class (`@Body() body: <UseCase>Body`), an answer that is a DTO class (`Promise<<UseCase>Answer>`), `Accepted` or `void`, which `ddd-ts-kit` reads into the generated `<context>.controllers.ts` the module lists (`nest/controllers-current` keeps it current); any other type is given in `request` or `response` of `@KitRoute`. The raw request and answer of Nest (`@Req`, `@Res`, `@Header`), its guards, pipes, interceptors and filters are refused (`nest/no-parallel-pipeline`): the kit would not run them.
|
|
23
23
|
{{/if}}
|
|
24
24
|
{{#if routes.functions}}
|
|
25
25
|
- A route validates the shape of the input, builds a command or a query with the actor, executes it through `CommandBus` or `QueryBus` (never a handler class) and maps the answer. Nothing else.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@@imports
|
|
2
2
|
import { {{publisher.pascal}}Publisher } from '{{alias.context}}/application/integration/publishers/{{publisher.kebab}}.publisher{{alias.ext}}';
|
|
3
3
|
import { {{event.pascal}} } from '{{alias.context}}/domain/events/{{event.kebab}}.event{{alias.ext}}';
|
|
4
|
-
@@
|
|
4
|
+
@@reactions
|
|
5
5
|
const {{publisher.camel}}Publisher = platform.adapter(new {{publisher.pascal}}Publisher(platform.publisher, platform.ids), { kind: 'domain-event-handler', context: '{{context.kebab}}' });
|
|
6
6
|
|
|
7
7
|
platform.domainEvents.on({{event.reference}}, async (event) => {
|
|
@@ -11,7 +11,7 @@ import { {{upstream.definition}} as {{name.camel}}Definition } from '{{alias.con
|
|
|
11
11
|
import { idempotent, inEventScope } from '@ddd-ts-kit/kernel';
|
|
12
12
|
{{/if}}
|
|
13
13
|
import { {{name.pascal}}IntegrationHandler } from '{{alias.context}}/application/integration/handlers/{{name.kebab}}.integration-handler{{alias.ext}}';
|
|
14
|
-
@@
|
|
14
|
+
@@reactions
|
|
15
15
|
const {{name.camel}}IntegrationHandler = new {{name.pascal}}IntegrationHandler(platform.commands);
|
|
16
16
|
|
|
17
17
|
{{#if consumer.declarative}}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { {{search.nestImports}} } from '@nestjs/common';
|
|
2
|
+
import { {{search.kitImports}} } from '@ddd-ts-kit/http';
|
|
3
|
+
import { CurrentActor, KitRoute, KitRoutes } from '@ddd-ts-kit/http/nest';
|
|
4
|
+
import { QueryBus, type Actor } from '@ddd-ts-kit/kernel';
|
|
5
|
+
import type { Infer } from '@ddd-ts-kit/validation';
|
|
6
|
+
import { classSchema } from '@ddd-ts-kit/validation/class-validator';
|
|
7
|
+
{{route.imports}}
|
|
8
|
+
|
|
9
|
+
// TODO(domain): list here the fields of {{name.pascal}}Sort a client may sort by, and bound the size of a page.
|
|
10
|
+
const query = pageQuerySchema({ sortable: ['id'], maxSize: 100 });
|
|
11
|
+
const line = classSchema({{name.pascal}}Line);
|
|
12
|
+
|
|
13
|
+
/** Built by Nest with the bus it injects, served by the kit: a page is no DTO class, so @KitRoute gives its query and its answer. */
|
|
14
|
+
@Controller()
|
|
15
|
+
@KitRoutes({ {{route.nestShared}} })
|
|
16
|
+
export class {{name.pascal}}Controller {
|
|
17
|
+
constructor(@Inject(QueryBus) private readonly queries: QueryBus) {}
|
|
18
|
+
|
|
19
|
+
@{{route.nestMethod}}({{route.nestPath}})
|
|
20
|
+
@KitRoute({
|
|
21
|
+
request: { query },
|
|
22
|
+
response: { description: 'One page of the search.', body: pageSchemaOf(line) },
|
|
23
|
+
// 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`).
|
|
24
|
+
errors: [],
|
|
25
|
+
{{#if route.cached}}
|
|
26
|
+
cache: {{route.cache}},
|
|
27
|
+
{{/if}}
|
|
28
|
+
})
|
|
29
|
+
async {{name.camel}}(
|
|
30
|
+
@Query() criteria: Infer<typeof query>,
|
|
31
|
+
@CurrentActor() actor: Actor,
|
|
32
|
+
): Promise<PageBody<Infer<typeof line>>> {
|
|
33
|
+
// TODO(domain): hand the criteria of the query over too, once the query schema declares them next to the page; map each line to its public fields.
|
|
34
|
+
const page = await this.queries.execute(new {{route.input}}(actor, criteria));
|
|
35
|
+
|
|
36
|
+
return pageResponse(page, ({{search.element}}) => ({ id: {{search.element}}.id }));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -4,22 +4,9 @@ import { {{route.kitImports}} } from '@ddd-ts-kit/http';
|
|
|
4
4
|
{{/if}}
|
|
5
5
|
import { {{route.bridgeImports}} } from '@ddd-ts-kit/http/nest';
|
|
6
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
7
|
{{route.imports}}
|
|
11
8
|
|
|
12
|
-
|
|
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. */
|
|
9
|
+
/** Built by Nest with the bus it injects, served by the kit: what each method takes and answers is read from its signature. */
|
|
23
10
|
@Controller()
|
|
24
11
|
@KitRoutes({ {{route.nestShared}} })
|
|
25
12
|
export class {{name.pascal}}Controller {
|
|
@@ -30,9 +17,6 @@ export class {{name.pascal}}Controller {
|
|
|
30
17
|
@HttpCode({{route.nestHttpCode}})
|
|
31
18
|
{{/if}}
|
|
32
19
|
@KitRoute({
|
|
33
|
-
{{#if route.readsRequest}}
|
|
34
|
-
request: { {{route.nestRequest}} },
|
|
35
|
-
{{/if}}
|
|
36
20
|
// 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
21
|
errors: [],
|
|
38
22
|
{{#if route.cached}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { describe, expect, it } from '{{tests.module}}';
|
|
3
|
+
import { executeRoute } from '@ddd-ts-kit/http';
|
|
4
|
+
import { nestControllerRoute } from '@ddd-ts-kit/http/nest';
|
|
5
|
+
import { InMemoryCommandBus{{#if route.protected}}, type Actor{{/if}} } from '@ddd-ts-kit/kernel';
|
|
6
|
+
{{route.messageImport}}
|
|
7
|
+
{{route.specImports}}
|
|
8
|
+
|
|
9
|
+
{{#if route.protected}}
|
|
10
|
+
const caller: Actor = { id: 'user-1', type: 'user', roles: [], attributes: {} };
|
|
11
|
+
|
|
12
|
+
{{/if}}
|
|
13
|
+
describe('{{route.method}} {{route.path}}', () => {
|
|
14
|
+
it('declares the file it receives, and hands it to the command as it streams', async () => {
|
|
15
|
+
const received: string[] = [];
|
|
16
|
+
|
|
17
|
+
const commands = new InMemoryCommandBus().register({{route.input}}, {
|
|
18
|
+
execute: async ({ upload }) => {
|
|
19
|
+
received.push(upload.fileName);
|
|
20
|
+
|
|
21
|
+
return 'file-1';
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const route = nestControllerRoute({{name.pascal}}Controller, { instanceOf: () => new {{name.pascal}}Controller(commands) });
|
|
26
|
+
const file = { fileName: 'scan.pdf', mediaType: 'application/pdf', stream: Readable.from([Buffer.from('%PDF-')]) };
|
|
27
|
+
|
|
28
|
+
const response = await executeRoute(
|
|
29
|
+
route,
|
|
30
|
+
{ params: {{route.sampleParams}}, query: {}, headers: {}, body: {}, raw: undefined },
|
|
31
|
+
{
|
|
32
|
+
validateResponses: true,
|
|
33
|
+
uploads: async () => ({ fields: {}, file }),
|
|
34
|
+
{{#if route.protected}}
|
|
35
|
+
resolvePrincipal: () => caller,
|
|
36
|
+
{{/if}}
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(response.status).toBe(201);
|
|
41
|
+
expect(received).toEqual(['scan.pdf']);
|
|
42
|
+
expect(route.upload?.field).toBe('file');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// TODO(domain): replace each entry below by a test of the contract a client relies on.
|
|
46
|
+
it.todo('answers the documented status for each error code of the use case');
|
|
47
|
+
});
|