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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-stored-events-lock.js","sourceRoot":"","sources":["../../src/docs/write-stored-events-lock.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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KAC7G,CAAC,CACL,CAAC;AACJ,CAAC"}
|
package/dist/generate/kind.d.ts
CHANGED
|
@@ -79,6 +79,8 @@ export interface KindFlags {
|
|
|
79
79
|
readonly cache?: string;
|
|
80
80
|
/** An aggregate keeps its state as the stream of its events. */
|
|
81
81
|
readonly eventSourced: boolean;
|
|
82
|
+
/** The fact an event-sourced aggregate is born with, as `--birth <Fact>`; `Created` when absent. */
|
|
83
|
+
readonly birth?: string;
|
|
82
84
|
/** The module of the model of the context the files of its layers and their specs are written in. */
|
|
83
85
|
readonly module?: string;
|
|
84
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kind.d.ts","sourceRoot":"","sources":["../../src/generate/kind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,yFAAyF;IACzF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAA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,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,2GAA2G;IAC3G,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,8KAA8K;IAC9K,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,+GAA+G;IAC/G,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/aggregate-kind.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregate-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/aggregate-kind.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAOpC,eAAO,MAAM,aAAa,EAAE,IAqC3B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CliError } from '../../cli-error.js';
|
|
1
2
|
import { refreshContextDoc } from '../../docs/refresh-context-doc.js';
|
|
2
3
|
import { concept } from '../concept.js';
|
|
3
4
|
import { emit } from '../emit.js';
|
|
@@ -9,14 +10,17 @@ import { writeEventSourcedAggregate } from './write-event-sourced-aggregate.js';
|
|
|
9
10
|
export const aggregateKind = {
|
|
10
11
|
name: 'aggregate',
|
|
11
12
|
aliases: [],
|
|
12
|
-
usage: 'aggregate <context> <Name> [--event-sourced] [--term "<Term>=<meaning>"]...',
|
|
13
|
-
summary: 'An aggregate root with create and rehydrate factories, its test data builder and its spec; with --event-sourced, its state is the replay of its events, with its birth event and the codec of its stored events.',
|
|
13
|
+
usage: 'aggregate <context> <Name> [--event-sourced [--birth <Event>]] [--term "<Term>=<meaning>"]...',
|
|
14
|
+
summary: 'An aggregate root with create and rehydrate factories, its test data builder and its spec; with --event-sourced, its state is the replay of its events, with its birth event (Created, or the fact --birth names) and the codec of its stored events.',
|
|
14
15
|
positionals: ['context', 'Name'],
|
|
15
16
|
writesShared: false,
|
|
16
17
|
run: (request) => {
|
|
17
18
|
const scope = openScope(request);
|
|
18
19
|
learnTerms(scope);
|
|
19
20
|
const name = concept(scope, request.args[1] ?? '', { what: 'aggregate', strip: ['aggregate'] });
|
|
21
|
+
if (scope.flags.birth !== undefined && !scope.flags.eventSourced) {
|
|
22
|
+
throw new CliError('--birth names the birth event of an event-sourced aggregate.', 'Add --event-sourced, or drop --birth: a plain aggregate has no birth event.');
|
|
23
|
+
}
|
|
20
24
|
if (scope.flags.eventSourced) {
|
|
21
25
|
writeEventSourcedAggregate(scope, name);
|
|
22
26
|
refreshContextDoc(scope.ws, scope.config, scope.context.kebab);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/aggregate-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,U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CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAEhG,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACjE,MAAM,IAAI,QAAQ,CAChB,8DAA8D,EAC9D,6EAA6E,CAC9E,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YAC7B,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACxC,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAE/D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YACtE,CAAC,4BAA4B,EAAE,qBAAqB,IAAI,CAAC,KAAK,eAAe,CAAC;YAC9E,CAAC,wBAAwB,EAAE,iBAAiB,IAAI,CAAC,KAAK,aAAa,CAAC;YACpE,CAAC,iCAAiC,EAAE,aAAa,IAAI,CAAC,KAAK,oBAAoB,CAAC;SACjF,CAAC,CAAC;QAEH,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Scope } from '../scope.js';
|
|
2
|
+
/** An event-sourced aggregate is loaded and saved through the stores `init --event-sourcing on` wires: without them it could not run. */
|
|
3
|
+
export declare function assertEventStore(scope: Scope): void;
|
|
4
|
+
//# sourceMappingURL=assert-event-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-event-store.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/assert-event-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,yIAAyI;AACzI,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CASnD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CliError } from '../../cli-error.js';
|
|
2
|
+
import { CONFIG_FILE } from '../../config/index.js';
|
|
3
|
+
/** An event-sourced aggregate is loaded and saved through the stores `init --event-sourcing on` wires: without them it could not run. */
|
|
4
|
+
export function assertEventStore(scope) {
|
|
5
|
+
if (scope.config.stack.eventSourcing === 'on') {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
throw new CliError('This project has no event store (stack.eventSourcing is "off").', `Run \`ddd-ts-kit init --force --event-sourcing on\` to wire the event store in ${CONFIG_FILE} and src/platform/event-sourcing/ (the tables of the event_store schema, the stores, the keys of the data subjects and the cipher), then generate the aggregate again.`);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=assert-event-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-event-store.js","sourceRoot":"","sources":["../../../src/generate/kinds/assert-event-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,yIAAyI;AACzI,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,iEAAiE,EACjE,kFAAkF,WAAW,wKAAwK,CACtQ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Scope } from '../../scope.js';
|
|
2
|
+
import type { ControllerPlan } from '../route/controller-plan.js';
|
|
3
|
+
/**
|
|
4
|
+
* Writes the Nest controller of an upload in its folder, its group when it is new, and its spec:
|
|
5
|
+
* `@Upload()` hands its method the file the kit streams, and the generated list of the context
|
|
6
|
+
* names it for Nest to build.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeNestUploadController(scope: Scope, plan: ControllerPlan): void;
|
|
9
|
+
//# sourceMappingURL=write-nest-upload-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-nest-upload-controller.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/file-upload/write-nest-upload-controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CA8BlF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { emit } from '../../emit.js';
|
|
2
|
+
import { named } from '../../named.js';
|
|
3
|
+
import { vars } from '../../vars.js';
|
|
4
|
+
import { controllerImports } from '../route/controller-imports.js';
|
|
5
|
+
import { groupVars } from '../route/group-vars.js';
|
|
6
|
+
import { nestControllerVars } from '../route/nest-controller-vars.js';
|
|
7
|
+
/**
|
|
8
|
+
* Writes the Nest controller of an upload in its folder, its group when it is new, and its spec:
|
|
9
|
+
* `@Upload()` hands its method the file the kit streams, and the generated list of the context
|
|
10
|
+
* names it for Nest to build.
|
|
11
|
+
*/
|
|
12
|
+
export function writeNestUploadController(scope, plan) {
|
|
13
|
+
const { name, group, folder } = plan;
|
|
14
|
+
const route = nestControllerVars(scope, { ...plan, withMapper: false, withSerializer: false });
|
|
15
|
+
// The file is the request: no class of params, body or answer stands next to the controller.
|
|
16
|
+
const { message, group: groupImport } = controllerImports(scope, plan);
|
|
17
|
+
const context = vars(scope, {
|
|
18
|
+
name: named(name),
|
|
19
|
+
route: { ...route, imports: [message, ...groupImport].join('\n') },
|
|
20
|
+
upload: uploadVars(plan),
|
|
21
|
+
...(group === undefined
|
|
22
|
+
? {}
|
|
23
|
+
: {
|
|
24
|
+
group: groupVars({
|
|
25
|
+
name: group.name,
|
|
26
|
+
prefix: group.prefix,
|
|
27
|
+
tag: scope.context.kebab,
|
|
28
|
+
access: 'authenticated',
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
const outputs = [
|
|
33
|
+
...(group === undefined || group.exists ? [] : [['controller/group.ts.tpl', `${group.file}.ts`]]),
|
|
34
|
+
['nest-controller/upload.ts.tpl', `${folder}/${name.kebab}.controller.ts`],
|
|
35
|
+
['nest-controller/upload.spec.ts.tpl', `test/unit/${name.kebab}.controller.spec.ts`],
|
|
36
|
+
];
|
|
37
|
+
emit(scope, context, outputs);
|
|
38
|
+
}
|
|
39
|
+
/** The imports of the controller, and the parameters of its method: the file, and the caller of a protected use case. */
|
|
40
|
+
function uploadVars({ group, useCase }) {
|
|
41
|
+
return {
|
|
42
|
+
kitImports: [...(group === undefined ? ['Public'] : []), 'type IncomingFile'].join(', '),
|
|
43
|
+
bridgeImports: [...(useCase.isProtected ? ['CurrentActor'] : []), 'KitRoute', 'KitRoutes', 'Upload'].join(', '),
|
|
44
|
+
kernelImports: useCase.isProtected ? 'CommandBus, type Actor' : 'CommandBus',
|
|
45
|
+
parameters: ['@Upload() file: IncomingFile', ...(useCase.isProtected ? ['@CurrentActor() actor: Actor'] : [])].join(', '),
|
|
46
|
+
arguments: useCase.isProtected ? 'actor, file' : 'file',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=write-nest-upload-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-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,IAAI,CACL;QACD,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/file-upload-kind.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"file-upload-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/file-upload-kind.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAcpC,eAAO,MAAM,cAAc,EAAE,IA4C5B,CAAC"}
|
|
@@ -9,6 +9,7 @@ import { openScope } from '../open-scope.js';
|
|
|
9
9
|
import { specVars } from '../spec-vars.js';
|
|
10
10
|
import { vars } from '../vars.js';
|
|
11
11
|
import { wire } from '../wire.js';
|
|
12
|
+
import { writeNestUploadController } from './file-upload/write-nest-upload-controller.js';
|
|
12
13
|
import { writeUploadController } from './file-upload/write-upload-controller.js';
|
|
13
14
|
import { findUseCase } from './route/find-use-case.js';
|
|
14
15
|
import { parseEndpoint } from './route/parse-endpoint.js';
|
|
@@ -17,7 +18,7 @@ export const fileUploadKind = {
|
|
|
17
18
|
name: 'file-upload',
|
|
18
19
|
aliases: [],
|
|
19
20
|
usage: 'file-upload <context> <UseCaseName> --path <path> (--permission <aggregate>.<action> [--grant <role>] | --public) [--method <POST|PUT>] [--group <Name>]',
|
|
20
|
-
summary: 'An upload: a controller that declares the file it receives (size and media types in the contract, checked as it streams), the command that carries it as a FileUpload (staged by the command bus before the transaction), the handler that records it and promotes it with the commit, and their specs. Needs "stack.storage".',
|
|
21
|
+
summary: 'An upload: a controller that declares the file it receives (`@Upload()` of a Nest controller; size and media types in the contract, checked as it streams), the command that carries it as a FileUpload (staged by the command bus before the transaction), the handler that records it and promotes it with the commit, and their specs. Needs "stack.storage".',
|
|
21
22
|
positionals: ['context', 'UseCaseName'],
|
|
22
23
|
writesShared: true,
|
|
23
24
|
run: (request) => {
|
|
@@ -40,7 +41,13 @@ export const fileUploadKind = {
|
|
|
40
41
|
const flags = { ...request.flags, method: request.flags.method ?? 'POST', command: true, query: false };
|
|
41
42
|
const endpoint = parseEndpoint(flags);
|
|
42
43
|
const useCase = findUseCase(scope, name, flags);
|
|
43
|
-
|
|
44
|
+
const plan = planController(scope, { name, endpoint, useCase });
|
|
45
|
+
if (scope.config.stack.routes === 'nest') {
|
|
46
|
+
writeNestUploadController(scope, plan);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
writeUploadController(scope, plan);
|
|
50
|
+
}
|
|
44
51
|
},
|
|
45
52
|
};
|
|
46
53
|
function assertFileStack(scope) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/file-upload-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAA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ceRoot":"","sources":["../../../src/generate/kinds/form-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAMpC,eAAO,MAAM,QAAQ,EAAE,IA2CtB,CAAC"}
|
|
@@ -4,35 +4,39 @@ import { label } from '../label.js';
|
|
|
4
4
|
import { openScope } from '../open-scope.js';
|
|
5
5
|
import { controllerOf } from './presentation/controller-of.js';
|
|
6
6
|
import { controllerSource } from './presentation/controller-source.js';
|
|
7
|
-
const HINTS = `/** How the body of the route is entered, served as a form at GET /forms/<operationId> for the caller who asks. */
|
|
8
|
-
const form = defineForm<Infer<typeof body>>({
|
|
9
|
-
// TODO(domain): name the permission of the use case as its @Requires does (requires: { permission, subject, context }), so that only who may run it reads the form.
|
|
10
|
-
// TODO(domain): group the fields (groups), and say per field what the schema cannot: its widget, the GET route its options come from (lookup), when it shows (visibleWhen) and when it is required (requiredWhen).
|
|
11
|
-
});
|
|
12
|
-
`;
|
|
13
7
|
export const formKind = {
|
|
14
8
|
name: 'form',
|
|
15
9
|
aliases: [],
|
|
16
10
|
usage: 'form <context> <UseCase>',
|
|
17
|
-
summary: 'The form of a controller that receives a body: `defineForm` hints next to its schemas, named in `@Controller` as `form`, served at GET /forms/<operationId> when "stack.forms" is "on". Fields, constraints and options come from the body schema, read-only and hidden fields from its field access.',
|
|
11
|
+
summary: 'The form of a controller that receives a body: `defineForm` hints next to its schemas, named in `@Controller` (`@KitRoute` of a Nest controller) as `form`, served at GET /forms/<operationId> when "stack.forms" is "on". Fields, constraints and options come from the body schema, read-only and hidden fields from its field access.',
|
|
18
12
|
positionals: ['context', 'UseCase'],
|
|
19
13
|
writesShared: false,
|
|
20
14
|
run: (request) => {
|
|
21
15
|
const scope = openScope(request);
|
|
22
16
|
const useCase = label(scope, request.args[1] ?? '', { what: 'use case', strip: ['controller'] });
|
|
23
17
|
const { file, source } = controllerOf(scope, useCase);
|
|
24
|
-
|
|
18
|
+
const nestBody = controllerSource.nestBody(source);
|
|
19
|
+
if (nestBody === undefined && !/^\s*body[,:]/m.test(source)) {
|
|
25
20
|
throw new CliError(`${useCase.pascal}Controller receives no body.`, 'A form describes the body of a route: give the controller a body schema first.');
|
|
26
21
|
}
|
|
27
22
|
if (/\bconst form = defineForm\b/.test(source)) {
|
|
28
23
|
throw new CliError(`${useCase.pascal}Controller already declares its form.`, 'Edit its hints in the controller.');
|
|
29
24
|
}
|
|
30
|
-
const hinted = controllerSource.withOption(controllerSource.beforeController(source,
|
|
31
|
-
const
|
|
32
|
-
scope.ws.update(file,
|
|
25
|
+
const hinted = controllerSource.withOption(controllerSource.beforeController(source, hints(nestBody ?? 'Infer<typeof body>')), 'form,');
|
|
26
|
+
const withForm = controllerSource.withImport(hinted, 'defineForm', '@ddd-ts-kit/http');
|
|
27
|
+
scope.ws.update(file, nestBody === undefined ? controllerSource.withImport(withForm, 'type Infer', '@ddd-ts-kit/validation') : withForm);
|
|
33
28
|
if (scope.config.stack.forms !== 'on') {
|
|
34
29
|
scope.ws.note(`The form is served once "stack.forms" is "on" in ${CONFIG_FILE}: run \`ddd-ts-kit init --force --forms on\`.`);
|
|
35
30
|
}
|
|
36
31
|
},
|
|
37
32
|
};
|
|
33
|
+
/** The hints of the form, typed by the shape of the body: `Infer<typeof body>` of a schema, or the DTO class a Nest controller takes. */
|
|
34
|
+
function hints(shape) {
|
|
35
|
+
return `/** How the body of the route is entered, served as a form at GET /forms/<operationId> for the caller who asks. */
|
|
36
|
+
const form = defineForm<${shape}>({
|
|
37
|
+
// TODO(domain): name the permission of the use case as its @Requires does (requires: { permission, subject, context }), so that only who may run it reads the form.
|
|
38
|
+
// TODO(domain): group the fields (groups), and say per field what the schema cannot: its widget, the GET route its options come from (lookup), when it shows (visibleWhen) and when it is required (requiredWhen).
|
|
39
|
+
});
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
38
42
|
//# sourceMappingURL=form-kind.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/form-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,
|
|
1
|
+
{"version":3,"file":"form-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/form-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,MAAM,QAAQ,GAAS;IAC5B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,0BAA0B;IACjC,OAAO,EACL,0UAA0U;IAC5U,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IACnC,YAAY,EAAE,KAAK;IACnB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,YA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a;IAC1B,OAAO;0BACiB,KAAK;;;;CAI9B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Name } from '../../naming/index.js';
|
|
2
|
+
import type { RenderContext } from '../../templating/index.js';
|
|
3
|
+
import type { Scope } from '../scope.js';
|
|
4
|
+
/**
|
|
5
|
+
* The repository of an event-sourced aggregate: the port, an adapter that delegates to
|
|
6
|
+
* `EventSourcedRepository` of the kernel over the `EventStore` and the cipher the platform binds
|
|
7
|
+
* with the codec of the stored events, the fake that is that adapter over the in-memory stores,
|
|
8
|
+
* and the contract suite run on both. No table and no row mapper: the events are the storage.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateEventSourcedRepository(scope: Scope, aggregate: Name): RenderContext;
|
|
11
|
+
//# sourceMappingURL=generate-event-sourced-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-event-sourced-repository.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/generate-event-sourced-repository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKtC;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,aAAa,CA2B3F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CliError } from '../../cli-error.js';
|
|
2
|
+
import { emit } from '../emit.js';
|
|
3
|
+
import { named } from '../named.js';
|
|
4
|
+
import { vars } from '../vars.js';
|
|
5
|
+
import { wire } from '../wire.js';
|
|
6
|
+
import { assertEventStore } from './assert-event-store.js';
|
|
7
|
+
/**
|
|
8
|
+
* The repository of an event-sourced aggregate: the port, an adapter that delegates to
|
|
9
|
+
* `EventSourcedRepository` of the kernel over the `EventStore` and the cipher the platform binds
|
|
10
|
+
* with the codec of the stored events, the fake that is that adapter over the in-memory stores,
|
|
11
|
+
* and the contract suite run on both. No table and no row mapper: the events are the storage.
|
|
12
|
+
*/
|
|
13
|
+
export function generateEventSourcedRepository(scope, aggregate) {
|
|
14
|
+
assertEventStore(scope);
|
|
15
|
+
assertCodec(scope, aggregate);
|
|
16
|
+
assertNoColumns(scope);
|
|
17
|
+
const context = vars(scope, { aggregate: named(aggregate) });
|
|
18
|
+
emit(scope, context, [
|
|
19
|
+
['repository/repository.ts.tpl', `domain/repositories/${aggregate.kebab}.repository.ts`],
|
|
20
|
+
[
|
|
21
|
+
'repository/event-sourced/repository.ts.tpl',
|
|
22
|
+
`infrastructure/persistence/event-store-${aggregate.kebab}.repository.ts`,
|
|
23
|
+
],
|
|
24
|
+
['repository/event-sourced/fake.ts.tpl', `test/fakes/${aggregate.kebab}.repository.fake.ts`],
|
|
25
|
+
[
|
|
26
|
+
'repository/event-sourced/contract.spec.ts.tpl',
|
|
27
|
+
`test/integration/${aggregate.kebab}.repository.contract.spec.ts`,
|
|
28
|
+
],
|
|
29
|
+
]);
|
|
30
|
+
wire(scope, 'repository/event-sourced', context);
|
|
31
|
+
scope.ws.note(`${aggregate.pascal} is event-sourced: EventStore${aggregate.pascal}Repository delegates to EventSourcedRepository over the EventStore the platform binds, with the codec of infrastructure/persistence/${aggregate.kebab}-events.mapper.ts; there is no table. Fake${aggregate.pascal}Repository is that adapter over the in-memory event store, and the repository contract (test/integration) runs on both once its \`mutate\` records an event. The event store keeps no tenant: a stream is \`${scope.context.kebab}.${aggregate.kebab}-<id>\`, so decide who may load an id in the application layer.`);
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
function assertCodec(scope, aggregate) {
|
|
35
|
+
const codec = `${scope.dir}/infrastructure/persistence/${aggregate.kebab}-events.mapper.ts`;
|
|
36
|
+
if (scope.ws.exists(codec)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
throw new CliError(`${aggregate.pascal} is event-sourced but the codec of its stored events is missing (${codec}).`, `Write it (it exports \`${aggregate.camel}Events\`, a StoredEventTypes with one defineStoredEvent per event, as \`ddd-ts-kit generate aggregate ${scope.context.kebab} ${aggregate.pascal} --event-sourced\` writes it), then generate the repository again.`);
|
|
40
|
+
}
|
|
41
|
+
/** The columns of a table are rows: an event-sourced aggregate has none, its personal values are sealed in its events. */
|
|
42
|
+
function assertNoColumns(scope) {
|
|
43
|
+
if (scope.flags.personal === undefined) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
throw new CliError('--personal declares columns of a table, and an event-sourced aggregate has none.', 'Write the personal values of its events with `personalData(subjectId, value)` in the codec of its stored events (docs/concepts/event-sourcing.md of ddd-ts-kit, "Personal data").');
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=generate-event-sourced-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-event-sourced-repository.js","sourceRoot":"","sources":["../../../src/generate/kinds/generate-event-sourced-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAY,EAAE,SAAe;IAC1E,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxB,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC9B,eAAe,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EA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S,EAAE,CAAC;QACvC,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,kFAAkF,EAClF,mLAAmL,CACpL,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-repository.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/generate-repository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-repository.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/generate-repository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAUtC,4HAA4H;AAC5H,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,aAAa,CA6B/E"}
|
|
@@ -2,12 +2,17 @@ import { emit } from '../emit.js';
|
|
|
2
2
|
import { named } from '../named.js';
|
|
3
3
|
import { vars } from '../vars.js';
|
|
4
4
|
import { wire } from '../wire.js';
|
|
5
|
+
import { generateEventSourcedRepository } from './generate-event-sourced-repository.js';
|
|
6
|
+
import { isEventSourced } from './is-event-sourced.js';
|
|
5
7
|
import { declareStorage } from './declare-storage.js';
|
|
6
8
|
import { personalVars } from './personal-data/personal-vars.js';
|
|
7
9
|
import { REPOSITORY_ADAPTERS } from './repository-adapter.js';
|
|
8
10
|
import { repositoryPrefix } from './repository-prefix.js';
|
|
9
11
|
/** The port of the repository of an aggregate, the adapter of the ORM of the stack, the fake and the contract both pass. */
|
|
10
12
|
export function generateRepository(scope, aggregate) {
|
|
13
|
+
if (isEventSourced(scope, aggregate)) {
|
|
14
|
+
return generateEventSourcedRepository(scope, aggregate);
|
|
15
|
+
}
|
|
11
16
|
const adapter = REPOSITORY_ADAPTERS[scope.config.stack.orm];
|
|
12
17
|
const context = vars(scope, {
|
|
13
18
|
aggregate: named(aggregate),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-repository.js","sourceRoot":"","sources":["../../../src/generate/kinds/generate-repository.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,4HAA4H;AAC5H,MAAM,UAAU,kBAAkB,CAAC,KAAY,EAAE,SAAe;IAC9D,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;QAC3B,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACjD,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC;QACzB,QAAQ,EAAE,YAAY,CAAC,KAAK,CAAC;KAC9B,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;QACnB,CAAC,8BAA8B,EAAE,uBAA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/**
|
|
4
|
+
* Whether the aggregate keeps its state as the stream of its events: its class extends
|
|
5
|
+
* `EventSourcedAggregate`. The source is the signal the generators already read; the codec file
|
|
6
|
+
* can be missing in a project that is being written, the class cannot.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isEventSourced(scope: Scope, aggregate: Name): boolean;
|
|
9
|
+
//# sourceMappingURL=is-event-sourced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-event-sourced.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/is-event-sourced.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,OAAO,CAIrE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const EVENT_SOURCED = /\bextends\s+EventSourcedAggregate\b/;
|
|
2
|
+
/**
|
|
3
|
+
* Whether the aggregate keeps its state as the stream of its events: its class extends
|
|
4
|
+
* `EventSourcedAggregate`. The source is the signal the generators already read; the codec file
|
|
5
|
+
* can be missing in a project that is being written, the class cannot.
|
|
6
|
+
*/
|
|
7
|
+
export function isEventSourced(scope, aggregate) {
|
|
8
|
+
const source = scope.ws.read(`${scope.dir}/domain/aggregates/${aggregate.kebab}.aggregate.ts`);
|
|
9
|
+
return source !== undefined && EVENT_SOURCED.test(source);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=is-event-sourced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-event-sourced.js","sourceRoot":"","sources":["../../../src/generate/kinds/is-event-sourced.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,SAAe;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,sBAAsB,SAAS,CAAC,KAAK,eAAe,CAAC,CAAC;IAE/F,OAAO,MAAM,KAAK,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Edits of the source of a controller written by the generator, which keep its shape: one more
|
|
3
|
-
* name in an import, one more option of `@Controller
|
|
3
|
+
* name in an import, one more option of `@Controller` (of `@KitRoute` of its method, for a Nest
|
|
4
|
+
* controller), a declaration before the class.
|
|
4
5
|
*/
|
|
5
6
|
export declare const controllerSource: {
|
|
6
7
|
/** Adds `name` (`type Name` for a type) to the import of `module`, or a new import line after the last one. */
|
|
7
8
|
withImport(source: string, name: string, module: string): string;
|
|
8
|
-
/**
|
|
9
|
+
/** Whether it is a Nest controller the kit serves: its options are those of `@KitRoute` of its method. */
|
|
10
|
+
isNest(source: string): boolean;
|
|
11
|
+
/** The DTO class of the body a Nest controller takes whole (`@Body() body: IssueInvoiceBody`), if it takes one. */
|
|
12
|
+
nestBody(source: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation; to a
|
|
15
|
+
* Nest controller, at the top of `@KitRoute({ ... })` of its method.
|
|
16
|
+
*/
|
|
9
17
|
withOption(source: string, line: string): string;
|
|
10
|
-
/** Puts a declaration right before the decorator of the class. */
|
|
18
|
+
/** Puts a declaration right before the decorator of the class, and before the comment that documents the class. */
|
|
11
19
|
beforeController(source: string, declaration: string): string;
|
|
12
20
|
};
|
|
13
21
|
//# sourceMappingURL=controller-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-source.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller-source.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IAC3B,+GAA+G;IAC/G,UAAU,SAAS,MAAM,QAAQ,MAAM,UAAU,MAAM,GAAG,MAAM;IAoChE,0GAA0G;IAC1G,MAAM,SAAS,MAAM,GAAG,OAAO;IAI/B,mHAAmH;IACnH,QAAQ,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS;IAI5C;;;OAGG;IACH,UAAU,SAAS,MAAM,QAAQ,MAAM,GAAG,MAAM;IAoBhD,mHAAmH;IACnH,gBAAgB,SAAS,MAAM,eAAe,MAAM,GAAG,MAAM;CAO9D,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
const NEST_ROUTE = /^([ \t]*)@KitRoute\(\{[ \t]*$/m;
|
|
2
|
+
const NEST_BODY = /@Body\(\)\s+(?:readonly\s+)?[\w$]+\s*:\s*([\w$]+)/;
|
|
1
3
|
/**
|
|
2
4
|
* Edits of the source of a controller written by the generator, which keep its shape: one more
|
|
3
|
-
* name in an import, one more option of `@Controller
|
|
5
|
+
* name in an import, one more option of `@Controller` (of `@KitRoute` of its method, for a Nest
|
|
6
|
+
* controller), a declaration before the class.
|
|
4
7
|
*/
|
|
5
8
|
export const controllerSource = {
|
|
6
9
|
/** Adds `name` (`type Name` for a type) to the import of `module`, or a new import line after the last one. */
|
|
@@ -26,8 +29,24 @@ export const controllerSource = {
|
|
|
26
29
|
const types = added.filter((part) => part.startsWith('type ')).sort();
|
|
27
30
|
return source.replace(written[0], `import ${typeOnly ? 'type ' : ''}{ ${[...values, ...types].join(', ')} } from '${module}';`);
|
|
28
31
|
},
|
|
29
|
-
/**
|
|
32
|
+
/** Whether it is a Nest controller the kit serves: its options are those of `@KitRoute` of its method. */
|
|
33
|
+
isNest(source) {
|
|
34
|
+
return source.includes("from '@ddd-ts-kit/http/nest'");
|
|
35
|
+
},
|
|
36
|
+
/** The DTO class of the body a Nest controller takes whole (`@Body() body: IssueInvoiceBody`), if it takes one. */
|
|
37
|
+
nestBody(source) {
|
|
38
|
+
return NEST_BODY.exec(source)?.[1];
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Adds an option line to `@Controller({ ... })`, after its `summary`, with its indentation; to a
|
|
42
|
+
* Nest controller, at the top of `@KitRoute({ ... })` of its method.
|
|
43
|
+
*/
|
|
30
44
|
withOption(source, line) {
|
|
45
|
+
const route = NEST_ROUTE.exec(source);
|
|
46
|
+
if (route !== null) {
|
|
47
|
+
const end = route.index + route[0].length;
|
|
48
|
+
return `${source.slice(0, end)}\n${route[1] ?? ''} ${line}${source.slice(end)}`;
|
|
49
|
+
}
|
|
31
50
|
const summary = /^(\s*)summary:.*$/m.exec(source);
|
|
32
51
|
if (summary === null) {
|
|
33
52
|
return source;
|
|
@@ -35,9 +54,11 @@ export const controllerSource = {
|
|
|
35
54
|
const end = summary.index + summary[0].length;
|
|
36
55
|
return `${source.slice(0, end)}\n${summary[1] ?? ''}${line}${source.slice(end)}`;
|
|
37
56
|
},
|
|
38
|
-
/** Puts a declaration right before the decorator of the class. */
|
|
57
|
+
/** Puts a declaration right before the decorator of the class, and before the comment that documents the class. */
|
|
39
58
|
beforeController(source, declaration) {
|
|
40
|
-
const
|
|
59
|
+
const decorator = source.indexOf('@Controller(');
|
|
60
|
+
const documented = /\/\*\*(?:(?!\*\/)[\s\S])*\*\/\s*$/.exec(source.slice(0, decorator));
|
|
61
|
+
const at = documented === null ? decorator : documented.index;
|
|
41
62
|
return `${source.slice(0, at)}${declaration}\n${source.slice(at)}`;
|
|
42
63
|
},
|
|
43
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-source.js","sourceRoot":"","sources":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"controller-source.js","sourceRoot":"","sources":["../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UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QAE9D,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACrE,CAAC;CACF,CAAC"}
|
|
@@ -6,7 +6,7 @@ export const repositoryKind = {
|
|
|
6
6
|
name: 'repository',
|
|
7
7
|
aliases: [],
|
|
8
8
|
usage: 'repository <context> <Aggregate> [--tenant-scoped] [--personal <column>,<column>... [--subject <column>] [--erasure pseudonymise|row] [--retention <column>:<n><d|m|y>]]',
|
|
9
|
-
summary: "A repository port (an abstract class of the domain), its in-memory fake, the adapter of the project's ORM with its mapper, the contract suite both pass, and its registration; with --personal, the declaration of the personal columns of its table, and the erasure and the export of the context that read it, and with --retention how long the rows keep it before the nightly purge erases them.",
|
|
9
|
+
summary: "A repository port (an abstract class of the domain), its in-memory fake, the adapter of the project's ORM with its mapper, the contract suite both pass, and its registration; on an event-sourced aggregate, the adapter over EventSourcedRepository with the codec of its stored events, no table; with --personal, the declaration of the personal columns of its table, and the erasure and the export of the context that read it, and with --retention how long the rows keep it before the nightly purge erases them.",
|
|
10
10
|
positionals: ['context', 'Aggregate'],
|
|
11
11
|
writesShared: true,
|
|
12
12
|
run: (request) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/repository-kind.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,EAAE;IACX,KAAK,EACH,0KAA0K;IAC5K,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"repository-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/repository-kind.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,EAAE;IACX,KAAK,EACH,0KAA0K;IAC5K,OAAO,EACL,8fAA8f;IAChgB,WAAW,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;IACrC,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAEjC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAErD,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representation-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAUpC,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"representation-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAUpC,eAAO,MAAM,kBAAkB,EAAE,IAmChC,CAAC"}
|