minotor 3.0.1 → 3.0.2
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.
- package/.cspell.json +12 -1
- package/.gitattributes +3 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +3 -0
- package/.github/workflows/minotor.yml +17 -1
- package/CHANGELOG.md +2 -2
- package/README.md +34 -14
- package/dist/__e2e__/router.test.d.ts +1 -0
- package/dist/cli/perf.d.ts +28 -0
- package/dist/cli/utils.d.ts +6 -2
- package/dist/cli.mjs +1967 -823
- package/dist/cli.mjs.map +1 -1
- package/dist/gtfs/trips.d.ts +1 -0
- package/dist/gtfs/utils.d.ts +1 -1
- package/dist/parser.cjs.js +1030 -627
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.d.ts +4 -2
- package/dist/parser.esm.js +1030 -627
- package/dist/parser.esm.js.map +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +10 -5
- package/dist/router.esm.js +1 -1
- package/dist/router.esm.js.map +1 -1
- package/dist/router.umd.js +1 -1
- package/dist/router.umd.js.map +1 -1
- package/dist/routing/__tests__/result.test.d.ts +1 -0
- package/dist/routing/query.d.ts +27 -6
- package/dist/routing/result.d.ts +1 -1
- package/dist/routing/route.d.ts +47 -2
- package/dist/routing/router.d.ts +15 -1
- package/dist/stops/stopsIndex.d.ts +3 -3
- package/dist/timetable/__tests__/route.test.d.ts +1 -0
- package/dist/timetable/__tests__/time.test.d.ts +1 -0
- package/dist/timetable/io.d.ts +7 -1
- package/dist/timetable/proto/timetable.d.ts +1 -1
- package/dist/timetable/route.d.ts +155 -0
- package/dist/timetable/time.d.ts +21 -0
- package/dist/timetable/timetable.d.ts +41 -61
- package/package.json +36 -34
- package/src/__e2e__/benchmark.json +22 -0
- package/src/__e2e__/router.test.ts +209 -0
- package/src/__e2e__/timetable/stops.bin +3 -0
- package/src/__e2e__/timetable/timetable.bin +3 -0
- package/src/cli/minotor.ts +51 -1
- package/src/cli/perf.ts +136 -0
- package/src/cli/repl.ts +26 -13
- package/src/cli/utils.ts +6 -28
- package/src/gtfs/__tests__/parser.test.ts +12 -15
- package/src/gtfs/__tests__/services.test.ts +1 -0
- package/src/gtfs/__tests__/transfers.test.ts +0 -1
- package/src/gtfs/__tests__/trips.test.ts +67 -74
- package/src/gtfs/profiles/ch.ts +1 -1
- package/src/gtfs/routes.ts +4 -4
- package/src/gtfs/services.ts +15 -2
- package/src/gtfs/stops.ts +7 -3
- package/src/gtfs/transfers.ts +6 -3
- package/src/gtfs/trips.ts +33 -16
- package/src/gtfs/utils.ts +13 -2
- package/src/parser.ts +4 -2
- package/src/router.ts +17 -11
- package/src/routing/__tests__/result.test.ts +392 -0
- package/src/routing/__tests__/router.test.ts +94 -137
- package/src/routing/query.ts +28 -7
- package/src/routing/result.ts +10 -5
- package/src/routing/route.ts +95 -9
- package/src/routing/router.ts +82 -66
- package/src/stops/__tests__/io.test.ts +1 -1
- package/src/stops/__tests__/stopFinder.test.ts +1 -1
- package/src/stops/proto/stops.ts +4 -4
- package/src/stops/stopsIndex.ts +3 -3
- package/src/timetable/__tests__/io.test.ts +16 -23
- package/src/timetable/__tests__/route.test.ts +317 -0
- package/src/timetable/__tests__/time.test.ts +494 -0
- package/src/timetable/__tests__/timetable.test.ts +64 -75
- package/src/timetable/io.ts +32 -26
- package/src/timetable/proto/timetable.proto +1 -1
- package/src/timetable/proto/timetable.ts +13 -13
- package/src/timetable/route.ts +347 -0
- package/src/timetable/time.ts +40 -8
- package/src/timetable/timetable.ts +74 -165
- package/tsconfig.build.json +1 -1
package/.cspell.json
CHANGED
|
@@ -30,7 +30,18 @@
|
|
|
30
30
|
"Klosters",
|
|
31
31
|
"Engadin",
|
|
32
32
|
"isochrone",
|
|
33
|
-
"Delling"
|
|
33
|
+
"Delling",
|
|
34
|
+
"Moléson",
|
|
35
|
+
"Bulle",
|
|
36
|
+
"Gruyères",
|
|
37
|
+
"gare",
|
|
38
|
+
"funi",
|
|
39
|
+
"Francey",
|
|
40
|
+
"téléphérique",
|
|
41
|
+
"Moritz",
|
|
42
|
+
"Haut",
|
|
43
|
+
"Rhin",
|
|
44
|
+
"Olten"
|
|
34
45
|
],
|
|
35
46
|
"flagWords": [],
|
|
36
47
|
"ignorePaths": [
|
package/.gitattributes
ADDED
|
@@ -2,3 +2,6 @@ Fixes # (issue)
|
|
|
2
2
|
|
|
3
3
|
Please provide a concise description of your changes, and the motivation for making them.
|
|
4
4
|
If relevant, include links to related issues or pull requests.
|
|
5
|
+
|
|
6
|
+
- [ ] If the timetable or stops format changed, I re-generated `src/__e2e__/timetable/stops.bin` and `src/__e2e__/timetable/timetable.bin` based on the latest Swiss GTFS for the next Monday (and adjusted e2e tests results accordingly if needed).
|
|
7
|
+
- [ ] I ran the performance tests and confirmed that no regression was introduced.
|
|
@@ -67,9 +67,25 @@ jobs:
|
|
|
67
67
|
- name: ⚡ Tests
|
|
68
68
|
run: npm run test:coverage
|
|
69
69
|
|
|
70
|
+
e2e:
|
|
71
|
+
name: 🏁 End-to-end tests
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v3
|
|
75
|
+
with:
|
|
76
|
+
lfs: true
|
|
77
|
+
- name: Checkout LFS objects
|
|
78
|
+
run: git lfs pull
|
|
79
|
+
- uses: actions/setup-node@v3
|
|
80
|
+
with:
|
|
81
|
+
node-version: '21.1.0'
|
|
82
|
+
- uses: bahmutov/npm-install@v1
|
|
83
|
+
- name: 🏁 End-to-end tests
|
|
84
|
+
run: npm run e2e
|
|
85
|
+
|
|
70
86
|
build-and-release:
|
|
71
87
|
name: 🚀 Build & release
|
|
72
|
-
needs: [format, lint, audit, spell, type, test]
|
|
88
|
+
needs: [format, lint, audit, spell, type, test, e2e]
|
|
73
89
|
runs-on: ubuntu-latest
|
|
74
90
|
steps:
|
|
75
91
|
- uses: actions/checkout@v3
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [3.0.
|
|
1
|
+
## [3.0.2](https://github.com/aubryio/minotor/compare/v3.0.1...v3.0.2) (2025-09-05)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* make csv-parser cast sequence numbers as numbers ([#21](https://github.com/aubryio/minotor/issues/21)) ([8bf70c2](https://github.com/aubryio/minotor/commit/8bf70c26a4ccec6e32b849b608bd399fe53382db))
|
package/README.md
CHANGED
|
@@ -61,8 +61,9 @@ const parser = new GtfsParser('gtfs-feed.zip', chGtfsProfile);
|
|
|
61
61
|
const { timetable, stopsIndex } = await parser.parse(new Date());
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Note that
|
|
65
|
-
|
|
64
|
+
Note that times are only represented at the minute level so they can fit on 16 bits.
|
|
65
|
+
|
|
66
|
+
This operation can take a few minutes for large GTFS feeds.
|
|
66
67
|
|
|
67
68
|
#### Stop Search (Browser or Node.js)
|
|
68
69
|
|
|
@@ -127,11 +128,21 @@ Query routes (`minotor> .route -h for more options`):
|
|
|
127
128
|
|
|
128
129
|
## Development
|
|
129
130
|
|
|
131
|
+
### Requirements
|
|
132
|
+
|
|
133
|
+
Make sure you have a working [node](https://nodejs.org) environment.
|
|
134
|
+
|
|
135
|
+
`protoc` also needs to be available on the build system.
|
|
136
|
+
|
|
137
|
+
Ubuntu: `sudo apt install -y protobuf-compiler` |
|
|
138
|
+
Fedora: `sudo dnf install -y protobuf-compiler` |
|
|
139
|
+
MacOS: `brew install protobuf`
|
|
140
|
+
|
|
130
141
|
### Debugging
|
|
131
142
|
|
|
132
143
|
It is possible to plot the router graph to debug the algorithm:
|
|
133
144
|
|
|
134
|
-
`minotor repl`
|
|
145
|
+
Using the npm script `repl`, or `minotor repl` if the project is installed globally.
|
|
135
146
|
|
|
136
147
|
`minotor> .plot from <stationId> to <stationId> at <HH:mm> [with <N> transfers] [to <graph.dot>]`
|
|
137
148
|
|
|
@@ -139,15 +150,20 @@ It is possible to plot the router graph to debug the algorithm:
|
|
|
139
150
|
|
|
140
151
|
### Build
|
|
141
152
|
|
|
142
|
-
Make sure you have a working node setup as well as a protobuf compiler.
|
|
143
|
-
|
|
144
153
|
- `build`: builds the project in the `dist/` directory
|
|
145
154
|
- `clean`: removes the `dist/` directory
|
|
146
155
|
|
|
147
|
-
### Tests
|
|
156
|
+
### Unit Tests
|
|
157
|
+
|
|
158
|
+
- `test`: runs unit tests
|
|
159
|
+
- `test:coverage`: runs unit test runner with coverage reports
|
|
160
|
+
|
|
161
|
+
### End-to-End Tests
|
|
148
162
|
|
|
149
|
-
- `
|
|
150
|
-
- `
|
|
163
|
+
- `e2e`: runs end-to-end tests, using a real data from a day in the Swiss GTFS dataset
|
|
164
|
+
- `perf`: runs a basic performance test, using a real data from a day in the Swiss GTFS dataset
|
|
165
|
+
|
|
166
|
+
Note that performance tests are not included in the CI pipeline and must be run manually.
|
|
151
167
|
|
|
152
168
|
### Formatting & linting
|
|
153
169
|
|
|
@@ -163,15 +179,19 @@ Releases are automatically published to npm when merging to the `main` or `beta`
|
|
|
163
179
|
|
|
164
180
|
## Roadmap
|
|
165
181
|
|
|
166
|
-
The project is under active development. Here are some of the features that are planned
|
|
182
|
+
The project is under active development. Here are some of the features that are planned (ordered by priority).
|
|
183
|
+
Contact [the author](https://aubry.io/) for feature requests.
|
|
167
184
|
|
|
168
|
-
-
|
|
185
|
+
- Route/Trip-based transfer support
|
|
186
|
+
- Arrive-by support
|
|
169
187
|
- Range queries
|
|
170
188
|
- Transfer preferences
|
|
189
|
+
- Route/Trip metadata support
|
|
190
|
+
- Routing filters based on metadata e.g. bicycle support, wheelchair access
|
|
191
|
+
- More routing options (slower/faster transfers, etc.)
|
|
192
|
+
- Improved stop search (sort by stop importance)
|
|
193
|
+
- Real-time timetable support (tripId/routeId mapping)
|
|
171
194
|
- Support for exporting a calendar range as opposed to a single day
|
|
172
195
|
- Support for GTFS `frequencies.txt`
|
|
173
|
-
-
|
|
196
|
+
- Load multiple GTFS archives at once
|
|
174
197
|
- NeTEx support
|
|
175
|
-
- Higher level timetable API for cleaner router code
|
|
176
|
-
- RT-GTFS Support (adding tripId support)
|
|
177
|
-
- More extensive testing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Query, Router, StopsIndex } from '../router.js';
|
|
2
|
+
type PerformanceResult = {
|
|
3
|
+
task: Query;
|
|
4
|
+
meanTimeMs: number;
|
|
5
|
+
meanMemoryMb: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param filePath
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const loadQueriesFromJson: (filePath: string) => Query[];
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param router
|
|
16
|
+
* @param stopsIndex
|
|
17
|
+
* @param tasks
|
|
18
|
+
* @param iterations
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const testRouterPerformance: (router: Router, stopsIndex: StopsIndex, tasks: Query[], iterations: number) => PerformanceResult[];
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param results
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare const prettyPrintPerformanceResults: (results: PerformanceResult[]) => void;
|
|
28
|
+
export {};
|
package/dist/cli/utils.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { Result
|
|
2
|
-
|
|
1
|
+
import { Result } from '../router.js';
|
|
2
|
+
/**
|
|
3
|
+
* Plots the graph of the result to a dot file.
|
|
4
|
+
* @param result - The result object to plot.
|
|
5
|
+
* @param filePath - The path where the dot file will be saved.
|
|
6
|
+
*/
|
|
3
7
|
export declare const plotGraphToDotFile: (result: Result, filePath: string) => void;
|