@golemio/pid 2.23.3-dev.1525727326 → 2.23.3-dev.1528203332

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 (77) hide show
  1. package/db/example/03_ropidgtfs_dump.sql +7 -1
  2. package/db/example/09_departureboards_testdata_nogapfilter.sql +4 -1
  3. package/db/example/20_jis_infotexts.sql +6 -0
  4. package/db/migrations/postgresql/20241104000200-transfer-boards.js +53 -0
  5. package/db/migrations/postgresql/sqls/20241104000200-transfer-boards-down.sql +1 -0
  6. package/db/migrations/postgresql/sqls/20241104000200-transfer-boards-up.sql +96 -0
  7. package/dist/helpers/StopEnums.d.ts +12 -0
  8. package/dist/helpers/StopEnums.js +17 -0
  9. package/dist/helpers/StopEnums.js.map +1 -0
  10. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +5 -0
  11. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +14 -0
  12. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
  13. package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.d.ts +5 -0
  14. package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js +14 -0
  15. package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map +1 -1
  16. package/dist/integration-engine/jis/services/JISInfotextsDataService.js +15 -7
  17. package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -1
  18. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +3 -0
  19. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  20. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.d.ts +13 -0
  21. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js +116 -0
  22. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -0
  23. package/dist/output-gateway/pid/data-access/DeparturesRepository.d.ts +14 -14
  24. package/dist/output-gateway/pid/data-access/DeparturesRepository.js +86 -34
  25. package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
  26. package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.d.ts +16 -0
  27. package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.js +3 -0
  28. package/dist/output-gateway/pid/data-access/interfaces/DepartureInterfaces.js.map +1 -0
  29. package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
  30. package/dist/output-gateway/pid/helpers/DepartureBoardMapper.d.ts +0 -7
  31. package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +5 -16
  32. package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
  33. package/dist/output-gateway/pid/index.d.ts +31 -0
  34. package/dist/output-gateway/pid/index.js.map +1 -1
  35. package/dist/output-gateway/pid/ioc/Di.js +19 -0
  36. package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
  37. package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +8 -0
  38. package/dist/output-gateway/pid/ioc/OgPidToken.js +10 -0
  39. package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
  40. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +4 -2
  41. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
  42. package/dist/output-gateway/pid/models/helpers/FilterHelper.d.ts +4 -4
  43. package/dist/output-gateway/pid/models/helpers/FilterHelper.js.map +1 -1
  44. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.d.ts +4 -3
  45. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +31 -8
  46. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
  47. package/dist/output-gateway/pid/models/helpers/interfaces/IPIDDepartureQueryOptions.d.ts +1 -0
  48. package/dist/output-gateway/pid/routers/v3/V3PIDRouter.d.ts +1 -0
  49. package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js +10 -0
  50. package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js.map +1 -1
  51. package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +13 -0
  52. package/dist/output-gateway/pid/service/facade/InfotextFacade.js +62 -0
  53. package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -0
  54. package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +9 -0
  55. package/dist/output-gateway/pid/service/facade/StopFacade.js +76 -0
  56. package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -0
  57. package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +20 -0
  58. package/dist/output-gateway/pid/service/facade/TransferFacade.js +104 -0
  59. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -0
  60. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +10 -0
  61. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +20 -0
  62. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -0
  63. package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.d.ts +11 -0
  64. package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js +30 -0
  65. package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js.map +1 -0
  66. package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.d.ts +22 -0
  67. package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js +52 -0
  68. package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js.map +1 -0
  69. package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.d.ts +11 -0
  70. package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js +65 -0
  71. package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js.map +1 -0
  72. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.d.ts +4 -0
  73. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js +25 -2
  74. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js.map +1 -1
  75. package/docs/implementation_documentation.md +4 -0
  76. package/docs/openapi-output.yaml +152 -1
  77. package/package.json +1 -1
@@ -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
- this.addDirections();
21
- return this.departures;
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
- const isAtStop = departure.stop_sequence === departure["trip.last_position.this_stop_sequence"];
45
- const isPassStop = departure["trip.last_position.last_stop_sequence"] &&
46
- departure.stop_sequence <= departure["trip.last_position.last_stop_sequence"];
47
- return !((this.options.skip.includes(pid_1.DepartureSkip.UNTRACKED) && !departure.is_delay_available) ||
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 ? this.filterByCondition(filterCondition) : { once: this.departures, fill: [] };
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,+BAAuG;AACvG,8FAAwE;AACxE,iDAAoE;AAGpE,MAAqB,kBAAkB;IAcnC,YAAY,UAA2B,EAAE,OAAkC;QAKpE,YAAO,GAAG,GAAG,EAAE;YAClB,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,CA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AqB,EAAE,CAAC;IAC9H,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,EAAqB,EAAE,IAAI,EAAE,EAAqB,EAAE,CAC/D,CAAC;IACN,CAAC;;AA1Hc,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"}
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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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"}
@@ -10,4 +10,5 @@ export default interface IPIDDepartureQueryOptions {
10
10
  skip: DepartureSkip[];
11
11
  departuresDirections: IRopidDeparturesDirectionsOutput[];
12
12
  timezone: string;
13
+ tripNumber?: string;
13
14
  }
@@ -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":";;;AACA,qCAAgD;AAChD,qDAAoD;AACpD,yDAAoD;AACpD,sFAAmF;AAEnF,6EAA2E;AAC3E,+DAAuE;AACvE,+DAA2D;AAE3D,MAAa,WAAY,SAAQ,+BAAc;IAK3C;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QALlB,WAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QAWxB,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,YAAY,EACZ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,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfotextFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/InfotextFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mFAAkF;AAElF,qDAAoD;AACpD,6EAA8F;AAE9F,iEAAwE;AACxE,4GAAyG;AAGlG,IAAM,cAAc,4BAApB,MAAM,cAAc;IACvB,YACsD,kBAAyC,EAC7B,sBAAyD;QADrE,uBAAkB,GAAlB,kBAAkB,CAAuB;QAC7B,2BAAsB,GAAtB,sBAAsB,CAAmC;IACxH,CAAC;IAEJ;;OAEG;IACU,6BAA6B,CACtC,OAAiB,EACjB,aAAqB,EACrB,QAAuB;;YAEvB,IAAI,SAAS,GAAiC,EAAE,CAAC;YACjD,IAAI;gBACA,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAC3E,OAAO,EACP,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,CACxD,CAAC;gBAEF,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;aAC5E;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,KAAK,YAAY,qCAAoB,EAAE;oBACvC,MAAM,KAAK,CAAC;iBACf;gBAED,MAAM,IAAI,6BAAY,CAAC,8BAA8B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aAC7F;YAED,OAAO,SAAS,CAAC;QACrB,CAAC;KAAA;CACJ,CAAA;yBAhCY,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,qBAAqB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,iCAAiC,CAAC,CAAA;qCADiB,6CAAqB;QACL,qEAAiC;GAHlH,cAAc,CAgC1B"}
@@ -0,0 +1,9 @@
1
+ import { CisStopGroupRepository } from "../../../ropid-gtfs/data-access/CisStopGroupRepository";
2
+ export declare class StopFacade {
3
+ private cisStopGroupsRepository;
4
+ constructor(cisStopGroupsRepository: CisStopGroupRepository);
5
+ /**
6
+ * Retrieves ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
7
+ */
8
+ getStopIdsForTransferBoards(cisId: string): Promise<string[]>;
9
+ }
@@ -0,0 +1,76 @@
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.StopFacade = void 0;
25
+ const OgPidToken_1 = require("../../ioc/OgPidToken");
26
+ const CisStopGroupRepository_1 = require("../../../ropid-gtfs/data-access/CisStopGroupRepository");
27
+ const models_1 = require("../../../ropid-gtfs/models");
28
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
29
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
30
+ let StopFacade = exports.StopFacade = class StopFacade {
31
+ constructor(cisStopGroupsRepository) {
32
+ this.cisStopGroupsRepository = cisStopGroupsRepository;
33
+ }
34
+ /**
35
+ * Retrieves ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
36
+ */
37
+ getStopIdsForTransferBoards(cisId) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ //#region CIS stop node
40
+ let aswNode;
41
+ try {
42
+ const cisStopNode = yield this.cisStopGroupsRepository.getNodeByCisId(cisId);
43
+ if (cisStopNode === null) {
44
+ return [];
45
+ }
46
+ aswNode = cisStopNode;
47
+ }
48
+ catch (error) {
49
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
50
+ throw error;
51
+ }
52
+ throw new golemio_errors_1.GeneralError("Failed to retrieve CIS stop node", this.constructor.name, error, 500);
53
+ }
54
+ //#endregion
55
+ //#region GTFS stop IDs
56
+ let stopIds = [];
57
+ try {
58
+ stopIds = yield models_1.models.GTFSStopModel.getMultipleIdsByAswNode(aswNode);
59
+ }
60
+ catch (error) {
61
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
62
+ throw error;
63
+ }
64
+ throw new golemio_errors_1.GeneralError("Failed to retrieve GTFS stops", this.constructor.name, error, 500);
65
+ }
66
+ //#endregion
67
+ return stopIds;
68
+ });
69
+ }
70
+ };
71
+ exports.StopFacade = StopFacade = __decorate([
72
+ (0, tsyringe_1.injectable)(),
73
+ __param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.CisStopGroupRepository)),
74
+ __metadata("design:paramtypes", [CisStopGroupRepository_1.CisStopGroupRepository])
75
+ ], StopFacade);
76
+ //# sourceMappingURL=StopFacade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StopFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/StopFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoD;AACpD,mGAA2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,CAwCtB"}
@@ -0,0 +1,20 @@
1
+ import { ITransferOutputDto } from "../..";
2
+ import { DeparturesRepository } from "../../data-access";
3
+ import { Moment } from "@golemio/core/dist/shared/moment-timezone";
4
+ import { TransferDepartureTransformation } from "../transformations/TransferDepartureTransformation";
5
+ export declare class TransferFacade {
6
+ private departureRepository;
7
+ private departureTransformation;
8
+ constructor(departureRepository: DeparturesRepository, departureTransformation: TransferDepartureTransformation);
9
+ /**
10
+ * Retrieves transfer departures for given GTFS stop IDs
11
+ * - Get transfer departures from DB
12
+ * - Process them (filter, sort, etc.)
13
+ * - Transform them to DTO
14
+ */
15
+ getTransferDepartures(stopIds: string[], tripNumber: string, currentMoment: Moment, minutesOffset: number, timeZone?: string): Promise<ITransferOutputDto[]>;
16
+ /**
17
+ * Fallback options as defined by ROPID
18
+ */
19
+ private get defaultOptions();
20
+ }
@@ -0,0 +1,104 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.TransferFacade = void 0;
28
+ const pid_1 = require("../..");
29
+ const data_access_1 = require("../../data-access");
30
+ const OgPidToken_1 = require("../../ioc/OgPidToken");
31
+ const PIDDepartureModel_1 = __importDefault(require("../../models/helpers/PIDDepartureModel"));
32
+ const IPIDDepartureQueryOptions_1 = __importDefault(require("../../models/helpers/interfaces/IPIDDepartureQueryOptions"));
33
+ const shared_1 = require("../../../shared");
34
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
35
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
36
+ const TransferDepartureTransformation_1 = require("../transformations/TransferDepartureTransformation");
37
+ let TransferFacade = exports.TransferFacade = class TransferFacade {
38
+ constructor(departureRepository, departureTransformation) {
39
+ this.departureRepository = departureRepository;
40
+ this.departureTransformation = departureTransformation;
41
+ }
42
+ /**
43
+ * Retrieves transfer departures for given GTFS stop IDs
44
+ * - Get transfer departures from DB
45
+ * - Process them (filter, sort, etc.)
46
+ * - Transform them to DTO
47
+ */
48
+ getTransferDepartures(stopIds, tripNumber, currentMoment, minutesOffset, timeZone = shared_1.RopidRouterUtils.TIMEZONE) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ let departureEntities = [];
51
+ try {
52
+ departureEntities = yield this.departureRepository.getTransferDepartures({
53
+ stopsIds: stopIds,
54
+ currentMoment,
55
+ minutesOffset,
56
+ });
57
+ }
58
+ catch (error) {
59
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
60
+ throw error;
61
+ }
62
+ throw new golemio_errors_1.GeneralError("Failed to retrieve transfer departures", this.constructor.name, error, 500);
63
+ }
64
+ if (departureEntities.length === 0) {
65
+ return [];
66
+ }
67
+ let transferDepartures = [];
68
+ try {
69
+ const processedDepartures = new PIDDepartureModel_1.default(departureEntities, Object.assign(Object.assign({}, this.defaultOptions), { timezone: timeZone, tripNumber })).processAndReturnTransfers();
70
+ transferDepartures = this.departureTransformation.transformArray(processedDepartures);
71
+ }
72
+ catch (error) {
73
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
74
+ throw error;
75
+ }
76
+ throw new golemio_errors_1.GeneralError("Failed to process transfer departures", this.constructor.name, error, 500);
77
+ }
78
+ return transferDepartures;
79
+ });
80
+ }
81
+ /**
82
+ * Fallback options as defined by ROPID
83
+ */
84
+ get defaultOptions() {
85
+ return {
86
+ limit: 16,
87
+ total: 16,
88
+ offset: 0,
89
+ mode: pid_1.DepartureMode.DEPARTURES,
90
+ order: pid_1.DepartureOrder.REAL,
91
+ filter: pid_1.DepartureFilter.ROUTE_HEADING_ONCE_NOGAP_FILL,
92
+ skip: [pid_1.DepartureSkip.CANCELED],
93
+ departuresDirections: [],
94
+ };
95
+ }
96
+ };
97
+ exports.TransferFacade = TransferFacade = __decorate([
98
+ (0, tsyringe_1.injectable)(),
99
+ __param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.DeparturesRepository)),
100
+ __param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferDepartureTransformation)),
101
+ __metadata("design:paramtypes", [data_access_1.DeparturesRepository,
102
+ TransferDepartureTransformation_1.TransferDepartureTransformation])
103
+ ], TransferFacade);
104
+ //# sourceMappingURL=TransferFacade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/TransferFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAgI;AAChI,mDAA2D;AAC3D,qDAAo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,MAAM,KAAK,CAAC;iBACf;gBAED,MAAM,IAAI,6BAAY,CAAC,uCAAuC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aACtG;YAED,OAAO,kBAAkB,CAAC;QAC9B,CAAC;KAAA;IAED;;OAEG;IACH,IAAY,cAAc;QACtB,OAAO;YACH,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,mBAAa,CAAC,UAAU;YAC9B,KAAK,EAAE,oBAAc,CAAC,IAAI;YAC1B,MAAM,EAAE,qBAAe,CAAC,6BAA6B;YACrD,IAAI,EAAE,CAAC,mBAAa,CAAC,QAAQ,CAAC;YAC9B,oBAAoB,EAAE,EAAE;SAC3B,CAAC;IACN,CAAC;CACJ,CAAA;yBAzEY,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,oBAAoB,CAAC,CAAA;IACvC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,+BAA+B,CAAC,CAAA;qCADmB,kCAAoB;QACL,iEAA+B;GAH/G,cAAc,CAyE1B"}
@@ -0,0 +1,10 @@
1
+ import { ITransferDeparture } from "../..";
2
+ export declare class PlatformCodeResolver {
3
+ /**
4
+ * Platform code is determined by the following rules:
5
+ * - for trains, the last stop platform code is used (CIS) if available
6
+ * - otherwise, the departure platform code is used (GTFS)
7
+ * - for other route types, the departure platform code is used (GTFS)
8
+ */
9
+ static resolve(departure: ITransferDeparture): string | null;
10
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformCodeResolver = void 0;
4
+ const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
5
+ class PlatformCodeResolver {
6
+ /**
7
+ * Platform code is determined by the following rules:
8
+ * - for trains, the last stop platform code is used (CIS) if available
9
+ * - otherwise, the departure platform code is used (GTFS)
10
+ * - for other route types, the departure platform code is used (GTFS)
11
+ */
12
+ static resolve(departure) {
13
+ if (departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.TRAIN && departure["trip.cis_stop_platform_code"] !== null) {
14
+ return departure["trip.cis_stop_platform_code"];
15
+ }
16
+ return departure.platform_code;
17
+ }
18
+ }
19
+ exports.PlatformCodeResolver = PlatformCodeResolver;
20
+ //# sourceMappingURL=PlatformCodeResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/helpers/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,SAA6B;QAC/C,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,IAAI,EAAE;YACvG,OAAO,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,aAAa,CAAC;IACnC,CAAC;CACJ;AAdD,oDAcC"}
@@ -0,0 +1,11 @@
1
+ import { IInfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
2
+ import { JISInfotextsModel } from "../../../../schema-definitions/jis/models/JISInfotextsModel";
3
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
4
+ export declare class JISInfotextTransferTransformation extends AbstractTransformation<JISInfotextsModel, IInfotextTransferOutputDto> {
5
+ name: string;
6
+ protected transformInternal: (infotext: JISInfotextsModel) => {
7
+ display_type: import("../../domain/InfotextDisplayTypeEnum").InfotextDisplayType;
8
+ text: string;
9
+ text_en: string | null;
10
+ };
11
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.JISInfotextTransferTransformation = void 0;
10
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
11
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
12
+ const DisplayTypeMapper_1 = require("../helpers/DisplayTypeMapper");
13
+ let JISInfotextTransferTransformation = exports.JISInfotextTransferTransformation = class JISInfotextTransferTransformation extends AbstractTransformation_1.AbstractTransformation {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.name = "JISInfotextTransferTransformation";
17
+ this.transformInternal = (infotext) => {
18
+ var _a;
19
+ return {
20
+ display_type: DisplayTypeMapper_1.DisplayTypeMapper.mapInputToOutputDisplayType(infotext.display_type),
21
+ text: infotext.description_text.cs,
22
+ text_en: (_a = infotext.description_text.en) !== null && _a !== void 0 ? _a : null,
23
+ };
24
+ };
25
+ }
26
+ };
27
+ exports.JISInfotextTransferTransformation = JISInfotextTransferTransformation = __decorate([
28
+ (0, tsyringe_1.injectable)()
29
+ ], JISInfotextTransferTransformation);
30
+ //# sourceMappingURL=JISInfotextTransferTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISInfotextTransferTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.ts"],"names":[],"mappings":";;;;;;;;;AAEA,6GAA0G;AAC1G,iEAAgE;AAChE,oEAAiE;AAG1D,IAAM,iCAAiC,+CAAvC,MAAM,iCAAkC,SAAQ,+CAAqE;IAArH;;QACI,SAAI,GAAG,mCAAmC,CAAC;QAExC,sBAAiB,GAAG,CAAC,QAA2B,EAAE,EAAE;;YAC1D,OAAO;gBACH,YAAY,EAAE,qCAAiB,CAAC,2BAA2B,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAClF,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;gBAClC,OAAO,EAAE,MAAA,QAAQ,CAAC,gBAAgB,CAAC,EAAE,mCAAI,IAAI;aAChD,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;4CAVY,iCAAiC;IAD7C,IAAA,qBAAU,GAAE;GACA,iCAAiC,CAU7C"}
@@ -0,0 +1,22 @@
1
+ import { ITransferDeparture, ITransferOutputDto } from "../..";
2
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
3
+ export declare class TransferDepartureTransformation extends AbstractTransformation<ITransferDeparture, ITransferOutputDto> {
4
+ name: string;
5
+ protected transformInternal: (departure: ITransferDeparture) => {
6
+ departure_timestamp: {
7
+ minutes: string | null;
8
+ };
9
+ route: {
10
+ short_name: string | null;
11
+ type: import("../../../../helpers/RouteTypeEnums").GTFSRouteTypeEnum;
12
+ };
13
+ stop: {
14
+ platform_code: string | null;
15
+ };
16
+ trip: {
17
+ headsign: string;
18
+ id: string;
19
+ };
20
+ };
21
+ private calculateDepartureMinutes;
22
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TransferDepartureTransformation = void 0;
10
+ const DepartureCalculator_1 = require("../../../shared/DepartureCalculator");
11
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
12
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
13
+ const PlatformCodeResolver_1 = require("../helpers/PlatformCodeResolver");
14
+ let TransferDepartureTransformation = exports.TransferDepartureTransformation = class TransferDepartureTransformation extends AbstractTransformation_1.AbstractTransformation {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.name = "TransferDepartureTransformation";
18
+ this.transformInternal = (departure) => {
19
+ var _a;
20
+ return {
21
+ departure_timestamp: {
22
+ minutes: this.calculateDepartureMinutes(departure.departure_datetime_real),
23
+ },
24
+ route: {
25
+ short_name: departure.route_short_name,
26
+ type: departure.route_type,
27
+ },
28
+ stop: {
29
+ platform_code: PlatformCodeResolver_1.PlatformCodeResolver.resolve(departure),
30
+ },
31
+ trip: {
32
+ headsign: (_a = departure.stop_headsign) !== null && _a !== void 0 ? _a : departure.trip_headsign,
33
+ id: departure.trip_id,
34
+ },
35
+ };
36
+ };
37
+ }
38
+ calculateDepartureMinutes(predicted) {
39
+ if (!predicted) {
40
+ return null;
41
+ }
42
+ const departure_minutes = DepartureCalculator_1.DepartureCalculator.getDepartureMinutes(predicted);
43
+ if (departure_minutes < 1) {
44
+ return "<1";
45
+ }
46
+ return departure_minutes.toString();
47
+ }
48
+ };
49
+ exports.TransferDepartureTransformation = TransferDepartureTransformation = __decorate([
50
+ (0, tsyringe_1.injectable)()
51
+ ], TransferDepartureTransformation);
52
+ //# sourceMappingURL=TransferDepartureTransformation.js.map