@tmlmobilidade/types 20250807.22.45 → 20250811.1237.51

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.
@@ -1,77 +1,149 @@
1
1
  import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
2
  import { z } from 'zod';
3
- export declare enum ApexValidationStatus {
3
+ export declare const ApexValidationStatus: {
4
4
  /**
5
5
  * VALID:
6
6
  * The card holder had a valid contract for the given context.
7
7
  */
8
- _0_ContractValid = 0,
8
+ readonly _0_ContractValid: 0;
9
9
  /**
10
10
  * INVALID:
11
11
  * The card holder already has a valid validation for the given context.
12
12
  */
13
- _1_Antipassback = 1,
13
+ readonly _1_Antipassback: 1;
14
14
  /**
15
15
  * INVALID:
16
16
  * The card holder's card is in the black list.
17
17
  */
18
- _2_CardInBlackList = 2,
18
+ readonly _2_CardInBlackList: 2;
19
19
  /**
20
20
  * INVALID:
21
21
  * The validator SAM is in the black list.
22
22
  */
23
- _3_SamInBlackList = 3,
23
+ readonly _3_SamInBlackList: 3;
24
24
  /**
25
25
  * VALID:
26
26
  * The card holder's card is in the white list.
27
27
  */
28
- _4_CardInWhiteList = 4,
28
+ readonly _4_CardInWhiteList: 4;
29
29
  /**
30
30
  * VALID:
31
31
  * The card holder's profile is in the white list.
32
32
  */
33
- _5_ProfileInWhiteList = 5,
33
+ readonly _5_ProfileInWhiteList: 5;
34
34
  /**
35
35
  * VALID:
36
36
  * The context allows for validation re-use.
37
37
  */
38
- _6_Interchange = 6,
38
+ readonly _6_Interchange: 6;
39
39
  /**
40
40
  * INVALID:
41
41
  * The validation could not be written to the card.
42
42
  */
43
- _7_Interrupted = 7,
43
+ readonly _7_Interrupted: 7;
44
44
  /**
45
45
  * INVALID:
46
46
  * The card holder does not have a valid contract for the given context.
47
47
  */
48
- _8_NoValidContract = 8,
48
+ readonly _8_NoValidContract: 8;
49
49
  /**
50
50
  * INVALID:
51
51
  * The card holder's card is invalidated.
52
52
  */
53
- _9_CardInvalidated = 9,
53
+ readonly _9_CardInvalidated: 9;
54
54
  /**
55
55
  * INVALID:
56
56
  * The card holder's card or the validator's SAM has no more space for events.
57
57
  */
58
- _10_EventsFull = 10,
58
+ readonly _10_EventsFull: 10;
59
59
  /**
60
60
  * INVALID:
61
61
  * The card holder's card does not have enough units for the given context.
62
62
  */
63
- _11_NotEnoughUnits = 11,
63
+ readonly _11_NotEnoughUnits: 11;
64
64
  /**
65
65
  * INVALID:
66
66
  * The card holder's contract has expired.
67
67
  */
68
- _12_ContractExpired = 12,
68
+ readonly _12_ContractExpired: 12;
69
69
  /**
70
70
  * INVALID:
71
71
  * The maximum value for the validation status. This is used to validate the status.
72
72
  */
73
- _13_MaxValue = 13
74
- }
73
+ readonly _13_MaxValue: 13;
74
+ };
75
+ export declare const ApexValidationStatusSchema: z.ZodNativeEnum<{
76
+ /**
77
+ * VALID:
78
+ * The card holder had a valid contract for the given context.
79
+ */
80
+ readonly _0_ContractValid: 0;
81
+ /**
82
+ * INVALID:
83
+ * The card holder already has a valid validation for the given context.
84
+ */
85
+ readonly _1_Antipassback: 1;
86
+ /**
87
+ * INVALID:
88
+ * The card holder's card is in the black list.
89
+ */
90
+ readonly _2_CardInBlackList: 2;
91
+ /**
92
+ * INVALID:
93
+ * The validator SAM is in the black list.
94
+ */
95
+ readonly _3_SamInBlackList: 3;
96
+ /**
97
+ * VALID:
98
+ * The card holder's card is in the white list.
99
+ */
100
+ readonly _4_CardInWhiteList: 4;
101
+ /**
102
+ * VALID:
103
+ * The card holder's profile is in the white list.
104
+ */
105
+ readonly _5_ProfileInWhiteList: 5;
106
+ /**
107
+ * VALID:
108
+ * The context allows for validation re-use.
109
+ */
110
+ readonly _6_Interchange: 6;
111
+ /**
112
+ * INVALID:
113
+ * The validation could not be written to the card.
114
+ */
115
+ readonly _7_Interrupted: 7;
116
+ /**
117
+ * INVALID:
118
+ * The card holder does not have a valid contract for the given context.
119
+ */
120
+ readonly _8_NoValidContract: 8;
121
+ /**
122
+ * INVALID:
123
+ * The card holder's card is invalidated.
124
+ */
125
+ readonly _9_CardInvalidated: 9;
126
+ /**
127
+ * INVALID:
128
+ * The card holder's card or the validator's SAM has no more space for events.
129
+ */
130
+ readonly _10_EventsFull: 10;
131
+ /**
132
+ * INVALID:
133
+ * The card holder's card does not have enough units for the given context.
134
+ */
135
+ readonly _11_NotEnoughUnits: 11;
136
+ /**
137
+ * INVALID:
138
+ * The card holder's contract has expired.
139
+ */
140
+ readonly _12_ContractExpired: 12;
141
+ /**
142
+ * INVALID:
143
+ * The maximum value for the validation status. This is used to validate the status.
144
+ */
145
+ readonly _13_MaxValue: 13;
146
+ }>;
75
147
  export declare const SimplifiedApexValidationSchema: z.ZodObject<{
76
148
  _id: z.ZodString;
77
149
  created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
@@ -94,7 +166,78 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
94
166
  stop_id: z.ZodString;
95
167
  trip_id: z.ZodString;
96
168
  units_qty: z.ZodNullable<z.ZodNumber>;
97
- validation_status: z.ZodNativeEnum<typeof ApexValidationStatus>;
169
+ validation_status: z.ZodNativeEnum<{
170
+ /**
171
+ * VALID:
172
+ * The card holder had a valid contract for the given context.
173
+ */
174
+ readonly _0_ContractValid: 0;
175
+ /**
176
+ * INVALID:
177
+ * The card holder already has a valid validation for the given context.
178
+ */
179
+ readonly _1_Antipassback: 1;
180
+ /**
181
+ * INVALID:
182
+ * The card holder's card is in the black list.
183
+ */
184
+ readonly _2_CardInBlackList: 2;
185
+ /**
186
+ * INVALID:
187
+ * The validator SAM is in the black list.
188
+ */
189
+ readonly _3_SamInBlackList: 3;
190
+ /**
191
+ * VALID:
192
+ * The card holder's card is in the white list.
193
+ */
194
+ readonly _4_CardInWhiteList: 4;
195
+ /**
196
+ * VALID:
197
+ * The card holder's profile is in the white list.
198
+ */
199
+ readonly _5_ProfileInWhiteList: 5;
200
+ /**
201
+ * VALID:
202
+ * The context allows for validation re-use.
203
+ */
204
+ readonly _6_Interchange: 6;
205
+ /**
206
+ * INVALID:
207
+ * The validation could not be written to the card.
208
+ */
209
+ readonly _7_Interrupted: 7;
210
+ /**
211
+ * INVALID:
212
+ * The card holder does not have a valid contract for the given context.
213
+ */
214
+ readonly _8_NoValidContract: 8;
215
+ /**
216
+ * INVALID:
217
+ * The card holder's card is invalidated.
218
+ */
219
+ readonly _9_CardInvalidated: 9;
220
+ /**
221
+ * INVALID:
222
+ * The card holder's card or the validator's SAM has no more space for events.
223
+ */
224
+ readonly _10_EventsFull: 10;
225
+ /**
226
+ * INVALID:
227
+ * The card holder's card does not have enough units for the given context.
228
+ */
229
+ readonly _11_NotEnoughUnits: 11;
230
+ /**
231
+ * INVALID:
232
+ * The card holder's contract has expired.
233
+ */
234
+ readonly _12_ContractExpired: 12;
235
+ /**
236
+ * INVALID:
237
+ * The maximum value for the validation status. This is used to validate the status.
238
+ */
239
+ readonly _13_MaxValue: 13;
240
+ }>;
98
241
  vehicle_id: z.ZodNumber;
99
242
  }, "strict", z.ZodTypeAny, {
100
243
  _id: string;
@@ -118,7 +261,7 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
118
261
  event_type: number;
119
262
  product_id: string;
120
263
  units_qty: number | null;
121
- validation_status: ApexValidationStatus;
264
+ validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13;
122
265
  created_at?: (number & {
123
266
  __brand: "UnixTimestamp";
124
267
  } & z.BRAND<"UnixTimestamp">) | null | undefined;
@@ -145,7 +288,7 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
145
288
  event_type: number;
146
289
  product_id: string;
147
290
  units_qty: number | null;
148
- validation_status: ApexValidationStatus;
291
+ validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13;
149
292
  created_at?: number | null | undefined;
150
293
  updated_at?: number | null | undefined;
151
294
  }>;
@@ -170,7 +313,78 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
170
313
  stop_id: z.ZodOptional<z.ZodString>;
171
314
  trip_id: z.ZodOptional<z.ZodString>;
172
315
  units_qty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
173
- validation_status: z.ZodOptional<z.ZodNativeEnum<typeof ApexValidationStatus>>;
316
+ validation_status: z.ZodOptional<z.ZodNativeEnum<{
317
+ /**
318
+ * VALID:
319
+ * The card holder had a valid contract for the given context.
320
+ */
321
+ readonly _0_ContractValid: 0;
322
+ /**
323
+ * INVALID:
324
+ * The card holder already has a valid validation for the given context.
325
+ */
326
+ readonly _1_Antipassback: 1;
327
+ /**
328
+ * INVALID:
329
+ * The card holder's card is in the black list.
330
+ */
331
+ readonly _2_CardInBlackList: 2;
332
+ /**
333
+ * INVALID:
334
+ * The validator SAM is in the black list.
335
+ */
336
+ readonly _3_SamInBlackList: 3;
337
+ /**
338
+ * VALID:
339
+ * The card holder's card is in the white list.
340
+ */
341
+ readonly _4_CardInWhiteList: 4;
342
+ /**
343
+ * VALID:
344
+ * The card holder's profile is in the white list.
345
+ */
346
+ readonly _5_ProfileInWhiteList: 5;
347
+ /**
348
+ * VALID:
349
+ * The context allows for validation re-use.
350
+ */
351
+ readonly _6_Interchange: 6;
352
+ /**
353
+ * INVALID:
354
+ * The validation could not be written to the card.
355
+ */
356
+ readonly _7_Interrupted: 7;
357
+ /**
358
+ * INVALID:
359
+ * The card holder does not have a valid contract for the given context.
360
+ */
361
+ readonly _8_NoValidContract: 8;
362
+ /**
363
+ * INVALID:
364
+ * The card holder's card is invalidated.
365
+ */
366
+ readonly _9_CardInvalidated: 9;
367
+ /**
368
+ * INVALID:
369
+ * The card holder's card or the validator's SAM has no more space for events.
370
+ */
371
+ readonly _10_EventsFull: 10;
372
+ /**
373
+ * INVALID:
374
+ * The card holder's card does not have enough units for the given context.
375
+ */
376
+ readonly _11_NotEnoughUnits: 11;
377
+ /**
378
+ * INVALID:
379
+ * The card holder's contract has expired.
380
+ */
381
+ readonly _12_ContractExpired: 12;
382
+ /**
383
+ * INVALID:
384
+ * The maximum value for the validation status. This is used to validate the status.
385
+ */
386
+ readonly _13_MaxValue: 13;
387
+ }>>;
174
388
  vehicle_id: z.ZodOptional<z.ZodNumber>;
175
389
  }, "strict", z.ZodTypeAny, {
176
390
  _id?: string | undefined;
@@ -200,7 +414,7 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
200
414
  event_type?: number | undefined;
201
415
  product_id?: string | undefined;
202
416
  units_qty?: number | null | undefined;
203
- validation_status?: ApexValidationStatus | undefined;
417
+ validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined;
204
418
  }, {
205
419
  _id?: string | undefined;
206
420
  created_at?: number | null | undefined;
@@ -223,7 +437,7 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
223
437
  event_type?: number | undefined;
224
438
  product_id?: string | undefined;
225
439
  units_qty?: number | null | undefined;
226
- validation_status?: ApexValidationStatus | undefined;
440
+ validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined;
227
441
  }>;
228
442
  /**
229
443
  * APEX Validations are APEX transactions of type 11 that are generated when a card holder touches a validator
@@ -241,4 +455,4 @@ export type UpdateSimplifiedApexValidationDto = Partial<SimplifiedApexValidation
241
455
  /**
242
456
  * Validation statuses that are considered valid for the card holder to travel.
243
457
  */
244
- export declare const ALLOWED_VALIDATION_STATUSES: ApexValidationStatus[];
458
+ export declare const ALLOWED_VALIDATION_STATUSES: (0 | 4 | 5 | 6)[];
@@ -3,79 +3,79 @@ import { DocumentSchema } from '../_common/document.js';
3
3
  import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
- export var ApexValidationStatus;
7
- (function (ApexValidationStatus) {
6
+ export const ApexValidationStatus = {
8
7
  /**
9
8
  * VALID:
10
9
  * The card holder had a valid contract for the given context.
11
10
  */
12
- ApexValidationStatus[ApexValidationStatus["_0_ContractValid"] = 0] = "_0_ContractValid";
11
+ _0_ContractValid: 0,
13
12
  /**
14
13
  * INVALID:
15
14
  * The card holder already has a valid validation for the given context.
16
15
  */
17
- ApexValidationStatus[ApexValidationStatus["_1_Antipassback"] = 1] = "_1_Antipassback";
16
+ _1_Antipassback: 1,
18
17
  /**
19
18
  * INVALID:
20
19
  * The card holder's card is in the black list.
21
20
  */
22
- ApexValidationStatus[ApexValidationStatus["_2_CardInBlackList"] = 2] = "_2_CardInBlackList";
21
+ _2_CardInBlackList: 2,
23
22
  /**
24
23
  * INVALID:
25
24
  * The validator SAM is in the black list.
26
25
  */
27
- ApexValidationStatus[ApexValidationStatus["_3_SamInBlackList"] = 3] = "_3_SamInBlackList";
26
+ _3_SamInBlackList: 3,
28
27
  /**
29
28
  * VALID:
30
29
  * The card holder's card is in the white list.
31
30
  */
32
- ApexValidationStatus[ApexValidationStatus["_4_CardInWhiteList"] = 4] = "_4_CardInWhiteList";
31
+ _4_CardInWhiteList: 4,
33
32
  /**
34
33
  * VALID:
35
34
  * The card holder's profile is in the white list.
36
35
  */
37
- ApexValidationStatus[ApexValidationStatus["_5_ProfileInWhiteList"] = 5] = "_5_ProfileInWhiteList";
36
+ _5_ProfileInWhiteList: 5,
38
37
  /**
39
38
  * VALID:
40
39
  * The context allows for validation re-use.
41
40
  */
42
- ApexValidationStatus[ApexValidationStatus["_6_Interchange"] = 6] = "_6_Interchange";
41
+ _6_Interchange: 6,
43
42
  /**
44
43
  * INVALID:
45
44
  * The validation could not be written to the card.
46
45
  */
47
- ApexValidationStatus[ApexValidationStatus["_7_Interrupted"] = 7] = "_7_Interrupted";
46
+ _7_Interrupted: 7,
48
47
  /**
49
48
  * INVALID:
50
49
  * The card holder does not have a valid contract for the given context.
51
50
  */
52
- ApexValidationStatus[ApexValidationStatus["_8_NoValidContract"] = 8] = "_8_NoValidContract";
51
+ _8_NoValidContract: 8,
53
52
  /**
54
53
  * INVALID:
55
54
  * The card holder's card is invalidated.
56
55
  */
57
- ApexValidationStatus[ApexValidationStatus["_9_CardInvalidated"] = 9] = "_9_CardInvalidated";
56
+ _9_CardInvalidated: 9,
58
57
  /**
59
58
  * INVALID:
60
59
  * The card holder's card or the validator's SAM has no more space for events.
61
60
  */
62
- ApexValidationStatus[ApexValidationStatus["_10_EventsFull"] = 10] = "_10_EventsFull";
61
+ _10_EventsFull: 10,
63
62
  /**
64
63
  * INVALID:
65
64
  * The card holder's card does not have enough units for the given context.
66
65
  */
67
- ApexValidationStatus[ApexValidationStatus["_11_NotEnoughUnits"] = 11] = "_11_NotEnoughUnits";
66
+ _11_NotEnoughUnits: 11,
68
67
  /**
69
68
  * INVALID:
70
69
  * The card holder's contract has expired.
71
70
  */
72
- ApexValidationStatus[ApexValidationStatus["_12_ContractExpired"] = 12] = "_12_ContractExpired";
71
+ _12_ContractExpired: 12,
73
72
  /**
74
73
  * INVALID:
75
74
  * The maximum value for the validation status. This is used to validate the status.
76
75
  */
77
- ApexValidationStatus[ApexValidationStatus["_13_MaxValue"] = 13] = "_13_MaxValue";
78
- })(ApexValidationStatus || (ApexValidationStatus = {}));
76
+ _13_MaxValue: 13,
77
+ };
78
+ export const ApexValidationStatusSchema = z.nativeEnum(ApexValidationStatus);
79
79
  /* * */
80
80
  export const SimplifiedApexValidationSchema = DocumentSchema.extend({
81
81
  agency_id: z.string(),
@@ -95,7 +95,7 @@ export const SimplifiedApexValidationSchema = DocumentSchema.extend({
95
95
  stop_id: z.string(),
96
96
  trip_id: z.string(),
97
97
  units_qty: z.number().nullable(),
98
- validation_status: z.nativeEnum(ApexValidationStatus),
98
+ validation_status: ApexValidationStatusSchema,
99
99
  vehicle_id: z.number(),
100
100
  }).strict();
101
101
  export const UpdateSimplifiedApexValidationSchema = SimplifiedApexValidationSchema.partial();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250807.22.45",
3
+ "version": "20250811.1237.51",
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",