ddd-ts-kit 0.12.0 → 0.13.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.
Files changed (165) hide show
  1. package/README.md +13 -2
  2. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  3. package/dist/check/catalogue/architecture-rules.js +4 -0
  4. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  5. package/dist/check/explain/rule-docs.d.ts.map +1 -1
  6. package/dist/check/explain/rule-docs.js +2 -0
  7. package/dist/check/explain/rule-docs.js.map +1 -1
  8. package/dist/check/explain/schema-docs.d.ts +3 -0
  9. package/dist/check/explain/schema-docs.d.ts.map +1 -0
  10. package/dist/check/explain/schema-docs.js +28 -0
  11. package/dist/check/explain/schema-docs.js.map +1 -0
  12. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  13. package/dist/check/fixtures/fixtures.js +2 -0
  14. package/dist/check/fixtures/fixtures.js.map +1 -1
  15. package/dist/check/fixtures/schema-fixtures.d.ts +3 -0
  16. package/dist/check/fixtures/schema-fixtures.d.ts.map +1 -0
  17. package/dist/check/fixtures/schema-fixtures.js +129 -0
  18. package/dist/check/fixtures/schema-fixtures.js.map +1 -0
  19. package/dist/check/rules/schema-no-duplicate-shape.d.ts +3 -0
  20. package/dist/check/rules/schema-no-duplicate-shape.d.ts.map +1 -0
  21. package/dist/check/rules/schema-no-duplicate-shape.js +60 -0
  22. package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -0
  23. package/dist/check/rules/schema-presentation-only.d.ts +3 -0
  24. package/dist/check/rules/schema-presentation-only.d.ts.map +1 -0
  25. package/dist/check/rules/schema-presentation-only.js +53 -0
  26. package/dist/check/rules/schema-presentation-only.js.map +1 -0
  27. package/dist/check/schemas/class-shapes.d.ts +9 -0
  28. package/dist/check/schemas/class-shapes.d.ts.map +1 -0
  29. package/dist/check/schemas/class-shapes.js +52 -0
  30. package/dist/check/schemas/class-shapes.js.map +1 -0
  31. package/dist/check/schemas/declared-shape.d.ts +9 -0
  32. package/dist/check/schemas/declared-shape.d.ts.map +1 -0
  33. package/dist/check/schemas/declared-shape.js +2 -0
  34. package/dist/check/schemas/declared-shape.js.map +1 -0
  35. package/dist/check/schemas/holds-schemas.d.ts +5 -0
  36. package/dist/check/schemas/holds-schemas.d.ts.map +1 -0
  37. package/dist/check/schemas/holds-schemas.js +12 -0
  38. package/dist/check/schemas/holds-schemas.js.map +1 -0
  39. package/dist/check/schemas/object-shapes.d.ts +8 -0
  40. package/dist/check/schemas/object-shapes.d.ts.map +1 -0
  41. package/dist/check/schemas/object-shapes.js +31 -0
  42. package/dist/check/schemas/object-shapes.js.map +1 -0
  43. package/dist/check/schemas/restored-code.d.ts +7 -0
  44. package/dist/check/schemas/restored-code.d.ts.map +1 -0
  45. package/dist/check/schemas/restored-code.js +17 -0
  46. package/dist/check/schemas/restored-code.js.map +1 -0
  47. package/dist/check/schemas/shared-presentation.d.ts +4 -0
  48. package/dist/check/schemas/shared-presentation.d.ts.map +1 -0
  49. package/dist/check/schemas/shared-presentation.js +5 -0
  50. package/dist/check/schemas/shared-presentation.js.map +1 -0
  51. package/dist/check/schemas/shares-schemas.d.ts +4 -0
  52. package/dist/check/schemas/shares-schemas.d.ts.map +1 -0
  53. package/dist/check/schemas/shares-schemas.js +5 -0
  54. package/dist/check/schemas/shares-schemas.js.map +1 -0
  55. package/dist/check/schemas/still-generated.d.ts +8 -0
  56. package/dist/check/schemas/still-generated.d.ts.map +1 -0
  57. package/dist/check/schemas/still-generated.js +11 -0
  58. package/dist/check/schemas/still-generated.js.map +1 -0
  59. package/dist/check/schemas/top-level-statements.d.ts +3 -0
  60. package/dist/check/schemas/top-level-statements.d.ts.map +1 -0
  61. package/dist/check/schemas/top-level-statements.js +21 -0
  62. package/dist/check/schemas/top-level-statements.js.map +1 -0
  63. package/dist/check/schemas/validation-packages.d.ts +3 -0
  64. package/dist/check/schemas/validation-packages.d.ts.map +1 -0
  65. package/dist/check/schemas/validation-packages.js +13 -0
  66. package/dist/check/schemas/validation-packages.js.map +1 -0
  67. package/dist/commands/init.d.ts.map +1 -1
  68. package/dist/commands/init.js +1 -0
  69. package/dist/commands/init.js.map +1 -1
  70. package/dist/config/default-allowed-packages.d.ts.map +1 -1
  71. package/dist/config/default-allowed-packages.js +1 -0
  72. package/dist/config/default-allowed-packages.js.map +1 -1
  73. package/dist/config/index.d.ts +1 -1
  74. package/dist/config/index.d.ts.map +1 -1
  75. package/dist/config/index.js +1 -1
  76. package/dist/config/index.js.map +1 -1
  77. package/dist/config/parse-stack.d.ts.map +1 -1
  78. package/dist/config/parse-stack.js +2 -1
  79. package/dist/config/parse-stack.js.map +1 -1
  80. package/dist/config/stack.d.ts +11 -2
  81. package/dist/config/stack.d.ts.map +1 -1
  82. package/dist/config/stack.js +3 -2
  83. package/dist/config/stack.js.map +1 -1
  84. package/dist/generate/kinds/route/controller-imports.d.ts.map +1 -1
  85. package/dist/generate/kinds/route/controller-imports.js +2 -1
  86. package/dist/generate/kinds/route/controller-imports.js.map +1 -1
  87. package/dist/generate/kinds/route/controller-types.d.ts.map +1 -1
  88. package/dist/generate/kinds/route/controller-types.js +4 -2
  89. package/dist/generate/kinds/route/controller-types.js.map +1 -1
  90. package/dist/generate/kinds/route/controller-vars.d.ts.map +1 -1
  91. package/dist/generate/kinds/route/controller-vars.js +21 -9
  92. package/dist/generate/kinds/route/controller-vars.js.map +1 -1
  93. package/dist/generate/kinds/route/dto-classes.d.ts +5 -2
  94. package/dist/generate/kinds/route/dto-classes.d.ts.map +1 -1
  95. package/dist/generate/kinds/route/dto-classes.js +6 -3
  96. package/dist/generate/kinds/route/dto-classes.js.map +1 -1
  97. package/dist/generate/kinds/route/route-vars.d.ts.map +1 -1
  98. package/dist/generate/kinds/route/route-vars.js +17 -4
  99. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  100. package/dist/generate/kinds/route/search-line-libraries.d.ts +3 -0
  101. package/dist/generate/kinds/route/search-line-libraries.d.ts.map +1 -0
  102. package/dist/generate/kinds/route/search-line-libraries.js +3 -0
  103. package/dist/generate/kinds/route/search-line-libraries.js.map +1 -0
  104. package/dist/generate/kinds/route/shares-schemas.d.ts +4 -0
  105. package/dist/generate/kinds/route/shares-schemas.d.ts.map +1 -0
  106. package/dist/generate/kinds/route/shares-schemas.js +5 -0
  107. package/dist/generate/kinds/route/shares-schemas.js.map +1 -0
  108. package/dist/generate/kinds/route/write-controller.d.ts.map +1 -1
  109. package/dist/generate/kinds/route/write-controller.js +4 -2
  110. package/dist/generate/kinds/route/write-controller.js.map +1 -1
  111. package/dist/generate/kinds/route-kind.d.ts.map +1 -1
  112. package/dist/generate/kinds/route-kind.js +4 -2
  113. package/dist/generate/kinds/route-kind.js.map +1 -1
  114. package/dist/generate/kinds/schema-kind.d.ts +3 -0
  115. package/dist/generate/kinds/schema-kind.d.ts.map +1 -0
  116. package/dist/generate/kinds/schema-kind.js +36 -0
  117. package/dist/generate/kinds/schema-kind.js.map +1 -0
  118. package/dist/generate/kinds.d.ts.map +1 -1
  119. package/dist/generate/kinds.js +2 -0
  120. package/dist/generate/kinds.js.map +1 -1
  121. package/dist/generate/shared-writes.d.ts.map +1 -1
  122. package/dist/generate/shared-writes.js +5 -0
  123. package/dist/generate/shared-writes.js.map +1 -1
  124. package/dist/help/usage.d.ts +1 -1
  125. package/dist/help/usage.d.ts.map +1 -1
  126. package/dist/help/usage.js +3 -1
  127. package/dist/help/usage.js.map +1 -1
  128. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  129. package/dist/init/manifest/dependencies-for.js +2 -0
  130. package/dist/init/manifest/dependencies-for.js.map +1 -1
  131. package/dist/init/manifest/versions.d.ts.map +1 -1
  132. package/dist/init/manifest/versions.js +27 -24
  133. package/dist/init/manifest/versions.js.map +1 -1
  134. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  135. package/dist/init/stack/resolve-stack.js +4 -2
  136. package/dist/init/stack/resolve-stack.js.map +1 -1
  137. package/dist/init/stack/stack-options.d.ts +1 -0
  138. package/dist/init/stack/stack-options.d.ts.map +1 -1
  139. package/dist/init/validation-dependencies.d.ts.map +1 -1
  140. package/dist/init/validation-dependencies.js +1 -0
  141. package/dist/init/validation-dependencies.js.map +1 -1
  142. package/dist/stack/stack-vars.js +6 -5
  143. package/dist/stack/stack-vars.js.map +1 -1
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/package.json +2 -2
  147. package/templates/controller/controller.class-validator.ts.tpl +2 -2
  148. package/templates/controller/controller.none.ts.tpl +2 -2
  149. package/templates/controller/controller.search.ts.tpl +14 -0
  150. package/templates/controller/controller.standard-schema.ts.tpl +2 -2
  151. package/templates/controller/controller.typebox.ts.tpl +98 -0
  152. package/templates/controller/controller.zod.ts.tpl +2 -2
  153. package/templates/init/platform/http/start-http-server.hono.ts.tpl +84 -0
  154. package/templates/init/rules/presentation.md.tpl +3 -0
  155. package/templates/pipeline/package-scripts.json +1 -1
  156. package/templates/route/route.class-validator.ts.tpl +3 -3
  157. package/templates/route/route.none.ts.tpl +3 -3
  158. package/templates/route/route.search.ts.tpl +14 -0
  159. package/templates/route/route.standard-schema.ts.tpl +3 -3
  160. package/templates/route/route.typebox.ts.tpl +79 -0
  161. package/templates/route/route.zod.ts.tpl +3 -3
  162. package/templates/schema/schema.class-validator.ts.tpl +3 -0
  163. package/templates/schema/schema.custom.ts.tpl +14 -0
  164. package/templates/schema/schema.typebox.ts.tpl +8 -0
  165. 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`,
@@ -281,6 +289,7 @@ ddd-ts-kit generate --help --json
281
289
  | `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
290
  | `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
291
  | `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts`: a declared guard class to fill, and its spec |
292
+ | `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
293
  | `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
294
  | `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
295
  | `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 |
@@ -800,6 +809,8 @@ saying what to do instead. Exit code 1 when there is at least one error.
800
809
  | `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
810
  | `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
811
  | `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 |
812
+ | `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 |
813
+ | `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
814
  | `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
815
 
805
816
  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;AA6E7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA4E7C,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;AA+E7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA8E7C,CAAC"}
@@ -64,6 +64,8 @@ import { purityNoEnvironment } from '../rules/purity-no-environment.js';
64
64
  import { purityNoSystemClock } from '../rules/purity-no-system-clock.js';
65
65
  import { schedulingJobName } from '../rules/scheduling-job-name.js';
66
66
  import { schedulingJobTriggersUseCase } from '../rules/scheduling-job-triggers-use-case.js';
67
+ import { schemaNoDuplicateShape } from '../rules/schema-no-duplicate-shape.js';
68
+ import { schemaPresentationOnly } from '../rules/schema-presentation-only.js';
67
69
  import { standardNoParallelInterface } from '../rules/standard-no-parallel-interface.js';
68
70
  import { tenancyScopedStatement } from '../rules/tenancy-scoped-statement.js';
69
71
  import { testBuilderRequired } from '../rules/test-builder-required.js';
@@ -88,6 +90,8 @@ export const ARCHITECTURE_RULES = [
88
90
  namingSuffix,
89
91
  namingOneConceptPerFile,
90
92
  namingSearchNotList,
93
+ schemaPresentationOnly,
94
+ schemaNoDuplicateShape,
91
95
  testSpecRequired,
92
96
  eventsNameFormat,
93
97
  eventsDefinedInPublishedLanguage,
@@ -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,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE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yB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,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
+ {"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,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAA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AM,CAAC,MAAM,kBAAkB,GAAoB;IACjD,iBAAiB;IACjB,sBAAsB;IACtB,iCAAiC;IACjC,iCAAiC;IACjC,4BAA4B;IAC5B,2BAA2B;IAC3B,mCAAmC;IACnC,cAAc;IACd,UAAU;IACV,cAAc;IACd,YAAY;IACZ,uBAAuB;IACvB,mBAAmB;IACnB,sBAAsB;IACtB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,gCAAgC;IAChC,WAAW;IACX,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,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":"rule-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAoBpD,oGAAoG;AACpG,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBvD,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
  ...TENANCY_DOCS,
37
39
  ...TREE_DOCS,
@@ -1 +1 @@
1
- {"version":3,"file":"rule-docs.js","sourceRoot":"","sources":["../../../src/check/explain/rule-docs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO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AW;IACd,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,SAAS;IACZ,GAAG,WAAW;CACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RuleDoc } from '../model/rule-doc.js';
2
+ export declare const SCHEMA_DOCS: Readonly<Record<string, RuleDoc>>;
3
+ //# sourceMappingURL=schema-docs.d.ts.map
@@ -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":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAqCtC,CAAC"}
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,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,i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AuB;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,3 @@
1
+ import type { Fixture } from './fixture.js';
2
+ export declare const SCHEMA_FIXTURES: readonly Fixture[];
3
+ //# sourceMappingURL=schema-fixtures.d.ts.map
@@ -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,Y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F;IACD;QACE,MAAM,EAAE,2BAA2B;QACnC,IAAI,EAAE,iDAAiD;QACvD,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,OAAO,CACZ;YACE,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC;YAClD,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC;SACnD,EACD,MAAM,CACP;KACF;IACD;QACE,MAAM,EAAE,2BAA2B;QACnC,IAAI,EAAE,qEAAqE;QAC3E,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,OAAO,CAAC;YACb,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC;YACnD,CAAC,aAAa,CAAC,EAAE,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC;SAClD,CAAC;KACH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAuB,CAAC,GAAG,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from '../model/rule.js';
2
+ export declare const schemaNoDuplicateShape: Rule;
3
+ //# sourceMappingURL=schema-no-duplicate-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-no-duplicate-shape.d.ts","sourceRoot":"","sources":["../../../src/check/rules/schema-no-duplicate-shape.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA4B7C,eAAO,MAAM,sBAAsB,EAAE,IA2BpC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { classShapes } from '../schemas/class-shapes.js';
2
+ import { holdsSchemas } from '../schemas/holds-schemas.js';
3
+ import { objectShapes } from '../schemas/object-shapes.js';
4
+ import { restoredCode } from '../schemas/restored-code.js';
5
+ import { sharesSchemas } from '../schemas/shares-schemas.js';
6
+ import { reporter } from '../support/reporter.js';
7
+ /** What a route reads from its path, its query string or its headers is documented per operation, never as a component. */
8
+ const PARAMETER_FILE = /\.(?:params|query|headers)\.ts$/;
9
+ /** Where a context keeps the shapes its routes share: the declaration there is the original, a copy elsewhere is reported. */
10
+ const SHARED_OF_A_CONTEXT = '/presentation/http/shared/';
11
+ /** The home of the shapes of the shared kernel: every context compares its shapes with them. */
12
+ const KERNEL = '';
13
+ const FIX = 'Declare the shape once, under presentation/http/shared/ of its context (`ddd-ts-kit generate schema <context> <Name>`) or under presentation/ of the shared kernel when several contexts use it (`generate schema shared-kernel <Name>`), share it (`.meta({ id })` with zod, `classSchema(Dto, { shared: true })` with class-validator, `sharedSchema(name, schema)` otherwise) and use it in both places, whole or in part. An identifier answer is `acceptedSchema` of @ddd-ts-kit/http.';
14
+ export const schemaNoDuplicateShape = {
15
+ id: 'schema/no-duplicate-shape',
16
+ description: 'Under "stack.schemas": "shared", one shape of the HTTP contract is declared once in its context: no two DTO classes, and no two object schemas (zod, valibot, TypeBox), of the presentation layer of one context, or of a context and presentation/ of the shared kernel, declare the same properties with the same constraints. Two contexts may declare the same shape; request parameters and shapes the generator left to fill are not judged.',
17
+ scope: 'project',
18
+ run(project) {
19
+ if (!sharesSchemas(project)) {
20
+ return [];
21
+ }
22
+ const report = reporter(project, this.id);
23
+ const first = new Map();
24
+ return shapesOf(project).flatMap((shape) => {
25
+ const earlier = first.get(`${KERNEL}|${shape.key}`) ?? first.get(`${shape.home}|${shape.key}`);
26
+ if (earlier === undefined) {
27
+ first.set(`${shape.home}|${shape.key}`, shape);
28
+ return [];
29
+ }
30
+ const message = `${shape.what} declares the shape ${earlier.what.charAt(0).toLowerCase()}${earlier.what.slice(1)} already declares (${earlier.file}:${String(earlier.line)}).`;
31
+ return [report({ file: shape.file, line: shape.line }, message, FIX)];
32
+ });
33
+ },
34
+ };
35
+ function shapesOf(project) {
36
+ return project.files
37
+ .filter((file) => holdsSchemas(project, file) && !PARAMETER_FILE.test(file.path))
38
+ .map((file) => ({ file, home: file.location.area === 'context' ? file.location.context : KERNEL }))
39
+ .sort((a, b) => rank(a.file.path, a.home) - rank(b.file.path, b.home) || compare(a.file.path, b.file.path))
40
+ .flatMap(({ file, home }) => {
41
+ const code = restoredCode(file);
42
+ return [...classShapes(file, code), ...objectShapes(file, code)]
43
+ .sort((a, b) => a.line - b.line)
44
+ .map((shape) => ({ ...shape, file: file.path, home }));
45
+ });
46
+ }
47
+ /** The shared kernel first, then the shared shapes of each context, then the routes: a copy is reported, never its original. */
48
+ function rank(path, home) {
49
+ if (home === KERNEL) {
50
+ return 0;
51
+ }
52
+ return path.includes(SHARED_OF_A_CONTEXT) ? 1 : 2;
53
+ }
54
+ function compare(a, b) {
55
+ if (a === b) {
56
+ return 0;
57
+ }
58
+ return a < b ? -1 : 1;
59
+ }
60
+ //# sourceMappingURL=schema-no-duplicate-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-no-duplicate-shape.js","sourceRoot":"","sources":["../../../src/check/rules/schema-no-duplicate-shape.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,2HAA2H;AAC3H,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAEzD,8HAA8H;AAC9H,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAEzD,gGAAgG;AAChG,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,GAAG,GACP,6dAA6d,CAAC;AAQhe,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,EAAE,EAAE,2BAA2B;IAC/B,WAAW,EACT,obAAob;IACtb,KAAK,EAAE,SAAS;IAChB,GA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EAAE,IAAY;IACtC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,OAAO,CAAC,CAAS,EAAE,CAAS;IACnC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from '../model/rule.js';
2
+ export declare const schemaPresentationOnly: Rule;
3
+ //# sourceMappingURL=schema-presentation-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-presentation-only.d.ts","sourceRoot":"","sources":["../../../src/check/rules/schema-presentation-only.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW7C,eAAO,MAAM,sBAAsB,EAAE,IAgBpC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { holdsSchemas } from '../schemas/holds-schemas.js';
2
+ import { sharedPresentation } from '../schemas/shared-presentation.js';
3
+ import { sharesSchemas } from '../schemas/shares-schemas.js';
4
+ import { VALIDATION_PACKAGES } from '../schemas/validation-packages.js';
5
+ import { perFile } from '../support/per-file.js';
6
+ /** Where a context reads a type of the contract: its presentation layer; the module file and the specs wire and drive it. */
7
+ const READERS_OUTSIDE = ['domain', 'application', 'infrastructure', 'published-language'];
8
+ export const schemaPresentationOnly = {
9
+ id: 'schema/presentation-only',
10
+ description: 'Under "stack.schemas": "shared", a schema of the HTTP contract lives in presentation/: of its context, or of the shared kernel when several contexts answer with it. The shared kernel declares no schema anywhere else, and no domain, application, infrastructure or published language imports one of its presentation/.',
11
+ scope: 'file',
12
+ run(project) {
13
+ if (!sharesSchemas(project)) {
14
+ return [];
15
+ }
16
+ return perFile(project, this.id, (file) => file.isTest || holdsSchemas(project, file)
17
+ ? []
18
+ : [...declaredInSharedKernel(file), ...readOutsidePresentation(project, file)]);
19
+ },
20
+ };
21
+ function declaredInSharedKernel(file) {
22
+ if (file.location.area !== 'shared-kernel') {
23
+ return [];
24
+ }
25
+ return file.imports
26
+ .filter(({ target }) => target.kind === 'package' && VALIDATION_PACKAGES.includes(target.name))
27
+ .map(({ line, specifier }) => ({
28
+ line,
29
+ message: `The shared kernel declares a schema outside presentation/ (it imports "${specifier}"): every layer of every context may import the shared kernel, a schema there reaches the domain.`,
30
+ fix: 'Move the file under presentation/ of the shared kernel (`ddd-ts-kit generate schema shared-kernel <Name>` writes one there), or keep the value object it describes in the shared kernel as plain TypeScript and its schema in presentation/.',
31
+ }));
32
+ }
33
+ function readOutsidePresentation(project, file) {
34
+ const { location } = file;
35
+ const reader = location.area === 'shared-kernel' || (location.area === 'context' && READERS_OUTSIDE.includes(location.layer));
36
+ if (!reader) {
37
+ return [];
38
+ }
39
+ const directory = sharedPresentation(project.config);
40
+ return file.imports
41
+ .filter(({ target }) => target.kind === 'file' && target.path.startsWith(directory))
42
+ .map(({ line, specifier }) => ({
43
+ line,
44
+ message: `${describe(file)} imports "${specifier}", a schema of the HTTP contract: a schema is a presentation type, the model and the use cases never read one.`,
45
+ fix: 'Import it from presentation/ only, and map it there to the command, the query or the value object the inner layer expects.',
46
+ }));
47
+ }
48
+ function describe({ location }) {
49
+ return location.area === 'context'
50
+ ? `${location.layer}/ of ${location.context}`
51
+ : 'The shared kernel outside presentation/';
52
+ }
53
+ //# sourceMappingURL=schema-presentation-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-presentation-only.js","sourceRoot":"","sources":["../../../src/check/rules/schema-presentation-only.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC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redShape } from './declared-shape.js';
3
+ /**
4
+ * The DTO classes of a source: a class of the module that extends nothing, has no method and
5
+ * gives a decorator to each of its properties. Its shape is its properties, by name, each with
6
+ * its decorators and whether it is optional. A class the generator left to fill is not one yet.
7
+ */
8
+ export declare function classShapes(file: SourceFile, code: string): DeclaredShape[];
9
+ //# sourceMappingURL=class-shapes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-shapes.d.ts","sourceRoot":"","sources":["../../../src/check/schemas/class-shapes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAQ3E"}
@@ -0,0 +1,52 @@
1
+ import { matchingBracket } from '../text/matching-bracket.js';
2
+ import { stillGenerated } from './still-generated.js';
3
+ import { topLevelStatements } from './top-level-statements.js';
4
+ const DECORATOR_NAME = /@[A-Za-z_$][\w$]*\s*/y;
5
+ const PROPERTY = /^(?:(?:readonly|public|declare)\s+)*([A-Za-z_$][\w$]*)\s*([?!])?/;
6
+ /**
7
+ * The DTO classes of a source: a class of the module that extends nothing, has no method and
8
+ * gives a decorator to each of its properties. Its shape is its properties, by name, each with
9
+ * its decorators and whether it is optional. A class the generator left to fill is not one yet.
10
+ */
11
+ export function classShapes(file, code) {
12
+ return file.structure.classes.flatMap((shape) => {
13
+ const members = dtoMembers(shape, code);
14
+ return members === undefined || stillGenerated(file, shape.bodyStart, shape.end)
15
+ ? []
16
+ : [{ key: `class{${members.join(';')}}`, line: shape.line, what: `The class ${shape.name}` }];
17
+ });
18
+ }
19
+ function dtoMembers(shape, code) {
20
+ if (shape.depth !== 0 || shape.superclass !== undefined || shape.methods.length > 0) {
21
+ return undefined;
22
+ }
23
+ const members = topLevelStatements(code.slice(shape.bodyStart + 1, shape.end), ';').map(member);
24
+ const decorated = members.flatMap((one) => (one === undefined ? [] : [one]));
25
+ return decorated.length === 0 || decorated.length < members.length ? undefined : decorated.sort();
26
+ }
27
+ /** `name?:@IsString()@MaxLength(500)` for a decorated property; nothing for anything else. */
28
+ function member(statement) {
29
+ const { decorators, rest } = decoratorsOf(statement.trim());
30
+ const property = PROPERTY.exec(rest);
31
+ if (decorators.length === 0 || property === null) {
32
+ return undefined;
33
+ }
34
+ return `${property[1] ?? ''}${property[2] === '?' ? '?' : ''}:${decorators.join('')}`;
35
+ }
36
+ /** The decorators that open a statement, their arguments included, and what follows them. */
37
+ function decoratorsOf(statement) {
38
+ const decorators = [];
39
+ let at = 0;
40
+ for (;;) {
41
+ DECORATOR_NAME.lastIndex = at;
42
+ const name = DECORATOR_NAME.exec(statement);
43
+ if (name === null) {
44
+ return { decorators, rest: statement.slice(at).trim() };
45
+ }
46
+ const open = at + name[0].length;
47
+ const end = statement.charAt(open) === '(' ? matchingBracket(statement, open) + 1 : open;
48
+ decorators.push(statement.slice(at, end).replace(/\s+/g, ''));
49
+ at = end + (statement.slice(end).length - statement.slice(end).trimStart().length);
50
+ }
51
+ }
52
+ //# sourceMappingURL=class-shapes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-shapes.js","sourceRoot":"","sources":["../../../src/check/schemas/class-shapes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C,MAAM,QAAQ,GAAG,kEAAkE,CAAC;AAEpF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB,EAAE,IAAY;IACxD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,C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AG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9D,EAAE,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC;IACrF,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** A shape of the HTTP contract written by hand: a DTO class, or the object of a schema builder. */
2
+ export interface DeclaredShape {
3
+ /** The shape, written the same way whatever its layout: equal keys are one shape. */
4
+ readonly key: string;
5
+ readonly line: number;
6
+ /** How a reader finds it in its file. */
7
+ readonly what: string;
8
+ }
9
+ //# sourceMappingURL=declared-shape.d.ts.map