@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,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTOM/XOP (SOAP Message Transmission Optimization Mechanism).
|
|
3
|
+
*
|
|
4
|
+
* Outgoing, this implements the rule the request editor exposes: an element
|
|
5
|
+
* whose text is exactly `cid:<content-id>` names an attachment, and enabling MTOM replaces
|
|
6
|
+
* that text with an `<xop:Include>` while the bytes travel unencoded in their own MIME
|
|
7
|
+
* part. Nothing is inferred from the schema — a base64Binary element that does not carry a
|
|
8
|
+
* `cid:` reference is left alone, and a `cid:` reference naming no attachment stays as it
|
|
9
|
+
* is (the server may know what it means).
|
|
10
|
+
*
|
|
11
|
+
* Incoming, an `<xop:Include>` can either be expanded back into base64 inside the envelope
|
|
12
|
+
* ("Expand MTOM Attachments") or left in place with the part listed alongside.
|
|
13
|
+
*/
|
|
14
|
+
import { scanXml } from '../../xsd/xml-scan.js';
|
|
15
|
+
import { findCidReferences, forEachScannedElement, spliceRanges } from './cid-scan.js';
|
|
16
|
+
import { mediaTypeOf, mimeParameter } from './multipart.js';
|
|
17
|
+
import { collectResponseAttachments } from './swa.js';
|
|
18
|
+
/** The XOP namespace, whose `Include` element replaces optimised content. */
|
|
19
|
+
export const XOP_NS = 'http://www.w3.org/2004/08/xop/include';
|
|
20
|
+
/**
|
|
21
|
+
* Turns a SOAP content type into the XOP root part's content type.
|
|
22
|
+
*
|
|
23
|
+
* The SOAP media type moves into the `type` parameter (so the receiver knows what the
|
|
24
|
+
* package encodes) and any SOAP 1.2 `action` parameter is kept, at the end, on the root
|
|
25
|
+
* part itself — the multipart's own `Content-Type` has no room for it.
|
|
26
|
+
*
|
|
27
|
+
* @param soapContentType e.g. `text/xml;charset=UTF-8` or `application/soap+xml;charset=UTF-8;action="urn:Add"`
|
|
28
|
+
*/
|
|
29
|
+
export function xopContentType(soapContentType) {
|
|
30
|
+
const mediaType = mediaTypeOf(soapContentType);
|
|
31
|
+
const charset = mimeParameter(soapContentType, 'charset') ?? 'UTF-8';
|
|
32
|
+
const action = mimeParameter(soapContentType, 'action');
|
|
33
|
+
return (`application/xop+xml;charset=${charset};type="${mediaType}"` + (action === undefined ? '' : `;action="${action}"`));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Percent-decodes a `cid:` href's tail, falling back to the raw string when it is not valid
|
|
37
|
+
* percent-encoding (e.g. a stray `%` from a server that did not escape its Content-IDs) —
|
|
38
|
+
* a malformed response should not throw out of the send path.
|
|
39
|
+
*/
|
|
40
|
+
function decodeCidHref(raw) {
|
|
41
|
+
try {
|
|
42
|
+
return decodeURIComponent(raw);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return raw;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** The attachment a `cid:` reference names: by Content-ID first, then by attachment id. */
|
|
49
|
+
function findAttachment(attachments, cid) {
|
|
50
|
+
return attachments.find((a) => a.contentId === cid) ?? attachments.find((a) => a.id === cid);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Rewrites `envelopeXml` for MTOM and resolves the bytes of every attachment it optimises.
|
|
54
|
+
*
|
|
55
|
+
* @param envelopeXml the envelope as it would otherwise be sent
|
|
56
|
+
* @param attachments the request's attachments
|
|
57
|
+
* @param options `force` packaging and the resolver that reads attachment bytes
|
|
58
|
+
*/
|
|
59
|
+
export async function prepareMtomRequest(envelopeXml, attachments, options) {
|
|
60
|
+
const scan = findCidReferences(envelopeXml);
|
|
61
|
+
const edits = [];
|
|
62
|
+
const consumed = new Map();
|
|
63
|
+
for (const reference of scan.references) {
|
|
64
|
+
const attachment = findAttachment(attachments, reference.cid);
|
|
65
|
+
if (attachment === undefined) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const contentId = attachment.contentId.length > 0 ? attachment.contentId : `${attachment.id}@wirebench`;
|
|
69
|
+
consumed.set(attachment.id, attachment);
|
|
70
|
+
edits.push({
|
|
71
|
+
range: reference.range,
|
|
72
|
+
text: `<xop:Include href="cid:${contentId}" xmlns:xop="${XOP_NS}"/>`,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const parts = [];
|
|
76
|
+
for (const attachment of consumed.values()) {
|
|
77
|
+
parts.push({
|
|
78
|
+
contentId: attachment.contentId.length > 0 ? attachment.contentId : `${attachment.id}@wirebench`,
|
|
79
|
+
contentType: attachment.contentType,
|
|
80
|
+
bytes: await options.resolver(attachment),
|
|
81
|
+
transferEncoding: 'binary',
|
|
82
|
+
...(attachment.name.length > 0 ? { fileName: attachment.name } : {}),
|
|
83
|
+
...(attachment.part !== undefined && attachment.part.length > 0 ? { partName: attachment.part } : {}),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
envelopeXml: spliceRanges(envelopeXml, edits),
|
|
88
|
+
parts,
|
|
89
|
+
used: parts.length > 0 || options.force,
|
|
90
|
+
consumedIds: [...consumed.keys()],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Expands (or merely lists) the XOP parts of a `multipart/related` response.
|
|
95
|
+
*
|
|
96
|
+
* With `inline` set, every `<xop:Include>` whose part is present is replaced by that
|
|
97
|
+
* part's base64, which is what the receiver's own XML tooling would have seen; the parts
|
|
98
|
+
* stay listed so the caller can still show and save them. Without it the envelope is
|
|
99
|
+
* returned as received.
|
|
100
|
+
*
|
|
101
|
+
* @param parsed the parsed multipart response
|
|
102
|
+
* @param options `inline` expansion, and the already charset-decoded root text when the caller has it
|
|
103
|
+
*/
|
|
104
|
+
export function expandMtomResponse(parsed, options) {
|
|
105
|
+
const envelopeXml = options.envelopeXml ?? Buffer.from(parsed.root.bytes).toString('utf-8');
|
|
106
|
+
const attachments = collectResponseAttachments(parsed);
|
|
107
|
+
if (!options.inline) {
|
|
108
|
+
return { envelopeXml, attachments, inlinedContentIds: [] };
|
|
109
|
+
}
|
|
110
|
+
const scan = scanXml(envelopeXml);
|
|
111
|
+
if (scan.problems.length > 0) {
|
|
112
|
+
return { envelopeXml, attachments, inlinedContentIds: [] };
|
|
113
|
+
}
|
|
114
|
+
const byContentId = new Map(parsed.parts.map((part) => [part.contentId ?? '', part]));
|
|
115
|
+
const edits = [];
|
|
116
|
+
const inlined = [];
|
|
117
|
+
forEachScannedElement(scan.elements, (element) => {
|
|
118
|
+
if (element.localName !== 'Include' || element.namespaceUri !== XOP_NS) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const href = element.attributes.find((attribute) => attribute.name === 'href')?.value;
|
|
122
|
+
if (href === undefined || !href.startsWith('cid:')) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const contentId = decodeCidHref(href.slice('cid:'.length));
|
|
126
|
+
const part = byContentId.get(contentId);
|
|
127
|
+
if (part === undefined) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
inlined.push(contentId);
|
|
131
|
+
edits.push({ range: element.range, text: Buffer.from(part.bytes).toString('base64') });
|
|
132
|
+
});
|
|
133
|
+
return { envelopeXml: spliceRanges(envelopeXml, edits), attachments, inlinedContentIds: inlined };
|
|
134
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building and parsing `multipart/related` bodies (RFC 2387), the container both
|
|
3
|
+
* MTOM/XOP and SOAP with Attachments use.
|
|
4
|
+
*
|
|
5
|
+
* Building is strict — CRLF everywhere, a boundary guaranteed not to occur inside any
|
|
6
|
+
* part — because that is what goes on the wire. Parsing is deliberately tolerant, because
|
|
7
|
+
* what comes back rarely is: LF-only line endings, a missing final `--` terminator,
|
|
8
|
+
* unquoted boundary parameters, folded headers and a missing `start` parameter are all
|
|
9
|
+
* accepted and reported as problems rather than raised.
|
|
10
|
+
*/
|
|
11
|
+
import type { MimePart, MultipartPart, MultipartRoot } from './types.js';
|
|
12
|
+
/** Default Content-ID of the envelope part when the caller does not choose one. */
|
|
13
|
+
export declare const DEFAULT_ROOT_CONTENT_ID = "rootpart@wirebench";
|
|
14
|
+
/** What {@link buildMultipartRelated} needs to write a body. */
|
|
15
|
+
export interface BuildMultipartInput {
|
|
16
|
+
readonly root: MultipartRoot;
|
|
17
|
+
readonly parts: readonly MultipartPart[];
|
|
18
|
+
/** Fixed boundary (tests); a random one is generated otherwise. Replaced if it collides. */
|
|
19
|
+
readonly boundary?: string;
|
|
20
|
+
/** Package as MTOM: adds the `start-info` parameter naming the SOAP content type. */
|
|
21
|
+
readonly mtom?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** A built `multipart/related` body plus the `Content-Type` that describes it. */
|
|
24
|
+
export interface BuiltMultipart {
|
|
25
|
+
readonly contentType: string;
|
|
26
|
+
readonly body: Uint8Array;
|
|
27
|
+
readonly boundary: string;
|
|
28
|
+
}
|
|
29
|
+
/** What {@link parseMultipartRelated} found. */
|
|
30
|
+
export interface ParsedMultipart {
|
|
31
|
+
/** The `start` part, or the first part when no usable `start` parameter was given. */
|
|
32
|
+
readonly root: MimePart;
|
|
33
|
+
/** Every part but the root, in wire order. */
|
|
34
|
+
readonly parts: readonly MimePart[];
|
|
35
|
+
/** Tolerance notes, e.g. `missing-boundary`, `missing-final-boundary`, `start-part-not-found`. */
|
|
36
|
+
readonly problems: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
/** The media type of a `Content-Type` header value, without its parameters. */
|
|
39
|
+
export declare function mediaTypeOf(contentType: string): string;
|
|
40
|
+
/** One parameter of a `Content-Type`-style header value, unquoted; case-insensitive on the name. */
|
|
41
|
+
export declare function mimeParameter(header: string, name: string): string | undefined;
|
|
42
|
+
/** Strips the angle brackets from a Content-ID (`<a@b>` -> `a@b`). */
|
|
43
|
+
export declare function stripContentId(value: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Writes a `multipart/related` body and the `Content-Type` header describing it.
|
|
46
|
+
*
|
|
47
|
+
* The `type` parameter names the root part's media type and `start` points at its
|
|
48
|
+
* Content-ID, so a receiver can find the envelope without relying on part order. For
|
|
49
|
+
* MTOM, `start-info` additionally carries the content type the XOP package encodes
|
|
50
|
+
* (`text/xml` for SOAP 1.1, `application/soap+xml` for 1.2), taken from the root part's
|
|
51
|
+
* own `type` parameter.
|
|
52
|
+
*
|
|
53
|
+
* @param input the root (envelope) part, the attachment parts, and packaging options
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildMultipartRelated(input: BuildMultipartInput): BuiltMultipart;
|
|
56
|
+
/**
|
|
57
|
+
* Parses a `multipart/related` body.
|
|
58
|
+
*
|
|
59
|
+
* Never throws: a body that cannot be split (no `boundary` parameter, no delimiters at
|
|
60
|
+
* all) is returned whole as the root part with a problem describing why, so a caller can
|
|
61
|
+
* still show the response it actually received.
|
|
62
|
+
*
|
|
63
|
+
* @param bytes the raw body bytes
|
|
64
|
+
* @param contentTypeHeader the `Content-Type` header that described them
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseMultipartRelated(bytes: Uint8Array, contentTypeHeader: string): ParsedMultipart;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building and parsing `multipart/related` bodies (RFC 2387), the container both
|
|
3
|
+
* MTOM/XOP and SOAP with Attachments use.
|
|
4
|
+
*
|
|
5
|
+
* Building is strict — CRLF everywhere, a boundary guaranteed not to occur inside any
|
|
6
|
+
* part — because that is what goes on the wire. Parsing is deliberately tolerant, because
|
|
7
|
+
* what comes back rarely is: LF-only line endings, a missing final `--` terminator,
|
|
8
|
+
* unquoted boundary parameters, folded headers and a missing `start` parameter are all
|
|
9
|
+
* accepted and reported as problems rather than raised.
|
|
10
|
+
*/
|
|
11
|
+
import { randomBytes } from 'node:crypto';
|
|
12
|
+
/** Default Content-ID of the envelope part when the caller does not choose one. */
|
|
13
|
+
export const DEFAULT_ROOT_CONTENT_ID = 'rootpart@wirebench';
|
|
14
|
+
const CRLF = '\r\n';
|
|
15
|
+
const KNOWN_ENCODINGS = ['binary', 'base64', '8bit', '7bit', 'quoted-printable'];
|
|
16
|
+
/** The media type of a `Content-Type` header value, without its parameters. */
|
|
17
|
+
export function mediaTypeOf(contentType) {
|
|
18
|
+
const semicolon = contentType.indexOf(';');
|
|
19
|
+
return (semicolon === -1 ? contentType : contentType.slice(0, semicolon)).trim();
|
|
20
|
+
}
|
|
21
|
+
/** One parameter of a `Content-Type`-style header value, unquoted; case-insensitive on the name. */
|
|
22
|
+
export function mimeParameter(header, name) {
|
|
23
|
+
// The quoted-string branch follows RFC 2045's grammar: any character except `"` and `\`,
|
|
24
|
+
// or a backslash-escaped pair, so a value written by {@link quoteParameter} round-trips.
|
|
25
|
+
// Only `\"` and `\\` are unescaped afterwards: a third-party part that carries an unescaped
|
|
26
|
+
// backslash (`filename="report\notes.pdf"`, common from Windows senders) keeps it.
|
|
27
|
+
const pattern = new RegExp(`;\\s*${name}\\s*=\\s*(?:"((?:[^"\\\\]|\\\\.)*)"|([^;\\s]+))`, 'i');
|
|
28
|
+
const match = pattern.exec(header);
|
|
29
|
+
if (match === null) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const quoted = match[1];
|
|
33
|
+
return quoted !== undefined ? quoted.replace(/\\(["\\])/g, '$1') : match[2];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Replaces CR, LF and other control characters in a header value component with `_`.
|
|
37
|
+
*
|
|
38
|
+
* Used for every value that lands unquoted on the wire (`Content-ID`, `Content-Type`) so a
|
|
39
|
+
* user-authored string (an attachment name, a resolved content type) cannot smuggle in a
|
|
40
|
+
* second header line.
|
|
41
|
+
*/
|
|
42
|
+
function sanitizeHeaderValue(value) {
|
|
43
|
+
let out = '';
|
|
44
|
+
for (const char of value) {
|
|
45
|
+
const code = char.codePointAt(0) ?? 0;
|
|
46
|
+
out += code < 0x20 || code === 0x7f ? '_' : char;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Quotes a MIME parameter value for a header line: sanitizes control characters (see
|
|
52
|
+
* {@link sanitizeHeaderValue}), then backslash-escapes `"` and `\` per RFC 2045's
|
|
53
|
+
* quoted-string grammar. Use for every quoted parameter this module writes — `filename`,
|
|
54
|
+
* `name`, `type`, `start`, `start-info`, `boundary` — since all of them can carry
|
|
55
|
+
* user-authored text.
|
|
56
|
+
*/
|
|
57
|
+
function quoteParameter(value) {
|
|
58
|
+
return `"${sanitizeHeaderValue(value).replace(/[\\"]/g, (char) => `\\${char}`)}"`;
|
|
59
|
+
}
|
|
60
|
+
/** Strips the angle brackets from a Content-ID (`<a@b>` -> `a@b`). */
|
|
61
|
+
export function stripContentId(value) {
|
|
62
|
+
const trimmed = value.trim();
|
|
63
|
+
return trimmed.startsWith('<') && trimmed.endsWith('>') ? trimmed.slice(1, -1) : trimmed;
|
|
64
|
+
}
|
|
65
|
+
/** Base64 with the 76-column CRLF wrapping MIME expects. */
|
|
66
|
+
function toBase64Lines(bytes) {
|
|
67
|
+
const encoded = Buffer.from(bytes).toString('base64');
|
|
68
|
+
const lines = [];
|
|
69
|
+
for (let index = 0; index < encoded.length; index += 76) {
|
|
70
|
+
lines.push(encoded.slice(index, index + 76));
|
|
71
|
+
}
|
|
72
|
+
return Buffer.from(lines.join(CRLF), 'ascii');
|
|
73
|
+
}
|
|
74
|
+
/** The bytes of a part as they go on the wire, honouring its transfer encoding. */
|
|
75
|
+
function encodePart(bytes, encoding) {
|
|
76
|
+
return encoding === 'base64' ? toBase64Lines(bytes) : Buffer.from(bytes);
|
|
77
|
+
}
|
|
78
|
+
/** A boundary that does not occur in any of `chunks`, starting from `preferred`. */
|
|
79
|
+
function chooseBoundary(preferred, chunks) {
|
|
80
|
+
let candidate = preferred ?? `----=_Part_${randomBytes(12).toString('hex')}`;
|
|
81
|
+
let attempts = 0;
|
|
82
|
+
while (chunks.some((chunk) => chunk.includes(candidate, 0, 'utf-8'))) {
|
|
83
|
+
candidate = `----=_Part_${randomBytes(12).toString('hex')}`;
|
|
84
|
+
attempts += 1;
|
|
85
|
+
/* c8 ignore next 3 -- a 96-bit random boundary colliding twice is not reachable in a test. */
|
|
86
|
+
if (attempts > 8) {
|
|
87
|
+
throw new Error('could not choose a MIME boundary');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return candidate;
|
|
91
|
+
}
|
|
92
|
+
/** `Content-Disposition` for a part that names a file and/or a WSDL mime part. */
|
|
93
|
+
function dispositionHeader(part) {
|
|
94
|
+
const attributes = [];
|
|
95
|
+
if (part.partName !== undefined && part.partName.length > 0) {
|
|
96
|
+
attributes.push(`name=${quoteParameter(part.partName)}`);
|
|
97
|
+
}
|
|
98
|
+
if (part.fileName !== undefined && part.fileName.length > 0) {
|
|
99
|
+
attributes.push(`filename=${quoteParameter(part.fileName)}`);
|
|
100
|
+
}
|
|
101
|
+
return attributes.length === 0 ? undefined : `attachment; ${attributes.join('; ')}`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Writes a `multipart/related` body and the `Content-Type` header describing it.
|
|
105
|
+
*
|
|
106
|
+
* The `type` parameter names the root part's media type and `start` points at its
|
|
107
|
+
* Content-ID, so a receiver can find the envelope without relying on part order. For
|
|
108
|
+
* MTOM, `start-info` additionally carries the content type the XOP package encodes
|
|
109
|
+
* (`text/xml` for SOAP 1.1, `application/soap+xml` for 1.2), taken from the root part's
|
|
110
|
+
* own `type` parameter.
|
|
111
|
+
*
|
|
112
|
+
* @param input the root (envelope) part, the attachment parts, and packaging options
|
|
113
|
+
*/
|
|
114
|
+
export function buildMultipartRelated(input) {
|
|
115
|
+
const rootBytes = Buffer.from(input.root.bytes);
|
|
116
|
+
const encoded = input.parts.map((part) => encodePart(part.bytes, part.transferEncoding));
|
|
117
|
+
const boundary = chooseBoundary(input.boundary, [rootBytes, ...encoded]);
|
|
118
|
+
const rootContentId = sanitizeHeaderValue(input.root.contentId ?? DEFAULT_ROOT_CONTENT_ID);
|
|
119
|
+
const rootContentType = sanitizeHeaderValue(input.root.contentType);
|
|
120
|
+
const chunks = [];
|
|
121
|
+
const push = (text) => void chunks.push(Buffer.from(text, 'utf-8'));
|
|
122
|
+
push(`--${boundary}${CRLF}`);
|
|
123
|
+
push(`Content-Type: ${rootContentType}${CRLF}`);
|
|
124
|
+
push(`Content-Transfer-Encoding: 8bit${CRLF}`);
|
|
125
|
+
push(`Content-ID: <${rootContentId}>${CRLF}${CRLF}`);
|
|
126
|
+
chunks.push(rootBytes);
|
|
127
|
+
input.parts.forEach((part, index) => {
|
|
128
|
+
push(`${CRLF}--${boundary}${CRLF}`);
|
|
129
|
+
push(`Content-Type: ${sanitizeHeaderValue(part.contentType)}${CRLF}`);
|
|
130
|
+
push(`Content-Transfer-Encoding: ${part.transferEncoding ?? 'binary'}${CRLF}`);
|
|
131
|
+
push(`Content-ID: <${sanitizeHeaderValue(part.contentId)}>${CRLF}`);
|
|
132
|
+
const disposition = dispositionHeader(part);
|
|
133
|
+
if (disposition !== undefined) {
|
|
134
|
+
push(`Content-Disposition: ${disposition}${CRLF}`);
|
|
135
|
+
}
|
|
136
|
+
push(CRLF);
|
|
137
|
+
chunks.push(encoded[index] ?? Buffer.alloc(0));
|
|
138
|
+
});
|
|
139
|
+
push(`${CRLF}--${boundary}--${CRLF}`);
|
|
140
|
+
const rootType = mediaTypeOf(rootContentType);
|
|
141
|
+
const startInfo = input.mtom === true ? (mimeParameter(rootContentType, 'type') ?? 'text/xml') : undefined;
|
|
142
|
+
const contentType = `multipart/related; type=${quoteParameter(rootType)}; start=${quoteParameter(`<${rootContentId}>`)}; boundary=${quoteParameter(boundary)}` +
|
|
143
|
+
(startInfo === undefined ? '' : `; start-info=${quoteParameter(startInfo)}`);
|
|
144
|
+
return { contentType, body: new Uint8Array(Buffer.concat(chunks)), boundary };
|
|
145
|
+
}
|
|
146
|
+
/** Decodes RFC 2045 quoted-printable text, honouring soft line breaks. */
|
|
147
|
+
function decodeQuotedPrintable(raw) {
|
|
148
|
+
const decoded = raw
|
|
149
|
+
.toString('latin1')
|
|
150
|
+
.replace(/=(?:\r\n|\n|\r)/g, '')
|
|
151
|
+
.replace(/=([0-9A-Fa-f]{2})/g, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
|
152
|
+
return Buffer.from(decoded, 'latin1');
|
|
153
|
+
}
|
|
154
|
+
/** Splits one part's raw bytes into unfolded headers and a body, tolerating LF-only breaks. */
|
|
155
|
+
function splitHeaders(segment) {
|
|
156
|
+
const lines = [];
|
|
157
|
+
let cursor = 0;
|
|
158
|
+
let bodyStart = segment.length;
|
|
159
|
+
while (cursor < segment.length) {
|
|
160
|
+
const newline = segment.indexOf(0x0a, cursor);
|
|
161
|
+
const lineEnd = newline === -1 ? segment.length : newline;
|
|
162
|
+
const trimmedEnd = lineEnd > cursor && segment[lineEnd - 1] === 0x0d ? lineEnd - 1 : lineEnd;
|
|
163
|
+
const line = segment.toString('utf-8', cursor, trimmedEnd);
|
|
164
|
+
const next = newline === -1 ? segment.length : newline + 1;
|
|
165
|
+
if (line.length === 0) {
|
|
166
|
+
bodyStart = next;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
if (/^[ \t]/.test(line) && lines.length > 0) {
|
|
170
|
+
lines[lines.length - 1] = `${lines[lines.length - 1] ?? ''} ${line.trim()}`;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
lines.push(line);
|
|
174
|
+
}
|
|
175
|
+
cursor = next;
|
|
176
|
+
bodyStart = next;
|
|
177
|
+
}
|
|
178
|
+
const headers = {};
|
|
179
|
+
for (const line of lines) {
|
|
180
|
+
const colon = line.indexOf(':');
|
|
181
|
+
if (colon === -1) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const name = line.slice(0, colon).trim().toLowerCase();
|
|
185
|
+
if (name.length > 0 && headers[name] === undefined) {
|
|
186
|
+
headers[name] = line.slice(colon + 1).trim();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return { headers, body: segment.subarray(bodyStart) };
|
|
190
|
+
}
|
|
191
|
+
/** The last `/`-separated, non-empty segment of a `Content-Location` value, sans query/fragment. */
|
|
192
|
+
function lastPathSegment(contentLocation) {
|
|
193
|
+
if (contentLocation === undefined) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const withoutQuery = contentLocation.trim().split(/[?#]/, 1)[0] ?? '';
|
|
197
|
+
const segments = withoutQuery.split('/');
|
|
198
|
+
const last = segments[segments.length - 1];
|
|
199
|
+
return last !== undefined && last.length > 0 ? last : undefined;
|
|
200
|
+
}
|
|
201
|
+
/** Turns one raw part segment into a {@link MimePart}, decoding its transfer encoding. */
|
|
202
|
+
function toMimePart(segment, fallbackContentType) {
|
|
203
|
+
const { headers, body } = splitHeaders(segment);
|
|
204
|
+
const encodingHeader = headers['content-transfer-encoding']?.toLowerCase();
|
|
205
|
+
const transferEncoding = encodingHeader !== undefined && KNOWN_ENCODINGS.includes(encodingHeader)
|
|
206
|
+
? encodingHeader
|
|
207
|
+
: undefined;
|
|
208
|
+
const raw = Buffer.from(body);
|
|
209
|
+
const decoded = transferEncoding === 'base64'
|
|
210
|
+
? Buffer.from(raw.toString('ascii').replace(/\s+/g, ''), 'base64')
|
|
211
|
+
: transferEncoding === 'quoted-printable'
|
|
212
|
+
? decodeQuotedPrintable(raw)
|
|
213
|
+
: raw;
|
|
214
|
+
const disposition = headers['content-disposition'];
|
|
215
|
+
const dispositionFileName = disposition === undefined ? undefined : (mimeParameter(`;${disposition}`, 'filename') ?? undefined);
|
|
216
|
+
const fileName = dispositionFileName ?? lastPathSegment(headers['content-location']);
|
|
217
|
+
const partName = disposition === undefined ? undefined : (mimeParameter(`;${disposition}`, 'name') ?? undefined);
|
|
218
|
+
const contentId = headers['content-id'];
|
|
219
|
+
return {
|
|
220
|
+
headers,
|
|
221
|
+
...(contentId !== undefined ? { contentId: stripContentId(contentId) } : {}),
|
|
222
|
+
contentType: headers['content-type'] ?? fallbackContentType,
|
|
223
|
+
...(transferEncoding !== undefined ? { transferEncoding } : {}),
|
|
224
|
+
bytes: new Uint8Array(decoded),
|
|
225
|
+
raw: new Uint8Array(raw),
|
|
226
|
+
...(fileName !== undefined ? { fileName } : {}),
|
|
227
|
+
...(partName !== undefined ? { partName } : {}),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/** Every `--boundary` delimiter line in `buf`, with where the segment after it starts. */
|
|
231
|
+
function findDelimiters(buf, boundary) {
|
|
232
|
+
const token = Buffer.from(`--${boundary}`, 'utf-8');
|
|
233
|
+
const found = [];
|
|
234
|
+
let from = 0;
|
|
235
|
+
for (;;) {
|
|
236
|
+
const at = buf.indexOf(token, from);
|
|
237
|
+
if (at === -1) {
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
from = at + token.length;
|
|
241
|
+
if (at !== 0 && buf[at - 1] !== 0x0a) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
let cursor = from;
|
|
245
|
+
const terminator = buf[cursor] === 0x2d && buf[cursor + 1] === 0x2d;
|
|
246
|
+
if (terminator) {
|
|
247
|
+
cursor += 2;
|
|
248
|
+
}
|
|
249
|
+
while (buf[cursor] === 0x20 || buf[cursor] === 0x09) {
|
|
250
|
+
cursor += 1;
|
|
251
|
+
}
|
|
252
|
+
if (buf[cursor] === 0x0d) {
|
|
253
|
+
cursor += 1;
|
|
254
|
+
}
|
|
255
|
+
if (buf[cursor] === 0x0a) {
|
|
256
|
+
cursor += 1;
|
|
257
|
+
}
|
|
258
|
+
found.push({ start: at, contentStart: cursor, terminator });
|
|
259
|
+
}
|
|
260
|
+
return found;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Parses a `multipart/related` body.
|
|
264
|
+
*
|
|
265
|
+
* Never throws: a body that cannot be split (no `boundary` parameter, no delimiters at
|
|
266
|
+
* all) is returned whole as the root part with a problem describing why, so a caller can
|
|
267
|
+
* still show the response it actually received.
|
|
268
|
+
*
|
|
269
|
+
* @param bytes the raw body bytes
|
|
270
|
+
* @param contentTypeHeader the `Content-Type` header that described them
|
|
271
|
+
*/
|
|
272
|
+
export function parseMultipartRelated(bytes, contentTypeHeader) {
|
|
273
|
+
const buf = Buffer.from(bytes);
|
|
274
|
+
const problems = [];
|
|
275
|
+
const boundary = mimeParameter(contentTypeHeader, 'boundary');
|
|
276
|
+
const fallbackContentType = mediaTypeOf(contentTypeHeader) || 'application/octet-stream';
|
|
277
|
+
const wholeBody = (problem) => {
|
|
278
|
+
problems.push(problem);
|
|
279
|
+
return {
|
|
280
|
+
root: { headers: {}, contentType: fallbackContentType, bytes: new Uint8Array(buf), raw: new Uint8Array(buf) },
|
|
281
|
+
parts: [],
|
|
282
|
+
problems,
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
if (boundary === undefined || boundary.length === 0) {
|
|
286
|
+
return wholeBody('missing-boundary');
|
|
287
|
+
}
|
|
288
|
+
const delimiters = findDelimiters(buf, boundary);
|
|
289
|
+
const openers = delimiters.filter((d) => !d.terminator);
|
|
290
|
+
if (openers.length === 0) {
|
|
291
|
+
return wholeBody('no-parts');
|
|
292
|
+
}
|
|
293
|
+
if (!delimiters.some((d) => d.terminator)) {
|
|
294
|
+
problems.push('missing-final-boundary');
|
|
295
|
+
}
|
|
296
|
+
const parts = [];
|
|
297
|
+
for (const opener of openers) {
|
|
298
|
+
const next = delimiters.find((d) => d.start > opener.start);
|
|
299
|
+
// The CRLF (or LF) in front of a delimiter belongs to the delimiter, not to the part.
|
|
300
|
+
// A truncated message has no delimiter after its last part, so the same line break is
|
|
301
|
+
// dropped there too: the sender wrote it ahead of the terminator it never sent.
|
|
302
|
+
let end = next === undefined ? buf.length : next.start;
|
|
303
|
+
if (end > opener.contentStart && buf[end - 1] === 0x0a) {
|
|
304
|
+
end -= 1;
|
|
305
|
+
}
|
|
306
|
+
if (end > opener.contentStart && buf[end - 1] === 0x0d) {
|
|
307
|
+
end -= 1;
|
|
308
|
+
}
|
|
309
|
+
parts.push(toMimePart(buf.subarray(opener.contentStart, end), fallbackContentType));
|
|
310
|
+
}
|
|
311
|
+
const start = mimeParameter(contentTypeHeader, 'start');
|
|
312
|
+
let rootIndex = 0;
|
|
313
|
+
if (start !== undefined) {
|
|
314
|
+
const wanted = stripContentId(start);
|
|
315
|
+
const found = parts.findIndex((part) => part.contentId === wanted);
|
|
316
|
+
if (found === -1) {
|
|
317
|
+
problems.push('start-part-not-found');
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
rootIndex = found;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
const root = parts[rootIndex];
|
|
324
|
+
/* c8 ignore next 3 -- rootIndex always indexes a part that exists. */
|
|
325
|
+
if (root === undefined) {
|
|
326
|
+
return wholeBody('no-parts');
|
|
327
|
+
}
|
|
328
|
+
return { root, parts: parts.filter((_part, index) => index !== rootIndex), problems };
|
|
329
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attachment stages of a send: what happens to the envelope on the way out, and how a
|
|
3
|
+
* `multipart/related` response is unwrapped on the way back in.
|
|
4
|
+
*
|
|
5
|
+
* Kept beside the MIME modules rather than in `send.ts` so the ordering rules live next to
|
|
6
|
+
* the code that implements them.
|
|
7
|
+
*/
|
|
8
|
+
import type { SoapExchange, SoapSendInput } from '../../types.js';
|
|
9
|
+
import type { ResponseAttachment } from './types.js';
|
|
10
|
+
/** One problem recorded on the exchange. */
|
|
11
|
+
export type SoapProblem = SoapExchange['problems'][number];
|
|
12
|
+
/**
|
|
13
|
+
* Substitutes every `file:` reference in the envelope with the file's base64 bytes.
|
|
14
|
+
*
|
|
15
|
+
* This is envelope *text preparation*, exactly like property expansion, so it runs before the
|
|
16
|
+
* envelope transforms rather than with the attachment packaging that follows them (see
|
|
17
|
+
* `send.ts`): a WS-Security signature must cover the bytes that actually go on the wire, and
|
|
18
|
+
* signing the literal `file:/…` text and then replacing it would produce a signature no
|
|
19
|
+
* receiver can verify.
|
|
20
|
+
*
|
|
21
|
+
* A missing file is a problem, not a failure: the reference is left verbatim and the send
|
|
22
|
+
* continues, since the server's own error is usually more informative than a client-side abort.
|
|
23
|
+
* Without a `resolveFile` there is no way to read anything, so the property is inert.
|
|
24
|
+
*
|
|
25
|
+
* @param input the (already expanded) send input
|
|
26
|
+
* @param problems collects non-fatal issues, e.g. an inline file that is missing
|
|
27
|
+
* @returns the envelope with every readable `file:` reference replaced
|
|
28
|
+
*/
|
|
29
|
+
export declare function substituteInlineFiles(input: SoapSendInput, problems: SoapProblem[]): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Runs the request-side attachment pipeline and returns the bytes to send.
|
|
32
|
+
*
|
|
33
|
+
* The order is fixed: property expansion, inline-file substitution
|
|
34
|
+
* ({@link substituteInlineFiles}) and the envelope transforms have already happened, then
|
|
35
|
+
* MTOM claims the attachments its `cid:` references name, then everything left over rides
|
|
36
|
+
* along as SwA. Only when something is actually packaged is the `Content-Type` replaced by
|
|
37
|
+
* the multipart's — the caller's own content type (charset and all) becomes the root part's,
|
|
38
|
+
* so a request that sets one still gets what it asked for where it matters.
|
|
39
|
+
*
|
|
40
|
+
* "Disable Multiparts" short-circuits the whole stage, MTOM included: rewriting a `cid:`
|
|
41
|
+
* reference into an `xop:Include` whose part is then not sent would produce a message no
|
|
42
|
+
* server can read.
|
|
43
|
+
*
|
|
44
|
+
* @param input the (already expanded, already inlined) send input
|
|
45
|
+
* @param headers the request headers, mutated when a multipart Content-Type takes over
|
|
46
|
+
*/
|
|
47
|
+
export declare function packageRequestBody(input: SoapSendInput, headers: Record<string, string>): Promise<Uint8Array>;
|
|
48
|
+
/**
|
|
49
|
+
* Reads the response body as an envelope, unwrapping a `multipart/related` response into
|
|
50
|
+
* its root part plus attachments.
|
|
51
|
+
*
|
|
52
|
+
* A response is unwrapped whether or not the request asked for attachments — a server may
|
|
53
|
+
* answer with MTOM regardless — but the two response knobs only apply when the request
|
|
54
|
+
* carried them: `expandMtomAttachments` writes each referenced part back into the envelope
|
|
55
|
+
* as base64, and `inlineResponseAttachments` decides whether those parts stay listed
|
|
56
|
+
* afterwards.
|
|
57
|
+
*/
|
|
58
|
+
export declare function readResponseBody(body: Uint8Array, contentType: string | undefined, options: SoapSendInput['attachmentOptions'], problems: SoapProblem[]): {
|
|
59
|
+
readonly envelopeXml: string;
|
|
60
|
+
readonly attachments?: readonly ResponseAttachment[];
|
|
61
|
+
};
|