@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,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads what a WSDL says about WS-Addressing, so an imported interface can turn addressing on
|
|
3
|
+
* by itself instead of making the user discover the requirement from a runtime fault.
|
|
4
|
+
*
|
|
5
|
+
* Three shapes are recognised, all of which real services use:
|
|
6
|
+
* - `wsaw:UsingAddressing` (or the 2004 `wsap:UsingAddressing`) on the binding or the port;
|
|
7
|
+
* - a `wsp:Policy` — attached inline or through a `wsp:PolicyReference` to a `#id` — that
|
|
8
|
+
* contains `wsam:Addressing` or one of the `UsingAddressing` assertions;
|
|
9
|
+
* - `wsam:Action` (or `wsaw:Action`) on a `portType` operation's `wsdl:input`, which also
|
|
10
|
+
* supplies that operation's default `wsa:Action`.
|
|
11
|
+
*/
|
|
12
|
+
import { NS } from '../xml/namespaces.js';
|
|
13
|
+
import { findPortType } from '../wsdl/model.js';
|
|
14
|
+
import { qnameEquals, qnameToString } from '../wsdl/qname.js';
|
|
15
|
+
/** The `wsp:Policy`/`wsp:PolicyReference` namespaces, newest first. */
|
|
16
|
+
const POLICY_NAMESPACES = [NS.WSP, NS.WSP_2004];
|
|
17
|
+
/** Every descendant element of `root` (excluding `root` itself), in document order. */
|
|
18
|
+
function descendants(root) {
|
|
19
|
+
const found = [];
|
|
20
|
+
const walk = (element) => {
|
|
21
|
+
for (let node = element.firstChild; node !== null; node = node.nextSibling) {
|
|
22
|
+
if (node.nodeType === 1) {
|
|
23
|
+
found.push(node);
|
|
24
|
+
walk(node);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
walk(root);
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
31
|
+
/** True when `value` is the WS-Policy "true" spelling (`true` or `1`) used by `wsp:Optional`. */
|
|
32
|
+
function isPolicyTrue(value) {
|
|
33
|
+
return value === 'true' || value === '1';
|
|
34
|
+
}
|
|
35
|
+
/** True when `element` carries `wsp:Optional="true"` (either policy-namespace flavour). */
|
|
36
|
+
function isOptionalAssertion(element) {
|
|
37
|
+
return POLICY_NAMESPACES.some((ns) => isPolicyTrue(element.getAttributeNS(ns, 'Optional')));
|
|
38
|
+
}
|
|
39
|
+
/** True when `element` is one of the addressing assertions; describes which flavour and optionality. */
|
|
40
|
+
function addressingAssertion(element) {
|
|
41
|
+
const { namespaceURI: ns, localName } = element;
|
|
42
|
+
const optional = isOptionalAssertion(element);
|
|
43
|
+
if (ns === NS.WSAP_2004 && localName === 'UsingAddressing') {
|
|
44
|
+
return { version: '2004/08', optional };
|
|
45
|
+
}
|
|
46
|
+
if (ns === NS.WSAW && localName === 'UsingAddressing') {
|
|
47
|
+
return { version: '2005/08', optional };
|
|
48
|
+
}
|
|
49
|
+
if (ns === NS.WSAM && (localName === 'Addressing' || localName === 'AnonymousResponses')) {
|
|
50
|
+
return { version: '2005/08', optional };
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
/** The `wsp:Policy` element with `wsu:Id`/`xml:id`/`Id` equal to `id`, anywhere in `doc`. */
|
|
55
|
+
function policyById(doc, id) {
|
|
56
|
+
const root = doc.documentElement;
|
|
57
|
+
if (root === null) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
for (const element of descendants(root)) {
|
|
61
|
+
if (!POLICY_NAMESPACES.some((ns) => ns === element.namespaceURI) || element.localName !== 'Policy') {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const wsuId = element.getAttributeNS(NS.WSU, 'Id');
|
|
65
|
+
const xmlId = element.getAttributeNS(NS.XML, 'id');
|
|
66
|
+
const plainId = element.getAttribute('Id');
|
|
67
|
+
const candidate = wsuId !== null && wsuId.length > 0
|
|
68
|
+
? wsuId
|
|
69
|
+
: xmlId !== null && xmlId.length > 0
|
|
70
|
+
? xmlId
|
|
71
|
+
: plainId !== null && plainId.length > 0
|
|
72
|
+
? plainId
|
|
73
|
+
: undefined;
|
|
74
|
+
if (candidate === id) {
|
|
75
|
+
return element;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The addressing assertions reachable from `owner`: its own extension children, plus every
|
|
82
|
+
* policy it attaches inline or references by `#id`.
|
|
83
|
+
*/
|
|
84
|
+
function assertionsUnder(owner) {
|
|
85
|
+
const versions = [];
|
|
86
|
+
const consider = (element) => {
|
|
87
|
+
const assertion = addressingAssertion(element);
|
|
88
|
+
if (assertion !== undefined) {
|
|
89
|
+
versions.push(assertion);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
for (let node = owner.firstChild; node !== null; node = node.nextSibling) {
|
|
93
|
+
if (node.nodeType !== 1) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const element = node;
|
|
97
|
+
consider(element);
|
|
98
|
+
const isPolicyNs = POLICY_NAMESPACES.some((ns) => ns === element.namespaceURI);
|
|
99
|
+
if (isPolicyNs && element.localName === 'Policy') {
|
|
100
|
+
descendants(element).forEach(consider);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (isPolicyNs && element.localName === 'PolicyReference') {
|
|
104
|
+
const uri = element.getAttribute('URI');
|
|
105
|
+
const doc = owner.ownerDocument;
|
|
106
|
+
if (uri !== null && uri.startsWith('#') && doc !== null) {
|
|
107
|
+
const policy = policyById(doc, uri.slice(1));
|
|
108
|
+
if (policy !== undefined) {
|
|
109
|
+
consider(policy);
|
|
110
|
+
descendants(policy).forEach(consider);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return versions;
|
|
116
|
+
}
|
|
117
|
+
/** The `wsam:Action`/`wsaw:Action` attribute of a `portType` operation's `wsdl:input`. */
|
|
118
|
+
function declaredAction(operation) {
|
|
119
|
+
const input = operation?.input?.sourceElement;
|
|
120
|
+
if (input === undefined) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
for (const ns of [NS.WSAM, NS.WSAW]) {
|
|
124
|
+
const value = input.getAttributeNS(ns, 'Action');
|
|
125
|
+
if (value !== null && value.length > 0) {
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/** Joins `parts` with single `/` separators, tolerating a target namespace with a trailing one. */
|
|
132
|
+
function joinUri(...parts) {
|
|
133
|
+
return parts
|
|
134
|
+
.map((part, index) => (index === 0 ? part.replace(/\/+$/, '') : part.replace(/^\/+|\/+$/g, '')))
|
|
135
|
+
.join('/');
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The default `wsa:Action` for one operation, following the WS-Addressing 1.0 WSDL binding's
|
|
139
|
+
* precedence: an explicit `wsam:Action`, then a non-empty `soapAction`, then the default
|
|
140
|
+
* pattern `<targetNamespace>/<portType>/<operation>Request`.
|
|
141
|
+
*
|
|
142
|
+
* @param definition the definition the operation belongs to
|
|
143
|
+
* @param portType the operation's `wsdl:portType`
|
|
144
|
+
* @param operation the abstract `wsdl:operation`
|
|
145
|
+
* @param options `soapAction` from the binding operation, when it has one
|
|
146
|
+
*/
|
|
147
|
+
export function defaultAction(definition, portType, operation, options) {
|
|
148
|
+
const declared = declaredAction(operation);
|
|
149
|
+
if (declared !== undefined) {
|
|
150
|
+
return declared;
|
|
151
|
+
}
|
|
152
|
+
const soapAction = options?.soapAction;
|
|
153
|
+
if (soapAction !== undefined && soapAction.length > 0) {
|
|
154
|
+
return soapAction;
|
|
155
|
+
}
|
|
156
|
+
const namespace = portType.name.namespaceUri.length > 0 ? portType.name.namespaceUri : definition.targetNamespace;
|
|
157
|
+
return joinUri(namespace, portType.name.localName, `${operation.name}Request`);
|
|
158
|
+
}
|
|
159
|
+
/** The ports, across every service, that bind to `binding`. */
|
|
160
|
+
function portElementsFor(definition, binding) {
|
|
161
|
+
const elements = [];
|
|
162
|
+
for (const service of definition.services) {
|
|
163
|
+
for (const port of service.ports) {
|
|
164
|
+
if (qnameEquals(port.binding, binding.name) && port.sourceElement !== undefined) {
|
|
165
|
+
elements.push(port.sourceElement);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return elements;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* What `definition` says about WS-Addressing for one binding operation.
|
|
173
|
+
*
|
|
174
|
+
* `version` is `'2004/08'` only when *every* marker found is a 2004 one; a definition that
|
|
175
|
+
* mixes the two (or declares none at all) is treated as 2005/08, the version a modern stack
|
|
176
|
+
* speaks.
|
|
177
|
+
*
|
|
178
|
+
* @param definition the imported definition
|
|
179
|
+
* @param binding the binding the operation belongs to
|
|
180
|
+
* @param operation the binding operation, for its `soapAction` and abstract counterpart
|
|
181
|
+
*/
|
|
182
|
+
export function detectWsaDefaults(definition, binding, operation) {
|
|
183
|
+
const owners = [
|
|
184
|
+
...(binding.sourceElement !== undefined ? [binding.sourceElement] : []),
|
|
185
|
+
...portElementsFor(definition, binding),
|
|
186
|
+
];
|
|
187
|
+
const assertions = owners.flatMap(assertionsUnder);
|
|
188
|
+
const portType = findPortType(definition, binding.type);
|
|
189
|
+
const abstract = portType?.operations.find((candidate) => candidate.name === operation.name);
|
|
190
|
+
const action = declaredAction(abstract);
|
|
191
|
+
const required = assertions.filter((assertion) => !assertion.optional);
|
|
192
|
+
const usingAddressing = required.length > 0 || action !== undefined;
|
|
193
|
+
const versionSource = required.length > 0 ? required : assertions;
|
|
194
|
+
const version = versionSource.length > 0 && versionSource.every((a) => a.version === '2004/08') ? '2004/08' : '2005/08';
|
|
195
|
+
// Optional only when the WSDL merely offers addressing (no required assertion, no declared
|
|
196
|
+
// action) but does say something — an `wsp:Optional="true"` assertion.
|
|
197
|
+
const optional = !usingAddressing && assertions.some((assertion) => assertion.optional);
|
|
198
|
+
return {
|
|
199
|
+
usingAddressing,
|
|
200
|
+
version,
|
|
201
|
+
...(action !== undefined ? { action } : {}),
|
|
202
|
+
...(optional ? { optional: true } : {}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** The `defaultActionByOperation` key for one binding operation: `{ns}Binding|Operation`. */
|
|
206
|
+
export function wsaActionKey(bindingName, operationName) {
|
|
207
|
+
return `${qnameToString(bindingName)}|${operationName}`;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Folds {@link detectWsaDefaults} and {@link defaultAction} over every binding operation, for
|
|
211
|
+
* the interface summary an import produces.
|
|
212
|
+
*
|
|
213
|
+
* @param definition the imported definition
|
|
214
|
+
*/
|
|
215
|
+
export function summarizeWsa(definition) {
|
|
216
|
+
let enabled = false;
|
|
217
|
+
let optional = false;
|
|
218
|
+
const versions = [];
|
|
219
|
+
const defaultActionByOperation = {};
|
|
220
|
+
for (const binding of definition.bindings) {
|
|
221
|
+
const portType = findPortType(definition, binding.type);
|
|
222
|
+
for (const operation of binding.operations) {
|
|
223
|
+
const detected = detectWsaDefaults(definition, binding, operation);
|
|
224
|
+
if (detected.usingAddressing) {
|
|
225
|
+
enabled = true;
|
|
226
|
+
versions.push(detected.version);
|
|
227
|
+
}
|
|
228
|
+
else if (detected.optional === true) {
|
|
229
|
+
optional = true;
|
|
230
|
+
}
|
|
231
|
+
const abstract = portType?.operations.find((candidate) => candidate.name === operation.name);
|
|
232
|
+
if (portType !== undefined && abstract !== undefined) {
|
|
233
|
+
defaultActionByOperation[wsaActionKey(binding.name, operation.name)] = defaultAction(definition, portType, abstract, {
|
|
234
|
+
...(operation.soapAction !== undefined ? { soapAction: operation.soapAction } : {}),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
enabled,
|
|
241
|
+
optional,
|
|
242
|
+
version: versions.length > 0 && versions.every((v) => v === '2004/08') ? '2004/08' : '2005/08',
|
|
243
|
+
defaultActionByOperation,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives on-disk file names for the documents in a {@link DefinitionBundle}
|
|
3
|
+
* when writing a definition cache or an export folder. Shared by
|
|
4
|
+
* `wsdl/cache.ts` and `wsdl/export-definition.ts` so both lay documents out
|
|
5
|
+
* identically (a location always maps to the same relative file name).
|
|
6
|
+
*
|
|
7
|
+
* File names are sanitised with the same segment-validation rules Task 17
|
|
8
|
+
* uses for project slugs ({@link sanitiseFileName}/{@link isReservedFileName}
|
|
9
|
+
* from `project/paths.ts`), so a hyphen or space is preserved and a Windows
|
|
10
|
+
* reserved device name (`CON`, `NUL`, `COM1`, ...) is renamed safely instead
|
|
11
|
+
* of being written as-is.
|
|
12
|
+
*/
|
|
13
|
+
/** The least a document must say for a file name to be derived from it. */
|
|
14
|
+
export interface NameableDocument {
|
|
15
|
+
readonly location: string;
|
|
16
|
+
/** The extension a document with no usable name of its own falls back to (`wsdl`, `xsd`, `yaml`). */
|
|
17
|
+
readonly kind: string;
|
|
18
|
+
}
|
|
19
|
+
/** Options accepted by {@link assignFileNames}. */
|
|
20
|
+
export interface AssignFileNamesOptions {
|
|
21
|
+
/** File name for the root document when its location gives none. Defaults to `service.wsdl`. */
|
|
22
|
+
readonly rootFile?: string;
|
|
23
|
+
}
|
|
24
|
+
/** One document's assigned on-disk file name, alongside the document itself. */
|
|
25
|
+
export interface NamedDocument<T extends NameableDocument = NameableDocument> {
|
|
26
|
+
readonly document: T;
|
|
27
|
+
readonly file: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Assigns a unique, sanitised file name to every document in `documents`
|
|
31
|
+
* (root first, in the order given), de-duplicating collisions with a
|
|
32
|
+
* numeric suffix inserted before the extension (`service.wsdl`,
|
|
33
|
+
* `service-2.wsdl`, ...).
|
|
34
|
+
*
|
|
35
|
+
* Generic in the document type so a caller keeps its own: the naming rules
|
|
36
|
+
* only ever read `location` and `kind`, which is why an OpenAPI definition
|
|
37
|
+
* cache uses the same function as a WSDL one.
|
|
38
|
+
*/
|
|
39
|
+
export declare function assignFileNames<T extends NameableDocument>(documents: readonly T[], options?: AssignFileNamesOptions): readonly NamedDocument<T>[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives on-disk file names for the documents in a {@link DefinitionBundle}
|
|
3
|
+
* when writing a definition cache or an export folder. Shared by
|
|
4
|
+
* `wsdl/cache.ts` and `wsdl/export-definition.ts` so both lay documents out
|
|
5
|
+
* identically (a location always maps to the same relative file name).
|
|
6
|
+
*
|
|
7
|
+
* File names are sanitised with the same segment-validation rules Task 17
|
|
8
|
+
* uses for project slugs ({@link sanitiseFileName}/{@link isReservedFileName}
|
|
9
|
+
* from `project/paths.ts`), so a hyphen or space is preserved and a Windows
|
|
10
|
+
* reserved device name (`CON`, `NUL`, `COM1`, ...) is renamed safely instead
|
|
11
|
+
* of being written as-is.
|
|
12
|
+
*/
|
|
13
|
+
import { isReservedFileName, sanitiseFileName } from '../project/paths.js';
|
|
14
|
+
/** Extracts the last path segment of a location's pathname, ignoring any query/fragment. */
|
|
15
|
+
function lastPathSegment(location) {
|
|
16
|
+
try {
|
|
17
|
+
const url = new URL(location);
|
|
18
|
+
const segments = url.pathname.split('/').filter((s) => s.length > 0);
|
|
19
|
+
return segments.at(-1);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Extension to use for a document with no usable name of its own, keyed by `kind`. */
|
|
26
|
+
function fallbackName(isRoot, kind, index, rootFile) {
|
|
27
|
+
if (isRoot) {
|
|
28
|
+
return rootFile;
|
|
29
|
+
}
|
|
30
|
+
return `document-${index}.${kind}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Renames a reserved Windows device name (`CON`, `NUL`, `COM1`, ...) safely
|
|
34
|
+
* by suffixing its stem with `_`, keeping the extension intact (`con.xsd` →
|
|
35
|
+
* `con_.xsd`). Names that are not reserved pass through unchanged.
|
|
36
|
+
*/
|
|
37
|
+
function guardReservedName(name) {
|
|
38
|
+
if (!isReservedFileName(name)) {
|
|
39
|
+
return name;
|
|
40
|
+
}
|
|
41
|
+
const dot = name.lastIndexOf('.');
|
|
42
|
+
const stem = dot > 0 ? name.slice(0, dot) : name;
|
|
43
|
+
const ext = dot > 0 ? name.slice(dot) : '';
|
|
44
|
+
return `${stem}_${ext}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Chooses a base file name for one document: the last segment of its
|
|
48
|
+
* location when it looks like a real file name (has an extension), or a
|
|
49
|
+
* `service.wsdl` / `document-N.<kind>` fallback for extensionless or
|
|
50
|
+
* unparsable locations (e.g. a `?wsdl` query-string root). Either way, the
|
|
51
|
+
* result is sanitised and guarded against Windows reserved device names.
|
|
52
|
+
*/
|
|
53
|
+
function baseFileName(doc, isRoot, index, rootFile) {
|
|
54
|
+
const segment = lastPathSegment(doc.location);
|
|
55
|
+
if (segment !== undefined && /\.[A-Za-z0-9]+$/.test(segment)) {
|
|
56
|
+
return guardReservedName(sanitiseFileName(segment));
|
|
57
|
+
}
|
|
58
|
+
return guardReservedName(fallbackName(isRoot, doc.kind, index, rootFile));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Assigns a unique, sanitised file name to every document in `documents`
|
|
62
|
+
* (root first, in the order given), de-duplicating collisions with a
|
|
63
|
+
* numeric suffix inserted before the extension (`service.wsdl`,
|
|
64
|
+
* `service-2.wsdl`, ...).
|
|
65
|
+
*
|
|
66
|
+
* Generic in the document type so a caller keeps its own: the naming rules
|
|
67
|
+
* only ever read `location` and `kind`, which is why an OpenAPI definition
|
|
68
|
+
* cache uses the same function as a WSDL one.
|
|
69
|
+
*/
|
|
70
|
+
export function assignFileNames(documents, options) {
|
|
71
|
+
const rootFile = options?.rootFile ?? 'service.wsdl';
|
|
72
|
+
const used = new Set();
|
|
73
|
+
const named = [];
|
|
74
|
+
documents.forEach((document, index) => {
|
|
75
|
+
const isRoot = index === 0;
|
|
76
|
+
const base = baseFileName(document, isRoot, index, rootFile);
|
|
77
|
+
const dot = base.lastIndexOf('.');
|
|
78
|
+
const stem = dot > 0 ? base.slice(0, dot) : base;
|
|
79
|
+
const ext = dot > 0 ? base.slice(dot) : '';
|
|
80
|
+
let candidate = base;
|
|
81
|
+
let n = 2;
|
|
82
|
+
while (used.has(candidate.toLowerCase())) {
|
|
83
|
+
candidate = `${stem}-${n}${ext}`;
|
|
84
|
+
n += 1;
|
|
85
|
+
}
|
|
86
|
+
used.add(candidate.toLowerCase());
|
|
87
|
+
named.push({ document, file: candidate });
|
|
88
|
+
});
|
|
89
|
+
return named;
|
|
90
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persists a resolved {@link DefinitionBundle} byte-exact inside a project
|
|
3
|
+
* (`interfaces/<slug>/definition/`) so the interface can be opened offline,
|
|
4
|
+
* and reconstructs a bundle from that cache later. Unlike
|
|
5
|
+
* `wsdl/export-definition.ts`, nothing here is ever re-serialised: every
|
|
6
|
+
* document is written and read back as the exact bytes that were fetched,
|
|
7
|
+
* verified by SHA-256 against the manifest.
|
|
8
|
+
*/
|
|
9
|
+
import type { DefinitionCacheManifest } from '../project/schema.js';
|
|
10
|
+
import type { FsLike } from '../project/fs.js';
|
|
11
|
+
import type { DefinitionBundle, FetchDocument } from './resolver.js';
|
|
12
|
+
/** Options accepted by {@link writeDefinitionCache} and {@link readDefinitionCache}. */
|
|
13
|
+
export interface DefinitionCacheOptions {
|
|
14
|
+
/** Overrides the file system, e.g. for tests. Defaults to `nodeFs`. */
|
|
15
|
+
readonly fs?: FsLike;
|
|
16
|
+
}
|
|
17
|
+
/** Options accepted by {@link writeDefinitionCache} beyond {@link DefinitionCacheOptions}. */
|
|
18
|
+
export interface WriteDefinitionCacheOptions extends DefinitionCacheOptions {
|
|
19
|
+
/** Overrides the clock used for `fetchedAt`. Defaults to `() => new Date().toISOString()`. */
|
|
20
|
+
readonly now?: () => string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Writes every document of `bundle` byte-exact into `dir` (created if
|
|
24
|
+
* needed), alongside a `manifest.yaml` describing them, and returns that
|
|
25
|
+
* manifest. This entirely REPLACES the directory's previous contents: any
|
|
26
|
+
* file left over from a prior cache that is not part of the new manifest is
|
|
27
|
+
* deleted, so the folder never accumulates stale documents across re-caches.
|
|
28
|
+
*
|
|
29
|
+
* @param bundle the resolved definition to cache
|
|
30
|
+
* @param dir absolute path of the interface's `definition/` directory
|
|
31
|
+
*/
|
|
32
|
+
export declare function writeDefinitionCache(bundle: DefinitionBundle, dir: string, options?: WriteDefinitionCacheOptions): Promise<DefinitionCacheManifest>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads a manifest previously written by {@link writeDefinitionCache} back
|
|
35
|
+
* into a {@link DefinitionBundle}, re-parsing every document and verifying
|
|
36
|
+
* its bytes against the manifest's recorded SHA-256.
|
|
37
|
+
*
|
|
38
|
+
* @throws {ProjectError} `definition-cache-missing` if `dir` has no `manifest.yaml`
|
|
39
|
+
* @throws {ProjectError} `definition-cache-corrupt` if a document's bytes no longer match its recorded hash
|
|
40
|
+
*/
|
|
41
|
+
export declare function readDefinitionCache(dir: string, options?: DefinitionCacheOptions): Promise<DefinitionBundle>;
|
|
42
|
+
/**
|
|
43
|
+
* Wraps `fallback` with a {@link FetchDocument} that serves documents from a
|
|
44
|
+
* previously-written cache by canonical location (or the location that was
|
|
45
|
+
* originally requested to fetch it), and only falls through to `fallback`
|
|
46
|
+
* for a location the cache does not contain.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createCachedFetchDocument(manifest: DefinitionCacheManifest, dir: string, fallback: FetchDocument, options?: DefinitionCacheOptions): FetchDocument;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persists a resolved {@link DefinitionBundle} byte-exact inside a project
|
|
3
|
+
* (`interfaces/<slug>/definition/`) so the interface can be opened offline,
|
|
4
|
+
* and reconstructs a bundle from that cache later. Unlike
|
|
5
|
+
* `wsdl/export-definition.ts`, nothing here is ever re-serialised: every
|
|
6
|
+
* document is written and read back as the exact bytes that were fetched,
|
|
7
|
+
* verified by SHA-256 against the manifest.
|
|
8
|
+
*/
|
|
9
|
+
import { createHash } from 'node:crypto';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { ProjectError } from '../errors.js';
|
|
12
|
+
import { definitionCacheManifestSchema, parseFile } from '../project/schema.js';
|
|
13
|
+
import { nodeFs, readFileIfExists, readdirIfExists, writeFileAtomic } from '../project/fs.js';
|
|
14
|
+
import { parseYaml, stringifyYaml } from '../project/yaml.js';
|
|
15
|
+
import { parseXml } from '../xml/parse.js';
|
|
16
|
+
import { assignFileNames } from './cache-naming.js';
|
|
17
|
+
const MANIFEST_FILE = 'manifest.yaml';
|
|
18
|
+
/** Hex-encoded SHA-256 digest of `bytes`, used to verify cached documents haven't been tampered with or corrupted. */
|
|
19
|
+
function sha256Hex(bytes) {
|
|
20
|
+
return createHash('sha256').update(bytes).digest('hex');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Writes every document of `bundle` byte-exact into `dir` (created if
|
|
24
|
+
* needed), alongside a `manifest.yaml` describing them, and returns that
|
|
25
|
+
* manifest. This entirely REPLACES the directory's previous contents: any
|
|
26
|
+
* file left over from a prior cache that is not part of the new manifest is
|
|
27
|
+
* deleted, so the folder never accumulates stale documents across re-caches.
|
|
28
|
+
*
|
|
29
|
+
* @param bundle the resolved definition to cache
|
|
30
|
+
* @param dir absolute path of the interface's `definition/` directory
|
|
31
|
+
*/
|
|
32
|
+
export async function writeDefinitionCache(bundle, dir, options) {
|
|
33
|
+
const fs = options?.fs ?? nodeFs;
|
|
34
|
+
const now = options?.now ?? (() => new Date().toISOString());
|
|
35
|
+
const existing = await readdirIfExists(fs, dir);
|
|
36
|
+
const named = assignFileNames(bundle.documents);
|
|
37
|
+
const documents = named.map(({ document, file }) => ({
|
|
38
|
+
file,
|
|
39
|
+
location: document.location,
|
|
40
|
+
...(document.requestedLocation !== document.location ? { requestedLocation: document.requestedLocation } : {}),
|
|
41
|
+
kind: document.kind,
|
|
42
|
+
sha256: sha256Hex(document.bytes),
|
|
43
|
+
bytes: document.bytes.length,
|
|
44
|
+
...(document.importedBy !== undefined ? { importedBy: document.importedBy } : {}),
|
|
45
|
+
...(document.namespace !== undefined ? { namespace: document.namespace } : {}),
|
|
46
|
+
...(document.chameleonFor !== undefined ? { chameleonFor: document.chameleonFor } : {}),
|
|
47
|
+
}));
|
|
48
|
+
const manifest = {
|
|
49
|
+
formatVersion: 1,
|
|
50
|
+
rootLocation: bundle.root.location,
|
|
51
|
+
fetchedAt: now(),
|
|
52
|
+
documents,
|
|
53
|
+
};
|
|
54
|
+
for (const { document, file } of named) {
|
|
55
|
+
await writeFileAtomic(fs, join(dir, file), Buffer.from(document.bytes));
|
|
56
|
+
}
|
|
57
|
+
await writeFileAtomic(fs, join(dir, MANIFEST_FILE), stringifyYaml(manifest));
|
|
58
|
+
const keep = new Set([MANIFEST_FILE, ...named.map((n) => n.file)]);
|
|
59
|
+
for (const entry of existing) {
|
|
60
|
+
if (entry.isFile && !keep.has(entry.name)) {
|
|
61
|
+
await fs.rm(join(dir, entry.name), { force: true });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return manifest;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads a manifest previously written by {@link writeDefinitionCache} back
|
|
68
|
+
* into a {@link DefinitionBundle}, re-parsing every document and verifying
|
|
69
|
+
* its bytes against the manifest's recorded SHA-256.
|
|
70
|
+
*
|
|
71
|
+
* @throws {ProjectError} `definition-cache-missing` if `dir` has no `manifest.yaml`
|
|
72
|
+
* @throws {ProjectError} `definition-cache-corrupt` if a document's bytes no longer match its recorded hash
|
|
73
|
+
*/
|
|
74
|
+
export async function readDefinitionCache(dir, options) {
|
|
75
|
+
const fs = options?.fs ?? nodeFs;
|
|
76
|
+
const manifestPath = join(dir, MANIFEST_FILE);
|
|
77
|
+
const manifestRaw = await readFileIfExists(fs, manifestPath);
|
|
78
|
+
if (manifestRaw === undefined) {
|
|
79
|
+
throw new ProjectError('definition-cache-missing', `No definition cache manifest at ${manifestPath}`, {
|
|
80
|
+
details: { dir },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const manifest = parseFile(definitionCacheManifestSchema, parseYaml(manifestRaw.toString('utf-8'), manifestPath), manifestPath);
|
|
84
|
+
const documents = [];
|
|
85
|
+
for (const entry of manifest.documents) {
|
|
86
|
+
const filePath = join(dir, entry.file);
|
|
87
|
+
const buffer = await fs.readFile(filePath);
|
|
88
|
+
const bytes = new Uint8Array(buffer);
|
|
89
|
+
const actualSha256 = sha256Hex(bytes);
|
|
90
|
+
if (actualSha256 !== entry.sha256) {
|
|
91
|
+
throw new ProjectError('definition-cache-corrupt', `Definition cache document "${entry.file}" is corrupt`, {
|
|
92
|
+
details: { file: entry.file, expected: entry.sha256, actual: actualSha256 },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const text = new TextDecoder('utf-8').decode(bytes);
|
|
96
|
+
const document = parseXml(text, { location: entry.location });
|
|
97
|
+
documents.push({
|
|
98
|
+
location: entry.location,
|
|
99
|
+
requestedLocation: entry.requestedLocation ?? entry.location,
|
|
100
|
+
bytes,
|
|
101
|
+
text,
|
|
102
|
+
kind: entry.kind,
|
|
103
|
+
...(entry.importedBy !== undefined ? { importedBy: entry.importedBy } : {}),
|
|
104
|
+
...(entry.namespace !== undefined ? { namespace: entry.namespace } : {}),
|
|
105
|
+
...(entry.chameleonFor !== undefined ? { chameleonFor: entry.chameleonFor } : {}),
|
|
106
|
+
document,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const root = documents.find((d) => d.location === manifest.rootLocation) ?? documents[0];
|
|
110
|
+
if (root === undefined) {
|
|
111
|
+
throw new ProjectError('definition-cache-corrupt', `Definition cache manifest at ${manifestPath} lists no documents`, {
|
|
112
|
+
details: { dir },
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return { root, documents, problems: [] };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Wraps `fallback` with a {@link FetchDocument} that serves documents from a
|
|
119
|
+
* previously-written cache by canonical location (or the location that was
|
|
120
|
+
* originally requested to fetch it), and only falls through to `fallback`
|
|
121
|
+
* for a location the cache does not contain.
|
|
122
|
+
*/
|
|
123
|
+
export function createCachedFetchDocument(manifest, dir, fallback, options) {
|
|
124
|
+
const fs = options?.fs ?? nodeFs;
|
|
125
|
+
const byLocation = new Map();
|
|
126
|
+
for (const entry of manifest.documents) {
|
|
127
|
+
byLocation.set(entry.location, entry);
|
|
128
|
+
if (entry.requestedLocation !== undefined) {
|
|
129
|
+
byLocation.set(entry.requestedLocation, entry);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return async (location, signal) => {
|
|
133
|
+
const entry = byLocation.get(location);
|
|
134
|
+
if (entry === undefined) {
|
|
135
|
+
return fallback(location, signal);
|
|
136
|
+
}
|
|
137
|
+
const buffer = await fs.readFile(join(dir, entry.file));
|
|
138
|
+
const bytes = new Uint8Array(buffer);
|
|
139
|
+
return { location: entry.location, bytes, text: new TextDecoder('utf-8').decode(bytes) };
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Generate Documentation": renders an imported definition as a
|
|
3
|
+
* single self-contained document — HTML (inline CSS, no scripts, everything
|
|
4
|
+
* escaped) or Markdown (with a table of contents).
|
|
5
|
+
*
|
|
6
|
+
* Pure and deterministic: the same {@link ImportResult} always produces
|
|
7
|
+
* byte-identical output, so the golden tests are meaningful and a regenerated
|
|
8
|
+
* document is a clean diff. Nothing is fetched; every byte comes from the
|
|
9
|
+
* bundle the import already resolved.
|
|
10
|
+
*/
|
|
11
|
+
import type { ImportResult } from '../types.js';
|
|
12
|
+
/** Options accepted by {@link generateDocs}. */
|
|
13
|
+
export interface GenerateDocsOptions {
|
|
14
|
+
readonly format: 'html' | 'markdown';
|
|
15
|
+
/** Document title; defaults to the first service's name, then the definition's file name. */
|
|
16
|
+
readonly title?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The XML source of the element that starts on `line` (1-based) of `text`, capped at
|
|
20
|
+
* `maxLines`. Textual rather than DOM-based on purpose: the point is to show the author's own
|
|
21
|
+
* markup, comments and formatting, not a re-serialisation of it. An attribute value containing
|
|
22
|
+
* a literal `>` would end the snippet early — vanishingly rare in a schema, and worth the
|
|
23
|
+
* simplicity of not carrying a second parser here.
|
|
24
|
+
*
|
|
25
|
+
* @param text the whole document the declaration lives in
|
|
26
|
+
* @param line the 1-based line the declaration's start tag opens on
|
|
27
|
+
* @param maxLines how many lines to keep before cutting the snippet with an ellipsis
|
|
28
|
+
* @returns the declaration's source, dedented, or `''` when `line` is out of range
|
|
29
|
+
*
|
|
30
|
+
* Deliberately duplicated, not shared, with `apps/desktop/src/renderer/features/interface-editor/source-snippet.ts`
|
|
31
|
+
* (used by the Schema tab): that one must stay dependency-free JS the sandboxed renderer can run without pulling
|
|
32
|
+
* in `@wirebench/engine`'s main entry, which drags in Node built-ins (`node:crypto`, `node:fs`, …) the renderer
|
|
33
|
+
* cannot load. Keep the two in sync using `packages/engine/test/helpers/source-snippet-cases.ts`, a fixture both
|
|
34
|
+
* test suites run against.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sourceSnippet(text: string, line: number, maxLines?: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* Renders `result` as a complete, self-contained document — a single HTML page
|
|
39
|
+
* or a single Markdown file — covering the definition's services and ports,
|
|
40
|
+
* bindings, operations (with their messages and SOAP headers), messages and
|
|
41
|
+
* global schema components with the XML that declares them.
|
|
42
|
+
*
|
|
43
|
+
* @param result the imported definition to document
|
|
44
|
+
* @param options output format and an optional title
|
|
45
|
+
* @returns the whole document as a string; the caller decides where it lands
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateDocs(result: ImportResult, options: GenerateDocsOptions): string;
|