gtfs 4.13.2 → 4.13.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/index.js CHANGED
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/lib/import.ts
2
8
  import path from "node:path";
3
9
  import { createReadStream, existsSync, lstatSync } from "node:fs";
@@ -11,8 +17,68 @@ import mapSeries from "promise-map-series";
11
17
  import GtfsRealtimeBindings from "gtfs-realtime-bindings";
12
18
  import sqlString2 from "sqlstring-sqlite";
13
19
 
20
+ // src/models/models.ts
21
+ var models_exports = {};
22
+ __export(models_exports, {
23
+ agency: () => agency,
24
+ areas: () => areas,
25
+ attributions: () => attributions,
26
+ boardAlight: () => boardAlight,
27
+ bookingRules: () => bookingRules,
28
+ calendar: () => calendar,
29
+ calendarAttributes: () => calendarAttributes,
30
+ calendarDates: () => calendarDates,
31
+ deadheadTimes: () => deadheadTimes,
32
+ deadheads: () => deadheads,
33
+ directions: () => directions,
34
+ fareAttributes: () => fareAttributes,
35
+ fareLegRules: () => fareLegRules,
36
+ fareMedia: () => fareMedia,
37
+ fareProducts: () => fareProducts,
38
+ fareRules: () => fareRules,
39
+ fareTransferRules: () => fareTransferRules,
40
+ feedInfo: () => feedInfo,
41
+ frequencies: () => frequencies,
42
+ levels: () => levels,
43
+ locationGroupStops: () => locationGroupStops,
44
+ locationGroups: () => locationGroups,
45
+ locations: () => locations,
46
+ networks: () => networks,
47
+ opsLocations: () => opsLocations,
48
+ pathways: () => pathways,
49
+ rideFeedInfo: () => rideFeedInfo,
50
+ riderTrip: () => riderTrip,
51
+ ridership: () => ridership,
52
+ routeAttributes: () => routeAttributes,
53
+ routeNetworks: () => routeNetworks,
54
+ routes: () => routes,
55
+ runEvents: () => runEvents,
56
+ runsPieces: () => runsPieces,
57
+ serviceAlertTargets: () => serviceAlertTargets,
58
+ serviceAlerts: () => serviceAlerts,
59
+ shapes: () => shapes,
60
+ stopAreas: () => stopAreas,
61
+ stopAttributes: () => stopAttributes,
62
+ stopTimeUpdates: () => stopTimeUpdates,
63
+ stopTimes: () => stopTimes,
64
+ stops: () => stops,
65
+ timeframes: () => timeframes,
66
+ timetableNotes: () => timetableNotes,
67
+ timetableNotesReferences: () => timetableNotesReferences,
68
+ timetablePages: () => timetablePages,
69
+ timetableStopOrder: () => timetableStopOrder,
70
+ timetables: () => timetables,
71
+ transfers: () => transfers,
72
+ translations: () => translations,
73
+ tripCapacity: () => tripCapacity,
74
+ tripUpdates: () => tripUpdates,
75
+ trips: () => trips,
76
+ tripsDatedVehicleJourney: () => tripsDatedVehicleJourney,
77
+ vehiclePositions: () => vehiclePositions
78
+ });
79
+
14
80
  // src/models/gtfs/agency.ts
15
- var model = {
81
+ var agency = {
16
82
  filenameBase: "agency",
17
83
  filenameExtension: "txt",
18
84
  schema: [
@@ -59,10 +125,9 @@ var model = {
59
125
  }
60
126
  ]
61
127
  };
62
- var agency_default = model;
63
128
 
64
129
  // src/models/gtfs/areas.ts
65
- var model2 = {
130
+ var areas = {
66
131
  filenameBase: "areas",
67
132
  filenameExtension: "txt",
68
133
  schema: [
@@ -79,10 +144,9 @@ var model2 = {
79
144
  }
80
145
  ]
81
146
  };
82
- var areas_default = model2;
83
147
 
84
148
  // src/models/gtfs/attributions.ts
85
- var model3 = {
149
+ var attributions = {
86
150
  filenameBase: "attributions",
87
151
  filenameExtension: "txt",
88
152
  schema: [
@@ -146,10 +210,9 @@ var model3 = {
146
210
  }
147
211
  ]
148
212
  };
149
- var attributions_default = model3;
150
213
 
151
214
  // src/models/gtfs/booking-rules.ts
152
- var model4 = {
215
+ var bookingRules = {
153
216
  filenameBase: "booking_rules",
154
217
  filenameExtension: "txt",
155
218
  schema: [
@@ -239,10 +302,9 @@ var model4 = {
239
302
  }
240
303
  ]
241
304
  };
242
- var booking_rules_default = model4;
243
305
 
244
306
  // src/models/gtfs/calendar-dates.ts
245
- var model5 = {
307
+ var calendarDates = {
246
308
  filenameBase: "calendar_dates",
247
309
  filenameExtension: "txt",
248
310
  schema: [
@@ -274,10 +336,9 @@ var model5 = {
274
336
  }
275
337
  ]
276
338
  };
277
- var calendar_dates_default = model5;
278
339
 
279
340
  // src/models/gtfs/calendar.ts
280
- var model6 = {
341
+ var calendar = {
281
342
  filenameBase: "calendar",
282
343
  filenameExtension: "txt",
283
344
  schema: [
@@ -351,10 +412,9 @@ var model6 = {
351
412
  }
352
413
  ]
353
414
  };
354
- var calendar_default = model6;
355
415
 
356
416
  // src/models/gtfs/fare-attributes.ts
357
- var model7 = {
417
+ var fareAttributes = {
358
418
  filenameBase: "fare_attributes",
359
419
  filenameExtension: "txt",
360
420
  schema: [
@@ -400,10 +460,9 @@ var model7 = {
400
460
  }
401
461
  ]
402
462
  };
403
- var fare_attributes_default = model7;
404
463
 
405
464
  // src/models/gtfs/fare-leg-rules.ts
406
- var model8 = {
465
+ var fareLegRules = {
407
466
  filenameBase: "fare_leg_rules",
408
467
  filenameExtension: "txt",
409
468
  schema: [
@@ -456,10 +515,9 @@ var model8 = {
456
515
  }
457
516
  ]
458
517
  };
459
- var fare_leg_rules_default = model8;
460
518
 
461
519
  // src/models/gtfs/fare-media.ts
462
- var model9 = {
520
+ var fareMedia = {
463
521
  filenameBase: "fare_media",
464
522
  filenameExtension: "txt",
465
523
  schema: [
@@ -483,10 +541,9 @@ var model9 = {
483
541
  }
484
542
  ]
485
543
  };
486
- var fare_media_default = model9;
487
544
 
488
545
  // src/models/gtfs/fare-products.ts
489
- var model10 = {
546
+ var fareProducts = {
490
547
  filenameBase: "fare_products",
491
548
  filenameExtension: "txt",
492
549
  schema: [
@@ -519,10 +576,9 @@ var model10 = {
519
576
  }
520
577
  ]
521
578
  };
522
- var fare_products_default = model10;
523
579
 
524
580
  // src/models/gtfs/fare-rules.ts
525
- var model11 = {
581
+ var fareRules = {
526
582
  filenameBase: "fare_rules",
527
583
  filenameExtension: "txt",
528
584
  schema: [
@@ -554,10 +610,9 @@ var model11 = {
554
610
  }
555
611
  ]
556
612
  };
557
- var fare_rules_default = model11;
558
613
 
559
614
  // src/models/gtfs/fare-transfer-rules.ts
560
- var model12 = {
615
+ var fareTransferRules = {
561
616
  filenameBase: "fare_transfer_rules",
562
617
  filenameExtension: "txt",
563
618
  schema: [
@@ -611,10 +666,9 @@ var model12 = {
611
666
  }
612
667
  ]
613
668
  };
614
- var fare_transfer_rules_default = model12;
615
669
 
616
670
  // src/models/gtfs/feed-info.ts
617
- var model13 = {
671
+ var feedInfo = {
618
672
  filenameBase: "feed_info",
619
673
  filenameExtension: "txt",
620
674
  schema: [
@@ -662,10 +716,9 @@ var model13 = {
662
716
  }
663
717
  ]
664
718
  };
665
- var feed_info_default = model13;
666
719
 
667
720
  // src/models/gtfs/frequencies.ts
668
- var model14 = {
721
+ var frequencies = {
669
722
  filenameBase: "frequencies",
670
723
  filenameExtension: "txt",
671
724
  schema: [
@@ -709,10 +762,9 @@ var model14 = {
709
762
  }
710
763
  ]
711
764
  };
712
- var frequencies_default = model14;
713
765
 
714
766
  // src/models/gtfs/levels.ts
715
- var model15 = {
767
+ var levels = {
716
768
  filenameBase: "levels",
717
769
  filenameExtension: "txt",
718
770
  schema: [
@@ -735,10 +787,9 @@ var model15 = {
735
787
  }
736
788
  ]
737
789
  };
738
- var levels_default = model15;
739
790
 
740
791
  // src/models/gtfs/location-groups.ts
741
- var model16 = {
792
+ var locationGroups = {
742
793
  filenameBase: "location_groups",
743
794
  filenameExtension: "txt",
744
795
  schema: [
@@ -755,10 +806,9 @@ var model16 = {
755
806
  }
756
807
  ]
757
808
  };
758
- var location_groups_default = model16;
759
809
 
760
810
  // src/models/gtfs/location-group-stops.ts
761
- var model17 = {
811
+ var locationGroupStops = {
762
812
  filenameBase: "location_group_stops",
763
813
  filenameExtension: "txt",
764
814
  schema: [
@@ -778,10 +828,9 @@ var model17 = {
778
828
  }
779
829
  ]
780
830
  };
781
- var location_group_stops_default = model17;
782
831
 
783
832
  // src/models/gtfs/locations.ts
784
- var model18 = {
833
+ var locations = {
785
834
  filenameBase: "locations",
786
835
  filenameExtension: "geojson",
787
836
  schema: [
@@ -791,10 +840,9 @@ var model18 = {
791
840
  }
792
841
  ]
793
842
  };
794
- var locations_default = model18;
795
843
 
796
844
  // src/models/gtfs/networks.ts
797
- var model19 = {
845
+ var networks = {
798
846
  filenameBase: "networks",
799
847
  filenameExtension: "txt",
800
848
  schema: [
@@ -812,10 +860,9 @@ var model19 = {
812
860
  }
813
861
  ]
814
862
  };
815
- var networks_default = model19;
816
863
 
817
864
  // src/models/gtfs/pathways.ts
818
- var model20 = {
865
+ var pathways = {
819
866
  filenameBase: "pathways",
820
867
  filenameExtension: "txt",
821
868
  schema: [
@@ -887,10 +934,9 @@ var model20 = {
887
934
  }
888
935
  ]
889
936
  };
890
- var pathways_default = model20;
891
937
 
892
938
  // src/models/gtfs/route-networks.ts
893
- var model21 = {
939
+ var routeNetworks = {
894
940
  filenameBase: "route_networks",
895
941
  filenameExtension: "txt",
896
942
  schema: [
@@ -909,10 +955,9 @@ var model21 = {
909
955
  }
910
956
  ]
911
957
  };
912
- var route_networks_default = model21;
913
958
 
914
959
  // src/models/gtfs/routes.ts
915
- var model22 = {
960
+ var routes = {
916
961
  filenameBase: "routes",
917
962
  filenameExtension: "txt",
918
963
  schema: [
@@ -989,10 +1034,9 @@ var model22 = {
989
1034
  }
990
1035
  ]
991
1036
  };
992
- var routes_default = model22;
993
1037
 
994
1038
  // src/models/gtfs/shapes.ts
995
- var model23 = {
1039
+ var shapes = {
996
1040
  filenameBase: "shapes",
997
1041
  filenameExtension: "txt",
998
1042
  schema: [
@@ -1031,10 +1075,9 @@ var model23 = {
1031
1075
  }
1032
1076
  ]
1033
1077
  };
1034
- var shapes_default = model23;
1035
1078
 
1036
1079
  // src/models/gtfs/stop-areas.ts
1037
- var model24 = {
1080
+ var stopAreas = {
1038
1081
  filenameBase: "stop_areas",
1039
1082
  filenameExtension: "txt",
1040
1083
  schema: [
@@ -1052,10 +1095,9 @@ var model24 = {
1052
1095
  }
1053
1096
  ]
1054
1097
  };
1055
- var stop_areas_default = model24;
1056
1098
 
1057
1099
  // src/models/gtfs/stop-times.ts
1058
- var model25 = {
1100
+ var stopTimes = {
1059
1101
  filenameBase: "stop_times",
1060
1102
  filenameExtension: "txt",
1061
1103
  schema: [
@@ -1173,10 +1215,9 @@ var model25 = {
1173
1215
  }
1174
1216
  ]
1175
1217
  };
1176
- var stop_times_default = model25;
1177
1218
 
1178
1219
  // src/models/gtfs/stops.ts
1179
- var model26 = {
1220
+ var stops = {
1180
1221
  filenameBase: "stops",
1181
1222
  filenameExtension: "txt",
1182
1223
  schema: [
@@ -1259,10 +1300,9 @@ var model26 = {
1259
1300
  }
1260
1301
  ]
1261
1302
  };
1262
- var stops_default = model26;
1263
1303
 
1264
1304
  // src/models/gtfs/timeframes.ts
1265
- var model27 = {
1305
+ var timeframes = {
1266
1306
  filenameBase: "timeframes",
1267
1307
  filenameExtension: "txt",
1268
1308
  schema: [
@@ -1289,10 +1329,9 @@ var model27 = {
1289
1329
  }
1290
1330
  ]
1291
1331
  };
1292
- var timeframes_default = model27;
1293
1332
 
1294
1333
  // src/models/gtfs/transfers.ts
1295
- var model28 = {
1334
+ var transfers = {
1296
1335
  filenameBase: "transfers",
1297
1336
  filenameExtension: "txt",
1298
1337
  schema: [
@@ -1346,10 +1385,9 @@ var model28 = {
1346
1385
  }
1347
1386
  ]
1348
1387
  };
1349
- var transfers_default = model28;
1350
1388
 
1351
1389
  // src/models/gtfs/translations.ts
1352
- var model29 = {
1390
+ var translations = {
1353
1391
  filenameBase: "translations",
1354
1392
  filenameExtension: "txt",
1355
1393
  schema: [
@@ -1395,10 +1433,9 @@ var model29 = {
1395
1433
  }
1396
1434
  ]
1397
1435
  };
1398
- var translations_default = model29;
1399
1436
 
1400
1437
  // src/models/gtfs/trips.ts
1401
- var model30 = {
1438
+ var trips = {
1402
1439
  filenameBase: "trips",
1403
1440
  filenameExtension: "txt",
1404
1441
  schema: [
@@ -1466,10 +1503,9 @@ var model30 = {
1466
1503
  }
1467
1504
  ]
1468
1505
  };
1469
- var trips_default = model30;
1470
1506
 
1471
1507
  // src/models/non-standard/timetables.ts
1472
- var model31 = {
1508
+ var timetables = {
1473
1509
  filenameBase: "timetables",
1474
1510
  filenameExtension: "txt",
1475
1511
  nonstandard: true,
@@ -1611,10 +1647,9 @@ var model31 = {
1611
1647
  }
1612
1648
  ]
1613
1649
  };
1614
- var timetables_default = model31;
1615
1650
 
1616
1651
  // src/models/non-standard/timetable-pages.ts
1617
- var model32 = {
1652
+ var timetablePages = {
1618
1653
  filenameBase: "timetable_pages",
1619
1654
  filenameExtension: "txt",
1620
1655
  nonstandard: true,
@@ -1635,10 +1670,9 @@ var model32 = {
1635
1670
  }
1636
1671
  ]
1637
1672
  };
1638
- var timetable_pages_default = model32;
1639
1673
 
1640
1674
  // src/models/non-standard/timetable-stop-order.ts
1641
- var model33 = {
1675
+ var timetableStopOrder = {
1642
1676
  filenameBase: "timetable_stop_order",
1643
1677
  filenameExtension: "txt",
1644
1678
  nonstandard: true,
@@ -1668,10 +1702,9 @@ var model33 = {
1668
1702
  }
1669
1703
  ]
1670
1704
  };
1671
- var timetable_stop_order_default = model33;
1672
1705
 
1673
1706
  // src/models/non-standard/timetable-notes.ts
1674
- var model34 = {
1707
+ var timetableNotes = {
1675
1708
  filenameBase: "timetable_notes",
1676
1709
  filenameExtension: "txt",
1677
1710
  nonstandard: true,
@@ -1693,10 +1726,9 @@ var model34 = {
1693
1726
  }
1694
1727
  ]
1695
1728
  };
1696
- var timetable_notes_default = model34;
1697
1729
 
1698
1730
  // src/models/non-standard/timetable-notes-references.ts
1699
- var model35 = {
1731
+ var timetableNotesReferences = {
1700
1732
  filenameBase: "timetable_notes_references",
1701
1733
  filenameExtension: "txt",
1702
1734
  nonstandard: true,
@@ -1744,11 +1776,10 @@ var model35 = {
1744
1776
  }
1745
1777
  ]
1746
1778
  };
1747
- var timetable_notes_references_default = model35;
1748
1779
 
1749
1780
  // src/models/non-standard/trips-dated-vehicle-journey.ts
1750
- var model36 = {
1751
- filenameBase: "trips_dated_vehicle_journeys",
1781
+ var tripsDatedVehicleJourney = {
1782
+ filenameBase: "trips_dated_vehicle_journey",
1752
1783
  filenameExtension: "txt",
1753
1784
  nonstandard: true,
1754
1785
  schema: [
@@ -1779,10 +1810,9 @@ var model36 = {
1779
1810
  }
1780
1811
  ]
1781
1812
  };
1782
- var trips_dated_vehicle_journey_default = model36;
1783
1813
 
1784
1814
  // src/models/gtfs-plus/calendar-attributes.ts
1785
- var model37 = {
1815
+ var calendarAttributes = {
1786
1816
  filenameBase: "calendar_attributes",
1787
1817
  filenameExtension: "txt",
1788
1818
  nonstandard: true,
@@ -1802,10 +1832,9 @@ var model37 = {
1802
1832
  }
1803
1833
  ]
1804
1834
  };
1805
- var calendar_attributes_default = model37;
1806
1835
 
1807
1836
  // src/models/gtfs-plus/directions.ts
1808
- var model38 = {
1837
+ var directions = {
1809
1838
  filenameBase: "directions",
1810
1839
  filenameExtension: "txt",
1811
1840
  nonstandard: true,
@@ -1832,10 +1861,9 @@ var model38 = {
1832
1861
  }
1833
1862
  ]
1834
1863
  };
1835
- var directions_default = model38;
1836
1864
 
1837
1865
  // src/models/gtfs-plus/route-attributes.ts
1838
- var model39 = {
1866
+ var routeAttributes = {
1839
1867
  filenameBase: "route_attributes",
1840
1868
  filenameExtension: "txt",
1841
1869
  nonstandard: true,
@@ -1867,10 +1895,9 @@ var model39 = {
1867
1895
  }
1868
1896
  ]
1869
1897
  };
1870
- var route_attributes_default = model39;
1871
1898
 
1872
1899
  // src/models/gtfs-plus/stop-attributes.ts
1873
- var model40 = {
1900
+ var stopAttributes = {
1874
1901
  filenameBase: "stop_attributes",
1875
1902
  filenameExtension: "txt",
1876
1903
  nonstandard: true,
@@ -1903,10 +1930,9 @@ var model40 = {
1903
1930
  }
1904
1931
  ]
1905
1932
  };
1906
- var stop_attributes_default = model40;
1907
1933
 
1908
1934
  // src/models/gtfs-ride/board-alight.ts
1909
- var model41 = {
1935
+ var boardAlight = {
1910
1936
  filenameBase: "board_alight",
1911
1937
  filenameExtension: "txt",
1912
1938
  nonstandard: true,
@@ -2036,10 +2062,9 @@ var model41 = {
2036
2062
  }
2037
2063
  ]
2038
2064
  };
2039
- var board_alight_default = model41;
2040
2065
 
2041
2066
  // src/models/gtfs-ride/rider-trip.ts
2042
- var model42 = {
2067
+ var riderTrip = {
2043
2068
  filenameBase: "rider_trip",
2044
2069
  filenameExtension: "txt",
2045
2070
  nonstandard: true,
@@ -2150,10 +2175,9 @@ var model42 = {
2150
2175
  }
2151
2176
  ]
2152
2177
  };
2153
- var rider_trip_default = model42;
2154
2178
 
2155
2179
  // src/models/gtfs-ride/ridership.ts
2156
- var model43 = {
2180
+ var ridership = {
2157
2181
  filenameBase: "ridership",
2158
2182
  filenameExtension: "txt",
2159
2183
  nonstandard: true,
@@ -2278,10 +2302,9 @@ var model43 = {
2278
2302
  }
2279
2303
  ]
2280
2304
  };
2281
- var ridership_default = model43;
2282
2305
 
2283
2306
  // src/models/gtfs-ride/trip-capacity.ts
2284
- var model44 = {
2307
+ var tripCapacity = {
2285
2308
  filenameBase: "trip_capacity",
2286
2309
  filenameExtension: "txt",
2287
2310
  nonstandard: true,
@@ -2330,10 +2353,9 @@ var model44 = {
2330
2353
  }
2331
2354
  ]
2332
2355
  };
2333
- var trip_capacity_default = model44;
2334
2356
 
2335
2357
  // src/models/gtfs-ride/ride-feed-info.ts
2336
- var model45 = {
2358
+ var rideFeedInfo = {
2337
2359
  filenameBase: "ride_feed_info",
2338
2360
  filenameExtension: "txt",
2339
2361
  nonstandard: true,
@@ -2371,10 +2393,9 @@ var model45 = {
2371
2393
  }
2372
2394
  ]
2373
2395
  };
2374
- var ride_feed_info_default = model45;
2375
2396
 
2376
2397
  // src/models/gtfs-realtime/trip-updates.ts
2377
- var model46 = {
2398
+ var tripUpdates = {
2378
2399
  filenameBase: "trip_updates",
2379
2400
  extension: "gtfs-realtime",
2380
2401
  schema: [
@@ -2449,10 +2470,9 @@ var model46 = {
2449
2470
  }
2450
2471
  ]
2451
2472
  };
2452
- var trip_updates_default = model46;
2453
2473
 
2454
2474
  // src/models/gtfs-realtime/stop-time-updates.ts
2455
- var model47 = {
2475
+ var stopTimeUpdates = {
2456
2476
  filenameBase: "stop_time_updates",
2457
2477
  extension: "gtfs-realtime",
2458
2478
  schema: [
@@ -2537,10 +2557,9 @@ var model47 = {
2537
2557
  }
2538
2558
  ]
2539
2559
  };
2540
- var stop_time_updates_default = model47;
2541
2560
 
2542
2561
  // src/models/gtfs-realtime/vehicle-positions.ts
2543
- var model48 = {
2562
+ var vehiclePositions = {
2544
2563
  filenameBase: "vehicle_positions",
2545
2564
  extension: "gtfs-realtime",
2546
2565
  schema: [
@@ -2675,10 +2694,9 @@ var model48 = {
2675
2694
  }
2676
2695
  ]
2677
2696
  };
2678
- var vehicle_positions_default = model48;
2679
2697
 
2680
2698
  // src/models/gtfs-realtime/service-alerts.ts
2681
- var model49 = {
2699
+ var serviceAlerts = {
2682
2700
  filenameBase: "service_alerts",
2683
2701
  extension: "gtfs-realtime",
2684
2702
  schema: [
@@ -2738,10 +2756,9 @@ var model49 = {
2738
2756
  }
2739
2757
  ]
2740
2758
  };
2741
- var service_alerts_default = model49;
2742
2759
 
2743
2760
  // src/models/gtfs-realtime/service-alert-targets.ts
2744
- var model50 = {
2761
+ var serviceAlertTargets = {
2745
2762
  filenameBase: "service_alert_targets",
2746
2763
  extension: "gtfs-realtime",
2747
2764
  schema: [
@@ -2778,10 +2795,9 @@ var model50 = {
2778
2795
  }
2779
2796
  ]
2780
2797
  };
2781
- var service_alert_targets_default = model50;
2782
2798
 
2783
2799
  // src/models/ods/deadhead-times.ts
2784
- var model51 = {
2800
+ var deadheadTimes = {
2785
2801
  filenameBase: "deadhead_times",
2786
2802
  filenameExtension: "txt",
2787
2803
  nonstandard: true,
@@ -2844,10 +2860,9 @@ var model51 = {
2844
2860
  }
2845
2861
  ]
2846
2862
  };
2847
- var deadhead_times_default = model51;
2848
2863
 
2849
2864
  // src/models/ods/deadheads.ts
2850
- var model52 = {
2865
+ var deadheads = {
2851
2866
  filenameBase: "deadheads",
2852
2867
  filenameExtension: "txt",
2853
2868
  nonstandard: true,
@@ -2905,10 +2920,9 @@ var model52 = {
2905
2920
  }
2906
2921
  ]
2907
2922
  };
2908
- var deadheads_default = model52;
2909
2923
 
2910
2924
  // src/models/ods/ops-locations.ts
2911
- var model53 = {
2925
+ var opsLocations = {
2912
2926
  filenameBase: "ops_locations",
2913
2927
  filenameExtension: "txt",
2914
2928
  nonstandard: true,
@@ -2952,10 +2966,9 @@ var model53 = {
2952
2966
  }
2953
2967
  ]
2954
2968
  };
2955
- var ops_locations_default = model53;
2956
2969
 
2957
2970
  // src/models/ods/run-events.ts
2958
- var model54 = {
2971
+ var runEvents = {
2959
2972
  filenameBase: "run_event",
2960
2973
  filenameExtension: "txt",
2961
2974
  nonstandard: true,
@@ -3023,10 +3036,9 @@ var model54 = {
3023
3036
  }
3024
3037
  ]
3025
3038
  };
3026
- var run_events_default = model54;
3027
3039
 
3028
3040
  // src/models/ods/runs-pieces.ts
3029
- var model55 = {
3041
+ var runsPieces = {
3030
3042
  filenameBase: "runs_pieces",
3031
3043
  filenameExtension: "txt",
3032
3044
  nonstandard: true,
@@ -3083,67 +3095,6 @@ var model55 = {
3083
3095
  }
3084
3096
  ]
3085
3097
  };
3086
- var runs_pieces_default = model55;
3087
-
3088
- // src/models/models.ts
3089
- var models = [
3090
- agency_default,
3091
- areas_default,
3092
- attributions_default,
3093
- booking_rules_default,
3094
- calendar_dates_default,
3095
- calendar_default,
3096
- fare_attributes_default,
3097
- fare_leg_rules_default,
3098
- fare_media_default,
3099
- fare_products_default,
3100
- fare_rules_default,
3101
- fare_transfer_rules_default,
3102
- feed_info_default,
3103
- frequencies_default,
3104
- levels_default,
3105
- location_groups_default,
3106
- location_group_stops_default,
3107
- locations_default,
3108
- networks_default,
3109
- pathways_default,
3110
- route_networks_default,
3111
- routes_default,
3112
- shapes_default,
3113
- stop_areas_default,
3114
- stop_times_default,
3115
- stops_default,
3116
- timeframes_default,
3117
- transfers_default,
3118
- translations_default,
3119
- trips_default,
3120
- timetables_default,
3121
- timetable_pages_default,
3122
- timetable_stop_order_default,
3123
- timetable_notes_default,
3124
- timetable_notes_references_default,
3125
- trips_dated_vehicle_journey_default,
3126
- calendar_attributes_default,
3127
- directions_default,
3128
- route_attributes_default,
3129
- stop_attributes_default,
3130
- board_alight_default,
3131
- ride_feed_info_default,
3132
- rider_trip_default,
3133
- ridership_default,
3134
- trip_capacity_default,
3135
- trip_updates_default,
3136
- stop_time_updates_default,
3137
- vehicle_positions_default,
3138
- service_alerts_default,
3139
- service_alert_targets_default,
3140
- deadhead_times_default,
3141
- deadheads_default,
3142
- ops_locations_default,
3143
- run_events_default,
3144
- runs_pieces_default
3145
- ];
3146
- var models_default = models;
3147
3098
 
3148
3099
  // src/lib/db.ts
3149
3100
  import fs from "fs";
@@ -3269,9 +3220,9 @@ function isValidLineString(lineString) {
3269
3220
  }
3270
3221
  return true;
3271
3222
  }
3272
- function consolidateShapes(shapes) {
3223
+ function consolidateShapes(shapes2) {
3273
3224
  const keys = /* @__PURE__ */ new Set();
3274
- const segmentsArray = shapes.map(
3225
+ const segmentsArray = shapes2.map(
3275
3226
  (shape) => shape.reduce(
3276
3227
  (memo, point, idx) => {
3277
3228
  if (idx > 0) {
@@ -3313,11 +3264,17 @@ function formatHexColor(color) {
3313
3264
  return `#${color}`;
3314
3265
  }
3315
3266
  function formatProperties(properties) {
3316
- const formattedProperties = {
3317
- ...cloneDeep(omitBy(properties, (value) => value === null)),
3318
- route_color: formatHexColor(properties.route_color),
3319
- route_text_color: formatHexColor(properties.route_text_color)
3320
- };
3267
+ const formattedProperties = cloneDeep(
3268
+ omitBy(properties, (value) => value === null || value === void 0)
3269
+ );
3270
+ const formattedRouteColor = formatHexColor(properties.route_color);
3271
+ const formattedRouteTextColor = formatHexColor(properties.route_text_color);
3272
+ if (formattedRouteColor) {
3273
+ formattedProperties.route_color = formattedRouteColor;
3274
+ }
3275
+ if (formattedRouteTextColor) {
3276
+ formattedProperties.route_text_color = formattedRouteTextColor;
3277
+ }
3321
3278
  if (properties.routes) {
3322
3279
  formattedProperties.routes = properties.routes.map(
3323
3280
  (route) => formatProperties(route)
@@ -3325,23 +3282,21 @@ function formatProperties(properties) {
3325
3282
  }
3326
3283
  return formattedProperties;
3327
3284
  }
3328
- function shapesToGeoJSONFeatures(shapes, properties = {}) {
3329
- const shapeGroups = Object.values(groupBy(shapes, "shape_id")).map(
3285
+ function shapesToGeoJSONFeature(shapes2, properties = {}) {
3286
+ const shapeGroups = Object.values(groupBy(shapes2, "shape_id")).map(
3330
3287
  (shapeGroup) => sortBy(shapeGroup, "shape_pt_sequence")
3331
3288
  );
3332
3289
  const lineStrings = consolidateShapes(shapeGroups);
3333
- return lineStrings.map(
3334
- (lineString) => feature(
3335
- {
3336
- type: "LineString",
3337
- coordinates: lineString
3338
- },
3339
- formatProperties(properties)
3340
- )
3290
+ return feature(
3291
+ {
3292
+ type: "MultiLineString",
3293
+ coordinates: lineStrings
3294
+ },
3295
+ formatProperties(properties)
3341
3296
  );
3342
3297
  }
3343
- function stopsToGeoJSON(stops) {
3344
- const features = stops.map(
3298
+ function stopsToGeoJSONFeatureCollection(stops2) {
3299
+ const features = stops2.map(
3345
3300
  (stop) => feature(
3346
3301
  {
3347
3302
  type: "Point",
@@ -3414,8 +3369,8 @@ function validateConfigForImport(config) {
3414
3369
  if (!config.agencies || config.agencies.length === 0) {
3415
3370
  throw new Error("No `agencies` specified in config");
3416
3371
  }
3417
- for (const [index, agency] of config.agencies.entries()) {
3418
- if (!agency.path && !agency.url) {
3372
+ for (const [index, agency2] of config.agencies.entries()) {
3373
+ if (!agency2.path && !agency2.url) {
3419
3374
  throw new Error(
3420
3375
  `No Agency \`url\` or \`path\` specified in config for agency index ${index}.`
3421
3376
  );
@@ -3636,25 +3591,6 @@ var updateRealtimeData = async (task) => {
3636
3591
  const db = openDb({
3637
3592
  sqlitePath: task.sqlitePath
3638
3593
  });
3639
- const vehiclePositionsModel = models_default.find(
3640
- (x) => x.filenameBase === "vehicle_positions"
3641
- );
3642
- const tripUpdatesModel = models_default.find(
3643
- (x) => x.filenameBase === "trip_updates"
3644
- );
3645
- const stoptimeUpdatesModel = models_default.find(
3646
- (x) => x.filenameBase === "stop_time_updates"
3647
- );
3648
- const serviceAlertsModel = models_default.find(
3649
- (x) => x.filenameBase === "service_alerts"
3650
- );
3651
- const serviceAlertTargetsModel = models_default.find(
3652
- (x) => x.filenameBase === "service_alert_targets"
3653
- );
3654
- if (!vehiclePositionsModel || !tripUpdatesModel || !stoptimeUpdatesModel || !serviceAlertsModel || !serviceAlertTargetsModel) {
3655
- task.logError("GTFS-Realtime models definitions not found");
3656
- return;
3657
- }
3658
3594
  task.log(
3659
3595
  `Starting GTFS-Realtime import from ${task.realtime_urls.length} urls`
3660
3596
  );
@@ -3667,25 +3603,25 @@ var updateRealtimeData = async (task) => {
3667
3603
  task.log(`Download successful`);
3668
3604
  let totalLineCount = 0;
3669
3605
  for (const entity of gtfsRealtimeData.entity) {
3670
- let model56;
3606
+ let model;
3671
3607
  if (entity.vehicle) {
3672
- model56 = vehiclePositionsModel;
3608
+ model = vehiclePositions;
3673
3609
  }
3674
3610
  if (entity.tripUpdate) {
3675
- model56 = tripUpdatesModel;
3611
+ model = tripUpdates;
3676
3612
  }
3677
3613
  if (entity.alert) {
3678
- model56 = serviceAlertsModel;
3614
+ model = serviceAlerts;
3679
3615
  }
3680
- if (!model56) {
3616
+ if (!model) {
3681
3617
  break;
3682
3618
  }
3683
- const fieldValues = model56.schema.map(
3619
+ const fieldValues = model.schema.map(
3684
3620
  (column) => prepareRealtimeValue(entity, column, task)
3685
3621
  );
3686
3622
  try {
3687
3623
  db.prepare(
3688
- `REPLACE INTO ${model56.filenameBase} (${model56.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3624
+ `REPLACE INTO ${model.filenameBase} (${model.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3689
3625
  ).run();
3690
3626
  } catch (error) {
3691
3627
  task.logWarning("Import error: " + error.message);
@@ -3694,7 +3630,7 @@ var updateRealtimeData = async (task) => {
3694
3630
  const stopTimeUpdateArray = [];
3695
3631
  for (const stopTimeUpdate of entity.tripUpdate.stopTimeUpdate) {
3696
3632
  stopTimeUpdate.parent = entity;
3697
- const subValues = stoptimeUpdatesModel.schema.map(
3633
+ const subValues = stopTimeUpdates.schema.map(
3698
3634
  (column) => prepareRealtimeValue(stopTimeUpdate, column, task)
3699
3635
  );
3700
3636
  stopTimeUpdateArray.push(`(${subValues.join(", ")})`);
@@ -3702,7 +3638,7 @@ var updateRealtimeData = async (task) => {
3702
3638
  }
3703
3639
  try {
3704
3640
  db.prepare(
3705
- `REPLACE INTO ${stoptimeUpdatesModel.filenameBase} (${stoptimeUpdatesModel.schema.map((column) => column.name).join(", ")}) VALUES ${stopTimeUpdateArray.join(", ")}`
3641
+ `REPLACE INTO ${stopTimeUpdates.filenameBase} (${stopTimeUpdates.schema.map((column) => column.name).join(", ")}) VALUES ${stopTimeUpdateArray.join(", ")}`
3706
3642
  ).run();
3707
3643
  } catch (error) {
3708
3644
  task.logWarning("Import error: " + error.message);
@@ -3712,7 +3648,7 @@ var updateRealtimeData = async (task) => {
3712
3648
  const alertTargetArray = [];
3713
3649
  for (const informedEntity of entity.alert.informedEntity) {
3714
3650
  informedEntity.parent = entity;
3715
- const subValues = serviceAlertTargetsModel.schema.map(
3651
+ const subValues = serviceAlertTargets.schema.map(
3716
3652
  (column) => prepareRealtimeValue(informedEntity, column, task)
3717
3653
  );
3718
3654
  alertTargetArray.push(`(${subValues.join(", ")})`);
@@ -3720,7 +3656,7 @@ var updateRealtimeData = async (task) => {
3720
3656
  }
3721
3657
  try {
3722
3658
  db.prepare(
3723
- `REPLACE INTO ${serviceAlertTargetsModel.filenameBase} (${serviceAlertTargetsModel.schema.map((column) => column.name).join(", ")}) VALUES ${alertTargetArray.join(", ")}`
3659
+ `REPLACE INTO ${serviceAlertTargets.filenameBase} (${serviceAlertTargets.schema.map((column) => column.name).join(", ")}) VALUES ${alertTargetArray.join(", ")}`
3724
3660
  ).run();
3725
3661
  } catch (error) {
3726
3662
  task.logWarning("Import error: " + error.message);
@@ -3785,11 +3721,11 @@ var readFiles = async (task) => {
3785
3721
  }
3786
3722
  };
3787
3723
  var createTables = (db) => {
3788
- for (const model56 of models_default) {
3789
- if (!model56.schema) {
3724
+ for (const model of Object.values(models_exports)) {
3725
+ if (!model.schema) {
3790
3726
  return;
3791
3727
  }
3792
- const columns = model56.schema.map((column) => {
3728
+ const columns = model.schema.map((column) => {
3793
3729
  let check = "";
3794
3730
  if (column.min !== void 0 && column.max) {
3795
3731
  check = `CHECK( ${column.name} >= ${column.min} AND ${column.name} <= ${column.max} )`;
@@ -3803,34 +3739,34 @@ var createTables = (db) => {
3803
3739
  const columnCollation = column.nocase ? "COLLATE NOCASE" : "";
3804
3740
  return `${column.name} ${column.type} ${check} ${required} ${columnDefault} ${columnCollation}`;
3805
3741
  });
3806
- const primaryColumns = model56.schema.filter((column) => column.primary);
3742
+ const primaryColumns = model.schema.filter((column) => column.primary);
3807
3743
  if (primaryColumns.length > 0) {
3808
3744
  columns.push(
3809
3745
  `PRIMARY KEY (${primaryColumns.map((column) => column.name).join(", ")})`
3810
3746
  );
3811
3747
  }
3812
- db.prepare(`DROP TABLE IF EXISTS ${model56.filenameBase};`).run();
3748
+ db.prepare(`DROP TABLE IF EXISTS ${model.filenameBase};`).run();
3813
3749
  db.prepare(
3814
- `CREATE TABLE ${model56.filenameBase} (${columns.join(", ")});`
3750
+ `CREATE TABLE ${model.filenameBase} (${columns.join(", ")});`
3815
3751
  ).run();
3816
- for (const column of model56.schema.filter((column2) => column2.index)) {
3752
+ for (const column of model.schema.filter((column2) => column2.index)) {
3817
3753
  db.prepare(
3818
- `CREATE INDEX idx_${model56.filenameBase}_${column.name} ON ${model56.filenameBase} (${column.name});`
3754
+ `CREATE INDEX idx_${model.filenameBase}_${column.name} ON ${model.filenameBase} (${column.name});`
3819
3755
  ).run();
3820
3756
  }
3821
3757
  }
3822
3758
  };
3823
- var formatLine = (line, model56, totalLineCount) => {
3759
+ var formatLine = (line, model, totalLineCount) => {
3824
3760
  const lineNumber = totalLineCount + 1;
3825
3761
  const formattedLine = {};
3826
- for (const columnSchema of model56.schema) {
3762
+ for (const columnSchema of model.schema) {
3827
3763
  const lineValue = line[columnSchema.name];
3828
3764
  if (columnSchema.type === "date") {
3829
3765
  if (lineValue !== "" && lineValue !== void 0) {
3830
3766
  const dateValue = lineValue.replace(/-/g, "");
3831
3767
  if (dateValue.length !== 8) {
3832
3768
  throw new Error(
3833
- `Invalid date in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3769
+ `Invalid date in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3834
3770
  );
3835
3771
  }
3836
3772
  formattedLine[columnSchema.name] = Number.parseInt(dateValue, 10);
@@ -3847,17 +3783,17 @@ var formatLine = (line, model56, totalLineCount) => {
3847
3783
  }
3848
3784
  if (columnSchema.required === true && formattedLine[columnSchema.name] === null) {
3849
3785
  throw new Error(
3850
- `Missing required value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3786
+ `Missing required value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3851
3787
  );
3852
3788
  }
3853
3789
  if (columnSchema.min !== void 0 && formattedLine[columnSchema.name] < columnSchema.min) {
3854
3790
  throw new Error(
3855
- `Invalid value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: below minimum value of ${columnSchema.min}.`
3791
+ `Invalid value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: below minimum value of ${columnSchema.min}.`
3856
3792
  );
3857
3793
  }
3858
3794
  if (columnSchema.max !== void 0 && formattedLine[columnSchema.name] > columnSchema.max) {
3859
3795
  throw new Error(
3860
- `Invalid value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: above maximum value of ${columnSchema.max}.`
3796
+ `Invalid value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: above maximum value of ${columnSchema.max}.`
3861
3797
  );
3862
3798
  }
3863
3799
  }
@@ -3883,7 +3819,7 @@ var formatLine = (line, model56, totalLineCount) => {
3883
3819
  }
3884
3820
  return formattedLine;
3885
3821
  };
3886
- var importLines = (task, lines, model56, totalLineCount) => {
3822
+ var importLines = (task, lines, model, totalLineCount) => {
3887
3823
  const db = openDb({
3888
3824
  sqlitePath: task.sqlitePath
3889
3825
  });
@@ -3891,7 +3827,7 @@ var importLines = (task, lines, model56, totalLineCount) => {
3891
3827
  return;
3892
3828
  }
3893
3829
  const linesToImportCount = lines.length;
3894
- const columns = model56.schema.filter((column) => column.name !== "id");
3830
+ const columns = model.schema.filter((column) => column.name !== "id");
3895
3831
  const placeholders = [];
3896
3832
  const values = [];
3897
3833
  while (lines.length > 0) {
@@ -3911,59 +3847,59 @@ var importLines = (task, lines, model56, totalLineCount) => {
3911
3847
  }
3912
3848
  try {
3913
3849
  db.prepare(
3914
- `INSERT ${task.ignoreDuplicates ? "OR IGNORE" : ""} INTO ${model56.filenameBase} (${columns.map((column) => column.name).join(", ")}) VALUES ${placeholders.join(",")}`
3850
+ `INSERT ${task.ignoreDuplicates ? "OR IGNORE" : ""} INTO ${model.filenameBase} (${columns.map((column) => column.name).join(", ")}) VALUES ${placeholders.join(",")}`
3915
3851
  ).run(...values);
3916
3852
  } catch (error) {
3917
3853
  if (error.code === "SQLITE_CONSTRAINT_PRIMARYKEY") {
3918
- const primaryColumns = model56.schema.filter((column) => column.primary);
3854
+ const primaryColumns = model.schema.filter((column) => column.primary);
3919
3855
  task.logWarning(
3920
- `Duplicate values for primary key (${primaryColumns.map((column) => column.name).join(", ")}) found in ${model56.filenameBase}.${model56.filenameExtension}. Set the \`ignoreDuplicates\` option to true in config.json to ignore this error`
3856
+ `Duplicate values for primary key (${primaryColumns.map((column) => column.name).join(", ")}) found in ${model.filenameBase}.${model.filenameExtension}. Set the \`ignoreDuplicates\` option to true in config.json to ignore this error`
3921
3857
  );
3922
3858
  }
3923
3859
  task.logWarning(
3924
- `Check ${model56.filenameBase}.${model56.filenameExtension} for invalid data between lines ${totalLineCount - linesToImportCount} and ${totalLineCount}.`
3860
+ `Check ${model.filenameBase}.${model.filenameExtension} for invalid data between lines ${totalLineCount - linesToImportCount} and ${totalLineCount}.`
3925
3861
  );
3926
3862
  throw error;
3927
3863
  }
3928
3864
  task.log(
3929
- `Importing - ${model56.filenameBase}.${model56.filenameExtension} - ${totalLineCount} lines imported\r`,
3865
+ `Importing - ${model.filenameBase}.${model.filenameExtension} - ${totalLineCount} lines imported\r`,
3930
3866
  true
3931
3867
  );
3932
3868
  };
3933
3869
  var importFiles = (task) => mapSeries(
3934
- models_default,
3935
- (model56) => new Promise((resolve, reject) => {
3870
+ Object.values(models_exports),
3871
+ (model) => new Promise((resolve, reject) => {
3936
3872
  const lines = [];
3937
3873
  let totalLineCount = 0;
3938
3874
  const maxInsertVariables = 32e3;
3939
- if (task.exclude && task.exclude.includes(model56.filenameBase)) {
3875
+ if (task.exclude && task.exclude.includes(model.filenameBase)) {
3940
3876
  task.log(
3941
- `Skipping - ${model56.filenameBase}.${model56.filenameExtension}\r`
3877
+ `Skipping - ${model.filenameBase}.${model.filenameExtension}\r`
3942
3878
  );
3943
3879
  resolve();
3944
3880
  return;
3945
3881
  }
3946
- if (model56.extension === "gtfs-realtime") {
3882
+ if (model.extension === "gtfs-realtime") {
3947
3883
  resolve();
3948
3884
  return;
3949
3885
  }
3950
3886
  const filepath = path.join(
3951
3887
  task.downloadDir,
3952
- `${model56.filenameBase}.${model56.filenameExtension}`
3888
+ `${model.filenameBase}.${model.filenameExtension}`
3953
3889
  );
3954
3890
  if (!existsSync(filepath)) {
3955
- if (!model56.nonstandard) {
3891
+ if (!model.nonstandard) {
3956
3892
  task.log(
3957
- `Importing - ${model56.filenameBase}.${model56.filenameExtension} - No file found\r`
3893
+ `Importing - ${model.filenameBase}.${model.filenameExtension} - No file found\r`
3958
3894
  );
3959
3895
  }
3960
3896
  resolve();
3961
3897
  return;
3962
3898
  }
3963
3899
  task.log(
3964
- `Importing - ${model56.filenameBase}.${model56.filenameExtension}\r`
3900
+ `Importing - ${model.filenameBase}.${model.filenameExtension}\r`
3965
3901
  );
3966
- if (model56.filenameExtension === "txt") {
3902
+ if (model.filenameExtension === "txt") {
3967
3903
  const parser = parse({
3968
3904
  columns: true,
3969
3905
  relax_quotes: true,
@@ -3976,9 +3912,9 @@ var importFiles = (task) => mapSeries(
3976
3912
  while (record = parser.read()) {
3977
3913
  try {
3978
3914
  totalLineCount += 1;
3979
- lines.push(formatLine(record, model56, totalLineCount));
3980
- if (lines.length >= maxInsertVariables / model56.schema.length) {
3981
- importLines(task, lines, model56, totalLineCount);
3915
+ lines.push(formatLine(record, model, totalLineCount));
3916
+ if (lines.length >= maxInsertVariables / model.schema.length) {
3917
+ importLines(task, lines, model, totalLineCount);
3982
3918
  }
3983
3919
  } catch (error) {
3984
3920
  reject(error);
@@ -3987,7 +3923,7 @@ var importFiles = (task) => mapSeries(
3987
3923
  });
3988
3924
  parser.on("end", () => {
3989
3925
  try {
3990
- importLines(task, lines, model56, totalLineCount);
3926
+ importLines(task, lines, model, totalLineCount);
3991
3927
  } catch (error) {
3992
3928
  reject(error);
3993
3929
  }
@@ -3995,22 +3931,22 @@ var importFiles = (task) => mapSeries(
3995
3931
  });
3996
3932
  parser.on("error", reject);
3997
3933
  createReadStream(filepath).pipe(stripBomStream()).pipe(parser);
3998
- } else if (model56.filenameExtension === "geojson") {
3934
+ } else if (model.filenameExtension === "geojson") {
3999
3935
  readFile2(filepath, "utf8").then((data) => {
4000
3936
  if (isValidJSON(data) === false) {
4001
3937
  reject(
4002
3938
  new Error(
4003
- `Invalid JSON in ${model56.filenameBase}.${model56.filenameExtension}`
3939
+ `Invalid JSON in ${model.filenameBase}.${model.filenameExtension}`
4004
3940
  )
4005
3941
  );
4006
3942
  }
4007
- const line = formatLine({ geojson: data }, model56, totalLineCount);
4008
- importLines(task, [line], model56, totalLineCount);
3943
+ const line = formatLine({ geojson: data }, model, totalLineCount);
3944
+ importLines(task, [line], model, totalLineCount);
4009
3945
  resolve();
4010
3946
  }).catch(reject);
4011
3947
  } else {
4012
3948
  reject(
4013
- new Error(`Unsupported file type: ${model56.filenameExtension}`)
3949
+ new Error(`Unsupported file type: ${model.filenameExtension}`)
4014
3950
  );
4015
3951
  }
4016
3952
  })
@@ -4034,22 +3970,22 @@ async function importGtfs(initialConfig) {
4034
3970
  createTables(db);
4035
3971
  await mapSeries(
4036
3972
  config.agencies,
4037
- async (agency) => {
3973
+ async (agency2) => {
4038
3974
  const tempPath = temporaryDirectory();
4039
3975
  const task = {
4040
- exclude: agency.exclude,
4041
- agency_url: agency.url,
4042
- headers: agency.headers,
4043
- realtime_headers: agency.realtimeHeaders,
4044
- realtime_urls: agency.realtimeUrls,
3976
+ exclude: agency2.exclude,
3977
+ agency_url: agency2.url,
3978
+ headers: agency2.headers,
3979
+ realtime_headers: agency2.realtimeHeaders,
3980
+ realtime_urls: agency2.realtimeUrls,
4045
3981
  downloadDir: tempPath,
4046
3982
  downloadTimeout: config.downloadTimeout,
4047
3983
  gtfsRealtimeExpirationSeconds: config.gtfsRealtimeExpirationSeconds,
4048
- path: agency.path,
3984
+ path: agency2.path,
4049
3985
  csvOptions: config.csvOptions || {},
4050
3986
  ignoreDuplicates: config.ignoreDuplicates,
4051
3987
  sqlitePath: config.sqlitePath,
4052
- prefix: agency.prefix,
3988
+ prefix: agency2.prefix,
4053
3989
  currentTimestamp: Math.floor(Date.now() / 1e3),
4054
3990
  log: log2,
4055
3991
  logWarning: logWarning2,
@@ -4103,13 +4039,13 @@ async function updateGtfsRealtime(initialConfig) {
4103
4039
  );
4104
4040
  deleteExpiredRealtimeData(config);
4105
4041
  await Promise.all(
4106
- config.agencies.map(async (agency) => {
4107
- if (agency.realtimeUrls === void 0) {
4042
+ config.agencies.map(async (agency2) => {
4043
+ if (agency2.realtimeUrls === void 0) {
4108
4044
  return;
4109
4045
  }
4110
4046
  const task = {
4111
- realtime_headers: agency.realtimeHeaders,
4112
- realtime_urls: agency.realtimeUrls,
4047
+ realtime_headers: agency2.realtimeHeaders,
4048
+ realtime_urls: agency2.realtimeUrls,
4113
4049
  downloadTimeout: config.downloadTimeout,
4114
4050
  gtfsRealtimeExpirationSeconds: config.gtfsRealtimeExpirationSeconds,
4115
4051
  sqlitePath: config.sqlitePath,
@@ -4189,27 +4125,27 @@ var exportGtfs = async (initialConfig) => {
4189
4125
  const defaultExportPath = path2.join(process.cwd(), "gtfs-export", folderName);
4190
4126
  const exportPath = untildify4(config.exportPath || defaultExportPath);
4191
4127
  await prepDirectory(exportPath);
4192
- const modelsToExport = models_default.filter(
4193
- (model56) => model56.extension !== "gtfs-realtime"
4128
+ const modelsToExport = Object.values(models_exports).filter(
4129
+ (model) => model.extension !== "gtfs-realtime"
4194
4130
  );
4195
4131
  const exportedFiles = await mapSeries2(
4196
4132
  modelsToExport,
4197
- async (model56) => {
4133
+ async (model) => {
4198
4134
  const filePath = path2.join(
4199
4135
  exportPath,
4200
- `${model56.filenameBase}.${model56.filenameExtension}`
4136
+ `${model.filenameBase}.${model.filenameExtension}`
4201
4137
  );
4202
- const tableName = sqlString3.escapeId(model56.filenameBase);
4138
+ const tableName = sqlString3.escapeId(model.filenameBase);
4203
4139
  const lines = db.prepare(`SELECT * FROM ${tableName};`).all();
4204
4140
  if (!lines || lines.length === 0) {
4205
- if (!model56.nonstandard) {
4141
+ if (!model.nonstandard) {
4206
4142
  log2(
4207
- `Skipping (no data) - ${model56.filenameBase}.${model56.filenameExtension}\r`
4143
+ `Skipping (no data) - ${model.filenameBase}.${model.filenameExtension}\r`
4208
4144
  );
4209
4145
  }
4210
4146
  return;
4211
4147
  }
4212
- if (model56.filenameExtension === "txt") {
4148
+ if (model.filenameExtension === "txt") {
4213
4149
  const excludeColumns = [
4214
4150
  "id",
4215
4151
  "arrival_timestamp",
@@ -4223,7 +4159,7 @@ var exportGtfs = async (initialConfig) => {
4223
4159
  "ridership_start_timestamp",
4224
4160
  "ridership_end_timestamp"
4225
4161
  ];
4226
- if (model56.filenameBase === "routes") {
4162
+ if (model.filenameBase === "routes") {
4227
4163
  const routesWithAgencyId = db.prepare(
4228
4164
  "SELECT agency_id FROM routes WHERE agency_id IS NOT NULL;"
4229
4165
  ).all();
@@ -4232,21 +4168,21 @@ var exportGtfs = async (initialConfig) => {
4232
4168
  }
4233
4169
  }
4234
4170
  const columns = without(
4235
- model56.schema.map((column) => column.name),
4171
+ model.schema.map((column) => column.name),
4236
4172
  ...excludeColumns
4237
4173
  );
4238
4174
  const fileText = await stringify(lines, { columns, header: true });
4239
4175
  await writeFile2(filePath, fileText);
4240
- } else if (model56.filenameExtension === "geojson") {
4176
+ } else if (model.filenameExtension === "geojson") {
4241
4177
  const fileText = lines?.[0].geojson ?? "";
4242
4178
  await writeFile2(filePath, fileText);
4243
4179
  } else {
4244
4180
  throw new Error(
4245
- `Unexpected filename extension: ${model56.filenameExtension}`
4181
+ `Unexpected filename extension: ${model.filenameExtension}`
4246
4182
  );
4247
4183
  }
4248
- log2(`Exporting - ${model56.filenameBase}.${model56.filenameExtension}\r`);
4249
- return `${model56.filenameBase}.${model56.filenameExtension}`;
4184
+ log2(`Exporting - ${model.filenameBase}.${model.filenameExtension}\r`);
4185
+ return `${model.filenameBase}.${model.filenameExtension}`;
4250
4186
  }
4251
4187
  );
4252
4188
  if (compact(exportedFiles).length === 0) {
@@ -4281,10 +4217,9 @@ function advancedQuery(table, advancedQueryOptions) {
4281
4217
  }
4282
4218
 
4283
4219
  // src/lib/gtfs/agencies.ts
4284
- import sqlString5 from "sqlstring-sqlite";
4285
4220
  function getAgencies2(query = {}, fields = [], orderBy2 = [], options = {}) {
4286
4221
  const db = options.db ?? openDb();
4287
- const tableName = sqlString5.escapeId(agency_default.filenameBase);
4222
+ const tableName = "agency";
4288
4223
  const selectClause = formatSelectClause(fields);
4289
4224
  const whereClause = formatWhereClauses(query);
4290
4225
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4294,10 +4229,9 @@ function getAgencies2(query = {}, fields = [], orderBy2 = [], options = {}) {
4294
4229
  }
4295
4230
 
4296
4231
  // src/lib/gtfs/areas.ts
4297
- import sqlString6 from "sqlstring-sqlite";
4298
4232
  function getAreas(query = {}, fields = [], orderBy2 = [], options = {}) {
4299
4233
  const db = options.db ?? openDb();
4300
- const tableName = sqlString6.escapeId(areas_default.filenameBase);
4234
+ const tableName = "areas";
4301
4235
  const selectClause = formatSelectClause(fields);
4302
4236
  const whereClause = formatWhereClauses(query);
4303
4237
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4307,10 +4241,9 @@ function getAreas(query = {}, fields = [], orderBy2 = [], options = {}) {
4307
4241
  }
4308
4242
 
4309
4243
  // src/lib/gtfs/attributions.ts
4310
- import sqlString7 from "sqlstring-sqlite";
4311
4244
  function getAttributions(query = {}, fields = [], orderBy2 = [], options = {}) {
4312
4245
  const db = options.db ?? openDb();
4313
- const tableName = sqlString7.escapeId(attributions_default.filenameBase);
4246
+ const tableName = "attributions";
4314
4247
  const selectClause = formatSelectClause(fields);
4315
4248
  const whereClause = formatWhereClauses(query);
4316
4249
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4320,10 +4253,9 @@ function getAttributions(query = {}, fields = [], orderBy2 = [], options = {}) {
4320
4253
  }
4321
4254
 
4322
4255
  // src/lib/gtfs/booking-rules.ts
4323
- import sqlString8 from "sqlstring-sqlite";
4324
4256
  function getBookingRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4325
4257
  const db = options.db ?? openDb();
4326
- const tableName = sqlString8.escapeId(booking_rules_default.filenameBase);
4258
+ const tableName = "booking_rules";
4327
4259
  const selectClause = formatSelectClause(fields);
4328
4260
  const whereClause = formatWhereClauses(query);
4329
4261
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4333,10 +4265,9 @@ function getBookingRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4333
4265
  }
4334
4266
 
4335
4267
  // src/lib/gtfs/calendar-dates.ts
4336
- import sqlString9 from "sqlstring-sqlite";
4337
4268
  function getCalendarDates(query = {}, fields = [], orderBy2 = [], options = {}) {
4338
4269
  const db = options.db ?? openDb();
4339
- const tableName = sqlString9.escapeId(calendar_dates_default.filenameBase);
4270
+ const tableName = "calendar_dates";
4340
4271
  const selectClause = formatSelectClause(fields);
4341
4272
  const whereClause = formatWhereClauses(query);
4342
4273
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4346,10 +4277,9 @@ function getCalendarDates(query = {}, fields = [], orderBy2 = [], options = {})
4346
4277
  }
4347
4278
 
4348
4279
  // src/lib/gtfs/calendars.ts
4349
- import sqlString10 from "sqlstring-sqlite";
4350
4280
  function getCalendars(query = {}, fields = [], orderBy2 = [], options = {}) {
4351
4281
  const db = options.db ?? openDb();
4352
- const tableName = sqlString10.escapeId(calendar_default.filenameBase);
4282
+ const tableName = "calendar";
4353
4283
  const selectClause = formatSelectClause(fields);
4354
4284
  const whereClause = formatWhereClauses(query);
4355
4285
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4359,10 +4289,9 @@ function getCalendars(query = {}, fields = [], orderBy2 = [], options = {}) {
4359
4289
  }
4360
4290
 
4361
4291
  // src/lib/gtfs/fare-attributes.ts
4362
- import sqlString11 from "sqlstring-sqlite";
4363
4292
  function getFareAttributes(query = {}, fields = [], orderBy2 = [], options = {}) {
4364
4293
  const db = options.db ?? openDb();
4365
- const tableName = sqlString11.escapeId(fare_attributes_default.filenameBase);
4294
+ const tableName = "fare_attributes";
4366
4295
  const selectClause = formatSelectClause(fields);
4367
4296
  const whereClause = formatWhereClauses(query);
4368
4297
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4372,10 +4301,9 @@ function getFareAttributes(query = {}, fields = [], orderBy2 = [], options = {})
4372
4301
  }
4373
4302
 
4374
4303
  // src/lib/gtfs/fare-leg-rules.ts
4375
- import sqlString12 from "sqlstring-sqlite";
4376
4304
  function getFareLegRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4377
4305
  const db = options.db ?? openDb();
4378
- const tableName = sqlString12.escapeId(fare_leg_rules_default.filenameBase);
4306
+ const tableName = "fare_leg_rules";
4379
4307
  const selectClause = formatSelectClause(fields);
4380
4308
  const whereClause = formatWhereClauses(query);
4381
4309
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4385,10 +4313,9 @@ function getFareLegRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4385
4313
  }
4386
4314
 
4387
4315
  // src/lib/gtfs/fare-media.ts
4388
- import sqlString13 from "sqlstring-sqlite";
4389
4316
  function getFareMedia(query = {}, fields = [], orderBy2 = [], options = {}) {
4390
4317
  const db = options.db ?? openDb();
4391
- const tableName = sqlString13.escapeId(fare_media_default.filenameBase);
4318
+ const tableName = "fare_media";
4392
4319
  const selectClause = formatSelectClause(fields);
4393
4320
  const whereClause = formatWhereClauses(query);
4394
4321
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4398,10 +4325,9 @@ function getFareMedia(query = {}, fields = [], orderBy2 = [], options = {}) {
4398
4325
  }
4399
4326
 
4400
4327
  // src/lib/gtfs/fare-products.ts
4401
- import sqlString14 from "sqlstring-sqlite";
4402
4328
  function getFareProducts(query = {}, fields = [], orderBy2 = [], options = {}) {
4403
4329
  const db = options.db ?? openDb();
4404
- const tableName = sqlString14.escapeId(fare_products_default.filenameBase);
4330
+ const tableName = "fare_products";
4405
4331
  const selectClause = formatSelectClause(fields);
4406
4332
  const whereClause = formatWhereClauses(query);
4407
4333
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4411,10 +4337,9 @@ function getFareProducts(query = {}, fields = [], orderBy2 = [], options = {}) {
4411
4337
  }
4412
4338
 
4413
4339
  // src/lib/gtfs/fare-rules.ts
4414
- import sqlString15 from "sqlstring-sqlite";
4415
4340
  function getFareRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4416
4341
  const db = options.db ?? openDb();
4417
- const tableName = sqlString15.escapeId(fare_rules_default.filenameBase);
4342
+ const tableName = "fare_rules";
4418
4343
  const selectClause = formatSelectClause(fields);
4419
4344
  const whereClause = formatWhereClauses(query);
4420
4345
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4424,10 +4349,9 @@ function getFareRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4424
4349
  }
4425
4350
 
4426
4351
  // src/lib/gtfs/fare-transfer-rules.ts
4427
- import sqlString16 from "sqlstring-sqlite";
4428
4352
  function getFareTransferRules(query = {}, fields = [], orderBy2 = [], options = {}) {
4429
4353
  const db = options.db ?? openDb();
4430
- const tableName = sqlString16.escapeId(fare_transfer_rules_default.filenameBase);
4354
+ const tableName = "fare_transfer_rules";
4431
4355
  const selectClause = formatSelectClause(fields);
4432
4356
  const whereClause = formatWhereClauses(query);
4433
4357
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4437,10 +4361,9 @@ function getFareTransferRules(query = {}, fields = [], orderBy2 = [], options =
4437
4361
  }
4438
4362
 
4439
4363
  // src/lib/gtfs/feed-info.ts
4440
- import sqlString17 from "sqlstring-sqlite";
4441
4364
  function getFeedInfo(query = {}, fields = [], orderBy2 = [], options = {}) {
4442
4365
  const db = options.db ?? openDb();
4443
- const tableName = sqlString17.escapeId(feed_info_default.filenameBase);
4366
+ const tableName = "feed_info";
4444
4367
  const selectClause = formatSelectClause(fields);
4445
4368
  const whereClause = formatWhereClauses(query);
4446
4369
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4450,10 +4373,9 @@ function getFeedInfo(query = {}, fields = [], orderBy2 = [], options = {}) {
4450
4373
  }
4451
4374
 
4452
4375
  // src/lib/gtfs/frequencies.ts
4453
- import sqlString18 from "sqlstring-sqlite";
4454
4376
  function getFrequencies(query = {}, fields = [], orderBy2 = [], options = {}) {
4455
4377
  const db = options.db ?? openDb();
4456
- const tableName = sqlString18.escapeId(frequencies_default.filenameBase);
4378
+ const tableName = "frequencies";
4457
4379
  const selectClause = formatSelectClause(fields);
4458
4380
  const whereClause = formatWhereClauses(query);
4459
4381
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4463,10 +4385,9 @@ function getFrequencies(query = {}, fields = [], orderBy2 = [], options = {}) {
4463
4385
  }
4464
4386
 
4465
4387
  // src/lib/gtfs/levels.ts
4466
- import sqlString19 from "sqlstring-sqlite";
4467
4388
  function getLevels(query = {}, fields = [], orderBy2 = [], options = {}) {
4468
4389
  const db = options.db ?? openDb();
4469
- const tableName = sqlString19.escapeId(levels_default.filenameBase);
4390
+ const tableName = "levels";
4470
4391
  const selectClause = formatSelectClause(fields);
4471
4392
  const whereClause = formatWhereClauses(query);
4472
4393
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4476,10 +4397,9 @@ function getLevels(query = {}, fields = [], orderBy2 = [], options = {}) {
4476
4397
  }
4477
4398
 
4478
4399
  // src/lib/gtfs/location-groups.ts
4479
- import sqlString20 from "sqlstring-sqlite";
4480
4400
  function getLocationGroups(query = {}, fields = [], orderBy2 = [], options = {}) {
4481
4401
  const db = options.db ?? openDb();
4482
- const tableName = sqlString20.escapeId(location_groups_default.filenameBase);
4402
+ const tableName = "location_groups";
4483
4403
  const selectClause = formatSelectClause(fields);
4484
4404
  const whereClause = formatWhereClauses(query);
4485
4405
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4489,10 +4409,9 @@ function getLocationGroups(query = {}, fields = [], orderBy2 = [], options = {})
4489
4409
  }
4490
4410
 
4491
4411
  // src/lib/gtfs/location-group-stops.ts
4492
- import sqlString21 from "sqlstring-sqlite";
4493
4412
  function getLocationGroupStops(query = {}, fields = [], orderBy2 = [], options = {}) {
4494
4413
  const db = options.db ?? openDb();
4495
- const tableName = sqlString21.escapeId(location_group_stops_default.filenameBase);
4414
+ const tableName = "location_group_stops";
4496
4415
  const selectClause = formatSelectClause(fields);
4497
4416
  const whereClause = formatWhereClauses(query);
4498
4417
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4502,10 +4421,9 @@ function getLocationGroupStops(query = {}, fields = [], orderBy2 = [], options =
4502
4421
  }
4503
4422
 
4504
4423
  // src/lib/gtfs/locations.ts
4505
- import sqlString22 from "sqlstring-sqlite";
4506
4424
  function getLocations(query = {}, fields = [], orderBy2 = [], options = {}) {
4507
4425
  const db = options.db ?? openDb();
4508
- const tableName = sqlString22.escapeId(locations_default.filenameBase);
4426
+ const tableName = "locations";
4509
4427
  const selectClause = formatSelectClause(fields);
4510
4428
  const whereClause = formatWhereClauses(query);
4511
4429
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4515,10 +4433,9 @@ function getLocations(query = {}, fields = [], orderBy2 = [], options = {}) {
4515
4433
  }
4516
4434
 
4517
4435
  // src/lib/gtfs/networks.ts
4518
- import sqlString23 from "sqlstring-sqlite";
4519
4436
  function getNetworks(query = {}, fields = [], orderBy2 = [], options = {}) {
4520
4437
  const db = options.db ?? openDb();
4521
- const tableName = sqlString23.escapeId(networks_default.filenameBase);
4438
+ const tableName = "networks";
4522
4439
  const selectClause = formatSelectClause(fields);
4523
4440
  const whereClause = formatWhereClauses(query);
4524
4441
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4528,10 +4445,9 @@ function getNetworks(query = {}, fields = [], orderBy2 = [], options = {}) {
4528
4445
  }
4529
4446
 
4530
4447
  // src/lib/gtfs/pathways.ts
4531
- import sqlString24 from "sqlstring-sqlite";
4532
4448
  function getPathways(query = {}, fields = [], orderBy2 = [], options = {}) {
4533
4449
  const db = options.db ?? openDb();
4534
- const tableName = sqlString24.escapeId(pathways_default.filenameBase);
4450
+ const tableName = "pathways";
4535
4451
  const selectClause = formatSelectClause(fields);
4536
4452
  const whereClause = formatWhereClauses(query);
4537
4453
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4541,10 +4457,9 @@ function getPathways(query = {}, fields = [], orderBy2 = [], options = {}) {
4541
4457
  }
4542
4458
 
4543
4459
  // src/lib/gtfs/route-networks.ts
4544
- import sqlString25 from "sqlstring-sqlite";
4545
4460
  function getRouteNetworks(query = {}, fields = [], orderBy2 = [], options = {}) {
4546
4461
  const db = options.db ?? openDb();
4547
- const tableName = sqlString25.escapeId(route_networks_default.filenameBase);
4462
+ const tableName = "route_networks";
4548
4463
  const selectClause = formatSelectClause(fields);
4549
4464
  const whereClause = formatWhereClauses(query);
4550
4465
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4555,7 +4470,6 @@ function getRouteNetworks(query = {}, fields = [], orderBy2 = [], options = {})
4555
4470
 
4556
4471
  // src/lib/gtfs/routes.ts
4557
4472
  import { omit as omit3, pick } from "lodash-es";
4558
- import sqlString26 from "sqlstring-sqlite";
4559
4473
  function buildStoptimeSubquery(query) {
4560
4474
  const whereClause = formatWhereClauses(query);
4561
4475
  return `SELECT DISTINCT trip_id FROM stop_times ${whereClause}`;
@@ -4577,7 +4491,7 @@ function buildTripSubquery(query) {
4577
4491
  }
4578
4492
  function getRoutes(query = {}, fields = [], orderBy2 = [], options = {}) {
4579
4493
  const db = options.db ?? openDb();
4580
- const tableName = sqlString26.escapeId(routes_default.filenameBase);
4494
+ const tableName = "routes";
4581
4495
  const selectClause = formatSelectClause(fields);
4582
4496
  let whereClause = "";
4583
4497
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4601,15 +4515,13 @@ function getRoutes(query = {}, fields = [], orderBy2 = [], options = {}) {
4601
4515
  }
4602
4516
 
4603
4517
  // src/lib/gtfs/shapes.ts
4604
- import { omit as omit4, pick as pick2 } from "lodash-es";
4605
- import sqlString28 from "sqlstring-sqlite";
4518
+ import { compact as compact2, omit as omit4, pick as pick2 } from "lodash-es";
4606
4519
  import { featureCollection as featureCollection2 } from "@turf/helpers";
4607
4520
 
4608
4521
  // src/lib/gtfs-plus/route-attributes.ts
4609
- import sqlString27 from "sqlstring-sqlite";
4610
4522
  function getRouteAttributes(query = {}, fields = [], orderBy2 = [], options = {}) {
4611
4523
  const db = options.db ?? openDb();
4612
- const tableName = sqlString27.escapeId(route_attributes_default.filenameBase);
4524
+ const tableName = "route_attributes";
4613
4525
  const selectClause = formatSelectClause(fields);
4614
4526
  const whereClause = formatWhereClauses(query);
4615
4527
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4625,7 +4537,7 @@ function buildTripSubquery2(query) {
4625
4537
  }
4626
4538
  function getShapes(query = {}, fields = [], orderBy2 = [], options = {}) {
4627
4539
  const db = options.db ?? openDb();
4628
- const tableName = sqlString28.escapeId(shapes_default.filenameBase);
4540
+ const tableName = "shapes";
4629
4541
  const selectClause = formatSelectClause(fields);
4630
4542
  let whereClause = "";
4631
4543
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4652,44 +4564,47 @@ function getShapes(query = {}, fields = [], orderBy2 = [], options = {}) {
4652
4564
  function getShapesAsGeoJSON(query = {}, options = {}) {
4653
4565
  const agencies = getAgencies2({}, [], [], options);
4654
4566
  const routeQuery = pick2(query, ["route_id"]);
4655
- const routes = getRoutes(routeQuery, [], [], options);
4656
- const features = [];
4657
- for (const route of routes) {
4658
- const shapeQuery = {
4659
- route_id: route.route_id,
4660
- ...omit4(query, "route_id")
4661
- };
4662
- const shapes = getShapes(
4663
- shapeQuery,
4664
- ["shape_id", "shape_pt_sequence", "shape_pt_lon", "shape_pt_lat"],
4665
- [],
4666
- options
4667
- );
4668
- const routeAttributes = getRouteAttributes(
4669
- { route_id: route.route_id },
4670
- [],
4671
- [],
4672
- options
4673
- );
4674
- const agency = agencies.find(
4675
- (agency2) => agency2.agency_id === route.agency_id
4676
- );
4677
- const geojsonProperties = {
4678
- agency_name: agency ? agency.agency_name : void 0,
4679
- shape_id: query.shape_id,
4680
- ...route,
4681
- ...routeAttributes?.[0] || []
4682
- };
4683
- features.push(...shapesToGeoJSONFeatures(shapes, geojsonProperties));
4684
- }
4567
+ const routes2 = getRoutes(routeQuery, [], [], options);
4568
+ const features = compact2(
4569
+ routes2.map((route) => {
4570
+ const shapeQuery = {
4571
+ route_id: route.route_id,
4572
+ ...omit4(query, "route_id")
4573
+ };
4574
+ const shapes2 = getShapes(
4575
+ shapeQuery,
4576
+ ["shape_id", "shape_pt_sequence", "shape_pt_lon", "shape_pt_lat"],
4577
+ [],
4578
+ options
4579
+ );
4580
+ if (shapes2.length === 0) {
4581
+ return;
4582
+ }
4583
+ const routeAttributes2 = getRouteAttributes(
4584
+ { route_id: route.route_id },
4585
+ [],
4586
+ [],
4587
+ options
4588
+ );
4589
+ const agency2 = agencies.find(
4590
+ (agency3) => agency3.agency_id === route.agency_id
4591
+ );
4592
+ const geojsonProperties = {
4593
+ agency_name: agency2 ? agency2.agency_name : void 0,
4594
+ shape_id: query.shape_id,
4595
+ ...route,
4596
+ ...routeAttributes2?.[0] || []
4597
+ };
4598
+ return shapesToGeoJSONFeature(shapes2, geojsonProperties);
4599
+ })
4600
+ );
4685
4601
  return featureCollection2(features);
4686
4602
  }
4687
4603
 
4688
4604
  // src/lib/gtfs/stop-areas.ts
4689
- import sqlString29 from "sqlstring-sqlite";
4690
4605
  function getStopAreas(query = {}, fields = [], orderBy2 = [], options = {}) {
4691
4606
  const db = options.db ?? openDb();
4692
- const tableName = sqlString29.escapeId(stop_areas_default.filenameBase);
4607
+ const tableName = "stop_areas";
4693
4608
  const selectClause = formatSelectClause(fields);
4694
4609
  const whereClause = formatWhereClauses(query);
4695
4610
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4700,13 +4615,11 @@ function getStopAreas(query = {}, fields = [], orderBy2 = [], options = {}) {
4700
4615
 
4701
4616
  // src/lib/gtfs/stops.ts
4702
4617
  import { omit as omit5, orderBy, pick as pick3 } from "lodash-es";
4703
- import sqlString31 from "sqlstring-sqlite";
4704
4618
 
4705
4619
  // src/lib/gtfs-plus/stop-attributes.ts
4706
- import sqlString30 from "sqlstring-sqlite";
4707
4620
  function getStopAttributes(query = {}, fields = [], orderBy2 = [], options = {}) {
4708
4621
  const db = options.db ?? openDb();
4709
- const tableName = sqlString30.escapeId(stop_attributes_default.filenameBase);
4622
+ const tableName = "stop_attributes";
4710
4623
  const selectClause = formatSelectClause(fields);
4711
4624
  const whereClause = formatWhereClauses(query);
4712
4625
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4727,7 +4640,7 @@ function buildStoptimeSubquery2(query) {
4727
4640
  }
4728
4641
  function getStops(query = {}, fields = [], orderBy2 = [], options = {}) {
4729
4642
  const db = options.db ?? openDb();
4730
- const tableName = sqlString31.escapeId(stops_default.filenameBase);
4643
+ const tableName = "stops";
4731
4644
  const selectClause = formatSelectClause(fields);
4732
4645
  let whereClause = "";
4733
4646
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4773,31 +4686,30 @@ function getStops(query = {}, fields = [], orderBy2 = [], options = {}) {
4773
4686
  }
4774
4687
  function getStopsAsGeoJSON(query = {}, options = {}) {
4775
4688
  const db = options.db ?? openDb();
4776
- const stops = getStops(query, [], [], options);
4689
+ const stops2 = getStops(query, [], [], options);
4777
4690
  const agencies = getAgencies2({}, [], [], options);
4778
- const preparedStops = stops.map((stop) => {
4691
+ const preparedStops = stops2.map((stop) => {
4779
4692
  const routeSubquery = "SELECT DISTINCT route_id FROM trips WHERE trip_id IN (SELECT DISTINCT trip_id FROM stop_times WHERE stop_id = ?)";
4780
- const routes = db.prepare(`SELECT * FROM routes WHERE route_id IN (${routeSubquery})`).all(stop.stop_id);
4781
- const stopAttributes = getStopAttributes({ stop_id: stop.stop_id });
4693
+ const routes2 = db.prepare(`SELECT * FROM routes WHERE route_id IN (${routeSubquery})`).all(stop.stop_id);
4694
+ const stopAttributes2 = getStopAttributes({ stop_id: stop.stop_id });
4782
4695
  stop.routes = orderBy(
4783
- routes,
4696
+ routes2,
4784
4697
  (route) => route?.route_short_name ? Number.parseInt(route.route_short_name, 10) : 0
4785
4698
  );
4786
4699
  stop.agency_name = agencies[0].agency_name;
4787
4700
  return {
4788
4701
  ...stop,
4789
- ...stopAttributes?.[0] || []
4702
+ ...stopAttributes2?.[0] || []
4790
4703
  };
4791
4704
  });
4792
4705
  const filteredStops = preparedStops.filter((stop) => stop.routes.length > 0);
4793
- return stopsToGeoJSON(filteredStops);
4706
+ return stopsToGeoJSONFeatureCollection(filteredStops);
4794
4707
  }
4795
4708
 
4796
4709
  // src/lib/gtfs/stop-times.ts
4797
- import sqlString32 from "sqlstring-sqlite";
4798
4710
  function getStoptimes(query = {}, fields = [], orderBy2 = [], options = {}) {
4799
4711
  const db = options.db ?? openDb();
4800
- const tableName = sqlString32.escapeId(stop_times_default.filenameBase);
4712
+ const tableName = "stop_times";
4801
4713
  const selectClause = formatSelectClause(fields);
4802
4714
  const whereClause = formatWhereClauses(query);
4803
4715
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4807,10 +4719,9 @@ function getStoptimes(query = {}, fields = [], orderBy2 = [], options = {}) {
4807
4719
  }
4808
4720
 
4809
4721
  // src/lib/gtfs/timeframes.ts
4810
- import sqlString33 from "sqlstring-sqlite";
4811
4722
  function getTimeframes(query = {}, fields = [], orderBy2 = [], options = {}) {
4812
4723
  const db = options.db ?? openDb();
4813
- const tableName = sqlString33.escapeId(timeframes_default.filenameBase);
4724
+ const tableName = "timeframes";
4814
4725
  const selectClause = formatSelectClause(fields);
4815
4726
  const whereClause = formatWhereClauses(query);
4816
4727
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4820,10 +4731,9 @@ function getTimeframes(query = {}, fields = [], orderBy2 = [], options = {}) {
4820
4731
  }
4821
4732
 
4822
4733
  // src/lib/gtfs/transfers.ts
4823
- import sqlString34 from "sqlstring-sqlite";
4824
4734
  function getTransfers(query = {}, fields = [], orderBy2 = [], options = {}) {
4825
4735
  const db = options.db ?? openDb();
4826
- const tableName = sqlString34.escapeId(transfers_default.filenameBase);
4736
+ const tableName = "transfers";
4827
4737
  const selectClause = formatSelectClause(fields);
4828
4738
  const whereClause = formatWhereClauses(query);
4829
4739
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4833,10 +4743,9 @@ function getTransfers(query = {}, fields = [], orderBy2 = [], options = {}) {
4833
4743
  }
4834
4744
 
4835
4745
  // src/lib/gtfs/translations.ts
4836
- import sqlString35 from "sqlstring-sqlite";
4837
4746
  function getTranslations(query = {}, fields = [], orderBy2 = [], options = {}) {
4838
4747
  const db = options.db ?? openDb();
4839
- const tableName = sqlString35.escapeId(translations_default.filenameBase);
4748
+ const tableName = "translations";
4840
4749
  const selectClause = formatSelectClause(fields);
4841
4750
  const whereClause = formatWhereClauses(query);
4842
4751
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4846,10 +4755,9 @@ function getTranslations(query = {}, fields = [], orderBy2 = [], options = {}) {
4846
4755
  }
4847
4756
 
4848
4757
  // src/lib/gtfs/trips.ts
4849
- import sqlString36 from "sqlstring-sqlite";
4850
4758
  function getTrips(query = {}, fields = [], orderBy2 = [], options = {}) {
4851
4759
  const db = options.db ?? openDb();
4852
- const tableName = sqlString36.escapeId(trips_default.filenameBase);
4760
+ const tableName = "trips";
4853
4761
  const selectClause = formatSelectClause(fields);
4854
4762
  const whereClause = formatWhereClauses(query);
4855
4763
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4859,10 +4767,9 @@ function getTrips(query = {}, fields = [], orderBy2 = [], options = {}) {
4859
4767
  }
4860
4768
 
4861
4769
  // src/lib/gtfs-plus/calendar-attributes.ts
4862
- import sqlString37 from "sqlstring-sqlite";
4863
4770
  function getCalendarAttributes(query = {}, fields = [], orderBy2 = [], options = {}) {
4864
4771
  const db = options.db ?? openDb();
4865
- const tableName = sqlString37.escapeId(calendar_attributes_default.filenameBase);
4772
+ const tableName = "calendar_attributes";
4866
4773
  const selectClause = formatSelectClause(fields);
4867
4774
  const whereClause = formatWhereClauses(query);
4868
4775
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4872,10 +4779,9 @@ function getCalendarAttributes(query = {}, fields = [], orderBy2 = [], options =
4872
4779
  }
4873
4780
 
4874
4781
  // src/lib/gtfs-plus/directions.ts
4875
- import sqlString38 from "sqlstring-sqlite";
4876
4782
  function getDirections(query = {}, fields = [], orderBy2 = [], options = {}) {
4877
4783
  const db = options.db ?? openDb();
4878
- const tableName = sqlString38.escapeId(directions_default.filenameBase);
4784
+ const tableName = "directions";
4879
4785
  const selectClause = formatSelectClause(fields);
4880
4786
  const whereClause = formatWhereClauses(query);
4881
4787
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4885,10 +4791,9 @@ function getDirections(query = {}, fields = [], orderBy2 = [], options = {}) {
4885
4791
  }
4886
4792
 
4887
4793
  // src/lib/non-standard/timetables.ts
4888
- import sqlString39 from "sqlstring-sqlite";
4889
4794
  function getTimetables(query = {}, fields = [], orderBy2 = [], options = {}) {
4890
4795
  const db = options.db ?? openDb();
4891
- const tableName = sqlString39.escapeId(timetables_default.filenameBase);
4796
+ const tableName = "timetables";
4892
4797
  const selectClause = formatSelectClause(fields);
4893
4798
  const whereClause = formatWhereClauses(query);
4894
4799
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4898,10 +4803,9 @@ function getTimetables(query = {}, fields = [], orderBy2 = [], options = {}) {
4898
4803
  }
4899
4804
 
4900
4805
  // src/lib/non-standard/timetable-stop-order.ts
4901
- import sqlString40 from "sqlstring-sqlite";
4902
4806
  function getTimetableStopOrders(query = {}, fields = [], orderBy2 = [], options = {}) {
4903
4807
  const db = options.db ?? openDb();
4904
- const tableName = sqlString40.escapeId(timetable_stop_order_default.filenameBase);
4808
+ const tableName = "timetable_stop_order";
4905
4809
  const selectClause = formatSelectClause(fields);
4906
4810
  const whereClause = formatWhereClauses(query);
4907
4811
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4911,10 +4815,9 @@ function getTimetableStopOrders(query = {}, fields = [], orderBy2 = [], options
4911
4815
  }
4912
4816
 
4913
4817
  // src/lib/non-standard/timetable-pages.ts
4914
- import sqlString41 from "sqlstring-sqlite";
4915
4818
  function getTimetablePages(query = {}, fields = [], orderBy2 = [], options = {}) {
4916
4819
  const db = options.db ?? openDb();
4917
- const tableName = sqlString41.escapeId(timetable_pages_default.filenameBase);
4820
+ const tableName = "timetable_pages";
4918
4821
  const selectClause = formatSelectClause(fields);
4919
4822
  const whereClause = formatWhereClauses(query);
4920
4823
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4924,10 +4827,9 @@ function getTimetablePages(query = {}, fields = [], orderBy2 = [], options = {})
4924
4827
  }
4925
4828
 
4926
4829
  // src/lib/non-standard/timetable-notes.ts
4927
- import sqlString42 from "sqlstring-sqlite";
4928
4830
  function getTimetableNotes(query = {}, fields = [], orderBy2 = [], options = {}) {
4929
4831
  const db = options.db ?? openDb();
4930
- const tableName = sqlString42.escapeId(timetable_notes_default.filenameBase);
4832
+ const tableName = "timetable_notes";
4931
4833
  const selectClause = formatSelectClause(fields);
4932
4834
  const whereClause = formatWhereClauses(query);
4933
4835
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4937,10 +4839,9 @@ function getTimetableNotes(query = {}, fields = [], orderBy2 = [], options = {})
4937
4839
  }
4938
4840
 
4939
4841
  // src/lib/non-standard/timetable-notes-references.ts
4940
- import sqlString43 from "sqlstring-sqlite";
4941
4842
  function getTimetableNotesReferences(query = {}, fields = [], orderBy2 = [], options = {}) {
4942
4843
  const db = options.db ?? openDb();
4943
- const tableName = sqlString43.escapeId(timetable_notes_references_default.filenameBase);
4844
+ const tableName = "timetable_notes_references";
4944
4845
  const selectClause = formatSelectClause(fields);
4945
4846
  const whereClause = formatWhereClauses(query);
4946
4847
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4950,10 +4851,9 @@ function getTimetableNotesReferences(query = {}, fields = [], orderBy2 = [], opt
4950
4851
  }
4951
4852
 
4952
4853
  // src/lib/non-standard/trips-dated-vehicle-journey.ts
4953
- import sqlString44 from "sqlstring-sqlite";
4954
4854
  function getTripsDatedVehicleJourneys(query = {}, fields = [], orderBy2 = [], options = {}) {
4955
4855
  const db = options.db ?? openDb();
4956
- const tableName = sqlString44.escapeId(trips_dated_vehicle_journey_default.filenameBase);
4856
+ const tableName = "trips_dated_vehicle_journey";
4957
4857
  const selectClause = formatSelectClause(fields);
4958
4858
  const whereClause = formatWhereClauses(query);
4959
4859
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4963,10 +4863,9 @@ function getTripsDatedVehicleJourneys(query = {}, fields = [], orderBy2 = [], op
4963
4863
  }
4964
4864
 
4965
4865
  // src/lib/gtfs-ride/board-alights.ts
4966
- import sqlString45 from "sqlstring-sqlite";
4967
4866
  function getBoardAlights(query = {}, fields = [], orderBy2 = [], options = {}) {
4968
4867
  const db = options.db ?? openDb();
4969
- const tableName = sqlString45.escapeId(board_alight_default.filenameBase);
4868
+ const tableName = "board_alight";
4970
4869
  const selectClause = formatSelectClause(fields);
4971
4870
  const whereClause = formatWhereClauses(query);
4972
4871
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4975,11 +4874,10 @@ function getBoardAlights(query = {}, fields = [], orderBy2 = [], options = {}) {
4975
4874
  ).all();
4976
4875
  }
4977
4876
 
4978
- // src/lib/gtfs-ride/ride-feed-infos.ts
4979
- import sqlString46 from "sqlstring-sqlite";
4980
- function getRideFeedInfos(query = {}, fields = [], orderBy2 = [], options = {}) {
4877
+ // src/lib/gtfs-ride/ride-feed-info.ts
4878
+ function getRideFeedInfo(query = {}, fields = [], orderBy2 = [], options = {}) {
4981
4879
  const db = options.db ?? openDb();
4982
- const tableName = sqlString46.escapeId(ride_feed_info_default.filenameBase);
4880
+ const tableName = "ride_feed_info";
4983
4881
  const selectClause = formatSelectClause(fields);
4984
4882
  const whereClause = formatWhereClauses(query);
4985
4883
  const orderByClause = formatOrderByClause(orderBy2);
@@ -4989,10 +4887,9 @@ function getRideFeedInfos(query = {}, fields = [], orderBy2 = [], options = {})
4989
4887
  }
4990
4888
 
4991
4889
  // src/lib/gtfs-ride/rider-trips.ts
4992
- import sqlString47 from "sqlstring-sqlite";
4993
4890
  function getRiderTrips(query = {}, fields = [], orderBy2 = [], options = {}) {
4994
4891
  const db = options.db ?? openDb();
4995
- const tableName = sqlString47.escapeId(rider_trip_default.filenameBase);
4892
+ const tableName = "rider_trip";
4996
4893
  const selectClause = formatSelectClause(fields);
4997
4894
  const whereClause = formatWhereClauses(query);
4998
4895
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5001,11 +4898,10 @@ function getRiderTrips(query = {}, fields = [], orderBy2 = [], options = {}) {
5001
4898
  ).all();
5002
4899
  }
5003
4900
 
5004
- // src/lib/gtfs-ride/riderships.ts
5005
- import sqlString48 from "sqlstring-sqlite";
5006
- function getRiderships(query = {}, fields = [], orderBy2 = [], options = {}) {
4901
+ // src/lib/gtfs-ride/ridership.ts
4902
+ function getRidership(query = {}, fields = [], orderBy2 = [], options = {}) {
5007
4903
  const db = options.db ?? openDb();
5008
- const tableName = sqlString48.escapeId(ridership_default.filenameBase);
4904
+ const tableName = "ridership";
5009
4905
  const selectClause = formatSelectClause(fields);
5010
4906
  const whereClause = formatWhereClauses(query);
5011
4907
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5015,10 +4911,9 @@ function getRiderships(query = {}, fields = [], orderBy2 = [], options = {}) {
5015
4911
  }
5016
4912
 
5017
4913
  // src/lib/gtfs-ride/trip-capacities.ts
5018
- import sqlString49 from "sqlstring-sqlite";
5019
4914
  function getTripCapacities(query = {}, fields = [], orderBy2 = [], options = {}) {
5020
4915
  const db = options.db ?? openDb();
5021
- const tableName = sqlString49.escapeId(trip_capacity_default.filenameBase);
4916
+ const tableName = "trip_capacity";
5022
4917
  const selectClause = formatSelectClause(fields);
5023
4918
  const whereClause = formatWhereClauses(query);
5024
4919
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5028,10 +4923,9 @@ function getTripCapacities(query = {}, fields = [], orderBy2 = [], options = {})
5028
4923
  }
5029
4924
 
5030
4925
  // src/lib/gtfs-realtime/stop-time-updates.ts
5031
- import sqlString50 from "sqlstring-sqlite";
5032
4926
  function getStopTimeUpdates(query = {}, fields = [], orderBy2 = [], options = {}) {
5033
4927
  const db = options.db ?? openDb();
5034
- const tableName = sqlString50.escapeId(stop_time_updates_default.filenameBase);
4928
+ const tableName = "stop_time_updates";
5035
4929
  const selectClause = formatSelectClause(fields);
5036
4930
  const whereClause = formatWhereClauses(query);
5037
4931
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5041,10 +4935,9 @@ function getStopTimeUpdates(query = {}, fields = [], orderBy2 = [], options = {}
5041
4935
  }
5042
4936
 
5043
4937
  // src/lib/gtfs-realtime/trip-updates.ts
5044
- import sqlString51 from "sqlstring-sqlite";
5045
4938
  function getTripUpdates(query = {}, fields = [], orderBy2 = [], options = {}) {
5046
4939
  const db = options.db ?? openDb();
5047
- const tableName = sqlString51.escapeId(trip_updates_default.filenameBase);
4940
+ const tableName = "trip_updates";
5048
4941
  const selectClause = formatSelectClause(fields);
5049
4942
  const whereClause = formatWhereClauses(query);
5050
4943
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5054,10 +4947,9 @@ function getTripUpdates(query = {}, fields = [], orderBy2 = [], options = {}) {
5054
4947
  }
5055
4948
 
5056
4949
  // src/lib/gtfs-realtime/vehicle-positions.ts
5057
- import sqlString52 from "sqlstring-sqlite";
5058
4950
  function getVehiclePositions(query = {}, fields = [], orderBy2 = [], options = {}) {
5059
4951
  const db = options.db ?? openDb();
5060
- const tableName = sqlString52.escapeId(vehicle_positions_default.filenameBase);
4952
+ const tableName = "vehicle_positions";
5061
4953
  const selectClause = formatSelectClause(fields);
5062
4954
  const whereClause = formatWhereClauses(query);
5063
4955
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5067,24 +4959,22 @@ function getVehiclePositions(query = {}, fields = [], orderBy2 = [], options = {
5067
4959
  }
5068
4960
 
5069
4961
  // src/lib/gtfs-realtime/service-alerts.ts
5070
- import sqlString53 from "sqlstring-sqlite";
5071
4962
  function getServiceAlerts(query = {}, fields = [], orderBy2 = [], options = {}) {
5072
4963
  const db = options.db ?? openDb();
5073
- const tableName = sqlString53.escapeId(service_alerts_default.filenameBase);
5074
- const joinTable = sqlString53.escapeId(service_alert_targets_default.filenameBase);
4964
+ const tableName = "service_alerts";
4965
+ const joinTableName = "service_alert_targets";
5075
4966
  const selectClause = formatSelectClause(fields);
5076
4967
  const whereClause = formatWhereClauses(query);
5077
4968
  const orderByClause = formatOrderByClause(orderBy2);
5078
4969
  return db.prepare(
5079
- `${selectClause} FROM ${tableName} INNER JOIN ${joinTable} ON ${tableName}.id=${joinTable}.alert_id ${whereClause} ${orderByClause};`
4970
+ `${selectClause} FROM ${tableName} INNER JOIN ${joinTableName} ON ${tableName}.id=${joinTableName}.alert_id ${whereClause} ${orderByClause};`
5080
4971
  ).all();
5081
4972
  }
5082
4973
 
5083
4974
  // src/lib/ods/deadheads.ts
5084
- import sqlString54 from "sqlstring-sqlite";
5085
4975
  function getDeadheads(query = {}, fields = [], orderBy2 = [], options = {}) {
5086
4976
  const db = options.db ?? openDb();
5087
- const tableName = sqlString54.escapeId(deadheads_default.filenameBase);
4977
+ const tableName = "deadheads";
5088
4978
  const selectClause = formatSelectClause(fields);
5089
4979
  const whereClause = formatWhereClauses(query);
5090
4980
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5094,10 +4984,9 @@ function getDeadheads(query = {}, fields = [], orderBy2 = [], options = {}) {
5094
4984
  }
5095
4985
 
5096
4986
  // src/lib/ods/deadhead-times.ts
5097
- import sqlString55 from "sqlstring-sqlite";
5098
4987
  function getDeadheadTimes(query = {}, fields = [], orderBy2 = [], options = {}) {
5099
4988
  const db = options.db ?? openDb();
5100
- const tableName = sqlString55.escapeId(deadhead_times_default.filenameBase);
4989
+ const tableName = "deadhead_times";
5101
4990
  const selectClause = formatSelectClause(fields);
5102
4991
  const whereClause = formatWhereClauses(query);
5103
4992
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5107,10 +4996,9 @@ function getDeadheadTimes(query = {}, fields = [], orderBy2 = [], options = {})
5107
4996
  }
5108
4997
 
5109
4998
  // src/lib/ods/ops-locations.ts
5110
- import sqlString56 from "sqlstring-sqlite";
5111
4999
  function getOpsLocations(query = {}, fields = [], orderBy2 = [], options = {}) {
5112
5000
  const db = options.db ?? openDb();
5113
- const tableName = sqlString56.escapeId(ops_locations_default.filenameBase);
5001
+ const tableName = "ops_locations";
5114
5002
  const selectClause = formatSelectClause(fields);
5115
5003
  const whereClause = formatWhereClauses(query);
5116
5004
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5120,10 +5008,9 @@ function getOpsLocations(query = {}, fields = [], orderBy2 = [], options = {}) {
5120
5008
  }
5121
5009
 
5122
5010
  // src/lib/ods/run-events.ts
5123
- import sqlString57 from "sqlstring-sqlite";
5124
5011
  function getRunEvents(query = {}, fields = [], orderBy2 = [], options = {}) {
5125
5012
  const db = options.db ?? openDb();
5126
- const tableName = sqlString57.escapeId(run_events_default.filenameBase);
5013
+ const tableName = "run_events";
5127
5014
  const selectClause = formatSelectClause(fields);
5128
5015
  const whereClause = formatWhereClauses(query);
5129
5016
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5133,10 +5020,9 @@ function getRunEvents(query = {}, fields = [], orderBy2 = [], options = {}) {
5133
5020
  }
5134
5021
 
5135
5022
  // src/lib/ods/runs-pieces.ts
5136
- import sqlString58 from "sqlstring-sqlite";
5137
5023
  function getRunsPieces(query = {}, fields = [], orderBy2 = [], options = {}) {
5138
5024
  const db = options.db ?? openDb();
5139
- const tableName = sqlString58.escapeId(runs_pieces_default.filenameBase);
5025
+ const tableName = "runs_pieces";
5140
5026
  const selectClause = formatSelectClause(fields);
5141
5027
  const whereClause = formatWhereClauses(query);
5142
5028
  const orderByClause = formatOrderByClause(orderBy2);
@@ -5175,9 +5061,9 @@ export {
5175
5061
  getNetworks,
5176
5062
  getOpsLocations,
5177
5063
  getPathways,
5178
- getRideFeedInfos,
5064
+ getRideFeedInfo,
5179
5065
  getRiderTrips,
5180
- getRiderships,
5066
+ getRidership,
5181
5067
  getRouteAttributes,
5182
5068
  getRouteNetworks,
5183
5069
  getRoutes,