@golemio/pid 4.0.2-dev.1981729168 → 4.0.2-dev.1982076656
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/db/example/redis/gtfsStopsCacheMock.json +8 -0
- package/db/example/redis/jisCacheMock.json +31 -0
- package/db/migrations/postgresql/20250716143052-add-stop-name-to-combined-stop-times.js +53 -0
- package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-down.sql +47 -0
- package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-up.sql +47 -0
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.d.ts +6 -0
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js +11 -0
- package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js.map +1 -0
- package/dist/integration-engine/jis/ioc/Di.js +2 -0
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +2 -2
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +9 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +1 -1
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.d.ts +7 -0
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js +37 -0
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js.map +1 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +3 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +8 -3
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +5 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +1 -0
- 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 +2 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +1 -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/PublicApiTripTransformation.js +2 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
- package/dist/output-gateway/index.js +1 -0
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.d.ts +17 -0
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js +113 -0
- package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js.map +1 -0
- 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 +2 -0
- package/dist/output-gateway/jis/ioc/OgJisToken.js +2 -0
- 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/controllers/v4/V4TransferBoardsController.d.ts +17 -0
- package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js +147 -0
- package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js.map +1 -0
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.d.ts +14 -0
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js +3 -0
- package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js.map +1 -0
- package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +4 -1
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +7 -1
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.d.ts +5 -0
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.js +33 -0
- package/dist/output-gateway/pid/helpers/TransferBoardFilter.js.map +1 -0
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.d.ts +6 -0
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.js +65 -0
- package/dist/output-gateway/pid/helpers/TransferBoardSorter.js.map +1 -0
- package/dist/output-gateway/pid/index.d.ts +47 -0
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/ioc/Di.js +62 -6
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
- package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +11 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js +11 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
- package/dist/output-gateway/pid/routers/index.d.ts +1 -0
- package/dist/output-gateway/pid/routers/index.js +3 -1
- package/dist/output-gateway/pid/routers/index.js.map +1 -1
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.d.ts +16 -0
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js +67 -0
- package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js.map +1 -0
- package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +7 -2
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +29 -4
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +12 -3
- package/dist/output-gateway/pid/service/facade/StopFacade.js +43 -7
- package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +11 -9
- package/dist/output-gateway/pid/service/facade/TransferFacade.js +117 -14
- package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +7 -1
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +12 -0
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -1
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts +13 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js +31 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js.map +1 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts +27 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js +75 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +4 -4
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +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/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.d.ts +13 -0
- package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js +83 -0
- package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js.map +1 -0
- package/dist/output-gateway/shared/constants/route-version.d.ts +2 -1
- package/dist/output-gateway/shared/constants/route-version.js +1 -0
- package/dist/output-gateway/shared/constants/route-version.js.map +1 -1
- package/dist/output-gateway/{public → shared}/service/VPSubscriber.d.ts +4 -2
- package/dist/output-gateway/{public → shared}/service/VPSubscriber.js +1 -1
- package/dist/output-gateway/shared/service/VPSubscriber.js.map +1 -0
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.d.ts +17 -0
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js +3 -0
- package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js.map +1 -0
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.d.ts +3 -0
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js +59 -0
- package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +3 -2
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +4 -0
- 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 +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +2 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +8 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +4 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
- package/docs/cache/types/redis.md +2 -2
- package/docs/openapi-output.yaml +326 -4
- package/package.json +1 -1
- package/dist/output-gateway/public/service/VPSubscriber.js.map +0 -1
|
@@ -13,18 +13,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.StopFacade = void 0;
|
|
16
|
+
const GtfsStopParser_1 = require("../../../../helpers/GtfsStopParser");
|
|
16
17
|
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
17
|
-
const CisStopGroupRepository_1 = require("../../../ropid-gtfs/data-access/CisStopGroupRepository");
|
|
18
18
|
const models_1 = require("../../../ropid-gtfs/models");
|
|
19
|
-
const
|
|
19
|
+
const CisStopGroupRepository_1 = require("../../../ropid-gtfs/data-access/CisStopGroupRepository");
|
|
20
|
+
const GtfsStopsRedisRepository_1 = require("../../../ropid-gtfs/data-access/redis/GtfsStopsRedisRepository");
|
|
20
21
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
21
23
|
let StopFacade = exports.StopFacade = class StopFacade {
|
|
22
|
-
constructor(cisStopGroupsRepository) {
|
|
24
|
+
constructor(cisStopGroupsRepository, gtfsStopsRedisRepository) {
|
|
23
25
|
this.cisStopGroupsRepository = cisStopGroupsRepository;
|
|
26
|
+
this.gtfsStopsRedisRepository = gtfsStopsRedisRepository;
|
|
27
|
+
this.gtfsStopParser = new GtfsStopParser_1.GtfsStopParser();
|
|
24
28
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
|
|
27
|
-
*/
|
|
28
29
|
async getStopIdsForTransferBoards(cisId) {
|
|
29
30
|
//#region CIS stop node
|
|
30
31
|
let aswNode;
|
|
@@ -56,10 +57,45 @@ let StopFacade = exports.StopFacade = class StopFacade {
|
|
|
56
57
|
//#endregion
|
|
57
58
|
return stopIds;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Retrieve ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
|
|
62
|
+
*/
|
|
63
|
+
async getStopIdsForTransferBoardsByCisId(cisId) {
|
|
64
|
+
try {
|
|
65
|
+
const aswNodeId = await this.gtfsStopsRedisRepository.getAswNodeIdFromCisId(cisId);
|
|
66
|
+
if (aswNodeId === null) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return await this.getStopIdsForTransferBoardsByAswNode(aswNodeId);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError)
|
|
73
|
+
throw error;
|
|
74
|
+
throw new golemio_errors_1.GeneralError("Failed to retrieve CIS stop node", this.constructor.name, error, 500);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve ASW node ID for given ASW stop ID and then returns GTFS stop IDs for this ASW node
|
|
79
|
+
*/
|
|
80
|
+
async getStopIdsForTransferBoardsByAswId(aswId) {
|
|
81
|
+
return await this.getStopIdsForTransferBoardsByAswNode(this.gtfsStopParser.getAswNodeFromId(aswId));
|
|
82
|
+
}
|
|
83
|
+
async getStopIdsForTransferBoardsByAswNode(aswNodeId) {
|
|
84
|
+
try {
|
|
85
|
+
return await this.gtfsStopsRedisRepository.getGtfsStopIdsByAswNode(aswNodeId);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError)
|
|
89
|
+
throw error;
|
|
90
|
+
throw new golemio_errors_1.GeneralError("Failed to retrieve GTFS stops", this.constructor.name, error, 500);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
59
93
|
};
|
|
60
94
|
exports.StopFacade = StopFacade = __decorate([
|
|
61
95
|
(0, tsyringe_1.injectable)(),
|
|
62
96
|
__param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.CisStopGroupRepository)),
|
|
63
|
-
|
|
97
|
+
__param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.GtfsStopsRedisRepository)),
|
|
98
|
+
__metadata("design:paramtypes", [CisStopGroupRepository_1.CisStopGroupRepository,
|
|
99
|
+
GtfsStopsRedisRepository_1.GtfsStopsRedisRepository])
|
|
64
100
|
], StopFacade);
|
|
65
101
|
//# sourceMappingURL=StopFacade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StopFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/StopFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"StopFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/StopFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,qDAAoD;AACpD,uDAA+C;AAC/C,mGAA2F;AAC3F,6GAAqG;AACrG,iEAAwE;AACxE,6EAA8F;AAGvF,IAAM,UAAU,wBAAhB,MAAM,UAAU;IAGnB,YAC+C,uBAAuD,EACrD,wBAA0D;QADpD,4BAAuB,GAAvB,uBAAuB,CAAwB;QAC7C,6BAAwB,GAAxB,wBAAwB,CAA0B;QAJ1F,mBAAc,GAAG,IAAI,+BAAc,EAAE,CAAC;IAKpD,CAAC;IAEG,KAAK,CAAC,2BAA2B,CAAC,KAAa;QAClD,uBAAuB;QACvB,IAAI,OAAe,CAAC;QACpB,IAAI;YACA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC7E,IAAI,WAAW,KAAK,IAAI,EAAE;gBACtB,OAAO,EAAE,CAAC;aACb;YAED,OAAO,GAAG,WAAW,CAAC;SACzB;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,KAAK,YAAY,qCAAoB,EAAE;gBACvC,MAAM,KAAK,CAAC;aACf;YAED,MAAM,IAAI,6BAAY,CAAC,kCAAkC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;SACjG;QACD,YAAY;QAEZ,uBAAuB;QACvB,IAAI,OAAO,GAAa,EAAE,CAAC;QAC3B,IAAI;YACA,OA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6BAAY,CAAC,+BAA+B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;SAC9F;IACL,CAAC;CACJ,CAAA;qBA1EY,UAAU;IADtB,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,sBAAsB,CAAC,CAAA;IACzC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,wBAAwB,CAAC,CAAA;qCADgC,+CAAsB;QACnB,mDAAwB;GALlG,UAAU,CA0EtB"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { ITransferOutputDto } from "../..";
|
|
2
|
-
import { DeparturesRepository } from "../../data-access";
|
|
1
|
+
import { ITransferOutputDto, IV4TransferDto } from "../..";
|
|
3
2
|
import { Moment } from "@golemio/core/dist/shared/moment-timezone";
|
|
4
3
|
import { TransferDepartureTransformation } from "../transformations/TransferDepartureTransformation";
|
|
4
|
+
import { PublicGtfsDepartureRepository } from "../../../public/data-access/redis/PublicGtfsDepartureRepository";
|
|
5
|
+
import { PublicVehiclePositionsRepository } from "../../../public/data-access/redis/PublicVehiclePositionsRepository";
|
|
6
|
+
import { PublicStopTimeRepository } from "../../../public/data-access/redis/PublicStopTimeRepository";
|
|
7
|
+
import { DeparturesRepository } from "../../data-access";
|
|
5
8
|
export declare class TransferFacade {
|
|
9
|
+
private publicDepartureRepository;
|
|
6
10
|
private departureRepository;
|
|
7
11
|
private departureTransformation;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* - Get transfer departures from DB
|
|
12
|
-
* - Process them (filter, sort, etc.)
|
|
13
|
-
* - Transform them to DTO
|
|
14
|
-
*/
|
|
12
|
+
private tripRepository;
|
|
13
|
+
private stopTimeRepository;
|
|
14
|
+
constructor(publicDepartureRepository: PublicGtfsDepartureRepository, departureRepository: DeparturesRepository, departureTransformation: TransferDepartureTransformation, tripRepository: PublicVehiclePositionsRepository, stopTimeRepository: PublicStopTimeRepository);
|
|
15
15
|
getTransferDepartures(stopIds: string[], tripNumber: string | null, currentMoment: Moment, minutesOffset: number, timeZone?: string): Promise<ITransferOutputDto[]>;
|
|
16
|
+
getTransferCache(stopIds: string[], reqNumber?: number, vehicleType?: number): Promise<IV4TransferDto>;
|
|
17
|
+
private processMultiplePostionsForDeparture;
|
|
16
18
|
/**
|
|
17
19
|
* Fallback options as defined by ROPID
|
|
18
20
|
*/
|
|
@@ -17,25 +17,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.TransferFacade = void 0;
|
|
19
19
|
const pid_1 = require("../..");
|
|
20
|
-
const data_access_1 = require("../../data-access");
|
|
21
20
|
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
22
|
-
const PIDDepartureModel_1 = __importDefault(require("../../models/helpers/PIDDepartureModel"));
|
|
23
21
|
const IPIDDepartureQueryOptions_1 = __importDefault(require("../../models/helpers/interfaces/IPIDDepartureQueryOptions"));
|
|
24
|
-
const shared_1 = require("../../../shared");
|
|
25
22
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
26
23
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
27
24
|
const TransferDepartureTransformation_1 = require("../transformations/TransferDepartureTransformation");
|
|
25
|
+
const PublicGtfsDepartureRepository_1 = require("../../../public/data-access/redis/PublicGtfsDepartureRepository");
|
|
26
|
+
const PublicVehiclePositionsRepository_1 = require("../../../public/data-access/redis/PublicVehiclePositionsRepository");
|
|
27
|
+
const PublicStopTimeRepository_1 = require("../../../public/data-access/redis/PublicStopTimeRepository");
|
|
28
|
+
const monitoring_1 = require("@golemio/core/dist/monitoring");
|
|
29
|
+
const PIDDepartureModel_1 = __importDefault(require("../../models/helpers/PIDDepartureModel"));
|
|
30
|
+
const shared_1 = require("../../../shared");
|
|
31
|
+
const data_access_1 = require("../../data-access");
|
|
32
|
+
const const_1 = require("../../../../const");
|
|
28
33
|
let TransferFacade = exports.TransferFacade = class TransferFacade {
|
|
29
|
-
constructor(departureRepository, departureTransformation) {
|
|
34
|
+
constructor(publicDepartureRepository, departureRepository, departureTransformation, tripRepository, stopTimeRepository) {
|
|
35
|
+
this.publicDepartureRepository = publicDepartureRepository;
|
|
30
36
|
this.departureRepository = departureRepository;
|
|
31
37
|
this.departureTransformation = departureTransformation;
|
|
38
|
+
this.tripRepository = tripRepository;
|
|
39
|
+
this.stopTimeRepository = stopTimeRepository;
|
|
32
40
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves transfer departures for given GTFS stop IDs
|
|
35
|
-
* - Get transfer departures from DB
|
|
36
|
-
* - Process them (filter, sort, etc.)
|
|
37
|
-
* - Transform them to DTO
|
|
38
|
-
*/
|
|
39
41
|
async getTransferDepartures(stopIds, tripNumber, currentMoment, minutesOffset, timeZone = shared_1.RopidRouterUtils.TIMEZONE) {
|
|
40
42
|
let departureEntities = [];
|
|
41
43
|
try {
|
|
@@ -71,6 +73,101 @@ let TransferFacade = exports.TransferFacade = class TransferFacade {
|
|
|
71
73
|
}
|
|
72
74
|
return transferDepartures;
|
|
73
75
|
}
|
|
76
|
+
async getTransferCache(stopIds, reqNumber, vehicleType) {
|
|
77
|
+
const span = (0, monitoring_1.createChildSpan)(`Departures.getTransferCache`);
|
|
78
|
+
span?.setAttributes({ stopIds, reqNumber, vehicleType });
|
|
79
|
+
try {
|
|
80
|
+
let departureEntities = [];
|
|
81
|
+
try {
|
|
82
|
+
departureEntities = await this.publicDepartureRepository.getPublicGtfsDepartureCache(stopIds, 60 * 6);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
span?.recordException(error);
|
|
86
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
throw new golemio_errors_1.GeneralError("Failed to publicGtfsDepartureCache", this.constructor.name, error, 500);
|
|
90
|
+
}
|
|
91
|
+
const currentPosition = await this.tripRepository.getDetailedVehiclePosition(`service-${vehicleType}-${reqNumber}`);
|
|
92
|
+
let currentDeparture = null;
|
|
93
|
+
let currentStopTime = null;
|
|
94
|
+
if (currentPosition) {
|
|
95
|
+
const departureIndex = departureEntities.findIndex((departure) => {
|
|
96
|
+
return departure.trip_id === currentPosition.gtfs_trip_id;
|
|
97
|
+
}) ?? null;
|
|
98
|
+
// Remove currentDeparture from departureEntities
|
|
99
|
+
if (departureIndex !== -1) {
|
|
100
|
+
currentDeparture = departureEntities.splice(departureIndex, 1)[0];
|
|
101
|
+
}
|
|
102
|
+
const stopTimes = await this.stopTimeRepository.getPublicStopTimeCache(currentPosition.vehicle_id, currentPosition.gtfs_trip_id);
|
|
103
|
+
currentStopTime =
|
|
104
|
+
stopTimes.find((stopTime) => stopTime.sequence === currentPosition.detailed_info.last_stop_sequence + 1) ??
|
|
105
|
+
null;
|
|
106
|
+
}
|
|
107
|
+
const positionsByTrip = await this.tripRepository.getAllVehiclePositionsForMultipleTrips(departureEntities.map((departure) => departure.trip_id));
|
|
108
|
+
let transfers = [];
|
|
109
|
+
for (const departure of departureEntities) {
|
|
110
|
+
const positions = positionsByTrip.get(departure.trip_id) ?? [];
|
|
111
|
+
const duplicatedDepartures = await this.processMultiplePostionsForDeparture(departure, positions);
|
|
112
|
+
transfers.push(...duplicatedDepartures);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
currentTrip: {
|
|
116
|
+
departure: currentDeparture,
|
|
117
|
+
position: currentPosition,
|
|
118
|
+
stopTime: currentStopTime,
|
|
119
|
+
},
|
|
120
|
+
transfers,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
span?.recordException(error);
|
|
125
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
throw new golemio_errors_1.GeneralError("Error in getTransferCache", this.constructor.name, error, 500);
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
span?.end();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async processMultiplePostionsForDeparture(departure, vehiclePositions) {
|
|
135
|
+
const outputGroup = [];
|
|
136
|
+
try {
|
|
137
|
+
// If there are no RT data, we still want to display the departure
|
|
138
|
+
// but without any RT/vehicle information
|
|
139
|
+
if (vehiclePositions.length === 0) {
|
|
140
|
+
outputGroup.push({
|
|
141
|
+
departure,
|
|
142
|
+
position: null,
|
|
143
|
+
stopTime: null,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// Otherwise, we want to duplicate the departure for each vehicleId
|
|
147
|
+
// (multiple vehicles can be on the same trip at the same time)
|
|
148
|
+
for (const vehiclePosition of vehiclePositions) {
|
|
149
|
+
// filter out CANCELED trips
|
|
150
|
+
if (vehiclePosition.state_position === const_1.StatePositionEnum.CANCELED) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
let currentStopTime = null;
|
|
154
|
+
const stopTimes = await this.stopTimeRepository.getPublicStopTimeCache(vehiclePosition.vehicle_id, departure.trip_id);
|
|
155
|
+
currentStopTime = stopTimes.find((stopTime) => stopTime.sequence === departure.stop_sequence) ?? null;
|
|
156
|
+
outputGroup.push({
|
|
157
|
+
departure,
|
|
158
|
+
position: vehiclePosition,
|
|
159
|
+
stopTime: currentStopTime,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return outputGroup;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
throw new golemio_errors_1.GeneralError("Error in processMultiplePostionsForDeparture", this.constructor.name, error, 500);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
74
171
|
/**
|
|
75
172
|
* Fallback options as defined by ROPID
|
|
76
173
|
*/
|
|
@@ -91,9 +188,15 @@ let TransferFacade = exports.TransferFacade = class TransferFacade {
|
|
|
91
188
|
};
|
|
92
189
|
exports.TransferFacade = TransferFacade = __decorate([
|
|
93
190
|
(0, tsyringe_1.injectable)(),
|
|
94
|
-
__param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.
|
|
95
|
-
__param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.
|
|
96
|
-
|
|
97
|
-
|
|
191
|
+
__param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicGtfsDepartureRepository)),
|
|
192
|
+
__param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.DeparturesRepository)),
|
|
193
|
+
__param(2, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferDepartureTransformation)),
|
|
194
|
+
__param(3, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicVehiclePositionsRepository)),
|
|
195
|
+
__param(4, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicStopTimeRepository)),
|
|
196
|
+
__metadata("design:paramtypes", [PublicGtfsDepartureRepository_1.PublicGtfsDepartureRepository,
|
|
197
|
+
data_access_1.DeparturesRepository,
|
|
198
|
+
TransferDepartureTransformation_1.TransferDepartureTransformation,
|
|
199
|
+
PublicVehiclePositionsRepository_1.PublicVehiclePositionsRepository,
|
|
200
|
+
PublicStopTimeRepository_1.PublicStopTimeRepository])
|
|
98
201
|
], TransferFacade);
|
|
99
202
|
//# sourceMappingURL=TransferFacade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/TransferFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"TransferFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/TransferFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BASiB;AACjB,qDAAoD;AACpD,0HAAoG;AACpG,6EAA8F;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ITransferDeparture } from "../..";
|
|
1
|
+
import { ITransferDeparture, IDepartureWithPosition } from "../..";
|
|
2
2
|
export declare class PlatformCodeResolver {
|
|
3
3
|
/**
|
|
4
4
|
* Platform code is determined by the following rules:
|
|
@@ -7,4 +7,10 @@ export declare class PlatformCodeResolver {
|
|
|
7
7
|
* - for other route types, the departure platform code is used (GTFS)
|
|
8
8
|
*/
|
|
9
9
|
static resolve(departure: ITransferDeparture): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Determine platform code based on the following rules:
|
|
12
|
+
* if current stop time is known, use its RT CIS platform code (if available)
|
|
13
|
+
* otherwise use GTFS schedule platform code
|
|
14
|
+
*/
|
|
15
|
+
static determinePlatformCode: (inputDto: IDepartureWithPosition) => string | null;
|
|
10
16
|
}
|
|
@@ -17,4 +17,16 @@ class PlatformCodeResolver {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.PlatformCodeResolver = PlatformCodeResolver;
|
|
20
|
+
/**
|
|
21
|
+
* Determine platform code based on the following rules:
|
|
22
|
+
* if current stop time is known, use its RT CIS platform code (if available)
|
|
23
|
+
* otherwise use GTFS schedule platform code
|
|
24
|
+
*/
|
|
25
|
+
PlatformCodeResolver.determinePlatformCode = (inputDto) => {
|
|
26
|
+
const { departure, stopTime } = inputDto;
|
|
27
|
+
if (stopTime) {
|
|
28
|
+
return stopTime.cis_stop_platform_code;
|
|
29
|
+
}
|
|
30
|
+
return departure.platform_code;
|
|
31
|
+
};
|
|
20
32
|
//# sourceMappingURL=PlatformCodeResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/helpers/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,SAA6B;QAC/C,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,IAAI,EAAE;YACvG,OAAO,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,aAAa,CAAC;IACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/helpers/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,SAA6B;QAC/C,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,IAAI,EAAE;YACvG,OAAO,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,aAAa,CAAC;IACnC,CAAC;;AAbL,oDA4BC;AAdG;;;;GAIG;AACW,0CAAqB,GAAG,CAAC,QAAgC,EAAiB,EAAE;IACtF,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;IAEzC,IAAI,QAAQ,EAAE;QACV,OAAO,QAAQ,CAAC,sBAAsB,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,aAAa,CAAC;AACnC,CAAC,CAAC"}
|
package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
// TODO: what to do if there is no position for metro
|
|
25
|
+
const departureRouteAndDirection = `${departure.route_short_name}-${position?.detailed_info.direction_id ?? 0}`;
|
|
26
|
+
const dep = departures.get(departureRouteAndDirection);
|
|
27
|
+
if (dep && dep.departure_timestamp.minutes.length < 2) {
|
|
28
|
+
dep.departure_timestamp.minutes.push(this.calculateDepartureMinutes(departure, position?.delay ?? null));
|
|
29
|
+
departures.set(departureRouteAndDirection, dep);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
departures.set(departureRouteAndDirection, this.transformInternal({ departure, position, stopTime }));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
res.push(this.transformInternal({ departure, position, stopTime }));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [...Array.from(departures.values()), ...res];
|
|
39
|
+
};
|
|
40
|
+
this.transformInternal = (data) => {
|
|
41
|
+
const { departure, position } = data;
|
|
42
|
+
return {
|
|
43
|
+
departure_timestamp: {
|
|
44
|
+
minutes: [this.calculateDepartureMinutes(departure, position?.delay ?? null)],
|
|
45
|
+
},
|
|
46
|
+
route: {
|
|
47
|
+
short_name: departure.route_short_name,
|
|
48
|
+
type: departure.route_type,
|
|
49
|
+
},
|
|
50
|
+
stop: {
|
|
51
|
+
platform_code: PlatformCodeResolver_1.PlatformCodeResolver.determinePlatformCode(data),
|
|
52
|
+
},
|
|
53
|
+
trip: {
|
|
54
|
+
headsign: departure.trip_headsign,
|
|
55
|
+
id: departure.trip_id,
|
|
56
|
+
is_wheelchair_accessible: position?.detailed_info.is_wheelchair_accessible ?? null,
|
|
57
|
+
},
|
|
58
|
+
icons: [],
|
|
59
|
+
substitution_text: null,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
calculateDepartureMinutes({ arrival_datetime, departure_datetime }, delay) {
|
|
64
|
+
const departureTime = DepartureCalculator_1.DepartureCalculator.getPredictedDepartureTime(new Date(departure_datetime), arrival_datetime ? new Date(arrival_datetime) : null, delay);
|
|
65
|
+
const departure_minutes = DepartureCalculator_1.DepartureCalculator.getDepartureMinutes(departureTime);
|
|
66
|
+
if (departure_minutes < 1 && departure_minutes >= 0) {
|
|
67
|
+
return "<1";
|
|
68
|
+
}
|
|
69
|
+
return departure_minutes.toString();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.TransferDepartureCacheTransformation = TransferDepartureCacheTransformation = __decorate([
|
|
73
|
+
(0, tsyringe_1.injectable)()
|
|
74
|
+
], TransferDepartureCacheTransformation);
|
|
75
|
+
//# sourceMappingURL=TransferDepartureCacheTransformation.js.map
|
package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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;AAEvE,uEAA4D;AAG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AC,QAAQ,EAAE,CAAC;IACxC,CAAC;CACJ,CAAA;+CArEY,oCAAoC;IADhD,IAAA,qBAAU,GAAE;GACA,oCAAoC,CAqEhD"}
|
|
@@ -6,6 +6,6 @@ export declare class PublicGtfsDepartureRepository implements IGtfsDepartureRepo
|
|
|
6
6
|
private redisConnector;
|
|
7
7
|
private log;
|
|
8
8
|
constructor(redisConnector: IoRedisConnector, log: ILogger);
|
|
9
|
-
getPublicGtfsDepartureCache(stopIds: string[], minutesAfter: number): Promise<IPublicGtfsDepartureCacheDto[]>;
|
|
9
|
+
getPublicGtfsDepartureCache(stopIds: string[], minutesAfter: number, timeFrom?: Date): Promise<IPublicGtfsDepartureCacheDto[]>;
|
|
10
10
|
private getAndParseDepartureCache;
|
|
11
11
|
}
|
|
@@ -23,11 +23,11 @@ let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = clas
|
|
|
23
23
|
constructor(redisConnector, log) {
|
|
24
24
|
this.redisConnector = redisConnector;
|
|
25
25
|
this.log = log;
|
|
26
|
-
this.getAndParseDepartureCache = async (stopId, minutesAfter) => {
|
|
26
|
+
this.getAndParseDepartureCache = async (stopId, minutesAfter, timeFrom) => {
|
|
27
27
|
const connection = this.redisConnector.getConnection();
|
|
28
28
|
let departureCache;
|
|
29
29
|
try {
|
|
30
|
-
departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, "-inf", Math.round(new Date().getTime() / 1000) + minutesAfter * 60);
|
|
30
|
+
departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, "-inf", Math.round(timeFrom?.getTime() ?? new Date().getTime() / 1000) + minutesAfter * 60);
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
33
33
|
throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot get public departure cache from cache: ${err.message}`, this.constructor.name, err);
|
|
@@ -44,11 +44,11 @@ let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = clas
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
async getPublicGtfsDepartureCache(stopIds, minutesAfter) {
|
|
47
|
+
async getPublicGtfsDepartureCache(stopIds, minutesAfter, timeFrom) {
|
|
48
48
|
if (!this.redisConnector.isConnected()) {
|
|
49
49
|
await this.redisConnector.connect();
|
|
50
50
|
}
|
|
51
|
-
const allDepartures = await Promise.all(stopIds.map((stopId) => this.getAndParseDepartureCache(stopId, minutesAfter)));
|
|
51
|
+
const allDepartures = await Promise.all(stopIds.map((stopId) => this.getAndParseDepartureCache(stopId, minutesAfter, timeFrom)));
|
|
52
52
|
return allDepartures.flat();
|
|
53
53
|
}
|
|
54
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC2C,cAAwC,EACrD,GAAoB;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;
|
|
1
|
+
{"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC2C,cAAwC,EACrD,GAAoB;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;QAmB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AI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACvC;QAED,MAAM,aAAa,GAAqC,MAAM,OAAO,CAAC,GAAG,CACrE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAC1F,CAAC;QAEF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CAwCJ,CAAA;wCA5DY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,6BAA6B,CA4DzC"}
|
|
@@ -11,7 +11,7 @@ const DelayComputationRepository_1 = require("../data-access/redis/DelayComputat
|
|
|
11
11
|
const PublicGtfsDepartureRepository_1 = require("../data-access/redis/PublicGtfsDepartureRepository");
|
|
12
12
|
const PublicStopTimeRepository_1 = require("../data-access/redis/PublicStopTimeRepository");
|
|
13
13
|
const PublicVehiclePositionsRepository_1 = require("../data-access/redis/PublicVehiclePositionsRepository");
|
|
14
|
-
const VPSubscriber_1 = require("
|
|
14
|
+
const VPSubscriber_1 = require("../../shared/service/VPSubscriber");
|
|
15
15
|
const DepartureBoardFacade_1 = require("../service/facade/DepartureBoardFacade");
|
|
16
16
|
const DetailedTripFacade_1 = require("../service/facade/DetailedTripFacade");
|
|
17
17
|
const GtfsTripLookupFacade_1 = require("../service/facade/GtfsTripLookupFacade");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,oFAAyE;AACzE,qFAAmF;AAEnF,wE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,CAAC,CAAC,OAAO,CAA8B,6BAAa,CAAC,gCAAgC,CAAC,EACtF,CAAC,CAAC,OAAO,CAAsB,6BAAa,CAAC,wBAAwB,CAAC,EACtE,CAAC,CAAC,OAAO,CAAoC,6BAAa,CAAC,iCAAiC,CAAC,CAChG,CAAC;IACN,CAAC,CAAC;CACL,CAAC,CAAC;AAEH,iBAAiB,CAAC,QAAQ,CAAC,6BAAa,CAAC,YAAY,EAAE;IACnD,UAAU,EAAE,IAAA,iCAAsB,EAAC,CAAC,CAAC,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAAC,CAAC;QAEpD,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|