@golemio/pid 2.6.4 → 2.6.5-dev.834035052

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 (80) 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/gtfs-rt/helpers/VehicleDescriptor.js +3 -0
  41. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.js.map +1 -1
  42. package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/interfaces/IGtfsRtFeedEntity.d.ts +3 -0
  43. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.d.ts +1 -1
  44. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +3 -3
  45. package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
  46. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js +3 -1
  47. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.js.map +1 -1
  48. package/dist/integration-engine/vehicle-positions/workers/vehicle-descriptors/data-access/DescriptorRepository.d.ts +1 -1
  49. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.d.ts +1 -0
  50. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +38 -22
  51. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
  52. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.d.ts +1 -0
  53. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js +7 -2
  54. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateDelayTask.js.map +1 -1
  55. package/dist/output-gateway/departure-boards/DepartureBoardsRouter.js +1 -1
  56. package/dist/output-gateway/pid/data-access/DeparturesRepository.js +0 -6
  57. package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
  58. package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +2 -2
  59. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -3
  60. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +15 -15
  61. package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
  62. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.d.ts +0 -1
  63. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js +5 -18
  64. package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js.map +1 -1
  65. package/dist/schema-definitions/ropid-gtfs/models/precomputed/interfaces/IDeparturesModel.d.ts +0 -1
  66. package/docs/implementation_documentation.md +30 -10
  67. package/docs/openapi-output.yaml +8 -1
  68. package/package.json +4 -3
  69. package/db/example/99_precomputed_tables.sql +0 -169
  70. package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.d.ts +0 -19
  71. package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.js.map +0 -1
  72. package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.d.ts +0 -21
  73. package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.js.map +0 -1
  74. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.d.ts +0 -19
  75. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js +0 -142
  76. package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js.map +0 -1
  77. package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js +0 -162
  78. package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js.map +0 -1
  79. package/dist/integration-engine/ropid-gtfs/data-access/index.d.ts +0 -1
  80. 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;SACzD,EACD,IAAI,uCAAmB,CAAC,qCAAqC,EAAE,sBAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAC9G,CAAC;QAGC,sBAAiB,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YACzF,MAAM,GAAG,GAAG;;;;;;;;;;;;;0BAaM,sBAAS,CAAC,QAAQ,uBAAuB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+BhD,sBAAS,CAAC,QAAQ,6BAA6B,iBAAiB;;;;;;;;gCAQpE,sBAAS,CAAC,QAAQ,6BAA6B,iBAAiB;;;;;;;SAOvF,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,CACtC,yBAAyB,s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K,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,mFAAk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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,EA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Descriptor {
9
9
  label: feedEntity.vehicle_registration_number,
10
10
  })), { ".transit_realtime.ovapiVehicleDescriptor": {
11
11
  wheelchairAccessible: (_a = feedEntity.wheelchair_accessible) !== null && _a !== void 0 ? _a : undefined,
12
+ vehicleType: feedEntity.vehicle_descriptor
13
+ ? JSON.stringify({ airConditioned: feedEntity.vehicle_descriptor.is_air_conditioned })
14
+ : undefined,
12
15
  } });
13
16
  }
14
17
  getVehicleId(feedEntity) {
@@ -1 +1 @@
1
- {"version":3,"file":"VehicleDescriptor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.ts"],"names":[],"mappings":";;;AACA,0EAA+D;AAa/D,MAAa,iBAAiB;IACnB,oBAAoB,CAAC,UAA6B;;QACrD,qCACI,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAC9B,CAAC,UAAU,CAAC,2BAA2B,IAAI;YAC1C,KAAK,EAAE,UAAU,CAAC,2BAA2B;SAChD,CAAC,KACF,0CAA0C,EAAE;gBACxC,oBAAoB,EAAE,MAAA,UAAU,CAAC,qBAAqB,mCAAI,SAAS;aACtE,IACH;IACN,CAAC;IAEO,YAAY,CAAC,UAA6B;QAC9C,IAAI,UAAU,CAAC,eAAe,KAAK,kCAAiB,CAAC,KAAK,EAAE;YACxD,OAAO,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC;SAChD;QAED,IAAI,UAAU,CAAC,eAAe,KAAK,kCAAiB,CAAC,KAAK,EAAE;YACxD,OAAO,QAAQ,GAAG,UAAU,CAAC,qBAAqB,GAAG,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC;SACpF;QAED,OAAO,UAAU,GAAG,UAAU,CAAC,eAAe,GAAG,GAAG,GAAG,UAAU,CAAC,2BAA2B,CAAC;IAClG,CAAC;CACJ;AAxBD,8CAwBC"}
1
+ {"version":3,"file":"VehicleDescriptor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/VehicleDescriptor.ts"],"names":[],"mappings":";;;AACA,0EAA+D;AAa/D,MAAa,iBAAiB;IACnB,oBAAoB,CAAC,UAA6B;;QACrD,qCACI,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAC9B,CAAC,UAAU,CAAC,2BAA2B,IAAI;YAC1C,KAAK,EAAE,UAAU,CAAC,2BAA2B;SAChD,CAAC,KACF,0CAA0C,EAAE;gBACxC,oBAAoB,EAAE,MAAA,UAAU,CAAC,qBAAqB,mCAAI,SAAS;gBACnE,WAAW,EAAE,UAAU,CAAC,kBAAkB;oBACtC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,UAAU,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;oBACtF,CAAC,CAAC,SAAS;aAClB,IACH;IACN,CAAC;IAEO,YAAY,CAAC,UAA6B;QAC9C,IAAI,UAAU,CAAC,eAAe,KAAK,kCAAiB,CAAC,KAAK,EAAE;YACxD,OAAO,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC;SAChD;QAED,IAAI,UAAU,CAAC,eAAe,KAAK,kCAAiB,CAAC,KAAK,EAAE;YACxD,OAAO,QAAQ,GAAG,UAAU,CAAC,qBAAqB,GAAG,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC;SACpF;QAED,OAAO,UAAU,GAAG,UAAU,CAAC,eAAe,GAAG,GAAG,GAAG,UAAU,CAAC,2BAA2B,CAAC;IAClG,CAAC;CACJ;AA3BD,8CA2BC"}
@@ -25,4 +25,7 @@ export interface IGtfsRtFeedEntity {
25
25
  gtfs_route_type: number | null;
26
26
  gtfs_route_short_name: string | null;
27
27
  wheelchair_accessible: boolean | null;
28
+ vehicle_descriptor?: {
29
+ is_air_conditioned: boolean | null;
30
+ };
28
31
  }
@@ -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/Comm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E,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gFAAgF;AAChF,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,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;wBAChF,IAAI,EAAE,2BAA2B;qBACpC;iBACJ;aACJ;SACJ,EACD,I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AY,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,sBAAsB,GAAG,IAAI,oCAAsB,EAAE,CAAC;IAC/D,CAAC;CAiHJ;AAtKD,oDAsKC"}
@@ -13,6 +13,7 @@ exports.CommonMessageProcessor = void 0;
13
13
  const config_1 = require("@golemio/core/dist/integration-engine/config");
14
14
  const queueprocessors_1 = require("@golemio/core/dist/integration-engine/queueprocessors");
15
15
  const vehicle_positions_1 = require("../../../../../schema-definitions/vehicle-positions");
16
+ const const_1 = require("../../../../../const");
16
17
  class CommonMessageProcessor {
17
18
  constructor(runsRepository) {
18
19
  this.runsRepository = runsRepository;
@@ -23,7 +24,8 @@ class CommonMessageProcessor {
23
24
  const record = yield this.runsRepository.getRunRecordForUpdate(element.run);
24
25
  let outputMsg;
25
26
  if (record) {
26
- if (!element.run_message.actual_stop_timestamp_scheduled) {
27
+ if (!element.run_message.actual_stop_timestamp_scheduled &&
28
+ !const_1.ArrayNotPublicRegistrationNumbers.includes(element.run.registration_number)) {
27
29
  const lastRecordMessage = yield this.runsRepository["runsMessagesRepository"].getLastMessage(record.id);
28
30
  if (!lastRecordMessage || !lastRecordMessage.actual_stop_timestamp_scheduled)
29
31
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAsE;AACtE,2FAAqF;AAGrF,2FAA0D;AAE1D,MAAa,sBAAsB;IAC/B,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAEjE;;WAEG;QACI,0BAAqB,GAAG,CAAO,OAA8B,EAAiB,EAAE;YACnF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE5E,IAAI,SAAgC,CAAC;YACrC,IAAI,MAAM,EAAE;gBACR,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,+BAA+B,EAAE;oBACtD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACxG,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,+BAA+B;wBAAE,OAAO;oBACrF,OAAO,CAAC,WAAW,CAAC,+BAA+B,GAAG,iBAAiB,CAAC,+BAA+B,CAAC;iBAC3G;gBAED,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;aAChF;iBAAM;gBACH,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;aACrE;YAED,MAAM,8BAAY,CAAC,qBAAqB,CACpC,GAAG,eAAM,CAAC,oBAAoB,IAAI,oCAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EACvE,sBAAsB,EACtB,SAAS,CACZ,CAAC;QACN,CAAC,CAAA,CAAC;IA1BkE,CAAC;CA2BxE;AA5BD,wDA4BC"}
1
+ {"version":3,"file":"CommonMessageProcessor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/CommonMessageProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAsE;AACtE,2FAAqF;AAGrF,2FAA0D;AAC1D,gDAAyE;AAEzE,MAAa,sBAAsB;IAC/B,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;QAEjE;;WAEG;QACI,0BAAqB,GAAG,CAAO,OAA8B,EAAiB,EAAE;YACnF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE5E,IAAI,SAAgC,CAAC;YACrC,IAAI,MAAM,EAAE;gBACR,IACI,CAAC,OAAO,CAAC,WAAW,CAAC,+BAA+B;oBACpD,CAAC,yCAAiC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAC9E;oBACE,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACxG,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,+BAA+B;wBAAE,OAAO;oBACrF,OAAO,CAAC,WAAW,CAAC,+BAA+B,GAAG,iBAAiB,CAAC,+BAA+B,CAAC;iBAC3G;gBAED,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;aAChF;iBAAM;gBACH,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;aACrE;YAED,MAAM,8BAAY,CAAC,qBAAqB,CACpC,GAAG,eAAM,CAAC,oBAAoB,IAAI,oCAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EACvE,sBAAsB,EACtB,SAAS,CACZ,CAAC;QACN,CAAC,CAAA,CAAC;IA7BkE,CAAC;CA8BxE;AA/BD,wDA+BC"}
@@ -6,7 +6,7 @@ import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
6
6
  export declare class DescriptorRepository extends PostgresModel implements IModel {
7
7
  private logger;
8
8
  private static REPOSITORY_NAME;
9
- protected sequelizeModel: ModelStatic<DescriptorModel>;
9
+ sequelizeModel: ModelStatic<DescriptorModel>;
10
10
  constructor(logger: ILogger);
11
11
  saveData: (data: IDescriptorOutputDto[], isReturning?: boolean) => Promise<DescriptorModel[]>;
12
12
  deleteNHoursOldData: (hours: number) => Promise<number>;
@@ -83,6 +83,7 @@ export declare class TripsRepository extends PostgresModel implements IModel {
83
83
  protected savingType: "insertOnly" | "insertOrUpdate";
84
84
  private positionsRepository;
85
85
  private gtfsStopsTimesRepository;
86
+ private descriptorRepository;
86
87
  constructor();
87
88
  /**
88
89
  * Overrides PostgresModel::save