@tmlmobilidade/types 20260506.2129.32 → 20260507.1753.34

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.
@@ -66,8 +66,8 @@ export const CommentSchema = z
66
66
  });
67
67
  }
68
68
  }
69
- // If field is NOT 'multiple_fields', curr_value and prev_value must differ
70
69
  else if (data.curr_value === data.prev_value) {
70
+ // If field is NOT 'multiple_fields', curr_value and prev_value must differ
71
71
  ctx.addIssue({
72
72
  code: z.ZodIssueCode.custom,
73
73
  message: 'curr_value and prev_value must differ',
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export declare const ApiResponseSuccessSchema: z.ZodObject<{
3
+ data: z.ZodAny;
4
+ error: z.ZodNull;
5
+ status_code: z.ZodEnum<["200", "201", "204"]>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ error: null;
8
+ status_code: "200" | "201" | "204";
9
+ data?: any;
10
+ }, {
11
+ error: null;
12
+ status_code: "200" | "201" | "204";
13
+ data?: any;
14
+ }>;
15
+ export type ApiResponseSuccess<T> = Omit<z.infer<typeof ApiResponseSuccessSchema>, 'data'> & {
16
+ data: T;
17
+ };
18
+ export declare const ApiResponseErrorSchema: z.ZodObject<{
19
+ data: z.ZodNull;
20
+ error: z.ZodString;
21
+ status_code: z.ZodEnum<["400", "401", "403", "404", "500"]>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ error: string;
24
+ data: null;
25
+ status_code: "400" | "401" | "403" | "404" | "500";
26
+ }, {
27
+ error: string;
28
+ data: null;
29
+ status_code: "400" | "401" | "403" | "404" | "500";
30
+ }>;
31
+ export type ApiResponseError = z.infer<typeof ApiResponseErrorSchema>;
32
+ export declare const ApiResponseSchema: z.ZodDiscriminatedUnion<"status_code", [z.ZodObject<{
33
+ data: z.ZodAny;
34
+ error: z.ZodNull;
35
+ status_code: z.ZodEnum<["200", "201", "204"]>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ error: null;
38
+ status_code: "200" | "201" | "204";
39
+ data?: any;
40
+ }, {
41
+ error: null;
42
+ status_code: "200" | "201" | "204";
43
+ data?: any;
44
+ }>, z.ZodObject<{
45
+ data: z.ZodNull;
46
+ error: z.ZodString;
47
+ status_code: z.ZodEnum<["400", "401", "403", "404", "500"]>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ error: string;
50
+ data: null;
51
+ status_code: "400" | "401" | "403" | "404" | "500";
52
+ }, {
53
+ error: string;
54
+ data: null;
55
+ status_code: "400" | "401" | "403" | "404" | "500";
56
+ }>]>;
57
+ export type ApiResponse<T> = ApiResponseError | ApiResponseSuccess<T>;
@@ -0,0 +1,27 @@
1
+ /* * */
2
+ import { HttpStatusSchema } from './http-status.js';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const ApiResponseSuccessSchema = z.object({
6
+ data: z.any(),
7
+ error: z.null(),
8
+ status_code: HttpStatusSchema.extract([
9
+ '200', // OK
10
+ '201', // Created
11
+ '204', // No Content
12
+ ]),
13
+ });
14
+ /* * */
15
+ export const ApiResponseErrorSchema = z.object({
16
+ data: z.null(),
17
+ error: z.string(),
18
+ status_code: HttpStatusSchema.extract([
19
+ '400', // Bad Request
20
+ '401', // Unauthorized
21
+ '403', // Forbidden
22
+ '404', // Not Found
23
+ '500', // Internal Server Error
24
+ ]),
25
+ });
26
+ /* * */
27
+ export const ApiResponseSchema = z.discriminatedUnion('status_code', [ApiResponseSuccessSchema, ApiResponseErrorSchema]);
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const HttpStatusValues: readonly ["200", "201", "204", "400", "401", "403", "404", "500"];
3
+ export declare const HttpStatusSchema: z.ZodEnum<["200", "201", "204", "400", "401", "403", "404", "500"]>;
4
+ export type HttpStatus = z.infer<typeof HttpStatusSchema>;
@@ -0,0 +1,14 @@
1
+ /* * */
2
+ import { z } from 'zod';
3
+ /* * */
4
+ export const HttpStatusValues = [
5
+ '200', // OK
6
+ '201', // Created
7
+ '204', // No Content
8
+ '400', // Bad Request
9
+ '401', // Unauthorized
10
+ '403', // Forbidden
11
+ '404', // Not Found
12
+ '500', // Internal Server Error
13
+ ];
14
+ export const HttpStatusSchema = z.enum(HttpStatusValues);
@@ -0,0 +1,2 @@
1
+ export * from './api-response.js';
2
+ export * from './http-status.js';
@@ -0,0 +1,2 @@
1
+ export * from './api-response.js';
2
+ export * from './http-status.js';
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './_common/index.js';
2
2
  export * from './agency.js';
3
3
  export * from './alerts/index.js';
4
4
  export * from './apex/index.js';
5
+ export * from './api/index.js';
5
6
  export * from './auth/index.js';
6
7
  export * from './calendar/index.js';
7
8
  export * from './dates/index.js';
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './_common/index.js';
5
5
  export * from './agency.js';
6
6
  export * from './alerts/index.js';
7
7
  export * from './apex/index.js';
8
+ export * from './api/index.js';
8
9
  export * from './auth/index.js';
9
10
  export * from './calendar/index.js';
10
11
  export * from './dates/index.js';
@@ -19,24 +19,24 @@ export declare const DemandByAgencyByYearSchema: z.ZodObject<{
19
19
  } & {
20
20
  metric: z.ZodLiteral<"demand_by_agency_by_year">;
21
21
  }, "strip", z.ZodTypeAny, {
22
+ data: Record<string, {
23
+ qty: number;
24
+ }>;
22
25
  properties: {
23
26
  agency_id: string;
24
27
  };
25
28
  generated_at: Date;
26
29
  metric: "demand_by_agency_by_year";
30
+ description?: string | undefined;
31
+ }, {
27
32
  data: Record<string, {
28
33
  qty: number;
29
34
  }>;
30
- description?: string | undefined;
31
- }, {
32
35
  properties: {
33
36
  agency_id: string;
34
37
  };
35
38
  generated_at: Date;
36
39
  metric: "demand_by_agency_by_year";
37
- data: Record<string, {
38
- qty: number;
39
- }>;
40
40
  description?: string | undefined;
41
41
  }>;
42
42
  export declare const DemandByAgencyByMonthSchema: z.ZodObject<{
@@ -59,24 +59,24 @@ export declare const DemandByAgencyByMonthSchema: z.ZodObject<{
59
59
  } & {
60
60
  metric: z.ZodLiteral<"demand_by_agency_by_month">;
61
61
  }, "strip", z.ZodTypeAny, {
62
+ data: Record<string, {
63
+ qty: number;
64
+ }>;
62
65
  properties: {
63
66
  agency_id: string;
64
67
  };
65
68
  generated_at: Date;
66
69
  metric: "demand_by_agency_by_month";
70
+ description?: string | undefined;
71
+ }, {
67
72
  data: Record<string, {
68
73
  qty: number;
69
74
  }>;
70
- description?: string | undefined;
71
- }, {
72
75
  properties: {
73
76
  agency_id: string;
74
77
  };
75
78
  generated_at: Date;
76
79
  metric: "demand_by_agency_by_month";
77
- data: Record<string, {
78
- qty: number;
79
- }>;
80
80
  description?: string | undefined;
81
81
  }>;
82
82
  export declare const DemandByAgencyByDaySchema: z.ZodObject<{
@@ -111,11 +111,6 @@ export declare const DemandByAgencyByDaySchema: z.ZodObject<{
111
111
  }>>;
112
112
  metric: z.ZodLiteral<"demand_by_agency_by_day">;
113
113
  }, "strip", z.ZodTypeAny, {
114
- properties: {
115
- agency_id: string;
116
- };
117
- generated_at: Date;
118
- metric: "demand_by_agency_by_day";
119
114
  data: Record<string, {
120
115
  period: "1" | "2" | "3";
121
116
  holiday: "0" | "1";
@@ -123,13 +118,13 @@ export declare const DemandByAgencyByDaySchema: z.ZodObject<{
123
118
  day_type: "1" | "2" | "3";
124
119
  notes: string | null;
125
120
  }>;
126
- description?: string | undefined;
127
- }, {
128
121
  properties: {
129
122
  agency_id: string;
130
123
  };
131
124
  generated_at: Date;
132
125
  metric: "demand_by_agency_by_day";
126
+ description?: string | undefined;
127
+ }, {
133
128
  data: Record<string, {
134
129
  period: "1" | "2" | "3";
135
130
  holiday: "0" | "1";
@@ -137,6 +132,11 @@ export declare const DemandByAgencyByDaySchema: z.ZodObject<{
137
132
  day_type: "1" | "2" | "3";
138
133
  notes: string | null;
139
134
  }>;
135
+ properties: {
136
+ agency_id: string;
137
+ };
138
+ generated_at: Date;
139
+ metric: "demand_by_agency_by_day";
140
140
  description?: string | undefined;
141
141
  }>;
142
142
  export declare const DemandByAgencyByDayByProductSchema: z.ZodObject<{
@@ -174,11 +174,6 @@ export declare const DemandByAgencyByDayByProductSchema: z.ZodObject<{
174
174
  }>>;
175
175
  metric: z.ZodLiteral<"demand_by_agency_by_day_by_product">;
176
176
  }, "strip", z.ZodTypeAny, {
177
- properties: {
178
- agency_id: string;
179
- };
180
- generated_at: Date;
181
- metric: "demand_by_agency_by_day_by_product";
182
177
  data: Record<string, {
183
178
  period: "1" | "2" | "3";
184
179
  holiday: "0" | "1";
@@ -187,13 +182,13 @@ export declare const DemandByAgencyByDayByProductSchema: z.ZodObject<{
187
182
  notes: string | null;
188
183
  products: Record<string, number>;
189
184
  }>;
190
- description?: string | undefined;
191
- }, {
192
185
  properties: {
193
186
  agency_id: string;
194
187
  };
195
188
  generated_at: Date;
196
189
  metric: "demand_by_agency_by_day_by_product";
190
+ description?: string | undefined;
191
+ }, {
197
192
  data: Record<string, {
198
193
  period: "1" | "2" | "3";
199
194
  holiday: "0" | "1";
@@ -202,6 +197,11 @@ export declare const DemandByAgencyByDayByProductSchema: z.ZodObject<{
202
197
  notes: string | null;
203
198
  products: Record<string, number>;
204
199
  }>;
200
+ properties: {
201
+ agency_id: string;
202
+ };
203
+ generated_at: Date;
204
+ metric: "demand_by_agency_by_day_by_product";
205
205
  description?: string | undefined;
206
206
  }>;
207
207
  export type DemandByAgencyByYear = z.infer<typeof DemandByAgencyByYearSchema>;
@@ -34,12 +34,6 @@ export declare const DemandByCategoryByAgencyByDaySchema: z.ZodObject<{
34
34
  category: "prepaid" | "subscription" | "on_board_sale";
35
35
  }>;
36
36
  }, "strip", z.ZodTypeAny, {
37
- properties: {
38
- agency_id: string;
39
- category: "prepaid" | "subscription" | "on_board_sale";
40
- };
41
- generated_at: Date;
42
- metric: "demand_by_category_by_agency_by_day";
43
37
  data: Record<string, {
44
38
  period: "1" | "2" | "3";
45
39
  holiday: boolean;
@@ -47,14 +41,14 @@ export declare const DemandByCategoryByAgencyByDaySchema: z.ZodObject<{
47
41
  day_type: "1" | "2" | "3";
48
42
  notes: string | null;
49
43
  }>;
50
- description?: string | undefined;
51
- }, {
52
44
  properties: {
53
45
  agency_id: string;
54
46
  category: "prepaid" | "subscription" | "on_board_sale";
55
47
  };
56
48
  generated_at: Date;
57
49
  metric: "demand_by_category_by_agency_by_day";
50
+ description?: string | undefined;
51
+ }, {
58
52
  data: Record<string, {
59
53
  period: "1" | "2" | "3";
60
54
  holiday: boolean;
@@ -62,6 +56,12 @@ export declare const DemandByCategoryByAgencyByDaySchema: z.ZodObject<{
62
56
  day_type: "1" | "2" | "3";
63
57
  notes: string | null;
64
58
  }>;
59
+ properties: {
60
+ agency_id: string;
61
+ category: "prepaid" | "subscription" | "on_board_sale";
62
+ };
63
+ generated_at: Date;
64
+ metric: "demand_by_category_by_agency_by_day";
65
65
  description?: string | undefined;
66
66
  }>;
67
67
  export declare const DemandByCategoryByAgencyByMonthSchema: z.ZodObject<{
@@ -87,26 +87,26 @@ export declare const DemandByCategoryByAgencyByMonthSchema: z.ZodObject<{
87
87
  category: "prepaid" | "subscription" | "on_board_sale";
88
88
  }>;
89
89
  }, "strip", z.ZodTypeAny, {
90
+ data: Record<string, {
91
+ qty: number;
92
+ }>;
90
93
  properties: {
91
94
  agency_id: string;
92
95
  category: "prepaid" | "subscription" | "on_board_sale";
93
96
  };
94
97
  generated_at: Date;
95
98
  metric: "demand_by_category_by_agency_by_month";
99
+ description?: string | undefined;
100
+ }, {
96
101
  data: Record<string, {
97
102
  qty: number;
98
103
  }>;
99
- description?: string | undefined;
100
- }, {
101
104
  properties: {
102
105
  agency_id: string;
103
106
  category: "prepaid" | "subscription" | "on_board_sale";
104
107
  };
105
108
  generated_at: Date;
106
109
  metric: "demand_by_category_by_agency_by_month";
107
- data: Record<string, {
108
- qty: number;
109
- }>;
110
110
  description?: string | undefined;
111
111
  }>;
112
112
  export declare const DemandByCategoryByAgencyByYearSchema: z.ZodObject<{
@@ -132,26 +132,26 @@ export declare const DemandByCategoryByAgencyByYearSchema: z.ZodObject<{
132
132
  category: "prepaid" | "subscription" | "on_board_sale";
133
133
  }>;
134
134
  }, "strip", z.ZodTypeAny, {
135
+ data: Record<string, {
136
+ qty: number;
137
+ }>;
135
138
  properties: {
136
139
  agency_id: string;
137
140
  category: "prepaid" | "subscription" | "on_board_sale";
138
141
  };
139
142
  generated_at: Date;
140
143
  metric: "demand_by_category_by_agency_by_year";
144
+ description?: string | undefined;
145
+ }, {
141
146
  data: Record<string, {
142
147
  qty: number;
143
148
  }>;
144
- description?: string | undefined;
145
- }, {
146
149
  properties: {
147
150
  agency_id: string;
148
151
  category: "prepaid" | "subscription" | "on_board_sale";
149
152
  };
150
153
  generated_at: Date;
151
154
  metric: "demand_by_category_by_agency_by_year";
152
- data: Record<string, {
153
- qty: number;
154
- }>;
155
155
  description?: string | undefined;
156
156
  }>;
157
157
  export declare const DemandByCategoryByLineByDaySchema: z.ZodObject<{
@@ -189,12 +189,6 @@ export declare const DemandByCategoryByLineByDaySchema: z.ZodObject<{
189
189
  category: "prepaid" | "subscription" | "on_board_sale";
190
190
  }>;
191
191
  }, "strip", z.ZodTypeAny, {
192
- properties: {
193
- line_id: string;
194
- category: "prepaid" | "subscription" | "on_board_sale";
195
- };
196
- generated_at: Date;
197
- metric: "demand_by_category_by_line_by_day";
198
192
  data: Record<string, {
199
193
  period: "1" | "2" | "3";
200
194
  holiday: boolean;
@@ -202,14 +196,14 @@ export declare const DemandByCategoryByLineByDaySchema: z.ZodObject<{
202
196
  day_type: "1" | "2" | "3";
203
197
  notes: string | null;
204
198
  }>;
205
- description?: string | undefined;
206
- }, {
207
199
  properties: {
208
200
  line_id: string;
209
201
  category: "prepaid" | "subscription" | "on_board_sale";
210
202
  };
211
203
  generated_at: Date;
212
204
  metric: "demand_by_category_by_line_by_day";
205
+ description?: string | undefined;
206
+ }, {
213
207
  data: Record<string, {
214
208
  period: "1" | "2" | "3";
215
209
  holiday: boolean;
@@ -217,6 +211,12 @@ export declare const DemandByCategoryByLineByDaySchema: z.ZodObject<{
217
211
  day_type: "1" | "2" | "3";
218
212
  notes: string | null;
219
213
  }>;
214
+ properties: {
215
+ line_id: string;
216
+ category: "prepaid" | "subscription" | "on_board_sale";
217
+ };
218
+ generated_at: Date;
219
+ metric: "demand_by_category_by_line_by_day";
220
220
  description?: string | undefined;
221
221
  }>;
222
222
  export declare const DemandByCategoryByLineByMonthSchema: z.ZodObject<{
@@ -242,26 +242,26 @@ export declare const DemandByCategoryByLineByMonthSchema: z.ZodObject<{
242
242
  category: "prepaid" | "subscription" | "on_board_sale";
243
243
  }>;
244
244
  }, "strip", z.ZodTypeAny, {
245
+ data: Record<string, {
246
+ qty: number;
247
+ }>;
245
248
  properties: {
246
249
  line_id: string;
247
250
  category: "prepaid" | "subscription" | "on_board_sale";
248
251
  };
249
252
  generated_at: Date;
250
253
  metric: "demand_by_category_by_line_by_month";
254
+ description?: string | undefined;
255
+ }, {
251
256
  data: Record<string, {
252
257
  qty: number;
253
258
  }>;
254
- description?: string | undefined;
255
- }, {
256
259
  properties: {
257
260
  line_id: string;
258
261
  category: "prepaid" | "subscription" | "on_board_sale";
259
262
  };
260
263
  generated_at: Date;
261
264
  metric: "demand_by_category_by_line_by_month";
262
- data: Record<string, {
263
- qty: number;
264
- }>;
265
265
  description?: string | undefined;
266
266
  }>;
267
267
  export declare const DemandByCategoryByLineByYearSchema: z.ZodObject<{
@@ -287,26 +287,26 @@ export declare const DemandByCategoryByLineByYearSchema: z.ZodObject<{
287
287
  category: "prepaid" | "subscription" | "on_board_sale";
288
288
  }>;
289
289
  }, "strip", z.ZodTypeAny, {
290
+ data: Record<string, {
291
+ qty: number;
292
+ }>;
290
293
  properties: {
291
294
  line_id: string;
292
295
  category: "prepaid" | "subscription" | "on_board_sale";
293
296
  };
294
297
  generated_at: Date;
295
298
  metric: "demand_by_category_by_line_by_year";
299
+ description?: string | undefined;
300
+ }, {
296
301
  data: Record<string, {
297
302
  qty: number;
298
303
  }>;
299
- description?: string | undefined;
300
- }, {
301
304
  properties: {
302
305
  line_id: string;
303
306
  category: "prepaid" | "subscription" | "on_board_sale";
304
307
  };
305
308
  generated_at: Date;
306
309
  metric: "demand_by_category_by_line_by_year";
307
- data: Record<string, {
308
- qty: number;
309
- }>;
310
310
  description?: string | undefined;
311
311
  }>;
312
312
  export declare const DemandByCategoryByPatternByDaySchema: z.ZodObject<{
@@ -344,12 +344,6 @@ export declare const DemandByCategoryByPatternByDaySchema: z.ZodObject<{
344
344
  category: "prepaid" | "subscription" | "on_board_sale";
345
345
  }>;
346
346
  }, "strip", z.ZodTypeAny, {
347
- properties: {
348
- pattern_id: string;
349
- category: "prepaid" | "subscription" | "on_board_sale";
350
- };
351
- generated_at: Date;
352
- metric: "demand_by_category_by_pattern_by_day";
353
347
  data: Record<string, {
354
348
  period: "1" | "2" | "3";
355
349
  holiday: boolean;
@@ -357,14 +351,14 @@ export declare const DemandByCategoryByPatternByDaySchema: z.ZodObject<{
357
351
  day_type: "1" | "2" | "3";
358
352
  notes: string | null;
359
353
  }>;
360
- description?: string | undefined;
361
- }, {
362
354
  properties: {
363
355
  pattern_id: string;
364
356
  category: "prepaid" | "subscription" | "on_board_sale";
365
357
  };
366
358
  generated_at: Date;
367
359
  metric: "demand_by_category_by_pattern_by_day";
360
+ description?: string | undefined;
361
+ }, {
368
362
  data: Record<string, {
369
363
  period: "1" | "2" | "3";
370
364
  holiday: boolean;
@@ -372,6 +366,12 @@ export declare const DemandByCategoryByPatternByDaySchema: z.ZodObject<{
372
366
  day_type: "1" | "2" | "3";
373
367
  notes: string | null;
374
368
  }>;
369
+ properties: {
370
+ pattern_id: string;
371
+ category: "prepaid" | "subscription" | "on_board_sale";
372
+ };
373
+ generated_at: Date;
374
+ metric: "demand_by_category_by_pattern_by_day";
375
375
  description?: string | undefined;
376
376
  }>;
377
377
  export declare const DemandByCategoryByPatternByMonthSchema: z.ZodObject<{
@@ -397,26 +397,26 @@ export declare const DemandByCategoryByPatternByMonthSchema: z.ZodObject<{
397
397
  category: "prepaid" | "subscription" | "on_board_sale";
398
398
  }>;
399
399
  }, "strip", z.ZodTypeAny, {
400
+ data: Record<string, {
401
+ qty: number;
402
+ }>;
400
403
  properties: {
401
404
  pattern_id: string;
402
405
  category: "prepaid" | "subscription" | "on_board_sale";
403
406
  };
404
407
  generated_at: Date;
405
408
  metric: "demand_by_category_by_pattern_by_month";
409
+ description?: string | undefined;
410
+ }, {
406
411
  data: Record<string, {
407
412
  qty: number;
408
413
  }>;
409
- description?: string | undefined;
410
- }, {
411
414
  properties: {
412
415
  pattern_id: string;
413
416
  category: "prepaid" | "subscription" | "on_board_sale";
414
417
  };
415
418
  generated_at: Date;
416
419
  metric: "demand_by_category_by_pattern_by_month";
417
- data: Record<string, {
418
- qty: number;
419
- }>;
420
420
  description?: string | undefined;
421
421
  }>;
422
422
  export declare const DemandByCategoryByPatternByYearSchema: z.ZodObject<{
@@ -442,26 +442,26 @@ export declare const DemandByCategoryByPatternByYearSchema: z.ZodObject<{
442
442
  category: "prepaid" | "subscription" | "on_board_sale";
443
443
  }>;
444
444
  }, "strip", z.ZodTypeAny, {
445
+ data: Record<string, {
446
+ qty: number;
447
+ }>;
445
448
  properties: {
446
449
  pattern_id: string;
447
450
  category: "prepaid" | "subscription" | "on_board_sale";
448
451
  };
449
452
  generated_at: Date;
450
453
  metric: "demand_by_category_by_pattern_by_year";
454
+ description?: string | undefined;
455
+ }, {
451
456
  data: Record<string, {
452
457
  qty: number;
453
458
  }>;
454
- description?: string | undefined;
455
- }, {
456
459
  properties: {
457
460
  pattern_id: string;
458
461
  category: "prepaid" | "subscription" | "on_board_sale";
459
462
  };
460
463
  generated_at: Date;
461
464
  metric: "demand_by_category_by_pattern_by_year";
462
- data: Record<string, {
463
- qty: number;
464
- }>;
465
465
  description?: string | undefined;
466
466
  }>;
467
467
  export type DemandByCategoryByAgencyByDay = z.infer<typeof DemandByCategoryByAgencyByDaySchema>;