@thymian/core 0.0.0-PLACEHOLDER
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/README.md +59 -0
- package/dist/actions/action.d.ts +5 -0
- package/dist/actions/action.d.ts.map +1 -0
- package/dist/actions/action.js +2 -0
- package/dist/actions/action.js.map +1 -0
- package/dist/actions/close.action.d.ts +3 -0
- package/dist/actions/close.action.d.ts.map +1 -0
- package/dist/actions/close.action.js +2 -0
- package/dist/actions/close.action.js.map +1 -0
- package/dist/actions/core-analyze.action.d.ts +11 -0
- package/dist/actions/core-analyze.action.d.ts.map +1 -0
- package/dist/actions/core-analyze.action.js +2 -0
- package/dist/actions/core-analyze.action.js.map +1 -0
- package/dist/actions/core-lint.action.d.ts +9 -0
- package/dist/actions/core-lint.action.d.ts.map +1 -0
- package/dist/actions/core-lint.action.js +2 -0
- package/dist/actions/core-lint.action.js.map +1 -0
- package/dist/actions/core-request-sample.action.d.ts +9 -0
- package/dist/actions/core-request-sample.action.d.ts.map +1 -0
- package/dist/actions/core-request-sample.action.js +2 -0
- package/dist/actions/core-request-sample.action.js.map +1 -0
- package/dist/actions/core-test.action.d.ts +10 -0
- package/dist/actions/core-test.action.d.ts.map +1 -0
- package/dist/actions/core-test.action.js +2 -0
- package/dist/actions/core-test.action.js.map +1 -0
- package/dist/actions/core-validation-input.d.ts +6 -0
- package/dist/actions/core-validation-input.d.ts.map +1 -0
- package/dist/actions/core-validation-input.js +2 -0
- package/dist/actions/core-validation-input.js.map +1 -0
- package/dist/actions/format-load.action.d.ts +16 -0
- package/dist/actions/format-load.action.d.ts.map +1 -0
- package/dist/actions/format-load.action.js +36 -0
- package/dist/actions/format-load.action.js.map +1 -0
- package/dist/actions/format.action.d.ts +4 -0
- package/dist/actions/format.action.d.ts.map +1 -0
- package/dist/actions/format.action.js +2 -0
- package/dist/actions/format.action.js.map +1 -0
- package/dist/actions/index.d.ts +39 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +14 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/ready.action.d.ts +3 -0
- package/dist/actions/ready.action.d.ts.map +1 -0
- package/dist/actions/ready.action.js +2 -0
- package/dist/actions/ready.action.js.map +1 -0
- package/dist/actions/report-flush.action.d.ts +6 -0
- package/dist/actions/report-flush.action.d.ts.map +1 -0
- package/dist/actions/report-flush.action.js +2 -0
- package/dist/actions/report-flush.action.js.map +1 -0
- package/dist/actions/request-dispatch.action.d.ts +13 -0
- package/dist/actions/request-dispatch.action.d.ts.map +1 -0
- package/dist/actions/request-dispatch.action.js +45 -0
- package/dist/actions/request-dispatch.action.js.map +1 -0
- package/dist/actions/traffic-load.action.d.ts +16 -0
- package/dist/actions/traffic-load.action.d.ts.map +1 -0
- package/dist/actions/traffic-load.action.js +36 -0
- package/dist/actions/traffic-load.action.js.map +1 -0
- package/dist/actions/validation-result.d.ts +18 -0
- package/dist/actions/validation-result.d.ts.map +1 -0
- package/dist/actions/validation-result.js +81 -0
- package/dist/actions/validation-result.js.map +1 -0
- package/dist/ajv.d.ts +5 -0
- package/dist/ajv.d.ts.map +1 -0
- package/dist/ajv.js +9 -0
- package/dist/ajv.js.map +1 -0
- package/dist/chalk.d.ts +2 -0
- package/dist/chalk.d.ts.map +1 -0
- package/dist/chalk.js +2 -0
- package/dist/chalk.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/core-plugin.d.ts +5 -0
- package/dist/core-plugin.d.ts.map +1 -0
- package/dist/core-plugin.js +62 -0
- package/dist/core-plugin.js.map +1 -0
- package/dist/emitter/action-event.d.ts +19 -0
- package/dist/emitter/action-event.d.ts.map +1 -0
- package/dist/emitter/action-event.js +2 -0
- package/dist/emitter/action-event.js.map +1 -0
- package/dist/emitter/error-event.d.ts +13 -0
- package/dist/emitter/error-event.d.ts.map +1 -0
- package/dist/emitter/error-event.js +2 -0
- package/dist/emitter/error-event.js.map +1 -0
- package/dist/emitter/events.d.ts +10 -0
- package/dist/emitter/events.d.ts.map +1 -0
- package/dist/emitter/events.js +2 -0
- package/dist/emitter/events.js.map +1 -0
- package/dist/emitter/index.d.ts +6 -0
- package/dist/emitter/index.d.ts.map +1 -0
- package/dist/emitter/index.js +6 -0
- package/dist/emitter/index.js.map +1 -0
- package/dist/emitter/thymian-emitter.d.ts +61 -0
- package/dist/emitter/thymian-emitter.d.ts.map +1 -0
- package/dist/emitter/thymian-emitter.js +371 -0
- package/dist/emitter/thymian-emitter.js.map +1 -0
- package/dist/emitter/utils.d.ts +8 -0
- package/dist/emitter/utils.d.ts.map +1 -0
- package/dist/emitter/utils.js +16 -0
- package/dist/emitter/utils.js.map +1 -0
- package/dist/events/error.event.d.ts +5 -0
- package/dist/events/error.event.d.ts.map +1 -0
- package/dist/events/error.event.js +49 -0
- package/dist/events/error.event.js.map +1 -0
- package/dist/events/exit.event.d.ts +14 -0
- package/dist/events/exit.event.d.ts.map +1 -0
- package/dist/events/exit.event.js +9 -0
- package/dist/events/exit.event.js.map +1 -0
- package/dist/events/index.d.ts +15 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +4 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/register-plugin.event.d.ts +51 -0
- package/dist/events/register-plugin.event.d.ts.map +1 -0
- package/dist/events/register-plugin.event.js +29 -0
- package/dist/events/register-plugin.event.js.map +1 -0
- package/dist/events/report.event.d.ts +104 -0
- package/dist/events/report.event.d.ts.map +1 -0
- package/dist/events/report.event.js +109 -0
- package/dist/events/report.event.js.map +1 -0
- package/dist/format/circular-references.d.ts +3 -0
- package/dist/format/circular-references.d.ts.map +1 -0
- package/dist/format/circular-references.js +71 -0
- package/dist/format/circular-references.js.map +1 -0
- package/dist/format/edges/edge.d.ts +9 -0
- package/dist/format/edges/edge.d.ts.map +1 -0
- package/dist/format/edges/edge.js +2 -0
- package/dist/format/edges/edge.js.map +1 -0
- package/dist/format/edges/has-sample.edge.d.ts +5 -0
- package/dist/format/edges/has-sample.edge.d.ts.map +1 -0
- package/dist/format/edges/has-sample.edge.js +2 -0
- package/dist/format/edges/has-sample.edge.js.map +1 -0
- package/dist/format/edges/http-link.edge.d.ts +10 -0
- package/dist/format/edges/http-link.edge.d.ts.map +1 -0
- package/dist/format/edges/http-link.edge.js +2 -0
- package/dist/format/edges/http-link.edge.js.map +1 -0
- package/dist/format/edges/http-transaction.edge.d.ts +5 -0
- package/dist/format/edges/http-transaction.edge.d.ts.map +1 -0
- package/dist/format/edges/http-transaction.edge.js +2 -0
- package/dist/format/edges/http-transaction.edge.js.map +1 -0
- package/dist/format/edges/is-secured-with.edge.d.ts +5 -0
- package/dist/format/edges/is-secured-with.edge.d.ts.map +1 -0
- package/dist/format/edges/is-secured-with.edge.js +2 -0
- package/dist/format/edges/is-secured-with.edge.js.map +1 -0
- package/dist/format/edges/sample-http-transaction.edge.d.ts +5 -0
- package/dist/format/edges/sample-http-transaction.edge.d.ts.map +1 -0
- package/dist/format/edges/sample-http-transaction.edge.js +2 -0
- package/dist/format/edges/sample-http-transaction.edge.js.map +1 -0
- package/dist/format/format-location.d.ts +13 -0
- package/dist/format/format-location.d.ts.map +1 -0
- package/dist/format/format-location.js +2 -0
- package/dist/format/format-location.js.map +1 -0
- package/dist/format/http-filter-expression-to-transaction-filter.d.ts +5 -0
- package/dist/format/http-filter-expression-to-transaction-filter.d.ts.map +1 -0
- package/dist/format/http-filter-expression-to-transaction-filter.js +88 -0
- package/dist/format/http-filter-expression-to-transaction-filter.js.map +1 -0
- package/dist/format/index.d.ts +14 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +14 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/nodes/http-request.node.d.ts +29 -0
- package/dist/format/nodes/http-request.node.d.ts.map +1 -0
- package/dist/format/nodes/http-request.node.js +2 -0
- package/dist/format/nodes/http-request.node.js.map +1 -0
- package/dist/format/nodes/http-response.node.d.ts +12 -0
- package/dist/format/nodes/http-response.node.d.ts.map +1 -0
- package/dist/format/nodes/http-response.node.js +2 -0
- package/dist/format/nodes/http-response.node.js.map +1 -0
- package/dist/format/nodes/node.d.ts +9 -0
- package/dist/format/nodes/node.d.ts.map +1 -0
- package/dist/format/nodes/node.js +2 -0
- package/dist/format/nodes/node.js.map +1 -0
- package/dist/format/nodes/sample-http-request.node.d.ts +7 -0
- package/dist/format/nodes/sample-http-request.node.d.ts.map +1 -0
- package/dist/format/nodes/sample-http-request.node.js +2 -0
- package/dist/format/nodes/sample-http-request.node.js.map +1 -0
- package/dist/format/nodes/sample-http-response.node.d.ts +7 -0
- package/dist/format/nodes/sample-http-response.node.d.ts.map +1 -0
- package/dist/format/nodes/sample-http-response.node.js +2 -0
- package/dist/format/nodes/sample-http-response.node.js.map +1 -0
- package/dist/format/nodes/security-scheme.node.d.ts +17 -0
- package/dist/format/nodes/security-scheme.node.d.ts.map +1 -0
- package/dist/format/nodes/security-scheme.node.js +2 -0
- package/dist/format/nodes/security-scheme.node.js.map +1 -0
- package/dist/format/parameter.d.ts +10 -0
- package/dist/format/parameter.d.ts.map +1 -0
- package/dist/format/parameter.js +2 -0
- package/dist/format/parameter.js.map +1 -0
- package/dist/format/serialization-style/cookie.serialization-style.d.ts +5 -0
- package/dist/format/serialization-style/cookie.serialization-style.d.ts.map +1 -0
- package/dist/format/serialization-style/cookie.serialization-style.js +7 -0
- package/dist/format/serialization-style/cookie.serialization-style.js.map +1 -0
- package/dist/format/serialization-style/header.serialization-style.d.ts +5 -0
- package/dist/format/serialization-style/header.serialization-style.d.ts.map +1 -0
- package/dist/format/serialization-style/header.serialization-style.js +7 -0
- package/dist/format/serialization-style/header.serialization-style.js.map +1 -0
- package/dist/format/serialization-style/index.d.ts +6 -0
- package/dist/format/serialization-style/index.d.ts.map +1 -0
- package/dist/format/serialization-style/index.js +6 -0
- package/dist/format/serialization-style/index.js.map +1 -0
- package/dist/format/serialization-style/path.serialization-style.d.ts +5 -0
- package/dist/format/serialization-style/path.serialization-style.d.ts.map +1 -0
- package/dist/format/serialization-style/path.serialization-style.js +7 -0
- package/dist/format/serialization-style/path.serialization-style.js.map +1 -0
- package/dist/format/serialization-style/query.serialization-style.d.ts +5 -0
- package/dist/format/serialization-style/query.serialization-style.d.ts.map +1 -0
- package/dist/format/serialization-style/query.serialization-style.js +7 -0
- package/dist/format/serialization-style/query.serialization-style.js.map +1 -0
- package/dist/format/serialization-style/serialization-style.d.ts +13 -0
- package/dist/format/serialization-style/serialization-style.d.ts.map +1 -0
- package/dist/format/serialization-style/serialization-style.js +25 -0
- package/dist/format/serialization-style/serialization-style.js.map +1 -0
- package/dist/format/thymian-format.d.ts +109 -0
- package/dist/format/thymian-format.d.ts.map +1 -0
- package/dist/format/thymian-format.js +437 -0
- package/dist/format/thymian-format.js.map +1 -0
- package/dist/format/thymian-schema.d.ts +56 -0
- package/dist/format/thymian-schema.d.ts.map +1 -0
- package/dist/format/thymian-schema.js +2 -0
- package/dist/format/thymian-schema.js.map +1 -0
- package/dist/format/utils.d.ts +12 -0
- package/dist/format/utils.d.ts.map +1 -0
- package/dist/format/utils.js +85 -0
- package/dist/format/utils.js.map +1 -0
- package/dist/http-filter-visitor.d.ts +76 -0
- package/dist/http-filter-visitor.d.ts.map +1 -0
- package/dist/http-filter-visitor.js +168 -0
- package/dist/http-filter-visitor.js.map +1 -0
- package/dist/http-filter.d.ts +140 -0
- package/dist/http-filter.d.ts.map +1 -0
- package/dist/http-filter.js +137 -0
- package/dist/http-filter.js.map +1 -0
- package/dist/http-status-codes/1xx/index.d.ts +15 -0
- package/dist/http-status-codes/1xx/index.d.ts.map +1 -0
- package/dist/http-status-codes/1xx/index.js +15 -0
- package/dist/http-status-codes/1xx/index.js.map +1 -0
- package/dist/http-status-codes/1xx/informational.phrases.d.ts +4 -0
- package/dist/http-status-codes/1xx/informational.phrases.d.ts.map +1 -0
- package/dist/http-status-codes/1xx/informational.phrases.js +10 -0
- package/dist/http-status-codes/1xx/informational.phrases.js.map +1 -0
- package/dist/http-status-codes/1xx/informational.status-codes.d.ts +4 -0
- package/dist/http-status-codes/1xx/informational.status-codes.d.ts.map +1 -0
- package/dist/http-status-codes/1xx/informational.status-codes.js +5 -0
- package/dist/http-status-codes/1xx/informational.status-codes.js.map +1 -0
- package/dist/http-status-codes/2xx/index.d.ts +25 -0
- package/dist/http-status-codes/2xx/index.d.ts.map +1 -0
- package/dist/http-status-codes/2xx/index.js +25 -0
- package/dist/http-status-codes/2xx/index.js.map +1 -0
- package/dist/http-status-codes/2xx/successful.phrases.d.ts +4 -0
- package/dist/http-status-codes/2xx/successful.phrases.d.ts.map +1 -0
- package/dist/http-status-codes/2xx/successful.phrases.js +15 -0
- package/dist/http-status-codes/2xx/successful.phrases.js.map +1 -0
- package/dist/http-status-codes/2xx/successful.status-codes.d.ts +4 -0
- package/dist/http-status-codes/2xx/successful.status-codes.d.ts.map +1 -0
- package/dist/http-status-codes/2xx/successful.status-codes.js +7 -0
- package/dist/http-status-codes/2xx/successful.status-codes.js.map +1 -0
- package/dist/http-status-codes/3xx/index.d.ts +21 -0
- package/dist/http-status-codes/3xx/index.d.ts.map +1 -0
- package/dist/http-status-codes/3xx/index.js +21 -0
- package/dist/http-status-codes/3xx/index.js.map +1 -0
- package/dist/http-status-codes/3xx/redirection.phrases.d.ts +4 -0
- package/dist/http-status-codes/3xx/redirection.phrases.d.ts.map +1 -0
- package/dist/http-status-codes/3xx/redirection.phrases.js +13 -0
- package/dist/http-status-codes/3xx/redirection.phrases.js.map +1 -0
- package/dist/http-status-codes/3xx/redirection.status-codes.d.ts +4 -0
- package/dist/http-status-codes/3xx/redirection.status-codes.d.ts.map +1 -0
- package/dist/http-status-codes/3xx/redirection.status-codes.js +7 -0
- package/dist/http-status-codes/3xx/redirection.status-codes.js.map +1 -0
- package/dist/http-status-codes/4xx/client-error.phrases.d.ts +4 -0
- package/dist/http-status-codes/4xx/client-error.phrases.d.ts.map +1 -0
- package/dist/http-status-codes/4xx/client-error.phrases.js +34 -0
- package/dist/http-status-codes/4xx/client-error.phrases.js.map +1 -0
- package/dist/http-status-codes/4xx/client-error.status-codes.d.ts +4 -0
- package/dist/http-status-codes/4xx/client-error.status-codes.d.ts.map +1 -0
- package/dist/http-status-codes/4xx/client-error.status-codes.js +8 -0
- package/dist/http-status-codes/4xx/client-error.status-codes.js.map +1 -0
- package/dist/http-status-codes/4xx/index.d.ts +63 -0
- package/dist/http-status-codes/4xx/index.d.ts.map +1 -0
- package/dist/http-status-codes/4xx/index.js +63 -0
- package/dist/http-status-codes/4xx/index.js.map +1 -0
- package/dist/http-status-codes/5xx/index.d.ts +29 -0
- package/dist/http-status-codes/5xx/index.d.ts.map +1 -0
- package/dist/http-status-codes/5xx/index.js +29 -0
- package/dist/http-status-codes/5xx/index.js.map +1 -0
- package/dist/http-status-codes/5xx/server-error.phrases.d.ts +4 -0
- package/dist/http-status-codes/5xx/server-error.phrases.d.ts.map +1 -0
- package/dist/http-status-codes/5xx/server-error.phrases.js +17 -0
- package/dist/http-status-codes/5xx/server-error.phrases.js.map +1 -0
- package/dist/http-status-codes/5xx/server-error.status-codes.d.ts +4 -0
- package/dist/http-status-codes/5xx/server-error.status-codes.d.ts.map +1 -0
- package/dist/http-status-codes/5xx/server-error.status-codes.js +7 -0
- package/dist/http-status-codes/5xx/server-error.status-codes.js.map +1 -0
- package/dist/http-status-codes/http-status-code-ranges.d.ts +11 -0
- package/dist/http-status-codes/http-status-code-ranges.d.ts.map +1 -0
- package/dist/http-status-codes/http-status-code-ranges.js +19 -0
- package/dist/http-status-codes/http-status-code-ranges.js.map +1 -0
- package/dist/http-status-codes/http-status-code.d.ts +8 -0
- package/dist/http-status-codes/http-status-code.d.ts.map +1 -0
- package/dist/http-status-codes/http-status-code.js +13 -0
- package/dist/http-status-codes/http-status-code.js.map +1 -0
- package/dist/http-status-codes/http-status-phrase.d.ts +8 -0
- package/dist/http-status-codes/http-status-phrase.d.ts.map +1 -0
- package/dist/http-status-codes/http-status-phrase.js +13 -0
- package/dist/http-status-codes/http-status-phrase.js.map +1 -0
- package/dist/http-status-codes/index.d.ts +10 -0
- package/dist/http-status-codes/index.d.ts.map +1 -0
- package/dist/http-status-codes/index.js +10 -0
- package/dist/http-status-codes/index.js.map +1 -0
- package/dist/http-status-codes/phrase-to-status-code.d.ts +62 -0
- package/dist/http-status-codes/phrase-to-status-code.d.ts.map +1 -0
- package/dist/http-status-codes/phrase-to-status-code.js +13 -0
- package/dist/http-status-codes/phrase-to-status-code.js.map +1 -0
- package/dist/http-status-codes/status-code-to-phrase.d.ts +62 -0
- package/dist/http-status-codes/status-code-to-phrase.d.ts.map +1 -0
- package/dist/http-status-codes/status-code-to-phrase.js +13 -0
- package/dist/http-status-codes/status-code-to-phrase.js.map +1 -0
- package/dist/http-status-codes/validate.d.ts +5 -0
- package/dist/http-status-codes/validate.d.ts.map +1 -0
- package/dist/http-status-codes/validate.js +28 -0
- package/dist/http-status-codes/validate.js.map +1 -0
- package/dist/http-testing/http-test/create-hook-runner.d.ts +21 -0
- package/dist/http-testing/http-test/create-hook-runner.d.ts.map +1 -0
- package/dist/http-testing/http-test/create-hook-runner.js +17 -0
- package/dist/http-testing/http-test/create-hook-runner.js.map +1 -0
- package/dist/http-testing/http-test/create-http-test-context.d.ts +3 -0
- package/dist/http-testing/http-test/create-http-test-context.d.ts.map +1 -0
- package/dist/http-testing/http-test/create-http-test-context.js +24 -0
- package/dist/http-testing/http-test/create-http-test-context.js.map +1 -0
- package/dist/http-testing/http-test/http-test-case-result.d.ts +46 -0
- package/dist/http-testing/http-test/http-test-case-result.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test-case-result.js +2 -0
- package/dist/http-testing/http-test/http-test-case-result.js.map +1 -0
- package/dist/http-testing/http-test/http-test-case.d.ts +36 -0
- package/dist/http-testing/http-test/http-test-case.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test-case.js +2 -0
- package/dist/http-testing/http-test/http-test-case.js.map +1 -0
- package/dist/http-testing/http-test/http-test-context.d.ts +20 -0
- package/dist/http-testing/http-test/http-test-context.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test-context.js +2 -0
- package/dist/http-testing/http-test/http-test-context.js.map +1 -0
- package/dist/http-testing/http-test/http-test-hooks.d.ts +26 -0
- package/dist/http-testing/http-test/http-test-hooks.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test-hooks.js +2 -0
- package/dist/http-testing/http-test/http-test-hooks.js.map +1 -0
- package/dist/http-testing/http-test/http-test-pipeline.d.ts +10 -0
- package/dist/http-testing/http-test/http-test-pipeline.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test-pipeline.js +2 -0
- package/dist/http-testing/http-test/http-test-pipeline.js.map +1 -0
- package/dist/http-testing/http-test/http-test.d.ts +11 -0
- package/dist/http-testing/http-test/http-test.d.ts.map +1 -0
- package/dist/http-testing/http-test/http-test.js +35 -0
- package/dist/http-testing/http-test/http-test.js.map +1 -0
- package/dist/http-testing/http-test/index.d.ts +10 -0
- package/dist/http-testing/http-test/index.d.ts.map +1 -0
- package/dist/http-testing/http-test/index.js +10 -0
- package/dist/http-testing/http-test/index.js.map +1 -0
- package/dist/http-testing/http-test/utils.d.ts +11 -0
- package/dist/http-testing/http-test/utils.d.ts.map +1 -0
- package/dist/http-testing/http-test/utils.js +16 -0
- package/dist/http-testing/http-test/utils.js.map +1 -0
- package/dist/http-testing/index.d.ts +7 -0
- package/dist/http-testing/index.d.ts.map +1 -0
- package/dist/http-testing/index.js +7 -0
- package/dist/http-testing/index.js.map +1 -0
- package/dist/http-testing/operators/expect-for-transaction.operator.d.ts +5 -0
- package/dist/http-testing/operators/expect-for-transaction.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/expect-for-transaction.operator.js +39 -0
- package/dist/http-testing/operators/expect-for-transaction.operator.js.map +1 -0
- package/dist/http-testing/operators/expect-headers.operator.d.ts +4 -0
- package/dist/http-testing/operators/expect-headers.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/expect-headers.operator.js +37 -0
- package/dist/http-testing/operators/expect-headers.operator.js.map +1 -0
- package/dist/http-testing/operators/expect-status-code.operator.d.ts +5 -0
- package/dist/http-testing/operators/expect-status-code.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/expect-status-code.operator.js +55 -0
- package/dist/http-testing/operators/expect-status-code.operator.js.map +1 -0
- package/dist/http-testing/operators/expect.operator.d.ts +4 -0
- package/dist/http-testing/operators/expect.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/expect.operator.js +31 -0
- package/dist/http-testing/operators/expect.operator.js.map +1 -0
- package/dist/http-testing/operators/fail.operator.d.ts +4 -0
- package/dist/http-testing/operators/fail.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/fail.operator.js +8 -0
- package/dist/http-testing/operators/fail.operator.js.map +1 -0
- package/dist/http-testing/operators/filter-http-transactions.operator.d.ts +10 -0
- package/dist/http-testing/operators/filter-http-transactions.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/filter-http-transactions.operator.js +18 -0
- package/dist/http-testing/operators/filter-http-transactions.operator.js.map +1 -0
- package/dist/http-testing/operators/generate-requests.operator.d.ts +10 -0
- package/dist/http-testing/operators/generate-requests.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/generate-requests.operator.js +44 -0
- package/dist/http-testing/operators/generate-requests.operator.js.map +1 -0
- package/dist/http-testing/operators/index.d.ts +21 -0
- package/dist/http-testing/operators/index.d.ts.map +1 -0
- package/dist/http-testing/operators/index.js +21 -0
- package/dist/http-testing/operators/index.js.map +1 -0
- package/dist/http-testing/operators/map-to-grouped-test-case.operator.d.ts +7 -0
- package/dist/http-testing/operators/map-to-grouped-test-case.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/map-to-grouped-test-case.operator.js +32 -0
- package/dist/http-testing/operators/map-to-grouped-test-case.operator.js.map +1 -0
- package/dist/http-testing/operators/map-to-test-case.operator.d.ts +7 -0
- package/dist/http-testing/operators/map-to-test-case.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/map-to-test-case.operator.js +21 -0
- package/dist/http-testing/operators/map-to-test-case.operator.js.map +1 -0
- package/dist/http-testing/operators/override-headers.operator.d.ts +5 -0
- package/dist/http-testing/operators/override-headers.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/override-headers.operator.js +18 -0
- package/dist/http-testing/operators/override-headers.operator.js.map +1 -0
- package/dist/http-testing/operators/override-with-previous.operator.d.ts +5 -0
- package/dist/http-testing/operators/override-with-previous.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/override-with-previous.operator.js +23 -0
- package/dist/http-testing/operators/override-with-previous.operator.js.map +1 -0
- package/dist/http-testing/operators/replay-previous-step.operator.d.ts +5 -0
- package/dist/http-testing/operators/replay-previous-step.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/replay-previous-step.operator.js +27 -0
- package/dist/http-testing/operators/replay-previous-step.operator.js.map +1 -0
- package/dist/http-testing/operators/reply-previous-but-expect-response.operator.d.ts +7 -0
- package/dist/http-testing/operators/reply-previous-but-expect-response.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/reply-previous-but-expect-response.operator.js +61 -0
- package/dist/http-testing/operators/reply-previous-but-expect-response.operator.js.map +1 -0
- package/dist/http-testing/operators/requires-authorization.operator.d.ts +5 -0
- package/dist/http-testing/operators/requires-authorization.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/requires-authorization.operator.js +9 -0
- package/dist/http-testing/operators/requires-authorization.operator.js.map +1 -0
- package/dist/http-testing/operators/run-requests.operator.d.ts +14 -0
- package/dist/http-testing/operators/run-requests.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/run-requests.operator.js +139 -0
- package/dist/http-testing/operators/run-requests.operator.js.map +1 -0
- package/dist/http-testing/operators/single-step-for-transaction.operator.d.ts +5 -0
- package/dist/http-testing/operators/single-step-for-transaction.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/single-step-for-transaction.operator.js +43 -0
- package/dist/http-testing/operators/single-step-for-transaction.operator.js.map +1 -0
- package/dist/http-testing/operators/skip.operator.d.ts +5 -0
- package/dist/http-testing/operators/skip.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/skip.operator.js +11 -0
- package/dist/http-testing/operators/skip.operator.js.map +1 -0
- package/dist/http-testing/operators/step.operator.d.ts +5 -0
- package/dist/http-testing/operators/step.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/step.operator.js +20 -0
- package/dist/http-testing/operators/step.operator.js.map +1 -0
- package/dist/http-testing/operators/utils.d.ts +10 -0
- package/dist/http-testing/operators/utils.d.ts.map +1 -0
- package/dist/http-testing/operators/utils.js +17 -0
- package/dist/http-testing/operators/utils.js.map +1 -0
- package/dist/http-testing/operators/validate-responses.operator.d.ts +4 -0
- package/dist/http-testing/operators/validate-responses.operator.d.ts.map +1 -0
- package/dist/http-testing/operators/validate-responses.operator.js +33 -0
- package/dist/http-testing/operators/validate-responses.operator.js.map +1 -0
- package/dist/http-testing/serialize-parameter.d.ts +6 -0
- package/dist/http-testing/serialize-parameter.d.ts.map +1 -0
- package/dist/http-testing/serialize-parameter.js +51 -0
- package/dist/http-testing/serialize-parameter.js.map +1 -0
- package/dist/http-testing/serialize-request.d.ts +7 -0
- package/dist/http-testing/serialize-request.d.ts.map +1 -0
- package/dist/http-testing/serialize-request.js +112 -0
- package/dist/http-testing/serialize-request.js.map +1 -0
- package/dist/http-testing/test-builder/builder-pipeline.d.ts +4 -0
- package/dist/http-testing/test-builder/builder-pipeline.d.ts.map +1 -0
- package/dist/http-testing/test-builder/builder-pipeline.js +2 -0
- package/dist/http-testing/test-builder/builder-pipeline.js.map +1 -0
- package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.d.ts +9 -0
- package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.d.ts.map +1 -0
- package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.js +114 -0
- package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.js.map +1 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.d.ts +4 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.d.ts.map +1 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.js +36 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.js.map +1 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.d.ts +4 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.d.ts.map +1 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.js +65 -0
- package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.js.map +1 -0
- package/dist/http-testing/test-builder/extract-value-from-response.d.ts +4 -0
- package/dist/http-testing/test-builder/extract-value-from-response.d.ts.map +1 -0
- package/dist/http-testing/test-builder/extract-value-from-response.js +16 -0
- package/dist/http-testing/test-builder/extract-value-from-response.js.map +1 -0
- package/dist/http-testing/test-builder/override-request-template.d.ts +4 -0
- package/dist/http-testing/test-builder/override-request-template.d.ts.map +1 -0
- package/dist/http-testing/test-builder/override-request-template.js +33 -0
- package/dist/http-testing/test-builder/override-request-template.js.map +1 -0
- package/dist/http-testing/test-builder/reply-step-builder.d.ts +10 -0
- package/dist/http-testing/test-builder/reply-step-builder.d.ts.map +1 -0
- package/dist/http-testing/test-builder/reply-step-builder.js +39 -0
- package/dist/http-testing/test-builder/reply-step-builder.js.map +1 -0
- package/dist/http-testing/test-builder/single-step-test-builder.d.ts +42 -0
- package/dist/http-testing/test-builder/single-step-test-builder.d.ts.map +1 -0
- package/dist/http-testing/test-builder/single-step-test-builder.js +112 -0
- package/dist/http-testing/test-builder/single-step-test-builder.js.map +1 -0
- package/dist/http-testing/validate/ajv.d.ts +3 -0
- package/dist/http-testing/validate/ajv.d.ts.map +1 -0
- package/dist/http-testing/validate/ajv.js +7 -0
- package/dist/http-testing/validate/ajv.js.map +1 -0
- package/dist/http-testing/validate/index.d.ts +9 -0
- package/dist/http-testing/validate/index.d.ts.map +1 -0
- package/dist/http-testing/validate/index.js +9 -0
- package/dist/http-testing/validate/index.js.map +1 -0
- package/dist/http-testing/validate/validate-body.d.ts +5 -0
- package/dist/http-testing/validate/validate-body.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-body.js +62 -0
- package/dist/http-testing/validate/validate-body.js.map +1 -0
- package/dist/http-testing/validate/validate-headers.d.ts +8 -0
- package/dist/http-testing/validate/validate-headers.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-headers.js +101 -0
- package/dist/http-testing/validate/validate-headers.js.map +1 -0
- package/dist/http-testing/validate/validate-request-body.d.ts +5 -0
- package/dist/http-testing/validate/validate-request-body.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-request-body.js +71 -0
- package/dist/http-testing/validate/validate-request-body.js.map +1 -0
- package/dist/http-testing/validate/validate-request-headers.d.ts +8 -0
- package/dist/http-testing/validate/validate-request-headers.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-request-headers.js +93 -0
- package/dist/http-testing/validate/validate-request-headers.js.map +1 -0
- package/dist/http-testing/validate/validate-request-path-parameters.d.ts +6 -0
- package/dist/http-testing/validate/validate-request-path-parameters.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-request-path-parameters.js +69 -0
- package/dist/http-testing/validate/validate-request-path-parameters.js.map +1 -0
- package/dist/http-testing/validate/validate-request-query-parameters.d.ts +7 -0
- package/dist/http-testing/validate/validate-request-query-parameters.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-request-query-parameters.js +91 -0
- package/dist/http-testing/validate/validate-request-query-parameters.js.map +1 -0
- package/dist/http-testing/validate/validate-response.d.ts +7 -0
- package/dist/http-testing/validate/validate-response.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-response.js +15 -0
- package/dist/http-testing/validate/validate-response.js.map +1 -0
- package/dist/http-testing/validate/validate-status-code.d.ts +3 -0
- package/dist/http-testing/validate/validate-status-code.d.ts.map +1 -0
- package/dist/http-testing/validate/validate-status-code.js +25 -0
- package/dist/http-testing/validate/validate-status-code.js.map +1 -0
- package/dist/http.d.ts +29 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +2 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/log-level.d.ts +5 -0
- package/dist/logger/log-level.d.ts.map +1 -0
- package/dist/logger/log-level.js +24 -0
- package/dist/logger/log-level.js.map +1 -0
- package/dist/logger/logger.d.ts +13 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +2 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logger/noop.logger.d.ts +15 -0
- package/dist/logger/noop.logger.d.ts.map +1 -0
- package/dist/logger/noop.logger.js +18 -0
- package/dist/logger/noop.logger.js.map +1 -0
- package/dist/logger/text.logger.d.ts +16 -0
- package/dist/logger/text.logger.d.ts.map +1 -0
- package/dist/logger/text.logger.js +51 -0
- package/dist/logger/text.logger.js.map +1 -0
- package/dist/report-sorter.d.ts +16 -0
- package/dist/report-sorter.d.ts.map +1 -0
- package/dist/report-sorter.js +193 -0
- package/dist/report-sorter.js.map +1 -0
- package/dist/rules/ajv-validate.d.ts +2 -0
- package/dist/rules/ajv-validate.d.ts.map +1 -0
- package/dist/rules/ajv-validate.js +4 -0
- package/dist/rules/ajv-validate.js.map +1 -0
- package/dist/rules/captured-trace-to-string.d.ts +3 -0
- package/dist/rules/captured-trace-to-string.d.ts.map +1 -0
- package/dist/rules/captured-trace-to-string.js +27 -0
- package/dist/rules/captured-trace-to-string.js.map +1 -0
- package/dist/rules/common-http-converters.d.ts +8 -0
- package/dist/rules/common-http-converters.d.ts.map +1 -0
- package/dist/rules/common-http-converters.js +58 -0
- package/dist/rules/common-http-converters.js.map +1 -0
- package/dist/rules/contexts.d.ts +63 -0
- package/dist/rules/contexts.d.ts.map +1 -0
- package/dist/rules/contexts.js +2 -0
- package/dist/rules/contexts.js.map +1 -0
- package/dist/rules/index.d.ts +16 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +16 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/rule-builder.d.ts +34 -0
- package/dist/rules/rule-builder.d.ts.map +1 -0
- package/dist/rules/rule-builder.js +112 -0
- package/dist/rules/rule-builder.js.map +1 -0
- package/dist/rules/rule-configuration.d.ts +10 -0
- package/dist/rules/rule-configuration.d.ts.map +1 -0
- package/dist/rules/rule-configuration.js +2 -0
- package/dist/rules/rule-configuration.js.map +1 -0
- package/dist/rules/rule-filter.d.ts +9 -0
- package/dist/rules/rule-filter.d.ts.map +1 -0
- package/dist/rules/rule-filter.js +12 -0
- package/dist/rules/rule-filter.js.map +1 -0
- package/dist/rules/rule-fn.d.ts +7 -0
- package/dist/rules/rule-fn.d.ts.map +1 -0
- package/dist/rules/rule-fn.js +2 -0
- package/dist/rules/rule-fn.js.map +1 -0
- package/dist/rules/rule-loader.d.ts +8 -0
- package/dist/rules/rule-loader.d.ts.map +1 -0
- package/dist/rules/rule-loader.js +124 -0
- package/dist/rules/rule-loader.js.map +1 -0
- package/dist/rules/rule-meta.d.ts +20 -0
- package/dist/rules/rule-meta.d.ts.map +1 -0
- package/dist/rules/rule-meta.js +18 -0
- package/dist/rules/rule-meta.js.map +1 -0
- package/dist/rules/rule-runner.d.ts +30 -0
- package/dist/rules/rule-runner.d.ts.map +1 -0
- package/dist/rules/rule-runner.js +129 -0
- package/dist/rules/rule-runner.js.map +1 -0
- package/dist/rules/rule-set.d.ts +9 -0
- package/dist/rules/rule-set.d.ts.map +1 -0
- package/dist/rules/rule-set.js +2 -0
- package/dist/rules/rule-set.js.map +1 -0
- package/dist/rules/rule-severity.d.ts +10 -0
- package/dist/rules/rule-severity.d.ts.map +1 -0
- package/dist/rules/rule-severity.js +12 -0
- package/dist/rules/rule-severity.js.map +1 -0
- package/dist/rules/rule-violation.d.ts +22 -0
- package/dist/rules/rule-violation.d.ts.map +1 -0
- package/dist/rules/rule-violation.js +2 -0
- package/dist/rules/rule-violation.js.map +1 -0
- package/dist/rules/rule.d.ts +10 -0
- package/dist/rules/rule.d.ts.map +1 -0
- package/dist/rules/rule.js +2 -0
- package/dist/rules/rule.js.map +1 -0
- package/dist/rules/traffic.d.ts +25 -0
- package/dist/rules/traffic.d.ts.map +1 -0
- package/dist/rules/traffic.js +2 -0
- package/dist/rules/traffic.js.map +1 -0
- package/dist/thymian-plugin.d.ts +38 -0
- package/dist/thymian-plugin.d.ts.map +1 -0
- package/dist/thymian-plugin.js +24 -0
- package/dist/thymian-plugin.js.map +1 -0
- package/dist/thymian.d.ts +85 -0
- package/dist/thymian.d.ts.map +1 -0
- package/dist/thymian.error.d.ts +26 -0
- package/dist/thymian.error.d.ts.map +1 -0
- package/dist/thymian.error.js +34 -0
- package/dist/thymian.error.js.map +1 -0
- package/dist/thymian.js +322 -0
- package/dist/thymian.js.map +1 -0
- package/dist/utils.d.ts +40 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +139 -0
- package/dist/utils.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { setHeader } from '../../index.js';
|
|
2
|
+
export function overrideTemplate(template, toRequest, value) {
|
|
3
|
+
switch (toRequest.type) {
|
|
4
|
+
case 'method':
|
|
5
|
+
template.method = value;
|
|
6
|
+
break;
|
|
7
|
+
case 'requestHeader':
|
|
8
|
+
if (typeof toRequest.header === 'undefined') {
|
|
9
|
+
break;
|
|
10
|
+
}
|
|
11
|
+
setHeader(template.headers, toRequest.header, value);
|
|
12
|
+
break;
|
|
13
|
+
case 'queryParam':
|
|
14
|
+
if (typeof toRequest.param === 'undefined') {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
setHeader(template.query, toRequest.param, value);
|
|
18
|
+
break;
|
|
19
|
+
case 'path':
|
|
20
|
+
template.path = value;
|
|
21
|
+
break;
|
|
22
|
+
case 'origin':
|
|
23
|
+
template.origin = value;
|
|
24
|
+
break;
|
|
25
|
+
case 'requestMediaType':
|
|
26
|
+
setHeader(template.headers, 'content-type', toRequest.mediaType);
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`Invalid expression type "${toRequest.type}".`);
|
|
30
|
+
}
|
|
31
|
+
return template;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=override-request-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"override-request-template.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/override-request-template.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,UAAU,gBAAgB,CAC9B,QAA6B,EAC7B,SAAkC,EAClC,KAAc;IAEd,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,QAAQ;YACX,QAAQ,CAAC,MAAM,GAAG,KAAe,CAAC;YAClC,MAAM;QACR,KAAK,eAAe;YAClB,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;gBAC5C,MAAM;YACR,CAAC;YAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACrD,MAAM;QACR,KAAK,YAAY;YACf,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;gBAC3C,MAAM;YACR,CAAC;YAED,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,MAAM;YACT,QAAQ,CAAC,IAAI,GAAG,KAAe,CAAC;YAChC,MAAM;QACR,KAAK,QAAQ;YACX,QAAQ,CAAC,MAAM,GAAG,KAAe,CAAC;YAClC,MAAM;QACR,KAAK,kBAAkB;YACrB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACjE,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Constant, type HttpResponse, type RequestFilterExpression, type ResponseFilterExpression } from '../../index.js';
|
|
2
|
+
import type { BuilderPipeline } from './builder-pipeline.js';
|
|
3
|
+
import type { RunOptions } from './single-step-test-builder.js';
|
|
4
|
+
export declare class ReplyStepBuilder {
|
|
5
|
+
protected readonly pipeline: BuilderPipeline;
|
|
6
|
+
set(toRequest: RequestFilterExpression, fromResponse: ResponseFilterExpression | Constant | ((response: HttpResponse) => unknown)): ReplyStepBuilder;
|
|
7
|
+
run(options?: RunOptions): ReplyStepBuilder;
|
|
8
|
+
done(): BuilderPipeline;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=reply-step-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply-step-builder.d.ts","sourceRoot":"","sources":["../../../src/http-testing/test-builder/reply-step-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,qBAAa,gBAAgB;IAC3B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAM;IAElD,GAAG,CACD,SAAS,EAAE,uBAAuB,EAClC,YAAY,EACR,wBAAwB,GACxB,QAAQ,GACR,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,GACxC,gBAAgB;IAgCnB,GAAG,CAAC,OAAO,GAAE,UAAe,GAAG,gBAAgB;IAM/C,IAAI,IAAI,eAAe;CAGxB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {} from '../../index.js';
|
|
2
|
+
import { overrideRequestWithPrevious, runRequests, } from '../operators/index.js';
|
|
3
|
+
import { extractValueFromResponse } from './extract-value-from-response.js';
|
|
4
|
+
import { overrideTemplate } from './override-request-template.js';
|
|
5
|
+
export class ReplyStepBuilder {
|
|
6
|
+
pipeline = [];
|
|
7
|
+
set(toRequest, fromResponse) {
|
|
8
|
+
const operator = overrideRequestWithPrevious((requestTemplate, previous) => {
|
|
9
|
+
const response = previous.transactions[0]?.response;
|
|
10
|
+
if (response) {
|
|
11
|
+
let extractedValue;
|
|
12
|
+
if (typeof fromResponse === 'function') {
|
|
13
|
+
extractedValue = fromResponse(response);
|
|
14
|
+
}
|
|
15
|
+
else if (fromResponse.type === 'constant') {
|
|
16
|
+
extractedValue = fromResponse.value;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
extractedValue = extractValueFromResponse(response, fromResponse);
|
|
20
|
+
}
|
|
21
|
+
if (extractedValue) {
|
|
22
|
+
return overrideTemplate(requestTemplate, toRequest, extractedValue);
|
|
23
|
+
}
|
|
24
|
+
return requestTemplate;
|
|
25
|
+
}
|
|
26
|
+
throw new Error('No response found to override template.');
|
|
27
|
+
});
|
|
28
|
+
this.pipeline.push(operator);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
run(options = {}) {
|
|
32
|
+
this.pipeline.push(runRequests(options));
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
done() {
|
|
36
|
+
return this.pipeline;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=reply-step-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply-step-builder.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/reply-step-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,gBAAgB,CAAC;AAExB,OAAO,E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C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HttpRequestTemplate } from '../../index.js';
|
|
2
|
+
import { type HttpFilterExpression, type RequestFilterExpression } from '../../index.js';
|
|
3
|
+
import { type GenerateRequestsOptions, type HttpTestCaseStepTransaction, type HttpTestPipeline } from '../http-test/index.js';
|
|
4
|
+
import { type RunRequestsOptions } from '../operators/index.js';
|
|
5
|
+
import type { BuilderPipeline } from './builder-pipeline.js';
|
|
6
|
+
import { ReplyStepBuilder } from './reply-step-builder.js';
|
|
7
|
+
export type RunOptions = GenerateRequestsOptions & Partial<RunRequestsOptions>;
|
|
8
|
+
export interface FilterTransactions {
|
|
9
|
+
forTransactionsWith(filter: HttpFilterExpression): RunRequests;
|
|
10
|
+
}
|
|
11
|
+
export interface RunRequests {
|
|
12
|
+
set(filter: RequestFilterExpression, value: unknown): RunRequests;
|
|
13
|
+
mapRequest(fn: (request: HttpRequestTemplate) => HttpRequestTemplate): RunRequests;
|
|
14
|
+
tap(fn: () => void): RunRequests;
|
|
15
|
+
run(options?: RunOptions): ExpectOrStep<[Required<HttpTestCaseStepTransaction>]>;
|
|
16
|
+
}
|
|
17
|
+
export interface ExpectOrStep<Transactions extends Required<HttpTestCaseStepTransaction>[]> {
|
|
18
|
+
expectForTransactions(...filters: HttpFilterExpression[]): ExpectOrStep<Transactions>;
|
|
19
|
+
replayStep(step: (step: ReplyStepBuilder) => BuilderPipeline): ExpectOrStep<[...Transactions, Required<HttpTestCaseStepTransaction>]>;
|
|
20
|
+
skipIf(expression: HttpFilterExpression, message?: string): ExpectOrStep<Transactions>;
|
|
21
|
+
done(): HttpTestPipeline<Record<PropertyKey, unknown>>;
|
|
22
|
+
transactions(fn: (transactions: Transactions) => void): ExpectOrStep<Transactions>;
|
|
23
|
+
}
|
|
24
|
+
export declare class SingleStepTestBuilder<Transactions extends Required<HttpTestCaseStepTransaction>[]> implements RunRequests, FilterTransactions, ExpectOrStep<Transactions> {
|
|
25
|
+
#private;
|
|
26
|
+
protected readonly pipeline: BuilderPipeline;
|
|
27
|
+
mapRequest(fn: (request: HttpRequestTemplate) => HttpRequestTemplate): SingleStepTestBuilder<Transactions>;
|
|
28
|
+
forTransactionsWith(filterExpression: HttpFilterExpression): RunRequests;
|
|
29
|
+
tap(fn: () => void): RunRequests;
|
|
30
|
+
set(filter: RequestFilterExpression, value: unknown): SingleStepTestBuilder<Transactions>;
|
|
31
|
+
skipIf(expression: HttpFilterExpression, message?: string): ExpectOrStep<Transactions>;
|
|
32
|
+
run(options?: RunOptions): SingleStepTestBuilder<[Required<HttpTestCaseStepTransaction>]>;
|
|
33
|
+
expectForTransactions(...filters: HttpFilterExpression[]): ExpectOrStep<Transactions>;
|
|
34
|
+
done(): HttpTestPipeline<Record<PropertyKey, unknown>>;
|
|
35
|
+
replayStep(step: (step: ReplyStepBuilder) => BuilderPipeline): SingleStepTestBuilder<[
|
|
36
|
+
...Transactions,
|
|
37
|
+
Required<HttpTestCaseStepTransaction>
|
|
38
|
+
]>;
|
|
39
|
+
transactions(fn: (transactions: Transactions) => void): SingleStepTestBuilder<Transactions>;
|
|
40
|
+
}
|
|
41
|
+
export declare function singleTestCase(): FilterTransactions;
|
|
42
|
+
//# sourceMappingURL=single-step-test-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-step-test-builder.d.ts","sourceRoot":"","sources":["../../../src/http-testing/test-builder/single-step-test-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,uBAAuB,EAE5B,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EAItB,MAAM,uBAAuB,C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;AAED,wBAAgB,cAAc,IAAI,kBAAkB,CAEnD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { filter, map, tap } from 'rxjs';
|
|
2
|
+
import { and, } from '../../index.js';
|
|
3
|
+
import { isFailedTestCase, isSkippedTestCase, } from '../http-test/index.js';
|
|
4
|
+
import { expectForTransactions, generateRequests, mapToTestCase, replayStep, runRequests, } from '../operators/index.js';
|
|
5
|
+
import { httpFilterToTransactionFilter } from './compilers/http-filter-to-transaction-filter.js';
|
|
6
|
+
import { compileResponseScopedToResponseChecker } from './compilers/response-scoped-to-response-checker.js';
|
|
7
|
+
import { compileResponseScopedExpressionToTransactionValidationFn } from './compilers/response-scoped-to-transaction-validator.js';
|
|
8
|
+
import { overrideTemplate } from './override-request-template.js';
|
|
9
|
+
import { ReplyStepBuilder } from './reply-step-builder.js';
|
|
10
|
+
export class SingleStepTestBuilder {
|
|
11
|
+
pipeline = [];
|
|
12
|
+
#requestOverrides = [];
|
|
13
|
+
mapRequest(fn) {
|
|
14
|
+
const operator = map(({ current, ctx }) => {
|
|
15
|
+
if (current.steps[0]?.transactions[0]) {
|
|
16
|
+
current.steps[0].transactions[0].requestTemplate = fn(current.steps[0].transactions[0].requestTemplate);
|
|
17
|
+
}
|
|
18
|
+
return { current, ctx };
|
|
19
|
+
});
|
|
20
|
+
this.#requestOverrides.push(operator);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
forTransactionsWith(filterExpression) {
|
|
24
|
+
this.pipeline.push(filter(({ current, ctx }) => {
|
|
25
|
+
const filterFn = httpFilterToTransactionFilter(filterExpression, ctx.format);
|
|
26
|
+
const responses = ctx.format.getNeighboursOfType(current.thymianReqId, 'http-response');
|
|
27
|
+
return filterFn(current.thymianReq, current.thymianReqId, current.thymianRes, current.thymianResId, responses);
|
|
28
|
+
}));
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
tap(fn) {
|
|
32
|
+
this.pipeline.push(tap(fn));
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
set(filter, value) {
|
|
36
|
+
const operator = map(({ current, ctx }) => {
|
|
37
|
+
if (current.steps[0]?.transactions[0]) {
|
|
38
|
+
current.steps[0].transactions[0].requestTemplate = overrideTemplate(current.steps[0].transactions[0].requestTemplate, filter, value);
|
|
39
|
+
}
|
|
40
|
+
return { current, ctx };
|
|
41
|
+
});
|
|
42
|
+
this.#requestOverrides.push(operator);
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
skipIf(expression, message) {
|
|
46
|
+
const operator = map(({ current, ctx }) => {
|
|
47
|
+
if (isSkippedTestCase(current) || isFailedTestCase(current)) {
|
|
48
|
+
return { current, ctx };
|
|
49
|
+
}
|
|
50
|
+
const step = current.steps.at(-1);
|
|
51
|
+
if (step) {
|
|
52
|
+
const response = step.transactions[0]?.response;
|
|
53
|
+
if (response &&
|
|
54
|
+
compileResponseScopedToResponseChecker(expression, response)) {
|
|
55
|
+
return ctx.skip(current, message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { current, ctx };
|
|
59
|
+
});
|
|
60
|
+
this.pipeline.push(operator);
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
run(options = {}) {
|
|
64
|
+
this.pipeline.push(mapToTestCase(), generateRequests(options), ...this.#requestOverrides, runRequests(options));
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
expectForTransactions(...filters) {
|
|
68
|
+
const validate = compileResponseScopedExpressionToTransactionValidationFn(and(...filters));
|
|
69
|
+
const fn = expectForTransactions((transaction) => validate(transaction));
|
|
70
|
+
this.pipeline.push(fn);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
done() {
|
|
74
|
+
return (transactions) => transactions.pipe(
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
76
|
+
// @ts-expect-error
|
|
77
|
+
...this.pipeline);
|
|
78
|
+
}
|
|
79
|
+
replayStep(step) {
|
|
80
|
+
this.pipeline.push(replayStep((step1) => step1.pipe(
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
82
|
+
// @ts-expect-error
|
|
83
|
+
...step(new ReplyStepBuilder()))));
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
transactions(fn) {
|
|
87
|
+
const operator = map(({ current, ctx }) => {
|
|
88
|
+
if (isSkippedTestCase(current) || isFailedTestCase(current)) {
|
|
89
|
+
return { current, ctx };
|
|
90
|
+
}
|
|
91
|
+
const transactions = current.steps.flatMap((step) => step.transactions);
|
|
92
|
+
try {
|
|
93
|
+
fn(transactions);
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
if (e instanceof Error) {
|
|
97
|
+
return ctx.fail(current, e.message);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return ctx.fail(current, 'unknown error.');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { current, ctx };
|
|
104
|
+
});
|
|
105
|
+
this.pipeline.push(operator);
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export function singleTestCase() {
|
|
110
|
+
return new SingleStepTestBuilder();
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=single-step-test-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-step-test-builder.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/single-step-test-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAiC,GAAG,EAAE,MAAM,MAAM,CAAC;AAMvE,OAAO,EACL,GAAG,GAGJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,WAAW,GAEZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,E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C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,GAAG,SAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../../src/http-testing/validate/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;AAEjC,6DAA6D;AAC7D,mBAAmB;AACnB,UAAU,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './validate-body.js';
|
|
2
|
+
export * from './validate-headers.js';
|
|
3
|
+
export * from './validate-request-body.js';
|
|
4
|
+
export * from './validate-request-headers.js';
|
|
5
|
+
export * from './validate-request-path-parameters.js';
|
|
6
|
+
export * from './validate-request-query-parameters.js';
|
|
7
|
+
export * from './validate-response.js';
|
|
8
|
+
export * from './validate-status-code.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './validate-body.js';
|
|
2
|
+
export * from './validate-headers.js';
|
|
3
|
+
export * from './validate-request-body.js';
|
|
4
|
+
export * from './validate-request-headers.js';
|
|
5
|
+
export * from './validate-request-path-parameters.js';
|
|
6
|
+
export * from './validate-request-query-parameters.js';
|
|
7
|
+
export * from './validate-response.js';
|
|
8
|
+
export * from './validate-status-code.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http-testing/validate/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ThymianHttpResponse } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare function validateJsonBody(body: string, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
4
|
+
export declare function validateBodyForResponse(body: string | undefined, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
5
|
+
//# sourceMappingURL=validate-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-body.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CA8CtB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAiBtB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { parse } from 'secure-json-parse';
|
|
2
|
+
import { ajv } from './ajv.js';
|
|
3
|
+
export function validateJsonBody(body, response) {
|
|
4
|
+
try {
|
|
5
|
+
const json = parse(body);
|
|
6
|
+
if (!response.schema) {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
type: 'info',
|
|
10
|
+
message: 'No response schema is provided.',
|
|
11
|
+
details: '',
|
|
12
|
+
timestamp: Date.now(),
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
const validate = ajv.compile(response.schema);
|
|
17
|
+
validate(json);
|
|
18
|
+
if (validate.errors) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
type: 'assertion-failure',
|
|
22
|
+
message: `Invalid response body: ${validate.errors.map((err) => err.instancePath + ' ' + err.message).join(', ')}`,
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
type: 'assertion-success',
|
|
30
|
+
message: 'Valid response body.',
|
|
31
|
+
timestamp: Date.now(),
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
type: 'assertion-failure',
|
|
40
|
+
message: 'Response body is not valid JSON.',
|
|
41
|
+
timestamp: Date.now(),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function validateBodyForResponse(body, response) {
|
|
47
|
+
if (typeof body === 'undefined') {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
if (/^application\/[^+]*[+]?(json);?.*/.test(response.mediaType)) {
|
|
51
|
+
return validateJsonBody(body, response);
|
|
52
|
+
}
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
type: 'info',
|
|
56
|
+
message: 'Non JSON response body cannot be validated.',
|
|
57
|
+
timestamp: Date.now(),
|
|
58
|
+
details: '',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=validate-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-body.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,QAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO;gBACL;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,iCAAiC;oBAC1C,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE9C,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO;gBACL;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,0BAA0B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,GAAG,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBAClH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,sBAAsB;gBAC/B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB;SACF,CAAC;QACF,6DAA6D;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,kCAAkC;gBAC3C,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,IAAwB,EACxB,QAA6B;IAE7B,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,mCAAmC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACjE,OAAO,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,6CAA6C;YACtD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;SACZ;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ThymianHttpResponse } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare const commonHttpHeaders: readonly ["date", "content-length", "transfer-encoding", "content-type", "connection", "server", "vary", "content-encoding", "access-control-allow-origin", "access-control-allow-headers", "access-control-allow-methods", "access-control-expose-headers", "access-control-max-age", "set-cookie", "strict-transport-security", "x-powered-by", "keep-alive", "cross-origin-opener-policy", "content-security-policy", "cross-origin-opener-policy", "origin-agent-cluster", "referrer-policy", "x-content-type-options", "x-dns-prefetch-control", "x-download-options", "x-frame-options", "x-permitted-cross-domain-policies", "x-xss-protection"];
|
|
4
|
+
export declare function checkForMissingHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
5
|
+
export declare function checkForAdditionalHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
6
|
+
export declare function validateExistingHeader(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
7
|
+
export declare function validateHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
|
|
8
|
+
//# sourceMappingURL=validate-headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-headers.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,eAAO,MAAM,iBAAiB,ynBA6BpB,CAAC;AAKX,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAatB;AAGD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAoBtB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAMtB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { getHeader, objHasKeyIgnoreCase, } from '../../index.js';
|
|
2
|
+
import { ajv } from './ajv.js';
|
|
3
|
+
export const commonHttpHeaders = [
|
|
4
|
+
'date',
|
|
5
|
+
'content-length',
|
|
6
|
+
'transfer-encoding',
|
|
7
|
+
'content-type',
|
|
8
|
+
'connection',
|
|
9
|
+
'server',
|
|
10
|
+
'vary',
|
|
11
|
+
'content-encoding',
|
|
12
|
+
'access-control-allow-origin',
|
|
13
|
+
'access-control-allow-headers',
|
|
14
|
+
'access-control-allow-methods',
|
|
15
|
+
'access-control-expose-headers',
|
|
16
|
+
'access-control-max-age',
|
|
17
|
+
'set-cookie',
|
|
18
|
+
'strict-transport-security',
|
|
19
|
+
'x-powered-by',
|
|
20
|
+
'keep-alive',
|
|
21
|
+
'cross-origin-opener-policy',
|
|
22
|
+
'content-security-policy',
|
|
23
|
+
'cross-origin-opener-policy',
|
|
24
|
+
'origin-agent-cluster',
|
|
25
|
+
'referrer-policy',
|
|
26
|
+
'x-content-type-options',
|
|
27
|
+
'x-dns-prefetch-control',
|
|
28
|
+
'x-download-options',
|
|
29
|
+
'x-frame-options',
|
|
30
|
+
'x-permitted-cross-domain-policies',
|
|
31
|
+
'x-xss-protection',
|
|
32
|
+
];
|
|
33
|
+
const commonHeadersSet = new Set(commonHttpHeaders);
|
|
34
|
+
// checks if the response is missing required headers
|
|
35
|
+
export function checkForMissingHeaders(headers, response) {
|
|
36
|
+
return Object.entries(response.headers).reduce((acc, [name, header]) => {
|
|
37
|
+
const value = getHeader(headers, name);
|
|
38
|
+
if (!value && header.required) {
|
|
39
|
+
acc.push({
|
|
40
|
+
type: 'assertion-failure',
|
|
41
|
+
message: `Header "${name}" is required but not included in the response.`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return acc;
|
|
45
|
+
}, []);
|
|
46
|
+
}
|
|
47
|
+
// Are there headers included in the response that are not in the description format?
|
|
48
|
+
export function checkForAdditionalHeaders(headers, response) {
|
|
49
|
+
const failures = Object.keys(headers)
|
|
50
|
+
.filter((headerName) => !objHasKeyIgnoreCase(response.headers, headerName) &&
|
|
51
|
+
!commonHeadersSet.has(headerName.toLowerCase()))
|
|
52
|
+
.map((headerName) => ({
|
|
53
|
+
type: 'assertion-failure',
|
|
54
|
+
message: `Response contains header "${headerName}" that is not included in the description format.`,
|
|
55
|
+
}));
|
|
56
|
+
return failures.length > 0
|
|
57
|
+
? failures
|
|
58
|
+
: [
|
|
59
|
+
{
|
|
60
|
+
type: 'assertion-success',
|
|
61
|
+
message: `Response does not contain additional headers that are included in the description format.`,
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
export function validateExistingHeader(headers, response) {
|
|
66
|
+
return Object.entries(headers)
|
|
67
|
+
.filter(([name]) => Object.hasOwn(response.headers, name))
|
|
68
|
+
.map(([name, value]) => {
|
|
69
|
+
if (response.headers[name]?.schema) {
|
|
70
|
+
const validate = ajv.compile(response.headers[name]?.schema);
|
|
71
|
+
validate(value);
|
|
72
|
+
if (validate.errors) {
|
|
73
|
+
return {
|
|
74
|
+
type: 'assertion-failure',
|
|
75
|
+
message: `Invalid value for header ${name}: ${validate.errors.map((err) => err.message).join(', ')}.`,
|
|
76
|
+
timestamp: Date.now(),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
return {
|
|
81
|
+
type: 'assertion-success',
|
|
82
|
+
message: `Valid header ${name}.`,
|
|
83
|
+
timestamp: Date.now(),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
type: 'info',
|
|
89
|
+
message: `No schema provided for header ${name}.`,
|
|
90
|
+
timestamp: Date.now(),
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function validateHeaders(headers, response) {
|
|
95
|
+
return [
|
|
96
|
+
...checkForMissingHeaders(headers, response),
|
|
97
|
+
...checkForAdditionalHeaders(headers, response),
|
|
98
|
+
...validateExistingHeader(headers, response),
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=validate-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-headers.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,kBAAkB;IAClB,6BAA6B;IAC7B,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;IAC/B,wBAAwB;IACxB,YAAY;IACZ,2BAA2B;IAC3B,cAAc;IACd,YAAY;IACZ,4BAA4B;IAC5B,yBAAyB;IACzB,4BAA4B;IAC5B,sBAAsB;IACtB,iBAAiB;IACjB,wBAAwB;IACxB,wBAAwB;IACxB,oBAAoB;IACpB,iBAAiB;IACjB,mCAAmC;IACnC,kBAAkB;CACV,CAAC;AAEX,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,iBAAiB,CAAC,CAAC;AAE5D,qDAAqD;AACrD,MAAM,UAAU,sBAAsB,CACpC,OAAsD,EACtD,QAA6B;IAE7B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;QACrE,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAEvC,IA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M,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAE7D,QAAQ,CAAC,KAAK,CAAC,CAAC;YAEhB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,4BAA4B,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;oBACrG,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,gBAAgB,IAAI,GAAG;oBAChC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,iCAAiC,IAAI,GAAG;YACjD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAsD,EACtD,QAA6B;IAE7B,OAAO;QACL,GAAG,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC5C,GAAG,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC/C,GAAG,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ThymianHttpRequest } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare function validateJsonRequestBody(body: string, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
4
|
+
export declare function validateBodyForRequest(body: string | undefined, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
5
|
+
//# sourceMappingURL=validate-request-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-body.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8CtB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA2BtB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parse } from 'secure-json-parse';
|
|
2
|
+
import { ajv } from './ajv.js';
|
|
3
|
+
export function validateJsonRequestBody(body, request) {
|
|
4
|
+
try {
|
|
5
|
+
const json = parse(body);
|
|
6
|
+
if (!request.body) {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
type: 'info',
|
|
10
|
+
message: 'No request body schema is provided.',
|
|
11
|
+
details: '',
|
|
12
|
+
timestamp: Date.now(),
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
const validate = ajv.compile(request.body);
|
|
17
|
+
validate(json);
|
|
18
|
+
if (validate.errors) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
type: 'assertion-failure',
|
|
22
|
+
message: `Invalid request body: ${validate.errors.map((err) => err.instancePath + ' ' + err.message).join(', ')}`,
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
type: 'assertion-success',
|
|
30
|
+
message: 'Valid request body.',
|
|
31
|
+
timestamp: Date.now(),
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
type: 'assertion-failure',
|
|
40
|
+
message: 'Request body is not valid JSON.',
|
|
41
|
+
timestamp: Date.now(),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function validateBodyForRequest(body, request) {
|
|
47
|
+
if (typeof body === 'undefined') {
|
|
48
|
+
if (request.bodyRequired) {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
type: 'assertion-failure',
|
|
52
|
+
message: 'Request body is required but not provided.',
|
|
53
|
+
timestamp: Date.now(),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
if (/^application\/[^+]*[+]?(json);?.*/.test(request.mediaType)) {
|
|
60
|
+
return validateJsonRequestBody(body, request);
|
|
61
|
+
}
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
type: 'info',
|
|
65
|
+
message: 'Non JSON request body cannot be validated.',
|
|
66
|
+
timestamp: Date.now(),
|
|
67
|
+
details: '',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=validate-request-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-body.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,OAA2B;IAE3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,CAAC;YACzB,OAAO;gBACL;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,4CAA4C;oBACrD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,mCAAmC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAChE,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,4CAA4C;YACrD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;SACZ;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ThymianHttpRequest } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare const commonRequestHeaders: readonly ["accept", "accept-charset", "accept-encoding", "accept-language", "authorization", "cache-control", "connection", "content-length", "content-type", "cookie", "host", "origin", "referer", "user-agent", "te", "upgrade", "via", "x-forwarded-for", "x-forwarded-host", "x-forwarded-proto", "x-request-id", "x-correlation-id"];
|
|
4
|
+
export declare function checkForMissingRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
5
|
+
export declare function checkForAdditionalRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
6
|
+
export declare function validateExistingRequestHeader(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
7
|
+
export declare function validateRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
8
|
+
//# sourceMappingURL=validate-request-headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-headers.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,eAAO,MAAM,oBAAoB,4UAuBvB,CAAC;AAIX,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAatB;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAoBtB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAMtB"}
|