@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.
- package/README.md +373 -11
- package/dist/controller/controller-routes.d.ts.map +1 -1
- package/dist/controller/controller-routes.js +8 -0
- package/dist/controller/controller-routes.js.map +1 -1
- package/dist/controller/controller-spec.d.ts +7 -0
- package/dist/controller/controller-spec.d.ts.map +1 -1
- package/dist/error/default-error-mapping.d.ts.map +1 -1
- package/dist/error/default-error-mapping.js +1 -0
- package/dist/error/default-error-mapping.js.map +1 -1
- package/dist/express/mount-express.d.ts +4 -2
- package/dist/express/mount-express.d.ts.map +1 -1
- package/dist/express/mount-express.js +25 -11
- package/dist/express/mount-express.js.map +1 -1
- package/dist/fastify/mount-fastify.d.ts +2 -1
- package/dist/fastify/mount-fastify.d.ts.map +1 -1
- package/dist/fastify/mount-fastify.js +23 -4
- package/dist/fastify/mount-fastify.js.map +1 -1
- package/dist/field-access/assert-writable.d.ts +8 -0
- package/dist/field-access/assert-writable.d.ts.map +1 -0
- package/dist/field-access/assert-writable.js +29 -0
- package/dist/field-access/assert-writable.js.map +1 -0
- package/dist/field-access/field-access-entry.d.ts +7 -0
- package/dist/field-access/field-access-entry.d.ts.map +1 -0
- package/dist/field-access/field-access-entry.js +2 -0
- package/dist/field-access/field-access-entry.js.map +1 -0
- package/dist/field-access/field-access.d.ts +13 -0
- package/dist/field-access/field-access.d.ts.map +1 -0
- package/dist/field-access/field-access.js +41 -0
- package/dist/field-access/field-access.js.map +1 -0
- package/dist/field-access/field-decider-of.d.ts +37 -0
- package/dist/field-access/field-decider-of.d.ts.map +1 -0
- package/dist/field-access/field-decider-of.js +30 -0
- package/dist/field-access/field-decider-of.js.map +1 -0
- package/dist/field-access/field-decider.d.ts +4 -0
- package/dist/field-access/field-decider.d.ts.map +1 -0
- package/dist/field-access/field-decider.js +2 -0
- package/dist/field-access/field-decider.js.map +1 -0
- package/dist/field-access/field-judge.d.ts +33 -0
- package/dist/field-access/field-judge.d.ts.map +1 -0
- package/dist/field-access/field-judge.js +81 -0
- package/dist/field-access/field-judge.js.map +1 -0
- package/dist/field-access/field-policy.d.ts +15 -0
- package/dist/field-access/field-policy.d.ts.map +1 -0
- package/dist/field-access/field-policy.js +2 -0
- package/dist/field-access/field-policy.js.map +1 -0
- package/dist/field-access/field-question.d.ts +18 -0
- package/dist/field-access/field-question.d.ts.map +1 -0
- package/dist/field-access/field-question.js +2 -0
- package/dist/field-access/field-question.js.map +1 -0
- package/dist/field-access/field-requirement.d.ts +13 -0
- package/dist/field-access/field-requirement.d.ts.map +1 -0
- package/dist/field-access/field-requirement.js +2 -0
- package/dist/field-access/field-requirement.js.map +1 -0
- package/dist/field-access/field-rule.d.ts +11 -0
- package/dist/field-access/field-rule.d.ts.map +1 -0
- package/dist/field-access/field-rule.js +2 -0
- package/dist/field-access/field-rule.js.map +1 -0
- package/dist/field-access/field-rules.d.ts +6 -0
- package/dist/field-access/field-rules.d.ts.map +1 -0
- package/dist/field-access/field-rules.js +2 -0
- package/dist/field-access/field-rules.js.map +1 -0
- package/dist/field-access/field-tree.d.ts +16 -0
- package/dist/field-access/field-tree.d.ts.map +1 -0
- package/dist/field-access/field-tree.js +28 -0
- package/dist/field-access/field-tree.js.map +1 -0
- package/dist/field-access/visible-body.d.ts +9 -0
- package/dist/field-access/visible-body.d.ts.map +1 -0
- package/dist/field-access/visible-body.js +42 -0
- package/dist/field-access/visible-body.js.map +1 -0
- package/dist/field-access/with-field-access.d.ts +17 -0
- package/dist/field-access/with-field-access.d.ts.map +1 -0
- package/dist/field-access/with-field-access.js +63 -0
- package/dist/field-access/with-field-access.js.map +1 -0
- package/dist/forms/assert-hints.d.ts +12 -0
- package/dist/forms/assert-hints.d.ts.map +1 -0
- package/dist/forms/assert-hints.js +32 -0
- package/dist/forms/assert-hints.js.map +1 -0
- package/dist/forms/assert-opens.d.ts +16 -0
- package/dist/forms/assert-opens.d.ts.map +1 -0
- package/dist/forms/assert-opens.js +24 -0
- package/dist/forms/assert-opens.js.map +1 -0
- package/dist/forms/constraints-of.d.ts +4 -0
- package/dist/forms/constraints-of.d.ts.map +1 -0
- package/dist/forms/constraints-of.js +24 -0
- package/dist/forms/constraints-of.js.map +1 -0
- package/dist/forms/define-form.d.ts +20 -0
- package/dist/forms/define-form.d.ts.map +1 -0
- package/dist/forms/define-form.js +8 -0
- package/dist/forms/define-form.js.map +1 -0
- package/dist/forms/field-block.d.ts +33 -0
- package/dist/forms/field-block.d.ts.map +1 -0
- package/dist/forms/field-block.js +2 -0
- package/dist/forms/field-block.js.map +1 -0
- package/dist/forms/field-hint.d.ts +18 -0
- package/dist/forms/field-hint.d.ts.map +1 -0
- package/dist/forms/field-hint.js +2 -0
- package/dist/forms/field-hint.js.map +1 -0
- package/dist/forms/field-lookup.d.ts +7 -0
- package/dist/forms/field-lookup.d.ts.map +1 -0
- package/dist/forms/field-lookup.js +2 -0
- package/dist/forms/field-lookup.js.map +1 -0
- package/dist/forms/form-block.d.ts +5 -0
- package/dist/forms/form-block.d.ts.map +1 -0
- package/dist/forms/form-block.js +2 -0
- package/dist/forms/form-block.js.map +1 -0
- package/dist/forms/form-condition.d.ts +9 -0
- package/dist/forms/form-condition.d.ts.map +1 -0
- package/dist/forms/form-condition.js +2 -0
- package/dist/forms/form-condition.js.map +1 -0
- package/dist/forms/form-describer.d.ts +35 -0
- package/dist/forms/form-describer.d.ts.map +1 -0
- package/dist/forms/form-describer.js +132 -0
- package/dist/forms/form-describer.js.map +1 -0
- package/dist/forms/form-description.d.ts +17 -0
- package/dist/forms/form-description.d.ts.map +1 -0
- package/dist/forms/form-description.js +2 -0
- package/dist/forms/form-description.js.map +1 -0
- package/dist/forms/form-document.d.ts +9 -0
- package/dist/forms/form-document.d.ts.map +1 -0
- package/dist/forms/form-document.js +2 -0
- package/dist/forms/form-document.js.map +1 -0
- package/dist/forms/form-documents-of.d.ts +10 -0
- package/dist/forms/form-documents-of.d.ts.map +1 -0
- package/dist/forms/form-documents-of.js +22 -0
- package/dist/forms/form-documents-of.js.map +1 -0
- package/dist/forms/form-format.d.ts +7 -0
- package/dist/forms/form-format.d.ts.map +1 -0
- package/dist/forms/form-format.js +3 -0
- package/dist/forms/form-format.js.map +1 -0
- package/dist/forms/form-group-hint.d.ts +8 -0
- package/dist/forms/form-group-hint.d.ts.map +1 -0
- package/dist/forms/form-group-hint.js +2 -0
- package/dist/forms/form-group-hint.js.map +1 -0
- package/dist/forms/form-hints.d.ts +16 -0
- package/dist/forms/form-hints.d.ts.map +1 -0
- package/dist/forms/form-hints.js +2 -0
- package/dist/forms/form-hints.js.map +1 -0
- package/dist/forms/form-of-route.d.ts +17 -0
- package/dist/forms/form-of-route.d.ts.map +1 -0
- package/dist/forms/form-of-route.js +47 -0
- package/dist/forms/form-of-route.js.map +1 -0
- package/dist/forms/form-query-schema.d.ts +10 -0
- package/dist/forms/form-query-schema.d.ts.map +1 -0
- package/dist/forms/form-query-schema.js +58 -0
- package/dist/forms/form-query-schema.js.map +1 -0
- package/dist/forms/form-query.d.ts +7 -0
- package/dist/forms/form-query.d.ts.map +1 -0
- package/dist/forms/form-query.js +2 -0
- package/dist/forms/form-query.js.map +1 -0
- package/dist/forms/form-requirement.d.ts +18 -0
- package/dist/forms/form-requirement.d.ts.map +1 -0
- package/dist/forms/form-requirement.js +2 -0
- package/dist/forms/form-requirement.js.map +1 -0
- package/dist/forms/form-routes.d.ts +19 -0
- package/dist/forms/form-routes.d.ts.map +1 -0
- package/dist/forms/form-routes.js +67 -0
- package/dist/forms/form-routes.js.map +1 -0
- package/dist/forms/form-schema.d.ts +4 -0
- package/dist/forms/form-schema.d.ts.map +1 -0
- package/dist/forms/form-schema.js +52 -0
- package/dist/forms/form-schema.js.map +1 -0
- package/dist/forms/group-block.d.ts +9 -0
- package/dist/forms/group-block.d.ts.map +1 -0
- package/dist/forms/group-block.js +2 -0
- package/dist/forms/group-block.js.map +1 -0
- package/dist/forms/json-form.d.ts +8 -0
- package/dist/forms/json-form.d.ts.map +1 -0
- package/dist/forms/json-form.js +2 -0
- package/dist/forms/json-form.js.map +1 -0
- package/dist/forms/json-forms-of.d.ts +12 -0
- package/dist/forms/json-forms-of.d.ts.map +1 -0
- package/dist/forms/json-forms-of.js +129 -0
- package/dist/forms/json-forms-of.js.map +1 -0
- package/dist/forms/lookups-of.d.ts +5 -0
- package/dist/forms/lookups-of.d.ts.map +1 -0
- package/dist/forms/lookups-of.js +7 -0
- package/dist/forms/lookups-of.js.map +1 -0
- package/dist/forms/widget-of.d.ts +5 -0
- package/dist/forms/widget-of.d.ts.map +1 -0
- package/dist/forms/widget-of.js +25 -0
- package/dist/forms/widget-of.js.map +1 -0
- package/dist/forms/widget.d.ts +3 -0
- package/dist/forms/widget.d.ts.map +1 -0
- package/dist/forms/widget.js +2 -0
- package/dist/forms/widget.js.map +1 -0
- package/dist/hono/edge-problem.d.ts +11 -0
- package/dist/hono/edge-problem.d.ts.map +1 -0
- package/dist/hono/edge-problem.js +15 -0
- package/dist/hono/edge-problem.js.map +1 -0
- package/dist/hono/hono-mount-options.d.ts +10 -0
- package/dist/hono/hono-mount-options.d.ts.map +1 -0
- package/dist/hono/hono-mount-options.js +2 -0
- package/dist/hono/hono-mount-options.js.map +1 -0
- package/dist/hono/hono-raw.d.ts +11 -0
- package/dist/hono/hono-raw.d.ts.map +1 -0
- package/dist/hono/hono-raw.js +2 -0
- package/dist/hono/hono-raw.js.map +1 -0
- package/dist/hono/mount-hono.d.ts +13 -0
- package/dist/hono/mount-hono.d.ts.map +1 -0
- package/dist/hono/mount-hono.js +77 -0
- package/dist/hono/mount-hono.js.map +1 -0
- package/dist/hono/read-body.d.ts +16 -0
- package/dist/hono/read-body.d.ts.map +1 -0
- package/dist/hono/read-body.js +65 -0
- package/dist/hono/read-body.js.map +1 -0
- package/dist/hono.d.ts +4 -0
- package/dist/hono.d.ts.map +1 -0
- package/dist/hono.js +2 -0
- package/dist/hono.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/openapi/cache-response-headers.d.ts +5 -2
- package/dist/openapi/cache-response-headers.d.ts.map +1 -1
- package/dist/openapi/cache-response-headers.js +10 -5
- package/dist/openapi/cache-response-headers.js.map +1 -1
- package/dist/openapi/definitions.d.ts +6 -1
- package/dist/openapi/definitions.d.ts.map +1 -1
- package/dist/openapi/definitions.js +12 -1
- package/dist/openapi/definitions.js.map +1 -1
- package/dist/openapi/documenting.d.ts +11 -0
- package/dist/openapi/documenting.d.ts.map +1 -0
- package/dist/openapi/documenting.js +2 -0
- package/dist/openapi/documenting.js.map +1 -0
- package/dist/openapi/generate-open-api.d.ts +7 -0
- package/dist/openapi/generate-open-api.d.ts.map +1 -1
- package/dist/openapi/generate-open-api.js +5 -1
- package/dist/openapi/generate-open-api.js.map +1 -1
- package/dist/openapi/path-items.d.ts +2 -3
- package/dist/openapi/path-items.d.ts.map +1 -1
- package/dist/openapi/path-items.js +8 -7
- package/dist/openapi/path-items.js.map +1 -1
- package/dist/openapi/request-body.d.ts +6 -3
- package/dist/openapi/request-body.d.ts.map +1 -1
- package/dist/openapi/request-body.js +13 -3
- package/dist/openapi/request-body.js.map +1 -1
- package/dist/openapi/responses.d.ts +2 -3
- package/dist/openapi/responses.d.ts.map +1 -1
- package/dist/openapi/responses.js +40 -12
- package/dist/openapi/responses.js.map +1 -1
- package/dist/openapi/schema-parameters.js +1 -1
- package/dist/openapi/schema-parameters.js.map +1 -1
- package/dist/pagination/every-page.d.ts +15 -0
- package/dist/pagination/every-page.d.ts.map +1 -0
- package/dist/pagination/every-page.js +21 -0
- package/dist/pagination/every-page.js.map +1 -0
- package/dist/pagination/page-schema-of.d.ts +3 -1
- package/dist/pagination/page-schema-of.d.ts.map +1 -1
- package/dist/pagination/page-schema-of.js +11 -3
- package/dist/pagination/page-schema-of.js.map +1 -1
- package/dist/pipeline/assert-cached-routes.d.ts +4 -2
- package/dist/pipeline/assert-cached-routes.d.ts.map +1 -1
- package/dist/pipeline/assert-cached-routes.js +46 -8
- package/dist/pipeline/assert-cached-routes.js.map +1 -1
- package/dist/pipeline/conditional-answer.d.ts +7 -2
- package/dist/pipeline/conditional-answer.d.ts.map +1 -1
- package/dist/pipeline/conditional-answer.js +10 -6
- package/dist/pipeline/conditional-answer.js.map +1 -1
- package/dist/pipeline/entity-tag-of.d.ts +3 -3
- package/dist/pipeline/entity-tag-of.d.ts.map +1 -1
- package/dist/pipeline/entity-tag-of.js +4 -4
- package/dist/pipeline/entity-tag-of.js.map +1 -1
- package/dist/pipeline/error-context.d.ts +6 -1
- package/dist/pipeline/error-context.d.ts.map +1 -1
- package/dist/pipeline/execute-options.d.ts +17 -0
- package/dist/pipeline/execute-options.d.ts.map +1 -1
- package/dist/pipeline/execute-route.d.ts.map +1 -1
- package/dist/pipeline/execute-route.js +121 -35
- package/dist/pipeline/execute-route.js.map +1 -1
- package/dist/pipeline/iterated-within.d.ts +9 -0
- package/dist/pipeline/iterated-within.d.ts.map +1 -0
- package/dist/pipeline/iterated-within.js +17 -0
- package/dist/pipeline/iterated-within.js.map +1 -0
- package/dist/pipeline/negotiated-vary.d.ts +6 -0
- package/dist/pipeline/negotiated-vary.d.ts.map +1 -0
- package/dist/pipeline/negotiated-vary.js +15 -0
- package/dist/pipeline/negotiated-vary.js.map +1 -0
- package/dist/pipeline/negotiation.d.ts +19 -0
- package/dist/pipeline/negotiation.d.ts.map +1 -0
- package/dist/pipeline/negotiation.js +19 -0
- package/dist/pipeline/negotiation.js.map +1 -0
- package/dist/pipeline/primed.d.ts +6 -0
- package/dist/pipeline/primed.d.ts.map +1 -0
- package/dist/pipeline/primed.js +20 -0
- package/dist/pipeline/primed.js.map +1 -0
- package/dist/pipeline/read-body.d.ts +10 -0
- package/dist/pipeline/read-body.d.ts.map +1 -0
- package/dist/pipeline/read-body.js +33 -0
- package/dist/pipeline/read-body.js.map +1 -0
- package/dist/pipeline/reported-stream.d.ts +6 -0
- package/dist/pipeline/reported-stream.d.ts.map +1 -0
- package/dist/pipeline/reported-stream.js +14 -0
- package/dist/pipeline/reported-stream.js.map +1 -0
- package/dist/pipeline/represented-answer.d.ts +7 -0
- package/dist/pipeline/represented-answer.d.ts.map +1 -0
- package/dist/pipeline/represented-answer.js +2 -0
- package/dist/pipeline/represented-answer.js.map +1 -0
- package/dist/pipeline/represented.d.ts +7 -0
- package/dist/pipeline/represented.d.ts.map +1 -0
- package/dist/pipeline/represented.js +19 -0
- package/dist/pipeline/represented.js.map +1 -0
- package/dist/pipeline/route-response.d.ts +2 -0
- package/dist/pipeline/route-response.d.ts.map +1 -1
- package/dist/pipeline/tagged-answer.d.ts +5 -2
- package/dist/pipeline/tagged-answer.d.ts.map +1 -1
- package/dist/pipeline/tagged-answer.js +1 -1
- package/dist/pipeline/tagged-answer.js.map +1 -1
- package/dist/pipeline/write-stream.d.ts +8 -0
- package/dist/pipeline/write-stream.d.ts.map +1 -0
- package/dist/pipeline/write-stream.js +23 -0
- package/dist/pipeline/write-stream.js.map +1 -0
- package/dist/pipeline/written-in.d.ts +10 -0
- package/dist/pipeline/written-in.d.ts.map +1 -0
- package/dist/pipeline/written-in.js +17 -0
- package/dist/pipeline/written-in.js.map +1 -0
- package/dist/representation/assert-served.d.ts +10 -0
- package/dist/representation/assert-served.d.ts.map +1 -0
- package/dist/representation/assert-served.js +18 -0
- package/dist/representation/assert-served.js.map +1 -0
- package/dist/representation/body-shape.d.ts +9 -0
- package/dist/representation/body-shape.d.ts.map +1 -0
- package/dist/representation/body-shape.js +2 -0
- package/dist/representation/body-shape.js.map +1 -0
- package/dist/representation/csv/csv-cell.d.ts +8 -0
- package/dist/representation/csv/csv-cell.d.ts.map +1 -0
- package/dist/representation/csv/csv-cell.js +19 -0
- package/dist/representation/csv/csv-cell.js.map +1 -0
- package/dist/representation/csv/csv-representation.d.ts +16 -0
- package/dist/representation/csv/csv-representation.d.ts.map +1 -0
- package/dist/representation/csv/csv-representation.js +54 -0
- package/dist/representation/csv/csv-representation.js.map +1 -0
- package/dist/representation/is-json-media-type.d.ts +3 -0
- package/dist/representation/is-json-media-type.d.ts.map +1 -0
- package/dist/representation/is-json-media-type.js +5 -0
- package/dist/representation/is-json-media-type.js.map +1 -0
- package/dist/representation/json-representation.d.ts +14 -0
- package/dist/representation/json-representation.d.ts.map +1 -0
- package/dist/representation/json-representation.js +40 -0
- package/dist/representation/json-representation.js.map +1 -0
- package/dist/representation/malformed-body.d.ts +4 -0
- package/dist/representation/malformed-body.d.ts.map +1 -0
- package/dist/representation/malformed-body.js +6 -0
- package/dist/representation/malformed-body.js.map +1 -0
- package/dist/representation/media-type-of.d.ts +3 -0
- package/dist/representation/media-type-of.d.ts.map +1 -0
- package/dist/representation/media-type-of.js +7 -0
- package/dist/representation/media-type-of.js.map +1 -0
- package/dist/representation/negotiate.d.ts +8 -0
- package/dist/representation/negotiate.d.ts.map +1 -0
- package/dist/representation/negotiate.js +55 -0
- package/dist/representation/negotiate.js.map +1 -0
- package/dist/representation/not-acceptable-error.d.ts +7 -0
- package/dist/representation/not-acceptable-error.d.ts.map +1 -0
- package/dist/representation/not-acceptable-error.js +7 -0
- package/dist/representation/not-acceptable-error.js.map +1 -0
- package/dist/representation/problem-shape.d.ts +4 -0
- package/dist/representation/problem-shape.d.ts.map +1 -0
- package/dist/representation/problem-shape.js +7 -0
- package/dist/representation/problem-shape.js.map +1 -0
- package/dist/representation/representation.d.ts +20 -0
- package/dist/representation/representation.d.ts.map +1 -0
- package/dist/representation/representation.js +9 -0
- package/dist/representation/representation.js.map +1 -0
- package/dist/representation/representations.d.ts +33 -0
- package/dist/representation/representations.d.ts.map +1 -0
- package/dist/representation/representations.js +85 -0
- package/dist/representation/representations.js.map +1 -0
- package/dist/representation/represented-body.d.ts +3 -0
- package/dist/representation/represented-body.d.ts.map +1 -0
- package/dist/representation/represented-body.js +2 -0
- package/dist/representation/represented-body.js.map +1 -0
- package/dist/representation/stream-schema-of.d.ts +10 -0
- package/dist/representation/stream-schema-of.d.ts.map +1 -0
- package/dist/representation/stream-schema-of.js +31 -0
- package/dist/representation/stream-schema-of.js.map +1 -0
- package/dist/representation/unsupported-media-type-error.d.ts +7 -0
- package/dist/representation/unsupported-media-type-error.d.ts.map +1 -0
- package/dist/representation/unsupported-media-type-error.js +7 -0
- package/dist/representation/unsupported-media-type-error.js.map +1 -0
- package/dist/representation/wire-text.d.ts +7 -0
- package/dist/representation/wire-text.d.ts.map +1 -0
- package/dist/representation/wire-text.js +21 -0
- package/dist/representation/wire-text.js.map +1 -0
- package/dist/representation/xml/decode-entities.d.ts +3 -0
- package/dist/representation/xml/decode-entities.d.ts.map +1 -0
- package/dist/representation/xml/decode-entities.js +38 -0
- package/dist/representation/xml/decode-entities.js.map +1 -0
- package/dist/representation/xml/is-xml-name.d.ts +3 -0
- package/dist/representation/xml/is-xml-name.d.ts.map +1 -0
- package/dist/representation/xml/is-xml-name.js +6 -0
- package/dist/representation/xml/is-xml-name.js.map +1 -0
- package/dist/representation/xml/xml-convention.d.ts +10 -0
- package/dist/representation/xml/xml-convention.d.ts.map +1 -0
- package/dist/representation/xml/xml-convention.js +10 -0
- package/dist/representation/xml/xml-convention.js.map +1 -0
- package/dist/representation/xml/xml-element-writer.d.ts +16 -0
- package/dist/representation/xml/xml-element-writer.d.ts.map +1 -0
- package/dist/representation/xml/xml-element-writer.js +71 -0
- package/dist/representation/xml/xml-element-writer.js.map +1 -0
- package/dist/representation/xml/xml-element.d.ts +9 -0
- package/dist/representation/xml/xml-element.d.ts.map +1 -0
- package/dist/representation/xml/xml-element.js +2 -0
- package/dist/representation/xml/xml-element.js.map +1 -0
- package/dist/representation/xml/xml-parser.d.ts +27 -0
- package/dist/representation/xml/xml-parser.d.ts.map +1 -0
- package/dist/representation/xml/xml-parser.js +154 -0
- package/dist/representation/xml/xml-parser.js.map +1 -0
- package/dist/representation/xml/xml-representation.d.ts +20 -0
- package/dist/representation/xml/xml-representation.d.ts.map +1 -0
- package/dist/representation/xml/xml-representation.js +52 -0
- package/dist/representation/xml/xml-representation.js.map +1 -0
- package/dist/representation/xml/xml-syntax-error.d.ts +5 -0
- package/dist/representation/xml/xml-syntax-error.d.ts.map +1 -0
- package/dist/representation/xml/xml-syntax-error.js +8 -0
- package/dist/representation/xml/xml-syntax-error.js.map +1 -0
- package/dist/representation/xml/xml-text.d.ts +7 -0
- package/dist/representation/xml/xml-text.d.ts.map +1 -0
- package/dist/representation/xml/xml-text.js +30 -0
- package/dist/representation/xml/xml-text.js.map +1 -0
- package/dist/representation/xml/xml-value-reader.d.ts +15 -0
- package/dist/representation/xml/xml-value-reader.d.ts.map +1 -0
- package/dist/representation/xml/xml-value-reader.js +101 -0
- package/dist/representation/xml/xml-value-reader.js.map +1 -0
- package/dist/route/answers-with-schema.d.ts +7 -0
- package/dist/route/answers-with-schema.d.ts.map +1 -0
- package/dist/route/answers-with-schema.js +10 -0
- package/dist/route/answers-with-schema.js.map +1 -0
- package/dist/route/route-spec.d.ts +11 -0
- package/dist/route/route-spec.d.ts.map +1 -1
- package/dist/schema/json-schema-of.d.ts +7 -0
- package/dist/schema/json-schema-of.d.ts.map +1 -0
- package/dist/schema/json-schema-of.js +15 -0
- package/dist/schema/json-schema-of.js.map +1 -0
- package/dist/schema/schema-node.d.ts +25 -0
- package/dist/schema/schema-node.d.ts.map +1 -0
- package/dist/schema/schema-node.js +92 -0
- package/dist/schema/schema-node.js.map +1 -0
- package/dist/schema/schema-type.d.ts +3 -0
- package/dist/schema/schema-type.d.ts.map +1 -0
- package/dist/schema/schema-type.js +2 -0
- package/dist/schema/schema-type.js.map +1 -0
- package/dist/schema/xml-hints.d.ts +9 -0
- package/dist/schema/xml-hints.d.ts.map +1 -0
- package/dist/schema/xml-hints.js +2 -0
- package/dist/schema/xml-hints.js.map +1 -0
- package/dist/schemas/accepted-schema.d.ts +8 -0
- package/dist/schemas/accepted-schema.d.ts.map +1 -0
- package/dist/schemas/accepted-schema.js +20 -0
- package/dist/schemas/accepted-schema.js.map +1 -0
- package/dist/schemas/accepted.d.ts +5 -0
- package/dist/schemas/accepted.d.ts.map +1 -0
- package/dist/schemas/accepted.js +2 -0
- package/dist/schemas/accepted.js.map +1 -0
- package/dist/serialization/decimal-text.d.ts +6 -0
- package/dist/serialization/decimal-text.d.ts.map +1 -0
- package/dist/serialization/decimal-text.js +13 -0
- package/dist/serialization/decimal-text.js.map +1 -0
- package/dist/serialization/money-body.d.ts +6 -0
- package/dist/serialization/money-body.d.ts.map +1 -0
- package/dist/serialization/money-body.js +2 -0
- package/dist/serialization/money-body.js.map +1 -0
- package/dist/serialization/money.d.ts +4 -0
- package/dist/serialization/money.d.ts.map +1 -0
- package/dist/serialization/money.js +10 -0
- package/dist/serialization/money.js.map +1 -0
- package/dist/support/is-async-iterable.d.ts +3 -0
- package/dist/support/is-async-iterable.d.ts.map +1 -0
- package/dist/support/is-async-iterable.js +5 -0
- package/dist/support/is-async-iterable.js.map +1 -0
- package/package.json +15 -5
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { decodeEntities } from './decode-entities.js';
|
|
2
|
+
import { XmlSyntaxError } from './xml-syntax-error.js';
|
|
3
|
+
const NAME = /[\p{L}_:][\p{L}\p{N}._:-]*/uy;
|
|
4
|
+
const SPACE = /\s*/y;
|
|
5
|
+
const ATTRIBUTE_VALUE = /"([^"<]*)"|'([^'<]*)'/y;
|
|
6
|
+
const MAX_DEPTH = 64;
|
|
7
|
+
/**
|
|
8
|
+
* Parses the subset of XML 1.0 a request body needs: elements, attributes, character data,
|
|
9
|
+
* CDATA sections, comments, processing instructions, the five predefined entities and character
|
|
10
|
+
* references. A document type declaration is refused, and with it every external or recursive
|
|
11
|
+
* entity: nothing in a body can make the parser read a file or expand without end.
|
|
12
|
+
*/
|
|
13
|
+
export class XmlParser {
|
|
14
|
+
source;
|
|
15
|
+
position = 0;
|
|
16
|
+
constructor(source) {
|
|
17
|
+
this.source = source;
|
|
18
|
+
}
|
|
19
|
+
static parse(source) {
|
|
20
|
+
return new XmlParser(source).document();
|
|
21
|
+
}
|
|
22
|
+
document() {
|
|
23
|
+
this.miscellany();
|
|
24
|
+
if (this.source.startsWith('<!DOCTYPE', this.position)) {
|
|
25
|
+
throw new XmlSyntaxError('a document type declaration is not accepted');
|
|
26
|
+
}
|
|
27
|
+
const root = this.element(1);
|
|
28
|
+
this.miscellany();
|
|
29
|
+
if (this.position < this.source.length) {
|
|
30
|
+
throw new XmlSyntaxError('content after the root element');
|
|
31
|
+
}
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
/** Spaces, comments and processing instructions, where the document allows them. */
|
|
35
|
+
miscellany() {
|
|
36
|
+
for (;;) {
|
|
37
|
+
this.match(SPACE);
|
|
38
|
+
if (this.source.startsWith('<?', this.position)) {
|
|
39
|
+
this.skipPast('?>');
|
|
40
|
+
}
|
|
41
|
+
else if (this.source.startsWith('<!--', this.position)) {
|
|
42
|
+
this.skipPast('-->');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
element(depth) {
|
|
50
|
+
if (depth > MAX_DEPTH) {
|
|
51
|
+
throw new XmlSyntaxError(`elements nested deeper than ${String(MAX_DEPTH)}`);
|
|
52
|
+
}
|
|
53
|
+
this.expect('<');
|
|
54
|
+
const name = this.name();
|
|
55
|
+
const attributes = this.attributes();
|
|
56
|
+
if (this.source.startsWith('/>', this.position)) {
|
|
57
|
+
this.position += 2;
|
|
58
|
+
return { name, attributes, children: [], text: '' };
|
|
59
|
+
}
|
|
60
|
+
this.expect('>');
|
|
61
|
+
const content = this.content(depth);
|
|
62
|
+
this.expect(`</${name}`);
|
|
63
|
+
this.match(SPACE);
|
|
64
|
+
this.expect('>');
|
|
65
|
+
return { name, attributes, ...content };
|
|
66
|
+
}
|
|
67
|
+
attributes() {
|
|
68
|
+
const attributes = {};
|
|
69
|
+
for (;;) {
|
|
70
|
+
this.match(SPACE);
|
|
71
|
+
if (!/[\p{L}_:]/u.test(this.source.charAt(this.position))) {
|
|
72
|
+
return attributes;
|
|
73
|
+
}
|
|
74
|
+
const name = this.name();
|
|
75
|
+
this.match(SPACE);
|
|
76
|
+
this.expect('=');
|
|
77
|
+
this.match(SPACE);
|
|
78
|
+
const value = this.match(ATTRIBUTE_VALUE);
|
|
79
|
+
if (value === undefined || Object.hasOwn(attributes, name)) {
|
|
80
|
+
throw new XmlSyntaxError(`the attribute ${name} is malformed or repeated`);
|
|
81
|
+
}
|
|
82
|
+
// Defined, not assigned: an attribute named __proto__ is an attribute like any other.
|
|
83
|
+
Object.defineProperty(attributes, name, {
|
|
84
|
+
value: decodeEntities(value[1] ?? value[2] ?? ''),
|
|
85
|
+
enumerable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
configurable: true,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
content(depth) {
|
|
92
|
+
const content = { children: [], text: '' };
|
|
93
|
+
while (!this.source.startsWith('</', this.position)) {
|
|
94
|
+
this.contentPart(content, depth);
|
|
95
|
+
}
|
|
96
|
+
return content;
|
|
97
|
+
}
|
|
98
|
+
contentPart(content, depth) {
|
|
99
|
+
if (this.position >= this.source.length) {
|
|
100
|
+
throw new XmlSyntaxError('an element is not closed');
|
|
101
|
+
}
|
|
102
|
+
if (this.source.startsWith('<![CDATA[', this.position)) {
|
|
103
|
+
const start = this.position + '<![CDATA['.length;
|
|
104
|
+
content.text += this.source.slice(start, this.skipPast(']]>'));
|
|
105
|
+
}
|
|
106
|
+
else if (this.source.startsWith('<!--', this.position) || this.source.startsWith('<?', this.position)) {
|
|
107
|
+
this.miscellany();
|
|
108
|
+
}
|
|
109
|
+
else if (this.source.startsWith('<', this.position)) {
|
|
110
|
+
content.children.push(this.element(depth + 1));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
content.text += this.characterData();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
characterData() {
|
|
117
|
+
const end = this.source.indexOf('<', this.position);
|
|
118
|
+
const raw = this.source.slice(this.position, end === -1 ? this.source.length : end);
|
|
119
|
+
this.position += raw.length;
|
|
120
|
+
return decodeEntities(raw);
|
|
121
|
+
}
|
|
122
|
+
name() {
|
|
123
|
+
const name = this.match(NAME)?.[0];
|
|
124
|
+
if (name === undefined) {
|
|
125
|
+
throw new XmlSyntaxError('a name was expected');
|
|
126
|
+
}
|
|
127
|
+
return name;
|
|
128
|
+
}
|
|
129
|
+
expect(text) {
|
|
130
|
+
if (!this.source.startsWith(text, this.position)) {
|
|
131
|
+
throw new XmlSyntaxError(`"${text}" was expected`);
|
|
132
|
+
}
|
|
133
|
+
this.position += text.length;
|
|
134
|
+
}
|
|
135
|
+
/** Moves past the next `end`, and answers where `end` starts. */
|
|
136
|
+
skipPast(end) {
|
|
137
|
+
const at = this.source.indexOf(end, this.position);
|
|
138
|
+
if (at === -1) {
|
|
139
|
+
throw new XmlSyntaxError(`"${end}" was expected`);
|
|
140
|
+
}
|
|
141
|
+
this.position = at + end.length;
|
|
142
|
+
return at;
|
|
143
|
+
}
|
|
144
|
+
match(pattern) {
|
|
145
|
+
pattern.lastIndex = this.position;
|
|
146
|
+
const found = pattern.exec(this.source);
|
|
147
|
+
if (found === null) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
this.position += found[0].length;
|
|
151
|
+
return found;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=xml-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-parser.js","sourceRoot":"","sources":["../../../src/representation/xml/xml-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAC5C,MAAM,KAAK,GAAG,MAAM,CAAC;AACrB,MAAM,eAAe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AAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BodyShape } from '../body-shape.js';
|
|
2
|
+
import type { RepresentedBody } from '../represented-body.js';
|
|
3
|
+
import type { Representation } from '../representation.js';
|
|
4
|
+
/**
|
|
5
|
+
* `application/xml`, and `application/problem+xml` for a refusal: the JSON model written as XML,
|
|
6
|
+
* element names and attributes taken from the response schema and its XML object, never a
|
|
7
|
+
* vocabulary of its own. A body sent as XML is read back by the same convention into the value
|
|
8
|
+
* the JSON path produces, then validated by the same schema. No library: the parser reads only
|
|
9
|
+
* what a body needs and refuses any document type declaration.
|
|
10
|
+
*/
|
|
11
|
+
export declare class XmlRepresentation implements Representation {
|
|
12
|
+
readonly mediaType = "application/xml";
|
|
13
|
+
readonly problemMediaType = "application/problem+xml";
|
|
14
|
+
private readonly writer;
|
|
15
|
+
private readonly reader;
|
|
16
|
+
write(body: unknown, shape: BodyShape): RepresentedBody;
|
|
17
|
+
read(text: string, shape: BodyShape): unknown;
|
|
18
|
+
private streamed;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=xml-representation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-representation.d.ts","sourceRoot":"","sources":["../../../src/representation/xml/xml-representation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQ3D;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IACtD,QAAQ,CAAC,SAAS,qBAAc;IAEhC,QAAQ,CAAC,gBAAgB,6BAA6B;IAEtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAE/C,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,eAAe,CAStD;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAM5C;YAEc,QAAQ;CAYxB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SchemaNode } from '../../schema/schema-node.js';
|
|
2
|
+
import { isAsyncIterable } from '../../support/is-async-iterable.js';
|
|
3
|
+
import { malformedBody } from '../malformed-body.js';
|
|
4
|
+
import { ITEM_ELEMENT, XML_DECLARATION, XSI_NAMESPACE } from './xml-convention.js';
|
|
5
|
+
import { XmlElementWriter } from './xml-element-writer.js';
|
|
6
|
+
import { XmlParser } from './xml-parser.js';
|
|
7
|
+
import { XmlValueReader } from './xml-value-reader.js';
|
|
8
|
+
const MEDIA_TYPE = 'application/xml';
|
|
9
|
+
/**
|
|
10
|
+
* `application/xml`, and `application/problem+xml` for a refusal: the JSON model written as XML,
|
|
11
|
+
* element names and attributes taken from the response schema and its XML object, never a
|
|
12
|
+
* vocabulary of its own. A body sent as XML is read back by the same convention into the value
|
|
13
|
+
* the JSON path produces, then validated by the same schema. No library: the parser reads only
|
|
14
|
+
* what a body needs and refuses any document type declaration.
|
|
15
|
+
*/
|
|
16
|
+
export class XmlRepresentation {
|
|
17
|
+
mediaType = MEDIA_TYPE;
|
|
18
|
+
problemMediaType = 'application/problem+xml';
|
|
19
|
+
writer = new XmlElementWriter();
|
|
20
|
+
reader = new XmlValueReader();
|
|
21
|
+
write(body, shape) {
|
|
22
|
+
const node = SchemaNode.of(shape.schema);
|
|
23
|
+
const root = rootOf(node, shape);
|
|
24
|
+
if (isAsyncIterable(body)) {
|
|
25
|
+
return this.streamed(body, { node, root });
|
|
26
|
+
}
|
|
27
|
+
return `${XML_DECLARATION}${this.writer.element(root.name, body, node).replace(`<${root.name}`, root.open)}`;
|
|
28
|
+
}
|
|
29
|
+
read(text, shape) {
|
|
30
|
+
try {
|
|
31
|
+
return this.reader.value(XmlParser.parse(text), SchemaNode.of(shape.schema));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw malformedBody(MEDIA_TYPE);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async *streamed(items, { node, root }) {
|
|
38
|
+
const itemNode = node.items();
|
|
39
|
+
const itemName = itemNode.xml().name ?? ITEM_ELEMENT;
|
|
40
|
+
yield `${XML_DECLARATION}${root.open}>`;
|
|
41
|
+
for await (const item of items) {
|
|
42
|
+
yield this.writer.element(itemName, item, itemNode);
|
|
43
|
+
}
|
|
44
|
+
yield `</${root.name}>`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function rootOf(node, shape) {
|
|
48
|
+
const { name = shape.name, namespace } = node.xml();
|
|
49
|
+
const declared = namespace === undefined ? '' : ` xmlns="${namespace}"`;
|
|
50
|
+
return { name, open: `<${name}${declared} xmlns:xsi="${XSI_NAMESPACE}"` };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=xml-representation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-representation.js","sourceRoot":"","sources":["../../../src/representation/xml/xml-representation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,OAAO,iBAAiB;IACnB,SAAS,GA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Ae,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC;QAExC,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC/B,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC;IAC1B,CAAC;CACF;AAaD,SAAS,MAAM,CAAC,IAAgB,EAAE,KAAgB;IAChD,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,SAAS,GAAG,CAAC;IAExE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,GAAG,QAAQ,eAAe,aAAa,GAAG,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-syntax-error.d.ts","sourceRoot":"","sources":["../../../src/representation/xml/xml-syntax-error.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,MAAM,EAAE,MAAM,EAGzB;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A body that is not the XML the parser reads: answered as a malformed body, never quoted. */
|
|
2
|
+
export class XmlSyntaxError extends Error {
|
|
3
|
+
constructor(reason) {
|
|
4
|
+
super(`The XML is not well formed: ${reason}.`);
|
|
5
|
+
this.name = 'XmlSyntaxError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=xml-syntax-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-syntax-error.js","sourceRoot":"","sources":["../../../src/representation/xml/xml-syntax-error.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,MAAc;QACxB,KAAK,CAAC,+BAA+B,MAAM,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text that is safe as the content of an element or the value of an attribute between quotes.
|
|
3
|
+
* A character XML 1.0 cannot carry at all (most control characters, a lone surrogate) becomes
|
|
4
|
+
* U+FFFD: the document stays well formed, and the loss is visible.
|
|
5
|
+
*/
|
|
6
|
+
export declare function xmlText(value: string): string;
|
|
7
|
+
//# sourceMappingURL=xml-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-text.d.ts","sourceRoot":"","sources":["../../../src/representation/xml/xml-text.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const REPLACEMENT = '�';
|
|
2
|
+
const ESCAPES = {
|
|
3
|
+
'&': '&',
|
|
4
|
+
'<': '<',
|
|
5
|
+
'>': '>',
|
|
6
|
+
'"': '"',
|
|
7
|
+
"'": ''',
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Text that is safe as the content of an element or the value of an attribute between quotes.
|
|
11
|
+
* A character XML 1.0 cannot carry at all (most control characters, a lone surrogate) becomes
|
|
12
|
+
* U+FFFD: the document stays well formed, and the loss is visible.
|
|
13
|
+
*/
|
|
14
|
+
export function xmlText(value) {
|
|
15
|
+
let text = '';
|
|
16
|
+
for (const character of value) {
|
|
17
|
+
text += isXmlCharacter(character.codePointAt(0) ?? 0) ? (ESCAPES[character] ?? character) : REPLACEMENT;
|
|
18
|
+
}
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
/** The `Char` production of XML 1.0. */
|
|
22
|
+
function isXmlCharacter(code) {
|
|
23
|
+
return (code === 0x9 ||
|
|
24
|
+
code === 0xa ||
|
|
25
|
+
code === 0xd ||
|
|
26
|
+
(code >= 0x20 && code <= 0xd7ff) ||
|
|
27
|
+
(code >= 0xe000 && code <= 0xfffd) ||
|
|
28
|
+
code >= 0x10000);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=xml-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-text.js","sourceRoot":"","sources":["../../../src/representation/xml/xml-text.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,OAAO,GAAqC;IAChD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,IAAI,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAC1G,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wCAAwC;AACxC,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,CACL,IAAI,KAAK,GAAG;QACZ,IAAI,KAAK,GAAG;QACZ,IAAI,KAAK,GAAG;QACZ,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,CAAC;QAChC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,IAAI,IAAI,OAAO,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SchemaNode } from '../../schema/schema-node.js';
|
|
2
|
+
import type { XmlElement } from './xml-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reads a parsed element back into the value the JSON path produces, by the same convention and
|
|
5
|
+
* the same schema the writer uses: text becomes a number or a boolean where the schema says so,
|
|
6
|
+
* repeated elements a list. What the schema does not declare is kept as it was read, so that the
|
|
7
|
+
* schema refuses it as it refuses an unknown JSON property.
|
|
8
|
+
*/
|
|
9
|
+
export declare class XmlValueReader {
|
|
10
|
+
value(element: XmlElement, node: SchemaNode): unknown;
|
|
11
|
+
private record;
|
|
12
|
+
private member;
|
|
13
|
+
private undeclared;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=xml-value-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-value-reader.d.ts","sourceRoot":"","sources":["../../../src/representation/xml/xml-value-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgBnD;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAgBpD;IAED,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,MAAM;IAqBd,OAAO,CAAC,UAAU;CAenB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { SchemaNode } from '../../schema/schema-node.js';
|
|
2
|
+
import { ENTRY_ELEMENT, KEY_ATTRIBUTE } from './xml-convention.js';
|
|
3
|
+
const NUMBER = /^\s*-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?\s*$/;
|
|
4
|
+
const BOOLEANS = new Map([
|
|
5
|
+
['true', true],
|
|
6
|
+
['false', false],
|
|
7
|
+
['1', true],
|
|
8
|
+
['0', false],
|
|
9
|
+
]);
|
|
10
|
+
/** What a document declares about itself, never a value: namespaces and the attributes of the XSI namespace. */
|
|
11
|
+
const DECLARATION = /^(?:xmlns(?::|$)|xsi:)/;
|
|
12
|
+
/** A schema that declares nothing, for what the schema of the body does not describe. */
|
|
13
|
+
const NOTHING = SchemaNode.of({});
|
|
14
|
+
/**
|
|
15
|
+
* Reads a parsed element back into the value the JSON path produces, by the same convention and
|
|
16
|
+
* the same schema the writer uses: text becomes a number or a boolean where the schema says so,
|
|
17
|
+
* repeated elements a list. What the schema does not declare is kept as it was read, so that the
|
|
18
|
+
* schema refuses it as it refuses an unknown JSON property.
|
|
19
|
+
*/
|
|
20
|
+
export class XmlValueReader {
|
|
21
|
+
value(element, node) {
|
|
22
|
+
if (isNil(element)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const type = node.type();
|
|
26
|
+
if (type === 'array') {
|
|
27
|
+
return element.children.map((child) => this.value(child, node.items()));
|
|
28
|
+
}
|
|
29
|
+
if (type === 'object' || (type === undefined && element.children.length > 0)) {
|
|
30
|
+
return this.record(element, node);
|
|
31
|
+
}
|
|
32
|
+
return scalar(element.text, node);
|
|
33
|
+
}
|
|
34
|
+
record(element, node) {
|
|
35
|
+
const record = {};
|
|
36
|
+
const claimed = new Set();
|
|
37
|
+
for (const [key, child] of node.properties()) {
|
|
38
|
+
const read = this.member(element, { key, node: child }, claimed);
|
|
39
|
+
if (read !== undefined) {
|
|
40
|
+
setOwn(record, key, read);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.undeclared(element, claimed, record);
|
|
44
|
+
return record;
|
|
45
|
+
}
|
|
46
|
+
member(element, { key, node }, claimed) {
|
|
47
|
+
const hints = node.xml();
|
|
48
|
+
const name = hints.name ?? key;
|
|
49
|
+
if (hints.attribute === true) {
|
|
50
|
+
const text = ownOf(element.attributes, name);
|
|
51
|
+
return text === undefined ? undefined : scalar(text, node);
|
|
52
|
+
}
|
|
53
|
+
const named = element.children.filter((child) => isNamed(child, name) && !claimed.has(child));
|
|
54
|
+
named.forEach((child) => claimed.add(child));
|
|
55
|
+
if (node.type() !== 'array' || hints.wrapped === true) {
|
|
56
|
+
return named[0] === undefined ? undefined : this.value(named[0], node);
|
|
57
|
+
}
|
|
58
|
+
return named.map((child) => this.value(child, node.items()));
|
|
59
|
+
}
|
|
60
|
+
undeclared(element, claimed, record) {
|
|
61
|
+
for (const child of element.children.filter((candidate) => !claimed.has(candidate))) {
|
|
62
|
+
const key = keyOf(child);
|
|
63
|
+
const value = child.children.length > 0 ? this.record(child, NOTHING) : child.text;
|
|
64
|
+
const earlier = ownOf(record, key);
|
|
65
|
+
setOwn(record, key, earlier === undefined ? value : [earlier, value].flat());
|
|
66
|
+
}
|
|
67
|
+
for (const [name, text] of Object.entries(element.attributes)) {
|
|
68
|
+
if (!DECLARATION.test(name) && !Object.hasOwn(record, name)) {
|
|
69
|
+
setOwn(record, name, text);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function isNil(element) {
|
|
75
|
+
return Object.entries(element.attributes).some(([name, value]) => (name === 'nil' || name.endsWith(':nil')) && (value === 'true' || value === '1'));
|
|
76
|
+
}
|
|
77
|
+
function isNamed(element, name) {
|
|
78
|
+
return element.name === name || (element.name === ENTRY_ELEMENT && ownOf(element.attributes, KEY_ATTRIBUTE) === name);
|
|
79
|
+
}
|
|
80
|
+
function keyOf(element) {
|
|
81
|
+
return element.name === ENTRY_ELEMENT ? (ownOf(element.attributes, KEY_ATTRIBUTE) ?? element.name) : element.name;
|
|
82
|
+
}
|
|
83
|
+
function scalar(text, node) {
|
|
84
|
+
const type = node.type();
|
|
85
|
+
if ((type === 'number' || type === 'integer') && NUMBER.test(text)) {
|
|
86
|
+
return Number(text);
|
|
87
|
+
}
|
|
88
|
+
if (type === 'boolean') {
|
|
89
|
+
return BOOLEANS.get(text.trim()) ?? text;
|
|
90
|
+
}
|
|
91
|
+
return text;
|
|
92
|
+
}
|
|
93
|
+
/** The value a record holds itself under `key`, never one it inherits: `constructor` or `__proto__` is no member of a document. */
|
|
94
|
+
function ownOf(record, key) {
|
|
95
|
+
return Object.hasOwn(record, key) ? record[key] : undefined;
|
|
96
|
+
}
|
|
97
|
+
/** Defined, not assigned: an element named `__proto__` becomes a key the schema then refuses, never the prototype of the record. */
|
|
98
|
+
function setOwn(record, key, value) {
|
|
99
|
+
Object.defineProperty(record, key, { value, enumerable: true, writable: true, configurable: true });
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=xml-value-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-value-reader.js","sourceRoot":"","sources":["../../../src/representation/xml/xml-value-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnE,MAAM,MAAM,GAAG,qDAAqD,CAAC;AAErE,MAAM,QAAQ,GAAiC,IAAI,GAAG,CAAC;IACrD,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,KAAK,CAAC;CACb,CAAC,CAAC;AAEH,gHAAgH;AAChH,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAC7C,yFAAyF;AACzF,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAElC;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,OAAmB,EAAE,IAAgB;QACzC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,IAAI,IAAI,KAAK,OAAO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,7 @@
|
|
|
1
|
+
import type { Route } from './route.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a representation writes what the route answers: a route that declares no body schema
|
|
4
|
+
* answers its own bytes (a file, a redirect, no content), which no `Accept` header refuses.
|
|
5
|
+
*/
|
|
6
|
+
export declare function answersWithSchema(route: Pick<Route, 'responses'>): boolean;
|
|
7
|
+
//# sourceMappingURL=answers-with-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answers-with-schema.d.ts","sourceRoot":"","sources":["../../src/route/answers-with-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,OAAO,CAK1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a representation writes what the route answers: a route that declares no body schema
|
|
3
|
+
* answers its own bytes (a file, a redirect, no content), which no `Accept` header refuses.
|
|
4
|
+
*/
|
|
5
|
+
export function answersWithSchema(route) {
|
|
6
|
+
// A copy has a string index, which is how the statuses are enumerated.
|
|
7
|
+
const declared = { ...route.responses };
|
|
8
|
+
return Object.values(declared).some(({ body }) => body !== undefined);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=answers-with-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answers-with-schema.js","sourceRoot":"","sources":["../../src/route/answers-with-schema.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA+B;IAC/D,uEAAuE;IACvE,MAAM,QAAQ,GAA2C,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAEhF,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FormHints } from '../forms/form-hints.js';
|
|
1
2
|
import type { CachePolicy } from '../cache/cache-policy.js';
|
|
2
3
|
import type { IfMatch } from '../cache/if-match.js';
|
|
3
4
|
import type { HttpMethod } from './http-method.js';
|
|
@@ -26,6 +27,16 @@ export interface RouteSpec<Request extends RequestSchemas = RequestSchemas, Resp
|
|
|
26
27
|
*/
|
|
27
28
|
readonly security: readonly string[] | false;
|
|
28
29
|
readonly deprecated?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The media types the route answers in besides `application/json`, chosen per request by its
|
|
32
|
+
* `Accept` header among the representations of the platform: `['application/xml', 'text/csv']`.
|
|
33
|
+
* Each one is documented in the contract with the schema of the response.
|
|
34
|
+
*/
|
|
35
|
+
readonly produces?: readonly string[];
|
|
36
|
+
/** The media types the route reads a body in besides `application/json`: `['application/xml']`. */
|
|
37
|
+
readonly consumes?: readonly string[];
|
|
38
|
+
/** Describes the body of the route as a form, served by `formRoutes` at `GET /forms/<operationId>`: `{}` for the body as it is. */
|
|
39
|
+
readonly form?: FormHints;
|
|
29
40
|
/**
|
|
30
41
|
* How the caches on the way may keep the answer. Left out, a route that is not public answers
|
|
31
42
|
* `Cache-Control: no-store`, and a public one says nothing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-spec.d.ts","sourceRoot":"","sources":["../../src/route/route-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CA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AAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,mIAAmI;IACnI,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JsonSchema, Schema } from '@ddd-ts-kit/validation';
|
|
2
|
+
/**
|
|
3
|
+
* The JSON Schema of a schema, computed once: a route is answered many times, and some libraries
|
|
4
|
+
* rebuild the description of every class they know each time they are asked.
|
|
5
|
+
*/
|
|
6
|
+
export declare function jsonSchemaOf(schema: Schema<unknown>): JsonSchema;
|
|
7
|
+
//# sourceMappingURL=json-schema-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-of.d.ts","sourceRoot":"","sources":["../../src/schema/json-schema-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIjE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,UAAU,CAYhE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const described = new WeakMap();
|
|
2
|
+
/**
|
|
3
|
+
* The JSON Schema of a schema, computed once: a route is answered many times, and some libraries
|
|
4
|
+
* rebuild the description of every class they know each time they are asked.
|
|
5
|
+
*/
|
|
6
|
+
export function jsonSchemaOf(schema) {
|
|
7
|
+
const known = described.get(schema);
|
|
8
|
+
if (known !== undefined) {
|
|
9
|
+
return known;
|
|
10
|
+
}
|
|
11
|
+
const computed = schema.toJsonSchema();
|
|
12
|
+
described.set(schema, computed);
|
|
13
|
+
return computed;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=json-schema-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-of.js","sourceRoot":"","sources":["../../src/schema/json-schema-of.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,IAAI,OAAO,EAA+B,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEpC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IAEvC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEhC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { JsonSchema } from '@ddd-ts-kit/validation';
|
|
2
|
+
import type { SchemaType } from './schema-type.js';
|
|
3
|
+
import type { XmlHints } from './xml-hints.js';
|
|
4
|
+
/**
|
|
5
|
+
* One node of a JSON Schema, read with the definitions of the document it belongs to: what the
|
|
6
|
+
* representations and the forms ask of a response or a request schema, whatever library wrote it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SchemaNode {
|
|
9
|
+
readonly node: JsonSchema;
|
|
10
|
+
private readonly root;
|
|
11
|
+
private constructor();
|
|
12
|
+
static of(root: JsonSchema): SchemaNode;
|
|
13
|
+
/** The node a `$ref` points to, and the first alternative of `anyOf` or `oneOf` that is not `null`. */
|
|
14
|
+
resolved(hops?: number): SchemaNode;
|
|
15
|
+
type(): SchemaType | undefined;
|
|
16
|
+
isScalar(): boolean;
|
|
17
|
+
properties(): readonly (readonly [string, SchemaNode])[];
|
|
18
|
+
required(): readonly string[];
|
|
19
|
+
items(): SchemaNode;
|
|
20
|
+
xml(): XmlHints;
|
|
21
|
+
private child;
|
|
22
|
+
private step;
|
|
23
|
+
private definition;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=schema-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-node.d.ts","sourceRoot":"","sources":["../../src/schema/schema-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO/C;;;GAGG;AACH,qBAAa,UAAU;IAEnB,QAAQ,CAAC,IAAI,EAAE,UAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFvB,OAAO,eAGH;IAEJ,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAEtC;IAED,uGAAuG;IACvG,QAAQ,CAAC,IAAI,SAAI,GAAG,UAAU,CAI7B;IAED,IAAI,IAAI,UAAU,GAAG,SAAS,CAa7B;IAED,QAAQ,IAAI,OAAO,CAIlB;IAED,UAAU,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAAE,CAQvD;IAED,QAAQ,IAAI,SAAS,MAAM,EAAE,CAI5B;IAED,KAAK,IAAI,UAAU,CAElB;IAED,GAAG,IAAI,QAAQ,CAad;IAED,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,IAAI;IAoBZ,OAAO,CAAC,UAAU;CASnB"}
|