@findatruck/aggregator-client 1.6.0 → 1.7.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 +47 -0
- package/dist/index.d.cts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +51 -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,6 +51,11 @@ __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
|
+
PatchDriverDriverResponseSchema: () => import_shared_schemas2.PatchDriverDriverResponseSchema,
|
|
56
|
+
PatchDriverRequestSchema: () => import_shared_schemas2.PatchDriverRequestSchema,
|
|
57
|
+
PatchDriverResponseSchema: () => import_shared_schemas2.PatchDriverResponseSchema,
|
|
58
|
+
SharedDriverResponseSchema: () => import_shared_schemas2.SharedDriverResponseSchema,
|
|
53
59
|
StateHeatmapEntrySchema: () => import_shared_schemas2.StateHeatmapEntrySchema,
|
|
54
60
|
StateHeatmapRequestSchema: () => import_shared_schemas2.StateHeatmapRequestSchema,
|
|
55
61
|
StateHeatmapResponseSchema: () => import_shared_schemas2.StateHeatmapResponseSchema,
|
|
@@ -127,6 +133,12 @@ var endpoints = {
|
|
|
127
133
|
method: "GET",
|
|
128
134
|
requestSchema: import_shared_schemas.DriverEnrichedSummariesRequestSchema,
|
|
129
135
|
responseSchema: import_shared_schemas.DriverEnrichedSummariesResponseSchema
|
|
136
|
+
},
|
|
137
|
+
patchDriver: {
|
|
138
|
+
path: "/drivers/:id",
|
|
139
|
+
method: "PATCH",
|
|
140
|
+
requestSchema: import_shared_schemas.PatchDriverRequestSchema,
|
|
141
|
+
responseSchema: import_shared_schemas.PatchDriverResponseSchema
|
|
130
142
|
}
|
|
131
143
|
};
|
|
132
144
|
|
|
@@ -326,6 +338,35 @@ var AggregatorClient = class {
|
|
|
326
338
|
}
|
|
327
339
|
return responseParseResult.data;
|
|
328
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Renames a driver by ID.
|
|
343
|
+
*/
|
|
344
|
+
async patchDriver(request) {
|
|
345
|
+
const endpoint = endpoints.patchDriver;
|
|
346
|
+
const parseResult = endpoint.requestSchema.safeParse(request);
|
|
347
|
+
if (!parseResult.success) {
|
|
348
|
+
throw new AggregatorClientError(
|
|
349
|
+
`Invalid request: ${parseResult.error.message}`,
|
|
350
|
+
endpoint.path
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
const validated = parseResult.data;
|
|
354
|
+
const path = endpoint.path.replace(":id", validated.driver_id);
|
|
355
|
+
const response = await this.makeRequest(path, endpoint.method, {
|
|
356
|
+
name: validated.name,
|
|
357
|
+
provider_account_id: validated.provider_account_id
|
|
358
|
+
});
|
|
359
|
+
const responseParseResult = endpoint.responseSchema.safeParse(response);
|
|
360
|
+
if (!responseParseResult.success) {
|
|
361
|
+
throw new AggregatorClientError(
|
|
362
|
+
`Invalid response from aggregator: ${responseParseResult.error.message}`,
|
|
363
|
+
endpoint.path,
|
|
364
|
+
void 0,
|
|
365
|
+
response
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
return responseParseResult.data;
|
|
369
|
+
}
|
|
329
370
|
/**
|
|
330
371
|
* Gets individual trips for a driver within a date range.
|
|
331
372
|
* Computes on-demand if no trips exist yet.
|
|
@@ -515,6 +556,7 @@ var import_shared_schemas2 = require("@findatruck/shared-schemas");
|
|
|
515
556
|
DriverDailySummarySchema,
|
|
516
557
|
DriverEnrichedSummariesRequestSchema,
|
|
517
558
|
DriverEnrichedSummariesResponseSchema,
|
|
559
|
+
DriverNameSchema,
|
|
518
560
|
DriverRankingSchema,
|
|
519
561
|
DriverRankingsRequestSchema,
|
|
520
562
|
DriverRankingsResponseSchema,
|
|
@@ -534,6 +576,11 @@ var import_shared_schemas2 = require("@findatruck/shared-schemas");
|
|
|
534
576
|
NewLoginResponseFailureSchema,
|
|
535
577
|
NewLoginResponseSchema,
|
|
536
578
|
NewLoginResponseSuccessSchema,
|
|
579
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
580
|
+
PatchDriverDriverResponseSchema,
|
|
581
|
+
PatchDriverRequestSchema,
|
|
582
|
+
PatchDriverResponseSchema,
|
|
583
|
+
SharedDriverResponseSchema,
|
|
537
584
|
StateHeatmapEntrySchema,
|
|
538
585
|
StateHeatmapRequestSchema,
|
|
539
586
|
StateHeatmapResponseSchema,
|
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, PatchDriverDriverResponse, PatchDriverDriverResponseSchema, PatchDriverRequest, PatchDriverRequestSchema, PatchDriverResponse, PatchDriverResponseSchema, SharedDriverResponse, SharedDriverResponseSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -79,6 +79,10 @@ 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
|
+
* Renames a driver by ID.
|
|
84
|
+
*/
|
|
85
|
+
patchDriver(request: PatchDriverRequest): Promise<PatchDriverResponse>;
|
|
82
86
|
/**
|
|
83
87
|
* Gets individual trips for a driver within a date range.
|
|
84
88
|
* Computes on-demand if no trips exist yet.
|
|
@@ -216,6 +220,10 @@ declare const endpoints: {
|
|
|
216
220
|
speed_mph: z.ZodOptional<z.ZodNumber>;
|
|
217
221
|
altitude_feet: z.ZodOptional<z.ZodNumber>;
|
|
218
222
|
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
+
driving_status: z.ZodOptional<z.ZodEnum<{
|
|
224
|
+
parked: "parked";
|
|
225
|
+
driving: "driving";
|
|
226
|
+
}>>;
|
|
219
227
|
}, z.core.$strip>>;
|
|
220
228
|
}, z.core.$strip>;
|
|
221
229
|
readonly responseSchema: z.ZodObject<{
|
|
@@ -244,6 +252,10 @@ declare const endpoints: {
|
|
|
244
252
|
eld: "eld";
|
|
245
253
|
manual: "manual";
|
|
246
254
|
}>;
|
|
255
|
+
driving_status: z.ZodNullable<z.ZodEnum<{
|
|
256
|
+
parked: "parked";
|
|
257
|
+
driving: "driving";
|
|
258
|
+
}>>;
|
|
247
259
|
}, z.core.$strip>>;
|
|
248
260
|
}, z.core.$strip>;
|
|
249
261
|
};
|
|
@@ -356,6 +368,26 @@ declare const endpoints: {
|
|
|
356
368
|
}, z.core.$strip>>;
|
|
357
369
|
}, z.core.$strip>>;
|
|
358
370
|
};
|
|
371
|
+
readonly patchDriver: {
|
|
372
|
+
readonly path: "/drivers/:id";
|
|
373
|
+
readonly method: "PATCH";
|
|
374
|
+
readonly requestSchema: z.ZodObject<{
|
|
375
|
+
driver_id: z.ZodUUID;
|
|
376
|
+
provider_account_id: z.ZodUUID;
|
|
377
|
+
name: z.ZodString;
|
|
378
|
+
}, z.core.$strip>;
|
|
379
|
+
readonly responseSchema: z.ZodObject<{
|
|
380
|
+
message: z.ZodString;
|
|
381
|
+
driver: z.ZodObject<{
|
|
382
|
+
id: z.ZodUUID;
|
|
383
|
+
created_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
384
|
+
updated_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
385
|
+
name: z.ZodString;
|
|
386
|
+
eld_external_id: z.ZodString;
|
|
387
|
+
is_placeholder: z.ZodBoolean;
|
|
388
|
+
}, z.core.$strict>;
|
|
389
|
+
}, z.core.$strip>;
|
|
390
|
+
};
|
|
359
391
|
};
|
|
360
392
|
type EndpointName = keyof typeof endpoints;
|
|
361
393
|
|
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, PatchDriverDriverResponse, PatchDriverDriverResponseSchema, PatchDriverRequest, PatchDriverRequestSchema, PatchDriverResponse, PatchDriverResponseSchema, SharedDriverResponse, SharedDriverResponseSchema, StateHeatmapEntry, StateHeatmapEntrySchema, StateHeatmapRequest, StateHeatmapRequestSchema, StateHeatmapResponse, StateHeatmapResponseSchema, ValidatePasswordRequest, ValidatePasswordRequestSchema, ValidatePasswordResponse, ValidatePasswordResponseSchema } from '@findatruck/shared-schemas';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -79,6 +79,10 @@ 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
|
+
* Renames a driver by ID.
|
|
84
|
+
*/
|
|
85
|
+
patchDriver(request: PatchDriverRequest): Promise<PatchDriverResponse>;
|
|
82
86
|
/**
|
|
83
87
|
* Gets individual trips for a driver within a date range.
|
|
84
88
|
* Computes on-demand if no trips exist yet.
|
|
@@ -216,6 +220,10 @@ declare const endpoints: {
|
|
|
216
220
|
speed_mph: z.ZodOptional<z.ZodNumber>;
|
|
217
221
|
altitude_feet: z.ZodOptional<z.ZodNumber>;
|
|
218
222
|
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
+
driving_status: z.ZodOptional<z.ZodEnum<{
|
|
224
|
+
parked: "parked";
|
|
225
|
+
driving: "driving";
|
|
226
|
+
}>>;
|
|
219
227
|
}, z.core.$strip>>;
|
|
220
228
|
}, z.core.$strip>;
|
|
221
229
|
readonly responseSchema: z.ZodObject<{
|
|
@@ -244,6 +252,10 @@ declare const endpoints: {
|
|
|
244
252
|
eld: "eld";
|
|
245
253
|
manual: "manual";
|
|
246
254
|
}>;
|
|
255
|
+
driving_status: z.ZodNullable<z.ZodEnum<{
|
|
256
|
+
parked: "parked";
|
|
257
|
+
driving: "driving";
|
|
258
|
+
}>>;
|
|
247
259
|
}, z.core.$strip>>;
|
|
248
260
|
}, z.core.$strip>;
|
|
249
261
|
};
|
|
@@ -356,6 +368,26 @@ declare const endpoints: {
|
|
|
356
368
|
}, z.core.$strip>>;
|
|
357
369
|
}, z.core.$strip>>;
|
|
358
370
|
};
|
|
371
|
+
readonly patchDriver: {
|
|
372
|
+
readonly path: "/drivers/:id";
|
|
373
|
+
readonly method: "PATCH";
|
|
374
|
+
readonly requestSchema: z.ZodObject<{
|
|
375
|
+
driver_id: z.ZodUUID;
|
|
376
|
+
provider_account_id: z.ZodUUID;
|
|
377
|
+
name: z.ZodString;
|
|
378
|
+
}, z.core.$strip>;
|
|
379
|
+
readonly responseSchema: z.ZodObject<{
|
|
380
|
+
message: z.ZodString;
|
|
381
|
+
driver: z.ZodObject<{
|
|
382
|
+
id: z.ZodUUID;
|
|
383
|
+
created_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
384
|
+
updated_at: z.ZodUnion<readonly [z.ZodString, z.ZodDate]>;
|
|
385
|
+
name: z.ZodString;
|
|
386
|
+
eld_external_id: z.ZodString;
|
|
387
|
+
is_placeholder: z.ZodBoolean;
|
|
388
|
+
}, z.core.$strict>;
|
|
389
|
+
}, z.core.$strip>;
|
|
390
|
+
};
|
|
359
391
|
};
|
|
360
392
|
type EndpointName = keyof typeof endpoints;
|
|
361
393
|
|
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,35 @@ var AggregatorClient = class {
|
|
|
287
295
|
}
|
|
288
296
|
return responseParseResult.data;
|
|
289
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Renames a driver by ID.
|
|
300
|
+
*/
|
|
301
|
+
async patchDriver(request) {
|
|
302
|
+
const endpoint = endpoints.patchDriver;
|
|
303
|
+
const parseResult = endpoint.requestSchema.safeParse(request);
|
|
304
|
+
if (!parseResult.success) {
|
|
305
|
+
throw new AggregatorClientError(
|
|
306
|
+
`Invalid request: ${parseResult.error.message}`,
|
|
307
|
+
endpoint.path
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
const validated = parseResult.data;
|
|
311
|
+
const path = endpoint.path.replace(":id", validated.driver_id);
|
|
312
|
+
const response = await this.makeRequest(path, endpoint.method, {
|
|
313
|
+
name: validated.name,
|
|
314
|
+
provider_account_id: validated.provider_account_id
|
|
315
|
+
});
|
|
316
|
+
const responseParseResult = endpoint.responseSchema.safeParse(response);
|
|
317
|
+
if (!responseParseResult.success) {
|
|
318
|
+
throw new AggregatorClientError(
|
|
319
|
+
`Invalid response from aggregator: ${responseParseResult.error.message}`,
|
|
320
|
+
endpoint.path,
|
|
321
|
+
void 0,
|
|
322
|
+
response
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
return responseParseResult.data;
|
|
326
|
+
}
|
|
290
327
|
/**
|
|
291
328
|
* Gets individual trips for a driver within a date range.
|
|
292
329
|
* Computes on-demand if no trips exist yet.
|
|
@@ -495,7 +532,13 @@ import {
|
|
|
495
532
|
EnrichedPointSchema,
|
|
496
533
|
EnrichedStopSchema,
|
|
497
534
|
DriverEnrichedSummariesRequestSchema as DriverEnrichedSummariesRequestSchema2,
|
|
498
|
-
DriverEnrichedSummariesResponseSchema as DriverEnrichedSummariesResponseSchema2
|
|
535
|
+
DriverEnrichedSummariesResponseSchema as DriverEnrichedSummariesResponseSchema2,
|
|
536
|
+
PatchDriverRequestSchema as PatchDriverRequestSchema2,
|
|
537
|
+
PatchDriverResponseSchema as PatchDriverResponseSchema2,
|
|
538
|
+
PatchDriverDriverResponseSchema,
|
|
539
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
540
|
+
DriverNameSchema,
|
|
541
|
+
SharedDriverResponseSchema
|
|
499
542
|
} from "@findatruck/shared-schemas";
|
|
500
543
|
export {
|
|
501
544
|
AggregatorClient,
|
|
@@ -509,6 +552,7 @@ export {
|
|
|
509
552
|
DriverDailySummarySchema,
|
|
510
553
|
DriverEnrichedSummariesRequestSchema2 as DriverEnrichedSummariesRequestSchema,
|
|
511
554
|
DriverEnrichedSummariesResponseSchema2 as DriverEnrichedSummariesResponseSchema,
|
|
555
|
+
DriverNameSchema,
|
|
512
556
|
DriverRankingSchema,
|
|
513
557
|
DriverRankingsRequestSchema2 as DriverRankingsRequestSchema,
|
|
514
558
|
DriverRankingsResponseSchema2 as DriverRankingsResponseSchema,
|
|
@@ -528,6 +572,11 @@ export {
|
|
|
528
572
|
NewLoginResponseFailureSchema,
|
|
529
573
|
NewLoginResponseSchema2 as NewLoginResponseSchema,
|
|
530
574
|
NewLoginResponseSuccessSchema,
|
|
575
|
+
PATCH_DRIVER_NAME_MAX_LENGTH,
|
|
576
|
+
PatchDriverDriverResponseSchema,
|
|
577
|
+
PatchDriverRequestSchema2 as PatchDriverRequestSchema,
|
|
578
|
+
PatchDriverResponseSchema2 as PatchDriverResponseSchema,
|
|
579
|
+
SharedDriverResponseSchema,
|
|
531
580
|
StateHeatmapEntrySchema,
|
|
532
581
|
StateHeatmapRequestSchema2 as StateHeatmapRequestSchema,
|
|
533
582
|
StateHeatmapResponseSchema2 as StateHeatmapResponseSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findatruck/aggregator-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.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.18.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"zod": "^4.1.11"
|