@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
package/dist/send.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sends an already-built SOAP envelope over HTTP and structurally parses the
|
|
3
|
+
* response: SOAP version, fault, or "not actually SOAP" detection.
|
|
4
|
+
*/
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import { gzipSync } from 'node:zlib';
|
|
7
|
+
import { WirebenchError } from './errors.js';
|
|
8
|
+
import { expandSendInput } from './project/properties.js';
|
|
9
|
+
import { sendWithAuth } from './http/auth/apply.js';
|
|
10
|
+
import { headerValue, mergeHeaders } from './http/headers.js';
|
|
11
|
+
import { charsetOf } from './soap/charset.js';
|
|
12
|
+
import { packageRequestBody, readResponseBody, substituteInlineFiles, } from './soap/mime/send-pipeline.js';
|
|
13
|
+
import { parseSoapResponse } from './soap/response-parser.js';
|
|
14
|
+
import { soapActionHeaders } from './soap/soap-action.js';
|
|
15
|
+
import { applyWsaHeaders, effectiveAction } from './wsa/headers.js';
|
|
16
|
+
import { applyOutgoingWss } from './wss/apply.js';
|
|
17
|
+
import { processIncomingWss } from './wss/incoming/index.js';
|
|
18
|
+
/**
|
|
19
|
+
* Sends `input.envelopeXml` to `input.endpoint` over HTTP, computing the
|
|
20
|
+
* `Content-Type`/`SOAPAction` headers for `input.soapVersion` and merging in
|
|
21
|
+
* any caller-supplied `input.headers`, which override the computed ones.
|
|
22
|
+
*
|
|
23
|
+
* HTTP-layer failures (timeout, abort, DNS, TLS, ...) propagate as
|
|
24
|
+
* {@link HttpError}; a non-2xx HTTP status is not an error and is returned
|
|
25
|
+
* as a normal exchange for the caller to inspect.
|
|
26
|
+
*
|
|
27
|
+
* When `input.attachmentOptions` is given, the envelope additionally goes through the
|
|
28
|
+
* attachment pipeline. Its stages are split across the send: inline `file:` references are
|
|
29
|
+
* substituted up front, with property expansion (they are envelope text, and WS-Security must
|
|
30
|
+
* sign what is actually sent), while MTOM and then SwA package the finished envelope after the
|
|
31
|
+
* WS-Addressing and WS-Security rewrites. A `multipart/related` response is unwrapped into its
|
|
32
|
+
* envelope plus `response.attachments`. See `soap/mime/send-pipeline.ts`.
|
|
33
|
+
*
|
|
34
|
+
* The full request order is: property expansion → inline files → WS-Addressing → WS-Security →
|
|
35
|
+
* MTOM → SwA → gzip.
|
|
36
|
+
*
|
|
37
|
+
* When `options.scopes` is given, `input.endpoint`, `input.envelopeXml`,
|
|
38
|
+
* `input.soapAction` and every header name/value are first passed through
|
|
39
|
+
* {@link expandSendInput}; any expressions that could not be resolved are
|
|
40
|
+
* left verbatim in the sent request and reported on the returned exchange's
|
|
41
|
+
* `unresolved` field, rather than failing the send.
|
|
42
|
+
*
|
|
43
|
+
* When `input.auth` is Basic, the `Authorization` header is either sent up front
|
|
44
|
+
* (`preemptive`) or added on a single retry after the server answers the first attempt
|
|
45
|
+
* with a 401 `Basic` challenge; both attempts share the one `timeoutMs` budget (if the first
|
|
46
|
+
* attempt already used it all, the challenge is reported as-is, `attempts: 1`, rather than
|
|
47
|
+
* firing a retry doomed to time out immediately) and the returned exchange is the final attempt
|
|
48
|
+
* actually made. A caller-supplied `Authorization` header always wins.
|
|
49
|
+
*
|
|
50
|
+
* When `input.auth` is NTLM, the send instead runs the three-leg NTLMv2 handshake over one
|
|
51
|
+
* dedicated connection (`http/auth/ntlm-transport.ts`): a bare bodyless leg, the Type 1
|
|
52
|
+
* message, then the Type 3 message carrying the real body. The returned exchange is the
|
|
53
|
+
* final leg, `durationMs` sums every leg, and a server that never challenges short-circuits
|
|
54
|
+
* after the first (`attempts: 1`).
|
|
55
|
+
*
|
|
56
|
+
* @param input the endpoint, envelope and transport options to send
|
|
57
|
+
* @param options an injected `dispatcher` (tests), `now` clock, and/or property `scopes`
|
|
58
|
+
*/
|
|
59
|
+
export async function sendSoapRequest(input, options) {
|
|
60
|
+
let unresolved;
|
|
61
|
+
let effectiveInput = input;
|
|
62
|
+
if (options?.scopes !== undefined) {
|
|
63
|
+
const expanded = expandSendInput(input, options.scopes, { entitize: input.entitize ?? false });
|
|
64
|
+
effectiveInput = expanded.input;
|
|
65
|
+
unresolved = expanded.unresolved;
|
|
66
|
+
}
|
|
67
|
+
const problems = [];
|
|
68
|
+
// Inline `file:` references are substituted first, with property expansion: both are envelope
|
|
69
|
+
// *text* preparation, and the envelope every later stage sees must be the one that goes on
|
|
70
|
+
// the wire. Doing it after WS-Security — as this pipeline used to — signed the literal
|
|
71
|
+
// `file:/…` text and then replaced it, leaving a signature that verifies over nothing that
|
|
72
|
+
// was sent. MTOM/SwA still run last, after WSS, so the header is inside the packaged envelope.
|
|
73
|
+
const inlinedEnvelopeXml = await substituteInlineFiles(effectiveInput, problems);
|
|
74
|
+
if (inlinedEnvelopeXml !== effectiveInput.envelopeXml) {
|
|
75
|
+
effectiveInput = { ...effectiveInput, envelopeXml: inlinedEnvelopeXml };
|
|
76
|
+
}
|
|
77
|
+
// WS-Addressing runs first of the envelope rewrites: before WS-Security, so a signature
|
|
78
|
+
// configured to cover the `wsa:*` headers finds them already in place, and before the
|
|
79
|
+
// attachment pipeline, so they are inside the envelope MTOM/SwA package and raw capture show.
|
|
80
|
+
let wsaApplied;
|
|
81
|
+
const wsa = effectiveInput.wsa;
|
|
82
|
+
if (wsa !== undefined && wsa.config.enabled) {
|
|
83
|
+
let messageId;
|
|
84
|
+
const uuid = wsa.uuid ?? (() => randomUUID());
|
|
85
|
+
const envelopeXml = applyWsaHeaders(effectiveInput.envelopeXml, wsa.config, {
|
|
86
|
+
endpoint: effectiveInput.endpoint,
|
|
87
|
+
...(effectiveInput.soapAction !== undefined ? { soapAction: effectiveInput.soapAction } : {}),
|
|
88
|
+
defaultAction: wsa.defaultAction,
|
|
89
|
+
uuid: () => {
|
|
90
|
+
const value = uuid();
|
|
91
|
+
messageId = `urn:uuid:${value}`;
|
|
92
|
+
return value;
|
|
93
|
+
},
|
|
94
|
+
envelopeVersion: effectiveInput.soapVersion,
|
|
95
|
+
});
|
|
96
|
+
const action = effectiveAction(wsa.config, {
|
|
97
|
+
...(effectiveInput.soapAction !== undefined ? { soapAction: effectiveInput.soapAction } : {}),
|
|
98
|
+
defaultAction: wsa.defaultAction,
|
|
99
|
+
});
|
|
100
|
+
// A fixed MessageID never goes through the uuid factory, so read it back off the config.
|
|
101
|
+
const fixed = wsa.config.messageId;
|
|
102
|
+
if (messageId === undefined && fixed !== undefined && fixed.length > 0 && fixed !== 'auto') {
|
|
103
|
+
messageId = fixed;
|
|
104
|
+
}
|
|
105
|
+
effectiveInput = { ...effectiveInput, envelopeXml };
|
|
106
|
+
wsaApplied = {
|
|
107
|
+
...(messageId !== undefined ? { messageId } : {}),
|
|
108
|
+
...(action !== undefined ? { action } : {}),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// WS-Security runs on the expanded envelope and before the attachment pipeline, so the
|
|
112
|
+
// header is inside the envelope that MTOM/SwA package and that raw capture records.
|
|
113
|
+
let wssApplied;
|
|
114
|
+
const wss = effectiveInput.wss;
|
|
115
|
+
if (wss?.outgoing !== undefined) {
|
|
116
|
+
const envelopeXml = await applyOutgoingWss(effectiveInput.envelopeXml, wss.outgoing, wss.ctx, {
|
|
117
|
+
...(wss.requestProperties !== undefined ? { requestProperties: wss.requestProperties } : {}),
|
|
118
|
+
});
|
|
119
|
+
effectiveInput = { ...effectiveInput, envelopeXml };
|
|
120
|
+
wssApplied = wss.outgoing.entries.map((entry) => entry.kind);
|
|
121
|
+
}
|
|
122
|
+
const charset = charsetOf(effectiveInput.headers !== undefined ? headerValue(effectiveInput.headers, 'content-type') : undefined) ??
|
|
123
|
+
'UTF-8';
|
|
124
|
+
const computed = soapActionHeaders(effectiveInput.soapVersion, effectiveInput.soapAction, {
|
|
125
|
+
...(effectiveInput.skipSoapAction !== undefined ? { skipSoapAction: effectiveInput.skipSoapAction } : {}),
|
|
126
|
+
charset,
|
|
127
|
+
});
|
|
128
|
+
const headers = mergeHeaders({ 'content-type': computed.contentType, ...computed.headers }, effectiveInput.headers ?? {});
|
|
129
|
+
// Attachments are packaged before compression, so gzip applies to the whole multipart
|
|
130
|
+
// body exactly as it would to a plain envelope.
|
|
131
|
+
const encoded = await packageRequestBody(effectiveInput, headers);
|
|
132
|
+
// Compression is applied after the headers are merged so a caller-supplied Content-Encoding
|
|
133
|
+
// cannot silently disagree with what is actually on the wire.
|
|
134
|
+
const body = effectiveInput.compressBody === 'gzip' ? new Uint8Array(gzipSync(encoded)) : encoded;
|
|
135
|
+
if (effectiveInput.compressBody === 'gzip') {
|
|
136
|
+
headers['content-encoding'] = 'gzip';
|
|
137
|
+
}
|
|
138
|
+
const timeoutMs = effectiveInput.timeoutMs ?? 60_000;
|
|
139
|
+
const request = {
|
|
140
|
+
url: effectiveInput.endpoint,
|
|
141
|
+
method: 'POST',
|
|
142
|
+
headers,
|
|
143
|
+
body,
|
|
144
|
+
timeoutMs,
|
|
145
|
+
followRedirects: effectiveInput.followRedirects ?? false,
|
|
146
|
+
...(effectiveInput.maxSizeBytes !== undefined ? { maxSizeBytes: effectiveInput.maxSizeBytes } : {}),
|
|
147
|
+
...(effectiveInput.localAddress !== undefined ? { localAddress: effectiveInput.localAddress } : {}),
|
|
148
|
+
...(effectiveInput.signal !== undefined ? { signal: effectiveInput.signal } : {}),
|
|
149
|
+
...(effectiveInput.tls !== undefined ? { tls: effectiveInput.tls } : {}),
|
|
150
|
+
...(effectiveInput.proxy !== undefined ? { proxy: effectiveInput.proxy } : {}),
|
|
151
|
+
...(effectiveInput.allowH2 !== undefined ? { allowH2: effectiveInput.allowH2 } : {}),
|
|
152
|
+
};
|
|
153
|
+
// Basic (preemptive or challenged) and NTLM are transport concerns, shared with the REST send.
|
|
154
|
+
const authenticated = await sendWithAuth(request, effectiveInput.auth, options);
|
|
155
|
+
const http = authenticated.http;
|
|
156
|
+
const totalDurationMs = authenticated.durationMs;
|
|
157
|
+
const authSummary = authenticated.auth;
|
|
158
|
+
const { envelopeXml: receivedXml, attachments } = readResponseBody(http.body, headerValue(http.headers, 'content-type'), effectiveInput.attachmentOptions, problems);
|
|
159
|
+
// Incoming WS-Security runs on the envelope the response pipeline produced — after MTOM
|
|
160
|
+
// expansion — so a signature over an expanded Body is judged over what the user sees.
|
|
161
|
+
let wssIncoming;
|
|
162
|
+
let envelopeXml = receivedXml;
|
|
163
|
+
if (wss?.incoming !== undefined) {
|
|
164
|
+
wssIncoming = await processIncomingWss(receivedXml, wss.incoming, wss.ctx);
|
|
165
|
+
if (wssIncoming.decryptedXml !== undefined) {
|
|
166
|
+
envelopeXml = wssIncoming.decryptedXml;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let response;
|
|
170
|
+
try {
|
|
171
|
+
const parsed = parseSoapResponse(envelopeXml);
|
|
172
|
+
response = {
|
|
173
|
+
envelopeXml,
|
|
174
|
+
version: parsed.version,
|
|
175
|
+
...(parsed.fault !== undefined ? { fault: parsed.fault } : {}),
|
|
176
|
+
isSoap: true,
|
|
177
|
+
...(attachments !== undefined ? { attachments } : {}),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
catch (cause) {
|
|
181
|
+
if (cause instanceof WirebenchError && cause.code === 'not-a-soap-envelope') {
|
|
182
|
+
response = { envelopeXml, isSoap: false, ...(attachments !== undefined ? { attachments } : {}) };
|
|
183
|
+
problems.push({ code: 'not-soap', message: cause.message });
|
|
184
|
+
}
|
|
185
|
+
else if (cause instanceof WirebenchError && cause.code === 'xml-parse-error') {
|
|
186
|
+
response = { envelopeXml, isSoap: false, ...(attachments !== undefined ? { attachments } : {}) };
|
|
187
|
+
problems.push({ code: 'xml-parse-error', message: cause.message });
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
throw cause;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
http,
|
|
195
|
+
...(response !== undefined ? { response } : {}),
|
|
196
|
+
durationMs: totalDurationMs,
|
|
197
|
+
...(authSummary !== undefined ? { auth: authSummary } : {}),
|
|
198
|
+
problems,
|
|
199
|
+
...(unresolved !== undefined ? { unresolved } : {}),
|
|
200
|
+
...(wsaApplied !== undefined ? { wsa: wsaApplied } : {}),
|
|
201
|
+
...(wssApplied !== undefined || wssIncoming !== undefined
|
|
202
|
+
? {
|
|
203
|
+
wss: {
|
|
204
|
+
...(wssApplied !== undefined ? { applied: wssApplied } : {}),
|
|
205
|
+
...(wssIncoming !== undefined ? { incoming: wssIncoming } : {}),
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
: {}),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns WSDL message parts into the XML that goes inside `soapenv:Body` and
|
|
3
|
+
* `soapenv:Header`, following the WSDL 1.1 SOAP binding and the WS-I Basic
|
|
4
|
+
* Profile conventions for `document`/`rpc` × `literal`/`encoded`.
|
|
5
|
+
*/
|
|
6
|
+
import type { Message, Part, SoapBody, SoapHeader, WsdlDefinition } from '../wsdl/model.js';
|
|
7
|
+
import type { GenerateOptions } from '../xsd/sample-generator.js';
|
|
8
|
+
import type { SchemaSet } from '../xsd/schema-set.js';
|
|
9
|
+
import type { BuildProblem } from './build-problems.js';
|
|
10
|
+
import type { NamespaceScope } from './namespace-scope.js';
|
|
11
|
+
/** Everything the body/header builders need, plus the problem sink they append to. */
|
|
12
|
+
export interface BodyBuildContext {
|
|
13
|
+
readonly definition: WsdlDefinition;
|
|
14
|
+
readonly schemaSet: SchemaSet;
|
|
15
|
+
readonly scope: NamespaceScope;
|
|
16
|
+
readonly genOptions: Partial<GenerateOptions>;
|
|
17
|
+
readonly indent: string;
|
|
18
|
+
readonly problems: BuildProblem[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generates the fragment for one part in `document` style (and for header
|
|
22
|
+
* parts, which are always element-like whatever the body style is).
|
|
23
|
+
*
|
|
24
|
+
* A part declaring a `type` rather than an `element` is not WS-I conformant,
|
|
25
|
+
* but is common in the wild; the part's own name is then used as the
|
|
26
|
+
* (unqualified) element name and no problem is reported.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildDocumentPart(ctx: BodyBuildContext, part: Part): string | undefined;
|
|
29
|
+
/** Selects and orders the parts a body carries: `soap:body/@parts` first, then `parameterOrder`. */
|
|
30
|
+
export declare function orderParts(parts: readonly Part[], bodyParts: readonly string[] | undefined, parameterOrder: readonly string[] | undefined): readonly Part[];
|
|
31
|
+
/**
|
|
32
|
+
* Builds the content of `soapenv:Body` for one binding operation.
|
|
33
|
+
*
|
|
34
|
+
* @param style the effective operation style (`soap:operation/@style` falling back to `soap:binding/@style`)
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildBody(ctx: BodyBuildContext, operationName: string, style: 'document' | 'rpc', body: SoapBody, message: Message, parameterOrder: readonly string[] | undefined): string;
|
|
37
|
+
/** Builds the content of `soapenv:Header` from a binding operation's `soap:header` elements. */
|
|
38
|
+
export declare function buildHeaders(ctx: BodyBuildContext, headers: readonly SoapHeader[]): string;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns WSDL message parts into the XML that goes inside `soapenv:Body` and
|
|
3
|
+
* `soapenv:Header`, following the WSDL 1.1 SOAP binding and the WS-I Basic
|
|
4
|
+
* Profile conventions for `document`/`rpc` × `literal`/`encoded`.
|
|
5
|
+
*/
|
|
6
|
+
import { SchemaError } from '../errors.js';
|
|
7
|
+
import { NS } from '../xml/namespaces.js';
|
|
8
|
+
import { findMessage } from '../wsdl/model.js';
|
|
9
|
+
import { qnameToString } from '../wsdl/qname.js';
|
|
10
|
+
import { generateElement, generateSoapEncArray, generateType } from '../xsd/sample-generator.js';
|
|
11
|
+
import { arrayTypeOf } from '../xsd/sample-types.js';
|
|
12
|
+
import { escapeAttribute } from '../xsd/xml-writer.js';
|
|
13
|
+
import { SOAP_ENVELOPE_PREFIX } from './envelope.js';
|
|
14
|
+
/** Inserts attributes into a fragment's root start tag. */
|
|
15
|
+
function addRootAttributes(xml, attributes) {
|
|
16
|
+
if (attributes.length === 0) {
|
|
17
|
+
return xml;
|
|
18
|
+
}
|
|
19
|
+
const rendered = attributes.map(([name, value]) => ` ${name}="${escapeAttribute(value)}"`).join('');
|
|
20
|
+
// Attribute values are `>`-escaped by the writer, so the first `>` on the
|
|
21
|
+
// first line always terminates the start tag.
|
|
22
|
+
const close = xml.indexOf('>');
|
|
23
|
+
if (close === -1) {
|
|
24
|
+
return xml;
|
|
25
|
+
}
|
|
26
|
+
const insertAt = xml[close - 1] === '/' ? close - 1 : close;
|
|
27
|
+
return `${xml.slice(0, insertAt)}${rendered}${xml.slice(insertAt)}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Removes the `xmlns:*` declarations a fragment put on its own root, for every
|
|
31
|
+
* prefix the envelope now declares with the same URI. A declaration the
|
|
32
|
+
* envelope does not carry is left alone rather than silently dropped.
|
|
33
|
+
*/
|
|
34
|
+
function stripHoistedNamespaces(xml, scope) {
|
|
35
|
+
const close = xml.indexOf('>');
|
|
36
|
+
if (close === -1) {
|
|
37
|
+
return xml;
|
|
38
|
+
}
|
|
39
|
+
const startTag = xml.slice(0, close);
|
|
40
|
+
const stripped = startTag.replace(/ xmlns:([A-Za-z_][\w.-]*)="([^"]*)"/g, (match, prefix, uri) => scope.declares(prefix, uri) ? '' : match);
|
|
41
|
+
return `${stripped}${xml.slice(close)}`;
|
|
42
|
+
}
|
|
43
|
+
/** Prepends `pad` to every non-empty line. */
|
|
44
|
+
function indentLines(xml, pad) {
|
|
45
|
+
return xml
|
|
46
|
+
.split('\n')
|
|
47
|
+
.map((line) => (line.length === 0 ? line : `${pad}${line}`))
|
|
48
|
+
.join('\n');
|
|
49
|
+
}
|
|
50
|
+
/** Registers a fragment's namespaces on the envelope and drops its own declarations. */
|
|
51
|
+
function hoist(ctx, fragment) {
|
|
52
|
+
ctx.scope.markUsed(fragment.namespaces);
|
|
53
|
+
return stripHoistedNamespaces(fragment.xml, ctx.scope);
|
|
54
|
+
}
|
|
55
|
+
function generateOptions(ctx) {
|
|
56
|
+
return { ...ctx.genOptions, indent: ctx.indent, prefixes: ctx.scope.prefixes() };
|
|
57
|
+
}
|
|
58
|
+
/** True when `type` is neither a built-in nor a global type in the schema set. */
|
|
59
|
+
function isUnknownType(ctx, type) {
|
|
60
|
+
return ctx.schemaSet.builtin(type) === undefined && ctx.schemaSet.lookupType(type) === undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generates the fragment for one part in `document` style (and for header
|
|
64
|
+
* parts, which are always element-like whatever the body style is).
|
|
65
|
+
*
|
|
66
|
+
* A part declaring a `type` rather than an `element` is not WS-I conformant,
|
|
67
|
+
* but is common in the wild; the part's own name is then used as the
|
|
68
|
+
* (unqualified) element name and no problem is reported.
|
|
69
|
+
*/
|
|
70
|
+
export function buildDocumentPart(ctx, part) {
|
|
71
|
+
if (part.element !== undefined) {
|
|
72
|
+
try {
|
|
73
|
+
return hoist(ctx, generateElement(ctx.schemaSet, part.element, generateOptions(ctx)));
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (error instanceof SchemaError) {
|
|
77
|
+
ctx.problems.push({
|
|
78
|
+
code: 'unknown-element',
|
|
79
|
+
message: `Part "${part.name}" references undeclared element ${qnameToString(part.element)}`,
|
|
80
|
+
});
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (part.type !== undefined) {
|
|
87
|
+
if (isUnknownType(ctx, part.type)) {
|
|
88
|
+
ctx.problems.push({
|
|
89
|
+
code: 'unknown-type',
|
|
90
|
+
message: `Part "${part.name}" references undeclared type ${qnameToString(part.type)}`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const name = { namespaceUri: '', localName: part.name };
|
|
94
|
+
return hoist(ctx, generateType(ctx.schemaSet, name, part.type, generateOptions(ctx)));
|
|
95
|
+
}
|
|
96
|
+
ctx.problems.push({ code: 'missing-part', message: `Part "${part.name}" declares neither an element nor a type` });
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
/** The SOAP-encoded array item type a part's type declares, if it is one. */
|
|
100
|
+
function soapEncItemType(ctx, type) {
|
|
101
|
+
const definition = ctx.schemaSet.lookupType(type);
|
|
102
|
+
if (definition === undefined ||
|
|
103
|
+
definition.kind !== 'complexType' ||
|
|
104
|
+
definition.content.kind !== 'complexContent' ||
|
|
105
|
+
ctx.schemaSet.builtin(definition.content.base)?.soapEncArray !== true) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
const raw = arrayTypeOf(ctx.schemaSet.resolveContent(definition).attributes);
|
|
109
|
+
if (raw === undefined) {
|
|
110
|
+
return { namespaceUri: NS.XSD, localName: 'anyType' };
|
|
111
|
+
}
|
|
112
|
+
// `wsdl:arrayType` is a QName-plus-bounds, e.g. `xsd:int[]` or `tns:Item[,]`.
|
|
113
|
+
const withoutBounds = raw.replace(/(\[[^\]]*\])+\s*$/, '').trim();
|
|
114
|
+
const colon = withoutBounds.indexOf(':');
|
|
115
|
+
if (colon === -1) {
|
|
116
|
+
return { namespaceUri: NS.XSD, localName: 'anyType' };
|
|
117
|
+
}
|
|
118
|
+
const prefix = withoutBounds.slice(0, colon);
|
|
119
|
+
const localName = withoutBounds.slice(colon + 1);
|
|
120
|
+
// The prefix was in scope on the schema element, whose declarations are not
|
|
121
|
+
// kept; the root `wsdl:definitions` declarations are the practical stand-in.
|
|
122
|
+
const namespaceUri = ctx.definition.namespaceDeclarations[prefix];
|
|
123
|
+
return namespaceUri === undefined || localName === ''
|
|
124
|
+
? { namespaceUri: NS.XSD, localName: 'anyType' }
|
|
125
|
+
: { namespaceUri, localName };
|
|
126
|
+
}
|
|
127
|
+
/** Builds one rpc accessor: an unqualified element named after the part. */
|
|
128
|
+
function buildRpcAccessor(ctx, part, use) {
|
|
129
|
+
const name = { namespaceUri: '', localName: part.name };
|
|
130
|
+
if (part.element !== undefined) {
|
|
131
|
+
// A part with an `element` is non-WS-I for rpc (R2203); emit the element
|
|
132
|
+
// itself as the accessor rather than inventing a wrapper around it.
|
|
133
|
+
return buildDocumentPart(ctx, part);
|
|
134
|
+
}
|
|
135
|
+
if (part.type === undefined) {
|
|
136
|
+
ctx.problems.push({ code: 'missing-part', message: `Part "${part.name}" declares neither an element nor a type` });
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
if (isUnknownType(ctx, part.type)) {
|
|
140
|
+
ctx.problems.push({
|
|
141
|
+
code: 'unknown-type',
|
|
142
|
+
message: `Part "${part.name}" references undeclared type ${qnameToString(part.type)}`,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const itemType = soapEncItemType(ctx, part.type);
|
|
146
|
+
const fragment = itemType !== undefined
|
|
147
|
+
? generateSoapEncArray(ctx.schemaSet, name, itemType, generateOptions(ctx))
|
|
148
|
+
: generateType(ctx.schemaSet, name, part.type, generateOptions(ctx));
|
|
149
|
+
const xml = hoist(ctx, fragment);
|
|
150
|
+
if (use !== 'encoded' || itemType !== undefined) {
|
|
151
|
+
return xml;
|
|
152
|
+
}
|
|
153
|
+
// SOAP encoding wants every simple-typed accessor self-describing.
|
|
154
|
+
const builtin = ctx.schemaSet.builtin(part.type);
|
|
155
|
+
const resolved = ctx.schemaSet.lookupType(part.type);
|
|
156
|
+
if (builtin === undefined && resolved?.kind !== 'simpleType') {
|
|
157
|
+
return xml;
|
|
158
|
+
}
|
|
159
|
+
const typeLabel = `${ctx.scope.use(part.type.namespaceUri)}:${part.type.localName}`;
|
|
160
|
+
return addRootAttributes(xml, [[`${ctx.scope.use(NS.XSI)}:type`, typeLabel]]);
|
|
161
|
+
}
|
|
162
|
+
/** Selects and orders the parts a body carries: `soap:body/@parts` first, then `parameterOrder`. */
|
|
163
|
+
export function orderParts(parts, bodyParts, parameterOrder) {
|
|
164
|
+
const selected = bodyParts === undefined
|
|
165
|
+
? [...parts]
|
|
166
|
+
: bodyParts.flatMap((name) => {
|
|
167
|
+
const match = parts.find((part) => part.name === name);
|
|
168
|
+
return match === undefined ? [] : [match];
|
|
169
|
+
});
|
|
170
|
+
if (parameterOrder === undefined) {
|
|
171
|
+
return selected;
|
|
172
|
+
}
|
|
173
|
+
const ordered = parameterOrder.flatMap((name) => {
|
|
174
|
+
const match = selected.find((part) => part.name === name);
|
|
175
|
+
return match === undefined ? [] : [match];
|
|
176
|
+
});
|
|
177
|
+
// Parts the port type did not name (typically the return part) keep their
|
|
178
|
+
// message order and follow the named ones, per WSDL 1.1 §2.4.5.
|
|
179
|
+
return [...ordered, ...selected.filter((part) => !ordered.includes(part))];
|
|
180
|
+
}
|
|
181
|
+
/** Builds the `soapenv:Body` content for a `document`-style operation. */
|
|
182
|
+
function buildDocumentBody(ctx, parts) {
|
|
183
|
+
return parts
|
|
184
|
+
.map((part) => buildDocumentPart(ctx, part))
|
|
185
|
+
.filter((xml) => xml !== undefined)
|
|
186
|
+
.join('\n');
|
|
187
|
+
}
|
|
188
|
+
/** Builds the `soapenv:Body` content for an `rpc`-style operation: one wrapper, one child per part. */
|
|
189
|
+
function buildRpcBody(ctx, operationName, body, parts) {
|
|
190
|
+
const wrapperNamespace = body.namespace ?? ctx.definition.targetNamespace;
|
|
191
|
+
const prefix = ctx.scope.use(wrapperNamespace);
|
|
192
|
+
const tag = prefix === '' ? operationName : `${prefix}:${operationName}`;
|
|
193
|
+
const attributes = body.use === 'encoded'
|
|
194
|
+
? ` ${SOAP_ENVELOPE_PREFIX}:encodingStyle="${escapeAttribute(body.encodingStyle ?? NS.SOAP11_ENC)}"`
|
|
195
|
+
: '';
|
|
196
|
+
const accessors = parts
|
|
197
|
+
.map((part) => buildRpcAccessor(ctx, part, body.use))
|
|
198
|
+
.filter((xml) => xml !== undefined);
|
|
199
|
+
if (accessors.length === 0) {
|
|
200
|
+
return `<${tag}${attributes}/>`;
|
|
201
|
+
}
|
|
202
|
+
return [`<${tag}${attributes}>`, ...accessors.map((xml) => indentLines(xml, ctx.indent)), `</${tag}>`].join('\n');
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Builds the content of `soapenv:Body` for one binding operation.
|
|
206
|
+
*
|
|
207
|
+
* @param style the effective operation style (`soap:operation/@style` falling back to `soap:binding/@style`)
|
|
208
|
+
*/
|
|
209
|
+
export function buildBody(ctx, operationName, style, body, message, parameterOrder) {
|
|
210
|
+
const parts = orderParts(message.parts, body.parts, style === 'rpc' ? parameterOrder : undefined);
|
|
211
|
+
for (const name of body.parts ?? []) {
|
|
212
|
+
if (!message.parts.some((part) => part.name === name)) {
|
|
213
|
+
ctx.problems.push({
|
|
214
|
+
code: 'missing-part',
|
|
215
|
+
message: `soap:body names part "${name}", which message ${qnameToString(message.name)} does not declare`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return style === 'rpc' ? buildRpcBody(ctx, operationName, body, parts) : buildDocumentBody(ctx, parts);
|
|
220
|
+
}
|
|
221
|
+
/** Builds the content of `soapenv:Header` from a binding operation's `soap:header` elements. */
|
|
222
|
+
export function buildHeaders(ctx, headers) {
|
|
223
|
+
const fragments = [];
|
|
224
|
+
for (const header of headers) {
|
|
225
|
+
const message = findMessage(ctx.definition, header.message);
|
|
226
|
+
if (message === undefined) {
|
|
227
|
+
ctx.problems.push({
|
|
228
|
+
code: 'missing-message',
|
|
229
|
+
message: `soap:header references unknown message ${qnameToString(header.message)}`,
|
|
230
|
+
});
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const part = message.parts.find((candidate) => candidate.name === header.part);
|
|
234
|
+
if (part === undefined) {
|
|
235
|
+
ctx.problems.push({
|
|
236
|
+
code: 'missing-part',
|
|
237
|
+
message: `soap:header references part "${header.part}", which message ${qnameToString(message.name)} does not declare`,
|
|
238
|
+
});
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const xml = buildDocumentPart(ctx, part);
|
|
242
|
+
if (xml === undefined) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
fragments.push(header.use === 'encoded'
|
|
246
|
+
? addRootAttributes(xml, [[`${SOAP_ENVELOPE_PREFIX}:encodingStyle`, header.encodingStyle ?? NS.SOAP11_ENC]])
|
|
247
|
+
: xml);
|
|
248
|
+
}
|
|
249
|
+
return fragments.join('\n');
|
|
250
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Non-fatal problems the sample-request builder reports instead of throwing. */
|
|
2
|
+
/** Machine-readable kinds of {@link BuildProblem}. */
|
|
3
|
+
export type BuildProblemCode = 'unknown-operation' | 'unknown-binding' | 'unsupported-binding' | 'missing-part' | 'unknown-element' | 'unknown-type' | 'missing-portType' | 'missing-message';
|
|
4
|
+
/**
|
|
5
|
+
* A problem encountered while building a sample request. The builder is
|
|
6
|
+
* deliberately total — it always returns an envelope, however degraded — so
|
|
7
|
+
* the UI can show a partial request alongside what is wrong with it.
|
|
8
|
+
*/
|
|
9
|
+
export interface BuildProblem {
|
|
10
|
+
readonly code: BuildProblemCode;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a SOAP envelope into wire bytes and back, per the request's encoding and the
|
|
3
|
+
* response's declared charset.
|
|
4
|
+
*/
|
|
5
|
+
/** The charset declared in a `Content-Type` header value, if any. */
|
|
6
|
+
export declare function charsetOf(contentType: string | undefined): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Encodes `text` for the wire, per `encoding` (default utf-8).
|
|
9
|
+
*
|
|
10
|
+
* `ISO-8859-1` is a valid encoding label (it is one of the choices the Encoding
|
|
11
|
+
* property's `<select>` shows), but it is not one of the labels Node's `Buffer` recognises —
|
|
12
|
+
* `iso-8859-1` is instead spelled `latin1` there. That is the one label this function
|
|
13
|
+
* translates; every other name is handed to `Buffer` as-is.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeBody(text: string, encoding: string | undefined): Uint8Array;
|
|
16
|
+
/** Decodes a response body per its `Content-Type` charset (default UTF-8), falling back to UTF-8 with a `decode-error` problem when the charset label is unsupported or the bytes are invalid for it. */
|
|
17
|
+
export declare function decodeBody(body: Uint8Array, contentType: string | undefined): {
|
|
18
|
+
text: string;
|
|
19
|
+
problem?: {
|
|
20
|
+
readonly code: 'decode-error';
|
|
21
|
+
readonly message: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a SOAP envelope into wire bytes and back, per the request's encoding and the
|
|
3
|
+
* response's declared charset.
|
|
4
|
+
*/
|
|
5
|
+
import { WirebenchError } from '../errors.js';
|
|
6
|
+
/** The charset declared in a `Content-Type` header value, if any. */
|
|
7
|
+
export function charsetOf(contentType) {
|
|
8
|
+
const match = contentType !== undefined ? /charset=([^;]+)/i.exec(contentType) : null;
|
|
9
|
+
return match?.[1]?.trim().replace(/^"|"$/g, '');
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Encodes `text` for the wire, per `encoding` (default utf-8).
|
|
13
|
+
*
|
|
14
|
+
* `ISO-8859-1` is a valid encoding label (it is one of the choices the Encoding
|
|
15
|
+
* property's `<select>` shows), but it is not one of the labels Node's `Buffer` recognises —
|
|
16
|
+
* `iso-8859-1` is instead spelled `latin1` there. That is the one label this function
|
|
17
|
+
* translates; every other name is handed to `Buffer` as-is.
|
|
18
|
+
*/
|
|
19
|
+
export function encodeBody(text, encoding) {
|
|
20
|
+
const normalized = (encoding ?? 'utf-8').toLowerCase();
|
|
21
|
+
if (normalized === 'utf-8' || normalized === 'utf8') {
|
|
22
|
+
return new TextEncoder().encode(text);
|
|
23
|
+
}
|
|
24
|
+
const bufferEncoding = normalized === 'iso-8859-1' ? 'latin1' : normalized;
|
|
25
|
+
if (Buffer.isEncoding(bufferEncoding)) {
|
|
26
|
+
return new Uint8Array(Buffer.from(text, bufferEncoding));
|
|
27
|
+
}
|
|
28
|
+
throw new WirebenchError('unsupported-encoding', `Unsupported request encoding "${encoding}"`, {
|
|
29
|
+
details: { encoding },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Decodes a response body per its `Content-Type` charset (default UTF-8), falling back to UTF-8 with a `decode-error` problem when the charset label is unsupported or the bytes are invalid for it. */
|
|
33
|
+
export function decodeBody(body, contentType) {
|
|
34
|
+
const label = charsetOf(contentType) ?? 'utf-8';
|
|
35
|
+
try {
|
|
36
|
+
return { text: new TextDecoder(label, { fatal: false }).decode(body) };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return {
|
|
40
|
+
text: new TextDecoder('utf-8', { fatal: false }).decode(body),
|
|
41
|
+
problem: {
|
|
42
|
+
code: 'decode-error',
|
|
43
|
+
message: `Response charset "${label}" is not supported; decoded as UTF-8 instead`,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SOAP envelope assembly: wraps already-rendered header and body fragments in
|
|
3
|
+
* a `soapenv:Envelope`, following the conventions classic SOAP workbenches
|
|
4
|
+
* produce (three-space indent, `soapenv` prefix, an always-present `Header`).
|
|
5
|
+
*/
|
|
6
|
+
import type { Document } from '@xmldom/xmldom';
|
|
7
|
+
/** The SOAP version an envelope is written in. */
|
|
8
|
+
export type SoapEnvelopeVersion = '1.1' | '1.2';
|
|
9
|
+
/** The prefix every generated envelope binds its SOAP envelope namespace to. */
|
|
10
|
+
export declare const SOAP_ENVELOPE_PREFIX = "soapenv";
|
|
11
|
+
/** The pieces {@link createEnvelope} wraps. */
|
|
12
|
+
export interface EnvelopeParts {
|
|
13
|
+
/** Already-rendered header block children; omitted or empty yields `<soapenv:Header/>`. */
|
|
14
|
+
readonly headerXml?: string;
|
|
15
|
+
/** Already-rendered body children; empty yields `<soapenv:Body/>`. */
|
|
16
|
+
readonly bodyXml: string;
|
|
17
|
+
/** Extra prefix → namespace URI declarations to hoist onto the `Envelope` element. */
|
|
18
|
+
readonly namespaces?: Readonly<Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
/** The SOAP envelope namespace URI for `version`. */
|
|
21
|
+
export declare function envelopeNamespace(version: SoapEnvelopeVersion): string;
|
|
22
|
+
/**
|
|
23
|
+
* The SOAP version of a parsed document, from its root element's namespace, or
|
|
24
|
+
* `undefined` when the root is not a SOAP `Envelope`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectEnvelopeVersion(doc: Document): SoapEnvelopeVersion | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Wraps `parts` in a SOAP envelope.
|
|
29
|
+
*
|
|
30
|
+
* The `Header` element is always emitted (empty when there are no header
|
|
31
|
+
* blocks): it gives the user somewhere to paste a security
|
|
32
|
+
* header without re-typing the element. Every namespace in
|
|
33
|
+
* {@link EnvelopeParts.namespaces} is declared on the `Envelope` root, so the
|
|
34
|
+
* fragments inside carry no `xmlns` declarations of their own.
|
|
35
|
+
*
|
|
36
|
+
* Deterministic: identical inputs always produce byte-identical output.
|
|
37
|
+
*
|
|
38
|
+
* @param version which SOAP envelope namespace to bind
|
|
39
|
+
* @param parts the header/body fragments and the namespaces they use
|
|
40
|
+
* @param options `indent` defaults to three spaces
|
|
41
|
+
*/
|
|
42
|
+
export declare function createEnvelope(version: SoapEnvelopeVersion, parts: EnvelopeParts, options?: {
|
|
43
|
+
readonly indent?: string;
|
|
44
|
+
}): string;
|