@golemio/pid 2.6.6 → 2.6.7-dev.834780584

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.
Files changed (70) hide show
  1. package/db/example/00_clear_test_data.sql +4 -4
  2. package/db/example/03_ropidgtfs_dump.sql +10 -1
  3. package/db/example/14_nightDelays.sql +16 -8
  4. package/db/migrations/postgresql/20230327121511-departure-view.js +53 -0
  5. package/db/migrations/postgresql/sqls/20220915123941-partitioned-departures-down.sql +2 -0
  6. package/db/migrations/postgresql/sqls/20230307124639-positions-internal-down.sql +1 -1
  7. package/db/migrations/postgresql/sqls/20230327121511-departure-view-down.sql +81 -0
  8. package/db/migrations/postgresql/sqls/20230327121511-departure-view-up.sql +37 -0
  9. package/dist/integration-engine/queueDefinitions.js +10 -0
  10. package/dist/integration-engine/queueDefinitions.js.map +1 -1
  11. package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.d.ts +13 -7
  12. package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js +50 -45
  13. package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js.map +1 -1
  14. package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.d.ts +4 -3
  15. package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js +50 -18
  16. package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js.map +1 -1
  17. package/dist/integration-engine/ropid-gtfs/data-access/{DeparturesRepository.d.ts → precomputed/DeparturesRepository.d.ts} +2 -1
  18. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +132 -0
  19. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -0
  20. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.d.ts +9 -0
  21. package/dist/integration-engine/ropid-gtfs/{RopidGTFSMinMaxSequencesModel.js → data-access/precomputed/MinMaxStopSequencesRepository.js} +34 -33
  22. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +1 -0
  23. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts +9 -0
  24. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +135 -0
  25. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +1 -0
  26. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts +11 -0
  27. package/dist/integration-engine/ropid-gtfs/{RopidGTFSScheduledTripsModel.js → data-access/precomputed/TripScheduleRepository.js} +27 -26
  28. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -0
  29. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.d.ts +4 -0
  30. package/dist/integration-engine/ropid-gtfs/data-access/{index.js → precomputed/index.js} +3 -0
  31. package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.js.map +1 -0
  32. package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.d.ts +5 -0
  33. package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js +10 -0
  34. package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js.map +1 -0
  35. package/dist/integration-engine/ropid-gtfs/index.d.ts +0 -3
  36. package/dist/integration-engine/ropid-gtfs/index.js +0 -3
  37. package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
  38. package/dist/integration-engine/ropid-gtfs/utils.js +5 -4
  39. package/dist/integration-engine/ropid-gtfs/utils.js.map +1 -1
  40. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.d.ts +1 -1
  41. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +3 -3
  42. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
  43. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +18 -18
  44. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
  45. package/dist/output-gateway/departure-boards/DepartureBoardsRouter.js +1 -1
  46. package/dist/output-gateway/pid/data-access/DeparturesRepository.js +0 -6
  47. package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
  48. package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +2 -2
  49. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -3
  50. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +15 -15
  51. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
  52. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.d.ts +0 -1
  53. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js +5 -18
  54. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js.map +1 -1
  55. package/dist/schema-definitions/ropid-gtfs/models/precomputed/interfaces/IDeparturesModel.d.ts +0 -1
  56. package/docs/implementation_documentation.md +30 -10
  57. package/docs/openapi-output.yaml +1 -1
  58. package/package.json +4 -3
  59. package/db/example/99_precomputed_tables.sql +0 -169
  60. package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.d.ts +0 -19
  61. package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.js.map +0 -1
  62. package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.d.ts +0 -21
  63. package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.js.map +0 -1
  64. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.d.ts +0 -19
  65. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js +0 -142
  66. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js.map +0 -1
  67. package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js +0 -162
  68. package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js.map +0 -1
  69. package/dist/integration-engine/ropid-gtfs/data-access/index.d.ts +0 -1
  70. package/dist/integration-engine/ropid-gtfs/data-access/index.js.map +0 -1
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServicesCalendarRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+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,sBAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC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AAC,iBAAiB,CAAC,CAAC;gBACtF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC;wBACQ,sBAAS,CAAC,QAAQ,KAAK,WAAW;+BAC3B,sBAAS,CAAC,QAAQ,KAAK,eAAe,gBAAgB,sBAAS,CAAC,QAAQ,KAAK,WAAW;wCAC/E,sBAAS,CAAC,QAAQ,KAAK,eAAe;kBAC5D,UAAU;+BACG,sBAAS,CAAC,QAAQ,KAAK,YAAY,cAAc,eAAe;+BAChE,sBAAS,CAAC,QAAQ,KAAK,eAAe,aAAa,sBAAS,CAAC,QAAQ,KAAK,WAAW;iBACnG,EACD,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,kBAAa,GAAG,GAAwB,EAAE;YAC7C,IAAI;gBACA,MAAM,UAAU,GAAG,IAAA,6BAAqB,EACpC,sBAAS,CAAC,gBAAgB,CAAC,WAAW,EACtC,sBAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAC/C,CAAC;gBACF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;aAC1D;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAnHF,CAAC;CAoHJ;AAjID,gEAiIC"}
@@ -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.RopidGTFSScheduledTripsModel = void 0;
13
- const utils_1 = require("./utils");
14
- const ropid_gtfs_1 = require("../../schema-definitions/ropid-gtfs");
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
- class RopidGTFSScheduledTripsModel extends models_1.PostgresModel {
18
+ const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
19
+ class TripScheduleRepository extends models_1.PostgresModel {
19
20
  constructor() {
20
- super(ropid_gtfs_1.RopidGTFS.scheduledTrips.name + "Model", {
21
- outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.scheduledTrips.outputSequelizeAttributes,
22
- pgTableName: ropid_gtfs_1.RopidGTFS.scheduledTrips.pgTableName,
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(ropid_gtfs_1.RopidGTFS.scheduledTrips.name + "ModelValidator", ropid_gtfs_1.RopidGTFS.scheduledTrips.outputJsonSchema));
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.createAndPopulateFromTmp = () => __awaiter(this, void 0, void 0, function* () {
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}".ropidgtfs_run_numbers_tmp t1
118
- LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_services_first14days_tmp t3 ON t1.service_id = t3.service_id
119
- LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_trips_minmaxsequences_tmp t4 ON t1.trip_id = t4.trip_id
120
- LEFT OUTER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_stop_times_tmp t5 ON t1.trip_id = t5.trip_id AND t5.stop_sequence = t4.min_stop_sequence
121
- LEFT OUTER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_stop_times_tmp t6 ON t1.trip_id = t6.trip_id AND t6.stop_sequence = t4.max_stop_sequence
122
- LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_trips_tmp t8 ON t1.trip_id = t8.trip_id
123
- LEFT JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_routes_tmp t7 ON t8.route_id = t7.route_id
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.scheduledTrips.pgTableName + "_tmp";
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.scheduledTrips.pgTableName}
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.scheduledTrips.pgTableName;
143
- const tableNameActual = pgTableName + "_actual";
144
- const tableNameTmp = pgTableName + "_tmp";
145
- const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.scheduledTrips.modelIndexOptions);
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.scheduledTrips.modelIndexOptions;
163
- const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.scheduledTrips.pgTableName, indexes);
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.RopidGTFSScheduledTripsModel = RopidGTFSScheduledTripsModel;
174
- //# sourceMappingURL=RopidGTFSScheduledTripsModel.js.map
174
+ exports.TripScheduleRepository = TripScheduleRepository;
175
+ //# sourceMappingURL=TripScheduleRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAG5E,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,sBAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,sBAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CACtG,CAAC;QAGC,YAAO,GAAG,CAAC,OAAoB,EAAgC,EAAE;YACpE,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,iBAAG,GAAG,EAAE,IAAI,IAAK,OAAO,EAAG,CAAC;QAClE,CAAC,CAAC;QAEK,sBAAiB,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YACzF,4BAA4B;YAC5B,MAAM,GAAG,GAAG;;;;;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Y,CAAC,iBAAiB,CAAC,CAAC;gBAClF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC;wBACQ,sBAAS,CAAC,QAAQ,KAAK,WAAW;+BAC3B,sBAAS,CAAC,QAAQ,KAAK,eAAe,gBAAgB,sBAAS,CAAC,QAAQ,KAAK,WAAW;wCAC/E,sBAAS,CAAC,QAAQ,KAAK,eAAe;kBAC5D,UAAU;+BACG,sBAAS,CAAC,QAAQ,KAAK,YAAY,cAAc,eAAe;+BAChE,sBAAS,CAAC,QAAQ,KAAK,eAAe,aAAa,sBAAS,CAAC,QAAQ,KAAK,WAAW;iBACnG,EACD,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,kBAAa,GAAG,GAAwB,EAAE;YAC7C,IAAI;gBACA,MAAM,OAAO,GAAG,sBAAS,CAAC,YAAY,CAAC,iBAAiB,CAAC;gBACzD,MAAM,UAAU,GAAG,IAAA,6BAAqB,EAAC,sBAAS,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBAEtF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;aAC1D;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IA1JF,CAAC;CA2JJ;AAxKD,wDAwKC"}
@@ -0,0 +1,4 @@
1
+ export * from "./TripScheduleRepository";
2
+ export * from "./ServicesCalendarRepository";
3
+ export * from "./MinMaxStopSequencesRepository";
4
+ export * from "./DeparturesRepository";
@@ -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,5 @@
1
+ export declare enum SourceTableSuffixEnum {
2
+ Actual = "_actual",
3
+ Tmp = "_tmp",
4
+ Drop = "_drop"
5
+ }
@@ -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"}
@@ -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,sEAAoD;AACpD,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AACtC,2DAAyC;AACzC,oDAAkC;AAClC,4DAA0C;AAC1C,wDAAsC;AACtC,yDAAuC"}
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}_tmp
8
- ON "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableName}_tmp ${el.using ? "USING " + el.using : ""} (${el.fields.toString()});`;
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}_tmp RENAME TO ${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}_tmp;`;
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":";;;AACA,oEAA4C;AAErC,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;sBAC3D,sBAAS,CAAC,QAAQ,KAAK,SAAS,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,MAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC5H,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC;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,kBAAkB,EAAE,CAAC,IAAI,GAAG,CAAC;IAChG,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,OAA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,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"}
@@ -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 ropidGTFSScheduledTripsModel;
22
+ private tripScheduleRepository;
23
23
  constructor();
24
24
  getRunRecordForUpdate: (run: ICommonRunsModel) => Promise<ICommonRunsModel | null>;
25
25
  createAndAssociate: ({ run, run_message }: ICommonRunWithMessage) => Promise<ICommonRunWithMessage>;
@@ -44,7 +44,7 @@ var __rest = (this && this.__rest) || function (s, e) {
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.CommonRunsRepository = void 0;
47
- const RopidGTFSScheduledTripsModel_1 = require("../../../../ropid-gtfs/RopidGTFSScheduledTripsModel");
47
+ const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
48
48
  const vehicle_positions_1 = require("../../../../../schema-definitions/vehicle-positions");
49
49
  const models_1 = require("../../../../../schema-definitions/vehicle-positions/models");
50
50
  const connectors_1 = require("@golemio/core/dist/integration-engine/connectors");
@@ -148,7 +148,7 @@ class CommonRunsRepository extends models_2.PostgresModel {
148
148
  }
149
149
  });
150
150
  this.getScheduledTrips = (origin_route_name, run_number, msg_last_timestamp) => {
151
- return this.ropidGTFSScheduledTripsModel.findAll({
151
+ return this.tripScheduleRepository.findAll({
152
152
  attributes: {
153
153
  include: [
154
154
  [sequelize_1.default.cast(sequelize_1.default.col("start_timestamp"), "varchar"), "start_timestamp"],
@@ -181,7 +181,7 @@ class CommonRunsRepository extends models_2.PostgresModel {
181
181
  foreignKey: "runs_id",
182
182
  as: "run_messages",
183
183
  });
184
- this.ropidGTFSScheduledTripsModel = new RopidGTFSScheduledTripsModel_1.RopidGTFSScheduledTripsModel();
184
+ this.tripScheduleRepository = new precomputed_1.TripScheduleRepository();
185
185
  }
186
186
  }
187
187
  exports.CommonRunsRepository = CommonRunsRepository;
@@ -1 +1 @@
1
- {"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sGAA2F;AAC3F,2FAA0D;AAC1D,uFAAgE;AAEhE,iFAAqF;AACrF,2EAAoE;AACpE,yEAAqF;AACrF,6EAAuE;AACvE,mFAAkF;AAClF,iFAAoE;AAEpE,iFAA8E;AAE9E,MAAa,oBAAqB,SAAQ,sBAAa;IAgBnD;QACI,KAAK,CACD,sBAAsB,EACtB;YACI,WAAW,EAAE,wBAAe,CAAC,UAAU;YACvC,QAAQ,EAAE,oCAAgB,CAAC,QAAQ;YACnC,yBAAyB,EAAE,wBAAe,CAAC,cAAc;YACzD,UAAU,EAAE,YAAY;YACxB,2BAA2B,EAAE;gBACzB,OAAO,EAAE;oBACL;wBACI,MAAM,EAAE,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,4BAA4B;qBACrC;oBACD;wBACI,MAAM,EAAE,CAAC,UAAU,EAAE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S,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC,EAAE,eAAe,CAAC;qBAC/E;oBACD,OAAO,EAAE,CAAC,YAAY,EAAE,iBAAiB,EAAE,eAAe,CAAC;iBAC9D;gBACD,KAAK,EAAE;oBACH,iBAAiB;oBACjB,UAAU;oBACV,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;wBACf,mBAAS,CAAC,OAAO,CAAC,WAAW,kBAAkB,SAAS,CAAC;wBACzD,mBAAS,CAAC,OAAO,CAAC,YAAY,kBAAkB,wCAAwC,CAAC;wBACzF,mBAAS,CAAC,OAAO,CAAC,YAAY,kBAAkB,wCAAwC,CAAC;qBAC5F;iBACJ;gBACD,KAAK,EAAE;oBACH,CAAC,MAAM,EAAE,KAAK,CAAC;oBACf,CAAC,eAAe,EAAE,KAAK,CAAC;iBAC3B;aACJ,CAAC,CAAC;QACP,CAAC,CAAC;QA7HE,IAAI,CAAC,sBAAsB,GAAG,IAAI,2DAA4B,EAAE,CAAC;QACjE,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE;YACzE,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,SAAS;SACtB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE;YACvE,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,SAAS;YACrB,EAAE,EAAE,cAAc;SACrB,CAAC,CAAC;QAEH,IAAI,CAAC,4BAA4B,GAAG,IAAI,2DAA4B,EAAE,CAAC;IAC3E,CAAC;CAiHJ;AAtKD,oDAsKC"}
1
+ {"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAC,cAAc,EAAE;YACzE,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,SAAS;SACtB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE;YACvE,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,SAAS;YACrB,EAAE,EAAE,cAAc;SACrB,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,GAAG,IAAI,oCAAsB,EAAE,CAAC;IAC/D,CAAC;CAiHJ;AAtKD,oDAsKC"}
@@ -461,22 +461,22 @@ class TripsRepository extends models_2.PostgresModel {
461
461
  const sqlQuery = `
462
462
  SELECT DISTINCT
463
463
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id as gtfs_trip_id,
464
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.date as gtfs_date,
464
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.date as gtfs_date,
465
465
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_headsign as gtfs_trip_headsign,
466
466
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_id as gtfs_route_id,
467
467
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_type as gtfs_route_type,
468
468
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_short_name as gtfs_route_short_name,
469
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences.min_stop_time,
470
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences.max_stop_time,
471
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.run_number as internal_run_number,
472
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.origin_route_name as internal_route_name
469
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences.min_stop_time,
470
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences.max_stop_time,
471
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.run_number as internal_run_number,
472
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.origin_route_name as internal_route_name
473
473
  FROM "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips
474
474
  INNER JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.route_id=ropidgtfs_routes.route_id
475
475
  INNER JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_stop_times ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_stop_times.trip_id
476
- LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips
477
- ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_scheduled_trips.trip_id
478
- AND ropidgtfs_scheduled_trips.start_timestamp::date = current_date
479
- LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_trips_minmaxsequences.trip_id
476
+ LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule
477
+ ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_precomputed_trip_schedule.trip_id
478
+ AND ropidgtfs_precomputed_trip_schedule.start_timestamp::date = current_date
479
+ LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_precomputed_minmax_stop_sequences.trip_id
480
480
  WHERE
481
481
  ( "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_short_name LIKE $cisLineShortName
482
482
  OR CASE WHEN ($cisLineShortName = 'IKEA')
@@ -574,7 +574,7 @@ class TripsRepository extends models_2.PostgresModel {
574
574
  LIMIT 1)
575
575
  SELECT DISTINCT
576
576
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id as gtfs_trip_id,
577
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.date as gtfs_date,
577
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.date as gtfs_date,
578
578
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.block_id as gtfs_block_id,
579
579
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_headsign as gtfs_trip_headsign,
580
580
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_short_name as gtfs_trip_short_name,
@@ -582,18 +582,18 @@ class TripsRepository extends models_2.PostgresModel {
582
582
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_type as gtfs_route_type,
583
583
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_short_name as gtfs_route_short_name,
584
584
  wanted_trip.cis_trip_number,
585
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences.min_stop_time,
586
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences.max_stop_time,
587
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.run_number as internal_run_number,
588
- "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips.origin_route_name as internal_route_name
585
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences.min_stop_time,
586
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences.max_stop_time,
587
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.run_number as internal_run_number,
588
+ "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule.origin_route_name as internal_route_name
589
589
  FROM "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips
590
590
  INNER JOIN wanted_trip ON 1 = 1
591
591
  INNER JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.route_id=ropidgtfs_routes.route_id
592
592
  INNER JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_stop_times ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_stop_times.trip_id
593
- LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_scheduled_trips
594
- ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_scheduled_trips.trip_id
595
- AND ropidgtfs_scheduled_trips.start_timestamp::date = current_date
596
- LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id="${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips_minmaxsequences.trip_id
593
+ LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_trip_schedule
594
+ ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id=ropidgtfs_precomputed_trip_schedule.trip_id
595
+ AND ropidgtfs_precomputed_trip_schedule.start_timestamp::date = current_date
596
+ LEFT JOIN "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences ON "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id="${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_precomputed_minmax_stop_sequences.trip_id
597
597
  WHERE
598
598
  "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_trips.trip_id ~ CONCAT('\\d+_', wanted_trip.cis_trip_number, '_\\d+')
599
599
  AND "${vehicle_positions_1.VehiclePositions.pgSchema}".ropidgtfs_routes.route_type = '2'