@golemio/pid 2.8.1 → 2.8.2-dev.943885572
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/example/12_metro_line_A_gtfs_trips.sql +4 -0
- package/dist/helpers/AccessibilityEnums.d.ts +16 -0
- package/dist/helpers/AccessibilityEnums.js +22 -0
- package/dist/helpers/AccessibilityEnums.js.map +1 -0
- package/dist/integration-engine/index.js +2 -0
- package/dist/integration-engine/index.js.map +1 -1
- package/dist/integration-engine/queueDefinitions.js +0 -50
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.d.ts +0 -63
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.js +3 -541
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js +18 -4
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.d.ts +3 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +29 -0
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +8 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +12 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js +16 -3
- package/dist/integration-engine/ropid-gtfs/transformations/RopidGTFSTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.d.ts +5 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +23 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.d.ts +12 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js +61 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.d.ts +14 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +93 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.d.ts +19 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js +152 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.d.ts +11 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js +57 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.d.ts +21 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js +160 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.d.ts +24 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.js +36 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.d.ts +12 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js +67 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.d.ts +13 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js +102 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/ICheckForNewDataInput.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IDatasetsInput.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IDatasetsInput.js +3 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IDatasetsInput.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CachedDatasetSchema.d.ts +8 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CachedDatasetSchema.js +40 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CachedDatasetSchema.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CheckForNewDataMessageValidation.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CheckForNewDataMessageValidation.js +22 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CheckForNewDataMessageValidation.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/DownloadDataInputSchema.d.ts +5 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/DownloadDataInputSchema.js +23 -0
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/DownloadDataInputSchema.js.map +1 -0
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.d.ts +3 -3
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js +21 -3
- package/dist/output-gateway/pid/helpers/DepartureBoardMapper.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +3 -2
- package/dist/output-gateway/pid/index.js +1 -1
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/interfaces/IDeparturesModel.d.ts +3 -2
- package/docs/implementation_documentation.md +39 -37
- package/docs/openapi-output.yaml +1 -1
- package/package.json +3 -3
- package/dist/integration-engine/ropid-gtfs/interfaces/ICheckForNewDataInput.js.map +0 -1
- /package/dist/integration-engine/ropid-gtfs/{interfaces → workers/timetables/tasks/interfaces}/ICheckForNewDataInput.d.ts +0 -0
- /package/dist/integration-engine/ropid-gtfs/{interfaces → workers/timetables/tasks/interfaces}/ICheckForNewDataInput.js +0 -0
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RefreshPrecomputedTablesTask = void 0;
|
|
13
|
+
const Di_1 = require("../../../../ioc/Di");
|
|
14
|
+
const ModuleContainerToken_1 = require("../../../../ioc/ModuleContainerToken");
|
|
15
|
+
const DataCacheManager_1 = require("../../../helpers/DataCacheManager");
|
|
16
|
+
const SourceTableSuffixEnum_1 = require("../../../helpers/SourceTableSuffixEnum");
|
|
17
|
+
const Di_2 = require("../../../ioc/Di");
|
|
18
|
+
const RopidGtfsContainerToken_1 = require("../../../ioc/RopidGtfsContainerToken");
|
|
19
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
20
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
21
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
22
|
+
class RefreshPrecomputedTablesTask extends workers_1.AbstractEmptyTask {
|
|
23
|
+
constructor(queuePrefix) {
|
|
24
|
+
super(queuePrefix);
|
|
25
|
+
this.queueName = "refreshPrecomputedTables";
|
|
26
|
+
this.queueTtl = 59 * 60 * 1000; // 59 minutes
|
|
27
|
+
this.logger = Di_2.RopidGtfsContainer.resolve(CoreToken_1.CoreToken.Logger);
|
|
28
|
+
this.metaModel = Di_2.RopidGtfsContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.RopidGTFSMetadataModel);
|
|
29
|
+
this.dataCacheManager = DataCacheManager_1.DataCacheManager.getInstance();
|
|
30
|
+
this.precomputeTablesFacade = Di_2.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.PrecomputedTablesFacade);
|
|
31
|
+
}
|
|
32
|
+
execute() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
yield this.precomputeTablesFacade.createAndPopulatePrecomputedTmpTables(SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
this.logger.error(err);
|
|
39
|
+
throw new golemio_errors_1.GeneralError("Error while creating RopidGTFS precomputed tables", this.constructor.name);
|
|
40
|
+
}
|
|
41
|
+
const connection = Di_1.PidContainer.resolve(CoreToken_1.CoreToken.PostgresConnector).getConnection();
|
|
42
|
+
const transaction = yield connection.transaction();
|
|
43
|
+
try {
|
|
44
|
+
yield this.metaModel.replacePrecomputedTables(transaction);
|
|
45
|
+
yield transaction.commit();
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
yield transaction.rollback();
|
|
49
|
+
this.logger.error(err);
|
|
50
|
+
throw new golemio_errors_1.GeneralError("Error while replacing RopidGTFS precomputed tables", this.constructor.name);
|
|
51
|
+
}
|
|
52
|
+
yield this.dataCacheManager.cleanCache();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.RefreshPrecomputedTablesTask = RefreshPrecomputedTablesTask;
|
|
57
|
+
//# sourceMappingURL=RefreshPrecomputedTablesTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshPrecomputedTablesTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0C;AAC1C,+EAAoE;AAEpE,wEAA2E;AAC3E,kFAAqF;AACrF,wCAA2D;AAC3D,kFAAqF;AAErF,wEAAqE;AAErE,2EAAkF;AAClF,6EAAwE;AAGxE,MAAa,4BAA6B,SAAQ,2BAAiB;IAS/D,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QATP,cAAS,GAAG,0BAA0B,CAAC;QACvC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;QASpD,IAAI,CAAC,MAAM,GAAG,uBAAkB,CAAC,OAAO,CAAU,qBAAS,CAAC,MAAM,CAAC,CAAC;QACpE,IAAI,CAAC,SAAS,GAAG,uBAAkB,CAAC,OAAO,CAAyB,2CAAoB,CAAC,sBAAsB,CAAC,CAAC;QACjH,IAAI,CAAC,gBAAgB,GAAG,mCAAgB,CAAC,WAAW,EAAE,CAAC;QACvD,IAAI,CAAC,sBAAsB,GAAG,uBAAkB,CAAC,OAAO,CACpD,iDAAuB,CAAC,uBAAuB,CAClD,CAAC;IACN,CAAC;IAEe,OAAO;;YACnB,IAAI;gBACA,MAAM,IAAI,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,6CAAqB,CAAC,MAAM,CAAC,CAAC;aACzG;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,MAAM,IAAI,6BAAY,CAAC,mDAAmD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACtG;YAED,MAAM,UAAU,GAAG,iBAAY,CAAC,OAAO,CAAqB,qBAAS,CAAC,iBAAiB,CAAC,CAAC,aAAa,EAAE,CAAC;YACzG,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,CAAC;YAEnD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;gBAC3D,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;aAC9B;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;gBAE7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,MAAM,IAAI,6BAAY,CAAC,oDAAoD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACvG;YAED,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC7C,CAAC;KAAA;CACJ;AA1CD,oEA0CC"}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
+
import { MessageProperties } from "amqplib";
|
|
3
|
+
import { ICachedDataset } from "./helpers/HelperTypes";
|
|
4
|
+
import { CachedDatasetSchema } from "./schema/CachedDatasetSchema";
|
|
5
|
+
export declare class TransformAndSaveDataTask extends AbstractTask<ICachedDataset> {
|
|
6
|
+
readonly queueName = "transformAndSaveData";
|
|
7
|
+
readonly queueTtl: number;
|
|
8
|
+
readonly schema: typeof CachedDatasetSchema;
|
|
9
|
+
private logger;
|
|
10
|
+
private staticFileRedisRepository;
|
|
11
|
+
private transformationGtfs;
|
|
12
|
+
private ropidGtfsFactory;
|
|
13
|
+
private gtfsRedisChannel;
|
|
14
|
+
private metaModel;
|
|
15
|
+
constructor(queuePrefix: string);
|
|
16
|
+
protected execute(inputData: ICachedDataset, msgProperties?: MessageProperties): Promise<void>;
|
|
17
|
+
private saveTransformedDataset;
|
|
18
|
+
private createTmpModel;
|
|
19
|
+
private streamDataToTmp;
|
|
20
|
+
private getTmpModelByName;
|
|
21
|
+
}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TransformAndSaveDataTask = void 0;
|
|
13
|
+
const Di_1 = require("../../../../ioc/Di");
|
|
14
|
+
const ModuleContainerToken_1 = require("../../../../ioc/ModuleContainerToken");
|
|
15
|
+
const ropid_gtfs_1 = require("../../..");
|
|
16
|
+
const SourceTableSuffixEnum_1 = require("../../../helpers/SourceTableSuffixEnum");
|
|
17
|
+
const Di_2 = require("../../../ioc/Di");
|
|
18
|
+
const RopidGtfsContainerToken_1 = require("../../../ioc/RopidGtfsContainerToken");
|
|
19
|
+
const utils_1 = require("../../../utils");
|
|
20
|
+
const RopidMetadataModel_1 = require("../../../../shared/RopidMetadataModel");
|
|
21
|
+
const const_1 = require("../../../../../schema-definitions/const");
|
|
22
|
+
const ropid_gtfs_2 = require("../../../../../schema-definitions/ropid-gtfs");
|
|
23
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
24
|
+
const PostgresModel_1 = require("@golemio/core/dist/integration-engine/models/PostgresModel");
|
|
25
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
26
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
27
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
28
|
+
const pg_copy_streams_1 = require("pg-copy-streams");
|
|
29
|
+
const HelperTypes_1 = require("./helpers/HelperTypes");
|
|
30
|
+
const CachedDatasetSchema_1 = require("./schema/CachedDatasetSchema");
|
|
31
|
+
class TransformAndSaveDataTask extends workers_1.AbstractTask {
|
|
32
|
+
constructor(queuePrefix) {
|
|
33
|
+
super(queuePrefix);
|
|
34
|
+
this.queueName = "transformAndSaveData";
|
|
35
|
+
this.queueTtl = 23 * 60 * 60 * 1000; // 23 hours
|
|
36
|
+
this.schema = CachedDatasetSchema_1.CachedDatasetSchema;
|
|
37
|
+
this.saveTransformedDataset = (transformedData, dataset, modelName) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const model = yield this.createTmpModel(modelName);
|
|
39
|
+
switch (dataset) {
|
|
40
|
+
case ropid_gtfs_1.DatasetEnum.PID_GTFS:
|
|
41
|
+
case ropid_gtfs_1.DatasetEnum.RUN_NUMBERS:
|
|
42
|
+
yield this.streamDataToTmp(transformedData, modelName);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
yield (model === null || model === void 0 ? void 0 : model.save(transformedData, false));
|
|
46
|
+
this.logger.info(`Datasets: copying to tmp success (${modelName})`);
|
|
47
|
+
}
|
|
48
|
+
const dbLastModified = yield this.metaModel.getLastModified(dataset);
|
|
49
|
+
yield this.metaModel.updateState(dataset, modelName, RopidMetadataModel_1.MetaStateEnum.SAVED, dbLastModified.version);
|
|
50
|
+
});
|
|
51
|
+
this.createTmpModel = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const model = yield this.getTmpModelByName(name);
|
|
53
|
+
if (ropid_gtfs_2.RopidGTFS[name].modelIndexOptions) {
|
|
54
|
+
yield model.query((0, utils_1.buildDropIndexQuery)(ropid_gtfs_2.RopidGTFS[name].modelIndexOptions));
|
|
55
|
+
}
|
|
56
|
+
yield model.sync({ force: true, schema: const_1.PG_SCHEMA });
|
|
57
|
+
return model;
|
|
58
|
+
});
|
|
59
|
+
this.streamDataToTmp = (data, modelName) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
// get connection and db client
|
|
61
|
+
const connection = Di_1.PidContainer.resolve(CoreToken_1.CoreToken.PostgresConnector).getConnection();
|
|
62
|
+
const client = (yield connection.connectionManager.getConnection({ type: "write" }));
|
|
63
|
+
const tmpTableName = ropid_gtfs_2.RopidGTFS[modelName].pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
64
|
+
// copy transformed data to tmp table by stream
|
|
65
|
+
yield new Promise((resolve, reject) => {
|
|
66
|
+
const stream = client
|
|
67
|
+
.query((0, pg_copy_streams_1.from)(`COPY "${const_1.PG_SCHEMA}".${tmpTableName} FROM STDIN DELIMITER ',' CSV HEADER;`))
|
|
68
|
+
.on("error", (err) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
this.logger.error(`Datasets: copying to tmp error (${modelName}): ${err.toString()}`);
|
|
70
|
+
yield connection.connectionManager.releaseConnection(client);
|
|
71
|
+
return reject(err);
|
|
72
|
+
}))
|
|
73
|
+
.on("finish", () => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
this.logger.info(`Datasets: copying to tmp success (${modelName})`);
|
|
75
|
+
yield connection.connectionManager.releaseConnection(client);
|
|
76
|
+
return resolve();
|
|
77
|
+
}));
|
|
78
|
+
data.pipe(stream);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
this.getTmpModelByName = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const modelDef = ropid_gtfs_2.RopidGTFS[name];
|
|
83
|
+
if (!modelDef || !modelDef.name || !modelDef.pgTableName || !modelDef.outputSequelizeAttributes) {
|
|
84
|
+
throw new Error("Model not found.");
|
|
85
|
+
}
|
|
86
|
+
const model = new PostgresModel_1.PostgresModel(modelDef.name + "Tmp" + "Model", {
|
|
87
|
+
hasTmpTable: false,
|
|
88
|
+
outputSequelizeAttributes: modelDef.outputSequelizeAttributes,
|
|
89
|
+
pgSchema: const_1.PG_SCHEMA,
|
|
90
|
+
pgTableName: modelDef.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp,
|
|
91
|
+
savingType: "insertOnly",
|
|
92
|
+
sequelizeAdditionalSettings: Object.assign({ timestamps: false }, (modelDef.modelIndexOptions &&
|
|
93
|
+
modelDef.modelIndexOptions.length && {
|
|
94
|
+
indexes: modelDef.modelIndexOptions.map((indexDef) => {
|
|
95
|
+
return Object.assign(Object.assign({}, indexDef), { name: indexDef.name + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp });
|
|
96
|
+
}),
|
|
97
|
+
})),
|
|
98
|
+
}, new golemio_validator_1.JSONSchemaValidator(modelDef.name + "Tmp" + "ModelValidator", modelDef.outputMongooseSchemaObject));
|
|
99
|
+
return model;
|
|
100
|
+
});
|
|
101
|
+
this.logger = Di_2.RopidGtfsContainer.resolve(CoreToken_1.CoreToken.Logger);
|
|
102
|
+
this.metaModel = Di_2.RopidGtfsContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.RopidGTFSMetadataModel);
|
|
103
|
+
this.staticFileRedisRepository = Di_2.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.StaticFileRedisRepository);
|
|
104
|
+
this.transformationGtfs = Di_2.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.RopidGTFSTransformation); // TODO is it posible to use factory instead, which already contain this transformation?
|
|
105
|
+
this.ropidGtfsFactory = Di_2.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.RopidGtfsFactory);
|
|
106
|
+
this.gtfsRedisChannel = Di_2.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.RedisPubSubChannel);
|
|
107
|
+
}
|
|
108
|
+
execute(inputData, msgProperties) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const datasetMap = this.ropidGtfsFactory.getDatasetMap();
|
|
111
|
+
let modelName = (0, HelperTypes_1.datasetFileModelMap)(inputData.dataset, inputData.name);
|
|
112
|
+
if (!Array.isArray(modelName)) {
|
|
113
|
+
modelName = [modelName];
|
|
114
|
+
}
|
|
115
|
+
let errorMessage;
|
|
116
|
+
if (inputData.dataset === ropid_gtfs_1.DatasetEnum.PID_GTFS || inputData.dataset === ropid_gtfs_1.DatasetEnum.RUN_NUMBERS) {
|
|
117
|
+
try {
|
|
118
|
+
const sourceStream = this.staticFileRedisRepository.getReadableStream(inputData.filepath);
|
|
119
|
+
const transformedDataset = yield this.transformationGtfs.transform({
|
|
120
|
+
sourceStream,
|
|
121
|
+
name: modelName[0],
|
|
122
|
+
});
|
|
123
|
+
yield this.saveTransformedDataset(transformedDataset, inputData.dataset, modelName[0]);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
errorMessage = err.message;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
try {
|
|
131
|
+
const data = yield this.staticFileRedisRepository.get(inputData.filepath);
|
|
132
|
+
const transformedDataset = yield datasetMap[inputData.dataset].transformation.transform({
|
|
133
|
+
data: datasetMap[inputData.dataset].cacheContentType === HelperTypes_1.CacheContentType.JSON ? JSON.parse(data) : data,
|
|
134
|
+
name: inputData.name,
|
|
135
|
+
});
|
|
136
|
+
if (inputData.dataset === ropid_gtfs_1.DatasetEnum.CIS_STOPS) {
|
|
137
|
+
yield this.saveTransformedDataset(transformedDataset.cis_stops, inputData.dataset, modelName[0]);
|
|
138
|
+
yield this.saveTransformedDataset(transformedDataset.cis_stop_groups, inputData.dataset, modelName[1]);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
yield this.saveTransformedDataset(transformedDataset, inputData.dataset, modelName[0]);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
errorMessage = err.message;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (msgProperties === null || msgProperties === void 0 ? void 0 : msgProperties.headers[HelperTypes_1.ORIGIN_HOSTNAME_HEADER]) {
|
|
149
|
+
yield this.gtfsRedisChannel.publishMessage(`${errorMessage !== null && errorMessage !== void 0 ? errorMessage : "OK"} (${modelName})`, {
|
|
150
|
+
channelSuffix: msgProperties.headers[HelperTypes_1.ORIGIN_HOSTNAME_HEADER],
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (errorMessage) {
|
|
154
|
+
throw new golemio_errors_1.GeneralError(errorMessage, this.constructor.name);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.TransformAndSaveDataTask = TransformAndSaveDataTask;
|
|
160
|
+
//# sourceMappingURL=TransformAndSaveDataTask.js.map
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformAndSaveDataTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0C;AAC1C,+EAAoE;AACpE,yCAA8F;AAE9F,kFAAqF;AACrF,wCAA2D;AAC3D,kFAAqF;AACrF,0CAA2D;AAC3D,8EAA8D;AAC9D,mEAAuC;AACvC,6EAAiF;AAGjF,wEAAqE;AAGrE,8FAA2F;AAC3F,2EAA6E;AAC7E,6EAAwE;AACxE,mFAAkF;AAElF,qDAAmD;AACnD,uDAM+B;AAE/B,sEAAmE;AAEnE,MAAa,wBAAyB,SAAQ,sBAA4B;IAYtE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAZP,cAAS,GAAG,sBAAsB,CAAC;QACnC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;QAC3C,WAAM,GAAG,yCAAmB,CAAC;QA0ErC,2BAAsB,GAAG,CAC7B,eAAoB,EACpB,OAAqB,EACrB,SAA2B,EACd,EAAE;YACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YAEnD,QAAQ,OAAO,EAAE;gBACb,KAAK,wBAAW,CAAC,QAAQ,CAAC;gBAC1B,KAAK,wBAAW,CAAC,WAAW;oBACxB,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,SAA8B,CAAC,CAAC;oBAC5E,MAAM;gBACV;oBACI,MAAM,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA,CAAC;oBAC1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,SAAS,GAAG,CAAC,CAAC;aAC3E;YAED,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,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I,SAAS,CAAC,OAAO,KAAK,wBAAW,CAAC,SAAS,EAAE;wBAC7C,MAAM,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjG,MAAM,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,eAAe,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC1G;yBAAM;wBACH,MAAM,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC1F;iBACJ;gBAAC,OAAO,GAAG,EAAE;oBACV,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;iBAC9B;aACJ;YAED,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,oCAAsB,CAAC,EAAE;gBAChD,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,KAAK,SAAS,GAAG,EAAE;oBACjF,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,oCAAsB,CAAC;iBAC/D,CAAC,CAAC;aACN;YAED,IAAI,YAAY,EAAE;gBACd,MAAM,IAAI,6BAAY,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aAC/D;QACL,CAAC;KAAA;CA0FJ;AArKD,4DAqKC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DatasetEnum } from "../../../../RopidGTFSMetadataModel";
|
|
2
|
+
import { DatasetModelName } from "../../../../../../schema-definitions/ropid-gtfs";
|
|
3
|
+
import { IDataSource } from "@golemio/core/dist/integration-engine/datasources/IDataSource";
|
|
4
|
+
import { IFile } from "@golemio/core/dist/integration-engine/datasources/protocol-strategy/IProtocolStrategy";
|
|
5
|
+
import { ITransformation } from "@golemio/core/dist/integration-engine/transformations/ITransformation";
|
|
6
|
+
export declare const ORIGIN_HOSTNAME_HEADER = "x-origin-hostname";
|
|
7
|
+
export type ICachedFileMeta = Omit<IFile, "data">;
|
|
8
|
+
export type ICachedDataset = ICachedFileMeta & {
|
|
9
|
+
dataset: GTFSDatasets;
|
|
10
|
+
};
|
|
11
|
+
export declare enum CacheContentType {
|
|
12
|
+
CSV = "CSV",
|
|
13
|
+
JSON = "JSON"
|
|
14
|
+
}
|
|
15
|
+
export type GTFSDatasets = Exclude<DatasetEnum, DatasetEnum.DEPARTURES_PRESETS>;
|
|
16
|
+
export type DatasetMap = {
|
|
17
|
+
[key in GTFSDatasets]: {
|
|
18
|
+
datasource: IDataSource;
|
|
19
|
+
transformation: ITransformation;
|
|
20
|
+
cacheContentType: CacheContentType;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const isCachedDataset: (obj: any) => obj is ICachedDataset;
|
|
24
|
+
export declare const datasetFileModelMap: (dataset: GTFSDatasets, name: string) => DatasetModelName | DatasetModelName[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.datasetFileModelMap = exports.isCachedDataset = exports.CacheContentType = exports.ORIGIN_HOSTNAME_HEADER = void 0;
|
|
4
|
+
const RopidGTFSMetadataModel_1 = require("../../../../RopidGTFSMetadataModel");
|
|
5
|
+
exports.ORIGIN_HOSTNAME_HEADER = "x-origin-hostname";
|
|
6
|
+
var CacheContentType;
|
|
7
|
+
(function (CacheContentType) {
|
|
8
|
+
CacheContentType["CSV"] = "CSV";
|
|
9
|
+
CacheContentType["JSON"] = "JSON";
|
|
10
|
+
})(CacheContentType || (exports.CacheContentType = CacheContentType = {}));
|
|
11
|
+
const isCachedDataset = (obj) => {
|
|
12
|
+
return obj instanceof Object && obj.filepath !== undefined && obj.name !== undefined && obj.dataset !== undefined;
|
|
13
|
+
};
|
|
14
|
+
exports.isCachedDataset = isCachedDataset;
|
|
15
|
+
const datasetFileModelMap = (dataset, name) => {
|
|
16
|
+
let model;
|
|
17
|
+
switch (dataset) {
|
|
18
|
+
case RopidGTFSMetadataModel_1.DatasetEnum.PID_GTFS:
|
|
19
|
+
model = name;
|
|
20
|
+
break;
|
|
21
|
+
case RopidGTFSMetadataModel_1.DatasetEnum.RUN_NUMBERS:
|
|
22
|
+
model = "run_numbers";
|
|
23
|
+
break;
|
|
24
|
+
case RopidGTFSMetadataModel_1.DatasetEnum.OIS_MAPPING:
|
|
25
|
+
model = "ois";
|
|
26
|
+
break;
|
|
27
|
+
case RopidGTFSMetadataModel_1.DatasetEnum.CIS_STOPS:
|
|
28
|
+
model = ["cis_stops", "cis_stop_groups"];
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Error mapping dataset ${dataset} and source ${name}`);
|
|
32
|
+
}
|
|
33
|
+
return model;
|
|
34
|
+
};
|
|
35
|
+
exports.datasetFileModelMap = datasetFileModelMap;
|
|
36
|
+
//# sourceMappingURL=HelperTypes.js.map
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelperTypes.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.ts"],"names":[],"mappings":";;;AAAA,+EAAoE;AAMvD,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAQ1D,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+BAAW,CAAA;IACX,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAYM,MAAM,eAAe,GAAG,CAAC,GAAQ,EAAyB,EAAE;IAC/D,OAAO,GAAG,YAAY,MAAM,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC;AACtH,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,mBAAmB,GAAG,CAAC,OAAqB,EAAE,IAAY,EAAyC,EAAE;IAC9G,IAAI,KAAK,CAAC;IACV,QAAQ,OAAO,EAAE;QACb,KAAK,oCAAW,CAAC,QAAQ;YACrB,KAAK,GAAG,IAAyB,CAAC;YAClC,MAAM;QACV,KAAK,oCAAW,CAAC,WAAW;YACxB,KAAK,GAAU,aAAa,CAAC;YAC7B,MAAM;QACV,KAAK,oCAAW,CAAC,WAAW;YACxB,KAAK,GAAU,KAAK,CAAC;YACrB,MAAM;QACV,KAAK,oCAAW,CAAC,SAAS;YACtB,KAAK,GAAG,CAAQ,WAAW,EAAS,iBAAiB,CAAC,CAAC;YACvD,MAAM;QACV;YACI,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,eAAe,IAAI,EAAE,CAAC,CAAC;KAC9E;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SourceTableSuffixEnum } from "../../../../helpers/SourceTableSuffixEnum";
|
|
2
|
+
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
3
|
+
export declare class PrecomputedTablesFacade {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
/** Precomputed data repositories */
|
|
6
|
+
private departuresRepository;
|
|
7
|
+
private minMaxStopSequencesRepository;
|
|
8
|
+
private tripScheduleRepository;
|
|
9
|
+
private servicesCalendarRepository;
|
|
10
|
+
constructor(logger: ILogger);
|
|
11
|
+
createAndPopulatePrecomputedTmpTables: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.PrecomputedTablesFacade = void 0;
|
|
25
|
+
const DeparturesRepository_1 = require("../../../../data-access/precomputed/DeparturesRepository");
|
|
26
|
+
const MinMaxStopSequencesRepository_1 = require("../../../../data-access/precomputed/MinMaxStopSequencesRepository");
|
|
27
|
+
const ServicesCalendarRepository_1 = require("../../../../data-access/precomputed/ServicesCalendarRepository");
|
|
28
|
+
const TripScheduleRepository_1 = require("../../../../data-access/precomputed/TripScheduleRepository");
|
|
29
|
+
const SourceTableSuffixEnum_1 = require("../../../../helpers/SourceTableSuffixEnum");
|
|
30
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
31
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
32
|
+
let PrecomputedTablesFacade = exports.PrecomputedTablesFacade = class PrecomputedTablesFacade {
|
|
33
|
+
constructor(logger) {
|
|
34
|
+
this.logger = logger;
|
|
35
|
+
this.createAndPopulatePrecomputedTmpTables = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
this.logger.info(`Datasets: creating temp table ${this.servicesCalendarRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
37
|
+
yield this.servicesCalendarRepository.createAndPopulate(sourceTableSuffix);
|
|
38
|
+
this.logger.info(`Datasets: creating indexes on ${this.servicesCalendarRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
39
|
+
yield this.servicesCalendarRepository.createIndexes();
|
|
40
|
+
this.logger.info(`Datasets: creating temp table ${this.minMaxStopSequencesRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
41
|
+
yield this.minMaxStopSequencesRepository.createAndPopulate(sourceTableSuffix);
|
|
42
|
+
this.logger.info(`Datasets: creating indexes on ${this.minMaxStopSequencesRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
43
|
+
yield this.minMaxStopSequencesRepository.createIndexes();
|
|
44
|
+
this.logger.info(`Datasets: creating temp table ${this.tripScheduleRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
45
|
+
yield this.tripScheduleRepository.createAndPopulate(sourceTableSuffix);
|
|
46
|
+
this.logger.info(`Datasets: creating indexes on ${this.tripScheduleRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
47
|
+
yield this.tripScheduleRepository.createIndexes();
|
|
48
|
+
this.logger.info(`Datasets: creating temp table ${this.departuresRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
49
|
+
yield this.departuresRepository.createAndPopulate(sourceTableSuffix);
|
|
50
|
+
this.logger.info(`Datasets: creating indexes on ${this.departuresRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
51
|
+
yield this.departuresRepository.createIndexes();
|
|
52
|
+
this.logger.info(`Datasets: running analyze on ${this.departuresRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
|
|
53
|
+
yield this.departuresRepository.analyze();
|
|
54
|
+
});
|
|
55
|
+
/** Precomputed data repositories */
|
|
56
|
+
this.departuresRepository = new DeparturesRepository_1.DeparturesRepository();
|
|
57
|
+
this.minMaxStopSequencesRepository = new MinMaxStopSequencesRepository_1.MinMaxStopSequencesRepository();
|
|
58
|
+
this.tripScheduleRepository = new TripScheduleRepository_1.TripScheduleRepository();
|
|
59
|
+
this.servicesCalendarRepository = new ServicesCalendarRepository_1.ServicesCalendarRepository();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.PrecomputedTablesFacade = PrecomputedTablesFacade = __decorate([
|
|
63
|
+
(0, tsyringe_1.injectable)(),
|
|
64
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
65
|
+
__metadata("design:paramtypes", [Object])
|
|
66
|
+
], PrecomputedTablesFacade);
|
|
67
|
+
//# sourceMappingURL=PrecomputedTablesFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecomputedTablesFacade.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.ts"],"names":[],"m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,CAAC,CAAA;;GAP5B,uBAAuB,CAmDnC"}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DatasetMap } from "./HelperTypes";
|
|
2
|
+
export declare class RopidGtfsFactory {
|
|
3
|
+
private dataSourceGtfs;
|
|
4
|
+
private dataSourceCisStops;
|
|
5
|
+
private dataSourceOisMapping;
|
|
6
|
+
private dataSourceRunNumbers;
|
|
7
|
+
private transformationGtfs;
|
|
8
|
+
private transformationCisStops;
|
|
9
|
+
private transformationOisMapping;
|
|
10
|
+
private datasetMap;
|
|
11
|
+
constructor();
|
|
12
|
+
getDatasetMap(): DatasetMap;
|
|
13
|
+
}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
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.RopidGtfsFactory = void 0;
|
|
13
|
+
const RopidGTFSMetadataModel_1 = require("../../../../RopidGTFSMetadataModel");
|
|
14
|
+
const RopidGTFSCisStopsTransformation_1 = require("../../../../transformations/RopidGTFSCisStopsTransformation");
|
|
15
|
+
const RopidGTFSOisTransformation_1 = require("../../../../transformations/RopidGTFSOisTransformation");
|
|
16
|
+
const RopidGTFSTransformation_1 = require("../../../../transformations/RopidGTFSTransformation");
|
|
17
|
+
const ropid_gtfs_1 = require("../../../../../../schema-definitions/ropid-gtfs");
|
|
18
|
+
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
19
|
+
const RetryDataSource_1 = require("@golemio/core/dist/integration-engine/datasources/RetryDataSource");
|
|
20
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
21
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
const HelperTypes_1 = require("./HelperTypes");
|
|
23
|
+
let RopidGtfsFactory = exports.RopidGtfsFactory = class RopidGtfsFactory {
|
|
24
|
+
constructor() {
|
|
25
|
+
// Ropid GTFS
|
|
26
|
+
this.dataSourceGtfs = new RetryDataSource_1.RetryDataSource(ropid_gtfs_1.RopidGTFS.name + "DataSource", new integration_engine_1.FTPProtocolStrategy({
|
|
27
|
+
filename: integration_engine_1.config.datasources.RopidGTFSFilename,
|
|
28
|
+
targetType: integration_engine_1.FTPTargetType.COMPRESSED,
|
|
29
|
+
returnType: integration_engine_1.FTPReturnType.Stream,
|
|
30
|
+
path: integration_engine_1.config.datasources.RopidGTFSPath,
|
|
31
|
+
url: integration_engine_1.config.datasources.RopidFTP,
|
|
32
|
+
whitelistedFiles: [
|
|
33
|
+
"agency.txt",
|
|
34
|
+
"calendar.txt",
|
|
35
|
+
"calendar_dates.txt",
|
|
36
|
+
"shapes.txt",
|
|
37
|
+
"stop_times.txt",
|
|
38
|
+
"stops.txt",
|
|
39
|
+
"routes.txt",
|
|
40
|
+
"trips.txt",
|
|
41
|
+
],
|
|
42
|
+
encoding: "utf8",
|
|
43
|
+
}), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), null);
|
|
44
|
+
this.transformationGtfs = new RopidGTFSTransformation_1.RopidGTFSTransformation();
|
|
45
|
+
// Ropid GTFS Run Numbers Datasource
|
|
46
|
+
this.dataSourceRunNumbers = new RetryDataSource_1.RetryDataSource(ropid_gtfs_1.RopidGTFS.run_numbers.name + "DataSource", new integration_engine_1.FTPProtocolStrategy({
|
|
47
|
+
filename: integration_engine_1.config.datasources.RopidGTFSRunNumbersFilename,
|
|
48
|
+
returnType: integration_engine_1.FTPReturnType.Stream,
|
|
49
|
+
path: integration_engine_1.config.datasources.RopidGTFSRunNumbersPath,
|
|
50
|
+
url: integration_engine_1.config.datasources.RopidFTP,
|
|
51
|
+
encoding: "utf8",
|
|
52
|
+
}), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), null);
|
|
53
|
+
// Ropid GTFS CIS STOPS Datasource
|
|
54
|
+
const cisStopsTypeStrategy = new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "stopGroups" });
|
|
55
|
+
cisStopsTypeStrategy.setFilter((item) => item.cis !== 0);
|
|
56
|
+
this.dataSourceCisStops = new RetryDataSource_1.RetryDataSource(ropid_gtfs_1.RopidGTFS.name + "CisStops", new integration_engine_1.FTPProtocolStrategy({
|
|
57
|
+
filename: integration_engine_1.config.datasources.RopidGTFSCisStopsFilename,
|
|
58
|
+
path: integration_engine_1.config.datasources.RopidGTFSCisStopsPath,
|
|
59
|
+
url: integration_engine_1.config.datasources.RopidFTP,
|
|
60
|
+
encoding: "utf8",
|
|
61
|
+
}), cisStopsTypeStrategy, null);
|
|
62
|
+
this.transformationCisStops = new RopidGTFSCisStopsTransformation_1.RopidGTFSCisStopsTransformation();
|
|
63
|
+
// Ropid GTFS Ois Datasource
|
|
64
|
+
this.dataSourceOisMapping = new RetryDataSource_1.RetryDataSource(ropid_gtfs_1.RopidGTFS.name + "Ois", new integration_engine_1.FTPProtocolStrategy({
|
|
65
|
+
filename: integration_engine_1.config.datasources.RopidGTFSOisFilename,
|
|
66
|
+
path: integration_engine_1.config.datasources.RopidGTFSOisPath,
|
|
67
|
+
url: integration_engine_1.config.datasources.RopidFTP,
|
|
68
|
+
encoding: "utf8",
|
|
69
|
+
}), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator(ropid_gtfs_1.RopidGTFS.ois.name + "DataSource", ropid_gtfs_1.RopidGTFS.ois.datasourceJsonSchema));
|
|
70
|
+
this.transformationOisMapping = new RopidGTFSOisTransformation_1.RopidGTFSOisMappingTransformation();
|
|
71
|
+
this.datasetMap = {
|
|
72
|
+
[RopidGTFSMetadataModel_1.DatasetEnum.PID_GTFS]: {
|
|
73
|
+
datasource: this.dataSourceGtfs,
|
|
74
|
+
transformation: this.transformationGtfs,
|
|
75
|
+
cacheContentType: HelperTypes_1.CacheContentType.CSV,
|
|
76
|
+
},
|
|
77
|
+
[RopidGTFSMetadataModel_1.DatasetEnum.RUN_NUMBERS]: {
|
|
78
|
+
datasource: this.dataSourceRunNumbers,
|
|
79
|
+
transformation: this.transformationGtfs,
|
|
80
|
+
cacheContentType: HelperTypes_1.CacheContentType.CSV,
|
|
81
|
+
},
|
|
82
|
+
[RopidGTFSMetadataModel_1.DatasetEnum.CIS_STOPS]: {
|
|
83
|
+
datasource: this.dataSourceCisStops,
|
|
84
|
+
transformation: this.transformationCisStops,
|
|
85
|
+
cacheContentType: HelperTypes_1.CacheContentType.JSON,
|
|
86
|
+
},
|
|
87
|
+
[RopidGTFSMetadataModel_1.DatasetEnum.OIS_MAPPING]: {
|
|
88
|
+
datasource: this.dataSourceOisMapping,
|
|
89
|
+
transformation: this.transformationOisMapping,
|
|
90
|
+
cacheContentType: HelperTypes_1.CacheContentType.JSON,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
getDatasetMap() {
|
|
95
|
+
return this.datasetMap;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
exports.RopidGtfsFactory = RopidGtfsFactory = __decorate([
|
|
99
|
+
(0, tsyringe_1.injectable)(),
|
|
100
|
+
__metadata("design:paramtypes", [])
|
|
101
|
+
], RopidGtfsFactory);
|
|
102
|
+
//# sourceMappingURL=RopidGtfsFactory.js.map
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopidGtfsFactory.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAAoE;AACpE,iHAAiH;AACjH,uGAA8G;AAC9G,iGAAiG;AACjG,gFAA4C;AAC5C,8EAO+C;AAC/C,uGAAoG;AACpG,mFAAkF;AAClF,iEAAgE;AAChE,+CAA6D;AAGtD,IAAM,gBAAgB,8BAAtB,MAAM,gBAAgB;IAYzB;QACI,aAAa;QACb,IAAI,CAAC,cAAc,GAAG,IAAI,iCAAe,CACrC,sBAAS,CAAC,IAAI,GAAG,YAAY,EAC7B,IAAI,wCAAmB,CAAC;YACpB,QAAQ,EAAE,2BAAM,CAAC,WAAW,CAAC,iBAAiB;YAC9C,UAAU,EAAE,kCAAa,CAAC,UAAU;YACpC,UAAU,EAAE,kCAAa,CAAC,MAAM;YAChC,IAAI,EAAE,2BAAM,CAAC,WAAW,CAAC,aAAa;YACtC,GAAG,EAAE,2BAAM,CAAC,WAAW,CAAC,QAAQ;YAChC,gBAAgB,EAAE;gBACd,YAAY;gBACZ,cAAc;gBACd,oBAAoB;gBACpB,YAAY;gBACZ,gBAAgB;gBAChB,WAAW;gBACX,YAAY;gBACZ,WAAW;aACd;YACD,QAAQ,EAAE,MAAM;SACnB,CAAC,EACF,IAAI,yCAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,EAC7C,IAAW,CACd,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAExD,oCAAoC;QACpC,IAAI,CA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,CA8G5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICheckForNewDataInput.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/ICheckForNewDataInput.ts"],"names":[],"mappings":""}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IDatasetsInput.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDatasetsInput.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/interfaces/IDatasetsInput.ts"],"names":[],"mappings":""}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CachedDatasetSchema.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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.CachedDatasetSchema = void 0;
|
|
13
|
+
const ropid_gtfs_1 = require("../../../..");
|
|
14
|
+
const class_validator_1 = require("@golemio/core/dist/shared/class-validator");
|
|
15
|
+
class CachedDatasetSchema {
|
|
16
|
+
}
|
|
17
|
+
exports.CachedDatasetSchema = CachedDatasetSchema;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], CachedDatasetSchema.prototype, "filepath", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], CachedDatasetSchema.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], CachedDatasetSchema.prototype, "mtime", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
__metadata("design:type", Object)
|
|
35
|
+
], CachedDatasetSchema.prototype, "type", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsEnum)(ropid_gtfs_1.DatasetEnum),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], CachedDatasetSchema.prototype, "dataset", void 0);
|
|
40
|
+
//# sourceMappingURL=CachedDatasetSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CachedDatasetSchema.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/schema/CachedDatasetSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA6C;AAC7C,+EAAyF;AAGzF,MAAa,mBAAmB;CAa/B;AAbD,kDAaC;AAXG;IADC,IAAA,0BAAQ,GAAE;;qDACO;AAElB;IADC,IAAA,0BAAQ,GAAE;;iDACG;AAGd;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACgB;AAG3B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iDACe;AAE1B;IADC,IAAA,wBAAM,EAAC,wBAAW,CAAC;;oDACG"}
|