@tmlmobilidade/types 20250911.1034.51 → 20250911.1425.9

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 (54) hide show
  1. package/dist/src/_common/comment.d.ts +20 -20
  2. package/dist/src/_common/document.d.ts +4 -4
  3. package/dist/src/_common/document.js +2 -2
  4. package/dist/src/_common/operational-date.d.ts +1 -1
  5. package/dist/src/_common/operational-date.js +1 -2
  6. package/dist/src/_common/proposed-change.d.ts +18 -40
  7. package/dist/src/_common/proposed-change.js +5 -14
  8. package/dist/src/agency.d.ts +19 -30
  9. package/dist/src/agency.js +1 -1
  10. package/dist/src/alert.d.ts +37 -63
  11. package/dist/src/alert.js +8 -48
  12. package/dist/src/auth/login.js +2 -8
  13. package/dist/src/auth/role.d.ts +15 -22
  14. package/dist/src/auth/role.js +1 -1
  15. package/dist/src/auth/session.d.ts +22 -38
  16. package/dist/src/auth/session.js +3 -3
  17. package/dist/src/auth/user.d.ts +22 -41
  18. package/dist/src/auth/user.js +3 -3
  19. package/dist/src/auth/verification-token.d.ts +22 -34
  20. package/dist/src/auth/verification-token.js +3 -3
  21. package/dist/src/gtfs.d.ts +6 -17
  22. package/dist/src/organization.d.ts +10 -13
  23. package/dist/src/organization.js +1 -1
  24. package/dist/src/plans/gtfs-validation.d.ts +34 -72
  25. package/dist/src/plans/gtfs-validation.js +2 -6
  26. package/dist/src/plans/plan-controller.d.ts +3 -8
  27. package/dist/src/plans/plan-controller.js +2 -2
  28. package/dist/src/plans/plan.d.ts +43 -95
  29. package/dist/src/plans/plan.js +2 -6
  30. package/dist/src/rides/ride-audit.d.ts +27 -30
  31. package/dist/src/rides/ride-audit.js +1 -1
  32. package/dist/src/rides/ride-justification.d.ts +69 -72
  33. package/dist/src/rides/ride-justification.js +1 -1
  34. package/dist/src/rides/ride.d.ts +55 -106
  35. package/dist/src/rides/ride.js +8 -8
  36. package/dist/src/sams/sam-analysis.d.ts +5 -13
  37. package/dist/src/sams/sam-analysis.js +3 -3
  38. package/dist/src/sams/sam.d.ts +46 -97
  39. package/dist/src/sams/sam.js +4 -4
  40. package/dist/src/simplified-apex/simplified-apex-location.d.ts +18 -25
  41. package/dist/src/simplified-apex/simplified-apex-location.js +2 -2
  42. package/dist/src/simplified-apex/simplified-apex-on-board-refund.d.ts +18 -25
  43. package/dist/src/simplified-apex/simplified-apex-on-board-refund.js +2 -2
  44. package/dist/src/simplified-apex/simplified-apex-on-board-sale.d.ts +28 -38
  45. package/dist/src/simplified-apex/simplified-apex-on-board-sale.js +3 -3
  46. package/dist/src/simplified-apex/simplified-apex-validation.d.ts +18 -25
  47. package/dist/src/simplified-apex/simplified-apex-validation.js +2 -2
  48. package/dist/src/stop.d.ts +133 -151
  49. package/dist/src/stop.js +11 -74
  50. package/dist/src/vehicle-event.d.ts +9 -14
  51. package/dist/src/vehicle-event.js +2 -2
  52. package/dist/src/zone.d.ts +9 -12
  53. package/dist/src/zone.js +1 -1
  54. package/package.json +1 -1
@@ -1,18 +1,22 @@
1
- import { type UnixTimestamp } from './_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const causeSchema: z.ZodEnum<["ACCIDENT", "CONSTRUCTION", "DEMONSTRATION", "HOLIDAY", "MAINTENANCE", "MEDICAL_EMERGENCY", "OTHER_CAUSE", "POLICE_ACTIVITY", "STRIKE", "TECHNICAL_PROBLEM", "UNKNOWN_CAUSE", "WEATHER"]>;
4
3
  export declare const effectSchema: z.ZodEnum<["ACCESSIBILITY_ISSUE", "ADDITIONAL_SERVICE", "DETOUR", "MODIFIED_SERVICE", "NO_EFFECT", "NO_SERVICE", "OTHER_EFFECT", "REDUCED_SERVICE", "SIGNIFICANT_DELAYS", "STOP_MOVED", "UNKNOWN_EFFECT"]>;
5
4
  export declare const publishStatusSchema: z.ZodEnum<["PUBLISHED", "ARCHIVED", "DRAFT"]>;
6
5
  export declare const alertTypeSchema: z.ZodEnum<["PLANNED", "REALTIME"]>;
7
6
  export declare const referenceTypeSchema: z.ZodEnum<["LINE", "STOP", "AGENCY", "TRIP"]>;
7
+ export type Cause = z.infer<typeof causeSchema>;
8
+ export type Effect = z.infer<typeof effectSchema>;
9
+ export type PublishStatus = z.infer<typeof publishStatusSchema>;
10
+ export type AlertType = z.infer<typeof alertTypeSchema>;
11
+ export type ReferenceType = z.infer<typeof referenceTypeSchema>;
8
12
  export declare const AlertSchema: z.ZodObject<{
9
13
  _id: z.ZodString;
10
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
11
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
12
- updated_by: z.ZodDefault<z.ZodString>;
14
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
15
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
16
+ updated_by: z.ZodOptional<z.ZodString>;
13
17
  } & {
14
- active_period_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>;
15
- active_period_start_date: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
18
+ active_period_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>;
19
+ active_period_start_date: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
16
20
  cause: z.ZodEnum<["ACCIDENT", "CONSTRUCTION", "DEMONSTRATION", "HOLIDAY", "MAINTENANCE", "MEDICAL_EMERGENCY", "OTHER_CAUSE", "POLICE_ACTIVITY", "STRIKE", "TECHNICAL_PROBLEM", "UNKNOWN_CAUSE", "WEATHER"]>;
17
21
  coordinates: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
18
22
  created_by: z.ZodString;
@@ -22,8 +26,8 @@ export declare const AlertSchema: z.ZodObject<{
22
26
  info_url: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
23
27
  modified_by: z.ZodString;
24
28
  municipality_ids: z.ZodArray<z.ZodString, "many">;
25
- publish_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>;
26
- publish_start_date: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
29
+ publish_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>;
30
+ publish_start_date: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
27
31
  publish_status: z.ZodEnum<["PUBLISHED", "ARCHIVED", "DRAFT"]>;
28
32
  reference_type: z.ZodEnum<["LINE", "STOP", "AGENCY", "TRIP"]>;
29
33
  references: z.ZodArray<z.ZodObject<{
@@ -47,7 +51,6 @@ export declare const AlertSchema: z.ZodObject<{
47
51
  updated_at: number & {
48
52
  __brand: "UnixTimestamp";
49
53
  };
50
- updated_by: string;
51
54
  type: "PLANNED" | "REALTIME";
52
55
  municipality_ids: string[];
53
56
  active_period_start_date: number & {
@@ -67,11 +70,12 @@ export declare const AlertSchema: z.ZodObject<{
67
70
  parent_id: string;
68
71
  }[];
69
72
  title: string;
70
- active_period_end_date?: UnixTimestamp | null | undefined;
73
+ updated_by?: string | undefined;
74
+ active_period_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
71
75
  coordinates?: [number, number] | null | undefined;
72
76
  file_id?: string | null | undefined;
73
77
  info_url?: string | undefined;
74
- publish_end_date?: UnixTimestamp | null | undefined;
78
+ publish_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
75
79
  }, {
76
80
  _id: string;
77
81
  created_at: number;
@@ -101,12 +105,12 @@ export declare const AlertSchema: z.ZodObject<{
101
105
  }>;
102
106
  export declare const CreateAlertSchema: z.ZodObject<Omit<{
103
107
  _id: z.ZodString;
104
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
105
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
106
- updated_by: z.ZodDefault<z.ZodString>;
108
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
109
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
110
+ updated_by: z.ZodOptional<z.ZodString>;
107
111
  } & {
108
- active_period_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>;
109
- active_period_start_date: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
112
+ active_period_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>;
113
+ active_period_start_date: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
110
114
  cause: z.ZodEnum<["ACCIDENT", "CONSTRUCTION", "DEMONSTRATION", "HOLIDAY", "MAINTENANCE", "MEDICAL_EMERGENCY", "OTHER_CAUSE", "POLICE_ACTIVITY", "STRIKE", "TECHNICAL_PROBLEM", "UNKNOWN_CAUSE", "WEATHER"]>;
111
115
  coordinates: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
112
116
  created_by: z.ZodString;
@@ -116,8 +120,8 @@ export declare const CreateAlertSchema: z.ZodObject<Omit<{
116
120
  info_url: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
117
121
  modified_by: z.ZodString;
118
122
  municipality_ids: z.ZodArray<z.ZodString, "many">;
119
- publish_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>;
120
- publish_start_date: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
123
+ publish_end_date: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>;
124
+ publish_start_date: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
121
125
  publish_status: z.ZodEnum<["PUBLISHED", "ARCHIVED", "DRAFT"]>;
122
126
  reference_type: z.ZodEnum<["LINE", "STOP", "AGENCY", "TRIP"]>;
123
127
  references: z.ZodArray<z.ZodObject<{
@@ -134,7 +138,6 @@ export declare const CreateAlertSchema: z.ZodObject<Omit<{
134
138
  type: z.ZodEnum<["PLANNED", "REALTIME"]>;
135
139
  }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
136
140
  created_by: string;
137
- updated_by: string;
138
141
  type: "PLANNED" | "REALTIME";
139
142
  municipality_ids: string[];
140
143
  active_period_start_date: number & {
@@ -154,11 +157,12 @@ export declare const CreateAlertSchema: z.ZodObject<Omit<{
154
157
  parent_id: string;
155
158
  }[];
156
159
  title: string;
157
- active_period_end_date?: UnixTimestamp | null | undefined;
160
+ updated_by?: string | undefined;
161
+ active_period_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
158
162
  coordinates?: [number, number] | null | undefined;
159
163
  file_id?: string | null | undefined;
160
164
  info_url?: string | undefined;
161
- publish_end_date?: UnixTimestamp | null | undefined;
165
+ publish_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
162
166
  }, {
163
167
  created_by: string;
164
168
  type: "PLANNED" | "REALTIME";
@@ -184,12 +188,11 @@ export declare const CreateAlertSchema: z.ZodObject<Omit<{
184
188
  publish_end_date?: number | null | undefined;
185
189
  }>;
186
190
  export declare const UpdateAlertSchema: z.ZodObject<{
187
- created_by: z.ZodOptional<z.ZodString>;
188
- updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
191
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
189
192
  type: z.ZodOptional<z.ZodEnum<["PLANNED", "REALTIME"]>>;
190
193
  municipality_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
191
- active_period_end_date: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>>;
192
- active_period_start_date: z.ZodOptional<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>;
194
+ active_period_end_date: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>>;
195
+ active_period_start_date: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>;
193
196
  cause: z.ZodOptional<z.ZodEnum<["ACCIDENT", "CONSTRUCTION", "DEMONSTRATION", "HOLIDAY", "MAINTENANCE", "MEDICAL_EMERGENCY", "OTHER_CAUSE", "POLICE_ACTIVITY", "STRIKE", "TECHNICAL_PROBLEM", "UNKNOWN_CAUSE", "WEATHER"]>>;
194
197
  coordinates: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>>;
195
198
  description: z.ZodOptional<z.ZodString>;
@@ -197,8 +200,8 @@ export declare const UpdateAlertSchema: z.ZodObject<{
197
200
  file_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
198
201
  info_url: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>>;
199
202
  modified_by: z.ZodOptional<z.ZodString>;
200
- publish_end_date: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>>>;
201
- publish_start_date: z.ZodOptional<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>;
203
+ publish_end_date: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>>>;
204
+ publish_start_date: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>>;
202
205
  publish_status: z.ZodOptional<z.ZodEnum<["PUBLISHED", "ARCHIVED", "DRAFT"]>>;
203
206
  reference_type: z.ZodOptional<z.ZodEnum<["LINE", "STOP", "AGENCY", "TRIP"]>>;
204
207
  references: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -213,12 +216,11 @@ export declare const UpdateAlertSchema: z.ZodObject<{
213
216
  }>, "many">>;
214
217
  title: z.ZodOptional<z.ZodString>;
215
218
  }, "strict", z.ZodTypeAny, {
216
- created_by?: string | undefined;
217
219
  updated_by?: string | undefined;
218
220
  type?: "PLANNED" | "REALTIME" | undefined;
219
221
  municipality_ids?: string[] | undefined;
220
- active_period_end_date?: UnixTimestamp | null | undefined;
221
- active_period_start_date?: UnixTimestamp | undefined;
222
+ active_period_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
223
+ active_period_start_date?: import("./_common/unix-timestamp.js").UnixTimestamp | undefined;
222
224
  cause?: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "HOLIDAY" | "MAINTENANCE" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "STRIKE" | "TECHNICAL_PROBLEM" | "UNKNOWN_CAUSE" | "WEATHER" | undefined;
223
225
  coordinates?: [number, number] | null | undefined;
224
226
  description?: string | undefined;
@@ -226,8 +228,8 @@ export declare const UpdateAlertSchema: z.ZodObject<{
226
228
  file_id?: string | null | undefined;
227
229
  info_url?: string | undefined;
228
230
  modified_by?: string | undefined;
229
- publish_end_date?: UnixTimestamp | null | undefined;
230
- publish_start_date?: UnixTimestamp | undefined;
231
+ publish_end_date?: import("./_common/unix-timestamp.js").UnixTimestamp | null | undefined;
232
+ publish_start_date?: import("./_common/unix-timestamp.js").UnixTimestamp | undefined;
231
233
  publish_status?: "PUBLISHED" | "ARCHIVED" | "DRAFT" | undefined;
232
234
  reference_type?: "LINE" | "STOP" | "AGENCY" | "TRIP" | undefined;
233
235
  references?: {
@@ -236,7 +238,6 @@ export declare const UpdateAlertSchema: z.ZodObject<{
236
238
  }[] | undefined;
237
239
  title?: string | undefined;
238
240
  }, {
239
- created_by?: string | undefined;
240
241
  updated_by?: string | undefined;
241
242
  type?: "PLANNED" | "REALTIME" | undefined;
242
243
  municipality_ids?: string[] | undefined;
@@ -259,36 +260,9 @@ export declare const UpdateAlertSchema: z.ZodObject<{
259
260
  }[] | undefined;
260
261
  title?: string | undefined;
261
262
  }>;
262
- export type Cause = z.infer<typeof causeSchema>;
263
- export type Effect = z.infer<typeof effectSchema>;
264
- export type PublishStatus = z.infer<typeof publishStatusSchema>;
265
- export type AlertType = z.infer<typeof alertTypeSchema>;
266
- export type ReferenceType = z.infer<typeof referenceTypeSchema>;
267
- export interface Alert extends Omit<z.infer<typeof AlertSchema>, 'active_period_end_date' | 'active_period_start_date' | 'cause' | 'created_at' | 'effect' | 'publish_end_date' | 'publish_start_date' | 'publish_status' | 'reference_type' | 'type' | 'updated_at'> {
268
- active_period_end_date: null | undefined | UnixTimestamp;
269
- active_period_start_date: UnixTimestamp;
270
- cause: Cause;
271
- created_at: UnixTimestamp;
272
- effect: Effect;
273
- publish_end_date: null | undefined | UnixTimestamp;
274
- publish_start_date: UnixTimestamp;
275
- publish_status: PublishStatus;
276
- reference_type: ReferenceType;
277
- type: AlertType;
278
- updated_at: UnixTimestamp;
279
- }
280
- export interface CreateAlertDto extends Omit<z.infer<typeof CreateAlertSchema>, 'active_period_end_date' | 'active_period_start_date' | 'cause' | 'effect' | 'publish_end_date' | 'publish_start_date' | 'publish_status' | 'reference_type' | 'type'> {
281
- active_period_end_date: null | undefined | UnixTimestamp;
282
- active_period_start_date: UnixTimestamp;
283
- cause: Cause;
284
- effect: Effect;
285
- publish_end_date: null | undefined | UnixTimestamp;
286
- publish_start_date: UnixTimestamp;
287
- publish_status: PublishStatus;
288
- reference_type: ReferenceType;
289
- type: AlertType;
290
- }
291
- export type UpdateAlertDto = Partial<Omit<CreateAlertDto, 'created_by'>>;
263
+ export type Alert = z.infer<typeof AlertSchema>;
264
+ export type CreateAlertDto = z.infer<typeof CreateAlertSchema>;
265
+ export type UpdateAlertDto = z.infer<typeof UpdateAlertSchema>;
292
266
  export declare const AlertPermissionSchema: z.ZodObject<{
293
267
  agency_ids: z.ZodArray<z.ZodString, "many">;
294
268
  }, "strip", z.ZodTypeAny, {
package/dist/src/alert.js CHANGED
@@ -4,54 +4,17 @@ import { unixTimeStampSchema } from './_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
6
  // Define constants for enum values for better maintainability
7
- const CAUSE_VALUES = [
8
- 'ACCIDENT',
9
- 'CONSTRUCTION',
10
- 'DEMONSTRATION',
11
- 'HOLIDAY',
12
- 'MAINTENANCE',
13
- 'MEDICAL_EMERGENCY',
14
- 'OTHER_CAUSE',
15
- 'POLICE_ACTIVITY',
16
- 'STRIKE',
17
- 'TECHNICAL_PROBLEM',
18
- 'UNKNOWN_CAUSE',
19
- 'WEATHER',
20
- ];
21
- const EFFECT_VALUES = [
22
- 'ACCESSIBILITY_ISSUE',
23
- 'ADDITIONAL_SERVICE',
24
- 'DETOUR',
25
- 'MODIFIED_SERVICE',
26
- 'NO_EFFECT',
27
- 'NO_SERVICE',
28
- 'OTHER_EFFECT',
29
- 'REDUCED_SERVICE',
30
- 'SIGNIFICANT_DELAYS',
31
- 'STOP_MOVED',
32
- 'UNKNOWN_EFFECT',
33
- ];
34
- const PUBLISH_STATUS_VALUES = [
35
- 'PUBLISHED',
36
- 'ARCHIVED',
37
- 'DRAFT',
38
- ];
39
- const ALERT_TYPE_VALUES = [
40
- 'PLANNED',
41
- 'REALTIME',
42
- ];
43
- const REFERENCE_TYPE_VALUES = [
44
- 'LINE',
45
- 'STOP',
46
- 'AGENCY',
47
- 'TRIP',
48
- ];
49
- // Define schemas using constants
7
+ const CAUSE_VALUES = ['ACCIDENT', 'CONSTRUCTION', 'DEMONSTRATION', 'HOLIDAY', 'MAINTENANCE', 'MEDICAL_EMERGENCY', 'OTHER_CAUSE', 'POLICE_ACTIVITY', 'STRIKE', 'TECHNICAL_PROBLEM', 'UNKNOWN_CAUSE', 'WEATHER'];
8
+ const EFFECT_VALUES = ['ACCESSIBILITY_ISSUE', 'ADDITIONAL_SERVICE', 'DETOUR', 'MODIFIED_SERVICE', 'NO_EFFECT', 'NO_SERVICE', 'OTHER_EFFECT', 'REDUCED_SERVICE', 'SIGNIFICANT_DELAYS', 'STOP_MOVED', 'UNKNOWN_EFFECT'];
9
+ const PUBLISH_STATUS_VALUES = ['PUBLISHED', 'ARCHIVED', 'DRAFT'];
10
+ const ALERT_TYPE_VALUES = ['PLANNED', 'REALTIME'];
11
+ const REFERENCE_TYPE_VALUES = ['LINE', 'STOP', 'AGENCY', 'TRIP'];
50
12
  export const causeSchema = z.enum(CAUSE_VALUES);
51
13
  export const effectSchema = z.enum(EFFECT_VALUES);
52
14
  export const publishStatusSchema = z.enum(PUBLISH_STATUS_VALUES);
53
15
  export const alertTypeSchema = z.enum(ALERT_TYPE_VALUES);
54
16
  export const referenceTypeSchema = z.enum(REFERENCE_TYPE_VALUES);
17
+ /* * */
55
18
  // Base schema for alerts with common validation rules
56
19
  export const AlertSchema = DocumentSchema.extend({
57
20
  active_period_end_date: unixTimeStampSchema.nullish(),
@@ -76,11 +39,8 @@ export const AlertSchema = DocumentSchema.extend({
76
39
  title: z.string().min(1),
77
40
  type: alertTypeSchema,
78
41
  }).strict();
79
- export const CreateAlertSchema = AlertSchema
80
- .omit({ _id: true, created_at: true, updated_at: true });
81
- export const UpdateAlertSchema = AlertSchema
82
- .omit({ _id: true, created_at: true, updated_at: true })
83
- .partial();
42
+ export const CreateAlertSchema = AlertSchema.omit({ _id: true, created_at: true, updated_at: true });
43
+ export const UpdateAlertSchema = CreateAlertSchema.omit({ created_by: true }).partial();
84
44
  /* * */
85
45
  export const AlertPermissionSchema = z.object({
86
46
  agency_ids: z.array(z.string()),
@@ -2,12 +2,6 @@
2
2
  import { z } from 'zod';
3
3
  /* * */
4
4
  export const LoginDtoSchema = z.object({
5
- email: z.string({
6
- required_error: 'Email is required',
7
- }).email({
8
- message: 'Email must be a valid email address',
9
- }),
10
- password: z.string({
11
- required_error: 'Password is required',
12
- }),
5
+ email: z.string({ required_error: 'Email is required' }).email({ message: 'Email must be a valid email address' }),
6
+ password: z.string({ required_error: 'Password is required' }),
13
7
  }).strict();
@@ -1,11 +1,10 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const RoleSchema: z.ZodObject<{
4
3
  _id: z.ZodString;
5
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
- created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
8
- updated_by: z.ZodDefault<z.ZodString>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
5
+ created_by: z.ZodOptional<z.ZodString>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
7
+ updated_by: z.ZodOptional<z.ZodString>;
9
8
  } & {
10
9
  name: z.ZodString;
11
10
  permissions: z.ZodArray<z.ZodObject<{
@@ -26,17 +25,17 @@ export declare const RoleSchema: z.ZodObject<{
26
25
  created_at: number & {
27
26
  __brand: "UnixTimestamp";
28
27
  };
29
- created_by: string;
30
28
  updated_at: number & {
31
29
  __brand: "UnixTimestamp";
32
30
  };
33
- updated_by: string;
34
31
  name: string;
35
32
  permissions: {
36
33
  scope: string;
37
34
  action: string;
38
35
  resource?: Record<string, any> | null | undefined;
39
36
  }[];
37
+ created_by?: string | undefined;
38
+ updated_by?: string | undefined;
40
39
  }, {
41
40
  _id: string;
42
41
  created_at: number;
@@ -52,10 +51,10 @@ export declare const RoleSchema: z.ZodObject<{
52
51
  }>;
53
52
  export declare const CreateRoleSchema: z.ZodObject<Omit<{
54
53
  _id: z.ZodString;
55
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
56
- created_by: z.ZodDefault<z.ZodString>;
57
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
58
- updated_by: z.ZodDefault<z.ZodString>;
54
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
55
+ created_by: z.ZodOptional<z.ZodString>;
56
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
57
+ updated_by: z.ZodOptional<z.ZodString>;
59
58
  } & {
60
59
  name: z.ZodString;
61
60
  permissions: z.ZodArray<z.ZodObject<{
@@ -72,14 +71,14 @@ export declare const CreateRoleSchema: z.ZodObject<Omit<{
72
71
  resource?: Record<string, any> | null | undefined;
73
72
  }>, "many">;
74
73
  }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
75
- created_by: string;
76
- updated_by: string;
77
74
  name: string;
78
75
  permissions: {
79
76
  scope: string;
80
77
  action: string;
81
78
  resource?: Record<string, any> | null | undefined;
82
79
  }[];
80
+ created_by?: string | undefined;
81
+ updated_by?: string | undefined;
83
82
  }, {
84
83
  name: string;
85
84
  permissions: {
@@ -91,8 +90,7 @@ export declare const CreateRoleSchema: z.ZodObject<Omit<{
91
90
  updated_by?: string | undefined;
92
91
  }>;
93
92
  export declare const UpdateRoleSchema: z.ZodObject<{
94
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
95
- updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
93
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
96
94
  name: z.ZodOptional<z.ZodString>;
97
95
  permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
96
  action: z.ZodString;
@@ -108,7 +106,6 @@ export declare const UpdateRoleSchema: z.ZodObject<{
108
106
  resource?: Record<string, any> | null | undefined;
109
107
  }>, "many">>;
110
108
  }, "strict", z.ZodTypeAny, {
111
- created_by?: string | undefined;
112
109
  updated_by?: string | undefined;
113
110
  name?: string | undefined;
114
111
  permissions?: {
@@ -117,7 +114,6 @@ export declare const UpdateRoleSchema: z.ZodObject<{
117
114
  resource?: Record<string, any> | null | undefined;
118
115
  }[] | undefined;
119
116
  }, {
120
- created_by?: string | undefined;
121
117
  updated_by?: string | undefined;
122
118
  name?: string | undefined;
123
119
  permissions?: {
@@ -126,9 +122,6 @@ export declare const UpdateRoleSchema: z.ZodObject<{
126
122
  resource?: Record<string, any> | null | undefined;
127
123
  }[] | undefined;
128
124
  }>;
129
- export interface Role extends Omit<z.infer<typeof RoleSchema>, 'created_at' | 'updated_at'> {
130
- created_at: UnixTimestamp;
131
- updated_at: UnixTimestamp;
132
- }
125
+ export type Role = z.infer<typeof RoleSchema>;
133
126
  export type CreateRoleDto = z.infer<typeof CreateRoleSchema>;
134
- export type UpdateRoleDto = Partial<CreateRoleDto>;
127
+ export type UpdateRoleDto = z.infer<typeof UpdateRoleSchema>;
@@ -8,4 +8,4 @@ export const RoleSchema = DocumentSchema.extend({
8
8
  permissions: z.array(PermissionSchema),
9
9
  }).strict();
10
10
  export const CreateRoleSchema = RoleSchema.omit({ _id: true, created_at: true, updated_at: true });
11
- export const UpdateRoleSchema = CreateRoleSchema.partial();
11
+ export const UpdateRoleSchema = CreateRoleSchema.omit({ created_by: true }).partial();
@@ -1,13 +1,12 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const SessionSchema: z.ZodObject<{
4
3
  _id: z.ZodString;
5
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
- created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
8
- updated_by: z.ZodDefault<z.ZodString>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
5
+ created_by: z.ZodOptional<z.ZodString>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
7
+ updated_by: z.ZodOptional<z.ZodString>;
9
8
  } & {
10
- expires_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
9
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
11
10
  token: z.ZodString;
12
11
  user_id: z.ZodString;
13
12
  }, "strict", z.ZodTypeAny, {
@@ -15,16 +14,14 @@ export declare const SessionSchema: z.ZodObject<{
15
14
  created_at: number & {
16
15
  __brand: "UnixTimestamp";
17
16
  };
18
- created_by: string;
19
17
  updated_at: number & {
20
18
  __brand: "UnixTimestamp";
21
19
  };
22
- updated_by: string;
23
20
  user_id: string;
24
21
  token: string;
25
- expires_at?: (number & {
26
- __brand: "UnixTimestamp";
27
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
22
+ created_by?: string | undefined;
23
+ updated_by?: string | undefined;
24
+ expires_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
28
25
  }, {
29
26
  _id: string;
30
27
  created_at: number;
@@ -37,22 +34,20 @@ export declare const SessionSchema: z.ZodObject<{
37
34
  }>;
38
35
  export declare const CreateSessionSchema: z.ZodObject<Omit<{
39
36
  _id: z.ZodString;
40
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
41
- created_by: z.ZodDefault<z.ZodString>;
42
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
43
- updated_by: z.ZodDefault<z.ZodString>;
37
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
38
+ created_by: z.ZodOptional<z.ZodString>;
39
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
40
+ updated_by: z.ZodOptional<z.ZodString>;
44
41
  } & {
45
- expires_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
42
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
46
43
  token: z.ZodString;
47
44
  user_id: z.ZodString;
48
45
  }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
49
- created_by: string;
50
- updated_by: string;
51
46
  user_id: string;
52
47
  token: string;
53
- expires_at?: (number & {
54
- __brand: "UnixTimestamp";
55
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
48
+ created_by?: string | undefined;
49
+ updated_by?: string | undefined;
50
+ expires_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
56
51
  }, {
57
52
  user_id: string;
58
53
  token: string;
@@ -61,32 +56,21 @@ export declare const CreateSessionSchema: z.ZodObject<Omit<{
61
56
  expires_at?: number | null | undefined;
62
57
  }>;
63
58
  export declare const UpdateSessionSchema: z.ZodObject<{
64
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
65
- updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
59
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
66
60
  user_id: z.ZodOptional<z.ZodString>;
67
- expires_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>;
61
+ expires_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>>;
68
62
  token: z.ZodOptional<z.ZodString>;
69
63
  }, "strict", z.ZodTypeAny, {
70
- created_by?: string | undefined;
71
64
  updated_by?: string | undefined;
72
65
  user_id?: string | undefined;
73
- expires_at?: (number & {
74
- __brand: "UnixTimestamp";
75
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
66
+ expires_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
76
67
  token?: string | undefined;
77
68
  }, {
78
- created_by?: string | undefined;
79
69
  updated_by?: string | undefined;
80
70
  user_id?: string | undefined;
81
71
  expires_at?: number | null | undefined;
82
72
  token?: string | undefined;
83
73
  }>;
84
- export interface Session extends Omit<z.infer<typeof SessionSchema>, 'created_at' | 'expires_at' | 'updated_at'> {
85
- created_at: UnixTimestamp;
86
- expires_at?: UnixTimestamp;
87
- updated_at: UnixTimestamp;
88
- }
89
- export interface CreateSessionDto extends Omit<z.infer<typeof CreateSessionSchema>, 'expires_at'> {
90
- expires_at?: UnixTimestamp;
91
- }
92
- export type UpdateSessionDto = Partial<CreateSessionDto>;
74
+ export type Session = z.infer<typeof SessionSchema>;
75
+ export type CreateSessionDto = z.infer<typeof CreateSessionSchema>;
76
+ export type UpdateSessionDto = z.infer<typeof UpdateSessionSchema>;
@@ -1,12 +1,12 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from '../_common/document.js';
3
- import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
3
+ import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
6
  export const SessionSchema = DocumentSchema.extend({
7
- expires_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullish(),
7
+ expires_at: unixTimeStampSchema.nullish(),
8
8
  token: z.string(),
9
9
  user_id: z.string(),
10
10
  }).strict();
11
11
  export const CreateSessionSchema = SessionSchema.omit({ _id: true, created_at: true, updated_at: true });
12
- export const UpdateSessionSchema = CreateSessionSchema.partial();
12
+ export const UpdateSessionSchema = CreateSessionSchema.omit({ created_by: true }).partial();