ddd-ts-kit 0.3.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 +44 -1
- 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/eslint-only-rules.d.ts.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +12 -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/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.map +1 -1
- package/dist/check/fixtures/errors-fixtures.js +10 -0
- package/dist/check/fixtures/errors-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-known-code.js +2 -2
- package/dist/check/rules/errors-known-code.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/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 +1 -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 +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +9 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -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 +5 -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/format-description.js +4 -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-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 +13 -6
- 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/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/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/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 +6 -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 +3 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +1 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +7 -0
- 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 +16 -0
- 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/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/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/presentation.md.tpl +14 -6
- package/templates/pipeline/package-scripts.json +1 -1
|
@@ -20,6 +20,7 @@ export interface StackOptions {
|
|
|
20
20
|
readonly assembly?: string;
|
|
21
21
|
readonly dependencies?: string;
|
|
22
22
|
readonly refusals?: string;
|
|
23
|
+
readonly routes?: string;
|
|
23
24
|
readonly packageManager?: string;
|
|
24
25
|
/** The prefix of the source root in imports, when it is not the default. */
|
|
25
26
|
readonly importAlias?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-options.d.ts","sourceRoot":"","sources":["../../../src/init/stack/stack-options.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,M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,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB"}
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAyG3C,wBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,MAAM,CAkCvE"}
|
package/dist/run.js
CHANGED
|
@@ -2,6 +2,7 @@ import { affectedCommand } from './commands/affected.js';
|
|
|
2
2
|
import { buildAliasesCommand } from './commands/build-aliases.js';
|
|
3
3
|
import { checkFileCommand, explainCommand, rulesCommand } from './commands/check.js';
|
|
4
4
|
import { checksCommand } from './commands/checks.js';
|
|
5
|
+
import { controllersCommand } from './commands/controllers.js';
|
|
5
6
|
import { depcruiseConfigCommand } from './commands/depcruise-config.js';
|
|
6
7
|
import { describeCommand } from './commands/describe.js';
|
|
7
8
|
import { docsCommand } from './commands/docs.js';
|
|
@@ -30,6 +31,7 @@ const COMMANDS = {
|
|
|
30
31
|
'depcruise-config': depcruiseConfigCommand,
|
|
31
32
|
'build-aliases': buildAliasesCommand,
|
|
32
33
|
'error-factories': errorFactoriesCommand,
|
|
34
|
+
controllers: controllersCommand,
|
|
33
35
|
check: checksCommand,
|
|
34
36
|
'check-file': checkFileCommand,
|
|
35
37
|
rules: rulesCommand,
|
|
@@ -44,6 +46,7 @@ const USAGE = `Usage
|
|
|
44
46
|
[--broker none|rabbitmq|kafka|nats|redis|custom] [--cache none|redis] [--audit on|off]
|
|
45
47
|
[--errors none|sentry] [--logger stdout|pino|winston] [--style declared|explicit] [--assembly barrel|discovery]
|
|
46
48
|
[--dependencies signature|listed] [--refusals factories|classes]
|
|
49
|
+
[--routes controllers|functions]
|
|
47
50
|
[--package-manager npm|pnpm] [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
|
|
48
51
|
[--import-extension none|js]
|
|
49
52
|
[--context <name>:<core|supporting|generic>]... [--dry-run] [--force]
|
|
@@ -58,6 +61,7 @@ const USAGE = `Usage
|
|
|
58
61
|
ddd-ts-kit depcruise-config [--check|--write]
|
|
59
62
|
ddd-ts-kit build-aliases [--project <tsconfig>]
|
|
60
63
|
ddd-ts-kit error-factories --plan | --apply [--dry-run]
|
|
64
|
+
ddd-ts-kit controllers [<context>] [--dry-run]
|
|
61
65
|
ddd-ts-kit affected [--base <git-ref>] [--head <git-ref>] [--format text|json|github|env]
|
|
62
66
|
ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab] [--changed-since <git-ref>] [--self]
|
|
63
67
|
ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]
|
|
@@ -75,6 +79,9 @@ const NOTES = ` affected what a pull request has to run: the contexts a
|
|
|
75
79
|
error-factories moves a project from one class per error to static factories on one error class per
|
|
76
80
|
concept: --plan writes error-factories.plan.json, where each class is given its concept;
|
|
77
81
|
--apply follows it (classes, specs, every usage, "stack.refusals" in the config)
|
|
82
|
+
controllers moves the function routes of a project, or of one context, to controller classes: each
|
|
83
|
+
<name>.route.ts becomes <resource>/<name>/<name>.controller.ts behind the route group of
|
|
84
|
+
its resource, its schema files and its spec follow; a context is turned whole or not at all
|
|
78
85
|
describe one context as facts: use cases, routes, events, ports, policies, gateways, dependencies
|
|
79
86
|
status the next step of docs/architecture/plan.md, the slices of docs/architecture/slices.md by
|
|
80
87
|
status and by owner, and the TODO(domain), TODO(platform) and it.todo left in each context
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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
|
1
|
+
{"version":3,"file":"audit-vars.d.ts","sourceRoot":"","sources":["../../src/stack/audit-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAgBvD"}
|
package/dist/stack/audit-vars.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const WITH_AUDIT_STORE = ['knex', 'drizzle'];
|
|
2
2
|
/** Where the audit trail is kept: its SQL store with knex and drizzle, the memory of the process with anything else. */
|
|
3
3
|
export function auditVars(config) {
|
|
4
|
-
const { audit, orm, http } = config.stack;
|
|
4
|
+
const { audit, orm, http, routes } = config.stack;
|
|
5
5
|
const on = audit === 'on';
|
|
6
6
|
const sql = on && WITH_AUDIT_STORE.includes(orm);
|
|
7
7
|
return {
|
|
@@ -12,6 +12,8 @@ export function auditVars(config) {
|
|
|
12
12
|
knex: on && orm === 'knex',
|
|
13
13
|
drizzle: on && orm === 'drizzle',
|
|
14
14
|
route: on && http !== 'none',
|
|
15
|
+
functionRoute: on && http !== 'none' && routes === 'functions',
|
|
16
|
+
controller: on && http !== 'none' && routes === 'controllers',
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=audit-vars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-vars.js","sourceRoot":"","sources":["../../src/stack/audit-vars.ts"],"names":[],"mappings":"AAGA,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE7C,wHAAwH;AACxH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"audit-vars.js","sourceRoot":"","sources":["../../src/stack/audit-vars.ts"],"names":[],"mappings":"AAGA,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE7C,wHAAwH;AACxH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAClD,MAAM,EAAE,GAAG,KAAK,KAAK,IAAI,CAAC;IAC1B,MAAM,GAAG,GAAG,EAAE,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEjD,OAAO;QACL,EAAE;QACF,GAAG,EAAE,CAAC,EAAE;QACR,GAAG;QACH,MAAM,EAAE,EAAE,IAAI,CAAC,GAAG;QAClB,IAAI,EAAE,EAAE,IAAI,GAAG,KAAK,MAAM;QAC1B,OAAO,EAAE,EAAE,IAAI,GAAG,KAAK,SAAS;QAChC,KAAK,EAAE,EAAE,IAAI,IAAI,KAAK,MAAM;QAC5B,aAAa,EAAE,EAAE,IAAI,IAAI,KAAK,MAAM,IAAI,MAAM,KAAK,WAAW;QAC9D,UAAU,EAAE,EAAE,IAAI,IAAI,KAAK,MAAM,IAAI,MAAM,KAAK,aAAa;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.d.ts","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAa5D,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"stack-vars.d.ts","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAa5D,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CA6BvD"}
|
package/dist/stack/stack-vars.js
CHANGED
|
@@ -30,6 +30,7 @@ export function stackVars(config) {
|
|
|
30
30
|
audit: auditVars(config),
|
|
31
31
|
errors: errorVars(config),
|
|
32
32
|
refusals: one(refusals, ['factories', 'classes']),
|
|
33
|
+
routes: routeVars(config),
|
|
33
34
|
logger: one(logger, ['stdout', 'pino', 'winston']),
|
|
34
35
|
tests: { ...one(tests, ['vitest', 'jest']), module: tests === 'jest' ? '@jest/globals' : 'vitest' },
|
|
35
36
|
worker: { on: config.worker, off: !config.worker },
|
|
@@ -38,6 +39,21 @@ export function stackVars(config) {
|
|
|
38
39
|
persistence: persistenceVars(config),
|
|
39
40
|
};
|
|
40
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
|
+
}
|
|
41
57
|
function assemblyVars(config) {
|
|
42
58
|
const { style, assembly } = config.stack;
|
|
43
59
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-v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ERSION = "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
|
}
|
|
@@ -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
|
+
}
|