@golemio/waze-tt 1.0.11-dev.708280182 → 1.1.0-dev.757321437

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/README.md CHANGED
@@ -35,10 +35,10 @@ The APIs may be unstable. Therefore, we recommend to install this module as an e
35
35
 
36
36
  ```bash
37
37
  # Latest version
38
- yarn add --exact @golemio/waze-tt@latest
38
+ npm install --save-exact @golemio/waze-tt@latest
39
39
 
40
40
  # Development version
41
- yarn add --exact @golemio/waze-tt@dev
41
+ npm install --save-exact @golemio/waze-tt@dev
42
42
  ```
43
43
 
44
44
  <!-- ## Description -->
@@ -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', '20230125124017-pp20230125-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', '20230125124017-pp20230125-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,36 @@
1
+ /* Replace with your SQL commands */
2
+
3
+ DROP VIEW if exists analytic.v_route_travel_times;
4
+
5
+ ALTER TABLE analytic.waze_dashboard_route_name
6
+ ALTER COLUMN route_id TYPE int;
7
+
8
+
9
+ CREATE OR REPLACE VIEW analytic.v_route_travel_times
10
+ AS SELECT ts.route_id,
11
+ ts.year,
12
+ ts.month,
13
+ ts.day,
14
+ ts.dow,
15
+ ts.hour,
16
+ ts.quarter,
17
+ ts.hour + (ts.quarter::numeric / 60::numeric)::double precision AS hour_quarter,
18
+ ((((((((ts.year || '-'::text) || ts.month) || '-'::text) || ts.day) || ' '::text) || ts.hour) || ':'::text) || ts.quarter)::timestamp without time zone AS date,
19
+ avg(ts.travel_time)::integer AS travel_time
20
+ FROM ( SELECT raw.route_id,
21
+ raw.update_time,
22
+ raw.travel_time,
23
+ date_part('year'::text, raw.update_time) AS year,
24
+ date_part('month'::text, raw.update_time) AS month,
25
+ date_part('day'::text, raw.update_time) AS day,
26
+ date_part('dow'::text, raw.update_time) AS dow,
27
+ date_part('hour'::text, raw.update_time) AS hour,
28
+ date_part('minute'::text, raw.update_time) AS minute,
29
+ date_part('minute'::text, raw.update_time)::integer / 15 * 15 AS quarter
30
+ FROM ( SELECT wazett_route_lives.route_id,
31
+ timezone('Europe/Prague'::text, to_timestamp((wazett_route_lives.update_time / 1000)::double precision)::timestamp without time zone) AS update_time,
32
+ wazett_route_lives."time" AS travel_time
33
+ FROM wazett.wazett_route_lives
34
+ JOIN analytic.waze_dashboard_route_name wdrn ON wdrn.route_id = wazett_route_lives.route_id) raw) ts
35
+ WHERE ts.year > 2000::double precision
36
+ GROUP BY ts.route_id, ts.year, ts.month, ts.day, ts.dow, ts.hour, ts.quarter;
@@ -0,0 +1,35 @@
1
+ /* Replace with your SQL commands */
2
+
3
+ DROP VIEW if exists analytic.v_route_travel_times;
4
+
5
+ ALTER TABLE analytic.waze_dashboard_route_name
6
+ ALTER COLUMN route_id TYPE bigint;
7
+
8
+ CREATE OR REPLACE VIEW analytic.v_route_travel_times
9
+ AS SELECT ts.route_id,
10
+ ts.year,
11
+ ts.month,
12
+ ts.day,
13
+ ts.dow,
14
+ ts.hour,
15
+ ts.quarter,
16
+ ts.hour + (ts.quarter::numeric / 60::numeric)::double precision AS hour_quarter,
17
+ ((((((((ts.year || '-'::text) || ts.month) || '-'::text) || ts.day) || ' '::text) || ts.hour) || ':'::text) || ts.quarter)::timestamp without time zone AS date,
18
+ avg(ts.travel_time)::integer AS travel_time
19
+ FROM ( SELECT raw.route_id,
20
+ raw.update_time,
21
+ raw.travel_time,
22
+ date_part('year'::text, raw.update_time) AS year,
23
+ date_part('month'::text, raw.update_time) AS month,
24
+ date_part('day'::text, raw.update_time) AS day,
25
+ date_part('dow'::text, raw.update_time) AS dow,
26
+ date_part('hour'::text, raw.update_time) AS hour,
27
+ date_part('minute'::text, raw.update_time) AS minute,
28
+ date_part('minute'::text, raw.update_time)::integer / 15 * 15 AS quarter
29
+ FROM ( SELECT wazett_route_lives.route_id,
30
+ timezone('Europe/Prague'::text, to_timestamp((wazett_route_lives.update_time / 1000)::double precision)::timestamp without time zone) AS update_time,
31
+ wazett_route_lives."time" AS travel_time
32
+ FROM wazett.wazett_route_lives
33
+ JOIN analytic.waze_dashboard_route_name wdrn ON wdrn.route_id = wazett_route_lives.route_id) raw) ts
34
+ WHERE ts.year > 2000::double precision
35
+ GROUP BY ts.route_id, ts.year, ts.month, ts.day, ts.dow, ts.hour, ts.quarter;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@golemio/waze-tt",
3
- "version": "1.0.11-dev.708280182",
3
+ "version": "1.1.0-dev.757321437",
4
4
  "description": "Golemio Waze TT Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
9
- "build-minimal": "run-s 'build --sourceMap false --declaration false'",
10
- "build-watch": "run-s 'build --watch --preserveWatchOutput'",
9
+ "build-minimal": "run-s 'build -- --sourceMap false --declaration false'",
10
+ "build-watch": "run-s 'build -- --watch --preserveWatchOutput'",
11
11
  "test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --check-leaks --timeout 120000 -r ts-node/register test/**/*.test.ts --exit",
12
- "test-debug": "run-s 'test --inspect-brk=9230'",
12
+ "test-debug": "run-s 'test -- --inspect-brk=9230'",
13
13
  "code-coverage": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' nyc mocha --timeout 120000 -r ts-node/register -r source-map-support/register test/**/*.test.ts --exit",
14
14
  "generate-docs": "typedoc --out docs/typedoc src",
15
15
  "lint_": "eslint {src,test}/**/*.ts",
@@ -24,6 +24,11 @@
24
24
  "type": "git",
25
25
  "url": "https://gitlab.com/operator-ict/golemio/code/modules/waze-tt"
26
26
  },
27
+ "engines": {
28
+ "node": ">=16.0.0",
29
+ "npm": ">=8.0.0",
30
+ "yarn": "Use npm!"
31
+ },
27
32
  "devDependencies": {
28
33
  "@commitlint/cli": "^11.0.0",
29
34
  "@commitlint/config-conventional": "^11.0.0",