@golemio/pid 2.7.4-dev.878787025 → 2.7.4-dev.879847899

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', '20230525125437-presets-query-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', '20230525125437-presets-query-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,34 @@
1
+ DROP VIEW IF EXISTS analytic.v_ropid_departure_boards;
2
+
3
+ ALTER TABLE ropid_departures_presets ALTER COLUMN url_query_params TYPE character varying(250);
4
+
5
+ CREATE OR REPLACE VIEW analytic.v_ropid_departure_boards
6
+ AS SELECT final.lon,
7
+ final.lat,
8
+ final.route_name,
9
+ final.note,
10
+ final.stop_correct,
11
+ count(1) OVER (PARTITION BY (split_part(final.stop_correct, '/'::text, 1))) AS n_ceduli,
12
+ final.alt_idos_name
13
+ FROM ( SELECT stops.lon,
14
+ stops.lat,
15
+ tab.route_name,
16
+ tab.note,
17
+ tab.stop_correct,
18
+ stops.alt_idos_name,
19
+ row_number() OVER (PARTITION BY tab.note) AS n_duplicit
20
+ FROM ( SELECT rdp.route_name,
21
+ rdp.note,
22
+ CASE
23
+ WHEN rdp.url_query_params::text ~~ '%aswIds%'::text THEN replace("substring"(rdp.url_query_params::text, 'aswIds[^=]*?=(.+?(?=&|$))'::text), '_'::text, '/'::text)
24
+ WHEN rdp.url_query_params::text ~~ '%cisIds%'::text THEN "substring"(rdp.url_query_params::text, 'cisIds[^=]*?=(.+?(?=&|$))'::text)
25
+ ELSE NULL::text
26
+ END AS stop_correct
27
+ FROM ropid_departures_presets rdp) tab
28
+ LEFT JOIN ropidgtfs_cis_stops stops ON
29
+ CASE
30
+ WHEN tab.stop_correct ~~ '%/%'::text THEN tab.stop_correct = stops.id::text
31
+ ELSE tab.stop_correct = split_part(stops.id::text, '/'::text, 1)
32
+ END OR tab.stop_correct = stops.cis::text) final
33
+ WHERE final.n_duplicit = 1
34
+ ORDER BY final.stop_correct;
@@ -0,0 +1,34 @@
1
+ DROP VIEW IF EXISTS analytic.v_ropid_departure_boards;
2
+
3
+ ALTER TABLE ropid_departures_presets ALTER COLUMN url_query_params TYPE character varying(400);
4
+
5
+ CREATE OR REPLACE VIEW analytic.v_ropid_departure_boards
6
+ AS SELECT final.lon,
7
+ final.lat,
8
+ final.route_name,
9
+ final.note,
10
+ final.stop_correct,
11
+ count(1) OVER (PARTITION BY (split_part(final.stop_correct, '/'::text, 1))) AS n_ceduli,
12
+ final.alt_idos_name
13
+ FROM ( SELECT stops.lon,
14
+ stops.lat,
15
+ tab.route_name,
16
+ tab.note,
17
+ tab.stop_correct,
18
+ stops.alt_idos_name,
19
+ row_number() OVER (PARTITION BY tab.note) AS n_duplicit
20
+ FROM ( SELECT rdp.route_name,
21
+ rdp.note,
22
+ CASE
23
+ WHEN rdp.url_query_params::text ~~ '%aswIds%'::text THEN replace("substring"(rdp.url_query_params::text, 'aswIds[^=]*?=(.+?(?=&|$))'::text), '_'::text, '/'::text)
24
+ WHEN rdp.url_query_params::text ~~ '%cisIds%'::text THEN "substring"(rdp.url_query_params::text, 'cisIds[^=]*?=(.+?(?=&|$))'::text)
25
+ ELSE NULL::text
26
+ END AS stop_correct
27
+ FROM ropid_departures_presets rdp) tab
28
+ LEFT JOIN ropidgtfs_cis_stops stops ON
29
+ CASE
30
+ WHEN tab.stop_correct ~~ '%/%'::text THEN tab.stop_correct = stops.id::text
31
+ ELSE tab.stop_correct = split_part(stops.id::text, '/'::text, 1)
32
+ END OR tab.stop_correct = stops.cis::text) final
33
+ WHERE final.n_duplicit = 1
34
+ ORDER BY final.stop_correct;
@@ -14,7 +14,7 @@ const outputPresetsSDMA = {
14
14
  },
15
15
  api_version: sequelize_1.DataTypes.SMALLINT,
16
16
  route: sequelize_1.DataTypes.STRING(100),
17
- url_query_params: sequelize_1.DataTypes.STRING(250),
17
+ url_query_params: sequelize_1.DataTypes.STRING(400),
18
18
  note: sequelize_1.DataTypes.STRING(1000),
19
19
  };
20
20
  exports.outputPresetsSDMA = outputPresetsSDMA;
@@ -27,7 +27,7 @@ const datasourceJsonSchema = {
27
27
  query: {
28
28
  type: "string",
29
29
  minLength: 4,
30
- maxLength: 250,
30
+ maxLength: 400,
31
31
  },
32
32
  note: {
33
33
  type: "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.7.4-dev.878787025",
3
+ "version": "2.7.4-dev.879847899",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",