@tmlmobilidade/types 20250910.1541.13 → 20250911.1325.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/src/_common/operational-date.d.ts +1 -1
  2. package/dist/src/_common/operational-date.js +1 -2
  3. package/dist/src/_common/proposed-change.d.ts +9 -31
  4. package/dist/src/_common/proposed-change.js +5 -14
  5. package/dist/src/agency.d.ts +10 -21
  6. package/dist/src/agency.js +1 -1
  7. package/dist/src/alert.d.ts +32 -58
  8. package/dist/src/alert.js +8 -48
  9. package/dist/src/auth/login.js +2 -8
  10. package/dist/src/auth/role.d.ts +6 -13
  11. package/dist/src/auth/role.js +1 -1
  12. package/dist/src/auth/session.d.ts +13 -29
  13. package/dist/src/auth/session.js +3 -3
  14. package/dist/src/auth/user.d.ts +13 -32
  15. package/dist/src/auth/user.js +3 -3
  16. package/dist/src/auth/verification-token.d.ts +13 -25
  17. package/dist/src/auth/verification-token.js +3 -3
  18. package/dist/src/gtfs.d.ts +6 -17
  19. package/dist/src/organization.d.ts +1 -4
  20. package/dist/src/organization.js +1 -1
  21. package/dist/src/plans/gtfs-validation.d.ts +25 -63
  22. package/dist/src/plans/gtfs-validation.js +2 -6
  23. package/dist/src/plans/plan-controller.d.ts +3 -8
  24. package/dist/src/plans/plan-controller.js +2 -2
  25. package/dist/src/plans/plan.d.ts +34 -86
  26. package/dist/src/plans/plan.js +2 -6
  27. package/dist/src/rides/ride-audit.d.ts +52 -1168
  28. package/dist/src/rides/ride-audit.js +3 -5
  29. package/dist/src/rides/ride-justification.d.ts +84 -9
  30. package/dist/src/rides/ride-justification.js +4 -1
  31. package/dist/src/rides/ride.d.ts +54 -105
  32. package/dist/src/rides/ride.js +8 -8
  33. package/dist/src/sams/sam-analysis.d.ts +5 -13
  34. package/dist/src/sams/sam-analysis.js +3 -3
  35. package/dist/src/sams/sam.d.ts +37 -88
  36. package/dist/src/sams/sam.js +4 -4
  37. package/dist/src/simplified-apex/simplified-apex-location.d.ts +16 -23
  38. package/dist/src/simplified-apex/simplified-apex-location.js +2 -2
  39. package/dist/src/simplified-apex/simplified-apex-on-board-refund.d.ts +16 -23
  40. package/dist/src/simplified-apex/simplified-apex-on-board-refund.js +2 -2
  41. package/dist/src/simplified-apex/simplified-apex-on-board-sale.d.ts +27 -37
  42. package/dist/src/simplified-apex/simplified-apex-on-board-sale.js +3 -3
  43. package/dist/src/simplified-apex/simplified-apex-validation.d.ts +16 -23
  44. package/dist/src/simplified-apex/simplified-apex-validation.js +2 -2
  45. package/dist/src/stop.d.ts +68 -86
  46. package/dist/src/stop.js +11 -74
  47. package/dist/src/vehicle-event.d.ts +7 -12
  48. package/dist/src/vehicle-event.js +2 -2
  49. package/dist/src/zone.d.ts +0 -3
  50. package/dist/src/zone.js +1 -1
  51. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from '../_common/document.js';
3
3
  import { validateOperationalDate } from '../_common/operational-date.js';
4
- import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
4
+ import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
5
5
  import { atLeastOneVehicleEventOnFirstStopSchema, endedAtLastStopSchema, expectedApexValidationIntervalSchema, expectedDriverIdQtySchema, expectedStartTimeSchema, expectedVehicleEventDelaySchema, expectedVehicleEventIntervalSchema, expectedVehicleEventQtySchema, expectedVehicleIdQtySchema, matchingApexLocationsSchema, matchingVehicleIdsSchema, simpleOneApexValidationSchema, simpleOneVehicleEventOrApexValidationSchema, simpleThreeVehicleEventsSchema, transactionSequentialitySchema } from './ride-analysis.js';
6
6
  import { ProcessingStatusSchema } from '../system/processing-status.js';
7
7
  import { z } from 'zod';
@@ -32,8 +32,8 @@ export const RideSchema = DocumentSchema.extend({
32
32
  apex_on_board_sales_qty: z.number().nullable(),
33
33
  apex_validations_qty: z.number().nullable(),
34
34
  driver_ids: z.array(z.string()),
35
- end_time_observed: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
36
- end_time_scheduled: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp'),
35
+ end_time_observed: unixTimeStampSchema.nullable(),
36
+ end_time_scheduled: unixTimeStampSchema,
37
37
  extension_observed: z.number().nullable(),
38
38
  extension_scheduled: z.number(),
39
39
  hashed_shape_id: z.string(),
@@ -51,16 +51,16 @@ export const RideSchema = DocumentSchema.extend({
51
51
  pattern_id: z.string(),
52
52
  plan_id: z.string(),
53
53
  route_id: z.string(),
54
- seen_first_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
55
- seen_last_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
56
- start_time_observed: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
57
- start_time_scheduled: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp'),
54
+ seen_first_at: unixTimeStampSchema.nullable(),
55
+ seen_last_at: unixTimeStampSchema.nullable(),
56
+ start_time_observed: unixTimeStampSchema.nullable(),
57
+ start_time_scheduled: unixTimeStampSchema,
58
58
  system_status: ProcessingStatusSchema.default('waiting'),
59
59
  trip_id: z.string(),
60
60
  vehicle_ids: z.array(z.number()),
61
61
  }).strip();
62
62
  export const CreateRideSchema = RideSchema.partial({ _id: true }).omit({ created_at: true, updated_at: true });
63
- export const UpdateRideSchema = CreateRideSchema.partial();
63
+ export const UpdateRideSchema = CreateRideSchema.omit({ created_by: true }).partial();
64
64
  /* * */
65
65
  export const RidePermissionSchema = z.object({
66
66
  agency_ids: z.array(z.string()),
@@ -1,16 +1,15 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const SamAnalysisSchema: z.ZodObject<{
4
3
  apex_version: z.ZodNullable<z.ZodString>;
5
4
  device_id: z.ZodNullable<z.ZodString>;
6
- end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
5
+ end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
7
6
  first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
8
7
  first_transaction_id: z.ZodNullable<z.ZodString>;
9
8
  first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
10
9
  last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
11
10
  last_transaction_id: z.ZodNullable<z.ZodString>;
12
11
  last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
13
- start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
12
+ start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
14
13
  transactions_expected: z.ZodNullable<z.ZodNumber>;
15
14
  transactions_found: z.ZodNullable<z.ZodNumber>;
16
15
  transactions_missing: z.ZodNullable<z.ZodNumber>;
@@ -18,18 +17,14 @@ export declare const SamAnalysisSchema: z.ZodObject<{
18
17
  }, "strict", z.ZodTypeAny, {
19
18
  apex_version: string | null;
20
19
  device_id: string | null;
21
- end_time: (number & {
22
- __brand: "UnixTimestamp";
23
- } & z.BRAND<"UnixTimestamp">) | null;
20
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
24
21
  first_transaction_ase_counter_value: number | null;
25
22
  first_transaction_id: string | null;
26
23
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
27
24
  last_transaction_ase_counter_value: number | null;
28
25
  last_transaction_id: string | null;
29
26
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
30
- start_time: (number & {
31
- __brand: "UnixTimestamp";
32
- } & z.BRAND<"UnixTimestamp">) | null;
27
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
33
28
  transactions_expected: number | null;
34
29
  transactions_found: number | null;
35
30
  transactions_missing: number | null;
@@ -50,7 +45,4 @@ export declare const SamAnalysisSchema: z.ZodObject<{
50
45
  transactions_missing: number | null;
51
46
  vehicle_id: number | null;
52
47
  }>;
53
- export interface SamAnalysis extends Omit<z.infer<typeof SamAnalysisSchema>, 'end_time' | 'start_time'> {
54
- end_time: null | UnixTimestamp;
55
- start_time: null | UnixTimestamp;
56
- }
48
+ export type SamAnalysis = z.infer<typeof SamAnalysisSchema>;
@@ -1,19 +1,19 @@
1
1
  /* * */
2
- import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
2
+ import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
3
3
  import { SimplifiedApexTypeSchema } from '../simplified-apex/simplified-apex-type.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
6
  export const SamAnalysisSchema = z.object({
7
7
  apex_version: z.string().nullable(),
8
8
  device_id: z.string().nullable(),
9
- end_time: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
9
+ end_time: unixTimeStampSchema.nullable(),
10
10
  first_transaction_ase_counter_value: z.number().nullable(),
11
11
  first_transaction_id: z.string().nullable(),
12
12
  first_transaction_type: SimplifiedApexTypeSchema.nullable(),
13
13
  last_transaction_ase_counter_value: z.number().nullable(),
14
14
  last_transaction_id: z.string().nullable(),
15
15
  last_transaction_type: SimplifiedApexTypeSchema.nullable(),
16
- start_time: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
16
+ start_time: unixTimeStampSchema.nullable(),
17
17
  transactions_expected: z.number().nullable(),
18
18
  transactions_found: z.number().nullable(),
19
19
  transactions_missing: z.number().nullable(),
@@ -1,10 +1,8 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
- import { type SamAnalysis } from './sam-analysis.js';
3
1
  import { z } from 'zod';
4
2
  export declare const SamSchema: z.ZodObject<{
5
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
3
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
6
4
  created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
5
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
8
6
  updated_by: z.ZodDefault<z.ZodString>;
9
7
  } & {
10
8
  _id: z.ZodNumber;
@@ -12,14 +10,14 @@ export declare const SamSchema: z.ZodObject<{
12
10
  analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
13
11
  apex_version: z.ZodNullable<z.ZodString>;
14
12
  device_id: z.ZodNullable<z.ZodString>;
15
- end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
13
+ end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
16
14
  first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
17
15
  first_transaction_id: z.ZodNullable<z.ZodString>;
18
16
  first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
19
17
  last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
20
18
  last_transaction_id: z.ZodNullable<z.ZodString>;
21
19
  last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
22
- start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
20
+ start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
23
21
  transactions_expected: z.ZodNullable<z.ZodNumber>;
24
22
  transactions_found: z.ZodNullable<z.ZodNumber>;
25
23
  transactions_missing: z.ZodNullable<z.ZodNumber>;
@@ -27,18 +25,14 @@ export declare const SamSchema: z.ZodObject<{
27
25
  }, "strict", z.ZodTypeAny, {
28
26
  apex_version: string | null;
29
27
  device_id: string | null;
30
- end_time: (number & {
31
- __brand: "UnixTimestamp";
32
- } & z.BRAND<"UnixTimestamp">) | null;
28
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
33
29
  first_transaction_ase_counter_value: number | null;
34
30
  first_transaction_id: string | null;
35
31
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
36
32
  last_transaction_ase_counter_value: number | null;
37
33
  last_transaction_id: string | null;
38
34
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
39
- start_time: (number & {
40
- __brand: "UnixTimestamp";
41
- } & z.BRAND<"UnixTimestamp">) | null;
35
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
42
36
  transactions_expected: number | null;
43
37
  transactions_found: number | null;
44
38
  transactions_missing: number | null;
@@ -61,8 +55,8 @@ export declare const SamSchema: z.ZodObject<{
61
55
  }>, "many">>;
62
56
  latest_apex_version: z.ZodNullable<z.ZodString>;
63
57
  remarks: z.ZodDefault<z.ZodNullable<z.ZodString>>;
64
- seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
65
- seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
58
+ seen_first_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
59
+ seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
66
60
  system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
67
61
  transactions_expected: z.ZodNullable<z.ZodNumber>;
68
62
  transactions_found: z.ZodNullable<z.ZodNumber>;
@@ -81,29 +75,21 @@ export declare const SamSchema: z.ZodObject<{
81
75
  analysis: {
82
76
  apex_version: string | null;
83
77
  device_id: string | null;
84
- end_time: (number & {
85
- __brand: "UnixTimestamp";
86
- } & z.BRAND<"UnixTimestamp">) | null;
78
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
87
79
  first_transaction_ase_counter_value: number | null;
88
80
  first_transaction_id: string | null;
89
81
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
90
82
  last_transaction_ase_counter_value: number | null;
91
83
  last_transaction_id: string | null;
92
84
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
93
- start_time: (number & {
94
- __brand: "UnixTimestamp";
95
- } & z.BRAND<"UnixTimestamp">) | null;
85
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
96
86
  transactions_expected: number | null;
97
87
  transactions_found: number | null;
98
88
  transactions_missing: number | null;
99
89
  vehicle_id: number | null;
100
90
  }[];
101
- seen_first_at: (number & {
102
- __brand: "UnixTimestamp";
103
- } & z.BRAND<"UnixTimestamp">) | null;
104
- seen_last_at: (number & {
105
- __brand: "UnixTimestamp";
106
- } & z.BRAND<"UnixTimestamp">) | null;
91
+ seen_first_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
92
+ seen_last_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
107
93
  system_status: "waiting" | "processing" | "complete" | "error";
108
94
  transactions_expected: number | null;
109
95
  transactions_found: number | null;
@@ -143,9 +129,9 @@ export declare const SamSchema: z.ZodObject<{
143
129
  remarks?: string | null | undefined;
144
130
  }>;
145
131
  export declare const CreateSamSchema: z.ZodObject<Omit<{
146
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
132
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
147
133
  created_by: z.ZodDefault<z.ZodString>;
148
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
134
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
149
135
  updated_by: z.ZodDefault<z.ZodString>;
150
136
  } & {
151
137
  _id: z.ZodNumber;
@@ -153,14 +139,14 @@ export declare const CreateSamSchema: z.ZodObject<Omit<{
153
139
  analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
154
140
  apex_version: z.ZodNullable<z.ZodString>;
155
141
  device_id: z.ZodNullable<z.ZodString>;
156
- end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
142
+ end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
157
143
  first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
158
144
  first_transaction_id: z.ZodNullable<z.ZodString>;
159
145
  first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
160
146
  last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
161
147
  last_transaction_id: z.ZodNullable<z.ZodString>;
162
148
  last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
163
- start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
149
+ start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
164
150
  transactions_expected: z.ZodNullable<z.ZodNumber>;
165
151
  transactions_found: z.ZodNullable<z.ZodNumber>;
166
152
  transactions_missing: z.ZodNullable<z.ZodNumber>;
@@ -168,18 +154,14 @@ export declare const CreateSamSchema: z.ZodObject<Omit<{
168
154
  }, "strict", z.ZodTypeAny, {
169
155
  apex_version: string | null;
170
156
  device_id: string | null;
171
- end_time: (number & {
172
- __brand: "UnixTimestamp";
173
- } & z.BRAND<"UnixTimestamp">) | null;
157
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
174
158
  first_transaction_ase_counter_value: number | null;
175
159
  first_transaction_id: string | null;
176
160
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
177
161
  last_transaction_ase_counter_value: number | null;
178
162
  last_transaction_id: string | null;
179
163
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
180
- start_time: (number & {
181
- __brand: "UnixTimestamp";
182
- } & z.BRAND<"UnixTimestamp">) | null;
164
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
183
165
  transactions_expected: number | null;
184
166
  transactions_found: number | null;
185
167
  transactions_missing: number | null;
@@ -202,8 +184,8 @@ export declare const CreateSamSchema: z.ZodObject<Omit<{
202
184
  }>, "many">>;
203
185
  latest_apex_version: z.ZodNullable<z.ZodString>;
204
186
  remarks: z.ZodDefault<z.ZodNullable<z.ZodString>>;
205
- seen_first_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
206
- seen_last_at: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
187
+ seen_first_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
188
+ seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
207
189
  system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
208
190
  transactions_expected: z.ZodNullable<z.ZodNumber>;
209
191
  transactions_found: z.ZodNullable<z.ZodNumber>;
@@ -216,29 +198,21 @@ export declare const CreateSamSchema: z.ZodObject<Omit<{
216
198
  analysis: {
217
199
  apex_version: string | null;
218
200
  device_id: string | null;
219
- end_time: (number & {
220
- __brand: "UnixTimestamp";
221
- } & z.BRAND<"UnixTimestamp">) | null;
201
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
222
202
  first_transaction_ase_counter_value: number | null;
223
203
  first_transaction_id: string | null;
224
204
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
225
205
  last_transaction_ase_counter_value: number | null;
226
206
  last_transaction_id: string | null;
227
207
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
228
- start_time: (number & {
229
- __brand: "UnixTimestamp";
230
- } & z.BRAND<"UnixTimestamp">) | null;
208
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
231
209
  transactions_expected: number | null;
232
210
  transactions_found: number | null;
233
211
  transactions_missing: number | null;
234
212
  vehicle_id: number | null;
235
213
  }[];
236
- seen_first_at: (number & {
237
- __brand: "UnixTimestamp";
238
- } & z.BRAND<"UnixTimestamp">) | null;
239
- seen_last_at: (number & {
240
- __brand: "UnixTimestamp";
241
- } & z.BRAND<"UnixTimestamp">) | null;
214
+ seen_first_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
215
+ seen_last_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
242
216
  system_status: "waiting" | "processing" | "complete" | "error";
243
217
  transactions_expected: number | null;
244
218
  transactions_found: number | null;
@@ -277,20 +251,19 @@ export declare const CreateSamSchema: z.ZodObject<Omit<{
277
251
  }>;
278
252
  export declare const UpdateSamSchema: z.ZodObject<{
279
253
  _id: z.ZodOptional<z.ZodNumber>;
280
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
281
254
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
282
255
  agency_id: z.ZodOptional<z.ZodString>;
283
256
  analysis: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
284
257
  apex_version: z.ZodNullable<z.ZodString>;
285
258
  device_id: z.ZodNullable<z.ZodString>;
286
- end_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
259
+ end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
287
260
  first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
288
261
  first_transaction_id: z.ZodNullable<z.ZodString>;
289
262
  first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
290
263
  last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
291
264
  last_transaction_id: z.ZodNullable<z.ZodString>;
292
265
  last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
293
- start_time: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
266
+ start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
294
267
  transactions_expected: z.ZodNullable<z.ZodNumber>;
295
268
  transactions_found: z.ZodNullable<z.ZodNumber>;
296
269
  transactions_missing: z.ZodNullable<z.ZodNumber>;
@@ -298,18 +271,14 @@ export declare const UpdateSamSchema: z.ZodObject<{
298
271
  }, "strict", z.ZodTypeAny, {
299
272
  apex_version: string | null;
300
273
  device_id: string | null;
301
- end_time: (number & {
302
- __brand: "UnixTimestamp";
303
- } & z.BRAND<"UnixTimestamp">) | null;
274
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
304
275
  first_transaction_ase_counter_value: number | null;
305
276
  first_transaction_id: string | null;
306
277
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
307
278
  last_transaction_ase_counter_value: number | null;
308
279
  last_transaction_id: string | null;
309
280
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
310
- start_time: (number & {
311
- __brand: "UnixTimestamp";
312
- } & z.BRAND<"UnixTimestamp">) | null;
281
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
313
282
  transactions_expected: number | null;
314
283
  transactions_found: number | null;
315
284
  transactions_missing: number | null;
@@ -330,8 +299,8 @@ export declare const UpdateSamSchema: z.ZodObject<{
330
299
  transactions_missing: number | null;
331
300
  vehicle_id: number | null;
332
301
  }>, "many">>>;
333
- seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
334
- seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
302
+ seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
303
+ seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
335
304
  system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>>;
336
305
  transactions_expected: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
337
306
  transactions_found: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -340,35 +309,26 @@ export declare const UpdateSamSchema: z.ZodObject<{
340
309
  remarks: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
341
310
  }, "strict", z.ZodTypeAny, {
342
311
  _id?: number | undefined;
343
- created_by?: string | undefined;
344
312
  updated_by?: string | undefined;
345
313
  agency_id?: string | undefined;
346
314
  analysis?: {
347
315
  apex_version: string | null;
348
316
  device_id: string | null;
349
- end_time: (number & {
350
- __brand: "UnixTimestamp";
351
- } & z.BRAND<"UnixTimestamp">) | null;
317
+ end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
352
318
  first_transaction_ase_counter_value: number | null;
353
319
  first_transaction_id: string | null;
354
320
  first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
355
321
  last_transaction_ase_counter_value: number | null;
356
322
  last_transaction_id: string | null;
357
323
  last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
358
- start_time: (number & {
359
- __brand: "UnixTimestamp";
360
- } & z.BRAND<"UnixTimestamp">) | null;
324
+ start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
361
325
  transactions_expected: number | null;
362
326
  transactions_found: number | null;
363
327
  transactions_missing: number | null;
364
328
  vehicle_id: number | null;
365
329
  }[] | undefined;
366
- seen_first_at?: (number & {
367
- __brand: "UnixTimestamp";
368
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
369
- seen_last_at?: (number & {
370
- __brand: "UnixTimestamp";
371
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
330
+ seen_first_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
331
+ seen_last_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
372
332
  system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
373
333
  transactions_expected?: number | null | undefined;
374
334
  transactions_found?: number | null | undefined;
@@ -377,7 +337,6 @@ export declare const UpdateSamSchema: z.ZodObject<{
377
337
  remarks?: string | null | undefined;
378
338
  }, {
379
339
  _id?: number | undefined;
380
- created_by?: string | undefined;
381
340
  updated_by?: string | undefined;
382
341
  agency_id?: string | undefined;
383
342
  analysis?: {
@@ -412,16 +371,6 @@ export declare const UpdateSamSchema: z.ZodObject<{
412
371
  * the transactions are real, unique and incremental. This allows the system to
413
372
  * detect if a transaction has been tampered with or if any transactions are missing.
414
373
  */
415
- export interface Sam extends Omit<z.infer<typeof SamSchema>, 'analysis' | 'created_at' | 'seen_first_at' | 'seen_last_at' | 'updated_at'> {
416
- analysis: SamAnalysis[];
417
- created_at: UnixTimestamp;
418
- seen_first_at: null | UnixTimestamp;
419
- seen_last_at: null | UnixTimestamp;
420
- updated_at: UnixTimestamp;
421
- }
422
- export interface CreateSamDto extends Omit<z.infer<typeof CreateSamSchema>, 'analysis' | 'seen_first_at' | 'seen_last_at'> {
423
- analysis: SamAnalysis[];
424
- seen_first_at: null | UnixTimestamp;
425
- seen_last_at: null | UnixTimestamp;
426
- }
427
- export type UpdateSamDto = Partial<CreateSamDto>;
374
+ export type Sam = z.infer<typeof SamSchema>;
375
+ export type CreateSamDto = z.infer<typeof CreateSamSchema>;
376
+ export type UpdateSamDto = z.infer<typeof UpdateSamSchema>;
@@ -1,6 +1,6 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from '../_common/document.js';
3
- import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
3
+ import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
4
4
  import { SamAnalysisSchema } from './sam-analysis.js';
5
5
  import { ProcessingStatusSchema } from '../system/processing-status.js';
6
6
  import { z } from 'zod';
@@ -11,12 +11,12 @@ export const SamSchema = DocumentSchema.extend({
11
11
  analysis: z.array(SamAnalysisSchema).default([]),
12
12
  latest_apex_version: z.string().nullable(),
13
13
  remarks: z.string().nullable().default(null),
14
- seen_first_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
15
- seen_last_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp').nullable(),
14
+ seen_first_at: unixTimeStampSchema.nullable(),
15
+ seen_last_at: unixTimeStampSchema.nullable(),
16
16
  system_status: ProcessingStatusSchema.default('waiting'),
17
17
  transactions_expected: z.number().nullable(),
18
18
  transactions_found: z.number().nullable(),
19
19
  transactions_missing: z.number().nullable(),
20
20
  }).strict();
21
21
  export const CreateSamSchema = SamSchema.omit({ created_at: true, updated_at: true });
22
- export const UpdateSamSchema = CreateSamSchema.partial();
22
+ export const UpdateSamSchema = CreateSamSchema.omit({ created_by: true }).partial();
@@ -1,10 +1,9 @@
1
- import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const SimplifiedApexLocationSchema: z.ZodObject<{
4
3
  _id: z.ZodString;
5
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
6
5
  created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
8
7
  updated_by: z.ZodDefault<z.ZodString>;
9
8
  } & {
10
9
  agency_id: z.ZodString;
@@ -14,7 +13,7 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
14
13
  mac_ase_counter_value: z.ZodNumber;
15
14
  mac_sam_serial_number: z.ZodNumber;
16
15
  pattern_id: z.ZodString;
17
- received_at: z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">;
16
+ received_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
18
17
  stop_id: z.ZodString;
19
18
  trip_id: z.ZodString;
20
19
  vehicle_id: z.ZodNumber;
@@ -30,8 +29,8 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
30
29
  updated_by: string;
31
30
  agency_id: string;
32
31
  line_id: string;
33
- pattern_id: string;
34
32
  trip_id: string;
33
+ pattern_id: string;
35
34
  apex_version: string;
36
35
  device_id: string;
37
36
  vehicle_id: number;
@@ -39,7 +38,7 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
39
38
  mac_sam_serial_number: number;
40
39
  received_at: number & {
41
40
  __brand: "UnixTimestamp";
42
- } & z.BRAND<"UnixTimestamp">;
41
+ };
43
42
  stop_id: string;
44
43
  }, {
45
44
  _id: string;
@@ -47,8 +46,8 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
47
46
  updated_at: number;
48
47
  agency_id: string;
49
48
  line_id: string;
50
- pattern_id: string;
51
49
  trip_id: string;
50
+ pattern_id: string;
52
51
  apex_version: string;
53
52
  device_id: string;
54
53
  vehicle_id: number;
@@ -61,9 +60,9 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
61
60
  }>;
62
61
  export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
63
62
  _id: z.ZodOptional<z.ZodString>;
64
- created_at: z.ZodOptional<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>;
63
+ created_at: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
65
64
  created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
66
- updated_at: z.ZodOptional<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>>;
65
+ updated_at: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
67
66
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
68
67
  agency_id: z.ZodOptional<z.ZodString>;
69
68
  apex_version: z.ZodOptional<z.ZodString>;
@@ -72,28 +71,26 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
72
71
  mac_ase_counter_value: z.ZodOptional<z.ZodNumber>;
73
72
  mac_sam_serial_number: z.ZodOptional<z.ZodNumber>;
74
73
  pattern_id: z.ZodOptional<z.ZodString>;
75
- received_at: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
74
+ received_at: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
76
75
  stop_id: z.ZodOptional<z.ZodString>;
77
76
  trip_id: z.ZodOptional<z.ZodString>;
78
77
  vehicle_id: z.ZodOptional<z.ZodNumber>;
79
78
  }, "strict", z.ZodTypeAny, {
80
79
  _id?: string | undefined;
81
- created_at?: UnixTimestamp | undefined;
80
+ created_at?: import("../_common/unix-timestamp.js").UnixTimestamp | undefined;
82
81
  created_by?: string | undefined;
83
- updated_at?: UnixTimestamp | undefined;
82
+ updated_at?: import("../_common/unix-timestamp.js").UnixTimestamp | undefined;
84
83
  updated_by?: string | undefined;
85
84
  agency_id?: string | undefined;
86
85
  line_id?: string | undefined;
87
- pattern_id?: string | undefined;
88
86
  trip_id?: string | undefined;
87
+ pattern_id?: string | undefined;
89
88
  apex_version?: string | undefined;
90
89
  device_id?: string | undefined;
91
90
  vehicle_id?: number | undefined;
92
91
  mac_ase_counter_value?: number | undefined;
93
92
  mac_sam_serial_number?: number | undefined;
94
- received_at?: (number & {
95
- __brand: "UnixTimestamp";
96
- } & z.BRAND<"UnixTimestamp">) | undefined;
93
+ received_at?: import("../_common/unix-timestamp.js").UnixTimestamp | undefined;
97
94
  stop_id?: string | undefined;
98
95
  }, {
99
96
  _id?: string | undefined;
@@ -103,8 +100,8 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
103
100
  updated_by?: string | undefined;
104
101
  agency_id?: string | undefined;
105
102
  line_id?: string | undefined;
106
- pattern_id?: string | undefined;
107
103
  trip_id?: string | undefined;
104
+ pattern_id?: string | undefined;
108
105
  apex_version?: string | undefined;
109
106
  device_id?: string | undefined;
110
107
  vehicle_id?: number | undefined;
@@ -120,9 +117,5 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
120
117
  * of products. In summary, these transactions are generated every time the vehicle has a change
121
118
  * in the current stop ID, trip ID, route ID, pattern ID, etc.
122
119
  */
123
- export interface SimplifiedApexLocation extends Omit<z.infer<typeof SimplifiedApexLocationSchema>, 'created_at' | 'received_at' | 'updated_at'> {
124
- created_at: UnixTimestamp;
125
- received_at: UnixTimestamp;
126
- updated_at: UnixTimestamp;
127
- }
128
- export type UpdateSimplifiedApexLocationDto = Partial<SimplifiedApexLocation>;
120
+ export type SimplifiedApexLocation = z.infer<typeof SimplifiedApexLocationSchema>;
121
+ export type UpdateSimplifiedApexLocationDto = z.infer<typeof UpdateSimplifiedApexLocationSchema>;
@@ -1,6 +1,6 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from '../_common/document.js';
3
- import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
3
+ import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
6
  export const SimplifiedApexLocationSchema = DocumentSchema.extend({
@@ -11,7 +11,7 @@ export const SimplifiedApexLocationSchema = DocumentSchema.extend({
11
11
  mac_ase_counter_value: z.number(),
12
12
  mac_sam_serial_number: z.number(),
13
13
  pattern_id: z.string(),
14
- received_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp'),
14
+ received_at: unixTimeStampSchema,
15
15
  stop_id: z.string(),
16
16
  trip_id: z.string(),
17
17
  vehicle_id: z.number(),