minotor 7.0.2 → 9.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/.cspell.json +11 -1
- package/CHANGELOG.md +8 -3
- package/README.md +26 -24
- package/dist/cli.mjs +1786 -791
- package/dist/cli.mjs.map +1 -1
- package/dist/gtfs/transfers.d.ts +29 -5
- package/dist/gtfs/trips.d.ts +10 -5
- package/dist/parser.cjs.js +972 -525
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.esm.js +972 -525
- package/dist/parser.esm.js.map +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +2 -2
- package/dist/router.esm.js +1 -1
- package/dist/router.esm.js.map +1 -1
- package/dist/router.umd.js +1 -1
- package/dist/router.umd.js.map +1 -1
- package/dist/routing/__tests__/plotter.test.d.ts +1 -0
- package/dist/routing/plotter.d.ts +42 -3
- package/dist/routing/result.d.ts +23 -7
- package/dist/routing/route.d.ts +2 -0
- package/dist/routing/router.d.ts +78 -19
- package/dist/timetable/__tests__/tripBoardingId.test.d.ts +1 -0
- package/dist/timetable/io.d.ts +4 -2
- package/dist/timetable/proto/timetable.d.ts +15 -1
- package/dist/timetable/route.d.ts +48 -23
- package/dist/timetable/timetable.d.ts +24 -7
- package/dist/timetable/tripBoardingId.d.ts +34 -0
- package/package.json +1 -1
- package/src/__e2e__/router.test.ts +114 -105
- package/src/__e2e__/timetable/stops.bin +2 -2
- package/src/__e2e__/timetable/timetable.bin +2 -2
- package/src/cli/repl.ts +245 -1
- package/src/gtfs/__tests__/parser.test.ts +19 -4
- package/src/gtfs/__tests__/transfers.test.ts +773 -37
- package/src/gtfs/__tests__/trips.test.ts +308 -27
- package/src/gtfs/parser.ts +36 -6
- package/src/gtfs/transfers.ts +193 -19
- package/src/gtfs/trips.ts +58 -21
- package/src/router.ts +2 -2
- package/src/routing/__tests__/plotter.test.ts +230 -0
- package/src/routing/__tests__/result.test.ts +486 -125
- package/src/routing/__tests__/route.test.ts +7 -3
- package/src/routing/__tests__/router.test.ts +380 -172
- package/src/routing/plotter.ts +279 -48
- package/src/routing/result.ts +114 -34
- package/src/routing/route.ts +0 -3
- package/src/routing/router.ts +344 -211
- package/src/timetable/__tests__/io.test.ts +34 -1
- package/src/timetable/__tests__/route.test.ts +74 -81
- package/src/timetable/__tests__/timetable.test.ts +232 -61
- package/src/timetable/__tests__/tripBoardingId.test.ts +57 -0
- package/src/timetable/io.ts +72 -10
- package/src/timetable/proto/timetable.proto +16 -2
- package/src/timetable/proto/timetable.ts +256 -22
- package/src/timetable/route.ts +174 -58
- package/src/timetable/timetable.ts +66 -16
- package/src/timetable/tripBoardingId.ts +94 -0
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { RouteId, StopRouteIndex, TripRouteIndex } from '../route.js';
|
|
5
|
+
import {
|
|
6
|
+
decode,
|
|
7
|
+
encode,
|
|
8
|
+
getRouteId,
|
|
9
|
+
getStopIndex,
|
|
10
|
+
getTripIndex,
|
|
11
|
+
} from '../tripBoardingId.js';
|
|
12
|
+
|
|
13
|
+
describe('tripBoardingId', () => {
|
|
14
|
+
it('should maintain identity for encode/decode round-trip', () => {
|
|
15
|
+
const testCases: [StopRouteIndex, RouteId, TripRouteIndex][] = [
|
|
16
|
+
[0, 0, 0],
|
|
17
|
+
[1, 1, 1],
|
|
18
|
+
[500, 1000, 500],
|
|
19
|
+
[100000, 200000, 300000],
|
|
20
|
+
[0, 1048575, 0],
|
|
21
|
+
[1048575, 0, 1048575],
|
|
22
|
+
[1048575, 1048575, 1048575], // Maximum values (2^20 - 1)
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
testCases.forEach(([stopIndex, routeId, tripIndex]) => {
|
|
26
|
+
const tripBoardingId = encode(stopIndex, routeId, tripIndex);
|
|
27
|
+
const [decodedStopIndex, decodedRouteId, decodedTripIndex] =
|
|
28
|
+
decode(tripBoardingId);
|
|
29
|
+
|
|
30
|
+
assert.strictEqual(decodedStopIndex, stopIndex);
|
|
31
|
+
assert.strictEqual(decodedRouteId, routeId);
|
|
32
|
+
assert.strictEqual(decodedTripIndex, tripIndex);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should extract stop index correctly', () => {
|
|
37
|
+
const tripBoardingId = encode(42, 100, 200);
|
|
38
|
+
assert.strictEqual(getStopIndex(tripBoardingId), 42);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should extract route ID correctly', () => {
|
|
42
|
+
const tripBoardingId = encode(42, 100, 200);
|
|
43
|
+
assert.strictEqual(getRouteId(tripBoardingId), 100);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should extract trip index correctly', () => {
|
|
47
|
+
const tripBoardingId = encode(42, 100, 200);
|
|
48
|
+
assert.strictEqual(getTripIndex(tripBoardingId), 200);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should throw error for values exceeding 20-bit limit', () => {
|
|
52
|
+
const maxValue = 1048575; // 2^20 - 1
|
|
53
|
+
assert.throws(() => encode(maxValue + 1, 0, 0));
|
|
54
|
+
assert.throws(() => encode(0, maxValue + 1, 0));
|
|
55
|
+
assert.throws(() => encode(0, 0, maxValue + 1));
|
|
56
|
+
});
|
|
57
|
+
});
|
package/src/timetable/io.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ServiceRoute as ProtoServiceRoute,
|
|
6
6
|
StopAdjacency as ProtoStopAdjacency,
|
|
7
7
|
TransferType as ProtoTransferType,
|
|
8
|
+
TripContinuationEntry as ProtoTripContinuationEntry,
|
|
8
9
|
} from './proto/timetable.js';
|
|
9
10
|
import { Route } from './route.js';
|
|
10
11
|
import {
|
|
@@ -14,7 +15,10 @@ import {
|
|
|
14
15
|
StopAdjacency,
|
|
15
16
|
Transfer,
|
|
16
17
|
TransferType,
|
|
18
|
+
TripBoarding,
|
|
19
|
+
TripContinuations,
|
|
17
20
|
} from './timetable.js';
|
|
21
|
+
import { decode, encode, TripBoardingId } from './tripBoardingId.js';
|
|
18
22
|
|
|
19
23
|
export type SerializedRoute = {
|
|
20
24
|
stopTimes: Uint16Array;
|
|
@@ -125,13 +129,15 @@ export const serializeStopsAdjacency = (
|
|
|
125
129
|
): ProtoStopAdjacency[] => {
|
|
126
130
|
return stopsAdjacency.map((value) => {
|
|
127
131
|
return {
|
|
128
|
-
transfers: value.transfers
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
transfers: value.transfers
|
|
133
|
+
? value.transfers.map((transfer) => ({
|
|
134
|
+
destination: transfer.destination,
|
|
135
|
+
type: serializeTransferType(transfer.type),
|
|
136
|
+
...(transfer.minTransferTime !== undefined && {
|
|
137
|
+
minTransferTime: transfer.minTransferTime.toSeconds(),
|
|
138
|
+
}),
|
|
139
|
+
}))
|
|
140
|
+
: [],
|
|
135
141
|
routes: value.routes,
|
|
136
142
|
};
|
|
137
143
|
});
|
|
@@ -190,10 +196,15 @@ export const deserializeStopsAdjacency = (
|
|
|
190
196
|
transfers.push(newTransfer);
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
|
|
194
|
-
transfers: transfers,
|
|
199
|
+
const stopAdjacency: StopAdjacency = {
|
|
195
200
|
routes: value.routes,
|
|
196
|
-
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
if (transfers.length > 0) {
|
|
204
|
+
stopAdjacency.transfers = transfers;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
result.push(stopAdjacency);
|
|
197
208
|
}
|
|
198
209
|
|
|
199
210
|
return result;
|
|
@@ -210,6 +221,7 @@ export const deserializeRoutesAdjacency = (
|
|
|
210
221
|
const stops = bytesToUint32Array(value.stops);
|
|
211
222
|
routesAdjacency.push(
|
|
212
223
|
new Route(
|
|
224
|
+
i,
|
|
213
225
|
bytesToUint16Array(value.stopTimes),
|
|
214
226
|
value.pickUpDropOffTypes,
|
|
215
227
|
stops,
|
|
@@ -319,3 +331,53 @@ const serializeRouteType = (type: RouteType): ProtoRouteType => {
|
|
|
319
331
|
return ProtoRouteType.MONORAIL;
|
|
320
332
|
}
|
|
321
333
|
};
|
|
334
|
+
|
|
335
|
+
export const serializeTripContinuations = (
|
|
336
|
+
tripContinuations: TripContinuations,
|
|
337
|
+
): ProtoTripContinuationEntry[] => {
|
|
338
|
+
const result: ProtoTripContinuationEntry[] = [];
|
|
339
|
+
for (const [tripBoardingId, boardings] of tripContinuations.entries()) {
|
|
340
|
+
const [originStopIndex, originRouteId, originTripIndex] =
|
|
341
|
+
decode(tripBoardingId);
|
|
342
|
+
|
|
343
|
+
result.push({
|
|
344
|
+
originStopIndex,
|
|
345
|
+
originRouteId,
|
|
346
|
+
originTripIndex,
|
|
347
|
+
continuations: boardings.map((tripBoarding) => ({
|
|
348
|
+
hopOnStopIndex: tripBoarding.hopOnStopIndex,
|
|
349
|
+
routeId: tripBoarding.routeId,
|
|
350
|
+
tripIndex: tripBoarding.tripIndex,
|
|
351
|
+
})),
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return result;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
export const deserializeTripContinuations = (
|
|
359
|
+
protoTripContinuations: ProtoTripContinuationEntry[],
|
|
360
|
+
): TripContinuations => {
|
|
361
|
+
const result = new Map<TripBoardingId, TripBoarding[]>();
|
|
362
|
+
|
|
363
|
+
for (let i = 0; i < protoTripContinuations.length; i++) {
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
365
|
+
const entry = protoTripContinuations[i]!;
|
|
366
|
+
const tripBoardingId = encode(
|
|
367
|
+
entry.originStopIndex,
|
|
368
|
+
entry.originRouteId,
|
|
369
|
+
entry.originTripIndex,
|
|
370
|
+
);
|
|
371
|
+
const tripBoardings: TripBoarding[] = entry.continuations.map(
|
|
372
|
+
(protoTripBoarding) => ({
|
|
373
|
+
hopOnStopIndex: protoTripBoarding.hopOnStopIndex,
|
|
374
|
+
routeId: protoTripBoarding.routeId,
|
|
375
|
+
tripIndex: protoTripBoarding.tripIndex,
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
result.set(tripBoardingId, tripBoardings);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return result;
|
|
383
|
+
};
|
|
@@ -40,9 +40,22 @@ message Transfer {
|
|
|
40
40
|
optional uint32 minTransferTime = 3;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
message TripBoarding {
|
|
44
|
+
uint32 hopOnStopIndex = 1;
|
|
45
|
+
uint32 routeId = 2;
|
|
46
|
+
uint32 tripIndex = 3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message TripContinuationEntry {
|
|
50
|
+
uint32 originStopIndex = 1;
|
|
51
|
+
uint32 originRouteId = 2;
|
|
52
|
+
uint32 originTripIndex = 3;
|
|
53
|
+
repeated TripBoarding continuations = 4;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
message StopAdjacency {
|
|
44
|
-
repeated
|
|
45
|
-
repeated
|
|
57
|
+
repeated uint32 routes = 1;
|
|
58
|
+
repeated Transfer transfers = 2;
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
enum RouteType {
|
|
@@ -69,4 +82,5 @@ message Timetable {
|
|
|
69
82
|
repeated StopAdjacency stopsAdjacency = 2;
|
|
70
83
|
repeated Route routesAdjacency = 3;
|
|
71
84
|
repeated ServiceRoute serviceRoutes = 4;
|
|
85
|
+
repeated TripContinuationEntry tripContinuations = 5;
|
|
72
86
|
}
|
|
@@ -166,9 +166,22 @@ export interface Transfer {
|
|
|
166
166
|
minTransferTime?: number | undefined;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
export interface TripBoarding {
|
|
170
|
+
hopOnStopIndex: number;
|
|
171
|
+
routeId: number;
|
|
172
|
+
tripIndex: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface TripContinuationEntry {
|
|
176
|
+
originStopIndex: number;
|
|
177
|
+
originRouteId: number;
|
|
178
|
+
originTripIndex: number;
|
|
179
|
+
continuations: TripBoarding[];
|
|
180
|
+
}
|
|
181
|
+
|
|
169
182
|
export interface StopAdjacency {
|
|
170
|
-
transfers: Transfer[];
|
|
171
183
|
routes: number[];
|
|
184
|
+
transfers: Transfer[];
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
export interface ServiceRoute {
|
|
@@ -182,6 +195,7 @@ export interface Timetable {
|
|
|
182
195
|
stopsAdjacency: StopAdjacency[];
|
|
183
196
|
routesAdjacency: Route[];
|
|
184
197
|
serviceRoutes: ServiceRoute[];
|
|
198
|
+
tripContinuations: TripContinuationEntry[];
|
|
185
199
|
}
|
|
186
200
|
|
|
187
201
|
function createBaseRoute(): Route {
|
|
@@ -391,20 +405,222 @@ export const Transfer: MessageFns<Transfer> = {
|
|
|
391
405
|
},
|
|
392
406
|
};
|
|
393
407
|
|
|
408
|
+
function createBaseTripBoarding(): TripBoarding {
|
|
409
|
+
return { hopOnStopIndex: 0, routeId: 0, tripIndex: 0 };
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export const TripBoarding: MessageFns<TripBoarding> = {
|
|
413
|
+
encode(message: TripBoarding, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
414
|
+
if (message.hopOnStopIndex !== 0) {
|
|
415
|
+
writer.uint32(8).uint32(message.hopOnStopIndex);
|
|
416
|
+
}
|
|
417
|
+
if (message.routeId !== 0) {
|
|
418
|
+
writer.uint32(16).uint32(message.routeId);
|
|
419
|
+
}
|
|
420
|
+
if (message.tripIndex !== 0) {
|
|
421
|
+
writer.uint32(24).uint32(message.tripIndex);
|
|
422
|
+
}
|
|
423
|
+
return writer;
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
decode(input: BinaryReader | Uint8Array, length?: number): TripBoarding {
|
|
427
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
428
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
429
|
+
const message = createBaseTripBoarding();
|
|
430
|
+
while (reader.pos < end) {
|
|
431
|
+
const tag = reader.uint32();
|
|
432
|
+
switch (tag >>> 3) {
|
|
433
|
+
case 1: {
|
|
434
|
+
if (tag !== 8) {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
message.hopOnStopIndex = reader.uint32();
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
case 2: {
|
|
442
|
+
if (tag !== 16) {
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
message.routeId = reader.uint32();
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
case 3: {
|
|
450
|
+
if (tag !== 24) {
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
message.tripIndex = reader.uint32();
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
reader.skip(tag & 7);
|
|
462
|
+
}
|
|
463
|
+
return message;
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
fromJSON(object: any): TripBoarding {
|
|
467
|
+
return {
|
|
468
|
+
hopOnStopIndex: isSet(object.hopOnStopIndex) ? globalThis.Number(object.hopOnStopIndex) : 0,
|
|
469
|
+
routeId: isSet(object.routeId) ? globalThis.Number(object.routeId) : 0,
|
|
470
|
+
tripIndex: isSet(object.tripIndex) ? globalThis.Number(object.tripIndex) : 0,
|
|
471
|
+
};
|
|
472
|
+
},
|
|
473
|
+
|
|
474
|
+
toJSON(message: TripBoarding): unknown {
|
|
475
|
+
const obj: any = {};
|
|
476
|
+
if (message.hopOnStopIndex !== 0) {
|
|
477
|
+
obj.hopOnStopIndex = Math.round(message.hopOnStopIndex);
|
|
478
|
+
}
|
|
479
|
+
if (message.routeId !== 0) {
|
|
480
|
+
obj.routeId = Math.round(message.routeId);
|
|
481
|
+
}
|
|
482
|
+
if (message.tripIndex !== 0) {
|
|
483
|
+
obj.tripIndex = Math.round(message.tripIndex);
|
|
484
|
+
}
|
|
485
|
+
return obj;
|
|
486
|
+
},
|
|
487
|
+
|
|
488
|
+
create<I extends Exact<DeepPartial<TripBoarding>, I>>(base?: I): TripBoarding {
|
|
489
|
+
return TripBoarding.fromPartial(base ?? ({} as any));
|
|
490
|
+
},
|
|
491
|
+
fromPartial<I extends Exact<DeepPartial<TripBoarding>, I>>(object: I): TripBoarding {
|
|
492
|
+
const message = createBaseTripBoarding();
|
|
493
|
+
message.hopOnStopIndex = object.hopOnStopIndex ?? 0;
|
|
494
|
+
message.routeId = object.routeId ?? 0;
|
|
495
|
+
message.tripIndex = object.tripIndex ?? 0;
|
|
496
|
+
return message;
|
|
497
|
+
},
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
function createBaseTripContinuationEntry(): TripContinuationEntry {
|
|
501
|
+
return { originStopIndex: 0, originRouteId: 0, originTripIndex: 0, continuations: [] };
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export const TripContinuationEntry: MessageFns<TripContinuationEntry> = {
|
|
505
|
+
encode(message: TripContinuationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
506
|
+
if (message.originStopIndex !== 0) {
|
|
507
|
+
writer.uint32(8).uint32(message.originStopIndex);
|
|
508
|
+
}
|
|
509
|
+
if (message.originRouteId !== 0) {
|
|
510
|
+
writer.uint32(16).uint32(message.originRouteId);
|
|
511
|
+
}
|
|
512
|
+
if (message.originTripIndex !== 0) {
|
|
513
|
+
writer.uint32(24).uint32(message.originTripIndex);
|
|
514
|
+
}
|
|
515
|
+
for (const v of message.continuations) {
|
|
516
|
+
TripBoarding.encode(v!, writer.uint32(34).fork()).join();
|
|
517
|
+
}
|
|
518
|
+
return writer;
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
decode(input: BinaryReader | Uint8Array, length?: number): TripContinuationEntry {
|
|
522
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
523
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
524
|
+
const message = createBaseTripContinuationEntry();
|
|
525
|
+
while (reader.pos < end) {
|
|
526
|
+
const tag = reader.uint32();
|
|
527
|
+
switch (tag >>> 3) {
|
|
528
|
+
case 1: {
|
|
529
|
+
if (tag !== 8) {
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
message.originStopIndex = reader.uint32();
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
case 2: {
|
|
537
|
+
if (tag !== 16) {
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
message.originRouteId = reader.uint32();
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
case 3: {
|
|
545
|
+
if (tag !== 24) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
message.originTripIndex = reader.uint32();
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
case 4: {
|
|
553
|
+
if (tag !== 34) {
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
message.continuations.push(TripBoarding.decode(reader, reader.uint32()));
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
reader.skip(tag & 7);
|
|
565
|
+
}
|
|
566
|
+
return message;
|
|
567
|
+
},
|
|
568
|
+
|
|
569
|
+
fromJSON(object: any): TripContinuationEntry {
|
|
570
|
+
return {
|
|
571
|
+
originStopIndex: isSet(object.originStopIndex) ? globalThis.Number(object.originStopIndex) : 0,
|
|
572
|
+
originRouteId: isSet(object.originRouteId) ? globalThis.Number(object.originRouteId) : 0,
|
|
573
|
+
originTripIndex: isSet(object.originTripIndex) ? globalThis.Number(object.originTripIndex) : 0,
|
|
574
|
+
continuations: globalThis.Array.isArray(object?.continuations)
|
|
575
|
+
? object.continuations.map((e: any) => TripBoarding.fromJSON(e))
|
|
576
|
+
: [],
|
|
577
|
+
};
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
toJSON(message: TripContinuationEntry): unknown {
|
|
581
|
+
const obj: any = {};
|
|
582
|
+
if (message.originStopIndex !== 0) {
|
|
583
|
+
obj.originStopIndex = Math.round(message.originStopIndex);
|
|
584
|
+
}
|
|
585
|
+
if (message.originRouteId !== 0) {
|
|
586
|
+
obj.originRouteId = Math.round(message.originRouteId);
|
|
587
|
+
}
|
|
588
|
+
if (message.originTripIndex !== 0) {
|
|
589
|
+
obj.originTripIndex = Math.round(message.originTripIndex);
|
|
590
|
+
}
|
|
591
|
+
if (message.continuations?.length) {
|
|
592
|
+
obj.continuations = message.continuations.map((e) => TripBoarding.toJSON(e));
|
|
593
|
+
}
|
|
594
|
+
return obj;
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
create<I extends Exact<DeepPartial<TripContinuationEntry>, I>>(base?: I): TripContinuationEntry {
|
|
598
|
+
return TripContinuationEntry.fromPartial(base ?? ({} as any));
|
|
599
|
+
},
|
|
600
|
+
fromPartial<I extends Exact<DeepPartial<TripContinuationEntry>, I>>(object: I): TripContinuationEntry {
|
|
601
|
+
const message = createBaseTripContinuationEntry();
|
|
602
|
+
message.originStopIndex = object.originStopIndex ?? 0;
|
|
603
|
+
message.originRouteId = object.originRouteId ?? 0;
|
|
604
|
+
message.originTripIndex = object.originTripIndex ?? 0;
|
|
605
|
+
message.continuations = object.continuations?.map((e) => TripBoarding.fromPartial(e)) || [];
|
|
606
|
+
return message;
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
|
|
394
610
|
function createBaseStopAdjacency(): StopAdjacency {
|
|
395
|
-
return {
|
|
611
|
+
return { routes: [], transfers: [] };
|
|
396
612
|
}
|
|
397
613
|
|
|
398
614
|
export const StopAdjacency: MessageFns<StopAdjacency> = {
|
|
399
615
|
encode(message: StopAdjacency, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
400
|
-
|
|
401
|
-
Transfer.encode(v!, writer.uint32(10).fork()).join();
|
|
402
|
-
}
|
|
403
|
-
writer.uint32(18).fork();
|
|
616
|
+
writer.uint32(10).fork();
|
|
404
617
|
for (const v of message.routes) {
|
|
405
618
|
writer.uint32(v);
|
|
406
619
|
}
|
|
407
620
|
writer.join();
|
|
621
|
+
for (const v of message.transfers) {
|
|
622
|
+
Transfer.encode(v!, writer.uint32(18).fork()).join();
|
|
623
|
+
}
|
|
408
624
|
return writer;
|
|
409
625
|
},
|
|
410
626
|
|
|
@@ -416,21 +632,13 @@ export const StopAdjacency: MessageFns<StopAdjacency> = {
|
|
|
416
632
|
const tag = reader.uint32();
|
|
417
633
|
switch (tag >>> 3) {
|
|
418
634
|
case 1: {
|
|
419
|
-
if (tag
|
|
420
|
-
break;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
message.transfers.push(Transfer.decode(reader, reader.uint32()));
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
case 2: {
|
|
427
|
-
if (tag === 16) {
|
|
635
|
+
if (tag === 8) {
|
|
428
636
|
message.routes.push(reader.uint32());
|
|
429
637
|
|
|
430
638
|
continue;
|
|
431
639
|
}
|
|
432
640
|
|
|
433
|
-
if (tag ===
|
|
641
|
+
if (tag === 10) {
|
|
434
642
|
const end2 = reader.uint32() + reader.pos;
|
|
435
643
|
while (reader.pos < end2) {
|
|
436
644
|
message.routes.push(reader.uint32());
|
|
@@ -441,6 +649,14 @@ export const StopAdjacency: MessageFns<StopAdjacency> = {
|
|
|
441
649
|
|
|
442
650
|
break;
|
|
443
651
|
}
|
|
652
|
+
case 2: {
|
|
653
|
+
if (tag !== 18) {
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
message.transfers.push(Transfer.decode(reader, reader.uint32()));
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
444
660
|
}
|
|
445
661
|
if ((tag & 7) === 4 || tag === 0) {
|
|
446
662
|
break;
|
|
@@ -452,21 +668,21 @@ export const StopAdjacency: MessageFns<StopAdjacency> = {
|
|
|
452
668
|
|
|
453
669
|
fromJSON(object: any): StopAdjacency {
|
|
454
670
|
return {
|
|
671
|
+
routes: globalThis.Array.isArray(object?.routes) ? object.routes.map((e: any) => globalThis.Number(e)) : [],
|
|
455
672
|
transfers: globalThis.Array.isArray(object?.transfers)
|
|
456
673
|
? object.transfers.map((e: any) => Transfer.fromJSON(e))
|
|
457
674
|
: [],
|
|
458
|
-
routes: globalThis.Array.isArray(object?.routes) ? object.routes.map((e: any) => globalThis.Number(e)) : [],
|
|
459
675
|
};
|
|
460
676
|
},
|
|
461
677
|
|
|
462
678
|
toJSON(message: StopAdjacency): unknown {
|
|
463
679
|
const obj: any = {};
|
|
464
|
-
if (message.transfers?.length) {
|
|
465
|
-
obj.transfers = message.transfers.map((e) => Transfer.toJSON(e));
|
|
466
|
-
}
|
|
467
680
|
if (message.routes?.length) {
|
|
468
681
|
obj.routes = message.routes.map((e) => Math.round(e));
|
|
469
682
|
}
|
|
683
|
+
if (message.transfers?.length) {
|
|
684
|
+
obj.transfers = message.transfers.map((e) => Transfer.toJSON(e));
|
|
685
|
+
}
|
|
470
686
|
return obj;
|
|
471
687
|
},
|
|
472
688
|
|
|
@@ -475,8 +691,8 @@ export const StopAdjacency: MessageFns<StopAdjacency> = {
|
|
|
475
691
|
},
|
|
476
692
|
fromPartial<I extends Exact<DeepPartial<StopAdjacency>, I>>(object: I): StopAdjacency {
|
|
477
693
|
const message = createBaseStopAdjacency();
|
|
478
|
-
message.transfers = object.transfers?.map((e) => Transfer.fromPartial(e)) || [];
|
|
479
694
|
message.routes = object.routes?.map((e) => e) || [];
|
|
695
|
+
message.transfers = object.transfers?.map((e) => Transfer.fromPartial(e)) || [];
|
|
480
696
|
return message;
|
|
481
697
|
},
|
|
482
698
|
};
|
|
@@ -586,7 +802,7 @@ export const ServiceRoute: MessageFns<ServiceRoute> = {
|
|
|
586
802
|
};
|
|
587
803
|
|
|
588
804
|
function createBaseTimetable(): Timetable {
|
|
589
|
-
return { version: "", stopsAdjacency: [], routesAdjacency: [], serviceRoutes: [] };
|
|
805
|
+
return { version: "", stopsAdjacency: [], routesAdjacency: [], serviceRoutes: [], tripContinuations: [] };
|
|
590
806
|
}
|
|
591
807
|
|
|
592
808
|
export const Timetable: MessageFns<Timetable> = {
|
|
@@ -603,6 +819,9 @@ export const Timetable: MessageFns<Timetable> = {
|
|
|
603
819
|
for (const v of message.serviceRoutes) {
|
|
604
820
|
ServiceRoute.encode(v!, writer.uint32(34).fork()).join();
|
|
605
821
|
}
|
|
822
|
+
for (const v of message.tripContinuations) {
|
|
823
|
+
TripContinuationEntry.encode(v!, writer.uint32(42).fork()).join();
|
|
824
|
+
}
|
|
606
825
|
return writer;
|
|
607
826
|
},
|
|
608
827
|
|
|
@@ -645,6 +864,14 @@ export const Timetable: MessageFns<Timetable> = {
|
|
|
645
864
|
message.serviceRoutes.push(ServiceRoute.decode(reader, reader.uint32()));
|
|
646
865
|
continue;
|
|
647
866
|
}
|
|
867
|
+
case 5: {
|
|
868
|
+
if (tag !== 42) {
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
message.tripContinuations.push(TripContinuationEntry.decode(reader, reader.uint32()));
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
648
875
|
}
|
|
649
876
|
if ((tag & 7) === 4 || tag === 0) {
|
|
650
877
|
break;
|
|
@@ -666,6 +893,9 @@ export const Timetable: MessageFns<Timetable> = {
|
|
|
666
893
|
serviceRoutes: globalThis.Array.isArray(object?.serviceRoutes)
|
|
667
894
|
? object.serviceRoutes.map((e: any) => ServiceRoute.fromJSON(e))
|
|
668
895
|
: [],
|
|
896
|
+
tripContinuations: globalThis.Array.isArray(object?.tripContinuations)
|
|
897
|
+
? object.tripContinuations.map((e: any) => TripContinuationEntry.fromJSON(e))
|
|
898
|
+
: [],
|
|
669
899
|
};
|
|
670
900
|
},
|
|
671
901
|
|
|
@@ -683,6 +913,9 @@ export const Timetable: MessageFns<Timetable> = {
|
|
|
683
913
|
if (message.serviceRoutes?.length) {
|
|
684
914
|
obj.serviceRoutes = message.serviceRoutes.map((e) => ServiceRoute.toJSON(e));
|
|
685
915
|
}
|
|
916
|
+
if (message.tripContinuations?.length) {
|
|
917
|
+
obj.tripContinuations = message.tripContinuations.map((e) => TripContinuationEntry.toJSON(e));
|
|
918
|
+
}
|
|
686
919
|
return obj;
|
|
687
920
|
},
|
|
688
921
|
|
|
@@ -695,6 +928,7 @@ export const Timetable: MessageFns<Timetable> = {
|
|
|
695
928
|
message.stopsAdjacency = object.stopsAdjacency?.map((e) => StopAdjacency.fromPartial(e)) || [];
|
|
696
929
|
message.routesAdjacency = object.routesAdjacency?.map((e) => Route.fromPartial(e)) || [];
|
|
697
930
|
message.serviceRoutes = object.serviceRoutes?.map((e) => ServiceRoute.fromPartial(e)) || [];
|
|
931
|
+
message.tripContinuations = object.tripContinuations?.map((e) => TripContinuationEntry.fromPartial(e)) || [];
|
|
698
932
|
return message;
|
|
699
933
|
},
|
|
700
934
|
};
|