@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,369 @@
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-matrix-v1.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import { Point } from "./common-geocode-v1";
10
+
11
+ export const protobufPackage = "matrix.v1";
12
+
13
+ export interface MatrixRequest {
14
+ coordinates: Point[];
15
+ profile: string;
16
+ annotations: string[];
17
+ }
18
+
19
+ export interface MatrixResponse {
20
+ code: string;
21
+ durations: MatrixRow[];
22
+ distances: MatrixRow[];
23
+ destinations: MatrixWaypoint[];
24
+ sources: MatrixWaypoint[];
25
+ }
26
+
27
+ export interface MatrixRow {
28
+ values: number[];
29
+ }
30
+
31
+ export interface MatrixWaypoint {
32
+ name: string;
33
+ location: number[];
34
+ }
35
+
36
+ function createBaseMatrixRequest(): MatrixRequest {
37
+ return { coordinates: [], profile: "", annotations: [] };
38
+ }
39
+
40
+ export const MatrixRequest: MessageFns<MatrixRequest> = {
41
+ encode(message: MatrixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
42
+ for (const v of message.coordinates) {
43
+ Point.encode(v!, writer.uint32(10).fork()).join();
44
+ }
45
+ if (message.profile !== "") {
46
+ writer.uint32(18).string(message.profile);
47
+ }
48
+ for (const v of message.annotations) {
49
+ writer.uint32(26).string(v!);
50
+ }
51
+ return writer;
52
+ },
53
+
54
+ decode(input: BinaryReader | Uint8Array, length?: number): MatrixRequest {
55
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
56
+ const end = length === undefined ? reader.len : reader.pos + length;
57
+ const message = createBaseMatrixRequest();
58
+ while (reader.pos < end) {
59
+ const tag = reader.uint32();
60
+ switch (tag >>> 3) {
61
+ case 1: {
62
+ if (tag !== 10) {
63
+ break;
64
+ }
65
+
66
+ message.coordinates.push(Point.decode(reader, reader.uint32()));
67
+ continue;
68
+ }
69
+ case 2: {
70
+ if (tag !== 18) {
71
+ break;
72
+ }
73
+
74
+ message.profile = reader.string();
75
+ continue;
76
+ }
77
+ case 3: {
78
+ if (tag !== 26) {
79
+ break;
80
+ }
81
+
82
+ message.annotations.push(reader.string());
83
+ continue;
84
+ }
85
+ }
86
+ if ((tag & 7) === 4 || tag === 0) {
87
+ break;
88
+ }
89
+ reader.skip(tag & 7);
90
+ }
91
+ return message;
92
+ },
93
+
94
+ create<I extends Exact<DeepPartial<MatrixRequest>, I>>(base?: I): MatrixRequest {
95
+ return MatrixRequest.fromPartial(base ?? ({} as any));
96
+ },
97
+ fromPartial<I extends Exact<DeepPartial<MatrixRequest>, I>>(object: I): MatrixRequest {
98
+ const message = createBaseMatrixRequest();
99
+ message.coordinates = object.coordinates?.map((e) => Point.fromPartial(e)) || [];
100
+ message.profile = object.profile ?? "";
101
+ message.annotations = object.annotations?.map((e) => e) || [];
102
+ return message;
103
+ },
104
+ };
105
+
106
+ function createBaseMatrixResponse(): MatrixResponse {
107
+ return { code: "", durations: [], distances: [], destinations: [], sources: [] };
108
+ }
109
+
110
+ export const MatrixResponse: MessageFns<MatrixResponse> = {
111
+ encode(message: MatrixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
112
+ if (message.code !== "") {
113
+ writer.uint32(10).string(message.code);
114
+ }
115
+ for (const v of message.durations) {
116
+ MatrixRow.encode(v!, writer.uint32(18).fork()).join();
117
+ }
118
+ for (const v of message.distances) {
119
+ MatrixRow.encode(v!, writer.uint32(26).fork()).join();
120
+ }
121
+ for (const v of message.destinations) {
122
+ MatrixWaypoint.encode(v!, writer.uint32(34).fork()).join();
123
+ }
124
+ for (const v of message.sources) {
125
+ MatrixWaypoint.encode(v!, writer.uint32(42).fork()).join();
126
+ }
127
+ return writer;
128
+ },
129
+
130
+ decode(input: BinaryReader | Uint8Array, length?: number): MatrixResponse {
131
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
132
+ const end = length === undefined ? reader.len : reader.pos + length;
133
+ const message = createBaseMatrixResponse();
134
+ while (reader.pos < end) {
135
+ const tag = reader.uint32();
136
+ switch (tag >>> 3) {
137
+ case 1: {
138
+ if (tag !== 10) {
139
+ break;
140
+ }
141
+
142
+ message.code = reader.string();
143
+ continue;
144
+ }
145
+ case 2: {
146
+ if (tag !== 18) {
147
+ break;
148
+ }
149
+
150
+ message.durations.push(MatrixRow.decode(reader, reader.uint32()));
151
+ continue;
152
+ }
153
+ case 3: {
154
+ if (tag !== 26) {
155
+ break;
156
+ }
157
+
158
+ message.distances.push(MatrixRow.decode(reader, reader.uint32()));
159
+ continue;
160
+ }
161
+ case 4: {
162
+ if (tag !== 34) {
163
+ break;
164
+ }
165
+
166
+ message.destinations.push(MatrixWaypoint.decode(reader, reader.uint32()));
167
+ continue;
168
+ }
169
+ case 5: {
170
+ if (tag !== 42) {
171
+ break;
172
+ }
173
+
174
+ message.sources.push(MatrixWaypoint.decode(reader, reader.uint32()));
175
+ continue;
176
+ }
177
+ }
178
+ if ((tag & 7) === 4 || tag === 0) {
179
+ break;
180
+ }
181
+ reader.skip(tag & 7);
182
+ }
183
+ return message;
184
+ },
185
+
186
+ create<I extends Exact<DeepPartial<MatrixResponse>, I>>(base?: I): MatrixResponse {
187
+ return MatrixResponse.fromPartial(base ?? ({} as any));
188
+ },
189
+ fromPartial<I extends Exact<DeepPartial<MatrixResponse>, I>>(object: I): MatrixResponse {
190
+ const message = createBaseMatrixResponse();
191
+ message.code = object.code ?? "";
192
+ message.durations = object.durations?.map((e) => MatrixRow.fromPartial(e)) || [];
193
+ message.distances = object.distances?.map((e) => MatrixRow.fromPartial(e)) || [];
194
+ message.destinations = object.destinations?.map((e) => MatrixWaypoint.fromPartial(e)) || [];
195
+ message.sources = object.sources?.map((e) => MatrixWaypoint.fromPartial(e)) || [];
196
+ return message;
197
+ },
198
+ };
199
+
200
+ function createBaseMatrixRow(): MatrixRow {
201
+ return { values: [] };
202
+ }
203
+
204
+ export const MatrixRow: MessageFns<MatrixRow> = {
205
+ encode(message: MatrixRow, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
206
+ writer.uint32(10).fork();
207
+ for (const v of message.values) {
208
+ writer.double(v);
209
+ }
210
+ writer.join();
211
+ return writer;
212
+ },
213
+
214
+ decode(input: BinaryReader | Uint8Array, length?: number): MatrixRow {
215
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
216
+ const end = length === undefined ? reader.len : reader.pos + length;
217
+ const message = createBaseMatrixRow();
218
+ while (reader.pos < end) {
219
+ const tag = reader.uint32();
220
+ switch (tag >>> 3) {
221
+ case 1: {
222
+ if (tag === 9) {
223
+ message.values.push(reader.double());
224
+
225
+ continue;
226
+ }
227
+
228
+ if (tag === 10) {
229
+ const end2 = reader.uint32() + reader.pos;
230
+ while (reader.pos < end2) {
231
+ message.values.push(reader.double());
232
+ }
233
+
234
+ continue;
235
+ }
236
+
237
+ break;
238
+ }
239
+ }
240
+ if ((tag & 7) === 4 || tag === 0) {
241
+ break;
242
+ }
243
+ reader.skip(tag & 7);
244
+ }
245
+ return message;
246
+ },
247
+
248
+ create<I extends Exact<DeepPartial<MatrixRow>, I>>(base?: I): MatrixRow {
249
+ return MatrixRow.fromPartial(base ?? ({} as any));
250
+ },
251
+ fromPartial<I extends Exact<DeepPartial<MatrixRow>, I>>(object: I): MatrixRow {
252
+ const message = createBaseMatrixRow();
253
+ message.values = object.values?.map((e) => e) || [];
254
+ return message;
255
+ },
256
+ };
257
+
258
+ function createBaseMatrixWaypoint(): MatrixWaypoint {
259
+ return { name: "", location: [] };
260
+ }
261
+
262
+ export const MatrixWaypoint: MessageFns<MatrixWaypoint> = {
263
+ encode(message: MatrixWaypoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
264
+ if (message.name !== "") {
265
+ writer.uint32(10).string(message.name);
266
+ }
267
+ writer.uint32(18).fork();
268
+ for (const v of message.location) {
269
+ writer.double(v);
270
+ }
271
+ writer.join();
272
+ return writer;
273
+ },
274
+
275
+ decode(input: BinaryReader | Uint8Array, length?: number): MatrixWaypoint {
276
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
277
+ const end = length === undefined ? reader.len : reader.pos + length;
278
+ const message = createBaseMatrixWaypoint();
279
+ while (reader.pos < end) {
280
+ const tag = reader.uint32();
281
+ switch (tag >>> 3) {
282
+ case 1: {
283
+ if (tag !== 10) {
284
+ break;
285
+ }
286
+
287
+ message.name = reader.string();
288
+ continue;
289
+ }
290
+ case 2: {
291
+ if (tag === 17) {
292
+ message.location.push(reader.double());
293
+
294
+ continue;
295
+ }
296
+
297
+ if (tag === 18) {
298
+ const end2 = reader.uint32() + reader.pos;
299
+ while (reader.pos < end2) {
300
+ message.location.push(reader.double());
301
+ }
302
+
303
+ continue;
304
+ }
305
+
306
+ break;
307
+ }
308
+ }
309
+ if ((tag & 7) === 4 || tag === 0) {
310
+ break;
311
+ }
312
+ reader.skip(tag & 7);
313
+ }
314
+ return message;
315
+ },
316
+
317
+ create<I extends Exact<DeepPartial<MatrixWaypoint>, I>>(base?: I): MatrixWaypoint {
318
+ return MatrixWaypoint.fromPartial(base ?? ({} as any));
319
+ },
320
+ fromPartial<I extends Exact<DeepPartial<MatrixWaypoint>, I>>(object: I): MatrixWaypoint {
321
+ const message = createBaseMatrixWaypoint();
322
+ message.name = object.name ?? "";
323
+ message.location = object.location?.map((e) => e) || [];
324
+ return message;
325
+ },
326
+ };
327
+
328
+ export interface MatrixService {
329
+ GetMatrix(request: MatrixRequest): Promise<MatrixResponse>;
330
+ }
331
+
332
+ export const MatrixServiceServiceName = "matrix.v1.MatrixService";
333
+ export class MatrixServiceClientImpl implements MatrixService {
334
+ private readonly rpc: Rpc;
335
+ private readonly service: string;
336
+ constructor(rpc: Rpc, opts?: { service?: string }) {
337
+ this.service = opts?.service || MatrixServiceServiceName;
338
+ this.rpc = rpc;
339
+ this.GetMatrix = this.GetMatrix.bind(this);
340
+ }
341
+ GetMatrix(request: MatrixRequest): Promise<MatrixResponse> {
342
+ const data = MatrixRequest.encode(request).finish();
343
+ const promise = this.rpc.request(this.service, "GetMatrix", data);
344
+ return promise.then((data) => MatrixResponse.decode(new BinaryReader(data)));
345
+ }
346
+ }
347
+
348
+ interface Rpc {
349
+ request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
350
+ }
351
+
352
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
353
+
354
+ export type DeepPartial<T> = T extends Builtin ? T
355
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
356
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
357
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
358
+ : Partial<T>;
359
+
360
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
361
+ export type Exact<P, I extends P> = P extends Builtin ? P
362
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
363
+
364
+ export interface MessageFns<T> {
365
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
366
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
367
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
368
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
369
+ }