ddd-ts-kit 0.2.0 → 0.4.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/README.md +99 -3
- package/dist/check/canonical/roles.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +18 -1
- package/dist/check/canonical/roles.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/catalogue/eslint-only-rules.d.ts.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +24 -0
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/declarations/classes-of.d.ts +2 -2
- package/dist/check/declarations/classes-of.js +4 -6
- package/dist/check/declarations/classes-of.js.map +1 -1
- package/dist/check/errors/builds-through-factories.d.ts +4 -0
- package/dist/check/errors/builds-through-factories.d.ts.map +1 -0
- package/dist/check/errors/builds-through-factories.js +5 -0
- package/dist/check/errors/builds-through-factories.js.map +1 -0
- package/dist/check/errors/error-code.d.ts +6 -0
- package/dist/check/errors/error-code.d.ts.map +1 -0
- package/dist/check/errors/error-code.js +2 -0
- package/dist/check/errors/error-code.js.map +1 -0
- package/dist/check/errors/error-codes.d.ts +8 -0
- package/dist/check/errors/error-codes.d.ts.map +1 -0
- package/dist/check/errors/error-codes.js +21 -0
- package/dist/check/errors/error-codes.js.map +1 -0
- package/dist/check/errors/kit-error-codes.d.ts +3 -0
- package/dist/check/errors/kit-error-codes.d.ts.map +1 -0
- package/dist/check/errors/kit-error-codes.js +17 -0
- package/dist/check/errors/kit-error-codes.js.map +1 -0
- package/dist/check/explain/errors-docs.d.ts +3 -0
- package/dist/check/explain/errors-docs.d.ts.map +1 -0
- package/dist/check/explain/errors-docs.js +30 -0
- package/dist/check/explain/errors-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/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +3 -2
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-declared-fixtures.js +19 -0
- package/dist/check/fixtures/authz-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/errors-fixtures.d.ts +3 -0
- package/dist/check/fixtures/errors-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/errors-fixtures.js +136 -0
- package/dist/check/fixtures/errors-fixtures.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +25 -3
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/rules/authz-declared.d.ts.map +1 -1
- package/dist/check/rules/authz-declared.js +24 -0
- package/dist/check/rules/authz-declared.js.map +1 -1
- package/dist/check/rules/declarations-role-declared.js +1 -1
- package/dist/check/rules/declarations-role-declared.js.map +1 -1
- package/dist/check/rules/errors-code-unique.d.ts +3 -0
- package/dist/check/rules/errors-code-unique.d.ts.map +1 -0
- package/dist/check/rules/errors-code-unique.js +34 -0
- package/dist/check/rules/errors-code-unique.js.map +1 -0
- package/dist/check/rules/errors-known-code.d.ts +3 -0
- package/dist/check/rules/errors-known-code.d.ts.map +1 -0
- package/dist/check/rules/errors-known-code.js +51 -0
- package/dist/check/rules/errors-known-code.js.map +1 -0
- package/dist/check/rules/language-glossary-term.d.ts.map +1 -1
- package/dist/check/rules/language-glossary-term.js +7 -5
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/commands/controllers.d.ts +8 -0
- package/dist/commands/controllers.d.ts.map +1 -0
- package/dist/commands/controllers.js +57 -0
- package/dist/commands/controllers.js.map +1 -0
- package/dist/commands/error-factories.d.ts +7 -0
- package/dist/commands/error-factories.d.ts.map +1 -0
- package/dist/commands/error-factories.js +65 -0
- package/dist/commands/error-factories.js.map +1 -0
- package/dist/commands/generate.js +10 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -0
- package/dist/commands/init.js.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-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +3 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +18 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +2 -0
- package/dist/config/stack.js.map +1 -1
- package/dist/controllers/entries-of.d.ts +3 -0
- package/dist/controllers/entries-of.d.ts.map +1 -0
- package/dist/controllers/entries-of.js +19 -0
- package/dist/controllers/entries-of.js.map +1 -0
- package/dist/controllers/finish-migration.d.ts +8 -0
- package/dist/controllers/finish-migration.d.ts.map +1 -0
- package/dist/controllers/finish-migration.js +71 -0
- package/dist/controllers/finish-migration.js.map +1 -0
- package/dist/controllers/function-route.d.ts +23 -0
- package/dist/controllers/function-route.d.ts.map +1 -0
- package/dist/controllers/function-route.js +2 -0
- package/dist/controllers/function-route.js.map +1 -0
- package/dist/controllers/handle-body.d.ts +8 -0
- package/dist/controllers/handle-body.d.ts.map +1 -0
- package/dist/controllers/handle-body.js +29 -0
- package/dist/controllers/handle-body.js.map +1 -0
- package/dist/controllers/handle-types-of.d.ts +15 -0
- package/dist/controllers/handle-types-of.d.ts.map +1 -0
- package/dist/controllers/handle-types-of.js +48 -0
- package/dist/controllers/handle-types-of.js.map +1 -0
- package/dist/controllers/migrate-context.d.ts +4 -0
- package/dist/controllers/migrate-context.d.ts.map +1 -0
- package/dist/controllers/migrate-context.js +74 -0
- package/dist/controllers/migrate-context.js.map +1 -0
- package/dist/controllers/migrated-group.d.ts +11 -0
- package/dist/controllers/migrated-group.d.ts.map +1 -0
- package/dist/controllers/migrated-group.js +2 -0
- package/dist/controllers/migrated-group.js.map +1 -0
- package/dist/controllers/migration.d.ts +16 -0
- package/dist/controllers/migration.d.ts.map +1 -0
- package/dist/controllers/migration.js +2 -0
- package/dist/controllers/migration.js.map +1 -0
- package/dist/controllers/plan-context.d.ts +22 -0
- package/dist/controllers/plan-context.d.ts.map +1 -0
- package/dist/controllers/plan-context.js +70 -0
- package/dist/controllers/plan-context.js.map +1 -0
- package/dist/controllers/read-function-route.d.ts +4 -0
- package/dist/controllers/read-function-route.d.ts.map +1 -0
- package/dist/controllers/read-function-route.js +37 -0
- package/dist/controllers/read-function-route.js.map +1 -0
- package/dist/controllers/render-controller.d.ts +15 -0
- package/dist/controllers/render-controller.d.ts.map +1 -0
- package/dist/controllers/render-controller.js +104 -0
- package/dist/controllers/render-controller.js.map +1 -0
- package/dist/declared/declared-role.d.ts +8 -2
- package/dist/declared/declared-role.d.ts.map +1 -1
- package/dist/declared/declared-role.js +17 -3
- package/dist/declared/declared-role.js.map +1 -1
- package/dist/declared/index.d.ts +1 -1
- package/dist/declared/index.d.ts.map +1 -1
- package/dist/declared/index.js +1 -1
- package/dist/declared/index.js.map +1 -1
- package/dist/depcruise/hygiene-rules.js +2 -1
- package/dist/depcruise/hygiene-rules.js.map +1 -1
- package/dist/describe/context-description.d.ts +17 -0
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/decorator-options.d.ts +3 -0
- package/dist/describe/decorator-options.d.ts.map +1 -0
- package/dist/describe/decorator-options.js +20 -0
- package/dist/describe/decorator-options.js.map +1 -0
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +2 -0
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/describe/format-description.d.ts.map +1 -1
- package/dist/describe/format-description.js +9 -1
- package/dist/describe/format-description.js.map +1 -1
- package/dist/describe/listed-in.d.ts +3 -0
- package/dist/describe/listed-in.d.ts.map +1 -0
- package/dist/describe/listed-in.js +9 -0
- package/dist/describe/listed-in.js.map +1 -0
- package/dist/describe/read-controllers.d.ts +5 -0
- package/dist/describe/read-controllers.d.ts.map +1 -0
- package/dist/describe/read-controllers.js +98 -0
- package/dist/describe/read-controllers.js.map +1 -0
- package/dist/describe/read-errors.d.ts +8 -0
- package/dist/describe/read-errors.d.ts.map +1 -0
- package/dist/describe/read-errors.js +52 -0
- package/dist/describe/read-errors.js.map +1 -0
- package/dist/describe/read-route-groups.d.ts +5 -0
- package/dist/describe/read-route-groups.d.ts.map +1 -0
- package/dist/describe/read-route-groups.js +37 -0
- package/dist/describe/read-route-groups.js.map +1 -0
- package/dist/describe/read-routes.d.ts +4 -1
- package/dist/describe/read-routes.d.ts.map +1 -1
- package/dist/describe/read-routes.js +10 -4
- package/dist/describe/read-routes.js.map +1 -1
- package/dist/describe/reference-lines.js +27 -7
- package/dist/describe/reference-lines.js.map +1 -1
- package/dist/describe/route-group-fact.d.ts +11 -0
- package/dist/describe/route-group-fact.d.ts.map +1 -0
- package/dist/describe/route-group-fact.js +2 -0
- package/dist/describe/route-group-fact.js.map +1 -0
- package/dist/generate/errors/add-factory.d.ts +13 -0
- package/dist/generate/errors/add-factory.d.ts.map +1 -0
- package/dist/generate/errors/add-factory.js +30 -0
- package/dist/generate/errors/add-factory.js.map +1 -0
- package/dist/generate/errors/add-spec-case.d.ts +6 -0
- package/dist/generate/errors/add-spec-case.d.ts.map +1 -0
- package/dist/generate/errors/add-spec-case.js +26 -0
- package/dist/generate/errors/add-spec-case.js.map +1 -0
- package/dist/generate/errors/class-body.d.ts +8 -0
- package/dist/generate/errors/class-body.d.ts.map +1 -0
- package/dist/generate/errors/class-body.js +11 -0
- package/dist/generate/errors/class-body.js.map +1 -0
- package/dist/generate/errors/codes-of-context.d.ts +4 -0
- package/dist/generate/errors/codes-of-context.d.ts.map +1 -0
- package/dist/generate/errors/codes-of-context.js +17 -0
- package/dist/generate/errors/codes-of-context.js.map +1 -0
- package/dist/generate/errors/refusal-code.d.ts +13 -0
- package/dist/generate/errors/refusal-code.d.ts.map +1 -0
- package/dist/generate/errors/refusal-code.js +19 -0
- package/dist/generate/errors/refusal-code.js.map +1 -0
- package/dist/generate/errors/refusal-name.d.ts +4 -0
- package/dist/generate/errors/refusal-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-name.js +15 -0
- package/dist/generate/errors/refusal-name.js.map +1 -0
- package/dist/generate/errors/static-methods.d.ts +10 -0
- package/dist/generate/errors/static-methods.d.ts.map +1 -0
- package/dist/generate/errors/static-methods.js +13 -0
- package/dist/generate/errors/static-methods.js.map +1 -0
- package/dist/generate/errors/vague-refusal-names.d.ts +3 -0
- package/dist/generate/errors/vague-refusal-names.d.ts.map +1 -0
- package/dist/generate/errors/vague-refusal-names.js +15 -0
- package/dist/generate/errors/vague-refusal-names.js.map +1 -0
- package/dist/generate/kind.d.ts +12 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/declare-context-entries.d.ts +1 -1
- package/dist/generate/kinds/declare-context-entries.js +4 -3
- package/dist/generate/kinds/declare-context-entries.js.map +1 -1
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +4 -1
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e-kind.js +29 -6
- package/dist/generate/kinds/e2e-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.d.ts +3 -0
- package/dist/generate/kinds/error-kind.d.ts.map +1 -0
- package/dist/generate/kinds/error-kind.js +75 -0
- package/dist/generate/kinds/error-kind.js.map +1 -0
- package/dist/generate/kinds/extraction/service-selection.d.ts.map +1 -1
- package/dist/generate/kinds/extraction/service-selection.js +2 -1
- package/dist/generate/kinds/extraction/service-selection.js.map +1 -1
- package/dist/generate/kinds/guard-kind.d.ts +3 -0
- package/dist/generate/kinds/guard-kind.d.ts.map +1 -0
- package/dist/generate/kinds/guard-kind.js +27 -0
- package/dist/generate/kinds/guard-kind.js.map +1 -0
- package/dist/generate/kinds/route/controller-imports.d.ts +17 -0
- package/dist/generate/kinds/route/controller-imports.d.ts.map +1 -0
- package/dist/generate/kinds/route/controller-imports.js +22 -0
- package/dist/generate/kinds/route/controller-imports.js.map +1 -0
- package/dist/generate/kinds/route/controller-plan.d.ts +12 -0
- package/dist/generate/kinds/route/controller-plan.d.ts.map +1 -0
- package/dist/generate/kinds/route/controller-plan.js +2 -0
- package/dist/generate/kinds/route/controller-plan.js.map +1 -0
- package/dist/generate/kinds/route/controller-types.d.ts +18 -0
- package/dist/generate/kinds/route/controller-types.d.ts.map +1 -0
- package/dist/generate/kinds/route/controller-types.js +27 -0
- package/dist/generate/kinds/route/controller-types.js.map +1 -0
- package/dist/generate/kinds/route/controller-vars.d.ts +6 -0
- package/dist/generate/kinds/route/controller-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/controller-vars.js +117 -0
- package/dist/generate/kinds/route/controller-vars.js.map +1 -0
- package/dist/generate/kinds/route/group-file.d.ts +3 -0
- package/dist/generate/kinds/route/group-file.d.ts.map +1 -0
- package/dist/generate/kinds/route/group-file.js +5 -0
- package/dist/generate/kinds/route/group-file.js.map +1 -0
- package/dist/generate/kinds/route/group-prefix.d.ts +4 -0
- package/dist/generate/kinds/route/group-prefix.d.ts.map +1 -0
- package/dist/generate/kinds/route/group-prefix.js +17 -0
- package/dist/generate/kinds/route/group-prefix.js.map +1 -0
- package/dist/generate/kinds/route/group-vars.d.ts +17 -0
- package/dist/generate/kinds/route/group-vars.d.ts.map +1 -0
- package/dist/generate/kinds/route/group-vars.js +33 -0
- package/dist/generate/kinds/route/group-vars.js.map +1 -0
- package/dist/generate/kinds/route/plan-controller.d.ts +6 -0
- package/dist/generate/kinds/route/plan-controller.d.ts.map +1 -0
- package/dist/generate/kinds/route/plan-controller.js +16 -0
- package/dist/generate/kinds/route/plan-controller.js.map +1 -0
- package/dist/generate/kinds/route/resolve-group.d.ts +11 -0
- package/dist/generate/kinds/route/resolve-group.d.ts.map +1 -0
- package/dist/generate/kinds/route/resolve-group.js +31 -0
- package/dist/generate/kinds/route/resolve-group.js.map +1 -0
- package/dist/generate/kinds/route/resource-of.d.ts +5 -0
- package/dist/generate/kinds/route/resource-of.d.ts.map +1 -0
- package/dist/generate/kinds/route/resource-of.js +6 -0
- package/dist/generate/kinds/route/resource-of.js.map +1 -0
- package/dist/generate/kinds/route/route-group.d.ts +11 -0
- package/dist/generate/kinds/route/route-group.d.ts.map +1 -0
- package/dist/generate/kinds/route/route-group.js +2 -0
- package/dist/generate/kinds/route/route-group.js.map +1 -0
- package/dist/generate/kinds/route/write-controller.d.ts +5 -0
- package/dist/generate/kinds/route/write-controller.d.ts.map +1 -0
- package/dist/generate/kinds/route/write-controller.js +55 -0
- package/dist/generate/kinds/route/write-controller.js.map +1 -0
- package/dist/generate/kinds/route-group-kind.d.ts +3 -0
- package/dist/generate/kinds/route-group-kind.d.ts.map +1 -0
- package/dist/generate/kinds/route-group-kind.js +55 -0
- package/dist/generate/kinds/route-group-kind.js.map +1 -0
- package/dist/generate/kinds/route-kind.d.ts +2 -0
- package/dist/generate/kinds/route-kind.d.ts.map +1 -1
- package/dist/generate/kinds/route-kind.js +19 -4
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds/write-context-files.d.ts.map +1 -1
- package/dist/generate/kinds/write-context-files.js +5 -4
- package/dist/generate/kinds/write-context-files.js.map +1 -1
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +8 -1
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/lists-routes.d.ts +8 -0
- package/dist/generate/lists-routes.d.ts.map +1 -0
- package/dist/generate/lists-routes.js +10 -0
- package/dist/generate/lists-routes.js.map +1 -0
- package/dist/init/files/audit-files.d.ts.map +1 -1
- package/dist/init/files/audit-files.js +2 -7
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/manifest/versions.js +23 -23
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +5 -1
- 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/refusals/apply-plan.d.ts +17 -0
- package/dist/refusals/apply-plan.d.ts.map +1 -0
- package/dist/refusals/apply-plan.js +118 -0
- package/dist/refusals/apply-plan.js.map +1 -0
- package/dist/refusals/factory-name-for.d.ts +7 -0
- package/dist/refusals/factory-name-for.d.ts.map +1 -0
- package/dist/refusals/factory-name-for.js +16 -0
- package/dist/refusals/factory-name-for.js.map +1 -0
- package/dist/refusals/legacy-error.d.ts +21 -0
- package/dist/refusals/legacy-error.d.ts.map +1 -0
- package/dist/refusals/legacy-error.js +2 -0
- package/dist/refusals/legacy-error.js.map +1 -0
- package/dist/refusals/legacy-errors.d.ts +6 -0
- package/dist/refusals/legacy-errors.d.ts.map +1 -0
- package/dist/refusals/legacy-errors.js +16 -0
- package/dist/refusals/legacy-errors.js.map +1 -0
- package/dist/refusals/migration-draft.d.ts +15 -0
- package/dist/refusals/migration-draft.d.ts.map +1 -0
- package/dist/refusals/migration-draft.js +41 -0
- package/dist/refusals/migration-draft.js.map +1 -0
- package/dist/refusals/migration-plan.d.ts +6 -0
- package/dist/refusals/migration-plan.d.ts.map +1 -0
- package/dist/refusals/migration-plan.js +2 -0
- package/dist/refusals/migration-plan.js.map +1 -0
- package/dist/refusals/move.d.ts +15 -0
- package/dist/refusals/move.d.ts.map +1 -0
- package/dist/refusals/move.js +2 -0
- package/dist/refusals/move.js.map +1 -0
- package/dist/refusals/nested-cases.d.ts +3 -0
- package/dist/refusals/nested-cases.d.ts.map +1 -0
- package/dist/refusals/nested-cases.js +9 -0
- package/dist/refusals/nested-cases.js.map +1 -0
- package/dist/refusals/plan-file.d.ts +3 -0
- package/dist/refusals/plan-file.d.ts.map +1 -0
- package/dist/refusals/plan-file.js +3 -0
- package/dist/refusals/plan-file.js.map +1 -0
- package/dist/refusals/planned-factory.d.ts +11 -0
- package/dist/refusals/planned-factory.d.ts.map +1 -0
- package/dist/refusals/planned-factory.js +2 -0
- package/dist/refusals/planned-factory.js.map +1 -0
- package/dist/refusals/planned-move.d.ts +8 -0
- package/dist/refusals/planned-move.d.ts.map +1 -0
- package/dist/refusals/planned-move.js +2 -0
- package/dist/refusals/planned-move.js.map +1 -0
- package/dist/refusals/project-sources.d.ts +5 -0
- package/dist/refusals/project-sources.d.ts.map +1 -0
- package/dist/refusals/project-sources.js +13 -0
- package/dist/refusals/project-sources.js.map +1 -0
- package/dist/refusals/propose-plan.d.ts +16 -0
- package/dist/refusals/propose-plan.d.ts.map +1 -0
- package/dist/refusals/propose-plan.js +39 -0
- package/dist/refusals/propose-plan.js.map +1 -0
- package/dist/refusals/read-legacy-error.d.ts +9 -0
- package/dist/refusals/read-legacy-error.d.ts.map +1 -0
- package/dist/refusals/read-legacy-error.js +75 -0
- package/dist/refusals/read-legacy-error.js.map +1 -0
- package/dist/refusals/read-plan.d.ts +4 -0
- package/dist/refusals/read-plan.d.ts.map +1 -0
- package/dist/refusals/read-plan.js +43 -0
- package/dist/refusals/read-plan.js.map +1 -0
- package/dist/refusals/render-factory.d.ts +5 -0
- package/dist/refusals/render-factory.d.ts.map +1 -0
- package/dist/refusals/render-factory.js +14 -0
- package/dist/refusals/render-factory.js.map +1 -0
- package/dist/refusals/replace-in-code.d.ts +16 -0
- package/dist/refusals/replace-in-code.d.ts.map +1 -0
- package/dist/refusals/replace-in-code.js +20 -0
- package/dist/refusals/replace-in-code.js.map +1 -0
- package/dist/refusals/rewrite-usages.d.ts +6 -0
- package/dist/refusals/rewrite-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-usages.js +80 -0
- package/dist/refusals/rewrite-usages.js.map +1 -0
- package/dist/refusals/spec-parts.d.ts +8 -0
- package/dist/refusals/spec-parts.d.ts.map +1 -0
- package/dist/refusals/spec-parts.js +14 -0
- package/dist/refusals/spec-parts.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +14 -1
- package/dist/run.js.map +1 -1
- package/dist/stack/audit-vars.d.ts.map +1 -1
- package/dist/stack/audit-vars.js +3 -1
- package/dist/stack/audit-vars.js.map +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +18 -1
- 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 +2 -2
- package/templates/aggregate/aggregate.ts.tpl +5 -0
- package/templates/command/handler.declared.ts.tpl +5 -0
- package/templates/command/handler.ts.tpl +5 -0
- package/templates/context/wiring.declared.tpl +2 -2
- package/templates/controller/controller.class-validator.ts.tpl +85 -0
- package/templates/controller/controller.none.ts.tpl +101 -0
- package/templates/controller/controller.search.ts.tpl +84 -0
- package/templates/controller/controller.spec.ts.tpl +49 -0
- package/templates/controller/controller.standard-schema.ts.tpl +113 -0
- package/templates/controller/controller.zod.ts.tpl +99 -0
- package/templates/controller/group.ts.tpl +4 -0
- package/templates/controller/guard.spec.ts.tpl +27 -0
- package/templates/controller/guard.ts.tpl +14 -0
- package/templates/controller/mapper.ts.tpl +10 -0
- package/templates/controller/routes.tsyringe.tpl +5 -0
- package/templates/controller/serializer.ts.tpl +10 -0
- package/templates/controller/wiring.manual.tpl +5 -0
- package/templates/docs/openapi.json.tpl +5 -0
- package/templates/entity/entity.ts.tpl +5 -0
- package/templates/error/case.spec.ts.tpl +8 -0
- package/templates/error/concept-error.spec.ts.tpl +7 -0
- package/templates/error/concept-error.ts.tpl +5 -0
- package/templates/error/factory.ts.tpl +4 -0
- package/templates/init/jest.config.js.tpl +7 -0
- package/templates/init/platform/audit/audit.module.manual.ts.tpl +18 -0
- package/templates/init/platform/audit/search-audit-entries.controller.ts.tpl +193 -0
- package/templates/init/platform/compose-application.tsyringe.ts.tpl +38 -4
- package/templates/init/rules/domain.md.tpl +11 -0
- package/templates/init/rules/presentation.md.tpl +18 -5
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/route/route.class-validator.ts.tpl +1 -1
- package/templates/route/route.none.ts.tpl +1 -1
- package/templates/route/route.search.ts.tpl +1 -1
- package/templates/route/route.standard-schema.ts.tpl +1 -1
- package/templates/route/route.zod.ts.tpl +1 -1
- package/templates/value-object/value-object.ts.tpl +5 -0
package/dist/stack/stack-vars.js
CHANGED
|
@@ -11,7 +11,7 @@ import { redisVars } from './redis-vars.js';
|
|
|
11
11
|
import { usesLegacyDecorators } from './uses-legacy-decorators.js';
|
|
12
12
|
/** The choices of the stack as template variables: what every template of `init` and of `generate` reads. */
|
|
13
13
|
export function stackVars(config) {
|
|
14
|
-
const { validation, di, tests, orm, authz, style, logger } = config.stack;
|
|
14
|
+
const { validation, di, tests, orm, authz, style, logger, refusals } = config.stack;
|
|
15
15
|
const legacy = usesLegacyDecorators(config);
|
|
16
16
|
return {
|
|
17
17
|
style: one(style, ['declared', 'explicit']),
|
|
@@ -29,6 +29,8 @@ export function stackVars(config) {
|
|
|
29
29
|
redis: redisVars(config),
|
|
30
30
|
audit: auditVars(config),
|
|
31
31
|
errors: errorVars(config),
|
|
32
|
+
refusals: one(refusals, ['factories', 'classes']),
|
|
33
|
+
routes: routeVars(config),
|
|
32
34
|
logger: one(logger, ['stdout', 'pino', 'winston']),
|
|
33
35
|
tests: { ...one(tests, ['vitest', 'jest']), module: tests === 'jest' ? '@jest/globals' : 'vitest' },
|
|
34
36
|
worker: { on: config.worker, off: !config.worker },
|
|
@@ -37,6 +39,21 @@ export function stackVars(config) {
|
|
|
37
39
|
persistence: persistenceVars(config),
|
|
38
40
|
};
|
|
39
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* `listed`: the routes of a context are a list written in `<context>.routes.ts`. Declared
|
|
44
|
+
* controllers reach the application by themselves, and the composition root mounts them in
|
|
45
|
+
* either form of routes, so a project of function routes can write its first controller.
|
|
46
|
+
*/
|
|
47
|
+
function routeVars(config) {
|
|
48
|
+
const { routes, style, http, audit } = config.stack;
|
|
49
|
+
const declaredControllers = http !== 'none' && style === 'declared';
|
|
50
|
+
return {
|
|
51
|
+
...one(routes, ['controllers', 'functions']),
|
|
52
|
+
listed: http !== 'none' && !(style === 'declared' && routes === 'controllers'),
|
|
53
|
+
declaredControllers,
|
|
54
|
+
mountsControllers: declaredControllers || (http !== 'none' && audit === 'on' && routes === 'controllers'),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
40
57
|
function assemblyVars(config) {
|
|
41
58
|
const { style, assembly } = config.stack;
|
|
42
59
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,G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AI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;KAChD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.4.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Bootstrap, scaffold and verify DDD and Clean Architecture TypeScript projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
32
|
+
"@ddd-ts-kit/kernel": "^0.4.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -14,7 +14,12 @@ export class {{name.pascal}} extends AggregateRoot<string> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static create(id: string, now: Date): {{name.pascal}} {
|
|
17
|
+
{{#if refusals.factories}}
|
|
18
|
+
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal of its error class when one is violated: `throw {{name.pascal}}Error.<refusal>(...)`, added with `ddd-ts-kit generate error {{context.kebab}} {{name.pascal}} <refusal>`.
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{#if refusals.classes}}
|
|
17
21
|
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw a DomainError of ../errors when one is violated.
|
|
22
|
+
{{/if}}
|
|
18
23
|
const created = new {{name.pascal}}(id, { registeredAt: now });
|
|
19
24
|
|
|
20
25
|
// TODO(domain): record the birth fact with `created.record(new {{name.pascal}}Created(id, now))` after `ddd-ts-kit generate domain-event {{context.kebab}} {{name.pascal}} Created`.
|
|
@@ -14,7 +14,12 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
|
|
|
14
14
|
) {}
|
|
15
15
|
|
|
16
16
|
async execute(command: {{name.pascal}}Command): Promise<string> {
|
|
17
|
+
{{#if refusals.factories}}
|
|
18
|
+
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{#if refusals.classes}}
|
|
17
21
|
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw a not-found DomainError, call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
22
|
+
{{/if}}
|
|
18
23
|
const target = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
|
|
19
24
|
|
|
20
25
|
await this.{{aggregate.camel}}Repository.save(target);
|
|
@@ -12,7 +12,12 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
|
|
|
12
12
|
) {}
|
|
13
13
|
|
|
14
14
|
async execute(command: {{name.pascal}}Command): Promise<string> {
|
|
15
|
+
{{#if refusals.factories}}
|
|
16
|
+
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if refusals.classes}}
|
|
15
19
|
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw a not-found DomainError, call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
20
|
+
{{/if}}
|
|
16
21
|
const target = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
|
|
17
22
|
|
|
18
23
|
await this.{{aggregate.camel}}Repository.save(target);
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
{{#if assembly.barrel}}
|
|
3
3
|
import * as {{context.camel}}Declarations from '{{alias.context}}/{{context.kebab}}.declarations{{alias.ext}}';
|
|
4
4
|
{{/if}}
|
|
5
|
-
{{#if
|
|
5
|
+
{{#if routes.listed}}
|
|
6
6
|
import { {{context.camel}}Routes } from '{{alias.context}}/presentation/http/{{context.kebab}}.routes{{alias.ext}}';
|
|
7
7
|
{{/if}}
|
|
8
8
|
@@contexts
|
|
9
9
|
{{assembled.module}},
|
|
10
|
-
{{#if
|
|
10
|
+
{{#if routes.listed}}
|
|
11
11
|
@@routes
|
|
12
12
|
{{context.camel}}Routes,
|
|
13
13
|
{{/if}}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { {{route.httpImports}} } from '@ddd-ts-kit/http';
|
|
2
|
+
import type { {{route.busType}} } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{#if route.declaresSchema}}
|
|
4
|
+
import { classSchema } from '@ddd-ts-kit/validation/class-validator';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{route.imports}}
|
|
7
|
+
|
|
8
|
+
{{#if route.hasParams}}
|
|
9
|
+
const params = classSchema({{name.pascal}}Params);
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#if route.hasBody}}
|
|
12
|
+
// TODO(domain): once {{name.pascal}}Body has its decorated fields, drop the second argument: it only lets a class without any decorated field through.
|
|
13
|
+
const body = classSchema({{name.pascal}}Body, { validator: { forbidUnknownValues: false } });
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{#if route.returnsId}}
|
|
16
|
+
const accepted = classSchema({{name.pascal}}Accepted);
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if route.isQuery}}
|
|
19
|
+
// TODO(domain): once {{name.pascal}}Answer has its decorated fields, drop the second argument: it only lets a class without any decorated field through.
|
|
20
|
+
const answer = classSchema({{name.pascal}}Answer, { validator: { forbidUnknownValues: false } });
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#if route.declaresSchema}}
|
|
23
|
+
|
|
24
|
+
{{/if}}
|
|
25
|
+
@Controller({
|
|
26
|
+
{{route.access}}
|
|
27
|
+
method: '{{route.method}}',
|
|
28
|
+
path: '{{route.groupPath}}',
|
|
29
|
+
summary: '{{name.title}}',
|
|
30
|
+
{{#if route.hasTypedParams}}
|
|
31
|
+
params,
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#if route.hasBody}}
|
|
34
|
+
body,
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if route.returnsId}}
|
|
37
|
+
response: { status: {{route.status}}, description: 'Done; the body carries the identifier.', body: accepted },
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#if route.returnsNothing}}
|
|
40
|
+
response: { status: {{route.status}}, description: 'Done.' },
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#if route.isQuery}}
|
|
43
|
+
response: { status: {{route.status}}, description: 'The answer.', body: answer },
|
|
44
|
+
{{/if}}
|
|
45
|
+
// TODO(domain): list the codes of the refusals "{{name.words}}" can raise, as their factories set them, so that they appear in the contract with their status (`errors/known-code`).
|
|
46
|
+
errors: [],
|
|
47
|
+
})
|
|
48
|
+
export class {{name.pascal}}Controller {
|
|
49
|
+
constructor({{route.constructorParams}}) {}
|
|
50
|
+
|
|
51
|
+
{{#if route.isQuery}}
|
|
52
|
+
async handle({{route.requestParam}}): Promise<{{route.answerType}}> {
|
|
53
|
+
{{#unless route.mapper}}
|
|
54
|
+
// TODO(domain): build the query from `request` (params, query string); the actor is already there.
|
|
55
|
+
{{/unless}}
|
|
56
|
+
{{#if route.serializer}}
|
|
57
|
+
return this.serializer.serialize(await this.{{route.bus}}.execute({{route.message}}));
|
|
58
|
+
{{/if}}
|
|
59
|
+
{{#unless route.serializer}}
|
|
60
|
+
// TODO(domain): map the answer of the query to the public fields.
|
|
61
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
62
|
+
|
|
63
|
+
return {};
|
|
64
|
+
{{/unless}}
|
|
65
|
+
}
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{#if route.returnsId}}
|
|
68
|
+
async handle({{route.requestParam}}): Promise<{{route.acceptedType}}> {
|
|
69
|
+
{{#unless route.mapper}}
|
|
70
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
71
|
+
{{/unless}}
|
|
72
|
+
const id = await this.{{route.bus}}.execute({{route.message}});
|
|
73
|
+
|
|
74
|
+
return { id };
|
|
75
|
+
}
|
|
76
|
+
{{/if}}
|
|
77
|
+
{{#if route.returnsNothing}}
|
|
78
|
+
async handle({{route.requestParam}}): Promise<void> {
|
|
79
|
+
{{#unless route.mapper}}
|
|
80
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
81
|
+
{{/unless}}
|
|
82
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
83
|
+
}
|
|
84
|
+
{{/if}}
|
|
85
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { {{route.httpImports}} } from '@ddd-ts-kit/http';
|
|
2
|
+
{{#if route.usesSchema}}
|
|
3
|
+
import { err, ok, type {{route.busType}} } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import { customSchema{{#if route.usesInfer}}, type Infer{{/if}} } from '@ddd-ts-kit/validation';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#unless route.usesSchema}}
|
|
7
|
+
import type { {{route.busType}} } from '@ddd-ts-kit/kernel';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
{{route.imports}}
|
|
10
|
+
|
|
11
|
+
{{#if route.usesAnyObject}}
|
|
12
|
+
const anyObject = customSchema<Record<string, unknown>>(
|
|
13
|
+
(input) =>
|
|
14
|
+
typeof input === 'object' && input !== null && !Array.isArray(input)
|
|
15
|
+
? ok({ ...input })
|
|
16
|
+
: err([{ path: '', code: 'invalid_type', message: 'An object is expected.' }]),
|
|
17
|
+
{ type: 'object' },
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
{{/if}}
|
|
21
|
+
{{#if route.hasBody}}
|
|
22
|
+
// TODO(domain): replace `anyObject` by a schema checking the fields the client sends for "{{name.words}}" (shape constraints only; business rules stay in the domain) and describing them in JSON Schema.
|
|
23
|
+
const body = anyObject;
|
|
24
|
+
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{#if route.returnsId}}
|
|
27
|
+
const accepted = customSchema<{ readonly id: string }>(
|
|
28
|
+
(input) =>
|
|
29
|
+
typeof input === 'object' && input !== null && 'id' in input && typeof input.id === 'string'
|
|
30
|
+
? ok({ id: input.id })
|
|
31
|
+
: err([{ path: 'id', code: 'invalid_type', message: 'An identifier is expected.' }]),
|
|
32
|
+
{ type: 'object', required: ['id'], properties: { id: { type: 'string' } } },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if route.isQuery}}
|
|
37
|
+
// TODO(domain): replace `anyObject` by a schema of the fields of {{name.pascal}}Result that are part of the public contract.
|
|
38
|
+
const answer = anyObject;
|
|
39
|
+
|
|
40
|
+
{{/if}}
|
|
41
|
+
@Controller({
|
|
42
|
+
{{route.access}}
|
|
43
|
+
method: '{{route.method}}',
|
|
44
|
+
path: '{{route.groupPath}}',
|
|
45
|
+
summary: '{{name.title}}',
|
|
46
|
+
{{#if route.hasTypedParams}}
|
|
47
|
+
params,
|
|
48
|
+
{{/if}}
|
|
49
|
+
{{#if route.hasBody}}
|
|
50
|
+
body,
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#if route.returnsId}}
|
|
53
|
+
response: { status: {{route.status}}, description: 'Done; the body carries the identifier.', body: accepted },
|
|
54
|
+
{{/if}}
|
|
55
|
+
{{#if route.returnsNothing}}
|
|
56
|
+
response: { status: {{route.status}}, description: 'Done.' },
|
|
57
|
+
{{/if}}
|
|
58
|
+
{{#if route.isQuery}}
|
|
59
|
+
response: { status: {{route.status}}, description: 'The answer.', body: answer },
|
|
60
|
+
{{/if}}
|
|
61
|
+
// TODO(domain): list the codes of the refusals "{{name.words}}" can raise, as their factories set them, so that they appear in the contract with their status (`errors/known-code`).
|
|
62
|
+
errors: [],
|
|
63
|
+
})
|
|
64
|
+
export class {{name.pascal}}Controller {
|
|
65
|
+
constructor({{route.constructorParams}}) {}
|
|
66
|
+
|
|
67
|
+
{{#if route.isQuery}}
|
|
68
|
+
async handle({{route.requestParam}}): Promise<{{route.answerType}}> {
|
|
69
|
+
{{#unless route.mapper}}
|
|
70
|
+
// TODO(domain): build the query from `request` (params, query string); the actor is already there.
|
|
71
|
+
{{/unless}}
|
|
72
|
+
{{#if route.serializer}}
|
|
73
|
+
return this.serializer.serialize(await this.{{route.bus}}.execute({{route.message}}));
|
|
74
|
+
{{/if}}
|
|
75
|
+
{{#unless route.serializer}}
|
|
76
|
+
// TODO(domain): map the answer of the query to the public fields.
|
|
77
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
78
|
+
|
|
79
|
+
return {};
|
|
80
|
+
{{/unless}}
|
|
81
|
+
}
|
|
82
|
+
{{/if}}
|
|
83
|
+
{{#if route.returnsId}}
|
|
84
|
+
async handle({{route.requestParam}}): Promise<{{route.acceptedType}}> {
|
|
85
|
+
{{#unless route.mapper}}
|
|
86
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
87
|
+
{{/unless}}
|
|
88
|
+
const id = await this.{{route.bus}}.execute({{route.message}});
|
|
89
|
+
|
|
90
|
+
return { id };
|
|
91
|
+
}
|
|
92
|
+
{{/if}}
|
|
93
|
+
{{#if route.returnsNothing}}
|
|
94
|
+
async handle({{route.requestParam}}): Promise<void> {
|
|
95
|
+
{{#unless route.mapper}}
|
|
96
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
97
|
+
{{/unless}}
|
|
98
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
99
|
+
}
|
|
100
|
+
{{/if}}
|
|
101
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{{#if validation.zod}}
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
{{/if}}
|
|
4
|
+
import {
|
|
5
|
+
Controller,
|
|
6
|
+
pageQuerySchema,
|
|
7
|
+
pageResponse,
|
|
8
|
+
pageSchemaOf,
|
|
9
|
+
type HttpRequest,
|
|
10
|
+
type PageBody,
|
|
11
|
+
} from '@ddd-ts-kit/http';
|
|
12
|
+
{{#if search.customSchema}}
|
|
13
|
+
import { err, ok, type QueryBus } from '@ddd-ts-kit/kernel';
|
|
14
|
+
import { customSchema, type Infer } from '@ddd-ts-kit/validation';
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#unless search.customSchema}}
|
|
17
|
+
import type { QueryBus } from '@ddd-ts-kit/kernel';
|
|
18
|
+
import type { Infer } from '@ddd-ts-kit/validation';
|
|
19
|
+
{{/unless}}
|
|
20
|
+
{{#if validation.zod}}
|
|
21
|
+
import { zodSchema } from '@ddd-ts-kit/validation/zod';
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#if validation.classValidator}}
|
|
24
|
+
import { classSchema } from '@ddd-ts-kit/validation/class-validator';
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{route.imports}}
|
|
27
|
+
|
|
28
|
+
// TODO(domain): list here the fields of {{name.pascal}}Sort a client may sort by, and bound the size of a page.
|
|
29
|
+
const query = pageQuerySchema({ sortable: ['id'], maxSize: 100 });
|
|
30
|
+
|
|
31
|
+
{{#if validation.zod}}
|
|
32
|
+
const line = zodSchema(
|
|
33
|
+
z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
// TODO(domain): declare the fields of {{name.pascal}}Item that are part of the public contract.
|
|
36
|
+
}),
|
|
37
|
+
{ io: 'output' },
|
|
38
|
+
);
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#if validation.classValidator}}
|
|
41
|
+
const line = classSchema({{name.pascal}}Line);
|
|
42
|
+
{{/if}}
|
|
43
|
+
{{#if search.customSchema}}
|
|
44
|
+
interface {{name.pascal}}Line {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
// TODO(domain): declare the fields of {{name.pascal}}Item that are part of the public contract, here and in the schema below.
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const line = customSchema<{{name.pascal}}Line>(
|
|
50
|
+
(input) => (isLine(input) ? ok(input) : err([{ path: 'id', code: 'invalid_type', message: 'Expected a text.' }])),
|
|
51
|
+
{
|
|
52
|
+
type: 'object',
|
|
53
|
+
required: ['id'],
|
|
54
|
+
properties: { id: { type: 'string' } },
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
{{/if}}
|
|
58
|
+
|
|
59
|
+
@Controller({
|
|
60
|
+
{{route.access}}
|
|
61
|
+
method: '{{route.method}}',
|
|
62
|
+
path: '{{route.groupPath}}',
|
|
63
|
+
summary: '{{name.title}}',
|
|
64
|
+
query,
|
|
65
|
+
response: { status: 200, description: 'One page of the search.', body: pageSchemaOf(line) },
|
|
66
|
+
// TODO(domain): list the codes of the refusals "{{name.words}}" can raise, as their factories set them, so that they appear in the contract with their status (`errors/known-code`).
|
|
67
|
+
errors: [],
|
|
68
|
+
})
|
|
69
|
+
export class {{name.pascal}}Controller {
|
|
70
|
+
constructor({{route.constructorParams}}) {}
|
|
71
|
+
|
|
72
|
+
async handle(request: HttpRequest<{ query: Infer<typeof query> }>): Promise<PageBody<Infer<typeof line>>> {
|
|
73
|
+
// TODO(domain): hand the criteria of the query over too, once the query schema declares them next to the page (a request mapper is their place); map each line to its public fields.
|
|
74
|
+
const page = await this.queries.execute(new {{route.input}}(request.actor, request.query));
|
|
75
|
+
|
|
76
|
+
return pageResponse(page, (item) => ({ id: item.id }));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
{{#if search.customSchema}}
|
|
80
|
+
|
|
81
|
+
function isLine(input: unknown): input is {{name.pascal}}Line {
|
|
82
|
+
return typeof input === 'object' && input !== null && 'id' in input && typeof input.id === 'string';
|
|
83
|
+
}
|
|
84
|
+
{{/if}}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
import { controllerRoute, executeRoute } from '@ddd-ts-kit/http';
|
|
3
|
+
import { {{route.busClass}}{{#if route.protected}}, type Actor{{/if}} } from '@ddd-ts-kit/kernel';
|
|
4
|
+
{{route.messageImport}}
|
|
5
|
+
{{route.specImports}}
|
|
6
|
+
|
|
7
|
+
{{#if route.protected}}
|
|
8
|
+
const caller: Actor = { id: 'user-1', type: 'user', roles: [], attributes: {} };
|
|
9
|
+
|
|
10
|
+
{{/if}}
|
|
11
|
+
describe('{{route.method}} {{route.path}}', () => {
|
|
12
|
+
it('answers {{route.status}} when the use case succeeds', async () => {
|
|
13
|
+
{{#if route.isPlainQuery}}
|
|
14
|
+
const {{route.bus}} = new {{route.busClass}}().register({{route.input}}, {
|
|
15
|
+
execute: async () => ({}),
|
|
16
|
+
});
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if route.isSearch}}
|
|
19
|
+
const {{route.bus}} = new {{route.busClass}}().register({{route.input}}, {
|
|
20
|
+
execute: async () => ({ items: [{ id: '{{name.kebab}}-1' }], total: 1 }),
|
|
21
|
+
});
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{#if route.returnsId}}
|
|
24
|
+
const {{route.bus}} = new {{route.busClass}}().register({{route.input}}, {
|
|
25
|
+
execute: async () => '{{name.kebab}}-1',
|
|
26
|
+
});
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if route.returnsNothing}}
|
|
29
|
+
const {{route.bus}} = new {{route.busClass}}().register({{route.input}}, {
|
|
30
|
+
execute: async () => undefined,
|
|
31
|
+
});
|
|
32
|
+
{{/if}}
|
|
33
|
+
|
|
34
|
+
const route = controllerRoute(new {{name.pascal}}Controller({{route.specArguments}}));
|
|
35
|
+
|
|
36
|
+
const response = await executeRoute(
|
|
37
|
+
route,
|
|
38
|
+
{ params: {{route.sampleParams}}, query: {}, headers: {}, body: {}, raw: undefined },
|
|
39
|
+
{ validateResponses: true{{#if route.protected}}, resolvePrincipal: () => caller{{/if}} },
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
expect(response.status).toBe({{route.status}});
|
|
43
|
+
expect(route.path).toBe('{{route.path}}');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// TODO(domain): replace each entry below by a test of the contract a client relies on.
|
|
47
|
+
it.todo('refuses an input that does not have the expected shape with 422');
|
|
48
|
+
it.todo('answers the documented status for each error code of the use case');
|
|
49
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { {{route.httpImports}} } from '@ddd-ts-kit/http';
|
|
2
|
+
import type { {{route.busType}} } from '@ddd-ts-kit/kernel';
|
|
3
|
+
{{#if route.usesInfer}}
|
|
4
|
+
import type { Infer } from '@ddd-ts-kit/validation';
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#if route.usesSchema}}
|
|
7
|
+
import { standardSchema, type StandardSchemaV1 } from '@ddd-ts-kit/validation/standard-schema';
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{route.imports}}
|
|
10
|
+
|
|
11
|
+
{{#if route.usesAnyObject}}
|
|
12
|
+
const anyObject: StandardSchemaV1<unknown, Record<string, unknown>> = {
|
|
13
|
+
'~standard': {
|
|
14
|
+
version: 1,
|
|
15
|
+
vendor: '{{context.kebab}}',
|
|
16
|
+
validate: (value) =>
|
|
17
|
+
typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
18
|
+
? { value: { ...value } }
|
|
19
|
+
: { issues: [{ message: 'An object is expected.' }] },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#if route.hasBody}}
|
|
25
|
+
// TODO(domain): replace `anyObject` by the schema of "{{name.words}}" written with your Standard Schema library (shape constraints only; business rules stay in the domain) and describe it in the JSON Schema next to it.
|
|
26
|
+
const body = standardSchema(anyObject, { type: 'object' });
|
|
27
|
+
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if route.returnsId}}
|
|
30
|
+
const acceptedShape: StandardSchemaV1<unknown, { readonly id: string }> = {
|
|
31
|
+
'~standard': {
|
|
32
|
+
version: 1,
|
|
33
|
+
vendor: '{{context.kebab}}',
|
|
34
|
+
validate: (value) =>
|
|
35
|
+
typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string'
|
|
36
|
+
? { value: { id: value.id } }
|
|
37
|
+
: { issues: [{ message: 'An identifier is expected.', path: ['id'] }] },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const accepted = standardSchema(acceptedShape, {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['id'],
|
|
44
|
+
properties: { id: { type: 'string' } },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{#if route.isQuery}}
|
|
49
|
+
// TODO(domain): replace `anyObject` by the schema of the fields of {{name.pascal}}Result that are part of the public contract, and describe it in the JSON Schema next to it.
|
|
50
|
+
const answer = standardSchema(anyObject, { type: 'object' });
|
|
51
|
+
|
|
52
|
+
{{/if}}
|
|
53
|
+
@Controller({
|
|
54
|
+
{{route.access}}
|
|
55
|
+
method: '{{route.method}}',
|
|
56
|
+
path: '{{route.groupPath}}',
|
|
57
|
+
summary: '{{name.title}}',
|
|
58
|
+
{{#if route.hasTypedParams}}
|
|
59
|
+
params,
|
|
60
|
+
{{/if}}
|
|
61
|
+
{{#if route.hasBody}}
|
|
62
|
+
body,
|
|
63
|
+
{{/if}}
|
|
64
|
+
{{#if route.returnsId}}
|
|
65
|
+
response: { status: {{route.status}}, description: 'Done; the body carries the identifier.', body: accepted },
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{#if route.returnsNothing}}
|
|
68
|
+
response: { status: {{route.status}}, description: 'Done.' },
|
|
69
|
+
{{/if}}
|
|
70
|
+
{{#if route.isQuery}}
|
|
71
|
+
response: { status: {{route.status}}, description: 'The answer.', body: answer },
|
|
72
|
+
{{/if}}
|
|
73
|
+
// TODO(domain): list the codes of the refusals "{{name.words}}" can raise, as their factories set them, so that they appear in the contract with their status (`errors/known-code`).
|
|
74
|
+
errors: [],
|
|
75
|
+
})
|
|
76
|
+
export class {{name.pascal}}Controller {
|
|
77
|
+
constructor({{route.constructorParams}}) {}
|
|
78
|
+
|
|
79
|
+
{{#if route.isQuery}}
|
|
80
|
+
async handle({{route.requestParam}}): Promise<{{route.answerType}}> {
|
|
81
|
+
{{#unless route.mapper}}
|
|
82
|
+
// TODO(domain): build the query from `request` (params, query string); the actor is already there.
|
|
83
|
+
{{/unless}}
|
|
84
|
+
{{#if route.serializer}}
|
|
85
|
+
return this.serializer.serialize(await this.{{route.bus}}.execute({{route.message}}));
|
|
86
|
+
{{/if}}
|
|
87
|
+
{{#unless route.serializer}}
|
|
88
|
+
// TODO(domain): map the answer of the query to the public fields.
|
|
89
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
90
|
+
|
|
91
|
+
return {};
|
|
92
|
+
{{/unless}}
|
|
93
|
+
}
|
|
94
|
+
{{/if}}
|
|
95
|
+
{{#if route.returnsId}}
|
|
96
|
+
async handle({{route.requestParam}}): Promise<{{route.acceptedType}}> {
|
|
97
|
+
{{#unless route.mapper}}
|
|
98
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
99
|
+
{{/unless}}
|
|
100
|
+
const id = await this.{{route.bus}}.execute({{route.message}});
|
|
101
|
+
|
|
102
|
+
return { id };
|
|
103
|
+
}
|
|
104
|
+
{{/if}}
|
|
105
|
+
{{#if route.returnsNothing}}
|
|
106
|
+
async handle({{route.requestParam}}): Promise<void> {
|
|
107
|
+
{{#unless route.mapper}}
|
|
108
|
+
// TODO(domain): build the command from `request` (body, params); the actor is already there.
|
|
109
|
+
{{/unless}}
|
|
110
|
+
await this.{{route.bus}}.execute({{route.message}});
|
|
111
|
+
}
|
|
112
|
+
{{/if}}
|
|
113
|
+
}
|