@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.
Files changed (61) hide show
  1. package/LICENSE.md +25 -0
  2. package/dist/events/auth/index.d.ts +1 -0
  3. package/dist/events/auth/index.js +17 -0
  4. package/dist/events/auth/verification-request.interface.d.ts +5 -0
  5. package/dist/events/auth/verification-request.interface.js +2 -0
  6. package/dist/events/index.d.ts +1 -0
  7. package/dist/events/index.js +17 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.js +19 -0
  10. package/dist/proto/index.d.ts +1 -0
  11. package/dist/proto/index.js +17 -0
  12. package/dist/proto/paths.d.ts +18 -0
  13. package/dist/proto/paths.js +27 -0
  14. package/dist/utils/data-transformer.util.d.ts +55 -0
  15. package/dist/utils/data-transformer.util.js +141 -0
  16. package/dist/utils/index.d.ts +1 -0
  17. package/dist/utils/index.js +17 -0
  18. package/gen/go/mapbox-direction-v1.pb.go +621 -0
  19. package/gen/go/mapbox-geocode-v1.pb.go +473 -0
  20. package/gen/go/mapbox-matrix-v1.pb.go +337 -0
  21. package/gen/go/mapbox-optimization-v1.pb.go +422 -0
  22. package/gen/go/mapbox-search-v1.pb.go +699 -0
  23. package/gen/ts/common-geocode-v1.ts +368 -0
  24. package/gen/ts/common-pagination-v1.ts +713 -0
  25. package/gen/ts/fleet-truck-v1.ts +1102 -0
  26. package/gen/ts/fleet-unit-v1.ts +9 -0
  27. package/gen/ts/google/protobuf/field_mask.ts +295 -0
  28. package/gen/ts/google/protobuf/wrappers.ts +544 -0
  29. package/gen/ts/identify-account-v1.ts +9 -0
  30. package/gen/ts/identify-auth-v1.ts +9 -0
  31. package/gen/ts/identify-company-v1.ts +1025 -0
  32. package/gen/ts/identify-role-v1.ts +9 -0
  33. package/gen/ts/identify-user-v1.ts +9 -0
  34. package/gen/ts/mapbox-direction-v1.ts +718 -0
  35. package/gen/ts/mapbox-geocode-v1.ts +511 -0
  36. package/gen/ts/mapbox-matrix-v1.ts +369 -0
  37. package/gen/ts/mapbox-optimization-v1.ts +472 -0
  38. package/gen/ts/mapbox-search-v1.ts +803 -0
  39. package/gen/ts/shipments-freight-v1.ts +9 -0
  40. package/gen/ts/shipments-loads-v1.ts +9 -0
  41. package/gen/ts/shipments-rate-v1.ts +9 -0
  42. package/gen/ts/shipments-stop-v1.ts +9 -0
  43. package/package.json +40 -0
  44. package/proto/common-geocode-v1.proto +10 -0
  45. package/proto/common-pagination-v1.proto +39 -0
  46. package/proto/fleet-truck-v1.proto +145 -0
  47. package/proto/fleet-unit-v1.proto +3 -0
  48. package/proto/identify-account-v1.proto +3 -0
  49. package/proto/identify-auth-v1.proto +3 -0
  50. package/proto/identify-company-v1.proto +114 -0
  51. package/proto/identify-role-v1.proto +3 -0
  52. package/proto/identify-user-v1.proto +3 -0
  53. package/proto/mapbox-direction-v1.proto +61 -0
  54. package/proto/mapbox-geocode-v1.proto +47 -0
  55. package/proto/mapbox-matrix-v1.proto +34 -0
  56. package/proto/mapbox-optimization-v1.proto +43 -0
  57. package/proto/mapbox-search-v1.proto +68 -0
  58. package/proto/shipments-freight-v1.proto +3 -0
  59. package/proto/shipments-loads-v1.proto +3 -0
  60. package/proto/shipments-rate-v1.proto +3 -0
  61. package/proto/shipments-stop-v1.proto +3 -0
@@ -0,0 +1,718 @@
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-direction-v1.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import { LineString, Point } from "./common-geocode-v1";
10
+
11
+ export const protobufPackage = "directions.v1";
12
+
13
+ export interface DirectionsRequest {
14
+ coordinates: Point[];
15
+ profile: string;
16
+ steps: boolean;
17
+ geometries: string;
18
+ }
19
+
20
+ export interface DirectionsResponse {
21
+ routes: Route[];
22
+ waypoints: Waypoint[];
23
+ code: string;
24
+ uuid: string;
25
+ }
26
+
27
+ export interface Route {
28
+ legs: RouteLeg[];
29
+ distance: number;
30
+ duration: number;
31
+ geometry: LineString | undefined;
32
+ weightName: string;
33
+ }
34
+
35
+ export interface RouteLeg {
36
+ steps: RouteStep[];
37
+ distance: number;
38
+ duration: number;
39
+ summary: string;
40
+ }
41
+
42
+ export interface RouteStep {
43
+ maneuver: Maneuver | undefined;
44
+ name: string;
45
+ distance: number;
46
+ duration: number;
47
+ mode: string;
48
+ drivingSide: string;
49
+ }
50
+
51
+ export interface Maneuver {
52
+ type: string;
53
+ instruction: string;
54
+ location: number[];
55
+ modifier?: string | undefined;
56
+ }
57
+
58
+ export interface Waypoint {
59
+ name: string;
60
+ location: number[];
61
+ }
62
+
63
+ function createBaseDirectionsRequest(): DirectionsRequest {
64
+ return { coordinates: [], profile: "", steps: false, geometries: "" };
65
+ }
66
+
67
+ export const DirectionsRequest: MessageFns<DirectionsRequest> = {
68
+ encode(message: DirectionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
69
+ for (const v of message.coordinates) {
70
+ Point.encode(v!, writer.uint32(10).fork()).join();
71
+ }
72
+ if (message.profile !== "") {
73
+ writer.uint32(18).string(message.profile);
74
+ }
75
+ if (message.steps !== false) {
76
+ writer.uint32(24).bool(message.steps);
77
+ }
78
+ if (message.geometries !== "") {
79
+ writer.uint32(34).string(message.geometries);
80
+ }
81
+ return writer;
82
+ },
83
+
84
+ decode(input: BinaryReader | Uint8Array, length?: number): DirectionsRequest {
85
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
86
+ const end = length === undefined ? reader.len : reader.pos + length;
87
+ const message = createBaseDirectionsRequest();
88
+ while (reader.pos < end) {
89
+ const tag = reader.uint32();
90
+ switch (tag >>> 3) {
91
+ case 1: {
92
+ if (tag !== 10) {
93
+ break;
94
+ }
95
+
96
+ message.coordinates.push(Point.decode(reader, reader.uint32()));
97
+ continue;
98
+ }
99
+ case 2: {
100
+ if (tag !== 18) {
101
+ break;
102
+ }
103
+
104
+ message.profile = reader.string();
105
+ continue;
106
+ }
107
+ case 3: {
108
+ if (tag !== 24) {
109
+ break;
110
+ }
111
+
112
+ message.steps = reader.bool();
113
+ continue;
114
+ }
115
+ case 4: {
116
+ if (tag !== 34) {
117
+ break;
118
+ }
119
+
120
+ message.geometries = reader.string();
121
+ continue;
122
+ }
123
+ }
124
+ if ((tag & 7) === 4 || tag === 0) {
125
+ break;
126
+ }
127
+ reader.skip(tag & 7);
128
+ }
129
+ return message;
130
+ },
131
+
132
+ create<I extends Exact<DeepPartial<DirectionsRequest>, I>>(base?: I): DirectionsRequest {
133
+ return DirectionsRequest.fromPartial(base ?? ({} as any));
134
+ },
135
+ fromPartial<I extends Exact<DeepPartial<DirectionsRequest>, I>>(object: I): DirectionsRequest {
136
+ const message = createBaseDirectionsRequest();
137
+ message.coordinates = object.coordinates?.map((e) => Point.fromPartial(e)) || [];
138
+ message.profile = object.profile ?? "";
139
+ message.steps = object.steps ?? false;
140
+ message.geometries = object.geometries ?? "";
141
+ return message;
142
+ },
143
+ };
144
+
145
+ function createBaseDirectionsResponse(): DirectionsResponse {
146
+ return { routes: [], waypoints: [], code: "", uuid: "" };
147
+ }
148
+
149
+ export const DirectionsResponse: MessageFns<DirectionsResponse> = {
150
+ encode(message: DirectionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
151
+ for (const v of message.routes) {
152
+ Route.encode(v!, writer.uint32(10).fork()).join();
153
+ }
154
+ for (const v of message.waypoints) {
155
+ Waypoint.encode(v!, writer.uint32(18).fork()).join();
156
+ }
157
+ if (message.code !== "") {
158
+ writer.uint32(26).string(message.code);
159
+ }
160
+ if (message.uuid !== "") {
161
+ writer.uint32(34).string(message.uuid);
162
+ }
163
+ return writer;
164
+ },
165
+
166
+ decode(input: BinaryReader | Uint8Array, length?: number): DirectionsResponse {
167
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
168
+ const end = length === undefined ? reader.len : reader.pos + length;
169
+ const message = createBaseDirectionsResponse();
170
+ while (reader.pos < end) {
171
+ const tag = reader.uint32();
172
+ switch (tag >>> 3) {
173
+ case 1: {
174
+ if (tag !== 10) {
175
+ break;
176
+ }
177
+
178
+ message.routes.push(Route.decode(reader, reader.uint32()));
179
+ continue;
180
+ }
181
+ case 2: {
182
+ if (tag !== 18) {
183
+ break;
184
+ }
185
+
186
+ message.waypoints.push(Waypoint.decode(reader, reader.uint32()));
187
+ continue;
188
+ }
189
+ case 3: {
190
+ if (tag !== 26) {
191
+ break;
192
+ }
193
+
194
+ message.code = reader.string();
195
+ continue;
196
+ }
197
+ case 4: {
198
+ if (tag !== 34) {
199
+ break;
200
+ }
201
+
202
+ message.uuid = reader.string();
203
+ continue;
204
+ }
205
+ }
206
+ if ((tag & 7) === 4 || tag === 0) {
207
+ break;
208
+ }
209
+ reader.skip(tag & 7);
210
+ }
211
+ return message;
212
+ },
213
+
214
+ create<I extends Exact<DeepPartial<DirectionsResponse>, I>>(base?: I): DirectionsResponse {
215
+ return DirectionsResponse.fromPartial(base ?? ({} as any));
216
+ },
217
+ fromPartial<I extends Exact<DeepPartial<DirectionsResponse>, I>>(object: I): DirectionsResponse {
218
+ const message = createBaseDirectionsResponse();
219
+ message.routes = object.routes?.map((e) => Route.fromPartial(e)) || [];
220
+ message.waypoints = object.waypoints?.map((e) => Waypoint.fromPartial(e)) || [];
221
+ message.code = object.code ?? "";
222
+ message.uuid = object.uuid ?? "";
223
+ return message;
224
+ },
225
+ };
226
+
227
+ function createBaseRoute(): Route {
228
+ return { legs: [], distance: 0, duration: 0, geometry: undefined, weightName: "" };
229
+ }
230
+
231
+ export const Route: MessageFns<Route> = {
232
+ encode(message: Route, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
233
+ for (const v of message.legs) {
234
+ RouteLeg.encode(v!, writer.uint32(10).fork()).join();
235
+ }
236
+ if (message.distance !== 0) {
237
+ writer.uint32(17).double(message.distance);
238
+ }
239
+ if (message.duration !== 0) {
240
+ writer.uint32(25).double(message.duration);
241
+ }
242
+ if (message.geometry !== undefined) {
243
+ LineString.encode(message.geometry, writer.uint32(34).fork()).join();
244
+ }
245
+ if (message.weightName !== "") {
246
+ writer.uint32(42).string(message.weightName);
247
+ }
248
+ return writer;
249
+ },
250
+
251
+ decode(input: BinaryReader | Uint8Array, length?: number): Route {
252
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
253
+ const end = length === undefined ? reader.len : reader.pos + length;
254
+ const message = createBaseRoute();
255
+ while (reader.pos < end) {
256
+ const tag = reader.uint32();
257
+ switch (tag >>> 3) {
258
+ case 1: {
259
+ if (tag !== 10) {
260
+ break;
261
+ }
262
+
263
+ message.legs.push(RouteLeg.decode(reader, reader.uint32()));
264
+ continue;
265
+ }
266
+ case 2: {
267
+ if (tag !== 17) {
268
+ break;
269
+ }
270
+
271
+ message.distance = reader.double();
272
+ continue;
273
+ }
274
+ case 3: {
275
+ if (tag !== 25) {
276
+ break;
277
+ }
278
+
279
+ message.duration = reader.double();
280
+ continue;
281
+ }
282
+ case 4: {
283
+ if (tag !== 34) {
284
+ break;
285
+ }
286
+
287
+ message.geometry = LineString.decode(reader, reader.uint32());
288
+ continue;
289
+ }
290
+ case 5: {
291
+ if (tag !== 42) {
292
+ break;
293
+ }
294
+
295
+ message.weightName = reader.string();
296
+ continue;
297
+ }
298
+ }
299
+ if ((tag & 7) === 4 || tag === 0) {
300
+ break;
301
+ }
302
+ reader.skip(tag & 7);
303
+ }
304
+ return message;
305
+ },
306
+
307
+ create<I extends Exact<DeepPartial<Route>, I>>(base?: I): Route {
308
+ return Route.fromPartial(base ?? ({} as any));
309
+ },
310
+ fromPartial<I extends Exact<DeepPartial<Route>, I>>(object: I): Route {
311
+ const message = createBaseRoute();
312
+ message.legs = object.legs?.map((e) => RouteLeg.fromPartial(e)) || [];
313
+ message.distance = object.distance ?? 0;
314
+ message.duration = object.duration ?? 0;
315
+ message.geometry = (object.geometry !== undefined && object.geometry !== null)
316
+ ? LineString.fromPartial(object.geometry)
317
+ : undefined;
318
+ message.weightName = object.weightName ?? "";
319
+ return message;
320
+ },
321
+ };
322
+
323
+ function createBaseRouteLeg(): RouteLeg {
324
+ return { steps: [], distance: 0, duration: 0, summary: "" };
325
+ }
326
+
327
+ export const RouteLeg: MessageFns<RouteLeg> = {
328
+ encode(message: RouteLeg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
329
+ for (const v of message.steps) {
330
+ RouteStep.encode(v!, writer.uint32(10).fork()).join();
331
+ }
332
+ if (message.distance !== 0) {
333
+ writer.uint32(17).double(message.distance);
334
+ }
335
+ if (message.duration !== 0) {
336
+ writer.uint32(25).double(message.duration);
337
+ }
338
+ if (message.summary !== "") {
339
+ writer.uint32(34).string(message.summary);
340
+ }
341
+ return writer;
342
+ },
343
+
344
+ decode(input: BinaryReader | Uint8Array, length?: number): RouteLeg {
345
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
346
+ const end = length === undefined ? reader.len : reader.pos + length;
347
+ const message = createBaseRouteLeg();
348
+ while (reader.pos < end) {
349
+ const tag = reader.uint32();
350
+ switch (tag >>> 3) {
351
+ case 1: {
352
+ if (tag !== 10) {
353
+ break;
354
+ }
355
+
356
+ message.steps.push(RouteStep.decode(reader, reader.uint32()));
357
+ continue;
358
+ }
359
+ case 2: {
360
+ if (tag !== 17) {
361
+ break;
362
+ }
363
+
364
+ message.distance = reader.double();
365
+ continue;
366
+ }
367
+ case 3: {
368
+ if (tag !== 25) {
369
+ break;
370
+ }
371
+
372
+ message.duration = reader.double();
373
+ continue;
374
+ }
375
+ case 4: {
376
+ if (tag !== 34) {
377
+ break;
378
+ }
379
+
380
+ message.summary = reader.string();
381
+ continue;
382
+ }
383
+ }
384
+ if ((tag & 7) === 4 || tag === 0) {
385
+ break;
386
+ }
387
+ reader.skip(tag & 7);
388
+ }
389
+ return message;
390
+ },
391
+
392
+ create<I extends Exact<DeepPartial<RouteLeg>, I>>(base?: I): RouteLeg {
393
+ return RouteLeg.fromPartial(base ?? ({} as any));
394
+ },
395
+ fromPartial<I extends Exact<DeepPartial<RouteLeg>, I>>(object: I): RouteLeg {
396
+ const message = createBaseRouteLeg();
397
+ message.steps = object.steps?.map((e) => RouteStep.fromPartial(e)) || [];
398
+ message.distance = object.distance ?? 0;
399
+ message.duration = object.duration ?? 0;
400
+ message.summary = object.summary ?? "";
401
+ return message;
402
+ },
403
+ };
404
+
405
+ function createBaseRouteStep(): RouteStep {
406
+ return { maneuver: undefined, name: "", distance: 0, duration: 0, mode: "", drivingSide: "" };
407
+ }
408
+
409
+ export const RouteStep: MessageFns<RouteStep> = {
410
+ encode(message: RouteStep, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
411
+ if (message.maneuver !== undefined) {
412
+ Maneuver.encode(message.maneuver, writer.uint32(10).fork()).join();
413
+ }
414
+ if (message.name !== "") {
415
+ writer.uint32(18).string(message.name);
416
+ }
417
+ if (message.distance !== 0) {
418
+ writer.uint32(25).double(message.distance);
419
+ }
420
+ if (message.duration !== 0) {
421
+ writer.uint32(33).double(message.duration);
422
+ }
423
+ if (message.mode !== "") {
424
+ writer.uint32(42).string(message.mode);
425
+ }
426
+ if (message.drivingSide !== "") {
427
+ writer.uint32(50).string(message.drivingSide);
428
+ }
429
+ return writer;
430
+ },
431
+
432
+ decode(input: BinaryReader | Uint8Array, length?: number): RouteStep {
433
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
434
+ const end = length === undefined ? reader.len : reader.pos + length;
435
+ const message = createBaseRouteStep();
436
+ while (reader.pos < end) {
437
+ const tag = reader.uint32();
438
+ switch (tag >>> 3) {
439
+ case 1: {
440
+ if (tag !== 10) {
441
+ break;
442
+ }
443
+
444
+ message.maneuver = Maneuver.decode(reader, reader.uint32());
445
+ continue;
446
+ }
447
+ case 2: {
448
+ if (tag !== 18) {
449
+ break;
450
+ }
451
+
452
+ message.name = reader.string();
453
+ continue;
454
+ }
455
+ case 3: {
456
+ if (tag !== 25) {
457
+ break;
458
+ }
459
+
460
+ message.distance = reader.double();
461
+ continue;
462
+ }
463
+ case 4: {
464
+ if (tag !== 33) {
465
+ break;
466
+ }
467
+
468
+ message.duration = reader.double();
469
+ continue;
470
+ }
471
+ case 5: {
472
+ if (tag !== 42) {
473
+ break;
474
+ }
475
+
476
+ message.mode = reader.string();
477
+ continue;
478
+ }
479
+ case 6: {
480
+ if (tag !== 50) {
481
+ break;
482
+ }
483
+
484
+ message.drivingSide = reader.string();
485
+ continue;
486
+ }
487
+ }
488
+ if ((tag & 7) === 4 || tag === 0) {
489
+ break;
490
+ }
491
+ reader.skip(tag & 7);
492
+ }
493
+ return message;
494
+ },
495
+
496
+ create<I extends Exact<DeepPartial<RouteStep>, I>>(base?: I): RouteStep {
497
+ return RouteStep.fromPartial(base ?? ({} as any));
498
+ },
499
+ fromPartial<I extends Exact<DeepPartial<RouteStep>, I>>(object: I): RouteStep {
500
+ const message = createBaseRouteStep();
501
+ message.maneuver = (object.maneuver !== undefined && object.maneuver !== null)
502
+ ? Maneuver.fromPartial(object.maneuver)
503
+ : undefined;
504
+ message.name = object.name ?? "";
505
+ message.distance = object.distance ?? 0;
506
+ message.duration = object.duration ?? 0;
507
+ message.mode = object.mode ?? "";
508
+ message.drivingSide = object.drivingSide ?? "";
509
+ return message;
510
+ },
511
+ };
512
+
513
+ function createBaseManeuver(): Maneuver {
514
+ return { type: "", instruction: "", location: [], modifier: undefined };
515
+ }
516
+
517
+ export const Maneuver: MessageFns<Maneuver> = {
518
+ encode(message: Maneuver, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
519
+ if (message.type !== "") {
520
+ writer.uint32(10).string(message.type);
521
+ }
522
+ if (message.instruction !== "") {
523
+ writer.uint32(18).string(message.instruction);
524
+ }
525
+ writer.uint32(26).fork();
526
+ for (const v of message.location) {
527
+ writer.double(v);
528
+ }
529
+ writer.join();
530
+ if (message.modifier !== undefined) {
531
+ writer.uint32(34).string(message.modifier);
532
+ }
533
+ return writer;
534
+ },
535
+
536
+ decode(input: BinaryReader | Uint8Array, length?: number): Maneuver {
537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
538
+ const end = length === undefined ? reader.len : reader.pos + length;
539
+ const message = createBaseManeuver();
540
+ while (reader.pos < end) {
541
+ const tag = reader.uint32();
542
+ switch (tag >>> 3) {
543
+ case 1: {
544
+ if (tag !== 10) {
545
+ break;
546
+ }
547
+
548
+ message.type = reader.string();
549
+ continue;
550
+ }
551
+ case 2: {
552
+ if (tag !== 18) {
553
+ break;
554
+ }
555
+
556
+ message.instruction = reader.string();
557
+ continue;
558
+ }
559
+ case 3: {
560
+ if (tag === 25) {
561
+ message.location.push(reader.double());
562
+
563
+ continue;
564
+ }
565
+
566
+ if (tag === 26) {
567
+ const end2 = reader.uint32() + reader.pos;
568
+ while (reader.pos < end2) {
569
+ message.location.push(reader.double());
570
+ }
571
+
572
+ continue;
573
+ }
574
+
575
+ break;
576
+ }
577
+ case 4: {
578
+ if (tag !== 34) {
579
+ break;
580
+ }
581
+
582
+ message.modifier = reader.string();
583
+ continue;
584
+ }
585
+ }
586
+ if ((tag & 7) === 4 || tag === 0) {
587
+ break;
588
+ }
589
+ reader.skip(tag & 7);
590
+ }
591
+ return message;
592
+ },
593
+
594
+ create<I extends Exact<DeepPartial<Maneuver>, I>>(base?: I): Maneuver {
595
+ return Maneuver.fromPartial(base ?? ({} as any));
596
+ },
597
+ fromPartial<I extends Exact<DeepPartial<Maneuver>, I>>(object: I): Maneuver {
598
+ const message = createBaseManeuver();
599
+ message.type = object.type ?? "";
600
+ message.instruction = object.instruction ?? "";
601
+ message.location = object.location?.map((e) => e) || [];
602
+ message.modifier = object.modifier ?? undefined;
603
+ return message;
604
+ },
605
+ };
606
+
607
+ function createBaseWaypoint(): Waypoint {
608
+ return { name: "", location: [] };
609
+ }
610
+
611
+ export const Waypoint: MessageFns<Waypoint> = {
612
+ encode(message: Waypoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
613
+ if (message.name !== "") {
614
+ writer.uint32(10).string(message.name);
615
+ }
616
+ writer.uint32(18).fork();
617
+ for (const v of message.location) {
618
+ writer.double(v);
619
+ }
620
+ writer.join();
621
+ return writer;
622
+ },
623
+
624
+ decode(input: BinaryReader | Uint8Array, length?: number): Waypoint {
625
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
626
+ const end = length === undefined ? reader.len : reader.pos + length;
627
+ const message = createBaseWaypoint();
628
+ while (reader.pos < end) {
629
+ const tag = reader.uint32();
630
+ switch (tag >>> 3) {
631
+ case 1: {
632
+ if (tag !== 10) {
633
+ break;
634
+ }
635
+
636
+ message.name = reader.string();
637
+ continue;
638
+ }
639
+ case 2: {
640
+ if (tag === 17) {
641
+ message.location.push(reader.double());
642
+
643
+ continue;
644
+ }
645
+
646
+ if (tag === 18) {
647
+ const end2 = reader.uint32() + reader.pos;
648
+ while (reader.pos < end2) {
649
+ message.location.push(reader.double());
650
+ }
651
+
652
+ continue;
653
+ }
654
+
655
+ break;
656
+ }
657
+ }
658
+ if ((tag & 7) === 4 || tag === 0) {
659
+ break;
660
+ }
661
+ reader.skip(tag & 7);
662
+ }
663
+ return message;
664
+ },
665
+
666
+ create<I extends Exact<DeepPartial<Waypoint>, I>>(base?: I): Waypoint {
667
+ return Waypoint.fromPartial(base ?? ({} as any));
668
+ },
669
+ fromPartial<I extends Exact<DeepPartial<Waypoint>, I>>(object: I): Waypoint {
670
+ const message = createBaseWaypoint();
671
+ message.name = object.name ?? "";
672
+ message.location = object.location?.map((e) => e) || [];
673
+ return message;
674
+ },
675
+ };
676
+
677
+ export interface DirectionsService {
678
+ GetRoute(request: DirectionsRequest): Promise<DirectionsResponse>;
679
+ }
680
+
681
+ export const DirectionsServiceServiceName = "directions.v1.DirectionsService";
682
+ export class DirectionsServiceClientImpl implements DirectionsService {
683
+ private readonly rpc: Rpc;
684
+ private readonly service: string;
685
+ constructor(rpc: Rpc, opts?: { service?: string }) {
686
+ this.service = opts?.service || DirectionsServiceServiceName;
687
+ this.rpc = rpc;
688
+ this.GetRoute = this.GetRoute.bind(this);
689
+ }
690
+ GetRoute(request: DirectionsRequest): Promise<DirectionsResponse> {
691
+ const data = DirectionsRequest.encode(request).finish();
692
+ const promise = this.rpc.request(this.service, "GetRoute", data);
693
+ return promise.then((data) => DirectionsResponse.decode(new BinaryReader(data)));
694
+ }
695
+ }
696
+
697
+ interface Rpc {
698
+ request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
699
+ }
700
+
701
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
702
+
703
+ export type DeepPartial<T> = T extends Builtin ? T
704
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
705
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
706
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
707
+ : Partial<T>;
708
+
709
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
710
+ export type Exact<P, I extends P> = P extends Builtin ? P
711
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
712
+
713
+ export interface MessageFns<T> {
714
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
715
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
716
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
717
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
718
+ }