@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,93 @@
|
|
|
1
|
+
import { getHeader, objHasKeyIgnoreCase, } from '../../index.js';
|
|
2
|
+
import { ajv } from './ajv.js';
|
|
3
|
+
export const commonRequestHeaders = [
|
|
4
|
+
'accept',
|
|
5
|
+
'accept-charset',
|
|
6
|
+
'accept-encoding',
|
|
7
|
+
'accept-language',
|
|
8
|
+
'authorization',
|
|
9
|
+
'cache-control',
|
|
10
|
+
'connection',
|
|
11
|
+
'content-length',
|
|
12
|
+
'content-type',
|
|
13
|
+
'cookie',
|
|
14
|
+
'host',
|
|
15
|
+
'origin',
|
|
16
|
+
'referer',
|
|
17
|
+
'user-agent',
|
|
18
|
+
'te',
|
|
19
|
+
'upgrade',
|
|
20
|
+
'via',
|
|
21
|
+
'x-forwarded-for',
|
|
22
|
+
'x-forwarded-host',
|
|
23
|
+
'x-forwarded-proto',
|
|
24
|
+
'x-request-id',
|
|
25
|
+
'x-correlation-id',
|
|
26
|
+
];
|
|
27
|
+
const commonRequestHeadersSet = new Set(commonRequestHeaders);
|
|
28
|
+
export function checkForMissingRequestHeaders(headers, request) {
|
|
29
|
+
return Object.entries(request.headers).reduce((acc, [name, header]) => {
|
|
30
|
+
const value = getHeader(headers, name);
|
|
31
|
+
if (!value && header.required) {
|
|
32
|
+
acc.push({
|
|
33
|
+
type: 'assertion-failure',
|
|
34
|
+
message: `Header "${name}" is required but not included in the request.`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return acc;
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
export function checkForAdditionalRequestHeaders(headers, request) {
|
|
41
|
+
const failures = Object.keys(headers)
|
|
42
|
+
.filter((headerName) => !objHasKeyIgnoreCase(request.headers, headerName) &&
|
|
43
|
+
!commonRequestHeadersSet.has(headerName.toLowerCase()))
|
|
44
|
+
.map((headerName) => ({
|
|
45
|
+
type: 'assertion-failure',
|
|
46
|
+
message: `Request contains header "${headerName}" that is not included in the description format.`,
|
|
47
|
+
}));
|
|
48
|
+
return failures.length > 0
|
|
49
|
+
? failures
|
|
50
|
+
: [
|
|
51
|
+
{
|
|
52
|
+
type: 'assertion-success',
|
|
53
|
+
message: `Request does not contain additional headers that are not included in the description format.`,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
export function validateExistingRequestHeader(headers, request) {
|
|
58
|
+
return Object.entries(headers)
|
|
59
|
+
.filter(([name]) => Object.hasOwn(request.headers, name))
|
|
60
|
+
.map(([name, value]) => {
|
|
61
|
+
if (request.headers[name]?.schema) {
|
|
62
|
+
const validate = ajv.compile(request.headers[name]?.schema);
|
|
63
|
+
validate(value);
|
|
64
|
+
if (validate.errors) {
|
|
65
|
+
return {
|
|
66
|
+
type: 'assertion-failure',
|
|
67
|
+
message: `Invalid value for request header ${name}: ${validate.errors.map((err) => err.message).join(', ')}.`,
|
|
68
|
+
timestamp: Date.now(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return {
|
|
73
|
+
type: 'assertion-success',
|
|
74
|
+
message: `Valid request header ${name}.`,
|
|
75
|
+
timestamp: Date.now(),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
type: 'info',
|
|
81
|
+
message: `No schema provided for request header ${name}.`,
|
|
82
|
+
timestamp: Date.now(),
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export function validateRequestHeaders(headers, request) {
|
|
87
|
+
return [
|
|
88
|
+
...checkForMissingRequestHeaders(headers, request),
|
|
89
|
+
...checkForAdditionalRequestHeaders(headers, request),
|
|
90
|
+
...validateExistingRequestHeader(headers, request),
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=validate-request-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-headers.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-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,oBAAoB,GAAG;IAClC,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,IAAI;IACJ,SAAS;IACT,KAAK;IACL,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,cAAc;IACd,kBAAkB;CACV,CAAC;AAEX,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,oBAAoB,CAAC,CAAC;AAEtE,MAAM,UAAU,6BAA6B,CAC3C,OAAsD,EACtD,OAA2B;IAE3B,OAAO,MAAM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AC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ThymianHttpRequest } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare function checkForMissingPathParameters(pathParams: Record<string, string>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
4
|
+
export declare function validateExistingPathParameter(pathParams: Record<string, string>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
5
|
+
export declare function validateRequestPathParameters(actualPath: string, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
6
|
+
//# sourceMappingURL=validate-request-path-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-path-parameters.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-path-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAqBhE,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAWtB;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAiBtB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { match } from 'path-to-regexp';
|
|
2
|
+
import { ajv } from './ajv.js';
|
|
3
|
+
function extractPathParameters(actualPath, templatePath) {
|
|
4
|
+
const pathWithoutQuery = actualPath.split('?')[0] ?? actualPath;
|
|
5
|
+
const normalizedTemplate = templatePath.replaceAll(/{([^}]+)}/gi, ':$1');
|
|
6
|
+
const matchFn = match(normalizedTemplate);
|
|
7
|
+
const result = matchFn(pathWithoutQuery);
|
|
8
|
+
if (!result) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return Object.fromEntries(Object.entries(result.params).map(([key, value]) => [key, String(value)]));
|
|
12
|
+
}
|
|
13
|
+
export function checkForMissingPathParameters(pathParams, request) {
|
|
14
|
+
return Object.entries(request.pathParameters).reduce((acc, [name, param]) => {
|
|
15
|
+
if (!(name in pathParams) && param.required) {
|
|
16
|
+
acc.push({
|
|
17
|
+
type: 'assertion-failure',
|
|
18
|
+
message: `Path parameter "${name}" is required but not included in the request path.`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return acc;
|
|
22
|
+
}, []);
|
|
23
|
+
}
|
|
24
|
+
export function validateExistingPathParameter(pathParams, request) {
|
|
25
|
+
return Object.entries(pathParams)
|
|
26
|
+
.filter(([name]) => Object.hasOwn(request.pathParameters, name))
|
|
27
|
+
.map(([name, value]) => {
|
|
28
|
+
if (request.pathParameters[name]?.schema) {
|
|
29
|
+
const validate = ajv.compile(request.pathParameters[name]?.schema);
|
|
30
|
+
validate(value);
|
|
31
|
+
if (validate.errors) {
|
|
32
|
+
return {
|
|
33
|
+
type: 'assertion-failure',
|
|
34
|
+
message: `Invalid value for path parameter "${name}": ${validate.errors.map((err) => err.message).join(', ')}.`,
|
|
35
|
+
timestamp: Date.now(),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return {
|
|
40
|
+
type: 'assertion-success',
|
|
41
|
+
message: `Valid path parameter "${name}".`,
|
|
42
|
+
timestamp: Date.now(),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
type: 'info',
|
|
48
|
+
message: `No schema provided for path parameter "${name}".`,
|
|
49
|
+
timestamp: Date.now(),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function validateRequestPathParameters(actualPath, request) {
|
|
54
|
+
const pathParams = extractPathParameters(actualPath, request.path);
|
|
55
|
+
if (!pathParams) {
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
type: 'assertion-failure',
|
|
59
|
+
message: `Request path "${actualPath}" does not match the template path "${request.path}".`,
|
|
60
|
+
timestamp: Date.now(),
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
return [
|
|
65
|
+
...checkForMissingPathParameters(pathParams, request),
|
|
66
|
+
...validateExistingPathParameter(pathParams, request),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=validate-request-path-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-path-parameters.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-path-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,SAAS,qBAAqB,CAC5B,UAAkB,EAClB,YAAoB;IAEpB,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;IAChE,MAAM,kBAAkB,GAAG,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,C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AG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;oBAC/G,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,yBAAyB,IAAI,IAAI;oBAC1C,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,0CAA0C,IAAI,IAAI;YAC3D,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,UAAkB,EAClB,OAA2B;IAE3B,MAAM,UAAU,GAAG,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,iBAAiB,UAAU,uCAAuC,OAAO,CAAC,IAAI,IAAI;gBAC3F,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,6BAA6B,CAAC,UAAU,EAAE,OAAO,CAAC;QACrD,GAAG,6BAA6B,CAAC,UAAU,EAAE,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThymianHttpRequest } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare function checkForMissingQueryParameters(queryParams: Record<string, string | string[]>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
4
|
+
export declare function checkForAdditionalQueryParameters(queryParams: Record<string, string | string[]>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
5
|
+
export declare function validateExistingQueryParameter(queryParams: Record<string, string | string[]>, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
6
|
+
export declare function validateRequestQueryParameters(path: string, request: ThymianHttpRequest): HttpTestCaseResult[];
|
|
7
|
+
//# sourceMappingURL=validate-request-query-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-query-parameters.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-query-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAqChE,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC9C,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CActB;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC9C,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAgBtB;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC9C,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAStB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ajv } from './ajv.js';
|
|
2
|
+
function parseQueryString(queryString) {
|
|
3
|
+
const params = {};
|
|
4
|
+
if (!queryString) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
for (const part of queryString.split('&')) {
|
|
8
|
+
const [key, value] = part.split('=');
|
|
9
|
+
if (!key) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const decodedKey = decodeURIComponent(key);
|
|
13
|
+
const decodedValue = value ? decodeURIComponent(value) : '';
|
|
14
|
+
if (params[decodedKey]) {
|
|
15
|
+
params[decodedKey].push(decodedValue);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
params[decodedKey] = [decodedValue];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return Object.fromEntries(Object.entries(params).map(([key, values]) => [
|
|
22
|
+
key,
|
|
23
|
+
values.length === 1 ? values[0] : values,
|
|
24
|
+
]));
|
|
25
|
+
}
|
|
26
|
+
export function checkForMissingQueryParameters(queryParams, request) {
|
|
27
|
+
return Object.entries(request.queryParameters).reduce((acc, [name, param]) => {
|
|
28
|
+
if (!(name in queryParams) && param.required) {
|
|
29
|
+
acc.push({
|
|
30
|
+
type: 'assertion-failure',
|
|
31
|
+
message: `Query parameter "${name}" is required but not included in the request.`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return acc;
|
|
35
|
+
}, []);
|
|
36
|
+
}
|
|
37
|
+
export function checkForAdditionalQueryParameters(queryParams, request) {
|
|
38
|
+
const failures = Object.keys(queryParams)
|
|
39
|
+
.filter((name) => !Object.hasOwn(request.queryParameters, name))
|
|
40
|
+
.map((name) => ({
|
|
41
|
+
type: 'assertion-failure',
|
|
42
|
+
message: `Request contains query parameter "${name}" that is not included in the description format.`,
|
|
43
|
+
}));
|
|
44
|
+
return failures.length > 0
|
|
45
|
+
? failures
|
|
46
|
+
: [
|
|
47
|
+
{
|
|
48
|
+
type: 'assertion-success',
|
|
49
|
+
message: `Request does not contain additional query parameters that are not included in the description format.`,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
export function validateExistingQueryParameter(queryParams, request) {
|
|
54
|
+
return Object.entries(queryParams)
|
|
55
|
+
.filter(([name]) => Object.hasOwn(request.queryParameters, name))
|
|
56
|
+
.map(([name, value]) => {
|
|
57
|
+
if (request.queryParameters[name]?.schema) {
|
|
58
|
+
const validate = ajv.compile(request.queryParameters[name]?.schema);
|
|
59
|
+
validate(value);
|
|
60
|
+
if (validate.errors) {
|
|
61
|
+
return {
|
|
62
|
+
type: 'assertion-failure',
|
|
63
|
+
message: `Invalid value for query parameter "${name}": ${validate.errors.map((err) => err.message).join(', ')}.`,
|
|
64
|
+
timestamp: Date.now(),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return {
|
|
69
|
+
type: 'assertion-success',
|
|
70
|
+
message: `Valid query parameter "${name}".`,
|
|
71
|
+
timestamp: Date.now(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
type: 'info',
|
|
77
|
+
message: `No schema provided for query parameter "${name}".`,
|
|
78
|
+
timestamp: Date.now(),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function validateRequestQueryParameters(path, request) {
|
|
83
|
+
const queryString = path.includes('?') ? (path.split('?')[1] ?? '') : '';
|
|
84
|
+
const queryParams = parseQueryString(queryString);
|
|
85
|
+
return [
|
|
86
|
+
...checkForMissingQueryParameters(queryParams, request),
|
|
87
|
+
...checkForAdditionalQueryParameters(queryParams, request),
|
|
88
|
+
...validateExistingQueryParameter(queryParams, request),
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=validate-request-query-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-query-parameters.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-query-parameters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,SAAS,gBAAgB,CACvB,WAAmB;IAEnB,MAAM,MAAM,GAA6B,EAAE,CAAC;IAE5C,IAAI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+
import type { HttpResponse, ThymianHttpResponse } from '../../index.js';
|
|
2
|
+
import type { HttpTestCaseResult } from '../http-test/index.js';
|
|
3
|
+
export declare function validateResponse(response: ThymianHttpResponse, actualResponse: HttpResponse, availableResponses: ThymianHttpResponse[]): {
|
|
4
|
+
valid: boolean;
|
|
5
|
+
results: HttpTestCaseResult[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=validate-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-response.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAKhE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,mBAAmB,EAC7B,cAAc,EAAE,YAAY,EAC5B,kBAAkB,EAAE,mBAAmB,EAAE,GACxC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAenD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { validateBodyForResponse } from './validate-body.js';
|
|
2
|
+
import { validateHeaders } from './validate-headers.js';
|
|
3
|
+
import { validateStatusCode } from './validate-status-code.js';
|
|
4
|
+
export function validateResponse(response, actualResponse, availableResponses) {
|
|
5
|
+
const results = [
|
|
6
|
+
validateStatusCode(response.statusCode, actualResponse.statusCode, availableResponses.map(({ statusCode }) => statusCode)),
|
|
7
|
+
...validateBodyForResponse(actualResponse.body, response),
|
|
8
|
+
...validateHeaders(actualResponse.headers, response),
|
|
9
|
+
];
|
|
10
|
+
return {
|
|
11
|
+
results,
|
|
12
|
+
valid: !results.some((r) => r.type === 'assertion-failure'),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=validate-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-response.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,UAAU,gBAAgB,CAC9B,QAA6B,EAC7B,cAA4B,EAC5B,kBAAyC;IAEzC,MAAM,OAAO,GAAG;QACd,kBAAkB,CAChB,QAAQ,CAAC,UAAU,EACnB,cAAc,CAAC,UAAU,EACzB,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,CACvD;QACD,GAAG,uBAAuB,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC;QACzD,GAAG,eAAe,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC;KACrD,CAAC;IAEF,OAAO;QACL,OAAO;QACP,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-status-code.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-status-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAAE,GAC7B,kBAAkB,CAuBpB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function validateStatusCode(statusCode, actualStatusCode, availableStatusCodes) {
|
|
2
|
+
if (statusCode !== actualStatusCode) {
|
|
3
|
+
if (!availableStatusCodes.includes(statusCode)) {
|
|
4
|
+
return {
|
|
5
|
+
type: 'assertion-failure',
|
|
6
|
+
message: `Expected status code ${statusCode}, but received ${actualStatusCode}, which is not included in the documented status codes: ${availableStatusCodes.join(', ')}.`,
|
|
7
|
+
expected: statusCode,
|
|
8
|
+
actual: actualStatusCode,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
type: 'assertion-failure',
|
|
13
|
+
message: `Expected status code ${statusCode}, but received ${actualStatusCode}.`,
|
|
14
|
+
expected: statusCode,
|
|
15
|
+
actual: actualStatusCode,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return {
|
|
20
|
+
type: 'assertion-success',
|
|
21
|
+
message: `Expected and received status code ${statusCode}.`,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=validate-status-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-status-code.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-status-code.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAChC,UAAkB,EAClB,gBAAwB,EACxB,oBAA8B;IAE9B,IAAI,UAAU,KAAK,gBAAgB,EAAE,CAAC;QACpC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/C,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,wBAAwB,UAAU,kBAAkB,gBAAgB,2DAA2D,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAC1K,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,gBAAgB;aACzB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,wBAAwB,UAAU,kBAAkB,gBAAgB,GAAG;YAChF,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,gBAAgB;SACzB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,qCAAqC,UAAU,GAAG;SAC5D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type HttpRequest = {
|
|
2
|
+
origin: string;
|
|
3
|
+
path: string;
|
|
4
|
+
method: string;
|
|
5
|
+
bodyEncoding?: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
8
|
+
};
|
|
9
|
+
export type HttpRequestTemplate = {
|
|
10
|
+
origin: string;
|
|
11
|
+
path: string;
|
|
12
|
+
pathParameters: Record<string, unknown>;
|
|
13
|
+
method: string;
|
|
14
|
+
query: Record<string, unknown>;
|
|
15
|
+
authorize: boolean;
|
|
16
|
+
bodyEncoding?: string;
|
|
17
|
+
body?: unknown;
|
|
18
|
+
headers: Record<string, unknown>;
|
|
19
|
+
cookies: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
export type HttpResponse = {
|
|
22
|
+
statusCode: number;
|
|
23
|
+
headers: Record<string, string | string[] | undefined>;
|
|
24
|
+
body?: string;
|
|
25
|
+
bodyEncoding?: string;
|
|
26
|
+
trailers: Record<string, string>;
|
|
27
|
+
duration: number;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/dist/http.js
ADDED
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './actions/index.js';
|
|
2
|
+
export * from './ajv.js';
|
|
3
|
+
export * as chalk from './chalk.js';
|
|
4
|
+
export * from './constants.js';
|
|
5
|
+
export * from './emitter/index.js';
|
|
6
|
+
export * from './emitter/thymian-emitter.js';
|
|
7
|
+
export * from './events/index.js';
|
|
8
|
+
export * from './format/index.js';
|
|
9
|
+
export * from './http.js';
|
|
10
|
+
export * from './http-filter.js';
|
|
11
|
+
export * from './http-filter-visitor.js';
|
|
12
|
+
export { httpStatusCodeRanges, isHttpStatusCodeRange, } from './http-status-codes/http-status-code-ranges.js';
|
|
13
|
+
export * from './http-status-codes/index.js';
|
|
14
|
+
export * from './http-testing/index.js';
|
|
15
|
+
export * from './logger/log-level.js';
|
|
16
|
+
export * from './logger/logger.js';
|
|
17
|
+
export * from './logger/noop.logger.js';
|
|
18
|
+
export * from './logger/text.logger.js';
|
|
19
|
+
export * from './report-sorter.js';
|
|
20
|
+
export * from './rules/index.js';
|
|
21
|
+
export * from './thymian.error.js';
|
|
22
|
+
export * from './thymian.js';
|
|
23
|
+
export * from './thymian-plugin.js';
|
|
24
|
+
export * from './utils.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gDAAgD,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './actions/index.js';
|
|
2
|
+
export * from './ajv.js';
|
|
3
|
+
export * as chalk from './chalk.js';
|
|
4
|
+
export * from './constants.js';
|
|
5
|
+
export * from './emitter/index.js';
|
|
6
|
+
export * from './emitter/thymian-emitter.js';
|
|
7
|
+
export * from './events/index.js';
|
|
8
|
+
export * from './format/index.js';
|
|
9
|
+
export * from './http.js';
|
|
10
|
+
export * from './http-filter.js';
|
|
11
|
+
export * from './http-filter-visitor.js';
|
|
12
|
+
export { httpStatusCodeRanges, isHttpStatusCodeRange, } from './http-status-codes/http-status-code-ranges.js';
|
|
13
|
+
export * from './http-status-codes/index.js';
|
|
14
|
+
export * from './http-testing/index.js';
|
|
15
|
+
export * from './logger/log-level.js';
|
|
16
|
+
export * from './logger/logger.js';
|
|
17
|
+
export * from './logger/noop.logger.js';
|
|
18
|
+
export * from './logger/text.logger.js';
|
|
19
|
+
export * from './report-sorter.js';
|
|
20
|
+
export * from './rules/index.js';
|
|
21
|
+
export * from './thymian.error.js';
|
|
22
|
+
export * from './thymian.js';
|
|
23
|
+
export * from './thymian-plugin.js';
|
|
24
|
+
export * from './utils.js';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gDAAgD,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "silent"];
|
|
2
|
+
export type LogLevel = (typeof logLevels)[number];
|
|
3
|
+
export declare function isLogLevel(value: unknown): value is LogLevel;
|
|
4
|
+
export declare function shouldLog(messageLevel: LogLevel, configuredLevel: LogLevel): boolean;
|
|
5
|
+
//# sourceMappingURL=log-level.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-level.d.ts","sourceRoot":"","sources":["../../src/logger/log-level.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,gEAOZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAWlD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAK5D;AAED,wBAAgB,SAAS,CACvB,YAAY,EAAE,QAAQ,EACtB,eAAe,EAAE,QAAQ,GACxB,OAAO,CAET"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const logLevels = [
|
|
2
|
+
'trace',
|
|
3
|
+
'debug',
|
|
4
|
+
'info',
|
|
5
|
+
'warn',
|
|
6
|
+
'error',
|
|
7
|
+
'silent',
|
|
8
|
+
];
|
|
9
|
+
const logLevelValues = {
|
|
10
|
+
trace: 0,
|
|
11
|
+
debug: 1,
|
|
12
|
+
info: 2,
|
|
13
|
+
warn: 3,
|
|
14
|
+
error: 4,
|
|
15
|
+
silent: 5,
|
|
16
|
+
};
|
|
17
|
+
export function isLogLevel(value) {
|
|
18
|
+
return (typeof value === 'string' &&
|
|
19
|
+
logLevels.includes(value));
|
|
20
|
+
}
|
|
21
|
+
export function shouldLog(messageLevel, configuredLevel) {
|
|
22
|
+
return logLevelValues[messageLevel] >= logLevelValues[configuredLevel];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=log-level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-level.js","sourceRoot":"","sources":["../../src/logger/log-level.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;CACA,CAAC;AAIX,MAAM,cAAc,GAA6B;IAC/C,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,SAA+B,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,YAAsB,EACtB,eAAyB;IAEzB,OAAO,cAAc,CAAC,YAAY,CAAC,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogLevel } from './log-level.js';
|
|
2
|
+
export interface Logger {
|
|
3
|
+
namespace: string;
|
|
4
|
+
level: LogLevel;
|
|
5
|
+
debug(formatter: unknown, ...args: unknown[]): void;
|
|
6
|
+
info(formatter: unknown, ...args: unknown[]): void;
|
|
7
|
+
error(formatter: unknown, ...args: unknown[]): void;
|
|
8
|
+
trace(formatter: unknown, ...args: unknown[]): void;
|
|
9
|
+
warn(formatter: unknown, ...args: unknown[]): void;
|
|
10
|
+
out(output: unknown): void;
|
|
11
|
+
child(name: string): Logger;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACnD,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpD,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACnD,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LogLevel } from './log-level.js';
|
|
2
|
+
import type { Logger } from './logger.js';
|
|
3
|
+
export declare class NoopLogger implements Logger {
|
|
4
|
+
readonly namespace: string;
|
|
5
|
+
level: LogLevel;
|
|
6
|
+
constructor(name?: string);
|
|
7
|
+
trace(): void;
|
|
8
|
+
warn(): void;
|
|
9
|
+
debug(): void;
|
|
10
|
+
info(): void;
|
|
11
|
+
error(): void;
|
|
12
|
+
out(): void;
|
|
13
|
+
child(): Logger;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=noop.logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.logger.d.ts","sourceRoot":"","sources":["../../src/logger/noop.logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,UAAW,YAAW,MAAM;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,QAAQ,CAAY;gBAEf,IAAI,SAAK;IAIrB,KAAK,IAAI,IAAI;IACb,IAAI,IAAI,IAAI;IACZ,KAAK,IAAI,IAAI;IACb,IAAI,IAAI,IAAI;IACZ,KAAK,IAAI,IAAI;IACb,GAAG,IAAI,IAAI;IACX,KAAK,IAAI,MAAM;CAGhB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-empty-function: 0 */
|
|
2
|
+
export class NoopLogger {
|
|
3
|
+
namespace;
|
|
4
|
+
level = 'silent';
|
|
5
|
+
constructor(name = '') {
|
|
6
|
+
this.namespace = name;
|
|
7
|
+
}
|
|
8
|
+
trace() { }
|
|
9
|
+
warn() { }
|
|
10
|
+
debug() { }
|
|
11
|
+
info() { }
|
|
12
|
+
error() { }
|
|
13
|
+
out() { }
|
|
14
|
+
child() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=noop.logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.logger.js","sourceRoot":"","sources":["../../src/logger/noop.logger.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAKpD,MAAM,OAAO,UAAU;IACZ,SAAS,CAAS;IAC3B,KAAK,GAAa,QAAQ,CAAC;IAE3B,YAAY,IAAI,GAAG,EAAE;QACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,KAAK,KAAU,CAAC;IAChB,GAAG,KAAU,CAAC;IACd,KAAK;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LogLevel } from './log-level.js';
|
|
2
|
+
import type { Logger } from './logger.js';
|
|
3
|
+
export declare class TextLogger implements Logger {
|
|
4
|
+
readonly namespace: string;
|
|
5
|
+
readonly level: LogLevel;
|
|
6
|
+
constructor(name: string, level?: LogLevel);
|
|
7
|
+
trace(formatter: unknown, ...args: unknown[]): void;
|
|
8
|
+
warn(formatter: unknown, ...args: unknown[]): void;
|
|
9
|
+
debug(formatter: unknown, ...args: unknown[]): void;
|
|
10
|
+
info(formatter: unknown, ...args: unknown[]): void;
|
|
11
|
+
error(formatter: unknown, ...args: unknown[]): void;
|
|
12
|
+
out(output: unknown): void;
|
|
13
|
+
child(name: string): Logger;
|
|
14
|
+
private now;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=text.logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.logger.d.ts","sourceRoot":"","sources":["../../src/logger/text.logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,UAAW,YAAW,MAAM;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;gBAEb,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,QAAiB;IAKlD,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAUnD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAWlD,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAUnD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAUlD,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAUnD,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAS1B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3B,OAAO,CAAC,GAAG;CAGZ"}
|