gtfs 3.5.1 → 3.6.1

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/README.md CHANGED
@@ -62,17 +62,16 @@ or
62
62
  ```js
63
63
  import { importGtfs } from 'gtfs';
64
64
  import { readFile } from 'fs/promises';
65
+
65
66
  const config = JSON.parse(
66
67
  await readFile(new URL('./config.json', import.meta.url))
67
68
  );
68
69
 
69
- importGtfs(config)
70
- .then(() => {
71
- console.log('Import Successful');
72
- })
73
- .catch((err) => {
74
- console.error(err);
75
- });
70
+ try {
71
+ await importGtfs(config);
72
+ } catch (error) {
73
+ console.error(error);
74
+ }
76
75
  ```
77
76
 
78
77
  ### Example Applications
@@ -94,6 +93,10 @@ importGtfs(config)
94
93
  <td><img src="https://github.com/BlinkTagInc/gtfs-tts/raw/main/docs/images/gtfs-tts-logo.svg" alt="GTFS-TTS" width="200"></td>
95
94
  <td><a href="https://github.com/blinktaginc/gtfs-tts">GTFS-Text-to-Speech</a> app tests GTFS stop name pronunciation for text-to-speech. It uses `node-gtfs` for loading stop names from GTFS data.</td>
96
95
  </tr>
96
+ <tr>
97
+ <td><img src="https://github.com/BlinkTagInc/transit-arrivals-widget/raw/master/docs/images/transit-arrivals-widget-logo.svg" alt="Transit Arrivals Widget" width="200"></td>
98
+ <td><a href="https://github.com/BlinkTagInc/transit-arrivals-widget">Transit Arrivals Widget</a> creates a realtime transit arrivals tool from GTFS and GTFS-RT data.</td>
99
+ </tr>
97
100
  </table>
98
101
 
99
102
  ## Command-Line Usage
@@ -312,7 +315,7 @@ const config = {
312
315
  },
313
316
  };
314
317
 
315
- importGtfs(config);
318
+ await importGtfs(config);
316
319
  ```
317
320
 
318
321
  ## `gtfs-import` Script
@@ -339,13 +342,7 @@ const config = JSON.parse(
339
342
  await readFile(new URL('./config.json', import.meta.url))
340
343
  );
341
344
 
342
- importGtfs(config)
343
- .then(() => {
344
- console.log('Import Successful');
345
- })
346
- .catch((err) => {
347
- console.error(err);
348
- });
345
+ await importGtfs(config);
349
346
  ```
350
347
 
351
348
  Configuration can be a JSON object in your code
@@ -363,13 +360,7 @@ const config = {
363
360
  ],
364
361
  };
365
362
 
366
- importGtfs(config)
367
- .then(() => {
368
- console.log('Import Successful');
369
- })
370
- .catch((err) => {
371
- console.error(err);
372
- });
363
+ await importGtfs(config);
373
364
  ```
374
365
 
375
366
  ## `gtfsrealtime-update` Script
@@ -396,13 +387,7 @@ const config = JSON.parse(
396
387
  await readFile(new URL('./config.json', import.meta.url))
397
388
  );
398
389
 
399
- updateGtfsRealtime(config)
400
- .then(() => {
401
- console.log('Update Successful');
402
- })
403
- .catch((err) => {
404
- console.error(err);
405
- });
390
+ await updateGtfsRealtime(config);
406
391
  ```
407
392
 
408
393
  ## `gtfs-export` Script
@@ -454,13 +439,7 @@ const config = {
454
439
  ],
455
440
  };
456
441
 
457
- exportGtfs(config)
458
- .then(() => {
459
- console.log('Export Successful');
460
- })
461
- .catch((err) => {
462
- console.error(err);
463
- });
442
+ await exportGtfs(config);
464
443
  ```
465
444
 
466
445
  ## Query Methods
@@ -549,14 +528,30 @@ Queries agencies and returns a promise. The result of the promise is an array of
549
528
  import { getAgencies } from 'gtfs';
550
529
 
551
530
  // Get all agencies
552
- getAgencies();
531
+ const agencies = await getAgencies();
553
532
 
554
533
  // Get a specific agency
555
- getAgencies({
534
+ const agencies = await getAgencies({
556
535
  agency_id: 'caltrain',
557
536
  });
558
537
  ```
559
538
 
539
+ ### getAreas(query, fields, sortBy)
540
+
541
+ Queries areas and returns a promise. The result of the promise is an array of areas.
542
+
543
+ ```js
544
+ import { getAreas } from 'gtfs';
545
+
546
+ // Get all areas
547
+ const areas = await getAreas();
548
+
549
+ // Get a specific area
550
+ const areas = await getAreas({
551
+ area_id: 'area1',
552
+ });
553
+ ```
554
+
560
555
  ### getAttributions(query, fields, sortBy)
561
556
 
562
557
  Queries attributions and returns a promise. The result of the promise is an array of attributions.
@@ -565,10 +560,10 @@ Queries attributions and returns a promise. The result of the promise is an arra
565
560
  import { getAttributions } from 'gtfs';
566
561
 
567
562
  // Get all attributions
568
- getAttributions();
563
+ const attributions = await getAttributions();
569
564
 
570
565
  // Get a specific attribution
571
- getAttributions({
566
+ const attributions = await getAttributions({
572
567
  attribution_id: '123',
573
568
  });
574
569
  ```
@@ -581,10 +576,10 @@ Queries routes and returns a promise. The result of the promise is an array of r
581
576
  import { getRoutes } from 'gtfs';
582
577
 
583
578
  // Get all routes, sorted by route_short_name
584
- getRoutes({}, [], [['route_short_name', 'ASC']]);
579
+ const routes = await getRoutes({}, [], [['route_short_name', 'ASC']]);
585
580
 
586
581
  // Get a specific route
587
- getRoutes({
582
+ const routes = await getRoutes({
588
583
  route_id: 'Lo-16APR',
589
584
  });
590
585
  ```
@@ -595,7 +590,7 @@ getRoutes({
595
590
  import { getRoutes } from 'gtfs';
596
591
 
597
592
  // Get routes that serve a specific stop, sorted by `stop_name`.
598
- getRoutes(
593
+ const routes = await getRoutes(
599
594
  {
600
595
  stop_id: '70011',
601
596
  },
@@ -612,43 +607,34 @@ Queries stops and returns a promise. The result of the promise is an array of st
612
607
  import { getStops } from 'gtfs';
613
608
 
614
609
  // Get all stops
615
- getStops();
610
+ const stops = await getStops();
616
611
 
617
612
  // Get a specific stop by stop_id
618
- getStops({
613
+ const stops = await getStops({
619
614
  stop_id: '70011',
620
615
  });
621
- ```
622
-
623
- `getStops` allows passing a `route_id` in the query and it will query trips and stoptimes to find all stops served by that `route_id`.
624
-
625
- ```js
626
- import { getStops } from 'gtfs';
627
616
 
628
- // Get all stops for a specific route
629
- getStops({
617
+ /*
618
+ * `getStops` allows passing a `route_id` in the query and it will
619
+ * query trips and stoptimes to find all stops served by that `route_id`.
620
+ */
621
+ const stops = await getStops({
630
622
  route_id: 'Lo-16APR',
631
623
  });
632
- ```
633
-
634
- `getStops` allows passing a `trip_id` in the query and it will query stoptimes to find all stops on that `trip_id`.
635
-
636
- ```js
637
- import { getStops } from 'gtfs';
638
624
 
639
- // Get all stops for a specific trip
640
- getStops({
625
+ /*
626
+ * `getStops` allows passing a `trip_id` in the query and it will query
627
+ * stoptimes to find all stops on that `trip_id`.
628
+ */
629
+ const stops = await getStops({
641
630
  trip_id: '37a',
642
631
  });
643
- ```
644
-
645
- `getStops` allows passing a `shape_id` in the query and it will query trips and stoptimes to find all stops that use that `shape_id`.
646
-
647
- ```js
648
- import { getStops } from 'gtfs';
649
632
 
650
- // Get all stops for a specific trip
651
- getStops({
633
+ /*
634
+ * `getStops` allows passing a `shape_id` in the query and it will query
635
+ * trips and stoptimes to find all stops that use that `shape_id`.
636
+ */
637
+ const stops = await getStops({
652
638
  shape_id: 'cal_sf_tam',
653
639
  });
654
640
  ```
@@ -661,10 +647,10 @@ Queries stops and returns a promise. The result of the promise is an geoJSON obj
661
647
  import { getStopsAsGeoJSON } from 'gtfs';
662
648
 
663
649
  // Get all stops for an agency as geoJSON
664
- getStopsAsGeoJSON();
650
+ const stopsGeojson = await getStopsAsGeoJSON();
665
651
 
666
652
  // Get all stops for a specific route as geoJSON
667
- getStopsAsGeoJSON({
653
+ const stopsGeojson = await getStopsAsGeoJSON({
668
654
  route_id: 'Lo-16APR',
669
655
  });
670
656
  ```
@@ -677,15 +663,15 @@ Queries `stop_times` and returns a promise. The result of the promise is an arra
677
663
  import { getStoptimes } from 'gtfs';
678
664
 
679
665
  // Get all stoptimes
680
- getStoptimes();
666
+ const stoptimes = await getStoptimes();
681
667
 
682
668
  // Get all stoptimes for a specific stop
683
- getStoptimes({
669
+ const stoptimes = await getStoptimes({
684
670
  stop_id: '70011',
685
671
  });
686
672
 
687
673
  // Get all stoptimes for a specific trip, sorted by stop_sequence
688
- getStoptimes(
674
+ const stoptimes = await getStoptimes(
689
675
  {
690
676
  trip_id: '37a',
691
677
  },
@@ -694,7 +680,7 @@ getStoptimes(
694
680
  );
695
681
 
696
682
  // Get all stoptimes for a specific stop and service_id
697
- getStoptimes({
683
+ const stoptimes = await getStoptimes({
698
684
  stop_id: '70011',
699
685
  service_id: 'CT-16APR-Caltrain-Weekday-01',
700
686
  });
@@ -708,22 +694,22 @@ Queries trips and returns a promise. The result of the promise is an array of tr
708
694
  import { getTrips } from 'gtfs';
709
695
 
710
696
  // Get all trips
711
- getTrips();
697
+ const trips = await getTrips();
712
698
 
713
699
  // Get trips for a specific route and direction
714
- getTrips({
700
+ const trips = await getTrips({
715
701
  route_id: 'Lo-16APR',
716
702
  direction_id: 0
717
703
  });
718
704
 
719
705
  // Get trips for direction '' or null
720
- getTrips({
706
+ const trips = await getTrips({
721
707
  route_id: 'Lo-16APR',
722
708
  direction_id: null
723
709
  });
724
710
 
725
711
  // Get trips for a specific route and direction limited by a service_id
726
- getTrips({
712
+ const trips = await getTrips({
727
713
  route_id: 'Lo-16APR',
728
714
  direction_id: 0,
729
715
  service_id: '
@@ -738,7 +724,7 @@ Queries shapes and returns a promise. The result of the promise is an array of s
738
724
  import { getShapes } from 'gtfs';
739
725
 
740
726
  // Get all shapes for an agency
741
- getShapes();
727
+ const shapes = await getShapes();
742
728
  ```
743
729
 
744
730
  `getShapes` allows passing a `route_id` in the query and it will query trips to find all shapes served by that `route_id`.
@@ -747,30 +733,24 @@ getShapes();
747
733
  import { getShapes } from 'gtfs';
748
734
 
749
735
  // Get all shapes for a specific route and direction
750
- getShapes({
736
+ const shapes = await getShapes({
751
737
  route_id: 'Lo-16APR',
752
738
  });
753
- ```
754
-
755
- `getShapes` allows passing a `trip_id` in the query and it will query trips to find all shapes served by that `trip_id`.
756
739
 
757
- ```js
758
- import { getShapes } from 'gtfs';
759
-
760
- // Get all shapes for a specific trip_id
761
- getShapes({
740
+ /*
741
+ * `getShapes` allows passing a `trip_id` in the query and it will query
742
+ * trips to find all shapes served by that `trip_id`.
743
+ */
744
+ const shapes = await getShapes({
762
745
  trip_id: '37a',
763
746
  });
764
- ```
765
-
766
- `getShapes` allows passing a `service_id` in the query and it will query trips to find all shapes served by that `service_id`.
767
-
768
- ```js
769
- import { getShapes } from 'gtfs';
770
747
 
771
- // Get all shapes for a specific service_id
772
- .etShapes({
773
- service_id: 'CT-16APR-Caltrain-Sunday-02'
748
+ /*
749
+ * `getShapes` allows passing a `service_id` in the query and it will query
750
+ * trips to find all shapes served by that `service_id`.
751
+ */
752
+ const shapes = await getShapes({
753
+ service_id: 'CT-16APR-Caltrain-Sunday-02',
774
754
  });
775
755
  ```
776
756
 
@@ -778,31 +758,29 @@ import { getShapes } from 'gtfs';
778
758
 
779
759
  Queries shapes and returns a promise. The result of the promise is an geoJSON object of shapes. All valid queries for `getShapes()` work for `getShapesAsGeoJSON()`.
780
760
 
781
- Returns geoJSON of shapes.
782
-
783
761
  ```js
784
762
  import { getShapesAsGeoJSON } from 'gtfs';
785
763
 
786
764
  // Get geoJSON of all routes in an agency
787
- getShapesAsGeoJSON();
765
+ const shapesGeojson = await getShapesAsGeoJSON();
788
766
 
789
767
  // Get geoJSON of shapes for a specific route
790
- getShapesAsGeoJSON({
768
+ const shapesGeojson = await getShapesAsGeoJSON({
791
769
  route_id: 'Lo-16APR',
792
770
  });
793
771
 
794
772
  // Get geoJSON of shapes for a specific trip
795
- getShapesAsGeoJSON({
773
+ const shapesGeojson = await getShapesAsGeoJSON({
796
774
  trip_id: '37a',
797
775
  });
798
776
 
799
777
  // Get geoJSON of shapes for a specific `service_id`
800
- getShapesAsGeoJSON({
778
+ const shapesGeojson = await getShapesAsGeoJSON({
801
779
  service_id: 'CT-16APR-Caltrain-Sunday-02',
802
780
  });
803
781
 
804
782
  // Get geoJSON of shapes for a specific `shape_id`
805
- getShapesAsGeoJSON({
783
+ const shapesGeojson = await getShapesAsGeoJSON({
806
784
  shape_id: 'cal_sf_tam',
807
785
  });
808
786
  ```
@@ -815,10 +793,10 @@ Queries calendars and returns a promise. The result of the promise is an array o
815
793
  import { getCalendars } from 'gtfs';
816
794
 
817
795
  // Get all calendars for an agency
818
- getCalendars();
796
+ const calendars = await getCalendars();
819
797
 
820
798
  // Get calendars for a specific `service_id`
821
- getCalendars({
799
+ const calendars = await getCalendars({
822
800
  service_id: 'CT-16APR-Caltrain-Sunday-02',
823
801
  });
824
802
  ```
@@ -831,10 +809,10 @@ Queries calendar_dates and returns a promise. The result of the promise is an ar
831
809
  import { getCalendarDates } from 'gtfs';
832
810
 
833
811
  // Get all calendar_dates for an agency
834
- getCalendarDates();
812
+ const calendarDates = await getCalendarDates();
835
813
 
836
814
  // Get calendar_dates for a specific `service_id`
837
- getCalendarDates({
815
+ const calendarDates = await getCalendarDates({
838
816
  service_id: 'CT-16APR-Caltrain-Sunday-02',
839
817
  });
840
818
  ```
@@ -847,14 +825,46 @@ Queries fare_attributes and returns a promise. The result of the promise is an a
847
825
  import { getFareAttributes } from 'gtfs';
848
826
 
849
827
  // Get all `fare_attributes` for an agency
850
- getFareAttributes();
828
+ const fareAttributes = await getFareAttributes();
851
829
 
852
830
  // Get `fare_attributes` for a specific `fare_id`
853
- getFareAttributes({
831
+ const fareAttributes = await getFareAttributes({
854
832
  fare_id: '123',
855
833
  });
856
834
  ```
857
835
 
836
+ ### getFareLegRules(query, fields, sortBy)
837
+
838
+ Queries fare leg rules and returns a promise. The result of the promise is an array of fare leg rules.
839
+
840
+ ```js
841
+ import { getFareLegRules } from 'gtfs';
842
+
843
+ // Get all fare leg rules
844
+ const fareLegRules = await getFareLegRules();
845
+
846
+ // Get fare leg rules for a specific fare product
847
+ const fareLegRules = await getFareLegRules({
848
+ fare_product_id: 'product1',
849
+ });
850
+ ```
851
+
852
+ ### getFareProducts(query, fields, sortBy)
853
+
854
+ Queries fare products and returns a promise. The result of the promise is an array of fare products.
855
+
856
+ ```js
857
+ import { getFareProducts } from 'gtfs';
858
+
859
+ // Get all fare products
860
+ const fareProducts = await getFareProducts();
861
+
862
+ // Get a specific fare product
863
+ const fareProducts = await getFareProducts({
864
+ fare_product_id: 'product1',
865
+ });
866
+ ```
867
+
858
868
  ### getFareRules(query, fields, sortBy)
859
869
 
860
870
  Queries fare_rules and returns a promise. The result of the promise is an array of fare_rules.
@@ -863,14 +873,30 @@ Queries fare_rules and returns a promise. The result of the promise is an array
863
873
  import { getFareRules } from 'gtfs';
864
874
 
865
875
  // Get all `fare_rules` for an agency
866
- getFareRules();
876
+ const fareRules = await getFareRules();
867
877
 
868
878
  // Get fare_rules for a specific route
869
- getFareRules({
879
+ const fareRules = await getFareRules({
870
880
  route_id: 'Lo-16APR',
871
881
  });
872
882
  ```
873
883
 
884
+ ### getFareTransferRules(query, fields, sortBy)
885
+
886
+ Queries fare transfer rules and returns a promise. The result of the promise is an array of fare transfer rules.
887
+
888
+ ```js
889
+ import { getFareTransferRules } from 'gtfs';
890
+
891
+ // Get all fare transfer rules
892
+ const fareTransferRules = await getFareTransferRules();
893
+
894
+ // Get a all fare transfer rules for a specific fare product
895
+ const fareTransferRules = await getFareTransferRules({
896
+ fare_product_id: 'product1',
897
+ });
898
+ ```
899
+
874
900
  ### getFeedInfo(query, fields, sortBy)
875
901
 
876
902
  Queries feed_info and returns a promise. The result of the promise is an array of feed_infos.
@@ -879,7 +905,7 @@ Queries feed_info and returns a promise. The result of the promise is an array o
879
905
  import { getFeedInfo } from 'gtfs';
880
906
 
881
907
  // Get feed_info
882
- getFeedInfo();
908
+ const feedInfo = await getFeedInfo();
883
909
  ```
884
910
 
885
911
  ### getFrequencies(query, fields, sortBy)
@@ -890,10 +916,10 @@ Queries frequencies and returns a promise. The result of the promise is an array
890
916
  import { getFrequencies } from 'gtfs';
891
917
 
892
918
  // Get all frequencies
893
- getFrequencies();
919
+ const frequencies = await getFrequencies();
894
920
 
895
921
  // Get frequencies for a specific trip
896
- getFrequencies({
922
+ const frequencies = await getFrequencies({
897
923
  trip_id: '1234',
898
924
  });
899
925
  ```
@@ -905,8 +931,8 @@ Queries levels and returns a promise. The result of the promise is an array of l
905
931
  ```js
906
932
  import { getLevels } from 'gtfs';
907
933
 
908
- // Get levels
909
- getLevels();
934
+ // Get all levels
935
+ const levels = await getLevels();
910
936
  ```
911
937
 
912
938
  ### getPathways(query, fields, sortBy)
@@ -916,8 +942,8 @@ Queries pathways and returns a promise. The result of the promise is an array of
916
942
  ```js
917
943
  import { getPathways } from 'gtfs';
918
944
 
919
- // Get pathways
920
- getPathways();
945
+ // Get all pathways
946
+ const pathways = await getPathways();
921
947
  ```
922
948
 
923
949
  ### getTransfers(query, fields, sortBy)
@@ -928,10 +954,10 @@ Queries transfers and returns a promise. The result of the promise is an array o
928
954
  import { getTransfers } from 'gtfs';
929
955
 
930
956
  // Get all transfers
931
- getTransfers();
957
+ const transfers = await getTransfers();
932
958
 
933
959
  // Get transfers for a specific stop
934
- getTransfers({
960
+ const transfers = await getTransfers({
935
961
  from_stop_id: '1234',
936
962
  });
937
963
  ```
@@ -943,8 +969,8 @@ Queries translations and returns a promise. The result of the promise is an arra
943
969
  ```js
944
970
  import { getTranslations } from 'gtfs';
945
971
 
946
- // Get translations
947
- getTranslations();
972
+ // Get all translations
973
+ const translations = await getTranslations();
948
974
  ```
949
975
 
950
976
  ### getDirections(query, fields, sortBy)
@@ -955,20 +981,31 @@ Queries directions and returns a promise. The result of the promise is an array
955
981
  import { getDirections } from 'gtfs';
956
982
 
957
983
  // Get all directions
958
- getDirections();
984
+ const directions = await getDirections();
959
985
 
960
986
  // Get directions for a specific route
961
- getDirections({
987
+ const directions = await getDirections({
962
988
  route_id: '1234',
963
989
  });
964
990
 
965
991
  // Get directions for a specific route and direction
966
- getDirections({
992
+ const directions = await getDirections({
967
993
  route_id: '1234',
968
994
  direction_id: 1,
969
995
  });
970
996
  ```
971
997
 
998
+ ### getStopAreas(query, fields, sortBy)
999
+
1000
+ Queries stop areas and returns a promise. The result of the promise is an array of stop areas.
1001
+
1002
+ ```js
1003
+ import { getStopAreas } from 'gtfs';
1004
+
1005
+ // Get all stop areas
1006
+ const stopAreas = await getStopAreas();
1007
+ ```
1008
+
972
1009
  ### getStopAttributes(query, fields, sortBy)
973
1010
 
974
1011
  Queries stop_attributes and returns a promise. The result of the promise is an array of stop_attributes. These are from the non-standard `stop_attributes.txt` file. See [documentation and examples of this file](https://gtfstohtml.com/docs/stop-attributes).
@@ -977,10 +1014,10 @@ Queries stop_attributes and returns a promise. The result of the promise is an a
977
1014
  import { getStopAttributes } from 'gtfs';
978
1015
 
979
1016
  // Get all stop attributes
980
- getStopAttributes();
1017
+ const stopAttributes = await getStopAttributes();
981
1018
 
982
1019
  // Get stop attributes for specific stop
983
- getStopAttributes({
1020
+ const stopAttributes = await getStopAttributes({
984
1021
  stop_id: '1234',
985
1022
  });
986
1023
  ```
@@ -993,10 +1030,10 @@ Queries timetables and returns a promise. The result of the promise is an array
993
1030
  import { getTimetables } from 'gtfs';
994
1031
 
995
1032
  // Get all timetables for an agency
996
- getTimetables();
1033
+ const timetables = await getTimetables();
997
1034
 
998
1035
  // Get a specific timetable
999
- getTimetables({
1036
+ const timetables = await getTimetables({
1000
1037
  timetable_id: '1',
1001
1038
  });
1002
1039
  ```
@@ -1009,10 +1046,10 @@ Queries timetable_stop_orders and returns a promise. The result of the promise i
1009
1046
  import { getTimetableStopOrders } from 'gtfs';
1010
1047
 
1011
1048
  // Get all timetable_stop_orders
1012
- getTimetableStopOrders();
1049
+ const timetableStopOrders = await getTimetableStopOrders();
1013
1050
 
1014
1051
  // Get timetable_stop_orders for a specific timetable
1015
- getTimetableStopOrders({
1052
+ const timetableStopOrders = await getTimetableStopOrders({
1016
1053
  timetable_id: '1',
1017
1054
  });
1018
1055
  ```
@@ -1025,10 +1062,10 @@ Queries timetable_pages and returns a promise. The result of the promise is an a
1025
1062
  import { getTimetablePages } from 'gtfs';
1026
1063
 
1027
1064
  // Get all timetable_pages for an agency
1028
- getTimetablePages();
1065
+ const timetablePages = await getTimetablePages();
1029
1066
 
1030
1067
  // Get a specific timetable_page
1031
- getTimetablePages({
1068
+ const timetablePages = await getTimetablePages({
1032
1069
  timetable_page_id: '2',
1033
1070
  });
1034
1071
  ```
@@ -1041,10 +1078,10 @@ Queries timetable_notes and returns a promise. The result of the promise is an a
1041
1078
  import { getTimetableNotes } from 'gtfs';
1042
1079
 
1043
1080
  // Get all timetable_notes for an agency
1044
- getTimetableNotes();
1081
+ const timetableNotes = await getTimetableNotes();
1045
1082
 
1046
1083
  // Get a specific timetable_note
1047
- getTimetableNotes({
1084
+ const timetableNotes = await getTimetableNotes({
1048
1085
  note_id: '1',
1049
1086
  });
1050
1087
  ```
@@ -1057,10 +1094,10 @@ Queries timetable_notes_references and returns a promise. The result of the prom
1057
1094
  import { getTimetableNotesReferences } from 'gtfs';
1058
1095
 
1059
1096
  // Get all timetable_notes_references for an agency
1060
- getTimetableNotesReferences();
1097
+ const timetableNotesReferences = await getTimetableNotesReferences();
1061
1098
 
1062
1099
  // Get all timetable_notes_references for a specific timetable
1063
- getTimetableNotesReferences({
1100
+ const timetableNotesReferences = await getTimetableNotesReferences({
1064
1101
  timetable_id: '4',
1065
1102
  });
1066
1103
  ```
@@ -1073,7 +1110,7 @@ Queries trips_dated_vehicle_journey and returns a promise. The result of the pro
1073
1110
  import { getTripsDatedVehicleJourneys } from 'gtfs';
1074
1111
 
1075
1112
  // Get all timetable_stop_orders
1076
- getTripsDatedVehicleJourneys();
1113
+ const tripsDatedVehicleJourneys = await getTripsDatedVehicleJourneys();
1077
1114
  ```
1078
1115
 
1079
1116
  ### getServiceAlerts(query, fields, sortBy)
@@ -1085,7 +1122,7 @@ These are only valid if you use GTFS-Realtime and have imported Service Alert da
1085
1122
  import { getServiceAlerts } from 'gtfs';
1086
1123
 
1087
1124
  // Get service alerts
1088
- getServiceAlerts();
1125
+ const serviceAlerts = await getServiceAlerts();
1089
1126
  ```
1090
1127
 
1091
1128
  ### getTripUpdates(query, fields, sortBy)
@@ -1097,7 +1134,7 @@ These are only valid if you use GTFS-Realtime and have imported Trip Update data
1097
1134
  import { getTripUpdates } from 'gtfs';
1098
1135
 
1099
1136
  // Get all trip updates
1100
- getTripUpdates();
1137
+ const tripUpdates = await getTripUpdates();
1101
1138
  ```
1102
1139
 
1103
1140
  ### getStopTimesUpdates(query, fields, sortBy)
@@ -1109,7 +1146,7 @@ These are only valid if you use GTFS-Realtime and have imported Trip Update data
1109
1146
  import { getStopTimesUpdates } from 'gtfs';
1110
1147
 
1111
1148
  // Get all stop times updates
1112
- getStopTimesUpdates();
1149
+ const stopTimesUpdates = await getStopTimesUpdates();
1113
1150
  ```
1114
1151
 
1115
1152
  ### getVehiclePositions(query, fields, sortBy)
@@ -1121,7 +1158,7 @@ These are only valid if you use GTFS-Realtime and have imported Vehicle Position
1121
1158
  import { getVehiclePositions } from 'gtfs';
1122
1159
 
1123
1160
  // Get all vehicle position data
1124
- getVehiclePositions();
1161
+ const vehiclePositions = await getVehiclePositions();
1125
1162
  ```
1126
1163
 
1127
1164
  ### advancedQuery(table, advancedQueryOptions)
@@ -1146,8 +1183,9 @@ const advancedQueryOptions = {
1146
1183
  },
1147
1184
  ],
1148
1185
  };
1186
+
1149
1187
  // Perform a custom query
1150
- advancedQuery('stop_times', advancedQueryOptions);
1188
+ const stoptimes = await advancedQuery('stop_times', advancedQueryOptions);
1151
1189
  ```
1152
1190
 
1153
1191
  ### runRawQuery(query)
@@ -1159,7 +1197,9 @@ The result of the promise is an array the selected data.
1159
1197
  import { runRawQuery } from 'gtfs';
1160
1198
 
1161
1199
  // Perform a raw query
1162
- runRawQuery('SELECT * FROM stop_times WHERE stop_sequence="1"');
1200
+ const stoptimes = await runRawQuery(
1201
+ 'SELECT * FROM stop_times WHERE stop_sequence="1"'
1202
+ );
1163
1203
  ```
1164
1204
 
1165
1205
  ### execRawQuery(query)
@@ -1170,7 +1210,7 @@ Executes a statement. Returns a promise containing the result of the execute.
1170
1210
  import { execRawQuery } from 'gtfs';
1171
1211
 
1172
1212
  // Purge trips table
1173
- execRawQuery('DELETE FROM trips');
1213
+ await execRawQuery('DELETE FROM trips');
1174
1214
  ```
1175
1215
 
1176
1216
  ## Contributing