@golemio/ndic 1.6.7-dev.2411589925 → 1.6.7-dev.2460425347

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', '20260408145914-fix-traffic-restrictions-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', '20260408145914-fix-traffic-restrictions-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,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', '20260414213317-ndic-traffic-info-indexes-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', '20260414213317-ndic-traffic-info-indexes-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,29 @@
1
+ create or replace function fetch_valid_traffic_restrictions(validity_datetime timestamptz)
2
+ returns setof v_traffic_restrictions_all
3
+ language sql
4
+ set search_path from current
5
+ as $function$
6
+ select *
7
+ from (
8
+ select distinct on (situation_record_id) *
9
+ from v_traffic_restrictions_all
10
+ where situation_record_id in (
11
+ select distinct situation_record_id
12
+ from v_traffic_restrictions_all
13
+ where
14
+ validity_overall_start_time < validity_datetime
15
+ and validity_overall_end_time > validity_datetime
16
+ )
17
+ order by situation_record_id, situation_record_version_time desc
18
+ ) tmp
19
+ where
20
+ tmp.validity_overall_start_time < validity_datetime
21
+ and tmp.validity_overall_end_time > validity_datetime
22
+ ;
23
+ $function$;
24
+
25
+ comment on function fetch_valid_traffic_restrictions(timestamptz) is E''
26
+ 'Get all traffic restrictions (both from Prague and from regions) with'
27
+ ' validity_overall_start_time < validity_datetime < validity_overall_end_time. Only one row per situation_record_id will be'
28
+ ' returned - the one with the highest situation_record_version_time.'
29
+ ;
@@ -0,0 +1,24 @@
1
+ create or replace function fetch_valid_traffic_restrictions(validity_datetime timestamptz)
2
+ returns setof v_traffic_restrictions_all
3
+ language sql
4
+ set search_path from current
5
+ as $function$
6
+ select distinct on (situation_record_id) *
7
+ from v_traffic_restrictions_all valid_rows
8
+ where
9
+ validity_overall_start_time < validity_datetime
10
+ and validity_overall_end_time > validity_datetime
11
+ and not exists (
12
+ select 1
13
+ from v_traffic_restrictions_all
14
+ where
15
+ situation_record_id = valid_rows.situation_record_id
16
+ and situation_record_version_time > valid_rows.situation_record_version_time
17
+ )
18
+ order by situation_record_id, situation_record_version_time desc
19
+ $function$;
20
+
21
+ comment on function fetch_valid_traffic_restrictions(timestamptz) is E''
22
+ 'Get all traffic restrictions (both from Prague and from regions) valid at validity_datetime'
23
+ ' (validity_overall_start_time < validity_datetime < validity_overall_end_time).'
24
+ ' Only one row per situation_record_id will be returned - the one with the highest situation_record_version_time.';
@@ -0,0 +1 @@
1
+ DROP INDEX IF EXISTS ndic.ndic_traffic_info_validity_idx;
@@ -0,0 +1,3 @@
1
+ -- Validity range join in rush-hour-aggregation NdicEventsFull query.
2
+ CREATE INDEX IF NOT EXISTS ndic_traffic_info_validity_idx
3
+ ON ndic.ndic_traffic_info (validity_overall_start_time, validity_overall_end_time);
@@ -8,13 +8,13 @@ class TrafficRestrictionsHelper {
8
8
  }
9
9
  exports.TrafficRestrictionsHelper = TrafficRestrictionsHelper;
10
10
  _a = TrafficRestrictionsHelper;
11
- //#region Public Methods
12
11
  TrafficRestrictionsHelper.uniqueRestrictionsArray = (arr) => {
13
- const constraintsArr = [];
12
+ const unique = new Set();
14
13
  const resultArr = [];
15
14
  for (const obj of arr) {
16
- if (!constraintsArr.includes(obj.situation_record_id + obj.situation_record_version_time)) {
17
- constraintsArr.push(obj.situation_record_id + obj.situation_record_version_time);
15
+ const key = `${obj.situation_record_id ?? ""}|${obj.situation_record_version_time ?? ""}`;
16
+ if (!unique.has(key)) {
17
+ unique.add(key);
18
18
  resultArr.push(obj);
19
19
  }
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TrafficRestrictionsHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/TrafficRestrictionsHelper.ts"],"names":[],"mappings":";;;;AAAA,0DAA8D;AAC9D,kCAA2C;AAK3C,MAAa,yBAAyB;;AAAtC,8DAiDC;;AAhDG,wBAAwB;AACV,iDAAuB,GAAG,CAAC,GAAgC,EAAE,EAAE;IACzE,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,MAAM,SAAS,GAAgC,EAAE,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACnB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,6BAA6B,CAAC,EAAE;YACvF,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC,6BAA6B,CAAC,CAAC;YACjF,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACvB;KACJ;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,AAVoC,CAUnC;AAEY,gEAAsC,GAAG,KAAK,EACxD,eAA4C,EACR,EAAE;IACtC,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE;QACnC,OAAO,CAAC,iBAAiB,GAAG,MAAM,EAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KACtF;IACD,OAAO,eAAe,CAAC;AAC3B,CAAC,AAPmD,CAOlD;AAEY,6CAAmB,GAAG,KAAK,EACrC,eAAgD,EACjB,EAAE;IACjC,IAAI,CAAC,eAAe;QAAE,OAAO,SAAS,CAAC;IAEvC,MAAM,eAAe,GAAG,kBAAa,CAAC,OAAO,CAAoB,qCAAoB,CAAC,sBAAsB,CAAC,CAAC;IAC9G,MAAM,4BAA4B,GAAG,eAAe,CAAC,iCAAiC,CAAC,cAAc,CAAC,gBAAgB,CAAC;IACvH,MAAM,8BAA8B,GAChC,eAAe,CAAC,mCAAmC,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAExF,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC;IACnF,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;IAEvF,IAAI,eAAe,IAAI,iBAAiB,EAAE;QACtC,MAAM,cAAc,GAAe;YAC/B,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACtG,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7G,CAAC;QACF,OAAO;YACH,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,YAAY;SACP,CAAC;KACnB;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,AAxBgC,CAwB/B"}
1
+ {"version":3,"file":"TrafficRestrictionsHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/TrafficRestrictionsHelper.ts"],"names":[],"mappings":";;;;AAAA,0DAA8D;AAC9D,kCAA2C;AAK3C,MAAa,yBAAyB;;AAAtC,8DAkDC;;AAjDiB,iDAAuB,GAAG,CAAC,GAAgC,EAAE,EAAE;IACzE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,MAAM,SAAS,GAAgC,EAAE,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACnB,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,mBAA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C,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACtG,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7G,CAAC;QACF,OAAO;YACH,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,YAAY;SACP,CAAC;KACnB;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,AAxBgC,CAwB/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/ndic",
3
- "version": "1.6.7-dev.2411589925",
3
+ "version": "1.6.7-dev.2460425347",
4
4
  "description": "Golemio NDIC Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",