@tmlmobilidade/interfaces 20250911.1325.18 → 20250911.1428.53

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.
@@ -13,11 +13,9 @@ declare class AgenciesClass extends MongoCollectionClass<Agency, CreateAgencyDto
13
13
  created_at: number & {
14
14
  __brand: "UnixTimestamp";
15
15
  };
16
- created_by: string;
17
16
  updated_at: number & {
18
17
  __brand: "UnixTimestamp";
19
18
  };
20
- updated_by: string;
21
19
  contact_emails_pta: string[];
22
20
  contact_emails_pto: string[];
23
21
  fare_url: string;
@@ -34,17 +32,17 @@ declare class AgenciesClass extends MongoCollectionClass<Agency, CreateAgencyDto
34
32
  short_name: string;
35
33
  timezone: string;
36
34
  website_url: string;
35
+ created_by?: string | undefined;
36
+ updated_by?: string | undefined;
37
37
  }> | null>;
38
38
  updateByCode(code: string, fields: Partial<Agency>): Promise<import("mongodb").UpdateResult<{
39
39
  _id: string;
40
40
  created_at: number & {
41
41
  __brand: "UnixTimestamp";
42
42
  };
43
- created_by: string;
44
43
  updated_at: number & {
45
44
  __brand: "UnixTimestamp";
46
45
  };
47
- updated_by: string;
48
46
  contact_emails_pta: string[];
49
47
  contact_emails_pto: string[];
50
48
  fare_url: string;
@@ -61,6 +59,8 @@ declare class AgenciesClass extends MongoCollectionClass<Agency, CreateAgencyDto
61
59
  short_name: string;
62
60
  timezone: string;
63
61
  website_url: string;
62
+ created_by?: string | undefined;
63
+ updated_by?: string | undefined;
64
64
  }>>;
65
65
  protected getCollectionIndexes(): IndexDescription[];
66
66
  protected getCollectionName(): string;
@@ -17,7 +17,6 @@ declare class AlertsRealtimeClass extends MongoCollectionClass<Alert, CreateAler
17
17
  updated_at: number & {
18
18
  __brand: "UnixTimestamp";
19
19
  };
20
- updated_by: string;
21
20
  type: "PLANNED" | "REALTIME";
22
21
  municipality_ids: string[];
23
22
  active_period_start_date: number & {
@@ -37,6 +36,7 @@ declare class AlertsRealtimeClass extends MongoCollectionClass<Alert, CreateAler
37
36
  parent_id: string;
38
37
  }[];
39
38
  title: string;
39
+ updated_by?: string | undefined;
40
40
  active_period_end_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
41
41
  coordinates?: [number, number] | null | undefined;
42
42
  file_id?: string | null | undefined;
@@ -52,7 +52,6 @@ declare class AlertsRealtimeClass extends MongoCollectionClass<Alert, CreateAler
52
52
  updated_at: number & {
53
53
  __brand: "UnixTimestamp";
54
54
  };
55
- updated_by: string;
56
55
  type: "PLANNED" | "REALTIME";
57
56
  municipality_ids: string[];
58
57
  active_period_start_date: number & {
@@ -72,6 +71,7 @@ declare class AlertsRealtimeClass extends MongoCollectionClass<Alert, CreateAler
72
71
  parent_id: string;
73
72
  }[];
74
73
  title: string;
74
+ updated_by?: string | undefined;
75
75
  active_period_end_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
76
76
  coordinates?: [number, number] | null | undefined;
77
77
  file_id?: string | null | undefined;
@@ -17,7 +17,6 @@ declare class AlertsClass extends MongoCollectionClass<Alert, CreateAlertDto, Up
17
17
  updated_at: number & {
18
18
  __brand: "UnixTimestamp";
19
19
  };
20
- updated_by: string;
21
20
  type: "PLANNED" | "REALTIME";
22
21
  municipality_ids: string[];
23
22
  active_period_start_date: number & {
@@ -37,6 +36,7 @@ declare class AlertsClass extends MongoCollectionClass<Alert, CreateAlertDto, Up
37
36
  parent_id: string;
38
37
  }[];
39
38
  title: string;
39
+ updated_by?: string | undefined;
40
40
  active_period_end_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
41
41
  coordinates?: [number, number] | null | undefined;
42
42
  file_id?: string | null | undefined;
@@ -52,7 +52,6 @@ declare class AlertsClass extends MongoCollectionClass<Alert, CreateAlertDto, Up
52
52
  updated_at: number & {
53
53
  __brand: "UnixTimestamp";
54
54
  };
55
- updated_by: string;
56
55
  type: "PLANNED" | "REALTIME";
57
56
  municipality_ids: string[];
58
57
  active_period_start_date: number & {
@@ -72,6 +71,7 @@ declare class AlertsClass extends MongoCollectionClass<Alert, CreateAlertDto, Up
72
71
  parent_id: string;
73
72
  }[];
74
73
  title: string;
74
+ updated_by?: string | undefined;
75
75
  active_period_end_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
76
76
  coordinates?: [number, number] | null | undefined;
77
77
  file_id?: string | null | undefined;
@@ -19,17 +19,17 @@ declare class RolesClass extends MongoCollectionClass<Role, CreateRoleDto, Updat
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  name: string;
28
26
  permissions: {
29
27
  scope: string;
30
28
  action: string;
31
29
  resource?: Record<string, any> | null | undefined;
32
30
  }[];
31
+ created_by?: string | undefined;
32
+ updated_by?: string | undefined;
33
33
  }> | null>;
34
34
  protected getCollectionIndexes(): IndexDescription[];
35
35
  protected getCollectionName(): string;
@@ -39,8 +39,8 @@ declare class UsersClass extends MongoCollectionClass<User, CreateUserDto, Updat
39
39
  updated_at: number & {
40
40
  __brand: "UnixTimestamp";
41
41
  };
42
- created_by: string;
43
- updated_by: string;
42
+ created_by?: string | undefined | undefined;
43
+ updated_by?: string | undefined | undefined;
44
44
  phone?: string | null | undefined | undefined;
45
45
  email: string;
46
46
  permissions: import("@tmlmobilidade/types").Permission<unknown>[];
@@ -70,8 +70,8 @@ declare class UsersClass extends MongoCollectionClass<User, CreateUserDto, Updat
70
70
  updated_at: number & {
71
71
  __brand: "UnixTimestamp";
72
72
  };
73
- created_by: string;
74
- updated_by: string;
73
+ created_by?: string | undefined | undefined;
74
+ updated_by?: string | undefined | undefined;
75
75
  phone?: string | null | undefined | undefined;
76
76
  email: string;
77
77
  permissions: import("@tmlmobilidade/types").Permission<unknown>[];
@@ -19,16 +19,16 @@ declare class VerificationTokensClass extends MongoCollectionClass<VerificationT
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  user_id: string;
28
26
  expires_at: number & {
29
27
  __brand: "UnixTimestamp";
30
28
  };
31
29
  token: string;
30
+ created_by?: string | undefined;
31
+ updated_by?: string | undefined;
32
32
  }> | null>;
33
33
  protected getCollectionIndexes(): IndexDescription[];
34
34
  protected getCollectionName(): string;
@@ -19,11 +19,9 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  file_id: string;
28
26
  feeder_status: "waiting" | "processing" | "complete" | "error";
29
27
  gtfs_agency: {
@@ -48,6 +46,8 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
48
46
  feed_version?: string | null | undefined;
49
47
  };
50
48
  notification_sent: boolean;
49
+ created_by?: string | undefined;
50
+ updated_by?: string | undefined;
51
51
  summary?: {
52
52
  messages: {
53
53
  message: string;
@@ -19,13 +19,13 @@ declare class OrganizationsClass extends MongoCollectionClass<Organization, Crea
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  code: string;
28
26
  name: string;
27
+ created_by?: string | undefined;
28
+ updated_by?: string | undefined;
29
29
  }> | null>;
30
30
  /**
31
31
  * Updates an organization by its code
@@ -39,13 +39,13 @@ declare class OrganizationsClass extends MongoCollectionClass<Organization, Crea
39
39
  created_at: number & {
40
40
  __brand: "UnixTimestamp";
41
41
  };
42
- created_by: string;
43
42
  updated_at: number & {
44
43
  __brand: "UnixTimestamp";
45
44
  };
46
- updated_by: string;
47
45
  code: string;
48
46
  name: string;
47
+ created_by?: string | undefined;
48
+ updated_by?: string | undefined;
49
49
  }>>;
50
50
  protected getCollectionIndexes(): IndexDescription[];
51
51
  protected getCollectionName(): string;
@@ -19,11 +19,9 @@ declare class PlansClass extends MongoCollectionClass<Plan, CreatePlanDto, Updat
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  gtfs_agency: {
28
26
  agency_id: string;
29
27
  agency_name: string;
@@ -57,6 +55,8 @@ declare class PlansClass extends MongoCollectionClass<Plan, CreatePlanDto, Updat
57
55
  operation_plan_id: string | null;
58
56
  };
59
57
  status_merger: "waiting" | "processing" | "complete" | "error";
58
+ created_by?: string | undefined;
59
+ updated_by?: string | undefined;
60
60
  }>[]>;
61
61
  protected getCollectionIndexes(): IndexDescription[];
62
62
  protected getCollectionName(): string;
@@ -19,11 +19,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
- created_by: string;
23
22
  updated_at: number & {
24
23
  __brand: "UnixTimestamp";
25
24
  };
26
- updated_by: string;
27
25
  agency_id: string;
28
26
  line_id: number;
29
27
  analysis: {
@@ -156,6 +154,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
156
154
  };
157
155
  system_status: "waiting" | "processing" | "complete" | "error";
158
156
  vehicle_ids: number[];
157
+ created_by?: string | undefined;
158
+ updated_by?: string | undefined;
159
159
  }>[]>;
160
160
  /**
161
161
  * Finds ride documents by Line ID.
@@ -168,11 +168,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
168
168
  created_at: number & {
169
169
  __brand: "UnixTimestamp";
170
170
  };
171
- created_by: string;
172
171
  updated_at: number & {
173
172
  __brand: "UnixTimestamp";
174
173
  };
175
- updated_by: string;
176
174
  agency_id: string;
177
175
  line_id: number;
178
176
  analysis: {
@@ -305,6 +303,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
305
303
  };
306
304
  system_status: "waiting" | "processing" | "complete" | "error";
307
305
  vehicle_ids: number[];
306
+ created_by?: string | undefined;
307
+ updated_by?: string | undefined;
308
308
  }>[]>;
309
309
  /**
310
310
  * Finds ride documents by Pattern ID.
@@ -317,11 +317,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
317
317
  created_at: number & {
318
318
  __brand: "UnixTimestamp";
319
319
  };
320
- created_by: string;
321
320
  updated_at: number & {
322
321
  __brand: "UnixTimestamp";
323
322
  };
324
- updated_by: string;
325
323
  agency_id: string;
326
324
  line_id: number;
327
325
  analysis: {
@@ -454,6 +452,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
454
452
  };
455
453
  system_status: "waiting" | "processing" | "complete" | "error";
456
454
  vehicle_ids: number[];
455
+ created_by?: string | undefined;
456
+ updated_by?: string | undefined;
457
457
  }>[]>;
458
458
  /**
459
459
  * Finds ride documents by Plan ID.
@@ -466,11 +466,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
466
466
  created_at: number & {
467
467
  __brand: "UnixTimestamp";
468
468
  };
469
- created_by: string;
470
469
  updated_at: number & {
471
470
  __brand: "UnixTimestamp";
472
471
  };
473
- updated_by: string;
474
472
  agency_id: string;
475
473
  line_id: number;
476
474
  analysis: {
@@ -603,6 +601,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
603
601
  };
604
602
  system_status: "waiting" | "processing" | "complete" | "error";
605
603
  vehicle_ids: number[];
604
+ created_by?: string | undefined;
605
+ updated_by?: string | undefined;
606
606
  }>[]>;
607
607
  /**
608
608
  * Finds ride documents by Route ID.
@@ -615,11 +615,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
615
615
  created_at: number & {
616
616
  __brand: "UnixTimestamp";
617
617
  };
618
- created_by: string;
619
618
  updated_at: number & {
620
619
  __brand: "UnixTimestamp";
621
620
  };
622
- updated_by: string;
623
621
  agency_id: string;
624
622
  line_id: number;
625
623
  analysis: {
@@ -752,6 +750,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
752
750
  };
753
751
  system_status: "waiting" | "processing" | "complete" | "error";
754
752
  vehicle_ids: number[];
753
+ created_by?: string | undefined;
754
+ updated_by?: string | undefined;
755
755
  }>[]>;
756
756
  /**
757
757
  * Finds ride documents by Trip ID.
@@ -764,11 +764,9 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
764
764
  created_at: number & {
765
765
  __brand: "UnixTimestamp";
766
766
  };
767
- created_by: string;
768
767
  updated_at: number & {
769
768
  __brand: "UnixTimestamp";
770
769
  };
771
- updated_by: string;
772
770
  agency_id: string;
773
771
  line_id: number;
774
772
  analysis: {
@@ -901,6 +899,8 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
901
899
  };
902
900
  system_status: "waiting" | "processing" | "complete" | "error";
903
901
  vehicle_ids: number[];
902
+ created_by?: string | undefined;
903
+ updated_by?: string | undefined;
904
904
  }>[]>;
905
905
  protected getCollectionIndexes(): IndexDescription[];
906
906
  protected getCollectionName(): string;
@@ -22,11 +22,9 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
22
22
  created_at: number & {
23
23
  __brand: "UnixTimestamp";
24
24
  };
25
- created_by: string;
26
25
  updated_at: number & {
27
26
  __brand: "UnixTimestamp";
28
27
  };
29
- updated_by: string;
30
28
  name: string;
31
29
  has_bench: "unknown" | "yes" | "no";
32
30
  has_network_map: "unknown" | "yes" | "no";
@@ -40,13 +38,13 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
40
38
  created_at: number & {
41
39
  __brand: "UnixTimestamp";
42
40
  };
43
- created_by: string;
44
41
  updated_at: number & {
45
42
  __brand: "UnixTimestamp";
46
43
  };
47
- updated_by: string;
48
44
  message: string;
49
45
  type: "note";
46
+ created_by?: string | undefined;
47
+ updated_by?: string | undefined;
50
48
  } | {
51
49
  _id: string;
52
50
  created_at: number & {
@@ -64,14 +62,14 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
64
62
  created_at: number & {
65
63
  __brand: "UnixTimestamp";
66
64
  };
67
- created_by: string;
68
65
  updated_at: number & {
69
66
  __brand: "UnixTimestamp";
70
67
  };
71
- updated_by: string;
72
68
  type: "statusChanged";
73
69
  curr_status: string;
74
70
  prev_status: string;
71
+ created_by?: string | undefined;
72
+ updated_by?: string | undefined;
75
73
  })[];
76
74
  is_archived: boolean;
77
75
  jurisdiction: "unknown" | "ip" | "municipality" | "other";
@@ -90,6 +88,8 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
90
88
  has_mupi: "unknown" | "yes" | "no";
91
89
  file_ids: string[];
92
90
  image_ids: string[];
91
+ created_by?: string | undefined;
92
+ updated_by?: string | undefined;
93
93
  short_name?: string | null | undefined;
94
94
  parish_id?: string | null | undefined;
95
95
  shelter_code?: string | null | undefined;
@@ -119,11 +119,9 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
119
119
  created_at: number & {
120
120
  __brand: "UnixTimestamp";
121
121
  };
122
- created_by: string;
123
122
  updated_at: number & {
124
123
  __brand: "UnixTimestamp";
125
124
  };
126
- updated_by: string;
127
125
  name: string;
128
126
  has_bench: "unknown" | "yes" | "no";
129
127
  has_network_map: "unknown" | "yes" | "no";
@@ -137,13 +135,13 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
137
135
  created_at: number & {
138
136
  __brand: "UnixTimestamp";
139
137
  };
140
- created_by: string;
141
138
  updated_at: number & {
142
139
  __brand: "UnixTimestamp";
143
140
  };
144
- updated_by: string;
145
141
  message: string;
146
142
  type: "note";
143
+ created_by?: string | undefined;
144
+ updated_by?: string | undefined;
147
145
  } | {
148
146
  _id: string;
149
147
  created_at: number & {
@@ -161,14 +159,14 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
161
159
  created_at: number & {
162
160
  __brand: "UnixTimestamp";
163
161
  };
164
- created_by: string;
165
162
  updated_at: number & {
166
163
  __brand: "UnixTimestamp";
167
164
  };
168
- updated_by: string;
169
165
  type: "statusChanged";
170
166
  curr_status: string;
171
167
  prev_status: string;
168
+ created_by?: string | undefined;
169
+ updated_by?: string | undefined;
172
170
  })[];
173
171
  is_archived: boolean;
174
172
  jurisdiction: "unknown" | "ip" | "municipality" | "other";
@@ -187,6 +185,8 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
187
185
  has_mupi: "unknown" | "yes" | "no";
188
186
  file_ids: string[];
189
187
  image_ids: string[];
188
+ created_by?: string | undefined;
189
+ updated_by?: string | undefined;
190
190
  short_name?: string | null | undefined;
191
191
  parish_id?: string | null | undefined;
192
192
  shelter_code?: string | null | undefined;
@@ -112,7 +112,9 @@ export declare abstract class MongoCollectionClass<T extends Document, TCreate,
112
112
  insertOne<TReturnDocument extends boolean = true>(doc: TCreate & {
113
113
  _id?: string;
114
114
  created_at?: UnixTimestamp;
115
+ created_by?: string;
115
116
  updated_at?: UnixTimestamp;
117
+ updated_by?: string;
116
118
  }, { options, unsafe }?: {
117
119
  options?: InsertOneOptions & {
118
120
  returnResult?: TReturnDocument;
@@ -136,7 +138,10 @@ export declare abstract class MongoCollectionClass<T extends Document, TCreate,
136
138
  * @param options - The options for the update operation
137
139
  * @returns A promise that resolves to the result of the update operation
138
140
  */
139
- updateMany<TReturnDocument extends boolean = true>(filter: Filter<T>, updateFields: TUpdate, options?: UpdateOptions & {
141
+ updateMany<TReturnDocument extends boolean = true>(filter: Filter<T>, updateFields: TUpdate & {
142
+ updated_at?: UnixTimestamp;
143
+ updated_by?: string;
144
+ }, options?: UpdateOptions & {
140
145
  returnResults?: TReturnDocument;
141
146
  }): Promise<TReturnDocument extends true ? WithId<T>[] : UpdateResult<T>>;
142
147
  /**
@@ -181,7 +181,9 @@ export class MongoCollectionClass {
181
181
  ...doc,
182
182
  _id: doc._id || generateRandomString({ length: 5 }),
183
183
  created_at: doc.created_at || Dates.now('utc').unix_timestamp,
184
+ created_by: doc.created_by || 'system',
184
185
  updated_at: doc.updated_at || Dates.now('utc').unix_timestamp,
186
+ updated_by: doc.updated_by || 'system',
185
187
  };
186
188
  if (!doc._id) {
187
189
  while (await this.findById(newDocument._id)) {
@@ -231,7 +233,11 @@ export class MongoCollectionClass {
231
233
  * @returns A promise that resolves to the result of the update operation
232
234
  */
233
235
  async updateMany(filter, updateFields, options) {
234
- let parsedUpdateFields = updateFields;
236
+ let parsedUpdateFields = {
237
+ ...updateFields,
238
+ updated_at: updateFields.updated_at || Dates.now('utc').unix_timestamp,
239
+ updated_by: updateFields.updated_by || 'system',
240
+ };
235
241
  if (this.updateSchema) {
236
242
  try {
237
243
  parsedUpdateFields = this.updateSchema.parse(updateFields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20250911.1325.18",
3
+ "version": "20250911.1428.53",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",