@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,143 @@
|
|
|
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
|
+
import { ProtoError } from '../../errors.js';
|
|
10
|
+
/** The fully qualified names this module handles. */
|
|
11
|
+
export const WELL_KNOWN_TYPES = new Set([
|
|
12
|
+
'google.protobuf.Timestamp',
|
|
13
|
+
'google.protobuf.Duration',
|
|
14
|
+
'google.protobuf.Struct',
|
|
15
|
+
'google.protobuf.Value',
|
|
16
|
+
'google.protobuf.ListValue',
|
|
17
|
+
'google.protobuf.NullValue',
|
|
18
|
+
'google.protobuf.Empty',
|
|
19
|
+
'google.protobuf.FieldMask',
|
|
20
|
+
'google.protobuf.Any',
|
|
21
|
+
'google.protobuf.DoubleValue',
|
|
22
|
+
'google.protobuf.FloatValue',
|
|
23
|
+
'google.protobuf.Int64Value',
|
|
24
|
+
'google.protobuf.UInt64Value',
|
|
25
|
+
'google.protobuf.Int32Value',
|
|
26
|
+
'google.protobuf.UInt32Value',
|
|
27
|
+
'google.protobuf.BoolValue',
|
|
28
|
+
'google.protobuf.StringValue',
|
|
29
|
+
'google.protobuf.BytesValue',
|
|
30
|
+
]);
|
|
31
|
+
const WRAPPERS = new Set([...WELL_KNOWN_TYPES].filter((name) => name.endsWith('Value') &&
|
|
32
|
+
name !== 'google.protobuf.Value' &&
|
|
33
|
+
name !== 'google.protobuf.ListValue' &&
|
|
34
|
+
name !== 'google.protobuf.NullValue'));
|
|
35
|
+
/** Whether `fullName` is a wrapper type (`google.protobuf.StringValue` and its siblings). */
|
|
36
|
+
export function isWrapperType(fullName) {
|
|
37
|
+
return WRAPPERS.has(fullName);
|
|
38
|
+
}
|
|
39
|
+
/** The sample the editor shows for a well-known type, or `undefined` for an ordinary message. */
|
|
40
|
+
export function wellKnownSample(fullName) {
|
|
41
|
+
switch (fullName) {
|
|
42
|
+
case 'google.protobuf.Timestamp':
|
|
43
|
+
return '1970-01-01T00:00:00Z';
|
|
44
|
+
case 'google.protobuf.Duration':
|
|
45
|
+
return '0s';
|
|
46
|
+
case 'google.protobuf.Struct':
|
|
47
|
+
case 'google.protobuf.Empty':
|
|
48
|
+
return {};
|
|
49
|
+
case 'google.protobuf.Value':
|
|
50
|
+
return null;
|
|
51
|
+
case 'google.protobuf.ListValue':
|
|
52
|
+
return [];
|
|
53
|
+
case 'google.protobuf.FieldMask':
|
|
54
|
+
return '';
|
|
55
|
+
case 'google.protobuf.Any':
|
|
56
|
+
return { '@type': '' };
|
|
57
|
+
case 'google.protobuf.BoolValue':
|
|
58
|
+
return false;
|
|
59
|
+
case 'google.protobuf.StringValue':
|
|
60
|
+
case 'google.protobuf.BytesValue':
|
|
61
|
+
case 'google.protobuf.Int64Value':
|
|
62
|
+
case 'google.protobuf.UInt64Value':
|
|
63
|
+
return '';
|
|
64
|
+
case 'google.protobuf.DoubleValue':
|
|
65
|
+
case 'google.protobuf.FloatValue':
|
|
66
|
+
case 'google.protobuf.Int32Value':
|
|
67
|
+
case 'google.protobuf.UInt32Value':
|
|
68
|
+
return 0;
|
|
69
|
+
default:
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function invalid(type, reason) {
|
|
74
|
+
return new ProtoError('grpc-message-invalid', `${type}: ${reason}`, { details: { type, reason } });
|
|
75
|
+
}
|
|
76
|
+
/** `{seconds, nanos}` from a JSON `Timestamp` string. */
|
|
77
|
+
export function timestampFromJson(value) {
|
|
78
|
+
if (typeof value !== 'string') {
|
|
79
|
+
throw invalid('google.protobuf.Timestamp', 'expected an RFC 3339 string');
|
|
80
|
+
}
|
|
81
|
+
const match = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/.exec(value);
|
|
82
|
+
if (match === null) {
|
|
83
|
+
throw invalid('google.protobuf.Timestamp', `"${value}" is not an RFC 3339 timestamp`);
|
|
84
|
+
}
|
|
85
|
+
const millis = Date.parse(`${match[1]}${match[3]}`);
|
|
86
|
+
if (Number.isNaN(millis)) {
|
|
87
|
+
throw invalid('google.protobuf.Timestamp', `"${value}" is not a valid date`);
|
|
88
|
+
}
|
|
89
|
+
const fraction = match[2] === undefined ? '' : match[2].slice(1).padEnd(9, '0');
|
|
90
|
+
return { seconds: String(Math.floor(millis / 1000)), nanos: fraction === '' ? 0 : Number(fraction) };
|
|
91
|
+
}
|
|
92
|
+
/** A JSON `Timestamp` string from `{seconds, nanos}`. */
|
|
93
|
+
export function timestampToJson(value) {
|
|
94
|
+
const seconds = Number(value.seconds ?? 0);
|
|
95
|
+
const nanos = Number(value.nanos ?? 0);
|
|
96
|
+
const iso = new Date(seconds * 1000).toISOString().slice(0, 19);
|
|
97
|
+
if (nanos === 0) {
|
|
98
|
+
return `${iso}Z`;
|
|
99
|
+
}
|
|
100
|
+
const fraction = String(nanos)
|
|
101
|
+
.padStart(9, '0')
|
|
102
|
+
.replace(/(?:000)+$/, '');
|
|
103
|
+
return `${iso}.${fraction}Z`;
|
|
104
|
+
}
|
|
105
|
+
/** `{seconds, nanos}` from a JSON `Duration` string such as `"1.5s"`. */
|
|
106
|
+
export function durationFromJson(value) {
|
|
107
|
+
if (typeof value !== 'string') {
|
|
108
|
+
throw invalid('google.protobuf.Duration', 'expected a string such as "1.5s"');
|
|
109
|
+
}
|
|
110
|
+
const match = /^(-)?(\d+)(?:\.(\d{1,9}))?s$/.exec(value);
|
|
111
|
+
if (match === null) {
|
|
112
|
+
throw invalid('google.protobuf.Duration', `"${value}" is not a duration such as "1.5s"`);
|
|
113
|
+
}
|
|
114
|
+
const negative = match[1] === '-';
|
|
115
|
+
const seconds = BigInt(match[2] ?? '0');
|
|
116
|
+
const nanos = match[3] === undefined ? 0 : Number(match[3].padEnd(9, '0'));
|
|
117
|
+
return { seconds: `${negative ? '-' : ''}${seconds.toString()}`, nanos: negative ? -nanos : nanos };
|
|
118
|
+
}
|
|
119
|
+
/** A JSON `Duration` string from `{seconds, nanos}`. */
|
|
120
|
+
export function durationToJson(value) {
|
|
121
|
+
const seconds = typeof value.seconds === 'string' || typeof value.seconds === 'number' ? String(value.seconds) : '0';
|
|
122
|
+
const nanos = Number(value.nanos ?? 0);
|
|
123
|
+
const negative = seconds.startsWith('-') || nanos < 0;
|
|
124
|
+
const absSeconds = seconds.replace(/^-/, '');
|
|
125
|
+
const absNanos = Math.abs(nanos);
|
|
126
|
+
const fraction = absNanos === 0
|
|
127
|
+
? ''
|
|
128
|
+
: `.${String(absNanos)
|
|
129
|
+
.padStart(9, '0')
|
|
130
|
+
.replace(/(?:000)+$/, '')}`;
|
|
131
|
+
return `${negative ? '-' : ''}${absSeconds}${fraction}s`;
|
|
132
|
+
}
|
|
133
|
+
/** A JSON `FieldMask` string (`"a.b,c"`) as `{paths}`. */
|
|
134
|
+
export function fieldMaskFromJson(value) {
|
|
135
|
+
if (typeof value !== 'string') {
|
|
136
|
+
throw invalid('google.protobuf.FieldMask', 'expected a comma-separated string of paths');
|
|
137
|
+
}
|
|
138
|
+
return { paths: value === '' ? [] : value.split(',').map((path) => path.trim()) };
|
|
139
|
+
}
|
|
140
|
+
/** `{paths}` as the JSON `FieldMask` string. */
|
|
141
|
+
export function fieldMaskToJson(value) {
|
|
142
|
+
return Array.isArray(value.paths) ? value.paths.map(String).join(',') : '';
|
|
143
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reconciling a gRPC API against a schema it has been given again — a server re-describing itself,
|
|
3
|
+
* or the same `.proto` files re-read.
|
|
4
|
+
*
|
|
5
|
+
* The rule is the one "Update Definition" keeps for a WSDL: **nothing is ever deleted.** A method the
|
|
6
|
+
* schema no longer declares keeps its saved request, flagged {@link GrpcRequestDef.orphaned}, because
|
|
7
|
+
* a method that disappeared may mean "clean this up" or may mean the server was rebuilt wrong, and
|
|
8
|
+
* that is the user's call. A method that came back has the flag cleared. A method the API does not
|
|
9
|
+
* have yet gets a request, in the folder its service already owns or in a new one; what the user
|
|
10
|
+
* edited — a message, metadata, credentials, settings — is never touched.
|
|
11
|
+
*
|
|
12
|
+
* Pure: it returns the next API and the ids of what changed, and writes nothing.
|
|
13
|
+
*/
|
|
14
|
+
import type { IdGenerator } from '../project/model.js';
|
|
15
|
+
import type { GrpcApi } from './model.js';
|
|
16
|
+
import type { ProtoSet } from './proto/load.js';
|
|
17
|
+
/** Options for {@link reconcileGrpcApi}. */
|
|
18
|
+
export interface ReconcileGrpcApiOptions {
|
|
19
|
+
/** Mints ids for created folders and requests; injected by tests for determinism. */
|
|
20
|
+
readonly newId?: IdGenerator;
|
|
21
|
+
}
|
|
22
|
+
/** What {@link reconcileGrpcApi} did, in ids the caller can report or select. */
|
|
23
|
+
export interface GrpcReconcileResult {
|
|
24
|
+
readonly api: GrpcApi;
|
|
25
|
+
/** Ids of requests created for methods the API did not have. */
|
|
26
|
+
readonly requestsAdded: readonly string[];
|
|
27
|
+
/** Ids of requests now flagged `orphaned` because their method is gone. */
|
|
28
|
+
readonly requestsOrphaned: readonly string[];
|
|
29
|
+
/** Ids of requests whose method is back, so the flag was cleared. */
|
|
30
|
+
readonly requestsRestored: readonly string[];
|
|
31
|
+
/** Ids of requests whose streaming shape changed, so `methodKind` was corrected. */
|
|
32
|
+
readonly requestsRetyped: readonly string[];
|
|
33
|
+
/** Ids of folders created for services the API did not have. */
|
|
34
|
+
readonly foldersAdded: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Brings `api` in line with `set`.
|
|
38
|
+
*
|
|
39
|
+
* @param api the API to reconcile; never mutated
|
|
40
|
+
* @param set the schema it has been given again
|
|
41
|
+
*/
|
|
42
|
+
export declare function reconcileGrpcApi(api: GrpcApi, set: ProtoSet, options?: ReconcileGrpcApiOptions): GrpcReconcileResult;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reconciling a gRPC API against a schema it has been given again — a server re-describing itself,
|
|
3
|
+
* or the same `.proto` files re-read.
|
|
4
|
+
*
|
|
5
|
+
* The rule is the one "Update Definition" keeps for a WSDL: **nothing is ever deleted.** A method the
|
|
6
|
+
* schema no longer declares keeps its saved request, flagged {@link GrpcRequestDef.orphaned}, because
|
|
7
|
+
* a method that disappeared may mean "clean this up" or may mean the server was rebuilt wrong, and
|
|
8
|
+
* that is the user's call. A method that came back has the flag cleared. A method the API does not
|
|
9
|
+
* have yet gets a request, in the folder its service already owns or in a new one; what the user
|
|
10
|
+
* edited — a message, metadata, credentials, settings — is never touched.
|
|
11
|
+
*
|
|
12
|
+
* Pure: it returns the next API and the ids of what changed, and writes nothing.
|
|
13
|
+
*/
|
|
14
|
+
import { uniqueSlug } from '../project/paths.js';
|
|
15
|
+
import { createGrpcFolder, createGrpcRequest } from './model.js';
|
|
16
|
+
import { describeServices } from './proto/describe.js';
|
|
17
|
+
import { sampleMessageText } from './proto/sample.js';
|
|
18
|
+
/** A method's identity across two schemas. */
|
|
19
|
+
function methodKey(service, method) {
|
|
20
|
+
return `${service}/${method}`;
|
|
21
|
+
}
|
|
22
|
+
/** Every request under a folder tree, depth-first, with the folder holding it. */
|
|
23
|
+
function walkRequests(folders) {
|
|
24
|
+
return folders.flatMap((folder) => [
|
|
25
|
+
...folder.requests.map((request) => ({ folder, request })),
|
|
26
|
+
...walkRequests(folder.folders),
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
/** A method's description: its leading comment, with a deprecation notice ahead of it. */
|
|
30
|
+
function requestDescription(method) {
|
|
31
|
+
const parts = [method.deprecated === true ? '**Deprecated.**' : undefined, method.comment].filter((part) => part !== undefined && part !== '');
|
|
32
|
+
return parts.length > 0 ? parts.join(' ') : undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Brings `api` in line with `set`.
|
|
36
|
+
*
|
|
37
|
+
* @param api the API to reconcile; never mutated
|
|
38
|
+
* @param set the schema it has been given again
|
|
39
|
+
*/
|
|
40
|
+
export function reconcileGrpcApi(api, set, options = {}) {
|
|
41
|
+
const services = describeServices(set);
|
|
42
|
+
const declared = new Map();
|
|
43
|
+
for (const service of services) {
|
|
44
|
+
for (const method of service.methods) {
|
|
45
|
+
declared.set(methodKey(service.fullName, method.name), { service, method });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const requestsOrphaned = [];
|
|
49
|
+
const requestsRestored = [];
|
|
50
|
+
const requestsRetyped = [];
|
|
51
|
+
const kept = new Set();
|
|
52
|
+
/** Re-flags one request against the schema, leaving everything the user edited alone. */
|
|
53
|
+
const reconcileRequest = (request) => {
|
|
54
|
+
const found = declared.get(methodKey(request.service, request.method));
|
|
55
|
+
if (found === undefined) {
|
|
56
|
+
if (request.orphaned !== true) {
|
|
57
|
+
requestsOrphaned.push(request.id);
|
|
58
|
+
return { ...request, orphaned: true };
|
|
59
|
+
}
|
|
60
|
+
return request;
|
|
61
|
+
}
|
|
62
|
+
kept.add(methodKey(request.service, request.method));
|
|
63
|
+
let next = request;
|
|
64
|
+
if (next.orphaned === true) {
|
|
65
|
+
requestsRestored.push(next.id);
|
|
66
|
+
const { orphaned, ...rest } = next;
|
|
67
|
+
void orphaned;
|
|
68
|
+
next = rest;
|
|
69
|
+
}
|
|
70
|
+
if (next.methodKind !== found.method.kind) {
|
|
71
|
+
requestsRetyped.push(next.id);
|
|
72
|
+
next = { ...next, methodKind: found.method.kind };
|
|
73
|
+
}
|
|
74
|
+
return next;
|
|
75
|
+
};
|
|
76
|
+
const reconcileFolder = (folder) => ({
|
|
77
|
+
...folder,
|
|
78
|
+
requests: folder.requests.map(reconcileRequest),
|
|
79
|
+
folders: folder.folders.map(reconcileFolder),
|
|
80
|
+
});
|
|
81
|
+
let next = {
|
|
82
|
+
...api,
|
|
83
|
+
requests: api.requests.map(reconcileRequest),
|
|
84
|
+
folders: api.folders.map(reconcileFolder),
|
|
85
|
+
};
|
|
86
|
+
// Where a new request goes: the folder that already holds this service, anywhere in the tree.
|
|
87
|
+
const folderOfService = new Map();
|
|
88
|
+
for (const { folder, request } of walkRequests(next.folders)) {
|
|
89
|
+
if (!folderOfService.has(request.service)) {
|
|
90
|
+
folderOfService.set(request.service, folder.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const requestsAdded = [];
|
|
94
|
+
const foldersAdded = [];
|
|
95
|
+
const newRequests = new Map();
|
|
96
|
+
const rootFolderSlugs = new Set(next.folders.map((folder) => folder.slug.toLowerCase()));
|
|
97
|
+
for (const service of services) {
|
|
98
|
+
const missing = service.methods.filter((method) => !kept.has(methodKey(service.fullName, method.name)));
|
|
99
|
+
if (missing.length === 0) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
let folderId = folderOfService.get(service.fullName);
|
|
103
|
+
if (folderId === undefined) {
|
|
104
|
+
const slug = uniqueSlug(service.name, rootFolderSlugs);
|
|
105
|
+
rootFolderSlugs.add(slug.toLowerCase());
|
|
106
|
+
const description = [service.package !== '' ? `Package \`${service.package}\`.` : undefined, service.comment]
|
|
107
|
+
.filter((part) => part !== undefined && part !== '')
|
|
108
|
+
.join(' ');
|
|
109
|
+
const folder = createGrpcFolder(service.name, {
|
|
110
|
+
slug,
|
|
111
|
+
order: next.folders.length,
|
|
112
|
+
...(options.newId !== undefined ? { newId: options.newId } : {}),
|
|
113
|
+
...(description !== '' ? { description } : {}),
|
|
114
|
+
});
|
|
115
|
+
foldersAdded.push(folder.id);
|
|
116
|
+
next = { ...next, folders: [...next.folders, folder] };
|
|
117
|
+
folderId = folder.id;
|
|
118
|
+
folderOfService.set(service.fullName, folderId);
|
|
119
|
+
}
|
|
120
|
+
const into = newRequests.get(folderId) ?? [];
|
|
121
|
+
for (const method of missing) {
|
|
122
|
+
const description = requestDescription(method);
|
|
123
|
+
const request = createGrpcRequest(method.name, {
|
|
124
|
+
...(options.newId !== undefined ? { newId: options.newId } : {}),
|
|
125
|
+
...(description !== undefined ? { description } : {}),
|
|
126
|
+
service: service.fullName,
|
|
127
|
+
method: method.name,
|
|
128
|
+
methodKind: method.kind,
|
|
129
|
+
message: sampleMessageText(set, method.requestType),
|
|
130
|
+
});
|
|
131
|
+
requestsAdded.push(request.id);
|
|
132
|
+
into.push(request);
|
|
133
|
+
}
|
|
134
|
+
newRequests.set(folderId, into);
|
|
135
|
+
}
|
|
136
|
+
/** Appends the new requests of each folder, slugs and orders unique within it. */
|
|
137
|
+
const addInto = (folder) => {
|
|
138
|
+
const additions = newRequests.get(folder.id) ?? [];
|
|
139
|
+
const folders = folder.folders.map(addInto);
|
|
140
|
+
if (additions.length === 0) {
|
|
141
|
+
return { ...folder, folders };
|
|
142
|
+
}
|
|
143
|
+
const taken = new Set(folder.requests.map((request) => request.slug.toLowerCase()));
|
|
144
|
+
const numbered = additions.map((request, index) => {
|
|
145
|
+
const slug = uniqueSlug(request.name, taken);
|
|
146
|
+
taken.add(slug.toLowerCase());
|
|
147
|
+
return { ...request, slug, order: folder.requests.length + index };
|
|
148
|
+
});
|
|
149
|
+
return { ...folder, folders, requests: [...folder.requests, ...numbered] };
|
|
150
|
+
};
|
|
151
|
+
next = { ...next, folders: next.folders.map(addInto) };
|
|
152
|
+
return { api: next, requestsAdded, requestsOrphaned, requestsRestored, requestsRetyped, foldersAdded };
|
|
153
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovering a server's services over gRPC server reflection.
|
|
3
|
+
*
|
|
4
|
+
* A user who has the `.proto` files imports them; a user who has only an address asks the server
|
|
5
|
+
* what it serves. The protocol for that is `ServerReflectionInfo`, and although it is declared as a
|
|
6
|
+
* bidirectional stream, the exchange is strictly request/response per message and the client always
|
|
7
|
+
* knows what to ask for before it asks — so the whole discovery resolves as a short sequence of
|
|
8
|
+
* ordinary batch calls through {@link sendGrpc}, with no transport change and with trust, proxy,
|
|
9
|
+
* credentials and deadline behaving exactly as they do for a call the user sends by hand.
|
|
10
|
+
*
|
|
11
|
+
* The rounds are:
|
|
12
|
+
*
|
|
13
|
+
* 1. `list_services` — the service names the server exposes.
|
|
14
|
+
* 2. One `file_containing_symbol` per service. A well-behaved server answers each with the file
|
|
15
|
+
* declaring the service *and* its transitive dependencies.
|
|
16
|
+
* 3. Whatever dependency is still missing, by `file_by_filename`, until nothing new arrives or the
|
|
17
|
+
* round cap is reached — so a server that answers a dependency with another dependency cannot
|
|
18
|
+
* keep the client asking forever.
|
|
19
|
+
*/
|
|
20
|
+
import type { ProtoSet } from '../proto/load.js';
|
|
21
|
+
import type { GrpcSendInput } from '../send.js';
|
|
22
|
+
import type { GrpcReflectionVersion } from './proto.js';
|
|
23
|
+
export type { GrpcReflectionVersion } from './proto.js';
|
|
24
|
+
/** Everything {@link reflectServices} needs: the transport half of a call, plus the version to speak. */
|
|
25
|
+
export interface GrpcReflectInput extends Omit<GrpcSendInput, 'service' | 'method' | 'messages'> {
|
|
26
|
+
/** Which protocol version to use. Defaults to `auto`: v1 first, v1alpha if the server refuses it. */
|
|
27
|
+
readonly version?: GrpcReflectionVersion;
|
|
28
|
+
/** Cap on the dependency-chasing rounds. Defaults to 8. */
|
|
29
|
+
readonly maxRounds?: number;
|
|
30
|
+
}
|
|
31
|
+
/** What a server described of itself. */
|
|
32
|
+
export interface GrpcReflectionResult {
|
|
33
|
+
/** The version that answered, which is what an `auto` discovery resolved to. */
|
|
34
|
+
readonly version: 'v1' | 'v1alpha';
|
|
35
|
+
/** The services the server exposes, reflection's own services excluded. */
|
|
36
|
+
readonly services: readonly string[];
|
|
37
|
+
/** Every descriptor collected, keyed by the file name its own header carries. */
|
|
38
|
+
readonly files: ReadonlyMap<string, Uint8Array>;
|
|
39
|
+
/** The files declaring the services, which the schema is loaded from. */
|
|
40
|
+
readonly roots: readonly string[];
|
|
41
|
+
/** Files something imports that the server never described, after the rounds ran out. */
|
|
42
|
+
readonly missing: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
/** Whether a name is one of reflection's own services, which a discovered API has no use for. */
|
|
45
|
+
export declare function isReflectionService(name: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Asks a server what it serves.
|
|
48
|
+
*
|
|
49
|
+
* `auto` tries `grpc.reflection.v1` and falls back to `grpc.reflection.v1alpha` when the server
|
|
50
|
+
* refuses it, which is what a server predating the stable package does.
|
|
51
|
+
*
|
|
52
|
+
* @throws HttpError for a connection, DNS, TLS or abort failure; GrpcError
|
|
53
|
+
* `grpc-reflection-unsupported` when the server serves no reflection version this client knows,
|
|
54
|
+
* `grpc-reflection-failed` when it refuses a request; ProtoError `grpc-reflection-descriptor` when
|
|
55
|
+
* a descriptor it sent cannot be read
|
|
56
|
+
*/
|
|
57
|
+
export declare function reflectServices(input: GrpcReflectInput): Promise<GrpcReflectionResult>;
|
|
58
|
+
/** What {@link reflectProtoSet} produced: the loaded schema and the discovery behind it. */
|
|
59
|
+
export interface GrpcReflectedProtoSet extends GrpcReflectionResult {
|
|
60
|
+
readonly set: ProtoSet;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Discovers a server's services and resolves them into a loaded schema, which is the form the rest
|
|
64
|
+
* of the gRPC code — `describeServices`, the codec, `apiFromProtoSet` — already reads.
|
|
65
|
+
*
|
|
66
|
+
* @throws as {@link reflectServices}, plus ProtoError `grpc-reflection-incomplete` when the set the
|
|
67
|
+
* server described does not resolve and files it imports are missing from it, and `proto-unresolved`
|
|
68
|
+
* when it does not resolve for any other reason
|
|
69
|
+
*/
|
|
70
|
+
export declare function reflectProtoSet(input: GrpcReflectInput): Promise<GrpcReflectedProtoSet>;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovering a server's services over gRPC server reflection.
|
|
3
|
+
*
|
|
4
|
+
* A user who has the `.proto` files imports them; a user who has only an address asks the server
|
|
5
|
+
* what it serves. The protocol for that is `ServerReflectionInfo`, and although it is declared as a
|
|
6
|
+
* bidirectional stream, the exchange is strictly request/response per message and the client always
|
|
7
|
+
* knows what to ask for before it asks — so the whole discovery resolves as a short sequence of
|
|
8
|
+
* ordinary batch calls through {@link sendGrpc}, with no transport change and with trust, proxy,
|
|
9
|
+
* credentials and deadline behaving exactly as they do for a call the user sends by hand.
|
|
10
|
+
*
|
|
11
|
+
* The rounds are:
|
|
12
|
+
*
|
|
13
|
+
* 1. `list_services` — the service names the server exposes.
|
|
14
|
+
* 2. One `file_containing_symbol` per service. A well-behaved server answers each with the file
|
|
15
|
+
* declaring the service *and* its transitive dependencies.
|
|
16
|
+
* 3. Whatever dependency is still missing, by `file_by_filename`, until nothing new arrives or the
|
|
17
|
+
* round cap is reached — so a server that answers a dependency with another dependency cannot
|
|
18
|
+
* keep the client asking forever.
|
|
19
|
+
*/
|
|
20
|
+
import { Buffer } from 'node:buffer';
|
|
21
|
+
import { GrpcError } from '../../errors.js';
|
|
22
|
+
import { decodeMessage, encodeMessage } from '../codec.js';
|
|
23
|
+
import { sendGrpc } from '../send.js';
|
|
24
|
+
import { grpcStatusName } from '../status.js';
|
|
25
|
+
import { descriptorHeader, protoSetFromDescriptors } from './descriptors.js';
|
|
26
|
+
import { REFLECTION_METHOD, REFLECTION_VERSIONS, reflectionPackage, reflectionProtoSet, reflectionServiceName, } from './proto.js';
|
|
27
|
+
/** How many `file_by_filename` rounds to run before giving up on the files still missing. */
|
|
28
|
+
const DEFAULT_MAX_ROUNDS = 8;
|
|
29
|
+
/** `UNIMPLEMENTED`, which is what a server that does not know a reflection version answers with. */
|
|
30
|
+
const UNIMPLEMENTED = 12;
|
|
31
|
+
/** Whether a name is one of reflection's own services, which a discovered API has no use for. */
|
|
32
|
+
export function isReflectionService(name) {
|
|
33
|
+
return REFLECTION_VERSIONS.some((version) => name === reflectionServiceName(version));
|
|
34
|
+
}
|
|
35
|
+
/** Whether an error says the server does not implement the reflection version that was tried. */
|
|
36
|
+
function refusedVersion(error) {
|
|
37
|
+
return error instanceof GrpcError && error.code === 'grpc-reflection-unsupported';
|
|
38
|
+
}
|
|
39
|
+
function asRecord(value) {
|
|
40
|
+
return typeof value === 'object' && value !== null ? value : {};
|
|
41
|
+
}
|
|
42
|
+
/** The `bytes` of a descriptor field, which the codec hands over as base64 per the JSON mapping. */
|
|
43
|
+
function descriptorBytes(value) {
|
|
44
|
+
const list = Array.isArray(value) ? value : [];
|
|
45
|
+
return list
|
|
46
|
+
.filter((entry) => typeof entry === 'string')
|
|
47
|
+
.map((entry) => new Uint8Array(Buffer.from(entry, 'base64')));
|
|
48
|
+
}
|
|
49
|
+
/** One round: every request goes out on one stream, and the responses come back in the same order. */
|
|
50
|
+
async function exchange(input, version, set, requests) {
|
|
51
|
+
const pkg = reflectionPackage(version);
|
|
52
|
+
const exchanged = await sendGrpc({
|
|
53
|
+
...input,
|
|
54
|
+
service: reflectionServiceName(version),
|
|
55
|
+
method: REFLECTION_METHOD,
|
|
56
|
+
messages: requests.map((request) => encodeMessage(set, `${pkg}.ServerReflectionRequest`, request)),
|
|
57
|
+
});
|
|
58
|
+
if (exchanged.status !== 0) {
|
|
59
|
+
const detail = exchanged.statusMessage === undefined ? '' : `: ${exchanged.statusMessage}`;
|
|
60
|
+
throw new GrpcError(exchanged.status === UNIMPLEMENTED ? 'grpc-reflection-unsupported' : 'grpc-reflection-failed', exchanged.status === UNIMPLEMENTED
|
|
61
|
+
? `${input.target} does not serve ${reflectionServiceName(version)}${detail}`
|
|
62
|
+
: `${input.target} answered the reflection call with ${grpcStatusName(exchanged.status)}${detail}`, { details: { status: exchanged.status, version, service: reflectionServiceName(version) } });
|
|
63
|
+
}
|
|
64
|
+
return exchanged.messages.map((bytes) => decodeMessage(set, `${pkg}.ServerReflectionResponse`, bytes));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The `error_response` a server may answer an individual request with, as an error.
|
|
68
|
+
*
|
|
69
|
+
* A reflection error is reported inside the response rather than as the call's status, because one
|
|
70
|
+
* stream carries many requests; `UNIMPLEMENTED` here means the same thing it means in the trailers,
|
|
71
|
+
* so it feeds the version fallback the same way.
|
|
72
|
+
*/
|
|
73
|
+
function assertNoError(response, version, target) {
|
|
74
|
+
const error = response['error_response'];
|
|
75
|
+
if (error === undefined) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const record = asRecord(error);
|
|
79
|
+
const code = Number(record['error_code'] ?? 2);
|
|
80
|
+
const message = typeof record['error_message'] === 'string' ? record['error_message'] : '';
|
|
81
|
+
throw new GrpcError(code === UNIMPLEMENTED ? 'grpc-reflection-unsupported' : 'grpc-reflection-failed', `${target} refused a reflection request with ${grpcStatusName(code)}${message === '' ? '' : `: ${message}`}`, { details: { status: code, version } });
|
|
82
|
+
}
|
|
83
|
+
/** Runs every round against one version. */
|
|
84
|
+
async function reflectWith(input, version) {
|
|
85
|
+
const set = reflectionProtoSet(version);
|
|
86
|
+
const [listed] = await exchange(input, version, set, [{ list_services: '' }]);
|
|
87
|
+
if (listed === undefined) {
|
|
88
|
+
throw new GrpcError('grpc-reflection-failed', `${input.target} answered the service list with no response`, {
|
|
89
|
+
details: { version },
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
assertNoError(asRecord(listed), version, input.target);
|
|
93
|
+
const entries = asRecord(asRecord(listed)['list_services_response'])['service'];
|
|
94
|
+
const services = (Array.isArray(entries) ? entries : [])
|
|
95
|
+
.map((entry) => asRecord(entry)['name'])
|
|
96
|
+
.filter((name) => typeof name === 'string' && name !== '')
|
|
97
|
+
.filter((name) => !isReflectionService(name));
|
|
98
|
+
const files = new Map();
|
|
99
|
+
const roots = [];
|
|
100
|
+
const collect = (response) => {
|
|
101
|
+
const record = asRecord(response);
|
|
102
|
+
assertNoError(record, version, input.target);
|
|
103
|
+
const descriptors = descriptorBytes(asRecord(record['file_descriptor_response'])['file_descriptor_proto']);
|
|
104
|
+
for (const bytes of descriptors) {
|
|
105
|
+
const { name } = descriptorHeader(bytes);
|
|
106
|
+
if (name !== '' && !files.has(name)) {
|
|
107
|
+
files.set(name, bytes);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return descriptors;
|
|
111
|
+
};
|
|
112
|
+
if (services.length > 0) {
|
|
113
|
+
const responses = await exchange(input, version, set, services.map((service) => ({ file_containing_symbol: service })));
|
|
114
|
+
for (const response of responses) {
|
|
115
|
+
// The file declaring the asked-for symbol comes first by convention; the rest are its imports.
|
|
116
|
+
const first = collect(response)[0];
|
|
117
|
+
if (first !== undefined) {
|
|
118
|
+
const { name } = descriptorHeader(first);
|
|
119
|
+
if (name !== '' && !roots.includes(name)) {
|
|
120
|
+
roots.push(name);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const stillMissing = () => {
|
|
126
|
+
const wanted = new Set();
|
|
127
|
+
for (const bytes of files.values()) {
|
|
128
|
+
for (const dependency of descriptorHeader(bytes).dependencies) {
|
|
129
|
+
if (!files.has(dependency)) {
|
|
130
|
+
wanted.add(dependency);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return [...wanted];
|
|
135
|
+
};
|
|
136
|
+
const maxRounds = input.maxRounds ?? DEFAULT_MAX_ROUNDS;
|
|
137
|
+
let missing = stillMissing();
|
|
138
|
+
for (let round = 0; round < maxRounds && missing.length > 0; round += 1) {
|
|
139
|
+
const before = files.size;
|
|
140
|
+
const responses = await exchange(input, version, set, missing.map((name) => ({ file_by_filename: name })));
|
|
141
|
+
for (const response of responses) {
|
|
142
|
+
collect(response);
|
|
143
|
+
}
|
|
144
|
+
if (files.size === before) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
missing = stillMissing();
|
|
148
|
+
}
|
|
149
|
+
return { version, services, files, roots: roots.length > 0 ? roots : [...files.keys()], missing };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Asks a server what it serves.
|
|
153
|
+
*
|
|
154
|
+
* `auto` tries `grpc.reflection.v1` and falls back to `grpc.reflection.v1alpha` when the server
|
|
155
|
+
* refuses it, which is what a server predating the stable package does.
|
|
156
|
+
*
|
|
157
|
+
* @throws HttpError for a connection, DNS, TLS or abort failure; GrpcError
|
|
158
|
+
* `grpc-reflection-unsupported` when the server serves no reflection version this client knows,
|
|
159
|
+
* `grpc-reflection-failed` when it refuses a request; ProtoError `grpc-reflection-descriptor` when
|
|
160
|
+
* a descriptor it sent cannot be read
|
|
161
|
+
*/
|
|
162
|
+
export async function reflectServices(input) {
|
|
163
|
+
const versions = input.version === undefined || input.version === 'auto' ? REFLECTION_VERSIONS : [input.version];
|
|
164
|
+
let refusal;
|
|
165
|
+
for (const version of versions) {
|
|
166
|
+
try {
|
|
167
|
+
return await reflectWith(input, version);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
if (!refusedVersion(error)) {
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
refusal = error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
throw refusal;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Discovers a server's services and resolves them into a loaded schema, which is the form the rest
|
|
180
|
+
* of the gRPC code — `describeServices`, the codec, `apiFromProtoSet` — already reads.
|
|
181
|
+
*
|
|
182
|
+
* @throws as {@link reflectServices}, plus ProtoError `grpc-reflection-incomplete` when the set the
|
|
183
|
+
* server described does not resolve and files it imports are missing from it, and `proto-unresolved`
|
|
184
|
+
* when it does not resolve for any other reason
|
|
185
|
+
*/
|
|
186
|
+
export async function reflectProtoSet(input) {
|
|
187
|
+
const result = await reflectServices(input);
|
|
188
|
+
try {
|
|
189
|
+
return { ...result, set: protoSetFromDescriptors({ files: result.files, roots: result.roots }) };
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (result.missing.length === 0) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
throw new GrpcError('grpc-reflection-incomplete', `${input.target} did not describe ${result.missing.join(', ')}, which the files it did describe import`, { cause: error, details: { missing: [...result.missing], version: result.version } });
|
|
196
|
+
}
|
|
197
|
+
}
|