minotor 5.0.0 → 5.0.1

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,11 +1,8 @@
1
- import { Platform } from '../stops/stops.js';
2
1
  import { StopsIndex } from '../stops/stopsIndex.js';
3
2
  import { RouteType, Timetable } from '../timetable/timetable.js';
4
- import { StopEntry } from './stops.js';
5
3
  import { Maybe } from './utils.js';
6
4
  export type GtfsProfile = {
7
5
  routeTypeParser: (routeType: number) => Maybe<RouteType>;
8
- platformParser?: (stopEntry: StopEntry) => Maybe<Platform>;
9
6
  };
10
7
  export declare class GtfsParser {
11
8
  private path;
@@ -1,5 +1,4 @@
1
1
  import { Latitude, Longitude, Platform, SourceStopId, Stop, StopId, StopsMap } from '../stops/stops.js';
2
- import { Maybe } from './utils.js';
3
2
  export type GtfsLocationType = 0 | 1 | 2 | 3 | 4;
4
3
  export type StopEntry = {
5
4
  stop_id: SourceStopId;
@@ -20,7 +19,7 @@ export type ParsedStopsMap = Map<SourceStopId, ParsedStop>;
20
19
  * @param stopsStream The readable stream containing the stops data.
21
20
  * @return A mapping of stop IDs to corresponding stop details.
22
21
  */
23
- export declare const parseStops: (stopsStream: NodeJS.ReadableStream, platformParser?: (stopEntry: StopEntry) => Maybe<Platform>) => Promise<ParsedStopsMap>;
22
+ export declare const parseStops: (stopsStream: NodeJS.ReadableStream) => Promise<ParsedStopsMap>;
24
23
  /**
25
24
  * Builds the final stop map indexed by internal IDs.
26
25
  * Excludes all stops that do not have at least one valid stopId
@@ -13841,12 +13841,6 @@ const standardProfile = {
13841
13841
  return undefined;
13842
13842
  }
13843
13843
  },
13844
- platformParser: (stopEntry) => {
13845
- if (stopEntry.platform_code) {
13846
- return stopEntry.platform_code;
13847
- }
13848
- return undefined;
13849
- },
13850
13844
  };
13851
13845
 
13852
13846
  const is_object = function (obj) {
@@ -15944,7 +15938,7 @@ const parseCalendarDates = (calendarDatesStream, serviceIds, date) => __awaiter(
15944
15938
  * @param stopsStream The readable stream containing the stops data.
15945
15939
  * @return A mapping of stop IDs to corresponding stop details.
15946
15940
  */
15947
- const parseStops = (stopsStream, platformParser) => __awaiter(void 0, void 0, void 0, function* () {
15941
+ const parseStops = (stopsStream) => __awaiter(void 0, void 0, void 0, function* () {
15948
15942
  var _a, e_1, _b, _c;
15949
15943
  const parsedStops = new Map();
15950
15944
  let i = 0;
@@ -15958,20 +15952,9 @@ const parseStops = (stopsStream, platformParser) => __awaiter(void 0, void 0, vo
15958
15952
  _d = false;
15959
15953
  const rawLine = _c;
15960
15954
  const line = rawLine;
15961
- 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
15955
+ 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
15962
15956
  ? parseGtfsLocationType(line.location_type)
15963
- : 'SIMPLE_STOP_OR_PLATFORM', children: [] }, (line.parent_station && { parentSourceId: line.parent_station }));
15964
- if (platformParser) {
15965
- try {
15966
- const platform = platformParser(line);
15967
- if (platform) {
15968
- stop.platform = platform;
15969
- }
15970
- }
15971
- catch (_g) {
15972
- console.info(`Could not parse platform for stop ${line.stop_id}.`);
15973
- }
15974
- }
15957
+ : 'SIMPLE_STOP_OR_PLATFORM' }, (line.platform_code && { platform: line.platform_code })), { children: [] }), (line.parent_station && { parentSourceId: line.parent_station }));
15975
15958
  parsedStops.set(line.stop_id, stop);
15976
15959
  i = i + 1;
15977
15960
  }
@@ -16433,7 +16416,7 @@ class GtfsParser {
16433
16416
  log.info(`Parsing ${STOPS_FILE}`);
16434
16417
  const stopsStart = performance.now();
16435
16418
  const stopsStream = yield zip.stream(STOPS_FILE);
16436
- const parsedStops = yield parseStops(stopsStream, this.profile.platformParser);
16419
+ const parsedStops = yield parseStops(stopsStream);
16437
16420
  const stopsEnd = performance.now();
16438
16421
  log.info(`${parsedStops.size} parsed stops. (${(stopsEnd - stopsStart).toFixed(2)}ms)`);
16439
16422
  if (entries[CALENDAR_FILE]) {
@@ -16509,7 +16492,7 @@ class GtfsParser {
16509
16492
  log.info(`Parsing ${STOPS_FILE}`);
16510
16493
  const stopsStart = performance.now();
16511
16494
  const stopsStream = yield zip.stream(STOPS_FILE);
16512
- const stops = indexStops(yield parseStops(stopsStream, this.profile.platformParser));
16495
+ const stops = indexStops(yield parseStops(stopsStream));
16513
16496
  const stopsEnd = performance.now();
16514
16497
  log.info(`${stops.size} parsed stops. (${(stopsEnd - stopsStart).toFixed(2)}ms)`);
16515
16498
  yield zip.close();
@@ -16518,19 +16501,6 @@ class GtfsParser {
16518
16501
  }
16519
16502
  }
16520
16503
 
16521
- /**
16522
- * Parses the platform number from a stop entry.
16523
- * @param stopEntry The stop entry.
16524
- * @returns The platform corresponding to this stop.
16525
- */
16526
- const platformParser = (stopEntry) => {
16527
- const stopId = stopEntry.stop_id;
16528
- const stopParts = stopId.split(':');
16529
- if (stopParts.length > 2) {
16530
- return stopParts[2];
16531
- }
16532
- return undefined;
16533
- };
16534
16504
  /**
16535
16505
  * Parses the SBB extended route type and returns the corresponding basic GTFS route type.
16536
16506
  * @param routeType The SBB route type to parse.
@@ -16557,6 +16527,7 @@ const routeTypeParser = (routeType) => {
16557
16527
  return 'FERRY'; // Boat
16558
16528
  case 900: // Tram
16559
16529
  return 'TRAM'; // Tram
16530
+ case 116: // ??? train TODO figure out what this means
16560
16531
  case 117: // Special train
16561
16532
  case 102: // International train
16562
16533
  case 104: // Car train
@@ -16568,7 +16539,6 @@ const routeTypeParser = (routeType) => {
16568
16539
  case 100: // No guaranteed train
16569
16540
  case 106: // Regional train
16570
16541
  case 109: // Urban train
16571
- case 116: // ??? train TODO figure out what this means
16572
16542
  return 'RAIL'; // Train
16573
16543
  case 1100: // Aircraft
16574
16544
  case 1500: // Taxi
@@ -16578,7 +16548,6 @@ const routeTypeParser = (routeType) => {
16578
16548
  };
16579
16549
  const chGtfsProfile = {
16580
16550
  routeTypeParser,
16581
- platformParser,
16582
16551
  };
16583
16552
 
16584
16553
  exports.GtfsParser = GtfsParser;