@golemio/pid 4.0.2 → 4.0.3-dev.1988936235

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 (198) 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/tasks/PropagateTrainDelayTask.js.map +1 -1
  80. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +1 -0
  81. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
  82. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +2 -0
  83. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
  84. package/dist/output-gateway/index.js +1 -0
  85. package/dist/output-gateway/index.js.map +1 -1
  86. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.d.ts +17 -0
  87. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js +113 -0
  88. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js.map +1 -0
  89. package/dist/output-gateway/jis/ioc/Di.js +2 -2
  90. package/dist/output-gateway/jis/ioc/Di.js.map +1 -1
  91. package/dist/output-gateway/jis/ioc/OgJisToken.d.ts +2 -0
  92. package/dist/output-gateway/jis/ioc/OgJisToken.js +2 -0
  93. package/dist/output-gateway/jis/ioc/OgJisToken.js.map +1 -1
  94. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
  95. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.d.ts +17 -0
  96. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js +154 -0
  97. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js.map +1 -0
  98. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.d.ts +14 -0
  99. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js +3 -0
  100. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js.map +1 -0
  101. package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
  102. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +4 -1
  103. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +7 -1
  104. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
  105. package/dist/output-gateway/pid/helpers/TransferBoardFilter.d.ts +5 -0
  106. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js +33 -0
  107. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js.map +1 -0
  108. package/dist/output-gateway/pid/helpers/TransferBoardSorter.d.ts +6 -0
  109. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js +61 -0
  110. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js.map +1 -0
  111. package/dist/output-gateway/pid/index.d.ts +50 -0
  112. package/dist/output-gateway/pid/index.js.map +1 -1
  113. package/dist/output-gateway/pid/ioc/Di.js +62 -6
  114. package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
  115. package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +11 -0
  116. package/dist/output-gateway/pid/ioc/OgPidToken.js +11 -0
  117. package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
  118. package/dist/output-gateway/pid/routers/index.d.ts +1 -0
  119. package/dist/output-gateway/pid/routers/index.js +3 -1
  120. package/dist/output-gateway/pid/routers/index.js.map +1 -1
  121. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.d.ts +16 -0
  122. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js +67 -0
  123. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js.map +1 -0
  124. package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +7 -2
  125. package/dist/output-gateway/pid/service/facade/InfotextFacade.js +29 -4
  126. package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
  127. package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +12 -3
  128. package/dist/output-gateway/pid/service/facade/StopFacade.js +43 -7
  129. package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
  130. package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +11 -9
  131. package/dist/output-gateway/pid/service/facade/TransferFacade.js +117 -14
  132. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
  133. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +7 -1
  134. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +12 -0
  135. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -1
  136. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts +13 -0
  137. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js +31 -0
  138. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js.map +1 -0
  139. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts +27 -0
  140. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js +78 -0
  141. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map +1 -0
  142. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +1 -1
  143. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +4 -4
  144. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
  145. package/dist/output-gateway/public/ioc/Di.js +1 -1
  146. package/dist/output-gateway/public/ioc/Di.js.map +1 -1
  147. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.d.ts +13 -0
  148. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js +83 -0
  149. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js.map +1 -0
  150. package/dist/output-gateway/shared/constants/route-version.d.ts +2 -1
  151. package/dist/output-gateway/shared/constants/route-version.js +1 -0
  152. package/dist/output-gateway/shared/constants/route-version.js.map +1 -1
  153. package/dist/output-gateway/{public → shared}/service/VPSubscriber.d.ts +4 -2
  154. package/dist/output-gateway/{public → shared}/service/VPSubscriber.js +1 -1
  155. package/dist/output-gateway/shared/service/VPSubscriber.js.map +1 -0
  156. package/dist/schema-definitions/jis/redis/const.d.ts +1 -0
  157. package/dist/schema-definitions/jis/redis/const.js +2 -1
  158. package/dist/schema-definitions/jis/redis/const.js.map +1 -1
  159. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.d.ts +17 -0
  160. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js +3 -0
  161. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js.map +1 -0
  162. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.d.ts +1 -5
  163. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.d.ts +3 -0
  164. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js +59 -0
  165. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js.map +1 -0
  166. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js +5 -11
  167. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js.map +1 -1
  168. package/dist/schema-definitions/ropid-departures-presets/index.d.ts +1 -0
  169. package/dist/schema-definitions/ropid-departures-presets/index.js +3 -0
  170. package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
  171. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +16 -0
  172. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +3 -0
  173. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +1 -0
  174. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +1 -0
  175. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +58 -0
  176. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +69 -0
  177. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +1 -0
  178. package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +1 -0
  179. package/dist/schema-definitions/ropid-gtfs/redis/const.js +2 -1
  180. package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
  181. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +3 -2
  182. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +4 -0
  183. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
  184. package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +1 -0
  185. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +2 -0
  186. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +1 -0
  187. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +8 -0
  188. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
  189. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +4 -1
  190. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
  191. package/docs/asyncapi.yaml +45 -0
  192. package/docs/cache/types/redis.md +82 -2
  193. package/docs/implementation_documentation.md +2 -0
  194. package/docs/jis/index.md +17 -5
  195. package/docs/openapi-input.yaml +13 -2
  196. package/docs/openapi-output.yaml +326 -4
  197. package/package.json +2 -2
  198. package/dist/output-gateway/public/service/VPSubscriber.js.map +0 -1
@@ -1,19 +1,24 @@
1
+ import { JISInfotextsRedisRepository } from "../../../jis/data-access/cache/JISInfotextsRedisRepository";
1
2
  import { JISInfotextRepository } from "../../data-access/JISInfotextRepository";
2
- import { IInfotextDepartureOutputDto, IInfotextOverviewOutputDto, IInfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
3
+ import { IInfotextDepartureOutputDto, IInfotextOverviewOutputDto, IInfotextTransferOutputDto, IV4InfotextTransferOutputDto } from "../../domain/InfotextInterfaces";
3
4
  import { JISInfotextStopSuppressionFilter } from "../../helpers/JISInfotextStopSuppressionFilter";
4
5
  import { IGetDeparturesOptions } from "../../models/interfaces/IGetDeparturesOptions";
5
6
  import { Moment } from "@golemio/core/dist/shared/moment-timezone";
6
7
  import { JISInfotextDepartureTransformation } from "../transformations/JISInfotextDepartureTransformation";
7
8
  import { JISInfotextOverviewTransformation } from "../transformations/JISInfotextOverviewTransformation";
8
9
  import { JISInfotextTransferTransformation } from "../transformations/JISInfotextTransferTransformation";
10
+ import { JISInfotextCacheTransferTransformation } from "../transformations/JISInfotextCacheTransferTransformation";
9
11
  export declare class InfotextFacade {
10
12
  private infotextRepository;
11
13
  private infotextDepartureTransformation;
12
14
  private infotextTransferTransformation;
13
15
  private infotextOverviewTransformation;
14
16
  private infotextStopFilter;
15
- constructor(infotextRepository: JISInfotextRepository, infotextDepartureTransformation: JISInfotextDepartureTransformation, infotextTransferTransformation: JISInfotextTransferTransformation, infotextOverviewTransformation: JISInfotextOverviewTransformation, infotextStopFilter: JISInfotextStopSuppressionFilter);
17
+ private infotextsRedisRepository;
18
+ private cacheTransferTransformation;
19
+ constructor(infotextRepository: JISInfotextRepository, infotextDepartureTransformation: JISInfotextDepartureTransformation, infotextTransferTransformation: JISInfotextTransferTransformation, infotextOverviewTransformation: JISInfotextOverviewTransformation, infotextStopFilter: JISInfotextStopSuppressionFilter, infotextsRedisRepository: JISInfotextsRedisRepository, cacheTransferTransformation: JISInfotextCacheTransferTransformation);
16
20
  getInfotextsForDepartureBoards(stopIds: string[], currentMoment: Moment, options: IGetDeparturesOptions): Promise<IInfotextDepartureOutputDto[]>;
17
21
  getInfotextsForTransferBoards(stopIds: string[], currentMoment: Moment, timeFrom: Moment | null): Promise<IInfotextTransferOutputDto[]>;
18
22
  getInfotextsForOverview(): Promise<IInfotextOverviewOutputDto[]>;
23
+ getInfotextsCache(stopIds: string[], currentMoment: Date, timeFrom: Date | null): Promise<IV4InfotextTransferOutputDto[]>;
19
24
  }
@@ -13,6 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.InfotextFacade = void 0;
16
+ const JISInfotextsRedisRepository_1 = require("../../../jis/data-access/cache/JISInfotextsRedisRepository");
16
17
  const JISInfotextRepository_1 = require("../../data-access/JISInfotextRepository");
17
18
  const JISInfotextStopSuppressionFilter_1 = require("../../helpers/JISInfotextStopSuppressionFilter");
18
19
  const OgPidToken_1 = require("../../ioc/OgPidToken");
@@ -21,13 +22,16 @@ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
21
22
  const JISInfotextDepartureTransformation_1 = require("../transformations/JISInfotextDepartureTransformation");
22
23
  const JISInfotextOverviewTransformation_1 = require("../transformations/JISInfotextOverviewTransformation");
23
24
  const JISInfotextTransferTransformation_1 = require("../transformations/JISInfotextTransferTransformation");
25
+ const JISInfotextCacheTransferTransformation_1 = require("../transformations/JISInfotextCacheTransferTransformation");
24
26
  let InfotextFacade = exports.InfotextFacade = class InfotextFacade {
25
- constructor(infotextRepository, infotextDepartureTransformation, infotextTransferTransformation, infotextOverviewTransformation, infotextStopFilter) {
27
+ constructor(infotextRepository, infotextDepartureTransformation, infotextTransferTransformation, infotextOverviewTransformation, infotextStopFilter, infotextsRedisRepository, cacheTransferTransformation) {
26
28
  this.infotextRepository = infotextRepository;
27
29
  this.infotextDepartureTransformation = infotextDepartureTransformation;
28
30
  this.infotextTransferTransformation = infotextTransferTransformation;
29
31
  this.infotextOverviewTransformation = infotextOverviewTransformation;
30
32
  this.infotextStopFilter = infotextStopFilter;
33
+ this.infotextsRedisRepository = infotextsRedisRepository;
34
+ this.cacheTransferTransformation = cacheTransferTransformation;
31
35
  }
32
36
  async getInfotextsForDepartureBoards(stopIds, currentMoment, options) {
33
37
  try {
@@ -69,9 +73,8 @@ let InfotextFacade = exports.InfotextFacade = class InfotextFacade {
69
73
  return this.infotextTransferTransformation.transformArray(filteredInfotexts);
70
74
  }
71
75
  catch (error) {
72
- if (error instanceof golemio_errors_1.AbstractGolemioError) {
76
+ if (error instanceof golemio_errors_1.AbstractGolemioError)
73
77
  throw error;
74
- }
75
78
  throw new golemio_errors_1.GeneralError("Failed to retrieve infotexts for transfer boards", this.constructor.name, error, 500);
76
79
  }
77
80
  }
@@ -94,6 +97,24 @@ let InfotextFacade = exports.InfotextFacade = class InfotextFacade {
94
97
  throw new golemio_errors_1.GeneralError("Failed to retrieve infotexts for overview", this.constructor.name, error, 500);
95
98
  }
96
99
  }
100
+ async getInfotextsCache(stopIds, currentMoment, timeFrom) {
101
+ try {
102
+ const infotexts = await this.infotextsRedisRepository.getActiveStopsInfotexts(stopIds, timeFrom ?? currentMoment);
103
+ if (infotexts.length === 0) {
104
+ return [];
105
+ }
106
+ const filteredInfotexts = this.infotextStopFilter.filterBySeverityLevel(infotexts);
107
+ if (filteredInfotexts.length === 0) {
108
+ return [];
109
+ }
110
+ return this.cacheTransferTransformation.transformArray(filteredInfotexts);
111
+ }
112
+ catch (error) {
113
+ if (error instanceof golemio_errors_1.AbstractGolemioError)
114
+ throw error;
115
+ throw new golemio_errors_1.GeneralError("Failed to retrieve infotexts for V4 transfer boards", this.constructor.name, error, 500);
116
+ }
117
+ }
97
118
  };
98
119
  exports.InfotextFacade = InfotextFacade = __decorate([
99
120
  (0, tsyringe_1.injectable)(),
@@ -102,10 +123,14 @@ exports.InfotextFacade = InfotextFacade = __decorate([
102
123
  __param(2, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextTransferTransformation)),
103
124
  __param(3, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextOverviewTransformation)),
104
125
  __param(4, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextStopSuppressionFilter)),
126
+ __param(5, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextsRedisRepository)),
127
+ __param(6, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.JISInfotextCacheTransferTransformation)),
105
128
  __metadata("design:paramtypes", [JISInfotextRepository_1.JISInfotextRepository,
106
129
  JISInfotextDepartureTransformation_1.JISInfotextDepartureTransformation,
107
130
  JISInfotextTransferTransformation_1.JISInfotextTransferTransformation,
108
131
  JISInfotextOverviewTransformation_1.JISInfotextOverviewTransformation,
109
- JISInfotextStopSuppressionFilter_1.JISInfotextStopSuppressionFilter])
132
+ JISInfotextStopSuppressionFilter_1.JISInfotextStopSuppressionFilter,
133
+ JISInfotextsRedisRepository_1.JISInfotextsRedisRepository,
134
+ JISInfotextCacheTransferTransformation_1.JISInfotextCacheTransferTransformation])
110
135
  ], InfotextFacade);
111
136
  //# sourceMappingURL=InfotextFacade.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InfotextFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/InfotextFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,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MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;YACnF,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;gBAChC,OAAO,EAAE,CAAC;aACb;YAED,OAAO,IAAI,CAAC,8BAA8B,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;SAChF;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,KAAK,YAAY,qCAAoB,EAAE;gBACvC,MAAM,KAAK,CAAC;aACf;YAED,MAAM,IAAI,6BAAY,CAAC,2CAA2C,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;SAC1G;IACL,CAAC;CACJ,CAAA;yBAvGY,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,qBAAqB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,kCAAkC,CAAC,CAAA;IAErD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,iCAAiC,CAAC,CAAA;IAEpD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,iCAAiC,CAAC,CAAA;IAEpD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,gCAAgC,CAAC,CAAA;qCAPkB,6CAAqB;QAElD,uEAAkC;QAEnC,qEAAiC;QAEjC,qEAAiC;QACQ,mEAAgC;GAT5G,cAAc,CAuG1B"}
1
+ {"version":3,"file":"InfotextFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/InfotextFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4GAAoG;AACpG,mFAAkF;AAOlF,qGAAoG;AACpG,qDAAoD;AAEpD,6EAA8F;AAE9F,iEAAwE;AACxE,8GAA2G;AAC3G,4GAAyG;AACzG,4GAAyG;AACzG,sHAAmH;AAG5G,IAAM,cAAc,4BAApB,MA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BAAqB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,kCAAkC,CAAC,CAAA;IAErD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,iCAAiC,CAAC,CAAA;IAEpD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,iCAAiC,CAAC,CAAA;IAEpD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,gCAAgC,CAAC,CAAA;IACnD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,2BAA2B,CAAC,CAAA;IAC9C,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,sCAAsC,CAAC,CAAA;qCATY,6CAAqB;QAElD,uEAAkC;QAEnC,qEAAiC;QAEjC,qEAAiC;QACQ,mEAAgC;QAC/B,yDAA2B;QAExE,+EAAsC;GAZtE,cAAc,CA8H1B"}
@@ -1,9 +1,18 @@
1
1
  import { CisStopGroupRepository } from "../../../ropid-gtfs/data-access/CisStopGroupRepository";
2
+ import { GtfsStopsRedisRepository } from "../../../ropid-gtfs/data-access/redis/GtfsStopsRedisRepository";
2
3
  export declare class StopFacade {
3
4
  private cisStopGroupsRepository;
4
- constructor(cisStopGroupsRepository: CisStopGroupRepository);
5
+ private gtfsStopsRedisRepository;
6
+ private readonly gtfsStopParser;
7
+ constructor(cisStopGroupsRepository: CisStopGroupRepository, gtfsStopsRedisRepository: GtfsStopsRedisRepository);
8
+ getStopIdsForTransferBoards(cisId: string): Promise<string[]>;
5
9
  /**
6
- * Retrieves ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
10
+ * Retrieve ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
7
11
  */
8
- getStopIdsForTransferBoards(cisId: string): Promise<string[]>;
12
+ getStopIdsForTransferBoardsByCisId(cisId: string): Promise<string[]>;
13
+ /**
14
+ * Retrieve ASW node ID for given ASW stop ID and then returns GTFS stop IDs for this ASW node
15
+ */
16
+ getStopIdsForTransferBoardsByAswId(aswId: string): Promise<string[]>;
17
+ private getStopIdsForTransferBoardsByAswNode;
9
18
  }
@@ -13,18 +13,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.StopFacade = void 0;
16
+ const GtfsStopParser_1 = require("../../../../helpers/GtfsStopParser");
16
17
  const OgPidToken_1 = require("../../ioc/OgPidToken");
17
- const CisStopGroupRepository_1 = require("../../../ropid-gtfs/data-access/CisStopGroupRepository");
18
18
  const models_1 = require("../../../ropid-gtfs/models");
19
- const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
19
+ const CisStopGroupRepository_1 = require("../../../ropid-gtfs/data-access/CisStopGroupRepository");
20
+ const GtfsStopsRedisRepository_1 = require("../../../ropid-gtfs/data-access/redis/GtfsStopsRedisRepository");
20
21
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
22
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
21
23
  let StopFacade = exports.StopFacade = class StopFacade {
22
- constructor(cisStopGroupsRepository) {
24
+ constructor(cisStopGroupsRepository, gtfsStopsRedisRepository) {
23
25
  this.cisStopGroupsRepository = cisStopGroupsRepository;
26
+ this.gtfsStopsRedisRepository = gtfsStopsRedisRepository;
27
+ this.gtfsStopParser = new GtfsStopParser_1.GtfsStopParser();
24
28
  }
25
- /**
26
- * Retrieves ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
27
- */
28
29
  async getStopIdsForTransferBoards(cisId) {
29
30
  //#region CIS stop node
30
31
  let aswNode;
@@ -56,10 +57,45 @@ let StopFacade = exports.StopFacade = class StopFacade {
56
57
  //#endregion
57
58
  return stopIds;
58
59
  }
60
+ /**
61
+ * Retrieve ASW node ID for given CIS ID and then returns GTFS stop IDs for this ASW node
62
+ */
63
+ async getStopIdsForTransferBoardsByCisId(cisId) {
64
+ try {
65
+ const aswNodeId = await this.gtfsStopsRedisRepository.getAswNodeIdFromCisId(cisId);
66
+ if (aswNodeId === null) {
67
+ return [];
68
+ }
69
+ return await this.getStopIdsForTransferBoardsByAswNode(aswNodeId);
70
+ }
71
+ catch (error) {
72
+ if (error instanceof golemio_errors_1.AbstractGolemioError)
73
+ throw error;
74
+ throw new golemio_errors_1.GeneralError("Failed to retrieve CIS stop node", this.constructor.name, error, 500);
75
+ }
76
+ }
77
+ /**
78
+ * Retrieve ASW node ID for given ASW stop ID and then returns GTFS stop IDs for this ASW node
79
+ */
80
+ async getStopIdsForTransferBoardsByAswId(aswId) {
81
+ return await this.getStopIdsForTransferBoardsByAswNode(this.gtfsStopParser.getAswNodeFromId(aswId));
82
+ }
83
+ async getStopIdsForTransferBoardsByAswNode(aswNodeId) {
84
+ try {
85
+ return await this.gtfsStopsRedisRepository.getGtfsStopIdsByAswNode(aswNodeId);
86
+ }
87
+ catch (error) {
88
+ if (error instanceof golemio_errors_1.AbstractGolemioError)
89
+ throw error;
90
+ throw new golemio_errors_1.GeneralError("Failed to retrieve GTFS stops", this.constructor.name, error, 500);
91
+ }
92
+ }
59
93
  };
60
94
  exports.StopFacade = StopFacade = __decorate([
61
95
  (0, tsyringe_1.injectable)(),
62
96
  __param(0, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.CisStopGroupRepository)),
63
- __metadata("design:paramtypes", [CisStopGroupRepository_1.CisStopGroupRepository])
97
+ __param(1, (0, tsyringe_1.inject)(OgPidToken_1.OgPidToken.GtfsStopsRedisRepository)),
98
+ __metadata("design:paramtypes", [CisStopGroupRepository_1.CisStopGroupRepository,
99
+ GtfsStopsRedisRepository_1.GtfsStopsRedisRepository])
64
100
  ], StopFacade);
65
101
  //# sourceMappingURL=StopFacade.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StopFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/StopFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAoD;AACpD,mGAA2F;AAC3F,uDAA+C;AAC/C,6EAA8F;AAC9F,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wBAAwB,CAAC,CAAA;qCADgC,+CAAsB;QACnB,mDAAwB;GALlG,UAAU,CA0EtB"}
@@ -1,18 +1,20 @@
1
- import { ITransferOutputDto } from "../..";
2
- import { DeparturesRepository } from "../../data-access";
1
+ import { ITransferOutputDto, IV4TransferDto } from "../..";
3
2
  import { Moment } from "@golemio/core/dist/shared/moment-timezone";
4
3
  import { TransferDepartureTransformation } from "../transformations/TransferDepartureTransformation";
4
+ import { PublicGtfsDepartureRepository } from "../../../public/data-access/redis/PublicGtfsDepartureRepository";
5
+ import { PublicVehiclePositionsRepository } from "../../../public/data-access/redis/PublicVehiclePositionsRepository";
6
+ import { PublicStopTimeRepository } from "../../../public/data-access/redis/PublicStopTimeRepository";
7
+ import { DeparturesRepository } from "../../data-access";
5
8
  export declare class TransferFacade {
9
+ private publicDepartureRepository;
6
10
  private departureRepository;
7
11
  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
- */
12
+ private tripRepository;
13
+ private stopTimeRepository;
14
+ constructor(publicDepartureRepository: PublicGtfsDepartureRepository, departureRepository: DeparturesRepository, departureTransformation: TransferDepartureTransformation, tripRepository: PublicVehiclePositionsRepository, stopTimeRepository: PublicStopTimeRepository);
15
15
  getTransferDepartures(stopIds: string[], tripNumber: string | null, currentMoment: Moment, minutesOffset: number, timeZone?: string): Promise<ITransferOutputDto[]>;
16
+ getTransferCache(stopIds: string[], reqNumber?: number, vehicleType?: number): Promise<IV4TransferDto>;
17
+ private processMultiplePostionsForDeparture;
16
18
  /**
17
19
  * Fallback options as defined by ROPID
18
20
  */
@@ -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,QAA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AAM,EAAE,qBAAe,CAAC,6BAA6B;YACrD,IAAI,EAAE,CAAC,mBAAa,CAAC,QAAQ,CAAC;YAC9B,oBAAoB,EAAE,EAAE;YACxB,cAAc,EAAE,IAAI;YACpB,cAAc,EAAE,IAAI,EAAE,2BAA2B;SACpD,CAAC;IACN,CAAC;CACJ,CAAA;yBA3EY,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,CA2E1B"}
1
+ {"version":3,"file":"TransferFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/service/facade/TransferFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BASiB;AACjB,qDAAoD;AACpD,0HAAoG;AACpG,6EAA8F;AAE9F,iEAAwE;AACxE,wGAAqG;AACrG,mHAA2G;AAE3G,yHAAiH;AAGjH,yGAAiG;AACjG,8DAAgE;AAChE,+FAA0E;AAC1E,4CAA8C;AAC9C,mDAA2D;AAC3D,6CAA8C;AAGvC,IAAM,cAAc,4BAApB,MAAM,cAAc;IACvB,YAC8D,yBAAwD,EACjE,mBAAyC,EAC9B,uBAAwD,EACvD,cAAgD,EACxD,kBAA4C;QAJvC,8BAAyB,GAAzB,yBAAyB,CAA+B;QACjE,wBAAmB,GAAnB,mBAAmB,CAAsB;QAC9B,4BAAuB,GAAvB,uBAAuB,CAAiC;QACvD,mBAAc,GAAd,cAAc,CAAkC;QACxD,uBAAkB,GAAlB,kBAAkB,CAA0B;IAClG,CAAC;IAEG,KAAK,CAAC,qBAAqB,CAC9B,OAAiB,EACjB,UAAyB,EACzB,aAAqB,EACrB,aAAqB,EACrB,QAAQ,GAAG,yBAAgB,CAAC,QAAQ;QAEpC,IAAI,iBAAiB,GAAyB,EAAE,CAAC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;YACxB,cAAc,EAAE,IAAI;YACpB,cAAc,EAAE,IAAI,EAAE,2BAA2B;SACpD,CAAC;IACN,CAAC;CACJ,CAAA;yBAzLY,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,6BAA6B,CAAC,CAAA;IAChD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,oBAAoB,CAAC,CAAA;IACvC,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,+BAA+B,CAAC,CAAA;IAClD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,gCAAgC,CAAC,CAAA;IACnD,WAAA,IAAA,iBAAM,EAAC,uBAAU,CAAC,wBAAwB,CAAC,CAAA;qCAJyC,6DAA6B;QAC5C,kCAAoB;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
+ }