@golemio/pid 2.3.4-dev.705246340 → 2.3.4-dev.705279523

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', '20221125082502-v-ropid-departure-boards-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', '20221125082502-v-ropid-departure-boards-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 @@
1
+ DROP VIEW analytic.v_ropid_departure_boards;
@@ -0,0 +1,32 @@
1
+ CREATE SCHEMA IF NOT EXISTS analytic;
2
+
3
+ CREATE OR REPLACE VIEW analytic.v_ropid_departure_boards
4
+ AS SELECT final.lon,
5
+ final.lat,
6
+ final.route_name,
7
+ final.note,
8
+ final.stop_correct,
9
+ count(1) OVER (PARTITION BY (split_part(final.stop_correct, '/'::text, 1))) AS n_ceduli,
10
+ final.alt_idos_name
11
+ FROM ( SELECT stops.lon,
12
+ stops.lat,
13
+ tab.route_name,
14
+ tab.note,
15
+ tab.stop_correct,
16
+ stops.alt_idos_name,
17
+ row_number() OVER (PARTITION BY tab.note) AS n_duplicit
18
+ FROM ( SELECT rdp.route_name,
19
+ rdp.note,
20
+ CASE
21
+ WHEN rdp.url_query_params::text ~~ '%aswIds%'::text THEN replace("substring"(rdp.url_query_params::text, 'aswIds[^=]*?=(.+?(?=&|$))'::text), '_'::text, '/'::text)
22
+ WHEN rdp.url_query_params::text ~~ '%cisIds%'::text THEN "substring"(rdp.url_query_params::text, 'cisIds[^=]*?=(.+?(?=&|$))'::text)
23
+ ELSE NULL::text
24
+ END AS stop_correct
25
+ FROM ropid_departures_presets rdp) tab
26
+ LEFT JOIN ropidgtfs_cis_stops stops ON
27
+ CASE
28
+ WHEN tab.stop_correct ~~ '%/%'::text THEN tab.stop_correct = stops.id::text
29
+ ELSE tab.stop_correct = split_part(stops.id::text, '/'::text, 1)
30
+ END OR tab.stop_correct = stops.cis::text) final
31
+ WHERE final.n_duplicit = 1
32
+ ORDER BY final.stop_correct;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.3.4-dev.705246340",
3
+ "version": "2.3.4-dev.705279523",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "@commitlint/cli": "^11.0.0",
34
34
  "@commitlint/config-conventional": "^11.0.0",
35
35
  "@golemio/cli": "1.3.3",
36
- "@golemio/core": "1.2.21",
36
+ "@golemio/core": "1.2.22-dev.694978995",
37
37
  "@golemio/db-common": "1.0.2",
38
38
  "@golemio/eslint-config": "^1.1.0",
39
39
  "@ovos-media/ts-transform-paths": "^1.7.18-1",