@golemio/pid 2.2.10-dev.590586063 → 2.2.10-dev.592415990

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.
Files changed (60) hide show
  1. package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsModel.js +9 -20
  2. package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsModel.js.map +1 -1
  3. package/dist/output-gateway/pid/PIDRouter.d.ts +7 -17
  4. package/dist/output-gateway/pid/PIDRouter.js +33 -146
  5. package/dist/output-gateway/pid/PIDRouter.js.map +1 -1
  6. package/dist/output-gateway/pid/constants/index.d.ts +1 -0
  7. package/dist/output-gateway/pid/constants/index.js +18 -0
  8. package/dist/output-gateway/pid/constants/index.js.map +1 -0
  9. package/dist/output-gateway/pid/constants/validations.d.ts +7 -0
  10. package/dist/output-gateway/pid/constants/validations.js +29 -0
  11. package/dist/output-gateway/pid/constants/validations.js.map +1 -0
  12. package/dist/output-gateway/pid/controllers/DepartureBoardsController.d.ts +7 -0
  13. package/dist/output-gateway/pid/controllers/DepartureBoardsController.js +79 -0
  14. package/dist/output-gateway/pid/controllers/DepartureBoardsController.js.map +1 -0
  15. package/dist/output-gateway/pid/controllers/InfotextsController.d.ts +7 -0
  16. package/dist/output-gateway/pid/controllers/InfotextsController.js +36 -0
  17. package/dist/output-gateway/pid/controllers/InfotextsController.js.map +1 -0
  18. package/dist/output-gateway/pid/controllers/index.d.ts +2 -0
  19. package/dist/output-gateway/pid/controllers/index.js +19 -0
  20. package/dist/output-gateway/pid/controllers/index.js.map +1 -0
  21. package/dist/output-gateway/pid/dto/DepartureBoardsDTO.d.ts +17 -0
  22. package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js +67 -0
  23. package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js.map +1 -0
  24. package/dist/output-gateway/pid/dto/index.d.ts +1 -0
  25. package/dist/output-gateway/pid/dto/index.js +18 -0
  26. package/dist/output-gateway/pid/dto/index.js.map +1 -0
  27. package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.d.ts +6 -0
  28. package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +28 -0
  29. package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js.map +1 -0
  30. package/dist/output-gateway/pid/middleware/index.d.ts +1 -0
  31. package/dist/output-gateway/pid/middleware/index.js +18 -0
  32. package/dist/output-gateway/pid/middleware/index.js.map +1 -0
  33. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.d.ts +1 -2
  34. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +0 -6
  35. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
  36. package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.d.ts +1 -17
  37. package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js +1 -17
  38. package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js.map +1 -1
  39. package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.d.ts +9 -0
  40. package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.js +21 -0
  41. package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.js.map +1 -0
  42. package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.d.ts +28 -18
  43. package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js +85 -26
  44. package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js.map +1 -1
  45. package/dist/output-gateway/pid/models/index.d.ts +1 -0
  46. package/dist/output-gateway/pid/models/index.js +1 -0
  47. package/dist/output-gateway/pid/models/index.js.map +1 -1
  48. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.d.ts +1 -1
  49. package/dist/output-gateway/shared/RopidRouterUtils.d.ts +5 -0
  50. package/dist/output-gateway/shared/RopidRouterUtils.js +7 -0
  51. package/dist/output-gateway/shared/RopidRouterUtils.js.map +1 -1
  52. package/dist/output-gateway/shared/decorators/index.d.ts +1 -0
  53. package/dist/output-gateway/shared/decorators/index.js +18 -0
  54. package/dist/output-gateway/shared/decorators/index.js.map +1 -0
  55. package/dist/output-gateway/shared/decorators/transformers.d.ts +2 -0
  56. package/dist/output-gateway/shared/decorators/transformers.js +9 -0
  57. package/dist/output-gateway/shared/decorators/transformers.js.map +1 -0
  58. package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js +0 -1
  59. package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js.map +1 -1
  60. package/package.json +2 -1
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.RopidVYMIEventsModel = void 0;
13
4
  const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
@@ -28,19 +19,17 @@ class RopidVYMIEventsModel extends models_1.PostgresModel {
28
19
  }, new golemio_validator_1.JSONSchemaValidator(ropid_vymi_1.RopidVYMI.events.name + "ModelValidator", ropid_vymi_1.RopidVYMI.events.outputJsonSchema));
29
20
  }
30
21
  getCurrentAlerts(currentDate) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- return yield this.find({
33
- where: {
34
- record_type: 1,
35
- expiration_date: {
36
- [sequelize_1.Op.or]: {
37
- [sequelize_1.Op.eq]: null,
38
- [sequelize_1.Op.gte]: currentDate,
39
- },
22
+ return this.find({
23
+ where: {
24
+ record_type: 1,
25
+ expiration_date: {
26
+ [sequelize_1.Op.or]: {
27
+ [sequelize_1.Op.eq]: null,
28
+ [sequelize_1.Op.gte]: currentDate,
40
29
  },
41
30
  },
42
- raw: true,
43
- });
31
+ },
32
+ raw: true,
44
33
  });
45
34
  }
46
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RopidVYMIEventsModel.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-vymi/models/RopidVYMIEventsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mFAAkF;AAClF,yEAAqF;AACrF,uEAAmE;AACnE,mEAAyD;AAEzD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,sBAAa;IACnD;QACI,KAAK,CACD,sBAAS,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO,EAC/B;YACI,WAAW,EAAE,IAAI;YACjB,yBAAyB,EAAE,sBAAS,CAAC,MAAM,CAAC,yBAAyB;YACrE,WAAW,EAAE,sBAAS,CAAC,MAAM,CAAC,WAAW;YACzC,QAAQ,EAAE,sBAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,sBAAS,CAAC,MAAM,CAAC,IAAI,GAAG,gBAAgB,EAAE,sBAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CACvG,CAAC;IACN,CAAC;IAEY,gBAAgB,CAAC,WAAiB;;YAC3C,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE;oBACH,WAAW,EAAE,CAAC;oBACd,eAAe,EAAE;wBACb,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE;4BACL,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,IAAI;4BACb,CAAC,cAAE,CAAC,GAAG,CAAC,EAAE,WAAW;yBACxB;qBACJ;iBACJ;gBACD,GAAG,EAAE,IAAI;aACZ,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AA7BD,oDA6BC"}
1
+ {"version":3,"file":"RopidVYMIEventsModel.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-vymi/models/RopidVYMIEventsModel.ts"],"names":[],"mappings":";;;AAAA,mFAAkF;AAClF,yEAAqF;AACrF,uEAAmE;AACnE,mEAAyD;AAEzD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,sBAAa;IACnD;QACI,KAAK,CACD,sBAAS,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO,EAC/B;YACI,WAAW,EAAE,IAAI;YACjB,yBAAyB,EAAE,sBAAS,CAAC,MAAM,CAAC,yBAAyB;YACrE,WAAW,EAAE,sBAAS,CAAC,MAAM,CAAC,WAAW;YACzC,QAAQ,EAAE,sBAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,sBAAS,CAAC,MAAM,CAAC,IAAI,GAAG,gBAAgB,EAAE,sBAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CACvG,CAAC;IACN,CAAC;IAEM,gBAAgB,CAAC,WAAiB;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC;YACb,KAAK,EAAE;gBACH,WAAW,EAAE,CAAC;gBACd,eAAe,EAAE;oBACb,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE;wBACL,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,IAAI;wBACb,CAAC,cAAE,CAAC,GAAG,CAAC,EAAE,WAAW;qBACxB;iBACJ;aACJ;YACD,GAAG,EAAE,IAAI;SACZ,CAAC,CAAC;IACP,CAAC;CACJ;AA7BD,oDA6BC"}
@@ -3,26 +3,16 @@
3
3
  * Handles web logic (http request, response). Sets response headers, handles error responses.
4
4
  */
5
5
  /// <reference types="express" />
6
+ import { Router } from "@golemio/core/dist/shared/express";
6
7
  import { BaseRouter } from "@golemio/core/dist/output-gateway/routes/BaseRouter";
7
- import { NextFunction, Request, Response, Router } from "@golemio/core/dist/shared/express";
8
- import { PIDDepartureBoardsModel } from ".";
9
8
  export declare class PIDRouter extends BaseRouter {
10
- router: Router;
11
- protected departureBoardsModel: PIDDepartureBoardsModel;
12
- private defaultQueryParameters;
13
- private validationEnums;
9
+ readonly router: import("express-serve-static-core").Router;
10
+ private readonly departureBoardsController;
11
+ private readonly infotextsController;
14
12
  constructor();
15
- GetDepartureBoard: (req: Request, res: Response, next: NextFunction) => Promise<void>;
16
- /**
17
- * Performs a check if timeFrom query parameter is not too old or too much in future
18
- * @param routerName name passed to the returned Error object in case of fail
19
- */
20
- private checkTimeFromMiddleware;
21
- /**
22
- * Initiates all routes. Should respond with correct data to a HTTP requests to all routes.
23
- */
24
- private initRoutes;
25
- private initDepartureBoardsEndpoints;
13
+ private registerDepartureBoardsRoutes;
14
+ private registerInfotextsRoutes;
15
+ private commonMiddleware;
26
16
  }
27
17
  declare const pidRouter: Router;
28
18
  export { pidRouter };
@@ -3,156 +3,30 @@
3
3
  * Router /WEB LAYER/: maps routes to specific controller functions, passes request parameters and handles responses.
4
4
  * Handles web logic (http request, response). Sets response headers, handles error responses.
5
5
  */
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
- return new (P || (P = Promise))(function (resolve, reject) {
9
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
- });
14
- };
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
6
  Object.defineProperty(exports, "__esModule", { value: true });
19
7
  exports.pidRouter = exports.PIDRouter = void 0;
20
- const shared_1 = require("../shared");
21
- const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
22
- const config_1 = require("@golemio/core/dist/output-gateway/config");
23
- const redis_1 = require("@golemio/core/dist/output-gateway/redis");
24
- const BaseRouter_1 = require("@golemio/core/dist/output-gateway/routes/BaseRouter");
25
- const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
26
8
  const express_1 = require("@golemio/core/dist/shared/express");
27
9
  const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
28
- const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
29
- const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
30
- const lodash_1 = require("lodash");
31
- const _1 = require(".");
10
+ const BaseRouter_1 = require("@golemio/core/dist/output-gateway/routes/BaseRouter");
11
+ const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
12
+ const redis_1 = require("@golemio/core/dist/output-gateway/redis");
13
+ const middleware_1 = require("./middleware");
14
+ const constants_1 = require("./constants");
15
+ const controllers_1 = require("./controllers");
32
16
  class PIDRouter extends BaseRouter_1.BaseRouter {
33
17
  constructor() {
34
18
  super();
35
- // Assign router to the express.Router() instance
36
19
  this.router = (0, express_1.Router)();
37
- this.defaultQueryParameters = {
38
- total: 20,
39
- limit: 20,
40
- offset: 0,
41
- minutesAfter: 180,
42
- minutesBefore: 0,
43
- timeFromValidRange: {
44
- hoursBefore: 6,
45
- hoursAfter: 7 * 24,
46
- },
47
- };
48
- this.validationEnums = {
49
- departureMode: ["departures", "arrivals", "mixed"],
50
- order: ["real", "timetable"],
51
- filter: [
52
- "none",
53
- "routeOnce",
54
- "routeHeadingOnce",
55
- "routeOnceFill",
56
- "routeHeadingOnceFill",
57
- "routeHeadingOnceNoGap",
58
- "routeHeadingOnceNoGapFill",
59
- ],
60
- skip: ["untracked", "canceled", "atStop" /*, "onInfotext"*/],
61
- // creates whitelist of timezone names
62
- prefferedTimezone: moment_timezone_1.default.tz.names().concat(moment_timezone_1.default.tz
63
- .names()
64
- // concats only those names that have character /
65
- .filter((name) => name.match(/\//g))
66
- // that is replaced with _
67
- .map((name) => name.replace(/\//g, "_"))),
68
- };
69
- this.GetDepartureBoard = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
70
- const aswIds = this.ConvertToArray(req.query.aswIds || []);
71
- const cisIds = this.ConvertToArray(req.query.cisIds || []);
72
- const gtfsIds = this.ConvertToArray(req.query.ids || []);
73
- const names = this.ConvertToArray(req.query.names || []);
74
- const skip = this.ConvertToArray(req.query.skip || []);
75
- const limit = parseInt(req.query.limit || this.defaultQueryParameters.limit, 10);
76
- const total = (0, lodash_1.toNumber)(req.query.total) || limit;
77
- const preferredTimezone = shared_1.RopidRouterUtils.validateAndReturnTimezone(req.query.preferredTimezone, this.constructor.name);
78
- // datetime is valid ISO 8601 (by express validator)
79
- // it matches:
80
- // 2020-10-10T10:00:00Z
81
- // 2020-10-10 10:00:00.00Z
82
- // 2020-10-10T10:00:00+02
83
- // 2020-10-10T10:00:00+02:00
84
- const timezoneDefinedRegexp = /[T ][\d:\.]+([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)/;
85
- // use timezone from ?preferredTimezone if not set in ?timeFrom
86
- const timeFrom = req.query.timeFrom
87
- ? req.query.timeFrom.match(timezoneDefinedRegexp)
88
- ? (0, moment_timezone_1.default)(req.query.timeFrom)
89
- : moment_timezone_1.default.tz(req.query.timeFrom, preferredTimezone)
90
- : undefined;
91
- const span = (0, trace_provider_1.createChildSpan)("PIDRouter.GetDepartureBoard", config_1.config.telemetry);
92
- try {
93
- const data = yield this.departureBoardsModel.GetAll({
94
- aswIds,
95
- cisIds,
96
- gtfsIds,
97
- names,
98
- minutesAfter: parseInt(req.query.minutesAfter || this.defaultQueryParameters.minutesAfter, 10),
99
- minutesBefore: parseInt(req.query.minutesBefore || this.defaultQueryParameters.minutesBefore, 10),
100
- timeFrom,
101
- mode: req.query.mode,
102
- order: req.query.order,
103
- filter: req.query.filter,
104
- skip,
105
- limit,
106
- offset: (0, lodash_1.toNumber)(req.query.offset) || undefined,
107
- total,
108
- timezone: preferredTimezone,
109
- });
110
- // allow access response Date header
111
- res.setHeader("access-control-expose-headers", "date");
112
- res.status(200).send({
113
- stops: data.stops,
114
- departures: data.departures,
115
- infotexts: data.infotexts,
116
- });
117
- }
118
- catch (err) {
119
- next(err);
120
- }
121
- finally {
122
- span === null || span === void 0 ? void 0 : span.end();
123
- }
124
- });
125
- /**
126
- * Performs a check if timeFrom query parameter is not too old or too much in future
127
- * @param routerName name passed to the returned Error object in case of fail
128
- */
129
- this.checkTimeFromMiddleware = (routerName) => {
130
- return (req, res, next) => {
131
- const currentMoment = (0, moment_timezone_1.default)();
132
- const timeFrom = req.query.timeFrom ? (0, moment_timezone_1.default)(req.query.timeFrom) : null;
133
- if (timeFrom &&
134
- !timeFrom.isBetween(currentMoment.clone().subtract(this.defaultQueryParameters.timeFromValidRange.hoursBefore, "hours"), currentMoment.clone().add(this.defaultQueryParameters.timeFromValidRange.hoursAfter, "hours"), undefined, "[]")) {
135
- return next(new golemio_errors_1.CustomError("Parameter timeFrom must be in interval [-6h; +7d]", true, routerName || "BaseRouter", 400));
136
- }
137
- return next();
138
- };
139
- };
140
- /**
141
- * Initiates all routes. Should respond with correct data to a HTTP requests to all routes.
142
- */
143
- this.initRoutes = () => {
144
- this.initDepartureBoardsEndpoints("5 seconds");
145
- };
146
- this.initDepartureBoardsEndpoints = (expire) => {
147
- // could be this generated from enum?
148
- this.router.get("/departureboards", [
20
+ this.registerDepartureBoardsRoutes = () => {
21
+ const { prefferedTimezone, departureMode, order, filter, skip } = constants_1.departureBoardsValidationArrays;
22
+ const validation = [
149
23
  (0, express_validator_1.oneOf)([
150
- (0, express_validator_1.query)("ids").exists().isArray(),
151
24
  (0, express_validator_1.query)("aswIds").exists().isArray(),
152
- (0, express_validator_1.query)("cisIds").exists().isArray(),
153
- (0, express_validator_1.query)("ids").exists().isString(),
154
25
  (0, express_validator_1.query)("aswIds").exists().isString(),
26
+ (0, express_validator_1.query)("cisIds").exists().isArray(),
155
27
  (0, express_validator_1.query)("cisIds").exists().isString(),
28
+ (0, express_validator_1.query)("ids").exists().isArray(),
29
+ (0, express_validator_1.query)("ids").exists().isString(),
156
30
  (0, express_validator_1.query)("names").exists().isArray(),
157
31
  (0, express_validator_1.query)("names").exists().isString(),
158
32
  ]),
@@ -162,19 +36,32 @@ class PIDRouter extends BaseRouter_1.BaseRouter {
162
36
  (0, express_validator_1.query)("names.*").optional().isString(),
163
37
  (0, express_validator_1.query)("minutesBefore").optional().isInt(),
164
38
  (0, express_validator_1.query)("minutesAfter").optional().isInt(),
165
- (0, express_validator_1.query)("preferredTimezone").optional().isString().isIn(this.validationEnums.prefferedTimezone),
166
- (0, express_validator_1.query)("mode").optional().isIn(this.validationEnums.departureMode),
167
- (0, express_validator_1.query)("order").optional().isString().isIn(this.validationEnums.order),
168
- (0, express_validator_1.query)("filter").optional().isString().isIn(this.validationEnums.filter),
169
- (0, express_validator_1.query)("skip").optional().isIn(this.validationEnums.skip),
39
+ (0, express_validator_1.query)("preferredTimezone").optional().isString().isIn(prefferedTimezone),
40
+ (0, express_validator_1.query)("mode").optional().isIn(departureMode),
41
+ (0, express_validator_1.query)("order").optional().isString().isIn(order),
42
+ (0, express_validator_1.query)("filter").optional().isString().isIn(filter),
43
+ (0, express_validator_1.query)("skip").optional().isIn(skip),
170
44
  (0, express_validator_1.query)("timeFrom").optional().isString().isISO8601(),
171
45
  (0, express_validator_1.query)("limit").optional().isInt(),
172
46
  (0, express_validator_1.query)("offset").optional().isInt(),
173
47
  (0, express_validator_1.query)("total").optional().isInt(),
174
- ], Validation_1.pagination, Validation_1.checkErrors, this.checkTimeFromMiddleware("DepartureBoardsRouter"), (0, Validation_1.paginationLimitMiddleware)("DepartureBoardsRouter"), (0, redis_1.useCacheMiddleware)(expire), this.GetDepartureBoard);
48
+ ];
49
+ this.router.get("/departureboards", validation, ...this.commonMiddleware("PIDDepartureBoards"), (0, middleware_1.checkTimeFromMiddleware)("PIDDepartureBoards"), this.departureBoardsController.getDepartureBoard);
50
+ };
51
+ this.registerInfotextsRoutes = () => {
52
+ this.router.get("/infotexts", ...this.commonMiddleware("PIDInfotexts"), this.infotextsController.getInfotexts);
175
53
  };
176
- this.departureBoardsModel = new _1.PIDDepartureBoardsModel();
177
- this.initRoutes();
54
+ this.commonMiddleware = (name) => [
55
+ Validation_1.pagination,
56
+ Validation_1.checkErrors,
57
+ (0, Validation_1.paginationLimitMiddleware)(name),
58
+ (0, redis_1.useCacheMiddleware)("5 seconds"),
59
+ ];
60
+ this.departureBoardsController = new controllers_1.DepartureBoardsController();
61
+ this.infotextsController = new controllers_1.InfotextsController();
62
+ // Register routes
63
+ this.registerDepartureBoardsRoutes();
64
+ this.registerInfotextsRoutes();
178
65
  }
179
66
  }
180
67
  exports.PIDRouter = PIDRouter;
@@ -1 +1 @@
1
- {"version":3,"file":"PIDRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/PIDRouter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,sCAA8C;AAC9C,+FAA6F;AAC7F,qEAAkE;AAClE,mEAA6E;AAC7E,oFAAiF;AACjF,6EAAkH;AAClH,+DAA4F;AAC5F,mFAA2E;AAC3E,6EAAuE;AACvE,gGAA2E;AAC3E,mCAAkC;AAClC,wBAA4C;AAE5C,MAAa,SAAU,SAAQ,uBAAU;IA0CrC;QACI,KAAK,EAAE,CAAC;QA1CZ,iDAAiD;QAC1C,WAAM,GAAW,IAAA,gBAAM,GAAE,CAAC;QAIzB,2BAAsB,GAAQ;YAClC,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,CAAC;YACT,YAAY,EAAE,GAAG;YACjB,aAAa,EAAE,CAAC;YAChB,kBAAkB,EAAE;gBAChB,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,CAAC,GAAG,EAAE;aACrB;SACJ,CAAC;QAEM,oBAAe,GAAQ;YAC3B,aAAa,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC;YAClD,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;YAC5B,MAAM,EAAE;gBACJ,MAAM;gBACN,WAAW;gBACX,kBAAkB;gBACl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AErD,kBAAkB;QAClB,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACrC,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACnC,CAAC;CAmDJ;AAhED,8BAgEC;AAED,MAAM,SAAS,GAAW,IAAI,SAAS,EAAE,CAAC,MAAM,CAAC;AACxC,8BAAS"}
@@ -0,0 +1 @@
1
+ export * from "./validations";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./validations"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -0,0 +1,7 @@
1
+ export declare const departureBoardsValidationArrays: {
2
+ departureMode: string[];
3
+ order: string[];
4
+ filter: string[];
5
+ skip: string[];
6
+ prefferedTimezone: string[];
7
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.departureBoardsValidationArrays = void 0;
7
+ const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
8
+ exports.departureBoardsValidationArrays = {
9
+ departureMode: ["departures", "arrivals", "mixed"],
10
+ order: ["real", "timetable"],
11
+ filter: [
12
+ "none",
13
+ "routeOnce",
14
+ "routeHeadingOnce",
15
+ "routeOnceFill",
16
+ "routeHeadingOnceFill",
17
+ "routeHeadingOnceNoGap",
18
+ "routeHeadingOnceNoGapFill",
19
+ ],
20
+ skip: ["untracked", "canceled", "atStop" /*, "onInfotext"*/],
21
+ // TODO replace moment.tz.names() with Intl.supportedValuesOf("timeZone") after migrating to Node 18
22
+ prefferedTimezone: moment_timezone_1.default.tz.names().concat(moment_timezone_1.default.tz
23
+ .names()
24
+ // concats only those names that have character /
25
+ .filter((name) => name.match(/\//g))
26
+ // that is replaced with _
27
+ .map((name) => name.replace(/\//g, "_"))),
28
+ };
29
+ //# sourceMappingURL=validations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/constants/validations.ts"],"names":[],"mappings":";;;;;;AAAA,gGAA+D;AAElD,QAAA,+BAA+B,GAAG;IAC3C,aAAa,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC;IAClD,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;IAC5B,MAAM,EAAE;QACJ,MAAM;QACN,WAAW;QACX,kBAAkB;QAClB,eAAe;QACf,sBAAsB;QACtB,uBAAuB;QACvB,2BAA2B;KAC9B;IACD,IAAI,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAC5D,oGAAoG;IACpG,iBAAiB,EAAE,yBAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,CACvC,yBAAM,CAAC,EAAE;SACJ,KAAK,EAAE;QACR,iDAAiD;SAChD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACpC,0BAA0B;SACzB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAC/C;CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="express" />
2
+ import { RequestHandler } from "@golemio/core/dist/shared/express";
3
+ export declare class DepartureBoardsController {
4
+ private departureBoardsModel;
5
+ constructor();
6
+ getDepartureBoard: RequestHandler;
7
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DepartureBoardsController = void 0;
16
+ const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
17
+ const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
18
+ const config_1 = require("@golemio/core/dist/output-gateway/config");
19
+ const shared_1 = require("../../shared");
20
+ const models_1 = require("../models");
21
+ const dto_1 = require("../dto");
22
+ class DepartureBoardsController {
23
+ constructor() {
24
+ this.getDepartureBoard = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
25
+ var _a;
26
+ const query = shared_1.RopidRouterUtils.mapObjectToDTOInstance(dto_1.DepartureBoardsQueryDTO, req.query);
27
+ const preferredTimezone = shared_1.RopidRouterUtils.validateAndReturnTimezone(query.preferredTimezone, this.constructor.name);
28
+ // datetime is valid ISO 8601 (by express validator)
29
+ // it matches:
30
+ // 2020-10-10T10:00:00Z
31
+ // 2020-10-10 10:00:00.00Z
32
+ // 2020-10-10T10:00:00+02
33
+ // 2020-10-10T10:00:00+02:00
34
+ const timezoneDefinedRegexp = /[T ][\d:\.]+([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)/;
35
+ // use timezone from ?preferredTimezone if not set in ?timeFrom
36
+ const timeFrom = query.timeFrom
37
+ ? query.timeFrom.match(timezoneDefinedRegexp)
38
+ ? (0, moment_timezone_1.default)(query.timeFrom)
39
+ : moment_timezone_1.default.tz(query.timeFrom, preferredTimezone)
40
+ : undefined;
41
+ const span = (0, trace_provider_1.createChildSpan)("DepartureBoardsController.getDepartureBoard", config_1.config.telemetry);
42
+ try {
43
+ const data = yield this.departureBoardsModel.GetAll({
44
+ aswIds: query.aswIds,
45
+ cisIds: query.cisIds,
46
+ gtfsIds: query.ids,
47
+ names: query.names,
48
+ minutesAfter: query.minutesAfter,
49
+ minutesBefore: query.minutesBefore,
50
+ timeFrom,
51
+ mode: query.mode,
52
+ order: query.order,
53
+ filter: query.filter,
54
+ skip: query.skip,
55
+ limit: query.limit,
56
+ offset: query.offset,
57
+ total: (_a = query.total) !== null && _a !== void 0 ? _a : query.limit,
58
+ timezone: preferredTimezone,
59
+ });
60
+ // allow access response Date header
61
+ res.setHeader("access-control-expose-headers", "date");
62
+ res.status(200).send({
63
+ stops: data.stops,
64
+ departures: data.departures,
65
+ infotexts: data.infotexts,
66
+ });
67
+ }
68
+ catch (err) {
69
+ next(err);
70
+ }
71
+ finally {
72
+ span === null || span === void 0 ? void 0 : span.end();
73
+ }
74
+ });
75
+ this.departureBoardsModel = new models_1.PIDDepartureBoardsModel();
76
+ }
77
+ }
78
+ exports.DepartureBoardsController = DepartureBoardsController;
79
+ //# sourceMappingURL=DepartureBoardsController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepartureB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AClB,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,MAAA,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,KAAK;oBACjC,QAAQ,EAAE,iBAAiB;iBAC9B,CAAC,CAAC;gBACH,oCAAoC;gBACpC,GAAG,CAAC,SAAS,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;gBACvD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;iBAC5B,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;oBAAS;gBACN,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,EAAE,CAAC;aACf;QACL,CAAC,CAAA,CAAC;QApDE,IAAI,CAAC,oBAAoB,GAAG,IAAI,gCAAuB,EAAE,CAAC;IAC9D,CAAC;CAoDJ;AAzDD,8DAyDC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="express" />
2
+ import { RequestHandler } from "@golemio/core/dist/shared/express";
3
+ export declare class InfotextsController {
4
+ private readonly eventsStopsModel;
5
+ constructor();
6
+ getInfotexts: RequestHandler;
7
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.InfotextsController = void 0;
13
+ const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
14
+ const config_1 = require("@golemio/core/dist/output-gateway/config");
15
+ const models_1 = require("../models");
16
+ class InfotextsController {
17
+ constructor() {
18
+ this.getInfotexts = (_req, res, next) => __awaiter(this, void 0, void 0, function* () {
19
+ const span = (0, trace_provider_1.createChildSpan)("InfotextsController.getInfotexts", config_1.config.telemetry);
20
+ try {
21
+ const preferredTimezone = config_1.config.vehiclePositions.defaultTimezone;
22
+ const data = yield this.eventsStopsModel.GetAllWithRoutes(preferredTimezone);
23
+ res.status(200).send(data);
24
+ }
25
+ catch (err) {
26
+ next(err);
27
+ }
28
+ finally {
29
+ span === null || span === void 0 ? void 0 : span.end();
30
+ }
31
+ });
32
+ this.eventsStopsModel = new models_1.RopidVYMIEventsStopsModel();
33
+ }
34
+ }
35
+ exports.InfotextsController = InfotextsController;
36
+ //# sourceMappingURL=InfotextsController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfotextsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/controllers/InfotextsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+FAA6F;AAC7F,qEAAkE;AAClE,sCAA2D;AAE3D,MAAa,mBAAmB;IAG5B;QAIO,iBAAY,GAAmB,CAAO,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC5D,MAAM,IAAI,GAAG,IAAA,gCAAe,EAAC,kCAAkC,EAAE,eAAM,CAAC,SAAS,CAAC,CAAC;YAEnF,IAAI;gBACA,MAAM,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC;gBAClE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;gBAC7E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;oBAAS;gBACN,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,EAAE,CAAC;aACf;QACL,CAAC,CAAA,CAAC;QAfE,IAAI,CAAC,gBAAgB,GAAG,IAAI,kCAAyB,EAAE,CAAC;IAC5D,CAAC;CAeJ;AApBD,kDAoBC"}
@@ -0,0 +1,2 @@
1
+ export * from "./DepartureBoardsController";
2
+ export * from "./InfotextsController";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./DepartureBoardsController"), exports);
18
+ __exportStar(require("./InfotextsController"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,wDAAsC"}
@@ -0,0 +1,17 @@
1
+ export declare class DepartureBoardsQueryDTO {
2
+ aswIds: string[];
3
+ cisIds: string[];
4
+ ids: string[];
5
+ names: string[];
6
+ skip: string[];
7
+ limit: number;
8
+ minutesAfter: number;
9
+ minutesBefore: number;
10
+ total?: number;
11
+ preferredTimezone?: string;
12
+ timeFrom?: string;
13
+ mode?: string;
14
+ order?: string;
15
+ filter?: string;
16
+ offset?: number;
17
+ }