@tmlmobilidade/types 20250910.1541.13 → 20250911.1325.18

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 (51) hide show
  1. package/dist/src/_common/operational-date.d.ts +1 -1
  2. package/dist/src/_common/operational-date.js +1 -2
  3. package/dist/src/_common/proposed-change.d.ts +9 -31
  4. package/dist/src/_common/proposed-change.js +5 -14
  5. package/dist/src/agency.d.ts +10 -21
  6. package/dist/src/agency.js +1 -1
  7. package/dist/src/alert.d.ts +32 -58
  8. package/dist/src/alert.js +8 -48
  9. package/dist/src/auth/login.js +2 -8
  10. package/dist/src/auth/role.d.ts +6 -13
  11. package/dist/src/auth/role.js +1 -1
  12. package/dist/src/auth/session.d.ts +13 -29
  13. package/dist/src/auth/session.js +3 -3
  14. package/dist/src/auth/user.d.ts +13 -32
  15. package/dist/src/auth/user.js +3 -3
  16. package/dist/src/auth/verification-token.d.ts +13 -25
  17. package/dist/src/auth/verification-token.js +3 -3
  18. package/dist/src/gtfs.d.ts +6 -17
  19. package/dist/src/organization.d.ts +1 -4
  20. package/dist/src/organization.js +1 -1
  21. package/dist/src/plans/gtfs-validation.d.ts +25 -63
  22. package/dist/src/plans/gtfs-validation.js +2 -6
  23. package/dist/src/plans/plan-controller.d.ts +3 -8
  24. package/dist/src/plans/plan-controller.js +2 -2
  25. package/dist/src/plans/plan.d.ts +34 -86
  26. package/dist/src/plans/plan.js +2 -6
  27. package/dist/src/rides/ride-audit.d.ts +52 -1168
  28. package/dist/src/rides/ride-audit.js +3 -5
  29. package/dist/src/rides/ride-justification.d.ts +84 -9
  30. package/dist/src/rides/ride-justification.js +4 -1
  31. package/dist/src/rides/ride.d.ts +54 -105
  32. package/dist/src/rides/ride.js +8 -8
  33. package/dist/src/sams/sam-analysis.d.ts +5 -13
  34. package/dist/src/sams/sam-analysis.js +3 -3
  35. package/dist/src/sams/sam.d.ts +37 -88
  36. package/dist/src/sams/sam.js +4 -4
  37. package/dist/src/simplified-apex/simplified-apex-location.d.ts +16 -23
  38. package/dist/src/simplified-apex/simplified-apex-location.js +2 -2
  39. package/dist/src/simplified-apex/simplified-apex-on-board-refund.d.ts +16 -23
  40. package/dist/src/simplified-apex/simplified-apex-on-board-refund.js +2 -2
  41. package/dist/src/simplified-apex/simplified-apex-on-board-sale.d.ts +27 -37
  42. package/dist/src/simplified-apex/simplified-apex-on-board-sale.js +3 -3
  43. package/dist/src/simplified-apex/simplified-apex-validation.d.ts +16 -23
  44. package/dist/src/simplified-apex/simplified-apex-validation.js +2 -2
  45. package/dist/src/stop.d.ts +68 -86
  46. package/dist/src/stop.js +11 -74
  47. package/dist/src/vehicle-event.d.ts +7 -12
  48. package/dist/src/vehicle-event.js +2 -2
  49. package/dist/src/zone.d.ts +0 -3
  50. package/dist/src/zone.js +1 -1
  51. package/package.json +1 -1
@@ -3,7 +3,7 @@ export declare const OPERATIONAL_DATE_FORMAT = "yyyyMMdd";
3
3
  export type OperationalDate = string & {
4
4
  __brand: 'OperationalDate';
5
5
  };
6
- export declare const operationalDateSchema: z.ZodBranded<z.ZodEffects<z.ZodString, OperationalDate, string>, "OperationalDate">;
6
+ export declare const operationalDateSchema: z.ZodEffects<z.ZodString, OperationalDate, string>;
7
7
  /**
8
8
  * This function validates if a string is a valid operational date.
9
9
  * Throws an error if the date is invalid.
@@ -5,8 +5,7 @@ import { z } from 'zod';
5
5
  export const OPERATIONAL_DATE_FORMAT = 'yyyyMMdd';
6
6
  export const operationalDateSchema = z
7
7
  .string()
8
- .transform(validateOperationalDate)
9
- .brand('OperationalDate');
8
+ .transform(validateOperationalDate);
10
9
  /**
11
10
  * This function validates if a string is a valid operational date.
12
11
  * Throws an error if the date is invalid.
@@ -1,12 +1,13 @@
1
- import { type UnixTimestamp } from './unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const scopeSchema: z.ZodEnum<["stop", "lines"]>;
4
3
  export declare const statusSchema: z.ZodDefault<z.ZodEnum<["pending", "accepted", "declined"]>>;
4
+ export type Scope = z.infer<typeof scopeSchema>;
5
+ export type Status = z.infer<typeof statusSchema>;
5
6
  export declare const ProposedChangeSchema: z.ZodObject<{
6
7
  _id: z.ZodString;
7
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
8
+ created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
8
9
  created_by: z.ZodDefault<z.ZodString>;
9
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
10
+ updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
10
11
  updated_by: z.ZodDefault<z.ZodString>;
11
12
  } & {
12
13
  field_path: z.ZodString;
@@ -46,9 +47,9 @@ export declare const ProposedChangeSchema: z.ZodObject<{
46
47
  }>;
47
48
  export declare const CreateProposedChangeSchema: z.ZodObject<Omit<{
48
49
  _id: z.ZodString;
49
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
50
+ created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
50
51
  created_by: z.ZodDefault<z.ZodString>;
51
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
52
+ updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
52
53
  updated_by: z.ZodDefault<z.ZodString>;
53
54
  } & {
54
55
  field_path: z.ZodString;
@@ -77,7 +78,6 @@ export declare const CreateProposedChangeSchema: z.ZodObject<Omit<{
77
78
  field_value?: any;
78
79
  }>;
79
80
  export declare const UpdateProposedChangeSchema: z.ZodObject<{
80
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
81
81
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
82
82
  status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "accepted", "declined"]>>>;
83
83
  field_path: z.ZodOptional<z.ZodString>;
@@ -86,7 +86,6 @@ export declare const UpdateProposedChangeSchema: z.ZodObject<{
86
86
  target_id: z.ZodOptional<z.ZodString>;
87
87
  user_id: z.ZodOptional<z.ZodString>;
88
88
  }, "strict", z.ZodTypeAny, {
89
- created_by?: string | undefined;
90
89
  updated_by?: string | undefined;
91
90
  status?: "pending" | "accepted" | "declined" | undefined;
92
91
  field_path?: string | undefined;
@@ -95,7 +94,6 @@ export declare const UpdateProposedChangeSchema: z.ZodObject<{
95
94
  target_id?: string | undefined;
96
95
  user_id?: string | undefined;
97
96
  }, {
98
- created_by?: string | undefined;
99
97
  updated_by?: string | undefined;
100
98
  status?: "pending" | "accepted" | "declined" | undefined;
101
99
  field_path?: string | undefined;
@@ -104,26 +102,6 @@ export declare const UpdateProposedChangeSchema: z.ZodObject<{
104
102
  target_id?: string | undefined;
105
103
  user_id?: string | undefined;
106
104
  }>;
107
- export type Scope = z.infer<typeof scopeSchema>;
108
- export type Status = z.infer<typeof statusSchema>;
109
- export interface ProposedChange extends Omit<z.infer<typeof ProposedChangeSchema>, 'created_at' | 'field_path' | 'field_value' | 'scope' | 'status' | 'target_id' | 'updated_at' | 'user_id'> {
110
- created_at: UnixTimestamp;
111
- field_path: string;
112
- field_value: unknown;
113
- scope: Scope;
114
- status: Status;
115
- target_id: string;
116
- updated_at: UnixTimestamp;
117
- user_id: string;
118
- }
119
- export interface CreateProposedChangeDto extends Omit<z.infer<typeof CreateProposedChangeSchema>, 'created_at' | 'field_path' | 'field_value' | 'scope' | 'status' | 'target_id' | 'updated_at' | 'user_id'> {
120
- created_at: UnixTimestamp;
121
- field_path: string;
122
- field_value: unknown;
123
- scope: Scope;
124
- status: Status;
125
- target_id: string;
126
- updated_at: UnixTimestamp;
127
- user_id: string;
128
- }
129
- export type UpdateProposedChangeDto = Partial<Omit<CreateProposedChangeDto, 'created_by'>>;
105
+ export type ProposedChange = z.infer<typeof ProposedChangeSchema>;
106
+ export type CreateProposedChangeDto = z.infer<typeof CreateProposedChangeSchema>;
107
+ export type UpdateProposedChangeDto = z.infer<typeof UpdateProposedChangeSchema>;
@@ -4,17 +4,11 @@ import { z } from 'zod';
4
4
  /* * */
5
5
  //
6
6
  // Define constants for enum values for better maintainability
7
- const SCOPE_VALUES = [
8
- 'stop',
9
- 'lines',
10
- ];
11
- const STATUS_VALUES = [
12
- 'pending', 'accepted', 'declined',
13
- ];
14
- //
15
- // Define schemas using constants
7
+ const SCOPE_VALUES = ['stop', 'lines'];
8
+ const STATUS_VALUES = ['pending', 'accepted', 'declined'];
16
9
  export const scopeSchema = z.enum(SCOPE_VALUES);
17
10
  export const statusSchema = z.enum(STATUS_VALUES).default('pending');
11
+ // Define schemas using constants
18
12
  export const ProposedChangeSchema = DocumentSchema.extend({
19
13
  field_path: z.string(),
20
14
  field_value: z.any(),
@@ -23,8 +17,5 @@ export const ProposedChangeSchema = DocumentSchema.extend({
23
17
  target_id: z.string(),
24
18
  user_id: z.string(),
25
19
  }).strict();
26
- export const CreateProposedChangeSchema = ProposedChangeSchema
27
- .omit({ _id: true, created_at: true, updated_at: true });
28
- export const UpdateProposedChangeSchema = ProposedChangeSchema
29
- .omit({ _id: true, created_at: true, updated_at: true })
30
- .partial();
20
+ export const CreateProposedChangeSchema = ProposedChangeSchema.omit({ _id: true, created_at: true, updated_at: true });
21
+ export const UpdateProposedChangeSchema = CreateProposedChangeSchema.omit({ created_by: true }).partial();
@@ -1,11 +1,9 @@
1
- import { type OperationalDate } from './_common/operational-date.js';
2
- import { type UnixTimestamp } from './_common/unix-timestamp.js';
3
1
  import { z } from 'zod';
4
2
  export declare const AgencySchema: z.ZodObject<{
5
3
  _id: z.ZodString;
6
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
7
5
  created_by: z.ZodDefault<z.ZodString>;
8
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
9
7
  updated_by: z.ZodDefault<z.ZodString>;
10
8
  } & {
11
9
  contact_emails_pta: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -22,7 +20,7 @@ export declare const AgencySchema: z.ZodObject<{
22
20
  total_vkm_per_year: number;
23
21
  }>;
24
22
  name: z.ZodString;
25
- operation_start_date: z.ZodBranded<z.ZodEffects<z.ZodString, OperationalDate, string>, "OperationalDate">;
23
+ operation_start_date: z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">;
26
24
  phone: z.ZodString;
27
25
  public_email: z.ZodString;
28
26
  short_name: z.ZodString;
@@ -77,9 +75,9 @@ export declare const AgencySchema: z.ZodObject<{
77
75
  }>;
78
76
  export declare const CreateAgencySchema: z.ZodObject<Omit<{
79
77
  _id: z.ZodString;
80
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
78
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
81
79
  created_by: z.ZodDefault<z.ZodString>;
82
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
80
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
83
81
  updated_by: z.ZodDefault<z.ZodString>;
84
82
  } & {
85
83
  contact_emails_pta: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -96,7 +94,7 @@ export declare const CreateAgencySchema: z.ZodObject<Omit<{
96
94
  total_vkm_per_year: number;
97
95
  }>;
98
96
  name: z.ZodString;
99
- operation_start_date: z.ZodBranded<z.ZodEffects<z.ZodString, OperationalDate, string>, "OperationalDate">;
97
+ operation_start_date: z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">;
100
98
  phone: z.ZodString;
101
99
  public_email: z.ZodString;
102
100
  short_name: z.ZodString;
@@ -143,7 +141,6 @@ export declare const CreateAgencySchema: z.ZodObject<Omit<{
143
141
  }>;
144
142
  export declare const UpdateAgencySchema: z.ZodObject<{
145
143
  _id: z.ZodOptional<z.ZodString>;
146
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
147
144
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
148
145
  contact_emails_pta: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
149
146
  contact_emails_pto: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
@@ -159,7 +156,7 @@ export declare const UpdateAgencySchema: z.ZodObject<{
159
156
  total_vkm_per_year: number;
160
157
  }>>;
161
158
  name: z.ZodOptional<z.ZodString>;
162
- operation_start_date: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, OperationalDate, string>, "OperationalDate">>;
159
+ operation_start_date: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>;
163
160
  phone: z.ZodOptional<z.ZodString>;
164
161
  public_email: z.ZodOptional<z.ZodString>;
165
162
  short_name: z.ZodOptional<z.ZodString>;
@@ -167,7 +164,6 @@ export declare const UpdateAgencySchema: z.ZodObject<{
167
164
  website_url: z.ZodOptional<z.ZodString>;
168
165
  }, "strip", z.ZodTypeAny, {
169
166
  _id?: string | undefined;
170
- created_by?: string | undefined;
171
167
  updated_by?: string | undefined;
172
168
  contact_emails_pta?: string[] | undefined;
173
169
  contact_emails_pto?: string[] | undefined;
@@ -187,7 +183,6 @@ export declare const UpdateAgencySchema: z.ZodObject<{
187
183
  website_url?: string | undefined;
188
184
  }, {
189
185
  _id?: string | undefined;
190
- created_by?: string | undefined;
191
186
  updated_by?: string | undefined;
192
187
  contact_emails_pta?: string[] | undefined;
193
188
  contact_emails_pto?: string[] | undefined;
@@ -204,15 +199,9 @@ export declare const UpdateAgencySchema: z.ZodObject<{
204
199
  timezone?: string | undefined;
205
200
  website_url?: string | undefined;
206
201
  }>;
207
- export interface Agency extends Omit<z.infer<typeof AgencySchema>, 'created_at' | 'operation_start_date' | 'updated_at'> {
208
- created_at: UnixTimestamp;
209
- operation_start_date: OperationalDate;
210
- updated_at: UnixTimestamp;
211
- }
212
- export interface CreateAgencyDto extends Omit<z.infer<typeof CreateAgencySchema>, 'operation_start_date'> {
213
- operation_start_date: OperationalDate;
214
- }
215
- export type UpdateAgencyDto = Partial<CreateAgencyDto>;
202
+ export type Agency = z.infer<typeof AgencySchema>;
203
+ export type CreateAgencyDto = z.infer<typeof CreateAgencySchema>;
204
+ export type UpdateAgencyDto = z.infer<typeof UpdateAgencySchema>;
216
205
  export declare const AgencyPermissionSchema: z.ZodObject<{
217
206
  agency_ids: z.ZodArray<z.ZodString, "many">;
218
207
  municipality_ids: z.ZodArray<z.ZodString, "many">;
@@ -20,7 +20,7 @@ export const AgencySchema = DocumentSchema.extend({
20
20
  website_url: z.string().url(),
21
21
  }).strip();
22
22
  export const CreateAgencySchema = AgencySchema.omit({ created_at: true, updated_at: true });
23
- export const UpdateAgencySchema = CreateAgencySchema.partial();
23
+ export const UpdateAgencySchema = CreateAgencySchema.omit({ created_by: true }).partial();
24
24
  /* * */
25
25
  export const AgencyPermissionSchema = z.object({
26
26
  agency_ids: z.array(z.string()),
@@ -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>;
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>;
12
16
  updated_by: z.ZodDefault<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<{
@@ -67,11 +71,11 @@ export declare const AlertSchema: z.ZodObject<{
67
71
  parent_id: string;
68
72
  }[];
69
73
  title: string;
70
- active_period_end_date?: UnixTimestamp | null | 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>;
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>;
106
110
  updated_by: z.ZodDefault<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<{
@@ -154,11 +158,11 @@ export declare const CreateAlertSchema: z.ZodObject<Omit<{
154
158
  parent_id: string;
155
159
  }[];
156
160
  title: string;
157
- active_period_end_date?: UnixTimestamp | null | 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
191
  updated_by: z.ZodOptional<z.ZodDefault<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,10 +1,9 @@
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>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
6
5
  created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
8
7
  updated_by: z.ZodDefault<z.ZodString>;
9
8
  } & {
10
9
  name: z.ZodString;
@@ -52,9 +51,9 @@ 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>;
54
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
56
55
  created_by: z.ZodDefault<z.ZodString>;
57
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
56
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
58
57
  updated_by: z.ZodDefault<z.ZodString>;
59
58
  } & {
60
59
  name: z.ZodString;
@@ -91,7 +90,6 @@ 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
93
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
96
94
  name: z.ZodOptional<z.ZodString>;
97
95
  permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -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();