@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,691 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The schema-driven form model behind the request editor's Form view.
|
|
3
|
+
*
|
|
4
|
+
* {@link buildForm} projects one element declaration — optionally overlaid with
|
|
5
|
+
* the XML that currently stands for it — onto a tree of {@link FormNode}s the
|
|
6
|
+
* renderer can lay out as labelled fields, repeat groups and choice branches.
|
|
7
|
+
* {@link applyForm} serialises such a tree back to an XML fragment, so a
|
|
8
|
+
* structural change (add a repetition, select a choice branch, materialise an
|
|
9
|
+
* omitted optional element) is "rebuild the tree, mutate it, re-render it".
|
|
10
|
+
*
|
|
11
|
+
* Two invariants make that safe to run against a user's hand-edited envelope:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Nothing in the source is dropped.** Source children a particle never
|
|
14
|
+
* claims become `any` nodes carrying the verbatim text; source attributes
|
|
15
|
+
* with no schema counterpart (including `xmlns:*` and `xsi:type`) are kept
|
|
16
|
+
* as `extraAttributes` and re-emitted first.
|
|
17
|
+
* 2. **Recursion is only cut where the source is silent.** A recursive type is
|
|
18
|
+
* expanded past `maxDepth` whenever the XML actually goes that deep.
|
|
19
|
+
*
|
|
20
|
+
* Everything here is pure, synchronous and JSON-serialisable: the tree crosses
|
|
21
|
+
* the IPC boundary to the renderer as-is.
|
|
22
|
+
*/
|
|
23
|
+
import { qnameToString } from '../wsdl/qname.js';
|
|
24
|
+
import { NS } from '../xml/namespaces.js';
|
|
25
|
+
import { firstConcreteDerived, resolveType } from './sample-types.js';
|
|
26
|
+
import { builtinBaseOf, facetsOf, sampleValueFor } from './sample-values.js';
|
|
27
|
+
import { scanXml } from './xml-scan.js';
|
|
28
|
+
import { PrefixTable, comment, element as xmlElement, escapeAttribute, escapeText } from './xml-writer.js';
|
|
29
|
+
const ONCE = { min: 1, max: 1 };
|
|
30
|
+
const INTEGER_LOCALS = new Set([
|
|
31
|
+
'integer',
|
|
32
|
+
'nonPositiveInteger',
|
|
33
|
+
'negativeInteger',
|
|
34
|
+
'long',
|
|
35
|
+
'int',
|
|
36
|
+
'short',
|
|
37
|
+
'byte',
|
|
38
|
+
'nonNegativeInteger',
|
|
39
|
+
'unsignedLong',
|
|
40
|
+
'unsignedInt',
|
|
41
|
+
'unsignedShort',
|
|
42
|
+
'unsignedByte',
|
|
43
|
+
'positiveInteger',
|
|
44
|
+
]);
|
|
45
|
+
const NUMBER_LOCALS = new Set(['decimal', 'float', 'double']);
|
|
46
|
+
const BINARY_LOCALS = new Set(['base64Binary', 'hexBinary']);
|
|
47
|
+
function baseFor(set, ref) {
|
|
48
|
+
const builtin = builtinBaseOf(set, ref);
|
|
49
|
+
if (builtin === undefined || builtin.name.namespaceUri !== NS.XSD) {
|
|
50
|
+
return 'other';
|
|
51
|
+
}
|
|
52
|
+
const local = builtin.name.localName;
|
|
53
|
+
if (INTEGER_LOCALS.has(local))
|
|
54
|
+
return 'integer';
|
|
55
|
+
if (NUMBER_LOCALS.has(local))
|
|
56
|
+
return 'number';
|
|
57
|
+
if (BINARY_LOCALS.has(local))
|
|
58
|
+
return 'binary';
|
|
59
|
+
if (local === 'boolean')
|
|
60
|
+
return 'boolean';
|
|
61
|
+
if (local === 'date' || local === 'time' || local === 'dateTime')
|
|
62
|
+
return local;
|
|
63
|
+
return 'string';
|
|
64
|
+
}
|
|
65
|
+
/** Renders a type reference the way the Outline's Type column does: Clark, or `xs:int` for built-ins. */
|
|
66
|
+
function typeNameOf(set, ref) {
|
|
67
|
+
if (ref === undefined) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
if ('kind' in ref) {
|
|
71
|
+
return ref.name !== undefined ? qnameToString(ref.name) : '';
|
|
72
|
+
}
|
|
73
|
+
return set.builtin(ref) !== undefined ? `xs:${ref.localName}` : qnameToString(ref);
|
|
74
|
+
}
|
|
75
|
+
function formTypeOf(set, ref) {
|
|
76
|
+
const facets = facetsOf(set, ref);
|
|
77
|
+
return {
|
|
78
|
+
name: typeNameOf(set, ref),
|
|
79
|
+
base: baseFor(set, ref),
|
|
80
|
+
...(facets.enum !== undefined ? { enum: facets.enum } : {}),
|
|
81
|
+
...(facets.pattern !== undefined ? { pattern: facets.pattern } : {}),
|
|
82
|
+
...(facets.min !== undefined ? { min: facets.min } : {}),
|
|
83
|
+
...(facets.max !== undefined ? { max: facets.max } : {}),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Namespace prefixes in scope, plus a table that invents one when a new URI turns up. */
|
|
87
|
+
class NameScope {
|
|
88
|
+
byUri = new Map();
|
|
89
|
+
fresh;
|
|
90
|
+
/** Prefix → URI this build had to invent; declared on the form root. */
|
|
91
|
+
invented = {};
|
|
92
|
+
constructor(prefixes) {
|
|
93
|
+
for (const [uri, prefix] of Object.entries(prefixes)) {
|
|
94
|
+
this.byUri.set(uri, prefix);
|
|
95
|
+
}
|
|
96
|
+
this.fresh = new PrefixTable({});
|
|
97
|
+
}
|
|
98
|
+
/** Records the prefixes an element declares, so its subtree can reuse them. */
|
|
99
|
+
declare(declarations) {
|
|
100
|
+
for (const [prefix, uri] of Object.entries(declarations)) {
|
|
101
|
+
if (!this.byUri.has(uri)) {
|
|
102
|
+
this.byUri.set(uri, prefix);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** The lexical name to write for `name`, allocating and recording a prefix when needed. */
|
|
107
|
+
qualify(name) {
|
|
108
|
+
if (name.namespaceUri === '') {
|
|
109
|
+
return name.localName;
|
|
110
|
+
}
|
|
111
|
+
const existing = this.byUri.get(name.namespaceUri);
|
|
112
|
+
if (existing !== undefined) {
|
|
113
|
+
return existing === '' ? name.localName : `${existing}:${name.localName}`;
|
|
114
|
+
}
|
|
115
|
+
const prefix = this.fresh.prefixFor(name.namespaceUri);
|
|
116
|
+
this.byUri.set(name.namespaceUri, prefix);
|
|
117
|
+
this.invented[prefix] = name.namespaceUri;
|
|
118
|
+
return `${prefix}:${name.localName}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** Moves a fragment-relative range into the enclosing document's coordinates. */
|
|
122
|
+
function absolute(ctx, range) {
|
|
123
|
+
return ctx.offset === 0 ? range : { start: range.start + ctx.offset, end: range.end + ctx.offset };
|
|
124
|
+
}
|
|
125
|
+
/** The unconsumed source children of one element, claimed by name as particles are walked. */
|
|
126
|
+
class Pool {
|
|
127
|
+
children;
|
|
128
|
+
used;
|
|
129
|
+
constructor(children) {
|
|
130
|
+
this.children = children;
|
|
131
|
+
this.used = children.map(() => false);
|
|
132
|
+
}
|
|
133
|
+
/** Claims the next unused child whose expanded name is in `names`. */
|
|
134
|
+
take(names) {
|
|
135
|
+
for (let i = 0; i < this.children.length; i += 1) {
|
|
136
|
+
const child = this.children[i];
|
|
137
|
+
if (this.used[i] === true) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (names.some((n) => n.localName === child.localName && n.namespaceUri === child.namespaceUri)) {
|
|
141
|
+
this.used[i] = true;
|
|
142
|
+
return child;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
/** True when any unused child matches one of `names` — used to size a repeating compositor. */
|
|
148
|
+
has(names) {
|
|
149
|
+
return this.children.some((child, i) => this.used[i] !== true &&
|
|
150
|
+
names.some((n) => n.localName === child.localName && n.namespaceUri === child.namespaceUri));
|
|
151
|
+
}
|
|
152
|
+
/** Every child no particle claimed, in source order. */
|
|
153
|
+
leftovers() {
|
|
154
|
+
return this.children.filter((_, i) => this.used[i] !== true);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function targetOf(ctx, particle) {
|
|
158
|
+
if (particle.kind === 'localElement') {
|
|
159
|
+
return { decl: particle.decl, names: [particle.decl.name] };
|
|
160
|
+
}
|
|
161
|
+
if (particle.kind !== 'elementRef') {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const decl = ctx.set.lookupElement(particle.ref);
|
|
165
|
+
if (decl === undefined) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const substitutions = ctx.set.substitutionsFor(particle.ref);
|
|
169
|
+
return { decl, names: [decl.name, ...substitutions.map((s) => s.name)] };
|
|
170
|
+
}
|
|
171
|
+
/** The concrete declaration to build: an abstract head is replaced by a substitution member. */
|
|
172
|
+
function effectiveDecl(ctx, decl, source) {
|
|
173
|
+
if (source !== undefined) {
|
|
174
|
+
const match = ctx.set
|
|
175
|
+
.substitutionsFor(decl.name)
|
|
176
|
+
.find((c) => c.name.localName === source.localName && c.name.namespaceUri === source.namespaceUri);
|
|
177
|
+
if (match !== undefined) {
|
|
178
|
+
return match;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (!decl.abstract) {
|
|
182
|
+
return decl;
|
|
183
|
+
}
|
|
184
|
+
return ctx.set.substitutionsFor(decl.name).find((c) => !c.abstract) ?? decl;
|
|
185
|
+
}
|
|
186
|
+
/** Splits a source element's attributes into the schema ones (by lexical name) and the rest. */
|
|
187
|
+
function splitAttributes(ctx, source, declared) {
|
|
188
|
+
const matched = new Map();
|
|
189
|
+
const extras = [];
|
|
190
|
+
if (source === undefined) {
|
|
191
|
+
return { matched, extras };
|
|
192
|
+
}
|
|
193
|
+
for (const attr of source.attributes) {
|
|
194
|
+
const local = attr.name.includes(':') ? attr.name.slice(attr.name.indexOf(':') + 1) : attr.name;
|
|
195
|
+
// SOAP-encoding bookkeeping (`soapenc:arrayType`) is never an editable form
|
|
196
|
+
// field, so it stays an extra and is re-emitted exactly as written.
|
|
197
|
+
const decl = declared.find((d) => d.name.localName === local && d.name.namespaceUri !== NS.SOAP11_ENC);
|
|
198
|
+
if (decl !== undefined && !attr.name.startsWith('xmlns')) {
|
|
199
|
+
matched.set(qnameToString(decl.name), attr);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
extras.push({ name: attr.name, value: attr.value });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { matched, extras };
|
|
206
|
+
}
|
|
207
|
+
function attributeNode(ctx, attribute, source, id) {
|
|
208
|
+
const ref = attribute.type ?? attribute.anonymousType;
|
|
209
|
+
const forced = attribute.fixed ?? attribute.default;
|
|
210
|
+
return {
|
|
211
|
+
id,
|
|
212
|
+
kind: 'attribute',
|
|
213
|
+
name: attribute.name,
|
|
214
|
+
label: source?.name ?? ctx.scope.qualify(attribute.name),
|
|
215
|
+
required: attribute.use === 'required',
|
|
216
|
+
occurs: attribute.use === 'required' ? ONCE : { min: 0, max: 1 },
|
|
217
|
+
type: formTypeOf(ctx.set, ref),
|
|
218
|
+
value: source?.value ?? forced ?? sampleValueFor(ctx.set, ref, { sampleValues: ctx.sampleValues }),
|
|
219
|
+
...(source !== undefined ? { valueRange: absolute(ctx, source.valueRange) } : {}),
|
|
220
|
+
present: source !== undefined || (!ctx.hasDocument && attribute.use === 'required'),
|
|
221
|
+
...(attribute.fixed !== undefined ? { fixed: attribute.fixed } : {}),
|
|
222
|
+
children: [],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** Wraps a source element that no schema particle describes, keeping its text verbatim. */
|
|
226
|
+
function rawNode(ctx, source, id) {
|
|
227
|
+
return {
|
|
228
|
+
id,
|
|
229
|
+
kind: 'any',
|
|
230
|
+
name: { namespaceUri: source.namespaceUri, localName: source.localName },
|
|
231
|
+
label: source.name,
|
|
232
|
+
required: false,
|
|
233
|
+
occurs: { min: 0, max: 'unbounded' },
|
|
234
|
+
present: true,
|
|
235
|
+
raw: ctx.source.slice(source.range.start, source.range.end),
|
|
236
|
+
...(source.leadingComments.length > 0 ? { comments: source.leadingComments } : {}),
|
|
237
|
+
children: [],
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/** Builds one element node: its attributes, then either simple content or its child particles. */
|
|
241
|
+
function buildElementNode(ctx, decl, occurs, source, id, depth) {
|
|
242
|
+
const effective = effectiveDecl(ctx, decl, source);
|
|
243
|
+
if (source !== undefined) {
|
|
244
|
+
ctx.scope.declare(source.declaredNamespaces);
|
|
245
|
+
}
|
|
246
|
+
const label = source?.name ?? ctx.scope.qualify(effective.name);
|
|
247
|
+
const resolved = resolveType(ctx.set, effective.type ?? effective.anonymousType);
|
|
248
|
+
const common = {
|
|
249
|
+
id,
|
|
250
|
+
name: effective.name,
|
|
251
|
+
label,
|
|
252
|
+
required: occurs.min > 0,
|
|
253
|
+
occurs,
|
|
254
|
+
present: source !== undefined || (!ctx.hasDocument && occurs.min > 0),
|
|
255
|
+
...(effective.nillable ? { nillable: true } : {}),
|
|
256
|
+
...(effective.documentation !== undefined ? { documentation: effective.documentation } : {}),
|
|
257
|
+
...(source !== undefined && source.leadingComments.length > 0 ? { comments: source.leadingComments } : {}),
|
|
258
|
+
...(source !== undefined && source.trailingComments.length > 0
|
|
259
|
+
? { trailingComments: source.trailingComments }
|
|
260
|
+
: {}),
|
|
261
|
+
};
|
|
262
|
+
const forced = effective.fixed ?? effective.default;
|
|
263
|
+
if (resolved.kind !== 'complex') {
|
|
264
|
+
const ref = resolved.kind === 'simple' ? resolved.ref : undefined;
|
|
265
|
+
// A simple-typed element declares no attributes of its own, so everything
|
|
266
|
+
// the source wrote on it (`xmlns:*`, `xsi:nil`, …) is kept verbatim.
|
|
267
|
+
const extras = (source?.attributes ?? []).map((a) => ({ name: a.name, value: a.value }));
|
|
268
|
+
return {
|
|
269
|
+
...common,
|
|
270
|
+
...(extras.length > 0 ? { extraAttributes: extras } : {}),
|
|
271
|
+
kind: 'field',
|
|
272
|
+
type: formTypeOf(ctx.set, ref),
|
|
273
|
+
value: source?.text?.value ?? forced ?? sampleValueFor(ctx.set, ref, { sampleValues: ctx.sampleValues }),
|
|
274
|
+
...(source?.text !== undefined && !source.selfClosing ? { valueRange: absolute(ctx, source.text.range) } : {}),
|
|
275
|
+
...(effective.fixed !== undefined ? { fixed: effective.fixed } : {}),
|
|
276
|
+
children: [],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return buildComplexNode(ctx, common, resolved.type, source, depth, forced);
|
|
280
|
+
}
|
|
281
|
+
function buildComplexNode(ctx, common, complexType, source, depth, forced) {
|
|
282
|
+
let effective = complexType;
|
|
283
|
+
const invented = [];
|
|
284
|
+
if (complexType.abstract) {
|
|
285
|
+
const concrete = firstConcreteDerived(ctx.set, complexType);
|
|
286
|
+
if (concrete?.name !== undefined) {
|
|
287
|
+
effective = concrete;
|
|
288
|
+
if (source === undefined) {
|
|
289
|
+
ctx.scope.declare({ xsi: NS.XSI });
|
|
290
|
+
invented.push({ name: 'xsi:type', value: ctx.scope.qualify(concrete.name) });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const content = ctx.set.resolveContent(effective);
|
|
295
|
+
const { matched, extras } = splitAttributes(ctx, source, content.attributes);
|
|
296
|
+
const attributeNodes = content.attributes
|
|
297
|
+
.filter((a) => a.name.namespaceUri !== NS.SOAP11_ENC)
|
|
298
|
+
.map((a, index) => attributeNode(ctx, a, matched.get(qnameToString(a.name)), `${common.id}/@${index}`))
|
|
299
|
+
.filter((node) => node.present || node.required || source === undefined);
|
|
300
|
+
const allExtras = [...extras, ...invented];
|
|
301
|
+
const xsiType = allExtras.find((a) => a.name.endsWith(':type'))?.value;
|
|
302
|
+
const base = {
|
|
303
|
+
...common,
|
|
304
|
+
...(allExtras.length > 0 ? { extraAttributes: allExtras } : {}),
|
|
305
|
+
...(xsiType !== undefined ? { xsiType } : {}),
|
|
306
|
+
};
|
|
307
|
+
if (content.simpleContentBase !== undefined) {
|
|
308
|
+
const ref = content.simpleContentBase;
|
|
309
|
+
return {
|
|
310
|
+
...base,
|
|
311
|
+
kind: 'field',
|
|
312
|
+
type: formTypeOf(ctx.set, ref),
|
|
313
|
+
value: source?.text?.value ?? forced ?? sampleValueFor(ctx.set, ref, { sampleValues: ctx.sampleValues }),
|
|
314
|
+
...(source?.text !== undefined && !source.selfClosing ? { valueRange: absolute(ctx, source.text.range) } : {}),
|
|
315
|
+
children: attributeNodes,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
// Only a *silent* source may be cut off: expanding what the document already
|
|
319
|
+
// says can never diverge, while expanding what it does not say can recurse
|
|
320
|
+
// forever (see the `Node`/`child` fixture).
|
|
321
|
+
if (source === undefined && depth > ctx.maxDepth) {
|
|
322
|
+
return { ...base, kind: 'group', truncated: true, children: attributeNodes };
|
|
323
|
+
}
|
|
324
|
+
const pool = new Pool(source?.children ?? []);
|
|
325
|
+
const children = [...attributeNodes];
|
|
326
|
+
if (content.particle !== undefined) {
|
|
327
|
+
buildParticle(ctx, content.particle, pool, base.id, children, depth + 1, source !== undefined);
|
|
328
|
+
}
|
|
329
|
+
for (const [index, leftover] of pool.leftovers().entries()) {
|
|
330
|
+
children.push(rawNode(ctx, leftover, `${base.id}/~${index}`));
|
|
331
|
+
}
|
|
332
|
+
return { ...base, kind: 'group', children };
|
|
333
|
+
}
|
|
334
|
+
/** True when a particle may appear more than once. */
|
|
335
|
+
function repeatable(occurs) {
|
|
336
|
+
return occurs.max === 'unbounded' || occurs.max > 1;
|
|
337
|
+
}
|
|
338
|
+
/** Every element name a particle subtree can contribute, used to size a repeating compositor. */
|
|
339
|
+
function namesUnder(ctx, particle, out) {
|
|
340
|
+
const target = targetOf(ctx, particle);
|
|
341
|
+
if (target !== undefined) {
|
|
342
|
+
out.push(...target.names);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (particle.kind === 'sequence' || particle.kind === 'choice' || particle.kind === 'all') {
|
|
346
|
+
for (const child of particle.particles) {
|
|
347
|
+
namesUnder(ctx, child, out);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function buildRepeat(particle, id, hasSource, makeInstance, makeTemplate) {
|
|
352
|
+
const template = makeTemplate(`${id}#t`);
|
|
353
|
+
const instances = [];
|
|
354
|
+
const limit = particle.occurs.max === 'unbounded' ? Number.POSITIVE_INFINITY : particle.occurs.max;
|
|
355
|
+
while (instances.length < limit) {
|
|
356
|
+
const next = makeInstance(`${id}#${instances.length}`);
|
|
357
|
+
if (next === undefined) {
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
instances.push(next);
|
|
361
|
+
}
|
|
362
|
+
// With no document to read, a required repetition still needs one editable
|
|
363
|
+
// occurrence on screen — the sample generator emits one too.
|
|
364
|
+
if (!hasSource && instances.length === 0 && particle.occurs.min > 0) {
|
|
365
|
+
instances.push(reidTemplate(template, `${id}#0`, true));
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
id,
|
|
369
|
+
kind: 'repeat',
|
|
370
|
+
name: template.name,
|
|
371
|
+
label: template.label,
|
|
372
|
+
required: particle.occurs.min > 0,
|
|
373
|
+
occurs: particle.occurs,
|
|
374
|
+
present: instances.length > 0,
|
|
375
|
+
children: [],
|
|
376
|
+
repeat: {
|
|
377
|
+
instances,
|
|
378
|
+
template,
|
|
379
|
+
canAdd: instances.length < limit,
|
|
380
|
+
canRemove: instances.length > particle.occurs.min,
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
/** Copies a template subtree under a new id, optionally marking the copy present. */
|
|
385
|
+
function reidTemplate(node, id, present) {
|
|
386
|
+
return {
|
|
387
|
+
...node,
|
|
388
|
+
id,
|
|
389
|
+
...(present ? { present: true } : {}),
|
|
390
|
+
children: node.children.map((child, i) => reidTemplate(child, `${id}/${i}`, present && child.required)),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** Emits the nodes one particle contributes to `out`, claiming source children as it goes. */
|
|
394
|
+
function buildParticle(ctx, particle, pool, parentId, out, depth, hasSource) {
|
|
395
|
+
const id = `${parentId}/${out.length}`;
|
|
396
|
+
const target = targetOf(ctx, particle);
|
|
397
|
+
if (target !== undefined) {
|
|
398
|
+
if (!repeatable(particle.occurs)) {
|
|
399
|
+
const source = pool.take(target.names);
|
|
400
|
+
// A not-present optional element is still modelled, so the Full view can
|
|
401
|
+
// offer to add it; the renderer ghosts it until then.
|
|
402
|
+
out.push(buildElementNode(ctx, target.decl, particle.occurs, source, id, depth));
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
out.push(buildRepeat(particle, id, hasSource, (instanceId) => {
|
|
406
|
+
const source = pool.take(target.names);
|
|
407
|
+
return source === undefined ? undefined : buildElementNode(ctx, target.decl, ONCE, source, instanceId, depth);
|
|
408
|
+
}, (templateId) => buildElementNode(ctx, target.decl, ONCE, undefined, templateId, depth)));
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (particle.kind === 'any') {
|
|
412
|
+
out.push({
|
|
413
|
+
id,
|
|
414
|
+
kind: 'any',
|
|
415
|
+
name: { namespaceUri: '', localName: 'any' },
|
|
416
|
+
label: 'any',
|
|
417
|
+
required: particle.occurs.min > 0,
|
|
418
|
+
occurs: particle.occurs,
|
|
419
|
+
present: false,
|
|
420
|
+
children: [],
|
|
421
|
+
});
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (particle.kind === 'groupRef') {
|
|
425
|
+
// `resolveContent` expands group references; a stray one is skipped rather than guessed at.
|
|
426
|
+
ctx.problems.push(`Unexpanded group reference ${qnameToString(particle.ref)}`);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (particle.kind === 'choice') {
|
|
430
|
+
out.push(buildChoice(ctx, particle, pool, id, depth, hasSource));
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (particle.kind !== 'sequence' && particle.kind !== 'all') {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
// sequence / all
|
|
437
|
+
if (!repeatable(particle.occurs)) {
|
|
438
|
+
for (const child of particle.particles) {
|
|
439
|
+
buildParticle(ctx, child, pool, parentId, out, depth, hasSource);
|
|
440
|
+
}
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const names = [];
|
|
444
|
+
namesUnder(ctx, particle, names);
|
|
445
|
+
out.push(buildRepeat(particle, id, hasSource, (instanceId) => {
|
|
446
|
+
if (!pool.has(names)) {
|
|
447
|
+
return undefined;
|
|
448
|
+
}
|
|
449
|
+
const inner = [];
|
|
450
|
+
for (const child of particle.particles) {
|
|
451
|
+
buildParticle(ctx, child, pool, instanceId, inner, depth, hasSource);
|
|
452
|
+
}
|
|
453
|
+
return groupWrapper(instanceId, particle.kind, inner, true);
|
|
454
|
+
}, (templateId) => {
|
|
455
|
+
const inner = [];
|
|
456
|
+
const emptyPool = new Pool([]);
|
|
457
|
+
for (const child of particle.particles) {
|
|
458
|
+
buildParticle(ctx, child, emptyPool, templateId, inner, depth, false);
|
|
459
|
+
}
|
|
460
|
+
return groupWrapper(templateId, particle.kind, inner, false);
|
|
461
|
+
}));
|
|
462
|
+
}
|
|
463
|
+
/** A synthetic, nameless group standing for one occurrence of a repeating compositor. */
|
|
464
|
+
function groupWrapper(id, kind, children, present) {
|
|
465
|
+
return {
|
|
466
|
+
id,
|
|
467
|
+
kind: 'group',
|
|
468
|
+
name: { namespaceUri: '', localName: kind },
|
|
469
|
+
label: '',
|
|
470
|
+
required: false,
|
|
471
|
+
occurs: ONCE,
|
|
472
|
+
present,
|
|
473
|
+
children,
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function buildChoice(ctx, particle, pool, id, depth, hasSource) {
|
|
477
|
+
const branches = [];
|
|
478
|
+
for (const [index, alternative] of particle.particles.entries()) {
|
|
479
|
+
const collected = [];
|
|
480
|
+
buildParticle(ctx, alternative, pool, `${id}!${index}`, collected, depth, hasSource);
|
|
481
|
+
const only = collected.length === 1 ? collected[0] : undefined;
|
|
482
|
+
branches.push(only ?? groupWrapper(`${id}!${index}`, 'branch', collected, collected.some(isPresent)));
|
|
483
|
+
}
|
|
484
|
+
const selected = branches.findIndex(isPresent);
|
|
485
|
+
return {
|
|
486
|
+
id,
|
|
487
|
+
kind: 'choice',
|
|
488
|
+
name: { namespaceUri: '', localName: 'choice' },
|
|
489
|
+
label: 'choice',
|
|
490
|
+
required: particle.occurs.min > 0,
|
|
491
|
+
occurs: particle.occurs,
|
|
492
|
+
present: selected !== -1,
|
|
493
|
+
children: branches,
|
|
494
|
+
choice: selected === -1 ? {} : { selected },
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
/** True when a node, or anything under it, exists in the document. */
|
|
498
|
+
function isPresent(node) {
|
|
499
|
+
if (node.kind === 'attribute') {
|
|
500
|
+
return node.valueRange !== undefined;
|
|
501
|
+
}
|
|
502
|
+
if (node.present) {
|
|
503
|
+
return true;
|
|
504
|
+
}
|
|
505
|
+
return [...node.children, ...(node.repeat?.instances ?? [])].some(isPresent);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Builds the form tree for one global element declaration.
|
|
509
|
+
*
|
|
510
|
+
* @param schemaSet the compiled schemas the element is declared in
|
|
511
|
+
* @param element the global element to model
|
|
512
|
+
* @param xml the fragment that currently stands for it, or `undefined` for a fresh form
|
|
513
|
+
* @param options depth cut-off, sample values, and prefixes already in scope
|
|
514
|
+
* @returns the root node; never throws — an unknown element yields an `any` node instead
|
|
515
|
+
*/
|
|
516
|
+
export function buildForm(schemaSet, element, xml, options) {
|
|
517
|
+
const scanned = xml !== undefined ? scanXml(xml, options?.inScope ?? {}) : undefined;
|
|
518
|
+
const source = scanned?.elements[0];
|
|
519
|
+
const ctx = {
|
|
520
|
+
set: schemaSet,
|
|
521
|
+
maxDepth: options?.maxDepth ?? 5,
|
|
522
|
+
sampleValues: options?.sampleValues ?? false,
|
|
523
|
+
scope: new NameScope(options?.prefixes ?? {}),
|
|
524
|
+
problems: [...(scanned?.problems ?? [])],
|
|
525
|
+
source: xml ?? '',
|
|
526
|
+
hasDocument: xml !== undefined,
|
|
527
|
+
offset: options?.offset ?? 0,
|
|
528
|
+
};
|
|
529
|
+
const decl = schemaSet.lookupElement(element);
|
|
530
|
+
if (decl === undefined) {
|
|
531
|
+
return source !== undefined
|
|
532
|
+
? rawNode(ctx, source, 'r')
|
|
533
|
+
: {
|
|
534
|
+
id: 'r',
|
|
535
|
+
kind: 'any',
|
|
536
|
+
name: element,
|
|
537
|
+
label: ctx.scope.qualify(element),
|
|
538
|
+
required: true,
|
|
539
|
+
occurs: ONCE,
|
|
540
|
+
present: false,
|
|
541
|
+
children: [],
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
const root = buildElementNode(ctx, decl, ONCE, source, 'r', 0);
|
|
545
|
+
const invented = ctx.scope.invented;
|
|
546
|
+
return Object.keys(invented).length > 0 ? { ...root, namespaces: invented } : root;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Builds the form tree for an element whose content is described by a *type*
|
|
550
|
+
* rather than a global element declaration — the shape an rpc-style message
|
|
551
|
+
* part takes.
|
|
552
|
+
*/
|
|
553
|
+
export function buildFormForType(schemaSet, elementName, type, xml, options) {
|
|
554
|
+
const decl = {
|
|
555
|
+
kind: 'element',
|
|
556
|
+
name: elementName,
|
|
557
|
+
type,
|
|
558
|
+
nillable: false,
|
|
559
|
+
abstract: false,
|
|
560
|
+
source: { location: '<synthetic>' },
|
|
561
|
+
};
|
|
562
|
+
const scanned = xml !== undefined ? scanXml(xml, options?.inScope ?? {}) : undefined;
|
|
563
|
+
const ctx = {
|
|
564
|
+
set: schemaSet,
|
|
565
|
+
maxDepth: options?.maxDepth ?? 5,
|
|
566
|
+
sampleValues: options?.sampleValues ?? false,
|
|
567
|
+
scope: new NameScope(options?.prefixes ?? {}),
|
|
568
|
+
problems: [...(scanned?.problems ?? [])],
|
|
569
|
+
source: xml ?? '',
|
|
570
|
+
hasDocument: xml !== undefined,
|
|
571
|
+
offset: options?.offset ?? 0,
|
|
572
|
+
};
|
|
573
|
+
const root = buildElementNode(ctx, decl, ONCE, scanned?.elements[0], 'r', 0);
|
|
574
|
+
const invented = ctx.scope.invented;
|
|
575
|
+
return Object.keys(invented).length > 0 ? { ...root, namespaces: invented } : root;
|
|
576
|
+
}
|
|
577
|
+
function attributesOf(node) {
|
|
578
|
+
const out = Object.entries(node.namespaces ?? {}).map(([prefix, uri]) => ({
|
|
579
|
+
name: `xmlns:${prefix}`,
|
|
580
|
+
value: uri,
|
|
581
|
+
}));
|
|
582
|
+
for (const extra of node.extraAttributes ?? []) {
|
|
583
|
+
out.push({ name: extra.name, value: extra.value });
|
|
584
|
+
}
|
|
585
|
+
for (const child of node.children) {
|
|
586
|
+
if (child.kind === 'attribute' && child.present) {
|
|
587
|
+
out.push({ name: child.label, value: child.value ?? '' });
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return out;
|
|
591
|
+
}
|
|
592
|
+
/** Emits the XML nodes one form node contributes, leading comments included. */
|
|
593
|
+
function emit(node, out) {
|
|
594
|
+
for (const text of node.comments ?? []) {
|
|
595
|
+
out.push(comment(text));
|
|
596
|
+
}
|
|
597
|
+
switch (node.kind) {
|
|
598
|
+
case 'attribute':
|
|
599
|
+
return;
|
|
600
|
+
case 'repeat':
|
|
601
|
+
for (const instance of node.repeat?.instances ?? []) {
|
|
602
|
+
emit(instance, out);
|
|
603
|
+
}
|
|
604
|
+
return;
|
|
605
|
+
case 'choice': {
|
|
606
|
+
// A sample fragment shows every alternative and lets the user delete the
|
|
607
|
+
// ones they do not want, so emit each branch that is actually present —
|
|
608
|
+
// selecting a branch is what removes the others (see `select-choice`).
|
|
609
|
+
const live = node.children.filter(isPresent);
|
|
610
|
+
for (const branch of live.length > 0 ? live : []) {
|
|
611
|
+
emit(branch, out);
|
|
612
|
+
}
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
case 'any':
|
|
616
|
+
if (node.raw !== undefined) {
|
|
617
|
+
out.push({ kind: 'raw', text: node.raw });
|
|
618
|
+
}
|
|
619
|
+
return;
|
|
620
|
+
default:
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
if (!node.present) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
// A synthetic wrapper (a repeating compositor's occurrence, a choice branch
|
|
627
|
+
// holding several particles) has no tag of its own: splice its children out.
|
|
628
|
+
if (node.label === '') {
|
|
629
|
+
for (const child of node.children) {
|
|
630
|
+
emit(child, out);
|
|
631
|
+
}
|
|
632
|
+
for (const text of node.trailingComments ?? []) {
|
|
633
|
+
out.push(comment(text));
|
|
634
|
+
}
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const element = xmlElement(node.label);
|
|
638
|
+
element.attributes = attributesOf(node);
|
|
639
|
+
if (node.kind === 'field') {
|
|
640
|
+
element.text = node.value ?? '';
|
|
641
|
+
}
|
|
642
|
+
for (const child of node.children) {
|
|
643
|
+
emit(child, element.children);
|
|
644
|
+
}
|
|
645
|
+
for (const text of node.trailingComments ?? []) {
|
|
646
|
+
element.children.push(comment(text));
|
|
647
|
+
}
|
|
648
|
+
out.push(element);
|
|
649
|
+
}
|
|
650
|
+
/** Renders emitted nodes with a fixed indent; `raw` text is re-indented but never reformatted. */
|
|
651
|
+
function render(nodes, indent, depth, out) {
|
|
652
|
+
const pad = indent.repeat(depth);
|
|
653
|
+
for (const node of nodes) {
|
|
654
|
+
if (node.kind === 'raw') {
|
|
655
|
+
for (const line of node.text.split('\n')) {
|
|
656
|
+
out.push(`${pad}${line.trim()}`);
|
|
657
|
+
}
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
if (node.kind === 'comment') {
|
|
661
|
+
out.push(`${pad}<!--${node.text.replace(/--/g, '- -')}-->`);
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
const attrs = node.attributes.map((a) => ` ${a.name}="${escapeAttribute(a.value)}"`).join('');
|
|
665
|
+
const open = `<${node.name}${attrs}`;
|
|
666
|
+
if (node.children.length === 0 && node.text === undefined) {
|
|
667
|
+
out.push(`${pad}${open}/>`);
|
|
668
|
+
continue;
|
|
669
|
+
}
|
|
670
|
+
if (node.children.length === 0) {
|
|
671
|
+
out.push(`${pad}${open}>${escapeText(node.text ?? '')}</${node.name}>`);
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
out.push(`${pad}${open}>`);
|
|
675
|
+
render(node.children, indent, depth + 1, out);
|
|
676
|
+
out.push(`${pad}</${node.name}>`);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Serialises a form tree back to an XML fragment: the exact text that should
|
|
681
|
+
* replace the element the tree was built from. Comments captured from the
|
|
682
|
+
* source are re-emitted in place, and `any` nodes pass their source text
|
|
683
|
+
* through verbatim, so nothing the user wrote is lost.
|
|
684
|
+
*/
|
|
685
|
+
export function applyForm(form, options) {
|
|
686
|
+
const nodes = [];
|
|
687
|
+
emit(form, nodes);
|
|
688
|
+
const lines = [];
|
|
689
|
+
render(nodes, options?.indent ?? ' ', 0, lines);
|
|
690
|
+
return lines.join('\n');
|
|
691
|
+
}
|