@tmlmobilidade/databases 20260325.1459.50 → 20260325.2343.38

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.
@@ -0,0 +1,5 @@
1
+ export * from './pcgi-locations.js';
2
+ export * from './pcgi-sales.js';
3
+ export * from './pcgi-validations.js';
4
+ export * from '../vehicle-events/raw-vehicle-events.js';
5
+ export * from '../vehicle-events/simplified-vehicle-events.js';
@@ -0,0 +1,5 @@
1
+ export * from './pcgi-locations.js';
2
+ export * from './pcgi-sales.js';
3
+ export * from './pcgi-validations.js';
4
+ export * from '../vehicle-events/raw-vehicle-events.js';
5
+ export * from '../vehicle-events/simplified-vehicle-events.js';
@@ -0,0 +1,16 @@
1
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
2
+ declare class PCGILocationsClass extends MongoInterfaceTemplate<any, any, Partial<any>> {
3
+ private static _instance;
4
+ protected readonly collectionName = "locationEntity";
5
+ protected readonly databaseName = "LocationManagement";
6
+ protected readonly indexDescription = false;
7
+ protected createSchema: any;
8
+ protected updateSchema: any;
9
+ /**
10
+ * Returns the singleton instance of the subclass.
11
+ */
12
+ static getInstance(): Promise<PCGILocationsClass>;
13
+ protected connectToClient(): Promise<import("mongodb").MongoClient>;
14
+ }
15
+ export declare const pcgiLocations: PCGILocationsClass;
16
+ export {};
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { PCGIRawClient } from '../../clients/pcgi-raw.js';
3
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
4
+ import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class PCGILocationsClass extends MongoInterfaceTemplate {
7
+ //
8
+ static _instance = null;
9
+ collectionName = 'locationEntity';
10
+ databaseName = 'LocationManagement';
11
+ indexDescription = false;
12
+ createSchema = null;
13
+ updateSchema = null;
14
+ /**
15
+ * Returns the singleton instance of the subclass.
16
+ */
17
+ static async getInstance() {
18
+ // If no instance exists, create one and store the promise.
19
+ // This ensures that if multiple calls to getInstance() happen concurrently,
20
+ // they will all await the same initialization process.
21
+ if (!this._instance) {
22
+ this._instance = (async () => {
23
+ const instance = new PCGILocationsClass();
24
+ // This behaves like the constructor,
25
+ // but allows for async initialization.
26
+ await instance.init();
27
+ return instance;
28
+ })();
29
+ }
30
+ // Await the instance if it's still initializing,
31
+ // or return it immediately if ready.
32
+ return await this._instance;
33
+ }
34
+ connectToClient() {
35
+ return PCGIRawClient.getClient();
36
+ }
37
+ }
38
+ /* * */
39
+ export const pcgiLocations = asyncSingletonProxy(PCGILocationsClass);
@@ -0,0 +1,16 @@
1
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
2
+ declare class PCGISalesClass extends MongoInterfaceTemplate<any, any, Partial<any>> {
3
+ private static _instance;
4
+ protected readonly collectionName = "salesEntity";
5
+ protected readonly databaseName = "SalesManagement";
6
+ protected readonly indexDescription = false;
7
+ protected createSchema: any;
8
+ protected updateSchema: any;
9
+ /**
10
+ * Returns the singleton instance of the subclass.
11
+ */
12
+ static getInstance(): Promise<PCGISalesClass>;
13
+ protected connectToClient(): Promise<import("mongodb").MongoClient>;
14
+ }
15
+ export declare const pcgiSales: PCGISalesClass;
16
+ export {};
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { PCGIRawClient } from '../../clients/pcgi-raw.js';
3
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
4
+ import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class PCGISalesClass extends MongoInterfaceTemplate {
7
+ //
8
+ static _instance = null;
9
+ collectionName = 'salesEntity';
10
+ databaseName = 'SalesManagement';
11
+ indexDescription = false;
12
+ createSchema = null;
13
+ updateSchema = null;
14
+ /**
15
+ * Returns the singleton instance of the subclass.
16
+ */
17
+ static async getInstance() {
18
+ // If no instance exists, create one and store the promise.
19
+ // This ensures that if multiple calls to getInstance() happen concurrently,
20
+ // they will all await the same initialization process.
21
+ if (!this._instance) {
22
+ this._instance = (async () => {
23
+ const instance = new PCGISalesClass();
24
+ // This behaves like the constructor,
25
+ // but allows for async initialization.
26
+ await instance.init();
27
+ return instance;
28
+ })();
29
+ }
30
+ // Await the instance if it's still initializing,
31
+ // or return it immediately if ready.
32
+ return await this._instance;
33
+ }
34
+ connectToClient() {
35
+ return PCGIRawClient.getClient();
36
+ }
37
+ }
38
+ /* * */
39
+ export const pcgiSales = asyncSingletonProxy(PCGISalesClass);
@@ -0,0 +1,581 @@
1
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
2
+ import { type SimplifiedMongoIndex } from '../../types/mongo/index-description.js';
3
+ import { type RawVehicleEvent } from '@tmlmobilidade/types';
4
+ declare class RawVehicleEventsNewClass extends MongoInterfaceTemplate<RawVehicleEvent, RawVehicleEvent, Partial<RawVehicleEvent>> {
5
+ private static _instance;
6
+ protected readonly collectionName = "raw_vehicle_events";
7
+ protected readonly databaseName = "raw";
8
+ protected readonly indexDescription: SimplifiedMongoIndex<RawVehicleEvent>[];
9
+ protected createSchema: import("zod").ZodDiscriminatedUnion<"version", [import("zod").ZodObject<{
10
+ _id: import("zod").ZodString;
11
+ agency_id: import("zod").ZodString;
12
+ created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
13
+ entity_id: import("zod").ZodString;
14
+ received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
15
+ } & {
16
+ payload: import("zod").ZodObject<{
17
+ header: import("zod").ZodObject<{
18
+ gtfsRealtimeVersion: import("zod").ZodLiteral<"2.0">;
19
+ incrementality: import("zod").ZodLiteral<"DIFFERENTIAL">;
20
+ timestamp: import("zod").ZodNumber;
21
+ }, "strip", import("zod").ZodTypeAny, {
22
+ timestamp: number;
23
+ incrementality: "DIFFERENTIAL";
24
+ gtfsRealtimeVersion: "2.0";
25
+ }, {
26
+ timestamp: number;
27
+ incrementality: "DIFFERENTIAL";
28
+ gtfsRealtimeVersion: "2.0";
29
+ }>;
30
+ vehicle: import("zod").ZodObject<{
31
+ agencyId: import("zod").ZodString;
32
+ currentStatus: import("zod").ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>;
33
+ occupancyStatus: import("zod").ZodEnum<["EMPTY", "PARTIALLY_OCCUPIED", "FULL"]>;
34
+ operationPlanId: import("zod").ZodString;
35
+ position: import("zod").ZodObject<{
36
+ bearing: import("zod").ZodNumber;
37
+ latitude: import("zod").ZodNumber;
38
+ longitude: import("zod").ZodNumber;
39
+ odometer: import("zod").ZodNumber;
40
+ speed: import("zod").ZodNumber;
41
+ }, "strip", import("zod").ZodTypeAny, {
42
+ latitude: number;
43
+ longitude: number;
44
+ bearing: number;
45
+ odometer: number;
46
+ speed: number;
47
+ }, {
48
+ latitude: number;
49
+ longitude: number;
50
+ bearing: number;
51
+ odometer: number;
52
+ speed: number;
53
+ }>;
54
+ stopId: import("zod").ZodString;
55
+ timestamp: import("zod").ZodNumber;
56
+ trigger: import("zod").ZodObject<{
57
+ activity: import("zod").ZodEnum<["NO_CHANGE", "CHANGE"]>;
58
+ door: import("zod").ZodEnum<["NO_CHANGE", "CHANGE"]>;
59
+ }, "strip", import("zod").ZodTypeAny, {
60
+ activity: "NO_CHANGE" | "CHANGE";
61
+ door: "NO_CHANGE" | "CHANGE";
62
+ }, {
63
+ activity: "NO_CHANGE" | "CHANGE";
64
+ door: "NO_CHANGE" | "CHANGE";
65
+ }>;
66
+ trip: import("zod").ZodObject<{
67
+ extraTripId: import("zod").ZodString;
68
+ lineId: import("zod").ZodString;
69
+ patternId: import("zod").ZodString;
70
+ routeId: import("zod").ZodString;
71
+ scheduleRelationship: import("zod").ZodEnum<["SCHEDULED", "NOT_SCHEDULED"]>;
72
+ tripId: import("zod").ZodString;
73
+ }, "strip", import("zod").ZodTypeAny, {
74
+ extraTripId: string;
75
+ lineId: string;
76
+ patternId: string;
77
+ routeId: string;
78
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
79
+ tripId: string;
80
+ }, {
81
+ extraTripId: string;
82
+ lineId: string;
83
+ patternId: string;
84
+ routeId: string;
85
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
86
+ tripId: string;
87
+ }>;
88
+ vehicle: import("zod").ZodObject<{
89
+ _id: import("zod").ZodString;
90
+ blockId: import("zod").ZodString;
91
+ driverId: import("zod").ZodString;
92
+ shiftId: import("zod").ZodString;
93
+ }, "strip", import("zod").ZodTypeAny, {
94
+ _id: string;
95
+ blockId: string;
96
+ driverId: string;
97
+ shiftId: string;
98
+ }, {
99
+ _id: string;
100
+ blockId: string;
101
+ driverId: string;
102
+ shiftId: string;
103
+ }>;
104
+ }, "strip", import("zod").ZodTypeAny, {
105
+ trip: {
106
+ extraTripId: string;
107
+ lineId: string;
108
+ patternId: string;
109
+ routeId: string;
110
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
111
+ tripId: string;
112
+ };
113
+ position: {
114
+ latitude: number;
115
+ longitude: number;
116
+ bearing: number;
117
+ odometer: number;
118
+ speed: number;
119
+ };
120
+ timestamp: number;
121
+ vehicle: {
122
+ _id: string;
123
+ blockId: string;
124
+ driverId: string;
125
+ shiftId: string;
126
+ };
127
+ agencyId: string;
128
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
129
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
130
+ operationPlanId: string;
131
+ stopId: string;
132
+ trigger: {
133
+ activity: "NO_CHANGE" | "CHANGE";
134
+ door: "NO_CHANGE" | "CHANGE";
135
+ };
136
+ }, {
137
+ trip: {
138
+ extraTripId: string;
139
+ lineId: string;
140
+ patternId: string;
141
+ routeId: string;
142
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
143
+ tripId: string;
144
+ };
145
+ position: {
146
+ latitude: number;
147
+ longitude: number;
148
+ bearing: number;
149
+ odometer: number;
150
+ speed: number;
151
+ };
152
+ timestamp: number;
153
+ vehicle: {
154
+ _id: string;
155
+ blockId: string;
156
+ driverId: string;
157
+ shiftId: string;
158
+ };
159
+ agencyId: string;
160
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
161
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
162
+ operationPlanId: string;
163
+ stopId: string;
164
+ trigger: {
165
+ activity: "NO_CHANGE" | "CHANGE";
166
+ door: "NO_CHANGE" | "CHANGE";
167
+ };
168
+ }>;
169
+ }, "strip", import("zod").ZodTypeAny, {
170
+ vehicle: {
171
+ trip: {
172
+ extraTripId: string;
173
+ lineId: string;
174
+ patternId: string;
175
+ routeId: string;
176
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
177
+ tripId: string;
178
+ };
179
+ position: {
180
+ latitude: number;
181
+ longitude: number;
182
+ bearing: number;
183
+ odometer: number;
184
+ speed: number;
185
+ };
186
+ timestamp: number;
187
+ vehicle: {
188
+ _id: string;
189
+ blockId: string;
190
+ driverId: string;
191
+ shiftId: string;
192
+ };
193
+ agencyId: string;
194
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
195
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
196
+ operationPlanId: string;
197
+ stopId: string;
198
+ trigger: {
199
+ activity: "NO_CHANGE" | "CHANGE";
200
+ door: "NO_CHANGE" | "CHANGE";
201
+ };
202
+ };
203
+ header: {
204
+ timestamp: number;
205
+ incrementality: "DIFFERENTIAL";
206
+ gtfsRealtimeVersion: "2.0";
207
+ };
208
+ }, {
209
+ vehicle: {
210
+ trip: {
211
+ extraTripId: string;
212
+ lineId: string;
213
+ patternId: string;
214
+ routeId: string;
215
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
216
+ tripId: string;
217
+ };
218
+ position: {
219
+ latitude: number;
220
+ longitude: number;
221
+ bearing: number;
222
+ odometer: number;
223
+ speed: number;
224
+ };
225
+ timestamp: number;
226
+ vehicle: {
227
+ _id: string;
228
+ blockId: string;
229
+ driverId: string;
230
+ shiftId: string;
231
+ };
232
+ agencyId: string;
233
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
234
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
235
+ operationPlanId: string;
236
+ stopId: string;
237
+ trigger: {
238
+ activity: "NO_CHANGE" | "CHANGE";
239
+ door: "NO_CHANGE" | "CHANGE";
240
+ };
241
+ };
242
+ header: {
243
+ timestamp: number;
244
+ incrementality: "DIFFERENTIAL";
245
+ gtfsRealtimeVersion: "2.0";
246
+ };
247
+ }>;
248
+ version: import("zod").ZodLiteral<"cmet-v1">;
249
+ }, "strip", import("zod").ZodTypeAny, {
250
+ _id: string;
251
+ created_at: number & {
252
+ __brand: "UnixTimestamp";
253
+ };
254
+ agency_id: string;
255
+ received_at: number & {
256
+ __brand: "UnixTimestamp";
257
+ };
258
+ payload: {
259
+ vehicle: {
260
+ trip: {
261
+ extraTripId: string;
262
+ lineId: string;
263
+ patternId: string;
264
+ routeId: string;
265
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
266
+ tripId: string;
267
+ };
268
+ position: {
269
+ latitude: number;
270
+ longitude: number;
271
+ bearing: number;
272
+ odometer: number;
273
+ speed: number;
274
+ };
275
+ timestamp: number;
276
+ vehicle: {
277
+ _id: string;
278
+ blockId: string;
279
+ driverId: string;
280
+ shiftId: string;
281
+ };
282
+ agencyId: string;
283
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
284
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
285
+ operationPlanId: string;
286
+ stopId: string;
287
+ trigger: {
288
+ activity: "NO_CHANGE" | "CHANGE";
289
+ door: "NO_CHANGE" | "CHANGE";
290
+ };
291
+ };
292
+ header: {
293
+ timestamp: number;
294
+ incrementality: "DIFFERENTIAL";
295
+ gtfsRealtimeVersion: "2.0";
296
+ };
297
+ };
298
+ entity_id: string;
299
+ version: "cmet-v1";
300
+ }, {
301
+ _id: string;
302
+ created_at: number;
303
+ agency_id: string;
304
+ received_at: number;
305
+ payload: {
306
+ vehicle: {
307
+ trip: {
308
+ extraTripId: string;
309
+ lineId: string;
310
+ patternId: string;
311
+ routeId: string;
312
+ scheduleRelationship: "SCHEDULED" | "NOT_SCHEDULED";
313
+ tripId: string;
314
+ };
315
+ position: {
316
+ latitude: number;
317
+ longitude: number;
318
+ bearing: number;
319
+ odometer: number;
320
+ speed: number;
321
+ };
322
+ timestamp: number;
323
+ vehicle: {
324
+ _id: string;
325
+ blockId: string;
326
+ driverId: string;
327
+ shiftId: string;
328
+ };
329
+ agencyId: string;
330
+ currentStatus: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
331
+ occupancyStatus: "EMPTY" | "FULL" | "PARTIALLY_OCCUPIED";
332
+ operationPlanId: string;
333
+ stopId: string;
334
+ trigger: {
335
+ activity: "NO_CHANGE" | "CHANGE";
336
+ door: "NO_CHANGE" | "CHANGE";
337
+ };
338
+ };
339
+ header: {
340
+ timestamp: number;
341
+ incrementality: "DIFFERENTIAL";
342
+ gtfsRealtimeVersion: "2.0";
343
+ };
344
+ };
345
+ entity_id: string;
346
+ version: "cmet-v1";
347
+ }>, import("zod").ZodObject<{
348
+ _id: import("zod").ZodString;
349
+ agency_id: import("zod").ZodString;
350
+ created_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
351
+ entity_id: import("zod").ZodString;
352
+ received_at: import("zod").ZodEffects<import("zod").ZodNumber, import("@tmlmobilidade/types").UnixTimestamp, number>;
353
+ } & {
354
+ payload: import("zod").ZodObject<{
355
+ header: import("zod").ZodObject<{
356
+ feed_version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
357
+ gtfs_realtime_version: import("zod").ZodString;
358
+ incrementality: import("zod").ZodLiteral<"FULL_DATASET">;
359
+ timestamp: import("zod").ZodNumber;
360
+ }, "strip", import("zod").ZodTypeAny, {
361
+ timestamp: number;
362
+ gtfs_realtime_version: string;
363
+ incrementality: "FULL_DATASET";
364
+ feed_version?: string | null | undefined;
365
+ }, {
366
+ timestamp: number;
367
+ gtfs_realtime_version: string;
368
+ incrementality: "FULL_DATASET";
369
+ feed_version?: string | null | undefined;
370
+ }>;
371
+ vehicle: import("zod").ZodObject<{
372
+ current_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>>>;
373
+ occupancy_status: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<["EMPTY", "MANY_SEATS_AVAILABLE", "FEW_SEATS_AVAILABLE", "STANDING_ROOM_ONLY", "CRUSHED_STANDING_ROOM_ONLY", "FULL", "NOT_ACCEPTING_PASSENGERS", "NO_DATA_AVAILABLE", "NOT_BOARDABLE"]>>>;
374
+ position: import("zod").ZodObject<{
375
+ bearing: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
376
+ latitude: import("zod").ZodNumber;
377
+ longitude: import("zod").ZodNumber;
378
+ speed: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
379
+ }, "strip", import("zod").ZodTypeAny, {
380
+ latitude: number;
381
+ longitude: number;
382
+ bearing?: number | null | undefined;
383
+ speed?: number | null | undefined;
384
+ }, {
385
+ latitude: number;
386
+ longitude: number;
387
+ bearing?: number | null | undefined;
388
+ speed?: number | null | undefined;
389
+ }>;
390
+ stop_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
391
+ timestamp: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNumber>>;
392
+ trip: import("zod").ZodObject<{
393
+ trip_id: import("zod").ZodString;
394
+ }, "strip", import("zod").ZodTypeAny, {
395
+ trip_id: string;
396
+ }, {
397
+ trip_id: string;
398
+ }>;
399
+ vehicle: import("zod").ZodObject<{
400
+ id: import("zod").ZodString;
401
+ label: import("zod").ZodString;
402
+ }, "strip", import("zod").ZodTypeAny, {
403
+ id: string;
404
+ label: string;
405
+ }, {
406
+ id: string;
407
+ label: string;
408
+ }>;
409
+ }, "strip", import("zod").ZodTypeAny, {
410
+ trip: {
411
+ trip_id: string;
412
+ };
413
+ position: {
414
+ latitude: number;
415
+ longitude: number;
416
+ bearing?: number | null | undefined;
417
+ speed?: number | null | undefined;
418
+ };
419
+ vehicle: {
420
+ id: string;
421
+ label: string;
422
+ };
423
+ stop_id?: string | null | undefined;
424
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
425
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
426
+ timestamp?: number | null | undefined;
427
+ }, {
428
+ trip: {
429
+ trip_id: string;
430
+ };
431
+ position: {
432
+ latitude: number;
433
+ longitude: number;
434
+ bearing?: number | null | undefined;
435
+ speed?: number | null | undefined;
436
+ };
437
+ vehicle: {
438
+ id: string;
439
+ label: string;
440
+ };
441
+ stop_id?: string | null | undefined;
442
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
443
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
444
+ timestamp?: number | null | undefined;
445
+ }>;
446
+ }, "strip", import("zod").ZodTypeAny, {
447
+ vehicle: {
448
+ trip: {
449
+ trip_id: string;
450
+ };
451
+ position: {
452
+ latitude: number;
453
+ longitude: number;
454
+ bearing?: number | null | undefined;
455
+ speed?: number | null | undefined;
456
+ };
457
+ vehicle: {
458
+ id: string;
459
+ label: string;
460
+ };
461
+ stop_id?: string | null | undefined;
462
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
463
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
464
+ timestamp?: number | null | undefined;
465
+ };
466
+ header: {
467
+ timestamp: number;
468
+ gtfs_realtime_version: string;
469
+ incrementality: "FULL_DATASET";
470
+ feed_version?: string | null | undefined;
471
+ };
472
+ }, {
473
+ vehicle: {
474
+ trip: {
475
+ trip_id: string;
476
+ };
477
+ position: {
478
+ latitude: number;
479
+ longitude: number;
480
+ bearing?: number | null | undefined;
481
+ speed?: number | null | undefined;
482
+ };
483
+ vehicle: {
484
+ id: string;
485
+ label: string;
486
+ };
487
+ stop_id?: string | null | undefined;
488
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
489
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
490
+ timestamp?: number | null | undefined;
491
+ };
492
+ header: {
493
+ timestamp: number;
494
+ gtfs_realtime_version: string;
495
+ incrementality: "FULL_DATASET";
496
+ feed_version?: string | null | undefined;
497
+ };
498
+ }>;
499
+ version: import("zod").ZodLiteral<"ttsl-v1">;
500
+ }, "strip", import("zod").ZodTypeAny, {
501
+ _id: string;
502
+ created_at: number & {
503
+ __brand: "UnixTimestamp";
504
+ };
505
+ agency_id: string;
506
+ received_at: number & {
507
+ __brand: "UnixTimestamp";
508
+ };
509
+ payload: {
510
+ vehicle: {
511
+ trip: {
512
+ trip_id: string;
513
+ };
514
+ position: {
515
+ latitude: number;
516
+ longitude: number;
517
+ bearing?: number | null | undefined;
518
+ speed?: number | null | undefined;
519
+ };
520
+ vehicle: {
521
+ id: string;
522
+ label: string;
523
+ };
524
+ stop_id?: string | null | undefined;
525
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
526
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
527
+ timestamp?: number | null | undefined;
528
+ };
529
+ header: {
530
+ timestamp: number;
531
+ gtfs_realtime_version: string;
532
+ incrementality: "FULL_DATASET";
533
+ feed_version?: string | null | undefined;
534
+ };
535
+ };
536
+ entity_id: string;
537
+ version: "ttsl-v1";
538
+ }, {
539
+ _id: string;
540
+ created_at: number;
541
+ agency_id: string;
542
+ received_at: number;
543
+ payload: {
544
+ vehicle: {
545
+ trip: {
546
+ trip_id: string;
547
+ };
548
+ position: {
549
+ latitude: number;
550
+ longitude: number;
551
+ bearing?: number | null | undefined;
552
+ speed?: number | null | undefined;
553
+ };
554
+ vehicle: {
555
+ id: string;
556
+ label: string;
557
+ };
558
+ stop_id?: string | null | undefined;
559
+ occupancy_status?: "EMPTY" | "MANY_SEATS_AVAILABLE" | "FEW_SEATS_AVAILABLE" | "STANDING_ROOM_ONLY" | "CRUSHED_STANDING_ROOM_ONLY" | "FULL" | "NOT_ACCEPTING_PASSENGERS" | "NO_DATA_AVAILABLE" | "NOT_BOARDABLE" | null | undefined;
560
+ current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
561
+ timestamp?: number | null | undefined;
562
+ };
563
+ header: {
564
+ timestamp: number;
565
+ gtfs_realtime_version: string;
566
+ incrementality: "FULL_DATASET";
567
+ feed_version?: string | null | undefined;
568
+ };
569
+ };
570
+ entity_id: string;
571
+ version: "ttsl-v1";
572
+ }>]>;
573
+ protected updateSchema: null;
574
+ /**
575
+ * Returns the singleton instance of the subclass.
576
+ */
577
+ static getInstance(): Promise<RawVehicleEventsNewClass>;
578
+ protected connectToClient(): Promise<import("mongodb").MongoClient>;
579
+ }
580
+ export declare const rawVehicleEventsNew: RawVehicleEventsNewClass;
581
+ export {};
@@ -0,0 +1,45 @@
1
+ /* * */
2
+ import { PCGIRawClient } from '../../clients/pcgi-raw.js';
3
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
4
+ import { RawVehicleEventSchema } from '@tmlmobilidade/types';
5
+ import { asyncSingletonProxy } from '@tmlmobilidade/utils';
6
+ /* * */
7
+ class RawVehicleEventsNewClass extends MongoInterfaceTemplate {
8
+ //
9
+ static _instance = null;
10
+ collectionName = 'raw_vehicle_events';
11
+ databaseName = 'raw';
12
+ indexDescription = [
13
+ { key: { created_at: 1 } },
14
+ { key: { agency_id: 1, created_at: 1 } },
15
+ // eslint-disable-next-line perfectionist/sort-objects
16
+ { key: { version: 1, created_at: 1 } },
17
+ ];
18
+ createSchema = RawVehicleEventSchema;
19
+ updateSchema = null;
20
+ /**
21
+ * Returns the singleton instance of the subclass.
22
+ */
23
+ static async getInstance() {
24
+ // If no instance exists, create one and store the promise.
25
+ // This ensures that if multiple calls to getInstance() happen concurrently,
26
+ // they will all await the same initialization process.
27
+ if (!this._instance) {
28
+ this._instance = (async () => {
29
+ const instance = new RawVehicleEventsNewClass();
30
+ // This behaves like the constructor,
31
+ // but allows for async initialization.
32
+ await instance.init();
33
+ return instance;
34
+ })();
35
+ }
36
+ // Await the instance if it's still initializing,
37
+ // or return it immediately if ready.
38
+ return await this._instance;
39
+ }
40
+ connectToClient() {
41
+ return PCGIRawClient.getClient();
42
+ }
43
+ }
44
+ /* * */
45
+ export const rawVehicleEventsNew = asyncSingletonProxy(RawVehicleEventsNewClass);
@@ -0,0 +1,16 @@
1
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
2
+ declare class PCGIValidationsClass extends MongoInterfaceTemplate<any, any, Partial<any>> {
3
+ private static _instance;
4
+ protected readonly collectionName = "validationEntity";
5
+ protected readonly databaseName = "ValidationsManagement";
6
+ protected readonly indexDescription = false;
7
+ protected createSchema: any;
8
+ protected updateSchema: any;
9
+ /**
10
+ * Returns the singleton instance of the subclass.
11
+ */
12
+ static getInstance(): Promise<PCGIValidationsClass>;
13
+ protected connectToClient(): Promise<import("mongodb").MongoClient>;
14
+ }
15
+ export declare const pcgiValidations: PCGIValidationsClass;
16
+ export {};
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { PCGIRawClient } from '../../clients/pcgi-raw.js';
3
+ import { MongoInterfaceTemplate } from '../../templates/mongodb.js';
4
+ import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class PCGIValidationsClass extends MongoInterfaceTemplate {
7
+ //
8
+ static _instance = null;
9
+ collectionName = 'validationEntity';
10
+ databaseName = 'ValidationsManagement';
11
+ indexDescription = false;
12
+ createSchema = null;
13
+ updateSchema = null;
14
+ /**
15
+ * Returns the singleton instance of the subclass.
16
+ */
17
+ static async getInstance() {
18
+ // If no instance exists, create one and store the promise.
19
+ // This ensures that if multiple calls to getInstance() happen concurrently,
20
+ // they will all await the same initialization process.
21
+ if (!this._instance) {
22
+ this._instance = (async () => {
23
+ const instance = new PCGIValidationsClass();
24
+ // This behaves like the constructor,
25
+ // but allows for async initialization.
26
+ await instance.init();
27
+ return instance;
28
+ })();
29
+ }
30
+ // Await the instance if it's still initializing,
31
+ // or return it immediately if ready.
32
+ return await this._instance;
33
+ }
34
+ connectToClient() {
35
+ return PCGIRawClient.getClient();
36
+ }
37
+ }
38
+ /* * */
39
+ export const pcgiValidations = asyncSingletonProxy(PCGIValidationsClass);
@@ -1,2 +1,3 @@
1
+ export * from './apex/index.js';
1
2
  export * from './simplified-apex/index.js';
2
3
  export * from './vehicle-events/index.js';
@@ -1,2 +1,3 @@
1
+ export * from './apex/index.js';
1
2
  export * from './simplified-apex/index.js';
2
3
  export * from './vehicle-events/index.js';
@@ -570,7 +570,7 @@ declare class RawVehicleEventsNewClass extends MongoInterfaceTemplate<RawVehicle
570
570
  entity_id: string;
571
571
  version: "ttsl-v1";
572
572
  }>]>;
573
- protected updateSchema: null;
573
+ protected updateSchema: any;
574
574
  /**
575
575
  * Returns the singleton instance of the subclass.
576
576
  */
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
  export declare abstract class MongoInterfaceTemplate<T extends Document, TCreate, TUpdate> {
5
5
  protected readonly abstract collectionName: string;
6
6
  protected readonly abstract databaseName: string;
7
- protected readonly abstract indexDescription: SimplifiedMongoIndex<T>[];
7
+ protected readonly abstract indexDescription: false | SimplifiedMongoIndex<T>[];
8
8
  protected abstract createSchema: null | z.ZodSchema;
9
9
  protected abstract updateSchema: null | z.ZodSchema;
10
10
  private client;
@@ -193,6 +193,11 @@ export class MongoInterfaceTemplate {
193
193
  */
194
194
  async syncIndexes() {
195
195
  try {
196
+ if (this.indexDescription === false) {
197
+ Logger.info(`MONGODB [${this.collectionName}]: Skipping index synchronization.`);
198
+ return;
199
+ }
200
+ // Start index synchronization process
196
201
  Logger.info(`MONGODB [${this.collectionName}]: Synchronizing indexes...`);
197
202
  // Normalize already applied and new indexes
198
203
  // and filter the default _id index.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/databases",
3
- "version": "20260325.1459.50",
3
+ "version": "20260325.2343.38",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"