@golemio/pid 3.4.0 → 3.4.1-dev.1622739356

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 (381) hide show
  1. package/dist/input-gateway/jis/JisInfotextsController.js +4 -13
  2. package/dist/input-gateway/jis/JisInfotextsController.js.map +1 -1
  3. package/dist/input-gateway/jis/JisInfotextsRouter.js +3 -12
  4. package/dist/input-gateway/jis/JisInfotextsRouter.js.map +1 -1
  5. package/dist/input-gateway/ropid-gtfs/RopidGtfsController.js +4 -13
  6. package/dist/input-gateway/ropid-gtfs/RopidGtfsController.js.map +1 -1
  7. package/dist/input-gateway/ropid-gtfs/RopidGtfsRouter.js +3 -12
  8. package/dist/input-gateway/ropid-gtfs/RopidGtfsRouter.js.map +1 -1
  9. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +4 -13
  10. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
  11. package/dist/input-gateway/vehicle-positions/VehiclePositionsRouter.js +3 -12
  12. package/dist/input-gateway/vehicle-positions/VehiclePositionsRouter.js.map +1 -1
  13. package/dist/integration-engine/data-retention/workers/tasks/DeleteDataTask.js +4 -15
  14. package/dist/integration-engine/data-retention/workers/tasks/DeleteDataTask.js.map +1 -1
  15. package/dist/integration-engine/data-retention/workers/tasks/TableStorageRetentionTask.js +8 -19
  16. package/dist/integration-engine/data-retention/workers/tasks/TableStorageRetentionTask.js.map +1 -1
  17. package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js +1 -1
  18. package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js.map +1 -1
  19. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +56 -72
  20. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
  21. package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js +32 -48
  22. package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map +1 -1
  23. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js +24 -37
  24. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js.map +1 -1
  25. package/dist/integration-engine/jis/services/JISInfotextsDataService.js +24 -35
  26. package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -1
  27. package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js +2 -3
  28. package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js.map +1 -1
  29. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +12 -23
  30. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -1
  31. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +4 -15
  32. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  33. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopTimesModel.js +3 -12
  34. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopTimesModel.js.map +1 -1
  35. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +2 -11
  36. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
  37. package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js +3 -12
  38. package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js.map +1 -1
  39. package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js +21 -30
  40. package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js.map +1 -1
  41. package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js +20 -29
  42. package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js.map +1 -1
  43. package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js +33 -52
  44. package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js.map +1 -1
  45. package/dist/integration-engine/ropid-gtfs/data-access/RouteSubAgencyRepository.js +12 -23
  46. package/dist/integration-engine/ropid-gtfs/data-access/RouteSubAgencyRepository.js.map +1 -1
  47. package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js +12 -23
  48. package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
  49. package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js +33 -44
  50. package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js.map +1 -1
  51. package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js +10 -21
  52. package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js.map +1 -1
  53. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +15 -24
  54. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -1
  55. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js +3 -12
  56. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +1 -1
  57. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +3 -12
  58. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +1 -1
  59. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +4 -13
  60. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
  61. package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js +30 -41
  62. package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js.map +1 -1
  63. package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js +11 -22
  64. package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js.map +1 -1
  65. package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js +1 -2
  66. package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js.map +1 -1
  67. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSCisStopsTransformation.js +7 -16
  68. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSCisStopsTransformation.js.map +1 -1
  69. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSOisTransformation.js +3 -12
  70. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSOisTransformation.js.map +1 -1
  71. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js +13 -17
  72. package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js.map +1 -1
  73. package/dist/integration-engine/ropid-gtfs/workers/presets/data-access/PresetLogRepository.js +13 -22
  74. package/dist/integration-engine/ropid-gtfs/workers/presets/data-access/PresetLogRepository.js.map +1 -1
  75. package/dist/integration-engine/ropid-gtfs/workers/presets/datasources/grafana-loki/GrafanaLokiDataSourceProvider.js +1 -2
  76. package/dist/integration-engine/ropid-gtfs/workers/presets/datasources/grafana-loki/GrafanaLokiDataSourceProvider.js.map +1 -1
  77. package/dist/integration-engine/ropid-gtfs/workers/presets/helpers/RopidMonitoringService.js +12 -23
  78. package/dist/integration-engine/ropid-gtfs/workers/presets/helpers/RopidMonitoringService.js.map +1 -1
  79. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CheckForNewDeparturesPresetsTask.js +14 -25
  80. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CheckForNewDeparturesPresetsTask.js.map +1 -1
  81. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CollectAndSaveLogsTask.js +26 -37
  82. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CollectAndSaveLogsTask.js.map +1 -1
  83. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/DownloadDeparturesPresetsTask.js +12 -23
  84. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/DownloadDeparturesPresetsTask.js.map +1 -1
  85. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/ProcessAndSendLogsTask.js +36 -49
  86. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/ProcessAndSendLogsTask.js.map +1 -1
  87. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js +3 -14
  88. package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js.map +1 -1
  89. package/dist/integration-engine/ropid-gtfs/workers/presets/transformations/PresetLogTransformation.js +1 -2
  90. package/dist/integration-engine/ropid-gtfs/workers/presets/transformations/PresetLogTransformation.js.map +1 -1
  91. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js +29 -40
  92. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js.map +1 -1
  93. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +64 -81
  94. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
  95. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js +60 -79
  96. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js.map +1 -1
  97. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js +23 -34
  98. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js.map +1 -1
  99. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js +26 -38
  100. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js.map +1 -1
  101. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js +21 -32
  102. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js.map +1 -1
  103. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js +43 -55
  104. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map +1 -1
  105. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/DeparturesDirectionRepository.js +8 -18
  106. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/DeparturesDirectionRepository.js.map +1 -1
  107. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/MetroRailtrackGPSRepository.js +11 -21
  108. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/MetroRailtrackGPSRepository.js.map +1 -1
  109. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js +8 -17
  110. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js.map +1 -1
  111. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js +19 -30
  112. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js.map +1 -1
  113. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/transformations/DeparturesDirectionTransformation.js +8 -1
  114. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/transformations/DeparturesDirectionTransformation.js.map +1 -1
  115. package/dist/integration-engine/ropid-vymi/RopidVYMIEventsTransformation.js +31 -47
  116. package/dist/integration-engine/ropid-vymi/RopidVYMIEventsTransformation.js.map +1 -1
  117. package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsRoutesModel.js +6 -17
  118. package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsRoutesModel.js.map +1 -1
  119. package/dist/integration-engine/ropid-vymi/models/RopidVYMIMetadataModel.js +4 -14
  120. package/dist/integration-engine/ropid-vymi/models/RopidVYMIMetadataModel.js.map +1 -1
  121. package/dist/integration-engine/ropid-vymi/workers/tasks/CheckForNewEventsTask.js +6 -17
  122. package/dist/integration-engine/ropid-vymi/workers/tasks/CheckForNewEventsTask.js.map +1 -1
  123. package/dist/integration-engine/ropid-vymi/workers/tasks/FetchAndProcessEventsTask.js +34 -31
  124. package/dist/integration-engine/ropid-vymi/workers/tasks/FetchAndProcessEventsTask.js.map +1 -1
  125. package/dist/integration-engine/ropid-vymi/workers/tasks/helpers/RopidVYMIApiHelper.js +3 -12
  126. package/dist/integration-engine/ropid-vymi/workers/tasks/helpers/RopidVYMIApiHelper.js.map +1 -1
  127. package/dist/integration-engine/shared/RopidMetadataModel.js +35 -45
  128. package/dist/integration-engine/shared/RopidMetadataModel.js.map +1 -1
  129. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/AlertsGenerator.js +13 -24
  130. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/AlertsGenerator.js.map +1 -1
  131. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.js +9 -6
  132. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.js.map +1 -1
  133. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js +113 -128
  134. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js.map +1 -1
  135. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/AlertsTransformation.js +20 -34
  136. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/AlertsTransformation.js.map +1 -1
  137. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/AbstractRunRepository.js +3 -12
  138. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/AbstractRunRepository.js.map +1 -1
  139. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsMessagesRepository.js +3 -12
  140. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsMessagesRepository.js.map +1 -1
  141. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +12 -21
  142. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
  143. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js +7 -16
  144. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js.map +1 -1
  145. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/CisLookupManager.js +22 -33
  146. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/CisLookupManager.js.map +1 -1
  147. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/GtfsLookupManager.js +31 -44
  148. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/GtfsLookupManager.js.map +1 -1
  149. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusRunsFacade.js +14 -25
  150. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusRunsFacade.js.map +1 -1
  151. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/TripScheduleManager.js +25 -37
  152. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/TripScheduleManager.js.map +1 -1
  153. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js +53 -63
  154. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js.map +1 -1
  155. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessRegionalBusRunMessagesTask.js +57 -72
  156. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessRegionalBusRunMessagesTask.js.map +1 -1
  157. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveArrivaCityRunsToDBTask.js +15 -26
  158. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveArrivaCityRunsToDBTask.js.map +1 -1
  159. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js +10 -21
  160. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js.map +1 -1
  161. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js +19 -30
  162. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map +1 -1
  163. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js +10 -21
  164. package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js.map +1 -1
  165. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js +5 -14
  166. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js.map +1 -1
  167. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js +4 -14
  168. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js.map +1 -1
  169. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/RegionalBusRunsMessagesTransformation.js +1 -2
  170. package/dist/integration-engine/vehicle-positions/workers/runs/transformations/RegionalBusRunsMessagesTransformation.js.map +1 -1
  171. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/data-access/DescriptorRepository.js +35 -49
  172. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/data-access/DescriptorRepository.js.map +1 -1
  173. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/tasks/RefreshDescriptorsTask.js +11 -22
  174. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/tasks/RefreshDescriptorsTask.js.map +1 -1
  175. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/transformations/DescriptorTransformation.js +2 -3
  176. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/transformations/DescriptorTransformation.js.map +1 -1
  177. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/CisStopRepository.js +3 -12
  178. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/CisStopRepository.js.map +1 -1
  179. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsHistoryRepository.js +3 -12
  180. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsHistoryRepository.js.map +1 -1
  181. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js +19 -29
  182. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js.map +1 -1
  183. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimesHistoryRepository.js +3 -12
  184. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimesHistoryRepository.js.map +1 -1
  185. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsHistoryRepository.js +3 -12
  186. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsHistoryRepository.js.map +1 -1
  187. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +58 -55
  188. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
  189. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js +64 -79
  190. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js.map +1 -1
  191. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js +46 -59
  192. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js.map +1 -1
  193. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js +39 -6
  194. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js.map +1 -1
  195. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/metro/CachedMetroRailtrackLookup.js +8 -19
  196. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/metro/CachedMetroRailtrackLookup.js.map +1 -1
  197. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js +2 -13
  198. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js.map +1 -1
  199. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js +1 -2
  200. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js.map +1 -1
  201. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +10 -16
  202. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
  203. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +68 -40
  204. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
  205. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js +5 -14
  206. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js.map +1 -1
  207. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js +1 -2
  208. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js.map +1 -1
  209. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js +1 -2
  210. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js.map +1 -1
  211. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/ComputeDelayHelper.js +4 -4
  212. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/ComputeDelayHelper.js.map +1 -1
  213. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js +1 -2
  214. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js.map +1 -1
  215. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js +4 -5
  216. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js.map +1 -1
  217. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js +3 -4
  218. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js.map +1 -1
  219. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-data/strategy/HttpGtfsTripDataFixer.js +7 -18
  220. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-data/strategy/HttpGtfsTripDataFixer.js.map +1 -1
  221. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.js +7 -16
  222. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.js.map +1 -1
  223. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripCommonRunManager.js +40 -57
  224. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripCommonRunManager.js.map +1 -1
  225. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js +36 -53
  226. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js.map +1 -1
  227. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/metro/MetroShapePointsFixer.js +32 -41
  228. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/metro/MetroShapePointsFixer.js.map +1 -1
  229. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +61 -33
  230. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
  231. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/RegionalBusComputeDelayHelper.js +4 -4
  232. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/RegionalBusComputeDelayHelper.js.map +1 -1
  233. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js +4 -6
  234. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
  235. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/gtfs-trip-run/GtfsTripRegionalBusRunManager.js +38 -55
  236. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/gtfs-trip-run/GtfsTripRegionalBusRunManager.js.map +1 -1
  237. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/DataRetentionTask.js +32 -45
  238. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/DataRetentionTask.js.map +1 -1
  239. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js +81 -91
  240. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js.map +1 -1
  241. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js +43 -55
  242. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js.map +1 -1
  243. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js +37 -49
  244. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
  245. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshGtfsTripDataTask.js +7 -18
  246. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshGtfsTripDataTask.js.map +1 -1
  247. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +41 -52
  248. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
  249. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.js +32 -43
  250. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.js.map +1 -1
  251. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.js +95 -115
  252. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.js.map +1 -1
  253. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +150 -162
  254. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
  255. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js +82 -94
  256. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js.map +1 -1
  257. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js +24 -35
  258. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js.map +1 -1
  259. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js +15 -18
  260. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js.map +1 -1
  261. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.js +1 -1
  262. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.js.map +1 -1
  263. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js +11 -21
  264. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js.map +1 -1
  265. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +2 -3
  266. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
  267. package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js +5 -15
  268. package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js.map +1 -1
  269. package/dist/output-gateway/pid/controllers/v2/V2InfotextsController.js +4 -13
  270. package/dist/output-gateway/pid/controllers/v2/V2InfotextsController.js.map +1 -1
  271. package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js +4 -13
  272. package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js.map +1 -1
  273. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js +8 -17
  274. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
  275. package/dist/output-gateway/pid/data-access/DeparturesRepository.js +40 -53
  276. package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
  277. package/dist/output-gateway/pid/data-access/JISInfotextRepository.js +62 -75
  278. package/dist/output-gateway/pid/data-access/JISInfotextRepository.js.map +1 -1
  279. package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +2 -3
  280. package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
  281. package/dist/output-gateway/pid/helpers/ParamValidatorManager.js +6 -15
  282. package/dist/output-gateway/pid/helpers/ParamValidatorManager.js.map +1 -1
  283. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +11 -21
  284. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
  285. package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js +20 -27
  286. package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js.map +1 -1
  287. package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js +16 -25
  288. package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js.map +1 -1
  289. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +2 -4
  290. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
  291. package/dist/output-gateway/pid/service/facade/InfotextFacade.js +12 -23
  292. package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
  293. package/dist/output-gateway/pid/service/facade/StopFacade.js +27 -38
  294. package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
  295. package/dist/output-gateway/pid/service/facade/TransferFacade.js +32 -39
  296. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
  297. package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js +3 -4
  298. package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js.map +1 -1
  299. package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js +8 -12
  300. package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js.map +1 -1
  301. package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js +1 -2
  302. package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js.map +1 -1
  303. package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js +1 -2
  304. package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js.map +1 -1
  305. package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js +4 -13
  306. package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js.map +1 -1
  307. package/dist/output-gateway/public/controllers/v2/V2PublicGtfsController.js +4 -13
  308. package/dist/output-gateway/public/controllers/v2/V2PublicGtfsController.js.map +1 -1
  309. package/dist/output-gateway/public/controllers/v2/V2PublicVehiclePositionsController.js +9 -18
  310. package/dist/output-gateway/public/controllers/v2/V2PublicVehiclePositionsController.js.map +1 -1
  311. package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js +13 -26
  312. package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js.map +1 -1
  313. package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js +22 -33
  314. package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js.map +1 -1
  315. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +9 -20
  316. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
  317. package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js +23 -34
  318. package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js.map +1 -1
  319. package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +153 -172
  320. package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
  321. package/dist/output-gateway/public/routers/v2/helpers/CustomStopIdGroupValidator.js +2 -2
  322. package/dist/output-gateway/public/routers/v2/helpers/CustomStopIdGroupValidator.js.map +1 -1
  323. package/dist/output-gateway/public/service/VPSubscriber.js +8 -19
  324. package/dist/output-gateway/public/service/VPSubscriber.js.map +1 -1
  325. package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js +100 -117
  326. package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js.map +1 -1
  327. package/dist/output-gateway/public/service/facade/DetailedTripFacade.js +18 -29
  328. package/dist/output-gateway/public/service/facade/DetailedTripFacade.js.map +1 -1
  329. package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.js +20 -31
  330. package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.js.map +1 -1
  331. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js +15 -26
  332. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js.map +1 -1
  333. package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/strategy/StopTimesTripScopeHandler.js +1 -2
  334. package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/strategy/StopTimesTripScopeHandler.js.map +1 -1
  335. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHandler.js +3 -14
  336. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHandler.js.map +1 -1
  337. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHandler.js +7 -18
  338. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHandler.js.map +1 -1
  339. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js +35 -46
  340. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js.map +1 -1
  341. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHandler.js +16 -22
  342. package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHandler.js.map +1 -1
  343. package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js +9 -10
  344. package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js.map +1 -1
  345. package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js +5 -15
  346. package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js.map +1 -1
  347. package/dist/output-gateway/public/service/transformations/gtfs-trip-scopes/PublicGtfsTripInfoTransformation.js +2 -3
  348. package/dist/output-gateway/public/service/transformations/gtfs-trip-scopes/PublicGtfsTripInfoTransformation.js.map +1 -1
  349. package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js +2 -15
  350. package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js.map +1 -1
  351. package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js +1 -13
  352. package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js.map +1 -1
  353. package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js +14 -25
  354. package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js.map +1 -1
  355. package/dist/output-gateway/ropid-gtfs/models/GTFSCalendarModel.js +3 -12
  356. package/dist/output-gateway/ropid-gtfs/models/GTFSCalendarModel.js.map +1 -1
  357. package/dist/output-gateway/ropid-gtfs/models/GTFSRoutesModel.js +4 -13
  358. package/dist/output-gateway/ropid-gtfs/models/GTFSRoutesModel.js.map +1 -1
  359. package/dist/output-gateway/ropid-gtfs/models/GTFSShapesModel.js +5 -14
  360. package/dist/output-gateway/ropid-gtfs/models/GTFSShapesModel.js.map +1 -1
  361. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js +90 -102
  362. package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js.map +1 -1
  363. package/dist/output-gateway/ropid-gtfs/models/GTFSStopTimesModel.js +3 -12
  364. package/dist/output-gateway/ropid-gtfs/models/GTFSStopTimesModel.js.map +1 -1
  365. package/dist/output-gateway/ropid-gtfs/models/GTFSTripsModel.js +43 -51
  366. package/dist/output-gateway/ropid-gtfs/models/GTFSTripsModel.js.map +1 -1
  367. package/dist/output-gateway/ropid-gtfs/routers/v2/V2GTFSRouter.js +28 -37
  368. package/dist/output-gateway/ropid-gtfs/routers/v2/V2GTFSRouter.js.map +1 -1
  369. package/dist/output-gateway/shared/DepartureCalculator.js +1 -1
  370. package/dist/output-gateway/shared/DepartureCalculator.js.map +1 -1
  371. package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js +40 -48
  372. package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js.map +1 -1
  373. package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js +7 -16
  374. package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js.map +1 -1
  375. package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js +10 -19
  376. package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js.map +1 -1
  377. package/dist/schema-definitions/ropid-gtfs/RopidGTFSRunNumbers.js +5 -2
  378. package/dist/schema-definitions/ropid-gtfs/RopidGTFSRunNumbers.js.map +1 -1
  379. package/dist/schema-definitions/ropid-gtfs/index.js +16 -4
  380. package/dist/schema-definitions/ropid-gtfs/index.js.map +1 -1
  381. package/package.json +3 -3
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.RefreshPublicStopTimeCacheTask = void 0;
25
16
  const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
@@ -49,54 +40,52 @@ let RefreshPublicStopTimeCacheTask = exports.RefreshPublicStopTimeCacheTask = cl
49
40
  this.lockTimeout = config.getValue("old.datasources.pid.vehicle-positions.publicCache.mutexLockStopTimeTimeout", 6000); // default 6s
50
41
  this.refreshInterval = this.lockTimeout * 0.8;
51
42
  }
52
- execute() {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const startDateTime = new Date();
55
- const mutex = this.createMutex();
56
- const lockAcquired = yield mutex.tryAcquire();
57
- if (!lockAcquired) {
58
- this.logger.info(`${this.constructor.name}: mutex lock was not acquired`);
43
+ async execute() {
44
+ const startDateTime = new Date();
45
+ const mutex = this.createMutex();
46
+ const lockAcquired = await mutex.tryAcquire();
47
+ if (!lockAcquired) {
48
+ this.logger.info(`${this.constructor.name}: mutex lock was not acquired`);
49
+ return;
50
+ }
51
+ try {
52
+ const stopTimes = await this.publicStopTimeRepository.findAll();
53
+ if (stopTimes.length === 0) {
59
54
  return;
60
55
  }
61
- try {
62
- const stopTimes = yield this.publicStopTimeRepository.findAll();
63
- if (stopTimes.length === 0) {
64
- return;
65
- }
66
- const data = new Map();
67
- for (const stopTime of stopTimes) {
68
- const vehicleId = VehicleIdGenerator_1.VehicleIdGenerator.getVehicleId(stopTime.rt_trip_id, stopTime.gtfs_route_type, stopTime.provider_source_type, stopTime.gtfs_route_short_name, stopTime.cis_trip_number, stopTime.vehicle_registration_number, stopTime.run_number, stopTime.internal_run_number);
69
- const key = `${vehicleId}-${stopTime.gtfs_trip_id}`;
70
- if (!data.has(key)) {
71
- data.set(key, []);
72
- }
73
- data.get(key).push({
74
- sequence: stopTime.stop_sequence,
75
- arr_delay: stopTime.stop_arr_delay,
76
- dep_delay: stopTime.stop_dep_delay,
77
- cis_stop_platform_code: stopTime.cis_stop_platform_code,
78
- platform_code: stopTime.platform_code,
79
- stop_id: stopTime.stop_id,
80
- });
81
- }
82
- yield this.publicStopTimeCacheRepository.createOrUpdate(data, VPUtils_1.VPUtils.DELAY_COMPUTATION_CACHE_TTL);
83
- }
84
- catch (err) {
85
- if (err instanceof golemio_errors_1.AbstractGolemioError) {
86
- throw err;
56
+ const data = new Map();
57
+ for (const stopTime of stopTimes) {
58
+ const vehicleId = VehicleIdGenerator_1.VehicleIdGenerator.getVehicleId(stopTime.rt_trip_id, stopTime.gtfs_route_type, stopTime.provider_source_type, stopTime.gtfs_route_short_name, stopTime.cis_trip_number, stopTime.vehicle_registration_number, stopTime.run_number, stopTime.internal_run_number);
59
+ const key = `${vehicleId}-${stopTime.gtfs_trip_id}`;
60
+ if (!data.has(key)) {
61
+ data.set(key, []);
87
62
  }
88
- throw new golemio_errors_1.GeneralError(`${this.constructor.name}: error while refreshing public stop time cache`, this.constructor.name, err);
89
- }
90
- finally {
91
- yield mutex.release();
63
+ data.get(key).push({
64
+ sequence: stopTime.stop_sequence,
65
+ arr_delay: stopTime.stop_arr_delay,
66
+ dep_delay: stopTime.stop_dep_delay,
67
+ cis_stop_platform_code: stopTime.cis_stop_platform_code,
68
+ platform_code: stopTime.platform_code,
69
+ stop_id: stopTime.stop_id,
70
+ });
92
71
  }
93
- const ellapsedTimeInMs = new Date().getTime() - startDateTime.getTime();
94
- this.logger.info(`${this.constructor.name}: finished in ${ellapsedTimeInMs}ms`);
95
- if (ellapsedTimeInMs < this.refreshInterval) {
96
- yield (0, promises_1.setTimeout)(this.refreshInterval - ellapsedTimeInMs);
72
+ await this.publicStopTimeCacheRepository.createOrUpdate(data, VPUtils_1.VPUtils.DELAY_COMPUTATION_CACHE_TTL);
73
+ }
74
+ catch (err) {
75
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
76
+ throw err;
97
77
  }
98
- integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, this.queueName, {});
99
- });
78
+ throw new golemio_errors_1.GeneralError(`${this.constructor.name}: error while refreshing public stop time cache`, this.constructor.name, err);
79
+ }
80
+ finally {
81
+ await mutex.release();
82
+ }
83
+ const ellapsedTimeInMs = new Date().getTime() - startDateTime.getTime();
84
+ this.logger.info(`${this.constructor.name}: finished in ${ellapsedTimeInMs}ms`);
85
+ if (ellapsedTimeInMs < this.refreshInterval) {
86
+ await (0, promises_1.setTimeout)(this.refreshInterval - ellapsedTimeInMs);
87
+ }
88
+ integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, this.queueName, {});
100
89
  }
101
90
  createMutex() {
102
91
  return new redis_semaphore_1.Mutex(this.redisClient.getConnection(), this.queueName, {
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshPublicStopTimeCacheTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAA8E;AAC9E,iFAAsG;AAGtG,oGAAiG;AACjG,wEAAqE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IAAA,iBAAM,EAAC,mCAAgB,CAAC,6BAA6B,CAAC,CAAA;qDAHK,mCAAgB;QAE1C,mDAAwB;QAEnB,6DAA6B;GAb/D,8BAA8B,CAqG1C"}
1
+ {"version":3,"file":"RefreshPublicStopTimeCacheTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAA8E;AAC9E,iFAAsG;AAGtG,oGAAiG;AACjG,wEAAqE;AAErE,8EAAqE;AACrE,mEAA2E;AAC3E,2EAAkF;AAClF,6EAA8F;AAC9F,+EAAkE;AAClE,iEAAwE;AACxE,mDAA2D;AAC3D,4CAA2C;AAC3C,sGAAmG;AACnG,4FAAyF;AACzF,gDAA6C;AAGtC,IAAM,8BAA8B,4CAApC,MAAM,8BAA+B,SAAQ,2BAAiB;IAMjE,YACoC,MAAqB,EAC3B,MAAuB,EACV,WAAqC,EAE5E,wBAA0D,EAE1D,6BAAoE;QAEpE,KAAK,CAAC,uBAAW,CAAC,CAAC;QAPe,WAAM,GAAN,MAAM,CAAS;QACF,gBAAW,GAAX,WAAW,CAAkB;QAEpE,6BAAwB,GAAxB,wBAAwB,CAA0B;QAElD,kCAA6B,GAA7B,6BAA6B,CAA+B;QAZxD,cAAS,GAAG,4BAA4B,CAAC;QACzC,aAAQ,GAAG,KAAK,CAAC,CAAC,MAAM;QAcpC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,QAAQ,CAC9B,4EAA4E,EAC5E,IAAI,CACG,CAAC,CAAC,aAAa;QAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IAClD,CAAC;IAES,KAAK,CAAC,OAAO;QACnB,MAAM,aAAa,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,YAAY,GAAG,MA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,CAAC;CACJ,CAAA;yCArGY,8BAA8B;IAD1C,IAAA,qBAAU,GAAE;IAQJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,wBAAwB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,6BAA6B,CAAC,CAAA;qDAHK,mCAAgB;QAE1C,mDAAwB;QAEnB,6DAA6B;GAb/D,8BAA8B,CAqG1C"}
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.RefreshPublicTripCacheTask = void 0;
25
16
  const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
@@ -53,43 +44,41 @@ let RefreshPublicTripCacheTask = exports.RefreshPublicTripCacheTask = class Refr
53
44
  this.tripRepository = new TripsRepository_1.TripsRepository();
54
45
  this.redisChannel = new pubsub_1.RedisPubSubChannel(const_1.PUBLIC_CACHE_NAMESPACE_PREFIX);
55
46
  }
56
- execute() {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const startDateTime = new Date();
59
- const mutex = this.createMutex();
60
- const lockAcquired = yield mutex.tryAcquire();
61
- if (!lockAcquired) {
62
- this.logger.info(`${this.constructor.name}: mutex lock was not acquired`);
47
+ async execute() {
48
+ const startDateTime = new Date();
49
+ const mutex = this.createMutex();
50
+ const lockAcquired = await mutex.tryAcquire();
51
+ if (!lockAcquired) {
52
+ this.logger.info(`${this.constructor.name}: mutex lock was not acquired`);
53
+ return;
54
+ }
55
+ try {
56
+ const trips = await this.tripRepository.findAllForPublicCache(startDateTime);
57
+ if (trips.length === 0) {
63
58
  return;
64
59
  }
65
- try {
66
- const trips = yield this.tripRepository.findAllForPublicCache(startDateTime);
67
- if (trips.length === 0) {
68
- return;
69
- }
70
- const { filteredTrips, futureTrips, canceledTrips } = PublicCacheTripsFilter_1.PublicCacheTripsFilter.getDistinctLatestTrips(trips);
71
- const transformedTrips = this.publicApiTripTransformation.transformArray(filteredTrips);
72
- const transformedFutureTrips = this.publicApiTripTransformation.transformArray(futureTrips);
73
- const transformedCanceledTrips = this.publicApiTripTransformation.transformArray(canceledTrips);
74
- const newSetKey = yield this.publicApiCacheRepository.geoadd(transformedTrips, transformedFutureTrips, transformedCanceledTrips);
75
- yield this.redisChannel.publishMessage(newSetKey);
76
- }
77
- catch (err) {
78
- if (err instanceof golemio_errors_1.AbstractGolemioError) {
79
- throw err;
80
- }
81
- throw new golemio_errors_1.GeneralError(`${this.constructor.name}: error while refreshing public trip cache`, this.constructor.name, err);
82
- }
83
- finally {
84
- yield mutex.release();
60
+ const { filteredTrips, futureTrips, canceledTrips } = PublicCacheTripsFilter_1.PublicCacheTripsFilter.getDistinctLatestTrips(trips);
61
+ const transformedTrips = this.publicApiTripTransformation.transformArray(filteredTrips);
62
+ const transformedFutureTrips = this.publicApiTripTransformation.transformArray(futureTrips);
63
+ const transformedCanceledTrips = this.publicApiTripTransformation.transformArray(canceledTrips);
64
+ const newSetKey = await this.publicApiCacheRepository.geoadd(transformedTrips, transformedFutureTrips, transformedCanceledTrips);
65
+ await this.redisChannel.publishMessage(newSetKey);
66
+ }
67
+ catch (err) {
68
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
69
+ throw err;
85
70
  }
86
- const ellapsedTimeInMs = new Date().getTime() - startDateTime.getTime();
87
- this.logger.info(`${this.constructor.name}: finished in ${ellapsedTimeInMs}ms`);
88
- if (ellapsedTimeInMs < this.refreshInterval) {
89
- yield (0, promises_1.setTimeout)(this.refreshInterval - ellapsedTimeInMs);
90
- }
91
- integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, this.queueName, {});
92
- });
71
+ throw new golemio_errors_1.GeneralError(`${this.constructor.name}: error while refreshing public trip cache`, this.constructor.name, err);
72
+ }
73
+ finally {
74
+ await mutex.release();
75
+ }
76
+ const ellapsedTimeInMs = new Date().getTime() - startDateTime.getTime();
77
+ this.logger.info(`${this.constructor.name}: finished in ${ellapsedTimeInMs}ms`);
78
+ if (ellapsedTimeInMs < this.refreshInterval) {
79
+ await (0, promises_1.setTimeout)(this.refreshInterval - ellapsedTimeInMs);
80
+ }
81
+ integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, this.queueName, {});
93
82
  }
94
83
  createMutex() {
95
84
  return new redis_semaphore_1.Mutex(this.redisClient.getConnection(), this.queueName, {
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshPublicTripCacheTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAA8E;AAC9E,2FAAmF;AAEnF,oGAAiG;AACjG,wEAAqE;AAErE,8EAAqE;AACrE,qFAA8F;AAC9F,mEAA2E;AAC3E,2EAAkF;AAClF,6EAA8F;AAC9F,+EAAkE;AAClE,iEAAwE;AACxE,mDAA2D;AAC3D,4CAA2C;AAC3C,oEAAiE;AACjE,4FAAyF;AACzF,gGA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AAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC7E,CAAC;KAAA;IAEO,WAAW;QACf,OAAO,IAAI,uBAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE;YAC/D,oBAAoB,EAAE,CAAC;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,CAAC;YAC5E,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;qCAzFY,0BAA0B;IADtC,IAAA,qBAAU,GAAE;IAUJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,wBAAwB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,2BAA2B,CAAC,CAAA;qDAHO,mCAAgB;QAE1C,mDAAwB;QAErB,yDAA2B;GAf3D,0BAA0B,CAyFtC"}
1
+ {"version":3,"file":"RefreshPublicTripCacheTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAA8E;AAC9E,2FAAmF;AAEnF,oGAAiG;AACjG,wEAAqE;AAErE,8EAAqE;AACrE,qFAA8F;AAC9F,mEAA2E;AAC3E,2EAAkF;AAClF,6EAA8F;AAC9F,+EAAkE;AAClE,iEAAwE;A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;QAED,iCAAY,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEO,WAAW;QACf,OAAO,IAAI,uBAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE;YAC/D,oBAAoB,EAAE,CAAC;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,CAAC;YAC5E,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;qCAzFY,0BAA0B;IADtC,IAAA,qBAAU,GAAE;IAUJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,wBAAwB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,2BAA2B,CAAC,CAAA;qDAHO,mCAAgB;QAE1C,mDAAwB;QAErB,yDAA2B;GAf3D,0BAA0B,CAyFtC"}
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -34,128 +25,117 @@ class SaveDataToDBTask extends workers_1.AbstractTask {
34
25
  this.messageTransformation = new MpvMessageTransformation_1.MpvMessageTransformation();
35
26
  this.logger = ioc_1.IntegrationEngineContainer.resolve(CoreToken_1.CoreToken.Logger);
36
27
  }
37
- execute(data, messageProperties) {
38
- var _a;
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const taskStartTimestamp = new Date().getTime();
41
- const { trips, positions, stops } = yield this.messageTransformation.transform(data.m.spoj);
42
- const tripEntities = yield this.tripsRepository.bulkSave(trips,
43
- // Ignore incoming start_timestamp for existing trips to avoid overwriting existing computed timestamp
44
- // TODO this is a workaround, dedicated column (gtfs_start_timestamp) will be added
45
- Object.keys((_a = trips[0]) !== null && _a !== void 0 ? _a : {})
46
- .filter((key) => key !== "start_timestamp")
47
- .concat("updated_at"), true);
48
- const { inserted, updated } = TripsMapper_1.default.mapTripEntitiesToUpdateDto(tripEntities, taskStartTimestamp);
49
- // At this point we want to send ACK to rabbit and let the rest of the processing to be done in the background
50
- yield this.sendDataToUpdateGtfsTripId(inserted, positions, messageProperties === null || messageProperties === void 0 ? void 0 : messageProperties.timestamp);
51
- yield this.sendDataToUpdateDelay(updated, positions, messageProperties === null || messageProperties === void 0 ? void 0 : messageProperties.timestamp);
52
- // Save cis stops to later propagate platform codes to departure boards
53
- yield this.saveStops(stops);
54
- });
28
+ async execute(data, messageProperties) {
29
+ const taskStartTimestamp = new Date().getTime();
30
+ const { trips, positions, stops } = await this.messageTransformation.transform(data.m.spoj);
31
+ const tripEntities = await this.tripsRepository.bulkSave(trips,
32
+ // Ignore incoming start_timestamp for existing trips to avoid overwriting existing computed timestamp
33
+ // TODO this is a workaround, dedicated column (gtfs_start_timestamp) will be added
34
+ Object.keys(trips[0] ?? {})
35
+ .filter((key) => key !== "start_timestamp")
36
+ .concat("updated_at"), true);
37
+ const { inserted, updated } = TripsMapper_1.default.mapTripEntitiesToUpdateDto(tripEntities, taskStartTimestamp);
38
+ // At this point we want to send ACK to rabbit and let the rest of the processing to be done in the background
39
+ await this.sendDataToUpdateGtfsTripId(inserted, positions, messageProperties?.timestamp);
40
+ await this.sendDataToUpdateDelay(updated, positions, messageProperties?.timestamp);
41
+ // Save cis stops to later propagate platform codes to departure boards
42
+ await this.saveStops(stops);
55
43
  }
56
- saveStops(stops) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- try {
59
- yield this.cisStopRepository.bulkSave(stops);
44
+ async saveStops(stops) {
45
+ try {
46
+ await this.cisStopRepository.bulkSave(stops);
47
+ }
48
+ catch (error) {
49
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
50
+ this.logger.error(error);
60
51
  }
61
- catch (error) {
62
- if (error instanceof golemio_errors_1.AbstractGolemioError) {
63
- this.logger.error(error);
64
- }
65
- else {
66
- this.logger.error(new golemio_errors_1.GeneralError("Error while saving stops", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
67
- }
52
+ else {
53
+ this.logger.error(new golemio_errors_1.GeneralError("Error while saving stops", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
68
54
  }
69
- });
55
+ }
70
56
  }
71
- sendDataToUpdateGtfsTripId(insertedTrips, positions, firstMessageCreatedAt) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- try {
74
- // send message for update GTFSTripIds
75
- for (let i = 0, chunkSize = 50; i < insertedTrips.length; i += chunkSize) {
76
- const insertedBatch = insertedTrips.slice(i, i + chunkSize);
77
- const insertedIds = insertedBatch.map((ins) => {
78
- return ins.id;
79
- });
80
- yield queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateGTFSTripId", {
81
- trips: insertedBatch,
82
- positions: positions.filter((position) => insertedIds.includes(position.trips_id)),
83
- }, {
84
- timestamp: firstMessageCreatedAt,
85
- });
86
- }
57
+ async sendDataToUpdateGtfsTripId(insertedTrips, positions, firstMessageCreatedAt) {
58
+ try {
59
+ // send message for update GTFSTripIds
60
+ for (let i = 0, chunkSize = 50; i < insertedTrips.length; i += chunkSize) {
61
+ const insertedBatch = insertedTrips.slice(i, i + chunkSize);
62
+ const insertedIds = insertedBatch.map((ins) => {
63
+ return ins.id;
64
+ });
65
+ await queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateGTFSTripId", {
66
+ trips: insertedBatch,
67
+ positions: positions.filter((position) => insertedIds.includes(position.trips_id)),
68
+ }, {
69
+ timestamp: firstMessageCreatedAt,
70
+ });
87
71
  }
88
- catch (error) {
89
- if (error instanceof golemio_errors_1.AbstractGolemioError) {
90
- this.logger.error(error);
91
- }
92
- else {
93
- this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update GTFS trip id", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
94
- }
72
+ }
73
+ catch (error) {
74
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
75
+ this.logger.error(error);
76
+ }
77
+ else {
78
+ this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update GTFS trip id", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
95
79
  }
96
- });
80
+ }
97
81
  }
98
- sendDataToUpdateDelay(updatedTrips, positions, firstMessageCreatedAt) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- try {
101
- // aggregate runs by origin_route_name & run_number to keep related messages in same bulk
102
- const runTripMap = updatedTrips.length ? { unknown: [] } : {};
103
- for (const trip of updatedTrips) {
104
- if (!trip.origin_route_name || !trip.run_number) {
105
- runTripMap.unknown.push(trip.id);
106
- }
107
- else {
108
- const key = `${trip.origin_route_name}_${trip.run_number}`;
109
- runTripMap[key] ? runTripMap[key].push(trip.id) : (runTripMap[key] = [trip.id]);
110
- }
82
+ async sendDataToUpdateDelay(updatedTrips, positions, firstMessageCreatedAt) {
83
+ try {
84
+ // aggregate runs by origin_route_name & run_number to keep related messages in same bulk
85
+ const runTripMap = updatedTrips.length ? { unknown: [] } : {};
86
+ for (const trip of updatedTrips) {
87
+ if (!trip.origin_route_name || !trip.run_number) {
88
+ runTripMap.unknown.push(trip.id);
111
89
  }
112
- const chunks = [];
113
- let idx = 0;
114
- for (const key in runTripMap) {
115
- if (!chunks[idx]) {
116
- chunks[idx] = [];
117
- }
118
- chunks[idx] = chunks[idx].concat(runTripMap[key]);
119
- if (chunks[idx].length > 200) {
120
- idx++;
121
- }
122
- }
123
- const promises = [];
124
- for (const key in chunks) {
125
- promises.push(this.getTripDataAndSendToUpdateDelay(chunks[key], positions, firstMessageCreatedAt));
90
+ else {
91
+ const key = `${trip.origin_route_name}_${trip.run_number}`;
92
+ runTripMap[key] ? runTripMap[key].push(trip.id) : (runTripMap[key] = [trip.id]);
126
93
  }
127
- yield Promise.all(promises);
128
94
  }
129
- catch (error) {
130
- if (error instanceof golemio_errors_1.AbstractGolemioError) {
131
- this.logger.error(error);
95
+ const chunks = [];
96
+ let idx = 0;
97
+ for (const key in runTripMap) {
98
+ if (!chunks[idx]) {
99
+ chunks[idx] = [];
132
100
  }
133
- else {
134
- this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update delay", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
101
+ chunks[idx] = chunks[idx].concat(runTripMap[key]);
102
+ if (chunks[idx].length > 200) {
103
+ idx++;
135
104
  }
136
105
  }
137
- });
106
+ const promises = [];
107
+ for (const key in chunks) {
108
+ promises.push(this.getTripDataAndSendToUpdateDelay(chunks[key], positions, firstMessageCreatedAt));
109
+ }
110
+ await Promise.all(promises);
111
+ }
112
+ catch (error) {
113
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
114
+ this.logger.error(error);
115
+ }
116
+ else {
117
+ this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update delay", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
118
+ }
119
+ }
138
120
  }
139
- getTripDataAndSendToUpdateDelay(chunk, positions, firstMessageCreatedAt) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- try {
142
- const updatedTrips = yield this.tripsRepository.findAllAssocTripIds(chunk);
143
- yield queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", {
144
- updatedTrips,
145
- positions: positions.filter((position) => chunk.includes(position.trips_id)),
146
- }, {
147
- timestamp: firstMessageCreatedAt,
148
- });
121
+ async getTripDataAndSendToUpdateDelay(chunk, positions, firstMessageCreatedAt) {
122
+ try {
123
+ const updatedTrips = await this.tripsRepository.findAllAssocTripIds(chunk);
124
+ await queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", {
125
+ updatedTrips,
126
+ positions: positions.filter((position) => chunk.includes(position.trips_id)),
127
+ }, {
128
+ timestamp: firstMessageCreatedAt,
129
+ });
130
+ }
131
+ catch (error) {
132
+ if (error instanceof golemio_errors_1.AbstractGolemioError) {
133
+ this.logger.error(error);
149
134
  }
150
- catch (error) {
151
- if (error instanceof golemio_errors_1.AbstractGolemioError) {
152
- this.logger.error(error);
153
- }
154
- else {
155
- this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update delay", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
156
- }
135
+ else {
136
+ this.logger.error(new golemio_errors_1.GeneralError("Error while sending data to update delay", SaveDataToDBTask.name, error, undefined, "pid", this.queueName));
157
137
  }
158
- });
138
+ }
159
139
  }
160
140
  }
161
141
  exports.SaveDataToDBTask = SaveDataToDBTask;
@@ -1 +1 @@
1
- {"version":3,"file":"SaveDataToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,wEAAqE;AACrE,mEAAuF;AACvF,2FAAqF;AACrF,2EAA6E;AAC7E,6EAA8F;AAE9F,wEAAqE;AACrE,oEAAiE;AACjE,qFAA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CACzC,KAAe,EACf,SAA0C,EAC1C,qBAA8B;;YAE9B,IAAI;gBACA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBAC3E,MAAM,8BAAY,CAAC,qBAAqB,CACpC,IAAI,CAAC,WAAW,EAChB,aAAa,EACb;oBACI,YAAY;oBACZ,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;iBAC/E,EACD;oBACI,SAAS,EAAE,qBAAqB;iBACnC,CACJ,CAAC;aACL;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,KAAK,YAAY,qCAAoB,EAAE;oBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBAC5B;qBAAM;oBACH,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,6BAAY,CACZ,0CAA0C,EAC1C,gBAAgB,CAAC,IAAI,EACrB,KAAK,EACL,SAAS,EACT,KAAK,EACL,IAAI,CAAC,SAAS,CACjB,CACJ,CAAC;iBACL;aACJ;QACL,CAAC;KAAA;CACJ;AA3LD,4CA2LC"}
1
+ {"version":3,"file":"SaveDataToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.ts"],"names":[],"mappings":";;;;;;AAIA,wEAAqE;AACrE,mEAAuF;AACvF,2FAAqF;AACrF,2EAA6E;AAC7E,6EAA8F;AAE9F,wEAAqE;AACrE,oEAAiE;AACjE,qFAA6D;AAG7D,qEAA4E;AAC5E,0FAAuF;AAEvF,MAAa,gBAAiB,SAAQ,sBAA8B;IAUhE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAVP,cAAS,GAAG,cAAc,CAAC;QAC3B,aAAQ,GAAG,CAAC,GAAG,EAAE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