gtfs 4.18.3 → 4.18.4
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/dist/bin/gtfs-export.js +31 -3
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +377 -72
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +133 -18
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +499 -91
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,70 @@ import { Options } from 'csv-parse';
|
|
|
2
2
|
import Database$1, { Database } from 'better-sqlite3';
|
|
3
3
|
import { FeatureCollection } from 'geojson';
|
|
4
4
|
|
|
5
|
+
declare enum GtfsErrorCategory {
|
|
6
|
+
CONFIG = "config",
|
|
7
|
+
DOWNLOAD = "download",
|
|
8
|
+
ZIP = "zip",
|
|
9
|
+
VALIDATION = "validation",
|
|
10
|
+
DATABASE = "database",
|
|
11
|
+
PARSE = "parse",
|
|
12
|
+
QUERY = "query",
|
|
13
|
+
INTERNAL = "internal"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error codes are a public API contract and must remain stable across
|
|
17
|
+
* minor/patch releases.
|
|
18
|
+
*/
|
|
19
|
+
declare enum GtfsErrorCode {
|
|
20
|
+
GTFS_DOWNLOAD_HTTP = "GTFS_DOWNLOAD_HTTP",
|
|
21
|
+
GTFS_DOWNLOAD_FAILED = "GTFS_DOWNLOAD_FAILED",
|
|
22
|
+
GTFS_ZIP_INVALID = "GTFS_ZIP_INVALID",
|
|
23
|
+
GTFS_REQUIRED_FIELD_MISSING = "GTFS_REQUIRED_FIELD_MISSING",
|
|
24
|
+
GTFS_INVALID_DATE = "GTFS_INVALID_DATE",
|
|
25
|
+
GTFS_CONFIG_INVALID = "GTFS_CONFIG_INVALID",
|
|
26
|
+
DB_OPEN_FAILED = "DB_OPEN_FAILED",
|
|
27
|
+
GTFS_DB_OPERATION_FAILED = "GTFS_DB_OPERATION_FAILED",
|
|
28
|
+
GTFS_JSON_INVALID = "GTFS_JSON_INVALID",
|
|
29
|
+
GTFS_UNSUPPORTED_FILE_TYPE = "GTFS_UNSUPPORTED_FILE_TYPE",
|
|
30
|
+
GTFS_CSV_PARSE_FAILED = "GTFS_CSV_PARSE_FAILED",
|
|
31
|
+
GTFS_QUERY_INVALID = "GTFS_QUERY_INVALID"
|
|
32
|
+
}
|
|
33
|
+
declare enum GtfsWarningCode {
|
|
34
|
+
GTFS_DUPLICATE_PRIMARY_KEY = "GTFS_DUPLICATE_PRIMARY_KEY"
|
|
35
|
+
}
|
|
36
|
+
interface GtfsWarning {
|
|
37
|
+
code: GtfsWarningCode;
|
|
38
|
+
message: string;
|
|
39
|
+
details?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
interface ImportReport {
|
|
42
|
+
errors: GtfsError[];
|
|
43
|
+
warnings: GtfsWarning[];
|
|
44
|
+
errorCountsByCode: Partial<Record<GtfsErrorCode, number>>;
|
|
45
|
+
warningCountsByCode: Partial<Record<GtfsWarningCode, number>>;
|
|
46
|
+
}
|
|
47
|
+
interface GtfsErrorOptions {
|
|
48
|
+
code: GtfsErrorCode;
|
|
49
|
+
category: GtfsErrorCategory;
|
|
50
|
+
isOperational?: boolean;
|
|
51
|
+
statusCode?: number;
|
|
52
|
+
details?: Record<string, unknown>;
|
|
53
|
+
cause?: unknown;
|
|
54
|
+
}
|
|
55
|
+
declare class GtfsError extends Error {
|
|
56
|
+
code: GtfsErrorCode;
|
|
57
|
+
category: GtfsErrorCategory;
|
|
58
|
+
isOperational: boolean;
|
|
59
|
+
statusCode?: number;
|
|
60
|
+
details?: Record<string, unknown>;
|
|
61
|
+
constructor(message: string, options: GtfsErrorOptions);
|
|
62
|
+
}
|
|
63
|
+
declare function isGtfsError(error: unknown): error is GtfsError;
|
|
64
|
+
declare function isGtfsValidationError(error: unknown): error is GtfsError;
|
|
65
|
+
declare function formatGtfsError(error: unknown, options?: {
|
|
66
|
+
verbosity: 'user' | 'developer';
|
|
67
|
+
}): string;
|
|
68
|
+
|
|
5
69
|
type UnixTimestamp = number;
|
|
6
70
|
type TableNames = 'agency' | 'stops' | 'routes' | 'trips' | 'stop_times' | 'calendar' | 'calendar_dates' | 'fare_attributes' | 'fare_rules' | 'timeframes' | 'rider_categories' | 'fare_media' | 'fare_products' | 'fare_leg_rules' | 'fare_leg_join_rules' | 'fare_transfer_rules' | 'areas' | 'stop_areas' | 'networks' | 'route_networks' | 'shapes' | 'frequencies' | 'transfers' | 'pathways' | 'levels' | 'location_groups' | 'location_group_stops' | 'locations' | 'booking_rules' | 'translations' | 'feed_info' | 'attributions';
|
|
7
71
|
interface BaseConfigAgency {
|
|
@@ -113,6 +177,13 @@ interface Config {
|
|
|
113
177
|
* @defaultValue false
|
|
114
178
|
*/
|
|
115
179
|
ignoreErrors?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Whether or not to return a structured import report from `importGtfs`.
|
|
182
|
+
* Useful when `ignoreErrors` is enabled and you want to inspect collected errors/warnings.
|
|
183
|
+
*
|
|
184
|
+
* @defaultValue false
|
|
185
|
+
*/
|
|
186
|
+
includeImportReport?: boolean;
|
|
116
187
|
/**
|
|
117
188
|
* An array of GTFS files to be imported, and which files to exclude.
|
|
118
189
|
*/
|
|
@@ -733,6 +804,7 @@ interface StopAttribute {
|
|
|
733
804
|
*
|
|
734
805
|
* @param initialConfig
|
|
735
806
|
*/
|
|
807
|
+
declare function importGtfs(initialConfig: Config): Promise<ImportReport>;
|
|
736
808
|
declare function importGtfs(initialConfig: Config): Promise<void>;
|
|
737
809
|
|
|
738
810
|
/**
|
|
@@ -905,4 +977,4 @@ declare function getRunEvents<Fields extends keyof RunEvent>(query?: SqlWhere, f
|
|
|
905
977
|
|
|
906
978
|
declare function getRunsPieces<Fields extends keyof RunPiece>(query?: SqlWhere, fields?: Fields[], orderBy?: SqlOrderBy, options?: QueryOptions): QueryResult<RunPiece, Fields>[];
|
|
907
979
|
|
|
908
|
-
export { type Agency, type Area, type Attribution, type BoardAlight, type BookingRule, type Calendar, type CalendarAttribute, type CalendarDate, type Config, type ConfigAgency, type Deadhead, type DeadheadTime, type Direction, type FareAttribute, type FareLegRule, type FareMedia, type FareProduct, type FareRule, type FareTransferRule, type FeedInfo, type Frequency, type JoinOptions, type Level, type Location, type LocationGroup, type LocationGroupStop, type Model, type ModelColumn, type Network, type OpsLocation, type Pathway, type QueryOptions, type QueryResult, type RideFeedInfo, type RiderCategory, type RiderTrip, type Ridership, type Route, type RouteAttribute, type RouteNetwork, type RunEvent, type RunPiece, type ServiceAlert, type Shape, type SqlOrderBy, type SqlValue, type SqlWhere, type Stop, type StopArea, type StopAttribute, type StopTime, type StopTimeUpdate, type TableNames, type Timeframe, type Timetable, type TimetableNote, type TimetableNotesReference, type TimetablePage, type TimetableStopOrder, type Transfer, type Translation, type Trip, type TripCapacity, type TripUpdate, type TripsDatedVehicleJourney, type UnixTimestamp, type VehiclePosition, advancedQuery, closeDb, deleteDb, exportGtfs, generateFolderName, getAgencies, getAreas, getAttributions, getBoardAlights, getBookingRules, getCalendarAttributes, getCalendarDates, getCalendars, getDeadheadTimes, getDeadheads, getDirections, getFareAttributes, getFareLegRules, getFareMedia, getFareProducts, getFareRules, getFareTransferRules, getFeedInfo, getFrequencies, getLevels, getLocationGroupStops, getLocationGroups, getLocations, getNetworks, getOpsLocations, getPathways, getRideFeedInfo, getRiderCategories, getRiderTrips, getRidership, getRouteAttributes, getRouteNetworks, getRoutes, getRunEvents, getRunsPieces, getServiceAlerts, getServiceIdsByDate, getShapes, getShapesAsGeoJSON, getStopAreas, getStopAttributes, getStopTimeUpdates, getStops, getStopsAsGeoJSON, getStoptimes, getTimeframes, getTimetableNotes, getTimetableNotesReferences, getTimetablePages, getTimetableStopOrders, getTimetables, getTransfers, getTranslations, getTripCapacities, getTripUpdates, getTrips, getTripsDatedVehicleJourneys, getVehiclePositions, importGtfs, openDb, prepDirectory, untildify, unzip, updateGtfsRealtime };
|
|
980
|
+
export { type Agency, type Area, type Attribution, type BoardAlight, type BookingRule, type Calendar, type CalendarAttribute, type CalendarDate, type Config, type ConfigAgency, type Deadhead, type DeadheadTime, type Direction, type FareAttribute, type FareLegRule, type FareMedia, type FareProduct, type FareRule, type FareTransferRule, type FeedInfo, type Frequency, GtfsError, GtfsErrorCategory, GtfsErrorCode, type GtfsWarning, GtfsWarningCode, type ImportReport, type JoinOptions, type Level, type Location, type LocationGroup, type LocationGroupStop, type Model, type ModelColumn, type Network, type OpsLocation, type Pathway, type QueryOptions, type QueryResult, type RideFeedInfo, type RiderCategory, type RiderTrip, type Ridership, type Route, type RouteAttribute, type RouteNetwork, type RunEvent, type RunPiece, type ServiceAlert, type Shape, type SqlOrderBy, type SqlValue, type SqlWhere, type Stop, type StopArea, type StopAttribute, type StopTime, type StopTimeUpdate, type TableNames, type Timeframe, type Timetable, type TimetableNote, type TimetableNotesReference, type TimetablePage, type TimetableStopOrder, type Transfer, type Translation, type Trip, type TripCapacity, type TripUpdate, type TripsDatedVehicleJourney, type UnixTimestamp, type VehiclePosition, advancedQuery, closeDb, deleteDb, exportGtfs, formatGtfsError, generateFolderName, getAgencies, getAreas, getAttributions, getBoardAlights, getBookingRules, getCalendarAttributes, getCalendarDates, getCalendars, getDeadheadTimes, getDeadheads, getDirections, getFareAttributes, getFareLegRules, getFareMedia, getFareProducts, getFareRules, getFareTransferRules, getFeedInfo, getFrequencies, getLevels, getLocationGroupStops, getLocationGroups, getLocations, getNetworks, getOpsLocations, getPathways, getRideFeedInfo, getRiderCategories, getRiderTrips, getRidership, getRouteAttributes, getRouteNetworks, getRoutes, getRunEvents, getRunsPieces, getServiceAlerts, getServiceIdsByDate, getShapes, getShapesAsGeoJSON, getStopAreas, getStopAttributes, getStopTimeUpdates, getStops, getStopsAsGeoJSON, getStoptimes, getTimeframes, getTimetableNotes, getTimetableNotesReferences, getTimetablePages, getTimetableStopOrders, getTimetables, getTransfers, getTranslations, getTripCapacities, getTripUpdates, getTrips, getTripsDatedVehicleJourneys, getVehiclePositions, importGtfs, isGtfsError, isGtfsValidationError, openDb, prepDirectory, untildify, unzip, updateGtfsRealtime };
|