@golemio/traffic-common 0.1.0-dev.856907064 → 0.1.0-dev.877492401
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/db/example/00_reset.sql +2 -1
- package/db/example/02_sql_dump.sql +7 -0
- package/db/migrations/postgresql/20230511111340-rsd-tmc-osm-mapping-primary-key.js +53 -0
- package/db/migrations/postgresql/sqls/20230511111340-rsd-tmc-osm-mapping-primary-key-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20230511111340-rsd-tmc-osm-mapping-primary-key-up.sql +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.js +3 -3
- package/dist/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.js.map +1 -1
- package/dist/output-gateway/index.d.ts +1 -0
- package/dist/output-gateway/index.js +18 -0
- package/dist/output-gateway/index.js.map +1 -0
- package/dist/output-gateway/repositories/RsdTmcOsmMappingRepository.d.ts +10 -0
- package/dist/output-gateway/repositories/RsdTmcOsmMappingRepository.js +51 -0
- package/dist/output-gateway/repositories/RsdTmcOsmMappingRepository.js.map +1 -0
- package/dist/output-gateway/repositories/index.d.ts +1 -0
- package/dist/output-gateway/repositories/index.js +18 -0
- package/dist/output-gateway/repositories/index.js.map +1 -0
- package/package.json +3 -3
package/db/example/00_reset.sql
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
truncate table ltecze90_points_sjtsk_in_area;
|
|
1
|
+
truncate table ltecze90_points_sjtsk_in_area;
|
|
2
|
+
truncate table rsd_tmc_osm_mapping;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- EXAMPLE DATA - for testing purposes
|
|
2
|
+
INSERT INTO rsd_tmc_osm_mapping
|
|
3
|
+
(lt_start, lt_end, osm_path)
|
|
4
|
+
VALUES(1279, 25540, '[74256918, 191823166, 191823171, 74269338, 262869174, 189021819, 189021825, 74177021, 189021808, 191834725, 189021814, 189021813, 191834765, 191823161, 5506226185, 191823018, 74084348, 74282499, 1600950538, 156250951, 1600950600, 156250948, 1600950646, 74177697, 74238396, 74244807, 156250944, 156250941, 976485311, 74153579, 156250937, 156250932, 74168337, 74279965, 151003135]');
|
|
5
|
+
INSERT INTO rsd_tmc_osm_mapping
|
|
6
|
+
(lt_start, lt_end, osm_path)
|
|
7
|
+
VALUES(25631, 25632, '[156250932, 156250937, 74153579, 976485311]');
|
|
@@ -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', '20230511111340-rsd-tmc-osm-mapping-primary-key-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', '20230511111340-rsd-tmc-osm-mapping-primary-key-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
|
+
ALTER TABLE rsd_tmc_osm_mapping DROP CONSTRAINT rsd_tmc_osm_mapping_pkey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE rsd_tmc_osm_mapping ADD CONSTRAINT rsd_tmc_osm_mapping_pkey PRIMARY KEY (lt_start, lt_end);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SchemaDefinitions = exports.IntegrationEngine = void 0;
|
|
26
|
+
exports.OutputGateway = exports.SchemaDefinitions = exports.IntegrationEngine = void 0;
|
|
27
27
|
// Library exports
|
|
28
28
|
exports.IntegrationEngine = __importStar(require("./integration-engine/index"));
|
|
29
29
|
exports.SchemaDefinitions = __importStar(require("./schema-definitions/index"));
|
|
30
|
+
exports.OutputGateway = __importStar(require("./output-gateway/index"));
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,gFAA+C;AAC/C,gFAAgD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,gFAA+C;AAC/C,gFAAgD;AAChD,wEAA2C"}
|
|
@@ -27,19 +27,19 @@ class RefreshRsdTmcOsmMappingDataTask extends integration_engine_1.AbstractEmpty
|
|
|
27
27
|
yield this.repository.cleanTable();
|
|
28
28
|
}
|
|
29
29
|
catch (err) {
|
|
30
|
-
throw new golemio_errors_1.
|
|
30
|
+
throw new golemio_errors_1.GeneralError("Error while cleaning table.", this.constructor.name, err);
|
|
31
31
|
}
|
|
32
32
|
try {
|
|
33
33
|
dataStream = yield this.streamedStrategy.getRawData();
|
|
34
34
|
}
|
|
35
35
|
catch (err) {
|
|
36
|
-
throw new golemio_errors_1.
|
|
36
|
+
throw new golemio_errors_1.GeneralError("Error while getting data stream.", this.constructor.name, err);
|
|
37
37
|
}
|
|
38
38
|
try {
|
|
39
39
|
yield this.repository.streamDataIn(dataStream.data);
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
|
-
throw new golemio_errors_1.
|
|
42
|
+
throw new golemio_errors_1.GeneralError("Error while saving data.", this.constructor.name, err);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshRsdTmcOsmMappingDataTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAAwG;AAExG,
|
|
1
|
+
{"version":3,"file":"RefreshRsdTmcOsmMappingDataTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAAwG;AAExG,6EAAwE;AAGxE,MAAa,+BAAgC,SAAQ,sCAAiB;IAIlE,YACI,WAAmB,EACX,gBAA8C,EAC9C,UAAsC;QAE9C,KAAK,CAAC,WAAW,CAAC,CAAC;QAHX,qBAAgB,GAAhB,gBAAgB,CAA8B;QAC9C,eAAU,GAAV,UAAU,CAA4B;QANlC,cAAS,GAAG,yBAAyB,CAAC;QACtC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAQxD,CAAC;IAEe,OAAO;;YACnB,IAAI,UAA8B,CAAC;YAEnC,IAAI;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;aACtC;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,6BAA6B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aACrF;YAED,IAAI;gBACA,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;aACzD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,kCAAkC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC1F;YAED,IAAI;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;aACvD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,0BAA0B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAClF;QACL,CAAC;KAAA;CACJ;AAjCD,0EAiCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./repositories";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./repositories"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output-gateway/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
|
|
2
|
+
export interface LocationConfigOptions {
|
|
3
|
+
ltStart: number;
|
|
4
|
+
ltEnd: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class RsdTmcOsmMappingRepository extends SequelizeModel {
|
|
7
|
+
constructor();
|
|
8
|
+
GetOne: (options: LocationConfigOptions) => Promise<number[] | null>;
|
|
9
|
+
GetAll: () => Promise<object | null>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RsdTmcOsmMappingRepository = void 0;
|
|
13
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
14
|
+
const models_1 = require("@golemio/core/dist/output-gateway/models");
|
|
15
|
+
const _sch_1 = require("../../schema-definitions");
|
|
16
|
+
class RsdTmcOsmMappingRepository extends models_1.SequelizeModel {
|
|
17
|
+
constructor() {
|
|
18
|
+
super("RsdTmcOsmMappingRepository", _sch_1.RsdTmcOsmMappingTable.pgTableName, _sch_1.RsdTmcOsmMappingModel.attributeModel, {
|
|
19
|
+
schema: _sch_1.RsdTmcOsmMappingTable.pgSchema,
|
|
20
|
+
timestamps: false,
|
|
21
|
+
});
|
|
22
|
+
this.GetOne = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if (options.ltStart < 0 || options.ltEnd < 0) {
|
|
24
|
+
throw new golemio_errors_1.GeneralError(`ltStart and ltEnd should not be below zero`, "RsdTmcOsmMappingRepository", undefined, 500);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const where = {
|
|
28
|
+
lt_start: options.ltStart,
|
|
29
|
+
lt_end: options.ltEnd,
|
|
30
|
+
};
|
|
31
|
+
const rsdTmcOsmMappingFromDB = yield this.sequelizeModel.findOne({
|
|
32
|
+
raw: true,
|
|
33
|
+
where,
|
|
34
|
+
});
|
|
35
|
+
if (rsdTmcOsmMappingFromDB === null) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return JSON.parse(rsdTmcOsmMappingFromDB.osm_path);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
throw new golemio_errors_1.GeneralError(`GetOne error: ${err.message}`, "RsdTmcOsmMappingRepository", err, 500);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.GetAll = () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
throw new golemio_errors_1.GeneralError("Not implemented", "RsdTmcOsmMappingRepository");
|
|
46
|
+
});
|
|
47
|
+
this.sequelizeModel.removeAttribute("id");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.RsdTmcOsmMappingRepository = RsdTmcOsmMappingRepository;
|
|
51
|
+
//# sourceMappingURL=RsdTmcOsmMappingRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RsdTmcOsmMappingRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/RsdTmcOsmMappingRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAwE;AACxE,qEAA0E;AAC1E,mDAAoE;AAOpE,MAAa,0BAA2B,SAAQ,uBAAc;IAC1D;QACI,KAAK,CAAC,4BAA4B,EAAE,4BAAqB,CAAC,WAAW,EAAE,4BAAqB,CAAC,cAAc,EAAE;YACzG,MAAM,EAAE,4BAAqB,CAAC,QAAQ;YACtC,UAAU,EAAE,KAAK;SACpB,CAAC,CAAC;QAIA,WAAM,GAAG,CAAO,OAA8B,EAA4B,EAAE;YAC/E,IAAI,OAAO,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE;gBAC1C,MAAM,IAAI,6BAAY,CAAC,4CAA4C,EAAE,4BAA4B,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aACtH;YAED,IAAI;gBACA,MAAM,KAAK,GAAG;oBACV,QAAQ,EAAE,OAAO,CAAC,OAAO;oBACzB,MAAM,EAAE,OAAO,CAAC,KAAK;iBACxB,CAAC;gBAEF,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBAC7D,GAAG,EAAE,IAAI;oBACT,KAAK;iBACR,CAAC,CAAC;gBAEH,IAAI,sBAAsB,KAAK,IAAI,EAAE;oBACjC,OAAO,IAAI,CAAC;iBACf;gBACD,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;aACtD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,EAAE,4BAA4B,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAClG;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,6BAAY,CAAC,iBAAiB,EAAE,4BAA4B,CAAC,CAAC;QAC5E,CAAC,CAAA,CAAC;QA9BE,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CA8BJ;AArCD,gEAqCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RsdTmcOsmMappingRepository";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RsdTmcOsmMappingRepository"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/traffic-common",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.877492401",
|
|
4
4
|
"description": "Golemio Common Traffic Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@golemio/cli": "1.4.2",
|
|
35
|
-
"@golemio/core": "1.
|
|
35
|
+
"@golemio/core": "1.7.0-dev.877344481",
|
|
36
36
|
"@golemio/db-common": "1.1.0-dev.848192245",
|
|
37
37
|
"@golemio/eslint-config": "1.1.0",
|
|
38
38
|
"@ovos-media/ts-transform-paths": "^1.7.18-1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "4.7.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@golemio/core": ">=1.
|
|
65
|
+
"@golemio/core": ">=1.7.0"
|
|
66
66
|
},
|
|
67
67
|
"overrides": {},
|
|
68
68
|
"dependencies": {
|