@tmlmobilidade/types 20250903.1543.8 → 20250903.2212.53

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
@@ -10,6 +10,7 @@ export * from './src/organization.js';
10
10
  export * from './src/pcgi/index.js';
11
11
  export * from './src/plans/index.js';
12
12
  export * from './src/rides/index.js';
13
+ export * from './src/sams/index.js';
13
14
  export * from './src/simplified-apex/index.js';
14
15
  export * from './src/stop.js';
15
16
  export * from './src/system/index.js';
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './src/organization.js';
13
13
  export * from './src/pcgi/index.js';
14
14
  export * from './src/plans/index.js';
15
15
  export * from './src/rides/index.js';
16
+ export * from './src/sams/index.js';
16
17
  export * from './src/simplified-apex/index.js';
17
18
  export * from './src/stop.js';
18
19
  export * from './src/system/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './sam-analysis.js';
2
+ export * from './sam.js';
@@ -0,0 +1,2 @@
1
+ export * from './sam-analysis.js';
2
+ export * from './sam.js';
@@ -0,0 +1,38 @@
1
+ import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
+ import { z } from 'zod';
3
+ export declare const SamAnalysisSchema: z.ZodObject<{
4
+ apex_version: z.ZodNullable<z.ZodString>;
5
+ device_id: z.ZodNullable<z.ZodNumber>;
6
+ end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
7
+ start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
8
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
9
+ transactions_found: z.ZodNullable<z.ZodNumber>;
10
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
11
+ vehicle_id: z.ZodNullable<z.ZodNumber>;
12
+ }, "strict", z.ZodTypeAny, {
13
+ apex_version: string | null;
14
+ device_id: number | null;
15
+ end_time: (number & {
16
+ __brand: "UnixTimestamp";
17
+ } & z.BRAND<"UnixTimestamp">) | null;
18
+ start_time: (number & {
19
+ __brand: "UnixTimestamp";
20
+ } & z.BRAND<"UnixTimestamp">) | null;
21
+ transactions_expected: number | null;
22
+ transactions_found: number | null;
23
+ transactions_missing: number | null;
24
+ vehicle_id: number | null;
25
+ }, {
26
+ apex_version: string | null;
27
+ device_id: number | null;
28
+ end_time: number | null;
29
+ start_time: number | null;
30
+ transactions_expected: number | null;
31
+ transactions_found: number | null;
32
+ transactions_missing: number | null;
33
+ vehicle_id: number | null;
34
+ }>;
35
+ export interface SamAnalysis extends Omit<z.infer<typeof SamAnalysisSchema>, 'end_time' | 'start_time'> {
36
+ end_time: null | UnixTimestamp;
37
+ start_time: null | UnixTimestamp;
38
+ }
@@ -0,0 +1,14 @@
1
+ /* * */
2
+ import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const SamAnalysisSchema = z.object({
6
+ apex_version: z.string().nullable(),
7
+ device_id: z.number().nullable(),
8
+ end_time: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
9
+ start_time: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
10
+ transactions_expected: z.number().nullable(),
11
+ transactions_found: z.number().nullable(),
12
+ transactions_missing: z.number().nullable(),
13
+ vehicle_id: z.number().nullable(),
14
+ }).strict();
@@ -0,0 +1,307 @@
1
+ import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
+ import { z } from 'zod';
3
+ export declare const SamSchema: z.ZodObject<{
4
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
5
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
6
+ } & {
7
+ _id: z.ZodNumber;
8
+ agency_id: z.ZodString;
9
+ analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
10
+ apex_version: z.ZodNullable<z.ZodString>;
11
+ device_id: z.ZodNullable<z.ZodNumber>;
12
+ end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
13
+ start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
14
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
15
+ transactions_found: z.ZodNullable<z.ZodNumber>;
16
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
17
+ vehicle_id: z.ZodNullable<z.ZodNumber>;
18
+ }, "strict", z.ZodTypeAny, {
19
+ apex_version: string | null;
20
+ device_id: number | null;
21
+ end_time: (number & {
22
+ __brand: "UnixTimestamp";
23
+ } & z.BRAND<"UnixTimestamp">) | null;
24
+ start_time: (number & {
25
+ __brand: "UnixTimestamp";
26
+ } & z.BRAND<"UnixTimestamp">) | null;
27
+ transactions_expected: number | null;
28
+ transactions_found: number | null;
29
+ transactions_missing: number | null;
30
+ vehicle_id: number | null;
31
+ }, {
32
+ apex_version: string | null;
33
+ device_id: number | null;
34
+ end_time: number | null;
35
+ start_time: number | null;
36
+ transactions_expected: number | null;
37
+ transactions_found: number | null;
38
+ transactions_missing: number | null;
39
+ vehicle_id: number | null;
40
+ }>, "many">>;
41
+ latest_apex_version: z.ZodNullable<z.ZodString>;
42
+ seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
43
+ seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
44
+ system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
45
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
46
+ transactions_found: z.ZodNullable<z.ZodNumber>;
47
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
48
+ }, "strict", z.ZodTypeAny, {
49
+ _id: number;
50
+ agency_id: string;
51
+ analysis: {
52
+ apex_version: string | null;
53
+ device_id: number | null;
54
+ end_time: (number & {
55
+ __brand: "UnixTimestamp";
56
+ } & z.BRAND<"UnixTimestamp">) | null;
57
+ start_time: (number & {
58
+ __brand: "UnixTimestamp";
59
+ } & z.BRAND<"UnixTimestamp">) | null;
60
+ transactions_expected: number | null;
61
+ transactions_found: number | null;
62
+ transactions_missing: number | null;
63
+ vehicle_id: number | null;
64
+ }[];
65
+ seen_first_at: (number & {
66
+ __brand: "UnixTimestamp";
67
+ } & z.BRAND<"UnixTimestamp">) | null;
68
+ seen_last_at: (number & {
69
+ __brand: "UnixTimestamp";
70
+ } & z.BRAND<"UnixTimestamp">) | null;
71
+ system_status: "waiting" | "processing" | "complete" | "error";
72
+ transactions_expected: number | null;
73
+ transactions_found: number | null;
74
+ transactions_missing: number | null;
75
+ latest_apex_version: string | null;
76
+ created_at?: (number & {
77
+ __brand: "UnixTimestamp";
78
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
79
+ updated_at?: (number & {
80
+ __brand: "UnixTimestamp";
81
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
82
+ }, {
83
+ _id: number;
84
+ agency_id: string;
85
+ seen_first_at: number | null;
86
+ seen_last_at: number | null;
87
+ transactions_expected: number | null;
88
+ transactions_found: number | null;
89
+ transactions_missing: number | null;
90
+ latest_apex_version: string | null;
91
+ created_at?: number | null | undefined;
92
+ updated_at?: number | null | undefined;
93
+ analysis?: {
94
+ apex_version: string | null;
95
+ device_id: number | null;
96
+ end_time: number | null;
97
+ start_time: number | null;
98
+ transactions_expected: number | null;
99
+ transactions_found: number | null;
100
+ transactions_missing: number | null;
101
+ vehicle_id: number | null;
102
+ }[] | undefined;
103
+ system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
104
+ }>;
105
+ export declare const CreateSamSchema: z.ZodObject<Omit<{
106
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
107
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
108
+ } & {
109
+ _id: z.ZodNumber;
110
+ agency_id: z.ZodString;
111
+ analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
112
+ apex_version: z.ZodNullable<z.ZodString>;
113
+ device_id: z.ZodNullable<z.ZodNumber>;
114
+ end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
115
+ start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
116
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
117
+ transactions_found: z.ZodNullable<z.ZodNumber>;
118
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
119
+ vehicle_id: z.ZodNullable<z.ZodNumber>;
120
+ }, "strict", z.ZodTypeAny, {
121
+ apex_version: string | null;
122
+ device_id: number | null;
123
+ end_time: (number & {
124
+ __brand: "UnixTimestamp";
125
+ } & z.BRAND<"UnixTimestamp">) | null;
126
+ start_time: (number & {
127
+ __brand: "UnixTimestamp";
128
+ } & z.BRAND<"UnixTimestamp">) | null;
129
+ transactions_expected: number | null;
130
+ transactions_found: number | null;
131
+ transactions_missing: number | null;
132
+ vehicle_id: number | null;
133
+ }, {
134
+ apex_version: string | null;
135
+ device_id: number | null;
136
+ end_time: number | null;
137
+ start_time: number | null;
138
+ transactions_expected: number | null;
139
+ transactions_found: number | null;
140
+ transactions_missing: number | null;
141
+ vehicle_id: number | null;
142
+ }>, "many">>;
143
+ latest_apex_version: z.ZodNullable<z.ZodString>;
144
+ seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
145
+ seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
146
+ system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
147
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
148
+ transactions_found: z.ZodNullable<z.ZodNumber>;
149
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
150
+ }, "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
151
+ _id: number;
152
+ agency_id: string;
153
+ analysis: {
154
+ apex_version: string | null;
155
+ device_id: number | null;
156
+ end_time: (number & {
157
+ __brand: "UnixTimestamp";
158
+ } & z.BRAND<"UnixTimestamp">) | null;
159
+ start_time: (number & {
160
+ __brand: "UnixTimestamp";
161
+ } & z.BRAND<"UnixTimestamp">) | null;
162
+ transactions_expected: number | null;
163
+ transactions_found: number | null;
164
+ transactions_missing: number | null;
165
+ vehicle_id: number | null;
166
+ }[];
167
+ seen_first_at: (number & {
168
+ __brand: "UnixTimestamp";
169
+ } & z.BRAND<"UnixTimestamp">) | null;
170
+ seen_last_at: (number & {
171
+ __brand: "UnixTimestamp";
172
+ } & z.BRAND<"UnixTimestamp">) | null;
173
+ system_status: "waiting" | "processing" | "complete" | "error";
174
+ transactions_expected: number | null;
175
+ transactions_found: number | null;
176
+ transactions_missing: number | null;
177
+ latest_apex_version: string | null;
178
+ }, {
179
+ _id: number;
180
+ agency_id: string;
181
+ seen_first_at: number | null;
182
+ seen_last_at: number | null;
183
+ transactions_expected: number | null;
184
+ transactions_found: number | null;
185
+ transactions_missing: number | null;
186
+ latest_apex_version: string | null;
187
+ analysis?: {
188
+ apex_version: string | null;
189
+ device_id: number | null;
190
+ end_time: number | null;
191
+ start_time: number | null;
192
+ transactions_expected: number | null;
193
+ transactions_found: number | null;
194
+ transactions_missing: number | null;
195
+ vehicle_id: number | null;
196
+ }[] | undefined;
197
+ system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
198
+ }>;
199
+ export declare const UpdateSamSchema: z.ZodObject<{
200
+ _id: z.ZodOptional<z.ZodNumber>;
201
+ agency_id: z.ZodOptional<z.ZodString>;
202
+ analysis: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
203
+ apex_version: z.ZodNullable<z.ZodString>;
204
+ device_id: z.ZodNullable<z.ZodNumber>;
205
+ end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
206
+ start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
207
+ transactions_expected: z.ZodNullable<z.ZodNumber>;
208
+ transactions_found: z.ZodNullable<z.ZodNumber>;
209
+ transactions_missing: z.ZodNullable<z.ZodNumber>;
210
+ vehicle_id: z.ZodNullable<z.ZodNumber>;
211
+ }, "strict", z.ZodTypeAny, {
212
+ apex_version: string | null;
213
+ device_id: number | null;
214
+ end_time: (number & {
215
+ __brand: "UnixTimestamp";
216
+ } & z.BRAND<"UnixTimestamp">) | null;
217
+ start_time: (number & {
218
+ __brand: "UnixTimestamp";
219
+ } & z.BRAND<"UnixTimestamp">) | null;
220
+ transactions_expected: number | null;
221
+ transactions_found: number | null;
222
+ transactions_missing: number | null;
223
+ vehicle_id: number | null;
224
+ }, {
225
+ apex_version: string | null;
226
+ device_id: number | null;
227
+ end_time: number | null;
228
+ start_time: number | null;
229
+ transactions_expected: number | null;
230
+ transactions_found: number | null;
231
+ transactions_missing: number | null;
232
+ vehicle_id: number | null;
233
+ }>, "many">>>;
234
+ seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
235
+ seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
236
+ system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>>;
237
+ transactions_expected: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
238
+ transactions_found: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
239
+ transactions_missing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
240
+ latest_apex_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
241
+ }, "strict", z.ZodTypeAny, {
242
+ _id?: number | undefined;
243
+ agency_id?: string | undefined;
244
+ analysis?: {
245
+ apex_version: string | null;
246
+ device_id: number | null;
247
+ end_time: (number & {
248
+ __brand: "UnixTimestamp";
249
+ } & z.BRAND<"UnixTimestamp">) | null;
250
+ start_time: (number & {
251
+ __brand: "UnixTimestamp";
252
+ } & z.BRAND<"UnixTimestamp">) | null;
253
+ transactions_expected: number | null;
254
+ transactions_found: number | null;
255
+ transactions_missing: number | null;
256
+ vehicle_id: number | null;
257
+ }[] | undefined;
258
+ seen_first_at?: (number & {
259
+ __brand: "UnixTimestamp";
260
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
261
+ seen_last_at?: (number & {
262
+ __brand: "UnixTimestamp";
263
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
264
+ system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
265
+ transactions_expected?: number | null | undefined;
266
+ transactions_found?: number | null | undefined;
267
+ transactions_missing?: number | null | undefined;
268
+ latest_apex_version?: string | null | undefined;
269
+ }, {
270
+ _id?: number | undefined;
271
+ agency_id?: string | undefined;
272
+ analysis?: {
273
+ apex_version: string | null;
274
+ device_id: number | null;
275
+ end_time: number | null;
276
+ start_time: number | null;
277
+ transactions_expected: number | null;
278
+ transactions_found: number | null;
279
+ transactions_missing: number | null;
280
+ vehicle_id: number | null;
281
+ }[] | undefined;
282
+ seen_first_at?: number | null | undefined;
283
+ seen_last_at?: number | null | undefined;
284
+ system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
285
+ transactions_expected?: number | null | undefined;
286
+ transactions_found?: number | null | undefined;
287
+ transactions_missing?: number | null | undefined;
288
+ latest_apex_version?: string | null | undefined;
289
+ }>;
290
+ /**
291
+ * SAMs are the chips that contain the keys used to sign APEX transactions.
292
+ * They live in the validator machines and produce an incrementing counter value
293
+ * every time a transaction is signed. This counter value is used to ensure that
294
+ * the transactions are real, unique and incremental. This allows the system to
295
+ * detect if a transaction has been tampered with or if any transactions are missing.
296
+ */
297
+ export interface Sam extends Omit<z.infer<typeof SamSchema>, 'created_at' | 'seen_first_at' | 'seen_last_at' | 'updated_at'> {
298
+ created_at: UnixTimestamp;
299
+ seen_first_at: null | UnixTimestamp;
300
+ seen_last_at: null | UnixTimestamp;
301
+ updated_at: UnixTimestamp;
302
+ }
303
+ export interface CreateSamDto extends Omit<z.infer<typeof CreateSamSchema>, 'seen_first_at' | 'seen_last_at'> {
304
+ seen_first_at: null | UnixTimestamp;
305
+ seen_last_at: null | UnixTimestamp;
306
+ }
307
+ export type UpdateSamDto = Partial<CreateSamDto>;
@@ -3,20 +3,19 @@ import { DocumentSchema } from '../_common/document.js';
3
3
  import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
4
4
  import { ProcessingStatusSchema } from '../system/processing-status.js';
5
5
  import { z } from 'zod';
6
+ import { SamAnalysisSchema } from './sam-analysis.js';
6
7
  /* * */
7
8
  export const SamSchema = DocumentSchema.extend({
8
9
  _id: z.number(),
9
10
  agency_id: z.string(),
10
- device_ids: z.array(z.string()).nullable(),
11
+ analysis: z.array(SamAnalysisSchema).default([]),
11
12
  latest_apex_version: z.string().nullable(),
12
- remarks: z.string().nullable(),
13
13
  seen_first_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
14
14
  seen_last_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
15
15
  system_status: ProcessingStatusSchema.default('waiting'),
16
16
  transactions_expected: z.number().nullable(),
17
17
  transactions_found: z.number().nullable(),
18
18
  transactions_missing: z.number().nullable(),
19
- vehicle_ids: z.array(z.number()).nullable(),
20
19
  }).strict();
21
20
  export const CreateSamSchema = SamSchema.omit({ created_at: true, updated_at: true });
22
21
  export const UpdateSamSchema = CreateSamSchema.partial();
@@ -1,4 +1,3 @@
1
- export * from './sam.js';
2
1
  export * from './simplified-apex-inspection-decision.js';
3
2
  export * from './simplified-apex-inspection.js';
4
3
  export * from './simplified-apex-location.js';
@@ -1,4 +1,3 @@
1
- export * from './sam.js';
2
1
  export * from './simplified-apex-inspection-decision.js';
3
2
  export * from './simplified-apex-inspection.js';
4
3
  export * from './simplified-apex-location.js';
@@ -24,13 +24,13 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
24
24
  pattern_id: string;
25
25
  apex_version: string;
26
26
  device_id: string;
27
+ vehicle_id: number;
27
28
  mac_ase_counter_value: number;
28
29
  mac_sam_serial_number: number;
29
30
  received_at: number & {
30
31
  __brand: "UnixTimestamp";
31
32
  } & z.BRAND<"UnixTimestamp">;
32
33
  stop_id: string;
33
- vehicle_id: number;
34
34
  created_at?: (number & {
35
35
  __brand: "UnixTimestamp";
36
36
  } & z.BRAND<"UnixTimestamp">) | null | undefined;
@@ -45,11 +45,11 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
45
45
  pattern_id: string;
46
46
  apex_version: string;
47
47
  device_id: string;
48
+ vehicle_id: number;
48
49
  mac_ase_counter_value: number;
49
50
  mac_sam_serial_number: number;
50
51
  received_at: number;
51
52
  stop_id: string;
52
- vehicle_id: number;
53
53
  created_at?: number | null | undefined;
54
54
  updated_at?: number | null | undefined;
55
55
  }>;
@@ -82,13 +82,13 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
82
82
  pattern_id?: string | undefined;
83
83
  apex_version?: string | undefined;
84
84
  device_id?: string | undefined;
85
+ vehicle_id?: number | undefined;
85
86
  mac_ase_counter_value?: number | undefined;
86
87
  mac_sam_serial_number?: number | undefined;
87
88
  received_at?: (number & {
88
89
  __brand: "UnixTimestamp";
89
90
  } & z.BRAND<"UnixTimestamp">) | undefined;
90
91
  stop_id?: string | undefined;
91
- vehicle_id?: number | undefined;
92
92
  }, {
93
93
  _id?: string | undefined;
94
94
  created_at?: number | null | undefined;
@@ -99,11 +99,11 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
99
99
  pattern_id?: string | undefined;
100
100
  apex_version?: string | undefined;
101
101
  device_id?: string | undefined;
102
+ vehicle_id?: number | undefined;
102
103
  mac_ase_counter_value?: number | undefined;
103
104
  mac_sam_serial_number?: number | undefined;
104
105
  received_at?: number | undefined;
105
106
  stop_id?: string | undefined;
106
- vehicle_id?: number | undefined;
107
107
  }>;
108
108
  /**
109
109
  * APEX Locations are APEX transactions of type 19 that are generated every time the
@@ -35,13 +35,13 @@ export declare const SimplifiedApexOnBoardRefundSchema: z.ZodObject<{
35
35
  pattern_id: string | null;
36
36
  apex_version: string;
37
37
  device_id: string;
38
+ vehicle_id: number | null;
38
39
  mac_ase_counter_value: number;
39
40
  mac_sam_serial_number: number;
40
41
  received_at: number & {
41
42
  __brand: "UnixTimestamp";
42
43
  } & z.BRAND<"UnixTimestamp">;
43
44
  stop_id: string | null;
44
- vehicle_id: number | null;
45
45
  block_id: string | null;
46
46
  card_physical_type: number;
47
47
  card_serial_number: string;
@@ -66,11 +66,11 @@ export declare const SimplifiedApexOnBoardRefundSchema: z.ZodObject<{
66
66
  pattern_id: string | null;
67
67
  apex_version: string;
68
68
  device_id: string;
69
+ vehicle_id: number | null;
69
70
  mac_ase_counter_value: number;
70
71
  mac_sam_serial_number: number;
71
72
  received_at: number;
72
73
  stop_id: string | null;
73
- vehicle_id: number | null;
74
74
  block_id: string | null;
75
75
  card_physical_type: number;
76
76
  card_serial_number: string;
@@ -123,13 +123,13 @@ export declare const UpdateSimplifiedApexOnBoardRefundSchema: z.ZodObject<{
123
123
  pattern_id?: string | null | undefined;
124
124
  apex_version?: string | undefined;
125
125
  device_id?: string | undefined;
126
+ vehicle_id?: number | null | undefined;
126
127
  mac_ase_counter_value?: number | undefined;
127
128
  mac_sam_serial_number?: number | undefined;
128
129
  received_at?: (number & {
129
130
  __brand: "UnixTimestamp";
130
131
  } & z.BRAND<"UnixTimestamp">) | undefined;
131
132
  stop_id?: string | null | undefined;
132
- vehicle_id?: number | null | undefined;
133
133
  block_id?: string | null | undefined;
134
134
  card_physical_type?: number | undefined;
135
135
  card_serial_number?: string | undefined;
@@ -150,11 +150,11 @@ export declare const UpdateSimplifiedApexOnBoardRefundSchema: z.ZodObject<{
150
150
  pattern_id?: string | null | undefined;
151
151
  apex_version?: string | undefined;
152
152
  device_id?: string | undefined;
153
+ vehicle_id?: number | null | undefined;
153
154
  mac_ase_counter_value?: number | undefined;
154
155
  mac_sam_serial_number?: number | undefined;
155
156
  received_at?: number | undefined;
156
157
  stop_id?: string | null | undefined;
157
- vehicle_id?: number | null | undefined;
158
158
  block_id?: string | null | undefined;
159
159
  card_physical_type?: number | undefined;
160
160
  card_serial_number?: string | undefined;
@@ -36,13 +36,13 @@ export declare const SimplifiedApexOnBoardSaleSchema: z.ZodObject<{
36
36
  pattern_id: string | null;
37
37
  apex_version: string;
38
38
  device_id: string;
39
+ vehicle_id: number | null;
39
40
  mac_ase_counter_value: number;
40
41
  mac_sam_serial_number: number;
41
42
  received_at: number & {
42
43
  __brand: "UnixTimestamp";
43
44
  } & z.BRAND<"UnixTimestamp">;
44
45
  stop_id: string | null;
45
- vehicle_id: number | null;
46
46
  block_id: string | null;
47
47
  card_physical_type: number;
48
48
  card_serial_number: string;
@@ -68,11 +68,11 @@ export declare const SimplifiedApexOnBoardSaleSchema: z.ZodObject<{
68
68
  pattern_id: string | null;
69
69
  apex_version: string;
70
70
  device_id: string;
71
+ vehicle_id: number | null;
71
72
  mac_ase_counter_value: number;
72
73
  mac_sam_serial_number: number;
73
74
  received_at: number;
74
75
  stop_id: string | null;
75
- vehicle_id: number | null;
76
76
  block_id: string | null;
77
77
  card_physical_type: number;
78
78
  card_serial_number: string;
@@ -127,13 +127,13 @@ export declare const UpdateSimplifiedApexOnBoardSaleSchema: z.ZodObject<{
127
127
  pattern_id?: string | null | undefined;
128
128
  apex_version?: string | undefined;
129
129
  device_id?: string | undefined;
130
+ vehicle_id?: number | null | undefined;
130
131
  mac_ase_counter_value?: number | undefined;
131
132
  mac_sam_serial_number?: number | undefined;
132
133
  received_at?: (number & {
133
134
  __brand: "UnixTimestamp";
134
135
  } & z.BRAND<"UnixTimestamp">) | undefined;
135
136
  stop_id?: string | null | undefined;
136
- vehicle_id?: number | null | undefined;
137
137
  block_id?: string | null | undefined;
138
138
  card_physical_type?: number | undefined;
139
139
  card_serial_number?: string | undefined;
@@ -155,11 +155,11 @@ export declare const UpdateSimplifiedApexOnBoardSaleSchema: z.ZodObject<{
155
155
  pattern_id?: string | null | undefined;
156
156
  apex_version?: string | undefined;
157
157
  device_id?: string | undefined;
158
+ vehicle_id?: number | null | undefined;
158
159
  mac_ase_counter_value?: number | undefined;
159
160
  mac_sam_serial_number?: number | undefined;
160
161
  received_at?: number | undefined;
161
162
  stop_id?: string | null | undefined;
162
- vehicle_id?: number | null | undefined;
163
163
  block_id?: string | null | undefined;
164
164
  card_physical_type?: number | undefined;
165
165
  card_serial_number?: string | undefined;
@@ -248,13 +248,13 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
248
248
  pattern_id: string;
249
249
  apex_version: string;
250
250
  device_id: string;
251
+ vehicle_id: number;
251
252
  mac_ase_counter_value: number;
252
253
  mac_sam_serial_number: number;
253
254
  received_at: number & {
254
255
  __brand: "UnixTimestamp";
255
256
  } & z.BRAND<"UnixTimestamp">;
256
257
  stop_id: string;
257
- vehicle_id: number;
258
258
  card_serial_number: string;
259
259
  on_board_sale_id: string | null;
260
260
  is_passenger: boolean;
@@ -278,11 +278,11 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
278
278
  pattern_id: string;
279
279
  apex_version: string;
280
280
  device_id: string;
281
+ vehicle_id: number;
281
282
  mac_ase_counter_value: number;
282
283
  mac_sam_serial_number: number;
283
284
  received_at: number;
284
285
  stop_id: string;
285
- vehicle_id: number;
286
286
  card_serial_number: string;
287
287
  on_board_sale_id: string | null;
288
288
  is_passenger: boolean;
@@ -404,13 +404,13 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
404
404
  pattern_id?: string | undefined;
405
405
  apex_version?: string | undefined;
406
406
  device_id?: string | undefined;
407
+ vehicle_id?: number | undefined;
407
408
  mac_ase_counter_value?: number | undefined;
408
409
  mac_sam_serial_number?: number | undefined;
409
410
  received_at?: (number & {
410
411
  __brand: "UnixTimestamp";
411
412
  } & z.BRAND<"UnixTimestamp">) | undefined;
412
413
  stop_id?: string | undefined;
413
- vehicle_id?: number | undefined;
414
414
  card_serial_number?: string | undefined;
415
415
  on_board_sale_id?: string | null | undefined;
416
416
  is_passenger?: boolean | undefined;
@@ -430,11 +430,11 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
430
430
  pattern_id?: string | undefined;
431
431
  apex_version?: string | undefined;
432
432
  device_id?: string | undefined;
433
+ vehicle_id?: number | undefined;
433
434
  mac_ase_counter_value?: number | undefined;
434
435
  mac_sam_serial_number?: number | undefined;
435
436
  received_at?: number | undefined;
436
437
  stop_id?: string | undefined;
437
- vehicle_id?: number | undefined;
438
438
  card_serial_number?: string | undefined;
439
439
  on_board_sale_id?: string | null | undefined;
440
440
  is_passenger?: boolean | undefined;
@@ -24,11 +24,11 @@ export declare const VehicleEventSchema: z.ZodObject<{
24
24
  agency_id: string;
25
25
  trip_id: string;
26
26
  pattern_id: string;
27
+ vehicle_id: string;
27
28
  received_at: number & {
28
29
  __brand: "UnixTimestamp";
29
30
  } & z.BRAND<"UnixTimestamp">;
30
31
  stop_id: string;
31
- vehicle_id: string;
32
32
  latitude: number;
33
33
  longitude: number;
34
34
  driver_id: string;
@@ -48,9 +48,9 @@ export declare const VehicleEventSchema: z.ZodObject<{
48
48
  agency_id: string;
49
49
  trip_id: string;
50
50
  pattern_id: string;
51
+ vehicle_id: string;
51
52
  received_at: number;
52
53
  stop_id: string;
53
- vehicle_id: string;
54
54
  latitude: number;
55
55
  longitude: number;
56
56
  driver_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250903.1543.8",
3
+ "version": "20250903.2212.53",
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",
@@ -1,166 +0,0 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
- import { z } from 'zod';
3
- export declare const SamSchema: z.ZodObject<{
4
- created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
5
- updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
6
- } & {
7
- _id: z.ZodNumber;
8
- agency_id: z.ZodString;
9
- device_ids: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
10
- latest_apex_version: z.ZodNullable<z.ZodString>;
11
- remarks: z.ZodNullable<z.ZodString>;
12
- seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
13
- seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
14
- system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
15
- transactions_expected: z.ZodNullable<z.ZodNumber>;
16
- transactions_found: z.ZodNullable<z.ZodNumber>;
17
- transactions_missing: z.ZodNullable<z.ZodNumber>;
18
- vehicle_ids: z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>;
19
- }, "strict", z.ZodTypeAny, {
20
- _id: number;
21
- agency_id: string;
22
- seen_first_at: (number & {
23
- __brand: "UnixTimestamp";
24
- } & z.BRAND<"UnixTimestamp">) | null;
25
- seen_last_at: (number & {
26
- __brand: "UnixTimestamp";
27
- } & z.BRAND<"UnixTimestamp">) | null;
28
- system_status: "waiting" | "processing" | "complete" | "error";
29
- vehicle_ids: number[] | null;
30
- device_ids: string[] | null;
31
- latest_apex_version: string | null;
32
- remarks: string | null;
33
- transactions_expected: number | null;
34
- transactions_found: number | null;
35
- transactions_missing: number | null;
36
- created_at?: (number & {
37
- __brand: "UnixTimestamp";
38
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
39
- updated_at?: (number & {
40
- __brand: "UnixTimestamp";
41
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
42
- }, {
43
- _id: number;
44
- agency_id: string;
45
- seen_first_at: number | null;
46
- seen_last_at: number | null;
47
- vehicle_ids: number[] | null;
48
- device_ids: string[] | null;
49
- latest_apex_version: string | null;
50
- remarks: string | null;
51
- transactions_expected: number | null;
52
- transactions_found: number | null;
53
- transactions_missing: number | null;
54
- created_at?: number | null | undefined;
55
- updated_at?: number | null | undefined;
56
- system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
57
- }>;
58
- export declare const CreateSamSchema: z.ZodObject<Omit<{
59
- created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
60
- updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
61
- } & {
62
- _id: z.ZodNumber;
63
- agency_id: z.ZodString;
64
- device_ids: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
65
- latest_apex_version: z.ZodNullable<z.ZodString>;
66
- remarks: z.ZodNullable<z.ZodString>;
67
- seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
68
- seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
69
- system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
70
- transactions_expected: z.ZodNullable<z.ZodNumber>;
71
- transactions_found: z.ZodNullable<z.ZodNumber>;
72
- transactions_missing: z.ZodNullable<z.ZodNumber>;
73
- vehicle_ids: z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>;
74
- }, "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
75
- _id: number;
76
- agency_id: string;
77
- seen_first_at: (number & {
78
- __brand: "UnixTimestamp";
79
- } & z.BRAND<"UnixTimestamp">) | null;
80
- seen_last_at: (number & {
81
- __brand: "UnixTimestamp";
82
- } & z.BRAND<"UnixTimestamp">) | null;
83
- system_status: "waiting" | "processing" | "complete" | "error";
84
- vehicle_ids: number[] | null;
85
- device_ids: string[] | null;
86
- latest_apex_version: string | null;
87
- remarks: string | null;
88
- transactions_expected: number | null;
89
- transactions_found: number | null;
90
- transactions_missing: number | null;
91
- }, {
92
- _id: number;
93
- agency_id: string;
94
- seen_first_at: number | null;
95
- seen_last_at: number | null;
96
- vehicle_ids: number[] | null;
97
- device_ids: string[] | null;
98
- latest_apex_version: string | null;
99
- remarks: string | null;
100
- transactions_expected: number | null;
101
- transactions_found: number | null;
102
- transactions_missing: number | null;
103
- system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
104
- }>;
105
- export declare const UpdateSamSchema: z.ZodObject<{
106
- _id: z.ZodOptional<z.ZodNumber>;
107
- agency_id: z.ZodOptional<z.ZodString>;
108
- seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
109
- seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
110
- system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>>;
111
- vehicle_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
112
- device_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
113
- latest_apex_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
- remarks: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
- transactions_expected: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
116
- transactions_found: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
117
- transactions_missing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
- }, "strict", z.ZodTypeAny, {
119
- _id?: number | undefined;
120
- agency_id?: string | undefined;
121
- seen_first_at?: (number & {
122
- __brand: "UnixTimestamp";
123
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
124
- seen_last_at?: (number & {
125
- __brand: "UnixTimestamp";
126
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
127
- system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
128
- vehicle_ids?: number[] | null | undefined;
129
- device_ids?: string[] | null | undefined;
130
- latest_apex_version?: string | null | undefined;
131
- remarks?: string | null | undefined;
132
- transactions_expected?: number | null | undefined;
133
- transactions_found?: number | null | undefined;
134
- transactions_missing?: number | null | undefined;
135
- }, {
136
- _id?: number | undefined;
137
- agency_id?: string | undefined;
138
- seen_first_at?: number | null | undefined;
139
- seen_last_at?: number | null | undefined;
140
- system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
141
- vehicle_ids?: number[] | null | undefined;
142
- device_ids?: string[] | null | undefined;
143
- latest_apex_version?: string | null | undefined;
144
- remarks?: string | null | undefined;
145
- transactions_expected?: number | null | undefined;
146
- transactions_found?: number | null | undefined;
147
- transactions_missing?: number | null | undefined;
148
- }>;
149
- /**
150
- * SAMs are the chips that contain the keys used to sign APEX transactions.
151
- * They live in the validator machines and produce an incrementing counter value
152
- * every time a transaction is signed. This counter value is used to ensure that
153
- * the transactions are real, unique and incremental. This allows the system to
154
- * detect if a transaction has been tampered with or if any transactions are missing.
155
- */
156
- export interface Sam extends Omit<z.infer<typeof SamSchema>, 'created_at' | 'seen_first_at' | 'seen_last_at' | 'updated_at'> {
157
- created_at: UnixTimestamp;
158
- seen_first_at: null | UnixTimestamp;
159
- seen_last_at: null | UnixTimestamp;
160
- updated_at: UnixTimestamp;
161
- }
162
- export interface CreateSamDto extends Omit<z.infer<typeof CreateSamSchema>, 'seen_first_at' | 'seen_last_at'> {
163
- seen_first_at: null | UnixTimestamp;
164
- seen_last_at: null | UnixTimestamp;
165
- }
166
- export type UpdateSamDto = Partial<CreateSamDto>;