gtfs 4.17.7 → 4.18.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.
- package/README.md +9 -9
- package/dist/bin/gtfs-export.js +11 -4
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +413 -343
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +240 -183
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +145 -7
- package/dist/index.js +459 -377
- package/dist/index.js.map +1 -1
- package/package.json +16 -11
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 {
|
|
@@ -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":
|
|
374
|
+
"downloadTimeout": 30000
|
|
375
375
|
}
|
|
376
376
|
```
|
|
377
377
|
|
|
@@ -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);
|
|
@@ -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);
|
|
@@ -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(
|
package/dist/bin/gtfs-export.js
CHANGED
|
@@ -4141,7 +4141,8 @@ function setDefaultConfig(initialConfig) {
|
|
|
4141
4141
|
ignoreDuplicates: false,
|
|
4142
4142
|
ignoreErrors: false,
|
|
4143
4143
|
gtfsRealtimeExpirationSeconds: 0,
|
|
4144
|
-
verbose: true
|
|
4144
|
+
verbose: true,
|
|
4145
|
+
downloadTimeout: 3e4
|
|
4145
4146
|
};
|
|
4146
4147
|
return {
|
|
4147
4148
|
...defaults,
|
|
@@ -4171,7 +4172,7 @@ import mapSeries3 from "promise-map-series";
|
|
|
4171
4172
|
var getAgencies = (db, config) => {
|
|
4172
4173
|
try {
|
|
4173
4174
|
return db.prepare("SELECT agency_name FROM agency;").all();
|
|
4174
|
-
} catch
|
|
4175
|
+
} catch {
|
|
4175
4176
|
if (config.sqlitePath === ":memory:") {
|
|
4176
4177
|
throw new Error(
|
|
4177
4178
|
'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 +4239,17 @@ var exportGtfs = async (initialConfig) => {
|
|
|
4238
4239
|
}
|
|
4239
4240
|
} else if (model.filenameBase === "fare_attributes") {
|
|
4240
4241
|
for (const line of lines) {
|
|
4241
|
-
line.price = formatCurrency(
|
|
4242
|
+
line.price = formatCurrency(
|
|
4243
|
+
line.price,
|
|
4244
|
+
line.currency_type
|
|
4245
|
+
);
|
|
4242
4246
|
}
|
|
4243
4247
|
} else if (model.filenameBase === "fare_products") {
|
|
4244
4248
|
for (const line of lines) {
|
|
4245
|
-
line.amount = formatCurrency(
|
|
4249
|
+
line.amount = formatCurrency(
|
|
4250
|
+
line.amount,
|
|
4251
|
+
line.currency
|
|
4252
|
+
);
|
|
4246
4253
|
}
|
|
4247
4254
|
}
|
|
4248
4255
|
const columns = without(
|