ddd-ts-kit 0.91.0 → 0.93.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 +225 -0
- package/README.fr.md +27 -18
- package/README.md +24 -15
- package/dist/acceptance/check-locked-files.d.ts +25 -0
- package/dist/acceptance/check-locked-files.d.ts.map +1 -0
- package/dist/acceptance/check-locked-files.js +84 -0
- package/dist/acceptance/check-locked-files.js.map +1 -0
- 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/acceptance/scenarios-in.d.ts +4 -0
- package/dist/acceptance/scenarios-in.d.ts.map +1 -1
- package/dist/acceptance/scenarios-in.js +2 -2
- package/dist/acceptance/scenarios-in.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/acceptance.d.ts.map +1 -1
- package/dist/commands/acceptance.js +14 -0
- package/dist/commands/acceptance.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 +4 -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/commit/run-git.d.ts +5 -1
- package/dist/commit/run-git.d.ts.map +1 -1
- package/dist/commit/run-git.js +19 -2
- package/dist/commit/run-git.js.map +1 -1
- 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/controllers/finish-migration.js +4 -2
- package/dist/controllers/finish-migration.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/behaviour-page.d.ts.map +1 -1
- package/dist/docs/behaviour-page.js +9 -1
- package/dist/docs/behaviour-page.js.map +1 -1
- 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 +4 -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/job/job-vars.d.ts +4 -1
- package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
- package/dist/generate/kinds/job/job-vars.js +11 -1
- package/dist/generate/kinds/job/job-vars.js.map +1 -1
- package/dist/generate/kinds/job-kind.js +20 -3
- package/dist/generate/kinds/job-kind.js.map +1 -1
- 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/service-kind.d.ts.map +1 -1
- package/dist/generate/kinds/service-kind.js +30 -3
- package/dist/generate/kinds/service-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/inert-persistence-file.d.ts +5 -0
- package/dist/init/files/inert-persistence-file.d.ts.map +1 -0
- package/dist/init/files/inert-persistence-file.js +16 -0
- package/dist/init/files/inert-persistence-file.js.map +1 -0
- package/dist/init/files/platform-files.js +7 -1
- 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/measures/branch-commits.d.ts +4 -2
- package/dist/measures/branch-commits.d.ts.map +1 -1
- package/dist/measures/branch-commits.js +32 -8
- package/dist/measures/branch-commits.js.map +1 -1
- package/dist/measures/timeline-of.d.ts +3 -2
- package/dist/measures/timeline-of.d.ts.map +1 -1
- package/dist/measures/timeline-of.js +37 -8
- package/dist/measures/timeline-of.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 +5 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -1
- package/dist/platform-layout/platform-layout.js +5 -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/no-flags.d.ts.map +1 -1
- package/dist/presets/no-flags.js +1 -0
- package/dist/presets/no-flags.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/progress/build-next-of.d.ts +9 -0
- package/dist/progress/build-next-of.d.ts.map +1 -0
- package/dist/progress/build-next-of.js +22 -0
- package/dist/progress/build-next-of.js.map +1 -0
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +3 -0
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +3 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/read-progress.d.ts.map +1 -1
- package/dist/progress/read-progress.js +7 -2
- package/dist/progress/read-progress.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/architecture/extractable.declared.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.manual.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +2 -2
- package/templates/architecture/hosting.declared.spec.ts.tpl +69 -0
- package/templates/architecture/hosting.manual.spec.ts.tpl +57 -0
- package/templates/architecture/hosting.tsyringe.spec.ts.tpl +69 -0
- 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 +9 -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/gitignore.tpl +3 -0
- package/templates/init/main.ts.tpl +27 -20
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +11 -3
- 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 +30 -6
- package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +47 -65
- package/templates/init/platform/composition/context-selection.tsyringe.ts.tpl +17 -0
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +16 -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-options.manual.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/composition/routes-of.tsyringe.ts.tpl +51 -0
- package/templates/init/platform/config/app-config.ts.tpl +9 -2
- package/templates/init/platform/config/load-config.ts.tpl +27 -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/files/files.module.tsyringe.ts.tpl +6 -2
- 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/platform/jobs/job-settings.ts.tpl +13 -3
- package/templates/init/platform/privacy/privacy.module.tsyringe.ts.tpl +9 -6
- package/templates/init/platform/redis/open-redis.ts.tpl +13 -8
- 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/job.declared.ts.tpl +1 -1
- package/templates/job/job.spec.buses.ts.tpl +3 -0
- package/templates/job/job.spec.tsyringe.ts.tpl +29 -1
- package/templates/job/wiring.manual.tpl +4 -1
- package/templates/job/wiring.tsyringe.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 +9 -2
- package/templates/pipeline/eslint.config.mjs.tpl +6 -0
- package/templates/pipeline/knip.json.tpl +1 -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/service/compose.tpl +1 -1
- package/templates/service/extracted-name.tpl +2 -0
- package/templates/service/extracted.declared.tpl +6 -0
- package/templates/service/extracted.manual.tpl +2 -0
- package/templates/service/extracted.tsyringe.tpl +6 -0
- package/templates/service/main.ts.tpl +5 -1
- package/templates/worker/main.ts.tpl +20 -13
- /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
|
@@ -17,8 +17,8 @@ import { platformPath } from '../platform-path.js';
|
|
|
17
17
|
export const jobKind = {
|
|
18
18
|
name: 'job',
|
|
19
19
|
aliases: [],
|
|
20
|
-
usage: 'job <context> <Name> (--every <duration> | --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--term "<Term>=<meaning>"]...',
|
|
21
|
-
summary: 'A job run by time that sends one command as its own system actor, its spec, its registration, its switch in the job settings of the platform and, where the authorization model makes it one line, the grant of that actor.',
|
|
20
|
+
usage: 'job <context> <Name> (--every <duration> | --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--global] [--term "<Term>=<meaning>"]...',
|
|
21
|
+
summary: 'A job run by time (once per tenant under tenancy, or `--global`) that sends one command as its own system actor, its spec, its registration, its switch in the job settings of the platform and, where the authorization model makes it one line, the grant of that actor.',
|
|
22
22
|
positionals: ['context', 'Name'],
|
|
23
23
|
writesShared: true,
|
|
24
24
|
textFlags: ['command'],
|
|
@@ -31,11 +31,28 @@ export const jobKind = {
|
|
|
31
31
|
const context = vars(scope, {
|
|
32
32
|
name: named(name),
|
|
33
33
|
spec: specVars(scope, { protected: false }),
|
|
34
|
-
job: jobVars(scope, { name, schedule, command }),
|
|
34
|
+
job: jobVars(scope, { name, schedule, command, tenancy: tenancyOf(scope, name) }),
|
|
35
35
|
});
|
|
36
36
|
writeJob(scope, name, context);
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Under tenancy a job runs once per tenant unless `--global` says it works across them: a global job
|
|
41
|
+
* runs in no tenant, and a tenant-scoped repository refuses to be read there.
|
|
42
|
+
*/
|
|
43
|
+
function tenancyOf(scope, name) {
|
|
44
|
+
const { global } = scope.flags;
|
|
45
|
+
if (scope.config.stack.tenancy === 'none') {
|
|
46
|
+
if (global) {
|
|
47
|
+
throw new CliError('--global means nothing in a project without tenancy.', `Every job runs once there: drop --global from \`generate job ${scope.context.kebab} ${name.pascal}\`.`);
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
scope.ws.note(global
|
|
52
|
+
? `${name.pascal}Job is global (\`tenancy: 'global'\`): it runs once per occurrence, in no tenant, so a tenant-scoped repository refuses it. Drop --global for a job that works one tenant at a time.`
|
|
53
|
+
: `${name.pascal}Job runs per tenant (\`tenancy: 'per-tenant'\`): once per tenant of the TenantDirectory (TENANTS) for each occurrence, each run in the scope of its tenant. Pass --global for work across tenants.`);
|
|
54
|
+
return global ? 'global' : 'per-tenant';
|
|
55
|
+
}
|
|
39
56
|
function commandNamed(scope, name) {
|
|
40
57
|
const { commandName } = scope.flags;
|
|
41
58
|
if (commandName !== undefined && commandName.trim() !== '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/job-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,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,E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
@@ -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":["../../../../src/generate/kinds/presentation/controller-source.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,MAAM,SAAS,GAAG,mDAAmD,CAAC;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,+GAA+G;IAC/G,UAAU,CAAC,MAAc,EAAE,IAAY,EAAE,MA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AAC"}
|
|
@@ -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"}
|
|
@@ -11,7 +11,7 @@ export const representationKind = {
|
|
|
11
11
|
name: 'representation',
|
|
12
12
|
aliases: [],
|
|
13
13
|
usage: 'representation <context> <UseCase> <xml|csv|media/type>[,...]',
|
|
14
|
-
summary: 'Makes a controller answer in more media types than JSON: `produces` in `@Controller
|
|
14
|
+
summary: 'Makes a controller answer in more media types than JSON: `produces` in `@Controller` (`@KitRoute` of a Nest controller), and `consumes` of XML for a route that receives a body. The request chooses by its Accept header when "stack.representations" is "negotiated"; the contract lists every media type.',
|
|
15
15
|
positionals: ['context', 'UseCase', 'media'],
|
|
16
16
|
writesShared: false,
|
|
17
17
|
run: (request) => {
|
|
@@ -22,11 +22,12 @@ export const representationKind = {
|
|
|
22
22
|
if (/^\s*produces:/m.test(source)) {
|
|
23
23
|
throw new CliError(`${useCase.pascal}Controller already declares what it produces.`, 'Edit its `produces` in the controller.');
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const receivesBody = controllerSource.nestBody(source) !== undefined || /^\s*body[,:]/m.test(source);
|
|
26
|
+
const receivesXml = media.includes(XML) && receivesBody;
|
|
26
27
|
const produced = controllerSource.withOption(source, `produces: [${media.map((type) => `'${type}'`).join(', ')}],`);
|
|
27
28
|
scope.ws.update(file, receivesXml ? controllerSource.withOption(produced, `consumes: ['${XML}'],`) : produced);
|
|
28
29
|
if (receivesXml) {
|
|
29
|
-
scope.ws.note(`The route now also reads its body in XML (\`consumes: ['${XML}']\`), and answers 415 to another media type: remove \`consumes\` from @Controller if only the answer was to be XML.`);
|
|
30
|
+
scope.ws.note(`The route now also reads its body in XML (\`consumes: ['${XML}']\`), and answers 415 to another media type: remove \`consumes\` from ${controllerSource.isNest(source) ? '@KitRoute' : '@Controller'} if only the answer was to be XML.`);
|
|
30
31
|
}
|
|
31
32
|
tellWhatIsLeft(scope, { media, source });
|
|
32
33
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representation-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/representation-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,i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CACrB,KAAmC,EACnC,EAAE,KAAK,EAAE,MAAM,EAAgD;IAE/D,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/E,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,wLAAwL,CACzL,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,KAAK,YAAY,EAAE,CAAC;QACxD,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,gFAAgF,WAAW,iEAAiE,CAC7J,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -4,8 +4,8 @@ import type { ControllerPlan } from './controller-plan.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* What the template of a Nest controller reads, over what the template of a controller of the kit
|
|
6
6
|
* reads: the decorators of Nest it is written with, the parameters of its method, and the bus Nest
|
|
7
|
-
* injects by its class. What it answers is read from its signature by `ddd-ts-kit` into
|
|
8
|
-
* `<context>.controllers.ts` of its context.
|
|
7
|
+
* injects by its class. What it takes and answers is read from its signature by `ddd-ts-kit` into
|
|
8
|
+
* the `<context>.controllers.ts` of its context.
|
|
9
9
|
*/
|
|
10
10
|
export declare function nestControllerVars(scope: Scope, plan: ControllerPlan): RenderContext;
|
|
11
11
|
//# sourceMappingURL=nest-controller-vars.d.ts.map
|
|
@@ -5,8 +5,8 @@ import { successStatus } from './success-status.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* What the template of a Nest controller reads, over what the template of a controller of the kit
|
|
7
7
|
* reads: the decorators of Nest it is written with, the parameters of its method, and the bus Nest
|
|
8
|
-
* injects by its class. What it answers is read from its signature by `ddd-ts-kit` into
|
|
9
|
-
* `<context>.controllers.ts` of its context.
|
|
8
|
+
* injects by its class. What it takes and answers is read from its signature by `ddd-ts-kit` into
|
|
9
|
+
* the `<context>.controllers.ts` of its context.
|
|
10
10
|
*/
|
|
11
11
|
export function nestControllerVars(scope, plan) {
|
|
12
12
|
const types = controllerTypes(scope, plan);
|
|
@@ -34,7 +34,6 @@ function importVars(scope, plan, types) {
|
|
|
34
34
|
nestImports: fromNest.sort().join(', '),
|
|
35
35
|
importsFromTheKit: fromTheKit.length > 0,
|
|
36
36
|
kitImports: fromTheKit.join(', '),
|
|
37
|
-
readsSchemas: types.hasTypedParams || types.hasBody,
|
|
38
37
|
bridgeImports: [...(useCase.isProtected ? ['CurrentActor'] : []), 'KitRoute', 'KitRoutes'].join(', '),
|
|
39
38
|
kernelImports: useCase.isProtected ? `${busType}, type Actor` : busType,
|
|
40
39
|
};
|
|
@@ -59,15 +58,10 @@ function declarationVars(scope, { group, endpoint }, httpCode) {
|
|
|
59
58
|
nestShared: group === undefined ? `tags: ['${scope.context.kebab}'], guards: [Public]` : `group: ${group.name.pascal}Routes`,
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
|
-
/**
|
|
61
|
+
/** The parameters of the method, whose types `ddd-ts-kit` reads into the schemas of the route, and the message it sends through the bus the constructor injects. */
|
|
63
62
|
function methodVars({ name, useCase }, types) {
|
|
64
63
|
const busType = busTypeOf(useCase.isQuery);
|
|
65
64
|
return {
|
|
66
|
-
readsRequest: types.hasTypedParams || types.hasBody,
|
|
67
|
-
nestRequest: [
|
|
68
|
-
...(types.hasTypedParams ? ['params: paramsSchema'] : []),
|
|
69
|
-
...(types.hasBody ? ['body: bodySchema'] : []),
|
|
70
|
-
].join(', '),
|
|
71
65
|
nestParameters: [
|
|
72
66
|
...(types.hasTypedParams ? [`@Param() params: ${name.pascal}Params`] : []),
|
|
73
67
|
...(types.hasBody ? [`@Body() body: ${name.pascal}Body`] : []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nest-controller-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-controller-vars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,c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AC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RenderContext } from '../../../templating/index.js';
|
|
2
|
+
import type { Name } from '../../../naming/index.js';
|
|
3
|
+
import type { ControllerPlan } from './controller-plan.js';
|
|
4
|
+
/** What the template of a Nest controller of a search reads: the imports of a page and the name of one line. */
|
|
5
|
+
export declare function nestSearchVars(name: Name, { endpoint, group, cache }: ControllerPlan): RenderContext;
|
|
6
|
+
//# sourceMappingURL=nest-search-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-search-vars.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-search-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,cAAc,GAAG,aAAa,CAepG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { searchedElements } from '../../searched-elements.js';
|
|
2
|
+
/** What the template of a Nest controller of a search reads: the imports of a page and the name of one line. */
|
|
3
|
+
export function nestSearchVars(name, { endpoint, group, cache }) {
|
|
4
|
+
const method = `${endpoint.method.charAt(0)}${endpoint.method.slice(1).toLowerCase()}`;
|
|
5
|
+
return {
|
|
6
|
+
...searchedElements(name),
|
|
7
|
+
nestImports: ['Controller', method, 'Inject', 'Query'].sort().join(', '),
|
|
8
|
+
kitImports: [
|
|
9
|
+
...(cache === undefined ? [] : ['CacheScope']),
|
|
10
|
+
'pageQuerySchema',
|
|
11
|
+
'pageResponse',
|
|
12
|
+
'pageSchemaOf',
|
|
13
|
+
...(group === undefined ? ['Public'] : []),
|
|
14
|
+
'type PageBody',
|
|
15
|
+
].join(', '),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=nest-search-vars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-search-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/nest-search-vars.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,gHAAgH;AAChH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAkB;IACnF,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;IAEvF,OAAO;QACL,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACzB,WAAW,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;QACxE,UAAU,EAAE;YACV,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;YAC9C,iBAAiB;YACjB,cAAc;YACd,cAAc;YACd,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1C,eAAe;SAChB,CAAC,IAAI,CAAC,IAAI,CAAC;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-nest-controller.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-nest-controller.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAuB5E"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CliError } from '../../../cli-error.js';
|
|
2
1
|
import { emit } from '../../emit.js';
|
|
3
2
|
import { named } from '../../named.js';
|
|
4
3
|
import { vars } from '../../vars.js';
|
|
@@ -6,17 +5,19 @@ import { wire } from '../../wire.js';
|
|
|
6
5
|
import { dtoClasses } from './dto-classes.js';
|
|
7
6
|
import { groupVars } from './group-vars.js';
|
|
8
7
|
import { nestControllerVars } from './nest-controller-vars.js';
|
|
8
|
+
import { nestSearchVars } from './nest-search-vars.js';
|
|
9
9
|
import { sharesSchemas } from './shares-schemas.js';
|
|
10
10
|
/**
|
|
11
11
|
* Writes a Nest controller in its folder, its DTO classes beside it, its spec and its group when it
|
|
12
12
|
* is new, and lists it in the module of its context, for Nest to build it and the kit to serve it.
|
|
13
13
|
*/
|
|
14
14
|
export function writeNestController(scope, plan) {
|
|
15
|
-
assertWritable(scope
|
|
15
|
+
assertWritable(scope);
|
|
16
16
|
const { name, group } = plan;
|
|
17
17
|
const context = vars(scope, {
|
|
18
18
|
name: named(name),
|
|
19
19
|
route: nestControllerVars(scope, { ...plan, withMapper: false, withSerializer: false }),
|
|
20
|
+
...(plan.useCase.isSearch ? { search: nestSearchVars(name, plan) } : {}),
|
|
20
21
|
...(group === undefined
|
|
21
22
|
? {}
|
|
22
23
|
: {
|
|
@@ -31,11 +32,8 @@ export function writeNestController(scope, plan) {
|
|
|
31
32
|
emit(scope, context, outputsOf(scope, plan));
|
|
32
33
|
wire(scope, 'nest-controller', context);
|
|
33
34
|
}
|
|
34
|
-
/**
|
|
35
|
-
function assertWritable(scope
|
|
36
|
-
if (useCase.isSearch) {
|
|
37
|
-
throw new CliError(`${useCase.message} is a search: a Nest controller is not written for it yet.`, 'Generate it as a controller of the kit, which a Nest project serves too: `ddd-ts-kit generate controller ...`.');
|
|
38
|
-
}
|
|
35
|
+
/** The method of a Nest controller maps its input and its answer itself. */
|
|
36
|
+
function assertWritable(scope) {
|
|
39
37
|
if (scope.flags.mapper || scope.flags.serializer) {
|
|
40
38
|
scope.ws.note('--mapper and --serializer are left out: the method of a Nest controller maps its input and its answer itself.');
|
|
41
39
|
}
|
|
@@ -44,7 +42,7 @@ function outputsOf(scope, { name, group, useCase, endpoint, folder }) {
|
|
|
44
42
|
const beside = (role) => `${folder}/${name.kebab}.${role}.ts`;
|
|
45
43
|
return [
|
|
46
44
|
...(group === undefined || group.exists ? [] : [['controller/group.ts.tpl', `${group.file}.ts`]]),
|
|
47
|
-
[
|
|
45
|
+
[`nest-controller/controller${useCase.isSearch ? '.search' : ''}.ts.tpl`, beside('controller')],
|
|
48
46
|
...dtoClasses(endpoint, useCase, sharesSchemas(scope.config)).map((role) => [`route/dto.${role}.ts.tpl`, beside(role)]),
|
|
49
47
|
['nest-controller/controller.spec.ts.tpl', `test/unit/${name.kebab}.controller.spec.ts`],
|
|
50
48
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-nest-controller.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"write-nest-controller.js","sourceRoot":"","sources":["../../../../src/generate/kinds/route/write-nest-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM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: `route ${USAGE}`,
|
|
24
|
-
summary: 'An HTTP route calling an existing use case through its bus, with its spec: under "stack.routes": "controllers", a controller class in its folder, behind the guards of its route group; under "functions", a defineRoute function and its registration; under "nest", a Nest controller whose method
|
|
24
|
+
summary: 'An HTTP route calling an existing use case through its bus, with its spec: under "stack.routes": "controllers", a controller class in its folder, behind the guards of its route group; under "functions", a defineRoute function and its registration; under "nest", a Nest controller whose method takes and answers what its signature names, listed in the generated <context>.controllers.ts.',
|
|
25
25
|
positionals: ['context', 'UseCaseName'],
|
|
26
26
|
writesShared: false,
|
|
27
27
|
run: (request) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/route-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAmB,MAAM,oBAAoB,CA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AAU,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhH,OAAO;QACL,CAAC,eAAe,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,SAAS,EAAE,qBAAqB,IAAI,CAAC,KAAK,WAAW,CAAC;QAC9G,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAU,EAAE,CAAC,CAAC,aAAa,IAAI,SAAS,EAAE,qBAAqB,IAAI,CAAC,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC;QAC7G,CAAC,yBAAyB,EAAE,aAAa,IAAI,CAAC,KAAK,gBAAgB,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,0HAA0H;AAC1H,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,GAAG,SAAS;IACZ,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,cAAc,KAAK,EAAE;IAC5B,OAAO,EACL,uKAAuK;IACzK,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;CACpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAepC,eAAO,MAAM,WAAW,EAAE,IAgCzB,CAAC"}
|
|
@@ -1,32 +1,59 @@
|
|
|
1
1
|
import { CONFIG_FILE } from '../../config/index.js';
|
|
2
|
+
import { inertPersistenceFile } from '../../init/files/inert-persistence-file.js';
|
|
2
3
|
import { renderTemplate } from '../../templating/index.js';
|
|
3
4
|
import { openScope } from '../open-scope.js';
|
|
5
|
+
import { applyWiring } from '../apply-wiring.js';
|
|
6
|
+
import { platformPath } from '../platform-path.js';
|
|
4
7
|
import { vars } from '../vars.js';
|
|
8
|
+
import { wiringFamily } from '../wiring-family.js';
|
|
5
9
|
import { addComposeService } from './extraction/add-compose-service.js';
|
|
6
10
|
import { editJson } from './extraction/edit-json.js';
|
|
7
11
|
import { EntryPoint } from './extraction/entry-point.js';
|
|
8
12
|
import { recordOf } from './extraction/record-of.js';
|
|
9
13
|
import { serviceSelection } from './extraction/service-selection.js';
|
|
14
|
+
const HOSTING_PROOF = 'test/architecture/hosting.spec.ts';
|
|
10
15
|
export const serviceKind = {
|
|
11
16
|
name: 'service',
|
|
12
17
|
aliases: [],
|
|
13
18
|
usage: 'service <context>',
|
|
14
|
-
summary: 'The context run alone, with its scheduled jobs: its entry point under apps/, a start script, a compose service,
|
|
19
|
+
summary: 'The context run alone, with its scheduled jobs: its entry point under apps/, a start script, a compose service, `deployable` in the config, and its departure from the whole application (consumers, processes and jobs run once).',
|
|
15
20
|
positionals: ['context'],
|
|
16
21
|
writesShared: true,
|
|
17
22
|
run: (request) => {
|
|
18
23
|
const scope = openScope(request);
|
|
19
24
|
const { ws, config, context } = scope;
|
|
20
25
|
const entry = new EntryPoint(config, context.kebab);
|
|
21
|
-
const service = { ...serviceSelection(scope), portVariable:
|
|
26
|
+
const service = { ...serviceSelection(scope), portVariable: `\${${context.constant}_PORT:-3001}` };
|
|
22
27
|
ws.create(entry.source, renderTemplate('service/main.ts.tpl', vars(scope, { service })));
|
|
23
28
|
entry.declareIn(ws);
|
|
24
29
|
editJson(ws, CONFIG_FILE, (raw) => markDeployable(raw, context.kebab));
|
|
25
30
|
addComposeService(ws, context.kebab, renderTemplate('service/compose.tpl', vars(scope, { service })));
|
|
31
|
+
leaveTheWholeApplication(scope);
|
|
26
32
|
ws.note(`Build the image of the service with \`docker build --build-arg ENTRY=${entry.compiled} .\`, or start it with \`docker compose --profile services up ${context.kebab}\`.`);
|
|
27
|
-
ws.note(`The service takes the scheduled jobs of ${context.kebab} with it: it runs them unless RUN_JOBS=false, and no job of another context.`);
|
|
33
|
+
ws.note(`The service takes the scheduled jobs of ${context.kebab} with it: it runs them unless RUN_JOBS=false, and no job of another context nor of the platform (audit.archive, privacy.purge-expired stay with the whole application).`);
|
|
34
|
+
ws.note(`${context.pascal} leaves the application of src/main.ts and the worker: \`hostedContexts\` of the composition root omits it, so its consumers, its processes, its jobs and its routes run in the service only. \`everyContext\` stays the full list for the contracts and the end-to-end tests. Set the same DEPLOYMENT_NAME in every container, and a different OTEL_SERVICE_NAME.`);
|
|
28
35
|
},
|
|
29
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* The context stops being hosted by the whole application: the root of `main.ts` and of the worker
|
|
39
|
+
* composes `hostedContexts`, the settings of its jobs leave the whole application, and a proof
|
|
40
|
+
* composes both roots and checks that nothing is registered twice.
|
|
41
|
+
*/
|
|
42
|
+
function leaveTheWholeApplication(scope) {
|
|
43
|
+
const { ws, config } = scope;
|
|
44
|
+
const rendered = vars(scope, {});
|
|
45
|
+
applyWiring(ws, platformPath(scope, 'composition/compose-application.ts'), renderTemplate(`service/extracted.${wiringFamily(config)}.tpl`, rendered));
|
|
46
|
+
applyWiring(ws, platformPath(scope, 'jobs/job-settings.ts'), renderTemplate('service/extracted-name.tpl', rendered));
|
|
47
|
+
const inert = inertPersistenceFile(config);
|
|
48
|
+
// A project without HTTP on tsyringe composes nothing without a database until now: the proof needs the inert one.
|
|
49
|
+
if (inert !== undefined && !ws.exists(inert[0])) {
|
|
50
|
+
ws.create(inert[0], renderTemplate(inert[1], rendered));
|
|
51
|
+
}
|
|
52
|
+
if (!ws.exists(HOSTING_PROOF)) {
|
|
53
|
+
ws.create(HOSTING_PROOF, renderTemplate(`architecture/hosting.${wiringFamily(config)}.spec.ts.tpl`, rendered));
|
|
54
|
+
}
|
|
55
|
+
applyWiring(ws, HOSTING_PROOF, renderTemplate('service/extracted-name.tpl', rendered));
|
|
56
|
+
}
|
|
30
57
|
function markDeployable(raw, context) {
|
|
31
58
|
const contexts = recordOf(raw['contexts']);
|
|
32
59
|
raw['contexts'] = { ...contexts, [context]: { ...recordOf(contexts[context]), deployable: true } };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"service-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/service-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,aAAa,GAAG,mCAAmC,CAA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S,cAAc,CAAC,GAA4B,EAAE,OAAe;IACnE,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAE3C,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;AACrG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-repository-on-first-use.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"wire-repository-on-first-use.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMtC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,CAM5E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { named } from '../named.js';
|
|
2
2
|
import { vars } from '../vars.js';
|
|
3
3
|
import { wire } from '../wire.js';
|
|
4
|
+
import { isEventSourced } from './is-event-sourced.js';
|
|
4
5
|
import { repositoryPrefix } from './repository-prefix.js';
|
|
5
6
|
/**
|
|
6
7
|
* The repository of an aggregate, created in the module file of a hand-wired context by the first
|
|
@@ -9,6 +10,6 @@ import { repositoryPrefix } from './repository-prefix.js';
|
|
|
9
10
|
* families bind the repository to its port, where nothing is created before it is resolved.
|
|
10
11
|
*/
|
|
11
12
|
export function wireRepositoryOnFirstUse(scope, aggregate) {
|
|
12
|
-
wire(scope, 'repository/first-use', vars(scope, { aggregate: named(aggregate), adapter: repositoryPrefix(scope.config.stack.orm) }));
|
|
13
|
+
wire(scope, isEventSourced(scope, aggregate) ? 'repository/event-sourced-first-use' : 'repository/first-use', vars(scope, { aggregate: named(aggregate), adapter: repositoryPrefix(scope.config.stack.orm) }));
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=wire-repository-on-first-use.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-repository-on-first-use.js","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AACA,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,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY,EAAE,SAAe;IACpE,IAAI,CACF,KAAK,EACL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"wire-repository-on-first-use.js","sourceRoot":"","sources":["../../../src/generate/kinds/wire-repository-on-first-use.ts"],"names":[],"mappings":"AACA,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,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY,EAAE,SAAe;IACpE,IAAI,CACF,KAAK,EACL,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,sBAAsB,EAChG,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAChG,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-event-sourced-aggregate.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/write-event-sourced-aggregate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-event-sourced-aggregate.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/write-event-sourced-aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAQtC;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAkBzE"}
|