gtfs 4.14.0 → 4.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/gtfs-export.js +4 -8
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +5 -9
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +142 -4
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +307 -36
- package/dist/index.js +30 -29
- package/dist/index.js.map +1 -1
- package/dist/models/models.d.ts +0 -8
- package/dist/models/models.js +0 -5
- package/dist/models/models.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import CsvParse from 'csv-parse';
|
|
|
2
2
|
import Database from 'better-sqlite3';
|
|
3
3
|
import { FeatureCollection } from 'geojson';
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
interface ConfigAgency {
|
|
6
6
|
exclude?: string[];
|
|
7
7
|
url?: string;
|
|
8
8
|
path?: string;
|
|
@@ -21,7 +21,7 @@ interface IAgency {
|
|
|
21
21
|
};
|
|
22
22
|
prefix?: string;
|
|
23
23
|
}
|
|
24
|
-
interface
|
|
24
|
+
interface Config {
|
|
25
25
|
db?: Database.Database;
|
|
26
26
|
sqlitePath?: string;
|
|
27
27
|
ignoreDuplicates?: boolean;
|
|
@@ -30,7 +30,7 @@ interface IConfig {
|
|
|
30
30
|
csvOptions?: CsvParse.Options;
|
|
31
31
|
exportPath?: string;
|
|
32
32
|
ignoreErrors?: boolean;
|
|
33
|
-
agencies:
|
|
33
|
+
agencies: ConfigAgency[];
|
|
34
34
|
verbose?: boolean;
|
|
35
35
|
logFunction?: (message: string) => void;
|
|
36
36
|
}
|
|
@@ -48,11 +48,282 @@ interface QueryOptions {
|
|
|
48
48
|
bounding_box_side_m?: number;
|
|
49
49
|
}
|
|
50
50
|
type SqlResults = Array<Record<string, any>>;
|
|
51
|
+
interface Agency {
|
|
52
|
+
agency_id?: string;
|
|
53
|
+
agency_name: string;
|
|
54
|
+
agency_url: string;
|
|
55
|
+
agency_timezone: string;
|
|
56
|
+
agency_lang?: string;
|
|
57
|
+
agency_phone?: string;
|
|
58
|
+
agency_fare_url?: string;
|
|
59
|
+
agency_email?: string;
|
|
60
|
+
}
|
|
61
|
+
interface Area {
|
|
62
|
+
area_id: string;
|
|
63
|
+
area_name?: string;
|
|
64
|
+
}
|
|
65
|
+
interface Attribution {
|
|
66
|
+
attribution_id?: string;
|
|
67
|
+
agency_id?: string;
|
|
68
|
+
route_id?: string;
|
|
69
|
+
trip_id?: string;
|
|
70
|
+
organization_name: string;
|
|
71
|
+
is_producer?: 0 | 1;
|
|
72
|
+
is_operator?: 0 | 1;
|
|
73
|
+
is_authority?: 0 | 1;
|
|
74
|
+
attribution_url?: string;
|
|
75
|
+
attribution_email?: string;
|
|
76
|
+
attribution_phone?: string;
|
|
77
|
+
}
|
|
78
|
+
interface BookingRule {
|
|
79
|
+
booking_rule_id: string;
|
|
80
|
+
booking_type: 0 | 1 | 2;
|
|
81
|
+
prior_notice_duration_min?: number;
|
|
82
|
+
prior_notice_duration_max?: number;
|
|
83
|
+
prior_notice_last_day?: number;
|
|
84
|
+
prior_notice_last_time?: string;
|
|
85
|
+
prior_notice_last_timestamp?: number;
|
|
86
|
+
prior_notice_start_day?: number;
|
|
87
|
+
prior_notice_start_time?: string;
|
|
88
|
+
prior_notice_start_timestamp?: number;
|
|
89
|
+
prior_notice_service_id?: string;
|
|
90
|
+
message?: string;
|
|
91
|
+
pickup_message?: string;
|
|
92
|
+
drop_off_message?: string;
|
|
93
|
+
phone_number?: string;
|
|
94
|
+
info_url?: string;
|
|
95
|
+
booking_url?: string;
|
|
96
|
+
}
|
|
97
|
+
interface Calendar {
|
|
98
|
+
service_id: string;
|
|
99
|
+
monday: 0 | 1;
|
|
100
|
+
tuesday: 0 | 1;
|
|
101
|
+
wednesday: 0 | 1;
|
|
102
|
+
thursday: 0 | 1;
|
|
103
|
+
friday: 0 | 1;
|
|
104
|
+
saturday: 0 | 1;
|
|
105
|
+
sunday: 0 | 1;
|
|
106
|
+
start_date: number;
|
|
107
|
+
end_date: number;
|
|
108
|
+
}
|
|
109
|
+
interface CalendarDate {
|
|
110
|
+
service_id: string;
|
|
111
|
+
date: number;
|
|
112
|
+
exception_type: 1 | 2;
|
|
113
|
+
holiday_name?: string;
|
|
114
|
+
}
|
|
115
|
+
interface FareAttribute {
|
|
116
|
+
fare_id: string;
|
|
117
|
+
price: number;
|
|
118
|
+
currency_type: string;
|
|
119
|
+
payment_method: 0 | 1;
|
|
120
|
+
transfers: 0 | 1 | 2;
|
|
121
|
+
agency_id?: string;
|
|
122
|
+
transfer_duration?: number;
|
|
123
|
+
}
|
|
124
|
+
interface FareLegRule {
|
|
125
|
+
leg_group_id?: string;
|
|
126
|
+
network_id?: string;
|
|
127
|
+
from_area_id?: string;
|
|
128
|
+
to_area_id?: string;
|
|
129
|
+
from_timeframe_group_id?: string;
|
|
130
|
+
to_timeframe_group_id?: string;
|
|
131
|
+
fare_product_id: string;
|
|
132
|
+
rule_priority?: number;
|
|
133
|
+
}
|
|
134
|
+
interface FareMedia {
|
|
135
|
+
fare_media_id: string;
|
|
136
|
+
fare_media_name?: string;
|
|
137
|
+
fare_media_type: 0 | 1 | 2 | 3 | 4;
|
|
138
|
+
}
|
|
139
|
+
interface FareProduct {
|
|
140
|
+
fare_product_id: string;
|
|
141
|
+
fare_product_name?: string;
|
|
142
|
+
fare_media_id?: string;
|
|
143
|
+
amount: number;
|
|
144
|
+
currency: string;
|
|
145
|
+
}
|
|
146
|
+
interface FareRule {
|
|
147
|
+
fare_id: string;
|
|
148
|
+
route_id?: string;
|
|
149
|
+
origin_id?: string;
|
|
150
|
+
destination_id?: string;
|
|
151
|
+
contains_id?: string;
|
|
152
|
+
}
|
|
153
|
+
interface FareTransferRule {
|
|
154
|
+
from_leg_group_id?: string;
|
|
155
|
+
to_leg_group_id?: string;
|
|
156
|
+
transfer_count?: number;
|
|
157
|
+
duration_limit: number;
|
|
158
|
+
duration_limit_type?: 0 | 1 | 2 | 3;
|
|
159
|
+
fare_transfer_type: 0 | 1 | 2;
|
|
160
|
+
fare_product_id?: string;
|
|
161
|
+
}
|
|
162
|
+
interface FeedInfo {
|
|
163
|
+
feed_publisher_name: string;
|
|
164
|
+
feed_publisher_url: string;
|
|
165
|
+
feed_lang: string;
|
|
166
|
+
default_lang?: string;
|
|
167
|
+
feed_start_date?: number;
|
|
168
|
+
feed_end_date?: number;
|
|
169
|
+
feed_version?: string;
|
|
170
|
+
feed_contact_email?: string;
|
|
171
|
+
feed_contact_url?: string;
|
|
172
|
+
}
|
|
173
|
+
interface Frequency {
|
|
174
|
+
trip_id: string;
|
|
175
|
+
start_time: string;
|
|
176
|
+
start_timestamp: number;
|
|
177
|
+
end_time: string;
|
|
178
|
+
end_timestamp: number;
|
|
179
|
+
headway_secs: number;
|
|
180
|
+
exact_times?: 0 | 1;
|
|
181
|
+
}
|
|
182
|
+
interface Level {
|
|
183
|
+
level_id: string;
|
|
184
|
+
level_index: number;
|
|
185
|
+
level_name?: string;
|
|
186
|
+
}
|
|
187
|
+
interface LocationGroupStop {
|
|
188
|
+
location_group_id: string;
|
|
189
|
+
stop_id: string;
|
|
190
|
+
}
|
|
191
|
+
interface LocationGroup {
|
|
192
|
+
location_group_id: string;
|
|
193
|
+
location_group_name?: string;
|
|
194
|
+
}
|
|
195
|
+
interface Location {
|
|
196
|
+
geojson: string;
|
|
197
|
+
}
|
|
198
|
+
interface Network {
|
|
199
|
+
network_id: string;
|
|
200
|
+
network_name?: string;
|
|
201
|
+
}
|
|
202
|
+
interface Pathway {
|
|
203
|
+
pathway_id: string;
|
|
204
|
+
from_stop_id: string;
|
|
205
|
+
to_stop_id: string;
|
|
206
|
+
pathway_mode: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
207
|
+
is_bidirectional: 0 | 1;
|
|
208
|
+
length?: number;
|
|
209
|
+
traversal_time?: number;
|
|
210
|
+
stair_count?: number;
|
|
211
|
+
max_slope?: number;
|
|
212
|
+
min_width?: number;
|
|
213
|
+
signposted_as?: string;
|
|
214
|
+
reversed_signposted_as?: string;
|
|
215
|
+
}
|
|
216
|
+
interface RouteNetwork {
|
|
217
|
+
network_id: string;
|
|
218
|
+
route_id: string;
|
|
219
|
+
}
|
|
220
|
+
interface Route {
|
|
221
|
+
route_id: string;
|
|
222
|
+
agency_id?: string;
|
|
223
|
+
route_short_name?: string;
|
|
224
|
+
route_long_name?: string;
|
|
225
|
+
route_desc?: string;
|
|
226
|
+
route_type: number;
|
|
227
|
+
route_url?: string;
|
|
228
|
+
route_color?: string;
|
|
229
|
+
route_text_color?: string;
|
|
230
|
+
route_sort_order?: number;
|
|
231
|
+
continuous_pickup?: 0 | 1 | 2 | 3;
|
|
232
|
+
continuous_drop_off?: 0 | 1 | 2 | 3;
|
|
233
|
+
network_id?: string;
|
|
234
|
+
}
|
|
235
|
+
interface Shape {
|
|
236
|
+
shape_id: string;
|
|
237
|
+
shape_pt_lat: number;
|
|
238
|
+
shape_pt_lon: number;
|
|
239
|
+
shape_pt_sequence: number;
|
|
240
|
+
shape_dist_traveled?: number;
|
|
241
|
+
}
|
|
242
|
+
interface StopArea {
|
|
243
|
+
area_id: string;
|
|
244
|
+
stop_id: string;
|
|
245
|
+
}
|
|
246
|
+
interface StopTime {
|
|
247
|
+
trip_id: string;
|
|
248
|
+
arrival_time?: string;
|
|
249
|
+
arrival_timestamp?: number;
|
|
250
|
+
departure_time?: string;
|
|
251
|
+
departure_timestamp?: number;
|
|
252
|
+
location_group_id?: string;
|
|
253
|
+
location_id?: string;
|
|
254
|
+
stop_id?: string;
|
|
255
|
+
stop_sequence: number;
|
|
256
|
+
stop_headsign?: string;
|
|
257
|
+
start_pickup_drop_off_window?: string;
|
|
258
|
+
start_pickup_drop_off_window_timestamp?: number;
|
|
259
|
+
pickup_type?: 0 | 1 | 2 | 3;
|
|
260
|
+
drop_off_type?: 0 | 1 | 2 | 3;
|
|
261
|
+
continuous_pickup?: 0 | 1 | 2 | 3;
|
|
262
|
+
continuous_drop_off?: 0 | 1 | 2 | 3;
|
|
263
|
+
shape_dist_traveled?: number;
|
|
264
|
+
timepoint?: 0 | 1;
|
|
265
|
+
pickup_booking_rule_id?: string;
|
|
266
|
+
drop_off_booking_rule_id?: string;
|
|
267
|
+
}
|
|
268
|
+
interface Stop {
|
|
269
|
+
stop_id: string;
|
|
270
|
+
stop_code?: string;
|
|
271
|
+
stop_name?: string;
|
|
272
|
+
tts_stop_name?: string;
|
|
273
|
+
stop_desc?: string;
|
|
274
|
+
stop_lat?: number;
|
|
275
|
+
stop_lon?: number;
|
|
276
|
+
zone_id?: string;
|
|
277
|
+
stop_url?: string;
|
|
278
|
+
location_type?: 0 | 1 | 2 | 3 | 4;
|
|
279
|
+
parent_station?: string;
|
|
280
|
+
stop_timezone?: string;
|
|
281
|
+
wheelchair_boarding?: 0 | 1 | 2;
|
|
282
|
+
level_id?: string;
|
|
283
|
+
platform_code?: string;
|
|
284
|
+
}
|
|
285
|
+
interface Timeframe {
|
|
286
|
+
timeframe_group_id: string;
|
|
287
|
+
start_time?: string;
|
|
288
|
+
end_time?: string;
|
|
289
|
+
service_id: string;
|
|
290
|
+
}
|
|
291
|
+
interface Transfer {
|
|
292
|
+
from_stop_id?: string;
|
|
293
|
+
to_stop_id?: string;
|
|
294
|
+
from_route_id?: string;
|
|
295
|
+
to_route_id?: string;
|
|
296
|
+
from_trip_id?: string;
|
|
297
|
+
to_trip_id?: string;
|
|
298
|
+
transfer_type: 0 | 1 | 2 | 3 | 4 | 5;
|
|
299
|
+
min_transfer_time?: number;
|
|
300
|
+
}
|
|
301
|
+
interface Translation {
|
|
302
|
+
table_name: string;
|
|
303
|
+
field_name: string;
|
|
304
|
+
language: string;
|
|
305
|
+
translation: string;
|
|
306
|
+
record_id?: string;
|
|
307
|
+
record_sub_id?: string;
|
|
308
|
+
field_value?: string;
|
|
309
|
+
}
|
|
310
|
+
interface Trip {
|
|
311
|
+
route_id: string;
|
|
312
|
+
service_id: string;
|
|
313
|
+
trip_id: string;
|
|
314
|
+
trip_headsign?: string;
|
|
315
|
+
trip_short_name?: string;
|
|
316
|
+
direction_id?: 0 | 1;
|
|
317
|
+
block_id?: string;
|
|
318
|
+
shape_id?: string;
|
|
319
|
+
wheelchair_accessible?: 0 | 1 | 2;
|
|
320
|
+
bikes_allowed?: 0 | 1 | 2;
|
|
321
|
+
}
|
|
51
322
|
|
|
52
|
-
declare function importGtfs(initialConfig:
|
|
53
|
-
declare function updateGtfsRealtime(initialConfig:
|
|
323
|
+
declare function importGtfs(initialConfig: Config): Promise<void>;
|
|
324
|
+
declare function updateGtfsRealtime(initialConfig: Config): Promise<void>;
|
|
54
325
|
|
|
55
|
-
declare const exportGtfs: (initialConfig:
|
|
326
|
+
declare const exportGtfs: (initialConfig: Config) => Promise<void>;
|
|
56
327
|
|
|
57
328
|
declare function openDb(config?: {
|
|
58
329
|
db?: Database.Database;
|
|
@@ -70,67 +341,67 @@ declare function advancedQuery(table: string, advancedQueryOptions: {
|
|
|
70
341
|
options?: QueryOptions;
|
|
71
342
|
}): Array<Record<string, any>>;
|
|
72
343
|
|
|
73
|
-
declare function getAgencies(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
344
|
+
declare function getAgencies(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Agency[];
|
|
74
345
|
|
|
75
|
-
declare function getAreas(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
346
|
+
declare function getAreas(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Area[];
|
|
76
347
|
|
|
77
|
-
declare function getAttributions(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
348
|
+
declare function getAttributions(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Attribution[];
|
|
78
349
|
|
|
79
|
-
declare function getBookingRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
350
|
+
declare function getBookingRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): BookingRule[];
|
|
80
351
|
|
|
81
|
-
declare function getCalendarDates(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
352
|
+
declare function getCalendarDates(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): CalendarDate[];
|
|
82
353
|
|
|
83
|
-
declare function getCalendars(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
354
|
+
declare function getCalendars(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Calendar[];
|
|
84
355
|
|
|
85
|
-
declare function getFareAttributes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
356
|
+
declare function getFareAttributes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareAttribute[];
|
|
86
357
|
|
|
87
|
-
declare function getFareLegRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
358
|
+
declare function getFareLegRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareLegRule[];
|
|
88
359
|
|
|
89
|
-
declare function getFareMedia(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
360
|
+
declare function getFareMedia(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareMedia[];
|
|
90
361
|
|
|
91
|
-
declare function getFareProducts(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
362
|
+
declare function getFareProducts(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareProduct[];
|
|
92
363
|
|
|
93
|
-
declare function getFareRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
364
|
+
declare function getFareRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareRule[];
|
|
94
365
|
|
|
95
|
-
declare function getFareTransferRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
366
|
+
declare function getFareTransferRules(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FareTransferRule[];
|
|
96
367
|
|
|
97
|
-
declare function getFeedInfo(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
368
|
+
declare function getFeedInfo(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): FeedInfo[];
|
|
98
369
|
|
|
99
|
-
declare function getFrequencies(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
370
|
+
declare function getFrequencies(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Frequency[];
|
|
100
371
|
|
|
101
|
-
declare function getLevels(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
372
|
+
declare function getLevels(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Level[];
|
|
102
373
|
|
|
103
|
-
declare function getLocationGroups(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
374
|
+
declare function getLocationGroups(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): LocationGroup[];
|
|
104
375
|
|
|
105
|
-
declare function getLocationGroupStops(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
376
|
+
declare function getLocationGroupStops(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): LocationGroupStop[];
|
|
106
377
|
|
|
107
|
-
declare function getLocations(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
378
|
+
declare function getLocations(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Location[];
|
|
108
379
|
|
|
109
|
-
declare function getNetworks(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
380
|
+
declare function getNetworks(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Network[];
|
|
110
381
|
|
|
111
|
-
declare function getPathways(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
382
|
+
declare function getPathways(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Pathway[];
|
|
112
383
|
|
|
113
|
-
declare function getRouteNetworks(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
384
|
+
declare function getRouteNetworks(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): RouteNetwork[];
|
|
114
385
|
|
|
115
|
-
declare function getRoutes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
386
|
+
declare function getRoutes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Route[];
|
|
116
387
|
|
|
117
|
-
declare function getShapes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
388
|
+
declare function getShapes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Shape[];
|
|
118
389
|
declare function getShapesAsGeoJSON(query?: SqlWhere, options?: QueryOptions): FeatureCollection;
|
|
119
390
|
|
|
120
|
-
declare function getStopAreas(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
391
|
+
declare function getStopAreas(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): StopArea[];
|
|
121
392
|
|
|
122
|
-
declare function getStops(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
393
|
+
declare function getStops(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Stop[];
|
|
123
394
|
declare function getStopsAsGeoJSON(query?: SqlWhere, options?: QueryOptions): FeatureCollection;
|
|
124
395
|
|
|
125
|
-
declare function getStoptimes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
396
|
+
declare function getStoptimes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): StopTime[];
|
|
126
397
|
|
|
127
|
-
declare function getTimeframes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
398
|
+
declare function getTimeframes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Timeframe[];
|
|
128
399
|
|
|
129
|
-
declare function getTransfers(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
400
|
+
declare function getTransfers(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Transfer[];
|
|
130
401
|
|
|
131
|
-
declare function getTranslations(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
402
|
+
declare function getTranslations(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Translation[];
|
|
132
403
|
|
|
133
|
-
declare function getTrips(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions):
|
|
404
|
+
declare function getTrips(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): Trip[];
|
|
134
405
|
|
|
135
406
|
declare function getCalendarAttributes(query?: SqlWhere, fields?: SqlSelect, orderBy?: SqlOrderBy, options?: QueryOptions): SqlResults;
|
|
136
407
|
|
package/dist/index.js
CHANGED
|
@@ -634,11 +634,6 @@ var fareTransferRules = {
|
|
|
634
634
|
min: -1,
|
|
635
635
|
primary: true
|
|
636
636
|
},
|
|
637
|
-
{
|
|
638
|
-
name: "transfer_id",
|
|
639
|
-
type: "text",
|
|
640
|
-
prefix: true
|
|
641
|
-
},
|
|
642
637
|
{
|
|
643
638
|
name: "duration_limit",
|
|
644
639
|
type: "integer",
|
|
@@ -3192,6 +3187,7 @@ function generateFolderName(folderName) {
|
|
|
3192
3187
|
// src/lib/geojson-utils.ts
|
|
3193
3188
|
import {
|
|
3194
3189
|
cloneDeep,
|
|
3190
|
+
compact,
|
|
3195
3191
|
filter,
|
|
3196
3192
|
groupBy,
|
|
3197
3193
|
last,
|
|
@@ -3220,14 +3216,14 @@ function isValidLineString(lineString) {
|
|
|
3220
3216
|
}
|
|
3221
3217
|
return true;
|
|
3222
3218
|
}
|
|
3223
|
-
function consolidateShapes(
|
|
3219
|
+
function consolidateShapes(shapeGroups) {
|
|
3224
3220
|
const keys = /* @__PURE__ */ new Set();
|
|
3225
|
-
const segmentsArray =
|
|
3226
|
-
(
|
|
3221
|
+
const segmentsArray = shapeGroups.map(
|
|
3222
|
+
(shapes2) => shapes2.reduce(
|
|
3227
3223
|
(memo, point, idx) => {
|
|
3228
3224
|
if (idx > 0) {
|
|
3229
3225
|
memo.push([
|
|
3230
|
-
[
|
|
3226
|
+
[shapes2[idx - 1].shape_pt_lon, shapes2[idx - 1].shape_pt_lat],
|
|
3231
3227
|
[point.shape_pt_lon, point.shape_pt_lat]
|
|
3232
3228
|
]);
|
|
3233
3229
|
}
|
|
@@ -3296,14 +3292,19 @@ function shapesToGeoJSONFeature(shapes2, properties = {}) {
|
|
|
3296
3292
|
);
|
|
3297
3293
|
}
|
|
3298
3294
|
function stopsToGeoJSONFeatureCollection(stops2) {
|
|
3299
|
-
const features =
|
|
3300
|
-
(stop) =>
|
|
3301
|
-
{
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3295
|
+
const features = compact(
|
|
3296
|
+
stops2.map((stop) => {
|
|
3297
|
+
if (!stop.stop_lon || !stop.stop_lat) {
|
|
3298
|
+
return;
|
|
3299
|
+
}
|
|
3300
|
+
return feature(
|
|
3301
|
+
{
|
|
3302
|
+
type: "Point",
|
|
3303
|
+
coordinates: [stop.stop_lon, stop.stop_lat]
|
|
3304
|
+
},
|
|
3305
|
+
formatProperties(omit2(stop, ["stop_lat", "stop_lon"]))
|
|
3306
|
+
);
|
|
3307
|
+
})
|
|
3307
3308
|
);
|
|
3308
3309
|
return featureCollection(features);
|
|
3309
3310
|
}
|
|
@@ -3681,12 +3682,12 @@ var updateRealtimeData = async (task) => {
|
|
|
3681
3682
|
task.log(`Download successful`);
|
|
3682
3683
|
let totalLineCount = 0;
|
|
3683
3684
|
for (const entity of gtfsRealtimeData.entity) {
|
|
3684
|
-
const fieldValues =
|
|
3685
|
+
const fieldValues = vehiclePositions.schema.map(
|
|
3685
3686
|
(column) => prepareRealtimeValue(entity, column, task)
|
|
3686
3687
|
);
|
|
3687
3688
|
try {
|
|
3688
3689
|
db.prepare(
|
|
3689
|
-
`REPLACE INTO ${
|
|
3690
|
+
`REPLACE INTO ${vehiclePositions.filenameBase} (${vehiclePositions.schema.map((column) => column.name).join(", ")}) VALUES (${fieldValues.join(", ")})`
|
|
3690
3691
|
).run();
|
|
3691
3692
|
} catch (error) {
|
|
3692
3693
|
task.logWarning("Import error: " + error.message);
|
|
@@ -4107,7 +4108,7 @@ async function updateGtfsRealtime(initialConfig) {
|
|
|
4107
4108
|
// src/lib/export.ts
|
|
4108
4109
|
import path2 from "node:path";
|
|
4109
4110
|
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
4110
|
-
import { without, compact } from "lodash-es";
|
|
4111
|
+
import { without, compact as compact2 } from "lodash-es";
|
|
4111
4112
|
import pluralize2 from "pluralize";
|
|
4112
4113
|
import { stringify } from "csv-stringify";
|
|
4113
4114
|
import sqlString3 from "sqlstring-sqlite";
|
|
@@ -4214,7 +4215,7 @@ var exportGtfs = async (initialConfig) => {
|
|
|
4214
4215
|
return `${model.filenameBase}.${model.filenameExtension}`;
|
|
4215
4216
|
}
|
|
4216
4217
|
);
|
|
4217
|
-
if (
|
|
4218
|
+
if (compact2(exportedFiles).length === 0) {
|
|
4218
4219
|
log2("No GTFS data exported. Be sure to first import data into SQLite.");
|
|
4219
4220
|
return;
|
|
4220
4221
|
}
|
|
@@ -4544,7 +4545,7 @@ function getRoutes(query = {}, fields = [], orderBy2 = [], options = {}) {
|
|
|
4544
4545
|
}
|
|
4545
4546
|
|
|
4546
4547
|
// src/lib/gtfs/shapes.ts
|
|
4547
|
-
import { compact as
|
|
4548
|
+
import { compact as compact3, omit as omit4, pick as pick2 } from "lodash-es";
|
|
4548
4549
|
import { featureCollection as featureCollection2 } from "@turf/helpers";
|
|
4549
4550
|
|
|
4550
4551
|
// src/lib/gtfs-plus/route-attributes.ts
|
|
@@ -4594,7 +4595,7 @@ function getShapesAsGeoJSON(query = {}, options = {}) {
|
|
|
4594
4595
|
const agencies = getAgencies2({}, [], [], options);
|
|
4595
4596
|
const routeQuery = pick2(query, ["route_id"]);
|
|
4596
4597
|
const routes2 = getRoutes(routeQuery, [], [], options);
|
|
4597
|
-
const features =
|
|
4598
|
+
const features = compact3(
|
|
4598
4599
|
routes2.map((route) => {
|
|
4599
4600
|
const shapeQuery = {
|
|
4600
4601
|
route_id: route.route_id,
|
|
@@ -4721,14 +4722,14 @@ function getStopsAsGeoJSON(query = {}, options = {}) {
|
|
|
4721
4722
|
const routeSubquery = "SELECT DISTINCT route_id FROM trips WHERE trip_id IN (SELECT DISTINCT trip_id FROM stop_times WHERE stop_id = ?)";
|
|
4722
4723
|
const routes2 = db.prepare(`SELECT * FROM routes WHERE route_id IN (${routeSubquery})`).all(stop.stop_id);
|
|
4723
4724
|
const stopAttributes2 = getStopAttributes({ stop_id: stop.stop_id });
|
|
4724
|
-
stop.routes = orderBy(
|
|
4725
|
-
routes2,
|
|
4726
|
-
(route) => route?.route_short_name ? Number.parseInt(route.route_short_name, 10) : 0
|
|
4727
|
-
);
|
|
4728
|
-
stop.agency_name = agencies[0].agency_name;
|
|
4729
4725
|
return {
|
|
4730
4726
|
...stop,
|
|
4731
|
-
...stopAttributes2?.[0] || []
|
|
4727
|
+
...stopAttributes2?.[0] || [],
|
|
4728
|
+
routes: orderBy(
|
|
4729
|
+
routes2,
|
|
4730
|
+
(route) => route?.route_short_name ? Number.parseInt(route.route_short_name, 10) : 0
|
|
4731
|
+
),
|
|
4732
|
+
agency_name: agencies[0].agency_name
|
|
4732
4733
|
};
|
|
4733
4734
|
});
|
|
4734
4735
|
const filteredStops = preparedStops.filter((stop) => stop.routes.length > 0);
|