@wirebench/engine 2.1.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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/assert/contract.d.ts +3 -0
- package/dist/assert/contract.js +17 -0
- package/dist/assert/index.d.ts +4 -0
- package/dist/assert/index.js +27 -0
- package/dist/assert/match.d.ts +3 -0
- package/dist/assert/match.js +58 -0
- package/dist/assert/model.d.ts +73 -0
- package/dist/assert/model.js +8 -0
- package/dist/assert/schema.d.ts +34 -0
- package/dist/assert/schema.js +46 -0
- package/dist/assert/sla.d.ts +3 -0
- package/dist/assert/sla.js +8 -0
- package/dist/assert/soap-fault.d.ts +3 -0
- package/dist/assert/soap-fault.js +20 -0
- package/dist/assert/status.d.ts +3 -0
- package/dist/assert/status.js +14 -0
- package/dist/errors.d.ts +77 -0
- package/dist/errors.js +121 -0
- package/dist/fs.d.ts +35 -0
- package/dist/fs.js +64 -0
- package/dist/generate.d.ts +12 -0
- package/dist/generate.js +14 -0
- package/dist/grpc/browser.d.ts +11 -0
- package/dist/grpc/browser.js +9 -0
- package/dist/grpc/cache.d.ts +113 -0
- package/dist/grpc/cache.js +244 -0
- package/dist/grpc/call.d.ts +64 -0
- package/dist/grpc/call.js +72 -0
- package/dist/grpc/codec.d.ts +29 -0
- package/dist/grpc/codec.js +416 -0
- package/dist/grpc/command.d.ts +23 -0
- package/dist/grpc/command.js +91 -0
- package/dist/grpc/expand.d.ts +25 -0
- package/dist/grpc/expand.js +52 -0
- package/dist/grpc/framing.d.ts +28 -0
- package/dist/grpc/framing.js +61 -0
- package/dist/grpc/import.d.ts +47 -0
- package/dist/grpc/import.js +88 -0
- package/dist/grpc/model.d.ts +179 -0
- package/dist/grpc/model.js +91 -0
- package/dist/grpc/proto/describe.d.ts +92 -0
- package/dist/grpc/proto/describe.js +205 -0
- package/dist/grpc/proto/load.d.ts +35 -0
- package/dist/grpc/proto/load.js +112 -0
- package/dist/grpc/proto/sample.d.ts +21 -0
- package/dist/grpc/proto/sample.js +79 -0
- package/dist/grpc/proto/well-known.d.ts +42 -0
- package/dist/grpc/proto/well-known.js +143 -0
- package/dist/grpc/reconcile.d.ts +42 -0
- package/dist/grpc/reconcile.js +153 -0
- package/dist/grpc/reflection/client.d.ts +70 -0
- package/dist/grpc/reflection/client.js +197 -0
- package/dist/grpc/reflection/descriptors.d.ts +69 -0
- package/dist/grpc/reflection/descriptors.js +140 -0
- package/dist/grpc/reflection/proto.d.ts +33 -0
- package/dist/grpc/reflection/proto.js +144 -0
- package/dist/grpc/send.d.ts +132 -0
- package/dist/grpc/send.js +435 -0
- package/dist/grpc/shape.d.ts +29 -0
- package/dist/grpc/shape.js +36 -0
- package/dist/grpc/status.d.ts +21 -0
- package/dist/grpc/status.js +62 -0
- package/dist/grpc/target.d.ts +21 -0
- package/dist/grpc/target.js +66 -0
- package/dist/http/auth/apply.d.ts +37 -0
- package/dist/http/auth/apply.js +74 -0
- package/dist/http/auth/basic.d.ts +36 -0
- package/dist/http/auth/basic.js +69 -0
- package/dist/http/auth/md4.d.ts +13 -0
- package/dist/http/auth/md4.js +81 -0
- package/dist/http/auth/ntlm-transport.d.ts +61 -0
- package/dist/http/auth/ntlm-transport.js +97 -0
- package/dist/http/auth/ntlm.d.ts +190 -0
- package/dist/http/auth/ntlm.js +377 -0
- package/dist/http/client.d.ts +73 -0
- package/dist/http/client.js +403 -0
- package/dist/http/curl-flags.d.ts +15 -0
- package/dist/http/curl-flags.js +95 -0
- package/dist/http/curl.d.ts +94 -0
- package/dist/http/curl.js +245 -0
- package/dist/http/decompress.d.ts +7 -0
- package/dist/http/decompress.js +22 -0
- package/dist/http/errors.d.ts +22 -0
- package/dist/http/errors.js +144 -0
- package/dist/http/failed-request.d.ts +27 -0
- package/dist/http/failed-request.js +48 -0
- package/dist/http/headers.d.ts +15 -0
- package/dist/http/headers.js +50 -0
- package/dist/http/heredoc.d.ts +25 -0
- package/dist/http/heredoc.js +74 -0
- package/dist/http/proxy.d.ts +103 -0
- package/dist/http/proxy.js +168 -0
- package/dist/http/raw-capture.d.ts +23 -0
- package/dist/http/raw-capture.js +57 -0
- package/dist/http/timings.d.ts +79 -0
- package/dist/http/timings.js +212 -0
- package/dist/http/tls.d.ts +111 -0
- package/dist/http/tls.js +167 -0
- package/dist/http/types.d.ts +125 -0
- package/dist/http/types.js +6 -0
- package/dist/import-detect.d.ts +26 -0
- package/dist/import-detect.js +169 -0
- package/dist/import.d.ts +20 -0
- package/dist/import.js +163 -0
- package/dist/index.d.ts +272 -0
- package/dist/index.js +157 -0
- package/dist/json/cursor.d.ts +43 -0
- package/dist/json/cursor.js +168 -0
- package/dist/operations.d.ts +12 -0
- package/dist/operations.js +52 -0
- package/dist/project/attachments-cache.d.ts +80 -0
- package/dist/project/attachments-cache.js +186 -0
- package/dist/project/endpoints.d.ts +23 -0
- package/dist/project/endpoints.js +47 -0
- package/dist/project/environments.d.ts +68 -0
- package/dist/project/environments.js +124 -0
- package/dist/project/fs.d.ts +45 -0
- package/dist/project/fs.js +78 -0
- package/dist/project/history.d.ts +171 -0
- package/dist/project/history.js +179 -0
- package/dist/project/keystores.d.ts +24 -0
- package/dist/project/keystores.js +66 -0
- package/dist/project/load.d.ts +44 -0
- package/dist/project/load.js +634 -0
- package/dist/project/migrate.d.ts +27 -0
- package/dist/project/migrate.js +46 -0
- package/dist/project/model.d.ts +401 -0
- package/dist/project/model.js +126 -0
- package/dist/project/paths.d.ts +134 -0
- package/dist/project/paths.js +259 -0
- package/dist/project/preferences.d.ts +318 -0
- package/dist/project/preferences.js +239 -0
- package/dist/project/properties.d.ts +97 -0
- package/dist/project/properties.js +356 -0
- package/dist/project/save.d.ts +65 -0
- package/dist/project/save.js +295 -0
- package/dist/project/schema.d.ts +1329 -0
- package/dist/project/schema.js +737 -0
- package/dist/project/serialize.d.ts +42 -0
- package/dist/project/serialize.js +385 -0
- package/dist/project/wss-configs.d.ts +40 -0
- package/dist/project/wss-configs.js +142 -0
- package/dist/project/yaml.d.ts +17 -0
- package/dist/project/yaml.js +39 -0
- package/dist/redact/index.d.ts +77 -0
- package/dist/redact/index.js +328 -0
- package/dist/redact/literal.d.ts +12 -0
- package/dist/redact/literal.js +68 -0
- package/dist/rest/auth.d.ts +53 -0
- package/dist/rest/auth.js +80 -0
- package/dist/rest/body.d.ts +61 -0
- package/dist/rest/body.js +184 -0
- package/dist/rest/browser.d.ts +12 -0
- package/dist/rest/browser.js +11 -0
- package/dist/rest/cookies.d.ts +41 -0
- package/dist/rest/cookies.js +102 -0
- package/dist/rest/curl.d.ts +75 -0
- package/dist/rest/curl.js +417 -0
- package/dist/rest/expand.d.ts +35 -0
- package/dist/rest/expand.js +104 -0
- package/dist/rest/model.d.ts +247 -0
- package/dist/rest/model.js +118 -0
- package/dist/rest/oauth2.d.ts +118 -0
- package/dist/rest/oauth2.js +212 -0
- package/dist/rest/openapi/cache.d.ts +54 -0
- package/dist/rest/openapi/cache.js +128 -0
- package/dist/rest/openapi/import.d.ts +67 -0
- package/dist/rest/openapi/import.js +91 -0
- package/dist/rest/openapi/map.d.ts +102 -0
- package/dist/rest/openapi/map.js +477 -0
- package/dist/rest/openapi/model.d.ts +203 -0
- package/dist/rest/openapi/model.js +37 -0
- package/dist/rest/openapi/parse.d.ts +44 -0
- package/dist/rest/openapi/parse.js +1530 -0
- package/dist/rest/openapi/refs.d.ts +63 -0
- package/dist/rest/openapi/refs.js +258 -0
- package/dist/rest/openapi/sample.d.ts +68 -0
- package/dist/rest/openapi/sample.js +336 -0
- package/dist/rest/postman/import.d.ts +21 -0
- package/dist/rest/postman/import.js +47 -0
- package/dist/rest/postman/index.d.ts +7 -0
- package/dist/rest/postman/index.js +7 -0
- package/dist/rest/postman/map.d.ts +28 -0
- package/dist/rest/postman/map.js +427 -0
- package/dist/rest/postman/model.d.ts +118 -0
- package/dist/rest/postman/model.js +7 -0
- package/dist/rest/postman/parse.d.ts +29 -0
- package/dist/rest/postman/parse.js +518 -0
- package/dist/rest/response.d.ts +72 -0
- package/dist/rest/response.js +221 -0
- package/dist/rest/send.d.ts +102 -0
- package/dist/rest/send.js +148 -0
- package/dist/rest/url.d.ts +92 -0
- package/dist/rest/url.js +213 -0
- package/dist/run/effective-auth.d.ts +10 -0
- package/dist/run/effective-auth.js +19 -0
- package/dist/run/index.d.ts +8 -0
- package/dist/run/index.js +4 -0
- package/dist/run/prepare.d.ts +43 -0
- package/dist/run/prepare.js +280 -0
- package/dist/run/run.d.ts +53 -0
- package/dist/run/run.js +223 -0
- package/dist/run/secret-needs.d.ts +13 -0
- package/dist/run/secret-needs.js +125 -0
- package/dist/run/select.d.ts +34 -0
- package/dist/run/select.js +76 -0
- package/dist/secrets/env-names.d.ts +27 -0
- package/dist/secrets/env-names.js +40 -0
- package/dist/secrets/resolve.d.ts +58 -0
- package/dist/secrets/resolve.js +136 -0
- package/dist/send-options.d.ts +141 -0
- package/dist/send-options.js +228 -0
- package/dist/send.d.ts +53 -0
- package/dist/send.js +210 -0
- package/dist/soap/body-builder.d.ts +38 -0
- package/dist/soap/body-builder.js +250 -0
- package/dist/soap/build-problems.d.ts +12 -0
- package/dist/soap/build-problems.js +2 -0
- package/dist/soap/charset.d.ts +23 -0
- package/dist/soap/charset.js +47 -0
- package/dist/soap/envelope.d.ts +44 -0
- package/dist/soap/envelope.js +76 -0
- package/dist/soap/fault.d.ts +46 -0
- package/dist/soap/fault.js +129 -0
- package/dist/soap/form-request.d.ts +34 -0
- package/dist/soap/form-request.js +251 -0
- package/dist/soap/legacy-project/definition-fetcher.d.ts +21 -0
- package/dist/soap/legacy-project/definition-fetcher.js +43 -0
- package/dist/soap/legacy-project/format.d.ts +18 -0
- package/dist/soap/legacy-project/format.js +24 -0
- package/dist/soap/legacy-project/import.d.ts +21 -0
- package/dist/soap/legacy-project/import.js +46 -0
- package/dist/soap/legacy-project/index.d.ts +9 -0
- package/dist/soap/legacy-project/index.js +5 -0
- package/dist/soap/legacy-project/map.d.ts +91 -0
- package/dist/soap/legacy-project/map.js +290 -0
- package/dist/soap/legacy-project/model.d.ts +98 -0
- package/dist/soap/legacy-project/model.js +5 -0
- package/dist/soap/legacy-project/parse.d.ts +16 -0
- package/dist/soap/legacy-project/parse.js +325 -0
- package/dist/soap/mime/cid-scan.d.ts +36 -0
- package/dist/soap/mime/cid-scan.js +52 -0
- package/dist/soap/mime/inline-files.d.ts +39 -0
- package/dist/soap/mime/inline-files.js +71 -0
- package/dist/soap/mime/mtom.d.ts +74 -0
- package/dist/soap/mime/mtom.js +134 -0
- package/dist/soap/mime/multipart.d.ts +66 -0
- package/dist/soap/mime/multipart.js +329 -0
- package/dist/soap/mime/send-pipeline.d.ts +61 -0
- package/dist/soap/mime/send-pipeline.js +145 -0
- package/dist/soap/mime/swa.d.ts +45 -0
- package/dist/soap/mime/swa.js +62 -0
- package/dist/soap/mime/types.d.ts +69 -0
- package/dist/soap/mime/types.js +10 -0
- package/dist/soap/namespace-scope.d.ts +32 -0
- package/dist/soap/namespace-scope.js +85 -0
- package/dist/soap/prefixes.d.ts +24 -0
- package/dist/soap/prefixes.js +70 -0
- package/dist/soap/recreate.d.ts +28 -0
- package/dist/soap/recreate.js +168 -0
- package/dist/soap/request-builder.d.ts +63 -0
- package/dist/soap/request-builder.js +161 -0
- package/dist/soap/response-parser.d.ts +29 -0
- package/dist/soap/response-parser.js +71 -0
- package/dist/soap/soap-action.d.ts +31 -0
- package/dist/soap/soap-action.js +28 -0
- package/dist/soap/transforms.d.ts +52 -0
- package/dist/soap/transforms.js +164 -0
- package/dist/types.d.ts +307 -0
- package/dist/types.js +6 -0
- package/dist/validate/index.d.ts +61 -0
- package/dist/validate/index.js +72 -0
- package/dist/validate/schema-file-set.d.ts +51 -0
- package/dist/validate/schema-file-set.js +288 -0
- package/dist/validate/schema-validator.d.ts +53 -0
- package/dist/validate/schema-validator.js +251 -0
- package/dist/validate/soap-structure.d.ts +34 -0
- package/dist/validate/soap-structure.js +255 -0
- package/dist/validate/types.d.ts +47 -0
- package/dist/validate/types.js +8 -0
- package/dist/validate/wsi/assertions/helpers.d.ts +145 -0
- package/dist/validate/wsi/assertions/helpers.js +387 -0
- package/dist/validate/wsi/assertions/index.d.ts +44 -0
- package/dist/validate/wsi/assertions/index.js +77 -0
- package/dist/validate/wsi/assertions/message/helpers.d.ts +63 -0
- package/dist/validate/wsi/assertions/message/helpers.js +168 -0
- package/dist/validate/wsi/assertions/message/index.d.ts +39 -0
- package/dist/validate/wsi/assertions/message/index.js +62 -0
- package/dist/validate/wsi/assertions/message/r1001.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1001.js +38 -0
- package/dist/validate/wsi/assertions/message/r1003.d.ts +14 -0
- package/dist/validate/wsi/assertions/message/r1003.js +45 -0
- package/dist/validate/wsi/assertions/message/r1005.d.ts +12 -0
- package/dist/validate/wsi/assertions/message/r1005.js +37 -0
- package/dist/validate/wsi/assertions/message/r1006.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1006.js +49 -0
- package/dist/validate/wsi/assertions/message/r1007.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1007.js +30 -0
- package/dist/validate/wsi/assertions/message/r1011.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1011.js +33 -0
- package/dist/validate/wsi/assertions/message/r1012.d.ts +13 -0
- package/dist/validate/wsi/assertions/message/r1012.js +37 -0
- package/dist/validate/wsi/assertions/message/r1013.d.ts +9 -0
- package/dist/validate/wsi/assertions/message/r1013.js +42 -0
- package/dist/validate/wsi/assertions/message/r1014.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1014.js +30 -0
- package/dist/validate/wsi/assertions/message/r1015.d.ts +12 -0
- package/dist/validate/wsi/assertions/message/r1015.js +36 -0
- package/dist/validate/wsi/assertions/message/r1017.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1017.js +30 -0
- package/dist/validate/wsi/assertions/message/r1100.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1100.js +39 -0
- package/dist/validate/wsi/assertions/message/r1101.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1101.js +37 -0
- package/dist/validate/wsi/assertions/message/r1102.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1102.js +41 -0
- package/dist/validate/wsi/assertions/message/r1103.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1103.js +28 -0
- package/dist/validate/wsi/assertions/message/r1107.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1107.js +38 -0
- package/dist/validate/wsi/assertions/message/r1109.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1109.js +32 -0
- package/dist/validate/wsi/assertions/message/r1124.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1124.js +31 -0
- package/dist/validate/wsi/assertions/message/r1132.d.ts +9 -0
- package/dist/validate/wsi/assertions/message/r1132.js +23 -0
- package/dist/validate/wsi/assertions/message/r1140.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1140.js +42 -0
- package/dist/validate/wsi/assertions/message/r1141.d.ts +10 -0
- package/dist/validate/wsi/assertions/message/r1141.js +32 -0
- package/dist/validate/wsi/assertions/message/r2113.d.ts +11 -0
- package/dist/validate/wsi/assertions/message/r2113.js +33 -0
- package/dist/validate/wsi/assertions/message/r2211.d.ts +7 -0
- package/dist/validate/wsi/assertions/message/r2211.js +42 -0
- package/dist/validate/wsi/assertions/r2001.d.ts +15 -0
- package/dist/validate/wsi/assertions/r2001.js +47 -0
- package/dist/validate/wsi/assertions/r2002.d.ts +11 -0
- package/dist/validate/wsi/assertions/r2002.js +38 -0
- package/dist/validate/wsi/assertions/r2003.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2003.js +32 -0
- package/dist/validate/wsi/assertions/r2005.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2005.js +40 -0
- package/dist/validate/wsi/assertions/r2101.d.ts +14 -0
- package/dist/validate/wsi/assertions/r2101.js +65 -0
- package/dist/validate/wsi/assertions/r2102.d.ts +10 -0
- package/dist/validate/wsi/assertions/r2102.js +41 -0
- package/dist/validate/wsi/assertions/r2105.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2105.js +39 -0
- package/dist/validate/wsi/assertions/r2110.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2110.js +38 -0
- package/dist/validate/wsi/assertions/r2111.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2111.js +30 -0
- package/dist/validate/wsi/assertions/r2112.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2112.js +35 -0
- package/dist/validate/wsi/assertions/r2201.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2201.js +28 -0
- package/dist/validate/wsi/assertions/r2203.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2203.js +30 -0
- package/dist/validate/wsi/assertions/r2204.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2204.js +29 -0
- package/dist/validate/wsi/assertions/r2205.d.ts +8 -0
- package/dist/validate/wsi/assertions/r2205.js +46 -0
- package/dist/validate/wsi/assertions/r2206.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2206.js +36 -0
- package/dist/validate/wsi/assertions/r2209.d.ts +12 -0
- package/dist/validate/wsi/assertions/r2209.js +37 -0
- package/dist/validate/wsi/assertions/r2210.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2210.js +30 -0
- package/dist/validate/wsi/assertions/r2303.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2303.js +44 -0
- package/dist/validate/wsi/assertions/r2304.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2304.js +32 -0
- package/dist/validate/wsi/assertions/r2401.d.ts +12 -0
- package/dist/validate/wsi/assertions/r2401.js +31 -0
- package/dist/validate/wsi/assertions/r2701.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2701.js +28 -0
- package/dist/validate/wsi/assertions/r2702.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2702.js +26 -0
- package/dist/validate/wsi/assertions/r2705.d.ts +11 -0
- package/dist/validate/wsi/assertions/r2705.js +31 -0
- package/dist/validate/wsi/assertions/r2706.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2706.js +29 -0
- package/dist/validate/wsi/assertions/r2710.d.ts +13 -0
- package/dist/validate/wsi/assertions/r2710.js +37 -0
- package/dist/validate/wsi/assertions/r2716.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2716.js +29 -0
- package/dist/validate/wsi/assertions/r2717.d.ts +9 -0
- package/dist/validate/wsi/assertions/r2717.js +31 -0
- package/dist/validate/wsi/assertions/r2718.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2718.js +41 -0
- package/dist/validate/wsi/assertions/r2720.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2720.js +29 -0
- package/dist/validate/wsi/assertions/r2721.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2721.js +27 -0
- package/dist/validate/wsi/assertions/r2722.d.ts +6 -0
- package/dist/validate/wsi/assertions/r2722.js +29 -0
- package/dist/validate/wsi/assertions/r2801.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2801.js +39 -0
- package/dist/validate/wsi/assertions/r2803.d.ts +7 -0
- package/dist/validate/wsi/assertions/r2803.js +29 -0
- package/dist/validate/wsi/docs.d.ts +29 -0
- package/dist/validate/wsi/docs.js +167 -0
- package/dist/validate/wsi/index.d.ts +16 -0
- package/dist/validate/wsi/index.js +11 -0
- package/dist/validate/wsi/report-html.d.ts +36 -0
- package/dist/validate/wsi/report-html.js +135 -0
- package/dist/validate/wsi/run-message.d.ts +50 -0
- package/dist/validate/wsi/run-message.js +190 -0
- package/dist/validate/wsi/run-wsdl.d.ts +48 -0
- package/dist/validate/wsi/run-wsdl.js +99 -0
- package/dist/validate/wsi/types.d.ts +173 -0
- package/dist/validate/wsi/types.js +17 -0
- package/dist/workspace/commit-message.d.ts +47 -0
- package/dist/workspace/commit-message.js +195 -0
- package/dist/workspace/environments.d.ts +79 -0
- package/dist/workspace/environments.js +115 -0
- package/dist/workspace/index.d.ts +28 -0
- package/dist/workspace/index.js +19 -0
- package/dist/workspace/load.d.ts +45 -0
- package/dist/workspace/load.js +155 -0
- package/dist/workspace/local-state.d.ts +37 -0
- package/dist/workspace/local-state.js +59 -0
- package/dist/workspace/migrate.d.ts +38 -0
- package/dist/workspace/migrate.js +50 -0
- package/dist/workspace/model.d.ts +86 -0
- package/dist/workspace/model.js +54 -0
- package/dist/workspace/paths.d.ts +64 -0
- package/dist/workspace/paths.js +97 -0
- package/dist/workspace/reidentify.d.ts +22 -0
- package/dist/workspace/reidentify.js +122 -0
- package/dist/workspace/save.d.ts +31 -0
- package/dist/workspace/save.js +84 -0
- package/dist/workspace/schema.d.ts +93 -0
- package/dist/workspace/schema.js +115 -0
- package/dist/workspace/serialize.d.ts +24 -0
- package/dist/workspace/serialize.js +60 -0
- package/dist/workspace/share.d.ts +52 -0
- package/dist/workspace/share.js +89 -0
- package/dist/ws/browser.d.ts +13 -0
- package/dist/ws/browser.js +11 -0
- package/dist/ws/call.d.ts +53 -0
- package/dist/ws/call.js +106 -0
- package/dist/ws/command.d.ts +19 -0
- package/dist/ws/command.js +28 -0
- package/dist/ws/expand.d.ts +38 -0
- package/dist/ws/expand.js +76 -0
- package/dist/ws/model.d.ts +191 -0
- package/dist/ws/model.js +83 -0
- package/dist/ws/pretty.d.ts +12 -0
- package/dist/ws/pretty.js +25 -0
- package/dist/ws/session.d.ts +50 -0
- package/dist/ws/session.js +333 -0
- package/dist/ws/shape.d.ts +18 -0
- package/dist/ws/shape.js +28 -0
- package/dist/ws/transcript.d.ts +14 -0
- package/dist/ws/transcript.js +29 -0
- package/dist/ws/url.d.ts +3 -0
- package/dist/ws/url.js +44 -0
- package/dist/wsa/headers.d.ts +78 -0
- package/dist/wsa/headers.js +244 -0
- package/dist/wsa/model.d.ts +66 -0
- package/dist/wsa/model.js +52 -0
- package/dist/wsa/policy-detect.d.ts +81 -0
- package/dist/wsa/policy-detect.js +245 -0
- package/dist/wsdl/cache-naming.d.ts +39 -0
- package/dist/wsdl/cache-naming.js +90 -0
- package/dist/wsdl/cache.d.ts +48 -0
- package/dist/wsdl/cache.js +141 -0
- package/dist/wsdl/docs-generator.d.ts +47 -0
- package/dist/wsdl/docs-generator.js +439 -0
- package/dist/wsdl/dom-utils.d.ts +15 -0
- package/dist/wsdl/dom-utils.js +50 -0
- package/dist/wsdl/export-definition.d.ts +38 -0
- package/dist/wsdl/export-definition.js +100 -0
- package/dist/wsdl/fetch.d.ts +13 -0
- package/dist/wsdl/fetch.js +60 -0
- package/dist/wsdl/merge.d.ts +17 -0
- package/dist/wsdl/merge.js +57 -0
- package/dist/wsdl/model.d.ts +176 -0
- package/dist/wsdl/model.js +17 -0
- package/dist/wsdl/parse-binding.d.ts +6 -0
- package/dist/wsdl/parse-binding.js +150 -0
- package/dist/wsdl/parse-wsdl.d.ts +47 -0
- package/dist/wsdl/parse-wsdl.js +161 -0
- package/dist/wsdl/qname.d.ts +28 -0
- package/dist/wsdl/qname.js +41 -0
- package/dist/wsdl/ref-policy.d.ts +54 -0
- package/dist/wsdl/ref-policy.js +87 -0
- package/dist/wsdl/resolver.d.ts +81 -0
- package/dist/wsdl/resolver.js +276 -0
- package/dist/wsdl/update-definition.d.ts +106 -0
- package/dist/wsdl/update-definition.js +314 -0
- package/dist/wss/apply.d.ts +40 -0
- package/dist/wss/apply.js +212 -0
- package/dist/wss/c14n-prefixes.d.ts +27 -0
- package/dist/wss/c14n-prefixes.js +95 -0
- package/dist/wss/incoming/decrypt.d.ts +35 -0
- package/dist/wss/incoming/decrypt.js +57 -0
- package/dist/wss/incoming/index.d.ts +56 -0
- package/dist/wss/incoming/index.js +189 -0
- package/dist/wss/incoming/verify.d.ts +74 -0
- package/dist/wss/incoming/verify.js +440 -0
- package/dist/wss/key-identifiers.d.ts +76 -0
- package/dist/wss/key-identifiers.js +139 -0
- package/dist/wss/keystore/certificate.d.ts +45 -0
- package/dist/wss/keystore/certificate.js +134 -0
- package/dist/wss/keystore/index.d.ts +50 -0
- package/dist/wss/keystore/index.js +80 -0
- package/dist/wss/keystore/model.d.ts +83 -0
- package/dist/wss/keystore/model.js +27 -0
- package/dist/wss/keystore/pem.d.ts +21 -0
- package/dist/wss/keystore/pem.js +140 -0
- package/dist/wss/keystore/pkcs12.d.ts +21 -0
- package/dist/wss/keystore/pkcs12.js +125 -0
- package/dist/wss/model.d.ts +160 -0
- package/dist/wss/model.js +37 -0
- package/dist/wss/outgoing/encryption.d.ts +76 -0
- package/dist/wss/outgoing/encryption.js +618 -0
- package/dist/wss/outgoing/signature.d.ts +73 -0
- package/dist/wss/outgoing/signature.js +239 -0
- package/dist/wss/outgoing/timestamp.d.ts +29 -0
- package/dist/wss/outgoing/timestamp.js +39 -0
- package/dist/wss/outgoing/username-token.d.ts +36 -0
- package/dist/wss/outgoing/username-token.js +68 -0
- package/dist/wss/security-header.d.ts +31 -0
- package/dist/wss/security-header.js +83 -0
- package/dist/xml/index.d.ts +7 -0
- package/dist/xml/index.js +7 -0
- package/dist/xml/namespaces.d.ts +36 -0
- package/dist/xml/namespaces.js +60 -0
- package/dist/xml/parse.d.ts +79 -0
- package/dist/xml/parse.js +109 -0
- package/dist/xml/positions.d.ts +26 -0
- package/dist/xml/positions.js +71 -0
- package/dist/xml/pretty.d.ts +37 -0
- package/dist/xml/pretty.js +137 -0
- package/dist/xml/serialize.d.ts +6 -0
- package/dist/xml/serialize.js +8 -0
- package/dist/xml/tolerant-tree.d.ts +56 -0
- package/dist/xml/tolerant-tree.js +134 -0
- package/dist/xpath/evaluate-async.d.ts +31 -0
- package/dist/xpath/evaluate-async.js +81 -0
- package/dist/xpath/evaluate.d.ts +98 -0
- package/dist/xpath/evaluate.js +340 -0
- package/dist/xpath/jsonpath.d.ts +40 -0
- package/dist/xpath/jsonpath.js +109 -0
- package/dist/xpath/namespaces.d.ts +29 -0
- package/dist/xpath/namespaces.js +101 -0
- package/dist/xpath/worker.d.ts +7 -0
- package/dist/xpath/worker.js +26 -0
- package/dist/xsd/builtins.d.ts +36 -0
- package/dist/xsd/builtins.js +108 -0
- package/dist/xsd/check-references.d.ts +25 -0
- package/dist/xsd/check-references.js +145 -0
- package/dist/xsd/form-edits.d.ts +57 -0
- package/dist/xsd/form-edits.js +153 -0
- package/dist/xsd/form-model.d.ts +153 -0
- package/dist/xsd/form-model.js +691 -0
- package/dist/xsd/locate.d.ts +42 -0
- package/dist/xsd/locate.js +249 -0
- package/dist/xsd/model.d.ts +249 -0
- package/dist/xsd/model.js +1 -0
- package/dist/xsd/parse-particles.d.ts +48 -0
- package/dist/xsd/parse-particles.js +320 -0
- package/dist/xsd/parse-schema.d.ts +21 -0
- package/dist/xsd/parse-schema.js +143 -0
- package/dist/xsd/resolve-content.d.ts +18 -0
- package/dist/xsd/resolve-content.js +242 -0
- package/dist/xsd/sample-generator.d.ts +51 -0
- package/dist/xsd/sample-generator.js +291 -0
- package/dist/xsd/sample-types.d.ts +21 -0
- package/dist/xsd/sample-types.js +69 -0
- package/dist/xsd/sample-values.d.ts +54 -0
- package/dist/xsd/sample-values.js +267 -0
- package/dist/xsd/schema-set.d.ts +51 -0
- package/dist/xsd/schema-set.js +203 -0
- package/dist/xsd/xml-scan.d.ts +64 -0
- package/dist/xsd/xml-scan.js +286 -0
- package/dist/xsd/xml-writer.d.ts +56 -0
- package/dist/xsd/xml-writer.js +103 -0
- package/package.json +69 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `share.yaml`: whether (and how) a workspace's tree is shared, kept in the workspace's app-data
|
|
3
|
+
* folder — never inside the tree itself (see `paths.ts`'s `workspaceTreeDir`, spec §4.2). Absent
|
|
4
|
+
* means a local workspace.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors `local-state.ts`'s read/write shape, but unlike that file a corrupt `share.yaml` *is*
|
|
7
|
+
* an error worth surfacing: it names how (and whether) this workspace talks to other machines,
|
|
8
|
+
* so silently treating it as "not shared" would be a data-loss-shaped surprise.
|
|
9
|
+
*/
|
|
10
|
+
import type { FsLike } from '../project/fs.js';
|
|
11
|
+
/** File name of a workspace's share settings, directly under its app-data folder. */
|
|
12
|
+
export declare const WORKSPACE_SHARE_FILE = "share.yaml";
|
|
13
|
+
/** How a workspace's tree is shared. */
|
|
14
|
+
export type ShareKind = 'folder' | 'git' | 'server';
|
|
15
|
+
/** Git-specific share settings, all required once `kind: 'git'` is set (`remote` may still be unset). */
|
|
16
|
+
export interface GitShareSettings {
|
|
17
|
+
readonly remote?: string;
|
|
18
|
+
readonly branch: string;
|
|
19
|
+
readonly autoFetchSeconds: number;
|
|
20
|
+
readonly commitOnSave: boolean;
|
|
21
|
+
readonly pushOnSave: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Defaults a freshly-shared git workspace is given. */
|
|
24
|
+
export declare const DEFAULT_GIT_SHARE_SETTINGS: GitShareSettings;
|
|
25
|
+
/** `share.yaml`, as loaded (or about to be saved). */
|
|
26
|
+
export interface WorkspaceShare {
|
|
27
|
+
readonly version: 1;
|
|
28
|
+
readonly kind: ShareKind;
|
|
29
|
+
/** Absolute path to an externally managed clone/folder; absent means the managed `tree/`. */
|
|
30
|
+
readonly path?: string;
|
|
31
|
+
readonly git?: GitShareSettings;
|
|
32
|
+
readonly server?: {
|
|
33
|
+
readonly url: string;
|
|
34
|
+
readonly workspaceId: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Options shared by {@link loadShare}, {@link saveShare} and {@link deleteShare}. */
|
|
38
|
+
export interface ShareOptions {
|
|
39
|
+
readonly fs?: FsLike;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reads `<dir>/share.yaml`. `undefined` when the file does not exist (a local workspace).
|
|
43
|
+
*
|
|
44
|
+
* @throws WorkspaceError `workspace-file-invalid` when the file exists but is not valid YAML or
|
|
45
|
+
* does not match {@link workspaceShareSchema} (e.g. a relative `path`, or `kind: 'git'` with no
|
|
46
|
+
* `git` block).
|
|
47
|
+
*/
|
|
48
|
+
export declare function loadShare(dir: string, options?: ShareOptions): Promise<WorkspaceShare | undefined>;
|
|
49
|
+
/** Writes `share` to `<dir>/share.yaml` atomically. */
|
|
50
|
+
export declare function saveShare(dir: string, share: WorkspaceShare, options?: ShareOptions): Promise<void>;
|
|
51
|
+
/** Removes `<dir>/share.yaml`, if present — used when a workspace stops being shared. */
|
|
52
|
+
export declare function deleteShare(dir: string, options?: ShareOptions): Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `share.yaml`: whether (and how) a workspace's tree is shared, kept in the workspace's app-data
|
|
3
|
+
* folder — never inside the tree itself (see `paths.ts`'s `workspaceTreeDir`, spec §4.2). Absent
|
|
4
|
+
* means a local workspace.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors `local-state.ts`'s read/write shape, but unlike that file a corrupt `share.yaml` *is*
|
|
7
|
+
* an error worth surfacing: it names how (and whether) this workspace talks to other machines,
|
|
8
|
+
* so silently treating it as "not shared" would be a data-loss-shaped surprise.
|
|
9
|
+
*/
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { parse as parseYamlDocument } from 'yaml';
|
|
12
|
+
import { WorkspaceError } from '../errors.js';
|
|
13
|
+
import { nodeFs, readFileIfExists, writeFileAtomic } from '../project/fs.js';
|
|
14
|
+
import { compact, stringifyYaml } from '../project/yaml.js';
|
|
15
|
+
import { parseWorkspaceFile, workspaceShareSchema } from './schema.js';
|
|
16
|
+
/** File name of a workspace's share settings, directly under its app-data folder. */
|
|
17
|
+
export const WORKSPACE_SHARE_FILE = 'share.yaml';
|
|
18
|
+
/** Defaults a freshly-shared git workspace is given. */
|
|
19
|
+
export const DEFAULT_GIT_SHARE_SETTINGS = {
|
|
20
|
+
branch: 'main',
|
|
21
|
+
autoFetchSeconds: 60,
|
|
22
|
+
commitOnSave: true,
|
|
23
|
+
pushOnSave: true,
|
|
24
|
+
};
|
|
25
|
+
function shareFile(dir) {
|
|
26
|
+
return join(dir, WORKSPACE_SHARE_FILE);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Reads `<dir>/share.yaml`. `undefined` when the file does not exist (a local workspace).
|
|
30
|
+
*
|
|
31
|
+
* @throws WorkspaceError `workspace-file-invalid` when the file exists but is not valid YAML or
|
|
32
|
+
* does not match {@link workspaceShareSchema} (e.g. a relative `path`, or `kind: 'git'` with no
|
|
33
|
+
* `git` block).
|
|
34
|
+
*/
|
|
35
|
+
export async function loadShare(dir, options) {
|
|
36
|
+
const fs = options?.fs ?? nodeFs;
|
|
37
|
+
const path = shareFile(dir);
|
|
38
|
+
const buffer = await readFileIfExists(fs, path);
|
|
39
|
+
if (buffer === undefined) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
let document;
|
|
43
|
+
try {
|
|
44
|
+
document = parseYamlDocument(buffer.toString('utf8'));
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new WorkspaceError('workspace-file-invalid', `Malformed YAML in ${WORKSPACE_SHARE_FILE}`, {
|
|
48
|
+
details: {
|
|
49
|
+
file: WORKSPACE_SHARE_FILE,
|
|
50
|
+
issues: [{ path: '', message: error instanceof Error ? error.message : String(error) }],
|
|
51
|
+
},
|
|
52
|
+
cause: error,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const parsed = parseWorkspaceFile(workspaceShareSchema, document, WORKSPACE_SHARE_FILE);
|
|
56
|
+
return {
|
|
57
|
+
version: parsed.version,
|
|
58
|
+
kind: parsed.kind,
|
|
59
|
+
...(parsed.path !== undefined ? { path: parsed.path } : {}),
|
|
60
|
+
...(parsed.git !== undefined
|
|
61
|
+
? {
|
|
62
|
+
git: {
|
|
63
|
+
branch: parsed.git.branch,
|
|
64
|
+
autoFetchSeconds: parsed.git.autoFetchSeconds,
|
|
65
|
+
commitOnSave: parsed.git.commitOnSave,
|
|
66
|
+
pushOnSave: parsed.git.pushOnSave,
|
|
67
|
+
...(parsed.git.remote !== undefined ? { remote: parsed.git.remote } : {}),
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
: {}),
|
|
71
|
+
...(parsed.server !== undefined ? { server: parsed.server } : {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Writes `share` to `<dir>/share.yaml` atomically. */
|
|
75
|
+
export async function saveShare(dir, share, options) {
|
|
76
|
+
const fs = options?.fs ?? nodeFs;
|
|
77
|
+
await writeFileAtomic(fs, shareFile(dir), stringifyYaml(compact({
|
|
78
|
+
version: share.version,
|
|
79
|
+
kind: share.kind,
|
|
80
|
+
path: share.path,
|
|
81
|
+
git: share.git === undefined ? undefined : compact({ ...share.git }),
|
|
82
|
+
server: share.server === undefined ? undefined : compact({ ...share.server }),
|
|
83
|
+
})));
|
|
84
|
+
}
|
|
85
|
+
/** Removes `<dir>/share.yaml`, if present — used when a workspace stops being shared. */
|
|
86
|
+
export async function deleteShare(dir, options) {
|
|
87
|
+
const fs = options?.fs ?? nodeFs;
|
|
88
|
+
await fs.rm(shareFile(dir), { force: true });
|
|
89
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser-safe face of `ws/`: pure helpers with no Node dependency, reachable from the
|
|
3
|
+
* renderer as `@wirebench/engine/ws` (ESLint allows this subpath and no other). `model.ts` needs
|
|
4
|
+
* `project/paths.js` for its slugs (`node:path`), so only its types are re-exported here — the
|
|
5
|
+
* factories (`createWsApi` and friends) stay engine-side; the tree-walking and file-naming rules
|
|
6
|
+
* come from `shape.ts`, which is node-free, and URL resolution and frame pretty-printing come from
|
|
7
|
+
* `url.ts` and `pretty.ts`, also node-free.
|
|
8
|
+
*/
|
|
9
|
+
export type { CreateWsApiInput, CreateWsFolderInput, CreateWsRequestInput, WsApi, WsDefinitionRef, WsExchange, WsFolder, WsFrame, WsHandshake, WsOpcode, WsRequestDef, WsRequestSettings, WsSavedMessage, } from './model.js';
|
|
10
|
+
export { wsApiFolders, wsApiRequests, wsFolderRequests, wsMessageFileName } from './shape.js';
|
|
11
|
+
export { resolveWsUrl } from './url.js';
|
|
12
|
+
export { prettyFrameText } from './pretty.js';
|
|
13
|
+
export type { PrettyFrameResult } from './pretty.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser-safe face of `ws/`: pure helpers with no Node dependency, reachable from the
|
|
3
|
+
* renderer as `@wirebench/engine/ws` (ESLint allows this subpath and no other). `model.ts` needs
|
|
4
|
+
* `project/paths.js` for its slugs (`node:path`), so only its types are re-exported here — the
|
|
5
|
+
* factories (`createWsApi` and friends) stay engine-side; the tree-walking and file-naming rules
|
|
6
|
+
* come from `shape.ts`, which is node-free, and URL resolution and frame pretty-printing come from
|
|
7
|
+
* `url.ts` and `pretty.ts`, also node-free.
|
|
8
|
+
*/
|
|
9
|
+
export { wsApiFolders, wsApiRequests, wsFolderRequests, wsMessageFileName } from './shape.js';
|
|
10
|
+
export { resolveWsUrl } from './url.js';
|
|
11
|
+
export { prettyFrameText } from './pretty.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a saved WebSocket request, plus the API it belongs to and the credentials the host has
|
|
3
|
+
* already resolved, into the options `openWsSession` takes. Everything here is pure: no socket is
|
|
4
|
+
* opened, nothing is read from disk or the keychain — that is `apiHeaders`, `material.auth` and
|
|
5
|
+
* friends, all handed in already resolved.
|
|
6
|
+
*
|
|
7
|
+
* Layering, in order: API headers first, then the request's own headers (which override the API's
|
|
8
|
+
* by case-insensitive name), then auth (which overrides both). An API key configured "in query"
|
|
9
|
+
* lands in the URL's query string, exactly where REST puts it — `resolveWsUrl` appends it after
|
|
10
|
+
* the request's own query rows.
|
|
11
|
+
*/
|
|
12
|
+
import type { SendAuth } from '../types.js';
|
|
13
|
+
import type { ProxyOptions, TlsOptions } from '../http/types.js';
|
|
14
|
+
import type { WsSessionOptions } from './session.js';
|
|
15
|
+
import type { WsCallInput } from './expand.js';
|
|
16
|
+
export type { WsCallInput } from './expand.js';
|
|
17
|
+
/**
|
|
18
|
+
* Handshake header names undici either refuses or silently mangles when a caller sets them
|
|
19
|
+
* itself: `sec-websocket-key`/`-version` end up sent *twice* (the caller's value and undici's own,
|
|
20
|
+
* comma-joined on the wire — confirmed against `startTestWsServer`, which then sees a malformed
|
|
21
|
+
* `Sec-WebSocket-Version: 99, 13`), `upgrade`/`connection` collide with the ones undici sets to
|
|
22
|
+
* open the connection, and `sec-websocket-protocol` as a plain header does nothing at all — undici
|
|
23
|
+
* only negotiates a subprotocol through its own `protocols` option, which `subprotocols` here
|
|
24
|
+
* becomes. Dropping these rather than throwing keeps a pasted-in header harmless instead of fatal;
|
|
25
|
+
* `sec-websocket-accept` is included for the same reason though it only ever appears in a
|
|
26
|
+
* response, never a request. `host` stays here too: the transport sets it itself from the URL, so
|
|
27
|
+
* a caller-supplied value would only ever be overridden, never honoured.
|
|
28
|
+
*
|
|
29
|
+
* Exported for the unit test only — not part of the package's public surface.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FORBIDDEN_HANDSHAKE_HEADERS: ReadonlySet<string>;
|
|
32
|
+
/**
|
|
33
|
+
* What {@link toWsSessionOptions} additionally accepts beyond the call's own fields. An absent
|
|
34
|
+
* `auth` means no credentials at all — the common case of a request that inherited nothing and
|
|
35
|
+
* configured nothing.
|
|
36
|
+
*/
|
|
37
|
+
export interface WsSessionMaterial {
|
|
38
|
+
readonly auth?: SendAuth;
|
|
39
|
+
readonly tls?: TlsOptions;
|
|
40
|
+
readonly proxy?: ProxyOptions;
|
|
41
|
+
readonly signal?: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds the options `openWsSession` takes from a saved request: URL resolution, header merging,
|
|
45
|
+
* auth, and the request's own transport settings. The project/preference settings ladder (trust
|
|
46
|
+
* store, bind address, timeouts inherited from higher up) is a desktop concern handled later —
|
|
47
|
+
* this reads only `input.request.settings`.
|
|
48
|
+
*
|
|
49
|
+
* @throws WsError `ws-auth-unsupported` for NTLM. An absent `material.auth` means no credentials
|
|
50
|
+
* and never throws.
|
|
51
|
+
* @throws WsError `ws-bad-url` (via `resolveWsUrl`) for a URL that cannot be resolved.
|
|
52
|
+
*/
|
|
53
|
+
export declare function toWsSessionOptions(input: WsCallInput, material: WsSessionMaterial): WsSessionOptions;
|
package/dist/ws/call.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a saved WebSocket request, plus the API it belongs to and the credentials the host has
|
|
3
|
+
* already resolved, into the options `openWsSession` takes. Everything here is pure: no socket is
|
|
4
|
+
* opened, nothing is read from disk or the keychain — that is `apiHeaders`, `material.auth` and
|
|
5
|
+
* friends, all handed in already resolved.
|
|
6
|
+
*
|
|
7
|
+
* Layering, in order: API headers first, then the request's own headers (which override the API's
|
|
8
|
+
* by case-insensitive name), then auth (which overrides both). An API key configured "in query"
|
|
9
|
+
* lands in the URL's query string, exactly where REST puts it — `resolveWsUrl` appends it after
|
|
10
|
+
* the request's own query rows.
|
|
11
|
+
*/
|
|
12
|
+
import { applyAuth } from '../rest/auth.js';
|
|
13
|
+
import { WsError } from '../errors.js';
|
|
14
|
+
import { resolveWsUrl } from './url.js';
|
|
15
|
+
/**
|
|
16
|
+
* Handshake header names undici either refuses or silently mangles when a caller sets them
|
|
17
|
+
* itself: `sec-websocket-key`/`-version` end up sent *twice* (the caller's value and undici's own,
|
|
18
|
+
* comma-joined on the wire — confirmed against `startTestWsServer`, which then sees a malformed
|
|
19
|
+
* `Sec-WebSocket-Version: 99, 13`), `upgrade`/`connection` collide with the ones undici sets to
|
|
20
|
+
* open the connection, and `sec-websocket-protocol` as a plain header does nothing at all — undici
|
|
21
|
+
* only negotiates a subprotocol through its own `protocols` option, which `subprotocols` here
|
|
22
|
+
* becomes. Dropping these rather than throwing keeps a pasted-in header harmless instead of fatal;
|
|
23
|
+
* `sec-websocket-accept` is included for the same reason though it only ever appears in a
|
|
24
|
+
* response, never a request. `host` stays here too: the transport sets it itself from the URL, so
|
|
25
|
+
* a caller-supplied value would only ever be overridden, never honoured.
|
|
26
|
+
*
|
|
27
|
+
* Exported for the unit test only — not part of the package's public surface.
|
|
28
|
+
*/
|
|
29
|
+
export const FORBIDDEN_HANDSHAKE_HEADERS = new Set([
|
|
30
|
+
'sec-websocket-key',
|
|
31
|
+
'sec-websocket-version',
|
|
32
|
+
'sec-websocket-extensions',
|
|
33
|
+
'sec-websocket-accept',
|
|
34
|
+
'sec-websocket-protocol',
|
|
35
|
+
'upgrade',
|
|
36
|
+
'connection',
|
|
37
|
+
'host',
|
|
38
|
+
]);
|
|
39
|
+
/** Merges header rows by case-insensitive name, later rows overriding earlier ones. */
|
|
40
|
+
function mergeHeaders(...layers) {
|
|
41
|
+
const byLowerName = new Map();
|
|
42
|
+
for (const layer of layers) {
|
|
43
|
+
for (const row of layer) {
|
|
44
|
+
if (!row.enabled || row.name === '')
|
|
45
|
+
continue;
|
|
46
|
+
byLowerName.set(row.name.toLowerCase(), { name: row.name, value: row.value });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const result = {};
|
|
50
|
+
for (const { name, value } of byLowerName.values()) {
|
|
51
|
+
if (FORBIDDEN_HANDSHAKE_HEADERS.has(name.toLowerCase()))
|
|
52
|
+
continue;
|
|
53
|
+
result[name] = value;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/** Credentials resolved into the header (or headers) they become on the wire. */
|
|
58
|
+
function authHeadersAndQuery(auth) {
|
|
59
|
+
if (auth === undefined) {
|
|
60
|
+
return { headers: {}, query: [] };
|
|
61
|
+
}
|
|
62
|
+
if (auth.type === 'ntlm') {
|
|
63
|
+
throw new WsError('ws-auth-unsupported', 'NTLM authenticates a connection over several HTTP round trips, which a single WebSocket handshake cannot do. Use Basic, Bearer, an API key, or OAuth2 instead.', { details: { type: auth.type } });
|
|
64
|
+
}
|
|
65
|
+
if (auth.type === 'basic') {
|
|
66
|
+
// `rest/auth.ts`'s `applyAuth` deliberately leaves Basic to the HTTP transport's challenge
|
|
67
|
+
// flow, because a REST send can retry after a 401. A WebSocket handshake gets exactly one
|
|
68
|
+
// request, so there is no challenge to wait for: the header goes straight on, same as REST's
|
|
69
|
+
// "preemptive" Basic.
|
|
70
|
+
const encoded = Buffer.from(`${auth.username}:${auth.password}`, 'utf8').toString('base64');
|
|
71
|
+
return { headers: { Authorization: `Basic ${encoded}` }, query: [] };
|
|
72
|
+
}
|
|
73
|
+
const applied = applyAuth(auth);
|
|
74
|
+
return { headers: { ...applied.headers }, query: applied.query };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Builds the options `openWsSession` takes from a saved request: URL resolution, header merging,
|
|
78
|
+
* auth, and the request's own transport settings. The project/preference settings ladder (trust
|
|
79
|
+
* store, bind address, timeouts inherited from higher up) is a desktop concern handled later —
|
|
80
|
+
* this reads only `input.request.settings`.
|
|
81
|
+
*
|
|
82
|
+
* @throws WsError `ws-auth-unsupported` for NTLM. An absent `material.auth` means no credentials
|
|
83
|
+
* and never throws.
|
|
84
|
+
* @throws WsError `ws-bad-url` (via `resolveWsUrl`) for a URL that cannot be resolved.
|
|
85
|
+
*/
|
|
86
|
+
export function toWsSessionOptions(input, material) {
|
|
87
|
+
const { headers: authHeaders, query: authQuery } = authHeadersAndQuery(material.auth);
|
|
88
|
+
const query = [...input.request.query, ...authQuery];
|
|
89
|
+
const url = resolveWsUrl(input.serverUrl, input.request.url, query);
|
|
90
|
+
const headers = mergeHeaders(input.apiHeaders, input.request.headers, [
|
|
91
|
+
...Object.entries(authHeaders).map(([name, value]) => ({ name, value, enabled: true })),
|
|
92
|
+
]);
|
|
93
|
+
const settings = input.request.settings;
|
|
94
|
+
const tls = settings.trustInvalid === true ? { ...material.tls, rejectUnauthorized: false } : material.tls;
|
|
95
|
+
return {
|
|
96
|
+
url,
|
|
97
|
+
headers,
|
|
98
|
+
...(input.request.subprotocols.length > 0 ? { subprotocols: input.request.subprotocols } : {}),
|
|
99
|
+
...(tls !== undefined ? { tls } : {}),
|
|
100
|
+
...(material.proxy !== undefined ? { proxy: material.proxy } : {}),
|
|
101
|
+
...(settings.bindAddress !== undefined ? { localAddress: settings.bindAddress } : {}),
|
|
102
|
+
...(settings.handshakeTimeoutMs !== undefined ? { handshakeTimeoutMs: settings.handshakeTimeoutMs } : {}),
|
|
103
|
+
...(settings.maxMessageBytes !== undefined ? { maxMessageBytes: settings.maxMessageBytes } : {}),
|
|
104
|
+
...(material.signal !== undefined ? { signal: material.signal } : {}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command-line equivalent of a WebSocket session, for the Code panel: what a person would
|
|
3
|
+
* type at a shell to dial the same URL with `websocat`, a generic open-source WebSocket
|
|
4
|
+
* command-line client (as `grpcurl` is in `grpc/command.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import type { WsSessionOptions } from './session.js';
|
|
7
|
+
/** Options for {@link wsToCommand}. */
|
|
8
|
+
export interface WsToCommandFlags {
|
|
9
|
+
/** `-k`: connect even when the certificate does not verify. */
|
|
10
|
+
readonly insecure?: boolean;
|
|
11
|
+
readonly shell?: 'posix' | 'powershell';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders a session's options as a `websocat` command line: `-H='name: value'` per header, in
|
|
15
|
+
* insertion order, `--protocol` with the subprotocols joined by a comma when there are any, `-k`
|
|
16
|
+
* when the caller says the connection is insecure, and the URL last, every argument quoted for
|
|
17
|
+
* the shell.
|
|
18
|
+
*/
|
|
19
|
+
export declare function wsToCommand(options: Pick<WsSessionOptions, 'url' | 'headers' | 'subprotocols'>, flags?: WsToCommandFlags): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command-line equivalent of a WebSocket session, for the Code panel: what a person would
|
|
3
|
+
* type at a shell to dial the same URL with `websocat`, a generic open-source WebSocket
|
|
4
|
+
* command-line client (as `grpcurl` is in `grpc/command.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import { quoteForShell } from '../http/curl.js';
|
|
7
|
+
/**
|
|
8
|
+
* Renders a session's options as a `websocat` command line: `-H='name: value'` per header, in
|
|
9
|
+
* insertion order, `--protocol` with the subprotocols joined by a comma when there are any, `-k`
|
|
10
|
+
* when the caller says the connection is insecure, and the URL last, every argument quoted for
|
|
11
|
+
* the shell.
|
|
12
|
+
*/
|
|
13
|
+
export function wsToCommand(options, flags = {}) {
|
|
14
|
+
const shell = flags.shell ?? 'posix';
|
|
15
|
+
const q = (value) => quoteForShell(value, shell);
|
|
16
|
+
const parts = ['websocat'];
|
|
17
|
+
if (flags.insecure === true) {
|
|
18
|
+
parts.push('-k');
|
|
19
|
+
}
|
|
20
|
+
for (const [name, value] of Object.entries(options.headers ?? {})) {
|
|
21
|
+
parts.push(`-H=${q(`${name}: ${value}`)}`);
|
|
22
|
+
}
|
|
23
|
+
if (options.subprotocols !== undefined && options.subprotocols.length > 0) {
|
|
24
|
+
parts.push('--protocol', q(options.subprotocols.join(',')));
|
|
25
|
+
}
|
|
26
|
+
parts.push(q(options.url));
|
|
27
|
+
return parts.join(' ');
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property expansion for a WebSocket call: every `${…}` reference in the request URL, its query
|
|
3
|
+
* and header rows, and its subprotocols, resolved against the same scopes a REST or gRPC send
|
|
4
|
+
* uses. Message text is expanded separately (`expandWsMessage`), since a message is sent long
|
|
5
|
+
* after the call's other fields are settled and may be edited and resent several times over one
|
|
6
|
+
* session.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `grpc/expand.ts`: names as well as values are expanded, an unresolved reference is
|
|
9
|
+
* reported once per place it appears rather than guessed at or deduplicated, and `escape` — JSON
|
|
10
|
+
* string escaping — applies only to a message, never to a header, query row or the URL.
|
|
11
|
+
*/
|
|
12
|
+
import type { PropertyScopes, UnresolvedRef } from '../project/properties.js';
|
|
13
|
+
import type { KeyValueEntry } from '../rest/model.js';
|
|
14
|
+
import type { WsRequestDef } from './model.js';
|
|
15
|
+
/** Input to {@link expandWsInput}: the parts of a saved request an open call needs. */
|
|
16
|
+
export interface WsCallInput {
|
|
17
|
+
readonly serverUrl: string;
|
|
18
|
+
readonly request: Pick<WsRequestDef, 'url' | 'query' | 'headers' | 'subprotocols' | 'settings'>;
|
|
19
|
+
readonly apiHeaders: readonly KeyValueEntry[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Expands every property reference in a call's URL, query rows, header rows (both the API's and
|
|
23
|
+
* the request's own) and subprotocols.
|
|
24
|
+
*/
|
|
25
|
+
export declare function expandWsInput(input: WsCallInput, scopes: PropertyScopes): {
|
|
26
|
+
readonly input: WsCallInput;
|
|
27
|
+
readonly unresolved: readonly UnresolvedRef[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Expands every property reference in one message's text. `escape: true` JSON-escapes every
|
|
31
|
+
* substituted value, for a message that is going to be embedded in a larger JSON payload.
|
|
32
|
+
*/
|
|
33
|
+
export declare function expandWsMessage(text: string, scopes: PropertyScopes, options: {
|
|
34
|
+
readonly escape: boolean;
|
|
35
|
+
}): {
|
|
36
|
+
readonly text: string;
|
|
37
|
+
readonly unresolved: readonly UnresolvedRef[];
|
|
38
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property expansion for a WebSocket call: every `${…}` reference in the request URL, its query
|
|
3
|
+
* and header rows, and its subprotocols, resolved against the same scopes a REST or gRPC send
|
|
4
|
+
* uses. Message text is expanded separately (`expandWsMessage`), since a message is sent long
|
|
5
|
+
* after the call's other fields are settled and may be edited and resent several times over one
|
|
6
|
+
* session.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `grpc/expand.ts`: names as well as values are expanded, an unresolved reference is
|
|
9
|
+
* reported once per place it appears rather than guessed at or deduplicated, and `escape` — JSON
|
|
10
|
+
* string escaping — applies only to a message, never to a header, query row or the URL.
|
|
11
|
+
*/
|
|
12
|
+
import { expand } from '../project/properties.js';
|
|
13
|
+
import { escapeForLanguage } from '../rest/body.js';
|
|
14
|
+
function runRows(rows, run) {
|
|
15
|
+
return rows.map((row) => ({ ...row, name: run(row.name), value: run(row.value) }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Expands every property reference in a call's URL, query rows, header rows (both the API's and
|
|
19
|
+
* the request's own) and subprotocols.
|
|
20
|
+
*/
|
|
21
|
+
export function expandWsInput(input, scopes) {
|
|
22
|
+
const unresolved = [];
|
|
23
|
+
const run = (text) => {
|
|
24
|
+
const result = expand(text, scopes);
|
|
25
|
+
unresolved.push(...result.unresolved);
|
|
26
|
+
return result.text;
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
input: {
|
|
30
|
+
...input,
|
|
31
|
+
request: {
|
|
32
|
+
...input.request,
|
|
33
|
+
url: run(input.request.url),
|
|
34
|
+
query: runRows(input.request.query, run),
|
|
35
|
+
headers: runRows(input.request.headers, run),
|
|
36
|
+
subprotocols: input.request.subprotocols.map((protocol) => run(protocol)),
|
|
37
|
+
},
|
|
38
|
+
apiHeaders: runRows(input.apiHeaders, run),
|
|
39
|
+
},
|
|
40
|
+
unresolved,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Expands every property reference in one message's text. `escape: true` JSON-escapes every
|
|
45
|
+
* substituted value, for a message that is going to be embedded in a larger JSON payload.
|
|
46
|
+
*/
|
|
47
|
+
export function expandWsMessage(text, scopes, options) {
|
|
48
|
+
const unresolved = [];
|
|
49
|
+
const plain = expand(text, scopes);
|
|
50
|
+
unresolved.push(...plain.unresolved);
|
|
51
|
+
if (!options.escape) {
|
|
52
|
+
return { text: plain.text, unresolved };
|
|
53
|
+
}
|
|
54
|
+
const escaped = expand(text, escapedScopes(scopes));
|
|
55
|
+
return { text: escaped.text, unresolved };
|
|
56
|
+
}
|
|
57
|
+
/** The same scopes with every value JSON-escaped, so substitution escapes as it goes. */
|
|
58
|
+
function escapedScopes(scopes) {
|
|
59
|
+
const escapeMap = (map) => {
|
|
60
|
+
const out = {};
|
|
61
|
+
for (const [name, value] of Object.entries(map ?? {})) {
|
|
62
|
+
if (value !== undefined) {
|
|
63
|
+
out[name] = escapeForLanguage(value, 'json');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
...scopes,
|
|
70
|
+
project: escapeMap(scopes.project),
|
|
71
|
+
global: escapeMap(scopes.global),
|
|
72
|
+
system: escapeMap(scopes.system),
|
|
73
|
+
...(scopes.env !== undefined ? { env: escapeMap(scopes.env) } : {}),
|
|
74
|
+
...(scopes.workspace !== undefined ? { workspace: escapeMap(scopes.workspace) } : {}),
|
|
75
|
+
};
|
|
76
|
+
}
|