ddd-ts-kit 0.90.0 → 0.91.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 +285 -0
- package/README.fr.md +39 -7
- package/README.md +35 -6
- package/dist/alias/index.d.ts +2 -1
- package/dist/alias/index.d.ts.map +1 -1
- package/dist/alias/index.js +1 -0
- package/dist/alias/index.js.map +1 -1
- package/dist/alias/mapper-target-text.d.ts +4 -0
- package/dist/alias/mapper-target-text.d.ts.map +1 -0
- package/dist/alias/mapper-target-text.js +5 -0
- package/dist/alias/mapper-target-text.js.map +1 -0
- package/dist/alias/module-name-mapper.d.ts +5 -2
- package/dist/alias/module-name-mapper.d.ts.map +1 -1
- package/dist/alias/module-name-mapper.js +5 -2
- package/dist/alias/module-name-mapper.js.map +1 -1
- package/dist/check/alias/test-runners.js +8 -3
- package/dist/check/alias/test-runners.js.map +1 -1
- package/dist/check/baseline/apply-baseline.d.ts +14 -0
- package/dist/check/baseline/apply-baseline.d.ts.map +1 -0
- package/dist/check/baseline/apply-baseline.js +30 -0
- package/dist/check/baseline/apply-baseline.js.map +1 -0
- package/dist/check/baseline/baseline-following-moves.d.ts +9 -0
- package/dist/check/baseline/baseline-following-moves.d.ts.map +1 -0
- package/dist/check/baseline/baseline-following-moves.js +10 -0
- package/dist/check/baseline/baseline-following-moves.js.map +1 -0
- package/dist/check/baseline/baseline-move.d.ts +6 -0
- package/dist/check/baseline/baseline-move.d.ts.map +1 -0
- package/dist/check/baseline/baseline-move.js +2 -0
- package/dist/check/baseline/baseline-move.js.map +1 -0
- package/dist/check/baseline/baseline-text.d.ts +4 -0
- package/dist/check/baseline/baseline-text.d.ts.map +1 -0
- package/dist/check/baseline/baseline-text.js +12 -0
- package/dist/check/baseline/baseline-text.js.map +1 -0
- package/dist/check/baseline/baseline.d.ts +6 -0
- package/dist/check/baseline/baseline.d.ts.map +1 -0
- package/dist/check/baseline/baseline.js +2 -0
- package/dist/check/baseline/baseline.js.map +1 -0
- package/dist/check/baseline/moved-baseline-text.d.ts +4 -0
- package/dist/check/baseline/moved-baseline-text.d.ts.map +1 -0
- package/dist/check/baseline/moved-baseline-text.js +13 -0
- package/dist/check/baseline/moved-baseline-text.js.map +1 -0
- package/dist/check/baseline/parse-baseline.d.ts +4 -0
- package/dist/check/baseline/parse-baseline.d.ts.map +1 -0
- package/dist/check/baseline/parse-baseline.js +19 -0
- package/dist/check/baseline/parse-baseline.js.map +1 -0
- package/dist/check/baseline/pruned-baseline.d.ts +5 -0
- package/dist/check/baseline/pruned-baseline.d.ts.map +1 -0
- package/dist/check/baseline/pruned-baseline.js +14 -0
- package/dist/check/baseline/pruned-baseline.js.map +1 -0
- package/dist/check/baseline/read-baseline.d.ts +6 -0
- package/dist/check/baseline/read-baseline.d.ts.map +1 -0
- package/dist/check/baseline/read-baseline.js +11 -0
- package/dist/check/baseline/read-baseline.js.map +1 -0
- package/dist/check/baseline/recorded-baseline.d.ts +5 -0
- package/dist/check/baseline/recorded-baseline.d.ts.map +1 -0
- package/dist/check/baseline/recorded-baseline.js +11 -0
- package/dist/check/baseline/recorded-baseline.js.map +1 -0
- package/dist/check/baseline/renamed-files.d.ts +8 -0
- package/dist/check/baseline/renamed-files.d.ts.map +1 -0
- package/dist/check/baseline/renamed-files.js +23 -0
- package/dist/check/baseline/renamed-files.js.map +1 -0
- package/dist/check/baseline/write-baseline.d.ts +4 -0
- package/dist/check/baseline/write-baseline.d.ts.map +1 -0
- package/dist/check/baseline/write-baseline.js +9 -0
- package/dist/check/baseline/write-baseline.js.map +1 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -1
- package/dist/check/canonical/stray-entry.js +5 -1
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/commands/check-command.d.ts.map +1 -1
- package/dist/check/commands/check-command.js +46 -1
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/commands/check-file-command.d.ts +5 -0
- package/dist/check/commands/check-file-command.d.ts.map +1 -1
- package/dist/check/commands/check-file-command.js +27 -6
- package/dist/check/commands/check-file-command.js.map +1 -1
- package/dist/check/explain/nest-docs.d.ts +3 -0
- package/dist/check/explain/nest-docs.d.ts.map +1 -0
- package/dist/check/explain/nest-docs.js +31 -0
- package/dist/check/explain/nest-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.js +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts +3 -0
- package/dist/check/fixtures/nest-controllers-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/nest-controllers-fixtures.js +86 -0
- package/dist/check/fixtures/nest-controllers-fixtures.js.map +1 -0
- package/dist/check/fixtures/nest-fixtures.d.ts +3 -0
- package/dist/check/fixtures/nest-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/nest-fixtures.js +59 -0
- package/dist/check/fixtures/nest-fixtures.js.map +1 -0
- package/dist/check/nest/nest-equivalents-of.d.ts +14 -0
- package/dist/check/nest/nest-equivalents-of.d.ts.map +1 -0
- package/dist/check/nest/nest-equivalents-of.js +119 -0
- package/dist/check/nest/nest-equivalents-of.js.map +1 -0
- package/dist/check/project/load-project.d.ts +2 -0
- package/dist/check/project/load-project.d.ts.map +1 -1
- package/dist/check/project/load-project.js +7 -3
- package/dist/check/project/load-project.js.map +1 -1
- package/dist/check/rules/nest-controllers-current.d.ts +3 -0
- package/dist/check/rules/nest-controllers-current.d.ts.map +1 -0
- package/dist/check/rules/nest-controllers-current.js +43 -0
- package/dist/check/rules/nest-controllers-current.js.map +1 -0
- package/dist/check/rules/nest-no-parallel-pipeline.d.ts +3 -0
- package/dist/check/rules/nest-no-parallel-pipeline.d.ts.map +1 -0
- package/dist/check/rules/nest-no-parallel-pipeline.js +70 -0
- package/dist/check/rules/nest-no-parallel-pipeline.js.map +1 -0
- package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
- package/dist/check/support/is-generated-context-file.js +4 -1
- package/dist/check/support/is-generated-context-file.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-config.js +1 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/serialize-config.js +9 -2
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/config/stack.d.ts +17 -4
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +4 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +4 -1
- package/dist/dev/refresh-declarations.js.map +1 -1
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +2 -0
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/file-moves/move-files.d.ts.map +1 -1
- package/dist/file-moves/move-files.js +10 -0
- package/dist/file-moves/move-files.js.map +1 -1
- package/dist/generate/kinds/property-kind.d.ts +3 -0
- package/dist/generate/kinds/property-kind.d.ts.map +1 -0
- package/dist/generate/kinds/property-kind.js +51 -0
- package/dist/generate/kinds/property-kind.js.map +1 -0
- package/dist/generate/kinds/route/nest-controller-vars.d.ts +11 -0
- package/dist/generate/kinds/route/nest-controller-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/nest-controller-vars.js +97 -0
- package/dist/generate/kinds/route/nest-controller-vars.js.map +1 -0
- package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/route-vars.js +1 -9
- package/dist/generate/kinds/route/route-vars.js.map +1 -1
- package/dist/generate/kinds/route/success-status.d.ts +5 -0
- package/dist/generate/kinds/route/success-status.d.ts.map +1 -0
- package/dist/generate/kinds/route/success-status.js +11 -0
- package/dist/generate/kinds/route/success-status.js.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts +8 -0
- package/dist/generate/kinds/route/write-nest-controller.d.ts.map +1 -0
- package/dist/generate/kinds/route/write-nest-controller.js +52 -0
- package/dist/generate/kinds/route/write-nest-controller.js.map +1 -0
- package/dist/generate/kinds/route-kind.d.ts.map +1 -1
- package/dist/generate/kinds/route-kind.js +6 -1
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +2 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +2 -0
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +5 -0
- package/dist/generate/shared-writes.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 +4 -2
- package/dist/help/usage.js.map +1 -1
- package/dist/init/agent-permissions.js +2 -0
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/audit-files.js +1 -1
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +2 -0
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/knip-vars.d.ts.map +1 -1
- package/dist/init/knip-vars.js +10 -2
- package/dist/init/knip-vars.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts +18 -0
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -0
- package/dist/init/manifest/dependencies-against-stack.js +95 -0
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -0
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +12 -2
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/scripts-for.js +5 -2
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +30 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +14 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-queue.d.ts +4 -10
- package/dist/init/stack/resolve-queue.d.ts.map +1 -1
- package/dist/init/stack/resolve-queue.js +7 -11
- package/dist/init/stack/resolve-queue.js.map +1 -1
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +23 -4
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/nest-controllers/controllers-file.d.ts +3 -0
- package/dist/nest-controllers/controllers-file.d.ts.map +1 -0
- package/dist/nest-controllers/controllers-file.js +5 -0
- package/dist/nest-controllers/controllers-file.js.map +1 -0
- package/dist/nest-controllers/nest-answer.d.ts +16 -0
- package/dist/nest-controllers/nest-answer.d.ts.map +1 -0
- package/dist/nest-controllers/nest-answer.js +2 -0
- package/dist/nest-controllers/nest-answer.js.map +1 -0
- package/dist/nest-controllers/nest-controller-entry.d.ts +16 -0
- package/dist/nest-controllers/nest-controller-entry.d.ts.map +1 -0
- package/dist/nest-controllers/nest-controller-entry.js +2 -0
- package/dist/nest-controllers/nest-controller-entry.js.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts +15 -0
- package/dist/nest-controllers/read-nest-controllers.d.ts.map +1 -0
- package/dist/nest-controllers/read-nest-controllers.js +89 -0
- package/dist/nest-controllers/read-nest-controllers.js.map +1 -0
- package/dist/nest-controllers/refresh-nest-controllers.d.ts +9 -0
- package/dist/nest-controllers/refresh-nest-controllers.d.ts.map +1 -0
- package/dist/nest-controllers/refresh-nest-controllers.js +32 -0
- package/dist/nest-controllers/refresh-nest-controllers.js.map +1 -0
- package/dist/nest-controllers/render-controllers-file.d.ts +8 -0
- package/dist/nest-controllers/render-controllers-file.d.ts.map +1 -0
- package/dist/nest-controllers/render-controllers-file.js +56 -0
- package/dist/nest-controllers/render-controllers-file.js.map +1 -0
- package/dist/platform-folders/platform-folders.d.ts.map +1 -1
- package/dist/platform-folders/platform-folders.js +10 -0
- package/dist/platform-folders/platform-folders.js.map +1 -1
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +22 -2
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/identity-preset.d.ts.map +1 -1
- package/dist/presets/identity-preset.js +4 -1
- package/dist/presets/identity-preset.js.map +1 -1
- package/dist/presets/identity-refusal.d.ts.map +1 -1
- package/dist/presets/identity-refusal.js +11 -5
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/lay-out-prisma-models.d.ts +8 -0
- package/dist/presets/lay-out-prisma-models.d.ts.map +1 -0
- package/dist/presets/lay-out-prisma-models.js +51 -0
- package/dist/presets/lay-out-prisma-models.js.map +1 -0
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +3 -0
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/presets/preset.d.ts +11 -0
- package/dist/presets/preset.d.ts.map +1 -1
- package/dist/sdk/client-files.d.ts +5 -3
- package/dist/sdk/client-files.d.ts.map +1 -1
- package/dist/sdk/client-files.js +8 -3
- package/dist/sdk/client-files.js.map +1 -1
- package/dist/sdk/client-manifest.d.ts +3 -0
- package/dist/sdk/client-manifest.d.ts.map +1 -1
- package/dist/sdk/client-manifest.js +15 -2
- package/dist/sdk/client-manifest.js.map +1 -1
- package/dist/sdk/client-operation.d.ts +6 -0
- package/dist/sdk/client-operation.d.ts.map +1 -1
- package/dist/sdk/read-operation.d.ts.map +1 -1
- package/dist/sdk/read-operation.js +6 -0
- package/dist/sdk/read-operation.js.map +1 -1
- package/dist/sdk/render-orpc.d.ts +8 -0
- package/dist/sdk/render-orpc.d.ts.map +1 -0
- package/dist/sdk/render-orpc.js +42 -0
- package/dist/sdk/render-orpc.js.map +1 -0
- package/dist/sdk/render-readme.d.ts +3 -0
- package/dist/sdk/render-readme.d.ts.map +1 -1
- package/dist/sdk/render-readme.js +46 -0
- package/dist/sdk/render-readme.js.map +1 -1
- package/dist/sdk/render-trpc.d.ts +9 -0
- package/dist/sdk/render-trpc.d.ts.map +1 -0
- package/dist/sdk/render-trpc.js +36 -0
- package/dist/sdk/render-trpc.js.map +1 -0
- package/dist/sdk/rpc-packages.d.ts +7 -0
- package/dist/sdk/rpc-packages.d.ts.map +1 -0
- package/dist/sdk/rpc-packages.js +9 -0
- package/dist/sdk/rpc-packages.js.map +1 -0
- package/dist/sdk/rpc.d.ts +4 -0
- package/dist/sdk/rpc.d.ts.map +1 -0
- package/dist/sdk/rpc.js +2 -0
- package/dist/sdk/rpc.js.map +1 -0
- package/dist/sdk/write-clients.d.ts.map +1 -1
- package/dist/sdk/write-clients.js +18 -3
- package/dist/sdk/write-clients.js.map +1 -1
- package/dist/stack/alias-vars.d.ts.map +1 -1
- package/dist/stack/alias-vars.js +2 -2
- package/dist/stack/alias-vars.js.map +1 -1
- package/dist/stack/audit-vars.js +1 -1
- package/dist/stack/audit-vars.js.map +1 -1
- package/dist/stack/cache-vars.d.ts +5 -1
- package/dist/stack/cache-vars.d.ts.map +1 -1
- package/dist/stack/cache-vars.js +9 -3
- package/dist/stack/cache-vars.js.map +1 -1
- package/dist/stack/stack-vars.d.ts +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +11 -6
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/templates/architecture/extractable.declared.spec.ts.tpl +22 -17
- package/templates/architecture/extractable.manual.spec.ts.tpl +14 -9
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +19 -14
- package/templates/context/module.manual.ts.tpl +11 -0
- package/templates/init/jest.config.js.tpl +6 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +50 -0
- package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +9 -3
- package/templates/init/platform/database/persistence-over.drizzle.ts.tpl +1 -1
- package/templates/init/platform/database/persistence-over.knex.ts.tpl +1 -1
- package/templates/init/platform/database/persistence-over.prisma.ts.tpl +7 -1
- package/templates/init/platform/database/persistence-over.typeorm.ts.tpl +23 -1
- package/templates/init/platform/database/persistence.contract.spec.ts.tpl +113 -0
- package/templates/init/platform/database/persistence.orm.ts.tpl +8 -3
- package/templates/init/platform/database/schema.prisma.tpl +3 -1
- package/templates/init/platform/database/schema.typeorm.ts.tpl +17 -3
- package/templates/init/platform/database/table-statements.drizzle.ts.tpl +36 -0
- package/templates/init/platform/files/bind-files.tsyringe.ts.tpl +1 -1
- package/templates/init/platform/files/create-files.ts.tpl +1 -1
- package/templates/init/platform/http/create-app-module.ts.tpl +20 -0
- package/templates/init/platform/http/start-http-server.express.ts.tpl +48 -1
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +50 -2
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +60 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +61 -3
- package/templates/init/platform/jobs/create-background-work.ts.tpl +2 -2
- package/templates/init/rules/infrastructure.md.tpl +3 -0
- package/templates/init/rules/presentation.md.tpl +7 -0
- package/templates/nest-controller/controller.spec.ts.tpl +57 -0
- package/templates/nest-controller/controller.ts.tpl +65 -0
- package/templates/pipeline/knip.json.tpl +4 -8
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/__context__.module.explicit.ts.tpl +254 -0
- package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +6 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/integration/handlers/account-deactivated.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/member-joined.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/member-removed.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/handlers/organisation-opened.integration-handler.ts.tpl +4 -0
- package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +10 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +12 -0
- package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +6 -0
- package/templates/presets/identity/context/infrastructure/external/crypto-invitation-tokens.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/external/environment-identity-provider-connection.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/external/keycloak-identity-provider-admin.adapter.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.mapper.prisma.ts.tpl +36 -0
- package/templates/presets/identity/context/infrastructure/persistence/account.personal-fields.privacy.prisma.ts.tpl +19 -0
- package/templates/presets/identity/context/infrastructure/persistence/delegation.mapper.prisma.ts.tpl +48 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.mapper.prisma.ts.tpl +43 -0
- package/templates/presets/identity/context/infrastructure/persistence/invitation.personal-fields.privacy.prisma.ts.tpl +20 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-account.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-delegation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-invitation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-member.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-organisation.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-search-members-reader.repository.knex.ts.tpl +9 -0
- package/templates/presets/identity/context/infrastructure/persistence/member.mapper.prisma.ts.tpl +34 -0
- package/templates/presets/identity/context/infrastructure/persistence/organisation.mapper.prisma.ts.tpl +26 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-account.repository.prisma.ts.tpl +63 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-delegation.repository.prisma.ts.tpl +81 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-invitation.repository.prisma.ts.tpl +69 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-member.repository.prisma.ts.tpl +80 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation.repository.prisma.ts.tpl +63 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-search-members-reader.repository.prisma.ts.tpl +82 -0
- package/templates/presets/identity/context/test/integration/account.repository.contract.spec.ts.tpl +3 -3
- package/templates/presets/identity/context/test/integration/delegation.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/invitation.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/member.repository.contract.spec.ts.tpl +5 -5
- package/templates/presets/identity/context/test/integration/organisation.repository.contract.spec.ts.tpl +3 -3
- package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +8 -8
- package/templates/presets/identity/context/test/unit/__context__.module.spec.explicit.ts.tpl +95 -0
- package/templates/presets/identity/context/test/worlds/__context__.world.explicit.ts.tpl +332 -0
- package/templates/presets/identity/explicit/access-policies.wiring.tpl +16 -0
- package/templates/presets/identity/prisma/models.prisma.tpl +128 -0
- package/templates/property/value-object.properties.spec.ts.tpl +38 -0
- package/templates/sdk/orpc.ts.tpl +46 -0
- package/templates/sdk/trpc.ts.tpl +86 -0
- /package/templates/presets/identity/context/test/worlds/{__context__.world.ts.tpl → __context__.world.declared.ts.tpl} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { filesUnder } from '../generate/files-under.js';
|
|
2
|
+
import { toName } from '../naming/index.js';
|
|
3
|
+
import { controllersFile } from './controllers-file.js';
|
|
4
|
+
import { readNestControllers } from './read-nest-controllers.js';
|
|
5
|
+
import { renderControllersFile } from './render-controllers-file.js';
|
|
6
|
+
/**
|
|
7
|
+
* Rewrites `<context>.controllers.ts` of every context of a project whose routes are Nest
|
|
8
|
+
* controllers, from its controllers and the signatures of their methods. Called with the other
|
|
9
|
+
* generated files: at the end of every `generate`, by `docs` and by the `dev` script.
|
|
10
|
+
*/
|
|
11
|
+
export function refreshNestControllers(ws, config) {
|
|
12
|
+
if (config.stack.routes !== 'nest') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const files = {
|
|
16
|
+
read: (file) => ws.read(file),
|
|
17
|
+
under: (directory) => filesUnder(ws, directory).map((file) => `${directory}/${file}`),
|
|
18
|
+
};
|
|
19
|
+
for (const context of ws.directories(config.contextsDir).filter((name) => config.contexts[name] !== undefined)) {
|
|
20
|
+
const file = `${config.contextsDir}/${context}/${controllersFile(context)}`;
|
|
21
|
+
const content = renderControllersFile(context, `${toName(context).camel}Controllers`, readNestControllers(files, config, context));
|
|
22
|
+
if (ws.read(file) !== content) {
|
|
23
|
+
if (ws.exists(file)) {
|
|
24
|
+
ws.update(file, content);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
ws.create(file, content);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=refresh-nest-controllers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-nest-controllers.js","sourceRoot":"","sources":["../../src/nest-controllers/refresh-nest-controllers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBA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C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NestControllerEntry } from './nest-controller-entry.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<context>.controllers.ts`: the Nest controllers of a context, each with what its methods answer
|
|
4
|
+
* as their signatures say it, for the module to list and the bridge to read. A method whose answer
|
|
5
|
+
* cannot be read is left out: `@KitRoute` says it, or `nest/controllers-current` reports it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderControllersFile(context: string, constant: string, entries: readonly NestControllerEntry[]): string;
|
|
8
|
+
//# sourceMappingURL=render-controllers-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-controllers-file.d.ts","sourceRoot":"","sources":["../../src/nest-controllers/render-controllers-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,mBAAmB,EAAE,GACtC,MAAM,CAYR"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const WIDTH = 120;
|
|
2
|
+
/**
|
|
3
|
+
* `<context>.controllers.ts`: the Nest controllers of a context, each with what its methods answer
|
|
4
|
+
* as their signatures say it, for the module to list and the bridge to read. A method whose answer
|
|
5
|
+
* cannot be read is left out: `@KitRoute` says it, or `nest/controllers-current` reports it.
|
|
6
|
+
*/
|
|
7
|
+
export function renderControllersFile(context, constant, entries) {
|
|
8
|
+
const list = entries.length === 0
|
|
9
|
+
? ' = [];'
|
|
10
|
+
: ` = [\n${entries.map((entry) => `${entryOf(entry.className, answersOf(entry))}\n`).join('')}];`;
|
|
11
|
+
return `// Generated by ddd-ts-kit from the Nest controllers of ${context} and the signatures of their methods: never edit it.
|
|
12
|
+
${importsOf(entries).join('\n')}
|
|
13
|
+
|
|
14
|
+
/** The Nest controllers of ${context}, each with what its methods answer: the module of the context lists them, Nest builds them. */
|
|
15
|
+
export const ${constant}: readonly Type<unknown>[]${list}
|
|
16
|
+
`;
|
|
17
|
+
}
|
|
18
|
+
/** The import lines: the bridge and the schema of an identifier when they are used, the controllers, then the DTO classes they answer. */
|
|
19
|
+
function importsOf(entries) {
|
|
20
|
+
const answers = entries.flatMap(({ methods }) => methods.map(({ answer }) => answer));
|
|
21
|
+
const types = new Map(answers.flatMap((answer) => (answer.kind === 'class' ? [[answer.name, answer.specifier]] : [])));
|
|
22
|
+
return [
|
|
23
|
+
...new Set([
|
|
24
|
+
...(answers.some(({ kind }) => kind === 'accepted')
|
|
25
|
+
? ["import { acceptedSchema } from '@ddd-ts-kit/http';"]
|
|
26
|
+
: []),
|
|
27
|
+
...(entries.length === 0 ? [] : ["import { withAnswers } from '@ddd-ts-kit/http/nest';"]),
|
|
28
|
+
"import type { Type } from '@nestjs/common';",
|
|
29
|
+
...entries.map(({ className, specifier }) => `import { ${className} } from '${specifier}';`),
|
|
30
|
+
...[...types].map(([name, specifier]) => `import { ${name} } from '${specifier}';`),
|
|
31
|
+
]),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/** What each method answers, as `withAnswers` takes it; a method whose answer could not be read is left out. */
|
|
35
|
+
function answersOf({ methods }) {
|
|
36
|
+
return methods.flatMap(({ name, answer }) => {
|
|
37
|
+
if (answer.kind === 'none') {
|
|
38
|
+
return [`${name}: null`];
|
|
39
|
+
}
|
|
40
|
+
if (answer.kind === 'accepted') {
|
|
41
|
+
return [`${name}: acceptedSchema`];
|
|
42
|
+
}
|
|
43
|
+
return answer.kind === 'class' ? [`${name}: ${answer.name}`] : [];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** One entry of the list, on one line when the formatter would keep it there. */
|
|
47
|
+
function entryOf(className, answers) {
|
|
48
|
+
if (answers.length === 0) {
|
|
49
|
+
return ` withAnswers(${className}, {}),`;
|
|
50
|
+
}
|
|
51
|
+
const line = ` withAnswers(${className}, { ${answers.join(', ')} }),`;
|
|
52
|
+
return line.length <= WIDTH
|
|
53
|
+
? line
|
|
54
|
+
: ` withAnswers(${className}, {\n${answers.map((answer) => ` ${answer},\n`).join('')} }),`;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=render-controllers-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-controllers-file.js","sourceRoot":"","sources":["../../src/nest-controllers/render-controllers-file.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,QAAgB,EAChB,OAAuC;IAEvC,MAAM,IAAI,GACR,OAAO,CAAC,MAAM,KAAK,CAAC;QAClB,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;IAEtG,OAAO,2DAA2D,OAAO;EACzE,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;8BAED,OAAO;eACtB,QAAQ,6BAA6B,IAAI;CACvD,CAAC;AACF,CAAC;AAED,0IAA0I;AAC1I,SAAS,SAAS,CAAC,OAAuC;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtF,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,OAAO,CAAC,OAAO,CAAC,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QAED,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iFAAiF;AACjF,SAAS,OAAO,CAAC,SAAiB,EAAE,OAA0B;IAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,iBAAiB,SAAS,QAAQ,CAAC;IAC5C,CAAC;IAED,MAAM,IAAI,GAAG,iBAAiB,SAAS,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAEvE,OAAO,IAAI,CAAC,MAAM,IAAI,KAAK;QACzB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,iBAAiB,SAAS,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;AACpG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-folders.d.ts","sourceRoot":"","sources":["../../src/platform-folders/platform-folders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform-folders.d.ts","sourceRoot":"","sources":["../../src/platform-folders/platform-folders.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,GAAG,eAAe,CAqClF"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { aliasRoots } from '../alias/index.js';
|
|
2
|
+
import { movedBaselineText } from '../check/baseline/moved-baseline-text.js';
|
|
3
|
+
import { BASELINE_FILE } from '../check/baseline/read-baseline.js';
|
|
2
4
|
import { projectSources } from '../refusals/project-sources.js';
|
|
3
5
|
import { platformMoves } from './platform-moves.js';
|
|
4
6
|
import { unknownFlatFiles } from './unknown-flat-files.js';
|
|
@@ -33,6 +35,7 @@ export function platformFolders(tree, draft) {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
rewriteScripts(draft, moves);
|
|
38
|
+
followInBaseline(draft, moves);
|
|
36
39
|
const platform = `${tree.config.platformDir}/`;
|
|
37
40
|
const left = unknownFlatFiles(tree.ws, tree.config).filter((file) => !moves.some(({ from }) => from === `${platform}${file}`));
|
|
38
41
|
if (left.length > 0) {
|
|
@@ -41,6 +44,13 @@ export function platformFolders(tree, draft) {
|
|
|
41
44
|
return { moved: moves, rewritten };
|
|
42
45
|
}
|
|
43
46
|
/** `dev` preloads the tracing module by its path: the scripts name it where it is now. */
|
|
47
|
+
/** The errors the baseline of the project records for a moved file follow it to its new path. */
|
|
48
|
+
function followInBaseline(draft, moves) {
|
|
49
|
+
const baseline = movedBaselineText(draft.read(BASELINE_FILE), moves);
|
|
50
|
+
if (baseline !== undefined) {
|
|
51
|
+
draft.write(BASELINE_FILE, baseline);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
44
54
|
function rewriteScripts(draft, moves) {
|
|
45
55
|
const manifest = draft.read('package.json');
|
|
46
56
|
if (manifest !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-folders.js","sourceRoot":"","sources":["../../src/platform-folders/platform-folders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"platform-folders.js","sourceRoot":"","sources":["../../src/platform-folders/platform-folders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,SAAS,GAAG,cAAc,CAAC;AAgBjC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU,EAAE,KAAqB;IAC/D,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7G,MAAM,UAAU,GAAG,EAAE,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"version":3,"file":"apply-preset.d.ts","sourceRoot":"","sources":["../../src/presets/apply-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AASlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-preset.d.ts","sourceRoot":"","sources":["../../src/presets/apply-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AASlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CA6BzF"}
|
|
@@ -4,7 +4,10 @@ import { learnTerms } from '../generate/learn-terms.js';
|
|
|
4
4
|
import { vars } from '../generate/vars.js';
|
|
5
5
|
import { parseContextName } from '../naming/index.js';
|
|
6
6
|
import { renderTemplate } from '../templating/index.js';
|
|
7
|
+
import { applyWiring } from '../generate/apply-wiring.js';
|
|
8
|
+
import { platformPath } from '../generate/platform-path.js';
|
|
7
9
|
import { grantToSignedIn } from './grant-to-signed-in.js';
|
|
10
|
+
import { layOutPrismaModels } from './lay-out-prisma-models.js';
|
|
8
11
|
import { NO_FLAGS } from './no-flags.js';
|
|
9
12
|
import { organisationsAsTenants } from './organisations-as-tenants.js';
|
|
10
13
|
import { presetDecision } from './preset-decision.js';
|
|
@@ -22,14 +25,26 @@ export function applyPreset(ws, config, request) {
|
|
|
22
25
|
assertNoTwin(ws, config, request);
|
|
23
26
|
const scope = scopeOf(ws, config, request);
|
|
24
27
|
const adr = presetDecision(scope, preset.name);
|
|
25
|
-
const rendering = { preset: preset.name, context: vars(scope, { preset: { adr } }) };
|
|
28
|
+
const rendering = { preset: preset.name, context: vars(scope, { preset: { adr, adapter: adapterOf(config) } }) };
|
|
26
29
|
learnTerms(scope);
|
|
27
30
|
writeFiles(scope, preset.files(config).filter((file) => file.afterSteps !== true), rendering);
|
|
28
31
|
const wired = runSteps(scope, preset);
|
|
29
|
-
|
|
32
|
+
layOutAfterSteps({ ...scope, config: wired }, preset, rendering);
|
|
30
33
|
describeContext(scope, preset, rendering);
|
|
31
34
|
return wired;
|
|
32
35
|
}
|
|
36
|
+
/** What the generators started and the preset lays out whole: its files of after the steps, its policies in the explicit style, its models on Prisma. */
|
|
37
|
+
function layOutAfterSteps(scope, preset, rendering) {
|
|
38
|
+
const render = (template) => renderTemplate(`presets/${preset.name}/${template}`, rendering.context);
|
|
39
|
+
const { style, orm } = scope.config.stack;
|
|
40
|
+
writeFiles(scope, preset.files(scope.config).filter((file) => file.afterSteps === true), rendering);
|
|
41
|
+
if (preset.explicitPolicies !== undefined && style === 'explicit') {
|
|
42
|
+
applyWiring(scope.ws, platformPath(scope, 'auth/authorization/access-policies.ts'), render(preset.explicitPolicies));
|
|
43
|
+
}
|
|
44
|
+
if (preset.prismaModels !== undefined && orm === 'prisma') {
|
|
45
|
+
layOutPrismaModels(scope.ws, render(preset.prismaModels));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
33
48
|
/** One context of each preset kind: two would declare the same facts, routes and platform files, and could not live together. */
|
|
34
49
|
function assertNoTwin(ws, config, { context, preset }) {
|
|
35
50
|
const own = parseContextName(context).kebab;
|
|
@@ -50,6 +65,11 @@ function describeContext(scope, preset, rendering) {
|
|
|
50
65
|
.replace('## Aggregates', `${design}## Aggregates`);
|
|
51
66
|
scope.ws.update(file, text);
|
|
52
67
|
}
|
|
68
|
+
/** The prefix of the adapters the persistence of the project names its classes and files by: `Prisma`, `prisma`. */
|
|
69
|
+
function adapterOf(config) {
|
|
70
|
+
const { orm } = config.stack;
|
|
71
|
+
return { pascal: `${orm.charAt(0).toUpperCase()}${orm.slice(1)}`, kebab: orm };
|
|
72
|
+
}
|
|
53
73
|
function scopeOf(ws, config, { context, preset }) {
|
|
54
74
|
const name = parseContextName(context);
|
|
55
75
|
const term = preset.terms.map((row) => `${row.term}=${row.meaning}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-preset.js","sourceRoot":"","sources":["../../src/presets/apply-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAe,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAa,EAAE,MAAc,EAAE,OAAsB;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IAED,YAAY,CAAC,EAAE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AC,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-preset.d.ts","sourceRoot":"","sources":["../../src/presets/identity-preset.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-preset.d.ts","sourceRoot":"","sources":["../../src/presets/identity-preset.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiCvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,MA0B5B,CAAC"}
|
|
@@ -3,8 +3,9 @@ import { repositoryKind } from '../generate/kinds/repository-kind.js';
|
|
|
3
3
|
import { identityRefusal } from './identity-refusal.js';
|
|
4
4
|
import { IDENTITY_TERMS } from './identity-terms.js';
|
|
5
5
|
import { presetFiles } from './preset-files.js';
|
|
6
|
-
/** The tables of the context: the
|
|
6
|
+
/** The tables of the context and, in the explicit style, its module: the generators start them, the preset lays them out whole. */
|
|
7
7
|
const AFTER_STEPS = [
|
|
8
|
+
'__context__.module.ts',
|
|
8
9
|
'infrastructure/persistence/create-__context__-tables.schema.ts',
|
|
9
10
|
'infrastructure/persistence/__context__.schema.ts',
|
|
10
11
|
];
|
|
@@ -56,5 +57,7 @@ export const identityPreset = {
|
|
|
56
57
|
organisationsAreTenants: true,
|
|
57
58
|
signature: 'domain/services/role-rights.service.ts',
|
|
58
59
|
files: (config) => presetFiles('identity', config, AFTER_STEPS),
|
|
60
|
+
prismaModels: 'prisma/models.prisma.tpl',
|
|
61
|
+
explicitPolicies: 'explicit/access-policies.wiring.tpl',
|
|
59
62
|
};
|
|
60
63
|
//# sourceMappingURL=identity-preset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-preset.js","sourceRoot":"","sources":["../../src/presets/identity-preset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,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-refusal.d.ts","sourceRoot":"","sources":["../../src/presets/identity-refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyBtD,0IAA0I;AAC1I,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAuBzE"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/** What the identity preset is written for, each with the value it needs and the flag of `init` that gives it. */
|
|
2
2
|
const NEEDED = [
|
|
3
|
-
{ key: '
|
|
4
|
-
{ key: 'dependencies', values: ['signature'], flag: '--dependencies signature' },
|
|
3
|
+
{ key: 'dependencies', values: ['signature'], flag: '--dependencies signature', declaredOnly: true },
|
|
5
4
|
{ key: 'refusals', values: ['named', 'factories'], flag: '--refusals named or --refusals factories' },
|
|
6
5
|
{ key: 'valueObjects', values: ['throwing'], flag: '--value-objects throwing' },
|
|
7
6
|
{ key: 'routes', values: ['controllers'], flag: '--routes controllers' },
|
|
8
|
-
{ key: 'orm', values: ['knex', 'drizzle'], flag: '--orm knex or --orm
|
|
7
|
+
{ key: 'orm', values: ['knex', 'drizzle', 'prisma'], flag: '--orm knex, --orm drizzle or --orm prisma' },
|
|
9
8
|
{ key: 'validation', values: ['zod', 'class-validator'], flag: '--validation zod or --validation class-validator' },
|
|
10
|
-
{ key: 'http', values: ['express', 'fastify'], flag: '--http express or --http
|
|
9
|
+
{ key: 'http', values: ['express', 'fastify', 'nest'], flag: '--http express, --http fastify or --http nest' },
|
|
11
10
|
{
|
|
12
11
|
key: 'authn',
|
|
13
12
|
values: ['jwt', 'keycloak'],
|
|
@@ -17,7 +16,14 @@ const NEEDED = [
|
|
|
17
16
|
];
|
|
18
17
|
/** The identity preset is written for the defaults of `init` and their nearest variants; another stack is refused with what to change. */
|
|
19
18
|
export function identityRefusal(config) {
|
|
20
|
-
const
|
|
19
|
+
const { style, di } = config.stack;
|
|
20
|
+
if (style === 'explicit' && di === 'tsyringe') {
|
|
21
|
+
return {
|
|
22
|
+
message: 'The identity preset is not written for "stack.style": "explicit" with "stack.di": "tsyringe".',
|
|
23
|
+
fix: 'In the explicit style it is written for --di manual and --di nest, whose module file lists every binding; on tsyringe, keep --style declared, which init writes by default (docs/guides/bootstrap-with-well-designed-contexts.md says why).',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const missing = NEEDED.find(({ key, values, declaredOnly }) => (declaredOnly !== true || style === 'declared') && !values.includes(config.stack[key]));
|
|
21
27
|
if (missing === undefined) {
|
|
22
28
|
return undefined;
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../../src/presets/identity-refusal.ts"],"names":[],"mappings":"AAGA,kHAAkH;AAClH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../../src/presets/identity-refusal.ts"],"names":[],"mappings":"AAGA,kHAAkH;AAClH,MAAM,MAAM,GAMN;IACJ,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,YAAY,EAAE,IAAI,EAAE;IACpG,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,0CAA0C,EAAE;IACrG,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC/E,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,s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OAAO,EAAE,iDAAiD,OAAO,CAAC,GAAG,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI;QACzG,GAAG,EAAE,YAAY,OAAO,CAAC,IAAI,yKAAyK;KACvM,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Workspace } from '../workspace/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The models of a preset in `prisma/schema.prisma`: each takes the place of the model of the same
|
|
4
|
+
* name its repository generator started, the others join the models region, and the generator of
|
|
5
|
+
* the client turns on the partial indexes the preset relies on.
|
|
6
|
+
*/
|
|
7
|
+
export declare function layOutPrismaModels(ws: Workspace, models: string): void;
|
|
8
|
+
//# sourceMappingURL=lay-out-prisma-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lay-out-prisma-models.d.ts","sourceRoot":"","sources":["../../src/presets/lay-out-prisma-models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAa9C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAgBtE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const PRISMA_SCHEMA = 'prisma/schema.prisma';
|
|
2
|
+
/** Where the models of the contexts end in the schema `init` writes. */
|
|
3
|
+
const END_OF_MODELS = '// /ddd-ts-kit:models';
|
|
4
|
+
/** One model or enum of a schema, its documentation comments included. */
|
|
5
|
+
const BLOCK = /^(?:\/\/\/[^\n]*\n)*(model|enum) (\w+) \{\n[\s\S]*?^\}$/gm;
|
|
6
|
+
/** What a partial unique index (`@@unique(..., where: ...)`) needs of the generator. */
|
|
7
|
+
const PARTIAL_INDEXES = 'partialIndexes';
|
|
8
|
+
/**
|
|
9
|
+
* The models of a preset in `prisma/schema.prisma`: each takes the place of the model of the same
|
|
10
|
+
* name its repository generator started, the others join the models region, and the generator of
|
|
11
|
+
* the client turns on the partial indexes the preset relies on.
|
|
12
|
+
*/
|
|
13
|
+
export function layOutPrismaModels(ws, models) {
|
|
14
|
+
const schema = ws.read(PRISMA_SCHEMA);
|
|
15
|
+
if (schema === undefined) {
|
|
16
|
+
ws.note(`${PRISMA_SCHEMA} does not exist: copy the models of the preset into it by hand.`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const laidOut = [...models.matchAll(BLOCK)].reduce((content, [block, kind, name]) => withBlock(content, block, `${kind ?? ''} ${name ?? ''}`), withPreviewFeature(schema, PARTIAL_INDEXES));
|
|
20
|
+
ws.update(PRISMA_SCHEMA, laidOut);
|
|
21
|
+
ws.note(`${PRISMA_SCHEMA} changed: run \`npm run db:client\` to regenerate the client and the schema of the tests.`);
|
|
22
|
+
}
|
|
23
|
+
function withBlock(content, block, header) {
|
|
24
|
+
const existing = new RegExp(`^(?:///[^\\n]*\\n)*${header} \\{\\n[\\s\\S]*?^\\}$`, 'm');
|
|
25
|
+
if (existing.test(content)) {
|
|
26
|
+
return content.replace(existing, () => block);
|
|
27
|
+
}
|
|
28
|
+
const end = content.indexOf(END_OF_MODELS);
|
|
29
|
+
return end === -1
|
|
30
|
+
? `${content.trimEnd()}\n\n${block}\n`
|
|
31
|
+
: `${content.slice(0, end).trimEnd()}\n\n${block}\n${content.slice(end)}`;
|
|
32
|
+
}
|
|
33
|
+
/** The generator of the client with `feature` among its preview features, its assignments kept aligned. */
|
|
34
|
+
function withPreviewFeature(schema, feature) {
|
|
35
|
+
const body = /^generator client \{\n([\s\S]*?)^\}$/m.exec(schema)?.[1];
|
|
36
|
+
return body === undefined ? schema : schema.replace(body, generatorWith(body, feature));
|
|
37
|
+
}
|
|
38
|
+
function generatorWith(body, feature) {
|
|
39
|
+
const listed = /^(\s*previewFeatures\s*=\s*\[)([^\]]*)\]/m.exec(body);
|
|
40
|
+
if (listed === null) {
|
|
41
|
+
const column = /^(\s*\w+\s*)=/m.exec(body)?.[1]?.length ?? 0;
|
|
42
|
+
return `${body}${' previewFeatures'.padEnd(column)}= ["${feature}"]\n`;
|
|
43
|
+
}
|
|
44
|
+
const [assignment, opening = '', features = ''] = listed;
|
|
45
|
+
if (features.includes(`"${feature}"`)) {
|
|
46
|
+
return body;
|
|
47
|
+
}
|
|
48
|
+
const all = [features.trim(), `"${feature}"`].filter((one) => one !== '');
|
|
49
|
+
return body.replace(assignment, `${opening}${all.join(', ')}]`);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=lay-out-prisma-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lay-out-prisma-models.js","sourceRoot":"","sources":["../../src/presets/lay-out-prisma-models.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAE7C,wEAAwE;AACxE,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C,0EAA0E;AAC1E,MAAM,KAAK,GAAG,2DAA2D,CAAC;AAE1E,wFAAwF;AACxF,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAa,EAAE,MAAc;IAC9D,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEtC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,EAAE,CAAC,IAAI,CAAC,GAAG,aAAa,iEAAiE,CAAC,CAAC;QAE3F,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAChD,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC,EAC1F,kBAAkB,CAAC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AI,CAAC,CAAC;IAEtE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;QAE7D,OAAO,GAAG,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,OAAO,MAAM,CAAC;IAC1E,CAAC;IAED,MAAM,CAAC,UAAU,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC;IAEzD,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IAE1E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-files.d.ts","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"preset-files.d.ts","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2BhD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,EAAE,CAevG"}
|
|
@@ -7,6 +7,7 @@ import { listTemplates } from '../templating/index.js';
|
|
|
7
7
|
const VARIANTS = {
|
|
8
8
|
knex: (config) => config.stack.orm === 'knex',
|
|
9
9
|
drizzle: (config) => config.stack.orm === 'drizzle',
|
|
10
|
+
prisma: (config) => config.stack.orm === 'prisma',
|
|
10
11
|
zod: (config) => config.stack.validation === 'zod',
|
|
11
12
|
'class-validator': (config) => config.stack.validation === 'class-validator',
|
|
12
13
|
'per-route': (config) => config.stack.schemas === 'per-route',
|
|
@@ -14,6 +15,8 @@ const VARIANTS = {
|
|
|
14
15
|
named: (config) => config.stack.refusals === 'named',
|
|
15
16
|
factories: (config) => config.stack.refusals === 'factories',
|
|
16
17
|
privacy: (config) => config.stack.privacy === 'on',
|
|
18
|
+
declared: (config) => config.stack.style === 'declared',
|
|
19
|
+
explicit: (config) => config.stack.style === 'explicit',
|
|
17
20
|
};
|
|
18
21
|
const NAMES = Object.keys(VARIANTS).join('|');
|
|
19
22
|
/** One variant segment, followed by others or by the extension only. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-files.js","sourceRoot":"","sources":["../../src/presets/preset-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;;GAIG;AACH,MAAM,QAAQ,GAA0D;IACtE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM;IAC7C,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS;IACnD,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK;IAClD,iBAAiB,EAAE,CA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AC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAE5E,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACvE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEzC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtG,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/presets/preset.d.ts
CHANGED
|
@@ -32,5 +32,16 @@ export interface Preset {
|
|
|
32
32
|
readonly signature: string;
|
|
33
33
|
/** The files of the context, rendered from `templates/presets/<name>/`. */
|
|
34
34
|
files(config: Config): readonly PresetFile[];
|
|
35
|
+
/**
|
|
36
|
+
* The models and enums of the context on Prisma, a template of `templates/presets/<name>/`: laid
|
|
37
|
+
* out in `prisma/schema.prisma` once the generators ran, each in place of the model they started.
|
|
38
|
+
*/
|
|
39
|
+
readonly prismaModels?: string;
|
|
40
|
+
/**
|
|
41
|
+
* In the explicit style, the policies of the context as the platform lists them: a wiring of
|
|
42
|
+
* `templates/presets/<name>/` applied to `access-policies.ts` once the generators ran. The module
|
|
43
|
+
* file of the context is one of its files.
|
|
44
|
+
*/
|
|
45
|
+
readonly explicitPolicies?: string;
|
|
35
46
|
}
|
|
36
47
|
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/presets/preset.ts"],"names":[],"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AAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,oGAAoG;IACpG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACnD,iHAAiH;IACjH,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAC;IAC5C,mHAAmH;IACnH,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,gHAAgH;IAChH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,UAAU,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PlannedClient } from './planned-client.js';
|
|
2
|
+
import type { Rpc } from './rpc.js';
|
|
2
3
|
/**
|
|
3
4
|
* Every file of a client the generator owns, relative to its directory: its sources, its README
|
|
4
|
-
* and its compiler options
|
|
5
|
+
* and its compiler options, and the oRPC contract or the tRPC router of its procedures when the API serves them.
|
|
6
|
+
* package.json is not among them: the team owns its version.
|
|
5
7
|
*/
|
|
6
|
-
export declare function clientFiles(document
|
|
8
|
+
export declare function clientFiles({ document, packageName, directory }: PlannedClient, rpc?: Rpc): [string, string][];
|
|
7
9
|
//# sourceMappingURL=client-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-files.d.ts","sourceRoot":"","sources":["../../src/sdk/client-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client-files.d.ts","sourceRoot":"","sources":["../../src/sdk/client-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAStD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,aAAa,EACnD,GAAG,GAAE,GAAY,GAChB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAapB"}
|
package/dist/sdk/client-files.js
CHANGED
|
@@ -4,22 +4,27 @@ import { renderClient } from './render-client.js';
|
|
|
4
4
|
import { renderErrors } from './render-errors.js';
|
|
5
5
|
import { renderIndex } from './render-index.js';
|
|
6
6
|
import { renderOperations } from './render-operations.js';
|
|
7
|
+
import { renderOrpc } from './render-orpc.js';
|
|
7
8
|
import { renderReadme } from './render-readme.js';
|
|
8
9
|
import { renderSchemas } from './render-schemas.js';
|
|
10
|
+
import { renderTrpc } from './render-trpc.js';
|
|
9
11
|
/**
|
|
10
12
|
* Every file of a client the generator owns, relative to its directory: its sources, its README
|
|
11
|
-
* and its compiler options
|
|
13
|
+
* and its compiler options, and the oRPC contract or the tRPC router of its procedures when the API serves them.
|
|
14
|
+
* package.json is not among them: the team owns its version.
|
|
12
15
|
*/
|
|
13
|
-
export function clientFiles(document, packageName, directory) {
|
|
16
|
+
export function clientFiles({ document, packageName, directory }, rpc = 'none') {
|
|
14
17
|
return [
|
|
15
|
-
['README.md', renderReadme(document, { packageName, directory })],
|
|
18
|
+
['README.md', renderReadme(document, { packageName, directory, rpc })],
|
|
16
19
|
['tsconfig.json', CLIENT_TSCONFIG],
|
|
17
20
|
['src/client.ts', renderClient(document)],
|
|
18
21
|
['src/errors.ts', renderErrors(document)],
|
|
19
22
|
['src/index.ts', renderIndex(document)],
|
|
20
23
|
['src/operations.ts', renderOperations(document)],
|
|
24
|
+
...(rpc === 'orpc' ? [['src/orpc.ts', renderOrpc(document)]] : []),
|
|
21
25
|
['src/runtime.ts', readTemplate('sdk/runtime.ts.tpl')],
|
|
22
26
|
['src/schemas.ts', renderSchemas(document)],
|
|
27
|
+
...(rpc === 'trpc' ? [['src/trpc.ts', renderTrpc(document)]] : []),
|
|
23
28
|
];
|
|
24
29
|
}
|
|
25
30
|
//# sourceMappingURL=client-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-files.js","sourceRoot":"","sources":["../../src/sdk/client-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"client-files.js","sourceRoot":"","sources":["../../src/sdk/client-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAiB,EACnD,GAAG,GAAQ,MAAM;IAEjB,OAAO;QACL,CAAC,WAAW,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QACtE,CAAC,eAAe,EAAE,eAAe,CAAC;QAClC,CAAC,eAAe,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC,eAAe,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC,cAAc,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjD,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,CAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,CAAC,gBAAgB,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;QACtD,CAAC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC3C,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,CAA4B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9F,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { Rpc } from './rpc.js';
|
|
1
2
|
/** What the package.json of a client is made of. */
|
|
2
3
|
export interface ManifestFacts {
|
|
3
4
|
readonly name: string;
|
|
4
5
|
readonly version: string;
|
|
5
6
|
readonly title: string;
|
|
6
7
|
readonly access: string | undefined;
|
|
8
|
+
/** `orpc` or `trpc`: the client exports the procedures too, at `./orpc` or `./trpc`, with what it imports. */
|
|
9
|
+
readonly rpc?: Rpc;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
12
|
* The package.json of a client: the keys the generator owns (name, entry points, files, build,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-manifest.d.ts","sourceRoot":"","sources":["../../src/sdk/client-manifest.ts"],"names":[],"mappings":"AAGA,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client-manifest.d.ts","sourceRoot":"","sources":["../../src/sdk/client-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjC,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,8GAA8G;IAC9G,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAwBxF"}
|