gtfs 4.14.5 → 4.15.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/dist/bin/gtfs-export.js +30 -10
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +351 -302
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +172 -145
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +413 -361
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/bin/gtfs-export.js
CHANGED
|
@@ -127,15 +127,14 @@ function formatError(error) {
|
|
|
127
127
|
return colors.red(errorMessage);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// src/lib/import.ts
|
|
130
|
+
// src/lib/import-gtfs.ts
|
|
131
131
|
import { parse } from "csv-parse";
|
|
132
|
-
import
|
|
132
|
+
import pluralize2 from "pluralize";
|
|
133
133
|
import stripBomStream from "strip-bom-stream";
|
|
134
134
|
import { temporaryDirectory } from "tempy";
|
|
135
|
+
import Timer from "timer-machine";
|
|
135
136
|
import untildify3 from "untildify";
|
|
136
|
-
import
|
|
137
|
-
import GtfsRealtimeBindings from "gtfs-realtime-bindings";
|
|
138
|
-
import sqlString2 from "sqlstring-sqlite";
|
|
137
|
+
import mapSeries2 from "promise-map-series";
|
|
139
138
|
|
|
140
139
|
// src/models/models.ts
|
|
141
140
|
var models_exports = {};
|
|
@@ -3262,6 +3261,12 @@ import {
|
|
|
3262
3261
|
} from "lodash-es";
|
|
3263
3262
|
import { feature, featureCollection } from "@turf/helpers";
|
|
3264
3263
|
|
|
3264
|
+
// src/lib/import-gtfs-realtime.ts
|
|
3265
|
+
import pluralize from "pluralize";
|
|
3266
|
+
import GtfsRealtimeBindings from "gtfs-realtime-bindings";
|
|
3267
|
+
import sqlString2 from "sqlstring-sqlite";
|
|
3268
|
+
import mapSeries from "promise-map-series";
|
|
3269
|
+
|
|
3265
3270
|
// src/lib/utils.ts
|
|
3266
3271
|
import sqlString from "sqlstring-sqlite";
|
|
3267
3272
|
import Long from "long";
|
|
@@ -3278,14 +3283,29 @@ function setDefaultConfig(initialConfig) {
|
|
|
3278
3283
|
};
|
|
3279
3284
|
}
|
|
3280
3285
|
|
|
3286
|
+
// src/lib/import-gtfs.ts
|
|
3287
|
+
var TIME_COLUMN_NAMES = [
|
|
3288
|
+
"start_time",
|
|
3289
|
+
"end_time",
|
|
3290
|
+
"arrival_time",
|
|
3291
|
+
"departure_time",
|
|
3292
|
+
"prior_notice_last_time",
|
|
3293
|
+
"prior_notice_start_time",
|
|
3294
|
+
"start_pickup_drop_off_window"
|
|
3295
|
+
];
|
|
3296
|
+
var TIME_COLUMN_PAIRS = TIME_COLUMN_NAMES.map((name) => [
|
|
3297
|
+
name,
|
|
3298
|
+
name.endsWith("time") ? `${name}stamp` : `${name}_timestamp`
|
|
3299
|
+
]);
|
|
3300
|
+
|
|
3281
3301
|
// src/lib/export.ts
|
|
3282
3302
|
import path2 from "node:path";
|
|
3283
3303
|
import { writeFile } from "node:fs/promises";
|
|
3284
3304
|
import { without, compact as compact2 } from "lodash-es";
|
|
3285
|
-
import
|
|
3305
|
+
import pluralize3 from "pluralize";
|
|
3286
3306
|
import { stringify } from "csv-stringify";
|
|
3287
3307
|
import sqlString3 from "sqlstring-sqlite";
|
|
3288
|
-
import
|
|
3308
|
+
import mapSeries3 from "promise-map-series";
|
|
3289
3309
|
import untildify4 from "untildify";
|
|
3290
3310
|
var getAgencies = (db, config) => {
|
|
3291
3311
|
try {
|
|
@@ -3318,7 +3338,7 @@ var exportGtfs = async (initialConfig) => {
|
|
|
3318
3338
|
);
|
|
3319
3339
|
}
|
|
3320
3340
|
log2(
|
|
3321
|
-
`Starting GTFS export for ${
|
|
3341
|
+
`Starting GTFS export for ${pluralize3(
|
|
3322
3342
|
"agency",
|
|
3323
3343
|
agencyCount,
|
|
3324
3344
|
true
|
|
@@ -3331,7 +3351,7 @@ var exportGtfs = async (initialConfig) => {
|
|
|
3331
3351
|
const modelsToExport = Object.values(models_exports).filter(
|
|
3332
3352
|
(model) => model.extension !== "gtfs-realtime"
|
|
3333
3353
|
);
|
|
3334
|
-
const exportedFiles = await
|
|
3354
|
+
const exportedFiles = await mapSeries3(
|
|
3335
3355
|
modelsToExport,
|
|
3336
3356
|
async (model) => {
|
|
3337
3357
|
const filePath = path2.join(
|
|
@@ -3393,7 +3413,7 @@ var exportGtfs = async (initialConfig) => {
|
|
|
3393
3413
|
return;
|
|
3394
3414
|
}
|
|
3395
3415
|
log2(`Completed GTFS export to ${exportPath}`);
|
|
3396
|
-
log2(`Completed GTFS export for ${
|
|
3416
|
+
log2(`Completed GTFS export for ${pluralize3("agency", agencyCount, true)}
|
|
3397
3417
|
`);
|
|
3398
3418
|
};
|
|
3399
3419
|
|