@n1k1t/mock-server 0.1.0 → 0.1.2
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/.vscode/settings.json +3 -0
- package/README.md +55 -28
- package/bin/index.ts +31 -0
- package/lib/bin/index.d.ts +2 -0
- package/lib/bin/index.d.ts.map +1 -0
- package/lib/{src/cli.js → bin/index.js} +13 -15
- package/lib/bin/index.js.map +1 -0
- package/lib/package.json +4 -3
- package/lib/src/client/errors/connection.error.js +1 -1
- package/lib/src/client/errors/connection.error.js.map +1 -1
- package/lib/src/client/errors/validation.error.d.ts.map +1 -1
- package/lib/src/client/helpers/expectations.d.ts +91 -0
- package/lib/src/client/helpers/expectations.d.ts.map +1 -0
- package/lib/src/client/helpers/expectations.js +66 -0
- package/lib/src/client/helpers/expectations.js.map +1 -0
- package/lib/src/client/helpers/index.d.ts +2 -0
- package/lib/src/client/helpers/index.d.ts.map +1 -0
- package/lib/src/client/helpers/index.js +18 -0
- package/lib/src/client/helpers/index.js.map +1 -0
- package/lib/src/client/index.d.ts +4 -7
- package/lib/src/client/index.d.ts.map +1 -1
- package/lib/src/client/index.js +4 -41
- package/lib/src/client/index.js.map +1 -1
- package/lib/src/client/methods/expectations.create.method.d.ts +4 -0
- package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations.create.method.js +29 -0
- package/lib/src/client/methods/expectations.create.method.js.map +1 -0
- package/lib/src/client/methods/expectations.delete.method.d.ts +6 -0
- package/lib/src/client/methods/expectations.delete.method.d.ts.map +1 -0
- package/lib/src/client/methods/expectations.delete.method.js +26 -0
- package/lib/src/client/methods/expectations.delete.method.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 +44 -0
- package/lib/src/client/methods/expectations.update.method.js.map +1 -0
- package/lib/src/client/methods/index.d.ts +4 -1
- package/lib/src/client/methods/index.d.ts.map +1 -1
- package/lib/src/client/methods/index.js +11 -14
- package/lib/src/client/methods/index.js.map +1 -1
- package/lib/src/client/methods/ping.method.d.ts +4 -0
- package/lib/src/client/methods/ping.method.d.ts.map +1 -0
- package/lib/src/client/methods/ping.method.js +22 -0
- package/lib/src/client/methods/ping.method.js.map +1 -0
- package/lib/src/client/models/client.d.ts +40 -0
- package/lib/src/client/models/client.d.ts.map +1 -0
- package/lib/src/client/models/client.js +33 -0
- package/lib/src/client/models/client.js.map +1 -0
- package/lib/src/client/models/client.spec.d.ts +2 -0
- package/lib/src/client/models/client.spec.d.ts.map +1 -0
- package/lib/src/client/models/client.spec.js +219 -0
- package/lib/src/client/models/client.spec.js.map +1 -0
- package/lib/src/client/models/index.d.ts +3 -0
- package/lib/src/client/models/index.d.ts.map +1 -0
- package/lib/src/client/models/index.js +19 -0
- package/lib/src/client/models/index.js.map +1 -0
- package/lib/src/client/models/method.d.ts +17 -0
- package/lib/src/client/models/method.d.ts.map +1 -0
- package/lib/src/client/models/method.js +25 -0
- package/lib/src/client/models/method.js.map +1 -0
- package/lib/src/client/onsite.d.ts +7 -0
- package/lib/src/client/onsite.d.ts.map +1 -0
- package/lib/src/client/onsite.js +44 -0
- package/lib/src/client/onsite.js.map +1 -0
- package/lib/src/client/remote.d.ts +8 -0
- package/lib/src/client/remote.d.ts.map +1 -0
- package/lib/src/client/remote.js +52 -0
- package/lib/src/client/remote.js.map +1 -0
- package/lib/src/client/types.d.ts +19 -1
- package/lib/src/client/types.d.ts.map +1 -1
- package/lib/src/client/utils.d.ts +4 -3
- package/lib/src/client/utils.d.ts.map +1 -1
- package/lib/src/client/utils.js +36 -3
- package/lib/src/client/utils.js.map +1 -1
- package/lib/src/config/index.d.ts +9 -6
- package/lib/src/config/index.d.ts.map +1 -1
- package/lib/src/config/index.js +8 -7
- package/lib/src/config/index.js.map +1 -1
- package/lib/src/expectations/__utils__/index.d.ts +3 -0
- package/lib/src/expectations/__utils__/index.d.ts.map +1 -0
- package/lib/src/expectations/__utils__/index.js +44 -0
- package/lib/src/expectations/__utils__/index.js.map +1 -0
- package/lib/src/expectations/errors/index.d.ts.map +1 -0
- package/lib/src/expectations/errors/index.js.map +1 -0
- package/lib/src/expectations/index.d.ts +4 -0
- package/lib/src/expectations/index.d.ts.map +1 -0
- package/lib/src/{server/expectations → expectations}/index.js +1 -2
- package/lib/src/expectations/index.js.map +1 -0
- package/lib/src/expectations/models/expectation.d.ts +35 -0
- package/lib/src/expectations/models/expectation.d.ts.map +1 -0
- package/lib/src/expectations/models/expectation.js +113 -0
- package/lib/src/expectations/models/expectation.js.map +1 -0
- package/lib/src/expectations/models/index.d.ts +4 -0
- package/lib/src/expectations/models/index.d.ts.map +1 -0
- package/lib/src/expectations/models/index.js +20 -0
- package/lib/src/expectations/models/index.js.map +1 -0
- package/lib/src/expectations/models/operator.d.ts +20 -0
- package/lib/src/expectations/models/operator.d.ts.map +1 -0
- package/lib/src/expectations/models/operator.js +41 -0
- package/lib/src/expectations/models/operator.js.map +1 -0
- package/lib/src/expectations/models/storage.d.ts +15 -0
- package/lib/src/expectations/models/storage.d.ts.map +1 -0
- package/lib/src/{server/expectations → expectations/models}/storage.js +4 -14
- package/lib/src/expectations/models/storage.js.map +1 -0
- package/lib/src/expectations/models/storage.spec.d.ts +2 -0
- package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
- package/lib/src/expectations/models/storage.spec.js +111 -0
- package/lib/src/expectations/models/storage.spec.js.map +1 -0
- package/lib/src/expectations/operators/and.operator.d.ts +8 -0
- package/lib/src/expectations/operators/and.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/and.operator.js +24 -0
- package/lib/src/expectations/operators/and.operator.js.map +1 -0
- package/lib/src/expectations/operators/and.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/and.operator.spec.js +73 -0
- package/lib/src/expectations/operators/and.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/exec.operator.d.ts +8 -0
- package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/exec.operator.js +18 -0
- package/lib/src/expectations/operators/exec.operator.js.map +1 -0
- package/lib/src/expectations/operators/exec.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/exec.operator.spec.js +58 -0
- package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/has.operator.d.ts +28 -0
- package/lib/src/expectations/operators/has.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/has.operator.js +119 -0
- package/lib/src/expectations/operators/has.operator.js.map +1 -0
- package/lib/src/expectations/operators/has.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/has.operator.spec.js +434 -0
- package/lib/src/expectations/operators/has.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/if.operator.d.ts +16 -0
- package/lib/src/expectations/operators/if.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/if.operator.js +49 -0
- package/lib/src/expectations/operators/if.operator.js.map +1 -0
- package/lib/src/expectations/operators/if.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/if.operator.spec.js +122 -0
- package/lib/src/expectations/operators/if.operator.spec.js.map +1 -0
- package/lib/src/{server/expectations → expectations}/operators/index.d.ts +2 -0
- package/lib/src/expectations/operators/index.d.ts.map +1 -0
- package/lib/src/{server/expectations → expectations}/operators/index.js +5 -1
- package/lib/src/expectations/operators/index.js.map +1 -0
- package/lib/src/expectations/operators/merge.operator.d.ts +14 -0
- package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/merge.operator.js +34 -0
- package/lib/src/expectations/operators/merge.operator.js.map +1 -0
- package/lib/src/expectations/operators/merge.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/merge.operator.spec.js +65 -0
- package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/not.operator.d.ts +8 -0
- package/lib/src/expectations/operators/not.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/not.operator.js +24 -0
- package/lib/src/expectations/operators/not.operator.js.map +1 -0
- package/lib/src/expectations/operators/not.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/not.operator.spec.js +36 -0
- package/lib/src/expectations/operators/not.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/or.operator.d.ts +8 -0
- package/lib/src/expectations/operators/or.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/or.operator.js +24 -0
- package/lib/src/expectations/operators/or.operator.js.map +1 -0
- package/lib/src/expectations/operators/or.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/or.operator.spec.js +74 -0
- package/lib/src/expectations/operators/or.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/remove.operator.d.ts +13 -0
- package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/remove.operator.js +33 -0
- package/lib/src/expectations/operators/remove.operator.js.map +1 -0
- package/lib/src/expectations/operators/remove.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/remove.operator.spec.js +57 -0
- package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/root.operator.d.ts +8 -0
- package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/root.operator.js +36 -0
- package/lib/src/expectations/operators/root.operator.js.map +1 -0
- package/lib/src/expectations/operators/set.operator.d.ts +21 -0
- package/lib/src/expectations/operators/set.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/set.operator.js +56 -0
- package/lib/src/expectations/operators/set.operator.js.map +1 -0
- package/lib/src/expectations/operators/set.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/set.operator.spec.js +101 -0
- package/lib/src/expectations/operators/set.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
- package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/switch.operator.js +68 -0
- package/lib/src/expectations/operators/switch.operator.js.map +1 -0
- package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
- package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
- package/lib/src/expectations/types.d.ts +86 -0
- package/lib/src/expectations/types.d.ts.map +1 -0
- package/lib/src/{server/expectations → expectations}/types.js +13 -2
- package/lib/src/expectations/types.js.map +1 -0
- package/lib/src/expectations/utils.d.ts +24 -0
- package/lib/src/expectations/utils.d.ts.map +1 -0
- package/lib/src/expectations/utils.js +119 -0
- package/lib/src/expectations/utils.js.map +1 -0
- package/lib/src/server/endpoints/config.get.endpoint.d.ts +9 -4
- package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.js +4 -7
- package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +10 -12
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.js +4 -9
- package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +11 -8
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.js +4 -7
- package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +10 -5
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js +4 -4
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +14 -12
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.js +6 -21
- package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/index.d.ts +2 -3
- package/lib/src/server/endpoints/index.d.ts.map +1 -1
- package/lib/src/server/endpoints/index.js +5 -7
- package/lib/src/server/endpoints/index.js.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.d.ts +9 -4
- package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.js +3 -3
- package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
- package/lib/src/server/history/model.d.ts +16 -16
- package/lib/src/server/history/model.d.ts.map +1 -1
- package/lib/src/server/history/model.js +21 -6
- package/lib/src/server/history/model.js.map +1 -1
- package/lib/src/server/history/storage.d.ts +3 -4
- package/lib/src/server/history/storage.d.ts.map +1 -1
- package/lib/src/server/history/storage.js +7 -4
- package/lib/src/server/history/storage.js.map +1 -1
- package/lib/src/server/index.d.ts +15 -3
- package/lib/src/server/index.d.ts.map +1 -1
- package/lib/src/server/index.js +31 -32
- package/lib/src/server/index.js.map +1 -1
- package/lib/src/server/middlewares/add-history.middleware.d.ts +15 -5
- package/lib/src/server/middlewares/add-history.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/add-history.middleware.js +7 -8
- package/lib/src/server/middlewares/add-history.middleware.js.map +1 -1
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts +15 -5
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/destroy-request.midleware.js +6 -7
- package/lib/src/server/middlewares/destroy-request.midleware.js.map +1 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +15 -5
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +3 -4
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +1 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +15 -5
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +33 -47
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +1 -1
- package/lib/src/server/middlewares/index.d.ts +4 -4
- package/lib/src/server/middlewares/index.d.ts.map +1 -1
- package/lib/src/server/middlewares/index.js +9 -9
- package/lib/src/server/middlewares/index.js.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.d.ts +15 -3
- package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.js +6 -5
- package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts +18 -0
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
- package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
- package/lib/src/server/middlewares/reply.middleware.d.ts +15 -5
- package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/reply.middleware.js +36 -27
- package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts +15 -3
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/resolve-public.middleware.js +14 -15
- package/lib/src/server/middlewares/resolve-public.middleware.js.map +1 -1
- package/lib/src/server/models/endpoint.d.ts +32 -0
- package/lib/src/server/models/endpoint.d.ts.map +1 -0
- package/lib/src/server/{endpoints/model.js → models/endpoint.js} +3 -3
- package/lib/src/server/models/endpoint.js.map +1 -0
- package/lib/src/server/models/index.d.ts +2 -0
- package/lib/src/server/models/index.d.ts.map +1 -1
- package/lib/src/server/models/index.js +2 -0
- package/lib/src/server/models/index.js.map +1 -1
- package/lib/src/server/models/middleware.d.ts +23 -0
- package/lib/src/server/models/middleware.d.ts.map +1 -0
- package/lib/src/server/{middlewares/model.js → models/middleware.js} +7 -11
- package/lib/src/server/models/middleware.js.map +1 -0
- package/lib/src/server/models/reply-service/index.d.ts +6 -6
- package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
- package/lib/src/server/models/reply-service/index.js +24 -24
- package/lib/src/server/models/reply-service/index.js.map +1 -1
- package/lib/src/server/models/request-context/http.d.ts +42 -0
- package/lib/src/server/models/request-context/http.d.ts.map +1 -0
- package/lib/src/server/models/request-context/http.js +51 -0
- package/lib/src/server/models/request-context/http.js.map +1 -0
- package/lib/src/server/models/request-context/index.d.ts +4 -58
- package/lib/src/server/models/request-context/index.d.ts.map +1 -1
- package/lib/src/server/models/request-context/index.js +4 -57
- package/lib/src/server/models/request-context/index.js.map +1 -1
- package/lib/src/server/models/request-context/model.d.ts +13 -0
- package/lib/src/server/models/request-context/model.d.ts.map +1 -0
- package/lib/src/server/models/request-context/model.js +14 -0
- package/lib/src/server/models/request-context/model.js.map +1 -0
- package/lib/src/server/models/request-context/types.d.ts +14 -18
- package/lib/src/server/models/request-context/types.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.d.ts +7 -3
- package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.js +48 -25
- package/lib/src/server/models/request-context/utils.js.map +1 -1
- package/lib/src/server/models/request-context/ws.d.ts +21 -0
- package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
- package/lib/src/server/models/request-context/ws.js +22 -0
- package/lib/src/server/models/request-context/ws.js.map +1 -0
- package/lib/src/server/models/server-context.d.ts +26 -0
- package/lib/src/server/models/server-context.d.ts.map +1 -0
- package/lib/src/server/models/server-context.js +33 -0
- package/lib/src/server/models/server-context.js.map +1 -0
- package/lib/src/server/proxy.d.ts +0 -1
- package/lib/src/server/proxy.d.ts.map +1 -1
- package/lib/src/server/router.d.ts +4 -8
- package/lib/src/server/router.d.ts.map +1 -1
- package/lib/src/server/router.js +5 -12
- package/lib/src/server/router.js.map +1 -1
- package/lib/src/server/ws-exchange/index.d.ts +5 -0
- package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
- package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
- package/lib/src/server/ws-exchange/index.js.map +1 -0
- package/lib/src/server/ws-exchange/types.d.ts +12 -0
- package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
- package/lib/src/server/ws-exchange/types.js.map +1 -0
- package/lib/src/types.d.ts +0 -3
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/utils/common.d.ts +4 -0
- package/lib/src/utils/common.d.ts.map +1 -0
- package/lib/src/utils/common.js +18 -0
- package/lib/src/utils/common.js.map +1 -0
- package/lib/src/utils/index.d.ts +4 -28
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/index.js +17 -46
- package/lib/src/utils/index.js.map +1 -1
- package/lib/src/utils/json.d.ts +26 -0
- package/lib/src/utils/json.d.ts.map +1 -0
- package/lib/src/utils/json.js +36 -0
- package/lib/src/utils/json.js.map +1 -0
- package/lib/src/utils/regexp.d.ts +2 -0
- package/lib/src/utils/regexp.d.ts.map +1 -0
- package/lib/src/utils/regexp.js +9 -0
- package/lib/src/utils/regexp.js.map +1 -0
- package/lib/src/{server/utils/index.d.ts → utils/validation.d.ts} +1 -1
- package/lib/src/utils/validation.d.ts.map +1 -0
- package/lib/src/{server/utils/index.js → utils/validation.js} +1 -1
- package/lib/src/{server/utils/index.js.map → utils/validation.js.map} +1 -1
- package/lib/test/index.js +111 -108
- package/lib/test/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/common.global.d.ts +13 -6
- package/lib/types/common.global.d.ts.map +1 -1
- package/lib/types/lib.d.ts +1 -0
- package/lib/types/lib.d.ts.map +1 -1
- package/lib/types/lib.js +1 -0
- package/lib/types/lib.js.map +1 -1
- package/package.json +4 -3
- package/types/common.global.ts +21 -2
- package/types/lib.ts +1 -0
- package/lib/src/cli.d.ts +0 -2
- package/lib/src/cli.d.ts.map +0 -1
- package/lib/src/cli.js.map +0 -1
- package/lib/src/client/methods/expectations/create.method.d.ts +0 -6
- package/lib/src/client/methods/expectations/create.method.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/create.method.js +0 -13
- package/lib/src/client/methods/expectations/create.method.js.map +0 -1
- package/lib/src/client/methods/expectations/delete-all.method.d.ts +0 -3
- package/lib/src/client/methods/expectations/delete-all.method.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/delete-all.method.js +0 -11
- package/lib/src/client/methods/expectations/delete-all.method.js.map +0 -1
- package/lib/src/client/methods/expectations/delete.method.d.ts +0 -4
- package/lib/src/client/methods/expectations/delete.method.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/delete.method.js +0 -12
- package/lib/src/client/methods/expectations/delete.method.js.map +0 -1
- package/lib/src/client/methods/expectations/index.d.ts +0 -5
- package/lib/src/client/methods/expectations/index.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/index.js +0 -15
- package/lib/src/client/methods/expectations/index.js.map +0 -1
- package/lib/src/client/methods/expectations/types.d.ts +0 -18
- package/lib/src/client/methods/expectations/types.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/types.js.map +0 -1
- package/lib/src/client/methods/expectations/update.method.d.ts +0 -8
- package/lib/src/client/methods/expectations/update.method.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/update.method.js +0 -16
- package/lib/src/client/methods/expectations/update.method.js.map +0 -1
- package/lib/src/client/methods/expectations/utils.d.ts +0 -3
- package/lib/src/client/methods/expectations/utils.d.ts.map +0 -1
- package/lib/src/client/methods/expectations/utils.js +0 -26
- package/lib/src/client/methods/expectations/utils.js.map +0 -1
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts +0 -11
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts.map +0 -1
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.js +0 -11
- package/lib/src/server/endpoints/expectations.delete-all.endpoint.js.map +0 -1
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -11
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
- package/lib/src/server/endpoints/model.d.ts +0 -26
- package/lib/src/server/endpoints/model.d.ts.map +0 -1
- package/lib/src/server/endpoints/model.js.map +0 -1
- package/lib/src/server/expectations/__utils__/index.d.ts +0 -3
- package/lib/src/server/expectations/__utils__/index.d.ts.map +0 -1
- package/lib/src/server/expectations/__utils__/index.js +0 -36
- package/lib/src/server/expectations/__utils__/index.js.map +0 -1
- package/lib/src/server/expectations/errors/index.d.ts.map +0 -1
- package/lib/src/server/expectations/errors/index.js.map +0 -1
- package/lib/src/server/expectations/index.d.ts +0 -5
- package/lib/src/server/expectations/index.d.ts.map +0 -1
- package/lib/src/server/expectations/index.js.map +0 -1
- package/lib/src/server/expectations/model.d.ts +0 -37
- package/lib/src/server/expectations/model.d.ts.map +0 -1
- package/lib/src/server/expectations/model.js +0 -90
- package/lib/src/server/expectations/model.js.map +0 -1
- package/lib/src/server/expectations/operators/and.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/and.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/and.operator.js +0 -5
- package/lib/src/server/expectations/operators/and.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/and.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/and.operator.spec.js +0 -55
- package/lib/src/server/expectations/operators/and.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/exec.operator.d.ts +0 -9
- package/lib/src/server/expectations/operators/exec.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/exec.operator.js +0 -15
- package/lib/src/server/expectations/operators/exec.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/exec.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/exec.operator.spec.js +0 -27
- package/lib/src/server/expectations/operators/exec.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/has.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/has.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/has.operator.js +0 -83
- package/lib/src/server/expectations/operators/has.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/has.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/has.operator.spec.js +0 -173
- package/lib/src/server/expectations/operators/has.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/if.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/if.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/if.operator.js +0 -15
- package/lib/src/server/expectations/operators/if.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/if.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/if.operator.spec.js +0 -98
- package/lib/src/server/expectations/operators/if.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/index.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/index.js.map +0 -1
- package/lib/src/server/expectations/operators/merge.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/merge.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/merge.operator.js +0 -30
- package/lib/src/server/expectations/operators/merge.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/merge.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/merge.operator.spec.js +0 -55
- package/lib/src/server/expectations/operators/merge.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/not.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/not.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/not.operator.js +0 -5
- package/lib/src/server/expectations/operators/not.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/not.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/not.operator.spec.js +0 -17
- package/lib/src/server/expectations/operators/not.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/or.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/or.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/or.operator.js +0 -9
- package/lib/src/server/expectations/operators/or.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/or.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/or.operator.spec.js +0 -55
- package/lib/src/server/expectations/operators/or.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/remove.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/remove.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/remove.operator.js +0 -28
- package/lib/src/server/expectations/operators/remove.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/remove.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/remove.operator.spec.js +0 -45
- package/lib/src/server/expectations/operators/remove.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/set.operator.d.ts +0 -3
- package/lib/src/server/expectations/operators/set.operator.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/set.operator.js +0 -39
- package/lib/src/server/expectations/operators/set.operator.js.map +0 -1
- package/lib/src/server/expectations/operators/set.operator.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/set.operator.spec.js +0 -57
- package/lib/src/server/expectations/operators/set.operator.spec.js.map +0 -1
- package/lib/src/server/expectations/operators/utils.d.ts +0 -20
- package/lib/src/server/expectations/operators/utils.d.ts.map +0 -1
- package/lib/src/server/expectations/operators/utils.js +0 -67
- package/lib/src/server/expectations/operators/utils.js.map +0 -1
- package/lib/src/server/expectations/storage.d.ts +0 -19
- package/lib/src/server/expectations/storage.d.ts.map +0 -1
- package/lib/src/server/expectations/storage.js.map +0 -1
- package/lib/src/server/expectations/types.d.ts +0 -83
- package/lib/src/server/expectations/types.d.ts.map +0 -1
- package/lib/src/server/expectations/types.js.map +0 -1
- package/lib/src/server/expectations/utils.d.ts +0 -12
- package/lib/src/server/expectations/utils.d.ts.map +0 -1
- package/lib/src/server/expectations/utils.js +0 -92
- package/lib/src/server/expectations/utils.js.map +0 -1
- package/lib/src/server/expectations/utils.spec.d.ts +0 -2
- package/lib/src/server/expectations/utils.spec.d.ts.map +0 -1
- package/lib/src/server/expectations/utils.spec.js +0 -59
- package/lib/src/server/expectations/utils.spec.js.map +0 -1
- package/lib/src/server/expectations/validation-schemas.d.ts +0 -24
- package/lib/src/server/expectations/validation-schemas.d.ts.map +0 -1
- package/lib/src/server/expectations/validation-schemas.js +0 -36
- package/lib/src/server/expectations/validation-schemas.js.map +0 -1
- package/lib/src/server/middlewares/model.d.ts +0 -25
- package/lib/src/server/middlewares/model.d.ts.map +0 -1
- package/lib/src/server/middlewares/model.js.map +0 -1
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
- package/lib/src/server/models/server-context/index.d.ts +0 -14
- package/lib/src/server/models/server-context/index.d.ts.map +0 -1
- package/lib/src/server/models/server-context/index.js +0 -20
- package/lib/src/server/models/server-context/index.js.map +0 -1
- package/lib/src/server/types.d.ts +0 -6
- package/lib/src/server/types.d.ts.map +0 -1
- package/lib/src/server/types.js +0 -3
- package/lib/src/server/types.js.map +0 -1
- package/lib/src/server/utils/index.d.ts.map +0 -1
- package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
- package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
- package/lib/src/server/web-socket-exchange/index.js.map +0 -1
- package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
- package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
- package/lib/src/server/web-socket-exchange/types.js +0 -3
- package/lib/src/server/web-socket-exchange/types.js.map +0 -1
- /package/lib/src/{server/expectations → expectations}/errors/index.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/errors/index.js +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/and.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/exec.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/has.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/if.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/merge.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/not.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/or.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/remove.operator.spec.d.ts +0 -0
- /package/lib/src/{server/expectations → expectations}/operators/set.operator.spec.d.ts +0 -0
- /package/lib/src/{client/methods/expectations → server/ws-exchange}/types.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const __utils__1 = require("../__utils__");
|
|
27
|
+
const operators = __importStar(require("./index"));
|
|
28
|
+
describe('Expectations.Operators.If', () => {
|
|
29
|
+
describe('matching', () => {
|
|
30
|
+
it('should match by schema with simple valid condition and valid [then] target branch', () => {
|
|
31
|
+
const operator = new operators.$if(operators, {
|
|
32
|
+
$condition: { $has: { $location: 'path', $regExp: /^\/foo/ } },
|
|
33
|
+
$then: { $has: { $location: 'method', $value: 'POST' } },
|
|
34
|
+
});
|
|
35
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
it('should match by schema with simple invalid condition and valid [then] target branch', () => {
|
|
38
|
+
const operator = new operators.$if(operators, {
|
|
39
|
+
$condition: { $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
40
|
+
$then: { $has: { $location: 'method', $value: 'POST' } },
|
|
41
|
+
});
|
|
42
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
43
|
+
});
|
|
44
|
+
it('should match by schema with simple valid condition and invalid [then] target branch', () => {
|
|
45
|
+
const operator = new operators.$if(operators, {
|
|
46
|
+
$condition: { $has: { $location: 'path', $regExp: /^\/foo/ } },
|
|
47
|
+
$then: { $has: { $location: 'method', $value: 'GET' } },
|
|
48
|
+
});
|
|
49
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
50
|
+
});
|
|
51
|
+
it('should match by schema with simple invalid condition and valid [else] target branch', () => {
|
|
52
|
+
const operator = new operators.$if(operators, {
|
|
53
|
+
$condition: { $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
54
|
+
$else: { $has: { $location: 'method', $value: 'POST' } },
|
|
55
|
+
});
|
|
56
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
it('should match by schema with simple invalid condition and invalid [else] target branch', () => {
|
|
59
|
+
const operator = new operators.$if(operators, {
|
|
60
|
+
$condition: { $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
61
|
+
$else: { $has: { $location: 'method', $value: 'GET' } },
|
|
62
|
+
});
|
|
63
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
64
|
+
});
|
|
65
|
+
it('should match by schema with complex valid condition', () => {
|
|
66
|
+
const operator = new operators.$if(operators, {
|
|
67
|
+
$condition: {
|
|
68
|
+
$or: [
|
|
69
|
+
{ $if: { $condition: {} } },
|
|
70
|
+
{ $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
71
|
+
{ $has: { $location: 'method', $value: 'POST' } },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
$then: {
|
|
75
|
+
$or: [
|
|
76
|
+
{ $has: { $location: 'incoming.body', $path: 'foo.1.test.0', $regExp: /^2/ } },
|
|
77
|
+
{ $has: { $location: 'incoming.body', $path: 'foo.1.baz.0', $regExp: /^2/ } },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
82
|
+
});
|
|
83
|
+
it('should match by schema with complex invalid condition', () => {
|
|
84
|
+
const operator = new operators.$if(operators, {
|
|
85
|
+
$condition: {
|
|
86
|
+
$or: [
|
|
87
|
+
{ $if: { $condition: {} } },
|
|
88
|
+
{ $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
89
|
+
{ $has: { $location: 'method', $value: 'GET' } },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
$else: {
|
|
93
|
+
$has: { $location: 'incoming.body', $path: 'foo.1.test.0', $regExp: /^2/ },
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('manipulation', () => {
|
|
100
|
+
it('should manipulate by schema with conplex condition', () => {
|
|
101
|
+
const operator = new operators.$if(operators, {
|
|
102
|
+
$condition: {
|
|
103
|
+
$or: [
|
|
104
|
+
{ $if: { $condition: {} } },
|
|
105
|
+
{ $has: { $location: 'path', $regExp: /^\/bar/ } },
|
|
106
|
+
{ $has: { $location: 'method', $value: 'POST' } },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
$then: {
|
|
110
|
+
$and: [
|
|
111
|
+
{ $set: { $location: 'incoming.headers', $path: 'content-length', $value: 100 } },
|
|
112
|
+
{ $set: { $location: 'incoming.query', $path: 'bar.baz', $value: { test: true } } },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
|
|
117
|
+
expect(context.incoming.headers?.['content-length']).toEqual(100);
|
|
118
|
+
expect(context.incoming.query?.bar?.baz?.test).toBeTruthy();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=if.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/if.operator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAAqC;AAErC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;YAC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{ default as $merge } from './merge.operator';
|
|
8
8
|
export { default as $remove } from './remove.operator';
|
|
9
9
|
export { default as $exec } from './exec.operator';
|
|
10
|
+
export { default as $switch } from './switch.operator';
|
|
11
|
+
export { default as root } from './root.operator';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.$exec = exports.$remove = exports.$merge = exports.$set = exports.$has = exports.$if = exports.$not = exports.$or = exports.$and = void 0;
|
|
6
|
+
exports.root = exports.$switch = exports.$exec = exports.$remove = exports.$merge = exports.$set = exports.$has = exports.$if = exports.$not = exports.$or = exports.$and = void 0;
|
|
7
7
|
var and_operator_1 = require("./and.operator");
|
|
8
8
|
Object.defineProperty(exports, "$and", { enumerable: true, get: function () { return __importDefault(and_operator_1).default; } });
|
|
9
9
|
var or_operator_1 = require("./or.operator");
|
|
@@ -22,4 +22,8 @@ var remove_operator_1 = require("./remove.operator");
|
|
|
22
22
|
Object.defineProperty(exports, "$remove", { enumerable: true, get: function () { return __importDefault(remove_operator_1).default; } });
|
|
23
23
|
var exec_operator_1 = require("./exec.operator");
|
|
24
24
|
Object.defineProperty(exports, "$exec", { enumerable: true, get: function () { return __importDefault(exec_operator_1).default; } });
|
|
25
|
+
var switch_operator_1 = require("./switch.operator");
|
|
26
|
+
Object.defineProperty(exports, "$switch", { enumerable: true, get: function () { return __importDefault(switch_operator_1).default; } });
|
|
27
|
+
var root_operator_1 = require("./root.operator");
|
|
28
|
+
Object.defineProperty(exports, "root", { enumerable: true, get: function () { return __importDefault(root_operator_1).default; } });
|
|
25
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/operators/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,6CAA+C;AAAtC,mHAAA,OAAO,OAAO;AACvB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,6CAA+C;AAAtC,mHAAA,OAAO,OAAO;AACvB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,mDAAqD;AAA5C,yHAAA,OAAO,OAAU;AAC1B,qDAAuD;AAA9C,2HAAA,OAAO,OAAW;AAC3B,iDAAmD;AAA1C,uHAAA,OAAO,OAAS;AACzB,qDAAuD;AAA9C,2HAAA,OAAO,OAAW;AAC3B,iDAAkD;AAAzC,sHAAA,OAAO,OAAQ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExpectationOperator } from '../models/operator';
|
|
2
|
+
import { CompileExpectationOperatorValueWithPredicate, IExpectationOperatorContext, TExpectationOperatorLocation } from '../types';
|
|
3
|
+
export default class MergeExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, {
|
|
4
|
+
[K in TLocation]: {
|
|
5
|
+
$location: K;
|
|
6
|
+
$value: CompileExpectationOperatorValueWithPredicate<TContext, K, TValue>;
|
|
7
|
+
$path?: string;
|
|
8
|
+
$jsonPath?: string;
|
|
9
|
+
};
|
|
10
|
+
}[TLocation]> {
|
|
11
|
+
match(): boolean;
|
|
12
|
+
manipulate<T extends TContext>(context: T): T;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=merge.operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/merge.operator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,4CAA4C,EAC5C,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,OAAO,OAAO,wBAAwB,CAC3C,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,EAC7E,MAAM,GAAG,IAAI,CACb,SAAQ,mBAAmB,CAC3B,QAAQ,EACR;KACG,CAAC,IAAI,SAAS,GAAG;QAChB,SAAS,EAAE,CAAC,CAAC;QACb,MAAM,EAAE,4CAA4C,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAE1E,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF,CAAC,SAAS,CAAC,CACb;IACQ,KAAK,IAAI,OAAO;IAIhB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAgCrD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 deepmerge_1 = __importDefault(require("deepmerge"));
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const utils_2 = require("../../utils");
|
|
10
|
+
const operator_1 = require("../models/operator");
|
|
11
|
+
class MergeExpectationOperator extends operator_1.ExpectationOperator {
|
|
12
|
+
match() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
manipulate(context) {
|
|
16
|
+
const payload = (0, utils_1.extractContextByLocation)(this.command.$location, context);
|
|
17
|
+
if (payload?.type !== 'object') {
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
if (this.command.$path) {
|
|
21
|
+
lodash_1.default.set(payload.value, this.command.$path, (0, deepmerge_1.default)(lodash_1.default.get(payload.value, this.command.$path), this.command.$value ?? {}));
|
|
22
|
+
return context;
|
|
23
|
+
}
|
|
24
|
+
if (this.command.$jsonPath) {
|
|
25
|
+
(0, utils_2.extractWithJsonPathSafe)({ path: this.command.$jsonPath, json: payload.value })
|
|
26
|
+
.results?.forEach((segment) => lodash_1.default.set(payload.value, segment.pointer.substring(1).replace(/\//g, '.'), (0, deepmerge_1.default)(lodash_1.default.get(segment.parent, segment.parentProperty), this.command.$value ?? {})));
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
lodash_1.default.set(payload.parent, payload.key, (0, deepmerge_1.default)(payload.value, this.command.$value ?? {}));
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = MergeExpectationOperator;
|
|
34
|
+
//# sourceMappingURL=merge.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/merge.operator.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8B;AAC9B,oDAAuB;AAEvB,oCAAoD;AACpD,uCAAsD;AACtD,iDAAyD;AAOzD,MAAqB,wBAInB,SAAQ,8BAWT;IACQ,KAAK;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,MAAM,OAAO,GAAG,IAAA,gCAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvB,gBAAC,CAAC,GAAG,CACH,OAAO,CAAC,KAAK,EACb,IAAI,CAAC,OAAO,CAAC,KAAK,EAClB,IAAA,mBAAK,EAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAU,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CACnF,CAAC;YAEF,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAA,+BAAuB,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;iBAC3E,OAAO,EAAE,OAAO,CACf,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,GAAG,CAChB,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAChD,IAAA,mBAAK,EAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,EAAU,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CACxF,CACF,CAAC;YAEJ,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAA,mBAAK,EAAC,OAAO,CAAC,KAAK,EAAU,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5F,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AApDD,2CAoDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.operator.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/merge.operator.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const __utils__1 = require("../__utils__");
|
|
27
|
+
const operators = __importStar(require("./index"));
|
|
28
|
+
describe('Expectations.Operators.Merge', () => {
|
|
29
|
+
it('should handle schema with non object payload', () => {
|
|
30
|
+
const operator = new operators.$merge(operators, {
|
|
31
|
+
$location: 'path',
|
|
32
|
+
$value: true,
|
|
33
|
+
});
|
|
34
|
+
const context = operator.manipulate({ incoming: { path: 'test' } });
|
|
35
|
+
expect(context.incoming.path).toEqual('test');
|
|
36
|
+
});
|
|
37
|
+
it('should manipulate by schema', () => {
|
|
38
|
+
const operator = new operators.$merge(operators, {
|
|
39
|
+
$location: 'incoming.query',
|
|
40
|
+
$value: { test: true },
|
|
41
|
+
});
|
|
42
|
+
const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
|
|
43
|
+
expect(context.incoming.query.test).toBeTruthy();
|
|
44
|
+
});
|
|
45
|
+
it('should manipulate by schema using path', () => {
|
|
46
|
+
const operator = new operators.$merge(operators, {
|
|
47
|
+
$location: 'incoming.query',
|
|
48
|
+
$path: 'bar',
|
|
49
|
+
$value: { test: true },
|
|
50
|
+
});
|
|
51
|
+
const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
|
|
52
|
+
expect(context.incoming.query.bar.test).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('should manipulate by schema using jsonPath', () => {
|
|
55
|
+
const operator = new operators.$merge(operators, {
|
|
56
|
+
$location: 'incoming.body',
|
|
57
|
+
$jsonPath: '$.foo[*]',
|
|
58
|
+
$value: { test: true },
|
|
59
|
+
});
|
|
60
|
+
const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
|
|
61
|
+
expect(context.incoming.body.foo[0].test).toBeTruthy();
|
|
62
|
+
expect(context.incoming.body.foo[1].test).toBeTruthy();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=merge.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/merge.operator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAAqC;AAErC,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE;YAC/C,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACpE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE;YAC/C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACvB,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAM,IAAA,kCAAuB,GAAE,CAAC,CAAC;QACpE,M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peratorLocation } from '../types';
|
|
2
|
+
import { ExpectationOperator } from '../models/operator';
|
|
3
|
+
export default class NotExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>> {
|
|
4
|
+
compiled: ExpectationOperator<TContext, any> | null;
|
|
5
|
+
match(context: TContext): boolean;
|
|
6
|
+
manipulate<T extends TContext>(context: T): T;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=not.operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAE1F,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,EAC7E,MAAM,GAAG,IAAI,CACb,SAAQ,mBAAmB,CAC3B,QAAQ,EACR,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CACzD;IACQ,QAAQ,4CAQV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAGrD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const operator_1 = require("../models/operator");
|
|
4
|
+
class NotExpectationOperator extends operator_1.ExpectationOperator {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.compiled = (() => {
|
|
8
|
+
const extracted = this.extractNestedSchema(this.command);
|
|
9
|
+
if (!extracted) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const Operator = this.operators[extracted.key];
|
|
13
|
+
return new Operator(this.operators, extracted.nested);
|
|
14
|
+
})();
|
|
15
|
+
}
|
|
16
|
+
match(context) {
|
|
17
|
+
return this.compiled ? !this.compiled.match(context) : false;
|
|
18
|
+
}
|
|
19
|
+
manipulate(context) {
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = NotExpectationOperator;
|
|
24
|
+
//# sourceMappingURL=not.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,sBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,CAAC,GAAG,EAAE;YACtB,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,QAAQ,GAA8C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC1F,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,EAAE,CAAC;IASP,CAAC;IAPQ,KAAK,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzBD,yCAyBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not.operator.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const __utils__1 = require("../__utils__");
|
|
27
|
+
const operators = __importStar(require("./index"));
|
|
28
|
+
describe('Expectations.Operators.Not', () => {
|
|
29
|
+
it('should match by schema', () => {
|
|
30
|
+
const operator = new operators.$not(operators, {
|
|
31
|
+
$has: { $location: 'incoming.query', $path: 'foo', $value: 1 },
|
|
32
|
+
});
|
|
33
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=not.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAAqC;AAErC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE;YAC7C,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;SAC/D,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
|
|
2
|
+
import { ExpectationOperator } from '../models/operator';
|
|
3
|
+
export default class OrExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>[]> {
|
|
4
|
+
compiled: ExpectationOperator<TContext, any>[];
|
|
5
|
+
match(context: TContext): boolean;
|
|
6
|
+
manipulate<T extends TContext>(context: T): T;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=or.operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAE1F,MAAM,CAAC,OAAO,OAAO,qBAAqB,CACxC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,EAC7E,MAAM,GAAG,IAAI,CACb,SAAQ,mBAAmB,CAC3B,QAAQ,EACR,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAC3D;IACQ,QAAQ,uCAMV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAIrD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const operator_1 = require("../models/operator");
|
|
4
|
+
class OrExpectationOperator extends operator_1.ExpectationOperator {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.compiled = this.command
|
|
8
|
+
.map((schema) => this.extractNestedSchema(schema))
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.map((extracted) => {
|
|
11
|
+
const Operator = this.operators[extracted.key];
|
|
12
|
+
return new Operator(this.operators, extracted.nested);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
match(context) {
|
|
16
|
+
return this.compiled.some((operator) => operator.match(context));
|
|
17
|
+
}
|
|
18
|
+
manipulate(context) {
|
|
19
|
+
this.compiled.forEach((operator) => operator.manipulate(context));
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = OrExpectationOperator;
|
|
24
|
+
//# sourceMappingURL=or.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,qBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,IAAI,CAAC,OAAO;aAC3B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAE,CAAC;aAClD,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACjB,MAAM,QAAQ,GAA8C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC1F,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IAUP,CAAC;IARQ,KAAK,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxBD,wCAwBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.operator.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const __utils__1 = require("../__utils__");
|
|
27
|
+
const operators = __importStar(require("./index"));
|
|
28
|
+
describe('Expectations.Operators.Or', () => {
|
|
29
|
+
describe('matching', () => {
|
|
30
|
+
it('should match by schema with one valid condition', () => {
|
|
31
|
+
const operator = new operators.$or(operators, [
|
|
32
|
+
{ $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
|
|
33
|
+
]);
|
|
34
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
35
|
+
});
|
|
36
|
+
it('should match by schema with two valid conditions', () => {
|
|
37
|
+
const operator = new operators.$or(operators, [
|
|
38
|
+
{ $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
|
|
39
|
+
{ $has: { $location: 'incoming.query', $path: 'bar.baz', $value: null } },
|
|
40
|
+
]);
|
|
41
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
it('should match by schema with zero conditions', () => {
|
|
44
|
+
const operator = new operators.$or(operators, []);
|
|
45
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
46
|
+
});
|
|
47
|
+
it('should match by schema with one valid and one invalid condition', () => {
|
|
48
|
+
const operator = new operators.$or(operators, [
|
|
49
|
+
{ $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
|
|
50
|
+
{ $has: { $location: 'incoming.query', $path: 'bar.baz', $value: 1 } },
|
|
51
|
+
]);
|
|
52
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('should match by schema with two invalid conditions', () => {
|
|
55
|
+
const operator = new operators.$or(operators, [
|
|
56
|
+
{ $has: { $location: 'incoming.query', $path: 'foo', $value: null } },
|
|
57
|
+
{ $has: { $location: 'incoming.query', $path: 'bar.baz', $value: 1 } },
|
|
58
|
+
]);
|
|
59
|
+
expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('manipulation', () => {
|
|
63
|
+
it('should manipulate by schema with two conditions', () => {
|
|
64
|
+
const operator = new operators.$or(operators, [
|
|
65
|
+
{ $set: { $location: 'incoming.headers', $path: 'content-length', $value: 100 } },
|
|
66
|
+
{ $set: { $location: 'incoming.query', $path: 'bar.baz', $value: { test: true } } },
|
|
67
|
+
]);
|
|
68
|
+
const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
|
|
69
|
+
expect(context.incoming.headers?.['content-length']).toEqual(100);
|
|
70
|
+
expect(context.incoming.query?.bar?.baz?.test).toBeTruthy();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=or.operator.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAAqC;AAErC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE;gBAC5C,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;aACnE,CAAC,CAAC;YAEH,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE;gBAC5C,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;aAC1E,CAAC,CAAC;YAEH,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,MAAM,QAAQ,G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,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,GAAG,CAAM,SAAS,EAAE;gBACjD,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;gBACjF,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;aACpF,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAM,IAAA,kCAAuB,GAAE,CAAC,CAAC;YAEpE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAClE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IExpectationOperatorContext, TExpectationOperatorLocation } from '../types';
|
|
2
|
+
import { ExpectationOperator } from '../models/operator';
|
|
3
|
+
export default class RemoveExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation> extends ExpectationOperator<TContext, {
|
|
4
|
+
[K in TLocation]: {
|
|
5
|
+
$location: K;
|
|
6
|
+
$path?: string;
|
|
7
|
+
$jsonPath?: string;
|
|
8
|
+
};
|
|
9
|
+
}[TLocation]> {
|
|
10
|
+
match(): boolean;
|
|
11
|
+
manipulate<T extends TContext>(context: T): T;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=remove.operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,yBAAyB,CAC5C,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,CAC7E,SAAQ,mBAAmB,CAC3B,QAAQ,EACR;KACG,CAAC,IAAI,SAAS,GAAG;QAChB,SAAS,EAAE,CAAC,CAAC;QAEb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF,CAAC,SAAS,CAAC,CACb;IACQ,KAAK,IAAI,OAAO;IAIhB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAqBrD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
const operator_1 = require("../models/operator");
|
|
10
|
+
class RemoveExpectationOperator extends operator_1.ExpectationOperator {
|
|
11
|
+
match() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
manipulate(context) {
|
|
15
|
+
const payload = (0, utils_1.extractContextByLocation)(this.command.$location, context);
|
|
16
|
+
if (payload?.type !== 'object') {
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
if (this.command.$path) {
|
|
20
|
+
lodash_1.default.unset(payload.value, this.command.$path);
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
if (this.command.$jsonPath) {
|
|
24
|
+
(0, utils_2.extractWithJsonPathSafe)({ path: this.command.$jsonPath, json: payload.value })
|
|
25
|
+
.results?.forEach((segment) => lodash_1.default.unset(segment.parent, segment.parentProperty));
|
|
26
|
+
return context;
|
|
27
|
+
}
|
|
28
|
+
lodash_1.default.unset(payload.parent, payload.key);
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = RemoveExpectationOperator;
|
|
33
|
+
//# sourceMappingURL=remove.operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAGvB,oCAAoD;AACpD,uCAAsD;AACtD,iDAAyD;AAEzD,MAAqB,yBAGnB,SAAQ,8BAUT;IACQ,KAAK;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,MAAM,OAAO,GAAG,IAAA,gCAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvB,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAA,+BAAuB,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;iBAC3E,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;YAElF,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAvCD,4CAuCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.operator.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.spec.ts"],"names":[],"mappings":""}
|