@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,634 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a project folder back into a {@link Project}.
|
|
3
|
+
*
|
|
4
|
+
* The folder is the source of truth for names and ordering: an interface is a
|
|
5
|
+
* directory containing `interface.yaml`, a request is a `*.request.yaml` plus
|
|
6
|
+
* its sibling `.xml`, and each entity's `slug` comes from its file name. Every
|
|
7
|
+
* recoverable inconsistency (an orphaned envelope, an operation folder no
|
|
8
|
+
* interface declares) becomes a {@link ProjectProblem} rather than an error, so
|
|
9
|
+
* a slightly damaged project still opens.
|
|
10
|
+
*/
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { ProjectError } from '../errors.js';
|
|
13
|
+
import { FORMAT_VERSION } from './model.js';
|
|
14
|
+
import { nodeFs, readFileIfExists, readdirIfExists } from './fs.js';
|
|
15
|
+
import { migrate } from './migrate.js';
|
|
16
|
+
import { normalizeWsa } from '../wsa/model.js';
|
|
17
|
+
import { API_FILE, APIS_DIR, assertPathSegment, ENVIRONMENTS_DIR, FOLDER_FILE, INTERFACES_DIR, MAX_FOLDER_DEPTH, OPERATIONS_DIR, REQUEST_SUFFIX, REQUESTS_DIR, WSS_DIR, } from './paths.js';
|
|
18
|
+
import { apiFileSchema, apiKindOf, assertSupportedKind, grpcApiFileSchema, grpcRequestFileSchema, environmentFileSchema, interfaceFileSchema, keystoresFileSchema, manifestSchema, parseFile, requestFileSchema, restFolderFileSchema, restRequestFileSchema, wsApiFileSchema, wsRequestFileSchema, wssIncomingFileSchema, wssOutgoingFileSchema, } from './schema.js';
|
|
19
|
+
import { KEYSTORES_PATH, MANIFEST_PATH } from './serialize.js';
|
|
20
|
+
import { parseYaml } from './yaml.js';
|
|
21
|
+
function abs(root, relative) {
|
|
22
|
+
return join(root, ...relative.split('/'));
|
|
23
|
+
}
|
|
24
|
+
async function readYaml(fs, root, relative) {
|
|
25
|
+
const buffer = await readFileIfExists(fs, abs(root, relative));
|
|
26
|
+
return buffer === undefined ? undefined : parseYaml(buffer.toString('utf8'), relative);
|
|
27
|
+
}
|
|
28
|
+
/** Orders entities by their persisted `order`, falling back to a stable name comparison. */
|
|
29
|
+
function byOrder(a, b) {
|
|
30
|
+
return a.order - b.order || a.name.localeCompare(b.name);
|
|
31
|
+
}
|
|
32
|
+
function optional(key, value) {
|
|
33
|
+
return value === undefined ? {} : { [key]: value };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Drops `undefined`-valued keys from a zod result, so an absent optional field
|
|
37
|
+
* is truly absent rather than present-and-undefined (`exactOptionalPropertyTypes`).
|
|
38
|
+
*/
|
|
39
|
+
function exact(value) {
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const key of Object.keys(value)) {
|
|
42
|
+
const entry = value[key];
|
|
43
|
+
if (entry !== undefined) {
|
|
44
|
+
out[key] = entry;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
async function loadRequests(fs, root, dir, problems) {
|
|
50
|
+
const requests = [];
|
|
51
|
+
const entries = await readdirIfExists(fs, abs(root, dir));
|
|
52
|
+
const names = new Set(entries.filter((e) => e.isFile).map((e) => e.name));
|
|
53
|
+
for (const entry of [...entries].sort((a, b) => a.name.localeCompare(b.name))) {
|
|
54
|
+
if (!entry.isFile || !entry.name.endsWith(REQUEST_SUFFIX)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const slug = entry.name.slice(0, -REQUEST_SUFFIX.length);
|
|
58
|
+
const relative = `${dir}/${entry.name}`;
|
|
59
|
+
const document = await readYaml(fs, root, relative);
|
|
60
|
+
assertSupportedKind(document, relative);
|
|
61
|
+
const parsed = parseFile(requestFileSchema, document, relative);
|
|
62
|
+
const xmlRelative = `${dir}/${slug}.xml`;
|
|
63
|
+
const envelope = await readFileIfExists(fs, abs(root, xmlRelative));
|
|
64
|
+
if (envelope === undefined) {
|
|
65
|
+
problems.push({
|
|
66
|
+
code: 'missing-envelope',
|
|
67
|
+
message: `Request "${parsed.name}" has no envelope file; loaded with an empty body`,
|
|
68
|
+
file: xmlRelative,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
names.delete(entry.name);
|
|
72
|
+
names.delete(`${slug}.xml`);
|
|
73
|
+
requests.push({
|
|
74
|
+
kind: 'soap',
|
|
75
|
+
id: parsed.id,
|
|
76
|
+
name: parsed.name,
|
|
77
|
+
slug,
|
|
78
|
+
order: parsed.order,
|
|
79
|
+
...optional('description', parsed.description),
|
|
80
|
+
...optional('endpointId', parsed.endpointId),
|
|
81
|
+
...optional('endpointUrl', parsed.endpointUrl),
|
|
82
|
+
soapVersion: parsed.soapVersion,
|
|
83
|
+
...optional('soapAction', parsed.soapAction),
|
|
84
|
+
headers: parsed.headers,
|
|
85
|
+
attachments: parsed.attachments.map((a) => exact(a)),
|
|
86
|
+
...optional('auth', parsed.auth),
|
|
87
|
+
...(parsed.wsa !== undefined ? { wsa: normalizeWsa(parsed.wsa) } : {}),
|
|
88
|
+
...optional('wssOutgoingRef', parsed.wssOutgoingRef),
|
|
89
|
+
...optional('wssIncomingRef', parsed.wssIncomingRef),
|
|
90
|
+
properties: exact(parsed.properties),
|
|
91
|
+
assertions: parsed.assertions.map((a) => exact(a)),
|
|
92
|
+
...(parsed.orphaned === true ? { orphaned: true } : {}),
|
|
93
|
+
envelopeXml: envelope === undefined ? '' : envelope.toString('utf8'),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
for (const orphan of [...names].sort()) {
|
|
97
|
+
problems.push({
|
|
98
|
+
code: 'orphan-request-file',
|
|
99
|
+
message: `"${orphan}" does not belong to any request`,
|
|
100
|
+
file: `${dir}/${orphan}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return requests.sort(byOrder);
|
|
104
|
+
}
|
|
105
|
+
async function loadInterface(fs, root, slug, problems) {
|
|
106
|
+
const relative = `${INTERFACES_DIR}/${slug}/interface.yaml`;
|
|
107
|
+
const document = await readYaml(fs, root, relative);
|
|
108
|
+
if (document === undefined) {
|
|
109
|
+
problems.push({
|
|
110
|
+
code: 'missing-interface-file',
|
|
111
|
+
message: `Folder "${slug}" has no interface.yaml and was skipped`,
|
|
112
|
+
file: relative,
|
|
113
|
+
});
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
assertSupportedKind(document, relative);
|
|
117
|
+
const parsed = parseFile(interfaceFileSchema, document, relative);
|
|
118
|
+
const operationsDir = `${INTERFACES_DIR}/${slug}/${OPERATIONS_DIR}`;
|
|
119
|
+
const folders = new Set((await readdirIfExists(fs, abs(root, operationsDir))).filter((e) => e.isDirectory).map((e) => e.name));
|
|
120
|
+
const operations = [];
|
|
121
|
+
for (const entry of parsed.operations) {
|
|
122
|
+
folders.delete(entry.slug);
|
|
123
|
+
operations.push({
|
|
124
|
+
name: entry.name,
|
|
125
|
+
bindingName: entry.bindingName,
|
|
126
|
+
slug: entry.slug,
|
|
127
|
+
order: entry.order,
|
|
128
|
+
requests: await loadRequests(fs, root, `${operationsDir}/${entry.slug}`, problems),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
for (const orphan of [...folders].sort()) {
|
|
132
|
+
problems.push({
|
|
133
|
+
code: 'orphan-operation-folder',
|
|
134
|
+
message: `Operation folder "${orphan}" is not listed in interface.yaml`,
|
|
135
|
+
file: `${operationsDir}/${orphan}`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const endpoints = parsed.endpoints.map((e) => ({
|
|
139
|
+
id: e.id,
|
|
140
|
+
name: e.name,
|
|
141
|
+
url: e.url,
|
|
142
|
+
...optional('auth', e.auth),
|
|
143
|
+
authMode: e.authMode,
|
|
144
|
+
}));
|
|
145
|
+
return {
|
|
146
|
+
kind: 'soap',
|
|
147
|
+
id: parsed.id,
|
|
148
|
+
name: parsed.name,
|
|
149
|
+
slug,
|
|
150
|
+
order: parsed.order,
|
|
151
|
+
definitionUrl: parsed.definitionUrl,
|
|
152
|
+
cacheDefinition: parsed.cacheDefinition,
|
|
153
|
+
...optional('targetNamespace', parsed.targetNamespace),
|
|
154
|
+
endpoints,
|
|
155
|
+
...optional('defaultEndpointId', parsed.defaultEndpointId),
|
|
156
|
+
wsa: normalizeWsa(parsed.wsa),
|
|
157
|
+
...optional('auth', parsed.auth),
|
|
158
|
+
operations: operations.sort(byOrder),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Authentication as loaded: the same `undefined`-key drop {@link exact} performs, expressed
|
|
163
|
+
* separately because `AuthConfig` is a union and so has no single mapped shape to hand `exact`.
|
|
164
|
+
* The cast is safe for the same reason `exact`'s is: the schema has already established the
|
|
165
|
+
* arm's own fields, and this only removes keys whose value is absent.
|
|
166
|
+
*/
|
|
167
|
+
function authConfig(parsed) {
|
|
168
|
+
const out = {};
|
|
169
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
170
|
+
if (value !== undefined) {
|
|
171
|
+
out[key] = value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
/** A table row as loaded: `enabled` defaults to true, an absent description stays absent. */
|
|
177
|
+
function keyValueEntries(rows) {
|
|
178
|
+
return rows.map((row) => exact({ name: row.name, value: row.value, enabled: row.enabled, description: row.description }));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* One request body as loaded. A raw body's text lives in a sibling file, so it is read here and
|
|
182
|
+
* the file name is dropped: the model holds the text, the layout holds the name
|
|
183
|
+
* (`project/paths.ts` rebuilds it on save from the language).
|
|
184
|
+
*/
|
|
185
|
+
async function loadBody(fs, root, dir, document, requestName, problems) {
|
|
186
|
+
switch (document.kind) {
|
|
187
|
+
case 'raw': {
|
|
188
|
+
const relative = `${dir}/${document.file}`;
|
|
189
|
+
const text = await readFileIfExists(fs, abs(root, relative));
|
|
190
|
+
if (text === undefined) {
|
|
191
|
+
problems.push({
|
|
192
|
+
code: 'missing-body',
|
|
193
|
+
message: `Request "${requestName}" has no body file; loaded with an empty body`,
|
|
194
|
+
file: relative,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
kind: 'raw',
|
|
199
|
+
language: document.language,
|
|
200
|
+
...optional('contentType', document.contentType),
|
|
201
|
+
text: text === undefined ? '' : text.toString('utf8'),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
case 'form':
|
|
205
|
+
return { kind: 'form', fields: keyValueEntries(document.fields) };
|
|
206
|
+
case 'multipart':
|
|
207
|
+
return {
|
|
208
|
+
kind: 'multipart',
|
|
209
|
+
parts: document.parts.map((part) => part.kind === 'text'
|
|
210
|
+
? exact({ ...part, kind: 'text' })
|
|
211
|
+
: exact({ ...part, kind: 'file' })),
|
|
212
|
+
};
|
|
213
|
+
case 'binary':
|
|
214
|
+
return { kind: 'binary', source: document.source, contentType: document.contentType };
|
|
215
|
+
default:
|
|
216
|
+
return { kind: 'none' };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/** Reads a REST request and its raw body file. */
|
|
220
|
+
function restRequestReader(fs, root, problems) {
|
|
221
|
+
return async (dir, fileName, unclaimed) => {
|
|
222
|
+
const relative = `${dir}/${fileName}`;
|
|
223
|
+
const document = await readYaml(fs, root, relative);
|
|
224
|
+
assertSupportedKind(document, relative);
|
|
225
|
+
const parsed = parseFile(restRequestFileSchema, document, relative);
|
|
226
|
+
unclaimed.delete(fileName);
|
|
227
|
+
if (parsed.body.kind === 'raw') {
|
|
228
|
+
unclaimed.delete(parsed.body.file);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
kind: 'rest',
|
|
232
|
+
id: parsed.id,
|
|
233
|
+
name: parsed.name,
|
|
234
|
+
slug: fileName.slice(0, -REQUEST_SUFFIX.length),
|
|
235
|
+
order: parsed.order,
|
|
236
|
+
...optional('description', parsed.description),
|
|
237
|
+
method: parsed.method,
|
|
238
|
+
url: parsed.url,
|
|
239
|
+
pathParams: keyValueEntries(parsed.pathParams),
|
|
240
|
+
query: keyValueEntries(parsed.query),
|
|
241
|
+
headers: keyValueEntries(parsed.headers),
|
|
242
|
+
body: await loadBody(fs, root, dir, parsed.body, parsed.name, problems),
|
|
243
|
+
auth: authConfig(parsed.auth),
|
|
244
|
+
settings: exact(parsed.settings),
|
|
245
|
+
assertions: parsed.assertions.map((a) => exact(a)),
|
|
246
|
+
...(parsed.orphaned === true ? { orphaned: true } : {}),
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Reads a gRPC request and its message file. A request whose message file is gone loads with an
|
|
252
|
+
* empty message and a `missing-body` problem, exactly as a REST raw body does.
|
|
253
|
+
*/
|
|
254
|
+
function grpcRequestReader(fs, root, problems) {
|
|
255
|
+
return async (dir, fileName, unclaimed) => {
|
|
256
|
+
const relative = `${dir}/${fileName}`;
|
|
257
|
+
const document = await readYaml(fs, root, relative);
|
|
258
|
+
assertSupportedKind(document, relative);
|
|
259
|
+
const parsed = parseFile(grpcRequestFileSchema, document, relative);
|
|
260
|
+
unclaimed.delete(fileName);
|
|
261
|
+
let message = '';
|
|
262
|
+
if (parsed.message !== undefined) {
|
|
263
|
+
unclaimed.delete(parsed.message);
|
|
264
|
+
const messageRelative = `${dir}/${parsed.message}`;
|
|
265
|
+
const text = await readFileIfExists(fs, abs(root, messageRelative));
|
|
266
|
+
if (text === undefined) {
|
|
267
|
+
problems.push({
|
|
268
|
+
code: 'missing-body',
|
|
269
|
+
message: `Request "${parsed.name}" has no message file; loaded with an empty message`,
|
|
270
|
+
file: messageRelative,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
message = text.toString('utf8');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
kind: 'grpc',
|
|
279
|
+
id: parsed.id,
|
|
280
|
+
name: parsed.name,
|
|
281
|
+
slug: fileName.slice(0, -REQUEST_SUFFIX.length),
|
|
282
|
+
order: parsed.order,
|
|
283
|
+
...optional('description', parsed.description),
|
|
284
|
+
service: parsed.service,
|
|
285
|
+
method: parsed.method,
|
|
286
|
+
methodKind: parsed.methodKind,
|
|
287
|
+
metadata: keyValueEntries(parsed.metadata),
|
|
288
|
+
message,
|
|
289
|
+
auth: authConfig(parsed.auth),
|
|
290
|
+
settings: exact(parsed.settings),
|
|
291
|
+
...(parsed.orphaned === true ? { orphaned: true } : {}),
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Reads a WebSocket request and its saved messages, each in its own sibling file. A message whose
|
|
297
|
+
* file is gone loads with empty content and a `missing-body` problem, exactly as a gRPC message
|
|
298
|
+
* does; its slug is recovered from the file name between the `.msg-` marker and the extension.
|
|
299
|
+
*/
|
|
300
|
+
function wsRequestReader(fs, root, problems) {
|
|
301
|
+
return async (dir, fileName, unclaimed) => {
|
|
302
|
+
const relative = `${dir}/${fileName}`;
|
|
303
|
+
const document = await readYaml(fs, root, relative);
|
|
304
|
+
assertSupportedKind(document, relative);
|
|
305
|
+
const parsed = parseFile(wsRequestFileSchema, document, relative);
|
|
306
|
+
unclaimed.delete(fileName);
|
|
307
|
+
const requestSlug = fileName.slice(0, -REQUEST_SUFFIX.length);
|
|
308
|
+
const messages = [];
|
|
309
|
+
for (const entry of parsed.messages) {
|
|
310
|
+
assertPathSegment(entry.file);
|
|
311
|
+
unclaimed.delete(entry.file);
|
|
312
|
+
const messageRelative = `${dir}/${entry.file}`;
|
|
313
|
+
const text = await readFileIfExists(fs, abs(root, messageRelative));
|
|
314
|
+
if (text === undefined) {
|
|
315
|
+
problems.push({
|
|
316
|
+
code: 'missing-body',
|
|
317
|
+
message: `Request "${parsed.name}" has no message file; loaded with an empty message`,
|
|
318
|
+
file: messageRelative,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
const slug = entry.file.slice(`${requestSlug}.msg-`.length, entry.file.lastIndexOf('.'));
|
|
322
|
+
messages.push({
|
|
323
|
+
id: entry.id,
|
|
324
|
+
name: entry.name,
|
|
325
|
+
slug,
|
|
326
|
+
format: entry.format,
|
|
327
|
+
content: text === undefined ? '' : text.toString('utf8'),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
kind: 'websocket',
|
|
332
|
+
id: parsed.id,
|
|
333
|
+
name: parsed.name,
|
|
334
|
+
slug: requestSlug,
|
|
335
|
+
order: parsed.order,
|
|
336
|
+
...optional('description', parsed.description),
|
|
337
|
+
url: parsed.url,
|
|
338
|
+
query: keyValueEntries(parsed.query),
|
|
339
|
+
headers: keyValueEntries(parsed.headers),
|
|
340
|
+
subprotocols: parsed.subprotocols,
|
|
341
|
+
auth: authConfig(parsed.auth),
|
|
342
|
+
settings: exact(parsed.settings),
|
|
343
|
+
messages,
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Loads one directory of an API's request tree: its `*.request.yaml` files as requests (through
|
|
349
|
+
* the protocol's reader), its subdirectories as folders, recursively.
|
|
350
|
+
*
|
|
351
|
+
* A directory with no `folder.yaml` is still a folder — named after the directory, ordered after
|
|
352
|
+
* the ones that do have a file, and given a file of its own on the next save — because a folder
|
|
353
|
+
* someone created with `mkdir` in a checked-out project is a folder, not a fault. A directory
|
|
354
|
+
* deeper than {@link MAX_FOLDER_DEPTH} becomes a problem and is skipped whole, so nothing is ever
|
|
355
|
+
* written to a path that might not open on Windows.
|
|
356
|
+
*/
|
|
357
|
+
async function loadFolderContents(fs, root, dir, depth, problems, readRequest) {
|
|
358
|
+
const entries = await readdirIfExists(fs, abs(root, dir));
|
|
359
|
+
const unclaimed = new Set(entries.filter((e) => e.isFile && e.name !== FOLDER_FILE).map((e) => e.name));
|
|
360
|
+
const requests = [];
|
|
361
|
+
const folders = [];
|
|
362
|
+
for (const entry of [...entries].sort((a, b) => a.name.localeCompare(b.name))) {
|
|
363
|
+
if (entry.isFile && entry.name.endsWith(REQUEST_SUFFIX)) {
|
|
364
|
+
requests.push(await readRequest(dir, entry.name, unclaimed));
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (!entry.isDirectory) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
const childDir = `${dir}/${entry.name}`;
|
|
371
|
+
if (depth + 1 > MAX_FOLDER_DEPTH) {
|
|
372
|
+
problems.push({
|
|
373
|
+
code: 'folder-too-deep',
|
|
374
|
+
message: `Folder "${entry.name}" is nested more than ${String(MAX_FOLDER_DEPTH)} deep and was skipped`,
|
|
375
|
+
file: childDir,
|
|
376
|
+
});
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const contents = await loadFolderContents(fs, root, childDir, depth + 1, problems, readRequest);
|
|
380
|
+
const relative = `${childDir}/${FOLDER_FILE}`;
|
|
381
|
+
const document = await readYaml(fs, root, relative);
|
|
382
|
+
const parsed = document === undefined ? undefined : parseFile(restFolderFileSchema, document, relative);
|
|
383
|
+
folders.push({
|
|
384
|
+
id: parsed?.id ?? `folder:${entry.name}`,
|
|
385
|
+
name: parsed?.name ?? entry.name,
|
|
386
|
+
slug: entry.name,
|
|
387
|
+
order: parsed?.order ?? Number.MAX_SAFE_INTEGER,
|
|
388
|
+
...optional('description', parsed?.description),
|
|
389
|
+
...(parsed?.auth !== undefined ? { auth: authConfig(parsed.auth) } : {}),
|
|
390
|
+
folders: contents.folders,
|
|
391
|
+
requests: contents.requests,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
for (const orphan of [...unclaimed].sort()) {
|
|
395
|
+
problems.push({
|
|
396
|
+
code: 'orphan-request-file',
|
|
397
|
+
message: `"${orphan}" does not belong to any request`,
|
|
398
|
+
file: `${dir}/${orphan}`,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return { folders: folders.sort(byOrder), requests: requests.sort(byOrder) };
|
|
402
|
+
}
|
|
403
|
+
/** Loads one `apis/<slug>/` directory, or records a problem and returns nothing. */
|
|
404
|
+
async function loadApi(fs, root, slug, problems) {
|
|
405
|
+
const relative = `${APIS_DIR}/${slug}/${API_FILE}`;
|
|
406
|
+
const document = await readYaml(fs, root, relative);
|
|
407
|
+
if (document === undefined) {
|
|
408
|
+
problems.push({
|
|
409
|
+
code: 'missing-api-file',
|
|
410
|
+
message: `Folder "${slug}" has no ${API_FILE} and was skipped`,
|
|
411
|
+
file: relative,
|
|
412
|
+
});
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
assertSupportedKind(document, relative);
|
|
416
|
+
const requestsDir = `${APIS_DIR}/${slug}/${REQUESTS_DIR}`;
|
|
417
|
+
switch (apiKindOf(document)) {
|
|
418
|
+
case 'grpc': {
|
|
419
|
+
const parsed = parseFile(grpcApiFileSchema, document, relative);
|
|
420
|
+
const contents = await loadFolderContents(fs, root, requestsDir, 0, problems, grpcRequestReader(fs, root, problems));
|
|
421
|
+
return {
|
|
422
|
+
kind: 'grpc',
|
|
423
|
+
api: {
|
|
424
|
+
kind: 'grpc',
|
|
425
|
+
id: parsed.id,
|
|
426
|
+
name: parsed.name,
|
|
427
|
+
slug,
|
|
428
|
+
order: parsed.order,
|
|
429
|
+
...optional('description', parsed.description),
|
|
430
|
+
target: parsed.target,
|
|
431
|
+
tls: parsed.tls,
|
|
432
|
+
metadata: keyValueEntries(parsed.metadata),
|
|
433
|
+
...(parsed.auth !== undefined ? { auth: authConfig(parsed.auth) } : {}),
|
|
434
|
+
...(parsed.definition !== undefined
|
|
435
|
+
? {
|
|
436
|
+
definition: {
|
|
437
|
+
kind: parsed.definition.kind,
|
|
438
|
+
source: parsed.definition.source,
|
|
439
|
+
cache: parsed.definition.cache,
|
|
440
|
+
roots: parsed.definition.roots,
|
|
441
|
+
...optional('reflectionVersion', parsed.definition.reflectionVersion),
|
|
442
|
+
...optional('trustInvalid', parsed.definition.trustInvalid),
|
|
443
|
+
},
|
|
444
|
+
}
|
|
445
|
+
: {}),
|
|
446
|
+
folders: contents.folders,
|
|
447
|
+
requests: contents.requests,
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
case 'websocket': {
|
|
452
|
+
const parsed = parseFile(wsApiFileSchema, document, relative);
|
|
453
|
+
const contents = await loadFolderContents(fs, root, requestsDir, 0, problems, wsRequestReader(fs, root, problems));
|
|
454
|
+
return {
|
|
455
|
+
kind: 'websocket',
|
|
456
|
+
api: {
|
|
457
|
+
kind: 'websocket',
|
|
458
|
+
id: parsed.id,
|
|
459
|
+
name: parsed.name,
|
|
460
|
+
slug,
|
|
461
|
+
order: parsed.order,
|
|
462
|
+
...optional('description', parsed.description),
|
|
463
|
+
url: parsed.url,
|
|
464
|
+
headers: keyValueEntries(parsed.headers),
|
|
465
|
+
...(parsed.auth !== undefined ? { auth: authConfig(parsed.auth) } : {}),
|
|
466
|
+
...(parsed.definition !== undefined
|
|
467
|
+
? {
|
|
468
|
+
definition: {
|
|
469
|
+
kind: parsed.definition.kind,
|
|
470
|
+
source: parsed.definition.source,
|
|
471
|
+
cache: parsed.definition.cache,
|
|
472
|
+
},
|
|
473
|
+
}
|
|
474
|
+
: {}),
|
|
475
|
+
folders: contents.folders,
|
|
476
|
+
requests: contents.requests,
|
|
477
|
+
},
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
default: {
|
|
481
|
+
const parsed = parseFile(apiFileSchema, document, relative);
|
|
482
|
+
const contents = await loadFolderContents(fs, root, requestsDir, 0, problems, restRequestReader(fs, root, problems));
|
|
483
|
+
return {
|
|
484
|
+
kind: 'rest',
|
|
485
|
+
api: {
|
|
486
|
+
kind: 'rest',
|
|
487
|
+
id: parsed.id,
|
|
488
|
+
name: parsed.name,
|
|
489
|
+
slug,
|
|
490
|
+
order: parsed.order,
|
|
491
|
+
...optional('description', parsed.description),
|
|
492
|
+
baseUrl: parsed.baseUrl,
|
|
493
|
+
servers: parsed.servers.map((server) => exact(server)),
|
|
494
|
+
...(parsed.auth !== undefined ? { auth: authConfig(parsed.auth) } : {}),
|
|
495
|
+
...(parsed.definition !== undefined
|
|
496
|
+
? {
|
|
497
|
+
definition: {
|
|
498
|
+
source: parsed.definition.source,
|
|
499
|
+
cache: parsed.definition.cache,
|
|
500
|
+
version: parsed.definition.version,
|
|
501
|
+
},
|
|
502
|
+
}
|
|
503
|
+
: {}),
|
|
504
|
+
folders: contents.folders,
|
|
505
|
+
requests: contents.requests,
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
async function loadEnvironments(fs, root) {
|
|
512
|
+
const environments = [];
|
|
513
|
+
for (const entry of await readdirIfExists(fs, abs(root, ENVIRONMENTS_DIR))) {
|
|
514
|
+
if (!entry.isFile || !entry.name.endsWith('.yaml')) {
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
const relative = `${ENVIRONMENTS_DIR}/${entry.name}`;
|
|
518
|
+
const parsed = parseFile(environmentFileSchema, await readYaml(fs, root, relative), relative);
|
|
519
|
+
environments.push({
|
|
520
|
+
id: parsed.id,
|
|
521
|
+
name: parsed.name,
|
|
522
|
+
slug: entry.name.slice(0, -'.yaml'.length),
|
|
523
|
+
order: parsed.order,
|
|
524
|
+
endpoints: parsed.endpoints,
|
|
525
|
+
properties: parsed.properties,
|
|
526
|
+
disabledProperties: parsed.disabled ?? [],
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
return environments.sort(byOrder);
|
|
530
|
+
}
|
|
531
|
+
async function loadWssRefs(fs, root, direction) {
|
|
532
|
+
const dir = `${WSS_DIR}/${direction}`;
|
|
533
|
+
const schema = direction === 'outgoing' ? wssOutgoingFileSchema : wssIncomingFileSchema;
|
|
534
|
+
const refs = [];
|
|
535
|
+
for (const entry of await readdirIfExists(fs, abs(root, dir))) {
|
|
536
|
+
if (!entry.isFile || !entry.name.endsWith('.yaml')) {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
const relative = `${dir}/${entry.name}`;
|
|
540
|
+
const parsed = parseFile(schema, await readYaml(fs, root, relative), relative);
|
|
541
|
+
refs.push({ id: parsed.id, name: parsed.name, file: relative, document: parsed });
|
|
542
|
+
}
|
|
543
|
+
return refs.sort((a, b) => a.name.localeCompare(b.name));
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Loads the project stored in the directory `root`.
|
|
547
|
+
*
|
|
548
|
+
* @throws ProjectError `project-not-found` when there is no `wirebench.yaml`,
|
|
549
|
+
* `project-format-too-new` for a newer format version, `project-file-invalid`
|
|
550
|
+
* for malformed or schema-violating YAML (with the offending file in `details`).
|
|
551
|
+
*/
|
|
552
|
+
export async function loadProject(root, options) {
|
|
553
|
+
const fs = options?.fs ?? nodeFs;
|
|
554
|
+
const manifestDocument = await readYaml(fs, root, MANIFEST_PATH);
|
|
555
|
+
if (manifestDocument === undefined) {
|
|
556
|
+
throw new ProjectError('project-not-found', `No ${MANIFEST_PATH} in ${root}`, {
|
|
557
|
+
details: { file: MANIFEST_PATH, root },
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
const manifest = parseFile(manifestSchema, migrate(manifestDocument, MANIFEST_PATH), MANIFEST_PATH);
|
|
561
|
+
const problems = [];
|
|
562
|
+
const interfaces = [];
|
|
563
|
+
for (const entry of await readdirIfExists(fs, abs(root, INTERFACES_DIR))) {
|
|
564
|
+
if (!entry.isDirectory) {
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
const iface = await loadInterface(fs, root, entry.name, problems);
|
|
568
|
+
if (iface !== undefined) {
|
|
569
|
+
interfaces.push(iface);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
const interfaceSlugs = new Set(interfaces.map((iface) => iface.slug.toLowerCase()));
|
|
573
|
+
const apis = [];
|
|
574
|
+
const grpcApis = [];
|
|
575
|
+
const wsApis = [];
|
|
576
|
+
for (const entry of await readdirIfExists(fs, abs(root, APIS_DIR))) {
|
|
577
|
+
if (!entry.isDirectory) {
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
const loaded = await loadApi(fs, root, entry.name, problems);
|
|
581
|
+
if (loaded === undefined) {
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
// An environment's endpoint overrides are keyed by slug, so two entities sharing one would
|
|
585
|
+
// make the override ambiguous. The folders never collide; the override key would. REST and
|
|
586
|
+
// gRPC APIs share one directory, so their slugs cannot collide with each other.
|
|
587
|
+
if (interfaceSlugs.has(loaded.api.slug.toLowerCase())) {
|
|
588
|
+
problems.push({
|
|
589
|
+
code: 'api-slug-conflict',
|
|
590
|
+
message: `API "${loaded.api.name}" and an interface share the slug "${loaded.api.slug}"; the API was skipped`,
|
|
591
|
+
file: `${APIS_DIR}/${loaded.api.slug}/${API_FILE}`,
|
|
592
|
+
});
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (loaded.kind === 'grpc') {
|
|
596
|
+
grpcApis.push(loaded.api);
|
|
597
|
+
}
|
|
598
|
+
else if (loaded.kind === 'websocket') {
|
|
599
|
+
wsApis.push(loaded.api);
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
apis.push(loaded.api);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const keystoresDocument = await readYaml(fs, root, KEYSTORES_PATH);
|
|
606
|
+
const keystores = keystoresDocument === undefined
|
|
607
|
+
? []
|
|
608
|
+
: parseFile(keystoresFileSchema, keystoresDocument, KEYSTORES_PATH).keystores.map((k) => ({
|
|
609
|
+
id: k.id,
|
|
610
|
+
name: k.name,
|
|
611
|
+
document: k,
|
|
612
|
+
}));
|
|
613
|
+
const project = {
|
|
614
|
+
formatVersion: FORMAT_VERSION,
|
|
615
|
+
id: manifest.id,
|
|
616
|
+
name: manifest.name,
|
|
617
|
+
...optional('description', manifest.description),
|
|
618
|
+
settings: exact(manifest.settings),
|
|
619
|
+
properties: manifest.properties,
|
|
620
|
+
disabledProperties: manifest.disabled ?? [],
|
|
621
|
+
...optional('activeEnvironmentId', manifest.activeEnvironmentId),
|
|
622
|
+
interfaces: interfaces.sort(byOrder),
|
|
623
|
+
apis: apis.sort(byOrder),
|
|
624
|
+
grpcApis: grpcApis.sort(byOrder),
|
|
625
|
+
wsApis: wsApis.sort(byOrder),
|
|
626
|
+
environments: await loadEnvironments(fs, root),
|
|
627
|
+
wss: {
|
|
628
|
+
outgoing: await loadWssRefs(fs, root, 'outgoing'),
|
|
629
|
+
incoming: await loadWssRefs(fs, root, 'incoming'),
|
|
630
|
+
keystores,
|
|
631
|
+
},
|
|
632
|
+
};
|
|
633
|
+
return { project, problems };
|
|
634
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format-version handling for project folders.
|
|
3
|
+
*
|
|
4
|
+
* `formatVersion` is bumped only on breaking changes. Opening a project written
|
|
5
|
+
* by a newer Wirebench must fail loudly rather than silently dropping the parts
|
|
6
|
+
* this build does not understand.
|
|
7
|
+
*/
|
|
8
|
+
/** A raw manifest document, before schema validation. */
|
|
9
|
+
type RawManifest = Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Brings a raw manifest document up to {@link FORMAT_VERSION}.
|
|
12
|
+
*
|
|
13
|
+
* Version 1 needs no rewrite of its own: it simply has no `disabled` key, and
|
|
14
|
+
* `load.ts` defaults a missing list to empty. This function's job is narrower
|
|
15
|
+
* — validate the version is in `[1, FORMAT_VERSION]` and stamp the document
|
|
16
|
+
* with the current `formatVersion` so schema validation (which pins
|
|
17
|
+
* `formatVersion` to a literal) accepts a document written by an older build.
|
|
18
|
+
* The next save then writes the file back at the current version. Versions
|
|
19
|
+
* 2 → 3 → 4 are the same kind of step: fields an older file simply lacks,
|
|
20
|
+
* which the loader defaults.
|
|
21
|
+
*
|
|
22
|
+
* @throws ProjectError `project-format-too-new` when the file was written by a
|
|
23
|
+
* newer Wirebench, `project-file-invalid` when `formatVersion` is missing,
|
|
24
|
+
* not a number, or below 1.
|
|
25
|
+
*/
|
|
26
|
+
export declare function migrate(document: unknown, file: string): RawManifest;
|
|
27
|
+
export {};
|