@golemio/pid 4.0.2 → 4.0.3-dev.1993091012

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 (201) hide show
  1. package/README.md +1 -1
  2. package/db/example/redis/gtfsStopsCacheMock.json +8 -0
  3. package/db/example/redis/jisCacheMock.json +31 -0
  4. package/db/migrations/postgresql/20250716143052-add-stop-name-to-combined-stop-times.js +53 -0
  5. package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-down.sql +47 -0
  6. package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-up.sql +47 -0
  7. package/dist/helpers/GtfsStopParser.d.ts +2 -0
  8. package/dist/helpers/GtfsStopParser.js +11 -8
  9. package/dist/helpers/GtfsStopParser.js.map +1 -1
  10. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.d.ts +6 -0
  11. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js +11 -0
  12. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js.map +1 -0
  13. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +0 -1
  14. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
  15. package/dist/integration-engine/jis/ioc/Di.js +10 -0
  16. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  17. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +4 -0
  18. package/dist/integration-engine/jis/ioc/JISContainerToken.js +5 -0
  19. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  20. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +9 -0
  21. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +86 -0
  22. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +1 -0
  23. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +6 -1
  24. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +50 -2
  25. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
  26. package/dist/integration-engine/jis/repositories/JISMetadataRepository.d.ts +4 -1
  27. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js +37 -12
  28. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js.map +1 -1
  29. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.d.ts +7 -0
  30. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js +37 -0
  31. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js.map +1 -0
  32. package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
  33. package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
  34. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.d.ts +14 -0
  35. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.js +71 -0
  36. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.js.map +1 -0
  37. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.d.ts +10 -4
  38. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.js +15 -22
  39. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.js.map +1 -1
  40. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.d.ts +10 -5
  41. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +15 -23
  42. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -1
  43. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +13 -0
  44. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +47 -0
  45. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +1 -0
  46. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +1 -2
  47. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +5 -4
  48. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  49. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.d.ts +18 -0
  50. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js +44 -0
  51. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js.map +1 -0
  52. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.d.ts +5 -1
  53. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +24 -0
  54. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
  55. package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
  56. package/dist/integration-engine/ropid-gtfs/index.d.ts +1 -0
  57. package/dist/integration-engine/ropid-gtfs/index.js +1 -0
  58. package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
  59. package/dist/integration-engine/ropid-gtfs/ioc/Di.js +8 -0
  60. package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
  61. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +3 -0
  62. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +3 -0
  63. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
  64. package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js +1 -1
  65. package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js.map +1 -1
  66. package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +1 -0
  67. package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
  68. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +8 -5
  69. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
  70. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts +12 -0
  71. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js +44 -0
  72. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map +1 -0
  73. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.d.ts +12 -0
  74. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +87 -0
  75. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js.map +1 -0
  76. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +1 -0
  77. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
  78. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/interfaces/TripRepositoryInterfaces.d.ts +2 -1
  79. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.d.ts +3 -1
  80. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +100 -85
  81. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
  82. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
  83. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +1 -0
  84. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
  85. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +2 -0
  86. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
  87. package/dist/output-gateway/index.js +1 -0
  88. package/dist/output-gateway/index.js.map +1 -1
  89. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.d.ts +17 -0
  90. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js +113 -0
  91. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js.map +1 -0
  92. package/dist/output-gateway/jis/ioc/Di.js +2 -2
  93. package/dist/output-gateway/jis/ioc/Di.js.map +1 -1
  94. package/dist/output-gateway/jis/ioc/OgJisToken.d.ts +2 -0
  95. package/dist/output-gateway/jis/ioc/OgJisToken.js +2 -0
  96. package/dist/output-gateway/jis/ioc/OgJisToken.js.map +1 -1
  97. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
  98. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.d.ts +17 -0
  99. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js +154 -0
  100. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js.map +1 -0
  101. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.d.ts +14 -0
  102. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js +3 -0
  103. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js.map +1 -0
  104. package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
  105. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +4 -1
  106. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +7 -1
  107. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
  108. package/dist/output-gateway/pid/helpers/TransferBoardFilter.d.ts +5 -0
  109. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js +33 -0
  110. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js.map +1 -0
  111. package/dist/output-gateway/pid/helpers/TransferBoardSorter.d.ts +6 -0
  112. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js +61 -0
  113. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js.map +1 -0
  114. package/dist/output-gateway/pid/index.d.ts +50 -0
  115. package/dist/output-gateway/pid/index.js.map +1 -1
  116. package/dist/output-gateway/pid/ioc/Di.js +62 -6
  117. package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
  118. package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +11 -0
  119. package/dist/output-gateway/pid/ioc/OgPidToken.js +11 -0
  120. package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
  121. package/dist/output-gateway/pid/routers/index.d.ts +1 -0
  122. package/dist/output-gateway/pid/routers/index.js +3 -1
  123. package/dist/output-gateway/pid/routers/index.js.map +1 -1
  124. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.d.ts +16 -0
  125. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js +67 -0
  126. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js.map +1 -0
  127. package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +7 -2
  128. package/dist/output-gateway/pid/service/facade/InfotextFacade.js +29 -4
  129. package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
  130. package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +12 -3
  131. package/dist/output-gateway/pid/service/facade/StopFacade.js +43 -7
  132. package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
  133. package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +11 -9
  134. package/dist/output-gateway/pid/service/facade/TransferFacade.js +117 -14
  135. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
  136. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +7 -1
  137. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +12 -0
  138. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -1
  139. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts +13 -0
  140. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js +31 -0
  141. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js.map +1 -0
  142. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts +27 -0
  143. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js +78 -0
  144. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map +1 -0
  145. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +1 -1
  146. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +4 -4
  147. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
  148. package/dist/output-gateway/public/ioc/Di.js +1 -1
  149. package/dist/output-gateway/public/ioc/Di.js.map +1 -1
  150. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.d.ts +13 -0
  151. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js +83 -0
  152. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js.map +1 -0
  153. package/dist/output-gateway/shared/constants/route-version.d.ts +2 -1
  154. package/dist/output-gateway/shared/constants/route-version.js +1 -0
  155. package/dist/output-gateway/shared/constants/route-version.js.map +1 -1
  156. package/dist/output-gateway/{public → shared}/service/VPSubscriber.d.ts +4 -2
  157. package/dist/output-gateway/{public → shared}/service/VPSubscriber.js +1 -1
  158. package/dist/output-gateway/shared/service/VPSubscriber.js.map +1 -0
  159. package/dist/schema-definitions/jis/redis/const.d.ts +1 -0
  160. package/dist/schema-definitions/jis/redis/const.js +2 -1
  161. package/dist/schema-definitions/jis/redis/const.js.map +1 -1
  162. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.d.ts +17 -0
  163. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js +3 -0
  164. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js.map +1 -0
  165. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.d.ts +1 -5
  166. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.d.ts +3 -0
  167. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js +59 -0
  168. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js.map +1 -0
  169. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js +5 -11
  170. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js.map +1 -1
  171. package/dist/schema-definitions/ropid-departures-presets/index.d.ts +1 -0
  172. package/dist/schema-definitions/ropid-departures-presets/index.js +3 -0
  173. package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
  174. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +16 -0
  175. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +3 -0
  176. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +1 -0
  177. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +1 -0
  178. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +58 -0
  179. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +69 -0
  180. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +1 -0
  181. package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +1 -0
  182. package/dist/schema-definitions/ropid-gtfs/redis/const.js +2 -1
  183. package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
  184. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +3 -2
  185. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +4 -0
  186. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
  187. package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +1 -0
  188. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +2 -0
  189. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +1 -0
  190. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +8 -0
  191. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
  192. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +4 -1
  193. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
  194. package/docs/asyncapi.yaml +45 -0
  195. package/docs/cache/types/redis.md +82 -2
  196. package/docs/implementation_documentation.md +2 -0
  197. package/docs/jis/index.md +17 -5
  198. package/docs/openapi-input.yaml +13 -2
  199. package/docs/openapi-output.yaml +326 -4
  200. package/package.json +2 -2
  201. package/dist/output-gateway/public/service/VPSubscriber.js.map +0 -1
@@ -17,25 +17,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TransferFacade = void 0;
19
19
  const pid_1 = require("../..");
20
- const data_access_1 = require("../../data-access");
21
20
  const OgPidToken_1 = require("../../ioc/OgPidToken");
22
- const PIDDepartureModel_1 = __importDefault(require("../../models/helpers/PIDDepartureModel"));
23
21
  const IPIDDepartureQueryOptions_1 = __importDefault(require("../../models/helpers/interfaces/IPIDDepartureQueryOptions"));
24
- const shared_1 = require("../../../shared");
25
22
  const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
26
23
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
27
24
  const TransferDepartureTransformation_1 = require("../transformations/TransferDepartureTransformation");
25
+ const PublicGtfsDepartureRepository_1 = require("../../../public/data-access/redis/PublicGtfsDepartureRepository");
26
+ const PublicVehiclePositionsRepository_1 = require("../../../public/data-access/redis/PublicVehiclePositionsRepository");
27
+ const PublicStopTimeRepository_1 = require("../../../public/data-access/redis/PublicStopTimeRepository");
28
+ const monitoring_1 = require("@golemio/core/dist/monitoring");
29
+ const PIDDepartureModel_1 = __importDefault(require("../../models/helpers/PIDDepartureModel"));
30
+ const shared_1 = require("../../../shared");
31
+ const data_access_1 = require("../../data-access");
32
+ const const_1 = require("../../../../const");
28
33
  let TransferFacade = exports.TransferFacade = class TransferFacade {
29
- constructor(departureRepository, departureTransformation) {
34
+ constructor(publicDepartureRepository, departureRepository, departureTransformation, tripRepository, stopTimeRepository) {
35
+ this.publicDepartureRepository = publicDepartureRepository;
30
36
  this.departureRepository = departureRepository;
31
37
  this.departureTransformation = departureTransformation;
38
+ this.tripRepository = tripRepository;
39
+ this.stopTimeRepository = stopTimeRepository;
32
40
  }
33
- /**
34
- * Retrieves transfer departures for given GTFS stop IDs
35
- * - Get transfer departures from DB
36
- * - Process them (filter, sort, etc.)
37
- * - Transform them to DTO
38
- */
39
41
  async getTransferDepartures(stopIds, tripNumber, currentMoment, minutesOffset, timeZone = shared_1.RopidRouterUtils.TIMEZONE) {
40
42
  let departureEntities = [];
41
43
  try {
@@ -71,6 +73,101 @@ let TransferFacade = exports.TransferFacade = class TransferFacade {
71
73
  }
72
74
  return transferDepartures;
73
75
  }
76
+ async getTransferCache(stopIds, reqNumber, vehicleType) {
77
+ const span = (0, monitoring_1.createChildSpan)(`Departures.getTransferCache`);
78
+ span?.setAttributes({ stopIds, reqNumber, vehicleType });
79
+ try {
80
+ let departureEntities = [];
81
+ try {
82
+ departureEntities = await this.publicDepartureRepository.getPublicGtfsDepartureCache(stopIds, 60 * 6);
83
+ }
84
+ catch (error) {
85
+ span?.recordException(error);
86
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
87
+ throw error;
88
+ }
89
+ throw new golemio_errors_1.GeneralError("Failed to publicGtfsDepartureCache", this.constructor.name, error, 500);
90
+ }
91
+ const currentPosition = await this.tripRepository.getDetailedVehiclePosition(`service-${vehicleType}-${reqNumber}`);
92
+ let currentDeparture = null;
93
+ let currentStopTime = null;
94
+ if (currentPosition) {
95
+ const departureIndex = departureEntities.findIndex((departure) => {
96
+ return departure.trip_id === currentPosition.gtfs_trip_id;
97
+ }) ?? null;
98
+ // Remove currentDeparture from departureEntities
99
+ if (departureIndex !== -1) {
100
+ currentDeparture = departureEntities.splice(departureIndex, 1)[0];
101
+ }
102
+ const stopTimes = await this.stopTimeRepository.getPublicStopTimeCache(currentPosition.vehicle_id, currentPosition.gtfs_trip_id);
103
+ currentStopTime =
104
+ stopTimes.find((stopTime) => stopTime.sequence === currentPosition.detailed_info.last_stop_sequence + 1) ??
105
+ null;
106
+ }
107
+ const positionsByTrip = await this.tripRepository.getAllVehiclePositionsForMultipleTrips(departureEntities.map((departure) => departure.trip_id));
108
+ let transfers = [];
109
+ for (const departure of departureEntities) {
110
+ const positions = positionsByTrip.get(departure.trip_id) ?? [];
111
+ const duplicatedDepartures = await this.processMultiplePostionsForDeparture(departure, positions);
112
+ transfers.push(...duplicatedDepartures);
113
+ }
114
+ return {
115
+ currentTrip: {
116
+ departure: currentDeparture,
117
+ position: currentPosition,
118
+ stopTime: currentStopTime,
119
+ },
120
+ transfers,
121
+ };
122
+ }
123
+ catch (error) {
124
+ span?.recordException(error);
125
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
126
+ throw error;
127
+ }
128
+ throw new golemio_errors_1.GeneralError("Error in getTransferCache", this.constructor.name, error, 500);
129
+ }
130
+ finally {
131
+ span?.end();
132
+ }
133
+ }
134
+ async processMultiplePostionsForDeparture(departure, vehiclePositions) {
135
+ const outputGroup = [];
136
+ try {
137
+ // If there are no RT data, we still want to display the departure
138
+ // but without any RT/vehicle information
139
+ if (vehiclePositions.length === 0) {
140
+ outputGroup.push({
141
+ departure,
142
+ position: null,
143
+ stopTime: null,
144
+ });
145
+ }
146
+ // Otherwise, we want to duplicate the departure for each vehicleId
147
+ // (multiple vehicles can be on the same trip at the same time)
148
+ for (const vehiclePosition of vehiclePositions) {
149
+ // filter out CANCELED trips
150
+ if (vehiclePosition.state_position === const_1.StatePositionEnum.CANCELED) {
151
+ continue;
152
+ }
153
+ let currentStopTime = null;
154
+ const stopTimes = await this.stopTimeRepository.getPublicStopTimeCache(vehiclePosition.vehicle_id, departure.trip_id);
155
+ currentStopTime = stopTimes.find((stopTime) => stopTime.sequence === departure.stop_sequence) ?? null;
156
+ outputGroup.push({
157
+ departure,
158
+ position: vehiclePosition,
159
+ stopTime: currentStopTime,
160
+ });
161
+ }
162
+ return outputGroup;
163
+ }
164
+ catch (error) {
165
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
166
+ throw error;
167
+ }
168
+ throw new golemio_errors_1.GeneralError("Error in processMultiplePostionsForDeparture", this.constructor.name, error, 500);
169
+ }
170
+ }
74
171
  /**
75
172
  * Fallback options as defined by ROPID
76
173
  */
@@ -91,9 +188,15 @@ let TransferFacade = exports.TransferFacade = class TransferFacade {
91
188
  };
92
189
  exports.TransferFacade = TransferFacade = __decorate([
93
190
  (0, tsyringe_1.injectable)(),
94
- __param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.DeparturesRepository)),
95
- __param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferDepartureTransformation)),
96
- __metadata("design:paramtypes", [data_access_1.DeparturesRepository,
97
- TransferDepartureTransformation_1.TransferDepartureTransformation])
191
+ __param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicGtfsDepartureRepository)),
192
+ __param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.DeparturesRepository)),
193
+ __param(2, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.TransferDepartureTransformation)),
194
+ __param(3, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicVehiclePositionsRepository)),
195
+ __param(4, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.PublicStopTimeRepository)),
196
+ __metadata("design:paramtypes", [PublicGtfsDepartureRepository_1.PublicGtfsDepartureRepository,
197
+ data_access_1.DeparturesRepository,
198
+ TransferDepartureTransformation_1.TransferDepartureTransformation,
199
+ PublicVehiclePositionsRepository_1.PublicVehiclePositionsRepository,
200
+ PublicStopTimeRepository_1.PublicStopTimeRepository])
98
201
  ], TransferFacade);
99
202
  //# sourceMappingURL=TransferFacade.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransferFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/TransferFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAAgI;AAChI,mDAA2D;AAC3D,qDAAoD;AACpD,+FAA0E;AAC1E,0HAAoG;AACpG,4CAA8C;AAC9C,6EAA8F;AAE9F,iEAAwE;AACxE,wGAAqG;AAG9F,IAAM,cAAc,4BAApB,MAAM,cAAc;IACvB,YACqD,mBAAyC,EAC9B,uBAAwD;QADnE,wBAAmB,GAAnB,mBAAmB,CAAsB;QAC9B,4BAAuB,GAAvB,uBAAuB,CAAiC;IACrH,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAC9B,OAAiB,EACjB,UAAyB,EACzB,aAAqB,EACrB,aAAqB,EACrB,QAAQ,GAAG,yBAAgB,CAAC,QAAQ;QAEpC,IAAI,iBAAiB,GAAyB,EAAE,CAAC;QACjD,IAAI;YACA,iBAAiB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,CAAC;gBACrE,QAAQ,EAAE,OAAO;gBACjB,aAAa;gBACb,aAAa;aAChB,CAAC,CAAC;SACN;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,KAAK,YAAY,qCAAoB,EAAE;gBACvC,MAAM,KAAK,CAAC;aACf;YAED,MAAM,IAAI,6BAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;SACvG;QAED,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,EAAE,CAAC;SACb;QAED,IAAI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oB;QACL,iEAA+B;QACvC,mEAAgC;QACpC,mDAAwB;GAN5F,cAAc,CAyL1B"}
@@ -1,4 +1,4 @@
1
- import { ITransferDeparture } from "../..";
1
+ import { ITransferDeparture, IDepartureWithPosition } from "../..";
2
2
  export declare class PlatformCodeResolver {
3
3
  /**
4
4
  * Platform code is determined by the following rules:
@@ -7,4 +7,10 @@ export declare class PlatformCodeResolver {
7
7
  * - for other route types, the departure platform code is used (GTFS)
8
8
  */
9
9
  static resolve(departure: ITransferDeparture): string | null;
10
+ /**
11
+ * Determine platform code based on the following rules:
12
+ * if current stop time is known, use its RT CIS platform code (if available)
13
+ * otherwise use GTFS schedule platform code
14
+ */
15
+ static determinePlatformCode: (inputDto: IDepartureWithPosition) => string | null;
10
16
  }
@@ -17,4 +17,16 @@ class PlatformCodeResolver {
17
17
  }
18
18
  }
19
19
  exports.PlatformCodeResolver = PlatformCodeResolver;
20
+ /**
21
+ * Determine platform code based on the following rules:
22
+ * if current stop time is known, use its RT CIS platform code (if available)
23
+ * otherwise use GTFS schedule platform code
24
+ */
25
+ PlatformCodeResolver.determinePlatformCode = (inputDto) => {
26
+ const { departure, stopTime } = inputDto;
27
+ if (stopTime) {
28
+ return stopTime.cis_stop_platform_code;
29
+ }
30
+ return departure.platform_code;
31
+ };
20
32
  //# sourceMappingURL=PlatformCodeResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/helpers/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,SAA6B;QAC/C,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,IAAI,EAAE;YACvG,OAAO,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,aAAa,CAAC;IACnC,CAAC;CACJ;AAdD,oDAcC"}
1
+ {"version":3,"file":"PlatformCodeResolver.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/helpers/PlatformCodeResolver.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,SAA6B;QAC/C,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,IAAI,SAAS,CAAC,6BAA6B,CAAC,KAAK,IAAI,EAAE;YACvG,OAAO,SAAS,CAAC,6BAA6B,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,aAAa,CAAC;IACnC,CAAC;;AAbL,oDA4BC;AAdG;;;;GAIG;AACW,0CAAqB,GAAG,CAAC,QAAgC,EAAiB,EAAE;IACtF,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;IAEzC,IAAI,QAAQ,EAAE;QACV,OAAO,QAAQ,CAAC,sBAAsB,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,aAAa,CAAC;AACnC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { IV4InfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
2
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
3
+ import { IJISInfotextDto } from "../../../../schema-definitions/jis/redis/interfaces/IJISInfotextDto";
4
+ export declare class JISInfotextCacheTransferTransformation extends AbstractTransformation<IJISInfotextDto, IV4InfotextTransferOutputDto> {
5
+ name: string;
6
+ protected transformInternal: (infotext: IJISInfotextDto) => {
7
+ display_type: import("../../domain/InfotextDisplayTypeEnum").InfotextDisplayType;
8
+ text: {
9
+ cs: string;
10
+ en: string | null;
11
+ };
12
+ };
13
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.JISInfotextCacheTransferTransformation = void 0;
10
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
11
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
12
+ const DisplayTypeMapper_1 = require("../helpers/DisplayTypeMapper");
13
+ let JISInfotextCacheTransferTransformation = exports.JISInfotextCacheTransferTransformation = class JISInfotextCacheTransferTransformation extends AbstractTransformation_1.AbstractTransformation {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.name = "JISInfotextCacheTransferTransformation";
17
+ this.transformInternal = (infotext) => {
18
+ return {
19
+ display_type: DisplayTypeMapper_1.DisplayTypeMapper.mapInputToOutputDisplayType(infotext.display_type),
20
+ text: {
21
+ cs: infotext.description_text.cs,
22
+ en: infotext.description_text.en ?? null,
23
+ },
24
+ };
25
+ };
26
+ }
27
+ };
28
+ exports.JISInfotextCacheTransferTransformation = JISInfotextCacheTransferTransformation = __decorate([
29
+ (0, tsyringe_1.injectable)()
30
+ ], JISInfotextCacheTransferTransformation);
31
+ //# sourceMappingURL=JISInfotextCacheTransferTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISInfotextCacheTransferTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,oEAAiE;AAI1D,IAAM,sCAAsC,oDAA5C,MAAM,sCAAuC,SAAQ,+CAG3D;IAHM;;QAII,SAAI,GAAG,wCAAwC,CAAC;QAE7C,sBAAiB,GAAG,CAAC,QAAyB,EAAE,EAAE;YACxD,OAAO;gBACH,YAAY,EAAE,qCAAiB,CAAC,2BAA2B,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAClF,IAAI,EAAE;oBACF,EAAE,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;oBAChC,EAAE,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,IAAI;iBAC3C;aACJ,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;iDAfY,sCAAsC;IADlD,IAAA,qBAAU,GAAE;GACA,sCAAsC,CAelD"}
@@ -0,0 +1,27 @@
1
+ import { IDepartureWithPosition, IV4TransferDepartureOutputDto } from "../..";
2
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
3
+ import { GTFSRouteTypeEnum } from "../../../../helpers/RouteTypeEnums";
4
+ export declare class TransferDepartureCacheTransformation extends AbstractTransformation<IDepartureWithPosition, IV4TransferDepartureOutputDto> {
5
+ name: string;
6
+ transformArray: (data: IDepartureWithPosition[]) => IV4TransferDepartureOutputDto[];
7
+ protected transformInternal: (data: IDepartureWithPosition) => {
8
+ departure_timestamp: {
9
+ minutes: string[];
10
+ };
11
+ route: {
12
+ short_name: string;
13
+ type: GTFSRouteTypeEnum;
14
+ };
15
+ stop: {
16
+ platform_code: string | null;
17
+ };
18
+ trip: {
19
+ headsign: string;
20
+ id: string;
21
+ is_wheelchair_accessible: boolean | null;
22
+ };
23
+ icons: never[];
24
+ substitution_text: null;
25
+ };
26
+ private calculateDepartureMinutes;
27
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TransferDepartureCacheTransformation = void 0;
10
+ const DepartureCalculator_1 = require("../../../shared/DepartureCalculator");
11
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
12
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
13
+ const PlatformCodeResolver_1 = require("../helpers/PlatformCodeResolver");
14
+ const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
15
+ let TransferDepartureCacheTransformation = exports.TransferDepartureCacheTransformation = class TransferDepartureCacheTransformation extends AbstractTransformation_1.AbstractTransformation {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.name = "TransferDepartureCacheTransformation";
19
+ this.transformArray = (data) => {
20
+ const departures = new Map();
21
+ const res = [];
22
+ for (const { departure, position, stopTime } of data) {
23
+ if (departure.route_type === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO) {
24
+ // TODO: what to do if there is no position for metro
25
+ const departureRouteAndDirection = `${departure.route_short_name}-${position?.detailed_info.direction_id ?? 0}`;
26
+ const dep = departures.get(departureRouteAndDirection);
27
+ if (dep) {
28
+ if (dep.departure_timestamp.minutes.length >= 2) {
29
+ continue;
30
+ }
31
+ dep.departure_timestamp.minutes.push(this.calculateDepartureMinutes(departure.predictedDepartureDate));
32
+ departures.set(departureRouteAndDirection, dep);
33
+ }
34
+ else {
35
+ departures.set(departureRouteAndDirection, this.transformInternal({ departure, position, stopTime }));
36
+ }
37
+ }
38
+ else {
39
+ res.push(this.transformInternal({ departure, position, stopTime }));
40
+ }
41
+ }
42
+ return [...Array.from(departures.values()), ...res];
43
+ };
44
+ this.transformInternal = (data) => {
45
+ const { departure, position } = data;
46
+ return {
47
+ departure_timestamp: {
48
+ minutes: [this.calculateDepartureMinutes(departure.predictedDepartureDate)],
49
+ },
50
+ route: {
51
+ short_name: departure.route_short_name,
52
+ type: departure.route_type,
53
+ },
54
+ stop: {
55
+ platform_code: PlatformCodeResolver_1.PlatformCodeResolver.determinePlatformCode(data),
56
+ },
57
+ trip: {
58
+ headsign: departure.trip_headsign,
59
+ id: departure.trip_id,
60
+ is_wheelchair_accessible: position?.detailed_info.is_wheelchair_accessible ?? null,
61
+ },
62
+ icons: [],
63
+ substitution_text: null,
64
+ };
65
+ };
66
+ }
67
+ calculateDepartureMinutes(departureTime) {
68
+ const departure_minutes = DepartureCalculator_1.DepartureCalculator.getDepartureMinutes(departureTime);
69
+ if (departure_minutes < 1 && departure_minutes >= 0) {
70
+ return "<1";
71
+ }
72
+ return departure_minutes.toString();
73
+ }
74
+ };
75
+ exports.TransferDepartureCacheTransformation = TransferDepartureCacheTransformation = __decorate([
76
+ (0, tsyringe_1.injectable)()
77
+ ], TransferDepartureCacheTransformation);
78
+ //# sourceMappingURL=TransferDepartureCacheTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferDepartureCacheTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6EAAqE;AACrE,6GAA0G;AAC1G,iEAAgE;AAChE,0EAAuE;AAEvE,uEAA4D;AAGrD,IAAM,oCAAoC,kDAA1C,MAAM,oCAAqC,SAAQ,+CAGzD;IAHM;;QAII,SAAI,GAAG,sCAAsC,CAAC;QAE9C,mBAAc,GAAG,CAAC,IAA8B,EAAmC,EAAE;YACxF,MAAM,UAAU,GAA+C,IAAI,GAAG,EAAE,CAAC;YACzE,MAAM,GAAG,GAAoC,EAAE,CAAC;YAEhD,KAAK,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE;gBAClD,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAiB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AAC,gBAAgB;oBACtC,IAAI,EAAE,SAAS,CAAC,UAAU;iBAC7B;gBACD,IAAI,EAAE;oBACF,aAAa,EAAE,2CAAoB,CAAC,qBAAqB,CAAC,IAAI,CAAC;iBAClE;gBACD,IAAI,EAAE;oBACF,QAAQ,EAAE,SAAS,CAAC,aAAa;oBACjC,EAAE,EAAE,SAAS,CAAC,OAAO;oBACrB,wBAAwB,EAAE,QAAQ,EAAE,aAAa,CAAC,wBAAwB,IAAI,IAAI;iBACrF;gBACD,KAAK,EAAE,EAAE;gBACT,iBAAiB,EAAE,IAAI;aAC1B,CAAC;QACN,CAAC,CAAC;IAUN,CAAC;IARW,yBAAyB,CAAC,aAAmB;QACjD,MAAM,iBAAiB,GAAG,yCAAmB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACjF,IAAI,iBAAiB,GAAG,CAAC,IAAI,iBAAiB,IAAI,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACf;QAED,OAAO,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IACxC,CAAC;CACJ,CAAA;+CA/DY,oCAAoC;IADhD,IAAA,qBAAU,GAAE;GACA,oCAAoC,CA+DhD"}
@@ -6,6 +6,6 @@ export declare class PublicGtfsDepartureRepository implements IGtfsDepartureRepo
6
6
  private redisConnector;
7
7
  private log;
8
8
  constructor(redisConnector: IoRedisConnector, log: ILogger);
9
- getPublicGtfsDepartureCache(stopIds: string[], minutesAfter: number): Promise<IPublicGtfsDepartureCacheDto[]>;
9
+ getPublicGtfsDepartureCache(stopIds: string[], minutesAfter: number, timeFrom?: Date): Promise<IPublicGtfsDepartureCacheDto[]>;
10
10
  private getAndParseDepartureCache;
11
11
  }
@@ -23,11 +23,11 @@ let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = clas
23
23
  constructor(redisConnector, log) {
24
24
  this.redisConnector = redisConnector;
25
25
  this.log = log;
26
- this.getAndParseDepartureCache = async (stopId, minutesAfter) => {
26
+ this.getAndParseDepartureCache = async (stopId, minutesAfter, timeFrom) => {
27
27
  const connection = this.redisConnector.getConnection();
28
28
  let departureCache;
29
29
  try {
30
- departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, "-inf", Math.round(new Date().getTime() / 1000) + minutesAfter * 60);
30
+ departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, "-inf", Math.round(timeFrom?.getTime() ?? new Date().getTime() / 1000) + minutesAfter * 60);
31
31
  }
32
32
  catch (err) {
33
33
  throw new golemio_errors_1.GeneralError(`${this.constructor.name}: Cannot get public departure cache from cache: ${err.message}`, this.constructor.name, err);
@@ -44,11 +44,11 @@ let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = clas
44
44
  }
45
45
  };
46
46
  }
47
- async getPublicGtfsDepartureCache(stopIds, minutesAfter) {
47
+ async getPublicGtfsDepartureCache(stopIds, minutesAfter, timeFrom) {
48
48
  if (!this.redisConnector.isConnected()) {
49
49
  await this.redisConnector.connect();
50
50
  }
51
- const allDepartures = await Promise.all(stopIds.map((stopId) => this.getAndParseDepartureCache(stopId, minutesAfter)));
51
+ const allDepartures = await Promise.all(stopIds.map((stopId) => this.getAndParseDepartureCache(stopId, minutesAfter, timeFrom)));
52
52
  return allDepartures.flat();
53
53
  }
54
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC2C,cAAwC,EACrD,GAAoB;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;QAe1C,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C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACvC;QAED,MAAM,aAAa,GAAqC,MAAM,OAAO,CAAC,GAAG,CACrE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAChF,CAAC;QAEF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CAmCJ,CAAA;wCAnDY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,6BAA6B,CAmDzC"}
1
+ {"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC2C,cAAwC,EACrD,GAAoB;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;QAmB1C,8BAAyB,GAAG,KAAK,EACrC,MAAc,EACd,YAAoB,EACpB,QAAe,EACwB,EAAE;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;YAEvD,IAAI,cAAwB,CAAC;YAE7B,IAAI;gBACA,cAAc,GAAG,MAAM,UAAU,CAAC,aAAa,CAC3C,GAAG,yCAAiC,IAAI,MAAM,EAAE,EAChD,MAAM,EACN,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC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C;CAwCJ,CAAA;wCA5DY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,6BAA6B,CA4DzC"}
@@ -11,7 +11,7 @@ const DelayComputationRepository_1 = require("../data-access/redis/DelayComputat
11
11
  const PublicGtfsDepartureRepository_1 = require("../data-access/redis/PublicGtfsDepartureRepository");
12
12
  const PublicStopTimeRepository_1 = require("../data-access/redis/PublicStopTimeRepository");
13
13
  const PublicVehiclePositionsRepository_1 = require("../data-access/redis/PublicVehiclePositionsRepository");
14
- const VPSubscriber_1 = require("../service/VPSubscriber");
14
+ const VPSubscriber_1 = require("../../shared/service/VPSubscriber");
15
15
  const DepartureBoardFacade_1 = require("../service/facade/DepartureBoardFacade");
16
16
  const DetailedTripFacade_1 = require("../service/facade/DetailedTripFacade");
17
17
  const GtfsTripLookupFacade_1 = require("../service/facade/GtfsTripLookupFacade");
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/output-gateway/public/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,oFAAyE;AACzE,qFAAmF;AAEnF,wEAAqE;AAErE,iEAAkF;AAClF,iEAA4E;AAC5E,wGAAqG;AACrG,gGAA6F;AAC7F,sGAAmG;AACnG,4FAAyF;AACzF,4GAAyG;AAGzG,0DAAuD;AACvD,iFAA8E;AAC9E,6EAA0E;AAC1E,iFAA8E;AAC9E,qFAAwF;AACxF,4EAAyE;AACzE,gHAA6G;AAC7G,2GAA4G;AAC5G,+GAAgH;AAChH,qHAAsH;AACtH,qIAAsI;AAEtI,mGAAgG;AAChG,sGAAmG;AACnG,0GAAuG;AACvG,gHAA6G;AAC7G,gIAA6H;AAC7H,mIAAgI;AAChI,uIAAoI;AACpI,qJAAkJ;AAClJ,qIAAsI;AACtI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AAC,gCAAgC,CAAC,EACtF,CAAC,CAAC,OAAO,CAAsB,6BAAa,CAAC,wBAAwB,CAAC,EACtE,CAAC,CAAC,OAAO,CAAoC,6BAAa,CAAC,iCAAiC,CAAC,CAChG,CAAC;IACN,CAAC,CAAC;CACL,CAAC,CAAC;AAEH,iBAAiB,CAAC,QAAQ,CAAC,6BAAa,CAAC,YAAY,EAAE;IACnD,UAAU,EAAE,IAAA,iCAAsB,EAAC,CAAC,CAAC,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAAC,CAAC;QAEpD,OAAO,IAAI,2BAAY,CACnB;YACI,WAAW,EAAE,qCAA6B;YAC1C,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAS,gBAAgB,CAAC;YAChE,MAAM,EAAE,MAAM;SACjB,EACD,CAAC,CAAC,OAAO,CAA8B,6BAAa,CAAC,gCAAgC,CAAC,CACzF,CAAC;IACN,CAAC,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { RepositoryWithSubscriber } from "../../../shared/service/VPSubscriber";
2
+ import { IoRedisConnector } from "@golemio/core/dist/helpers/data-access/redis/IoRedisConnector";
3
+ import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
4
+ export declare class GtfsStopsRedisRepository implements RepositoryWithSubscriber {
5
+ private redisConnector;
6
+ private log;
7
+ private setName;
8
+ constructor(redisConnector: IoRedisConnector, log: ILogger);
9
+ private checkSetNameAndConnection;
10
+ setCurrentSetName(name: string): void;
11
+ getAswNodeIdFromCisId(cisId: string): Promise<string | null>;
12
+ getGtfsStopIdsByAswNode(aswNodeId: string): Promise<string[]>;
13
+ }
@@ -0,0 +1,83 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.GtfsStopsRedisRepository = void 0;
16
+ const const_1 = require("../../../../schema-definitions/ropid-gtfs/redis/const");
17
+ const IoRedisConnector_1 = require("@golemio/core/dist/helpers/data-access/redis/IoRedisConnector");
18
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
19
+ const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
20
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
21
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
22
+ let GtfsStopsRedisRepository = exports.GtfsStopsRedisRepository = class GtfsStopsRedisRepository {
23
+ constructor(redisConnector, log) {
24
+ this.redisConnector = redisConnector;
25
+ this.log = log;
26
+ this.setName = undefined; // loaded via pub sub or loaded from redis
27
+ }
28
+ async checkSetNameAndConnection() {
29
+ if (!this.redisConnector.isConnected()) {
30
+ await this.redisConnector.connect();
31
+ }
32
+ const connection = this.redisConnector.getConnection();
33
+ if (!this.setName) {
34
+ const loadedSetName = await connection.get(`${const_1.GTFS_STOPS_NAMESPACE_PREFIX}:activeSetName`);
35
+ if (!loadedSetName) {
36
+ this.log.debug(`Empty setName for ${const_1.GTFS_STOPS_NAMESPACE_PREFIX}`);
37
+ return null;
38
+ }
39
+ else {
40
+ this.setName = loadedSetName;
41
+ }
42
+ }
43
+ return connection;
44
+ }
45
+ setCurrentSetName(name) {
46
+ this.setName = name;
47
+ }
48
+ async getAswNodeIdFromCisId(cisId) {
49
+ const connection = await this.checkSetNameAndConnection();
50
+ if (!connection) {
51
+ return null;
52
+ }
53
+ try {
54
+ return await connection.hget(`${this.setName}:cisToAswNode`, cisId);
55
+ }
56
+ catch (error) {
57
+ throw new golemio_errors_1.GeneralError("Cannot get run trips from cache", this.constructor.name, error);
58
+ }
59
+ }
60
+ async getGtfsStopIdsByAswNode(aswNodeId) {
61
+ const connection = await this.checkSetNameAndConnection();
62
+ if (!connection) {
63
+ return [];
64
+ }
65
+ try {
66
+ const listOfGtfsStops = await connection.hget(`${this.setName}:aswNodeToGtfsStops`, aswNodeId);
67
+ if (!listOfGtfsStops) {
68
+ return [];
69
+ }
70
+ return listOfGtfsStops.split(",");
71
+ }
72
+ catch (error) {
73
+ throw new golemio_errors_1.GeneralError("Cannot get run trips from cache", this.constructor.name, error);
74
+ }
75
+ }
76
+ };
77
+ exports.GtfsStopsRedisRepository = GtfsStopsRedisRepository = __decorate([
78
+ (0, tsyringe_1.injectable)(),
79
+ __param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.RedisConnector)),
80
+ __param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
81
+ __metadata("design:paramtypes", [IoRedisConnector_1.IoRedisConnector, Object])
82
+ ], GtfsStopsRedisRepository);
83
+ //# sourceMappingURL=GtfsStopsRedisRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GtfsStopsRedisRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAA0E;AAC1E,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAA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AK,CAAC,CAAC;SAC3F;IACL,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,SAAiB;QAClD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC1D,IAAI,CAAC,UAAU,EAAE;YACb,OAAO,EAAE,CAAC;SACb;QACD,IAAI;YACA,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,qBAAqB,EAAE,SAAS,CAAC,CAAC;YAE/F,IAAI,CAAC,eAAe,EAAE;gBAClB,OAAO,EAAE,CAAC;aACb;YACD,OAAO,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAI,6BAAY,CAAC,iCAAiC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SAC3F;IACL,CAAC;CACJ,CAAA;mCAzDY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAJ1E,wBAAwB,CAyDpC"}
@@ -1,5 +1,6 @@
1
1
  export declare enum RouteVersion {
2
2
  v1 = "v1",
3
3
  v2 = "v2",
4
- v3 = "v3"
4
+ v3 = "v3",
5
+ v4 = "v4"
5
6
  }
@@ -6,5 +6,6 @@ var RouteVersion;
6
6
  RouteVersion["v1"] = "v1";
7
7
  RouteVersion["v2"] = "v2";
8
8
  RouteVersion["v3"] = "v3";
9
+ RouteVersion["v4"] = "v4";
9
10
  })(RouteVersion || (exports.RouteVersion = RouteVersion = {}));
10
11
  //# sourceMappingURL=route-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"route-version.js","sourceRoot":"","sources":["../../../../src/output-gateway/shared/constants/route-version.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,yBAAS,CAAA;IACT,yBAAS,CAAA;IACT,yBAAS,CAAA;AACb,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB"}
1
+ {"version":3,"file":"route-version.js","sourceRoot":"","sources":["../../../../src/output-gateway/shared/constants/route-version.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,yBAAS,CAAA;IACT,yBAAS,CAAA;IACT,yBAAS,CAAA;IACT,yBAAS,CAAA;AACb,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
@@ -1,7 +1,9 @@
1
1
  import { ISubscriberOptions, RedisSubscriber } from "@golemio/core/dist/helpers/data-access/pubsub/subscribers/RedisSubscriber";
2
- import { IVehiclePositionsRepository } from "../domain/repository/IVehiclePositionsRepository";
3
2
  export declare class VPSubscriber extends RedisSubscriber {
4
3
  private repository;
5
- constructor(options: ISubscriberOptions, repository: IVehiclePositionsRepository);
4
+ constructor(options: ISubscriberOptions, repository: RepositoryWithSubscriber);
6
5
  initialize(): Promise<void>;
7
6
  }
7
+ export interface RepositoryWithSubscriber {
8
+ setCurrentSetName(name: string): void;
9
+ }
@@ -9,7 +9,7 @@ class VPSubscriber extends RedisSubscriber_1.RedisSubscriber {
9
9
  }
10
10
  async initialize() {
11
11
  await this.subscribe();
12
- this.logger.debug("Redis subscriber subscribed to channel for Public API.");
12
+ this.logger.debug(`Redis subscriber subscribed to channel: ${this.redisChannel}`);
13
13
  this.listen((message) => {
14
14
  this.logger.debug("Redis subscriber received a message to change repository source.");
15
15
  if (message !== undefined) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VPSubscriber.js","sourceRoot":"","sources":["../../../../src/output-gateway/shared/service/VPSubscriber.ts"],"names":[],"mappings":";;;AAAA,+GAAgI;AAEhI,MAAa,YAAa,SAAQ,iCAAe;IAC7C,YAAY,OAA2B,EAAU,UAAoC;QACjF,KAAK,CAAC,OAAO,CAAC,CAAC;QAD8B,eAAU,GAAV,UAAU,CAA0B;IAErF,CAAC;IAEM,KAAK,CAAC,UAAU;QACnB,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QAEvB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;YACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;YACtF,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;aAC9C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAhBD,oCAgBC"}