@golemio/pid 3.5.1-dev.1632495980 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js +1 -2
- package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js +3 -1
- package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +5 -4
- package/dist/output-gateway/pid/index.js +0 -1
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/ioc/Di.js +0 -4
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
- package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +0 -2
- package/dist/output-gateway/pid/ioc/OgPidToken.js +0 -2
- package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.d.ts +28 -14
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +72 -192
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +15 -26
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/SkipHelper.d.ts +0 -11
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js +0 -91
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/interfaces/IPIDDepartureQueryOptions.d.ts +0 -3
- package/dist/output-gateway/pid/service/facade/TransferFacade.js +0 -2
- package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.d.ts +2 -4
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +68 -90
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
- package/dist/output-gateway/public/domain/repository/IVehiclePositionsRepository.d.ts +1 -2
- package/dist/output-gateway/shared/constants/validations.js +1 -1
- package/dist/output-gateway/shared/constants/validations.js.map +1 -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/docs/openapi-output.yaml +2 -10
- package/package.json +3 -3
- package/db/migrations/postgresql/20250103092631-skip-missing.js +0 -53
- package/db/migrations/postgresql/sqls/20250103092631-skip-missing-down.sql +0 -184
- package/db/migrations/postgresql/sqls/20250103092631-skip-missing-up.sql +0 -195
- package/dist/output-gateway/pid/domain/DepartureInterfaces.d.ts +0 -7
- package/dist/output-gateway/pid/domain/DepartureInterfaces.js +0 -3
- package/dist/output-gateway/pid/domain/DepartureInterfaces.js.map +0 -1
- package/dist/output-gateway/pid/models/helpers/const.d.ts +0 -4
- package/dist/output-gateway/pid/models/helpers/const.js +0 -8
- package/dist/output-gateway/pid/models/helpers/const.js.map +0 -1
- package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.d.ts +0 -21
- package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.js +0 -3
- package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.js.map +0 -1
- package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.d.ts +0 -10
- package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.js +0 -65
- package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.js.map +0 -1
- package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.d.ts +0 -4
- package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.js +0 -3
- package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RunTripsRedisRepository = void 0;
|
|
4
|
-
const const_1 = require("../../../../schema-definitions/ropid-gtfs/redis/const");
|
|
5
4
|
const GtfsRunTripCacheDtoSchema_1 = require("../../../../schema-definitions/vehicle-positions/redis/schemas/GtfsRunTripCacheDtoSchema");
|
|
6
5
|
const RedisModel_1 = require("@golemio/core/dist/integration-engine/models/RedisModel");
|
|
7
6
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
@@ -16,5 +15,5 @@ class RunTripsRedisRepository extends RedisModel_1.RedisModel {
|
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
exports.RunTripsRedisRepository = RunTripsRedisRepository;
|
|
19
|
-
RunTripsRedisRepository.NAMESPACE_PREFIX =
|
|
18
|
+
RunTripsRedisRepository.NAMESPACE_PREFIX = "gtfsRunSchedule";
|
|
20
19
|
//# sourceMappingURL=RunTripsRedisRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunTripsRedisRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"RunTripsRedisRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.ts"],"names":[],"mappings":";;;AAAA,wIAA2G;AAC3G,wFAAqF;AACrF,mFAAkF;AAElF,MAAa,uBAAwB,SAAQ,uBAAU;IAGnD;QACI,KAAK,CACD,6BAA6B,EAC7B;YACI,kBAAkB,EAAE,IAAI,CAAC,KAAK;YAC9B,oBAAoB,EAAE,IAAI,CAAC,SAAS;YACpC,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,uBAAuB,CAAC,gBAAgB;SACnD,EACD,IAAI,uCAAmB,CAAC,sCAAsC,EAAE,qDAAyB,CAAC,CAC7F,CAAC;IACN,CAAC;;AAdL,0DAeC;AAdiB,wCAAgB,GAAG,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropagateTrainDelayTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.ts"],"names":[],"mappings":";;;AACA,sDAA2D;AAC3D,gGAAqF;AAErF,wEAAqE;AAErE,mEAAuF;AACvF,mEAAyD;AAGzD,mFAAqF;AACrF,sFAAmF;AAEnF,MAAa,uBAAwB,SAAQ,uDAAqD;IAU9F,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAVP,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,0DAA8B,CAAC;QAgEhD,sBAAiB,GAAG,KAAK,EAC7B,aAAiC,EACjC,eAAuB,EACI,EAAE;YAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBAC5C,UAAU,EAAE,CAAC,cAAc,CAAC;gBAC5B,KAAK,EAAE;oBACH,aAAa,EAAE,aAAa;oBAC5B,eAAe,EAAE,EAAE,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE;iBAChD;gBACD,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;gBACnC,GAAG,EAAE,IAAI;aACZ,CAAC,CAAC;YAEH,OAAO,IAAI,EAAE,YAAY,CAAC;QAC9B,CAAC,CAAC;QAtEE,IAAI,CAAC,MAAM,GAAG,gCAA0B,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAAC,CA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AE,gBAAgB,CAAC,QAAQ,CAAC,eAAe;oBACjE,YAAY,EAAE,gBAAgB,CAAC,QAAQ,CAAC,cAAc;oBACtD,yBAAyB,EAAE,2BAA2B;oBACtD,gBAAgB,EAAE,eAAe;oBACjC,cAAc,EAAE,aAAc;oBAC9B,cAAc,EAAE,gBAAgB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"PropagateTrainDelayTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.ts"],"names":[],"mappings":";;;AACA,sDAA2D;AAC3D,gGAAqF;AAErF,wEAAqE;AAErE,mEAAuF;AACvF,mEAAyD;AAGzD,mFAAqF;AACrF,sFAAmF;AAEnF,MAAa,uBAAwB,SAAQ,uDAAqD;IAU9F,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAVP,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,0DAA8B,CAAC;QAgEhD,sBAAiB,GAAG,KAAK,EAC7B,aAAiC,EACjC,eAAuB,EACI,EAAE;YAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBAC5C,UAAU,EAAE,CAAC,cAAc,CAAC;gBAC5B,KAAK,EAAE;oBACH,aAAa,EAAE,aAAa;oBAC5B,eAAe,EAAE,EAAE,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE;iBAChD;gBACD,KAAK,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;gBACnC,GAAG,EAAE,IAAI;aACZ,CAAC,CAAC;YAEH,OAAO,IAAI,EAAE,YAAY,CAAC;QAC9B,CAAC,CAAC;QAtEE,IAAI,CAAC,MAAM,GAAG,gCAA0B,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAA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B,EAAE,gBAAgB,CAAC,QAAQ,CAAC,eAAe;oBACjE,YAAY,EAAE,gBAAgB,CAAC,QAAQ,CAAC,cAAc;oBACtD,yBAAyB,EAAE,2BAA2B;oBACtD,gBAAgB,EAAE,eAAe;oBACjC,cAAc,EAAE,aAAc;oBAC9B,cAAc,EAAE,gBAAgB,CAAC,QAAQ,CAAC,OAAQ;oBAClD,aAAa,EAAE,cAAc;wBACzB,CAAC,CAAC;4BACI;gCACI,OAAO,EAAE,cAAc;gCACvB,yBAAyB,EAAE,yBAAyB;6BACvD;yBACJ;wBACH,CAAC,CAAC,EAAE;iBACX,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,GAAG,IAAI,CAAC,SAAS,oDAAoD,YAAY,MAAM,GAAG,CAAC,OAAO,EAAE,CACvG,CAAC;aACL;SACJ;IACL,CAAC;CAkBJ;AAnFD,0DAmFC"}
|
|
@@ -29,7 +29,7 @@ class V2DepartureBoardsController {
|
|
|
29
29
|
: undefined;
|
|
30
30
|
const span = (0, trace_provider_1.createChildSpan)("V2DepartureBoardsController.getDepartureBoard");
|
|
31
31
|
try {
|
|
32
|
-
const data = await this.departureBoardsModel.
|
|
32
|
+
const data = await this.departureBoardsModel.GetAll({
|
|
33
33
|
aswIds: query.aswIds,
|
|
34
34
|
cisIds: query.cisIds,
|
|
35
35
|
gtfsIds: query.ids,
|
|
@@ -48,6 +48,8 @@ class V2DepartureBoardsController {
|
|
|
48
48
|
includeMetroTrains: query.includeMetroTrains,
|
|
49
49
|
airCondition: query.airCondition,
|
|
50
50
|
});
|
|
51
|
+
// allow access response Date header
|
|
52
|
+
res.setHeader("access-control-expose-headers", "date");
|
|
51
53
|
res.status(200).send(shared_1.RopidRouterUtils.mapObjectToDTOInstance(dto_1.DepartureBoardsResponseDTO, data));
|
|
52
54
|
}
|
|
53
55
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2DepartureBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/controllers/v2/V2DepartureBoardsController.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAkF;AAClF,kFAAiF;AACjF,4CAA8C;AAC9C,+FAA6F;AAE7F,gGAA2E;AAE3E,MAAa,2BAA2B;IAGpC;QAIO,sBAAiB,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAChE,MAAM,KAAK,GAAG,yBAAgB,CAAC,sBAAsB,CAAC,6BAAuB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1F,MAAM,iBAAiB,GAAG,yBAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAEzF,oDAAoD;YACpD,cAAc;YACd,uBAAuB;YACvB,0BAA0B;YAC1B,yBAAyB;YACzB,4BAA4B;YAC5B,MAAM,qBAAqB,GAAW,uDAAuD,CAAC;YAC9F,+DAA+D;YAC/D,MAAM,QAAQ,GAAuB,KAAK,CAAC,QAAQ;gBAC/C,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,qBAAqB,CAAC;oBACzC,CAAC,CAAC,IAAA,yBAAM,EAAC,KAAK,CAAC,QAAQ,CAAC;oBACxB,CAAC,CAAC,yBAAM,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC;gBAClD,CAAC,CAAC,SAAS,CAAC;YAEhB,MAAM,IAAI,GAAG,IAAA,gCAAe,EAAC,+CAA+C,CAAC,CAAC;YAC9E,IAAI;gBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;oBAChD,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,OAAO,EAAE,KAAK,CAAC,GAAG;oBAClB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,YAAY,EAAE,KAAK,CAAC,YAAY;oBAChC,aAAa,EAAE,KAAK,CAAC,aAAa;oBAClC,QAAQ;oBACR,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK;oBACjC,QAAQ,EAAE,iBAAiB;oBAC3B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;oBAC5C,YAAY,EAAE,KAAK,CAAC,YAAY;iBACnC,CAAC,CAAC;gBACH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAgB,CAAC,sBAAsB,CAAC,gCAA0B,EAAE,IAAI,CAAC,CAAC,CAAC;aACnG;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;oBAAS;gBACN,IAAI,EAAE,GAAG,EAAE,CAAC;aACf;QACL,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"V2DepartureBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/controllers/v2/V2DepartureBoardsController.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAkF;AAClF,kFAAiF;AACjF,4CAA8C;AAC9C,+FAA6F;AAE7F,gGAA2E;AAE3E,MAAa,2BAA2B;IAGpC;QAIO,sBAAiB,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAChE,MAAM,KAAK,GAAG,yBAAgB,CAAC,sBAAsB,CAAC,6BAAuB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1F,MAAM,iBAAiB,GAAG,yBAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YA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CAAC;gBACH,oCAAoC;gBACpC,GAAG,CAAC,SAAS,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;gBACvD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAgB,CAAC,sBAAsB,CAAC,gCAA0B,EAAE,IAAI,CAAC,CAAC,CAAC;aACnG;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;oBAAS;gBACN,IAAI,EAAE,GAAG,EAAE,CAAC;aACf;QACL,CAAC,CAAC;QAlDE,IAAI,CAAC,oBAAoB,GAAG,IAAI,iDAAuB,EAAE,CAAC;IAC9D,CAAC;CAkDJ;AAvDD,kEAuDC"}
|
|
@@ -33,9 +33,6 @@ export interface IPIDDeparture {
|
|
|
33
33
|
departure_datetime_real: Date | null;
|
|
34
34
|
real_wheelchair_accessible: boolean | null;
|
|
35
35
|
is_canceled: boolean;
|
|
36
|
-
origin_route_name: string | null;
|
|
37
|
-
run_number: number | null;
|
|
38
|
-
"trip.start_timestamp": string | null;
|
|
39
36
|
"trip.last_position.last_stop_id": string | null;
|
|
40
37
|
"trip.last_position.last_stop_sequence": number | null;
|
|
41
38
|
"trip.last_position.last_stop_name": string | null;
|
|
@@ -112,6 +109,11 @@ export interface IStop {
|
|
|
112
109
|
stop_name: string;
|
|
113
110
|
platform_code: string;
|
|
114
111
|
}
|
|
112
|
+
export interface IDepartureBoard {
|
|
113
|
+
departures: IPIDDeparture[];
|
|
114
|
+
infotexts: any[];
|
|
115
|
+
stops: IStop[];
|
|
116
|
+
}
|
|
115
117
|
export interface IDepartureTime {
|
|
116
118
|
predicted: string | null;
|
|
117
119
|
scheduled: string | null;
|
|
@@ -137,7 +139,6 @@ export declare enum DepartureFilter {
|
|
|
137
139
|
}
|
|
138
140
|
export declare enum DepartureSkip {
|
|
139
141
|
UNTRACKED = "untracked",
|
|
140
|
-
MISSING = "missing",
|
|
141
142
|
CANCELED = "canceled",
|
|
142
143
|
AT_STOP = "atStop"
|
|
143
144
|
}
|
|
@@ -41,7 +41,6 @@ var DepartureFilter;
|
|
|
41
41
|
var DepartureSkip;
|
|
42
42
|
(function (DepartureSkip) {
|
|
43
43
|
DepartureSkip["UNTRACKED"] = "untracked";
|
|
44
|
-
DepartureSkip["MISSING"] = "missing";
|
|
45
44
|
DepartureSkip["CANCELED"] = "canceled";
|
|
46
45
|
DepartureSkip["AT_STOP"] = "atStop";
|
|
47
46
|
// ON_INFOTEXT = "onInfotext",
|
|
@@ -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,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OgPidContainer = void 0;
|
|
4
|
-
const PublicVehiclePositionsRepository_1 = require("../../public/data-access/redis/PublicVehiclePositionsRepository");
|
|
5
4
|
const CisStopGroupRepository_1 = require("../../ropid-gtfs/data-access/CisStopGroupRepository");
|
|
6
|
-
const RunTripsRedisRepository_1 = require("../../ropid-gtfs/data-access/redis/RunTripsRedisRepository");
|
|
7
5
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
8
6
|
const V3InfotextsController_1 = require("../controllers/v3/V3InfotextsController");
|
|
9
7
|
const V3TransferBoardsController_1 = require("../controllers/v3/V3TransferBoardsController");
|
|
@@ -26,8 +24,6 @@ ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRopidGTFSSto
|
|
|
26
24
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRopidGTFSStopsRepository, JISInfotextRopidGTFSStopsRepository_1.JISInfotextRopidGTFSStopsRepository);
|
|
27
25
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextRepository, JISInfotextRepository_1.JISInfotextRepository);
|
|
28
26
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.DeparturesRepository, data_access_1.DeparturesRepository);
|
|
29
|
-
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.RunTripsRedisRepository, RunTripsRedisRepository_1.RunTripsRedisRepository);
|
|
30
|
-
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.PublicVehiclePositionsRepository, PublicVehiclePositionsRepository_1.PublicVehiclePositionsRepository);
|
|
31
27
|
//#endregion
|
|
32
28
|
//#region Transformations
|
|
33
29
|
ogPidContainer.registerSingleton(OgPidToken_1.OgPidToken.JISInfotextDepartureTransformation, JISInfotextDepartureTransformation_1.JISInfotextDepartureTransformation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,
|
|
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"}
|
|
@@ -3,8 +3,6 @@ export declare const OgPidToken: {
|
|
|
3
3
|
JISInfotextRopidGTFSStopsRepository: symbol;
|
|
4
4
|
JISInfotextRepository: symbol;
|
|
5
5
|
DeparturesRepository: symbol;
|
|
6
|
-
RunTripsRedisRepository: symbol;
|
|
7
|
-
PublicVehiclePositionsRepository: symbol;
|
|
8
6
|
JISInfotextDepartureTransformation: symbol;
|
|
9
7
|
JISInfotextTransferTransformation: symbol;
|
|
10
8
|
JISInfotextOverviewTransformation: symbol;
|
|
@@ -7,8 +7,6 @@ exports.OgPidToken = {
|
|
|
7
7
|
JISInfotextRopidGTFSStopsRepository: Symbol(),
|
|
8
8
|
JISInfotextRepository: Symbol(),
|
|
9
9
|
DeparturesRepository: Symbol(),
|
|
10
|
-
RunTripsRedisRepository: Symbol(),
|
|
11
|
-
PublicVehiclePositionsRepository: Symbol(),
|
|
12
10
|
//#endregion
|
|
13
11
|
//#region Transformations
|
|
14
12
|
JISInfotextDepartureTransformation: Symbol(),
|
|
@@ -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,sBAAsB,EAAE,MAAM,EAAE;IAChC,mCAAmC,EAAE,MAAM,EAAE;IAC7C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,oBAAoB,EAAE,MAAM,EAAE;IAC9B,
|
|
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"}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Moment } from "@golemio/core/dist/shared/moment-timezone";
|
|
2
|
+
import { DepartureFilter, DepartureMode, DepartureOrder, DepartureSkip } from "..";
|
|
3
3
|
declare class PIDDepartureBoardsModel {
|
|
4
|
-
private
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private readonly runTripsRedisRepository;
|
|
8
|
-
private readonly positionsRedisRepository;
|
|
4
|
+
private stopsMaxCount;
|
|
5
|
+
private ropidDeparturesDirectionsModel;
|
|
6
|
+
private departuresRepository;
|
|
9
7
|
private readonly infotextRepository;
|
|
10
8
|
private readonly infotextTransformation;
|
|
11
9
|
constructor();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
/** Retrieves all gtfs stop times for specific stop, optionaly enhanced with realtime delays
|
|
11
|
+
* @param {string} id Id of the stop
|
|
12
|
+
* @returns Object of the retrieved record or null
|
|
13
|
+
*/
|
|
14
|
+
GetAll: (options: {
|
|
15
|
+
aswIds?: string[];
|
|
16
|
+
cisIds?: string[];
|
|
17
|
+
gtfsIds?: string[];
|
|
18
|
+
names?: string[];
|
|
19
|
+
total: number;
|
|
20
|
+
limit: number;
|
|
21
|
+
offset: number;
|
|
22
|
+
mode: DepartureMode;
|
|
23
|
+
minutesBefore: number;
|
|
24
|
+
minutesAfter: number;
|
|
25
|
+
timeFrom?: Moment;
|
|
26
|
+
order: DepartureOrder;
|
|
27
|
+
filter: DepartureFilter;
|
|
28
|
+
skip: DepartureSkip[];
|
|
29
|
+
includeMetroTrains?: boolean;
|
|
30
|
+
airCondition?: boolean;
|
|
31
|
+
timezone: string;
|
|
32
|
+
}) => Promise<any>;
|
|
19
33
|
}
|
|
20
34
|
export { PIDDepartureBoardsModel };
|
|
@@ -12,223 +12,103 @@ const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/tr
|
|
|
12
12
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
13
13
|
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
14
14
|
const _1 = require(".");
|
|
15
|
-
const __1 = require("..");
|
|
16
15
|
const Di_1 = require("../ioc/Di");
|
|
17
16
|
const OgPidToken_1 = require("../ioc/OgPidToken");
|
|
18
17
|
const PIDDepartureModel_1 = __importDefault(require("./helpers/PIDDepartureModel"));
|
|
19
|
-
const STOPS_MAX_COUNT = 100;
|
|
20
|
-
// TODO refactor - split into facade and multiple service/strategy classes
|
|
21
|
-
// Check V3TransferBoardsController and TransferFacade for inspiration
|
|
22
18
|
class PIDDepartureBoardsModel {
|
|
23
19
|
constructor() {
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//#region Data retrieval from DB (GTFS stops, infotexts, directions, departures)
|
|
35
|
-
const { stopsToInclude, stopIds } = await this.retrieveAndReturnStops(options);
|
|
36
|
-
const [infotextsToInclude, directions, departures] = await Promise.all([
|
|
37
|
-
this.retrieveAndReturnInfotexts(stopIds, currentMoment, options),
|
|
38
|
-
this.retrieveAndReturnDirections(stopIds),
|
|
39
|
-
this.retrieveAndReturnDepartures(stopIds, currentMoment, options),
|
|
40
|
-
]);
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region Data retrieval from Redis (run schedule, untracked trips)
|
|
43
|
-
let runScheduleMap = new Map();
|
|
44
|
-
let untrackedTrips = new Set();
|
|
45
|
-
const isMissingRequested = options.skip.includes(__1.DepartureSkip.MISSING) && !options.skip.includes(__1.DepartureSkip.UNTRACKED);
|
|
46
|
-
// Note: The run schedule and untracked trips are populated only if the skip[]=missing (without untracked) is present
|
|
47
|
-
// Check the PIDDeparturesModel.skip function. In other cases they are not needed
|
|
48
|
-
if (isMissingRequested) {
|
|
49
|
-
const runTuples = new Set();
|
|
50
|
-
for (const departure of departures) {
|
|
51
|
-
runTuples.add(`${departure.origin_route_name}_${departure.run_number}`);
|
|
52
|
-
}
|
|
53
|
-
const { runSchedule, runTripIds } = await this.retrieveAndReturnRunTrips(runTuples);
|
|
54
|
-
runScheduleMap = runSchedule;
|
|
55
|
-
untrackedTrips = await this.retrieveAndReturnUntrackedTrips(runTripIds);
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region Processing and returning departures
|
|
59
|
-
const spanProcessing = (0, trace_provider_1.createChildSpan)("V2PIDRouter.Processing");
|
|
60
|
-
try {
|
|
61
|
-
const departuresToInclude = new PIDDepartureModel_1.default(departures, {
|
|
62
|
-
limit: options.limit,
|
|
63
|
-
offset: options.offset,
|
|
64
|
-
total: options.total,
|
|
65
|
-
mode: options.mode,
|
|
66
|
-
order: options.order,
|
|
67
|
-
filter: options.filter,
|
|
68
|
-
skip: options.skip,
|
|
69
|
-
departuresDirections: directions,
|
|
70
|
-
timezone: options.timezone,
|
|
71
|
-
tripNumber: null,
|
|
72
|
-
runScheduleMap,
|
|
73
|
-
untrackedTrips,
|
|
74
|
-
}).toArray();
|
|
75
|
-
spanProcessing?.end();
|
|
76
|
-
return {
|
|
77
|
-
departures: departuresToInclude,
|
|
78
|
-
infotexts: infotextsToInclude,
|
|
79
|
-
stops: stopsToInclude,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
spanProcessing?.recordException(error);
|
|
84
|
-
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
throw new golemio_errors_1.GeneralError("Error while processing departures", this.constructor.name, error, 500);
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
}
|
|
91
|
-
async retrieveAndReturnStops(options) {
|
|
92
|
-
const spanStops = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.stops");
|
|
93
|
-
spanStops?.setAttributes({ ...options, timeFrom: options.timeFrom?.toString() });
|
|
94
|
-
try {
|
|
20
|
+
this.stopsMaxCount = 100;
|
|
21
|
+
/** Retrieves all gtfs stop times for specific stop, optionaly enhanced with realtime delays
|
|
22
|
+
* @param {string} id Id of the stop
|
|
23
|
+
* @returns Object of the retrieved record or null
|
|
24
|
+
*/
|
|
25
|
+
this.GetAll = async (options) => {
|
|
26
|
+
const currentMoment = (0, moment_timezone_1.default)();
|
|
27
|
+
const minutesOffset = options.timeFrom ? options.timeFrom.diff(currentMoment, "minutes") : 0;
|
|
28
|
+
const spanStops = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.stops");
|
|
29
|
+
spanStops?.setAttributes({ ...options, timeFrom: options.timeFrom?.toString() });
|
|
95
30
|
const stopsToInclude = await models_1.models.GTFSStopModel.GetAll({
|
|
96
31
|
includeMetroTrains: options.includeMetroTrains,
|
|
97
32
|
appendAswId: true,
|
|
98
33
|
aswIds: options.aswIds,
|
|
99
34
|
cisIds: options.cisIds,
|
|
100
35
|
gtfsIds: options.gtfsIds,
|
|
101
|
-
limit:
|
|
36
|
+
limit: this.stopsMaxCount + 1,
|
|
102
37
|
locationType: StopEnums_1.GtfsStopLocationType.StopOrPlatform,
|
|
103
38
|
names: options.names,
|
|
104
39
|
returnRaw: true,
|
|
105
40
|
});
|
|
106
41
|
if (stopsToInclude.length === 0) {
|
|
107
|
-
throw new golemio_errors_1.GeneralError("No stops found.",
|
|
42
|
+
throw new golemio_errors_1.GeneralError("No stops found.", "DepartureBoardsRouter", undefined, 404);
|
|
108
43
|
}
|
|
109
|
-
|
|
110
|
-
throw new golemio_errors_1.GeneralError(`Too many stops, try lower number or split requests. The maximum is ${
|
|
44
|
+
if (stopsToInclude.length > this.stopsMaxCount) {
|
|
45
|
+
throw new golemio_errors_1.GeneralError(`Too many stops, try lower number or split requests. The maximum is ${this.stopsMaxCount} stops.`, "DepartureBoardsRouter", undefined, 413);
|
|
111
46
|
}
|
|
112
|
-
const
|
|
47
|
+
const stopsIds = stopsToInclude.map((e) => e.stop_id);
|
|
113
48
|
spanStops?.end();
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
49
|
+
const spanInfotexts = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.infotexts");
|
|
50
|
+
let infotextsToInclude;
|
|
51
|
+
try {
|
|
52
|
+
const infotexts = await this.infotextRepository.findAllForDepartureBoard(stopsIds, (options.timeFrom ?? currentMoment).toDate());
|
|
53
|
+
infotextsToInclude = this.infotextTransformation.transformArray(infotexts.map((infotext) => ({
|
|
54
|
+
data: infotext,
|
|
55
|
+
timeZone: options.timezone,
|
|
56
|
+
})));
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
if (err instanceof golemio_errors_1.AbstractGolemioError) {
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
throw new golemio_errors_1.GeneralError("Database error", "DepartureBoardsModel", err, 500);
|
|
120
63
|
}
|
|
121
|
-
throw new golemio_errors_1.GeneralError("Error while getting stops", this.constructor.name, error, 500);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async retrieveAndReturnInfotexts(stopIds, currentMoment, options) {
|
|
125
|
-
const spanInfotexts = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.infotexts");
|
|
126
|
-
try {
|
|
127
|
-
const infotexts = await this.infotextRepository.findAllForDepartureBoard(stopIds, (options.timeFrom ?? currentMoment).toDate());
|
|
128
|
-
const infotextsToInclude = this.infotextTransformation.transformArray(infotexts.map((infotext) => ({
|
|
129
|
-
data: infotext,
|
|
130
|
-
timeZone: options.timezone,
|
|
131
|
-
})));
|
|
132
64
|
spanInfotexts?.end();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
138
|
-
throw error;
|
|
65
|
+
const spanDirections = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.directions");
|
|
66
|
+
let departuresDirections;
|
|
67
|
+
try {
|
|
68
|
+
departuresDirections = await this.ropidDeparturesDirectionsModel.GetAll(stopsIds);
|
|
139
69
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
async retrieveAndReturnDirections(stopIds) {
|
|
144
|
-
const spanDirections = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.directions");
|
|
145
|
-
try {
|
|
146
|
-
const departuresDirections = await this.ropidDeparturesDirectionsModel.GetAll(stopIds);
|
|
147
|
-
spanDirections?.end();
|
|
148
|
-
return departuresDirections;
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
spanDirections?.recordException(error);
|
|
152
|
-
if (error instanceof golemio_errors_1.AbstractGolemioError) {
|
|
153
|
-
throw error;
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw new golemio_errors_1.GeneralError("Database error", "DepartureBoardsModel", err, 500);
|
|
154
72
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
73
|
+
spanDirections?.end();
|
|
74
|
+
try {
|
|
75
|
+
const results = await this.departuresRepository.GetAll({
|
|
76
|
+
currentMoment,
|
|
77
|
+
minutesAfter: options.minutesAfter,
|
|
78
|
+
minutesBefore: options.minutesBefore,
|
|
79
|
+
minutesOffset,
|
|
80
|
+
stopsIds,
|
|
81
|
+
mode: options.mode,
|
|
82
|
+
isAirCondition: !!options.airCondition,
|
|
83
|
+
});
|
|
84
|
+
const spanDepartures = (0, trace_provider_1.createChildSpan)("V2PIDRouter.DB.departures");
|
|
85
|
+
const res = {
|
|
86
|
+
departures: new PIDDepartureModel_1.default(results, {
|
|
87
|
+
limit: options.limit,
|
|
88
|
+
offset: options.offset,
|
|
89
|
+
total: options.total,
|
|
90
|
+
mode: options.mode,
|
|
91
|
+
order: options.order,
|
|
92
|
+
filter: options.filter,
|
|
93
|
+
skip: options.skip,
|
|
94
|
+
departuresDirections,
|
|
95
|
+
timezone: options.timezone,
|
|
96
|
+
tripNumber: null, // not used in this context
|
|
97
|
+
}).toArray(),
|
|
98
|
+
infotexts: infotextsToInclude,
|
|
99
|
+
stops: stopsToInclude,
|
|
100
|
+
};
|
|
101
|
+
spanDepartures?.end();
|
|
102
|
+
return res;
|
|
179
103
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
async retrieveAndReturnRunTrips(runTuples) {
|
|
184
|
-
const runScheduleMap = new Map();
|
|
185
|
-
const tripIds = new Set();
|
|
186
|
-
const spanRunTrips = (0, trace_provider_1.createChildSpan)("V2PIDRouter.Redis.runTrips");
|
|
187
|
-
try {
|
|
188
|
-
const runTuplesArray = Array.from(runTuples);
|
|
189
|
-
const runSchedule = await this.runTripsRedisRepository.getMultipleSchedule(runTuplesArray);
|
|
190
|
-
for (let i = 0; i < runSchedule.length; i++) {
|
|
191
|
-
const runTrip = runSchedule[i];
|
|
192
|
-
if (runTrip) {
|
|
193
|
-
const tuple = runTuplesArray[i];
|
|
194
|
-
runScheduleMap.set(tuple, runTrip.schedule);
|
|
195
|
-
for (const trip of runTrip.schedule) {
|
|
196
|
-
tripIds.add(trip.trip_id);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
throw new golemio_errors_1.GeneralError("Database error", "DepartureBoardsModel", err, 500);
|
|
199
106
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
// eslint-disable-next-line max-len
|
|
206
|
-
"Cannot retrieve run schedule. The API consumer will receive departures with missing vehicles even if they requested to skip them.");
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
return {
|
|
210
|
-
runSchedule: runScheduleMap,
|
|
211
|
-
runTripIds: tripIds,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
async retrieveAndReturnUntrackedTrips(tripIds) {
|
|
216
|
-
let untrackedTrips = new Set();
|
|
217
|
-
const spanUntrackedTrips = (0, trace_provider_1.createChildSpan)("V2PIDRouter.Redis.untrackedTrips");
|
|
218
|
-
try {
|
|
219
|
-
const tripIdsArray = Array.from(tripIds);
|
|
220
|
-
untrackedTrips = await this.positionsRedisRepository.getTripsWithUntrackedVehicles(tripIdsArray);
|
|
221
|
-
spanUntrackedTrips?.end();
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
spanUntrackedTrips?.recordException(error);
|
|
225
|
-
this.log.error(error,
|
|
226
|
-
// eslint-disable-next-line max-len
|
|
227
|
-
"Cannot retrieve untracked trips. The API consumer will receive departures with missing vehicles even if they requested to skip them.");
|
|
228
|
-
}
|
|
229
|
-
finally {
|
|
230
|
-
return untrackedTrips;
|
|
231
|
-
}
|
|
107
|
+
};
|
|
108
|
+
this.ropidDeparturesDirectionsModel = new _1.RopidDeparturesDirectionsModel();
|
|
109
|
+
this.departuresRepository = new data_access_1.DeparturesRepository(Di_1.OgPidContainer.resolve(CoreToken_1.CoreToken.PostgresConnector), Di_1.OgPidContainer.resolve(CoreToken_1.CoreToken.SimpleConfig));
|
|
110
|
+
this.infotextRepository = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.JISInfotextRepository);
|
|
111
|
+
this.infotextTransformation = Di_1.OgPidContainer.resolve(OgPidToken_1.OgPidToken.JISInfotextDepartureTransformation);
|
|
232
112
|
}
|
|
233
113
|
}
|
|
234
114
|
exports.PIDDepartureBoardsModel = PIDDepartureBoardsModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA0D;AAC1D,gDAA2D;
|
|
1
|
+
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA0D;AAC1D,gDAA2D;AAC3D,oDAA+C;AAI/C,wEAAqE;AACrE,+FAA6F;AAC7F,6EAA8F;AAC9F,gGAA2E;AA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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;CA0HJ;AAEQ,0DAAuB"}
|
|
@@ -43,34 +43,23 @@ class PIDDeparturesModel {
|
|
|
43
43
|
*/
|
|
44
44
|
this.skip = () => {
|
|
45
45
|
this.departures = this.departures.filter((departure) => {
|
|
46
|
-
|
|
47
|
-
|
|
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"];
|
|
48
54
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let isSkipAtStop = false;
|
|
53
|
-
for (const skip of this.options.skip) {
|
|
54
|
-
if (skip === pid_1.DepartureSkip.UNTRACKED) {
|
|
55
|
-
isSkipUntracked = true;
|
|
56
|
-
}
|
|
57
|
-
else if (skip === pid_1.DepartureSkip.MISSING) {
|
|
58
|
-
isSkipMissing = true;
|
|
59
|
-
}
|
|
60
|
-
else if (skip === pid_1.DepartureSkip.CANCELED) {
|
|
61
|
-
isSkipCanceled = true;
|
|
62
|
-
}
|
|
63
|
-
else if (skip === pid_1.DepartureSkip.AT_STOP) {
|
|
64
|
-
isSkipAtStop = true;
|
|
65
|
-
}
|
|
55
|
+
else if (this.options.tripNumber) {
|
|
56
|
+
// Skip transfers of current trip (in the vehicle in which the transfer board is located)
|
|
57
|
+
isCurrentTrip = SkipHelper_1.SkipHelper.isMatchingTripNumber(departure, this.options.tripNumber);
|
|
66
58
|
}
|
|
67
|
-
return !(
|
|
68
|
-
(
|
|
69
|
-
(
|
|
70
|
-
|
|
71
|
-
SkipHelper_1.SkipHelper.isVehicleMissing(departure, this.options.runScheduleMap, this.options.untrackedTrips)) ||
|
|
72
|
-
(isSkipCanceled && SkipHelper_1.SkipHelper.isTripCanceled(departure)) ||
|
|
73
|
-
(isSkipAtStop && SkipHelper_1.SkipHelper.isVehicleAtStop(departure)));
|
|
59
|
+
return !(isCurrentTrip ||
|
|
60
|
+
(this.options.skip.includes(pid_1.DepartureSkip.UNTRACKED) && !departure.is_delay_available) ||
|
|
61
|
+
(this.options.skip.includes(pid_1.DepartureSkip.CANCELED) && departure.is_canceled) ||
|
|
62
|
+
(this.options.skip.includes(pid_1.DepartureSkip.AT_STOP) && (isAtStop || isPassStop)));
|
|
74
63
|
});
|
|
75
64
|
};
|
|
76
65
|
/** Sorts by proper datetime by given options
|