@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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a {@link Project} into the exact set of files it occupies on disk.
|
|
3
|
+
*
|
|
4
|
+
* Keeping this pure (project in, `relative path -> file content` out) means the
|
|
5
|
+
* saver only has to diff two maps, and tests can assert on the layout without
|
|
6
|
+
* touching a file system.
|
|
7
|
+
*/
|
|
8
|
+
import type { AuthConfig, Project, WssRef } from './model.js';
|
|
9
|
+
/** A project's files, keyed by path relative to the project root (always `/`-separated). */
|
|
10
|
+
export type ProjectFiles = ReadonlyMap<string, string>;
|
|
11
|
+
/** Relative path of the manifest. */
|
|
12
|
+
export declare const MANIFEST_PATH = "wirebench.yaml";
|
|
13
|
+
/** Relative path of the keystore registry. */
|
|
14
|
+
export declare const KEYSTORES_PATH = "wss/keystores.yaml";
|
|
15
|
+
/**
|
|
16
|
+
* One authentication configuration as written: its own fields only, in the schema's spelling,
|
|
17
|
+
* with absent optionals and an empty scope list dropped. Every scheme's secret is a reference,
|
|
18
|
+
* so there is nothing here to redact — the values live in the keychain (ADR-0004).
|
|
19
|
+
*/
|
|
20
|
+
export declare function authDocument(auth: AuthConfig): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Relative path of a WS-Security configuration file.
|
|
23
|
+
*
|
|
24
|
+
* @throws ProjectError `project-path-invalid` when `ref.file` is not a
|
|
25
|
+
* relative path rooted at `wss/` with only safe segments.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wssRefPath(direction: 'outgoing' | 'incoming', ref: WssRef): string;
|
|
28
|
+
/** Options for {@link projectFiles}. */
|
|
29
|
+
export interface ProjectFilesOptions {
|
|
30
|
+
/** Recorded in the manifest as `writtenBy`. Defaults to `'wirebench'`. */
|
|
31
|
+
readonly writer?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds the complete `relative path -> content` map for a project.
|
|
35
|
+
*
|
|
36
|
+
* Every slug is validated with {@link assertPathSegment} (and every
|
|
37
|
+
* `WssRef.file` with {@link assertWssRelativePath}) before any path is built,
|
|
38
|
+
* so a corrupted slug or an unvalidated file reference throws
|
|
39
|
+
* `ProjectError('project-path-invalid')` here — before `saveProject` ever
|
|
40
|
+
* touches the file system.
|
|
41
|
+
*/
|
|
42
|
+
export declare function projectFiles(project: Project, options?: ProjectFilesOptions): ProjectFiles;
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a {@link Project} into the exact set of files it occupies on disk.
|
|
3
|
+
*
|
|
4
|
+
* Keeping this pure (project in, `relative path -> file content` out) means the
|
|
5
|
+
* saver only has to diff two maps, and tests can assert on the layout without
|
|
6
|
+
* touching a file system.
|
|
7
|
+
*/
|
|
8
|
+
import { ProjectError } from '../errors.js';
|
|
9
|
+
import { wsMessageFileName } from '../ws/model.js';
|
|
10
|
+
import { RAW_LANGUAGE_EXTENSIONS } from '../rest/model.js';
|
|
11
|
+
import { API_FILE, APIS_DIR, assertPathSegment, assertWssRelativePath, ENVIRONMENTS_DIR, FOLDER_FILE, INTERFACES_DIR, MAX_FOLDER_DEPTH, OPERATIONS_DIR, REQUEST_SUFFIX, REQUESTS_DIR, restBodyFileName, WSS_DIR, slugify, } from './paths.js';
|
|
12
|
+
import { compact, stringifyYaml } from './yaml.js';
|
|
13
|
+
/** Relative path of the manifest. */
|
|
14
|
+
export const MANIFEST_PATH = 'wirebench.yaml';
|
|
15
|
+
/** Relative path of the keystore registry. */
|
|
16
|
+
export const KEYSTORES_PATH = `${WSS_DIR}/keystores.yaml`;
|
|
17
|
+
/**
|
|
18
|
+
* The `disabled` list as written: sorted, deduplicated, and dropped entirely once it would be
|
|
19
|
+
* empty — a name with no entry left in `properties` never outlives its map, so it is filtered
|
|
20
|
+
* out here rather than merely sorted.
|
|
21
|
+
*/
|
|
22
|
+
function disabledList(disabled, properties) {
|
|
23
|
+
const known = new Set(Object.keys(properties));
|
|
24
|
+
const kept = [...new Set(disabled.filter((name) => known.has(name)))].sort();
|
|
25
|
+
return kept.length > 0 ? kept : undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One authentication configuration as written: its own fields only, in the schema's spelling,
|
|
29
|
+
* with absent optionals and an empty scope list dropped. Every scheme's secret is a reference,
|
|
30
|
+
* so there is nothing here to redact — the values live in the keychain (ADR-0004).
|
|
31
|
+
*/
|
|
32
|
+
export function authDocument(auth) {
|
|
33
|
+
if (auth.type === 'oauth2') {
|
|
34
|
+
return compact({ ...auth, scopes: auth.scopes.length > 0 ? [...auth.scopes] : undefined });
|
|
35
|
+
}
|
|
36
|
+
return compact({ ...auth });
|
|
37
|
+
}
|
|
38
|
+
function requestDocument(request) {
|
|
39
|
+
return compact({
|
|
40
|
+
kind: request.kind,
|
|
41
|
+
id: request.id,
|
|
42
|
+
name: request.name,
|
|
43
|
+
order: request.order,
|
|
44
|
+
description: request.description,
|
|
45
|
+
endpointId: request.endpointId,
|
|
46
|
+
endpointUrl: request.endpointUrl,
|
|
47
|
+
soapVersion: request.soapVersion,
|
|
48
|
+
soapAction: request.soapAction,
|
|
49
|
+
headers: request.headers.map((h) => ({ name: h.name, value: h.value })),
|
|
50
|
+
attachments: request.attachments.map((a) => compact({ ...a })),
|
|
51
|
+
auth: request.auth === undefined ? undefined : authDocument(request.auth),
|
|
52
|
+
wsa: request.wsa === undefined ? undefined : compact({ ...request.wsa }),
|
|
53
|
+
wssOutgoingRef: request.wssOutgoingRef,
|
|
54
|
+
wssIncomingRef: request.wssIncomingRef,
|
|
55
|
+
properties: compact({ ...request.properties }),
|
|
56
|
+
assertions: request.assertions.length > 0 ? request.assertions.map((a) => compact({ ...a })) : undefined,
|
|
57
|
+
orphaned: request.orphaned === true ? true : undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function interfaceDocument(iface) {
|
|
61
|
+
return compact({
|
|
62
|
+
kind: iface.kind,
|
|
63
|
+
id: iface.id,
|
|
64
|
+
name: iface.name,
|
|
65
|
+
order: iface.order,
|
|
66
|
+
definitionUrl: iface.definitionUrl,
|
|
67
|
+
cacheDefinition: iface.cacheDefinition,
|
|
68
|
+
targetNamespace: iface.targetNamespace,
|
|
69
|
+
endpoints: iface.endpoints.map((e) => compact({ ...e, auth: e.auth === undefined ? undefined : authDocument(e.auth) })),
|
|
70
|
+
defaultEndpointId: iface.defaultEndpointId,
|
|
71
|
+
wsa: compact({ ...iface.wsa }),
|
|
72
|
+
auth: iface.auth === undefined ? undefined : authDocument(iface.auth),
|
|
73
|
+
operations: iface.operations.map((op) => ({
|
|
74
|
+
name: op.name,
|
|
75
|
+
bindingName: op.bindingName,
|
|
76
|
+
slug: op.slug,
|
|
77
|
+
order: op.order,
|
|
78
|
+
})),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** One table row as written: `enabled` only when `false`, so a file stays quiet about the default. */
|
|
82
|
+
function keyValueDocuments(rows) {
|
|
83
|
+
return rows.map((row) => compact({
|
|
84
|
+
name: row.name,
|
|
85
|
+
value: row.value,
|
|
86
|
+
enabled: row.enabled ? undefined : false,
|
|
87
|
+
description: row.description,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A body as written, plus the sibling file a raw body needs.
|
|
92
|
+
*
|
|
93
|
+
* The text of a raw body is deliberately *not* in the request document: it goes to
|
|
94
|
+
* `<slug>.body.<ext>` beside it, so a JSON payload is a JSON file in git — reviewable, searchable
|
|
95
|
+
* and mergeable — rather than a quoted blob inside YAML.
|
|
96
|
+
*/
|
|
97
|
+
function bodyDocument(body, requestSlug) {
|
|
98
|
+
switch (body.kind) {
|
|
99
|
+
case 'raw': {
|
|
100
|
+
const name = restBodyFileName(requestSlug, RAW_LANGUAGE_EXTENSIONS[body.language]);
|
|
101
|
+
assertPathSegment(name);
|
|
102
|
+
return {
|
|
103
|
+
document: compact({ kind: 'raw', language: body.language, contentType: body.contentType, file: name }),
|
|
104
|
+
file: [name, body.text],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
case 'form':
|
|
108
|
+
return { document: { kind: 'form', fields: keyValueDocuments(body.fields) } };
|
|
109
|
+
case 'multipart':
|
|
110
|
+
return {
|
|
111
|
+
document: {
|
|
112
|
+
kind: 'multipart',
|
|
113
|
+
parts: body.parts.map((part) => compact({ ...part, enabled: part.enabled ? undefined : false })),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
case 'binary':
|
|
117
|
+
return { document: { kind: 'binary', source: { ...body.source }, contentType: body.contentType } };
|
|
118
|
+
default:
|
|
119
|
+
return { document: { kind: 'none' } };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function restRequestDocument(request) {
|
|
123
|
+
const body = bodyDocument(request.body, request.slug);
|
|
124
|
+
return compact({
|
|
125
|
+
kind: request.kind,
|
|
126
|
+
id: request.id,
|
|
127
|
+
name: request.name,
|
|
128
|
+
order: request.order,
|
|
129
|
+
description: request.description,
|
|
130
|
+
method: request.method,
|
|
131
|
+
url: request.url,
|
|
132
|
+
pathParams: request.pathParams.length > 0 ? keyValueDocuments(request.pathParams) : undefined,
|
|
133
|
+
query: request.query.length > 0 ? keyValueDocuments(request.query) : undefined,
|
|
134
|
+
headers: request.headers.length > 0 ? keyValueDocuments(request.headers) : undefined,
|
|
135
|
+
body: body.document,
|
|
136
|
+
auth: authDocument(request.auth),
|
|
137
|
+
settings: Object.keys(request.settings).length > 0 ? compact({ ...request.settings }) : undefined,
|
|
138
|
+
assertions: request.assertions.length > 0 ? request.assertions.map((a) => compact({ ...a })) : undefined,
|
|
139
|
+
orphaned: request.orphaned === true ? true : undefined,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const writeRestRequest = (files, dir, request) => {
|
|
143
|
+
const body = bodyDocument(request.body, request.slug);
|
|
144
|
+
files.set(`${dir}/${request.slug}${REQUEST_SUFFIX}`, stringifyYaml(restRequestDocument(request)));
|
|
145
|
+
if (body.file !== undefined) {
|
|
146
|
+
files.set(`${dir}/${body.file[0]}`, body.file[1]);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* A gRPC request as written: the message text goes to `<slug>.body.json` beside the document, the
|
|
151
|
+
* same convention as a REST raw body, so a message is a JSON file in git.
|
|
152
|
+
*/
|
|
153
|
+
const writeGrpcRequest = (files, dir, request) => {
|
|
154
|
+
const messageFile = restBodyFileName(request.slug, 'json');
|
|
155
|
+
assertPathSegment(messageFile);
|
|
156
|
+
files.set(`${dir}/${request.slug}${REQUEST_SUFFIX}`, stringifyYaml(compact({
|
|
157
|
+
kind: request.kind,
|
|
158
|
+
id: request.id,
|
|
159
|
+
name: request.name,
|
|
160
|
+
order: request.order,
|
|
161
|
+
description: request.description,
|
|
162
|
+
service: request.service,
|
|
163
|
+
method: request.method,
|
|
164
|
+
methodKind: request.methodKind,
|
|
165
|
+
metadata: request.metadata.length > 0 ? keyValueDocuments(request.metadata) : undefined,
|
|
166
|
+
message: messageFile,
|
|
167
|
+
auth: authDocument(request.auth),
|
|
168
|
+
settings: Object.keys(request.settings).length > 0 ? compact({ ...request.settings }) : undefined,
|
|
169
|
+
orphaned: request.orphaned === true ? true : undefined,
|
|
170
|
+
})));
|
|
171
|
+
files.set(`${dir}/${messageFile}`, request.message);
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* A WebSocket request as written: each saved message goes to a sibling file, so a JSON message is a
|
|
175
|
+
* JSON file in git. Siblings rather than a directory, because every directory here loads as a folder.
|
|
176
|
+
*
|
|
177
|
+
* @throws ProjectError `duplicate-slug` when two of the request's messages share a slug.
|
|
178
|
+
*/
|
|
179
|
+
const writeWsRequest = (files, dir, request) => {
|
|
180
|
+
const messages = request.messages.map((message) => {
|
|
181
|
+
const file = wsMessageFileName(request.slug, message);
|
|
182
|
+
assertPathSegment(file);
|
|
183
|
+
if (files.has(`${dir}/${file}`)) {
|
|
184
|
+
throw new ProjectError('duplicate-slug', `Request "${request.name}" has two messages named "${message.slug}"`, {
|
|
185
|
+
details: { file: `${dir}/${file}` },
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
files.set(`${dir}/${file}`, message.content);
|
|
189
|
+
return compact({
|
|
190
|
+
id: message.id,
|
|
191
|
+
name: message.name,
|
|
192
|
+
format: message.format === 'binary' ? 'binary' : undefined,
|
|
193
|
+
file,
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
files.set(`${dir}/${request.slug}${REQUEST_SUFFIX}`, stringifyYaml(compact({
|
|
197
|
+
kind: request.kind,
|
|
198
|
+
id: request.id,
|
|
199
|
+
name: request.name,
|
|
200
|
+
order: request.order,
|
|
201
|
+
description: request.description,
|
|
202
|
+
url: request.url,
|
|
203
|
+
query: request.query.length > 0 ? keyValueDocuments(request.query) : undefined,
|
|
204
|
+
headers: request.headers.length > 0 ? keyValueDocuments(request.headers) : undefined,
|
|
205
|
+
subprotocols: request.subprotocols.length > 0 ? [...request.subprotocols] : undefined,
|
|
206
|
+
auth: authDocument(request.auth),
|
|
207
|
+
settings: Object.keys(request.settings).length > 0 ? compact({ ...request.settings }) : undefined,
|
|
208
|
+
messages: messages.length > 0 ? messages : undefined,
|
|
209
|
+
})));
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Adds one folder's own file, its requests (and their body files) and, recursively, the folders
|
|
213
|
+
* below it.
|
|
214
|
+
*
|
|
215
|
+
* @throws ProjectError `project-path-invalid` for an unsafe slug, `project-folder-too-deep` for a
|
|
216
|
+
* tree deeper than {@link MAX_FOLDER_DEPTH} — before any path is built, never after.
|
|
217
|
+
*/
|
|
218
|
+
function addFolderFiles(files, dir, node, depth, writeRequest) {
|
|
219
|
+
for (const request of node.requests) {
|
|
220
|
+
assertPathSegment(request.slug);
|
|
221
|
+
writeRequest(files, dir, request);
|
|
222
|
+
}
|
|
223
|
+
for (const folder of node.folders) {
|
|
224
|
+
assertPathSegment(folder.slug);
|
|
225
|
+
if (depth + 1 > MAX_FOLDER_DEPTH) {
|
|
226
|
+
throw new ProjectError('project-folder-too-deep', `Folder "${folder.name}" would nest more than ${String(MAX_FOLDER_DEPTH)} deep`, { details: { folder: folder.slug, depth: depth + 1, max: MAX_FOLDER_DEPTH } });
|
|
227
|
+
}
|
|
228
|
+
const childDir = `${dir}/${folder.slug}`;
|
|
229
|
+
files.set(`${childDir}/${FOLDER_FILE}`, stringifyYaml(compact({
|
|
230
|
+
id: folder.id,
|
|
231
|
+
name: folder.name,
|
|
232
|
+
order: folder.order,
|
|
233
|
+
description: folder.description,
|
|
234
|
+
auth: folder.auth === undefined ? undefined : authDocument(folder.auth),
|
|
235
|
+
})));
|
|
236
|
+
addFolderFiles(files, childDir, folder, depth + 1, writeRequest);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/** Every file one REST API occupies, keyed by path relative to the project root. */
|
|
240
|
+
function addApiFiles(files, api) {
|
|
241
|
+
assertPathSegment(api.slug);
|
|
242
|
+
const base = `${APIS_DIR}/${api.slug}`;
|
|
243
|
+
files.set(`${base}/${API_FILE}`, stringifyYaml(compact({
|
|
244
|
+
kind: api.kind,
|
|
245
|
+
id: api.id,
|
|
246
|
+
name: api.name,
|
|
247
|
+
order: api.order,
|
|
248
|
+
description: api.description,
|
|
249
|
+
baseUrl: api.baseUrl,
|
|
250
|
+
servers: api.servers.length > 0 ? api.servers.map((server) => compact({ ...server })) : undefined,
|
|
251
|
+
auth: api.auth === undefined ? undefined : authDocument(api.auth),
|
|
252
|
+
definition: api.definition === undefined ? undefined : compact({ ...api.definition }),
|
|
253
|
+
})));
|
|
254
|
+
addFolderFiles(files, `${base}/${REQUESTS_DIR}`, api, 0, writeRestRequest);
|
|
255
|
+
}
|
|
256
|
+
/** Every file one gRPC API occupies. It shares `apis/` with the REST ones; its `kind` says which it is. */
|
|
257
|
+
function addGrpcApiFiles(files, api) {
|
|
258
|
+
assertPathSegment(api.slug);
|
|
259
|
+
const base = `${APIS_DIR}/${api.slug}`;
|
|
260
|
+
files.set(`${base}/${API_FILE}`, stringifyYaml(compact({
|
|
261
|
+
kind: api.kind,
|
|
262
|
+
id: api.id,
|
|
263
|
+
name: api.name,
|
|
264
|
+
order: api.order,
|
|
265
|
+
description: api.description,
|
|
266
|
+
target: api.target,
|
|
267
|
+
tls: api.tls,
|
|
268
|
+
metadata: api.metadata.length > 0 ? keyValueDocuments(api.metadata) : undefined,
|
|
269
|
+
auth: api.auth === undefined ? undefined : authDocument(api.auth),
|
|
270
|
+
definition: api.definition === undefined
|
|
271
|
+
? undefined
|
|
272
|
+
: compact({
|
|
273
|
+
kind: api.definition.kind,
|
|
274
|
+
source: api.definition.source,
|
|
275
|
+
cache: api.definition.cache,
|
|
276
|
+
roots: [...api.definition.roots],
|
|
277
|
+
reflectionVersion: api.definition.reflectionVersion,
|
|
278
|
+
trustInvalid: api.definition.trustInvalid,
|
|
279
|
+
}),
|
|
280
|
+
})));
|
|
281
|
+
addFolderFiles(files, `${base}/${REQUESTS_DIR}`, api, 0, writeGrpcRequest);
|
|
282
|
+
}
|
|
283
|
+
/** Every file one WebSocket API occupies. It shares `apis/` with the others; its `kind` says which it is. */
|
|
284
|
+
function addWsApiFiles(files, api) {
|
|
285
|
+
assertPathSegment(api.slug);
|
|
286
|
+
const base = `${APIS_DIR}/${api.slug}`;
|
|
287
|
+
files.set(`${base}/${API_FILE}`, stringifyYaml(compact({
|
|
288
|
+
kind: api.kind,
|
|
289
|
+
id: api.id,
|
|
290
|
+
name: api.name,
|
|
291
|
+
order: api.order,
|
|
292
|
+
description: api.description,
|
|
293
|
+
url: api.url,
|
|
294
|
+
headers: api.headers.length > 0 ? keyValueDocuments(api.headers) : undefined,
|
|
295
|
+
auth: api.auth === undefined ? undefined : authDocument(api.auth),
|
|
296
|
+
definition: api.definition === undefined ? undefined : compact({ ...api.definition }),
|
|
297
|
+
})));
|
|
298
|
+
addFolderFiles(files, `${base}/${REQUESTS_DIR}`, api, 0, writeWsRequest);
|
|
299
|
+
}
|
|
300
|
+
function wssDocument(ref) {
|
|
301
|
+
return stringifyYaml(ref.document);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Relative path of a WS-Security configuration file.
|
|
305
|
+
*
|
|
306
|
+
* @throws ProjectError `project-path-invalid` when `ref.file` is not a
|
|
307
|
+
* relative path rooted at `wss/` with only safe segments.
|
|
308
|
+
*/
|
|
309
|
+
export function wssRefPath(direction, ref) {
|
|
310
|
+
if (ref.file !== undefined) {
|
|
311
|
+
assertWssRelativePath(ref.file);
|
|
312
|
+
return ref.file;
|
|
313
|
+
}
|
|
314
|
+
return `${WSS_DIR}/${direction}/${slugify(ref.name)}.yaml`;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Builds the complete `relative path -> content` map for a project.
|
|
318
|
+
*
|
|
319
|
+
* Every slug is validated with {@link assertPathSegment} (and every
|
|
320
|
+
* `WssRef.file` with {@link assertWssRelativePath}) before any path is built,
|
|
321
|
+
* so a corrupted slug or an unvalidated file reference throws
|
|
322
|
+
* `ProjectError('project-path-invalid')` here — before `saveProject` ever
|
|
323
|
+
* touches the file system.
|
|
324
|
+
*/
|
|
325
|
+
export function projectFiles(project, options) {
|
|
326
|
+
const files = new Map();
|
|
327
|
+
const writer = options?.writer ?? 'wirebench';
|
|
328
|
+
files.set(MANIFEST_PATH, stringifyYaml(compact({
|
|
329
|
+
formatVersion: project.formatVersion,
|
|
330
|
+
id: project.id,
|
|
331
|
+
name: project.name,
|
|
332
|
+
description: project.description,
|
|
333
|
+
settings: compact({ ...project.settings }),
|
|
334
|
+
properties: { ...project.properties },
|
|
335
|
+
disabled: disabledList(project.disabledProperties, project.properties),
|
|
336
|
+
activeEnvironmentId: project.activeEnvironmentId,
|
|
337
|
+
writtenBy: writer,
|
|
338
|
+
})));
|
|
339
|
+
for (const environment of project.environments) {
|
|
340
|
+
assertPathSegment(environment.slug);
|
|
341
|
+
files.set(`${ENVIRONMENTS_DIR}/${environment.slug}.yaml`, stringifyYaml(compact({
|
|
342
|
+
id: environment.id,
|
|
343
|
+
name: environment.name,
|
|
344
|
+
order: environment.order,
|
|
345
|
+
endpoints: { ...environment.endpoints },
|
|
346
|
+
properties: { ...environment.properties },
|
|
347
|
+
disabled: disabledList(environment.disabledProperties, environment.properties),
|
|
348
|
+
})));
|
|
349
|
+
}
|
|
350
|
+
for (const iface of project.interfaces) {
|
|
351
|
+
assertPathSegment(iface.slug);
|
|
352
|
+
const base = `${INTERFACES_DIR}/${iface.slug}`;
|
|
353
|
+
files.set(`${base}/interface.yaml`, stringifyYaml(interfaceDocument(iface)));
|
|
354
|
+
for (const operation of iface.operations) {
|
|
355
|
+
assertPathSegment(operation.slug);
|
|
356
|
+
const dir = `${base}/${OPERATIONS_DIR}/${operation.slug}`;
|
|
357
|
+
for (const request of operation.requests) {
|
|
358
|
+
assertPathSegment(request.slug);
|
|
359
|
+
files.set(`${dir}/${request.slug}${REQUEST_SUFFIX}`, stringifyYaml(requestDocument(request)));
|
|
360
|
+
files.set(`${dir}/${request.slug}.xml`, request.envelopeXml);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
for (const api of project.apis) {
|
|
365
|
+
addApiFiles(files, api);
|
|
366
|
+
}
|
|
367
|
+
for (const api of project.grpcApis) {
|
|
368
|
+
addGrpcApiFiles(files, api);
|
|
369
|
+
}
|
|
370
|
+
for (const api of project.wsApis) {
|
|
371
|
+
addWsApiFiles(files, api);
|
|
372
|
+
}
|
|
373
|
+
for (const [direction, refs] of [
|
|
374
|
+
['outgoing', project.wss.outgoing],
|
|
375
|
+
['incoming', project.wss.incoming],
|
|
376
|
+
]) {
|
|
377
|
+
for (const ref of refs) {
|
|
378
|
+
files.set(wssRefPath(direction, ref), wssDocument(ref));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (project.wss.keystores.length > 0) {
|
|
382
|
+
files.set(KEYSTORES_PATH, stringifyYaml({ keystores: project.wss.keystores.map((k) => k.document) }));
|
|
383
|
+
}
|
|
384
|
+
return files;
|
|
385
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bridge between the project model's loose `WssRef` (which round-trips a
|
|
3
|
+
* `wss/{outgoing,incoming}/<id>.yaml` document verbatim, so a field written by a later build
|
|
4
|
+
* survives) and the typed configurations the WS-Security code takes — the same shape as
|
|
5
|
+
* `project/keystores.ts` does for the keystore registry.
|
|
6
|
+
*/
|
|
7
|
+
import type { WssRef } from './model.js';
|
|
8
|
+
import type { WssIncomingConfig, WssOutgoingConfig } from '../wss/model.js';
|
|
9
|
+
/**
|
|
10
|
+
* Reads one outgoing configuration out of its `WssRef`.
|
|
11
|
+
*
|
|
12
|
+
* @param ref the `Project.wss.outgoing` entry
|
|
13
|
+
* @returns the typed configuration
|
|
14
|
+
* @throws ProjectError `wss-config-invalid` when the stored document is not one
|
|
15
|
+
*/
|
|
16
|
+
export declare function toWssOutgoingConfig(ref: WssRef): WssOutgoingConfig;
|
|
17
|
+
/**
|
|
18
|
+
* The `WssRef` that stores `config`, preserving any unknown fields the existing document had.
|
|
19
|
+
*
|
|
20
|
+
* @param config the configuration to persist
|
|
21
|
+
* @param existing the ref being replaced, when this is an update
|
|
22
|
+
* @returns the ref to put into `Project.wss.outgoing`
|
|
23
|
+
*/
|
|
24
|
+
export declare function toWssOutgoingRef(config: WssOutgoingConfig, existing?: WssRef): WssRef;
|
|
25
|
+
/**
|
|
26
|
+
* Reads one incoming configuration out of its `WssRef`.
|
|
27
|
+
*
|
|
28
|
+
* @param ref the `Project.wss.incoming` entry
|
|
29
|
+
* @returns the typed configuration
|
|
30
|
+
* @throws ProjectError `wss-config-invalid` when the stored document is not one
|
|
31
|
+
*/
|
|
32
|
+
export declare function toWssIncomingConfig(ref: WssRef): WssIncomingConfig;
|
|
33
|
+
/**
|
|
34
|
+
* The `WssRef` that stores `config`, preserving any unknown fields the existing document had.
|
|
35
|
+
*
|
|
36
|
+
* @param config the configuration to persist
|
|
37
|
+
* @param existing the ref being replaced, when this is an update
|
|
38
|
+
* @returns the ref to put into `Project.wss.incoming`
|
|
39
|
+
*/
|
|
40
|
+
export declare function toWssIncomingRef(config: WssIncomingConfig, existing?: WssRef): WssRef;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bridge between the project model's loose `WssRef` (which round-trips a
|
|
3
|
+
* `wss/{outgoing,incoming}/<id>.yaml` document verbatim, so a field written by a later build
|
|
4
|
+
* survives) and the typed configurations the WS-Security code takes — the same shape as
|
|
5
|
+
* `project/keystores.ts` does for the keystore registry.
|
|
6
|
+
*/
|
|
7
|
+
import { ProjectError } from '../errors.js';
|
|
8
|
+
import { wssEntrySchema, wssIncomingFileSchema, wssOutgoingFileSchema } from './schema.js';
|
|
9
|
+
import { DEFAULT_WSS_TIMESTAMP_SKEW_SECONDS } from '../wss/model.js';
|
|
10
|
+
/**
|
|
11
|
+
* One stored entry as a typed {@link WssEntry}. An entry this build does not understand (a
|
|
12
|
+
* signature written by a later build, say) is carried through verbatim rather than dropped;
|
|
13
|
+
* applying it then fails loudly with `wss-entry-unsupported` instead of silently doing nothing.
|
|
14
|
+
*/
|
|
15
|
+
function toWssEntry(entry) {
|
|
16
|
+
const parsed = wssEntrySchema.safeParse(entry);
|
|
17
|
+
if (parsed.success) {
|
|
18
|
+
return parsed.data;
|
|
19
|
+
}
|
|
20
|
+
const kind = entry['kind'];
|
|
21
|
+
return { ...entry, kind: typeof kind === 'string' ? kind : 'unknown' };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reads one outgoing configuration out of its `WssRef`.
|
|
25
|
+
*
|
|
26
|
+
* @param ref the `Project.wss.outgoing` entry
|
|
27
|
+
* @returns the typed configuration
|
|
28
|
+
* @throws ProjectError `wss-config-invalid` when the stored document is not one
|
|
29
|
+
*/
|
|
30
|
+
export function toWssOutgoingConfig(ref) {
|
|
31
|
+
const parsed = wssOutgoingFileSchema.safeParse(ref.document);
|
|
32
|
+
if (!parsed.success) {
|
|
33
|
+
throw new ProjectError('wss-config-invalid', `Outgoing WS-Security configuration "${ref.name}" is invalid.`, {
|
|
34
|
+
details: { id: ref.id, issues: parsed.error.issues.map((issue) => issue.message) },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const document = parsed.data;
|
|
38
|
+
return {
|
|
39
|
+
id: document.id,
|
|
40
|
+
name: document.name,
|
|
41
|
+
...(document.defaultAlias !== undefined ? { defaultAlias: document.defaultAlias } : {}),
|
|
42
|
+
...(document.defaultPasswordRef !== undefined ? { defaultPasswordRef: document.defaultPasswordRef } : {}),
|
|
43
|
+
...(document.actor !== undefined ? { actor: document.actor } : {}),
|
|
44
|
+
mustUnderstand: document.mustUnderstand ?? false,
|
|
45
|
+
entries: (document.entries ?? []).map(toWssEntry),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `WssRef` that stores `config`, preserving any unknown fields the existing document had.
|
|
50
|
+
*
|
|
51
|
+
* @param config the configuration to persist
|
|
52
|
+
* @param existing the ref being replaced, when this is an update
|
|
53
|
+
* @returns the ref to put into `Project.wss.outgoing`
|
|
54
|
+
*/
|
|
55
|
+
export function toWssOutgoingRef(config, existing) {
|
|
56
|
+
const document = { ...existing?.document };
|
|
57
|
+
document['id'] = config.id;
|
|
58
|
+
document['name'] = config.name;
|
|
59
|
+
document['mustUnderstand'] = config.mustUnderstand;
|
|
60
|
+
document['entries'] = config.entries;
|
|
61
|
+
for (const [key, value] of [
|
|
62
|
+
['defaultAlias', config.defaultAlias],
|
|
63
|
+
['defaultPasswordRef', config.defaultPasswordRef],
|
|
64
|
+
['actor', config.actor],
|
|
65
|
+
]) {
|
|
66
|
+
if (value === undefined) {
|
|
67
|
+
delete document[key];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
document[key] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
id: config.id,
|
|
75
|
+
name: config.name,
|
|
76
|
+
...(existing?.file !== undefined ? { file: existing.file } : {}),
|
|
77
|
+
document,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Reads one incoming configuration out of its `WssRef`.
|
|
82
|
+
*
|
|
83
|
+
* @param ref the `Project.wss.incoming` entry
|
|
84
|
+
* @returns the typed configuration
|
|
85
|
+
* @throws ProjectError `wss-config-invalid` when the stored document is not one
|
|
86
|
+
*/
|
|
87
|
+
export function toWssIncomingConfig(ref) {
|
|
88
|
+
const parsed = wssIncomingFileSchema.safeParse(ref.document);
|
|
89
|
+
if (!parsed.success) {
|
|
90
|
+
throw new ProjectError('wss-config-invalid', `Incoming WS-Security configuration "${ref.name}" is invalid.`, {
|
|
91
|
+
details: { id: ref.id },
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const document = parsed.data;
|
|
95
|
+
return {
|
|
96
|
+
id: document.id,
|
|
97
|
+
name: document.name,
|
|
98
|
+
...(document.decryptKeystoreRef !== undefined ? { decryptKeystoreRef: document.decryptKeystoreRef } : {}),
|
|
99
|
+
...(document.decryptAlias !== undefined ? { decryptAlias: document.decryptAlias } : {}),
|
|
100
|
+
...(document.decryptKeyPasswordRef !== undefined ? { decryptKeyPasswordRef: document.decryptKeyPasswordRef } : {}),
|
|
101
|
+
...(document.signatureKeystoreRef !== undefined ? { signatureKeystoreRef: document.signatureKeystoreRef } : {}),
|
|
102
|
+
requireSignature: document.requireSignature ?? false,
|
|
103
|
+
requireTimestamp: document.requireTimestamp ?? false,
|
|
104
|
+
timestampSkewSeconds: document.timestampSkewSeconds ?? DEFAULT_WSS_TIMESTAMP_SKEW_SECONDS,
|
|
105
|
+
verifyChain: document.verifyChain ?? true,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The `WssRef` that stores `config`, preserving any unknown fields the existing document had.
|
|
110
|
+
*
|
|
111
|
+
* @param config the configuration to persist
|
|
112
|
+
* @param existing the ref being replaced, when this is an update
|
|
113
|
+
* @returns the ref to put into `Project.wss.incoming`
|
|
114
|
+
*/
|
|
115
|
+
export function toWssIncomingRef(config, existing) {
|
|
116
|
+
const document = { ...existing?.document };
|
|
117
|
+
document['id'] = config.id;
|
|
118
|
+
document['name'] = config.name;
|
|
119
|
+
document['requireSignature'] = config.requireSignature;
|
|
120
|
+
document['requireTimestamp'] = config.requireTimestamp;
|
|
121
|
+
document['timestampSkewSeconds'] = config.timestampSkewSeconds;
|
|
122
|
+
document['verifyChain'] = config.verifyChain;
|
|
123
|
+
for (const [key, value] of [
|
|
124
|
+
['decryptKeystoreRef', config.decryptKeystoreRef],
|
|
125
|
+
['decryptAlias', config.decryptAlias],
|
|
126
|
+
['decryptKeyPasswordRef', config.decryptKeyPasswordRef],
|
|
127
|
+
['signatureKeystoreRef', config.signatureKeystoreRef],
|
|
128
|
+
]) {
|
|
129
|
+
if (value === undefined) {
|
|
130
|
+
delete document[key];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
document[key] = value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
id: config.id,
|
|
138
|
+
name: config.name,
|
|
139
|
+
...(existing?.file !== undefined ? { file: existing.file } : {}),
|
|
140
|
+
document,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML (de)serialisation tuned for git-friendly project files: keys sorted so
|
|
3
|
+
* the byte order is a function of the data alone, and no line wrapping so a
|
|
4
|
+
* long URL stays on one line and diffs stay readable.
|
|
5
|
+
*/
|
|
6
|
+
/** Serialises a value to YAML with stable key order and unwrapped scalars. */
|
|
7
|
+
export declare function stringifyYaml(value: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* Parses YAML text, raising `ProjectError('project-file-invalid')` with the
|
|
10
|
+
* offending file path when the document is malformed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseYaml(text: string, file: string): unknown;
|
|
13
|
+
/**
|
|
14
|
+
* Drops `undefined` entries (and empty optional containers) so optional model
|
|
15
|
+
* fields never surface as `key: null` in the YAML.
|
|
16
|
+
*/
|
|
17
|
+
export declare function compact<T extends Record<string, unknown>>(value: T): Record<string, unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML (de)serialisation tuned for git-friendly project files: keys sorted so
|
|
3
|
+
* the byte order is a function of the data alone, and no line wrapping so a
|
|
4
|
+
* long URL stays on one line and diffs stay readable.
|
|
5
|
+
*/
|
|
6
|
+
import { parse as parseYamlDocument, stringify as stringifyYamlDocument } from 'yaml';
|
|
7
|
+
import { ProjectError } from '../errors.js';
|
|
8
|
+
/** Serialises a value to YAML with stable key order and unwrapped scalars. */
|
|
9
|
+
export function stringifyYaml(value) {
|
|
10
|
+
return stringifyYamlDocument(value, { sortMapEntries: true, lineWidth: 0 });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parses YAML text, raising `ProjectError('project-file-invalid')` with the
|
|
14
|
+
* offending file path when the document is malformed.
|
|
15
|
+
*/
|
|
16
|
+
export function parseYaml(text, file) {
|
|
17
|
+
try {
|
|
18
|
+
return parseYamlDocument(text);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new ProjectError('project-file-invalid', `Malformed YAML in ${file}`, {
|
|
22
|
+
details: { file, issues: [{ path: '', message: error instanceof Error ? error.message : String(error) }] },
|
|
23
|
+
cause: error,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Drops `undefined` entries (and empty optional containers) so optional model
|
|
29
|
+
* fields never surface as `key: null` in the YAML.
|
|
30
|
+
*/
|
|
31
|
+
export function compact(value) {
|
|
32
|
+
const out = {};
|
|
33
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
34
|
+
if (entry !== undefined) {
|
|
35
|
+
out[key] = entry;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|