@golemio/pid 2.12.10 → 2.12.11-dev.1271718352
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/db/example/12_metro_line_A_gtfs_trips.sql +1 -2
- package/db/example/15_vehicle_descriptors.sql +3 -3
- package/db/example/redis/publicDepartureBoardsMock.json +13 -0
- package/db/example/redis/publicVehiclePositionsMock.json +24 -0
- package/db/migrations/postgresql/20240418133218-detailed-stop-times.js +53 -0
- package/db/migrations/postgresql/20240424122841-delay-at-past-stops-release-part-1.js +53 -0
- package/db/migrations/postgresql/sqls/20240418133218-detailed-stop-times-down.sql +263 -0
- package/db/migrations/postgresql/sqls/20240418133218-detailed-stop-times-up.sql +174 -0
- package/db/migrations/postgresql/sqls/20240424122841-delay-at-past-stops-release-part-1-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20240424122841-delay-at-past-stops-release-part-1-up.sql +98 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.d.ts +4 -3
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js +8 -6
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.d.ts +14 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js +82 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.d.ts +10 -2
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +81 -10
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/interfaces/IPublicDepartureDto.d.ts +12 -0
- package/dist/{schema-definitions/vehicle-positions/models/views/interfaces/IStopTimeDelayPredictionDto.js → integration-engine/ropid-gtfs/interfaces/IPublicDepartureDto.js} +1 -1
- package/dist/integration-engine/ropid-gtfs/interfaces/IPublicDepartureDto.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +10 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +4 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.d.ts +7 -0
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js +36 -0
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.d.ts +2 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +9 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/constants.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/constants.js +5 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/constants.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +4 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.d.ts +21 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js +102 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.d.ts +3 -2
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js +9 -7
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IRefreshPublicDepartureParams.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IRefreshPublicDepartureParams.js +3 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IRefreshPublicDepartureParams.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/RefreshPublicDepartureSchema.d.ts +5 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/RefreshPublicDepartureSchema.js +31 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/RefreshPublicDepartureSchema.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js +30 -12
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.d.ts +1 -4
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js +5 -21
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +4 -21
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js +6 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.d.ts +4 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js +39 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +3 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.d.ts +3 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js +8 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js.map +1 -1
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +2 -1
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
- package/dist/output-gateway/public/controllers/v1/PublicDepartureBoardsController.d.ts +8 -0
- package/dist/output-gateway/public/controllers/v1/PublicDepartureBoardsController.js +65 -0
- package/dist/output-gateway/public/controllers/v1/PublicDepartureBoardsController.js.map +1 -0
- package/dist/output-gateway/public/controllers/v1/interfaces/PublicParamsInterfaces.d.ts +10 -0
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +11 -0
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +72 -0
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.d.ts +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +22 -2
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
- package/dist/output-gateway/public/domain/IPublicDepartureTransformInputDto.d.ts +9 -0
- package/dist/output-gateway/public/domain/IPublicDepartureTransformInputDto.js +3 -0
- package/dist/output-gateway/public/domain/IPublicDepartureTransformInputDto.js.map +1 -0
- package/dist/output-gateway/public/domain/PublicApiDepartureInterfaces.d.ts +34 -0
- package/dist/output-gateway/public/domain/PublicApiDepartureInterfaces.js +3 -0
- package/dist/output-gateway/public/domain/PublicApiDepartureInterfaces.js.map +1 -0
- package/dist/output-gateway/public/domain/repository/IGtfsDepartureRepository.d.ts +4 -0
- package/dist/output-gateway/public/domain/repository/IGtfsDepartureRepository.js +3 -0
- package/dist/output-gateway/public/domain/repository/IGtfsDepartureRepository.js.map +1 -0
- package/dist/output-gateway/public/domain/repository/IVehiclePositionsRepository.d.ts +1 -0
- package/dist/output-gateway/public/ioc/Di.js +8 -0
- package/dist/output-gateway/public/ioc/Di.js.map +1 -1
- package/dist/output-gateway/public/ioc/OgModuleToken.d.ts +2 -0
- package/dist/output-gateway/public/ioc/OgModuleToken.js +2 -0
- package/dist/output-gateway/public/ioc/OgModuleToken.js.map +1 -1
- package/dist/output-gateway/public/routers/v1/PublicDeparturesRouter.d.ts +10 -0
- package/dist/output-gateway/public/routers/v1/PublicDeparturesRouter.js +28 -0
- package/dist/output-gateway/public/routers/v1/PublicDeparturesRouter.js.map +1 -0
- package/dist/output-gateway/public/routers/v1/{PublicRouter.d.ts → PublicVehiclePositionsRouter.d.ts} +3 -3
- package/dist/output-gateway/public/routers/v1/{PublicRouter.js → PublicVehiclePositionsRouter.js} +8 -8
- package/dist/output-gateway/public/routers/v1/PublicVehiclePositionsRouter.js.map +1 -0
- package/dist/output-gateway/public/routers/v1/helpers/CustomStopIdGroupValidator.d.ts +5 -0
- package/dist/output-gateway/public/routers/v1/helpers/CustomStopIdGroupValidator.js +42 -0
- package/dist/output-gateway/public/routers/v1/helpers/CustomStopIdGroupValidator.js.map +1 -0
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.d.ts +17 -0
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js +117 -0
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js.map +1 -0
- package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.d.ts +34 -0
- package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js +54 -0
- package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js.map +1 -0
- package/dist/output-gateway/shared/DepartureCalculator.d.ts +10 -0
- package/dist/output-gateway/shared/DepartureCalculator.js +26 -0
- package/dist/output-gateway/shared/DepartureCalculator.js.map +1 -0
- package/dist/output-gateway/shared/RopidRouterUtils.d.ts +2 -1
- package/dist/output-gateway/shared/RopidRouterUtils.js +4 -3
- package/dist/output-gateway/shared/RopidRouterUtils.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +1 -0
- package/dist/schema-definitions/ropid-gtfs/redis/const.js +5 -0
- package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -0
- package/dist/schema-definitions/ropid-gtfs/redis/interfaces/IPublicGtfsDepartureCacheDto.d.ts +12 -0
- package/dist/schema-definitions/ropid-gtfs/redis/interfaces/IPublicGtfsDepartureCacheDto.js +3 -0
- package/dist/schema-definitions/ropid-gtfs/redis/interfaces/IPublicGtfsDepartureCacheDto.js.map +1 -0
- package/dist/schema-definitions/ropid-gtfs/redis/schemas/PublicGtfsDepartureDtoSchema.d.ts +4 -0
- package/dist/schema-definitions/ropid-gtfs/redis/schemas/PublicGtfsDepartureDtoSchema.js +69 -0
- package/dist/schema-definitions/ropid-gtfs/redis/schemas/PublicGtfsDepartureDtoSchema.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +3 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +12 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/index.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/index.js +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/index.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +3 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +3 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +26 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
- package/docs/implementation_documentation.md +26 -0
- package/docs/openapi-output.yaml +233 -0
- package/package.json +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/StopTimeDelayPredictionRepository.d.ts +0 -7
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/StopTimeDelayPredictionRepository.js +0 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/StopTimeDelayPredictionRepository.js.map +0 -1
- package/dist/output-gateway/public/routers/v1/PublicRouter.js.map +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/StopTimeDelayPredictionModel.d.ts +0 -13
- package/dist/schema-definitions/vehicle-positions/models/views/StopTimeDelayPredictionModel.js +0 -41
- package/dist/schema-definitions/vehicle-positions/models/views/StopTimeDelayPredictionModel.js.map +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IStopTimeDelayPredictionDto.d.ts +0 -9
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IStopTimeDelayPredictionDto.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.PublicGtfsDepartureRepository = void 0;
|
|
25
|
+
const OgModuleToken_1 = require("../../ioc/OgModuleToken");
|
|
26
|
+
const const_1 = require("../../../../schema-definitions/ropid-gtfs/redis/const");
|
|
27
|
+
const IoRedisConnector_1 = require("@golemio/core/dist/helpers/data-access/redis/IoRedisConnector");
|
|
28
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
29
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
30
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
31
|
+
let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = class PublicGtfsDepartureRepository {
|
|
32
|
+
constructor(redisConnector, log) {
|
|
33
|
+
this.redisConnector = redisConnector;
|
|
34
|
+
this.log = log;
|
|
35
|
+
this.getAndParseDepartureCache = (stopId, minutesAfter) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const connection = this.redisConnector.getConnection();
|
|
37
|
+
let departureCache;
|
|
38
|
+
try {
|
|
39
|
+
departureCache = yield connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, "-inf", Math.round(new Date().getTime() / 1000) + minutesAfter * 60);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot get public departure cache from cache: ${err.message}`, this.constructor.name, err);
|
|
43
|
+
}
|
|
44
|
+
if (departureCache.length === 0) {
|
|
45
|
+
this.log.info(`${this.constructor.name}: Cannot find public departure cache for stop ${stopId} in cache`);
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return departureCache.map((cache) => JSON.parse(cache));
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot parse public departure cache: ${err.message}`, this.constructor.name, err);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getPublicGtfsDepartureCache(stopIds, minutesAfter) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
if (!this.redisConnector.isConnected()) {
|
|
59
|
+
yield this.redisConnector.connect();
|
|
60
|
+
}
|
|
61
|
+
const allDepartures = yield Promise.all(stopIds.map((stopId) => this.getAndParseDepartureCache(stopId, minutesAfter)));
|
|
62
|
+
return allDepartures.flat();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.PublicGtfsDepartureRepository = PublicGtfsDepartureRepository = __decorate([
|
|
67
|
+
(0, tsyringe_1.injectable)(),
|
|
68
|
+
__param(0, (0, tsyringe_1.inject)(OgModuleToken_1.OgModuleToken.RedisConnector)),
|
|
69
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
70
|
+
__metadata("design:paramtypes", [IoRedisConnector_1.IoRedisConnector, Object])
|
|
71
|
+
], PublicGtfsDepartureRepository);
|
|
72
|
+
//# sourceMappingURL=PublicGtfsDepartureRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,2DAA6D;AAC7D,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC0C,cAAwC,EACpD,GAAoB;QADA,mBAAc,GAAd,cAAc,CAAkB;QAC5C,QAAG,GAAH,GAAG,CAAS;QAe1C,8BAAyB,GAAG,CAAO,MAAc,EAAE,YAAoB,EAA2C,EAAE;YACxH,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;YACvD,IAAI,cAAwB,CAAC;YAE7B,IAAI;gBACA,cAAc,GAAG,MAAM,UAAU,CAAC,aAAa,CAC3C,GAAG,yCAAiC,IAAI,MAAM,EAAE,EAChD,MAAM,EACN,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,YAAY,GAAG,EAAE,CAC9D,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAClB,GAAG,IAAI,CAAC,WAAW,CAA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CAAA;qCADqC,mCAAgB;GAFzE,6BAA6B,CAmDzC"}
|
|
@@ -9,6 +9,7 @@ export declare class PublicVehiclePositionsRepository implements IVehiclePositio
|
|
|
9
9
|
private setName;
|
|
10
10
|
constructor(redisConnector: IoRedisConnector, log: ILogger);
|
|
11
11
|
getAllVehicleIds(boundingBox: IBoundingBoxWithCenter): Promise<string[]>;
|
|
12
|
+
getAllVehicleIdsForTrip(tripId: string): Promise<string[]>;
|
|
12
13
|
getAllVehiclePositions(vehicleIds: string[]): Promise<IPublicApiCacheDto[]>;
|
|
13
14
|
getDetailedVehiclePosition(vehicleId: string): Promise<IPublicApiCacheDto | null>;
|
|
14
15
|
setCurrentSetName(name: string): void;
|
|
@@ -53,6 +53,26 @@ let PublicVehiclePositionsRepository = exports.PublicVehiclePositionsRepository
|
|
|
53
53
|
return vehicleIds;
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
getAllVehicleIdsForTrip(tripId) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
if (!this.setName) {
|
|
59
|
+
this.log.debug("Empty setName for public vehicle positions api.");
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
if (!this.redisConnector.isConnected()) {
|
|
63
|
+
yield this.redisConnector.connect();
|
|
64
|
+
}
|
|
65
|
+
const connection = this.redisConnector.getConnection();
|
|
66
|
+
let vehicleIds = [];
|
|
67
|
+
try {
|
|
68
|
+
vehicleIds = yield connection.lrange(`${this.setName}:trip-${tripId}`, 0, -1);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot get vehicle ids for trip from cache: ${err.message}`, this.constructor.name, err);
|
|
72
|
+
}
|
|
73
|
+
return vehicleIds;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
56
76
|
getAllVehiclePositions(vehicleIds) {
|
|
57
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
78
|
if (!this.setName) {
|
|
@@ -62,7 +82,7 @@ let PublicVehiclePositionsRepository = exports.PublicVehiclePositionsRepository
|
|
|
62
82
|
const connection = this.redisConnector.getConnection();
|
|
63
83
|
let vehiclePositions = [];
|
|
64
84
|
try {
|
|
65
|
-
vehiclePositions = yield connection.mget(vehicleIds.map((vehicleId) => `${this.setName}-${vehicleId}`));
|
|
85
|
+
vehiclePositions = yield connection.mget(vehicleIds.map((vehicleId) => `${this.setName}:vehicle-${vehicleId}`));
|
|
66
86
|
}
|
|
67
87
|
catch (err) {
|
|
68
88
|
throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot get vehicle positions from cache: ${err.message}`, this.constructor.name, err);
|
|
@@ -93,7 +113,7 @@ let PublicVehiclePositionsRepository = exports.PublicVehiclePositionsRepository
|
|
|
93
113
|
const connection = this.redisConnector.getConnection();
|
|
94
114
|
let vehiclePosition = null;
|
|
95
115
|
try {
|
|
96
|
-
vehiclePosition = yield connection.get(`${this.setName}-${vehicleId}`);
|
|
116
|
+
vehiclePosition = yield connection.get(`${this.setName}:vehicle-${vehicleId}`);
|
|
97
117
|
}
|
|
98
118
|
catch (err) {
|
|
99
119
|
this.log.error(`${this.constructor.name}: Cannot get vehicle position from cache: ${err.message}`);
|
package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicVehiclePositionsRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,2DAA6D;AAE7D,oGAAiG;AACjG,wEAAqE;AAErE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,gCAAgC,8CAAtC,MAAM,gCAAgC;IAGzC,YAC0C,cAAwC,EACpD,GAAoB;QADA,mBAAc,GAAd,cAAc,CAAkB;QAC5C,QAAG,GAAH,GAAG,CAAS;QAJ1C,YAAO,GAAuB,SAA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M,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"PublicVehiclePositionsRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,2DAA6D;AAE7D,oGAAiG;AACjG,wEAAqE;AAErE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,gCAAgC,8CAAtC,MAAM,gCAAgC;IAGzC,YAC0C,cAAwC,EACpD,GAAoB;QADA,mBAAc,GAAd,cAAc,CAAkB;QAC5C,QAAG,GAAH,GAAG,CAAS;QAJ1C,YAAO,GAAuB,SAAS,CAAC,CAAC,qBAAqB;IAKnE,CAAC;IAES,gBAAgB,CAAC,WAAmC;;YAC7D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBAClE,OAAO,EAAE,CAAC;aACb;YAED,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;gBACpC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;aACvC;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;YACvD,IAAI,UAAU,GAAa,EAAE,CAAC;YAE9B,IAAI;gBACA,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,SAAS,CACpC,IAAI,CAAC,OAAO,EACZ,YAAY,EACZ,WAAW,CAAC,WAAW,CAAC,SAAS,EACjC,WAAW,CAAC,WAAW,CAAC,QAAQ,EAChC,OAAO,EACP,WAAW,CAAC,KAAK,EACjB,WAAW,CAAC,MAAM,EAClB,GAAG,EACH,KAAK,CACR,CAAa,CAAC;aAClB;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IA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xB,CAAC;CACJ,CAAA;2CAvJY,gCAAgC;IAD5C,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,cAAc,CAAC,CAAA;IACpC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADqC,mCAAgB;GAJzE,gCAAgC,CAuJ5C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPublicGtfsDepartureCacheDto } from "../../../schema-definitions/ropid-gtfs/redis/interfaces/IPublicGtfsDepartureCacheDto";
|
|
2
|
+
import { IDescriptorOutputDto } from "../../../schema-definitions/vehicle-descriptors/models/interfaces";
|
|
3
|
+
import { IPublicApiCacheDto } from "../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
4
|
+
export interface IPublicDepartureTransformInputDto {
|
|
5
|
+
departure: IPublicGtfsDepartureCacheDto;
|
|
6
|
+
vehicleId: string | null;
|
|
7
|
+
vehiclePosition: IPublicApiCacheDto | null;
|
|
8
|
+
vehicleDescriptor: Partial<IDescriptorOutputDto> | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPublicDepartureTransformInputDto.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/domain/IPublicDepartureTransformInputDto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface IPublicApiDepartureInfo {
|
|
2
|
+
timestamp_scheduled: string;
|
|
3
|
+
timestamp_predicted: string;
|
|
4
|
+
delay_seconds: number | null;
|
|
5
|
+
minutes: number;
|
|
6
|
+
}
|
|
7
|
+
export interface IPublicApiDepartureStop {
|
|
8
|
+
id: string;
|
|
9
|
+
sequence: number;
|
|
10
|
+
platform_code: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface IPublicApiDepartureRoute {
|
|
13
|
+
type: string;
|
|
14
|
+
short_name: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IPublicApiDepartureTrip {
|
|
17
|
+
id: string;
|
|
18
|
+
headsign: string;
|
|
19
|
+
is_canceled: boolean | null;
|
|
20
|
+
}
|
|
21
|
+
export interface IPublicApiDepartureVehicle {
|
|
22
|
+
id: string | null;
|
|
23
|
+
is_wheelchair_accessible: boolean | null;
|
|
24
|
+
is_air_conditioned: boolean | null;
|
|
25
|
+
has_charger: boolean | null;
|
|
26
|
+
}
|
|
27
|
+
export interface IPublicApiDeparture {
|
|
28
|
+
departure: IPublicApiDepartureInfo;
|
|
29
|
+
stop: IPublicApiDepartureStop;
|
|
30
|
+
route: IPublicApiDepartureRoute;
|
|
31
|
+
trip: IPublicApiDepartureTrip;
|
|
32
|
+
vehicle: IPublicApiDepartureVehicle;
|
|
33
|
+
}
|
|
34
|
+
export type PublicApiDepartureBoardGroup = IPublicApiDeparture[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicApiDepartureInterfaces.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/domain/PublicApiDepartureInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPublicGtfsDepartureCacheDto } from "../../../../schema-definitions/ropid-gtfs/redis/interfaces/IPublicGtfsDepartureCacheDto";
|
|
2
|
+
export interface IGtfsDepartureRepository {
|
|
3
|
+
getPublicGtfsDepartureCache(stopId: string[], minutesAfter: number): Promise<IPublicGtfsDepartureCacheDto[]>;
|
|
4
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/domain/repository/IGtfsDepartureRepository.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import { IPublicApiCacheDto } from "../../../../schema-definitions/vehicle-posit
|
|
|
2
2
|
import { IBoundingBoxWithCenter } from "../IBoudingBox";
|
|
3
3
|
export interface IVehiclePositionsRepository {
|
|
4
4
|
getAllVehicleIds(boundingBox: IBoundingBoxWithCenter): Promise<string[]>;
|
|
5
|
+
getAllVehicleIdsForTrip(tripId: string): Promise<string[]>;
|
|
5
6
|
getAllVehiclePositions(vehicleIds: string[]): Promise<IPublicApiCacheDto[]>;
|
|
6
7
|
getDetailedVehiclePosition(vehicleId: string): Promise<IPublicApiCacheDto | null>;
|
|
7
8
|
setCurrentSetName(name: string): void;
|
|
@@ -9,9 +9,11 @@ const Di_1 = require("@golemio/core/dist/output-gateway/ioc/Di");
|
|
|
9
9
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
10
10
|
const VehicleDescriptorCachedRepository_1 = require("../data-access/VehicleDescriptorCachedRepository");
|
|
11
11
|
const DelayComputationRepository_1 = require("../data-access/redis/DelayComputationRepository");
|
|
12
|
+
const PublicGtfsDepartureRepository_1 = require("../data-access/redis/PublicGtfsDepartureRepository");
|
|
12
13
|
const PublicStopTimeRepository_1 = require("../data-access/redis/PublicStopTimeRepository");
|
|
13
14
|
const PublicVehiclePositionsRepository_1 = require("../data-access/redis/PublicVehiclePositionsRepository");
|
|
14
15
|
const VPSubscriber_1 = require("../service/VPSubscriber");
|
|
16
|
+
const DepartureBoardFacade_1 = require("../service/facade/DepartureBoardFacade");
|
|
15
17
|
const DetailedTripFacade_1 = require("../service/facade/DetailedTripFacade");
|
|
16
18
|
const VehiclePositionsFacade_1 = require("../service/facade/VehiclePositionsFacade");
|
|
17
19
|
const BoundingBoxHelper_1 = require("../service/helpers/BoundingBoxHelper");
|
|
@@ -35,6 +37,7 @@ ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.VehicleDescrip
|
|
|
35
37
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.PublicVehiclePositionsRepository, PublicVehiclePositionsRepository_1.PublicVehiclePositionsRepository);
|
|
36
38
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.DelayComputationRepository, DelayComputationRepository_1.DelayComputationRepository);
|
|
37
39
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.PublicStopTimeRepository, PublicStopTimeRepository_1.PublicStopTimeRepository);
|
|
40
|
+
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.PublicGtfsDepartureRepository, PublicGtfsDepartureRepository_1.PublicGtfsDepartureRepository);
|
|
38
41
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.InfoTripScopeHandler, InfoTripScopeHandler_1.InfoTripScopeHandler);
|
|
39
42
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.StopTimesTripScopeHandler, StopTimesTripScopeHandler_1.StopTimesTripScopeHandler);
|
|
40
43
|
ogPublicContainer.registerSingleton(OgModuleToken_1.OgModuleToken.ShapesTripScopeHandler, ShapesTripScopeHandler_1.ShapesTripScopeHandler);
|
|
@@ -50,6 +53,11 @@ ogPublicContainer.register(OgModuleToken_1.OgModuleToken.DetailedTripFacade, {
|
|
|
50
53
|
return new DetailedTripFacade_1.DetailedTripFacade(c.resolve(OgModuleToken_1.OgModuleToken.TripScopeHandlerFactory), c.resolve(OgModuleToken_1.OgModuleToken.PublicVehiclePositionsRepository));
|
|
51
54
|
}),
|
|
52
55
|
});
|
|
56
|
+
ogPublicContainer.register(OgModuleToken_1.OgModuleToken.DepartureBoardFacade, {
|
|
57
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
58
|
+
return new DepartureBoardFacade_1.DepartureBoardFacade(c.resolve(OgModuleToken_1.OgModuleToken.PublicGtfsDepartureRepository), c.resolve(OgModuleToken_1.OgModuleToken.PublicVehiclePositionsRepository), c.resolve(OgModuleToken_1.OgModuleToken.VehicleDescriptorCachedRepository));
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
53
61
|
ogPublicContainer.register(OgModuleToken_1.OgModuleToken.VPSubscriber, {
|
|
54
62
|
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
55
63
|
const config = c.resolve(CoreToken_1.CoreToken.SimpleConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,oFAAyE;AACzE,qFAAmF;AAEnF,oGAAiG;AACjG,wEAAqE;AAErE,iEAAkF;AAClF,iEAA4E;AAC5E,wGAAqG;AACrG,gGAA6F;AAC7F,4FAAyF;AACzF,4GAAyG;AAGzG,0DAAuD;AACvD,6EAA0E;AAC1E,qFAAwF;AACxF,4EAAyE;AAEzE,mGAAgG;AAChG,sGAAmG;AACnG,0GAAuG;AACvG,gHAA6G;AAC7G,gIAA6H;AAC7H,mDAAgD;AAEhD,MAAM,iBAAiB,GAAG,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,oFAAyE;AACzE,qFAAmF;AAEnF,oGAAiG;AACjG,wEAAqE;AAErE,iEAAkF;AAClF,iEAA4E;AAC5E,wGAAqG;AACrG,gGAA6F;AAC7F,sGAAmG;AACnG,4FAAyF;AACzF,4GAAyG;AAGzG,0DAAuD;AACvD,iFAA8E;AAC9E,6EAA0E;AAC1E,qFAAwF;AACxF,4EAAyE;AAEzE,mGAAgG;AAChG,sGAAmG;AACnG,0GAAuG;AACvG,gHAA6G;AAC7G,gIAA6H;AAC7H,mDAAgD;AAEhD,MAAM,iBAAiB,GAAG,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;AAsE1C,8CAAiB;AApE/C,iBAAiB,CAAC,QAAQ,CAAC,6BAAa,CAAC,cAAc,EAAE;IACrD,UAAU,EAAE,IAAA,iCAAsB,EAAC,CAAC,CAAC,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAEhE,OAAO,IAAI,mCAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC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AEpD,OAAO,IAAI,2BAAY,CACnB;YACI,WAAW,EAAE,qCAA6B;YAC1C,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAS,gBAAgB,CAAC;YAChE,MAAM,EAAE,MAAM;SACjB,EACD,CAAC,CAAC,OAAO,CAA8B,6BAAa,CAAC,gCAAgC,CAAC,CACzF,CAAC;IACN,CAAC,CAAC;CACL,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare const OgModuleToken: {
|
|
|
6
6
|
PublicVehiclePositionsRepository: symbol;
|
|
7
7
|
PublicStopTimeRepository: symbol;
|
|
8
8
|
DelayComputationRepository: symbol;
|
|
9
|
+
PublicGtfsDepartureRepository: symbol;
|
|
9
10
|
InfoTripScopeHandler: symbol;
|
|
10
11
|
StopTimesTripScopeHandler: symbol;
|
|
11
12
|
ShapesTripScopeHandler: symbol;
|
|
@@ -13,5 +14,6 @@ export declare const OgModuleToken: {
|
|
|
13
14
|
TripScopeHandlerFactory: symbol;
|
|
14
15
|
PublicVehiclePositionsFacade: symbol;
|
|
15
16
|
DetailedTripFacade: symbol;
|
|
17
|
+
DepartureBoardFacade: symbol;
|
|
16
18
|
VPSubscriber: symbol;
|
|
17
19
|
};
|
|
@@ -9,6 +9,7 @@ exports.OgModuleToken = {
|
|
|
9
9
|
PublicVehiclePositionsRepository: Symbol(),
|
|
10
10
|
PublicStopTimeRepository: Symbol(),
|
|
11
11
|
DelayComputationRepository: Symbol(),
|
|
12
|
+
PublicGtfsDepartureRepository: Symbol(),
|
|
12
13
|
InfoTripScopeHandler: Symbol(),
|
|
13
14
|
StopTimesTripScopeHandler: Symbol(),
|
|
14
15
|
ShapesTripScopeHandler: Symbol(),
|
|
@@ -16,6 +17,7 @@ exports.OgModuleToken = {
|
|
|
16
17
|
TripScopeHandlerFactory: Symbol(),
|
|
17
18
|
PublicVehiclePositionsFacade: Symbol(),
|
|
18
19
|
DetailedTripFacade: Symbol(),
|
|
20
|
+
DepartureBoardFacade: Symbol(),
|
|
19
21
|
VPSubscriber: Symbol(),
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=OgModuleToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OgModuleToken.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/OgModuleToken.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,cAAc,EAAE,MAAM,EAAE;IACxB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,iCAAiC,EAAE,MAAM,EAAE;IAC3C,gCAAgC,EAAE,MAAM,EAAE;IAC1C,wBAAwB,EAAE,MAAM,EAAE;IAClC,0BAA0B,EAAE,MAAM,EAAE;IACpC,oBAAoB,EAAE,MAAM,EAAE;IAC9B,yBAAyB,EAAE,MAAM,EAAE;IACnC,sBAAsB,EAAE,MAAM,EAAE;IAChC,iCAAiC,EAAE,MAAM,EAAE;IAC3C,uBAAuB,EAAE,MAAM,EAAE;IACjC,4BAA4B,EAAE,MAAM,EAAE;IACtC,kBAAkB,EAAE,MAAM,EAAE;IAC5B,YAAY,EAAE,MAAM,EAAE;CACzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"OgModuleToken.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/OgModuleToken.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,cAAc,EAAE,MAAM,EAAE;IACxB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,iCAAiC,EAAE,MAAM,EAAE;IAC3C,gCAAgC,EAAE,MAAM,EAAE;IAC1C,wBAAwB,EAAE,MAAM,EAAE;IAClC,0BAA0B,EAAE,MAAM,EAAE;IACpC,6BAA6B,EAAE,MAAM,EAAE;IACvC,oBAAoB,EAAE,MAAM,EAAE;IAC9B,yBAAyB,EAAE,MAAM,EAAE;IACnC,sBAAsB,EAAE,MAAM,EAAE;IAChC,iCAAiC,EAAE,MAAM,EAAE;IAC3C,uBAAuB,EAAE,MAAM,EAAE;IACjC,4BAA4B,EAAE,MAAM,EAAE;IACtC,kBAAkB,EAAE,MAAM,EAAE;IAC5B,oBAAoB,EAAE,MAAM,EAAE;IAC9B,YAAY,EAAE,MAAM,EAAE;CACzB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="express" />
|
|
2
|
+
import { Router } from "@golemio/core/dist/shared/express";
|
|
3
|
+
export declare class PublicDeparturesRouter {
|
|
4
|
+
router: Router;
|
|
5
|
+
private departureController;
|
|
6
|
+
constructor();
|
|
7
|
+
protected initRoutes(expire?: string | number | undefined): void;
|
|
8
|
+
}
|
|
9
|
+
declare const v1PublicDeparturesRouter: Router;
|
|
10
|
+
export { v1PublicDeparturesRouter };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.v1PublicDeparturesRouter = exports.PublicDeparturesRouter = void 0;
|
|
4
|
+
const PublicDepartureBoardsController_1 = require("../../controllers/v1/PublicDepartureBoardsController");
|
|
5
|
+
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
6
|
+
const express_1 = require("@golemio/core/dist/shared/express");
|
|
7
|
+
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
8
|
+
const CustomStopIdGroupValidator_1 = require("./helpers/CustomStopIdGroupValidator");
|
|
9
|
+
const redis_1 = require("@golemio/core/dist/output-gateway/redis");
|
|
10
|
+
class PublicDeparturesRouter {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.router = (0, express_1.Router)();
|
|
13
|
+
this.departureController = new PublicDepartureBoardsController_1.PublicDepartureBoardsController();
|
|
14
|
+
this.initRoutes("5 seconds");
|
|
15
|
+
}
|
|
16
|
+
initRoutes(expire) {
|
|
17
|
+
this.router.get("/", [
|
|
18
|
+
(0, express_validator_1.query)("stopIds").exists().custom(CustomStopIdGroupValidator_1.CustomStopIdGroupValidator.validate),
|
|
19
|
+
(0, express_validator_1.query)("limit").optional().isInt({ min: 1, max: 20 }).not().isArray(),
|
|
20
|
+
(0, express_validator_1.query)("routeShortNames").optional().not().isEmpty({ ignore_whitespace: true }),
|
|
21
|
+
(0, express_validator_1.query)("minutesAfter").optional().isInt({ min: 1, max: 360 }).not().isArray(),
|
|
22
|
+
], Validation_1.checkErrors, (0, redis_1.useCacheMiddleware)(expire), this.departureController.getAll);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.PublicDeparturesRouter = PublicDeparturesRouter;
|
|
26
|
+
const v1PublicDeparturesRouter = new PublicDeparturesRouter().router;
|
|
27
|
+
exports.v1PublicDeparturesRouter = v1PublicDeparturesRouter;
|
|
28
|
+
//# sourceMappingURL=PublicDeparturesRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicDeparturesRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v1/PublicDeparturesRouter.ts"],"names":[],"mappings":";;;AAAA,0GAA4G;AAC5G,6EAA2E;AAC3E,+DAA2D;AAC3D,mFAAoE;AACpE,qFAAkF;AAClF,mEAA6E;AAE7E,MAAa,sBAAsB;IAI/B;QACI,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,IAAI,iEAA+B,EAAE,CAAC;QACjE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAES,UAAU,CAAC,MAAoC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;YACI,IAAA,yBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,uDAA0B,CAAC,QAAQ,CAAC;YACrE,IAAA,yBAAK,EAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YACpE,IAAA,yBAAK,EAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC9E,IAAA,yBAAK,EAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;SAC/E,EACD,wBAAW,EACX,IAAA,0BAAkB,EAAC,MAAM,CAAC,EAC1B,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAClC,CAAC;IACN,CAAC;CACJ;AAxBD,wDAwBC;AAED,MAAM,wBAAwB,GAAG,IAAI,sBAAsB,EAAE,CAAC,MAAM,CAAC;AAC5D,4DAAwB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="express" />
|
|
2
2
|
import { Router } from "@golemio/core/dist/shared/express";
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class PublicVehiclePositionsRouter {
|
|
4
4
|
router: Router;
|
|
5
5
|
private vehiclePositionsController;
|
|
6
6
|
private redisSubscriber;
|
|
7
7
|
constructor();
|
|
8
8
|
protected initRoutes(expire?: string | number | undefined): void;
|
|
9
9
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export {
|
|
10
|
+
declare const v1PublicVPRouter: Router;
|
|
11
|
+
export { v1PublicVPRouter };
|
package/dist/output-gateway/public/routers/v1/{PublicRouter.js → PublicVehiclePositionsRouter.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.v1PublicVPRouter = exports.PublicVehiclePositionsRouter = void 0;
|
|
4
4
|
const PublicVehiclePositionsController_1 = require("../../controllers/v1/PublicVehiclePositionsController");
|
|
5
5
|
const Di_1 = require("../../ioc/Di");
|
|
6
6
|
const OgModuleToken_1 = require("../../ioc/OgModuleToken");
|
|
@@ -9,7 +9,7 @@ const express_1 = require("@golemio/core/dist/shared/express");
|
|
|
9
9
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
10
10
|
const CustomScopeValidator_1 = require("./helpers/CustomScopeValidator");
|
|
11
11
|
const CustomTypeValidator_1 = require("./helpers/CustomTypeValidator");
|
|
12
|
-
class
|
|
12
|
+
class PublicVehiclePositionsRouter {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.router = (0, express_1.Router)();
|
|
15
15
|
this.vehiclePositionsController = new PublicVehiclePositionsController_1.PublicVehiclePositionsController();
|
|
@@ -18,7 +18,7 @@ class PublicRouter {
|
|
|
18
18
|
this.redisSubscriber.initialize();
|
|
19
19
|
}
|
|
20
20
|
initRoutes(expire) {
|
|
21
|
-
this.router.get("/
|
|
21
|
+
this.router.get("/", [
|
|
22
22
|
(0, express_validator_1.query)("boundingBox")
|
|
23
23
|
.optional()
|
|
24
24
|
.matches(/^\d+\.?\d*(,\d+\.?\d*){3}$/) // 50.123,14.243,50.017,14.573
|
|
@@ -27,10 +27,10 @@ class PublicRouter {
|
|
|
27
27
|
(0, express_validator_1.query)("routeShortName").optional().not().isEmpty({ ignore_whitespace: true }),
|
|
28
28
|
(0, express_validator_1.query)("routeType").optional().custom(CustomTypeValidator_1.CustomTypeValidator.validate),
|
|
29
29
|
], Validation_1.checkErrors, this.vehiclePositionsController.getAll);
|
|
30
|
-
this.router.get("
|
|
30
|
+
this.router.get("/:vehicleId", [(0, express_validator_1.param)("vehicleId").exists(), (0, express_validator_1.query)("scopes").custom(CustomScopeValidator_1.CustomScopeValidator.validate)], Validation_1.checkErrors, this.vehiclePositionsController.getOneByVehicleId);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.
|
|
34
|
-
const
|
|
35
|
-
exports.
|
|
36
|
-
//# sourceMappingURL=
|
|
33
|
+
exports.PublicVehiclePositionsRouter = PublicVehiclePositionsRouter;
|
|
34
|
+
const v1PublicVPRouter = new PublicVehiclePositionsRouter().router;
|
|
35
|
+
exports.v1PublicVPRouter = v1PublicVPRouter;
|
|
36
|
+
//# sourceMappingURL=PublicVehiclePositionsRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicVehiclePositionsRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v1/PublicVehiclePositionsRouter.ts"],"names":[],"mappings":";;;AAAA,4GAA8G;AAC9G,qCAAsD;AACtD,2DAA6D;AAE7D,6EAA2E;AAC3E,+DAA2D;AAC3D,mFAA2E;AAC3E,yEAAsE;AACtE,uEAAoE;AAEpE,MAAa,4BAA4B;IAKrC;QACI,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,0BAA0B,GAAG,IAAI,mEAAgC,EAAE,CAAC;QACzE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,sBAAiB,CAAC,OAAO,CAAe,6BAAa,CAAC,YAAY,CAAC,CAAC;QAC3F,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;IAES,UAAU,CAAC,MAAoC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;YACI,IAAA,yBAAK,EAAC,aAAa,CAAC;iBACf,QAAQ,EAAE;iBACV,OAAO,CAAC,4BAA4B,CAAC,CAAC,8BAA8B;iBACpE,GAAG,EAAE;iBACL,OAAO,EAAE;YACd,IAAA,yBAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC7E,IAAA,yBAAK,EAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,yCAAmB,CAAC,QAAQ,CAAC;SACrE,EACD,wBAAW,EACX,IAAI,CAAC,0BAA0B,CAAC,MAAM,CACzC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,aAAa,EACb,CAAC,IAAA,yBAAK,EAAC,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE,IAAA,yBAAK,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,2CAAoB,CAAC,QAAQ,CAAC,CAAC,EACpF,wBAAW,EACX,IAAI,CAAC,0BAA0B,CAAC,iBAAiB,CACpD,CAAC;IACN,CAAC;CACJ;AApCD,oEAoCC;AAED,MAAM,gBAAgB,GAAG,IAAI,4BAA4B,EAAE,CAAC,MAAM,CAAC;AAE1D,4CAAgB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CustomStopIdGroupValidator = void 0;
|
|
5
|
+
class CustomStopIdGroupValidator {
|
|
6
|
+
static isStopIdGroupValid(value) {
|
|
7
|
+
try {
|
|
8
|
+
const parsed = JSON.parse(value);
|
|
9
|
+
const keys = Object.keys(parsed);
|
|
10
|
+
if (keys.length !== 1) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const priority = Number.parseInt(keys[0]);
|
|
14
|
+
if (Number.isNaN(priority)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const stopIds = parsed[priority];
|
|
18
|
+
if (!Array.isArray(stopIds) ||
|
|
19
|
+
stopIds.length === 0 ||
|
|
20
|
+
stopIds.length > 10 ||
|
|
21
|
+
stopIds.some((stopId) => typeof stopId !== "string" || stopId.length === 0 || stopId.length > 30)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CustomStopIdGroupValidator = CustomStopIdGroupValidator;
|
|
32
|
+
_a = CustomStopIdGroupValidator;
|
|
33
|
+
CustomStopIdGroupValidator.validate = (value, _) => {
|
|
34
|
+
if (value instanceof Array) {
|
|
35
|
+
if (value.length === 0 || value.length > 10) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return value.every((v) => _a.isStopIdGroupValid(v));
|
|
39
|
+
}
|
|
40
|
+
return _a.isStopIdGroupValid(value);
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=CustomStopIdGroupValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomStopIdGroupValidator.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/routers/v1/helpers/CustomStopIdGroupValidator.ts"],"names":[],"mappings":";;;;AAEA,MAAa,0BAA0B;IAa3B,MAAM,CAAC,kBAAkB,CAAC,KAAa;QAC3C,IAAI;YACA,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;gBACnB,OAAO,KAAK,CAAC;aAChB;YAED,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;gBACxB,OAAO,KAAK,CAAC;aAChB;YAED,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YACjC,IACI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;gBACvB,OAAO,CAAC,MAAM,KAAK,CAAC;gBACpB,OAAO,CAAC,MAAM,GAAG,EAAE;gBACnB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,EACnG;gBACE,OAAO,KAAK,CAAC;aAChB;YAED,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACV,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;;AAxCL,gEAyCC;;AAxCiB,mCAAQ,GAAoB,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;IACnD,IAAI,KAAK,YAAY,KAAK,EAAE;QACxB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;YACzC,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;KACzD;IAED,OAAO,EAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC,AAVqB,CAUpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IDepartureBoardsStopIdGroups } from "../../controllers/v1/interfaces/PublicParamsInterfaces";
|
|
2
|
+
import { VehicleDescriptorCachedRepository } from "../../data-access/VehicleDescriptorCachedRepository";
|
|
3
|
+
import { PublicApiDepartureBoardGroup } from "../../domain/PublicApiDepartureInterfaces";
|
|
4
|
+
import { IGtfsDepartureRepository } from "../../domain/repository/IGtfsDepartureRepository";
|
|
5
|
+
import { IVehiclePositionsRepository } from "../../domain/repository/IVehiclePositionsRepository";
|
|
6
|
+
export declare class DepartureBoardFacade {
|
|
7
|
+
private readonly departureRepository;
|
|
8
|
+
private readonly tripRepository;
|
|
9
|
+
private readonly descriptorRepository;
|
|
10
|
+
private readonly transformation;
|
|
11
|
+
constructor(departureRepository: IGtfsDepartureRepository, tripRepository: IVehiclePositionsRepository, descriptorRepository: VehicleDescriptorCachedRepository);
|
|
12
|
+
getAll(stopIds: Set<IDepartureBoardsStopIdGroups>, limit: number, routeShortNames: string[] | null, minutesAfter: number): Promise<PublicApiDepartureBoardGroup[]>;
|
|
13
|
+
private duplicateDeparturesWithDifferentVehicleIds;
|
|
14
|
+
private removeDeparturesOutsideTimeRange;
|
|
15
|
+
private sortStopGroupsByPriority;
|
|
16
|
+
private sortDeparturesByPredictedTimestamp;
|
|
17
|
+
}
|