minotor 12.0.0 → 13.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 (48) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/README.md +7 -4
  3. package/dist/cli/perf.d.ts +19 -9
  4. package/dist/cli.mjs +289 -206
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/parser.cjs.js +37 -19
  7. package/dist/parser.cjs.js.map +1 -1
  8. package/dist/parser.esm.js +37 -19
  9. package/dist/parser.esm.js.map +1 -1
  10. package/dist/router.cjs.js +1 -1
  11. package/dist/router.cjs.js.map +1 -1
  12. package/dist/router.d.ts +2 -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/rangeResult.d.ts +34 -25
  18. package/dist/routing/result.d.ts +28 -9
  19. package/dist/routing/resultInternals.d.ts +4 -0
  20. package/dist/routing/routingResult.d.ts +29 -0
  21. package/dist/routing/state.d.ts +2 -2
  22. package/dist/stops/stopsIndex.d.ts +1 -1
  23. package/dist/timetable/route.d.ts +2 -0
  24. package/package.json +2 -2
  25. package/src/cli/minotor.ts +20 -3
  26. package/src/cli/perf.ts +98 -111
  27. package/src/cli/repl.ts +1 -1
  28. package/src/router.ts +3 -0
  29. package/src/routing/__tests__/plotter.test.ts +0 -11
  30. package/src/routing/__tests__/rangeResult.test.ts +1470 -46
  31. package/src/routing/__tests__/rangeRouter.test.ts +14 -8
  32. package/src/routing/__tests__/result.test.ts +375 -76
  33. package/src/routing/__tests__/state.test.ts +29 -0
  34. package/src/routing/plainRouter.ts +1 -6
  35. package/src/routing/plotter.ts +6 -5
  36. package/src/routing/rangeResult.ts +67 -52
  37. package/src/routing/rangeRouter.ts +3 -8
  38. package/src/routing/result.ts +95 -36
  39. package/src/routing/resultInternals.ts +5 -0
  40. package/src/routing/routingResult.ts +34 -0
  41. package/src/routing/state.ts +11 -3
  42. package/src/stops/__tests__/stopFinder.test.ts +13 -0
  43. package/src/stops/stopsIndex.ts +13 -19
  44. package/src/timetable/__tests__/io.test.ts +27 -0
  45. package/src/timetable/__tests__/route.test.ts +30 -0
  46. package/src/timetable/io.ts +15 -1
  47. package/src/timetable/route.ts +19 -5
  48. package/src/timetable/timetable.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
- # [12.0.0](https://github.com/aubryio/minotor/compare/v11.5.2...v12.0.0) (2026-10-20)
1
+ # [13.0.0](https://github.com/aubryio/minotor/compare/v12.0.1...v13.0.0) (2026-10-30)
2
2
 
3
3
 
4
4
  ### Code Refactoring
5
5
 
6
- * use numeric types rather than strings across the api ([#79](https://github.com/aubryio/minotor/issues/79)) ([80c395b](https://github.com/aubryio/minotor/commit/80c395bcc7db1523e7f267ef1803591fca181386))
6
+ * improve public results APIs ([#81](https://github.com/aubryio/minotor/issues/81)) ([bc45e33](https://github.com/aubryio/minotor/commit/bc45e3345bbcfb57210cad0bd2ee748abfc5f8fe))
7
7
 
8
8
 
9
9
  ### BREAKING CHANGES
10
10
 
11
- * Route types, pick-up and drop-off types and transfer types are now numerical rather
12
- than strings in the API.
11
+ * result and rangeResult public API changes (routingGraph not accessible anymore,
12
+ harmonized methods signatures)
package/README.md CHANGED
@@ -126,6 +126,8 @@ const route = result.bestRoute(); // Route | undefined
126
126
 
127
127
  // Earliest arrival at any individual stop (useful for isochrone computation)
128
128
  const arrival = result.arrivalAt(stop.id); // { arrival: Time, legNumber: number } | undefined
129
+ // Earliest arrival at every reachable stop
130
+ const arrivals = result.arrivals();
129
131
  ```
130
132
 
131
133
  Query options:
@@ -166,11 +168,12 @@ for (const { departureTime, result } of rangeResult) {
166
168
  const earliest = rangeResult.bestRoute(); // earliest arrival
167
169
  const latest = rangeResult.latestDepartureRoute(); // latest possible departure
168
170
  const fastest = rangeResult.fastestRoute(); // shortest travel duration
169
- const all = rangeResult.getRoutes(); // all routes, earliest-departure-first
171
+ const all = rangeResult.routes(); // lazy iterator, earliest-departure-first
170
172
 
171
- // Earliest arrival at every reachable stop across all runs
172
- const arrivals = rangeResult.allEarliestArrivals(); // Map<StopId, Arrival>
173
- const durations = rangeResult.allShortestDurations(); // Map<StopId, DurationArrival>
173
+ // Earliest arrival at every reachable stop
174
+ const arrivals = rangeResult.arrivals();
175
+ // Shortest duration to every reachable stop
176
+ const durations = rangeResult.shortestDurations();
174
177
  ```
175
178
 
176
179
  ### CLI Usage
@@ -2,7 +2,17 @@ import { Query, RangeQuery, Router, StopsIndex } from '../router.js';
2
2
  type PerformanceResult = {
3
3
  label: string;
4
4
  meanTimeUs: number;
5
- meanMemoryMb: number;
5
+ meanHeapMiB: number;
6
+ meanArrayBuffersMiB: number;
7
+ };
8
+ /** Observed deltas, not peak memory or total allocations; GC can make them negative. */
9
+ export declare const measurePerformance: (operation: () => unknown, iterations: number) => Omit<PerformanceResult, "label">;
10
+ /** Measure retained storage after collection, keeping only the returned value alive. */
11
+ export declare const measureRetainedMemory: <T>(operation: () => T) => {
12
+ value: T;
13
+ loadTimeMs: number;
14
+ retainedHeapMiB?: number;
15
+ retainedArrayBuffersMiB?: number;
6
16
  };
7
17
  /**
8
18
  * Loads a list of routing queries from a JSON file and resolves the
@@ -46,7 +56,7 @@ export declare const loadRangeQueriesFromJson: (filePath: string, stopsIndex: St
46
56
  * yield a more stable mean at the cost of longer wall-clock time.
47
57
  * @param stopsIndex - Used to resolve stop names for result labels.
48
58
  * @returns An array of {@link PerformanceResult} objects, one per query, each
49
- * containing the mean wall-clock time (µs) and mean heap delta (MB).
59
+ * containing the mean wall-clock time (µs) and mean heap and ArrayBuffer deltas (MiB).
50
60
  */
51
61
  export declare const testRouterPerformance: (router: Router, tasks: Query[], iterations: number, stopsIndex: StopsIndex) => PerformanceResult[];
52
62
  /**
@@ -60,7 +70,7 @@ export declare const testRouterPerformance: (router: Router, tasks: Query[], ite
60
70
  * @param iterations - Number of times `bestRoute` is called per query.
61
71
  * @param stopsIndex - Used to resolve stop names for result labels.
62
72
  * @returns An array of {@link PerformanceResult} objects, one per query, each
63
- * containing the mean wall-clock time (µs) and mean heap delta (MB) for the
73
+ * containing the mean wall-clock time (µs) and mean heap and ArrayBuffer deltas (MiB) for the
64
74
  * `bestRoute` call alone.
65
75
  */
66
76
  export declare const testBestRoutePerformance: (router: Router, tasks: Query[], iterations: number, stopsIndex: StopsIndex) => PerformanceResult[];
@@ -73,22 +83,22 @@ export declare const testBestRoutePerformance: (router: Router, tasks: Query[],
73
83
  * @param iterations - Number of times each query is repeated.
74
84
  * @param stopsIndex - Used to resolve stop names for result labels.
75
85
  * @returns An array of {@link PerformanceResult} objects, one per query, each
76
- * containing the mean wall-clock time (µs) and mean heap delta (MB).
86
+ * containing the mean wall-clock time (µs) and mean heap and ArrayBuffer deltas (MiB).
77
87
  */
78
88
  export declare const testRangeRouterPerformance: (router: Router, tasks: RangeQuery[], iterations: number, stopsIndex: StopsIndex) => PerformanceResult[];
79
89
  /**
80
- * Benchmarks {@link RangeResult.getRoutes} — the full Pareto-frontier
90
+ * Benchmarks {@link RangeResult.routes} — the full Pareto-frontier
81
91
  * reconstruction phase — independently of the range routing phase.
82
92
  *
83
93
  * @param router - The router instance used to produce the range results that
84
- * are then fed into `getRoutes`.
94
+ * are then fed into `routes`.
85
95
  * @param tasks - The list of range queries to benchmark. One
86
96
  * {@link PerformanceResult} is produced per query.
87
- * @param iterations - Number of times `getRoutes` is called per query.
97
+ * @param iterations - Number of times `routes` is fully consumed per query.
88
98
  * @param stopsIndex - Used to resolve stop names for result labels.
89
99
  * @returns An array of {@link PerformanceResult} objects, one per query, each
90
- * containing the mean wall-clock time (µs) and mean heap delta (MB) for the
91
- * `getRoutes` call alone.
100
+ * containing the mean wall-clock time (µs) and mean heap and ArrayBuffer deltas (MiB) for the
101
+ * full `routes` iteration alone.
92
102
  */
93
103
  export declare const testRangeResultPerformance: (router: Router, tasks: RangeQuery[], iterations: number, stopsIndex: StopsIndex) => PerformanceResult[];
94
104
  /**