@n1k1t/mock-server 0.1.7 → 0.1.10
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 +200 -12
- 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 +10 -1
- package/lib/src/config/model.d.ts.map +1 -1
- package/lib/src/config/model.js +11 -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 +6 -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 +4 -2
- 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 +12 -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 +7 -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 +8 -14
- package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/forward.middleware.js +60 -20
- 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 +3 -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 +43 -29
- 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 +36 -0
- package/lib/src/server/models/containers/model.d.ts.map +1 -0
- package/lib/src/server/models/containers/model.js +46 -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 +44 -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 +23 -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 +30 -0
- package/lib/src/server/models/request-context/snapshot.d.ts.map +1 -0
- package/lib/src/server/models/request-context/snapshot.js +59 -0
- package/lib/src/server/models/request-context/snapshot.js.map +1 -0
- package/lib/src/server/models/request-context/types.d.ts +10 -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/index.html +0 -1
- package/public/scripts/main.js +34 -25
- package/public/styles/main.css +268 -1
- 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
- package/public/styles/json-highlighter.css +0 -259
|
@@ -2,47 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.History = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
5
6
|
class History {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
7
|
+
constructor(snapshot) {
|
|
8
|
+
this.snapshot = snapshot;
|
|
8
9
|
this.id = (0, uuid_1.v4)();
|
|
10
|
+
this.status = (0, utils_1.cast)('pending');
|
|
9
11
|
this.meta = {
|
|
10
|
-
state: 'pending',
|
|
11
12
|
requestedAt: Date.now(),
|
|
12
13
|
updatedAt: Date.now(),
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
switchStatus(status) {
|
|
16
17
|
this.meta.updatedAt = Date.now();
|
|
17
|
-
this.
|
|
18
|
+
this.status = status;
|
|
18
19
|
return this;
|
|
19
20
|
}
|
|
20
21
|
assignExpectation(expectation) {
|
|
21
22
|
this.meta.updatedAt = Date.now();
|
|
22
23
|
return Object.assign(this, { expectation });
|
|
23
24
|
}
|
|
24
|
-
assignError(error) {
|
|
25
|
-
this.meta.updatedAt = Date.now();
|
|
26
|
-
this.request.error = error;
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
assignOutgoing(outgoing) {
|
|
30
|
-
this.meta.updatedAt = Date.now();
|
|
31
|
-
this.request.outgoing = outgoing;
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
extendForwarded(forwarded) {
|
|
35
|
-
this.meta.updatedAt = Date.now();
|
|
36
|
-
return Object.assign(this, {
|
|
37
|
-
forwarded: Object.assign((this.forwaded ?? {}), forwarded)
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
25
|
toPlain() {
|
|
41
26
|
return {
|
|
42
27
|
id: this.id,
|
|
43
28
|
meta: this.meta,
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
status: this.status,
|
|
30
|
+
snapshot: this.snapshot.toPlain(),
|
|
46
31
|
expectation: this.expectation?.toPlain(),
|
|
47
32
|
};
|
|
48
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/server/history/model.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAKpC,uCAAmC;AAEnC,MAAa,OAAO;IAgBlB,YAAmB,QAAgC;QAAhC,aAAQ,GAAR,QAAQ,CAAwB;QAV5C,OAAE,GAAW,IAAA,SAAM,GAAE,CAAC;QAEtB,WAAM,GAAG,IAAA,YAAI,EAAyB,SAAS,CAAC,CAAC;QAGjD,SAAI,GAAG;YACZ,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;YACvB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IAEoD,CAAC;IAEhD,YAAY,CAAC,MAAyB;QAC3C,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,iBAAiB,CAAC,WAAgD;QACvE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9C,CAAC;IAEM,OAAO;QACZ,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YAEnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;SACzC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAA4B;QACvC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF;AA5CD,0BA4CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qBAAa,cAAe,SAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,OAAO,CAAC,GAAG,CAAgB;IAEpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qBAAa,cAAe,SAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,OAAO,CAAC,GAAG,CAAgB;IAEpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO;CAUvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,mCAAkC;AAElC,MAAa,cAAe,SAAQ,GAAoB;IAAxD;;QACU,QAAG,GAAa,EAAE,CAAC;IAY7B,CAAC;IAVQ,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/server/history/storage.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,mCAAkC;AAElC,MAAa,cAAe,SAAQ,GAAoB;IAAxD;;QACU,QAAG,GAAa,EAAE,CAAC;IAY7B,CAAC;IAVQ,QAAQ,CAAC,OAA4B;QAC1C,MAAM,OAAO,GAAG,eAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAE9B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,gBAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC;YAC5D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAG,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAbD,wCAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,aAAa,EAAoB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,aAAa,EAAoB,MAAM,UAAU,CAAC;AAQ3F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA+C1D,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;CAsClD"}
|
package/lib/src/server/index.js
CHANGED
|
@@ -34,6 +34,7 @@ const models_1 = require("./models");
|
|
|
34
34
|
const meta_1 = require("../meta");
|
|
35
35
|
const logger_1 = require("../logger");
|
|
36
36
|
const router_1 = require("./router");
|
|
37
|
+
const config_1 = __importDefault(require("../config"));
|
|
37
38
|
const middlewares = __importStar(require("./middlewares"));
|
|
38
39
|
var models_2 = require("./models");
|
|
39
40
|
Object.defineProperty(exports, "serializePayload", { enumerable: true, get: function () { return models_2.serializePayload; } });
|
|
@@ -98,6 +99,12 @@ class MockServer {
|
|
|
98
99
|
logger.info(`GUI is available on [${server.authority}/_mock/gui]`);
|
|
99
100
|
resolve();
|
|
100
101
|
}));
|
|
102
|
+
setInterval(() => {
|
|
103
|
+
server.context.storages.containers.getExpired().forEach((container) => {
|
|
104
|
+
container.unbind();
|
|
105
|
+
logger.info(`Container [${container.key}] has unbinded by expiration of [${container.ttl}] seconds`);
|
|
106
|
+
});
|
|
107
|
+
}, config_1.default.get('containers').garbageInterval * 1000);
|
|
101
108
|
return server;
|
|
102
109
|
}
|
|
103
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAqE;AACrE,yCAAmC;AACnC,oDAAuB;AAEvB,qCAA2F;AAC3F,kCAAsC;AACtC,sCAAmC;AACnC,q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@@
|
|
|
1
1
|
import { Middleware } from '../models';
|
|
2
|
-
declare const _default: Middleware<
|
|
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
|
}, {
|
|
22
16
|
logger: import("../..").Logger;
|
|
23
17
|
}]>;
|
|
@@ -1 +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
|
|
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,wBAOK"}
|
|
@@ -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
|
-
import { Middleware } from '../models';
|
|
2
|
-
declare const _default: Middleware<"history" | "expectation"
|
|
1
|
+
import { Middleware, RequestContextSnapshot } from '../models';
|
|
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: 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: 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":"AAOA,OAAO,EAGL,UAAU,EAEV,sBAAsB,EAEvB,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAmBnB,wBAwIK"}
|
|
@@ -5,44 +5,86 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const axios_1 = __importDefault(require("axios"));
|
|
7
7
|
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
|
|
8
|
+
const node_gzip_1 = require("node-gzip");
|
|
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 = (snapshot) => {
|
|
14
|
+
if (!snapshot.cache.isEnabled) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const payload = snapshot.cache.key ?? lodash_1.default.pick(snapshot.incoming, ['path', 'method', 'body', 'query']);
|
|
18
|
+
const key = typeof payload === 'object' ? value_1.Value.Hash(payload).toString() : String(payload);
|
|
19
|
+
return {
|
|
20
|
+
isEnabled: true,
|
|
21
|
+
ttl: snapshot.cache.ttl ?? 3600,
|
|
22
|
+
key: `${snapshot.cache.prefix ?? ''}${key}`,
|
|
23
|
+
prefix: snapshot.cache.prefix,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
11
26
|
exports.default = models_1.Middleware
|
|
12
|
-
.build(__filename, ['expectation', '
|
|
27
|
+
.build(__filename, ['expectation', 'history'])
|
|
13
28
|
.assignHandler(async (context, { logger }) => {
|
|
14
29
|
if (!context.shared.expectation.forward) {
|
|
15
30
|
return null;
|
|
16
31
|
}
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
32
|
+
const cache = compileCacheContext(context.shared.snapshot);
|
|
33
|
+
const incomingType = (0, models_1.extractPayloadType)(context.shared.snapshot.incoming.headers);
|
|
34
|
+
const forwarded = context.shared.snapshot.pick(['incoming', 'outgoing']);
|
|
35
|
+
const snapshot = context.shared.snapshot.assign({ forwarded, ...(cache && { cache }) });
|
|
36
|
+
context.shared.history.snapshot.assign(snapshot.pick(['forwarded', 'cache']));
|
|
37
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
38
|
+
if (cache) {
|
|
39
|
+
const cached = await context.server.storages.redis.get(cache.key).catch((error) => {
|
|
40
|
+
logger.error('Got error while redis get', error?.stack ?? error);
|
|
41
|
+
return null;
|
|
42
|
+
});
|
|
43
|
+
const unziped = cached
|
|
44
|
+
? await (0, node_gzip_1.ungzip)(Buffer.from(cached, 'base64')).catch((error) => {
|
|
45
|
+
logger.error('Got error while cache unzip', error?.stack ?? error);
|
|
46
|
+
return null;
|
|
47
|
+
})
|
|
48
|
+
: null;
|
|
49
|
+
const outgoing = (unziped ? (0, models_1.parsePayload)('json', unziped.toString()) : null);
|
|
50
|
+
if (outgoing) {
|
|
51
|
+
logger.info(`Got cache [${cache.key}]`);
|
|
52
|
+
forwarded.outgoing = outgoing;
|
|
53
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
54
|
+
return context.share({ snapshot });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
20
57
|
const body = forwarded.incoming.body === undefined ? forwarded.incoming.bodyRaw : forwarded.incoming.body;
|
|
21
58
|
const bodyRaw = Buffer.from(typeof body === 'object' ? (0, models_1.serializePayload)(incomingType, body) : String(body));
|
|
59
|
+
const url = new url_1.URL(context.shared.expectation.forward.url ?? forwarded.incoming.path, context.shared.expectation.forward.baseUrl);
|
|
22
60
|
const configuration = await context.server.plugins.exec('forward.request', {
|
|
23
|
-
timeout: timeout ?? 1000 * 30,
|
|
61
|
+
timeout: context.shared.expectation.forward.timeout ?? 1000 * 30,
|
|
24
62
|
method: forwarded.incoming.method,
|
|
25
63
|
headers: {
|
|
26
64
|
'connection': 'close',
|
|
27
65
|
...forwarded.incoming.headers,
|
|
66
|
+
...(context.shared.expectation.forward.options?.host === 'origin' && { host: url.host }),
|
|
28
67
|
...((!forwarded.incoming.headers?.['transfer-encoding'] && bodyRaw.length) && {
|
|
29
68
|
'content-length': String(bodyRaw.length),
|
|
30
69
|
}),
|
|
31
70
|
},
|
|
32
|
-
...(url && { url }),
|
|
33
|
-
...(baseUrl && {
|
|
71
|
+
...(context.shared.expectation.forward.url && { url: context.shared.expectation.forward.url }),
|
|
72
|
+
...(context.shared.expectation.forward.baseUrl && {
|
|
73
|
+
baseURL: context.shared.expectation.forward.baseUrl,
|
|
74
|
+
url: forwarded.incoming.path
|
|
75
|
+
}),
|
|
34
76
|
data: bodyRaw,
|
|
35
77
|
params: context.incoming.query,
|
|
36
78
|
responseType: 'arraybuffer',
|
|
37
|
-
...(proxy && {
|
|
38
|
-
proxy,
|
|
39
|
-
httpsAgent: (0, https_proxy_agent_1.default)(proxy.host)
|
|
79
|
+
...(context.shared.expectation.forward.proxy && {
|
|
80
|
+
proxy: context.shared.expectation.forward.proxy,
|
|
81
|
+
httpsAgent: (0, https_proxy_agent_1.default)(context.shared.expectation.forward.proxy.host)
|
|
40
82
|
}),
|
|
41
83
|
}, context);
|
|
42
84
|
const forwardedType = (0, models_1.extractPayloadType)(configuration.headers ?? {});
|
|
43
85
|
Object.assign(forwarded.incoming, {
|
|
44
86
|
type: forwardedType,
|
|
45
|
-
path:
|
|
87
|
+
path: url.pathname,
|
|
46
88
|
method: configuration.method ?? forwarded.incoming.method,
|
|
47
89
|
headers: configuration.headers ?? {},
|
|
48
90
|
...(configuration.params && { query: configuration.params }),
|
|
@@ -53,12 +95,11 @@ exports.default = models_1.Middleware
|
|
|
53
95
|
? configuration.data
|
|
54
96
|
: '',
|
|
55
97
|
});
|
|
56
|
-
const history = context.shared.history.extendForwarded(forwarded);
|
|
57
|
-
context.server.exchange.ws.publish('history:updated', history.toPlain());
|
|
58
98
|
const response = await axios_1.default.request(configuration).catch((error) => {
|
|
59
99
|
if (!error.response) {
|
|
60
|
-
history.
|
|
61
|
-
context.
|
|
100
|
+
context.shared.history.snapshot.assign({ error: lodash_1.default.pick(error, ['message', 'code']) });
|
|
101
|
+
context.shared.history.switchStatus('finished');
|
|
102
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
62
103
|
context.reply.internalError(error.message);
|
|
63
104
|
logger.error('Got error while forwaring', error?.stack ?? error);
|
|
64
105
|
throw error;
|
|
@@ -66,7 +107,7 @@ exports.default = models_1.Middleware
|
|
|
66
107
|
return error.response;
|
|
67
108
|
});
|
|
68
109
|
const parsed = await context.server.plugins.exec('forward.response', response, context);
|
|
69
|
-
const outgoingType = (0, models_1.extractPayloadType)(response.headers);
|
|
110
|
+
const outgoingType = parsed.type ?? (0, models_1.extractPayloadType)(response.headers);
|
|
70
111
|
forwarded.outgoing = {
|
|
71
112
|
type: outgoingType,
|
|
72
113
|
status: response.status,
|
|
@@ -74,8 +115,7 @@ exports.default = models_1.Middleware
|
|
|
74
115
|
dataRaw: parsed.raw,
|
|
75
116
|
data: 'payload' in parsed ? parsed.payload : (0, models_1.parsePayload)(outgoingType, parsed.raw),
|
|
76
117
|
};
|
|
77
|
-
history.
|
|
78
|
-
context.
|
|
79
|
-
context.share({ forwarded });
|
|
118
|
+
context.server.exchanges.ws.publish('history:updated', context.shared.history.toPlain());
|
|
119
|
+
context.share({ snapshot });
|
|
80
120
|
});
|
|
81
121
|
//# 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;AAEvB,
|
|
1
|
+
{"version":3,"file":"forward.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/forward.middleware.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0C;AAC1C,0EAAgD;AAChD,yCAAmC;AACnC,gDAA6C;AAC7C,6BAA0B;AAC1B,oDAAuB;AAEvB,sCAOmB;AAEnB,MAAM,mBAAmB,GAAG,CAAC,QAAgC,EAAE,EA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
|
|
|
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":"
|
|
1
|
+
{"version":3,"file":"history.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/history.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;;;;;;AAEvC,wBASK"}
|
|
@@ -4,10 +4,10 @@ const models_1 = require("../models");
|
|
|
4
4
|
exports.default = models_1.Middleware
|
|
5
5
|
.build(__filename, ['expectation'])
|
|
6
6
|
.assignHandler((context) => {
|
|
7
|
-
const history = context.server.
|
|
8
|
-
.register(context.
|
|
7
|
+
const history = context.server.storages.history
|
|
8
|
+
.register(context.compileSnapshot().assign(context.shared.snapshot.omit(['incoming'])))
|
|
9
9
|
.assignExpectation(context.shared.expectation);
|
|
10
|
-
context.server.
|
|
10
|
+
context.server.exchanges.ws.publish('history:added', history.toPlain());
|
|
11
11
|
context.share({ history });
|
|
12
12
|
});
|
|
13
13
|
//# 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,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,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SACtF,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"}
|