@findatruck/shared-schemas 2.13.0 → 2.14.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.cjs CHANGED
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AnonymousDriverErrorResponseSchema: () => AnonymousDriverErrorResponseSchema,
34
+ AnonymousDriverResponseSchema: () => AnonymousDriverResponseSchema,
33
35
  BatchConvexUpdate: () => BatchConvexUpdate,
34
36
  BatchConvexUpdateSchema: () => BatchConvexUpdateSchema,
35
37
  BrowserAuthFailureSchema: () => BrowserAuthFailureSchema,
@@ -39,10 +41,12 @@ __export(index_exports, {
39
41
  BrowserCrawlFailureSchema: () => BrowserCrawlFailureSchema,
40
42
  BrowserCrawlResponseSchema: () => BrowserCrawlResponseSchema,
41
43
  BrowserCrawlSuccessSchema: () => BrowserCrawlSuccessSchema,
44
+ CapturedTrafficEntrySchema: () => CapturedTrafficEntrySchema,
42
45
  ConvexDriverSchema: () => ConvexDriverSchema,
43
46
  ConvexUpdate: () => ConvexUpdate,
44
47
  ConvexUpdateSchema: () => ConvexUpdateSchema,
45
48
  CrawlPageSchema: () => CrawlPageSchema,
49
+ CreateAnonymousDriverBodySchema: () => CreateAnonymousDriverBodySchema,
46
50
  DeleteProviderAccountRequestSchema: () => DeleteProviderAccountRequestSchema,
47
51
  DeleteProviderAccountResponseSchema: () => DeleteProviderAccountResponseSchema,
48
52
  DriverRankingSchema: () => DriverRankingSchema,
@@ -172,8 +176,20 @@ var BatchConvexUpdateSchema = import_zod2.default.object({
172
176
  var ConvexUpdate = ConvexUpdateSchema;
173
177
  var BatchConvexUpdate = BatchConvexUpdateSchema;
174
178
 
175
- // src/schemas/providerAccounts/update-status.ts
179
+ // src/schemas/drivers/anonymous-driver.ts
176
180
  var import_zod3 = __toESM(require("zod"), 1);
181
+ var CreateAnonymousDriverBodySchema = import_zod3.default.object({
182
+ convex_user_id: import_zod3.default.string().min(1)
183
+ });
184
+ var AnonymousDriverResponseSchema = import_zod3.default.object({
185
+ driver_id: import_zod3.default.string()
186
+ });
187
+ var AnonymousDriverErrorResponseSchema = import_zod3.default.object({
188
+ error: import_zod3.default.string()
189
+ });
190
+
191
+ // src/schemas/providerAccounts/update-status.ts
192
+ var import_zod4 = __toESM(require("zod"), 1);
177
193
  var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
178
194
  ScrapeStatus2["NEW_LOGIN_RECEIVED"] = "NEW_LOGIN_RECEIVED";
179
195
  ScrapeStatus2["LOGIN_IN_PROGRESS"] = "LOGIN_IN_PROGRESS";
@@ -186,131 +202,131 @@ var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
186
202
  ScrapeStatus2["DATA_FETCH_FAILED"] = "DATA_FETCH_FAILED";
187
203
  return ScrapeStatus2;
188
204
  })(ScrapeStatus || {});
189
- var UpdateScrapeStatusMessage = import_zod3.default.object({
190
- status: import_zod3.default.nativeEnum(ScrapeStatus).describe("The current status of the scrape process"),
191
- correctPassword: import_zod3.default.boolean().optional().describe("Indicates if the provided password was correct, if applicable"),
192
- externalProviderAccountId: import_zod3.default.string().describe("The external identifier for the provider account (convex ID or similar)"),
193
- username: import_zod3.default.string().describe("The username of the provider account whose status is being updated"),
194
- provider_url: import_zod3.default.string().describe("The URL of the ELD provider"),
195
- driverCount: import_zod3.default.number().optional().describe("The number of drivers associated with the account, if applicable"),
196
- providerSlug: import_zod3.default.string().optional().describe("The slug identifier for the provider")
205
+ var UpdateScrapeStatusMessage = import_zod4.default.object({
206
+ status: import_zod4.default.nativeEnum(ScrapeStatus).describe("The current status of the scrape process"),
207
+ correctPassword: import_zod4.default.boolean().optional().describe("Indicates if the provided password was correct, if applicable"),
208
+ externalProviderAccountId: import_zod4.default.string().describe("The external identifier for the provider account (convex ID or similar)"),
209
+ username: import_zod4.default.string().describe("The username of the provider account whose status is being updated"),
210
+ provider_url: import_zod4.default.string().describe("The URL of the ELD provider"),
211
+ driverCount: import_zod4.default.number().optional().describe("The number of drivers associated with the account, if applicable"),
212
+ providerSlug: import_zod4.default.string().optional().describe("The slug identifier for the provider")
197
213
  }).describe("Schema for update status messages");
198
214
 
199
215
  // src/schemas/providerAccounts/validate-password.ts
200
- var import_zod4 = require("zod");
201
- var ValidatePasswordRequestSchema = import_zod4.z.object({
202
- providerAccountId: import_zod4.z.string().min(1).describe("The unique identifier of the provider account in postgres to validate the password for"),
203
- encryptedPassword: import_zod4.z.string().min(1).describe("The encrypted password to validate against the stored password")
216
+ var import_zod5 = require("zod");
217
+ var ValidatePasswordRequestSchema = import_zod5.z.object({
218
+ providerAccountId: import_zod5.z.string().min(1).describe("The unique identifier of the provider account in postgres to validate the password for"),
219
+ encryptedPassword: import_zod5.z.string().min(1).describe("The encrypted password to validate against the stored password")
204
220
  }).describe("Request schema for validating a provider account password");
205
- var ValidatePasswordResponseSchema = import_zod4.z.object({
206
- isValid: import_zod4.z.boolean().describe("Indicates if the provided password is valid"),
207
- driverIds: import_zod4.z.array(import_zod4.z.string()).describe("List of driver IDs associated with the provider account")
221
+ var ValidatePasswordResponseSchema = import_zod5.z.object({
222
+ isValid: import_zod5.z.boolean().describe("Indicates if the provided password is valid"),
223
+ driverIds: import_zod5.z.array(import_zod5.z.string()).describe("List of driver IDs associated with the provider account")
208
224
  }).describe("Response schema for password validation");
209
225
 
210
226
  // src/schemas/providerAccounts/delete-provider-account.ts
211
- var import_zod5 = require("zod");
212
- var DeleteProviderAccountRequestSchema = import_zod5.z.object({
213
- providerAccountId: import_zod5.z.string().min(1).describe("The external provider account ID to delete")
227
+ var import_zod6 = require("zod");
228
+ var DeleteProviderAccountRequestSchema = import_zod6.z.object({
229
+ providerAccountId: import_zod6.z.string().min(1).describe("The external provider account ID to delete")
214
230
  }).describe("Request schema for deleting a provider account");
215
- var DeleteProviderAccountResponseSchema = import_zod5.z.object({
216
- success: import_zod5.z.boolean().describe("Indicates if the provider account was successfully deleted")
231
+ var DeleteProviderAccountResponseSchema = import_zod6.z.object({
232
+ success: import_zod6.z.boolean().describe("Indicates if the provider account was successfully deleted")
217
233
  }).describe("Response schema for provider account deletion");
218
234
 
219
235
  // src/schemas/telemetry/driver-rankings.ts
220
- var import_zod6 = require("zod");
221
- var DriverRankingsRequestSchema = import_zod6.z.object({
222
- start_date: import_zod6.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
223
- end_date: import_zod6.z.string().describe("End date for the ranking period (ISO 8601 format)"),
224
- state: import_zod6.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
236
+ var import_zod7 = require("zod");
237
+ var DriverRankingsRequestSchema = import_zod7.z.object({
238
+ start_date: import_zod7.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
239
+ end_date: import_zod7.z.string().describe("End date for the ranking period (ISO 8601 format)"),
240
+ state: import_zod7.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
225
241
  }).describe("Request schema for driver rankings by miles driven");
226
- var DriverRankingSchema = import_zod6.z.object({
227
- rank: import_zod6.z.number().int().positive().describe("Rank position based on miles driven"),
228
- driver_id: import_zod6.z.string().uuid().describe("Unique identifier of the driver"),
229
- driver_name: import_zod6.z.string().describe("Name of the driver"),
230
- total_miles: import_zod6.z.number().min(0).describe("Total miles driven in the specified period")
242
+ var DriverRankingSchema = import_zod7.z.object({
243
+ rank: import_zod7.z.number().int().positive().describe("Rank position based on miles driven"),
244
+ driver_id: import_zod7.z.string().uuid().describe("Unique identifier of the driver"),
245
+ driver_name: import_zod7.z.string().describe("Name of the driver"),
246
+ total_miles: import_zod7.z.number().min(0).describe("Total miles driven in the specified period")
231
247
  }).describe("Single driver ranking entry");
232
- var DriverRankingsResponseSchema = import_zod6.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
248
+ var DriverRankingsResponseSchema = import_zod7.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
233
249
 
234
250
  // src/schemas/telemetry/state-heatmap.ts
235
- var import_zod7 = require("zod");
236
- var StateHeatmapRequestSchema = import_zod7.z.object({
237
- driver_id: import_zod7.z.string().uuid().describe("Unique identifier of the driver"),
238
- start_date: import_zod7.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
239
- end_date: import_zod7.z.string().describe("End date for the heatmap period (ISO 8601 format)")
251
+ var import_zod8 = require("zod");
252
+ var StateHeatmapRequestSchema = import_zod8.z.object({
253
+ driver_id: import_zod8.z.string().uuid().describe("Unique identifier of the driver"),
254
+ start_date: import_zod8.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
255
+ end_date: import_zod8.z.string().describe("End date for the heatmap period (ISO 8601 format)")
240
256
  }).describe("Request schema for driver state heatmap");
241
- var StateHeatmapEntrySchema = import_zod7.z.object({
242
- count: import_zod7.z.number().int().min(0).describe("Number of telemetry points in this state"),
243
- percentage: import_zod7.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
257
+ var StateHeatmapEntrySchema = import_zod8.z.object({
258
+ count: import_zod8.z.number().int().min(0).describe("Number of telemetry points in this state"),
259
+ percentage: import_zod8.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
244
260
  }).describe("Single state entry in the heatmap");
245
- var StateHeatmapResponseSchema = import_zod7.z.record(
246
- import_zod7.z.string().length(2),
261
+ var StateHeatmapResponseSchema = import_zod8.z.record(
262
+ import_zod8.z.string().length(2),
247
263
  StateHeatmapEntrySchema
248
264
  ).describe("Record of 2-letter state codes to heatmap entries");
249
265
 
250
266
  // src/schemas/telemetry/manual-batch.ts
251
- var import_zod8 = require("zod");
252
- var ManualBatchEntrySchema = import_zod8.z.object({
253
- driver_id: import_zod8.z.string().uuid().describe("Internal UUID of the driver"),
254
- timestamp: import_zod8.z.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
255
- location_latitude: import_zod8.z.number().min(-90).max(90).describe("GPS latitude coordinate"),
256
- location_longitude: import_zod8.z.number().min(-180).max(180).describe("GPS longitude coordinate"),
257
- location_address: import_zod8.z.string().optional().describe("Optional human-readable address"),
258
- vehicle_odometer_miles: import_zod8.z.number().min(0).optional().describe("Optional vehicle odometer reading in miles")
267
+ var import_zod9 = require("zod");
268
+ var ManualBatchEntrySchema = import_zod9.z.object({
269
+ driver_id: import_zod9.z.string().uuid().describe("Internal UUID of the driver"),
270
+ timestamp: import_zod9.z.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
271
+ location_latitude: import_zod9.z.number().min(-90).max(90).describe("GPS latitude coordinate"),
272
+ location_longitude: import_zod9.z.number().min(-180).max(180).describe("GPS longitude coordinate"),
273
+ location_address: import_zod9.z.string().optional().describe("Optional human-readable address"),
274
+ vehicle_odometer_miles: import_zod9.z.number().min(0).optional().describe("Optional vehicle odometer reading in miles")
259
275
  }).describe("Single manual telemetry entry");
260
- var ManualBatchRequestSchema = import_zod8.z.object({
261
- entries: import_zod8.z.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
276
+ var ManualBatchRequestSchema = import_zod9.z.object({
277
+ entries: import_zod9.z.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
262
278
  }).describe("Request schema for manual batch telemetry insertion");
263
- var ManualBatchTelemetrySchema = import_zod8.z.object({
264
- id: import_zod8.z.number().int().describe("Telemetry record ID"),
265
- driver_id: import_zod8.z.string().uuid().describe("Internal UUID of the driver"),
266
- timestamp: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.date()]).describe("Timestamp of the telemetry reading"),
267
- remaining_drive_time_in_seconds: import_zod8.z.number().min(0),
268
- remaining_shift_time_in_seconds: import_zod8.z.number().min(0),
269
- remaining_cycle_time_in_seconds: import_zod8.z.number().min(0),
270
- remaining_break_time_in_seconds: import_zod8.z.number().min(0),
271
- location_latitude: import_zod8.z.number().min(-90).max(90),
272
- location_longitude: import_zod8.z.number().min(-180).max(180),
273
- previous_location_latitude: import_zod8.z.number().min(-90).max(90).nullable(),
274
- previous_location_longitude: import_zod8.z.number().min(-180).max(180).nullable(),
275
- location_address: import_zod8.z.string().nullable(),
276
- location_state: import_zod8.z.string().length(2).nullable(),
277
- vehicle_odometer_miles: import_zod8.z.number().min(0).nullable(),
278
- source: import_zod8.z.enum(["eld", "manual"])
279
+ var ManualBatchTelemetrySchema = import_zod9.z.object({
280
+ id: import_zod9.z.number().int().describe("Telemetry record ID"),
281
+ driver_id: import_zod9.z.string().uuid().describe("Internal UUID of the driver"),
282
+ timestamp: import_zod9.z.union([import_zod9.z.string(), import_zod9.z.date()]).describe("Timestamp of the telemetry reading"),
283
+ remaining_drive_time_in_seconds: import_zod9.z.number().min(0),
284
+ remaining_shift_time_in_seconds: import_zod9.z.number().min(0),
285
+ remaining_cycle_time_in_seconds: import_zod9.z.number().min(0),
286
+ remaining_break_time_in_seconds: import_zod9.z.number().min(0),
287
+ location_latitude: import_zod9.z.number().min(-90).max(90),
288
+ location_longitude: import_zod9.z.number().min(-180).max(180),
289
+ previous_location_latitude: import_zod9.z.number().min(-90).max(90).nullable(),
290
+ previous_location_longitude: import_zod9.z.number().min(-180).max(180).nullable(),
291
+ location_address: import_zod9.z.string().nullable(),
292
+ location_state: import_zod9.z.string().length(2).nullable(),
293
+ vehicle_odometer_miles: import_zod9.z.number().min(0).nullable(),
294
+ source: import_zod9.z.enum(["eld", "manual"])
279
295
  }).describe("Telemetry record returned from manual batch insertion");
280
- var ManualBatchResponseSchema = import_zod8.z.object({
281
- message: import_zod8.z.string().describe("Success message"),
282
- inserted_count: import_zod8.z.number().int().min(0).describe("Number of telemetry entries inserted"),
283
- telemetry: import_zod8.z.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
296
+ var ManualBatchResponseSchema = import_zod9.z.object({
297
+ message: import_zod9.z.string().describe("Success message"),
298
+ inserted_count: import_zod9.z.number().int().min(0).describe("Number of telemetry entries inserted"),
299
+ telemetry: import_zod9.z.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
284
300
  }).describe("Response schema for manual batch telemetry insertion");
285
301
 
286
302
  // src/auth-data.ts
287
- var import_zod9 = require("zod");
288
- var GomotiveAuthDataSchema = import_zod9.z.object({
289
- kind: import_zod9.z.literal("gomotive"),
290
- token: import_zod9.z.string(),
291
- ownerOperator: import_zod9.z.boolean()
303
+ var import_zod10 = require("zod");
304
+ var GomotiveAuthDataSchema = import_zod10.z.object({
305
+ kind: import_zod10.z.literal("gomotive"),
306
+ token: import_zod10.z.string(),
307
+ ownerOperator: import_zod10.z.boolean()
292
308
  });
293
- var VistaAuthDataSchema = import_zod9.z.object({
294
- kind: import_zod9.z.literal("vista"),
295
- driverId: import_zod9.z.string(),
296
- cookie: import_zod9.z.string()
309
+ var VistaAuthDataSchema = import_zod10.z.object({
310
+ kind: import_zod10.z.literal("vista"),
311
+ driverId: import_zod10.z.string(),
312
+ cookie: import_zod10.z.string()
297
313
  });
298
- var MockAuthDataSchema = import_zod9.z.object({
299
- kind: import_zod9.z.literal("mock"),
300
- cookie: import_zod9.z.string()
314
+ var MockAuthDataSchema = import_zod10.z.object({
315
+ kind: import_zod10.z.literal("mock"),
316
+ cookie: import_zod10.z.string()
301
317
  });
302
- var NoneAuthDataSchema = import_zod9.z.object({
303
- kind: import_zod9.z.literal("none")
318
+ var NoneAuthDataSchema = import_zod10.z.object({
319
+ kind: import_zod10.z.literal("none")
304
320
  });
305
- var ProviderAuthDataSchema = import_zod9.z.discriminatedUnion("kind", [
321
+ var ProviderAuthDataSchema = import_zod10.z.discriminatedUnion("kind", [
306
322
  GomotiveAuthDataSchema,
307
323
  VistaAuthDataSchema,
308
324
  MockAuthDataSchema,
309
325
  NoneAuthDataSchema
310
326
  ]);
311
- var LegacyVistaAuthSchema = import_zod9.z.object({
312
- driverId: import_zod9.z.string(),
313
- cookie: import_zod9.z.string()
327
+ var LegacyVistaAuthSchema = import_zod10.z.object({
328
+ driverId: import_zod10.z.string(),
329
+ cookie: import_zod10.z.string()
314
330
  });
315
331
  function serializeAuthData(data) {
316
332
  if (data.kind === "none") {
@@ -346,43 +362,53 @@ function deserializeAuthData(authToken) {
346
362
  }
347
363
 
348
364
  // src/browser-auth.ts
349
- var import_zod10 = require("zod");
350
- var BrowserAuthRequestSchema = import_zod10.z.object({
351
- providerStub: import_zod10.z.string(),
352
- providerUrl: import_zod10.z.string(),
353
- username: import_zod10.z.string(),
354
- encryptedPassword: import_zod10.z.string()
365
+ var import_zod11 = require("zod");
366
+ var CapturedTrafficEntrySchema = import_zod11.z.object({
367
+ method: import_zod11.z.string(),
368
+ url: import_zod11.z.string(),
369
+ status: import_zod11.z.number(),
370
+ responseBody: import_zod11.z.string().optional()
371
+ });
372
+ var BrowserAuthRequestSchema = import_zod11.z.object({
373
+ providerStub: import_zod11.z.string(),
374
+ providerUrl: import_zod11.z.string(),
375
+ username: import_zod11.z.string(),
376
+ encryptedPassword: import_zod11.z.string(),
377
+ captureTraffic: import_zod11.z.boolean().optional()
355
378
  });
356
- var BrowserAuthSuccessSchema = import_zod10.z.object({
357
- success: import_zod10.z.literal(true),
358
- authData: ProviderAuthDataSchema
379
+ var BrowserAuthSuccessSchema = import_zod11.z.object({
380
+ success: import_zod11.z.literal(true),
381
+ authData: ProviderAuthDataSchema,
382
+ capturedTraffic: import_zod11.z.array(CapturedTrafficEntrySchema).optional()
359
383
  });
360
- var BrowserAuthFailureSchema = import_zod10.z.object({
361
- success: import_zod10.z.literal(false),
362
- error: import_zod10.z.string()
384
+ var BrowserAuthFailureSchema = import_zod11.z.object({
385
+ success: import_zod11.z.literal(false),
386
+ error: import_zod11.z.string()
363
387
  });
364
- var BrowserAuthResponseSchema = import_zod10.z.discriminatedUnion("success", [
388
+ var BrowserAuthResponseSchema = import_zod11.z.discriminatedUnion("success", [
365
389
  BrowserAuthSuccessSchema,
366
390
  BrowserAuthFailureSchema
367
391
  ]);
368
- var CrawlPageSchema = import_zod10.z.object({
369
- url: import_zod10.z.string(),
370
- html: import_zod10.z.string()
392
+ var CrawlPageSchema = import_zod11.z.object({
393
+ url: import_zod11.z.string(),
394
+ html: import_zod11.z.string()
371
395
  });
372
- var BrowserCrawlSuccessSchema = import_zod10.z.object({
373
- success: import_zod10.z.literal(true),
374
- pages: import_zod10.z.array(CrawlPageSchema)
396
+ var BrowserCrawlSuccessSchema = import_zod11.z.object({
397
+ success: import_zod11.z.literal(true),
398
+ pages: import_zod11.z.array(CrawlPageSchema)
375
399
  });
376
- var BrowserCrawlFailureSchema = import_zod10.z.object({
377
- success: import_zod10.z.literal(false),
378
- error: import_zod10.z.string()
400
+ var BrowserCrawlFailureSchema = import_zod11.z.object({
401
+ success: import_zod11.z.literal(false),
402
+ error: import_zod11.z.string()
379
403
  });
380
- var BrowserCrawlResponseSchema = import_zod10.z.discriminatedUnion("success", [
404
+ var BrowserCrawlResponseSchema = import_zod11.z.discriminatedUnion("success", [
381
405
  BrowserCrawlSuccessSchema,
382
406
  BrowserCrawlFailureSchema
383
407
  ]);
384
408
  // Annotate the CommonJS export names for ESM import in node:
385
409
  0 && (module.exports = {
410
+ AnonymousDriverErrorResponseSchema,
411
+ AnonymousDriverResponseSchema,
386
412
  BatchConvexUpdate,
387
413
  BatchConvexUpdateSchema,
388
414
  BrowserAuthFailureSchema,
@@ -392,10 +418,12 @@ var BrowserCrawlResponseSchema = import_zod10.z.discriminatedUnion("success", [
392
418
  BrowserCrawlFailureSchema,
393
419
  BrowserCrawlResponseSchema,
394
420
  BrowserCrawlSuccessSchema,
421
+ CapturedTrafficEntrySchema,
395
422
  ConvexDriverSchema,
396
423
  ConvexUpdate,
397
424
  ConvexUpdateSchema,
398
425
  CrawlPageSchema,
426
+ CreateAnonymousDriverBodySchema,
399
427
  DeleteProviderAccountRequestSchema,
400
428
  DeleteProviderAccountResponseSchema,
401
429
  DriverRankingSchema,