@findatruck/shared-schemas 0.15.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -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,25 @@
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
  }>;
34
22
  declare const NewLoginResponseSuccess: z.ZodObject<{
35
- success: z.ZodLiteral<true>;
36
23
  message: z.ZodString;
37
24
  user: z.ZodObject<{
38
25
  id: z.ZodString;
@@ -65,7 +52,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
65
52
  honkUserId: z.ZodOptional<z.ZodString>;
66
53
  }, "strip", z.ZodTypeAny, {
67
54
  message: string;
68
- success: true;
69
55
  user: {
70
56
  username: string;
71
57
  id: string;
@@ -81,7 +67,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
81
67
  honkUserId?: string | undefined;
82
68
  }, {
83
69
  message: string;
84
- success: true;
85
70
  user: {
86
71
  username: string;
87
72
  id: string;
@@ -97,17 +82,13 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
97
82
  honkUserId?: string | undefined;
98
83
  }>;
99
84
  declare const NewLoginResponseFailure: z.ZodObject<{
100
- success: z.ZodLiteral<false>;
101
85
  error: z.ZodString;
102
86
  }, "strip", z.ZodTypeAny, {
103
- success: false;
104
87
  error: string;
105
88
  }, {
106
- success: false;
107
89
  error: string;
108
90
  }>;
109
91
  declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
110
- success: z.ZodLiteral<true>;
111
92
  message: z.ZodString;
112
93
  user: z.ZodObject<{
113
94
  id: z.ZodString;
@@ -140,7 +121,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
140
121
  honkUserId: z.ZodOptional<z.ZodString>;
141
122
  }, "strip", z.ZodTypeAny, {
142
123
  message: string;
143
- success: true;
144
124
  user: {
145
125
  username: string;
146
126
  id: string;
@@ -156,7 +136,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
156
136
  honkUserId?: string | undefined;
157
137
  }, {
158
138
  message: string;
159
- success: true;
160
139
  user: {
161
140
  username: string;
162
141
  id: string;
@@ -171,13 +150,10 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
171
150
  organizationId?: string | undefined;
172
151
  honkUserId?: string | undefined;
173
152
  }>, z.ZodObject<{
174
- success: z.ZodLiteral<false>;
175
153
  error: z.ZodString;
176
154
  }, "strip", z.ZodTypeAny, {
177
- success: false;
178
155
  error: string;
179
156
  }, {
180
- success: false;
181
157
  error: string;
182
158
  }>]>;
183
159
 
@@ -194,9 +170,15 @@ declare const ConvexUpdate: z$1.ZodObject<{
194
170
  driver_current_location_latitude: z$1.ZodNumber;
195
171
  driver_current_location_longitude: z$1.ZodNumber;
196
172
  driver_current_location_address: z$1.ZodString;
173
+ license_number: z$1.ZodOptional<z$1.ZodString>;
174
+ license_state: z$1.ZodOptional<z$1.ZodString>;
175
+ speed: z$1.ZodOptional<z$1.ZodNumber>;
176
+ odometer: z$1.ZodOptional<z$1.ZodNumber>;
177
+ convex_provider_account_id: z$1.ZodString;
178
+ external_provider_account_id: z$1.ZodString;
197
179
  }, "strip", z$1.ZodTypeAny, {
198
- provider_url: string;
199
180
  username: string;
181
+ provider_url: string;
200
182
  driver_status: string;
201
183
  time_remaining_in_shift: number;
202
184
  time_remaining_till_break: number;
@@ -205,11 +187,17 @@ declare const ConvexUpdate: z$1.ZodObject<{
205
187
  driver_current_location_latitude: number;
206
188
  driver_current_location_longitude: number;
207
189
  driver_current_location_address: string;
190
+ convex_provider_account_id: string;
191
+ external_provider_account_id: string;
208
192
  driver_name?: string | undefined;
209
193
  vehicle_id?: string | undefined;
194
+ license_number?: string | undefined;
195
+ license_state?: string | undefined;
196
+ speed?: number | undefined;
197
+ odometer?: number | undefined;
210
198
  }, {
211
- provider_url: string;
212
199
  username: string;
200
+ provider_url: string;
213
201
  driver_status: string;
214
202
  time_remaining_in_shift: number;
215
203
  time_remaining_till_break: number;
@@ -218,221 +206,16 @@ declare const ConvexUpdate: z$1.ZodObject<{
218
206
  driver_current_location_latitude: number;
219
207
  driver_current_location_longitude: number;
220
208
  driver_current_location_address: string;
209
+ convex_provider_account_id: string;
210
+ external_provider_account_id: string;
221
211
  driver_name?: string | undefined;
222
212
  vehicle_id?: string | undefined;
213
+ license_number?: string | undefined;
214
+ license_state?: string | undefined;
215
+ speed?: number | undefined;
216
+ odometer?: number | undefined;
223
217
  }>;
224
218
  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
219
 
437
220
  declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
438
221
  declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
@@ -448,17 +231,43 @@ declare enum ScrapeStatus {
448
231
  }
449
232
  declare const UpdateScrapeStatusMessage: z$1.ZodObject<{
450
233
  status: z$1.ZodNativeEnum<typeof ScrapeStatus>;
234
+ externalProviderAccountId: z$1.ZodString;
451
235
  username: z$1.ZodString;
452
236
  provider_url: z$1.ZodString;
453
237
  }, "strip", z$1.ZodTypeAny, {
454
- provider_url: string;
455
238
  username: string;
239
+ externalProviderAccountId: string;
456
240
  status: ScrapeStatus;
457
- }, {
458
241
  provider_url: string;
242
+ }, {
459
243
  username: string;
244
+ externalProviderAccountId: string;
460
245
  status: ScrapeStatus;
246
+ provider_url: string;
461
247
  }>;
462
248
  type UpdateScrapeStatusMessage = z$1.infer<typeof UpdateScrapeStatusMessage>;
463
249
 
464
- export { ConvexUpdate, ConvexUpdateNested, DriverIdentity, DriverLocation, DriverLogin, DriverStatus, HoursOfService, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, VehicleIdentity, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
250
+ declare const ValidatePasswordRequestSchema: z.ZodObject<{
251
+ providerAccountId: z.ZodString;
252
+ encryptedPassword: z.ZodString;
253
+ }, "strip", z.ZodTypeAny, {
254
+ encryptedPassword: string;
255
+ providerAccountId: string;
256
+ }, {
257
+ encryptedPassword: string;
258
+ providerAccountId: string;
259
+ }>;
260
+ type ValidatePasswordRequest = z.infer<typeof ValidatePasswordRequestSchema>;
261
+ declare const ValidatePasswordResponseSchema: z.ZodObject<{
262
+ isValid: z.ZodBoolean;
263
+ driverIds: z.ZodArray<z.ZodString, "many">;
264
+ }, "strip", z.ZodTypeAny, {
265
+ driverIds: string[];
266
+ isValid: boolean;
267
+ }, {
268
+ driverIds: string[];
269
+ isValid: boolean;
270
+ }>;
271
+ type ValidatePasswordResponse = z.infer<typeof ValidatePasswordResponseSchema>;
272
+
273
+ 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,25 @@
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
  }>;
34
22
  declare const NewLoginResponseSuccess: z.ZodObject<{
35
- success: z.ZodLiteral<true>;
36
23
  message: z.ZodString;
37
24
  user: z.ZodObject<{
38
25
  id: z.ZodString;
@@ -65,7 +52,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
65
52
  honkUserId: z.ZodOptional<z.ZodString>;
66
53
  }, "strip", z.ZodTypeAny, {
67
54
  message: string;
68
- success: true;
69
55
  user: {
70
56
  username: string;
71
57
  id: string;
@@ -81,7 +67,6 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
81
67
  honkUserId?: string | undefined;
82
68
  }, {
83
69
  message: string;
84
- success: true;
85
70
  user: {
86
71
  username: string;
87
72
  id: string;
@@ -97,17 +82,13 @@ declare const NewLoginResponseSuccess: z.ZodObject<{
97
82
  honkUserId?: string | undefined;
98
83
  }>;
99
84
  declare const NewLoginResponseFailure: z.ZodObject<{
100
- success: z.ZodLiteral<false>;
101
85
  error: z.ZodString;
102
86
  }, "strip", z.ZodTypeAny, {
103
- success: false;
104
87
  error: string;
105
88
  }, {
106
- success: false;
107
89
  error: string;
108
90
  }>;
109
91
  declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
110
- success: z.ZodLiteral<true>;
111
92
  message: z.ZodString;
112
93
  user: z.ZodObject<{
113
94
  id: z.ZodString;
@@ -140,7 +121,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
140
121
  honkUserId: z.ZodOptional<z.ZodString>;
141
122
  }, "strip", z.ZodTypeAny, {
142
123
  message: string;
143
- success: true;
144
124
  user: {
145
125
  username: string;
146
126
  id: string;
@@ -156,7 +136,6 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
156
136
  honkUserId?: string | undefined;
157
137
  }, {
158
138
  message: string;
159
- success: true;
160
139
  user: {
161
140
  username: string;
162
141
  id: string;
@@ -171,13 +150,10 @@ declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
171
150
  organizationId?: string | undefined;
172
151
  honkUserId?: string | undefined;
173
152
  }>, z.ZodObject<{
174
- success: z.ZodLiteral<false>;
175
153
  error: z.ZodString;
176
154
  }, "strip", z.ZodTypeAny, {
177
- success: false;
178
155
  error: string;
179
156
  }, {
180
- success: false;
181
157
  error: string;
182
158
  }>]>;
183
159
 
@@ -194,9 +170,15 @@ declare const ConvexUpdate: z$1.ZodObject<{
194
170
  driver_current_location_latitude: z$1.ZodNumber;
195
171
  driver_current_location_longitude: z$1.ZodNumber;
196
172
  driver_current_location_address: z$1.ZodString;
173
+ license_number: z$1.ZodOptional<z$1.ZodString>;
174
+ license_state: z$1.ZodOptional<z$1.ZodString>;
175
+ speed: z$1.ZodOptional<z$1.ZodNumber>;
176
+ odometer: z$1.ZodOptional<z$1.ZodNumber>;
177
+ convex_provider_account_id: z$1.ZodString;
178
+ external_provider_account_id: z$1.ZodString;
197
179
  }, "strip", z$1.ZodTypeAny, {
198
- provider_url: string;
199
180
  username: string;
181
+ provider_url: string;
200
182
  driver_status: string;
201
183
  time_remaining_in_shift: number;
202
184
  time_remaining_till_break: number;
@@ -205,11 +187,17 @@ declare const ConvexUpdate: z$1.ZodObject<{
205
187
  driver_current_location_latitude: number;
206
188
  driver_current_location_longitude: number;
207
189
  driver_current_location_address: string;
190
+ convex_provider_account_id: string;
191
+ external_provider_account_id: string;
208
192
  driver_name?: string | undefined;
209
193
  vehicle_id?: string | undefined;
194
+ license_number?: string | undefined;
195
+ license_state?: string | undefined;
196
+ speed?: number | undefined;
197
+ odometer?: number | undefined;
210
198
  }, {
211
- provider_url: string;
212
199
  username: string;
200
+ provider_url: string;
213
201
  driver_status: string;
214
202
  time_remaining_in_shift: number;
215
203
  time_remaining_till_break: number;
@@ -218,221 +206,16 @@ declare const ConvexUpdate: z$1.ZodObject<{
218
206
  driver_current_location_latitude: number;
219
207
  driver_current_location_longitude: number;
220
208
  driver_current_location_address: string;
209
+ convex_provider_account_id: string;
210
+ external_provider_account_id: string;
221
211
  driver_name?: string | undefined;
222
212
  vehicle_id?: string | undefined;
213
+ license_number?: string | undefined;
214
+ license_state?: string | undefined;
215
+ speed?: number | undefined;
216
+ odometer?: number | undefined;
223
217
  }>;
224
218
  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
219
 
437
220
  declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
438
221
  declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
@@ -448,17 +231,43 @@ declare enum ScrapeStatus {
448
231
  }
449
232
  declare const UpdateScrapeStatusMessage: z$1.ZodObject<{
450
233
  status: z$1.ZodNativeEnum<typeof ScrapeStatus>;
234
+ externalProviderAccountId: z$1.ZodString;
451
235
  username: z$1.ZodString;
452
236
  provider_url: z$1.ZodString;
453
237
  }, "strip", z$1.ZodTypeAny, {
454
- provider_url: string;
455
238
  username: string;
239
+ externalProviderAccountId: string;
456
240
  status: ScrapeStatus;
457
- }, {
458
241
  provider_url: string;
242
+ }, {
459
243
  username: string;
244
+ externalProviderAccountId: string;
460
245
  status: ScrapeStatus;
246
+ provider_url: string;
461
247
  }>;
462
248
  type UpdateScrapeStatusMessage = z$1.infer<typeof UpdateScrapeStatusMessage>;
463
249
 
464
- export { ConvexUpdate, ConvexUpdateNested, DriverIdentity, DriverLocation, DriverLogin, DriverStatus, HoursOfService, NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess, ScrapeStatus, UpdateScrapeStatusMessage, VehicleIdentity, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
250
+ declare const ValidatePasswordRequestSchema: z.ZodObject<{
251
+ providerAccountId: z.ZodString;
252
+ encryptedPassword: z.ZodString;
253
+ }, "strip", z.ZodTypeAny, {
254
+ encryptedPassword: string;
255
+ providerAccountId: string;
256
+ }, {
257
+ encryptedPassword: string;
258
+ providerAccountId: string;
259
+ }>;
260
+ type ValidatePasswordRequest = z.infer<typeof ValidatePasswordRequestSchema>;
261
+ declare const ValidatePasswordResponseSchema: z.ZodObject<{
262
+ isValid: z.ZodBoolean;
263
+ driverIds: z.ZodArray<z.ZodString, "many">;
264
+ }, "strip", z.ZodTypeAny, {
265
+ driverIds: string[];
266
+ isValid: boolean;
267
+ }, {
268
+ driverIds: string[];
269
+ isValid: boolean;
270
+ }>;
271
+ type ValidatePasswordResponse = z.infer<typeof ValidatePasswordResponseSchema>;
272
+
273
+ 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.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",