@golemio/traffic-common 0.1.0-dev.856032789 → 0.1.0-dev.864393677
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/datasources/RsdTmcOsmMappingDataStreamFactory.d.ts +4 -0
- package/dist/integration-engine/datasources/RsdTmcOsmMappingDataStreamFactory.js +25 -0
- package/dist/integration-engine/datasources/RsdTmcOsmMappingDataStreamFactory.js.map +1 -0
- package/dist/integration-engine/ioc/Di.js +3 -3
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +1 -1
- package/dist/integration-engine/ioc/ModuleContainerToken.js +1 -1
- package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/integration-engine/repositories/RsdTmcOsmMappingRepository.d.ts +7 -3
- package/dist/integration-engine/repositories/RsdTmcOsmMappingRepository.js +31 -19
- package/dist/integration-engine/repositories/RsdTmcOsmMappingRepository.js.map +1 -1
- package/dist/integration-engine/workers/RsdTmcOsmMappingWorker.js +1 -1
- package/dist/integration-engine/workers/RsdTmcOsmMappingWorker.js.map +1 -1
- package/dist/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.d.ts +3 -5
- package/dist/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.js +15 -15
- 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/docs/implementation_documentation.md +2 -2
- package/package.json +6 -2
- package/dist/integration-engine/datasources/RsdTmcOsmMappingDataSourceFactory.d.ts +0 -4
- package/dist/integration-engine/datasources/RsdTmcOsmMappingDataSourceFactory.js +0 -36
- package/dist/integration-engine/datasources/RsdTmcOsmMappingDataSourceFactory.js.map +0 -1
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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HTTPProtocolStrategyStreamed } from "@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPProtocolStrategyStreamed";
|
|
2
|
+
export declare class RsdTmcOsmMappingDataStreamFactory {
|
|
3
|
+
getHTTPProtocolStrategyStreamed(dataUrl: string): HTTPProtocolStrategyStreamed;
|
|
4
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RsdTmcOsmMappingDataStreamFactory = void 0;
|
|
10
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
11
|
+
const HTTPProtocolStrategyStreamed_1 = require("@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPProtocolStrategyStreamed");
|
|
12
|
+
let RsdTmcOsmMappingDataStreamFactory = class RsdTmcOsmMappingDataStreamFactory {
|
|
13
|
+
getHTTPProtocolStrategyStreamed(dataUrl) {
|
|
14
|
+
return new HTTPProtocolStrategyStreamed_1.HTTPProtocolStrategyStreamed({
|
|
15
|
+
headers: {},
|
|
16
|
+
method: "GET",
|
|
17
|
+
url: dataUrl,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
RsdTmcOsmMappingDataStreamFactory = __decorate([
|
|
22
|
+
(0, tsyringe_1.injectable)()
|
|
23
|
+
], RsdTmcOsmMappingDataStreamFactory);
|
|
24
|
+
exports.RsdTmcOsmMappingDataStreamFactory = RsdTmcOsmMappingDataStreamFactory;
|
|
25
|
+
//# sourceMappingURL=RsdTmcOsmMappingDataStreamFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RsdTmcOsmMappingDataStreamFactory.js","sourceRoot":"","sources":["../../../src/integration-engine/datasources/RsdTmcOsmMappingDataStreamFactory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iEAAgE;AAChE,mJAAgJ;AAGhJ,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IACnC,+BAA+B,CAAC,OAAe;QAClD,OAAO,IAAI,2DAA4B,CAAC;YACpC,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,OAAO;SACf,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AARY,iCAAiC;IAD7C,IAAA,qBAAU,GAAE;GACA,iCAAiC,CAQ7C;AARY,8EAAiC"}
|
|
@@ -5,7 +5,7 @@ const Di_1 = require("@golemio/core/dist/integration-engine/ioc/Di");
|
|
|
5
5
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
6
6
|
const ModuleContainerToken_1 = require("./ModuleContainerToken");
|
|
7
7
|
const RsdTmcOsmMappingRepository_1 = require("../repositories/RsdTmcOsmMappingRepository");
|
|
8
|
-
const
|
|
8
|
+
const RsdTmcOsmMappingDataStreamFactory_1 = require("../datasources/RsdTmcOsmMappingDataStreamFactory");
|
|
9
9
|
const ioc_1 = require("@golemio/core/dist/integration-engine/ioc");
|
|
10
10
|
const LteCze90PointsSjtskInAreaRepository_1 = require("../repositories/LteCze90PointsSjtskInAreaRepository");
|
|
11
11
|
//#region Initialization
|
|
@@ -13,10 +13,10 @@ const TrafficCommonContainer = Di_1.IntegrationEngineContainer.createChildContai
|
|
|
13
13
|
exports.TrafficCommonContainer = TrafficCommonContainer;
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region Datasources
|
|
16
|
-
TrafficCommonContainer.register(ModuleContainerToken_1.ModuleContainerToken.
|
|
16
|
+
TrafficCommonContainer.register(ModuleContainerToken_1.ModuleContainerToken.RsdTmcOsmMappingDataSourceStrategy, {
|
|
17
17
|
useFactory: (0, tsyringe_1.instanceCachingFactory)(() => {
|
|
18
18
|
const config = Di_1.IntegrationEngineContainer.resolve(ioc_1.ContainerToken.Config);
|
|
19
|
-
return new
|
|
19
|
+
return new RsdTmcOsmMappingDataStreamFactory_1.RsdTmcOsmMappingDataStreamFactory().getHTTPProtocolStrategyStreamed(config.datasources.TrafficCommon.RsdTmcOsmMapping.url);
|
|
20
20
|
}),
|
|
21
21
|
});
|
|
22
22
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AAC1F,iEAAiG;AACjG,iEAA8D;AAE9D,2FAAyF;AACzF,wGAAsG;AACtG,mEAA2E;AAC3E,6GAA2G;AAE3G,wBAAwB;AACxB,MAAM,sBAAsB,GAAwB,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AAC1F,iEAAiG;AACjG,iEAA8D;AAE9D,2FAAyF;AACzF,wGAAsG;AACtG,mEAA2E;AAC3E,6GAA2G;AAE3G,wBAAwB;AACxB,MAAM,sBAAsB,GAAwB,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;AAoC7F,wDAAsB;AAnC/B,YAAY;AAEZ,qBAAqB;AACrB,sBAAsB,CAAC,QAAQ,CAA+B,2CAAoB,CAAC,kCAAkC,EAAE;IACnH,UAAU,EAAE,IAAA,iCAAsB,EAA+B,GAAG,EAAE;QAClE,MAAM,MAAM,GAAmB,+BAA0B,CAAC,OAAO,CAAC,oBAAc,CAAC,MAAM,CAAC,CAAC;QACzF,OAAO,IAAI,qEAAiC,EAAE,CAAC,+BAA+B,CAC1E,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CACxD,CAAC;IACN,CAAC,CAAC;CACL,CAAC,CAAC;AACH,YAAY;AAEZ,yBAAyB;AAEzB,YAAY;AAEZ,iBAAiB;AAEjB,YAAY;AAEZ,sBAAsB;AACtB,sBAAsB,CAAC,iBAAiB,CACpC,2CAAoB,CAAC,0BAA0B,EAC/C,uDAA0B,CAC7B,CAAC,QAAQ,CACN,2CAAoB,CAAC,mCAAmC,EACxD,yEAAmC,CACtC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModuleContainerToken = void 0;
|
|
4
4
|
const ModuleContainerToken = {
|
|
5
|
-
|
|
5
|
+
RsdTmcOsmMappingDataSourceStrategy: Symbol(),
|
|
6
6
|
RsdTmcOsmMappingRepository: Symbol(),
|
|
7
7
|
LteCze90PointsSjtskInAreaRepository: Symbol(),
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,
|
|
1
|
+
{"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,kCAAkC,EAAE,MAAM,EAAE;IAC5C,0BAA0B,EAAE,MAAM,EAAE;IACpC,mCAAmC,EAAE,MAAM,EAAE;CAChD,CAAC;AAEO,oDAAoB"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
3
|
import IPostgresConnector from "@golemio/core/dist/integration-engine/connectors/interfaces/IPostgresConnector";
|
|
3
|
-
import {
|
|
4
|
+
import { ILogger } from "@golemio/core/dist/helpers";
|
|
5
|
+
import { Readable } from "stream";
|
|
4
6
|
export declare class RsdTmcOsmMappingRepository extends PostgresModel implements IModel {
|
|
5
7
|
private connector;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
private logger;
|
|
9
|
+
constructor(connector: IPostgresConnector, logger: ILogger);
|
|
10
|
+
cleanTable(): Promise<void>;
|
|
11
|
+
streamDataIn(data: Readable): Promise<void>;
|
|
8
12
|
}
|
|
@@ -28,8 +28,9 @@ const RsdTmcOsmMappingModel_1 = require("../../schema-definitions/models/RsdTmcO
|
|
|
28
28
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
29
29
|
const ioc_1 = require("@golemio/core/dist/integration-engine/ioc");
|
|
30
30
|
const _sch_1 = require("../../schema-definitions");
|
|
31
|
+
const pg_copy_streams_1 = require("pg-copy-streams");
|
|
31
32
|
let RsdTmcOsmMappingRepository = class RsdTmcOsmMappingRepository extends models_1.PostgresModel {
|
|
32
|
-
constructor(connector) {
|
|
33
|
+
constructor(connector, logger) {
|
|
33
34
|
super("RsdTmcOsmMappingRepository", {
|
|
34
35
|
outputSequelizeAttributes: RsdTmcOsmMappingModel_1.RsdTmcOsmMappingModel.attributeModel,
|
|
35
36
|
pgTableName: _sch_1.RsdTmcOsmMappingTable.pgTableName,
|
|
@@ -41,33 +42,44 @@ let RsdTmcOsmMappingRepository = class RsdTmcOsmMappingRepository extends models
|
|
|
41
42
|
},
|
|
42
43
|
}, new golemio_validator_1.JSONSchemaValidator("RsdTmcOsmMappingValidator", RsdTmcOsmMappingModel_1.RsdTmcOsmMappingModel.jsonSchema));
|
|
43
44
|
this.connector = connector;
|
|
45
|
+
this.logger = logger;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
cleanTable() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
yield this.sequelizeModel.destroy({
|
|
50
|
+
truncate: true,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
streamDataIn(data) {
|
|
46
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
56
|
const connection = this.connector.getConnection();
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
const client = yield connection.connectionManager.getConnection({ type: "write" });
|
|
58
|
+
// copy transformed data to tmp table by stream
|
|
59
|
+
yield new Promise((resolve, reject) => {
|
|
60
|
+
const stream = client
|
|
61
|
+
.query((0, pg_copy_streams_1.from)(`COPY "${_sch_1.RsdTmcOsmMappingTable.pgSchema}".${_sch_1.RsdTmcOsmMappingTable.pgTableName}
|
|
62
|
+
FROM STDIN DELIMITER ',' CSV HEADER;`))
|
|
63
|
+
.on("error", (err) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
this.logger.error(`Copying data error (${this.name}): ${err.toString()}`);
|
|
65
|
+
yield connection.connectionManager.releaseConnection(client);
|
|
66
|
+
return reject(err);
|
|
67
|
+
}))
|
|
68
|
+
.on("finish", () => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
this.logger.info(`Done copying data (${this.name})`);
|
|
70
|
+
yield connection.connectionManager.releaseConnection(client);
|
|
71
|
+
return resolve();
|
|
72
|
+
}));
|
|
73
|
+
data.pipe(stream);
|
|
74
|
+
});
|
|
64
75
|
});
|
|
65
76
|
}
|
|
66
77
|
};
|
|
67
78
|
RsdTmcOsmMappingRepository = __decorate([
|
|
68
79
|
(0, tsyringe_1.injectable)(),
|
|
69
80
|
__param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.PostgresConnector)),
|
|
70
|
-
|
|
81
|
+
__param(1, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Logger)),
|
|
82
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
71
83
|
], RsdTmcOsmMappingRepository);
|
|
72
84
|
exports.RsdTmcOsmMappingRepository = RsdTmcOsmMappingRepository;
|
|
73
85
|
//# sourceMappingURL=RsdTmcOsmMappingRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RsdTmcOsmMappingRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/RsdTmcOsmMappingRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAqF;AACrF,iEAAwE;AACxE,iGAA0E;AAC1E,mFAAkF;AAClF,mEAA2E;AAE3E,
|
|
1
|
+
{"version":3,"file":"RsdTmcOsmMappingRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/RsdTmcOsmMappingRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAqF;AACrF,iEAAwE;AACxE,iGAA0E;AAC1E,mFAAkF;AAClF,mEAA2E;AAE3E,mDAA6C;AAC7C,qDAAmD;AAKnD,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,sBAAa;IACzD,YACsD,SAA6B,EACxC,MAAe;QAEtD,KAAK,CACD,4BAA4B,EAC5B;YACI,yBAAyB,EAAE,6CAAqB,CAAC,cAAc;YAC/D,WAAW,EAAE,4BAAqB,CAAC,WAAW;YAC9C,QAAQ,EAAE,4BAAqB,CAAC,QAAQ;YACxC,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,CAAC;YAC1B,2BAA2B,EAAE;gBACzB,UAAU,EAAE,KAAK;aACpB;SACJ,EACD,IAAI,uCAAmB,CAAC,2BAA2B,EAAE,6CAAqB,CAAC,UAAU,CAAC,CACzF,CAAC;QAhBgD,cAAS,GAAT,SAAS,CAAoB;QACxC,WAAM,GAAN,MAAM,CAAS;IAgB1D,CAAC;IAEY,UAAU;;YACnB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAC9B,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC;KAAA;IAEY,YAAY,CAAC,IAAc;;YACpC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YAClD,MAAM,MAAM,GAAQ,MAAM,UAAU,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAExF,+CAA+C;YAC/C,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACxC,MAAM,MAAM,GAAG,MAAM;qBAChB,KAAK,CACF,IAAA,sBAAQ,EACJ,SAAS,4BAAqB,CAAC,QAAQ,KAAK,4BAAqB,CAAC,WAAW;6DACxC,CACxC,CACJ;qBACA,EAAE,CAAC,OAAO,EAAE,CAAO,GAAQ,EAAE,EAAE;oBAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,IAAI,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;oBAC1E,MAAM,UAAU,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;oBAC7D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBACvB,CAAC,CAAA,CAAC;qBACD,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;oBACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;oBACrD,MAAM,UAAU,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;oBAC7D,OAAO,OAAO,EAAE,CAAC;gBACrB,CAAC,CAAA,CAAC,CAAC;gBACP,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAA;AArDY,0BAA0B;IADtC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,iBAAiB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,MAAM,CAAC,CAAA;;GAHzB,0BAA0B,CAqDtC;AArDY,gEAA0B"}
|
|
@@ -9,7 +9,7 @@ class RsdTmcOsmMappingWorker extends integration_engine_1.AbstractWorker {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super();
|
|
11
11
|
this.name = "RsdTmcOsmMapping";
|
|
12
|
-
this.registerTask(new RefreshRsdTmcOsmMappingDataTask_1.RefreshRsdTmcOsmMappingDataTask(this.getQueuePrefix(), Di_1.TrafficCommonContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.
|
|
12
|
+
this.registerTask(new RefreshRsdTmcOsmMappingDataTask_1.RefreshRsdTmcOsmMappingDataTask(this.getQueuePrefix(), Di_1.TrafficCommonContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.RsdTmcOsmMappingDataSourceStrategy), Di_1.TrafficCommonContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.RsdTmcOsmMappingRepository)));
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.RsdTmcOsmMappingWorker = RsdTmcOsmMappingWorker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RsdTmcOsmMappingWorker.js","sourceRoot":"","sources":["../../../src/integration-engine/workers/RsdTmcOsmMappingWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AACvE,6FAA0F;AAC1F,sEAAoE;AACpE,kCAAoD;AAEpD,MAAa,sBAAuB,SAAQ,mCAAc;IAGtD;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,kBAAkB,CAAC;QAIhC,IAAI,CAAC,YAAY,CACb,IAAI,iEAA+B,CAC/B,IAAI,CAAC,cAAc,EAAE,EACrB,2BAAsB,CAAC,OAAO,CAAC,2CAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"RsdTmcOsmMappingWorker.js","sourceRoot":"","sources":["../../../src/integration-engine/workers/RsdTmcOsmMappingWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AACvE,6FAA0F;AAC1F,sEAAoE;AACpE,kCAAoD;AAEpD,MAAa,sBAAuB,SAAQ,mCAAc;IAGtD;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,kBAAkB,CAAC;QAIhC,IAAI,CAAC,YAAY,CACb,IAAI,iEAA+B,CAC/B,IAAI,CAAC,cAAc,EAAE,EACrB,2BAAsB,CAAC,OAAO,CAAC,2CAAoB,CAAC,kCAAkC,CAAC,EACvF,2BAAsB,CAAC,OAAO,CAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAClF,CACJ,CAAC;IACN,CAAC;CACJ;AAbD,wDAaC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { AbstractEmptyTask,
|
|
1
|
+
import { AbstractEmptyTask, HTTPProtocolStrategyStreamed } from "@golemio/core/dist/integration-engine";
|
|
2
2
|
import { RsdTmcOsmMappingRepository } from "../../repositories/RsdTmcOsmMappingRepository";
|
|
3
3
|
export declare class RefreshRsdTmcOsmMappingDataTask extends AbstractEmptyTask {
|
|
4
|
-
private
|
|
4
|
+
private streamedStrategy;
|
|
5
5
|
private repository;
|
|
6
6
|
readonly queueName = "RsdTmsOsmMappingRefresh";
|
|
7
7
|
readonly queueTtl: number;
|
|
8
|
-
constructor(queuePrefix: string,
|
|
8
|
+
constructor(queuePrefix: string, streamedStrategy: HTTPProtocolStrategyStreamed, repository: RsdTmcOsmMappingRepository);
|
|
9
9
|
protected execute(): Promise<void>;
|
|
10
|
-
private onDataFunction;
|
|
11
|
-
private processDataStream;
|
|
12
10
|
}
|
|
@@ -13,34 +13,34 @@ exports.RefreshRsdTmcOsmMappingDataTask = void 0;
|
|
|
13
13
|
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
14
14
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
15
15
|
class RefreshRsdTmcOsmMappingDataTask extends integration_engine_1.AbstractEmptyTask {
|
|
16
|
-
constructor(queuePrefix,
|
|
16
|
+
constructor(queuePrefix, streamedStrategy, repository) {
|
|
17
17
|
super(queuePrefix);
|
|
18
|
-
this.
|
|
18
|
+
this.streamedStrategy = streamedStrategy;
|
|
19
19
|
this.repository = repository;
|
|
20
20
|
this.queueName = "RsdTmsOsmMappingRefresh";
|
|
21
21
|
this.queueTtl = 59 * 60 * 1000; // 59 minutes
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.processDataStream = (dataSourceStream, onDataFunction) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
}
|
|
23
|
+
execute() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
25
|
let dataStream;
|
|
27
26
|
try {
|
|
28
|
-
|
|
27
|
+
yield this.repository.cleanTable();
|
|
29
28
|
}
|
|
30
29
|
catch (err) {
|
|
31
|
-
throw new golemio_errors_1.CustomError("Error while
|
|
30
|
+
throw new golemio_errors_1.CustomError("Error while cleaning table.", true, this.constructor.name, 5050, err);
|
|
32
31
|
}
|
|
33
32
|
try {
|
|
34
|
-
yield
|
|
33
|
+
dataStream = yield this.streamedStrategy.getRawData();
|
|
35
34
|
}
|
|
36
35
|
catch (err) {
|
|
37
|
-
throw new golemio_errors_1.CustomError("Error while
|
|
36
|
+
throw new golemio_errors_1.CustomError("Error while getting data stream.", true, this.constructor.name, 5050, err);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
yield this.repository.streamDataIn(dataStream.data);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw new golemio_errors_1.CustomError("Error while saving data.", true, this.constructor.name, 5051, err);
|
|
38
43
|
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
execute() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
yield this.processDataStream(this.dataSource.getAll(true), this.onDataFunction);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshRsdTmcOsmMappingDataTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"RefreshRsdTmcOsmMappingDataTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/RefreshRsdTmcOsmMappingDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAAwG;AAExG,6EAAuE;AAGvE,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,4BAAW,CAAC,6BAA6B,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;aAChG;YAED,IAAI;gBACA,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;aACzD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,4BAAW,CAAC,kCAAkC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;aACrG;YAED,IAAI;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;aACvD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,4BAAW,CAAC,0BAA0B,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;aAC7F;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.CustomError(`ltStart and ltEnd should not be below zero`, true, "RsdTmcOsmMappingRepository", 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.CustomError(`GetOne error: ${err.message}`, true, "RsdTmcOsmMappingRepository", 500, err);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.GetAll = () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
throw new golemio_errors_1.CustomError("Not implemented", true, "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,6EAAuE;AACvE,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,4BAAW,CAAC,4CAA4C,EAAE,IAAI,EAAE,4BAA4B,EAAE,GAAG,CAAC,CAAC;aAChH;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,4BAAW,CAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACvG;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,4BAAW,CAAC,iBAAiB,EAAE,IAAI,EAAE,4BAA4B,CAAC,CAAC;QACjF,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"}
|
|
@@ -30,7 +30,6 @@ Modul spravuje dopravní data využívaná ostatními moduly (konkrétně NDIC a
|
|
|
30
30
|
- název rabbitmq fronty
|
|
31
31
|
- dataplatform.RsdTmcOsmMapping.RsdTmsOsmMappingRefresh
|
|
32
32
|
|
|
33
|
-
|
|
34
33
|
### *RsdTmcOsmMappingWorker*
|
|
35
34
|
|
|
36
35
|
#### *task: RefreshRsdTmcOsmMappingDataTask*
|
|
@@ -40,6 +39,7 @@ Modul spravuje dopravní data využívaná ostatními moduly (konkrétně NDIC a
|
|
|
40
39
|
- bez parametrů
|
|
41
40
|
- datové zdroje
|
|
42
41
|
- RsdTmcOsmMapping CSV
|
|
42
|
+
- data se streamují napřímo do databáze
|
|
43
43
|
- data modely
|
|
44
44
|
- RsdTmcOsmMappingModel -> (schéma traffic) `rsd_tmc_osm_mapping`
|
|
45
45
|
|
|
@@ -50,5 +50,5 @@ Modul spravuje dopravní data využívaná ostatními moduly (konkrétně NDIC a
|
|
|
50
50
|
- tabulka
|
|
51
51
|
- `traffic.rsd_tmc_osm_mapping`
|
|
52
52
|
- retence dat
|
|
53
|
-
- task
|
|
53
|
+
- task obnoví data při každém běhu
|
|
54
54
|
|
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.864393677",
|
|
4
4
|
"description": "Golemio Common Traffic Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@types/chai-as-promised": "7.1.2",
|
|
41
41
|
"@types/mocha": "^9.1.0",
|
|
42
42
|
"@types/node": "^18.13.0",
|
|
43
|
+
"@types/pg-copy-streams": "^1.2.2",
|
|
43
44
|
"@types/sinon": "^9.0.10",
|
|
44
45
|
"@types/supertest": "^2.0.12",
|
|
45
46
|
"chai": "4.2.0",
|
|
@@ -63,5 +64,8 @@
|
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@golemio/core": ">=1.6.5"
|
|
65
66
|
},
|
|
66
|
-
"overrides": {}
|
|
67
|
+
"overrides": {},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"pg-copy-streams": "^6.0.5"
|
|
70
|
+
}
|
|
67
71
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.RsdTmcOsmMappingDataSourceFactory = void 0;
|
|
10
|
-
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
11
|
-
const _sch_1 = require("../../schema-definitions");
|
|
12
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
13
|
-
const HTTPProtocolStrategyStreamed_1 = require("@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPProtocolStrategyStreamed");
|
|
14
|
-
let RsdTmcOsmMappingDataSourceFactory = class RsdTmcOsmMappingDataSourceFactory {
|
|
15
|
-
getDataSource(dataUrl) {
|
|
16
|
-
return new integration_engine_1.DataSourceStreamed(_sch_1.RsdTmcOsmMappingTable.name + "DataSource", new HTTPProtocolStrategyStreamed_1.HTTPProtocolStrategyStreamed({
|
|
17
|
-
headers: {},
|
|
18
|
-
method: "GET",
|
|
19
|
-
url: dataUrl,
|
|
20
|
-
}), new integration_engine_1.CSVDataTypeStrategy({
|
|
21
|
-
fastcsvParams: {
|
|
22
|
-
headers: true,
|
|
23
|
-
},
|
|
24
|
-
subscribe: (row) => ({
|
|
25
|
-
lt_start: Number(row.lt_start),
|
|
26
|
-
lt_end: Number(row.lt_end),
|
|
27
|
-
osm_path: row.osm_path,
|
|
28
|
-
}),
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
RsdTmcOsmMappingDataSourceFactory = __decorate([
|
|
33
|
-
(0, tsyringe_1.injectable)()
|
|
34
|
-
], RsdTmcOsmMappingDataSourceFactory);
|
|
35
|
-
exports.RsdTmcOsmMappingDataSourceFactory = RsdTmcOsmMappingDataSourceFactory;
|
|
36
|
-
//# sourceMappingURL=RsdTmcOsmMappingDataSourceFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RsdTmcOsmMappingDataSourceFactory.js","sourceRoot":"","sources":["../../../src/integration-engine/datasources/RsdTmcOsmMappingDataSourceFactory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8EAAgG;AAChG,mDAA6C;AAC7C,iEAAgE;AAChE,mJAAgJ;AAGhJ,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IACnC,aAAa,CAAC,OAAe;QAChC,OAAO,IAAI,uCAAkB,CACzB,4BAAqB,CAAC,IAAI,GAAG,YAAY,EACzC,IAAI,2DAA4B,CAAC;YAC7B,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,OAAO;SACf,CAAC,EACF,IAAI,wCAAmB,CAAC;YACpB,aAAa,EAAE;gBACX,OAAO,EAAE,IAAI;aAChB;YACD,SAAS,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC;gBACtB,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAC9B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;aACzB,CAAC;SACL,CAAC,CACL,CAAC;IACN,CAAC;CACJ,CAAA;AArBY,iCAAiC;IAD7C,IAAA,qBAAU,GAAE;GACA,iCAAiC,CAqB7C;AArBY,8EAAiC"}
|