@wirebench/engine 2.2.1 → 3.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -1
- package/dist/account/schema.d.ts +34 -0
- package/dist/account/schema.js +29 -0
- package/dist/assert/callback.d.ts +76 -0
- package/dist/assert/callback.js +320 -0
- package/dist/assert/capture-source.d.ts +50 -0
- package/dist/assert/capture-source.js +89 -0
- package/dist/assert/check.d.ts +8 -0
- package/dist/assert/check.js +18 -0
- package/dist/assert/header.d.ts +5 -0
- package/dist/assert/header.js +48 -0
- package/dist/assert/index.d.ts +2 -2
- package/dist/assert/index.js +12 -0
- package/dist/assert/match.d.ts +6 -0
- package/dist/assert/match.js +13 -4
- package/dist/assert/model.d.ts +110 -3
- package/dist/assert/model.js +16 -1
- package/dist/assert/schema.d.ts +194 -1
- package/dist/assert/schema.js +154 -12
- package/dist/assert/status-names.d.ts +9 -0
- package/dist/assert/status-names.js +27 -0
- package/dist/assert/status.d.ts +4 -1
- package/dist/assert/status.js +27 -3
- package/dist/asyncapi/browser.d.ts +7 -0
- package/dist/asyncapi/browser.js +6 -0
- package/dist/asyncapi/frame-check-worker-host.d.ts +44 -0
- package/dist/asyncapi/frame-check-worker-host.js +175 -0
- package/dist/asyncapi/frame-check-worker.d.ts +12 -0
- package/dist/asyncapi/frame-check-worker.js +25 -0
- package/dist/asyncapi/frame-check.d.ts +25 -0
- package/dist/asyncapi/frame-check.js +78 -0
- package/dist/asyncapi/import.d.ts +25 -0
- package/dist/asyncapi/import.js +34 -0
- package/dist/asyncapi/map.d.ts +40 -0
- package/dist/asyncapi/map.js +230 -0
- package/dist/asyncapi/model.d.ts +84 -0
- package/dist/asyncapi/model.js +7 -0
- package/dist/asyncapi/normalise-2.d.ts +13 -0
- package/dist/asyncapi/normalise-2.js +113 -0
- package/dist/asyncapi/normalise-3.d.ts +14 -0
- package/dist/asyncapi/normalise-3.js +133 -0
- package/dist/asyncapi/parse.d.ts +31 -0
- package/dist/asyncapi/parse.js +85 -0
- package/dist/asyncapi/read.d.ts +35 -0
- package/dist/asyncapi/read.js +186 -0
- package/dist/asyncapi/security.d.ts +14 -0
- package/dist/asyncapi/security.js +55 -0
- package/dist/asyncapi/update.d.ts +53 -0
- package/dist/asyncapi/update.js +220 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.js +22 -0
- package/dist/grpc/events.d.ts +22 -0
- package/dist/grpc/events.js +1 -0
- package/dist/grpc/expand.d.ts +1 -1
- package/dist/grpc/expand.js +15 -5
- package/dist/grpc/files.d.ts +271 -0
- package/dist/grpc/files.js +62 -0
- package/dist/grpc/model.d.ts +11 -1
- package/dist/grpc/module.d.ts +2 -0
- package/dist/grpc/module.js +13 -0
- package/dist/grpc/run.d.ts +73 -0
- package/dist/grpc/run.js +407 -0
- package/dist/grpc/script-types.d.ts +8 -0
- package/dist/grpc/script-types.js +149 -0
- package/dist/grpc/scripting.d.ts +34 -0
- package/dist/grpc/scripting.js +147 -0
- package/dist/grpc/send-input.d.ts +46 -0
- package/dist/grpc/send-input.js +42 -0
- package/dist/grpc/send.d.ts +2 -2
- package/dist/grpc/status.d.ts +9 -2
- package/dist/grpc/status.js +11 -24
- package/dist/grpc/storage.d.ts +9 -0
- package/dist/grpc/storage.js +167 -0
- package/dist/{rest/auth.d.ts → http/auth/apply-auth.d.ts} +4 -4
- package/dist/{rest/auth.js → http/auth/apply-auth.js} +1 -1
- package/dist/http/auth/apply.d.ts +1 -1
- package/dist/{rest → http/auth}/oauth2.d.ts +2 -2
- package/dist/{rest → http/auth}/oauth2.js +1 -1
- package/dist/http/auth/send-auth.d.ts +57 -0
- package/dist/http/auth/send-auth.js +7 -0
- package/dist/http/client.js +150 -8
- package/dist/http/cookies.d.ts +79 -0
- package/dist/http/cookies.js +81 -0
- package/dist/http/curl.d.ts +4 -14
- package/dist/http/curl.js +4 -154
- package/dist/http/decompress.d.ts +7 -0
- package/dist/http/decompress.js +23 -1
- package/dist/http/document-fetch.d.ts +42 -0
- package/dist/http/document-fetch.js +207 -0
- package/dist/http/entries.d.ts +27 -0
- package/dist/http/entries.js +16 -0
- package/dist/http/escape.d.ts +18 -0
- package/dist/http/escape.js +30 -0
- package/dist/http/fetch-document.d.ts +28 -0
- package/dist/{wsdl/fetch.js → http/fetch-document.js} +8 -16
- package/dist/http/media-type.d.ts +9 -0
- package/dist/http/media-type.js +12 -0
- package/dist/http/transcript-cap.d.ts +26 -0
- package/dist/http/transcript-cap.js +36 -0
- package/dist/http/types.d.ts +59 -0
- package/dist/http/webhook-signature.d.ts +81 -0
- package/dist/http/webhook-signature.js +227 -0
- package/dist/import-detect.d.ts +2 -2
- package/dist/import-detect.js +10 -1
- package/dist/index.d.ts +207 -55
- package/dist/index.js +129 -32
- package/dist/json/cursor.d.ts +2 -0
- package/dist/json/cursor.js +1 -0
- package/dist/json/pointer-range.d.ts +18 -0
- package/dist/json/pointer-range.js +157 -0
- package/dist/json/schema/model.d.ts +59 -0
- package/dist/json/schema/model.js +8 -0
- package/dist/json/schema/parse-text.d.ts +16 -0
- package/dist/json/schema/parse-text.js +37 -0
- package/dist/{rest/openapi → json/schema}/refs.d.ts +2 -2
- package/dist/{rest/openapi → json/schema}/refs.js +3 -3
- package/dist/{rest/openapi → json/schema}/sample.d.ts +4 -0
- package/dist/{rest/openapi → json/schema}/sample.js +2 -2
- package/dist/json/schema/source.d.ts +21 -0
- package/dist/json/schema/source.js +8 -0
- package/dist/json/schema-validate.d.ts +49 -0
- package/dist/json/schema-validate.js +557 -0
- package/dist/{wss/keystore → keystore}/index.js +1 -1
- package/dist/{wss/keystore → keystore}/pem.js +1 -1
- package/dist/{wss/keystore → keystore}/pkcs12.js +1 -1
- package/dist/project/attachments-cache.d.ts +3 -1
- package/dist/{wsdl → project}/cache-naming.js +1 -1
- package/dist/project/endpoints.d.ts +18 -8
- package/dist/project/endpoints.js +21 -6
- package/dist/project/environments.d.ts +7 -5
- package/dist/project/history.d.ts +105 -9
- package/dist/project/history.js +195 -23
- package/dist/project/inherit.d.ts +7 -0
- package/dist/project/inherit.js +9 -0
- package/dist/project/keystores.d.ts +1 -1
- package/dist/project/load-helpers.d.ts +89 -0
- package/dist/project/load-helpers.js +177 -0
- package/dist/project/load.d.ts +30 -4
- package/dist/project/load.js +168 -545
- package/dist/project/managed-files.d.ts +36 -0
- package/dist/project/managed-files.js +97 -0
- package/dist/project/migrate.d.ts +2 -2
- package/dist/project/migrate.js +2 -2
- package/dist/project/model.d.ts +92 -14
- package/dist/project/model.js +50 -4
- package/dist/project/paths.d.ts +10 -1
- package/dist/project/paths.js +10 -1
- package/dist/project/preferences.d.ts +11 -2
- package/dist/project/preferences.js +5 -1
- package/dist/project/properties.d.ts +31 -17
- package/dist/project/properties.js +89 -70
- package/dist/project/request-location.d.ts +20 -0
- package/dist/project/request-location.js +62 -0
- package/dist/project/save.d.ts +12 -2
- package/dist/project/save.js +186 -141
- package/dist/project/schema-parts.d.ts +337 -0
- package/dist/project/schema-parts.js +248 -0
- package/dist/project/schema.d.ts +72 -928
- package/dist/project/schema.js +17 -466
- package/dist/project/sequence-guards.d.ts +43 -0
- package/dist/project/sequence-guards.js +109 -0
- package/dist/project/serialize-helpers.d.ts +60 -0
- package/dist/project/serialize-helpers.js +108 -0
- package/dist/project/serialize.d.ts +7 -8
- package/dist/project/serialize.js +34 -293
- package/dist/protocol/features.d.ts +51 -0
- package/dist/protocol/features.js +64 -0
- package/dist/protocol/index.d.ts +7 -0
- package/dist/protocol/index.js +4 -0
- package/dist/protocol/module.d.ts +247 -0
- package/dist/protocol/module.js +48 -0
- package/dist/protocol/registry.d.ts +42 -0
- package/dist/protocol/registry.js +47 -0
- package/dist/protocols.d.ts +77 -0
- package/dist/protocols.js +40 -0
- package/dist/redact/index.d.ts +12 -1
- package/dist/redact/index.js +55 -7
- package/dist/redact/literal.d.ts +10 -0
- package/dist/redact/literal.js +110 -12
- package/dist/rest/body.d.ts +2 -10
- package/dist/rest/body.js +3 -25
- package/dist/rest/browser.d.ts +4 -0
- package/dist/rest/browser.js +5 -0
- package/dist/rest/contract-check-worker-host.d.ts +36 -0
- package/dist/rest/contract-check-worker-host.js +158 -0
- package/dist/rest/contract-check-worker.d.ts +7 -0
- package/dist/rest/contract-check-worker.js +28 -0
- package/dist/rest/contract-check.d.ts +43 -0
- package/dist/rest/contract-check.js +217 -0
- package/dist/rest/cookie-jar.d.ts +62 -0
- package/dist/rest/cookie-jar.js +262 -0
- package/dist/rest/cookies.d.ts +6 -22
- package/dist/rest/cookies.js +6 -42
- package/dist/rest/curl.js +5 -1
- package/dist/rest/events.d.ts +12 -0
- package/dist/rest/events.js +1 -0
- package/dist/rest/expand.d.ts +6 -1
- package/dist/rest/expand.js +29 -11
- package/dist/rest/files.d.ts +439 -0
- package/dist/rest/files.js +107 -0
- package/dist/rest/json-form.d.ts +97 -0
- package/dist/rest/json-form.js +396 -0
- package/dist/rest/model.d.ts +35 -24
- package/dist/rest/model.js +6 -9
- package/dist/rest/module.d.ts +2 -0
- package/dist/rest/module.js +13 -0
- package/dist/rest/openapi/cache.d.ts +7 -2
- package/dist/rest/openapi/cache.js +2 -2
- package/dist/rest/openapi/import.d.ts +11 -16
- package/dist/rest/openapi/import.js +6 -2
- package/dist/rest/openapi/map.d.ts +38 -1
- package/dist/rest/openapi/map.js +151 -41
- package/dist/rest/openapi/match.d.ts +20 -0
- package/dist/rest/openapi/match.js +117 -0
- package/dist/rest/openapi/model.d.ts +33 -45
- package/dist/rest/openapi/parse.d.ts +3 -12
- package/dist/rest/openapi/parse.js +138 -67
- package/dist/rest/openapi/responses.d.ts +23 -0
- package/dist/rest/openapi/responses.js +59 -0
- package/dist/rest/openapi/runtime-expression.d.ts +69 -0
- package/dist/rest/openapi/runtime-expression.js +213 -0
- package/dist/rest/openapi/update.d.ts +116 -0
- package/dist/rest/openapi/update.js +456 -0
- package/dist/rest/postman/map.d.ts +1 -0
- package/dist/rest/postman/map.js +66 -4
- package/dist/rest/postman/model.d.ts +9 -0
- package/dist/rest/postman/parse.js +33 -10
- package/dist/rest/response.d.ts +2 -23
- package/dist/rest/response.js +3 -75
- package/dist/rest/run.d.ts +56 -0
- package/dist/rest/run.js +395 -0
- package/dist/rest/script-types.d.ts +7 -0
- package/dist/rest/script-types.js +83 -0
- package/dist/rest/scripting.d.ts +38 -0
- package/dist/rest/scripting.js +282 -0
- package/dist/rest/send-input.d.ts +54 -0
- package/dist/rest/send-input.js +73 -0
- package/dist/rest/send.d.ts +77 -4
- package/dist/rest/send.js +128 -7
- package/dist/rest/sse-transcript.d.ts +25 -0
- package/dist/rest/sse-transcript.js +95 -0
- package/dist/rest/sse.d.ts +43 -0
- package/dist/rest/sse.js +195 -0
- package/dist/rest/storage.d.ts +26 -0
- package/dist/rest/storage.js +262 -0
- package/dist/rest/url.d.ts +10 -4
- package/dist/rest/url.js +38 -5
- package/dist/run/baseline-update.d.ts +35 -0
- package/dist/run/baseline-update.js +97 -0
- package/dist/run/baseline.d.ts +42 -0
- package/dist/run/baseline.js +93 -0
- package/dist/run/context.d.ts +86 -0
- package/dist/run/context.js +31 -0
- package/dist/run/current-values.d.ts +32 -0
- package/dist/run/current-values.js +43 -0
- package/dist/run/event-queue.d.ts +14 -0
- package/dist/run/event-queue.js +46 -0
- package/dist/run/exchange.d.ts +62 -0
- package/dist/run/exchange.js +65 -0
- package/dist/run/host.d.ts +89 -0
- package/dist/run/host.js +1 -0
- package/dist/run/index.d.ts +20 -7
- package/dist/run/index.js +12 -4
- package/dist/run/oauth2-token.d.ts +42 -0
- package/dist/run/oauth2-token.js +92 -0
- package/dist/run/open.d.ts +12 -0
- package/dist/run/open.js +16 -0
- package/dist/run/run.d.ts +124 -4
- package/dist/run/run.js +293 -134
- package/dist/run/scope.d.ts +11 -0
- package/dist/run/scope.js +26 -0
- package/dist/run/script-support.d.ts +53 -0
- package/dist/run/script-support.js +68 -0
- package/dist/run/secret-needs.d.ts +11 -4
- package/dist/run/secret-needs.js +48 -96
- package/dist/run/select.d.ts +34 -25
- package/dist/run/select.js +45 -54
- package/dist/run/send-helpers.d.ts +93 -0
- package/dist/run/send-helpers.js +255 -0
- package/dist/run/tree.d.ts +50 -0
- package/dist/run/tree.js +54 -0
- package/dist/script/api/postman.d.ts +10 -0
- package/dist/script/api/postman.js +264 -0
- package/dist/script/api/prelude.d.ts +20 -0
- package/dist/script/api/prelude.js +215 -0
- package/dist/script/apply.d.ts +44 -0
- package/dist/script/apply.js +120 -0
- package/dist/script/check/host.d.ts +41 -0
- package/dist/script/check/host.js +143 -0
- package/dist/script/check/service.d.ts +52 -0
- package/dist/script/check/service.js +195 -0
- package/dist/script/check/worker.d.ts +1 -0
- package/dist/script/check/worker.js +40 -0
- package/dist/script/index.d.ts +16 -0
- package/dist/script/index.js +10 -0
- package/dist/script/lookup.d.ts +10 -0
- package/dist/script/lookup.js +23 -0
- package/dist/script/model.d.ts +82 -0
- package/dist/script/model.js +18 -0
- package/dist/script/props.d.ts +8 -0
- package/dist/script/props.js +28 -0
- package/dist/script/request-scripts.d.ts +83 -0
- package/dist/script/request-scripts.js +160 -0
- package/dist/script/run.d.ts +47 -0
- package/dist/script/run.js +146 -0
- package/dist/script/sandbox/execute.d.ts +26 -0
- package/dist/script/sandbox/execute.js +212 -0
- package/dist/script/sandbox/host-api.d.ts +27 -0
- package/dist/script/sandbox/host-api.js +101 -0
- package/dist/script/sandbox/host.d.ts +18 -0
- package/dist/script/sandbox/host.js +172 -0
- package/dist/script/sandbox/model.d.ts +69 -0
- package/dist/script/sandbox/model.js +24 -0
- package/dist/script/sandbox/worker.d.ts +1 -0
- package/dist/script/sandbox/worker.js +20 -0
- package/dist/script/send.d.ts +27 -0
- package/dist/script/send.js +76 -0
- package/dist/script/strip.d.ts +5 -0
- package/dist/script/strip.js +43 -0
- package/dist/script/types/api.d.ts +38 -0
- package/dist/script/types/api.js +113 -0
- package/dist/script/types/json-schema.d.ts +26 -0
- package/dist/script/types/json-schema.js +206 -0
- package/dist/secrets/env-names.d.ts +9 -1
- package/dist/secrets/env-names.js +17 -1
- package/dist/secrets/resolve.d.ts +44 -4
- package/dist/secrets/resolve.js +58 -1
- package/dist/secrets/scan/apply.d.ts +36 -0
- package/dist/secrets/scan/apply.js +194 -0
- package/dist/secrets/scan/rules.d.ts +32 -0
- package/dist/secrets/scan/rules.js +346 -0
- package/dist/secrets/scan/scan.d.ts +6 -0
- package/dist/secrets/scan/scan.js +57 -0
- package/dist/secrets/scan/walk.d.ts +70 -0
- package/dist/secrets/scan/walk.js +156 -0
- package/dist/secrets/secret-refs.d.ts +8 -0
- package/dist/secrets/secret-refs.js +25 -0
- package/dist/secrets/secret-token.d.ts +17 -0
- package/dist/secrets/secret-token.js +25 -0
- package/dist/sequence/file.d.ts +169 -0
- package/dist/sequence/file.js +237 -0
- package/dist/sequence/index.d.ts +7 -0
- package/dist/sequence/index.js +5 -0
- package/dist/sequence/load.d.ts +32 -0
- package/dist/sequence/load.js +56 -0
- package/dist/sequence/model.d.ts +115 -0
- package/dist/sequence/model.js +53 -0
- package/dist/sequence/run.d.ts +131 -0
- package/dist/sequence/run.js +191 -0
- package/dist/sequence/transfer.d.ts +24 -0
- package/dist/sequence/transfer.js +75 -0
- package/dist/server-api/audit.d.ts +455 -0
- package/dist/server-api/audit.js +186 -0
- package/dist/server-api/ci-tokens.d.ts +50 -0
- package/dist/server-api/ci-tokens.js +35 -0
- package/dist/server-api/hooks.d.ts +337 -0
- package/dist/server-api/hooks.js +152 -0
- package/dist/server-api/identity.d.ts +210 -0
- package/dist/server-api/identity.js +115 -0
- package/dist/server-api/licensing.d.ts +80 -0
- package/dist/server-api/licensing.js +53 -0
- package/dist/server-api/live.d.ts +132 -0
- package/dist/server-api/live.js +102 -0
- package/dist/server-api/meta.d.ts +31 -0
- package/dist/server-api/meta.js +21 -0
- package/dist/server-api/sync.d.ts +179 -0
- package/dist/server-api/sync.js +124 -0
- package/dist/server-api/teams.d.ts +306 -0
- package/dist/server-api/teams.js +113 -0
- package/dist/snapshot/diff.d.ts +30 -0
- package/dist/snapshot/diff.js +75 -0
- package/dist/snapshot/format.d.ts +17 -0
- package/dist/snapshot/format.js +40 -0
- package/dist/snapshot/golden-file.d.ts +45 -0
- package/dist/snapshot/golden-file.js +173 -0
- package/dist/snapshot/ignore.d.ts +14 -0
- package/dist/snapshot/ignore.js +79 -0
- package/dist/snapshot/index.d.ts +9 -0
- package/dist/snapshot/index.js +9 -0
- package/dist/snapshot/json-diff.d.ts +3 -0
- package/dist/snapshot/json-diff.js +93 -0
- package/dist/snapshot/xml-diff.d.ts +10 -0
- package/dist/snapshot/xml-diff.js +194 -0
- package/dist/soap/auth.d.ts +26 -0
- package/dist/soap/auth.js +54 -0
- package/dist/soap/curl.d.ts +20 -0
- package/dist/soap/curl.js +161 -0
- package/dist/soap/expand.d.ts +24 -0
- package/dist/soap/expand.js +95 -0
- package/dist/soap/files.d.ts +384 -0
- package/dist/soap/files.js +114 -0
- package/dist/soap/form-request.d.ts +13 -0
- package/dist/soap/form-request.js +2 -2
- package/dist/soap/generate.d.ts +12 -0
- package/dist/{generate.js → soap/generate.js} +4 -4
- package/dist/{import.d.ts → soap/import.d.ts} +4 -4
- package/dist/{import.js → soap/import.js} +13 -13
- package/dist/soap/json-operation.d.ts +35 -0
- package/dist/soap/json-operation.js +225 -0
- package/dist/soap/legacy-project/env-refs.d.ts +19 -0
- package/dist/soap/legacy-project/env-refs.js +105 -0
- package/dist/soap/legacy-project/map.d.ts +2 -2
- package/dist/soap/legacy-project/map.js +6 -0
- package/dist/soap/mime/multipart.d.ts +2 -2
- package/dist/soap/mime/multipart.js +2 -5
- package/dist/soap/mime/send-pipeline.d.ts +1 -1
- package/dist/soap/mime/send-pipeline.js +1 -1
- package/dist/soap/mime/types.d.ts +1 -3
- package/dist/soap/module.d.ts +2 -0
- package/dist/soap/module.js +13 -0
- package/dist/soap/namespace-scope.js +1 -1
- package/dist/soap/operations.d.ts +12 -0
- package/dist/{operations.js → soap/operations.js} +4 -4
- package/dist/soap/run.d.ts +70 -0
- package/dist/soap/run.js +549 -0
- package/dist/soap/script-types.d.ts +65 -0
- package/dist/soap/script-types.js +379 -0
- package/dist/soap/scripting.d.ts +45 -0
- package/dist/soap/scripting.js +221 -0
- package/dist/soap/send-input.d.ts +61 -0
- package/dist/{send-options.js → soap/send-input.js} +5 -109
- package/dist/{send.d.ts → soap/send.d.ts} +1 -1
- package/dist/{send.js → soap/send.js} +28 -12
- package/dist/soap/storage.d.ts +9 -0
- package/dist/soap/storage.js +237 -0
- package/dist/soap/transforms.d.ts +3 -12
- package/dist/soap/transforms.js +3 -14
- package/dist/{types.d.ts → soap/types.d.ts} +34 -84
- package/dist/sync/git-cli.d.ts +202 -0
- package/dist/sync/git-cli.js +684 -0
- package/dist/sync/three-way-merge.d.ts +41 -0
- package/dist/sync/three-way-merge.js +85 -0
- package/dist/sync/tree-paths.d.ts +34 -0
- package/dist/sync/tree-paths.js +131 -0
- package/dist/team-secrets/envelope.d.ts +10 -0
- package/dist/team-secrets/envelope.js +121 -0
- package/dist/team-secrets/errors.d.ts +26 -0
- package/dist/team-secrets/errors.js +27 -0
- package/dist/team-secrets/index.d.ts +14 -0
- package/dist/team-secrets/index.js +8 -0
- package/dist/team-secrets/keys.d.ts +52 -0
- package/dist/team-secrets/keys.js +158 -0
- package/dist/team-secrets/log.d.ts +48 -0
- package/dist/team-secrets/log.js +175 -0
- package/dist/team-secrets/resolve-conflict.d.ts +7 -0
- package/dist/team-secrets/resolve-conflict.js +14 -0
- package/dist/team-secrets/schema.d.ts +97 -0
- package/dist/team-secrets/schema.js +157 -0
- package/dist/team-secrets/sign.d.ts +24 -0
- package/dist/team-secrets/sign.js +71 -0
- package/dist/team-secrets/vault.d.ts +49 -0
- package/dist/team-secrets/vault.js +148 -0
- package/dist/validate/wsi/run-message.d.ts +2 -2
- package/dist/validate/wsi/run-message.js +1 -1
- package/dist/validate/wsi/run-wsdl.d.ts +2 -2
- package/dist/validate/wsi/run-wsdl.js +1 -1
- package/dist/validate/wsi/types.d.ts +1 -1
- package/dist/webhooks/model.d.ts +138 -0
- package/dist/webhooks/model.js +150 -0
- package/dist/workspace/commit-message.d.ts +1 -1
- package/dist/workspace/commit-message.js +6 -1
- package/dist/workspace/environments.d.ts +11 -4
- package/dist/workspace/environments.js +12 -0
- package/dist/workspace/index.d.ts +3 -3
- package/dist/workspace/index.js +2 -2
- package/dist/workspace/paths.d.ts +5 -2
- package/dist/workspace/paths.js +5 -2
- package/dist/workspace/schema.d.ts +7 -3
- package/dist/workspace/schema.js +24 -3
- package/dist/workspace/share.d.ts +30 -11
- package/dist/workspace/share.js +32 -6
- package/dist/ws/call.d.ts +1 -1
- package/dist/ws/call.js +2 -2
- package/dist/ws/connect.d.ts +60 -0
- package/dist/ws/connect.js +131 -0
- package/dist/ws/events.d.ts +17 -0
- package/dist/ws/events.js +1 -0
- package/dist/ws/expand.d.ts +1 -1
- package/dist/ws/expand.js +1 -1
- package/dist/ws/files.d.ts +284 -0
- package/dist/ws/files.js +71 -0
- package/dist/ws/history-entry.d.ts +44 -0
- package/dist/ws/history-entry.js +93 -0
- package/dist/ws/model.d.ts +44 -3
- package/dist/ws/model.js +3 -0
- package/dist/ws/module.d.ts +2 -0
- package/dist/ws/module.js +11 -0
- package/dist/ws/run.d.ts +63 -0
- package/dist/ws/run.js +470 -0
- package/dist/ws/session.d.ts +18 -0
- package/dist/ws/session.js +52 -25
- package/dist/ws/storage.d.ts +9 -0
- package/dist/ws/storage.js +176 -0
- package/dist/ws/transcript.d.ts +3 -4
- package/dist/ws/transcript.js +26 -17
- package/dist/ws/url.d.ts +1 -1
- package/dist/wsdl/cache.js +1 -1
- package/dist/wsdl/docs-generator.d.ts +3 -3
- package/dist/wsdl/docs-generator.js +1 -1
- package/dist/wsdl/export-definition.js +1 -1
- package/dist/wsdl/qname.d.ts +2 -5
- package/dist/wsdl/resolver.d.ts +4 -11
- package/dist/wsdl/resolver.js +3 -3
- package/dist/wsdl/update-definition.d.ts +5 -5
- package/dist/wsdl/update-definition.js +6 -6
- package/dist/wss/apply.js +1 -1
- package/dist/{project/wss-configs.d.ts → wss/configs.d.ts} +2 -2
- package/dist/{project/wss-configs.js → wss/configs.js} +2 -2
- package/dist/wss/incoming/decrypt.d.ts +1 -1
- package/dist/wss/incoming/index.js +1 -1
- package/dist/wss/incoming/verify.d.ts +1 -1
- package/dist/wss/incoming/verify.js +1 -1
- package/dist/wss/key-identifiers.js +1 -1
- package/dist/wss/model.d.ts +1 -1
- package/dist/wss/outgoing/encryption.d.ts +1 -1
- package/dist/wss/outgoing/signature.d.ts +1 -1
- package/dist/xml/decode.d.ts +15 -0
- package/dist/xml/decode.js +22 -0
- package/dist/xml/entitize.d.ts +17 -0
- package/dist/xml/entitize.js +19 -0
- package/dist/xml/index.d.ts +1 -1
- package/dist/xml/index.js +1 -1
- package/dist/xml/locate.d.ts +39 -0
- package/dist/xml/locate.js +117 -0
- package/dist/xml/qname.d.ts +12 -0
- package/dist/xml/qname.js +8 -0
- package/dist/xpath/evaluate-async.d.ts +19 -0
- package/dist/xpath/evaluate-async.js +31 -11
- package/dist/xpath/evaluate.d.ts +1 -1
- package/dist/xpath/namespaces.js +1 -1
- package/dist/xpath/worker.d.ts +11 -5
- package/dist/xpath/worker.js +24 -7
- package/dist/xsd/form-model.d.ts +19 -2
- package/dist/xsd/form-model.js +14 -2
- package/dist/xsd/json-bridge.d.ts +152 -0
- package/dist/xsd/json-bridge.js +1213 -0
- package/dist/xsd/locate.d.ts +2 -30
- package/dist/xsd/locate.js +1 -109
- package/dist/xsd/xml-scan.d.ts +2 -0
- package/dist/xsd/xml-scan.js +1 -1
- package/dist/xsd/xml-writer.d.ts +2 -0
- package/dist/xsd/xml-writer.js +4 -0
- package/package.json +12 -1
- package/dist/generate.d.ts +0 -12
- package/dist/operations.d.ts +0 -12
- package/dist/run/effective-auth.d.ts +0 -10
- package/dist/run/effective-auth.js +0 -19
- package/dist/run/prepare.d.ts +0 -43
- package/dist/run/prepare.js +0 -280
- package/dist/send-options.d.ts +0 -141
- package/dist/wsdl/fetch.d.ts +0 -13
- /package/dist/{soap → http}/charset.d.ts +0 -0
- /package/dist/{soap → http}/charset.js +0 -0
- /package/dist/{wsdl → http}/ref-policy.d.ts +0 -0
- /package/dist/{wsdl → http}/ref-policy.js +0 -0
- /package/dist/{wss/keystore → keystore}/certificate.d.ts +0 -0
- /package/dist/{wss/keystore → keystore}/certificate.js +0 -0
- /package/dist/{wss/keystore → keystore}/index.d.ts +0 -0
- /package/dist/{wss/keystore → keystore}/model.d.ts +0 -0
- /package/dist/{wss/keystore → keystore}/model.js +0 -0
- /package/dist/{wss/keystore → keystore}/pem.d.ts +0 -0
- /package/dist/{wss/keystore → keystore}/pkcs12.d.ts +0 -0
- /package/dist/{wsdl → project}/cache-naming.d.ts +0 -0
- /package/dist/{types.js → soap/types.js} +0 -0
- /package/dist/{soap → xml}/prefixes.d.ts +0 -0
- /package/dist/{soap → xml}/prefixes.js +0 -0
package/dist/http/curl.js
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* {@link toCurl} describes a request in `curl`'s own terms — a method, a URL, headers and one of the
|
|
6
6
|
* body shapes `curl` has a flag for — and knows nothing about SOAP or REST. Each protocol builds that
|
|
7
|
-
* description from its own send input (
|
|
7
|
+
* description from its own send input (`soapToCurl` in `soap/curl.ts`, `restToCurl` in `rest/curl.ts`), so the
|
|
8
8
|
* quoting, the line continuations and the two shells have one implementation rather than two.
|
|
9
9
|
*/
|
|
10
|
-
import { soapActionHeaders } from '../soap/soap-action.js';
|
|
11
|
-
import { findHeredoc, findHereString } from './heredoc.js';
|
|
12
|
-
import { expandBundles, takesNoValue } from './curl-flags.js';
|
|
13
10
|
/** Escapes a value for a POSIX single-quoted shell string. */
|
|
14
11
|
function posixQuote(value) {
|
|
15
12
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
@@ -52,6 +49,9 @@ export function toCurl(command, options = {}) {
|
|
|
52
49
|
if (command.insecure === true) {
|
|
53
50
|
args.push('--insecure');
|
|
54
51
|
}
|
|
52
|
+
if (command.noBuffer === true) {
|
|
53
|
+
args.push('-N');
|
|
54
|
+
}
|
|
55
55
|
if (command.followRedirects === true) {
|
|
56
56
|
args.push('--location');
|
|
57
57
|
if (command.maxRedirects !== undefined) {
|
|
@@ -93,153 +93,3 @@ export function toCurl(command, options = {}) {
|
|
|
93
93
|
}
|
|
94
94
|
return lines.join('\n');
|
|
95
95
|
}
|
|
96
|
-
/** Builds a `curl` command reproducing a SOAP send — headers, envelope and all. */
|
|
97
|
-
export function soapToCurl(input, options = {}) {
|
|
98
|
-
const actionHeaders = soapActionHeaders(input.soapVersion, input.soapAction, input.skipSoapAction !== undefined ? { skipSoapAction: input.skipSoapAction } : {});
|
|
99
|
-
const contentType = input.contentType ?? input.headers?.['Content-Type'] ?? actionHeaders.contentType;
|
|
100
|
-
const headers = [{ name: 'Content-Type', value: contentType }];
|
|
101
|
-
if (input.soapVersion === '1.1' && input.headers?.['SOAPAction'] === undefined) {
|
|
102
|
-
headers.push({ name: 'SOAPAction', value: `"${input.soapAction ?? ''}"` });
|
|
103
|
-
}
|
|
104
|
-
for (const [name, value] of Object.entries(input.headers ?? {})) {
|
|
105
|
-
if (name === 'Content-Type')
|
|
106
|
-
continue;
|
|
107
|
-
headers.push({ name, value });
|
|
108
|
-
}
|
|
109
|
-
return toCurl({ method: 'POST', url: input.endpoint, headers, body: { kind: 'raw', text: input.envelopeXml } }, options);
|
|
110
|
-
}
|
|
111
|
-
/** Splits a command line into tokens, respecting single/double quoted spans (no `$'…'` support). */
|
|
112
|
-
function tokenize(text) {
|
|
113
|
-
const tokens = [];
|
|
114
|
-
let i = 0;
|
|
115
|
-
const len = text.length;
|
|
116
|
-
while (i < len) {
|
|
117
|
-
while (i < len && /\s/.test(text[i]))
|
|
118
|
-
i += 1;
|
|
119
|
-
if (i >= len)
|
|
120
|
-
break;
|
|
121
|
-
let token = '';
|
|
122
|
-
while (i < len && !/\s/.test(text[i])) {
|
|
123
|
-
const ch = text[i];
|
|
124
|
-
if (ch === "'" || ch === '"') {
|
|
125
|
-
const quote = ch;
|
|
126
|
-
i += 1;
|
|
127
|
-
const start = i;
|
|
128
|
-
while (i < len && text[i] !== quote)
|
|
129
|
-
i += 1;
|
|
130
|
-
token += text.slice(start, i);
|
|
131
|
-
i += 1;
|
|
132
|
-
}
|
|
133
|
-
else if (ch === '\\' && i + 1 < len) {
|
|
134
|
-
token += text[i + 1];
|
|
135
|
-
i += 2;
|
|
136
|
-
}
|
|
137
|
-
else if (ch === '`' || (ch === '\\' && text[i + 1] === '\n')) {
|
|
138
|
-
// line continuation markers; skip
|
|
139
|
-
i += 1;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
token += ch;
|
|
143
|
-
i += 1;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (token.length > 0)
|
|
147
|
-
tokens.push(token);
|
|
148
|
-
}
|
|
149
|
-
return tokens;
|
|
150
|
-
}
|
|
151
|
-
/** Parses a pasted `curl` command back into a partial {@link SoapSendInput}. */
|
|
152
|
-
export function fromCurl(text) {
|
|
153
|
-
const problems = [];
|
|
154
|
-
// Pull out a heredoc/here-string body (`<<'EOF' ... EOF` or `@'...'@`) before line-splicing and
|
|
155
|
-
// tokenizing the rest — its content is verbatim and may contain anything, including newlines.
|
|
156
|
-
let heredocData;
|
|
157
|
-
let withoutHeredoc = text;
|
|
158
|
-
const embedded = findHeredoc(text) ?? findHereString(text);
|
|
159
|
-
if (embedded !== undefined) {
|
|
160
|
-
heredocData = embedded.body;
|
|
161
|
-
withoutHeredoc = text.slice(0, embedded.start) + text.slice(embedded.end);
|
|
162
|
-
}
|
|
163
|
-
const normalized = withoutHeredoc
|
|
164
|
-
.replace(/\\\r?\n/g, ' ')
|
|
165
|
-
.replace(/`\r?\n/g, ' ')
|
|
166
|
-
.trim();
|
|
167
|
-
const tokens = expandBundles(tokenize(normalized));
|
|
168
|
-
let endpoint;
|
|
169
|
-
let envelopeXml;
|
|
170
|
-
const headers = {};
|
|
171
|
-
let i = 0;
|
|
172
|
-
if (tokens[0] === 'curl' || tokens[0] === 'curl.exe')
|
|
173
|
-
i += 1;
|
|
174
|
-
while (i < tokens.length) {
|
|
175
|
-
const tok = tokens[i];
|
|
176
|
-
if (tok === '-X' || tok === '--request') {
|
|
177
|
-
i += 2;
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
if (tok === '-H' || tok === '--header') {
|
|
181
|
-
const header = tokens[i + 1] ?? '';
|
|
182
|
-
const colon = header.indexOf(':');
|
|
183
|
-
if (colon !== -1) {
|
|
184
|
-
const key = header.slice(0, colon).trim();
|
|
185
|
-
const value = header.slice(colon + 1).trim();
|
|
186
|
-
headers[key] = value;
|
|
187
|
-
}
|
|
188
|
-
i += 2;
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
if (tok === '-d' || tok === '--data' || tok === '--data-binary' || tok === '--data-raw') {
|
|
192
|
-
const data = tokens[i + 1] ?? '';
|
|
193
|
-
if ((data === '@-' || data === '') && heredocData !== undefined) {
|
|
194
|
-
envelopeXml = heredocData;
|
|
195
|
-
}
|
|
196
|
-
else if (data.startsWith('@')) {
|
|
197
|
-
problems.push('data-from-file-unsupported');
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
envelopeXml = data;
|
|
201
|
-
}
|
|
202
|
-
i += 2;
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
if (tok === '--url') {
|
|
206
|
-
endpoint = tokens[i + 1];
|
|
207
|
-
i += 2;
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
if (tok === '-u' || tok === '--user') {
|
|
211
|
-
problems.push('basic-auth-ignored');
|
|
212
|
-
i += 2;
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
if (tok.startsWith('-')) {
|
|
216
|
-
// A flag with no field here: skip its value too, unless it is one that takes none.
|
|
217
|
-
problems.push(`ignored-flag:${tok}`);
|
|
218
|
-
i += takesNoValue(tok) ? 1 : 2;
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
// bare token: the URL
|
|
222
|
-
if (endpoint === undefined) {
|
|
223
|
-
endpoint = tok;
|
|
224
|
-
}
|
|
225
|
-
i += 1;
|
|
226
|
-
}
|
|
227
|
-
const soapActionHeader = headers['SOAPAction'];
|
|
228
|
-
let soapAction;
|
|
229
|
-
if (soapActionHeader !== undefined) {
|
|
230
|
-
soapAction = soapActionHeader.replace(/^"|"$/g, '');
|
|
231
|
-
}
|
|
232
|
-
const contentType = headers['Content-Type'];
|
|
233
|
-
const soapVersion = contentType?.includes('application/soap+xml') === true ? '1.2' : '1.1';
|
|
234
|
-
const extraHeaders = { ...headers };
|
|
235
|
-
delete extraHeaders['SOAPAction'];
|
|
236
|
-
delete extraHeaders['Content-Type'];
|
|
237
|
-
const input = {
|
|
238
|
-
...(endpoint !== undefined ? { endpoint } : {}),
|
|
239
|
-
...(envelopeXml !== undefined ? { envelopeXml } : {}),
|
|
240
|
-
soapVersion,
|
|
241
|
-
...(soapAction !== undefined ? { soapAction } : {}),
|
|
242
|
-
...(Object.keys(extraHeaders).length > 0 ? { headers: extraHeaders } : {}),
|
|
243
|
-
};
|
|
244
|
-
return { input, problems };
|
|
245
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Transform } from 'node:stream';
|
|
1
2
|
/**
|
|
2
3
|
* Decompresses `data` according to the response's `content-encoding` header
|
|
3
4
|
* (`gzip`, `x-gzip`, `deflate`, or `br`). Returns `data` unchanged for any
|
|
@@ -5,3 +6,9 @@
|
|
|
5
6
|
* to the caller.
|
|
6
7
|
*/
|
|
7
8
|
export declare function decompressBody(data: Uint8Array, contentEncoding: string | undefined): Promise<Uint8Array>;
|
|
9
|
+
/**
|
|
10
|
+
* An incremental decoder for a streamed body with the given `content-encoding`, or `undefined` when
|
|
11
|
+
* the encoding needs none. Sync-flushes, so each chunk's decoded bytes come out as soon as they can
|
|
12
|
+
* rather than waiting for more input, and a stream cut short still yields what it decoded.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createDecompressStream(contentEncoding: string | undefined): Transform | undefined;
|
package/dist/http/decompress.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { brotliDecompress, gunzip, inflate } from 'node:zlib';
|
|
1
|
+
import { brotliDecompress, constants, createBrotliDecompress, createGunzip, createInflate, gunzip, inflate, } from 'node:zlib';
|
|
2
2
|
/**
|
|
3
3
|
* Decompresses `data` according to the response's `content-encoding` header
|
|
4
4
|
* (`gzip`, `x-gzip`, `deflate`, or `br`). Returns `data` unchanged for any
|
|
@@ -20,3 +20,25 @@ export async function decompressBody(data, contentEncoding) {
|
|
|
20
20
|
return data;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* An incremental decoder for a streamed body with the given `content-encoding`, or `undefined` when
|
|
25
|
+
* the encoding needs none. Sync-flushes, so each chunk's decoded bytes come out as soon as they can
|
|
26
|
+
* rather than waiting for more input, and a stream cut short still yields what it decoded.
|
|
27
|
+
*/
|
|
28
|
+
export function createDecompressStream(contentEncoding) {
|
|
29
|
+
const zlibFlush = { flush: constants.Z_SYNC_FLUSH, finishFlush: constants.Z_SYNC_FLUSH };
|
|
30
|
+
switch (contentEncoding?.trim().toLowerCase()) {
|
|
31
|
+
case 'gzip':
|
|
32
|
+
case 'x-gzip':
|
|
33
|
+
return createGunzip(zlibFlush);
|
|
34
|
+
case 'deflate':
|
|
35
|
+
return createInflate(zlibFlush);
|
|
36
|
+
case 'br':
|
|
37
|
+
return createBrotliDecompress({
|
|
38
|
+
flush: constants.BROTLI_OPERATION_FLUSH,
|
|
39
|
+
finishFlush: constants.BROTLI_OPERATION_FLUSH,
|
|
40
|
+
});
|
|
41
|
+
default:
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fetcher every OpenAPI and AsyncAPI read goes through.
|
|
3
|
+
*
|
|
4
|
+
* It sends through the engine's own HTTP client rather than the global `fetch`, so the proxy and CA
|
|
5
|
+
* bundle the host resolves apply to a definition as they do to a request. It follows redirects
|
|
6
|
+
* itself: `sendHttp` scopes only the three standard credential headers to an origin, and a
|
|
7
|
+
* definition's credentials may also be a custom API-key header or a query key. On every hop, and for
|
|
8
|
+
* every `$ref` document, credentials go only to the origin of the document the user named.
|
|
9
|
+
*/
|
|
10
|
+
import type { SendAuth } from './auth/send-auth.js';
|
|
11
|
+
import type { FetchDocument } from './fetch-document.js';
|
|
12
|
+
import type { ProxyOptions, TlsOptions } from './types.js';
|
|
13
|
+
/** How {@link createHttpFetchDocument} reaches the network, and with what credentials. */
|
|
14
|
+
export interface DocumentFetchOptions {
|
|
15
|
+
/** Resolved credentials: values, not references. Sent only to `authOrigin`. */
|
|
16
|
+
readonly auth?: SendAuth;
|
|
17
|
+
/**
|
|
18
|
+
* Origin of the document the user named; absent means no auth is ever attached. Normalised as a URL
|
|
19
|
+
* origin (a trailing slash, the host's case and a default port do not matter); it must be `http(s)`.
|
|
20
|
+
*/
|
|
21
|
+
readonly authOrigin?: string;
|
|
22
|
+
/** TLS and proxy for one URL, as the host resolves them. */
|
|
23
|
+
readonly network?: (url: string) => Promise<{
|
|
24
|
+
readonly tls?: TlsOptions;
|
|
25
|
+
readonly proxy?: ProxyOptions;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates the {@link FetchDocument} for OpenAPI and AsyncAPI reads: `file:` (and any other non-HTTP
|
|
30
|
+
* location) as {@link createDefaultFetchDocument} reads it, and `http(s):` through `sendHttp` with
|
|
31
|
+
* the host's TLS and proxy, following up to 10 redirects, with `options.auth` sent only to
|
|
32
|
+
* `options.authOrigin`.
|
|
33
|
+
*
|
|
34
|
+
* The returned `location` never carries a query key this fetcher added, so `$ref` resolution,
|
|
35
|
+
* progress messages, errors and a recorded source never do either.
|
|
36
|
+
*
|
|
37
|
+
* @throws HttpError `definition-auth-required` for a 401 or 403 (`details.authSent` says whether
|
|
38
|
+
* credentials went with it), `fetch-failed` for any other non-2xx or a redirect off `http(s)`,
|
|
39
|
+
* `too-many-redirects`, or a transport error from `sendHttp` (without `details.request`)
|
|
40
|
+
* @throws HttpError `invalid-url`, at once, when `options.authOrigin` is not an `http(s)` URL
|
|
41
|
+
*/
|
|
42
|
+
export declare function createHttpFetchDocument(options?: DocumentFetchOptions): FetchDocument;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fetcher every OpenAPI and AsyncAPI read goes through.
|
|
3
|
+
*
|
|
4
|
+
* It sends through the engine's own HTTP client rather than the global `fetch`, so the proxy and CA
|
|
5
|
+
* bundle the host resolves apply to a definition as they do to a request. It follows redirects
|
|
6
|
+
* itself: `sendHttp` scopes only the three standard credential headers to an origin, and a
|
|
7
|
+
* definition's credentials may also be a custom API-key header or a query key. On every hop, and for
|
|
8
|
+
* every `$ref` document, credentials go only to the origin of the document the user named.
|
|
9
|
+
*/
|
|
10
|
+
import { HttpError, WirebenchError } from '../errors.js';
|
|
11
|
+
import { redactUrl } from '../redact/index.js';
|
|
12
|
+
import { applyAuth } from './auth/apply-auth.js';
|
|
13
|
+
import { decodeXmlBytes } from '../xml/decode.js';
|
|
14
|
+
import { createDefaultFetchDocument } from './fetch-document.js';
|
|
15
|
+
import { basicAuthorization } from './auth/basic.js';
|
|
16
|
+
import { sendHttp } from './client.js';
|
|
17
|
+
const TIMEOUT_MS = 20_000;
|
|
18
|
+
const USER_AGENT = 'wirebench/0.1';
|
|
19
|
+
const MAX_REDIRECTS = 10;
|
|
20
|
+
/** A definition is JSON or YAML; anything else is still read, at a lower preference. */
|
|
21
|
+
const ACCEPT = 'application/json, application/yaml, text/yaml, */*;q=0.8';
|
|
22
|
+
const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
|
|
23
|
+
const WEB_PROTOCOLS = new Set(['http:', 'https:']);
|
|
24
|
+
/** `url` without the query parameter `name`; `url` itself, unparsed and unchanged, when it has none. */
|
|
25
|
+
function withoutParam(url, name) {
|
|
26
|
+
const parsed = new URL(url);
|
|
27
|
+
if (!parsed.searchParams.has(name)) {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
parsed.searchParams.delete(name);
|
|
31
|
+
return parsed.toString();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `authOrigin` as `URL.origin` writes it, so it compares equal to a hop's origin however the caller
|
|
35
|
+
* spelled it.
|
|
36
|
+
*
|
|
37
|
+
* @throws HttpError `invalid-url` when it is not an `http(s)` URL: an opaque origin (`null`, from
|
|
38
|
+
* `file:` or `data:`) must never match anything
|
|
39
|
+
*/
|
|
40
|
+
function normaliseAuthOrigin(authOrigin) {
|
|
41
|
+
let parsed;
|
|
42
|
+
try {
|
|
43
|
+
parsed = new URL(authOrigin);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
throw new HttpError('invalid-url', `The origin credentials go to is not a URL: ${authOrigin}`, {
|
|
47
|
+
details: { authOrigin },
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!WEB_PROTOCOLS.has(parsed.protocol)) {
|
|
51
|
+
throw new HttpError('invalid-url', `The origin credentials go to is not http(s): ${authOrigin}`, {
|
|
52
|
+
details: { authOrigin },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return parsed.origin;
|
|
56
|
+
}
|
|
57
|
+
/** What one hop sends: its URL (with a query key, on the auth origin) and its credential headers. */
|
|
58
|
+
function credentialsFor(url, options) {
|
|
59
|
+
const { auth, authOrigin } = options;
|
|
60
|
+
if (auth === undefined || authOrigin === undefined) {
|
|
61
|
+
return { url, headers: {} };
|
|
62
|
+
}
|
|
63
|
+
const hop = new URL(url);
|
|
64
|
+
if (!WEB_PROTOCOLS.has(hop.protocol) || hop.origin !== authOrigin) {
|
|
65
|
+
return { url, headers: {} };
|
|
66
|
+
}
|
|
67
|
+
if (auth.type === 'basic') {
|
|
68
|
+
// Always preemptive: a definition endpoint that answers 401 is refused, not challenged through.
|
|
69
|
+
return { url, headers: { Authorization: basicAuthorization(auth.username, auth.password) } };
|
|
70
|
+
}
|
|
71
|
+
if (auth.type === 'api-key' && auth.in === 'query') {
|
|
72
|
+
const keyed = new URL(url);
|
|
73
|
+
keyed.searchParams.append(auth.name, auth.value);
|
|
74
|
+
return { url: keyed.toString(), headers: {} };
|
|
75
|
+
}
|
|
76
|
+
return { url, headers: applyAuth(auth).headers };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A transport failure from `sendHttp`, told without the credentials this hop carried.
|
|
80
|
+
*
|
|
81
|
+
* `details.request` always goes: it records the headers as sent, `Authorization` or an API-key header
|
|
82
|
+
* included. Every other detail stays, and `details.location` names the hop without a query key. When
|
|
83
|
+
* the hop carried a query key (`sent` differs from `bare`), the URL in the message is masked, any
|
|
84
|
+
* detail that repeats it is replaced by `bare`, and the `cause` goes too, since its text may hold it.
|
|
85
|
+
*/
|
|
86
|
+
function sanitisedFailure(error, sent, bare, keyName) {
|
|
87
|
+
if (!(error instanceof WirebenchError)) {
|
|
88
|
+
return error;
|
|
89
|
+
}
|
|
90
|
+
const keyed = keyName !== undefined && sent !== bare;
|
|
91
|
+
const details = {};
|
|
92
|
+
for (const [name, value] of Object.entries(error.details ?? {})) {
|
|
93
|
+
if (name !== 'request') {
|
|
94
|
+
details[name] = keyed && value === sent ? bare : value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
details['location'] = bare;
|
|
98
|
+
const message = keyed ? error.message.split(sent).join(redactUrl(sent, { extraParams: [keyName] })) : error.message;
|
|
99
|
+
const rebuilt = new HttpError(error.code, message, {
|
|
100
|
+
details,
|
|
101
|
+
...(!keyed && error.cause !== undefined ? { cause: error.cause } : {}),
|
|
102
|
+
});
|
|
103
|
+
if (!keyed && error.stack !== undefined) {
|
|
104
|
+
rebuilt.stack = error.stack;
|
|
105
|
+
}
|
|
106
|
+
return rebuilt;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Where a redirect from `bare` to `target` leads.
|
|
110
|
+
*
|
|
111
|
+
* @throws HttpError `fetch-failed` when `target` is not a URL or not `http(s)`: a server must not
|
|
112
|
+
* steer a definition read onto the local disk or anywhere else outside the web
|
|
113
|
+
*/
|
|
114
|
+
function redirectTarget(target, bare, status) {
|
|
115
|
+
let next;
|
|
116
|
+
try {
|
|
117
|
+
next = new URL(target, bare);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
throw new HttpError('fetch-failed', `GET ${bare} redirected to a location that is not a URL`, {
|
|
121
|
+
details: { location: bare, status },
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (!WEB_PROTOCOLS.has(next.protocol)) {
|
|
125
|
+
throw new HttpError('fetch-failed', `GET ${bare} redirected to a ${next.protocol} location; a definition read follows http(s) redirects only`, { details: { location: bare, status } });
|
|
126
|
+
}
|
|
127
|
+
return next.toString();
|
|
128
|
+
}
|
|
129
|
+
async function fetchHttp(location, signal, options) {
|
|
130
|
+
const keyName = options.auth?.type === 'api-key' && options.auth.in === 'query' ? options.auth.name : undefined;
|
|
131
|
+
// `bare` is the hop's URL as the resolver may see it: never with the key this fetcher adds, even
|
|
132
|
+
// when a server echoed it into a redirect's `Location`.
|
|
133
|
+
const start = keyName === undefined ? location : withoutParam(location, keyName);
|
|
134
|
+
let bare = start;
|
|
135
|
+
for (let hops = 0;; hops += 1) {
|
|
136
|
+
const { url, headers } = credentialsFor(bare, options);
|
|
137
|
+
const credentialsSent = url !== bare || Object.keys(headers).length > 0;
|
|
138
|
+
let exchange;
|
|
139
|
+
try {
|
|
140
|
+
// Inside the try: a cancel while the host resolves the proxy is a cancel too.
|
|
141
|
+
const network = (await options.network?.(bare)) ?? {};
|
|
142
|
+
signal?.throwIfAborted();
|
|
143
|
+
exchange = await sendHttp({
|
|
144
|
+
url,
|
|
145
|
+
method: 'GET',
|
|
146
|
+
headers: { 'user-agent': USER_AGENT, accept: ACCEPT, ...headers },
|
|
147
|
+
timeoutMs: TIMEOUT_MS,
|
|
148
|
+
followRedirects: false,
|
|
149
|
+
...(signal !== undefined ? { signal } : {}),
|
|
150
|
+
...(network.tls !== undefined ? { tls: network.tls } : {}),
|
|
151
|
+
...(network.proxy !== undefined ? { proxy: network.proxy } : {}),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// A cancel stays a cancel: the resolver tells an `AbortError` from a document that failed.
|
|
156
|
+
signal?.throwIfAborted();
|
|
157
|
+
throw sanitisedFailure(error, url, bare, keyName);
|
|
158
|
+
}
|
|
159
|
+
const target = exchange.headers['location'];
|
|
160
|
+
if (REDIRECT_STATUSES.has(exchange.status) && target !== undefined) {
|
|
161
|
+
if (hops >= MAX_REDIRECTS) {
|
|
162
|
+
throw new HttpError('too-many-redirects', `GET ${start} redirected more than ${String(MAX_REDIRECTS)} times`, {
|
|
163
|
+
details: { location: start },
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const next = redirectTarget(target, bare, exchange.status);
|
|
167
|
+
bare = keyName === undefined ? next : withoutParam(next, keyName);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (exchange.status === 401 || exchange.status === 403) {
|
|
171
|
+
const status = String(exchange.status);
|
|
172
|
+
throw new HttpError('definition-auth-required', credentialsSent
|
|
173
|
+
? `The definition at ${bare} refused the credentials given (HTTP ${status}).`
|
|
174
|
+
: `The definition at ${bare} needs authentication (HTTP ${status}).`, { details: { location: bare, status: exchange.status, authSent: credentialsSent } });
|
|
175
|
+
}
|
|
176
|
+
if (exchange.status < 200 || exchange.status >= 300) {
|
|
177
|
+
throw new HttpError('fetch-failed', `GET ${bare} failed with status ${String(exchange.status)}`, {
|
|
178
|
+
details: { location: bare, status: exchange.status },
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return { location: bare, bytes: exchange.body, text: decodeXmlBytes(exchange.body) };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Creates the {@link FetchDocument} for OpenAPI and AsyncAPI reads: `file:` (and any other non-HTTP
|
|
186
|
+
* location) as {@link createDefaultFetchDocument} reads it, and `http(s):` through `sendHttp` with
|
|
187
|
+
* the host's TLS and proxy, following up to 10 redirects, with `options.auth` sent only to
|
|
188
|
+
* `options.authOrigin`.
|
|
189
|
+
*
|
|
190
|
+
* The returned `location` never carries a query key this fetcher added, so `$ref` resolution,
|
|
191
|
+
* progress messages, errors and a recorded source never do either.
|
|
192
|
+
*
|
|
193
|
+
* @throws HttpError `definition-auth-required` for a 401 or 403 (`details.authSent` says whether
|
|
194
|
+
* credentials went with it), `fetch-failed` for any other non-2xx or a redirect off `http(s)`,
|
|
195
|
+
* `too-many-redirects`, or a transport error from `sendHttp` (without `details.request`)
|
|
196
|
+
* @throws HttpError `invalid-url`, at once, when `options.authOrigin` is not an `http(s)` URL
|
|
197
|
+
*/
|
|
198
|
+
export function createHttpFetchDocument(options = {}) {
|
|
199
|
+
const resolved = options.authOrigin === undefined ? options : { ...options, authOrigin: normaliseAuthOrigin(options.authOrigin) };
|
|
200
|
+
const fallback = createDefaultFetchDocument();
|
|
201
|
+
return async (location, signal) => {
|
|
202
|
+
if (!/^https?:\/\//i.test(location)) {
|
|
203
|
+
return fallback(location, signal);
|
|
204
|
+
}
|
|
205
|
+
return fetchHttp(location, signal, resolved);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A row of a name/value table: a path or query parameter, a header, a form field, a metadata entry.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because REST, gRPC and WebSocket requests all keep such rows, and a protocol folder
|
|
5
|
+
* imports core and itself, never another protocol (protocol modules spec §7.2). `rest/model.ts`
|
|
6
|
+
* re-exports both names, so REST code and the public exports read them where they always did.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* One row of a params, query, headers or form table: a name, a value, and whether it takes part
|
|
10
|
+
* in the next send. Rows keep author order and may repeat a name — two `X-Trace` headers and two
|
|
11
|
+
* `tag=` parameters are both legal on the wire, so neither is deduplicated here.
|
|
12
|
+
*
|
|
13
|
+
* `enabled` is always present in memory and written to disk only when `false`, so a file stays
|
|
14
|
+
* quiet about the common case (see `project/serialize.ts`).
|
|
15
|
+
*/
|
|
16
|
+
export interface KeyValueEntry {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly value: string;
|
|
19
|
+
readonly enabled: boolean;
|
|
20
|
+
/** Free-form note, carried over from an imported definition's parameter description. */
|
|
21
|
+
readonly description?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Creates an enabled {@link KeyValueEntry}. */
|
|
24
|
+
export declare function entry(name: string, value: string, options?: {
|
|
25
|
+
readonly enabled?: boolean;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
}): KeyValueEntry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A row of a name/value table: a path or query parameter, a header, a form field, a metadata entry.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because REST, gRPC and WebSocket requests all keep such rows, and a protocol folder
|
|
5
|
+
* imports core and itself, never another protocol (protocol modules spec §7.2). `rest/model.ts`
|
|
6
|
+
* re-exports both names, so REST code and the public exports read them where they always did.
|
|
7
|
+
*/
|
|
8
|
+
/** Creates an enabled {@link KeyValueEntry}. */
|
|
9
|
+
export function entry(name, value, options) {
|
|
10
|
+
return {
|
|
11
|
+
name,
|
|
12
|
+
value,
|
|
13
|
+
enabled: options?.enabled ?? true,
|
|
14
|
+
...(options?.description !== undefined ? { description: options.description } : {}),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escaping a value that is substituted into a body, by the language the body is written in.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the REST, gRPC and WebSocket expansions all apply it, and a protocol folder
|
|
5
|
+
* imports core and itself, never another protocol (protocol modules spec §7.2). `rest/model.ts`
|
|
6
|
+
* re-exports {@link RawLanguage} and `rest/body.ts` re-exports {@link escapeForLanguage}.
|
|
7
|
+
*/
|
|
8
|
+
/** The languages a raw body can be edited and sent as. Picks the editor mode and a default type. */
|
|
9
|
+
export type RawLanguage = 'json' | 'xml' | 'text' | 'html' | 'javascript';
|
|
10
|
+
/**
|
|
11
|
+
* XML- or JSON-escapes a value being substituted into a body, for the *escape properties* setting.
|
|
12
|
+
*
|
|
13
|
+
* Only the characters that would otherwise change the document's structure are touched. A JSON
|
|
14
|
+
* body gets JSON string escaping (without the surrounding quotes, since the value is substituted
|
|
15
|
+
* inside them); an XML body gets the five predefined entities; anything else is left alone,
|
|
16
|
+
* because there is no general escape for `text/plain`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function escapeForLanguage(value: string, language: RawLanguage | 'form'): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escaping a value that is substituted into a body, by the language the body is written in.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the REST, gRPC and WebSocket expansions all apply it, and a protocol folder
|
|
5
|
+
* imports core and itself, never another protocol (protocol modules spec §7.2). `rest/model.ts`
|
|
6
|
+
* re-exports {@link RawLanguage} and `rest/body.ts` re-exports {@link escapeForLanguage}.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* XML- or JSON-escapes a value being substituted into a body, for the *escape properties* setting.
|
|
10
|
+
*
|
|
11
|
+
* Only the characters that would otherwise change the document's structure are touched. A JSON
|
|
12
|
+
* body gets JSON string escaping (without the surrounding quotes, since the value is substituted
|
|
13
|
+
* inside them); an XML body gets the five predefined entities; anything else is left alone,
|
|
14
|
+
* because there is no general escape for `text/plain`.
|
|
15
|
+
*/
|
|
16
|
+
export function escapeForLanguage(value, language) {
|
|
17
|
+
if (language === 'json') {
|
|
18
|
+
const json = JSON.stringify(value);
|
|
19
|
+
return json.slice(1, -1);
|
|
20
|
+
}
|
|
21
|
+
if (language === 'xml' || language === 'html') {
|
|
22
|
+
return value
|
|
23
|
+
.replace(/&/g, '&')
|
|
24
|
+
.replace(/</g, '<')
|
|
25
|
+
.replace(/>/g, '>')
|
|
26
|
+
.replace(/"/g, '"')
|
|
27
|
+
.replace(/'/g, ''');
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetching one document by its location: what a fetcher is, and the default one.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the WSDL, OpenAPI and AsyncAPI imports all take a {@link FetchDocument}, and a
|
|
5
|
+
* protocol folder imports core and itself, never another protocol (protocol modules spec §7.2).
|
|
6
|
+
* `wsdl/resolver.ts` re-exports the two types.
|
|
7
|
+
*/
|
|
8
|
+
/** A fetched document's canonical location (post-redirect) and raw content. */
|
|
9
|
+
export interface FetchedDocument {
|
|
10
|
+
/** The final absolute location after following any redirects. */
|
|
11
|
+
readonly location: string;
|
|
12
|
+
readonly bytes: Uint8Array;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
15
|
+
/** Fetches a single document by absolute location, honouring an optional abort signal. */
|
|
16
|
+
export type FetchDocument = (location: string, signal?: AbortSignal) => Promise<FetchedDocument>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates the default {@link FetchDocument} implementation: `file:` URLs are
|
|
19
|
+
* read from disk via `node:fs/promises`, and `http(s):` URLs are fetched via
|
|
20
|
+
* the global `fetch` (following redirects, with a 20s timeout combined with
|
|
21
|
+
* the caller's `AbortSignal`, and a `wirebench/0.1` User-Agent).
|
|
22
|
+
*
|
|
23
|
+
* Text is decoded as UTF-8 by default, honouring an `iso-8859-1` `encoding`
|
|
24
|
+
* in the document's XML declaration when present (see {@link decodeXmlBytes}
|
|
25
|
+
* for why `utf-16` isn't sniffed the same way). Other declared encodings
|
|
26
|
+
* fall back to UTF-8.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createDefaultFetchDocument(): FetchDocument;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetching one document by its location: what a fetcher is, and the default one.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the WSDL, OpenAPI and AsyncAPI imports all take a {@link FetchDocument}, and a
|
|
5
|
+
* protocol folder imports core and itself, never another protocol (protocol modules spec §7.2).
|
|
6
|
+
* `wsdl/resolver.ts` re-exports the two types.
|
|
7
|
+
*/
|
|
1
8
|
import { readFile } from 'node:fs/promises';
|
|
2
9
|
import { fileURLToPath } from 'node:url';
|
|
3
10
|
import { HttpError } from '../errors.js';
|
|
11
|
+
import { decodeXmlBytes } from '../xml/decode.js';
|
|
4
12
|
const DEFAULT_TIMEOUT_MS = 20_000;
|
|
5
13
|
const USER_AGENT = 'wirebench/0.1';
|
|
6
|
-
/**
|
|
7
|
-
* Decodes bytes as UTF-8, honouring an `<?xml ... encoding="iso-8859-1" ?>`
|
|
8
|
-
* declaration when present (single-byte, so it is safely sniffable by
|
|
9
|
-
* decoding the head as UTF-8 first). A `utf-16` declaration would require a
|
|
10
|
-
* BOM/byte-order sniff before the declaration itself is even legible, which
|
|
11
|
-
* does not fit a small helper like this — such documents fall back to (and
|
|
12
|
-
* garble under) UTF-8; use a pre-fetched `text` in that case instead.
|
|
13
|
-
*/
|
|
14
|
-
function decodeXmlBytes(bytes) {
|
|
15
|
-
const head = new TextDecoder('utf-8').decode(bytes.subarray(0, 200));
|
|
16
|
-
const match = /^\s*<\?xml[^>]*\bencoding=["']([^"']+)["']/i.exec(head);
|
|
17
|
-
if (match?.[1]?.toLowerCase() === 'iso-8859-1') {
|
|
18
|
-
return new TextDecoder('iso-8859-1').decode(bytes);
|
|
19
|
-
}
|
|
20
|
-
return new TextDecoder('utf-8').decode(bytes);
|
|
21
|
-
}
|
|
22
14
|
async function fetchFile(location) {
|
|
23
15
|
const bytes = await readFile(fileURLToPath(location));
|
|
24
16
|
return { location, bytes: new Uint8Array(bytes), text: decodeXmlBytes(bytes) };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a `Content-Type` header value.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the SOAP multipart code and the REST body and response code both need the bare
|
|
5
|
+
* media type, and a protocol folder imports core and itself, never another protocol (protocol
|
|
6
|
+
* modules spec §7.2). `soap/mime/multipart.ts` re-exports the name.
|
|
7
|
+
*/
|
|
8
|
+
/** The media type of a `Content-Type` header value, without its parameters. */
|
|
9
|
+
export declare function mediaTypeOf(contentType: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a `Content-Type` header value.
|
|
3
|
+
*
|
|
4
|
+
* In `http/` because the SOAP multipart code and the REST body and response code both need the bare
|
|
5
|
+
* media type, and a protocol folder imports core and itself, never another protocol (protocol
|
|
6
|
+
* modules spec §7.2). `soap/mime/multipart.ts` re-exports the name.
|
|
7
|
+
*/
|
|
8
|
+
/** The media type of a `Content-Type` header value, without its parameters. */
|
|
9
|
+
export function mediaTypeOf(contentType) {
|
|
10
|
+
const semicolon = contentType.indexOf(';');
|
|
11
|
+
return (semicolon === -1 ? contentType : contentType.slice(0, semicolon)).trim();
|
|
12
|
+
}
|