@vectora/contracts 1.0.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/LICENSE.md +25 -0
- package/dist/events/auth/index.d.ts +1 -0
- package/dist/events/auth/index.js +17 -0
- package/dist/events/auth/verification-request.interface.d.ts +5 -0
- package/dist/events/auth/verification-request.interface.js +2 -0
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/proto/index.d.ts +1 -0
- package/dist/proto/index.js +17 -0
- package/dist/proto/paths.d.ts +18 -0
- package/dist/proto/paths.js +27 -0
- package/dist/utils/data-transformer.util.d.ts +55 -0
- package/dist/utils/data-transformer.util.js +141 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/gen/go/mapbox-direction-v1.pb.go +621 -0
- package/gen/go/mapbox-geocode-v1.pb.go +473 -0
- package/gen/go/mapbox-matrix-v1.pb.go +337 -0
- package/gen/go/mapbox-optimization-v1.pb.go +422 -0
- package/gen/go/mapbox-search-v1.pb.go +699 -0
- package/gen/ts/common-geocode-v1.ts +368 -0
- package/gen/ts/common-pagination-v1.ts +713 -0
- package/gen/ts/fleet-truck-v1.ts +1102 -0
- package/gen/ts/fleet-unit-v1.ts +9 -0
- package/gen/ts/google/protobuf/field_mask.ts +295 -0
- package/gen/ts/google/protobuf/wrappers.ts +544 -0
- package/gen/ts/identify-account-v1.ts +9 -0
- package/gen/ts/identify-auth-v1.ts +9 -0
- package/gen/ts/identify-company-v1.ts +1025 -0
- package/gen/ts/identify-role-v1.ts +9 -0
- package/gen/ts/identify-user-v1.ts +9 -0
- package/gen/ts/mapbox-direction-v1.ts +718 -0
- package/gen/ts/mapbox-geocode-v1.ts +511 -0
- package/gen/ts/mapbox-matrix-v1.ts +369 -0
- package/gen/ts/mapbox-optimization-v1.ts +472 -0
- package/gen/ts/mapbox-search-v1.ts +803 -0
- package/gen/ts/shipments-freight-v1.ts +9 -0
- package/gen/ts/shipments-loads-v1.ts +9 -0
- package/gen/ts/shipments-rate-v1.ts +9 -0
- package/gen/ts/shipments-stop-v1.ts +9 -0
- package/package.json +40 -0
- package/proto/common-geocode-v1.proto +10 -0
- package/proto/common-pagination-v1.proto +39 -0
- package/proto/fleet-truck-v1.proto +145 -0
- package/proto/fleet-unit-v1.proto +3 -0
- package/proto/identify-account-v1.proto +3 -0
- package/proto/identify-auth-v1.proto +3 -0
- package/proto/identify-company-v1.proto +114 -0
- package/proto/identify-role-v1.proto +3 -0
- package/proto/identify-user-v1.proto +3 -0
- package/proto/mapbox-direction-v1.proto +61 -0
- package/proto/mapbox-geocode-v1.proto +47 -0
- package/proto/mapbox-matrix-v1.proto +34 -0
- package/proto/mapbox-optimization-v1.proto +43 -0
- package/proto/mapbox-search-v1.proto +68 -0
- package/proto/shipments-freight-v1.proto +3 -0
- package/proto/shipments-loads-v1.proto +3 -0
- package/proto/shipments-rate-v1.proto +3 -0
- package/proto/shipments-stop-v1.proto +3 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.2
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: mapbox-optimization-v1.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import { LineString, Point } from "./common-geocode-v1";
|
|
10
|
+
import { RouteLeg } from "./mapbox-direction-v1";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "optimization.v1";
|
|
13
|
+
|
|
14
|
+
export interface OptimizationRequest {
|
|
15
|
+
coordinates: Point[];
|
|
16
|
+
profile: string;
|
|
17
|
+
roundtrip?: boolean | undefined;
|
|
18
|
+
source?: string | undefined;
|
|
19
|
+
destination?: string | undefined;
|
|
20
|
+
geometries?: string | undefined;
|
|
21
|
+
steps?: boolean | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface OptimizationResponse {
|
|
25
|
+
code: string;
|
|
26
|
+
waypoints: OptimizationWaypoint[];
|
|
27
|
+
trips: OptimizationTrip[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface OptimizationTrip {
|
|
31
|
+
geometry: LineString | undefined;
|
|
32
|
+
legs: RouteLeg[];
|
|
33
|
+
distance: number;
|
|
34
|
+
duration: number;
|
|
35
|
+
weight: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface OptimizationWaypoint {
|
|
39
|
+
name: string;
|
|
40
|
+
location: number[];
|
|
41
|
+
waypointIndex: number;
|
|
42
|
+
tripsIndex: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createBaseOptimizationRequest(): OptimizationRequest {
|
|
46
|
+
return {
|
|
47
|
+
coordinates: [],
|
|
48
|
+
profile: "",
|
|
49
|
+
roundtrip: undefined,
|
|
50
|
+
source: undefined,
|
|
51
|
+
destination: undefined,
|
|
52
|
+
geometries: undefined,
|
|
53
|
+
steps: undefined,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const OptimizationRequest: MessageFns<OptimizationRequest> = {
|
|
58
|
+
encode(message: OptimizationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
59
|
+
for (const v of message.coordinates) {
|
|
60
|
+
Point.encode(v!, writer.uint32(10).fork()).join();
|
|
61
|
+
}
|
|
62
|
+
if (message.profile !== "") {
|
|
63
|
+
writer.uint32(18).string(message.profile);
|
|
64
|
+
}
|
|
65
|
+
if (message.roundtrip !== undefined) {
|
|
66
|
+
writer.uint32(24).bool(message.roundtrip);
|
|
67
|
+
}
|
|
68
|
+
if (message.source !== undefined) {
|
|
69
|
+
writer.uint32(34).string(message.source);
|
|
70
|
+
}
|
|
71
|
+
if (message.destination !== undefined) {
|
|
72
|
+
writer.uint32(42).string(message.destination);
|
|
73
|
+
}
|
|
74
|
+
if (message.geometries !== undefined) {
|
|
75
|
+
writer.uint32(50).string(message.geometries);
|
|
76
|
+
}
|
|
77
|
+
if (message.steps !== undefined) {
|
|
78
|
+
writer.uint32(56).bool(message.steps);
|
|
79
|
+
}
|
|
80
|
+
return writer;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
decode(input: BinaryReader | Uint8Array, length?: number): OptimizationRequest {
|
|
84
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
85
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
86
|
+
const message = createBaseOptimizationRequest();
|
|
87
|
+
while (reader.pos < end) {
|
|
88
|
+
const tag = reader.uint32();
|
|
89
|
+
switch (tag >>> 3) {
|
|
90
|
+
case 1: {
|
|
91
|
+
if (tag !== 10) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message.coordinates.push(Point.decode(reader, reader.uint32()));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
case 2: {
|
|
99
|
+
if (tag !== 18) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
message.profile = reader.string();
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
case 3: {
|
|
107
|
+
if (tag !== 24) {
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message.roundtrip = reader.bool();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
case 4: {
|
|
115
|
+
if (tag !== 34) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
message.source = reader.string();
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
case 5: {
|
|
123
|
+
if (tag !== 42) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message.destination = reader.string();
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
case 6: {
|
|
131
|
+
if (tag !== 50) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
message.geometries = reader.string();
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
case 7: {
|
|
139
|
+
if (tag !== 56) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
message.steps = reader.bool();
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
reader.skip(tag & 7);
|
|
151
|
+
}
|
|
152
|
+
return message;
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
create<I extends Exact<DeepPartial<OptimizationRequest>, I>>(base?: I): OptimizationRequest {
|
|
156
|
+
return OptimizationRequest.fromPartial(base ?? ({} as any));
|
|
157
|
+
},
|
|
158
|
+
fromPartial<I extends Exact<DeepPartial<OptimizationRequest>, I>>(object: I): OptimizationRequest {
|
|
159
|
+
const message = createBaseOptimizationRequest();
|
|
160
|
+
message.coordinates = object.coordinates?.map((e) => Point.fromPartial(e)) || [];
|
|
161
|
+
message.profile = object.profile ?? "";
|
|
162
|
+
message.roundtrip = object.roundtrip ?? undefined;
|
|
163
|
+
message.source = object.source ?? undefined;
|
|
164
|
+
message.destination = object.destination ?? undefined;
|
|
165
|
+
message.geometries = object.geometries ?? undefined;
|
|
166
|
+
message.steps = object.steps ?? undefined;
|
|
167
|
+
return message;
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
function createBaseOptimizationResponse(): OptimizationResponse {
|
|
172
|
+
return { code: "", waypoints: [], trips: [] };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const OptimizationResponse: MessageFns<OptimizationResponse> = {
|
|
176
|
+
encode(message: OptimizationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
177
|
+
if (message.code !== "") {
|
|
178
|
+
writer.uint32(10).string(message.code);
|
|
179
|
+
}
|
|
180
|
+
for (const v of message.waypoints) {
|
|
181
|
+
OptimizationWaypoint.encode(v!, writer.uint32(18).fork()).join();
|
|
182
|
+
}
|
|
183
|
+
for (const v of message.trips) {
|
|
184
|
+
OptimizationTrip.encode(v!, writer.uint32(26).fork()).join();
|
|
185
|
+
}
|
|
186
|
+
return writer;
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
decode(input: BinaryReader | Uint8Array, length?: number): OptimizationResponse {
|
|
190
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
191
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
192
|
+
const message = createBaseOptimizationResponse();
|
|
193
|
+
while (reader.pos < end) {
|
|
194
|
+
const tag = reader.uint32();
|
|
195
|
+
switch (tag >>> 3) {
|
|
196
|
+
case 1: {
|
|
197
|
+
if (tag !== 10) {
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
message.code = reader.string();
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
case 2: {
|
|
205
|
+
if (tag !== 18) {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
message.waypoints.push(OptimizationWaypoint.decode(reader, reader.uint32()));
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
case 3: {
|
|
213
|
+
if (tag !== 26) {
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
message.trips.push(OptimizationTrip.decode(reader, reader.uint32()));
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
reader.skip(tag & 7);
|
|
225
|
+
}
|
|
226
|
+
return message;
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
create<I extends Exact<DeepPartial<OptimizationResponse>, I>>(base?: I): OptimizationResponse {
|
|
230
|
+
return OptimizationResponse.fromPartial(base ?? ({} as any));
|
|
231
|
+
},
|
|
232
|
+
fromPartial<I extends Exact<DeepPartial<OptimizationResponse>, I>>(object: I): OptimizationResponse {
|
|
233
|
+
const message = createBaseOptimizationResponse();
|
|
234
|
+
message.code = object.code ?? "";
|
|
235
|
+
message.waypoints = object.waypoints?.map((e) => OptimizationWaypoint.fromPartial(e)) || [];
|
|
236
|
+
message.trips = object.trips?.map((e) => OptimizationTrip.fromPartial(e)) || [];
|
|
237
|
+
return message;
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
function createBaseOptimizationTrip(): OptimizationTrip {
|
|
242
|
+
return { geometry: undefined, legs: [], distance: 0, duration: 0, weight: 0 };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const OptimizationTrip: MessageFns<OptimizationTrip> = {
|
|
246
|
+
encode(message: OptimizationTrip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
247
|
+
if (message.geometry !== undefined) {
|
|
248
|
+
LineString.encode(message.geometry, writer.uint32(10).fork()).join();
|
|
249
|
+
}
|
|
250
|
+
for (const v of message.legs) {
|
|
251
|
+
RouteLeg.encode(v!, writer.uint32(18).fork()).join();
|
|
252
|
+
}
|
|
253
|
+
if (message.distance !== 0) {
|
|
254
|
+
writer.uint32(25).double(message.distance);
|
|
255
|
+
}
|
|
256
|
+
if (message.duration !== 0) {
|
|
257
|
+
writer.uint32(33).double(message.duration);
|
|
258
|
+
}
|
|
259
|
+
if (message.weight !== 0) {
|
|
260
|
+
writer.uint32(41).double(message.weight);
|
|
261
|
+
}
|
|
262
|
+
return writer;
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
decode(input: BinaryReader | Uint8Array, length?: number): OptimizationTrip {
|
|
266
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
267
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
268
|
+
const message = createBaseOptimizationTrip();
|
|
269
|
+
while (reader.pos < end) {
|
|
270
|
+
const tag = reader.uint32();
|
|
271
|
+
switch (tag >>> 3) {
|
|
272
|
+
case 1: {
|
|
273
|
+
if (tag !== 10) {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
message.geometry = LineString.decode(reader, reader.uint32());
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
case 2: {
|
|
281
|
+
if (tag !== 18) {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
message.legs.push(RouteLeg.decode(reader, reader.uint32()));
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
case 3: {
|
|
289
|
+
if (tag !== 25) {
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
message.distance = reader.double();
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
case 4: {
|
|
297
|
+
if (tag !== 33) {
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
message.duration = reader.double();
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
case 5: {
|
|
305
|
+
if (tag !== 41) {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
message.weight = reader.double();
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
reader.skip(tag & 7);
|
|
317
|
+
}
|
|
318
|
+
return message;
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
create<I extends Exact<DeepPartial<OptimizationTrip>, I>>(base?: I): OptimizationTrip {
|
|
322
|
+
return OptimizationTrip.fromPartial(base ?? ({} as any));
|
|
323
|
+
},
|
|
324
|
+
fromPartial<I extends Exact<DeepPartial<OptimizationTrip>, I>>(object: I): OptimizationTrip {
|
|
325
|
+
const message = createBaseOptimizationTrip();
|
|
326
|
+
message.geometry = (object.geometry !== undefined && object.geometry !== null)
|
|
327
|
+
? LineString.fromPartial(object.geometry)
|
|
328
|
+
: undefined;
|
|
329
|
+
message.legs = object.legs?.map((e) => RouteLeg.fromPartial(e)) || [];
|
|
330
|
+
message.distance = object.distance ?? 0;
|
|
331
|
+
message.duration = object.duration ?? 0;
|
|
332
|
+
message.weight = object.weight ?? 0;
|
|
333
|
+
return message;
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
function createBaseOptimizationWaypoint(): OptimizationWaypoint {
|
|
338
|
+
return { name: "", location: [], waypointIndex: 0, tripsIndex: 0 };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export const OptimizationWaypoint: MessageFns<OptimizationWaypoint> = {
|
|
342
|
+
encode(message: OptimizationWaypoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
343
|
+
if (message.name !== "") {
|
|
344
|
+
writer.uint32(10).string(message.name);
|
|
345
|
+
}
|
|
346
|
+
writer.uint32(18).fork();
|
|
347
|
+
for (const v of message.location) {
|
|
348
|
+
writer.double(v);
|
|
349
|
+
}
|
|
350
|
+
writer.join();
|
|
351
|
+
if (message.waypointIndex !== 0) {
|
|
352
|
+
writer.uint32(24).int32(message.waypointIndex);
|
|
353
|
+
}
|
|
354
|
+
if (message.tripsIndex !== 0) {
|
|
355
|
+
writer.uint32(32).int32(message.tripsIndex);
|
|
356
|
+
}
|
|
357
|
+
return writer;
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
decode(input: BinaryReader | Uint8Array, length?: number): OptimizationWaypoint {
|
|
361
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
362
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
363
|
+
const message = createBaseOptimizationWaypoint();
|
|
364
|
+
while (reader.pos < end) {
|
|
365
|
+
const tag = reader.uint32();
|
|
366
|
+
switch (tag >>> 3) {
|
|
367
|
+
case 1: {
|
|
368
|
+
if (tag !== 10) {
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
message.name = reader.string();
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
case 2: {
|
|
376
|
+
if (tag === 17) {
|
|
377
|
+
message.location.push(reader.double());
|
|
378
|
+
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (tag === 18) {
|
|
383
|
+
const end2 = reader.uint32() + reader.pos;
|
|
384
|
+
while (reader.pos < end2) {
|
|
385
|
+
message.location.push(reader.double());
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
case 3: {
|
|
394
|
+
if (tag !== 24) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
message.waypointIndex = reader.int32();
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
case 4: {
|
|
402
|
+
if (tag !== 32) {
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
message.tripsIndex = reader.int32();
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
reader.skip(tag & 7);
|
|
414
|
+
}
|
|
415
|
+
return message;
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
create<I extends Exact<DeepPartial<OptimizationWaypoint>, I>>(base?: I): OptimizationWaypoint {
|
|
419
|
+
return OptimizationWaypoint.fromPartial(base ?? ({} as any));
|
|
420
|
+
},
|
|
421
|
+
fromPartial<I extends Exact<DeepPartial<OptimizationWaypoint>, I>>(object: I): OptimizationWaypoint {
|
|
422
|
+
const message = createBaseOptimizationWaypoint();
|
|
423
|
+
message.name = object.name ?? "";
|
|
424
|
+
message.location = object.location?.map((e) => e) || [];
|
|
425
|
+
message.waypointIndex = object.waypointIndex ?? 0;
|
|
426
|
+
message.tripsIndex = object.tripsIndex ?? 0;
|
|
427
|
+
return message;
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
export interface OptimizationService {
|
|
432
|
+
GetOptimizedRoute(request: OptimizationRequest): Promise<OptimizationResponse>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export const OptimizationServiceServiceName = "optimization.v1.OptimizationService";
|
|
436
|
+
export class OptimizationServiceClientImpl implements OptimizationService {
|
|
437
|
+
private readonly rpc: Rpc;
|
|
438
|
+
private readonly service: string;
|
|
439
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
440
|
+
this.service = opts?.service || OptimizationServiceServiceName;
|
|
441
|
+
this.rpc = rpc;
|
|
442
|
+
this.GetOptimizedRoute = this.GetOptimizedRoute.bind(this);
|
|
443
|
+
}
|
|
444
|
+
GetOptimizedRoute(request: OptimizationRequest): Promise<OptimizationResponse> {
|
|
445
|
+
const data = OptimizationRequest.encode(request).finish();
|
|
446
|
+
const promise = this.rpc.request(this.service, "GetOptimizedRoute", data);
|
|
447
|
+
return promise.then((data) => OptimizationResponse.decode(new BinaryReader(data)));
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
interface Rpc {
|
|
452
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
456
|
+
|
|
457
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
458
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
459
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
460
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
461
|
+
: Partial<T>;
|
|
462
|
+
|
|
463
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
464
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
465
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
466
|
+
|
|
467
|
+
export interface MessageFns<T> {
|
|
468
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
469
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
470
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
471
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
472
|
+
}
|