import { CallingPoint, TimetableLeg } from "../TimetableLeg"; import { Stop } from "../Journey"; import { LocalDate } from "js-joda"; import { CalendarDate, Trip } from "../Trip"; /** * Provide access to TimetableLeg's using an in-memory index. */ export declare class InMemoryTimetableLegRepository { private readonly index; constructor(index: TripIndex); /** * Use the index of timetable legs to find any leg between the origin and destination that runs on the given date */ getLegs(origin: Stop, destination: Stop, date: LocalDate): TimetableLeg[]; } /** * MySQL counts the epoch as 0000-01-01 and JavaScript uses 1970-01-01, this is the number of days between them */ export declare const DAYS_TO_EPOCH = 719528; /** * Access to the timetable legs in the GTFS database */ export declare class TimetableLegRepository { private readonly db; constructor(db: any); /** * Load all trips from the database into an in-memory repository */ getInMemoryRepository(): Promise; /** * Load all the calendars and index them by service_id */ private getCalendars; /** * Load all calling points and index them by trip_id */ private getCallingPoints; } /** * Index of serviceId -> CalendarDate */ export interface CalendarIndex { [serviceId: number]: CalendarDate; } /** * Calling points index by their tripId */ export interface CallingPointIndex { [tripId: number]: CallingPoint[]; } /** * Index of Trips that travel between origin and destination. */ export interface TripIndex { [origin: string]: { [destination: string]: Trip[]; }; }