@golemio/pid 5.4.2-dev.2261918657 → 5.4.2-dev.2267281653

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.
@@ -0,0 +1,53 @@
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', '20260116105742-required-stop-name-in-combined-stop-times-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', '20260116105742-required-stop-name-in-combined-stop-times-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
+ };
@@ -0,0 +1,47 @@
1
+ create
2
+ or replace view v_public_vehiclepositions_combined_stop_times as
3
+ select
4
+ distinct on (rt_trip_id, stop_sequence) stop_times.rt_trip_id,
5
+ vt.gtfs_trip_id,
6
+ stop_times.stop_sequence,
7
+ stop_times.stop_arr_delay,
8
+ stop_times.stop_dep_delay,
9
+ vt.gtfs_route_type,
10
+ vt.gtfs_route_short_name,
11
+ vt.run_number,
12
+ vt.internal_run_number,
13
+ vt.provider_source_type,
14
+ vt.cis_trip_number,
15
+ vt.vehicle_registration_number,
16
+ stop_times.stop_id,
17
+ vcs.cis_stop_platform_code,
18
+ rs.platform_code,
19
+ rs.stop_name
20
+ from
21
+ (
22
+ select
23
+ *
24
+ from
25
+ v_public_vehiclepositions_future_stop_times prediction
26
+ union
27
+ all
28
+ select
29
+ *
30
+ from
31
+ v_public_vehiclepositions_past_stop_times history
32
+ ) as stop_times
33
+ join vehiclepositions_trips vt on vt.id = stop_times.rt_trip_id
34
+ join vehiclepositions_positions vp on vt.last_position_id = vp.id
35
+ and (
36
+ vp.valid_to is null
37
+ or vp.valid_to >= now()
38
+ )
39
+ and vp.state_position != 'after_track'
40
+ left join ropidgtfs_stops rs on rs.stop_id = stop_times.stop_id
41
+ left join ropidgtfs_cis_stops rcs on rcs.id = rs.computed_cis_stop_id
42
+ left join vehiclepositions_cis_stops vcs
43
+ on vcs.rt_trip_id = stop_times.rt_trip_id
44
+ and vcs.cis_stop_group_id = rcs.cis
45
+ order by
46
+ rt_trip_id,
47
+ stop_sequence;
@@ -0,0 +1,47 @@
1
+ create
2
+ or replace view v_public_vehiclepositions_combined_stop_times as
3
+ select
4
+ distinct on (rt_trip_id, stop_sequence) stop_times.rt_trip_id,
5
+ vt.gtfs_trip_id,
6
+ stop_times.stop_sequence,
7
+ stop_times.stop_arr_delay,
8
+ stop_times.stop_dep_delay,
9
+ vt.gtfs_route_type,
10
+ vt.gtfs_route_short_name,
11
+ vt.run_number,
12
+ vt.internal_run_number,
13
+ vt.provider_source_type,
14
+ vt.cis_trip_number,
15
+ vt.vehicle_registration_number,
16
+ stop_times.stop_id,
17
+ vcs.cis_stop_platform_code,
18
+ rs.platform_code,
19
+ rs.stop_name
20
+ from
21
+ (
22
+ select
23
+ *
24
+ from
25
+ v_public_vehiclepositions_future_stop_times prediction
26
+ union
27
+ all
28
+ select
29
+ *
30
+ from
31
+ v_public_vehiclepositions_past_stop_times history
32
+ ) as stop_times
33
+ join vehiclepositions_trips vt on vt.id = stop_times.rt_trip_id
34
+ join vehiclepositions_positions vp on vt.last_position_id = vp.id
35
+ and (
36
+ vp.valid_to is null
37
+ or vp.valid_to >= now()
38
+ )
39
+ and vp.state_position != 'after_track'
40
+ inner join ropidgtfs_stops rs on rs.stop_id = stop_times.stop_id
41
+ left join ropidgtfs_cis_stops rcs on rcs.id = rs.computed_cis_stop_id
42
+ left join vehiclepositions_cis_stops vcs
43
+ on vcs.rt_trip_id = stop_times.rt_trip_id
44
+ and vcs.cis_stop_group_id = rcs.cis
45
+ order by
46
+ rt_trip_id,
47
+ stop_sequence;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "5.4.2-dev.2261918657",
3
+ "version": "5.4.2-dev.2267281653",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",