@findatruck/shared-schemas 2.9.0 → 2.10.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
@@ -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,11 +47,12 @@ __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
- ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema,
50
- decryptRsaOaepSha256B64: () => decryptRsaOaepSha256B64,
51
- encryptRsaOaepSha256ToB64: () => encryptRsaOaepSha256ToB64
55
+ ValidatePasswordResponseSchema: () => ValidatePasswordResponseSchema
52
56
  });
53
57
  module.exports = __toCommonJS(index_exports);
54
58
 
@@ -147,32 +151,6 @@ var BatchConvexUpdateSchema = import_zod2.default.object({
147
151
  var ConvexUpdate = ConvexUpdateSchema;
148
152
  var BatchConvexUpdate = BatchConvexUpdateSchema;
149
153
 
150
- // src/security/transit-crypto.ts
151
- var import_node_crypto = require("crypto");
152
- function encryptRsaOaepSha256ToB64(plaintext, publicKeyPem) {
153
- const ciphertext = (0, import_node_crypto.publicEncrypt)(
154
- {
155
- key: publicKeyPem,
156
- padding: import_node_crypto.constants.RSA_PKCS1_OAEP_PADDING,
157
- oaepHash: "sha256"
158
- },
159
- Buffer.from(plaintext, "utf8")
160
- );
161
- return ciphertext.toString("base64");
162
- }
163
- function decryptRsaOaepSha256B64(ciphertextB64, privateKeyPem, passphrase) {
164
- const plaintext = (0, import_node_crypto.privateDecrypt)(
165
- {
166
- key: privateKeyPem,
167
- passphrase,
168
- padding: import_node_crypto.constants.RSA_PKCS1_OAEP_PADDING,
169
- oaepHash: "sha256"
170
- },
171
- Buffer.from(ciphertextB64, "base64")
172
- );
173
- return plaintext.toString("utf8");
174
- }
175
-
176
154
  // src/schemas/providerAccounts/update-status.ts
177
155
  var import_zod3 = __toESM(require("zod"), 1);
178
156
  var ScrapeStatus = /* @__PURE__ */ ((ScrapeStatus2) => {
@@ -205,6 +183,37 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
205
183
  isValid: import_zod4.z.boolean().describe("Indicates if the provided password is valid"),
206
184
  driverIds: import_zod4.z.array(import_zod4.z.string()).describe("List of driver IDs associated with the provider account")
207
185
  }).describe("Response schema for password validation");
186
+
187
+ // src/schemas/telemetry/driver-rankings.ts
188
+ var import_zod5 = require("zod");
189
+ var DriverRankingsRequestSchema = import_zod5.z.object({
190
+ start_date: import_zod5.z.string().describe("Start date for the ranking period (ISO 8601 format)"),
191
+ end_date: import_zod5.z.string().describe("End date for the ranking period (ISO 8601 format)"),
192
+ state: import_zod5.z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
193
+ }).describe("Request schema for driver rankings by miles driven");
194
+ var DriverRankingSchema = import_zod5.z.object({
195
+ rank: import_zod5.z.number().int().positive().describe("Rank position based on miles driven"),
196
+ driver_id: import_zod5.z.string().uuid().describe("Unique identifier of the driver"),
197
+ driver_name: import_zod5.z.string().describe("Name of the driver"),
198
+ total_miles: import_zod5.z.number().min(0).describe("Total miles driven in the specified period")
199
+ }).describe("Single driver ranking entry");
200
+ var DriverRankingsResponseSchema = import_zod5.z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
201
+
202
+ // src/schemas/telemetry/state-heatmap.ts
203
+ var import_zod6 = require("zod");
204
+ var StateHeatmapRequestSchema = import_zod6.z.object({
205
+ driver_id: import_zod6.z.string().uuid().describe("Unique identifier of the driver"),
206
+ start_date: import_zod6.z.string().describe("Start date for the heatmap period (ISO 8601 format)"),
207
+ end_date: import_zod6.z.string().describe("End date for the heatmap period (ISO 8601 format)")
208
+ }).describe("Request schema for driver state heatmap");
209
+ var StateHeatmapEntrySchema = import_zod6.z.object({
210
+ count: import_zod6.z.number().int().min(0).describe("Number of telemetry points in this state"),
211
+ percentage: import_zod6.z.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
212
+ }).describe("Single state entry in the heatmap");
213
+ var StateHeatmapResponseSchema = import_zod6.z.record(
214
+ import_zod6.z.string().length(2),
215
+ StateHeatmapEntrySchema
216
+ ).describe("Record of 2-letter state codes to heatmap entries");
208
217
  // Annotate the CommonJS export names for ESM import in node:
209
218
  0 && (module.exports = {
210
219
  BatchConvexUpdate,
@@ -212,6 +221,9 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
212
221
  ConvexDriverSchema,
213
222
  ConvexUpdate,
214
223
  ConvexUpdateSchema,
224
+ DriverRankingSchema,
225
+ DriverRankingsRequestSchema,
226
+ DriverRankingsResponseSchema,
215
227
  NewLoginRequest,
216
228
  NewLoginRequestSchema,
217
229
  NewLoginResponse,
@@ -221,9 +233,10 @@ var ValidatePasswordResponseSchema = import_zod4.z.object({
221
233
  NewLoginResponseSuccess,
222
234
  NewLoginResponseSuccessSchema,
223
235
  ScrapeStatus,
236
+ StateHeatmapEntrySchema,
237
+ StateHeatmapRequestSchema,
238
+ StateHeatmapResponseSchema,
224
239
  UpdateScrapeStatusMessage,
225
240
  ValidatePasswordRequestSchema,
226
- ValidatePasswordResponseSchema,
227
- decryptRsaOaepSha256B64,
228
- encryptRsaOaepSha256ToB64
241
+ ValidatePasswordResponseSchema
229
242
  });
package/dist/index.d.cts CHANGED
@@ -1,7 +1,64 @@
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
- declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
5
- declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
4
+ interface DriverRankingsRequestData {
5
+ start_date: string;
6
+ end_date: string;
7
+ state?: string;
8
+ }
9
+ interface DriverRankingData {
10
+ rank: number;
11
+ driver_id: string;
12
+ driver_name: string;
13
+ total_miles: number;
14
+ }
15
+ type DriverRankingsResponseData = DriverRankingData[];
16
+ declare const DriverRankingsRequestSchema: z.ZodObject<{
17
+ start_date: z.ZodString;
18
+ end_date: z.ZodString;
19
+ state: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ declare const DriverRankingSchema: z.ZodObject<{
22
+ rank: z.ZodNumber;
23
+ driver_id: z.ZodString;
24
+ driver_name: z.ZodString;
25
+ total_miles: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ declare const DriverRankingsResponseSchema: z.ZodArray<z.ZodObject<{
28
+ rank: z.ZodNumber;
29
+ driver_id: z.ZodString;
30
+ driver_name: z.ZodString;
31
+ total_miles: z.ZodNumber;
32
+ }, z.core.$strip>>;
33
+ type DriverRankingsRequest = DriverRankingsRequestData;
34
+ type DriverRanking = DriverRankingData;
35
+ type DriverRankingsResponse = DriverRankingsResponseData;
6
36
 
7
- export { decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
37
+ interface StateHeatmapRequestData {
38
+ driver_id: string;
39
+ start_date: string;
40
+ end_date: string;
41
+ }
42
+ interface StateHeatmapEntryData {
43
+ count: number;
44
+ percentage: number;
45
+ }
46
+ type StateHeatmapResponseData = Record<string, StateHeatmapEntryData>;
47
+ declare const StateHeatmapRequestSchema: z.ZodObject<{
48
+ driver_id: z.ZodString;
49
+ start_date: z.ZodString;
50
+ end_date: z.ZodString;
51
+ }, z.core.$strip>;
52
+ declare const StateHeatmapEntrySchema: z.ZodObject<{
53
+ count: z.ZodNumber;
54
+ percentage: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ declare const StateHeatmapResponseSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
57
+ count: z.ZodNumber;
58
+ percentage: z.ZodNumber;
59
+ }, z.core.$strip>>;
60
+ type StateHeatmapRequest = StateHeatmapRequestData;
61
+ type StateHeatmapEntry = StateHeatmapEntryData;
62
+ type StateHeatmapResponse = StateHeatmapResponseData;
63
+
64
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,64 @@
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
- declare function encryptRsaOaepSha256ToB64(plaintext: string, publicKeyPem: string): string;
5
- declare function decryptRsaOaepSha256B64(ciphertextB64: string, privateKeyPem: string, passphrase?: string): string;
4
+ interface DriverRankingsRequestData {
5
+ start_date: string;
6
+ end_date: string;
7
+ state?: string;
8
+ }
9
+ interface DriverRankingData {
10
+ rank: number;
11
+ driver_id: string;
12
+ driver_name: string;
13
+ total_miles: number;
14
+ }
15
+ type DriverRankingsResponseData = DriverRankingData[];
16
+ declare const DriverRankingsRequestSchema: z.ZodObject<{
17
+ start_date: z.ZodString;
18
+ end_date: z.ZodString;
19
+ state: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ declare const DriverRankingSchema: z.ZodObject<{
22
+ rank: z.ZodNumber;
23
+ driver_id: z.ZodString;
24
+ driver_name: z.ZodString;
25
+ total_miles: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ declare const DriverRankingsResponseSchema: z.ZodArray<z.ZodObject<{
28
+ rank: z.ZodNumber;
29
+ driver_id: z.ZodString;
30
+ driver_name: z.ZodString;
31
+ total_miles: z.ZodNumber;
32
+ }, z.core.$strip>>;
33
+ type DriverRankingsRequest = DriverRankingsRequestData;
34
+ type DriverRanking = DriverRankingData;
35
+ type DriverRankingsResponse = DriverRankingsResponseData;
6
36
 
7
- export { decryptRsaOaepSha256B64, encryptRsaOaepSha256ToB64 };
37
+ interface StateHeatmapRequestData {
38
+ driver_id: string;
39
+ start_date: string;
40
+ end_date: string;
41
+ }
42
+ interface StateHeatmapEntryData {
43
+ count: number;
44
+ percentage: number;
45
+ }
46
+ type StateHeatmapResponseData = Record<string, StateHeatmapEntryData>;
47
+ declare const StateHeatmapRequestSchema: z.ZodObject<{
48
+ driver_id: z.ZodString;
49
+ start_date: z.ZodString;
50
+ end_date: z.ZodString;
51
+ }, z.core.$strip>;
52
+ declare const StateHeatmapEntrySchema: z.ZodObject<{
53
+ count: z.ZodNumber;
54
+ percentage: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ declare const StateHeatmapResponseSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
57
+ count: z.ZodNumber;
58
+ percentage: z.ZodNumber;
59
+ }, z.core.$strip>>;
60
+ type StateHeatmapRequest = StateHeatmapRequestData;
61
+ type StateHeatmapEntry = StateHeatmapEntryData;
62
+ type StateHeatmapResponse = StateHeatmapResponseData;
63
+
64
+ 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 };
package/dist/index.js CHANGED
@@ -18,37 +18,45 @@ import {
18
18
  ValidatePasswordResponseSchema
19
19
  } from "./chunk-CUV2KQXS.js";
20
20
 
21
- // src/security/transit-crypto.ts
22
- import { publicEncrypt, privateDecrypt, constants } from "crypto";
23
- function encryptRsaOaepSha256ToB64(plaintext, publicKeyPem) {
24
- const ciphertext = publicEncrypt(
25
- {
26
- key: publicKeyPem,
27
- padding: constants.RSA_PKCS1_OAEP_PADDING,
28
- oaepHash: "sha256"
29
- },
30
- Buffer.from(plaintext, "utf8")
31
- );
32
- return ciphertext.toString("base64");
33
- }
34
- function decryptRsaOaepSha256B64(ciphertextB64, privateKeyPem, passphrase) {
35
- const plaintext = privateDecrypt(
36
- {
37
- key: privateKeyPem,
38
- passphrase,
39
- padding: constants.RSA_PKCS1_OAEP_PADDING,
40
- oaepHash: "sha256"
41
- },
42
- Buffer.from(ciphertextB64, "base64")
43
- );
44
- return plaintext.toString("utf8");
45
- }
21
+ // src/schemas/telemetry/driver-rankings.ts
22
+ import { z } from "zod";
23
+ var DriverRankingsRequestSchema = z.object({
24
+ start_date: z.string().describe("Start date for the ranking period (ISO 8601 format)"),
25
+ end_date: z.string().describe("End date for the ranking period (ISO 8601 format)"),
26
+ state: z.string().length(2).optional().describe("Optional 2-letter state abbreviation to filter telemetry by location")
27
+ }).describe("Request schema for driver rankings by miles driven");
28
+ var DriverRankingSchema = z.object({
29
+ rank: z.number().int().positive().describe("Rank position based on miles driven"),
30
+ driver_id: z.string().uuid().describe("Unique identifier of the driver"),
31
+ driver_name: z.string().describe("Name of the driver"),
32
+ total_miles: z.number().min(0).describe("Total miles driven in the specified period")
33
+ }).describe("Single driver ranking entry");
34
+ var DriverRankingsResponseSchema = z.array(DriverRankingSchema).describe("Array of driver rankings sorted by miles driven in descending order");
35
+
36
+ // src/schemas/telemetry/state-heatmap.ts
37
+ import { z as z2 } from "zod";
38
+ var StateHeatmapRequestSchema = z2.object({
39
+ driver_id: z2.string().uuid().describe("Unique identifier of the driver"),
40
+ start_date: z2.string().describe("Start date for the heatmap period (ISO 8601 format)"),
41
+ end_date: z2.string().describe("End date for the heatmap period (ISO 8601 format)")
42
+ }).describe("Request schema for driver state heatmap");
43
+ var StateHeatmapEntrySchema = z2.object({
44
+ count: z2.number().int().min(0).describe("Number of telemetry points in this state"),
45
+ percentage: z2.number().min(0).max(100).describe("Percentage of total telemetry points in this state")
46
+ }).describe("Single state entry in the heatmap");
47
+ var StateHeatmapResponseSchema = z2.record(
48
+ z2.string().length(2),
49
+ StateHeatmapEntrySchema
50
+ ).describe("Record of 2-letter state codes to heatmap entries");
46
51
  export {
47
52
  BatchConvexUpdate,
48
53
  BatchConvexUpdateSchema,
49
54
  ConvexDriverSchema,
50
55
  ConvexUpdate,
51
56
  ConvexUpdateSchema,
57
+ DriverRankingSchema,
58
+ DriverRankingsRequestSchema,
59
+ DriverRankingsResponseSchema,
52
60
  NewLoginRequest,
53
61
  NewLoginRequestSchema,
54
62
  NewLoginResponse,
@@ -58,9 +66,10 @@ export {
58
66
  NewLoginResponseSuccess,
59
67
  NewLoginResponseSuccessSchema,
60
68
  ScrapeStatus,
69
+ StateHeatmapEntrySchema,
70
+ StateHeatmapRequestSchema,
71
+ StateHeatmapResponseSchema,
61
72
  UpdateScrapeStatusMessage,
62
73
  ValidatePasswordRequestSchema,
63
- ValidatePasswordResponseSchema,
64
- decryptRsaOaepSha256B64,
65
- encryptRsaOaepSha256ToB64
74
+ ValidatePasswordResponseSchema
66
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/shared-schemas",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
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",