@ddd-ts-kit/http 0.113.1 → 0.114.1

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.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:c1e19772dde9e37c -->
2
+ <!-- translation-of: README.md sha256:84d504cf4373feae -->
3
3
 
4
4
  # @ddd-ts-kit/http
5
5
 
@@ -11,7 +11,7 @@ Chaque adaptateur passe par un seul pipeline (`executeRoute`) : validation, gest
11
11
  (handler), correspondance des erreurs. Le comportement est donc le même sur les quatre
12
12
  frameworks, et une seule suite de tests le prouve.
13
13
 
14
- ![La place du package dans une application : l'adaptateur de chaque framework remet chaque requête HTTP au même pipeline executeRoute, qui lance le gestionnaire de la route, et le gestionnaire appelle un cas d'usage ; la même liste de routes est montée sur le serveur et donnée à generateOpenApi, qui écrit le contrat](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-overview.fr.svg)
14
+ ![La place du package dans une application : l'adaptateur de chaque framework remet chaque requête HTTP au même pipeline executeRoute, qui lance le gestionnaire de la route, et le gestionnaire appelle un cas d'usage ; la même liste de routes est montée sur le serveur et donnée à generateOpenApi, qui écrit le contrat](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-overview.fr.svg)
15
15
 
16
16
  Le package vit dans la couche présentation : il transforme une requête HTTP en un appel de
17
17
  votre gestionnaire, et la réponse du gestionnaire (ou son refus) en une réponse HTTP. Il ne
@@ -189,7 +189,7 @@ fait que copier la requête HTTP de son framework dans une `RawRequest` (`params
189
189
  `headers`, `body`, `raw`, et le flux du corps, `stream`), l'appeler, et réécrire la
190
190
  `RouteResponse` qu'elle renvoie.
191
191
 
192
- ![Les étapes que suit executeRoute pour une requête HTTP : les identifiants, puis, dans le hook around, authentification, téléversement, validation, If-Match, contexte d'exécution et tenant, puis les gardes et handle dans la portée d'exécution, le contrôle de la réponse, les en-têtes et le 304 ; chaque étape qui peut refuser nomme son statut, et chaque refus devient un document problem](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-pipeline.fr.svg)
192
+ ![Les étapes que suit executeRoute pour une requête HTTP : les identifiants, puis, dans le hook around, authentification, téléversement, validation, If-Match, contexte d'exécution et tenant, puis les gardes et handle dans la portée d'exécution, le contrôle de la réponse, les en-têtes et le 304 ; chaque étape qui peut refuser nomme son statut, et chaque refus devient un document problem](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-pipeline.fr.svg)
193
193
 
194
194
  Les étapes inutiles sont sautées : pas de téléversement, pas d'`If-Match`, pas de garde, pas de
195
195
  validateur. Le premier refus termine la requête HTTP : une requête HTTP invalide n'atteint
@@ -558,7 +558,7 @@ et la réponse est en `application/problem+json` (RFC 9457) :
558
558
  "detail": "Order 7 does not exist.", "requestId": "..." }
559
559
  ```
560
560
 
561
- ![Comment la réponse à une erreur est choisie : une erreur qui n'est pas une DomainError répond 500 sans détail ; une DomainError reçoit le statut auquel son code correspond, d'après les défauts, les codes de l'application, sinon 422 ; un 5xx ne répond que son statut et son code, un 4xx un document problem avec son détail, ses faits exposés et ses erreurs de validation](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-error-answer.fr.svg)
561
+ ![Comment la réponse à une erreur est choisie : une erreur qui n'est pas une DomainError répond 500 sans détail ; une DomainError reçoit le statut auquel son code correspond, d'après les défauts, les codes de l'application, sinon 422 ; un 5xx ne répond que son statut et son code, un 4xx un document problem avec son détail, ses faits exposés et ses erreurs de validation](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-error-answer.fr.svg)
562
562
 
563
563
  Un refus construit par une fabrique porte des faits, et ils sont privés : le document ne
564
564
  contient, sous `facts`, que ceux que sa fabrique a exposés par leur nom, et aucun membre `facts`
@@ -975,7 +975,7 @@ Une route continue de répondre une valeur typée que vérifie son schéma de r
975
975
  l'en-tête `Accept` parmi ceux que la route déclare. L'application enregistre ses représentations
976
976
  une fois et donne le même ensemble aux adaptateurs et au générateur du contrat :
977
977
 
978
- ![Un gestionnaire répond une valeur typée ; le schéma de réponse la vérifie ; l'accès aux champs écarte ce que l'appelant ne peut pas lire ; la négociation sur Accept choisit JSON, XML ou CSV parmi ce que produit la route, ou refuse par un 406 quand aucun n'est en commun](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-value.fr.svg)
978
+ ![Un gestionnaire répond une valeur typée ; le schéma de réponse la vérifie ; l'accès aux champs écarte ce que l'appelant ne peut pas lire ; la négociation sur Accept choisit JSON, XML ou CSV parmi ce que produit la route, ou refuse par un 406 quand aucun n'est en commun](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-value.fr.svg)
979
979
 
980
980
  ```ts
981
981
  import { Representations, type ExecuteOptions } from '@ddd-ts-kit/http';
@@ -1197,7 +1197,7 @@ déjà : son schéma de corps de requête, les champs restreints de ce schéma,
1197
1197
  indications de présentation. `formRoutes` sert un `GET /forms/<operationId>` par route de ce
1198
1198
  genre, monté et documenté comme toute route :
1199
1199
 
1200
- ![Le schéma du corps de la réservation réserve la note interne ; la route du formulaire demande la permission de réserver et interroge Access à propos de l'agenda ; le praticien titulaire du bureau peut poser chaque champ, un assistant sur un bureau délégué voit la note en lecture seule, un patient qui réserve pour lui-même ne la voit pas, et un assistant sans délégation est refusé par un 403](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-form-per-caller.fr.svg)
1200
+ ![Le schéma du corps de la réservation réserve la note interne ; la route du formulaire demande la permission de réserver et interroge Access à propos de l'agenda ; le praticien titulaire du bureau peut poser chaque champ, un assistant sur un bureau délégué voit la note en lecture seule, un patient qui réserve pour lui-même ne la voit pas, et un assistant sans délégation est refusé par un 403](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-form-per-caller.fr.svg)
1201
1201
 
1202
1202
  ```ts
1203
1203
  // presentation/http/appointments/book-appointment/book-appointment.controller.ts, à côté de ses schémas
package/README.md CHANGED
@@ -9,7 +9,7 @@ same declaration.
9
9
  Every adapter goes through one pipeline (`executeRoute`): validation, handler, error mapping.
10
10
  The behaviour is therefore the same on the four frameworks, and one test suite proves it.
11
11
 
12
- ![The place of the package in an application: the adapter of each framework hands every request to the same executeRoute pipeline, which runs the handler of the route, and the handler calls a use case; the same list of routes is mounted on the server and given to generateOpenApi, which writes the contract](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-overview.svg)
12
+ ![The place of the package in an application: the adapter of each framework hands every request to the same executeRoute pipeline, which runs the handler of the route, and the handler calls a use case; the same list of routes is mounted on the server and given to generateOpenApi, which writes the contract](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-overview.svg)
13
13
 
14
14
  The package lives in the presentation layer: it turns an HTTP request into a call of your
15
15
  handler, and the answer of the handler (or its refusal) into an HTTP response. It decides
@@ -178,7 +178,7 @@ are on the [presentation layer](../../docs/concepts/presentation-layer.md) page.
178
178
  copies the request of its framework into a `RawRequest` (`params`, `query`, `headers`, `body`,
179
179
  `raw`, and the body `stream`), calls it, and writes back the `RouteResponse` it returns.
180
180
 
181
- ![The steps executeRoute takes for one request: the identifiers, then, inside the around hook, authentication, upload, validation, If-Match, execution context and tenant, then guards and handle inside the execution scope, the check of the answer, the headers and the 304; each step that can refuse names its status, and every refusal becomes a problem document](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-pipeline.svg)
181
+ ![The steps executeRoute takes for one request: the identifiers, then, inside the around hook, authentication, upload, validation, If-Match, execution context and tenant, then guards and handle inside the execution scope, the check of the answer, the headers and the 304; each step that can refuse names its status, and every refusal becomes a problem document](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-pipeline.svg)
182
182
 
183
183
  The steps that are not needed are skipped: no upload, no `If-Match`, no guard, no validator.
184
184
  The first refusal ends the request: a request that is not valid never reaches the check of a
@@ -528,7 +528,7 @@ A handler throws a `DomainError`; its `code` is mapped to a status in one place
528
528
  "detail": "Order 7 does not exist.", "requestId": "..." }
529
529
  ```
530
530
 
531
- ![How the answer to an error is chosen: an error that is not a DomainError answers 500 with no detail; a DomainError gets the status its code maps to, from the defaults, the codes of the application, else 422; a 5xx answers its status and code only, a 4xx a problem document with its detail, its exposed facts and its issues](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/http-package-error-answer.svg)
531
+ ![How the answer to an error is chosen: an error that is not a DomainError answers 500 with no detail; a DomainError gets the status its code maps to, from the defaults, the codes of the application, else 422; a 5xx answers its status and code only, a 4xx a problem document with its detail, its exposed facts and its issues](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/http-package-error-answer.svg)
532
532
 
533
533
  A refusal built by a factory carries facts, and they are private: the document holds, under
534
534
  `facts`, only the ones its factory exposed by name, and no `facts` member when it exposed none.
@@ -936,7 +936,7 @@ into the text of one media type, chosen per request by the `Accept` header among
936
936
  route declares. The application registers its representations once and gives the same set to
937
937
  the adapters and to the contract generator:
938
938
 
939
- ![A handler answers a typed value; the response schema checks it; field access leaves out what the caller may not read; negotiation on Accept picks JSON, XML or CSV among what the route produces, or refuses with 406 when none is in common](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-value.svg)
939
+ ![A handler answers a typed value; the response schema checks it; field access leaves out what the caller may not read; negotiation on Accept picks JSON, XML or CSV among what the route produces, or refuses with 406 when none is in common](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-value.svg)
940
940
 
941
941
  ```ts
942
942
  import { Representations, type ExecuteOptions } from '@ddd-ts-kit/http';
@@ -1144,7 +1144,7 @@ A route that declares `form` is described as a form, from what it already declar
1144
1144
  body schema, the restricted fields of that schema, and a few presentation hints. `formRoutes`
1145
1145
  serves one `GET /forms/<operationId>` per such route, mounted and documented like any route:
1146
1146
 
1147
- ![The body schema of the booking reserves the internal note; the form route asks the permission to book and Access about the calendar; the practitioner who holds the desk may set every field, an assistant on a delegated desk sees the note read-only, a patient booking for themselves does not see it, and an assistant without a delegation is refused with 403](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-form-per-caller.svg)
1147
+ ![The body schema of the booking reserves the internal note; the form route asks the permission to book and Access about the calendar; the practitioner who holds the desk may set every field, an assistant on a delegated desk sees the note read-only, a patient booking for themselves does not see it, and an assistant without a delegation is refused with 403](https://raw.githubusercontent.com/ddd-ts-kit/ddd-ts-kit/main/docs/assets/diagrams/representations-and-forms-one-form-per-caller.svg)
1148
1148
 
1149
1149
  ```ts
1150
1150
  // presentation/http/appointments/book-appointment/book-appointment.controller.ts, next to its schemas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/http",
3
- "version": "0.113.1",
3
+ "version": "0.114.1",
4
4
  "description": "Framework-agnostic route definitions with Express, Fastify, Hono and NestJS adapters, oRPC and tRPC procedures and OpenAPI 3.1 generation.",
5
5
  "keywords": [
6
6
  "ddd",
@@ -20,11 +20,11 @@
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/gbourgeat/ddd-ts-kit.git",
23
+ "url": "git+https://github.com/ddd-ts-kit/ddd-ts-kit.git",
24
24
  "directory": "packages/http"
25
25
  },
26
- "homepage": "https://gbourgeat.github.io/ddd-ts-kit/packages/http/",
27
- "bugs": "https://github.com/gbourgeat/ddd-ts-kit/issues",
26
+ "homepage": "https://ddd-ts-kit.github.io/ddd-ts-kit/packages/http/",
27
+ "bugs": "https://github.com/ddd-ts-kit/ddd-ts-kit/issues",
28
28
  "publishConfig": {
29
29
  "access": "public",
30
30
  "provenance": true
@@ -88,8 +88,8 @@
88
88
  "dist"
89
89
  ],
90
90
  "dependencies": {
91
- "@ddd-ts-kit/kernel": "0.113.1",
92
- "@ddd-ts-kit/validation": "0.113.1"
91
+ "@ddd-ts-kit/kernel": "0.114.1",
92
+ "@ddd-ts-kit/validation": "0.114.1"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@nestjs/common": ">=11.0.0",
@@ -128,8 +128,8 @@
128
128
  }
129
129
  },
130
130
  "devDependencies": {
131
- "@ddd-ts-kit/testing": "0.113.1",
132
- "@hono/node-server": "^2.1.6",
131
+ "@ddd-ts-kit/testing": "0.114.1",
132
+ "@hono/node-server": "^2.1.7",
133
133
  "@nestjs/common": "^12.3.2",
134
134
  "@nestjs/core": "^12.3.2",
135
135
  "@nestjs/platform-express": "^12.3.2",
@@ -144,7 +144,7 @@
144
144
  "busboy": "^1.6.0",
145
145
  "express": "^5.3.0",
146
146
  "fastify": "^5.12.7",
147
- "hono": "^4.13.16",
147
+ "hono": "^4.13.18",
148
148
  "reflect-metadata": "^0.2.2",
149
149
  "rxjs": "^7.8.0",
150
150
  "zod": "^4.6.5"