@tmlmobilidade/types 20251009.1616.57 → 20251009.1628.1

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.
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './src/file.js';
6
6
  export * from './src/gtfs.js';
7
7
  export * from './src/gtfs/index.js';
8
8
  export * from './src/locations.js';
9
+ export * from './src/metrics/index.js';
9
10
  export * from './src/notification.js';
10
11
  export * from './src/organization.js';
11
12
  export * from './src/pcgi/index.js';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './src/file.js';
9
9
  export * from './src/gtfs.js';
10
10
  export * from './src/gtfs/index.js';
11
11
  export * from './src/locations.js';
12
+ export * from './src/metrics/index.js';
12
13
  export * from './src/notification.js';
13
14
  export * from './src/organization.js';
14
15
  export * from './src/pcgi/index.js';
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ export declare const TimeGranularitySchema: z.ZodEnum<["daily", "monthly", "yearly", "custom"]>;
3
+ export type TimeGranularity = z.infer<typeof TimeGranularitySchema>;
4
+ export declare const MetricScopeSchema: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
5
+ export type MetricScope = z.infer<typeof MetricScopeSchema>;
6
+ export declare const MetricsSchema: z.ZodEnum<["demand_by_line"]>;
7
+ export type Metrics = z.infer<typeof MetricsSchema>;
8
+ export declare const MetricBasePropertiesSchema: z.ZodObject<{
9
+ interval: z.ZodNumber;
10
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ interval: number;
13
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
14
+ }, {
15
+ interval: number;
16
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
17
+ }>;
18
+ export declare const MetricBaseSchema: z.ZodObject<{
19
+ _id: z.ZodString;
20
+ description: z.ZodOptional<z.ZodString>;
21
+ generated_at: z.ZodDate;
22
+ metric: z.ZodEnum<["demand_by_line"]>;
23
+ properties: z.ZodObject<{
24
+ interval: z.ZodNumber;
25
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ interval: number;
28
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
29
+ }, {
30
+ interval: number;
31
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
32
+ }>;
33
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ _id: string;
36
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
37
+ properties: {
38
+ interval: number;
39
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
40
+ };
41
+ generated_at: Date;
42
+ metric: "demand_by_line";
43
+ description?: string | undefined;
44
+ }, {
45
+ _id: string;
46
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
47
+ properties: {
48
+ interval: number;
49
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
50
+ };
51
+ generated_at: Date;
52
+ metric: "demand_by_line";
53
+ description?: string | undefined;
54
+ }>;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ /* * */
3
+ const TIME_GRANULARITY_VALUES = ['daily', 'monthly', 'yearly', 'custom'];
4
+ export const TimeGranularitySchema = z.enum(TIME_GRANULARITY_VALUES);
5
+ /* * */
6
+ const METRIC_SCOPE_VALUES = ['service_compliance', 'resource_management', 'demand', 'contract_compliance', 'financial'];
7
+ export const MetricScopeSchema = z.enum(METRIC_SCOPE_VALUES);
8
+ /* * */
9
+ const METRIC_VALUES = ['demand_by_line'];
10
+ export const MetricsSchema = z.enum(METRIC_VALUES);
11
+ /* * */
12
+ export const MetricBasePropertiesSchema = z.object({
13
+ interval: z.number(),
14
+ time_granularity: TimeGranularitySchema.optional(),
15
+ });
16
+ export const MetricBaseSchema = z.object({
17
+ _id: z.string(),
18
+ description: z.string().optional(),
19
+ generated_at: z.date(),
20
+ metric: MetricsSchema,
21
+ properties: MetricBasePropertiesSchema,
22
+ scope: MetricScopeSchema,
23
+ });
@@ -0,0 +1,115 @@
1
+ import { z } from 'zod';
2
+ export declare const DemandByLineByYearSchema: z.ZodObject<{
3
+ _id: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ generated_at: z.ZodDate;
6
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
7
+ } & {
8
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
9
+ qty: z.ZodNumber;
10
+ }, "strip", z.ZodTypeAny, {
11
+ qty: number;
12
+ }, {
13
+ qty: number;
14
+ }>>;
15
+ metric: z.ZodLiteral<"demand_by_line_by_year">;
16
+ properties: z.ZodObject<{
17
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
18
+ } & {
19
+ interval: z.ZodLiteral<300000>;
20
+ line_id: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ line_id: string;
23
+ interval: 300000;
24
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
25
+ }, {
26
+ line_id: string;
27
+ interval: 300000;
28
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
29
+ }>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ _id: string;
32
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
33
+ properties: {
34
+ line_id: string;
35
+ interval: 300000;
36
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
37
+ };
38
+ generated_at: Date;
39
+ metric: "demand_by_line_by_year";
40
+ data: Record<string, {
41
+ qty: number;
42
+ }>;
43
+ description?: string | undefined;
44
+ }, {
45
+ _id: string;
46
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
47
+ properties: {
48
+ line_id: string;
49
+ interval: 300000;
50
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
51
+ };
52
+ generated_at: Date;
53
+ metric: "demand_by_line_by_year";
54
+ data: Record<string, {
55
+ qty: number;
56
+ }>;
57
+ description?: string | undefined;
58
+ }>;
59
+ export declare const DemandByLineByMonthSchema: z.ZodObject<{
60
+ _id: z.ZodString;
61
+ description: z.ZodOptional<z.ZodString>;
62
+ generated_at: z.ZodDate;
63
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
64
+ } & {
65
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
66
+ qty: z.ZodNumber;
67
+ }, "strip", z.ZodTypeAny, {
68
+ qty: number;
69
+ }, {
70
+ qty: number;
71
+ }>>;
72
+ metric: z.ZodLiteral<"demand_by_line_by_month">;
73
+ properties: z.ZodObject<{
74
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
75
+ } & {
76
+ interval: z.ZodLiteral<300000>;
77
+ line_id: z.ZodString;
78
+ }, "strip", z.ZodTypeAny, {
79
+ line_id: string;
80
+ interval: 300000;
81
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
82
+ }, {
83
+ line_id: string;
84
+ interval: 300000;
85
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
86
+ }>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ _id: string;
89
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
90
+ properties: {
91
+ line_id: string;
92
+ interval: 300000;
93
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
94
+ };
95
+ generated_at: Date;
96
+ metric: "demand_by_line_by_month";
97
+ data: Record<string, {
98
+ qty: number;
99
+ }>;
100
+ description?: string | undefined;
101
+ }, {
102
+ _id: string;
103
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
104
+ properties: {
105
+ line_id: string;
106
+ interval: 300000;
107
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
108
+ };
109
+ generated_at: Date;
110
+ metric: "demand_by_line_by_month";
111
+ data: Record<string, {
112
+ qty: number;
113
+ }>;
114
+ description?: string | undefined;
115
+ }>;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ /* * */
3
+ import { MetricBasePropertiesSchema, MetricBaseSchema } from './common.js';
4
+ // /metrics/demand_by_line_by_year?line=4701
5
+ export const DemandByLineByYearSchema = MetricBaseSchema.extend({
6
+ data: z.record(z.string(), // e.g. "2024", "2025"
7
+ z.object({
8
+ qty: z.number(),
9
+ })),
10
+ metric: z.literal('demand_by_line_by_year'),
11
+ properties: MetricBasePropertiesSchema.extend({
12
+ interval: z.literal(300000),
13
+ line_id: z.string(),
14
+ }),
15
+ });
16
+ export const DemandByLineByMonthSchema = MetricBaseSchema.extend({
17
+ data: z.record(z.string(), // e.g. "2024-01", "2024-02"
18
+ z.object({
19
+ qty: z.number(),
20
+ })),
21
+ metric: z.literal('demand_by_line_by_month'),
22
+ properties: MetricBasePropertiesSchema.extend({
23
+ interval: z.literal(300000),
24
+ line_id: z.string(),
25
+ }),
26
+ });
27
+ /* * */
@@ -0,0 +1,331 @@
1
+ import { z } from 'zod';
2
+ export declare const MetricSchema: z.ZodDiscriminatedUnion<"metric", [z.ZodObject<{
3
+ _id: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ generated_at: z.ZodDate;
6
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
7
+ } & {
8
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
9
+ qty: z.ZodNumber;
10
+ }, "strip", z.ZodTypeAny, {
11
+ qty: number;
12
+ }, {
13
+ qty: number;
14
+ }>>;
15
+ metric: z.ZodLiteral<"demand_by_line_by_year">;
16
+ properties: z.ZodObject<{
17
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
18
+ } & {
19
+ interval: z.ZodLiteral<300000>;
20
+ line_id: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ line_id: string;
23
+ interval: 300000;
24
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
25
+ }, {
26
+ line_id: string;
27
+ interval: 300000;
28
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
29
+ }>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ _id: string;
32
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
33
+ properties: {
34
+ line_id: string;
35
+ interval: 300000;
36
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
37
+ };
38
+ generated_at: Date;
39
+ metric: "demand_by_line_by_year";
40
+ data: Record<string, {
41
+ qty: number;
42
+ }>;
43
+ description?: string | undefined;
44
+ }, {
45
+ _id: string;
46
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
47
+ properties: {
48
+ line_id: string;
49
+ interval: 300000;
50
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
51
+ };
52
+ generated_at: Date;
53
+ metric: "demand_by_line_by_year";
54
+ data: Record<string, {
55
+ qty: number;
56
+ }>;
57
+ description?: string | undefined;
58
+ }>, z.ZodObject<{
59
+ _id: z.ZodString;
60
+ description: z.ZodOptional<z.ZodString>;
61
+ generated_at: z.ZodDate;
62
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
63
+ } & {
64
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
65
+ qty: z.ZodNumber;
66
+ }, "strip", z.ZodTypeAny, {
67
+ qty: number;
68
+ }, {
69
+ qty: number;
70
+ }>>;
71
+ metric: z.ZodLiteral<"demand_by_line_by_month">;
72
+ properties: z.ZodObject<{
73
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
74
+ } & {
75
+ interval: z.ZodLiteral<300000>;
76
+ line_id: z.ZodString;
77
+ }, "strip", z.ZodTypeAny, {
78
+ line_id: string;
79
+ interval: 300000;
80
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
81
+ }, {
82
+ line_id: string;
83
+ interval: 300000;
84
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
85
+ }>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ _id: string;
88
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
89
+ properties: {
90
+ line_id: string;
91
+ interval: 300000;
92
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
93
+ };
94
+ generated_at: Date;
95
+ metric: "demand_by_line_by_month";
96
+ data: Record<string, {
97
+ qty: number;
98
+ }>;
99
+ description?: string | undefined;
100
+ }, {
101
+ _id: string;
102
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
103
+ properties: {
104
+ line_id: string;
105
+ interval: 300000;
106
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
107
+ };
108
+ generated_at: Date;
109
+ metric: "demand_by_line_by_month";
110
+ data: Record<string, {
111
+ qty: number;
112
+ }>;
113
+ description?: string | undefined;
114
+ }>]>;
115
+ export declare const CreateMetricSchema: z.ZodDiscriminatedUnion<"metric", [z.ZodObject<Omit<{
116
+ _id: z.ZodString;
117
+ description: z.ZodOptional<z.ZodString>;
118
+ generated_at: z.ZodDate;
119
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
120
+ } & {
121
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
122
+ qty: z.ZodNumber;
123
+ }, "strip", z.ZodTypeAny, {
124
+ qty: number;
125
+ }, {
126
+ qty: number;
127
+ }>>;
128
+ metric: z.ZodLiteral<"demand_by_line_by_year">;
129
+ properties: z.ZodObject<{
130
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
131
+ } & {
132
+ interval: z.ZodLiteral<300000>;
133
+ line_id: z.ZodString;
134
+ }, "strip", z.ZodTypeAny, {
135
+ line_id: string;
136
+ interval: 300000;
137
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
138
+ }, {
139
+ line_id: string;
140
+ interval: 300000;
141
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
142
+ }>;
143
+ }, "_id">, "strip", z.ZodTypeAny, {
144
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
145
+ properties: {
146
+ line_id: string;
147
+ interval: 300000;
148
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
149
+ };
150
+ generated_at: Date;
151
+ metric: "demand_by_line_by_year";
152
+ data: Record<string, {
153
+ qty: number;
154
+ }>;
155
+ description?: string | undefined;
156
+ }, {
157
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
158
+ properties: {
159
+ line_id: string;
160
+ interval: 300000;
161
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
162
+ };
163
+ generated_at: Date;
164
+ metric: "demand_by_line_by_year";
165
+ data: Record<string, {
166
+ qty: number;
167
+ }>;
168
+ description?: string | undefined;
169
+ }>, z.ZodObject<Omit<{
170
+ _id: z.ZodString;
171
+ description: z.ZodOptional<z.ZodString>;
172
+ generated_at: z.ZodDate;
173
+ scope: z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>;
174
+ } & {
175
+ data: z.ZodRecord<z.ZodString, z.ZodObject<{
176
+ qty: z.ZodNumber;
177
+ }, "strip", z.ZodTypeAny, {
178
+ qty: number;
179
+ }, {
180
+ qty: number;
181
+ }>>;
182
+ metric: z.ZodLiteral<"demand_by_line_by_month">;
183
+ properties: z.ZodObject<{
184
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
185
+ } & {
186
+ interval: z.ZodLiteral<300000>;
187
+ line_id: z.ZodString;
188
+ }, "strip", z.ZodTypeAny, {
189
+ line_id: string;
190
+ interval: 300000;
191
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
192
+ }, {
193
+ line_id: string;
194
+ interval: 300000;
195
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
196
+ }>;
197
+ }, "_id">, "strip", z.ZodTypeAny, {
198
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
199
+ properties: {
200
+ line_id: string;
201
+ interval: 300000;
202
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
203
+ };
204
+ generated_at: Date;
205
+ metric: "demand_by_line_by_month";
206
+ data: Record<string, {
207
+ qty: number;
208
+ }>;
209
+ description?: string | undefined;
210
+ }, {
211
+ scope: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial";
212
+ properties: {
213
+ line_id: string;
214
+ interval: 300000;
215
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
216
+ };
217
+ generated_at: Date;
218
+ metric: "demand_by_line_by_month";
219
+ data: Record<string, {
220
+ qty: number;
221
+ }>;
222
+ description?: string | undefined;
223
+ }>]>;
224
+ export declare const UpdateMetricSchema: z.ZodDiscriminatedUnion<"metric", [z.ZodObject<{
225
+ scope: z.ZodOptional<z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>>;
226
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
227
+ properties: z.ZodOptional<z.ZodObject<{
228
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
229
+ } & {
230
+ interval: z.ZodLiteral<300000>;
231
+ line_id: z.ZodString;
232
+ }, "strip", z.ZodTypeAny, {
233
+ line_id: string;
234
+ interval: 300000;
235
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
236
+ }, {
237
+ line_id: string;
238
+ interval: 300000;
239
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
240
+ }>>;
241
+ generated_at: z.ZodOptional<z.ZodDate>;
242
+ metric: z.ZodOptional<z.ZodLiteral<"demand_by_line_by_year">>;
243
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
244
+ qty: z.ZodNumber;
245
+ }, "strip", z.ZodTypeAny, {
246
+ qty: number;
247
+ }, {
248
+ qty: number;
249
+ }>>>;
250
+ }, "strip", z.ZodTypeAny, {
251
+ scope?: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial" | undefined;
252
+ description?: string | undefined;
253
+ properties?: {
254
+ line_id: string;
255
+ interval: 300000;
256
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
257
+ } | undefined;
258
+ generated_at?: Date | undefined;
259
+ metric?: "demand_by_line_by_year" | undefined;
260
+ data?: Record<string, {
261
+ qty: number;
262
+ }> | undefined;
263
+ }, {
264
+ scope?: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial" | undefined;
265
+ description?: string | undefined;
266
+ properties?: {
267
+ line_id: string;
268
+ interval: 300000;
269
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
270
+ } | undefined;
271
+ generated_at?: Date | undefined;
272
+ metric?: "demand_by_line_by_year" | undefined;
273
+ data?: Record<string, {
274
+ qty: number;
275
+ }> | undefined;
276
+ }>, z.ZodObject<{
277
+ scope: z.ZodOptional<z.ZodEnum<["service_compliance", "resource_management", "demand", "contract_compliance", "financial"]>>;
278
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
279
+ properties: z.ZodOptional<z.ZodObject<{
280
+ time_granularity: z.ZodOptional<z.ZodEnum<["daily", "monthly", "yearly", "custom"]>>;
281
+ } & {
282
+ interval: z.ZodLiteral<300000>;
283
+ line_id: z.ZodString;
284
+ }, "strip", z.ZodTypeAny, {
285
+ line_id: string;
286
+ interval: 300000;
287
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
288
+ }, {
289
+ line_id: string;
290
+ interval: 300000;
291
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
292
+ }>>;
293
+ generated_at: z.ZodOptional<z.ZodDate>;
294
+ metric: z.ZodOptional<z.ZodLiteral<"demand_by_line_by_month">>;
295
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
296
+ qty: z.ZodNumber;
297
+ }, "strip", z.ZodTypeAny, {
298
+ qty: number;
299
+ }, {
300
+ qty: number;
301
+ }>>>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ scope?: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial" | undefined;
304
+ description?: string | undefined;
305
+ properties?: {
306
+ line_id: string;
307
+ interval: 300000;
308
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
309
+ } | undefined;
310
+ generated_at?: Date | undefined;
311
+ metric?: "demand_by_line_by_month" | undefined;
312
+ data?: Record<string, {
313
+ qty: number;
314
+ }> | undefined;
315
+ }, {
316
+ scope?: "service_compliance" | "resource_management" | "demand" | "contract_compliance" | "financial" | undefined;
317
+ description?: string | undefined;
318
+ properties?: {
319
+ line_id: string;
320
+ interval: 300000;
321
+ time_granularity?: "custom" | "daily" | "monthly" | "yearly" | undefined;
322
+ } | undefined;
323
+ generated_at?: Date | undefined;
324
+ metric?: "demand_by_line_by_month" | undefined;
325
+ data?: Record<string, {
326
+ qty: number;
327
+ }> | undefined;
328
+ }>]>;
329
+ export type Metric = z.infer<typeof MetricSchema>;
330
+ export type CreateMetricDto = z.infer<typeof CreateMetricSchema>;
331
+ export type UpdateMetricDto = z.infer<typeof UpdateMetricSchema>;
@@ -0,0 +1,15 @@
1
+ import { DemandByLineByMonthSchema, DemandByLineByYearSchema } from './demand.js';
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const MetricSchema = z.discriminatedUnion('metric', [
5
+ DemandByLineByYearSchema,
6
+ DemandByLineByMonthSchema,
7
+ ]);
8
+ export const CreateMetricSchema = z.discriminatedUnion('metric', [
9
+ DemandByLineByYearSchema.omit({ _id: true }),
10
+ DemandByLineByMonthSchema.omit({ _id: true }),
11
+ ]);
12
+ export const UpdateMetricSchema = z.discriminatedUnion('metric', [
13
+ DemandByLineByYearSchema.omit({ _id: true }).partial(),
14
+ DemandByLineByMonthSchema.omit({ _id: true }).partial(),
15
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20251009.1616.57",
3
+ "version": "20251009.1628.1",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",