gtfs 4.17.7 → 4.18.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
@@ -69,7 +69,7 @@ import { readFile } from 'fs/promises';
69
69
  import path from 'node:path';
70
70
 
71
71
  const config = JSON.parse(
72
- await readFile(path.join(import.meta.dirname, 'config.json'))
72
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
73
73
  );
74
74
 
75
75
  try {
@@ -158,7 +158,7 @@ Copy `config-sample.json` to `config.json` and then add your projects configurat
158
158
  | [`gtfsRealtimeExpirationSeconds`](#gtfsrealtimeexpirationseconds) | integer | Amount of time in seconds to allow GTFS-Realtime data to be stored in database before allowing to be deleted. Optional, defaults to 0. |
159
159
  | [`ignoreDuplicates`](#ignoreduplicates) | boolean | Whether or not to ignore unique constraints on ids when importing GTFS, such as `trip_id`, `calendar_id`. Optional, defaults to false. |
160
160
  | [`ignoreErrors`](#ignoreerrors) | boolean | Whether or not to ignore errors during the import process. If true, failed files will be skipped while the rest are processed. Optional, defaults to false. |
161
- | [`sqlitePath`](#sqlitepath) | string | A path to an SQLite database. Optional, defaults to using an in-memory database. |
161
+ | [`sqlitePath`](#sqlitepath) | string | A path to a SQLite database. Optional, defaults to using an in-memory database. |
162
162
  | [`verbose`](#verbose) | boolean | Whether or not to print output to the console. Optional, defaults to true. |
163
163
 
164
164
  ### agencies
@@ -362,7 +362,7 @@ importGtfs({
362
362
 
363
363
  ### downloadTimeout
364
364
 
365
- {Integer} A number of milliseconds to wait when downloading GTFS before throwing an error. Optional.
365
+ {Integer} A number of milliseconds to wait when downloading GTFS before throwing an error. Optional, defaults to `30000` (30 seconds).
366
366
 
367
367
  ```json
368
368
  {
@@ -371,7 +371,7 @@ importGtfs({
371
371
  "path": "/path/to/the/unzipped/gtfs/"
372
372
  }
373
373
  ],
374
- "downloadTimeout": 5000
374
+ "downloadTimeout": 30000
375
375
  }
376
376
  ```
377
377
 
@@ -467,10 +467,10 @@ importGtfs({
467
467
 
468
468
  ### sqlitePath
469
469
 
470
- {String} A path to an SQLite database. Optional, defaults to using an in-memory database with a value of `:memory:`.
470
+ {String} A path to a SQLite database. Optional, defaults to using an in-memory database with a value of `:memory:`.
471
471
 
472
472
  ```json
473
- "sqlitePath": "/dev/sqlite/gtfs"
473
+ "sqlitePath": "/tmp/gtfs.sqlite"
474
474
  ```
475
475
 
476
476
  ### verbose
@@ -531,7 +531,7 @@ import { readFile } from 'fs/promises';
531
531
  import path from 'node:path';
532
532
 
533
533
  const config = JSON.parse(
534
- await readFile(path.join(import.meta.dirname, 'config.json'))
534
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
535
535
  );
536
536
 
537
537
  await importGtfs(config);
@@ -543,7 +543,7 @@ Configuration can be a JSON object in your code
543
543
  import { importGtfs } from 'gtfs';
544
544
 
545
545
  const config = {
546
- sqlitePath: '/dev/sqlite/gtfs',
546
+ sqlitePath: '/tmp/gtfs.sqlite',
547
547
  agencies: [
548
548
  {
549
549
  url: 'https://www.bart.gov/dev/schedules/google_transit.zip',
@@ -577,7 +577,7 @@ import { readFile } from 'fs/promises';
577
577
  import path from 'node:path';
578
578
 
579
579
  const config = JSON.parse(
580
- await readFile(path.join(import.meta.dirname, 'config.json'))
580
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
581
581
  );
582
582
 
583
583
  await updateGtfsRealtime(config);
@@ -623,7 +623,7 @@ Use `exportGtfs()` in your code to run an export of a GTFS file specified in a c
623
623
  import { exportGtfs } from 'gtfs';
624
624
 
625
625
  const config = {
626
- sqlitePath: '/dev/sqlite/gtfs',
626
+ sqlitePath: '/tmp/gtfs.sqlite',
627
627
  agencies: [
628
628
  {
629
629
  url: 'https://www.bart.gov/dev/schedules/google_transit.zip',
@@ -660,7 +660,7 @@ import { readFile } from 'fs/promises';
660
660
  import path from 'node:path';
661
661
 
662
662
  const config = JSON.parse(
663
- await readFile(path.join(import.meta.dirname, 'config.json'))
663
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
664
664
  );
665
665
 
666
666
  const db = openDb(config);
@@ -702,7 +702,7 @@ import { readFile } from 'fs/promises';
702
702
  import path from 'node:path';
703
703
 
704
704
  const config = JSON.parse(
705
- await readFile(path.join(import.meta.dirname, 'config.json'))
705
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
706
706
  );
707
707
 
708
708
  const db = openDb(config);
@@ -724,7 +724,7 @@ import { readFile } from 'fs/promises';
724
724
  import path from 'node:path';
725
725
 
726
726
  const config = JSON.parse(
727
- await readFile(path.join(import.meta.dirname, 'config.json'))
727
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
728
728
  );
729
729
 
730
730
  const db = openDb(config);
@@ -746,7 +746,7 @@ import { readFile } from 'fs/promises';
746
746
  import path from 'node:path';
747
747
 
748
748
  const config = JSON.parse(
749
- await readFile(path.join(import.meta.dirname, 'config.json'))
749
+ await readFile(path.join(import.meta.dirname, 'config.json'), 'utf8')
750
750
  );
751
751
  const db = openDb(config);
752
752
  const stops = getStops(
@@ -237,6 +237,12 @@ var agency = {
237
237
  name: "agency_email",
238
238
  type: "text",
239
239
  nocase: true
240
+ },
241
+ {
242
+ name: "cemv_support",
243
+ type: "integer",
244
+ min: 0,
245
+ max: 2
240
246
  }
241
247
  ]
242
248
  };
@@ -1167,6 +1173,12 @@ var routes = {
1167
1173
  name: "network_id",
1168
1174
  type: "text",
1169
1175
  prefix: true
1176
+ },
1177
+ {
1178
+ name: "cemv_support",
1179
+ type: "integer",
1180
+ min: 0,
1181
+ max: 2
1170
1182
  }
1171
1183
  ]
1172
1184
  };
@@ -1421,6 +1433,12 @@ var stops = {
1421
1433
  {
1422
1434
  name: "platform_code",
1423
1435
  type: "text"
1436
+ },
1437
+ {
1438
+ name: "stop_access",
1439
+ type: "integer",
1440
+ min: 0,
1441
+ max: 1
1424
1442
  }
1425
1443
  ]
1426
1444
  };
@@ -4141,7 +4159,8 @@ function setDefaultConfig(initialConfig) {
4141
4159
  ignoreDuplicates: false,
4142
4160
  ignoreErrors: false,
4143
4161
  gtfsRealtimeExpirationSeconds: 0,
4144
- verbose: true
4162
+ verbose: true,
4163
+ downloadTimeout: 3e4
4145
4164
  };
4146
4165
  return {
4147
4166
  ...defaults,
@@ -4171,7 +4190,7 @@ import mapSeries3 from "promise-map-series";
4171
4190
  var getAgencies = (db, config) => {
4172
4191
  try {
4173
4192
  return db.prepare("SELECT agency_name FROM agency;").all();
4174
- } catch (error) {
4193
+ } catch {
4175
4194
  if (config.sqlitePath === ":memory:") {
4176
4195
  throw new Error(
4177
4196
  'No agencies found in SQLite. You are using an in-memory database - if running this from command line be sure to specify a value for `sqlitePath` in config.json other than ":memory:".'
@@ -4238,11 +4257,17 @@ var exportGtfs = async (initialConfig) => {
4238
4257
  }
4239
4258
  } else if (model.filenameBase === "fare_attributes") {
4240
4259
  for (const line of lines) {
4241
- line.price = formatCurrency(line.price, line.currency_type);
4260
+ line.price = formatCurrency(
4261
+ line.price,
4262
+ line.currency_type
4263
+ );
4242
4264
  }
4243
4265
  } else if (model.filenameBase === "fare_products") {
4244
4266
  for (const line of lines) {
4245
- line.amount = formatCurrency(line.amount, line.currency);
4267
+ line.amount = formatCurrency(
4268
+ line.amount,
4269
+ line.currency
4270
+ );
4246
4271
  }
4247
4272
  }
4248
4273
  const columns = without(