@n1k1t/mock-server 0.1.0
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 +61 -0
- package/lib/package.json +77 -0
- package/lib/src/cli.d.ts +2 -0
- package/lib/src/cli.d.ts.map +1 -0
- package/lib/src/cli.js +33 -0
- package/lib/src/cli.js.map +1 -0
- package/lib/src/client/errors/connection.error.d.ts +6 -0
- package/lib/src/client/errors/connection.error.d.ts.map +1 -0
- package/lib/src/client/errors/connection.error.js +11 -0
- package/lib/src/client/errors/connection.error.js.map +1 -0
- package/lib/src/client/errors/index.d.ts +4 -0
- package/lib/src/client/errors/index.d.ts.map +1 -0
- package/lib/src/client/errors/index.js +20 -0
- package/lib/src/client/errors/index.js.map +1 -0
- package/lib/src/client/errors/internal-server.error.d.ts +6 -0
- package/lib/src/client/errors/internal-server.error.d.ts.map +1 -0
- package/lib/src/client/errors/internal-server.error.js +11 -0
- package/lib/src/client/errors/internal-server.error.js.map +1 -0
- package/lib/src/client/errors/types.d.ts +4 -0
- package/lib/src/client/errors/types.d.ts.map +1 -0
- package/lib/src/client/errors/types.js +3 -0
- package/lib/src/client/errors/types.js.map +1 -0
- package/lib/src/client/errors/validation.error.d.ts +7 -0
- package/lib/src/client/errors/validation.error.d.ts.map +1 -0
- package/lib/src/client/errors/validation.error.js +12 -0
- package/lib/src/client/errors/validation.error.js.map +1 -0
- package/lib/src/client/index.d.ts +9 -0
- package/lib/src/client/index.d.ts.map +1 -0
- package/lib/src/client/index.js +59 -0
- package/lib/src/client/index.js.map +1 -0
- package/lib/src/client/methods/expectations/create.method.d.ts +6 -0
- package/lib/src/client/methods/expectations/create.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/create.method.js +13 -0
- package/lib/src/client/methods/expectations/create.method.js.map +1 -0
- package/lib/src/client/methods/expectations/delete-all.method.d.ts +3 -0
- package/lib/src/client/methods/expectations/delete-all.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/delete-all.method.js +11 -0
- package/lib/src/client/methods/expectations/delete-all.method.js.map +1 -0
- package/lib/src/client/methods/expectations/delete.method.d.ts +4 -0
- package/lib/src/client/methods/expectations/delete.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/delete.method.js +12 -0
- package/lib/src/client/methods/expectations/delete.method.js.map +1 -0
- package/lib/src/client/methods/expectations/index.d.ts +5 -0
- package/lib/src/client/methods/expectations/index.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/index.js +15 -0
- package/lib/src/client/methods/expectations/index.js.map +1 -0
- package/lib/src/client/methods/expectations/types.d.ts +18 -0
- package/lib/src/client/methods/expectations/types.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/types.js +3 -0
- package/lib/src/client/methods/expectations/types.js.map +1 -0
- package/lib/src/client/methods/expectations/update.method.d.ts +8 -0
- package/lib/src/client/methods/expectations/update.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/update.method.js +16 -0
- package/lib/src/client/methods/expectations/update.method.js.map +1 -0
- package/lib/src/client/methods/expectations/utils.d.ts +3 -0
- package/lib/src/client/methods/expectations/utils.d.ts.map +1 -0
- package/lib/src/client/methods/expectations/utils.js +26 -0
- package/lib/src/client/methods/expectations/utils.js.map +1 -0
- package/lib/src/client/methods/index.d.ts +2 -0
- package/lib/src/client/methods/index.d.ts.map +1 -0
- package/lib/src/client/methods/index.js +18 -0
- package/lib/src/client/methods/index.js.map +1 -0
- package/lib/src/client/types.d.ts +6 -0
- package/lib/src/client/types.d.ts.map +1 -0
- package/lib/src/client/types.js +3 -0
- package/lib/src/client/types.js.map +1 -0
- package/lib/src/client/utils.d.ts +5 -0
- package/lib/src/client/utils.d.ts.map +1 -0
- package/lib/src/client/utils.js +27 -0
- package/lib/src/client/utils.js.map +1 -0
- package/lib/src/config/index.d.ts +8 -0
- package/lib/src/config/index.d.ts.map +1 -0
- package/lib/src/config/index.js +17 -0
- package/lib/src/config/index.js.map +1 -0
- package/lib/src/index.d.ts +5 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +21 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/process.d.ts +2 -0
- package/lib/src/process.d.ts.map +1 -0
- package/lib/src/process.js +7 -0
- package/lib/src/process.js.map +1 -0
- package/lib/src/server/endpoints/config.get.endpoint.d.ts +18 -0
- package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/config.get.endpoint.js +12 -0
- package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +21 -0
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/expectations.create.endpoint.js +15 -0
- package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts +11 -0
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.js +11 -0
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +19 -0
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/expectations.delete.endpoint.js +14 -0
- package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +16 -0
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js +9 -0
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +27 -0
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/expectations.update.endpoint.js +27 -0
- package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +16 -0
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js +11 -0
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/index.d.ts +9 -0
- package/lib/src/server/endpoints/index.d.ts.map +1 -0
- package/lib/src/server/endpoints/index.js +23 -0
- package/lib/src/server/endpoints/index.js.map +1 -0
- package/lib/src/server/endpoints/model.d.ts +26 -0
- package/lib/src/server/endpoints/model.d.ts.map +1 -0
- package/lib/src/server/endpoints/model.js +19 -0
- package/lib/src/server/endpoints/model.js.map +1 -0
- package/lib/src/server/endpoints/ping.endpoint.d.ts +15 -0
- package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/ping.endpoint.js +9 -0
- package/lib/src/server/endpoints/ping.endpoint.js.map +1 -0
- package/lib/src/server/expectations/__utils__/index.d.ts +3 -0
- package/lib/src/server/expectations/__utils__/index.d.ts.map +1 -0
- package/lib/src/server/expectations/__utils__/index.js +36 -0
- package/lib/src/server/expectations/__utils__/index.js.map +1 -0
- package/lib/src/server/expectations/errors/index.d.ts +6 -0
- package/lib/src/server/expectations/errors/index.d.ts.map +1 -0
- package/lib/src/server/expectations/errors/index.js +11 -0
- package/lib/src/server/expectations/errors/index.js.map +1 -0
- package/lib/src/server/expectations/index.d.ts +5 -0
- package/lib/src/server/expectations/index.d.ts.map +1 -0
- package/lib/src/server/expectations/index.js +21 -0
- package/lib/src/server/expectations/index.js.map +1 -0
- package/lib/src/server/expectations/model.d.ts +37 -0
- package/lib/src/server/expectations/model.d.ts.map +1 -0
- package/lib/src/server/expectations/model.js +90 -0
- package/lib/src/server/expectations/model.js.map +1 -0
- package/lib/src/server/expectations/operators/and.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/and.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/and.operator.js +5 -0
- package/lib/src/server/expectations/operators/and.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/and.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/and.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/and.operator.spec.js +55 -0
- package/lib/src/server/expectations/operators/and.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/exec.operator.d.ts +9 -0
- package/lib/src/server/expectations/operators/exec.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/exec.operator.js +15 -0
- package/lib/src/server/expectations/operators/exec.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/exec.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/exec.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/exec.operator.spec.js +27 -0
- package/lib/src/server/expectations/operators/exec.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/has.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/has.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/has.operator.js +83 -0
- package/lib/src/server/expectations/operators/has.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/has.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/has.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/has.operator.spec.js +173 -0
- package/lib/src/server/expectations/operators/has.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/if.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/if.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/if.operator.js +15 -0
- package/lib/src/server/expectations/operators/if.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/if.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/if.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/if.operator.spec.js +98 -0
- package/lib/src/server/expectations/operators/if.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/index.d.ts +10 -0
- package/lib/src/server/expectations/operators/index.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/index.js +25 -0
- package/lib/src/server/expectations/operators/index.js.map +1 -0
- package/lib/src/server/expectations/operators/merge.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/merge.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/merge.operator.js +30 -0
- package/lib/src/server/expectations/operators/merge.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/merge.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/merge.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/merge.operator.spec.js +55 -0
- package/lib/src/server/expectations/operators/merge.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/not.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/not.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/not.operator.js +5 -0
- package/lib/src/server/expectations/operators/not.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/not.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/not.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/not.operator.spec.js +17 -0
- package/lib/src/server/expectations/operators/not.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/or.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/or.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/or.operator.js +9 -0
- package/lib/src/server/expectations/operators/or.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/or.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/or.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/or.operator.spec.js +55 -0
- package/lib/src/server/expectations/operators/or.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/remove.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/remove.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/remove.operator.js +28 -0
- package/lib/src/server/expectations/operators/remove.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/remove.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/remove.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/remove.operator.spec.js +45 -0
- package/lib/src/server/expectations/operators/remove.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/set.operator.d.ts +3 -0
- package/lib/src/server/expectations/operators/set.operator.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/set.operator.js +39 -0
- package/lib/src/server/expectations/operators/set.operator.js.map +1 -0
- package/lib/src/server/expectations/operators/set.operator.spec.d.ts +2 -0
- package/lib/src/server/expectations/operators/set.operator.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/set.operator.spec.js +57 -0
- package/lib/src/server/expectations/operators/set.operator.spec.js.map +1 -0
- package/lib/src/server/expectations/operators/utils.d.ts +20 -0
- package/lib/src/server/expectations/operators/utils.d.ts.map +1 -0
- package/lib/src/server/expectations/operators/utils.js +67 -0
- package/lib/src/server/expectations/operators/utils.js.map +1 -0
- package/lib/src/server/expectations/storage.d.ts +19 -0
- package/lib/src/server/expectations/storage.d.ts.map +1 -0
- package/lib/src/server/expectations/storage.js +35 -0
- package/lib/src/server/expectations/storage.js.map +1 -0
- package/lib/src/server/expectations/types.d.ts +83 -0
- package/lib/src/server/expectations/types.d.ts.map +1 -0
- package/lib/src/server/expectations/types.js +16 -0
- package/lib/src/server/expectations/types.js.map +1 -0
- package/lib/src/server/expectations/utils.d.ts +12 -0
- package/lib/src/server/expectations/utils.d.ts.map +1 -0
- package/lib/src/server/expectations/utils.js +92 -0
- package/lib/src/server/expectations/utils.js.map +1 -0
- package/lib/src/server/expectations/utils.spec.d.ts +2 -0
- package/lib/src/server/expectations/utils.spec.d.ts.map +1 -0
- package/lib/src/server/expectations/utils.spec.js +59 -0
- package/lib/src/server/expectations/utils.spec.js.map +1 -0
- package/lib/src/server/expectations/validation-schemas.d.ts +24 -0
- package/lib/src/server/expectations/validation-schemas.d.ts.map +1 -0
- package/lib/src/server/expectations/validation-schemas.js +36 -0
- package/lib/src/server/expectations/validation-schemas.js.map +1 -0
- package/lib/src/server/history/index.d.ts +4 -0
- package/lib/src/server/history/index.d.ts.map +1 -0
- package/lib/src/server/history/index.js +20 -0
- package/lib/src/server/history/index.js.map +1 -0
- package/lib/src/server/history/model.d.ts +26 -0
- package/lib/src/server/history/model.d.ts.map +1 -0
- package/lib/src/server/history/model.js +33 -0
- package/lib/src/server/history/model.js.map +1 -0
- package/lib/src/server/history/storage.d.ts +7 -0
- package/lib/src/server/history/storage.d.ts.map +1 -0
- package/lib/src/server/history/storage.js +21 -0
- package/lib/src/server/history/storage.js.map +1 -0
- package/lib/src/server/history/types.d.ts +6 -0
- package/lib/src/server/history/types.d.ts.map +1 -0
- package/lib/src/server/history/types.js +3 -0
- package/lib/src/server/history/types.js.map +1 -0
- package/lib/src/server/index.d.ts +5 -0
- package/lib/src/server/index.d.ts.map +1 -0
- package/lib/src/server/index.js +80 -0
- package/lib/src/server/index.js.map +1 -0
- package/lib/src/server/middlewares/add-history.middleware.d.ts +8 -0
- package/lib/src/server/middlewares/add-history.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/add-history.middleware.js +14 -0
- package/lib/src/server/middlewares/add-history.middleware.js.map +1 -0
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts +8 -0
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/destroy-request.midleware.js +17 -0
- package/lib/src/server/middlewares/destroy-request.midleware.js.map +1 -0
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +8 -0
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +18 -0
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +1 -0
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +8 -0
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +86 -0
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +1 -0
- package/lib/src/server/middlewares/index.d.ts +9 -0
- package/lib/src/server/middlewares/index.d.ts.map +1 -0
- package/lib/src/server/middlewares/index.js +23 -0
- package/lib/src/server/middlewares/index.js.map +1 -0
- package/lib/src/server/middlewares/internal-route.middleware.d.ts +6 -0
- package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/internal-route.middleware.js +11 -0
- package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -0
- package/lib/src/server/middlewares/model.d.ts +25 -0
- package/lib/src/server/middlewares/model.d.ts.map +1 -0
- package/lib/src/server/middlewares/model.js +36 -0
- package/lib/src/server/middlewares/model.js.map +1 -0
- package/lib/src/server/middlewares/reply.middleware.d.ts +8 -0
- package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/reply.middleware.js +35 -0
- package/lib/src/server/middlewares/reply.middleware.js.map +1 -0
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts +6 -0
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/resolve-public.middleware.js +38 -0
- package/lib/src/server/middlewares/resolve-public.middleware.js.map +1 -0
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +6 -0
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js +20 -0
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +1 -0
- package/lib/src/server/models/index.d.ts +4 -0
- package/lib/src/server/models/index.d.ts.map +1 -0
- package/lib/src/server/models/index.js +20 -0
- package/lib/src/server/models/index.js.map +1 -0
- package/lib/src/server/models/reply-service/index.d.ts +12 -0
- package/lib/src/server/models/reply-service/index.d.ts.map +1 -0
- package/lib/src/server/models/reply-service/index.js +76 -0
- package/lib/src/server/models/reply-service/index.js.map +1 -0
- package/lib/src/server/models/reply-service/types.d.ts +5 -0
- package/lib/src/server/models/reply-service/types.d.ts.map +1 -0
- package/lib/src/server/models/reply-service/types.js +3 -0
- package/lib/src/server/models/reply-service/types.js.map +1 -0
- package/lib/src/server/models/request-context/index.d.ts +60 -0
- package/lib/src/server/models/request-context/index.d.ts.map +1 -0
- package/lib/src/server/models/request-context/index.js +75 -0
- package/lib/src/server/models/request-context/index.js.map +1 -0
- package/lib/src/server/models/request-context/types.d.ts +23 -0
- package/lib/src/server/models/request-context/types.d.ts.map +1 -0
- package/lib/src/server/models/request-context/types.js +3 -0
- package/lib/src/server/models/request-context/types.js.map +1 -0
- package/lib/src/server/models/request-context/utils.d.ts +6 -0
- package/lib/src/server/models/request-context/utils.d.ts.map +1 -0
- package/lib/src/server/models/request-context/utils.js +56 -0
- package/lib/src/server/models/request-context/utils.js.map +1 -0
- package/lib/src/server/models/server-context/index.d.ts +14 -0
- package/lib/src/server/models/server-context/index.d.ts.map +1 -0
- package/lib/src/server/models/server-context/index.js +20 -0
- package/lib/src/server/models/server-context/index.js.map +1 -0
- package/lib/src/server/proxy.d.ts +10 -0
- package/lib/src/server/proxy.d.ts.map +1 -0
- package/lib/src/server/proxy.js +16 -0
- package/lib/src/server/proxy.js.map +1 -0
- package/lib/src/server/router.d.ts +12 -0
- package/lib/src/server/router.d.ts.map +1 -0
- package/lib/src/server/router.js +49 -0
- package/lib/src/server/router.js.map +1 -0
- package/lib/src/server/types.d.ts +6 -0
- package/lib/src/server/types.d.ts.map +1 -0
- package/lib/src/server/types.js +3 -0
- package/lib/src/server/types.js.map +1 -0
- package/lib/src/server/utils/index.d.ts +11 -0
- package/lib/src/server/utils/index.d.ts.map +1 -0
- package/lib/src/server/utils/index.js +26 -0
- package/lib/src/server/utils/index.js.map +1 -0
- package/lib/src/server/web-socket-exchange/index.d.ts +5 -0
- package/lib/src/server/web-socket-exchange/index.d.ts.map +1 -0
- package/lib/src/server/web-socket-exchange/index.js +23 -0
- package/lib/src/server/web-socket-exchange/index.js.map +1 -0
- package/lib/src/server/web-socket-exchange/types.d.ts +12 -0
- package/lib/src/server/web-socket-exchange/types.d.ts.map +1 -0
- package/lib/src/server/web-socket-exchange/types.js +3 -0
- package/lib/src/server/web-socket-exchange/types.js.map +1 -0
- package/lib/src/types.d.ts +6 -0
- package/lib/src/types.d.ts.map +1 -0
- package/lib/src/types.js +3 -0
- package/lib/src/types.js.map +1 -0
- package/lib/src/utils/index.d.ts +29 -0
- package/lib/src/utils/index.d.ts.map +1 -0
- package/lib/src/utils/index.js +50 -0
- package/lib/src/utils/index.js.map +1 -0
- package/lib/task-processor.d.ts +2 -0
- package/lib/task-processor.d.ts.map +1 -0
- package/lib/task-processor.js +75 -0
- package/lib/task-processor.js.map +1 -0
- package/lib/test/index.d.ts +2 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +121 -0
- package/lib/test/index.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/common.global.d.ts +69 -0
- package/lib/types/common.global.d.ts.map +1 -0
- package/lib/types/common.global.js +3 -0
- package/lib/types/common.global.js.map +1 -0
- package/lib/types/lib.d.ts +3 -0
- package/lib/types/lib.d.ts.map +1 -0
- package/lib/types/lib.js +19 -0
- package/lib/types/lib.js.map +1 -0
- package/package.json +77 -0
- package/public/fonts/fa-regular-400.eot +0 -0
- package/public/fonts/fa-regular-400.svg +801 -0
- package/public/fonts/fa-regular-400.ttf +0 -0
- package/public/fonts/fa-regular-400.woff +0 -0
- package/public/fonts/fa-regular-400.woff2 +0 -0
- package/public/fonts/fa-solid-900.eot +0 -0
- package/public/fonts/fa-solid-900.svg +5028 -0
- package/public/fonts/fa-solid-900.ttf +0 -0
- package/public/fonts/fa-solid-900.woff +0 -0
- package/public/fonts/fa-solid-900.woff2 +0 -0
- package/public/images/favicon.png +0 -0
- package/public/index.html +25 -0
- package/public/scripts/main.js +19950 -0
- package/public/styles/fa-all.css +5 -0
- package/public/styles/json-highlighter.css +259 -0
- package/public/styles/main.css +245 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types/common.global.ts +112 -0
- package/types/lib.ts +2 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __utils__1 = require("../__utils__");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const or_operator_1 = __importDefault(require("./or.operator"));
|
|
9
|
+
describe('Expectations.Operators.Or', () => {
|
|
10
|
+
describe('validation mode', () => {
|
|
11
|
+
it('should validate by schema with one valid condition', () => {
|
|
12
|
+
const schema = [
|
|
13
|
+
{ $has: { $location: 'query', $path: 'foo', $value: 1 } },
|
|
14
|
+
];
|
|
15
|
+
expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
it('should validate by schema with two valid conditions', () => {
|
|
18
|
+
const schema = [
|
|
19
|
+
{ $has: { $location: 'query', $path: 'foo', $value: 1 } },
|
|
20
|
+
{ $has: { $location: 'query', $path: 'bar.baz', $value: null } },
|
|
21
|
+
];
|
|
22
|
+
expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
it('should validate by schema with zero conditions', () => {
|
|
25
|
+
expect((0, or_operator_1.default)('validation', [], (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
it('should validate by schema with one valid and one invalid condition', () => {
|
|
28
|
+
const schema = [
|
|
29
|
+
{ $has: { $location: 'query', $path: 'foo', $value: 1 } },
|
|
30
|
+
{ $has: { $location: 'query', $path: 'bar.baz', $value: 1 } },
|
|
31
|
+
];
|
|
32
|
+
expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
it('should validate by schema with two invalid conditions', () => {
|
|
35
|
+
const schema = [
|
|
36
|
+
{ $has: { $location: 'query', $path: 'foo', $value: null } },
|
|
37
|
+
{ $has: { $location: 'query', $path: 'bar.baz', $value: 1 } },
|
|
38
|
+
];
|
|
39
|
+
expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe('manipulation mode', () => {
|
|
43
|
+
it('should manipulate by schema with two conditions', () => {
|
|
44
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
45
|
+
const schema = [
|
|
46
|
+
{ $set: { $location: 'headers', $path: 'content-length', $value: 100 } },
|
|
47
|
+
{ $set: { $location: 'query', $path: 'bar.baz', $value: { test: true } } },
|
|
48
|
+
];
|
|
49
|
+
expect((0, or_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
50
|
+
expect(context.headers?.['content-length']).toEqual(100);
|
|
51
|
+
expect(context.query?.bar?.baz?.test).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=or.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/or.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,gEAAqC;AAErC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAA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,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;aAC3E,CAAC;YAEF,MAAM,CAAC,IAAA,qBAAQ,EAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;YACxH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACzD,MAAM,CAAO,OAAO,CAAC,KAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/remove.operator.ts"],"names":[],"mappings":";AAKA,wBAsBG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const utils_2 = require("../../../utils");
|
|
9
|
+
exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context) => {
|
|
10
|
+
if (mode !== 'manipulation' || !schema.$location) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const payload = (0, utils_1.extractContextPayloadSegment)(schema.$location, context);
|
|
14
|
+
if (payload?.type !== 'object') {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (schema.$path) {
|
|
18
|
+
lodash_1.default.unset(payload.value, schema.$path);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (schema.$jsonPath) {
|
|
22
|
+
(0, utils_2.extractByJsonPathSafe)({ path: schema.$jsonPath, json: payload.value })
|
|
23
|
+
.results?.forEach((segment) => lodash_1.default.unset(segment.parent, segment.parentProperty));
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=remove.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/remove.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAAwF;AACxF,0CAAuD;AAEvD,kBAAe,IAAA,uCAA+B,EAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAClF,IAAI,IAAI,KAAK,cAAc,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QAChD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,OAAO,GAAG,IAAA,oCAA4B,EAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IAED,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;KACb;IACD,IAAI,MAAM,CAAC,SAAS,EAAE;QACpB,IAAA,6BAAqB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;aACnE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QAElF,OAAO,IAAI,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/remove.operator.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __utils__1 = require("../__utils__");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const remove_operator_1 = __importDefault(require("./remove.operator"));
|
|
9
|
+
describe('Expectations.Operators.Remove', () => {
|
|
10
|
+
it('should handle invalid payload', () => {
|
|
11
|
+
const schema = { $location: 'query' };
|
|
12
|
+
expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
13
|
+
});
|
|
14
|
+
it('should handle schema without location', () => {
|
|
15
|
+
expect((0, remove_operator_1.default)('manipulation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
it('should handle schema with non object payload', () => {
|
|
18
|
+
const schema = { $location: 'path' };
|
|
19
|
+
expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
it('should handle schema without targeting properties', () => {
|
|
22
|
+
const schema = { $location: 'headers' };
|
|
23
|
+
expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
it('should manipulate by schema using path', () => {
|
|
26
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
27
|
+
const schema = {
|
|
28
|
+
$location: 'query',
|
|
29
|
+
$path: 'foo',
|
|
30
|
+
};
|
|
31
|
+
expect((0, remove_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
32
|
+
expect(context.query.foo).toBeUndefined();
|
|
33
|
+
});
|
|
34
|
+
it('should manipulate by schema using jsonPath', () => {
|
|
35
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
36
|
+
const schema = {
|
|
37
|
+
$location: 'body',
|
|
38
|
+
$jsonPath: '$.foo[*].bar,baz',
|
|
39
|
+
};
|
|
40
|
+
expect((0, remove_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
41
|
+
expect(context.body.foo[0].bar).toBeUndefined();
|
|
42
|
+
expect(context.body.foo[1].baz).toBeUndefined();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=remove.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/remove.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,wEAAyC;AAEzC,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAmC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACtE,MAAM,CAAC,IAAA,yBAAQ,EAAC,cAAc,EAAE,MAAM,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,IAAA,yBAAQ,EAAC,cAAc,EAAE,EAAE,E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AAE,MAAM;YACjB,SAAS,EAAE,kBAAkB;SAC9B,CAAC;QAEF,MAAM,CAAC,IAAA,yBAAQ,EAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACxH,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/set.operator.ts"],"names":[],"mappings":";AAKA,wBAmCG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const utils_2 = require("../../../utils");
|
|
9
|
+
exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context) => {
|
|
10
|
+
if (mode !== 'manipulation' || !schema.$location || schema.$value === undefined) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const payload = (0, utils_1.extractContextPayloadSegment)(schema.$location, context);
|
|
14
|
+
if (!payload) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
switch (payload.type) {
|
|
18
|
+
case 'number':
|
|
19
|
+
case 'string': {
|
|
20
|
+
lodash_1.default.set(payload.parent, payload.key, schema.$value);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
case 'object': {
|
|
24
|
+
if (schema.$path) {
|
|
25
|
+
lodash_1.default.set(payload.value, schema.$path, schema.$value);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (schema.$jsonPath) {
|
|
29
|
+
(0, utils_2.extractByJsonPathSafe)({ path: schema.$jsonPath, json: payload.value })
|
|
30
|
+
.results?.forEach((segment) => lodash_1.default.set(segment.parent, segment.parentProperty, schema.$value));
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
lodash_1.default.set(payload.parent, [payload.key], schema.$value);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
default: return true;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=set.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/set.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAAwF;AACxF,0CAAuD;AAEvD,kBAAe,IAAA,uCAA+B,EAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAC/E,IAAI,IAAI,KAAK,cAAc,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;QAC/E,OAAO,IAAI,CAAC;KACb;IAED,MAAM,OAAO,GAAG,IAAA,oCAA4B,EAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IAED,QAAO,OAAO,CAAC,IAAI,EAAE;QACnB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC,CAAC;YACb,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC;SACb;QAED,KAAK,QAAQ,CAAC,CAAC;YACb,IAAI,MAAM,CAAC,KAAK,EAAE;gBAChB,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBAClD,OAAO,IAAI,CAAC;aACb;YACD,IAAI,MAAM,CAAC,SAAS,EAAE;gBACpB,IAAA,6BAAqB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;qBACnE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;gBAE/F,OAAO,IAAI,CAAC;aACb;YAED,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC;KACtB;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/set.operator.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __utils__1 = require("../__utils__");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const set_operator_1 = __importDefault(require("./set.operator"));
|
|
9
|
+
describe('Expectations.Operators.Set', () => {
|
|
10
|
+
it('should handle invalid payload', () => {
|
|
11
|
+
const schema = { $location: 'query' };
|
|
12
|
+
expect((0, set_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
13
|
+
});
|
|
14
|
+
it('should handle schema without location', () => {
|
|
15
|
+
expect((0, set_operator_1.default)('manipulation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
it('should manipulate by schema in statusCode', () => {
|
|
18
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
19
|
+
const schema = {
|
|
20
|
+
$location: 'statusCode',
|
|
21
|
+
$value: 404,
|
|
22
|
+
};
|
|
23
|
+
expect((0, set_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
24
|
+
expect(context.statusCode).toEqual(404);
|
|
25
|
+
});
|
|
26
|
+
it('should manipulate by schema in headers', () => {
|
|
27
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
28
|
+
const schema = {
|
|
29
|
+
$location: 'headers',
|
|
30
|
+
$path: 'a.b.c.d',
|
|
31
|
+
$value: 'test',
|
|
32
|
+
};
|
|
33
|
+
expect((0, set_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
34
|
+
expect(context.headers.a.b.c.d).toEqual('test');
|
|
35
|
+
});
|
|
36
|
+
it('should manipulate by schema in body using jsonPath', () => {
|
|
37
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
38
|
+
const schema = {
|
|
39
|
+
$location: 'body',
|
|
40
|
+
$jsonPath: '$.foo[*].bar,baz',
|
|
41
|
+
$value: { test: true },
|
|
42
|
+
};
|
|
43
|
+
expect((0, set_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
44
|
+
expect(context.body.foo[0].bar.test).toBeTruthy();
|
|
45
|
+
expect(context.body.foo[1].baz.test).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
it('should manipulate by schema in root of query', () => {
|
|
48
|
+
const context = (0, __utils__1.buildExpectationContext)();
|
|
49
|
+
const schema = {
|
|
50
|
+
$location: 'query',
|
|
51
|
+
$value: { test: true },
|
|
52
|
+
};
|
|
53
|
+
expect((0, set_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
|
|
54
|
+
expect(context.query.test).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=set.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/set.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,kEAAsC;AAEtC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAmC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACtE,MAAM,CAAC,IAAA,sBAAQ,EAAC,cAAc,EAAE,MAAM,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,IAAA,sBAAQ,EAAC,cAAc,EAAE,EAAE,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACtH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,OAAO,GAAG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,EAAE,CAAC;QAExH,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QACzD,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,OAAO;YAClB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACvB,CAAC;QAEF,MAAM,CAAC,IAAA,sBAAQ,EAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACxH,MAAM,CAAO,OAAO,CAAC,KAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IRequestPlainContext, IResponsePlainContext } from '../../models';
|
|
2
|
+
import { TExpectationOperatorLocation, TExpectationOperatorHandler, TExpectationOperator } from '../types';
|
|
3
|
+
type TBasePayloadSegment = {
|
|
4
|
+
parent: object;
|
|
5
|
+
key: string;
|
|
6
|
+
};
|
|
7
|
+
type TPayloadSegment = (TBasePayloadSegment & {
|
|
8
|
+
value: object;
|
|
9
|
+
type: 'object';
|
|
10
|
+
}) | (TBasePayloadSegment & {
|
|
11
|
+
value: string;
|
|
12
|
+
type: 'string';
|
|
13
|
+
}) | (TBasePayloadSegment & {
|
|
14
|
+
value: number;
|
|
15
|
+
type: 'number';
|
|
16
|
+
});
|
|
17
|
+
export declare const buildExpectationOperatorHandler: <K extends TExpectationOperator>(handler: TExpectationOperatorHandler<K>) => TExpectationOperatorHandler<K>;
|
|
18
|
+
export declare const extractContextPayloadSegment: (location: TExpectationOperatorLocation, context: IRequestPlainContext | IResponsePlainContext) => TPayloadSegment | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,KAAK,mBAAmB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3D,KAAK,eAAe,GAChB,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GACzD,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GACzD,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAE9D,eAAO,MAAM,+BAA+B,6GAEhC,CAAC;AAEb,eAAO,MAAM,4BAA4B,aAC7B,4BAA4B,WAC7B,oBAAoB,GAAG,qBAAqB,KACpD,eAAe,GAAG,IAiEpB,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractContextPayloadSegment = exports.buildExpectationOperatorHandler = void 0;
|
|
4
|
+
const utils_1 = require("../../../utils");
|
|
5
|
+
const buildExpectationOperatorHandler = (handler) => handler;
|
|
6
|
+
exports.buildExpectationOperatorHandler = buildExpectationOperatorHandler;
|
|
7
|
+
const extractContextPayloadSegment = (location, context) => {
|
|
8
|
+
switch (location) {
|
|
9
|
+
case 'headers': return (0, utils_1.cast)({
|
|
10
|
+
key: 'headers',
|
|
11
|
+
type: 'object',
|
|
12
|
+
parent: context,
|
|
13
|
+
value: context.headers,
|
|
14
|
+
});
|
|
15
|
+
case 'method': return 'method' in context
|
|
16
|
+
? (0, utils_1.cast)({
|
|
17
|
+
key: 'method',
|
|
18
|
+
type: 'string',
|
|
19
|
+
parent: context,
|
|
20
|
+
value: context.method,
|
|
21
|
+
})
|
|
22
|
+
: null;
|
|
23
|
+
case 'path': return 'path' in context
|
|
24
|
+
? (0, utils_1.cast)({
|
|
25
|
+
key: 'path',
|
|
26
|
+
type: 'string',
|
|
27
|
+
parent: context,
|
|
28
|
+
value: context.path,
|
|
29
|
+
})
|
|
30
|
+
: null;
|
|
31
|
+
case 'body': return 'body' in context
|
|
32
|
+
? ({
|
|
33
|
+
key: 'body',
|
|
34
|
+
type: 'object',
|
|
35
|
+
parent: context,
|
|
36
|
+
value: context.body,
|
|
37
|
+
})
|
|
38
|
+
: null;
|
|
39
|
+
case 'data': return 'data' in context
|
|
40
|
+
? ({
|
|
41
|
+
key: 'data',
|
|
42
|
+
type: 'object',
|
|
43
|
+
parent: context,
|
|
44
|
+
value: context.data,
|
|
45
|
+
})
|
|
46
|
+
: null;
|
|
47
|
+
case 'statusCode': return 'statusCode' in context
|
|
48
|
+
? ({
|
|
49
|
+
key: 'statusCode',
|
|
50
|
+
type: 'number',
|
|
51
|
+
parent: context,
|
|
52
|
+
value: context.statusCode,
|
|
53
|
+
})
|
|
54
|
+
: null;
|
|
55
|
+
case 'query': return 'query' in context
|
|
56
|
+
? ({
|
|
57
|
+
key: 'query',
|
|
58
|
+
type: 'object',
|
|
59
|
+
parent: context,
|
|
60
|
+
value: context.query,
|
|
61
|
+
})
|
|
62
|
+
: null;
|
|
63
|
+
default: return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.extractContextPayloadSegment = extractContextPayloadSegment;
|
|
67
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/utils.ts"],"names":[],"mappings":";;;AAAA,0CAAsC;AAc/B,MAAM,+BAA+B,GAAG,CAC7C,OAAuC,EACvC,EAAE,CAAC,OAAO,CAAC;AAFA,QAAA,+BAA+B,mCAE/B;AAEN,MAAM,4BAA4B,GAAG,CAC1C,QAAsC,EACtC,OAAqD,EAC7B,EAAE;IAC1B,QAAO,QAAQ,EAAE;QACf,KAAK,SAAS,CAAC,CAAC,OAAO,IAAA,YAAI,EAAkB;YAC3C,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,OAAO,CAAC,OAAQ;SACxB,CAAC,CAAC;QAEH,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,IAAI,OAAO;YACvC,CAAC,CAAC,IAAA,YAAI,EAAkB;gBACtB,GAAG,EAAE,QAAQ;gBACb,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,MAAM;aACtB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,IAAI,OAAO;YACnC,CAAC,CAAC,IAAA,YAAI,EAAkB;gBACtB,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,IAAI;aACpB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,IAAI,OAAO;YACnC,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,IAAK;aACrB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,IAAI,OAAO;YACnC,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,IAAK;aACrB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,YAAY,CAAC,CAAC,OAAO,YAAY,IAAI,OAAO;YAC/C,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,YAAY;gBACjB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,UAAW;aAC3B,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,IAAI,OAAO;YACrC,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,OAAO;gBACZ,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,KAAM;aACtB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC;KACtB;AACH,CAAC,CAAA;AApEY,QAAA,4BAA4B,gCAoExC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ValueError } from '@n1k1t/typebox/errors';
|
|
2
|
+
import { Expectation } from './model';
|
|
3
|
+
import { TExpectationContext, TExpectationContextLocation } from './types';
|
|
4
|
+
export type TExpectationsStorageRegisterationResult = {
|
|
5
|
+
status: 'REGISTRED';
|
|
6
|
+
expectation: Expectation;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'ERROR';
|
|
9
|
+
reasons: ValueError[];
|
|
10
|
+
};
|
|
11
|
+
export declare class ExpectationsStorage extends Map<string, Expectation> {
|
|
12
|
+
register(configuration: Parameters<typeof Expectation['build']>[1]): TExpectationsStorageRegisterationResult;
|
|
13
|
+
findByContext(location: TExpectationContextLocation, context: TExpectationContext): Expectation | null;
|
|
14
|
+
findAndManipulateContext<T extends TExpectationContext>(location: TExpectationContextLocation, context: T, options?: Parameters<Expectation['manipulateContext']>[2]): {
|
|
15
|
+
context: T;
|
|
16
|
+
expectation: Expectation;
|
|
17
|
+
} | null;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/server/expectations/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3E,MAAM,MAAM,uCAAuC,GAC/C;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAoB,SAAQ,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC;IACxD,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,uCAAuC;IAY5G,aAAa,CAAC,QAAQ,EAAE,2BAA2B,EAAE,OAAO,EAAE,mBAAmB,GAAG,WAAW,GAAG,IAAI;IAUtG,wBAAwB,CAAC,CAAC,SAAS,mBAAmB,EAC3D,QAAQ,EAAE,2BAA2B,EACrC,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,GACxD;QAAE,OAAO,EAAE,CAAC,CAAC;QAAC,WAAW,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI;CAWnD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpectationsStorage = void 0;
|
|
4
|
+
const model_1 = require("./model");
|
|
5
|
+
class ExpectationsStorage extends Map {
|
|
6
|
+
register(configuration) {
|
|
7
|
+
const expectation = model_1.Expectation.build('HTTP', configuration);
|
|
8
|
+
const errors = expectation.validate();
|
|
9
|
+
if (errors.length) {
|
|
10
|
+
return { status: 'ERROR', reasons: errors };
|
|
11
|
+
}
|
|
12
|
+
this.set(expectation.id, expectation);
|
|
13
|
+
return { status: 'REGISTRED', expectation };
|
|
14
|
+
}
|
|
15
|
+
findByContext(location, context) {
|
|
16
|
+
for (const expectation of this.values()) {
|
|
17
|
+
if (expectation.isEnabled && expectation.validateContext(location, context)) {
|
|
18
|
+
return expectation;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
findAndManipulateContext(location, context, options) {
|
|
24
|
+
const expectation = this.findByContext(location, context);
|
|
25
|
+
if (!expectation) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
expectation,
|
|
30
|
+
context: expectation.manipulateContext(location, context, options),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ExpectationsStorage = ExpectationsStorage;
|
|
35
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/server/expectations/storage.ts"],"names":[],"mappings":";;;AAEA,mCAAsC;AAOtC,MAAa,mBAAoB,SAAQ,GAAwB;IACxD,QAAQ,CAAC,aAAyD;QACvE,MAAM,WAAW,GAAG,mBAAW,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAEtC,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;SAC5C;QAED,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAEM,aAAa,CAAC,QAAqC,EAAE,OAA4B;QACtF,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;YACvC,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;gBAC3E,OAAO,WAAW,CAAC;aACpB;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,wBAAwB,CAC7B,QAAqC,EACrC,OAAU,EACV,OAAyD;QAEzD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,IAAI,CAAC;SACb;QAED,OAAO;YACL,WAAW;YACX,OAAO,EAAE,WAAW,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;SACnE,CAAA;IACH,CAAC;CACF;AAtCD,kDAsCC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { IRequestPlainContext, IResponsePlainContext } from '../models';
|
|
2
|
+
export type TExpectationType = ConvertTupleToUnion<typeof LExpectationType>;
|
|
3
|
+
export declare const LExpectationType: readonly ["HTTP"];
|
|
4
|
+
export type TExpectationForwardProtocol = ConvertTupleToUnion<typeof LExpectationForwardProtocol>;
|
|
5
|
+
export declare const LExpectationForwardProtocol: readonly ["HTTP", "HTTPS"];
|
|
6
|
+
export type TExpectationDestroyType = ConvertTupleToUnion<typeof LExpectationDestroyType>;
|
|
7
|
+
export declare const LExpectationDestroyType: readonly ["ECONNABORTED"];
|
|
8
|
+
export type TExpectationOperatorLocation = ConvertTupleToUnion<typeof LExpectationOperatorLocation>;
|
|
9
|
+
export declare const LExpectationOperatorLocation: readonly ["path", "method", "headers", "body", "query", "data", "statusCode"];
|
|
10
|
+
export type TExpectationConditionalOperator = ConvertTupleToUnion<typeof LExpectationConditionalOperator>;
|
|
11
|
+
export declare const LExpectationConditionalOperator: readonly ["$if", "$not", "$and", "$or", "$has"];
|
|
12
|
+
export type TExpectationActionalOperator = ConvertTupleToUnion<typeof LExpectationActionalOperator>;
|
|
13
|
+
export declare const LExpectationActionalOperator: readonly ["$set", "$remove", "$merge", "$exec"];
|
|
14
|
+
export type TExpectationAttachlessOperator = ConvertTupleToUnion<typeof LExpectationAttachlessOperator>;
|
|
15
|
+
export declare const LExpectationAttachlessOperator: readonly ["$set", "$remove", "$merge", "$exec", "$has"];
|
|
16
|
+
export interface IExpectationMeta {
|
|
17
|
+
executionsCount: number;
|
|
18
|
+
additional: {
|
|
19
|
+
requestPaths?: string[];
|
|
20
|
+
requestMethods?: string[];
|
|
21
|
+
responseStatuses?: number[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface IExpectationDelay {
|
|
25
|
+
ms: number;
|
|
26
|
+
times?: number;
|
|
27
|
+
}
|
|
28
|
+
export type TExpectationContextLocation = 'request' | 'response';
|
|
29
|
+
export type TExpectationContext<TLocation extends TExpectationContextLocation = TExpectationContextLocation> = {
|
|
30
|
+
request: IRequestPlainContext;
|
|
31
|
+
response: IRequestPlainContext & IResponsePlainContext;
|
|
32
|
+
}[TLocation];
|
|
33
|
+
export type TExpectationOperatorMode = 'validation' | 'manipulation';
|
|
34
|
+
export type TExpectationOperatorHandlerParameters<K extends TExpectationOperator = TExpectationOperator> = [
|
|
35
|
+
TExpectationOperatorMode,
|
|
36
|
+
NonNullable<IExpectationSchema[K]>,
|
|
37
|
+
TExpectationContext
|
|
38
|
+
];
|
|
39
|
+
export type TExpectationOperatorHandler<K extends TExpectationOperator = TExpectationOperator> = TFunction<boolean, [
|
|
40
|
+
...TExpectationOperatorHandlerParameters<K>,
|
|
41
|
+
{
|
|
42
|
+
exploreNestedSchema: TFunction<boolean, TExpectationOperatorHandlerParameters>;
|
|
43
|
+
}
|
|
44
|
+
]>;
|
|
45
|
+
export type TExpectationOperator = TExpectationConditionalOperator | TExpectationActionalOperator;
|
|
46
|
+
export type TExpectationTargetionalValidationOperator = keyof IExpectationTargetionalSchema;
|
|
47
|
+
export type TExpectationTargetionalManipulationOperator = '$location' | '$path' | '$jsonPath' | '$value';
|
|
48
|
+
export type TExpectationTargetionalOperator = TExpectationTargetionalValidationOperator | TExpectationTargetionalManipulationOperator;
|
|
49
|
+
export interface IExpectationTargetionalSchema<TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation> {
|
|
50
|
+
$location?: TLocation;
|
|
51
|
+
$path?: string;
|
|
52
|
+
$jsonPath?: string;
|
|
53
|
+
$regExp?: RegExp;
|
|
54
|
+
$regExpAnyOf?: RegExp[];
|
|
55
|
+
$value?: unknown;
|
|
56
|
+
$valueAnyOf?: unknown[];
|
|
57
|
+
$minimatch?: string;
|
|
58
|
+
$minimatchAnyOf?: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface IExpectationSchemaConfiguration {
|
|
61
|
+
operator: TExpectationOperator;
|
|
62
|
+
useOperatorsOverride: Partial<Record<TExpectationOperator, unknown>>;
|
|
63
|
+
targetionalValidationOperator: TExpectationTargetionalValidationOperator;
|
|
64
|
+
targetionalManipulationOperator: TExpectationTargetionalManipulationOperator;
|
|
65
|
+
validationLocation: TExpectationOperatorLocation;
|
|
66
|
+
manipulationLocation: TExpectationOperatorLocation;
|
|
67
|
+
}
|
|
68
|
+
export interface IExpectationSchema<T extends IExpectationSchemaConfiguration = IExpectationSchemaConfiguration> {
|
|
69
|
+
$has?: Pick<IExpectationTargetionalSchema<T['validationLocation']>, Extract<T['targetionalValidationOperator'], TExpectationTargetionalValidationOperator>>;
|
|
70
|
+
$set?: Pick<IExpectationTargetionalSchema<T['manipulationLocation']>, Extract<T['targetionalManipulationOperator'], TExpectationTargetionalManipulationOperator>>;
|
|
71
|
+
$remove?: Pick<IExpectationTargetionalSchema<T['manipulationLocation']>, Extract<T['targetionalManipulationOperator'], TExpectationTargetionalManipulationOperator>>;
|
|
72
|
+
$merge?: Pick<IExpectationTargetionalSchema<T['manipulationLocation']>, Extract<T['targetionalManipulationOperator'], TExpectationTargetionalManipulationOperator>>;
|
|
73
|
+
$if?: IExpectationSchema<T> & {
|
|
74
|
+
$then?: Pick<IExpectationSchema<T>, T['operator']>;
|
|
75
|
+
$else?: Pick<IExpectationSchema<T>, T['operator']>;
|
|
76
|
+
};
|
|
77
|
+
$not?: Pick<IExpectationSchema<T>, T['operator']>;
|
|
78
|
+
$and?: Pick<IExpectationSchema<T>, T['operator']>[];
|
|
79
|
+
$or?: Pick<IExpectationSchema<T>, T['operator']>[];
|
|
80
|
+
$exec?: CheckKeyIsRequired<T['useOperatorsOverride'], '$exec'> extends true ? T['useOperatorsOverride']['$exec'] : string;
|
|
81
|
+
}
|
|
82
|
+
export type BuildExpectaionSchema<TConfiguration extends Partial<IExpectationSchemaConfiguration>, U extends IExpectationSchemaConfiguration = IExpectationSchemaConfiguration & TConfiguration> = Pick<IExpectationSchema<U>, U['operator']>;
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/expectations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE7E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OA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AAC,UAAU,CAAC,CAAC,CAAC;KACpD,CAAC;IAEF,IAAI,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;IACpD,GAAG,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;IAEnD,KAAK,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,GACvE,CAAC,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,GAClC,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,qBAAqB,CAC/B,cAAc,SAAS,OAAO,CAAC,+BAA+B,CAAC,EAC/D,CAAC,SAAS,+BAA+B,GAAG,+BAA+B,GAAG,cAAc,IAC1F,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LExpectationAttachlessOperator = exports.LExpectationActionalOperator = exports.LExpectationConditionalOperator = exports.LExpectationOperatorLocation = exports.LExpectationDestroyType = exports.LExpectationForwardProtocol = exports.LExpectationType = void 0;
|
|
4
|
+
exports.LExpectationType = ['HTTP'];
|
|
5
|
+
exports.LExpectationForwardProtocol = ['HTTP', 'HTTPS'];
|
|
6
|
+
exports.LExpectationDestroyType = ['ECONNABORTED'];
|
|
7
|
+
exports.LExpectationOperatorLocation = ['path', 'method', 'headers', 'body', 'query', 'data', 'statusCode'];
|
|
8
|
+
exports.LExpectationConditionalOperator = ['$if', '$not', '$and', '$or', '$has'];
|
|
9
|
+
exports.LExpectationActionalOperator = ['$set', '$remove', '$merge', '$exec'];
|
|
10
|
+
exports.LExpectationAttachlessOperator = [...exports.LExpectationActionalOperator, '$has'];
|
|
11
|
+
;
|
|
12
|
+
;
|
|
13
|
+
;
|
|
14
|
+
;
|
|
15
|
+
;
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/server/expectations/types.ts"],"names":[],"mappings":";;;AAGa,QAAA,gBAAgB,GAAU,CAAC,MAAM,CAAC,CAAC;AAGnC,QAAA,2BAA2B,GAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGvD,QAAA,uBAAuB,GAAU,CAAC,cAAc,CAAC,CAAC;AAGlD,QAAA,4BAA4B,GAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAG3G,QAAA,+BAA+B,GAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAGhF,QAAA,4BAA4B,GAAU,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAG7E,QAAA,8BAA8B,GAAU,CAAC,GAAG,oCAA4B,EAAE,MAAM,CAAC,CAAC;AAU9F,CAAC;AAKD,CAAC;AAsDD,CAAC;AAWD,CAAC;AAqCD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IExpectationSchema, TExpectationOperatorHandlerParameters, TExpectationOperator } from './types';
|
|
2
|
+
export declare const exploreNestedExpectationSchema: TFunction<boolean, TExpectationOperatorHandlerParameters>;
|
|
3
|
+
export declare const introspectExpectationSchema: <T extends object = IExpectationSchema<import("./types").IExpectationSchemaConfiguration> & {
|
|
4
|
+
$then?: Pick<IExpectationSchema<import("./types").IExpectationSchemaConfiguration>, TExpectationOperator> | undefined;
|
|
5
|
+
$else?: Pick<IExpectationSchema<import("./types").IExpectationSchemaConfiguration>, TExpectationOperator> | undefined;
|
|
6
|
+
}, K extends keyof T = keyof T>(schema: T, handler: (key: K, schema: T) => unknown) => void;
|
|
7
|
+
export declare const extractMetaAdditionalFromExpectationSchema: (schema: IExpectationSchema) => {
|
|
8
|
+
requestPaths?: string[] | undefined;
|
|
9
|
+
requestMethods?: string[] | undefined;
|
|
10
|
+
responseStatuses?: number[] | undefined;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/server/expectations/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAElB,qCAAqC,EACrC,oBAAoB,EAKrB,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,8BAA8B,EAAE,SAAS,CAAC,OAAO,EAAE,qCAAqC,CA2BlG,CAAA;AAEH,eAAO,MAAM,2BAA2B;;;2EAGK,OAAO,KAAG,IAQtD,CAAA;AAED,eAAO,MAAM,0CAA0C,WAAY,kBAAkB;;;;CA+BpF,CAAA"}
|