@findatruck/aggregator-client 1.3.0 → 1.4.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
@@ -22,6 +22,9 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AggregatorClient: () => AggregatorClient,
24
24
  AggregatorClientError: () => AggregatorClientError,
25
+ AnonymousDriverErrorResponseSchema: () => import_shared_schemas2.AnonymousDriverErrorResponseSchema,
26
+ AnonymousDriverResponseSchema: () => import_shared_schemas2.AnonymousDriverResponseSchema,
27
+ CreateAnonymousDriverBodySchema: () => import_shared_schemas2.CreateAnonymousDriverBodySchema,
25
28
  DeleteProviderAccountRequestSchema: () => import_shared_schemas2.DeleteProviderAccountRequestSchema,
26
29
  DeleteProviderAccountResponseSchema: () => import_shared_schemas2.DeleteProviderAccountResponseSchema,
27
30
  DriverRankingSchema: () => import_shared_schemas2.DriverRankingSchema,
@@ -82,6 +85,12 @@ var endpoints = {
82
85
  method: "POST",
83
86
  requestSchema: import_shared_schemas.ManualBatchRequestSchema,
84
87
  responseSchema: import_shared_schemas.ManualBatchResponseSchema
88
+ },
89
+ anonymousDriver: {
90
+ path: "/anonymous-driver",
91
+ method: "POST",
92
+ requestSchema: import_shared_schemas.CreateAnonymousDriverBodySchema,
93
+ responseSchema: import_shared_schemas.AnonymousDriverResponseSchema
85
94
  }
86
95
  };
87
96
 
@@ -257,6 +266,30 @@ var AggregatorClient = class {
257
266
  }
258
267
  return responseParseResult.data;
259
268
  }
269
+ /**
270
+ * Creates an anonymous driver for GPS-only users without ELD login.
271
+ */
272
+ async anonymousDriver(request) {
273
+ const endpoint = endpoints.anonymousDriver;
274
+ const parseResult = endpoint.requestSchema.safeParse(request);
275
+ if (!parseResult.success) {
276
+ throw new AggregatorClientError(
277
+ `Invalid request: ${parseResult.error.message}`,
278
+ endpoint.path
279
+ );
280
+ }
281
+ const response = await this.makeRequest(endpoint.path, endpoint.method, request);
282
+ const responseParseResult = endpoint.responseSchema.safeParse(response);
283
+ if (!responseParseResult.success) {
284
+ throw new AggregatorClientError(
285
+ `Invalid response from aggregator: ${responseParseResult.error.message}`,
286
+ endpoint.path,
287
+ void 0,
288
+ response
289
+ );
290
+ }
291
+ return responseParseResult.data;
292
+ }
260
293
  async makeRequest(path, method, body) {
261
294
  const url = `${this.baseUrl}${path}`;
262
295
  const response = await fetch(url, {
@@ -321,6 +354,9 @@ var import_shared_schemas2 = require("@findatruck/shared-schemas");
321
354
  0 && (module.exports = {
322
355
  AggregatorClient,
323
356
  AggregatorClientError,
357
+ AnonymousDriverErrorResponseSchema,
358
+ AnonymousDriverResponseSchema,
359
+ CreateAnonymousDriverBodySchema,
324
360
  DeleteProviderAccountRequestSchema,
325
361
  DeleteProviderAccountResponseSchema,
326
362
  DriverRankingSchema,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse } from '@findatruck/shared-schemas';
2
- export { DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
1
+ import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse, CreateAnonymousDriverBody, AnonymousDriverResponse } from '@findatruck/shared-schemas';
2
+ export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -75,6 +75,10 @@ declare class AggregatorClient {
75
75
  * Used for non-ELD sources (external GPS trackers, etc.).
76
76
  */
77
77
  manualBatch(request: ManualBatchRequest): Promise<ManualBatchResponse>;
78
+ /**
79
+ * Creates an anonymous driver for GPS-only users without ELD login.
80
+ */
81
+ anonymousDriver(request: CreateAnonymousDriverBody): Promise<AnonymousDriverResponse>;
78
82
  private makeRequest;
79
83
  private makeGetRequest;
80
84
  }
@@ -213,6 +217,16 @@ declare const endpoints: {
213
217
  }, z.core.$strip>>;
214
218
  }, z.core.$strip>;
215
219
  };
220
+ readonly anonymousDriver: {
221
+ readonly path: "/anonymous-driver";
222
+ readonly method: "POST";
223
+ readonly requestSchema: z.ZodObject<{
224
+ convex_user_id: z.ZodString;
225
+ }, z.core.$strip>;
226
+ readonly responseSchema: z.ZodObject<{
227
+ driver_id: z.ZodString;
228
+ }, z.core.$strip>;
229
+ };
216
230
  };
217
231
  type EndpointName = keyof typeof endpoints;
218
232
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse } from '@findatruck/shared-schemas';
2
- export { DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
1
+ import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse, CreateAnonymousDriverBody, AnonymousDriverResponse } from '@findatruck/shared-schemas';
2
+ export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -75,6 +75,10 @@ declare class AggregatorClient {
75
75
  * Used for non-ELD sources (external GPS trackers, etc.).
76
76
  */
77
77
  manualBatch(request: ManualBatchRequest): Promise<ManualBatchResponse>;
78
+ /**
79
+ * Creates an anonymous driver for GPS-only users without ELD login.
80
+ */
81
+ anonymousDriver(request: CreateAnonymousDriverBody): Promise<AnonymousDriverResponse>;
78
82
  private makeRequest;
79
83
  private makeGetRequest;
80
84
  }
@@ -213,6 +217,16 @@ declare const endpoints: {
213
217
  }, z.core.$strip>>;
214
218
  }, z.core.$strip>;
215
219
  };
220
+ readonly anonymousDriver: {
221
+ readonly path: "/anonymous-driver";
222
+ readonly method: "POST";
223
+ readonly requestSchema: z.ZodObject<{
224
+ convex_user_id: z.ZodString;
225
+ }, z.core.$strip>;
226
+ readonly responseSchema: z.ZodObject<{
227
+ driver_id: z.ZodString;
228
+ }, z.core.$strip>;
229
+ };
216
230
  };
217
231
  type EndpointName = keyof typeof endpoints;
218
232
 
package/dist/index.js CHANGED
@@ -11,7 +11,9 @@ import {
11
11
  StateHeatmapRequestSchema,
12
12
  StateHeatmapResponseSchema,
13
13
  ManualBatchRequestSchema,
14
- ManualBatchResponseSchema
14
+ ManualBatchResponseSchema,
15
+ CreateAnonymousDriverBodySchema,
16
+ AnonymousDriverResponseSchema
15
17
  } from "@findatruck/shared-schemas";
16
18
  var endpoints = {
17
19
  newLogin: {
@@ -49,6 +51,12 @@ var endpoints = {
49
51
  method: "POST",
50
52
  requestSchema: ManualBatchRequestSchema,
51
53
  responseSchema: ManualBatchResponseSchema
54
+ },
55
+ anonymousDriver: {
56
+ path: "/anonymous-driver",
57
+ method: "POST",
58
+ requestSchema: CreateAnonymousDriverBodySchema,
59
+ responseSchema: AnonymousDriverResponseSchema
52
60
  }
53
61
  };
54
62
 
@@ -224,6 +232,30 @@ var AggregatorClient = class {
224
232
  }
225
233
  return responseParseResult.data;
226
234
  }
235
+ /**
236
+ * Creates an anonymous driver for GPS-only users without ELD login.
237
+ */
238
+ async anonymousDriver(request) {
239
+ const endpoint = endpoints.anonymousDriver;
240
+ const parseResult = endpoint.requestSchema.safeParse(request);
241
+ if (!parseResult.success) {
242
+ throw new AggregatorClientError(
243
+ `Invalid request: ${parseResult.error.message}`,
244
+ endpoint.path
245
+ );
246
+ }
247
+ const response = await this.makeRequest(endpoint.path, endpoint.method, request);
248
+ const responseParseResult = endpoint.responseSchema.safeParse(response);
249
+ if (!responseParseResult.success) {
250
+ throw new AggregatorClientError(
251
+ `Invalid response from aggregator: ${responseParseResult.error.message}`,
252
+ endpoint.path,
253
+ void 0,
254
+ response
255
+ );
256
+ }
257
+ return responseParseResult.data;
258
+ }
227
259
  async makeRequest(path, method, body) {
228
260
  const url = `${this.baseUrl}${path}`;
229
261
  const response = await fetch(url, {
@@ -301,11 +333,17 @@ import {
301
333
  ManualBatchRequestSchema as ManualBatchRequestSchema2,
302
334
  ManualBatchResponseSchema as ManualBatchResponseSchema2,
303
335
  ManualBatchEntrySchema,
304
- ManualBatchTelemetrySchema
336
+ ManualBatchTelemetrySchema,
337
+ CreateAnonymousDriverBodySchema as CreateAnonymousDriverBodySchema2,
338
+ AnonymousDriverResponseSchema as AnonymousDriverResponseSchema2,
339
+ AnonymousDriverErrorResponseSchema
305
340
  } from "@findatruck/shared-schemas";
306
341
  export {
307
342
  AggregatorClient,
308
343
  AggregatorClientError,
344
+ AnonymousDriverErrorResponseSchema,
345
+ AnonymousDriverResponseSchema2 as AnonymousDriverResponseSchema,
346
+ CreateAnonymousDriverBodySchema2 as CreateAnonymousDriverBodySchema,
309
347
  DeleteProviderAccountRequestSchema2 as DeleteProviderAccountRequestSchema,
310
348
  DeleteProviderAccountResponseSchema2 as DeleteProviderAccountResponseSchema,
311
349
  DriverRankingSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findatruck/aggregator-client",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "@findatruck/shared-schemas": "^2.12.0"
26
+ "@findatruck/shared-schemas": "^2.14.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "zod": "^4.1.11"