@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 +141 -113
- package/dist/index.d.cts +251 -209
- package/dist/index.d.ts +251 -209
- package/dist/index.js +121 -97
- package/package.json +1 -1
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/
|
|
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 =
|
|
190
|
-
status:
|
|
191
|
-
correctPassword:
|
|
192
|
-
externalProviderAccountId:
|
|
193
|
-
username:
|
|
194
|
-
provider_url:
|
|
195
|
-
driverCount:
|
|
196
|
-
providerSlug:
|
|
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
|
|
201
|
-
var ValidatePasswordRequestSchema =
|
|
202
|
-
providerAccountId:
|
|
203
|
-
encryptedPassword:
|
|
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 =
|
|
206
|
-
isValid:
|
|
207
|
-
driverIds:
|
|
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
|
|
212
|
-
var DeleteProviderAccountRequestSchema =
|
|
213
|
-
providerAccountId:
|
|
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 =
|
|
216
|
-
success:
|
|
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
|
|
221
|
-
var DriverRankingsRequestSchema =
|
|
222
|
-
start_date:
|
|
223
|
-
end_date:
|
|
224
|
-
state:
|
|
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 =
|
|
227
|
-
rank:
|
|
228
|
-
driver_id:
|
|
229
|
-
driver_name:
|
|
230
|
-
total_miles:
|
|
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 =
|
|
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
|
|
236
|
-
var StateHeatmapRequestSchema =
|
|
237
|
-
driver_id:
|
|
238
|
-
start_date:
|
|
239
|
-
end_date:
|
|
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 =
|
|
242
|
-
count:
|
|
243
|
-
percentage:
|
|
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 =
|
|
246
|
-
|
|
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
|
|
252
|
-
var ManualBatchEntrySchema =
|
|
253
|
-
driver_id:
|
|
254
|
-
timestamp:
|
|
255
|
-
location_latitude:
|
|
256
|
-
location_longitude:
|
|
257
|
-
location_address:
|
|
258
|
-
vehicle_odometer_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 =
|
|
261
|
-
entries:
|
|
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 =
|
|
264
|
-
id:
|
|
265
|
-
driver_id:
|
|
266
|
-
timestamp:
|
|
267
|
-
remaining_drive_time_in_seconds:
|
|
268
|
-
remaining_shift_time_in_seconds:
|
|
269
|
-
remaining_cycle_time_in_seconds:
|
|
270
|
-
remaining_break_time_in_seconds:
|
|
271
|
-
location_latitude:
|
|
272
|
-
location_longitude:
|
|
273
|
-
previous_location_latitude:
|
|
274
|
-
previous_location_longitude:
|
|
275
|
-
location_address:
|
|
276
|
-
location_state:
|
|
277
|
-
vehicle_odometer_miles:
|
|
278
|
-
source:
|
|
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 =
|
|
281
|
-
message:
|
|
282
|
-
inserted_count:
|
|
283
|
-
telemetry:
|
|
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
|
|
288
|
-
var GomotiveAuthDataSchema =
|
|
289
|
-
kind:
|
|
290
|
-
token:
|
|
291
|
-
ownerOperator:
|
|
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 =
|
|
294
|
-
kind:
|
|
295
|
-
driverId:
|
|
296
|
-
cookie:
|
|
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 =
|
|
299
|
-
kind:
|
|
300
|
-
cookie:
|
|
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 =
|
|
303
|
-
kind:
|
|
318
|
+
var NoneAuthDataSchema = import_zod10.z.object({
|
|
319
|
+
kind: import_zod10.z.literal("none")
|
|
304
320
|
});
|
|
305
|
-
var ProviderAuthDataSchema =
|
|
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 =
|
|
312
|
-
driverId:
|
|
313
|
-
cookie:
|
|
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
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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 =
|
|
357
|
-
success:
|
|
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 =
|
|
361
|
-
success:
|
|
362
|
-
error:
|
|
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 =
|
|
388
|
+
var BrowserAuthResponseSchema = import_zod11.z.discriminatedUnion("success", [
|
|
365
389
|
BrowserAuthSuccessSchema,
|
|
366
390
|
BrowserAuthFailureSchema
|
|
367
391
|
]);
|
|
368
|
-
var CrawlPageSchema =
|
|
369
|
-
url:
|
|
370
|
-
html:
|
|
392
|
+
var CrawlPageSchema = import_zod11.z.object({
|
|
393
|
+
url: import_zod11.z.string(),
|
|
394
|
+
html: import_zod11.z.string()
|
|
371
395
|
});
|
|
372
|
-
var BrowserCrawlSuccessSchema =
|
|
373
|
-
success:
|
|
374
|
-
pages:
|
|
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 =
|
|
377
|
-
success:
|
|
378
|
-
error:
|
|
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 =
|
|
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,
|