@golemio/ndic 1.1.3 → 1.1.4-dev.856047480
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/dist/input-gateway/AbstractTrafficRestrictionsController.d.ts +7 -0
- package/dist/input-gateway/{TrafficRestrictionsController.js → AbstractTrafficRestrictionsController.js} +8 -9
- package/dist/input-gateway/AbstractTrafficRestrictionsController.js.map +1 -0
- package/dist/input-gateway/NdicRouter.js +21 -9
- package/dist/input-gateway/NdicRouter.js.map +1 -1
- package/dist/input-gateway/TrafficRestrictionsPragueController.d.ts +5 -0
- package/dist/input-gateway/TrafficRestrictionsPragueController.js +14 -0
- package/dist/input-gateway/TrafficRestrictionsPragueController.js.map +1 -0
- package/dist/input-gateway/TrafficRestrictionsRegionsController.d.ts +5 -0
- package/dist/input-gateway/TrafficRestrictionsRegionsController.js +14 -0
- package/dist/input-gateway/TrafficRestrictionsRegionsController.js.map +1 -0
- package/docs/implementation_documentation.md +5 -0
- package/package.json +1 -1
- package/dist/input-gateway/TrafficRestrictionsController.d.ts +0 -5
- package/dist/input-gateway/TrafficRestrictionsController.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseController } from "@golemio/core/dist/input-gateway";
|
|
2
|
+
import { IValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
3
|
+
export declare abstract class AbstractTrafficRestrictionsController extends BaseController {
|
|
4
|
+
protected abstract saveQueueKey: string;
|
|
5
|
+
constructor(validator: IValidator);
|
|
6
|
+
processData: (data: any) => Promise<void>;
|
|
7
|
+
}
|
|
@@ -9,18 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.AbstractTrafficRestrictionsController = void 0;
|
|
13
|
+
const _sch_1 = require("../schema-definitions");
|
|
13
14
|
const input_gateway_1 = require("@golemio/core/dist/input-gateway");
|
|
14
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
15
15
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
super(_sch_1.Ndic.name, new golemio_validator_1.JSONSchemaValidator(_sch_1.Ndic.traffic_restrictions.name, _sch_1.Ndic.traffic_restrictions.datasourceSchema));
|
|
16
|
+
class AbstractTrafficRestrictionsController extends input_gateway_1.BaseController {
|
|
17
|
+
constructor(validator) {
|
|
18
|
+
super(_sch_1.Ndic.name, validator);
|
|
20
19
|
this.processData = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
21
20
|
try {
|
|
22
21
|
yield this.validator.Validate(data);
|
|
23
|
-
yield this.sendMessageToExchange("input." + this.queuePrefix + ".
|
|
22
|
+
yield this.sendMessageToExchange("input." + this.queuePrefix + "." + this.saveQueueKey, JSON.stringify(data.d2LogicalModel), {
|
|
24
23
|
persistent: true,
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -35,5 +34,5 @@ class TrafficRestrictionsController extends input_gateway_1.BaseController {
|
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
exports.
|
|
39
|
-
//# sourceMappingURL=
|
|
37
|
+
exports.AbstractTrafficRestrictionsController = AbstractTrafficRestrictionsController;
|
|
38
|
+
//# sourceMappingURL=AbstractTrafficRestrictionsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractTrafficRestrictionsController.js","sourceRoot":"","sources":["../../src/input-gateway/AbstractTrafficRestrictionsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA4B;AAC5B,oEAAkE;AAClE,6EAAuE;AAGvE,MAAsB,qCAAsC,SAAQ,8BAAc;IAG9E,YAAY,SAAqB;QAC7B,KAAK,CAAC,WAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAGzB,gBAAW,GAAG,CAAO,IAAS,EAAiB,EAAE;YACpD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAEpC,MAAM,IAAI,CAAC,qBAAqB,CAC5B,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,GAAG,GAAG,IAAI,CAAC,YAAY,EACrD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EACnC;oBACI,UAAU,EAAE,IAAI;iBACnB,CACJ,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,4BAAW,EAAE;oBAC5B,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,4BAAW,CAAC,oCAAoC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;iBAC1F;aACJ;QACL,CAAC,CAAA,CAAC;IApBF,CAAC;CAqBJ;AA1BD,sFA0BC"}
|
|
@@ -11,14 +11,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ndicRouter = void 0;
|
|
13
13
|
const TrafficInfoController_1 = require("./TrafficInfoController");
|
|
14
|
-
const
|
|
14
|
+
const TrafficRestrictionsPragueController_1 = require("./TrafficRestrictionsPragueController");
|
|
15
|
+
const LoggerEmitter_1 = require("@golemio/core/dist/helpers/logger/LoggerEmitter");
|
|
15
16
|
const helpers_1 = require("@golemio/core/dist/input-gateway/helpers");
|
|
17
|
+
const ioc_1 = require("@golemio/core/dist/input-gateway/ioc");
|
|
16
18
|
const express_1 = require("@golemio/core/dist/shared/express");
|
|
19
|
+
const TrafficRestrictionsRegionsController_1 = require("./TrafficRestrictionsRegionsController");
|
|
17
20
|
class NdicRouter {
|
|
18
21
|
constructor() {
|
|
22
|
+
this.router = (0, express_1.Router)();
|
|
23
|
+
this.trafficInfoController = new TrafficInfoController_1.TrafficInfoController();
|
|
24
|
+
this.trafficRestrictionsPragueController = new TrafficRestrictionsPragueController_1.TrafficRestrictionsPragueController();
|
|
25
|
+
this.trafficRestrictionsRegionsController = new TrafficRestrictionsRegionsController_1.TrafficRestrictionsRegionsController();
|
|
19
26
|
this.initRoutes = () => {
|
|
20
27
|
this.router.post("/traffic-info", (0, helpers_1.checkContentTypeMiddleware)(["text/xml", "application/xml"]), this.trafficInfo);
|
|
21
|
-
this.router.post("/traffic-restrictions", (0, helpers_1.checkContentTypeMiddleware)(["text/xml", "application/xml"]), this.
|
|
28
|
+
this.router.post("/traffic-restrictions", (0, helpers_1.checkContentTypeMiddleware)(["text/xml", "application/xml"]), this.trafficRestrictionPrague);
|
|
29
|
+
this.router.post("/traffic-restrictions-regions", (0, helpers_1.checkContentTypeMiddleware)(["text/xml", "application/xml"]), this.trafficRestrictionRegions);
|
|
22
30
|
};
|
|
23
31
|
this.trafficInfo = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
24
32
|
try {
|
|
@@ -28,31 +36,35 @@ class NdicRouter {
|
|
|
28
36
|
numberOfRecords,
|
|
29
37
|
req,
|
|
30
38
|
};
|
|
31
|
-
|
|
39
|
+
this.loggerEmitter.emit(LoggerEmitter_1.LoggerEventType.NumberOfRecords, metrics);
|
|
32
40
|
res.sendStatus(204);
|
|
33
41
|
}
|
|
34
42
|
catch (err) {
|
|
35
43
|
next(err);
|
|
36
44
|
}
|
|
37
45
|
});
|
|
38
|
-
this.
|
|
46
|
+
this.trafficRestrictionPrague = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield this.trafficRestriction(this.trafficRestrictionsPragueController, req, res, next);
|
|
48
|
+
});
|
|
49
|
+
this.trafficRestrictionRegions = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield this.trafficRestriction(this.trafficRestrictionsRegionsController, req, res, next);
|
|
51
|
+
});
|
|
52
|
+
this.trafficRestriction = (controller, req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
39
53
|
try {
|
|
40
|
-
yield
|
|
54
|
+
yield controller.processData(req.body);
|
|
41
55
|
const numberOfRecords = (JSON.stringify(req.body.d2LogicalModel.payloadPublication.situation || {}).match(/situationRecord/g) || []).length;
|
|
42
56
|
const metrics = {
|
|
43
57
|
numberOfRecords,
|
|
44
58
|
req,
|
|
45
59
|
};
|
|
46
|
-
|
|
60
|
+
this.loggerEmitter.emit(LoggerEmitter_1.LoggerEventType.NumberOfRecords, metrics);
|
|
47
61
|
res.sendStatus(204);
|
|
48
62
|
}
|
|
49
63
|
catch (err) {
|
|
50
64
|
next(err);
|
|
51
65
|
}
|
|
52
66
|
});
|
|
53
|
-
this.
|
|
54
|
-
this.trafficInfoController = new TrafficInfoController_1.TrafficInfoController();
|
|
55
|
-
this.trafficRestrictionsController = new TrafficRestrictionsController_1.TrafficRestrictionsController();
|
|
67
|
+
this.loggerEmitter = ioc_1.InputGatewayContainer.resolve(ioc_1.ContainerToken.LoggerEmitter);
|
|
56
68
|
this.initRoutes();
|
|
57
69
|
}
|
|
58
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NdicRouter.js","sourceRoot":"","sources":["../../src/input-gateway/NdicRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"NdicRouter.js","sourceRoot":"","sources":["../../src/input-gateway/NdicRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAkE;AAClE,+FAA8F;AAC9F,mFAAiG;AAEjG,sEAAsF;AACtF,8DAA6F;AAC7F,+DAA4F;AAE5F,iGAA8F;AAE9F,MAAM,UAAU;IAQZ;QAPO,WAAM,GAAW,IAAA,gBAAM,GAAE,CAAC;QAGzB,0BAAqB,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACpD,wCAAmC,GAAG,IAAI,yEAAmC,EAAE,CAAC;Q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,CAAC;AAElC,gCAAU"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrafficRestrictionsPragueController = void 0;
|
|
4
|
+
const _sch_1 = require("../schema-definitions");
|
|
5
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
6
|
+
const AbstractTrafficRestrictionsController_1 = require("./AbstractTrafficRestrictionsController");
|
|
7
|
+
class TrafficRestrictionsPragueController extends AbstractTrafficRestrictionsController_1.AbstractTrafficRestrictionsController {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(new golemio_validator_1.JSONSchemaValidator("NdicTrafficRestrictionsPragueValidator", _sch_1.Ndic.traffic_restrictions.datasourceSchema));
|
|
10
|
+
this.saveQueueKey = "saveTrafficRestrictions";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.TrafficRestrictionsPragueController = TrafficRestrictionsPragueController;
|
|
14
|
+
//# sourceMappingURL=TrafficRestrictionsPragueController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrafficRestrictionsPragueController.js","sourceRoot":"","sources":["../../src/input-gateway/TrafficRestrictionsPragueController.ts"],"names":[],"mappings":";;;AAAA,gDAA4B;AAC5B,mFAAkF;AAClF,mGAAgG;AAEhG,MAAa,mCAAoC,SAAQ,6EAAqC;IAG1F;QACI,KAAK,CAAC,IAAI,uCAAmB,CAAC,wCAAwC,EAAE,WAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAH/G,iBAAY,GAAG,yBAAyB,CAAC;IAInD,CAAC;CACJ;AAND,kFAMC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrafficRestrictionsRegionsController = void 0;
|
|
4
|
+
const _sch_1 = require("../schema-definitions");
|
|
5
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
6
|
+
const AbstractTrafficRestrictionsController_1 = require("./AbstractTrafficRestrictionsController");
|
|
7
|
+
class TrafficRestrictionsRegionsController extends AbstractTrafficRestrictionsController_1.AbstractTrafficRestrictionsController {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(new golemio_validator_1.JSONSchemaValidator("NdicTrafficRestrictionsRegionsValidator", _sch_1.Ndic.traffic_restrictions.datasourceSchema));
|
|
10
|
+
this.saveQueueKey = "saveTrafficRestrictionsRegions";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.TrafficRestrictionsRegionsController = TrafficRestrictionsRegionsController;
|
|
14
|
+
//# sourceMappingURL=TrafficRestrictionsRegionsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrafficRestrictionsRegionsController.js","sourceRoot":"","sources":["../../src/input-gateway/TrafficRestrictionsRegionsController.ts"],"names":[],"mappings":";;;AAAA,gDAA4B;AAC5B,mFAAkF;AAClF,mGAAgG;AAEhG,MAAa,oCAAqC,SAAQ,6EAAqC;IAG3F;QACI,KAAK,CAAC,IAAI,uCAAmB,CAAC,yCAAyC,EAAE,WAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAHhH,iBAAY,GAAG,gCAAgC,CAAC;IAI1D,CAAC;CACJ;AAND,oFAMC"}
|
|
@@ -51,6 +51,11 @@ Popis dat, jak nám jsou posíláná na input-gateway. Pokud je vystaveno více
|
|
|
51
51
|
- (volitelně) odhadovaná zátěž
|
|
52
52
|
- n/a
|
|
53
53
|
|
|
54
|
+
### */traffic-restrictions-regions
|
|
55
|
+
|
|
56
|
+
- stejné jako `traffic-restrictions` s tím rozdílem, že na tento endpoint chodí data kolem Středočeského kraje: tj Liberecký, Královehradecký, Pardubický, Vysočina, Jihočeský, Plzeňský, Karlovarský, Ústecký
|
|
57
|
+
- název rabbitmq fronty
|
|
58
|
+
- `dataplatform.ndic.saveTrafficRestrictionsRegions` - zprávy v queue obsahují přichozí data v json formátu
|
|
54
59
|
|
|
55
60
|
|
|
56
61
|
## Zpracování dat / transformace
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TrafficRestrictionsController.js","sourceRoot":"","sources":["../../src/input-gateway/TrafficRestrictionsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAAkE;AAClE,mFAAkF;AAClF,6EAAuE;AACvE,gDAA4B;AAE5B,MAAa,6BAA8B,SAAQ,8BAAc;IAC7D;QACI,KAAK,CAAC,WAAI,CAAC,IAAI,EAAE,IAAI,uCAAmB,CAAC,WAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAGnH,gBAAW,GAAG,CAAO,IAAS,EAAiB,EAAE;YACpD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAEpC,MAAM,IAAI,CAAC,qBAAqB,CAC5B,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,0BAA0B,EACxD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EACnC;oBACI,UAAU,EAAE,IAAI;iBACnB,CACJ,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,4BAAW,EAAE;oBAC5B,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,4BAAW,CAAC,oCAAoC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;iBAC1F;aACJ;QACL,CAAC,CAAA,CAAC;IApBF,CAAC;CAqBJ;AAxBD,sEAwBC"}
|