@golemio/pid 2.23.2 → 2.23.3-dev.1527535265
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/example/03_ropidgtfs_dump.sql +7 -1
- package/db/example/09_departureboards_testdata_nogapfilter.sql +4 -1
- package/db/example/20_jis_infotexts.sql +6 -0
- package/db/migrations/postgresql/20241104000200-transfer-boards.js +53 -0
- package/db/migrations/postgresql/sqls/20241104000200-transfer-boards-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20241104000200-transfer-boards-up.sql +96 -0
- package/dist/helpers/StopEnums.d.ts +12 -0
- package/dist/helpers/StopEnums.js +17 -0
- package/dist/helpers/StopEnums.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.d.ts +13 -0
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js +116 -0
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -0
- package/dist/output-gateway/pid/data-access/DeparturesRepository.d.ts +14 -14
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js +86 -34
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
- package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.d.ts +16 -0
- package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.js +3 -0
- package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.js.map +1 -0
- package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.d.ts +0 -7
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +5 -16
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +31 -0
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/ioc/Di.js +19 -0
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
- package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +8 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js +10 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +4 -2
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/FilterHelper.d.ts +4 -4
- package/dist/output-gateway/pid/models/helpers/FilterHelper.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.d.ts +4 -3
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +31 -8
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/interfaces/IPIDDepartureQueryOptions.d.ts +1 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.d.ts +1 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js +10 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +13 -0
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +62 -0
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -0
- package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +9 -0
- package/dist/output-gateway/pid/service/facade/StopFacade.js +76 -0
- package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -0
- package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +20 -0
- package/dist/output-gateway/pid/service/facade/TransferFacade.js +104 -0
- package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -0
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +10 -0
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +20 -0
- package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.d.ts +11 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js +30 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js.map +1 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.d.ts +22 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js +52 -0
- package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js.map +1 -0
- package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.d.ts +11 -0
- package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js +65 -0
- package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js.map +1 -0
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.d.ts +4 -0
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js +25 -2
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js.map +1 -1
- package/docs/implementation_documentation.md +4 -0
- package/docs/openapi-output.yaml +152 -1
- package/package.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DepartureMode } from "../..";
|
|
2
|
+
import type { Moment } from "@golemio/core/dist/shared/moment-timezone";
|
|
3
|
+
export interface ITimestampOptions {
|
|
4
|
+
currentMoment: Moment;
|
|
5
|
+
minutesOffset: number;
|
|
6
|
+
minutesBefore: number;
|
|
7
|
+
minutesAfter: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IDeparturesViewOptions extends ITimestampOptions {
|
|
10
|
+
stopsIds: string[];
|
|
11
|
+
mode: DepartureMode;
|
|
12
|
+
isAirCondition: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ITransfersViewOptions extends Pick<ITimestampOptions, "currentMoment" | "minutesOffset"> {
|
|
15
|
+
stopsIds: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepartureInterfaces.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/data-access/interfaces/DepartureInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -18,6 +18,11 @@ export interface IInfotextDepartureOutputDto {
|
|
|
18
18
|
valid_from: string;
|
|
19
19
|
valid_to: string | null;
|
|
20
20
|
}
|
|
21
|
+
export interface IInfotextTransferOutputDto {
|
|
22
|
+
display_type: InfotextDisplayType;
|
|
23
|
+
text: string;
|
|
24
|
+
text_en: string | null;
|
|
25
|
+
}
|
|
21
26
|
export interface IInfotextOverviewOutputDto {
|
|
22
27
|
id: string;
|
|
23
28
|
priority: InfotextPriority;
|
|
@@ -6,11 +6,4 @@ export default class DepartureBoardMapper {
|
|
|
6
6
|
private static transformResponseData;
|
|
7
7
|
private static calculateDepartureMinutes;
|
|
8
8
|
private static determineWheelchairAccessibility;
|
|
9
|
-
/**
|
|
10
|
-
* Platform code is determined by the following rules:
|
|
11
|
-
* - for trains, the last stop platform code is used (CIS) if available
|
|
12
|
-
* - otherwise, the departure platform code is used (GTFS)
|
|
13
|
-
* - for other route types, the departure platform code is used (GTFS)
|
|
14
|
-
*/
|
|
15
|
-
private static determineStopPlatformCode;
|
|
16
9
|
}
|
|
@@ -7,6 +7,7 @@ const shared_1 = require("../../shared");
|
|
|
7
7
|
const DepartureCalculator_1 = require("../../shared/DepartureCalculator");
|
|
8
8
|
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
9
9
|
const __1 = require("..");
|
|
10
|
+
const PlatformCodeResolver_1 = require("../service/helpers/PlatformCodeResolver");
|
|
10
11
|
class DepartureBoardMapper {
|
|
11
12
|
static mapDepartures(data, preferredTimezone, mode) {
|
|
12
13
|
const result = data.departures.map((d) => this.transformResponseData(d, preferredTimezone, mode));
|
|
@@ -20,10 +21,10 @@ class DepartureBoardMapper {
|
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
23
|
const departure_minutes = DepartureCalculator_1.DepartureCalculator.getDepartureMinutes(predicted);
|
|
23
|
-
if (departure_minutes < 1)
|
|
24
|
+
if (departure_minutes < 1) {
|
|
24
25
|
return "<1";
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
}
|
|
27
|
+
return departure_minutes.toString();
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
_a = DepartureBoardMapper;
|
|
@@ -80,7 +81,7 @@ DepartureBoardMapper.transformResponseData = (x, preferredTimezone, mode) => {
|
|
|
80
81
|
},
|
|
81
82
|
stop: {
|
|
82
83
|
id: x.stop_id,
|
|
83
|
-
platform_code:
|
|
84
|
+
platform_code: PlatformCodeResolver_1.PlatformCodeResolver.resolve(x),
|
|
84
85
|
},
|
|
85
86
|
trip: {
|
|
86
87
|
direction: x.direction,
|
|
@@ -112,17 +113,5 @@ DepartureBoardMapper.determineWheelchairAccessibility = (departure) => {
|
|
|
112
113
|
: wheelchair_accessible === AccessibilityEnums_1.GtfsTripWheelchairAccessEnum.AccessibleVehicle;
|
|
113
114
|
}
|
|
114
115
|
};
|
|
115
|
-
/**
|
|
116
|
-
* Platform code is determined by the following rules:
|
|
117
|
-
* - for trains, the last stop platform code is used (CIS) if available
|
|
118
|
-
* - otherwise, the departure platform code is used (GTFS)
|
|
119
|
-
* - for other route types, the departure platform code is used (GTFS)
|
|
120
|
-
*/
|
|
121
|
-
DepartureBoardMapper.determineStopPlatformCode = (departure) => {
|
|
122
|
-
if (departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.TRAIN && departure["trip.cis_stop_platform_code"] !== null) {
|
|
123
|
-
return departure["trip.cis_stop_platform_code"];
|
|
124
|
-
}
|
|
125
|
-
return departure.platform_code;
|
|
126
|
-
};
|
|
127
116
|
exports.default = DepartureBoardMapper;
|
|
128
117
|
//# sourceMappingURL=DepartureBoardMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DepartureBoardMapper.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/helpers/DepartureBoardMapper.ts"],"names":[],"mappings":";;;AAAA,4EAA2G;AA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AAS,CAAC,YAAY,CAAC,KAAK,kCAAiB,CAAC,KAAK,EAAE;QACrD,QAAQ,mBAAmB,EAAE;YACzB,KAAK,mDAA8B,CAAC,iBAAiB;gBACjD,OAAO,IAAI,CAAC;YAChB,KAAK,mDAA8B,CAAC,mBAAmB,CAAC;YACxD,KAAK,mDAA8B,CAAC,aAAa,CAAC;YAClD;gBACI,OAAO,KAAK,CAAC;SACpB;KACJ;SAAM;QACH,OAAO,OAAO,0BAA0B,KAAK,SAAS;YAClD,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,qBAAqB,KAAK,iDAA4B,CAAC,iBAAiB,CAAC;KAClF;AACL,CAAC,AAjB8C,CAiB7C;kBA9Ge,oBAAoB"}
|
|
@@ -3,6 +3,7 @@ import { GTFSRouteTypeEnum } from "../../helpers/RouteTypeEnums";
|
|
|
3
3
|
import { DeparturesDirectionsEnum } from "../../schema-definitions/ropid-departures-directions";
|
|
4
4
|
export * from "./routers";
|
|
5
5
|
export * from "./models";
|
|
6
|
+
export type DepartureUnion = IPIDDeparture | ITransferDeparture;
|
|
6
7
|
export interface IPIDDeparture {
|
|
7
8
|
stop_sequence: number;
|
|
8
9
|
stop_headsign: string | null;
|
|
@@ -39,6 +40,22 @@ export interface IPIDDeparture {
|
|
|
39
40
|
"trip.cis_stop_platform_code": string | null;
|
|
40
41
|
"trip.vehicle_descriptor.is_air_conditioned"?: boolean | null;
|
|
41
42
|
}
|
|
43
|
+
export interface ITransferDeparture {
|
|
44
|
+
departure_datetime_real: Date | null;
|
|
45
|
+
stop_headsign: string | null;
|
|
46
|
+
departure_datetime: Date | null;
|
|
47
|
+
stop_id: string;
|
|
48
|
+
platform_code: string | null;
|
|
49
|
+
trip_id: string;
|
|
50
|
+
trip_headsign: string;
|
|
51
|
+
trip_short_name: string | null;
|
|
52
|
+
route_short_name: string | null;
|
|
53
|
+
route_type: GTFSRouteTypeEnum;
|
|
54
|
+
route_id: string | null;
|
|
55
|
+
is_canceled: boolean;
|
|
56
|
+
"trip.cis_stop_platform_code": string | null;
|
|
57
|
+
is_delay_available: boolean;
|
|
58
|
+
}
|
|
42
59
|
export interface IPIDDepartureOutput {
|
|
43
60
|
arrival_timestamp: IDepartureTime;
|
|
44
61
|
delay: {
|
|
@@ -73,6 +90,20 @@ export interface IPIDDepartureOutput {
|
|
|
73
90
|
short_name: string | null;
|
|
74
91
|
};
|
|
75
92
|
}
|
|
93
|
+
export interface ITransferOutputDto {
|
|
94
|
+
departure_timestamp: Pick<IDepartureTime, "minutes">;
|
|
95
|
+
route: {
|
|
96
|
+
short_name: string | null;
|
|
97
|
+
type: number | null;
|
|
98
|
+
};
|
|
99
|
+
stop: {
|
|
100
|
+
platform_code: string | null;
|
|
101
|
+
};
|
|
102
|
+
trip: {
|
|
103
|
+
headsign: string;
|
|
104
|
+
id: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
76
107
|
export interface IStop {
|
|
77
108
|
stop_id: string;
|
|
78
109
|
stop_name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,4CAA0B;AAC1B,2CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,4CAA0B;AAC1B,2CAAyB;AAoHzB,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACnB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,yCAAuB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,2CAAwB,CAAA;IACxB,0DAAuC,CAAA;IACvC,oDAAiC,CAAA;IACjC,mEAAgD,CAAA;IAChD,qEAAkD,CAAA;IAClD,8EAA2D,CAAA;AAC/D,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACrB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,mCAAkB,CAAA;IAClB,8BAA8B;AAClC,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB"}
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OgPidContainer = void 0;
|
|
4
|
+
const CisStopGroupRepository_1 = require("../../ropid-gtfs/data-access/CisStopGroupRepository");
|
|
4
5
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
5
6
|
const V3InfotextsController_1 = require("../controllers/v3/V3InfotextsController");
|
|
7
|
+
const V3TransferBoardsController_1 = require("../controllers/v3/V3TransferBoardsController");
|
|
8
|
+
const data_access_1 = require("../data-access");
|
|
6
9
|
const JISInfotextRepository_1 = require("../data-access/JISInfotextRepository");
|
|
7
10
|
const JISInfotextRopidGTFSStopsRepository_1 = require("../data-access/JISInfotextRopidGTFSStopsRepository");
|
|
11
|
+
const InfotextFacade_1 = require("../service/facade/InfotextFacade");
|
|
12
|
+
const StopFacade_1 = require("../service/facade/StopFacade");
|
|
13
|
+
const TransferFacade_1 = require("../service/facade/TransferFacade");
|
|
8
14
|
const JISInfotextDepartureTransformation_1 = require("../service/transformations/JISInfotextDepartureTransformation");
|
|
9
15
|
const JISInfotextOverviewTransformation_1 = require("../service/transformations/JISInfotextOverviewTransformation");
|
|
16
|
+
const JISInfotextTransferTransformation_1 = require("../service/transformations/JISInfotextTransferTransformation");
|
|
17
|
+
const TransferDepartureTransformation_1 = require("../service/transformations/TransferDepartureTransformation");
|
|
10
18
|
const OgPidToken_1 = require("./OgPidToken");
|
|
11
19
|
const ogPidContainer = ioc_1.OutputGatewayContainer.createChildContainer();
|
|
12
20
|
exports.OgPidContainer = ogPidContainer;
|
|
13
21
|
//#region Repositories
|
|
22
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.CisStopGroupRepository, CisStopGroupRepository_1.CisStopGroupRepository);
|
|
23
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRopidGTFSStopsRepository, JISInfotextRopidGTFSStopsRepository_1.JISInfotextRopidGTFSStopsRepository);
|
|
14
24
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRopidGTFSStopsRepository, JISInfotextRopidGTFSStopsRepository_1.JISInfotextRopidGTFSStopsRepository);
|
|
15
25
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRepository, JISInfotextRepository_1.JISInfotextRepository);
|
|
26
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.DeparturesRepository, data_access_1.DeparturesRepository);
|
|
16
27
|
//#endregion
|
|
17
28
|
//#region Transformations
|
|
18
29
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextDepartureTransformation, JISInfotextDepartureTransformation_1.JISInfotextDepartureTransformation);
|
|
30
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextTransferTransformation, JISInfotextTransferTransformation_1.JISInfotextTransferTransformation);
|
|
19
31
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextOverviewTransformation, JISInfotextOverviewTransformation_1.JISInfotextOverviewTransformation);
|
|
32
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.TransferDepartureTransformation, TransferDepartureTransformation_1.TransferDepartureTransformation);
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region Facade
|
|
35
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.StopFacade, StopFacade_1.StopFacade);
|
|
36
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.InfotextFacade, InfotextFacade_1.InfotextFacade);
|
|
37
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.TransferFacade, TransferFacade_1.TransferFacade);
|
|
20
38
|
//#endregion
|
|
21
39
|
//#region Controllers
|
|
40
|
+
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.V3TransferBoardsController, V3TransferBoardsController_1.V3TransferBoardsController);
|
|
22
41
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.V3InfotextsController, V3InfotextsController_1.V3InfotextsController);
|
|
23
42
|
//# sourceMappingURL=Di.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,+DAA+E;AAE/E,mFAAgF;AAChF,gFAA6E;AAC7E,4GAAyG;AACzG,sHAAmH;AACnH,oHAAiH;AACjH,6CAA0C;AAE1C,MAAM,cAAc,GAAwB,4BAAsB,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,gGAA2F;AAC3F,+DAA+E;AAE/E,mFAAgF;AAChF,6FAA0F;AAC1F,gDAAsD;AACtD,gFAA6E;AAC7E,4GAAyG;AACzG,qEAAkE;AAClE,6DAA0D;AAC1D,qEAAkE;AAClE,sHAAmH;AACnH,oHAAiH;AACjH,oHAAiH;AACjH,gHAA6G;AAC7G,6CAA0C;AAE1C,MAAM,cAAc,GAAwB,4BAAsB,CAAC,oBAAoB,EAAE,CAAC;AA4B/D,wCAAc;AA1BzC,sBAAsB;AACtB,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AAC5F,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,mCAAmC,EAAE,yEAAmC,CAAC,CAAC;AACtH,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,mCAAmC,EAAE,yEAAmC,CAAC,CAAC;AACtH,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC1F,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,oBAAoB,EAAE,kCAAoB,CAAC,CAAC;AACxF,YAAY;AAEZ,yBAAyB;AACzB,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,kCAAkC,EAAE,uEAAkC,CAAC,CAAC;AACpH,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,iCAAiC,EAAE,qEAAiC,CAAC,CAAC;AAClH,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,iCAAiC,EAAE,qEAAiC,CAAC,CAAC;AAClH,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,+BAA+B,EAAE,iEAA+B,CAAC,CAAC;AAC9G,YAAY;AAEZ,gBAAgB;AAChB,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,UAAU,EAAE,uBAAU,CAAC,CAAC;AACpE,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,cAAc,EAAE,+BAAc,CAAC,CAAC;AAC5E,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,cAAc,EAAE,+BAAc,CAAC,CAAC;AAC5E,YAAY;AAEZ,qBAAqB;AACrB,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACpG,cAAc,CAAC,iBAAiB,CAAC,uBAAU,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export declare const OgPidToken: {
|
|
2
|
+
CisStopGroupRepository: symbol;
|
|
2
3
|
JISInfotextRopidGTFSStopsRepository: symbol;
|
|
3
4
|
JISInfotextRepository: symbol;
|
|
5
|
+
DeparturesRepository: symbol;
|
|
4
6
|
JISInfotextDepartureTransformation: symbol;
|
|
7
|
+
JISInfotextTransferTransformation: symbol;
|
|
5
8
|
JISInfotextOverviewTransformation: symbol;
|
|
9
|
+
TransferDepartureTransformation: symbol;
|
|
10
|
+
StopFacade: symbol;
|
|
11
|
+
InfotextFacade: symbol;
|
|
12
|
+
TransferFacade: symbol;
|
|
13
|
+
V3TransferBoardsController: symbol;
|
|
6
14
|
V3InfotextsController: symbol;
|
|
7
15
|
};
|
|
@@ -3,14 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OgPidToken = void 0;
|
|
4
4
|
exports.OgPidToken = {
|
|
5
5
|
//#region Repositories
|
|
6
|
+
CisStopGroupRepository: Symbol(),
|
|
6
7
|
JISInfotextRopidGTFSStopsRepository: Symbol(),
|
|
7
8
|
JISInfotextRepository: Symbol(),
|
|
9
|
+
DeparturesRepository: Symbol(),
|
|
8
10
|
//#endregion
|
|
9
11
|
//#region Transformations
|
|
10
12
|
JISInfotextDepartureTransformation: Symbol(),
|
|
13
|
+
JISInfotextTransferTransformation: Symbol(),
|
|
11
14
|
JISInfotextOverviewTransformation: Symbol(),
|
|
15
|
+
TransferDepartureTransformation: Symbol(),
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region Facade
|
|
18
|
+
StopFacade: Symbol(),
|
|
19
|
+
InfotextFacade: Symbol(),
|
|
20
|
+
TransferFacade: Symbol(),
|
|
12
21
|
//#endregion
|
|
13
22
|
//#region Controllers
|
|
23
|
+
V3TransferBoardsController: Symbol(),
|
|
14
24
|
V3InfotextsController: Symbol(),
|
|
15
25
|
//#endregion
|
|
16
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OgPidToken.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/ioc/OgPidToken.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,sBAAsB;IACtB,mCAAmC,EAAE,MAAM,EAAE;IAC7C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,YAAY;IAEZ,yBAAyB;IACzB,kCAAkC,EAAE,MAAM,EAAE;IAC5C,iCAAiC,EAAE,MAAM,EAAE;IAC3C,YAAY;IAEZ,qBAAqB;IACrB,qBAAqB,EAAE,MAAM,EAAE;IAC/B,YAAY;CACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"OgPidToken.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/ioc/OgPidToken.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,sBAAsB;IACtB,sBAAsB,EAAE,MAAM,EAAE;IAChC,mCAAmC,EAAE,MAAM,EAAE;IAC7C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,oBAAoB,EAAE,MAAM,EAAE;IAC9B,YAAY;IAEZ,yBAAyB;IACzB,kCAAkC,EAAE,MAAM,EAAE;IAC5C,iCAAiC,EAAE,MAAM,EAAE;IAC3C,iCAAiC,EAAE,MAAM,EAAE;IAC3C,+BAA+B,EAAE,MAAM,EAAE;IACzC,YAAY;IAEZ,gBAAgB;IAChB,UAAU,EAAE,MAAM,EAAE;IACpB,cAAc,EAAE,MAAM,EAAE;IACxB,cAAc,EAAE,MAAM,EAAE;IACxB,YAAY;IAEZ,qBAAqB;IACrB,0BAA0B,EAAE,MAAM,EAAE;IACpC,qBAAqB,EAAE,MAAM,EAAE;IAC/B,YAAY;CACf,CAAC"}
|
|
@@ -13,8 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.PIDDepartureBoardsModel = void 0;
|
|
16
|
+
const StopEnums_1 = require("../../../helpers/StopEnums");
|
|
16
17
|
const data_access_1 = require("../data-access");
|
|
17
18
|
const models_1 = require("../../ropid-gtfs/models");
|
|
19
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
18
20
|
const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
|
|
19
21
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
20
22
|
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
@@ -42,7 +44,7 @@ class PIDDepartureBoardsModel {
|
|
|
42
44
|
cisIds: options.cisIds,
|
|
43
45
|
gtfsIds: options.gtfsIds,
|
|
44
46
|
limit: this.stopsMaxCount + 1,
|
|
45
|
-
locationType:
|
|
47
|
+
locationType: StopEnums_1.GtfsStopLocationType.StopOrPlatform,
|
|
46
48
|
names: options.names,
|
|
47
49
|
returnRaw: true,
|
|
48
50
|
});
|
|
@@ -113,7 +115,7 @@ class PIDDepartureBoardsModel {
|
|
|
113
115
|
}
|
|
114
116
|
});
|
|
115
117
|
this.ropidDeparturesDirectionsModel = new _1.RopidDeparturesDirectionsModel();
|
|
116
|
-
this.departuresRepository = new data_access_1.DeparturesRepository();
|
|
118
|
+
this.departuresRepository = new data_access_1.DeparturesRepository(Di_1.OgPidContainer.resolve(CoreToken_1.CoreToken.PostgresConnector), Di_1.OgPidContainer.resolve(CoreToken_1.CoreToken.SimpleConfig));
|
|
117
119
|
this.infotextRepository = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.JISInfotextRepository);
|
|
118
120
|
this.infotextTransformation = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.JISInfotextDepartureTransformation);
|
|
119
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2D;AAC3D,oDAA+C;
|
|
1
|
+
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAA0D;AAC1D,gDAA2D;AAC3D,oD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AAY,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC9E;QACL,CAAC,CAAA,CAAC;QAjIE,IAAI,CAAC,8BAA8B,GAAG,IAAI,iCAA8B,EAAE,CAAC;QAC3E,IAAI,CAAC,oBAAoB,GAAG,IAAI,kCAAoB,CAChD,mBAAc,CAAC,OAAO,CAAqB,qBAAS,CAAC,iBAAiB,CAAC,EACvE,mBAAc,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAChE,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,mBAAc,CAAC,OAAO,CAAwB,uBAAU,CAAC,qBAAqB,CAAC,CAAC;QAC1G,IAAI,CAAC,sBAAsB,GAAG,mBAAc,CAAC,OAAO,CAChD,uBAAU,CAAC,kCAAkC,CAChD,CAAC;IACN,CAAC;CAyHJ;AAEQ,0DAAuB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DepartureFilter,
|
|
1
|
+
import { DepartureFilter, DepartureUnion } from "../..";
|
|
2
2
|
/** SplitDepartures type
|
|
3
3
|
* Departures in once array are the ones we want to show on Departure board.
|
|
4
4
|
* Fill array is only used for some filters allowing to fill final result with
|
|
@@ -6,10 +6,10 @@ import { DepartureFilter, IPIDDeparture } from "../..";
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export type SplitDepartures = {
|
|
9
|
-
once:
|
|
10
|
-
fill:
|
|
9
|
+
once: DepartureUnion[];
|
|
10
|
+
fill: DepartureUnion[];
|
|
11
11
|
};
|
|
12
|
-
export type AccumulatorCondition = (accumulator: SplitDepartures, currentDeparture:
|
|
12
|
+
export type AccumulatorCondition = (accumulator: SplitDepartures, currentDeparture: DepartureUnion) => boolean;
|
|
13
13
|
export declare class FilterHelper {
|
|
14
14
|
static routeOnceHeadingCondition: AccumulatorCondition;
|
|
15
15
|
static routeOnceHeadingNoGapCondition: AccumulatorCondition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterHelper.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/FilterHelper.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"FilterHelper.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/FilterHelper.ts"],"names":[],"mappings":";;;;AAAA,+BAA0D;AAW1D,MAAa,YAAY;IAyBd,MAAM,CAAC,gBAAgB,CAAC,MAAuB;QAClD,OAAO,CACH,MAAM,KAAK,qBAAe,CAAC,eAAe;YAC1C,MAAM,KAAK,qBAAe,CAAC,uBAAuB;YAClD,MAAM,KAAK,qBAAe,CAAC,6BAA6B,CAC3D,CAAC;IACN,CAAC;;AA/BL,oCA2EC;;AA1EiB,sCAAyB,GAAyB,CAC5D,WAA4B,EAC5B,gBAAgC,EAClC,EAAE;IACA,+EAA+E;IAC/E,OAAO,CAAC,EAAI,CAAC,yBAAyB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC1E,CAAC,AANsC,CAMrC;AAEY,2CAA8B,GAAyB,CACjE,WAA4B,EAC5B,gBAAgC,EAClC,EAAE;IACA,wHAAwH;IACxH,OAAO,CACH,CAAC,EAAI,CAAC,iCAAiC,CAAC,WAAW,EAAE,gBAAgB,CAAC;QACtE,CAAC,EAAI,CAAC,cAAc,CAAC,WAAW,EAAE,gBAAgB,CAAC,CACtD,CAAC;AACN,CAAC,AAT2C,CAS1C;AAEY,+BAAkB,GAAyB,CAAC,WAA4B,EAAE,gBAAgC,EAAE,EAAE;IACxH,mEAAmE;IACnE,OAAO,CAAC,EAAI,CAAC,cAAc,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC/D,CAAC,AAH+B,CAG9B;AAUa,2BAAc,GAAyB,CAAC,WAA4B,EAAE,gBAAgC,EAAE,EAAE;IACrH,OAAO,CACH,WAAW,CAAC,IAAI,CAAC,SAAS,CACtB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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,AAF4B,CAE3B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IPIDDeparture } from "../..";
|
|
1
|
+
import { DepartureUnion, IPIDDeparture, ITransferDeparture } from "../..";
|
|
2
2
|
import IPIDDepartureQueryOptions from "./interfaces/IPIDDepartureQueryOptions";
|
|
3
3
|
export default class PIDDeparturesModel {
|
|
4
4
|
private departures;
|
|
5
5
|
private options;
|
|
6
6
|
private static FilterConditionMap;
|
|
7
|
-
constructor(departures:
|
|
8
|
-
toArray: () =>
|
|
7
|
+
constructor(departures: DepartureUnion[], options: IPIDDepartureQueryOptions);
|
|
8
|
+
toArray: () => IPIDDeparture[];
|
|
9
|
+
processAndReturnTransfers(): ITransferDeparture[];
|
|
9
10
|
private toArrayInternal;
|
|
10
11
|
/** Orders departures in special way by given options
|
|
11
12
|
*/
|
|
@@ -12,13 +12,14 @@ class PIDDeparturesModel {
|
|
|
12
12
|
this.toArrayInternal();
|
|
13
13
|
return DepartureBoardMapper_1.default.mapDepartures(this, this.options.timezone, this.options.mode);
|
|
14
14
|
};
|
|
15
|
-
this.toArrayInternal = () => {
|
|
15
|
+
this.toArrayInternal = (shouldIncludeDirections = true) => {
|
|
16
16
|
this.skip();
|
|
17
17
|
this.sort();
|
|
18
18
|
this.filterAndLimit();
|
|
19
19
|
this.sort();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
if (shouldIncludeDirections) {
|
|
21
|
+
this.addDirections();
|
|
22
|
+
}
|
|
22
23
|
};
|
|
23
24
|
/** Orders departures in special way by given options
|
|
24
25
|
*/
|
|
@@ -41,10 +42,22 @@ class PIDDeparturesModel {
|
|
|
41
42
|
*/
|
|
42
43
|
this.skip = () => {
|
|
43
44
|
this.departures = this.departures.filter((departure) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
var _a, _b;
|
|
46
|
+
let isAtStop = false;
|
|
47
|
+
let isPassStop = false;
|
|
48
|
+
let isCurrentTrip = false;
|
|
49
|
+
if ("arrival_datetime" in departure) {
|
|
50
|
+
isAtStop = departure.stop_sequence === departure["trip.last_position.this_stop_sequence"];
|
|
51
|
+
isPassStop =
|
|
52
|
+
!!departure["trip.last_position.last_stop_sequence"] &&
|
|
53
|
+
departure.stop_sequence <= departure["trip.last_position.last_stop_sequence"];
|
|
54
|
+
}
|
|
55
|
+
else if (this.options.tripNumber) {
|
|
56
|
+
// Skip transfers of current trip (in the vehicle in which the transfer board is located)
|
|
57
|
+
isCurrentTrip = (_b = (_a = departure.trip_short_name) === null || _a === void 0 ? void 0 : _a.endsWith(this.options.tripNumber)) !== null && _b !== void 0 ? _b : false;
|
|
58
|
+
}
|
|
59
|
+
return !(isCurrentTrip ||
|
|
60
|
+
(this.options.skip.includes(pid_1.DepartureSkip.UNTRACKED) && !departure.is_delay_available) ||
|
|
48
61
|
(this.options.skip.includes(pid_1.DepartureSkip.CANCELED) && departure.is_canceled) ||
|
|
49
62
|
(this.options.skip.includes(pid_1.DepartureSkip.AT_STOP) && (isAtStop || isPassStop)));
|
|
50
63
|
});
|
|
@@ -66,6 +79,9 @@ class PIDDeparturesModel {
|
|
|
66
79
|
this.addDirections = () => {
|
|
67
80
|
this.departures.forEach((departure) => {
|
|
68
81
|
var _a;
|
|
82
|
+
if (!("arrival_datetime" in departure)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
69
85
|
departure.direction = departure.direction || null;
|
|
70
86
|
const thisStopDeparturesDirections = this.options.departuresDirections.filter((departuresDirection) => departuresDirection.departure_stop_id === departure.stop_id);
|
|
71
87
|
if (thisStopDeparturesDirections.length > 0) {
|
|
@@ -81,9 +97,16 @@ class PIDDeparturesModel {
|
|
|
81
97
|
this.departures = departures;
|
|
82
98
|
this.options = options;
|
|
83
99
|
}
|
|
100
|
+
processAndReturnTransfers() {
|
|
101
|
+
this.toArrayInternal(false);
|
|
102
|
+
// ITransferDeparture is a subset of IPIDDeparture
|
|
103
|
+
return this.departures;
|
|
104
|
+
}
|
|
84
105
|
filterDepartures() {
|
|
85
106
|
const filterCondition = PIDDeparturesModel.FilterConditionMap[this.options.filter];
|
|
86
|
-
return filterCondition
|
|
107
|
+
return filterCondition
|
|
108
|
+
? this.filterByCondition(filterCondition)
|
|
109
|
+
: { once: this.departures, fill: [] };
|
|
87
110
|
}
|
|
88
111
|
filterByCondition(conditionFunction) {
|
|
89
112
|
return this.departures.reduce((acc, currentDeparture) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PIDDepartureModel.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/PIDDepartureModel.ts"],"names":[],"mappings":";;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"PIDDepartureModel.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/PIDDepartureModel.ts"],"names":[],"mappings":";;;;;AAAA,+BAQiB;AACjB,8FAAwE;AACxE,iDAAoE;AAGpE,MAAqB,kBAAkB;IAcnC,YAAY,UAA4B,EAAE,OAAkC;QAKrE,YAAO,GAAG,GAAoB,EAAE;YACnC,IAAI,CAAC,eAAe,EAAE,CAAC;YAEvB,OAAO,8BAAoB,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9F,CAAC,CAAC;QASM,oBAAe,GAAG,CAAC,uBAAuB,GAAG,IAAI,EAAE,EAAE;YACzD,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YAEZ,IAAI,uBAAuB,EAAE;gBACzB,IAAI,CAAC,aAAa,EAAE,CAAC;aACxB;QACL,CAAC,CAAC;QAEF;WACG;QACK,mBAAc,GAAG,GAAS,EAAE;YAChC,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAEhD,I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AAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEnF,OAAO,eAAe;YAClB,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;YACzC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,EAAsB,EAAE,CAAC;IAClE,CAAC;IAEO,iBAAiB,CAAC,iBAAuC;QAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC,GAAG,EAAE,gBAAgB,EAAE,EAAE;YACtB,IAAI,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE;gBAC1C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnC;iBAAM;gBACH,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnC;YACD,OAAO,GAAG,CAAC;QACf,CAAC,EACD,EAAE,IAAI,EAAE,EAAsB,EAAE,IAAI,EAAE,EAAsB,EAAE,CACjE,CAAC;IACN,CAAC;;AAlJc,qCAAkB,GAA8D;IAC3F,SAAS,EAAE,2BAAY,CAAC,kBAAkB;IAC1C,aAAa,EAAE,2BAAY,CAAC,kBAAkB;IAC9C,gBAAgB,EAAE,2BAAY,CAAC,yBAAyB;IACxD,oBAAoB,EAAE,2BAAY,CAAC,yBAAyB;IAC5D,qBAAqB,EAAE,2BAAY,CAAC,8BAA8B;IAClE,yBAAyB,EAAE,2BAAY,CAAC,8BAA8B;IACtE,IAAI,EAAE,SAAS;CAClB,AARgC,CAQ/B;kBAZe,kBAAkB"}
|
|
@@ -2,6 +2,7 @@ import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRoute
|
|
|
2
2
|
export declare class V3PIDRouter extends AbstractRouter {
|
|
3
3
|
readonly router: import("express-serve-static-core").Router;
|
|
4
4
|
private readonly cacheHeaderMiddleware;
|
|
5
|
+
private readonly transferBoardsController;
|
|
5
6
|
private readonly infotextsController;
|
|
6
7
|
constructor();
|
|
7
8
|
protected initRoutes: () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.v3PidRouter = exports.V3PIDRouter = void 0;
|
|
4
|
+
const ParamValidatorManager_1 = require("../../helpers/ParamValidatorManager");
|
|
4
5
|
const Di_1 = require("../../ioc/Di");
|
|
5
6
|
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
6
7
|
const constants_1 = require("../../../shared/constants");
|
|
@@ -8,6 +9,7 @@ const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRou
|
|
|
8
9
|
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
9
10
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
10
11
|
const express_1 = require("@golemio/core/dist/shared/express");
|
|
12
|
+
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
11
13
|
class V3PIDRouter extends AbstractRouter_1.AbstractRouter {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(constants_1.RouteVersion.v3, "pid");
|
|
@@ -16,11 +18,19 @@ class V3PIDRouter extends AbstractRouter_1.AbstractRouter {
|
|
|
16
18
|
this.registerInfotextsRoutes();
|
|
17
19
|
};
|
|
18
20
|
this.registerInfotextsRoutes = () => {
|
|
21
|
+
this.router.get("/transferboards", [
|
|
22
|
+
(0, express_validator_1.query)("cisId").exists().isInt().not().isArray(),
|
|
23
|
+
(0, express_validator_1.query)("tripNumber").exists().isInt().not().isArray(),
|
|
24
|
+
(0, express_validator_1.query)("timeFrom").optional().isISO8601().custom(ParamValidatorManager_1.ParamValidatorManager.getTimeFromValidator()).not().isArray(),
|
|
25
|
+
], Validation_1.checkErrors,
|
|
26
|
+
// max-age 5 seconds, stale-while-revalidate 5 seconds
|
|
27
|
+
this.cacheHeaderMiddleware.getMiddleware(5, 5), this.transferBoardsController.getTransferDepartures);
|
|
19
28
|
this.router.get("/infotexts", Validation_1.checkErrors,
|
|
20
29
|
// max-age 10 seconds, stale-while-revalidate 10 seconds
|
|
21
30
|
this.cacheHeaderMiddleware.getMiddleware(10, 10), this.infotextsController.getJisInfotexts);
|
|
22
31
|
};
|
|
23
32
|
this.cacheHeaderMiddleware = Di_1.OgPidContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
|
|
33
|
+
this.transferBoardsController = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.V3TransferBoardsController);
|
|
24
34
|
this.infotextsController = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.V3InfotextsController);
|
|
25
35
|
this.initRoutes();
|
|
26
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V3PIDRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/routers/v3/V3PIDRouter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"V3PIDRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/routers/v3/V3PIDRouter.ts"],"names":[],"mappings":";;;AAEA,+EAA8E;AAC9E,qCAAgD;AAChD,qDAAoD;AACpD,yDAAoD;AACpD,sFAAmF;AAEnF,6EAA2E;AAC3E,+DAAuE;AACvE,+DAA2D;AAC3D,mFAAoE;AAEpE,MAAa,WAAY,SAAQ,+BAAc;IAM3C;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QANlB,WAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QAaxB,eAAU,GAAG,GAAS,EAAE;YAC9B,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACnC,CAAC,CAAC;QAEM,4BAAuB,GAAG,GAAG,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,iBAAiB,EACjB;gBACI,IAAA,yBAAK,EAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBAC/C,IAAA,yBAAK,EAAC,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;gBACpD,IAAA,yBAAK,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,6CAAqB,CAAC,oBAAoB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;aAChH,EACD,wBAAW;YACX,sDAAsD;YACtD,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,IAAI,CAAC,wBAAwB,CAAC,qBAAqB,CACtD,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,YAAY,EACZ,wBAAW;YACX,wDAAwD;YACxD,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,CAAC,EAChD,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAC3C,CAAC;QACN,CAAC,CAAC;QA/BE,IAAI,CAAC,qBAAqB,GAAG,mBAAc,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACjH,IAAI,CAAC,wBAAwB,GAAG,mBAAc,CAAC,OAAO,CAA6B,uBAAU,CAAC,0BAA0B,CAAC,CAAC;QAC1H,IAAI,CAAC,mBAAmB,GAAG,mBAAc,CAAC,OAAO,CAAwB,uBAAU,CAAC,qBAAqB,CAAC,CAAC;QAC3G,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CA4BJ;AAxCD,kCAwCC;AAED,MAAM,WAAW,GAAmB,IAAI,WAAW,EAAE,CAAC;AAC7C,kCAAW"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JISInfotextRepository } from "../../data-access/JISInfotextRepository";
|
|
2
|
+
import { IInfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
|
|
3
|
+
import { Moment } from "@golemio/core/dist/shared/moment-timezone";
|
|
4
|
+
import { JISInfotextTransferTransformation } from "../transformations/JISInfotextTransferTransformation";
|
|
5
|
+
export declare class InfotextFacade {
|
|
6
|
+
private infotextRepository;
|
|
7
|
+
private infotextTransformation;
|
|
8
|
+
constructor(infotextRepository: JISInfotextRepository, infotextTransformation: JISInfotextTransferTransformation);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves active infotexts for given GTFS stop IDs
|
|
11
|
+
*/
|
|
12
|
+
getInfotextsForTransferBoards(stopIds: string[], currentMoment: Moment, timeFrom: Moment | null): Promise<IInfotextTransferOutputDto[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.InfotextFacade = void 0;
|
|
25
|
+
const JISInfotextRepository_1 = require("../../data-access/JISInfotextRepository");
|
|
26
|
+
const OgPidToken_1 = require("../../ioc/OgPidToken");
|
|
27
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
28
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
+
const JISInfotextTransferTransformation_1 = require("../transformations/JISInfotextTransferTransformation");
|
|
30
|
+
let InfotextFacade = exports.InfotextFacade = class InfotextFacade {
|
|
31
|
+
constructor(infotextRepository, infotextTransformation) {
|
|
32
|
+
this.infotextRepository = infotextRepository;
|
|
33
|
+
this.infotextTransformation = infotextTransformation;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves active infotexts for given GTFS stop IDs
|
|
37
|
+
*/
|
|
38
|
+
getInfotextsForTransferBoards(stopIds, currentMoment, timeFrom) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
let infotexts = [];
|
|
41
|
+
try {
|
|
42
|
+
const infotextEntities = yield this.infotextRepository.findAllForDepartureBoard(stopIds, timeFrom ? timeFrom.toDate() : currentMoment.toDate());
|
|
43
|
+
infotexts = this.infotextTransformation.transformArray(infotextEntities);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
throw new golemio_errors_1.GeneralError("Failed to retrieve infotexts", this.constructor.name, error, 500);
|
|
50
|
+
}
|
|
51
|
+
return infotexts;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.InfotextFacade = InfotextFacade = __decorate([
|
|
56
|
+
(0, tsyringe_1.injectable)(),
|
|
57
|
+
__param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextRepository)),
|
|
58
|
+
__param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextTransferTransformation)),
|
|
59
|
+
__metadata("design:paramtypes", [JISInfotextRepository_1.JISInfotextRepository,
|
|
60
|
+
JISInfotextTransferTransformation_1.JISInfotextTransferTransformation])
|
|
61
|
+
], InfotextFacade);
|
|
62
|
+
//# sourceMappingURL=InfotextFacade.js.map
|