@golemio/pid 5.7.1 → 5.7.2-dev.2363716873
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/const.d.ts +0 -1
- package/dist/const.js +1 -2
- package/dist/const.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository.d.ts +14 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository.js +46 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/datasources/StaticDataSourceFactory.d.ts +3 -2
- package/dist/integration-engine/ropid-gtfs/datasources/StaticDataSourceFactory.js +4 -2
- package/dist/integration-engine/ropid-gtfs/datasources/StaticDataSourceFactory.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/datasources/static-data/NotPublicVehiclesDataSourceProvider.d.ts +9 -0
- package/dist/integration-engine/ropid-gtfs/datasources/static-data/NotPublicVehiclesDataSourceProvider.js +46 -0
- package/dist/integration-engine/ropid-gtfs/datasources/static-data/NotPublicVehiclesDataSourceProvider.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +4 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +2 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +2 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.d.ts +6 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js +39 -10
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/Di.js +2 -0
- package/dist/integration-engine/vehicle-positions/ioc/Di.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js +1 -0
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.d.ts +10 -5
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.js +35 -9
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.d.ts +4 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js +21 -8
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.d.ts +7 -3
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.js +26 -8
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/interfaces/ICommonMessageFilter.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/IUpdateRunsGtfsTripInput.d.ts +6 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js +3 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/PositionRepository.d.ts +10 -3
- package/dist/output-gateway/vehicle-positions/data-access/PositionRepository.js +30 -7
- package/dist/output-gateway/vehicle-positions/data-access/PositionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.d.ts +7 -3
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js +30 -7
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/VehicleDescriptorRepository.d.ts +10 -3
- package/dist/output-gateway/vehicle-positions/data-access/VehicleDescriptorRepository.js +30 -7
- package/dist/output-gateway/vehicle-positions/data-access/VehicleDescriptorRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/VehicleTypeRepository.d.ts +10 -3
- package/dist/output-gateway/vehicle-positions/data-access/VehicleTypeRepository.js +30 -7
- package/dist/output-gateway/vehicle-positions/data-access/VehicleTypeRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/cache/NotPublicVehiclesRedisRepository.d.ts +11 -0
- package/dist/output-gateway/vehicle-positions/data-access/cache/NotPublicVehiclesRedisRepository.js +46 -0
- package/dist/output-gateway/vehicle-positions/data-access/cache/NotPublicVehiclesRedisRepository.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/index.js +9 -18
- package/dist/output-gateway/vehicle-positions/data-access/index.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/ITripWithPositionRepository.d.ts +3 -2
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/IVPRepositoryInstances.d.ts +6 -6
- package/dist/output-gateway/vehicle-positions/data-access/views/ProcessedPositionRepository.d.ts +7 -3
- package/dist/output-gateway/vehicle-positions/data-access/views/ProcessedPositionRepository.js +30 -7
- package/dist/output-gateway/vehicle-positions/data-access/views/ProcessedPositionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.d.ts +17 -7
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js +112 -42
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/ioc/Di.d.ts +3 -0
- package/dist/output-gateway/vehicle-positions/ioc/Di.js +23 -0
- package/dist/output-gateway/vehicle-positions/ioc/Di.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/ioc/OgVehiclePositionsToken.d.ts +9 -0
- package/dist/output-gateway/vehicle-positions/ioc/OgVehiclePositionsToken.js +15 -0
- package/dist/output-gateway/vehicle-positions/ioc/OgVehiclePositionsToken.js.map +1 -0
- package/dist/schema-definitions/datasources/static-data/NotPublicVehiclesJsonSchema.d.ts +3 -0
- package/dist/schema-definitions/datasources/static-data/NotPublicVehiclesJsonSchema.js +40 -0
- package/dist/schema-definitions/datasources/static-data/NotPublicVehiclesJsonSchema.js.map +1 -0
- package/dist/schema-definitions/datasources/static-data/index.d.ts +1 -0
- package/dist/schema-definitions/datasources/static-data/index.js +1 -0
- package/dist/schema-definitions/datasources/static-data/index.js.map +1 -1
- package/dist/schema-definitions/datasources/static-data/interfaces/NotPublicVehiclesDataInterface.d.ts +35 -0
- package/dist/schema-definitions/datasources/static-data/interfaces/NotPublicVehiclesDataInterface.js +18 -0
- package/dist/schema-definitions/datasources/static-data/interfaces/NotPublicVehiclesDataInterface.js.map +1 -0
- package/dist/schema-definitions/datasources/static-data/interfaces/index.d.ts +1 -0
- package/dist/schema-definitions/datasources/static-data/interfaces/index.js +1 -0
- package/dist/schema-definitions/datasources/static-data/interfaces/index.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/ICommonRunWithMessageDto.d.ts +6 -0
- package/docs/examples/not_public_vehicles.json +9 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BusMessageFilter = void 0;
|
|
16
|
+
const NotPublicVehiclesRedisRepository_1 = require("../../../../ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository");
|
|
16
17
|
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
17
18
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
18
19
|
const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
|
|
@@ -21,19 +22,27 @@ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
|
21
22
|
const TROLLEYBUS_ROUTE_ID_MIN = 50;
|
|
22
23
|
const TROLLEYBUS_ROUTE_ID_MAX = 69;
|
|
23
24
|
let BusMessageFilter = class BusMessageFilter {
|
|
24
|
-
constructor(logger, timestampValidator, config) {
|
|
25
|
+
constructor(logger, timestampValidator, config, notPublicVehiclesRepository) {
|
|
25
26
|
this.logger = logger;
|
|
26
27
|
this.timestampValidator = timestampValidator;
|
|
27
28
|
this.config = config;
|
|
28
|
-
this.
|
|
29
|
+
this.notPublicVehiclesRepository = notPublicVehiclesRepository;
|
|
30
|
+
this.dppTestingBuses = new Set(this.config.getValue("module.pid.vehicle-positions.dppTestingBuses.*", []));
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* Yield messages that are valid for processing (filter out internal bus lines and testing buses)
|
|
32
|
-
* - route id is a string of length 3 or more
|
|
33
|
-
* - route id is a number in range of
|
|
34
|
-
*
|
|
34
|
+
* - route id is a string of length 3 or more (bus)
|
|
35
|
+
* - route id is a number in range of trolleybus lines [50, 69]
|
|
36
|
+
* - OR registration number is in not-public vehicles whitelist (e.g., metro replacement buses)
|
|
37
|
+
* - filters out testing buses
|
|
38
|
+
*
|
|
39
|
+
* Sets isNotPublic flag on messages to avoid duplicate whitelist checks in processor
|
|
35
40
|
*/
|
|
36
|
-
*yieldFilteredMessages(messages, timestamp) {
|
|
41
|
+
async *yieldFilteredMessages(messages, timestamp) {
|
|
42
|
+
// Load config once for the entire batch to avoid multiple Redis calls
|
|
43
|
+
const { road: { registrationNumbers }, routeIds, } = await this.notPublicVehiclesRepository.getConfig();
|
|
44
|
+
const whitelistedRegistrationNumbers = new Set(registrationNumbers);
|
|
45
|
+
const whitelistedRouteNames = new Set(routeIds);
|
|
37
46
|
for (const message of messages) {
|
|
38
47
|
const { run } = message;
|
|
39
48
|
if (!this.timestampValidator.isTimestampValid(timestamp, message.run_message.actual_stop_timestamp_real.toString())) {
|
|
@@ -42,25 +51,41 @@ let BusMessageFilter = class BusMessageFilter {
|
|
|
42
51
|
`is not valid for line ${message.run.line_short_name}, run ${message.run.run_number}`, this.constructor.name, undefined, undefined, "pid"));
|
|
43
52
|
continue;
|
|
44
53
|
}
|
|
54
|
+
// Check if this is a not-public vehicle
|
|
55
|
+
// - Whitelisted registration number (e.g., metro replacement bus)
|
|
56
|
+
// - Whitelisted route name (e.g., ad-hoc routes like X1, X2, NAD)
|
|
57
|
+
const isNotPublicByRegistration = whitelistedRegistrationNumbers.has(run.registration_number);
|
|
58
|
+
const isNotPublicByRouteName = whitelistedRouteNames.has(run.line_short_name);
|
|
59
|
+
const isNotPublicVehicle = isNotPublicByRegistration || isNotPublicByRouteName;
|
|
60
|
+
// Allow if whitelisted by registration number or route name (skip other validation)
|
|
61
|
+
if (isNotPublicVehicle) {
|
|
62
|
+
message.isNotPublic = true; // ← Set flag
|
|
63
|
+
yield message;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// Regular bus (route_id length > 2)
|
|
45
67
|
if (run.route_id.length > 2) {
|
|
46
68
|
if (this.isTestingBus(message.run.registration_number)) {
|
|
47
|
-
this.logger.info(`Testing bus ${message.run.registration_number} was
|
|
69
|
+
this.logger.info(`Testing bus ${message.run.registration_number} was filtered out`);
|
|
48
70
|
continue;
|
|
49
71
|
}
|
|
72
|
+
message.isNotPublic = false; // ← Set flag (scheduled bus)
|
|
50
73
|
yield message;
|
|
51
74
|
continue;
|
|
52
75
|
}
|
|
76
|
+
// Trolleybus (route_id in range [50-69])
|
|
53
77
|
const routeId = Number.parseInt(run.route_id);
|
|
54
78
|
if (Number.isNaN(routeId) || routeId < TROLLEYBUS_ROUTE_ID_MIN || routeId > TROLLEYBUS_ROUTE_ID_MAX) {
|
|
55
79
|
this.logger.info(`${this.constructor.name}: route id ${routeId} is invalid or out of range`);
|
|
56
80
|
this.logger.debug(message);
|
|
57
81
|
continue;
|
|
58
82
|
}
|
|
83
|
+
message.isNotPublic = false; // ← Set flag (scheduled trolleybus)
|
|
59
84
|
yield message;
|
|
60
85
|
}
|
|
61
86
|
}
|
|
62
87
|
isTestingBus(reqNumber) {
|
|
63
|
-
return this.dppTestingBuses.
|
|
88
|
+
return this.dppTestingBuses.has(reqNumber);
|
|
64
89
|
}
|
|
65
90
|
};
|
|
66
91
|
exports.BusMessageFilter = BusMessageFilter;
|
|
@@ -69,6 +94,7 @@ exports.BusMessageFilter = BusMessageFilter = __decorate([
|
|
|
69
94
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
70
95
|
__param(1, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.TimestampValidator)),
|
|
71
96
|
__param(2, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.SimpleConfig)),
|
|
72
|
-
|
|
97
|
+
__param(3, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.NotPublicVehiclesRedisRepository)),
|
|
98
|
+
__metadata("design:paramtypes", [Object, TimestampValidator_1.TimestampValidator, Object, NotPublicVehiclesRedisRepository_1.NotPublicVehiclesRedisRepository])
|
|
73
99
|
], BusMessageFilter);
|
|
74
100
|
//# 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;AAGxE,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAG5B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEzB,YACsC,MAAe,EACI,kBAAsC,EACnD,MAAqB;
|
|
1
|
+
{"version":3,"file":"BusMessageFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/BusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gIAAqH;AACrH,wEAAqE;AAErE,iEAAwE;AAExE,oEAA8E;AAC9E,6DAA0D;AAC1D,6EAAwE;AAGxE,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAG5B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEzB,YACsC,MAAe,EACI,kBAAsC,EACnD,MAAqB,EAErD,2BAA6D;QAJnC,WAAM,GAAN,MAAM,CAAS;QACI,uBAAkB,GAAlB,kBAAkB,CAAoB;QACnD,WAAM,GAAN,MAAM,CAAe;QAErD,gCAA2B,GAA3B,2BAA2B,CAAkC;QAErE,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gDAAgD,EAAE,EAAE,CAAa,CAAC,CAAC;IAC3H,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,CAAC,qBAAqB,CAC/B,QAAoC,EACpC,SAAiB;QAEjB,sEAAsE;QACtE,MAAM,EACF,IAAI,EAAE,EAAE,mBAAmB,EAAE,EAC7B,QAAQ,GACX,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,SAAS,EAAE,CAAC;QACvD,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAS,mBAAmB,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F5B"}
|
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export declare class CommonMessageProcessor {
|
|
|
5
5
|
private logger;
|
|
6
6
|
constructor(runsRepository: CommonRunsRepository);
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Process a transformed run message
|
|
9
|
+
*
|
|
10
|
+
* @param element - The run with message data (already filtered, with isNotPublic flag set)
|
|
11
|
+
* @param firstMessageCreatedAt - Timestamp of the first message in the batch
|
|
9
12
|
*/
|
|
10
13
|
processTransformedRun: (element: ICommonRunWithMessageDto, firstMessageCreatedAt?: number) => Promise<void>;
|
|
11
14
|
private logElementIssues;
|
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js
CHANGED
|
@@ -7,26 +7,39 @@ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
|
7
7
|
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
8
8
|
const queueprocessors_1 = require("@golemio/core/dist/integration-engine/queueprocessors");
|
|
9
9
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
10
|
-
const const_1 = require("../../../../../const");
|
|
11
10
|
const ONE_HOUR_IN_MILLIS = 60 * 60 * 1000;
|
|
12
11
|
const MIN_HOURS_DIFF_TO_LOG = 22;
|
|
13
12
|
class CommonMessageProcessor {
|
|
14
13
|
constructor(runsRepository) {
|
|
15
14
|
this.runsRepository = runsRepository;
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
16
|
+
* Process a transformed run message
|
|
17
|
+
*
|
|
18
|
+
* @param element - The run with message data (already filtered, with isNotPublic flag set)
|
|
19
|
+
* @param firstMessageCreatedAt - Timestamp of the first message in the batch
|
|
18
20
|
*/
|
|
19
21
|
this.processTransformedRun = async (element, firstMessageCreatedAt) => {
|
|
20
22
|
this.logElementIssues(element);
|
|
21
23
|
const record = await this.runsRepository.getRunRecordForUpdate(element.run);
|
|
22
24
|
let outputMsg;
|
|
23
25
|
if (record) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
element.
|
|
26
|
+
// Data quality check: Ensure scheduled vehicles have timestamps
|
|
27
|
+
// Not-public vehicles (replacement buses/trams) don't need scheduled timestamps
|
|
28
|
+
// Regular scheduled vehicles MUST have a timestamp or be able to get one from history
|
|
29
|
+
if (!element.run_message.actual_stop_timestamp_scheduled) {
|
|
30
|
+
// Read flag set by filter (avoids duplicate whitelist check)
|
|
31
|
+
const isNotPublicVehicle = element.isNotPublic === true;
|
|
32
|
+
// If NOT a not-public vehicle, try to get timestamp from last message
|
|
33
|
+
// If we can't get it, skip this message (data quality issue)
|
|
34
|
+
if (!isNotPublicVehicle) {
|
|
35
|
+
const lastRecordMessage = await this.runsRepository["runsMessagesRepository"].getLastMessage(record.id);
|
|
36
|
+
if (!lastRecordMessage || !lastRecordMessage.actual_stop_timestamp_scheduled) {
|
|
37
|
+
// Cannot process scheduled vehicle without timestamp
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
element.run_message.actual_stop_timestamp_scheduled = lastRecordMessage.actual_stop_timestamp_scheduled;
|
|
41
|
+
}
|
|
42
|
+
// If IS a not-public vehicle, continue without timestamp (this is expected)
|
|
30
43
|
}
|
|
31
44
|
outputMsg = await this.runsRepository.updateAndAssociate(element, record.id);
|
|
32
45
|
}
|
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,2FAA0D;AAE1D,wEAAqE;AAErE,yEAAsE;AACtE,2FAAqF;AACrF,6EAAwE;
|
|
1
|
+
{"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,2FAA0D;AAE1D,wEAAqE;AAErE,yEAAsE;AACtE,2FAAqF;AACrF,6EAAwE;AAGxE,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAa,sBAAsB;IAG/B,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAIjE;;;;;WAKG;QACI,0BAAqB,GAAG,KAAK,EAAE,OAAiC,EAAE,qBAA8B,EAAiB,EAAE;YACtH,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE5E,IAAI,SAAmC,CAAC;YACxC,IAAI,MAAM,EAAE,CAAC;gBACT,gEAAgE;gBAChE,gFAAgF;gBAChF,sFAAsF;gBACtF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,+BAA+B,EAAE,CAAC;oBACvD,6DAA6D;oBAC7D,MAAM,kBAAkB,GAAG,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC;oBAExD,sEAAsE;oBACtE,6DAA6D;oBAC7D,IAAI,CAAC,kBAAkB,EAAE,CAAC;wBACtB,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;wBACxG,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,+BAA+B,EAAE,CAAC;4BAC3E,qDAAqD;4BACrD,OAAO;wBACX,CAAC;wBACD,OAAO,CAAC,WAAW,CAAC,+BAA+B,GAAG,iBAAiB,CAAC,+BAA+B,CAAC;oBAC5G,CAAC;oBACD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
|
import { ICommonRunWithMessageDto } from "../../../../../schema-definitions/vehicle-positions/models/interfaces/ICommonRunWithMessageDto";
|
|
2
|
+
import { NotPublicVehiclesRedisRepository } from "../../../../ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository";
|
|
2
3
|
import { ILogger } from "@golemio/core/dist/helpers/logger";
|
|
3
4
|
import { ICommonMessageFilter } from "./interfaces/ICommonMessageFilter";
|
|
4
5
|
import { TimestampValidator } from "./TimestampValidator";
|
|
5
6
|
export declare class TramMessageFilter implements ICommonMessageFilter {
|
|
6
7
|
private logger;
|
|
7
8
|
private timestampValidator;
|
|
8
|
-
|
|
9
|
+
private notPublicVehiclesRepository;
|
|
10
|
+
constructor(logger: ILogger, timestampValidator: TimestampValidator, notPublicVehiclesRepository: NotPublicVehiclesRedisRepository);
|
|
9
11
|
/**
|
|
10
12
|
* Yield tram messages that are valid for processing
|
|
11
13
|
* - route id is not considered a servicing route (50-89, note: >89 is a night tram route)
|
|
12
14
|
* - run number is less than 80
|
|
13
|
-
* -
|
|
15
|
+
* - OR registration number is in not-public vehicles whitelist (e.g., mazačka maintenance trams)
|
|
14
16
|
* - timestamp is in acceptable range
|
|
17
|
+
*
|
|
18
|
+
* Sets isNotPublic flag on messages to avoid duplicate whitelist checks in processor
|
|
15
19
|
*/
|
|
16
|
-
yieldFilteredMessages(messages: ICommonRunWithMessageDto[], timestamp: number):
|
|
20
|
+
yieldFilteredMessages(messages: ICommonRunWithMessageDto[], timestamp: number): AsyncGenerator<ICommonRunWithMessageDto>;
|
|
17
21
|
private isRouteIdValid;
|
|
18
22
|
private isRunNumberValid;
|
|
19
23
|
}
|
|
@@ -13,9 +13,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.TramMessageFilter = void 0;
|
|
16
|
+
const NotPublicVehiclesRedisRepository_1 = require("../../../../ropid-gtfs/data-access/cache/NotPublicVehiclesRedisRepository");
|
|
16
17
|
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
17
18
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
18
|
-
const const_1 = require("../../../../../const");
|
|
19
19
|
const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
|
|
20
20
|
const TimestampValidator_1 = require("./TimestampValidator");
|
|
21
21
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
@@ -23,28 +23,44 @@ const TRAM_SERVICING_ROUTE_ID_MIN = 50;
|
|
|
23
23
|
const TRAM_SERVICING_ROUTE_ID_MAX = 89;
|
|
24
24
|
const TRAM_UNUSUAL_RUN_NUMBER_MIN = 80;
|
|
25
25
|
let TramMessageFilter = class TramMessageFilter {
|
|
26
|
-
constructor(logger, timestampValidator) {
|
|
26
|
+
constructor(logger, timestampValidator, notPublicVehiclesRepository) {
|
|
27
27
|
this.logger = logger;
|
|
28
28
|
this.timestampValidator = timestampValidator;
|
|
29
|
+
this.notPublicVehiclesRepository = notPublicVehiclesRepository;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* Yield tram messages that are valid for processing
|
|
32
33
|
* - route id is not considered a servicing route (50-89, note: >89 is a night tram route)
|
|
33
34
|
* - run number is less than 80
|
|
34
|
-
* -
|
|
35
|
+
* - OR registration number is in not-public vehicles whitelist (e.g., mazačka maintenance trams)
|
|
35
36
|
* - timestamp is in acceptable range
|
|
37
|
+
*
|
|
38
|
+
* Sets isNotPublic flag on messages to avoid duplicate whitelist checks in processor
|
|
36
39
|
*/
|
|
37
|
-
*yieldFilteredMessages(messages, timestamp) {
|
|
40
|
+
async *yieldFilteredMessages(messages, timestamp) {
|
|
41
|
+
// Load config once for the entire batch to avoid multiple Redis calls
|
|
42
|
+
const { tram: { registrationNumbers }, routeIds, } = await this.notPublicVehiclesRepository.getConfig();
|
|
43
|
+
const whitelistedRegistrationNumbers = new Set(registrationNumbers);
|
|
44
|
+
const whitelistedRouteNames = new Set(routeIds);
|
|
38
45
|
for (const message of messages) {
|
|
39
|
-
const { route_id, run_number, registration_number } = message.run;
|
|
46
|
+
const { route_id, run_number, registration_number, line_short_name } = message.run;
|
|
40
47
|
if (!this.timestampValidator.isTimestampValid(timestamp, message.run_message.actual_stop_timestamp_real.toString())) {
|
|
41
48
|
this.logger.error(new golemio_errors_1.GeneralError("Message timestamp 'takt' of value" +
|
|
42
49
|
message.run_message.actual_stop_timestamp_real.toISOString() +
|
|
43
50
|
`is not valid for line ${message.run.line_short_name}, run ${message.run.run_number}`, this.constructor.name, undefined, undefined, "pid"));
|
|
44
51
|
continue;
|
|
45
52
|
}
|
|
46
|
-
if
|
|
47
|
-
|
|
53
|
+
// Check if this is a not-public vehicle
|
|
54
|
+
// - Whitelisted registration number (e.g., mazačka maintenance tram)
|
|
55
|
+
// - Whitelisted route name (e.g., ad-hoc routes like X1, X2, NAD)
|
|
56
|
+
const isNotPublicByRegistration = whitelistedRegistrationNumbers.has(registration_number);
|
|
57
|
+
const isNotPublicByRouteName = whitelistedRouteNames.has(line_short_name);
|
|
58
|
+
const isNotPublicVehicle = isNotPublicByRegistration || isNotPublicByRouteName;
|
|
59
|
+
// Allow if:
|
|
60
|
+
// - Whitelisted by registration number OR route name (not-public vehicles)
|
|
61
|
+
// - OR valid route_id and run_number (scheduled vehicles)
|
|
62
|
+
if (isNotPublicVehicle || (this.isRouteIdValid(route_id) && this.isRunNumberValid(run_number))) {
|
|
63
|
+
message.isNotPublic = isNotPublicVehicle; // ← Set flag
|
|
48
64
|
yield message;
|
|
49
65
|
}
|
|
50
66
|
else {
|
|
@@ -67,6 +83,8 @@ exports.TramMessageFilter = TramMessageFilter = __decorate([
|
|
|
67
83
|
(0, tsyringe_1.injectable)(),
|
|
68
84
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
69
85
|
__param(1, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.TimestampValidator)),
|
|
70
|
-
|
|
86
|
+
__param(2, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.NotPublicVehiclesRedisRepository)),
|
|
87
|
+
__metadata("design:paramtypes", [Object, TimestampValidator_1.TimestampValidator,
|
|
88
|
+
NotPublicVehiclesRedisRepository_1.NotPublicVehiclesRedisRepository])
|
|
71
89
|
], TramMessageFilter);
|
|
72
90
|
//# sourceMappingURL=TramMessageFilter.js.map
|
package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TramMessageFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;
|
|
1
|
+
{"version":3,"file":"TramMessageFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gIAAqH;AACrH,wEAAqE;AAErE,iEAAwE;AAExE,oEAA8E;AAC9E,6DAA0D;AAC1D,6EAAwE;AAExE,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAGhC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,YACsC,MAAe,EACI,kBAAsC,EAEnF,2BAA6D;QAHnC,WAAM,GAAN,MAAM,CAAS;QACI,uBAAkB,GAAlB,kBAAkB,CAAoB;QAEnF,gCAA2B,GAA3B,2BAA2B,CAAkC;IACtE,CAAC;IAEJ;;;;;;;;OAQG;IACI,KAAK,CAAC,CAAC,qBAAqB,CAC/B,QAAoC,EACpC,SAAiB;QAEjB,sEAAsE;QACtE,MAAM,EACF,IAAI,EAAE,EAAE,mBAAmB,EAAE,EAC7B,QAAQ,GACX,GAAG,MA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,CAAC,WAAW,GAAG,kBAAkB,CAAC,CAAC,aAAa;gBACvD,MAAM,OAAO,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,cAAc,QAAQ,kBAAkB,UAAU,aAAa,CAAC,CAAC;gBAC1G,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,OAAe;QAClC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,CACH,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;YAC5B,CAAC,aAAa,GAAG,2BAA2B,IAAI,aAAa,GAAG,2BAA2B,CAAC,CAC/F,CAAC;IACN,CAAC;IAEO,gBAAgB,CAAC,SAAiB;QACtC,OAAO,SAAS,GAAG,2BAA2B,CAAC;IACnD,CAAC;CACJ,CAAA;AA9EY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,kBAAkB,CAAC,CAAA;IAC3C,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,gCAAgC,CAAC,CAAA;6CADe,uCAAkB;QAEtD,mEAAgC;GALhE,iBAAiB,CA8E7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ICommonRunWithMessageDto } from "../../../../../../schema-definitions/vehicle-positions/models/interfaces/ICommonRunWithMessageDto";
|
|
2
2
|
export interface ICommonMessageFilter {
|
|
3
|
-
yieldFilteredMessages(messages: ICommonRunWithMessageDto[], timestamp: number):
|
|
3
|
+
yieldFilteredMessages(messages: ICommonRunWithMessageDto[], timestamp: number): AsyncGenerator<ICommonRunWithMessageDto>;
|
|
4
4
|
}
|
|
@@ -37,7 +37,7 @@ let SaveBusRunsToDBTask = class SaveBusRunsToDBTask extends workers_1.AbstractTa
|
|
|
37
37
|
}
|
|
38
38
|
const messages = this.messagesTransformation.transform({ data: data.M.V, timestamp });
|
|
39
39
|
const filteredMessages = this.messageFilter.yieldFilteredMessages(messages, timestamp);
|
|
40
|
-
for (const runMessage of filteredMessages) {
|
|
40
|
+
for await (const runMessage of filteredMessages) {
|
|
41
41
|
await this.messageProcessor.processTransformedRun(runMessage, timestamp);
|
|
42
42
|
}
|
|
43
43
|
}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveBusRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,6EAAwE;AAExE,8EAA2E;
|
|
1
|
+
{"version":3,"file":"SaveBusRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,6EAAwE;AAExE,8EAA2E;AAC3E,8EAA2E;AAG3E,iEAAwE;AAExE,wCAA2D;AAC3D,oEAA8E;AAC9E,iEAAgE;AAChE,4CAA2C;AAGpC,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,sBAA8B;IAUnE;QACI,KAAK,CAAC,uBAAW,CAAC,CAAC;QAVP,cAAS,GAAG,iBAAiB,CAAC;QAC9B,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,6CAA0B,CAAC;QAShD,IAAI,CAAC,sBAAsB,GAAG,gBAAW,CAAC,OAAO,CAC7C,mCAAgB,CAAC,gCAAgC,CACpD,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,2CAAoB,EAAE,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,IAAI,+CAAsB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,aAAa,GAAG,gBAAW,CAAC,OAAO,CAAmB,mCAAgB,CAAC,gBAAgB,CAAC,CAAC;IAClG,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,IAAsB,EAAE,aAAiC;QAC7E,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,CAAC;QAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,6BAAY,CAAC,sCAAsC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAChH,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACtF,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEvF,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;YAC9C,MAAM,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;IACL,CAAC;CACJ,CAAA;AAjCY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;;GACA,mBAAmB,CAiC/B"}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js
CHANGED
|
@@ -37,7 +37,7 @@ let SaveTramRunsToDBTask = class SaveTramRunsToDBTask extends workers_1.Abstract
|
|
|
37
37
|
}
|
|
38
38
|
const messages = this.messagesTransformation.transform({ data: data.M.V, timestamp }, true);
|
|
39
39
|
const filteredMessages = this.messageFilter.yieldFilteredMessages(messages, timestamp);
|
|
40
|
-
for (const runMessage of filteredMessages) {
|
|
40
|
+
for await (const runMessage of filteredMessages) {
|
|
41
41
|
await this.messageProcessor.processTransformedRun(runMessage, timestamp);
|
|
42
42
|
}
|
|
43
43
|
}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveTramRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA2D;AAC3D,oEAA8E;AAC9E,2EAA6E;AAC7E,6EAAwE;AAExE,8EAA2E;AAC3E,8EAA2E;AAG3E,iEAAwE;AAExE,iEAAgE;AAChE,4CAA2C;AAIpC,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,sBAA8B;IAUpE;QACI,KAAK,CAAC,uBAAW,CAAC,CAAC;QAVP,cAAS,GAAG,kBAAkB,CAAC;QAC/B,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,6CAA0B,CAAC;QAShD,IAAI,CAAC,sBAAsB,GAAG,gBAAW,CAAC,OAAO,CAC7C,mCAAgB,CAAC,gCAAgC,CACpD,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,2CAAoB,EAAE,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,IAAI,+CAAsB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,aAAa,GAAG,gBAAW,CAAC,OAAO,CAAoB,mCAAgB,CAAC,iBAAiB,CAAC,CAAC;IACpG,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,IAAsB,EAAE,aAAiC;QAC7E,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,CAAC;QAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,6BAAY,CAAC,uCAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjH,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5F,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACvF,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveTramRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA2D;AAC3D,oEAA8E;AAC9E,2EAA6E;AAC7E,6EAAwE;AAExE,8EAA2E;AAC3E,8EAA2E;AAG3E,iEAAwE;AAExE,iEAAgE;AAChE,4CAA2C;AAIpC,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,sBAA8B;IAUpE;QACI,KAAK,CAAC,uBAAW,CAAC,CAAC;QAVP,cAAS,GAAG,kBAAkB,CAAC;QAC/B,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,6CAA0B,CAAC;QAShD,IAAI,CAAC,sBAAsB,GAAG,gBAAW,CAAC,OAAO,CAC7C,mCAAgB,CAAC,gCAAgC,CACpD,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,2CAAoB,EAAE,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,IAAI,+CAAsB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,aAAa,GAAG,gBAAW,CAAC,OAAO,CAAoB,mCAAgB,CAAC,iBAAiB,CAAC,CAAC;IACpG,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,IAAsB,EAAE,aAAiC;QAC7E,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,CAAC;QAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,6BAAY,CAAC,uCAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjH,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5F,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACvF,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;YAC9C,MAAM,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;IACL,CAAC;CACJ,CAAA;AAhCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;;GACA,oBAAoB,CAgChC"}
|
|
@@ -7,4 +7,10 @@ export interface IRunMessageWithStringTimestamps extends Omit<ICommonRunsMessage
|
|
|
7
7
|
export interface IUpdateRunsGtfsTripInput {
|
|
8
8
|
run: ICommonRunsModel;
|
|
9
9
|
run_message: IRunMessageWithStringTimestamps;
|
|
10
|
+
/**
|
|
11
|
+
* Flag set by message filters to indicate this is a not-public vehicle
|
|
12
|
+
* (replacement bus/tram without schedule, or ad-hoc route)
|
|
13
|
+
* Used to avoid duplicate whitelist checks
|
|
14
|
+
*/
|
|
15
|
+
isNotPublic?: boolean;
|
|
10
16
|
}
|
|
@@ -9,7 +9,6 @@ const CommonRunsRepository_1 = require("../../runs/data-access/CommonRunsReposit
|
|
|
9
9
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
10
10
|
const queueprocessors_1 = require("@golemio/core/dist/integration-engine/queueprocessors");
|
|
11
11
|
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
12
|
-
const const_1 = require("../../../../../const");
|
|
13
12
|
const PositionsRepository_1 = require("../data-access/PositionsRepository");
|
|
14
13
|
const TripsRepository_1 = require("../data-access/TripsRepository");
|
|
15
14
|
const PositionsMapper_1 = __importDefault(require("../data-access/helpers/PositionsMapper"));
|
|
@@ -49,7 +48,9 @@ class UpdateRunsGtfsTripIdTask extends workers_1.AbstractTask {
|
|
|
49
48
|
async execute(data, messageProperties) {
|
|
50
49
|
const schedule = await this.gtfsTripRunManager.setAndReturnScheduledTrips(data.run);
|
|
51
50
|
if (schedule.length === 0) {
|
|
52
|
-
|
|
51
|
+
// Use the isNotPublic flag set by the filter to avoid duplicate Redis calls
|
|
52
|
+
// This flag is true if the vehicle is whitelisted by registration number or route name
|
|
53
|
+
if (data.isNotPublic === true) {
|
|
53
54
|
await this.updateNotPublicRunTrip(data);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateRunsGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2E;AAC3E,sFAA2G;AAC3G,2EAAoE;AACpE,2FAAqF;AACrF,2EAA6E;AAE7E,
|
|
1
|
+
{"version":3,"file":"UpdateRunsGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.ts"],"names":[],"mappings":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AAE,SAAS;aAC1C,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CAkBJ;AA7ED,4DA6EC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { PositionDto } from "../../../schema-definitions/vehicle-positions/models/PositionDto";
|
|
2
|
+
import { AbstractBasicRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractBasicRepository";
|
|
3
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
4
|
+
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
5
|
+
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
6
|
+
export declare class PositionRepository extends AbstractBasicRepository {
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
sequelizeModel: ModelStatic<PositionDto>;
|
|
10
|
+
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
4
11
|
GetAll(): never;
|
|
5
12
|
GetOne(): never;
|
|
6
13
|
}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.PositionRepository = void 0;
|
|
4
16
|
const const_1 = require("../../../schema-definitions/const");
|
|
5
17
|
const vehicle_positions_1 = require("../../../schema-definitions/vehicle-positions");
|
|
6
18
|
const PositionDto_1 = require("../../../schema-definitions/vehicle-positions/models/PositionDto");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
const AbstractBasicRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractBasicRepository");
|
|
20
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
21
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
let PositionRepository = class PositionRepository extends AbstractBasicRepository_1.AbstractBasicRepository {
|
|
23
|
+
constructor(connector, logger) {
|
|
24
|
+
super(connector, logger);
|
|
25
|
+
this.schema = const_1.PG_SCHEMA;
|
|
26
|
+
this.tableName = vehicle_positions_1.VehiclePositions.positions.pgTableName;
|
|
27
|
+
this.sequelizeModel = connector
|
|
28
|
+
.getConnection()
|
|
29
|
+
.define(this.tableName, PositionDto_1.PositionDto.attributeModel, { schema: this.schema });
|
|
13
30
|
}
|
|
14
31
|
GetAll() {
|
|
15
32
|
throw new Error("Not implemented");
|
|
@@ -17,6 +34,12 @@ class PositionRepository extends output_gateway_1.SequelizeModel {
|
|
|
17
34
|
GetOne() {
|
|
18
35
|
throw new Error("Not implemented");
|
|
19
36
|
}
|
|
20
|
-
}
|
|
37
|
+
};
|
|
21
38
|
exports.PositionRepository = PositionRepository;
|
|
39
|
+
exports.PositionRepository = PositionRepository = __decorate([
|
|
40
|
+
(0, tsyringe_1.injectable)(),
|
|
41
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
42
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
43
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
44
|
+
], PositionRepository);
|
|
22
45
|
//# sourceMappingURL=PositionRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositionRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/vehicle-positions/data-access/PositionRepository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PositionRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/vehicle-positions/data-access/PositionRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,qFAA0D;AAC1D,kGAAwE;AACxE,kIAA+H;AAG/H,wEAAqE;AACrE,iEAAwE;AAIjE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,iDAAuB;IAM3D,YAAiD,SAA6B,EAA4B,MAAe;QACrH,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QANtB,WAAM,GAAG,iBAAS,CAAC;QACnB,cAAS,GAAG,oCAAgB,CAAC,SAAS,CAAC,WAAW,CAAC;QAMtD,IAAI,CAAC,cAAc,GAAG,SAAS;aAC1B,aAAa,EAAE;aACf,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAW,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACrF,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ,CAAA;AApBY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,qBAAU,GAAE;IAOI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IAAiC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GANhG,kBAAkB,CAoB9B"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { VPTripsModel } from "../../../schema-definitions/vehicle-positions/models";
|
|
2
|
-
import {
|
|
2
|
+
import { AbstractBasicRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractBasicRepository";
|
|
3
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
4
|
+
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
3
5
|
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
4
|
-
export declare class TripRepository extends
|
|
6
|
+
export declare class TripRepository extends AbstractBasicRepository {
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
5
9
|
sequelizeModel: ModelStatic<VPTripsModel>;
|
|
6
|
-
constructor();
|
|
10
|
+
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
7
11
|
GetAll(): never;
|
|
8
12
|
GetOne(): never;
|
|
9
13
|
}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.TripRepository = void 0;
|
|
4
16
|
const const_1 = require("../../../schema-definitions/const");
|
|
5
17
|
const models_1 = require("../../../schema-definitions/vehicle-positions/models");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
const AbstractBasicRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractBasicRepository");
|
|
19
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
20
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
21
|
+
let TripRepository = class TripRepository extends AbstractBasicRepository_1.AbstractBasicRepository {
|
|
22
|
+
constructor(connector, logger) {
|
|
23
|
+
super(connector, logger);
|
|
24
|
+
this.schema = const_1.PG_SCHEMA;
|
|
25
|
+
this.tableName = models_1.VPTripsModel.TABLE_NAME;
|
|
26
|
+
this.sequelizeModel = connector
|
|
27
|
+
.getConnection()
|
|
28
|
+
.define(this.tableName, models_1.VPTripsModel.attributeModel, { schema: this.schema });
|
|
12
29
|
// some attributes should never be consumed by API users
|
|
13
30
|
this.sequelizeModel.removeAttribute("last_position_context");
|
|
14
31
|
this.sequelizeModel.removeAttribute("provider_source_type");
|
|
@@ -21,6 +38,12 @@ class TripRepository extends models_2.SequelizeModel {
|
|
|
21
38
|
GetOne() {
|
|
22
39
|
throw new Error("Not implemented");
|
|
23
40
|
}
|
|
24
|
-
}
|
|
41
|
+
};
|
|
25
42
|
exports.TripRepository = TripRepository;
|
|
43
|
+
exports.TripRepository = TripRepository = __decorate([
|
|
44
|
+
(0, tsyringe_1.injectable)(),
|
|
45
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
46
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
47
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
48
|
+
], TripRepository);
|
|
26
49
|
//# sourceMappingURL=TripRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TripRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/vehicle-positions/data-access/TripRepository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TripRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/vehicle-positions/data-access/TripRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,iFAA6D;AAC7D,kIAA+H;AAG/H,wEAAqE;AACrE,iEAAwE;AAIjE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,iDAAuB;IAMvD,YAAiD,SAA6B,EAA4B,MAAe;QACrH,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QANtB,WAAM,GAAG,iBAAS,CAAC;QACnB,cAAS,GAAG,qBAAY,CAAC,UAAU,CAAC;QAMvC,IAAI,CAAC,cAAc,GAAG,SAAS;aAC1B,aAAa,EAAE;aACf,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAElF,wDAAwD;QACxD,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;QAC5D,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACzD,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IACzD,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ,CAAA;AA1BY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAOI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IAAiC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GANhG,cAAc,CA0B1B"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { DescriptorModel } from "../../../schema-definitions/vehicle-descriptors/models/DescriptorModel";
|
|
2
|
+
import { AbstractBasicRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractBasicRepository";
|
|
3
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
4
|
+
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
5
|
+
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
6
|
+
export declare class VehicleDescriptorRepository extends AbstractBasicRepository {
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
sequelizeModel: ModelStatic<DescriptorModel>;
|
|
10
|
+
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
4
11
|
GetAll(): never;
|
|
5
12
|
GetOne(): never;
|
|
6
13
|
}
|