minotor 11.5.1 → 11.5.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/CHANGELOG.md +2 -2
- package/dist/cli.mjs +5596 -5027
- package/dist/cli.mjs.map +1 -1
- package/dist/parser.cjs.js +1481 -772
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.esm.js +1481 -772
- 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.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/stops/proto/v1/stops.d.ts +1 -0
- package/dist/timetable/proto/v1/timetable.d.ts +1 -0
- package/package.json +31 -31
- package/src/routing/raptor.ts +2 -2
- package/src/routing/route.ts +1 -4
- package/src/stops/proto/v1/stops.ts +122 -88
- package/src/stops/stopsIndex.ts +1 -1
- package/src/timetable/proto/v1/timetable.ts +335 -230
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
export declare const protobufPackage = "minotor.stops.v1";
|
|
3
|
+
export declare const protobufFileName = "src/stops/proto/v1/stops.proto";
|
|
3
4
|
export declare enum LocationType {
|
|
4
5
|
LOCATION_TYPE_UNSPECIFIED = 0,
|
|
5
6
|
LOCATION_TYPE_SIMPLE_STOP_OR_PLATFORM = 1,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
export declare const protobufPackage = "minotor.timetable.v1";
|
|
3
|
+
export declare const protobufFileName = "src/timetable/proto/v1/timetable.proto";
|
|
3
4
|
export declare enum TransferType {
|
|
4
5
|
TRANSFER_TYPE_UNSPECIFIED = 0,
|
|
5
6
|
TRANSFER_TYPE_RECOMMENDED_TRANSFER_POINT = 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minotor",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.2",
|
|
4
4
|
"description": "A lightweight client-side transit routing library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"minotor",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=24.
|
|
45
|
+
"node": ">=24.15.0",
|
|
46
46
|
"npm": ">=11.5.2"
|
|
47
47
|
},
|
|
48
48
|
"volta": {
|
|
49
|
-
"node": "24.
|
|
49
|
+
"node": "24.22.0",
|
|
50
50
|
"npm": "11.5.2"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
@@ -74,44 +74,44 @@
|
|
|
74
74
|
"semantic-release": "semantic-release"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@eslint/js": "^
|
|
78
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
77
|
+
"@eslint/js": "^10.0.1",
|
|
78
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
80
80
|
"@rollup/plugin-terser": "^1.0.0",
|
|
81
81
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
82
82
|
"@ryansonshine/commitizen": "^4.2.8",
|
|
83
|
-
"@ryansonshine/cz-conventional-changelog": "^3.3.
|
|
84
|
-
"@semantic-release/changelog": "^
|
|
83
|
+
"@ryansonshine/cz-conventional-changelog": "^3.3.4",
|
|
84
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
85
85
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
86
|
-
"@semantic-release/github": "^12.0.
|
|
87
|
-
"@semantic-release/npm": "^13.
|
|
88
|
-
"@semantic-release/release-notes-generator": "^14.1.
|
|
86
|
+
"@semantic-release/github": "^12.0.10",
|
|
87
|
+
"@semantic-release/npm": "^13.2.0",
|
|
88
|
+
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
89
89
|
"@types/geokdbush": "^1.1.5",
|
|
90
|
-
"@types/luxon": "^3.7.
|
|
91
|
-
"@types/node": "^
|
|
92
|
-
"c8": "^
|
|
93
|
-
"cspell": "^
|
|
94
|
-
"eslint": "^10.
|
|
90
|
+
"@types/luxon": "^3.7.6",
|
|
91
|
+
"@types/node": "^26.6.5",
|
|
92
|
+
"c8": "^12.0.0",
|
|
93
|
+
"cspell": "^10.4.0",
|
|
94
|
+
"eslint": "^10.13.0",
|
|
95
95
|
"eslint-config-prettier": "^10.1.8",
|
|
96
|
-
"eslint-plugin-simple-import-sort": "^
|
|
97
|
-
"prettier": "^3.
|
|
98
|
-
"rimraf": "^6.1.
|
|
99
|
-
"rollup": "^4.
|
|
100
|
-
"semantic-release": "^25.0.
|
|
101
|
-
"ts-proto": "^2.
|
|
102
|
-
"tsx": "^4.
|
|
103
|
-
"typescript": "
|
|
104
|
-
"typescript-eslint": "^8.
|
|
96
|
+
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
97
|
+
"prettier": "^3.9.10",
|
|
98
|
+
"rimraf": "^6.1.3",
|
|
99
|
+
"rollup": "^4.64.10",
|
|
100
|
+
"semantic-release": "^25.0.9",
|
|
101
|
+
"ts-proto": "^2.18.0",
|
|
102
|
+
"tsx": "^4.23.15",
|
|
103
|
+
"typescript": "~6.0.3",
|
|
104
|
+
"typescript-eslint": "^8.72.0"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@bufbuild/protobuf": "^2.
|
|
108
|
-
"commander": "^
|
|
109
|
-
"csv-parse": "^
|
|
110
|
-
"geokdbush": "^2.0
|
|
111
|
-
"kdbush": "^4.0
|
|
107
|
+
"@bufbuild/protobuf": "^2.16.0",
|
|
108
|
+
"commander": "^15.0.0",
|
|
109
|
+
"csv-parse": "^7.0.3",
|
|
110
|
+
"geokdbush": "^2.1.0",
|
|
111
|
+
"kdbush": "^4.1.0",
|
|
112
112
|
"loglevel": "^1.9.2",
|
|
113
113
|
"luxon": "^3.7.2",
|
|
114
|
-
"node-stream-zip": "^1.
|
|
115
|
-
"slimsearch": "^
|
|
114
|
+
"node-stream-zip": "^1.16.0",
|
|
115
|
+
"slimsearch": "^3.0.0"
|
|
116
116
|
}
|
|
117
117
|
}
|
package/src/routing/raptor.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { Duration, DURATION_ZERO, Time } from '../timetable/time.js';
|
|
10
10
|
import { Timetable, TransferTypes, TripStop } from '../timetable/timetable.js';
|
|
11
11
|
import { QueryOptions } from './query.js';
|
|
12
|
-
import { RoutingEdge,
|
|
12
|
+
import { RoutingEdge, VehicleEdge } from './state.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Common interface for all variants of RAPTOR routing.
|
|
@@ -411,7 +411,7 @@ export class Raptor {
|
|
|
411
411
|
to: transfer.destination, // TODO needed?
|
|
412
412
|
minTransferTime: transferTime || undefined,
|
|
413
413
|
type: transfer.type,
|
|
414
|
-
}
|
|
414
|
+
};
|
|
415
415
|
state.updateArrival(
|
|
416
416
|
transfer.destination,
|
|
417
417
|
arrivalAfterTransfer,
|
package/src/routing/route.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
DURATION_ZERO,
|
|
6
6
|
durationToString,
|
|
7
7
|
Time,
|
|
8
|
-
TIME_ORIGIN,
|
|
9
8
|
timeToString,
|
|
10
9
|
} from '../timetable/time.js';
|
|
11
10
|
import type {
|
|
@@ -81,7 +80,6 @@ export class Route {
|
|
|
81
80
|
* @throws If no vehicle leg is found in the route.
|
|
82
81
|
*/
|
|
83
82
|
arrivalTime(): Time {
|
|
84
|
-
let lastVehicleArrivalTime: Time = TIME_ORIGIN;
|
|
85
83
|
let totalTransferTime: Duration = DURATION_ZERO;
|
|
86
84
|
|
|
87
85
|
// Find the last vehicle leg and sum transfer times that come after it
|
|
@@ -90,8 +88,7 @@ export class Route {
|
|
|
90
88
|
const leg = this.legs[i]!;
|
|
91
89
|
|
|
92
90
|
if ('arrivalTime' in leg) {
|
|
93
|
-
|
|
94
|
-
return lastVehicleArrivalTime + totalTransferTime;
|
|
91
|
+
return leg.arrivalTime + totalTransferTime;
|
|
95
92
|
} else if ('minTransferTime' in leg && leg.minTransferTime) {
|
|
96
93
|
totalTransferTime += leg.minTransferTime;
|
|
97
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.
|
|
3
|
+
// protoc-gen-ts_proto v2.18.0
|
|
4
4
|
// protoc v4.23.4
|
|
5
5
|
// source: src/stops/proto/v1/stops.proto
|
|
6
6
|
|
|
@@ -9,6 +9,8 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
|
9
9
|
|
|
10
10
|
export const protobufPackage = "minotor.stops.v1";
|
|
11
11
|
|
|
12
|
+
export const protobufFileName = "src/stops/proto/v1/stops.proto";
|
|
13
|
+
|
|
12
14
|
export enum LocationType {
|
|
13
15
|
LOCATION_TYPE_UNSPECIFIED = 0,
|
|
14
16
|
LOCATION_TYPE_SIMPLE_STOP_OR_PLATFORM = 1,
|
|
@@ -108,11 +110,13 @@ export const Stop: MessageFns<Stop> = {
|
|
|
108
110
|
if (message.lon !== undefined) {
|
|
109
111
|
writer.uint32(37).float(message.lon);
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
if (message.children.length !== 0) {
|
|
114
|
+
writer.uint32(42).fork();
|
|
115
|
+
for (const v of message.children) {
|
|
116
|
+
writer.uint32(v);
|
|
117
|
+
}
|
|
118
|
+
writer.join();
|
|
114
119
|
}
|
|
115
|
-
writer.join();
|
|
116
120
|
if (message.parent !== undefined) {
|
|
117
121
|
writer.uint32(48).uint32(message.parent);
|
|
118
122
|
}
|
|
@@ -127,103 +131,120 @@ export const Stop: MessageFns<Stop> = {
|
|
|
127
131
|
|
|
128
132
|
decode(input: BinaryReader | Uint8Array, length?: number): Stop {
|
|
129
133
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
135
|
+
if (previousRecursionDepth >= 100) {
|
|
136
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
137
|
+
}
|
|
138
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
139
|
+
try {
|
|
140
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
141
|
+
const message = createBaseStop();
|
|
142
|
+
while (reader.pos < end) {
|
|
143
|
+
const tag = reader.uint32();
|
|
144
|
+
switch (tag >>> 3) {
|
|
145
|
+
case 1: {
|
|
146
|
+
if (tag !== 10) {
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
139
149
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
case 2: {
|
|
144
|
-
if (tag !== 18) {
|
|
145
|
-
break;
|
|
150
|
+
message.name = reader.string();
|
|
151
|
+
continue;
|
|
146
152
|
}
|
|
153
|
+
case 2: {
|
|
154
|
+
if (tag !== 18) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
147
157
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
case 3: {
|
|
152
|
-
if (tag !== 29) {
|
|
153
|
-
break;
|
|
158
|
+
message.sourceStopId = reader.string();
|
|
159
|
+
continue;
|
|
154
160
|
}
|
|
161
|
+
case 3: {
|
|
162
|
+
if (tag !== 29) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
155
165
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
case 4: {
|
|
160
|
-
if (tag !== 37) {
|
|
161
|
-
break;
|
|
166
|
+
message.lat = reader.float();
|
|
167
|
+
continue;
|
|
162
168
|
}
|
|
169
|
+
case 4: {
|
|
170
|
+
if (tag !== 37) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
163
173
|
|
|
164
|
-
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
case 5: {
|
|
168
|
-
if (tag === 40) {
|
|
169
|
-
message.children.push(reader.uint32());
|
|
170
|
-
|
|
174
|
+
message.lon = reader.float();
|
|
171
175
|
continue;
|
|
172
176
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const end2 = reader.uint32() + reader.pos;
|
|
176
|
-
while (reader.pos < end2) {
|
|
177
|
+
case 5: {
|
|
178
|
+
if (tag === 40) {
|
|
177
179
|
message.children.push(reader.uint32());
|
|
180
|
+
|
|
181
|
+
continue;
|
|
178
182
|
}
|
|
179
183
|
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
if (tag === 42) {
|
|
185
|
+
const end2 = reader.uint32() + reader.pos;
|
|
186
|
+
while (reader.pos < end2) {
|
|
187
|
+
message.children.push(reader.uint32());
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
182
192
|
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
case 6: {
|
|
186
|
-
if (tag !== 48) {
|
|
187
193
|
break;
|
|
188
194
|
}
|
|
195
|
+
case 6: {
|
|
196
|
+
if (tag !== 48) {
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
189
199
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
case 7: {
|
|
194
|
-
if (tag !== 56) {
|
|
195
|
-
break;
|
|
200
|
+
message.parent = reader.uint32();
|
|
201
|
+
continue;
|
|
196
202
|
}
|
|
203
|
+
case 7: {
|
|
204
|
+
if (tag !== 56) {
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
197
207
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
case 8: {
|
|
202
|
-
if (tag !== 66) {
|
|
203
|
-
break;
|
|
208
|
+
message.locationType = reader.int32() as any;
|
|
209
|
+
continue;
|
|
204
210
|
}
|
|
211
|
+
case 8: {
|
|
212
|
+
if (tag !== 66) {
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
205
215
|
|
|
206
|
-
|
|
207
|
-
|
|
216
|
+
message.platform = reader.string();
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
208
219
|
}
|
|
220
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
reader.skip(tag & 7);
|
|
209
224
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
reader.skip(tag & 7);
|
|
225
|
+
return message;
|
|
226
|
+
} finally {
|
|
227
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
214
228
|
}
|
|
215
|
-
return message;
|
|
216
229
|
},
|
|
217
230
|
|
|
218
231
|
fromJSON(object: any): Stop {
|
|
219
232
|
return {
|
|
220
233
|
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
221
|
-
sourceStopId: isSet(object.sourceStopId)
|
|
234
|
+
sourceStopId: isSet(object.sourceStopId)
|
|
235
|
+
? globalThis.String(object.sourceStopId)
|
|
236
|
+
: isSet(object.source_stop_id)
|
|
237
|
+
? globalThis.String(object.source_stop_id)
|
|
238
|
+
: undefined,
|
|
222
239
|
lat: isSet(object.lat) ? globalThis.Number(object.lat) : undefined,
|
|
223
240
|
lon: isSet(object.lon) ? globalThis.Number(object.lon) : undefined,
|
|
224
241
|
children: globalThis.Array.isArray(object?.children) ? object.children.map((e: any) => globalThis.Number(e)) : [],
|
|
225
242
|
parent: isSet(object.parent) ? globalThis.Number(object.parent) : undefined,
|
|
226
|
-
locationType: isSet(object.locationType)
|
|
243
|
+
locationType: isSet(object.locationType)
|
|
244
|
+
? locationTypeFromJSON(object.locationType)
|
|
245
|
+
: isSet(object.location_type)
|
|
246
|
+
? locationTypeFromJSON(object.location_type)
|
|
247
|
+
: 0,
|
|
227
248
|
platform: isSet(object.platform) ? globalThis.String(object.platform) : undefined,
|
|
228
249
|
};
|
|
229
250
|
},
|
|
@@ -237,10 +258,10 @@ export const Stop: MessageFns<Stop> = {
|
|
|
237
258
|
obj.sourceStopId = message.sourceStopId;
|
|
238
259
|
}
|
|
239
260
|
if (message.lat !== undefined) {
|
|
240
|
-
obj.lat = message.lat;
|
|
261
|
+
obj.lat = floatToJson(message.lat);
|
|
241
262
|
}
|
|
242
263
|
if (message.lon !== undefined) {
|
|
243
|
-
obj.lon = message.lon;
|
|
264
|
+
obj.lon = floatToJson(message.lon);
|
|
244
265
|
}
|
|
245
266
|
if (message.children?.length) {
|
|
246
267
|
obj.children = message.children.map((e) => Math.round(e));
|
|
@@ -288,26 +309,35 @@ export const StopsMap: MessageFns<StopsMap> = {
|
|
|
288
309
|
|
|
289
310
|
decode(input: BinaryReader | Uint8Array, length?: number): StopsMap {
|
|
290
311
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
312
|
+
const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
|
|
313
|
+
if (previousRecursionDepth >= 100) {
|
|
314
|
+
throw new globalThis.Error("protobuf decode recursion limit exceeded");
|
|
315
|
+
}
|
|
316
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
|
|
317
|
+
try {
|
|
318
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
319
|
+
const message = createBaseStopsMap();
|
|
320
|
+
while (reader.pos < end) {
|
|
321
|
+
const tag = reader.uint32();
|
|
322
|
+
switch (tag >>> 3) {
|
|
323
|
+
case 2: {
|
|
324
|
+
if (tag !== 18) {
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
300
327
|
|
|
301
|
-
|
|
302
|
-
|
|
328
|
+
message.stops.push(Stop.decode(reader, reader.uint32()));
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
303
331
|
}
|
|
332
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
reader.skip(tag & 7);
|
|
304
336
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
reader.skip(tag & 7);
|
|
337
|
+
return message;
|
|
338
|
+
} finally {
|
|
339
|
+
(reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
|
|
309
340
|
}
|
|
310
|
-
return message;
|
|
311
341
|
},
|
|
312
342
|
|
|
313
343
|
fromJSON(object: any): StopsMap {
|
|
@@ -332,6 +362,10 @@ export const StopsMap: MessageFns<StopsMap> = {
|
|
|
332
362
|
},
|
|
333
363
|
};
|
|
334
364
|
|
|
365
|
+
function floatToJson(value: number | null | undefined): number | string | null | undefined {
|
|
366
|
+
return typeof value === "number" && !globalThis.Number.isFinite(value) ? globalThis.String(value) : value;
|
|
367
|
+
}
|
|
368
|
+
|
|
335
369
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
336
370
|
|
|
337
371
|
export type DeepPartial<T> = T extends Builtin ? T
|
package/src/stops/stopsIndex.ts
CHANGED
|
@@ -140,7 +140,7 @@ export class StopsIndex {
|
|
|
140
140
|
maxResults,
|
|
141
141
|
radius,
|
|
142
142
|
).map((id) => {
|
|
143
|
-
const stopPoint = this.stopPoints[id
|
|
143
|
+
const stopPoint = this.stopPoints[id] as StopPoint;
|
|
144
144
|
return this.stops[stopPoint.id] as Stop;
|
|
145
145
|
});
|
|
146
146
|
return nearestStops;
|