ddd-ts-kit 0.91.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +189 -0
- package/README.fr.md +16 -12
- package/README.md +15 -10
- package/dist/acceptance/lock-acceptance.d.ts.map +1 -1
- package/dist/acceptance/lock-acceptance.js +2 -1
- package/dist/acceptance/lock-acceptance.js.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.js +3 -1
- package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
- package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
- package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
- package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.js +21 -3
- package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -1
- package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -1
- package/dist/check/nest/nest-equivalents-of.js +7 -2
- package/dist/check/nest/nest-equivalents-of.js.map +1 -1
- package/dist/check/rules/nest-controllers-current.d.ts.map +1 -1
- package/dist/check/rules/nest-controllers-current.js +13 -2
- package/dist/check/rules/nest-controllers-current.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +13 -5
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +21 -1
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/prisma-generate.d.ts +7 -0
- package/dist/commands/prisma-generate.d.ts.map +1 -0
- package/dist/commands/prisma-generate.js +23 -0
- package/dist/commands/prisma-generate.js.map +1 -0
- package/dist/commands/typeorm-generate.d.ts +10 -0
- package/dist/commands/typeorm-generate.d.ts.map +1 -0
- package/dist/commands/typeorm-generate.js +37 -0
- package/dist/commands/typeorm-generate.js.map +1 -0
- package/dist/config/stack.d.ts +1 -1
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/guard-errors.d.ts +3 -0
- package/dist/describe/guard-errors.d.ts.map +1 -0
- package/dist/describe/guard-errors.js +10 -0
- package/dist/describe/guard-errors.js.map +1 -0
- package/dist/describe/no-group.d.ts +4 -0
- package/dist/describe/no-group.d.ts.map +1 -0
- package/dist/describe/no-group.js +3 -0
- package/dist/describe/no-group.js.map +1 -0
- package/dist/describe/read-controllers.d.ts +1 -1
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +12 -19
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/read-nest-controller-routes.d.ts +16 -0
- package/dist/describe/read-nest-controller-routes.d.ts.map +1 -0
- package/dist/describe/read-nest-controller-routes.js +117 -0
- package/dist/describe/read-nest-controller-routes.js.map +1 -0
- package/dist/describe/schema-class-of.d.ts +3 -0
- package/dist/describe/schema-class-of.d.ts.map +1 -0
- package/dist/describe/schema-class-of.js +10 -0
- package/dist/describe/schema-class-of.js.map +1 -0
- package/dist/docs/declared-stored-events.d.ts +6 -2
- package/dist/docs/declared-stored-events.d.ts.map +1 -1
- package/dist/docs/declared-stored-events.js +4 -3
- package/dist/docs/declared-stored-events.js.map +1 -1
- package/dist/docs/emptily-recorded-stored-events.d.ts +6 -0
- package/dist/docs/emptily-recorded-stored-events.d.ts.map +1 -0
- package/dist/docs/emptily-recorded-stored-events.js +12 -0
- package/dist/docs/emptily-recorded-stored-events.js.map +1 -0
- package/dist/docs/refuse-unreadable-stored-events.d.ts +7 -0
- package/dist/docs/refuse-unreadable-stored-events.d.ts.map +1 -0
- package/dist/docs/refuse-unreadable-stored-events.js +27 -0
- package/dist/docs/refuse-unreadable-stored-events.js.map +1 -0
- package/dist/docs/write-stored-events-lock.d.ts +3 -2
- package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
- package/dist/docs/write-stored-events-lock.js +5 -2
- package/dist/docs/write-stored-events-lock.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.d.ts.map +1 -1
- package/dist/generate/kinds/aggregate-kind.js +6 -2
- package/dist/generate/kinds/aggregate-kind.js.map +1 -1
- package/dist/generate/kinds/assert-event-store.d.ts +4 -0
- package/dist/generate/kinds/assert-event-store.d.ts.map +1 -0
- package/dist/generate/kinds/assert-event-store.js +10 -0
- package/dist/generate/kinds/assert-event-store.js.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts +9 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +49 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -0
- package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload-kind.js +9 -2
- package/dist/generate/kinds/file-upload-kind.js.map +1 -1
- package/dist/generate/kinds/form-kind.d.ts.map +1 -1
- package/dist/generate/kinds/form-kind.js +15 -11
- package/dist/generate/kinds/form-kind.js.map +1 -1
- package/dist/generate/kinds/generate-event-sourced-repository.d.ts +11 -0
- package/dist/generate/kinds/generate-event-sourced-repository.d.ts.map +1 -0
- package/dist/generate/kinds/generate-event-sourced-repository.js +48 -0
- package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -0
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +5 -0
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/is-event-sourced.d.ts +9 -0
- package/dist/generate/kinds/is-event-sourced.d.ts.map +1 -0
- package/dist/generate/kinds/is-event-sourced.js +11 -0
- package/dist/generate/kinds/is-event-sourced.js.map +1 -0
- package/dist/generate/kinds/presentation/controller-source.d.ts +11 -3
- package/dist/generate/kinds/presentation/controller-source.d.ts.map +1 -1
- package/dist/generate/kinds/presentation/controller-source.js +25 -4
- package/dist/generate/kinds/presentation/controller-source.js.map +1 -1
- package/dist/generate/kinds/repository-kind.js +1 -1
- package/dist/generate/kinds/repository-kind.js.map +1 -1
- package/dist/generate/kinds/representation-kind.d.ts.map +1 -1
- package/dist/generate/kinds/representation-kind.js +4 -3
- package/dist/generate/kinds/representation-kind.js.map +1 -1
- package/dist/generate/kinds/route/nest-controller-vars.d.ts +2 -2
- package/dist/generate/kinds/route/nest-controller-vars.js +3 -9
- package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -1
- package/dist/generate/kinds/route/nest-search-vars.d.ts +6 -0
- package/dist/generate/kinds/route/nest-search-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/nest-search-vars.js +18 -0
- package/dist/generate/kinds/route/nest-search-vars.js.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -1
- package/dist/generate/kinds/route/write-nest-controller.js +6 -8
- package/dist/generate/kinds/route/write-nest-controller.js.map +1 -1
- package/dist/generate/kinds/route-kind.js +1 -1
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds/wire-repository-on-first-use.d.ts.map +1 -1
- package/dist/generate/kinds/wire-repository-on-first-use.js +2 -1
- package/dist/generate/kinds/wire-repository-on-first-use.js.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/write-event-sourced-aggregate.js +5 -13
- package/dist/generate/kinds/write-event-sourced-aggregate.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +3 -1
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +3 -1
- package/dist/help/usage.js.map +1 -1
- package/dist/init/agent-permissions.js +10 -6
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/auth-files.js +4 -0
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/platform-files.js +1 -0
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/knip-vars.js +4 -3
- package/dist/init/knip-vars.js.map +1 -1
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +10 -4
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.js +5 -1
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +7 -1
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +34 -30
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +9 -7
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/template-vars.js +1 -1
- package/dist/init/template-vars.js.map +1 -1
- package/dist/init/write-type-script-configs.d.ts.map +1 -1
- package/dist/init/write-type-script-configs.js +4 -1
- package/dist/init/write-type-script-configs.js.map +1 -1
- package/dist/markers/insert-in-region.js +1 -1
- package/dist/markers/insert-in-region.js.map +1 -1
- package/dist/merge/lost/untouched-by-branch.d.ts +12 -0
- package/dist/merge/lost/untouched-by-branch.d.ts.map +1 -0
- package/dist/merge/lost/untouched-by-branch.js +22 -0
- package/dist/merge/lost/untouched-by-branch.js.map +1 -0
- package/dist/merge/lost/verify-merge.d.ts.map +1 -1
- package/dist/merge/lost/verify-merge.js +6 -1
- package/dist/merge/lost/verify-merge.js.map +1 -1
- package/dist/migration/audit-guard/append-audit-guard.d.ts +18 -0
- package/dist/migration/audit-guard/append-audit-guard.d.ts.map +1 -0
- package/dist/migration/audit-guard/append-audit-guard.js +27 -0
- package/dist/migration/audit-guard/append-audit-guard.js.map +1 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.d.ts +7 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.d.ts.map +1 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.js +18 -0
- package/dist/migration/audit-guard/audit-guard-statements-of.js.map +1 -0
- package/dist/migration/audit-guard/audit-schema-created.d.ts +3 -0
- package/dist/migration/audit-guard/audit-schema-created.d.ts.map +1 -0
- package/dist/migration/audit-guard/audit-schema-created.js +9 -0
- package/dist/migration/audit-guard/audit-schema-created.js.map +1 -0
- package/dist/migration/audit-guard/generate-guarded.d.ts +16 -0
- package/dist/migration/audit-guard/generate-guarded.d.ts.map +1 -0
- package/dist/migration/audit-guard/generate-guarded.js +22 -0
- package/dist/migration/audit-guard/generate-guarded.js.map +1 -0
- package/dist/migration/audit-guard/guard-marker.d.ts +3 -0
- package/dist/migration/audit-guard/guard-marker.d.ts.map +1 -0
- package/dist/migration/audit-guard/guard-marker.js +3 -0
- package/dist/migration/audit-guard/guard-marker.js.map +1 -0
- package/dist/migration/audit-guard/guarded-text.d.ts +5 -0
- package/dist/migration/audit-guard/guarded-text.d.ts.map +1 -0
- package/dist/migration/audit-guard/guarded-text.js +26 -0
- package/dist/migration/audit-guard/guarded-text.js.map +1 -0
- package/dist/migration/audit-guard/migrations-under.d.ts +3 -0
- package/dist/migration/audit-guard/migrations-under.d.ts.map +1 -0
- package/dist/migration/audit-guard/migrations-under.js +15 -0
- package/dist/migration/audit-guard/migrations-under.js.map +1 -0
- package/dist/migration/audit-guard/run-orm-tool.d.ts +3 -0
- package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -0
- package/dist/migration/audit-guard/run-orm-tool.js +13 -0
- package/dist/migration/audit-guard/run-orm-tool.js.map +1 -0
- package/dist/migration/audit-guard/schemas-first.d.ts +6 -0
- package/dist/migration/audit-guard/schemas-first.d.ts.map +1 -0
- package/dist/migration/audit-guard/schemas-first.js +17 -0
- package/dist/migration/audit-guard/schemas-first.js.map +1 -0
- package/dist/migration/audit-guard/schemas-if-missing.d.ts +7 -0
- package/dist/migration/audit-guard/schemas-if-missing.d.ts.map +1 -0
- package/dist/migration/audit-guard/schemas-if-missing.js +9 -0
- package/dist/migration/audit-guard/schemas-if-missing.js.map +1 -0
- package/dist/migration/audit-guard/type-only-imports.d.ts +6 -0
- package/dist/migration/audit-guard/type-only-imports.d.ts.map +1 -0
- package/dist/migration/audit-guard/type-only-imports.js +8 -0
- package/dist/migration/audit-guard/type-only-imports.js.map +1 -0
- package/dist/migration/format-as-the-project.d.ts +4 -0
- package/dist/migration/format-as-the-project.d.ts.map +1 -0
- package/dist/migration/format-as-the-project.js +27 -0
- package/dist/migration/format-as-the-project.js.map +1 -0
- package/dist/migration/format-written-files.d.ts.map +1 -1
- package/dist/migration/format-written-files.js +2 -24
- package/dist/migration/format-written-files.js.map +1 -1
- package/dist/migration/index.d.ts +8 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +8 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/nest-controllers/nest-answer.d.ts +2 -10
- package/dist/nest-controllers/nest-answer.d.ts.map +1 -1
- package/dist/nest-controllers/nest-controller-entry.d.ts +4 -2
- package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -1
- package/dist/nest-controllers/nest-controllers-in.d.ts +6 -0
- package/dist/nest-controllers/nest-controllers-in.d.ts.map +1 -0
- package/dist/nest-controllers/nest-controllers-in.js +108 -0
- package/dist/nest-controllers/nest-controllers-in.js.map +1 -0
- package/dist/nest-controllers/nest-read-type.d.ts +12 -0
- package/dist/nest-controllers/nest-read-type.d.ts.map +1 -0
- package/dist/nest-controllers/nest-read-type.js +2 -0
- package/dist/nest-controllers/nest-read-type.js.map +1 -0
- package/dist/nest-controllers/nest-request-part.d.ts +9 -0
- package/dist/nest-controllers/nest-request-part.d.ts.map +1 -0
- package/dist/nest-controllers/nest-request-part.js +2 -0
- package/dist/nest-controllers/nest-request-part.js.map +1 -0
- package/dist/nest-controllers/parameters-of.d.ts +8 -0
- package/dist/nest-controllers/parameters-of.d.ts.map +1 -0
- package/dist/nest-controllers/parameters-of.js +32 -0
- package/dist/nest-controllers/parameters-of.js.map +1 -0
- package/dist/nest-controllers/project-files.d.ts +6 -0
- package/dist/nest-controllers/project-files.d.ts.map +1 -0
- package/dist/nest-controllers/project-files.js +2 -0
- package/dist/nest-controllers/project-files.js.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts +6 -9
- package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -1
- package/dist/nest-controllers/read-nest-controllers.js +10 -82
- package/dist/nest-controllers/read-nest-controllers.js.map +1 -1
- package/dist/nest-controllers/render-controllers-file.d.ts +4 -3
- package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -1
- package/dist/nest-controllers/render-controllers-file.js +45 -29
- package/dist/nest-controllers/render-controllers-file.js.map +1 -1
- package/dist/platform-layout/platform-layout.d.ts +3 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -1
- package/dist/platform-layout/platform-layout.js +3 -0
- package/dist/platform-layout/platform-layout.js.map +1 -1
- package/dist/presets/identity-refusal.js +3 -3
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +3 -1
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/dist/stack/authentication-vars.d.ts.map +1 -1
- package/dist/stack/authentication-vars.js +8 -2
- package/dist/stack/authentication-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.d.ts.map +1 -1
- package/dist/worker/briefing-of.js +2 -4
- package/dist/worker/briefing-of.js.map +1 -1
- package/dist/worker/resume-message.d.ts.map +1 -1
- package/dist/worker/resume-message.js +1 -2
- package/dist/worker/resume-message.js.map +1 -1
- package/package.json +6 -4
- package/templates/background-job/wiring.manual.tpl +1 -1
- package/templates/command/wiring.manual.tpl +1 -1
- package/templates/context/module.manual.ts.tpl +41 -10
- package/templates/erasure-handler/wiring.manual.tpl +1 -1
- package/templates/event-handler/wiring.manual.tpl +1 -1
- package/templates/file-upload/wiring.manual.tpl +1 -1
- package/templates/init/docker/env.example.tpl +1 -1
- package/templates/init/e2e/auth-environment.passport.ts.tpl +6 -0
- package/templates/init/e2e/create-credentials.passport.ts.tpl +47 -0
- package/templates/init/platform/auth/authentication/actor-of-token.ts.tpl +15 -0
- package/templates/init/platform/auth/authentication/bearer-strategy.ts.tpl +29 -0
- package/templates/init/platform/auth/authentication/create-authenticator.passport.ts.tpl +13 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +5 -2
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
- package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
- package/templates/init/platform/composition/platform-error-mapper.ts.tpl +9 -0
- package/templates/init/platform/composition/platform-test.module.tsyringe.ts.tpl +11 -0
- package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +5 -2
- package/templates/init/platform/config/app-config.ts.tpl +2 -2
- package/templates/init/platform/config/load-config.ts.tpl +2 -2
- package/templates/init/platform/database/open-persistence.memory.ts.tpl +10 -0
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +5 -0
- package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +5 -0
- package/templates/init/platform/database/persistence.contract.spec.ts.tpl +18 -0
- package/templates/init/platform/database/persistence.memory.ts.tpl +7 -1
- package/templates/init/platform/database/persistence.orm.ts.tpl +9 -1
- package/templates/init/platform/database/schema.drizzle.ts.tpl +11 -1
- package/templates/init/platform/database/schema.prisma.tpl +2 -1
- package/templates/init/platform/database/schema.typeorm.ts.tpl +1 -1
- package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +18 -6
- package/templates/init/platform/http/start-http-server.express.ts.tpl +10 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +6 -1
- package/templates/init/rules/presentation.md.tpl +1 -1
- package/templates/integration-event/wiring.manual.tpl +1 -1
- package/templates/integration-handler/wiring.manual.tpl +1 -1
- package/templates/job/wiring.manual.tpl +1 -1
- package/templates/nest-controller/controller.search.ts.tpl +38 -0
- package/templates/nest-controller/controller.ts.tpl +1 -17
- package/templates/nest-controller/upload.spec.ts.tpl +47 -0
- package/templates/nest-controller/upload.ts.tpl +25 -0
- package/templates/pipeline/biome.json.tpl +2 -2
- package/templates/pipeline/eslint.config.mjs.tpl +6 -0
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +17 -0
- package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.controller.nest-routes.ts.tpl +44 -0
- package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.controller.nest-routes.ts.tpl +56 -0
- package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.controller.nest-routes.ts.tpl +54 -0
- package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.controller.nest-routes.ts.tpl +32 -0
- package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.controller.nest-routes.ts.tpl +43 -0
- package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.controller.nest-routes.ts.tpl +25 -0
- package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.controller.nest-routes.ts.tpl +37 -0
- package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.controller.nest-routes.ts.tpl +31 -0
- package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.nest-routes.ts.tpl +42 -0
- package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +13 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/change-member-role.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/deactivate-account.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/decline-invitation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/grant-delegation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/invite-member.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/open-organisation.controller.spec.nest-routes.ts.tpl +70 -0
- package/templates/presets/identity/context/test/unit/provision-account.controller.spec.nest-routes.ts.tpl +99 -0
- package/templates/presets/identity/context/test/unit/remove-member.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/revoke-delegation.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/revoke-invitation.controller.spec.nest-routes.ts.tpl +57 -0
- package/templates/presets/identity/context/test/unit/search-members.controller.spec.nest-routes.ts.tpl +54 -0
- package/templates/process/timeout-job.wiring.manual.tpl +1 -1
- package/templates/query/search.wiring.manual.tpl +1 -1
- package/templates/query/wiring.manual.tpl +1 -1
- package/templates/repository/contract.spec.ts.tpl +1 -3
- package/templates/repository/event-sourced/contract.spec.ts.tpl +36 -0
- package/templates/repository/event-sourced/fake.ts.tpl +24 -0
- package/templates/repository/event-sourced/repository.ts.tpl +38 -0
- package/templates/repository/event-sourced-first-use.wiring.manual.tpl +4 -0
- package/templates/repository/event-sourced.wiring.tsyringe.tpl +6 -0
- package/templates/repository/first-use.wiring.manual.tpl +1 -1
- /package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/{deactivate-account.controller.ts.tpl → deactivate-account.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/accounts/provision-account/{provision-account.controller.ts.tpl → provision-account.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/{accept-invitation.controller.ts.tpl → accept-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/{decline-invitation.controller.ts.tpl → decline-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/change-member-role/{change-member-role.controller.ts.tpl → change-member-role.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/{grant-delegation.controller.ts.tpl → grant-delegation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/invite-member/{invite-member.controller.ts.tpl → invite-member.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/open-organisation/{open-organisation.controller.ts.tpl → open-organisation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/remove-member/{remove-member.controller.ts.tpl → remove-member.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/{revoke-delegation.controller.ts.tpl → revoke-delegation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/{revoke-invitation.controller.ts.tpl → revoke-invitation.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/presentation/http/organisations/search-members/{search-members.controller.ts.tpl → search-members.controller.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{accept-invitation.controller.spec.ts.tpl → accept-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{change-member-role.controller.spec.ts.tpl → change-member-role.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{deactivate-account.controller.spec.ts.tpl → deactivate-account.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{decline-invitation.controller.spec.ts.tpl → decline-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{grant-delegation.controller.spec.ts.tpl → grant-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{invite-member.controller.spec.ts.tpl → invite-member.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{open-organisation.controller.spec.ts.tpl → open-organisation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{provision-account.controller.spec.ts.tpl → provision-account.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{remove-member.controller.spec.ts.tpl → remove-member.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{revoke-delegation.controller.spec.ts.tpl → revoke-delegation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{revoke-invitation.controller.spec.ts.tpl → revoke-invitation.controller.spec.kit-routes.ts.tpl} +0 -0
- /package/templates/presets/identity/context/test/unit/{search-members.controller.spec.ts.tpl → search-members.controller.spec.kit-routes.ts.tpl} +0 -0
package/dist/config/stack.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const DATABASE_STACKS: readonly ['postgres', 'mysql', 'sqlite', '
|
|
|
7
7
|
export declare const TEST_STACKS: readonly ['vitest', 'jest'];
|
|
8
8
|
export declare const DOCS_UIS: readonly ['swagger', 'scalar', 'redoc', 'none'];
|
|
9
9
|
export declare const CI_PLATFORMS: readonly ['github', 'gitlab', 'both', 'none'];
|
|
10
|
-
export declare const AUTHN_STACKS: readonly ['jwt', 'keycloak', 'none'];
|
|
10
|
+
export declare const AUTHN_STACKS: readonly ['jwt', 'keycloak', 'passport', 'none'];
|
|
11
11
|
export declare const AUTHZ_STACKS: readonly ['rbac', 'abac', 'rebac', 'custom'];
|
|
12
12
|
export declare const BROKER_STACKS: readonly ['none', 'rabbitmq', 'kafka', 'nats', 'redis', 'custom'];
|
|
13
13
|
export declare const STYLES: readonly ['declared', 'explicit'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/config/stack.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,YAAI,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AACnF,eAAO,MAAM,iBAAiB,YAAI,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAU,CAAC;AAC3G,eAAO,MAAM,SAAS,YAAI,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AACjE,eAAO,MAAM,YAAY,YAAI,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AACvE,eAAO,MAAM,UAAU,YAAI,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAC9F,eAAO,MAAM,eAAe,YAAI,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAC3F,eAAO,MAAM,WAAW,YAAI,QAAQ,EAAE,MAAM,CAAU,CAAC;AACvD,eAAO,MAAM,QAAQ,YAAI,SAAS,EAAE,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OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IACtD;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;CAC/C"}
|
package/dist/config/stack.js
CHANGED
|
@@ -7,7 +7,7 @@ export const DATABASE_STACKS = ['postgres', 'mysql', 'sqlite', 'mongodb', 'none'
|
|
|
7
7
|
export const TEST_STACKS = ['vitest', 'jest'];
|
|
8
8
|
export const DOCS_UIS = ['swagger', 'scalar', 'redoc', 'none'];
|
|
9
9
|
export const CI_PLATFORMS = ['github', 'gitlab', 'both', 'none'];
|
|
10
|
-
export const AUTHN_STACKS = ['jwt', 'keycloak', 'none'];
|
|
10
|
+
export const AUTHN_STACKS = ['jwt', 'keycloak', 'passport', 'none'];
|
|
11
11
|
export const AUTHZ_STACKS = ['rbac', 'abac', 'rebac', 'custom'];
|
|
12
12
|
export const BROKER_STACKS = ['none', 'rabbitmq', 'kafka', 'nats', 'redis', 'custom'];
|
|
13
13
|
export const STYLES = ['declared', 'explicit'];
|
package/dist/config/stack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/config/stack.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAU,CAAC;AAC3G,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;A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tF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM;IACN,cAAc;IACd,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard-errors.d.ts","sourceRoot":"","sources":["../../src/describe/guard-errors.ts"],"names":[],"mappings":"AAMA,qHAAqH;AACrH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAE/D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What the guards of the kit document on the routes behind them. */
|
|
2
|
+
const GUARD_ERRORS = {
|
|
3
|
+
Authenticated: ['UNAUTHORIZED'],
|
|
4
|
+
HasRole: ['UNAUTHORIZED', 'FORBIDDEN'],
|
|
5
|
+
};
|
|
6
|
+
/** The codes the guards before a route answer, besides those it declares: `HasRole('admin')` answers 401 and 403. */
|
|
7
|
+
export function guardErrors(guards) {
|
|
8
|
+
return guards.flatMap((guard) => GUARD_ERRORS[guard.replace(/\(.*$/, '')] ?? []);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=guard-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard-errors.js","sourceRoot":"","sources":["../../src/describe/guard-errors.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,YAAY,GAAgD;IAChE,aAAa,EAAE,CAAC,cAAc,CAAC;IAC/B,OAAO,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;CACvC,CAAC;AAEF,qHAAqH;AACrH,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-group.d.ts","sourceRoot":"","sources":["../../src/describe/no-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,EAAE,cAA2E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-group.js","sourceRoot":"","sources":["../../src/describe/no-group.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAmB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteFact, UseCaseFact } from './context-description.js';
|
|
2
2
|
import type { ContextSources } from './context-sources.js';
|
|
3
|
-
/** The routes the controllers of a context declare, one per `*.controller.ts` file, with what their groups add. */
|
|
3
|
+
/** The routes the controllers of a context declare, one per `*.controller.ts` file and one per route method of a Nest controller, with what their groups add. */
|
|
4
4
|
export declare function readControllers(sources: ContextSources, useCases: readonly UseCaseFact[]): RouteFact[];
|
|
5
5
|
//# sourceMappingURL=read-controllers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-controllers.d.ts","sourceRoot":"","sources":["../../src/describe/read-controllers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,SAAS,EAAiB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"read-controllers.d.ts","sourceRoot":"","sources":["../../src/describe/read-controllers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,SAAS,EAAiB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAuBxD,iKAAiK;AACjK,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,EAAE,CAoBtG"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { filesUnder } from '../generate/files-under.js';
|
|
2
2
|
import { roleFoldersOf } from '../model-modules/index.js';
|
|
3
3
|
import { decoratorOptions } from './decorator-options.js';
|
|
4
|
+
import { guardErrors } from './guard-errors.js';
|
|
4
5
|
import { listedIn } from './listed-in.js';
|
|
5
6
|
import { presentationOfRoute } from './presentation-of-route.js';
|
|
6
7
|
import { readRouteGroups } from './read-route-groups.js';
|
|
8
|
+
import { NO_GROUP } from './no-group.js';
|
|
9
|
+
import { readNestControllerRoutes } from './read-nest-controller-routes.js';
|
|
10
|
+
import { schemaClassOf } from './schema-class-of.js';
|
|
7
11
|
const FOLDER = 'presentation/http';
|
|
12
|
+
const NEST_BRIDGE = "from '@ddd-ts-kit/http/nest'";
|
|
8
13
|
const PARTS = ['params', 'query', 'headers', 'body'];
|
|
9
|
-
/**
|
|
10
|
-
const GUARD_ERRORS = {
|
|
11
|
-
Authenticated: ['UNAUTHORIZED'],
|
|
12
|
-
HasRole: ['UNAUTHORIZED', 'FORBIDDEN'],
|
|
13
|
-
};
|
|
14
|
-
/** The routes the controllers of a context declare, one per `*.controller.ts` file, with what their groups add. */
|
|
14
|
+
/** The routes the controllers of a context declare, one per `*.controller.ts` file and one per route method of a Nest controller, with what their groups add. */
|
|
15
15
|
export function readControllers(sources, useCases) {
|
|
16
16
|
const { ws, directory } = sources;
|
|
17
17
|
const groups = readRouteGroups(ws, directory);
|
|
@@ -21,6 +21,9 @@ export function readControllers(sources, useCases) {
|
|
|
21
21
|
.filter((file) => file.endsWith('.controller.ts'))
|
|
22
22
|
.flatMap((path) => {
|
|
23
23
|
const source = ws.read(path) ?? '';
|
|
24
|
+
if (source.includes(NEST_BRIDGE)) {
|
|
25
|
+
return readNestControllerRoutes({ sources, file: path, groups }, useCases);
|
|
26
|
+
}
|
|
24
27
|
const options = decoratorOptions(source, 'Controller');
|
|
25
28
|
const mapper = ws.read(path.replace(/\.controller\.ts$/, '.mapper.ts')) ?? '';
|
|
26
29
|
return options === undefined ? [] : [routeOf({ file: path, source, mapper, options }, groups, useCases)];
|
|
@@ -48,7 +51,6 @@ function routeOf(read, groups, useCases) {
|
|
|
48
51
|
file,
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
|
-
const NO_GROUP = { name: '', prefix: '', guards: [], errors: [], tags: [] };
|
|
52
54
|
function field(options, key) {
|
|
53
55
|
const [, written = ''] = new RegExp(String.raw `\b${key}:\s*'([^']*)'`).exec(options) ?? [];
|
|
54
56
|
return written;
|
|
@@ -71,7 +73,7 @@ function operationIdOf(source) {
|
|
|
71
73
|
}
|
|
72
74
|
function errorsOf(options, group, guards) {
|
|
73
75
|
const own = listedIn(options, 'errors').map((entry) => entry.replace(/^['"]|['"]$/g, ''));
|
|
74
|
-
const guarded = guards
|
|
76
|
+
const guarded = guardErrors(guards);
|
|
75
77
|
return [...new Set([...guarded, ...group.errors, ...own])];
|
|
76
78
|
}
|
|
77
79
|
const RESPONSE = /\bresponse:\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/;
|
|
@@ -80,7 +82,7 @@ function requestOf(source, options) {
|
|
|
80
82
|
const outside = options.replace(RESPONSE, '');
|
|
81
83
|
return PARTS.flatMap((part) => {
|
|
82
84
|
const written = new RegExp(String.raw `(?:^|[\n,{])\s*${part}(?::\s*([^,\n]+?))?\s*,`).exec(outside);
|
|
83
|
-
return written === null ? [] : [{ part, schema:
|
|
85
|
+
return written === null ? [] : [{ part, schema: schemaClassOf(source, written[1] ?? part) }];
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
function responsesOf(source, options) {
|
|
@@ -89,15 +91,6 @@ function responsesOf(source, options) {
|
|
|
89
91
|
const body = /\bbody:\s*([\w.]+(?:\([\w.()]+\))?)/.exec(response)?.[1];
|
|
90
92
|
return status === undefined
|
|
91
93
|
? []
|
|
92
|
-
: [{ status: Number(status), schema: body === undefined ? '' :
|
|
93
|
-
}
|
|
94
|
-
/** The class a schema validates with, when it names one; else what the controller writes. */
|
|
95
|
-
function schemaName(source, written) {
|
|
96
|
-
const page = /^pageSchemaOf\((.+)\)$/.exec(written)?.[1];
|
|
97
|
-
if (page !== undefined) {
|
|
98
|
-
return `page of ${schemaName(source, page)}`;
|
|
99
|
-
}
|
|
100
|
-
const inline = /^classSchema\((\w+)/.exec(written)?.[1];
|
|
101
|
-
return inline ?? new RegExp(String.raw `\bconst ${written} = classSchema\((\w+)`).exec(source)?.[1] ?? written;
|
|
94
|
+
: [{ status: Number(status), schema: body === undefined ? '' : schemaClassOf(source, body) }];
|
|
102
95
|
}
|
|
103
96
|
//# sourceMappingURL=read-controllers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-controllers.js","sourceRoot":"","sources":["../../src/describe/read-controllers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"read-controllers.js","sourceRoot":"","sources":["../../src/describe/read-controllers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO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type { RouteFact, UseCaseFact } from './context-description.js';
|
|
2
|
+
import type { ContextSources } from './context-sources.js';
|
|
3
|
+
import type { RouteGroupFact } from './route-group-fact.js';
|
|
4
|
+
/** Where the Nest controllers of one file are read: the sources of the context and the route groups they may name. */
|
|
5
|
+
export interface NestControllerFile {
|
|
6
|
+
readonly sources: ContextSources;
|
|
7
|
+
readonly file: string;
|
|
8
|
+
readonly groups: ReadonlyMap<string, RouteGroupFact>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The routes of the Nest controllers the kit serves in one file, one per route method: its method
|
|
12
|
+
* and path from Nest's decorators under the prefix of its group, its parts and its answer from its
|
|
13
|
+
* signature, its refusal codes, guards and presentation from `@KitRoute` and `@KitRoutes`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readNestControllerRoutes({ sources, file, groups }: NestControllerFile, useCases: readonly UseCaseFact[]): RouteFact[];
|
|
16
|
+
//# sourceMappingURL=read-nest-controller-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-nest-controller-routes.d.ts","sourceRoot":"","sources":["../../src/describe/read-nest-controller-routes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,SAAS,EAAiB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,sHAAsH;AACtH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACtD;AAqBD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAC7C,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,SAAS,EAAE,CAab"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { scan } from '../check/scan/scan.js';
|
|
2
|
+
import { readStructure } from '../check/structure/read-structure.js';
|
|
3
|
+
import { nestControllersIn } from '../nest-controllers/nest-controllers-in.js';
|
|
4
|
+
import { decoratorOptions } from './decorator-options.js';
|
|
5
|
+
import { guardErrors } from './guard-errors.js';
|
|
6
|
+
import { listedIn } from './listed-in.js';
|
|
7
|
+
import { NO_GROUP } from './no-group.js';
|
|
8
|
+
import { presentationOfRoute } from './presentation-of-route.js';
|
|
9
|
+
import { schemaClassOf } from './schema-class-of.js';
|
|
10
|
+
const VERB = /@(Get|Post|Put|Patch|Delete|Head|Options)\s*\(\s*(?:'([^']*)')?/;
|
|
11
|
+
/**
|
|
12
|
+
* The routes of the Nest controllers the kit serves in one file, one per route method: its method
|
|
13
|
+
* and path from Nest's decorators under the prefix of its group, its parts and its answer from its
|
|
14
|
+
* signature, its refusal codes, guards and presentation from `@KitRoute` and `@KitRoutes`.
|
|
15
|
+
*/
|
|
16
|
+
export function readNestControllerRoutes({ sources, file, groups }, useCases) {
|
|
17
|
+
const { ws, config } = sources;
|
|
18
|
+
const text = ws.read(file) ?? '';
|
|
19
|
+
const classes = readStructure(scan(text)).classes;
|
|
20
|
+
const files = { read: (path) => ws.read(path), under: () => [] };
|
|
21
|
+
return nestControllersIn(files, config, file).flatMap((entry) => {
|
|
22
|
+
const shape = classes.find(({ name }) => name === entry.className);
|
|
23
|
+
return shape === undefined
|
|
24
|
+
? []
|
|
25
|
+
: methodsOf({ text, groups }, shape, entry).map((written) => routeOf(written, file, useCases));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** Each route method of the class, with its decorators and its body, and what the class says for all of them. */
|
|
29
|
+
function methodsOf({ text, groups }, shape, entry) {
|
|
30
|
+
const decorators = text.slice(Math.max(0, shape.start - 400), shape.start);
|
|
31
|
+
const shared = decoratorOptions(decorators, 'KitRoutes') ?? '';
|
|
32
|
+
const controller = {
|
|
33
|
+
path: /@Controller\(\s*'([^']*)'/.exec(decorators)?.[1] ?? '',
|
|
34
|
+
group: groups.get(/\bgroup:\s*([A-Za-z_$][\w$]*)/.exec(shared)?.[1] ?? '') ?? NO_GROUP,
|
|
35
|
+
shared,
|
|
36
|
+
};
|
|
37
|
+
let previous = shape.bodyStart;
|
|
38
|
+
return shape.methods.flatMap((written) => {
|
|
39
|
+
const before = text.slice(previous, written.start);
|
|
40
|
+
const method = entry.methods.find(({ name }) => name === written.name);
|
|
41
|
+
previous = written.end;
|
|
42
|
+
return method === undefined
|
|
43
|
+
? []
|
|
44
|
+
: [{ text, controller, method, decorators: before, body: text.slice(written.bodyStart, written.end) }];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function routeOf(written, file, useCases) {
|
|
48
|
+
const { controller, method, decorators, body } = written;
|
|
49
|
+
const options = decoratorOptions(decorators, 'KitRoute') ?? '';
|
|
50
|
+
const [, verb = '', path = ''] = VERB.exec(decorators) ?? [];
|
|
51
|
+
const { useCase, permission } = sentBy(body, useCases);
|
|
52
|
+
const operationId = /\boperationId:\s*'([^']*)'/.exec(options)?.[1] ?? method.name;
|
|
53
|
+
const guards = [...controller.group.guards, ...listedIn(controller.shared, 'guards'), ...listedIn(options, 'guards')];
|
|
54
|
+
return {
|
|
55
|
+
method: verb.toUpperCase(),
|
|
56
|
+
path: pathOf(controller, path),
|
|
57
|
+
operationId,
|
|
58
|
+
group: controller.group.name,
|
|
59
|
+
guards,
|
|
60
|
+
useCase,
|
|
61
|
+
permission,
|
|
62
|
+
request: requestOf(written, options),
|
|
63
|
+
responses: [responseOf(written, options, verb)],
|
|
64
|
+
errors: errorsOf(controller, options, guards),
|
|
65
|
+
...presentationOfRoute(options, operationId),
|
|
66
|
+
file,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** The use case the method sends a message of, and the permission it requires. */
|
|
70
|
+
function sentBy(body, useCases) {
|
|
71
|
+
const sent = /\bnew (\w+?)(Command|Query)\(/.exec(body);
|
|
72
|
+
const kind = sent?.[2] === 'Query' ? 'query' : 'command';
|
|
73
|
+
const useCase = sent?.[1] ?? '';
|
|
74
|
+
const permission = useCases.find((candidate) => candidate.kind === kind && candidate.name === useCase)?.permission;
|
|
75
|
+
return { useCase, permission: permission ?? '' };
|
|
76
|
+
}
|
|
77
|
+
/** What the guards answer, then the codes of the group, of the class and of the method. */
|
|
78
|
+
function errorsOf({ group, shared }, options, guards) {
|
|
79
|
+
const listed = [...group.errors, ...listedIn(shared, 'errors'), ...listedIn(options, 'errors')];
|
|
80
|
+
return [...new Set([...guardErrors(guards), ...listed.map((entry) => entry.replace(/^['"]|['"]$/g, ''))])];
|
|
81
|
+
}
|
|
82
|
+
/** The path of the group, then that of the class and that of the method, as Nest joins them. */
|
|
83
|
+
function pathOf({ path, group }, own) {
|
|
84
|
+
const rest = [path, own]
|
|
85
|
+
.map((part) => part.replace(/^\/+|\/+$/g, ''))
|
|
86
|
+
.filter((part) => part !== '')
|
|
87
|
+
.join('/');
|
|
88
|
+
return rest === '' ? group.prefix || '/' : `${group.prefix}/${rest}`;
|
|
89
|
+
}
|
|
90
|
+
/** Each part a parameter takes whole, by its class, or by the schema `request` of `@KitRoute` gives instead. */
|
|
91
|
+
function requestOf({ text, method }, options) {
|
|
92
|
+
const given = /\brequest:\s*\{([^{}]*)\}/.exec(options)?.[1] ?? '';
|
|
93
|
+
return method.request.map(({ source, type, declared }) => {
|
|
94
|
+
const member = new RegExp(String.raw `(?:^|,)\s*${source}\s*(?::\s*([\w.]+))?\s*(?:,|$)`).exec(given.trim());
|
|
95
|
+
if (declared && member !== null) {
|
|
96
|
+
return { part: source, schema: schemaClassOf(text, member[1] ?? source) };
|
|
97
|
+
}
|
|
98
|
+
return { part: source, schema: type.kind === 'class' ? type.name : type.text };
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** The status `@KitRoute`, `@HttpCode` or Nest gives, with the body `@KitRoute` declares or the signature answers. */
|
|
102
|
+
function responseOf({ text, method, decorators }, options, verb) {
|
|
103
|
+
const response = /\bresponse:\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/.exec(options)?.[1] ?? '';
|
|
104
|
+
const declared = /\bstatus:\s*(\d{3})/.exec(response)?.[1] ?? /@HttpCode\(\s*(\d{3})\s*\)/.exec(decorators)?.[1];
|
|
105
|
+
const body = /\bbody:\s*([\w.]+(?:\([\w.()]+\))?)/.exec(response)?.[1];
|
|
106
|
+
return {
|
|
107
|
+
status: declared === undefined ? (verb === 'Post' ? 201 : 200) : Number(declared),
|
|
108
|
+
schema: body === undefined ? answered(method.answer) : schemaClassOf(text, body),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function answered(answer) {
|
|
112
|
+
if (answer.kind === 'accepted') {
|
|
113
|
+
return 'acceptedSchema';
|
|
114
|
+
}
|
|
115
|
+
return answer.kind === 'class' ? answer.name : '';
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=read-nest-controller-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-nest-controller-routes.js","sourceRoot":"","sources":["../../src/describe/read-nest-controller-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,aAAa,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+
/** The class a schema validates with, when it names one; else what the controller writes. */
|
|
2
|
+
export function schemaClassOf(source, written) {
|
|
3
|
+
const page = /^pageSchemaOf\((.+)\)$/.exec(written)?.[1];
|
|
4
|
+
if (page !== undefined) {
|
|
5
|
+
return `page of ${schemaClassOf(source, page)}`;
|
|
6
|
+
}
|
|
7
|
+
const inline = /^classSchema\((\w+)/.exec(written)?.[1];
|
|
8
|
+
return inline ?? new RegExp(String.raw `\bconst ${written} = classSchema\((\w+)`).exec(source)?.[1] ?? written;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=schema-class-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-class-of.js","sourceRoot":"","sources":["../../src/describe/schema-class-of.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,OAAe;IAC3D,MAAM,IAAI,GAAG,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,WAAW,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,WAAW,OAAO,uBAAuB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;AAChH,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { StoredEventDeclaration } from '../check/event-sourcing/stored-event-declaration.js';
|
|
2
2
|
import type { Config } from '../config/index.js';
|
|
3
3
|
import type { Workspace } from '../workspace/index.js';
|
|
4
|
+
/** A stored event declaration with the codec file that holds it. */
|
|
5
|
+
export type CodecDeclaration = StoredEventDeclaration & {
|
|
6
|
+
readonly file: string;
|
|
7
|
+
};
|
|
4
8
|
/**
|
|
5
|
-
* The stored events the codecs of `infrastructure/persistence/` of these contexts declare, a key
|
|
9
|
+
* The stored events the codecs of `infrastructure/persistence/` of these contexts, and of each module of their model, declare, a key
|
|
6
10
|
* `[<Event>.eventName]` read from the events of `domain/events/`.
|
|
7
11
|
*/
|
|
8
|
-
export declare function declaredStoredEvents(ws: Workspace, config: Config, contexts: readonly string[]):
|
|
12
|
+
export declare function declaredStoredEvents(ws: Workspace, config: Config, contexts: readonly string[]): CodecDeclaration[];
|
|
9
13
|
//# sourceMappingURL=declared-stored-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-stored-events.d.ts","sourceRoot":"","sources":["../../src/docs/declared-stored-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAI/F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;GAGG;AACH,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"declared-stored-events.d.ts","sourceRoot":"","sources":["../../src/docs/declared-stored-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAI/F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAcnH"}
|
|
@@ -3,15 +3,16 @@ import { eventNameResolver } from '../check/events/event-name-resolver.js';
|
|
|
3
3
|
import { workspaceSources } from '../generate/workspace-sources.js';
|
|
4
4
|
import { roleFoldersOf, treeOf } from '../model-modules/index.js';
|
|
5
5
|
/**
|
|
6
|
-
* The stored events the codecs of `infrastructure/persistence/` of these contexts declare, a key
|
|
6
|
+
* The stored events the codecs of `infrastructure/persistence/` of these contexts, and of each module of their model, declare, a key
|
|
7
7
|
* `[<Event>.eventName]` read from the events of `domain/events/`.
|
|
8
8
|
*/
|
|
9
9
|
export function declaredStoredEvents(ws, config, contexts) {
|
|
10
10
|
const sources = workspaceSources(ws, config);
|
|
11
11
|
return contexts.flatMap((context) => {
|
|
12
|
-
const root = `${config.contextsDir}/${context}`;
|
|
13
12
|
const eventNameOf = eventNameResolver(roleFoldersOf(ws, treeOf(config, context), 'domain/events').flatMap((folder) => sourcesIn(ws, folder, sources)));
|
|
14
|
-
return
|
|
13
|
+
return roleFoldersOf(ws, treeOf(config, context), 'infrastructure/persistence')
|
|
14
|
+
.flatMap((folder) => sourcesIn(ws, folder, sources))
|
|
15
|
+
.flatMap((file) => storedEventDeclarations(file, eventNameOf).map((declaration) => ({ ...declaration, file: file.path })));
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
function sourcesIn(ws, directory, sources) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-stored-events.js","sourceRoot":"","sources":["../../src/docs/declared-stored-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"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OAAiD;IACpG,OAAO,EAAE;SACN,IAAI,CAAC,SAAS,CAAC;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACtC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `docs --check` holds against `stored-events.lock.json` besides the unrecorded versions: each version
|
|
3
|
+
* recorded with the hash of nothing, as `<event name> version <n>`. That lock vouches for no shape.
|
|
4
|
+
*/
|
|
5
|
+
export declare function emptilyRecordedStoredEvents(root: string): string[];
|
|
6
|
+
//# sourceMappingURL=emptily-recorded-stored-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptily-recorded-stored-events.d.ts","sourceRoot":"","sources":["../../src/docs/emptily-recorded-stored-events.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMlE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EMPTY_SHAPE_FINGERPRINT } from '../check/event-sourcing/read-stored-shape.js';
|
|
2
|
+
import { readStoredEventsLock } from '../check/event-sourcing/read-stored-events-lock.js';
|
|
3
|
+
/**
|
|
4
|
+
* What `docs --check` holds against `stored-events.lock.json` besides the unrecorded versions: each version
|
|
5
|
+
* recorded with the hash of nothing, as `<event name> version <n>`. That lock vouches for no shape.
|
|
6
|
+
*/
|
|
7
|
+
export function emptilyRecordedStoredEvents(root) {
|
|
8
|
+
return Object.entries(readStoredEventsLock(root)).flatMap(([name, versions]) => Object.entries(versions)
|
|
9
|
+
.filter(([, fingerprint]) => fingerprint === EMPTY_SHAPE_FINGERPRINT)
|
|
10
|
+
.map(([version]) => `${name} version ${version}`));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=emptily-recorded-stored-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptily-recorded-stored-events.js","sourceRoot":"","sources":["../../src/docs/emptily-recorded-stored-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAEvF;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAC7E,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,WAAW,KAAK,uBAAuB,CAAC;SACpE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,YAAY,OAAO,EAAE,CAAC,CACpD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CodecDeclaration } from './declared-stored-events.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refuses to record what the reader cannot read: a shape of no type found for its data or of no member would be
|
|
4
|
+
* recorded as the hash of nothing, and the lock would vouch for it. Nothing is written when one is refused.
|
|
5
|
+
*/
|
|
6
|
+
export declare function refuseUnreadableStoredEvents(declared: readonly CodecDeclaration[]): void;
|
|
7
|
+
//# sourceMappingURL=refuse-unreadable-stored-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refuse-unreadable-stored-events.d.ts","sourceRoot":"","sources":["../../src/docs/refuse-unreadable-stored-events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAaxF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CliError } from '../cli-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refuses to record what the reader cannot read: a shape of no type found for its data or of no member would be
|
|
4
|
+
* recorded as the hash of nothing, and the lock would vouch for it. Nothing is written when one is refused.
|
|
5
|
+
*/
|
|
6
|
+
export function refuseUnreadableStoredEvents(declared) {
|
|
7
|
+
const refused = declared.flatMap((declaration) => {
|
|
8
|
+
const reason = reasonOf(declaration);
|
|
9
|
+
return reason === undefined ? [] : [`${declaration.file}:${declaration.line}: ${reason}`];
|
|
10
|
+
});
|
|
11
|
+
if (refused.length > 0) {
|
|
12
|
+
throw new CliError(`Cannot record the stored shape of ${refused.length === 1 ? 'a stored event' : 'stored events'}, nothing is written:\n ${refused.join('\n ')}`, 'Declare the stored shape as a named type with its fields in the codec file (`interface InvoiceIssuedData { readonly cents: number }`), answer it from encode, then run `ddd-ts-kit docs --stored-events` again.');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Why the shape of a declaration cannot be recorded, or `undefined` when it can. */
|
|
16
|
+
function reasonOf({ eventClass, payloadType, fingerprint, emptyShape }) {
|
|
17
|
+
if (payloadType === undefined) {
|
|
18
|
+
return `the encode of ${eventClass} does not name the type of the data it stores`;
|
|
19
|
+
}
|
|
20
|
+
if (fingerprint === undefined) {
|
|
21
|
+
return `${payloadType}, the data of ${eventClass}, is not declared in this file`;
|
|
22
|
+
}
|
|
23
|
+
return emptyShape === true
|
|
24
|
+
? `${payloadType}, the data of ${eventClass}, declares no member: fill its fields, or write \`type ${payloadType} = Record<string, never>\` if the event carries nothing`
|
|
25
|
+
: undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=refuse-unreadable-stored-events.js.map
|
|
@@ -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AChB,CAAC"}
|
|
@@ -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) {
|