@golemio/pid 2.17.0 → 2.17.1-dev.1412857437
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/db/example/00_clear_test_data.sql +2 -0
- package/db/example/03_ropidgtfs_dump.sql +36 -0
- package/db/example/20_jis_infotexts.sql +214 -0
- package/db/migrations/postgresql/20240801141948-jis-infotexts.js +53 -0
- package/db/migrations/postgresql/20240808123947-filter-null-island.js +53 -0
- package/db/migrations/postgresql/20240809084521-jis-infotexts-severity-level.js +53 -0
- package/db/migrations/postgresql/sqls/20240801141948-jis-infotexts-down.sql +2 -0
- package/db/migrations/postgresql/sqls/20240801141948-jis-infotexts-up.sql +19 -0
- package/db/migrations/postgresql/sqls/20240808123947-filter-null-island-down.sql +53 -0
- package/db/migrations/postgresql/sqls/20240808123947-filter-null-island-up.sql +55 -0
- package/db/migrations/postgresql/sqls/20240809084521-jis-infotexts-severity-level-down.sql +8 -0
- package/db/migrations/postgresql/sqls/20240809084521-jis-infotexts-severity-level-up.sql +7 -0
- package/dist/integration-engine/index.js +4 -0
- package/dist/integration-engine/index.js.map +1 -1
- package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.d.ts +10 -0
- package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js +49 -0
- package/dist/integration-engine/jis/datasources/JISInfotextsDataSourceFactory.js.map +1 -0
- package/dist/integration-engine/jis/index.d.ts +1 -0
- package/dist/{output-gateway/pid/controllers → integration-engine/jis}/index.js +1 -2
- package/dist/integration-engine/jis/index.js.map +1 -0
- package/dist/integration-engine/jis/ioc/Di.d.ts +3 -0
- package/dist/integration-engine/jis/ioc/Di.js +31 -0
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +9 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +18 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +36 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +101 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.d.ts +36 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js +101 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map +1 -0
- package/dist/integration-engine/jis/services/JISInfotextsDataService.d.ts +20 -0
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js +78 -0
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -0
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.d.ts +13 -0
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js +41 -0
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js.map +1 -0
- package/dist/integration-engine/jis/workers/JISWorker.d.ts +7 -0
- package/dist/integration-engine/jis/workers/JISWorker.js +21 -0
- package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -0
- package/dist/integration-engine/jis/workers/constants.d.ts +1 -0
- package/dist/integration-engine/jis/workers/constants.js +5 -0
- package/dist/integration-engine/jis/workers/constants.js.map +1 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +14 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +72 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/helpers/RawQueryProvider.d.ts +3 -0
- package/dist/integration-engine/ropid-gtfs/data-access/helpers/RawQueryProvider.js +62 -0
- package/dist/integration-engine/ropid-gtfs/data-access/helpers/RawQueryProvider.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts +2 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +21 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/interfaces/TripScheduleInterfaces.d.ts +22 -0
- package/dist/integration-engine/ropid-gtfs/interfaces/TripScheduleInterfaces.js +3 -0
- package/dist/integration-engine/ropid-gtfs/interfaces/TripScheduleInterfaces.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.d.ts +1 -4
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js +11 -27
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +34 -51
- 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/helpers/RawQueryProvider.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js +1 -80
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/interfaces/TripRepositoryInterfaces.d.ts +0 -17
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +19 -11
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js +1 -1
- 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/transformations/MpvMessageTransformation.d.ts +3 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js +8 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js.map +1 -1
- package/dist/output-gateway/departure-boards/index.d.ts +1 -1
- package/dist/output-gateway/departure-boards/index.js +1 -1
- package/dist/output-gateway/departure-boards/index.js.map +1 -1
- package/dist/output-gateway/departure-boards/routers/index.d.ts +1 -0
- package/dist/output-gateway/departure-boards/routers/index.js +6 -0
- package/dist/output-gateway/departure-boards/routers/index.js.map +1 -0
- package/dist/output-gateway/departure-boards/{DepartureBoardsRouter.d.ts → routers/v2/V2DepartureBoardsRouter.d.ts} +9 -8
- package/dist/output-gateway/departure-boards/{DepartureBoardsRouter.js → routers/v2/V2DepartureBoardsRouter.js} +19 -18
- package/dist/output-gateway/departure-boards/routers/v2/V2DepartureBoardsRouter.js.map +1 -0
- package/dist/output-gateway/index.d.ts +1 -0
- package/dist/output-gateway/index.js +25 -1
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/pid/controllers/{DepartureBoardsController.d.ts → v2/V2DepartureBoardsController.d.ts} +1 -1
- package/dist/output-gateway/pid/controllers/{DepartureBoardsController.js → v2/V2DepartureBoardsController.js} +9 -9
- package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js.map +1 -0
- package/dist/output-gateway/pid/controllers/{InfotextsController.d.ts → v2/V2InfotextsController.d.ts} +1 -1
- package/dist/output-gateway/pid/controllers/{InfotextsController.js → v2/V2InfotextsController.js} +6 -6
- package/dist/output-gateway/pid/controllers/v2/V2InfotextsController.js.map +1 -0
- package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.d.ts +10 -0
- package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js +57 -0
- package/dist/output-gateway/pid/controllers/v3/V3InfotextsController.js.map +1 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRepository.d.ts +27 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRepository.js +157 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRepository.js.map +1 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRopidGTFSStopsRepository.d.ts +11 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRopidGTFSStopsRepository.js +37 -0
- package/dist/output-gateway/pid/data-access/JISInfotextRopidGTFSStopsRepository.js.map +1 -0
- package/dist/output-gateway/pid/domain/InfotextDisplayTypeEnum.d.ts +4 -0
- package/dist/output-gateway/pid/domain/InfotextDisplayTypeEnum.js +9 -0
- package/dist/output-gateway/pid/domain/InfotextDisplayTypeEnum.js.map +1 -0
- package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +28 -0
- package/dist/output-gateway/pid/domain/InfotextInterfaces.js +3 -0
- package/dist/output-gateway/pid/domain/InfotextInterfaces.js.map +1 -0
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.d.ts +3 -3
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js +1 -1
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +1 -1
- package/dist/output-gateway/pid/index.js +1 -1
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/ioc/Di.d.ts +3 -0
- package/dist/output-gateway/pid/ioc/Di.js +23 -0
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +7 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js +17 -0
- package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -0
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.d.ts +2 -1
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +20 -10
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.d.ts +2 -19
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js +4 -64
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js.map +1 -1
- package/dist/output-gateway/pid/routers/index.d.ts +2 -0
- package/dist/output-gateway/pid/routers/index.js +8 -0
- package/dist/output-gateway/pid/routers/index.js.map +1 -0
- package/dist/output-gateway/pid/{PIDRouter.d.ts → routers/v2/V2PIDRouter.d.ts} +5 -4
- package/dist/output-gateway/pid/{PIDRouter.js → routers/v2/V2PIDRouter.js} +20 -17
- package/dist/output-gateway/pid/routers/v2/V2PIDRouter.js.map +1 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.d.ts +11 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js +31 -0
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js.map +1 -0
- package/dist/output-gateway/pid/service/helpers/DisplayTypeMapper.d.ts +10 -0
- package/dist/output-gateway/pid/service/helpers/DisplayTypeMapper.js +25 -0
- package/dist/output-gateway/pid/service/helpers/DisplayTypeMapper.js.map +1 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.d.ts +13 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js +35 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextDepartureTransformation.js.map +1 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.d.ts +19 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js +43 -0
- package/dist/output-gateway/pid/service/transformations/JISInfotextOverviewTransformation.js.map +1 -0
- package/dist/output-gateway/public/controllers/{v1/PublicDepartureBoardsController.d.ts → v2/V2PublicDepartureBoardsController.d.ts} +1 -1
- package/dist/output-gateway/public/controllers/{v1/PublicDepartureBoardsController.js → v2/V2PublicDepartureBoardsController.js} +5 -5
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js.map +1 -0
- package/dist/output-gateway/public/controllers/{v1/PublicGtfsController.d.ts → v2/V2PublicGtfsController.d.ts} +1 -1
- package/dist/output-gateway/public/controllers/{v1/PublicGtfsController.js → v2/V2PublicGtfsController.js} +5 -5
- package/dist/output-gateway/public/controllers/v2/V2PublicGtfsController.js.map +1 -0
- package/dist/output-gateway/public/controllers/{v1/PublicVehiclePositionsController.d.ts → v2/V2PublicVehiclePositionsController.d.ts} +1 -1
- package/dist/output-gateway/public/controllers/{v1/PublicVehiclePositionsController.js → v2/V2PublicVehiclePositionsController.js} +4 -4
- package/dist/output-gateway/public/controllers/v2/V2PublicVehiclePositionsController.js.map +1 -0
- package/dist/output-gateway/public/controllers/{v1 → v2}/interfaces/PublicParamsInterfaces.d.ts +1 -1
- package/dist/output-gateway/public/controllers/{v1 → v2}/interfaces/PublicParamsInterfaces.js.map +1 -1
- package/dist/output-gateway/public/index.d.ts +1 -0
- package/dist/output-gateway/public/index.js +18 -0
- package/dist/output-gateway/public/index.js.map +1 -0
- package/dist/output-gateway/public/routers/index.d.ts +3 -0
- package/dist/output-gateway/public/routers/index.js +10 -0
- package/dist/output-gateway/public/routers/index.js.map +1 -0
- package/dist/output-gateway/public/routers/{v1/PublicDeparturesRouter.d.ts → v2/V2PublicDeparturesRouter.d.ts} +4 -3
- package/dist/output-gateway/public/routers/{v1/PublicDeparturesRouter.js → v2/V2PublicDeparturesRouter.js} +11 -8
- package/dist/output-gateway/public/routers/v2/V2PublicDeparturesRouter.js.map +1 -0
- package/dist/output-gateway/public/routers/{v1/PublicGtfsRouter.d.ts → v2/V2PublicGtfsRouter.d.ts} +4 -3
- package/dist/output-gateway/public/routers/{v1/PublicGtfsRouter.js → v2/V2PublicGtfsRouter.js} +11 -8
- package/dist/output-gateway/public/routers/v2/V2PublicGtfsRouter.js.map +1 -0
- package/dist/output-gateway/public/routers/{v1/PublicVehiclePositionsRouter.d.ts → v2/V2PublicVehiclePositionsRouter.d.ts} +4 -3
- package/dist/output-gateway/public/routers/{v1/PublicVehiclePositionsRouter.js → v2/V2PublicVehiclePositionsRouter.js} +11 -8
- package/dist/output-gateway/public/routers/v2/V2PublicVehiclePositionsRouter.js.map +1 -0
- package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomScopeValidator.js.map +1 -1
- package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomStopIdGroupValidator.js.map +1 -1
- package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomTypeValidator.js.map +1 -1
- package/dist/output-gateway/public/routers/{v1 → v2}/helpers/DetailedTripScopeEnum.js.map +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.d.ts +1 -1
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.d.ts +1 -1
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.js +1 -1
- package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.d.ts +1 -1
- package/dist/output-gateway/public/service/facade/GtfsTripLookupFacade.js +1 -1
- package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/GtfsTripScopeHandlerFactory.d.ts +1 -1
- package/dist/output-gateway/public/service/helpers/gtfs-trip-scope/GtfsTripScopeHandlerFactory.js +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/TripScopeHandlerFactory.d.ts +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/TripScopeHandlerFactory.js +1 -1
- package/dist/output-gateway/ropid-gtfs/index.d.ts +1 -1
- package/dist/output-gateway/ropid-gtfs/index.js +1 -1
- package/dist/output-gateway/ropid-gtfs/index.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/routers/index.d.ts +1 -0
- package/dist/output-gateway/ropid-gtfs/routers/index.js +6 -0
- package/dist/output-gateway/ropid-gtfs/routers/index.js.map +1 -0
- package/dist/output-gateway/ropid-gtfs/{GTFSRouter.d.ts → routers/v2/V2GTFSRouter.d.ts} +11 -13
- package/dist/output-gateway/ropid-gtfs/{GTFSRouter.js → routers/v2/V2GTFSRouter.js} +16 -16
- package/dist/output-gateway/ropid-gtfs/routers/v2/V2GTFSRouter.js.map +1 -0
- package/dist/output-gateway/shared/RopidRouterUtils.d.ts +4 -0
- package/dist/output-gateway/shared/RopidRouterUtils.js +11 -0
- package/dist/output-gateway/shared/RopidRouterUtils.js.map +1 -1
- package/dist/output-gateway/shared/constants/index.d.ts +1 -0
- package/dist/output-gateway/shared/constants/index.js +1 -0
- package/dist/output-gateway/shared/constants/index.js.map +1 -1
- package/dist/output-gateway/shared/constants/route-version.d.ts +5 -0
- package/dist/output-gateway/shared/constants/route-version.js +10 -0
- package/dist/output-gateway/shared/constants/route-version.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js +0 -2
- package/dist/output-gateway/vehicle-positions/data-access/views/TripWithLastPositionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/index.d.ts +1 -1
- package/dist/output-gateway/vehicle-positions/index.js +1 -1
- package/dist/output-gateway/vehicle-positions/index.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/routers/index.d.ts +1 -0
- package/dist/output-gateway/vehicle-positions/routers/index.js +6 -0
- package/dist/output-gateway/vehicle-positions/routers/index.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/{VehiclePositionsRouter.d.ts → routers/v2/V2VehiclePositionsRouter.d.ts} +6 -6
- package/dist/output-gateway/vehicle-positions/{VehiclePositionsRouter.js → routers/v2/V2VehiclePositionsRouter.js} +12 -11
- package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.d.ts +3 -0
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js +59 -0
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotext.d.ts +16 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotext.js +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotext.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextStop.d.ts +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextStop.js +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextStop.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISTranslationText.d.ts +4 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISTranslationText.js +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISTranslationText.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.d.ts +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.js +20 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.js.map +1 -0
- package/dist/schema-definitions/jis/models/JISInfotextsModel.d.ts +19 -0
- package/dist/schema-definitions/jis/models/JISInfotextsModel.js +80 -0
- package/dist/schema-definitions/jis/models/JISInfotextsModel.js.map +1 -0
- package/dist/schema-definitions/jis/models/JISInfotextsRopidGTFSStopsModel.d.ts +12 -0
- package/dist/schema-definitions/jis/models/JISInfotextsRopidGTFSStopsModel.js +41 -0
- package/dist/schema-definitions/jis/models/JISInfotextsRopidGTFSStopsModel.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotext.d.ts +10 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotext.js +3 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotext.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsRopidGTFSStops.d.ts +4 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsRopidGTFSStops.js +3 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsRopidGTFSStops.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISTranslationText.d.ts +4 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISTranslationText.js +3 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISTranslationText.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/index.d.ts +3 -0
- package/dist/schema-definitions/jis/models/interfaces/index.js +20 -0
- package/dist/schema-definitions/jis/models/interfaces/index.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +6 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.d.ts +2 -0
- package/docs/assets/pid_jis_erd.png +0 -0
- package/docs/implementation_documentation.md +86 -35
- package/docs/openapi-output.yaml +128 -69
- package/package.json +2 -2
- package/dist/output-gateway/departure-boards/DepartureBoardsRouter.js.map +0 -1
- package/dist/output-gateway/pid/PIDRouter.js.map +0 -1
- package/dist/output-gateway/pid/controllers/DepartureBoardsController.js.map +0 -1
- package/dist/output-gateway/pid/controllers/InfotextsController.js.map +0 -1
- package/dist/output-gateway/pid/controllers/index.d.ts +0 -2
- package/dist/output-gateway/pid/controllers/index.js.map +0 -1
- package/dist/output-gateway/public/controllers/v1/PublicDepartureBoardsController.js.map +0 -1
- package/dist/output-gateway/public/controllers/v1/PublicGtfsController.js.map +0 -1
- package/dist/output-gateway/public/controllers/v1/PublicVehiclePositionsController.js.map +0 -1
- package/dist/output-gateway/public/routers/v1/PublicDeparturesRouter.js.map +0 -1
- package/dist/output-gateway/public/routers/v1/PublicGtfsRouter.js.map +0 -1
- package/dist/output-gateway/public/routers/v1/PublicVehiclePositionsRouter.js.map +0 -1
- package/dist/output-gateway/ropid-gtfs/GTFSRouter.js.map +0 -1
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js.map +0 -1
- /package/dist/output-gateway/public/controllers/{v1 → v2}/interfaces/PublicParamsInterfaces.js +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomScopeValidator.d.ts +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomScopeValidator.js +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomStopIdGroupValidator.d.ts +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomStopIdGroupValidator.js +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomTypeValidator.d.ts +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/CustomTypeValidator.js +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/DetailedTripScopeEnum.d.ts +0 -0
- /package/dist/output-gateway/public/routers/{v1 → v2}/helpers/DetailedTripScopeEnum.js +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JISWorker = void 0;
|
|
4
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
5
|
+
const Di_1 = require("../ioc/Di");
|
|
6
|
+
const JISContainerToken_1 = require("../ioc/JISContainerToken");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
class JISWorker extends workers_1.AbstractWorker {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.name = constants_1.JIS_WORKER_NAME.toLowerCase();
|
|
12
|
+
this.registerTask = (task) => {
|
|
13
|
+
super.registerTask(task);
|
|
14
|
+
task.queuePrefix = this.getQueuePrefix();
|
|
15
|
+
};
|
|
16
|
+
// Register tasks
|
|
17
|
+
this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.JISWorker = JISWorker;
|
|
21
|
+
//# sourceMappingURL=JISWorker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAG9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QASxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAPE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAChH,CAAC;CAMJ;AAdD,8BAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const JIS_WORKER_NAME = "jis";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
|
|
2
|
+
import { JISInfotextsDataService } from "../../services/JISInfotextsDataService";
|
|
3
|
+
import { JISInfotextsTransformation } from "../../transformations/JISInfotextsTransformation";
|
|
4
|
+
import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
|
|
5
|
+
export declare class RefreshJISInfotextsTask extends AbstractEmptyTask {
|
|
6
|
+
private dataSourceFactory;
|
|
7
|
+
private infotextsDataService;
|
|
8
|
+
private infotextsTransformation;
|
|
9
|
+
readonly queueName = "refreshJISInfotexts";
|
|
10
|
+
readonly queueTtl: number;
|
|
11
|
+
constructor(dataSourceFactory: JISInfotextsDataSourceFactory, infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation);
|
|
12
|
+
protected execute(): Promise<void>;
|
|
13
|
+
private getEntitiesFromTransformationResult;
|
|
14
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RefreshJISInfotextsTask = void 0;
|
|
25
|
+
const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
|
|
26
|
+
const JISContainerToken_1 = require("../../ioc/JISContainerToken");
|
|
27
|
+
const JISInfotextsDataService_1 = require("../../services/JISInfotextsDataService");
|
|
28
|
+
const JISInfotextsTransformation_1 = require("../../transformations/JISInfotextsTransformation");
|
|
29
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
30
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
31
|
+
const constants_1 = require("../constants");
|
|
32
|
+
let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
|
|
33
|
+
constructor(dataSourceFactory, infotextsDataService, infotextsTransformation) {
|
|
34
|
+
super(constants_1.JIS_WORKER_NAME.toLowerCase());
|
|
35
|
+
this.dataSourceFactory = dataSourceFactory;
|
|
36
|
+
this.infotextsDataService = infotextsDataService;
|
|
37
|
+
this.infotextsTransformation = infotextsTransformation;
|
|
38
|
+
this.queueName = "refreshJISInfotexts";
|
|
39
|
+
this.queueTtl = 1 * 60 * 1000; // 1 minute;
|
|
40
|
+
}
|
|
41
|
+
execute() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const dataSource = this.dataSourceFactory.getDataSource();
|
|
44
|
+
const data = yield dataSource.getAll();
|
|
45
|
+
const transformedData = yield this.infotextsTransformation.transformArray(data);
|
|
46
|
+
const { infotexts, infotextsRopidGTFSStops } = this.getEntitiesFromTransformationResult(transformedData);
|
|
47
|
+
yield this.infotextsDataService.refreshData(infotexts, infotextsRopidGTFSStops);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getEntitiesFromTransformationResult(transformedData) {
|
|
51
|
+
const infotextEntities = [];
|
|
52
|
+
const infotextsRopidGTFSStopsEntities = [];
|
|
53
|
+
for (const { infotext, infotextsRopidGTFSStops } of transformedData) {
|
|
54
|
+
infotextEntities.push(infotext);
|
|
55
|
+
infotextsRopidGTFSStopsEntities.push(...infotextsRopidGTFSStops);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
infotexts: infotextEntities,
|
|
59
|
+
infotextsRopidGTFSStops: infotextsRopidGTFSStopsEntities,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.RefreshJISInfotextsTask = RefreshJISInfotextsTask = __decorate([
|
|
64
|
+
(0, tsyringe_1.injectable)(),
|
|
65
|
+
__param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
|
|
66
|
+
__param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
|
|
67
|
+
__param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation)),
|
|
68
|
+
__metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory,
|
|
69
|
+
JISInfotextsDataService_1.JISInfotextsDataService,
|
|
70
|
+
JISInfotextsTransformation_1.JISInfotextsTransformation])
|
|
71
|
+
], RefreshJISInfotextsTask);
|
|
72
|
+
//# sourceMappingURL=RefreshJISInfotextsTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAAkG;AAClG,mEAAkE;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,8EAA0E;AAC1E,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,sCAAiB;IAI1D,YAEI,iBAAwD,EAExD,oBAAqD,EAErD,uBAA2D;QAE3D,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAN7B,sBAAiB,GAAjB,iBAAiB,CAA+B;QAEhD,yBAAoB,GAApB,oBAAoB,CAAyB;QAE7C,4BAAuB,GAAvB,uBAAuB,CAA4B;QAT/C,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;IAWtD,CAAC;IAEe,OAAO;;YACnB,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;YAC1D,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;YACvC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAChF,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC,mCAAmC,CAAC,eAAe,CAAC,CAAC;YACzG,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACpF,CAAC;KAAA;IAEO,mCAAmC,CAAC,eAAyE;QACjH,MAAM,gBAAgB,GAAmB,EAAE,CAAC;QAC5C,MAAM,+BAA+B,GAAkC,EAAE,CAAC;QAC1E,KAAK,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE,IAAI,eAAe,EAAE;YACjE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,+BAA+B,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,CAAC;SACpE;QACD,OAAO;YACH,SAAS,EAAE,gBAAgB;YAC3B,uBAAuB,EAAE,+BAA+B;SAC3D,CAAC;IACN,CAAC;CACJ,CAAA;kCAnCY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,6BAA6B,CAAC,CAAA;IAEvD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;qCAH1B,6DAA6B;QAE1B,iDAAuB;QAEpB,uDAA0B;GAVtD,uBAAuB,CAmCnC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RawQueryProvider = void 0;
|
|
4
|
+
const const_1 = require("../../../../schema-definitions/const");
|
|
5
|
+
class RawQueryProvider {
|
|
6
|
+
static getFindGtfsCommonTripsQuery() {
|
|
7
|
+
/* eslint-disable max-len */
|
|
8
|
+
return `
|
|
9
|
+
set local search_path to ${const_1.PG_SCHEMA};
|
|
10
|
+
with trip_schedule as (
|
|
11
|
+
select
|
|
12
|
+
block_id,
|
|
13
|
+
trip_id
|
|
14
|
+
from
|
|
15
|
+
ropidgtfs_precomputed_trip_schedule
|
|
16
|
+
where
|
|
17
|
+
route_licence_number = :routeLicenceNumber
|
|
18
|
+
and (case when :tripNumber::int is null then trip_number is null else trip_number = :tripNumber::int end)
|
|
19
|
+
and start_timestamp::date = :startTimestamp::date
|
|
20
|
+
),
|
|
21
|
+
trip_ids as (
|
|
22
|
+
select
|
|
23
|
+
array_agg(trip.trip_id) as trip_ids
|
|
24
|
+
from
|
|
25
|
+
ropidgtfs_trips as trip
|
|
26
|
+
cross join
|
|
27
|
+
trip_schedule
|
|
28
|
+
where
|
|
29
|
+
trip.block_id = trip_schedule.block_id
|
|
30
|
+
or (trip_schedule.block_id is null and trip.trip_id = trip_schedule.trip_id)
|
|
31
|
+
)
|
|
32
|
+
select distinct on (ord)
|
|
33
|
+
trip_id as gtfs_trip_id,
|
|
34
|
+
trip_headsign as gtfs_trip_headsign,
|
|
35
|
+
route_id as gtfs_route_id,
|
|
36
|
+
route_short_name as gtfs_route_short_name,
|
|
37
|
+
direction_id as gtfs_direction_id,
|
|
38
|
+
shape_id as gtfs_shape_id,
|
|
39
|
+
min_stop_time::varchar as min_stop_time,
|
|
40
|
+
max_stop_time::varchar as max_stop_time,
|
|
41
|
+
block_id as gtfs_block_id,
|
|
42
|
+
trip_short_name as gtfs_trip_short_name,
|
|
43
|
+
route_type as gtfs_route_type,
|
|
44
|
+
trip_number as cis_trip_number,
|
|
45
|
+
run_number as internal_run_number,
|
|
46
|
+
origin_route_name as internal_route_name
|
|
47
|
+
from
|
|
48
|
+
ropidgtfs_precomputed_trip_schedule trip_schedule
|
|
49
|
+
cross join
|
|
50
|
+
trip_ids
|
|
51
|
+
join
|
|
52
|
+
unnest(trip_ids) with ordinality t(trip_id, ord) using (trip_id)
|
|
53
|
+
where
|
|
54
|
+
start_timestamp >= :startTimestamp::timestamptz
|
|
55
|
+
and start_timestamp < :startTimestamp::timestamptz + interval '12 hours'
|
|
56
|
+
order by ord, start_timestamp asc;
|
|
57
|
+
`;
|
|
58
|
+
/* eslint-enable max-len */
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.RawQueryProvider = RawQueryProvider;
|
|
62
|
+
//# sourceMappingURL=RawQueryProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RawQueryProvider.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/helpers/RawQueryProvider.ts"],"names":[],"mappings":";;;AAAA,gEAAuC;AAEvC,MAAa,gBAAgB;IAClB,MAAM,CAAC,2BAA2B;QACrC,4BAA4B;QAC5B,OAAO;uCACwB,iBAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgDvC,CAAC;QACF,2BAA2B;IAC/B,CAAC;CACJ;AAvDD,4CAuDC"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ILookupTripSchedule, ILookupTripScheduleInput } from "../../interfaces/TripScheduleInterfaces";
|
|
1
2
|
import { IScheduleDto } from "../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
|
|
2
3
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
3
4
|
import { FindOptions } from "@golemio/core/dist/shared/sequelize";
|
|
@@ -6,4 +7,5 @@ export declare class TripScheduleRepository extends PostgresModel implements IMo
|
|
|
6
7
|
constructor();
|
|
7
8
|
findAll: (options: FindOptions) => Promise<IScheduleDto[]>;
|
|
8
9
|
populate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
10
|
+
findTripsByRouteAndTripNumber: (trip: ILookupTripScheduleInput) => Promise<ILookupTripSchedule[]>;
|
|
9
11
|
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js
CHANGED
|
@@ -14,8 +14,11 @@ const const_1 = require("../../../../schema-definitions/const");
|
|
|
14
14
|
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
15
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
16
16
|
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
17
18
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
19
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
18
20
|
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
21
|
+
const RawQueryProvider_1 = require("../helpers/RawQueryProvider");
|
|
19
22
|
class TripScheduleRepository extends models_1.PostgresModel {
|
|
20
23
|
constructor() {
|
|
21
24
|
super("TripScheduleRepository", {
|
|
@@ -105,6 +108,24 @@ class TripScheduleRepository extends models_1.PostgresModel {
|
|
|
105
108
|
throw err;
|
|
106
109
|
}
|
|
107
110
|
});
|
|
111
|
+
this.findTripsByRouteAndTripNumber = (trip) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const connection = this.sequelizeModel.sequelize;
|
|
113
|
+
const sqlQuery = RawQueryProvider_1.RawQueryProvider.getFindGtfsCommonTripsQuery();
|
|
114
|
+
try {
|
|
115
|
+
return yield connection.query(sqlQuery, {
|
|
116
|
+
type: sequelize_1.QueryTypes.SELECT,
|
|
117
|
+
replacements: {
|
|
118
|
+
routeLicenceNumber: trip.routeLicenseNumber,
|
|
119
|
+
tripNumber: trip.tripNumber,
|
|
120
|
+
startTimestamp: trip.startTimestamp,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
// Explicit module name is needed here for the error to be properly logged by the custom logger
|
|
126
|
+
throw new golemio_errors_1.GeneralError("Failed to find trips by route and trip number", this.constructor.name, err, undefined, "pid");
|
|
127
|
+
}
|
|
128
|
+
});
|
|
108
129
|
}
|
|
109
130
|
}
|
|
110
131
|
exports.TripScheduleRepository = TripScheduleRepository;
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gEAAuC;AACvC,0EAA4C;AAE5C,2EAAoE;AACpE,yEAAqF;AACrF,6EAAwE;AACxE,mFAAkF;AAClF,mEAA8E;AAC9E,+EAA4E;AAC5E,kEAA+D;AAE/D,MAAa,sBAAuB,SAAQ,sBAAa;IACrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,sBAAS,CAAC,YAAY,CAAC,yBAAyB;YAC3E,WAAW,EAAE,sBAAS,CAAC,YAAY,CAAC,WAAW;YAC/C,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,sBAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CACtG,CAAC;QAGC,YAAO,GAAG,CAAC,OAAoB,EAA2B,EAAE;YAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,iBAAG,GAAG,EAAE,IAAI,IAAK,OAAO,EAAG,CAAC;QAClE,CAAC,CAAC;QAEK,aAAQ,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YAChF,4BAA4B;YAC5B,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqDI,iBAAS,0BAA0B,iBAAiB;8BAC9C,iBAAS;8BACT,iBAAS;6BACV,iBAAS,oBAAoB,iBAAiB;6BAC9C,iBAAS,qBAAqB,iBAAiB;6BAC/C,iBAAS,yBAAyB,iBAAiB;6BACnD,iBAAS,yBAAyB,iBAAiB;;SAEvE,CAAC;YACF,2BAA2B;YAE3B,IAAI;gBACA,MAAM,QAAQ,GAAG,sBAAS,CAAC,YAAY,CAAC,WAAW,GAAG,6CAAqB,CAAC,GAAG,CAAC;gBAEhF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC;2CACZ,iBAAS;+BACrB,QAAQ,KAAK,GAAG;aAClC,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAEK,kCAA6B,GAAG,CAAO,IAA8B,EAAkC,EAAE;YAC5G,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC;YAClD,MAAM,QAAQ,GAAG,mCAAgB,CAAC,2BAA2B,EAAE,CAAC;YAEhE,IAAI;gBACA,OAAO,MAAM,UAAU,CAAC,KAAK,CAAsB,QAAQ,EAAE;oBACzD,IAAI,EAAE,sBAAU,CAAC,MAAM;oBACvB,YAAY,EAAE;wBACV,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;wBAC3C,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;qBACtC;iBACJ,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,+FAA+F;gBAC/F,MAAM,IAAI,6BAAY,CAAC,+CAA+C,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;aACzH;QACL,CAAC,CAAA,CAAC;IAtGF,CAAC;CAuGJ;AApHD,wDAoHC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ILookupTripScheduleInput {
|
|
2
|
+
routeLicenseNumber: string | null;
|
|
3
|
+
tripNumber: number | null;
|
|
4
|
+
startTimestamp: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ILookupTripSchedule {
|
|
7
|
+
id?: string;
|
|
8
|
+
gtfs_trip_id: string;
|
|
9
|
+
gtfs_trip_headsign: string;
|
|
10
|
+
gtfs_route_id: string;
|
|
11
|
+
gtfs_route_short_name: string;
|
|
12
|
+
gtfs_direction_id: number;
|
|
13
|
+
gtfs_shape_id: string;
|
|
14
|
+
min_stop_time: string;
|
|
15
|
+
max_stop_time: string;
|
|
16
|
+
gtfs_block_id?: string;
|
|
17
|
+
gtfs_trip_short_name?: string;
|
|
18
|
+
gtfs_route_type?: number;
|
|
19
|
+
cis_trip_number?: number;
|
|
20
|
+
internal_run_number?: number;
|
|
21
|
+
internal_route_name?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TripScheduleInterfaces.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/interfaces/TripScheduleInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { IRegionalBusRunsMessagesModel } from "../../../../../../schema-definitions/vehicle-positions/models/interfaces/IRegionalBusRunsMessagesModel";
|
|
2
|
-
import { ISimpleConfig } from "@golemio/core/dist/helpers/configuration/ISimpleConfig";
|
|
3
2
|
import { ILogger } from "@golemio/core/dist/helpers/logger";
|
|
4
3
|
import { IRegionalBusMessageFilter } from "./interfaces/IRegionalBusMessageFilter";
|
|
5
4
|
import { TimestampValidator } from "../TimestampValidator";
|
|
6
5
|
export declare class RegionalBusMessageFilter implements IRegionalBusMessageFilter {
|
|
7
|
-
private config;
|
|
8
6
|
private logger;
|
|
9
7
|
private timestampValidator;
|
|
10
|
-
constructor(
|
|
8
|
+
constructor(logger: ILogger, timestampValidator: TimestampValidator);
|
|
11
9
|
/**
|
|
12
10
|
* Get messages that are valid for processing
|
|
13
11
|
*/
|
|
14
12
|
getFilteredMessages(messages: IRegionalBusRunsMessagesModel[], timestamp: number): IRegionalBusRunsMessagesModel[];
|
|
15
|
-
private get regNumberWhitelist();
|
|
16
13
|
}
|
|
@@ -19,8 +19,7 @@ const VPContainerToken_1 = require("../../../../ioc/VPContainerToken");
|
|
|
19
19
|
const TimestampValidator_1 = require("../TimestampValidator");
|
|
20
20
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
21
21
|
let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class RegionalBusMessageFilter {
|
|
22
|
-
constructor(
|
|
23
|
-
this.config = config;
|
|
22
|
+
constructor(logger, timestampValidator) {
|
|
24
23
|
this.logger = logger;
|
|
25
24
|
this.timestampValidator = timestampValidator;
|
|
26
25
|
}
|
|
@@ -30,18 +29,13 @@ let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class Regional
|
|
|
30
29
|
getFilteredMessages(messages, timestamp) {
|
|
31
30
|
let filteredMessages = [];
|
|
32
31
|
for (const message of messages) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!this.timestampValidator.isTimestampValid(timestamp, message.timestamp)) {
|
|
41
|
-
this.logger.error(new golemio_errors_1.GeneralError(`Message timestamp 'tm' of value ${message.timestamp} is not valid ` +
|
|
42
|
-
`(line ${message.cis_line_id}, trip id ${message.cis_trip_number})`, this.constructor.name, undefined, undefined, "pid"));
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
32
|
+
const isValidMessage = message.cis_line_id && message.cis_trip_number && message.registration_number && message.events !== "";
|
|
33
|
+
if (!this.timestampValidator.isTimestampValid(timestamp, message.timestamp)) {
|
|
34
|
+
this.logger.error(new golemio_errors_1.GeneralError(`Message timestamp 'tm' of value ${message.timestamp} is not valid ` +
|
|
35
|
+
`(line ${message.cis_line_id}, trip id ${message.cis_trip_number})`, this.constructor.name, undefined, undefined, "pid"));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (isValidMessage) {
|
|
45
39
|
filteredMessages.push(message);
|
|
46
40
|
}
|
|
47
41
|
}
|
|
@@ -50,21 +44,11 @@ let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class Regional
|
|
|
50
44
|
}
|
|
51
45
|
return filteredMessages;
|
|
52
46
|
}
|
|
53
|
-
get regNumberWhitelist() {
|
|
54
|
-
const valuePath = "old.datasources.pid.vehicle-positions.regNumberWhitelist.regionalBus";
|
|
55
|
-
const whitelistDict = this.config.getValue(valuePath, {});
|
|
56
|
-
const whitelist = Object.values(whitelistDict);
|
|
57
|
-
if (whitelist[0] !== "*") {
|
|
58
|
-
return whitelist;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
47
|
};
|
|
63
48
|
exports.RegionalBusMessageFilter = RegionalBusMessageFilter = __decorate([
|
|
64
49
|
(0, tsyringe_1.injectable)(),
|
|
65
|
-
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.
|
|
66
|
-
__param(1, (0, tsyringe_1.inject)(
|
|
67
|
-
|
|
68
|
-
__metadata("design:paramtypes", [Object, Object, TimestampValidator_1.TimestampValidator])
|
|
50
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
51
|
+
__param(1, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.TimestampValidator)),
|
|
52
|
+
__metadata("design:paramtypes", [Object, TimestampValidator_1.TimestampValidator])
|
|
69
53
|
], RegionalBusMessageFilter);
|
|
70
54
|
//# sourceMappingURL=RegionalBusMessageFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionalBusMessageFilter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RegionalBusMessageFilter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,uEAA8E;AAC9E,8DAA2D;AAC3D,6EAAwE;AAGjE,IAAM,wBAAwB,sCAA9B,MAAM,wBAAwB;IACjC,YACsC,MAAe,EACI,kBAAsC;QADzD,WAAM,GAAN,MAAM,CAAS;QACI,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC5F,CAAC;IAEJ;;OAEG;IACI,mBAAmB,CAAC,QAAyC,EAAE,SAAiB;QACnF,IAAI,gBAAgB,GAAoC,EAAE,CAAC;QAC3D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,MAAM,cAAc,GAChB,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC;YAC3G,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAU,CAAC,EAAE;gBAC1E,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,6BAAY,CACZ,mCAAmC,OAAO,CAAC,SAAS,gBAAgB;oBAChE,SAAS,OAAO,CAAC,WAAW,aAAa,OAAO,CAAC,eAAe,GAAG,EACvE,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,SAAS,EACT,SAAS,EACT,KAAK,CACR,CACJ,CAAC;gBACF,SAAS;aACZ;YAED,IAAI,cAAc,EAAE;gBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAClC;SACJ;QAED,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;SAChF;QAED,OAAO,gBAAgB,CAAC;IAC5B,CAAC;CACJ,CAAA;mCAvCY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,kBAAkB,CAAC,CAAA;6CAA6B,uCAAkB;GAHtF,wBAAwB,CAuCpC"}
|
|
@@ -14,6 +14,7 @@ export declare class TripsRepository extends PostgresModel implements IModel {
|
|
|
14
14
|
private connector;
|
|
15
15
|
private positionsRepository;
|
|
16
16
|
private descriptorRepository;
|
|
17
|
+
private readonly tripScheduleRepository;
|
|
17
18
|
constructor();
|
|
18
19
|
findAllAssocTripIds: (tripIds: string[]) => Promise<IUpdateDelayTripsIdsData[]>;
|
|
19
20
|
findGTFSTripId: (trip: IUpdateGTFSTripIdData) => Promise<IUpdateDelayTripsIdsData | IUpdateDelayTripsIdsData[] | undefined>;
|
|
@@ -27,7 +28,6 @@ export declare class TripsRepository extends PostgresModel implements IModel {
|
|
|
27
28
|
}>>;
|
|
28
29
|
hasOne: (model: any, options: any) => any;
|
|
29
30
|
findAll: (options: Sequelize.FindOptions<any> | undefined) => Promise<any>;
|
|
30
|
-
private findGTFSTripIdBasic;
|
|
31
31
|
private findGTFSTripIdsTrain;
|
|
32
32
|
/**
|
|
33
33
|
* Return all valid trips for GTFS Realtime feed
|
|
@@ -45,14 +45,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
};
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
47
|
exports.TripsRepository = void 0;
|
|
48
|
+
const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
|
|
48
49
|
const Di_1 = require("../../../ioc/Di");
|
|
50
|
+
const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
|
|
49
51
|
const const_1 = require("../../../../../schema-definitions/const");
|
|
50
52
|
const VPTripsModel_1 = require("../../../../../schema-definitions/vehicle-positions/models/VPTripsModel");
|
|
51
53
|
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
52
54
|
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
53
55
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
54
56
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
55
|
-
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
56
57
|
const sequelize_1 = __importStar(require("@golemio/core/dist/shared/sequelize"));
|
|
57
58
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
58
59
|
const const_2 = require("../../../../../const");
|
|
@@ -60,7 +61,6 @@ const DateTimeUtils_1 = require("../helpers/DateTimeUtils");
|
|
|
60
61
|
const PositionsRepository_1 = require("./PositionsRepository");
|
|
61
62
|
const RawQueryProvider_1 = require("./helpers/RawQueryProvider");
|
|
62
63
|
const TripsMapper_1 = __importDefault(require("./helpers/TripsMapper"));
|
|
63
|
-
const VPContainerToken_1 = require("../../../ioc/VPContainerToken");
|
|
64
64
|
let TripsRepository = exports.TripsRepository = class TripsRepository extends models_1.PostgresModel {
|
|
65
65
|
constructor() {
|
|
66
66
|
super("VPTripsRepository", {
|
|
@@ -91,7 +91,7 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
91
91
|
: [];
|
|
92
92
|
});
|
|
93
93
|
this.findGTFSTripId = (trip) => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
94
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
95
95
|
let foundGtfsTrips = [];
|
|
96
96
|
if (Number(trip.start_cis_stop_id) >= 5400000 && Number(trip.start_cis_stop_id) < 5500000) {
|
|
97
97
|
// trains
|
|
@@ -100,15 +100,24 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
102
|
// other
|
|
103
|
-
foundGtfsTrips = yield this.
|
|
103
|
+
foundGtfsTrips = yield this.tripScheduleRepository.findTripsByRouteAndTripNumber({
|
|
104
|
+
routeLicenseNumber: (_a = trip.cis_line_id) !== null && _a !== void 0 ? _a : null,
|
|
105
|
+
tripNumber: (_b = trip.cis_trip_number) !== null && _b !== void 0 ? _b : null,
|
|
106
|
+
startTimestamp: trip.start_timestamp,
|
|
107
|
+
});
|
|
104
108
|
}
|
|
105
109
|
if (foundGtfsTrips.length < 1) {
|
|
110
|
+
this.logger.verbose(`Model data was not found for id '${trip.id}'`, true, this.constructor.name, 5001);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
else if (foundGtfsTrips.length > 10) {
|
|
114
|
+
this.logger.verbose(`There are too many gtfs trips (${foundGtfsTrips.length}) linked with id '${trip.id}'`);
|
|
106
115
|
return;
|
|
107
116
|
}
|
|
108
117
|
// update existing trip with gtfs_trip_id, gtfs_block_id and other gtfs data
|
|
109
118
|
const firstFoundGtfsTrip = foundGtfsTrips.shift();
|
|
110
119
|
const { startTimestamp, endTimestamp } = this.deduceTimestamps(firstFoundGtfsTrip.min_stop_time, firstFoundGtfsTrip.max_stop_time, trip.start_timestamp);
|
|
111
|
-
yield this.update(Object.assign(Object.assign({}, firstFoundGtfsTrip), { internal_run_number: (
|
|
120
|
+
yield this.update(Object.assign(Object.assign({}, firstFoundGtfsTrip), { internal_run_number: (_c = firstFoundGtfsTrip.internal_run_number) !== null && _c !== void 0 ? _c : trip.run_number, internal_route_name: (_d = firstFoundGtfsTrip.internal_route_name) !== null && _d !== void 0 ? _d : trip.origin_route_name, start_timestamp: startTimestamp, end_timestamp: endTimestamp }), {
|
|
112
121
|
where: {
|
|
113
122
|
id: trip.id,
|
|
114
123
|
},
|
|
@@ -119,8 +128,8 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
119
128
|
gtfs_trip_id: firstFoundGtfsTrip.gtfs_trip_id,
|
|
120
129
|
gtfs_block_id: firstFoundGtfsTrip.gtfs_block_id,
|
|
121
130
|
gtfs_route_type: firstFoundGtfsTrip.gtfs_route_type,
|
|
122
|
-
internal_run_number: (
|
|
123
|
-
internal_route_name: (
|
|
131
|
+
internal_run_number: (_e = firstFoundGtfsTrip.internal_run_number) !== null && _e !== void 0 ? _e : trip.run_number,
|
|
132
|
+
internal_route_name: (_f = firstFoundGtfsTrip.internal_route_name) !== null && _f !== void 0 ? _f : trip.origin_route_name,
|
|
124
133
|
start_timestamp: startTimestamp.toISOString(),
|
|
125
134
|
end_timestamp: endTimestamp.toISOString(),
|
|
126
135
|
},
|
|
@@ -130,7 +139,7 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
130
139
|
const newId = `${trip.id}_gtfs_trip_id_${foundTrip.gtfs_trip_id}`;
|
|
131
140
|
foundTrip.id = newId;
|
|
132
141
|
const { startTimestamp, endTimestamp } = this.deduceTimestamps(foundTrip.min_stop_time, foundTrip.max_stop_time, trip.start_timestamp);
|
|
133
|
-
yield this.save(Object.assign(Object.assign(Object.assign({}, trip), foundTrip), { internal_run_number: (
|
|
142
|
+
yield this.save(Object.assign(Object.assign(Object.assign({}, trip), foundTrip), { internal_run_number: (_g = foundTrip.internal_run_number) !== null && _g !== void 0 ? _g : trip.run_number, internal_route_name: (_h = foundTrip.internal_route_name) !== null && _h !== void 0 ? _h : trip.origin_route_name, start_timestamp: startTimestamp, end_timestamp: endTimestamp }));
|
|
134
143
|
newIds.push({
|
|
135
144
|
id: newId,
|
|
136
145
|
gtfs_trip_id: foundTrip.gtfs_trip_id,
|
|
@@ -139,8 +148,8 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
139
148
|
start_timestamp: startTimestamp.toISOString(),
|
|
140
149
|
end_timestamp: endTimestamp.toISOString(),
|
|
141
150
|
run_number: trip.run_number,
|
|
142
|
-
internal_run_number: (
|
|
143
|
-
internal_route_name: (
|
|
151
|
+
internal_run_number: (_j = foundTrip.internal_run_number) !== null && _j !== void 0 ? _j : trip.run_number,
|
|
152
|
+
internal_route_name: (_k = foundTrip.internal_route_name) !== null && _k !== void 0 ? _k : trip.origin_route_name,
|
|
144
153
|
origin_route_name: trip.origin_route_name,
|
|
145
154
|
vehicle_registration_number: trip.vehicle_registration_number,
|
|
146
155
|
});
|
|
@@ -228,52 +237,15 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
228
237
|
this.findAll = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
229
238
|
return this.sequelizeModel.findAll(options);
|
|
230
239
|
});
|
|
231
|
-
this.findGTFSTripIdBasic = (trip) => __awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
const connection = this.connector.getConnection();
|
|
233
|
-
const startDate = (0, moment_timezone_1.default)(trip.start_timestamp).tz("Europe/Prague");
|
|
234
|
-
const startDateDayBefore = startDate.clone().subtract(1, "day");
|
|
235
|
-
const startDateYMD = startDate.format("YYYY-MM-DD");
|
|
236
|
-
const startDateDayName = startDate.format("dddd").toLowerCase();
|
|
237
|
-
const startDateDayBeforeYMD = startDateDayBefore.format("YYYY-MM-DD");
|
|
238
|
-
const startDateDayBeforeDayName = startDateDayBefore.format("dddd").toLowerCase();
|
|
239
|
-
const sqlQuery = RawQueryProvider_1.RawQueryProvider.getFindGtfsCommonTripsQuery(startDateDayName, startDateDayBeforeDayName);
|
|
240
|
-
let result = (yield connection.query(sqlQuery, {
|
|
241
|
-
type: sequelize_1.default.QueryTypes.SELECT,
|
|
242
|
-
bind: {
|
|
243
|
-
startDateDayBeforeYMD,
|
|
244
|
-
startDateYMD,
|
|
245
|
-
cisLineShortName: trip.cis_line_short_name,
|
|
246
|
-
startCisStopId: trip.start_cis_stop_id || 0,
|
|
247
|
-
startAswStopId: trip.start_asw_stop_id || "",
|
|
248
|
-
startCisStopPlatformCode: trip.start_cis_stop_platform_code,
|
|
249
|
-
startDateFormated: startDate.utc().format(),
|
|
250
|
-
},
|
|
251
|
-
}));
|
|
252
|
-
if (result.length < 1) {
|
|
253
|
-
this.logger.verbose(`${this.constructor.name}: Model data was not found for id '${trip.id}' (basic).`);
|
|
254
|
-
}
|
|
255
|
-
else if (result.length > 1) {
|
|
256
|
-
this.logger.verbose(`There are too many gtfs trips (${result.length}) linked with id '${trip.id}' (trip).`);
|
|
257
|
-
result = [];
|
|
258
|
-
}
|
|
259
|
-
return result;
|
|
260
|
-
});
|
|
261
240
|
this.findGTFSTripIdsTrain = (trip) => __awaiter(this, void 0, void 0, function* () {
|
|
262
241
|
const connection = this.connector.getConnection();
|
|
263
242
|
const sqlQuery = RawQueryProvider_1.RawQueryProvider.getFindGtfsTrainTripsQuery();
|
|
264
|
-
let results =
|
|
243
|
+
let results = yield connection.query(sqlQuery, {
|
|
265
244
|
type: sequelize_1.default.QueryTypes.SELECT,
|
|
266
245
|
bind: {
|
|
267
246
|
tripId: trip.id,
|
|
268
247
|
},
|
|
269
|
-
})
|
|
270
|
-
if (results.length < 1) {
|
|
271
|
-
this.logger.verbose(`Model data was not found for id '${trip.id}' (train).`, true, this.constructor.name, 5001);
|
|
272
|
-
}
|
|
273
|
-
else if (results.length > 10) {
|
|
274
|
-
this.logger.verbose(`There are too many gtfs trips (${results.length}) linked with id '${trip.id}' (train).`);
|
|
275
|
-
results = [];
|
|
276
|
-
}
|
|
248
|
+
});
|
|
277
249
|
return results;
|
|
278
250
|
});
|
|
279
251
|
/**
|
|
@@ -327,8 +299,18 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
327
299
|
valid_to: {
|
|
328
300
|
[sequelize_1.default.Op.or]: [null, { [sequelize_1.default.Op.gte]: minValidToDateTime }],
|
|
329
301
|
},
|
|
330
|
-
lat: {
|
|
331
|
-
|
|
302
|
+
lat: {
|
|
303
|
+
[sequelize_1.default.Op.and]: {
|
|
304
|
+
[sequelize_1.default.Op.ne]: null,
|
|
305
|
+
[sequelize_1.default.Op.ne]: 0,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
lng: {
|
|
309
|
+
[sequelize_1.default.Op.and]: {
|
|
310
|
+
[sequelize_1.default.Op.ne]: null,
|
|
311
|
+
[sequelize_1.default.Op.ne]: 0,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
332
314
|
},
|
|
333
315
|
},
|
|
334
316
|
{
|
|
@@ -448,6 +430,7 @@ let TripsRepository = exports.TripsRepository = class TripsRepository extends mo
|
|
|
448
430
|
this.connector = Di_1.VPContainer.resolve(CoreToken_1.CoreToken.PostgresConnector);
|
|
449
431
|
this.positionsRepository = new PositionsRepository_1.PositionsRepository();
|
|
450
432
|
this.descriptorRepository = Di_1.VPContainer.resolve(VPContainerToken_1.VPContainerToken.DescriptorRepository);
|
|
433
|
+
this.tripScheduleRepository = new precomputed_1.TripScheduleRepository();
|
|
451
434
|
this.sequelizeModel.belongsTo(this.positionsRepository["sequelizeModel"], {
|
|
452
435
|
as: "last_position",
|
|
453
436
|
foreignKey: "last_position_id",
|