@ddd-ts-kit/http 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.
Files changed (471) hide show
  1. package/README.md +373 -11
  2. package/dist/controller/controller-routes.d.ts.map +1 -1
  3. package/dist/controller/controller-routes.js +8 -0
  4. package/dist/controller/controller-routes.js.map +1 -1
  5. package/dist/controller/controller-spec.d.ts +7 -0
  6. package/dist/controller/controller-spec.d.ts.map +1 -1
  7. package/dist/error/default-error-mapping.d.ts.map +1 -1
  8. package/dist/error/default-error-mapping.js +1 -0
  9. package/dist/error/default-error-mapping.js.map +1 -1
  10. package/dist/express/mount-express.d.ts +4 -2
  11. package/dist/express/mount-express.d.ts.map +1 -1
  12. package/dist/express/mount-express.js +25 -11
  13. package/dist/express/mount-express.js.map +1 -1
  14. package/dist/fastify/mount-fastify.d.ts +2 -1
  15. package/dist/fastify/mount-fastify.d.ts.map +1 -1
  16. package/dist/fastify/mount-fastify.js +23 -4
  17. package/dist/fastify/mount-fastify.js.map +1 -1
  18. package/dist/field-access/assert-writable.d.ts +8 -0
  19. package/dist/field-access/assert-writable.d.ts.map +1 -0
  20. package/dist/field-access/assert-writable.js +29 -0
  21. package/dist/field-access/assert-writable.js.map +1 -0
  22. package/dist/field-access/field-access-entry.d.ts +7 -0
  23. package/dist/field-access/field-access-entry.d.ts.map +1 -0
  24. package/dist/field-access/field-access-entry.js +2 -0
  25. package/dist/field-access/field-access-entry.js.map +1 -0
  26. package/dist/field-access/field-access.d.ts +13 -0
  27. package/dist/field-access/field-access.d.ts.map +1 -0
  28. package/dist/field-access/field-access.js +41 -0
  29. package/dist/field-access/field-access.js.map +1 -0
  30. package/dist/field-access/field-decider-of.d.ts +37 -0
  31. package/dist/field-access/field-decider-of.d.ts.map +1 -0
  32. package/dist/field-access/field-decider-of.js +30 -0
  33. package/dist/field-access/field-decider-of.js.map +1 -0
  34. package/dist/field-access/field-decider.d.ts +4 -0
  35. package/dist/field-access/field-decider.d.ts.map +1 -0
  36. package/dist/field-access/field-decider.js +2 -0
  37. package/dist/field-access/field-decider.js.map +1 -0
  38. package/dist/field-access/field-judge.d.ts +33 -0
  39. package/dist/field-access/field-judge.d.ts.map +1 -0
  40. package/dist/field-access/field-judge.js +81 -0
  41. package/dist/field-access/field-judge.js.map +1 -0
  42. package/dist/field-access/field-policy.d.ts +15 -0
  43. package/dist/field-access/field-policy.d.ts.map +1 -0
  44. package/dist/field-access/field-policy.js +2 -0
  45. package/dist/field-access/field-policy.js.map +1 -0
  46. package/dist/field-access/field-question.d.ts +18 -0
  47. package/dist/field-access/field-question.d.ts.map +1 -0
  48. package/dist/field-access/field-question.js +2 -0
  49. package/dist/field-access/field-question.js.map +1 -0
  50. package/dist/field-access/field-requirement.d.ts +13 -0
  51. package/dist/field-access/field-requirement.d.ts.map +1 -0
  52. package/dist/field-access/field-requirement.js +2 -0
  53. package/dist/field-access/field-requirement.js.map +1 -0
  54. package/dist/field-access/field-rule.d.ts +11 -0
  55. package/dist/field-access/field-rule.d.ts.map +1 -0
  56. package/dist/field-access/field-rule.js +2 -0
  57. package/dist/field-access/field-rule.js.map +1 -0
  58. package/dist/field-access/field-rules.d.ts +6 -0
  59. package/dist/field-access/field-rules.d.ts.map +1 -0
  60. package/dist/field-access/field-rules.js +2 -0
  61. package/dist/field-access/field-rules.js.map +1 -0
  62. package/dist/field-access/field-tree.d.ts +16 -0
  63. package/dist/field-access/field-tree.d.ts.map +1 -0
  64. package/dist/field-access/field-tree.js +28 -0
  65. package/dist/field-access/field-tree.js.map +1 -0
  66. package/dist/field-access/visible-body.d.ts +9 -0
  67. package/dist/field-access/visible-body.d.ts.map +1 -0
  68. package/dist/field-access/visible-body.js +42 -0
  69. package/dist/field-access/visible-body.js.map +1 -0
  70. package/dist/field-access/with-field-access.d.ts +17 -0
  71. package/dist/field-access/with-field-access.d.ts.map +1 -0
  72. package/dist/field-access/with-field-access.js +63 -0
  73. package/dist/field-access/with-field-access.js.map +1 -0
  74. package/dist/forms/assert-hints.d.ts +12 -0
  75. package/dist/forms/assert-hints.d.ts.map +1 -0
  76. package/dist/forms/assert-hints.js +32 -0
  77. package/dist/forms/assert-hints.js.map +1 -0
  78. package/dist/forms/assert-opens.d.ts +16 -0
  79. package/dist/forms/assert-opens.d.ts.map +1 -0
  80. package/dist/forms/assert-opens.js +24 -0
  81. package/dist/forms/assert-opens.js.map +1 -0
  82. package/dist/forms/constraints-of.d.ts +4 -0
  83. package/dist/forms/constraints-of.d.ts.map +1 -0
  84. package/dist/forms/constraints-of.js +24 -0
  85. package/dist/forms/constraints-of.js.map +1 -0
  86. package/dist/forms/define-form.d.ts +20 -0
  87. package/dist/forms/define-form.d.ts.map +1 -0
  88. package/dist/forms/define-form.js +8 -0
  89. package/dist/forms/define-form.js.map +1 -0
  90. package/dist/forms/field-block.d.ts +33 -0
  91. package/dist/forms/field-block.d.ts.map +1 -0
  92. package/dist/forms/field-block.js +2 -0
  93. package/dist/forms/field-block.js.map +1 -0
  94. package/dist/forms/field-hint.d.ts +18 -0
  95. package/dist/forms/field-hint.d.ts.map +1 -0
  96. package/dist/forms/field-hint.js +2 -0
  97. package/dist/forms/field-hint.js.map +1 -0
  98. package/dist/forms/field-lookup.d.ts +7 -0
  99. package/dist/forms/field-lookup.d.ts.map +1 -0
  100. package/dist/forms/field-lookup.js +2 -0
  101. package/dist/forms/field-lookup.js.map +1 -0
  102. package/dist/forms/form-block.d.ts +5 -0
  103. package/dist/forms/form-block.d.ts.map +1 -0
  104. package/dist/forms/form-block.js +2 -0
  105. package/dist/forms/form-block.js.map +1 -0
  106. package/dist/forms/form-condition.d.ts +9 -0
  107. package/dist/forms/form-condition.d.ts.map +1 -0
  108. package/dist/forms/form-condition.js +2 -0
  109. package/dist/forms/form-condition.js.map +1 -0
  110. package/dist/forms/form-describer.d.ts +35 -0
  111. package/dist/forms/form-describer.d.ts.map +1 -0
  112. package/dist/forms/form-describer.js +132 -0
  113. package/dist/forms/form-describer.js.map +1 -0
  114. package/dist/forms/form-description.d.ts +17 -0
  115. package/dist/forms/form-description.d.ts.map +1 -0
  116. package/dist/forms/form-description.js +2 -0
  117. package/dist/forms/form-description.js.map +1 -0
  118. package/dist/forms/form-document.d.ts +9 -0
  119. package/dist/forms/form-document.d.ts.map +1 -0
  120. package/dist/forms/form-document.js +2 -0
  121. package/dist/forms/form-document.js.map +1 -0
  122. package/dist/forms/form-documents-of.d.ts +10 -0
  123. package/dist/forms/form-documents-of.d.ts.map +1 -0
  124. package/dist/forms/form-documents-of.js +22 -0
  125. package/dist/forms/form-documents-of.js.map +1 -0
  126. package/dist/forms/form-format.d.ts +7 -0
  127. package/dist/forms/form-format.d.ts.map +1 -0
  128. package/dist/forms/form-format.js +3 -0
  129. package/dist/forms/form-format.js.map +1 -0
  130. package/dist/forms/form-group-hint.d.ts +8 -0
  131. package/dist/forms/form-group-hint.d.ts.map +1 -0
  132. package/dist/forms/form-group-hint.js +2 -0
  133. package/dist/forms/form-group-hint.js.map +1 -0
  134. package/dist/forms/form-hints.d.ts +16 -0
  135. package/dist/forms/form-hints.d.ts.map +1 -0
  136. package/dist/forms/form-hints.js +2 -0
  137. package/dist/forms/form-hints.js.map +1 -0
  138. package/dist/forms/form-of-route.d.ts +17 -0
  139. package/dist/forms/form-of-route.d.ts.map +1 -0
  140. package/dist/forms/form-of-route.js +47 -0
  141. package/dist/forms/form-of-route.js.map +1 -0
  142. package/dist/forms/form-query-schema.d.ts +10 -0
  143. package/dist/forms/form-query-schema.d.ts.map +1 -0
  144. package/dist/forms/form-query-schema.js +58 -0
  145. package/dist/forms/form-query-schema.js.map +1 -0
  146. package/dist/forms/form-query.d.ts +7 -0
  147. package/dist/forms/form-query.d.ts.map +1 -0
  148. package/dist/forms/form-query.js +2 -0
  149. package/dist/forms/form-query.js.map +1 -0
  150. package/dist/forms/form-requirement.d.ts +18 -0
  151. package/dist/forms/form-requirement.d.ts.map +1 -0
  152. package/dist/forms/form-requirement.js +2 -0
  153. package/dist/forms/form-requirement.js.map +1 -0
  154. package/dist/forms/form-routes.d.ts +19 -0
  155. package/dist/forms/form-routes.d.ts.map +1 -0
  156. package/dist/forms/form-routes.js +67 -0
  157. package/dist/forms/form-routes.js.map +1 -0
  158. package/dist/forms/form-schema.d.ts +4 -0
  159. package/dist/forms/form-schema.d.ts.map +1 -0
  160. package/dist/forms/form-schema.js +52 -0
  161. package/dist/forms/form-schema.js.map +1 -0
  162. package/dist/forms/group-block.d.ts +9 -0
  163. package/dist/forms/group-block.d.ts.map +1 -0
  164. package/dist/forms/group-block.js +2 -0
  165. package/dist/forms/group-block.js.map +1 -0
  166. package/dist/forms/json-form.d.ts +8 -0
  167. package/dist/forms/json-form.d.ts.map +1 -0
  168. package/dist/forms/json-form.js +2 -0
  169. package/dist/forms/json-form.js.map +1 -0
  170. package/dist/forms/json-forms-of.d.ts +12 -0
  171. package/dist/forms/json-forms-of.d.ts.map +1 -0
  172. package/dist/forms/json-forms-of.js +129 -0
  173. package/dist/forms/json-forms-of.js.map +1 -0
  174. package/dist/forms/lookups-of.d.ts +5 -0
  175. package/dist/forms/lookups-of.d.ts.map +1 -0
  176. package/dist/forms/lookups-of.js +7 -0
  177. package/dist/forms/lookups-of.js.map +1 -0
  178. package/dist/forms/widget-of.d.ts +5 -0
  179. package/dist/forms/widget-of.d.ts.map +1 -0
  180. package/dist/forms/widget-of.js +25 -0
  181. package/dist/forms/widget-of.js.map +1 -0
  182. package/dist/forms/widget.d.ts +3 -0
  183. package/dist/forms/widget.d.ts.map +1 -0
  184. package/dist/forms/widget.js +2 -0
  185. package/dist/forms/widget.js.map +1 -0
  186. package/dist/hono/edge-problem.d.ts +11 -0
  187. package/dist/hono/edge-problem.d.ts.map +1 -0
  188. package/dist/hono/edge-problem.js +15 -0
  189. package/dist/hono/edge-problem.js.map +1 -0
  190. package/dist/hono/hono-mount-options.d.ts +10 -0
  191. package/dist/hono/hono-mount-options.d.ts.map +1 -0
  192. package/dist/hono/hono-mount-options.js +2 -0
  193. package/dist/hono/hono-mount-options.js.map +1 -0
  194. package/dist/hono/hono-raw.d.ts +11 -0
  195. package/dist/hono/hono-raw.d.ts.map +1 -0
  196. package/dist/hono/hono-raw.js +2 -0
  197. package/dist/hono/hono-raw.js.map +1 -0
  198. package/dist/hono/mount-hono.d.ts +13 -0
  199. package/dist/hono/mount-hono.d.ts.map +1 -0
  200. package/dist/hono/mount-hono.js +77 -0
  201. package/dist/hono/mount-hono.js.map +1 -0
  202. package/dist/hono/read-body.d.ts +16 -0
  203. package/dist/hono/read-body.d.ts.map +1 -0
  204. package/dist/hono/read-body.js +65 -0
  205. package/dist/hono/read-body.js.map +1 -0
  206. package/dist/hono.d.ts +4 -0
  207. package/dist/hono.d.ts.map +1 -0
  208. package/dist/hono.js +2 -0
  209. package/dist/hono.js.map +1 -0
  210. package/dist/index.d.ts +43 -0
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js +20 -0
  213. package/dist/index.js.map +1 -1
  214. package/dist/openapi/cache-response-headers.d.ts +5 -2
  215. package/dist/openapi/cache-response-headers.d.ts.map +1 -1
  216. package/dist/openapi/cache-response-headers.js +10 -5
  217. package/dist/openapi/cache-response-headers.js.map +1 -1
  218. package/dist/openapi/definitions.d.ts +6 -1
  219. package/dist/openapi/definitions.d.ts.map +1 -1
  220. package/dist/openapi/definitions.js +12 -1
  221. package/dist/openapi/definitions.js.map +1 -1
  222. package/dist/openapi/documenting.d.ts +11 -0
  223. package/dist/openapi/documenting.d.ts.map +1 -0
  224. package/dist/openapi/documenting.js +2 -0
  225. package/dist/openapi/documenting.js.map +1 -0
  226. package/dist/openapi/generate-open-api.d.ts +7 -0
  227. package/dist/openapi/generate-open-api.d.ts.map +1 -1
  228. package/dist/openapi/generate-open-api.js +5 -1
  229. package/dist/openapi/generate-open-api.js.map +1 -1
  230. package/dist/openapi/path-items.d.ts +2 -3
  231. package/dist/openapi/path-items.d.ts.map +1 -1
  232. package/dist/openapi/path-items.js +8 -7
  233. package/dist/openapi/path-items.js.map +1 -1
  234. package/dist/openapi/request-body.d.ts +6 -3
  235. package/dist/openapi/request-body.d.ts.map +1 -1
  236. package/dist/openapi/request-body.js +13 -3
  237. package/dist/openapi/request-body.js.map +1 -1
  238. package/dist/openapi/responses.d.ts +2 -3
  239. package/dist/openapi/responses.d.ts.map +1 -1
  240. package/dist/openapi/responses.js +40 -12
  241. package/dist/openapi/responses.js.map +1 -1
  242. package/dist/openapi/schema-parameters.js +1 -1
  243. package/dist/openapi/schema-parameters.js.map +1 -1
  244. package/dist/pagination/every-page.d.ts +15 -0
  245. package/dist/pagination/every-page.d.ts.map +1 -0
  246. package/dist/pagination/every-page.js +21 -0
  247. package/dist/pagination/every-page.js.map +1 -0
  248. package/dist/pagination/page-schema-of.d.ts +3 -1
  249. package/dist/pagination/page-schema-of.d.ts.map +1 -1
  250. package/dist/pagination/page-schema-of.js +11 -3
  251. package/dist/pagination/page-schema-of.js.map +1 -1
  252. package/dist/pipeline/assert-cached-routes.d.ts +4 -2
  253. package/dist/pipeline/assert-cached-routes.d.ts.map +1 -1
  254. package/dist/pipeline/assert-cached-routes.js +46 -8
  255. package/dist/pipeline/assert-cached-routes.js.map +1 -1
  256. package/dist/pipeline/conditional-answer.d.ts +7 -2
  257. package/dist/pipeline/conditional-answer.d.ts.map +1 -1
  258. package/dist/pipeline/conditional-answer.js +10 -6
  259. package/dist/pipeline/conditional-answer.js.map +1 -1
  260. package/dist/pipeline/entity-tag-of.d.ts +3 -3
  261. package/dist/pipeline/entity-tag-of.d.ts.map +1 -1
  262. package/dist/pipeline/entity-tag-of.js +4 -4
  263. package/dist/pipeline/entity-tag-of.js.map +1 -1
  264. package/dist/pipeline/error-context.d.ts +6 -1
  265. package/dist/pipeline/error-context.d.ts.map +1 -1
  266. package/dist/pipeline/execute-options.d.ts +17 -0
  267. package/dist/pipeline/execute-options.d.ts.map +1 -1
  268. package/dist/pipeline/execute-route.d.ts.map +1 -1
  269. package/dist/pipeline/execute-route.js +121 -35
  270. package/dist/pipeline/execute-route.js.map +1 -1
  271. package/dist/pipeline/iterated-within.d.ts +9 -0
  272. package/dist/pipeline/iterated-within.d.ts.map +1 -0
  273. package/dist/pipeline/iterated-within.js +17 -0
  274. package/dist/pipeline/iterated-within.js.map +1 -0
  275. package/dist/pipeline/negotiated-vary.d.ts +6 -0
  276. package/dist/pipeline/negotiated-vary.d.ts.map +1 -0
  277. package/dist/pipeline/negotiated-vary.js +15 -0
  278. package/dist/pipeline/negotiated-vary.js.map +1 -0
  279. package/dist/pipeline/negotiation.d.ts +19 -0
  280. package/dist/pipeline/negotiation.d.ts.map +1 -0
  281. package/dist/pipeline/negotiation.js +19 -0
  282. package/dist/pipeline/negotiation.js.map +1 -0
  283. package/dist/pipeline/primed.d.ts +6 -0
  284. package/dist/pipeline/primed.d.ts.map +1 -0
  285. package/dist/pipeline/primed.js +20 -0
  286. package/dist/pipeline/primed.js.map +1 -0
  287. package/dist/pipeline/read-body.d.ts +10 -0
  288. package/dist/pipeline/read-body.d.ts.map +1 -0
  289. package/dist/pipeline/read-body.js +33 -0
  290. package/dist/pipeline/read-body.js.map +1 -0
  291. package/dist/pipeline/reported-stream.d.ts +6 -0
  292. package/dist/pipeline/reported-stream.d.ts.map +1 -0
  293. package/dist/pipeline/reported-stream.js +14 -0
  294. package/dist/pipeline/reported-stream.js.map +1 -0
  295. package/dist/pipeline/represented-answer.d.ts +7 -0
  296. package/dist/pipeline/represented-answer.d.ts.map +1 -0
  297. package/dist/pipeline/represented-answer.js +2 -0
  298. package/dist/pipeline/represented-answer.js.map +1 -0
  299. package/dist/pipeline/represented.d.ts +7 -0
  300. package/dist/pipeline/represented.d.ts.map +1 -0
  301. package/dist/pipeline/represented.js +19 -0
  302. package/dist/pipeline/represented.js.map +1 -0
  303. package/dist/pipeline/route-response.d.ts +2 -0
  304. package/dist/pipeline/route-response.d.ts.map +1 -1
  305. package/dist/pipeline/tagged-answer.d.ts +5 -2
  306. package/dist/pipeline/tagged-answer.d.ts.map +1 -1
  307. package/dist/pipeline/tagged-answer.js +1 -1
  308. package/dist/pipeline/tagged-answer.js.map +1 -1
  309. package/dist/pipeline/write-stream.d.ts +8 -0
  310. package/dist/pipeline/write-stream.d.ts.map +1 -0
  311. package/dist/pipeline/write-stream.js +23 -0
  312. package/dist/pipeline/write-stream.js.map +1 -0
  313. package/dist/pipeline/written-in.d.ts +10 -0
  314. package/dist/pipeline/written-in.d.ts.map +1 -0
  315. package/dist/pipeline/written-in.js +17 -0
  316. package/dist/pipeline/written-in.js.map +1 -0
  317. package/dist/representation/assert-served.d.ts +10 -0
  318. package/dist/representation/assert-served.d.ts.map +1 -0
  319. package/dist/representation/assert-served.js +18 -0
  320. package/dist/representation/assert-served.js.map +1 -0
  321. package/dist/representation/body-shape.d.ts +9 -0
  322. package/dist/representation/body-shape.d.ts.map +1 -0
  323. package/dist/representation/body-shape.js +2 -0
  324. package/dist/representation/body-shape.js.map +1 -0
  325. package/dist/representation/csv/csv-cell.d.ts +8 -0
  326. package/dist/representation/csv/csv-cell.d.ts.map +1 -0
  327. package/dist/representation/csv/csv-cell.js +19 -0
  328. package/dist/representation/csv/csv-cell.js.map +1 -0
  329. package/dist/representation/csv/csv-representation.d.ts +16 -0
  330. package/dist/representation/csv/csv-representation.d.ts.map +1 -0
  331. package/dist/representation/csv/csv-representation.js +54 -0
  332. package/dist/representation/csv/csv-representation.js.map +1 -0
  333. package/dist/representation/is-json-media-type.d.ts +3 -0
  334. package/dist/representation/is-json-media-type.d.ts.map +1 -0
  335. package/dist/representation/is-json-media-type.js +5 -0
  336. package/dist/representation/is-json-media-type.js.map +1 -0
  337. package/dist/representation/json-representation.d.ts +14 -0
  338. package/dist/representation/json-representation.d.ts.map +1 -0
  339. package/dist/representation/json-representation.js +40 -0
  340. package/dist/representation/json-representation.js.map +1 -0
  341. package/dist/representation/malformed-body.d.ts +4 -0
  342. package/dist/representation/malformed-body.d.ts.map +1 -0
  343. package/dist/representation/malformed-body.js +6 -0
  344. package/dist/representation/malformed-body.js.map +1 -0
  345. package/dist/representation/media-type-of.d.ts +3 -0
  346. package/dist/representation/media-type-of.d.ts.map +1 -0
  347. package/dist/representation/media-type-of.js +7 -0
  348. package/dist/representation/media-type-of.js.map +1 -0
  349. package/dist/representation/negotiate.d.ts +8 -0
  350. package/dist/representation/negotiate.d.ts.map +1 -0
  351. package/dist/representation/negotiate.js +55 -0
  352. package/dist/representation/negotiate.js.map +1 -0
  353. package/dist/representation/not-acceptable-error.d.ts +7 -0
  354. package/dist/representation/not-acceptable-error.d.ts.map +1 -0
  355. package/dist/representation/not-acceptable-error.js +7 -0
  356. package/dist/representation/not-acceptable-error.js.map +1 -0
  357. package/dist/representation/problem-shape.d.ts +4 -0
  358. package/dist/representation/problem-shape.d.ts.map +1 -0
  359. package/dist/representation/problem-shape.js +7 -0
  360. package/dist/representation/problem-shape.js.map +1 -0
  361. package/dist/representation/representation.d.ts +20 -0
  362. package/dist/representation/representation.d.ts.map +1 -0
  363. package/dist/representation/representation.js +9 -0
  364. package/dist/representation/representation.js.map +1 -0
  365. package/dist/representation/representations.d.ts +33 -0
  366. package/dist/representation/representations.d.ts.map +1 -0
  367. package/dist/representation/representations.js +85 -0
  368. package/dist/representation/representations.js.map +1 -0
  369. package/dist/representation/represented-body.d.ts +3 -0
  370. package/dist/representation/represented-body.d.ts.map +1 -0
  371. package/dist/representation/represented-body.js +2 -0
  372. package/dist/representation/represented-body.js.map +1 -0
  373. package/dist/representation/stream-schema-of.d.ts +10 -0
  374. package/dist/representation/stream-schema-of.d.ts.map +1 -0
  375. package/dist/representation/stream-schema-of.js +31 -0
  376. package/dist/representation/stream-schema-of.js.map +1 -0
  377. package/dist/representation/unsupported-media-type-error.d.ts +7 -0
  378. package/dist/representation/unsupported-media-type-error.d.ts.map +1 -0
  379. package/dist/representation/unsupported-media-type-error.js +7 -0
  380. package/dist/representation/unsupported-media-type-error.js.map +1 -0
  381. package/dist/representation/wire-text.d.ts +7 -0
  382. package/dist/representation/wire-text.d.ts.map +1 -0
  383. package/dist/representation/wire-text.js +21 -0
  384. package/dist/representation/wire-text.js.map +1 -0
  385. package/dist/representation/xml/decode-entities.d.ts +3 -0
  386. package/dist/representation/xml/decode-entities.d.ts.map +1 -0
  387. package/dist/representation/xml/decode-entities.js +38 -0
  388. package/dist/representation/xml/decode-entities.js.map +1 -0
  389. package/dist/representation/xml/is-xml-name.d.ts +3 -0
  390. package/dist/representation/xml/is-xml-name.d.ts.map +1 -0
  391. package/dist/representation/xml/is-xml-name.js +6 -0
  392. package/dist/representation/xml/is-xml-name.js.map +1 -0
  393. package/dist/representation/xml/xml-convention.d.ts +10 -0
  394. package/dist/representation/xml/xml-convention.d.ts.map +1 -0
  395. package/dist/representation/xml/xml-convention.js +10 -0
  396. package/dist/representation/xml/xml-convention.js.map +1 -0
  397. package/dist/representation/xml/xml-element-writer.d.ts +16 -0
  398. package/dist/representation/xml/xml-element-writer.d.ts.map +1 -0
  399. package/dist/representation/xml/xml-element-writer.js +71 -0
  400. package/dist/representation/xml/xml-element-writer.js.map +1 -0
  401. package/dist/representation/xml/xml-element.d.ts +9 -0
  402. package/dist/representation/xml/xml-element.d.ts.map +1 -0
  403. package/dist/representation/xml/xml-element.js +2 -0
  404. package/dist/representation/xml/xml-element.js.map +1 -0
  405. package/dist/representation/xml/xml-parser.d.ts +27 -0
  406. package/dist/representation/xml/xml-parser.d.ts.map +1 -0
  407. package/dist/representation/xml/xml-parser.js +154 -0
  408. package/dist/representation/xml/xml-parser.js.map +1 -0
  409. package/dist/representation/xml/xml-representation.d.ts +20 -0
  410. package/dist/representation/xml/xml-representation.d.ts.map +1 -0
  411. package/dist/representation/xml/xml-representation.js +52 -0
  412. package/dist/representation/xml/xml-representation.js.map +1 -0
  413. package/dist/representation/xml/xml-syntax-error.d.ts +5 -0
  414. package/dist/representation/xml/xml-syntax-error.d.ts.map +1 -0
  415. package/dist/representation/xml/xml-syntax-error.js +8 -0
  416. package/dist/representation/xml/xml-syntax-error.js.map +1 -0
  417. package/dist/representation/xml/xml-text.d.ts +7 -0
  418. package/dist/representation/xml/xml-text.d.ts.map +1 -0
  419. package/dist/representation/xml/xml-text.js +30 -0
  420. package/dist/representation/xml/xml-text.js.map +1 -0
  421. package/dist/representation/xml/xml-value-reader.d.ts +15 -0
  422. package/dist/representation/xml/xml-value-reader.d.ts.map +1 -0
  423. package/dist/representation/xml/xml-value-reader.js +101 -0
  424. package/dist/representation/xml/xml-value-reader.js.map +1 -0
  425. package/dist/route/answers-with-schema.d.ts +7 -0
  426. package/dist/route/answers-with-schema.d.ts.map +1 -0
  427. package/dist/route/answers-with-schema.js +10 -0
  428. package/dist/route/answers-with-schema.js.map +1 -0
  429. package/dist/route/route-spec.d.ts +11 -0
  430. package/dist/route/route-spec.d.ts.map +1 -1
  431. package/dist/schema/json-schema-of.d.ts +7 -0
  432. package/dist/schema/json-schema-of.d.ts.map +1 -0
  433. package/dist/schema/json-schema-of.js +15 -0
  434. package/dist/schema/json-schema-of.js.map +1 -0
  435. package/dist/schema/schema-node.d.ts +25 -0
  436. package/dist/schema/schema-node.d.ts.map +1 -0
  437. package/dist/schema/schema-node.js +92 -0
  438. package/dist/schema/schema-node.js.map +1 -0
  439. package/dist/schema/schema-type.d.ts +3 -0
  440. package/dist/schema/schema-type.d.ts.map +1 -0
  441. package/dist/schema/schema-type.js +2 -0
  442. package/dist/schema/schema-type.js.map +1 -0
  443. package/dist/schema/xml-hints.d.ts +9 -0
  444. package/dist/schema/xml-hints.d.ts.map +1 -0
  445. package/dist/schema/xml-hints.js +2 -0
  446. package/dist/schema/xml-hints.js.map +1 -0
  447. package/dist/schemas/accepted-schema.d.ts +8 -0
  448. package/dist/schemas/accepted-schema.d.ts.map +1 -0
  449. package/dist/schemas/accepted-schema.js +20 -0
  450. package/dist/schemas/accepted-schema.js.map +1 -0
  451. package/dist/schemas/accepted.d.ts +5 -0
  452. package/dist/schemas/accepted.d.ts.map +1 -0
  453. package/dist/schemas/accepted.js +2 -0
  454. package/dist/schemas/accepted.js.map +1 -0
  455. package/dist/serialization/decimal-text.d.ts +6 -0
  456. package/dist/serialization/decimal-text.d.ts.map +1 -0
  457. package/dist/serialization/decimal-text.js +13 -0
  458. package/dist/serialization/decimal-text.js.map +1 -0
  459. package/dist/serialization/money-body.d.ts +6 -0
  460. package/dist/serialization/money-body.d.ts.map +1 -0
  461. package/dist/serialization/money-body.js +2 -0
  462. package/dist/serialization/money-body.js.map +1 -0
  463. package/dist/serialization/money.d.ts +4 -0
  464. package/dist/serialization/money.d.ts.map +1 -0
  465. package/dist/serialization/money.js +10 -0
  466. package/dist/serialization/money.js.map +1 -0
  467. package/dist/support/is-async-iterable.d.ts +3 -0
  468. package/dist/support/is-async-iterable.d.ts.map +1 -0
  469. package/dist/support/is-async-iterable.js +5 -0
  470. package/dist/support/is-async-iterable.js.map +1 -0
  471. package/package.json +15 -5
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @ddd-ts-kit/http
2
2
 
3
- Declare a route once, without a framework. Mount it on Express 5, Fastify 5 or NestJS, and
4
- generate the OpenAPI 3.1 contract from the same declaration.
3
+ Declare a route once, without a framework. Mount it on Express 5, Fastify 5, Hono 4 (on Node)
4
+ or NestJS, and generate the OpenAPI 3.1 contract from the same declaration.
5
5
 
6
6
  Every adapter goes through one pipeline (`executeRoute`): validation, handler, error mapping.
7
- The behaviour is therefore the same on the three frameworks, and one test suite proves it.
7
+ The behaviour is therefore the same on the four frameworks, and one test suite proves it.
8
8
 
9
9
  ## Declare
10
10
 
@@ -84,7 +84,7 @@ const routes = controllerRoutes([PlaceOrderController], { resolve: application.r
84
84
 
85
85
  | Export | What it is |
86
86
  |---|---|
87
- | `Controller(spec)` | the decorator of a controller: `group`, `method`, `path` (after the prefix of the group), `operationId` (the class name without `Controller` by default), `summary`, `description`, `tags`, `params`, `query`, `headers`, `body`, `response: { status, description?, body? }`, `errors`, `guards`, `deprecated`, `cache` and `ifMatch` (see "HTTP caching") |
87
+ | `Controller(spec)` | the decorator of a controller: `group`, `method`, `path` (after the prefix of the group), `operationId` (the class name without `Controller` by default), `summary`, `description`, `tags`, `params`, `query`, `headers`, `body`, `response: { status, description?, body? }`, `errors`, `guards`, `deprecated`, `cache` and `ifMatch` (see "HTTP caching"), `produces` and `consumes` (see [Representations](#representations-json-xml-csv)), `form` (see [Forms described by the server](#forms-described-by-the-server)) |
88
88
  | `RouteGroup({ parent, prefix, tags, guards, errors, cache })` | names a set of routes on an empty class; a child inherits from its `parent` and adds; the nearest `cache` wins |
89
89
  | `Guard` | the interface `{ documents?, check(request: GuardRequest) }`, and the decorator of a guard class that takes dependencies |
90
90
  | `Authenticated`, `Public`, `HasRole(...roles)`, `HasScope(...scopes)`, `TenantMember` | the guards the package ships, over the `Actor` and the `Session` of the request: 401 to the anonymous caller, 403 without one of the roles, without every scope named (`Session.scopes`, typed by the `SessionScopes` of the project) or outside the tenant of the request; `Public` lets everybody in and stands alone. A refusal of a guard is reported to `onGuardRefusal` |
@@ -152,9 +152,12 @@ the application are known, and a public answer is held to them with a `Declarati
152
152
 
153
153
  - on a route that knows its caller, `vary` names `Authorization`, `Cookie`, or a header the tenant
154
154
  is read from (`resolveTenant`): `vary: ['Accept-Language']` alone is refused;
155
+ - on any route, even one anybody may call, an answer whose schema reserves fields to some
156
+ callers (`withFieldAccess` with a `read` requirement, on the answer, its page or its stream)
157
+ names `Authorization` or `Cookie` in `vary`: what it shows depends on who calls;
155
158
  - behind a cache that ignores `Vary` (`cacheTags.header` of Cloudflare or Bunny), a public answer
156
159
  that varies is refused, unless `cacheTags.honoursVary: true` says the cache keys on those
157
- headers;
160
+ headers; an answer chosen by `Accept` among several media types (`produces`) varies on it;
158
161
  - with tags filed per tenant (`cacheTags.perTenant`), a tagged route anybody may call needs
159
162
  `resolveTenant`: an anonymous call names no tenant otherwise, and no purge would meet its answer.
160
163
 
@@ -192,7 +195,10 @@ without a body to a caller that already holds that version:
192
195
  `If-None-Match` is read first and compared weakly, `If-Modified-Since` only without it. A body
193
196
  that lacks the field it names answers 500, as any answer its declaration does not allow. The
194
197
  contract gains the `If-None-Match` and `If-Modified-Since` parameters, the `ETag` and
195
- `Last-Modified` headers and the `304` answer.
198
+ `Last-Modified` headers and the `304` answer. Under [representations](#representations-json-xml-csv), the
199
+ version, the instant and the cache tags are read from what the handler answered, the same in
200
+ JSON, XML or CSV; a strong tag digests the bytes of the media type sent, so each representation
201
+ has its own, and a streamed list, whose bytes are not known when its headers go, has none.
196
202
 
197
203
  A write made on the version a client read declares `ifMatch` (`IfMatch.optional` or
198
204
  `IfMatch.required`). The pipeline reads the version named in `If-Match` (the weak tag the read
@@ -335,7 +341,8 @@ message nor its facts.
335
341
 
336
342
  Defaults: `VALIDATION_FAILED` 422 (with `issues`, paths prefixed by the part:
337
343
  `body.items.0.sku`), `NOT_FOUND` 404, `CONFLICT` 409, `INVARIANT_VIOLATION` 422, `UNAUTHORIZED`
338
- 401, `FORBIDDEN` 403, `PRECONDITION_FAILED` 412, `PRECONDITION_REQUIRED` 428. A domain code that is not mapped answers 422.
344
+ 401, `FORBIDDEN` 403, `NOT_ACCEPTABLE` 406, `PRECONDITION_FAILED` 412, `UNSUPPORTED_MEDIA_TYPE` 415,
345
+ `PRECONDITION_REQUIRED` 428. A domain code that is not mapped answers 422.
339
346
 
340
347
  ```ts
341
348
  import { createErrorMapper } from '@ddd-ts-kit/http';
@@ -527,7 +534,7 @@ const searchOrders = defineRoute(
527
534
  | `pageQuerySchema(options?)` | the same reading as a `Schema`, for a route whose whole query is the page |
528
535
  | `pageResponse(page, map)` | the JSON body `{ items, total?, nextCursor? }`, each item through `map` |
529
536
  | `pageRequestParameters(options?)` | the JSON Schema of the query (one OpenAPI parameter per property); `properties` merges into a wider schema |
530
- | `pageSchemaOf(itemSchema)` | the `Schema` of a page of items: validates the envelope and each item, describes both in the contract |
537
+ | `pageSchemaOf(itemSchema)` | the `Schema` of a page of items: validates the envelope and each item, describes both in the contract; shared as `<Item>Page` when the item is shared ([shared schemas](#shared-schemas)) |
531
538
 
532
539
  `options` are the `PageLimits` of the kernel (`defaultSize` 20, `maxSize` 100) plus `sortable`,
533
540
  the closed list of fields a client may sort by, and `kind`, the variant of a query that names
@@ -609,6 +616,287 @@ issue per mistake, none quoting a value:
609
616
  The scope of the actor is not a parameter: the handler of the query joins it with `scoped`,
610
617
  and nothing in a query string can remove it.
611
618
 
619
+ ## Representations: JSON, XML, CSV
620
+
621
+ A route keeps answering a typed value its response schema checks; a `Representation` turns it
622
+ into the text of one media type, chosen per request by the `Accept` header among those the
623
+ route declares. The application registers its representations once and gives the same set to
624
+ the adapters and to the contract generator:
625
+
626
+ ```ts
627
+ import { Representations, type ExecuteOptions } from '@ddd-ts-kit/http';
628
+
629
+ const representations = Representations.standard(); // JSON, XML and CSV
630
+ const options: ExecuteOptions = { ...boundary, representations };
631
+ const document = generateOpenApi({ info, routes, errorMapper, representations });
632
+ ```
633
+
634
+ A route says what it answers in besides JSON (`produces`) and what it reads a body in besides
635
+ JSON (`consumes`), on `@Controller` or on `defineRoute` alike:
636
+
637
+ ```ts
638
+ @Controller({
639
+ group: PartnerRoutes, method: 'GET', path: '/:practiceId/appointments', summary: 'Export appointments',
640
+ params, response: { status: 200, body: streamSchemaOf(line) },
641
+ produces: ['text/csv', 'application/xml'],
642
+ })
643
+ ```
644
+
645
+ | Media type | Answers | Reads | Notes |
646
+ |---|---|---|---|
647
+ | `application/json` | always, and first: what a request without `Accept` gets | always | as before; a big integer is written as a string |
648
+ | `application/problem+json` | a refusal, unless XML was negotiated | | RFC 9457, as before |
649
+ | `application/xml` | `XmlRepresentation` | `XmlRepresentation`, when the route `consumes` it | the convention below |
650
+ | `application/problem+xml` | a refusal of a request that negotiated XML | | `<problem xmlns="urn:ietf:rfc:7807">` |
651
+ | `text/csv` | `CsvRepresentation`, for a page or a list of flat rows | never | streamed; RFC 4180 |
652
+
653
+ - **Negotiation** (RFC 9110): the media type of highest quality among those the route offers,
654
+ the most specific range of the header deciding, the order `application/json` then `produces`
655
+ breaking ties. None acceptable: `406 NOT_ACCEPTABLE` in `application/problem+json`, before
656
+ the handler runs. A route that offers more than one answers with `Vary: accept`, added to the
657
+ `Vary` of its cache policy or the one its handler sets, and documented in the contract. A route that declares no body schema in any response (a file, a
658
+ redirect, no content) is never refused 406: its answer is its own, and a `Readable` or bytes
659
+ go out as the handler wrote them, under its content type.
660
+ - **Bodies**: a body sent in a media type the route consumes is read by its representation
661
+ into the value the JSON path produces, then validated by the same schema; one sent in a media
662
+ type the route does not read is refused with `415 UNSUPPORTED_MEDIA_TYPE`. `mountExpress`
663
+ installs a text parser on each route that consumes another media type, `mountFastify` a
664
+ content type parser, `mountHono` reads it as text under its `bodyLimit`: nothing to add to
665
+ the application.
666
+ - **Streaming**: a handler that answers an `AsyncIterable` under a `streamSchemaOf(item)`
667
+ response is written item by item in every representation (one JSON array, one XML root, one
668
+ CSV line per row), honouring the back pressure of the client and stopping when it leaves.
669
+ Each item is read inside the execution scope of the request, as the handler was. The first
670
+ item is read before the status is sent: a cursor that cannot open is answered as a problem. A
671
+ failure after that cuts the response short and is told to `onError` with the correlation of
672
+ the request and `interrupted: true`, to count as a server fault.
673
+ - **A streamed list read through the bus**: build it with `everyPage((cursor) =>
674
+ this.queries.execute(new SearchQuery(actor, ..., pageAt(cursor))))`, one query per page. Each
675
+ page then goes through the middlewares of the bus: authorization, the unit of work and its
676
+ transaction-scoped tenant session (the row-level security of `@ddd-ts-kit/knex` and
677
+ `@ddd-ts-kit/drizzle`), timeout, tracing, metrics, error reporting. A query handler that
678
+ answers a lazy `AsyncIterable` is read after the bus has returned, outside all of them: its
679
+ reads have no transaction, no tenant session, no span. The deadline of the request
680
+ (`requestTimeoutMs`) counts from its arrival, so a long export needs a route of its own with a
681
+ longer one, or a job that writes a file.
682
+ - **Mount-time checks**: a media type no registered representation provides, a CSV answer
683
+ whose rows hold a list or an object, and a consumed media type nothing reads are refused with
684
+ a `DeclarationError` when the routes are mounted; so is a route that declares `produces` or
685
+ `consumes` when no `representations` are mounted. A body in a consumed media type that another
686
+ parser (a plugin, a middleware) already turned into an object is a defect, answered 500.
687
+ - **The contract** follows the representations it is given, which must be those the server is
688
+ mounted with (`generateOpenApi({ representations })`): every media type a route answers in is
689
+ listed under its response, every media type it reads under its request body, the problem
690
+ types under each refusal, `406` on every route whose answer a representation writes and `415`
691
+ on every route that reads a body, declared in `produces` and `consumes` or not. Without
692
+ `representations`, the contract says JSON only and neither status, as the server answers.
693
+ - **Without `representations`**, nothing changes: every answer is JSON, whatever the request
694
+ accepts. With them, an answer in the JSON of the kit stays a value in the `RouteResponse` (a
695
+ spec calling `executeRoute` reads it as before); another representation gives bytes in
696
+ `body`, or chunks in `stream`.
697
+
698
+ ### The serialization rules, the same in every representation
699
+
700
+ | Value | Written as |
701
+ |---|---|
702
+ | an instant (`Date`) | ISO 8601 in UTC, `2026-10-13T07:05:00.000Z` |
703
+ | a decimal | a string, `decimalText(value)`: `'12.30'`, never a binary number a client rounds |
704
+ | money | `money(amount, currency)`: `{ amount: '12.30', currency: 'EUR' }`, the ISO 4217 code always next to the amount |
705
+ | an identifier | a string; a `bigint` is written in full |
706
+ | a closed vocabulary | its code, the value of the object `as const` that declares it |
707
+ | a list | the page envelope `{ items, total?, nextCursor? }` of `pageResponse`, or a streamed list |
708
+
709
+ `standard-serialization.spec.ts` holds the three representations to this table.
710
+
711
+ ### The XML convention
712
+
713
+ One convention, the default of the XML object of OpenAPI, so the contract describes the XML
714
+ with nothing added:
715
+
716
+ - the root element is `xml.name` of the response schema, else the operation id of the route
717
+ (`<getAppointment>`), and declares `xmlns:xsi`;
718
+ - a property is an element of its name, in the order of the schema; `xml.name` renames it,
719
+ `xml.attribute: true` makes a scalar an attribute; a name that cannot be an element name is
720
+ written `<entry key="two words">`;
721
+ - a list is unwrapped: one element per item, named after the property (or `items.xml.name`);
722
+ `xml.wrapped: true` puts them in an element of the property, each named `items.xml.name` or
723
+ `item`; a list at the root holds `<item>` elements;
724
+ - `null` is an empty element with `xsi:nil="true"`; a missing value is no element at all;
725
+ - a scalar is the text JSON would hold: an instant in ISO 8601 UTC, `true` or `false`, a
726
+ number as JavaScript writes it; a character XML 1.0 cannot carry becomes U+FFFD.
727
+
728
+ Reading follows the schema: text becomes a number or a boolean where the schema says so,
729
+ repeated elements a list, an element the schema does not declare stays in the value so the
730
+ schema refuses it as it refuses an unknown JSON property. The parser is the package's own and
731
+ reads elements, attributes, CDATA, comments, processing instructions, the predefined entities
732
+ and character references; it refuses a document type declaration, so no body can declare an
733
+ entity (no XXE, no expansion bomb), and nests at most 64 elements deep.
734
+
735
+ ### CSV
736
+
737
+ One header line with the properties of a row in the order of the schema, then one line per
738
+ row, `\r\n` at the end of each. A cell holding a comma, a quote, a line break or surrounding
739
+ spaces is quoted; a text that starts with `=`, `+`, `-`, `@`, a tab or a carriage return is
740
+ prefixed with `'`, so a spreadsheet does not run it as a formula (a number never is). `null`
741
+ and a missing value are an empty cell. CSV is never read: an import is a route of its own,
742
+ with a body schema of its own.
743
+
744
+ ### A representation of your own
745
+
746
+ ```ts
747
+ class YamlRepresentation implements Representation {
748
+ readonly mediaType = 'application/yaml';
749
+ readonly problemMediaType = undefined; // refusals stay application/problem+json
750
+
751
+ write(body: unknown, shape: BodyShape): RepresentedBody { ... }
752
+ }
753
+
754
+ const representations = Representations.of(new XmlRepresentation(), new YamlRepresentation());
755
+ ```
756
+
757
+ `write` gets the value and its shape (the JSON Schema of the response and the operation id);
758
+ `read`, when present, turns a body back into the value; `refuses`, when present, says at mount
759
+ time why a shape cannot be written. One given for `application/json` replaces the default.
760
+
761
+ ## Fields reserved to some callers
762
+
763
+ A response or a request schema marks a field as requiring a permission or a policy; the
764
+ pipeline does the rest, for every representation, instead of an `if (admin)` in a handler:
765
+
766
+ ```ts
767
+ import { fieldDeciderOf, withFieldAccess } from '@ddd-ts-kit/http';
768
+
769
+ const answer = withFieldAccess(classSchema(AppointmentAnswer), {
770
+ internalNote: {
771
+ read: { permission: schedulingPermissions['appointment.note.read'] },
772
+ write: { policy: notesOfTheirOwnCalendars }, // a policy of @ddd-ts-kit/auth fits as it is
773
+ subject: (row) => ({ type: 'calendar', id: row.calendarId }), // what the requirement is asked about
774
+ },
775
+ });
776
+
777
+ const options: ExecuteOptions = { ...boundary, fieldAccess: fieldDeciderOf({ access: app.resolve(Access), clock }) };
778
+ ```
779
+
780
+ | Where | A field the actor may not read | A field the actor may read but not set |
781
+ |---|---|---|
782
+ | an answer (JSON, XML, CSV, a streamed list) | left out; in CSV the column stays, its cells empty | kept |
783
+ | a request body | refused with `403 FORBIDDEN`, naming the path (`body.internalNote`) | refused the same way |
784
+ | a form described by the server | absent | read-only |
785
+ | the contract | `x-field-access: { read: { permission }, write: { policy } }` on the property, which is no longer listed in `required` | the same |
786
+
787
+ - `read` absent: whoever may call the route sees the field; `write` absent: whoever sees it may
788
+ set it. A field left out of a body is never judged.
789
+ - A permission is decided by `access.decideOn(question)` of `@ddd-ts-kit/auth` (else
790
+ `access.decide`), the policies of the permission then the authorizer, as for a use case; a
791
+ policy named on the field is asked directly, with the time of `clock`. `subject` names the
792
+ element: left out, the requirement is asked about nothing, which a role grant answers and a
793
+ relationship does not.
794
+ - **What is recorded**: a field set in a body is an act, and its decision goes to the audit
795
+ trail (`onDecision`) with who asked and the correlation; a field shown or left out of an
796
+ answer or a form only shapes it, and its decision is not recorded. The use case keeps
797
+ recording its own decision.
798
+ - **Cost**: each requirement is decided once per element and per request, inside the execution
799
+ scope of the request. A requirement about no element is asked once; a page of a hundred rows
800
+ of the same calendar asks once. A streamed export whose rule names a subject per row asks one
801
+ decision per distinct row (one evaluation of the policies and of the authorizer, a lookup of
802
+ relationships for a relationship model); the judge remembers the last 256 elements per
803
+ requirement, so its memory stays bounded whatever the length of the export. For a long export,
804
+ prefer a rule without subject, or a read model that already holds only what the caller may
805
+ read.
806
+ - `pageSchemaOf(item)` and `streamSchemaOf(item)` carry the restricted fields of their item.
807
+ A shared schema carries them in either order: `withFieldAccess(sharedSchema('Note', schema),
808
+ rules)`, `withFieldAccess(classSchema(NoteDto, { shared: true }), rules)` and
809
+ `sharedSchema('Note', withFieldAccess(schema, rules))` mark the shared definition and filter
810
+ the answer alike.
811
+ - **A public cache policy**: an answer with a field some callers may not read differs per caller.
812
+ When the routes are mounted, a `public` policy on such a route is refused unless its `vary`
813
+ names `Authorization` or `Cookie`, whoever may call the route (see "HTTP caching").
814
+ The rules apply to the properties of the schema given to `withFieldAccess`; a nested object is
815
+ restricted by wrapping its own schema.
816
+ - Without `fieldAccess` in the options, a restricted field is left out of every answer and
817
+ refused in every body: nothing is shown by omission.
818
+ - The rule `authz/fields-by-schema` of the checker and of the ESLint plugin refuses the
819
+ hand-written alternative, a test on the roles of the actor under `application/queries/`;
820
+ `authz/in-application` already refuses one in `presentation/`.
821
+
822
+ ## Forms described by the server
823
+
824
+ A route that declares `form` is described as a form, from what it already declares: its request
825
+ body schema, the restricted fields of that schema, and a few presentation hints. `formRoutes`
826
+ serves one `GET /forms/<operationId>` per such route, mounted and documented like any route:
827
+
828
+ ```ts
829
+ // presentation/http/appointments/book-appointment/book-appointment.controller.ts, next to its schemas
830
+ const form = defineForm<Infer<typeof body>>({
831
+ groups: [{ name: 'when', fields: ['startsAt', 'appointmentTypeId'] }],
832
+ fields: {
833
+ appointmentTypeId: { lookup: 'searchAppointmentTypes' }, // options from a GET route
834
+ reason: { widget: 'textarea', visibleWhen: { field: 'kind', equals: AppointmentKind.consultation } },
835
+ },
836
+ });
837
+
838
+ @Controller({ ..., body, form })
839
+
840
+ // the composition root
841
+ const routes = defineRoutes(appRoutes, formRoutes(appRoutes, { fieldAccess }));
842
+ ```
843
+
844
+ `GET /forms/bookAppointment?calendarId=c-1` answers **JSON Forms** (the default): `schema`,
845
+ `uischema` and `data`, which every renderer of JSON Forms takes as they are.
846
+ `?format=blocks` answers the **neutral tree of blocks** for a front end with its own engine:
847
+
848
+ ```json
849
+ { "type": "form", "operation": "bookAppointment", "method": "POST", "path": "/appointments", "label": "bookAppointment",
850
+ "blocks": [
851
+ { "type": "group", "name": "when", "label": "bookAppointment.when", "blocks": [
852
+ { "type": "field", "name": "startsAt", "label": "bookAppointment.startsAt", "widget": "datetime", "required": true,
853
+ "constraints": { "format": "date-time" } } ] },
854
+ { "type": "field", "name": "internalNote", "label": "bookAppointment.internalNote", "widget": "textarea",
855
+ "required": false, "readOnly": true } ] }
856
+ ```
857
+
858
+ | What | Taken from | In the tree | In JSON Forms |
859
+ |---|---|---|---|
860
+ | fields, their order, `required` | the request schema | `field` blocks | `schema` |
861
+ | constraints | `minLength`, `maxLength`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`, `pattern`, `format`, `minItems`, `maxItems` | `constraints` | the same keywords in `schema` |
862
+ | options | an `enum` of the schema (a closed vocabulary), else `options` of the hint | `options`, each with a translation key | `enum` |
863
+ | a lookup | `lookup: '<operationId>'` of a `GET` route | `lookup: { operation, method, path }` | `options.lookup` of the control |
864
+ | widget | the hint, else the schema: `select` for an enumeration, `checkbox`, `number`, `datetime`, `date`, `time`, `email`, `list`, `text` | `widget` | the control, `options.multi` for `textarea`, `options.format: 'radio'` |
865
+ | groups | `groups` of the hints, nested; a nested object of the body is a group of its own | `group` blocks | `Group` elements |
866
+ | a field shown on a condition | `visibleWhen: { field, equals }` or `{ field, in }` | `visibleWhen` | a `SHOW` rule |
867
+ | a field required on a condition | `requiredWhen` | `requiredWhen` | `allOf` of `if`/`then` in `schema` |
868
+ | labels | `<operationId>`, `<operationId>.<group>`, `<operationId>.<field>`, `<operationId>.<field>.<option>`; `label` of a hint replaces one | `label` | `i18n` |
869
+ | values known in advance | the query: `?calendarId=c-1`, typed by the schema | `value` | `data` |
870
+
871
+ **The description respects the caller.** A form names the permission of the use case it
872
+ describes, asked as its `@Requires` asks it, from the values of the query:
873
+
874
+ ```ts
875
+ const form = defineForm<Infer<typeof body>>({
876
+ requires: {
877
+ permission: schedulingPermissions['appointment.book'],
878
+ subject: (values) => (values.calendarId === undefined ? undefined : { type: 'calendar', id: values.calendarId }),
879
+ context: (values, actor) => ({ selfService: (values.patientId ?? actor.id) === actor.id }),
880
+ },
881
+ });
882
+ ```
883
+
884
+ A caller who may not run the use case is refused with 403 (recorded as a decision) and learns
885
+ nothing of the fields; without `fieldAccess`, nobody is given a form that declares `requires`.
886
+ A form without `requires` is given to whoever may call the route. Then a field the actor may not
887
+ read (`withFieldAccess`) is absent, one they may read but not set is `readOnly` (`readOnly` in
888
+ `schema`, `options.readonly` on the control), with every field it holds when it is an object,
889
+ each asked about the element its `subject` names from the values of the query; a value of the
890
+ query for a field the caller does not see is not given back in `data`. The form of a route that
891
+ is not public refuses the anonymous caller with 401. The server still validates the body when
892
+ it is sent, refuses a field the caller may not set with 403, and the use case still enforces
893
+ its rules: a form carries shape and presentation, never a business rule.
894
+
895
+ Hints naming a field the body does not hold, or a lookup that is no `GET` route, stop
896
+ `formRoutes` with a `DeclarationError`. `formDocumentsOf(routes)` gives every form whole, in
897
+ both formats, for the documentation: a project generated by the CLI writes them to
898
+ `openapi/forms/<operationId>.json` next to its contract.
899
+
612
900
  ## Express 5
613
901
 
614
902
  ```ts
@@ -632,6 +920,31 @@ mountFastify(app, orderRoutes(orders), options);
632
920
  await app.register(fastifyRoutes(orderRoutes(orders), options), { prefix: '/api' });
633
921
  ```
634
922
 
923
+ ## Hono 4
924
+
925
+ ```ts
926
+ import { serve } from '@hono/node-server';
927
+ import { Hono } from 'hono';
928
+ import { mountHono } from '@ddd-ts-kit/http/hono';
929
+
930
+ const app = new Hono();
931
+ mountHono(app, orderRoutes(orders), options);
932
+ serve({ fetch: app.fetch, port: 3000 });
933
+ ```
934
+
935
+ The adapter reads the JSON body itself, chunk by chunk and up to `bodyLimit` bytes (1 MiB by
936
+ default, as Fastify; Express stops at 100 kB): a larger body is answered 413 as a problem
937
+ (`BODY_TOO_LARGE`), a body that is not JSON 400 (`MALFORMED_BODY`), both before the pipeline and
938
+ without holding the body whole. A body in a media type the route consumes (`consumes`) is read
939
+ as text under the same limit, for its representation; another media type is not read, and the
940
+ pipeline answers 415 when representations are mounted. An upload and a raw body are read from
941
+ the request stream, with the limits their route declares, and a stream answer or a streamed
942
+ list is streamed. A request carries `HonoRaw` as
943
+ its raw request (its headers as a record, which the authenticators of the kit read, and the
944
+ `Context` of Hono), and a repeated query parameter is a list, as on Express and Fastify. The
945
+ adapter imports nothing of Hono at run time and `node:stream` for the streams: the kit proves
946
+ Node with `@hono/node-server`, not Bun, Deno or an edge runtime.
947
+
635
948
  ## NestJS
636
949
 
637
950
  No decorator per route: a module mounts the routes on the underlying HTTP server at module
@@ -691,6 +1004,37 @@ whenever the route validates input, a shared `Problem` schema. Local `$defs` of
691
1004
  moved to `components.schemas`. Paths, statuses and component keys are sorted: the output does
692
1005
  not depend on the order of the routes, so the committed file diffs cleanly.
693
1006
 
1007
+ ### Shared schemas
1008
+
1009
+ A schema several routes use is declared once and lands once in `components.schemas`; each route
1010
+ points at it with `$ref`, whether it uses it whole or inside another schema. A schema is shared
1011
+ when its JSON Schema is a reference to one of its own definitions, which every adapter of
1012
+ `@ddd-ts-kit/validation` can produce:
1013
+
1014
+ | Library | Shared by |
1015
+ |---|---|
1016
+ | zod | `.meta({ id: 'Slot' })` on the zod schema, used whole or nested |
1017
+ | class-validator | `classSchema(SlotDto, { shared: true })`; a nested class is always a component |
1018
+ | TypeBox | `{ $id: 'Slot' }` in the options of the schema, used whole or nested |
1019
+ | Standard Schema | the library's own ids through Standard JSON Schema, or `sharedSchema('Slot', schema)` |
1020
+ | any `Schema` | `sharedSchema(name, schema)` of `@ddd-ts-kit/validation` |
1021
+
1022
+ A part of a shared schema (`slot.pick(...)`, `pickClass(SlotDto, [...])`) is a new shape: it is
1023
+ written where it is used unless it is shared under a name of its own. Two different shapes under
1024
+ one name get distinct components (`Slot`, `Slot_2`): for zod, the input and the output side of a
1025
+ schema with defaults are two shapes, so a response gets an id of its own.
1026
+
1027
+ The platform shares three schemas of its own:
1028
+
1029
+ | Schema | Component | For |
1030
+ |---|---|---|
1031
+ | `acceptedSchema` | `Accepted`, `{ id }` | the answer of every command route that returns the identifier of what it created or changed |
1032
+ | `pageSchemaOf(item)` | `<Item>Page` when the item is shared | the envelope of a search answer (`items`, `total`, `nextCursor`) |
1033
+ | the problem document | `Problem` | every refusal, RFC 9457 with the stable `code` |
1034
+
1035
+ A shared request part (`params`, `query`, `headers`) still gives one parameter per property.
1036
+ Fields reserved by `withFieldAccess` stay reserved whichever of the two wraps the other.
1037
+
694
1038
  ## Serving the contract and its page
695
1039
 
696
1040
  ```ts
@@ -795,12 +1139,30 @@ Express, mount them before `express.json()`: that parser reads a JSON body first
795
1139
  store answers its own links and needs no route.
796
1140
 
797
1141
  A handler may answer a stream (`Readable`) as its body: it is piped to the response, with its
798
- own `content-type`.
1142
+ own `content-type`, whatever `representations` the routes are mounted with: no representation
1143
+ writes a file, and a route that declares no body schema is never refused 406.
799
1144
 
800
1145
  ## Limits
801
1146
 
802
1147
  - A body the framework itself refuses (malformed JSON, payload too large) is answered by the
803
1148
  framework's own error handler, before the pipeline runs.
804
1149
  - Routes are JSON first. A handler may answer a string, bytes or a stream by setting its own
805
- `content-type` header. A request body streams only as a declared upload or a raw body
806
- (`rawBody`): server-sent events and WebSockets are written natively in the framework.
1150
+ `content-type` header, which no representation touches. A request body streams only as a
1151
+ declared upload or a raw body (`rawBody`): server-sent events and WebSockets are written
1152
+ natively in the framework.
1153
+ - XML is a faithful rendering of the JSON model, not a design tool for XML vocabularies: no
1154
+ namespaces but the default one of the root, no mixed content, no XML Schema. A partner format
1155
+ with a schema of its own is an anti-corruption layer with its own mapper.
1156
+ - A streamed list cannot be refused once its first item is written: the connection is cut,
1157
+ the client sees a truncated body, and `onError` is told. The items of a stream are not checked
1158
+ one by one by `validateResponses`.
1159
+ - CSV is written, never read, and holds flat rows only.
1160
+ - A form describes scalars, nested objects and lists of a closed vocabulary; a list of objects
1161
+ is a `list` field with no detail. Layout beyond groups and order is the front end's. A lookup
1162
+ names the route of the options; how the front end calls it and labels its items is its own.
1163
+ - Field access judges the fields a schema declares, not the rows: which rows an actor may read is
1164
+ the access scope of the query. A requirement about an element is one decision per element of
1165
+ the answer, not recorded; there is no batch decision of many elements at once.
1166
+ - A form is given to who may run its use case only when it declares `requires`; the values of
1167
+ its query name the element and the context, which the caller chooses, as they would in the
1168
+ body they send.
@@ -1 +1 @@
1
- {"version":3,"file":"controller-routes.d.ts","sourceRoot":"","sources":["../../src/controller/controller-routes.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAQ9E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,SAAS,CAAC,eAAe,GAAG,gBAAgB,CAAC,EAAE,EAC5D,OAAO,GAAE,uBAA4B,GACpC,SAAS,KAAK,EAAE,CAMlB"}
1
+ {"version":3,"file":"controller-routes.d.ts","sourceRoot":"","sources":["../../src/controller/controller-routes.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAS9E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,SAAS,CAAC,eAAe,GAAG,gBAAgB,CAAC,EAAE,EAC5D,OAAO,GAAE,uBAA4B,GACpC,SAAS,KAAK,EAAE,CAMlB"}
@@ -42,6 +42,7 @@ function documentationOf({ spec, declared, guards }) {
42
42
  responses: { [status]: { description: description ?? defaultDescription(body), ...bodyOf(body) } },
43
43
  errors: [...new Set([...declared.errors, ...guards.flatMap((guard) => guard.documents?.errors ?? [])])],
44
44
  ...(spec.deprecated === true ? { deprecated: true } : {}),
45
+ ...presentationOf(spec),
45
46
  };
46
47
  }
47
48
  function handlerOf(resolved, options, identity) {
@@ -81,6 +82,13 @@ function requestOf(parts) {
81
82
  }).filter(([, schema]) => schema !== undefined);
82
83
  return declared.length === 0 ? {} : { request: Object.fromEntries(declared) };
83
84
  }
85
+ function presentationOf({ produces, consumes, form }) {
86
+ return {
87
+ ...(produces === undefined ? {} : { produces: [...produces] }),
88
+ ...(consumes === undefined ? {} : { consumes: [...consumes] }),
89
+ ...(form === undefined ? {} : { form }),
90
+ };
91
+ }
84
92
  function bodyOf(body) {
85
93
  return body === undefined ? {} : { body };
86
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"controller-routes.js","sourceRoot":"","sources":["../../src/controller/controller-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAUtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAA2B,MAAM,0BAA0B,CAAC;AAEvF,MAAM,gBAAgB,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAA4D,EAC5D,OAAO,GAA4B,EAAE;IAErC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAExG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,S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EzE,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,YAAY,CACnB,QAA+D,EAC/D,KAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAE7C,OAAO;QACL,GAAG,QAAQ;QACX,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5F,OAAO,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACjC,KAAK;QACL,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Schema } from '@ddd-ts-kit/validation';
2
+ import type { FormHints } from '../forms/form-hints.js';
2
3
  import type { CachePolicy } from '../cache/cache-policy.js';
3
4
  import type { IfMatch } from '../cache/if-match.js';
4
5
  import type { HttpMethod } from '../route/http-method.js';
@@ -35,6 +36,12 @@ export interface ControllerSpec {
35
36
  /** Run after the guards of the group. With no group, at least one is required: `[Public]` says the route is open. */
36
37
  readonly guards?: readonly GuardReference[];
37
38
  readonly deprecated?: boolean;
39
+ /** Media types answered besides `application/json`, chosen by `Accept`: `['application/xml', 'text/csv']`. */
40
+ readonly produces?: readonly string[];
41
+ /** Media types a body is read in besides `application/json`: `['application/xml']`. */
42
+ readonly consumes?: readonly string[];
43
+ /** Describes the body as a form at `GET /forms/<operationId>` (`formRoutes`): `defineForm(...)` next to the schemas, or `{}`. */
44
+ readonly form?: FormHints;
38
45
  /** How the caches on the way may keep the answer; replaces the policy of the group. */
39
46
  readonly cache?: CachePolicy;
40
47
  /** A write conditional on the version the client read, handed to `handle` as `context.expectedVersion`. */
@@ -1 +1 @@
1
- {"version":3,"file":"controller-spec.d.ts","sourceRoot":"","sources":["../../src/controller/controller-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,yGAAyG;IACzG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC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,EAAE,SAAS,CAAC;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"default-error-mapping.d.ts","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,EAAE,YAYnC,CAAC"}
1
+ {"version":3,"file":"default-error-mapping.d.ts","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,EAAE,YAanC,CAAC"}
@@ -5,6 +5,7 @@ export const DEFAULT_ERROR_MAPPING = {
5
5
  INVARIANT_VIOLATION: 422,
6
6
  UNAUTHORIZED: 401,
7
7
  FORBIDDEN: 403,
8
+ NOT_ACCEPTABLE: 406,
8
9
  PRECONDITION_FAILED: 412,
9
10
  PRECONDITION_REQUIRED: 428,
10
11
  FILE_NOT_FOUND: 404,
@@ -1 +1 @@
1
- {"version":3,"file":"default-error-mapping.js","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,iBAAiB,EAAE,GAAG;IACtB,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,mBAAmB,EAAE,GAAG;IACxB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,mBAAmB,EAAE,GAAG;IACxB,qBAAqB,EAAE,GAAG;IAC1B,cAAc,EAAE,GAAG;IACnB,cAAc,EAAE,GAAG;IACnB,sBAAsB,EAAE,GAAG;CAC5B,CAAC"}
1
+ {"version":3,"file":"default-error-mapping.js","sourceRoot":"","sources":["../../src/error/default-error-mapping.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,iBAAiB,EAAE,GAAG;IACtB,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,mBAAmB,EAAE,GAAG;IACxB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,cAAc,EAAE,GAAG;IACnB,mBAAmB,EAAE,GAAG;IACxB,qBAAqB,EAAE,GAAG;IAC1B,cAAc,EAAE,GAAG;IACnB,cAAc,EAAE,GAAG;IACnB,sBAAsB,EAAE,GAAG;CAC5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { IRouter } from 'express';
1
+ import { type IRouter } from 'express';
2
2
  import type { ExecuteOptions } from '../pipeline/execute-options.js';
3
3
  import type { Route } from '../route/route.js';
4
4
  export type ExpressMountOptions = ExecuteOptions;
@@ -6,7 +6,9 @@ export type ExpressMountOptions = ExecuteOptions;
6
6
  * Registers the routes on an Express 5 application or router. A JSON body parser
7
7
  * (`express.json()`) must be installed before, otherwise bodies reach validation as `undefined`.
8
8
  * An upload and a raw body are read from the request stream, which that parser leaves alone
9
- * unless the request is JSON. A body that is a stream is piped to the response.
9
+ * unless the request is JSON; a route that consumes another media type (`consumes`) gets a text
10
+ * parser of its own for it. A body that is a stream is piped to the response, a streamed list
11
+ * written chunk by chunk.
10
12
  */
11
13
  export declare function mountExpress(target: IRouter, routes: readonly Route[], options?: ExpressMountOptions): void;
12
14
  //# sourceMappingURL=mount-express.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount-express.d.ts","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAMjD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAS/G"}
1
+ {"version":3,"file":"mount-express.d.ts","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAE,KAAK,OAAO,EAAoD,MAAM,SAAS,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAQrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAMjD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAU/G"}