@golemio/pid 4.0.1 → 4.0.2-dev.1981729168
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/dist/helpers/GtfsStopParser.d.ts +2 -0
- package/dist/helpers/GtfsStopParser.js +11 -8
- package/dist/helpers/GtfsStopParser.js.map +1 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +0 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
- package/dist/integration-engine/jis/ioc/Di.js +8 -0
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +3 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +4 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +9 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +78 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +1 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +6 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +50 -2
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
- package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +11 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +42 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +1 -0
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +1 -2
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +5 -4
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.d.ts +18 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js +44 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.d.ts +5 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +24 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/index.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/index.js +1 -0
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +8 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +3 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +3 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +8 -5
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts +12 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js +44 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.d.ts +12 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +87 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/schema-definitions/jis/redis/const.d.ts +1 -0
- package/dist/schema-definitions/jis/redis/const.js +2 -1
- package/dist/schema-definitions/jis/redis/const.js.map +1 -1
- package/dist/schema-definitions/ropid-departures-presets/index.d.ts +1 -0
- package/dist/schema-definitions/ropid-departures-presets/index.js +3 -0
- package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +16 -0
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +3 -0
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +1 -0
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +1 -0
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +58 -0
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +69 -0
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +1 -0
- package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +1 -0
- package/dist/schema-definitions/ropid-gtfs/redis/const.js +2 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
- package/docs/asyncapi.yaml +45 -0
- package/docs/cache/types/redis.md +82 -2
- package/docs/jis/index.md +15 -5
- package/docs/openapi-input.yaml +13 -2
- package/package.json +2 -2
|
@@ -15,16 +15,12 @@ let GtfsStopParser = exports.GtfsStopParser = class GtfsStopParser {
|
|
|
15
15
|
prepareAswWhereOptions(aswIds) {
|
|
16
16
|
let aswWhereOptions = [];
|
|
17
17
|
for (const aswId of aswIds) {
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
aswIdLike = aswIdLike.slice(0, -1);
|
|
21
|
-
}
|
|
22
|
-
const [nodeId, stopId] = aswIdLike.split("/");
|
|
23
|
-
if (!nodeId) {
|
|
18
|
+
const { aswNode, aswStopId } = this.parseAswId(aswId);
|
|
19
|
+
if (!aswNode) {
|
|
24
20
|
continue;
|
|
25
21
|
}
|
|
26
|
-
this.validateAswId(aswId,
|
|
27
|
-
aswWhereOptions.push(sequelize_1.Sequelize.and(sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_node_id"), "=",
|
|
22
|
+
this.validateAswId(aswId, aswNode, aswStopId);
|
|
23
|
+
aswWhereOptions.push(sequelize_1.Sequelize.and(sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_node_id"), "=", aswNode), aswStopId && sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_stop_id"), "=", aswStopId)));
|
|
28
24
|
}
|
|
29
25
|
return aswWhereOptions;
|
|
30
26
|
}
|
|
@@ -37,6 +33,13 @@ let GtfsStopParser = exports.GtfsStopParser = class GtfsStopParser {
|
|
|
37
33
|
throw new golemio_errors_1.GeneralError(`Invalid ASW ID: ${aswId}`, this.constructor.name, `Invalid ASW ID: ${aswId}`, 400);
|
|
38
34
|
}
|
|
39
35
|
}
|
|
36
|
+
parseAswId(aswId) {
|
|
37
|
+
const [aswNode, aswStopId] = aswId.replaceAll("_", "/").split("/");
|
|
38
|
+
return { aswNode, aswStopId };
|
|
39
|
+
}
|
|
40
|
+
getAswNodeFromId(aswId) {
|
|
41
|
+
return this.parseAswId(aswId).aswNode;
|
|
42
|
+
}
|
|
40
43
|
};
|
|
41
44
|
exports.GtfsStopParser = GtfsStopParser = __decorate([
|
|
42
45
|
(0, tsyringe_1.injectable)()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GtfsStopParser.js","sourceRoot":"","sources":["../../src/helpers/GtfsStopParser.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6EAAwE;AACxE,mEAA8E;AAC9E,iEAAgE;AAChE,oCAAmD;AAG5C,IAAM,cAAc,4BAApB,MAAM,cAAc;IAChB,sBAAsB,CAAC,MAAgB;QAC1C,IAAI,eAAe,GAAmB,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YACxB,
|
|
1
|
+
{"version":3,"file":"GtfsStopParser.js","sourceRoot":"","sources":["../../src/helpers/GtfsStopParser.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6EAAwE;AACxE,mEAA8E;AAC9E,iEAAgE;AAChE,oCAAmD;AAG5C,IAAM,cAAc,4BAApB,MAAM,cAAc;IAChB,sBAAsB,CAAC,MAAgB;QAC1C,IAAI,eAAe,GAAmB,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YACxB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,OAAO,EAAE;gBACV,SAAS;aACZ;YACD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAE9C,eAAe,CAAC,IAAI,CAChB,qBAAS,CAAC,GAAG,CACT,qBAAS,CAAC,KAAK,CAAC,qBAAS,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAC3D,SAAS,IAAI,qBAAS,CAAC,KAAK,CAAC,qBAAS,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,CAC7E,CACJ,CAAC;SACL;QACD,OAAO,eAAe,CAAC;IAC3B,CAAC;IAEO,cAAc,CAAC,KAAa;QAChC,OAAO,KAAK,IAAI,kBAAU,IAAI,KAAK,IAAI,kBAAU,CAAC;IACtD,CAAC;IAEO,aAAa,CAAC,KAAa,EAAE,MAAc,EAAE,MAAe;QAChE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACrF,MAAM,IAAI,6BAAY,CAAC,mBAAmB,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,mBAAmB,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;SAC9G;IACL,CAAC;IAEO,UAAU,CAAC,KAAa;QAI5B,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;IAC1C,CAAC;CACJ,CAAA;yBA3CY,cAAc;IAD1B,IAAA,qBAAU,GAAE;GACA,cAAc,CA2C1B"}
|
|
@@ -20,7 +20,6 @@ class VehiclePositionsController extends controllers_1.BaseController {
|
|
|
20
20
|
const dataBatches = this.splitData(inputData);
|
|
21
21
|
for (const batch of dataBatches) {
|
|
22
22
|
await this.sendMessageToExchange("input." + this.queuePrefix + ".saveDataToDB", JSON.stringify(batch), {
|
|
23
|
-
persistent: true,
|
|
24
23
|
timestamp: new Date().getTime(),
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VehiclePositionsController.js","sourceRoot":"","sources":["../../../src/input-gateway/vehicle-positions/VehiclePositionsController.ts"],"names":[],"mappings":";;;AAAA,kFAA0D;AAG1D,wEAAqE;AACrE,8EAA8E;AAC9E,8DAA6E;AAC7E,6EAA8F;AAC9F,mFAAkF;AAElF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAa,0BAA2B,SAAQ,4BAAc;IAM1D;QACI,KAAK,CACD,oCAAgB,CAAC,IAAI,EACrB,IAAI,uCAAmB,CAAC,oCAAgB,CAAC,IAAI,GAAG,YAAY,EAAE,oCAAgB,CAAC,oBAAoB,CAAC,CACvG,CAAC;QAMN;;WAEG;QACI,gBAAW,GAAG,KAAK,EAAE,SAA2B,EAAiB,EAAE;YACtE,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB;gBAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAC9C,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE;oBAC7B,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;wBACnG,
|
|
1
|
+
{"version":3,"file":"VehiclePositionsController.js","sourceRoot":"","sources":["../../../src/input-gateway/vehicle-positions/VehiclePositionsController.ts"],"names":[],"mappings":";;;AAAA,kFAA0D;AAG1D,wEAAqE;AACrE,8EAA8E;AAC9E,8DAA6E;AAC7E,6EAA8F;AAC9F,mFAAkF;AAElF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAa,0BAA2B,SAAQ,4BAAc;IAM1D;QACI,KAAK,CACD,oCAAgB,CAAC,IAAI,EACrB,IAAI,uCAAmB,CAAC,oCAAgB,CAAC,IAAI,GAAG,YAAY,EAAE,oCAAgB,CAAC,oBAAoB,CAAC,CACvG,CAAC;QAMN;;WAEG;QACI,gBAAW,GAAG,KAAK,EAAE,SAA2B,EAAiB,EAAE;YACtE,IAAI;g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vC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;QArCE,MAAM,MAAM,GAAG,2BAAqB,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QACpF,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,4CAA4C,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/G,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CAmCJ;AAjDD,gEAiDC"}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JISContainer = void 0;
|
|
4
4
|
const Di_1 = require("../../ioc/Di");
|
|
5
|
+
const RopidGTFSStopsModel_1 = require("../../ropid-gtfs/RopidGTFSStopsModel");
|
|
5
6
|
const JISEventsDataSourceFactory_1 = require("../datasources/JISEventsDataSourceFactory");
|
|
6
7
|
const JISInfotextsDataSourceFactory_1 = require("../datasources/JISInfotextsDataSourceFactory");
|
|
7
8
|
const JISEventsRepository_1 = require("../repositories/JISEventsRepository");
|
|
8
9
|
const JISEventsRopidGTFSRoutesRepository_1 = require("../repositories/JISEventsRopidGTFSRoutesRepository");
|
|
10
|
+
const JISInfotextsRedisRepository_1 = require("../repositories/JISInfotextsRedisRepository");
|
|
9
11
|
const JISInfotextsRepository_1 = require("../repositories/JISInfotextsRepository");
|
|
10
12
|
const JISInfotextsRopidGTFSStopsRepository_1 = require("../repositories/JISInfotextsRopidGTFSStopsRepository");
|
|
11
13
|
const JISMetadataRepository_1 = require("../repositories/JISMetadataRepository");
|
|
@@ -17,6 +19,7 @@ const JISInfotextsTransformation_1 = require("../transformations/JISInfotextsTra
|
|
|
17
19
|
const FetchJISEventsTask_1 = require("../workers/tasks/FetchJISEventsTask");
|
|
18
20
|
const FetchJISInfotextsTask_1 = require("../workers/tasks/FetchJISInfotextsTask");
|
|
19
21
|
const RefreshJISEventsTask_1 = require("../workers/tasks/RefreshJISEventsTask");
|
|
22
|
+
const RefreshJISInfotextsCacheTask_1 = require("../workers/tasks/RefreshJISInfotextsCacheTask");
|
|
20
23
|
const RefreshJISInfotextsTask_1 = require("../workers/tasks/RefreshJISInfotextsTask");
|
|
21
24
|
const JISContainerToken_1 = require("./JISContainerToken");
|
|
22
25
|
//#region Initialization
|
|
@@ -27,12 +30,16 @@ exports.JISContainer = JISContainer;
|
|
|
27
30
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsDataSourceFactory, JISEventsDataSourceFactory_1.JISEventsDataSourceFactory);
|
|
28
31
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory, JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory);
|
|
29
32
|
//#endregion
|
|
33
|
+
//#region Cache Repositories
|
|
34
|
+
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRedisRepository, JISInfotextsRedisRepository_1.JISInfotextsRedisRepository);
|
|
35
|
+
//#endregion
|
|
30
36
|
//#region Repositories
|
|
31
37
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRepository, JISEventsRepository_1.JISEventsRepository);
|
|
32
38
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRopidGTFSRoutesRepository, JISEventsRopidGTFSRoutesRepository_1.JISEventsRopidGTFSRoutesRepository);
|
|
33
39
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRepository, JISInfotextsRepository_1.JISInfotextsRepository);
|
|
34
40
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository);
|
|
35
41
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISMetadataRepository, JISMetadataRepository_1.JISMetadataRepository);
|
|
42
|
+
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository, RopidGTFSStopsModel_1.RopidGTFSStopsModel);
|
|
36
43
|
//#endregion
|
|
37
44
|
//#region Services
|
|
38
45
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsDataService, JISEventsDataService_1.JISEventsDataService);
|
|
@@ -43,6 +50,7 @@ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISEve
|
|
|
43
50
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask, FetchJISInfotextsTask_1.FetchJISInfotextsTask);
|
|
44
51
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISEventsTask, RefreshJISEventsTask_1.RefreshJISEventsTask);
|
|
45
52
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask, RefreshJISInfotextsTask_1.RefreshJISInfotextsTask);
|
|
53
|
+
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsCacheTask, RefreshJISInfotextsCacheTask_1.RefreshJISInfotextsCacheTask);
|
|
46
54
|
//#endregion
|
|
47
55
|
//#region Transformations
|
|
48
56
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsTransformation, JISEventsTransformation_1.JISEventsTransformation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,8EAAyE;AAEzE,0FAAuF;AACvF,gGAA6F;AAC7F,6EAA0E;AAC1E,2GAAwG;AACxG,6FAA0F;AAC1F,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,2EAAwE;AACxE,iFAA8E;AAC9E,oGA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C;AAC1F,YAAY;AAEZ,eAAe;AACf,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,kBAAkB,EAAE,uCAAkB,CAAC,CAAC;AACzF,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAC7F,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,4BAA4B,EAAE,2DAA4B,CAAC,CAAC;AAC7G,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
declare const JISContainerToken: {
|
|
2
2
|
JISEventsDataSourceFactory: symbol;
|
|
3
3
|
JISInfotextsDataSourceFactory: symbol;
|
|
4
|
+
JISInfotextsRedisRepository: symbol;
|
|
4
5
|
JISEventsRepository: symbol;
|
|
5
6
|
JISEventsRopidGTFSRoutesRepository: symbol;
|
|
6
7
|
JISInfotextsRepository: symbol;
|
|
7
8
|
JISInfotextsRopidGTFSStopsRepository: symbol;
|
|
8
9
|
JISMetadataRepository: symbol;
|
|
10
|
+
RopidGTFSStopsRepository: symbol;
|
|
9
11
|
JISEventsDataService: symbol;
|
|
10
12
|
JISInfotextsDataService: symbol;
|
|
11
13
|
JISEventsTransformation: symbol;
|
|
@@ -15,5 +17,6 @@ declare const JISContainerToken: {
|
|
|
15
17
|
FetchJISInfotextsTask: symbol;
|
|
16
18
|
RefreshJISEventsTask: symbol;
|
|
17
19
|
RefreshJISInfotextsTask: symbol;
|
|
20
|
+
RefreshJISInfotextsCacheTask: symbol;
|
|
18
21
|
};
|
|
19
22
|
export { JISContainerToken };
|
|
@@ -5,12 +5,15 @@ const JISContainerToken = {
|
|
|
5
5
|
/* Data Sources */
|
|
6
6
|
JISEventsDataSourceFactory: Symbol("JISEventsDataSourceFactory"),
|
|
7
7
|
JISInfotextsDataSourceFactory: Symbol("JISInfotextsDataSourceFactory"),
|
|
8
|
+
/* Cache Repositories */
|
|
9
|
+
JISInfotextsRedisRepository: Symbol("JISInfotextsRedisRepository"),
|
|
8
10
|
/* Repositories */
|
|
9
11
|
JISEventsRepository: Symbol("JISEventsRepository"),
|
|
10
12
|
JISEventsRopidGTFSRoutesRepository: Symbol("JISEventsRopidGTFSRoutesRepository"),
|
|
11
13
|
JISInfotextsRepository: Symbol("JISInfotextsRepository"),
|
|
12
14
|
JISInfotextsRopidGTFSStopsRepository: Symbol("JISInfotextsRopidGTFSStopsRepository"),
|
|
13
15
|
JISMetadataRepository: Symbol("JISMetadataRepository"),
|
|
16
|
+
RopidGTFSStopsRepository: Symbol("RopidGTFSStopsRepository"),
|
|
14
17
|
/* Services */
|
|
15
18
|
JISEventsDataService: Symbol("JISEventsDataService"),
|
|
16
19
|
JISInfotextsDataService: Symbol("JISInfotextsDataService"),
|
|
@@ -23,6 +26,7 @@ const JISContainerToken = {
|
|
|
23
26
|
FetchJISInfotextsTask: Symbol("FetchJISInfotextsTask"),
|
|
24
27
|
RefreshJISEventsTask: Symbol("RefreshJISEventsTask"),
|
|
25
28
|
RefreshJISInfotextsTask: Symbol("RefreshJISInfotextsTask"),
|
|
29
|
+
RefreshJISInfotextsCacheTask: Symbol("RefreshJISInfotextsCacheTask"),
|
|
26
30
|
};
|
|
27
31
|
exports.JISContainerToken = JISContainerToken;
|
|
28
32
|
//# sourceMappingURL=JISContainerToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,wBAAwB;IACxB,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAAC;CACvE,CAAC;AAEO,8CAAiB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JISInfotextsModel } from "../../../schema-definitions/jis/models/JISInfotextsModel";
|
|
2
|
+
import { RedisModel } from "@golemio/core/dist/integration-engine";
|
|
3
|
+
export declare class JISInfotextsRedisRepository extends RedisModel {
|
|
4
|
+
static NAMESPACE_PREFIX: string;
|
|
5
|
+
constructor();
|
|
6
|
+
refreshData(infotexts: JISInfotextsModel[]): Promise<void>;
|
|
7
|
+
private createNewCache;
|
|
8
|
+
private deleteOldCache;
|
|
9
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var JISInfotextsRedisRepository_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.JISInfotextsRedisRepository = void 0;
|
|
14
|
+
const const_1 = require("../../../schema-definitions/jis/redis/const");
|
|
15
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
16
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
17
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
18
|
+
const node_crypto_1 = require("node:crypto");
|
|
19
|
+
const TTL_SECONDS_BEFORE_DELETE = 60;
|
|
20
|
+
let JISInfotextsRedisRepository = exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = class JISInfotextsRedisRepository extends integration_engine_1.RedisModel {
|
|
21
|
+
constructor() {
|
|
22
|
+
super("JISInfotextsRedisRepository", {
|
|
23
|
+
isKeyConstructedFromData: false,
|
|
24
|
+
prefix: JISInfotextsRedisRepository_1.NAMESPACE_PREFIX,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async refreshData(infotexts) {
|
|
28
|
+
try {
|
|
29
|
+
const oldSetName = (await this.connection.get(`${this.prefix}:activeSetName`)) ?? "";
|
|
30
|
+
await this.createNewCache(infotexts);
|
|
31
|
+
await this.deleteOldCache(oldSetName);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
throw new golemio_errors_1.GeneralError("refreshData failed", this.constructor.name, err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async createNewCache(infotexts) {
|
|
38
|
+
try {
|
|
39
|
+
const infotextIdsByStopId = new Map();
|
|
40
|
+
const infotextsByInfotextId = new Map();
|
|
41
|
+
for (const infotext of infotexts) {
|
|
42
|
+
infotextsByInfotextId.set(infotext.id, JSON.stringify(infotext));
|
|
43
|
+
for (const { stop_id } of infotext?.stops ?? []) {
|
|
44
|
+
let stopInfotextsIds = infotextIdsByStopId.get(stop_id) ?? [];
|
|
45
|
+
stopInfotextsIds.push(infotext.id);
|
|
46
|
+
infotextIdsByStopId.set(stop_id, stopInfotextsIds);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const setName = (0, node_crypto_1.randomBytes)(4).toString("hex");
|
|
50
|
+
const pipeline = this.connection.pipeline();
|
|
51
|
+
pipeline.hset(`${this.prefix}:${setName}:infotexts`, infotextsByInfotextId);
|
|
52
|
+
pipeline.hset(`${this.prefix}:${setName}:stops-infotexts`, infotextIdsByStopId);
|
|
53
|
+
pipeline.publish(`${this.prefix}`, `${this.prefix}:${setName}`);
|
|
54
|
+
pipeline.set(`${this.prefix}:activeSetName`, `${this.prefix}:${setName}`);
|
|
55
|
+
await pipeline.exec();
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
throw new golemio_errors_1.GeneralError("createNewCache failed", this.constructor.name, err);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async deleteOldCache(setName) {
|
|
62
|
+
try {
|
|
63
|
+
const pipeline = this.connection.pipeline();
|
|
64
|
+
pipeline.expire(`${setName}:infotexts`, TTL_SECONDS_BEFORE_DELETE);
|
|
65
|
+
pipeline.expire(`${setName}:stops-infotexts`, TTL_SECONDS_BEFORE_DELETE);
|
|
66
|
+
await pipeline.exec();
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
throw new golemio_errors_1.GeneralError("deleteOldCache failed", this.constructor.name, err);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
JISInfotextsRedisRepository.NAMESPACE_PREFIX = const_1.JIS_NAMESPACE_PREFIX;
|
|
74
|
+
exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = __decorate([
|
|
75
|
+
(0, tsyringe_1.injectable)(),
|
|
76
|
+
__metadata("design:paramtypes", [])
|
|
77
|
+
], JISInfotextsRedisRepository);
|
|
78
|
+
//# sourceMappingURL=JISInfotextsRedisRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JISInfotextsRedisRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRedisRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,uEAA4D;AAC5D,8EAAmE;AACnE,6EAAwE;AACxE,iEAAgE;AAChE,6CAA0C;AAE1C,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAG9B,IAAM,2BAA2B,yEAAjC,MAAM,2BAA4B,SAAQ,+BAAU;IAGvD;QACI,KAAK,CAAC,6BAA6B,EAAE;YACjC,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,6BAA2B,CAAC,gBAAgB;SACvD,CAAC,CAAC;IACP,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAA8B;QACnD,IAAI;YACA,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAC;YACrF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YACrC,MAAM,IAAI,CAAC,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IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;YAChE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,gBAAgB,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;YAC1E,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SACzB;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,uBAAuB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC/E;IACL,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAAe;QACxC,IAAI;YACA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC5C,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,YAAY,EAAE,yBAAyB,CAAC,CAAC;YACnE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,kBAAkB,EAAE,yBAAyB,CAAC,CAAC;YACzE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SACzB;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,uBAAuB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC/E;IACL,CAAC;;AArDa,4CAAgB,GAAG,4BAAoB,AAAvB,CAAwB;sCAD7C,2BAA2B;IADvC,IAAA,qBAAU,GAAE;;GACA,2BAA2B,CAuDvC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RopidGTFSStopsModel } from "../../ropid-gtfs";
|
|
1
2
|
import { JISInfotextsModel } from "../../../schema-definitions/jis/models/JISInfotextsModel";
|
|
2
3
|
import { IJISInfotext } from "../../../schema-definitions/jis/models/interfaces";
|
|
3
4
|
import { ILogger } from "@golemio/core/dist/helpers";
|
|
@@ -5,16 +6,19 @@ import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postg
|
|
|
5
6
|
import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
|
|
6
7
|
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
7
8
|
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
9
|
+
import { JISInfotextsRopidGTFSStopsRepository } from "./JISInfotextsRopidGTFSStopsRepository";
|
|
8
10
|
type RepositoryOptions = {
|
|
9
11
|
transaction?: Transaction;
|
|
10
12
|
};
|
|
11
13
|
export declare class JISInfotextsRepository extends AbstractValidatableRepository {
|
|
12
14
|
private logger;
|
|
15
|
+
private infotextStopRepository;
|
|
16
|
+
private gtfsStopRepository;
|
|
13
17
|
validator: JSONSchemaValidator;
|
|
14
18
|
schema: string;
|
|
15
19
|
tableName: string;
|
|
16
20
|
private sequelizeModel;
|
|
17
|
-
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
21
|
+
constructor(connector: IDatabaseConnector, logger: ILogger, infotextStopRepository: JISInfotextsRopidGTFSStopsRepository, gtfsStopRepository: RopidGTFSStopsModel);
|
|
18
22
|
/**
|
|
19
23
|
* Refresh all data from VYMI and delete old data
|
|
20
24
|
*
|
|
@@ -28,5 +32,6 @@ export declare class JISInfotextsRepository extends AbstractValidatableRepositor
|
|
|
28
32
|
* @returns The number of deleted items
|
|
29
33
|
*/
|
|
30
34
|
deleteAll(options?: RepositoryOptions): Promise<number>;
|
|
35
|
+
findAll(): Promise<JISInfotextsModel[]>;
|
|
31
36
|
}
|
|
32
37
|
export {};
|
|
@@ -13,6 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.JISInfotextsRepository = void 0;
|
|
16
|
+
const ropid_gtfs_1 = require("../../ropid-gtfs");
|
|
16
17
|
const const_1 = require("../../../schema-definitions/const");
|
|
17
18
|
const JISInfotextsModel_1 = require("../../../schema-definitions/jis/models/JISInfotextsModel");
|
|
18
19
|
const AbstractValidatableRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository");
|
|
@@ -21,17 +22,48 @@ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
|
21
22
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
22
23
|
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
23
24
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
25
|
+
const JISContainerToken_1 = require("../ioc/JISContainerToken");
|
|
26
|
+
const JISInfotextsRopidGTFSStopsRepository_1 = require("./JISInfotextsRopidGTFSStopsRepository");
|
|
24
27
|
const RepositoryUtils_1 = require("../../shared/RepositoryUtils");
|
|
25
28
|
let JISInfotextsRepository = exports.JISInfotextsRepository = class JISInfotextsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
26
|
-
constructor(connector, logger) {
|
|
29
|
+
constructor(connector, logger, infotextStopRepository, gtfsStopRepository) {
|
|
27
30
|
super(connector, logger);
|
|
28
31
|
this.logger = logger;
|
|
32
|
+
this.infotextStopRepository = infotextStopRepository;
|
|
33
|
+
this.gtfsStopRepository = gtfsStopRepository;
|
|
29
34
|
this.schema = const_1.PG_SCHEMA;
|
|
30
35
|
this.tableName = JISInfotextsModel_1.JISInfotextsModel.tableName;
|
|
31
36
|
this.validator = new golemio_validator_1.JSONSchemaValidator("JISInfotextsRepository", JISInfotextsModel_1.JISInfotextsModel.jsonSchema);
|
|
32
37
|
this.sequelizeModel = connector
|
|
33
38
|
.getConnection()
|
|
34
39
|
.define(this.tableName, JISInfotextsModel_1.JISInfotextsModel.attributeModel, { schema: this.schema });
|
|
40
|
+
this.sequelizeModel.belongsToMany(this.gtfsStopRepository.sequelizeModel, {
|
|
41
|
+
through: this.infotextStopRepository["sequelizeModel"],
|
|
42
|
+
foreignKey: "infotext_id",
|
|
43
|
+
otherKey: "stop_id",
|
|
44
|
+
as: "stops",
|
|
45
|
+
});
|
|
46
|
+
this.gtfsStopRepository.sequelizeModel.belongsToMany(this.sequelizeModel, {
|
|
47
|
+
through: this.infotextStopRepository["sequelizeModel"],
|
|
48
|
+
foreignKey: "stop_id",
|
|
49
|
+
otherKey: "infotext_id",
|
|
50
|
+
});
|
|
51
|
+
this.infotextStopRepository["sequelizeModel"].belongsTo(this.sequelizeModel, {
|
|
52
|
+
targetKey: "id",
|
|
53
|
+
foreignKey: "infotext_id",
|
|
54
|
+
});
|
|
55
|
+
this.infotextStopRepository["sequelizeModel"].belongsTo(this.gtfsStopRepository.sequelizeModel, {
|
|
56
|
+
targetKey: "stop_id",
|
|
57
|
+
foreignKey: "stop_id",
|
|
58
|
+
});
|
|
59
|
+
this.sequelizeModel.hasMany(this.infotextStopRepository["sequelizeModel"], {
|
|
60
|
+
sourceKey: "id",
|
|
61
|
+
foreignKey: "infotext_id",
|
|
62
|
+
});
|
|
63
|
+
this.gtfsStopRepository.sequelizeModel.hasMany(this.infotextStopRepository["sequelizeModel"], {
|
|
64
|
+
sourceKey: "stop_id",
|
|
65
|
+
foreignKey: "stop_id",
|
|
66
|
+
});
|
|
35
67
|
}
|
|
36
68
|
/**
|
|
37
69
|
* Refresh all data from VYMI and delete old data
|
|
@@ -94,11 +126,27 @@ let JISInfotextsRepository = exports.JISInfotextsRepository = class JISInfotexts
|
|
|
94
126
|
throw new golemio_errors_1.GeneralError("Error in deleteAll", this.constructor.name, err);
|
|
95
127
|
}
|
|
96
128
|
}
|
|
129
|
+
async findAll() {
|
|
130
|
+
return await this.sequelizeModel.findAll({
|
|
131
|
+
include: [
|
|
132
|
+
{
|
|
133
|
+
model: this.gtfsStopRepository.sequelizeModel,
|
|
134
|
+
as: "stops",
|
|
135
|
+
attributes: ["stop_id"],
|
|
136
|
+
through: { attributes: [] },
|
|
137
|
+
required: true,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
97
142
|
};
|
|
98
143
|
exports.JISInfotextsRepository = JISInfotextsRepository = __decorate([
|
|
99
144
|
(0, tsyringe_1.injectable)(),
|
|
100
145
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
101
146
|
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
102
|
-
|
|
147
|
+
__param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository)),
|
|
148
|
+
__param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository)),
|
|
149
|
+
__metadata("design:paramtypes", [Object, Object, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository,
|
|
150
|
+
ropid_gtfs_1.RopidGTFSStopsModel])
|
|
103
151
|
], JISInfotextsRepository);
|
|
104
152
|
//# sourceMappingURL=JISInfotextsRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAAmF;AACnF,iEAAwE;AACxE,kEAA6D;AAOtD,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB;
|
|
1
|
+
{"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAqD;AACrD,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAAmF;AACnF,iEAAwE;AACxE,gEAA6D;AAC7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SAAS,CAAC,OAA2B;QAC9C,IAAI;YACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;SAC9F;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC5E;IACL,CAAC;IACM,KAAK,CAAC,OAAO;QAChB,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YACrC,OAAO,EAAE;gBACL;oBACI,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,cAAc;oBAC7C,EAAE,EAAE,OAAO;oBACX,UAAU,EAAE,CAAC,SAAS,CAAC;oBACvB,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;oBAC3B,QAAQ,EAAE,IAAI;iBACjB;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;iCApIY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IASJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,oCAAoC,CAAC,CAAA;IAE9D,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,wBAAwB,CAAC,CAAA;qDADnB,2EAAoC;QAExC,gCAAmB;GAb1C,sBAAsB,CAoIlC"}
|
|
@@ -18,6 +18,7 @@ class JISWorker extends workers_1.AbstractWorker {
|
|
|
18
18
|
this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask));
|
|
19
19
|
this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.RefreshJISEventsTask));
|
|
20
20
|
this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask));
|
|
21
|
+
this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsCacheTask));
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
exports.JISWorker = JISWorker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;
|
|
1
|
+
{"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAO9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QAaxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAXE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAAqB,qCAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClG,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAAwB,qCAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACxG,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAAuB,qCAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACtG,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA+B,qCAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAC1H,CAAC;CAMJ;AAlBD,8BAkBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JISInfotextsRedisRepository } from "../../repositories/JISInfotextsRedisRepository";
|
|
2
|
+
import { JISInfotextsRepository } from "../../repositories/JISInfotextsRepository";
|
|
3
|
+
import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
|
|
4
|
+
export declare class RefreshJISInfotextsCacheTask extends AbstractEmptyTask {
|
|
5
|
+
private infotextsRepository;
|
|
6
|
+
private infotextCacheRepository;
|
|
7
|
+
readonly queueName = "refreshJISInfotextsCache";
|
|
8
|
+
readonly queueTtl: number;
|
|
9
|
+
constructor(infotextsRepository: JISInfotextsRepository, infotextCacheRepository: JISInfotextsRedisRepository);
|
|
10
|
+
protected execute(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RefreshJISInfotextsCacheTask = void 0;
|
|
16
|
+
const JISContainerToken_1 = require("../../ioc/JISContainerToken");
|
|
17
|
+
const JISInfotextsRedisRepository_1 = require("../../repositories/JISInfotextsRedisRepository");
|
|
18
|
+
const JISInfotextsRepository_1 = require("../../repositories/JISInfotextsRepository");
|
|
19
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
20
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
21
|
+
const constants_1 = require("../constants");
|
|
22
|
+
let RefreshJISInfotextsCacheTask = exports.RefreshJISInfotextsCacheTask = class RefreshJISInfotextsCacheTask extends integration_engine_1.AbstractEmptyTask {
|
|
23
|
+
constructor(infotextsRepository, infotextCacheRepository) {
|
|
24
|
+
super(constants_1.JIS_WORKER_NAME.toLowerCase());
|
|
25
|
+
this.infotextsRepository = infotextsRepository;
|
|
26
|
+
this.infotextCacheRepository = infotextCacheRepository;
|
|
27
|
+
this.queueName = "refreshJISInfotextsCache";
|
|
28
|
+
this.queueTtl = 60 * 1000; // 1 minute
|
|
29
|
+
}
|
|
30
|
+
async execute() {
|
|
31
|
+
const infotexts = await this.infotextsRepository.findAll();
|
|
32
|
+
await this.infotextCacheRepository.refreshData(infotexts);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.RefreshJISInfotextsCacheTask = RefreshJISInfotextsCacheTask = __decorate([
|
|
36
|
+
(0, tsyringe_1.injectable)(),
|
|
37
|
+
__param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRepository)),
|
|
38
|
+
__param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRedisRepository)),
|
|
39
|
+
__metadata("design:paramtypes", [JISInfotextsRepository_1.JISInfotextsRepository,
|
|
40
|
+
JISInfotextsRedisRepository_1.JISInfotextsRedisRepository])
|
|
41
|
+
], RefreshJISInfotextsCacheTask);
|
|
42
|
+
//# sourceMappingURL=RefreshJISInfotextsCacheTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshJISInfotextsCacheTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,gGAA+F;AAC/F,sFAAqF;AACrF,8EAA0E;AAC1E,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,4BAA4B,0CAAlC,MAAM,4BAA6B,SAAQ,sCAAiB;IAI/D,YACsD,mBAAmD,EAC9C,uBAA4D;QAEnH,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAHqB,wBAAmB,GAAnB,mBAAmB,CAAwB;QACtC,4BAAuB,GAAvB,uBAAuB,CAA6B;QALvG,cAAS,GAAG,0BAA0B,CAAC;QACvC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;IAOjD,CAAC;IAES,KAAK,CAAC,OAAO;QACnB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;uCAfY,4BAA4B;IADxC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,sBAAsB,CAAC,CAAA;IAChD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,2BAA2B,CAAC,CAAA;qCADyB,+CAAsB;QACb,yDAA2B;GAN9G,4BAA4B,CAexC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JISInfotextsDataService } from "../../services/JISInfotextsDataService";
|
|
2
2
|
import { JISInfotextsTransformation } from "../../transformations/JISInfotextsTransformation";
|
|
3
|
+
import { IJISInfotext } from "../../../../schema-definitions/jis/datasources/interfaces";
|
|
3
4
|
import { AbstractTaskJsonSchema } from "@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema";
|
|
4
5
|
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
5
|
-
import { IJISInfotext } from "../../../../schema-definitions/jis/datasources/interfaces";
|
|
6
6
|
export declare class RefreshJISInfotextsTask extends AbstractTaskJsonSchema<IJISInfotext[]> {
|
|
7
7
|
private infotextsDataService;
|
|
8
8
|
private infotextsTransformation;
|
|
@@ -10,7 +10,6 @@ export declare class RefreshJISInfotextsTask extends AbstractTaskJsonSchema<IJIS
|
|
|
10
10
|
readonly queueName = "refreshJISInfotexts";
|
|
11
11
|
readonly queueTtl: number;
|
|
12
12
|
constructor(infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation);
|
|
13
|
-
/** refresh JIS Infotexts data in database */
|
|
14
13
|
protected execute(data: IJISInfotext[]): Promise<void>;
|
|
15
14
|
private getEntitiesFromTransformationResult;
|
|
16
15
|
}
|
|
@@ -16,11 +16,12 @@ exports.RefreshJISInfotextsTask = void 0;
|
|
|
16
16
|
const JISContainerToken_1 = require("../../ioc/JISContainerToken");
|
|
17
17
|
const JISInfotextsDataService_1 = require("../../services/JISInfotextsDataService");
|
|
18
18
|
const JISInfotextsTransformation_1 = require("../../transformations/JISInfotextsTransformation");
|
|
19
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
20
|
-
const constants_1 = require("../constants");
|
|
21
|
-
const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
|
|
22
19
|
const JISInfotextsJsonSchema_1 = require("../../../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
|
|
20
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
21
|
+
const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
|
|
23
22
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
23
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
24
|
+
const constants_1 = require("../constants");
|
|
24
25
|
let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
|
|
25
26
|
constructor(infotextsDataService, infotextsTransformation) {
|
|
26
27
|
super(constants_1.JIS_WORKER_NAME.toLowerCase());
|
|
@@ -30,11 +31,11 @@ let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJIS
|
|
|
30
31
|
this.queueName = "refreshJISInfotexts";
|
|
31
32
|
this.queueTtl = 60 * 1000; // 1 minute
|
|
32
33
|
}
|
|
33
|
-
/** refresh JIS Infotexts data in database */
|
|
34
34
|
async execute(data) {
|
|
35
35
|
const transformedData = this.infotextsTransformation.transformArray(data);
|
|
36
36
|
const { infotexts, infotextsRopidGTFSStops } = this.getEntitiesFromTransformationResult(transformedData);
|
|
37
37
|
await this.infotextsDataService.refreshData(infotexts, infotextsRopidGTFSStops);
|
|
38
|
+
await integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, "refreshJISInfotextsCache", {});
|
|
38
39
|
}
|
|
39
40
|
getEntitiesFromTransformationResult(transformedData) {
|
|
40
41
|
const infotextEntities = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,
|
|
1
|
+
{"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAkE;AA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AA+B,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,CAAC;SACpE;QACD,OAAO;YACH,SAAS,EAAE,gBAAgB;YAC3B,uBAAuB,EAAE,+BAA+B;SAC3D,CAAC;IACN,CAAC;CACJ,CAAA;kCApCY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;qCADvB,iDAAuB;QAEpB,uDAA0B;GATtD,uBAAuB,CAoCnC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IStopCisDto } from "../../schema-definitions/ropid-gtfs/interfaces/IStopCisDto";
|
|
2
|
+
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine";
|
|
3
|
+
import { IValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
4
|
+
import Sequelize from "@golemio/core/dist/shared/sequelize";
|
|
5
|
+
export declare class RopidGTFSCisStopsModel extends PostgresModel implements IModel {
|
|
6
|
+
/** Model name */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The Sequelize Model */
|
|
9
|
+
sequelizeModel: Sequelize.ModelCtor<any>;
|
|
10
|
+
/** The Sequelize Model for temporary table */
|
|
11
|
+
protected tmpSequelizeModel: Sequelize.ModelCtor<any> | null;
|
|
12
|
+
/** Validation helper */
|
|
13
|
+
protected validator: IValidator;
|
|
14
|
+
/** Type/Strategy of saving the data */
|
|
15
|
+
protected savingType: "insertOnly" | "insertOrUpdate";
|
|
16
|
+
constructor();
|
|
17
|
+
getAll: () => Promise<Array<Pick<IStopCisDto, "id" | "cis">>>;
|
|
18
|
+
}
|