@n1k1t/mock-server 0.1.1 → 0.1.3
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/lib/package.json +5 -2
- package/lib/src/client/helpers/expectations.d.ts +89 -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 +1 -0
- package/lib/src/client/index.d.ts.map +1 -1
- package/lib/src/client/index.js +1 -0
- package/lib/src/client/index.js.map +1 -1
- package/lib/src/client/methods/expectations.create.method.d.ts +1 -3
- package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -1
- package/lib/src/client/methods/expectations.create.method.js +3 -3
- package/lib/src/client/methods/expectations.create.method.js.map +1 -1
- package/lib/src/client/methods/expectations.update.method.d.ts +2 -2
- package/lib/src/client/methods/expectations.update.method.js +6 -6
- package/lib/src/client/methods/expectations.update.method.js.map +1 -1
- package/lib/src/client/methods/ping.method.d.ts +1 -1
- package/lib/src/client/methods/ping.method.js.map +1 -1
- 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 +224 -0
- package/lib/src/client/models/client.spec.js.map +1 -0
- package/lib/src/client/models/index.d.ts +1 -0
- package/lib/src/client/models/index.d.ts.map +1 -1
- package/lib/src/client/models/index.js +1 -0
- package/lib/src/client/models/index.js.map +1 -1
- package/lib/src/client/models/method.d.ts +4 -4
- package/lib/src/client/models/method.d.ts.map +1 -1
- package/lib/src/client/models/method.js.map +1 -1
- package/lib/src/client/onsite.d.ts +4 -3
- package/lib/src/client/onsite.d.ts.map +1 -1
- package/lib/src/client/onsite.js +8 -6
- package/lib/src/client/onsite.js.map +1 -1
- package/lib/src/client/remote.d.ts +4 -4
- package/lib/src/client/remote.d.ts.map +1 -1
- package/lib/src/client/remote.js +11 -10
- package/lib/src/client/remote.js.map +1 -1
- package/lib/src/client/types.d.ts +2 -0
- package/lib/src/client/types.d.ts.map +1 -1
- package/lib/src/client/utils.d.ts +2 -2
- package/lib/src/client/utils.d.ts.map +1 -1
- package/lib/src/client/utils.js +25 -12
- package/lib/src/client/utils.js.map +1 -1
- package/lib/src/expectations/__utils__/index.d.ts +2 -2
- package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
- package/lib/src/expectations/__utils__/index.js +31 -23
- package/lib/src/expectations/__utils__/index.js.map +1 -1
- package/lib/src/expectations/index.d.ts +1 -2
- package/lib/src/expectations/index.d.ts.map +1 -1
- package/lib/src/expectations/index.js +1 -2
- package/lib/src/expectations/index.js.map +1 -1
- package/lib/src/expectations/models/expectation.d.ts +33 -0
- package/lib/src/expectations/models/expectation.d.ts.map +1 -0
- package/lib/src/expectations/models/expectation.js +81 -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 +49 -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/expectations/{storage.js → 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 +7 -2
- package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/and.operator.js +21 -2
- package/lib/src/expectations/operators/and.operator.js.map +1 -1
- package/lib/src/expectations/operators/and.operator.spec.js +57 -39
- package/lib/src/expectations/operators/and.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.d.ts +7 -2
- package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/exec.operator.js +14 -18
- package/lib/src/expectations/operators/exec.operator.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.spec.js +49 -18
- package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/has.operator.d.ts +27 -2
- package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/has.operator.js +108 -69
- package/lib/src/expectations/operators/has.operator.js.map +1 -1
- package/lib/src/expectations/operators/has.operator.spec.js +422 -161
- package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/if.operator.d.ts +15 -2
- package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/if.operator.js +44 -10
- package/lib/src/expectations/operators/if.operator.js.map +1 -1
- package/lib/src/expectations/operators/if.operator.spec.js +89 -65
- package/lib/src/expectations/operators/if.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/index.d.ts +2 -0
- package/lib/src/expectations/operators/index.d.ts.map +1 -1
- package/lib/src/expectations/operators/index.js +5 -1
- package/lib/src/expectations/operators/index.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.d.ts +13 -2
- package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/merge.operator.js +23 -19
- package/lib/src/expectations/operators/merge.operator.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.spec.js +43 -33
- package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/not.operator.d.ts +7 -2
- package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/not.operator.js +21 -2
- package/lib/src/expectations/operators/not.operator.js.map +1 -1
- package/lib/src/expectations/operators/not.operator.spec.js +28 -9
- package/lib/src/expectations/operators/not.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/or.operator.d.ts +7 -2
- package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/or.operator.js +21 -6
- package/lib/src/expectations/operators/or.operator.js.map +1 -1
- package/lib/src/expectations/operators/or.operator.spec.js +58 -39
- package/lib/src/expectations/operators/or.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.d.ts +12 -2
- package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/remove.operator.js +22 -17
- package/lib/src/expectations/operators/remove.operator.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.spec.js +40 -28
- package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
- 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 +20 -2
- package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/set.operator.js +38 -23
- package/lib/src/expectations/operators/set.operator.js.map +1 -1
- package/lib/src/expectations/operators/set.operator.spec.js +87 -43
- package/lib/src/expectations/operators/set.operator.spec.js.map +1 -1
- 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 +67 -63
- package/lib/src/expectations/types.d.ts.map +1 -1
- package/lib/src/expectations/types.js +17 -3
- package/lib/src/expectations/types.js.map +1 -1
- package/lib/src/expectations/utils.d.ts +23 -10
- package/lib/src/expectations/utils.d.ts.map +1 -1
- package/lib/src/expectations/utils.js +111 -53
- package/lib/src/expectations/utils.js.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.js +2 -4
- package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +9 -11
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.js +2 -3
- package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +8 -5
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.js +2 -2
- package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js +2 -2
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +13 -11
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.js +4 -6
- 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 +1 -1
- package/lib/src/server/endpoints/index.d.ts.map +1 -1
- package/lib/src/server/endpoints/index.js +3 -3
- package/lib/src/server/endpoints/index.js.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.js +1 -1
- 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 +2 -2
- package/lib/src/server/history/storage.js.map +1 -1
- package/lib/src/server/index.d.ts +10 -6
- package/lib/src/server/index.d.ts.map +1 -1
- package/lib/src/server/index.js +21 -22
- package/lib/src/server/index.js.map +1 -1
- package/lib/src/server/middlewares/delay.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/delay.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/delay.middleware.js +13 -0
- package/lib/src/server/middlewares/delay.middleware.js.map +1 -0
- package/lib/src/server/middlewares/destroy.midleware.d.ts +24 -0
- package/lib/src/server/middlewares/destroy.midleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/destroy.midleware.js +16 -0
- package/lib/src/server/middlewares/destroy.midleware.js.map +1 -0
- package/lib/src/server/middlewares/forward.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/forward.middleware.js +71 -0
- package/lib/src/server/middlewares/forward.middleware.js.map +1 -0
- package/lib/src/server/middlewares/history.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/history.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/history.middleware.js +13 -0
- package/lib/src/server/middlewares/history.middleware.js.map +1 -0
- package/lib/src/server/middlewares/index.d.ts +7 -6
- package/lib/src/server/middlewares/index.d.ts.map +1 -1
- package/lib/src/server/middlewares/index.js +15 -13
- package/lib/src/server/middlewares/index.js.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.d.ts +20 -2
- package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.js +4 -3
- package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js +13 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js.map +1 -0
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts +24 -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/public.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/public.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/{resolve-public.middleware.js → public.middleware.js} +13 -13
- package/lib/src/server/middlewares/public.middleware.js.map +1 -0
- package/lib/src/server/middlewares/reply.middleware.d.ts +21 -5
- package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/reply.middleware.js +34 -25
- package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
- package/lib/src/server/models/endpoint.d.ts +19 -13
- package/lib/src/server/models/endpoint.d.ts.map +1 -1
- package/lib/src/server/models/endpoint.js +2 -2
- package/lib/src/server/models/endpoint.js.map +1 -1
- package/lib/src/server/models/middleware.d.ts +21 -20
- package/lib/src/server/models/middleware.d.ts.map +1 -1
- package/lib/src/server/models/middleware.js +6 -10
- package/lib/src/server/models/middleware.js.map +1 -1
- 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 +45 -0
- package/lib/src/server/models/request-context/http.d.ts.map +1 -0
- package/lib/src/server/models/request-context/http.js +71 -0
- package/lib/src/server/models/request-context/http.js.map +1 -0
- package/lib/src/server/models/request-context/index.d.ts +4 -57
- 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 +16 -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 +4 -4
- package/lib/src/server/models/server-context.d.ts.map +1 -1
- package/lib/src/server/models/server-context.js +5 -5
- package/lib/src/server/models/server-context.js.map +1 -1
- package/lib/src/server/router.d.ts +4 -7
- 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 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/index.js +1 -0
- package/lib/src/utils/index.js.map +1 -1
- package/lib/src/utils/json.d.ts +1 -1
- package/lib/src/utils/json.d.ts.map +1 -1
- package/lib/src/utils/json.js +3 -3
- package/lib/src/utils/json.js.map +1 -1
- 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/test/index.js +140 -136
- 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 +5 -2
- package/types/common.global.ts +21 -2
- package/types/lib.ts +1 -0
- package/lib/src/expectations/model.d.ts +0 -39
- package/lib/src/expectations/model.d.ts.map +0 -1
- package/lib/src/expectations/model.js +0 -90
- package/lib/src/expectations/model.js.map +0 -1
- package/lib/src/expectations/operators/utils.d.ts +0 -20
- package/lib/src/expectations/operators/utils.d.ts.map +0 -1
- package/lib/src/expectations/operators/utils.js +0 -67
- package/lib/src/expectations/operators/utils.js.map +0 -1
- package/lib/src/expectations/storage.d.ts +0 -19
- package/lib/src/expectations/storage.d.ts.map +0 -1
- package/lib/src/expectations/storage.js.map +0 -1
- package/lib/src/expectations/utils.spec.d.ts +0 -2
- package/lib/src/expectations/utils.spec.d.ts.map +0 -1
- package/lib/src/expectations/utils.spec.js +0 -59
- package/lib/src/expectations/utils.spec.js.map +0 -1
- package/lib/src/expectations/validation-schemas.d.ts +0 -14
- package/lib/src/expectations/validation-schemas.d.ts.map +0 -1
- package/lib/src/expectations/validation-schemas.js +0 -36
- package/lib/src/expectations/validation-schemas.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 -9
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
- package/lib/src/server/middlewares/add-history.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/add-history.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/add-history.middleware.js +0 -14
- package/lib/src/server/middlewares/add-history.middleware.js.map +0 -1
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts +0 -8
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/destroy-request.midleware.js +0 -17
- package/lib/src/server/middlewares/destroy-request.midleware.js.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +0 -18
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +0 -86
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +0 -1
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts +0 -6
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/resolve-public.middleware.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/types.d.ts +0 -6
- package/lib/src/server/types.d.ts.map +0 -1
- package/lib/src/server/types.js.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/{types.js → ws-exchange/types.js} +0 -0
|
@@ -9,11 +9,14 @@ declare const _default: Endpoint<null, {
|
|
|
9
9
|
readonly path: "/_mock/expectations";
|
|
10
10
|
};
|
|
11
11
|
} & {
|
|
12
|
-
handler: ({ reply,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
handler: ({ reply, incoming, server }: (import("../models").HttpRequestContext<null> | import("../models").WsRequestContext<null>) & {
|
|
13
|
+
incoming: OmitPartial<{
|
|
14
|
+
body: void | {
|
|
15
|
+
ids?: string[];
|
|
16
|
+
};
|
|
17
|
+
query: void | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
}) => Promise<void>;
|
|
17
20
|
};
|
|
18
21
|
export default _default;
|
|
19
22
|
//# sourceMappingURL=expectations.delete.endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.delete.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.delete.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;UAGd,IAAI,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE
|
|
1
|
+
{"version":3,"file":"expectations.delete.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.delete.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;UAGd,IAAI,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE;;;;;;;;;;sBAAV,MAAM,EAAE;;;;;;AAD9C,wBAMK"}
|
|
@@ -4,8 +4,8 @@ const models_1 = require("../models");
|
|
|
4
4
|
exports.default = models_1.Endpoint
|
|
5
5
|
.build()
|
|
6
6
|
.bindToHttp({ method: 'DELETE', path: '/_mock/expectations' })
|
|
7
|
-
.assignHandler(async ({ reply,
|
|
8
|
-
await client.deleteExpectations(body);
|
|
7
|
+
.assignHandler(async ({ reply, incoming, server }) => {
|
|
8
|
+
await server.client.deleteExpectations(incoming.body);
|
|
9
9
|
reply.ok(null);
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=expectations.delete.endpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.delete.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.delete.endpoint.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAA6C;KAClD,UAAU,CAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;KACpE,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"expectations.delete.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.delete.endpoint.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAA6C;KAClD,UAAU,CAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;KACpE,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,MAAM,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Expectation } from '../../expectations';
|
|
2
2
|
import { Endpoint } from '../models';
|
|
3
|
-
declare const _default: Endpoint<Expectation[],
|
|
3
|
+
declare const _default: Endpoint<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">[], {}> & {
|
|
4
4
|
http: {
|
|
5
5
|
readonly method: "GET";
|
|
6
6
|
readonly path: "/_mock/expectations";
|
|
7
7
|
};
|
|
8
8
|
} & {
|
|
9
|
-
|
|
9
|
+
ws: {
|
|
10
10
|
readonly path: "expectations:get";
|
|
11
11
|
};
|
|
12
12
|
} & {
|
|
13
|
-
handler: ({ reply,
|
|
13
|
+
handler: ({ reply, server }: (import("../models").HttpRequestContext<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">[]> | import("../models").WsRequestContext<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">[]>) & {
|
|
14
|
+
incoming: OmitPartial<{
|
|
15
|
+
body: void | undefined;
|
|
16
|
+
query: void | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
}) => void;
|
|
14
19
|
};
|
|
15
20
|
export default _default;
|
|
16
21
|
//# sourceMappingURL=expectations.get-list.endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.get-list.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.get-list.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"expectations.get-list.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.get-list.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAErC,wBAQI"}
|
|
@@ -4,6 +4,6 @@ const models_1 = require("../models");
|
|
|
4
4
|
exports.default = models_1.Endpoint
|
|
5
5
|
.build()
|
|
6
6
|
.bindToHttp({ method: 'GET', path: '/_mock/expectations' })
|
|
7
|
-
.
|
|
8
|
-
.assignHandler(({ reply,
|
|
7
|
+
.bindToWs({ path: 'expectations:get' })
|
|
8
|
+
.assignHandler(({ reply, server }) => reply.ok([...server.storage.expectations.values()].map((expectation) => expectation.toPlain())));
|
|
9
9
|
//# sourceMappingURL=expectations.get-list.endpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.get-list.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.get-list.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,
|
|
1
|
+
{"version":3,"file":"expectations.get-list.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.get-list.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAA2B;KAChC,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;KACjE,QAAQ,CAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;KAC7C,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACnC,KAAK,CAAC,EAAE,CACN,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CACtF,CACF,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Expectation } from '../../expectations';
|
|
1
|
+
import { Expectation, TBuildExpectationConfiguration } from '../../expectations';
|
|
2
2
|
import { Endpoint } from '../models';
|
|
3
|
-
|
|
4
|
-
declare const _default: Endpoint<Expectation, {
|
|
3
|
+
declare const _default: Endpoint<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">, {
|
|
5
4
|
body: {
|
|
6
5
|
id: string;
|
|
7
|
-
set:
|
|
6
|
+
set: Partial<Omit<TBuildExpectationConfiguration<any>, "type">>;
|
|
8
7
|
};
|
|
9
8
|
}> & {
|
|
10
9
|
http: {
|
|
@@ -12,16 +11,19 @@ declare const _default: Endpoint<Expectation, {
|
|
|
12
11
|
readonly path: "/_mock/expectations";
|
|
13
12
|
};
|
|
14
13
|
} & {
|
|
15
|
-
|
|
14
|
+
ws: {
|
|
16
15
|
readonly path: "expectations:update";
|
|
17
16
|
};
|
|
18
17
|
} & {
|
|
19
|
-
handler: ({ reply,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
handler: ({ reply, incoming, server }: (import("../models").HttpRequestContext<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">> | import("../models").WsRequestContext<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta">>) & {
|
|
19
|
+
incoming: OmitPartial<{
|
|
20
|
+
body: {
|
|
21
|
+
id: string;
|
|
22
|
+
set: Partial<Omit<TBuildExpectationConfiguration<any>, "type">>;
|
|
23
|
+
};
|
|
24
|
+
query: void | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
}) => Promise<void>;
|
|
25
27
|
};
|
|
26
28
|
export default _default;
|
|
27
29
|
//# sourceMappingURL=expectations.update.endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.update.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.update.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"expectations.update.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.update.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;UAI3B;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;KACjE;;;;;;;;;;;;;;oBAFK,MAAM;qBACL,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;;;;;;AAJrE,wBAYK"}
|
|
@@ -4,11 +4,9 @@ const models_1 = require("../models");
|
|
|
4
4
|
exports.default = models_1.Endpoint
|
|
5
5
|
.build()
|
|
6
6
|
.bindToHttp({ method: 'PUT', path: '/_mock/expectations' })
|
|
7
|
-
.
|
|
8
|
-
.assignHandler(async ({ reply,
|
|
9
|
-
const result = await client.updateExpectation(body);
|
|
10
|
-
result
|
|
11
|
-
? reply.ok(result)
|
|
12
|
-
: reply.notFound();
|
|
7
|
+
.bindToWs({ path: 'expectations:update' })
|
|
8
|
+
.assignHandler(async ({ reply, incoming, server }) => {
|
|
9
|
+
const result = await server.client.updateExpectation(incoming.body);
|
|
10
|
+
result ? reply.ok(result) : reply.notFound();
|
|
13
11
|
});
|
|
14
12
|
//# sourceMappingURL=expectations.update.endpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectations.update.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.update.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;
|
|
1
|
+
{"version":3,"file":"expectations.update.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/expectations.update.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAKF;KACH,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;KACjE,QAAQ,CAAQ,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;KAChD,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC/C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { History } from '../history';
|
|
2
|
+
import { Endpoint } from '../models';
|
|
3
|
+
declare const _default: Endpoint<(Pick<History, "error" | "request" | "id" | "meta" | "forwaded"> & {
|
|
4
|
+
expectation?: import("../../expectations").Expectation<any>["TPlain"];
|
|
5
|
+
})[], {}> & {
|
|
6
|
+
http: {
|
|
7
|
+
readonly method: "GET";
|
|
8
|
+
readonly path: "/_mock/history";
|
|
9
|
+
};
|
|
10
|
+
} & {
|
|
11
|
+
ws: {
|
|
12
|
+
readonly path: "history:get";
|
|
13
|
+
};
|
|
14
|
+
} & {
|
|
15
|
+
handler: ({ reply, server }: (import("../models").HttpRequestContext<(Pick<History, "error" | "request" | "id" | "meta" | "forwaded"> & {
|
|
16
|
+
expectation?: import("../../expectations").Expectation<any>["TPlain"];
|
|
17
|
+
})[]> | import("../models").WsRequestContext<(Pick<History, "error" | "request" | "id" | "meta" | "forwaded"> & {
|
|
18
|
+
expectation?: import("../../expectations").Expectation<any>["TPlain"];
|
|
19
|
+
})[]>) & {
|
|
20
|
+
incoming: OmitPartial<{
|
|
21
|
+
body: void | undefined;
|
|
22
|
+
query: void | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
}) => void;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
27
|
+
//# sourceMappingURL=history.get-list.endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.get-list.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/history.get-list.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAErC,wBAUI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../models");
|
|
4
|
+
exports.default = models_1.Endpoint
|
|
5
|
+
.build()
|
|
6
|
+
.bindToHttp({ method: 'GET', path: '/_mock/history' })
|
|
7
|
+
.bindToWs({ path: 'history:get' })
|
|
8
|
+
.assignHandler(({ reply, server }) => reply.ok([...server.storage.history.values()]
|
|
9
|
+
.sort((a, b) => b.meta.requestedAt - a.meta.requestedAt)
|
|
10
|
+
.map((history) => history.toPlain())));
|
|
11
|
+
//# sourceMappingURL=history.get-list.endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.get-list.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/history.get-list.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAAuB;KAC5B,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;KAC5D,QAAQ,CAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KACxC,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CACnC,KAAK,CAAC,EAAE,CACN,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;KACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;KACvD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CACvC,CACF,CAAC"}
|
|
@@ -2,7 +2,7 @@ export { default as getExpectationsList } from './expectations.get-list.endpoint
|
|
|
2
2
|
export { default as createExpectation } from './expectations.create.endpoint';
|
|
3
3
|
export { default as deleteExpectation } from './expectations.delete.endpoint';
|
|
4
4
|
export { default as updateExpectation } from './expectations.update.endpoint';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as getHistoryList } from './history.get-list.endpoint';
|
|
6
6
|
export { default as getConfig } from './config.get.endpoint';
|
|
7
7
|
export { default as ping } from './ping.endpoint';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,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.ping = exports.getConfig = exports.
|
|
6
|
+
exports.ping = exports.getConfig = exports.getHistoryList = exports.updateExpectation = exports.deleteExpectation = exports.createExpectation = exports.getExpectationsList = void 0;
|
|
7
7
|
var expectations_get_list_endpoint_1 = require("./expectations.get-list.endpoint");
|
|
8
8
|
Object.defineProperty(exports, "getExpectationsList", { enumerable: true, get: function () { return __importDefault(expectations_get_list_endpoint_1).default; } });
|
|
9
9
|
var expectations_create_endpoint_1 = require("./expectations.create.endpoint");
|
|
@@ -12,8 +12,8 @@ var expectations_delete_endpoint_1 = require("./expectations.delete.endpoint");
|
|
|
12
12
|
Object.defineProperty(exports, "deleteExpectation", { enumerable: true, get: function () { return __importDefault(expectations_delete_endpoint_1).default; } });
|
|
13
13
|
var expectations_update_endpoint_1 = require("./expectations.update.endpoint");
|
|
14
14
|
Object.defineProperty(exports, "updateExpectation", { enumerable: true, get: function () { return __importDefault(expectations_update_endpoint_1).default; } });
|
|
15
|
-
var
|
|
16
|
-
Object.defineProperty(exports, "
|
|
15
|
+
var history_get_list_endpoint_1 = require("./history.get-list.endpoint");
|
|
16
|
+
Object.defineProperty(exports, "getHistoryList", { enumerable: true, get: function () { return __importDefault(history_get_list_endpoint_1).default; } });
|
|
17
17
|
var config_get_endpoint_1 = require("./config.get.endpoint");
|
|
18
18
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return __importDefault(config_get_endpoint_1).default; } });
|
|
19
19
|
var ping_endpoint_1 = require("./ping.endpoint");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/endpoints/index.ts"],"names":[],"mappings":";;;;;;AAAA,mFAAkF;AAAzE,sJAAA,OAAO,OAAuB;AACvC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AACrC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AACrC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AAErC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/endpoints/index.ts"],"names":[],"mappings":";;;;;;AAAA,mFAAkF;AAAzE,sJAAA,OAAO,OAAuB;AACvC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AACrC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AACrC,+EAA8E;AAArE,kJAAA,OAAO,OAAqB;AAErC,yEAAwE;AAA/D,4IAAA,OAAO,OAAkB;AAElC,6DAA6D;AAApD,iIAAA,OAAO,OAAa;AAC7B,iDAAkD;AAAzC,sHAAA,OAAO,OAAQ"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { Endpoint } from '../models';
|
|
2
|
-
declare const _default: Endpoint<"pong",
|
|
2
|
+
declare const _default: Endpoint<"pong", {}> & {
|
|
3
3
|
http: {
|
|
4
4
|
readonly method: "GET";
|
|
5
5
|
readonly path: "/_mock/ping";
|
|
6
6
|
};
|
|
7
7
|
} & {
|
|
8
|
-
|
|
8
|
+
ws: {
|
|
9
9
|
readonly path: "ping";
|
|
10
10
|
};
|
|
11
11
|
} & {
|
|
12
|
-
handler: ({ reply }: import("../models").
|
|
12
|
+
handler: ({ reply }: (import("../models").HttpRequestContext<"pong"> | import("../models").WsRequestContext<"pong">) & {
|
|
13
|
+
incoming: OmitPartial<{
|
|
14
|
+
body: void | undefined;
|
|
15
|
+
query: void | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
}) => void;
|
|
13
18
|
};
|
|
14
19
|
export default _default;
|
|
15
20
|
//# sourceMappingURL=ping.endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/ping.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"ping.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/ping.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAErC,wBAIkD"}
|
|
@@ -4,6 +4,6 @@ const models_1 = require("../models");
|
|
|
4
4
|
exports.default = models_1.Endpoint
|
|
5
5
|
.build()
|
|
6
6
|
.bindToHttp({ method: 'GET', path: '/_mock/ping' })
|
|
7
|
-
.
|
|
7
|
+
.bindToWs({ path: 'ping' })
|
|
8
8
|
.assignHandler(({ reply }) => reply.ok('pong'));
|
|
9
9
|
//# sourceMappingURL=ping.endpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/ping.endpoint.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAAU;KACf,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KACzD,
|
|
1
|
+
{"version":3,"file":"ping.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/ping.endpoint.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAAU;KACf,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KACzD,QAAQ,CAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KACjC,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
5
|
-
request:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
response?: IResponsePlainContext;
|
|
9
|
-
forwaded?: {
|
|
10
|
-
request: IRequestPlainContext;
|
|
11
|
-
response?: IResponsePlainContext;
|
|
12
|
-
curl?: string;
|
|
1
|
+
import type { IHistoryRecordMeta } from './types';
|
|
2
|
+
import type { HttpRequestContext } from '../models';
|
|
3
|
+
import type { Expectation } from '../../expectations';
|
|
4
|
+
export declare class History {
|
|
5
|
+
request: Pick<HttpRequestContext, 'incoming' | 'outgoing'>;
|
|
6
|
+
TPlain: Pick<History, 'id' | 'forwaded' | 'error' | 'meta' | 'request'> & {
|
|
7
|
+
expectation?: Expectation<any>['TPlain'];
|
|
13
8
|
};
|
|
9
|
+
id: string;
|
|
10
|
+
expectation?: Expectation<any>;
|
|
11
|
+
forwaded?: Pick<HttpRequestContext, 'incoming' | 'outgoing'>;
|
|
14
12
|
error?: {
|
|
15
13
|
code?: string;
|
|
16
14
|
message?: string;
|
|
17
15
|
isManual?: boolean;
|
|
18
16
|
};
|
|
19
17
|
meta: IHistoryRecordMeta;
|
|
20
|
-
constructor(request:
|
|
18
|
+
constructor(request: Pick<HttpRequestContext, 'incoming' | 'outgoing'>);
|
|
21
19
|
changeState(state: IHistoryRecordMeta['state']): this;
|
|
22
|
-
assign<T extends Partial<Omit<
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
assign<T extends Partial<Omit<History, 'id' | 'request' | 'meta'>>>(context: T): this & T;
|
|
21
|
+
assignOutgoing(outgoing: NonNullable<HttpRequestContext['outgoing']>): this;
|
|
22
|
+
extendForwarded(forwarded: Partial<NonNullable<History['forwaded']>>): this;
|
|
23
|
+
toPlain(): History['TPlain'];
|
|
24
|
+
static build(request: History['request']): History;
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,OAAO;IAuBC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,CAAC;IAtBtE,MAAM,EAAG,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG;QAChF,WAAW,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;KAC1C,CAAA;IAEM,EAAE,EAAE,MAAM,CAAY;IAEtB,WAAW,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,CAAC,CAAC;IAE7D,KAAK,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;IAEK,IAAI,EAAE,kBAAkB,CAK7B;gBAEiB,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,CAAC;IAEtE,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,IAAI;IAKrD,MAAM,CAAC,CAAC,SAAS,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;IAK9E,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAOpE,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAOpE,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;IAanC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;CAGzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.History = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
-
class
|
|
5
|
+
class History {
|
|
6
6
|
constructor(request) {
|
|
7
7
|
this.request = request;
|
|
8
8
|
this.id = (0, uuid_1.v4)();
|
|
@@ -20,14 +20,29 @@ class HistoryRecord {
|
|
|
20
20
|
Object.assign(this.meta, { updatedAt: Date.now() });
|
|
21
21
|
return Object.assign(this, context);
|
|
22
22
|
}
|
|
23
|
+
assignOutgoing(outgoing) {
|
|
24
|
+
this.meta.updatedAt = Date.now();
|
|
25
|
+
this.request.outgoing = outgoing;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
23
28
|
extendForwarded(forwarded) {
|
|
24
|
-
|
|
25
|
-
Object.assign(this.forwaded, forwarded);
|
|
29
|
+
this.meta.updatedAt = Date.now();
|
|
30
|
+
this.forwaded = Object.assign((this.forwaded ?? {}), forwarded);
|
|
26
31
|
return this;
|
|
27
32
|
}
|
|
33
|
+
toPlain() {
|
|
34
|
+
return {
|
|
35
|
+
id: this.id,
|
|
36
|
+
meta: this.meta,
|
|
37
|
+
request: this.request,
|
|
38
|
+
forwaded: this.forwaded,
|
|
39
|
+
error: this.error,
|
|
40
|
+
expectation: this.expectation?.toPlain(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
28
43
|
static build(request) {
|
|
29
|
-
return new
|
|
44
|
+
return new History(request);
|
|
30
45
|
}
|
|
31
46
|
}
|
|
32
|
-
exports.
|
|
47
|
+
exports.History = History;
|
|
33
48
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAMpC,MAAa,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAMpC,MAAa,OAAO;IAuBlB,YAAmB,OAA0D;QAA1D,YAAO,GAAP,OAAO,CAAmD;QAlBtE,OAAE,GAAW,IAAA,SAAM,GAAE,CAAC;QAWtB,SAAI,GAAuB;YAChC,KAAK,EAAE,SAAS;YAEhB,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;YACvB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IAE8E,CAAC;IAE1E,WAAW,CAAC,KAAkC;QACnD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAA8D,OAAU;QACnF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,cAAc,CAAC,QAAqD;QACzE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,eAAe,CAAC,SAAoD;QACzE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAmC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;QAElG,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO;QACZ,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YAEf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YAEvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;SACzC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAA2B;QACtC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF;AAjED,0BAiEC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare class HistoryStorage extends Map<string, HistoryRecord> {
|
|
1
|
+
import { History } from './model';
|
|
2
|
+
export declare class HistoryStorage extends Map<string, History> {
|
|
4
3
|
private idsStack;
|
|
5
|
-
register(
|
|
4
|
+
register(request: History['request']): History;
|
|
6
5
|
}
|
|
7
6
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,qBAAa,cAAe,SAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,OAAO,CAAC,QAAQ,CAAgB;IAEzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO;CAWtD"}
|
|
@@ -11,8 +11,8 @@ class HistoryStorage extends Map {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.idsStack = [];
|
|
13
13
|
}
|
|
14
|
-
register(
|
|
15
|
-
const historyRecord = model_1.
|
|
14
|
+
register(request) {
|
|
15
|
+
const historyRecord = model_1.History.build(request);
|
|
16
16
|
this.set(historyRecord.id, historyRecord);
|
|
17
17
|
if (this.idsStack.push(historyRecord.id) > config_1.default.server.historyRecordsLimit) {
|
|
18
18
|
this.delete(this.idsStack.shift());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAkC;AAClC,0DAAkC;AAElC,MAAa,cAAe,SAAQ,GAAoB;IAAxD;;QACU,aAAQ,GAAa,EAAE,CAAC;IAalC,CAAC;IAXQ,QAAQ,CAAC,OAA2B;QACzC,MAAM,aAAa,GAAG,eAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QAE1C,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,gBAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAG,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAdD,wCAcC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { ServerContext } from './models';
|
|
2
|
-
import { IMockServerStartOptions } from './types';
|
|
3
2
|
export * from './proxy';
|
|
4
|
-
export * from './types';
|
|
5
3
|
export declare class MockServer {
|
|
6
|
-
options:
|
|
4
|
+
options: {
|
|
5
|
+
port: number;
|
|
6
|
+
host: string;
|
|
7
|
+
};
|
|
7
8
|
authority: string;
|
|
8
9
|
context: ServerContext;
|
|
9
|
-
constructor(options:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
constructor(options: {
|
|
11
|
+
port: number;
|
|
12
|
+
host: string;
|
|
13
|
+
});
|
|
14
|
+
get client(): import("..").OnsiteClient;
|
|
15
|
+
static start(options: MockServer['options']): Promise<MockServer>;
|
|
12
16
|
}
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,aAAa,EAAoB,MAAM,UAAU,CAAC;AAK3F,cAAc,SAAS,CAAC;AA4BxB,qBAAa,UAAU;IAIF,OAAO,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd;IANM,SAAS,SAAsD;IAC/D,OAAO,gBAAyB;gBAEpB,OAAO,EAAE;QAC1B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd;IAED,IAAI,MAAM,8BAET;WAEY,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC;CA+BlD"}
|
package/lib/src/server/index.js
CHANGED
|
@@ -37,26 +37,26 @@ const models_1 = require("./models");
|
|
|
37
37
|
const router_1 = require("./router");
|
|
38
38
|
const middlewares = __importStar(require("./middlewares"));
|
|
39
39
|
__exportStar(require("./proxy"), exports);
|
|
40
|
-
__exportStar(require("./types"), exports);
|
|
41
40
|
const middlewaresToUse = [
|
|
42
|
-
middlewares.
|
|
41
|
+
middlewares.publicMiddleware,
|
|
43
42
|
middlewares.handleInternalMiddleware,
|
|
44
|
-
middlewares.
|
|
45
|
-
middlewares.
|
|
46
|
-
middlewares.
|
|
47
|
-
middlewares.
|
|
48
|
-
middlewares.
|
|
43
|
+
middlewares.matchExpectationMiddleware,
|
|
44
|
+
middlewares.manipulateExpectationMiddleware,
|
|
45
|
+
middlewares.historyMiddleware,
|
|
46
|
+
middlewares.delayMiddleware,
|
|
47
|
+
middlewares.destroyMiddleware,
|
|
48
|
+
middlewares.forwardMiddleware,
|
|
49
49
|
middlewares.replyMiddleware,
|
|
50
50
|
];
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
return handleHttpRequestWithMiddlewares(requestContext);
|
|
51
|
+
const handleHttpRequest = async (context) => {
|
|
52
|
+
for (const middleware of middlewaresToUse) {
|
|
53
|
+
if (!middleware.required.every((key) => key in context.shared)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
await new Promise((resolve) => middleware.exec(context, (result) => resolve(context.share(result ?? {}))));
|
|
57
|
+
}
|
|
59
58
|
};
|
|
59
|
+
const httpRequestListener = (context) => async (request, response) => handleHttpRequest(await models_1.HttpRequestContext.build(context, request, response));
|
|
60
60
|
class MockServer {
|
|
61
61
|
constructor(options) {
|
|
62
62
|
this.options = options;
|
|
@@ -69,13 +69,12 @@ class MockServer {
|
|
|
69
69
|
static async start(options) {
|
|
70
70
|
const server = new MockServer(options);
|
|
71
71
|
const http = (0, http_1.createServer)(httpRequestListener(server.context));
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
.
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
server.context.assignWebSocketExchange(webSocket);
|
|
72
|
+
const ws = new socket_io_1.Server(http);
|
|
73
|
+
ws.on('connection', (socket) => Object.values(router_1.routes.ws).forEach((route) => socket.on(route.ws.path, (...args) => route.handler?.(models_1.WsRequestContext.build(server.context, {
|
|
74
|
+
callback: lodash_1.default.last(args),
|
|
75
|
+
body: lodash_1.default.first(args)
|
|
76
|
+
})))));
|
|
77
|
+
server.context.assignWsExchange(ws);
|
|
79
78
|
await new Promise((resolve) => http.listen(options.port, options.host, () => {
|
|
80
79
|
console.log(`Server has started on [${server.authority}]`);
|
|
81
80
|
console.log(`GUI is available on [${server.authority}/_mock/gui]`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAqE;AACrE,yCAAmC;AACnC,oDAAuB;AAEvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAqE;AACrE,yCAAmC;AACnC,oDAAuB;AAEvB,qCAA2F;AAC3F,qCAAkC;AAElC,2DAA6C;AAE7C,0CAAwB;AAExB,MAAM,gBAAgB,GAAwC;IAC5D,WAAW,CAAC,gBAAgB;IAC5B,WAAW,CAAC,wBAAwB;IACpC,WAAW,CAAC,0BAA0B;IACtC,WAAW,CAAC,+BAA+B;IAC3C,WAAW,CAAC,iBAAiB;IAC7B,WAAW,CAAC,eAAe;IAC3B,WAAW,CAAC,iBAAiB;IAC7B,WAAW,CAAC,iBAAiB;IAC7B,WAAW,CAAC,eAAe;CAC5B,CAAC;AAEF,MAAM,iBAAiB,GAAG,KAAK,EAAE,OAA2B,EAAE,EAAE;IAC9D,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/D,SAAS;QACX,CAAC;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,OAAsB,EAAE,EAAE,CACrD,KAAK,EAAE,OAAwB,EAAE,QAAwB,EAAE,EAAE,CAC3D,iBAAiB,CAAC,MAAM,2BAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAElF,MAAa,UAAU;IAIrB,YAAmB,OAGlB;QAHkB,YAAO,GAAP,OAAO,CAGzB;QANM,cAAS,GAAG,UAAU,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/D,YAAO,GAAG,sBAAa,CAAC,KAAK,EAAE,CAAC;IAKnC,CAAC;IAEL,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAA8B;QAC/C,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAEvC,MAAM,IAAI,GAAG,IAAA,mBAAY,EAAC,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/D,MAAM,EAAE,GAAG,IAAI,kBAAM,CAAC,IAAI,CAAC,CAAC;QAE5B,EAAE,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAC7B,MAAM,CAAC,MAAM,CAAC,eAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACzC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CACnC,KAAK,CAAC,OAAO,EAAE,CACb,yBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACrC,QAAQ,EAAE,gBAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,gBAAC,CAAC,KAAK,CAAC,IAAI,CAAC;SACpB,CAAC,CACL,CAAC,CACH,CACF,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAEpC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAClC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,0BAA0B,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,wBAAwB,MAAM,CAAC,SAAS,aAAa,CAAC,CAAC;YAEnE,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5CD,gCA4CC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Middleware } from '../models';
|
|
2
|
+
declare const _default: Middleware<"manipulated", import("../models").HttpRequestContext<unknown> & {
|
|
3
|
+
shared: SetRequiredKeys<{
|
|
4
|
+
state: Record<string, unknown>;
|
|
5
|
+
seed?: number;
|
|
6
|
+
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
+
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
+
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
9
|
+
history?: import("../history").History;
|
|
10
|
+
}, "manipulated">;
|
|
11
|
+
}> & {
|
|
12
|
+
handler: TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
|
+
shared: SetRequiredKeys<{
|
|
14
|
+
state: Record<string, unknown>;
|
|
15
|
+
seed?: number;
|
|
16
|
+
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
+
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
+
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
19
|
+
history?: import("../history").History;
|
|
20
|
+
}, "manipulated">;
|
|
21
|
+
}, (shared?: Partial<import("../models").HttpRequestContext["shared"]>) => unknown]>;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=delay.middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/delay.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;AAGvC,wBAQK"}
|