@golemio/pid 3.17.1-dev.1910883306 → 3.17.1-dev.1919036985
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/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.d.ts +6 -2
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.js +13 -3
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.js.map +1 -1
- package/package.json +1 -1
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import { ICommonRunWithMessageDto } from "../../../../../schema-definitions/vehi
|
|
|
2
2
|
import { ILogger } from "@golemio/core/dist/helpers/logger";
|
|
3
3
|
import { ICommonMessageFilter } from "./interfaces/ICommonMessageFilter";
|
|
4
4
|
import { TimestampValidator } from "./TimestampValidator";
|
|
5
|
+
import { ISimpleConfig } from "@golemio/core/dist/helpers/configuration/ISimpleConfig";
|
|
5
6
|
export declare class BusMessageFilter implements ICommonMessageFilter {
|
|
6
7
|
private logger;
|
|
7
8
|
private timestampValidator;
|
|
8
|
-
|
|
9
|
+
private config;
|
|
10
|
+
private dppTestingBuses;
|
|
11
|
+
constructor(logger: ILogger, timestampValidator: TimestampValidator, config: ISimpleConfig);
|
|
9
12
|
/**
|
|
10
|
-
* Yield messages that are valid for processing (filter out internal bus lines)
|
|
13
|
+
* Yield messages that are valid for processing (filter out internal bus lines and testing buses)
|
|
11
14
|
* - route id is a string of length 3 or more
|
|
12
15
|
* - route id is a number in range of bus and trolleybus lines
|
|
13
16
|
* - route id >= 100 (bus) ∪ [50, 69] (trolleybus)
|
|
14
17
|
*/
|
|
15
18
|
yieldFilteredMessages(messages: ICommonRunWithMessageDto[], timestamp: number): Generator<ICommonRunWithMessageDto>;
|
|
19
|
+
private isTestingBus;
|
|
16
20
|
}
|
|
@@ -21,12 +21,14 @@ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
|
21
21
|
const TROLLEYBUS_ROUTE_ID_MIN = 50;
|
|
22
22
|
const TROLLEYBUS_ROUTE_ID_MAX = 69;
|
|
23
23
|
let BusMessageFilter = exports.BusMessageFilter = class BusMessageFilter {
|
|
24
|
-
constructor(logger, timestampValidator) {
|
|
24
|
+
constructor(logger, timestampValidator, config) {
|
|
25
25
|
this.logger = logger;
|
|
26
26
|
this.timestampValidator = timestampValidator;
|
|
27
|
+
this.config = config;
|
|
28
|
+
this.dppTestingBuses = this.config.getValue("module.pid.vehicle-positions.dppTestingBuses.*", []);
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
* Yield messages that are valid for processing (filter out internal bus lines)
|
|
31
|
+
* Yield messages that are valid for processing (filter out internal bus lines and testing buses)
|
|
30
32
|
* - route id is a string of length 3 or more
|
|
31
33
|
* - route id is a number in range of bus and trolleybus lines
|
|
32
34
|
* - route id >= 100 (bus) ∪ [50, 69] (trolleybus)
|
|
@@ -41,6 +43,10 @@ let BusMessageFilter = exports.BusMessageFilter = class BusMessageFilter {
|
|
|
41
43
|
continue;
|
|
42
44
|
}
|
|
43
45
|
if (run.route_id.length > 2) {
|
|
46
|
+
if (this.isTestingBus(message.run.registration_number)) {
|
|
47
|
+
this.logger.info(`Testing bus ${message.run.registration_number} was filterd out`);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
44
50
|
yield message;
|
|
45
51
|
continue;
|
|
46
52
|
}
|
|
@@ -53,11 +59,15 @@ let BusMessageFilter = exports.BusMessageFilter = class BusMessageFilter {
|
|
|
53
59
|
yield message;
|
|
54
60
|
}
|
|
55
61
|
}
|
|
62
|
+
isTestingBus(reqNumber) {
|
|
63
|
+
return this.dppTestingBuses.includes(reqNumber);
|
|
64
|
+
}
|
|
56
65
|
};
|
|
57
66
|
exports.BusMessageFilter = BusMessageFilter = __decorate([
|
|
58
67
|
(0, tsyringe_1.injectable)(),
|
|
59
68
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
60
69
|
__param(1, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.TimestampValidator)),
|
|
61
|
-
|
|
70
|
+
__param(2, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.SimpleConfig)),
|
|
71
|
+
__metadata("design:paramtypes", [Object, TimestampValidator_1.TimestampValidator, Object])
|
|
62
72
|
], BusMessageFilter);
|
|
63
73
|
//# sourceMappingURL=BusMessageFilter.js.map
|
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusMessageFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,oEAA8E;AAC9E,6DAA0D;AAC1D,6EAAwE;
|
|
1
|
+
{"version":3,"file":"BusMessageFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,oEAA8E;AAC9E,6DAA0D;AAC1D,6EAAwE;AAGxE,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAG5B,IAAM,gBAAgB,8BAAtB,MAAM,gBAAgB;IAEzB,YACsC,MAAe,EACI,kBAAsC,EACnD,MAAqB;QAF3B,WAAM,GAAN,MAAM,CAAS;QACI,uBAAkB,GAAlB,kBAAkB,CAAoB;QACnD,WAAM,GAAN,MAAM,CAAe;QAE7D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gDAAgD,EAAE,EAAE,CAAa,CAAC;IAClH,CAAC;IAED;;;;;OAKG;IACI,CAAC,qBAAqB,CAAC,QAAoC,EAAE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