gtfs 4.15.7 → 4.15.8
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 +21 -9
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +7 -12
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +2 -2
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/models/models.d.ts +7 -15
- package/dist/models/models.js +4 -8
- package/dist/models/models.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/gtfs-export.js
CHANGED
|
@@ -2510,7 +2510,7 @@ var tripUpdates = {
|
|
|
2510
2510
|
extension: "gtfs-realtime",
|
|
2511
2511
|
schema: [
|
|
2512
2512
|
{
|
|
2513
|
-
name: "
|
|
2513
|
+
name: "id",
|
|
2514
2514
|
type: "text",
|
|
2515
2515
|
required: true,
|
|
2516
2516
|
primary: true,
|
|
@@ -2674,7 +2674,7 @@ var vehiclePositions = {
|
|
|
2674
2674
|
extension: "gtfs-realtime",
|
|
2675
2675
|
schema: [
|
|
2676
2676
|
{
|
|
2677
|
-
name: "
|
|
2677
|
+
name: "id",
|
|
2678
2678
|
type: "text",
|
|
2679
2679
|
required: true,
|
|
2680
2680
|
primary: true,
|
|
@@ -2913,17 +2913,12 @@ var deadheadTimes = {
|
|
|
2913
2913
|
nonstandard: true,
|
|
2914
2914
|
extension: "ods",
|
|
2915
2915
|
schema: [
|
|
2916
|
-
{
|
|
2917
|
-
name: "id",
|
|
2918
|
-
type: "integer",
|
|
2919
|
-
primary: true,
|
|
2920
|
-
prefix: true
|
|
2921
|
-
},
|
|
2922
2916
|
{
|
|
2923
2917
|
name: "deadhead_id",
|
|
2924
2918
|
type: "text",
|
|
2925
2919
|
required: true,
|
|
2926
2920
|
index: true,
|
|
2921
|
+
primary: true,
|
|
2927
2922
|
prefix: true
|
|
2928
2923
|
},
|
|
2929
2924
|
{
|
|
@@ -2960,6 +2955,7 @@ var deadheadTimes = {
|
|
|
2960
2955
|
name: "location_sequence",
|
|
2961
2956
|
type: "integer",
|
|
2962
2957
|
required: true,
|
|
2958
|
+
primary: true,
|
|
2963
2959
|
min: 0,
|
|
2964
2960
|
index: true
|
|
2965
2961
|
},
|
|
@@ -3279,6 +3275,15 @@ function setDefaultConfig(initialConfig) {
|
|
|
3279
3275
|
...initialConfig
|
|
3280
3276
|
};
|
|
3281
3277
|
}
|
|
3278
|
+
function formatCurrency(value, currency) {
|
|
3279
|
+
const parts = new Intl.NumberFormat(void 0, {
|
|
3280
|
+
style: "currency",
|
|
3281
|
+
currency
|
|
3282
|
+
}).formatToParts(value);
|
|
3283
|
+
const integerPart = parts.find((part) => part.type === "integer")?.value ?? "0";
|
|
3284
|
+
const fractionPart = parts.find((part) => part.type === "fraction")?.value ?? "";
|
|
3285
|
+
return `${integerPart}${fractionPart !== "" ? `.${fractionPart}` : ""}`;
|
|
3286
|
+
}
|
|
3282
3287
|
|
|
3283
3288
|
// src/lib/import-gtfs.ts
|
|
3284
3289
|
var TIME_COLUMN_NAMES = [
|
|
@@ -3365,7 +3370,6 @@ var exportGtfs = async (initialConfig) => {
|
|
|
3365
3370
|
}
|
|
3366
3371
|
if (model.filenameExtension === "txt") {
|
|
3367
3372
|
const excludeColumns = [
|
|
3368
|
-
"id",
|
|
3369
3373
|
"arrival_timestamp",
|
|
3370
3374
|
"departure_timestamp",
|
|
3371
3375
|
"start_timestamp",
|
|
@@ -3384,6 +3388,14 @@ var exportGtfs = async (initialConfig) => {
|
|
|
3384
3388
|
if (!routesWithAgencyId || routesWithAgencyId.length === 0) {
|
|
3385
3389
|
excludeColumns.push("agency_id");
|
|
3386
3390
|
}
|
|
3391
|
+
} else if (model.filenameBase === "fare_attributes") {
|
|
3392
|
+
for (const line of lines) {
|
|
3393
|
+
line.price = formatCurrency(line.price, line.currency_type);
|
|
3394
|
+
}
|
|
3395
|
+
} else if (model.filenameBase === "fare_products") {
|
|
3396
|
+
for (const line of lines) {
|
|
3397
|
+
line.price = formatCurrency(line.amount, line.currency);
|
|
3398
|
+
}
|
|
3387
3399
|
}
|
|
3388
3400
|
const columns = without(
|
|
3389
3401
|
model.schema.map((column) => column.name),
|