@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,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The REST half of the project model: an *API* and the folders and requests inside it.
|
|
3
|
+
*
|
|
4
|
+
* An API is the REST counterpart of a SOAP interface and lives beside one in the same project
|
|
5
|
+
* (`apis/<slug>/`, see `project/paths.ts`), so one workspace, one project and one set of
|
|
6
|
+
* environments serve both protocols. Everything here follows the same rules as the SOAP model:
|
|
7
|
+
* every field is `readonly`, ids are ULIDs so an entity survives a rename, `slug` is the
|
|
8
|
+
* file-system name derived from `name`, and nothing ever holds a secret — credentials are
|
|
9
|
+
* `secretRef`s resolved from the OS keychain at send time (ADR-0004).
|
|
10
|
+
*
|
|
11
|
+
* `kind` is the discriminator the project format has carried since v1. It is `'rest'` here and
|
|
12
|
+
* `'soap'` on an interface; `'grpc'` is reserved and refused by the loader (see `project/schema.ts`).
|
|
13
|
+
*/
|
|
14
|
+
import type { Assertion } from '../assert/model.js';
|
|
15
|
+
import type { AttachmentSource, AuthConfig, CreateOptions, IdGenerator } from '../project/model.js';
|
|
16
|
+
/**
|
|
17
|
+
* An HTTP method. The seven a REST client needs are spelled out so the common case is
|
|
18
|
+
* autocompleted and checked; a service that wants `PURGE`, `LOCK` or `REPORT` is not told it is
|
|
19
|
+
* wrong, because HTTP does not say it is (RFC 9110 §9).
|
|
20
|
+
*/
|
|
21
|
+
export type RestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | (string & {});
|
|
22
|
+
/** The methods the editor offers by name, in the order it offers them. */
|
|
23
|
+
export declare const COMMON_METHODS: readonly RestMethod[];
|
|
24
|
+
/**
|
|
25
|
+
* One row of a params, query, headers or form table: a name, a value, and whether it takes part
|
|
26
|
+
* in the next send. Rows keep author order and may repeat a name — two `X-Trace` headers and two
|
|
27
|
+
* `tag=` parameters are both legal on the wire, so neither is deduplicated here.
|
|
28
|
+
*
|
|
29
|
+
* `enabled` is always present in memory and written to disk only when `false`, so a file stays
|
|
30
|
+
* quiet about the common case (see `project/serialize.ts`).
|
|
31
|
+
*/
|
|
32
|
+
export interface KeyValueEntry {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly value: string;
|
|
35
|
+
readonly enabled: boolean;
|
|
36
|
+
/** Free-form note, carried over from an imported definition's parameter description. */
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Creates an enabled {@link KeyValueEntry}. */
|
|
40
|
+
export declare function entry(name: string, value: string, options?: {
|
|
41
|
+
readonly enabled?: boolean;
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
}): KeyValueEntry;
|
|
44
|
+
/** The languages a raw body can be edited and sent as. Picks the editor mode and a default type. */
|
|
45
|
+
export type RawLanguage = 'json' | 'xml' | 'text' | 'html' | 'javascript';
|
|
46
|
+
/** The `Content-Type` each {@link RawLanguage} implies when the request sets no header itself. */
|
|
47
|
+
export declare const RAW_LANGUAGE_CONTENT_TYPES: Readonly<Record<RawLanguage, string>>;
|
|
48
|
+
/** The file extension a raw body of each language is stored under, beside its request file. */
|
|
49
|
+
export declare const RAW_LANGUAGE_EXTENSIONS: Readonly<Record<RawLanguage, string>>;
|
|
50
|
+
/**
|
|
51
|
+
* One part of a `multipart/form-data` body: either inline text or a file. Distinct from the SOAP
|
|
52
|
+
* transport's `MultipartPart`, which is a MIME part of an already-built message.
|
|
53
|
+
*/
|
|
54
|
+
export type MultipartFormPart = {
|
|
55
|
+
readonly kind: 'text';
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly value: string;
|
|
58
|
+
readonly enabled: boolean;
|
|
59
|
+
readonly contentType?: string;
|
|
60
|
+
} | {
|
|
61
|
+
readonly kind: 'file';
|
|
62
|
+
readonly name: string;
|
|
63
|
+
/** Where the bytes live; content-addressed in the project, or a path under the resource root. */
|
|
64
|
+
readonly source: AttachmentSource;
|
|
65
|
+
readonly enabled: boolean;
|
|
66
|
+
/** The `filename` the part advertises. Defaults to the source file's own name. */
|
|
67
|
+
readonly fileName?: string;
|
|
68
|
+
readonly contentType?: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* What a request sends as its body.
|
|
72
|
+
*
|
|
73
|
+
* A raw body's text lives in a sibling file rather than inside the YAML (`project/paths.ts`), so
|
|
74
|
+
* a JSON payload diffs, highlights and merges as JSON; every other kind is small enough to stay
|
|
75
|
+
* in the request document.
|
|
76
|
+
*/
|
|
77
|
+
export type RestBody = {
|
|
78
|
+
readonly kind: 'none';
|
|
79
|
+
} | {
|
|
80
|
+
readonly kind: 'raw';
|
|
81
|
+
readonly language: RawLanguage;
|
|
82
|
+
/** Overrides the language's default `Content-Type`; a typed header still wins over both. */
|
|
83
|
+
readonly contentType?: string;
|
|
84
|
+
/** The body exactly as edited. Stored verbatim in the sibling file. */
|
|
85
|
+
readonly text: string;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: 'form';
|
|
88
|
+
readonly fields: readonly KeyValueEntry[];
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: 'multipart';
|
|
91
|
+
readonly parts: readonly MultipartFormPart[];
|
|
92
|
+
} | {
|
|
93
|
+
readonly kind: 'binary';
|
|
94
|
+
readonly source: AttachmentSource;
|
|
95
|
+
readonly contentType: string;
|
|
96
|
+
};
|
|
97
|
+
/** The body a freshly created request starts with. */
|
|
98
|
+
export declare const NO_BODY: RestBody;
|
|
99
|
+
/**
|
|
100
|
+
* Per-request transport settings. Every field is optional and an absent one means *inherit*, not
|
|
101
|
+
* *off*: the send resolves request → API → project → preference, exactly as a SOAP request's
|
|
102
|
+
* properties do (`send-options.ts`).
|
|
103
|
+
*/
|
|
104
|
+
export interface RestRequestSettings {
|
|
105
|
+
readonly timeoutMs?: number;
|
|
106
|
+
/** Unlike SOAP, REST follows redirects by default; see `rest/send.ts` for the per-status rules. */
|
|
107
|
+
readonly followRedirects?: boolean;
|
|
108
|
+
readonly maxRedirects?: number;
|
|
109
|
+
/** Keep method and body across a 301/302 that would otherwise become a GET (RFC 9110 §15.4). */
|
|
110
|
+
readonly keepBodyOnRedirect?: boolean;
|
|
111
|
+
/** Percent-encode path and query values on send. On by default; off sends them verbatim. */
|
|
112
|
+
readonly encodeUrl?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Send even when the server's certificate does not verify. Per request, as `trustInvalid` is
|
|
115
|
+
* per endpoint for SOAP, and badged in red wherever the request appears.
|
|
116
|
+
*/
|
|
117
|
+
readonly trustInvalid?: boolean;
|
|
118
|
+
/** Id of a `wss/keystores.yaml` entry: the client identity this request's TLS handshake presents. */
|
|
119
|
+
readonly sslKeystoreRef?: string;
|
|
120
|
+
readonly bindAddress?: string;
|
|
121
|
+
readonly maxSizeBytes?: number;
|
|
122
|
+
/** Send back the cookies this request's own last response set. Off by default. */
|
|
123
|
+
readonly sendCookies?: boolean;
|
|
124
|
+
/** JSON- or XML-escape every property value substituted into the body. Off by default. */
|
|
125
|
+
readonly escapeProperties?: boolean;
|
|
126
|
+
}
|
|
127
|
+
/** A saved REST request: everything but a raw body lives in `<slug>.request.yaml`. */
|
|
128
|
+
export interface RestRequestDef {
|
|
129
|
+
readonly kind: 'rest';
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly name: string;
|
|
132
|
+
/** File-system name (without the `.request.yaml` suffix). */
|
|
133
|
+
readonly slug: string;
|
|
134
|
+
readonly order: number;
|
|
135
|
+
/** Markdown, shown in the Details inspector; imported from an operation's description. */
|
|
136
|
+
readonly description?: string;
|
|
137
|
+
readonly method: RestMethod;
|
|
138
|
+
/** Absolute, or relative to the API's effective base URL. May contain `{param}` and `${…}`. */
|
|
139
|
+
readonly url: string;
|
|
140
|
+
/** One row per `{param}` in {@link url}; an unfilled one is a preflight problem, never a send. */
|
|
141
|
+
readonly pathParams: readonly KeyValueEntry[];
|
|
142
|
+
readonly query: readonly KeyValueEntry[];
|
|
143
|
+
readonly headers: readonly KeyValueEntry[];
|
|
144
|
+
readonly body: RestBody;
|
|
145
|
+
/** `inherit` by default: the folder chain, then the API, decides. */
|
|
146
|
+
readonly auth: AuthConfig;
|
|
147
|
+
readonly settings: RestRequestSettings;
|
|
148
|
+
/** Declarative checks a runner evaluates against this request's response. Empty when none. */
|
|
149
|
+
readonly assertions: readonly Assertion[];
|
|
150
|
+
/**
|
|
151
|
+
* True when the operation this request was imported from is no longer in the API's definition,
|
|
152
|
+
* the same flag a SOAP request carries after an Update Definition. Nothing is ever deleted on
|
|
153
|
+
* a re-import; the request survives badged.
|
|
154
|
+
*/
|
|
155
|
+
readonly orphaned?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/** A named node in an API's tree, holding folders and requests. */
|
|
158
|
+
export interface RestFolder {
|
|
159
|
+
readonly id: string;
|
|
160
|
+
readonly name: string;
|
|
161
|
+
readonly slug: string;
|
|
162
|
+
readonly order: number;
|
|
163
|
+
readonly description?: string;
|
|
164
|
+
/** Default credentials for everything inside, unless a child says otherwise. */
|
|
165
|
+
readonly auth?: AuthConfig;
|
|
166
|
+
readonly folders: readonly RestFolder[];
|
|
167
|
+
readonly requests: readonly RestRequestDef[];
|
|
168
|
+
}
|
|
169
|
+
/** One server an imported definition declared, offered as a choice for the base URL. */
|
|
170
|
+
export interface RestServer {
|
|
171
|
+
readonly url: string;
|
|
172
|
+
readonly description?: string;
|
|
173
|
+
}
|
|
174
|
+
/** The definition an imported API came from, cached under `apis/<slug>/definition/`. */
|
|
175
|
+
export interface RestDefinitionRef {
|
|
176
|
+
/** Where the document was fetched from: a URL, or a path as the user gave it. */
|
|
177
|
+
readonly source: string;
|
|
178
|
+
readonly cache: boolean;
|
|
179
|
+
/** The OpenAPI version of the document, as it declared itself (e.g. `3.1.0`). */
|
|
180
|
+
readonly version: string;
|
|
181
|
+
}
|
|
182
|
+
/** A REST API: a base URL, default credentials, and a tree of folders and requests. */
|
|
183
|
+
export interface RestApi {
|
|
184
|
+
readonly kind: 'rest';
|
|
185
|
+
readonly id: string;
|
|
186
|
+
readonly name: string;
|
|
187
|
+
readonly slug: string;
|
|
188
|
+
/**
|
|
189
|
+
* Position among the project's interfaces *and* APIs, which share one ordering space so the
|
|
190
|
+
* explorer can interleave them however the user arranged them.
|
|
191
|
+
*/
|
|
192
|
+
readonly order: number;
|
|
193
|
+
readonly description?: string;
|
|
194
|
+
/** May contain `${…}` properties; a workspace environment can override it per environment. */
|
|
195
|
+
readonly baseUrl: string;
|
|
196
|
+
readonly servers: readonly RestServer[];
|
|
197
|
+
readonly auth?: AuthConfig;
|
|
198
|
+
readonly definition?: RestDefinitionRef;
|
|
199
|
+
readonly folders: readonly RestFolder[];
|
|
200
|
+
readonly requests: readonly RestRequestDef[];
|
|
201
|
+
}
|
|
202
|
+
/** Input to {@link createApi} beyond the name. */
|
|
203
|
+
export interface CreateApiInput extends CreateOptions {
|
|
204
|
+
readonly baseUrl?: string;
|
|
205
|
+
readonly slug?: string;
|
|
206
|
+
readonly description?: string;
|
|
207
|
+
readonly servers?: readonly RestServer[];
|
|
208
|
+
readonly auth?: AuthConfig;
|
|
209
|
+
readonly definition?: RestDefinitionRef;
|
|
210
|
+
readonly folders?: readonly RestFolder[];
|
|
211
|
+
readonly requests?: readonly RestRequestDef[];
|
|
212
|
+
}
|
|
213
|
+
/** Creates an empty API with no credentials of its own (so its requests authenticate as `none`). */
|
|
214
|
+
export declare function createApi(name: string, input?: CreateApiInput): RestApi;
|
|
215
|
+
/** Input to {@link createFolder} beyond the name. */
|
|
216
|
+
export interface CreateFolderInput extends CreateOptions {
|
|
217
|
+
readonly slug?: string;
|
|
218
|
+
readonly description?: string;
|
|
219
|
+
readonly auth?: AuthConfig;
|
|
220
|
+
readonly folders?: readonly RestFolder[];
|
|
221
|
+
readonly requests?: readonly RestRequestDef[];
|
|
222
|
+
}
|
|
223
|
+
/** Creates an empty folder. */
|
|
224
|
+
export declare function createFolder(name: string, input?: CreateFolderInput): RestFolder;
|
|
225
|
+
/** Input to {@link createRestRequest} beyond the name. */
|
|
226
|
+
export interface CreateRestRequestInput extends CreateOptions {
|
|
227
|
+
readonly method?: RestMethod;
|
|
228
|
+
readonly url?: string;
|
|
229
|
+
readonly slug?: string;
|
|
230
|
+
readonly description?: string;
|
|
231
|
+
readonly pathParams?: readonly KeyValueEntry[];
|
|
232
|
+
readonly query?: readonly KeyValueEntry[];
|
|
233
|
+
readonly headers?: readonly KeyValueEntry[];
|
|
234
|
+
readonly body?: RestBody;
|
|
235
|
+
readonly auth?: AuthConfig;
|
|
236
|
+
readonly settings?: RestRequestSettings;
|
|
237
|
+
}
|
|
238
|
+
/** Creates a `GET` request with an empty URL, no body and inherited credentials. */
|
|
239
|
+
export declare function createRestRequest(name: string, input?: CreateRestRequestInput): RestRequestDef;
|
|
240
|
+
/** Generates entity ids; injectable so tests can produce deterministic APIs. */
|
|
241
|
+
export type { IdGenerator };
|
|
242
|
+
/** Every request in `folder` and, depth-first, in the folders below it. */
|
|
243
|
+
export declare function folderRequests(folder: Pick<RestFolder, 'folders' | 'requests'>): RestRequestDef[];
|
|
244
|
+
/** Every request in `api`, its root requests first and then each folder depth-first. */
|
|
245
|
+
export declare function apiRequests(api: RestApi): RestRequestDef[];
|
|
246
|
+
/** Every folder in `api`, depth-first. */
|
|
247
|
+
export declare function apiFolders(api: RestApi): RestFolder[];
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The REST half of the project model: an *API* and the folders and requests inside it.
|
|
3
|
+
*
|
|
4
|
+
* An API is the REST counterpart of a SOAP interface and lives beside one in the same project
|
|
5
|
+
* (`apis/<slug>/`, see `project/paths.ts`), so one workspace, one project and one set of
|
|
6
|
+
* environments serve both protocols. Everything here follows the same rules as the SOAP model:
|
|
7
|
+
* every field is `readonly`, ids are ULIDs so an entity survives a rename, `slug` is the
|
|
8
|
+
* file-system name derived from `name`, and nothing ever holds a secret — credentials are
|
|
9
|
+
* `secretRef`s resolved from the OS keychain at send time (ADR-0004).
|
|
10
|
+
*
|
|
11
|
+
* `kind` is the discriminator the project format has carried since v1. It is `'rest'` here and
|
|
12
|
+
* `'soap'` on an interface; `'grpc'` is reserved and refused by the loader (see `project/schema.ts`).
|
|
13
|
+
*/
|
|
14
|
+
import { generateId } from '../project/model.js';
|
|
15
|
+
import { slugify } from '../project/paths.js';
|
|
16
|
+
/** The methods the editor offers by name, in the order it offers them. */
|
|
17
|
+
export const COMMON_METHODS = Object.freeze([
|
|
18
|
+
'GET',
|
|
19
|
+
'POST',
|
|
20
|
+
'PUT',
|
|
21
|
+
'PATCH',
|
|
22
|
+
'DELETE',
|
|
23
|
+
'HEAD',
|
|
24
|
+
'OPTIONS',
|
|
25
|
+
]);
|
|
26
|
+
/** Creates an enabled {@link KeyValueEntry}. */
|
|
27
|
+
export function entry(name, value, options) {
|
|
28
|
+
return {
|
|
29
|
+
name,
|
|
30
|
+
value,
|
|
31
|
+
enabled: options?.enabled ?? true,
|
|
32
|
+
...(options?.description !== undefined ? { description: options.description } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** The `Content-Type` each {@link RawLanguage} implies when the request sets no header itself. */
|
|
36
|
+
export const RAW_LANGUAGE_CONTENT_TYPES = Object.freeze({
|
|
37
|
+
json: 'application/json',
|
|
38
|
+
xml: 'application/xml',
|
|
39
|
+
text: 'text/plain',
|
|
40
|
+
html: 'text/html',
|
|
41
|
+
javascript: 'application/javascript',
|
|
42
|
+
});
|
|
43
|
+
/** The file extension a raw body of each language is stored under, beside its request file. */
|
|
44
|
+
export const RAW_LANGUAGE_EXTENSIONS = Object.freeze({
|
|
45
|
+
json: 'json',
|
|
46
|
+
xml: 'xml',
|
|
47
|
+
text: 'txt',
|
|
48
|
+
html: 'html',
|
|
49
|
+
javascript: 'js',
|
|
50
|
+
});
|
|
51
|
+
/** The body a freshly created request starts with. */
|
|
52
|
+
export const NO_BODY = Object.freeze({ kind: 'none' });
|
|
53
|
+
function idOf(options) {
|
|
54
|
+
return options?.id ?? (options?.newId ?? generateId)();
|
|
55
|
+
}
|
|
56
|
+
/** Creates an empty API with no credentials of its own (so its requests authenticate as `none`). */
|
|
57
|
+
export function createApi(name, input = {}) {
|
|
58
|
+
return {
|
|
59
|
+
kind: 'rest',
|
|
60
|
+
id: idOf(input),
|
|
61
|
+
name,
|
|
62
|
+
slug: input.slug ?? slugify(name),
|
|
63
|
+
order: input.order ?? 0,
|
|
64
|
+
...(input.description !== undefined ? { description: input.description } : {}),
|
|
65
|
+
baseUrl: input.baseUrl ?? '',
|
|
66
|
+
servers: input.servers ?? [],
|
|
67
|
+
...(input.auth !== undefined ? { auth: input.auth } : {}),
|
|
68
|
+
...(input.definition !== undefined ? { definition: input.definition } : {}),
|
|
69
|
+
folders: input.folders ?? [],
|
|
70
|
+
requests: input.requests ?? [],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Creates an empty folder. */
|
|
74
|
+
export function createFolder(name, input = {}) {
|
|
75
|
+
return {
|
|
76
|
+
id: idOf(input),
|
|
77
|
+
name,
|
|
78
|
+
slug: input.slug ?? slugify(name),
|
|
79
|
+
order: input.order ?? 0,
|
|
80
|
+
...(input.description !== undefined ? { description: input.description } : {}),
|
|
81
|
+
...(input.auth !== undefined ? { auth: input.auth } : {}),
|
|
82
|
+
folders: input.folders ?? [],
|
|
83
|
+
requests: input.requests ?? [],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Creates a `GET` request with an empty URL, no body and inherited credentials. */
|
|
87
|
+
export function createRestRequest(name, input = {}) {
|
|
88
|
+
return {
|
|
89
|
+
kind: 'rest',
|
|
90
|
+
id: idOf(input),
|
|
91
|
+
name,
|
|
92
|
+
slug: input.slug ?? slugify(name),
|
|
93
|
+
order: input.order ?? 0,
|
|
94
|
+
...(input.description !== undefined ? { description: input.description } : {}),
|
|
95
|
+
method: input.method ?? 'GET',
|
|
96
|
+
url: input.url ?? '',
|
|
97
|
+
pathParams: input.pathParams ?? [],
|
|
98
|
+
query: input.query ?? [],
|
|
99
|
+
headers: input.headers ?? [],
|
|
100
|
+
body: input.body ?? NO_BODY,
|
|
101
|
+
auth: input.auth ?? { type: 'inherit' },
|
|
102
|
+
settings: input.settings ?? {},
|
|
103
|
+
assertions: [],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Every request in `folder` and, depth-first, in the folders below it. */
|
|
107
|
+
export function folderRequests(folder) {
|
|
108
|
+
return [...folder.requests, ...folder.folders.flatMap((child) => folderRequests(child))];
|
|
109
|
+
}
|
|
110
|
+
/** Every request in `api`, its root requests first and then each folder depth-first. */
|
|
111
|
+
export function apiRequests(api) {
|
|
112
|
+
return folderRequests(api);
|
|
113
|
+
}
|
|
114
|
+
/** Every folder in `api`, depth-first. */
|
|
115
|
+
export function apiFolders(api) {
|
|
116
|
+
const walk = (folders) => folders.flatMap((folder) => [folder, ...walk(folder.folders)]);
|
|
117
|
+
return walk(api.folders);
|
|
118
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OAuth2 pieces that are pure: what a token request looks like, what a token response means,
|
|
3
|
+
* and the PKCE maths (RFC 6749, RFC 7636, RFC 8252).
|
|
4
|
+
*
|
|
5
|
+
* Everything stateful stays out of the engine on purpose. Opening a browser, listening on a
|
|
6
|
+
* loopback port, caching a token for the session, deciding when to refresh — those belong to the
|
|
7
|
+
* host, which owns windows, ports and the keychain. This module only builds and reads messages, so
|
|
8
|
+
* both the desktop app and the planned CLI runner authenticate the same way.
|
|
9
|
+
*
|
|
10
|
+
* No access token is ever written to a project file or returned to a renderer by this module; it
|
|
11
|
+
* hands back a {@link TokenSet} and the host decides where it lives (ADR-0004).
|
|
12
|
+
*/
|
|
13
|
+
import type { OAuth2Auth } from '../project/model.js';
|
|
14
|
+
import type { HttpRequest } from '../http/types.js';
|
|
15
|
+
/** The credential values the host resolved for one OAuth2 configuration. */
|
|
16
|
+
export interface OAuth2Secrets {
|
|
17
|
+
/** The client secret, when the configuration references one. */
|
|
18
|
+
readonly clientSecret?: string;
|
|
19
|
+
/** A refresh token, from the session cache or the keychain. */
|
|
20
|
+
readonly refreshToken?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A token as obtained, with its expiry already turned into an absolute moment. */
|
|
23
|
+
export interface TokenSet {
|
|
24
|
+
readonly accessToken: string;
|
|
25
|
+
readonly tokenType: string;
|
|
26
|
+
/** ISO-8601; absent when the server did not say how long the token lasts. */
|
|
27
|
+
readonly expiresAt?: string;
|
|
28
|
+
readonly refreshToken?: string;
|
|
29
|
+
/** The scopes actually granted, when the server named them. */
|
|
30
|
+
readonly scopes?: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
/** A PKCE verifier and the challenge derived from it (RFC 7636, S256). */
|
|
33
|
+
export interface PkcePair {
|
|
34
|
+
readonly verifier: string;
|
|
35
|
+
readonly challenge: string;
|
|
36
|
+
readonly method: 'S256';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A fresh PKCE pair.
|
|
40
|
+
*
|
|
41
|
+
* 32 random bytes give a 43-character verifier, the shortest RFC 7636 §4.1 allows and the length
|
|
42
|
+
* every provider tests against. `plain` is not offered: a challenge equal to its verifier protects
|
|
43
|
+
* nothing, and every provider worth supporting takes S256.
|
|
44
|
+
*/
|
|
45
|
+
export declare function pkce(random?: (size: number) => Uint8Array): PkcePair;
|
|
46
|
+
/** A random `state` value, which is what makes a callback attributable to this flow. */
|
|
47
|
+
export declare function newState(random?: (size: number) => Uint8Array): string;
|
|
48
|
+
/** Options for {@link authorizationUrl}. */
|
|
49
|
+
export interface AuthorizationUrlInput {
|
|
50
|
+
readonly config: OAuth2Auth;
|
|
51
|
+
readonly redirectUri: string;
|
|
52
|
+
readonly state: string;
|
|
53
|
+
/** Omit for a configuration with PKCE switched off. */
|
|
54
|
+
readonly challenge?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The URL the user's browser is sent to for an authorization-code flow.
|
|
58
|
+
*
|
|
59
|
+
* @throws WirebenchError `oauth2-no-authorization-url` when the configuration has no endpoint to
|
|
60
|
+
* send them to, which is a configuration error rather than something to guess at.
|
|
61
|
+
*/
|
|
62
|
+
export declare function authorizationUrl(input: AuthorizationUrlInput): string;
|
|
63
|
+
/** Which token request to build. */
|
|
64
|
+
export type TokenGrantInput = {
|
|
65
|
+
readonly grant: 'client-credentials';
|
|
66
|
+
} | {
|
|
67
|
+
readonly grant: 'authorization-code';
|
|
68
|
+
readonly code: string;
|
|
69
|
+
readonly redirectUri: string;
|
|
70
|
+
readonly verifier?: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly grant: 'refresh';
|
|
73
|
+
readonly refreshToken: string;
|
|
74
|
+
};
|
|
75
|
+
/** Options for {@link buildTokenRequest} beyond the configuration and the grant. */
|
|
76
|
+
export interface TokenRequestOptions {
|
|
77
|
+
readonly timeoutMs?: number;
|
|
78
|
+
readonly signal?: AbortSignal;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Builds the `POST` to the token endpoint.
|
|
82
|
+
*
|
|
83
|
+
* `clientAuth` decides where the client credentials go: `basic` puts them in an `Authorization`
|
|
84
|
+
* header (RFC 6749 §2.3.1, which providers overwhelmingly prefer), `body` puts `client_secret` in
|
|
85
|
+
* the form. A public client — no secret at all — sends `client_id` in the body and no header, which
|
|
86
|
+
* is what RFC 8252 §8.4 expects of a native app.
|
|
87
|
+
*
|
|
88
|
+
* @throws WirebenchError `oauth2-no-token-url` when the configuration has no token endpoint
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildTokenRequest(config: OAuth2Auth, secrets: OAuth2Secrets, grantInput: TokenGrantInput, options?: TokenRequestOptions): HttpRequest;
|
|
91
|
+
/** What the token endpoint answered with, as far as reading it goes. */
|
|
92
|
+
export interface TokenResponseInput {
|
|
93
|
+
readonly status: number;
|
|
94
|
+
readonly body: Uint8Array;
|
|
95
|
+
/** Clock for turning `expires_in` into an absolute moment; injected so tests are deterministic. */
|
|
96
|
+
readonly now?: () => Date;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Reads a token response (RFC 6749 §5.1) or raises the error it describes (§5.2).
|
|
100
|
+
*
|
|
101
|
+
* A provider that answers 200 with an `error` field, or 400 with a perfectly good token, is not
|
|
102
|
+
* unheard of, so the body decides and the status only breaks ties. `expires_in` is turned into an
|
|
103
|
+
* absolute `expiresAt` immediately: a duration is meaningless once it has been cached.
|
|
104
|
+
*
|
|
105
|
+
* @throws WirebenchError `oauth2-token-error` with the provider's own `error`/`error_description`,
|
|
106
|
+
* or `oauth2-token-malformed` when the body is not a token response at all
|
|
107
|
+
*/
|
|
108
|
+
export declare function parseTokenResponse(input: TokenResponseInput): TokenSet;
|
|
109
|
+
/** How close to its expiry a token is refreshed rather than used. */
|
|
110
|
+
export declare const TOKEN_REFRESH_MARGIN_MS = 30000;
|
|
111
|
+
/**
|
|
112
|
+
* Whether `token` should be replaced before the next send.
|
|
113
|
+
*
|
|
114
|
+
* A token with no stated expiry is used until it fails, which is all a client can do; one with an
|
|
115
|
+
* expiry is refreshed while it still has {@link TOKEN_REFRESH_MARGIN_MS} left, so a slow request
|
|
116
|
+
* does not arrive just after it lapsed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function needsRefresh(token: TokenSet, now?: Date): boolean;
|