@findatruck/shared-schemas 2.20.0 → 2.23.1
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/browser.cjs +36 -18
- package/dist/browser.d.cts +31 -5
- package/dist/browser.d.ts +31 -5
- package/dist/browser.js +5 -1
- package/dist/{chunk-P4S46OZI.js → chunk-EQIUGAWW.js} +34 -18
- package/dist/index.cjs +377 -197
- package/dist/index.d.cts +458 -21
- package/dist/index.d.ts +458 -21
- package/dist/index.js +326 -172
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
ConvexUpdateSchema,
|
|
7
7
|
DRIVER_NAME_FORBIDDEN_CHAR_PATTERN,
|
|
8
8
|
DriverNameSchema,
|
|
9
|
+
ListDriversRequestSchema,
|
|
10
|
+
ListDriversResponseSchema,
|
|
9
11
|
NewLoginRequest,
|
|
10
12
|
NewLoginRequestSchema,
|
|
11
13
|
NewLoginResponse,
|
|
@@ -25,7 +27,7 @@ import {
|
|
|
25
27
|
UpdateScrapeStatusMessage,
|
|
26
28
|
ValidatePasswordRequestSchema,
|
|
27
29
|
ValidatePasswordResponseSchema
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-EQIUGAWW.js";
|
|
29
31
|
|
|
30
32
|
// src/schemas/drivers/anonymous-driver.ts
|
|
31
33
|
import z from "zod";
|
|
@@ -47,192 +49,330 @@ var DeleteAnonymousDriverResponseSchema = z.object({
|
|
|
47
49
|
user_id: z.string()
|
|
48
50
|
});
|
|
49
51
|
|
|
50
|
-
// src/schemas/providerAccounts/
|
|
52
|
+
// src/schemas/providerAccounts/validate-login.ts
|
|
51
53
|
import { z as z2 } from "zod";
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
+
var UrlSchema = z2.string().refine(
|
|
55
|
+
(val) => {
|
|
56
|
+
try {
|
|
57
|
+
new URL(val);
|
|
58
|
+
return true;
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{ message: "Invalid URL" }
|
|
64
|
+
);
|
|
65
|
+
var ValidateLoginRequestSchema = z2.object({
|
|
66
|
+
providerUrl: UrlSchema.describe("The URL of the ELD provider to validate credentials against"),
|
|
67
|
+
username: z2.string().min(1).describe("The username to validate"),
|
|
68
|
+
encryptedPassword: z2.string().min(1).describe("The encrypted password to validate")
|
|
69
|
+
}).describe("Request schema for validating login credentials via browser auth");
|
|
70
|
+
var ValidateLoginResponseSchema = z2.object({
|
|
71
|
+
success: z2.boolean().describe("Indicates if the login credentials are valid")
|
|
72
|
+
}).describe("Response schema for login validation");
|
|
73
|
+
|
|
74
|
+
// src/schemas/providerAccounts/delete-provider-account.ts
|
|
75
|
+
import { z as z3 } from "zod";
|
|
76
|
+
var DeleteProviderAccountRequestSchema = z3.object({
|
|
77
|
+
providerAccountId: z3.string().min(1).describe("The external provider account ID to delete")
|
|
54
78
|
}).describe("Request schema for deleting a provider account");
|
|
55
|
-
var DeleteProviderAccountResponseSchema =
|
|
56
|
-
success:
|
|
79
|
+
var DeleteProviderAccountResponseSchema = z3.object({
|
|
80
|
+
success: z3.boolean().describe("Indicates if the provider account was successfully deleted")
|
|
57
81
|
}).describe("Response schema for provider account deletion");
|
|
58
82
|
|
|
59
83
|
// src/schemas/telemetry/driver-rankings.ts
|
|
60
|
-
import { z as
|
|
61
|
-
var DriverRankingsRequestSchema =
|
|
62
|
-
start_date:
|
|
63
|
-
end_date:
|
|
64
|
-
state:
|
|
65
|
-
source:
|
|
84
|
+
import { z as z4 } from "zod";
|
|
85
|
+
var DriverRankingsRequestSchema = z4.object({
|
|
86
|
+
start_date: z4.string().describe("Start date for the ranking period (ISO 8601 format)"),
|
|
87
|
+
end_date: z4.string().describe("End date for the ranking period (ISO 8601 format)"),
|
|
88
|
+
state: z4.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location"),
|
|
89
|
+
source: z4.enum(["eld", "manual"]).default("manual").describe("Telemetry source to rank by: 'manual' uses GPS odometer, 'eld' uses calculated distance")
|
|
66
90
|
}).describe("Request schema for driver rankings by miles driven");
|
|
67
|
-
var DriverRankingSchema =
|
|
68
|
-
rank:
|
|
69
|
-
driver_id:
|
|
70
|
-
driver_name:
|
|
71
|
-
total_miles:
|
|
91
|
+
var DriverRankingSchema = z4.object({
|
|
92
|
+
rank: z4.number().int().positive().describe("Rank position based on miles driven"),
|
|
93
|
+
driver_id: z4.string().uuid().describe("Unique identifier of the driver"),
|
|
94
|
+
driver_name: z4.string().describe("Name of the driver"),
|
|
95
|
+
total_miles: z4.number().min(0).describe("Total miles driven in the specified period")
|
|
72
96
|
}).describe("Single driver ranking entry");
|
|
73
|
-
var DriverRankingsResponseSchema =
|
|
97
|
+
var DriverRankingsResponseSchema = z4.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
|
|
74
98
|
|
|
75
99
|
// src/schemas/telemetry/state-heatmap.ts
|
|
76
|
-
import { z as
|
|
77
|
-
var StateHeatmapRequestSchema =
|
|
78
|
-
driver_id:
|
|
79
|
-
start_date:
|
|
80
|
-
end_date:
|
|
100
|
+
import { z as z5 } from "zod";
|
|
101
|
+
var StateHeatmapRequestSchema = z5.object({
|
|
102
|
+
driver_id: z5.string().uuid().describe("Unique identifier of the driver"),
|
|
103
|
+
start_date: z5.string().describe("Start date for the heatmap period (ISO 8601 format)"),
|
|
104
|
+
end_date: z5.string().describe("End date for the heatmap period (ISO 8601 format)")
|
|
81
105
|
}).describe("Request schema for driver state heatmap");
|
|
82
|
-
var StateHeatmapEntrySchema =
|
|
83
|
-
count:
|
|
84
|
-
percentage:
|
|
106
|
+
var StateHeatmapEntrySchema = z5.object({
|
|
107
|
+
count: z5.number().int().min(0).describe("Number of telemetry points in this state"),
|
|
108
|
+
percentage: z5.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
|
|
85
109
|
}).describe("Single state entry in the heatmap");
|
|
86
|
-
var StateHeatmapResponseSchema =
|
|
87
|
-
|
|
110
|
+
var StateHeatmapResponseSchema = z5.record(
|
|
111
|
+
z5.string().length(2),
|
|
88
112
|
StateHeatmapEntrySchema
|
|
89
113
|
).describe("Record of 2-letter state codes to heatmap entries");
|
|
90
114
|
|
|
91
115
|
// src/schemas/telemetry/manual-batch.ts
|
|
92
|
-
import { z as
|
|
93
|
-
var ManualBatchEntrySchema =
|
|
94
|
-
driver_id:
|
|
95
|
-
timestamp:
|
|
96
|
-
location_latitude:
|
|
97
|
-
location_longitude:
|
|
98
|
-
location_address:
|
|
99
|
-
vehicle_odometer_miles:
|
|
100
|
-
heading:
|
|
101
|
-
speed_mph:
|
|
102
|
-
altitude_feet:
|
|
103
|
-
raw:
|
|
104
|
-
driving_status:
|
|
116
|
+
import { z as z6 } from "zod";
|
|
117
|
+
var ManualBatchEntrySchema = z6.object({
|
|
118
|
+
driver_id: z6.string().uuid().describe("Internal UUID of the driver"),
|
|
119
|
+
timestamp: z6.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
|
|
120
|
+
location_latitude: z6.number().min(-90).max(90).describe("GPS latitude coordinate"),
|
|
121
|
+
location_longitude: z6.number().min(-180).max(180).describe("GPS longitude coordinate"),
|
|
122
|
+
location_address: z6.string().optional().describe("Optional human-readable address"),
|
|
123
|
+
vehicle_odometer_miles: z6.number().min(0).optional().describe("Optional vehicle odometer reading in miles"),
|
|
124
|
+
heading: z6.number().min(0).max(360).optional().describe("Optional GPS heading in degrees (0-360)"),
|
|
125
|
+
speed_mph: z6.number().min(0).optional().describe("Optional GPS speed in miles per hour"),
|
|
126
|
+
altitude_feet: z6.number().optional().describe("Optional GPS altitude in feet"),
|
|
127
|
+
raw: z6.record(z6.string(), z6.unknown()).optional().describe("Optional raw upstream JSON payload to archive alongside this entry"),
|
|
128
|
+
driving_status: z6.enum(["parked", "driving"]).optional().describe("Optional parked/driving status reported by the upstream system"),
|
|
129
|
+
activity_type: z6.string().optional().describe("Optional activity recognition type (e.g. 'in_vehicle', 'on_foot')"),
|
|
130
|
+
activity_confidence: z6.number().int().min(0).max(100).optional().describe("Optional activity recognition confidence (0-100)")
|
|
105
131
|
}).describe("Single manual telemetry entry");
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
driving_status: z5.enum(["parked", "driving"]).nullable()
|
|
132
|
+
var ManualBatchTelemetrySchema = z6.object({
|
|
133
|
+
id: z6.number().int().describe("Telemetry record ID"),
|
|
134
|
+
driver_id: z6.string().uuid().describe("Internal UUID of the driver"),
|
|
135
|
+
timestamp: z6.union([z6.string(), z6.date()]).describe("Timestamp of the telemetry reading"),
|
|
136
|
+
remaining_drive_time_in_seconds: z6.number().min(0),
|
|
137
|
+
remaining_shift_time_in_seconds: z6.number().min(0),
|
|
138
|
+
remaining_cycle_time_in_seconds: z6.number().min(0),
|
|
139
|
+
remaining_break_time_in_seconds: z6.number().min(0),
|
|
140
|
+
location_latitude: z6.number().min(-90).max(90),
|
|
141
|
+
location_longitude: z6.number().min(-180).max(180),
|
|
142
|
+
previous_location_latitude: z6.number().min(-90).max(90).nullable(),
|
|
143
|
+
previous_location_longitude: z6.number().min(-180).max(180).nullable(),
|
|
144
|
+
location_address: z6.string().nullable(),
|
|
145
|
+
location_state: z6.string().length(2).nullable(),
|
|
146
|
+
echoed_odometer_miles: z6.number().min(0).nullable().describe("Vehicle odometer reading echoed back from the request (miles)"),
|
|
147
|
+
osrm_calculated_miles: z6.number().min(0).nullable().describe("Road distance calculated by OSRM between this point and the previous point (miles)"),
|
|
148
|
+
heading: z6.number().nullish(),
|
|
149
|
+
speed_mph: z6.number().nullish(),
|
|
150
|
+
altitude_feet: z6.number().nullish(),
|
|
151
|
+
source: z6.enum(["eld", "manual"]),
|
|
152
|
+
driving_status: z6.enum(["parked", "driving"]).nullable(),
|
|
153
|
+
activity_type: z6.string().nullable(),
|
|
154
|
+
activity_confidence: z6.number().int().nullable()
|
|
130
155
|
}).describe("Telemetry record returned from manual batch insertion");
|
|
131
|
-
var ManualBatchResponseSchema =
|
|
132
|
-
message:
|
|
133
|
-
inserted_count:
|
|
134
|
-
telemetry:
|
|
156
|
+
var ManualBatchResponseSchema = z6.object({
|
|
157
|
+
message: z6.string().describe("Success message"),
|
|
158
|
+
inserted_count: z6.number().int().min(0).describe("Number of telemetry entries inserted"),
|
|
159
|
+
telemetry: z6.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
|
|
135
160
|
}).describe("Response schema for manual batch telemetry insertion");
|
|
136
161
|
|
|
162
|
+
// src/schemas/telemetry/bggeo-batch.ts
|
|
163
|
+
import { z as z7 } from "zod";
|
|
164
|
+
var BGGeoCoordsSchema = z7.object({
|
|
165
|
+
latitude: z7.number().min(-90).max(90),
|
|
166
|
+
longitude: z7.number().min(-180).max(180),
|
|
167
|
+
accuracy: z7.number().optional(),
|
|
168
|
+
speed: z7.number().describe("Speed in m/s; -1 when unavailable"),
|
|
169
|
+
heading: z7.number().describe("Heading in degrees; -1 when unavailable"),
|
|
170
|
+
altitude: z7.number().describe("Altitude in meters"),
|
|
171
|
+
altitude_accuracy: z7.number().optional(),
|
|
172
|
+
speed_accuracy: z7.number().optional(),
|
|
173
|
+
heading_accuracy: z7.number().optional(),
|
|
174
|
+
ellipsoidal_altitude: z7.number().optional(),
|
|
175
|
+
floor: z7.number().nullable().optional()
|
|
176
|
+
}).describe("BGGeo coords object");
|
|
177
|
+
var BGGeoActivitySchema = z7.object({
|
|
178
|
+
type: z7.string(),
|
|
179
|
+
confidence: z7.number()
|
|
180
|
+
}).describe("BGGeo activity recognition");
|
|
181
|
+
var BGGeoBatterySchema = z7.object({
|
|
182
|
+
is_charging: z7.boolean(),
|
|
183
|
+
level: z7.number()
|
|
184
|
+
}).describe("BGGeo battery status");
|
|
185
|
+
var BGGeoLocationSchema = z7.object({
|
|
186
|
+
coords: BGGeoCoordsSchema,
|
|
187
|
+
extras: z7.object({}).passthrough().optional(),
|
|
188
|
+
activity: BGGeoActivitySchema.optional(),
|
|
189
|
+
battery: BGGeoBatterySchema.optional(),
|
|
190
|
+
timestamp: z7.string().datetime().describe("ISO 8601 timestamp"),
|
|
191
|
+
is_moving: z7.boolean(),
|
|
192
|
+
odometer: z7.number().min(0).describe("Odometer in meters"),
|
|
193
|
+
uuid: z7.string().optional(),
|
|
194
|
+
event: z7.string().optional(),
|
|
195
|
+
age: z7.number().optional(),
|
|
196
|
+
geofence: z7.record(z7.string(), z7.unknown()).optional(),
|
|
197
|
+
mock: z7.boolean().optional(),
|
|
198
|
+
recorded_at: z7.string().datetime().optional().describe("ISO 8601 device recording timestamp")
|
|
199
|
+
}).passthrough().describe("Single BGGeo location object");
|
|
200
|
+
var locationArray = z7.array(BGGeoLocationSchema).min(1).max(1e3).describe("Array of BGGeo location objects (1-1000)");
|
|
201
|
+
var locationOrArray = z7.union([
|
|
202
|
+
BGGeoLocationSchema.transform((loc) => [loc]),
|
|
203
|
+
locationArray
|
|
204
|
+
]);
|
|
205
|
+
var BGGeoBatchRequestSchema = z7.object({
|
|
206
|
+
location: locationOrArray.optional(),
|
|
207
|
+
locations: locationOrArray.optional()
|
|
208
|
+
}).refine((data) => data.location ?? data.locations, {
|
|
209
|
+
message: "Either 'location' or 'locations' must be provided"
|
|
210
|
+
}).describe("Request schema for BGGeo batch telemetry ingestion");
|
|
211
|
+
|
|
137
212
|
// src/schemas/trips/driver-trips.ts
|
|
138
|
-
import { z as
|
|
139
|
-
var DriverTripsRequestSchema =
|
|
140
|
-
driver_id:
|
|
141
|
-
start_date:
|
|
213
|
+
import { z as z8 } from "zod";
|
|
214
|
+
var DriverTripsRequestSchema = z8.object({
|
|
215
|
+
driver_id: z8.string().uuid(),
|
|
216
|
+
start_date: z8.string(),
|
|
142
217
|
// YYYY-MM-DD
|
|
143
|
-
end_date:
|
|
218
|
+
end_date: z8.string()
|
|
144
219
|
// YYYY-MM-DD
|
|
145
220
|
});
|
|
146
|
-
var DriverTripSchema =
|
|
147
|
-
id:
|
|
148
|
-
start_time:
|
|
149
|
-
end_time:
|
|
150
|
-
point_count:
|
|
151
|
-
polyline:
|
|
152
|
-
highways:
|
|
153
|
-
total_miles:
|
|
154
|
-
avg_speed_mph:
|
|
155
|
-
miles_by_weather:
|
|
156
|
-
miles_by_light:
|
|
221
|
+
var DriverTripSchema = z8.object({
|
|
222
|
+
id: z8.number(),
|
|
223
|
+
start_time: z8.string(),
|
|
224
|
+
end_time: z8.string(),
|
|
225
|
+
point_count: z8.number(),
|
|
226
|
+
polyline: z8.string().nullable(),
|
|
227
|
+
highways: z8.array(z8.string()).nullable(),
|
|
228
|
+
total_miles: z8.number().nullable(),
|
|
229
|
+
avg_speed_mph: z8.number().nullable(),
|
|
230
|
+
miles_by_weather: z8.record(z8.string(), z8.number()).nullable(),
|
|
231
|
+
miles_by_light: z8.record(z8.string(), z8.number()).nullable()
|
|
157
232
|
});
|
|
158
|
-
var DriverTripsResponseSchema =
|
|
159
|
-
var DriverDailySummarySchema =
|
|
160
|
-
summary_date:
|
|
161
|
-
total_miles:
|
|
162
|
-
trip_count:
|
|
163
|
-
point_count:
|
|
164
|
-
polyline:
|
|
165
|
-
highways:
|
|
166
|
-
avg_speed_mph:
|
|
167
|
-
miles_by_weather:
|
|
168
|
-
miles_by_light:
|
|
233
|
+
var DriverTripsResponseSchema = z8.array(DriverTripSchema);
|
|
234
|
+
var DriverDailySummarySchema = z8.object({
|
|
235
|
+
summary_date: z8.string(),
|
|
236
|
+
total_miles: z8.number(),
|
|
237
|
+
trip_count: z8.number(),
|
|
238
|
+
point_count: z8.number(),
|
|
239
|
+
polyline: z8.string().nullable(),
|
|
240
|
+
highways: z8.array(z8.string()).nullable(),
|
|
241
|
+
avg_speed_mph: z8.number().nullable(),
|
|
242
|
+
miles_by_weather: z8.record(z8.string(), z8.number()).nullable(),
|
|
243
|
+
miles_by_light: z8.record(z8.string(), z8.number()).nullable()
|
|
169
244
|
});
|
|
170
|
-
var DriverDailySummariesResponseSchema =
|
|
245
|
+
var DriverDailySummariesResponseSchema = z8.array(DriverDailySummarySchema);
|
|
171
246
|
|
|
172
247
|
// src/schemas/trips/enriched-trip-summary.ts
|
|
173
|
-
import { z as
|
|
174
|
-
var EnrichedTripSummaryRequestSchema =
|
|
175
|
-
trip_id:
|
|
248
|
+
import { z as z9 } from "zod";
|
|
249
|
+
var EnrichedTripSummaryRequestSchema = z9.object({
|
|
250
|
+
trip_id: z9.number()
|
|
176
251
|
});
|
|
177
|
-
var DriverEnrichedSummariesRequestSchema =
|
|
178
|
-
driver_id:
|
|
179
|
-
start_date:
|
|
180
|
-
end_date:
|
|
252
|
+
var DriverEnrichedSummariesRequestSchema = z9.object({
|
|
253
|
+
driver_id: z9.string().uuid(),
|
|
254
|
+
start_date: z9.string(),
|
|
255
|
+
end_date: z9.string()
|
|
181
256
|
});
|
|
182
|
-
var EnrichedStopSchema =
|
|
183
|
-
duration_seconds:
|
|
257
|
+
var EnrichedStopSchema = z9.object({
|
|
258
|
+
duration_seconds: z9.number()
|
|
184
259
|
});
|
|
185
|
-
var EnrichedPointSchema =
|
|
186
|
-
lat:
|
|
187
|
-
lon:
|
|
188
|
-
timestamp:
|
|
189
|
-
speed_mph:
|
|
190
|
-
heading:
|
|
191
|
-
altitude_feet:
|
|
192
|
-
weather_condition:
|
|
193
|
-
temperature_f:
|
|
194
|
-
visibility_miles:
|
|
195
|
-
light_condition:
|
|
260
|
+
var EnrichedPointSchema = z9.object({
|
|
261
|
+
lat: z9.number(),
|
|
262
|
+
lon: z9.number(),
|
|
263
|
+
timestamp: z9.string(),
|
|
264
|
+
speed_mph: z9.number().nullable(),
|
|
265
|
+
heading: z9.number().nullable(),
|
|
266
|
+
altitude_feet: z9.number().nullable(),
|
|
267
|
+
weather_condition: z9.string().nullable(),
|
|
268
|
+
temperature_f: z9.number().nullable(),
|
|
269
|
+
visibility_miles: z9.number().nullable(),
|
|
270
|
+
light_condition: z9.string().nullable(),
|
|
196
271
|
stop: EnrichedStopSchema.nullable()
|
|
197
272
|
});
|
|
198
|
-
var EnrichedTripSummarySchema =
|
|
199
|
-
trip_id:
|
|
200
|
-
driver_id:
|
|
201
|
-
start_time:
|
|
202
|
-
end_time:
|
|
203
|
-
points:
|
|
273
|
+
var EnrichedTripSummarySchema = z9.object({
|
|
274
|
+
trip_id: z9.number(),
|
|
275
|
+
driver_id: z9.string(),
|
|
276
|
+
start_time: z9.string(),
|
|
277
|
+
end_time: z9.string(),
|
|
278
|
+
points: z9.array(EnrichedPointSchema)
|
|
204
279
|
});
|
|
205
280
|
var EnrichedTripSummaryResponseSchema = EnrichedTripSummarySchema;
|
|
206
|
-
var DriverEnrichedSummariesResponseSchema =
|
|
281
|
+
var DriverEnrichedSummariesResponseSchema = z9.array(EnrichedTripSummarySchema);
|
|
282
|
+
|
|
283
|
+
// src/schemas/trips/convex-driver-trip.ts
|
|
284
|
+
import { z as z10 } from "zod";
|
|
285
|
+
var ConvexBreadcrumbEventSchema = z10.object({
|
|
286
|
+
ts: z10.number(),
|
|
287
|
+
// epoch ms
|
|
288
|
+
status: z10.string(),
|
|
289
|
+
lat: z10.number(),
|
|
290
|
+
lon: z10.number(),
|
|
291
|
+
heading: z10.number().optional(),
|
|
292
|
+
locationText: z10.string().optional(),
|
|
293
|
+
speedKph: z10.number().optional(),
|
|
294
|
+
altitudeFeet: z10.number().optional()
|
|
295
|
+
});
|
|
296
|
+
var ConvexDriverTripRequestSchema = z10.object({
|
|
297
|
+
userId: z10.string(),
|
|
298
|
+
breadcrumbs: z10.array(ConvexBreadcrumbEventSchema).min(1)
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
// src/schemas/trips/post-driver-trip-telemetry.ts
|
|
302
|
+
import { z as z11 } from "zod";
|
|
303
|
+
var PostDriverTripTelemetryRecordSchema = z11.object({
|
|
304
|
+
location_latitude: z11.number(),
|
|
305
|
+
location_longitude: z11.number(),
|
|
306
|
+
location_address: z11.string().optional(),
|
|
307
|
+
heading: z11.number(),
|
|
308
|
+
drivingState: z11.string(),
|
|
309
|
+
speedKph: z11.number(),
|
|
310
|
+
altitudeFeet: z11.number(),
|
|
311
|
+
gps_timestamp: z11.string().optional(),
|
|
312
|
+
odometer: z11.number().optional(),
|
|
313
|
+
activity_type: z11.string().optional(),
|
|
314
|
+
activity_confidence: z11.number().int().optional()
|
|
315
|
+
});
|
|
316
|
+
var PostDriverTripTelemetryRequestSchema = z11.object({
|
|
317
|
+
honkUserId: z11.string(),
|
|
318
|
+
telemetry: z11.array(PostDriverTripTelemetryRecordSchema).min(1)
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// src/schemas/trips/post-daily-summary.ts
|
|
322
|
+
import { z as z12 } from "zod";
|
|
323
|
+
var PostDailySummaryRecordSchema = z12.object({
|
|
324
|
+
externalDriverId: z12.string(),
|
|
325
|
+
// drivers.id from Postgres
|
|
326
|
+
date: z12.string(),
|
|
327
|
+
// "YYYY-MM-DD"
|
|
328
|
+
totalMiles: z12.number(),
|
|
329
|
+
tripCount: z12.number(),
|
|
330
|
+
pointCount: z12.number(),
|
|
331
|
+
polyline: z12.string().optional(),
|
|
332
|
+
highways: z12.array(z12.string()).optional(),
|
|
333
|
+
avgSpeedMph: z12.number().optional(),
|
|
334
|
+
milesByWeather: z12.record(z12.string(), z12.number()).optional(),
|
|
335
|
+
milesByLight: z12.record(z12.string(), z12.number()).optional(),
|
|
336
|
+
states: z12.array(z12.string()).optional(),
|
|
337
|
+
origin: z12.string().optional(),
|
|
338
|
+
destination: z12.string().optional(),
|
|
339
|
+
altitudeGainedFeet: z12.number().optional(),
|
|
340
|
+
altitudeLostFeet: z12.number().optional(),
|
|
341
|
+
userId: z12.string().optional()
|
|
342
|
+
// Convex user ID (honk_user_id) for fallback driver resolution
|
|
343
|
+
});
|
|
344
|
+
var PostDailySummaryRequestSchema = z12.object({
|
|
345
|
+
summaries: z12.array(PostDailySummaryRecordSchema).min(1)
|
|
346
|
+
});
|
|
207
347
|
|
|
208
348
|
// src/auth-data.ts
|
|
209
|
-
import { z as
|
|
210
|
-
var GomotiveAuthDataSchema =
|
|
211
|
-
kind:
|
|
212
|
-
token:
|
|
213
|
-
ownerOperator:
|
|
349
|
+
import { z as z13 } from "zod";
|
|
350
|
+
var GomotiveAuthDataSchema = z13.object({
|
|
351
|
+
kind: z13.literal("gomotive"),
|
|
352
|
+
token: z13.string(),
|
|
353
|
+
ownerOperator: z13.boolean()
|
|
214
354
|
});
|
|
215
|
-
var VistaAuthDataSchema =
|
|
216
|
-
kind:
|
|
217
|
-
driverId:
|
|
218
|
-
cookie:
|
|
355
|
+
var VistaAuthDataSchema = z13.object({
|
|
356
|
+
kind: z13.literal("vista"),
|
|
357
|
+
driverId: z13.string(),
|
|
358
|
+
cookie: z13.string()
|
|
219
359
|
});
|
|
220
|
-
var MockAuthDataSchema =
|
|
221
|
-
kind:
|
|
222
|
-
cookie:
|
|
360
|
+
var MockAuthDataSchema = z13.object({
|
|
361
|
+
kind: z13.literal("mock"),
|
|
362
|
+
cookie: z13.string()
|
|
223
363
|
});
|
|
224
|
-
var NoneAuthDataSchema =
|
|
225
|
-
kind:
|
|
364
|
+
var NoneAuthDataSchema = z13.object({
|
|
365
|
+
kind: z13.literal("none")
|
|
226
366
|
});
|
|
227
|
-
var ProviderAuthDataSchema =
|
|
367
|
+
var ProviderAuthDataSchema = z13.discriminatedUnion("kind", [
|
|
228
368
|
GomotiveAuthDataSchema,
|
|
229
369
|
VistaAuthDataSchema,
|
|
230
370
|
MockAuthDataSchema,
|
|
231
371
|
NoneAuthDataSchema
|
|
232
372
|
]);
|
|
233
|
-
var LegacyVistaAuthSchema =
|
|
234
|
-
driverId:
|
|
235
|
-
cookie:
|
|
373
|
+
var LegacyVistaAuthSchema = z13.object({
|
|
374
|
+
driverId: z13.string(),
|
|
375
|
+
cookie: z13.string()
|
|
236
376
|
});
|
|
237
377
|
function serializeAuthData(data) {
|
|
238
378
|
if (data.kind === "none") {
|
|
@@ -268,52 +408,57 @@ function deserializeAuthData(authToken) {
|
|
|
268
408
|
}
|
|
269
409
|
|
|
270
410
|
// src/browser-auth.ts
|
|
271
|
-
import { z as
|
|
272
|
-
var CapturedTrafficEntrySchema =
|
|
273
|
-
method:
|
|
274
|
-
url:
|
|
275
|
-
status:
|
|
276
|
-
responseBody:
|
|
411
|
+
import { z as z14 } from "zod";
|
|
412
|
+
var CapturedTrafficEntrySchema = z14.object({
|
|
413
|
+
method: z14.string(),
|
|
414
|
+
url: z14.string(),
|
|
415
|
+
status: z14.number(),
|
|
416
|
+
responseBody: z14.string().optional()
|
|
277
417
|
});
|
|
278
|
-
var BrowserAuthRequestSchema =
|
|
279
|
-
providerStub:
|
|
280
|
-
providerUrl:
|
|
281
|
-
username:
|
|
282
|
-
encryptedPassword:
|
|
283
|
-
captureTraffic:
|
|
418
|
+
var BrowserAuthRequestSchema = z14.object({
|
|
419
|
+
providerStub: z14.string(),
|
|
420
|
+
providerUrl: z14.string(),
|
|
421
|
+
username: z14.string(),
|
|
422
|
+
encryptedPassword: z14.string(),
|
|
423
|
+
captureTraffic: z14.boolean().optional()
|
|
284
424
|
});
|
|
285
|
-
var BrowserAuthSuccessSchema =
|
|
286
|
-
success:
|
|
425
|
+
var BrowserAuthSuccessSchema = z14.object({
|
|
426
|
+
success: z14.literal(true),
|
|
287
427
|
authData: ProviderAuthDataSchema,
|
|
288
|
-
capturedTraffic:
|
|
428
|
+
capturedTraffic: z14.array(CapturedTrafficEntrySchema).optional()
|
|
289
429
|
});
|
|
290
|
-
var BrowserAuthFailureSchema =
|
|
291
|
-
success:
|
|
292
|
-
error:
|
|
430
|
+
var BrowserAuthFailureSchema = z14.object({
|
|
431
|
+
success: z14.literal(false),
|
|
432
|
+
error: z14.string()
|
|
293
433
|
});
|
|
294
|
-
var BrowserAuthResponseSchema =
|
|
434
|
+
var BrowserAuthResponseSchema = z14.discriminatedUnion("success", [
|
|
295
435
|
BrowserAuthSuccessSchema,
|
|
296
436
|
BrowserAuthFailureSchema
|
|
297
437
|
]);
|
|
298
|
-
var CrawlPageSchema =
|
|
299
|
-
url:
|
|
300
|
-
html:
|
|
438
|
+
var CrawlPageSchema = z14.object({
|
|
439
|
+
url: z14.string(),
|
|
440
|
+
html: z14.string()
|
|
301
441
|
});
|
|
302
|
-
var BrowserCrawlSuccessSchema =
|
|
303
|
-
success:
|
|
304
|
-
pages:
|
|
442
|
+
var BrowserCrawlSuccessSchema = z14.object({
|
|
443
|
+
success: z14.literal(true),
|
|
444
|
+
pages: z14.array(CrawlPageSchema)
|
|
305
445
|
});
|
|
306
|
-
var BrowserCrawlFailureSchema =
|
|
307
|
-
success:
|
|
308
|
-
error:
|
|
446
|
+
var BrowserCrawlFailureSchema = z14.object({
|
|
447
|
+
success: z14.literal(false),
|
|
448
|
+
error: z14.string()
|
|
309
449
|
});
|
|
310
|
-
var BrowserCrawlResponseSchema =
|
|
450
|
+
var BrowserCrawlResponseSchema = z14.discriminatedUnion("success", [
|
|
311
451
|
BrowserCrawlSuccessSchema,
|
|
312
452
|
BrowserCrawlFailureSchema
|
|
313
453
|
]);
|
|
314
454
|
export {
|
|
315
455
|
AnonymousDriverErrorResponseSchema,
|
|
316
456
|
AnonymousDriverResponseSchema,
|
|
457
|
+
BGGeoActivitySchema,
|
|
458
|
+
BGGeoBatchRequestSchema,
|
|
459
|
+
BGGeoBatterySchema,
|
|
460
|
+
BGGeoCoordsSchema,
|
|
461
|
+
BGGeoLocationSchema,
|
|
317
462
|
BatchConvexUpdate,
|
|
318
463
|
BatchConvexUpdateSchema,
|
|
319
464
|
BrowserAuthFailureSchema,
|
|
@@ -324,7 +469,9 @@ export {
|
|
|
324
469
|
BrowserCrawlResponseSchema,
|
|
325
470
|
BrowserCrawlSuccessSchema,
|
|
326
471
|
CapturedTrafficEntrySchema,
|
|
472
|
+
ConvexBreadcrumbEventSchema,
|
|
327
473
|
ConvexDriverSchema,
|
|
474
|
+
ConvexDriverTripRequestSchema,
|
|
328
475
|
ConvexUpdate,
|
|
329
476
|
ConvexUpdateSchema,
|
|
330
477
|
CrawlPageSchema,
|
|
@@ -351,8 +498,9 @@ export {
|
|
|
351
498
|
EnrichedTripSummaryResponseSchema,
|
|
352
499
|
EnrichedTripSummarySchema,
|
|
353
500
|
GomotiveAuthDataSchema,
|
|
501
|
+
ListDriversRequestSchema,
|
|
502
|
+
ListDriversResponseSchema,
|
|
354
503
|
ManualBatchEntrySchema,
|
|
355
|
-
ManualBatchRequestSchema,
|
|
356
504
|
ManualBatchResponseSchema,
|
|
357
505
|
ManualBatchTelemetrySchema,
|
|
358
506
|
MockAuthDataSchema,
|
|
@@ -370,6 +518,10 @@ export {
|
|
|
370
518
|
PatchDriverDriverResponseSchema,
|
|
371
519
|
PatchDriverRequestSchema,
|
|
372
520
|
PatchDriverResponseSchema,
|
|
521
|
+
PostDailySummaryRecordSchema,
|
|
522
|
+
PostDailySummaryRequestSchema,
|
|
523
|
+
PostDriverTripTelemetryRecordSchema,
|
|
524
|
+
PostDriverTripTelemetryRequestSchema,
|
|
373
525
|
ProviderAuthDataSchema,
|
|
374
526
|
ScrapeStatus,
|
|
375
527
|
SharedDriverResponseSchema,
|
|
@@ -378,6 +530,8 @@ export {
|
|
|
378
530
|
StateHeatmapResponseSchema,
|
|
379
531
|
TruckTypeSchema,
|
|
380
532
|
UpdateScrapeStatusMessage,
|
|
533
|
+
ValidateLoginRequestSchema,
|
|
534
|
+
ValidateLoginResponseSchema,
|
|
381
535
|
ValidatePasswordRequestSchema,
|
|
382
536
|
ValidatePasswordResponseSchema,
|
|
383
537
|
VistaAuthDataSchema,
|