@tmlmobilidade/types 20250916.1050.43 → 20250916.1601.30

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,44 +1,31 @@
1
1
  /* * */
2
2
  import { CommentSchema } from '../_common/comment.js';
3
3
  import { DocumentSchema } from '../_common/document.js';
4
- import { atLeastOneVehicleEventOnFirstStopSchema, endedAtLastStopSchema, expectedApexValidationIntervalSchema, expectedDriverIdQtySchema, expectedStartTimeSchema, expectedVehicleEventDelaySchema, expectedVehicleEventIntervalSchema, expectedVehicleEventQtySchema, expectedVehicleIdQtySchema, matchingApexLocationsSchema, matchingVehicleIdsSchema, RideAnalysisSchema, simpleOneApexValidationSchema, simpleOneVehicleEventOrApexValidationSchema, simpleThreeVehicleEventsSchema, transactionSequentialitySchema } from './ride-analysis.js';
5
4
  import { z } from 'zod';
5
+ import { RideAnalysisSummarySchema } from './ride-analysis.js';
6
6
  /* * */
7
7
  export const RIDE_ACCEPTANCE_STATUS_OPTIONS = ['justification_required', 'under_review', 'accepted', 'rejected'];
8
8
  export const RideAcceptanceStatusSchema = z.enum(RIDE_ACCEPTANCE_STATUS_OPTIONS);
9
9
  export const RIDE_JUSTIFICATION_CAUSE_OPTIONS = ['TECHNICAL_PROBLEM', 'DEMONSTRATION', 'ACCIDENT', 'WEATHER', 'CONSTRUCTION', 'POLICE_ACTIVITY', 'MEDICAL_EMERGENCY', 'OTHER_CAUSE'];
10
10
  export const RideJustificationCauseSchema = z.enum(RIDE_JUSTIFICATION_CAUSE_OPTIONS);
11
- export const RIDE_JUSTIFICATION_SOURCE_OPTIONS = ['MANUAL', 'REALTIME_ALERT'];
11
+ export const RIDE_JUSTIFICATION_SOURCE_OPTIONS = ['MANUAL', 'ALERT'];
12
12
  export const RideJustificationSourceSchema = z.enum(RIDE_JUSTIFICATION_SOURCE_OPTIONS);
13
13
  export const RIDE_JUSTIFICATION_STATUS_TYPE_OPTIONS = ['locked_status', 'acceptance_status', 'pto_message'];
14
14
  export const RideJustificationStatusTypeSchema = z.enum(RIDE_JUSTIFICATION_STATUS_TYPE_OPTIONS);
15
15
  /* * */
16
16
  export const RideJustificationSchema = DocumentSchema.extend({
17
- acceptance_status: RideAcceptanceStatusSchema,
18
- analysis: z.object({
19
- AT_LEAST_ONE_VEHICLE_EVENT_ON_FIRST_STOP: atLeastOneVehicleEventOnFirstStopSchema,
20
- ENDED_AT_LAST_STOP: endedAtLastStopSchema,
21
- EXPECTED_APEX_VALIDATION_INTERVAL: expectedApexValidationIntervalSchema,
22
- EXPECTED_DRIVER_ID_QTY: expectedDriverIdQtySchema,
23
- EXPECTED_START_TIME: expectedStartTimeSchema,
24
- EXPECTED_VEHICLE_EVENT_DELAY: expectedVehicleEventDelaySchema,
25
- EXPECTED_VEHICLE_EVENT_INTERVAL: expectedVehicleEventIntervalSchema,
26
- EXPECTED_VEHICLE_EVENT_QTY: expectedVehicleEventQtySchema,
27
- EXPECTED_VEHICLE_ID_QTY: expectedVehicleIdQtySchema,
28
- MATCHING_APEX_LOCATIONS: matchingApexLocationsSchema,
29
- MATCHING_VEHICLE_IDS: matchingVehicleIdsSchema,
30
- SIMPLE_ONE_APEX_VALIDATION: simpleOneApexValidationSchema,
31
- SIMPLE_ONE_VEHICLE_EVENT_OR_APEX_VALIDATION: simpleOneVehicleEventOrApexValidationSchema,
32
- SIMPLE_THREE_VEHICLE_EVENTS: simpleThreeVehicleEventsSchema,
33
- TRANSACTION_SEQUENTIALITY: transactionSequentialitySchema,
34
- }).nullable(),
35
- analysisSummary: RideAnalysisSchema,
36
- comments: z.array(CommentSchema).default([]),
37
- is_locked: z.boolean().default(false),
38
17
  justification_cause: RideJustificationCauseSchema,
39
18
  justification_source: RideJustificationSourceSchema,
40
19
  pto_message: z.string().min(2).max(5000).default(''),
41
- trip_id: z.string(),
20
+ }).omit({ _id: true }).strict();
21
+ /* * */
22
+ export const RideAcceptanceSchema = DocumentSchema.extend({
23
+ acceptance_status: RideAcceptanceStatusSchema,
24
+ analysis_summary: RideAnalysisSummarySchema,
25
+ comments: z.array(CommentSchema).default([]),
26
+ is_locked: z.boolean().default(false),
27
+ justification: RideJustificationSchema.nullable(),
28
+ ride_id: z.string(),
42
29
  }).strict();
43
- export const CreateRideJustificationSchema = RideJustificationSchema.partial({ _id: true }).omit({ created_at: true, updated_at: true });
44
- export const UpdateRideJustificationSchema = CreateRideJustificationSchema.omit({ analysis: true, created_by: true, justification_source: true }).partial();
30
+ export const CreateRideAcceptanceSchema = RideAcceptanceSchema.partial({ _id: true }).omit({ created_at: true, updated_at: true });
31
+ export const UpdateRideAcceptanceSchema = RideAcceptanceSchema.omit({ created_at: true, created_by: true }).partial();
@@ -581,7 +581,6 @@ export declare const RideSchema: z.ZodObject<{
581
581
  error_message?: string | undefined;
582
582
  };
583
583
  } | null;
584
- trip_id: string;
585
584
  apex_locations_qty: number | null;
586
585
  apex_on_board_refunds_amount: number | null;
587
586
  apex_on_board_refunds_qty: number | null;
@@ -618,6 +617,7 @@ export declare const RideSchema: z.ZodObject<{
618
617
  __brand: "UnixTimestamp";
619
618
  };
620
619
  system_status: "waiting" | "processing" | "complete" | "error";
620
+ trip_id: string;
621
621
  vehicle_ids: number[];
622
622
  created_by?: string | undefined;
623
623
  updated_by?: string | undefined;
@@ -719,7 +719,6 @@ export declare const RideSchema: z.ZodObject<{
719
719
  error_message?: string | undefined;
720
720
  };
721
721
  } | null;
722
- trip_id: string;
723
722
  apex_locations_qty: number | null;
724
723
  apex_on_board_refunds_amount: number | null;
725
724
  apex_on_board_refunds_qty: number | null;
@@ -749,6 +748,7 @@ export declare const RideSchema: z.ZodObject<{
749
748
  seen_last_at: number | null;
750
749
  start_time_observed: number | null;
751
750
  start_time_scheduled: number;
751
+ trip_id: string;
752
752
  vehicle_ids: number[];
753
753
  created_by?: string | undefined;
754
754
  updated_by?: string | undefined;
@@ -1201,7 +1201,6 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1201
1201
  error_message?: string | undefined;
1202
1202
  };
1203
1203
  }>>;
1204
- trip_id: z.ZodString;
1205
1204
  apex_locations_qty: z.ZodNullable<z.ZodNumber>;
1206
1205
  apex_on_board_refunds_amount: z.ZodNullable<z.ZodNumber>;
1207
1206
  apex_on_board_refunds_qty: z.ZodNullable<z.ZodNumber>;
@@ -1232,6 +1231,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1232
1231
  start_time_observed: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
1233
1232
  start_time_scheduled: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
1234
1233
  system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
1234
+ trip_id: z.ZodString;
1235
1235
  vehicle_ids: z.ZodArray<z.ZodNumber, "many">;
1236
1236
  }, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
1237
1237
  agency_id: string;
@@ -1328,7 +1328,6 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1328
1328
  error_message?: string | undefined;
1329
1329
  };
1330
1330
  } | null;
1331
- trip_id: string;
1332
1331
  apex_locations_qty: number | null;
1333
1332
  apex_on_board_refunds_amount: number | null;
1334
1333
  apex_on_board_refunds_qty: number | null;
@@ -1365,6 +1364,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1365
1364
  __brand: "UnixTimestamp";
1366
1365
  };
1367
1366
  system_status: "waiting" | "processing" | "complete" | "error";
1367
+ trip_id: string;
1368
1368
  vehicle_ids: number[];
1369
1369
  _id?: string | undefined;
1370
1370
  created_by?: string | undefined;
@@ -1464,7 +1464,6 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1464
1464
  error_message?: string | undefined;
1465
1465
  };
1466
1466
  } | null;
1467
- trip_id: string;
1468
1467
  apex_locations_qty: number | null;
1469
1468
  apex_on_board_refunds_amount: number | null;
1470
1469
  apex_on_board_refunds_qty: number | null;
@@ -1494,6 +1493,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1494
1493
  seen_last_at: number | null;
1495
1494
  start_time_observed: number | null;
1496
1495
  start_time_scheduled: number;
1496
+ trip_id: string;
1497
1497
  vehicle_ids: number[];
1498
1498
  _id?: string | undefined;
1499
1499
  created_by?: string | undefined;
@@ -1944,7 +1944,6 @@ export declare const UpdateRideSchema: z.ZodObject<{
1944
1944
  error_message?: string | undefined;
1945
1945
  };
1946
1946
  }>>>;
1947
- trip_id: z.ZodOptional<z.ZodString>;
1948
1947
  apex_locations_qty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1949
1948
  apex_on_board_refunds_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1950
1949
  apex_on_board_refunds_qty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -1975,6 +1974,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
1975
1974
  start_time_observed: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
1976
1975
  start_time_scheduled: z.ZodOptional<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
1977
1976
  system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>>;
1977
+ trip_id: z.ZodOptional<z.ZodString>;
1978
1978
  vehicle_ids: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
1979
1979
  }, "strip", z.ZodTypeAny, {
1980
1980
  _id?: string | undefined;
@@ -2073,7 +2073,6 @@ export declare const UpdateRideSchema: z.ZodObject<{
2073
2073
  error_message?: string | undefined;
2074
2074
  };
2075
2075
  } | null | undefined;
2076
- trip_id?: string | undefined;
2077
2076
  apex_locations_qty?: number | null | undefined;
2078
2077
  apex_on_board_refunds_amount?: number | null | undefined;
2079
2078
  apex_on_board_refunds_qty?: number | null | undefined;
@@ -2104,6 +2103,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
2104
2103
  start_time_observed?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
2105
2104
  start_time_scheduled?: import("../_common/unix-timestamp.js").UnixTimestamp | undefined;
2106
2105
  system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
2106
+ trip_id?: string | undefined;
2107
2107
  vehicle_ids?: number[] | undefined;
2108
2108
  }, {
2109
2109
  _id?: string | undefined;
@@ -2202,7 +2202,6 @@ export declare const UpdateRideSchema: z.ZodObject<{
2202
2202
  error_message?: string | undefined;
2203
2203
  };
2204
2204
  } | null | undefined;
2205
- trip_id?: string | undefined;
2206
2205
  apex_locations_qty?: number | null | undefined;
2207
2206
  apex_on_board_refunds_amount?: number | null | undefined;
2208
2207
  apex_on_board_refunds_qty?: number | null | undefined;
@@ -2233,6 +2232,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
2233
2232
  start_time_observed?: number | null | undefined;
2234
2233
  start_time_scheduled?: number | undefined;
2235
2234
  system_status?: "waiting" | "processing" | "complete" | "error" | undefined;
2235
+ trip_id?: string | undefined;
2236
2236
  vehicle_ids?: number[] | undefined;
2237
2237
  }>;
2238
2238
  export type Ride = z.infer<typeof RideSchema>;
@@ -27,8 +27,8 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
27
27
  };
28
28
  agency_id: string;
29
29
  line_id: string;
30
- trip_id: string;
31
30
  pattern_id: string;
31
+ trip_id: string;
32
32
  apex_version: string;
33
33
  device_id: string;
34
34
  vehicle_id: number;
@@ -46,8 +46,8 @@ export declare const SimplifiedApexLocationSchema: z.ZodObject<{
46
46
  updated_at: number;
47
47
  agency_id: string;
48
48
  line_id: string;
49
- trip_id: string;
50
49
  pattern_id: string;
50
+ trip_id: string;
51
51
  apex_version: string;
52
52
  device_id: string;
53
53
  vehicle_id: number;
@@ -83,8 +83,8 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
83
83
  updated_by?: string | undefined;
84
84
  agency_id?: string | undefined;
85
85
  line_id?: string | undefined;
86
- trip_id?: string | undefined;
87
86
  pattern_id?: string | undefined;
87
+ trip_id?: string | undefined;
88
88
  apex_version?: string | undefined;
89
89
  device_id?: string | undefined;
90
90
  vehicle_id?: number | undefined;
@@ -100,8 +100,8 @@ export declare const UpdateSimplifiedApexLocationSchema: z.ZodObject<{
100
100
  updated_by?: string | undefined;
101
101
  agency_id?: string | undefined;
102
102
  line_id?: string | undefined;
103
- trip_id?: string | undefined;
104
103
  pattern_id?: string | undefined;
104
+ trip_id?: string | undefined;
105
105
  apex_version?: string | undefined;
106
106
  device_id?: string | undefined;
107
107
  vehicle_id?: number | undefined;
@@ -38,8 +38,8 @@ export declare const SimplifiedApexOnBoardRefundSchema: z.ZodObject<{
38
38
  agency_id: string;
39
39
  line_id: string | null;
40
40
  validation_id: string | null;
41
- trip_id: string | null;
42
41
  pattern_id: string | null;
42
+ trip_id: string | null;
43
43
  apex_version: string;
44
44
  device_id: string;
45
45
  vehicle_id: number | null;
@@ -67,8 +67,8 @@ export declare const SimplifiedApexOnBoardRefundSchema: z.ZodObject<{
67
67
  agency_id: string;
68
68
  line_id: string | null;
69
69
  validation_id: string | null;
70
- trip_id: string | null;
71
70
  pattern_id: string | null;
71
+ trip_id: string | null;
72
72
  apex_version: string;
73
73
  device_id: string;
74
74
  vehicle_id: number | null;
@@ -124,8 +124,8 @@ export declare const UpdateSimplifiedApexOnBoardRefundSchema: z.ZodObject<{
124
124
  agency_id?: string | undefined;
125
125
  line_id?: string | null | undefined;
126
126
  validation_id?: string | null | undefined;
127
- trip_id?: string | null | undefined;
128
127
  pattern_id?: string | null | undefined;
128
+ trip_id?: string | null | undefined;
129
129
  apex_version?: string | undefined;
130
130
  device_id?: string | undefined;
131
131
  vehicle_id?: number | null | undefined;
@@ -151,8 +151,8 @@ export declare const UpdateSimplifiedApexOnBoardRefundSchema: z.ZodObject<{
151
151
  agency_id?: string | undefined;
152
152
  line_id?: string | null | undefined;
153
153
  validation_id?: string | null | undefined;
154
- trip_id?: string | null | undefined;
155
154
  pattern_id?: string | null | undefined;
155
+ trip_id?: string | null | undefined;
156
156
  apex_version?: string | undefined;
157
157
  device_id?: string | undefined;
158
158
  vehicle_id?: number | null | undefined;
@@ -39,8 +39,8 @@ export declare const SimplifiedApexOnBoardSaleSchema: z.ZodObject<{
39
39
  agency_id: string;
40
40
  line_id: string | null;
41
41
  validation_id: string | null;
42
- trip_id: string | null;
43
42
  pattern_id: string | null;
43
+ trip_id: string | null;
44
44
  apex_version: string;
45
45
  device_id: string;
46
46
  vehicle_id: number | null;
@@ -69,8 +69,8 @@ export declare const SimplifiedApexOnBoardSaleSchema: z.ZodObject<{
69
69
  agency_id: string;
70
70
  line_id: string | null;
71
71
  validation_id: string | null;
72
- trip_id: string | null;
73
72
  pattern_id: string | null;
73
+ trip_id: string | null;
74
74
  apex_version: string;
75
75
  device_id: string;
76
76
  vehicle_id: number | null;
@@ -99,8 +99,8 @@ export declare const UpdateSimplifiedApexOnBoardSaleSchema: z.ZodObject<{
99
99
  agency_id: z.ZodOptional<z.ZodString>;
100
100
  line_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
101
  validation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
- trip_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
102
  pattern_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ trip_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
104
  apex_version: z.ZodOptional<z.ZodString>;
105
105
  device_id: z.ZodOptional<z.ZodString>;
106
106
  vehicle_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -126,8 +126,8 @@ export declare const UpdateSimplifiedApexOnBoardSaleSchema: z.ZodObject<{
126
126
  agency_id?: string | undefined;
127
127
  line_id?: string | null | undefined;
128
128
  validation_id?: string | null | undefined;
129
- trip_id?: string | null | undefined;
130
129
  pattern_id?: string | null | undefined;
130
+ trip_id?: string | null | undefined;
131
131
  apex_version?: string | undefined;
132
132
  device_id?: string | undefined;
133
133
  vehicle_id?: number | null | undefined;
@@ -153,8 +153,8 @@ export declare const UpdateSimplifiedApexOnBoardSaleSchema: z.ZodObject<{
153
153
  agency_id?: string | undefined;
154
154
  line_id?: string | null | undefined;
155
155
  validation_id?: string | null | undefined;
156
- trip_id?: string | null | undefined;
157
156
  pattern_id?: string | null | undefined;
157
+ trip_id?: string | null | undefined;
158
158
  apex_version?: string | undefined;
159
159
  device_id?: string | undefined;
160
160
  vehicle_id?: number | null | undefined;
@@ -251,8 +251,8 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
251
251
  };
252
252
  agency_id: string;
253
253
  line_id: string;
254
- trip_id: string;
255
254
  pattern_id: string;
255
+ trip_id: string;
256
256
  apex_version: string;
257
257
  device_id: string;
258
258
  vehicle_id: number;
@@ -279,8 +279,8 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
279
279
  updated_at: number;
280
280
  agency_id: string;
281
281
  line_id: string;
282
- trip_id: string;
283
282
  pattern_id: string;
283
+ trip_id: string;
284
284
  apex_version: string;
285
285
  device_id: string;
286
286
  vehicle_id: number;
@@ -405,8 +405,8 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
405
405
  updated_by?: string | undefined;
406
406
  agency_id?: string | undefined;
407
407
  line_id?: string | undefined;
408
- trip_id?: string | undefined;
409
408
  pattern_id?: string | undefined;
409
+ trip_id?: string | undefined;
410
410
  apex_version?: string | undefined;
411
411
  device_id?: string | undefined;
412
412
  vehicle_id?: number | undefined;
@@ -431,8 +431,8 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
431
431
  updated_by?: string | undefined;
432
432
  agency_id?: string | undefined;
433
433
  line_id?: string | undefined;
434
- trip_id?: string | undefined;
435
434
  pattern_id?: string | undefined;
435
+ trip_id?: string | undefined;
436
436
  apex_version?: string | undefined;
437
437
  device_id?: string | undefined;
438
438
  vehicle_id?: number | undefined;
@@ -29,8 +29,8 @@ export declare const VehicleEventSchema: z.ZodObject<{
29
29
  __brand: "UnixTimestamp";
30
30
  };
31
31
  agency_id: string;
32
- trip_id: string;
33
32
  pattern_id: string;
33
+ trip_id: string;
34
34
  vehicle_id: string;
35
35
  received_at: number & {
36
36
  __brand: "UnixTimestamp";
@@ -51,8 +51,8 @@ export declare const VehicleEventSchema: z.ZodObject<{
51
51
  created_at: number;
52
52
  updated_at: number;
53
53
  agency_id: string;
54
- trip_id: string;
55
54
  pattern_id: string;
55
+ trip_id: string;
56
56
  vehicle_id: string;
57
57
  received_at: number;
58
58
  stop_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250916.1050.43",
3
+ "version": "20250916.1601.30",
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",