@golemio/pid 3.17.2-dev.1929777703 → 3.17.2-dev.1964072627
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/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/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/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/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-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/package.json +1 -1
|
@@ -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,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AAC,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"}
|
|
@@ -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,iFA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AAuB,CAAC,CAAC;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,MA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AE,EAAE,GAAG,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
|
* Delete all items last updated before a given date and time (where their `updated_at` is less than the given limit)
|
|
20
24
|
*
|
|
@@ -36,5 +40,6 @@ export declare class JISInfotextsRepository extends AbstractValidatableRepositor
|
|
|
36
40
|
* @returns The number of deleted items
|
|
37
41
|
*/
|
|
38
42
|
deleteAll(options?: RepositoryOptions): Promise<number>;
|
|
43
|
+
findAll(): Promise<JISInfotextsModel[]>;
|
|
39
44
|
}
|
|
40
45
|
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,16 +22,47 @@ 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
|
let JISInfotextsRepository = exports.JISInfotextsRepository = class JISInfotextsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
25
|
-
constructor(connector, logger) {
|
|
28
|
+
constructor(connector, logger, infotextStopRepository, gtfsStopRepository) {
|
|
26
29
|
super(connector, logger);
|
|
27
30
|
this.logger = logger;
|
|
31
|
+
this.infotextStopRepository = infotextStopRepository;
|
|
32
|
+
this.gtfsStopRepository = gtfsStopRepository;
|
|
28
33
|
this.schema = const_1.PG_SCHEMA;
|
|
29
34
|
this.tableName = JISInfotextsModel_1.JISInfotextsModel.tableName;
|
|
30
35
|
this.validator = new golemio_validator_1.JSONSchemaValidator("JISInfotextsRepository", JISInfotextsModel_1.JISInfotextsModel.jsonSchema);
|
|
31
36
|
this.sequelizeModel = connector
|
|
32
37
|
.getConnection()
|
|
33
38
|
.define(this.tableName, JISInfotextsModel_1.JISInfotextsModel.attributeModel, { schema: this.schema });
|
|
39
|
+
this.sequelizeModel.belongsToMany(this.gtfsStopRepository.sequelizeModel, {
|
|
40
|
+
through: this.infotextStopRepository["sequelizeModel"],
|
|
41
|
+
foreignKey: "infotext_id",
|
|
42
|
+
otherKey: "stop_id",
|
|
43
|
+
as: "stops",
|
|
44
|
+
});
|
|
45
|
+
this.gtfsStopRepository.sequelizeModel.belongsToMany(this.sequelizeModel, {
|
|
46
|
+
through: this.infotextStopRepository["sequelizeModel"],
|
|
47
|
+
foreignKey: "stop_id",
|
|
48
|
+
otherKey: "infotext_id",
|
|
49
|
+
});
|
|
50
|
+
this.infotextStopRepository["sequelizeModel"].belongsTo(this.sequelizeModel, {
|
|
51
|
+
targetKey: "id",
|
|
52
|
+
foreignKey: "infotext_id",
|
|
53
|
+
});
|
|
54
|
+
this.infotextStopRepository["sequelizeModel"].belongsTo(this.gtfsStopRepository.sequelizeModel, {
|
|
55
|
+
targetKey: "stop_id",
|
|
56
|
+
foreignKey: "stop_id",
|
|
57
|
+
});
|
|
58
|
+
this.sequelizeModel.hasMany(this.infotextStopRepository["sequelizeModel"], {
|
|
59
|
+
sourceKey: "id",
|
|
60
|
+
foreignKey: "infotext_id",
|
|
61
|
+
});
|
|
62
|
+
this.gtfsStopRepository.sequelizeModel.hasMany(this.infotextStopRepository["sequelizeModel"], {
|
|
63
|
+
sourceKey: "stop_id",
|
|
64
|
+
foreignKey: "stop_id",
|
|
65
|
+
});
|
|
34
66
|
}
|
|
35
67
|
/**
|
|
36
68
|
* Delete all items last updated before a given date and time (where their `updated_at` is less than the given limit)
|
|
@@ -117,11 +149,27 @@ let JISInfotextsRepository = exports.JISInfotextsRepository = class JISInfotexts
|
|
|
117
149
|
throw new golemio_errors_1.GeneralError("Error in deleteAll", this.constructor.name, err);
|
|
118
150
|
}
|
|
119
151
|
}
|
|
152
|
+
async findAll() {
|
|
153
|
+
return await this.sequelizeModel.findAll({
|
|
154
|
+
include: [
|
|
155
|
+
{
|
|
156
|
+
model: this.gtfsStopRepository.sequelizeModel,
|
|
157
|
+
as: "stops",
|
|
158
|
+
attributes: ["stop_id"],
|
|
159
|
+
through: { attributes: [] },
|
|
160
|
+
required: true,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
120
165
|
};
|
|
121
166
|
exports.JISInfotextsRepository = JISInfotextsRepository = __decorate([
|
|
122
167
|
(0, tsyringe_1.injectable)(),
|
|
123
168
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
124
169
|
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
125
|
-
|
|
170
|
+
__param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository)),
|
|
171
|
+
__param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository)),
|
|
172
|
+
__metadata("design:paramtypes", [Object, Object, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository,
|
|
173
|
+
ropid_gtfs_1.RopidGTFSStopsModel])
|
|
126
174
|
], JISInfotextsRepository);
|
|
127
175
|
//# 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,6EAAyF;AACzF,mFAAkF;AAClF,mEAAgI;AAChI,iEAAwE;
|
|
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,6EAAyF;AACzF,mFAAkF;AAClF,mEAAgI;AAChI,iEAAwE;AACxE,gEAA6D;AAC7D,iGAA8F;AAOvF,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB,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,CAAC,SAAS,CAAC;oBACvB,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;oBAC3B,QAAQ,EAAE,IAAI;iBACjB;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;iCAjKY,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,CAiKlC"}
|
|
@@ -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;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,kHAAqF;AAErF,8EAAqE;AACrE,iHAA8G;AAC9G,mFAAkF;AAClF,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,+CAAsC;IAK/E,YAEI,oBAAqD,EAErD,uBAA2D;QAE3D,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAJ7B,yBAAoB,GAApB,oBAAoB,CAAyB;QAE7C,4BAAuB,GAAvB,uBAAuB,CAA4B;QAR/C,WAAM,GAAG,IAAI,uCAAmB,CAAC,4BAA4B,EAAE,+CAAsB,CAAC,CAAC;QACvF,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAA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resModel } 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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RopidGTFSCisStopsModel = void 0;
|
|
13
|
+
const const_1 = require("../../schema-definitions/const");
|
|
14
|
+
const StopCisDto_1 = require("../../schema-definitions/ropid-gtfs/models/StopCisDto");
|
|
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 golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
19
|
+
let RopidGTFSCisStopsModel = exports.RopidGTFSCisStopsModel = class RopidGTFSCisStopsModel extends integration_engine_1.PostgresModel {
|
|
20
|
+
constructor() {
|
|
21
|
+
super("RopidGTFSCisStopsModel", {
|
|
22
|
+
outputSequelizeAttributes: StopCisDto_1.StopCisDto.attributeModel,
|
|
23
|
+
pgTableName: StopCisDto_1.StopCisDto.tableName,
|
|
24
|
+
pgSchema: const_1.PG_SCHEMA,
|
|
25
|
+
savingType: "insertOnly",
|
|
26
|
+
}, new golemio_validator_1.JSONSchemaValidator(StopCisDto_1.StopCisDto.tableName + "ModelValidator", StopCisDto_1.StopCisDto.jsonSchema));
|
|
27
|
+
this.getAll = async () => {
|
|
28
|
+
try {
|
|
29
|
+
return await this.sequelizeModel.findAll({
|
|
30
|
+
attributes: ["id", "cis"],
|
|
31
|
+
raw: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw new golemio_errors_1.GeneralError("Database error", this.constructor.name, err, 500);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.RopidGTFSCisStopsModel = RopidGTFSCisStopsModel = __decorate([
|
|
41
|
+
(0, tsyringe_1.injectable)(),
|
|
42
|
+
__metadata("design:paramtypes", [])
|
|
43
|
+
], RopidGTFSCisStopsModel);
|
|
44
|
+
//# sourceMappingURL=RopidGTFSCisStopsModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopidGTFSCisStopsModel.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAuC;AAEvC,sFAA+D;AAC/D,8EAA8E;AAC9E,6EAAwE;AACxE,mFAA8F;AAE9F,iEAAgE;AAGzD,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,kCAAa;IAYrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,uBAAU,CAAC,cAAc;YACpD,WAAW,EAAE,uBAAU,CAAC,SAAS;YACjC,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,uBAAU,CAAC,SAAS,GAAG,gBAAgB,EAAE,uBAAU,CAAC,UAAU,CAAC,CAC1F,CAAC;QAGC,WAAM,GAAG,KAAK,IAAqD,EAAE;YACxE,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;oBACzB,GAAG,EAAE,IAAI;iBACZ,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC7E;QACL,CAAC,CAAC;IAXF,CAAC;CAYJ,CAAA;iCAnCY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;;GACA,sBAAsB,CAmClC"}
|