@findatruck/shared-schemas 2.20.0 → 2.23.0

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.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-P4S46OZI.js";
30
+ } from "./chunk-EQIUGAWW.js";
29
31
 
30
32
  // src/schemas/drivers/anonymous-driver.ts
31
33
  import z from "zod";
@@ -101,7 +103,9 @@ var ManualBatchEntrySchema = z5.object({
101
103
  speed_mph: z5.number().min(0).optional().describe("Optional GPS speed in miles per hour"),
102
104
  altitude_feet: z5.number().optional().describe("Optional GPS altitude in feet"),
103
105
  raw: z5.record(z5.string(), z5.unknown()).optional().describe("Optional raw upstream JSON payload to archive alongside this entry"),
104
- driving_status: z5.enum(["parked", "driving"]).optional().describe("Optional parked/driving status reported by the upstream system")
106
+ driving_status: z5.enum(["parked", "driving"]).optional().describe("Optional parked/driving status reported by the upstream system"),
107
+ activity_type: z5.string().optional().describe("Optional activity recognition type (e.g. 'in_vehicle', 'on_foot')"),
108
+ activity_confidence: z5.number().int().min(0).max(100).optional().describe("Optional activity recognition confidence (0-100)")
105
109
  }).describe("Single manual telemetry entry");
106
110
  var ManualBatchRequestSchema = z5.object({
107
111
  entries: z5.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
@@ -126,7 +130,9 @@ var ManualBatchTelemetrySchema = z5.object({
126
130
  speed_mph: z5.number().nullish(),
127
131
  altitude_feet: z5.number().nullish(),
128
132
  source: z5.enum(["eld", "manual"]),
129
- driving_status: z5.enum(["parked", "driving"]).nullable()
133
+ driving_status: z5.enum(["parked", "driving"]).nullable(),
134
+ activity_type: z5.string().nullable(),
135
+ activity_confidence: z5.number().int().nullable()
130
136
  }).describe("Telemetry record returned from manual batch insertion");
131
137
  var ManualBatchResponseSchema = z5.object({
132
138
  message: z5.string().describe("Success message"),
@@ -134,105 +140,193 @@ var ManualBatchResponseSchema = z5.object({
134
140
  telemetry: z5.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
135
141
  }).describe("Response schema for manual batch telemetry insertion");
136
142
 
137
- // src/schemas/trips/driver-trips.ts
143
+ // src/schemas/telemetry/bggeo-batch.ts
138
144
  import { z as z6 } from "zod";
139
- var DriverTripsRequestSchema = z6.object({
140
- driver_id: z6.string().uuid(),
141
- start_date: z6.string(),
145
+ var BGGeoCoordsSchema = z6.object({
146
+ latitude: z6.number().min(-90).max(90),
147
+ longitude: z6.number().min(-180).max(180),
148
+ accuracy: z6.number().optional(),
149
+ speed: z6.number().describe("Speed in m/s; -1 when unavailable"),
150
+ heading: z6.number().describe("Heading in degrees; -1 when unavailable"),
151
+ altitude: z6.number().describe("Altitude in meters"),
152
+ altitude_accuracy: z6.number().optional(),
153
+ speed_accuracy: z6.number().optional(),
154
+ heading_accuracy: z6.number().optional(),
155
+ ellipsoidal_altitude: z6.number().optional(),
156
+ floor: z6.number().nullable().optional()
157
+ }).describe("BGGeo coords object");
158
+ var BGGeoActivitySchema = z6.object({
159
+ type: z6.string(),
160
+ confidence: z6.number()
161
+ }).describe("BGGeo activity recognition");
162
+ var BGGeoBatterySchema = z6.object({
163
+ is_charging: z6.boolean(),
164
+ level: z6.number()
165
+ }).describe("BGGeo battery status");
166
+ var BGGeoLocationSchema = z6.object({
167
+ coords: BGGeoCoordsSchema,
168
+ extras: z6.object({}).passthrough().optional(),
169
+ activity: BGGeoActivitySchema.optional(),
170
+ battery: BGGeoBatterySchema.optional(),
171
+ timestamp: z6.string().datetime().describe("ISO 8601 timestamp"),
172
+ is_moving: z6.boolean(),
173
+ odometer: z6.number().min(0).describe("Odometer in meters"),
174
+ uuid: z6.string().optional(),
175
+ event: z6.string().optional(),
176
+ age: z6.number().optional(),
177
+ geofence: z6.record(z6.string(), z6.unknown()).optional(),
178
+ mock: z6.boolean().optional(),
179
+ recorded_at: z6.string().datetime().optional().describe("ISO 8601 device recording timestamp")
180
+ }).passthrough().describe("Single BGGeo location object");
181
+ var locationArray = z6.array(BGGeoLocationSchema).min(1).max(1e3).describe("Array of BGGeo location objects (1-1000)");
182
+ var locationOrArray = z6.union([
183
+ BGGeoLocationSchema.transform((loc) => [loc]),
184
+ locationArray
185
+ ]);
186
+ var BGGeoBatchRequestSchema = z6.object({
187
+ location: locationOrArray.optional(),
188
+ locations: locationOrArray.optional()
189
+ }).refine((data) => data.location ?? data.locations, {
190
+ message: "Either 'location' or 'locations' must be provided"
191
+ }).describe("Request schema for BGGeo batch telemetry ingestion");
192
+
193
+ // src/schemas/trips/driver-trips.ts
194
+ import { z as z7 } from "zod";
195
+ var DriverTripsRequestSchema = z7.object({
196
+ driver_id: z7.string().uuid(),
197
+ start_date: z7.string(),
142
198
  // YYYY-MM-DD
143
- end_date: z6.string()
199
+ end_date: z7.string()
144
200
  // YYYY-MM-DD
145
201
  });
146
- var DriverTripSchema = z6.object({
147
- id: z6.number(),
148
- start_time: z6.string(),
149
- end_time: z6.string(),
150
- point_count: z6.number(),
151
- polyline: z6.string().nullable(),
152
- highways: z6.array(z6.string()).nullable(),
153
- total_miles: z6.number().nullable(),
154
- avg_speed_mph: z6.number().nullable(),
155
- miles_by_weather: z6.record(z6.string(), z6.number()).nullable(),
156
- miles_by_light: z6.record(z6.string(), z6.number()).nullable()
202
+ var DriverTripSchema = z7.object({
203
+ id: z7.number(),
204
+ start_time: z7.string(),
205
+ end_time: z7.string(),
206
+ point_count: z7.number(),
207
+ polyline: z7.string().nullable(),
208
+ highways: z7.array(z7.string()).nullable(),
209
+ total_miles: z7.number().nullable(),
210
+ avg_speed_mph: z7.number().nullable(),
211
+ miles_by_weather: z7.record(z7.string(), z7.number()).nullable(),
212
+ miles_by_light: z7.record(z7.string(), z7.number()).nullable()
157
213
  });
158
- var DriverTripsResponseSchema = z6.array(DriverTripSchema);
159
- var DriverDailySummarySchema = z6.object({
160
- summary_date: z6.string(),
161
- total_miles: z6.number(),
162
- trip_count: z6.number(),
163
- point_count: z6.number(),
164
- polyline: z6.string().nullable(),
165
- highways: z6.array(z6.string()).nullable(),
166
- avg_speed_mph: z6.number().nullable(),
167
- miles_by_weather: z6.record(z6.string(), z6.number()).nullable(),
168
- miles_by_light: z6.record(z6.string(), z6.number()).nullable()
214
+ var DriverTripsResponseSchema = z7.array(DriverTripSchema);
215
+ var DriverDailySummarySchema = z7.object({
216
+ summary_date: z7.string(),
217
+ total_miles: z7.number(),
218
+ trip_count: z7.number(),
219
+ point_count: z7.number(),
220
+ polyline: z7.string().nullable(),
221
+ highways: z7.array(z7.string()).nullable(),
222
+ avg_speed_mph: z7.number().nullable(),
223
+ miles_by_weather: z7.record(z7.string(), z7.number()).nullable(),
224
+ miles_by_light: z7.record(z7.string(), z7.number()).nullable()
169
225
  });
170
- var DriverDailySummariesResponseSchema = z6.array(DriverDailySummarySchema);
226
+ var DriverDailySummariesResponseSchema = z7.array(DriverDailySummarySchema);
171
227
 
172
228
  // src/schemas/trips/enriched-trip-summary.ts
173
- import { z as z7 } from "zod";
174
- var EnrichedTripSummaryRequestSchema = z7.object({
175
- trip_id: z7.number()
229
+ import { z as z8 } from "zod";
230
+ var EnrichedTripSummaryRequestSchema = z8.object({
231
+ trip_id: z8.number()
176
232
  });
177
- var DriverEnrichedSummariesRequestSchema = z7.object({
178
- driver_id: z7.string().uuid(),
179
- start_date: z7.string(),
180
- end_date: z7.string()
233
+ var DriverEnrichedSummariesRequestSchema = z8.object({
234
+ driver_id: z8.string().uuid(),
235
+ start_date: z8.string(),
236
+ end_date: z8.string()
181
237
  });
182
- var EnrichedStopSchema = z7.object({
183
- duration_seconds: z7.number()
238
+ var EnrichedStopSchema = z8.object({
239
+ duration_seconds: z8.number()
184
240
  });
185
- var EnrichedPointSchema = z7.object({
186
- lat: z7.number(),
187
- lon: z7.number(),
188
- timestamp: z7.string(),
189
- speed_mph: z7.number().nullable(),
190
- heading: z7.number().nullable(),
191
- altitude_feet: z7.number().nullable(),
192
- weather_condition: z7.string().nullable(),
193
- temperature_f: z7.number().nullable(),
194
- visibility_miles: z7.number().nullable(),
195
- light_condition: z7.string().nullable(),
241
+ var EnrichedPointSchema = z8.object({
242
+ lat: z8.number(),
243
+ lon: z8.number(),
244
+ timestamp: z8.string(),
245
+ speed_mph: z8.number().nullable(),
246
+ heading: z8.number().nullable(),
247
+ altitude_feet: z8.number().nullable(),
248
+ weather_condition: z8.string().nullable(),
249
+ temperature_f: z8.number().nullable(),
250
+ visibility_miles: z8.number().nullable(),
251
+ light_condition: z8.string().nullable(),
196
252
  stop: EnrichedStopSchema.nullable()
197
253
  });
198
- var EnrichedTripSummarySchema = z7.object({
199
- trip_id: z7.number(),
200
- driver_id: z7.string(),
201
- start_time: z7.string(),
202
- end_time: z7.string(),
203
- points: z7.array(EnrichedPointSchema)
254
+ var EnrichedTripSummarySchema = z8.object({
255
+ trip_id: z8.number(),
256
+ driver_id: z8.string(),
257
+ start_time: z8.string(),
258
+ end_time: z8.string(),
259
+ points: z8.array(EnrichedPointSchema)
204
260
  });
205
261
  var EnrichedTripSummaryResponseSchema = EnrichedTripSummarySchema;
206
- var DriverEnrichedSummariesResponseSchema = z7.array(EnrichedTripSummarySchema);
262
+ var DriverEnrichedSummariesResponseSchema = z8.array(EnrichedTripSummarySchema);
263
+
264
+ // src/schemas/trips/convex-driver-trip.ts
265
+ import { z as z9 } from "zod";
266
+ var ConvexBreadcrumbEventSchema = z9.object({
267
+ ts: z9.number(),
268
+ // epoch ms
269
+ status: z9.string(),
270
+ lat: z9.number(),
271
+ lon: z9.number(),
272
+ heading: z9.number().optional(),
273
+ locationText: z9.string().optional(),
274
+ speedKph: z9.number().optional(),
275
+ altitudeFeet: z9.number().optional()
276
+ });
277
+ var ConvexDriverTripRequestSchema = z9.object({
278
+ userId: z9.string(),
279
+ breadcrumbs: z9.array(ConvexBreadcrumbEventSchema).min(1)
280
+ });
281
+
282
+ // src/schemas/trips/post-driver-trip-telemetry.ts
283
+ import { z as z10 } from "zod";
284
+ var PostDriverTripTelemetryRecordSchema = z10.object({
285
+ location_latitude: z10.number(),
286
+ location_longitude: z10.number(),
287
+ location_address: z10.string().optional(),
288
+ heading: z10.number(),
289
+ drivingState: z10.string(),
290
+ speedKph: z10.number(),
291
+ altitudeFeet: z10.number(),
292
+ gps_timestamp: z10.string().optional(),
293
+ odometer: z10.number().optional(),
294
+ activity_type: z10.string().optional(),
295
+ activity_confidence: z10.number().int().optional()
296
+ });
297
+ var PostDriverTripTelemetryRequestSchema = z10.object({
298
+ honkUserId: z10.string(),
299
+ telemetry: z10.array(PostDriverTripTelemetryRecordSchema).min(1)
300
+ });
207
301
 
208
302
  // src/auth-data.ts
209
- import { z as z8 } from "zod";
210
- var GomotiveAuthDataSchema = z8.object({
211
- kind: z8.literal("gomotive"),
212
- token: z8.string(),
213
- ownerOperator: z8.boolean()
303
+ import { z as z11 } from "zod";
304
+ var GomotiveAuthDataSchema = z11.object({
305
+ kind: z11.literal("gomotive"),
306
+ token: z11.string(),
307
+ ownerOperator: z11.boolean()
214
308
  });
215
- var VistaAuthDataSchema = z8.object({
216
- kind: z8.literal("vista"),
217
- driverId: z8.string(),
218
- cookie: z8.string()
309
+ var VistaAuthDataSchema = z11.object({
310
+ kind: z11.literal("vista"),
311
+ driverId: z11.string(),
312
+ cookie: z11.string()
219
313
  });
220
- var MockAuthDataSchema = z8.object({
221
- kind: z8.literal("mock"),
222
- cookie: z8.string()
314
+ var MockAuthDataSchema = z11.object({
315
+ kind: z11.literal("mock"),
316
+ cookie: z11.string()
223
317
  });
224
- var NoneAuthDataSchema = z8.object({
225
- kind: z8.literal("none")
318
+ var NoneAuthDataSchema = z11.object({
319
+ kind: z11.literal("none")
226
320
  });
227
- var ProviderAuthDataSchema = z8.discriminatedUnion("kind", [
321
+ var ProviderAuthDataSchema = z11.discriminatedUnion("kind", [
228
322
  GomotiveAuthDataSchema,
229
323
  VistaAuthDataSchema,
230
324
  MockAuthDataSchema,
231
325
  NoneAuthDataSchema
232
326
  ]);
233
- var LegacyVistaAuthSchema = z8.object({
234
- driverId: z8.string(),
235
- cookie: z8.string()
327
+ var LegacyVistaAuthSchema = z11.object({
328
+ driverId: z11.string(),
329
+ cookie: z11.string()
236
330
  });
237
331
  function serializeAuthData(data) {
238
332
  if (data.kind === "none") {
@@ -268,52 +362,57 @@ function deserializeAuthData(authToken) {
268
362
  }
269
363
 
270
364
  // src/browser-auth.ts
271
- import { z as z9 } from "zod";
272
- var CapturedTrafficEntrySchema = z9.object({
273
- method: z9.string(),
274
- url: z9.string(),
275
- status: z9.number(),
276
- responseBody: z9.string().optional()
365
+ import { z as z12 } from "zod";
366
+ var CapturedTrafficEntrySchema = z12.object({
367
+ method: z12.string(),
368
+ url: z12.string(),
369
+ status: z12.number(),
370
+ responseBody: z12.string().optional()
277
371
  });
278
- var BrowserAuthRequestSchema = z9.object({
279
- providerStub: z9.string(),
280
- providerUrl: z9.string(),
281
- username: z9.string(),
282
- encryptedPassword: z9.string(),
283
- captureTraffic: z9.boolean().optional()
372
+ var BrowserAuthRequestSchema = z12.object({
373
+ providerStub: z12.string(),
374
+ providerUrl: z12.string(),
375
+ username: z12.string(),
376
+ encryptedPassword: z12.string(),
377
+ captureTraffic: z12.boolean().optional()
284
378
  });
285
- var BrowserAuthSuccessSchema = z9.object({
286
- success: z9.literal(true),
379
+ var BrowserAuthSuccessSchema = z12.object({
380
+ success: z12.literal(true),
287
381
  authData: ProviderAuthDataSchema,
288
- capturedTraffic: z9.array(CapturedTrafficEntrySchema).optional()
382
+ capturedTraffic: z12.array(CapturedTrafficEntrySchema).optional()
289
383
  });
290
- var BrowserAuthFailureSchema = z9.object({
291
- success: z9.literal(false),
292
- error: z9.string()
384
+ var BrowserAuthFailureSchema = z12.object({
385
+ success: z12.literal(false),
386
+ error: z12.string()
293
387
  });
294
- var BrowserAuthResponseSchema = z9.discriminatedUnion("success", [
388
+ var BrowserAuthResponseSchema = z12.discriminatedUnion("success", [
295
389
  BrowserAuthSuccessSchema,
296
390
  BrowserAuthFailureSchema
297
391
  ]);
298
- var CrawlPageSchema = z9.object({
299
- url: z9.string(),
300
- html: z9.string()
392
+ var CrawlPageSchema = z12.object({
393
+ url: z12.string(),
394
+ html: z12.string()
301
395
  });
302
- var BrowserCrawlSuccessSchema = z9.object({
303
- success: z9.literal(true),
304
- pages: z9.array(CrawlPageSchema)
396
+ var BrowserCrawlSuccessSchema = z12.object({
397
+ success: z12.literal(true),
398
+ pages: z12.array(CrawlPageSchema)
305
399
  });
306
- var BrowserCrawlFailureSchema = z9.object({
307
- success: z9.literal(false),
308
- error: z9.string()
400
+ var BrowserCrawlFailureSchema = z12.object({
401
+ success: z12.literal(false),
402
+ error: z12.string()
309
403
  });
310
- var BrowserCrawlResponseSchema = z9.discriminatedUnion("success", [
404
+ var BrowserCrawlResponseSchema = z12.discriminatedUnion("success", [
311
405
  BrowserCrawlSuccessSchema,
312
406
  BrowserCrawlFailureSchema
313
407
  ]);
314
408
  export {
315
409
  AnonymousDriverErrorResponseSchema,
316
410
  AnonymousDriverResponseSchema,
411
+ BGGeoActivitySchema,
412
+ BGGeoBatchRequestSchema,
413
+ BGGeoBatterySchema,
414
+ BGGeoCoordsSchema,
415
+ BGGeoLocationSchema,
317
416
  BatchConvexUpdate,
318
417
  BatchConvexUpdateSchema,
319
418
  BrowserAuthFailureSchema,
@@ -324,7 +423,9 @@ export {
324
423
  BrowserCrawlResponseSchema,
325
424
  BrowserCrawlSuccessSchema,
326
425
  CapturedTrafficEntrySchema,
426
+ ConvexBreadcrumbEventSchema,
327
427
  ConvexDriverSchema,
428
+ ConvexDriverTripRequestSchema,
328
429
  ConvexUpdate,
329
430
  ConvexUpdateSchema,
330
431
  CrawlPageSchema,
@@ -351,6 +452,8 @@ export {
351
452
  EnrichedTripSummaryResponseSchema,
352
453
  EnrichedTripSummarySchema,
353
454
  GomotiveAuthDataSchema,
455
+ ListDriversRequestSchema,
456
+ ListDriversResponseSchema,
354
457
  ManualBatchEntrySchema,
355
458
  ManualBatchRequestSchema,
356
459
  ManualBatchResponseSchema,
@@ -370,6 +473,8 @@ export {
370
473
  PatchDriverDriverResponseSchema,
371
474
  PatchDriverRequestSchema,
372
475
  PatchDriverResponseSchema,
476
+ PostDriverTripTelemetryRecordSchema,
477
+ PostDriverTripTelemetryRequestSchema,
373
478
  ProviderAuthDataSchema,
374
479
  ScrapeStatus,
375
480
  SharedDriverResponseSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/shared-schemas",
3
- "version": "2.20.0",
3
+ "version": "2.23.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",