@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.js
CHANGED
|
@@ -18,110 +18,122 @@ import {
|
|
|
18
18
|
ValidatePasswordResponseSchema
|
|
19
19
|
} from "./chunk-S53TIE72.js";
|
|
20
20
|
|
|
21
|
+
// src/schemas/drivers/anonymous-driver.ts
|
|
22
|
+
import z from "zod";
|
|
23
|
+
var CreateAnonymousDriverBodySchema = z.object({
|
|
24
|
+
convex_user_id: z.string().min(1)
|
|
25
|
+
});
|
|
26
|
+
var AnonymousDriverResponseSchema = z.object({
|
|
27
|
+
driver_id: z.string()
|
|
28
|
+
});
|
|
29
|
+
var AnonymousDriverErrorResponseSchema = z.object({
|
|
30
|
+
error: z.string()
|
|
31
|
+
});
|
|
32
|
+
|
|
21
33
|
// src/schemas/providerAccounts/delete-provider-account.ts
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
var DeleteProviderAccountRequestSchema =
|
|
24
|
-
providerAccountId:
|
|
34
|
+
import { z as z2 } from "zod";
|
|
35
|
+
var DeleteProviderAccountRequestSchema = z2.object({
|
|
36
|
+
providerAccountId: z2.string().min(1).describe("The external provider account ID to delete")
|
|
25
37
|
}).describe("Request schema for deleting a provider account");
|
|
26
|
-
var DeleteProviderAccountResponseSchema =
|
|
27
|
-
success:
|
|
38
|
+
var DeleteProviderAccountResponseSchema = z2.object({
|
|
39
|
+
success: z2.boolean().describe("Indicates if the provider account was successfully deleted")
|
|
28
40
|
}).describe("Response schema for provider account deletion");
|
|
29
41
|
|
|
30
42
|
// src/schemas/telemetry/driver-rankings.ts
|
|
31
|
-
import { z as
|
|
32
|
-
var DriverRankingsRequestSchema =
|
|
33
|
-
start_date:
|
|
34
|
-
end_date:
|
|
35
|
-
state:
|
|
43
|
+
import { z as z3 } from "zod";
|
|
44
|
+
var DriverRankingsRequestSchema = z3.object({
|
|
45
|
+
start_date: z3.string().describe("Start date for the ranking period (ISO 8601 format)"),
|
|
46
|
+
end_date: z3.string().describe("End date for the ranking period (ISO 8601 format)"),
|
|
47
|
+
state: z3.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
|
|
36
48
|
}).describe("Request schema for driver rankings by miles driven");
|
|
37
|
-
var DriverRankingSchema =
|
|
38
|
-
rank:
|
|
39
|
-
driver_id:
|
|
40
|
-
driver_name:
|
|
41
|
-
total_miles:
|
|
49
|
+
var DriverRankingSchema = z3.object({
|
|
50
|
+
rank: z3.number().int().positive().describe("Rank position based on miles driven"),
|
|
51
|
+
driver_id: z3.string().uuid().describe("Unique identifier of the driver"),
|
|
52
|
+
driver_name: z3.string().describe("Name of the driver"),
|
|
53
|
+
total_miles: z3.number().min(0).describe("Total miles driven in the specified period")
|
|
42
54
|
}).describe("Single driver ranking entry");
|
|
43
|
-
var DriverRankingsResponseSchema =
|
|
55
|
+
var DriverRankingsResponseSchema = z3.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
|
|
44
56
|
|
|
45
57
|
// src/schemas/telemetry/state-heatmap.ts
|
|
46
|
-
import { z as
|
|
47
|
-
var StateHeatmapRequestSchema =
|
|
48
|
-
driver_id:
|
|
49
|
-
start_date:
|
|
50
|
-
end_date:
|
|
58
|
+
import { z as z4 } from "zod";
|
|
59
|
+
var StateHeatmapRequestSchema = z4.object({
|
|
60
|
+
driver_id: z4.string().uuid().describe("Unique identifier of the driver"),
|
|
61
|
+
start_date: z4.string().describe("Start date for the heatmap period (ISO 8601 format)"),
|
|
62
|
+
end_date: z4.string().describe("End date for the heatmap period (ISO 8601 format)")
|
|
51
63
|
}).describe("Request schema for driver state heatmap");
|
|
52
|
-
var StateHeatmapEntrySchema =
|
|
53
|
-
count:
|
|
54
|
-
percentage:
|
|
64
|
+
var StateHeatmapEntrySchema = z4.object({
|
|
65
|
+
count: z4.number().int().min(0).describe("Number of telemetry points in this state"),
|
|
66
|
+
percentage: z4.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
|
|
55
67
|
}).describe("Single state entry in the heatmap");
|
|
56
|
-
var StateHeatmapResponseSchema =
|
|
57
|
-
|
|
68
|
+
var StateHeatmapResponseSchema = z4.record(
|
|
69
|
+
z4.string().length(2),
|
|
58
70
|
StateHeatmapEntrySchema
|
|
59
71
|
).describe("Record of 2-letter state codes to heatmap entries");
|
|
60
72
|
|
|
61
73
|
// src/schemas/telemetry/manual-batch.ts
|
|
62
|
-
import { z as
|
|
63
|
-
var ManualBatchEntrySchema =
|
|
64
|
-
driver_id:
|
|
65
|
-
timestamp:
|
|
66
|
-
location_latitude:
|
|
67
|
-
location_longitude:
|
|
68
|
-
location_address:
|
|
69
|
-
vehicle_odometer_miles:
|
|
74
|
+
import { z as z5 } from "zod";
|
|
75
|
+
var ManualBatchEntrySchema = z5.object({
|
|
76
|
+
driver_id: z5.string().uuid().describe("Internal UUID of the driver"),
|
|
77
|
+
timestamp: z5.string().datetime().describe("Timestamp of the GPS reading (ISO 8601 format)"),
|
|
78
|
+
location_latitude: z5.number().min(-90).max(90).describe("GPS latitude coordinate"),
|
|
79
|
+
location_longitude: z5.number().min(-180).max(180).describe("GPS longitude coordinate"),
|
|
80
|
+
location_address: z5.string().optional().describe("Optional human-readable address"),
|
|
81
|
+
vehicle_odometer_miles: z5.number().min(0).optional().describe("Optional vehicle odometer reading in miles")
|
|
70
82
|
}).describe("Single manual telemetry entry");
|
|
71
|
-
var ManualBatchRequestSchema =
|
|
72
|
-
entries:
|
|
83
|
+
var ManualBatchRequestSchema = z5.object({
|
|
84
|
+
entries: z5.array(ManualBatchEntrySchema).min(1).max(1e3).describe("Array of manual telemetry entries (1-1000)")
|
|
73
85
|
}).describe("Request schema for manual batch telemetry insertion");
|
|
74
|
-
var ManualBatchTelemetrySchema =
|
|
75
|
-
id:
|
|
76
|
-
driver_id:
|
|
77
|
-
timestamp:
|
|
78
|
-
remaining_drive_time_in_seconds:
|
|
79
|
-
remaining_shift_time_in_seconds:
|
|
80
|
-
remaining_cycle_time_in_seconds:
|
|
81
|
-
remaining_break_time_in_seconds:
|
|
82
|
-
location_latitude:
|
|
83
|
-
location_longitude:
|
|
84
|
-
previous_location_latitude:
|
|
85
|
-
previous_location_longitude:
|
|
86
|
-
location_address:
|
|
87
|
-
location_state:
|
|
88
|
-
vehicle_odometer_miles:
|
|
89
|
-
source:
|
|
86
|
+
var ManualBatchTelemetrySchema = z5.object({
|
|
87
|
+
id: z5.number().int().describe("Telemetry record ID"),
|
|
88
|
+
driver_id: z5.string().uuid().describe("Internal UUID of the driver"),
|
|
89
|
+
timestamp: z5.union([z5.string(), z5.date()]).describe("Timestamp of the telemetry reading"),
|
|
90
|
+
remaining_drive_time_in_seconds: z5.number().min(0),
|
|
91
|
+
remaining_shift_time_in_seconds: z5.number().min(0),
|
|
92
|
+
remaining_cycle_time_in_seconds: z5.number().min(0),
|
|
93
|
+
remaining_break_time_in_seconds: z5.number().min(0),
|
|
94
|
+
location_latitude: z5.number().min(-90).max(90),
|
|
95
|
+
location_longitude: z5.number().min(-180).max(180),
|
|
96
|
+
previous_location_latitude: z5.number().min(-90).max(90).nullable(),
|
|
97
|
+
previous_location_longitude: z5.number().min(-180).max(180).nullable(),
|
|
98
|
+
location_address: z5.string().nullable(),
|
|
99
|
+
location_state: z5.string().length(2).nullable(),
|
|
100
|
+
vehicle_odometer_miles: z5.number().min(0).nullable(),
|
|
101
|
+
source: z5.enum(["eld", "manual"])
|
|
90
102
|
}).describe("Telemetry record returned from manual batch insertion");
|
|
91
|
-
var ManualBatchResponseSchema =
|
|
92
|
-
message:
|
|
93
|
-
inserted_count:
|
|
94
|
-
telemetry:
|
|
103
|
+
var ManualBatchResponseSchema = z5.object({
|
|
104
|
+
message: z5.string().describe("Success message"),
|
|
105
|
+
inserted_count: z5.number().int().min(0).describe("Number of telemetry entries inserted"),
|
|
106
|
+
telemetry: z5.array(ManualBatchTelemetrySchema).describe("Array of inserted telemetry records")
|
|
95
107
|
}).describe("Response schema for manual batch telemetry insertion");
|
|
96
108
|
|
|
97
109
|
// src/auth-data.ts
|
|
98
|
-
import { z as
|
|
99
|
-
var GomotiveAuthDataSchema =
|
|
100
|
-
kind:
|
|
101
|
-
token:
|
|
102
|
-
ownerOperator:
|
|
110
|
+
import { z as z6 } from "zod";
|
|
111
|
+
var GomotiveAuthDataSchema = z6.object({
|
|
112
|
+
kind: z6.literal("gomotive"),
|
|
113
|
+
token: z6.string(),
|
|
114
|
+
ownerOperator: z6.boolean()
|
|
103
115
|
});
|
|
104
|
-
var VistaAuthDataSchema =
|
|
105
|
-
kind:
|
|
106
|
-
driverId:
|
|
107
|
-
cookie:
|
|
116
|
+
var VistaAuthDataSchema = z6.object({
|
|
117
|
+
kind: z6.literal("vista"),
|
|
118
|
+
driverId: z6.string(),
|
|
119
|
+
cookie: z6.string()
|
|
108
120
|
});
|
|
109
|
-
var MockAuthDataSchema =
|
|
110
|
-
kind:
|
|
111
|
-
cookie:
|
|
121
|
+
var MockAuthDataSchema = z6.object({
|
|
122
|
+
kind: z6.literal("mock"),
|
|
123
|
+
cookie: z6.string()
|
|
112
124
|
});
|
|
113
|
-
var NoneAuthDataSchema =
|
|
114
|
-
kind:
|
|
125
|
+
var NoneAuthDataSchema = z6.object({
|
|
126
|
+
kind: z6.literal("none")
|
|
115
127
|
});
|
|
116
|
-
var ProviderAuthDataSchema =
|
|
128
|
+
var ProviderAuthDataSchema = z6.discriminatedUnion("kind", [
|
|
117
129
|
GomotiveAuthDataSchema,
|
|
118
130
|
VistaAuthDataSchema,
|
|
119
131
|
MockAuthDataSchema,
|
|
120
132
|
NoneAuthDataSchema
|
|
121
133
|
]);
|
|
122
|
-
var LegacyVistaAuthSchema =
|
|
123
|
-
driverId:
|
|
124
|
-
cookie:
|
|
134
|
+
var LegacyVistaAuthSchema = z6.object({
|
|
135
|
+
driverId: z6.string(),
|
|
136
|
+
cookie: z6.string()
|
|
125
137
|
});
|
|
126
138
|
function serializeAuthData(data) {
|
|
127
139
|
if (data.kind === "none") {
|
|
@@ -157,42 +169,52 @@ function deserializeAuthData(authToken) {
|
|
|
157
169
|
}
|
|
158
170
|
|
|
159
171
|
// src/browser-auth.ts
|
|
160
|
-
import { z as
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
import { z as z7 } from "zod";
|
|
173
|
+
var CapturedTrafficEntrySchema = z7.object({
|
|
174
|
+
method: z7.string(),
|
|
175
|
+
url: z7.string(),
|
|
176
|
+
status: z7.number(),
|
|
177
|
+
responseBody: z7.string().optional()
|
|
178
|
+
});
|
|
179
|
+
var BrowserAuthRequestSchema = z7.object({
|
|
180
|
+
providerStub: z7.string(),
|
|
181
|
+
providerUrl: z7.string(),
|
|
182
|
+
username: z7.string(),
|
|
183
|
+
encryptedPassword: z7.string(),
|
|
184
|
+
captureTraffic: z7.boolean().optional()
|
|
166
185
|
});
|
|
167
|
-
var BrowserAuthSuccessSchema =
|
|
168
|
-
success:
|
|
169
|
-
authData: ProviderAuthDataSchema
|
|
186
|
+
var BrowserAuthSuccessSchema = z7.object({
|
|
187
|
+
success: z7.literal(true),
|
|
188
|
+
authData: ProviderAuthDataSchema,
|
|
189
|
+
capturedTraffic: z7.array(CapturedTrafficEntrySchema).optional()
|
|
170
190
|
});
|
|
171
|
-
var BrowserAuthFailureSchema =
|
|
172
|
-
success:
|
|
173
|
-
error:
|
|
191
|
+
var BrowserAuthFailureSchema = z7.object({
|
|
192
|
+
success: z7.literal(false),
|
|
193
|
+
error: z7.string()
|
|
174
194
|
});
|
|
175
|
-
var BrowserAuthResponseSchema =
|
|
195
|
+
var BrowserAuthResponseSchema = z7.discriminatedUnion("success", [
|
|
176
196
|
BrowserAuthSuccessSchema,
|
|
177
197
|
BrowserAuthFailureSchema
|
|
178
198
|
]);
|
|
179
|
-
var CrawlPageSchema =
|
|
180
|
-
url:
|
|
181
|
-
html:
|
|
199
|
+
var CrawlPageSchema = z7.object({
|
|
200
|
+
url: z7.string(),
|
|
201
|
+
html: z7.string()
|
|
182
202
|
});
|
|
183
|
-
var BrowserCrawlSuccessSchema =
|
|
184
|
-
success:
|
|
185
|
-
pages:
|
|
203
|
+
var BrowserCrawlSuccessSchema = z7.object({
|
|
204
|
+
success: z7.literal(true),
|
|
205
|
+
pages: z7.array(CrawlPageSchema)
|
|
186
206
|
});
|
|
187
|
-
var BrowserCrawlFailureSchema =
|
|
188
|
-
success:
|
|
189
|
-
error:
|
|
207
|
+
var BrowserCrawlFailureSchema = z7.object({
|
|
208
|
+
success: z7.literal(false),
|
|
209
|
+
error: z7.string()
|
|
190
210
|
});
|
|
191
|
-
var BrowserCrawlResponseSchema =
|
|
211
|
+
var BrowserCrawlResponseSchema = z7.discriminatedUnion("success", [
|
|
192
212
|
BrowserCrawlSuccessSchema,
|
|
193
213
|
BrowserCrawlFailureSchema
|
|
194
214
|
]);
|
|
195
215
|
export {
|
|
216
|
+
AnonymousDriverErrorResponseSchema,
|
|
217
|
+
AnonymousDriverResponseSchema,
|
|
196
218
|
BatchConvexUpdate,
|
|
197
219
|
BatchConvexUpdateSchema,
|
|
198
220
|
BrowserAuthFailureSchema,
|
|
@@ -202,10 +224,12 @@ export {
|
|
|
202
224
|
BrowserCrawlFailureSchema,
|
|
203
225
|
BrowserCrawlResponseSchema,
|
|
204
226
|
BrowserCrawlSuccessSchema,
|
|
227
|
+
CapturedTrafficEntrySchema,
|
|
205
228
|
ConvexDriverSchema,
|
|
206
229
|
ConvexUpdate,
|
|
207
230
|
ConvexUpdateSchema,
|
|
208
231
|
CrawlPageSchema,
|
|
232
|
+
CreateAnonymousDriverBodySchema,
|
|
209
233
|
DeleteProviderAccountRequestSchema,
|
|
210
234
|
DeleteProviderAccountResponseSchema,
|
|
211
235
|
DriverRankingSchema,
|