@wirebench/engine 2.2.0 → 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,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON form model: a request body seen through its schema, as a tree of labelled nodes the form
|
|
3
|
+
* view can render, and the structural edits that view can ask for.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is pure and renderer-safe. Nodes are addressed by RFC 6901 JSON pointer (`''` for
|
|
6
|
+
* the root, `/a/0/b` below it), so an edit names a place in the *value*, not in the schema, and is
|
|
7
|
+
* applied to the current value every time — an edit can never act on a stale tree.
|
|
8
|
+
*
|
|
9
|
+
* The schema has already been dereferenced and may be a cyclic graph. Two bounds keep that finite:
|
|
10
|
+
* the tree only descends where the value has something (an absent property is one node with no
|
|
11
|
+
* children), and it stops at a depth limit with an `any` node, which the view shows as raw JSON.
|
|
12
|
+
* New values come from {@link sampleFromSchema}, so the form and "generate body" agree.
|
|
13
|
+
*/
|
|
14
|
+
import type { JsonSchema, JsonValue } from './openapi/model.js';
|
|
15
|
+
/** What a node renders as. */
|
|
16
|
+
export type JsonFormKind = 'field' | 'object' | 'array' | 'choice' | 'any';
|
|
17
|
+
/** The scalar type a `field` edits. */
|
|
18
|
+
export type JsonFormValueType = 'string' | 'number' | 'integer' | 'boolean' | 'null';
|
|
19
|
+
/** One node of the form: a place in the value, with what the schema says about it. */
|
|
20
|
+
export interface JsonFormNode {
|
|
21
|
+
/** JSON pointer of the value, `''` for the root. */
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly kind: JsonFormKind;
|
|
24
|
+
/** Property name, array index, or `''` for the root. */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/** The schema's `title`, else the name. */
|
|
27
|
+
readonly label: string;
|
|
28
|
+
readonly description?: string;
|
|
29
|
+
readonly required: boolean;
|
|
30
|
+
/** Whether the value exists in the document. */
|
|
31
|
+
readonly present: boolean;
|
|
32
|
+
/** `field` only. */
|
|
33
|
+
readonly valueType?: JsonFormValueType;
|
|
34
|
+
readonly format?: string;
|
|
35
|
+
readonly enum?: readonly JsonValue[];
|
|
36
|
+
/** `field` and `any`, when present. */
|
|
37
|
+
readonly value?: JsonValue;
|
|
38
|
+
/** Object properties, array items, or a choice's chosen branch. */
|
|
39
|
+
readonly children: readonly JsonFormNode[];
|
|
40
|
+
/** `choice`: one label per branch. */
|
|
41
|
+
readonly choices?: readonly string[];
|
|
42
|
+
/** `choice`: the index of the branch the value matches. */
|
|
43
|
+
readonly chosen?: number;
|
|
44
|
+
readonly readOnly?: boolean;
|
|
45
|
+
readonly deprecated?: boolean;
|
|
46
|
+
/** `field`: the schema allows `null` as well as `valueType`. */
|
|
47
|
+
readonly nullable?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** One structural change the form view can ask for, addressed by JSON pointer. */
|
|
50
|
+
export type JsonFormEdit = {
|
|
51
|
+
readonly kind: 'set-value';
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly value: JsonValue;
|
|
54
|
+
}
|
|
55
|
+
/** Make an absent property exist, filled from `sampleFromSchema`. */
|
|
56
|
+
| {
|
|
57
|
+
readonly kind: 'insert-optional';
|
|
58
|
+
readonly id: string;
|
|
59
|
+
}
|
|
60
|
+
/** Remove an optional property or an array item. */
|
|
61
|
+
| {
|
|
62
|
+
readonly kind: 'remove';
|
|
63
|
+
readonly id: string;
|
|
64
|
+
}
|
|
65
|
+
/** Append one item to the array at `id`. */
|
|
66
|
+
| {
|
|
67
|
+
readonly kind: 'add-item';
|
|
68
|
+
readonly id: string;
|
|
69
|
+
}
|
|
70
|
+
/** Replace the value at `id` with a sample of branch `index` of its `oneOf`/`anyOf`. */
|
|
71
|
+
| {
|
|
72
|
+
readonly kind: 'select-choice';
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly index: number;
|
|
75
|
+
};
|
|
76
|
+
/** Options for {@link buildJsonForm}. */
|
|
77
|
+
export interface JsonFormOptions {
|
|
78
|
+
/** Where the tree stops with an `any` node. Defaults to `MAX_SAMPLE_DEPTH`. */
|
|
79
|
+
readonly maxDepth?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The form tree for a value under a schema.
|
|
83
|
+
*
|
|
84
|
+
* @param schema the dereferenced schema (it may be cyclic)
|
|
85
|
+
* @param value the current body value, `undefined` when there is none
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildJsonForm(schema: JsonSchema, value: JsonValue | undefined, options?: JsonFormOptions): JsonFormNode;
|
|
88
|
+
/**
|
|
89
|
+
* The body value after one form edit. Nothing is mutated; properties the schema does not declare
|
|
90
|
+
* are carried over untouched.
|
|
91
|
+
*/
|
|
92
|
+
export declare function applyJsonFormEdit(schema: JsonSchema, value: JsonValue | undefined, edit: JsonFormEdit): JsonValue;
|
|
93
|
+
/**
|
|
94
|
+
* An acyclic copy of a schema, cut at `maxDepth` (and at a total node budget) with `{}` — "any
|
|
95
|
+
* value". What crosses a structured-clone or JSON boundary to the renderer.
|
|
96
|
+
*/
|
|
97
|
+
export declare function toWireSchema(schema: JsonSchema, maxDepth?: number): JsonSchema;
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON form model: a request body seen through its schema, as a tree of labelled nodes the form
|
|
3
|
+
* view can render, and the structural edits that view can ask for.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is pure and renderer-safe. Nodes are addressed by RFC 6901 JSON pointer (`''` for
|
|
6
|
+
* the root, `/a/0/b` below it), so an edit names a place in the *value*, not in the schema, and is
|
|
7
|
+
* applied to the current value every time — an edit can never act on a stale tree.
|
|
8
|
+
*
|
|
9
|
+
* The schema has already been dereferenced and may be a cyclic graph. Two bounds keep that finite:
|
|
10
|
+
* the tree only descends where the value has something (an absent property is one node with no
|
|
11
|
+
* children), and it stops at a depth limit with an `any` node, which the view shows as raw JSON.
|
|
12
|
+
* New values come from {@link sampleFromSchema}, so the form and "generate body" agree.
|
|
13
|
+
*/
|
|
14
|
+
import { effectiveType, MAX_SAMPLE_DEPTH, MAX_SAMPLE_NODES, mergeAllOf, sampleFromSchema, } from '../json/schema/sample.js';
|
|
15
|
+
const VALUE_TYPES = new Set(['string', 'number', 'integer', 'boolean', 'null']);
|
|
16
|
+
function isObject(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
function escapeSegment(segment) {
|
|
20
|
+
return segment.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
21
|
+
}
|
|
22
|
+
function parsePointer(pointer) {
|
|
23
|
+
if (pointer === '') {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return pointer
|
|
27
|
+
.slice(1)
|
|
28
|
+
.split('/')
|
|
29
|
+
.map((segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
30
|
+
}
|
|
31
|
+
/** The branches of a `oneOf`/`anyOf`, or none. */
|
|
32
|
+
function branchesOf(schema) {
|
|
33
|
+
return schema.oneOf ?? schema.anyOf ?? [];
|
|
34
|
+
}
|
|
35
|
+
/** Branch `index` merged with whatever sits beside the `oneOf` — the way `sampleFromSchema` merges its first. */
|
|
36
|
+
function branchSchema(schema, index) {
|
|
37
|
+
const branch = branchesOf(schema)[index];
|
|
38
|
+
if (branch === undefined) {
|
|
39
|
+
return schema;
|
|
40
|
+
}
|
|
41
|
+
const siblings = { ...schema };
|
|
42
|
+
delete siblings.oneOf;
|
|
43
|
+
delete siblings.anyOf;
|
|
44
|
+
return mergeAllOf({
|
|
45
|
+
...branch,
|
|
46
|
+
...siblings,
|
|
47
|
+
...(branch.properties !== undefined ? { properties: branch.properties } : {}),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Whether a value has the JSON type a schema type names. */
|
|
51
|
+
function typeMatches(type, value) {
|
|
52
|
+
if (type === undefined || value === undefined) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
switch (type) {
|
|
56
|
+
case 'object':
|
|
57
|
+
return isObject(value);
|
|
58
|
+
case 'array':
|
|
59
|
+
return Array.isArray(value);
|
|
60
|
+
case 'string':
|
|
61
|
+
return typeof value === 'string';
|
|
62
|
+
case 'number':
|
|
63
|
+
return typeof value === 'number';
|
|
64
|
+
case 'integer':
|
|
65
|
+
return typeof value === 'number' && Number.isInteger(value);
|
|
66
|
+
case 'boolean':
|
|
67
|
+
return typeof value === 'boolean';
|
|
68
|
+
case 'null':
|
|
69
|
+
return value === null;
|
|
70
|
+
default:
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Whether a value could be a branch: its type matches and it has every required property. */
|
|
75
|
+
function branchAccepts(branch, value) {
|
|
76
|
+
if (!typeMatches(effectiveType(branch), value)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const required = branch.required ?? [];
|
|
80
|
+
return required.length === 0 || (isObject(value) && required.every((name) => name in value));
|
|
81
|
+
}
|
|
82
|
+
/** Whether a branch's discriminator property pins `tag` with a `const` or `enum`. */
|
|
83
|
+
function discriminatorMatches(branch, propertyName, tag) {
|
|
84
|
+
const property = branch.properties?.[propertyName];
|
|
85
|
+
if (property === undefined) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const same = (member) => JSON.stringify(member) === JSON.stringify(tag);
|
|
89
|
+
return (property.const !== undefined && same(property.const)) || (property.enum ?? []).some(same);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The branch the value is: the one its discriminator names, else the accepting branch whose declared
|
|
93
|
+
* properties cover most of the value's keys (the first on a tie), else 0.
|
|
94
|
+
*/
|
|
95
|
+
function chosenBranch(schema, value) {
|
|
96
|
+
const branches = branchesOf(schema).map((_, index) => branchSchema(schema, index));
|
|
97
|
+
const propertyName = schema.discriminator?.propertyName;
|
|
98
|
+
if (propertyName !== undefined && isObject(value) && value[propertyName] !== undefined) {
|
|
99
|
+
const tag = value[propertyName];
|
|
100
|
+
const named = branches.findIndex((branch) => discriminatorMatches(branch, propertyName, tag));
|
|
101
|
+
if (named !== -1) {
|
|
102
|
+
return named;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let best = -1;
|
|
106
|
+
let bestCovered = -1;
|
|
107
|
+
branches.forEach((branch, index) => {
|
|
108
|
+
if (!branchAccepts(branch, value)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const declared = branch.properties ?? {};
|
|
112
|
+
const covered = isObject(value) ? Object.keys(value).filter((key) => Object.hasOwn(declared, key)).length : 0;
|
|
113
|
+
if (covered > bestCovered) {
|
|
114
|
+
best = index;
|
|
115
|
+
bestCovered = covered;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return best === -1 ? 0 : best;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The form tree for a value under a schema.
|
|
122
|
+
*
|
|
123
|
+
* @param schema the dereferenced schema (it may be cyclic)
|
|
124
|
+
* @param value the current body value, `undefined` when there is none
|
|
125
|
+
*/
|
|
126
|
+
export function buildJsonForm(schema, value, options = {}) {
|
|
127
|
+
return build(schema, value, { id: '', name: '', required: true, depth: 0 }, options.maxDepth ?? MAX_SAMPLE_DEPTH);
|
|
128
|
+
}
|
|
129
|
+
function anyNode(place, value, schema) {
|
|
130
|
+
return {
|
|
131
|
+
...common(schema ?? {}, place, value),
|
|
132
|
+
kind: 'any',
|
|
133
|
+
...(value !== undefined ? { value } : {}),
|
|
134
|
+
children: [],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function common(schema, place, value) {
|
|
138
|
+
return {
|
|
139
|
+
id: place.id,
|
|
140
|
+
name: place.name,
|
|
141
|
+
label: schema.title ?? place.name,
|
|
142
|
+
...(schema.description !== undefined ? { description: schema.description } : {}),
|
|
143
|
+
required: place.required,
|
|
144
|
+
present: value !== undefined,
|
|
145
|
+
...(schema.readOnly === true ? { readOnly: true } : {}),
|
|
146
|
+
...(schema.deprecated === true ? { deprecated: true } : {}),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function build(input, value, place, maxDepth) {
|
|
150
|
+
if (place.depth >= maxDepth) {
|
|
151
|
+
return anyNode(place, value, input);
|
|
152
|
+
}
|
|
153
|
+
const schema = mergeAllOf(input);
|
|
154
|
+
const branches = branchesOf(schema);
|
|
155
|
+
if (branches.length > 0) {
|
|
156
|
+
const chosen = chosenBranch(schema, value);
|
|
157
|
+
return {
|
|
158
|
+
...common(schema, place, value),
|
|
159
|
+
kind: 'choice',
|
|
160
|
+
choices: branches.map((branch, index) => branch.title ?? `Option ${index + 1}`),
|
|
161
|
+
chosen,
|
|
162
|
+
children: [build(branchSchema(schema, chosen), value, { ...place, depth: place.depth + 1 }, maxDepth)],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const type = effectiveType(schema) ?? inferredEnumType(schema);
|
|
166
|
+
if (type === 'object') {
|
|
167
|
+
return value === undefined || isObject(value)
|
|
168
|
+
? { ...common(schema, place, value), kind: 'object', children: objectChildren(schema, value, place, maxDepth) }
|
|
169
|
+
: anyNode(place, value, schema);
|
|
170
|
+
}
|
|
171
|
+
if (type === 'array') {
|
|
172
|
+
if (value !== undefined && !Array.isArray(value)) {
|
|
173
|
+
return anyNode(place, value, schema);
|
|
174
|
+
}
|
|
175
|
+
const items = value ?? [];
|
|
176
|
+
return {
|
|
177
|
+
...common(schema, place, value),
|
|
178
|
+
kind: 'array',
|
|
179
|
+
children: items.map((item, index) => build(schema.items ?? {}, item, { id: `${place.id}/${index}`, name: String(index), required: false, depth: place.depth + 1 }, maxDepth)),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (type !== undefined && VALUE_TYPES.has(type)) {
|
|
183
|
+
return {
|
|
184
|
+
...common(schema, place, value),
|
|
185
|
+
kind: 'field',
|
|
186
|
+
valueType: type,
|
|
187
|
+
...(schema.format !== undefined ? { format: schema.format } : {}),
|
|
188
|
+
...(schema.enum !== undefined ? { enum: schema.enum } : {}),
|
|
189
|
+
...(allowsNull(schema) ? { nullable: true } : {}),
|
|
190
|
+
...(value !== undefined ? { value } : {}),
|
|
191
|
+
children: [],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return anyNode(place, value, schema);
|
|
195
|
+
}
|
|
196
|
+
/** Whether a schema allows `null`, in either specification's spelling. */
|
|
197
|
+
function allowsNull(schema) {
|
|
198
|
+
return schema.nullable === true || (Array.isArray(schema.type) && schema.type.includes('null'));
|
|
199
|
+
}
|
|
200
|
+
/** A type-less enum still reads as a field of its members' type. */
|
|
201
|
+
function inferredEnumType(schema) {
|
|
202
|
+
const first = schema.enum?.[0];
|
|
203
|
+
if (first === undefined) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
if (first === null) {
|
|
207
|
+
return 'null';
|
|
208
|
+
}
|
|
209
|
+
return typeof first === 'object' ? undefined : typeof first;
|
|
210
|
+
}
|
|
211
|
+
function objectChildren(schema, value, place, maxDepth) {
|
|
212
|
+
// An absent object has nothing to show inside it; descending anyway would walk a cyclic schema
|
|
213
|
+
// breadth-first to the depth limit.
|
|
214
|
+
if (value === undefined) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
const required = new Set(schema.required ?? []);
|
|
218
|
+
const declared = schema.properties ?? {};
|
|
219
|
+
const childPlace = (name) => ({
|
|
220
|
+
id: `${place.id}/${escapeSegment(name)}`,
|
|
221
|
+
name,
|
|
222
|
+
required: required.has(name),
|
|
223
|
+
depth: place.depth + 1,
|
|
224
|
+
});
|
|
225
|
+
const children = Object.entries(declared).map(([name, property]) => build(property, value[name], childPlace(name), maxDepth));
|
|
226
|
+
const additional = schema.additionalProperties;
|
|
227
|
+
if (additional !== false) {
|
|
228
|
+
for (const [name, extra] of Object.entries(value)) {
|
|
229
|
+
if (Object.hasOwn(declared, name)) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
children.push(typeof additional === 'object'
|
|
233
|
+
? build(additional, extra, childPlace(name), maxDepth)
|
|
234
|
+
: anyNode(childPlace(name), extra));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return children;
|
|
238
|
+
}
|
|
239
|
+
/** The schema that describes the value at `segments`, following the value through choices. */
|
|
240
|
+
function schemaAt(root, value, segments) {
|
|
241
|
+
let schema = root;
|
|
242
|
+
let current = value;
|
|
243
|
+
for (const segment of segments) {
|
|
244
|
+
let resolved = mergeAllOf(schema);
|
|
245
|
+
if (branchesOf(resolved).length > 0) {
|
|
246
|
+
resolved = branchSchema(resolved, chosenBranch(resolved, current));
|
|
247
|
+
}
|
|
248
|
+
if (Array.isArray(current) || (current === undefined && effectiveType(resolved) === 'array')) {
|
|
249
|
+
schema = resolved.items ?? {};
|
|
250
|
+
current = Array.isArray(current) ? current[Number(segment)] : undefined;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const additional = resolved.additionalProperties;
|
|
254
|
+
schema = resolved.properties?.[segment] ?? (typeof additional === 'object' ? additional : {});
|
|
255
|
+
current = isObject(current) ? current[segment] : undefined;
|
|
256
|
+
}
|
|
257
|
+
return schema;
|
|
258
|
+
}
|
|
259
|
+
function getAt(value, segments) {
|
|
260
|
+
let current = value;
|
|
261
|
+
for (const segment of segments) {
|
|
262
|
+
if (Array.isArray(current)) {
|
|
263
|
+
current = current[Number(segment)];
|
|
264
|
+
}
|
|
265
|
+
else if (isObject(current)) {
|
|
266
|
+
current = current[segment];
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return undefined;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return current;
|
|
273
|
+
}
|
|
274
|
+
/** A copy of `value` with `replacement` at `segments`; `undefined` removes. Missing parents become objects. */
|
|
275
|
+
function updateAt(value, segments, replacement) {
|
|
276
|
+
if (segments.length === 0) {
|
|
277
|
+
return replacement;
|
|
278
|
+
}
|
|
279
|
+
const [head, ...rest] = segments;
|
|
280
|
+
if (Array.isArray(value)) {
|
|
281
|
+
const items = [...value];
|
|
282
|
+
const index = head === '-' ? items.length : Number(head);
|
|
283
|
+
const next = updateAt(items[index], rest, replacement);
|
|
284
|
+
if (next === undefined) {
|
|
285
|
+
items.splice(index, 1);
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
items[index] = next;
|
|
289
|
+
}
|
|
290
|
+
return items;
|
|
291
|
+
}
|
|
292
|
+
const object = isObject(value) ? { ...value } : {};
|
|
293
|
+
const next = updateAt(object[head], rest, replacement);
|
|
294
|
+
if (next === undefined) {
|
|
295
|
+
delete object[head];
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
object[head] = next;
|
|
299
|
+
}
|
|
300
|
+
return object;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The body value after one form edit. Nothing is mutated; properties the schema does not declare
|
|
304
|
+
* are carried over untouched.
|
|
305
|
+
*/
|
|
306
|
+
export function applyJsonFormEdit(schema, value, edit) {
|
|
307
|
+
const segments = parsePointer(edit.id);
|
|
308
|
+
const put = (replacement) => updateAt(value, segments, replacement) ?? null;
|
|
309
|
+
switch (edit.kind) {
|
|
310
|
+
case 'set-value':
|
|
311
|
+
return put(edit.value);
|
|
312
|
+
case 'insert-optional':
|
|
313
|
+
return put(sampleFromSchema(schemaAt(schema, value, segments)));
|
|
314
|
+
case 'remove':
|
|
315
|
+
return segments.length === 0 ? null : put(undefined);
|
|
316
|
+
case 'add-item': {
|
|
317
|
+
const existing = getAt(value, segments);
|
|
318
|
+
const items = Array.isArray(existing) ? existing : [];
|
|
319
|
+
let arraySchema = mergeAllOf(schemaAt(schema, value, segments));
|
|
320
|
+
if (branchesOf(arraySchema).length > 0) {
|
|
321
|
+
arraySchema = branchSchema(arraySchema, chosenBranch(arraySchema, existing));
|
|
322
|
+
}
|
|
323
|
+
return put([...items, sampleFromSchema(arraySchema.items ?? {})]);
|
|
324
|
+
}
|
|
325
|
+
case 'select-choice': {
|
|
326
|
+
const choice = mergeAllOf(schemaAt(schema, value, segments));
|
|
327
|
+
const branch = branchSchema(choice, edit.index);
|
|
328
|
+
// A sample of only the required properties can look like an earlier branch (two branches with
|
|
329
|
+
// nothing required both sample as `{}`); the optional ones are what tell it apart then.
|
|
330
|
+
const sample = sampleFromSchema(branch);
|
|
331
|
+
return put(chosenBranch(choice, sample) === edit.index ? sample : sampleFromSchema(branch, { includeOptional: true }));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* An acyclic copy of a schema, cut at `maxDepth` (and at a total node budget) with `{}` — "any
|
|
337
|
+
* value". What crosses a structured-clone or JSON boundary to the renderer.
|
|
338
|
+
*/
|
|
339
|
+
export function toWireSchema(schema, maxDepth = MAX_SAMPLE_DEPTH) {
|
|
340
|
+
return copySchema(schema, maxDepth, { remaining: MAX_SAMPLE_NODES });
|
|
341
|
+
}
|
|
342
|
+
/** Keys copied as they are: plain data the form and the sample generator read. */
|
|
343
|
+
const WIRE_SCALAR_KEYS = [
|
|
344
|
+
'type',
|
|
345
|
+
'format',
|
|
346
|
+
'title',
|
|
347
|
+
'description',
|
|
348
|
+
'default',
|
|
349
|
+
'example',
|
|
350
|
+
'examples',
|
|
351
|
+
'enum',
|
|
352
|
+
'const',
|
|
353
|
+
'required',
|
|
354
|
+
'discriminator',
|
|
355
|
+
'nullable',
|
|
356
|
+
'deprecated',
|
|
357
|
+
'readOnly',
|
|
358
|
+
'writeOnly',
|
|
359
|
+
'xml',
|
|
360
|
+
'$ref',
|
|
361
|
+
];
|
|
362
|
+
/**
|
|
363
|
+
* Only the keys the form and the sample read survive; anything else (`not`, `prefixItems`,
|
|
364
|
+
* `if`/`then`/`else`, …) is dropped, since it could hold a subschema — even a cycle — this copy
|
|
365
|
+
* would otherwise pass along by reference.
|
|
366
|
+
*/
|
|
367
|
+
function copySchema(schema, depth, budget) {
|
|
368
|
+
if (depth <= 0 || budget.remaining <= 0) {
|
|
369
|
+
return {};
|
|
370
|
+
}
|
|
371
|
+
budget.remaining -= 1;
|
|
372
|
+
const copy = {};
|
|
373
|
+
for (const key of WIRE_SCALAR_KEYS) {
|
|
374
|
+
if (schema[key] !== undefined) {
|
|
375
|
+
copy[key] = schema[key];
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const next = (child) => copySchema(child, depth - 1, budget);
|
|
379
|
+
if (schema.properties !== undefined) {
|
|
380
|
+
copy.properties = Object.fromEntries(Object.entries(schema.properties).map(([name, child]) => [name, next(child)]));
|
|
381
|
+
}
|
|
382
|
+
if (schema.items !== undefined) {
|
|
383
|
+
copy.items = next(schema.items);
|
|
384
|
+
}
|
|
385
|
+
if (schema.additionalProperties !== undefined) {
|
|
386
|
+
copy.additionalProperties =
|
|
387
|
+
typeof schema.additionalProperties === 'object' ? next(schema.additionalProperties) : schema.additionalProperties;
|
|
388
|
+
}
|
|
389
|
+
for (const key of ['allOf', 'oneOf', 'anyOf']) {
|
|
390
|
+
const branches = schema[key];
|
|
391
|
+
if (branches !== undefined) {
|
|
392
|
+
copy[key] = branches.map(next);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return copy;
|
|
396
|
+
}
|
package/dist/rest/model.d.ts
CHANGED
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
* `'soap'` on an interface; `'grpc'` is reserved and refused by the loader (see `project/schema.ts`).
|
|
13
13
|
*/
|
|
14
14
|
import type { Assertion } from '../assert/model.js';
|
|
15
|
-
import type {
|
|
15
|
+
import type { KeyValueEntry } from '../http/entries.js';
|
|
16
|
+
import type { RawLanguage } from '../http/escape.js';
|
|
17
|
+
import type { RequestScripts } from '../script/model.js';
|
|
18
|
+
import type { AttachmentSource, AuthConfig, CreateOptions, DefinitionAuth, IdGenerator } from '../project/model.js';
|
|
19
|
+
import type { HookLink, WebhookSigning } from '../webhooks/model.js';
|
|
16
20
|
/**
|
|
17
21
|
* An HTTP method. The seven a REST client needs are spelled out so the common case is
|
|
18
22
|
* autocompleted and checked; a service that wants `PURGE`, `LOCK` or `REPORT` is not told it is
|
|
@@ -21,28 +25,8 @@ import type { AttachmentSource, AuthConfig, CreateOptions, IdGenerator } from '.
|
|
|
21
25
|
export type RestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | (string & {});
|
|
22
26
|
/** The methods the editor offers by name, in the order it offers them. */
|
|
23
27
|
export declare const COMMON_METHODS: readonly RestMethod[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* in the next send. Rows keep author order and may repeat a name — two `X-Trace` headers and two
|
|
27
|
-
* `tag=` parameters are both legal on the wire, so neither is deduplicated here.
|
|
28
|
-
*
|
|
29
|
-
* `enabled` is always present in memory and written to disk only when `false`, so a file stays
|
|
30
|
-
* quiet about the common case (see `project/serialize.ts`).
|
|
31
|
-
*/
|
|
32
|
-
export interface KeyValueEntry {
|
|
33
|
-
readonly name: string;
|
|
34
|
-
readonly value: string;
|
|
35
|
-
readonly enabled: boolean;
|
|
36
|
-
/** Free-form note, carried over from an imported definition's parameter description. */
|
|
37
|
-
readonly description?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Creates an enabled {@link KeyValueEntry}. */
|
|
40
|
-
export declare function entry(name: string, value: string, options?: {
|
|
41
|
-
readonly enabled?: boolean;
|
|
42
|
-
readonly description?: string;
|
|
43
|
-
}): KeyValueEntry;
|
|
44
|
-
/** The languages a raw body can be edited and sent as. Picks the editor mode and a default type. */
|
|
45
|
-
export type RawLanguage = 'json' | 'xml' | 'text' | 'html' | 'javascript';
|
|
28
|
+
export { entry } from '../http/entries.js';
|
|
29
|
+
export type { KeyValueEntry, RawLanguage };
|
|
46
30
|
/** The `Content-Type` each {@link RawLanguage} implies when the request sets no header itself. */
|
|
47
31
|
export declare const RAW_LANGUAGE_CONTENT_TYPES: Readonly<Record<RawLanguage, string>>;
|
|
48
32
|
/** The file extension a raw body of each language is stored under, beside its request file. */
|
|
@@ -99,7 +83,7 @@ export declare const NO_BODY: RestBody;
|
|
|
99
83
|
/**
|
|
100
84
|
* Per-request transport settings. Every field is optional and an absent one means *inherit*, not
|
|
101
85
|
* *off*: the send resolves request → API → project → preference, exactly as a SOAP request's
|
|
102
|
-
* properties do (`send-
|
|
86
|
+
* properties do (`send-input.ts`).
|
|
103
87
|
*/
|
|
104
88
|
export interface RestRequestSettings {
|
|
105
89
|
readonly timeoutMs?: number;
|
|
@@ -153,6 +137,28 @@ export interface RestRequestDef {
|
|
|
153
137
|
* a re-import; the request survives badged.
|
|
154
138
|
*/
|
|
155
139
|
readonly orphaned?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The operation of the API's definition this request calls: its lower-case method and its path as
|
|
142
|
+
* the definition spells it (`/pets/{petId}`). Set by an import, kept by edits; absent when unknown.
|
|
143
|
+
*/
|
|
144
|
+
readonly contract?: RestContractLink;
|
|
145
|
+
/**
|
|
146
|
+
* Set only on an item of a project's webhook collection that was imported from an OpenAPI
|
|
147
|
+
* `webhooks` or `callbacks` entry: which one, so *Update definition* can keep it in step.
|
|
148
|
+
*/
|
|
149
|
+
readonly hook?: HookLink;
|
|
150
|
+
/**
|
|
151
|
+
* Only on an item of a project's webhook collection: how it signs what it sends, overriding its
|
|
152
|
+
* folders and the collection (spec `2026-09-29-…-webhook-signatures-design.md` §5.1).
|
|
153
|
+
*/
|
|
154
|
+
readonly signing?: WebhookSigning;
|
|
155
|
+
/** Pre-request and post-response scripts, in files beside the request (#63). */
|
|
156
|
+
readonly scripts?: RequestScripts;
|
|
157
|
+
}
|
|
158
|
+
/** A request's link to an operation of its API's definition. */
|
|
159
|
+
export interface RestContractLink {
|
|
160
|
+
readonly method: string;
|
|
161
|
+
readonly path: string;
|
|
156
162
|
}
|
|
157
163
|
/** A named node in an API's tree, holding folders and requests. */
|
|
158
164
|
export interface RestFolder {
|
|
@@ -178,6 +184,8 @@ export interface RestDefinitionRef {
|
|
|
178
184
|
readonly cache: boolean;
|
|
179
185
|
/** The OpenAPI version of the document, as it declared itself (e.g. `3.1.0`). */
|
|
180
186
|
readonly version: string;
|
|
187
|
+
/** Credentials the document is fetched with, sent to the source's own origin only. */
|
|
188
|
+
readonly auth?: DefinitionAuth;
|
|
181
189
|
}
|
|
182
190
|
/** A REST API: a base URL, default credentials, and a tree of folders and requests. */
|
|
183
191
|
export interface RestApi {
|
|
@@ -234,6 +242,9 @@ export interface CreateRestRequestInput extends CreateOptions {
|
|
|
234
242
|
readonly body?: RestBody;
|
|
235
243
|
readonly auth?: AuthConfig;
|
|
236
244
|
readonly settings?: RestRequestSettings;
|
|
245
|
+
readonly contract?: RestContractLink;
|
|
246
|
+
readonly hook?: HookLink;
|
|
247
|
+
readonly signing?: WebhookSigning;
|
|
237
248
|
}
|
|
238
249
|
/** Creates a `GET` request with an empty URL, no body and inherited credentials. */
|
|
239
250
|
export declare function createRestRequest(name: string, input?: CreateRestRequestInput): RestRequestDef;
|
package/dist/rest/model.js
CHANGED
|
@@ -23,15 +23,9 @@ export const COMMON_METHODS = Object.freeze([
|
|
|
23
23
|
'HEAD',
|
|
24
24
|
'OPTIONS',
|
|
25
25
|
]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
name,
|
|
30
|
-
value,
|
|
31
|
-
enabled: options?.enabled ?? true,
|
|
32
|
-
...(options?.description !== undefined ? { description: options.description } : {}),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
26
|
+
// Declared in `http/`, which the gRPC and WebSocket folders share with this one; re-exported so REST
|
|
27
|
+
// code and the public exports keep reading them from here.
|
|
28
|
+
export { entry } from '../http/entries.js';
|
|
35
29
|
/** The `Content-Type` each {@link RawLanguage} implies when the request sets no header itself. */
|
|
36
30
|
export const RAW_LANGUAGE_CONTENT_TYPES = Object.freeze({
|
|
37
31
|
json: 'application/json',
|
|
@@ -101,6 +95,9 @@ export function createRestRequest(name, input = {}) {
|
|
|
101
95
|
auth: input.auth ?? { type: 'inherit' },
|
|
102
96
|
settings: input.settings ?? {},
|
|
103
97
|
assertions: [],
|
|
98
|
+
...(input.contract !== undefined ? { contract: { method: input.contract.method, path: input.contract.path } } : {}),
|
|
99
|
+
...(input.hook !== undefined ? { hook: { ...input.hook } } : {}),
|
|
100
|
+
...(input.signing !== undefined ? { signing: input.signing } : {}),
|
|
104
101
|
};
|
|
105
102
|
}
|
|
106
103
|
/** Every request in `folder` and, depth-first, in the folders below it. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** REST as a protocol module (spec §3). */
|
|
2
|
+
import { defineProtocol } from '../protocol/module.js';
|
|
3
|
+
import { restRun } from './run.js';
|
|
4
|
+
import { restScripting } from './scripting.js';
|
|
5
|
+
import { restStorage } from './storage.js';
|
|
6
|
+
/** The REST protocol: APIs, their folders and requests, and the project's webhook items. */
|
|
7
|
+
export const restProtocol = defineProtocol({
|
|
8
|
+
kind: 'rest',
|
|
9
|
+
feature: { id: 'rest', title: 'REST', default: true, stage: 'stable', requires: [] },
|
|
10
|
+
storage: restStorage,
|
|
11
|
+
run: restRun,
|
|
12
|
+
scripting: restScripting,
|
|
13
|
+
});
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { FsLike } from '../../project/fs.js';
|
|
11
11
|
import type { ApiDefinitionCacheManifest } from '../../project/schema.js';
|
|
12
|
-
import type { FetchDocument } from '../../
|
|
13
|
-
import type { ResolvedDocument } from '
|
|
12
|
+
import type { FetchDocument } from '../../http/fetch-document.js';
|
|
13
|
+
import type { ResolvedDocument } from '../../json/schema/refs.js';
|
|
14
14
|
/** Options accepted by the read and write halves. */
|
|
15
15
|
export interface ApiDefinitionCacheOptions {
|
|
16
16
|
/** Overrides the file system, e.g. for tests. Defaults to `nodeFs`. */
|
|
@@ -22,6 +22,11 @@ export interface WriteApiDefinitionCacheOptions extends ApiDefinitionCacheOption
|
|
|
22
22
|
readonly now?: () => string;
|
|
23
23
|
/** The `openapi` string the root document declared, recorded for the definition card. */
|
|
24
24
|
readonly declaredVersion?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The name the root document is cached under when its own location gives none. Defaults to
|
|
27
|
+
* `openapi.yaml`; an AsyncAPI import passes `asyncapi.yaml`.
|
|
28
|
+
*/
|
|
29
|
+
readonly rootFile?: string;
|
|
25
30
|
}
|
|
26
31
|
/**
|
|
27
32
|
* Writes every document byte-exact into `dir` (created if needed) alongside a `manifest.yaml`, and
|
|
@@ -13,7 +13,7 @@ import { ProjectError } from '../../errors.js';
|
|
|
13
13
|
import { nodeFs, readFileIfExists, readdirIfExists, writeFileAtomic } from '../../project/fs.js';
|
|
14
14
|
import { apiDefinitionCacheManifestSchema, parseFile } from '../../project/schema.js';
|
|
15
15
|
import { parseYaml, stringifyYaml } from '../../project/yaml.js';
|
|
16
|
-
import { assignFileNames } from '../../
|
|
16
|
+
import { assignFileNames } from '../../project/cache-naming.js';
|
|
17
17
|
const MANIFEST_FILE = 'manifest.yaml';
|
|
18
18
|
function sha256Hex(bytes) {
|
|
19
19
|
return createHash('sha256').update(bytes).digest('hex');
|
|
@@ -41,7 +41,7 @@ export async function writeApiDefinitionCache(documents, dir, options) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
const existing = await readdirIfExists(fs, dir);
|
|
44
|
-
const named = assignFileNames(documents.map((document) => ({ ...document, kind: kindOf(document.text) })), { rootFile: 'openapi.yaml' });
|
|
44
|
+
const named = assignFileNames(documents.map((document) => ({ ...document, kind: kindOf(document.text) })), { rootFile: options?.rootFile ?? 'openapi.yaml' });
|
|
45
45
|
const entries = named.map(({ document, file }) => ({
|
|
46
46
|
file,
|
|
47
47
|
location: document.location,
|