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/src/router.ts CHANGED
@@ -15,6 +15,7 @@ import type {
15
15
  ParetoRun,
16
16
  } from './routing/router.js';
17
17
  import { RangeResult, Router } from './routing/router.js';
18
+ import type { RoutingResult, StopArrival } from './routing/routingResult.js';
18
19
  import type { LocationType, SourceStopId, StopId } from './stops/stops.js';
19
20
  import type { Stop } from './stops/stops.js';
20
21
  import { StopsIndex } from './stops/stopsIndex.js';
@@ -63,9 +64,11 @@ export type {
63
64
  QueryOptions,
64
65
  RangeQueryOptions,
65
66
  RouteType,
67
+ RoutingResult,
66
68
  ServiceRouteInfo,
67
69
  SourceStopId,
68
70
  Stop,
71
+ StopArrival,
69
72
  StopId,
70
73
  Transfer,
71
74
  TransferType,
@@ -13,7 +13,6 @@ import {
13
13
  TransferTypes,
14
14
  } from '../../timetable/timetable.js';
15
15
  import { Plotter } from '../plotter.js';
16
- import { Query } from '../query.js';
17
16
  import { Result } from '../result.js';
18
17
  import { RoutingState } from '../router.js';
19
18
 
@@ -71,16 +70,10 @@ describe('Plotter', () => {
71
70
 
72
71
  const mockStopsIndex = new StopsIndex([stop1, stop2]);
73
72
  const mockTimetable = new Timetable(stopsAdjacency, routesAdjacency, routes);
74
- const mockQuery = new Query.Builder()
75
- .from(0)
76
- .to(new Set([1]))
77
- .departureTime(timeFromHMS(8, 0, 0))
78
- .build();
79
73
 
80
74
  describe('plotDotGraph', () => {
81
75
  it('should generate valid DOT graph structure', () => {
82
76
  const result = new Result(
83
- mockQuery.to,
84
77
  RoutingState.fromTestData({ nbStops: NB_STOPS }),
85
78
  mockStopsIndex,
86
79
  mockTimetable,
@@ -97,7 +90,6 @@ describe('Plotter', () => {
97
90
 
98
91
  it('should include station nodes', () => {
99
92
  const result = new Result(
100
- mockQuery.to,
101
93
  RoutingState.fromTestData({
102
94
  nbStops: NB_STOPS,
103
95
  origins: [0],
@@ -118,7 +110,6 @@ describe('Plotter', () => {
118
110
 
119
111
  it('should handle empty graph gracefully', () => {
120
112
  const result = new Result(
121
- mockQuery.to,
122
113
  RoutingState.fromTestData({ nbStops: NB_STOPS }),
123
114
  mockStopsIndex,
124
115
  mockTimetable,
@@ -146,7 +137,6 @@ describe('Plotter', () => {
146
137
  const specialStopsIndex = new StopsIndex([stop1, stop2, specialStop]);
147
138
 
148
139
  const result = new Result(
149
- mockQuery.to,
150
140
  RoutingState.fromTestData({
151
141
  nbStops: NB_STOPS,
152
142
  origins: [2],
@@ -171,7 +161,6 @@ describe('Plotter', () => {
171
161
 
172
162
  it('should use correct colors', () => {
173
163
  const result = new Result(
174
- mockQuery.to,
175
164
  RoutingState.fromTestData({
176
165
  nbStops: NB_STOPS,
177
166
  origins: [0],