minotor 8.0.0 → 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.
Files changed (50) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/README.md +1 -1
  3. package/dist/cli.mjs +835 -816
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/gtfs/transfers.d.ts +21 -6
  6. package/dist/gtfs/trips.d.ts +2 -2
  7. package/dist/parser.cjs.js +666 -642
  8. package/dist/parser.cjs.js.map +1 -1
  9. package/dist/parser.esm.js +666 -642
  10. package/dist/parser.esm.js.map +1 -1
  11. package/dist/router.cjs.js +1 -1
  12. package/dist/router.cjs.js.map +1 -1
  13. package/dist/router.esm.js +1 -1
  14. package/dist/router.esm.js.map +1 -1
  15. package/dist/router.umd.js +1 -1
  16. package/dist/router.umd.js.map +1 -1
  17. package/dist/routing/router.d.ts +4 -4
  18. package/dist/timetable/io.d.ts +3 -3
  19. package/dist/timetable/proto/timetable.d.ts +6 -4
  20. package/dist/timetable/route.d.ts +13 -21
  21. package/dist/timetable/timetable.d.ts +13 -11
  22. package/dist/timetable/tripBoardingId.d.ts +34 -0
  23. package/package.json +1 -1
  24. package/src/__e2e__/timetable/timetable.bin +2 -2
  25. package/src/cli/repl.ts +53 -67
  26. package/src/gtfs/__tests__/parser.test.ts +19 -4
  27. package/src/gtfs/__tests__/transfers.test.ts +598 -318
  28. package/src/gtfs/__tests__/trips.test.ts +3 -44
  29. package/src/gtfs/parser.ts +26 -8
  30. package/src/gtfs/transfers.ts +151 -20
  31. package/src/gtfs/trips.ts +1 -39
  32. package/src/routing/__tests__/result.test.ts +10 -10
  33. package/src/routing/__tests__/router.test.ts +11 -9
  34. package/src/routing/result.ts +2 -2
  35. package/src/routing/router.ts +34 -22
  36. package/src/timetable/__tests__/io.test.ts +8 -7
  37. package/src/timetable/__tests__/route.test.ts +66 -80
  38. package/src/timetable/__tests__/timetable.test.ts +32 -29
  39. package/src/timetable/__tests__/tripBoardingId.test.ts +57 -0
  40. package/src/timetable/io.ts +21 -20
  41. package/src/timetable/proto/timetable.proto +6 -4
  42. package/src/timetable/proto/timetable.ts +84 -48
  43. package/src/timetable/route.ts +39 -56
  44. package/src/timetable/timetable.ts +37 -26
  45. package/src/timetable/tripBoardingId.ts +94 -0
  46. package/tsconfig.json +2 -2
  47. package/dist/timetable/tripId.d.ts +0 -15
  48. package/src/timetable/__tests__/tripId.test.ts +0 -27
  49. package/src/timetable/tripId.ts +0 -29
  50. /package/dist/timetable/__tests__/{tripId.test.d.ts → tripBoardingId.test.d.ts} +0 -0
@@ -1,15 +1,15 @@
1
1
  import { SourceStopId, StopId } from '../stops/stops.js';
2
- import { ServiceRouteId, Transfer } from '../timetable/timetable.js';
2
+ import { ServiceRouteId, Timetable, Transfer, TripContinuations } from '../timetable/timetable.js';
3
3
  import { GtfsStopsMap } from './stops.js';
4
- import { GtfsTripId } from './trips.js';
4
+ import { GtfsTripId, TripsMapping } from './trips.js';
5
5
  export type GtfsTransferType = 0 | 1 | 2 | 3 | 4 | 5;
6
6
  export type TransfersMap = Map<StopId, Transfer[]>;
7
- export type GtfsTripBoarding = {
7
+ export type GtfsTripContinuation = {
8
+ fromStop: StopId;
8
9
  fromTrip: GtfsTripId;
10
+ toStop: StopId;
9
11
  toTrip: GtfsTripId;
10
- hopOnStop: StopId;
11
12
  };
12
- export type TripContinuationsMap = Map<StopId, GtfsTripBoarding[]>;
13
13
  export type TransferEntry = {
14
14
  from_stop_id?: SourceStopId;
15
15
  to_stop_id?: SourceStopId;
@@ -28,5 +28,20 @@ export type TransferEntry = {
28
28
  */
29
29
  export declare const parseTransfers: (transfersStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap) => Promise<{
30
30
  transfers: TransfersMap;
31
- tripContinuations: TripContinuationsMap;
31
+ tripContinuations: GtfsTripContinuation[];
32
32
  }>;
33
+ /**
34
+ * Builds trip continuations map from GTFS trip continuation data.
35
+ *
36
+ * This function processes GTFS in-seat transfer data and creates a mapping
37
+ * from trip boarding IDs to continuation boarding information. It disambiguates
38
+ * stop indices when routes have multiple stops with the same ID by finding
39
+ * the most coherent transfer timing.
40
+ *
41
+ * @param tripsMapping Mapping from GTFS trip IDs to internal trip representations
42
+ * @param tripContinuations Array of GTFS trip continuation data from transfers.txt
43
+ * @param timetable The timetable containing route and timing information
44
+ * @param activeStopIds Set of stop IDs that are active/enabled in the system
45
+ * @returns A map from trip boarding IDs to arrays of continuation boarding options
46
+ */
47
+ export declare const buildTripContinuations: (tripsMapping: TripsMapping, tripContinuations: GtfsTripContinuation[], timetable: Timetable, activeStopIds: Set<StopId>) => TripContinuations;
@@ -4,7 +4,7 @@ import { ServiceRoute, ServiceRouteId, StopAdjacency } from '../timetable/timeta
4
4
  import { GtfsRouteId, GtfsRoutesMap } from './routes.js';
5
5
  import { ServiceIds } from './services.js';
6
6
  import { GtfsStopsMap } from './stops.js';
7
- import { TransfersMap, TripContinuationsMap } from './transfers.js';
7
+ import { TransfersMap } from './transfers.js';
8
8
  export type GtfsTripId = string;
9
9
  export type GtfsTripIdsMap = Map<GtfsTripId, GtfsRouteId>;
10
10
  export type TripsMapping = Map<GtfsTripId, {
@@ -27,7 +27,7 @@ export declare const encodePickUpDropOffTypes: (pickUpTypes: SerializedPickUpDro
27
27
  * @returns A mapping of trip IDs to corresponding route IDs.
28
28
  */
29
29
  export declare const parseTrips: (tripsStream: NodeJS.ReadableStream, serviceIds: ServiceIds, validGtfsRoutes: GtfsRoutesMap) => Promise<GtfsTripIdsMap>;
30
- export declare const buildStopsAdjacencyStructure: (tripsMapping: TripsMapping, serviceRoutes: ServiceRoute[], routes: Route[], transfersMap: TransfersMap, tripContinuationsMap: TripContinuationsMap, nbStops: number, activeStops: Set<StopId>) => StopAdjacency[];
30
+ export declare const buildStopsAdjacencyStructure: (serviceRoutes: ServiceRoute[], routes: Route[], transfersMap: TransfersMap, nbStops: number, activeStops: Set<StopId>) => StopAdjacency[];
31
31
  /**
32
32
  * Parses the stop_times.txt data from a GTFS feed.
33
33
  *