@golemio/pid 4.0.3-dev.1997942620 → 4.0.3-rc.2001599412
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/helpers/GtfsStopParser.d.ts +0 -2
- package/dist/helpers/GtfsStopParser.js +8 -11
- package/dist/helpers/GtfsStopParser.js.map +1 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +1 -0
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
- package/dist/integration-engine/jis/ioc/Di.js +0 -10
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +0 -4
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +0 -5
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +1 -6
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +2 -50
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/workers/JISWorker.js +0 -1
- package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +2 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +4 -5
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.d.ts +1 -5
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +0 -24
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/index.d.ts +0 -1
- package/dist/integration-engine/ropid-gtfs/index.js +0 -1
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +0 -8
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +0 -3
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +0 -3
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +5 -8
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js +0 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +0 -1
- 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/interfaces/TripRepositoryInterfaces.d.ts +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.d.ts +1 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +109 -124
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.d.ts +1 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +85 -100
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +0 -1
- 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/PublicApiTripTransformation.js +0 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
- package/dist/output-gateway/index.js +0 -1
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/jis/ioc/Di.js +2 -2
- package/dist/output-gateway/jis/ioc/Di.js.map +1 -1
- package/dist/output-gateway/jis/ioc/OgJisToken.d.ts +0 -2
- package/dist/output-gateway/jis/ioc/OgJisToken.js +0 -2
- package/dist/output-gateway/jis/ioc/OgJisToken.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
- package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +0 -5
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +1 -4
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +1 -7
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +0 -50
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/ioc/Di.js +6 -64
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
- package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +0 -12
- package/dist/output-gateway/pid/ioc/OgPidToken.js +0 -12
- package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
- package/dist/output-gateway/pid/routers/index.d.ts +0 -1
- package/dist/output-gateway/pid/routers/index.js +1 -3
- package/dist/output-gateway/pid/routers/index.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +2 -7
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +4 -29
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +3 -12
- package/dist/output-gateway/pid/service/facade/StopFacade.js +7 -43
- package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +10 -17
- package/dist/output-gateway/pid/service/facade/TransferFacade.js +16 -161
- package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +1 -7
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +0 -9
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +4 -7
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.d.ts +0 -1
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js +0 -21
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.d.ts +1 -2
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +15 -14
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
- package/dist/output-gateway/public/domain/repository/IGtfsDepartureRepository.d.ts +1 -1
- package/dist/output-gateway/public/ioc/Di.js +1 -1
- package/dist/output-gateway/public/ioc/Di.js.map +1 -1
- package/dist/output-gateway/{shared → public}/service/VPSubscriber.d.ts +2 -4
- package/dist/output-gateway/{shared → public}/service/VPSubscriber.js +1 -1
- package/dist/output-gateway/public/service/VPSubscriber.js.map +1 -0
- package/dist/output-gateway/shared/constants/route-version.d.ts +1 -2
- package/dist/output-gateway/shared/constants/route-version.js +0 -1
- package/dist/output-gateway/shared/constants/route-version.js.map +1 -1
- package/dist/schema-definitions/jis/redis/const.d.ts +0 -1
- package/dist/schema-definitions/jis/redis/const.js +1 -2
- package/dist/schema-definitions/jis/redis/const.js.map +1 -1
- package/dist/schema-definitions/ropid-departures-presets/index.d.ts +0 -1
- package/dist/schema-definitions/ropid-departures-presets/index.js +0 -3
- package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +0 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +0 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.js +1 -2
- package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +2 -3
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +0 -4
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +0 -2
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +0 -8
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +1 -4
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
- package/docs/asyncapi.yaml +0 -45
- package/docs/cache/types/redis.md +2 -82
- package/docs/jis/index.md +5 -15
- package/docs/openapi-input.yaml +2 -13
- package/docs/openapi-output.yaml +4 -326
- package/package.json +2 -2
- package/db/example/redis/gtfsStopsCacheMock.json +0 -8
- package/db/example/redis/jisCacheMock.json +0 -31
- package/db/migrations/postgresql/20250716143052-add-stop-name-to-combined-stop-times.js +0 -53
- package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-down.sql +0 -47
- package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-up.sql +0 -47
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.d.ts +0 -6
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js +0 -11
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js.map +0 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +0 -9
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +0 -86
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +0 -1
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.d.ts +0 -7
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js +0 -37
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js.map +0 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +0 -13
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +0 -47
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.d.ts +0 -18
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js +0 -44
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts +0 -12
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js +0 -44
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.d.ts +0 -12
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +0 -87
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js.map +0 -1
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.d.ts +0 -17
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js +0 -113
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js.map +0 -1
- package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.d.ts +0 -17
- package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js +0 -155
- package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js.map +0 -1
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.d.ts +0 -14
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js +0 -3
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js.map +0 -1
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.d.ts +0 -5
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.js +0 -33
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.js.map +0 -1
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.d.ts +0 -6
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.js +0 -61
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.js.map +0 -1
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.d.ts +0 -16
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js +0 -67
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js.map +0 -1
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts +0 -13
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js +0 -31
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js.map +0 -1
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts +0 -27
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js +0 -77
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map +0 -1
- package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.d.ts +0 -13
- package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js +0 -83
- package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js.map +0 -1
- package/dist/output-gateway/shared/service/VPSubscriber.js.map +0 -1
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.d.ts +0 -17
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js +0 -3
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js.map +0 -1
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.d.ts +0 -3
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js +0 -59
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js.map +0 -1
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +0 -16
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +0 -3
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +0 -1
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +0 -58
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +0 -69
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +0 -1
|
@@ -1,155 +0,0 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.V4TransferBoardsController = void 0;
|
|
19
|
-
const TransferBoardFilter_1 = require("../../helpers/TransferBoardFilter");
|
|
20
|
-
const TransferBoardSorter_1 = require("../../helpers/TransferBoardSorter");
|
|
21
|
-
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
22
|
-
const InfotextFacade_1 = require("../../service/facade/InfotextFacade");
|
|
23
|
-
const StopFacade_1 = require("../../service/facade/StopFacade");
|
|
24
|
-
const TransferFacade_1 = require("../../service/facade/TransferFacade");
|
|
25
|
-
const shared_1 = require("../../../shared");
|
|
26
|
-
const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
|
|
27
|
-
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
28
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
-
const TransferDepartureCacheTransformation_1 = require("../../service/transformations/TransferDepartureCacheTransformation");
|
|
30
|
-
const DepartureCalculator_1 = require("../../../shared/DepartureCalculator");
|
|
31
|
-
const DEFAULT_TRANSFER_BOARDS_LIMIT = 8;
|
|
32
|
-
let V4TransferBoardsController = exports.V4TransferBoardsController = class V4TransferBoardsController {
|
|
33
|
-
constructor(stopFacade, infotextFacade, transferFacade, transformation) {
|
|
34
|
-
this.stopFacade = stopFacade;
|
|
35
|
-
this.infotextFacade = infotextFacade;
|
|
36
|
-
this.transferFacade = transferFacade;
|
|
37
|
-
this.transformation = transformation;
|
|
38
|
-
this.defaultTransferBoardsLimit = DEFAULT_TRANSFER_BOARDS_LIMIT;
|
|
39
|
-
this.getTransferBoardData = async (req, res, next) => {
|
|
40
|
-
const span = (0, trace_provider_1.createChildSpan)("V4TransferBoardsController.getTransferBoardData");
|
|
41
|
-
try {
|
|
42
|
-
const params = this.parseTransferBoardsParams(req.query);
|
|
43
|
-
span?.setAttributes(Object.fromEntries(Object.entries(params).filter(([_, value]) => value !== null)));
|
|
44
|
-
const now = new Date();
|
|
45
|
-
let timeFrom = null;
|
|
46
|
-
if (params.timeFrom !== null) {
|
|
47
|
-
timeFrom = moment_timezone_1.default.tz(params.timeFrom, shared_1.RopidRouterUtils.TIMEZONE).toDate();
|
|
48
|
-
}
|
|
49
|
-
//#region GTFS stops
|
|
50
|
-
let stopIds = [];
|
|
51
|
-
let transferCacheDto = undefined;
|
|
52
|
-
let infotextsToInclude = [];
|
|
53
|
-
try {
|
|
54
|
-
if ("aswId" in params && typeof params.aswId === "string") {
|
|
55
|
-
stopIds = await this.stopFacade.getStopIdsForTransferBoardsByAswId(params.aswId);
|
|
56
|
-
//#region Transfer departures and infotexts
|
|
57
|
-
if (stopIds.length === 0) {
|
|
58
|
-
return res.status(404).json({
|
|
59
|
-
departures: [],
|
|
60
|
-
infotexts: [],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
const [transferCache, infotexts] = await Promise.all([
|
|
65
|
-
this.transferFacade.getTransferCache(stopIds, params.limit, parseInt(params.vehicleRegistrationNumber ?? "0", 10), params.routeType, timeFrom || now),
|
|
66
|
-
this.infotextFacade.getInfotextsCache(stopIds, now, timeFrom),
|
|
67
|
-
]);
|
|
68
|
-
infotextsToInclude = infotexts;
|
|
69
|
-
transferCacheDto = transferCache;
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
span?.recordException(error);
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
76
|
-
}
|
|
77
|
-
else if ("cisId" in params && typeof params.cisId === "number") {
|
|
78
|
-
// add support for trains
|
|
79
|
-
// load stopIds from stopFacade using translation of params.cisId
|
|
80
|
-
return res.status(501).json({ message: "EP is not ready for cisId+tripNumber yet" });
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return res.status(400).json({
|
|
84
|
-
message: "Either an aswId (and no cisId), or a cisId (and no aswId) must be provided",
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
span?.recordException(error);
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
|
-
// add predictedDeparture to transfers
|
|
94
|
-
transferCacheDto.transfers = transferCacheDto.transfers.map((t) => {
|
|
95
|
-
t.departure.predictedDepartureDate = DepartureCalculator_1.DepartureCalculator.getPredictedDepartureTime(new Date(t.departure.departure_datetime), t.departure.arrival_datetime ? new Date(t.departure.arrival_datetime) : null, t.position?.delay ?? null);
|
|
96
|
-
t.departure.predictedDepartureTimestamp = t.departure.predictedDepartureDate.getTime();
|
|
97
|
-
return t;
|
|
98
|
-
});
|
|
99
|
-
TransferBoardSorter_1.TransferBoardSorter.sortDepartures(transferCacheDto.transfers);
|
|
100
|
-
const transformedData = this.transformation.transformArray(transferCacheDto.transfers);
|
|
101
|
-
const filteredData = TransferBoardFilter_1.TransferBoardFilter.filterDepartures(transformedData, params.limit, this.getTimeFrom(transferCacheDto.currentTrip));
|
|
102
|
-
const output = {
|
|
103
|
-
// possibly share arrival_datetime of the current vehicle?
|
|
104
|
-
platform_code: transferCacheDto.currentTrip.stopTime?.platform_code ??
|
|
105
|
-
transferCacheDto.currentTrip.stopTime?.cis_stop_platform_code,
|
|
106
|
-
stop_name: transferCacheDto.currentTrip.stopTime?.stop_name,
|
|
107
|
-
departures: filteredData,
|
|
108
|
-
infotexts: infotextsToInclude,
|
|
109
|
-
icons: [],
|
|
110
|
-
};
|
|
111
|
-
return res.status(200).json(output);
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
next(err);
|
|
115
|
-
}
|
|
116
|
-
finally {
|
|
117
|
-
span?.end();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
parseTransferBoardsParams(query) {
|
|
122
|
-
return {
|
|
123
|
-
aswId: (query.aswId ?? null),
|
|
124
|
-
cisId: (query.cisId ?? null),
|
|
125
|
-
tripNumber: (query.tripNumber ?? null),
|
|
126
|
-
vehicleRegistrationNumber: (query.vehicleRegistrationNumber ?? null),
|
|
127
|
-
routeType: query.routeType,
|
|
128
|
-
timeFrom: (query.timeFrom ?? null),
|
|
129
|
-
limit: (query.limit ?? this.defaultTransferBoardsLimit),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
getTimeFrom({ departure, position }) {
|
|
133
|
-
if (!departure?.arrival_datetime || !position) {
|
|
134
|
-
return new Date().getTime();
|
|
135
|
-
}
|
|
136
|
-
const arrivalDate = new Date(departure.arrival_datetime);
|
|
137
|
-
if (!position.delay) {
|
|
138
|
-
return arrivalDate.getTime();
|
|
139
|
-
}
|
|
140
|
-
arrivalDate.setSeconds(arrivalDate.getSeconds() + position.delay);
|
|
141
|
-
return arrivalDate.getTime();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
exports.V4TransferBoardsController = V4TransferBoardsController = __decorate([
|
|
145
|
-
(0, tsyringe_1.injectable)(),
|
|
146
|
-
__param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.StopFacade)),
|
|
147
|
-
__param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.InfotextFacade)),
|
|
148
|
-
__param(2, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferFacade)),
|
|
149
|
-
__param(3, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferDepartureCacheTransformation)),
|
|
150
|
-
__metadata("design:paramtypes", [StopFacade_1.StopFacade,
|
|
151
|
-
InfotextFacade_1.InfotextFacade,
|
|
152
|
-
TransferFacade_1.TransferFacade,
|
|
153
|
-
TransferDepartureCacheTransformation_1.TransferDepartureCacheTransformation])
|
|
154
|
-
], V4TransferBoardsController);
|
|
155
|
-
//# sourceMappingURL=V4TransferBoardsController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"V4TransferBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/controllers/v4/V4TransferBoardsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2EAA0E;AAC1E,2EAA0E;AAC1E,qDAAoD;AACpD,wEAAuE;AACvE,gEAA+D;AAC/D,wEAAuE;AACvE,4CAA8C;AAC9C,+FAA6F;AAE7F,gGAA+D;AAE/D,iEAAwE;AAExE,6HAA4H;AAC5H,6EAAqE;AAErE,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAGjC,IAAM,0BAA0B,wCAAhC,MAAM,0BAA0B;IAGnC,YACmC,UAA8B,EAC1B,cAAsC,EACtC,cAAsC,EAChB,cAA4D;QAH9E,eAAU,GAAV,UAAU,CAAY;QAClB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,mBAAc,GAAd,cAAc,CAAgB;QACR,mBAAc,GAAd,c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AC7B,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,cAAc,CAAC,CAAA;IACjC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,cAAc,CAAC,CAAA;IACjC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,oCAAoC,CAAC,CAAA;qCAHL,uBAAU;QACF,+BAAc;QACd,+BAAc;QACQ,2EAAoC;GAPhH,0BAA0B,CAqItC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ITransferBoardsBasic {
|
|
2
|
-
timeFrom: string | null;
|
|
3
|
-
limit: number;
|
|
4
|
-
}
|
|
5
|
-
export interface ITransferBoardsAswIdBased extends ITransferBoardsBasic {
|
|
6
|
-
aswId: string | null;
|
|
7
|
-
vehicleRegistrationNumber: string | null;
|
|
8
|
-
routeType: number;
|
|
9
|
-
}
|
|
10
|
-
export interface ITransferBoardsCisIdBased extends ITransferBoardsBasic {
|
|
11
|
-
cisId: number | null;
|
|
12
|
-
tripNumber: number | null;
|
|
13
|
-
}
|
|
14
|
-
export type ITransferBoardsParams = ITransferBoardsAswIdBased | ITransferBoardsCisIdBased;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ITransferBoardsParams.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransferBoardFilter = void 0;
|
|
4
|
-
class TransferBoardFilter {
|
|
5
|
-
static filterDepartures(transfers, limit, timeFrom) {
|
|
6
|
-
const filteredDepartures = [];
|
|
7
|
-
for (const transfer of transfers) {
|
|
8
|
-
if (filteredDepartures.length === limit) {
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
if (!this.isInRange(transfer, timeFrom)) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
filteredDepartures.push(transfer);
|
|
15
|
-
}
|
|
16
|
-
// Departures are already sorted so that metro ones are first
|
|
17
|
-
return filteredDepartures;
|
|
18
|
-
}
|
|
19
|
-
static isInRange(departure, timeFrom) {
|
|
20
|
-
const timeRangeStart = timeFrom;
|
|
21
|
-
// add one hour
|
|
22
|
-
const timeRangeEnd = timeFrom + 60 * 60 * 1000;
|
|
23
|
-
const departureMinutes = departure.departure_timestamp.minutes[0] === "<1" ? 1 : Number(departure.departure_timestamp.minutes[0]);
|
|
24
|
-
if (isNaN(departureMinutes))
|
|
25
|
-
return false;
|
|
26
|
-
// Calculate the departure time
|
|
27
|
-
const departureTime = timeRangeStart + departureMinutes * 60 * 1000;
|
|
28
|
-
// Check if departureTime is within the range
|
|
29
|
-
return departureTime >= timeRangeStart && departureTime <= timeRangeEnd;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.TransferBoardFilter = TransferBoardFilter;
|
|
33
|
-
//# sourceMappingURL=TransferBoardFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransferBoardFilter.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/helpers/TransferBoardFilter.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IACrB,MAAM,CAAC,gBAAgB,CAC1B,SAA0C,EAC1C,KAAa,EACb,QAAgB;QAEhB,MAAM,kBAAkB,GAAoC,EAAE,CAAC;QAE/D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAC9B,IAAI,kBAAkB,CAAC,MAAM,KAAK,KAAK,EAAE;gBACrC,MAAM;aACT;YACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;gBACrC,SAAS;aACZ;YACD,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACrC;QAED,6DAA6D;QAC7D,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IACO,MAAM,CAAC,SAAS,CAAC,SAAwC,EAAE,QAAgB;QAC/E,MAAM,cAAc,GAAG,QAAQ,CAAC;QAChC,eAAe;QACf,MAAM,YAAY,GAAG,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAE/C,MAAM,gBAAgB,GAClB,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7G,IAAI,KAAK,CAAC,gBAAgB,CAAC;YAAE,OAAO,KAAK,CAAC;QAE1C,+BAA+B;QAC/B,MAAM,aAAa,GAAG,cAAc,GAAG,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;QAEpE,6CAA6C;QAC7C,OAAO,aAAa,IAAI,cAAc,IAAI,aAAa,IAAI,YAAY,CAAC;IAC5E,CAAC;CACJ;AApCD,kDAoCC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.TransferBoardSorter = void 0;
|
|
5
|
-
const RouteTypeEnums_1 = require("../../../helpers/RouteTypeEnums");
|
|
6
|
-
class TransferBoardSorter {
|
|
7
|
-
static sortDepartures(departures) {
|
|
8
|
-
departures.sort((a, b) => {
|
|
9
|
-
for (const compareFn of this.compareFnPipeline) {
|
|
10
|
-
const res = compareFn(a, b);
|
|
11
|
-
if (res !== 0)
|
|
12
|
-
return res;
|
|
13
|
-
}
|
|
14
|
-
return 0;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.TransferBoardSorter = TransferBoardSorter;
|
|
19
|
-
_a = TransferBoardSorter;
|
|
20
|
-
TransferBoardSorter.compareFns = {
|
|
21
|
-
metroFirst: (a, b) => {
|
|
22
|
-
const aIsMetro = a.departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|
|
23
|
-
const bIsMetro = b.departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|
|
24
|
-
if (aIsMetro !== bIsMetro)
|
|
25
|
-
return aIsMetro ? -1 : 1;
|
|
26
|
-
return 0;
|
|
27
|
-
},
|
|
28
|
-
metroNameAsc: (a, b) => {
|
|
29
|
-
const aIsMetro = a.departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|
|
30
|
-
const bIsMetro = b.departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|
|
31
|
-
if (aIsMetro && bIsMetro && a.departure.route_short_name !== null && b.departure.route_short_name !== null)
|
|
32
|
-
return a.departure.route_short_name.localeCompare(b.departure.route_short_name);
|
|
33
|
-
return 0;
|
|
34
|
-
},
|
|
35
|
-
departureTimeAsc: (a, b) => {
|
|
36
|
-
const aTimestamp = a.departure.predictedDepartureTimestamp;
|
|
37
|
-
const bTimestamp = b.departure.predictedDepartureTimestamp;
|
|
38
|
-
if (aTimestamp && bTimestamp) {
|
|
39
|
-
return aTimestamp - bTimestamp;
|
|
40
|
-
}
|
|
41
|
-
if (!aTimestamp && !bTimestamp)
|
|
42
|
-
return 0;
|
|
43
|
-
if (!bTimestamp)
|
|
44
|
-
return -1;
|
|
45
|
-
return 1;
|
|
46
|
-
},
|
|
47
|
-
directionIdAsc: (a, b) => {
|
|
48
|
-
const aDirectionId = a.position?.detailed_info.direction_id;
|
|
49
|
-
const bDirectionId = b.position?.detailed_info.direction_id;
|
|
50
|
-
if (aDirectionId !== bDirectionId)
|
|
51
|
-
return aDirectionId ? -1 : 1;
|
|
52
|
-
return 0;
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
TransferBoardSorter.compareFnPipeline = [
|
|
56
|
-
_a.compareFns.metroFirst,
|
|
57
|
-
_a.compareFns.metroNameAsc,
|
|
58
|
-
_a.compareFns.departureTimeAsc,
|
|
59
|
-
_a.compareFns.directionIdAsc,
|
|
60
|
-
];
|
|
61
|
-
//# sourceMappingURL=TransferBoardSorter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransferBoardSorter.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/helpers/TransferBoardSorter.ts"],"names":[],"mappings":";;;;AAAA,oEAA4D;AAG5D,MAAa,mBAAmB;IACrB,MAAM,CAAC,cAAc,CAAC,UAAoC;QAC7D,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAC5C,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC5B,IAAI,GAAG,KAAK,CAAC;oBAAE,OAAO,GAAG,CAAC;aAC7B;YACD,OAAO,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;IACP,CAAC;;AATL,kDAiDC;;AAtC2B,8BAAU,GAAqF;IACnH,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,CAAC;QACpE,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,CAAC;QACpE,IAAI,QAAQ,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO,CAAC,CAAC;IACb,CAAC;IACD,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACnB,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,CAAC;QACpE,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,UAAU,KAAK,kCAAiB,C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AAU,CAAC,cAAc;CACjC,AALwC,CAKvC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="express" />
|
|
2
|
-
import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
|
|
3
|
-
import { Router } from "@golemio/core/dist/shared/express";
|
|
4
|
-
export declare class V4PIDRouter extends AbstractRouter {
|
|
5
|
-
readonly router: Router;
|
|
6
|
-
private readonly cacheHeaderMiddleware;
|
|
7
|
-
private readonly transferBoardsController;
|
|
8
|
-
private readonly GtfsStopsSubscriber;
|
|
9
|
-
private readonly VPSubscriber;
|
|
10
|
-
private readonly JisInotextsSubscriber;
|
|
11
|
-
constructor();
|
|
12
|
-
protected initRoutes: () => void;
|
|
13
|
-
private registerTransferBoardsRoutes;
|
|
14
|
-
}
|
|
15
|
-
declare const v4PidRouter: AbstractRouter;
|
|
16
|
-
export { v4PidRouter };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.v4PidRouter = exports.V4PIDRouter = void 0;
|
|
4
|
-
const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
|
|
5
|
-
const ParamValidatorManager_1 = require("../../helpers/ParamValidatorManager");
|
|
6
|
-
const Di_1 = require("../../ioc/Di");
|
|
7
|
-
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
8
|
-
const constants_1 = require("../../../shared/constants");
|
|
9
|
-
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
|
|
10
|
-
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
11
|
-
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
12
|
-
const express_1 = require("@golemio/core/dist/shared/express");
|
|
13
|
-
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
14
|
-
const const_1 = require("../../../../const");
|
|
15
|
-
class V4PIDRouter extends AbstractRouter_1.AbstractRouter {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(constants_1.RouteVersion.v4, "pid");
|
|
18
|
-
this.router = (0, express_1.Router)();
|
|
19
|
-
this.initRoutes = () => {
|
|
20
|
-
this.registerTransferBoardsRoutes();
|
|
21
|
-
};
|
|
22
|
-
this.registerTransferBoardsRoutes = () => {
|
|
23
|
-
const transferBoardsValidation = [
|
|
24
|
-
(0, express_validator_1.query)("aswId").optional().custom(ParamValidatorManager_1.ParamValidatorManager.getAswIdsValidator()).not().isArray(),
|
|
25
|
-
(0, express_validator_1.query)("cisId").optional().isInt({ min: const_1.PG_INT_MIN, max: const_1.PG_INT_MAX }).toInt(10).not().isArray(),
|
|
26
|
-
(0, express_validator_1.oneOf)([
|
|
27
|
-
[
|
|
28
|
-
(0, express_validator_1.query)("aswId").exists(),
|
|
29
|
-
(0, express_validator_1.query)("vehicleRegistrationNumber").exists(),
|
|
30
|
-
(0, express_validator_1.query)("tripNumber").not().exists(),
|
|
31
|
-
(0, express_validator_1.query)("cisId").not().exists(),
|
|
32
|
-
],
|
|
33
|
-
[
|
|
34
|
-
(0, express_validator_1.query)("cisId").exists(),
|
|
35
|
-
(0, express_validator_1.query)("tripNumber").exists(),
|
|
36
|
-
(0, express_validator_1.query)("aswId").not().exists(),
|
|
37
|
-
(0, express_validator_1.query)("vehicleRegistrationNumber").not().exists(),
|
|
38
|
-
],
|
|
39
|
-
], {
|
|
40
|
-
message: "Either an aswId+vehicleRegistrationNumber (and no cisId+tripNumber), " +
|
|
41
|
-
"or a cisId+tripNumber (and aswId+vehicleRegistrationNumber) must be provided",
|
|
42
|
-
}),
|
|
43
|
-
(0, express_validator_1.query)("tripNumber").optional().isInt({ min: 0 }).toInt(10).not().isArray(),
|
|
44
|
-
(0, express_validator_1.query)("vehicleRegistrationNumber").optional().not().isEmpty({ ignore_whitespace: true }).not().isArray(),
|
|
45
|
-
(0, express_validator_1.query)("routeType").exists().isInt().isIn(Object.values(RouteTypeEnums_1.GTFSRouteTypeEnum)).toInt(10).not().isArray(),
|
|
46
|
-
(0, express_validator_1.query)("timeFrom").optional().isISO8601().custom(ParamValidatorManager_1.ParamValidatorManager.getTimeFromValidator()).not().isArray(),
|
|
47
|
-
(0, express_validator_1.query)("limit").optional().isInt({ min: 0 }).toInt(10).not().isArray(),
|
|
48
|
-
];
|
|
49
|
-
this.router.get("/transferboards", transferBoardsValidation, Validation_1.checkErrors,
|
|
50
|
-
// max-age 5 seconds, stale-while-revalidate 5 seconds
|
|
51
|
-
this.cacheHeaderMiddleware.getMiddleware(5, 5), this.transferBoardsController.getTransferBoardData);
|
|
52
|
-
};
|
|
53
|
-
this.cacheHeaderMiddleware = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
|
|
54
|
-
this.transferBoardsController = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.V4TransferBoardsController);
|
|
55
|
-
this.GtfsStopsSubscriber = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.GtfsStopsSubscriber);
|
|
56
|
-
this.GtfsStopsSubscriber.initialize();
|
|
57
|
-
this.JisInotextsSubscriber = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.JisInotextsSubscriber);
|
|
58
|
-
this.JisInotextsSubscriber.initialize();
|
|
59
|
-
this.VPSubscriber = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.VPSubscriber);
|
|
60
|
-
this.VPSubscriber.initialize();
|
|
61
|
-
this.initRoutes();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.V4PIDRouter = V4PIDRouter;
|
|
65
|
-
const v4PidRouter = new V4PIDRouter();
|
|
66
|
-
exports.v4PidRouter = v4PidRouter;
|
|
67
|
-
//# sourceMappingURL=V4PIDRouter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"V4PIDRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/routers/v4/V4PIDRouter.ts"],"names":[],"mappings":";;;A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YACtD,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,CACrD,CAAC;QACN,CAAC,CAAC;QAvDE,IAAI,CAAC,qBAAqB,GAAG,4BAAsB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACzH,IAAI,CAAC,wBAAwB,GAAG,mBAAc,CAAC,OAAO,CAA6B,uBAAU,CAAC,0BAA0B,CAAC,CAAC;QAC1H,IAAI,CAAC,mBAAmB,GAAG,mBAAc,CAAC,OAAO,CAAe,uBAAU,CAAC,mBAAmB,CAAC,CAAC;QAChG,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,CAAC,qBAAqB,GAAG,mBAAc,CAAC,OAAO,CAAe,uBAAU,CAAC,qBAAqB,CAAC,CAAC;QACpG,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,mBAAc,CAAC,OAAO,CAAe,uBAAU,CAAC,YAAY,CAAC,CAAC;QAClF,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CA+CJ;AAlED,kCAkEC;AAED,MAAM,WAAW,GAAmB,IAAI,WAAW,EAAE,CAAC;AAC7C,kCAAW"}
|
package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IV4InfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
|
|
2
|
-
import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
|
|
3
|
-
import { IJISInfotextDto } from "../../../../schema-definitions/jis/redis/interfaces/IJISInfotextDto";
|
|
4
|
-
export declare class JISInfotextCacheTransferTransformation extends AbstractTransformation<IJISInfotextDto, IV4InfotextTransferOutputDto> {
|
|
5
|
-
name: string;
|
|
6
|
-
protected transformInternal: (infotext: IJISInfotextDto) => {
|
|
7
|
-
display_type: import("../../domain/InfotextDisplayTypeEnum").InfotextDisplayType;
|
|
8
|
-
text: {
|
|
9
|
-
cs: string;
|
|
10
|
-
en: string | null;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}
|
package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.JISInfotextCacheTransferTransformation = void 0;
|
|
10
|
-
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
|
|
11
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
12
|
-
const DisplayTypeMapper_1 = require("../helpers/DisplayTypeMapper");
|
|
13
|
-
let JISInfotextCacheTransferTransformation = exports.JISInfotextCacheTransferTransformation = class JISInfotextCacheTransferTransformation extends AbstractTransformation_1.AbstractTransformation {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.name = "JISInfotextCacheTransferTransformation";
|
|
17
|
-
this.transformInternal = (infotext) => {
|
|
18
|
-
return {
|
|
19
|
-
display_type: DisplayTypeMapper_1.DisplayTypeMapper.mapInputToOutputDisplayType(infotext.display_type),
|
|
20
|
-
text: {
|
|
21
|
-
cs: infotext.description_text.cs,
|
|
22
|
-
en: infotext.description_text.en ?? null,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.JISInfotextCacheTransferTransformation = JISInfotextCacheTransferTransformation = __decorate([
|
|
29
|
-
(0, tsyringe_1.injectable)()
|
|
30
|
-
], JISInfotextCacheTransferTransformation);
|
|
31
|
-
//# sourceMappingURL=JISInfotextCacheTransferTransformation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextCacheTransferTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,oEAAiE;AAI1D,IAAM,sCAAsC,oDAA5C,MAAM,sCAAuC,SAAQ,+CAG3D;IAHM;;QAII,SAAI,GAAG,wCAAwC,CAAC;QAE7C,sBAAiB,GAAG,CAAC,QAAyB,EAAE,EAAE;YACxD,OAAO;gBACH,YAAY,EAAE,qCAAiB,CAAC,2BAA2B,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAClF,IAAI,EAAE;oBACF,EAAE,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;oBAChC,EAAE,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,IAAI;iBAC3C;aACJ,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;iDAfY,sCAAsC;IADlD,IAAA,qBAAU,GAAE;GACA,sCAAsC,CAelD"}
|
package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IDepartureWithPosition, IV4TransferDepartureOutputDto } from "../..";
|
|
2
|
-
import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
|
|
3
|
-
import { GTFSRouteTypeEnum } from "../../../../helpers/RouteTypeEnums";
|
|
4
|
-
export declare class TransferDepartureCacheTransformation extends AbstractTransformation<IDepartureWithPosition, IV4TransferDepartureOutputDto> {
|
|
5
|
-
name: string;
|
|
6
|
-
transformArray: (data: IDepartureWithPosition[]) => IV4TransferDepartureOutputDto[];
|
|
7
|
-
protected transformInternal: (data: IDepartureWithPosition) => {
|
|
8
|
-
departure_timestamp: {
|
|
9
|
-
minutes: string[];
|
|
10
|
-
};
|
|
11
|
-
route: {
|
|
12
|
-
short_name: string;
|
|
13
|
-
type: GTFSRouteTypeEnum;
|
|
14
|
-
};
|
|
15
|
-
stop: {
|
|
16
|
-
platform_code: string | null;
|
|
17
|
-
};
|
|
18
|
-
trip: {
|
|
19
|
-
headsign: string;
|
|
20
|
-
id: string;
|
|
21
|
-
is_wheelchair_accessible: boolean | null;
|
|
22
|
-
};
|
|
23
|
-
icons: never[];
|
|
24
|
-
substitution_text: null;
|
|
25
|
-
};
|
|
26
|
-
private calculateDepartureMinutes;
|
|
27
|
-
}
|
package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TransferDepartureCacheTransformation = void 0;
|
|
10
|
-
const DepartureCalculator_1 = require("../../../shared/DepartureCalculator");
|
|
11
|
-
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
|
|
12
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
13
|
-
const PlatformCodeResolver_1 = require("../helpers/PlatformCodeResolver");
|
|
14
|
-
const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
|
|
15
|
-
let TransferDepartureCacheTransformation = exports.TransferDepartureCacheTransformation = class TransferDepartureCacheTransformation extends AbstractTransformation_1.AbstractTransformation {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.name = "TransferDepartureCacheTransformation";
|
|
19
|
-
this.transformArray = (data) => {
|
|
20
|
-
const departures = new Map();
|
|
21
|
-
const res = [];
|
|
22
|
-
for (const { departure, position, stopTime } of data) {
|
|
23
|
-
if (departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO) {
|
|
24
|
-
const departureRouteIdentifier = `${departure.route_short_name}-${departure.stop_id}`;
|
|
25
|
-
const dep = departures.get(departureRouteIdentifier);
|
|
26
|
-
if (dep) {
|
|
27
|
-
if (dep.departure_timestamp.minutes.length >= 2) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
dep.departure_timestamp.minutes.push(this.calculateDepartureMinutes(departure.predictedDepartureDate));
|
|
31
|
-
departures.set(departureRouteIdentifier, dep);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
departures.set(departureRouteIdentifier, this.transformInternal({ departure, position, stopTime }));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
res.push(this.transformInternal({ departure, position, stopTime }));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return [...Array.from(departures.values()), ...res];
|
|
42
|
-
};
|
|
43
|
-
this.transformInternal = (data) => {
|
|
44
|
-
const { departure, position } = data;
|
|
45
|
-
return {
|
|
46
|
-
departure_timestamp: {
|
|
47
|
-
minutes: [this.calculateDepartureMinutes(departure.predictedDepartureDate)],
|
|
48
|
-
},
|
|
49
|
-
route: {
|
|
50
|
-
short_name: departure.route_short_name,
|
|
51
|
-
type: departure.route_type,
|
|
52
|
-
},
|
|
53
|
-
stop: {
|
|
54
|
-
platform_code: PlatformCodeResolver_1.PlatformCodeResolver.determinePlatformCode(data),
|
|
55
|
-
},
|
|
56
|
-
trip: {
|
|
57
|
-
headsign: departure.trip_headsign,
|
|
58
|
-
id: departure.trip_id,
|
|
59
|
-
is_wheelchair_accessible: position?.detailed_info.is_wheelchair_accessible ?? null,
|
|
60
|
-
},
|
|
61
|
-
icons: [],
|
|
62
|
-
substitution_text: null,
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
calculateDepartureMinutes(departureTime) {
|
|
67
|
-
const departure_minutes = DepartureCalculator_1.DepartureCalculator.getDepartureMinutes(departureTime);
|
|
68
|
-
if (departure_minutes < 1 && departure_minutes >= 0) {
|
|
69
|
-
return "<1";
|
|
70
|
-
}
|
|
71
|
-
return departure_minutes.toString();
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
exports.TransferDepartureCacheTransformation = TransferDepartureCacheTransformation = __decorate([
|
|
75
|
-
(0, tsyringe_1.injectable)()
|
|
76
|
-
], TransferDepartureCacheTransformation);
|
|
77
|
-
//# sourceMappingURL=TransferDepartureCacheTransformation.js.map
|
package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransferDepartureCacheTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6EAAqE;AACrE,6GAA0G;AAC1G,iEAAgE;AAChE,0EAAuE;AACvE,uEAA4D;AAGrD,IAAM,oCAAoC,kDAA1C,MAAM,oCAAqC,SAAQ,+CAGzD;IAHM;;Q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AA4B,EAAE,EAAE;YAC3D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;YACrC,OAAO;gBACH,mBAAmB,EAAE;oBACjB,OAAO,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,sBAA8B,CAAC,CAAC;iBACtF;gBACD,KAAK,EAAE;oBACH,UAAU,EAAE,SAAS,CAAC,gBAAgB;oBACtC,IAAI,EAAE,SAAS,CAAC,UAAU;iBAC7B;gBACD,IAAI,EAAE;oBACF,aAAa,EAAE,2CAAoB,CAAC,qBAAqB,CAAC,IAAI,CAAC;iBAClE;gBACD,IAAI,EAAE;oBACF,QAAQ,EAAE,SAAS,CAAC,aAAa;oBACjC,EAAE,EAAE,SAAS,CAAC,OAAO;oBACrB,wBAAwB,EAAE,QAAQ,EAAE,aAAa,CAAC,wBAAwB,IAAI,IAAI;iBACrF;gBACD,KAAK,EAAE,EAAE;gBACT,iBAAiB,EAAE,IAAI;aAC1B,CAAC;QACN,CAAC,CAAC;IAUN,CAAC;IARW,yBAAyB,CAAC,aAAmB;QACjD,MAAM,iBAAiB,GAAG,yCAAmB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACjF,IAAI,iBAAiB,GAAG,CAAC,IAAI,iBAAiB,IAAI,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACf;QAED,OAAO,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IACxC,CAAC;CACJ,CAAA;+CAhEY,oCAAoC;IADhD,IAAA,qBAAU,GAAE;GACA,oCAAoC,CAgEhD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RepositoryWithSubscriber } from "../../../shared/service/VPSubscriber";
|
|
2
|
-
import { IoRedisConnector } from "@golemio/core/dist/helpers/data-access/redis/IoRedisConnector";
|
|
3
|
-
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
4
|
-
export declare class GtfsStopsRedisRepository implements RepositoryWithSubscriber {
|
|
5
|
-
private redisConnector;
|
|
6
|
-
private log;
|
|
7
|
-
private setName;
|
|
8
|
-
constructor(redisConnector: IoRedisConnector, log: ILogger);
|
|
9
|
-
private checkSetNameAndConnection;
|
|
10
|
-
setCurrentSetName(name: string): void;
|
|
11
|
-
getAswNodeIdFromCisId(cisId: string): Promise<string | null>;
|
|
12
|
-
getGtfsStopIdsByAswNode(aswNodeId: string): Promise<string[]>;
|
|
13
|
-
}
|