@golemio/pid 3.5.1-dev.1635663373 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js +1 -2
  2. package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js.map +1 -1
  3. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
  4. package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js +3 -1
  5. package/dist/output-gateway/pid/controllers/v2/V2DepartureBoardsController.js.map +1 -1
  6. package/dist/output-gateway/pid/index.d.ts +5 -4
  7. package/dist/output-gateway/pid/index.js +0 -1
  8. package/dist/output-gateway/pid/index.js.map +1 -1
  9. package/dist/output-gateway/pid/ioc/Di.js +0 -4
  10. package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
  11. package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +0 -2
  12. package/dist/output-gateway/pid/ioc/OgPidToken.js +0 -2
  13. package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
  14. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.d.ts +28 -14
  15. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +72 -192
  16. package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
  17. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js +15 -26
  18. package/dist/output-gateway/pid/models/helpers/PIDDepartureModel.js.map +1 -1
  19. package/dist/output-gateway/pid/models/helpers/SkipHelper.d.ts +0 -11
  20. package/dist/output-gateway/pid/models/helpers/SkipHelper.js +0 -91
  21. package/dist/output-gateway/pid/models/helpers/SkipHelper.js.map +1 -1
  22. package/dist/output-gateway/pid/models/helpers/interfaces/IPIDDepartureQueryOptions.d.ts +0 -3
  23. package/dist/output-gateway/pid/service/facade/TransferFacade.js +0 -2
  24. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
  25. package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.d.ts +2 -4
  26. package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +68 -90
  27. package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
  28. package/dist/output-gateway/public/domain/repository/IVehiclePositionsRepository.d.ts +1 -2
  29. package/dist/output-gateway/shared/constants/validations.js +1 -1
  30. package/dist/output-gateway/shared/constants/validations.js.map +1 -1
  31. package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +0 -1
  32. package/dist/schema-definitions/ropid-gtfs/redis/const.js +1 -2
  33. package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
  34. package/docs/openapi-output.yaml +2 -10
  35. package/package.json +3 -3
  36. package/db/migrations/postgresql/20250103092631-skip-missing.js +0 -53
  37. package/db/migrations/postgresql/sqls/20250103092631-skip-missing-down.sql +0 -184
  38. package/db/migrations/postgresql/sqls/20250103092631-skip-missing-up.sql +0 -195
  39. package/dist/output-gateway/pid/domain/DepartureInterfaces.d.ts +0 -7
  40. package/dist/output-gateway/pid/domain/DepartureInterfaces.js +0 -3
  41. package/dist/output-gateway/pid/domain/DepartureInterfaces.js.map +0 -1
  42. package/dist/output-gateway/pid/models/helpers/const.d.ts +0 -4
  43. package/dist/output-gateway/pid/models/helpers/const.js +0 -8
  44. package/dist/output-gateway/pid/models/helpers/const.js.map +0 -1
  45. package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.d.ts +0 -21
  46. package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.js +0 -3
  47. package/dist/output-gateway/pid/models/interfaces/IGetDeparturesOptions.js.map +0 -1
  48. package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.d.ts +0 -10
  49. package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.js +0 -65
  50. package/dist/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.js.map +0 -1
  51. package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.d.ts +0 -4
  52. package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.js +0 -3
  53. package/dist/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.js.map +0 -1
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- var dbm;
4
- var type;
5
- var seed;
6
- var fs = require('fs');
7
- var path = require('path');
8
- var Promise;
9
-
10
- /**
11
- * We receive the dbmigrate dependency from dbmigrate initially.
12
- * This enables us to not have to rely on NODE_PATH.
13
- */
14
- exports.setup = function(options, seedLink) {
15
- dbm = options.dbmigrate;
16
- type = dbm.dataType;
17
- seed = seedLink;
18
- Promise = options.Promise;
19
- };
20
-
21
- exports.up = function(db) {
22
- var filePath = path.join(__dirname, 'sqls', '20250103092631-skip-missing-up.sql');
23
- return new Promise( function( resolve, reject ) {
24
- fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
- if (err) return reject(err);
26
- console.log('received data: ' + data);
27
-
28
- resolve(data);
29
- });
30
- })
31
- .then(function(data) {
32
- return db.runSql(data);
33
- });
34
- };
35
-
36
- exports.down = function(db) {
37
- var filePath = path.join(__dirname, 'sqls', '20250103092631-skip-missing-down.sql');
38
- return new Promise( function( resolve, reject ) {
39
- fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
- if (err) return reject(err);
41
- console.log('received data: ' + data);
42
-
43
- resolve(data);
44
- });
45
- })
46
- .then(function(data) {
47
- return db.runSql(data);
48
- });
49
- };
50
-
51
- exports._meta = {
52
- "version": 1
53
- };
@@ -1,184 +0,0 @@
1
- -- Remove columns in the resulting table of the get_departures function
2
- -- - trip.start_timestamp
3
- -- - trip.end_timestamp
4
- -- - trip.start_stop_id
5
-
6
- drop function get_departures;
7
- create function get_departures (
8
- stopsIds varchar,
9
- mode int,
10
- dateDepartureBetweenStart timestamptz,
11
- dateDepartureBetweenEnd timestamptz,
12
- isNegativeMinutesBefore int,
13
- dateCanceledDepartureBetweenStart timestamptz,
14
- dateCanceledDepartureBetweenEnd timestamptz,
15
- airconditioninfoenabled int
16
- )
17
- returns table (
18
- departure_datetime_real timestamptz,
19
- arrival_datetime_real timestamptz,
20
- stop_sequence int2,
21
- stop_headsign varchar(70),
22
- arrival_datetime timestamptz,
23
- departure_datetime timestamptz,
24
- stop_id varchar(25),
25
- platform_code varchar(10),
26
- wheelchair_boarding int2,
27
- min_stop_sequence int2,
28
- max_stop_sequence int2,
29
- trip_id varchar(50),
30
- trip_headsign varchar(100),
31
- trip_short_name varchar(30),
32
- wheelchair_accessible int2,
33
- route_short_name varchar(50),
34
- route_type int2,
35
- route_id varchar(20),
36
- is_night bpchar(1),
37
- is_regional bpchar(1),
38
- is_substitute_transport bpchar(1),
39
- next_stop_id varchar(30),
40
- delay_seconds int4,
41
- real_wheelchair_accessible bool,
42
- is_canceled bool,
43
- "trip.gtfs_trip_short_name" varchar(255),
44
- "trip.gtfs_date" date,
45
- "trip.internal_route_name" varchar(50),
46
- "trip.internal_run_number" int4,
47
- "trip.last_position.last_stop_id" varchar(255),
48
- "trip.last_position.last_stop_sequence" int4,
49
- "trip.last_position.last_stop_name" varchar(255),
50
- "trip.last_position.this_stop_sequence" int4,
51
- "trip.cis_stop_platform_code" varchar(15),
52
- "trip.vehicle_descriptor.is_air_conditioned" bool,
53
- delay_minutes int4,
54
- is_delay_available bool
55
- )
56
- language SQL
57
- set search_path from current
58
- as $$
59
- select
60
- departure_boards_detailed."computed.departure_datetime_real",
61
- departure_boards_detailed."computed.arrival_datetime_real",
62
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence",
63
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_headsign",
64
- departure_boards_detailed."ropidgtfs_precomputed_departures.arrival_datetime",
65
- departure_boards_detailed."ropidgtfs_precomputed_departures.departure_datetime",
66
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id",
67
- departure_boards_detailed."ropidgtfs_precomputed_departures.platform_code",
68
- departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_boarding",
69
- departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence",
70
- departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence",
71
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_id",
72
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_headsign",
73
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_short_name",
74
- departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_accessible",
75
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_short_name",
76
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_type",
77
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_id",
78
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_night",
79
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_regional",
80
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_substitute_transport",
81
- departure_boards_detailed."ropidgtfs_precomputed_departures.next_stop_id",
82
- departure_boards_detailed."delay_seconds",
83
- departure_boards_detailed."real_wheelchair_accessible",
84
- departure_boards_detailed."is_canceled",
85
- departure_boards_detailed."trip.gtfs_trip_short_name",
86
- departure_boards_detailed."trip.gtfs_date",
87
- departure_boards_detailed."trip.internal_route_name",
88
- departure_boards_detailed."trip.internal_run_number",
89
- departure_boards_detailed."trip.last_position.last_stop_id",
90
- departure_boards_detailed."trip.last_position.last_stop_sequence",
91
- departure_boards_detailed."trip.last_position.last_stop_name",
92
- departure_boards_detailed."trip.last_position.this_stop_sequence",
93
- departure_boards_detailed.cis_stop_platform_code as "trip.cis_stop_platform_code",
94
- case when airconditioninfoenabled = 1 then departure_boards_detailed."trip.vehicle_descriptor.is_air_conditioned" else NULL end,
95
- TRUNC(departure_boards_detailed."trip.last_position.delay"::DECIMAL / 60, 0)::int as "delay_minutes",
96
- case when departure_boards_detailed."trip.last_position.delay" is null then false else true end as "is_delay_available"
97
- from (
98
- select
99
- ("departure_datetime"
100
- + MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end))
101
- - case when (MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)) > MAKE_INTERVAL())
102
- then least (
103
- MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)),
104
- ("departure_datetime" - "arrival_datetime")::interval
105
- )
106
- else MAKE_INTERVAL()
107
- end
108
- ) "computed.departure_datetime_real",
109
- "arrival_datetime" + MAKE_INTERVAL(secs => (
110
- CASE WHEN "trip.last_position.delay" IS NULL THEN 0 ELSE "trip.last_position.delay" end
111
- )) "computed.arrival_datetime_real",
112
- "ropidgtfs_precomputed_departures"."stop_sequence" as "ropidgtfs_precomputed_departures.stop_sequence",
113
- "ropidgtfs_precomputed_departures"."stop_headsign" as "ropidgtfs_precomputed_departures.stop_headsign",
114
- "ropidgtfs_precomputed_departures"."pickup_type" as "ropidgtfs_precomputed_departures.pickup_type",
115
- "ropidgtfs_precomputed_departures"."drop_off_type" as "ropidgtfs_precomputed_departures.drop_off_type",
116
- "ropidgtfs_precomputed_departures"."arrival_time" as "ropidgtfs_precomputed_departures.arrival_time",
117
- "ropidgtfs_precomputed_departures"."arrival_datetime" as "ropidgtfs_precomputed_departures.arrival_datetime",
118
- "ropidgtfs_precomputed_departures"."departure_time" as "ropidgtfs_precomputed_departures.departure_time",
119
- "ropidgtfs_precomputed_departures"."departure_datetime" as "ropidgtfs_precomputed_departures.departure_datetime",
120
- "ropidgtfs_precomputed_departures"."stop_id" as "ropidgtfs_precomputed_departures.stop_id",
121
- "ropidgtfs_precomputed_departures"."stop_name" as "ropidgtfs_precomputed_departures.stop_name",
122
- "ropidgtfs_precomputed_departures"."platform_code" as "ropidgtfs_precomputed_departures.platform_code",
123
- "ropidgtfs_precomputed_departures"."wheelchair_boarding" as "ropidgtfs_precomputed_departures.wheelchair_boarding",
124
- "ropidgtfs_precomputed_departures"."min_stop_sequence" as "ropidgtfs_precomputed_departures.min_stop_sequence",
125
- "ropidgtfs_precomputed_departures"."max_stop_sequence" as "ropidgtfs_precomputed_departures.max_stop_sequence",
126
- "ropidgtfs_precomputed_departures"."trip_id" as "ropidgtfs_precomputed_departures.trip_id",
127
- "ropidgtfs_precomputed_departures"."trip_headsign" as "ropidgtfs_precomputed_departures.trip_headsign",
128
- "ropidgtfs_precomputed_departures"."trip_short_name" as "ropidgtfs_precomputed_departures.trip_short_name",
129
- "ropidgtfs_precomputed_departures"."wheelchair_accessible" as "ropidgtfs_precomputed_departures.wheelchair_accessible",
130
- "ropidgtfs_precomputed_departures"."service_id" as "ropidgtfs_precomputed_departures.service_id",
131
- "ropidgtfs_precomputed_departures"."date" as "ropidgtfs_precomputed_departures.date",
132
- "ropidgtfs_precomputed_departures"."route_short_name" as "ropidgtfs_precomputed_departures.route_short_name",
133
- "ropidgtfs_precomputed_departures"."route_type" as "ropidgtfs_precomputed_departures.route_type",
134
- "ropidgtfs_precomputed_departures"."route_id" as "ropidgtfs_precomputed_departures.route_id",
135
- "ropidgtfs_precomputed_departures"."is_night" as "ropidgtfs_precomputed_departures.is_night",
136
- "ropidgtfs_precomputed_departures"."is_regional" as "ropidgtfs_precomputed_departures.is_regional",
137
- "ropidgtfs_precomputed_departures"."is_substitute_transport" as "ropidgtfs_precomputed_departures.is_substitute_transport",
138
- "ropidgtfs_precomputed_departures"."next_stop_sequence" as "ropidgtfs_precomputed_departures.next_stop_sequence",
139
- "ropidgtfs_precomputed_departures"."next_stop_id" as "ropidgtfs_precomputed_departures.next_stop_id",
140
- "ropidgtfs_precomputed_departures"."last_stop_sequence" as "ropidgtfs_precomputed_departures.last_stop_sequence",
141
- "ropidgtfs_precomputed_departures"."last_stop_id" as "ropidgtfs_precomputed_departures.last_stop_id",
142
- x.*,
143
- cis_stop.cis_stop_platform_code as "cis_stop_platform_code"
144
- from
145
- "ropidgtfs_precomputed_departures" as "ropidgtfs_precomputed_departures"
146
- left outer join v_vehiclepositions_trip_position_vehicle_info as x on
147
- "ropidgtfs_precomputed_departures"."trip_id" = x."trip.gtfs_trip_id"
148
- left join vehiclepositions_cis_stops as cis_stop on
149
- cis_stop.rt_trip_id = x."trip.id"
150
- and cis_stop.cis_stop_group_id = "ropidgtfs_precomputed_departures"."cis_stop_group_id"
151
- ) departure_boards_detailed
152
- where
153
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id" = ANY(STRING_TO_ARRAY(stopsIds,','))
154
- and (
155
- (
156
- (
157
- (mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
158
- or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
159
- )
160
- and
161
- (
162
- 0 = isNegativeMinutesBefore
163
- or ( -- pro záporné minutes before
164
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" >= departure_boards_detailed."trip.last_position.last_stop_sequence"
165
- or departure_boards_detailed."trip.last_position.last_stop_sequence" IS null
166
- )
167
- )
168
-
169
- )
170
- or (
171
- departure_boards_detailed."trip.is_canceled" = true
172
- and
173
- (
174
- (mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
175
- or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
176
- )
177
- )
178
- ) and
179
- (
180
- (mode = 1 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence")) -- mode default/departures
181
- or (mode=2 and (departure_boards_detailed."ropidgtfs_precomputed_departures.drop_off_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence")) -- mode arrivals
182
- or (mode=3 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1')) -- mode mixed
183
- );
184
- $$;
@@ -1,195 +0,0 @@
1
- -- Add columns in the resulting table of the get_departures function
2
- -- + trip.start_timestamp
3
- -- + origin_route_name
4
- -- + run_number
5
-
6
- drop function get_departures;
7
- create function get_departures (
8
- stopsIds varchar,
9
- mode int,
10
- dateDepartureBetweenStart timestamptz,
11
- dateDepartureBetweenEnd timestamptz,
12
- isNegativeMinutesBefore int,
13
- dateCanceledDepartureBetweenStart timestamptz,
14
- dateCanceledDepartureBetweenEnd timestamptz,
15
- airconditioninfoenabled int
16
- )
17
- returns table (
18
- departure_datetime_real timestamptz,
19
- arrival_datetime_real timestamptz,
20
- stop_sequence int2,
21
- stop_headsign varchar(70),
22
- arrival_datetime timestamptz,
23
- departure_datetime timestamptz,
24
- stop_id varchar(25),
25
- platform_code varchar(10),
26
- wheelchair_boarding int2,
27
- min_stop_sequence int2,
28
- max_stop_sequence int2,
29
- trip_id varchar(50),
30
- trip_headsign varchar(100),
31
- trip_short_name varchar(30),
32
- wheelchair_accessible int2,
33
- route_short_name varchar(50),
34
- route_type int2,
35
- route_id varchar(20),
36
- is_night bpchar(1),
37
- is_regional bpchar(1),
38
- is_substitute_transport bpchar(1),
39
- next_stop_id varchar(30),
40
- delay_seconds int4,
41
- real_wheelchair_accessible bool,
42
- is_canceled bool,
43
- "trip.gtfs_trip_short_name" varchar(255),
44
- "trip.gtfs_date" date,
45
- "trip.internal_route_name" varchar(50),
46
- "trip.internal_run_number" int4,
47
- "trip.start_timestamp" timestamptz,
48
- "trip.last_position.last_stop_id" varchar(255),
49
- "trip.last_position.last_stop_sequence" int4,
50
- "trip.last_position.last_stop_name" varchar(255),
51
- "trip.last_position.this_stop_sequence" int4,
52
- "trip.cis_stop_platform_code" varchar(15),
53
- "trip.vehicle_descriptor.is_air_conditioned" bool,
54
- delay_minutes int4,
55
- is_delay_available bool,
56
- origin_route_name varchar(50),
57
- run_number int4
58
- )
59
- language SQL
60
- set search_path from current
61
- as $$
62
- select
63
- departure_boards_detailed."computed.departure_datetime_real",
64
- departure_boards_detailed."computed.arrival_datetime_real",
65
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence",
66
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_headsign",
67
- departure_boards_detailed."ropidgtfs_precomputed_departures.arrival_datetime",
68
- departure_boards_detailed."ropidgtfs_precomputed_departures.departure_datetime",
69
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id",
70
- departure_boards_detailed."ropidgtfs_precomputed_departures.platform_code",
71
- departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_boarding",
72
- departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence",
73
- departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence",
74
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_id",
75
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_headsign",
76
- departure_boards_detailed."ropidgtfs_precomputed_departures.trip_short_name",
77
- departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_accessible",
78
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_short_name",
79
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_type",
80
- departure_boards_detailed."ropidgtfs_precomputed_departures.route_id",
81
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_night",
82
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_regional",
83
- departure_boards_detailed."ropidgtfs_precomputed_departures.is_substitute_transport",
84
- departure_boards_detailed."ropidgtfs_precomputed_departures.next_stop_id",
85
- departure_boards_detailed."delay_seconds",
86
- departure_boards_detailed."real_wheelchair_accessible",
87
- departure_boards_detailed."is_canceled",
88
- departure_boards_detailed."trip.gtfs_trip_short_name",
89
- departure_boards_detailed."trip.gtfs_date",
90
- departure_boards_detailed."trip.internal_route_name",
91
- departure_boards_detailed."trip.internal_run_number",
92
- departure_boards_detailed."trip.start_timestamp",
93
- departure_boards_detailed."trip.last_position.last_stop_id",
94
- departure_boards_detailed."trip.last_position.last_stop_sequence",
95
- departure_boards_detailed."trip.last_position.last_stop_name",
96
- departure_boards_detailed."trip.last_position.this_stop_sequence",
97
- departure_boards_detailed.cis_stop_platform_code as "trip.cis_stop_platform_code",
98
- case when airconditioninfoenabled = 1 then departure_boards_detailed."trip.vehicle_descriptor.is_air_conditioned" else NULL end,
99
- TRUNC(departure_boards_detailed."trip.last_position.delay"::DECIMAL / 60, 0)::int as "delay_minutes",
100
- case when departure_boards_detailed."trip.last_position.delay" is null then false else true end as "is_delay_available",
101
- departure_boards_detailed."run.origin_route_name",
102
- departure_boards_detailed."run.run_number"
103
- from (
104
- select
105
- ("departure_datetime"
106
- + MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end))
107
- - case when (MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)) > MAKE_INTERVAL())
108
- then least (
109
- MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)),
110
- ("departure_datetime" - "arrival_datetime")::interval
111
- )
112
- else MAKE_INTERVAL()
113
- end
114
- ) "computed.departure_datetime_real",
115
- "arrival_datetime" + MAKE_INTERVAL(secs => (
116
- CASE WHEN "trip.last_position.delay" IS NULL THEN 0 ELSE "trip.last_position.delay" end
117
- )) "computed.arrival_datetime_real",
118
- "ropidgtfs_precomputed_departures"."stop_sequence" as "ropidgtfs_precomputed_departures.stop_sequence",
119
- "ropidgtfs_precomputed_departures"."stop_headsign" as "ropidgtfs_precomputed_departures.stop_headsign",
120
- "ropidgtfs_precomputed_departures"."pickup_type" as "ropidgtfs_precomputed_departures.pickup_type",
121
- "ropidgtfs_precomputed_departures"."drop_off_type" as "ropidgtfs_precomputed_departures.drop_off_type",
122
- "ropidgtfs_precomputed_departures"."arrival_time" as "ropidgtfs_precomputed_departures.arrival_time",
123
- "ropidgtfs_precomputed_departures"."arrival_datetime" as "ropidgtfs_precomputed_departures.arrival_datetime",
124
- "ropidgtfs_precomputed_departures"."departure_time" as "ropidgtfs_precomputed_departures.departure_time",
125
- "ropidgtfs_precomputed_departures"."departure_datetime" as "ropidgtfs_precomputed_departures.departure_datetime",
126
- "ropidgtfs_precomputed_departures"."stop_id" as "ropidgtfs_precomputed_departures.stop_id",
127
- "ropidgtfs_precomputed_departures"."stop_name" as "ropidgtfs_precomputed_departures.stop_name",
128
- "ropidgtfs_precomputed_departures"."platform_code" as "ropidgtfs_precomputed_departures.platform_code",
129
- "ropidgtfs_precomputed_departures"."wheelchair_boarding" as "ropidgtfs_precomputed_departures.wheelchair_boarding",
130
- "ropidgtfs_precomputed_departures"."min_stop_sequence" as "ropidgtfs_precomputed_departures.min_stop_sequence",
131
- "ropidgtfs_precomputed_departures"."max_stop_sequence" as "ropidgtfs_precomputed_departures.max_stop_sequence",
132
- "ropidgtfs_precomputed_departures"."trip_id" as "ropidgtfs_precomputed_departures.trip_id",
133
- "ropidgtfs_precomputed_departures"."trip_headsign" as "ropidgtfs_precomputed_departures.trip_headsign",
134
- "ropidgtfs_precomputed_departures"."trip_short_name" as "ropidgtfs_precomputed_departures.trip_short_name",
135
- "ropidgtfs_precomputed_departures"."wheelchair_accessible" as "ropidgtfs_precomputed_departures.wheelchair_accessible",
136
- "ropidgtfs_precomputed_departures"."service_id" as "ropidgtfs_precomputed_departures.service_id",
137
- "ropidgtfs_precomputed_departures"."date" as "ropidgtfs_precomputed_departures.date",
138
- "ropidgtfs_precomputed_departures"."route_short_name" as "ropidgtfs_precomputed_departures.route_short_name",
139
- "ropidgtfs_precomputed_departures"."route_type" as "ropidgtfs_precomputed_departures.route_type",
140
- "ropidgtfs_precomputed_departures"."route_id" as "ropidgtfs_precomputed_departures.route_id",
141
- "ropidgtfs_precomputed_departures"."is_night" as "ropidgtfs_precomputed_departures.is_night",
142
- "ropidgtfs_precomputed_departures"."is_regional" as "ropidgtfs_precomputed_departures.is_regional",
143
- "ropidgtfs_precomputed_departures"."is_substitute_transport" as "ropidgtfs_precomputed_departures.is_substitute_transport",
144
- "ropidgtfs_precomputed_departures"."next_stop_sequence" as "ropidgtfs_precomputed_departures.next_stop_sequence",
145
- "ropidgtfs_precomputed_departures"."next_stop_id" as "ropidgtfs_precomputed_departures.next_stop_id",
146
- "ropidgtfs_precomputed_departures"."last_stop_sequence" as "ropidgtfs_precomputed_departures.last_stop_sequence",
147
- "ropidgtfs_precomputed_departures"."last_stop_id" as "ropidgtfs_precomputed_departures.last_stop_id",
148
- x.*,
149
- cis_stop.cis_stop_platform_code as "cis_stop_platform_code",
150
- right(run.route_id, -1) as "run.origin_route_name",
151
- run.run_number as "run.run_number"
152
- from
153
- "ropidgtfs_precomputed_departures" as "ropidgtfs_precomputed_departures"
154
- left join "ropidgtfs_run_numbers" as run on
155
- "ropidgtfs_precomputed_departures"."trip_id" = run.trip_id
156
- and "ropidgtfs_precomputed_departures"."service_id" = run.service_id
157
- left outer join v_vehiclepositions_trip_position_vehicle_info as x on
158
- "ropidgtfs_precomputed_departures"."trip_id" = x."trip.gtfs_trip_id"
159
- left join vehiclepositions_cis_stops as cis_stop on
160
- cis_stop.rt_trip_id = x."trip.id"
161
- and cis_stop.cis_stop_group_id = "ropidgtfs_precomputed_departures"."cis_stop_group_id"
162
- ) departure_boards_detailed
163
- where
164
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id" = ANY(STRING_TO_ARRAY(stopsIds,','))
165
- and (
166
- (
167
- (
168
- (mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
169
- or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
170
- )
171
- and
172
- (
173
- 0 = isNegativeMinutesBefore
174
- or ( -- pro záporné minutes before
175
- departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" >= departure_boards_detailed."trip.last_position.last_stop_sequence"
176
- or departure_boards_detailed."trip.last_position.last_stop_sequence" IS null
177
- )
178
- )
179
-
180
- )
181
- or (
182
- departure_boards_detailed."trip.is_canceled" = true
183
- and
184
- (
185
- (mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
186
- or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
187
- )
188
- )
189
- ) and
190
- (
191
- (mode = 1 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence")) -- mode default/departures
192
- or (mode=2 and (departure_boards_detailed."ropidgtfs_precomputed_departures.drop_off_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence")) -- mode arrivals
193
- or (mode=3 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1')) -- mode mixed
194
- );
195
- $$;
@@ -1,7 +0,0 @@
1
- import type { IPIDDeparture, IStop } from "..";
2
- import type { IInfotextDepartureOutputDto } from "./InfotextInterfaces";
3
- export interface IDepartureBoardOutputDto {
4
- departures: IPIDDeparture[];
5
- infotexts: IInfotextDepartureOutputDto[];
6
- stops: IStop[];
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=DepartureInterfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepartureInterfaces.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/domain/DepartureInterfaces.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export declare const START_SOON_MINUTES_THRESHOLD = 30;
2
- export declare const START_SOON_METRO_MINUTES_THRESHOLD = 5;
3
- export declare const DEPARTURED_MINUTES_THRESHOLD = -2;
4
- export declare const TRIP_GAP_MINUTES_THRESHOLD = 60;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRIP_GAP_MINUTES_THRESHOLD = exports.DEPARTURED_MINUTES_THRESHOLD = exports.START_SOON_METRO_MINUTES_THRESHOLD = exports.START_SOON_MINUTES_THRESHOLD = void 0;
4
- exports.START_SOON_MINUTES_THRESHOLD = 30;
5
- exports.START_SOON_METRO_MINUTES_THRESHOLD = 5;
6
- exports.DEPARTURED_MINUTES_THRESHOLD = -2;
7
- exports.TRIP_GAP_MINUTES_THRESHOLD = 60;
8
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,EAAE,CAAC;AAClC,QAAA,kCAAkC,GAAG,CAAC,CAAC;AACvC,QAAA,4BAA4B,GAAG,CAAC,CAAC,CAAC;AAClC,QAAA,0BAA0B,GAAG,EAAE,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { DepartureFilter, DepartureMode, DepartureOrder, DepartureSkip } from "../..";
2
- import type { Moment } from "@golemio/core/dist/shared/moment-timezone";
3
- export interface IGetDeparturesOptions {
4
- aswIds?: string[];
5
- cisIds?: string[];
6
- gtfsIds?: string[];
7
- names?: string[];
8
- total: number;
9
- limit: number;
10
- offset: number;
11
- mode: DepartureMode;
12
- minutesBefore: number;
13
- minutesAfter: number;
14
- timeFrom?: Moment;
15
- order: DepartureOrder;
16
- filter: DepartureFilter;
17
- skip: DepartureSkip[];
18
- includeMetroTrains?: boolean;
19
- airCondition?: boolean;
20
- timezone: string;
21
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IGetDeparturesOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IGetDeparturesOptions.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/interfaces/IGetDeparturesOptions.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { IRunTripsRedisRepository } from "../../domain/repository/IRunTripsRedisRepository";
2
- import { IGtfsRunTripCacheDto } from "../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
3
- import { IoRedisConnector } from "@golemio/core/dist/helpers/data-access/redis/IoRedisConnector";
4
- import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
5
- export declare class RunTripsRedisRepository implements IRunTripsRedisRepository {
6
- private redisConnector;
7
- private log;
8
- constructor(redisConnector: IoRedisConnector, log: ILogger);
9
- getMultipleSchedule(runTuples: string[]): Promise<Array<IGtfsRunTripCacheDto | null>>;
10
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.RunTripsRedisRepository = void 0;
16
- const const_1 = require("../../../../schema-definitions/ropid-gtfs/redis/const");
17
- const IoRedisConnector_1 = require("@golemio/core/dist/helpers/data-access/redis/IoRedisConnector");
18
- const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
19
- const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
20
- const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
21
- const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
22
- let RunTripsRedisRepository = exports.RunTripsRedisRepository = class RunTripsRedisRepository {
23
- constructor(redisConnector, log) {
24
- this.redisConnector = redisConnector;
25
- this.log = log;
26
- }
27
- async getMultipleSchedule(runTuples) {
28
- if (!runTuples.length) {
29
- return [];
30
- }
31
- if (!this.redisConnector.isConnected()) {
32
- await this.redisConnector.connect();
33
- }
34
- const connection = this.redisConnector.getConnection();
35
- let runTripCache = [];
36
- try {
37
- runTripCache = await connection.mget(runTuples.map((runTuple) => `${const_1.GTFS_RUN_SCHEDULE_NAMESPACE_PREFIX}:${runTuple}`));
38
- }
39
- catch (error) {
40
- throw new golemio_errors_1.GeneralError("Cannot get run trips from cache", this.constructor.name, error);
41
- }
42
- let gtfsRunTripDtos = [];
43
- for (const cache of runTripCache) {
44
- if (cache === null) {
45
- this.log.info(`${this.constructor.name}: Cannot find run trip cache`);
46
- gtfsRunTripDtos.push(null);
47
- continue;
48
- }
49
- try {
50
- gtfsRunTripDtos.push(JSON.parse(cache));
51
- }
52
- catch (error) {
53
- throw new golemio_errors_1.GeneralError("Cannot parse run trip cache", this.constructor.name, error);
54
- }
55
- }
56
- return gtfsRunTripDtos;
57
- }
58
- };
59
- exports.RunTripsRedisRepository = RunTripsRedisRepository = __decorate([
60
- (0, tsyringe_1.injectable)(),
61
- __param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.RedisConnector)),
62
- __param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
63
- __metadata("design:paramtypes", [IoRedisConnector_1.IoRedisConnector, Object])
64
- ], RunTripsRedisRepository);
65
- //# sourceMappingURL=RunTripsRedisRepository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RunTripsRedisRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/ropid-gtfs/data-access/redis/RunTripsRedisRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAiF;AAEjF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,uBAAuB,qCAA7B,MAAM,uBAAuB;IAChC,YACmD,cAAgC,EAC7C,GAAY;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;IAC/C,CAAC;IAEG,KAAK,CAAC,mBAAmB,CAAC,SAAmB;QAChD,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACnB,OAAO,EAAE,CAAC;SACb;QAED,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACvC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;QACvD,IAAI,YAAY,GAAyB,EAAE,CAAC;QAE5C,IAAI;YACA,YAAY,GAAG,MAAM,UAAU,CAAC,IAAI,CAChC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,0CAAkC,IAAI,QAAQ,EAAE,CAAC,CACnF,CAAC;SACL;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAI,6BAAY,CAAC,iCAAiC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SAC3F;QAED,IAAI,eAAe,GAAuC,EAAE,CAAC;QAC7D,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YAC9B,IAAI,KAAK,KAAK,IAAI,EAAE;gBAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBACtE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC3B,SAAS;aACZ;YAED,IAAI;gBACA,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aAC3C;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,IAAI,6BAAY,CAAC,6BAA6B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACvF;SACJ;QAED,OAAO,eAAe,CAAC;IAC3B,CAAC;CACJ,CAAA;kCA3CY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,uBAAuB,CA2CnC"}
@@ -1,4 +0,0 @@
1
- import type { IGtfsRunTripCacheDto } from "../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
2
- export interface IRunTripsRedisRepository {
3
- getMultipleSchedule(runTuples: string[]): Promise<Array<IGtfsRunTripCacheDto | null>>;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IRunTripsRedisRepository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRunTripsRedisRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/ropid-gtfs/domain/repository/IRunTripsRedisRepository.ts"],"names":[],"mappings":""}