@findatruck/shared-schemas 2.10.1 → 2.12.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
@@ -32,12 +32,28 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  BatchConvexUpdate: () => BatchConvexUpdate,
34
34
  BatchConvexUpdateSchema: () => BatchConvexUpdateSchema,
35
+ BrowserAuthFailureSchema: () => BrowserAuthFailureSchema,
36
+ BrowserAuthRequestSchema: () => BrowserAuthRequestSchema,
37
+ BrowserAuthResponseSchema: () => BrowserAuthResponseSchema,
38
+ BrowserAuthSuccessSchema: () => BrowserAuthSuccessSchema,
39
+ BrowserCrawlFailureSchema: () => BrowserCrawlFailureSchema,
40
+ BrowserCrawlResponseSchema: () => BrowserCrawlResponseSchema,
41
+ BrowserCrawlSuccessSchema: () => BrowserCrawlSuccessSchema,
35
42
  ConvexDriverSchema: () => ConvexDriverSchema,
36
43
  ConvexUpdate: () => ConvexUpdate,
37
44
  ConvexUpdateSchema: () => ConvexUpdateSchema,
45
+ CrawlPageSchema: () => CrawlPageSchema,
46
+ DeleteProviderAccountRequestSchema: () => DeleteProviderAccountRequestSchema,
47
+ DeleteProviderAccountResponseSchema: () => DeleteProviderAccountResponseSchema,
38
48
  DriverRankingSchema: () => DriverRankingSchema,
39
49
  DriverRankingsRequestSchema: () => DriverRankingsRequestSchema,
40
50
  DriverRankingsResponseSchema: () => DriverRankingsResponseSchema,
51
+ GomotiveAuthDataSchema: () => GomotiveAuthDataSchema,
52
+ ManualBatchEntrySchema: () => ManualBatchEntrySchema,
53
+ ManualBatchRequestSchema: () => ManualBatchRequestSchema,
54
+ ManualBatchResponseSchema: () => ManualBatchResponseSchema,
55
+ ManualBatchTelemetrySchema: () => ManualBatchTelemetrySchema,
56
+ MockAuthDataSchema: () => MockAuthDataSchema,
41
57
  NewLoginRequest: () => NewLoginRequest,
42
58
  NewLoginRequestSchema: () => NewLoginRequestSchema,
43
59
  NewLoginResponse: () => NewLoginResponse,
@@ -46,13 +62,18 @@ __export(index_exports, {
46
62
  NewLoginResponseSchema: () => NewLoginResponseSchema,
47
63
  NewLoginResponseSuccess: () => NewLoginResponseSuccess,
48
64
  NewLoginResponseSuccessSchema: () => NewLoginResponseSuccessSchema,
65
+ NoneAuthDataSchema: () => NoneAuthDataSchema,
66
+ ProviderAuthDataSchema: () => ProviderAuthDataSchema,
49
67
  ScrapeStatus: () => ScrapeStatus,
50
68
  StateHeatmapEntrySchema: () => StateHeatmapEntrySchema,
51
69
  StateHeatmapRequestSchema: () => StateHeatmapRequestSchema,
52
70
  StateHeatmapResponseSchema: () => StateHeatmapResponseSchema,
53
71
  UpdateScrapeStatusMessage: () => UpdateScrapeStatusMessage,
54
72
  ValidatePasswordRequestSchema: () => ValidatePasswordRequestSchema,
55
- ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema
73
+ ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema,
74
+ VistaAuthDataSchema: () => VistaAuthDataSchema,
75
+ deserializeAuthData: () => deserializeAuthData,
76
+ serializeAuthData: () => serializeAuthData
56
77
  });
57
78
  module.exports = __toCommonJS(index_exports);
58
79
 
@@ -185,46 +206,206 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
185
206
  driverIds: import_zod4.z.array(import_zod4.z.string()).describe("List of driver IDs associated with the provider account")
186
207
  }).describe("Response schema for password validation");
187
208
 
188
- // src/schemas/telemetry/driver-rankings.ts
209
+ // src/schemas/providerAccounts/delete-provider-account.ts
189
210
  var import_zod5 = require("zod");
190
- var DriverRankingsRequestSchema = import_zod5.z.object({
191
- start_date: import_zod5.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
192
- end_date: import_zod5.z.string().describe("End date for the ranking period (ISO 8601 format)"),
193
- state: import_zod5.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
211
+ var DeleteProviderAccountRequestSchema = import_zod5.z.object({
212
+ providerAccountId: import_zod5.z.string().min(1).describe("The external provider account ID to delete")
213
+ }).describe("Request schema for deleting a provider account");
214
+ var DeleteProviderAccountResponseSchema = import_zod5.z.object({
215
+ success: import_zod5.z.boolean().describe("Indicates if the provider account was successfully deleted")
216
+ }).describe("Response schema for provider account deletion");
217
+
218
+ // src/schemas/telemetry/driver-rankings.ts
219
+ var import_zod6 = require("zod");
220
+ var DriverRankingsRequestSchema = import_zod6.z.object({
221
+ start_date: import_zod6.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
222
+ end_date: import_zod6.z.string().describe("End date for the ranking period (ISO 8601 format)"),
223
+ state: import_zod6.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
194
224
  }).describe("Request schema for driver rankings by miles driven");
195
- var DriverRankingSchema = import_zod5.z.object({
196
- rank: import_zod5.z.number().int().positive().describe("Rank position based on miles driven"),
197
- driver_id: import_zod5.z.string().uuid().describe("Unique identifier of the driver"),
198
- driver_name: import_zod5.z.string().describe("Name of the driver"),
199
- total_miles: import_zod5.z.number().min(0).describe("Total miles driven in the specified period")
225
+ var DriverRankingSchema = import_zod6.z.object({
226
+ rank: import_zod6.z.number().int().positive().describe("Rank position based on miles driven"),
227
+ driver_id: import_zod6.z.string().uuid().describe("Unique identifier of the driver"),
228
+ driver_name: import_zod6.z.string().describe("Name of the driver"),
229
+ total_miles: import_zod6.z.number().min(0).describe("Total miles driven in the specified period")
200
230
  }).describe("Single driver ranking entry");
201
- var DriverRankingsResponseSchema = import_zod5.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
231
+ var DriverRankingsResponseSchema = import_zod6.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
202
232
 
203
233
  // src/schemas/telemetry/state-heatmap.ts
204
- var import_zod6 = require("zod");
205
- var StateHeatmapRequestSchema = import_zod6.z.object({
206
- driver_id: import_zod6.z.string().uuid().describe("Unique identifier of the driver"),
207
- start_date: import_zod6.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
208
- end_date: import_zod6.z.string().describe("End date for the heatmap period (ISO 8601 format)")
234
+ var import_zod7 = require("zod");
235
+ var StateHeatmapRequestSchema = import_zod7.z.object({
236
+ driver_id: import_zod7.z.string().uuid().describe("Unique identifier of the driver"),
237
+ start_date: import_zod7.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
238
+ end_date: import_zod7.z.string().describe("End date for the heatmap period (ISO 8601 format)")
209
239
  }).describe("Request schema for driver state heatmap");
210
- var StateHeatmapEntrySchema = import_zod6.z.object({
211
- count: import_zod6.z.number().int().min(0).describe("Number of telemetry points in this state"),
212
- percentage: import_zod6.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
240
+ var StateHeatmapEntrySchema = import_zod7.z.object({
241
+ count: import_zod7.z.number().int().min(0).describe("Number of telemetry points in this state"),
242
+ percentage: import_zod7.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
213
243
  }).describe("Single state entry in the heatmap");
214
- var StateHeatmapResponseSchema = import_zod6.z.record(
215
- import_zod6.z.string().length(2),
244
+ var StateHeatmapResponseSchema = import_zod7.z.record(
245
+ import_zod7.z.string().length(2),
216
246
  StateHeatmapEntrySchema
217
247
  ).describe("Record of 2-letter state codes to heatmap entries");
248
+
249
+ // src/schemas/telemetry/manual-batch.ts
250
+ var import_zod8 = require("zod");
251
+ var ManualBatchEntrySchema = import_zod8.z.object({
252
+ driver_id: import_zod8.z.string().uuid().describe("Internal UUID of the driver"),
253
+ timestamp: import_zod8.z.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
254
+ location_latitude: import_zod8.z.number().min(-90).max(90).describe("GPS latitude coordinate"),
255
+ location_longitude: import_zod8.z.number().min(-180).max(180).describe("GPS longitude coordinate"),
256
+ location_address: import_zod8.z.string().optional().describe("Optional human-readable address"),
257
+ vehicle_odometer_miles: import_zod8.z.number().min(0).optional().describe("Optional vehicle odometer reading in miles")
258
+ }).describe("Single manual telemetry entry");
259
+ var ManualBatchRequestSchema = import_zod8.z.object({
260
+ entries: import_zod8.z.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
261
+ }).describe("Request schema for manual batch telemetry insertion");
262
+ var ManualBatchTelemetrySchema = import_zod8.z.object({
263
+ id: import_zod8.z.number().int().describe("Telemetry record ID"),
264
+ driver_id: import_zod8.z.string().uuid().describe("Internal UUID of the driver"),
265
+ timestamp: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.date()]).describe("Timestamp of the telemetry reading"),
266
+ remaining_drive_time_in_seconds: import_zod8.z.number().min(0),
267
+ remaining_shift_time_in_seconds: import_zod8.z.number().min(0),
268
+ remaining_cycle_time_in_seconds: import_zod8.z.number().min(0),
269
+ remaining_break_time_in_seconds: import_zod8.z.number().min(0),
270
+ location_latitude: import_zod8.z.number().min(-90).max(90),
271
+ location_longitude: import_zod8.z.number().min(-180).max(180),
272
+ previous_location_latitude: import_zod8.z.number().min(-90).max(90).nullable(),
273
+ previous_location_longitude: import_zod8.z.number().min(-180).max(180).nullable(),
274
+ location_address: import_zod8.z.string().nullable(),
275
+ location_state: import_zod8.z.string().length(2).nullable(),
276
+ vehicle_odometer_miles: import_zod8.z.number().min(0).nullable(),
277
+ source: import_zod8.z.enum(["eld", "manual"])
278
+ }).describe("Telemetry record returned from manual batch insertion");
279
+ var ManualBatchResponseSchema = import_zod8.z.object({
280
+ message: import_zod8.z.string().describe("Success message"),
281
+ inserted_count: import_zod8.z.number().int().min(0).describe("Number of telemetry entries inserted"),
282
+ telemetry: import_zod8.z.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
283
+ }).describe("Response schema for manual batch telemetry insertion");
284
+
285
+ // src/auth-data.ts
286
+ var import_zod9 = require("zod");
287
+ var GomotiveAuthDataSchema = import_zod9.z.object({
288
+ kind: import_zod9.z.literal("gomotive"),
289
+ token: import_zod9.z.string(),
290
+ ownerOperator: import_zod9.z.boolean()
291
+ });
292
+ var VistaAuthDataSchema = import_zod9.z.object({
293
+ kind: import_zod9.z.literal("vista"),
294
+ driverId: import_zod9.z.string(),
295
+ cookie: import_zod9.z.string()
296
+ });
297
+ var MockAuthDataSchema = import_zod9.z.object({
298
+ kind: import_zod9.z.literal("mock"),
299
+ cookie: import_zod9.z.string()
300
+ });
301
+ var NoneAuthDataSchema = import_zod9.z.object({
302
+ kind: import_zod9.z.literal("none")
303
+ });
304
+ var ProviderAuthDataSchema = import_zod9.z.discriminatedUnion("kind", [
305
+ GomotiveAuthDataSchema,
306
+ VistaAuthDataSchema,
307
+ MockAuthDataSchema,
308
+ NoneAuthDataSchema
309
+ ]);
310
+ var LegacyVistaAuthSchema = import_zod9.z.object({
311
+ driverId: import_zod9.z.string(),
312
+ cookie: import_zod9.z.string()
313
+ });
314
+ function serializeAuthData(data) {
315
+ if (data.kind === "none") {
316
+ return null;
317
+ }
318
+ return JSON.stringify(data);
319
+ }
320
+ function deserializeAuthData(authToken) {
321
+ if (!authToken) {
322
+ return { kind: "none" };
323
+ }
324
+ try {
325
+ const parsed = JSON.parse(authToken);
326
+ const newFormatResult = ProviderAuthDataSchema.safeParse(parsed);
327
+ if (newFormatResult.success) {
328
+ return newFormatResult.data;
329
+ }
330
+ const legacyVistaResult = LegacyVistaAuthSchema.safeParse(parsed);
331
+ if (legacyVistaResult.success) {
332
+ return {
333
+ kind: "vista",
334
+ driverId: legacyVistaResult.data.driverId,
335
+ cookie: legacyVistaResult.data.cookie
336
+ };
337
+ }
338
+ } catch {
339
+ }
340
+ return {
341
+ kind: "gomotive",
342
+ token: authToken,
343
+ ownerOperator: false
344
+ };
345
+ }
346
+
347
+ // src/browser-auth.ts
348
+ var import_zod10 = require("zod");
349
+ var BrowserAuthRequestSchema = import_zod10.z.object({
350
+ providerStub: import_zod10.z.string(),
351
+ providerUrl: import_zod10.z.string(),
352
+ username: import_zod10.z.string(),
353
+ encryptedPassword: import_zod10.z.string()
354
+ });
355
+ var BrowserAuthSuccessSchema = import_zod10.z.object({
356
+ success: import_zod10.z.literal(true),
357
+ authData: ProviderAuthDataSchema
358
+ });
359
+ var BrowserAuthFailureSchema = import_zod10.z.object({
360
+ success: import_zod10.z.literal(false),
361
+ error: import_zod10.z.string()
362
+ });
363
+ var BrowserAuthResponseSchema = import_zod10.z.discriminatedUnion("success", [
364
+ BrowserAuthSuccessSchema,
365
+ BrowserAuthFailureSchema
366
+ ]);
367
+ var CrawlPageSchema = import_zod10.z.object({
368
+ url: import_zod10.z.string(),
369
+ html: import_zod10.z.string()
370
+ });
371
+ var BrowserCrawlSuccessSchema = import_zod10.z.object({
372
+ success: import_zod10.z.literal(true),
373
+ pages: import_zod10.z.array(CrawlPageSchema)
374
+ });
375
+ var BrowserCrawlFailureSchema = import_zod10.z.object({
376
+ success: import_zod10.z.literal(false),
377
+ error: import_zod10.z.string()
378
+ });
379
+ var BrowserCrawlResponseSchema = import_zod10.z.discriminatedUnion("success", [
380
+ BrowserCrawlSuccessSchema,
381
+ BrowserCrawlFailureSchema
382
+ ]);
218
383
  // Annotate the CommonJS export names for ESM import in node:
219
384
  0 && (module.exports = {
220
385
  BatchConvexUpdate,
221
386
  BatchConvexUpdateSchema,
387
+ BrowserAuthFailureSchema,
388
+ BrowserAuthRequestSchema,
389
+ BrowserAuthResponseSchema,
390
+ BrowserAuthSuccessSchema,
391
+ BrowserCrawlFailureSchema,
392
+ BrowserCrawlResponseSchema,
393
+ BrowserCrawlSuccessSchema,
222
394
  ConvexDriverSchema,
223
395
  ConvexUpdate,
224
396
  ConvexUpdateSchema,
397
+ CrawlPageSchema,
398
+ DeleteProviderAccountRequestSchema,
399
+ DeleteProviderAccountResponseSchema,
225
400
  DriverRankingSchema,
226
401
  DriverRankingsRequestSchema,
227
402
  DriverRankingsResponseSchema,
403
+ GomotiveAuthDataSchema,
404
+ ManualBatchEntrySchema,
405
+ ManualBatchRequestSchema,
406
+ ManualBatchResponseSchema,
407
+ ManualBatchTelemetrySchema,
408
+ MockAuthDataSchema,
228
409
  NewLoginRequest,
229
410
  NewLoginRequestSchema,
230
411
  NewLoginResponse,
@@ -233,11 +414,16 @@ var StateHeatmapResponseSchema = import_zod6.z.record(
233
414
  NewLoginResponseSchema,
234
415
  NewLoginResponseSuccess,
235
416
  NewLoginResponseSuccessSchema,
417
+ NoneAuthDataSchema,
418
+ ProviderAuthDataSchema,
236
419
  ScrapeStatus,
237
420
  StateHeatmapEntrySchema,
238
421
  StateHeatmapRequestSchema,
239
422
  StateHeatmapResponseSchema,
240
423
  UpdateScrapeStatusMessage,
241
424
  ValidatePasswordRequestSchema,
242
- ValidatePasswordResponseSchema
425
+ ValidatePasswordResponseSchema,
426
+ VistaAuthDataSchema,
427
+ deserializeAuthData,
428
+ serializeAuthData
243
429
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,21 @@
1
1
  export { BatchConvexUpdate, BatchConvexUpdateData, BatchConvexUpdateSchema, ConvexDriverData, ConvexDriverSchema, ConvexUpdate, ConvexUpdateData, ConvexUpdateSchema, NewLoginRequest, NewLoginRequestData, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseData, NewLoginResponseFailure, NewLoginResponseFailureData, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessData, NewLoginResponseSuccessSchema, PublicProviderData, PublicUserData, ScrapeStatus, UpdateScrapeStatusMessage, ValidatePasswordRequest, ValidatePasswordRequestData, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseData, ValidatePasswordResponseSchema } from './browser.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
+ interface DeleteProviderAccountRequestData {
5
+ providerAccountId: string;
6
+ }
7
+ interface DeleteProviderAccountResponseData {
8
+ success: boolean;
9
+ }
10
+ declare const DeleteProviderAccountRequestSchema: z.ZodObject<{
11
+ providerAccountId: z.ZodString;
12
+ }, z.core.$strip>;
13
+ declare const DeleteProviderAccountResponseSchema: z.ZodObject<{
14
+ success: z.ZodBoolean;
15
+ }, z.core.$strip>;
16
+ type DeleteProviderAccountRequest = DeleteProviderAccountRequestData;
17
+ type DeleteProviderAccountResponse = DeleteProviderAccountResponseData;
18
+
4
19
  interface DriverRankingsRequestData {
5
20
  start_date: string;
6
21
  end_date: string;
@@ -61,4 +76,196 @@ type StateHeatmapRequest = StateHeatmapRequestData;
61
76
  type StateHeatmapEntry = StateHeatmapEntryData;
62
77
  type StateHeatmapResponse = StateHeatmapResponseData;
63
78
 
64
- export { type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema };
79
+ declare const ManualBatchEntrySchema: z.ZodObject<{
80
+ driver_id: z.ZodString;
81
+ timestamp: z.ZodString;
82
+ location_latitude: z.ZodNumber;
83
+ location_longitude: z.ZodNumber;
84
+ location_address: z.ZodOptional<z.ZodString>;
85
+ vehicle_odometer_miles: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strip>;
87
+ declare const ManualBatchRequestSchema: z.ZodObject<{
88
+ entries: z.ZodArray<z.ZodObject<{
89
+ driver_id: z.ZodString;
90
+ timestamp: z.ZodString;
91
+ location_latitude: z.ZodNumber;
92
+ location_longitude: z.ZodNumber;
93
+ location_address: z.ZodOptional<z.ZodString>;
94
+ vehicle_odometer_miles: z.ZodOptional<z.ZodNumber>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>;
97
+ declare const ManualBatchTelemetrySchema: z.ZodObject<{
98
+ id: z.ZodNumber;
99
+ driver_id: z.ZodString;
100
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
101
+ remaining_drive_time_in_seconds: z.ZodNumber;
102
+ remaining_shift_time_in_seconds: z.ZodNumber;
103
+ remaining_cycle_time_in_seconds: z.ZodNumber;
104
+ remaining_break_time_in_seconds: z.ZodNumber;
105
+ location_latitude: z.ZodNumber;
106
+ location_longitude: z.ZodNumber;
107
+ previous_location_latitude: z.ZodNullable<z.ZodNumber>;
108
+ previous_location_longitude: z.ZodNullable<z.ZodNumber>;
109
+ location_address: z.ZodNullable<z.ZodString>;
110
+ location_state: z.ZodNullable<z.ZodString>;
111
+ vehicle_odometer_miles: z.ZodNullable<z.ZodNumber>;
112
+ source: z.ZodEnum<{
113
+ eld: "eld";
114
+ manual: "manual";
115
+ }>;
116
+ }, z.core.$strip>;
117
+ declare const ManualBatchResponseSchema: z.ZodObject<{
118
+ message: z.ZodString;
119
+ inserted_count: z.ZodNumber;
120
+ telemetry: z.ZodArray<z.ZodObject<{
121
+ id: z.ZodNumber;
122
+ driver_id: z.ZodString;
123
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
124
+ remaining_drive_time_in_seconds: z.ZodNumber;
125
+ remaining_shift_time_in_seconds: z.ZodNumber;
126
+ remaining_cycle_time_in_seconds: z.ZodNumber;
127
+ remaining_break_time_in_seconds: z.ZodNumber;
128
+ location_latitude: z.ZodNumber;
129
+ location_longitude: z.ZodNumber;
130
+ previous_location_latitude: z.ZodNullable<z.ZodNumber>;
131
+ previous_location_longitude: z.ZodNullable<z.ZodNumber>;
132
+ location_address: z.ZodNullable<z.ZodString>;
133
+ location_state: z.ZodNullable<z.ZodString>;
134
+ vehicle_odometer_miles: z.ZodNullable<z.ZodNumber>;
135
+ source: z.ZodEnum<{
136
+ eld: "eld";
137
+ manual: "manual";
138
+ }>;
139
+ }, z.core.$strip>>;
140
+ }, z.core.$strip>;
141
+ type ManualBatchEntry = z.infer<typeof ManualBatchEntrySchema>;
142
+ type ManualBatchRequest = z.infer<typeof ManualBatchRequestSchema>;
143
+ type ManualBatchTelemetry = z.infer<typeof ManualBatchTelemetrySchema>;
144
+ type ManualBatchResponse = z.infer<typeof ManualBatchResponseSchema>;
145
+
146
+ declare const GomotiveAuthDataSchema: z.ZodObject<{
147
+ kind: z.ZodLiteral<"gomotive">;
148
+ token: z.ZodString;
149
+ ownerOperator: z.ZodBoolean;
150
+ }, z.core.$strip>;
151
+ type GomotiveAuthData = z.infer<typeof GomotiveAuthDataSchema>;
152
+ declare const VistaAuthDataSchema: z.ZodObject<{
153
+ kind: z.ZodLiteral<"vista">;
154
+ driverId: z.ZodString;
155
+ cookie: z.ZodString;
156
+ }, z.core.$strip>;
157
+ type VistaAuthData = z.infer<typeof VistaAuthDataSchema>;
158
+ declare const MockAuthDataSchema: z.ZodObject<{
159
+ kind: z.ZodLiteral<"mock">;
160
+ cookie: z.ZodString;
161
+ }, z.core.$strip>;
162
+ type MockAuthData = z.infer<typeof MockAuthDataSchema>;
163
+ declare const NoneAuthDataSchema: z.ZodObject<{
164
+ kind: z.ZodLiteral<"none">;
165
+ }, z.core.$strip>;
166
+ type NoneAuthData = z.infer<typeof NoneAuthDataSchema>;
167
+ declare const ProviderAuthDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
168
+ kind: z.ZodLiteral<"gomotive">;
169
+ token: z.ZodString;
170
+ ownerOperator: z.ZodBoolean;
171
+ }, z.core.$strip>, z.ZodObject<{
172
+ kind: z.ZodLiteral<"vista">;
173
+ driverId: z.ZodString;
174
+ cookie: z.ZodString;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ kind: z.ZodLiteral<"mock">;
177
+ cookie: z.ZodString;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ kind: z.ZodLiteral<"none">;
180
+ }, z.core.$strip>], "kind">;
181
+ type ProviderAuthData = z.infer<typeof ProviderAuthDataSchema>;
182
+ /**
183
+ * Serializes ProviderAuthData to a string for storage.
184
+ * Returns null for 'none' kind since there's nothing to cache.
185
+ */
186
+ declare function serializeAuthData(data: ProviderAuthData): string | null;
187
+ /**
188
+ * Deserializes an auth token string to ProviderAuthData.
189
+ * Handles legacy formats for backward compatibility:
190
+ * - Raw string -> { kind: 'gomotive', token, ownerOperator: false }
191
+ * - JSON with {driverId, cookie} but no kind -> { kind: 'vista', ... }
192
+ */
193
+ declare function deserializeAuthData(authToken: string | null): ProviderAuthData;
194
+
195
+ declare const BrowserAuthRequestSchema: z.ZodObject<{
196
+ providerStub: z.ZodString;
197
+ providerUrl: z.ZodString;
198
+ username: z.ZodString;
199
+ encryptedPassword: z.ZodString;
200
+ }, z.core.$strip>;
201
+ type BrowserAuthRequest = z.infer<typeof BrowserAuthRequestSchema>;
202
+ declare const BrowserAuthSuccessSchema: z.ZodObject<{
203
+ success: z.ZodLiteral<true>;
204
+ authData: z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ kind: z.ZodLiteral<"gomotive">;
206
+ token: z.ZodString;
207
+ ownerOperator: z.ZodBoolean;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"vista">;
210
+ driverId: z.ZodString;
211
+ cookie: z.ZodString;
212
+ }, z.core.$strip>, z.ZodObject<{
213
+ kind: z.ZodLiteral<"mock">;
214
+ cookie: z.ZodString;
215
+ }, z.core.$strip>, z.ZodObject<{
216
+ kind: z.ZodLiteral<"none">;
217
+ }, z.core.$strip>], "kind">;
218
+ }, z.core.$strip>;
219
+ declare const BrowserAuthFailureSchema: z.ZodObject<{
220
+ success: z.ZodLiteral<false>;
221
+ error: z.ZodString;
222
+ }, z.core.$strip>;
223
+ declare const BrowserAuthResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
224
+ success: z.ZodLiteral<true>;
225
+ authData: z.ZodDiscriminatedUnion<[z.ZodObject<{
226
+ kind: z.ZodLiteral<"gomotive">;
227
+ token: z.ZodString;
228
+ ownerOperator: z.ZodBoolean;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"vista">;
231
+ driverId: z.ZodString;
232
+ cookie: z.ZodString;
233
+ }, z.core.$strip>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"mock">;
235
+ cookie: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"none">;
238
+ }, z.core.$strip>], "kind">;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ success: z.ZodLiteral<false>;
241
+ error: z.ZodString;
242
+ }, z.core.$strip>], "success">;
243
+ type BrowserAuthResponse = z.infer<typeof BrowserAuthResponseSchema>;
244
+ declare const CrawlPageSchema: z.ZodObject<{
245
+ url: z.ZodString;
246
+ html: z.ZodString;
247
+ }, z.core.$strip>;
248
+ declare const BrowserCrawlSuccessSchema: z.ZodObject<{
249
+ success: z.ZodLiteral<true>;
250
+ pages: z.ZodArray<z.ZodObject<{
251
+ url: z.ZodString;
252
+ html: z.ZodString;
253
+ }, z.core.$strip>>;
254
+ }, z.core.$strip>;
255
+ declare const BrowserCrawlFailureSchema: z.ZodObject<{
256
+ success: z.ZodLiteral<false>;
257
+ error: z.ZodString;
258
+ }, z.core.$strip>;
259
+ declare const BrowserCrawlResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ success: z.ZodLiteral<true>;
261
+ pages: z.ZodArray<z.ZodObject<{
262
+ url: z.ZodString;
263
+ html: z.ZodString;
264
+ }, z.core.$strip>>;
265
+ }, z.core.$strip>, z.ZodObject<{
266
+ success: z.ZodLiteral<false>;
267
+ error: z.ZodString;
268
+ }, z.core.$strip>], "success">;
269
+ type BrowserCrawlResponse = z.infer<typeof BrowserCrawlResponseSchema>;
270
+
271
+ export { BrowserAuthFailureSchema, type BrowserAuthRequest, BrowserAuthRequestSchema, type BrowserAuthResponse, BrowserAuthResponseSchema, BrowserAuthSuccessSchema, BrowserCrawlFailureSchema, type BrowserCrawlResponse, BrowserCrawlResponseSchema, BrowserCrawlSuccessSchema, CrawlPageSchema, type DeleteProviderAccountRequest, type DeleteProviderAccountRequestData, DeleteProviderAccountRequestSchema, type DeleteProviderAccountResponse, type DeleteProviderAccountResponseData, DeleteProviderAccountResponseSchema, type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type GomotiveAuthData, GomotiveAuthDataSchema, type ManualBatchEntry, ManualBatchEntrySchema, type ManualBatchRequest, ManualBatchRequestSchema, type ManualBatchResponse, ManualBatchResponseSchema, type ManualBatchTelemetry, ManualBatchTelemetrySchema, type MockAuthData, MockAuthDataSchema, type NoneAuthData, NoneAuthDataSchema, type ProviderAuthData, ProviderAuthDataSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema, type VistaAuthData, VistaAuthDataSchema, deserializeAuthData, serializeAuthData };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,21 @@
1
1
  export { BatchConvexUpdate, BatchConvexUpdateData, BatchConvexUpdateSchema, ConvexDriverData, ConvexDriverSchema, ConvexUpdate, ConvexUpdateData, ConvexUpdateSchema, NewLoginRequest, NewLoginRequestData, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseData, NewLoginResponseFailure, NewLoginResponseFailureData, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessData, NewLoginResponseSuccessSchema, PublicProviderData, PublicUserData, ScrapeStatus, UpdateScrapeStatusMessage, ValidatePasswordRequest, ValidatePasswordRequestData, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseData, ValidatePasswordResponseSchema } from './browser.js';
2
2
  import { z } from 'zod';
3
3
 
4
+ interface DeleteProviderAccountRequestData {
5
+ providerAccountId: string;
6
+ }
7
+ interface DeleteProviderAccountResponseData {
8
+ success: boolean;
9
+ }
10
+ declare const DeleteProviderAccountRequestSchema: z.ZodObject<{
11
+ providerAccountId: z.ZodString;
12
+ }, z.core.$strip>;
13
+ declare const DeleteProviderAccountResponseSchema: z.ZodObject<{
14
+ success: z.ZodBoolean;
15
+ }, z.core.$strip>;
16
+ type DeleteProviderAccountRequest = DeleteProviderAccountRequestData;
17
+ type DeleteProviderAccountResponse = DeleteProviderAccountResponseData;
18
+
4
19
  interface DriverRankingsRequestData {
5
20
  start_date: string;
6
21
  end_date: string;
@@ -61,4 +76,196 @@ type StateHeatmapRequest = StateHeatmapRequestData;
61
76
  type StateHeatmapEntry = StateHeatmapEntryData;
62
77
  type StateHeatmapResponse = StateHeatmapResponseData;
63
78
 
64
- export { type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema };
79
+ declare const ManualBatchEntrySchema: z.ZodObject<{
80
+ driver_id: z.ZodString;
81
+ timestamp: z.ZodString;
82
+ location_latitude: z.ZodNumber;
83
+ location_longitude: z.ZodNumber;
84
+ location_address: z.ZodOptional<z.ZodString>;
85
+ vehicle_odometer_miles: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strip>;
87
+ declare const ManualBatchRequestSchema: z.ZodObject<{
88
+ entries: z.ZodArray<z.ZodObject<{
89
+ driver_id: z.ZodString;
90
+ timestamp: z.ZodString;
91
+ location_latitude: z.ZodNumber;
92
+ location_longitude: z.ZodNumber;
93
+ location_address: z.ZodOptional<z.ZodString>;
94
+ vehicle_odometer_miles: z.ZodOptional<z.ZodNumber>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>;
97
+ declare const ManualBatchTelemetrySchema: z.ZodObject<{
98
+ id: z.ZodNumber;
99
+ driver_id: z.ZodString;
100
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
101
+ remaining_drive_time_in_seconds: z.ZodNumber;
102
+ remaining_shift_time_in_seconds: z.ZodNumber;
103
+ remaining_cycle_time_in_seconds: z.ZodNumber;
104
+ remaining_break_time_in_seconds: z.ZodNumber;
105
+ location_latitude: z.ZodNumber;
106
+ location_longitude: z.ZodNumber;
107
+ previous_location_latitude: z.ZodNullable<z.ZodNumber>;
108
+ previous_location_longitude: z.ZodNullable<z.ZodNumber>;
109
+ location_address: z.ZodNullable<z.ZodString>;
110
+ location_state: z.ZodNullable<z.ZodString>;
111
+ vehicle_odometer_miles: z.ZodNullable<z.ZodNumber>;
112
+ source: z.ZodEnum<{
113
+ eld: "eld";
114
+ manual: "manual";
115
+ }>;
116
+ }, z.core.$strip>;
117
+ declare const ManualBatchResponseSchema: z.ZodObject<{
118
+ message: z.ZodString;
119
+ inserted_count: z.ZodNumber;
120
+ telemetry: z.ZodArray<z.ZodObject<{
121
+ id: z.ZodNumber;
122
+ driver_id: z.ZodString;
123
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
124
+ remaining_drive_time_in_seconds: z.ZodNumber;
125
+ remaining_shift_time_in_seconds: z.ZodNumber;
126
+ remaining_cycle_time_in_seconds: z.ZodNumber;
127
+ remaining_break_time_in_seconds: z.ZodNumber;
128
+ location_latitude: z.ZodNumber;
129
+ location_longitude: z.ZodNumber;
130
+ previous_location_latitude: z.ZodNullable<z.ZodNumber>;
131
+ previous_location_longitude: z.ZodNullable<z.ZodNumber>;
132
+ location_address: z.ZodNullable<z.ZodString>;
133
+ location_state: z.ZodNullable<z.ZodString>;
134
+ vehicle_odometer_miles: z.ZodNullable<z.ZodNumber>;
135
+ source: z.ZodEnum<{
136
+ eld: "eld";
137
+ manual: "manual";
138
+ }>;
139
+ }, z.core.$strip>>;
140
+ }, z.core.$strip>;
141
+ type ManualBatchEntry = z.infer<typeof ManualBatchEntrySchema>;
142
+ type ManualBatchRequest = z.infer<typeof ManualBatchRequestSchema>;
143
+ type ManualBatchTelemetry = z.infer<typeof ManualBatchTelemetrySchema>;
144
+ type ManualBatchResponse = z.infer<typeof ManualBatchResponseSchema>;
145
+
146
+ declare const GomotiveAuthDataSchema: z.ZodObject<{
147
+ kind: z.ZodLiteral<"gomotive">;
148
+ token: z.ZodString;
149
+ ownerOperator: z.ZodBoolean;
150
+ }, z.core.$strip>;
151
+ type GomotiveAuthData = z.infer<typeof GomotiveAuthDataSchema>;
152
+ declare const VistaAuthDataSchema: z.ZodObject<{
153
+ kind: z.ZodLiteral<"vista">;
154
+ driverId: z.ZodString;
155
+ cookie: z.ZodString;
156
+ }, z.core.$strip>;
157
+ type VistaAuthData = z.infer<typeof VistaAuthDataSchema>;
158
+ declare const MockAuthDataSchema: z.ZodObject<{
159
+ kind: z.ZodLiteral<"mock">;
160
+ cookie: z.ZodString;
161
+ }, z.core.$strip>;
162
+ type MockAuthData = z.infer<typeof MockAuthDataSchema>;
163
+ declare const NoneAuthDataSchema: z.ZodObject<{
164
+ kind: z.ZodLiteral<"none">;
165
+ }, z.core.$strip>;
166
+ type NoneAuthData = z.infer<typeof NoneAuthDataSchema>;
167
+ declare const ProviderAuthDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
168
+ kind: z.ZodLiteral<"gomotive">;
169
+ token: z.ZodString;
170
+ ownerOperator: z.ZodBoolean;
171
+ }, z.core.$strip>, z.ZodObject<{
172
+ kind: z.ZodLiteral<"vista">;
173
+ driverId: z.ZodString;
174
+ cookie: z.ZodString;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ kind: z.ZodLiteral<"mock">;
177
+ cookie: z.ZodString;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ kind: z.ZodLiteral<"none">;
180
+ }, z.core.$strip>], "kind">;
181
+ type ProviderAuthData = z.infer<typeof ProviderAuthDataSchema>;
182
+ /**
183
+ * Serializes ProviderAuthData to a string for storage.
184
+ * Returns null for 'none' kind since there's nothing to cache.
185
+ */
186
+ declare function serializeAuthData(data: ProviderAuthData): string | null;
187
+ /**
188
+ * Deserializes an auth token string to ProviderAuthData.
189
+ * Handles legacy formats for backward compatibility:
190
+ * - Raw string -> { kind: 'gomotive', token, ownerOperator: false }
191
+ * - JSON with {driverId, cookie} but no kind -> { kind: 'vista', ... }
192
+ */
193
+ declare function deserializeAuthData(authToken: string | null): ProviderAuthData;
194
+
195
+ declare const BrowserAuthRequestSchema: z.ZodObject<{
196
+ providerStub: z.ZodString;
197
+ providerUrl: z.ZodString;
198
+ username: z.ZodString;
199
+ encryptedPassword: z.ZodString;
200
+ }, z.core.$strip>;
201
+ type BrowserAuthRequest = z.infer<typeof BrowserAuthRequestSchema>;
202
+ declare const BrowserAuthSuccessSchema: z.ZodObject<{
203
+ success: z.ZodLiteral<true>;
204
+ authData: z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ kind: z.ZodLiteral<"gomotive">;
206
+ token: z.ZodString;
207
+ ownerOperator: z.ZodBoolean;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"vista">;
210
+ driverId: z.ZodString;
211
+ cookie: z.ZodString;
212
+ }, z.core.$strip>, z.ZodObject<{
213
+ kind: z.ZodLiteral<"mock">;
214
+ cookie: z.ZodString;
215
+ }, z.core.$strip>, z.ZodObject<{
216
+ kind: z.ZodLiteral<"none">;
217
+ }, z.core.$strip>], "kind">;
218
+ }, z.core.$strip>;
219
+ declare const BrowserAuthFailureSchema: z.ZodObject<{
220
+ success: z.ZodLiteral<false>;
221
+ error: z.ZodString;
222
+ }, z.core.$strip>;
223
+ declare const BrowserAuthResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
224
+ success: z.ZodLiteral<true>;
225
+ authData: z.ZodDiscriminatedUnion<[z.ZodObject<{
226
+ kind: z.ZodLiteral<"gomotive">;
227
+ token: z.ZodString;
228
+ ownerOperator: z.ZodBoolean;
229
+ }, z.core.$strip>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"vista">;
231
+ driverId: z.ZodString;
232
+ cookie: z.ZodString;
233
+ }, z.core.$strip>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"mock">;
235
+ cookie: z.ZodString;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ kind: z.ZodLiteral<"none">;
238
+ }, z.core.$strip>], "kind">;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ success: z.ZodLiteral<false>;
241
+ error: z.ZodString;
242
+ }, z.core.$strip>], "success">;
243
+ type BrowserAuthResponse = z.infer<typeof BrowserAuthResponseSchema>;
244
+ declare const CrawlPageSchema: z.ZodObject<{
245
+ url: z.ZodString;
246
+ html: z.ZodString;
247
+ }, z.core.$strip>;
248
+ declare const BrowserCrawlSuccessSchema: z.ZodObject<{
249
+ success: z.ZodLiteral<true>;
250
+ pages: z.ZodArray<z.ZodObject<{
251
+ url: z.ZodString;
252
+ html: z.ZodString;
253
+ }, z.core.$strip>>;
254
+ }, z.core.$strip>;
255
+ declare const BrowserCrawlFailureSchema: z.ZodObject<{
256
+ success: z.ZodLiteral<false>;
257
+ error: z.ZodString;
258
+ }, z.core.$strip>;
259
+ declare const BrowserCrawlResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ success: z.ZodLiteral<true>;
261
+ pages: z.ZodArray<z.ZodObject<{
262
+ url: z.ZodString;
263
+ html: z.ZodString;
264
+ }, z.core.$strip>>;
265
+ }, z.core.$strip>, z.ZodObject<{
266
+ success: z.ZodLiteral<false>;
267
+ error: z.ZodString;
268
+ }, z.core.$strip>], "success">;
269
+ type BrowserCrawlResponse = z.infer<typeof BrowserCrawlResponseSchema>;
270
+
271
+ export { BrowserAuthFailureSchema, type BrowserAuthRequest, BrowserAuthRequestSchema, type BrowserAuthResponse, BrowserAuthResponseSchema, BrowserAuthSuccessSchema, BrowserCrawlFailureSchema, type BrowserCrawlResponse, BrowserCrawlResponseSchema, BrowserCrawlSuccessSchema, CrawlPageSchema, type DeleteProviderAccountRequest, type DeleteProviderAccountRequestData, DeleteProviderAccountRequestSchema, type DeleteProviderAccountResponse, type DeleteProviderAccountResponseData, DeleteProviderAccountResponseSchema, type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type GomotiveAuthData, GomotiveAuthDataSchema, type ManualBatchEntry, ManualBatchEntrySchema, type ManualBatchRequest, ManualBatchRequestSchema, type ManualBatchResponse, ManualBatchResponseSchema, type ManualBatchTelemetry, ManualBatchTelemetrySchema, type MockAuthData, MockAuthDataSchema, type NoneAuthData, NoneAuthDataSchema, type ProviderAuthData, ProviderAuthDataSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema, type VistaAuthData, VistaAuthDataSchema, deserializeAuthData, serializeAuthData };
package/dist/index.js CHANGED
@@ -18,45 +18,205 @@ import {
18
18
  ValidatePasswordResponseSchema
19
19
  } from "./chunk-UWBIQBUR.js";
20
20
 
21
- // src/schemas/telemetry/driver-rankings.ts
21
+ // src/schemas/providerAccounts/delete-provider-account.ts
22
22
  import { z } from "zod";
23
- var DriverRankingsRequestSchema = z.object({
24
- start_date: z.string().describe("Start date for the ranking period (ISO 8601 format)"),
25
- end_date: z.string().describe("End date for the ranking period (ISO 8601 format)"),
26
- state: z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
23
+ var DeleteProviderAccountRequestSchema = z.object({
24
+ providerAccountId: z.string().min(1).describe("The external provider account ID to delete")
25
+ }).describe("Request schema for deleting a provider account");
26
+ var DeleteProviderAccountResponseSchema = z.object({
27
+ success: z.boolean().describe("Indicates if the provider account was successfully deleted")
28
+ }).describe("Response schema for provider account deletion");
29
+
30
+ // src/schemas/telemetry/driver-rankings.ts
31
+ import { z as z2 } from "zod";
32
+ var DriverRankingsRequestSchema = z2.object({
33
+ start_date: z2.string().describe("Start date for the ranking period (ISO 8601 format)"),
34
+ end_date: z2.string().describe("End date for the ranking period (ISO 8601 format)"),
35
+ state: z2.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
27
36
  }).describe("Request schema for driver rankings by miles driven");
28
- var DriverRankingSchema = z.object({
29
- rank: z.number().int().positive().describe("Rank position based on miles driven"),
30
- driver_id: z.string().uuid().describe("Unique identifier of the driver"),
31
- driver_name: z.string().describe("Name of the driver"),
32
- total_miles: z.number().min(0).describe("Total miles driven in the specified period")
37
+ var DriverRankingSchema = z2.object({
38
+ rank: z2.number().int().positive().describe("Rank position based on miles driven"),
39
+ driver_id: z2.string().uuid().describe("Unique identifier of the driver"),
40
+ driver_name: z2.string().describe("Name of the driver"),
41
+ total_miles: z2.number().min(0).describe("Total miles driven in the specified period")
33
42
  }).describe("Single driver ranking entry");
34
- var DriverRankingsResponseSchema = z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
43
+ var DriverRankingsResponseSchema = z2.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
35
44
 
36
45
  // src/schemas/telemetry/state-heatmap.ts
37
- import { z as z2 } from "zod";
38
- var StateHeatmapRequestSchema = z2.object({
39
- driver_id: z2.string().uuid().describe("Unique identifier of the driver"),
40
- start_date: z2.string().describe("Start date for the heatmap period (ISO 8601 format)"),
41
- end_date: z2.string().describe("End date for the heatmap period (ISO 8601 format)")
46
+ import { z as z3 } from "zod";
47
+ var StateHeatmapRequestSchema = z3.object({
48
+ driver_id: z3.string().uuid().describe("Unique identifier of the driver"),
49
+ start_date: z3.string().describe("Start date for the heatmap period (ISO 8601 format)"),
50
+ end_date: z3.string().describe("End date for the heatmap period (ISO 8601 format)")
42
51
  }).describe("Request schema for driver state heatmap");
43
- var StateHeatmapEntrySchema = z2.object({
44
- count: z2.number().int().min(0).describe("Number of telemetry points in this state"),
45
- percentage: z2.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
52
+ var StateHeatmapEntrySchema = z3.object({
53
+ count: z3.number().int().min(0).describe("Number of telemetry points in this state"),
54
+ percentage: z3.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
46
55
  }).describe("Single state entry in the heatmap");
47
- var StateHeatmapResponseSchema = z2.record(
48
- z2.string().length(2),
56
+ var StateHeatmapResponseSchema = z3.record(
57
+ z3.string().length(2),
49
58
  StateHeatmapEntrySchema
50
59
  ).describe("Record of 2-letter state codes to heatmap entries");
60
+
61
+ // src/schemas/telemetry/manual-batch.ts
62
+ import { z as z4 } from "zod";
63
+ var ManualBatchEntrySchema = z4.object({
64
+ driver_id: z4.string().uuid().describe("Internal UUID of the driver"),
65
+ timestamp: z4.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
66
+ location_latitude: z4.number().min(-90).max(90).describe("GPS latitude coordinate"),
67
+ location_longitude: z4.number().min(-180).max(180).describe("GPS longitude coordinate"),
68
+ location_address: z4.string().optional().describe("Optional human-readable address"),
69
+ vehicle_odometer_miles: z4.number().min(0).optional().describe("Optional vehicle odometer reading in miles")
70
+ }).describe("Single manual telemetry entry");
71
+ var ManualBatchRequestSchema = z4.object({
72
+ entries: z4.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
73
+ }).describe("Request schema for manual batch telemetry insertion");
74
+ var ManualBatchTelemetrySchema = z4.object({
75
+ id: z4.number().int().describe("Telemetry record ID"),
76
+ driver_id: z4.string().uuid().describe("Internal UUID of the driver"),
77
+ timestamp: z4.union([z4.string(), z4.date()]).describe("Timestamp of the telemetry reading"),
78
+ remaining_drive_time_in_seconds: z4.number().min(0),
79
+ remaining_shift_time_in_seconds: z4.number().min(0),
80
+ remaining_cycle_time_in_seconds: z4.number().min(0),
81
+ remaining_break_time_in_seconds: z4.number().min(0),
82
+ location_latitude: z4.number().min(-90).max(90),
83
+ location_longitude: z4.number().min(-180).max(180),
84
+ previous_location_latitude: z4.number().min(-90).max(90).nullable(),
85
+ previous_location_longitude: z4.number().min(-180).max(180).nullable(),
86
+ location_address: z4.string().nullable(),
87
+ location_state: z4.string().length(2).nullable(),
88
+ vehicle_odometer_miles: z4.number().min(0).nullable(),
89
+ source: z4.enum(["eld", "manual"])
90
+ }).describe("Telemetry record returned from manual batch insertion");
91
+ var ManualBatchResponseSchema = z4.object({
92
+ message: z4.string().describe("Success message"),
93
+ inserted_count: z4.number().int().min(0).describe("Number of telemetry entries inserted"),
94
+ telemetry: z4.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
95
+ }).describe("Response schema for manual batch telemetry insertion");
96
+
97
+ // src/auth-data.ts
98
+ import { z as z5 } from "zod";
99
+ var GomotiveAuthDataSchema = z5.object({
100
+ kind: z5.literal("gomotive"),
101
+ token: z5.string(),
102
+ ownerOperator: z5.boolean()
103
+ });
104
+ var VistaAuthDataSchema = z5.object({
105
+ kind: z5.literal("vista"),
106
+ driverId: z5.string(),
107
+ cookie: z5.string()
108
+ });
109
+ var MockAuthDataSchema = z5.object({
110
+ kind: z5.literal("mock"),
111
+ cookie: z5.string()
112
+ });
113
+ var NoneAuthDataSchema = z5.object({
114
+ kind: z5.literal("none")
115
+ });
116
+ var ProviderAuthDataSchema = z5.discriminatedUnion("kind", [
117
+ GomotiveAuthDataSchema,
118
+ VistaAuthDataSchema,
119
+ MockAuthDataSchema,
120
+ NoneAuthDataSchema
121
+ ]);
122
+ var LegacyVistaAuthSchema = z5.object({
123
+ driverId: z5.string(),
124
+ cookie: z5.string()
125
+ });
126
+ function serializeAuthData(data) {
127
+ if (data.kind === "none") {
128
+ return null;
129
+ }
130
+ return JSON.stringify(data);
131
+ }
132
+ function deserializeAuthData(authToken) {
133
+ if (!authToken) {
134
+ return { kind: "none" };
135
+ }
136
+ try {
137
+ const parsed = JSON.parse(authToken);
138
+ const newFormatResult = ProviderAuthDataSchema.safeParse(parsed);
139
+ if (newFormatResult.success) {
140
+ return newFormatResult.data;
141
+ }
142
+ const legacyVistaResult = LegacyVistaAuthSchema.safeParse(parsed);
143
+ if (legacyVistaResult.success) {
144
+ return {
145
+ kind: "vista",
146
+ driverId: legacyVistaResult.data.driverId,
147
+ cookie: legacyVistaResult.data.cookie
148
+ };
149
+ }
150
+ } catch {
151
+ }
152
+ return {
153
+ kind: "gomotive",
154
+ token: authToken,
155
+ ownerOperator: false
156
+ };
157
+ }
158
+
159
+ // src/browser-auth.ts
160
+ import { z as z6 } from "zod";
161
+ var BrowserAuthRequestSchema = z6.object({
162
+ providerStub: z6.string(),
163
+ providerUrl: z6.string(),
164
+ username: z6.string(),
165
+ encryptedPassword: z6.string()
166
+ });
167
+ var BrowserAuthSuccessSchema = z6.object({
168
+ success: z6.literal(true),
169
+ authData: ProviderAuthDataSchema
170
+ });
171
+ var BrowserAuthFailureSchema = z6.object({
172
+ success: z6.literal(false),
173
+ error: z6.string()
174
+ });
175
+ var BrowserAuthResponseSchema = z6.discriminatedUnion("success", [
176
+ BrowserAuthSuccessSchema,
177
+ BrowserAuthFailureSchema
178
+ ]);
179
+ var CrawlPageSchema = z6.object({
180
+ url: z6.string(),
181
+ html: z6.string()
182
+ });
183
+ var BrowserCrawlSuccessSchema = z6.object({
184
+ success: z6.literal(true),
185
+ pages: z6.array(CrawlPageSchema)
186
+ });
187
+ var BrowserCrawlFailureSchema = z6.object({
188
+ success: z6.literal(false),
189
+ error: z6.string()
190
+ });
191
+ var BrowserCrawlResponseSchema = z6.discriminatedUnion("success", [
192
+ BrowserCrawlSuccessSchema,
193
+ BrowserCrawlFailureSchema
194
+ ]);
51
195
  export {
52
196
  BatchConvexUpdate,
53
197
  BatchConvexUpdateSchema,
198
+ BrowserAuthFailureSchema,
199
+ BrowserAuthRequestSchema,
200
+ BrowserAuthResponseSchema,
201
+ BrowserAuthSuccessSchema,
202
+ BrowserCrawlFailureSchema,
203
+ BrowserCrawlResponseSchema,
204
+ BrowserCrawlSuccessSchema,
54
205
  ConvexDriverSchema,
55
206
  ConvexUpdate,
56
207
  ConvexUpdateSchema,
208
+ CrawlPageSchema,
209
+ DeleteProviderAccountRequestSchema,
210
+ DeleteProviderAccountResponseSchema,
57
211
  DriverRankingSchema,
58
212
  DriverRankingsRequestSchema,
59
213
  DriverRankingsResponseSchema,
214
+ GomotiveAuthDataSchema,
215
+ ManualBatchEntrySchema,
216
+ ManualBatchRequestSchema,
217
+ ManualBatchResponseSchema,
218
+ ManualBatchTelemetrySchema,
219
+ MockAuthDataSchema,
60
220
  NewLoginRequest,
61
221
  NewLoginRequestSchema,
62
222
  NewLoginResponse,
@@ -65,11 +225,16 @@ export {
65
225
  NewLoginResponseSchema,
66
226
  NewLoginResponseSuccess,
67
227
  NewLoginResponseSuccessSchema,
228
+ NoneAuthDataSchema,
229
+ ProviderAuthDataSchema,
68
230
  ScrapeStatus,
69
231
  StateHeatmapEntrySchema,
70
232
  StateHeatmapRequestSchema,
71
233
  StateHeatmapResponseSchema,
72
234
  UpdateScrapeStatusMessage,
73
235
  ValidatePasswordRequestSchema,
74
- ValidatePasswordResponseSchema
236
+ ValidatePasswordResponseSchema,
237
+ VistaAuthDataSchema,
238
+ deserializeAuthData,
239
+ serializeAuthData
75
240
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/shared-schemas",
3
- "version": "2.10.1",
3
+ "version": "2.12.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",