@n1k1t/mock-server 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -8
- package/lib/package.json +4 -1
- package/lib/src/client/helpers/expectations.d.ts +18 -18
- package/lib/src/client/helpers/expectations.d.ts.map +1 -1
- package/lib/src/client/helpers/expectations.js.map +1 -1
- package/lib/src/client/methods/expectations.create.method.d.ts +1 -1
- package/lib/src/client/methods/expectations.create.method.js +2 -2
- package/lib/src/client/methods/expectations.create.method.js.map +1 -1
- package/lib/src/client/methods/expectations.delete.method.js +2 -2
- package/lib/src/client/methods/expectations.delete.method.js.map +1 -1
- package/lib/src/client/methods/expectations.update.method.d.ts +1 -1
- package/lib/src/client/methods/expectations.update.method.js +4 -4
- package/lib/src/client/methods/expectations.update.method.js.map +1 -1
- package/lib/src/client/models/client.d.ts +13 -13
- package/lib/src/client/models/client.d.ts.map +1 -1
- package/lib/src/client/models/client.js.map +1 -1
- package/lib/src/config/model.d.ts +4 -1
- package/lib/src/config/model.d.ts.map +1 -1
- package/lib/src/config/model.js +5 -1
- package/lib/src/config/model.js.map +1 -1
- package/lib/src/expectations/__utils__/index.d.ts +1 -2
- package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
- package/lib/src/expectations/__utils__/index.js +8 -0
- package/lib/src/expectations/__utils__/index.js.map +1 -1
- package/lib/src/expectations/models/expectation.d.ts +15 -9
- package/lib/src/expectations/models/expectation.d.ts.map +1 -1
- package/lib/src/expectations/models/expectation.js.map +1 -1
- package/lib/src/expectations/models/operator.d.ts +3 -3
- package/lib/src/expectations/models/operator.d.ts.map +1 -1
- package/lib/src/expectations/models/storage.d.ts +1 -2
- package/lib/src/expectations/models/storage.d.ts.map +1 -1
- package/lib/src/expectations/models/storage.js.map +1 -1
- package/lib/src/expectations/operators/and.operator.d.ts +1 -2
- package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/and.operator.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.d.ts +2 -2
- package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/exec.operator.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/has.operator.d.ts +1 -1
- package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/if.operator.d.ts +1 -2
- package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/if.operator.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.d.ts +3 -3
- package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/merge.operator.js +2 -2
- package/lib/src/expectations/operators/merge.operator.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/not.operator.d.ts +1 -2
- package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/not.operator.js.map +1 -1
- package/lib/src/expectations/operators/or.operator.d.ts +1 -2
- package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/or.operator.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.d.ts +1 -2
- package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/remove.operator.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/root.operator.d.ts +1 -2
- package/lib/src/expectations/operators/root.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/root.operator.js.map +1 -1
- package/lib/src/expectations/operators/set.operator.d.ts +2 -2
- package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/set.operator.js.map +1 -1
- package/lib/src/expectations/operators/switch.operator.d.ts +2 -2
- package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -1
- package/lib/src/expectations/types.d.ts +28 -14
- package/lib/src/expectations/types.d.ts.map +1 -1
- package/lib/src/expectations/types.js +2 -0
- package/lib/src/expectations/types.js.map +1 -1
- package/lib/src/expectations/utils.d.ts +3 -4
- package/lib/src/expectations/utils.d.ts.map +1 -1
- package/lib/src/expectations/utils.js +12 -0
- package/lib/src/expectations/utils.js.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.d.ts +3 -0
- package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +2 -2
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +2 -2
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +2 -2
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +6 -3
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/history.get-list.endpoint.js +1 -1
- package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -1
- package/lib/src/server/history/index.d.ts +0 -1
- package/lib/src/server/history/index.d.ts.map +1 -1
- package/lib/src/server/history/index.js +0 -1
- package/lib/src/server/history/index.js.map +1 -1
- package/lib/src/server/history/model.d.ts +12 -12
- package/lib/src/server/history/model.d.ts.map +1 -1
- package/lib/src/server/history/model.js +8 -23
- package/lib/src/server/history/model.js.map +1 -1
- package/lib/src/server/history/storage.d.ts +1 -1
- package/lib/src/server/history/storage.d.ts.map +1 -1
- package/lib/src/server/history/storage.js.map +1 -1
- package/lib/src/server/index.d.ts.map +1 -1
- package/lib/src/server/index.js +6 -0
- package/lib/src/server/index.js.map +1 -1
- package/lib/src/server/middlewares/delay.middleware.d.ts +7 -13
- package/lib/src/server/middlewares/delay.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/delay.middleware.js +4 -4
- package/lib/src/server/middlewares/delay.middleware.js.map +1 -1
- package/lib/src/server/middlewares/destroy.midleware.d.ts +7 -13
- package/lib/src/server/middlewares/destroy.midleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/destroy.midleware.js +7 -8
- package/lib/src/server/middlewares/destroy.midleware.js.map +1 -1
- package/lib/src/server/middlewares/forward.middleware.d.ts +7 -13
- package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/forward.middleware.js +81 -27
- package/lib/src/server/middlewares/forward.middleware.js.map +1 -1
- package/lib/src/server/middlewares/history.middleware.d.ts +4 -10
- package/lib/src/server/middlewares/history.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/history.middleware.js +7 -3
- package/lib/src/server/middlewares/history.middleware.js.map +1 -1
- package/lib/src/server/middlewares/internal.middleware.d.ts +4 -10
- package/lib/src/server/middlewares/internal.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts +4 -10
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js +1 -7
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js.map +1 -1
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts +4 -10
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/match-expectation.middleware.js +7 -8
- package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -1
- package/lib/src/server/middlewares/public.middleware.d.ts +4 -10
- package/lib/src/server/middlewares/public.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/reply.middleware.d.ts +9 -15
- package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/reply.middleware.js +23 -28
- package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
- package/lib/src/server/models/containers/index.d.ts +3 -0
- package/lib/src/server/models/containers/index.d.ts.map +1 -0
- package/lib/src/server/models/containers/index.js +19 -0
- package/lib/src/server/models/containers/index.js.map +1 -0
- package/lib/src/server/models/containers/model.d.ts +44 -0
- package/lib/src/server/models/containers/model.d.ts.map +1 -0
- package/lib/src/server/models/containers/model.js +43 -0
- package/lib/src/server/models/containers/model.js.map +1 -0
- package/lib/src/server/models/containers/storage.d.ts +19 -0
- package/lib/src/server/models/containers/storage.d.ts.map +1 -0
- package/lib/src/server/models/containers/storage.js +42 -0
- package/lib/src/server/models/containers/storage.js.map +1 -0
- package/lib/src/server/models/containers/utils.d.ts +2 -0
- package/lib/src/server/models/containers/utils.d.ts.map +1 -0
- package/lib/src/server/models/containers/utils.js +7 -0
- package/lib/src/server/models/containers/utils.js.map +1 -0
- package/lib/src/server/models/index.d.ts +1 -0
- package/lib/src/server/models/index.d.ts.map +1 -1
- package/lib/src/server/models/index.js +1 -0
- package/lib/src/server/models/index.js.map +1 -1
- package/lib/src/server/models/middleware.d.ts +2 -5
- package/lib/src/server/models/middleware.d.ts.map +1 -1
- package/lib/src/server/models/plugins.d.ts +7 -2
- package/lib/src/server/models/plugins.d.ts.map +1 -1
- package/lib/src/server/models/plugins.js.map +1 -1
- package/lib/src/server/models/request-context/http.d.ts +20 -15
- package/lib/src/server/models/request-context/http.d.ts.map +1 -1
- package/lib/src/server/models/request-context/http.js +25 -31
- package/lib/src/server/models/request-context/http.js.map +1 -1
- package/lib/src/server/models/request-context/index.d.ts +1 -0
- package/lib/src/server/models/request-context/index.d.ts.map +1 -1
- package/lib/src/server/models/request-context/index.js +1 -0
- package/lib/src/server/models/request-context/index.js.map +1 -1
- package/lib/src/server/models/request-context/snapshot.d.ts +28 -0
- package/lib/src/server/models/request-context/snapshot.d.ts.map +1 -0
- package/lib/src/server/models/request-context/snapshot.js +49 -0
- package/lib/src/server/models/request-context/snapshot.js.map +1 -0
- package/lib/src/server/models/request-context/types.d.ts +12 -0
- package/lib/src/server/models/request-context/types.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.d.ts +1 -0
- package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.js +1 -1
- package/lib/src/server/models/request-context/utils.js.map +1 -1
- package/lib/src/server/models/server-context.d.ts +7 -2
- package/lib/src/server/models/server-context.d.ts.map +1 -1
- package/lib/src/server/models/server-context.js +17 -3
- package/lib/src/server/models/server-context.js.map +1 -1
- package/lib/src/server/ws-exchange/types.d.ts +2 -2
- package/lib/src/server/ws-exchange/types.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -1
- package/public/scripts/main.js +18 -17
- package/public/styles/main.css +4 -0
- package/lib/src/server/history/types.d.ts +0 -14
- package/lib/src/server/history/types.d.ts.map +0 -1
- package/lib/src/server/history/types.js +0 -3
- package/lib/src/server/history/types.js.map +0 -1
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const models_1 = require("../models");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
5
|
exports.default = models_1.Middleware
|
|
6
|
-
.build(__filename
|
|
6
|
+
.build(__filename)
|
|
7
7
|
.assignHandler(async (context, { logger }) => {
|
|
8
|
-
if (context.shared.
|
|
9
|
-
logger.info(`Has delayed over [${context.shared.
|
|
10
|
-
await (0, utils_1.wait)(context.shared.
|
|
8
|
+
if (context.shared.snapshot.incoming.delay) {
|
|
9
|
+
logger.info(`Has delayed over [${context.shared.snapshot.incoming.delay}ms]`);
|
|
10
|
+
await (0, utils_1.wait)(context.shared.snapshot.incoming.delay);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=delay.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/delay.middleware.ts"],"names":[],"mappings":";;AAEA,sCAAuC;AACvC,uCAAmC;AAEnC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"delay.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/delay.middleware.ts"],"names":[],"mappings":";;AAEA,sCAAuC;AACvC,uCAAmC;AAEnC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC3C,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,qBAAqB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC;QAC9E,MAAM,IAAA,YAAI,EAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
|
-
declare const _default: Middleware<"history"
|
|
2
|
+
declare const _default: Middleware<"history", import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
|
-
}, "history"
|
|
7
|
+
}, "history">;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
|
-
}, "history"
|
|
14
|
+
}, "history">;
|
|
21
15
|
}, {
|
|
22
16
|
logger: import("../..").Logger;
|
|
23
17
|
}]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.midleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy.midleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"destroy.midleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy.midleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAEvC,wBAaK"}
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
4
|
exports.default = models_1.Middleware
|
|
5
|
-
.build(__filename, ['
|
|
5
|
+
.build(__filename, ['history'])
|
|
6
6
|
.assignHandler((context, { logger }) => {
|
|
7
|
-
if (context.shared.
|
|
8
|
-
context.shared.history
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
context.response.destroy(new Error(context.shared.manipulated.incoming.error));
|
|
7
|
+
if (context.shared.snapshot.incoming.error) {
|
|
8
|
+
context.shared.history.snapshot.assign({ error: { code: context.shared.snapshot.incoming.error, isManual: true } });
|
|
9
|
+
context.shared.history.switchStatus('finished');
|
|
10
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
11
|
+
logger.info(`Has destroyed using [${context.shared.snapshot.incoming.error}]`);
|
|
12
|
+
context.response.destroy(new Error(context.shared.snapshot.incoming.error));
|
|
14
13
|
context.complete();
|
|
15
14
|
}
|
|
16
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.midleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy.midleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"destroy.midleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy.midleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC;KAC9B,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IACrC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACpH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAEhD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACzF,MAAM,CAAC,IAAI,CAAC,wBAAwB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC;QAE/E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
|
-
declare const _default: Middleware<"history" | "expectation"
|
|
2
|
+
declare const _default: Middleware<"history" | "expectation", import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
|
-
}, "history" | "expectation"
|
|
7
|
+
}, "history" | "expectation">;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
|
-
}, "history" | "expectation"
|
|
14
|
+
}, "history" | "expectation">;
|
|
21
15
|
}, {
|
|
22
16
|
logger: import("../..").Logger;
|
|
23
17
|
}]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forward.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/forward.middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forward.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/forward.middleware.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,UAAU,EAIX,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAgBnB,wBA4JK"}
|
|
@@ -4,46 +4,86 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const node_gzip_1 = require("node-gzip");
|
|
7
8
|
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
|
|
9
|
+
const value_1 = require("@n1k1t/typebox/value");
|
|
10
|
+
const url_1 = require("url");
|
|
8
11
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
12
|
const models_1 = require("../models");
|
|
10
|
-
const
|
|
13
|
+
const compileCacheContext = (context, forwarded) => {
|
|
14
|
+
if (!context.server.storages.redis || !forwarded.options.cache.isEnabled) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const payload = forwarded.options.cache.key ?? lodash_1.default.pick(forwarded.incoming, ['path', 'method', 'body', 'query']);
|
|
18
|
+
const key = typeof payload === 'object' ? value_1.Value.Hash(payload).toString() : String(payload);
|
|
19
|
+
return {
|
|
20
|
+
key: `${forwarded.options.cache.prefix ?? ''}${key}`,
|
|
21
|
+
ttl: forwarded.options.cache.ttl ?? 3600,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
11
24
|
exports.default = models_1.Middleware
|
|
12
|
-
.build(__filename, ['expectation', '
|
|
25
|
+
.build(__filename, ['expectation', 'history'])
|
|
13
26
|
.assignHandler(async (context, { logger }) => {
|
|
14
27
|
if (!context.shared.expectation.forward) {
|
|
15
28
|
return null;
|
|
16
29
|
}
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
30
|
+
const snapshot = context.shared.snapshot.assign({ forwarded: lodash_1.default.pick(context.shared.snapshot, ['incoming']) });
|
|
31
|
+
const incomingType = (0, models_1.extractPayloadType)(snapshot.incoming.headers);
|
|
32
|
+
const cache = compileCacheContext(context, snapshot);
|
|
33
|
+
context.shared.history.snapshot.assign({ forwarded: snapshot.forwarded });
|
|
34
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
35
|
+
if (cache) {
|
|
36
|
+
const cached = await context.server.storages.redis.get(cache.key).catch((error) => {
|
|
37
|
+
logger.error('Got error while redis get', error?.stack ?? error);
|
|
38
|
+
return null;
|
|
39
|
+
});
|
|
40
|
+
const unziped = cached
|
|
41
|
+
? await (0, node_gzip_1.ungzip)(Buffer.from(cached, 'base64')).catch((error) => {
|
|
42
|
+
logger.error('Got error while cache unzip', error?.stack ?? error);
|
|
43
|
+
return null;
|
|
44
|
+
})
|
|
45
|
+
: null;
|
|
46
|
+
const outgoing = (unziped ? (0, models_1.parsePayload)('json', unziped.toString()) : null);
|
|
47
|
+
if (outgoing) {
|
|
48
|
+
logger.info(`Got cache [${cache.key}]`);
|
|
49
|
+
snapshot.assign({ forwarded: Object.assign(snapshot.forwarded, { outgoing }) });
|
|
50
|
+
context.shared.history.snapshot.assign({ forwarded: snapshot.forwarded });
|
|
51
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
52
|
+
return context.share({ snapshot });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const body = snapshot.incoming.body === undefined ? snapshot.incoming.bodyRaw : snapshot.incoming.body;
|
|
21
56
|
const bodyRaw = Buffer.from(typeof body === 'object' ? (0, models_1.serializePayload)(incomingType, body) : String(body));
|
|
57
|
+
const url = new url_1.URL(context.shared.expectation.forward.url ?? snapshot.incoming.path, context.shared.expectation.forward.baseUrl);
|
|
22
58
|
const configuration = await context.server.plugins.exec('forward.request', {
|
|
23
|
-
timeout: timeout ?? 1000 * 30,
|
|
24
|
-
method:
|
|
59
|
+
timeout: context.shared.expectation.forward.timeout ?? 1000 * 30,
|
|
60
|
+
method: snapshot.incoming.method,
|
|
25
61
|
headers: {
|
|
26
62
|
'connection': 'close',
|
|
27
|
-
...
|
|
28
|
-
...(
|
|
63
|
+
...snapshot.incoming.headers,
|
|
64
|
+
...(context.shared.expectation.forward.options?.host === 'origin' && { host: url.host }),
|
|
65
|
+
...((!snapshot.incoming.headers?.['transfer-encoding'] && bodyRaw.length) && {
|
|
29
66
|
'content-length': String(bodyRaw.length),
|
|
30
67
|
}),
|
|
31
68
|
},
|
|
32
|
-
...(url && { url }),
|
|
33
|
-
...(baseUrl && {
|
|
69
|
+
...(context.shared.expectation.forward.url && { url: context.shared.expectation.forward.url }),
|
|
70
|
+
...(context.shared.expectation.forward.baseUrl && {
|
|
71
|
+
baseURL: context.shared.expectation.forward.baseUrl,
|
|
72
|
+
url: snapshot.incoming.path
|
|
73
|
+
}),
|
|
34
74
|
data: bodyRaw,
|
|
35
75
|
params: context.incoming.query,
|
|
36
76
|
responseType: 'arraybuffer',
|
|
37
|
-
...(proxy && {
|
|
38
|
-
proxy,
|
|
39
|
-
httpsAgent: (0, https_proxy_agent_1.default)(proxy.host)
|
|
77
|
+
...(context.shared.expectation.forward.proxy && {
|
|
78
|
+
proxy: context.shared.expectation.forward.proxy,
|
|
79
|
+
httpsAgent: (0, https_proxy_agent_1.default)(context.shared.expectation.forward.proxy.host)
|
|
40
80
|
}),
|
|
41
81
|
}, context);
|
|
42
82
|
const forwardedType = (0, models_1.extractPayloadType)(configuration.headers ?? {});
|
|
43
|
-
Object.assign(
|
|
83
|
+
Object.assign(snapshot.incoming, {
|
|
44
84
|
type: forwardedType,
|
|
45
|
-
path:
|
|
46
|
-
method: configuration.method ??
|
|
85
|
+
path: url.pathname,
|
|
86
|
+
method: configuration.method ?? snapshot.incoming.method,
|
|
47
87
|
headers: configuration.headers ?? {},
|
|
48
88
|
...(configuration.params && { query: configuration.params }),
|
|
49
89
|
body: (0, models_1.parsePayload)(forwardedType, configuration.data instanceof Buffer ? configuration.data.toString() : configuration.data),
|
|
@@ -53,12 +93,11 @@ exports.default = models_1.Middleware
|
|
|
53
93
|
? configuration.data
|
|
54
94
|
: '',
|
|
55
95
|
});
|
|
56
|
-
const history = context.shared.history.extendForwarded(forwarded);
|
|
57
|
-
context.server.exchange.ws.publish('history:updated', history.toPlain());
|
|
58
96
|
const response = await axios_1.default.request(configuration).catch((error) => {
|
|
59
97
|
if (!error.response) {
|
|
60
|
-
history.
|
|
61
|
-
context.
|
|
98
|
+
context.shared.history.snapshot.assign({ error: lodash_1.default.pick(error, ['message', 'code']) });
|
|
99
|
+
context.shared.history.switchStatus('finished');
|
|
100
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
62
101
|
context.reply.internalError(error.message);
|
|
63
102
|
logger.error('Got error while forwaring', error?.stack ?? error);
|
|
64
103
|
throw error;
|
|
@@ -66,16 +105,31 @@ exports.default = models_1.Middleware
|
|
|
66
105
|
return error.response;
|
|
67
106
|
});
|
|
68
107
|
const parsed = await context.server.plugins.exec('forward.response', response, context);
|
|
69
|
-
const outgoingType = (0, models_1.extractPayloadType)(response.headers);
|
|
70
|
-
forwarded.outgoing = {
|
|
108
|
+
const outgoingType = parsed.type ?? (0, models_1.extractPayloadType)(response.headers);
|
|
109
|
+
snapshot.forwarded.outgoing = {
|
|
71
110
|
type: outgoingType,
|
|
72
111
|
status: response.status,
|
|
73
112
|
headers: response.headers,
|
|
74
113
|
dataRaw: parsed.raw,
|
|
75
114
|
data: 'payload' in parsed ? parsed.payload : (0, models_1.parsePayload)(outgoingType, parsed.raw),
|
|
76
115
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
116
|
+
if (cache) {
|
|
117
|
+
const payload = Object.assign({ isCached: true }, snapshot.forwarded.outgoing);
|
|
118
|
+
const serialized = await (0, node_gzip_1.gzip)((0, models_1.serializePayload)('json', payload)).catch((error) => {
|
|
119
|
+
logger.error('Got error while zip payload', error?.stack ?? error);
|
|
120
|
+
return null;
|
|
121
|
+
});
|
|
122
|
+
if (serialized) {
|
|
123
|
+
await context.server.storages.redis.setex(cache.key, cache.ttl, serialized.toString('base64'))
|
|
124
|
+
.then(() => logger.info(`Wrote cache [${cache.key}] for [${cache.ttl}] seconds`))
|
|
125
|
+
.catch((error) => {
|
|
126
|
+
logger.error('Got error while redis set', error?.stack ?? error);
|
|
127
|
+
return null;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
context.shared.history.snapshot.assign({ forwarded: snapshot.forwarded });
|
|
132
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
133
|
+
context.share({ snapshot });
|
|
80
134
|
});
|
|
81
135
|
//# sourceMappingURL=forward.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forward.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/forward.middleware.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0C;AAC1C,0EAAgD;AAChD,oDAAuB;
|
|
1
|
+
{"version":3,"file":"forward.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/forward.middleware.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0C;AAC1C,yCAAyC;AACzC,0EAAgD;AAChD,gDAA6C;AAC7C,6BAA0B;AAC1B,oDAAuB;AAGvB,sCAOmB;AAEnB,MAAM,mBAAmB,GAAG,CAAC,OAAuB,EAAE,SAAsC,EAAE,EAAE;IAC9F,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,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AAE;YAC/E,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;iBAC5F,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,GAAG,UAAU,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC;iBAChF,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,CAAC;gBACjE,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC;IACH,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEzF,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
2
|
declare const _default: Middleware<"expectation", import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
7
|
}, "expectation">;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
14
|
}, "expectation">;
|
|
21
15
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/history.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"history.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/history.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAEvC,wBASK"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
3
7
|
const models_1 = require("../models");
|
|
4
8
|
exports.default = models_1.Middleware
|
|
5
9
|
.build(__filename, ['expectation'])
|
|
6
10
|
.assignHandler((context) => {
|
|
7
|
-
const history = context.server.
|
|
8
|
-
.register(context.
|
|
11
|
+
const history = context.server.storages.history
|
|
12
|
+
.register(context.compileSnapshot().assign(lodash_1.default.omit(context.shared.snapshot, ['incoming'])))
|
|
9
13
|
.assignExpectation(context.shared.expectation);
|
|
10
|
-
context.server.
|
|
14
|
+
context.server.exchanges.ws.publish('history:added', history.toPlain());
|
|
11
15
|
context.share({ history });
|
|
12
16
|
});
|
|
13
17
|
//# sourceMappingURL=history.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/history.middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"history.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/history.middleware.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,CAAC;KAClC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO;SAC5C,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,gBAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SACzF,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEjD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxE,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
2
|
declare const _default: Middleware<never, import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
7
|
}, never>;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
14
|
}, never>;
|
|
21
15
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/internal.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"internal.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/internal.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAGvC,wBAUK"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
2
|
declare const _default: Middleware<"expectation", import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
7
|
}, "expectation">;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
14
|
}, "expectation">;
|
|
21
15
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manipulate-expectation.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/manipulate-expectation.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"manipulate-expectation.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/manipulate-expectation.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAEvC,wBAII"}
|
|
@@ -3,11 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const models_1 = require("../models");
|
|
4
4
|
exports.default = models_1.Middleware
|
|
5
5
|
.build(__filename, ['expectation'])
|
|
6
|
-
.assignHandler((context) => {
|
|
7
|
-
const manipulated = context.shared.expectation.request?.manipulate(context.toPlain({ clone: true, locations: ['incoming'] }));
|
|
8
|
-
context.share({
|
|
9
|
-
manipulated,
|
|
10
|
-
...(manipulated?.seed !== undefined && { seed: manipulated.seed }),
|
|
11
|
-
});
|
|
12
|
-
});
|
|
6
|
+
.assignHandler((context) => context.share({ snapshot: context.shared.expectation.request.manipulate(context.shared.snapshot) }));
|
|
13
7
|
//# sourceMappingURL=manipulate-expectation.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manipulate-expectation.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/manipulate-expectation.middleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,CAAC;KAClC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"manipulate-expectation.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/manipulate-expectation.middleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,CAAC;KAClC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,CACzB,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CACpG,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
2
|
declare const _default: Middleware<never, import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
7
|
}, never>;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
14
|
}, never>;
|
|
21
15
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-expectation.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/match-expectation.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"match-expectation.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/match-expectation.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAGhE,wBA0BK"}
|
|
@@ -5,23 +5,22 @@ const utils_1 = require("../../utils");
|
|
|
5
5
|
exports.default = models_1.Middleware
|
|
6
6
|
.build(__filename)
|
|
7
7
|
.assignHandler((context, { logger }) => {
|
|
8
|
-
const
|
|
9
|
-
const expectation = context.server.storage.expectations.match('request', plain);
|
|
8
|
+
const expectation = context.server.storages.expectations.match('request', context.shared.snapshot);
|
|
10
9
|
if (!expectation) {
|
|
11
|
-
const history = context.server.
|
|
12
|
-
.register(
|
|
10
|
+
const history = context.server.storages.history
|
|
11
|
+
.register(context.shared.snapshot.assign({
|
|
13
12
|
outgoing: (0, utils_1.cast)({
|
|
14
13
|
type: 'json',
|
|
15
14
|
status: 404,
|
|
16
15
|
headers: {},
|
|
17
16
|
})
|
|
18
17
|
}))
|
|
19
|
-
.
|
|
20
|
-
context.server.
|
|
18
|
+
.switchStatus('finished');
|
|
19
|
+
context.server.exchanges.ws.publish('history:added', history.toPlain());
|
|
21
20
|
return context.reply.notFound();
|
|
22
21
|
}
|
|
23
22
|
logger.info('Has matched with', `"${expectation.name}" [${expectation.id}]`);
|
|
24
|
-
context.server.
|
|
25
|
-
context.
|
|
23
|
+
context.server.exchanges.ws.publish('expectation:updated', expectation.toPlain());
|
|
24
|
+
context.assignExpectation(expectation);
|
|
26
25
|
});
|
|
27
26
|
//# sourceMappingURL=match-expectation.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-expectation.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/match-expectation.middleware.ts"],"names":[],"mappings":";;AAEA,sCAAgE;AAChE,uCAAmC;AAEnC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IACrC,MAAM,
|
|
1
|
+
{"version":3,"file":"match-expectation.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/match-expectation.middleware.ts"],"names":[],"mappings":";;AAEA,sCAAgE;AAChE,uCAAmC;AAEnC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEnG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO;aAC5C,QAAQ,CACP,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7B,QAAQ,EAAE,IAAA,YAAI,EAA0B;gBACtC,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,EAAE;aACZ,CAAC;SACH,CAAC,CACH;aACA,YAAY,CAAC,UAAU,CAAC,CAAC;QAE5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACxE,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,WAAW,CAAC,IAAI,MAAM,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC;IAE7E,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
2
|
declare const _default: Middleware<never, import("../models").HttpRequestContext<unknown> & {
|
|
3
3
|
shared: import("../..").SetRequiredKeys<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
7
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
8
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
4
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
5
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
9
6
|
history?: import("../history").History;
|
|
10
7
|
}, never>;
|
|
11
8
|
}> & {
|
|
12
9
|
handler: import("../..").TFunction<unknown, [import("../models").HttpRequestContext<unknown> & {
|
|
13
10
|
shared: import("../..").SetRequiredKeys<{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expectation?: import("../../expectations").Expectation<Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">>;
|
|
17
|
-
manipulated?: import("../../expectations").IExpectationOperatorContext;
|
|
18
|
-
forwarded?: Pick<import("../models").HttpRequestContext, "incoming" | "outgoing">;
|
|
11
|
+
snapshot: import("../models").RequestContextSnapshot;
|
|
12
|
+
expectation?: import("../../expectations").Expectation<any>;
|
|
19
13
|
history?: import("../history").History;
|
|
20
14
|
}, never>;
|
|
21
15
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/public.middleware.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"public.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/public.middleware.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAGvC,wBAiCK"}
|