minotor 4.0.0 → 5.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.
- package/CHANGELOG.md +4 -3
- package/dist/cli.mjs +122 -212
- package/dist/cli.mjs.map +1 -1
- package/dist/gtfs/trips.d.ts +6 -5
- package/dist/parser.cjs.js +121 -211
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.esm.js +121 -211
- 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 +2 -2
- 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/route.d.ts +3 -3
- package/dist/timetable/io.d.ts +5 -4
- package/dist/timetable/proto/timetable.d.ts +5 -15
- package/dist/timetable/route.d.ts +1 -1
- package/dist/timetable/timetable.d.ts +7 -5
- package/package.json +1 -1
- package/src/__e2e__/timetable/timetable.bin +2 -2
- package/src/gtfs/__tests__/parser.test.ts +2 -2
- package/src/gtfs/__tests__/routes.test.ts +3 -0
- package/src/gtfs/__tests__/trips.test.ts +122 -154
- package/src/gtfs/parser.ts +2 -1
- package/src/gtfs/routes.ts +1 -0
- package/src/gtfs/trips.ts +21 -19
- package/src/router.ts +2 -2
- package/src/routing/__tests__/route.test.ts +3 -3
- package/src/routing/__tests__/router.test.ts +186 -203
- package/src/routing/route.ts +3 -3
- package/src/routing/router.ts +1 -1
- package/src/timetable/__tests__/io.test.ts +52 -64
- package/src/timetable/__tests__/timetable.test.ts +9 -13
- package/src/timetable/io.ts +20 -19
- package/src/timetable/proto/timetable.proto +5 -8
- package/src/timetable/proto/timetable.ts +78 -201
- package/src/timetable/route.ts +1 -1
- package/src/timetable/timetable.ts +20 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
# [
|
|
1
|
+
# [5.0.0](https://github.com/aubryio/minotor/compare/v4.0.0...v5.0.0) (2025-09-13)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Performance Improvements
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* store routeIds as integers ([#23](https://github.com/aubryio/minotor/issues/23)) ([c347da7](https://github.com/aubryio/minotor/commit/c347da7b69664d9682ab27a3508b5cf253cb6651))
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### BREAKING CHANGES
|
|
10
10
|
|
|
11
|
-
*
|
|
11
|
+
* RouteIds are now represented as integers, older timetables are not supported
|
|
12
|
+
anymore.
|
package/dist/cli.mjs
CHANGED
|
@@ -30,6 +30,18 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
30
30
|
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
function __rest(s, e) {
|
|
34
|
+
var t = {};
|
|
35
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
36
|
+
t[p] = s[p];
|
|
37
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
38
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
39
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
40
|
+
t[p[i]] = s[p[i]];
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
34
46
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -16621,148 +16633,6 @@ const Route$2 = {
|
|
|
16621
16633
|
return message;
|
|
16622
16634
|
},
|
|
16623
16635
|
};
|
|
16624
|
-
function createBaseRoutesAdjacency() {
|
|
16625
|
-
return { routes: {} };
|
|
16626
|
-
}
|
|
16627
|
-
const RoutesAdjacency = {
|
|
16628
|
-
encode(message, writer = new BinaryWriter()) {
|
|
16629
|
-
Object.entries(message.routes).forEach(([key, value]) => {
|
|
16630
|
-
RoutesAdjacency_RoutesEntry.encode({ key: key, value }, writer.uint32(10).fork()).join();
|
|
16631
|
-
});
|
|
16632
|
-
return writer;
|
|
16633
|
-
},
|
|
16634
|
-
decode(input, length) {
|
|
16635
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
16636
|
-
const end = length === undefined ? reader.len : reader.pos + length;
|
|
16637
|
-
const message = createBaseRoutesAdjacency();
|
|
16638
|
-
while (reader.pos < end) {
|
|
16639
|
-
const tag = reader.uint32();
|
|
16640
|
-
switch (tag >>> 3) {
|
|
16641
|
-
case 1: {
|
|
16642
|
-
if (tag !== 10) {
|
|
16643
|
-
break;
|
|
16644
|
-
}
|
|
16645
|
-
const entry1 = RoutesAdjacency_RoutesEntry.decode(reader, reader.uint32());
|
|
16646
|
-
if (entry1.value !== undefined) {
|
|
16647
|
-
message.routes[entry1.key] = entry1.value;
|
|
16648
|
-
}
|
|
16649
|
-
continue;
|
|
16650
|
-
}
|
|
16651
|
-
}
|
|
16652
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
16653
|
-
break;
|
|
16654
|
-
}
|
|
16655
|
-
reader.skip(tag & 7);
|
|
16656
|
-
}
|
|
16657
|
-
return message;
|
|
16658
|
-
},
|
|
16659
|
-
fromJSON(object) {
|
|
16660
|
-
return {
|
|
16661
|
-
routes: isObject(object.routes)
|
|
16662
|
-
? Object.entries(object.routes).reduce((acc, [key, value]) => {
|
|
16663
|
-
acc[key] = Route$2.fromJSON(value);
|
|
16664
|
-
return acc;
|
|
16665
|
-
}, {})
|
|
16666
|
-
: {},
|
|
16667
|
-
};
|
|
16668
|
-
},
|
|
16669
|
-
toJSON(message) {
|
|
16670
|
-
const obj = {};
|
|
16671
|
-
if (message.routes) {
|
|
16672
|
-
const entries = Object.entries(message.routes);
|
|
16673
|
-
if (entries.length > 0) {
|
|
16674
|
-
obj.routes = {};
|
|
16675
|
-
entries.forEach(([k, v]) => {
|
|
16676
|
-
obj.routes[k] = Route$2.toJSON(v);
|
|
16677
|
-
});
|
|
16678
|
-
}
|
|
16679
|
-
}
|
|
16680
|
-
return obj;
|
|
16681
|
-
},
|
|
16682
|
-
create(base) {
|
|
16683
|
-
return RoutesAdjacency.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
16684
|
-
},
|
|
16685
|
-
fromPartial(object) {
|
|
16686
|
-
var _a;
|
|
16687
|
-
const message = createBaseRoutesAdjacency();
|
|
16688
|
-
message.routes = Object.entries((_a = object.routes) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
|
|
16689
|
-
if (value !== undefined) {
|
|
16690
|
-
acc[key] = Route$2.fromPartial(value);
|
|
16691
|
-
}
|
|
16692
|
-
return acc;
|
|
16693
|
-
}, {});
|
|
16694
|
-
return message;
|
|
16695
|
-
},
|
|
16696
|
-
};
|
|
16697
|
-
function createBaseRoutesAdjacency_RoutesEntry() {
|
|
16698
|
-
return { key: "", value: undefined };
|
|
16699
|
-
}
|
|
16700
|
-
const RoutesAdjacency_RoutesEntry = {
|
|
16701
|
-
encode(message, writer = new BinaryWriter()) {
|
|
16702
|
-
if (message.key !== "") {
|
|
16703
|
-
writer.uint32(10).string(message.key);
|
|
16704
|
-
}
|
|
16705
|
-
if (message.value !== undefined) {
|
|
16706
|
-
Route$2.encode(message.value, writer.uint32(18).fork()).join();
|
|
16707
|
-
}
|
|
16708
|
-
return writer;
|
|
16709
|
-
},
|
|
16710
|
-
decode(input, length) {
|
|
16711
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
16712
|
-
const end = length === undefined ? reader.len : reader.pos + length;
|
|
16713
|
-
const message = createBaseRoutesAdjacency_RoutesEntry();
|
|
16714
|
-
while (reader.pos < end) {
|
|
16715
|
-
const tag = reader.uint32();
|
|
16716
|
-
switch (tag >>> 3) {
|
|
16717
|
-
case 1: {
|
|
16718
|
-
if (tag !== 10) {
|
|
16719
|
-
break;
|
|
16720
|
-
}
|
|
16721
|
-
message.key = reader.string();
|
|
16722
|
-
continue;
|
|
16723
|
-
}
|
|
16724
|
-
case 2: {
|
|
16725
|
-
if (tag !== 18) {
|
|
16726
|
-
break;
|
|
16727
|
-
}
|
|
16728
|
-
message.value = Route$2.decode(reader, reader.uint32());
|
|
16729
|
-
continue;
|
|
16730
|
-
}
|
|
16731
|
-
}
|
|
16732
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
16733
|
-
break;
|
|
16734
|
-
}
|
|
16735
|
-
reader.skip(tag & 7);
|
|
16736
|
-
}
|
|
16737
|
-
return message;
|
|
16738
|
-
},
|
|
16739
|
-
fromJSON(object) {
|
|
16740
|
-
return {
|
|
16741
|
-
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
16742
|
-
value: isSet(object.value) ? Route$2.fromJSON(object.value) : undefined,
|
|
16743
|
-
};
|
|
16744
|
-
},
|
|
16745
|
-
toJSON(message) {
|
|
16746
|
-
const obj = {};
|
|
16747
|
-
if (message.key !== "") {
|
|
16748
|
-
obj.key = message.key;
|
|
16749
|
-
}
|
|
16750
|
-
if (message.value !== undefined) {
|
|
16751
|
-
obj.value = Route$2.toJSON(message.value);
|
|
16752
|
-
}
|
|
16753
|
-
return obj;
|
|
16754
|
-
},
|
|
16755
|
-
create(base) {
|
|
16756
|
-
return RoutesAdjacency_RoutesEntry.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
16757
|
-
},
|
|
16758
|
-
fromPartial(object) {
|
|
16759
|
-
var _a;
|
|
16760
|
-
const message = createBaseRoutesAdjacency_RoutesEntry();
|
|
16761
|
-
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
|
|
16762
|
-
message.value = (object.value !== undefined && object.value !== null) ? Route$2.fromPartial(object.value) : undefined;
|
|
16763
|
-
return message;
|
|
16764
|
-
},
|
|
16765
|
-
};
|
|
16766
16636
|
function createBaseTransfer() {
|
|
16767
16637
|
return { destination: 0, type: 0, minTransferTime: undefined };
|
|
16768
16638
|
}
|
|
@@ -16775,7 +16645,7 @@ const Transfer = {
|
|
|
16775
16645
|
writer.uint32(16).int32(message.type);
|
|
16776
16646
|
}
|
|
16777
16647
|
if (message.minTransferTime !== undefined) {
|
|
16778
|
-
writer.uint32(24).
|
|
16648
|
+
writer.uint32(24).uint32(message.minTransferTime);
|
|
16779
16649
|
}
|
|
16780
16650
|
return writer;
|
|
16781
16651
|
},
|
|
@@ -16804,7 +16674,7 @@ const Transfer = {
|
|
|
16804
16674
|
if (tag !== 24) {
|
|
16805
16675
|
break;
|
|
16806
16676
|
}
|
|
16807
|
-
message.minTransferTime = reader.
|
|
16677
|
+
message.minTransferTime = reader.uint32();
|
|
16808
16678
|
continue;
|
|
16809
16679
|
}
|
|
16810
16680
|
}
|
|
@@ -16886,7 +16756,7 @@ const StopsAdjacency = {
|
|
|
16886
16756
|
return {
|
|
16887
16757
|
stops: isObject(object.stops)
|
|
16888
16758
|
? Object.entries(object.stops).reduce((acc, [key, value]) => {
|
|
16889
|
-
acc[key] = StopsAdjacency_StopAdjacency.fromJSON(value);
|
|
16759
|
+
acc[globalThis.Number(key)] = StopsAdjacency_StopAdjacency.fromJSON(value);
|
|
16890
16760
|
return acc;
|
|
16891
16761
|
}, {})
|
|
16892
16762
|
: {},
|
|
@@ -16913,7 +16783,7 @@ const StopsAdjacency = {
|
|
|
16913
16783
|
const message = createBaseStopsAdjacency();
|
|
16914
16784
|
message.stops = Object.entries((_a = object.stops) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
|
|
16915
16785
|
if (value !== undefined) {
|
|
16916
|
-
acc[key] = StopsAdjacency_StopAdjacency.fromPartial(value);
|
|
16786
|
+
acc[globalThis.Number(key)] = StopsAdjacency_StopAdjacency.fromPartial(value);
|
|
16917
16787
|
}
|
|
16918
16788
|
return acc;
|
|
16919
16789
|
}, {});
|
|
@@ -16928,9 +16798,11 @@ const StopsAdjacency_StopAdjacency = {
|
|
|
16928
16798
|
for (const v of message.transfers) {
|
|
16929
16799
|
Transfer.encode(v, writer.uint32(10).fork()).join();
|
|
16930
16800
|
}
|
|
16801
|
+
writer.uint32(18).fork();
|
|
16931
16802
|
for (const v of message.routes) {
|
|
16932
|
-
writer.
|
|
16803
|
+
writer.int32(v);
|
|
16933
16804
|
}
|
|
16805
|
+
writer.join();
|
|
16934
16806
|
return writer;
|
|
16935
16807
|
},
|
|
16936
16808
|
decode(input, length) {
|
|
@@ -16948,11 +16820,18 @@ const StopsAdjacency_StopAdjacency = {
|
|
|
16948
16820
|
continue;
|
|
16949
16821
|
}
|
|
16950
16822
|
case 2: {
|
|
16951
|
-
if (tag
|
|
16952
|
-
|
|
16823
|
+
if (tag === 16) {
|
|
16824
|
+
message.routes.push(reader.int32());
|
|
16825
|
+
continue;
|
|
16953
16826
|
}
|
|
16954
|
-
|
|
16955
|
-
|
|
16827
|
+
if (tag === 18) {
|
|
16828
|
+
const end2 = reader.uint32() + reader.pos;
|
|
16829
|
+
while (reader.pos < end2) {
|
|
16830
|
+
message.routes.push(reader.int32());
|
|
16831
|
+
}
|
|
16832
|
+
continue;
|
|
16833
|
+
}
|
|
16834
|
+
break;
|
|
16956
16835
|
}
|
|
16957
16836
|
}
|
|
16958
16837
|
if ((tag & 7) === 4 || tag === 0) {
|
|
@@ -16967,7 +16846,7 @@ const StopsAdjacency_StopAdjacency = {
|
|
|
16967
16846
|
transfers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.transfers)
|
|
16968
16847
|
? object.transfers.map((e) => Transfer.fromJSON(e))
|
|
16969
16848
|
: [],
|
|
16970
|
-
routes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.routes) ? object.routes.map((e) => globalThis.
|
|
16849
|
+
routes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.routes) ? object.routes.map((e) => globalThis.Number(e)) : [],
|
|
16971
16850
|
};
|
|
16972
16851
|
},
|
|
16973
16852
|
toJSON(message) {
|
|
@@ -16977,7 +16856,7 @@ const StopsAdjacency_StopAdjacency = {
|
|
|
16977
16856
|
obj.transfers = message.transfers.map((e) => Transfer.toJSON(e));
|
|
16978
16857
|
}
|
|
16979
16858
|
if ((_b = message.routes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
16980
|
-
obj.routes = message.routes;
|
|
16859
|
+
obj.routes = message.routes.map((e) => Math.round(e));
|
|
16981
16860
|
}
|
|
16982
16861
|
return obj;
|
|
16983
16862
|
},
|
|
@@ -16993,12 +16872,12 @@ const StopsAdjacency_StopAdjacency = {
|
|
|
16993
16872
|
},
|
|
16994
16873
|
};
|
|
16995
16874
|
function createBaseStopsAdjacency_StopsEntry() {
|
|
16996
|
-
return { key:
|
|
16875
|
+
return { key: 0, value: undefined };
|
|
16997
16876
|
}
|
|
16998
16877
|
const StopsAdjacency_StopsEntry = {
|
|
16999
16878
|
encode(message, writer = new BinaryWriter()) {
|
|
17000
|
-
if (message.key !==
|
|
17001
|
-
writer.uint32(
|
|
16879
|
+
if (message.key !== 0) {
|
|
16880
|
+
writer.uint32(8).uint32(message.key);
|
|
17002
16881
|
}
|
|
17003
16882
|
if (message.value !== undefined) {
|
|
17004
16883
|
StopsAdjacency_StopAdjacency.encode(message.value, writer.uint32(18).fork()).join();
|
|
@@ -17013,10 +16892,10 @@ const StopsAdjacency_StopsEntry = {
|
|
|
17013
16892
|
const tag = reader.uint32();
|
|
17014
16893
|
switch (tag >>> 3) {
|
|
17015
16894
|
case 1: {
|
|
17016
|
-
if (tag !==
|
|
16895
|
+
if (tag !== 8) {
|
|
17017
16896
|
break;
|
|
17018
16897
|
}
|
|
17019
|
-
message.key = reader.
|
|
16898
|
+
message.key = reader.uint32();
|
|
17020
16899
|
continue;
|
|
17021
16900
|
}
|
|
17022
16901
|
case 2: {
|
|
@@ -17036,14 +16915,14 @@ const StopsAdjacency_StopsEntry = {
|
|
|
17036
16915
|
},
|
|
17037
16916
|
fromJSON(object) {
|
|
17038
16917
|
return {
|
|
17039
|
-
key: isSet(object.key) ? globalThis.
|
|
16918
|
+
key: isSet(object.key) ? globalThis.Number(object.key) : 0,
|
|
17040
16919
|
value: isSet(object.value) ? StopsAdjacency_StopAdjacency.fromJSON(object.value) : undefined,
|
|
17041
16920
|
};
|
|
17042
16921
|
},
|
|
17043
16922
|
toJSON(message) {
|
|
17044
16923
|
const obj = {};
|
|
17045
|
-
if (message.key !==
|
|
17046
|
-
obj.key = message.key;
|
|
16924
|
+
if (message.key !== 0) {
|
|
16925
|
+
obj.key = Math.round(message.key);
|
|
17047
16926
|
}
|
|
17048
16927
|
if (message.value !== undefined) {
|
|
17049
16928
|
obj.value = StopsAdjacency_StopAdjacency.toJSON(message.value);
|
|
@@ -17056,7 +16935,7 @@ const StopsAdjacency_StopsEntry = {
|
|
|
17056
16935
|
fromPartial(object) {
|
|
17057
16936
|
var _a;
|
|
17058
16937
|
const message = createBaseStopsAdjacency_StopsEntry();
|
|
17059
|
-
message.key = (_a = object.key) !== null && _a !== void 0 ? _a :
|
|
16938
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : 0;
|
|
17060
16939
|
message.value = (object.value !== undefined && object.value !== null)
|
|
17061
16940
|
? StopsAdjacency_StopAdjacency.fromPartial(object.value)
|
|
17062
16941
|
: undefined;
|
|
@@ -17064,7 +16943,7 @@ const StopsAdjacency_StopsEntry = {
|
|
|
17064
16943
|
},
|
|
17065
16944
|
};
|
|
17066
16945
|
function createBaseServiceRoute() {
|
|
17067
|
-
return { type: 0, name: "" };
|
|
16946
|
+
return { type: 0, name: "", routes: [] };
|
|
17068
16947
|
}
|
|
17069
16948
|
const ServiceRoute = {
|
|
17070
16949
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -17074,6 +16953,11 @@ const ServiceRoute = {
|
|
|
17074
16953
|
if (message.name !== "") {
|
|
17075
16954
|
writer.uint32(18).string(message.name);
|
|
17076
16955
|
}
|
|
16956
|
+
writer.uint32(26).fork();
|
|
16957
|
+
for (const v of message.routes) {
|
|
16958
|
+
writer.int32(v);
|
|
16959
|
+
}
|
|
16960
|
+
writer.join();
|
|
17077
16961
|
return writer;
|
|
17078
16962
|
},
|
|
17079
16963
|
decode(input, length) {
|
|
@@ -17097,6 +16981,20 @@ const ServiceRoute = {
|
|
|
17097
16981
|
message.name = reader.string();
|
|
17098
16982
|
continue;
|
|
17099
16983
|
}
|
|
16984
|
+
case 3: {
|
|
16985
|
+
if (tag === 24) {
|
|
16986
|
+
message.routes.push(reader.int32());
|
|
16987
|
+
continue;
|
|
16988
|
+
}
|
|
16989
|
+
if (tag === 26) {
|
|
16990
|
+
const end2 = reader.uint32() + reader.pos;
|
|
16991
|
+
while (reader.pos < end2) {
|
|
16992
|
+
message.routes.push(reader.int32());
|
|
16993
|
+
}
|
|
16994
|
+
continue;
|
|
16995
|
+
}
|
|
16996
|
+
break;
|
|
16997
|
+
}
|
|
17100
16998
|
}
|
|
17101
16999
|
if ((tag & 7) === 4 || tag === 0) {
|
|
17102
17000
|
break;
|
|
@@ -17109,9 +17007,11 @@ const ServiceRoute = {
|
|
|
17109
17007
|
return {
|
|
17110
17008
|
type: isSet(object.type) ? routeTypeFromJSON(object.type) : 0,
|
|
17111
17009
|
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
17010
|
+
routes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.routes) ? object.routes.map((e) => globalThis.Number(e)) : [],
|
|
17112
17011
|
};
|
|
17113
17012
|
},
|
|
17114
17013
|
toJSON(message) {
|
|
17014
|
+
var _a;
|
|
17115
17015
|
const obj = {};
|
|
17116
17016
|
if (message.type !== 0) {
|
|
17117
17017
|
obj.type = routeTypeToJSON(message.type);
|
|
@@ -17119,16 +17019,20 @@ const ServiceRoute = {
|
|
|
17119
17019
|
if (message.name !== "") {
|
|
17120
17020
|
obj.name = message.name;
|
|
17121
17021
|
}
|
|
17022
|
+
if ((_a = message.routes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
17023
|
+
obj.routes = message.routes.map((e) => Math.round(e));
|
|
17024
|
+
}
|
|
17122
17025
|
return obj;
|
|
17123
17026
|
},
|
|
17124
17027
|
create(base) {
|
|
17125
17028
|
return ServiceRoute.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
17126
17029
|
},
|
|
17127
17030
|
fromPartial(object) {
|
|
17128
|
-
var _a, _b;
|
|
17031
|
+
var _a, _b, _c;
|
|
17129
17032
|
const message = createBaseServiceRoute();
|
|
17130
17033
|
message.type = (_a = object.type) !== null && _a !== void 0 ? _a : 0;
|
|
17131
17034
|
message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
|
|
17035
|
+
message.routes = ((_c = object.routes) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
|
|
17132
17036
|
return message;
|
|
17133
17037
|
},
|
|
17134
17038
|
};
|
|
@@ -17277,7 +17181,7 @@ const ServiceRoutesMap_RoutesEntry = {
|
|
|
17277
17181
|
},
|
|
17278
17182
|
};
|
|
17279
17183
|
function createBaseTimetable() {
|
|
17280
|
-
return { version: "", stopsAdjacency: undefined, routesAdjacency:
|
|
17184
|
+
return { version: "", stopsAdjacency: undefined, routesAdjacency: [], routes: undefined };
|
|
17281
17185
|
}
|
|
17282
17186
|
const Timetable$1 = {
|
|
17283
17187
|
encode(message, writer = new BinaryWriter()) {
|
|
@@ -17287,8 +17191,8 @@ const Timetable$1 = {
|
|
|
17287
17191
|
if (message.stopsAdjacency !== undefined) {
|
|
17288
17192
|
StopsAdjacency.encode(message.stopsAdjacency, writer.uint32(18).fork()).join();
|
|
17289
17193
|
}
|
|
17290
|
-
|
|
17291
|
-
|
|
17194
|
+
for (const v of message.routesAdjacency) {
|
|
17195
|
+
Route$2.encode(v, writer.uint32(26).fork()).join();
|
|
17292
17196
|
}
|
|
17293
17197
|
if (message.routes !== undefined) {
|
|
17294
17198
|
ServiceRoutesMap.encode(message.routes, writer.uint32(34).fork()).join();
|
|
@@ -17320,7 +17224,7 @@ const Timetable$1 = {
|
|
|
17320
17224
|
if (tag !== 26) {
|
|
17321
17225
|
break;
|
|
17322
17226
|
}
|
|
17323
|
-
message.routesAdjacency
|
|
17227
|
+
message.routesAdjacency.push(Route$2.decode(reader, reader.uint32()));
|
|
17324
17228
|
continue;
|
|
17325
17229
|
}
|
|
17326
17230
|
case 4: {
|
|
@@ -17342,11 +17246,14 @@ const Timetable$1 = {
|
|
|
17342
17246
|
return {
|
|
17343
17247
|
version: isSet(object.version) ? globalThis.String(object.version) : "",
|
|
17344
17248
|
stopsAdjacency: isSet(object.stopsAdjacency) ? StopsAdjacency.fromJSON(object.stopsAdjacency) : undefined,
|
|
17345
|
-
routesAdjacency:
|
|
17249
|
+
routesAdjacency: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.routesAdjacency)
|
|
17250
|
+
? object.routesAdjacency.map((e) => Route$2.fromJSON(e))
|
|
17251
|
+
: [],
|
|
17346
17252
|
routes: isSet(object.routes) ? ServiceRoutesMap.fromJSON(object.routes) : undefined,
|
|
17347
17253
|
};
|
|
17348
17254
|
},
|
|
17349
17255
|
toJSON(message) {
|
|
17256
|
+
var _a;
|
|
17350
17257
|
const obj = {};
|
|
17351
17258
|
if (message.version !== "") {
|
|
17352
17259
|
obj.version = message.version;
|
|
@@ -17354,8 +17261,8 @@ const Timetable$1 = {
|
|
|
17354
17261
|
if (message.stopsAdjacency !== undefined) {
|
|
17355
17262
|
obj.stopsAdjacency = StopsAdjacency.toJSON(message.stopsAdjacency);
|
|
17356
17263
|
}
|
|
17357
|
-
if (message.routesAdjacency
|
|
17358
|
-
obj.routesAdjacency =
|
|
17264
|
+
if ((_a = message.routesAdjacency) === null || _a === void 0 ? void 0 : _a.length) {
|
|
17265
|
+
obj.routesAdjacency = message.routesAdjacency.map((e) => Route$2.toJSON(e));
|
|
17359
17266
|
}
|
|
17360
17267
|
if (message.routes !== undefined) {
|
|
17361
17268
|
obj.routes = ServiceRoutesMap.toJSON(message.routes);
|
|
@@ -17366,15 +17273,13 @@ const Timetable$1 = {
|
|
|
17366
17273
|
return Timetable$1.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
17367
17274
|
},
|
|
17368
17275
|
fromPartial(object) {
|
|
17369
|
-
var _a;
|
|
17276
|
+
var _a, _b;
|
|
17370
17277
|
const message = createBaseTimetable();
|
|
17371
17278
|
message.version = (_a = object.version) !== null && _a !== void 0 ? _a : "";
|
|
17372
17279
|
message.stopsAdjacency = (object.stopsAdjacency !== undefined && object.stopsAdjacency !== null)
|
|
17373
17280
|
? StopsAdjacency.fromPartial(object.stopsAdjacency)
|
|
17374
17281
|
: undefined;
|
|
17375
|
-
message.routesAdjacency = (object.routesAdjacency
|
|
17376
|
-
? RoutesAdjacency.fromPartial(object.routesAdjacency)
|
|
17377
|
-
: undefined;
|
|
17282
|
+
message.routesAdjacency = ((_b = object.routesAdjacency) === null || _b === void 0 ? void 0 : _b.map((e) => Route$2.fromPartial(e))) || [];
|
|
17378
17283
|
message.routes = (object.routes !== undefined && object.routes !== null)
|
|
17379
17284
|
? ServiceRoutesMap.fromPartial(object.routes)
|
|
17380
17285
|
: undefined;
|
|
@@ -17938,17 +17843,15 @@ const serializeStopsAdjacency = (stopsAdjacency) => {
|
|
|
17938
17843
|
return protoStopsAdjacency;
|
|
17939
17844
|
};
|
|
17940
17845
|
const serializeRoutesAdjacency = (routesAdjacency) => {
|
|
17941
|
-
const protoRoutesAdjacency =
|
|
17942
|
-
|
|
17943
|
-
};
|
|
17944
|
-
routesAdjacency.forEach((route, key) => {
|
|
17846
|
+
const protoRoutesAdjacency = [];
|
|
17847
|
+
routesAdjacency.forEach((route) => {
|
|
17945
17848
|
const routeData = route.serialize();
|
|
17946
|
-
protoRoutesAdjacency.
|
|
17849
|
+
protoRoutesAdjacency.push({
|
|
17947
17850
|
stopTimes: uint16ArrayToBytes(routeData.stopTimes),
|
|
17948
17851
|
pickUpDropOffTypes: routeData.pickUpDropOffTypes,
|
|
17949
17852
|
stops: uint32ArrayToBytes(routeData.stops),
|
|
17950
17853
|
serviceRouteId: routeData.serviceRouteId,
|
|
17951
|
-
};
|
|
17854
|
+
});
|
|
17952
17855
|
});
|
|
17953
17856
|
return protoRoutesAdjacency;
|
|
17954
17857
|
};
|
|
@@ -17960,6 +17863,7 @@ const serializeServiceRoutesMap = (serviceRoutesMap) => {
|
|
|
17960
17863
|
protoServiceRoutesMap.routes[key] = {
|
|
17961
17864
|
type: serializeRouteType(value.type),
|
|
17962
17865
|
name: value.name,
|
|
17866
|
+
routes: value.routes,
|
|
17963
17867
|
};
|
|
17964
17868
|
});
|
|
17965
17869
|
return protoServiceRoutesMap;
|
|
@@ -17978,10 +17882,10 @@ const deserializeStopsAdjacency = (protoStopsAdjacency) => {
|
|
|
17978
17882
|
return stopsAdjacency;
|
|
17979
17883
|
};
|
|
17980
17884
|
const deserializeRoutesAdjacency = (protoRoutesAdjacency) => {
|
|
17981
|
-
const routesAdjacency =
|
|
17982
|
-
|
|
17885
|
+
const routesAdjacency = [];
|
|
17886
|
+
protoRoutesAdjacency.forEach((value) => {
|
|
17983
17887
|
const stops = bytesToUint32Array(value.stops);
|
|
17984
|
-
routesAdjacency.
|
|
17888
|
+
routesAdjacency.push(new Route$1(bytesToUint16Array(value.stopTimes), value.pickUpDropOffTypes, stops, value.serviceRouteId));
|
|
17985
17889
|
});
|
|
17986
17890
|
return routesAdjacency;
|
|
17987
17891
|
};
|
|
@@ -17991,6 +17895,7 @@ const deserializeServiceRoutesMap = (protoServiceRoutesMap) => {
|
|
|
17991
17895
|
serviceRoutesMap.set(key, {
|
|
17992
17896
|
type: parseRouteType(value.type),
|
|
17993
17897
|
name: value.name,
|
|
17898
|
+
routes: value.routes,
|
|
17994
17899
|
});
|
|
17995
17900
|
});
|
|
17996
17901
|
return serviceRoutesMap;
|
|
@@ -18085,7 +17990,7 @@ const ALL_TRANSPORT_MODES = new Set([
|
|
|
18085
17990
|
'TROLLEYBUS',
|
|
18086
17991
|
'MONORAIL',
|
|
18087
17992
|
]);
|
|
18088
|
-
const CURRENT_VERSION = '0.0.
|
|
17993
|
+
const CURRENT_VERSION = '0.0.5';
|
|
18089
17994
|
/**
|
|
18090
17995
|
* The internal transit timetable format.
|
|
18091
17996
|
*/
|
|
@@ -18125,9 +18030,7 @@ class Timetable {
|
|
|
18125
18030
|
}
|
|
18126
18031
|
return new Timetable(
|
|
18127
18032
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18128
|
-
deserializeStopsAdjacency(protoTimetable.stopsAdjacency), deserializeRoutesAdjacency(
|
|
18129
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18130
|
-
protoTimetable.routesAdjacency),
|
|
18033
|
+
deserializeStopsAdjacency(protoTimetable.stopsAdjacency), deserializeRoutesAdjacency(protoTimetable.routesAdjacency),
|
|
18131
18034
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18132
18035
|
deserializeServiceRoutesMap(protoTimetable.routes));
|
|
18133
18036
|
}
|
|
@@ -18139,7 +18042,7 @@ class Timetable {
|
|
|
18139
18042
|
* or undefined if no such route exists.
|
|
18140
18043
|
*/
|
|
18141
18044
|
getRoute(routeId) {
|
|
18142
|
-
return this.routesAdjacency
|
|
18045
|
+
return this.routesAdjacency[routeId];
|
|
18143
18046
|
}
|
|
18144
18047
|
/**
|
|
18145
18048
|
* Retrieves all transfer options available at the specified stop.
|
|
@@ -18159,9 +18062,14 @@ class Timetable {
|
|
|
18159
18062
|
* @param route - The route for which the service route is to be retrieved.
|
|
18160
18063
|
* @returns The service route corresponding to the provided route.
|
|
18161
18064
|
*/
|
|
18162
|
-
|
|
18163
|
-
|
|
18164
|
-
|
|
18065
|
+
getServiceRouteInfo(route) {
|
|
18066
|
+
const serviceRoute = this.routes.get(route.serviceRoute());
|
|
18067
|
+
if (!serviceRoute) {
|
|
18068
|
+
throw new Error(`Service route not found for route ID: ${route.serviceRoute()}`);
|
|
18069
|
+
}
|
|
18070
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18071
|
+
const { routes } = serviceRoute, serviceRouteInfo = __rest(serviceRoute, ["routes"]);
|
|
18072
|
+
return serviceRouteInfo;
|
|
18165
18073
|
}
|
|
18166
18074
|
/**
|
|
18167
18075
|
* Finds all routes passing through a stop.
|
|
@@ -18176,7 +18084,7 @@ class Timetable {
|
|
|
18176
18084
|
}
|
|
18177
18085
|
const routes = [];
|
|
18178
18086
|
for (const routeId of stopData.routes) {
|
|
18179
|
-
const route = this.routesAdjacency
|
|
18087
|
+
const route = this.routesAdjacency[routeId];
|
|
18180
18088
|
if (route) {
|
|
18181
18089
|
routes.push(route);
|
|
18182
18090
|
}
|
|
@@ -18196,7 +18104,7 @@ class Timetable {
|
|
|
18196
18104
|
const reachableRoutes = new Map();
|
|
18197
18105
|
for (const originStop of fromStops) {
|
|
18198
18106
|
const validRoutes = this.routesPassingThrough(originStop).filter((route) => {
|
|
18199
|
-
const serviceRoute = this.
|
|
18107
|
+
const serviceRoute = this.getServiceRouteInfo(route);
|
|
18200
18108
|
return transportModes.has(serviceRoute.type);
|
|
18201
18109
|
});
|
|
18202
18110
|
for (const route of validRoutes) {
|
|
@@ -20207,6 +20115,7 @@ const parseRoutes = (routesStream_1, ...args_1) => __awaiter(void 0, [routesStre
|
|
|
20207
20115
|
routes.set(line.route_id, {
|
|
20208
20116
|
name: line.route_short_name,
|
|
20209
20117
|
type: routeType,
|
|
20118
|
+
routes: [],
|
|
20210
20119
|
});
|
|
20211
20120
|
}
|
|
20212
20121
|
}
|
|
@@ -20601,10 +20510,10 @@ const finalizeRouteFromBuilder = (builder) => {
|
|
|
20601
20510
|
*
|
|
20602
20511
|
* @param tripsStream The readable stream containing the trips data.
|
|
20603
20512
|
* @param serviceIds A mapping of service IDs to corresponding route IDs.
|
|
20604
|
-
* @param
|
|
20513
|
+
* @param serviceRoutes A mapping of route IDs to route details.
|
|
20605
20514
|
* @returns A mapping of trip IDs to corresponding route IDs.
|
|
20606
20515
|
*/
|
|
20607
|
-
const parseTrips = (tripsStream, serviceIds,
|
|
20516
|
+
const parseTrips = (tripsStream, serviceIds, serviceRoutes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20608
20517
|
var _a, e_1, _b, _c;
|
|
20609
20518
|
const trips = new Map();
|
|
20610
20519
|
try {
|
|
@@ -20617,7 +20526,7 @@ const parseTrips = (tripsStream, serviceIds, routeIds) => __awaiter(void 0, void
|
|
|
20617
20526
|
// The trip doesn't correspond to an active service
|
|
20618
20527
|
continue;
|
|
20619
20528
|
}
|
|
20620
|
-
if (!
|
|
20529
|
+
if (!serviceRoutes.get(line.route_id)) {
|
|
20621
20530
|
// The trip doesn't correspond to a supported route
|
|
20622
20531
|
continue;
|
|
20623
20532
|
}
|
|
@@ -20633,21 +20542,22 @@ const parseTrips = (tripsStream, serviceIds, routeIds) => __awaiter(void 0, void
|
|
|
20633
20542
|
}
|
|
20634
20543
|
return trips;
|
|
20635
20544
|
});
|
|
20636
|
-
const buildStopsAdjacencyStructure = (validStops, routes, transfersMap) => {
|
|
20637
|
-
var _a;
|
|
20545
|
+
const buildStopsAdjacencyStructure = (validStops, serviceRoutes, routes, transfersMap) => {
|
|
20638
20546
|
const stopsAdjacency = new Map();
|
|
20639
|
-
|
|
20640
|
-
|
|
20641
|
-
if (!route) {
|
|
20642
|
-
throw new Error(`Route ${routeId} not found`);
|
|
20643
|
-
}
|
|
20547
|
+
routes.forEach((route, index) => {
|
|
20548
|
+
var _a;
|
|
20644
20549
|
for (const stop of route.stopsIterator()) {
|
|
20645
20550
|
if (!stopsAdjacency.get(stop) && validStops.has(stop)) {
|
|
20646
20551
|
stopsAdjacency.set(stop, { routes: [], transfers: [] });
|
|
20647
20552
|
}
|
|
20648
|
-
(_a = stopsAdjacency.get(stop)) === null || _a === void 0 ? void 0 : _a.routes.push(
|
|
20553
|
+
(_a = stopsAdjacency.get(stop)) === null || _a === void 0 ? void 0 : _a.routes.push(index);
|
|
20649
20554
|
}
|
|
20650
|
-
|
|
20555
|
+
const serviceRoute = serviceRoutes.get(route.serviceRoute());
|
|
20556
|
+
if (!serviceRoute) {
|
|
20557
|
+
throw new Error(`Service route ${route.serviceRoute()} not found for route ${index}.`);
|
|
20558
|
+
}
|
|
20559
|
+
serviceRoute.routes.push(index);
|
|
20560
|
+
});
|
|
20651
20561
|
for (const [stop, transfers] of transfersMap) {
|
|
20652
20562
|
const s = stopsAdjacency.get(stop);
|
|
20653
20563
|
if (s) {
|
|
@@ -20779,10 +20689,10 @@ const parseStopTimes = (stopTimesStream, stopsMap, validTripIds, validStopIds) =
|
|
|
20779
20689
|
if (currentTripId) {
|
|
20780
20690
|
addTrip(currentTripId);
|
|
20781
20691
|
}
|
|
20782
|
-
const routesAdjacency =
|
|
20783
|
-
for (const [
|
|
20692
|
+
const routesAdjacency = [];
|
|
20693
|
+
for (const [, routeBuilder] of routeBuilders) {
|
|
20784
20694
|
const routeData = finalizeRouteFromBuilder(routeBuilder);
|
|
20785
|
-
routesAdjacency.
|
|
20695
|
+
routesAdjacency.push(new Route$1(routeData.stopTimes, routeData.pickUpDropOffTypes, routeData.stops, routeData.serviceRouteId));
|
|
20786
20696
|
}
|
|
20787
20697
|
return routesAdjacency;
|
|
20788
20698
|
});
|
|
@@ -20877,9 +20787,9 @@ class GtfsParser {
|
|
|
20877
20787
|
const stopTimesStart = performance.now();
|
|
20878
20788
|
const stopTimesStream = yield zip.stream(STOP_TIMES_FILE);
|
|
20879
20789
|
const routesAdjacency = yield parseStopTimes(stopTimesStream, parsedStops, trips, validStopIds);
|
|
20880
|
-
const stopsAdjacency = buildStopsAdjacencyStructure(validStopIds, routesAdjacency, transfers);
|
|
20790
|
+
const stopsAdjacency = buildStopsAdjacencyStructure(validStopIds, validGtfsRoutes, routesAdjacency, transfers);
|
|
20881
20791
|
const stopTimesEnd = performance.now();
|
|
20882
|
-
log.info(`${routesAdjacency.
|
|
20792
|
+
log.info(`${routesAdjacency.length} valid unique routes. (${(stopTimesEnd - stopTimesStart).toFixed(2)}ms)`);
|
|
20883
20793
|
log.info(`Removing unused stops.`);
|
|
20884
20794
|
const indexStopsStart = performance.now();
|
|
20885
20795
|
const stops = indexStops(parsedStops, validStopIds);
|
|
@@ -21454,7 +21364,7 @@ class Router {
|
|
|
21454
21364
|
to: this.stopsIndex.findStopById(currentStop),
|
|
21455
21365
|
departureTime: bestHopOnDepartureTime,
|
|
21456
21366
|
arrivalTime: currentArrivalTime,
|
|
21457
|
-
route: this.timetable.
|
|
21367
|
+
route: this.timetable.getServiceRouteInfo(route),
|
|
21458
21368
|
},
|
|
21459
21369
|
});
|
|
21460
21370
|
earliestArrivals.set(currentStop, {
|