minotor 7.0.2 → 8.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 (58) hide show
  1. package/.cspell.json +11 -1
  2. package/CHANGELOG.md +8 -3
  3. package/README.md +26 -24
  4. package/dist/cli.mjs +1243 -267
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/gtfs/transfers.d.ts +13 -4
  7. package/dist/gtfs/trips.d.ts +12 -7
  8. package/dist/parser.cjs.js +494 -71
  9. package/dist/parser.cjs.js.map +1 -1
  10. package/dist/parser.esm.js +494 -71
  11. package/dist/parser.esm.js.map +1 -1
  12. package/dist/router.cjs.js +1 -1
  13. package/dist/router.cjs.js.map +1 -1
  14. package/dist/router.d.ts +2 -2
  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/routing/__tests__/plotter.test.d.ts +1 -0
  20. package/dist/routing/plotter.d.ts +42 -3
  21. package/dist/routing/result.d.ts +23 -7
  22. package/dist/routing/route.d.ts +2 -0
  23. package/dist/routing/router.d.ts +78 -19
  24. package/dist/timetable/__tests__/tripId.test.d.ts +1 -0
  25. package/dist/timetable/io.d.ts +4 -2
  26. package/dist/timetable/proto/timetable.d.ts +13 -1
  27. package/dist/timetable/route.d.ts +41 -8
  28. package/dist/timetable/timetable.d.ts +18 -3
  29. package/dist/timetable/tripId.d.ts +15 -0
  30. package/package.json +1 -1
  31. package/src/__e2e__/router.test.ts +114 -105
  32. package/src/__e2e__/timetable/stops.bin +2 -2
  33. package/src/__e2e__/timetable/timetable.bin +2 -2
  34. package/src/cli/repl.ts +259 -1
  35. package/src/gtfs/__tests__/transfers.test.ts +468 -12
  36. package/src/gtfs/__tests__/trips.test.ts +350 -28
  37. package/src/gtfs/parser.ts +16 -4
  38. package/src/gtfs/transfers.ts +61 -18
  39. package/src/gtfs/trips.ts +97 -22
  40. package/src/router.ts +2 -2
  41. package/src/routing/__tests__/plotter.test.ts +230 -0
  42. package/src/routing/__tests__/result.test.ts +486 -125
  43. package/src/routing/__tests__/route.test.ts +7 -3
  44. package/src/routing/__tests__/router.test.ts +378 -172
  45. package/src/routing/plotter.ts +279 -48
  46. package/src/routing/result.ts +114 -34
  47. package/src/routing/route.ts +0 -3
  48. package/src/routing/router.ts +332 -211
  49. package/src/timetable/__tests__/io.test.ts +33 -1
  50. package/src/timetable/__tests__/route.test.ts +10 -3
  51. package/src/timetable/__tests__/timetable.test.ts +225 -57
  52. package/src/timetable/__tests__/tripId.test.ts +27 -0
  53. package/src/timetable/io.ts +71 -10
  54. package/src/timetable/proto/timetable.proto +14 -2
  55. package/src/timetable/proto/timetable.ts +218 -20
  56. package/src/timetable/route.ts +152 -19
  57. package/src/timetable/timetable.ts +45 -6
  58. package/src/timetable/tripId.ts +29 -0
@@ -1,14 +1,20 @@
1
1
  import { SourceStopId, StopId } from '../stops/stops.js';
2
2
  import { ServiceRouteId, Transfer } from '../timetable/timetable.js';
3
3
  import { GtfsStopsMap } from './stops.js';
4
- import { TripId } from './trips.js';
4
+ import { GtfsTripId } 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 = {
8
+ fromTrip: GtfsTripId;
9
+ toTrip: GtfsTripId;
10
+ hopOnStop: StopId;
11
+ };
12
+ export type TripContinuationsMap = Map<StopId, GtfsTripBoarding[]>;
7
13
  export type TransferEntry = {
8
14
  from_stop_id?: SourceStopId;
9
15
  to_stop_id?: SourceStopId;
10
- from_trip_id?: TripId;
11
- to_trip_id?: TripId;
16
+ from_trip_id?: GtfsTripId;
17
+ to_trip_id?: GtfsTripId;
12
18
  from_route_id?: ServiceRouteId;
13
19
  to_route_id?: ServiceRouteId;
14
20
  transfer_type: GtfsTransferType;
@@ -20,4 +26,7 @@ export type TransferEntry = {
20
26
  * @param stopsStream The readable stream containing the stops data.
21
27
  * @return A mapping of stop IDs to corresponding stop details.
22
28
  */
23
- export declare const parseTransfers: (transfersStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap) => Promise<TransfersMap>;
29
+ export declare const parseTransfers: (transfersStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap) => Promise<{
30
+ transfers: TransfersMap;
31
+ tripContinuations: TripContinuationsMap;
32
+ }>;
@@ -1,12 +1,16 @@
1
1
  import { StopId } from '../stops/stops.js';
2
- import { Route } from '../timetable/route.js';
2
+ import { Route, RouteId, TripRouteIndex } from '../timetable/route.js';
3
3
  import { ServiceRoute, ServiceRouteId, StopAdjacency } from '../timetable/timetable.js';
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 } from './transfers.js';
8
- export type TripId = string;
9
- export type TripIdsMap = Map<TripId, GtfsRouteId>;
7
+ import { TransfersMap, TripContinuationsMap } from './transfers.js';
8
+ export type GtfsTripId = string;
9
+ export type GtfsTripIdsMap = Map<GtfsTripId, GtfsRouteId>;
10
+ export type TripsMapping = Map<GtfsTripId, {
11
+ routeId: RouteId;
12
+ tripRouteIndex: TripRouteIndex;
13
+ }>;
10
14
  export type GtfsPickupDropOffType = '' | '0' | '1' | '2' | '3';
11
15
  export type SerializedPickUpDropOffType = 0 | 1 | 2 | 3;
12
16
  /**
@@ -22,8 +26,8 @@ export declare const encodePickUpDropOffTypes: (pickUpTypes: SerializedPickUpDro
22
26
  * @param serviceRoutes A mapping of route IDs to route details.
23
27
  * @returns A mapping of trip IDs to corresponding route IDs.
24
28
  */
25
- export declare const parseTrips: (tripsStream: NodeJS.ReadableStream, serviceIds: ServiceIds, validGtfsRoutes: GtfsRoutesMap) => Promise<TripIdsMap>;
26
- export declare const buildStopsAdjacencyStructure: (serviceRoutes: ServiceRoute[], routes: Route[], transfersMap: TransfersMap, nbStops: number, activeStops: Set<StopId>) => StopAdjacency[];
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[];
27
31
  /**
28
32
  * Parses the stop_times.txt data from a GTFS feed.
29
33
  *
@@ -33,7 +37,8 @@ export declare const buildStopsAdjacencyStructure: (serviceRoutes: ServiceRoute[
33
37
  * @param activeStopIds A set of valid stop IDs.
34
38
  * @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.
35
39
  */
36
- export declare const parseStopTimes: (stopTimesStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap, activeTripIds: TripIdsMap, activeStopIds: Set<StopId>) => Promise<{
40
+ export declare const parseStopTimes: (stopTimesStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap, activeTripIds: GtfsTripIdsMap, activeStopIds: Set<StopId>) => Promise<{
37
41
  routes: Route[];
38
42
  serviceRoutesMap: Map<GtfsRouteId, ServiceRouteId>;
43
+ tripsMapping: TripsMapping;
39
44
  }>;