@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
@@ -1,11 +1,21 @@
1
- /** The request body of an operation: JSON, or for an upload the multipart form with its file, its size and its media types. */
2
- export function requestBody(route, definitions) {
1
+ /**
2
+ * The request body of an operation: JSON and, under negotiation, every media type the route reads it in besides, or
3
+ * for an upload the multipart form with its file, its size and its media types.
4
+ */
5
+ export function requestBody(route, { definitions, representations }) {
3
6
  const body = route.request?.body;
4
7
  const fields = body === undefined ? undefined : definitions.embed(body);
5
8
  if (route.upload !== undefined) {
6
9
  return multipartBody(route.upload, fields);
7
10
  }
8
- return fields === undefined ? undefined : { required: true, content: { 'application/json': { schema: fields } } };
11
+ if (fields === undefined) {
12
+ return undefined;
13
+ }
14
+ const mediaTypes = ['application/json', ...(representations === undefined ? [] : (route.consumes ?? []))];
15
+ return {
16
+ required: true,
17
+ content: Object.fromEntries(mediaTypes.map((mediaType) => [mediaType, { schema: fields }])),
18
+ };
9
19
  }
10
20
  function multipartBody(upload, fields) {
11
21
  const types = upload.mediaTypes.join(', ');
@@ -1 +1 @@
1
- {"version":3,"file":"request-body.js","sourceRoot":"","sources":["../../src/openapi/request-body.ts"],"names":[],"mappings":"AAKA,+HAA+H;AAC/H,MA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,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,gBAAgB,EAAE,0BAA0B;gBAC5C,WAAW,EAAE,aAAa,KAAK,aAAa,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,0CAA0C;gBAC7G,aAAa,EAAE,MAAM,CAAC,QAAQ;gBAC9B,eAAe,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;aACxC;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;KACzB,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4EAA4E;QACzF,OAAO,EAAE;YACP,qBAAqB,EAAE;gBACrB,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC/D,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE;aACrD;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import type { JsonSchema } from '@ddd-ts-kit/validation';
2
- import type { ErrorMapper } from '../error/error-mapper.js';
3
2
  import type { Route } from '../route/route.js';
4
- import type { Definitions } from './definitions.js';
3
+ import type { Documenting } from './documenting.js';
5
4
  /** The declared responses, plus one problem response per status of the declared error codes. */
6
- export declare function responses(route: Route, mapper: ErrorMapper, definitions: Definitions): JsonSchema;
5
+ export declare function responses(route: Route, documenting: Documenting): JsonSchema;
7
6
  //# sourceMappingURL=responses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/openapi/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAUpD,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,UAAU,CAiBjG"}
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/openapi/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAYpD,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,GAAG,UAAU,CAkB5E"}
@@ -1,5 +1,8 @@
1
1
  import { IfMatch } from '../cache/if-match.js';
2
2
  import { statusTitle } from '../error/status-title.js';
3
+ import { NOT_ACCEPTABLE } from '../representation/not-acceptable-error.js';
4
+ import { UNSUPPORTED_MEDIA_TYPE } from '../representation/unsupported-media-type-error.js';
5
+ import { answersWithSchema } from '../route/answers-with-schema.js';
3
6
  import { isRecord } from '../support/is-record.js';
4
7
  import { cacheResponseHeaders } from './cache-response-headers.js';
5
8
  import { compare } from './compare.js';
@@ -10,42 +13,58 @@ const NOT_MODIFIED = 304;
10
13
  /** What a route that declares an upload may answer besides its own codes: a file too large, of another type, or missing. */
11
14
  const UPLOAD_REFUSALS = ['FILE_TOO_LARGE', 'UNSUPPORTED_MEDIA_TYPE', VALIDATION_FAILED];
12
15
  const PROBLEM_REF = { $ref: '#/components/schemas/Problem' };
16
+ const JSON_MEDIA_TYPE = 'application/json';
17
+ const PROBLEM_MEDIA_TYPE = 'application/problem+json';
13
18
  /** The declared responses, plus one problem response per status of the declared error codes. */
14
- export function responses(route, mapper, definitions) {
15
- const byStatus = declaredResponses(route, definitions);
19
+ export function responses(route, documenting) {
20
+ const byStatus = declaredResponses(route, documenting);
21
+ const problemTypes = problemMediaTypes(route, documenting);
16
22
  if (route.cache?.etag !== undefined || route.cache?.lastModified !== undefined) {
17
23
  byStatus.set(NOT_MODIFIED, {
18
24
  description: 'Not Modified: the version the caller holds (If-None-Match, If-Modified-Since) is still the current one.',
19
25
  });
20
26
  }
21
- for (const [status, codes] of errorCodesByStatus(route, mapper)) {
22
- byStatus.set(status, problemResponse(status, codes, byStatus.get(status)));
27
+ for (const [status, codes] of errorCodesByStatus(route, documenting)) {
28
+ byStatus.set(status, problemResponse({ status, codes, mediaTypes: problemTypes }, byStatus.get(status)));
23
29
  }
24
30
  const statuses = [...byStatus.keys()].sort((a, b) => a - b);
25
31
  return Object.fromEntries(statuses.map((status) => [String(status), byStatus.get(status)]));
26
32
  }
27
- function declaredResponses(route, definitions) {
33
+ function declaredResponses(route, { definitions, representations }) {
28
34
  const byStatus = new Map();
35
+ const mediaTypes = representations?.offeredBy(route) ?? [JSON_MEDIA_TYPE];
36
+ // An answer chosen by Accept among several media types varies on it, as the pipeline says.
37
+ const varies = representations !== undefined && answersWithSchema(route) && mediaTypes.length > 1;
29
38
  // A copy has a string index, which is how the statuses are enumerated.
30
39
  const declaredByKey = { ...route.responses };
31
40
  for (const [key, declared] of Object.entries(declaredByKey)) {
32
41
  byStatus.set(Number(key), {
33
42
  description: declared.description,
34
- ...cacheResponseHeaders(route, Number(key)),
35
- ...(declared.body === undefined
36
- ? {}
37
- : { content: { 'application/json': { schema: definitions.embed(declared.body) } } }),
43
+ ...cacheResponseHeaders(route, Number(key), varies),
44
+ ...(declared.body === undefined ? {} : { content: contentOf(mediaTypes, definitions.embed(declared.body)) }),
38
45
  });
39
46
  }
40
47
  return byStatus;
41
48
  }
42
- function errorCodesByStatus(route, mapper) {
49
+ function contentOf(mediaTypes, schema) {
50
+ return Object.fromEntries(mediaTypes.map((mediaType) => [mediaType, { schema }]));
51
+ }
52
+ /** `application/problem+json`, and the problem type of every media type the route answers in that has one. */
53
+ function problemMediaTypes(route, { representations }) {
54
+ if (representations === undefined) {
55
+ return [PROBLEM_MEDIA_TYPE];
56
+ }
57
+ const types = representations.offeredBy(route).map((mediaType) => representations.problemIn(mediaType).mediaType);
58
+ return [...new Set(types)];
59
+ }
60
+ function errorCodesByStatus(route, { mapper, representations }) {
43
61
  const validatesInput = Object.values(route.request ?? {}).some((schema) => schema !== undefined);
44
62
  const uploads = route.upload === undefined ? [] : UPLOAD_REFUSALS;
45
63
  const codes = new Set([
46
64
  ...(route.errors ?? []),
47
65
  ...(validatesInput ? [VALIDATION_FAILED] : []),
48
66
  ...uploads,
67
+ ...(representations === undefined ? [] : negotiationCodes(route)),
49
68
  ...preconditionCodes(route),
50
69
  ]);
51
70
  const codesByStatus = new Map();
@@ -55,19 +74,28 @@ function errorCodesByStatus(route, mapper) {
55
74
  }
56
75
  return codesByStatus;
57
76
  }
77
+ /**
78
+ * Under negotiation, a route whose answer a representation writes refuses an `Accept` header it
79
+ * cannot meet with 406, and a route that reads a body refuses a media type it does not read with
80
+ * 415, whatever it declares in `produces` and `consumes`.
81
+ */
82
+ function negotiationCodes(route) {
83
+ const readsBody = route.request?.body !== undefined && route.upload === undefined && route.rawBody !== true;
84
+ return [...(answersWithSchema(route) ? [NOT_ACCEPTABLE] : []), ...(readsBody ? [UNSUPPORTED_MEDIA_TYPE] : [])];
85
+ }
58
86
  function preconditionCodes({ ifMatch }) {
59
87
  if (ifMatch === undefined) {
60
88
  return [];
61
89
  }
62
90
  return ifMatch === IfMatch.required ? [PRECONDITION_FAILED, PRECONDITION_REQUIRED] : [PRECONDITION_FAILED];
63
91
  }
64
- function problemResponse(status, codes, declared) {
92
+ function problemResponse({ status, codes, mediaTypes }, declared) {
65
93
  const sorted = [...codes].sort(compare);
66
94
  return {
67
95
  description: declared === undefined ? `${statusTitle(status)}. Error codes: ${sorted.join(', ')}.` : declared['description'],
68
96
  content: {
69
97
  ...(isRecord(declared?.['content']) ? declared['content'] : {}),
70
- 'application/problem+json': { schema: PROBLEM_REF },
98
+ ...contentOf(mediaTypes, PROBLEM_REF),
71
99
  },
72
100
  'x-error-codes': sorted,
73
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/openapi/responses.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAClD,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,4HAA4H;AAC5H,MAAM,eAAe,GAAG,CAAC,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,CAAC,CAAC;AACxF,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,8BAA8B,EAAE,CAAC;AAE7D,gGAAgG;AAChG,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,MAAmB,EAAE,WAAwB;IACnF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAEvD,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,EAAE,YAAY,KAAK,SAAS,EAAE,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MAAM,EAAE,KAAK,EAAE,UAAU,EAAY,EAAE,QAAgC;IAChG,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO;QACL,WAAW,EACT,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;QACjH,OAAO,EAAE;YACP,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,GAAG,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;SACtC;QACD,eAAe,EAAE,MAAM;KACxB,CAAC;AACJ,CAAC"}
@@ -4,7 +4,7 @@ export function schemaParameters(location, schema, definitions) {
4
4
  if (schema === undefined) {
5
5
  return [];
6
6
  }
7
- const embedded = definitions.embed(schema);
7
+ const embedded = definitions.resolve(definitions.embed(schema));
8
8
  const properties = embedded['properties'];
9
9
  if (!isRecord(properties)) {
10
10
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"schema-parameters.js","sourceRoot":"","sources":["../../src/openapi/schema-parameters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAC9B,QAAqC,EACrC,MAAmC,EACnC,WAAwB;IAExB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAE1C,IAAI,CAAC,QAAQ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UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjF,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;QACzD,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE7E,OAAO;YACL,IAAI;YACJ,EAAE,EAAE,QAAQ;YACZ,GAAG,CAAC,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjC,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Page } from '@ddd-ts-kit/kernel';
2
+ /**
3
+ * The items of every page of a search, read page after page as a streamed list is written: give
4
+ * it what sends the query of one page through the bus, so that each page is read through the
5
+ * middlewares of the bus (authorization, unit of work, tenant session, timeout, tracing, error
6
+ * reporting) inside the scope of the request:
7
+ *
8
+ * return everyPage((cursor) => this.queries.execute(new SearchAgendaQuery(actor, practiceId, pageAt(cursor))));
9
+ *
10
+ * A query handler that answers a lazy list instead is read after the bus has returned, outside
11
+ * of all of them. A page that fails once the status is sent cuts the response short and is
12
+ * reported to `onError` as an interrupted fault.
13
+ */
14
+ export declare function everyPage<T>(readPage: (cursor: string | undefined) => Promise<Page<T>>): AsyncIterable<T>;
15
+ //# sourceMappingURL=every-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"every-page.d.ts","sourceRoot":"","sources":["../../src/pagination/every-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,wBAAuB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAShH"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The items of every page of a search, read page after page as a streamed list is written: give
3
+ * it what sends the query of one page through the bus, so that each page is read through the
4
+ * middlewares of the bus (authorization, unit of work, tenant session, timeout, tracing, error
5
+ * reporting) inside the scope of the request:
6
+ *
7
+ * return everyPage((cursor) => this.queries.execute(new SearchAgendaQuery(actor, practiceId, pageAt(cursor))));
8
+ *
9
+ * A query handler that answers a lazy list instead is read after the bus has returned, outside
10
+ * of all of them. A page that fails once the status is sent cuts the response short and is
11
+ * reported to `onError` as an interrupted fault.
12
+ */
13
+ export async function* everyPage(readPage) {
14
+ let cursor;
15
+ do {
16
+ const page = await readPage(cursor);
17
+ yield* page.items;
18
+ cursor = page.nextCursor;
19
+ } while (cursor !== undefined);
20
+ }
21
+ //# sourceMappingURL=every-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"every-page.js","sourceRoot":"","sources":["../../src/pagination/every-page.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,CAAI,QAA0D;IAC5F,IAAI,MAA0B,CAAC;IAE/B,GAAG,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEpC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAClB,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC,QAAQ,MAAM,KAAK,SAAS,EAAE;AACjC,CAAC"}
@@ -3,7 +3,9 @@ import type { PageBody } from './page-body.js';
3
3
  /**
4
4
  * The schema of a page of items, from the schema of one item: validates the envelope and each
5
5
  * item, and describes both in the contract. Local `$defs` of the item schema move to the top,
6
- * where the OpenAPI generator collects them.
6
+ * where the OpenAPI generator collects them. The page of a shared item is shared too, as
7
+ * `<Item>Page`: every search that answers pages of it points at one component. The restricted
8
+ * fields of an item are those of each item of the page.
7
9
  */
8
10
  export declare function pageSchemaOf<T>(item: Schema<T>): Schema<PageBody<T>>;
9
11
  //# sourceMappingURL=page-schema-of.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-schema-of.d.ts","sourceRoot":"","sources":["../../src/pagination/page-schema-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,MAAM,EAAwB,MAAM,wBAAwB,CAAC;AAG1G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAEpE"}
1
+ {"version":3,"file":"page-schema-of.d.ts","sourceRoot":"","sources":["../../src/pagination/page-schema-of.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,MAAM,EAEZ,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CASpE"}
@@ -1,14 +1,22 @@
1
1
  import { err, ok } from '@ddd-ts-kit/kernel';
2
- import { customSchema } from '@ddd-ts-kit/validation';
2
+ import { customSchema, sharedNameOf, sharedSchema, } from '@ddd-ts-kit/validation';
3
+ import { fieldAccess } from '../field-access/field-access.js';
3
4
  import { isRecord } from '../support/is-record.js';
4
5
  import { issue } from './issue.js';
5
6
  /**
6
7
  * The schema of a page of items, from the schema of one item: validates the envelope and each
7
8
  * item, and describes both in the contract. Local `$defs` of the item schema move to the top,
8
- * where the OpenAPI generator collects them.
9
+ * where the OpenAPI generator collects them. The page of a shared item is shared too, as
10
+ * `<Item>Page`: every search that answers pages of it points at one component. The restricted
11
+ * fields of an item are those of each item of the page.
9
12
  */
10
13
  export function pageSchemaOf(item) {
11
- return customSchema((input) => parsePageBody(input, item), pageJsonSchema(item.toJsonSchema()));
14
+ const itemJsonSchema = item.toJsonSchema();
15
+ const page = customSchema((input) => parsePageBody(input, item), pageJsonSchema(itemJsonSchema));
16
+ const shared = sharedNameOf(itemJsonSchema);
17
+ const named = shared === undefined ? page : sharedSchema(`${shared}Page`, page);
18
+ fieldAccess.carry(item, named, ['items', '*']);
19
+ return named;
12
20
  }
13
21
  function parsePageBody(input, item) {
14
22
  if (!isRecord(input) || !Array.isArray(input['items'])) {
@@ -1 +1 @@
1
- {"version":3,"file":"page-schema-of.js","sourceRoot":"","sources":["../../src/pagination/page-schema-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAsD,MAAM,wBAAwB,CAAC;AAC1G,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAI,IAAe;IAC7C,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,aAAa,CAAI,KA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V,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;YACrC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE;YACzF,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;SAC/E;QACD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACzC,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC"}
@@ -4,8 +4,10 @@ import type { ExecuteOptions } from './execute-options.js';
4
4
  * Refuses, when the routes are mounted with the options of the application, a public answer the
5
5
  * caches in front could hand to the wrong caller: one of a route that knows its caller whose
6
6
  * `vary` names neither who calls (`Authorization`, `Cookie`) nor the header its tenant is read
7
- * from; one that varies, behind a cache that ignores `Vary`; one filed per tenant on a route
8
- * anybody may call, when nothing names the tenant of an anonymous call.
7
+ * from; one whose fields are shown to some callers only (`withFieldAccess`) whose `vary` names
8
+ * neither `Authorization` nor `Cookie`, whoever may call the route; one that varies, on a header
9
+ * or on `Accept` among the representations of the route, behind a cache that ignores `Vary`; one
10
+ * filed per tenant on a route anybody may call, when nothing names the tenant of an anonymous call.
9
11
  */
10
12
  export declare function assertCachedRoutes(routes: readonly Route[], options: ExecuteOptions): void;
11
13
  //# sourceMappingURL=assert-cached-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert-cached-routes.d.ts","sourceRoot":"","sources":["../../src/pipeline/assert-cached-routes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAM1F"}
1
+ {"version":3,"file":"assert-cached-routes.d.ts","sourceRoot":"","sources":["../../src/pipeline/assert-cached-routes.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS3D;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAM1F"}
@@ -2,6 +2,8 @@ import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
2
2
  import { CacheScope } from '../cache/cache-scope.js';
3
3
  import { CacheTagHeader } from '../cache/cache-tag-header.js';
4
4
  import { varyOf } from '../cache/vary-of.js';
5
+ import { fieldAccess } from '../field-access/field-access.js';
6
+ import { answersWithSchema } from '../route/answers-with-schema.js';
5
7
  // The request headers that say who calls: an answer that varies on one is never handed to another caller.
6
8
  const ACTOR_HEADERS = ['authorization', 'cookie'];
7
9
  // The caches that key their answers on Vary: Varnish (xkey) and Fastly. Cloudflare and Bunny do not.
@@ -10,8 +12,10 @@ const HONOURING_VARY = [CacheTagHeader.xkey, CacheTagHeader.surrogateKey];
10
12
  * Refuses, when the routes are mounted with the options of the application, a public answer the
11
13
  * caches in front could hand to the wrong caller: one of a route that knows its caller whose
12
14
  * `vary` names neither who calls (`Authorization`, `Cookie`) nor the header its tenant is read
13
- * from; one that varies, behind a cache that ignores `Vary`; one filed per tenant on a route
14
- * anybody may call, when nothing names the tenant of an anonymous call.
15
+ * from; one whose fields are shown to some callers only (`withFieldAccess`) whose `vary` names
16
+ * neither `Authorization` nor `Cookie`, whoever may call the route; one that varies, on a header
17
+ * or on `Accept` among the representations of the route, behind a cache that ignores `Vary`; one
18
+ * filed per tenant on a route anybody may call, when nothing names the tenant of an anonymous call.
15
19
  */
16
20
  export function assertCachedRoutes(routes, options) {
17
21
  for (const route of routes) {
@@ -22,16 +26,50 @@ export function assertCachedRoutes(routes, options) {
22
26
  }
23
27
  function assertCachedRoute(route, options) {
24
28
  const refused = (reason) => new DeclarationError(`Route "${route.operationId}" (${route.method} ${route.path}): ${reason}`);
29
+ const reason = callerRefusal(route, options) ?? fieldsRefusal(route) ?? varyRefusal(route, options);
30
+ if (reason !== undefined) {
31
+ throw refused(reason);
32
+ }
33
+ assertTenantNamed(route, options, refused);
34
+ }
35
+ /** On a route that knows its caller, why its answer could reach another caller, if it could. */
36
+ function callerRefusal(route, options) {
25
37
  const tenantHeaders = lowerCase(options.resolveTenant?.headers ?? []);
26
- const declared = lowerCase(route.cache.vary ?? []);
27
38
  const dimensions = [...ACTOR_HEADERS, ...tenantHeaders];
28
- if (route.security !== false && !declared.some((name) => dimensions.includes(name))) {
29
- throw refused(`the route knows its caller, and its public answer is kept by shared caches: name in vary one of ${dimensions.join(', ')}, what says who calls or the tenant, or declare scope private.`);
39
+ if (route.security === false || namesOneOf(route, dimensions)) {
40
+ return undefined;
30
41
  }
31
- if (!honoursVary(options) && varyOf(declared, tenantHeaders).length > 0) {
32
- throw refused(`the cache in front (${options.cacheTags?.header ?? ''}) ignores Vary, and would hand one variant to every caller: declare scope private, read the tenant from the host or the path, or set cacheTags.honoursVary once the cache keys on these headers.`);
42
+ return `the route knows its caller, and its public answer is kept by shared caches: name in vary one of ${dimensions.join(', ')}, what says who calls or the tenant, or declare scope private.`;
43
+ }
44
+ /** On an answer with fields some callers may not read, why it could reach another caller, if it could. */
45
+ function fieldsRefusal(route) {
46
+ if (!showsFieldsPerCaller(route) || namesOneOf(route, ACTOR_HEADERS)) {
47
+ return undefined;
33
48
  }
34
- assertTenantNamed(route, options, refused);
49
+ return `its answer shows some fields to some callers only, and a shared cache would hand the answer of the first caller to the next: name in vary one of ${ACTOR_HEADERS.join(', ')}, or declare scope private.`;
50
+ }
51
+ /** Behind a cache that ignores Vary, why a varying answer would reach every caller, if it would. */
52
+ function varyRefusal(route, options) {
53
+ if (honoursVary(options) || !varies(route, options)) {
54
+ return undefined;
55
+ }
56
+ return `the cache in front (${options.cacheTags?.header ?? ''}) ignores Vary, and would hand one variant to every caller: declare scope private, answer in one media type, read the tenant from the host or the path, or set cacheTags.honoursVary once the cache keys on these headers.`;
57
+ }
58
+ function namesOneOf(route, headers) {
59
+ return lowerCase(route.cache.vary ?? []).some((name) => headers.includes(name));
60
+ }
61
+ /** Whether the answer varies: on the headers its policy or the tenant names, or on `Accept` among several media types. */
62
+ function varies(route, options) {
63
+ const { representations, resolveTenant } = options;
64
+ const named = varyOf(route.cache.vary ?? [], resolveTenant?.headers ?? []);
65
+ const negotiated = representations !== undefined && answersWithSchema(route) && representations.offeredBy(route).length > 1;
66
+ return named.length > 0 || negotiated;
67
+ }
68
+ /** Whether a schema the route answers with holds a field some callers may not see. */
69
+ function showsFieldsPerCaller(route) {
70
+ // A copy has a string index, which is how the statuses are enumerated.
71
+ const declared = { ...route.responses };
72
+ return Object.values(declared).some(({ body }) => fieldAccess.of(body).some(({ rule }) => rule.read !== undefined));
35
73
  }
36
74
  function lowerCase(names) {
37
75
  return names.map((name) => name.toLowerCase());
@@ -1 +1 @@
1
- {"version":3,"file":"assert-cached-routes.js","sourceRoot":"","sources":["../../src/pipeline/assert-cached-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,0GAA0G;AAC1G,MAAM,aAAa,GAAsB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AACrE,qGAAqG;AACrG,MAAM,cAAc,GAA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Aa,EAAE,OAAuB,EAAE,OAAkC;IACnG,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAEnD,IAAI,OAAO,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QACjF,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,OAAO,CACX,qNAAqN,CACtN,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -4,7 +4,12 @@ import type { RouteResponse } from './route-response.js';
4
4
  /**
5
5
  * A successful read that declares validators answers its `ETag` and `Last-Modified`, and
6
6
  * `304 Not Modified` without a body when the caller already holds that version. A header the
7
- * handler answered itself wins.
7
+ * handler answered itself wins. A version and an instant are read from `value`, what the handler
8
+ * answered, whatever representation wrote it; a strong `ETag` digests the bytes sent, so an
9
+ * answer streamed as it is written, whose bytes are not known when its headers go, has none.
8
10
  */
9
- export declare function conditionalAnswer(route: Pick<Route, 'method' | 'cache'>, request: Readonly<RawHeaders>, response: RouteResponse): Promise<RouteResponse>;
11
+ export declare function conditionalAnswer(route: Pick<Route, 'method' | 'cache'>, request: Readonly<RawHeaders>, answered: {
12
+ readonly response: RouteResponse;
13
+ readonly value: unknown;
14
+ }): Promise<RouteResponse>;
10
15
  //# sourceMappingURL=conditional-answer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditional-answer.d.ts","sourceRoot":"","sources":["../../src/pipeline/conditional-answer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,EACtC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC7B,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,aAAa,CAAC,CAiBxB"}
1
+ {"version":3,"file":"conditional-answer.d.ts","sourceRoot":"","sources":["../../src/pipeline/conditional-answer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,EACtC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC7B,QAAQ,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACtE,OAAO,CAAC,aAAa,CAAC,CAkBxB"}
@@ -8,14 +8,17 @@ const READS = ['GET', 'HEAD'];
8
8
  /**
9
9
  * A successful read that declares validators answers its `ETag` and `Last-Modified`, and
10
10
  * `304 Not Modified` without a body when the caller already holds that version. A header the
11
- * handler answered itself wins.
11
+ * handler answered itself wins. A version and an instant are read from `value`, what the handler
12
+ * answered, whatever representation wrote it; a strong `ETag` digests the bytes sent, so an
13
+ * answer streamed as it is written, whose bytes are not known when its headers go, has none.
12
14
  */
13
- export async function conditionalAnswer(route, request, response) {
15
+ export async function conditionalAnswer(route, request, answered) {
14
16
  const { cache } = route;
17
+ const { response, value } = answered;
15
18
  if (cache === undefined || response.status < SUCCESS_FROM || response.status > SUCCESS_TO) {
16
19
  return response;
17
20
  }
18
- const headers = { ...(await validatorsOf(cache, response)), ...response.headers };
21
+ const headers = { ...(await validatorsOf(cache, response, value)), ...response.headers };
19
22
  if (!READS.includes(route.method) || !isNotModified(request, headers)) {
20
23
  return { ...response, headers };
21
24
  }
@@ -24,10 +27,11 @@ export async function conditionalAnswer(route, request, response) {
24
27
  headers: Object.fromEntries(Object.entries(headers).filter(([name]) => name !== 'content-type')),
25
28
  };
26
29
  }
27
- async function validatorsOf(cache, response) {
30
+ async function validatorsOf(cache, response, value) {
31
+ const streamed = response.stream !== undefined && cache.etag === 'representation';
28
32
  return {
29
- ...(cache.etag === undefined ? {} : { etag: await entityTagOf(cache.etag, response) }),
30
- ...(cache.lastModified === undefined ? {} : { 'last-modified': lastModifiedOf(cache.lastModified, response.body) }),
33
+ ...(cache.etag === undefined || streamed ? {} : { etag: await entityTagOf(cache.etag, response, value) }),
34
+ ...(cache.lastModified === undefined ? {} : { 'last-modified': lastModifiedOf(cache.lastModified, value) }),
31
35
  };
32
36
  }
33
37
  //# sourceMappingURL=conditional-answer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditional-answer.js","sourceRoot":"","sources":["../../src/pipeline/conditional-answer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,KAAK,GAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAsC,EACtC,OAA6B,EAC7B,QAAuB;IAEvB,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,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ACzB,KAAkB,EAClB,QAAuB,EACvB,KAAc;IAEd,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC;IAElF,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;QACzG,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;KAC5G,CAAC;AACJ,CAAC"}
@@ -2,8 +2,8 @@ import type { EntityTagSource } from '../cache/entity-tag-source.js';
2
2
  import type { RouteResponse } from './route-response.js';
3
3
  /**
4
4
  * The `ETag` of an answer: strong, the SHA-256 of the bytes sent, for `representation`; weak,
5
- * the version the body carries, for `{ version }`. A body without that version is an answer its
6
- * declaration does not allow.
5
+ * the version the value answered carries, for `{ version }`, the same in every representation.
6
+ * A value without that version is an answer its declaration does not allow.
7
7
  */
8
- export declare function entityTagOf(source: EntityTagSource, response: RouteResponse): Promise<string>;
8
+ export declare function entityTagOf(source: EntityTagSource, response: RouteResponse, value?: unknown): Promise<string>;
9
9
  //# sourceMappingURL=entity-tag-of.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity-tag-of.d.ts","sourceRoot":"","sources":["../../src/pipeline/entity-tag-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAYnG"}
1
+ {"version":3,"file":"entity-tag-of.d.ts","sourceRoot":"","sources":["../../src/pipeline/entity-tag-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,aAAa,EACvB,KAAK,GAAE,OAAuB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAYjB"}
@@ -3,14 +3,14 @@ import { valuesAt } from '../support/values-at.js';
3
3
  import { serializeBody } from './serialize-body.js';
4
4
  /**
5
5
  * The `ETag` of an answer: strong, the SHA-256 of the bytes sent, for `representation`; weak,
6
- * the version the body carries, for `{ version }`. A body without that version is an answer its
7
- * declaration does not allow.
6
+ * the version the value answered carries, for `{ version }`, the same in every representation.
7
+ * A value without that version is an answer its declaration does not allow.
8
8
  */
9
- export async function entityTagOf(source, response) {
9
+ export async function entityTagOf(source, response, value = response.body) {
10
10
  if (source === 'representation') {
11
11
  return `"${await digestOf(serializeBody(response) ?? '')}"`;
12
12
  }
13
- const [version] = valuesAt(response.body, source.version);
13
+ const [version] = valuesAt(value, source.version);
14
14
  if (typeof version !== 'number' && typeof version !== 'string') {
15
15
  throw new ResponseContractError(`The answer carries no version under "${source.version}" for its ETag.`);
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"entity-tag-of.js","sourceRoot":"","sources":["../../src/pipeline/entity-tag-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;GAIG;AACH,MAA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AE,EAAE,CAAC,CAAC;AAC7E,CAAC"}
@@ -7,8 +7,13 @@ export interface ErrorContext {
7
7
  readonly operationId: string;
8
8
  readonly method: HttpMethod;
9
9
  readonly path: string;
10
- /** The response the client receives for this error. */
10
+ /** The response the client receives for this error; for an interrupted stream, what it would have received. */
11
11
  readonly problem: Problem;
12
+ /**
13
+ * The failure came while a streamed list was written, after the status: the client received a
14
+ * response cut short, not the problem. Count it as a server fault whatever the problem says.
15
+ */
16
+ readonly interrupted?: boolean;
12
17
  /** The execution context of the request, when the failure happened after it was built: not for a refused credential or an invalid request. */
13
18
  readonly execution?: ExecutionContext;
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error-context.d.ts","sourceRoot":"","sources":["../../src/pipeline/error-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,8IAA8I;IAC9I,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CACvC"}
1
+ {"version":3,"file":"error-context.d.ts","sourceRoot":"","sources":["../../src/pipeline/error-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,C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