minotor 5.0.0 → 6.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 (59) hide show
  1. package/CHANGELOG.md +3 -4
  2. package/dist/cli.mjs +212 -632
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/gtfs/parser.d.ts +4 -13
  5. package/dist/gtfs/routes.d.ts +16 -2
  6. package/dist/gtfs/stops.d.ts +3 -14
  7. package/dist/gtfs/transfers.d.ts +2 -2
  8. package/dist/gtfs/trips.d.ts +12 -8
  9. package/dist/parser.cjs.js +206 -629
  10. package/dist/parser.cjs.js.map +1 -1
  11. package/dist/parser.esm.js +206 -629
  12. package/dist/parser.esm.js.map +1 -1
  13. package/dist/router.cjs.js +1 -1
  14. package/dist/router.cjs.js.map +1 -1
  15. package/dist/router.esm.js +1 -1
  16. package/dist/router.esm.js.map +1 -1
  17. package/dist/router.umd.js +1 -1
  18. package/dist/router.umd.js.map +1 -1
  19. package/dist/stops/io.d.ts +3 -3
  20. package/dist/stops/proto/stops.d.ts +1 -8
  21. package/dist/stops/stops.d.ts +0 -4
  22. package/dist/stops/stopsIndex.d.ts +3 -3
  23. package/dist/timetable/io.d.ts +6 -6
  24. package/dist/timetable/proto/timetable.d.ts +5 -27
  25. package/dist/timetable/timetable.d.ts +17 -9
  26. package/package.json +1 -1
  27. package/src/__e2e__/timetable/stops.bin +2 -2
  28. package/src/__e2e__/timetable/timetable.bin +2 -2
  29. package/src/cli/minotor.ts +3 -4
  30. package/src/gtfs/__tests__/parser.test.ts +5 -6
  31. package/src/gtfs/__tests__/routes.test.ts +0 -3
  32. package/src/gtfs/__tests__/stops.test.ts +7 -137
  33. package/src/gtfs/__tests__/transfers.test.ts +7 -7
  34. package/src/gtfs/__tests__/trips.test.ts +74 -45
  35. package/src/gtfs/parser.ts +34 -57
  36. package/src/gtfs/profiles/__tests__/ch.test.ts +0 -28
  37. package/src/gtfs/profiles/ch.ts +1 -18
  38. package/src/gtfs/profiles/standard.ts +0 -9
  39. package/src/gtfs/routes.ts +43 -5
  40. package/src/gtfs/stops.ts +4 -56
  41. package/src/gtfs/transfers.ts +2 -2
  42. package/src/gtfs/trips.ts +57 -40
  43. package/src/routing/__tests__/result.test.ts +48 -48
  44. package/src/routing/__tests__/router.test.ts +279 -363
  45. package/src/routing/router.ts +3 -1
  46. package/src/stops/__tests__/io.test.ts +25 -31
  47. package/src/stops/__tests__/stopFinder.test.ts +82 -103
  48. package/src/stops/io.ts +8 -17
  49. package/src/stops/proto/stops.proto +3 -3
  50. package/src/stops/proto/stops.ts +16 -120
  51. package/src/stops/stops.ts +0 -4
  52. package/src/stops/stopsIndex.ts +20 -26
  53. package/src/timetable/__tests__/io.test.ts +44 -54
  54. package/src/timetable/__tests__/route.test.ts +11 -11
  55. package/src/timetable/__tests__/timetable.test.ts +29 -37
  56. package/src/timetable/io.ts +38 -66
  57. package/src/timetable/proto/timetable.proto +6 -13
  58. package/src/timetable/proto/timetable.ts +43 -385
  59. package/src/timetable/timetable.ts +43 -28
@@ -11459,10 +11459,10 @@ const Stop = {
11459
11459
  writer.uint32(18).string(message.sourceStopId);
11460
11460
  }
11461
11461
  if (message.lat !== undefined) {
11462
- writer.uint32(25).double(message.lat);
11462
+ writer.uint32(29).float(message.lat);
11463
11463
  }
11464
11464
  if (message.lon !== undefined) {
11465
- writer.uint32(33).double(message.lon);
11465
+ writer.uint32(37).float(message.lon);
11466
11466
  }
11467
11467
  writer.uint32(42).fork();
11468
11468
  for (const v of message.children) {
@@ -11502,17 +11502,17 @@ const Stop = {
11502
11502
  continue;
11503
11503
  }
11504
11504
  case 3: {
11505
- if (tag !== 25) {
11505
+ if (tag !== 29) {
11506
11506
  break;
11507
11507
  }
11508
- message.lat = reader.double();
11508
+ message.lat = reader.float();
11509
11509
  continue;
11510
11510
  }
11511
11511
  case 4: {
11512
- if (tag !== 33) {
11512
+ if (tag !== 37) {
11513
11513
  break;
11514
11514
  }
11515
- message.lon = reader.double();
11515
+ message.lon = reader.float();
11516
11516
  continue;
11517
11517
  }
11518
11518
  case 5: {
@@ -11617,16 +11617,16 @@ const Stop = {
11617
11617
  },
11618
11618
  };
11619
11619
  function createBaseStopsMap() {
11620
- return { version: "", stops: {} };
11620
+ return { version: "", stops: [] };
11621
11621
  }
11622
11622
  const StopsMap = {
11623
11623
  encode(message, writer = new BinaryWriter()) {
11624
11624
  if (message.version !== "") {
11625
11625
  writer.uint32(10).string(message.version);
11626
11626
  }
11627
- Object.entries(message.stops).forEach(([key, value]) => {
11628
- StopsMap_StopsEntry.encode({ key: key, value }, writer.uint32(18).fork()).join();
11629
- });
11627
+ for (const v of message.stops) {
11628
+ Stop.encode(v, writer.uint32(18).fork()).join();
11629
+ }
11630
11630
  return writer;
11631
11631
  },
11632
11632
  decode(input, length) {
@@ -11647,10 +11647,7 @@ const StopsMap = {
11647
11647
  if (tag !== 18) {
11648
11648
  break;
11649
11649
  }
11650
- const entry2 = StopsMap_StopsEntry.decode(reader, reader.uint32());
11651
- if (entry2.value !== undefined) {
11652
- message.stops[entry2.key] = entry2.value;
11653
- }
11650
+ message.stops.push(Stop.decode(reader, reader.uint32()));
11654
11651
  continue;
11655
11652
  }
11656
11653
  }
@@ -11664,27 +11661,17 @@ const StopsMap = {
11664
11661
  fromJSON(object) {
11665
11662
  return {
11666
11663
  version: isSet$1(object.version) ? globalThis.String(object.version) : "",
11667
- stops: isObject$1(object.stops)
11668
- ? Object.entries(object.stops).reduce((acc, [key, value]) => {
11669
- acc[globalThis.Number(key)] = Stop.fromJSON(value);
11670
- return acc;
11671
- }, {})
11672
- : {},
11664
+ stops: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.stops) ? object.stops.map((e) => Stop.fromJSON(e)) : [],
11673
11665
  };
11674
11666
  },
11675
11667
  toJSON(message) {
11668
+ var _a;
11676
11669
  const obj = {};
11677
11670
  if (message.version !== "") {
11678
11671
  obj.version = message.version;
11679
11672
  }
11680
- if (message.stops) {
11681
- const entries = Object.entries(message.stops);
11682
- if (entries.length > 0) {
11683
- obj.stops = {};
11684
- entries.forEach(([k, v]) => {
11685
- obj.stops[k] = Stop.toJSON(v);
11686
- });
11687
- }
11673
+ if ((_a = message.stops) === null || _a === void 0 ? void 0 : _a.length) {
11674
+ obj.stops = message.stops.map((e) => Stop.toJSON(e));
11688
11675
  }
11689
11676
  return obj;
11690
11677
  },
@@ -11695,92 +11682,15 @@ const StopsMap = {
11695
11682
  var _a, _b;
11696
11683
  const message = createBaseStopsMap();
11697
11684
  message.version = (_a = object.version) !== null && _a !== void 0 ? _a : "";
11698
- message.stops = Object.entries((_b = object.stops) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
11699
- if (value !== undefined) {
11700
- acc[globalThis.Number(key)] = Stop.fromPartial(value);
11701
- }
11702
- return acc;
11703
- }, {});
11685
+ message.stops = ((_b = object.stops) === null || _b === void 0 ? void 0 : _b.map((e) => Stop.fromPartial(e))) || [];
11704
11686
  return message;
11705
11687
  },
11706
11688
  };
11707
- function createBaseStopsMap_StopsEntry() {
11708
- return { key: 0, value: undefined };
11709
- }
11710
- const StopsMap_StopsEntry = {
11711
- encode(message, writer = new BinaryWriter()) {
11712
- if (message.key !== 0) {
11713
- writer.uint32(8).uint32(message.key);
11714
- }
11715
- if (message.value !== undefined) {
11716
- Stop.encode(message.value, writer.uint32(18).fork()).join();
11717
- }
11718
- return writer;
11719
- },
11720
- decode(input, length) {
11721
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
11722
- const end = length === undefined ? reader.len : reader.pos + length;
11723
- const message = createBaseStopsMap_StopsEntry();
11724
- while (reader.pos < end) {
11725
- const tag = reader.uint32();
11726
- switch (tag >>> 3) {
11727
- case 1: {
11728
- if (tag !== 8) {
11729
- break;
11730
- }
11731
- message.key = reader.uint32();
11732
- continue;
11733
- }
11734
- case 2: {
11735
- if (tag !== 18) {
11736
- break;
11737
- }
11738
- message.value = Stop.decode(reader, reader.uint32());
11739
- continue;
11740
- }
11741
- }
11742
- if ((tag & 7) === 4 || tag === 0) {
11743
- break;
11744
- }
11745
- reader.skip(tag & 7);
11746
- }
11747
- return message;
11748
- },
11749
- fromJSON(object) {
11750
- return {
11751
- key: isSet$1(object.key) ? globalThis.Number(object.key) : 0,
11752
- value: isSet$1(object.value) ? Stop.fromJSON(object.value) : undefined,
11753
- };
11754
- },
11755
- toJSON(message) {
11756
- const obj = {};
11757
- if (message.key !== 0) {
11758
- obj.key = Math.round(message.key);
11759
- }
11760
- if (message.value !== undefined) {
11761
- obj.value = Stop.toJSON(message.value);
11762
- }
11763
- return obj;
11764
- },
11765
- create(base) {
11766
- return StopsMap_StopsEntry.fromPartial(base !== null && base !== void 0 ? base : {});
11767
- },
11768
- fromPartial(object) {
11769
- var _a;
11770
- const message = createBaseStopsMap_StopsEntry();
11771
- message.key = (_a = object.key) !== null && _a !== void 0 ? _a : 0;
11772
- message.value = (object.value !== undefined && object.value !== null) ? Stop.fromPartial(object.value) : undefined;
11773
- return message;
11774
- },
11775
- };
11776
- function isObject$1(value) {
11777
- return typeof value === "object" && value !== null;
11778
- }
11779
11689
  function isSet$1(value) {
11780
11690
  return value !== null && value !== undefined;
11781
11691
  }
11782
11692
 
11783
- const CURRENT_VERSION$1 = '0.0.2';
11693
+ const CURRENT_VERSION$1 = '0.0.3';
11784
11694
  const serializeStop = (stop) => {
11785
11695
  return {
11786
11696
  name: stop.name,
@@ -11793,14 +11703,11 @@ const serializeStop = (stop) => {
11793
11703
  platform: stop.platform,
11794
11704
  };
11795
11705
  };
11796
- const serializeStopsMap = (stopsMap) => {
11706
+ const serializeStopsMap = (stops) => {
11797
11707
  const protoStopsMap = {
11798
11708
  version: CURRENT_VERSION$1,
11799
- stops: {},
11709
+ stops: stops.map((value) => serializeStop(value)),
11800
11710
  };
11801
- stopsMap.forEach((value, key) => {
11802
- protoStopsMap.stops[key] = serializeStop(value);
11803
- });
11804
11711
  return protoStopsMap;
11805
11712
  };
11806
11713
  const deserializeStop = (stopId, protoStop) => {
@@ -11820,12 +11727,7 @@ const deserializeStopsMap = (protoStopsMap) => {
11820
11727
  if (protoStopsMap.version !== CURRENT_VERSION$1) {
11821
11728
  throw new Error(`Unsupported stopMap version ${protoStopsMap.version}`);
11822
11729
  }
11823
- const stopsMap = new Map();
11824
- Object.entries(protoStopsMap.stops).forEach(([key, value]) => {
11825
- const intKey = parseInt(key, 10);
11826
- stopsMap.set(intKey, deserializeStop(intKey, value));
11827
- });
11828
- return stopsMap;
11730
+ return protoStopsMap.stops.map((value, intKey) => deserializeStop(intKey, value));
11829
11731
  };
11830
11732
  const parseProtoLocationType = (protoLocationType) => {
11831
11733
  switch (protoLocationType) {
@@ -11864,13 +11766,12 @@ const serializeLocationType = (locationType) => {
11864
11766
  * to efficiently find stops based on user queries.
11865
11767
  */
11866
11768
  class StopsIndex {
11867
- constructor(stopsMap) {
11868
- var _a;
11869
- this.stopsMap = stopsMap;
11769
+ constructor(stops) {
11770
+ this.stops = stops;
11870
11771
  this.sourceStopsMap = new Map();
11871
- for (const [id, stop] of stopsMap.entries()) {
11772
+ stops.forEach((stop, id) => {
11872
11773
  this.sourceStopsMap.set(stop.sourceStopId, id);
11873
- }
11774
+ });
11874
11775
  this.textIndex = lt({
11875
11776
  fields: ['name'],
11876
11777
  storeFields: ['id'],
@@ -11878,25 +11779,26 @@ class StopsIndex {
11878
11779
  processTerm: generateAccentVariants,
11879
11780
  });
11880
11781
  const stopsSet = new Map();
11881
- for (const [id, stop] of stopsMap.entries()) {
11782
+ stops.forEach((stop, id) => {
11783
+ var _a;
11882
11784
  const effectiveStopId = (_a = stop.parent) !== null && _a !== void 0 ? _a : id;
11883
11785
  if (!stopsSet.has(effectiveStopId)) {
11884
11786
  stopsSet.set(effectiveStopId, {
11885
11787
  id: effectiveStopId,
11886
11788
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11887
- name: stop.parent ? this.stopsMap.get(stop.parent).name : stop.name,
11789
+ name: stop.parent ? this.stops[stop.parent].name : stop.name,
11888
11790
  });
11889
11791
  }
11890
- }
11792
+ });
11891
11793
  const stopsArray = Array.from(stopsSet.values());
11892
11794
  q(this.textIndex, stopsArray);
11893
- this.stopPoints = Array.from(this.stopsMap.entries())
11894
- .filter(([, stop]) => {
11795
+ this.stopPoints = this.stops
11796
+ .filter((stop) => {
11895
11797
  if (stop.lat && stop.lon)
11896
11798
  return true;
11897
11799
  return false;
11898
11800
  })
11899
- .map(([id, stop]) => ({
11801
+ .map((stop, id) => ({
11900
11802
  id: id,
11901
11803
  lat: stop.lat,
11902
11804
  lon: stop.lon,
@@ -11924,7 +11826,7 @@ class StopsIndex {
11924
11826
  * @returns The serialized binary data.
11925
11827
  */
11926
11828
  serialize() {
11927
- const protoStopsMap = serializeStopsMap(this.stopsMap);
11829
+ const protoStopsMap = serializeStopsMap(this.stops);
11928
11830
  const writer = new BinaryWriter();
11929
11831
  StopsMap.encode(protoStopsMap, writer);
11930
11832
  return writer.finish();
@@ -11935,7 +11837,7 @@ class StopsIndex {
11935
11837
  * @returns The total number of stops.
11936
11838
  */
11937
11839
  size() {
11938
- return this.stopsMap.size;
11840
+ return this.stops.length;
11939
11841
  }
11940
11842
  /**
11941
11843
  * Finds stops by their name using a text search.
@@ -11945,7 +11847,7 @@ class StopsIndex {
11945
11847
  * @returns An array of Stop objects that match the search query.
11946
11848
  */
11947
11849
  findStopsByName(query, maxResults = 5) {
11948
- const results = dt(this.textIndex, query).map((result) => this.stopsMap.get(result.id));
11850
+ const results = dt(this.textIndex, query).map((result) => this.stops[result.id]);
11949
11851
  return results.slice(0, maxResults);
11950
11852
  }
11951
11853
  /**
@@ -11960,7 +11862,7 @@ class StopsIndex {
11960
11862
  findStopsByLocation(lat, lon, maxResults = 5, radius = 0.5) {
11961
11863
  const nearestStops = around(this.geoIndex, lon, lat, maxResults, radius).map((id) => {
11962
11864
  const stopPoint = this.stopPoints[id];
11963
- return this.stopsMap.get(stopPoint.id);
11865
+ return this.stops[stopPoint.id];
11964
11866
  });
11965
11867
  return nearestStops;
11966
11868
  }
@@ -11971,7 +11873,7 @@ class StopsIndex {
11971
11873
  * @returns The Stop object that matches the specified ID, or undefined if not found.
11972
11874
  */
11973
11875
  findStopById(id) {
11974
- return this.stopsMap.get(id);
11876
+ return this.stops[id];
11975
11877
  }
11976
11878
  /**
11977
11879
  * Finds a stop by its ID in the transit data source (e.g. GTFS).
@@ -11995,14 +11897,14 @@ class StopsIndex {
11995
11897
  if (id === undefined) {
11996
11898
  return [];
11997
11899
  }
11998
- const stop = this.stopsMap.get(id);
11900
+ const stop = this.stops[id];
11999
11901
  if (!stop) {
12000
11902
  return [];
12001
11903
  }
12002
11904
  const equivalentStops = stop.parent
12003
- ? ((_b = (_a = this.stopsMap.get(stop.parent)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [])
11905
+ ? ((_b = (_a = this.stops[stop.parent]) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [])
12004
11906
  : stop.children;
12005
- return Array.from(new Set([id, ...equivalentStops])).map((stopId) => this.stopsMap.get(stopId));
11907
+ return Array.from(new Set([id, ...equivalentStops])).map((stopId) => this.stops[stopId]);
12006
11908
  }
12007
11909
  }
12008
11910
 
@@ -12220,7 +12122,7 @@ function createBaseRoute() {
12220
12122
  stopTimes: new Uint8Array(0),
12221
12123
  pickUpDropOffTypes: new Uint8Array(0),
12222
12124
  stops: new Uint8Array(0),
12223
- serviceRouteId: "",
12125
+ serviceRouteId: 0,
12224
12126
  };
12225
12127
  }
12226
12128
  const Route$1 = {
@@ -12234,8 +12136,8 @@ const Route$1 = {
12234
12136
  if (message.stops.length !== 0) {
12235
12137
  writer.uint32(26).bytes(message.stops);
12236
12138
  }
12237
- if (message.serviceRouteId !== "") {
12238
- writer.uint32(34).string(message.serviceRouteId);
12139
+ if (message.serviceRouteId !== 0) {
12140
+ writer.uint32(32).uint32(message.serviceRouteId);
12239
12141
  }
12240
12142
  return writer;
12241
12143
  },
@@ -12268,10 +12170,10 @@ const Route$1 = {
12268
12170
  continue;
12269
12171
  }
12270
12172
  case 4: {
12271
- if (tag !== 34) {
12173
+ if (tag !== 32) {
12272
12174
  break;
12273
12175
  }
12274
- message.serviceRouteId = reader.string();
12176
+ message.serviceRouteId = reader.uint32();
12275
12177
  continue;
12276
12178
  }
12277
12179
  }
@@ -12289,7 +12191,7 @@ const Route$1 = {
12289
12191
  ? bytesFromBase64(object.pickUpDropOffTypes)
12290
12192
  : new Uint8Array(0),
12291
12193
  stops: isSet(object.stops) ? bytesFromBase64(object.stops) : new Uint8Array(0),
12292
- serviceRouteId: isSet(object.serviceRouteId) ? globalThis.String(object.serviceRouteId) : "",
12194
+ serviceRouteId: isSet(object.serviceRouteId) ? globalThis.Number(object.serviceRouteId) : 0,
12293
12195
  };
12294
12196
  },
12295
12197
  toJSON(message) {
@@ -12303,8 +12205,8 @@ const Route$1 = {
12303
12205
  if (message.stops.length !== 0) {
12304
12206
  obj.stops = base64FromBytes(message.stops);
12305
12207
  }
12306
- if (message.serviceRouteId !== "") {
12307
- obj.serviceRouteId = message.serviceRouteId;
12208
+ if (message.serviceRouteId !== 0) {
12209
+ obj.serviceRouteId = Math.round(message.serviceRouteId);
12308
12210
  }
12309
12211
  return obj;
12310
12212
  },
@@ -12317,7 +12219,7 @@ const Route$1 = {
12317
12219
  message.stopTimes = (_a = object.stopTimes) !== null && _a !== void 0 ? _a : new Uint8Array(0);
12318
12220
  message.pickUpDropOffTypes = (_b = object.pickUpDropOffTypes) !== null && _b !== void 0 ? _b : new Uint8Array(0);
12319
12221
  message.stops = (_c = object.stops) !== null && _c !== void 0 ? _c : new Uint8Array(0);
12320
- message.serviceRouteId = (_d = object.serviceRouteId) !== null && _d !== void 0 ? _d : "";
12222
+ message.serviceRouteId = (_d = object.serviceRouteId) !== null && _d !== void 0 ? _d : 0;
12321
12223
  return message;
12322
12224
  },
12323
12225
  };
@@ -12405,83 +12307,10 @@ const Transfer = {
12405
12307
  return message;
12406
12308
  },
12407
12309
  };
12408
- function createBaseStopsAdjacency() {
12409
- return { stops: {} };
12410
- }
12411
- const StopsAdjacency = {
12412
- encode(message, writer = new BinaryWriter()) {
12413
- Object.entries(message.stops).forEach(([key, value]) => {
12414
- StopsAdjacency_StopsEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
12415
- });
12416
- return writer;
12417
- },
12418
- decode(input, length) {
12419
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12420
- const end = length === undefined ? reader.len : reader.pos + length;
12421
- const message = createBaseStopsAdjacency();
12422
- while (reader.pos < end) {
12423
- const tag = reader.uint32();
12424
- switch (tag >>> 3) {
12425
- case 1: {
12426
- if (tag !== 10) {
12427
- break;
12428
- }
12429
- const entry1 = StopsAdjacency_StopsEntry.decode(reader, reader.uint32());
12430
- if (entry1.value !== undefined) {
12431
- message.stops[entry1.key] = entry1.value;
12432
- }
12433
- continue;
12434
- }
12435
- }
12436
- if ((tag & 7) === 4 || tag === 0) {
12437
- break;
12438
- }
12439
- reader.skip(tag & 7);
12440
- }
12441
- return message;
12442
- },
12443
- fromJSON(object) {
12444
- return {
12445
- stops: isObject(object.stops)
12446
- ? Object.entries(object.stops).reduce((acc, [key, value]) => {
12447
- acc[globalThis.Number(key)] = StopsAdjacency_StopAdjacency.fromJSON(value);
12448
- return acc;
12449
- }, {})
12450
- : {},
12451
- };
12452
- },
12453
- toJSON(message) {
12454
- const obj = {};
12455
- if (message.stops) {
12456
- const entries = Object.entries(message.stops);
12457
- if (entries.length > 0) {
12458
- obj.stops = {};
12459
- entries.forEach(([k, v]) => {
12460
- obj.stops[k] = StopsAdjacency_StopAdjacency.toJSON(v);
12461
- });
12462
- }
12463
- }
12464
- return obj;
12465
- },
12466
- create(base) {
12467
- return StopsAdjacency.fromPartial(base !== null && base !== void 0 ? base : {});
12468
- },
12469
- fromPartial(object) {
12470
- var _a;
12471
- const message = createBaseStopsAdjacency();
12472
- message.stops = Object.entries((_a = object.stops) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
12473
- if (value !== undefined) {
12474
- acc[globalThis.Number(key)] = StopsAdjacency_StopAdjacency.fromPartial(value);
12475
- }
12476
- return acc;
12477
- }, {});
12478
- return message;
12479
- },
12480
- };
12481
- function createBaseStopsAdjacency_StopAdjacency() {
12310
+ function createBaseStopAdjacency() {
12482
12311
  return { transfers: [], routes: [] };
12483
12312
  }
12484
- const StopsAdjacency_StopAdjacency = {
12313
+ const StopAdjacency = {
12485
12314
  encode(message, writer = new BinaryWriter()) {
12486
12315
  for (const v of message.transfers) {
12487
12316
  Transfer.encode(v, writer.uint32(10).fork()).join();
@@ -12496,7 +12325,7 @@ const StopsAdjacency_StopAdjacency = {
12496
12325
  decode(input, length) {
12497
12326
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12498
12327
  const end = length === undefined ? reader.len : reader.pos + length;
12499
- const message = createBaseStopsAdjacency_StopAdjacency();
12328
+ const message = createBaseStopAdjacency();
12500
12329
  while (reader.pos < end) {
12501
12330
  const tag = reader.uint32();
12502
12331
  switch (tag >>> 3) {
@@ -12549,87 +12378,16 @@ const StopsAdjacency_StopAdjacency = {
12549
12378
  return obj;
12550
12379
  },
12551
12380
  create(base) {
12552
- return StopsAdjacency_StopAdjacency.fromPartial(base !== null && base !== void 0 ? base : {});
12381
+ return StopAdjacency.fromPartial(base !== null && base !== void 0 ? base : {});
12553
12382
  },
12554
12383
  fromPartial(object) {
12555
12384
  var _a, _b;
12556
- const message = createBaseStopsAdjacency_StopAdjacency();
12385
+ const message = createBaseStopAdjacency();
12557
12386
  message.transfers = ((_a = object.transfers) === null || _a === void 0 ? void 0 : _a.map((e) => Transfer.fromPartial(e))) || [];
12558
12387
  message.routes = ((_b = object.routes) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
12559
12388
  return message;
12560
12389
  },
12561
12390
  };
12562
- function createBaseStopsAdjacency_StopsEntry() {
12563
- return { key: 0, value: undefined };
12564
- }
12565
- const StopsAdjacency_StopsEntry = {
12566
- encode(message, writer = new BinaryWriter()) {
12567
- if (message.key !== 0) {
12568
- writer.uint32(8).uint32(message.key);
12569
- }
12570
- if (message.value !== undefined) {
12571
- StopsAdjacency_StopAdjacency.encode(message.value, writer.uint32(18).fork()).join();
12572
- }
12573
- return writer;
12574
- },
12575
- decode(input, length) {
12576
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12577
- const end = length === undefined ? reader.len : reader.pos + length;
12578
- const message = createBaseStopsAdjacency_StopsEntry();
12579
- while (reader.pos < end) {
12580
- const tag = reader.uint32();
12581
- switch (tag >>> 3) {
12582
- case 1: {
12583
- if (tag !== 8) {
12584
- break;
12585
- }
12586
- message.key = reader.uint32();
12587
- continue;
12588
- }
12589
- case 2: {
12590
- if (tag !== 18) {
12591
- break;
12592
- }
12593
- message.value = StopsAdjacency_StopAdjacency.decode(reader, reader.uint32());
12594
- continue;
12595
- }
12596
- }
12597
- if ((tag & 7) === 4 || tag === 0) {
12598
- break;
12599
- }
12600
- reader.skip(tag & 7);
12601
- }
12602
- return message;
12603
- },
12604
- fromJSON(object) {
12605
- return {
12606
- key: isSet(object.key) ? globalThis.Number(object.key) : 0,
12607
- value: isSet(object.value) ? StopsAdjacency_StopAdjacency.fromJSON(object.value) : undefined,
12608
- };
12609
- },
12610
- toJSON(message) {
12611
- const obj = {};
12612
- if (message.key !== 0) {
12613
- obj.key = Math.round(message.key);
12614
- }
12615
- if (message.value !== undefined) {
12616
- obj.value = StopsAdjacency_StopAdjacency.toJSON(message.value);
12617
- }
12618
- return obj;
12619
- },
12620
- create(base) {
12621
- return StopsAdjacency_StopsEntry.fromPartial(base !== null && base !== void 0 ? base : {});
12622
- },
12623
- fromPartial(object) {
12624
- var _a;
12625
- const message = createBaseStopsAdjacency_StopsEntry();
12626
- message.key = (_a = object.key) !== null && _a !== void 0 ? _a : 0;
12627
- message.value = (object.value !== undefined && object.value !== null)
12628
- ? StopsAdjacency_StopAdjacency.fromPartial(object.value)
12629
- : undefined;
12630
- return message;
12631
- },
12632
- };
12633
12391
  function createBaseServiceRoute() {
12634
12392
  return { type: 0, name: "", routes: [] };
12635
12393
  }
@@ -12724,166 +12482,22 @@ const ServiceRoute = {
12724
12482
  return message;
12725
12483
  },
12726
12484
  };
12727
- function createBaseServiceRoutesMap() {
12728
- return { routes: {} };
12729
- }
12730
- const ServiceRoutesMap = {
12731
- encode(message, writer = new BinaryWriter()) {
12732
- Object.entries(message.routes).forEach(([key, value]) => {
12733
- ServiceRoutesMap_RoutesEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
12734
- });
12735
- return writer;
12736
- },
12737
- decode(input, length) {
12738
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12739
- const end = length === undefined ? reader.len : reader.pos + length;
12740
- const message = createBaseServiceRoutesMap();
12741
- while (reader.pos < end) {
12742
- const tag = reader.uint32();
12743
- switch (tag >>> 3) {
12744
- case 1: {
12745
- if (tag !== 10) {
12746
- break;
12747
- }
12748
- const entry1 = ServiceRoutesMap_RoutesEntry.decode(reader, reader.uint32());
12749
- if (entry1.value !== undefined) {
12750
- message.routes[entry1.key] = entry1.value;
12751
- }
12752
- continue;
12753
- }
12754
- }
12755
- if ((tag & 7) === 4 || tag === 0) {
12756
- break;
12757
- }
12758
- reader.skip(tag & 7);
12759
- }
12760
- return message;
12761
- },
12762
- fromJSON(object) {
12763
- return {
12764
- routes: isObject(object.routes)
12765
- ? Object.entries(object.routes).reduce((acc, [key, value]) => {
12766
- acc[key] = ServiceRoute.fromJSON(value);
12767
- return acc;
12768
- }, {})
12769
- : {},
12770
- };
12771
- },
12772
- toJSON(message) {
12773
- const obj = {};
12774
- if (message.routes) {
12775
- const entries = Object.entries(message.routes);
12776
- if (entries.length > 0) {
12777
- obj.routes = {};
12778
- entries.forEach(([k, v]) => {
12779
- obj.routes[k] = ServiceRoute.toJSON(v);
12780
- });
12781
- }
12782
- }
12783
- return obj;
12784
- },
12785
- create(base) {
12786
- return ServiceRoutesMap.fromPartial(base !== null && base !== void 0 ? base : {});
12787
- },
12788
- fromPartial(object) {
12789
- var _a;
12790
- const message = createBaseServiceRoutesMap();
12791
- message.routes = Object.entries((_a = object.routes) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
12792
- if (value !== undefined) {
12793
- acc[key] = ServiceRoute.fromPartial(value);
12794
- }
12795
- return acc;
12796
- }, {});
12797
- return message;
12798
- },
12799
- };
12800
- function createBaseServiceRoutesMap_RoutesEntry() {
12801
- return { key: "", value: undefined };
12802
- }
12803
- const ServiceRoutesMap_RoutesEntry = {
12804
- encode(message, writer = new BinaryWriter()) {
12805
- if (message.key !== "") {
12806
- writer.uint32(10).string(message.key);
12807
- }
12808
- if (message.value !== undefined) {
12809
- ServiceRoute.encode(message.value, writer.uint32(18).fork()).join();
12810
- }
12811
- return writer;
12812
- },
12813
- decode(input, length) {
12814
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12815
- const end = length === undefined ? reader.len : reader.pos + length;
12816
- const message = createBaseServiceRoutesMap_RoutesEntry();
12817
- while (reader.pos < end) {
12818
- const tag = reader.uint32();
12819
- switch (tag >>> 3) {
12820
- case 1: {
12821
- if (tag !== 10) {
12822
- break;
12823
- }
12824
- message.key = reader.string();
12825
- continue;
12826
- }
12827
- case 2: {
12828
- if (tag !== 18) {
12829
- break;
12830
- }
12831
- message.value = ServiceRoute.decode(reader, reader.uint32());
12832
- continue;
12833
- }
12834
- }
12835
- if ((tag & 7) === 4 || tag === 0) {
12836
- break;
12837
- }
12838
- reader.skip(tag & 7);
12839
- }
12840
- return message;
12841
- },
12842
- fromJSON(object) {
12843
- return {
12844
- key: isSet(object.key) ? globalThis.String(object.key) : "",
12845
- value: isSet(object.value) ? ServiceRoute.fromJSON(object.value) : undefined,
12846
- };
12847
- },
12848
- toJSON(message) {
12849
- const obj = {};
12850
- if (message.key !== "") {
12851
- obj.key = message.key;
12852
- }
12853
- if (message.value !== undefined) {
12854
- obj.value = ServiceRoute.toJSON(message.value);
12855
- }
12856
- return obj;
12857
- },
12858
- create(base) {
12859
- return ServiceRoutesMap_RoutesEntry.fromPartial(base !== null && base !== void 0 ? base : {});
12860
- },
12861
- fromPartial(object) {
12862
- var _a;
12863
- const message = createBaseServiceRoutesMap_RoutesEntry();
12864
- message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
12865
- message.value = (object.value !== undefined && object.value !== null)
12866
- ? ServiceRoute.fromPartial(object.value)
12867
- : undefined;
12868
- return message;
12869
- },
12870
- };
12871
12485
  function createBaseTimetable() {
12872
- return { version: "", stopsAdjacency: undefined, routesAdjacency: [], routes: undefined };
12486
+ return { version: "", stopsAdjacency: [], routesAdjacency: [], serviceRoutes: [] };
12873
12487
  }
12874
12488
  const Timetable$1 = {
12875
12489
  encode(message, writer = new BinaryWriter()) {
12876
12490
  if (message.version !== "") {
12877
12491
  writer.uint32(10).string(message.version);
12878
12492
  }
12879
- if (message.stopsAdjacency !== undefined) {
12880
- StopsAdjacency.encode(message.stopsAdjacency, writer.uint32(18).fork()).join();
12493
+ for (const v of message.stopsAdjacency) {
12494
+ StopAdjacency.encode(v, writer.uint32(18).fork()).join();
12881
12495
  }
12882
12496
  for (const v of message.routesAdjacency) {
12883
12497
  Route$1.encode(v, writer.uint32(26).fork()).join();
12884
12498
  }
12885
- if (message.routes !== undefined) {
12886
- ServiceRoutesMap.encode(message.routes, writer.uint32(34).fork()).join();
12499
+ for (const v of message.serviceRoutes) {
12500
+ ServiceRoute.encode(v, writer.uint32(34).fork()).join();
12887
12501
  }
12888
12502
  return writer;
12889
12503
  },
@@ -12905,7 +12519,7 @@ const Timetable$1 = {
12905
12519
  if (tag !== 18) {
12906
12520
  break;
12907
12521
  }
12908
- message.stopsAdjacency = StopsAdjacency.decode(reader, reader.uint32());
12522
+ message.stopsAdjacency.push(StopAdjacency.decode(reader, reader.uint32()));
12909
12523
  continue;
12910
12524
  }
12911
12525
  case 3: {
@@ -12919,7 +12533,7 @@ const Timetable$1 = {
12919
12533
  if (tag !== 34) {
12920
12534
  break;
12921
12535
  }
12922
- message.routes = ServiceRoutesMap.decode(reader, reader.uint32());
12536
+ message.serviceRoutes.push(ServiceRoute.decode(reader, reader.uint32()));
12923
12537
  continue;
12924
12538
  }
12925
12539
  }
@@ -12933,27 +12547,31 @@ const Timetable$1 = {
12933
12547
  fromJSON(object) {
12934
12548
  return {
12935
12549
  version: isSet(object.version) ? globalThis.String(object.version) : "",
12936
- stopsAdjacency: isSet(object.stopsAdjacency) ? StopsAdjacency.fromJSON(object.stopsAdjacency) : undefined,
12550
+ stopsAdjacency: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.stopsAdjacency)
12551
+ ? object.stopsAdjacency.map((e) => StopAdjacency.fromJSON(e))
12552
+ : [],
12937
12553
  routesAdjacency: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.routesAdjacency)
12938
12554
  ? object.routesAdjacency.map((e) => Route$1.fromJSON(e))
12939
12555
  : [],
12940
- routes: isSet(object.routes) ? ServiceRoutesMap.fromJSON(object.routes) : undefined,
12556
+ serviceRoutes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.serviceRoutes)
12557
+ ? object.serviceRoutes.map((e) => ServiceRoute.fromJSON(e))
12558
+ : [],
12941
12559
  };
12942
12560
  },
12943
12561
  toJSON(message) {
12944
- var _a;
12562
+ var _a, _b, _c;
12945
12563
  const obj = {};
12946
12564
  if (message.version !== "") {
12947
12565
  obj.version = message.version;
12948
12566
  }
12949
- if (message.stopsAdjacency !== undefined) {
12950
- obj.stopsAdjacency = StopsAdjacency.toJSON(message.stopsAdjacency);
12567
+ if ((_a = message.stopsAdjacency) === null || _a === void 0 ? void 0 : _a.length) {
12568
+ obj.stopsAdjacency = message.stopsAdjacency.map((e) => StopAdjacency.toJSON(e));
12951
12569
  }
12952
- if ((_a = message.routesAdjacency) === null || _a === void 0 ? void 0 : _a.length) {
12570
+ if ((_b = message.routesAdjacency) === null || _b === void 0 ? void 0 : _b.length) {
12953
12571
  obj.routesAdjacency = message.routesAdjacency.map((e) => Route$1.toJSON(e));
12954
12572
  }
12955
- if (message.routes !== undefined) {
12956
- obj.routes = ServiceRoutesMap.toJSON(message.routes);
12573
+ if ((_c = message.serviceRoutes) === null || _c === void 0 ? void 0 : _c.length) {
12574
+ obj.serviceRoutes = message.serviceRoutes.map((e) => ServiceRoute.toJSON(e));
12957
12575
  }
12958
12576
  return obj;
12959
12577
  },
@@ -12961,16 +12579,12 @@ const Timetable$1 = {
12961
12579
  return Timetable$1.fromPartial(base !== null && base !== void 0 ? base : {});
12962
12580
  },
12963
12581
  fromPartial(object) {
12964
- var _a, _b;
12582
+ var _a, _b, _c, _d;
12965
12583
  const message = createBaseTimetable();
12966
12584
  message.version = (_a = object.version) !== null && _a !== void 0 ? _a : "";
12967
- message.stopsAdjacency = (object.stopsAdjacency !== undefined && object.stopsAdjacency !== null)
12968
- ? StopsAdjacency.fromPartial(object.stopsAdjacency)
12969
- : undefined;
12970
- message.routesAdjacency = ((_b = object.routesAdjacency) === null || _b === void 0 ? void 0 : _b.map((e) => Route$1.fromPartial(e))) || [];
12971
- message.routes = (object.routes !== undefined && object.routes !== null)
12972
- ? ServiceRoutesMap.fromPartial(object.routes)
12973
- : undefined;
12585
+ message.stopsAdjacency = ((_b = object.stopsAdjacency) === null || _b === void 0 ? void 0 : _b.map((e) => StopAdjacency.fromPartial(e))) || [];
12586
+ message.routesAdjacency = ((_c = object.routesAdjacency) === null || _c === void 0 ? void 0 : _c.map((e) => Route$1.fromPartial(e))) || [];
12587
+ message.serviceRoutes = ((_d = object.serviceRoutes) === null || _d === void 0 ? void 0 : _d.map((e) => ServiceRoute.fromPartial(e))) || [];
12974
12588
  return message;
12975
12589
  },
12976
12590
  };
@@ -12999,9 +12613,6 @@ function base64FromBytes(arr) {
12999
12613
  return globalThis.btoa(bin.join(""));
13000
12614
  }
13001
12615
  }
13002
- function isObject(value) {
13003
- return typeof value === "object" && value !== null;
13004
- }
13005
12616
  function isSet(value) {
13006
12617
  return value !== null && value !== undefined;
13007
12618
  }
@@ -13517,18 +13128,14 @@ const bytesToUint16Array = (bytes) => {
13517
13128
  return result;
13518
13129
  };
13519
13130
  const serializeStopsAdjacency = (stopsAdjacency) => {
13520
- const protoStopsAdjacency = {
13521
- stops: {},
13522
- };
13523
- stopsAdjacency.forEach((value, key) => {
13524
- protoStopsAdjacency.stops[key] = {
13131
+ return stopsAdjacency.map((value) => {
13132
+ return {
13525
13133
  transfers: value.transfers.map((transfer) => (Object.assign({ destination: transfer.destination, type: serializeTransferType(transfer.type) }, (transfer.minTransferTime !== undefined && {
13526
13134
  minTransferTime: transfer.minTransferTime.toSeconds(),
13527
13135
  })))),
13528
13136
  routes: value.routes,
13529
13137
  };
13530
13138
  });
13531
- return protoStopsAdjacency;
13532
13139
  };
13533
13140
  const serializeRoutesAdjacency = (routesAdjacency) => {
13534
13141
  const protoRoutesAdjacency = [];
@@ -13543,31 +13150,24 @@ const serializeRoutesAdjacency = (routesAdjacency) => {
13543
13150
  });
13544
13151
  return protoRoutesAdjacency;
13545
13152
  };
13546
- const serializeServiceRoutesMap = (serviceRoutesMap) => {
13547
- const protoServiceRoutesMap = {
13548
- routes: {},
13549
- };
13550
- serviceRoutesMap.forEach((value, key) => {
13551
- protoServiceRoutesMap.routes[key] = {
13153
+ const serializeServiceRoutesMap = (serviceRoutes) => {
13154
+ return serviceRoutes.map((value) => {
13155
+ return {
13552
13156
  type: serializeRouteType(value.type),
13553
13157
  name: value.name,
13554
13158
  routes: value.routes,
13555
13159
  };
13556
13160
  });
13557
- return protoServiceRoutesMap;
13558
13161
  };
13559
13162
  const deserializeStopsAdjacency = (protoStopsAdjacency) => {
13560
- const stopsAdjacency = new Map();
13561
- Object.entries(protoStopsAdjacency.stops).forEach(([keyStr, value]) => {
13562
- const key = parseInt(keyStr, 10);
13563
- stopsAdjacency.set(key, {
13163
+ return protoStopsAdjacency.map((value) => {
13164
+ return {
13564
13165
  transfers: value.transfers.map((transfer) => (Object.assign({ destination: transfer.destination, type: parseTransferType(transfer.type) }, (transfer.minTransferTime !== undefined && {
13565
13166
  minTransferTime: Duration.fromSeconds(transfer.minTransferTime),
13566
13167
  })))),
13567
13168
  routes: value.routes,
13568
- });
13169
+ };
13569
13170
  });
13570
- return stopsAdjacency;
13571
13171
  };
13572
13172
  const deserializeRoutesAdjacency = (protoRoutesAdjacency) => {
13573
13173
  const routesAdjacency = [];
@@ -13577,16 +13177,14 @@ const deserializeRoutesAdjacency = (protoRoutesAdjacency) => {
13577
13177
  });
13578
13178
  return routesAdjacency;
13579
13179
  };
13580
- const deserializeServiceRoutesMap = (protoServiceRoutesMap) => {
13581
- const serviceRoutesMap = new Map();
13582
- Object.entries(protoServiceRoutesMap.routes).forEach(([key, value]) => {
13583
- serviceRoutesMap.set(key, {
13180
+ const deserializeServiceRoutesMap = (protoServiceRoutes) => {
13181
+ return protoServiceRoutes.map((value) => {
13182
+ return {
13584
13183
  type: parseRouteType(value.type),
13585
13184
  name: value.name,
13586
13185
  routes: value.routes,
13587
- });
13186
+ };
13588
13187
  });
13589
- return serviceRoutesMap;
13590
13188
  };
13591
13189
  const parseTransferType = (type) => {
13592
13190
  switch (type) {
@@ -13678,7 +13276,7 @@ const ALL_TRANSPORT_MODES = new Set([
13678
13276
  'TROLLEYBUS',
13679
13277
  'MONORAIL',
13680
13278
  ]);
13681
- const CURRENT_VERSION = '0.0.5';
13279
+ const CURRENT_VERSION = '0.0.6';
13682
13280
  /**
13683
13281
  * The internal transit timetable format.
13684
13282
  */
@@ -13686,7 +13284,15 @@ class Timetable {
13686
13284
  constructor(stopsAdjacency, routesAdjacency, routes) {
13687
13285
  this.stopsAdjacency = stopsAdjacency;
13688
13286
  this.routesAdjacency = routesAdjacency;
13689
- this.routes = routes;
13287
+ this.serviceRoutes = routes;
13288
+ this.activeStops = new Set();
13289
+ for (let i = 0; i < stopsAdjacency.length; i++) {
13290
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13291
+ const stop = stopsAdjacency[i];
13292
+ if (stop.routes.length > 0 || stop.transfers.length > 0) {
13293
+ this.activeStops.add(i);
13294
+ }
13295
+ }
13690
13296
  }
13691
13297
  /**
13692
13298
  * Serializes the Timetable into a binary array.
@@ -13698,7 +13304,7 @@ class Timetable {
13698
13304
  version: CURRENT_VERSION,
13699
13305
  stopsAdjacency: serializeStopsAdjacency(this.stopsAdjacency),
13700
13306
  routesAdjacency: serializeRoutesAdjacency(this.routesAdjacency),
13701
- routes: serializeServiceRoutesMap(this.routes),
13307
+ serviceRoutes: serializeServiceRoutesMap(this.serviceRoutes),
13702
13308
  };
13703
13309
  const writer = new BinaryWriter();
13704
13310
  Timetable$1.encode(protoTimetable, writer);
@@ -13716,11 +13322,18 @@ class Timetable {
13716
13322
  if (protoTimetable.version !== CURRENT_VERSION) {
13717
13323
  throw new Error(`Unsupported timetable version ${protoTimetable.version}`);
13718
13324
  }
13719
- return new Timetable(
13720
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13721
- deserializeStopsAdjacency(protoTimetable.stopsAdjacency), deserializeRoutesAdjacency(protoTimetable.routesAdjacency),
13722
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13723
- deserializeServiceRoutesMap(protoTimetable.routes));
13325
+ return new Timetable(deserializeStopsAdjacency(protoTimetable.stopsAdjacency), deserializeRoutesAdjacency(protoTimetable.routesAdjacency), deserializeServiceRoutesMap(protoTimetable.serviceRoutes));
13326
+ }
13327
+ /**
13328
+ * Checks if the given stop is active on the timetable.
13329
+ * An active stop is a stop reached by a route that is active on the timetable
13330
+ * or by a transfer reachable from an active route.
13331
+ *
13332
+ * @param stopId - The ID of the stop to check.
13333
+ * @returns True if the stop is active, false otherwise.
13334
+ */
13335
+ isActive(stopId) {
13336
+ return this.activeStops.has(stopId);
13724
13337
  }
13725
13338
  /**
13726
13339
  * Retrieves the route associated with the given route ID.
@@ -13740,7 +13353,7 @@ class Timetable {
13740
13353
  */
13741
13354
  getTransfers(stopId) {
13742
13355
  var _a, _b;
13743
- return (_b = (_a = this.stopsAdjacency.get(stopId)) === null || _a === void 0 ? void 0 : _a.transfers) !== null && _b !== void 0 ? _b : [];
13356
+ return (_b = (_a = this.stopsAdjacency[stopId]) === null || _a === void 0 ? void 0 : _a.transfers) !== null && _b !== void 0 ? _b : [];
13744
13357
  }
13745
13358
  /**
13746
13359
  * Retrieves the service route associated with the given route.
@@ -13751,7 +13364,7 @@ class Timetable {
13751
13364
  * @returns The service route corresponding to the provided route.
13752
13365
  */
13753
13366
  getServiceRouteInfo(route) {
13754
- const serviceRoute = this.routes.get(route.serviceRoute());
13367
+ const serviceRoute = this.serviceRoutes[route.serviceRoute()];
13755
13368
  if (!serviceRoute) {
13756
13369
  throw new Error(`Service route not found for route ID: ${route.serviceRoute()}`);
13757
13370
  }
@@ -13766,7 +13379,7 @@ class Timetable {
13766
13379
  * @returns An array of routes passing through the specified stop.
13767
13380
  */
13768
13381
  routesPassingThrough(stopId) {
13769
- const stopData = this.stopsAdjacency.get(stopId);
13382
+ const stopData = this.stopsAdjacency[stopId];
13770
13383
  if (!stopData) {
13771
13384
  return [];
13772
13385
  }
@@ -13839,12 +13452,6 @@ const standardProfile = {
13839
13452
  return undefined;
13840
13453
  }
13841
13454
  },
13842
- platformParser: (stopEntry) => {
13843
- if (stopEntry.platform_code) {
13844
- return stopEntry.platform_code;
13845
- }
13846
- return undefined;
13847
- },
13848
13455
  };
13849
13456
 
13850
13457
  const is_object = function (obj) {
@@ -15803,7 +15410,6 @@ const parseRoutes = (routesStream_1, ...args_1) => __awaiter(void 0, [routesStre
15803
15410
  routes.set(line.route_id, {
15804
15411
  name: line.route_short_name,
15805
15412
  type: routeType,
15806
- routes: [],
15807
15413
  });
15808
15414
  }
15809
15415
  }
@@ -15816,6 +15422,29 @@ const parseRoutes = (routesStream_1, ...args_1) => __awaiter(void 0, [routesStre
15816
15422
  }
15817
15423
  return routes;
15818
15424
  });
15425
+ /**
15426
+ * Creates an array of ServiceRoute objects by combining GTFS route data with service route mappings.
15427
+ *
15428
+ * @param gtfsRoutesMap A map containing GTFS route information indexed by route ID
15429
+ * @param serviceRoutesMap A map linking GTFS route IDs to service route IDs
15430
+ * @returns An array of ServiceRoute objects with route information
15431
+ */
15432
+ const indexRoutes = (gtfsRoutesMap, serviceRoutesMap) => {
15433
+ const serviceRoutes = new Array(serviceRoutesMap.size);
15434
+ for (const [gtfsRouteId, serviceRouteId] of serviceRoutesMap) {
15435
+ const route = gtfsRoutesMap.get(gtfsRouteId);
15436
+ if (route === undefined) {
15437
+ log.warn(`Route ${gtfsRouteId} not found.`);
15438
+ continue;
15439
+ }
15440
+ serviceRoutes[serviceRouteId] = {
15441
+ name: route.name,
15442
+ type: route.type,
15443
+ routes: [],
15444
+ };
15445
+ }
15446
+ return serviceRoutes;
15447
+ };
15819
15448
 
15820
15449
  const toGtfsDate = (date) => {
15821
15450
  return parseInt(date.toFormat('yyyyLLdd'));
@@ -15942,7 +15571,7 @@ const parseCalendarDates = (calendarDatesStream, serviceIds, date) => __awaiter(
15942
15571
  * @param stopsStream The readable stream containing the stops data.
15943
15572
  * @return A mapping of stop IDs to corresponding stop details.
15944
15573
  */
15945
- const parseStops = (stopsStream, platformParser) => __awaiter(void 0, void 0, void 0, function* () {
15574
+ const parseStops = (stopsStream) => __awaiter(void 0, void 0, void 0, function* () {
15946
15575
  var _a, e_1, _b, _c;
15947
15576
  const parsedStops = new Map();
15948
15577
  let i = 0;
@@ -15956,20 +15585,9 @@ const parseStops = (stopsStream, platformParser) => __awaiter(void 0, void 0, vo
15956
15585
  _d = false;
15957
15586
  const rawLine = _c;
15958
15587
  const line = rawLine;
15959
- const stop = Object.assign({ id: i, sourceStopId: line.stop_id, name: line.stop_name, lat: line.stop_lat, lon: line.stop_lon, locationType: line.location_type
15588
+ const stop = Object.assign(Object.assign(Object.assign({ id: i, sourceStopId: line.stop_id, name: line.stop_name, lat: line.stop_lat, lon: line.stop_lon, locationType: line.location_type
15960
15589
  ? parseGtfsLocationType(line.location_type)
15961
- : 'SIMPLE_STOP_OR_PLATFORM', children: [] }, (line.parent_station && { parentSourceId: line.parent_station }));
15962
- if (platformParser) {
15963
- try {
15964
- const platform = platformParser(line);
15965
- if (platform) {
15966
- stop.platform = platform;
15967
- }
15968
- }
15969
- catch (_g) {
15970
- console.info(`Could not parse platform for stop ${line.stop_id}.`);
15971
- }
15972
- }
15590
+ : 'SIMPLE_STOP_OR_PLATFORM' }, (line.platform_code && { platform: line.platform_code })), { children: [] }), (line.parent_station && { parentSourceId: line.parent_station }));
15973
15591
  parsedStops.set(line.stop_id, stop);
15974
15592
  i = i + 1;
15975
15593
  }
@@ -15994,37 +15612,6 @@ const parseStops = (stopsStream, platformParser) => __awaiter(void 0, void 0, vo
15994
15612
  }
15995
15613
  return parsedStops;
15996
15614
  });
15997
- /**
15998
- * Builds the final stop map indexed by internal IDs.
15999
- * Excludes all stops that do not have at least one valid stopId
16000
- * as a child, a parent, or being valid itself.
16001
- *
16002
- * @param parsedStops - The map of parsed stops.
16003
- * @param validStops - A set of valid stop IDs.
16004
- * @returns A map of stops indexed by internal IDs.
16005
- */
16006
- const indexStops = (parsedStops, validStops) => {
16007
- const stops = new Map();
16008
- for (const [, stop] of parsedStops) {
16009
- if (!validStops ||
16010
- validStops.has(stop.id) ||
16011
- (stop.parent && validStops.has(stop.parent)) ||
16012
- stop.children.some((childId) => validStops.has(childId))) {
16013
- stops.set(stop.id, {
16014
- id: stop.id,
16015
- sourceStopId: stop.sourceStopId,
16016
- name: stop.name,
16017
- lat: stop.lat,
16018
- lon: stop.lon,
16019
- locationType: stop.locationType,
16020
- platform: stop.platform,
16021
- children: stop.children.filter((childId) => !validStops || validStops.has(childId)),
16022
- parent: stop.parent,
16023
- });
16024
- }
16025
- }
16026
- return stops;
16027
- };
16028
15615
  const parseGtfsLocationType = (gtfsLocationType) => {
16029
15616
  switch (gtfsLocationType) {
16030
15617
  case 0:
@@ -16201,7 +15788,7 @@ const finalizeRouteFromBuilder = (builder) => {
16201
15788
  * @param serviceRoutes A mapping of route IDs to route details.
16202
15789
  * @returns A mapping of trip IDs to corresponding route IDs.
16203
15790
  */
16204
- const parseTrips = (tripsStream, serviceIds, serviceRoutes) => __awaiter(void 0, void 0, void 0, function* () {
15791
+ const parseTrips = (tripsStream, serviceIds, validGtfsRoutes) => __awaiter(void 0, void 0, void 0, function* () {
16205
15792
  var _a, e_1, _b, _c;
16206
15793
  const trips = new Map();
16207
15794
  try {
@@ -16214,7 +15801,7 @@ const parseTrips = (tripsStream, serviceIds, serviceRoutes) => __awaiter(void 0,
16214
15801
  // The trip doesn't correspond to an active service
16215
15802
  continue;
16216
15803
  }
16217
- if (!serviceRoutes.get(line.route_id)) {
15804
+ if (!validGtfsRoutes.has(line.route_id)) {
16218
15805
  // The trip doesn't correspond to a supported route
16219
15806
  continue;
16220
15807
  }
@@ -16230,29 +15817,32 @@ const parseTrips = (tripsStream, serviceIds, serviceRoutes) => __awaiter(void 0,
16230
15817
  }
16231
15818
  return trips;
16232
15819
  });
16233
- const buildStopsAdjacencyStructure = (validStops, serviceRoutes, routes, transfersMap) => {
16234
- const stopsAdjacency = new Map();
15820
+ const buildStopsAdjacencyStructure = (serviceRoutes, routes, transfersMap, nbStops, activeStops) => {
15821
+ // TODO somehow works when it's a map
15822
+ const stopsAdjacency = new Array(nbStops);
15823
+ for (let i = 0; i < nbStops; i++) {
15824
+ stopsAdjacency[i] = { routes: [], transfers: [] };
15825
+ }
16235
15826
  routes.forEach((route, index) => {
16236
- var _a;
16237
15827
  for (const stop of route.stopsIterator()) {
16238
- if (!stopsAdjacency.get(stop) && validStops.has(stop)) {
16239
- stopsAdjacency.set(stop, { routes: [], transfers: [] });
15828
+ if (activeStops.has(stop)) {
15829
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15830
+ stopsAdjacency[stop].routes.push(index);
16240
15831
  }
16241
- (_a = stopsAdjacency.get(stop)) === null || _a === void 0 ? void 0 : _a.routes.push(index);
16242
15832
  }
16243
- const serviceRoute = serviceRoutes.get(route.serviceRoute());
16244
- if (!serviceRoute) {
15833
+ const serviceRoute = serviceRoutes[route.serviceRoute()];
15834
+ if (serviceRoute === undefined) {
16245
15835
  throw new Error(`Service route ${route.serviceRoute()} not found for route ${index}.`);
16246
15836
  }
16247
15837
  serviceRoute.routes.push(index);
16248
15838
  });
16249
15839
  for (const [stop, transfers] of transfersMap) {
16250
- const s = stopsAdjacency.get(stop);
16251
- if (s) {
16252
- for (const transfer of transfers) {
16253
- if (validStops.has(transfer.destination)) {
16254
- s.transfers.push(transfer);
16255
- }
15840
+ for (const transfer of transfers) {
15841
+ if (activeStops.has(stop) || activeStops.has(transfer.destination)) {
15842
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15843
+ stopsAdjacency[stop].transfers.push(transfer);
15844
+ activeStops.add(transfer.destination);
15845
+ activeStops.add(stop);
16256
15846
  }
16257
15847
  }
16258
15848
  }
@@ -16263,18 +15853,18 @@ const buildStopsAdjacencyStructure = (validStops, serviceRoutes, routes, transfe
16263
15853
  *
16264
15854
  * @param stopTimesStream The readable stream containing the stop times data.
16265
15855
  * @param stopsMap A map of parsed stops from the GTFS feed.
16266
- * @param validTripIds A map of valid trip IDs to corresponding route IDs.
16267
- * @param validStopIds A set of valid stop IDs.
15856
+ * @param activeTripIds A map of valid trip IDs to corresponding route IDs.
15857
+ * @param activeStopIds A set of valid stop IDs.
16268
15858
  * @returns A mapping of route IDs to route details. The routes returned correspond to the set of trips from GTFS that share the same stop list.
16269
15859
  */
16270
- const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) => __awaiter(void 0, void 0, void 0, function* () {
15860
+ const parseStopTimes = (stopTimesStream, stopsMap, activeTripIds, activeStopIds) => __awaiter(void 0, void 0, void 0, function* () {
16271
15861
  var _a, e_2, _b, _c;
16272
15862
  var _d, _e;
16273
15863
  /**
16274
15864
  * Adds a trip to the appropriate route builder
16275
15865
  */
16276
15866
  const addTrip = (currentTripId) => {
16277
- const gtfsRouteId = validTripIds.get(currentTripId);
15867
+ const gtfsRouteId = activeTripIds.get(currentTripId);
16278
15868
  if (!gtfsRouteId || stops.length === 0) {
16279
15869
  stops = [];
16280
15870
  arrivalTimes = [];
@@ -16283,7 +15873,6 @@ const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) =
16283
15873
  dropOffTypes = [];
16284
15874
  return;
16285
15875
  }
16286
- const routeId = `${gtfsRouteId}_${hashIds(stops)}`;
16287
15876
  const firstDeparture = departureTimes[0];
16288
15877
  if (firstDeparture === undefined) {
16289
15878
  console.warn(`Empty trip ${currentTripId}`);
@@ -16294,24 +15883,31 @@ const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) =
16294
15883
  dropOffTypes = [];
16295
15884
  return;
16296
15885
  }
15886
+ const routeId = `${gtfsRouteId}_${hashIds(stops)}`;
16297
15887
  let routeBuilder = routeBuilders.get(routeId);
16298
15888
  if (!routeBuilder) {
15889
+ let serviceRouteId = serviceRoutesMap.get(gtfsRouteId);
15890
+ if (serviceRouteId === undefined) {
15891
+ serviceRouteId = currentServiceRouteId;
15892
+ serviceRoutesMap.set(gtfsRouteId, serviceRouteId);
15893
+ currentServiceRouteId = currentServiceRouteId + 1;
15894
+ }
16299
15895
  routeBuilder = {
16300
- serviceRouteId: gtfsRouteId,
16301
- stops: [...stops],
15896
+ serviceRouteId,
15897
+ stops,
16302
15898
  trips: [],
16303
15899
  };
16304
15900
  routeBuilders.set(routeId, routeBuilder);
16305
15901
  for (const stop of stops) {
16306
- validStopIds.add(stop);
15902
+ activeStopIds.add(stop);
16307
15903
  }
16308
15904
  }
16309
15905
  routeBuilder.trips.push({
16310
15906
  firstDeparture,
16311
- arrivalTimes: [...arrivalTimes],
16312
- departureTimes: [...departureTimes],
16313
- pickUpTypes: [...pickUpTypes],
16314
- dropOffTypes: [...dropOffTypes],
15907
+ arrivalTimes: arrivalTimes,
15908
+ departureTimes: departureTimes,
15909
+ pickUpTypes: pickUpTypes,
15910
+ dropOffTypes: dropOffTypes,
16315
15911
  });
16316
15912
  stops = [];
16317
15913
  arrivalTimes = [];
@@ -16320,6 +15916,9 @@ const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) =
16320
15916
  dropOffTypes = [];
16321
15917
  };
16322
15918
  const routeBuilders = new Map();
15919
+ const serviceRoutesMap = new Map();
15920
+ // incrementally generate service route IDs
15921
+ let currentServiceRouteId = 0;
16323
15922
  let previousSeq = 0;
16324
15923
  let stops = [];
16325
15924
  let arrivalTimes = [];
@@ -16382,7 +15981,7 @@ const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) =
16382
15981
  const routeData = finalizeRouteFromBuilder(routeBuilder);
16383
15982
  routesAdjacency.push(new Route(routeData.stopTimes, routeData.pickUpDropOffTypes, routeData.stops, routeData.serviceRouteId));
16384
15983
  }
16385
- return routesAdjacency;
15984
+ return { routes: routesAdjacency, serviceRoutesMap };
16386
15985
  });
16387
15986
  const parsePickupDropOffType = (gtfsType) => {
16388
15987
  switch (gtfsType) {
@@ -16416,39 +16015,37 @@ class GtfsParser {
16416
16015
  * Parses a GTFS feed to extract all the data relevant to a given day in a transit-planner friendly format.
16417
16016
  *
16418
16017
  * @param date The active date.
16419
- * @param gtfsPath A path to the zipped GTFS feed.
16420
- * @param gtfsProfile The GTFS profile configuration.
16421
- * @returns An object containing the timetable and stops map.
16018
+ * @returns The parsed timetable.
16422
16019
  */
16423
- parse(date) {
16020
+ parseTimetable(date) {
16424
16021
  return __awaiter(this, void 0, void 0, function* () {
16425
16022
  log.setLevel('INFO');
16426
16023
  const zip = new StreamZip.async({ file: this.path });
16427
16024
  const entries = yield zip.entries();
16428
16025
  const datetime = DateTime.fromJSDate(date);
16429
- const validServiceIds = new Set();
16430
- const validStopIds = new Set();
16026
+ const activeServiceIds = new Set();
16027
+ const activeStopIds = new Set();
16431
16028
  log.info(`Parsing ${STOPS_FILE}`);
16432
16029
  const stopsStart = performance.now();
16433
16030
  const stopsStream = yield zip.stream(STOPS_FILE);
16434
- const parsedStops = yield parseStops(stopsStream, this.profile.platformParser);
16031
+ const parsedStops = yield parseStops(stopsStream);
16435
16032
  const stopsEnd = performance.now();
16436
16033
  log.info(`${parsedStops.size} parsed stops. (${(stopsEnd - stopsStart).toFixed(2)}ms)`);
16437
16034
  if (entries[CALENDAR_FILE]) {
16438
16035
  log.info(`Parsing ${CALENDAR_FILE}`);
16439
16036
  const calendarStart = performance.now();
16440
16037
  const calendarStream = yield zip.stream(CALENDAR_FILE);
16441
- yield parseCalendar(calendarStream, validServiceIds, datetime);
16038
+ yield parseCalendar(calendarStream, activeServiceIds, datetime);
16442
16039
  const calendarEnd = performance.now();
16443
- log.info(`${validServiceIds.size} valid services. (${(calendarEnd - calendarStart).toFixed(2)}ms)`);
16040
+ log.info(`${activeServiceIds.size} valid services. (${(calendarEnd - calendarStart).toFixed(2)}ms)`);
16444
16041
  }
16445
16042
  if (entries[CALENDAR_DATES_FILE]) {
16446
16043
  log.info(`Parsing ${CALENDAR_DATES_FILE}`);
16447
16044
  const calendarDatesStart = performance.now();
16448
16045
  const calendarDatesStream = yield zip.stream(CALENDAR_DATES_FILE);
16449
- yield parseCalendarDates(calendarDatesStream, validServiceIds, datetime);
16046
+ yield parseCalendarDates(calendarDatesStream, activeServiceIds, datetime);
16450
16047
  const calendarDatesEnd = performance.now();
16451
- log.info(`${validServiceIds.size} valid services. (${(calendarDatesEnd - calendarDatesStart).toFixed(2)}ms)`);
16048
+ log.info(`${activeServiceIds.size} valid services. (${(calendarDatesEnd - calendarDatesStart).toFixed(2)}ms)`);
16452
16049
  }
16453
16050
  log.info(`Parsing ${ROUTES_FILE}`);
16454
16051
  const routesStart = performance.now();
@@ -16459,7 +16056,7 @@ class GtfsParser {
16459
16056
  log.info(`Parsing ${TRIPS_FILE}`);
16460
16057
  const tripsStart = performance.now();
16461
16058
  const tripsStream = yield zip.stream(TRIPS_FILE);
16462
- const trips = yield parseTrips(tripsStream, validServiceIds, validGtfsRoutes);
16059
+ const trips = yield parseTrips(tripsStream, activeServiceIds, validGtfsRoutes);
16463
16060
  const tripsEnd = performance.now();
16464
16061
  log.info(`${trips.size} valid trips. (${(tripsEnd - tripsStart).toFixed(2)}ms)`);
16465
16062
  let transfers = new Map();
@@ -16474,32 +16071,26 @@ class GtfsParser {
16474
16071
  log.info(`Parsing ${STOP_TIMES_FILE}`);
16475
16072
  const stopTimesStart = performance.now();
16476
16073
  const stopTimesStream = yield zip.stream(STOP_TIMES_FILE);
16477
- const routesAdjacency = yield parseStopTimes(stopTimesStream, parsedStops, trips, validStopIds);
16478
- const stopsAdjacency = buildStopsAdjacencyStructure(validStopIds, validGtfsRoutes, routesAdjacency, transfers);
16074
+ const { routes, serviceRoutesMap } = yield parseStopTimes(stopTimesStream, parsedStops, trips, activeStopIds);
16075
+ const serviceRoutes = indexRoutes(validGtfsRoutes, serviceRoutesMap);
16479
16076
  const stopTimesEnd = performance.now();
16480
- log.info(`${routesAdjacency.length} valid unique routes. (${(stopTimesEnd - stopTimesStart).toFixed(2)}ms)`);
16481
- log.info(`Removing unused stops.`);
16482
- const indexStopsStart = performance.now();
16483
- const stops = indexStops(parsedStops, validStopIds);
16484
- const indexStopsEnd = performance.now();
16485
- log.info(`${stops.size} used stop stops, ${parsedStops.size - stops.size} unused. (${(indexStopsEnd - indexStopsStart).toFixed(2)}ms)`);
16077
+ log.info(`${routes.length} valid unique routes. (${(stopTimesEnd - stopTimesStart).toFixed(2)}ms)`);
16078
+ log.info('Building stops adjacency structure');
16079
+ const stopsAdjacencyStart = performance.now();
16080
+ const stopsAdjacency = buildStopsAdjacencyStructure(serviceRoutes, routes, transfers, parsedStops.size, activeStopIds);
16081
+ const stopsAdjacencyEnd = performance.now();
16082
+ log.info(`${stopsAdjacency.length} valid stops in the structure. (${(stopsAdjacencyEnd - stopsAdjacencyStart).toFixed(2)}ms)`);
16486
16083
  yield zip.close();
16487
- const timetable = new Timetable(stopsAdjacency, routesAdjacency, validGtfsRoutes);
16488
- log.info(`Building stops index.`);
16489
- const stopsIndexStart = performance.now();
16490
- const stopsIndex = new StopsIndex(stops);
16491
- const stopsIndexEnd = performance.now();
16492
- log.info(`Stops index built. (${(stopsIndexEnd - stopsIndexStart).toFixed(2)}ms)`);
16084
+ const timetable = new Timetable(stopsAdjacency, routes, serviceRoutes);
16493
16085
  log.info('Parsing complete.');
16494
- return { timetable, stopsIndex };
16086
+ return timetable;
16495
16087
  });
16496
16088
  }
16497
16089
  /**
16498
16090
  * Parses a GTFS feed to extract all stops.
16499
16091
  *
16500
- * @param gtfsPath A path the zipped GTFS feed.
16501
- * @param gtfsProfile The GTFS profile configuration.
16502
- * @returns An object containing the timetable and stops map.
16092
+ * @param activeStops The set of active stop IDs to include in the index.
16093
+ * @returns An index of stops.
16503
16094
  */
16504
16095
  parseStops() {
16505
16096
  return __awaiter(this, void 0, void 0, function* () {
@@ -16507,28 +16098,15 @@ class GtfsParser {
16507
16098
  log.info(`Parsing ${STOPS_FILE}`);
16508
16099
  const stopsStart = performance.now();
16509
16100
  const stopsStream = yield zip.stream(STOPS_FILE);
16510
- const stops = indexStops(yield parseStops(stopsStream, this.profile.platformParser));
16101
+ const stops = yield parseStops(stopsStream);
16511
16102
  const stopsEnd = performance.now();
16512
16103
  log.info(`${stops.size} parsed stops. (${(stopsEnd - stopsStart).toFixed(2)}ms)`);
16513
16104
  yield zip.close();
16514
- return new StopsIndex(stops);
16105
+ return new StopsIndex(Array.from(stops.values()));
16515
16106
  });
16516
16107
  }
16517
16108
  }
16518
16109
 
16519
- /**
16520
- * Parses the platform number from a stop entry.
16521
- * @param stopEntry The stop entry.
16522
- * @returns The platform corresponding to this stop.
16523
- */
16524
- const platformParser = (stopEntry) => {
16525
- const stopId = stopEntry.stop_id;
16526
- const stopParts = stopId.split(':');
16527
- if (stopParts.length > 2) {
16528
- return stopParts[2];
16529
- }
16530
- return undefined;
16531
- };
16532
16110
  /**
16533
16111
  * Parses the SBB extended route type and returns the corresponding basic GTFS route type.
16534
16112
  * @param routeType The SBB route type to parse.
@@ -16555,6 +16133,7 @@ const routeTypeParser = (routeType) => {
16555
16133
  return 'FERRY'; // Boat
16556
16134
  case 900: // Tram
16557
16135
  return 'TRAM'; // Tram
16136
+ case 116: // ??? train TODO figure out what this means
16558
16137
  case 117: // Special train
16559
16138
  case 102: // International train
16560
16139
  case 104: // Car train
@@ -16566,7 +16145,6 @@ const routeTypeParser = (routeType) => {
16566
16145
  case 100: // No guaranteed train
16567
16146
  case 106: // Regional train
16568
16147
  case 109: // Urban train
16569
- case 116: // ??? train TODO figure out what this means
16570
16148
  return 'RAIL'; // Train
16571
16149
  case 1100: // Aircraft
16572
16150
  case 1500: // Taxi
@@ -16576,7 +16154,6 @@ const routeTypeParser = (routeType) => {
16576
16154
  };
16577
16155
  const chGtfsProfile = {
16578
16156
  routeTypeParser,
16579
- platformParser,
16580
16157
  };
16581
16158
 
16582
16159
  export { GtfsParser, chGtfsProfile };