@golemio/pid 2.8.6 → 2.8.7-dev.963032002
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/migrations/postgresql/20230802143613-ropid-gtfs-update-procedures.js +53 -0
- package/db/migrations/postgresql/sqls/20230802143613-ropid-gtfs-update-procedures-down.sql +7 -0
- package/db/migrations/postgresql/sqls/20230802143613-ropid-gtfs-update-procedures-up.sql +149 -0
- package/dist/integration-engine/ioc/Di.js +0 -4
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +0 -2
- package/dist/integration-engine/ioc/ModuleContainerToken.js +0 -2
- package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.d.ts +1 -1
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.js +6 -8
- package/dist/integration-engine/ropid-gtfs/LegacyRopidGTFSWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.d.ts +30 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js +152 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsFacade.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.d.ts +22 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js +120 -0
- package/dist/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.d.ts +18 -0
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js +95 -0
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.d.ts +1 -2
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +2 -16
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.d.ts +1 -4
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js +2 -38
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts +1 -4
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +2 -37
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts +2 -4
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +2 -38
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.d.ts +3 -3
- package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js +17 -15
- package/dist/integration-engine/ropid-gtfs/facade/DeparturePresetsFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/index.d.ts +1 -1
- package/dist/integration-engine/ropid-gtfs/index.js +1 -1
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +8 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +4 -0
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js +3 -3
- package/dist/integration-engine/ropid-gtfs/workers/presets/tasks/SavePresetsDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.d.ts +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js +3 -5
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckForNewDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.d.ts +6 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +54 -38
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.d.ts +3 -2
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js +8 -7
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/DownloadDatasetsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.d.ts +2 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js +6 -3
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.d.ts +2 -3
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js +12 -26
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.d.ts +2 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.js +11 -6
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/HelperTypes.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.d.ts +3 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js +14 -17
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/PrecomputedTablesFacade.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.d.ts +2 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js +8 -5
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/helpers/RopidGtfsFactory.js.map +1 -1
- package/dist/integration-engine/shared/RopidMetadataModel.d.ts +5 -1
- package/dist/integration-engine/shared/RopidMetadataModel.js +9 -19
- package/dist/integration-engine/shared/RopidMetadataModel.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +0 -3
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +0 -45
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/AgencyDto.js +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/AgencyDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/CalendarDatesDto.js +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/CalendarDatesDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/CalendarDto.js +6 -6
- package/dist/schema-definitions/ropid-gtfs/models/CalendarDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/RouteDto.js +3 -3
- package/dist/schema-definitions/ropid-gtfs/models/RouteDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/ShapeDto.js +2 -2
- package/dist/schema-definitions/ropid-gtfs/models/ShapeDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/StopDto.d.ts +1 -2
- package/dist/schema-definitions/ropid-gtfs/models/StopDto.js +5 -25
- package/dist/schema-definitions/ropid-gtfs/models/StopDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/StopTimesDto.d.ts +1 -2
- package/dist/schema-definitions/ropid-gtfs/models/StopTimesDto.js +3 -14
- package/dist/schema-definitions/ropid-gtfs/models/StopTimesDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/TripDto.js +2 -2
- package/dist/schema-definitions/ropid-gtfs/models/TripDto.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.d.ts +1 -2
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js +0 -14
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-descriptors/models/DescriptorModel.d.ts +1 -2
- package/dist/schema-definitions/vehicle-descriptors/models/DescriptorModel.js +0 -8
- package/dist/schema-definitions/vehicle-descriptors/models/DescriptorModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.d.ts +1 -2
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +0 -8
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
- package/package.json +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.d.ts +0 -36
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js +0 -229
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/utils.d.ts +0 -4
- package/dist/integration-engine/ropid-gtfs/utils.js +0 -28
- package/dist/integration-engine/ropid-gtfs/utils.js.map +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RopidGtfsMetadataRepository = exports.DatasetEnum = void 0;
|
|
25
|
+
const shared_1 = require("../shared");
|
|
26
|
+
const ropid_gtfs_1 = require("../../schema-definitions/ropid-gtfs");
|
|
27
|
+
const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
|
|
28
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
+
var DatasetEnum;
|
|
30
|
+
(function (DatasetEnum) {
|
|
31
|
+
DatasetEnum["PID_GTFS"] = "PID_GTFS";
|
|
32
|
+
DatasetEnum["CIS_STOPS"] = "CIS_STOPS";
|
|
33
|
+
DatasetEnum["OIS_MAPPING"] = "OIS_MAPPING";
|
|
34
|
+
DatasetEnum["RUN_NUMBERS"] = "RUN_NUMBERS";
|
|
35
|
+
DatasetEnum["DEPARTURES_PRESETS"] = "DEPARTURES_PRESETS";
|
|
36
|
+
})(DatasetEnum || (exports.DatasetEnum = DatasetEnum = {}));
|
|
37
|
+
let RopidGtfsMetadataRepository = exports.RopidGtfsMetadataRepository = class RopidGtfsMetadataRepository extends shared_1.RopidMetadataModel {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(ropid_gtfs_1.RopidGTFS);
|
|
40
|
+
this.getAllSaved = (dataset, version) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const tables = yield this.sequelizeModel.findAll({
|
|
42
|
+
attributes: [["key", "tn"]],
|
|
43
|
+
where: {
|
|
44
|
+
dataset,
|
|
45
|
+
type: shared_1.MetaTypeEnum.STATE,
|
|
46
|
+
value: shared_1.MetaStateEnum.SAVED,
|
|
47
|
+
version,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return tables;
|
|
51
|
+
});
|
|
52
|
+
this.checkAllTablesHasSavedState = (datasets) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const notSaved = yield this.sequelizeModel.count({
|
|
54
|
+
where: {
|
|
55
|
+
[sequelize_1.default.Op.or]: datasets.map((item) => ({
|
|
56
|
+
dataset: item.dataset,
|
|
57
|
+
version: item.version,
|
|
58
|
+
type: shared_1.MetaTypeEnum.STATE,
|
|
59
|
+
value: { [sequelize_1.default.Op.ne]: shared_1.MetaStateEnum.SAVED },
|
|
60
|
+
})),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return notSaved === 0;
|
|
64
|
+
});
|
|
65
|
+
this.checkIfNewVersionIsAlreadyDeployed = (dataset, version) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const alreadyDeployed = yield this.sequelizeModel.count({
|
|
67
|
+
where: {
|
|
68
|
+
dataset,
|
|
69
|
+
key: shared_1.MetaDatasetInfoKeyEnum.DEPLOYED,
|
|
70
|
+
type: shared_1.MetaTypeEnum.DATASET_INFO,
|
|
71
|
+
value: "true",
|
|
72
|
+
version,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
return alreadyDeployed !== 0;
|
|
76
|
+
});
|
|
77
|
+
this.updateState = (dataset, name, state, version) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return this.sequelizeModel.update({
|
|
79
|
+
dataset,
|
|
80
|
+
key: name,
|
|
81
|
+
type: shared_1.MetaTypeEnum.STATE,
|
|
82
|
+
value: state,
|
|
83
|
+
version,
|
|
84
|
+
}, {
|
|
85
|
+
where: {
|
|
86
|
+
dataset,
|
|
87
|
+
key: name,
|
|
88
|
+
type: shared_1.MetaTypeEnum.STATE,
|
|
89
|
+
version,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
this.getNumberOfDownloadRetries = (dataset, version) => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const numberOfRetries = yield this.sequelizeModel.findOne({
|
|
95
|
+
attributes: [["value", "retries"]],
|
|
96
|
+
where: {
|
|
97
|
+
dataset,
|
|
98
|
+
key: shared_1.MetaDatasetInfoKeyEnum.NUMBER_OF_RETRIES,
|
|
99
|
+
type: shared_1.MetaTypeEnum.DATASET_INFO,
|
|
100
|
+
version: version - 1,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
if (!numberOfRetries) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
return +numberOfRetries.dataValues.retries;
|
|
107
|
+
});
|
|
108
|
+
this.bulkCreate = (data, options) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
yield this.sequelizeModel.bulkCreate(data, options);
|
|
110
|
+
});
|
|
111
|
+
this.destroy = (options) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
yield this.sequelizeModel.destroy(options);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
exports.RopidGtfsMetadataRepository = RopidGtfsMetadataRepository = __decorate([
|
|
117
|
+
(0, tsyringe_1.injectable)(),
|
|
118
|
+
__metadata("design:paramtypes", [])
|
|
119
|
+
], RopidGtfsMetadataRepository);
|
|
120
|
+
//# sourceMappingURL=RopidGtfsMetadataRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopidGtfsMetadataRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/RopidGtfsMetadataRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAqG;AACrG,oEAA4C;AAC5C,oFAAmG;AACnG,iEAAgE;AAEhE,IAAY,WAMX;AAND,WAAY,WAAW;IACnB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,wDAAyC,CAAA;AAC7C,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAGM,IAAM,2BAA2B,yCAAjC,MAAM,2BAA4B,SAAQ,2BAAkB;IAC/D;QACI,KAAK,CAAC,sBAAS,CAAC,CAAC;QAGd,gBAAW,GAAG,CAAO,OAAe,EAAE,OAAe,EAAkB,EAAE;YAC5E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAC7C,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBAC3B,KAAK,EAAE;oBACH,OAAO;oBACP,IAAI,EAAE,qBAAY,CAAC,KAAK;oBACxB,KAAK,EAAE,sBAAa,CAAC,KAAK;oBAC1B,OAAO;iBACV;aACJ,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAClB,CAAC,CAAA,CAAC;QAEK,gCAA2B,GAAG,CAAO,QAAqD,EAAoB,EAAE;YACnH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cA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AAC;QAEK,+BAA0B,GAAG,CAAO,OAAe,EAAE,OAAe,EAAmB,EAAE;YAC5F,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACtD,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAClC,KAAK,EAAE;oBACH,OAAO;oBACP,GAAG,EAAE,+BAAsB,CAAC,iBAAiB;oBAC7C,IAAI,EAAE,qBAAY,CAAC,YAAY;oBAC/B,OAAO,EAAE,OAAO,GAAG,CAAC;iBACvB;aACJ,CAAC,CAAC;YAEH,IAAI,CAAC,eAAe,EAAE;gBAClB,OAAO,CAAC,CAAC;aACZ;YAED,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC;QAC/C,CAAC,CAAA,CAAC;QAEK,eAAU,GAAG,CAAO,IAAW,EAAE,OAA0B,EAAiB,EAAE;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC,CAAA,CAAC;QAEK,YAAO,GAAG,CAAO,OAAuB,EAAiB,EAAE;YAC9D,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC,CAAA,CAAC;IAvFF,CAAC;CAwFJ,CAAA;sCA3FY,2BAA2B;IADvC,IAAA,qBAAU,GAAE;;GACA,2BAA2B,CA2FvC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
2
|
+
import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
|
|
3
|
+
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
4
|
+
export declare class RopidGtfsRepository {
|
|
5
|
+
private connector;
|
|
6
|
+
private logger;
|
|
7
|
+
private preparationProcedure;
|
|
8
|
+
private cleaningTmpProcedure;
|
|
9
|
+
private cleaningOldProcedure;
|
|
10
|
+
private replaceAllProcedure;
|
|
11
|
+
private createPrecomputedTmpTablesProcedure;
|
|
12
|
+
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
13
|
+
replaceAllTable(tables: string[], t: Transaction): Promise<void>;
|
|
14
|
+
createTmpTables(): Promise<void>;
|
|
15
|
+
createPrecomputedTmpTables(): Promise<void>;
|
|
16
|
+
cleanTmpAndOldTables(): Promise<void>;
|
|
17
|
+
cleanOldTables(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.RopidGtfsRepository = void 0;
|
|
25
|
+
const const_1 = require("../../../schema-definitions/const");
|
|
26
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
27
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
28
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
+
let RopidGtfsRepository = exports.RopidGtfsRepository = class RopidGtfsRepository {
|
|
30
|
+
constructor(connector, logger) {
|
|
31
|
+
this.connector = connector;
|
|
32
|
+
this.logger = logger;
|
|
33
|
+
this.preparationProcedure = "ropidgtfs_prepareTmpTables";
|
|
34
|
+
this.cleaningTmpProcedure = "ropidgtfs_cleanTmpTables";
|
|
35
|
+
this.cleaningOldProcedure = "ropidgtfs_cleanOldTables";
|
|
36
|
+
this.replaceAllProcedure = "ropidgtfs_replaceAllSavedTables";
|
|
37
|
+
this.createPrecomputedTmpTablesProcedure = "ropidgtfs_preparePrecomputedTmpTables";
|
|
38
|
+
}
|
|
39
|
+
replaceAllTable(tables, t) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
this.logger.info(`Replacing tmp for actual tables: ${tables.join(", ")}`);
|
|
42
|
+
const connection = this.connector.getConnection();
|
|
43
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.replaceAllProcedure}($1);`, {
|
|
44
|
+
transaction: t,
|
|
45
|
+
bind: [tables.join(",")],
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
createTmpTables() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
this.logger.info(`Creating tmp tables`);
|
|
52
|
+
const connection = this.connector.getConnection();
|
|
53
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.preparationProcedure}();`);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
createPrecomputedTmpTables() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
this.logger.info(`Creating precomputed tmp tables`);
|
|
59
|
+
const connection = this.connector.getConnection();
|
|
60
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.createPrecomputedTmpTablesProcedure}();`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
cleanTmpAndOldTables() {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
this.logger.info(`Cleaning tmp and old tables`);
|
|
67
|
+
const connection = this.connector.getConnection();
|
|
68
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.cleaningOldProcedure}();`);
|
|
69
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.cleaningTmpProcedure}();`);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
this.logger.error(new golemio_errors_1.GeneralError("Error while cleaning tmp and old tables", this.constructor.name, err));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
cleanOldTables() {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
try {
|
|
79
|
+
this.logger.info(`Cleaning tmp and old tables`);
|
|
80
|
+
const connection = this.connector.getConnection();
|
|
81
|
+
yield connection.query(`CALL ${const_1.PG_SCHEMA}.${this.cleaningOldProcedure}();`);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
this.logger.error(new golemio_errors_1.GeneralError("Error while cleaning old tables", this.constructor.name, err));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.RopidGtfsRepository = RopidGtfsRepository = __decorate([
|
|
90
|
+
(0, tsyringe_1.injectable)(),
|
|
91
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
92
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
93
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
94
|
+
], RopidGtfsRepository);
|
|
95
|
+
//# sourceMappingURL=RopidGtfsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopidGtfsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAuC;AAEvC,wEAAqE;AAErE,6EAAwE;AAExE,iEAAwE;AAGjE,IAAM,mBAAmB,iCAAzB,MAAM,mBAAmB;IAO5B,YACyC,SAAqC,EAChD,MAAuB;QADJ,cAAS,GAAT,SAAS,CAAoB;QACxC,WAAM,GAAN,MAAM,CAAS;QAR7C,yBAAoB,GAAG,4BAA4B,CAAC;QACpD,yBAAoB,GAAG,0BAA0B,CAAC;QAClD,yBAAoB,GAAG,0BAA0B,CAAC;QAClD,wBAAmB,GAAG,iCAAiC,CAAC;QACxD,wCAAmC,GAAG,uCAAuC,CAAC;IAKnF,CAAC;IAES,eAAe,CAAC,MAAgB,EAAE,CAAc;;YACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YAClD,MAAM,UAAU,CAAC,KAAK,CAAC,QAAQ,iBAAS,IAAI,IAAI,CAAC,mBAAmB,OAAO,EAAE;gBACzE,WAAW,EAAE,CAAC;gBACd,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC3B,CAAC,CAAC;QACP,CAAC;KAA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U,CAAC,KAAK,CAAC,QAAQ,iBAAS,IAAI,IAAI,CAAC,oBAAoB,KAAK,CAAC,CAAC;aAC/E;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,6BAAY,CAAC,iCAAiC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;aACtG;QACL,CAAC;KAAA;CACJ,CAAA;8BArDY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;IASJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GATpB,mBAAmB,CAqD/B"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
2
|
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
3
|
+
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
4
4
|
export declare class DeparturesRepository extends PostgresModel implements IModel {
|
|
5
5
|
constructor();
|
|
6
6
|
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
7
7
|
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
8
|
analyze: () => Promise<void>;
|
|
9
|
-
createIndexes: () => Promise<void>;
|
|
10
9
|
}
|
|
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DeparturesRepository = void 0;
|
|
13
13
|
const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
|
|
14
|
-
const utils_1 = require("../../utils");
|
|
15
14
|
const const_1 = require("../../../../schema-definitions/const");
|
|
16
15
|
const precomputed_1 = require("../../../../schema-definitions/ropid-gtfs/models/precomputed");
|
|
17
16
|
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
@@ -80,7 +79,7 @@ class DeparturesRepository extends models_1.PostgresModel {
|
|
|
80
79
|
yield this.sequelizeModel.sequelize.query(`
|
|
81
80
|
SET LOCAL search_path TO ${const_1.PG_SCHEMA};
|
|
82
81
|
DROP TABLE IF EXISTS ${tmpTableName};
|
|
83
|
-
CREATE TABLE ${tmpTableName} (LIKE ${tableName} including
|
|
82
|
+
CREATE TABLE ${tmpTableName} (LIKE ${tableName} including all);
|
|
84
83
|
INSERT INTO ${tmpTableName} ${sql};`, {
|
|
85
84
|
replacements: {
|
|
86
85
|
defaultRouteType: RouteTypeEnums_1.GTFSRouteTypeEnum.EXT_MISCELLANEOUS,
|
|
@@ -97,14 +96,12 @@ class DeparturesRepository extends models_1.PostgresModel {
|
|
|
97
96
|
const tableName = precomputed_1.DeparturesModel.TABLE_NAME;
|
|
98
97
|
const tmpTableName = tableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
99
98
|
const dropTableName = tableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Drop;
|
|
100
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(precomputed_1.DeparturesModel.indexesOptions);
|
|
101
99
|
yield this.sequelizeModel.sequelize.query(`
|
|
102
100
|
SET LOCAL search_path TO ${const_1.PG_SCHEMA};
|
|
103
101
|
LOCK ${tableName} IN EXCLUSIVE MODE;
|
|
104
102
|
ALTER TABLE ${tableName} RENAME TO ${dropTableName};
|
|
105
103
|
ALTER TABLE ${tmpTableName} RENAME TO ${tableName};
|
|
106
|
-
DROP TABLE ${dropTableName} CASCADE;
|
|
107
|
-
${indexQuery}`, { transaction });
|
|
104
|
+
DROP TABLE ${dropTableName} CASCADE;`, { transaction });
|
|
108
105
|
}
|
|
109
106
|
catch (err) {
|
|
110
107
|
helpers_1.log.error(err);
|
|
@@ -120,17 +117,6 @@ class DeparturesRepository extends models_1.PostgresModel {
|
|
|
120
117
|
throw err;
|
|
121
118
|
}
|
|
122
119
|
});
|
|
123
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
try {
|
|
125
|
-
const indexes = precomputed_1.DeparturesModel.indexesOptions;
|
|
126
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(precomputed_1.DeparturesModel.TABLE_NAME, indexes);
|
|
127
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
128
|
-
}
|
|
129
|
-
catch (err) {
|
|
130
|
-
helpers_1.log.error(err);
|
|
131
|
-
throw err;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
120
|
}
|
|
135
121
|
}
|
|
136
122
|
exports.DeparturesRepository = DeparturesRepository;
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeparturesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uEAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"DeparturesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uEAA4D;AAC5D,gEAAuC;AACvC,8FAAqE;AACrE,yEAAsE;AACtE,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAClF,+EAA4E;AAG5E,MAAa,oBAAqB,SAAQ,sBAAa;IACnD;QACI,KAAK,CACD,sBAAsB,EACtB;YACI,WAAW,EAAE,6BAAe,CAAC,UAAU;YACvC,QAAQ,EAAE,iBAAS;YACnB,yBAAyB,EAAE,6BAAe,CAAC,cAAc;YACzD,kBAAkB,EAAE,CAAC,IA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,SAAS,GAAG,6CAAqB,CAAC,IAAI,CAAC;gBAE7D,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC;2CAC2B,iBAAS;uBAC7B,SAAS;8BACF,SAAS,cAAc,aAAa;8BACpC,YAAY,cAAc,SAAS;6BACpC,aAAa,WAAW,EACrC,EAAE,WAAW,EAAE,CAClB,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAEK,YAAO,GAAG,GAAwB,EAAE;YACvC,IAAI;gBACA,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC,WAAW,iBAAS,IAAI,6BAAe,CAAC,UAAU,GAAG,6CAAqB,CAAC,GAAG,GAAG,CACpF,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAvGF,CAAC;CAwGJ;AArHD,oDAqHC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
2
|
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
3
|
export declare class MinMaxStopSequencesRepository extends PostgresModel implements IModel {
|
|
5
4
|
constructor();
|
|
6
|
-
|
|
7
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
|
-
createIndexes: () => Promise<void>;
|
|
5
|
+
populate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
9
6
|
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MinMaxStopSequencesRepository = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
13
|
const const_1 = require("../../../../schema-definitions/const");
|
|
15
14
|
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
16
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
@@ -26,7 +25,7 @@ class MinMaxStopSequencesRepository extends models_1.PostgresModel {
|
|
|
26
25
|
savingType: "insertOnly",
|
|
27
26
|
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
28
27
|
}, new golemio_validator_1.JSONSchemaValidator("MinMaxStopSequencesRepositoryValidator", ropid_gtfs_1.RopidGTFS.minMaxStopSequences.outputJsonSchema));
|
|
29
|
-
this.
|
|
28
|
+
this.populate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
30
29
|
const sql = `
|
|
31
30
|
SELECT
|
|
32
31
|
trip_id,
|
|
@@ -45,42 +44,7 @@ class MinMaxStopSequencesRepository extends models_1.PostgresModel {
|
|
|
45
44
|
`;
|
|
46
45
|
try {
|
|
47
46
|
const tmpTable = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
48
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
49
|
-
CREATE TABLE "${const_1.PG_SCHEMA}"."${tmpTable}" (
|
|
50
|
-
LIKE "${const_1.PG_SCHEMA}"."${ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName}"
|
|
51
|
-
);
|
|
52
|
-
INSERT INTO "${const_1.PG_SCHEMA}"."${tmpTable}" ${sql};`);
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
helpers_1.log.error(err);
|
|
56
|
-
throw err;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
try {
|
|
61
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName;
|
|
62
|
-
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
63
|
-
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
64
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.minMaxStopSequences.modelIndexOptions);
|
|
65
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
66
|
-
LOCK "${const_1.PG_SCHEMA}".${pgTableName} IN EXCLUSIVE MODE;
|
|
67
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameActual} NO INHERIT "${const_1.PG_SCHEMA}".${pgTableName};
|
|
68
|
-
DROP TABLE IF EXISTS "${const_1.PG_SCHEMA}"."${tableNameActual}";
|
|
69
|
-
${indexQuery}
|
|
70
|
-
ALTER TABLE "${const_1.PG_SCHEMA}"."${tableNameTmp}" RENAME TO ${tableNameActual};
|
|
71
|
-
ALTER TABLE "${const_1.PG_SCHEMA}"."${tableNameActual}" INHERIT "${const_1.PG_SCHEMA}"."${pgTableName}";
|
|
72
|
-
`, { transaction });
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
helpers_1.log.error(err);
|
|
76
|
-
throw err;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
try {
|
|
81
|
-
const indexes = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.modelIndexOptions;
|
|
82
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName, indexes);
|
|
83
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
47
|
+
yield this.sequelizeModel.sequelize.query(`INSERT INTO "${const_1.PG_SCHEMA}"."${tmpTable}" ${sql};`);
|
|
84
48
|
}
|
|
85
49
|
catch (err) {
|
|
86
50
|
helpers_1.log.error(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinMaxStopSequencesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"MinMaxStopSequencesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuC;AACvC,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAClF,+EAA4E;AAE5E,MAAa,6BAA8B,SAAQ,sBAAa;IAC5D;QACI,KAAK,CACD,+BAA+B,EAC/B;YACI,yBAAyB,EAAE,sBAAS,CAAC,mBAAmB,CAAC,yBAAyB;YAClF,WAAW,EAAE,sBAAS,CAAC,mBAAmB,CAAC,WAAW;YACtD,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,wCAAwC,EAAE,sBAAS,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CACpH,CAAC;QAGC,aAAQ,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YAChF,MAAM,GAAG,GAAG;;;;;;;;;;;;;oBAaA,iBAAS,yBAAyB,iBAAiB;;SAE9D,CAAC;YAEF,IAAI;gBACA,MAAM,QAAQ,GAAG,sBAAS,CAAC,mBAAmB,CAAC,WAAW,GAAG,6CAAqB,CAAC,GAAG,CAAC;gBAEvF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,gBAAgB,iBAAS,MAAM,QAAQ,KAAK,GAAG,GAAG,CAAC,CAAC;aAClG;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IA5BF,CAAC;CA6BJ;AA1CD,sEA0CC"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
2
|
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
3
|
export declare class ServicesCalendarRepository extends PostgresModel implements IModel {
|
|
5
4
|
constructor();
|
|
6
|
-
|
|
7
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
|
-
createIndexes: () => Promise<void>;
|
|
5
|
+
populate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
9
6
|
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ServicesCalendarRepository = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
13
|
const const_1 = require("../../../../schema-definitions/const");
|
|
15
14
|
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
16
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
@@ -26,7 +25,7 @@ class ServicesCalendarRepository extends models_1.PostgresModel {
|
|
|
26
25
|
savingType: "insertOnly",
|
|
27
26
|
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
28
27
|
}, new golemio_validator_1.JSONSchemaValidator("ServicesCalendarRepositoryValidator", ropid_gtfs_1.RopidGTFS.servicesCalendar.outputJsonSchema));
|
|
29
|
-
this.
|
|
28
|
+
this.populate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
30
29
|
const sql = `
|
|
31
30
|
SELECT
|
|
32
31
|
dates.date,
|
|
@@ -89,41 +88,7 @@ class ServicesCalendarRepository extends models_1.PostgresModel {
|
|
|
89
88
|
`;
|
|
90
89
|
try {
|
|
91
90
|
const tmpTable = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
92
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
93
|
-
CREATE TABLE "${const_1.PG_SCHEMA}".${tmpTable} (
|
|
94
|
-
LIKE "${const_1.PG_SCHEMA}".${ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName}
|
|
95
|
-
);
|
|
96
|
-
INSERT INTO "${const_1.PG_SCHEMA}".${tmpTable} ${sql};`);
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
helpers_1.log.error(err);
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
try {
|
|
105
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName;
|
|
106
|
-
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
107
|
-
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
108
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
109
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
110
|
-
LOCK "${const_1.PG_SCHEMA}".${pgTableName} IN EXCLUSIVE MODE;
|
|
111
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameActual} NO INHERIT "${const_1.PG_SCHEMA}".${pgTableName};
|
|
112
|
-
DROP TABLE IF EXISTS "${const_1.PG_SCHEMA}".${tableNameActual};
|
|
113
|
-
${indexQuery}
|
|
114
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameTmp} RENAME TO ${tableNameActual};
|
|
115
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameActual} INHERIT "${const_1.PG_SCHEMA}".${pgTableName};
|
|
116
|
-
`, { transaction });
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
helpers_1.log.error(err);
|
|
120
|
-
throw err;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
try {
|
|
125
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName, ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
126
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
91
|
+
yield this.sequelizeModel.sequelize.query(`INSERT INTO "${const_1.PG_SCHEMA}".${tmpTable} ${sql};`);
|
|
127
92
|
}
|
|
128
93
|
catch (err) {
|
|
129
94
|
helpers_1.log.error(err);
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesCalendarRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ServicesCalendarRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuC;AACvC,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAClF,+EAA4E;AAE5E,MAAa,0BAA2B,SAAQ,sBAAa;IACzD;QACI,KAAK,CACD,4BAA4B,EAC5B;YACI,yBAAyB,EAAE,sBAAS,CAAC,gBAAgB,CAAC,yBAAyB;YAC/E,WAAW,EAAE,sBAAS,CAAC,gBAAgB,CAAC,WAAW;YACnD,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,qCAAqC,EAAE,sBAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAC9G,CAAC;QAGC,aAAQ,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YAChF,MAAM,GAAG,GAAG;;;;;;;;;;;;;0BAaM,iBAAS,uBAAuB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+BvC,iBAAS,6BAA6B,iBAAiB;;;;;;;;gCAQ3D,iBAAS,6BAA6B,iBAAiB;;;;;;;SAO9E,CAAC;YAEF,IAAI;gBACA,MAAM,QAAQ,GAAG,sBAAS,CAAC,gBAAgB,CAAC,WAAW,GAAG,6CAAqB,CAAC,GAAG,CAAC;gBAEpF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,gBAAgB,iBAAS,KAAK,QAAQ,IAAI,GAAG,GAAG,CAAC,CAAC;aAChG;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAxEF,CAAC;CAyEJ;AAtFD,gEAsFC"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { IScheduleDto } from "../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
|
|
2
2
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
3
|
-
import { FindOptions
|
|
3
|
+
import { FindOptions } from "@golemio/core/dist/shared/sequelize";
|
|
4
4
|
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
5
5
|
export declare class TripScheduleRepository extends PostgresModel implements IModel {
|
|
6
6
|
constructor();
|
|
7
7
|
findAll: (options: FindOptions) => Promise<IScheduleDto[]>;
|
|
8
|
-
|
|
9
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
10
|
-
createIndexes: () => Promise<void>;
|
|
8
|
+
populate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
11
9
|
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TripScheduleRepository = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
13
|
const const_1 = require("../../../../schema-definitions/const");
|
|
15
14
|
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
16
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
@@ -29,7 +28,7 @@ class TripScheduleRepository extends models_1.PostgresModel {
|
|
|
29
28
|
this.findAll = (options) => {
|
|
30
29
|
return this.sequelizeModel.findAll(Object.assign({ raw: true }, options));
|
|
31
30
|
};
|
|
32
|
-
this.
|
|
31
|
+
this.populate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
33
32
|
/* eslint-disable max-len */
|
|
34
33
|
const sql = `
|
|
35
34
|
SELECT
|
|
@@ -128,42 +127,7 @@ class TripScheduleRepository extends models_1.PostgresModel {
|
|
|
128
127
|
/* eslint-enable max-len */
|
|
129
128
|
try {
|
|
130
129
|
const tmpTable = ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
131
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
132
|
-
CREATE TABLE "${const_1.PG_SCHEMA}".${tmpTable} (
|
|
133
|
-
LIKE "${const_1.PG_SCHEMA}".${ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName}
|
|
134
|
-
);
|
|
135
|
-
INSERT INTO "${const_1.PG_SCHEMA}".${tmpTable} ${sql};`);
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
helpers_1.log.error(err);
|
|
139
|
-
throw err;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
try {
|
|
144
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName;
|
|
145
|
-
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
146
|
-
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
147
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.tripSchedule.modelIndexOptions);
|
|
148
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
149
|
-
LOCK "${const_1.PG_SCHEMA}".${pgTableName} IN EXCLUSIVE MODE;
|
|
150
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameActual} NO INHERIT "${const_1.PG_SCHEMA}".${pgTableName};
|
|
151
|
-
DROP TABLE IF EXISTS "${const_1.PG_SCHEMA}".${tableNameActual};
|
|
152
|
-
${indexQuery}
|
|
153
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameTmp} RENAME TO ${tableNameActual};
|
|
154
|
-
ALTER TABLE "${const_1.PG_SCHEMA}".${tableNameActual} INHERIT "${const_1.PG_SCHEMA}".${pgTableName};
|
|
155
|
-
`, { transaction });
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
helpers_1.log.error(err);
|
|
159
|
-
throw err;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
try {
|
|
164
|
-
const indexes = ropid_gtfs_1.RopidGTFS.tripSchedule.modelIndexOptions;
|
|
165
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName, indexes);
|
|
166
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
130
|
+
yield this.sequelizeModel.sequelize.query(`INSERT INTO "${const_1.PG_SCHEMA}".${tmpTable} ${sql};`);
|
|
167
131
|
}
|
|
168
132
|
catch (err) {
|
|
169
133
|
helpers_1.log.error(err);
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuC;AACvC,0EAA4C;AAE5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAE5E,MAAa,sBAAuB,SAAQ,sBAAa;IACrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,sBAAS,CAAC,YAAY,CAAC,yBAAyB;YAC3E,WAAW,EAAE,sBAAS,CAAC,YAAY,CAAC,WAAW;YAC/C,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAA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/core/dist/helpers/logger/LoggerProvider";
|
|
3
|
-
import {
|
|
3
|
+
import { RopidGtfsMetadataRepository } from "../RopidGtfsMetadataRepository";
|
|
4
4
|
import { DeparturePresetsRepository } from "../data-access/DeparturePresetsRepository";
|
|
5
5
|
import { RopidDeparturesPresetsTransformation } from "../transformations/RopidDeparturesPresetsTransformation";
|
|
6
6
|
export declare class DeparturePresetsFacade {
|
|
7
|
-
private
|
|
7
|
+
private metadataRepository;
|
|
8
8
|
private departurePresetsRepository;
|
|
9
9
|
private transformationDeparturesPresets;
|
|
10
10
|
private logger;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(metadataRepository: RopidGtfsMetadataRepository, departurePresetsRepository: DeparturePresetsRepository, transformationDeparturesPresets: RopidDeparturesPresetsTransformation, logger: ILogger);
|
|
12
12
|
handleNewDeparturePresets(data: IRopidDeparturesPreset[], lastModified: string): Promise<void>;
|
|
13
13
|
}
|