minotor 11.5.1 → 12.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.
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.18.0
4
4
  // protoc v4.23.4
5
5
  // source: src/stops/proto/v1/stops.proto
6
6
 
@@ -9,6 +9,8 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
9
 
10
10
  export const protobufPackage = "minotor.stops.v1";
11
11
 
12
+ export const protobufFileName = "src/stops/proto/v1/stops.proto";
13
+
12
14
  export enum LocationType {
13
15
  LOCATION_TYPE_UNSPECIFIED = 0,
14
16
  LOCATION_TYPE_SIMPLE_STOP_OR_PLATFORM = 1,
@@ -108,11 +110,13 @@ export const Stop: MessageFns<Stop> = {
108
110
  if (message.lon !== undefined) {
109
111
  writer.uint32(37).float(message.lon);
110
112
  }
111
- writer.uint32(42).fork();
112
- for (const v of message.children) {
113
- writer.uint32(v);
113
+ if (message.children.length !== 0) {
114
+ writer.uint32(42).fork();
115
+ for (const v of message.children) {
116
+ writer.uint32(v);
117
+ }
118
+ writer.join();
114
119
  }
115
- writer.join();
116
120
  if (message.parent !== undefined) {
117
121
  writer.uint32(48).uint32(message.parent);
118
122
  }
@@ -127,103 +131,120 @@ export const Stop: MessageFns<Stop> = {
127
131
 
128
132
  decode(input: BinaryReader | Uint8Array, length?: number): Stop {
129
133
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
130
- const end = length === undefined ? reader.len : reader.pos + length;
131
- const message = createBaseStop();
132
- while (reader.pos < end) {
133
- const tag = reader.uint32();
134
- switch (tag >>> 3) {
135
- case 1: {
136
- if (tag !== 10) {
137
- break;
138
- }
134
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
135
+ if (previousRecursionDepth >= 100) {
136
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
137
+ }
138
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
139
+ try {
140
+ const end = length === undefined ? reader.len : reader.pos + length;
141
+ const message = createBaseStop();
142
+ while (reader.pos < end) {
143
+ const tag = reader.uint32();
144
+ switch (tag >>> 3) {
145
+ case 1: {
146
+ if (tag !== 10) {
147
+ break;
148
+ }
139
149
 
140
- message.name = reader.string();
141
- continue;
142
- }
143
- case 2: {
144
- if (tag !== 18) {
145
- break;
150
+ message.name = reader.string();
151
+ continue;
146
152
  }
153
+ case 2: {
154
+ if (tag !== 18) {
155
+ break;
156
+ }
147
157
 
148
- message.sourceStopId = reader.string();
149
- continue;
150
- }
151
- case 3: {
152
- if (tag !== 29) {
153
- break;
158
+ message.sourceStopId = reader.string();
159
+ continue;
154
160
  }
161
+ case 3: {
162
+ if (tag !== 29) {
163
+ break;
164
+ }
155
165
 
156
- message.lat = reader.float();
157
- continue;
158
- }
159
- case 4: {
160
- if (tag !== 37) {
161
- break;
166
+ message.lat = reader.float();
167
+ continue;
162
168
  }
169
+ case 4: {
170
+ if (tag !== 37) {
171
+ break;
172
+ }
163
173
 
164
- message.lon = reader.float();
165
- continue;
166
- }
167
- case 5: {
168
- if (tag === 40) {
169
- message.children.push(reader.uint32());
170
-
174
+ message.lon = reader.float();
171
175
  continue;
172
176
  }
173
-
174
- if (tag === 42) {
175
- const end2 = reader.uint32() + reader.pos;
176
- while (reader.pos < end2) {
177
+ case 5: {
178
+ if (tag === 40) {
177
179
  message.children.push(reader.uint32());
180
+
181
+ continue;
178
182
  }
179
183
 
180
- continue;
181
- }
184
+ if (tag === 42) {
185
+ const end2 = reader.uint32() + reader.pos;
186
+ while (reader.pos < end2) {
187
+ message.children.push(reader.uint32());
188
+ }
189
+
190
+ continue;
191
+ }
182
192
 
183
- break;
184
- }
185
- case 6: {
186
- if (tag !== 48) {
187
193
  break;
188
194
  }
195
+ case 6: {
196
+ if (tag !== 48) {
197
+ break;
198
+ }
189
199
 
190
- message.parent = reader.uint32();
191
- continue;
192
- }
193
- case 7: {
194
- if (tag !== 56) {
195
- break;
200
+ message.parent = reader.uint32();
201
+ continue;
196
202
  }
203
+ case 7: {
204
+ if (tag !== 56) {
205
+ break;
206
+ }
197
207
 
198
- message.locationType = reader.int32() as any;
199
- continue;
200
- }
201
- case 8: {
202
- if (tag !== 66) {
203
- break;
208
+ message.locationType = reader.int32() as any;
209
+ continue;
204
210
  }
211
+ case 8: {
212
+ if (tag !== 66) {
213
+ break;
214
+ }
205
215
 
206
- message.platform = reader.string();
207
- continue;
216
+ message.platform = reader.string();
217
+ continue;
218
+ }
208
219
  }
220
+ if ((tag & 7) === 4 || tag === 0) {
221
+ break;
222
+ }
223
+ reader.skip(tag & 7);
209
224
  }
210
- if ((tag & 7) === 4 || tag === 0) {
211
- break;
212
- }
213
- reader.skip(tag & 7);
225
+ return message;
226
+ } finally {
227
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
214
228
  }
215
- return message;
216
229
  },
217
230
 
218
231
  fromJSON(object: any): Stop {
219
232
  return {
220
233
  name: isSet(object.name) ? globalThis.String(object.name) : "",
221
- sourceStopId: isSet(object.sourceStopId) ? globalThis.String(object.sourceStopId) : undefined,
234
+ sourceStopId: isSet(object.sourceStopId)
235
+ ? globalThis.String(object.sourceStopId)
236
+ : isSet(object.source_stop_id)
237
+ ? globalThis.String(object.source_stop_id)
238
+ : undefined,
222
239
  lat: isSet(object.lat) ? globalThis.Number(object.lat) : undefined,
223
240
  lon: isSet(object.lon) ? globalThis.Number(object.lon) : undefined,
224
241
  children: globalThis.Array.isArray(object?.children) ? object.children.map((e: any) => globalThis.Number(e)) : [],
225
242
  parent: isSet(object.parent) ? globalThis.Number(object.parent) : undefined,
226
- locationType: isSet(object.locationType) ? locationTypeFromJSON(object.locationType) : 0,
243
+ locationType: isSet(object.locationType)
244
+ ? locationTypeFromJSON(object.locationType)
245
+ : isSet(object.location_type)
246
+ ? locationTypeFromJSON(object.location_type)
247
+ : 0,
227
248
  platform: isSet(object.platform) ? globalThis.String(object.platform) : undefined,
228
249
  };
229
250
  },
@@ -237,10 +258,10 @@ export const Stop: MessageFns<Stop> = {
237
258
  obj.sourceStopId = message.sourceStopId;
238
259
  }
239
260
  if (message.lat !== undefined) {
240
- obj.lat = message.lat;
261
+ obj.lat = floatToJson(message.lat);
241
262
  }
242
263
  if (message.lon !== undefined) {
243
- obj.lon = message.lon;
264
+ obj.lon = floatToJson(message.lon);
244
265
  }
245
266
  if (message.children?.length) {
246
267
  obj.children = message.children.map((e) => Math.round(e));
@@ -288,26 +309,35 @@ export const StopsMap: MessageFns<StopsMap> = {
288
309
 
289
310
  decode(input: BinaryReader | Uint8Array, length?: number): StopsMap {
290
311
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
291
- const end = length === undefined ? reader.len : reader.pos + length;
292
- const message = createBaseStopsMap();
293
- while (reader.pos < end) {
294
- const tag = reader.uint32();
295
- switch (tag >>> 3) {
296
- case 2: {
297
- if (tag !== 18) {
298
- break;
299
- }
312
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
313
+ if (previousRecursionDepth >= 100) {
314
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
315
+ }
316
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
317
+ try {
318
+ const end = length === undefined ? reader.len : reader.pos + length;
319
+ const message = createBaseStopsMap();
320
+ while (reader.pos < end) {
321
+ const tag = reader.uint32();
322
+ switch (tag >>> 3) {
323
+ case 2: {
324
+ if (tag !== 18) {
325
+ break;
326
+ }
300
327
 
301
- message.stops.push(Stop.decode(reader, reader.uint32()));
302
- continue;
328
+ message.stops.push(Stop.decode(reader, reader.uint32()));
329
+ continue;
330
+ }
303
331
  }
332
+ if ((tag & 7) === 4 || tag === 0) {
333
+ break;
334
+ }
335
+ reader.skip(tag & 7);
304
336
  }
305
- if ((tag & 7) === 4 || tag === 0) {
306
- break;
307
- }
308
- reader.skip(tag & 7);
337
+ return message;
338
+ } finally {
339
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
309
340
  }
310
- return message;
311
341
  },
312
342
 
313
343
  fromJSON(object: any): StopsMap {
@@ -332,6 +362,10 @@ export const StopsMap: MessageFns<StopsMap> = {
332
362
  },
333
363
  };
334
364
 
365
+ function floatToJson(value: number | null | undefined): number | string | null | undefined {
366
+ return typeof value === "number" && !globalThis.Number.isFinite(value) ? globalThis.String(value) : value;
367
+ }
368
+
335
369
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
336
370
 
337
371
  export type DeepPartial<T> = T extends Builtin ? T
@@ -140,7 +140,7 @@ export class StopsIndex {
140
140
  maxResults,
141
141
  radius,
142
142
  ).map((id) => {
143
- const stopPoint = this.stopPoints[id as number] as StopPoint;
143
+ const stopPoint = this.stopPoints[id] as StopPoint;
144
144
  return this.stops[stopPoint.id] as Stop;
145
145
  });
146
146
  return nearestStops;