gtfs 4.15.11 → 4.15.13
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 +11 -6
- package/dist/bin/gtfs-export.js.map +1 -1
- package/dist/bin/gtfs-import.js +23 -11
- package/dist/bin/gtfs-import.js.map +1 -1
- package/dist/bin/gtfsrealtime-update.js +16 -9
- package/dist/bin/gtfsrealtime-update.js.map +1 -1
- package/dist/index.d.ts +33 -31
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/dist/models/models.js +11 -6
- package/dist/models/models.js.map +1 -1
- package/package.json +11 -11
package/dist/bin/gtfs-import.js
CHANGED
|
@@ -2761,6 +2761,11 @@ var serviceAlerts = {
|
|
|
2761
2761
|
index: true,
|
|
2762
2762
|
source: "id"
|
|
2763
2763
|
},
|
|
2764
|
+
{
|
|
2765
|
+
name: "active_period",
|
|
2766
|
+
type: "json",
|
|
2767
|
+
source: "alert.activePeriod"
|
|
2768
|
+
},
|
|
2764
2769
|
{
|
|
2765
2770
|
name: "cause",
|
|
2766
2771
|
type: "text",
|
|
@@ -2774,7 +2779,7 @@ var serviceAlerts = {
|
|
|
2774
2779
|
{
|
|
2775
2780
|
name: "url",
|
|
2776
2781
|
type: "text",
|
|
2777
|
-
source: "alert.url",
|
|
2782
|
+
source: "alert.url.translation[0].text",
|
|
2778
2783
|
default: ""
|
|
2779
2784
|
},
|
|
2780
2785
|
{
|
|
@@ -2792,31 +2797,31 @@ var serviceAlerts = {
|
|
|
2792
2797
|
default: ""
|
|
2793
2798
|
},
|
|
2794
2799
|
{
|
|
2795
|
-
name: "
|
|
2800
|
+
name: "header_text",
|
|
2796
2801
|
type: "text",
|
|
2797
2802
|
required: true,
|
|
2798
2803
|
source: "alert.headerText.translation[0].text",
|
|
2799
2804
|
default: ""
|
|
2800
2805
|
},
|
|
2801
2806
|
{
|
|
2802
|
-
name: "
|
|
2807
|
+
name: "description_text",
|
|
2803
2808
|
type: "text",
|
|
2804
2809
|
required: true,
|
|
2805
2810
|
source: "alert.descriptionText.translation[0].text",
|
|
2806
2811
|
default: ""
|
|
2807
2812
|
},
|
|
2808
2813
|
{
|
|
2809
|
-
name: "
|
|
2814
|
+
name: "tts_header_text",
|
|
2810
2815
|
type: "text",
|
|
2811
2816
|
source: "alert.ttsHeaderText.translation[0].text"
|
|
2812
2817
|
},
|
|
2813
2818
|
{
|
|
2814
|
-
name: "
|
|
2819
|
+
name: "tts_description_text",
|
|
2815
2820
|
type: "text",
|
|
2816
2821
|
source: "alert.ttsDescriptionText.translation[0].text"
|
|
2817
2822
|
},
|
|
2818
2823
|
{
|
|
2819
|
-
name: "
|
|
2824
|
+
name: "severity_level",
|
|
2820
2825
|
type: "text",
|
|
2821
2826
|
source: "alert.severityLevel"
|
|
2822
2827
|
},
|
|
@@ -3276,9 +3281,11 @@ function convertLongTimeToDate(longDate) {
|
|
|
3276
3281
|
).toISOString();
|
|
3277
3282
|
}
|
|
3278
3283
|
function calculateSecondsFromMidnight(time) {
|
|
3279
|
-
if (!time || typeof time !== "string")
|
|
3284
|
+
if (!time || typeof time !== "string") {
|
|
3285
|
+
return null;
|
|
3286
|
+
}
|
|
3280
3287
|
const [hours, minutes, seconds] = time.split(":").map(Number);
|
|
3281
|
-
if ([hours, minutes, seconds].some(isNaN) ||
|
|
3288
|
+
if ([hours, minutes, seconds].some(isNaN) || minutes >= 60 || seconds >= 60) {
|
|
3282
3289
|
return null;
|
|
3283
3290
|
}
|
|
3284
3291
|
return hours * 3600 + minutes * 60 + seconds;
|
|
@@ -3363,9 +3370,11 @@ function prepareRealtimeFieldValue(entity, column, task) {
|
|
|
3363
3370
|
if (column.name === "expiration_timestamp") {
|
|
3364
3371
|
return task.currentTimestamp + task.gtfsRealtimeExpirationSeconds;
|
|
3365
3372
|
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3373
|
+
const value = getNestedProperty(entity, column.default, column.source);
|
|
3374
|
+
if (column.type === "json") {
|
|
3375
|
+
return sqlString2.escape(JSON.stringify(value));
|
|
3376
|
+
}
|
|
3377
|
+
return sqlString2.escape(value);
|
|
3369
3378
|
}
|
|
3370
3379
|
async function processRealtimeAlerts(db, gtfsRealtimeData, task) {
|
|
3371
3380
|
task.log(`Download successful`);
|
|
@@ -3703,6 +3712,9 @@ var formatGtfsLine = (line, model, totalLineCount) => {
|
|
|
3703
3712
|
value = timeAsString;
|
|
3704
3713
|
formattedLine[getTimestampColumnName(name)] = timeAsSecondsFromMidnight ?? null;
|
|
3705
3714
|
}
|
|
3715
|
+
if (type === "json") {
|
|
3716
|
+
value = JSON.stringify(value);
|
|
3717
|
+
}
|
|
3706
3718
|
formattedLine[name] = value;
|
|
3707
3719
|
}
|
|
3708
3720
|
return formattedLine;
|