@findatruck/shared-schemas 2.9.0 → 2.9.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 +43 -0
- package/dist/index.d.cts +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +37 -0
- package/package.json +1 -3
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,9 @@ __export(index_exports, {
|
|
|
35
35
|
ConvexDriverSchema: () => ConvexDriverSchema,
|
|
36
36
|
ConvexUpdate: () => ConvexUpdate,
|
|
37
37
|
ConvexUpdateSchema: () => ConvexUpdateSchema,
|
|
38
|
+
DriverRankingSchema: () => DriverRankingSchema,
|
|
39
|
+
DriverRankingsRequestSchema: () => DriverRankingsRequestSchema,
|
|
40
|
+
DriverRankingsResponseSchema: () => DriverRankingsResponseSchema,
|
|
38
41
|
NewLoginRequest: () => NewLoginRequest,
|
|
39
42
|
NewLoginRequestSchema: () => NewLoginRequestSchema,
|
|
40
43
|
NewLoginResponse: () => NewLoginResponse,
|
|
@@ -44,6 +47,9 @@ __export(index_exports, {
|
|
|
44
47
|
NewLoginResponseSuccess: () => NewLoginResponseSuccess,
|
|
45
48
|
NewLoginResponseSuccessSchema: () => NewLoginResponseSuccessSchema,
|
|
46
49
|
ScrapeStatus: () => ScrapeStatus,
|
|
50
|
+
StateHeatmapEntrySchema: () => StateHeatmapEntrySchema,
|
|
51
|
+
StateHeatmapRequestSchema: () => StateHeatmapRequestSchema,
|
|
52
|
+
StateHeatmapResponseSchema: () => StateHeatmapResponseSchema,
|
|
47
53
|
UpdateScrapeStatusMessage: () => UpdateScrapeStatusMessage,
|
|
48
54
|
ValidatePasswordRequestSchema: () => ValidatePasswordRequestSchema,
|
|
49
55
|
ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema,
|
|
@@ -205,6 +211,37 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
|
|
|
205
211
|
isValid: import_zod4.z.boolean().describe("Indicates if the provided password is valid"),
|
|
206
212
|
driverIds: import_zod4.z.array(import_zod4.z.string()).describe("List of driver IDs associated with the provider account")
|
|
207
213
|
}).describe("Response schema for password validation");
|
|
214
|
+
|
|
215
|
+
// src/schemas/telemetry/driver-rankings.ts
|
|
216
|
+
var import_zod5 = require("zod");
|
|
217
|
+
var DriverRankingsRequestSchema = import_zod5.z.object({
|
|
218
|
+
start_date: import_zod5.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
|
|
219
|
+
end_date: import_zod5.z.string().describe("End date for the ranking period (ISO 8601 format)"),
|
|
220
|
+
state: import_zod5.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
|
|
221
|
+
}).describe("Request schema for driver rankings by miles driven");
|
|
222
|
+
var DriverRankingSchema = import_zod5.z.object({
|
|
223
|
+
rank: import_zod5.z.number().int().positive().describe("Rank position based on miles driven"),
|
|
224
|
+
driver_id: import_zod5.z.string().uuid().describe("Unique identifier of the driver"),
|
|
225
|
+
driver_name: import_zod5.z.string().describe("Name of the driver"),
|
|
226
|
+
total_miles: import_zod5.z.number().min(0).describe("Total miles driven in the specified period")
|
|
227
|
+
}).describe("Single driver ranking entry");
|
|
228
|
+
var DriverRankingsResponseSchema = import_zod5.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
|
|
229
|
+
|
|
230
|
+
// src/schemas/telemetry/state-heatmap.ts
|
|
231
|
+
var import_zod6 = require("zod");
|
|
232
|
+
var StateHeatmapRequestSchema = import_zod6.z.object({
|
|
233
|
+
driver_id: import_zod6.z.string().uuid().describe("Unique identifier of the driver"),
|
|
234
|
+
start_date: import_zod6.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
|
|
235
|
+
end_date: import_zod6.z.string().describe("End date for the heatmap period (ISO 8601 format)")
|
|
236
|
+
}).describe("Request schema for driver state heatmap");
|
|
237
|
+
var StateHeatmapEntrySchema = import_zod6.z.object({
|
|
238
|
+
count: import_zod6.z.number().int().min(0).describe("Number of telemetry points in this state"),
|
|
239
|
+
percentage: import_zod6.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
|
|
240
|
+
}).describe("Single state entry in the heatmap");
|
|
241
|
+
var StateHeatmapResponseSchema = import_zod6.z.record(
|
|
242
|
+
import_zod6.z.string().length(2),
|
|
243
|
+
StateHeatmapEntrySchema
|
|
244
|
+
).describe("Record of 2-letter state codes to heatmap entries");
|
|
208
245
|
// Annotate the CommonJS export names for ESM import in node:
|
|
209
246
|
0 && (module.exports = {
|
|
210
247
|
BatchConvexUpdate,
|
|
@@ -212,6 +249,9 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
|
|
|
212
249
|
ConvexDriverSchema,
|
|
213
250
|
ConvexUpdate,
|
|
214
251
|
ConvexUpdateSchema,
|
|
252
|
+
DriverRankingSchema,
|
|
253
|
+
DriverRankingsRequestSchema,
|
|
254
|
+
DriverRankingsResponseSchema,
|
|
215
255
|
NewLoginRequest,
|
|
216
256
|
NewLoginRequestSchema,
|
|
217
257
|
NewLoginResponse,
|
|
@@ -221,6 +261,9 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
|
|
|
221
261
|
NewLoginResponseSuccess,
|
|
222
262
|
NewLoginResponseSuccessSchema,
|
|
223
263
|
ScrapeStatus,
|
|
264
|
+
StateHeatmapEntrySchema,
|
|
265
|
+
StateHeatmapRequestSchema,
|
|
266
|
+
StateHeatmapResponseSchema,
|
|
224
267
|
UpdateScrapeStatusMessage,
|
|
225
268
|
ValidatePasswordRequestSchema,
|
|
226
269
|
ValidatePasswordResponseSchema,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,67 @@
|
|
|
1
1
|
export { BatchConvexUpdate, BatchConvexUpdateData, BatchConvexUpdateSchema, ConvexDriverData, ConvexDriverSchema, ConvexUpdate, ConvexUpdateData, ConvexUpdateSchema, NewLoginRequest, NewLoginRequestData, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseData, NewLoginResponseFailure, NewLoginResponseFailureData, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessData, NewLoginResponseSuccessSchema, PublicProviderData, PublicUserData, ScrapeStatus, UpdateScrapeStatusMessage, ValidatePasswordRequest, ValidatePasswordRequestData, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseData, ValidatePasswordResponseSchema } from './browser.cjs';
|
|
2
|
-
import 'zod';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
|
|
5
5
|
declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface DriverRankingsRequestData {
|
|
8
|
+
start_date: string;
|
|
9
|
+
end_date: string;
|
|
10
|
+
state?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DriverRankingData {
|
|
13
|
+
rank: number;
|
|
14
|
+
driver_id: string;
|
|
15
|
+
driver_name: string;
|
|
16
|
+
total_miles: number;
|
|
17
|
+
}
|
|
18
|
+
type DriverRankingsResponseData = DriverRankingData[];
|
|
19
|
+
declare const DriverRankingsRequestSchema: z.ZodObject<{
|
|
20
|
+
start_date: z.ZodString;
|
|
21
|
+
end_date: z.ZodString;
|
|
22
|
+
state: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
declare const DriverRankingSchema: z.ZodObject<{
|
|
25
|
+
rank: z.ZodNumber;
|
|
26
|
+
driver_id: z.ZodString;
|
|
27
|
+
driver_name: z.ZodString;
|
|
28
|
+
total_miles: z.ZodNumber;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
declare const DriverRankingsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
31
|
+
rank: z.ZodNumber;
|
|
32
|
+
driver_id: z.ZodString;
|
|
33
|
+
driver_name: z.ZodString;
|
|
34
|
+
total_miles: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
type DriverRankingsRequest = DriverRankingsRequestData;
|
|
37
|
+
type DriverRanking = DriverRankingData;
|
|
38
|
+
type DriverRankingsResponse = DriverRankingsResponseData;
|
|
39
|
+
|
|
40
|
+
interface StateHeatmapRequestData {
|
|
41
|
+
driver_id: string;
|
|
42
|
+
start_date: string;
|
|
43
|
+
end_date: string;
|
|
44
|
+
}
|
|
45
|
+
interface StateHeatmapEntryData {
|
|
46
|
+
count: number;
|
|
47
|
+
percentage: number;
|
|
48
|
+
}
|
|
49
|
+
type StateHeatmapResponseData = Record<string, StateHeatmapEntryData>;
|
|
50
|
+
declare const StateHeatmapRequestSchema: z.ZodObject<{
|
|
51
|
+
driver_id: z.ZodString;
|
|
52
|
+
start_date: z.ZodString;
|
|
53
|
+
end_date: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
declare const StateHeatmapEntrySchema: z.ZodObject<{
|
|
56
|
+
count: z.ZodNumber;
|
|
57
|
+
percentage: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const StateHeatmapResponseSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
60
|
+
count: z.ZodNumber;
|
|
61
|
+
percentage: z.ZodNumber;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
type StateHeatmapRequest = StateHeatmapRequestData;
|
|
64
|
+
type StateHeatmapEntry = StateHeatmapEntryData;
|
|
65
|
+
type StateHeatmapResponse = StateHeatmapResponseData;
|
|
66
|
+
|
|
67
|
+
export { type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,67 @@
|
|
|
1
1
|
export { BatchConvexUpdate, BatchConvexUpdateData, BatchConvexUpdateSchema, ConvexDriverData, ConvexDriverSchema, ConvexUpdate, ConvexUpdateData, ConvexUpdateSchema, NewLoginRequest, NewLoginRequestData, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseData, NewLoginResponseFailure, NewLoginResponseFailureData, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessData, NewLoginResponseSuccessSchema, PublicProviderData, PublicUserData, ScrapeStatus, UpdateScrapeStatusMessage, ValidatePasswordRequest, ValidatePasswordRequestData, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseData, ValidatePasswordResponseSchema } from './browser.js';
|
|
2
|
-
import 'zod';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
|
|
5
5
|
declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface DriverRankingsRequestData {
|
|
8
|
+
start_date: string;
|
|
9
|
+
end_date: string;
|
|
10
|
+
state?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DriverRankingData {
|
|
13
|
+
rank: number;
|
|
14
|
+
driver_id: string;
|
|
15
|
+
driver_name: string;
|
|
16
|
+
total_miles: number;
|
|
17
|
+
}
|
|
18
|
+
type DriverRankingsResponseData = DriverRankingData[];
|
|
19
|
+
declare const DriverRankingsRequestSchema: z.ZodObject<{
|
|
20
|
+
start_date: z.ZodString;
|
|
21
|
+
end_date: z.ZodString;
|
|
22
|
+
state: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
declare const DriverRankingSchema: z.ZodObject<{
|
|
25
|
+
rank: z.ZodNumber;
|
|
26
|
+
driver_id: z.ZodString;
|
|
27
|
+
driver_name: z.ZodString;
|
|
28
|
+
total_miles: z.ZodNumber;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
declare const DriverRankingsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
31
|
+
rank: z.ZodNumber;
|
|
32
|
+
driver_id: z.ZodString;
|
|
33
|
+
driver_name: z.ZodString;
|
|
34
|
+
total_miles: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
type DriverRankingsRequest = DriverRankingsRequestData;
|
|
37
|
+
type DriverRanking = DriverRankingData;
|
|
38
|
+
type DriverRankingsResponse = DriverRankingsResponseData;
|
|
39
|
+
|
|
40
|
+
interface StateHeatmapRequestData {
|
|
41
|
+
driver_id: string;
|
|
42
|
+
start_date: string;
|
|
43
|
+
end_date: string;
|
|
44
|
+
}
|
|
45
|
+
interface StateHeatmapEntryData {
|
|
46
|
+
count: number;
|
|
47
|
+
percentage: number;
|
|
48
|
+
}
|
|
49
|
+
type StateHeatmapResponseData = Record<string, StateHeatmapEntryData>;
|
|
50
|
+
declare const StateHeatmapRequestSchema: z.ZodObject<{
|
|
51
|
+
driver_id: z.ZodString;
|
|
52
|
+
start_date: z.ZodString;
|
|
53
|
+
end_date: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
declare const StateHeatmapEntrySchema: z.ZodObject<{
|
|
56
|
+
count: z.ZodNumber;
|
|
57
|
+
percentage: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const StateHeatmapResponseSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
60
|
+
count: z.ZodNumber;
|
|
61
|
+
percentage: z.ZodNumber;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
type StateHeatmapRequest = StateHeatmapRequestData;
|
|
64
|
+
type StateHeatmapEntry = StateHeatmapEntryData;
|
|
65
|
+
type StateHeatmapResponse = StateHeatmapResponseData;
|
|
66
|
+
|
|
67
|
+
export { type DriverRanking, type DriverRankingData, DriverRankingSchema, type DriverRankingsRequest, type DriverRankingsRequestData, DriverRankingsRequestSchema, type DriverRankingsResponse, type DriverRankingsResponseData, DriverRankingsResponseSchema, type StateHeatmapEntry, type StateHeatmapEntryData, StateHeatmapEntrySchema, type StateHeatmapRequest, type StateHeatmapRequestData, StateHeatmapRequestSchema, type StateHeatmapResponse, type StateHeatmapResponseData, StateHeatmapResponseSchema, decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
|
package/dist/index.js
CHANGED
|
@@ -43,12 +43,46 @@ function decryptRsaOaepSha256B64(ciphertextB64, privateKeyPem, passphrase) {
|
|
|
43
43
|
);
|
|
44
44
|
return plaintext.toString("utf8");
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
// src/schemas/telemetry/driver-rankings.ts
|
|
48
|
+
import { z } from "zod";
|
|
49
|
+
var DriverRankingsRequestSchema = z.object({
|
|
50
|
+
start_date: z.string().describe("Start date for the ranking period (ISO 8601 format)"),
|
|
51
|
+
end_date: z.string().describe("End date for the ranking period (ISO 8601 format)"),
|
|
52
|
+
state: z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
|
|
53
|
+
}).describe("Request schema for driver rankings by miles driven");
|
|
54
|
+
var DriverRankingSchema = z.object({
|
|
55
|
+
rank: z.number().int().positive().describe("Rank position based on miles driven"),
|
|
56
|
+
driver_id: z.string().uuid().describe("Unique identifier of the driver"),
|
|
57
|
+
driver_name: z.string().describe("Name of the driver"),
|
|
58
|
+
total_miles: z.number().min(0).describe("Total miles driven in the specified period")
|
|
59
|
+
}).describe("Single driver ranking entry");
|
|
60
|
+
var DriverRankingsResponseSchema = z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
|
|
61
|
+
|
|
62
|
+
// src/schemas/telemetry/state-heatmap.ts
|
|
63
|
+
import { z as z2 } from "zod";
|
|
64
|
+
var StateHeatmapRequestSchema = z2.object({
|
|
65
|
+
driver_id: z2.string().uuid().describe("Unique identifier of the driver"),
|
|
66
|
+
start_date: z2.string().describe("Start date for the heatmap period (ISO 8601 format)"),
|
|
67
|
+
end_date: z2.string().describe("End date for the heatmap period (ISO 8601 format)")
|
|
68
|
+
}).describe("Request schema for driver state heatmap");
|
|
69
|
+
var StateHeatmapEntrySchema = z2.object({
|
|
70
|
+
count: z2.number().int().min(0).describe("Number of telemetry points in this state"),
|
|
71
|
+
percentage: z2.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
|
|
72
|
+
}).describe("Single state entry in the heatmap");
|
|
73
|
+
var StateHeatmapResponseSchema = z2.record(
|
|
74
|
+
z2.string().length(2),
|
|
75
|
+
StateHeatmapEntrySchema
|
|
76
|
+
).describe("Record of 2-letter state codes to heatmap entries");
|
|
46
77
|
export {
|
|
47
78
|
BatchConvexUpdate,
|
|
48
79
|
BatchConvexUpdateSchema,
|
|
49
80
|
ConvexDriverSchema,
|
|
50
81
|
ConvexUpdate,
|
|
51
82
|
ConvexUpdateSchema,
|
|
83
|
+
DriverRankingSchema,
|
|
84
|
+
DriverRankingsRequestSchema,
|
|
85
|
+
DriverRankingsResponseSchema,
|
|
52
86
|
NewLoginRequest,
|
|
53
87
|
NewLoginRequestSchema,
|
|
54
88
|
NewLoginResponse,
|
|
@@ -58,6 +92,9 @@ export {
|
|
|
58
92
|
NewLoginResponseSuccess,
|
|
59
93
|
NewLoginResponseSuccessSchema,
|
|
60
94
|
ScrapeStatus,
|
|
95
|
+
StateHeatmapEntrySchema,
|
|
96
|
+
StateHeatmapRequestSchema,
|
|
97
|
+
StateHeatmapResponseSchema,
|
|
61
98
|
UpdateScrapeStatusMessage,
|
|
62
99
|
ValidatePasswordRequestSchema,
|
|
63
100
|
ValidatePasswordResponseSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findatruck/shared-schemas",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup src/index.ts src/browser.ts --dts --format esm,cjs --out-dir dist --clean",
|
|
26
26
|
"prepublishOnly": "npm run build",
|
|
27
|
-
"prepare": "npm run build",
|
|
28
27
|
"test": "vitest run",
|
|
29
28
|
"test:watch": "vitest",
|
|
30
29
|
"coverage": "vitest run --coverage"
|
|
@@ -33,7 +32,6 @@
|
|
|
33
32
|
"zod": "^4.1.11"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
|
-
"@changesets/cli": "^2.29.7",
|
|
37
35
|
"@types/node": "^24.7.0",
|
|
38
36
|
"tsup": "^8.0.0",
|
|
39
37
|
"typescript": "^5.9.3",
|