gtfs 4.13.3 → 4.14.0

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.
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
2
7
 
3
8
  // src/bin/gtfs-import.ts
4
9
  import yargs from "yargs";
@@ -143,8 +148,68 @@ import mapSeries from "promise-map-series";
143
148
  import GtfsRealtimeBindings from "gtfs-realtime-bindings";
144
149
  import sqlString2 from "sqlstring-sqlite";
145
150
 
151
+ // src/models/models.ts
152
+ var models_exports = {};
153
+ __export(models_exports, {
154
+ agency: () => agency,
155
+ areas: () => areas,
156
+ attributions: () => attributions,
157
+ boardAlight: () => boardAlight,
158
+ bookingRules: () => bookingRules,
159
+ calendar: () => calendar,
160
+ calendarAttributes: () => calendarAttributes,
161
+ calendarDates: () => calendarDates,
162
+ deadheadTimes: () => deadheadTimes,
163
+ deadheads: () => deadheads,
164
+ directions: () => directions,
165
+ fareAttributes: () => fareAttributes,
166
+ fareLegRules: () => fareLegRules,
167
+ fareMedia: () => fareMedia,
168
+ fareProducts: () => fareProducts,
169
+ fareRules: () => fareRules,
170
+ fareTransferRules: () => fareTransferRules,
171
+ feedInfo: () => feedInfo,
172
+ frequencies: () => frequencies,
173
+ levels: () => levels,
174
+ locationGroupStops: () => locationGroupStops,
175
+ locationGroups: () => locationGroups,
176
+ locations: () => locations,
177
+ networks: () => networks,
178
+ opsLocations: () => opsLocations,
179
+ pathways: () => pathways,
180
+ rideFeedInfo: () => rideFeedInfo,
181
+ riderTrip: () => riderTrip,
182
+ ridership: () => ridership,
183
+ routeAttributes: () => routeAttributes,
184
+ routeNetworks: () => routeNetworks,
185
+ routes: () => routes,
186
+ runEvents: () => runEvents,
187
+ runsPieces: () => runsPieces,
188
+ serviceAlertTargets: () => serviceAlertTargets,
189
+ serviceAlerts: () => serviceAlerts,
190
+ shapes: () => shapes,
191
+ stopAreas: () => stopAreas,
192
+ stopAttributes: () => stopAttributes,
193
+ stopTimeUpdates: () => stopTimeUpdates,
194
+ stopTimes: () => stopTimes,
195
+ stops: () => stops,
196
+ timeframes: () => timeframes,
197
+ timetableNotes: () => timetableNotes,
198
+ timetableNotesReferences: () => timetableNotesReferences,
199
+ timetablePages: () => timetablePages,
200
+ timetableStopOrder: () => timetableStopOrder,
201
+ timetables: () => timetables,
202
+ transfers: () => transfers,
203
+ translations: () => translations,
204
+ tripCapacity: () => tripCapacity,
205
+ tripUpdates: () => tripUpdates,
206
+ trips: () => trips,
207
+ tripsDatedVehicleJourney: () => tripsDatedVehicleJourney,
208
+ vehiclePositions: () => vehiclePositions
209
+ });
210
+
146
211
  // src/models/gtfs/agency.ts
147
- var model = {
212
+ var agency = {
148
213
  filenameBase: "agency",
149
214
  filenameExtension: "txt",
150
215
  schema: [
@@ -191,10 +256,9 @@ var model = {
191
256
  }
192
257
  ]
193
258
  };
194
- var agency_default = model;
195
259
 
196
260
  // src/models/gtfs/areas.ts
197
- var model2 = {
261
+ var areas = {
198
262
  filenameBase: "areas",
199
263
  filenameExtension: "txt",
200
264
  schema: [
@@ -211,10 +275,9 @@ var model2 = {
211
275
  }
212
276
  ]
213
277
  };
214
- var areas_default = model2;
215
278
 
216
279
  // src/models/gtfs/attributions.ts
217
- var model3 = {
280
+ var attributions = {
218
281
  filenameBase: "attributions",
219
282
  filenameExtension: "txt",
220
283
  schema: [
@@ -278,10 +341,9 @@ var model3 = {
278
341
  }
279
342
  ]
280
343
  };
281
- var attributions_default = model3;
282
344
 
283
345
  // src/models/gtfs/booking-rules.ts
284
- var model4 = {
346
+ var bookingRules = {
285
347
  filenameBase: "booking_rules",
286
348
  filenameExtension: "txt",
287
349
  schema: [
@@ -371,10 +433,9 @@ var model4 = {
371
433
  }
372
434
  ]
373
435
  };
374
- var booking_rules_default = model4;
375
436
 
376
437
  // src/models/gtfs/calendar-dates.ts
377
- var model5 = {
438
+ var calendarDates = {
378
439
  filenameBase: "calendar_dates",
379
440
  filenameExtension: "txt",
380
441
  schema: [
@@ -406,10 +467,9 @@ var model5 = {
406
467
  }
407
468
  ]
408
469
  };
409
- var calendar_dates_default = model5;
410
470
 
411
471
  // src/models/gtfs/calendar.ts
412
- var model6 = {
472
+ var calendar = {
413
473
  filenameBase: "calendar",
414
474
  filenameExtension: "txt",
415
475
  schema: [
@@ -483,10 +543,9 @@ var model6 = {
483
543
  }
484
544
  ]
485
545
  };
486
- var calendar_default = model6;
487
546
 
488
547
  // src/models/gtfs/fare-attributes.ts
489
- var model7 = {
548
+ var fareAttributes = {
490
549
  filenameBase: "fare_attributes",
491
550
  filenameExtension: "txt",
492
551
  schema: [
@@ -532,10 +591,9 @@ var model7 = {
532
591
  }
533
592
  ]
534
593
  };
535
- var fare_attributes_default = model7;
536
594
 
537
595
  // src/models/gtfs/fare-leg-rules.ts
538
- var model8 = {
596
+ var fareLegRules = {
539
597
  filenameBase: "fare_leg_rules",
540
598
  filenameExtension: "txt",
541
599
  schema: [
@@ -588,10 +646,9 @@ var model8 = {
588
646
  }
589
647
  ]
590
648
  };
591
- var fare_leg_rules_default = model8;
592
649
 
593
650
  // src/models/gtfs/fare-media.ts
594
- var model9 = {
651
+ var fareMedia = {
595
652
  filenameBase: "fare_media",
596
653
  filenameExtension: "txt",
597
654
  schema: [
@@ -615,10 +672,9 @@ var model9 = {
615
672
  }
616
673
  ]
617
674
  };
618
- var fare_media_default = model9;
619
675
 
620
676
  // src/models/gtfs/fare-products.ts
621
- var model10 = {
677
+ var fareProducts = {
622
678
  filenameBase: "fare_products",
623
679
  filenameExtension: "txt",
624
680
  schema: [
@@ -651,10 +707,9 @@ var model10 = {
651
707
  }
652
708
  ]
653
709
  };
654
- var fare_products_default = model10;
655
710
 
656
711
  // src/models/gtfs/fare-rules.ts
657
- var model11 = {
712
+ var fareRules = {
658
713
  filenameBase: "fare_rules",
659
714
  filenameExtension: "txt",
660
715
  schema: [
@@ -686,10 +741,9 @@ var model11 = {
686
741
  }
687
742
  ]
688
743
  };
689
- var fare_rules_default = model11;
690
744
 
691
745
  // src/models/gtfs/fare-transfer-rules.ts
692
- var model12 = {
746
+ var fareTransferRules = {
693
747
  filenameBase: "fare_transfer_rules",
694
748
  filenameExtension: "txt",
695
749
  schema: [
@@ -743,10 +797,9 @@ var model12 = {
743
797
  }
744
798
  ]
745
799
  };
746
- var fare_transfer_rules_default = model12;
747
800
 
748
801
  // src/models/gtfs/feed-info.ts
749
- var model13 = {
802
+ var feedInfo = {
750
803
  filenameBase: "feed_info",
751
804
  filenameExtension: "txt",
752
805
  schema: [
@@ -794,10 +847,9 @@ var model13 = {
794
847
  }
795
848
  ]
796
849
  };
797
- var feed_info_default = model13;
798
850
 
799
851
  // src/models/gtfs/frequencies.ts
800
- var model14 = {
852
+ var frequencies = {
801
853
  filenameBase: "frequencies",
802
854
  filenameExtension: "txt",
803
855
  schema: [
@@ -841,10 +893,9 @@ var model14 = {
841
893
  }
842
894
  ]
843
895
  };
844
- var frequencies_default = model14;
845
896
 
846
897
  // src/models/gtfs/levels.ts
847
- var model15 = {
898
+ var levels = {
848
899
  filenameBase: "levels",
849
900
  filenameExtension: "txt",
850
901
  schema: [
@@ -867,10 +918,9 @@ var model15 = {
867
918
  }
868
919
  ]
869
920
  };
870
- var levels_default = model15;
871
921
 
872
922
  // src/models/gtfs/location-groups.ts
873
- var model16 = {
923
+ var locationGroups = {
874
924
  filenameBase: "location_groups",
875
925
  filenameExtension: "txt",
876
926
  schema: [
@@ -887,10 +937,9 @@ var model16 = {
887
937
  }
888
938
  ]
889
939
  };
890
- var location_groups_default = model16;
891
940
 
892
941
  // src/models/gtfs/location-group-stops.ts
893
- var model17 = {
942
+ var locationGroupStops = {
894
943
  filenameBase: "location_group_stops",
895
944
  filenameExtension: "txt",
896
945
  schema: [
@@ -910,10 +959,9 @@ var model17 = {
910
959
  }
911
960
  ]
912
961
  };
913
- var location_group_stops_default = model17;
914
962
 
915
963
  // src/models/gtfs/locations.ts
916
- var model18 = {
964
+ var locations = {
917
965
  filenameBase: "locations",
918
966
  filenameExtension: "geojson",
919
967
  schema: [
@@ -923,10 +971,9 @@ var model18 = {
923
971
  }
924
972
  ]
925
973
  };
926
- var locations_default = model18;
927
974
 
928
975
  // src/models/gtfs/networks.ts
929
- var model19 = {
976
+ var networks = {
930
977
  filenameBase: "networks",
931
978
  filenameExtension: "txt",
932
979
  schema: [
@@ -944,10 +991,9 @@ var model19 = {
944
991
  }
945
992
  ]
946
993
  };
947
- var networks_default = model19;
948
994
 
949
995
  // src/models/gtfs/pathways.ts
950
- var model20 = {
996
+ var pathways = {
951
997
  filenameBase: "pathways",
952
998
  filenameExtension: "txt",
953
999
  schema: [
@@ -1019,10 +1065,9 @@ var model20 = {
1019
1065
  }
1020
1066
  ]
1021
1067
  };
1022
- var pathways_default = model20;
1023
1068
 
1024
1069
  // src/models/gtfs/route-networks.ts
1025
- var model21 = {
1070
+ var routeNetworks = {
1026
1071
  filenameBase: "route_networks",
1027
1072
  filenameExtension: "txt",
1028
1073
  schema: [
@@ -1041,10 +1086,9 @@ var model21 = {
1041
1086
  }
1042
1087
  ]
1043
1088
  };
1044
- var route_networks_default = model21;
1045
1089
 
1046
1090
  // src/models/gtfs/routes.ts
1047
- var model22 = {
1091
+ var routes = {
1048
1092
  filenameBase: "routes",
1049
1093
  filenameExtension: "txt",
1050
1094
  schema: [
@@ -1121,10 +1165,9 @@ var model22 = {
1121
1165
  }
1122
1166
  ]
1123
1167
  };
1124
- var routes_default = model22;
1125
1168
 
1126
1169
  // src/models/gtfs/shapes.ts
1127
- var model23 = {
1170
+ var shapes = {
1128
1171
  filenameBase: "shapes",
1129
1172
  filenameExtension: "txt",
1130
1173
  schema: [
@@ -1163,10 +1206,9 @@ var model23 = {
1163
1206
  }
1164
1207
  ]
1165
1208
  };
1166
- var shapes_default = model23;
1167
1209
 
1168
1210
  // src/models/gtfs/stop-areas.ts
1169
- var model24 = {
1211
+ var stopAreas = {
1170
1212
  filenameBase: "stop_areas",
1171
1213
  filenameExtension: "txt",
1172
1214
  schema: [
@@ -1184,10 +1226,9 @@ var model24 = {
1184
1226
  }
1185
1227
  ]
1186
1228
  };
1187
- var stop_areas_default = model24;
1188
1229
 
1189
1230
  // src/models/gtfs/stop-times.ts
1190
- var model25 = {
1231
+ var stopTimes = {
1191
1232
  filenameBase: "stop_times",
1192
1233
  filenameExtension: "txt",
1193
1234
  schema: [
@@ -1305,10 +1346,9 @@ var model25 = {
1305
1346
  }
1306
1347
  ]
1307
1348
  };
1308
- var stop_times_default = model25;
1309
1349
 
1310
1350
  // src/models/gtfs/stops.ts
1311
- var model26 = {
1351
+ var stops = {
1312
1352
  filenameBase: "stops",
1313
1353
  filenameExtension: "txt",
1314
1354
  schema: [
@@ -1391,10 +1431,9 @@ var model26 = {
1391
1431
  }
1392
1432
  ]
1393
1433
  };
1394
- var stops_default = model26;
1395
1434
 
1396
1435
  // src/models/gtfs/timeframes.ts
1397
- var model27 = {
1436
+ var timeframes = {
1398
1437
  filenameBase: "timeframes",
1399
1438
  filenameExtension: "txt",
1400
1439
  schema: [
@@ -1421,10 +1460,9 @@ var model27 = {
1421
1460
  }
1422
1461
  ]
1423
1462
  };
1424
- var timeframes_default = model27;
1425
1463
 
1426
1464
  // src/models/gtfs/transfers.ts
1427
- var model28 = {
1465
+ var transfers = {
1428
1466
  filenameBase: "transfers",
1429
1467
  filenameExtension: "txt",
1430
1468
  schema: [
@@ -1478,10 +1516,9 @@ var model28 = {
1478
1516
  }
1479
1517
  ]
1480
1518
  };
1481
- var transfers_default = model28;
1482
1519
 
1483
1520
  // src/models/gtfs/translations.ts
1484
- var model29 = {
1521
+ var translations = {
1485
1522
  filenameBase: "translations",
1486
1523
  filenameExtension: "txt",
1487
1524
  schema: [
@@ -1527,10 +1564,9 @@ var model29 = {
1527
1564
  }
1528
1565
  ]
1529
1566
  };
1530
- var translations_default = model29;
1531
1567
 
1532
1568
  // src/models/gtfs/trips.ts
1533
- var model30 = {
1569
+ var trips = {
1534
1570
  filenameBase: "trips",
1535
1571
  filenameExtension: "txt",
1536
1572
  schema: [
@@ -1598,10 +1634,9 @@ var model30 = {
1598
1634
  }
1599
1635
  ]
1600
1636
  };
1601
- var trips_default = model30;
1602
1637
 
1603
1638
  // src/models/non-standard/timetables.ts
1604
- var model31 = {
1639
+ var timetables = {
1605
1640
  filenameBase: "timetables",
1606
1641
  filenameExtension: "txt",
1607
1642
  nonstandard: true,
@@ -1743,10 +1778,9 @@ var model31 = {
1743
1778
  }
1744
1779
  ]
1745
1780
  };
1746
- var timetables_default = model31;
1747
1781
 
1748
1782
  // src/models/non-standard/timetable-pages.ts
1749
- var model32 = {
1783
+ var timetablePages = {
1750
1784
  filenameBase: "timetable_pages",
1751
1785
  filenameExtension: "txt",
1752
1786
  nonstandard: true,
@@ -1767,10 +1801,9 @@ var model32 = {
1767
1801
  }
1768
1802
  ]
1769
1803
  };
1770
- var timetable_pages_default = model32;
1771
1804
 
1772
1805
  // src/models/non-standard/timetable-stop-order.ts
1773
- var model33 = {
1806
+ var timetableStopOrder = {
1774
1807
  filenameBase: "timetable_stop_order",
1775
1808
  filenameExtension: "txt",
1776
1809
  nonstandard: true,
@@ -1800,10 +1833,9 @@ var model33 = {
1800
1833
  }
1801
1834
  ]
1802
1835
  };
1803
- var timetable_stop_order_default = model33;
1804
1836
 
1805
1837
  // src/models/non-standard/timetable-notes.ts
1806
- var model34 = {
1838
+ var timetableNotes = {
1807
1839
  filenameBase: "timetable_notes",
1808
1840
  filenameExtension: "txt",
1809
1841
  nonstandard: true,
@@ -1825,10 +1857,9 @@ var model34 = {
1825
1857
  }
1826
1858
  ]
1827
1859
  };
1828
- var timetable_notes_default = model34;
1829
1860
 
1830
1861
  // src/models/non-standard/timetable-notes-references.ts
1831
- var model35 = {
1862
+ var timetableNotesReferences = {
1832
1863
  filenameBase: "timetable_notes_references",
1833
1864
  filenameExtension: "txt",
1834
1865
  nonstandard: true,
@@ -1876,11 +1907,10 @@ var model35 = {
1876
1907
  }
1877
1908
  ]
1878
1909
  };
1879
- var timetable_notes_references_default = model35;
1880
1910
 
1881
1911
  // src/models/non-standard/trips-dated-vehicle-journey.ts
1882
- var model36 = {
1883
- filenameBase: "trips_dated_vehicle_journeys",
1912
+ var tripsDatedVehicleJourney = {
1913
+ filenameBase: "trips_dated_vehicle_journey",
1884
1914
  filenameExtension: "txt",
1885
1915
  nonstandard: true,
1886
1916
  schema: [
@@ -1911,10 +1941,9 @@ var model36 = {
1911
1941
  }
1912
1942
  ]
1913
1943
  };
1914
- var trips_dated_vehicle_journey_default = model36;
1915
1944
 
1916
1945
  // src/models/gtfs-plus/calendar-attributes.ts
1917
- var model37 = {
1946
+ var calendarAttributes = {
1918
1947
  filenameBase: "calendar_attributes",
1919
1948
  filenameExtension: "txt",
1920
1949
  nonstandard: true,
@@ -1934,10 +1963,9 @@ var model37 = {
1934
1963
  }
1935
1964
  ]
1936
1965
  };
1937
- var calendar_attributes_default = model37;
1938
1966
 
1939
1967
  // src/models/gtfs-plus/directions.ts
1940
- var model38 = {
1968
+ var directions = {
1941
1969
  filenameBase: "directions",
1942
1970
  filenameExtension: "txt",
1943
1971
  nonstandard: true,
@@ -1964,10 +1992,9 @@ var model38 = {
1964
1992
  }
1965
1993
  ]
1966
1994
  };
1967
- var directions_default = model38;
1968
1995
 
1969
1996
  // src/models/gtfs-plus/route-attributes.ts
1970
- var model39 = {
1997
+ var routeAttributes = {
1971
1998
  filenameBase: "route_attributes",
1972
1999
  filenameExtension: "txt",
1973
2000
  nonstandard: true,
@@ -1999,10 +2026,9 @@ var model39 = {
1999
2026
  }
2000
2027
  ]
2001
2028
  };
2002
- var route_attributes_default = model39;
2003
2029
 
2004
2030
  // src/models/gtfs-plus/stop-attributes.ts
2005
- var model40 = {
2031
+ var stopAttributes = {
2006
2032
  filenameBase: "stop_attributes",
2007
2033
  filenameExtension: "txt",
2008
2034
  nonstandard: true,
@@ -2035,10 +2061,9 @@ var model40 = {
2035
2061
  }
2036
2062
  ]
2037
2063
  };
2038
- var stop_attributes_default = model40;
2039
2064
 
2040
2065
  // src/models/gtfs-ride/board-alight.ts
2041
- var model41 = {
2066
+ var boardAlight = {
2042
2067
  filenameBase: "board_alight",
2043
2068
  filenameExtension: "txt",
2044
2069
  nonstandard: true,
@@ -2168,10 +2193,9 @@ var model41 = {
2168
2193
  }
2169
2194
  ]
2170
2195
  };
2171
- var board_alight_default = model41;
2172
2196
 
2173
2197
  // src/models/gtfs-ride/rider-trip.ts
2174
- var model42 = {
2198
+ var riderTrip = {
2175
2199
  filenameBase: "rider_trip",
2176
2200
  filenameExtension: "txt",
2177
2201
  nonstandard: true,
@@ -2282,10 +2306,9 @@ var model42 = {
2282
2306
  }
2283
2307
  ]
2284
2308
  };
2285
- var rider_trip_default = model42;
2286
2309
 
2287
2310
  // src/models/gtfs-ride/ridership.ts
2288
- var model43 = {
2311
+ var ridership = {
2289
2312
  filenameBase: "ridership",
2290
2313
  filenameExtension: "txt",
2291
2314
  nonstandard: true,
@@ -2410,10 +2433,9 @@ var model43 = {
2410
2433
  }
2411
2434
  ]
2412
2435
  };
2413
- var ridership_default = model43;
2414
2436
 
2415
2437
  // src/models/gtfs-ride/trip-capacity.ts
2416
- var model44 = {
2438
+ var tripCapacity = {
2417
2439
  filenameBase: "trip_capacity",
2418
2440
  filenameExtension: "txt",
2419
2441
  nonstandard: true,
@@ -2462,10 +2484,9 @@ var model44 = {
2462
2484
  }
2463
2485
  ]
2464
2486
  };
2465
- var trip_capacity_default = model44;
2466
2487
 
2467
2488
  // src/models/gtfs-ride/ride-feed-info.ts
2468
- var model45 = {
2489
+ var rideFeedInfo = {
2469
2490
  filenameBase: "ride_feed_info",
2470
2491
  filenameExtension: "txt",
2471
2492
  nonstandard: true,
@@ -2503,10 +2524,9 @@ var model45 = {
2503
2524
  }
2504
2525
  ]
2505
2526
  };
2506
- var ride_feed_info_default = model45;
2507
2527
 
2508
2528
  // src/models/gtfs-realtime/trip-updates.ts
2509
- var model46 = {
2529
+ var tripUpdates = {
2510
2530
  filenameBase: "trip_updates",
2511
2531
  extension: "gtfs-realtime",
2512
2532
  schema: [
@@ -2581,10 +2601,9 @@ var model46 = {
2581
2601
  }
2582
2602
  ]
2583
2603
  };
2584
- var trip_updates_default = model46;
2585
2604
 
2586
2605
  // src/models/gtfs-realtime/stop-time-updates.ts
2587
- var model47 = {
2606
+ var stopTimeUpdates = {
2588
2607
  filenameBase: "stop_time_updates",
2589
2608
  extension: "gtfs-realtime",
2590
2609
  schema: [
@@ -2669,10 +2688,9 @@ var model47 = {
2669
2688
  }
2670
2689
  ]
2671
2690
  };
2672
- var stop_time_updates_default = model47;
2673
2691
 
2674
2692
  // src/models/gtfs-realtime/vehicle-positions.ts
2675
- var model48 = {
2693
+ var vehiclePositions = {
2676
2694
  filenameBase: "vehicle_positions",
2677
2695
  extension: "gtfs-realtime",
2678
2696
  schema: [
@@ -2807,10 +2825,9 @@ var model48 = {
2807
2825
  }
2808
2826
  ]
2809
2827
  };
2810
- var vehicle_positions_default = model48;
2811
2828
 
2812
2829
  // src/models/gtfs-realtime/service-alerts.ts
2813
- var model49 = {
2830
+ var serviceAlerts = {
2814
2831
  filenameBase: "service_alerts",
2815
2832
  extension: "gtfs-realtime",
2816
2833
  schema: [
@@ -2870,10 +2887,9 @@ var model49 = {
2870
2887
  }
2871
2888
  ]
2872
2889
  };
2873
- var service_alerts_default = model49;
2874
2890
 
2875
2891
  // src/models/gtfs-realtime/service-alert-targets.ts
2876
- var model50 = {
2892
+ var serviceAlertTargets = {
2877
2893
  filenameBase: "service_alert_targets",
2878
2894
  extension: "gtfs-realtime",
2879
2895
  schema: [
@@ -2910,10 +2926,9 @@ var model50 = {
2910
2926
  }
2911
2927
  ]
2912
2928
  };
2913
- var service_alert_targets_default = model50;
2914
2929
 
2915
2930
  // src/models/ods/deadhead-times.ts
2916
- var model51 = {
2931
+ var deadheadTimes = {
2917
2932
  filenameBase: "deadhead_times",
2918
2933
  filenameExtension: "txt",
2919
2934
  nonstandard: true,
@@ -2976,10 +2991,9 @@ var model51 = {
2976
2991
  }
2977
2992
  ]
2978
2993
  };
2979
- var deadhead_times_default = model51;
2980
2994
 
2981
2995
  // src/models/ods/deadheads.ts
2982
- var model52 = {
2996
+ var deadheads = {
2983
2997
  filenameBase: "deadheads",
2984
2998
  filenameExtension: "txt",
2985
2999
  nonstandard: true,
@@ -3037,10 +3051,9 @@ var model52 = {
3037
3051
  }
3038
3052
  ]
3039
3053
  };
3040
- var deadheads_default = model52;
3041
3054
 
3042
3055
  // src/models/ods/ops-locations.ts
3043
- var model53 = {
3056
+ var opsLocations = {
3044
3057
  filenameBase: "ops_locations",
3045
3058
  filenameExtension: "txt",
3046
3059
  nonstandard: true,
@@ -3084,10 +3097,9 @@ var model53 = {
3084
3097
  }
3085
3098
  ]
3086
3099
  };
3087
- var ops_locations_default = model53;
3088
3100
 
3089
3101
  // src/models/ods/run-events.ts
3090
- var model54 = {
3102
+ var runEvents = {
3091
3103
  filenameBase: "run_event",
3092
3104
  filenameExtension: "txt",
3093
3105
  nonstandard: true,
@@ -3155,10 +3167,9 @@ var model54 = {
3155
3167
  }
3156
3168
  ]
3157
3169
  };
3158
- var run_events_default = model54;
3159
3170
 
3160
3171
  // src/models/ods/runs-pieces.ts
3161
- var model55 = {
3172
+ var runsPieces = {
3162
3173
  filenameBase: "runs_pieces",
3163
3174
  filenameExtension: "txt",
3164
3175
  nonstandard: true,
@@ -3215,67 +3226,6 @@ var model55 = {
3215
3226
  }
3216
3227
  ]
3217
3228
  };
3218
- var runs_pieces_default = model55;
3219
-
3220
- // src/models/models.ts
3221
- var models = [
3222
- agency_default,
3223
- areas_default,
3224
- attributions_default,
3225
- booking_rules_default,
3226
- calendar_dates_default,
3227
- calendar_default,
3228
- fare_attributes_default,
3229
- fare_leg_rules_default,
3230
- fare_media_default,
3231
- fare_products_default,
3232
- fare_rules_default,
3233
- fare_transfer_rules_default,
3234
- feed_info_default,
3235
- frequencies_default,
3236
- levels_default,
3237
- location_groups_default,
3238
- location_group_stops_default,
3239
- locations_default,
3240
- networks_default,
3241
- pathways_default,
3242
- route_networks_default,
3243
- routes_default,
3244
- shapes_default,
3245
- stop_areas_default,
3246
- stop_times_default,
3247
- stops_default,
3248
- timeframes_default,
3249
- transfers_default,
3250
- translations_default,
3251
- trips_default,
3252
- timetables_default,
3253
- timetable_pages_default,
3254
- timetable_stop_order_default,
3255
- timetable_notes_default,
3256
- timetable_notes_references_default,
3257
- trips_dated_vehicle_journey_default,
3258
- calendar_attributes_default,
3259
- directions_default,
3260
- route_attributes_default,
3261
- stop_attributes_default,
3262
- board_alight_default,
3263
- ride_feed_info_default,
3264
- rider_trip_default,
3265
- ridership_default,
3266
- trip_capacity_default,
3267
- trip_updates_default,
3268
- stop_time_updates_default,
3269
- vehicle_positions_default,
3270
- service_alerts_default,
3271
- service_alert_targets_default,
3272
- deadhead_times_default,
3273
- deadheads_default,
3274
- ops_locations_default,
3275
- run_events_default,
3276
- runs_pieces_default
3277
- ];
3278
- var models_default = models;
3279
3229
 
3280
3230
  // src/lib/db.ts
3281
3231
  import Database from "better-sqlite3";
@@ -3359,8 +3309,8 @@ function validateConfigForImport(config) {
3359
3309
  if (!config.agencies || config.agencies.length === 0) {
3360
3310
  throw new Error("No `agencies` specified in config");
3361
3311
  }
3362
- for (const [index, agency] of config.agencies.entries()) {
3363
- if (!agency.path && !agency.url) {
3312
+ for (const [index, agency2] of config.agencies.entries()) {
3313
+ if (!agency2.path && !agency2.url) {
3364
3314
  throw new Error(
3365
3315
  `No Agency \`url\` or \`path\` specified in config for agency index ${index}.`
3366
3316
  );
@@ -3400,31 +3350,34 @@ function padLeadingZeros(time) {
3400
3350
 
3401
3351
  // src/lib/import.ts
3402
3352
  var downloadFiles = async (task) => {
3403
- task.log(`Downloading GTFS from ${task.agency_url}`);
3353
+ task.log(`Downloading GTFS from ${task.url}`);
3404
3354
  task.path = `${task.downloadDir}/gtfs.zip`;
3405
- const response = await fetch(task.agency_url, {
3355
+ const response = await fetch(task.url, {
3406
3356
  method: "GET",
3407
3357
  headers: task.headers || {},
3408
3358
  signal: task.downloadTimeout ? AbortSignal.timeout(task.downloadTimeout) : void 0
3409
3359
  });
3410
3360
  if (response.status !== 200) {
3411
- throw new Error(`Unable to download GTFS from ${task.agency_url}`);
3361
+ throw new Error(`Unable to download GTFS from ${task.url}`);
3412
3362
  }
3413
3363
  const buffer = await response.arrayBuffer();
3414
3364
  await writeFile(task.path, Buffer.from(buffer));
3415
3365
  task.log("Download successful");
3416
3366
  };
3417
- var downloadGtfsRealtimeData = async (url, task) => {
3418
- const response = await fetch(url, {
3367
+ var downloadGtfsRealtimeData = async (urlAndHeaders, task) => {
3368
+ task.log(`Downloading GTFS-Realtime from ${urlAndHeaders.url}`);
3369
+ const response = await fetch(urlAndHeaders.url, {
3419
3370
  method: "GET",
3420
3371
  headers: {
3421
- ...task.realtime_headers || {},
3372
+ ...urlAndHeaders.headers ?? {},
3422
3373
  "Accept-Encoding": "gzip"
3423
3374
  },
3424
3375
  signal: task.downloadTimeout ? AbortSignal.timeout(task.downloadTimeout) : void 0
3425
3376
  });
3426
3377
  if (response.status !== 200) {
3427
- task.logWarning(`Unable to download GTFS-Realtime from ${url}`);
3378
+ task.logWarning(
3379
+ `Unable to download GTFS-Realtime from ${urlAndHeaders.url}`
3380
+ );
3428
3381
  return null;
3429
3382
  }
3430
3383
  const buffer = await response.arrayBuffer();
@@ -3484,71 +3437,74 @@ var prepareRealtimeValue = (entity, column, task) => {
3484
3437
  );
3485
3438
  };
3486
3439
  var updateRealtimeData = async (task) => {
3487
- if (!task.realtime_urls) {
3440
+ if (task.realtimeAlerts === void 0 && task.realtimeTripUpdates === void 0 && task.realtimeVehiclePositions === void 0) {
3488
3441
  return;
3489
3442
  }
3490
3443
  const db = openDb({
3491
3444
  sqlitePath: task.sqlitePath
3492
3445
  });
3493
- const vehiclePositionsModel = models_default.find(
3494
- (x) => x.filenameBase === "vehicle_positions"
3495
- );
3496
- const tripUpdatesModel = models_default.find(
3497
- (x) => x.filenameBase === "trip_updates"
3498
- );
3499
- const stoptimeUpdatesModel = models_default.find(
3500
- (x) => x.filenameBase === "stop_time_updates"
3501
- );
3502
- const serviceAlertsModel = models_default.find(
3503
- (x) => x.filenameBase === "service_alerts"
3504
- );
3505
- const serviceAlertTargetsModel = models_default.find(
3506
- (x) => x.filenameBase === "service_alert_targets"
3507
- );
3508
- if (!vehiclePositionsModel || !tripUpdatesModel || !stoptimeUpdatesModel || !serviceAlertsModel || !serviceAlertTargetsModel) {
3509
- task.logError("GTFS-Realtime models definitions not found");
3510
- return;
3511
- }
3512
- task.log(
3513
- `Starting GTFS-Realtime import from ${task.realtime_urls.length} urls`
3514
- );
3515
- for (const realtimeUrl of task.realtime_urls) {
3516
- task.log(`Downloading GTFS-Realtime from ${realtimeUrl}`);
3517
- const gtfsRealtimeData = await downloadGtfsRealtimeData(realtimeUrl, task);
3518
- if (!gtfsRealtimeData?.entity) {
3519
- continue;
3520
- }
3521
- task.log(`Download successful`);
3522
- let totalLineCount = 0;
3523
- for (const entity of gtfsRealtimeData.entity) {
3524
- let model56;
3525
- if (entity.vehicle) {
3526
- model56 = vehiclePositionsModel;
3527
- }
3528
- if (entity.tripUpdate) {
3529
- model56 = tripUpdatesModel;
3530
- }
3531
- if (entity.alert) {
3532
- model56 = serviceAlertsModel;
3533
- }
3534
- if (!model56) {
3535
- break;
3536
- }
3537
- const fieldValues = model56.schema.map(
3538
- (column) => prepareRealtimeValue(entity, column, task)
3539
- );
3540
- try {
3541
- db.prepare(
3542
- `REPLACE INTO ${model56.filenameBase} (${model56.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3543
- ).run();
3544
- } catch (error) {
3545
- task.logWarning("Import error: " + error.message);
3446
+ if (task.realtimeAlerts?.url) {
3447
+ const gtfsRealtimeData = await downloadGtfsRealtimeData(
3448
+ task.realtimeAlerts,
3449
+ task
3450
+ );
3451
+ if (gtfsRealtimeData?.entity) {
3452
+ task.log(`Download successful`);
3453
+ let totalLineCount = 0;
3454
+ for (const entity of gtfsRealtimeData.entity) {
3455
+ const fieldValues = serviceAlerts.schema.map(
3456
+ (column) => prepareRealtimeValue(entity, column, task)
3457
+ );
3458
+ try {
3459
+ db.prepare(
3460
+ `REPLACE INTO ${serviceAlerts.filenameBase} (${serviceAlerts.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3461
+ ).run();
3462
+ } catch (error) {
3463
+ task.logWarning("Import error: " + error.message);
3464
+ }
3465
+ const alertTargetArray = [];
3466
+ for (const informedEntity of entity.alert.informedEntity) {
3467
+ informedEntity.parent = entity;
3468
+ const subValues = serviceAlertTargets.schema.map(
3469
+ (column) => prepareRealtimeValue(informedEntity, column, task)
3470
+ );
3471
+ alertTargetArray.push(`(${subValues.join(", ")})`);
3472
+ totalLineCount++;
3473
+ }
3474
+ try {
3475
+ db.prepare(
3476
+ `REPLACE INTO ${serviceAlertTargets.filenameBase} (${serviceAlertTargets.schema.map((column) => column.name).join(", ")}) VALUES ${alertTargetArray.join(", ")}`
3477
+ ).run();
3478
+ } catch (error) {
3479
+ task.logWarning("Import error: " + error.message);
3480
+ }
3481
+ task.log(`Importing - ${totalLineCount++} entries imported\r`, true);
3546
3482
  }
3547
- if (entity.tripUpdate) {
3483
+ }
3484
+ }
3485
+ if (task.realtimeTripUpdates?.url) {
3486
+ const gtfsRealtimeData = await downloadGtfsRealtimeData(
3487
+ task.realtimeTripUpdates,
3488
+ task
3489
+ );
3490
+ if (gtfsRealtimeData?.entity) {
3491
+ task.log(`Download successful`);
3492
+ let totalLineCount = 0;
3493
+ for (const entity of gtfsRealtimeData.entity) {
3494
+ const fieldValues = tripUpdates.schema.map(
3495
+ (column) => prepareRealtimeValue(entity, column, task)
3496
+ );
3497
+ try {
3498
+ db.prepare(
3499
+ `REPLACE INTO ${tripUpdates.filenameBase} (${tripUpdates.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3500
+ ).run();
3501
+ } catch (error) {
3502
+ task.logWarning("Import error: " + error.message);
3503
+ }
3548
3504
  const stopTimeUpdateArray = [];
3549
3505
  for (const stopTimeUpdate of entity.tripUpdate.stopTimeUpdate) {
3550
3506
  stopTimeUpdate.parent = entity;
3551
- const subValues = stoptimeUpdatesModel.schema.map(
3507
+ const subValues = stopTimeUpdates.schema.map(
3552
3508
  (column) => prepareRealtimeValue(stopTimeUpdate, column, task)
3553
3509
  );
3554
3510
  stopTimeUpdateArray.push(`(${subValues.join(", ")})`);
@@ -3556,31 +3512,36 @@ var updateRealtimeData = async (task) => {
3556
3512
  }
3557
3513
  try {
3558
3514
  db.prepare(
3559
- `REPLACE INTO ${stoptimeUpdatesModel.filenameBase} (${stoptimeUpdatesModel.schema.map((column) => column.name).join(", ")}) VALUES ${stopTimeUpdateArray.join(", ")}`
3515
+ `REPLACE INTO ${stopTimeUpdates.filenameBase} (${stopTimeUpdates.schema.map((column) => column.name).join(", ")}) VALUES ${stopTimeUpdateArray.join(", ")}`
3560
3516
  ).run();
3561
3517
  } catch (error) {
3562
3518
  task.logWarning("Import error: " + error.message);
3563
3519
  }
3520
+ task.log(`Importing - ${totalLineCount++} entries imported\r`, true);
3564
3521
  }
3565
- if (entity.alert) {
3566
- const alertTargetArray = [];
3567
- for (const informedEntity of entity.alert.informedEntity) {
3568
- informedEntity.parent = entity;
3569
- const subValues = serviceAlertTargetsModel.schema.map(
3570
- (column) => prepareRealtimeValue(informedEntity, column, task)
3571
- );
3572
- alertTargetArray.push(`(${subValues.join(", ")})`);
3573
- totalLineCount++;
3574
- }
3522
+ }
3523
+ }
3524
+ if (task.realtimeVehiclePositions?.url) {
3525
+ const gtfsRealtimeData = await downloadGtfsRealtimeData(
3526
+ task.realtimeVehiclePositions,
3527
+ task
3528
+ );
3529
+ if (gtfsRealtimeData?.entity) {
3530
+ task.log(`Download successful`);
3531
+ let totalLineCount = 0;
3532
+ for (const entity of gtfsRealtimeData.entity) {
3533
+ const fieldValues = tripUpdates.schema.map(
3534
+ (column) => prepareRealtimeValue(entity, column, task)
3535
+ );
3575
3536
  try {
3576
3537
  db.prepare(
3577
- `REPLACE INTO ${serviceAlertTargetsModel.filenameBase} (${serviceAlertTargetsModel.schema.map((column) => column.name).join(", ")}) VALUES ${alertTargetArray.join(", ")}`
3538
+ `REPLACE INTO ${tripUpdates.filenameBase} (${tripUpdates.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
3578
3539
  ).run();
3579
3540
  } catch (error) {
3580
3541
  task.logWarning("Import error: " + error.message);
3581
3542
  }
3543
+ task.log(`Importing - ${totalLineCount++} entries imported\r`, true);
3582
3544
  }
3583
- task.log(`Importing - ${totalLineCount++} entries imported\r`, true);
3584
3545
  }
3585
3546
  }
3586
3547
  task.log(`GTFS-Realtime data import complete`);
@@ -3639,11 +3600,11 @@ var readFiles = async (task) => {
3639
3600
  }
3640
3601
  };
3641
3602
  var createTables = (db) => {
3642
- for (const model56 of models_default) {
3643
- if (!model56.schema) {
3603
+ for (const model of Object.values(models_exports)) {
3604
+ if (!model.schema) {
3644
3605
  return;
3645
3606
  }
3646
- const columns = model56.schema.map((column) => {
3607
+ const columns = model.schema.map((column) => {
3647
3608
  let check = "";
3648
3609
  if (column.min !== void 0 && column.max) {
3649
3610
  check = `CHECK( ${column.name} >= ${column.min} AND ${column.name} <= ${column.max} )`;
@@ -3657,34 +3618,34 @@ var createTables = (db) => {
3657
3618
  const columnCollation = column.nocase ? "COLLATE NOCASE" : "";
3658
3619
  return `${column.name} ${column.type} ${check} ${required} ${columnDefault} ${columnCollation}`;
3659
3620
  });
3660
- const primaryColumns = model56.schema.filter((column) => column.primary);
3621
+ const primaryColumns = model.schema.filter((column) => column.primary);
3661
3622
  if (primaryColumns.length > 0) {
3662
3623
  columns.push(
3663
3624
  `PRIMARY KEY (${primaryColumns.map((column) => column.name).join(", ")})`
3664
3625
  );
3665
3626
  }
3666
- db.prepare(`DROP TABLE IF EXISTS ${model56.filenameBase};`).run();
3627
+ db.prepare(`DROP TABLE IF EXISTS ${model.filenameBase};`).run();
3667
3628
  db.prepare(
3668
- `CREATE TABLE ${model56.filenameBase} (${columns.join(", ")});`
3629
+ `CREATE TABLE ${model.filenameBase} (${columns.join(", ")});`
3669
3630
  ).run();
3670
- for (const column of model56.schema.filter((column2) => column2.index)) {
3631
+ for (const column of model.schema.filter((column2) => column2.index)) {
3671
3632
  db.prepare(
3672
- `CREATE INDEX idx_${model56.filenameBase}_${column.name} ON ${model56.filenameBase} (${column.name});`
3633
+ `CREATE INDEX idx_${model.filenameBase}_${column.name} ON ${model.filenameBase} (${column.name});`
3673
3634
  ).run();
3674
3635
  }
3675
3636
  }
3676
3637
  };
3677
- var formatLine = (line, model56, totalLineCount) => {
3638
+ var formatLine = (line, model, totalLineCount) => {
3678
3639
  const lineNumber = totalLineCount + 1;
3679
3640
  const formattedLine = {};
3680
- for (const columnSchema of model56.schema) {
3641
+ for (const columnSchema of model.schema) {
3681
3642
  const lineValue = line[columnSchema.name];
3682
3643
  if (columnSchema.type === "date") {
3683
3644
  if (lineValue !== "" && lineValue !== void 0) {
3684
3645
  const dateValue = lineValue.replace(/-/g, "");
3685
3646
  if (dateValue.length !== 8) {
3686
3647
  throw new Error(
3687
- `Invalid date in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3648
+ `Invalid date in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3688
3649
  );
3689
3650
  }
3690
3651
  formattedLine[columnSchema.name] = Number.parseInt(dateValue, 10);
@@ -3701,17 +3662,17 @@ var formatLine = (line, model56, totalLineCount) => {
3701
3662
  }
3702
3663
  if (columnSchema.required === true && formattedLine[columnSchema.name] === null) {
3703
3664
  throw new Error(
3704
- `Missing required value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3665
+ `Missing required value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}.`
3705
3666
  );
3706
3667
  }
3707
3668
  if (columnSchema.min !== void 0 && formattedLine[columnSchema.name] < columnSchema.min) {
3708
3669
  throw new Error(
3709
- `Invalid value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: below minimum value of ${columnSchema.min}.`
3670
+ `Invalid value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: below minimum value of ${columnSchema.min}.`
3710
3671
  );
3711
3672
  }
3712
3673
  if (columnSchema.max !== void 0 && formattedLine[columnSchema.name] > columnSchema.max) {
3713
3674
  throw new Error(
3714
- `Invalid value in ${model56.filenameBase}.${model56.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: above maximum value of ${columnSchema.max}.`
3675
+ `Invalid value in ${model.filenameBase}.${model.filenameExtension} for ${columnSchema.name} on line ${lineNumber}: above maximum value of ${columnSchema.max}.`
3715
3676
  );
3716
3677
  }
3717
3678
  }
@@ -3737,7 +3698,7 @@ var formatLine = (line, model56, totalLineCount) => {
3737
3698
  }
3738
3699
  return formattedLine;
3739
3700
  };
3740
- var importLines = (task, lines, model56, totalLineCount) => {
3701
+ var importLines = (task, lines, model, totalLineCount) => {
3741
3702
  const db = openDb({
3742
3703
  sqlitePath: task.sqlitePath
3743
3704
  });
@@ -3745,7 +3706,7 @@ var importLines = (task, lines, model56, totalLineCount) => {
3745
3706
  return;
3746
3707
  }
3747
3708
  const linesToImportCount = lines.length;
3748
- const columns = model56.schema.filter((column) => column.name !== "id");
3709
+ const columns = model.schema.filter((column) => column.name !== "id");
3749
3710
  const placeholders = [];
3750
3711
  const values = [];
3751
3712
  while (lines.length > 0) {
@@ -3765,59 +3726,59 @@ var importLines = (task, lines, model56, totalLineCount) => {
3765
3726
  }
3766
3727
  try {
3767
3728
  db.prepare(
3768
- `INSERT ${task.ignoreDuplicates ? "OR IGNORE" : ""} INTO ${model56.filenameBase} (${columns.map((column) => column.name).join(", ")}) VALUES ${placeholders.join(",")}`
3729
+ `INSERT ${task.ignoreDuplicates ? "OR IGNORE" : ""} INTO ${model.filenameBase} (${columns.map((column) => column.name).join(", ")}) VALUES ${placeholders.join(",")}`
3769
3730
  ).run(...values);
3770
3731
  } catch (error) {
3771
3732
  if (error.code === "SQLITE_CONSTRAINT_PRIMARYKEY") {
3772
- const primaryColumns = model56.schema.filter((column) => column.primary);
3733
+ const primaryColumns = model.schema.filter((column) => column.primary);
3773
3734
  task.logWarning(
3774
- `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`
3735
+ `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`
3775
3736
  );
3776
3737
  }
3777
3738
  task.logWarning(
3778
- `Check ${model56.filenameBase}.${model56.filenameExtension} for invalid data between lines ${totalLineCount - linesToImportCount} and ${totalLineCount}.`
3739
+ `Check ${model.filenameBase}.${model.filenameExtension} for invalid data between lines ${totalLineCount - linesToImportCount} and ${totalLineCount}.`
3779
3740
  );
3780
3741
  throw error;
3781
3742
  }
3782
3743
  task.log(
3783
- `Importing - ${model56.filenameBase}.${model56.filenameExtension} - ${totalLineCount} lines imported\r`,
3744
+ `Importing - ${model.filenameBase}.${model.filenameExtension} - ${totalLineCount} lines imported\r`,
3784
3745
  true
3785
3746
  );
3786
3747
  };
3787
3748
  var importFiles = (task) => mapSeries(
3788
- models_default,
3789
- (model56) => new Promise((resolve, reject) => {
3749
+ Object.values(models_exports),
3750
+ (model) => new Promise((resolve, reject) => {
3790
3751
  const lines = [];
3791
3752
  let totalLineCount = 0;
3792
3753
  const maxInsertVariables = 32e3;
3793
- if (task.exclude && task.exclude.includes(model56.filenameBase)) {
3754
+ if (task.exclude && task.exclude.includes(model.filenameBase)) {
3794
3755
  task.log(
3795
- `Skipping - ${model56.filenameBase}.${model56.filenameExtension}\r`
3756
+ `Skipping - ${model.filenameBase}.${model.filenameExtension}\r`
3796
3757
  );
3797
3758
  resolve();
3798
3759
  return;
3799
3760
  }
3800
- if (model56.extension === "gtfs-realtime") {
3761
+ if (model.extension === "gtfs-realtime") {
3801
3762
  resolve();
3802
3763
  return;
3803
3764
  }
3804
3765
  const filepath = path2.join(
3805
3766
  task.downloadDir,
3806
- `${model56.filenameBase}.${model56.filenameExtension}`
3767
+ `${model.filenameBase}.${model.filenameExtension}`
3807
3768
  );
3808
3769
  if (!existsSync2(filepath)) {
3809
- if (!model56.nonstandard) {
3770
+ if (!model.nonstandard) {
3810
3771
  task.log(
3811
- `Importing - ${model56.filenameBase}.${model56.filenameExtension} - No file found\r`
3772
+ `Importing - ${model.filenameBase}.${model.filenameExtension} - No file found\r`
3812
3773
  );
3813
3774
  }
3814
3775
  resolve();
3815
3776
  return;
3816
3777
  }
3817
3778
  task.log(
3818
- `Importing - ${model56.filenameBase}.${model56.filenameExtension}\r`
3779
+ `Importing - ${model.filenameBase}.${model.filenameExtension}\r`
3819
3780
  );
3820
- if (model56.filenameExtension === "txt") {
3781
+ if (model.filenameExtension === "txt") {
3821
3782
  const parser = parse({
3822
3783
  columns: true,
3823
3784
  relax_quotes: true,
@@ -3830,9 +3791,9 @@ var importFiles = (task) => mapSeries(
3830
3791
  while (record = parser.read()) {
3831
3792
  try {
3832
3793
  totalLineCount += 1;
3833
- lines.push(formatLine(record, model56, totalLineCount));
3834
- if (lines.length >= maxInsertVariables / model56.schema.length) {
3835
- importLines(task, lines, model56, totalLineCount);
3794
+ lines.push(formatLine(record, model, totalLineCount));
3795
+ if (lines.length >= maxInsertVariables / model.schema.length) {
3796
+ importLines(task, lines, model, totalLineCount);
3836
3797
  }
3837
3798
  } catch (error) {
3838
3799
  reject(error);
@@ -3841,7 +3802,7 @@ var importFiles = (task) => mapSeries(
3841
3802
  });
3842
3803
  parser.on("end", () => {
3843
3804
  try {
3844
- importLines(task, lines, model56, totalLineCount);
3805
+ importLines(task, lines, model, totalLineCount);
3845
3806
  } catch (error) {
3846
3807
  reject(error);
3847
3808
  }
@@ -3849,22 +3810,22 @@ var importFiles = (task) => mapSeries(
3849
3810
  });
3850
3811
  parser.on("error", reject);
3851
3812
  createReadStream(filepath).pipe(stripBomStream()).pipe(parser);
3852
- } else if (model56.filenameExtension === "geojson") {
3813
+ } else if (model.filenameExtension === "geojson") {
3853
3814
  readFile2(filepath, "utf8").then((data) => {
3854
3815
  if (isValidJSON(data) === false) {
3855
3816
  reject(
3856
3817
  new Error(
3857
- `Invalid JSON in ${model56.filenameBase}.${model56.filenameExtension}`
3818
+ `Invalid JSON in ${model.filenameBase}.${model.filenameExtension}`
3858
3819
  )
3859
3820
  );
3860
3821
  }
3861
- const line = formatLine({ geojson: data }, model56, totalLineCount);
3862
- importLines(task, [line], model56, totalLineCount);
3822
+ const line = formatLine({ geojson: data }, model, totalLineCount);
3823
+ importLines(task, [line], model, totalLineCount);
3863
3824
  resolve();
3864
3825
  }).catch(reject);
3865
3826
  } else {
3866
3827
  reject(
3867
- new Error(`Unsupported file type: ${model56.filenameExtension}`)
3828
+ new Error(`Unsupported file type: ${model.filenameExtension}`)
3868
3829
  );
3869
3830
  }
3870
3831
  })
@@ -3888,29 +3849,30 @@ async function importGtfs(initialConfig) {
3888
3849
  createTables(db);
3889
3850
  await mapSeries(
3890
3851
  config.agencies,
3891
- async (agency) => {
3852
+ async (agency2) => {
3892
3853
  const tempPath = temporaryDirectory();
3893
3854
  const task = {
3894
- exclude: agency.exclude,
3895
- agency_url: agency.url,
3896
- headers: agency.headers,
3897
- realtime_headers: agency.realtimeHeaders,
3898
- realtime_urls: agency.realtimeUrls,
3855
+ exclude: agency2.exclude,
3856
+ url: agency2.url,
3857
+ headers: agency2.headers,
3858
+ realtimeAlerts: agency2.realtimeAlerts,
3859
+ realtimeTripUpdates: agency2.realtimeTripUpdates,
3860
+ realtimeVehiclePositions: agency2.realtimeVehiclePositions,
3899
3861
  downloadDir: tempPath,
3900
3862
  downloadTimeout: config.downloadTimeout,
3901
3863
  gtfsRealtimeExpirationSeconds: config.gtfsRealtimeExpirationSeconds,
3902
- path: agency.path,
3864
+ path: agency2.path,
3903
3865
  csvOptions: config.csvOptions || {},
3904
3866
  ignoreDuplicates: config.ignoreDuplicates,
3905
3867
  sqlitePath: config.sqlitePath,
3906
- prefix: agency.prefix,
3868
+ prefix: agency2.prefix,
3907
3869
  currentTimestamp: Math.floor(Date.now() / 1e3),
3908
3870
  log: log2,
3909
3871
  logWarning: logWarning2,
3910
3872
  logError: logError2
3911
3873
  };
3912
3874
  try {
3913
- if (task.agency_url) {
3875
+ if (task.url) {
3914
3876
  await downloadFiles(task);
3915
3877
  }
3916
3878
  await readFiles(task);
@@ -3951,171 +3913,15 @@ import untildify4 from "untildify";
3951
3913
  // src/lib/advancedQuery.ts
3952
3914
  import sqlString4 from "sqlstring-sqlite";
3953
3915
 
3954
- // src/lib/gtfs/agencies.ts
3955
- import sqlString5 from "sqlstring-sqlite";
3956
-
3957
- // src/lib/gtfs/areas.ts
3958
- import sqlString6 from "sqlstring-sqlite";
3959
-
3960
- // src/lib/gtfs/attributions.ts
3961
- import sqlString7 from "sqlstring-sqlite";
3962
-
3963
- // src/lib/gtfs/booking-rules.ts
3964
- import sqlString8 from "sqlstring-sqlite";
3965
-
3966
- // src/lib/gtfs/calendar-dates.ts
3967
- import sqlString9 from "sqlstring-sqlite";
3968
-
3969
- // src/lib/gtfs/calendars.ts
3970
- import sqlString10 from "sqlstring-sqlite";
3971
-
3972
- // src/lib/gtfs/fare-attributes.ts
3973
- import sqlString11 from "sqlstring-sqlite";
3974
-
3975
- // src/lib/gtfs/fare-leg-rules.ts
3976
- import sqlString12 from "sqlstring-sqlite";
3977
-
3978
- // src/lib/gtfs/fare-media.ts
3979
- import sqlString13 from "sqlstring-sqlite";
3980
-
3981
- // src/lib/gtfs/fare-products.ts
3982
- import sqlString14 from "sqlstring-sqlite";
3983
-
3984
- // src/lib/gtfs/fare-rules.ts
3985
- import sqlString15 from "sqlstring-sqlite";
3986
-
3987
- // src/lib/gtfs/fare-transfer-rules.ts
3988
- import sqlString16 from "sqlstring-sqlite";
3989
-
3990
- // src/lib/gtfs/feed-info.ts
3991
- import sqlString17 from "sqlstring-sqlite";
3992
-
3993
- // src/lib/gtfs/frequencies.ts
3994
- import sqlString18 from "sqlstring-sqlite";
3995
-
3996
- // src/lib/gtfs/levels.ts
3997
- import sqlString19 from "sqlstring-sqlite";
3998
-
3999
- // src/lib/gtfs/location-groups.ts
4000
- import sqlString20 from "sqlstring-sqlite";
4001
-
4002
- // src/lib/gtfs/location-group-stops.ts
4003
- import sqlString21 from "sqlstring-sqlite";
4004
-
4005
- // src/lib/gtfs/locations.ts
4006
- import sqlString22 from "sqlstring-sqlite";
4007
-
4008
- // src/lib/gtfs/networks.ts
4009
- import sqlString23 from "sqlstring-sqlite";
4010
-
4011
- // src/lib/gtfs/pathways.ts
4012
- import sqlString24 from "sqlstring-sqlite";
4013
-
4014
- // src/lib/gtfs/route-networks.ts
4015
- import sqlString25 from "sqlstring-sqlite";
4016
-
4017
3916
  // src/lib/gtfs/routes.ts
4018
3917
  import { omit as omit3, pick } from "lodash-es";
4019
- import sqlString26 from "sqlstring-sqlite";
4020
3918
 
4021
3919
  // src/lib/gtfs/shapes.ts
4022
3920
  import { compact as compact2, omit as omit4, pick as pick2 } from "lodash-es";
4023
- import sqlString28 from "sqlstring-sqlite";
4024
3921
  import { featureCollection as featureCollection2 } from "@turf/helpers";
4025
3922
 
4026
- // src/lib/gtfs-plus/route-attributes.ts
4027
- import sqlString27 from "sqlstring-sqlite";
4028
-
4029
- // src/lib/gtfs/stop-areas.ts
4030
- import sqlString29 from "sqlstring-sqlite";
4031
-
4032
3923
  // src/lib/gtfs/stops.ts
4033
3924
  import { omit as omit5, orderBy, pick as pick3 } from "lodash-es";
4034
- import sqlString31 from "sqlstring-sqlite";
4035
-
4036
- // src/lib/gtfs-plus/stop-attributes.ts
4037
- import sqlString30 from "sqlstring-sqlite";
4038
-
4039
- // src/lib/gtfs/stop-times.ts
4040
- import sqlString32 from "sqlstring-sqlite";
4041
-
4042
- // src/lib/gtfs/timeframes.ts
4043
- import sqlString33 from "sqlstring-sqlite";
4044
-
4045
- // src/lib/gtfs/transfers.ts
4046
- import sqlString34 from "sqlstring-sqlite";
4047
-
4048
- // src/lib/gtfs/translations.ts
4049
- import sqlString35 from "sqlstring-sqlite";
4050
-
4051
- // src/lib/gtfs/trips.ts
4052
- import sqlString36 from "sqlstring-sqlite";
4053
-
4054
- // src/lib/gtfs-plus/calendar-attributes.ts
4055
- import sqlString37 from "sqlstring-sqlite";
4056
-
4057
- // src/lib/gtfs-plus/directions.ts
4058
- import sqlString38 from "sqlstring-sqlite";
4059
-
4060
- // src/lib/non-standard/timetables.ts
4061
- import sqlString39 from "sqlstring-sqlite";
4062
-
4063
- // src/lib/non-standard/timetable-stop-order.ts
4064
- import sqlString40 from "sqlstring-sqlite";
4065
-
4066
- // src/lib/non-standard/timetable-pages.ts
4067
- import sqlString41 from "sqlstring-sqlite";
4068
-
4069
- // src/lib/non-standard/timetable-notes.ts
4070
- import sqlString42 from "sqlstring-sqlite";
4071
-
4072
- // src/lib/non-standard/timetable-notes-references.ts
4073
- import sqlString43 from "sqlstring-sqlite";
4074
-
4075
- // src/lib/non-standard/trips-dated-vehicle-journey.ts
4076
- import sqlString44 from "sqlstring-sqlite";
4077
-
4078
- // src/lib/gtfs-ride/board-alights.ts
4079
- import sqlString45 from "sqlstring-sqlite";
4080
-
4081
- // src/lib/gtfs-ride/ride-feed-infos.ts
4082
- import sqlString46 from "sqlstring-sqlite";
4083
-
4084
- // src/lib/gtfs-ride/rider-trips.ts
4085
- import sqlString47 from "sqlstring-sqlite";
4086
-
4087
- // src/lib/gtfs-ride/riderships.ts
4088
- import sqlString48 from "sqlstring-sqlite";
4089
-
4090
- // src/lib/gtfs-ride/trip-capacities.ts
4091
- import sqlString49 from "sqlstring-sqlite";
4092
-
4093
- // src/lib/gtfs-realtime/stop-time-updates.ts
4094
- import sqlString50 from "sqlstring-sqlite";
4095
-
4096
- // src/lib/gtfs-realtime/trip-updates.ts
4097
- import sqlString51 from "sqlstring-sqlite";
4098
-
4099
- // src/lib/gtfs-realtime/vehicle-positions.ts
4100
- import sqlString52 from "sqlstring-sqlite";
4101
-
4102
- // src/lib/gtfs-realtime/service-alerts.ts
4103
- import sqlString53 from "sqlstring-sqlite";
4104
-
4105
- // src/lib/ods/deadheads.ts
4106
- import sqlString54 from "sqlstring-sqlite";
4107
-
4108
- // src/lib/ods/deadhead-times.ts
4109
- import sqlString55 from "sqlstring-sqlite";
4110
-
4111
- // src/lib/ods/ops-locations.ts
4112
- import sqlString56 from "sqlstring-sqlite";
4113
-
4114
- // src/lib/ods/run-events.ts
4115
- import sqlString57 from "sqlstring-sqlite";
4116
-
4117
- // src/lib/ods/runs-pieces.ts
4118
- import sqlString58 from "sqlstring-sqlite";
4119
3925
 
4120
3926
  // src/bin/gtfs-import.ts
4121
3927
  var pe = new PrettyError();