gtfs 4.13.4 → 4.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -178,8 +178,9 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
178
178
  | `headers` | object | An object of HTTP headers in key:value format to use when fetching GTFS from the `url` specified. Optional. |
179
179
  | `prefix` | string | A prefix to be added to every ID field maintain uniqueness when importing multiple GTFS from multiple agencies. Optional. |
180
180
  | `exclude` | array | An array of GTFS file names (without `.txt`) to exclude when importing. Optional. |
181
- | `realtimeUrls` | array | An array of GTFS-Realtime urls to import. Optional. |
182
- | `realtimeHeaders` | array | An object of HTTP headers in key:value format to use when fetching GTFS-Realtime data from the `realtimeUrls` specified. Optional. |
181
+ | `realtimeAlerts` | object | An object containing a `url` field for GTFS-Realtime alerts and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
182
+ | `realtimeTripUpdates` | object | An object containing a `url` field for GTFS-Realtime trip updates and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
183
+ | `realtimeVehiclePositions` | object | An object containing a `url` field for GTFS-Realtime vehicle positions and a `headers` field in key:value format to use when fetching GTFS-Realtime data. Optional. |
183
184
 
184
185
  - Specify a `url` to download GTFS:
185
186
 
@@ -187,7 +188,7 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
187
188
  {
188
189
  "agencies": [
189
190
  {
190
- "url": "http://countyconnection.com/GTFS/google_transit.zip"
191
+ "url": "https://opendata.somewhere.com/gtfs.zip"
191
192
  }
192
193
  ]
193
194
  }
@@ -199,7 +200,7 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
199
200
  {
200
201
  "agencies": [
201
202
  {
202
- "url": "http://countyconnection.com/GTFS/google_transit.zip",
203
+ "url": "https://opendata.somewhere.com/gtfs.zip",
203
204
  "headers": {
204
205
  "Content-Type": "application/json",
205
206
  "Authorization": "bearer 1234567890"
@@ -246,19 +247,30 @@ To find an agency's GTFS file, visit [transitfeeds.com](http://transitfeeds.com)
246
247
  }
247
248
  ```
248
249
 
249
- - Specify urls for GTFS-Realtime updates. `realtimeUrls` allows an array of GTFS-Realtime URLs. For example, a URL for trip updates, a URL for vehicle updates and a URL for service alerts. In addition, a `realtimeHeaders` parameter allows adding additional HTTP headers to the request.
250
+ - Specify urls for GTFS-Realtime updates. `realtimeAlerts`, `realtimeTripUpdates` and `realtimeVehiclePositions` fields accept an object with a `url` and optional `headers` field to specify HTTP headers to include with the request, usually for authorization purposes.
250
251
 
251
252
  ```json
252
253
  {
253
254
  "agencies": [
254
255
  {
255
- "url": "http://countyconnection.com/GTFS/google_transit.zip",
256
- "realtimeUrls": [
257
- "https://opendata.somewhere.com/gtfs-rt/VehicleUpdates.pb",
258
- "https://opendata.somewhere.com/gtfs-rt/TripUpdates.pb"
259
- ],
260
- "realtimeHeaders": {
261
- "Authorization": "bearer 1234567890"
256
+ "url": "https://opendata.somewhere.com/gtfs.zip",
257
+ "realtimeAlerts": {
258
+ "url": "https://opendata.somewhere.com/gtfs-rt/alerts",
259
+ "headers": {
260
+ "Authorization": "bearer 123456789"
261
+ }
262
+ },
263
+ "realtimeTripUpdates": {
264
+ "url": "https://opendata.somewhere.com/gtfs-rt/tripupdates",
265
+ "headers": {
266
+ "Authorization": "bearer 123456789"
267
+ }
268
+ },
269
+ "realtimeVehiclePositions": {
270
+ "url": "https://opendata.somewhere.com/gtfs-rt/vehiclepositions",
271
+ "headers": {
272
+ "Authorization": "bearer 123456789"
273
+ }
262
274
  }
263
275
  }
264
276
  ]
@@ -389,11 +401,15 @@ importGtfs({
389
401
  "agencies": [
390
402
  {
391
403
  "url": "https://agency.com/gtfs.zip",
392
- "realtimeUrls": [
393
- "https://agency.com/gtfs-rt/alerts",
394
- "https://agency.com/gtfs-rt/tripupdates",
395
- "https://agency.com/gtfs-rt/vehiclepositions"
396
- ]
404
+ "realtimeAlerts": {
405
+ "url": "https://opendata.somewhere.com/gtfs-rt/alerts"
406
+ },
407
+ "realtimeTripUpdates": {
408
+ "url": "https://opendata.somewhere.com/gtfs-rt/tripupdates"
409
+ },
410
+ "realtimeVehiclePositions": {
411
+ "url": "https://opendata.somewhere.com/gtfs-rt/vehiclepositions"
412
+ }
397
413
  }
398
414
  ],
399
415
  "gtfsRealtimeExpirationSeconds": false
@@ -462,7 +478,7 @@ import { importGtfs } from 'gtfs';
462
478
  const config = {
463
479
  agencies: [
464
480
  {
465
- url: 'http://countyconnection.com/GTFS/google_transit.zip',
481
+ url: 'https://opendata.somewhere.com/gtfs.zip',
466
482
  exclude: ['shapes'],
467
483
  },
468
484
  ],
@@ -512,7 +528,7 @@ const config = {
512
528
  sqlitePath: '/dev/sqlite/gtfs',
513
529
  agencies: [
514
530
  {
515
- url: 'http://countyconnection.com/GTFS/google_transit.zip',
531
+ url: 'https://opendata.somewhere.com/gtfs.zip',
516
532
  exclude: ['shapes'],
517
533
  },
518
534
  ],
@@ -592,7 +608,7 @@ const config = {
592
608
  sqlitePath: '/dev/sqlite/gtfs',
593
609
  agencies: [
594
610
  {
595
- url: 'http://countyconnection.com/GTFS/google_transit.zip',
611
+ url: 'https://opendata.somewhere.com/gtfs.zip',
596
612
  exclude: ['shapes'],
597
613
  },
598
614
  ],
@@ -754,11 +754,6 @@ var fareTransferRules = {
754
754
  min: -1,
755
755
  primary: true
756
756
  },
757
- {
758
- name: "transfer_id",
759
- type: "text",
760
- prefix: true
761
- },
762
757
  {
763
758
  name: "duration_limit",
764
759
  type: "integer",
@@ -3257,6 +3252,7 @@ function openDb(config = null) {
3257
3252
  // src/lib/geojson-utils.ts
3258
3253
  import {
3259
3254
  cloneDeep,
3255
+ compact,
3260
3256
  filter,
3261
3257
  groupBy,
3262
3258
  last,
@@ -3284,7 +3280,7 @@ function setDefaultConfig(initialConfig) {
3284
3280
  // src/lib/export.ts
3285
3281
  import path2 from "node:path";
3286
3282
  import { writeFile } from "node:fs/promises";
3287
- import { without, compact } from "lodash-es";
3283
+ import { without, compact as compact2 } from "lodash-es";
3288
3284
  import pluralize2 from "pluralize";
3289
3285
  import { stringify } from "csv-stringify";
3290
3286
  import sqlString3 from "sqlstring-sqlite";
@@ -3391,7 +3387,7 @@ var exportGtfs = async (initialConfig) => {
3391
3387
  return `${model.filenameBase}.${model.filenameExtension}`;
3392
3388
  }
3393
3389
  );
3394
- if (compact(exportedFiles).length === 0) {
3390
+ if (compact2(exportedFiles).length === 0) {
3395
3391
  log2("No GTFS data exported. Be sure to first import data into SQLite.");
3396
3392
  return;
3397
3393
  }
@@ -3407,7 +3403,7 @@ import sqlString4 from "sqlstring-sqlite";
3407
3403
  import { omit as omit3, pick } from "lodash-es";
3408
3404
 
3409
3405
  // src/lib/gtfs/shapes.ts
3410
- import { compact as compact2, omit as omit4, pick as pick2 } from "lodash-es";
3406
+ import { compact as compact3, omit as omit4, pick as pick2 } from "lodash-es";
3411
3407
  import { featureCollection as featureCollection2 } from "@turf/helpers";
3412
3408
 
3413
3409
  // src/lib/gtfs/stops.ts