@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,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a {@link ProtoSet} back as plain, serialisable descriptions: the services and methods an
|
|
3
|
+
* import turns into folders and requests, and the shape of a message the editor's Form view and
|
|
4
|
+
* sample generator work from. Nothing here holds a parser object, so the result crosses IPC as it is.
|
|
5
|
+
*/
|
|
6
|
+
import protobuf from 'protobufjs';
|
|
7
|
+
import type { GrpcMethodKind } from '../model.js';
|
|
8
|
+
import type { ProtoSet } from './load.js';
|
|
9
|
+
/** One method of a service, as declared. */
|
|
10
|
+
export interface GrpcMethodDescriptor {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly service: string;
|
|
13
|
+
readonly kind: GrpcMethodKind;
|
|
14
|
+
/** Fully qualified request and response message types, without a leading dot. */
|
|
15
|
+
readonly requestType: string;
|
|
16
|
+
readonly responseType: string;
|
|
17
|
+
readonly comment?: string;
|
|
18
|
+
readonly deprecated?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** One service, with its methods in declaration order. */
|
|
21
|
+
export interface GrpcServiceDescriptor {
|
|
22
|
+
/** The short name, e.g. `Greeter`. */
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/** The fully qualified name, e.g. `helloworld.Greeter`. */
|
|
25
|
+
readonly fullName: string;
|
|
26
|
+
/** The enclosing package, empty when the file declares none. */
|
|
27
|
+
readonly package: string;
|
|
28
|
+
readonly comment?: string;
|
|
29
|
+
readonly methods: readonly GrpcMethodDescriptor[];
|
|
30
|
+
}
|
|
31
|
+
/** What kind of value a field holds. */
|
|
32
|
+
export type FieldValueKind = 'scalar' | 'enum' | 'message' | 'map';
|
|
33
|
+
/** One field of a message. */
|
|
34
|
+
export interface MessageFieldDescriptor {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly id: number;
|
|
37
|
+
/** The declared type: a scalar name, or a fully qualified message or enum name. */
|
|
38
|
+
readonly type: string;
|
|
39
|
+
readonly valueKind: FieldValueKind;
|
|
40
|
+
readonly repeated: boolean;
|
|
41
|
+
/** Declared with the `optional` keyword (proto3 explicit presence, or any proto2 optional field). */
|
|
42
|
+
readonly optional: boolean;
|
|
43
|
+
/** The `oneof` this field belongs to, when it does. */
|
|
44
|
+
readonly oneof?: string;
|
|
45
|
+
/** For a map field: the key's scalar type. */
|
|
46
|
+
readonly mapKeyType?: string;
|
|
47
|
+
/** For an enum field: the value names, in declaration order. */
|
|
48
|
+
readonly enumValues?: readonly string[];
|
|
49
|
+
readonly comment?: string;
|
|
50
|
+
}
|
|
51
|
+
/** A message type, flattened for a reader that does not hold the parser's objects. */
|
|
52
|
+
export interface MessageDescriptor {
|
|
53
|
+
readonly fullName: string;
|
|
54
|
+
readonly fields: readonly MessageFieldDescriptor[];
|
|
55
|
+
readonly oneofs: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
/** A reflection object's fully qualified name without the leading dot protobufjs adds. */
|
|
58
|
+
export declare function qualifiedName(object: protobuf.ReflectionObject): string;
|
|
59
|
+
/** Every service in the set, in file and declaration order. */
|
|
60
|
+
export declare function describeServices(set: ProtoSet): GrpcServiceDescriptor[];
|
|
61
|
+
/**
|
|
62
|
+
* The message type `fullName` names.
|
|
63
|
+
*
|
|
64
|
+
* @throws ProtoError `proto-type-unknown` when the set has no such message
|
|
65
|
+
*/
|
|
66
|
+
export declare function lookupMessageType(set: ProtoSet, fullName: string): protobuf.Type;
|
|
67
|
+
/**
|
|
68
|
+
* The method `service`/`method` names, resolved.
|
|
69
|
+
*
|
|
70
|
+
* @throws ProtoError `proto-method-unknown` when the set has no such service or method
|
|
71
|
+
*/
|
|
72
|
+
export declare function lookupMethod(set: ProtoSet, service: string, method: string): protobuf.Method;
|
|
73
|
+
/** The request and response message types of one method, plus its streaming shape. */
|
|
74
|
+
export declare function describeMethod(set: ProtoSet, service: string, method: string): GrpcMethodDescriptor;
|
|
75
|
+
/** The fields of the message type `fullName`, in field-number order. */
|
|
76
|
+
export declare function describeMessage(set: ProtoSet, fullName: string): MessageDescriptor;
|
|
77
|
+
/**
|
|
78
|
+
* The message whose fields belong at `path` — a chain of JSON object keys — under `rootType`.
|
|
79
|
+
*
|
|
80
|
+
* `path` is what {@link jsonCompletionContextAt} reports, so it carries no array indices: a
|
|
81
|
+
* repeated field is descended through as if it were singular. A map field is followed by the
|
|
82
|
+
* user's own key, which is consumed here, since only the schema knows that a level of the
|
|
83
|
+
* document is a map rather than a nested message.
|
|
84
|
+
*
|
|
85
|
+
* Returns `undefined` when the path names a field the message does not have, stops on a scalar or
|
|
86
|
+
* an enum, or ends on a map whose entries the user names — and for a well-known type, whose JSON
|
|
87
|
+
* is its own mapping (a `Timestamp` is a string, a wrapper is a bare value) rather than its
|
|
88
|
+
* fields, so offering those fields would be offering a document protobuf will not read back.
|
|
89
|
+
*
|
|
90
|
+
* @throws ProtoError `proto-type-unknown` when the set has no `rootType`
|
|
91
|
+
*/
|
|
92
|
+
export declare function describeMessageAt(set: ProtoSet, rootType: string, path: readonly string[]): MessageDescriptor | undefined;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a {@link ProtoSet} back as plain, serialisable descriptions: the services and methods an
|
|
3
|
+
* import turns into folders and requests, and the shape of a message the editor's Form view and
|
|
4
|
+
* sample generator work from. Nothing here holds a parser object, so the result crosses IPC as it is.
|
|
5
|
+
*/
|
|
6
|
+
import protobuf from 'protobufjs';
|
|
7
|
+
import { ProtoError } from '../../errors.js';
|
|
8
|
+
import { WELL_KNOWN_TYPES } from './well-known.js';
|
|
9
|
+
function methodKindOf(method) {
|
|
10
|
+
if (method.requestStream === true && method.responseStream === true) {
|
|
11
|
+
return 'bidi-streaming';
|
|
12
|
+
}
|
|
13
|
+
if (method.requestStream === true) {
|
|
14
|
+
return 'client-streaming';
|
|
15
|
+
}
|
|
16
|
+
if (method.responseStream === true) {
|
|
17
|
+
return 'server-streaming';
|
|
18
|
+
}
|
|
19
|
+
return 'unary';
|
|
20
|
+
}
|
|
21
|
+
/** A reflection object's fully qualified name without the leading dot protobufjs adds. */
|
|
22
|
+
export function qualifiedName(object) {
|
|
23
|
+
return object.fullName.replace(/^\./, '');
|
|
24
|
+
}
|
|
25
|
+
function commentOf(object) {
|
|
26
|
+
const text = object.comment?.trim();
|
|
27
|
+
return text !== undefined && text.length > 0 ? { comment: text } : {};
|
|
28
|
+
}
|
|
29
|
+
function walkServices(namespace, out) {
|
|
30
|
+
for (const nested of namespace.nestedArray) {
|
|
31
|
+
if (nested instanceof protobuf.Service) {
|
|
32
|
+
out.push(nested);
|
|
33
|
+
}
|
|
34
|
+
else if (nested instanceof protobuf.Namespace) {
|
|
35
|
+
walkServices(nested, out);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Every service in the set, in file and declaration order. */
|
|
40
|
+
export function describeServices(set) {
|
|
41
|
+
const services = [];
|
|
42
|
+
walkServices(set.root, services);
|
|
43
|
+
return services.map((service) => {
|
|
44
|
+
const fullName = qualifiedName(service);
|
|
45
|
+
const packageName = fullName.slice(0, Math.max(0, fullName.length - service.name.length - 1));
|
|
46
|
+
return {
|
|
47
|
+
name: service.name,
|
|
48
|
+
fullName,
|
|
49
|
+
package: packageName,
|
|
50
|
+
...commentOf(service),
|
|
51
|
+
methods: service.methodsArray.map((method) => {
|
|
52
|
+
method.resolve();
|
|
53
|
+
return {
|
|
54
|
+
name: method.name,
|
|
55
|
+
service: fullName,
|
|
56
|
+
kind: methodKindOf(method),
|
|
57
|
+
requestType: method.resolvedRequestType !== null ? qualifiedName(method.resolvedRequestType) : method.requestType,
|
|
58
|
+
responseType: method.resolvedResponseType !== null ? qualifiedName(method.resolvedResponseType) : method.responseType,
|
|
59
|
+
...commentOf(method),
|
|
60
|
+
...(method.getOption('deprecated') === true ? { deprecated: true } : {}),
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The message type `fullName` names.
|
|
68
|
+
*
|
|
69
|
+
* @throws ProtoError `proto-type-unknown` when the set has no such message
|
|
70
|
+
*/
|
|
71
|
+
export function lookupMessageType(set, fullName) {
|
|
72
|
+
const found = set.root.lookup(fullName.replace(/^\./, ''), protobuf.Type, true);
|
|
73
|
+
if (found === null || !(found instanceof protobuf.Type)) {
|
|
74
|
+
throw new ProtoError('proto-type-unknown', `Message type "${fullName}" is not defined by the loaded .proto files`, {
|
|
75
|
+
details: { type: fullName },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return found;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The method `service`/`method` names, resolved.
|
|
82
|
+
*
|
|
83
|
+
* @throws ProtoError `proto-method-unknown` when the set has no such service or method
|
|
84
|
+
*/
|
|
85
|
+
export function lookupMethod(set, service, method) {
|
|
86
|
+
const found = set.root.lookup(service.replace(/^\./, ''), protobuf.Service, true);
|
|
87
|
+
if (found === null || !(found instanceof protobuf.Service)) {
|
|
88
|
+
throw new ProtoError('proto-method-unknown', `Service "${service}" is not defined by the loaded .proto files`, {
|
|
89
|
+
details: { service, method },
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const resolved = found.methods[method];
|
|
93
|
+
if (resolved === undefined) {
|
|
94
|
+
throw new ProtoError('proto-method-unknown', `Service "${service}" has no method "${method}"`, {
|
|
95
|
+
details: { service, method },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
resolved.resolve();
|
|
99
|
+
return resolved;
|
|
100
|
+
}
|
|
101
|
+
/** The request and response message types of one method, plus its streaming shape. */
|
|
102
|
+
export function describeMethod(set, service, method) {
|
|
103
|
+
const resolved = lookupMethod(set, service, method);
|
|
104
|
+
return {
|
|
105
|
+
name: resolved.name,
|
|
106
|
+
service: service.replace(/^\./, ''),
|
|
107
|
+
kind: methodKindOf(resolved),
|
|
108
|
+
requestType: resolved.resolvedRequestType !== null ? qualifiedName(resolved.resolvedRequestType) : resolved.requestType,
|
|
109
|
+
responseType: resolved.resolvedResponseType !== null ? qualifiedName(resolved.resolvedResponseType) : resolved.responseType,
|
|
110
|
+
...commentOf(resolved),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function describeField(field) {
|
|
114
|
+
field.resolve();
|
|
115
|
+
const map = field instanceof protobuf.MapField ? field : undefined;
|
|
116
|
+
const resolvedType = field.resolvedType;
|
|
117
|
+
const valueKind = map !== undefined
|
|
118
|
+
? 'map'
|
|
119
|
+
: resolvedType instanceof protobuf.Enum
|
|
120
|
+
? 'enum'
|
|
121
|
+
: resolvedType instanceof protobuf.Type
|
|
122
|
+
? 'message'
|
|
123
|
+
: 'scalar';
|
|
124
|
+
const type = resolvedType !== null ? qualifiedName(resolvedType) : field.type;
|
|
125
|
+
return {
|
|
126
|
+
name: field.name,
|
|
127
|
+
id: field.id,
|
|
128
|
+
type,
|
|
129
|
+
valueKind,
|
|
130
|
+
repeated: field.repeated,
|
|
131
|
+
optional: (field.partOf?.name.startsWith('_') ?? false) || field.rule === 'optional',
|
|
132
|
+
...(field.partOf !== null && !field.partOf.name.startsWith('_') ? { oneof: field.partOf.name } : {}),
|
|
133
|
+
...(map !== undefined ? { mapKeyType: map.keyType } : {}),
|
|
134
|
+
...(resolvedType instanceof protobuf.Enum ? { enumValues: Object.keys(resolvedType.values) } : {}),
|
|
135
|
+
...commentOf(field),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** The fields of the message type `fullName`, in field-number order. */
|
|
139
|
+
export function describeMessage(set, fullName) {
|
|
140
|
+
const type = lookupMessageType(set, fullName);
|
|
141
|
+
return {
|
|
142
|
+
fullName: qualifiedName(type),
|
|
143
|
+
fields: type.fieldsArray.map(describeField),
|
|
144
|
+
oneofs: type.oneofsArray.filter((oneof) => !oneof.name.startsWith('_')).map((oneof) => oneof.name),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/** The lowerCamelCase JSON name protobuf's JSON mapping accepts alongside a field's declared name. */
|
|
148
|
+
function jsonNameOf(name) {
|
|
149
|
+
return name.replace(/_([a-z0-9])/g, (_match, char) => char.toUpperCase());
|
|
150
|
+
}
|
|
151
|
+
/** The message type `fullName`, or `undefined` when the set has no such message. */
|
|
152
|
+
function messageOrUndefined(set, fullName) {
|
|
153
|
+
const found = set.root.lookup(fullName.replace(/^\./, ''), protobuf.Type, true);
|
|
154
|
+
return found instanceof protobuf.Type ? found : undefined;
|
|
155
|
+
}
|
|
156
|
+
/** The field of `descriptor` a JSON key names, matching either the declared name or its JSON name. */
|
|
157
|
+
function fieldNamed(descriptor, key) {
|
|
158
|
+
return descriptor.fields.find((field) => field.name === key || jsonNameOf(field.name) === key);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The message whose fields belong at `path` — a chain of JSON object keys — under `rootType`.
|
|
162
|
+
*
|
|
163
|
+
* `path` is what {@link jsonCompletionContextAt} reports, so it carries no array indices: a
|
|
164
|
+
* repeated field is descended through as if it were singular. A map field is followed by the
|
|
165
|
+
* user's own key, which is consumed here, since only the schema knows that a level of the
|
|
166
|
+
* document is a map rather than a nested message.
|
|
167
|
+
*
|
|
168
|
+
* Returns `undefined` when the path names a field the message does not have, stops on a scalar or
|
|
169
|
+
* an enum, or ends on a map whose entries the user names — and for a well-known type, whose JSON
|
|
170
|
+
* is its own mapping (a `Timestamp` is a string, a wrapper is a bare value) rather than its
|
|
171
|
+
* fields, so offering those fields would be offering a document protobuf will not read back.
|
|
172
|
+
*
|
|
173
|
+
* @throws ProtoError `proto-type-unknown` when the set has no `rootType`
|
|
174
|
+
*/
|
|
175
|
+
export function describeMessageAt(set, rootType, path) {
|
|
176
|
+
let descriptor = describeMessage(set, rootType);
|
|
177
|
+
let index = 0;
|
|
178
|
+
while (index < path.length) {
|
|
179
|
+
const field = fieldNamed(descriptor, path[index]);
|
|
180
|
+
if (field === undefined) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
if (field.valueKind === 'map') {
|
|
184
|
+
// The next segment is whatever the user called this entry; the fields under it are the
|
|
185
|
+
// value type's, so a map costs two segments rather than one.
|
|
186
|
+
index += 1;
|
|
187
|
+
if (index >= path.length) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else if (field.valueKind !== 'message') {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
if (WELL_KNOWN_TYPES.has(field.type)) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
const nested = messageOrUndefined(set, field.type);
|
|
198
|
+
if (nested === undefined) {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
descriptor = describeMessage(set, field.type);
|
|
202
|
+
index += 1;
|
|
203
|
+
}
|
|
204
|
+
return descriptor;
|
|
205
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading a set of `.proto` sources into one resolved schema.
|
|
3
|
+
*
|
|
4
|
+
* The engine never reads a file on its own here: the caller hands over every source it has, keyed
|
|
5
|
+
* by import path, and this module parses them, follows `import` statements through that map (and
|
|
6
|
+
* through the well-known `google/protobuf/*` definitions bundled with the parser), and resolves
|
|
7
|
+
* every type reference. What comes out is a {@link ProtoSet} the describe, sample and codec
|
|
8
|
+
* modules all read from, so a `.proto` is parsed once per import or send and never re-read.
|
|
9
|
+
*/
|
|
10
|
+
import protobuf from 'protobufjs';
|
|
11
|
+
/** `.proto` sources keyed by the import path other files use to reach them (`/`-separated). */
|
|
12
|
+
export type ProtoSources = ReadonlyMap<string, string>;
|
|
13
|
+
/** A parsed and resolved set of `.proto` files. */
|
|
14
|
+
export interface ProtoSet {
|
|
15
|
+
/** The resolved namespace tree. Readers use the describe and codec modules rather than this directly. */
|
|
16
|
+
readonly root: protobuf.Root;
|
|
17
|
+
/** Every file that took part, roots first, in load order; the bundled well-known files included. */
|
|
18
|
+
readonly files: readonly string[];
|
|
19
|
+
/** The import paths the load started from. */
|
|
20
|
+
readonly roots: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** Options for {@link loadProtoSet}. */
|
|
23
|
+
export interface LoadProtoOptions {
|
|
24
|
+
/** The files to start from; each must be a key of the sources. Defaults to every source. */
|
|
25
|
+
readonly roots?: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parses and resolves `sources`, starting from `roots`.
|
|
29
|
+
*
|
|
30
|
+
* @throws ProtoError `proto-parse` when a file does not parse (`details.file`, `details.line` when
|
|
31
|
+
* the parser reports one); `proto-import-missing` when an `import` names a file that is neither in
|
|
32
|
+
* the sources nor bundled; `proto-unresolved` when a type reference resolves to nothing;
|
|
33
|
+
* `proto-no-roots` when there is nothing to load.
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadProtoSet(sources: ProtoSources, options?: LoadProtoOptions): ProtoSet;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading a set of `.proto` sources into one resolved schema.
|
|
3
|
+
*
|
|
4
|
+
* The engine never reads a file on its own here: the caller hands over every source it has, keyed
|
|
5
|
+
* by import path, and this module parses them, follows `import` statements through that map (and
|
|
6
|
+
* through the well-known `google/protobuf/*` definitions bundled with the parser), and resolves
|
|
7
|
+
* every type reference. What comes out is a {@link ProtoSet} the describe, sample and codec
|
|
8
|
+
* modules all read from, so a `.proto` is parsed once per import or send and never re-read.
|
|
9
|
+
*/
|
|
10
|
+
import protobuf from 'protobufjs';
|
|
11
|
+
import { ProtoError } from '../../errors.js';
|
|
12
|
+
/** The `google/protobuf/*.proto` files the parser bundles, keyed by import path. */
|
|
13
|
+
function bundledCommon(path) {
|
|
14
|
+
const common = protobuf.common;
|
|
15
|
+
return Object.hasOwn(common, path) ? common[path] : undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Finds the source an `import` names. The canonical rule is "relative to a proto root", so the
|
|
19
|
+
* verbatim path wins; a path relative to the importing file's directory comes second, and a
|
|
20
|
+
* unique suffix match last — a user who picked files from nested directories should not have to
|
|
21
|
+
* rearrange them to satisfy the import root convention.
|
|
22
|
+
*/
|
|
23
|
+
function resolveImport(sources, importedBy, target) {
|
|
24
|
+
if (sources.has(target)) {
|
|
25
|
+
return target;
|
|
26
|
+
}
|
|
27
|
+
const dir = importedBy.includes('/') ? importedBy.slice(0, importedBy.lastIndexOf('/') + 1) : '';
|
|
28
|
+
const relative = normalisePath(`${dir}${target}`);
|
|
29
|
+
if (sources.has(relative)) {
|
|
30
|
+
return relative;
|
|
31
|
+
}
|
|
32
|
+
const suffix = `/${target}`;
|
|
33
|
+
const candidates = [...sources.keys()].filter((key) => key.endsWith(suffix));
|
|
34
|
+
return candidates.length === 1 ? candidates[0] : undefined;
|
|
35
|
+
}
|
|
36
|
+
/** Collapses `.` and `..` segments of a `/`-separated path. */
|
|
37
|
+
function normalisePath(path) {
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const segment of path.split('/')) {
|
|
40
|
+
if (segment === '' || segment === '.') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (segment === '..') {
|
|
44
|
+
out.pop();
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
out.push(segment);
|
|
48
|
+
}
|
|
49
|
+
return out.join('/');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parses and resolves `sources`, starting from `roots`.
|
|
53
|
+
*
|
|
54
|
+
* @throws ProtoError `proto-parse` when a file does not parse (`details.file`, `details.line` when
|
|
55
|
+
* the parser reports one); `proto-import-missing` when an `import` names a file that is neither in
|
|
56
|
+
* the sources nor bundled; `proto-unresolved` when a type reference resolves to nothing;
|
|
57
|
+
* `proto-no-roots` when there is nothing to load.
|
|
58
|
+
*/
|
|
59
|
+
export function loadProtoSet(sources, options = {}) {
|
|
60
|
+
const roots = options.roots ?? [...sources.keys()];
|
|
61
|
+
if (roots.length === 0) {
|
|
62
|
+
throw new ProtoError('proto-no-roots', 'No .proto files to load');
|
|
63
|
+
}
|
|
64
|
+
const root = new protobuf.Root();
|
|
65
|
+
const loaded = new Set();
|
|
66
|
+
const order = [];
|
|
67
|
+
const load = (path, importedBy) => {
|
|
68
|
+
if (loaded.has(path)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
loaded.add(path);
|
|
72
|
+
order.push(path);
|
|
73
|
+
const source = sources.get(path);
|
|
74
|
+
if (source === undefined) {
|
|
75
|
+
const bundled = bundledCommon(path);
|
|
76
|
+
if (bundled !== undefined) {
|
|
77
|
+
root.addJSON(bundled.nested ?? {});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
throw new ProtoError('proto-import-missing', importedBy === undefined
|
|
81
|
+
? `${path} is not among the .proto files`
|
|
82
|
+
: `${importedBy} imports ${path}, which is not among the .proto files`, { details: { file: path, ...(importedBy !== undefined ? { importedBy } : {}) } });
|
|
83
|
+
}
|
|
84
|
+
let parsed;
|
|
85
|
+
try {
|
|
86
|
+
parsed = protobuf.parse(source, root, { keepCase: true, alternateCommentMode: true });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
90
|
+
const line = /\(line (\d+)\)/.exec(message)?.[1];
|
|
91
|
+
throw new ProtoError('proto-parse', `${path}: ${message}`, {
|
|
92
|
+
cause: error,
|
|
93
|
+
details: { file: path, ...(line !== undefined ? { line: Number(line) } : {}) },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
for (const target of [...(parsed.imports ?? []), ...(parsed.weakImports ?? [])]) {
|
|
97
|
+
const resolved = resolveImport(sources, path, target) ?? target;
|
|
98
|
+
load(resolved, path);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
for (const path of roots) {
|
|
102
|
+
load(path, undefined);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
root.resolveAll();
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
109
|
+
throw new ProtoError('proto-unresolved', message, { cause: error });
|
|
110
|
+
}
|
|
111
|
+
return { root, files: order, roots };
|
|
112
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sample request message for a type, as the JSON the editor starts from — the counterpart of the
|
|
3
|
+
* `?`-filled envelope a WSDL import generates. Every field is present once with a zero-ish value of
|
|
4
|
+
* the right JSON shape, so the user replaces values rather than remembering names; a `oneof` shows
|
|
5
|
+
* its first member only, and recursion stops at a fixed depth so a self-referencing tree does not
|
|
6
|
+
* unroll for ever.
|
|
7
|
+
*/
|
|
8
|
+
import type { ProtoSet } from './load.js';
|
|
9
|
+
/** Options for {@link sampleMessage}. */
|
|
10
|
+
export interface SampleMessageOptions {
|
|
11
|
+
/** Message nesting depth at which a message becomes `{}`. Defaults to 3. */
|
|
12
|
+
readonly maxDepth?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A sample value for the message type `fullName`, as a plain JSON-ready value.
|
|
16
|
+
*
|
|
17
|
+
* @throws ProtoError `proto-type-unknown` when the set has no such message
|
|
18
|
+
*/
|
|
19
|
+
export declare function sampleMessage(set: ProtoSet, fullName: string, options?: SampleMessageOptions): unknown;
|
|
20
|
+
/** {@link sampleMessage} as pretty-printed JSON text, which is what a new request's body file holds. */
|
|
21
|
+
export declare function sampleMessageText(set: ProtoSet, fullName: string, options?: SampleMessageOptions): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sample request message for a type, as the JSON the editor starts from — the counterpart of the
|
|
3
|
+
* `?`-filled envelope a WSDL import generates. Every field is present once with a zero-ish value of
|
|
4
|
+
* the right JSON shape, so the user replaces values rather than remembering names; a `oneof` shows
|
|
5
|
+
* its first member only, and recursion stops at a fixed depth so a self-referencing tree does not
|
|
6
|
+
* unroll for ever.
|
|
7
|
+
*/
|
|
8
|
+
import protobuf from 'protobufjs';
|
|
9
|
+
import { lookupMessageType } from './describe.js';
|
|
10
|
+
import { wellKnownSample } from './well-known.js';
|
|
11
|
+
const DEFAULT_MAX_DEPTH = 3;
|
|
12
|
+
function scalarSample(type) {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'string':
|
|
15
|
+
return '';
|
|
16
|
+
case 'bool':
|
|
17
|
+
return false;
|
|
18
|
+
case 'bytes':
|
|
19
|
+
return '';
|
|
20
|
+
case 'int64':
|
|
21
|
+
case 'uint64':
|
|
22
|
+
case 'sint64':
|
|
23
|
+
case 'fixed64':
|
|
24
|
+
case 'sfixed64':
|
|
25
|
+
return '0';
|
|
26
|
+
default:
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function fieldSample(field, depth, options) {
|
|
31
|
+
field.resolve();
|
|
32
|
+
const resolved = field.resolvedType;
|
|
33
|
+
if (resolved instanceof protobuf.Enum) {
|
|
34
|
+
const names = Object.keys(resolved.values);
|
|
35
|
+
return names[0] ?? 0;
|
|
36
|
+
}
|
|
37
|
+
if (resolved instanceof protobuf.Type) {
|
|
38
|
+
return typeSample(resolved, depth + 1, options);
|
|
39
|
+
}
|
|
40
|
+
return scalarSample(field.type);
|
|
41
|
+
}
|
|
42
|
+
function typeSample(type, depth, options) {
|
|
43
|
+
const wellKnown = wellKnownSample(type.fullName.replace(/^\./, ''));
|
|
44
|
+
if (wellKnown !== undefined) {
|
|
45
|
+
return wellKnown;
|
|
46
|
+
}
|
|
47
|
+
if (depth > options.maxDepth) {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
const out = {};
|
|
51
|
+
const seenOneofs = new Set();
|
|
52
|
+
for (const field of type.fieldsArray) {
|
|
53
|
+
if (field.partOf !== null && !field.partOf.name.startsWith('_')) {
|
|
54
|
+
if (seenOneofs.has(field.partOf.name)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
seenOneofs.add(field.partOf.name);
|
|
58
|
+
}
|
|
59
|
+
if (field instanceof protobuf.MapField) {
|
|
60
|
+
out[field.name] = { key: fieldSample(field, depth, options) };
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const value = fieldSample(field, depth, options);
|
|
64
|
+
out[field.name] = field.repeated ? [value] : value;
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A sample value for the message type `fullName`, as a plain JSON-ready value.
|
|
70
|
+
*
|
|
71
|
+
* @throws ProtoError `proto-type-unknown` when the set has no such message
|
|
72
|
+
*/
|
|
73
|
+
export function sampleMessage(set, fullName, options = {}) {
|
|
74
|
+
return typeSample(lookupMessageType(set, fullName), 0, { maxDepth: options.maxDepth ?? DEFAULT_MAX_DEPTH });
|
|
75
|
+
}
|
|
76
|
+
/** {@link sampleMessage} as pretty-printed JSON text, which is what a new request's body file holds. */
|
|
77
|
+
export function sampleMessageText(set, fullName, options = {}) {
|
|
78
|
+
return `${JSON.stringify(sampleMessage(set, fullName, options), null, 2)}\n`;
|
|
79
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON mapping the protobuf specification gives the well-known types: a `Timestamp` is an
|
|
3
|
+
* RFC 3339 string, a `Duration` is `"1.5s"`, a `Struct` is the JSON object it represents, a wrapper
|
|
4
|
+
* is its bare value, an `Any` carries an `@type` beside the message's own fields. The parser
|
|
5
|
+
* itself knows only the field-by-field form (`{seconds, nanos}`), so the codec converts between
|
|
6
|
+
* the two here, on the way in and on the way out, field numbers rather than names because the
|
|
7
|
+
* bundled definitions do not spell the names the way a `.proto` on disk does.
|
|
8
|
+
*/
|
|
9
|
+
/** The fully qualified names this module handles. */
|
|
10
|
+
export declare const WELL_KNOWN_TYPES: ReadonlySet<string>;
|
|
11
|
+
/** Whether `fullName` is a wrapper type (`google.protobuf.StringValue` and its siblings). */
|
|
12
|
+
export declare function isWrapperType(fullName: string): boolean;
|
|
13
|
+
/** The sample the editor shows for a well-known type, or `undefined` for an ordinary message. */
|
|
14
|
+
export declare function wellKnownSample(fullName: string): unknown;
|
|
15
|
+
/** `{seconds, nanos}` from a JSON `Timestamp` string. */
|
|
16
|
+
export declare function timestampFromJson(value: unknown): {
|
|
17
|
+
seconds: string;
|
|
18
|
+
nanos: number;
|
|
19
|
+
};
|
|
20
|
+
/** A JSON `Timestamp` string from `{seconds, nanos}`. */
|
|
21
|
+
export declare function timestampToJson(value: {
|
|
22
|
+
seconds?: unknown;
|
|
23
|
+
nanos?: unknown;
|
|
24
|
+
}): string;
|
|
25
|
+
/** `{seconds, nanos}` from a JSON `Duration` string such as `"1.5s"`. */
|
|
26
|
+
export declare function durationFromJson(value: unknown): {
|
|
27
|
+
seconds: string;
|
|
28
|
+
nanos: number;
|
|
29
|
+
};
|
|
30
|
+
/** A JSON `Duration` string from `{seconds, nanos}`. */
|
|
31
|
+
export declare function durationToJson(value: {
|
|
32
|
+
seconds?: unknown;
|
|
33
|
+
nanos?: unknown;
|
|
34
|
+
}): string;
|
|
35
|
+
/** A JSON `FieldMask` string (`"a.b,c"`) as `{paths}`. */
|
|
36
|
+
export declare function fieldMaskFromJson(value: unknown): {
|
|
37
|
+
paths: string[];
|
|
38
|
+
};
|
|
39
|
+
/** `{paths}` as the JSON `FieldMask` string. */
|
|
40
|
+
export declare function fieldMaskToJson(value: {
|
|
41
|
+
paths?: unknown;
|
|
42
|
+
}): string;
|