@findatruck/shared-schemas 2.11.0 → 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 +175 -2
- package/dist/index.d.cts +193 -1
- package/dist/index.d.ts +193 -1
- package/dist/index.js +155 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,14 +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,
|
|
38
46
|
DeleteProviderAccountRequestSchema: () => DeleteProviderAccountRequestSchema,
|
|
39
47
|
DeleteProviderAccountResponseSchema: () => DeleteProviderAccountResponseSchema,
|
|
40
48
|
DriverRankingSchema: () => DriverRankingSchema,
|
|
41
49
|
DriverRankingsRequestSchema: () => DriverRankingsRequestSchema,
|
|
42
50
|
DriverRankingsResponseSchema: () => DriverRankingsResponseSchema,
|
|
51
|
+
GomotiveAuthDataSchema: () => GomotiveAuthDataSchema,
|
|
52
|
+
ManualBatchEntrySchema: () => ManualBatchEntrySchema,
|
|
53
|
+
ManualBatchRequestSchema: () => ManualBatchRequestSchema,
|
|
54
|
+
ManualBatchResponseSchema: () => ManualBatchResponseSchema,
|
|
55
|
+
ManualBatchTelemetrySchema: () => ManualBatchTelemetrySchema,
|
|
56
|
+
MockAuthDataSchema: () => MockAuthDataSchema,
|
|
43
57
|
NewLoginRequest: () => NewLoginRequest,
|
|
44
58
|
NewLoginRequestSchema: () => NewLoginRequestSchema,
|
|
45
59
|
NewLoginResponse: () => NewLoginResponse,
|
|
@@ -48,13 +62,18 @@ __export(index_exports, {
|
|
|
48
62
|
NewLoginResponseSchema: () => NewLoginResponseSchema,
|
|
49
63
|
NewLoginResponseSuccess: () => NewLoginResponseSuccess,
|
|
50
64
|
NewLoginResponseSuccessSchema: () => NewLoginResponseSuccessSchema,
|
|
65
|
+
NoneAuthDataSchema: () => NoneAuthDataSchema,
|
|
66
|
+
ProviderAuthDataSchema: () => ProviderAuthDataSchema,
|
|
51
67
|
ScrapeStatus: () => ScrapeStatus,
|
|
52
68
|
StateHeatmapEntrySchema: () => StateHeatmapEntrySchema,
|
|
53
69
|
StateHeatmapRequestSchema: () => StateHeatmapRequestSchema,
|
|
54
70
|
StateHeatmapResponseSchema: () => StateHeatmapResponseSchema,
|
|
55
71
|
UpdateScrapeStatusMessage: () => UpdateScrapeStatusMessage,
|
|
56
72
|
ValidatePasswordRequestSchema: () => ValidatePasswordRequestSchema,
|
|
57
|
-
ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema
|
|
73
|
+
ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema,
|
|
74
|
+
VistaAuthDataSchema: () => VistaAuthDataSchema,
|
|
75
|
+
deserializeAuthData: () => deserializeAuthData,
|
|
76
|
+
serializeAuthData: () => serializeAuthData
|
|
58
77
|
});
|
|
59
78
|
module.exports = __toCommonJS(index_exports);
|
|
60
79
|
|
|
@@ -226,18 +245,167 @@ var StateHeatmapResponseSchema = import_zod7.z.record(
|
|
|
226
245
|
import_zod7.z.string().length(2),
|
|
227
246
|
StateHeatmapEntrySchema
|
|
228
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
|
+
]);
|
|
229
383
|
// Annotate the CommonJS export names for ESM import in node:
|
|
230
384
|
0 && (module.exports = {
|
|
231
385
|
BatchConvexUpdate,
|
|
232
386
|
BatchConvexUpdateSchema,
|
|
387
|
+
BrowserAuthFailureSchema,
|
|
388
|
+
BrowserAuthRequestSchema,
|
|
389
|
+
BrowserAuthResponseSchema,
|
|
390
|
+
BrowserAuthSuccessSchema,
|
|
391
|
+
BrowserCrawlFailureSchema,
|
|
392
|
+
BrowserCrawlResponseSchema,
|
|
393
|
+
BrowserCrawlSuccessSchema,
|
|
233
394
|
ConvexDriverSchema,
|
|
234
395
|
ConvexUpdate,
|
|
235
396
|
ConvexUpdateSchema,
|
|
397
|
+
CrawlPageSchema,
|
|
236
398
|
DeleteProviderAccountRequestSchema,
|
|
237
399
|
DeleteProviderAccountResponseSchema,
|
|
238
400
|
DriverRankingSchema,
|
|
239
401
|
DriverRankingsRequestSchema,
|
|
240
402
|
DriverRankingsResponseSchema,
|
|
403
|
+
GomotiveAuthDataSchema,
|
|
404
|
+
ManualBatchEntrySchema,
|
|
405
|
+
ManualBatchRequestSchema,
|
|
406
|
+
ManualBatchResponseSchema,
|
|
407
|
+
ManualBatchTelemetrySchema,
|
|
408
|
+
MockAuthDataSchema,
|
|
241
409
|
NewLoginRequest,
|
|
242
410
|
NewLoginRequestSchema,
|
|
243
411
|
NewLoginResponse,
|
|
@@ -246,11 +414,16 @@ var StateHeatmapResponseSchema = import_zod7.z.record(
|
|
|
246
414
|
NewLoginResponseSchema,
|
|
247
415
|
NewLoginResponseSuccess,
|
|
248
416
|
NewLoginResponseSuccessSchema,
|
|
417
|
+
NoneAuthDataSchema,
|
|
418
|
+
ProviderAuthDataSchema,
|
|
249
419
|
ScrapeStatus,
|
|
250
420
|
StateHeatmapEntrySchema,
|
|
251
421
|
StateHeatmapRequestSchema,
|
|
252
422
|
StateHeatmapResponseSchema,
|
|
253
423
|
UpdateScrapeStatusMessage,
|
|
254
424
|
ValidatePasswordRequestSchema,
|
|
255
|
-
ValidatePasswordResponseSchema
|
|
425
|
+
ValidatePasswordResponseSchema,
|
|
426
|
+
VistaAuthDataSchema,
|
|
427
|
+
deserializeAuthData,
|
|
428
|
+
serializeAuthData
|
|
256
429
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -76,4 +76,196 @@ type StateHeatmapRequest = StateHeatmapRequestData;
|
|
|
76
76
|
type StateHeatmapEntry = StateHeatmapEntryData;
|
|
77
77
|
type StateHeatmapResponse = StateHeatmapResponseData;
|
|
78
78
|
|
|
79
|
-
|
|
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
|
@@ -76,4 +76,196 @@ type StateHeatmapRequest = StateHeatmapRequestData;
|
|
|
76
76
|
type StateHeatmapEntry = StateHeatmapEntryData;
|
|
77
77
|
type StateHeatmapResponse = StateHeatmapResponseData;
|
|
78
78
|
|
|
79
|
-
|
|
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
|
@@ -57,17 +57,166 @@ var StateHeatmapResponseSchema = z3.record(
|
|
|
57
57
|
z3.string().length(2),
|
|
58
58
|
StateHeatmapEntrySchema
|
|
59
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
|
+
]);
|
|
60
195
|
export {
|
|
61
196
|
BatchConvexUpdate,
|
|
62
197
|
BatchConvexUpdateSchema,
|
|
198
|
+
BrowserAuthFailureSchema,
|
|
199
|
+
BrowserAuthRequestSchema,
|
|
200
|
+
BrowserAuthResponseSchema,
|
|
201
|
+
BrowserAuthSuccessSchema,
|
|
202
|
+
BrowserCrawlFailureSchema,
|
|
203
|
+
BrowserCrawlResponseSchema,
|
|
204
|
+
BrowserCrawlSuccessSchema,
|
|
63
205
|
ConvexDriverSchema,
|
|
64
206
|
ConvexUpdate,
|
|
65
207
|
ConvexUpdateSchema,
|
|
208
|
+
CrawlPageSchema,
|
|
66
209
|
DeleteProviderAccountRequestSchema,
|
|
67
210
|
DeleteProviderAccountResponseSchema,
|
|
68
211
|
DriverRankingSchema,
|
|
69
212
|
DriverRankingsRequestSchema,
|
|
70
213
|
DriverRankingsResponseSchema,
|
|
214
|
+
GomotiveAuthDataSchema,
|
|
215
|
+
ManualBatchEntrySchema,
|
|
216
|
+
ManualBatchRequestSchema,
|
|
217
|
+
ManualBatchResponseSchema,
|
|
218
|
+
ManualBatchTelemetrySchema,
|
|
219
|
+
MockAuthDataSchema,
|
|
71
220
|
NewLoginRequest,
|
|
72
221
|
NewLoginRequestSchema,
|
|
73
222
|
NewLoginResponse,
|
|
@@ -76,11 +225,16 @@ export {
|
|
|
76
225
|
NewLoginResponseSchema,
|
|
77
226
|
NewLoginResponseSuccess,
|
|
78
227
|
NewLoginResponseSuccessSchema,
|
|
228
|
+
NoneAuthDataSchema,
|
|
229
|
+
ProviderAuthDataSchema,
|
|
79
230
|
ScrapeStatus,
|
|
80
231
|
StateHeatmapEntrySchema,
|
|
81
232
|
StateHeatmapRequestSchema,
|
|
82
233
|
StateHeatmapResponseSchema,
|
|
83
234
|
UpdateScrapeStatusMessage,
|
|
84
235
|
ValidatePasswordRequestSchema,
|
|
85
|
-
ValidatePasswordResponseSchema
|
|
236
|
+
ValidatePasswordResponseSchema,
|
|
237
|
+
VistaAuthDataSchema,
|
|
238
|
+
deserializeAuthData,
|
|
239
|
+
serializeAuthData
|
|
86
240
|
};
|