@findatruck/shared-schemas 0.15.0 → 2.0.1

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
@@ -31,25 +31,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  ConvexUpdate: () => ConvexUpdate,
34
- ConvexUpdateNested: () => ConvexUpdateNested,
35
- DriverIdentity: () => DriverIdentity,
36
- DriverLocation: () => DriverLocation,
37
- DriverLogin: () => DriverLogin,
38
- DriverStatus: () => DriverStatus,
39
- HoursOfService: () => HoursOfService,
40
34
  NewLoginRequest: () => NewLoginRequest,
41
35
  NewLoginResponse: () => NewLoginResponse,
42
36
  NewLoginResponseFailure: () => NewLoginResponseFailure,
43
37
  NewLoginResponseSuccess: () => NewLoginResponseSuccess,
44
38
  ScrapeStatus: () => ScrapeStatus,
45
39
  UpdateScrapeStatusMessage: () => UpdateScrapeStatusMessage,
46
- VehicleIdentity: () => VehicleIdentity,
40
+ ValidatePasswordRequestSchema: () => ValidatePasswordRequestSchema,
41
+ ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema,
47
42
  decryptRsaOaepSha256B64: () => decryptRsaOaepSha256B64,
48
43
  encryptRsaOaepSha256ToB64: () => encryptRsaOaepSha256ToB64
49
44
  });
50
45
  module.exports = __toCommonJS(index_exports);
51
46
 
52
- // src/schemas/new-login.ts
47
+ // src/schemas/providerAccounts/new-login.ts
53
48
  var import_zod = require("zod");
54
49
  var UrlSchema = import_zod.z.string().refine(
55
50
  (val) => {
@@ -63,13 +58,11 @@ var UrlSchema = import_zod.z.string().refine(
63
58
  { message: "Invalid URL" }
64
59
  );
65
60
  var NewLoginRequest = import_zod.z.object({
66
- provider_url: UrlSchema,
61
+ providerUrl: UrlSchema,
67
62
  username: import_zod.z.string().min(1),
68
- password: import_zod.z.string().min(1),
69
- organizationId: import_zod.z.string().optional(),
70
- honkUserId: import_zod.z.string().optional()
71
- }).refine((data) => data.organizationId && !data.honkUserId || !data.organizationId && data.honkUserId, {
72
- message: "Requires one and only one of organizationId or honkUserId must be provided"
63
+ encryptedPassword: import_zod.z.string().min(1),
64
+ ownerId: import_zod.z.string(),
65
+ externalProviderAccountId: import_zod.z.string()
73
66
  });
74
67
  var PublicUser = import_zod.z.object({
75
68
  id: import_zod.z.string(),
@@ -82,7 +75,6 @@ var PublicProvider = import_zod.z.object({
82
75
  url: UrlSchema
83
76
  });
84
77
  var NewLoginResponseSuccess = import_zod.z.object({
85
- success: import_zod.z.literal(true),
86
78
  message: import_zod.z.string(),
87
79
  user: PublicUser,
88
80
  provider: PublicProvider,
@@ -91,12 +83,11 @@ var NewLoginResponseSuccess = import_zod.z.object({
91
83
  honkUserId: import_zod.z.string().optional()
92
84
  });
93
85
  var NewLoginResponseFailure = import_zod.z.object({
94
- success: import_zod.z.literal(false),
95
86
  error: import_zod.z.string()
96
87
  });
97
88
  var NewLoginResponse = import_zod.z.union([NewLoginResponseSuccess, NewLoginResponseFailure]);
98
89
 
99
- // src/schemas/convex-update.ts
90
+ // src/schemas/drivers/convex-update.ts
100
91
  var import_zod2 = __toESM(require("zod"), 1);
101
92
  var UrlSchema2 = import_zod2.default.string().refine(
102
93
  (val) => {
@@ -121,44 +112,14 @@ var ConvexUpdate = import_zod2.default.object({
121
112
  time_remaining_in_drive: import_zod2.default.number().describe("Seconds remaining in current drive period"),
122
113
  driver_current_location_latitude: import_zod2.default.number().describe("Driver's current latitude"),
123
114
  driver_current_location_longitude: import_zod2.default.number().describe("Driver's current longitude"),
124
- driver_current_location_address: import_zod2.default.string().describe("Driver's current address")
115
+ driver_current_location_address: import_zod2.default.string().describe("Driver's current address"),
116
+ license_number: import_zod2.default.string().optional().describe("The driver's license number"),
117
+ license_state: import_zod2.default.string().optional().describe("The state that issued the driver's license"),
118
+ speed: import_zod2.default.number().optional().describe("The vehicle's current speed in mph"),
119
+ odometer: import_zod2.default.number().optional().describe("The vehicle's current odometer reading in miles"),
120
+ convex_provider_account_id: import_zod2.default.string().describe("The Convex ELD provider account ID"),
121
+ external_provider_account_id: import_zod2.default.string().describe("The provider account ID on backend")
125
122
  }).describe("Schema for updating driver ELD status information");
126
- var HoursOfService = import_zod2.default.object({
127
- timeRemainingInShift: import_zod2.default.number().describe("Seconds remaining in current shift"),
128
- timeRemainingTillBreak: import_zod2.default.number().describe("Seconds remaining until next required break"),
129
- timeRemainingInWeek: import_zod2.default.number().describe("Seconds remaining in current cycle/week"),
130
- timeRemainingInDrive: import_zod2.default.number().describe("Seconds remaining in current drive period")
131
- }).describe("Schema for driver's hours of service information");
132
- var DriverLocation = import_zod2.default.object({
133
- latitude: import_zod2.default.number().describe("Driver's current latitude"),
134
- longitude: import_zod2.default.number().describe("Driver's current longitude"),
135
- address: import_zod2.default.string().describe("Driver's current address")
136
- }).describe("Schema for driver's current location information");
137
- var DriverStatus = import_zod2.default.object({
138
- status: import_zod2.default.string().describe("The driver's duty status (direct from ELD)")
139
- }).describe("Schema for driver's current duty status information");
140
- var DriverLogin = import_zod2.default.object({
141
- providerUrl: UrlSchema2.describe("The URL of the ELD provider"),
142
- username: import_zod2.default.string().describe("The driver's login username"),
143
- password: import_zod2.default.string().describe("The driver's login password")
144
- }).describe("Schema for driver login information");
145
- var DriverIdentity = import_zod2.default.object({
146
- driverId: import_zod2.default.string().describe("The ELD's internal driver ID"),
147
- driverFirstName: import_zod2.default.string().optional().describe("The driver's first name"),
148
- driverLastName: import_zod2.default.string().optional().describe("The driver's last name"),
149
- driverName: import_zod2.default.string().optional().describe("The driver's full name")
150
- }).describe("Schema for identifying the driver");
151
- var VehicleIdentity = import_zod2.default.object({
152
- vehicleId: import_zod2.default.string().optional().describe("The vehicle ID")
153
- }).describe("Schema for identifying the vehicle");
154
- var ConvexUpdateNested = import_zod2.default.object({
155
- driver: DriverIdentity,
156
- vehicle: VehicleIdentity,
157
- hoursOfService: HoursOfService,
158
- driverLocation: DriverLocation,
159
- driverStatus: DriverStatus,
160
- driverLogin: DriverLogin
161
- }).describe("Nested schema for updating driver ELD status information");
162
123
 
163
124
  // src/security/transit-crypto.ts
164
125
  var import_node_crypto = require("crypto");
@@ -186,7 +147,7 @@ function decryptRsaOaepSha256B64(ciphertextB64, privateKeyPem, passphrase) {
186
147
  return plaintext.toString("utf8");
187
148
  }
188
149
 
189
- // src/schemas/update-status.ts
150
+ // src/schemas/providerAccounts/update-status.ts
190
151
  var import_zod3 = __toESM(require("zod"), 1);
191
152
  var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
192
153
  ScrapeStatus2["NEW_LOGIN_RECEIVED"] = "NEW_LOGIN_RECEIVED";
@@ -200,25 +161,32 @@ var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
200
161
  })(ScrapeStatus || {});
201
162
  var UpdateScrapeStatusMessage = import_zod3.default.object({
202
163
  status: import_zod3.default.nativeEnum(ScrapeStatus).describe("The current status of the scrape process"),
203
- username: import_zod3.default.string().describe("The username of the driver whose status is being updated"),
164
+ externalProviderAccountId: import_zod3.default.string().describe("The external identifier for the provider account"),
165
+ username: import_zod3.default.string().describe("The username of the provider account whose status is being updated"),
204
166
  provider_url: import_zod3.default.string().describe("The URL of the ELD provider")
205
167
  }).describe("Schema for update status messages");
168
+
169
+ // src/schemas/providerAccounts/validate-password.ts
170
+ var import_zod4 = require("zod");
171
+ var ValidatePasswordRequestSchema = import_zod4.z.object({
172
+ providerAccountId: import_zod4.z.string().min(1).describe("The unique identifier of the provider account in postgres to validate the password for"),
173
+ encryptedPassword: import_zod4.z.string().min(1).describe("The encrypted password to validate against the stored password")
174
+ }).describe("Request schema for validating a provider account password");
175
+ var ValidatePasswordResponseSchema = import_zod4.z.object({
176
+ isValid: import_zod4.z.boolean().describe("Indicates if the provided password is valid"),
177
+ driverIds: import_zod4.z.array(import_zod4.z.string()).describe("List of driver IDs associated with the provider account")
178
+ }).describe("Response schema for password validation");
206
179
  // Annotate the CommonJS export names for ESM import in node:
207
180
  0 && (module.exports = {
208
181
  ConvexUpdate,
209
- ConvexUpdateNested,
210
- DriverIdentity,
211
- DriverLocation,
212
- DriverLogin,
213
- DriverStatus,
214
- HoursOfService,
215
182
  NewLoginRequest,
216
183
  NewLoginResponse,
217
184
  NewLoginResponseFailure,
218
185
  NewLoginResponseSuccess,
219
186
  ScrapeStatus,
220
187
  UpdateScrapeStatusMessage,
221
- VehicleIdentity,
188
+ ValidatePasswordRequestSchema,
189
+ ValidatePasswordResponseSchema,
222
190
  decryptRsaOaepSha256B64,
223
191
  encryptRsaOaepSha256ToB64
224
192
  });
package/dist/index.d.cts CHANGED
@@ -1,38 +1,26 @@
1
1
  import z$1, { z } from 'zod';
2
2
 
3
- declare const NewLoginRequest: z.ZodEffects<z.ZodObject<{
4
- provider_url: z.ZodEffects<z.ZodString, string, string>;
3
+ declare const NewLoginRequest: z.ZodObject<{
4
+ providerUrl: z.ZodEffects<z.ZodString, string, string>;
5
5
  username: z.ZodString;
6
- password: z.ZodString;
7
- organizationId: z.ZodOptional<z.ZodString>;
8
- honkUserId: z.ZodOptional<z.ZodString>;
6
+ encryptedPassword: z.ZodString;
7
+ ownerId: z.ZodString;
8
+ externalProviderAccountId: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- provider_url: string;
11
- username: string;
12
- password: string;
13
- organizationId?: string | undefined;
14
- honkUserId?: string | undefined;
15
- }, {
16
- provider_url: string;
17
- username: string;
18
- password: string;
19
- organizationId?: string | undefined;
20
- honkUserId?: string | undefined;
21
- }>, {
22
- provider_url: string;
10
+ providerUrl: string;
23
11
  username: string;
24
- password: string;
25
- organizationId?: string | undefined;
26
- honkUserId?: string | undefined;
12
+ encryptedPassword: string;
13
+ ownerId: string;
14
+ externalProviderAccountId: string;
27
15
  }, {
28
- provider_url: string;
16
+ providerUrl: string;
29
17
  username: string;
30
- password: string;
31
- organizationId?: string | undefined;
32
- honkUserId?: string | undefined;
18
+ encryptedPassword: string;
19
+ ownerId: string;
20
+ externalProviderAccountId: string;
33
21
  }>;
22
+ type NewLoginRequest = z.infer<typeof NewLoginRequest>;
34
23
  declare const NewLoginResponseSuccess: z.ZodObject<{
35
- success: z.ZodLiteral<true>;
36
24
  message: z.ZodString;
37
25
  user: z.ZodObject<{
38
26
  id: z.ZodString;
@@ -65,7 +53,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
65
53
  honkUserId: z.ZodOptional<z.ZodString>;
66
54
  }, "strip", z.ZodTypeAny, {
67
55
  message: string;
68
- success: true;
69
56
  user: {
70
57
  username: string;
71
58
  id: string;
@@ -81,7 +68,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
81
68
  honkUserId?: string | undefined;
82
69
  }, {
83
70
  message: string;
84
- success: true;
85
71
  user: {
86
72
  username: string;
87
73
  id: string;
@@ -96,18 +82,16 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
96
82
  organizationId?: string | undefined;
97
83
  honkUserId?: string | undefined;
98
84
  }>;
85
+ type NewLoginResponseSuccess = z.infer<typeof NewLoginResponseSuccess>;
99
86
  declare const NewLoginResponseFailure: z.ZodObject<{
100
- success: z.ZodLiteral<false>;
101
87
  error: z.ZodString;
102
88
  }, "strip", z.ZodTypeAny, {
103
- success: false;
104
89
  error: string;
105
90
  }, {
106
- success: false;
107
91
  error: string;
108
92
  }>;
93
+ type NewLoginResponseFailure = z.infer<typeof NewLoginResponseFailure>;
109
94
  declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
110
- success: z.ZodLiteral<true>;
111
95
  message: z.ZodString;
112
96
  user: z.ZodObject<{
113
97
  id: z.ZodString;
@@ -140,7 +124,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
140
124
  honkUserId: z.ZodOptional<z.ZodString>;
141
125
  }, "strip", z.ZodTypeAny, {
142
126
  message: string;
143
- success: true;
144
127
  user: {
145
128
  username: string;
146
129
  id: string;
@@ -156,7 +139,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
156
139
  honkUserId?: string | undefined;
157
140
  }, {
158
141
  message: string;
159
- success: true;
160
142
  user: {
161
143
  username: string;
162
144
  id: string;
@@ -171,15 +153,13 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
171
153
  organizationId?: string | undefined;
172
154
  honkUserId?: string | undefined;
173
155
  }>, z.ZodObject<{
174
- success: z.ZodLiteral<false>;
175
156
  error: z.ZodString;
176
157
  }, "strip", z.ZodTypeAny, {
177
- success: false;
178
158
  error: string;
179
159
  }, {
180
- success: false;
181
160
  error: string;
182
161
  }>]>;
162
+ type NewLoginResponse = z.infer<typeof NewLoginResponse>;
183
163
 
184
164
  declare const ConvexUpdate: z$1.ZodObject<{
185
165
  provider_url: z$1.ZodEffects<z$1.ZodString, string, string>;
@@ -194,9 +174,15 @@ declare const ConvexUpdate: z$1.ZodObject<{
194
174
  driver_current_location_latitude: z$1.ZodNumber;
195
175
  driver_current_location_longitude: z$1.ZodNumber;
196
176
  driver_current_location_address: z$1.ZodString;
177
+ license_number: z$1.ZodOptional<z$1.ZodString>;
178
+ license_state: z$1.ZodOptional<z$1.ZodString>;
179
+ speed: z$1.ZodOptional<z$1.ZodNumber>;
180
+ odometer: z$1.ZodOptional<z$1.ZodNumber>;
181
+ convex_provider_account_id: z$1.ZodString;
182
+ external_provider_account_id: z$1.ZodString;
197
183
  }, "strip", z$1.ZodTypeAny, {
198
- provider_url: string;
199
184
  username: string;
185
+ provider_url: string;
200
186
  driver_status: string;
201
187
  time_remaining_in_shift: number;
202
188
  time_remaining_till_break: number;
@@ -205,11 +191,17 @@ declare const ConvexUpdate: z$1.ZodObject<{
205
191
  driver_current_location_latitude: number;
206
192
  driver_current_location_longitude: number;
207
193
  driver_current_location_address: string;
194
+ convex_provider_account_id: string;
195
+ external_provider_account_id: string;
208
196
  driver_name?: string | undefined;
209
197
  vehicle_id?: string | undefined;
198
+ license_number?: string | undefined;
199
+ license_state?: string | undefined;
200
+ speed?: number | undefined;
201
+ odometer?: number | undefined;
210
202
  }, {
211
- provider_url: string;
212
203
  username: string;
204
+ provider_url: string;
213
205
  driver_status: string;
214
206
  time_remaining_in_shift: number;
215
207
  time_remaining_till_break: number;
@@ -218,221 +210,16 @@ declare const ConvexUpdate: z$1.ZodObject<{
218
210
  driver_current_location_latitude: number;
219
211
  driver_current_location_longitude: number;
220
212
  driver_current_location_address: string;
213
+ convex_provider_account_id: string;
214
+ external_provider_account_id: string;
221
215
  driver_name?: string | undefined;
222
216
  vehicle_id?: string | undefined;
217
+ license_number?: string | undefined;
218
+ license_state?: string | undefined;
219
+ speed?: number | undefined;
220
+ odometer?: number | undefined;
223
221
  }>;
224
222
  type ConvexUpdate = z$1.infer<typeof ConvexUpdate>;
225
- declare const HoursOfService: z$1.ZodObject<{
226
- timeRemainingInShift: z$1.ZodNumber;
227
- timeRemainingTillBreak: z$1.ZodNumber;
228
- timeRemainingInWeek: z$1.ZodNumber;
229
- timeRemainingInDrive: z$1.ZodNumber;
230
- }, "strip", z$1.ZodTypeAny, {
231
- timeRemainingInShift: number;
232
- timeRemainingTillBreak: number;
233
- timeRemainingInWeek: number;
234
- timeRemainingInDrive: number;
235
- }, {
236
- timeRemainingInShift: number;
237
- timeRemainingTillBreak: number;
238
- timeRemainingInWeek: number;
239
- timeRemainingInDrive: number;
240
- }>;
241
- type HoursOfService = z$1.infer<typeof HoursOfService>;
242
- declare const DriverLocation: z$1.ZodObject<{
243
- latitude: z$1.ZodNumber;
244
- longitude: z$1.ZodNumber;
245
- address: z$1.ZodString;
246
- }, "strip", z$1.ZodTypeAny, {
247
- latitude: number;
248
- longitude: number;
249
- address: string;
250
- }, {
251
- latitude: number;
252
- longitude: number;
253
- address: string;
254
- }>;
255
- type DriverLocation = z$1.infer<typeof DriverLocation>;
256
- declare const DriverStatus: z$1.ZodObject<{
257
- status: z$1.ZodString;
258
- }, "strip", z$1.ZodTypeAny, {
259
- status: string;
260
- }, {
261
- status: string;
262
- }>;
263
- type DriverStatus = z$1.infer<typeof DriverStatus>;
264
- declare const DriverLogin: z$1.ZodObject<{
265
- providerUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
266
- username: z$1.ZodString;
267
- password: z$1.ZodString;
268
- }, "strip", z$1.ZodTypeAny, {
269
- username: string;
270
- password: string;
271
- providerUrl: string;
272
- }, {
273
- username: string;
274
- password: string;
275
- providerUrl: string;
276
- }>;
277
- type DriverLogin = z$1.infer<typeof DriverLogin>;
278
- declare const DriverIdentity: z$1.ZodObject<{
279
- driverId: z$1.ZodString;
280
- driverFirstName: z$1.ZodOptional<z$1.ZodString>;
281
- driverLastName: z$1.ZodOptional<z$1.ZodString>;
282
- driverName: z$1.ZodOptional<z$1.ZodString>;
283
- }, "strip", z$1.ZodTypeAny, {
284
- driverId: string;
285
- driverFirstName?: string | undefined;
286
- driverLastName?: string | undefined;
287
- driverName?: string | undefined;
288
- }, {
289
- driverId: string;
290
- driverFirstName?: string | undefined;
291
- driverLastName?: string | undefined;
292
- driverName?: string | undefined;
293
- }>;
294
- type DriverIdentity = z$1.infer<typeof DriverIdentity>;
295
- declare const VehicleIdentity: z$1.ZodObject<{
296
- vehicleId: z$1.ZodOptional<z$1.ZodString>;
297
- }, "strip", z$1.ZodTypeAny, {
298
- vehicleId?: string | undefined;
299
- }, {
300
- vehicleId?: string | undefined;
301
- }>;
302
- type VehicleIdentity = z$1.infer<typeof VehicleIdentity>;
303
- declare const ConvexUpdateNested: z$1.ZodObject<{
304
- driver: z$1.ZodObject<{
305
- driverId: z$1.ZodString;
306
- driverFirstName: z$1.ZodOptional<z$1.ZodString>;
307
- driverLastName: z$1.ZodOptional<z$1.ZodString>;
308
- driverName: z$1.ZodOptional<z$1.ZodString>;
309
- }, "strip", z$1.ZodTypeAny, {
310
- driverId: string;
311
- driverFirstName?: string | undefined;
312
- driverLastName?: string | undefined;
313
- driverName?: string | undefined;
314
- }, {
315
- driverId: string;
316
- driverFirstName?: string | undefined;
317
- driverLastName?: string | undefined;
318
- driverName?: string | undefined;
319
- }>;
320
- vehicle: z$1.ZodObject<{
321
- vehicleId: z$1.ZodOptional<z$1.ZodString>;
322
- }, "strip", z$1.ZodTypeAny, {
323
- vehicleId?: string | undefined;
324
- }, {
325
- vehicleId?: string | undefined;
326
- }>;
327
- hoursOfService: z$1.ZodObject<{
328
- timeRemainingInShift: z$1.ZodNumber;
329
- timeRemainingTillBreak: z$1.ZodNumber;
330
- timeRemainingInWeek: z$1.ZodNumber;
331
- timeRemainingInDrive: z$1.ZodNumber;
332
- }, "strip", z$1.ZodTypeAny, {
333
- timeRemainingInShift: number;
334
- timeRemainingTillBreak: number;
335
- timeRemainingInWeek: number;
336
- timeRemainingInDrive: number;
337
- }, {
338
- timeRemainingInShift: number;
339
- timeRemainingTillBreak: number;
340
- timeRemainingInWeek: number;
341
- timeRemainingInDrive: number;
342
- }>;
343
- driverLocation: z$1.ZodObject<{
344
- latitude: z$1.ZodNumber;
345
- longitude: z$1.ZodNumber;
346
- address: z$1.ZodString;
347
- }, "strip", z$1.ZodTypeAny, {
348
- latitude: number;
349
- longitude: number;
350
- address: string;
351
- }, {
352
- latitude: number;
353
- longitude: number;
354
- address: string;
355
- }>;
356
- driverStatus: z$1.ZodObject<{
357
- status: z$1.ZodString;
358
- }, "strip", z$1.ZodTypeAny, {
359
- status: string;
360
- }, {
361
- status: string;
362
- }>;
363
- driverLogin: z$1.ZodObject<{
364
- providerUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
365
- username: z$1.ZodString;
366
- password: z$1.ZodString;
367
- }, "strip", z$1.ZodTypeAny, {
368
- username: string;
369
- password: string;
370
- providerUrl: string;
371
- }, {
372
- username: string;
373
- password: string;
374
- providerUrl: string;
375
- }>;
376
- }, "strip", z$1.ZodTypeAny, {
377
- driver: {
378
- driverId: string;
379
- driverFirstName?: string | undefined;
380
- driverLastName?: string | undefined;
381
- driverName?: string | undefined;
382
- };
383
- vehicle: {
384
- vehicleId?: string | undefined;
385
- };
386
- hoursOfService: {
387
- timeRemainingInShift: number;
388
- timeRemainingTillBreak: number;
389
- timeRemainingInWeek: number;
390
- timeRemainingInDrive: number;
391
- };
392
- driverLocation: {
393
- latitude: number;
394
- longitude: number;
395
- address: string;
396
- };
397
- driverStatus: {
398
- status: string;
399
- };
400
- driverLogin: {
401
- username: string;
402
- password: string;
403
- providerUrl: string;
404
- };
405
- }, {
406
- driver: {
407
- driverId: string;
408
- driverFirstName?: string | undefined;
409
- driverLastName?: string | undefined;
410
- driverName?: string | undefined;
411
- };
412
- vehicle: {
413
- vehicleId?: string | undefined;
414
- };
415
- hoursOfService: {
416
- timeRemainingInShift: number;
417
- timeRemainingTillBreak: number;
418
- timeRemainingInWeek: number;
419
- timeRemainingInDrive: number;
420
- };
421
- driverLocation: {
422
- latitude: number;
423
- longitude: number;
424
- address: string;
425
- };
426
- driverStatus: {
427
- status: string;
428
- };
429
- driverLogin: {
430
- username: string;
431
- password: string;
432
- providerUrl: string;
433
- };
434
- }>;
435
- type ConvexUpdateNested = z$1.infer<typeof ConvexUpdateNested>;
436
223
 
437
224
  declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
438
225
  declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
@@ -448,17 +235,43 @@ declare enum ScrapeStatus {
448
235
  }
449
236
  declare const UpdateScrapeStatusMessage: z$1.ZodObject<{
450
237
  status: z$1.ZodNativeEnum<typeof ScrapeStatus>;
238
+ externalProviderAccountId: z$1.ZodString;
451
239
  username: z$1.ZodString;
452
240
  provider_url: z$1.ZodString;
453
241
  }, "strip", z$1.ZodTypeAny, {
454
- provider_url: string;
455
242
  username: string;
243
+ externalProviderAccountId: string;
456
244
  status: ScrapeStatus;
457
- }, {
458
245
  provider_url: string;
246
+ }, {
459
247
  username: string;
248
+ externalProviderAccountId: string;
460
249
  status: ScrapeStatus;
250
+ provider_url: string;
461
251
  }>;
462
252
  type UpdateScrapeStatusMessage = z$1.infer<typeof UpdateScrapeStatusMessage>;
463
253
 
464
- export { ConvexUpdate, ConvexUpdateNested, DriverIdentity, DriverLocation, DriverLogin, DriverStatus, HoursOfService, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, VehicleIdentity, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
254
+ declare const ValidatePasswordRequestSchema: z.ZodObject<{
255
+ providerAccountId: z.ZodString;
256
+ encryptedPassword: z.ZodString;
257
+ }, "strip", z.ZodTypeAny, {
258
+ encryptedPassword: string;
259
+ providerAccountId: string;
260
+ }, {
261
+ encryptedPassword: string;
262
+ providerAccountId: string;
263
+ }>;
264
+ type ValidatePasswordRequest = z.infer<typeof ValidatePasswordRequestSchema>;
265
+ declare const ValidatePasswordResponseSchema: z.ZodObject<{
266
+ isValid: z.ZodBoolean;
267
+ driverIds: z.ZodArray<z.ZodString, "many">;
268
+ }, "strip", z.ZodTypeAny, {
269
+ driverIds: string[];
270
+ isValid: boolean;
271
+ }, {
272
+ driverIds: string[];
273
+ isValid: boolean;
274
+ }>;
275
+ type ValidatePasswordResponse = z.infer<typeof ValidatePasswordResponseSchema>;
276
+
277
+ export { ConvexUpdate, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, type ValidatePasswordRequest, ValidatePasswordRequestSchema, type ValidatePasswordResponse, ValidatePasswordResponseSchema, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
package/dist/index.d.ts CHANGED
@@ -1,38 +1,26 @@
1
1
  import z$1, { z } from 'zod';
2
2
 
3
- declare const NewLoginRequest: z.ZodEffects<z.ZodObject<{
4
- provider_url: z.ZodEffects<z.ZodString, string, string>;
3
+ declare const NewLoginRequest: z.ZodObject<{
4
+ providerUrl: z.ZodEffects<z.ZodString, string, string>;
5
5
  username: z.ZodString;
6
- password: z.ZodString;
7
- organizationId: z.ZodOptional<z.ZodString>;
8
- honkUserId: z.ZodOptional<z.ZodString>;
6
+ encryptedPassword: z.ZodString;
7
+ ownerId: z.ZodString;
8
+ externalProviderAccountId: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- provider_url: string;
11
- username: string;
12
- password: string;
13
- organizationId?: string | undefined;
14
- honkUserId?: string | undefined;
15
- }, {
16
- provider_url: string;
17
- username: string;
18
- password: string;
19
- organizationId?: string | undefined;
20
- honkUserId?: string | undefined;
21
- }>, {
22
- provider_url: string;
10
+ providerUrl: string;
23
11
  username: string;
24
- password: string;
25
- organizationId?: string | undefined;
26
- honkUserId?: string | undefined;
12
+ encryptedPassword: string;
13
+ ownerId: string;
14
+ externalProviderAccountId: string;
27
15
  }, {
28
- provider_url: string;
16
+ providerUrl: string;
29
17
  username: string;
30
- password: string;
31
- organizationId?: string | undefined;
32
- honkUserId?: string | undefined;
18
+ encryptedPassword: string;
19
+ ownerId: string;
20
+ externalProviderAccountId: string;
33
21
  }>;
22
+ type NewLoginRequest = z.infer<typeof NewLoginRequest>;
34
23
  declare const NewLoginResponseSuccess: z.ZodObject<{
35
- success: z.ZodLiteral<true>;
36
24
  message: z.ZodString;
37
25
  user: z.ZodObject<{
38
26
  id: z.ZodString;
@@ -65,7 +53,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
65
53
  honkUserId: z.ZodOptional<z.ZodString>;
66
54
  }, "strip", z.ZodTypeAny, {
67
55
  message: string;
68
- success: true;
69
56
  user: {
70
57
  username: string;
71
58
  id: string;
@@ -81,7 +68,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
81
68
  honkUserId?: string | undefined;
82
69
  }, {
83
70
  message: string;
84
- success: true;
85
71
  user: {
86
72
  username: string;
87
73
  id: string;
@@ -96,18 +82,16 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
96
82
  organizationId?: string | undefined;
97
83
  honkUserId?: string | undefined;
98
84
  }>;
85
+ type NewLoginResponseSuccess = z.infer<typeof NewLoginResponseSuccess>;
99
86
  declare const NewLoginResponseFailure: z.ZodObject<{
100
- success: z.ZodLiteral<false>;
101
87
  error: z.ZodString;
102
88
  }, "strip", z.ZodTypeAny, {
103
- success: false;
104
89
  error: string;
105
90
  }, {
106
- success: false;
107
91
  error: string;
108
92
  }>;
93
+ type NewLoginResponseFailure = z.infer<typeof NewLoginResponseFailure>;
109
94
  declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
110
- success: z.ZodLiteral<true>;
111
95
  message: z.ZodString;
112
96
  user: z.ZodObject<{
113
97
  id: z.ZodString;
@@ -140,7 +124,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
140
124
  honkUserId: z.ZodOptional<z.ZodString>;
141
125
  }, "strip", z.ZodTypeAny, {
142
126
  message: string;
143
- success: true;
144
127
  user: {
145
128
  username: string;
146
129
  id: string;
@@ -156,7 +139,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
156
139
  honkUserId?: string | undefined;
157
140
  }, {
158
141
  message: string;
159
- success: true;
160
142
  user: {
161
143
  username: string;
162
144
  id: string;
@@ -171,15 +153,13 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
171
153
  organizationId?: string | undefined;
172
154
  honkUserId?: string | undefined;
173
155
  }>, z.ZodObject<{
174
- success: z.ZodLiteral<false>;
175
156
  error: z.ZodString;
176
157
  }, "strip", z.ZodTypeAny, {
177
- success: false;
178
158
  error: string;
179
159
  }, {
180
- success: false;
181
160
  error: string;
182
161
  }>]>;
162
+ type NewLoginResponse = z.infer<typeof NewLoginResponse>;
183
163
 
184
164
  declare const ConvexUpdate: z$1.ZodObject<{
185
165
  provider_url: z$1.ZodEffects<z$1.ZodString, string, string>;
@@ -194,9 +174,15 @@ declare const ConvexUpdate: z$1.ZodObject<{
194
174
  driver_current_location_latitude: z$1.ZodNumber;
195
175
  driver_current_location_longitude: z$1.ZodNumber;
196
176
  driver_current_location_address: z$1.ZodString;
177
+ license_number: z$1.ZodOptional<z$1.ZodString>;
178
+ license_state: z$1.ZodOptional<z$1.ZodString>;
179
+ speed: z$1.ZodOptional<z$1.ZodNumber>;
180
+ odometer: z$1.ZodOptional<z$1.ZodNumber>;
181
+ convex_provider_account_id: z$1.ZodString;
182
+ external_provider_account_id: z$1.ZodString;
197
183
  }, "strip", z$1.ZodTypeAny, {
198
- provider_url: string;
199
184
  username: string;
185
+ provider_url: string;
200
186
  driver_status: string;
201
187
  time_remaining_in_shift: number;
202
188
  time_remaining_till_break: number;
@@ -205,11 +191,17 @@ declare const ConvexUpdate: z$1.ZodObject<{
205
191
  driver_current_location_latitude: number;
206
192
  driver_current_location_longitude: number;
207
193
  driver_current_location_address: string;
194
+ convex_provider_account_id: string;
195
+ external_provider_account_id: string;
208
196
  driver_name?: string | undefined;
209
197
  vehicle_id?: string | undefined;
198
+ license_number?: string | undefined;
199
+ license_state?: string | undefined;
200
+ speed?: number | undefined;
201
+ odometer?: number | undefined;
210
202
  }, {
211
- provider_url: string;
212
203
  username: string;
204
+ provider_url: string;
213
205
  driver_status: string;
214
206
  time_remaining_in_shift: number;
215
207
  time_remaining_till_break: number;
@@ -218,221 +210,16 @@ declare const ConvexUpdate: z$1.ZodObject<{
218
210
  driver_current_location_latitude: number;
219
211
  driver_current_location_longitude: number;
220
212
  driver_current_location_address: string;
213
+ convex_provider_account_id: string;
214
+ external_provider_account_id: string;
221
215
  driver_name?: string | undefined;
222
216
  vehicle_id?: string | undefined;
217
+ license_number?: string | undefined;
218
+ license_state?: string | undefined;
219
+ speed?: number | undefined;
220
+ odometer?: number | undefined;
223
221
  }>;
224
222
  type ConvexUpdate = z$1.infer<typeof ConvexUpdate>;
225
- declare const HoursOfService: z$1.ZodObject<{
226
- timeRemainingInShift: z$1.ZodNumber;
227
- timeRemainingTillBreak: z$1.ZodNumber;
228
- timeRemainingInWeek: z$1.ZodNumber;
229
- timeRemainingInDrive: z$1.ZodNumber;
230
- }, "strip", z$1.ZodTypeAny, {
231
- timeRemainingInShift: number;
232
- timeRemainingTillBreak: number;
233
- timeRemainingInWeek: number;
234
- timeRemainingInDrive: number;
235
- }, {
236
- timeRemainingInShift: number;
237
- timeRemainingTillBreak: number;
238
- timeRemainingInWeek: number;
239
- timeRemainingInDrive: number;
240
- }>;
241
- type HoursOfService = z$1.infer<typeof HoursOfService>;
242
- declare const DriverLocation: z$1.ZodObject<{
243
- latitude: z$1.ZodNumber;
244
- longitude: z$1.ZodNumber;
245
- address: z$1.ZodString;
246
- }, "strip", z$1.ZodTypeAny, {
247
- latitude: number;
248
- longitude: number;
249
- address: string;
250
- }, {
251
- latitude: number;
252
- longitude: number;
253
- address: string;
254
- }>;
255
- type DriverLocation = z$1.infer<typeof DriverLocation>;
256
- declare const DriverStatus: z$1.ZodObject<{
257
- status: z$1.ZodString;
258
- }, "strip", z$1.ZodTypeAny, {
259
- status: string;
260
- }, {
261
- status: string;
262
- }>;
263
- type DriverStatus = z$1.infer<typeof DriverStatus>;
264
- declare const DriverLogin: z$1.ZodObject<{
265
- providerUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
266
- username: z$1.ZodString;
267
- password: z$1.ZodString;
268
- }, "strip", z$1.ZodTypeAny, {
269
- username: string;
270
- password: string;
271
- providerUrl: string;
272
- }, {
273
- username: string;
274
- password: string;
275
- providerUrl: string;
276
- }>;
277
- type DriverLogin = z$1.infer<typeof DriverLogin>;
278
- declare const DriverIdentity: z$1.ZodObject<{
279
- driverId: z$1.ZodString;
280
- driverFirstName: z$1.ZodOptional<z$1.ZodString>;
281
- driverLastName: z$1.ZodOptional<z$1.ZodString>;
282
- driverName: z$1.ZodOptional<z$1.ZodString>;
283
- }, "strip", z$1.ZodTypeAny, {
284
- driverId: string;
285
- driverFirstName?: string | undefined;
286
- driverLastName?: string | undefined;
287
- driverName?: string | undefined;
288
- }, {
289
- driverId: string;
290
- driverFirstName?: string | undefined;
291
- driverLastName?: string | undefined;
292
- driverName?: string | undefined;
293
- }>;
294
- type DriverIdentity = z$1.infer<typeof DriverIdentity>;
295
- declare const VehicleIdentity: z$1.ZodObject<{
296
- vehicleId: z$1.ZodOptional<z$1.ZodString>;
297
- }, "strip", z$1.ZodTypeAny, {
298
- vehicleId?: string | undefined;
299
- }, {
300
- vehicleId?: string | undefined;
301
- }>;
302
- type VehicleIdentity = z$1.infer<typeof VehicleIdentity>;
303
- declare const ConvexUpdateNested: z$1.ZodObject<{
304
- driver: z$1.ZodObject<{
305
- driverId: z$1.ZodString;
306
- driverFirstName: z$1.ZodOptional<z$1.ZodString>;
307
- driverLastName: z$1.ZodOptional<z$1.ZodString>;
308
- driverName: z$1.ZodOptional<z$1.ZodString>;
309
- }, "strip", z$1.ZodTypeAny, {
310
- driverId: string;
311
- driverFirstName?: string | undefined;
312
- driverLastName?: string | undefined;
313
- driverName?: string | undefined;
314
- }, {
315
- driverId: string;
316
- driverFirstName?: string | undefined;
317
- driverLastName?: string | undefined;
318
- driverName?: string | undefined;
319
- }>;
320
- vehicle: z$1.ZodObject<{
321
- vehicleId: z$1.ZodOptional<z$1.ZodString>;
322
- }, "strip", z$1.ZodTypeAny, {
323
- vehicleId?: string | undefined;
324
- }, {
325
- vehicleId?: string | undefined;
326
- }>;
327
- hoursOfService: z$1.ZodObject<{
328
- timeRemainingInShift: z$1.ZodNumber;
329
- timeRemainingTillBreak: z$1.ZodNumber;
330
- timeRemainingInWeek: z$1.ZodNumber;
331
- timeRemainingInDrive: z$1.ZodNumber;
332
- }, "strip", z$1.ZodTypeAny, {
333
- timeRemainingInShift: number;
334
- timeRemainingTillBreak: number;
335
- timeRemainingInWeek: number;
336
- timeRemainingInDrive: number;
337
- }, {
338
- timeRemainingInShift: number;
339
- timeRemainingTillBreak: number;
340
- timeRemainingInWeek: number;
341
- timeRemainingInDrive: number;
342
- }>;
343
- driverLocation: z$1.ZodObject<{
344
- latitude: z$1.ZodNumber;
345
- longitude: z$1.ZodNumber;
346
- address: z$1.ZodString;
347
- }, "strip", z$1.ZodTypeAny, {
348
- latitude: number;
349
- longitude: number;
350
- address: string;
351
- }, {
352
- latitude: number;
353
- longitude: number;
354
- address: string;
355
- }>;
356
- driverStatus: z$1.ZodObject<{
357
- status: z$1.ZodString;
358
- }, "strip", z$1.ZodTypeAny, {
359
- status: string;
360
- }, {
361
- status: string;
362
- }>;
363
- driverLogin: z$1.ZodObject<{
364
- providerUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
365
- username: z$1.ZodString;
366
- password: z$1.ZodString;
367
- }, "strip", z$1.ZodTypeAny, {
368
- username: string;
369
- password: string;
370
- providerUrl: string;
371
- }, {
372
- username: string;
373
- password: string;
374
- providerUrl: string;
375
- }>;
376
- }, "strip", z$1.ZodTypeAny, {
377
- driver: {
378
- driverId: string;
379
- driverFirstName?: string | undefined;
380
- driverLastName?: string | undefined;
381
- driverName?: string | undefined;
382
- };
383
- vehicle: {
384
- vehicleId?: string | undefined;
385
- };
386
- hoursOfService: {
387
- timeRemainingInShift: number;
388
- timeRemainingTillBreak: number;
389
- timeRemainingInWeek: number;
390
- timeRemainingInDrive: number;
391
- };
392
- driverLocation: {
393
- latitude: number;
394
- longitude: number;
395
- address: string;
396
- };
397
- driverStatus: {
398
- status: string;
399
- };
400
- driverLogin: {
401
- username: string;
402
- password: string;
403
- providerUrl: string;
404
- };
405
- }, {
406
- driver: {
407
- driverId: string;
408
- driverFirstName?: string | undefined;
409
- driverLastName?: string | undefined;
410
- driverName?: string | undefined;
411
- };
412
- vehicle: {
413
- vehicleId?: string | undefined;
414
- };
415
- hoursOfService: {
416
- timeRemainingInShift: number;
417
- timeRemainingTillBreak: number;
418
- timeRemainingInWeek: number;
419
- timeRemainingInDrive: number;
420
- };
421
- driverLocation: {
422
- latitude: number;
423
- longitude: number;
424
- address: string;
425
- };
426
- driverStatus: {
427
- status: string;
428
- };
429
- driverLogin: {
430
- username: string;
431
- password: string;
432
- providerUrl: string;
433
- };
434
- }>;
435
- type ConvexUpdateNested = z$1.infer<typeof ConvexUpdateNested>;
436
223
 
437
224
  declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
438
225
  declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
@@ -448,17 +235,43 @@ declare enum ScrapeStatus {
448
235
  }
449
236
  declare const UpdateScrapeStatusMessage: z$1.ZodObject<{
450
237
  status: z$1.ZodNativeEnum<typeof ScrapeStatus>;
238
+ externalProviderAccountId: z$1.ZodString;
451
239
  username: z$1.ZodString;
452
240
  provider_url: z$1.ZodString;
453
241
  }, "strip", z$1.ZodTypeAny, {
454
- provider_url: string;
455
242
  username: string;
243
+ externalProviderAccountId: string;
456
244
  status: ScrapeStatus;
457
- }, {
458
245
  provider_url: string;
246
+ }, {
459
247
  username: string;
248
+ externalProviderAccountId: string;
460
249
  status: ScrapeStatus;
250
+ provider_url: string;
461
251
  }>;
462
252
  type UpdateScrapeStatusMessage = z$1.infer<typeof UpdateScrapeStatusMessage>;
463
253
 
464
- export { ConvexUpdate, ConvexUpdateNested, DriverIdentity, DriverLocation, DriverLogin, DriverStatus, HoursOfService, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, VehicleIdentity, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
254
+ declare const ValidatePasswordRequestSchema: z.ZodObject<{
255
+ providerAccountId: z.ZodString;
256
+ encryptedPassword: z.ZodString;
257
+ }, "strip", z.ZodTypeAny, {
258
+ encryptedPassword: string;
259
+ providerAccountId: string;
260
+ }, {
261
+ encryptedPassword: string;
262
+ providerAccountId: string;
263
+ }>;
264
+ type ValidatePasswordRequest = z.infer<typeof ValidatePasswordRequestSchema>;
265
+ declare const ValidatePasswordResponseSchema: z.ZodObject<{
266
+ isValid: z.ZodBoolean;
267
+ driverIds: z.ZodArray<z.ZodString, "many">;
268
+ }, "strip", z.ZodTypeAny, {
269
+ driverIds: string[];
270
+ isValid: boolean;
271
+ }, {
272
+ driverIds: string[];
273
+ isValid: boolean;
274
+ }>;
275
+ type ValidatePasswordResponse = z.infer<typeof ValidatePasswordResponseSchema>;
276
+
277
+ export { ConvexUpdate, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, type ValidatePasswordRequest, ValidatePasswordRequestSchema, type ValidatePasswordResponse, ValidatePasswordResponseSchema, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/schemas/new-login.ts
1
+ // src/schemas/providerAccounts/new-login.ts
2
2
  import { z } from "zod";
3
3
  var UrlSchema = z.string().refine(
4
4
  (val) => {
@@ -12,13 +12,11 @@ var UrlSchema = z.string().refine(
12
12
  { message: "Invalid URL" }
13
13
  );
14
14
  var NewLoginRequest = z.object({
15
- provider_url: UrlSchema,
15
+ providerUrl: UrlSchema,
16
16
  username: z.string().min(1),
17
- password: z.string().min(1),
18
- organizationId: z.string().optional(),
19
- honkUserId: z.string().optional()
20
- }).refine((data) => data.organizationId && !data.honkUserId || !data.organizationId && data.honkUserId, {
21
- message: "Requires one and only one of organizationId or honkUserId must be provided"
17
+ encryptedPassword: z.string().min(1),
18
+ ownerId: z.string(),
19
+ externalProviderAccountId: z.string()
22
20
  });
23
21
  var PublicUser = z.object({
24
22
  id: z.string(),
@@ -31,7 +29,6 @@ var PublicProvider = z.object({
31
29
  url: UrlSchema
32
30
  });
33
31
  var NewLoginResponseSuccess = z.object({
34
- success: z.literal(true),
35
32
  message: z.string(),
36
33
  user: PublicUser,
37
34
  provider: PublicProvider,
@@ -40,12 +37,11 @@ var NewLoginResponseSuccess = z.object({
40
37
  honkUserId: z.string().optional()
41
38
  });
42
39
  var NewLoginResponseFailure = z.object({
43
- success: z.literal(false),
44
40
  error: z.string()
45
41
  });
46
42
  var NewLoginResponse = z.union([NewLoginResponseSuccess, NewLoginResponseFailure]);
47
43
 
48
- // src/schemas/convex-update.ts
44
+ // src/schemas/drivers/convex-update.ts
49
45
  import z2 from "zod";
50
46
  var UrlSchema2 = z2.string().refine(
51
47
  (val) => {
@@ -70,44 +66,14 @@ var ConvexUpdate = z2.object({
70
66
  time_remaining_in_drive: z2.number().describe("Seconds remaining in current drive period"),
71
67
  driver_current_location_latitude: z2.number().describe("Driver's current latitude"),
72
68
  driver_current_location_longitude: z2.number().describe("Driver's current longitude"),
73
- driver_current_location_address: z2.string().describe("Driver's current address")
69
+ driver_current_location_address: z2.string().describe("Driver's current address"),
70
+ license_number: z2.string().optional().describe("The driver's license number"),
71
+ license_state: z2.string().optional().describe("The state that issued the driver's license"),
72
+ speed: z2.number().optional().describe("The vehicle's current speed in mph"),
73
+ odometer: z2.number().optional().describe("The vehicle's current odometer reading in miles"),
74
+ convex_provider_account_id: z2.string().describe("The Convex ELD provider account ID"),
75
+ external_provider_account_id: z2.string().describe("The provider account ID on backend")
74
76
  }).describe("Schema for updating driver ELD status information");
75
- var HoursOfService = z2.object({
76
- timeRemainingInShift: z2.number().describe("Seconds remaining in current shift"),
77
- timeRemainingTillBreak: z2.number().describe("Seconds remaining until next required break"),
78
- timeRemainingInWeek: z2.number().describe("Seconds remaining in current cycle/week"),
79
- timeRemainingInDrive: z2.number().describe("Seconds remaining in current drive period")
80
- }).describe("Schema for driver's hours of service information");
81
- var DriverLocation = z2.object({
82
- latitude: z2.number().describe("Driver's current latitude"),
83
- longitude: z2.number().describe("Driver's current longitude"),
84
- address: z2.string().describe("Driver's current address")
85
- }).describe("Schema for driver's current location information");
86
- var DriverStatus = z2.object({
87
- status: z2.string().describe("The driver's duty status (direct from ELD)")
88
- }).describe("Schema for driver's current duty status information");
89
- var DriverLogin = z2.object({
90
- providerUrl: UrlSchema2.describe("The URL of the ELD provider"),
91
- username: z2.string().describe("The driver's login username"),
92
- password: z2.string().describe("The driver's login password")
93
- }).describe("Schema for driver login information");
94
- var DriverIdentity = z2.object({
95
- driverId: z2.string().describe("The ELD's internal driver ID"),
96
- driverFirstName: z2.string().optional().describe("The driver's first name"),
97
- driverLastName: z2.string().optional().describe("The driver's last name"),
98
- driverName: z2.string().optional().describe("The driver's full name")
99
- }).describe("Schema for identifying the driver");
100
- var VehicleIdentity = z2.object({
101
- vehicleId: z2.string().optional().describe("The vehicle ID")
102
- }).describe("Schema for identifying the vehicle");
103
- var ConvexUpdateNested = z2.object({
104
- driver: DriverIdentity,
105
- vehicle: VehicleIdentity,
106
- hoursOfService: HoursOfService,
107
- driverLocation: DriverLocation,
108
- driverStatus: DriverStatus,
109
- driverLogin: DriverLogin
110
- }).describe("Nested schema for updating driver ELD status information");
111
77
 
112
78
  // src/security/transit-crypto.ts
113
79
  import { publicEncrypt, privateDecrypt, constants } from "crypto";
@@ -135,7 +101,7 @@ function decryptRsaOaepSha256B64(ciphertextB64, privateKeyPem, passphrase) {
135
101
  return plaintext.toString("utf8");
136
102
  }
137
103
 
138
- // src/schemas/update-status.ts
104
+ // src/schemas/providerAccounts/update-status.ts
139
105
  import z3 from "zod";
140
106
  var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
141
107
  ScrapeStatus2["NEW_LOGIN_RECEIVED"] = "NEW_LOGIN_RECEIVED";
@@ -149,24 +115,31 @@ var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
149
115
  })(ScrapeStatus || {});
150
116
  var UpdateScrapeStatusMessage = z3.object({
151
117
  status: z3.nativeEnum(ScrapeStatus).describe("The current status of the scrape process"),
152
- username: z3.string().describe("The username of the driver whose status is being updated"),
118
+ externalProviderAccountId: z3.string().describe("The external identifier for the provider account"),
119
+ username: z3.string().describe("The username of the provider account whose status is being updated"),
153
120
  provider_url: z3.string().describe("The URL of the ELD provider")
154
121
  }).describe("Schema for update status messages");
122
+
123
+ // src/schemas/providerAccounts/validate-password.ts
124
+ import { z as z4 } from "zod";
125
+ var ValidatePasswordRequestSchema = z4.object({
126
+ providerAccountId: z4.string().min(1).describe("The unique identifier of the provider account in postgres to validate the password for"),
127
+ encryptedPassword: z4.string().min(1).describe("The encrypted password to validate against the stored password")
128
+ }).describe("Request schema for validating a provider account password");
129
+ var ValidatePasswordResponseSchema = z4.object({
130
+ isValid: z4.boolean().describe("Indicates if the provided password is valid"),
131
+ driverIds: z4.array(z4.string()).describe("List of driver IDs associated with the provider account")
132
+ }).describe("Response schema for password validation");
155
133
  export {
156
134
  ConvexUpdate,
157
- ConvexUpdateNested,
158
- DriverIdentity,
159
- DriverLocation,
160
- DriverLogin,
161
- DriverStatus,
162
- HoursOfService,
163
135
  NewLoginRequest,
164
136
  NewLoginResponse,
165
137
  NewLoginResponseFailure,
166
138
  NewLoginResponseSuccess,
167
139
  ScrapeStatus,
168
140
  UpdateScrapeStatusMessage,
169
- VehicleIdentity,
141
+ ValidatePasswordRequestSchema,
142
+ ValidatePasswordResponseSchema,
170
143
  decryptRsaOaepSha256B64,
171
144
  encryptRsaOaepSha256ToB64
172
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/shared-schemas",
3
- "version": "0.15.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",