minotor 5.0.1 → 7.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 +8 -3
- package/dist/cli.mjs +282 -654
- package/dist/cli.mjs.map +1 -1
- package/dist/gtfs/parser.d.ts +4 -10
- package/dist/gtfs/routes.d.ts +16 -2
- package/dist/gtfs/stops.d.ts +3 -13
- package/dist/gtfs/transfers.d.ts +2 -2
- package/dist/gtfs/trips.d.ts +12 -8
- package/dist/parser.cjs.js +257 -644
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.esm.js +257 -644
- 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/io.d.ts +3 -3
- package/dist/stops/proto/stops.d.ts +1 -8
- package/dist/stops/stops.d.ts +0 -4
- package/dist/stops/stopsIndex.d.ts +3 -3
- package/dist/timetable/io.d.ts +6 -6
- package/dist/timetable/proto/timetable.d.ts +5 -27
- package/dist/timetable/route.d.ts +2 -11
- package/dist/timetable/timetable.d.ts +17 -9
- package/package.json +1 -1
- package/src/__e2e__/timetable/stops.bin +2 -2
- package/src/__e2e__/timetable/timetable.bin +2 -2
- package/src/cli/minotor.ts +3 -4
- package/src/gtfs/__tests__/parser.test.ts +5 -6
- package/src/gtfs/__tests__/routes.test.ts +0 -3
- package/src/gtfs/__tests__/stops.test.ts +1 -124
- package/src/gtfs/__tests__/transfers.test.ts +7 -7
- package/src/gtfs/__tests__/trips.test.ts +74 -45
- package/src/gtfs/parser.ts +32 -49
- package/src/gtfs/routes.ts +43 -5
- package/src/gtfs/stops.ts +2 -44
- package/src/gtfs/transfers.ts +2 -2
- package/src/gtfs/trips.ts +66 -43
- package/src/routing/__tests__/result.test.ts +48 -48
- package/src/routing/__tests__/router.test.ts +279 -363
- package/src/routing/router.ts +22 -8
- package/src/stops/__tests__/io.test.ts +25 -31
- package/src/stops/__tests__/stopFinder.test.ts +82 -103
- package/src/stops/io.ts +8 -17
- package/src/stops/proto/stops.proto +3 -3
- package/src/stops/proto/stops.ts +16 -120
- package/src/stops/stops.ts +0 -4
- package/src/stops/stopsIndex.ts +37 -41
- package/src/timetable/__tests__/io.test.ts +44 -54
- package/src/timetable/__tests__/route.test.ts +10 -29
- package/src/timetable/__tests__/timetable.test.ts +29 -37
- package/src/timetable/io.ts +66 -74
- package/src/timetable/proto/timetable.proto +7 -14
- package/src/timetable/proto/timetable.ts +49 -391
- package/src/timetable/route.ts +2 -32
- package/src/timetable/timetable.ts +51 -31
package/dist/gtfs/parser.d.ts
CHANGED
|
@@ -12,20 +12,14 @@ export declare class GtfsParser {
|
|
|
12
12
|
* Parses a GTFS feed to extract all the data relevant to a given day in a transit-planner friendly format.
|
|
13
13
|
*
|
|
14
14
|
* @param date The active date.
|
|
15
|
-
* @
|
|
16
|
-
* @param gtfsProfile The GTFS profile configuration.
|
|
17
|
-
* @returns An object containing the timetable and stops map.
|
|
15
|
+
* @returns The parsed timetable.
|
|
18
16
|
*/
|
|
19
|
-
|
|
20
|
-
timetable: Timetable;
|
|
21
|
-
stopsIndex: StopsIndex;
|
|
22
|
-
}>;
|
|
17
|
+
parseTimetable(date: Date): Promise<Timetable>;
|
|
23
18
|
/**
|
|
24
19
|
* Parses a GTFS feed to extract all stops.
|
|
25
20
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
28
|
-
* @returns An object containing the timetable and stops map.
|
|
21
|
+
* @param activeStops The set of active stop IDs to include in the index.
|
|
22
|
+
* @returns An index of stops.
|
|
29
23
|
*/
|
|
30
24
|
parseStops(): Promise<StopsIndex>;
|
|
31
25
|
}
|
package/dist/gtfs/routes.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RouteType } from '../router.js';
|
|
2
|
+
import { ServiceRoute, ServiceRouteId } from '../timetable/timetable.js';
|
|
2
3
|
import { GtfsProfile } from './parser.js';
|
|
3
4
|
export type GtfsRouteType = number;
|
|
5
|
+
export type GtfsRouteId = string;
|
|
6
|
+
export type GtfsRoutesMap = Map<GtfsRouteId, {
|
|
7
|
+
name: string;
|
|
8
|
+
type: RouteType;
|
|
9
|
+
}>;
|
|
4
10
|
/**
|
|
5
11
|
* Parses a GTFS routes.txt file and returns a map of all the valid routes.
|
|
6
12
|
*
|
|
@@ -8,4 +14,12 @@ export type GtfsRouteType = number;
|
|
|
8
14
|
* @param profile A configuration object defining the specificities of the GTFS feed.
|
|
9
15
|
* @returns A map of all the valid routes.
|
|
10
16
|
*/
|
|
11
|
-
export declare const parseRoutes: (routesStream: NodeJS.ReadableStream, profile?: GtfsProfile) => Promise<
|
|
17
|
+
export declare const parseRoutes: (routesStream: NodeJS.ReadableStream, profile?: GtfsProfile) => Promise<GtfsRoutesMap>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an array of ServiceRoute objects by combining GTFS route data with service route mappings.
|
|
20
|
+
*
|
|
21
|
+
* @param gtfsRoutesMap A map containing GTFS route information indexed by route ID
|
|
22
|
+
* @param serviceRoutesMap A map linking GTFS route IDs to service route IDs
|
|
23
|
+
* @returns An array of ServiceRoute objects with route information
|
|
24
|
+
*/
|
|
25
|
+
export declare const indexRoutes: (gtfsRoutesMap: GtfsRoutesMap, serviceRoutesMap: Map<GtfsRouteId, ServiceRouteId>) => ServiceRoute[];
|
package/dist/gtfs/stops.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Latitude, Longitude, Platform, SourceStopId, Stop
|
|
1
|
+
import { Latitude, Longitude, Platform, SourceStopId, Stop } from '../stops/stops.js';
|
|
2
2
|
export type GtfsLocationType = 0 | 1 | 2 | 3 | 4;
|
|
3
3
|
export type StopEntry = {
|
|
4
4
|
stop_id: SourceStopId;
|
|
@@ -12,22 +12,12 @@ export type StopEntry = {
|
|
|
12
12
|
type ParsedStop = Stop & {
|
|
13
13
|
parentSourceId?: SourceStopId;
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type GtfsStopsMap = Map<SourceStopId, ParsedStop>;
|
|
16
16
|
/**
|
|
17
17
|
* Parses the stops.txt file from a GTFS feed.
|
|
18
18
|
*
|
|
19
19
|
* @param stopsStream The readable stream containing the stops data.
|
|
20
20
|
* @return A mapping of stop IDs to corresponding stop details.
|
|
21
21
|
*/
|
|
22
|
-
export declare const parseStops: (stopsStream: NodeJS.ReadableStream) => Promise<
|
|
23
|
-
/**
|
|
24
|
-
* Builds the final stop map indexed by internal IDs.
|
|
25
|
-
* Excludes all stops that do not have at least one valid stopId
|
|
26
|
-
* as a child, a parent, or being valid itself.
|
|
27
|
-
*
|
|
28
|
-
* @param parsedStops - The map of parsed stops.
|
|
29
|
-
* @param validStops - A set of valid stop IDs.
|
|
30
|
-
* @returns A map of stops indexed by internal IDs.
|
|
31
|
-
*/
|
|
32
|
-
export declare const indexStops: (parsedStops: ParsedStopsMap, validStops?: Set<StopId>) => StopsMap;
|
|
22
|
+
export declare const parseStops: (stopsStream: NodeJS.ReadableStream) => Promise<GtfsStopsMap>;
|
|
33
23
|
export {};
|
package/dist/gtfs/transfers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SourceStopId, StopId } from '../stops/stops.js';
|
|
2
2
|
import { ServiceRouteId, Transfer } from '../timetable/timetable.js';
|
|
3
|
-
import {
|
|
3
|
+
import { GtfsStopsMap } from './stops.js';
|
|
4
4
|
import { TripId } from './trips.js';
|
|
5
5
|
export type GtfsTransferType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
6
6
|
export type TransfersMap = Map<StopId, Transfer[]>;
|
|
@@ -20,4 +20,4 @@ export type TransferEntry = {
|
|
|
20
20
|
* @param stopsStream The readable stream containing the stops data.
|
|
21
21
|
* @return A mapping of stop IDs to corresponding stop details.
|
|
22
22
|
*/
|
|
23
|
-
export declare const parseTransfers: (transfersStream: NodeJS.ReadableStream, stopsMap:
|
|
23
|
+
export declare const parseTransfers: (transfersStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap) => Promise<TransfersMap>;
|
package/dist/gtfs/trips.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { StopId } from '../stops/stops.js';
|
|
2
2
|
import { Route } from '../timetable/route.js';
|
|
3
|
-
import {
|
|
3
|
+
import { ServiceRoute, ServiceRouteId, StopAdjacency } from '../timetable/timetable.js';
|
|
4
|
+
import { GtfsRouteId, GtfsRoutesMap } from './routes.js';
|
|
4
5
|
import { ServiceIds } from './services.js';
|
|
5
|
-
import {
|
|
6
|
+
import { GtfsStopsMap } from './stops.js';
|
|
6
7
|
import { TransfersMap } from './transfers.js';
|
|
7
8
|
export type TripId = string;
|
|
8
|
-
export type TripIdsMap = Map<TripId,
|
|
9
|
+
export type TripIdsMap = Map<TripId, GtfsRouteId>;
|
|
9
10
|
export type GtfsPickupDropOffType = '' | '0' | '1' | '2' | '3';
|
|
10
11
|
export type SerializedPickUpDropOffType = 0 | 1 | 2 | 3;
|
|
11
12
|
/**
|
|
@@ -21,15 +22,18 @@ export declare const encodePickUpDropOffTypes: (pickUpTypes: SerializedPickUpDro
|
|
|
21
22
|
* @param serviceRoutes A mapping of route IDs to route details.
|
|
22
23
|
* @returns A mapping of trip IDs to corresponding route IDs.
|
|
23
24
|
*/
|
|
24
|
-
export declare const parseTrips: (tripsStream: NodeJS.ReadableStream, serviceIds: ServiceIds,
|
|
25
|
-
export declare const buildStopsAdjacencyStructure: (
|
|
25
|
+
export declare const parseTrips: (tripsStream: NodeJS.ReadableStream, serviceIds: ServiceIds, validGtfsRoutes: GtfsRoutesMap) => Promise<TripIdsMap>;
|
|
26
|
+
export declare const buildStopsAdjacencyStructure: (serviceRoutes: ServiceRoute[], routes: Route[], transfersMap: TransfersMap, nbStops: number, activeStops: Set<StopId>) => StopAdjacency[];
|
|
26
27
|
/**
|
|
27
28
|
* Parses the stop_times.txt data from a GTFS feed.
|
|
28
29
|
*
|
|
29
30
|
* @param stopTimesStream The readable stream containing the stop times data.
|
|
30
31
|
* @param stopsMap A map of parsed stops from the GTFS feed.
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
32
|
+
* @param activeTripIds A map of valid trip IDs to corresponding route IDs.
|
|
33
|
+
* @param activeStopIds A set of valid stop IDs.
|
|
33
34
|
* @returns A mapping of route IDs to route details. The routes returned correspond to the set of trips from GTFS that share the same stop list.
|
|
34
35
|
*/
|
|
35
|
-
export declare const parseStopTimes: (stopTimesStream: NodeJS.ReadableStream, stopsMap:
|
|
36
|
+
export declare const parseStopTimes: (stopTimesStream: NodeJS.ReadableStream, stopsMap: GtfsStopsMap, activeTripIds: TripIdsMap, activeStopIds: Set<StopId>) => Promise<{
|
|
37
|
+
routes: Route[];
|
|
38
|
+
serviceRoutesMap: Map<GtfsRouteId, ServiceRouteId>;
|
|
39
|
+
}>;
|