gtfs 4.15.12 → 4.15.13

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/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Options } from 'csv-parse';
2
2
  import Database$1, { Database } from 'better-sqlite3';
3
3
  import { FeatureCollection } from 'geojson';
4
4
 
5
+ type UnixTimestamp = number;
5
6
  interface ConfigAgency {
6
7
  exclude?: string[];
7
8
  url?: string;
@@ -103,10 +104,10 @@ interface BookingRule {
103
104
  prior_notice_duration_max?: number;
104
105
  prior_notice_last_day?: number;
105
106
  prior_notice_last_time?: string;
106
- prior_notice_last_timestamp?: number;
107
+ prior_notice_last_timestamp?: UnixTimestamp;
107
108
  prior_notice_start_day?: number;
108
109
  prior_notice_start_time?: string;
109
- prior_notice_start_timestamp?: number;
110
+ prior_notice_start_timestamp?: UnixTimestamp;
110
111
  prior_notice_service_id?: string;
111
112
  message?: string;
112
113
  pickup_message?: string;
@@ -194,9 +195,9 @@ interface FeedInfo {
194
195
  interface Frequency {
195
196
  trip_id: string;
196
197
  start_time: string;
197
- start_timestamp: number;
198
+ start_timestamp: UnixTimestamp;
198
199
  end_time: string;
199
- end_timestamp: number;
200
+ end_timestamp: UnixTimestamp;
200
201
  headway_secs: number;
201
202
  exact_times?: 0 | 1;
202
203
  }
@@ -267,16 +268,16 @@ interface StopArea {
267
268
  interface StopTime {
268
269
  trip_id: string;
269
270
  arrival_time?: string;
270
- arrival_timestamp?: number;
271
+ arrival_timestamp?: UnixTimestamp;
271
272
  departure_time?: string;
272
- departure_timestamp?: number;
273
+ departure_timestamp?: UnixTimestamp;
273
274
  location_group_id?: string;
274
275
  location_id?: string;
275
276
  stop_id?: string;
276
277
  stop_sequence: number;
277
278
  stop_headsign?: string;
278
279
  start_pickup_drop_off_window?: string;
279
- start_pickup_drop_off_window_timestamp?: number;
280
+ start_pickup_drop_off_window_timestamp?: UnixTimestamp;
280
281
  pickup_type?: 0 | 1 | 2 | 3;
281
282
  drop_off_type?: 0 | 1 | 2 | 3;
282
283
  continuous_pickup?: 0 | 1 | 2 | 3;
@@ -354,9 +355,9 @@ interface Timetable {
354
355
  saturday: 0 | 1;
355
356
  sunday: 0 | 1;
356
357
  start_time?: string;
357
- start_timestamp?: number;
358
+ start_timestamp?: UnixTimestamp;
358
359
  end_time?: string;
359
- end_timestamp?: number;
360
+ end_timestamp?: UnixTimestamp;
360
361
  timetable_label?: string;
361
362
  service_notes?: string;
362
363
  orientation?: string;
@@ -382,6 +383,7 @@ interface TimetableNote {
382
383
  note: string;
383
384
  }
384
385
  interface TimetableNotesReference {
386
+ note_id: string;
385
387
  timetable_id: string;
386
388
  route_id?: string;
387
389
  trip_id?: string;
@@ -398,9 +400,9 @@ interface TripsDatedVehicleJourney {
398
400
  interface DeadheadTime {
399
401
  deadhead_id: string;
400
402
  arrival_time: string;
401
- arrival_timestamp: number;
403
+ arrival_timestamp: UnixTimestamp;
402
404
  departure_time: string;
403
- departure_timestamp: number;
405
+ departure_timestamp: UnixTimestamp;
404
406
  ops_location_id?: string;
405
407
  stop_id?: string;
406
408
  location_sequence: number;
@@ -452,8 +454,8 @@ interface ServiceAlert {
452
454
  end_time: string;
453
455
  headline: string;
454
456
  description: string;
455
- created_timestamp: number;
456
- expiration_timestamp: number;
457
+ created_timestamp: UnixTimestamp;
458
+ expiration_timestamp: UnixTimestamp;
457
459
  }
458
460
  interface StopTimeUpdate {
459
461
  trip_id?: string;
@@ -464,11 +466,11 @@ interface StopTimeUpdate {
464
466
  stop_sequence?: number;
465
467
  arrival_delay?: number;
466
468
  departure_delay?: number;
467
- departure_timestamp?: string;
468
- arrival_timestamp?: string;
469
+ departure_timestamp?: UnixTimestamp;
470
+ arrival_timestamp?: UnixTimestamp;
469
471
  schedule_relationship?: string;
470
- created_timestamp: number;
471
- expiration_timestamp: number;
472
+ created_timestamp: UnixTimestamp;
473
+ expiration_timestamp: UnixTimestamp;
472
474
  }
473
475
  interface TripUpdate {
474
476
  update_id: string;
@@ -478,10 +480,10 @@ interface TripUpdate {
478
480
  direction_id?: 0 | 1;
479
481
  route_id?: string;
480
482
  start_date?: number;
481
- timestamp?: string;
483
+ timestamp?: UnixTimestamp;
482
484
  schedule_relationship?: string;
483
- created_timestamp: number;
484
- expiration_timestamp: number;
485
+ created_timestamp: UnixTimestamp;
486
+ expiration_timestamp: UnixTimestamp;
485
487
  }
486
488
  interface VehiclePosition {
487
489
  update_id: string;
@@ -501,9 +503,9 @@ interface VehiclePosition {
501
503
  vehicle_label?: string;
502
504
  vehicle_license_plate?: string;
503
505
  vehicle_wheelchair_accessible?: number;
504
- timestamp?: string;
505
- created_timestamp: number;
506
- expiration_timestamp: number;
506
+ timestamp?: UnixTimestamp;
507
+ created_timestamp: UnixTimestamp;
508
+ expiration_timestamp: UnixTimestamp;
507
509
  }
508
510
  interface BoardAlight {
509
511
  trip_id: string;
@@ -524,9 +526,9 @@ interface BoardAlight {
524
526
  ramp_alightings?: number;
525
527
  service_date?: number;
526
528
  service_arrival_time?: string;
527
- service_arrival_timestamp?: number;
529
+ service_arrival_timestamp?: UnixTimestamp;
528
530
  service_departure_time?: string;
529
- service_departure_timestamp?: number;
531
+ service_departure_timestamp?: UnixTimestamp;
530
532
  source?: 0 | 1 | 2 | 3 | 4;
531
533
  }
532
534
  interface RideFeedInfo {
@@ -547,9 +549,9 @@ interface RiderTrip {
547
549
  alighting_stop_sequence?: number;
548
550
  service_date?: number;
549
551
  boarding_time?: string;
550
- boarding_timestamp?: number;
552
+ boarding_timestamp?: UnixTimestamp;
551
553
  alighting_time?: string;
552
- alighting_timestamp?: number;
554
+ alighting_timestamp?: UnixTimestamp;
553
555
  rider_type?: number;
554
556
  rider_type_description?: string;
555
557
  fare_paid?: number;
@@ -564,9 +566,9 @@ interface Ridership {
564
566
  ridership_start_date?: number;
565
567
  ridership_end_date?: number;
566
568
  ridership_start_time?: string;
567
- ridership_start_timestamp?: number;
569
+ ridership_start_timestamp?: UnixTimestamp;
568
570
  ridership_end_time?: string;
569
- ridership_end_timestamp?: number;
571
+ ridership_end_timestamp?: UnixTimestamp;
570
572
  service_id?: string;
571
573
  monday?: 0 | 1;
572
574
  tuesday?: 0 | 1;
@@ -747,4 +749,4 @@ declare function getRunEvents<Fields extends keyof RunEvent>(query?: SqlWhere, f
747
749
 
748
750
  declare function getRunsPieces<Fields extends keyof RunPiece>(query?: SqlWhere, fields?: Fields[], orderBy?: SqlOrderBy, options?: QueryOptions): QueryResult<RunPiece, Fields>[];
749
751
 
750
- 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 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 Timeframe, type Timetable, type TimetableNote, type TimetableNotesReference, type TimetablePage, type TimetableStopOrder, type Transfer, type Translation, type Trip, type TripCapacity, type TripUpdate, type TripsDatedVehicleJourney, type VehiclePosition, advancedQuery, closeDb, deleteDb, exportGtfs, 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, 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, updateGtfsRealtime };
752
+ 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 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 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, 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, 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, updateGtfsRealtime };
package/dist/index.js CHANGED
@@ -4790,7 +4790,7 @@ function getStops(query = {}, fields = [], orderBy2 = [], options = {}) {
4790
4790
  const tableName = "stops";
4791
4791
  const selectClause = formatSelectClause(fields);
4792
4792
  let whereClause = "";
4793
- const orderByClause = formatOrderByClause(orderBy2);
4793
+ let orderByClause = formatOrderByClause(orderBy2);
4794
4794
  const stopQueryOmitKeys = [
4795
4795
  "route_id",
4796
4796
  "trip_id",
@@ -4820,6 +4820,9 @@ function getStops(query = {}, fields = [], orderBy2 = [], options = {}) {
4820
4820
  options.bounding_box_side_m
4821
4821
  )
4822
4822
  );
4823
+ if (orderBy2.length === 0) {
4824
+ orderByClause = `ORDER BY (((stop_lat - ${query.stop_lat}) * (stop_lat - ${query.stop_lat})) + ((stop_lon - ${query.stop_lon}) * (stop_lon - ${query.stop_lon}))) ASC`;
4825
+ }
4823
4826
  }
4824
4827
  if (Object.values(tripQuery).length > 0) {
4825
4828
  whereClauses.push(`stop_id IN (${buildStoptimeSubquery2(tripQuery)})`);