ddd-ts-kit 0.12.0 → 0.14.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 +19 -4
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +6 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/errors/kit-error-codes.d.ts.map +1 -1
- package/dist/check/errors/kit-error-codes.js +1 -0
- package/dist/check/errors/kit-error-codes.js.map +1 -1
- package/dist/check/explain/authz-docs.d.ts.map +1 -1
- package/dist/check/explain/authz-docs.js +12 -0
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/errors-docs.js +1 -1
- package/dist/check/explain/errors-docs.js.map +1 -1
- 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/schema-docs.d.ts +3 -0
- package/dist/check/explain/schema-docs.d.ts.map +1 -0
- package/dist/check/explain/schema-docs.js +28 -0
- package/dist/check/explain/schema-docs.js.map +1 -0
- package/dist/check/fixtures/authz-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-fixtures.js +38 -1
- package/dist/check/fixtures/authz-fixtures.js.map +1 -1
- 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/schema-fixtures.d.ts +3 -0
- package/dist/check/fixtures/schema-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/schema-fixtures.js +129 -0
- package/dist/check/fixtures/schema-fixtures.js.map +1 -0
- package/dist/check/rules/authz-fields-by-schema.d.ts +3 -0
- package/dist/check/rules/authz-fields-by-schema.d.ts.map +1 -0
- package/dist/check/rules/authz-fields-by-schema.js +33 -0
- package/dist/check/rules/authz-fields-by-schema.js.map +1 -0
- package/dist/check/rules/schema-no-duplicate-shape.d.ts +3 -0
- package/dist/check/rules/schema-no-duplicate-shape.d.ts.map +1 -0
- package/dist/check/rules/schema-no-duplicate-shape.js +60 -0
- package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -0
- package/dist/check/rules/schema-presentation-only.d.ts +3 -0
- package/dist/check/rules/schema-presentation-only.d.ts.map +1 -0
- package/dist/check/rules/schema-presentation-only.js +53 -0
- package/dist/check/rules/schema-presentation-only.js.map +1 -0
- package/dist/check/schemas/class-shapes.d.ts +9 -0
- package/dist/check/schemas/class-shapes.d.ts.map +1 -0
- package/dist/check/schemas/class-shapes.js +52 -0
- package/dist/check/schemas/class-shapes.js.map +1 -0
- package/dist/check/schemas/declared-shape.d.ts +9 -0
- package/dist/check/schemas/declared-shape.d.ts.map +1 -0
- package/dist/check/schemas/declared-shape.js +2 -0
- package/dist/check/schemas/declared-shape.js.map +1 -0
- package/dist/check/schemas/holds-schemas.d.ts +5 -0
- package/dist/check/schemas/holds-schemas.d.ts.map +1 -0
- package/dist/check/schemas/holds-schemas.js +12 -0
- package/dist/check/schemas/holds-schemas.js.map +1 -0
- package/dist/check/schemas/object-shapes.d.ts +8 -0
- package/dist/check/schemas/object-shapes.d.ts.map +1 -0
- package/dist/check/schemas/object-shapes.js +31 -0
- package/dist/check/schemas/object-shapes.js.map +1 -0
- package/dist/check/schemas/restored-code.d.ts +7 -0
- package/dist/check/schemas/restored-code.d.ts.map +1 -0
- package/dist/check/schemas/restored-code.js +17 -0
- package/dist/check/schemas/restored-code.js.map +1 -0
- package/dist/check/schemas/shared-presentation.d.ts +4 -0
- package/dist/check/schemas/shared-presentation.d.ts.map +1 -0
- package/dist/check/schemas/shared-presentation.js +5 -0
- package/dist/check/schemas/shared-presentation.js.map +1 -0
- package/dist/check/schemas/shares-schemas.d.ts +4 -0
- package/dist/check/schemas/shares-schemas.d.ts.map +1 -0
- package/dist/check/schemas/shares-schemas.js +5 -0
- package/dist/check/schemas/shares-schemas.js.map +1 -0
- package/dist/check/schemas/still-generated.d.ts +8 -0
- package/dist/check/schemas/still-generated.d.ts.map +1 -0
- package/dist/check/schemas/still-generated.js +11 -0
- package/dist/check/schemas/still-generated.js.map +1 -0
- package/dist/check/schemas/top-level-statements.d.ts +3 -0
- package/dist/check/schemas/top-level-statements.d.ts.map +1 -0
- package/dist/check/schemas/top-level-statements.js +21 -0
- package/dist/check/schemas/top-level-statements.js.map +1 -0
- package/dist/check/schemas/validation-packages.d.ts +3 -0
- package/dist/check/schemas/validation-packages.d.ts.map +1 -0
- package/dist/check/schemas/validation-packages.js +13 -0
- package/dist/check/schemas/validation-packages.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/default-allowed-packages.d.ts.map +1 -1
- package/dist/config/default-allowed-packages.js +1 -0
- package/dist/config/default-allowed-packages.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 +4 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +25 -2
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +5 -2
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/context-description.d.ts +6 -0
- package/dist/describe/context-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/presentation-of-route.d.ts +4 -0
- package/dist/describe/presentation-of-route.d.ts.map +1 -0
- package/dist/describe/presentation-of-route.js +15 -0
- package/dist/describe/presentation-of-route.js.map +1 -0
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +4 -1
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/read-routes.d.ts.map +1 -1
- package/dist/describe/read-routes.js +2 -0
- package/dist/describe/read-routes.js.map +1 -1
- package/dist/generate/kinds/form-kind.d.ts +3 -0
- package/dist/generate/kinds/form-kind.d.ts.map +1 -0
- package/dist/generate/kinds/form-kind.js +38 -0
- package/dist/generate/kinds/form-kind.js.map +1 -0
- package/dist/generate/kinds/presentation/controller-of.d.ts +10 -0
- package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -0
- package/dist/generate/kinds/presentation/controller-of.js +13 -0
- package/dist/generate/kinds/presentation/controller-of.js.map +1 -0
- package/dist/generate/kinds/presentation/controller-source.d.ts +13 -0
- package/dist/generate/kinds/presentation/controller-source.d.ts.map +1 -0
- package/dist/generate/kinds/presentation/controller-source.js +44 -0
- package/dist/generate/kinds/presentation/controller-source.js.map +1 -0
- package/dist/generate/kinds/representation-kind.d.ts +3 -0
- package/dist/generate/kinds/representation-kind.d.ts.map +1 -0
- package/dist/generate/kinds/representation-kind.js +54 -0
- package/dist/generate/kinds/representation-kind.js.map +1 -0
- package/dist/generate/kinds/route/controller-imports.d.ts.map +1 -1
- package/dist/generate/kinds/route/controller-imports.js +2 -1
- package/dist/generate/kinds/route/controller-imports.js.map +1 -1
- package/dist/generate/kinds/route/controller-types.d.ts.map +1 -1
- package/dist/generate/kinds/route/controller-types.js +4 -2
- package/dist/generate/kinds/route/controller-types.js.map +1 -1
- package/dist/generate/kinds/route/controller-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/controller-vars.js +21 -9
- package/dist/generate/kinds/route/controller-vars.js.map +1 -1
- package/dist/generate/kinds/route/dto-classes.d.ts +5 -2
- package/dist/generate/kinds/route/dto-classes.d.ts.map +1 -1
- package/dist/generate/kinds/route/dto-classes.js +6 -3
- package/dist/generate/kinds/route/dto-classes.js.map +1 -1
- package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
- package/dist/generate/kinds/route/route-vars.js +17 -4
- package/dist/generate/kinds/route/route-vars.js.map +1 -1
- package/dist/generate/kinds/route/search-line-libraries.d.ts +3 -0
- package/dist/generate/kinds/route/search-line-libraries.d.ts.map +1 -0
- package/dist/generate/kinds/route/search-line-libraries.js +3 -0
- package/dist/generate/kinds/route/search-line-libraries.js.map +1 -0
- package/dist/generate/kinds/route/shares-schemas.d.ts +4 -0
- package/dist/generate/kinds/route/shares-schemas.d.ts.map +1 -0
- package/dist/generate/kinds/route/shares-schemas.js +5 -0
- package/dist/generate/kinds/route/shares-schemas.js.map +1 -0
- package/dist/generate/kinds/route/write-controller.d.ts.map +1 -1
- package/dist/generate/kinds/route/write-controller.js +4 -2
- package/dist/generate/kinds/route/write-controller.js.map +1 -1
- package/dist/generate/kinds/route-kind.d.ts.map +1 -1
- package/dist/generate/kinds/route-kind.js +4 -2
- package/dist/generate/kinds/route-kind.js.map +1 -1
- package/dist/generate/kinds/schema-kind.d.ts +3 -0
- package/dist/generate/kinds/schema-kind.d.ts.map +1 -0
- package/dist/generate/kinds/schema-kind.js +36 -0
- package/dist/generate/kinds/schema-kind.js.map +1 -0
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +6 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +5 -0
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +5 -2
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/platform-files.js +3 -1
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +2 -0
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +27 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +18 -2
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +3 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/init/validation-dependencies.d.ts.map +1 -1
- package/dist/init/validation-dependencies.js +1 -0
- package/dist/init/validation-dependencies.js.map +1 -1
- package/dist/stack/stack-vars.js +25 -7
- 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/controller/controller.class-validator.ts.tpl +2 -2
- package/templates/controller/controller.none.ts.tpl +2 -2
- package/templates/controller/controller.search.ts.tpl +14 -0
- package/templates/controller/controller.standard-schema.ts.tpl +2 -2
- package/templates/controller/controller.typebox.ts.tpl +98 -0
- package/templates/controller/controller.zod.ts.tpl +2 -2
- package/templates/docs/openapi.json.tpl +15 -0
- package/templates/init/CLAUDE.md.tpl +2 -2
- package/templates/init/platform/auth/http-boundary.ts.tpl +20 -3
- package/templates/init/platform/compose-application.manual.ts.tpl +18 -0
- package/templates/init/platform/compose-application.tsyringe.ts.tpl +23 -0
- package/templates/init/platform/http/presentation-of.ts.tpl +27 -0
- package/templates/init/platform/http/start-http-server.express.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +84 -0
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +2 -2
- package/templates/init/platform/http/with-documentation.ts.tpl +13 -3
- package/templates/init/platform/http/with-forms.ts.tpl +7 -0
- package/templates/init/rules/application.md.tpl +1 -1
- package/templates/init/rules/presentation.md.tpl +4 -1
- package/templates/init/scripts/openapi.ts.tpl +27 -6
- package/templates/pipeline/biome.json.tpl +1 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/route/route.class-validator.ts.tpl +3 -3
- package/templates/route/route.none.ts.tpl +3 -3
- package/templates/route/route.search.ts.tpl +14 -0
- package/templates/route/route.standard-schema.ts.tpl +3 -3
- package/templates/route/route.typebox.ts.tpl +79 -0
- package/templates/route/route.zod.ts.tpl +3 -3
- package/templates/schema/schema.class-validator.ts.tpl +3 -0
- package/templates/schema/schema.custom.ts.tpl +14 -0
- package/templates/schema/schema.typebox.ts.tpl +8 -0
- package/templates/schema/schema.zod.ts.tpl +7 -0
package/README.md
CHANGED
|
@@ -38,8 +38,8 @@ its limits, `2` wrong usage (the message says what to do).
|
|
|
38
38
|
## init
|
|
39
39
|
|
|
40
40
|
```
|
|
41
|
-
ddd-ts-kit init [--http express|fastify|nest|none]
|
|
42
|
-
[--validation zod|class-validator|standard-schema|none]
|
|
41
|
+
ddd-ts-kit init [--http express|fastify|hono|nest|none]
|
|
42
|
+
[--validation zod|class-validator|typebox|standard-schema|none]
|
|
43
43
|
[--di tsyringe|nest|manual] [--tests vitest|jest]
|
|
44
44
|
[--orm drizzle|knex|prisma|typeorm|custom|none]
|
|
45
45
|
[--database postgres|mysql|sqlite|none]
|
|
@@ -53,6 +53,7 @@ ddd-ts-kit init [--http express|fastify|nest|none]
|
|
|
53
53
|
[--dependencies signature|listed] [--refusals factories|classes]
|
|
54
54
|
[--routes controllers|functions] [--value-objects throwing|result]
|
|
55
55
|
[--literals named|free] [--tenancy none|shared-table] [--queue database|redis|memory]
|
|
56
|
+
[--schemas shared|per-route]
|
|
56
57
|
[--package-manager npm|pnpm]
|
|
57
58
|
[--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
|
|
58
59
|
[--import-extension none|js] [--sdk]
|
|
@@ -165,6 +166,13 @@ file. `--routes functions`, or a config without the key, keeps one `defineRoute`
|
|
|
165
166
|
route, listed in `<context>.routes.ts`, as 0.1 to 0.3 wrote them; `controllers` moves a
|
|
166
167
|
project from one to the other, a context at a time.
|
|
167
168
|
|
|
169
|
+
**A shape is declared once.** `init` writes `"stack.schemas": "shared"`: a command route answers
|
|
170
|
+
its identifier with `acceptedSchema` of `@ddd-ts-kit/http`, one `Accepted` component in the
|
|
171
|
+
contract, and `generate schema <context> <Name>` (or `schema shared-kernel <Name>`) writes a
|
|
172
|
+
shape several routes use, which the contract documents once and every route refers to. The
|
|
173
|
+
`schema/*` rules hold that form. `--schemas per-route`, or a config without the key, keeps one
|
|
174
|
+
schema per route, an identifier answer included, as 0.1 to 0.5 wrote them.
|
|
175
|
+
|
|
168
176
|
**A value object throws its refusals.** `init` writes `"stack.valueObjects": "throwing"`:
|
|
169
177
|
`generate value-object` writes a `create` that returns the value object or throws the refusal of
|
|
170
178
|
its concept, and a spec that asserts it with `expectRefusal(() => ..)`. `--value-objects result`,
|
|
@@ -194,6 +202,7 @@ config, `docsUi`, `ci` and `logger` included.
|
|
|
194
202
|
| tracing | wired once, by the platform (`tracing/platform-only`): no `decorate` hook, no `decorate-bindings.ts`. `tracing.ts` starts `initTracing` of `@ddd-ts-kit/tracing/node` before any other module, on what `config/read-tracing.ts` validates: `OTEL_EXPORTER_OTLP_ENDPOINT` (a URL; left out, no span leaves the process), `TRACE_SAMPLE_RATIO` (0 to 1) and `TRACE_CONSUMERS` (`continue`, the default: a consumed event stays in the trace of its publication; `link`: each delivery starts a trace linked to it). With `--di tsyringe`: `lay-foundations.ts` builds `traceApplication({ consumers })`, `compose-application.ts` hands it to `kernelModule({ instrumentation })` (one span per use case, repository call, domain event, publication, consumer and job) and gives the outbox relay `tracedPublisher(bus)`. With hand wiring: `create-platform.ts` applies the members of `traceApplication()` itself (`useCase` on both buses, `domainEvents`, `publisher`, `binding` around every adapter, `job`, `executionScope`, `errorReporter`), with `tracedSubscriber` and `tracedPublisher` around the provider. With an HTTP stack, in both families, `auth/http-boundary.ts` sets `around: tracedRoutes()`: one `SERVER` span per request, named by its route |
|
|
195
203
|
| `--logger` | `src/platform/observability/create-logger.ts`, one per choice: `stdout` (the default) is the `StdoutLogger` of `@ddd-ts-kit/aspects`, JSON lines, credentials not redacted; `pino` is `createPinoLogger` of `@ddd-ts-kit/pino` (dependencies `pino` and `pino-pretty`); `winston` is `createWinstonLogger` of `@ddd-ts-kit/winston`; these two redact the credential keys of the kernel. Every entry carries `traceLogFields(scope)`: the correlation id, origin, actor and tenant of the work in progress and the ids of the active trace. `LOG_LEVEL`, `LOG_FORMAT` (`json`, the default, or `pretty`; with `stdout`, which has no pretty format, `pretty` is refused when the configuration is loaded) and `LOG_SCRUB_MESSAGES` (`[message removed]` in place of the message of a logged error that is not a `DomainError`) are validated in `config/load-config.ts`. Stopping the application flushes the error reporter, then the logger, last: `container.stop()` does it on tsyringe, `compose-application.ts` flushes explicitly with hand wiring. The tools and the tests compose the application without `log` and write nothing |
|
|
196
204
|
| `src/platform/auth/` | `create-authenticator.ts` (`--authn jwt`: `JwtAuthenticator` on `AUTH_ISSUER`, `AUTH_AUDIENCE`, `AUTH_JWKS_URI`; `--authn keycloak`: `keycloakAuthenticator` on `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_AUDIENCE` and the optional `KEYCLOAK_CLIENT_ID`; `--authn none`: `development-header-authenticator.ts`, which reads `x-development-actor` and throws in production), `principal-of.ts`, `security-schemes.ts`, `offline-authenticator.ts`, `http-boundary.ts` (`resolvePrincipal` answering a `Session`, `executionScope`, `errorMapper` and `onError`, spread into the mount options: every request runs inside the execution scope, with its correlation id), `create-authorizer.ts` and the files of the model (`roles.ts`, with the role `system` every system actor holds; `attribute-policies.ts`; `relationship-schema.ts`, `create-tuple-store.ts` and its contract spec, `relation-tuples.ts`, `relate-system-actors.ts`, `permission-mapping.ts` and `permissions.ts`; `custom-authorizer.ts`, its `authorizerContract` spec and `permissions.ts`), `authorization.ts` (`authorizationModule` with tsyringe) or `use-case-protection.ts` (the guard of the hand-wired buses), `access-policies.ts`, and with `--audit off` `log-decisions.ts` (one log entry per decision, ids and codes only). Without an HTTP stack there is no authenticator and no boundary |
|
|
205
|
+
| `--representations negotiated`, `--forms on` | `src/platform/http/presentation-of.ts` (`Representations.standard()` with `negotiated`, and `fieldDeciderOf` over the `Access` of the application), spread into the HTTP boundary and given to the contract script; with `--forms on`, `src/platform/http/with-forms.ts` adds `formRoutes` to the routes and `scripts/openapi.ts` writes `openapi/forms/<operationId>.json`. Both are the default with an HTTP stack; `json` and `off` leave them out ([docs/CONFIG.md](../../docs/CONFIG.md)) |
|
|
197
206
|
| `--audit on` | `src/platform/audit/`: `create-audit.ts` (the trail, the `onDecision` of the authorization, the refusals of the guards at the edge given to the HTTP boundary as `onGuardRefusal`, the middleware before the unit of work, the integration events subscribed under the consumer name `audit`), `audited-events.ts` (the registry `generate integration-event` adds to), `audit.module.ts`, and with an HTTP stack the read side: `audit.permissions.ts` (`audit:trail.read`), `search-audit-entries.query.ts`, its handler, `search-audit-entries.route.ts` (`GET /audit/entries`: cursor pages, filters `actorId`, `action`, `outcome`, `correlationId`). It is a capability of the platform, not a bounded context: no model, one protected query over the `AuditReader` port, bounded by the tenant of the actor (with `--tenancy shared-table`, by the tenant of the work through `TenantAuditReader`: platform staff read across tenants only inside `acrossTenants`). The refusals of a caller without a credential are not recorded. A scheduled job is audited like a request: origin `schedule`, actor `system:<context>.<job>`. With knex the two tables and their append-only triggers are created by the first migration; with drizzle the tables are in `schema.ts` and `npm run db:audit-guard` prints the trigger statements for a custom migration; with prisma, typeorm, `custom` or no ORM the trail is an `InMemoryAuditTrail` behind a `TODO(platform)`. The test databases leave the audit schema out of `reset()` |
|
|
198
207
|
| `--tenancy shared-table` | recorded as `stack.tenancy`; Knex or Drizzle only. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` or `tenantCondition` and `ownTenantCondition`; the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, or `tenantOutboxTable`), so consumers run in it; `tenancy/scoped-statement` judges the adapters. Row-level security, schema per tenant and database per tenant are refused, with what to wire by hand ([Multitenancy](../../docs/concepts/multitenancy.md)) |
|
|
199
208
|
| `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex or Drizzle with tsyringe): `createJobTable` and `createProcessTable`, or `jobsTable` and `processesTable`, in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform module rebinds `JobStore` and `ProcessStore` to them, so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default otherwise): nothing is written, the kernel module keeps both in the process. Refused off tsyringe, `database` with another ORM, `redis` without the cache |
|
|
@@ -281,6 +290,9 @@ ddd-ts-kit generate --help --json
|
|
|
281
290
|
| `controller` | the same arguments as `route` | the controller class, whatever `stack.routes` says: for a project of function routes that writes its next route as a class. `--cache` writes its cache policy: `private` (a `GET` of a caller, `max-age=0`, `must-revalidate`, strong `ETag`), `public` (a `GET` of a public use case, `max-age` 1m, `s-maxage` 5m, tagged with the resources of its path), `no-store`; refused on a write, and `public` behind a route group |
|
|
282
291
|
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts`: an empty class carrying `@RouteGroup`, behind `Authenticated` unless `--public` or `--role` says otherwise (`HasRole(Role.Admin)`, the role read from the vocabulary of the platform, `<platformDir>/auth/role.ts`, which gets it when it does not hold it); with `--group` it refines that group and inherits from it |
|
|
283
292
|
| `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts`: a declared guard class to fill, and its spec |
|
|
293
|
+
| `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | adds `produces` to the `@Controller` of the use case, and `consumes: ['application/xml']` to one that receives a body when XML is asked; says when CSV needs a page or a streamed list, and when `stack.representations` is not `negotiated` |
|
|
294
|
+
| `form` | `<context> <UseCase>` | adds `const form = defineForm<Infer<typeof body>>({ ... })` before the `@Controller` of a use case that receives a body, and `form` to its options: the hints of its form at `GET /forms/<operationId>` |
|
|
295
|
+
| `schema` | `<context\|shared-kernel> <Name>` | `presentation/http/shared/<name>.schema.ts` of the context, or `presentation/<name>.schema.ts` of the shared kernel: one shape of the contract declared once (a zod schema with `.meta({ id })`, a class-validator class, or a schema wrapped by `sharedSchema`), to fill; the routes use it whole, nested or in part |
|
|
284
296
|
| `integration-event` | `<context> <Aggregate> <Fact> [--version n]` | `defineIntegrationEvent` declaration in the published language (its payload in `<event>.v<n>.payload.ts` with class-validator or a schema of your own), index export, the publisher `application/integration/publishers/<event>.publisher.ts`, spec, registration, a line of `platform/audit/audited-events.ts` |
|
|
285
297
|
| `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, a class `<Name>IntegrationHandler` depending on `CommandBus`, its spec, its idempotent subscription under the consumer name `<context>.<name>`; refused unless the upstream is declared |
|
|
286
298
|
| `event-handler` | `<context> <Aggregate> <Fact> [--phase after-commit]` | reaction to a domain event of the context, spec, subscription; before the commit of the unit of work by default, after it with `--phase after-commit` (an effect no transaction covers, at most once), and the spec runs the reaction in that phase |
|
|
@@ -628,7 +640,7 @@ ddd-ts-kit describe <context>
|
|
|
628
640
|
|
|
629
641
|
One context as facts read from the config and the source text, in both styles: use cases with
|
|
630
642
|
their permission (or `public`), routes (method, path, operation id, use case, schema names, error
|
|
631
|
-
codes), consumed and published events, ports with their adapters, policies, gateways with their
|
|
643
|
+
codes, the media types they answer and read in besides JSON, their form), consumed and published events, ports with their adapters, policies, gateways with their
|
|
632
644
|
upstream, scheduled jobs, upstreams and downstreams. Field lists are not guessed: they are in
|
|
633
645
|
`openapi/openapi.yaml` and `docs/integration/event-catalog.md`. `docs` writes the same facts in
|
|
634
646
|
each `CONTEXT.md`.
|
|
@@ -641,7 +653,7 @@ each `CONTEXT.md`.
|
|
|
641
653
|
| `glossary`, `aggregates`, `domainEvents`, `permissions` | names |
|
|
642
654
|
| `upstreams`, `downstreams` | `{ context, relationship }` |
|
|
643
655
|
| `useCases` | `{ kind, name, permission, file }`, `kind` being `command` or `query` |
|
|
644
|
-
| `routes` | `{ method, path, operationId, useCase, permission, request: [{ part, schema }], responses: [{ status, schema }], errors, file }` |
|
|
656
|
+
| `routes` | `{ method, path, operationId, useCase, permission, request: [{ part, schema }], responses: [{ status, schema }], errors, file }`, and `produces`, `consumes` (media types besides JSON) and `form` (`GET /forms/<operationId>`) when the route declares them |
|
|
645
657
|
| `consumedEvents` | `{ type, version, from, handler, consumer, file }` |
|
|
646
658
|
| `publishedEvents` | `{ type, versions, publishers }` |
|
|
647
659
|
| `ports` | `{ name, kind, adapters, file }`, `kind` being that of its binding (`repository`, `external`, `gateway`) |
|
|
@@ -774,6 +786,7 @@ saying what to do instead. Exit code 1 when there is at least one error.
|
|
|
774
786
|
| `authz/declared` | in a module file, `builder.command(X)` or `builder.query(X)` without `.requires(` or `.public(` in its chain, unless the message class carries `@Requires` or `@Public` of `@ddd-ts-kit/kernel/declarations`; with manual or nest wiring, a command or query class absent from every `requires(X, ...)` and `publicUseCase(X)` of the module file and of `application/authorization/`; a `defineRoute` without `security` (the route type refuses it already, and an empty list too: this is the text-level net for a definition built loosely); in the declared style, the exported class of a `*.command.ts` or `*.query.ts` file carrying neither `@Requires` nor `@Public` |
|
|
775
787
|
| `authz/in-application` | `presentation/`: a test on roles, `isAdmin`, the import of an authorizer or of `Access`; `infrastructure/`: `authorize(` or `check(` on an authorizer or access, `ForbiddenError`; `domain/`: any import of `@ddd-ts-kit/auth`, of the actor types of the kernel (`Actor`, `ActorContext`, `Session`, `ExecutionContext`, the authorized messages), a read of `.roles` or `.permissions` on an actor. The request glue of `@ddd-ts-kit/auth` (`actorOf`, `sessionOf`, `resolveSession`, `SessionAuthenticator`) is free in `presentation/`. `presentation/` and `infrastructure/`: the import of `Requires`, `Public` or `Policy` from `@ddd-ts-kit/kernel/declarations`, or of the ports `Access` and `PolicyAccess` from `@ddd-ts-kit/auth`; they are free in `application/` |
|
|
776
788
|
| `authz/actor-explicit` | in `domain/` and `application/`: `ActorContext`, `ExecutionScope` (as a type or as a value: the class is the token of a dependency list), `AsyncLocalStorageExecutionScope`, `ScopedActorContext`, `AsyncLocalStorage`; `.current()` or `.require()` on an actor context or on something named `scope`, `scopes` or `...executionScope`; an import of `stampCreation`, `stampUpdate` or `tenantScopeOf` |
|
|
789
|
+
| `authz/fields-by-schema` | under `application/queries/`: `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, a comparison with a `role`, `isAdmin` |
|
|
777
790
|
| `aspects/outside-in` | an import of `@ddd-ts-kit/aspects/decorators` outside `infrastructure/` of a context and the platform directory: `presentation/`, the module file, `published-language/`, the shared kernel, `main.ts`, any other source (`domain/` and `application/` are reported by the two `layer/*` rules instead) |
|
|
778
791
|
| `tracing/platform-only` | an import of `@ddd-ts-kit/tracing` or of an `@opentelemetry/*` package outside the platform directory, `main.ts` and `apps/`, tests included |
|
|
779
792
|
| `tenancy/scoped-statement` | with `stack.tenancy` other than `none`, in `infrastructure/` of a context, tests aside: on Knex the executor used other than as an argument (`executor()(`, `executor().from(`, `executor().raw(`, `const db = ...executor();`) and any `.raw(`; on Drizzle, statement by statement, a read, update or delete on the executor whose where has no `tenantCondition(` nor `ownTenantCondition(` (inline or in the local it is given), an insert whose row has no `tenantScopeOf(`, a relational query (`executor().query`), a raw `execute(`, or the executor held in a variable; on both, a read model store built without its `tenant` option. A where built by another function is not followed |
|
|
@@ -800,6 +813,8 @@ saying what to do instead. Exit code 1 when there is at least one error.
|
|
|
800
813
|
| `scheduling/job-triggers-use-case` | in `application/scheduling/*.job.ts`: an exported class that does not implement `ScheduledJob`; a `run` that sends no command (no `.execute(` call); a repository in the dependency list or the constructor; an import from `domain/aggregates/`, `domain/entities/`, `domain/services/` or `infrastructure/`. A `builder.job(..)` registration of a class that lives elsewhere |
|
|
801
814
|
| `scheduling/job-name` | the first argument of `@Scheduled(..)` or `.job(..)` that is not a string literal `<context>.<job-name>` in lower-case kebab-case with the context of its file; a `systemActor(..)` of a job file passing another name; one job name used twice in the project |
|
|
802
815
|
| `errors/code-unique` | under `"stack.refusals": "factories"`, in the `domain/errors/` of a context: a code set a second time, by a factory (`refusal('CODE', ..)`) or by a class (`readonly code = 'CODE'`), with the file and line of the first. The same code in two contexts is not reported |
|
|
816
|
+
| `schema/presentation-only` | under `"stack.schemas": "shared"`: in the shared kernel outside `presentation/`, an import of a validation library; in `domain/`, `application/`, `infrastructure/`, `published-language/` and the shared kernel outside `presentation/`, an import of a file of `presentation/` of the shared kernel |
|
|
817
|
+
| `schema/no-duplicate-shape` | under `"stack.schemas": "shared"`, in the presentation layer of one context, or in it and `presentation/` of the shared kernel: a DTO class or an object schema (`z.object`, `v.object`, `Type.Object`) declaring the shape of another one, with the place of the original (the shared kernel, then `presentation/http/shared/`); two contexts are not compared, and request parameters and shapes still carrying a `TODO(domain)` of the generator are not judged |
|
|
803
818
|
| `errors/known-code` | under `"stack.refusals": "factories"`, in a `*.route.ts`: a code of the `errors` list that no refusal of the context of the route sets, that no class outside the contexts sets, and that is not a code of the kit |
|
|
804
819
|
|
|
805
820
|
More ids belong to `@ddd-ts-kit/eslint-plugin`, which reads the syntax tree where this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAgF7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA+E7C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { aspectsOutsideIn } from '../rules/aspects-outside-in.js';
|
|
2
2
|
import { authzActorExplicit } from '../rules/authz-actor-explicit.js';
|
|
3
|
+
import { authzFieldsBySchema } from '../rules/authz-fields-by-schema.js';
|
|
3
4
|
import { authzDeclared } from '../rules/authz-declared.js';
|
|
4
5
|
import { authzInApplication } from '../rules/authz-in-application.js';
|
|
5
6
|
import { cleanBlankLines } from '../rules/clean-blank-lines.js';
|
|
@@ -64,6 +65,8 @@ import { purityNoEnvironment } from '../rules/purity-no-environment.js';
|
|
|
64
65
|
import { purityNoSystemClock } from '../rules/purity-no-system-clock.js';
|
|
65
66
|
import { schedulingJobName } from '../rules/scheduling-job-name.js';
|
|
66
67
|
import { schedulingJobTriggersUseCase } from '../rules/scheduling-job-triggers-use-case.js';
|
|
68
|
+
import { schemaNoDuplicateShape } from '../rules/schema-no-duplicate-shape.js';
|
|
69
|
+
import { schemaPresentationOnly } from '../rules/schema-presentation-only.js';
|
|
67
70
|
import { standardNoParallelInterface } from '../rules/standard-no-parallel-interface.js';
|
|
68
71
|
import { tenancyScopedStatement } from '../rules/tenancy-scoped-statement.js';
|
|
69
72
|
import { testBuilderRequired } from '../rules/test-builder-required.js';
|
|
@@ -88,6 +91,8 @@ export const ARCHITECTURE_RULES = [
|
|
|
88
91
|
namingSuffix,
|
|
89
92
|
namingOneConceptPerFile,
|
|
90
93
|
namingSearchNotList,
|
|
94
|
+
schemaPresentationOnly,
|
|
95
|
+
schemaNoDuplicateShape,
|
|
91
96
|
testSpecRequired,
|
|
92
97
|
eventsNameFormat,
|
|
93
98
|
eventsDefinedInPublishedLanguage,
|
|
@@ -124,6 +129,7 @@ export const ARCHITECTURE_RULES = [
|
|
|
124
129
|
authzDeclared,
|
|
125
130
|
authzInApplication,
|
|
126
131
|
authzActorExplicit,
|
|
132
|
+
authzFieldsBySchema,
|
|
127
133
|
aspectsOutsideIn,
|
|
128
134
|
tracingPlatformOnly,
|
|
129
135
|
tenancyScopedStatement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE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B,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,qBAAqB;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-error-codes.d.ts","sourceRoot":"","sources":["../../../src/check/errors/kit-error-codes.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"kit-error-codes.d.ts","sourceRoot":"","sources":["../../../src/check/errors/kit-error-codes.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAsB5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit-error-codes.js","sourceRoot":"","sources":["../../../src/check/errors/kit-error-codes.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,qBAAqB;IACrB,cAAc;IACd,WAAW;IACX,sBAAsB;IACtB,kBAAkB;IAClB,sBAAsB;IACtB,SAAS;IACT,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,qBAAqB;IACrB,uBAAuB;IACvB,gBAAgB;IAChB,wBAAwB;IACxB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;CACnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"kit-error-codes.js","sourceRoot":"","sources":["../../../src/check/errors/kit-error-codes.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,qBAAqB;IACrB,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,sBAAsB;IACtB,SAAS;IACT,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,qBAAqB;IACrB,uBAAuB;IACvB,gBAAgB;IAChB,wBAAwB;IACxB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwDxD,CAAC"}
|
|
@@ -42,5 +42,17 @@ const { actor } = command;
|
|
|
42
42
|
// infrastructure/persistence/drizzle-invoice.repository.ts
|
|
43
43
|
const row = { ...toRow(invoice), ...stampCreation(this.scope, this.clock), ...tenantScopeOf(this.scope) };`,
|
|
44
44
|
},
|
|
45
|
+
'authz/fields-by-schema': {
|
|
46
|
+
why: 'A query that removes a field for the callers without a role answers one way in JSON and is forgotten in the CSV export, the XML of a partner and the form of the front end, and nobody reading the contract knows the field may be missing. Marked on the response schema with withFieldAccess of @ddd-ts-kit/http, the field is reserved to a permission or a policy once: the pipeline leaves it out of every representation for an actor who may not read it, refuses it in a request body from one who may not set it, the contract says so with x-field-access, and a form described by the server shows it read-only or not at all. Which rows the actor may read stays the access scope of the query. Judged: a test on the roles (roles.includes, some, every, find, indexOf), a comparison with a role, or isAdmin, in a file under application/queries/ of a context.',
|
|
47
|
+
bad: `// application/queries/get-appointment/get-appointment.handler.ts
|
|
48
|
+
const row = await this.appointments.findById(query.appointmentId);
|
|
49
|
+
return query.actor.roles.includes('practitioner') ? row : { ...row, internalNote: undefined };`,
|
|
50
|
+
good: `// application/queries/get-appointment/get-appointment.handler.ts
|
|
51
|
+
return this.appointments.findById(query.appointmentId);
|
|
52
|
+
// presentation/http/appointments/get-appointment/get-appointment.controller.ts
|
|
53
|
+
const answer = withFieldAccess(classSchema(GetAppointmentAnswer), {
|
|
54
|
+
internalNote: { read: { permission: schedulingPermissions['appointment.note.read'] } },
|
|
55
|
+
});`,
|
|
56
|
+
},
|
|
45
57
|
};
|
|
46
58
|
//# sourceMappingURL=authz-docs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,ykBAAykB;QAC9kB,GAAG,EAAE;;;;qDAI4C;QACjD,IAAI,EAAE;;;;;2GAKiG;KACxG;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,ykBAAykB;QAC9kB,GAAG,EAAE;;;;qDAI4C;QACjD,IAAI,EAAE;;;;;2GAKiG;KACxG;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,i1BAAi1B;QACt1B,GAAG,EAAE;;+FAEsF;QAC3F,IAAI,EAAE;;;;;IAKN;KACD;CACF,CAAC"}
|
|
@@ -21,7 +21,7 @@ export const ERRORS_DOCS = {
|
|
|
21
21
|
}`,
|
|
22
22
|
},
|
|
23
23
|
'errors/known-code': {
|
|
24
|
-
why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when a class outside the contexts (the platform, the shared kernel) does, or when it is a code of the kit: VALIDATION_FAILED, NOT_FOUND, CONFLICT, INVARIANT_VIOLATION, UNAUTHORIZED, FORBIDDEN, CONCURRENCY_CONFLICT, INVALID_CRITERIA, INVALID_PAGE_REQUEST, TIMEOUT, CIRCUIT_OPEN, BULKHEAD_FULL, ATTEMPTS_EXHAUSTED, the conditions of a write: PRECONDITION_FAILED, PRECONDITION_REQUIRED, and the refusals of a file: FILE_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, FILE_NOT_FOUND, FILE_REJECTED, INVALID_FILE_KEY. A code another context sets does not count: a context answers with its own language. Judged under "stack.refusals": "factories" only.',
|
|
24
|
+
why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when a class outside the contexts (the platform, the shared kernel) does, or when it is a code of the kit: VALIDATION_FAILED, NOT_FOUND, CONFLICT, INVARIANT_VIOLATION, UNAUTHORIZED, FORBIDDEN, NOT_ACCEPTABLE, CONCURRENCY_CONFLICT, INVALID_CRITERIA, INVALID_PAGE_REQUEST, TIMEOUT, CIRCUIT_OPEN, BULKHEAD_FULL, ATTEMPTS_EXHAUSTED, the conditions of a write: PRECONDITION_FAILED, PRECONDITION_REQUIRED, and the refusals of a file: FILE_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, FILE_NOT_FOUND, FILE_REJECTED, INVALID_FILE_KEY. A code another context sets does not count: a context answers with its own language. Judged under "stack.refusals": "factories" only.',
|
|
25
25
|
bad: `// domain/errors/appointment.error.ts sets 'SLOT_TAKEN'
|
|
26
26
|
defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_ALREADY_TAKEN'], security: ['bearer'] }, book);`,
|
|
27
27
|
good: `defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_TAKEN'], security: ['bearer'] }, book);`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,y1BAAy1B;QAC91B,GAAG,EAAE;;;;;;;;EAQP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,y1BAAy1B;QAC91B,GAAG,EAAE;;;;;;;;EAQP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,wiCAAwiC;QAC7iC,GAAG,EAAE;iIACwH;QAC7H,IAAI,EAAE,0HAA0H;KACjI;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"rule-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAqBpD,oGAAoG;AACpG,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBvD,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { LIFECYCLE_DOCS } from './lifecycle-docs.js';
|
|
|
12
12
|
import { PERSISTENCE_DOCS } from './persistence-docs.js';
|
|
13
13
|
import { PORTS_DOCS } from './ports-docs.js';
|
|
14
14
|
import { SCHEDULING_DOCS } from './scheduling-docs.js';
|
|
15
|
+
import { SCHEMA_DOCS } from './schema-docs.js';
|
|
15
16
|
import { STANDARD_DOCS } from './standard-docs.js';
|
|
16
17
|
import { TENANCY_DOCS } from './tenancy-docs.js';
|
|
17
18
|
import { TREE_DOCS } from './tree-docs.js';
|
|
@@ -32,6 +33,7 @@ export const RULE_DOCS = {
|
|
|
32
33
|
...PERSISTENCE_DOCS,
|
|
33
34
|
...PORTS_DOCS,
|
|
34
35
|
...SCHEDULING_DOCS,
|
|
36
|
+
...SCHEMA_DOCS,
|
|
35
37
|
...STANDARD_DOCS,
|
|
36
38
|
...TEN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;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,GAAG,UAAU;IACb,GAAG,UAAU;IACb,GAAG,YAAY;IACf,GAAG,WAAW;IACd,GAAG,mBAAmB;IACtB,GAAG,WAAW;IACd,GAAG,YAAY;IACf,GAAG,aAAa;IAChB,GAAG,UAAU;IACb,GAAG,WAAW;IACd,GAAG,cAAc;IACjB,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,GAAG,eAAe;IAClB,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,SAAS;IACZ,GAAG,WAAW;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/schema-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0BzD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const SCHEMA_DOCS = {
|
|
2
|
+
'schema/presentation-only': {
|
|
3
|
+
why: 'A schema says what a client sends or receives: it is a presentation type, and it changes with the contract, not with the model. The shared kernel is imported by every layer of every context, so a schema written there reaches the domain and the use cases, which then depend on the shape of a request. A schema shared by several contexts therefore lives under presentation/ of the shared kernel, and only presentation layers import it; a schema of one context lives in its presentation layer (domain/ and application/ are already refused any validation library by the layer rules). Judged: in the shared kernel outside presentation/, an import of a validation library (zod, class-validator, class-transformer, class-validator-jsonschema, valibot, arktype, TypeBox, @ddd-ts-kit/validation); in domain/, application/, infrastructure/ and published-language/ of a context, and in the shared kernel outside presentation/, an import of a file of presentation/ of the shared kernel. Specs are not judged. Judged under "stack.schemas": "shared" only.',
|
|
4
|
+
bad: `// shared-kernel/money.ts
|
|
5
|
+
import { IsInt, IsString } from 'class-validator';
|
|
6
|
+
export class MoneyDto { @IsInt() cents = 0; @IsString() currency = ''; }
|
|
7
|
+
// contexts/billing/application/commands/issue-invoice/issue-invoice.command.ts
|
|
8
|
+
import { MoneyDto } from '@/shared-kernel/presentation/money.schema';`,
|
|
9
|
+
good: `// shared-kernel/presentation/money.schema.ts
|
|
10
|
+
export class Money { @IsInt() cents = 0; @IsString() currency = ''; }
|
|
11
|
+
// contexts/billing/presentation/http/invoices/issue-invoice/issue-invoice.mapper.ts
|
|
12
|
+
import type { Money } from '@/shared-kernel/presentation/money.schema';
|
|
13
|
+
// maps Money to the command, which carries plain values`,
|
|
14
|
+
},
|
|
15
|
+
'schema/no-duplicate-shape': {
|
|
16
|
+
why: 'Two routes that declare the same shape by hand document it twice, as two unrelated schemas: the contract grows a copy per route, a client SDK generates two types for one thing, and the day the shape changes one copy is forgotten. Declared once and shared, it lands once in components.schemas and every route points at it with $ref; a route that needs a part of it derives that part (pick, omit, partial, extend) from the one declaration. Judged within one context, and between a context and presentation/ of the shared kernel: two contexts may declare the same structure, because an equal shape with two meanings is two concepts and sharing it would couple contexts that stay extractable. Compared: a DTO class (a class of the module that extends nothing, has no method and decorates each property), compared by its property names, their decorators with their arguments and whether each is optional; and the object of a schema builder (`z.object({...})`, `v.object({...})`, `Type.Object({...})`), compared by its entries whatever their order and layout. Empty shapes, shapes that still carry a TODO(domain) of the generator (every search line starts as `{ id }`), *.params.ts, *.query.ts and *.headers.ts files and the objects assigned to params, query or headers are not judged: a request parameter is documented per operation, never as a component. The original is the declaration of the shared kernel, then the one under presentation/http/shared/ of the context, then the first in path order; each copy is reported with the place of the original. Judged under "stack.schemas": "shared" only.',
|
|
17
|
+
bad: `// appointments/cancel-appointment/cancel-appointment.accepted.ts
|
|
18
|
+
export class CancelAppointmentAccepted { @IsString() id = ''; }
|
|
19
|
+
// appointments/confirm-appointment/confirm-appointment.accepted.ts
|
|
20
|
+
export class ConfirmAppointmentAccepted { @IsString() id = ''; }`,
|
|
21
|
+
good: `// both controllers answer with the identifier schema of the platform
|
|
22
|
+
import { acceptedSchema, type Accepted } from '@ddd-ts-kit/http';
|
|
23
|
+
response: { status: 201, description: 'Done.', body: acceptedSchema },
|
|
24
|
+
// a shape of the context, declared once: presentation/http/shared/slot.schema.ts
|
|
25
|
+
export const slotSchema = z.object({ startsAt: z.iso.datetime(), endsAt: z.iso.datetime() }).meta({ id: 'Slot' });`,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=schema-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-docs.js","sourceRoot":"","sources":["../../../src/check/explain/schema-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,0BAA0B,EAAE;QAC1B,GAAG,EAAE,mhCAAmhC;QACxhC,GAAG,EAAE;;;;sEAI6D;QAClE,IAAI,EAAE;;;;yDAI+C;KACtD;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,4jDAA4jD;QACjkD,GAAG,EAAE;;;iEAGwD;QAC7D,IAAI,EAAE;;;;mHAIyG;KAChH;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/authz-fixtures.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"authz-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/authz-fixtures.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ5C,eAAO,MAAM,cAAc,EAAE,SAAS,OAAO,EA8O5C,CAAC"}
|
|
@@ -4,7 +4,8 @@ import { declaredProject } from './declared-project.js';
|
|
|
4
4
|
import { handler } from './handler.js';
|
|
5
5
|
import { PATHS } from './paths.js';
|
|
6
6
|
import { project } from './project.js';
|
|
7
|
-
|
|
7
|
+
import { SAMPLES } from './samples.js';
|
|
8
|
+
const { ADAPTER, AGGREGATE, COMMAND, HANDLER, POLICY, QUERY_HANDLER, QUERY_HANDLER_SPEC, ROUTE } = PATHS;
|
|
8
9
|
export const AUTHZ_FIXTURES = [
|
|
9
10
|
{
|
|
10
11
|
ruleId: 'authz/in-application',
|
|
@@ -151,5 +152,41 @@ export const AUTHZ_FIXTURES = [
|
|
|
151
152
|
...handler("import { ExecutionScope } from '@ddd-ts-kit/kernel';\nimport { CommandHandler } from '@ddd-ts-kit/kernel/declarations';\nimport { IssueInvoiceCommand } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command.js';\n\n@CommandHandler(IssueInvoiceCommand, [ExecutionScope])\nexport class IssueInvoiceHandler {}\n"),
|
|
152
153
|
}),
|
|
153
154
|
},
|
|
155
|
+
{
|
|
156
|
+
ruleId: 'authz/fields-by-schema',
|
|
157
|
+
name: 'a query that answers what its read model holds, the scope narrowing the rows',
|
|
158
|
+
expect: 'pass',
|
|
159
|
+
files: project({
|
|
160
|
+
[QUERY_HANDLER]: "export class InvoicesIssuedHandler {\n async execute(query: InvoicesIssuedQuery): Promise<readonly InvoiceLine[]> {\n const scope = await this.access.scope(query.actor, permission, 'invoice');\n\n return this.invoices.search(scope);\n }\n}\n",
|
|
161
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
ruleId: 'authz/fields-by-schema',
|
|
166
|
+
name: 'a query that tests the roles it took out of the actor first',
|
|
167
|
+
expect: { file: QUERY_HANDLER },
|
|
168
|
+
files: project({
|
|
169
|
+
[QUERY_HANDLER]: "export class InvoicesIssuedHandler {\n async execute(query: InvoicesIssuedQuery): Promise<readonly InvoiceLine[]> {\n const { roles } = query.actor;\n const lines = await this.invoices.search(query.scope);\n\n return roles.includes('accountant') ? lines : lines.map(({ margin: _margin, ...line }) => line);\n }\n}\n",
|
|
170
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
171
|
+
}),
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
ruleId: 'authz/fields-by-schema',
|
|
175
|
+
name: 'a query that compares a role held in a variable of its own',
|
|
176
|
+
expect: { file: QUERY_HANDLER },
|
|
177
|
+
files: project({
|
|
178
|
+
[QUERY_HANDLER]: "export class InvoicesIssuedHandler {\n async execute(query: InvoicesIssuedQuery): Promise<readonly InvoiceLine[]> {\n const role = query.actor.attributes['role'];\n const lines = await this.invoices.search(query.scope);\n\n return role === 'accountant' ? lines : lines.map(({ margin: _margin, ...line }) => line);\n }\n}\n",
|
|
179
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
ruleId: 'authz/fields-by-schema',
|
|
184
|
+
name: 'a query that removes a field for the callers without a role',
|
|
185
|
+
expect: { file: QUERY_HANDLER },
|
|
186
|
+
files: project({
|
|
187
|
+
[QUERY_HANDLER]: "export class InvoicesIssuedHandler {\n async execute(query: InvoicesIssuedQuery): Promise<readonly InvoiceLine[]> {\n const lines = await this.invoices.search(query.scope);\n\n return query.actor.roles.includes('accountant') ? lines : lines.map(({ margin: _margin, ...line }) => line);\n }\n}\n",
|
|
188
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
154
191
|
];
|
|
155
192
|
//# sourceMappingURL=authz-fixtures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,E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EAAE,aAAa,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC;YACb,CAAC,aAAa,CAAC,EACb,wUAAwU;YAC1U,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,IAAI;SACnC,CAAC;KACH;IACD;QACE,MAAM,EAAE,wBAAwB;QAChC,IAAI,EAAE,4DAA4D;QAClE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC;YACb,CAAC,aAAa,CAAC,EACb,+UAA+U;YACjV,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,IAAI;SACnC,CAAC;KACH;IACD;QACE,MAAM,EAAE,wBAAwB;QAChC,IAAI,EAAE,6DAA6D;QACnE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;QAC/B,KAAK,EAAE,OAAO,CAAC;YACb,CAAC,aAAa,CAAC,EACb,gTAAgT;YAClT,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,IAAI;SACnC,CAAC;KACH;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAsCtC,CAAC"}
|
|
@@ -29,6 +29,7 @@ import { PERSISTENCE_FIXTURES } from './persistence-fixtures.js';
|
|
|
29
29
|
import { PORTS_FIXTURES } from './ports-fixtures.js';
|
|
30
30
|
import { PURITY_FIXTURES } from './purity-fixtures.js';
|
|
31
31
|
import { SCHEDULING_FIXTURES } from './scheduling-fixtures.js';
|
|
32
|
+
import { SCHEMA_FIXTURES } from './schema-fixtures.js';
|
|
32
33
|
import { STANDARD_FIXTURES } from './standard-fixtures.js';
|
|
33
34
|
import { TENANCY_FIXTURES } from './tenancy-fixtures.js';
|
|
34
35
|
import { TEST_FIXTURES } from './test-fixtures.js';
|
|
@@ -53,6 +54,7 @@ export const FIXTURES = [
|
|
|
53
54
|
...DECLARATIONS_FIXTURES,
|
|
54
55
|
...DOMAIN_EVENTS_FIXTURES,
|
|
55
56
|
...ERRORS_FIXTURES,
|
|
57
|
+
...SCHEMA_FIXTURES,
|
|
56
58
|
...EVENT_SOURCING_FIXTURES,
|
|
57
59
|
...EVENTS_FIXTURES,
|
|
58
60
|
...EXTENSION_FIXTURES,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAA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,uBAAuB;IAC1B,GAAG,uBAAuB;IAC1B,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,oBAAoB;IACvB,GAAG,eAAe;IAClB,GAAG,8BAA8B;IACjC,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,qBAAqB;IACxB,GAAG,sBAAsB;IACzB,GAAG,eAAe;IAClB,GAAG,uBAAuB;IAC1B,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,mBAAmB;IACtB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,aAAa;CACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,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AAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,GAAG,uBAAuB;IAC1B,GAAG,uBAAuB;IAC1B,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,oBAAoB;IACvB,GAAG,eAAe;IAClB,GAAG,8BAA8B;IACjC,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,qBAAqB;IACxB,GAAG,sBAAsB;IACzB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,uBAAuB;IAC1B,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,mBAAmB;IACtB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,aAAa;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/schema-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA+M5C,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EAAkD,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { CONFIG_FILE } from '../../config/index.js';
|
|
2
|
+
import { config } from './config.js';
|
|
3
|
+
import { PATHS } from './paths.js';
|
|
4
|
+
import { project } from './project.js';
|
|
5
|
+
import { source } from './source.js';
|
|
6
|
+
const { BILLING } = PATHS;
|
|
7
|
+
const HTTP = `${BILLING}/presentation/http/invoices`;
|
|
8
|
+
const SHARED = { [CONFIG_FILE]: config({ stack: { schemas: 'shared' } }) };
|
|
9
|
+
const MONEY_SCHEMA = 'src/shared-kernel/presentation/money.schema.ts';
|
|
10
|
+
const LOOSE_MONEY = 'src/shared-kernel/money.ts';
|
|
11
|
+
const MAPPER = `${HTTP}/issue-invoice/issue-invoice.mapper.ts`;
|
|
12
|
+
const ISSUE_ACCEPTED = `${HTTP}/issue-invoice/issue-invoice.accepted.ts`;
|
|
13
|
+
const VOID_ACCEPTED = `${HTTP}/void-invoice/void-invoice.accepted.ts`;
|
|
14
|
+
const ISSUE_PARAMS = `${HTTP}/issue-invoice/issue-invoice.params.ts`;
|
|
15
|
+
const VOID_PARAMS = `${HTTP}/void-invoice/void-invoice.params.ts`;
|
|
16
|
+
const ISSUE_CONTROLLER = `${HTTP}/issue-invoice/issue-invoice.controller.ts`;
|
|
17
|
+
const AMEND_CONTROLLER = `${HTTP}/amend-invoice/amend-invoice.controller.ts`;
|
|
18
|
+
const SHARED_SLOT = `${BILLING}/presentation/http/shared/slot.schema.ts`;
|
|
19
|
+
const ISSUE_BODY = `${HTTP}/issue-invoice/issue-invoice.body.ts`;
|
|
20
|
+
const CATALOG_ACCEPTED = `${PATHS.CATALOG}/presentation/http/products/list-product/list-product.accepted.ts`;
|
|
21
|
+
const ISSUE_LINE = `${HTTP}/search-invoices/search-invoices.line.ts`;
|
|
22
|
+
const VOID_LINE = `${HTTP}/search-voided-invoices/search-voided-invoices.line.ts`;
|
|
23
|
+
const money = (name) => source("import { IsInt, IsString } from 'class-validator';", '', `export class ${name} {`, ' @IsInt()', ' cents = 0;', '', ' @IsString()', " currency = '';", '}');
|
|
24
|
+
const dto = (name, property) => source("import { IsString } from 'class-validator';", '', `export class ${name} {`, ' @IsString()', ` ${property} = '';`, '}');
|
|
25
|
+
/** A line as `generate query --search` writes it: an identifier and the mark of what is left to declare. */
|
|
26
|
+
const generatedLine = (name) => source("import { IsString } from 'class-validator';", '', `export class ${name} {`, ' @IsString()', " id = '';", '', ' // TODO(domain): declare the fields that are part of the public contract.', '}');
|
|
27
|
+
const GENERATED_ZOD_LINE = 'z.object({\n id: z.string(),\n // TODO(domain): declare the public fields.\n})';
|
|
28
|
+
const MAPPING = source("import type { Money } from '@/shared-kernel/presentation/money.schema.js';", '', 'export class IssueInvoiceMapper {', ' amountOf(money: Money): number {', ' return money.cents;', ' }', '}');
|
|
29
|
+
const COMMAND_READING_A_SCHEMA = source("import type { Money } from '@/shared-kernel/presentation/money.schema.js';", '', 'export class IssueInvoiceCommand {', ' constructor(readonly amount: Money) {}', '}');
|
|
30
|
+
const controller = (body) => source("import { z } from 'zod';", "import { zodSchema } from '@ddd-ts-kit/validation/zod';", '', `export const body = zodSchema(${body});`);
|
|
31
|
+
const PRESENTATION_ONLY = [
|
|
32
|
+
{
|
|
33
|
+
ruleId: 'schema/presentation-only',
|
|
34
|
+
name: 'a schema shared by the contexts under presentation/ of the shared kernel, read by a presentation layer',
|
|
35
|
+
expect: 'pass',
|
|
36
|
+
files: project({ [MONEY_SCHEMA]: money('Money'), [MAPPER]: MAPPING }, SHARED),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
ruleId: 'schema/presentation-only',
|
|
40
|
+
name: 'a schema declared in the shared kernel outside presentation/',
|
|
41
|
+
expect: { file: LOOSE_MONEY },
|
|
42
|
+
files: project({ [LOOSE_MONEY]: money('Money') }, SHARED),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
ruleId: 'schema/presentation-only',
|
|
46
|
+
name: 'a command that carries a schema of presentation/ of the shared kernel',
|
|
47
|
+
expect: { file: PATHS.COMMAND },
|
|
48
|
+
files: project({ [MONEY_SCHEMA]: money('Money'), [PATHS.COMMAND]: COMMAND_READING_A_SCHEMA }, SHARED),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
ruleId: 'schema/presentation-only',
|
|
52
|
+
name: 'a project that does not say how it writes its schemas is not judged',
|
|
53
|
+
expect: 'pass',
|
|
54
|
+
files: project({ [LOOSE_MONEY]: money('Money') }),
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
const NO_DUPLICATE_SHAPE = [
|
|
58
|
+
{
|
|
59
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
60
|
+
name: 'two answers of different shapes',
|
|
61
|
+
expect: 'pass',
|
|
62
|
+
files: project({ [ISSUE_ACCEPTED]: dto('IssueInvoiceAccepted', 'id'), [VOID_ACCEPTED]: dto('VoidInvoiceAccepted', 'reference') }, SHARED),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
66
|
+
name: 'two DTO classes declaring the same properties with the same constraints',
|
|
67
|
+
expect: { file: VOID_ACCEPTED },
|
|
68
|
+
files: project({ [ISSUE_ACCEPTED]: dto('IssueInvoiceAccepted', 'id'), [VOID_ACCEPTED]: dto('VoidInvoiceAccepted', 'id') }, SHARED),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
72
|
+
name: 'two zod bodies declaring the same entries in another order and layout',
|
|
73
|
+
expect: { file: ISSUE_CONTROLLER },
|
|
74
|
+
files: project({
|
|
75
|
+
[AMEND_CONTROLLER]: controller('z.object({ cents: z.number().int(), currency: z.string().length(3) })'),
|
|
76
|
+
[ISSUE_CONTROLLER]: controller('z.object({\n currency: z.string().length(3),\n cents: z.number().int(),\n})'),
|
|
77
|
+
}, SHARED),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
81
|
+
name: 'two routes reading the same path parameter',
|
|
82
|
+
expect: 'pass',
|
|
83
|
+
files: project({ [ISSUE_PARAMS]: dto('IssueInvoiceParams', 'invoiceId'), [VOID_PARAMS]: dto('VoidInvoiceParams', 'invoiceId') }, SHARED),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
87
|
+
name: 'two contexts declaring the same shape, each in its own words',
|
|
88
|
+
expect: 'pass',
|
|
89
|
+
files: project({ [ISSUE_ACCEPTED]: dto('IssueInvoiceAccepted', 'id'), [CATALOG_ACCEPTED]: dto('ListProductAccepted', 'id') }, SHARED),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
93
|
+
name: 'a context copying a shape of presentation/ of the shared kernel',
|
|
94
|
+
expect: { file: CATALOG_ACCEPTED },
|
|
95
|
+
files: project({ [MONEY_SCHEMA]: money('Money'), [CATALOG_ACCEPTED]: money('ListProductAccepted') }, SHARED),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
99
|
+
name: 'a route copying a shape its context shares, though its path sorts first',
|
|
100
|
+
expect: { file: ISSUE_BODY },
|
|
101
|
+
files: project({ [SHARED_SLOT]: money('Slot'), [ISSUE_BODY]: money('IssueInvoiceBody') }, SHARED),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
105
|
+
name: 'two search lines the generator left to fill',
|
|
106
|
+
expect: 'pass',
|
|
107
|
+
files: project({ [ISSUE_LINE]: generatedLine('SearchInvoicesLine'), [VOID_LINE]: generatedLine('SearchVoidedInvoicesLine') }, SHARED),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
111
|
+
name: 'two zod search lines the generator left to fill',
|
|
112
|
+
expect: 'pass',
|
|
113
|
+
files: project({
|
|
114
|
+
[AMEND_CONTROLLER]: controller(GENERATED_ZOD_LINE),
|
|
115
|
+
[ISSUE_CONTROLLER]: controller(GENERATED_ZOD_LINE),
|
|
116
|
+
}, SHARED),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
ruleId: 'schema/no-duplicate-shape',
|
|
120
|
+
name: 'a project that does not say how it writes its schemas is not judged',
|
|
121
|
+
expect: 'pass',
|
|
122
|
+
files: project({
|
|
123
|
+
[ISSUE_ACCEPTED]: dto('IssueInvoiceAccepted', 'id'),
|
|
124
|
+
[VOID_ACCEPTED]: dto('VoidInvoiceAccepted', 'id'),
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
export const SCHEMA_FIXTURES = [...PRESENTATION_ONLY, ...NO_DUPLICATE_SHAPE];
|
|
129
|
+
//# sourceMappingURL=schema-fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/schema-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAC1B,MAAM,IAAI,GAAG,GAAG,OAAO,6BAA6B,CAAC;AACrD,MAAM,MAAM,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC;AAC3E,MAAM,YAAY,GAAG,gDAAgD,CAAC;AAC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