@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Project, PropertyMap } from '../project/model.js';
|
|
2
|
+
import type { HeldSoapDefinition } from '../protocols.js';
|
|
3
|
+
import type { PropertyScopes } from '../project/properties.js';
|
|
4
|
+
import type { ProtocolRegistry } from '../protocol/registry.js';
|
|
5
|
+
import type { RequestScripting } from '../script/request-scripts.js';
|
|
6
|
+
import type { SecretPlaceholders } from '../script/send.js';
|
|
7
|
+
import type { Workspace } from '../workspace/model.js';
|
|
8
|
+
import type { CurrentValues } from './current-values.js';
|
|
9
|
+
import type { SendHost } from './host.js';
|
|
10
|
+
import type { SelectedRequest } from './select.js';
|
|
11
|
+
/**
|
|
12
|
+
* The workspace a project is run inside, and the slug its manifest addresses the project by (the
|
|
13
|
+
* first half of a workspace environment's `<projectSlug>/<interfaceSlug>` endpoint key).
|
|
14
|
+
*/
|
|
15
|
+
export interface RunWorkspace {
|
|
16
|
+
readonly workspace: Workspace;
|
|
17
|
+
readonly projectSlug: string;
|
|
18
|
+
}
|
|
19
|
+
/** Everything a run supplies around the saved requests it sends. */
|
|
20
|
+
export interface RunContext {
|
|
21
|
+
readonly project: Project;
|
|
22
|
+
/** The project folder: keystores, attachments and file bodies are read from inside it only. */
|
|
23
|
+
readonly projectDir: string;
|
|
24
|
+
/**
|
|
25
|
+
* The environment the run resolves under. Inside a workspace it is a *workspace* environment's
|
|
26
|
+
* id, as it is in the app: the project's own environments apply only through the one linked to
|
|
27
|
+
* it by slug.
|
|
28
|
+
*/
|
|
29
|
+
readonly environmentId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The workspace the project sits inside. Its properties become the `${#Workspace#…}` scope, and
|
|
32
|
+
* its environment (with the linked project one laid over it) the `${…}` shorthand's.
|
|
33
|
+
*/
|
|
34
|
+
readonly workspace?: RunWorkspace;
|
|
35
|
+
/** `--var` overrides, laid over the environment's properties. */
|
|
36
|
+
readonly overrides: PropertyMap;
|
|
37
|
+
/** The host's global properties, the `${#Global#…}` scope. Absent: none. */
|
|
38
|
+
readonly globals?: PropertyMap;
|
|
39
|
+
/**
|
|
40
|
+
* The session's current values (cookie jar spec §5.2), each laid over the committed values of its
|
|
41
|
+
* own scope. `overrides` still win over them. Typed by the user, never response-derived.
|
|
42
|
+
*/
|
|
43
|
+
readonly current?: CurrentValues;
|
|
44
|
+
/** What the host lends each send: secrets, proxy, TLS, tokens, preferences (spec §3.1). */
|
|
45
|
+
readonly host: SendHost;
|
|
46
|
+
readonly timeoutMs?: number;
|
|
47
|
+
readonly insecure?: boolean;
|
|
48
|
+
readonly signal?: AbortSignal;
|
|
49
|
+
/**
|
|
50
|
+
* The WSDL-derived default `wsa:Action` for a SOAP request, as the app takes it from the
|
|
51
|
+
* interface's imported definition. Absent (or returning `''`) when no definition is at hand:
|
|
52
|
+
* an explicit `wsa:Action` or the request's SOAPAction then still applies.
|
|
53
|
+
*/
|
|
54
|
+
readonly defaultWsaActionFor?: (selected: Extract<SelectedRequest, {
|
|
55
|
+
kind: 'soap';
|
|
56
|
+
}>) => string;
|
|
57
|
+
/**
|
|
58
|
+
* The definition a host already holds for a SOAP request's interface (the app's, imported and
|
|
59
|
+
* compiled), so a send neither reads nor compiles the definition cache. Absent, or answering
|
|
60
|
+
* undefined: the run reads the interface's cached definition itself, once per run scope.
|
|
61
|
+
*/
|
|
62
|
+
readonly loadedDefinitionFor?: (selected: Extract<SelectedRequest, {
|
|
63
|
+
kind: 'soap';
|
|
64
|
+
}>) => HeldSoapDefinition | undefined;
|
|
65
|
+
/** A sequence step's `${#Sequence#…}` values, from the responses of the steps before it. */
|
|
66
|
+
readonly sequence?: PropertyMap;
|
|
67
|
+
/**
|
|
68
|
+
* Set for a request with a pre-request script: every `${secret:…}` in the request's text becomes
|
|
69
|
+
* one of these placeholders, and the script's host puts the values back after it (#63).
|
|
70
|
+
*/
|
|
71
|
+
readonly secretPlaceholders?: SecretPlaceholders;
|
|
72
|
+
/**
|
|
73
|
+
* Runs requests' scripts (#63). A run without it refuses a request whose scripts are switched on,
|
|
74
|
+
* rather than send it without them.
|
|
75
|
+
*/
|
|
76
|
+
readonly scripting?: RequestScripting;
|
|
77
|
+
/** True when a value holds a credential the run knows; such a script value is treated as secret. */
|
|
78
|
+
readonly containsKnownSecret?: (value: string) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The protocol modules this run dispatches through, with their feature switches. Absent: the
|
|
81
|
+
* built-in four with every feature on (`defaultRegistry()`).
|
|
82
|
+
*/
|
|
83
|
+
readonly registry?: ProtocolRegistry;
|
|
84
|
+
}
|
|
85
|
+
/** The property scopes a request of this run expands against, secrets not yet added. */
|
|
86
|
+
export declare function scopesFor(context: RunContext): PropertyScopes;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a run supplies around the saved requests it sends, and the property scopes they expand
|
|
3
|
+
* against. Apart from the run's own files so a protocol module can take a `RunContext` without
|
|
4
|
+
* importing the run loop.
|
|
5
|
+
*/
|
|
6
|
+
import { resolveScopes } from '../project/environments.js';
|
|
7
|
+
import { resolveWorkspaceScopes, withActiveEnvironment } from '../workspace/environments.js';
|
|
8
|
+
import { withCurrentValues } from './current-values.js';
|
|
9
|
+
/** The property scopes a request of this run expands against, secrets not yet added. */
|
|
10
|
+
export function scopesFor(context) {
|
|
11
|
+
const { environmentId } = context;
|
|
12
|
+
const { project, workspace, globals } = withCurrentValues({
|
|
13
|
+
project: context.project,
|
|
14
|
+
...(context.workspace !== undefined ? { workspace: context.workspace.workspace } : {}),
|
|
15
|
+
globals: context.globals ?? {},
|
|
16
|
+
}, context.current);
|
|
17
|
+
const scopes = workspace === undefined
|
|
18
|
+
? resolveScopes(project, environmentId, globals, process.env)
|
|
19
|
+
: resolveWorkspaceScopes({
|
|
20
|
+
workspace: withActiveEnvironment(workspace, environmentId),
|
|
21
|
+
project,
|
|
22
|
+
globals,
|
|
23
|
+
system: process.env,
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
...scopes,
|
|
27
|
+
env: { ...(scopes.env ?? {}), ...context.overrides },
|
|
28
|
+
// A sequence step's `${#Sequence#…}` values: literal, explicit-only and guarded (ADR-0015).
|
|
29
|
+
...(context.sequence !== undefined ? { sequence: context.sequence } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current values (cookie jar and current values spec §5.2): the session's own value for a variable,
|
|
3
|
+
* laid over its committed value in the same scope before resolution. A host hands them in through
|
|
4
|
+
* `RunContext.current`.
|
|
5
|
+
*
|
|
6
|
+
* A current value is typed by the user, never taken from a response, so it is a template like a
|
|
7
|
+
* committed value and ADR-0015 is untouched. It only replaces a name its scope defines, and since
|
|
8
|
+
* resolution drops disabled names afterwards, a disabled variable's current value does not apply.
|
|
9
|
+
*/
|
|
10
|
+
import type { Project, PropertyMap } from '../project/model.js';
|
|
11
|
+
import type { Workspace } from '../workspace/model.js';
|
|
12
|
+
/** The overlays of one run, keyed like the scopes they land on; environments by id. */
|
|
13
|
+
export interface CurrentValues {
|
|
14
|
+
readonly global?: PropertyMap;
|
|
15
|
+
readonly workspace?: PropertyMap;
|
|
16
|
+
readonly workspaceEnvironments?: Readonly<Record<string, PropertyMap>>;
|
|
17
|
+
readonly project?: PropertyMap;
|
|
18
|
+
/** The run's project's own environments. */
|
|
19
|
+
readonly projectEnvironments?: Readonly<Record<string, PropertyMap>>;
|
|
20
|
+
}
|
|
21
|
+
/** `properties` with each name it defines replaced by `current`'s value; the same map when nothing changes. */
|
|
22
|
+
export declare function overlayCurrent(properties: PropertyMap, current: PropertyMap | undefined): PropertyMap;
|
|
23
|
+
/** The project, workspace and globals a run resolves, each scope with its current values laid over it. */
|
|
24
|
+
export declare function withCurrentValues(input: {
|
|
25
|
+
readonly project: Project;
|
|
26
|
+
readonly workspace?: Workspace;
|
|
27
|
+
readonly globals: PropertyMap;
|
|
28
|
+
}, current: CurrentValues | undefined): {
|
|
29
|
+
readonly project: Project;
|
|
30
|
+
readonly workspace?: Workspace;
|
|
31
|
+
readonly globals: PropertyMap;
|
|
32
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** `properties` with each name it defines replaced by `current`'s value; the same map when nothing changes. */
|
|
2
|
+
export function overlayCurrent(properties, current) {
|
|
3
|
+
if (current === undefined) {
|
|
4
|
+
return properties;
|
|
5
|
+
}
|
|
6
|
+
let laid;
|
|
7
|
+
for (const [name, value] of Object.entries(current)) {
|
|
8
|
+
if (Object.hasOwn(properties, name)) {
|
|
9
|
+
laid ??= { ...properties };
|
|
10
|
+
laid[name] = value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return laid ?? properties;
|
|
14
|
+
}
|
|
15
|
+
/** The project, workspace and globals a run resolves, each scope with its current values laid over it. */
|
|
16
|
+
export function withCurrentValues(input, current) {
|
|
17
|
+
if (current === undefined) {
|
|
18
|
+
return input;
|
|
19
|
+
}
|
|
20
|
+
const project = {
|
|
21
|
+
...input.project,
|
|
22
|
+
properties: overlayCurrent(input.project.properties, current.project),
|
|
23
|
+
environments: input.project.environments.map((environment) => ({
|
|
24
|
+
...environment,
|
|
25
|
+
properties: overlayCurrent(environment.properties, current.projectEnvironments?.[environment.id]),
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
28
|
+
const workspace = input.workspace === undefined
|
|
29
|
+
? undefined
|
|
30
|
+
: {
|
|
31
|
+
...input.workspace,
|
|
32
|
+
properties: overlayCurrent(input.workspace.properties, current.workspace),
|
|
33
|
+
environments: input.workspace.environments.map((environment) => ({
|
|
34
|
+
...environment,
|
|
35
|
+
properties: overlayCurrent(environment.properties, current.workspaceEnvironments?.[environment.id]),
|
|
36
|
+
})),
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
project,
|
|
40
|
+
...(workspace !== undefined ? { workspace } : {}),
|
|
41
|
+
globals: overlayCurrent(input.globals, current.global),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live events of one exchange, as an async iterable. A disabled queue drops everything: nobody
|
|
3
|
+
* reads its events (a run), so a long stream costs no memory beyond the exchange it records anyway.
|
|
4
|
+
*/
|
|
5
|
+
export declare class EventQueue<T> implements AsyncIterable<T> {
|
|
6
|
+
private readonly enabled;
|
|
7
|
+
private readonly buffered;
|
|
8
|
+
private waiting;
|
|
9
|
+
private ended;
|
|
10
|
+
constructor(enabled: boolean);
|
|
11
|
+
push(event: T): void;
|
|
12
|
+
end(): void;
|
|
13
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live events of one exchange, as an async iterable. A disabled queue drops everything: nobody
|
|
3
|
+
* reads its events (a run), so a long stream costs no memory beyond the exchange it records anyway.
|
|
4
|
+
*/
|
|
5
|
+
export class EventQueue {
|
|
6
|
+
enabled;
|
|
7
|
+
buffered = [];
|
|
8
|
+
waiting;
|
|
9
|
+
ended = false;
|
|
10
|
+
constructor(enabled) {
|
|
11
|
+
this.enabled = enabled;
|
|
12
|
+
}
|
|
13
|
+
push(event) {
|
|
14
|
+
if (!this.enabled || this.ended)
|
|
15
|
+
return;
|
|
16
|
+
const waiting = this.waiting;
|
|
17
|
+
if (waiting !== undefined) {
|
|
18
|
+
this.waiting = undefined;
|
|
19
|
+
waiting({ value: event, done: false });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.buffered.push(event);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
end() {
|
|
26
|
+
if (this.ended)
|
|
27
|
+
return;
|
|
28
|
+
this.ended = true;
|
|
29
|
+
const waiting = this.waiting;
|
|
30
|
+
this.waiting = undefined;
|
|
31
|
+
waiting?.({ value: undefined, done: true });
|
|
32
|
+
}
|
|
33
|
+
[Symbol.asyncIterator]() {
|
|
34
|
+
return {
|
|
35
|
+
next: () => {
|
|
36
|
+
if (this.buffered.length > 0)
|
|
37
|
+
return Promise.resolve({ value: this.buffered.shift(), done: false });
|
|
38
|
+
if (this.ended)
|
|
39
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
this.waiting = resolve;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One send, whoever sends it (spec §3.2): the desktop, a run, a sequence step. A protocol's run facet
|
|
3
|
+
* builds its handle with `exchangeController`; `openExchange` (run/open.ts) hands an item to its
|
|
4
|
+
* facet. Core code: it names no protocol.
|
|
5
|
+
*/
|
|
6
|
+
import { WirebenchError } from '../errors.js';
|
|
7
|
+
import type { PropertyScopes } from '../project/properties.js';
|
|
8
|
+
import type { RunScope, ScriptedSend } from '../protocol/module.js';
|
|
9
|
+
import { EventQueue } from './event-queue.js';
|
|
10
|
+
import type { SentRequest } from './run.js';
|
|
11
|
+
export interface LiveEventBase {
|
|
12
|
+
readonly protocol: string;
|
|
13
|
+
readonly kind: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A message pushed on an open exchange: text (expanded when `expand`), or binary as base64. A text
|
|
17
|
+
* expands against `scopes` when the host brings them (its properties as they are at the push, an
|
|
18
|
+
* environment switched since the open included), else against the exchange's own.
|
|
19
|
+
*/
|
|
20
|
+
export type PushMessage = {
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly expand?: boolean;
|
|
23
|
+
readonly scopes?: PropertyScopes;
|
|
24
|
+
} | {
|
|
25
|
+
readonly base64: string;
|
|
26
|
+
};
|
|
27
|
+
export interface ExchangeOptions {
|
|
28
|
+
readonly scope: RunScope;
|
|
29
|
+
readonly scripts?: ScriptedSend;
|
|
30
|
+
/** The host drives push, halfClose and close; otherwise the saved messages are sent (spec §5.2). */
|
|
31
|
+
readonly interactive: boolean;
|
|
32
|
+
/** True when the caller reads `events`. By default nothing is buffered. */
|
|
33
|
+
readonly live?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* True for a run's send (spec §5.2): a stream waits for its answer within the run timeout, and one
|
|
36
|
+
* the timeout cuts fails with `timeout`. A host's own send is not a run, interactive or not.
|
|
37
|
+
*/
|
|
38
|
+
readonly run?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface StreamingSide {
|
|
41
|
+
/** Resolves with what was sent: a gRPC message's canonical JSON, a WebSocket frame. */
|
|
42
|
+
push(message: PushMessage): Promise<unknown>;
|
|
43
|
+
halfClose(): void;
|
|
44
|
+
close(code?: number, reason?: string): void;
|
|
45
|
+
}
|
|
46
|
+
export interface ExchangeHandle<E extends LiveEventBase = LiveEventBase> extends StreamingSide {
|
|
47
|
+
readonly events: AsyncIterable<E>;
|
|
48
|
+
/** Aborts this send only. False when it has already settled or been cancelled. */
|
|
49
|
+
cancel(): boolean;
|
|
50
|
+
/** Rejects with the send's error; `events` has ended by then. */
|
|
51
|
+
readonly result: Promise<SentRequest>;
|
|
52
|
+
}
|
|
53
|
+
export interface ExchangeController<E extends LiveEventBase> {
|
|
54
|
+
/** This exchange's own signal, which also follows the run's. */
|
|
55
|
+
readonly signal: AbortSignal;
|
|
56
|
+
readonly queue: EventQueue<E>;
|
|
57
|
+
/** The handle: its result is `run`'s, and its events end when `run` settles. */
|
|
58
|
+
handle(run: () => Promise<SentRequest>, streaming?: StreamingSide): ExchangeHandle<E>;
|
|
59
|
+
}
|
|
60
|
+
/** The refusal of a push, half-close or close on an exchange that takes no messages. */
|
|
61
|
+
export declare function notStreaming(kind: string): WirebenchError;
|
|
62
|
+
export declare function exchangeController<E extends LiveEventBase>(kind: string, options: ExchangeOptions): ExchangeController<E>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One send, whoever sends it (spec §3.2): the desktop, a run, a sequence step. A protocol's run facet
|
|
3
|
+
* builds its handle with `exchangeController`; `openExchange` (run/open.ts) hands an item to its
|
|
4
|
+
* facet. Core code: it names no protocol.
|
|
5
|
+
*/
|
|
6
|
+
import { WirebenchError } from '../errors.js';
|
|
7
|
+
import { EventQueue } from './event-queue.js';
|
|
8
|
+
/** The refusal of a push, half-close or close on an exchange that takes no messages. */
|
|
9
|
+
export function notStreaming(kind) {
|
|
10
|
+
return new WirebenchError('exchange-not-streaming', `This ${kind} request takes no messages once it is sent`, {
|
|
11
|
+
details: { protocol: kind },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function exchangeController(kind, options) {
|
|
15
|
+
const abort = new AbortController();
|
|
16
|
+
const outer = options.scope.context.signal;
|
|
17
|
+
const follow = () => abort.abort(outer?.reason);
|
|
18
|
+
if (outer !== undefined) {
|
|
19
|
+
if (outer.aborted)
|
|
20
|
+
abort.abort(outer.reason);
|
|
21
|
+
else
|
|
22
|
+
outer.addEventListener('abort', follow, { once: true });
|
|
23
|
+
}
|
|
24
|
+
const queue = new EventQueue(options.live === true);
|
|
25
|
+
let settled = false;
|
|
26
|
+
return {
|
|
27
|
+
signal: abort.signal,
|
|
28
|
+
queue,
|
|
29
|
+
handle(run, streaming) {
|
|
30
|
+
const result = (async () => {
|
|
31
|
+
try {
|
|
32
|
+
return await run();
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
settled = true;
|
|
36
|
+
outer?.removeEventListener('abort', follow);
|
|
37
|
+
queue.end();
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
40
|
+
// Observed here, so a rejection nobody awaits yet is never reported as unhandled.
|
|
41
|
+
result.catch(() => undefined);
|
|
42
|
+
return {
|
|
43
|
+
events: queue,
|
|
44
|
+
result,
|
|
45
|
+
push: (message) => (streaming !== undefined ? streaming.push(message) : Promise.reject(notStreaming(kind))),
|
|
46
|
+
halfClose: () => {
|
|
47
|
+
if (streaming === undefined)
|
|
48
|
+
throw notStreaming(kind);
|
|
49
|
+
streaming.halfClose();
|
|
50
|
+
},
|
|
51
|
+
close: (code, reason) => {
|
|
52
|
+
if (streaming === undefined)
|
|
53
|
+
throw notStreaming(kind);
|
|
54
|
+
streaming.close(code, reason);
|
|
55
|
+
},
|
|
56
|
+
cancel: () => {
|
|
57
|
+
if (settled || abort.signal.aborted)
|
|
58
|
+
return false;
|
|
59
|
+
abort.abort();
|
|
60
|
+
return true;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host lends the engine for one send (spec §3.1). Only the secret getter is required.
|
|
3
|
+
* Where any other member is absent, the send behaves as the command line's does.
|
|
4
|
+
*/
|
|
5
|
+
import type { CookieJarHost } from '../http/cookies.js';
|
|
6
|
+
import type { ProxyOptions } from '../http/types.js';
|
|
7
|
+
import type { Keystore } from '../keystore/index.js';
|
|
8
|
+
import type { Preferences } from '../project/preferences.js';
|
|
9
|
+
import type { SelectedBase } from '../protocol/module.js';
|
|
10
|
+
import type { GetSecret } from '../secrets/resolve.js';
|
|
11
|
+
import type { RunTokenSource } from './oauth2-token.js';
|
|
12
|
+
export interface ClientIdentity {
|
|
13
|
+
readonly cert: string;
|
|
14
|
+
readonly key: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AttemptedRequest {
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly method: string;
|
|
19
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
20
|
+
}
|
|
21
|
+
export interface SendFailure {
|
|
22
|
+
readonly stage: 'prepare' | 'send';
|
|
23
|
+
readonly error: unknown;
|
|
24
|
+
/** `Date.now()` when the failed stage began: the prepare stage, or the send stage after it. */
|
|
25
|
+
readonly startedAt: number;
|
|
26
|
+
/**
|
|
27
|
+
* How long the failed stage ran. A send-stage failure counts the send stage's own time only, never
|
|
28
|
+
* resolve, a script, a token fetch or a proxy lookup; a host's History records it as the duration.
|
|
29
|
+
*/
|
|
30
|
+
readonly durationMs: number;
|
|
31
|
+
/**
|
|
32
|
+
* What was about to go, or went, on the wire; absent when resolution itself failed. It can hold
|
|
33
|
+
* live values — a `${secret:…}` expanded into a header or a metadata row — so a host redacts it
|
|
34
|
+
* before it is shown or logged.
|
|
35
|
+
*/
|
|
36
|
+
readonly attempted?: AttemptedRequest;
|
|
37
|
+
/**
|
|
38
|
+
* The protocol's input at the stage that failed, for a host that records the send whole. It holds
|
|
39
|
+
* live credentials — resolved auth, a signing secret, a proxy password, TLS keys — so a host reads
|
|
40
|
+
* only what it records and never logs or serialises it.
|
|
41
|
+
*/
|
|
42
|
+
readonly input?: unknown;
|
|
43
|
+
/**
|
|
44
|
+
* What the protocol recorded of an exchange that failed part way, for a host that records the
|
|
45
|
+
* attempt whole: a session cancelled before it opened keeps its transcript. Redacted as `input` is.
|
|
46
|
+
*/
|
|
47
|
+
readonly exchange?: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface SendHost {
|
|
50
|
+
readonly getSecret: GetSecret;
|
|
51
|
+
/** Told every OAuth2 access token the send obtains, so the host can mask it in all it prints. */
|
|
52
|
+
readonly onSecretValue?: (value: string) => void;
|
|
53
|
+
readonly proxyFor?: (url: string) => Promise<ProxyOptions | undefined>;
|
|
54
|
+
readonly tls?: {
|
|
55
|
+
/** Added to every TLS connection's trust: the system roots, a CA bundle, test anchors. */
|
|
56
|
+
readonly anchors?: readonly string[];
|
|
57
|
+
/** A request's keystore, or the host's default identity when the request names none. */
|
|
58
|
+
identityFor?(keystoreId: string | undefined): Promise<ClientIdentity | undefined>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A WS-Security keystore by its project entry id, for signing, encryption, response verification
|
|
62
|
+
* and decryption alike; undefined when the project has no such entry. The app lends its own
|
|
63
|
+
* loader, which also reads a file its user picked this session; absent, a keystore is read from
|
|
64
|
+
* inside the project folder only.
|
|
65
|
+
*/
|
|
66
|
+
readonly keystoreFor?: (keystoreId: string) => Promise<Keystore | undefined>;
|
|
67
|
+
/** The OAuth2 token source; a run creates one per run when the host brings none. */
|
|
68
|
+
readonly tokens?: RunTokenSource;
|
|
69
|
+
readonly preferences?: Preferences;
|
|
70
|
+
readonly events?: {
|
|
71
|
+
onFailed?(item: SelectedBase, failure: SendFailure): void;
|
|
72
|
+
/** A row the host logs that is not the send's result (the WebSocket handshake). */
|
|
73
|
+
onExchange?(item: SelectedBase, exchange: unknown): void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The cookie jar (cookie jar spec §1.4): every REST send stores what each response sets, redirect
|
|
77
|
+
* hops included, and a request whose `sendCookies` setting is on carries what matches each hop's
|
|
78
|
+
* URL. Absent: nothing is stored or sent.
|
|
79
|
+
*/
|
|
80
|
+
readonly cookies?: CookieJarHost;
|
|
81
|
+
/** The response checked against the request's contract. Absent: nothing is checked.
|
|
82
|
+
* A rejection means nothing was checked: the send still succeeds, without a contract.
|
|
83
|
+
* `sent` is the protocol's input as it went out, which the operation is looked up from. */
|
|
84
|
+
readonly contractFor?: (item: SelectedBase, exchange: unknown, sent?: unknown) => Promise<unknown>;
|
|
85
|
+
/** A webhook item's callback URL, used in place of its target; undefined keeps the target. */
|
|
86
|
+
readonly callbackUrlFor?: (item: SelectedBase) => Promise<string | undefined>;
|
|
87
|
+
/** An API's schema (a ProtoSet; the gRPC module narrows it), in place of the definition cache. */
|
|
88
|
+
readonly protoSetFor?: (item: SelectedBase) => Promise<unknown>;
|
|
89
|
+
}
|
package/dist/run/host.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/run/index.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
export { selectRequests } from './select.js';
|
|
2
|
-
export type { SelectedRequest } from './select.js';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
export {
|
|
1
|
+
export { findStepRequest, selectRequests } from './select.js';
|
|
2
|
+
export type { SelectedRequest, StepRequestLookup } from './select.js';
|
|
3
|
+
export { scopesFor } from './context.js';
|
|
4
|
+
export { overlayCurrent, withCurrentValues } from './current-values.js';
|
|
5
|
+
export type { CurrentValues } from './current-values.js';
|
|
6
|
+
export type { AttemptedRequest, ClientIdentity, SendFailure, SendHost } from './host.js';
|
|
7
|
+
export type { RunContext, RunWorkspace } from './context.js';
|
|
8
|
+
export { cappedExchange, checkRunScripts, createRunSender, deferredSession, errorOf, runRequests, scriptReport, } from './run.js';
|
|
9
|
+
export type { BaselineSink, BaselineSource, RequestOutcome, RequestResult, RunOptions, RunRequestSender, RunResult, RunSendOverrides, LiveEvent, RunSummary, SentExchange, SentRequest, } from './run.js';
|
|
10
|
+
export { secretNamesInValue, secretNeedsOf } from './secret-needs.js';
|
|
8
11
|
export type { LocatedSecretNeed } from './secret-needs.js';
|
|
12
|
+
export { createRunTokenSource } from './oauth2-token.js';
|
|
13
|
+
export type { RunTokenSource, RunTokenSourceOptions, TokenRequestContext } from './oauth2-token.js';
|
|
14
|
+
export { mergeScriptValues, scriptAssertions, scriptSession, listedSecrets } from './script-support.js';
|
|
15
|
+
export type { ScriptSession, ScriptSessionOptions, SentScripts } from './script-support.js';
|
|
16
|
+
export { EventQueue } from './event-queue.js';
|
|
17
|
+
export { exchangeController, notStreaming } from './exchange.js';
|
|
18
|
+
export { openExchange, resolveExchange } from './open.js';
|
|
19
|
+
export { createRunScope } from './scope.js';
|
|
20
|
+
export { resolvedBaseUrl } from './send-helpers.js';
|
|
21
|
+
export type { ExchangeController, ExchangeHandle, ExchangeOptions, LiveEventBase, PushMessage, StreamingSide, } from './exchange.js';
|
package/dist/run/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
export { selectRequests } from './select.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { findStepRequest, selectRequests } from './select.js';
|
|
2
|
+
export { scopesFor } from './context.js';
|
|
3
|
+
export { overlayCurrent, withCurrentValues } from './current-values.js';
|
|
4
|
+
export { cappedExchange, checkRunScripts, createRunSender, deferredSession, errorOf, runRequests, scriptReport, } from './run.js';
|
|
5
|
+
export { secretNamesInValue, secretNeedsOf } from './secret-needs.js';
|
|
6
|
+
export { createRunTokenSource } from './oauth2-token.js';
|
|
7
|
+
export { mergeScriptValues, scriptAssertions, scriptSession, listedSecrets } from './script-support.js';
|
|
8
|
+
export { EventQueue } from './event-queue.js';
|
|
9
|
+
export { exchangeController, notStreaming } from './exchange.js';
|
|
10
|
+
export { openExchange, resolveExchange } from './open.js';
|
|
11
|
+
export { createRunScope } from './scope.js';
|
|
12
|
+
export { resolvedBaseUrl } from './send-helpers.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HttpExchange, HttpRequest, ProxyOptions, TlsOptions } from '../http/types.js';
|
|
2
|
+
import type { OAuth2Auth } from '../project/model.js';
|
|
3
|
+
import type { PropertyScopes } from '../project/properties.js';
|
|
4
|
+
import type { GetSecret } from '../secrets/resolve.js';
|
|
5
|
+
export interface RunTokenSourceOptions {
|
|
6
|
+
readonly getSecret: GetSecret;
|
|
7
|
+
/** Sends the token request. The engine's `sendHttp` by default; a stub in tests. */
|
|
8
|
+
readonly send?: (request: HttpRequest) => Promise<HttpExchange>;
|
|
9
|
+
readonly now?: () => Date;
|
|
10
|
+
/** Told every access token obtained, so a host can keep it out of everything it prints. */
|
|
11
|
+
readonly onSecretValue?: (value: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/** What one token request needs beyond the configuration: the requesting send's own surroundings. */
|
|
14
|
+
export interface TokenRequestContext {
|
|
15
|
+
/** The request's property scopes: token URL, client id, scopes and audience expand against them. */
|
|
16
|
+
readonly scopes: PropertyScopes;
|
|
17
|
+
readonly tls?: TlsOptions;
|
|
18
|
+
/** The proxy for the token URL, chosen after it is expanded. */
|
|
19
|
+
readonly proxy?: (tokenUrl: string) => Promise<ProxyOptions | undefined>;
|
|
20
|
+
readonly timeoutMs?: number;
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
export interface RunTokenSource {
|
|
24
|
+
/**
|
|
25
|
+
* The cached token for the configuration, or a new one when there is none, it is about to lapse,
|
|
26
|
+
* or it was rejected.
|
|
27
|
+
*
|
|
28
|
+
* @throws WirebenchError `unresolved-properties` | `secret-missing` | `oauth2-no-token-url` |
|
|
29
|
+
* `oauth2-token-error` | `oauth2-token-malformed`, or the send's own error
|
|
30
|
+
*/
|
|
31
|
+
accessTokenFor(config: OAuth2Auth, request: TokenRequestContext): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Drops `accessToken` from the cache after a server refused it (a REST or SOAP `401`, a gRPC
|
|
34
|
+
* `UNAUTHENTICATED`), so the next request behind its configuration fetches a new one. It never
|
|
35
|
+
* re-sends the refused request: that one may already have done something. A token the cache no
|
|
36
|
+
* longer holds is ignored.
|
|
37
|
+
*/
|
|
38
|
+
reject(accessToken: string): void;
|
|
39
|
+
}
|
|
40
|
+
export declare function createRunTokenSource(options: RunTokenSourceOptions): RunTokenSource;
|
|
41
|
+
/** A secret the project names but the run was not given: refused, never sent without. */
|
|
42
|
+
export declare function requiredSecret(ref: string, getSecret: GetSecret): Promise<string>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth2 access tokens for a run, which has no browser, no keychain and no token cache of its own
|
|
3
|
+
* beyond the run itself. Only the client-credentials grant can work headless; this source refuses
|
|
4
|
+
* authorization-code (a host's own source may serve it).
|
|
5
|
+
*
|
|
6
|
+
* One token per configuration per run: two requests behind the same configuration share one token
|
|
7
|
+
* request, and a token is fetched again when `needsRefresh` says it is about to lapse, or after a
|
|
8
|
+
* server rejected it (`reject`). A failed fetch is never cached, so the next request behind the
|
|
9
|
+
* configuration tries again.
|
|
10
|
+
*/
|
|
11
|
+
import { WirebenchError } from '../errors.js';
|
|
12
|
+
import { sendHttp } from '../http/client.js';
|
|
13
|
+
import { expand } from '../project/properties.js';
|
|
14
|
+
import { buildTokenRequest, needsRefresh, parseTokenResponse } from '../http/auth/oauth2.js';
|
|
15
|
+
/** The configuration with its property references expanded; unresolved ones refuse the fetch. */
|
|
16
|
+
function expandConfig(config, scopes) {
|
|
17
|
+
const unresolved = [];
|
|
18
|
+
const one = (text) => {
|
|
19
|
+
const result = expand(text, scopes);
|
|
20
|
+
unresolved.push(...result.unresolved);
|
|
21
|
+
return result.text;
|
|
22
|
+
};
|
|
23
|
+
const expanded = {
|
|
24
|
+
...config,
|
|
25
|
+
tokenUrl: one(config.tokenUrl),
|
|
26
|
+
clientId: one(config.clientId),
|
|
27
|
+
scopes: config.scopes.map(one),
|
|
28
|
+
...(config.audience !== undefined ? { audience: one(config.audience) } : {}),
|
|
29
|
+
};
|
|
30
|
+
if (unresolved.length > 0) {
|
|
31
|
+
const exprs = unresolved.map((ref) => ref.expr);
|
|
32
|
+
throw new WirebenchError('unresolved-properties', `The OAuth2 configuration has property references nothing resolves: ${exprs.join(', ')}`, { details: { unresolved: exprs } });
|
|
33
|
+
}
|
|
34
|
+
return expanded;
|
|
35
|
+
}
|
|
36
|
+
/** The expanded fields a token belongs to. Kept in memory only, never printed. */
|
|
37
|
+
function cacheKey(config) {
|
|
38
|
+
return [config.tokenUrl, config.clientId, [...config.scopes].sort().join(' '), config.audience ?? ''].join('\u0000');
|
|
39
|
+
}
|
|
40
|
+
export function createRunTokenSource(options) {
|
|
41
|
+
const tokens = new Map();
|
|
42
|
+
const now = options.now ?? (() => new Date());
|
|
43
|
+
const send = options.send ?? ((request) => sendHttp(request));
|
|
44
|
+
return {
|
|
45
|
+
async accessTokenFor(config, request) {
|
|
46
|
+
if (config.grant === 'authorization-code') {
|
|
47
|
+
throw new WirebenchError('auth-grant-unsupported', 'This request signs in through a browser (OAuth2 authorization code), which a pipeline cannot do.', { details: { grant: config.grant } });
|
|
48
|
+
}
|
|
49
|
+
const expanded = expandConfig(config, request.scopes);
|
|
50
|
+
const key = cacheKey(expanded);
|
|
51
|
+
const cached = tokens.get(key);
|
|
52
|
+
if (cached !== undefined && !needsRefresh(cached, now())) {
|
|
53
|
+
return cached.accessToken;
|
|
54
|
+
}
|
|
55
|
+
const clientSecret = await clientSecretOf(expanded, options.getSecret);
|
|
56
|
+
const built = buildTokenRequest(expanded, clientSecret !== undefined ? { clientSecret } : {}, { grant: 'client-credentials' }, {
|
|
57
|
+
...(request.timeoutMs !== undefined ? { timeoutMs: request.timeoutMs } : {}),
|
|
58
|
+
...(request.signal !== undefined ? { signal: request.signal } : {}),
|
|
59
|
+
});
|
|
60
|
+
const proxy = await request.proxy?.(expanded.tokenUrl);
|
|
61
|
+
const exchange = await send({
|
|
62
|
+
...built,
|
|
63
|
+
...(request.tls !== undefined ? { tls: request.tls } : {}),
|
|
64
|
+
...(proxy !== undefined ? { proxy } : {}),
|
|
65
|
+
});
|
|
66
|
+
const token = parseTokenResponse({ status: exchange.status, body: exchange.body, now });
|
|
67
|
+
options.onSecretValue?.(token.accessToken);
|
|
68
|
+
tokens.set(key, token);
|
|
69
|
+
return token.accessToken;
|
|
70
|
+
},
|
|
71
|
+
reject(accessToken) {
|
|
72
|
+
for (const [key, token] of tokens) {
|
|
73
|
+
if (token.accessToken === accessToken) {
|
|
74
|
+
tokens.delete(key);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** A secret the project names but the run was not given: refused, never sent without. */
|
|
81
|
+
export async function requiredSecret(ref, getSecret) {
|
|
82
|
+
const value = await getSecret(ref);
|
|
83
|
+
if (value === undefined) {
|
|
84
|
+
throw new WirebenchError('secret-missing', `Secret ${ref} was not supplied to this run.`, { details: { ref } });
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
/** A configured client secret the run was not given is refused, never sent as a public client. */
|
|
89
|
+
async function clientSecretOf(config, getSecret) {
|
|
90
|
+
const ref = config.clientSecretRef;
|
|
91
|
+
return ref === undefined || ref === '' ? undefined : requiredSecret(ref, getSecret);
|
|
92
|
+
}
|