@golemio/pid 2.6.6 → 2.6.7-dev.839499227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/example/00_clear_test_data.sql +4 -4
- package/db/example/03_ropidgtfs_dump.sql +10 -1
- package/db/example/14_nightDelays.sql +16 -8
- package/db/migrations/postgresql/20230327121511-departure-view.js +53 -0
- package/db/migrations/postgresql/sqls/20220915123941-partitioned-departures-down.sql +2 -0
- package/db/migrations/postgresql/sqls/20230307124639-positions-internal-down.sql +1 -1
- package/db/migrations/postgresql/sqls/20230327121511-departure-view-down.sql +81 -0
- package/db/migrations/postgresql/sqls/20230327121511-departure-view-up.sql +37 -0
- package/dist/integration-engine/queueDefinitions.js +10 -0
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.d.ts +13 -7
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js +50 -45
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.d.ts +6 -4
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js +61 -30
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js.map +1 -1
- package/dist/integration-engine/{vehicle-positions/workers/vehicle-positions/data-access/TripStopsRedisRepository.d.ts → ropid-gtfs/data-access/cache/BlockStopsRedisRepository.d.ts} +2 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/BlockStopsRedisRepository.js +19 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/BlockStopsRedisRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/{DelayComputationRedisRepository.d.ts → cache/DelayComputationRedisRepository.d.ts} +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/{DelayComputationRedisRepository.js → cache/DelayComputationRedisRepository.js} +5 -5
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -0
- package/dist/integration-engine/{vehicle-positions/workers/runs/data-access → ropid-gtfs/data-access/cache}/RunTripsRedisRepository.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js +19 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/RunTripsRedisRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.d.ts +5 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js +15 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/StaticFileRedisRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/index.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/index.js +21 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/index.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/{DeparturesRepository.d.ts → precomputed/DeparturesRepository.d.ts} +2 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +132 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.d.ts +9 -0
- package/dist/integration-engine/ropid-gtfs/{RopidGTFSMinMaxSequencesModel.js → data-access/precomputed/MinMaxStopSequencesRepository.js} +34 -33
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts +9 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +135 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts +11 -0
- package/dist/integration-engine/ropid-gtfs/{RopidGTFSScheduledTripsModel.js → data-access/precomputed/TripScheduleRepository.js} +27 -26
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.d.ts +4 -0
- package/dist/integration-engine/ropid-gtfs/data-access/{index.js → precomputed/index.js} +3 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.d.ts +11 -0
- package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js +43 -0
- package/dist/integration-engine/ropid-gtfs/helpers/DataCacheManager.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.d.ts +5 -0
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js +10 -0
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/helpers/interfaces/IDataCacheManager.d.ts +3 -0
- package/dist/integration-engine/ropid-gtfs/helpers/interfaces/IDataCacheManager.js +3 -0
- package/dist/integration-engine/ropid-gtfs/helpers/interfaces/IDataCacheManager.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/index.d.ts +0 -3
- package/dist/integration-engine/ropid-gtfs/index.js +0 -3
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/utils.js +5 -4
- package/dist/integration-engine/ropid-gtfs/utils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +3 -3
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunsMessagesTask.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunsMessagesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +18 -18
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.d.ts +3 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js +4 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/TripStopsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +4 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js +5 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.js.map +1 -1
- package/dist/output-gateway/departure-boards/DepartureBoardsRouter.js +1 -1
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js +0 -6
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
- package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +2 -2
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -6
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +30 -33
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/index.js +1 -4
- package/dist/schema-definitions/ropid-gtfs/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.d.ts +0 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js +5 -18
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/interfaces/IDeparturesModel.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/index.d.ts +0 -4
- package/dist/schema-definitions/vehicle-positions/index.js +0 -4
- package/dist/schema-definitions/vehicle-positions/index.js.map +1 -1
- package/docs/implementation_documentation.md +30 -10
- package/docs/openapi-output.yaml +1 -1
- package/package.json +4 -3
- package/db/example/99_precomputed_tables.sql +0 -169
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.d.ts +0 -19
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.d.ts +0 -21
- package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.d.ts +0 -19
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js +0 -142
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/DelayComputationRedisRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js +0 -162
- package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/index.d.ts +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/index.js.map +0 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/RunTripsRedisRepository.js +0 -19
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/RunTripsRedisRepository.js.map +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripStopsRedisRepository.js +0 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripStopsRedisRepository.js.map +0 -1
|
@@ -9,43 +9,44 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
12
|
+
exports.MinMaxStopSequencesRepository = void 0;
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
14
|
+
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
14
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
15
|
-
const ropid_gtfs_1 = require("../../schema-definitions/ropid-gtfs");
|
|
16
16
|
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
+
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
19
|
+
class MinMaxStopSequencesRepository extends models_1.PostgresModel {
|
|
19
20
|
constructor() {
|
|
20
|
-
super(
|
|
21
|
-
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.
|
|
22
|
-
pgTableName: ropid_gtfs_1.RopidGTFS.
|
|
21
|
+
super("MinMaxStopSequencesRepository", {
|
|
22
|
+
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.minMaxStopSequences.outputSequelizeAttributes,
|
|
23
|
+
pgTableName: ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName,
|
|
23
24
|
pgSchema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
24
25
|
savingType: "insertOnly",
|
|
25
26
|
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
26
|
-
}, new golemio_validator_1.JSONSchemaValidator(
|
|
27
|
-
this.
|
|
27
|
+
}, new golemio_validator_1.JSONSchemaValidator("MinMaxStopSequencesRepositoryValidator", ropid_gtfs_1.RopidGTFS.minMaxStopSequences.outputJsonSchema));
|
|
28
|
+
this.createAndPopulate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
28
29
|
const sql = `
|
|
29
30
|
SELECT
|
|
30
|
-
|
|
31
|
-
max(
|
|
32
|
-
min(
|
|
33
|
-
|
|
34
|
-
max(
|
|
35
|
-
max(
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
min(
|
|
39
|
-
min(
|
|
40
|
-
)
|
|
41
|
-
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".
|
|
42
|
-
GROUP BY
|
|
31
|
+
trip_id,
|
|
32
|
+
max(stop_sequence) AS max_stop_sequence,
|
|
33
|
+
min(stop_sequence) AS min_stop_sequence,
|
|
34
|
+
GREATEST(
|
|
35
|
+
max(arrival_time::interval),
|
|
36
|
+
max(departure_time::interval)
|
|
37
|
+
) AS max_stop_time,
|
|
38
|
+
LEAST(
|
|
39
|
+
min(arrival_time::interval),
|
|
40
|
+
min(departure_time::interval)
|
|
41
|
+
) AS min_stop_time
|
|
42
|
+
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_stop_times${sourceTableSuffix}
|
|
43
|
+
GROUP BY trip_id
|
|
43
44
|
`;
|
|
44
45
|
try {
|
|
45
|
-
const tmpTable = ropid_gtfs_1.RopidGTFS.
|
|
46
|
+
const tmpTable = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
46
47
|
yield this.sequelizeModel.sequelize.query(`DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}"."${tmpTable}";
|
|
47
48
|
CREATE TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}"."${tmpTable}" (
|
|
48
|
-
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}"."${ropid_gtfs_1.RopidGTFS.
|
|
49
|
+
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}"."${ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName}"
|
|
49
50
|
);
|
|
50
51
|
INSERT INTO "${ropid_gtfs_1.RopidGTFS.pgSchema}"."${tmpTable}" ${sql};`);
|
|
51
52
|
}
|
|
@@ -56,10 +57,10 @@ class RopidGTFSMinMaxSequencesModel extends models_1.PostgresModel {
|
|
|
56
57
|
});
|
|
57
58
|
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
58
59
|
try {
|
|
59
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.
|
|
60
|
+
const pgTableName = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName;
|
|
61
|
+
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
62
|
+
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
63
|
+
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.minMaxStopSequences.modelIndexOptions);
|
|
63
64
|
yield this.sequelizeModel.sequelize.query(`
|
|
64
65
|
LOCK "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName} IN EXCLUSIVE MODE;
|
|
65
66
|
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} NO INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
@@ -76,8 +77,8 @@ class RopidGTFSMinMaxSequencesModel extends models_1.PostgresModel {
|
|
|
76
77
|
});
|
|
77
78
|
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
78
79
|
try {
|
|
79
|
-
const indexes = ropid_gtfs_1.RopidGTFS.
|
|
80
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.
|
|
80
|
+
const indexes = ropid_gtfs_1.RopidGTFS.minMaxStopSequences.modelIndexOptions;
|
|
81
|
+
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.minMaxStopSequences.pgTableName, indexes);
|
|
81
82
|
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
82
83
|
}
|
|
83
84
|
catch (err) {
|
|
@@ -87,5 +88,5 @@ class RopidGTFSMinMaxSequencesModel extends models_1.PostgresModel {
|
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
exports.
|
|
91
|
-
//# sourceMappingURL=
|
|
91
|
+
exports.MinMaxStopSequencesRepository = MinMaxStopSequencesRepository;
|
|
92
|
+
//# sourceMappingURL=MinMaxStopSequencesRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinMaxStopSequencesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.ts"],"names":[],"mappings":"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"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
+
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
+
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
|
+
export declare class ServicesCalendarRepository extends PostgresModel implements IModel {
|
|
5
|
+
constructor();
|
|
6
|
+
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
7
|
+
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
|
+
createIndexes: () => Promise<void>;
|
|
9
|
+
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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.ServicesCalendarRepository = void 0;
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
14
|
+
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
15
|
+
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
16
|
+
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
+
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
19
|
+
class ServicesCalendarRepository extends models_1.PostgresModel {
|
|
20
|
+
constructor() {
|
|
21
|
+
super("ServicesCalendarRepository", {
|
|
22
|
+
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.servicesCalendar.outputSequelizeAttributes,
|
|
23
|
+
pgTableName: ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName,
|
|
24
|
+
pgSchema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
25
|
+
savingType: "insertOnly",
|
|
26
|
+
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
27
|
+
}, new golemio_validator_1.JSONSchemaValidator("ServicesCalendarRepositoryValidator", ropid_gtfs_1.RopidGTFS.servicesCalendar.outputJsonSchema));
|
|
28
|
+
this.createAndPopulate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const sql = `
|
|
30
|
+
SELECT
|
|
31
|
+
dates.date,
|
|
32
|
+
date_part('day', dates.date - to_char(timezone('Europe/Prague', now()), 'YYYY-MM-DD')::timestamp) AS day_diff,
|
|
33
|
+
service_id
|
|
34
|
+
FROM (
|
|
35
|
+
SELECT
|
|
36
|
+
date_trunc('day', dd.dd)::date AS date
|
|
37
|
+
FROM generate_series(
|
|
38
|
+
( SELECT (CURRENT_TIMESTAMP - interval '1 day') )::date,
|
|
39
|
+
( SELECT (CURRENT_TIMESTAMP + interval '2 days') )::date,
|
|
40
|
+
'1 day'
|
|
41
|
+
) dd(dd)) dates
|
|
42
|
+
INNER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar${sourceTableSuffix} calendar ON ((1 = 1))
|
|
43
|
+
WHERE (
|
|
44
|
+
(
|
|
45
|
+
dates.date >= "start_date"::date
|
|
46
|
+
AND dates.date <= end_date::date
|
|
47
|
+
AND (
|
|
48
|
+
(
|
|
49
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'monday'
|
|
50
|
+
AND monday = 1
|
|
51
|
+
) OR (
|
|
52
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'tuesday'
|
|
53
|
+
AND tuesday = 1
|
|
54
|
+
) OR (
|
|
55
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'wednesday'
|
|
56
|
+
AND wednesday = 1
|
|
57
|
+
) OR (
|
|
58
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'thursday'
|
|
59
|
+
AND thursday = 1
|
|
60
|
+
) OR (
|
|
61
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'friday'
|
|
62
|
+
AND friday = 1
|
|
63
|
+
) OR (
|
|
64
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'saturday'
|
|
65
|
+
AND saturday = 1
|
|
66
|
+
) OR (
|
|
67
|
+
btrim(to_char(dates.date::timestamptz, 'day')) = 'sunday'
|
|
68
|
+
AND sunday = 1
|
|
69
|
+
)
|
|
70
|
+
) AND (
|
|
71
|
+
NOT service_id IN (
|
|
72
|
+
SELECT service_id
|
|
73
|
+
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar_dates${sourceTableSuffix} calendar_dates
|
|
74
|
+
WHERE (
|
|
75
|
+
exception_type = 2
|
|
76
|
+
AND dates.date = calendar_dates.date::date
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
)) OR service_id IN (
|
|
80
|
+
SELECT service_id
|
|
81
|
+
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar_dates${sourceTableSuffix} calendar_dates
|
|
82
|
+
WHERE
|
|
83
|
+
calendar_dates.exception_type = 1
|
|
84
|
+
AND dates.date = calendar_dates.date::date
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
ORDER BY dates.date
|
|
88
|
+
`;
|
|
89
|
+
try {
|
|
90
|
+
const tmpTable = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
91
|
+
yield this.sequelizeModel.sequelize.query(`DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable};
|
|
92
|
+
CREATE TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} (
|
|
93
|
+
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName}
|
|
94
|
+
);
|
|
95
|
+
INSERT INTO "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} ${sql};`);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
helpers_1.log.error(err);
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
try {
|
|
104
|
+
const pgTableName = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName;
|
|
105
|
+
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
106
|
+
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
107
|
+
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
108
|
+
yield this.sequelizeModel.sequelize.query(`
|
|
109
|
+
LOCK "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName} IN EXCLUSIVE MODE;
|
|
110
|
+
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} NO INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
111
|
+
DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual};
|
|
112
|
+
${indexQuery}
|
|
113
|
+
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameTmp} RENAME TO ${tableNameActual};
|
|
114
|
+
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
115
|
+
`, { transaction });
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
helpers_1.log.error(err);
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
try {
|
|
124
|
+
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName, ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
125
|
+
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
helpers_1.log.error(err);
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.ServicesCalendarRepository = ServicesCalendarRepository;
|
|
135
|
+
//# sourceMappingURL=ServicesCalendarRepository.js.map
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServicesCalendarRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.ts"],"names":[],"mappings":"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"}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
+
import { FindOptions, Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
+
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
|
+
import { IGtfsRunTripCache } from "../../interfaces/IGtfsRunTripCache";
|
|
5
|
+
export declare class TripScheduleRepository extends PostgresModel implements IModel {
|
|
6
|
+
constructor();
|
|
7
|
+
findAll: (options: FindOptions) => Promise<IGtfsRunTripCache[]>;
|
|
8
|
+
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
9
|
+
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
10
|
+
createIndexes: () => Promise<void>;
|
|
11
|
+
}
|
|
@@ -9,25 +9,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const utils_1 = require("
|
|
14
|
-
const ropid_gtfs_1 = require("
|
|
12
|
+
exports.TripScheduleRepository = void 0;
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
14
|
+
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
15
15
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
16
16
|
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
17
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
-
|
|
18
|
+
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
19
|
+
class TripScheduleRepository extends models_1.PostgresModel {
|
|
19
20
|
constructor() {
|
|
20
|
-
super(
|
|
21
|
-
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.
|
|
22
|
-
pgTableName: ropid_gtfs_1.RopidGTFS.
|
|
21
|
+
super("TripScheduleRepository", {
|
|
22
|
+
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.tripSchedule.outputSequelizeAttributes,
|
|
23
|
+
pgTableName: ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName,
|
|
23
24
|
pgSchema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
24
25
|
savingType: "insertOnly",
|
|
25
26
|
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
26
|
-
}, new golemio_validator_1.JSONSchemaValidator(
|
|
27
|
+
}, new golemio_validator_1.JSONSchemaValidator("TripScheduleRepositoryValidator", ropid_gtfs_1.RopidGTFS.tripSchedule.outputJsonSchema));
|
|
27
28
|
this.findAll = (options) => {
|
|
28
29
|
return this.sequelizeModel.findAll(Object.assign({ raw: true }, options));
|
|
29
30
|
};
|
|
30
|
-
this.
|
|
31
|
+
this.createAndPopulate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
/* eslint-disable max-len */
|
|
32
33
|
const sql = `
|
|
33
34
|
SELECT
|
|
@@ -114,21 +115,21 @@ class RopidGTFSScheduledTripsModel extends models_1.PostgresModel {
|
|
|
114
115
|
GREATEST(t6.arrival_time::INTERVAL, t6.departure_time::INTERVAL) AS max_stop_time,
|
|
115
116
|
t5.stop_id AS first_stop_id,
|
|
116
117
|
t6.stop_id AS last_stop_id
|
|
117
|
-
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
LEFT
|
|
121
|
-
LEFT
|
|
122
|
-
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".
|
|
123
|
-
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".
|
|
118
|
+
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_run_numbers${sourceTableSuffix} t1
|
|
119
|
+
INNER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_precomputed_services_calendar_tmp t3 ON t1.service_id = t3.service_id
|
|
120
|
+
INNER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences_tmp t4 ON t1.trip_id = t4.trip_id
|
|
121
|
+
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_trips${sourceTableSuffix} t8 ON t1.trip_id = t8.trip_id
|
|
122
|
+
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_routes${sourceTableSuffix} t7 ON t8.route_id = t7.route_id
|
|
123
|
+
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_stop_times${sourceTableSuffix} t5 ON t1.trip_id = t5.trip_id AND t5.stop_sequence = t4.min_stop_sequence
|
|
124
|
+
LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_stop_times${sourceTableSuffix} t6 ON t1.trip_id = t6.trip_id AND t6.stop_sequence = t4.max_stop_sequence
|
|
124
125
|
) t0;
|
|
125
126
|
`;
|
|
126
127
|
/* eslint-enable max-len */
|
|
127
128
|
try {
|
|
128
|
-
const tmpTable = ropid_gtfs_1.RopidGTFS.
|
|
129
|
+
const tmpTable = ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
129
130
|
yield this.sequelizeModel.sequelize.query(`DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable};
|
|
130
131
|
CREATE TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} (
|
|
131
|
-
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${ropid_gtfs_1.RopidGTFS.
|
|
132
|
+
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName}
|
|
132
133
|
);
|
|
133
134
|
INSERT INTO "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} ${sql};`);
|
|
134
135
|
}
|
|
@@ -139,10 +140,10 @@ class RopidGTFSScheduledTripsModel extends models_1.PostgresModel {
|
|
|
139
140
|
});
|
|
140
141
|
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
141
142
|
try {
|
|
142
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.
|
|
143
|
+
const pgTableName = ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName;
|
|
144
|
+
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
145
|
+
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
146
|
+
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.tripSchedule.modelIndexOptions);
|
|
146
147
|
yield this.sequelizeModel.sequelize.query(`
|
|
147
148
|
LOCK "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName} IN EXCLUSIVE MODE;
|
|
148
149
|
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} NO INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
@@ -159,8 +160,8 @@ class RopidGTFSScheduledTripsModel extends models_1.PostgresModel {
|
|
|
159
160
|
});
|
|
160
161
|
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
161
162
|
try {
|
|
162
|
-
const indexes = ropid_gtfs_1.RopidGTFS.
|
|
163
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.
|
|
163
|
+
const indexes = ropid_gtfs_1.RopidGTFS.tripSchedule.modelIndexOptions;
|
|
164
|
+
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.tripSchedule.pgTableName, indexes);
|
|
164
165
|
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
165
166
|
}
|
|
166
167
|
catch (err) {
|
|
@@ -170,5 +171,5 @@ class RopidGTFSScheduledTripsModel extends models_1.PostgresModel {
|
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
exports.
|
|
174
|
-
//# sourceMappingURL=
|
|
174
|
+
exports.TripScheduleRepository = TripScheduleRepository;
|
|
175
|
+
//# sourceMappingURL=TripScheduleRepository.js.map
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":"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"}
|
|
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TripScheduleRepository"), exports);
|
|
18
|
+
__exportStar(require("./ServicesCalendarRepository"), exports);
|
|
19
|
+
__exportStar(require("./MinMaxStopSequencesRepository"), exports);
|
|
17
20
|
__exportStar(require("./DeparturesRepository"), exports);
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDataCacheManager } from "./interfaces/IDataCacheManager";
|
|
2
|
+
export declare class DataCacheManager implements IDataCacheManager {
|
|
3
|
+
private static _instance;
|
|
4
|
+
private readonly staticFileRepository;
|
|
5
|
+
private readonly runTripsRepository;
|
|
6
|
+
private readonly blockStopsRepository;
|
|
7
|
+
private readonly delayComputationRepository;
|
|
8
|
+
static getInstance(): DataCacheManager;
|
|
9
|
+
private constructor();
|
|
10
|
+
cleanCache(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.DataCacheManager = void 0;
|
|
13
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
14
|
+
const cache_1 = require("../data-access/cache");
|
|
15
|
+
class DataCacheManager {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.staticFileRepository = new cache_1.StaticFileRedisRepository();
|
|
18
|
+
this.runTripsRepository = new cache_1.RunTripsRedisRepository();
|
|
19
|
+
this.blockStopsRepository = new cache_1.BlockStopsRedisRepository();
|
|
20
|
+
this.delayComputationRepository = new cache_1.DelayComputationRedisRepository();
|
|
21
|
+
}
|
|
22
|
+
static getInstance() {
|
|
23
|
+
if (!this._instance) {
|
|
24
|
+
this._instance = new DataCacheManager();
|
|
25
|
+
}
|
|
26
|
+
return this._instance;
|
|
27
|
+
}
|
|
28
|
+
cleanCache() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
try {
|
|
31
|
+
yield this.staticFileRepository.truncate(true);
|
|
32
|
+
yield this.runTripsRepository.truncate(true);
|
|
33
|
+
yield this.blockStopsRepository.truncate(true);
|
|
34
|
+
yield this.delayComputationRepository.truncate(true);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw new golemio_errors_1.CustomError("DataCacheManager: Failed to clean cache", true, this.constructor.name, undefined, err);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DataCacheManager = DataCacheManager;
|
|
43
|
+
//# sourceMappingURL=DataCacheManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataCacheManager.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/helpers/DataCacheManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAuE;AACvE,gDAK8B;AAG9B,MAAa,gBAAgB;IAezB;QACI,IAAI,CAAC,oBAAoB,GAAG,IAAI,iCAAyB,EAAE,CAAC;QAC5D,IAAI,CAAC,kBAAkB,GAAG,IAAI,+BAAuB,EAAE,CAAC;QACxD,IAAI,CAAC,oBAAoB,GAAG,IAAI,iCAAyB,EAAE,CAAC;QAC5D,IAAI,CAAC,0BAA0B,GAAG,IAAI,uCAA+B,EAAE,CAAC;IAC5E,CAAC;IAbM,MAAM,CAAC,WAAW;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;SAC3C;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IASY,UAAU;;YACnB,IAAI;gBACA,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC/C,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC7C,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC/C,MAAM,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aACxD;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,4BAAW,CAAC,yCAAyC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aACjH;QACL,CAAC;KAAA;CACJ;AAhCD,4CAgCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceTableSuffixEnum = void 0;
|
|
4
|
+
var SourceTableSuffixEnum;
|
|
5
|
+
(function (SourceTableSuffixEnum) {
|
|
6
|
+
SourceTableSuffixEnum["Actual"] = "_actual";
|
|
7
|
+
SourceTableSuffixEnum["Tmp"] = "_tmp";
|
|
8
|
+
SourceTableSuffixEnum["Drop"] = "_drop";
|
|
9
|
+
})(SourceTableSuffixEnum = exports.SourceTableSuffixEnum || (exports.SourceTableSuffixEnum = {}));
|
|
10
|
+
//# sourceMappingURL=SourceTableSuffixEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceTableSuffixEnum.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,2CAAkB,CAAA;IAClB,qCAAY,CAAA;IACZ,uCAAc,CAAA;AAClB,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDataCacheManager.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/helpers/interfaces/IDataCacheManager.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export * from "./transformations/RopidDeparturesPresetsTransformation";
|
|
2
2
|
export * from "./transformations/RopidGTFSCisStopsTransformation";
|
|
3
3
|
export * from "./transformations/RopidGTFSTransformation";
|
|
4
|
-
export * from "./RopidGTFSServicesFirst14daysModel";
|
|
5
|
-
export * from "./RopidGTFSMinMaxSequencesModel";
|
|
6
|
-
export * from "./RopidGTFSScheduledTripsModel";
|
|
7
4
|
export * from "./RopidGTFSTripsModel";
|
|
8
5
|
export * from "./RopidGTFSMetadataModel";
|
|
9
6
|
export * from "./RopidGTFSWorker";
|
|
@@ -17,9 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./transformations/RopidDeparturesPresetsTransformation"), exports);
|
|
18
18
|
__exportStar(require("./transformations/RopidGTFSCisStopsTransformation"), exports);
|
|
19
19
|
__exportStar(require("./transformations/RopidGTFSTransformation"), exports);
|
|
20
|
-
__exportStar(require("./RopidGTFSServicesFirst14daysModel"), exports);
|
|
21
|
-
__exportStar(require("./RopidGTFSMinMaxSequencesModel"), exports);
|
|
22
|
-
__exportStar(require("./RopidGTFSScheduledTripsModel"), exports);
|
|
23
20
|
__exportStar(require("./RopidGTFSTripsModel"), exports);
|
|
24
21
|
__exportStar(require("./RopidGTFSMetadataModel"), exports);
|
|
25
22
|
__exportStar(require("./RopidGTFSWorker"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yFAAuE;AACvE,oFAAkE;AAClE,4EAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yFAAuE;AACvE,oFAAkE;AAClE,4EAA0D;AAC1D,wDAAsC;AACtC,2DAAyC;AACzC,oDAAkC;AAClC,4DAA0C;AAC1C,wDAAsC;AACtC,yDAAuC"}
|
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildDropIndexQuery = exports.buildAlterIndexQuery = exports.buildCreateIndexQuery = void 0;
|
|
4
4
|
const ropid_gtfs_1 = require("../../schema-definitions/ropid-gtfs");
|
|
5
|
+
const SourceTableSuffixEnum_1 = require("./helpers/SourceTableSuffixEnum");
|
|
5
6
|
const buildCreateIndexQuery = (tableName, indexes) => {
|
|
6
7
|
const rawQuery = indexes.map((el) => {
|
|
7
|
-
return `CREATE ${el.unique ? "UNIQUE" : ""} INDEX IF NOT EXISTS ${el.name}
|
|
8
|
-
ON "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableName}
|
|
8
|
+
return `CREATE ${el.unique ? "UNIQUE" : ""} INDEX IF NOT EXISTS ${el.name}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}
|
|
9
|
+
ON "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableName}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp} ${el.using ? "USING " + el.using : ""} (${el.fields.toString()});`;
|
|
9
10
|
});
|
|
10
11
|
return rawQuery.join(" ");
|
|
11
12
|
};
|
|
12
13
|
exports.buildCreateIndexQuery = buildCreateIndexQuery;
|
|
13
14
|
const buildAlterIndexQuery = (indexes) => {
|
|
14
15
|
const rawQuery = indexes.map((el) => {
|
|
15
|
-
return `ALTER INDEX IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${el.name}
|
|
16
|
+
return `ALTER INDEX IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${el.name}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp} RENAME TO ${el.name};`;
|
|
16
17
|
});
|
|
17
18
|
return rawQuery.join(" ");
|
|
18
19
|
};
|
|
19
20
|
exports.buildAlterIndexQuery = buildAlterIndexQuery;
|
|
20
21
|
const buildDropIndexQuery = (indexes) => {
|
|
21
22
|
const rawQuery = indexes.map((el) => {
|
|
22
|
-
return `DROP INDEX IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${el.name}
|
|
23
|
+
return `DROP INDEX IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${el.name}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp};`;
|
|
23
24
|
});
|
|
24
25
|
return rawQuery.join(" ");
|
|
25
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/utils.ts"],"names":[],"mappings":";;;AAAA,oEAA4C;AAE5C,2EAAwE;AAEjE,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAE,OAA8B,EAAU,EAAE;IAC/F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAChC,OAAO,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,CAAC,IAAI,GAAG,6CAAqB,CAAC,GAAG;sBACvF,sBAAS,CAAC,QAAQ,KAAK,SAAS,GAAG,6CAAqB,CAAC,GAAG,IACtE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,MAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC;AATW,QAAA,qBAAqB,yBAShC;AAEK,MAAM,oBAAoB,GAAG,CAAC,OAA8B,EAAU,EAAE;IAC3E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAChC,OAAO,0BAA0B,sBAAS,CAAC,QAAQ,KAAK,EAAE,CAAC,IAAI,GAAG,6CAAqB,CAAC,GAAG,cAAc,EAAE,CAAC,IAAI,GAAG,CAAC;IACxH,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AAEK,MAAM,mBAAmB,GAAG,CAAC,OAA8B,EAAU,EAAE;IAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAChC,OAAO,yBAAyB,sBAAS,CAAC,QAAQ,KAAK,EAAE,CAAC,IAAI,GAAG,6CAAqB,CAAC,GAAG,GAAG,CAAC;IAClG,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}
|
package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class CommonRunsRepository extends PostgresModel implements IMode
|
|
|
19
19
|
/** Associated vehiclepositions_runs_messages repository */
|
|
20
20
|
protected runsMessagesRepository: CommonRunsMessagesRepository;
|
|
21
21
|
/** Precomputed scheduled trips model */
|
|
22
|
-
private
|
|
22
|
+
private tripScheduleRepository;
|
|
23
23
|
constructor();
|
|
24
24
|
getRunRecordForUpdate: (run: ICommonRunsModel) => Promise<ICommonRunsModel | null>;
|
|
25
25
|
createAndAssociate: ({ run, run_message }: ICommonRunWithMessage) => Promise<ICommonRunWithMessage>;
|