@findatruck/aggregator-client 1.6.0 → 1.8.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 +53 -0
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +57 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
DriverDailySummarySchema: () => import_shared_schemas2.DriverDailySummarySchema,
|
|
32
32
|
DriverEnrichedSummariesRequestSchema: () => import_shared_schemas2.DriverEnrichedSummariesRequestSchema,
|
|
33
33
|
DriverEnrichedSummariesResponseSchema: () => import_shared_schemas2.DriverEnrichedSummariesResponseSchema,
|
|
34
|
+
DriverNameSchema: () => import_shared_schemas2.DriverNameSchema,
|
|
34
35
|
DriverRankingSchema: () => import_shared_schemas2.DriverRankingSchema,
|
|
35
36
|
DriverRankingsRequestSchema: () => import_shared_schemas2.DriverRankingsRequestSchema,
|
|
36
37
|
DriverRankingsResponseSchema: () => import_shared_schemas2.DriverRankingsResponseSchema,
|
|
@@ -50,9 +51,16 @@ __export(index_exports, {
|
|
|
50
51
|
NewLoginResponseFailureSchema: () => import_shared_schemas2.NewLoginResponseFailureSchema,
|
|
51
52
|
NewLoginResponseSchema: () => import_shared_schemas2.NewLoginResponseSchema,
|
|
52
53
|
NewLoginResponseSuccessSchema: () => import_shared_schemas2.NewLoginResponseSuccessSchema,
|
|
54
|
+
PATCH_DRIVER_NAME_MAX_LENGTH: () => import_shared_schemas2.PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
55
|
+
PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH: () => import_shared_schemas2.PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH,
|
|
56
|
+
PatchDriverDriverResponseSchema: () => import_shared_schemas2.PatchDriverDriverResponseSchema,
|
|
57
|
+
PatchDriverRequestSchema: () => import_shared_schemas2.PatchDriverRequestSchema,
|
|
58
|
+
PatchDriverResponseSchema: () => import_shared_schemas2.PatchDriverResponseSchema,
|
|
59
|
+
SharedDriverResponseSchema: () => import_shared_schemas2.SharedDriverResponseSchema,
|
|
53
60
|
StateHeatmapEntrySchema: () => import_shared_schemas2.StateHeatmapEntrySchema,
|
|
54
61
|
StateHeatmapRequestSchema: () => import_shared_schemas2.StateHeatmapRequestSchema,
|
|
55
62
|
StateHeatmapResponseSchema: () => import_shared_schemas2.StateHeatmapResponseSchema,
|
|
63
|
+
TruckTypeSchema: () => import_shared_schemas2.TruckTypeSchema,
|
|
56
64
|
ValidatePasswordRequestSchema: () => import_shared_schemas2.ValidatePasswordRequestSchema,
|
|
57
65
|
ValidatePasswordResponseSchema: () => import_shared_schemas2.ValidatePasswordResponseSchema,
|
|
58
66
|
endpoints: () => endpoints
|
|
@@ -127,6 +135,12 @@ var endpoints = {
|
|
|
127
135
|
method: "GET",
|
|
128
136
|
requestSchema: import_shared_schemas.DriverEnrichedSummariesRequestSchema,
|
|
129
137
|
responseSchema: import_shared_schemas.DriverEnrichedSummariesResponseSchema
|
|
138
|
+
},
|
|
139
|
+
patchDriver: {
|
|
140
|
+
path: "/drivers/:id",
|
|
141
|
+
method: "PATCH",
|
|
142
|
+
requestSchema: import_shared_schemas.PatchDriverRequestSchema,
|
|
143
|
+
responseSchema: import_shared_schemas.PatchDriverResponseSchema
|
|
130
144
|
}
|
|
131
145
|
};
|
|
132
146
|
|
|
@@ -326,6 +340,37 @@ var AggregatorClient = class {
|
|
|
326
340
|
}
|
|
327
341
|
return responseParseResult.data;
|
|
328
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Patches a driver by ID. Accepts `name` and/or `truck_type`.
|
|
345
|
+
* At least one field must be provided.
|
|
346
|
+
* `truck_type: null` clears the value.
|
|
347
|
+
*/
|
|
348
|
+
async patchDriver(request) {
|
|
349
|
+
const endpoint = endpoints.patchDriver;
|
|
350
|
+
const parseResult = endpoint.requestSchema.safeParse(request);
|
|
351
|
+
if (!parseResult.success) {
|
|
352
|
+
throw new AggregatorClientError(
|
|
353
|
+
`Invalid request: ${parseResult.error.message}`,
|
|
354
|
+
endpoint.path
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
const validated = parseResult.data;
|
|
358
|
+
const path = endpoint.path.replace(":id", validated["driver_id"]);
|
|
359
|
+
const body = {};
|
|
360
|
+
if (validated["name"] !== void 0) body["name"] = validated["name"];
|
|
361
|
+
if (validated["truck_type"] !== void 0) body["truck_type"] = validated["truck_type"];
|
|
362
|
+
const response = await this.makeRequest(path, endpoint.method, body);
|
|
363
|
+
const responseParseResult = endpoint.responseSchema.safeParse(response);
|
|
364
|
+
if (!responseParseResult.success) {
|
|
365
|
+
throw new AggregatorClientError(
|
|
366
|
+
`Invalid response from aggregator: ${responseParseResult.error.message}`,
|
|
367
|
+
endpoint.path,
|
|
368
|
+
void 0,
|
|
369
|
+
response
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return responseParseResult.data;
|
|
373
|
+
}
|
|
329
374
|
/**
|
|
330
375
|
* Gets individual trips for a driver within a date range.
|
|
331
376
|
* Computes on-demand if no trips exist yet.
|
|
@@ -515,6 +560,7 @@ var import_shared_schemas2 = require("@findatruck/shared-schemas");
|
|
|
515
560
|
DriverDailySummarySchema,
|
|
516
561
|
DriverEnrichedSummariesRequestSchema,
|
|
517
562
|
DriverEnrichedSummariesResponseSchema,
|
|
563
|
+
DriverNameSchema,
|
|
518
564
|
DriverRankingSchema,
|
|
519
565
|
DriverRankingsRequestSchema,
|
|
520
566
|
DriverRankingsResponseSchema,
|
|
@@ -534,9 +580,16 @@ var import_shared_schemas2 = require("@findatruck/shared-schemas");
|
|
|
534
580
|
NewLoginResponseFailureSchema,
|
|
535
581
|
NewLoginResponseSchema,
|
|
536
582
|
NewLoginResponseSuccessSchema,
|
|
583
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
584
|
+
PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH,
|
|
585
|
+
PatchDriverDriverResponseSchema,
|
|
586
|
+
PatchDriverRequestSchema,
|
|
587
|
+
PatchDriverResponseSchema,
|
|
588
|
+
SharedDriverResponseSchema,
|
|
537
589
|
StateHeatmapEntrySchema,
|
|
538
590
|
StateHeatmapRequestSchema,
|
|
539
591
|
StateHeatmapResponseSchema,
|
|
592
|
+
TruckTypeSchema,
|
|
540
593
|
ValidatePasswordRequestSchema,
|
|
541
594
|
ValidatePasswordResponseSchema,
|
|
542
595
|
endpoints
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse, CreateAnonymousDriverBody, AnonymousDriverResponse, DriverTripsRequest, DriverTripsResponse, DriverDailySummariesResponse, EnrichedTripSummaryRequest, EnrichedTripSummaryResponse, DriverEnrichedSummariesRequest, DriverEnrichedSummariesResponse } from '@findatruck/shared-schemas';
|
|
2
|
-
export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverDailySummariesResponse, DriverDailySummariesResponseSchema, DriverDailySummary, DriverDailySummarySchema, DriverEnrichedSummariesRequest, DriverEnrichedSummariesRequestSchema, DriverEnrichedSummariesResponse, DriverEnrichedSummariesResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, DriverTrip, DriverTripSchema, DriverTripsRequest, DriverTripsRequestSchema, DriverTripsResponse, DriverTripsResponseSchema, EnrichedPoint, EnrichedPointSchema, EnrichedStop, EnrichedStopSchema, EnrichedTripSummary, EnrichedTripSummaryRequest, EnrichedTripSummaryRequestSchema, EnrichedTripSummaryResponse, EnrichedTripSummaryResponseSchema, EnrichedTripSummarySchema, 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, PatchDriverRequest, PatchDriverResponse, DriverTripsRequest, DriverTripsResponse, DriverDailySummariesResponse, EnrichedTripSummaryRequest, EnrichedTripSummaryResponse, DriverEnrichedSummariesRequest, DriverEnrichedSummariesResponse } from '@findatruck/shared-schemas';
|
|
2
|
+
export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverDailySummariesResponse, DriverDailySummariesResponseSchema, DriverDailySummary, DriverDailySummarySchema, DriverEnrichedSummariesRequest, DriverEnrichedSummariesRequestSchema, DriverEnrichedSummariesResponse, DriverEnrichedSummariesResponseSchema, DriverNameSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, DriverTrip, DriverTripSchema, DriverTripsRequest, DriverTripsRequestSchema, DriverTripsResponse, DriverTripsResponseSchema, EnrichedPoint, EnrichedPointSchema, EnrichedStop, EnrichedStopSchema, EnrichedTripSummary, EnrichedTripSummaryRequest, EnrichedTripSummaryRequestSchema, EnrichedTripSummaryResponse, EnrichedTripSummaryResponseSchema, EnrichedTripSummarySchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, PATCH_DRIVER_NAME_MAX_LENGTH, PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH, PatchDriverDriverResponse, PatchDriverDriverResponseSchema, PatchDriverRequest, PatchDriverRequestSchema, PatchDriverResponse, PatchDriverResponseSchema, SharedDriverResponse, SharedDriverResponseSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, TruckTypeSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -79,6 +79,12 @@ declare class AggregatorClient {
|
|
|
79
79
|
* Creates an anonymous driver for GPS-only users without ELD login.
|
|
80
80
|
*/
|
|
81
81
|
anonymousDriver(request: CreateAnonymousDriverBody): Promise<AnonymousDriverResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Patches a driver by ID. Accepts `name` and/or `truck_type`.
|
|
84
|
+
* At least one field must be provided.
|
|
85
|
+
* `truck_type: null` clears the value.
|
|
86
|
+
*/
|
|
87
|
+
patchDriver(request: PatchDriverRequest): Promise<PatchDriverResponse>;
|
|
82
88
|
/**
|
|
83
89
|
* Gets individual trips for a driver within a date range.
|
|
84
90
|
* Computes on-demand if no trips exist yet.
|
|
@@ -216,6 +222,10 @@ declare const endpoints: {
|
|
|
216
222
|
speed_mph: z.ZodOptional<z.ZodNumber>;
|
|
217
223
|
altitude_feet: z.ZodOptional<z.ZodNumber>;
|
|
218
224
|
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
225
|
+
driving_status: z.ZodOptional<z.ZodEnum<{
|
|
226
|
+
parked: "parked";
|
|
227
|
+
driving: "driving";
|
|
228
|
+
}>>;
|
|
219
229
|
}, z.core.$strip>>;
|
|
220
230
|
}, z.core.$strip>;
|
|
221
231
|
readonly responseSchema: z.ZodObject<{
|
|
@@ -244,6 +254,10 @@ declare const endpoints: {
|
|
|
244
254
|
eld: "eld";
|
|
245
255
|
manual: "manual";
|
|
246
256
|
}>;
|
|
257
|
+
driving_status: z.ZodNullable<z.ZodEnum<{
|
|
258
|
+
parked: "parked";
|
|
259
|
+
driving: "driving";
|
|
260
|
+
}>>;
|
|
247
261
|
}, z.core.$strip>>;
|
|
248
262
|
}, z.core.$strip>;
|
|
249
263
|
};
|
|
@@ -356,6 +370,27 @@ declare const endpoints: {
|
|
|
356
370
|
}, z.core.$strip>>;
|
|
357
371
|
}, z.core.$strip>>;
|
|
358
372
|
};
|
|
373
|
+
readonly patchDriver: {
|
|
374
|
+
readonly path: "/drivers/:id";
|
|
375
|
+
readonly method: "PATCH";
|
|
376
|
+
readonly requestSchema: z.ZodObject<{
|
|
377
|
+
driver_id: z.ZodUUID;
|
|
378
|
+
name: z.ZodOptional<z.ZodString>;
|
|
379
|
+
truck_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
380
|
+
}, z.core.$strip>;
|
|
381
|
+
readonly responseSchema: z.ZodObject<{
|
|
382
|
+
message: z.ZodString;
|
|
383
|
+
driver: z.ZodObject<{
|
|
384
|
+
id: z.ZodUUID;
|
|
385
|
+
created_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
386
|
+
updated_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
387
|
+
name: z.ZodString;
|
|
388
|
+
eld_external_id: z.ZodString;
|
|
389
|
+
is_placeholder: z.ZodBoolean;
|
|
390
|
+
truck_type: z.ZodNullable<z.ZodString>;
|
|
391
|
+
}, z.core.$strict>;
|
|
392
|
+
}, z.core.$strip>;
|
|
393
|
+
};
|
|
359
394
|
};
|
|
360
395
|
type EndpointName = keyof typeof endpoints;
|
|
361
396
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NewLoginRequest, NewLoginResponse, ValidatePasswordRequest, ValidatePasswordResponse, DeleteProviderAccountRequest, DeleteProviderAccountResponse, DriverRankingsRequest, DriverRankingsResponse, StateHeatmapRequest, StateHeatmapResponse, ManualBatchRequest, ManualBatchResponse, CreateAnonymousDriverBody, AnonymousDriverResponse, DriverTripsRequest, DriverTripsResponse, DriverDailySummariesResponse, EnrichedTripSummaryRequest, EnrichedTripSummaryResponse, DriverEnrichedSummariesRequest, DriverEnrichedSummariesResponse } from '@findatruck/shared-schemas';
|
|
2
|
-
export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverDailySummariesResponse, DriverDailySummariesResponseSchema, DriverDailySummary, DriverDailySummarySchema, DriverEnrichedSummariesRequest, DriverEnrichedSummariesRequestSchema, DriverEnrichedSummariesResponse, DriverEnrichedSummariesResponseSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, DriverTrip, DriverTripSchema, DriverTripsRequest, DriverTripsRequestSchema, DriverTripsResponse, DriverTripsResponseSchema, EnrichedPoint, EnrichedPointSchema, EnrichedStop, EnrichedStopSchema, EnrichedTripSummary, EnrichedTripSummaryRequest, EnrichedTripSummaryRequestSchema, EnrichedTripSummaryResponse, EnrichedTripSummaryResponseSchema, EnrichedTripSummarySchema, 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, PatchDriverRequest, PatchDriverResponse, DriverTripsRequest, DriverTripsResponse, DriverDailySummariesResponse, EnrichedTripSummaryRequest, EnrichedTripSummaryResponse, DriverEnrichedSummariesRequest, DriverEnrichedSummariesResponse } from '@findatruck/shared-schemas';
|
|
2
|
+
export { AnonymousDriverErrorResponse, AnonymousDriverErrorResponseSchema, AnonymousDriverResponse, AnonymousDriverResponseSchema, CreateAnonymousDriverBody, CreateAnonymousDriverBodySchema, DeleteProviderAccountRequest, DeleteProviderAccountRequestSchema, DeleteProviderAccountResponse, DeleteProviderAccountResponseSchema, DriverDailySummariesResponse, DriverDailySummariesResponseSchema, DriverDailySummary, DriverDailySummarySchema, DriverEnrichedSummariesRequest, DriverEnrichedSummariesRequestSchema, DriverEnrichedSummariesResponse, DriverEnrichedSummariesResponseSchema, DriverNameSchema, DriverRanking, DriverRankingSchema, DriverRankingsRequest, DriverRankingsRequestSchema, DriverRankingsResponse, DriverRankingsResponseSchema, DriverTrip, DriverTripSchema, DriverTripsRequest, DriverTripsRequestSchema, DriverTripsResponse, DriverTripsResponseSchema, EnrichedPoint, EnrichedPointSchema, EnrichedStop, EnrichedStopSchema, EnrichedTripSummary, EnrichedTripSummaryRequest, EnrichedTripSummaryRequestSchema, EnrichedTripSummaryResponse, EnrichedTripSummaryResponseSchema, EnrichedTripSummarySchema, ManualBatchEntry, ManualBatchEntrySchema, ManualBatchRequest, ManualBatchRequestSchema, ManualBatchResponse, ManualBatchResponseSchema, ManualBatchTelemetry, ManualBatchTelemetrySchema, NewLoginRequest, NewLoginRequestSchema, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseFailureSchema, NewLoginResponseSchema, NewLoginResponseSuccess, NewLoginResponseSuccessSchema, PATCH_DRIVER_NAME_MAX_LENGTH, PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH, PatchDriverDriverResponse, PatchDriverDriverResponseSchema, PatchDriverRequest, PatchDriverRequestSchema, PatchDriverResponse, PatchDriverResponseSchema, SharedDriverResponse, SharedDriverResponseSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, TruckTypeSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -79,6 +79,12 @@ declare class AggregatorClient {
|
|
|
79
79
|
* Creates an anonymous driver for GPS-only users without ELD login.
|
|
80
80
|
*/
|
|
81
81
|
anonymousDriver(request: CreateAnonymousDriverBody): Promise<AnonymousDriverResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Patches a driver by ID. Accepts `name` and/or `truck_type`.
|
|
84
|
+
* At least one field must be provided.
|
|
85
|
+
* `truck_type: null` clears the value.
|
|
86
|
+
*/
|
|
87
|
+
patchDriver(request: PatchDriverRequest): Promise<PatchDriverResponse>;
|
|
82
88
|
/**
|
|
83
89
|
* Gets individual trips for a driver within a date range.
|
|
84
90
|
* Computes on-demand if no trips exist yet.
|
|
@@ -216,6 +222,10 @@ declare const endpoints: {
|
|
|
216
222
|
speed_mph: z.ZodOptional<z.ZodNumber>;
|
|
217
223
|
altitude_feet: z.ZodOptional<z.ZodNumber>;
|
|
218
224
|
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
225
|
+
driving_status: z.ZodOptional<z.ZodEnum<{
|
|
226
|
+
parked: "parked";
|
|
227
|
+
driving: "driving";
|
|
228
|
+
}>>;
|
|
219
229
|
}, z.core.$strip>>;
|
|
220
230
|
}, z.core.$strip>;
|
|
221
231
|
readonly responseSchema: z.ZodObject<{
|
|
@@ -244,6 +254,10 @@ declare const endpoints: {
|
|
|
244
254
|
eld: "eld";
|
|
245
255
|
manual: "manual";
|
|
246
256
|
}>;
|
|
257
|
+
driving_status: z.ZodNullable<z.ZodEnum<{
|
|
258
|
+
parked: "parked";
|
|
259
|
+
driving: "driving";
|
|
260
|
+
}>>;
|
|
247
261
|
}, z.core.$strip>>;
|
|
248
262
|
}, z.core.$strip>;
|
|
249
263
|
};
|
|
@@ -356,6 +370,27 @@ declare const endpoints: {
|
|
|
356
370
|
}, z.core.$strip>>;
|
|
357
371
|
}, z.core.$strip>>;
|
|
358
372
|
};
|
|
373
|
+
readonly patchDriver: {
|
|
374
|
+
readonly path: "/drivers/:id";
|
|
375
|
+
readonly method: "PATCH";
|
|
376
|
+
readonly requestSchema: z.ZodObject<{
|
|
377
|
+
driver_id: z.ZodUUID;
|
|
378
|
+
name: z.ZodOptional<z.ZodString>;
|
|
379
|
+
truck_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
380
|
+
}, z.core.$strip>;
|
|
381
|
+
readonly responseSchema: z.ZodObject<{
|
|
382
|
+
message: z.ZodString;
|
|
383
|
+
driver: z.ZodObject<{
|
|
384
|
+
id: z.ZodUUID;
|
|
385
|
+
created_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
386
|
+
updated_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
387
|
+
name: z.ZodString;
|
|
388
|
+
eld_external_id: z.ZodString;
|
|
389
|
+
is_placeholder: z.ZodBoolean;
|
|
390
|
+
truck_type: z.ZodNullable<z.ZodString>;
|
|
391
|
+
}, z.core.$strict>;
|
|
392
|
+
}, z.core.$strip>;
|
|
393
|
+
};
|
|
359
394
|
};
|
|
360
395
|
type EndpointName = keyof typeof endpoints;
|
|
361
396
|
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
EnrichedTripSummaryRequestSchema,
|
|
21
21
|
EnrichedTripSummaryResponseSchema,
|
|
22
22
|
DriverEnrichedSummariesRequestSchema,
|
|
23
|
-
DriverEnrichedSummariesResponseSchema
|
|
23
|
+
DriverEnrichedSummariesResponseSchema,
|
|
24
|
+
PatchDriverRequestSchema,
|
|
25
|
+
PatchDriverResponseSchema
|
|
24
26
|
} from "@findatruck/shared-schemas";
|
|
25
27
|
var endpoints = {
|
|
26
28
|
newLogin: {
|
|
@@ -88,6 +90,12 @@ var endpoints = {
|
|
|
88
90
|
method: "GET",
|
|
89
91
|
requestSchema: DriverEnrichedSummariesRequestSchema,
|
|
90
92
|
responseSchema: DriverEnrichedSummariesResponseSchema
|
|
93
|
+
},
|
|
94
|
+
patchDriver: {
|
|
95
|
+
path: "/drivers/:id",
|
|
96
|
+
method: "PATCH",
|
|
97
|
+
requestSchema: PatchDriverRequestSchema,
|
|
98
|
+
responseSchema: PatchDriverResponseSchema
|
|
91
99
|
}
|
|
92
100
|
};
|
|
93
101
|
|
|
@@ -287,6 +295,37 @@ var AggregatorClient = class {
|
|
|
287
295
|
}
|
|
288
296
|
return responseParseResult.data;
|
|
289
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Patches a driver by ID. Accepts `name` and/or `truck_type`.
|
|
300
|
+
* At least one field must be provided.
|
|
301
|
+
* `truck_type: null` clears the value.
|
|
302
|
+
*/
|
|
303
|
+
async patchDriver(request) {
|
|
304
|
+
const endpoint = endpoints.patchDriver;
|
|
305
|
+
const parseResult = endpoint.requestSchema.safeParse(request);
|
|
306
|
+
if (!parseResult.success) {
|
|
307
|
+
throw new AggregatorClientError(
|
|
308
|
+
`Invalid request: ${parseResult.error.message}`,
|
|
309
|
+
endpoint.path
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
const validated = parseResult.data;
|
|
313
|
+
const path = endpoint.path.replace(":id", validated["driver_id"]);
|
|
314
|
+
const body = {};
|
|
315
|
+
if (validated["name"] !== void 0) body["name"] = validated["name"];
|
|
316
|
+
if (validated["truck_type"] !== void 0) body["truck_type"] = validated["truck_type"];
|
|
317
|
+
const response = await this.makeRequest(path, endpoint.method, body);
|
|
318
|
+
const responseParseResult = endpoint.responseSchema.safeParse(response);
|
|
319
|
+
if (!responseParseResult.success) {
|
|
320
|
+
throw new AggregatorClientError(
|
|
321
|
+
`Invalid response from aggregator: ${responseParseResult.error.message}`,
|
|
322
|
+
endpoint.path,
|
|
323
|
+
void 0,
|
|
324
|
+
response
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return responseParseResult.data;
|
|
328
|
+
}
|
|
290
329
|
/**
|
|
291
330
|
* Gets individual trips for a driver within a date range.
|
|
292
331
|
* Computes on-demand if no trips exist yet.
|
|
@@ -495,7 +534,15 @@ import {
|
|
|
495
534
|
EnrichedPointSchema,
|
|
496
535
|
EnrichedStopSchema,
|
|
497
536
|
DriverEnrichedSummariesRequestSchema as DriverEnrichedSummariesRequestSchema2,
|
|
498
|
-
DriverEnrichedSummariesResponseSchema as DriverEnrichedSummariesResponseSchema2
|
|
537
|
+
DriverEnrichedSummariesResponseSchema as DriverEnrichedSummariesResponseSchema2,
|
|
538
|
+
PatchDriverRequestSchema as PatchDriverRequestSchema2,
|
|
539
|
+
PatchDriverResponseSchema as PatchDriverResponseSchema2,
|
|
540
|
+
PatchDriverDriverResponseSchema,
|
|
541
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
542
|
+
PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH,
|
|
543
|
+
TruckTypeSchema,
|
|
544
|
+
DriverNameSchema,
|
|
545
|
+
SharedDriverResponseSchema
|
|
499
546
|
} from "@findatruck/shared-schemas";
|
|
500
547
|
export {
|
|
501
548
|
AggregatorClient,
|
|
@@ -509,6 +556,7 @@ export {
|
|
|
509
556
|
DriverDailySummarySchema,
|
|
510
557
|
DriverEnrichedSummariesRequestSchema2 as DriverEnrichedSummariesRequestSchema,
|
|
511
558
|
DriverEnrichedSummariesResponseSchema2 as DriverEnrichedSummariesResponseSchema,
|
|
559
|
+
DriverNameSchema,
|
|
512
560
|
DriverRankingSchema,
|
|
513
561
|
DriverRankingsRequestSchema2 as DriverRankingsRequestSchema,
|
|
514
562
|
DriverRankingsResponseSchema2 as DriverRankingsResponseSchema,
|
|
@@ -528,9 +576,16 @@ export {
|
|
|
528
576
|
NewLoginResponseFailureSchema,
|
|
529
577
|
NewLoginResponseSchema2 as NewLoginResponseSchema,
|
|
530
578
|
NewLoginResponseSuccessSchema,
|
|
579
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
580
|
+
PATCH_DRIVER_TRUCK_TYPE_MAX_LENGTH,
|
|
581
|
+
PatchDriverDriverResponseSchema,
|
|
582
|
+
PatchDriverRequestSchema2 as PatchDriverRequestSchema,
|
|
583
|
+
PatchDriverResponseSchema2 as PatchDriverResponseSchema,
|
|
584
|
+
SharedDriverResponseSchema,
|
|
531
585
|
StateHeatmapEntrySchema,
|
|
532
586
|
StateHeatmapRequestSchema2 as StateHeatmapRequestSchema,
|
|
533
587
|
StateHeatmapResponseSchema2 as StateHeatmapResponseSchema,
|
|
588
|
+
TruckTypeSchema,
|
|
534
589
|
ValidatePasswordRequestSchema2 as ValidatePasswordRequestSchema,
|
|
535
590
|
ValidatePasswordResponseSchema2 as ValidatePasswordResponseSchema,
|
|
536
591
|
endpoints
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findatruck/aggregator-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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.
|
|
26
|
+
"@findatruck/shared-schemas": "^2.19.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"zod": "^4.1.11"
|