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
|
@@ -2,12 +2,13 @@ import type { Config } from '../config/index.js';
|
|
|
2
2
|
import type { Workspace } from '../workspace/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* `ddd-ts-kit docs --stored-events`: records in `stored-events.lock.json` the shape of each
|
|
5
|
-
* version of a stored event declared in the codecs of `infrastructure/persistence
|
|
5
|
+
* version of a stored event declared in the codecs of `infrastructure/persistence/`, of the context and of each module of its model. Run when a
|
|
6
6
|
* version starts being stored where events are kept (before the release that ships it): from
|
|
7
7
|
* then on its shape is the one stored. A version already recorded is never rewritten, so a
|
|
8
8
|
* changed shape stays visible to `event-sourcing/upcaster-required`, save the fingerprint 0.82.0
|
|
9
9
|
* and earlier recorded for the same shape, recorded again as it reads now; a project without
|
|
10
|
-
* stored events gets no lock.
|
|
10
|
+
* stored events gets no lock. A codec whose data type is not found or declares no member is refused, with
|
|
11
|
+
* its file and the reason, and nothing is recorded: the hash of nothing would vouch for no shape. `docs --check` fails while a declared version is not recorded.
|
|
11
12
|
*/
|
|
12
13
|
export declare function writeStoredEventsLock(ws: Workspace, config: Config, contexts: readonly string[]): void;
|
|
13
14
|
//# sourceMappingURL=write-stored-events-lock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-stored-events-lock.d.ts","sourceRoot":"","sources":["../../src/docs/write-stored-events-lock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"write-stored-events-lock.d.ts","sourceRoot":"","sources":["../../src/docs/write-stored-events-lock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CA8BtG"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { readStoredEventsLock } from '../check/event-sourcing/read-stored-events-lock.js';
|
|
2
2
|
import { STORED_EVENTS_LOCK } from '../check/event-sourcing/stored-events-lock-file.js';
|
|
3
3
|
import { declaredStoredEvents } from './declared-stored-events.js';
|
|
4
|
+
import { refuseUnreadableStoredEvents } from './refuse-unreadable-stored-events.js';
|
|
4
5
|
/**
|
|
5
6
|
* `ddd-ts-kit docs --stored-events`: records in `stored-events.lock.json` the shape of each
|
|
6
|
-
* version of a stored event declared in the codecs of `infrastructure/persistence
|
|
7
|
+
* version of a stored event declared in the codecs of `infrastructure/persistence/`, of the context and of each module of its model. Run when a
|
|
7
8
|
* version starts being stored where events are kept (before the release that ships it): from
|
|
8
9
|
* then on its shape is the one stored. A version already recorded is never rewritten, so a
|
|
9
10
|
* changed shape stays visible to `event-sourcing/upcaster-required`, save the fingerprint 0.82.0
|
|
10
11
|
* and earlier recorded for the same shape, recorded again as it reads now; a project without
|
|
11
|
-
* stored events gets no lock.
|
|
12
|
+
* stored events gets no lock. A codec whose data type is not found or declares no member is refused, with
|
|
13
|
+
* its file and the reason, and nothing is recorded: the hash of nothing would vouch for no shape. `docs --check` fails while a declared version is not recorded.
|
|
12
14
|
*/
|
|
13
15
|
export function writeStoredEventsLock(ws, config, contexts) {
|
|
14
16
|
const declared = declaredStoredEvents(ws, config, contexts);
|
|
17
|
+
refuseUnreadableStoredEvents(declared);
|
|
15
18
|
const recorded = readStoredEventsLock(ws.root);
|
|
16
19
|
const exists = ws.exists(STORED_EVENTS_LOCK);
|
|
17
20
|
if (declared.length === 0 && !exists) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-stored-events-lock.js","sourceRoot":"","sources":["../../src/docs/write-stored-events-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAGrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"write-stored-events-lock.js","sourceRoot":"","sources":["../../src/docs/write-stored-events-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAGrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAa,EAAE,MAAc,EAAE,QAA2B;IAC9F,MAAM,QAAQ,GAAG,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE5D,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAE7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAA2C,MAAM,CAAC,WAAW,CACrE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,C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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACb,IAAI;QACJ,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,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
|
@@ -54,6 +54,8 @@ export interface KindFlags {
|
|
|
54
54
|
readonly kind?: string;
|
|
55
55
|
/** The adapter carries its resilience policy as standard decorators on its class. */
|
|
56
56
|
readonly decorators: boolean;
|
|
57
|
+
/** A job works across tenants, in none of them: `--global`, where a job of a multi-tenant project runs once per tenant by default. */
|
|
58
|
+
readonly global: boolean;
|
|
57
59
|
/** What an ADR deviates from, as a config key such as `rules.clean/stepdown`. */
|
|
58
60
|
readonly deviation?: string;
|
|
59
61
|
readonly reason?: string;
|
|
@@ -79,6 +81,8 @@ export interface KindFlags {
|
|
|
79
81
|
readonly cache?: string;
|
|
80
82
|
/** An aggregate keeps its state as the stream of its events. */
|
|
81
83
|
readonly eventSourced: boolean;
|
|
84
|
+
/** The fact an event-sourced aggregate is born with, as `--birth <Fact>`; `Created` when absent. */
|
|
85
|
+
readonly birth?: string;
|
|
82
86
|
/** The module of the model of the context the files of its layers and their specs are written in. */
|
|
83
87
|
readonly module?: string;
|
|
84
88
|
}
|
|
@@ -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,C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+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,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE
|
|
1
|
+
{"version":3,"file":"aggregate-kind.js","sourceRoot":"","sources":["../../../src/generate/kinds/aggregate-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,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,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;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AE,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-nest-upload-controller.js","sourceRoot":"","sources":["../../../../src/generate/kinds/file-upload/write-nest-upload-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAY,EAAE,IAAoB;IAC1E,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IAE/F,6FAA6F;IAC7F,MAAM,EAAE,OAAO,EAAE,KA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AAC,CAAC,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxF,aAAa,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/G,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,YAAY;QAC5E,UAAU,EAAE,CAAC,8BAA8B,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CACjH,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,E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AAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IAE7C,IAAI,OAAO,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,OAAO,KAAK,MAAM;QAChB,CAAC,CAAC,wDAAwD;QAC1D,CAAC,CAAC,wDAAwD,EAC5D,2GAA2G,WAAW,oDAAoD,CAC3K,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-kind.d.ts","sourceRoot":"","sources":["../../../src/generate/kinds/form-kind.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"form-kind.d.ts","sourceRoot":"","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,8BAA8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QAEF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAEvF,KAAK,CAAC,EAAE,CAAC,MAAM,CACb,IAAI,EACJ,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAClH,CAAC;QAEF,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtC,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,oDAAoD,WAAW,+CAA+C,CAC/G,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,yIAAyI;AACzI,SAAS,KAAK,CAAC,KAAa;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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AAS,WAAW,CAAC,KAAY,EAAE,SAAe;IAChD,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC,GAAG,+BAA+B,SAAS,CAAC,KAAK,mBAAmB,CAAC;IAE5F,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,GAAG,SAAS,CAAC,MAAM,oEAAoE,KAAK,IAAI,EAChG,0BAA0B,SAAS,CAAC,KAAK,yGAAyG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,CAAC,MAAM,oEAAoE,CAC9P,CAAC;AACJ,CAAC;AAED,0HAA0H;AAC1H,SAAS,eAAe,CAAC,KAAY;IACnC,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,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,qBAAq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YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC;IACrH,MAAM,MAAM,GAAG,KAAK,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtE,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,CAAC,IAAI,CACX,iFAAiF,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,mKAAmK,CAC3Q,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Name } from '../../naming/index.js';
|
|
2
|
+
import type { Scope } from '../scope.js';
|
|
3
|
+
/**
|
|
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"}
|
|
@@ -2,12 +2,15 @@ import type { Name } from '../../../naming/index.js';
|
|
|
2
2
|
import type { RenderContext } from '../../../templating/index.js';
|
|
3
3
|
import type { Scope } from '../../scope.js';
|
|
4
4
|
import type { SentCommand } from './sent-command.js';
|
|
5
|
+
/** Which tenants a run is for, as the source of the job says it; empty where the project has no tenant. */
|
|
6
|
+
export type JobTenancy = 'per-tenant' | 'global' | undefined;
|
|
5
7
|
export interface JobParts {
|
|
6
8
|
readonly name: Name;
|
|
7
9
|
/** The schedule as the source writes it. */
|
|
8
10
|
readonly schedule: string;
|
|
9
11
|
readonly command: SentCommand;
|
|
12
|
+
readonly tenancy: JobTenancy;
|
|
10
13
|
}
|
|
11
14
|
/** What the templates of a job read; the grant of its system actor is written on the way, where the model allows. */
|
|
12
|
-
export declare function jobVars(scope: Scope, { name, schedule, command }: JobParts): RenderContext;
|
|
15
|
+
export declare function jobVars(scope: Scope, { name, schedule, command, tenancy }: JobParts): RenderContext;
|
|
13
16
|
//# sourceMappingURL=job-vars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-vars.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/job/job-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"job-vars.d.ts","sourceRoot":"","sources":["../../../../src/generate/kinds/job/job-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,2GAA2G;AAC3G,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;CAC9B;AAED,qHAAqH;AACrH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,QAAQ,GAAG,aAAa,CAyBnG"}
|
|
@@ -2,13 +2,14 @@ import { grantSystemActor } from './grant-system-actor.js';
|
|
|
2
2
|
import { grantedInSpec } from './granted-in-spec.js';
|
|
3
3
|
const PERIOD = 'which period the work is for is said by `execution.scheduledAt`, never by the clock: an occurrence may run late, or twice';
|
|
4
4
|
/** What the templates of a job read; the grant of its system actor is written on the way, where the model allows. */
|
|
5
|
-
export function jobVars(scope, { name, schedule, command }) {
|
|
5
|
+
export function jobVars(scope, { name, schedule, command, tenancy }) {
|
|
6
6
|
const jobName = `${scope.context.kebab}.${name.kebab}`;
|
|
7
7
|
const actor = command.isProtected ? [`systemActor('${jobName}')`] : [];
|
|
8
8
|
const grant = command.isProtected ? grantSystemActor(scope, jobName, command) : undefined;
|
|
9
9
|
return {
|
|
10
10
|
name: jobName,
|
|
11
11
|
schedule,
|
|
12
|
+
...tenancyVars(schedule, tenancy),
|
|
12
13
|
switch: `JOB_${scope.context.constant}_${name.constant}_ENABLED`,
|
|
13
14
|
command: command.name.pascal,
|
|
14
15
|
commandKebab: command.name.kebab,
|
|
@@ -26,6 +27,15 @@ export function jobVars(scope, { name, schedule, command }) {
|
|
|
26
27
|
grant: grant?.todo ?? '',
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
function tenancyVars(schedule, tenancy) {
|
|
31
|
+
return {
|
|
32
|
+
tenancy: tenancy ?? '',
|
|
33
|
+
perTenant: tenancy === 'per-tenant',
|
|
34
|
+
tenanted: tenancy !== undefined,
|
|
35
|
+
// Where the source writes the schedule and the options of the job together (the decorator, the builder).
|
|
36
|
+
scheduled: tenancy === undefined ? schedule : `${schedule.slice(0, -2)}, tenancy: '${tenancy}' }`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
29
39
|
function todoOf(command) {
|
|
30
40
|
const message = `${command.name.pascal}Command`;
|
|
31
41
|
return command.takesInstant
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/job/job-vars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,GACV,2HAA2H,CAAC;
|
|
1
|
+
{"version":3,"file":"job-vars.js","sourceRoot":"","sources":["../../../../src/generate/kinds/job/job-vars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,GACV,2HAA2H,CAAC;AAa9H,qHAAqH;AACrH,MAAM,UAAU,OAAO,CAAC,KAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAY;IAClF,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1F,OAAO;QACL,IAAI,EAAE,OAAO;QACb,QAAQ;QACR,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC;QACjC,MAAM,EAAE,OAAO,KAAK,CAAC,OAAO,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