@tmlmobilidade/types 20260126.1852.36 → 20260128.2320.17

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 (150) hide show
  1. package/dist/_common/comment.d.ts +24 -24
  2. package/dist/_common/document.d.ts +3 -3
  3. package/dist/_common/document.js +1 -1
  4. package/dist/_common/status.d.ts +2 -2
  5. package/dist/_common/status.js +1 -1
  6. package/dist/_common/unix-timestamp.js +1 -0
  7. package/dist/agency.d.ts +6 -6
  8. package/dist/alerts/alert.d.ts +262 -0
  9. package/dist/alerts/alert.js +34 -0
  10. package/dist/alerts/cause-effect-map.d.ts +106 -0
  11. package/dist/alerts/cause-effect-map.js +94 -0
  12. package/dist/alerts/cause.d.ts +17 -0
  13. package/dist/alerts/cause.js +45 -0
  14. package/dist/alerts/effect.d.ts +17 -0
  15. package/dist/alerts/effect.js +35 -0
  16. package/dist/alerts/index.d.ts +6 -0
  17. package/dist/alerts/index.js +6 -0
  18. package/dist/alerts/query.d.ts +9 -0
  19. package/dist/alerts/query.js +6 -0
  20. package/dist/alerts/reference-type.d.ts +4 -0
  21. package/dist/alerts/reference-type.js +10 -0
  22. package/dist/apex/simplified-apex-location.d.ts +2 -12
  23. package/dist/apex/simplified-apex-location.js +1 -1
  24. package/dist/apex/simplified-apex-on-board-refund.d.ts +2 -12
  25. package/dist/apex/simplified-apex-on-board-refund.js +1 -1
  26. package/dist/apex/simplified-apex-on-board-sale.d.ts +12 -19
  27. package/dist/apex/simplified-apex-on-board-sale.js +2 -2
  28. package/dist/apex/simplified-apex-validation.d.ts +6 -16
  29. package/dist/apex/simplified-apex-validation.js +1 -1
  30. package/dist/auth/role.d.ts +718 -130
  31. package/dist/auth/session.d.ts +6 -6
  32. package/dist/auth/user.d.ts +1182 -270
  33. package/dist/auth/verification-token.d.ts +4 -4
  34. package/dist/calendar/event.d.ts +43 -0
  35. package/dist/calendar/event.js +16 -0
  36. package/dist/calendar/index.d.ts +1 -0
  37. package/dist/calendar/index.js +2 -0
  38. package/dist/dates/annotation.d.ts +6 -6
  39. package/dist/dates/date.d.ts +32 -0
  40. package/dist/dates/date.js +18 -0
  41. package/dist/dates/index.d.ts +2 -0
  42. package/dist/dates/index.js +2 -0
  43. package/dist/dates/period.d.ts +94 -0
  44. package/dist/dates/period.js +14 -0
  45. package/dist/file-exports/base.d.ts +9 -9
  46. package/dist/file-exports/file-exports.d.ts +7 -7
  47. package/dist/file-exports/ride-export.d.ts +14 -14
  48. package/dist/file-exports/ride-export.js +2 -2
  49. package/dist/gtfs/cause.d.ts +10 -0
  50. package/dist/gtfs/cause.js +18 -0
  51. package/dist/gtfs/effect.d.ts +10 -0
  52. package/dist/gtfs/effect.js +17 -0
  53. package/dist/gtfs/index.d.ts +2 -1
  54. package/dist/gtfs/index.js +2 -1
  55. package/dist/index.d.ts +5 -2
  56. package/dist/index.js +5 -2
  57. package/dist/locations/queries.d.ts +2 -2
  58. package/dist/metrics/demand/demand_by_agency.d.ts +8 -8
  59. package/dist/metrics/demand/demand_by_category.d.ts +12 -12
  60. package/dist/metrics/demand/demand_by_line.d.ts +4 -4
  61. package/dist/metrics/demand/demand_by_pattern.d.ts +8 -8
  62. package/dist/metrics/demand/demand_by_product.d.ts +12 -12
  63. package/dist/metrics/index.d.ts +93 -48
  64. package/dist/metrics/index.js +4 -1
  65. package/dist/metrics/passenger-impact/index.d.ts +1 -0
  66. package/dist/metrics/passenger-impact/index.js +1 -0
  67. package/dist/metrics/passenger-impact/passenger-impact.d.ts +97 -0
  68. package/dist/metrics/passenger-impact/passenger-impact.js +22 -0
  69. package/dist/metrics/supply/supply_by_agency.d.ts +4 -4
  70. package/dist/notification.d.ts +18 -18
  71. package/dist/offer/index.d.ts +5 -0
  72. package/dist/offer/index.js +5 -0
  73. package/dist/offer/line.d.ts +296 -0
  74. package/dist/offer/line.js +60 -0
  75. package/dist/offer/pattern.d.ts +3608 -0
  76. package/dist/offer/pattern.js +75 -0
  77. package/dist/offer/route.d.ts +187 -0
  78. package/dist/offer/route.js +33 -0
  79. package/dist/offer/scheduleRule.d.ts +80 -0
  80. package/dist/offer/scheduleRule.js +50 -0
  81. package/dist/offer/typology.d.ts +124 -0
  82. package/dist/offer/typology.js +30 -0
  83. package/dist/organization.d.ts +20 -20
  84. package/dist/permissions/alerts.d.ts +13 -19
  85. package/dist/permissions/alerts.js +8 -13
  86. package/dist/permissions/annotations.d.ts +25 -0
  87. package/dist/permissions/annotations.js +16 -0
  88. package/dist/permissions/fares.d.ts +25 -0
  89. package/dist/permissions/fares.js +16 -0
  90. package/dist/permissions/index.d.ts +196 -21
  91. package/dist/permissions/index.js +142 -6
  92. package/dist/permissions/lines.d.ts +25 -0
  93. package/dist/permissions/lines.js +16 -0
  94. package/dist/permissions/periods.d.ts +25 -0
  95. package/dist/permissions/periods.js +16 -0
  96. package/dist/permissions/typologies.d.ts +25 -0
  97. package/dist/permissions/typologies.js +16 -0
  98. package/dist/permissions/vehicles.d.ts +25 -0
  99. package/dist/permissions/vehicles.js +16 -0
  100. package/dist/permissions/zones.d.ts +25 -0
  101. package/dist/permissions/zones.js +16 -0
  102. package/dist/plans/gtfs-validation.d.ts +30 -30
  103. package/dist/plans/plan.d.ts +6 -6
  104. package/dist/proposed-change.d.ts +12 -12
  105. package/dist/rides/batch-query.d.ts +52 -0
  106. package/dist/rides/batch-query.js +54 -0
  107. package/dist/rides/index.d.ts +1 -0
  108. package/dist/rides/index.js +1 -0
  109. package/dist/rides/ride-acceptance.d.ts +105 -105
  110. package/dist/rides/ride-acceptance.js +2 -2
  111. package/dist/rides/ride-audit.d.ts +21 -21
  112. package/dist/rides/ride-normalized.d.ts +808 -21
  113. package/dist/rides/ride-normalized.js +31 -1
  114. package/dist/rides/ride.d.ts +6 -6
  115. package/dist/sams/sam.d.ts +0 -15
  116. package/dist/sams/sam.js +2 -2
  117. package/dist/stops/connections.d.ts +1 -0
  118. package/dist/stops/connections.js +1 -1
  119. package/dist/stops/equipment.d.ts +1 -0
  120. package/dist/stops/equipment.js +1 -1
  121. package/dist/stops/parent-station.d.ts +6 -6
  122. package/dist/stops/stop-area.d.ts +6 -6
  123. package/dist/stops/stop.d.ts +69 -69
  124. package/dist/ticketing/fare.d.ts +137 -0
  125. package/dist/ticketing/fare.js +44 -0
  126. package/dist/ticketing/index.d.ts +2 -0
  127. package/dist/ticketing/index.js +2 -0
  128. package/dist/ticketing/zone.d.ts +220 -0
  129. package/dist/ticketing/zone.js +34 -0
  130. package/dist/vehicle/emission.d.ts +3 -0
  131. package/dist/vehicle/emission.js +12 -0
  132. package/dist/vehicle/index.d.ts +4 -0
  133. package/dist/vehicle/index.js +4 -0
  134. package/dist/vehicle/propulsion.d.ts +3 -0
  135. package/dist/vehicle/propulsion.js +14 -0
  136. package/dist/vehicle/vehicle.d.ts +189 -0
  137. package/dist/vehicle/vehicle.js +27 -0
  138. package/dist/vehicle/wheelchair.d.ts +3 -0
  139. package/dist/vehicle/wheelchair.js +10 -0
  140. package/dist/vehicle-events/clickhouse-vehicle-event.d.ts +2 -6
  141. package/dist/vehicle-events/simplified-vehicle-event.d.ts +2 -6
  142. package/dist/vehicle-events/simplified-vehicle-event.js +1 -1
  143. package/dist/zone.d.ts +6 -6
  144. package/package.json +2 -2
  145. package/dist/alert.d.ts +0 -265
  146. package/dist/alert.js +0 -42
  147. package/dist/gtfs/cause-effetcs.d.ts +0 -86
  148. package/dist/gtfs/cause-effetcs.js +0 -31
  149. package/dist/permissions/dates.d.ts +0 -25
  150. package/dist/permissions/dates.js +0 -16
@@ -0,0 +1,97 @@
1
+ import { z } from 'zod';
2
+ export declare const DemandAffectedByFailedCirculationsSchema: z.ZodObject<{
3
+ description: z.ZodOptional<z.ZodString>;
4
+ generated_at: z.ZodDate;
5
+ metric: z.ZodString;
6
+ } & {
7
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
8
+ failed_circulations: z.ZodNumber;
9
+ estimated_affected_passengers: z.ZodNumber;
10
+ }, "strip", z.ZodTypeAny, {
11
+ failed_circulations: number;
12
+ estimated_affected_passengers: number;
13
+ }, {
14
+ failed_circulations: number;
15
+ estimated_affected_passengers: number;
16
+ }>>;
17
+ /**
18
+ * Agency_id used as the base aggregation key
19
+ */
20
+ properties: z.ZodObject<{
21
+ agency_id: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ agency_id: string;
24
+ }, {
25
+ agency_id: string;
26
+ }>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ properties: {
29
+ agency_id: string;
30
+ };
31
+ generated_at: Date;
32
+ metric: string;
33
+ data: Record<string, {
34
+ failed_circulations: number;
35
+ estimated_affected_passengers: number;
36
+ }>;
37
+ description?: string | undefined;
38
+ }, {
39
+ properties: {
40
+ agency_id: string;
41
+ };
42
+ generated_at: Date;
43
+ metric: string;
44
+ data: Record<string, {
45
+ failed_circulations: number;
46
+ estimated_affected_passengers: number;
47
+ }>;
48
+ description?: string | undefined;
49
+ }>;
50
+ /** Variants: by_day */
51
+ export declare const DemandAffectedByFailedCirculationsByDaySchema: z.ZodObject<{
52
+ description: z.ZodOptional<z.ZodString>;
53
+ generated_at: z.ZodDate;
54
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
55
+ failed_circulations: z.ZodNumber;
56
+ estimated_affected_passengers: z.ZodNumber;
57
+ }, "strip", z.ZodTypeAny, {
58
+ failed_circulations: number;
59
+ estimated_affected_passengers: number;
60
+ }, {
61
+ failed_circulations: number;
62
+ estimated_affected_passengers: number;
63
+ }>>;
64
+ properties: z.ZodObject<{
65
+ agency_id: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ agency_id: string;
68
+ }, {
69
+ agency_id: string;
70
+ }>;
71
+ } & {
72
+ metric: z.ZodLiteral<"demand_affected_by_failed_circulations_by_day">;
73
+ }, "strip", z.ZodTypeAny, {
74
+ properties: {
75
+ agency_id: string;
76
+ };
77
+ generated_at: Date;
78
+ metric: "demand_affected_by_failed_circulations_by_day";
79
+ data: Record<string, {
80
+ failed_circulations: number;
81
+ estimated_affected_passengers: number;
82
+ }>;
83
+ description?: string | undefined;
84
+ }, {
85
+ properties: {
86
+ agency_id: string;
87
+ };
88
+ generated_at: Date;
89
+ metric: "demand_affected_by_failed_circulations_by_day";
90
+ data: Record<string, {
91
+ failed_circulations: number;
92
+ estimated_affected_passengers: number;
93
+ }>;
94
+ description?: string | undefined;
95
+ }>;
96
+ /** Types */
97
+ export type DemandAffectedByFailedCirculationsByDay = z.infer<typeof DemandAffectedByFailedCirculationsByDaySchema>;
@@ -0,0 +1,22 @@
1
+ /* * */
2
+ import { MetricBaseSchema } from '../common.js';
3
+ import { z } from 'zod';
4
+ /* DEMAND AFFECTED BY FAILED CIRCULATIONS */
5
+ export const DemandAffectedByFailedCirculationsSchema = MetricBaseSchema.extend({
6
+ data: z.record(z.string().describe('Time key (e.g., YYYY-MM-DD / YYYY-MM / YYYY)'), z.object({
7
+ // Circulations that failed (or were considered failed) within the target interval
8
+ failed_circulations: z.number(),
9
+ // Median number of validations over the last 30 days
10
+ estimated_affected_passengers: z.number(),
11
+ })),
12
+ /**
13
+ * Agency_id used as the base aggregation key
14
+ */
15
+ properties: z.object({
16
+ agency_id: z.string(),
17
+ }),
18
+ });
19
+ /** Variants: by_day */
20
+ export const DemandAffectedByFailedCirculationsByDaySchema = DemandAffectedByFailedCirculationsSchema.extend({
21
+ metric: z.literal('demand_affected_by_failed_circulations_by_day'),
22
+ });
@@ -130,19 +130,19 @@ export declare const SupplyByAgencyByDaySchema: z.ZodObject<{
130
130
  vkms_observed: z.ZodNumber;
131
131
  vkms_scheduled: z.ZodNumber;
132
132
  }, "strip", z.ZodTypeAny, {
133
+ period: "1" | "2" | "3";
133
134
  day_type: "1" | "2" | "3";
134
135
  holiday: "0" | "1";
135
136
  notes: string | null;
136
- period: "1" | "2" | "3";
137
137
  accomplished_rides: number;
138
138
  scheduled_rides: number;
139
139
  vkms_observed: number;
140
140
  vkms_scheduled: number;
141
141
  }, {
142
+ period: "1" | "2" | "3";
142
143
  day_type: "1" | "2" | "3";
143
144
  holiday: "0" | "1";
144
145
  notes: string | null;
145
- period: "1" | "2" | "3";
146
146
  accomplished_rides: number;
147
147
  scheduled_rides: number;
148
148
  vkms_observed: number;
@@ -156,10 +156,10 @@ export declare const SupplyByAgencyByDaySchema: z.ZodObject<{
156
156
  generated_at: Date;
157
157
  metric: "supply_by_agency_by_day";
158
158
  data: Record<string, {
159
+ period: "1" | "2" | "3";
159
160
  day_type: "1" | "2" | "3";
160
161
  holiday: "0" | "1";
161
162
  notes: string | null;
162
- period: "1" | "2" | "3";
163
163
  accomplished_rides: number;
164
164
  scheduled_rides: number;
165
165
  vkms_observed: number;
@@ -173,10 +173,10 @@ export declare const SupplyByAgencyByDaySchema: z.ZodObject<{
173
173
  generated_at: Date;
174
174
  metric: "supply_by_agency_by_day";
175
175
  data: Record<string, {
176
+ period: "1" | "2" | "3";
176
177
  day_type: "1" | "2" | "3";
177
178
  holiday: "0" | "1";
178
179
  notes: string | null;
179
- period: "1" | "2" | "3";
180
180
  accomplished_rides: number;
181
181
  scheduled_rides: number;
182
182
  vkms_observed: number;
@@ -3,7 +3,7 @@ export type Notification = z.infer<typeof NotificationSchema>;
3
3
  export declare const NotificationSchema: z.ZodObject<Omit<{
4
4
  _id: z.ZodString;
5
5
  created_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
6
- created_by: z.ZodOptional<z.ZodString>;
6
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
7
7
  is_locked: z.ZodDefault<z.ZodBoolean>;
8
8
  updated_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
9
9
  updated_by: z.ZodOptional<z.ZodString>;
@@ -17,13 +17,13 @@ export declare const NotificationSchema: z.ZodObject<Omit<{
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  title: string;
19
19
  body: string;
20
- href?: string | undefined;
21
20
  icon?: string | undefined;
21
+ href?: string | undefined;
22
22
  }, {
23
23
  title: string;
24
24
  body: string;
25
- href?: string | undefined;
26
25
  icon?: string | undefined;
26
+ href?: string | undefined;
27
27
  }>;
28
28
  priority: z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>;
29
29
  scope: z.ZodString;
@@ -34,6 +34,7 @@ export declare const NotificationSchema: z.ZodObject<Omit<{
34
34
  created_at: number & {
35
35
  __brand: "UnixTimestamp";
36
36
  };
37
+ created_by: string | null;
37
38
  updated_at: number & {
38
39
  __brand: "UnixTimestamp";
39
40
  };
@@ -42,12 +43,11 @@ export declare const NotificationSchema: z.ZodObject<Omit<{
42
43
  payload: {
43
44
  title: string;
44
45
  body: string;
45
- href?: string | undefined;
46
46
  icon?: string | undefined;
47
+ href?: string | undefined;
47
48
  };
48
49
  priority: "high" | "normal" | "low";
49
50
  topic: string;
50
- created_by?: string | undefined;
51
51
  updated_by?: string | undefined;
52
52
  user_id?: string | undefined;
53
53
  }, {
@@ -59,11 +59,11 @@ export declare const NotificationSchema: z.ZodObject<Omit<{
59
59
  payload: {
60
60
  title: string;
61
61
  body: string;
62
- href?: string | undefined;
63
62
  icon?: string | undefined;
63
+ href?: string | undefined;
64
64
  };
65
65
  topic: string;
66
- created_by?: string | undefined;
66
+ created_by?: string | null | undefined;
67
67
  updated_by?: string | undefined;
68
68
  user_id?: string | undefined;
69
69
  priority?: "high" | "normal" | "low" | undefined;
@@ -71,7 +71,7 @@ export declare const NotificationSchema: z.ZodObject<Omit<{
71
71
  export declare const CreateNotificationSchema: z.ZodObject<Omit<Omit<{
72
72
  _id: z.ZodString;
73
73
  created_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
74
- created_by: z.ZodOptional<z.ZodString>;
74
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
75
75
  is_locked: z.ZodDefault<z.ZodBoolean>;
76
76
  updated_at: z.ZodEffects<z.ZodNumber, import("./index.js").UnixTimestamp, number>;
77
77
  updated_by: z.ZodOptional<z.ZodString>;
@@ -85,30 +85,30 @@ export declare const CreateNotificationSchema: z.ZodObject<Omit<Omit<{
85
85
  }, "strip", z.ZodTypeAny, {
86
86
  title: string;
87
87
  body: string;
88
- href?: string | undefined;
89
88
  icon?: string | undefined;
89
+ href?: string | undefined;
90
90
  }, {
91
91
  title: string;
92
92
  body: string;
93
- href?: string | undefined;
94
93
  icon?: string | undefined;
94
+ href?: string | undefined;
95
95
  }>;
96
96
  priority: z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>;
97
97
  scope: z.ZodString;
98
98
  topic: z.ZodString;
99
99
  user_id: z.ZodOptional<z.ZodString>;
100
100
  }, "_id" | "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
101
+ created_by: string | null;
101
102
  scope: string;
102
103
  is_read: boolean;
103
104
  payload: {
104
105
  title: string;
105
106
  body: string;
106
- href?: string | undefined;
107
107
  icon?: string | undefined;
108
+ href?: string | undefined;
108
109
  };
109
110
  priority: "high" | "normal" | "low";
110
111
  topic: string;
111
- created_by?: string | undefined;
112
112
  updated_by?: string | undefined;
113
113
  user_id?: string | undefined;
114
114
  }, {
@@ -117,11 +117,11 @@ export declare const CreateNotificationSchema: z.ZodObject<Omit<Omit<{
117
117
  payload: {
118
118
  title: string;
119
119
  body: string;
120
- href?: string | undefined;
121
120
  icon?: string | undefined;
121
+ href?: string | undefined;
122
122
  };
123
123
  topic: string;
124
- created_by?: string | undefined;
124
+ created_by?: string | null | undefined;
125
125
  updated_by?: string | undefined;
126
126
  user_id?: string | undefined;
127
127
  priority?: "high" | "normal" | "low" | undefined;
@@ -139,13 +139,13 @@ export declare const UpdateNotificationSchema: z.ZodObject<{
139
139
  }, "strip", z.ZodTypeAny, {
140
140
  title: string;
141
141
  body: string;
142
- href?: string | undefined;
143
142
  icon?: string | undefined;
143
+ href?: string | undefined;
144
144
  }, {
145
145
  title: string;
146
146
  body: string;
147
- href?: string | undefined;
148
147
  icon?: string | undefined;
148
+ href?: string | undefined;
149
149
  }>>;
150
150
  priority: z.ZodOptional<z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>>;
151
151
  topic: z.ZodOptional<z.ZodString>;
@@ -157,8 +157,8 @@ export declare const UpdateNotificationSchema: z.ZodObject<{
157
157
  payload?: {
158
158
  title: string;
159
159
  body: string;
160
- href?: string | undefined;
161
160
  icon?: string | undefined;
161
+ href?: string | undefined;
162
162
  } | undefined;
163
163
  priority?: "high" | "normal" | "low" | undefined;
164
164
  topic?: string | undefined;
@@ -170,8 +170,8 @@ export declare const UpdateNotificationSchema: z.ZodObject<{
170
170
  payload?: {
171
171
  title: string;
172
172
  body: string;
173
- href?: string | undefined;
174
173
  icon?: string | undefined;
174
+ href?: string | undefined;
175
175
  } | undefined;
176
176
  priority?: "high" | "normal" | "low" | undefined;
177
177
  topic?: string | undefined;
@@ -0,0 +1,5 @@
1
+ export * from './line.js';
2
+ export * from './pattern.js';
3
+ export * from './route.js';
4
+ export * from './scheduleRule.js';
5
+ export * from './typology.js';
@@ -0,0 +1,5 @@
1
+ export * from './line.js';
2
+ export * from './pattern.js';
3
+ export * from './route.js';
4
+ export * from './scheduleRule.js';
5
+ export * from './typology.js';
@@ -0,0 +1,296 @@
1
+ import { z } from 'zod';
2
+ export declare const TRANSPORT_TYPE: {
3
+ readonly AERIAL_LIFT: "6";
4
+ readonly BUS: "3";
5
+ readonly CABLE_TRAM: "5";
6
+ readonly FERRY: "4";
7
+ readonly FUNICULAR: "7";
8
+ readonly MONORAIL: "12";
9
+ readonly RAIL: "2";
10
+ readonly SUBWAY: "1";
11
+ readonly TRAM: "0";
12
+ readonly TROLLEYBUS: "11";
13
+ };
14
+ export declare const transportTypeOptions: ({
15
+ label: string;
16
+ value: "6";
17
+ } | {
18
+ label: string;
19
+ value: "3";
20
+ } | {
21
+ label: string;
22
+ value: "5";
23
+ } | {
24
+ label: string;
25
+ value: "4";
26
+ } | {
27
+ label: string;
28
+ value: "7";
29
+ } | {
30
+ label: string;
31
+ value: "12";
32
+ } | {
33
+ label: string;
34
+ value: "2";
35
+ } | {
36
+ label: string;
37
+ value: "1";
38
+ } | {
39
+ label: string;
40
+ value: "0";
41
+ } | {
42
+ label: string;
43
+ value: "11";
44
+ })[];
45
+ export declare const INTERCHANGE_MODE: {
46
+ readonly CONFIGURED: "2";
47
+ readonly NONE: "0";
48
+ readonly SAME_OPERATOR: "1";
49
+ };
50
+ export declare const interchangeModeOptions: ({
51
+ label: string;
52
+ value: "0";
53
+ } | {
54
+ label: string;
55
+ value: "1";
56
+ } | {
57
+ label: string;
58
+ value: "2";
59
+ })[];
60
+ export declare const LineSchema: z.ZodObject<{
61
+ _id: z.ZodString;
62
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
63
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
64
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
65
+ updated_by: z.ZodOptional<z.ZodString>;
66
+ } & {
67
+ agency_id: z.ZodString;
68
+ code: z.ZodString;
69
+ interchange: z.ZodDefault<z.ZodNativeEnum<{
70
+ readonly CONFIGURED: "2";
71
+ readonly NONE: "0";
72
+ readonly SAME_OPERATOR: "1";
73
+ }>>;
74
+ is_circular_line: z.ZodDefault<z.ZodBoolean>;
75
+ is_continuous_line: z.ZodDefault<z.ZodBoolean>;
76
+ is_locked: z.ZodDefault<z.ZodBoolean>;
77
+ is_school_line: z.ZodDefault<z.ZodBoolean>;
78
+ name: z.ZodString;
79
+ onboard_fare_ids: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
80
+ prepaid_fare_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
81
+ routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
82
+ _id: z.ZodString;
83
+ code: z.ZodString;
84
+ name: z.ZodString;
85
+ }, "strip", z.ZodTypeAny, {
86
+ _id: string;
87
+ code: string;
88
+ name: string;
89
+ }, {
90
+ _id: string;
91
+ code: string;
92
+ name: string;
93
+ }>, "many">>;
94
+ transport_type: z.ZodDefault<z.ZodNativeEnum<{
95
+ readonly AERIAL_LIFT: "6";
96
+ readonly BUS: "3";
97
+ readonly CABLE_TRAM: "5";
98
+ readonly FERRY: "4";
99
+ readonly FUNICULAR: "7";
100
+ readonly MONORAIL: "12";
101
+ readonly RAIL: "2";
102
+ readonly SUBWAY: "1";
103
+ readonly TRAM: "0";
104
+ readonly TROLLEYBUS: "11";
105
+ }>>;
106
+ typology: z.ZodDefault<z.ZodNullable<z.ZodString>>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ _id: string;
109
+ created_at: number & {
110
+ __brand: "UnixTimestamp";
111
+ };
112
+ created_by: string | null;
113
+ is_locked: boolean;
114
+ updated_at: number & {
115
+ __brand: "UnixTimestamp";
116
+ };
117
+ code: string;
118
+ name: string;
119
+ agency_id: string;
120
+ interchange: "0" | "1" | "2";
121
+ is_circular_line: boolean;
122
+ is_continuous_line: boolean;
123
+ is_school_line: boolean;
124
+ onboard_fare_ids: string[] | null;
125
+ prepaid_fare_id: string | null;
126
+ transport_type: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12";
127
+ typology: string | null;
128
+ updated_by?: string | undefined;
129
+ routes?: {
130
+ _id: string;
131
+ code: string;
132
+ name: string;
133
+ }[] | undefined;
134
+ }, {
135
+ _id: string;
136
+ created_at: number;
137
+ updated_at: number;
138
+ code: string;
139
+ name: string;
140
+ agency_id: string;
141
+ created_by?: string | null | undefined;
142
+ is_locked?: boolean | undefined;
143
+ updated_by?: string | undefined;
144
+ interchange?: "0" | "1" | "2" | undefined;
145
+ is_circular_line?: boolean | undefined;
146
+ is_continuous_line?: boolean | undefined;
147
+ is_school_line?: boolean | undefined;
148
+ onboard_fare_ids?: string[] | null | undefined;
149
+ prepaid_fare_id?: string | null | undefined;
150
+ routes?: {
151
+ _id: string;
152
+ code: string;
153
+ name: string;
154
+ }[] | undefined;
155
+ transport_type?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12" | undefined;
156
+ typology?: string | null | undefined;
157
+ }>;
158
+ export declare const CreateLineSchema: z.ZodObject<Omit<{
159
+ _id: z.ZodString;
160
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
161
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
162
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
163
+ updated_by: z.ZodOptional<z.ZodString>;
164
+ } & {
165
+ agency_id: z.ZodString;
166
+ code: z.ZodString;
167
+ interchange: z.ZodDefault<z.ZodNativeEnum<{
168
+ readonly CONFIGURED: "2";
169
+ readonly NONE: "0";
170
+ readonly SAME_OPERATOR: "1";
171
+ }>>;
172
+ is_circular_line: z.ZodDefault<z.ZodBoolean>;
173
+ is_continuous_line: z.ZodDefault<z.ZodBoolean>;
174
+ is_locked: z.ZodDefault<z.ZodBoolean>;
175
+ is_school_line: z.ZodDefault<z.ZodBoolean>;
176
+ name: z.ZodString;
177
+ onboard_fare_ids: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
178
+ prepaid_fare_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
179
+ routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
180
+ _id: z.ZodString;
181
+ code: z.ZodString;
182
+ name: z.ZodString;
183
+ }, "strip", z.ZodTypeAny, {
184
+ _id: string;
185
+ code: string;
186
+ name: string;
187
+ }, {
188
+ _id: string;
189
+ code: string;
190
+ name: string;
191
+ }>, "many">>;
192
+ transport_type: z.ZodDefault<z.ZodNativeEnum<{
193
+ readonly AERIAL_LIFT: "6";
194
+ readonly BUS: "3";
195
+ readonly CABLE_TRAM: "5";
196
+ readonly FERRY: "4";
197
+ readonly FUNICULAR: "7";
198
+ readonly MONORAIL: "12";
199
+ readonly RAIL: "2";
200
+ readonly SUBWAY: "1";
201
+ readonly TRAM: "0";
202
+ readonly TROLLEYBUS: "11";
203
+ }>>;
204
+ typology: z.ZodDefault<z.ZodNullable<z.ZodString>>;
205
+ }, "_id" | "created_at" | "updated_at" | "routes">, "strip", z.ZodTypeAny, {
206
+ created_by: string | null;
207
+ is_locked: boolean;
208
+ code: string;
209
+ name: string;
210
+ agency_id: string;
211
+ interchange: "0" | "1" | "2";
212
+ is_circular_line: boolean;
213
+ is_continuous_line: boolean;
214
+ is_school_line: boolean;
215
+ onboard_fare_ids: string[] | null;
216
+ prepaid_fare_id: string | null;
217
+ transport_type: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12";
218
+ typology: string | null;
219
+ updated_by?: string | undefined;
220
+ }, {
221
+ code: string;
222
+ name: string;
223
+ agency_id: string;
224
+ created_by?: string | null | undefined;
225
+ is_locked?: boolean | undefined;
226
+ updated_by?: string | undefined;
227
+ interchange?: "0" | "1" | "2" | undefined;
228
+ is_circular_line?: boolean | undefined;
229
+ is_continuous_line?: boolean | undefined;
230
+ is_school_line?: boolean | undefined;
231
+ onboard_fare_ids?: string[] | null | undefined;
232
+ prepaid_fare_id?: string | null | undefined;
233
+ transport_type?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12" | undefined;
234
+ typology?: string | null | undefined;
235
+ }>;
236
+ export declare const UpdateLineSchema: z.ZodObject<{
237
+ is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
238
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
239
+ code: z.ZodOptional<z.ZodString>;
240
+ name: z.ZodOptional<z.ZodString>;
241
+ agency_id: z.ZodOptional<z.ZodString>;
242
+ interchange: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<{
243
+ readonly CONFIGURED: "2";
244
+ readonly NONE: "0";
245
+ readonly SAME_OPERATOR: "1";
246
+ }>>>;
247
+ is_circular_line: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
248
+ is_continuous_line: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
249
+ is_school_line: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
250
+ onboard_fare_ids: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>>;
251
+ prepaid_fare_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
252
+ transport_type: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<{
253
+ readonly AERIAL_LIFT: "6";
254
+ readonly BUS: "3";
255
+ readonly CABLE_TRAM: "5";
256
+ readonly FERRY: "4";
257
+ readonly FUNICULAR: "7";
258
+ readonly MONORAIL: "12";
259
+ readonly RAIL: "2";
260
+ readonly SUBWAY: "1";
261
+ readonly TRAM: "0";
262
+ readonly TROLLEYBUS: "11";
263
+ }>>>;
264
+ typology: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ is_locked?: boolean | undefined;
267
+ updated_by?: string | undefined;
268
+ code?: string | undefined;
269
+ name?: string | undefined;
270
+ agency_id?: string | undefined;
271
+ interchange?: "0" | "1" | "2" | undefined;
272
+ is_circular_line?: boolean | undefined;
273
+ is_continuous_line?: boolean | undefined;
274
+ is_school_line?: boolean | undefined;
275
+ onboard_fare_ids?: string[] | null | undefined;
276
+ prepaid_fare_id?: string | null | undefined;
277
+ transport_type?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12" | undefined;
278
+ typology?: string | null | undefined;
279
+ }, {
280
+ is_locked?: boolean | undefined;
281
+ updated_by?: string | undefined;
282
+ code?: string | undefined;
283
+ name?: string | undefined;
284
+ agency_id?: string | undefined;
285
+ interchange?: "0" | "1" | "2" | undefined;
286
+ is_circular_line?: boolean | undefined;
287
+ is_continuous_line?: boolean | undefined;
288
+ is_school_line?: boolean | undefined;
289
+ onboard_fare_ids?: string[] | null | undefined;
290
+ prepaid_fare_id?: string | null | undefined;
291
+ transport_type?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12" | undefined;
292
+ typology?: string | null | undefined;
293
+ }>;
294
+ export type Line = z.infer<typeof LineSchema>;
295
+ export type CreateLineDto = z.infer<typeof CreateLineSchema>;
296
+ export type UpdateLineDto = z.infer<typeof UpdateLineSchema>;
@@ -0,0 +1,60 @@
1
+ /* * */
2
+ import { DocumentSchema } from '../_common/document.js';
3
+ import { z } from 'zod';
4
+ import { RouteSimplifiedSchema } from './route.js';
5
+ /* * */
6
+ export const TRANSPORT_TYPE = {
7
+ AERIAL_LIFT: '6', // Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables.
8
+ BUS: '3', // Bus. Used for short- and long-distance bus routes.
9
+ CABLE_TRAM: '5', // Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle (e.g., cable car in San Francisco).
10
+ FERRY: '4', // Ferry. Used for short- and long-distance boat service.
11
+ FUNICULAR: '7', // Funicular. Any rail system designed for steep inclines.
12
+ MONORAIL: '12', // Monorail. Railway in which the track consists of a single rail or a beam.
13
+ RAIL: '2', // Rail. Used for intercity or long-distance travel.
14
+ SUBWAY: '1', // Subway, Metro. Any underground rail system within a metropolitan area
15
+ TRAM: '0', // Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area
16
+ TROLLEYBUS: '11', // Trolleybus. Electric buses that draw power from overhead wires using poles.
17
+ };
18
+ export const transportTypeOptions = [
19
+ { label: 'Teleférico', value: TRANSPORT_TYPE.AERIAL_LIFT },
20
+ { label: 'Autocarro', value: TRANSPORT_TYPE.BUS },
21
+ { label: 'Elétrico', value: TRANSPORT_TYPE.CABLE_TRAM },
22
+ { label: 'Ferry', value: TRANSPORT_TYPE.FERRY },
23
+ { label: 'Funicular', value: TRANSPORT_TYPE.FUNICULAR },
24
+ { label: 'Monocarril', value: TRANSPORT_TYPE.MONORAIL },
25
+ { label: 'Comboio', value: TRANSPORT_TYPE.RAIL },
26
+ { label: 'Metro', value: TRANSPORT_TYPE.SUBWAY },
27
+ { label: 'Elétrico', value: TRANSPORT_TYPE.TRAM },
28
+ { label: 'Trolleybus', value: TRANSPORT_TYPE.TROLLEYBUS },
29
+ ]; // Move this to translations
30
+ export const INTERCHANGE_MODE = {
31
+ CONFIGURED: '2', // Validation transfers should be configured in APEX configuration files
32
+ NONE: '0', // Validation transfers are not allowed
33
+ SAME_OPERATOR: '1', // Validation transfers are allowed only in the same operator
34
+ };
35
+ export const interchangeModeOptions = [
36
+ { label: 'Transbordos não são permitidos', value: INTERCHANGE_MODE.NONE },
37
+ { label: 'Transbordos não são permitidos dentro do mesmo operador', value: INTERCHANGE_MODE.SAME_OPERATOR },
38
+ { label: 'Transbordos devem ser configurados nos ficheiros APEX', value: INTERCHANGE_MODE.CONFIGURED },
39
+ ];
40
+ /* * */
41
+ export const LineSchema = DocumentSchema.extend({
42
+ agency_id: z.string(),
43
+ code: z.string().trim().min(1).max(10),
44
+ interchange: z.nativeEnum(INTERCHANGE_MODE).default(INTERCHANGE_MODE.NONE),
45
+ is_circular_line: z.boolean().default(false),
46
+ is_continuous_line: z.boolean().default(false),
47
+ is_locked: z.boolean().default(false),
48
+ is_school_line: z.boolean().default(false),
49
+ name: z.string().trim().min(1).max(50),
50
+ onboard_fare_ids: z.array(z.string()).nullable().default([]),
51
+ prepaid_fare_id: z.string().nullable().default(null),
52
+ routes: z.array(RouteSimplifiedSchema).optional(), // Computed field, not stored in DB
53
+ transport_type: z.nativeEnum(TRANSPORT_TYPE).default(TRANSPORT_TYPE.BUS),
54
+ typology: z.string().nullable().default(null),
55
+ });
56
+ /* * */
57
+ export const CreateLineSchema = LineSchema.omit({ _id: true, created_at: true, routes: true, updated_at: true });
58
+ export const UpdateLineSchema = CreateLineSchema
59
+ .omit({ created_by: true })
60
+ .partial();