@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.
- package/dist/input-gateway/jis/JisInfotextsController.js +4 -13
- package/dist/input-gateway/jis/JisInfotextsController.js.map +1 -1
- package/dist/input-gateway/jis/JisInfotextsRouter.js +3 -12
- package/dist/input-gateway/jis/JisInfotextsRouter.js.map +1 -1
- package/dist/input-gateway/ropid-gtfs/RopidGtfsController.js +4 -13
- package/dist/input-gateway/ropid-gtfs/RopidGtfsController.js.map +1 -1
- package/dist/input-gateway/ropid-gtfs/RopidGtfsRouter.js +3 -12
- package/dist/input-gateway/ropid-gtfs/RopidGtfsRouter.js.map +1 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +4 -13
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsRouter.js +3 -12
- package/dist/input-gateway/vehicle-positions/VehiclePositionsRouter.js.map +1 -1
- package/dist/integration-engine/data-retention/workers/tasks/DeleteDataTask.js +4 -15
- package/dist/integration-engine/data-retention/workers/tasks/DeleteDataTask.js.map +1 -1
- package/dist/integration-engine/data-retention/workers/tasks/TableStorageRetentionTask.js +8 -19
- package/dist/integration-engine/data-retention/workers/tasks/TableStorageRetentionTask.js.map +1 -1
- package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js +1 -1
- package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +56 -72
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js +32 -48
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISMetadataRepository.js +24 -37
- package/dist/integration-engine/jis/repositories/JISMetadataRepository.js.map +1 -1
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js +24 -35
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -1
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js +2 -3
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +12 -23
- package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +4 -15
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopTimesModel.js +3 -12
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopTimesModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +2 -11
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js +3 -12
- package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js +21 -30
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js +20 -29
- package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js +33 -52
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/RouteSubAgencyRepository.js +12 -23
- package/dist/integration-engine/ropid-gtfs/data-access/RouteSubAgencyRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js +12 -23
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js +33 -44
- package/dist/integration-engine/ropid-gtfs/data-access/cache/PublicGtfsDepartureRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js +10 -21
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +15 -24
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js +3 -12
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +3 -12
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +4 -13
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js +30 -41
- package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js +11 -22
- package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js +1 -2
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSCisStopsTransformation.js +7 -16
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSCisStopsTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSOisTransformation.js +3 -12
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSOisTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js +13 -17
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/data-access/PresetLogRepository.js +13 -22
- package/dist/integration-engine/ropid-gtfs/workers/presets/data-access/PresetLogRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/datasources/grafana-loki/GrafanaLokiDataSourceProvider.js +1 -2
- package/dist/integration-engine/ropid-gtfs/workers/presets/datasources/grafana-loki/GrafanaLokiDataSourceProvider.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/helpers/RopidMonitoringService.js +12 -23
- package/dist/integration-engine/ropid-gtfs/workers/presets/helpers/RopidMonitoringService.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CheckForNewDeparturesPresetsTask.js +14 -25
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CheckForNewDeparturesPresetsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CollectAndSaveLogsTask.js +26 -37
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/CollectAndSaveLogsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/DownloadDeparturesPresetsTask.js +12 -23
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/DownloadDeparturesPresetsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/ProcessAndSendLogsTask.js +36 -49
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/ProcessAndSendLogsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js +3 -14
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/transformations/PresetLogTransformation.js +1 -2
- package/dist/integration-engine/ropid-gtfs/workers/presets/transformations/PresetLogTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js +29 -40
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +64 -81
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js +60 -79
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js +23 -34
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js +26 -38
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPublicGtfsDepartureCacheTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js +21 -32
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/SaveStaticDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js +43 -55
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/DeparturesDirectionRepository.js +8 -18
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/DeparturesDirectionRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/MetroRailtrackGPSRepository.js +11 -21
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/MetroRailtrackGPSRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js +8 -17
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js +19 -30
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/transformations/DeparturesDirectionTransformation.js +8 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/transformations/DeparturesDirectionTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/RopidVYMIEventsTransformation.js +31 -47
- package/dist/integration-engine/ropid-vymi/RopidVYMIEventsTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsRoutesModel.js +6 -17
- package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsRoutesModel.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/models/RopidVYMIMetadataModel.js +4 -14
- package/dist/integration-engine/ropid-vymi/models/RopidVYMIMetadataModel.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/workers/tasks/CheckForNewEventsTask.js +6 -17
- package/dist/integration-engine/ropid-vymi/workers/tasks/CheckForNewEventsTask.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/workers/tasks/FetchAndProcessEventsTask.js +34 -31
- package/dist/integration-engine/ropid-vymi/workers/tasks/FetchAndProcessEventsTask.js.map +1 -1
- package/dist/integration-engine/ropid-vymi/workers/tasks/helpers/RopidVYMIApiHelper.js +3 -12
- package/dist/integration-engine/ropid-vymi/workers/tasks/helpers/RopidVYMIApiHelper.js.map +1 -1
- package/dist/integration-engine/shared/RopidMetadataModel.js +35 -45
- package/dist/integration-engine/shared/RopidMetadataModel.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/AlertsGenerator.js +13 -24
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/AlertsGenerator.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.js +9 -6
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js +113 -128
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/AlertsTransformation.js +20 -34
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/AlertsTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/AbstractRunRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/AbstractRunRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsMessagesRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsMessagesRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +12 -21
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js +7 -16
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/CisLookupManager.js +22 -33
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/CisLookupManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/GtfsLookupManager.js +31 -44
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/GtfsLookupManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusRunsFacade.js +14 -25
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusRunsFacade.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/TripScheduleManager.js +25 -37
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/TripScheduleManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js +53 -63
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessRegionalBusRunMessagesTask.js +57 -72
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessRegionalBusRunMessagesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveArrivaCityRunsToDBTask.js +15 -26
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveArrivaCityRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js +10 -21
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js +19 -30
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js +10 -21
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js +5 -14
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js +4 -14
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/RegionalBusRunsMessagesTransformation.js +1 -2
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/RegionalBusRunsMessagesTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/data-access/DescriptorRepository.js +35 -49
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/data-access/DescriptorRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/tasks/RefreshDescriptorsTask.js +11 -22
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/tasks/RefreshDescriptorsTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/transformations/DescriptorTransformation.js +2 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/transformations/DescriptorTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/CisStopRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/CisStopRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsHistoryRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsHistoryRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js +19 -29
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimesHistoryRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimesHistoryRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsHistoryRepository.js +3 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsHistoryRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +58 -55
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js +64 -79
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js +46 -59
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js +39 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/metro/CachedMetroRailtrackLookup.js +8 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/metro/CachedMetroRailtrackLookup.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js +2 -13
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +10 -16
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +68 -40
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js +5 -14
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/ComputeDelayHelper.js +4 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/ComputeDelayHelper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js +4 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js +3 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-data/strategy/HttpGtfsTripDataFixer.js +7 -18
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-data/strategy/HttpGtfsTripDataFixer.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.js +7 -16
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripCommonRunManager.js +40 -57
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripCommonRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js +36 -53
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/metro/MetroShapePointsFixer.js +32 -41
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/metro/MetroShapePointsFixer.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +61 -33
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/RegionalBusComputeDelayHelper.js +4 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/RegionalBusComputeDelayHelper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js +4 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/gtfs-trip-run/GtfsTripRegionalBusRunManager.js +38 -55
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/gtfs-trip-run/GtfsTripRegionalBusRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/DataRetentionTask.js +32 -45
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/DataRetentionTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js +81 -91
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js +43 -55
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js +37 -49
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshGtfsTripDataTask.js +7 -18
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshGtfsTripDataTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +41 -52
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.js +32 -43
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.js +95 -115
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +150 -162
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js +82 -94
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js +24 -35
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js +15 -18
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js +11 -21
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +2 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js +5 -15
- package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v2/V2InfotextsController.js +4 -13
- package/dist/output-gateway/pid/controllers/v2/V2InfotextsController.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js +4 -13
- package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js.map +1 -1
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js +8 -17
- package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js +40 -53
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
- package/dist/output-gateway/pid/data-access/JISInfotextRepository.js +62 -75
- package/dist/output-gateway/pid/data-access/JISInfotextRepository.js.map +1 -1
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +2 -3
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
- package/dist/output-gateway/pid/helpers/ParamValidatorManager.js +6 -15
- package/dist/output-gateway/pid/helpers/ParamValidatorManager.js.map +1 -1
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +11 -21
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js +20 -27
- package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js +16 -25
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +2 -4
- package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +12 -23
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/StopFacade.js +27 -38
- package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/TransferFacade.js +32 -39
- package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
- package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js +3 -4
- package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js.map +1 -1
- package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js +8 -12
- package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js.map +1 -1
- package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js +1 -2
- package/dist/output-gateway/pid/service/transformations/JISInfotextTransferTransformation.js.map +1 -1
- package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js +1 -2
- package/dist/output-gateway/pid/service/transformations/TransferDepartureTransformation.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js +4 -13
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicGtfsController.js +4 -13
- package/dist/output-gateway/public/controllers/v2/V2PublicGtfsController.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicVehiclePositionsController.js +9 -18
- package/dist/output-gateway/public/controllers/v2/V2PublicVehiclePositionsController.js.map +1 -1
- package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js +13 -26
- package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js +22 -33
- package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +9 -20
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js +23 -34
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js.map +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +153 -172
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
- package/dist/output-gateway/public/routers/v2/helpers/CustomStopIdGroupValidator.js +2 -2
- package/dist/output-gateway/public/routers/v2/helpers/CustomStopIdGroupValidator.js.map +1 -1
- package/dist/output-gateway/public/service/VPSubscriber.js +8 -19
- package/dist/output-gateway/public/service/VPSubscriber.js.map +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js +100 -117
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js.map +1 -1
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.js +18 -29
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.js.map +1 -1
- package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.js +20 -31
- package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.js.map +1 -1
- package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js +15 -26
- package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/strategy/StopTimesTripScopeHandler.js +1 -2
- package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/strategy/StopTimesTripScopeHandler.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHandler.js +3 -14
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHandler.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHandler.js +7 -18
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHandler.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js +35 -46
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHandler.js +16 -22
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHandler.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js +9 -10
- package/dist/output-gateway/public/service/transformations/PublicDepartureTransformation.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js +5 -15
- package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/gtfs-trip-scopes/PublicGtfsTripInfoTransformation.js +2 -3
- package/dist/output-gateway/public/service/transformations/gtfs-trip-scopes/PublicGtfsTripInfoTransformation.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js +2 -15
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js +1 -13
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js +14 -25
- package/dist/output-gateway/ropid-gtfs/data-access/CisStopGroupRepository.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSCalendarModel.js +3 -12
- package/dist/output-gateway/ropid-gtfs/models/GTFSCalendarModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSRoutesModel.js +4 -13
- package/dist/output-gateway/ropid-gtfs/models/GTFSRoutesModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSShapesModel.js +5 -14
- package/dist/output-gateway/ropid-gtfs/models/GTFSShapesModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js +90 -102
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopTimesModel.js +3 -12
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopTimesModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSTripsModel.js +43 -51
- package/dist/output-gateway/ropid-gtfs/models/GTFSTripsModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/routers/v2/V2GTFSRouter.js +28 -37
- package/dist/output-gateway/ropid-gtfs/routers/v2/V2GTFSRouter.js.map +1 -1
- package/dist/output-gateway/shared/DepartureCalculator.js +1 -1
- package/dist/output-gateway/shared/DepartureCalculator.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js +40 -48
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js +7 -16
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js +10 -19
- package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSRunNumbers.js +5 -2
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSRunNumbers.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/index.js +16 -4
- package/dist/schema-definitions/ropid-gtfs/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.UpdateGtfsTripIdTask = void 0;
|
|
13
4
|
const RopidGTFSStopTimesModel_1 = require("../../../../ropid-gtfs/RopidGTFSStopTimesModel");
|
|
@@ -41,100 +32,97 @@ class UpdateGtfsTripIdTask extends workers_1.AbstractTask {
|
|
|
41
32
|
/**
|
|
42
33
|
* Take all newly computed positions and save it, then save the last ones to the trips
|
|
43
34
|
*/
|
|
44
|
-
execute(data, messageProperties) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
async execute(data, messageProperties) {
|
|
36
|
+
// unique ids in input data in key-value (id-positions) structure
|
|
37
|
+
let tripIdToPositionDict = {};
|
|
38
|
+
for (const position of data.positions) {
|
|
39
|
+
tripIdToPositionDict[position.trips_id] = position;
|
|
40
|
+
}
|
|
41
|
+
// find gtfs data for each trip
|
|
42
|
+
const foundTrips = await Promise.all(data.trips.map(async (trip) => {
|
|
43
|
+
if (!trip.start_timestamp) {
|
|
44
|
+
return;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!trip.start_timestamp) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
return yield this.tripsRepository.findGTFSTripId(trip);
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
helpers_1.log.error(err);
|
|
61
|
-
return err;
|
|
62
|
-
}
|
|
63
|
-
})));
|
|
64
|
-
let existingTrips = [], existingTripErrors = [];
|
|
65
|
-
// filter only trips with found gtfs data
|
|
66
|
-
for (const trip of foundTrips) {
|
|
67
|
-
if (trip instanceof golemio_errors_1.AbstractGolemioError) {
|
|
68
|
-
existingTripErrors.push(trip);
|
|
69
|
-
}
|
|
70
|
-
else if (trip instanceof Array) {
|
|
71
|
-
existingTrips.push(...trip);
|
|
72
|
-
}
|
|
73
|
-
else if ((trip === null || trip === void 0 ? void 0 : trip.constructor) === Object) {
|
|
74
|
-
existingTrips.push(trip);
|
|
75
|
-
}
|
|
46
|
+
try {
|
|
47
|
+
return await this.tripsRepository.findGTFSTripId(trip);
|
|
76
48
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
continue;
|
|
81
|
-
if (!blockIdToTripIdsDict[trip.gtfs_block_id]) {
|
|
82
|
-
blockIdToTripIdsDict[trip.gtfs_block_id] = new Set();
|
|
83
|
-
}
|
|
84
|
-
blockIdToTripIdsDict[trip.gtfs_block_id].add(trip.gtfs_trip_id);
|
|
49
|
+
catch (err) {
|
|
50
|
+
helpers_1.log.error(err);
|
|
51
|
+
return err;
|
|
85
52
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return acc;
|
|
96
|
-
}), Promise.resolve({}));
|
|
97
|
-
let currentPosition;
|
|
98
|
-
for (const trip of existingTrips) {
|
|
99
|
-
if (tripIdToPositionDict[trip.id]) {
|
|
100
|
-
currentPosition = tripIdToPositionDict[trip.id];
|
|
101
|
-
if (trip.gtfs_block_id) {
|
|
102
|
-
// Determine current position tracking status
|
|
103
|
-
currentPosition.is_tracked = VPUtils_1.VPUtils.determineTrackingStatus(trip.gtfs_trip_id, blockIdToTripStopScheduleDict[trip.gtfs_block_id], currentPosition);
|
|
104
|
-
}
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (!currentPosition) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
// Determine new position tracking status
|
|
111
|
-
const newPositionTrackingStatus = VPUtils_1.VPUtils.determineNewPositionTracking(blockIdToTripStopScheduleDict[trip.gtfs_block_id], trip, currentPosition);
|
|
112
|
-
// duplicate position with new created trip for second trip
|
|
113
|
-
const newPosition = Object.assign({}, currentPosition);
|
|
114
|
-
newPosition.trips_id = trip.id;
|
|
115
|
-
newPosition.is_tracked = newPositionTrackingStatus;
|
|
116
|
-
data.positions.push(newPosition);
|
|
53
|
+
}));
|
|
54
|
+
let existingTrips = [], existingTripErrors = [];
|
|
55
|
+
// filter only trips with found gtfs data
|
|
56
|
+
for (const trip of foundTrips) {
|
|
57
|
+
if (trip instanceof golemio_errors_1.AbstractGolemioError) {
|
|
58
|
+
existingTripErrors.push(trip);
|
|
59
|
+
}
|
|
60
|
+
else if (trip instanceof Array) {
|
|
61
|
+
existingTrips.push(...trip);
|
|
117
62
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// successfully updated gtfs ids
|
|
121
|
-
for (let i = 0, chunkSize = 100, imax = existingTrips.length; i < imax; i += chunkSize) {
|
|
122
|
-
yield queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", {
|
|
123
|
-
positions: [],
|
|
124
|
-
updatedTrips: existingTrips.slice(i, i + chunkSize),
|
|
125
|
-
}, { timestamp: messageProperties === null || messageProperties === void 0 ? void 0 : messageProperties.timestamp });
|
|
63
|
+
else if (trip?.constructor === Object) {
|
|
64
|
+
existingTrips.push(trip);
|
|
126
65
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
66
|
+
}
|
|
67
|
+
let blockIdToTripIdsDict = {};
|
|
68
|
+
for (const trip of existingTrips) {
|
|
69
|
+
if (!trip.gtfs_block_id || !trip.gtfs_trip_id)
|
|
70
|
+
continue;
|
|
71
|
+
if (!blockIdToTripIdsDict[trip.gtfs_block_id]) {
|
|
72
|
+
blockIdToTripIdsDict[trip.gtfs_block_id] = new Set();
|
|
73
|
+
}
|
|
74
|
+
blockIdToTripIdsDict[trip.gtfs_block_id].add(trip.gtfs_trip_id);
|
|
75
|
+
}
|
|
76
|
+
// create cache for trip stops (grouped by block id)
|
|
77
|
+
const blockIdToTripStopScheduleDict = await Object.entries(blockIdToTripIdsDict).reduce(async (acc, [blockId, gtfsTripIds]) => {
|
|
78
|
+
const tripStops = await acc;
|
|
79
|
+
try {
|
|
80
|
+
tripStops[blockId] = await this.tripStopsManager.setAndReturnTripStopsSchedule(blockId, [...gtfsTripIds]);
|
|
130
81
|
}
|
|
131
|
-
|
|
82
|
+
catch (err) {
|
|
83
|
+
helpers_1.IntegrationErrorHandler.handle(err);
|
|
84
|
+
}
|
|
85
|
+
return acc;
|
|
86
|
+
}, Promise.resolve({}));
|
|
87
|
+
let currentPosition;
|
|
88
|
+
for (const trip of existingTrips) {
|
|
89
|
+
if (tripIdToPositionDict[trip.id]) {
|
|
90
|
+
currentPosition = tripIdToPositionDict[trip.id];
|
|
91
|
+
if (trip.gtfs_block_id) {
|
|
92
|
+
// Determine current position tracking status
|
|
93
|
+
currentPosition.is_tracked = VPUtils_1.VPUtils.determineTrackingStatus(trip.gtfs_trip_id, blockIdToTripStopScheduleDict[trip.gtfs_block_id], currentPosition);
|
|
94
|
+
}
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (!currentPosition) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
// Determine new position tracking status
|
|
101
|
+
const newPositionTrackingStatus = VPUtils_1.VPUtils.determineNewPositionTracking(blockIdToTripStopScheduleDict[trip.gtfs_block_id], trip, currentPosition);
|
|
102
|
+
// duplicate position with new created trip for second trip
|
|
103
|
+
const newPosition = { ...currentPosition };
|
|
104
|
+
newPosition.trips_id = trip.id;
|
|
105
|
+
newPosition.is_tracked = newPositionTrackingStatus;
|
|
106
|
+
data.positions.push(newPosition);
|
|
107
|
+
}
|
|
108
|
+
await this.positionsRepository.bulkSave(data.positions);
|
|
109
|
+
await this.generateAndSaveScheduledTrips(tripIdToPositionDict, data.trips, existingTrips);
|
|
110
|
+
// successfully updated gtfs ids
|
|
111
|
+
for (let i = 0, chunkSize = 100, imax = existingTrips.length; i < imax; i += chunkSize) {
|
|
112
|
+
await queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", {
|
|
113
|
+
positions: [],
|
|
114
|
+
updatedTrips: existingTrips.slice(i, i + chunkSize),
|
|
115
|
+
}, { timestamp: messageProperties?.timestamp });
|
|
116
|
+
}
|
|
117
|
+
// gtfsId updating errors
|
|
118
|
+
for (let i = 0, imax = existingTripErrors.length; i < imax; i++) {
|
|
119
|
+
helpers_1.IntegrationErrorHandler.handle(existingTripErrors[i]);
|
|
120
|
+
}
|
|
132
121
|
}
|
|
133
122
|
generateAndSaveScheduledTrips(tripIdToPositionDict, inputTrips, existingTrips) {
|
|
134
|
-
var _a;
|
|
135
123
|
let operationPromises = [];
|
|
136
124
|
for (const inputTrip of inputTrips) {
|
|
137
|
-
if (!
|
|
125
|
+
if (!tripIdToPositionDict[inputTrip.id]?.origin_timestamp) {
|
|
138
126
|
continue;
|
|
139
127
|
}
|
|
140
128
|
const existingTrip = existingTrips.find((existingTrip) => existingTrip.id === inputTrip.id);
|
|
@@ -143,7 +131,7 @@ class UpdateGtfsTripIdTask extends workers_1.AbstractTask {
|
|
|
143
131
|
let runNumber = inputTrip.run_number;
|
|
144
132
|
// We don't trust the run number and route name from the input data
|
|
145
133
|
// so we use the ones from the scheduled/existing trip if they exist
|
|
146
|
-
if (
|
|
134
|
+
if (existingTrip?.internal_run_number && existingTrip?.internal_route_name) {
|
|
147
135
|
routeId = existingTrip.internal_route_name;
|
|
148
136
|
runNumber = existingTrip.internal_run_number;
|
|
149
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.ts"],"names":[],"mappings":";;;AAAA,4FAAiF;AACjF,oEAAsG;AACtG,sFAA2G;AAC3G,2EAA6F;AAC7F,2FAAqF;AACrF,2EAA6E;AAC7E,6EAA8F;AAE9F,4EAAyE;AACzE,oEAAiE;AAEjE,kEAA+D;AAC/D,gDAA6C;AAE7C,kGAAgH;AAIhH,6EAAoF;AAEpF,MAAa,oBAAqB,SAAQ,sBAAoC;IAW1E,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAXP,cAAS,GAAG,kBAAkB,CAAC;QAC/B,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,yDAAgC,CAAC;Q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ACnE,oEAAoE;YACpE,IAAI,YAAY,EAAE,mBAAmB,IAAI,YAAY,EAAE,mBAAmB,EAAE;gBACxE,OAAO,GAAG,YAAY,CAAC,mBAAmB,CAAC;gBAC3C,SAAS,GAAG,YAAY,CAAC,mBAAmB,CAAC;aAChD;YAED,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;gBACxB,SAAS;aACZ;YAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB;iBAC3C,0BAA0B,CAAC;gBACxB,QAAQ,EAAE,OAAO;gBACjB,UAAU,EAAE,SAAS;gBACrB,kBAAkB,EAAE,wBAAwB;aAC/C,CAAC;iBACD,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC;YAEnD,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC5C;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,CAAC;CACJ;AApMD,oDAoMC"}
|
|
@@ -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
|
};
|
|
@@ -35,17 +26,17 @@ class UpdateRunsGtfsTripIdTask extends workers_1.AbstractTask {
|
|
|
35
26
|
/**
|
|
36
27
|
* Process not public trips from runs data
|
|
37
28
|
*/
|
|
38
|
-
this.updateNotPublicRunTrip = (input) =>
|
|
29
|
+
this.updateNotPublicRunTrip = async (input) => {
|
|
39
30
|
const tripId = TripsIdGenerator_1.default.generateFromCommonRunNotPublic(input.run);
|
|
40
31
|
//#region position
|
|
41
32
|
const positionDto = PositionsMapper_1.default.mapCommonRunNotPublicToDto(input.run_message, tripId);
|
|
42
|
-
const createdPosition =
|
|
33
|
+
const createdPosition = await this.positionsRepository.createEntity(positionDto);
|
|
43
34
|
//#endregion
|
|
44
35
|
//#region trip
|
|
45
36
|
const tripDto = TripsMapper_1.default.mapCommonRunNotPublicToDto(input.run, tripId, createdPosition.id);
|
|
46
|
-
|
|
37
|
+
await this.tripsRepository.upsertEntity(tripDto);
|
|
47
38
|
//#endregion
|
|
48
|
-
}
|
|
39
|
+
};
|
|
49
40
|
this.tripsRepository = new TripsRepository_1.TripsRepository();
|
|
50
41
|
this.positionsRepository = new PositionsRepository_1.PositionsRepository();
|
|
51
42
|
this.commonRunsRepository = new CommonRunsRepository_1.CommonRunsRepository();
|
|
@@ -55,30 +46,28 @@ class UpdateRunsGtfsTripIdTask extends workers_1.AbstractTask {
|
|
|
55
46
|
/**
|
|
56
47
|
* Process trips from runs data
|
|
57
48
|
*/
|
|
58
|
-
execute(data, messageProperties) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
yield this.updateNotPublicRunTrip(data);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
helpers_1.log.info(`updateRunsGTFSTripId: no schedule for run: ${JSON.stringify(data.run)}`);
|
|
67
|
-
}
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (!data.run_message.actual_stop_timestamp_scheduled) {
|
|
71
|
-
helpers_1.log.info(`updateRunsGTFSTripId: actualStopTimestampScheduled is not provided for current run: ${JSON.stringify(data.run)}`);
|
|
72
|
-
return;
|
|
49
|
+
async execute(data, messageProperties) {
|
|
50
|
+
const schedule = await this.gtfsTripRunManager.setAndReturnScheduledTrips(data.run);
|
|
51
|
+
if (schedule.length === 0) {
|
|
52
|
+
if (const_1.ArrayNotPublicRegistrationNumbers.includes(data.run.registration_number)) {
|
|
53
|
+
await this.updateNotPublicRunTrip(data);
|
|
73
54
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (delayMsg.updatedTrips.length > 0) {
|
|
77
|
-
yield queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", delayMsg, {
|
|
78
|
-
timestamp: messageProperties === null || messageProperties === void 0 ? void 0 : messageProperties.timestamp,
|
|
79
|
-
});
|
|
55
|
+
else {
|
|
56
|
+
helpers_1.log.info(`updateRunsGTFSTripId: no schedule for run: ${JSON.stringify(data.run)}`);
|
|
80
57
|
}
|
|
81
|
-
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!data.run_message.actual_stop_timestamp_scheduled) {
|
|
61
|
+
helpers_1.log.info(`updateRunsGTFSTripId: actualStopTimestampScheduled is not provided for current run: ${JSON.stringify(data.run)}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const delayMsg = await this.gtfsTripRunManager.generateDelayMsg(schedule, data);
|
|
65
|
+
// send to updateDelay only if there are some trips updated
|
|
66
|
+
if (delayMsg.updatedTrips.length > 0) {
|
|
67
|
+
await queueprocessors_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateDelay", delayMsg, {
|
|
68
|
+
timestamp: messageProperties?.timestamp,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
82
71
|
}
|
|
83
72
|
}
|
|
84
73
|
exports.UpdateRunsGtfsTripIdTask = UpdateRunsGtfsTripIdTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateRunsGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateRunsGtfsTripIdTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2E;AAC3E,sFAA2G;AAC3G,2EAAoE;AACpE,2FAAqF;AACrF,2EAA6E;AAE7E,gDAA8D;AAC9D,4EAAyE;AACzE,oEAAiE;AACjE,6FAAqE;AACrE,+FAAuE;AACvE,qFAA6D;AAE7D,kGAAgH;AAEhH,qFAA4F;AAE5F,MAAa,wBAAyB,SAAQ,sBAAsC;IAWhF,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAXP,cAAS,GAAG,sBAAsB,CAAC;QACnC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,iEAAoC,CAAC;QAwD9D;;WAEG;QACK,2BAAsB,GAAG,KAAK,EAAE,KAA+B,EAAE,EAAE;YACvE,MAAM,MAAM,GAAG,0BAAgB,CAAC,8BAA8B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAE1E,kBAAkB;YAClB,MAAM,WAAW,GAAG,yBAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAC1F,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;YACjF,YAAY;YAEZ,cAAc;YACd,MAAM,OAAO,GAAG,qBAAW,CAAC,0BAA0B,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC;YAC9F,MAAM,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACjD,YAAY;QAChB,CAAC,CAAC;QA7DE,IAAI,CAAC,e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,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,8BAAY,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE;gBAChF,SAAS,EAAE,iBAAiB,EAAE,SAAS;aAC1C,CAAC,CAAC;SACN;IACL,CAAC;CAkBJ;AA3ED,4DA2EC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AbstractPropagateDelayTask = void 0;
|
|
13
4
|
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
@@ -21,9 +12,8 @@ class AbstractPropagateDelayTask extends integration_engine_1.AbstractTask {
|
|
|
21
12
|
/**
|
|
22
13
|
* Takes all newly computed positions search for next trips in near future and propagate delay for them
|
|
23
14
|
*/
|
|
24
|
-
this.propagateDelayForGtfsTrip = (data) =>
|
|
25
|
-
|
|
26
|
-
const trips = yield this.tripsRepository.getPropagateDelayTripsWithPositions(data);
|
|
15
|
+
this.propagateDelayForGtfsTrip = async (data) => {
|
|
16
|
+
const trips = await this.tripsRepository.getPropagateDelayTripsWithPositions(data);
|
|
27
17
|
if (!trips.length)
|
|
28
18
|
return;
|
|
29
19
|
let tripsToUpdate = new Map();
|
|
@@ -32,7 +22,7 @@ class AbstractPropagateDelayTask extends integration_engine_1.AbstractTask {
|
|
|
32
22
|
for (let i = 0; i < trips.length; i++) {
|
|
33
23
|
const trip = trips[i];
|
|
34
24
|
const lastPosition = trip.last_position;
|
|
35
|
-
const requiredTurnaroundSeconds =
|
|
25
|
+
const requiredTurnaroundSeconds = data.nextGtfsTrips.find((gtfsTrip) => gtfsTrip.trip_id === trip.gtfs_trip_id)?.requiredTurnaroundSeconds ?? 0;
|
|
36
26
|
let delayInSeconds = data.currentDelay;
|
|
37
27
|
// If trips are not connected through block_id, subtract the time that the vehicle is expected to wait between trips
|
|
38
28
|
// otherwise delay should be propagated to next trips as is
|
|
@@ -51,10 +41,17 @@ class AbstractPropagateDelayTask extends integration_engine_1.AbstractTask {
|
|
|
51
41
|
tripsToUpdate.set(trip.id, {
|
|
52
42
|
id: trip.id,
|
|
53
43
|
last_position_id: lastPosition.id,
|
|
54
|
-
last_position_context:
|
|
44
|
+
last_position_context: {
|
|
45
|
+
...trip.last_position_context,
|
|
46
|
+
lastPositionLat: typeof lastPosition.lat === "string" ? parseFloat(lastPosition.lat) : lastPosition.lat,
|
|
47
|
+
lastPositionLng: typeof lastPosition.lng === "string" ? parseFloat(lastPosition.lng) : lastPosition.lng,
|
|
48
|
+
lastPositionState: const_1.StatePositionEnum.BEFORE_TRACK_DELAYED,
|
|
49
|
+
lastPositionStateChange: new Date().toISOString(),
|
|
50
|
+
lastPositionBeforeTrackDelayed: {
|
|
55
51
|
delay: delayInSeconds,
|
|
56
52
|
origin_timestamp: lastPosition.origin_timestamp,
|
|
57
|
-
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
58
55
|
});
|
|
59
56
|
positionsToUpdate.push({
|
|
60
57
|
id: lastPosition.id,
|
|
@@ -65,9 +62,9 @@ class AbstractPropagateDelayTask extends integration_engine_1.AbstractTask {
|
|
|
65
62
|
bearing: data.currentBearing,
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
65
|
+
await this.positionsRepository.bulkSave(positionsToUpdate);
|
|
66
|
+
await this.tripsRepository.bulkSave(Array.from(tripsToUpdate.values()));
|
|
67
|
+
};
|
|
71
68
|
this.tripsRepository = new TripsRepository_1.TripsRepository();
|
|
72
69
|
this.positionsRepository = new PositionsRepository_1.PositionsRepository();
|
|
73
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractPropagateDelayTask.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AbstractPropagateDelayTask.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.ts"],"names":[],"mappings":";;;AAEA,8EAAqE;AACrE,mDAAgE;AAChE,+EAA4E;AAC5E,uEAAoE;AAGpE,MAAsB,0BAA6C,SAAQ,iCAAe;IAMtF,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QANP,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QAWtD;;WAEG;QACO,8BAAyB,GAAG,KAAK,EAAE,IAAqB,EAAE,EAAE;YAClE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,mCAAmC,CAAC,IAAI,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,OAAO;YAE1B,IAAI,aAAa,GAAG,IAAI,GAAG,EAAkC,CAAC;YAC9D,IAAI,iBAAiB,GAAiC,EAAE,CAAC;YACzD,IAAI,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAgB,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,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;AA5ED,gEA4EC"}
|
|
@@ -11,7 +11,7 @@ class UpdateDelayLimiter {
|
|
|
11
11
|
this.name = name;
|
|
12
12
|
this.queueTtl = queueTtl;
|
|
13
13
|
this.skippedIterations = 0;
|
|
14
|
-
this.logger = logger
|
|
14
|
+
this.logger = logger ?? Di_1.IntegrationEngineContainer.resolve(CoreToken_1.CoreToken.Logger);
|
|
15
15
|
}
|
|
16
16
|
isActualMessage(messageProperties) {
|
|
17
17
|
if (!messageProperties) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateDelayLimiter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AAErE,qEAA0F;AAG1F;;GAEG;AACH,MAAa,kBAAkB;IAK3B,YAAoB,IAAY,EAAU,QAAgB,EAAE,MAAgB;QAAxD,SAAI,GAAJ,IAAI,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAQ;QAHlD,sBAAiB,GAAG,CAAC,CAAC;QAI1B,IAAI,CAAC,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"UpdateDelayLimiter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.ts"],"names":[],"mappings":";;;AAAA,wEAAqE;AAErE,qEAA0F;AAG1F;;GAEG;AACH,MAAa,kBAAkB;IAK3B,YAAoB,IAAY,EAAU,QAAgB,EAAE,MAAgB;QAAxD,SAAI,GAAJ,IAAI,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAQ;QAHlD,sBAAiB,GAAG,CAAC,CAAC;QAI1B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,+BAA0B,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAAC,CAAC;IAC1F,CAAC;IAEM,eAAe,CAAC,iBAAgD;QACnE,IAAI,CAAC,iBAAiB,EAAE;YACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAErF,OAAO,IAAI,CAAC;SACf;aAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sDAAsD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAEpF,OAAO,IAAI,CAAC;SACf;aAAM,IAAI,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAI,iBAAiB,CAAC,SAAoB,GAAG,IAAI,CAAC,QAAQ,EAAE;YACvF,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,sBAAsB,EAAE;gBACpE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gEAAgE,IAAI,CAAC,iBAAiB,SAAS,CAAC,CAAC;gBAClH,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;aAC9B;YAED,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;;AA7BL,gDA8BC;AA7B2B,yCAAsB,GAAG,GAAG,AAAN,CAAO"}
|
|
@@ -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
|
};
|
|
@@ -35,7 +26,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
35
26
|
/**
|
|
36
27
|
* Overrides BaseTransformation::transform
|
|
37
28
|
*/
|
|
38
|
-
this.transform = (data) =>
|
|
29
|
+
this.transform = async (data) => {
|
|
39
30
|
let trips = new Map();
|
|
40
31
|
let stops = new Map();
|
|
41
32
|
let res = {
|
|
@@ -46,7 +37,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
46
37
|
if (!Array.isArray(data))
|
|
47
38
|
data = [data];
|
|
48
39
|
for (const element of data) {
|
|
49
|
-
const elemRes =
|
|
40
|
+
const elemRes = await this.transformElement(element);
|
|
50
41
|
if (elemRes) {
|
|
51
42
|
res.positions.push(elemRes.position);
|
|
52
43
|
trips.set(elemRes.trip.id, elemRes.trip);
|
|
@@ -58,14 +49,13 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
58
49
|
res.trips = Array.from(trips.values());
|
|
59
50
|
res.stops = Array.from(stops.values());
|
|
60
51
|
return res;
|
|
61
|
-
}
|
|
62
|
-
this.transformElement = (element) =>
|
|
63
|
-
var _a, _b;
|
|
52
|
+
};
|
|
53
|
+
this.transformElement = async (element) => {
|
|
64
54
|
const attributes = element.$;
|
|
65
55
|
// Trips with null cpoz (origin time) and falsy or "false" zrus (cancellation) attributes are excluded
|
|
66
56
|
let hasInvalidAttributes = !attributes.cpoz && (!attributes.zrus || attributes.zrus === "false");
|
|
67
57
|
// Canceled trips with no lat or lng are accepted because we try to later get the coords from the context if possible
|
|
68
|
-
hasInvalidAttributes
|
|
58
|
+
hasInvalidAttributes ||= attributes.zrus !== "true" && (!attributes.lat || !attributes.lng);
|
|
69
59
|
if (this.isBlacklistedAgency(attributes.dopr) || hasInvalidAttributes) {
|
|
70
60
|
return null;
|
|
71
61
|
}
|
|
@@ -73,7 +63,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
73
63
|
attributes.alias = attributes.alias || "none";
|
|
74
64
|
attributes.cpoz = attributes.cpoz || moment_timezone_1.default.tz("Europe/Prague").format(MpvMessageTransformation.ORIGIN_TIME_FORMAT);
|
|
75
65
|
const stops = element.zast;
|
|
76
|
-
const { startTimestamp, positionTimestamp } =
|
|
66
|
+
const { startTimestamp, positionTimestamp } = await this.deduceTimestamps(stops[0], attributes.cpoz);
|
|
77
67
|
// filter out position with future time (set to be far than 5 minutes from now)
|
|
78
68
|
if ((0, moment_timezone_1.default)(positionTimestamp).isAfter((0, moment_timezone_1.default)().add(5, "minutes"))) {
|
|
79
69
|
return null;
|
|
@@ -136,11 +126,11 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
136
126
|
cis_trip_number: parseInt(attributes.spoj, 10),
|
|
137
127
|
id: primaryKey,
|
|
138
128
|
is_canceled: attributes.zrus === "true",
|
|
139
|
-
origin_route_name:
|
|
129
|
+
origin_route_name: attributes.kmenl ?? null,
|
|
140
130
|
run_number: attributes.po !== undefined ? parseInt(attributes.po, 10) : null,
|
|
141
131
|
start_asw_stop_id: null,
|
|
142
132
|
start_cis_stop_id: stops[0].$.zast ? parseInt(stops[0].$.zast, 10) : null,
|
|
143
|
-
start_cis_stop_platform_code:
|
|
133
|
+
start_cis_stop_platform_code: stops[0].$.stan ?? null,
|
|
144
134
|
start_time: startTimestamp.tz("Europe/Prague").format("HH:mm"),
|
|
145
135
|
start_timestamp: startTimestamp.toDate(),
|
|
146
136
|
vehicle_registration_number: attributes.vuzevc ? parseInt(attributes.vuzevc, 10) : null,
|
|
@@ -170,7 +160,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
170
160
|
}
|
|
171
161
|
}
|
|
172
162
|
return res;
|
|
173
|
-
}
|
|
163
|
+
};
|
|
174
164
|
/**
|
|
175
165
|
* Deduce UTC timestamp of start of trip and UTC timestamp of current position
|
|
176
166
|
*
|
|
@@ -178,7 +168,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
178
168
|
* @param {string} positionTimestampXML - XML attribute of local timestamp of position (HH:mm:ss)
|
|
179
169
|
* @returns {{ startTimestamp: Moment; positionTimestamp: Moment }}
|
|
180
170
|
*/
|
|
181
|
-
this.deduceTimestamps = (firstStopXML, positionTimestampXML) =>
|
|
171
|
+
this.deduceTimestamps = async (firstStopXML, positionTimestampXML) => {
|
|
182
172
|
const now = moment_timezone_1.default.tz("Europe/Prague");
|
|
183
173
|
let isOverMidnight = 0;
|
|
184
174
|
// creating startDate and timestamp from zast[0].prij and cpoz
|
|
@@ -204,7 +194,7 @@ class MpvMessageTransformation extends transformations_1.BaseTransformation {
|
|
|
204
194
|
startTimestamp,
|
|
205
195
|
positionTimestamp,
|
|
206
196
|
};
|
|
207
|
-
}
|
|
197
|
+
};
|
|
208
198
|
/**
|
|
209
199
|
* Returns -1 if start hour is 12-23 and now is 0-12, 1 if start hour is 18-23 and now 0-6, else 0
|
|
210
200
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MpvMessageTransformation.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MpvMessageTransformation.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.ts"],"names":[],"mappings":";;;;;;AAAA,2FAA0D;AAG1D,wEAAqE;AACrE,qEAA0F;AAC1F,2FAA4G;AAC5G,gGAA2E;AAC3E,gDAAgE;AAChE,mEAA2C;AAC3C,8EAA2E;AAC3E,oEAAiE;AAGjE,0EAA4D;AAE5D,IAAK,oBAGJ;AAHD,WAAK,oBAAoB;IACrB,0CAAkB,CAAA;IAClB,sCAAc,CAAA;AAClB,CAAC,EAHI,oBAAoB,KAApB,oBAAo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MAAM,EAAE,EAAE,CAAC,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;QAC7F,OAAO,mBAAmB,GAAG,GAAG,GAAG,mBAAmB,CAAC;IAC3D,CAAC;;AA1QL,4DA2QC;AA1QkB,2CAAkB,GAAG,UAAU,AAAb,CAAc"}
|
|
@@ -15,7 +15,6 @@ let PublicApiTripTransformation = exports.PublicApiTripTransformation = class Pu
|
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.name = "PublicApiTripTransformation";
|
|
17
17
|
this.transformInternal = (data) => {
|
|
18
|
-
var _a, _b;
|
|
19
18
|
return {
|
|
20
19
|
gtfs_trip_id: data.gtfs_trip_id,
|
|
21
20
|
route_type: data.gtfs_route_type,
|
|
@@ -31,12 +30,12 @@ let PublicApiTripTransformation = exports.PublicApiTripTransformation = class Pu
|
|
|
31
30
|
origin_route_name: data.origin_route_name,
|
|
32
31
|
shape_id: data.gtfs_shape_id,
|
|
33
32
|
run_number: data.run_number,
|
|
34
|
-
trip_headsign:
|
|
33
|
+
trip_headsign: data.last_stop_headsign ?? data.gtfs_trip_headsign,
|
|
35
34
|
shape_dist_traveled: data.shape_dist_traveled === null ? null : Number.parseFloat(data.shape_dist_traveled),
|
|
36
35
|
last_stop_sequence: data.last_stop_sequence,
|
|
37
36
|
origin_timestamp: data.origin_timestamp.toISOString(),
|
|
38
37
|
registration_number: data.vehicle_registration_number,
|
|
39
|
-
operator:
|
|
38
|
+
operator: data.agency_name_real ?? data.agency_name_scheduled,
|
|
40
39
|
},
|
|
41
40
|
};
|
|
42
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicApiTripTransformation.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,iFAA8E;AAOvE,IAAM,2BAA2B,yCAAjC,MAAM,2BAA4B,SAAQ,+CAAiD;IAA3F;;QACI,SAAI,GAAG,6BAA6B,CAAC;QAElC,sBAAiB,GAAG,CAAC,IAAiB,EAAgB,EAAE
|
|
1
|
+
{"version":3,"file":"PublicApiTripTransformation.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,iFAA8E;AAOvE,IAAM,2BAA2B,yCAAjC,MAAM,2BAA4B,SAAQ,+CAAiD;IAA3F;;QACI,SAAI,GAAG,6BAA6B,CAAC;QAElC,sBAAiB,GAAG,CAAC,IAAiB,EAAgB,EAAE;YAC9D,OAAO;gBACH,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,UAAU,EAAE,IAAI,CAAC,eAAe;gBAChC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;gBACjD,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;gBAChC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;gBAChC,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,UAAU,EAAE,uCAAkB,CAAC,YAAY,CACvC,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,2BAA2B,EAChC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,mBAAmB,CAC3B;gBACD,aAAa,EAAE;oBACX,wBAAwB,EAAE,IAAI,CAAC,qBAAqB;oBACpD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;oBACzC,QAAQ,EAAE,IAAI,CAAC,aAAa;oBAC5B,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3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