@tmlmobilidade/types 20260121.2332.6 → 20260128.2248.28

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,75 @@
1
+ /* * */
2
+ import { DocumentSchema } from '../_common/document.js';
3
+ import { StopSchema } from '../stops/stop.js';
4
+ import { z } from 'zod';
5
+ import { ScheduleRuleSchema } from './scheduleRule.js';
6
+ /* * */
7
+ export const directionOptions = [
8
+ { label: 'Ida', value: '0' },
9
+ { label: 'Volta', value: '1' },
10
+ ];
11
+ /* * */
12
+ export const PathSchema = z.object({
13
+ _id: z.string(),
14
+ allow_drop_off: z.boolean().default(true),
15
+ allow_pickup: z.boolean().default(true),
16
+ distance_delta: z.number().nullable().default(null),
17
+ stop: StopSchema.nullable().optional(),
18
+ stop_id: z.string(),
19
+ timepoint: z.boolean().default(true),
20
+ zones: z.array(z.string()).optional(),
21
+ });
22
+ /* * */
23
+ export const PatternSchema = DocumentSchema.extend({
24
+ code: z.string().trim().min(1).max(10),
25
+ destination: z.string().trim().min(1).max(100),
26
+ direction: z.enum(['0', '1']).default('0'),
27
+ headsign: z.string().trim().min(1).max(100),
28
+ is_locked: z.boolean().default(false),
29
+ line_id: z.string(),
30
+ origin: z.string().trim().min(1).max(100),
31
+ path: z.array(PathSchema).optional(),
32
+ presets: z.object({
33
+ dwell_time: z.number().default(0),
34
+ velocity: z.number().default(20),
35
+ }).optional(),
36
+ route_id: z.string(),
37
+ rules: z.array(ScheduleRuleSchema).optional().default([]),
38
+ shape: z.object({
39
+ extension: z.number(),
40
+ geojson: z.object({
41
+ geometry: z.object({
42
+ coordinates: z.array(z.array(z.number())),
43
+ type: z.string().default('LineString'),
44
+ }),
45
+ properties: z.object({}).optional(),
46
+ type: z.string().default('Feature'),
47
+ }),
48
+ }).optional(),
49
+ });
50
+ export const PatternSimplifiedSchema = z.object({
51
+ _id: z.string(),
52
+ code: z.string().trim().min(1).max(10),
53
+ headsign: z.string().trim().min(1).max(100),
54
+ line_id: z.string(),
55
+ route_id: z.string(),
56
+ });
57
+ /* * */
58
+ export const CreatePatternSchema = PatternSchema.omit({ _id: true, created_at: true, updated_at: true });
59
+ export const UpdatePatternSchema = CreatePatternSchema
60
+ .omit({ created_by: true })
61
+ .partial();
62
+ /* * */
63
+ /**
64
+ * Pattern with populated stop data (returned by API)
65
+ */
66
+ // export interface PatternWithStops extends Pattern {
67
+ // path?: (Path & {
68
+ // stop?: null | {
69
+ // _id: string
70
+ // latitude: number
71
+ // longitude: number
72
+ // name: string
73
+ // }
74
+ // })[]
75
+ // }
@@ -0,0 +1,187 @@
1
+ import { z } from 'zod';
2
+ export declare const PATH_TYPE: {
3
+ readonly BASE: "0";
4
+ readonly PARCEL: "1";
5
+ readonly VARIANT: "2";
6
+ };
7
+ export declare const pathTypeOptions: ({
8
+ label: string;
9
+ value: "0";
10
+ } | {
11
+ label: string;
12
+ value: "1";
13
+ } | {
14
+ label: string;
15
+ value: "2";
16
+ })[];
17
+ export declare const RouteSchema: z.ZodObject<{
18
+ _id: z.ZodString;
19
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
20
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
21
+ is_locked: z.ZodDefault<z.ZodBoolean>;
22
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
23
+ updated_by: z.ZodOptional<z.ZodString>;
24
+ } & {
25
+ code: z.ZodString;
26
+ line_id: z.ZodString;
27
+ name: z.ZodString;
28
+ path_type: z.ZodDefault<z.ZodNativeEnum<{
29
+ readonly BASE: "0";
30
+ readonly PARCEL: "1";
31
+ readonly VARIANT: "2";
32
+ }>>;
33
+ patterns: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ _id: z.ZodString;
35
+ code: z.ZodString;
36
+ headsign: z.ZodString;
37
+ line_id: z.ZodString;
38
+ route_id: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ _id: string;
41
+ code: string;
42
+ line_id: string;
43
+ headsign: string;
44
+ route_id: string;
45
+ }, {
46
+ _id: string;
47
+ code: string;
48
+ line_id: string;
49
+ headsign: string;
50
+ route_id: string;
51
+ }>, "many">>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ _id: string;
54
+ created_at: number & {
55
+ __brand: "UnixTimestamp";
56
+ };
57
+ created_by: string | null;
58
+ is_locked: boolean;
59
+ updated_at: number & {
60
+ __brand: "UnixTimestamp";
61
+ };
62
+ code: string;
63
+ name: string;
64
+ line_id: string;
65
+ path_type: "0" | "1" | "2";
66
+ updated_by?: string | undefined;
67
+ patterns?: {
68
+ _id: string;
69
+ code: string;
70
+ line_id: string;
71
+ headsign: string;
72
+ route_id: string;
73
+ }[] | undefined;
74
+ }, {
75
+ _id: string;
76
+ created_at: number;
77
+ updated_at: number;
78
+ code: string;
79
+ name: string;
80
+ line_id: string;
81
+ created_by?: string | null | undefined;
82
+ is_locked?: boolean | undefined;
83
+ updated_by?: string | undefined;
84
+ path_type?: "0" | "1" | "2" | undefined;
85
+ patterns?: {
86
+ _id: string;
87
+ code: string;
88
+ line_id: string;
89
+ headsign: string;
90
+ route_id: string;
91
+ }[] | undefined;
92
+ }>;
93
+ export declare const RouteSimplifiedSchema: z.ZodObject<{
94
+ _id: z.ZodString;
95
+ code: z.ZodString;
96
+ name: z.ZodString;
97
+ }, "strip", z.ZodTypeAny, {
98
+ _id: string;
99
+ code: string;
100
+ name: string;
101
+ }, {
102
+ _id: string;
103
+ code: string;
104
+ name: string;
105
+ }>;
106
+ export declare const CreateRouteSchema: z.ZodObject<Omit<{
107
+ _id: z.ZodString;
108
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
109
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
110
+ is_locked: z.ZodDefault<z.ZodBoolean>;
111
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
112
+ updated_by: z.ZodOptional<z.ZodString>;
113
+ } & {
114
+ code: z.ZodString;
115
+ line_id: z.ZodString;
116
+ name: z.ZodString;
117
+ path_type: z.ZodDefault<z.ZodNativeEnum<{
118
+ readonly BASE: "0";
119
+ readonly PARCEL: "1";
120
+ readonly VARIANT: "2";
121
+ }>>;
122
+ patterns: z.ZodOptional<z.ZodArray<z.ZodObject<{
123
+ _id: z.ZodString;
124
+ code: z.ZodString;
125
+ headsign: z.ZodString;
126
+ line_id: z.ZodString;
127
+ route_id: z.ZodString;
128
+ }, "strip", z.ZodTypeAny, {
129
+ _id: string;
130
+ code: string;
131
+ line_id: string;
132
+ headsign: string;
133
+ route_id: string;
134
+ }, {
135
+ _id: string;
136
+ code: string;
137
+ line_id: string;
138
+ headsign: string;
139
+ route_id: string;
140
+ }>, "many">>;
141
+ }, "_id" | "created_at" | "updated_at" | "patterns">, "strip", z.ZodTypeAny, {
142
+ created_by: string | null;
143
+ is_locked: boolean;
144
+ code: string;
145
+ name: string;
146
+ line_id: string;
147
+ path_type: "0" | "1" | "2";
148
+ updated_by?: string | undefined;
149
+ }, {
150
+ code: string;
151
+ name: string;
152
+ line_id: string;
153
+ created_by?: string | null | undefined;
154
+ is_locked?: boolean | undefined;
155
+ updated_by?: string | undefined;
156
+ path_type?: "0" | "1" | "2" | undefined;
157
+ }>;
158
+ export declare const UpdateRouteSchema: z.ZodObject<{
159
+ is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
160
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
161
+ code: z.ZodOptional<z.ZodString>;
162
+ name: z.ZodOptional<z.ZodString>;
163
+ line_id: z.ZodOptional<z.ZodString>;
164
+ path_type: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<{
165
+ readonly BASE: "0";
166
+ readonly PARCEL: "1";
167
+ readonly VARIANT: "2";
168
+ }>>>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ is_locked?: boolean | undefined;
171
+ updated_by?: string | undefined;
172
+ code?: string | undefined;
173
+ name?: string | undefined;
174
+ line_id?: string | undefined;
175
+ path_type?: "0" | "1" | "2" | undefined;
176
+ }, {
177
+ is_locked?: boolean | undefined;
178
+ updated_by?: string | undefined;
179
+ code?: string | undefined;
180
+ name?: string | undefined;
181
+ line_id?: string | undefined;
182
+ path_type?: "0" | "1" | "2" | undefined;
183
+ }>;
184
+ export type Route = z.infer<typeof RouteSchema>;
185
+ export type CreateRouteDto = z.infer<typeof CreateRouteSchema>;
186
+ export type UpdateRouteDto = z.infer<typeof UpdateRouteSchema>;
187
+ export type RouteSimplified = z.infer<typeof RouteSimplifiedSchema>;
@@ -0,0 +1,33 @@
1
+ /* * */
2
+ import { DocumentSchema } from '../_common/document.js';
3
+ import { z } from 'zod';
4
+ import { PatternSimplifiedSchema } from './pattern.js';
5
+ /* * */
6
+ export const PATH_TYPE = {
7
+ BASE: '0',
8
+ PARCEL: '1',
9
+ VARIANT: '2',
10
+ };
11
+ export const pathTypeOptions = [
12
+ { label: 'Rota Base (Principal)', value: PATH_TYPE.BASE },
13
+ { label: 'Parcelar', value: PATH_TYPE.PARCEL },
14
+ { label: 'Variante', value: PATH_TYPE.VARIANT },
15
+ ];
16
+ /* * */
17
+ export const RouteSchema = DocumentSchema.extend({
18
+ code: z.string().trim().min(1).max(10),
19
+ line_id: z.string(),
20
+ name: z.string().trim().min(1).max(50),
21
+ path_type: z.nativeEnum(PATH_TYPE).default(PATH_TYPE.BASE),
22
+ patterns: z.array(PatternSimplifiedSchema).optional(),
23
+ });
24
+ export const RouteSimplifiedSchema = z.object({
25
+ _id: z.string(),
26
+ code: z.string().trim().min(1).max(10),
27
+ name: z.string().trim().min(1).max(50),
28
+ });
29
+ /* * */
30
+ export const CreateRouteSchema = RouteSchema.omit({ _id: true, created_at: true, patterns: true, updated_at: true });
31
+ export const UpdateRouteSchema = CreateRouteSchema
32
+ .omit({ created_by: true })
33
+ .partial();
@@ -0,0 +1,80 @@
1
+ import { z } from 'zod';
2
+ export declare enum OPERATING_MODE {
3
+ EXCLUDE = "exclude",
4
+ INCLUDE = "include"
5
+ }
6
+ export declare const ScheduleRuleSchema: z.ZodObject<{
7
+ _id: z.ZodOptional<z.ZodString>;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ operatingMode: z.ZodNativeEnum<typeof OPERATING_MODE>;
10
+ periodIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ weekdays: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
12
+ readonly Fri: 5;
13
+ readonly Mon: 1;
14
+ readonly Sat: 6;
15
+ readonly Sun: 7;
16
+ readonly Thu: 4;
17
+ readonly Tue: 2;
18
+ readonly Wed: 3;
19
+ }>, "many">>;
20
+ holidays: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
21
+ mode: z.ZodLiteral<"ignore">;
22
+ }, "strip", z.ZodTypeAny, {
23
+ mode: "ignore";
24
+ }, {
25
+ mode: "ignore";
26
+ }>, z.ZodObject<{
27
+ mode: z.ZodLiteral<"all">;
28
+ }, "strip", z.ZodTypeAny, {
29
+ mode: "all";
30
+ }, {
31
+ mode: "all";
32
+ }>, z.ZodObject<{
33
+ ids: z.ZodArray<z.ZodString, "many">;
34
+ mode: z.ZodLiteral<"specific">;
35
+ }, "strip", z.ZodTypeAny, {
36
+ mode: "specific";
37
+ ids: string[];
38
+ }, {
39
+ mode: "specific";
40
+ ids: string[];
41
+ }>]>>;
42
+ events: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
+ travelTime: z.ZodOptional<z.ZodString>;
44
+ timePoints: z.ZodArray<z.ZodString, "many">;
45
+ }, "strip", z.ZodTypeAny, {
46
+ operatingMode: OPERATING_MODE;
47
+ timePoints: string[];
48
+ _id?: string | undefined;
49
+ name?: string | undefined;
50
+ periodIds?: string[] | undefined;
51
+ weekdays?: (1 | 2 | 3 | 5 | 4 | 6 | 7)[] | undefined;
52
+ holidays?: {
53
+ mode: "ignore";
54
+ } | {
55
+ mode: "all";
56
+ } | {
57
+ mode: "specific";
58
+ ids: string[];
59
+ } | undefined;
60
+ events?: string[] | undefined;
61
+ travelTime?: string | undefined;
62
+ }, {
63
+ operatingMode: OPERATING_MODE;
64
+ timePoints: string[];
65
+ _id?: string | undefined;
66
+ name?: string | undefined;
67
+ periodIds?: string[] | undefined;
68
+ weekdays?: (1 | 2 | 3 | 5 | 4 | 6 | 7)[] | undefined;
69
+ holidays?: {
70
+ mode: "ignore";
71
+ } | {
72
+ mode: "all";
73
+ } | {
74
+ mode: "specific";
75
+ ids: string[];
76
+ } | undefined;
77
+ events?: string[] | undefined;
78
+ travelTime?: string | undefined;
79
+ }>;
80
+ export type ScheduleRule = z.infer<typeof ScheduleRuleSchema>;
@@ -0,0 +1,50 @@
1
+ // interface Rule {
2
+ // operatingMode: 'include' | 'exclude'; // include = schedules operate, exclude = schedules do not operate
3
+ // periodIds: string[]; // e.g., ["escolar", "ferias"]
4
+ // weekdays?: string[]; // ["Mon", "Tue", ...], optional
5
+ // holidays?: {
6
+ // all?: boolean; // applies to all holidays
7
+ // specific?: string[]; // holidayIds this rule applies to
8
+ // };
9
+ // events?: string[]; // list of event IDs or names this rule applies to
10
+ // travelTime?: string; // optional travel info
11
+ // }
12
+ import { WEEKDAYS } from '../dates/date.js';
13
+ import { z } from 'zod';
14
+ /* * */
15
+ export var OPERATING_MODE;
16
+ (function (OPERATING_MODE) {
17
+ OPERATING_MODE["EXCLUDE"] = "exclude";
18
+ OPERATING_MODE["INCLUDE"] = "include";
19
+ })(OPERATING_MODE || (OPERATING_MODE = {}));
20
+ // Holidays schema
21
+ const HolidaysSchema = z.discriminatedUnion('mode', [
22
+ z.object({
23
+ mode: z.literal('ignore'),
24
+ }),
25
+ z.object({
26
+ mode: z.literal('all'),
27
+ }),
28
+ z.object({
29
+ ids: z.array(z.string()).min(1),
30
+ mode: z.literal('specific'),
31
+ }),
32
+ ]);
33
+ /* * */
34
+ export const ScheduleRuleSchema = z.object({
35
+ _id: z.string().optional(), // Client-side ID for tracking
36
+ name: z.string().optional(),
37
+ operatingMode: z.nativeEnum(OPERATING_MODE),
38
+ // Can reference multiple periods by ID
39
+ periodIds: z.array(z.string()).optional(),
40
+ // Optional weekdays filter
41
+ weekdays: z.array(z.nativeEnum(WEEKDAYS)).optional(),
42
+ // Optional holidays filter
43
+ holidays: HolidaysSchema.optional(),
44
+ // Optional events
45
+ events: z.array(z.string()).optional(),
46
+ // Optional travel time
47
+ travelTime: z.string().optional(),
48
+ // Optional timepoints when this rule applies (HH:mm format)
49
+ timePoints: z.array(z.string().regex(/^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/)),
50
+ });
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ export declare const TypologySchema: z.ZodObject<{
3
+ _id: z.ZodString;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
5
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("../index.js").UnixTimestamp, number>;
7
+ updated_by: z.ZodOptional<z.ZodString>;
8
+ } & {
9
+ agency_ids: z.ZodArray<z.ZodString, "many">;
10
+ code: z.ZodString;
11
+ color: z.ZodString;
12
+ default_onboard_fare_ids: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
13
+ default_prepaid_fare_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14
+ is_locked: z.ZodDefault<z.ZodBoolean>;
15
+ name: z.ZodString;
16
+ text_color: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ _id: string;
19
+ created_at: number & {
20
+ __brand: "UnixTimestamp";
21
+ };
22
+ created_by: string | null;
23
+ is_locked: boolean;
24
+ updated_at: number & {
25
+ __brand: "UnixTimestamp";
26
+ };
27
+ code: string;
28
+ name: string;
29
+ agency_ids: string[];
30
+ color: string;
31
+ default_onboard_fare_ids: string[] | null;
32
+ default_prepaid_fare_id: string | null;
33
+ text_color: string;
34
+ updated_by?: string | undefined;
35
+ }, {
36
+ _id: string;
37
+ created_at: number;
38
+ updated_at: number;
39
+ code: string;
40
+ name: string;
41
+ agency_ids: string[];
42
+ color: string;
43
+ text_color: string;
44
+ created_by?: string | null | undefined;
45
+ is_locked?: boolean | undefined;
46
+ updated_by?: string | undefined;
47
+ default_onboard_fare_ids?: string[] | null | undefined;
48
+ default_prepaid_fare_id?: string | null | undefined;
49
+ }>;
50
+ export declare const CreateTypologySchema: z.ZodObject<{
51
+ agency_ids: z.ZodArray<z.ZodString, "many">;
52
+ code: z.ZodString;
53
+ name: z.ZodString;
54
+ } & {
55
+ _id: z.ZodOptional<z.ZodString>;
56
+ created_by: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
57
+ is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
58
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
59
+ color: z.ZodOptional<z.ZodString>;
60
+ default_onboard_fare_ids: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>>;
61
+ default_prepaid_fare_id: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
62
+ text_color: z.ZodOptional<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ code: string;
65
+ name: string;
66
+ agency_ids: string[];
67
+ _id?: string | undefined;
68
+ created_by?: string | null | undefined;
69
+ is_locked?: boolean | undefined;
70
+ updated_by?: string | undefined;
71
+ color?: string | undefined;
72
+ default_onboard_fare_ids?: string[] | null | undefined;
73
+ default_prepaid_fare_id?: string | null | undefined;
74
+ text_color?: string | undefined;
75
+ }, {
76
+ code: string;
77
+ name: string;
78
+ agency_ids: string[];
79
+ _id?: string | undefined;
80
+ created_by?: string | null | undefined;
81
+ is_locked?: boolean | undefined;
82
+ updated_by?: string | undefined;
83
+ color?: string | undefined;
84
+ default_onboard_fare_ids?: string[] | null | undefined;
85
+ default_prepaid_fare_id?: string | null | undefined;
86
+ text_color?: string | undefined;
87
+ }>;
88
+ export declare const UpdateTypologySchema: z.ZodObject<{
89
+ _id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
90
+ is_locked: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodBoolean>>>;
91
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodString>>>;
92
+ code: z.ZodOptional<z.ZodString>;
93
+ name: z.ZodOptional<z.ZodString>;
94
+ agency_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
95
+ color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
96
+ default_onboard_fare_ids: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>>>;
97
+ default_prepaid_fare_id: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>>;
98
+ text_color: z.ZodOptional<z.ZodOptional<z.ZodString>>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ _id?: string | undefined;
101
+ is_locked?: boolean | undefined;
102
+ updated_by?: string | undefined;
103
+ code?: string | undefined;
104
+ name?: string | undefined;
105
+ agency_ids?: string[] | undefined;
106
+ color?: string | undefined;
107
+ default_onboard_fare_ids?: string[] | null | undefined;
108
+ default_prepaid_fare_id?: string | null | undefined;
109
+ text_color?: string | undefined;
110
+ }, {
111
+ _id?: string | undefined;
112
+ is_locked?: boolean | undefined;
113
+ updated_by?: string | undefined;
114
+ code?: string | undefined;
115
+ name?: string | undefined;
116
+ agency_ids?: string[] | undefined;
117
+ color?: string | undefined;
118
+ default_onboard_fare_ids?: string[] | null | undefined;
119
+ default_prepaid_fare_id?: string | null | undefined;
120
+ text_color?: string | undefined;
121
+ }>;
122
+ export type Typology = z.infer<typeof TypologySchema>;
123
+ export type CreateTypologyDto = z.infer<typeof CreateTypologySchema>;
124
+ export type UpdateTypologyDto = z.infer<typeof UpdateTypologySchema>;
@@ -0,0 +1,30 @@
1
+ /* * */
2
+ import { DocumentSchema } from '../_common/document.js';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const TypologySchema = DocumentSchema.extend({
6
+ agency_ids: z.array(z.string()).min(1, 'At least one agency ID is required'),
7
+ code: z.string().trim().min(1).max(10),
8
+ color: z.string().trim().min(1).max(7), // Hex color code
9
+ default_onboard_fare_ids: z.array(z.string()).nullable().default(null),
10
+ default_prepaid_fare_id: z.string().nullable().default(null),
11
+ is_locked: z.boolean().default(false),
12
+ name: z.string().trim().min(1).max(50),
13
+ text_color: z.string().trim().min(1).max(7), // Hex color code
14
+ });
15
+ /* * */
16
+ // Only name, code, and agency_ids are required for creation
17
+ export const CreateTypologySchema = z.object({
18
+ agency_ids: TypologySchema.shape.agency_ids,
19
+ code: TypologySchema.shape.code,
20
+ name: TypologySchema.shape.name,
21
+ }).merge(TypologySchema.omit({
22
+ agency_ids: true,
23
+ code: true,
24
+ created_at: true,
25
+ name: true,
26
+ updated_at: true,
27
+ }).partial());
28
+ export const UpdateTypologySchema = CreateTypologySchema
29
+ .omit({ created_by: true })
30
+ .partial();