corequery-gtfs 2.0.1 → 3.0.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 +67 -2
- package/dist/config/apply-service-tag-succession.d.ts +1 -0
- package/dist/config/apply-service-tag-succession.js +2 -0
- package/dist/config/apply-service-tag-succession.js.map +1 -0
- package/dist/config/debug-contextualization-helpers.d.ts +4 -0
- package/dist/config/debug-contextualization-helpers.js +2 -0
- package/dist/config/debug-contextualization-helpers.js.map +1 -0
- package/dist/config/gtfs-config.d.ts +4 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/conversion/service-converter.js +14 -5
- package/dist/conversion/service-converter.js.map +1 -1
- package/dist/corequery-types.d.ts +58 -0
- package/dist/data/gtfs-realtime-transfer.d.ts +3 -1
- package/dist/data/gtfs-realtime-transfer.js +3 -1
- package/dist/data/gtfs-realtime-transfer.js.map +1 -1
- package/dist/data/route/line-routes-mapping.d.ts +3 -1
- package/dist/data/route/line-routes-mapping.js +5 -2
- package/dist/data/route/line-routes-mapping.js.map +1 -1
- package/dist/data/route/route.d.ts +2 -1
- package/dist/data/route/route.js +2 -2
- package/dist/data/route/route.js.map +1 -1
- package/dist/data/trip/added/gtfs-added-trip.d.ts +3 -0
- package/dist/data/trip/added/gtfs-added-trip.js +2 -0
- package/dist/data/trip/added/gtfs-added-trip.js.map +1 -1
- package/dist/data/trip/replaced/gtfs-replaced-trip.d.ts +5 -0
- package/dist/data/trip/replaced/gtfs-replaced-trip.js +14 -0
- package/dist/data/trip/replaced/gtfs-replaced-trip.js.map +1 -1
- package/dist/data/trip/scheduled/gtfs-scheduled-trip.d.ts +12 -0
- package/dist/data/trip/scheduled/gtfs-scheduled-trip.js +49 -0
- package/dist/data/trip/scheduled/gtfs-scheduled-trip.js.map +1 -1
- package/dist/data/trip/updated/gtfs-updated-trip.d.ts +4 -0
- package/dist/data/trip/updated/gtfs-updated-trip.js +5 -0
- package/dist/data/trip/updated/gtfs-updated-trip.js.map +1 -1
- package/dist/debug-pages/debug-contextualization-helpers.d.ts +18 -0
- package/dist/debug-pages/debug-contextualization-helpers.js +37 -0
- package/dist/debug-pages/debug-contextualization-helpers.js.map +1 -0
- package/dist/debug-pages/debug-page-system.d.ts +14 -0
- package/dist/debug-pages/debug-page-system.js +48 -0
- package/dist/debug-pages/debug-page-system.js.map +1 -0
- package/dist/debug-pages/pages/debug-home-page.d.ts +11 -0
- package/dist/debug-pages/pages/debug-home-page.js +110 -0
- package/dist/debug-pages/pages/debug-home-page.js.map +1 -0
- package/dist/debug-pages/pages/debug-service-page.d.ts +25 -0
- package/dist/debug-pages/pages/debug-service-page.js +277 -0
- package/dist/debug-pages/pages/debug-service-page.js.map +1 -0
- package/dist/gtfs-service-source.d.ts +5 -1
- package/dist/gtfs-service-source.js +9 -0
- package/dist/gtfs-service-source.js.map +1 -1
- package/dist/gtfs-system.d.ts +8 -2
- package/dist/gtfs-system.js +31 -2
- package/dist/gtfs-system.js.map +1 -1
- package/dist/parser/error-types.d.ts +45 -0
- package/dist/parser/error-types.js +51 -7
- package/dist/parser/error-types.js.map +1 -1
- package/dist/parser/realtime/gtfs-realtime-data-parser.d.ts +1 -0
- package/dist/parser/realtime/gtfs-realtime-data-parser.js +39 -8
- package/dist/parser/realtime/gtfs-realtime-data-parser.js.map +1 -1
- package/dist/parser/realtime/gtfs-trip-update-parser.d.ts +1 -0
- package/dist/parser/realtime/gtfs-trip-update-parser.js +6 -0
- package/dist/parser/realtime/gtfs-trip-update-parser.js.map +1 -1
- package/dist/parser/realtime/gtfs-updated-trip-update-parser.d.ts +1 -0
- package/dist/parser/realtime/gtfs-updated-trip-update-parser.js +6 -1
- package/dist/parser/realtime/gtfs-updated-trip-update-parser.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { assertNever, itsOk, nonNull, parseIntThrow, } from "@dan-schel/js-utils";
|
|
2
|
+
import { GtfsScheduledTrip } from "../../data/trip/scheduled/gtfs-scheduled-trip.js";
|
|
3
|
+
import { GtfsAddedTrip } from "../../data/trip/added/gtfs-added-trip.js";
|
|
4
|
+
import { GtfsUpdatedTrip } from "../../data/trip/updated/gtfs-updated-trip.js";
|
|
5
|
+
import { GtfsReplacedTrip } from "../../data/trip/replaced/gtfs-replaced-trip.js";
|
|
6
|
+
import { GtfsEntireVehicleFormsServiceTransfer, } from "../../data/gtfs-transfer.js";
|
|
7
|
+
import { CorequeryIntrasourceId } from "../../conversion/corequery-intrasource-id.js";
|
|
8
|
+
export class DebugServicePage {
|
|
9
|
+
_trip;
|
|
10
|
+
_serviceDay;
|
|
11
|
+
_sourceId;
|
|
12
|
+
_system;
|
|
13
|
+
constructor(_trip, _serviceDay, _sourceId, _system) {
|
|
14
|
+
this._trip = _trip;
|
|
15
|
+
this._serviceDay = _serviceDay;
|
|
16
|
+
this._sourceId = _sourceId;
|
|
17
|
+
this._system = _system;
|
|
18
|
+
}
|
|
19
|
+
async render() {
|
|
20
|
+
return Promise.resolve({
|
|
21
|
+
title: this._trip.gtfsTripId,
|
|
22
|
+
content: [
|
|
23
|
+
this._renderBasicInfoSection(),
|
|
24
|
+
this._renderTransfersSection(),
|
|
25
|
+
this._renderTripUpdateSection(),
|
|
26
|
+
].filter(nonNull),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
_renderBasicInfoSection() {
|
|
30
|
+
return {
|
|
31
|
+
type: "section",
|
|
32
|
+
title: "Basic info",
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: "field-table",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
key: "Trip type",
|
|
39
|
+
value: this._getTripType(),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: "GTFS trip ID",
|
|
43
|
+
value: this._trip.gtfsTripId,
|
|
44
|
+
valueStyle: "code",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "Service day",
|
|
48
|
+
value: this._serviceDay.toLocaleString("en-US", {
|
|
49
|
+
dateStyle: "medium",
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "GTFS route ID",
|
|
54
|
+
value: this._getTripGtfsRouteId(),
|
|
55
|
+
valueStyle: "code",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
_renderTransfersSection() {
|
|
63
|
+
const feed = this._system.getFeed();
|
|
64
|
+
if (feed == null)
|
|
65
|
+
return null;
|
|
66
|
+
const { scheduleData, realtimeData: rtData } = feed;
|
|
67
|
+
const tripId = this._trip.gtfsTripId;
|
|
68
|
+
const scheduled = scheduleData.getTransfersForTrip(tripId);
|
|
69
|
+
const broken = rtData.getBrokenTransfersForTrip(tripId, this._serviceDay);
|
|
70
|
+
const added = rtData.getAddedTransfersForTrip(tripId, this._serviceDay);
|
|
71
|
+
return {
|
|
72
|
+
type: "section",
|
|
73
|
+
title: "Transfers",
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: "accordion",
|
|
77
|
+
sections: [
|
|
78
|
+
{
|
|
79
|
+
title: "Scheduled",
|
|
80
|
+
value: this._formatTransferCount(scheduled.length),
|
|
81
|
+
content: this._addEmptyMessageIfEmpty(scheduled.map((t) => this._formatScheduledTransfer(t)), "No scheduled transfers."),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: "Broken",
|
|
85
|
+
value: this._formatTransferCount(broken.length),
|
|
86
|
+
content: this._addEmptyMessageIfEmpty(broken.map((t) => this._formatBrokenTransfer(t)), "No broken transfers."),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: "Added",
|
|
90
|
+
value: this._formatTransferCount(added.length),
|
|
91
|
+
content: this._addEmptyMessageIfEmpty(added.map((t) => this._formatAddedTransfer(t)), "No added transfers."),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
_renderTripUpdateSection() {
|
|
99
|
+
if (this._trip instanceof GtfsScheduledTrip)
|
|
100
|
+
return null;
|
|
101
|
+
const json = this._trip.tripUpdateJson;
|
|
102
|
+
const content = json != null
|
|
103
|
+
? {
|
|
104
|
+
type: "code-block",
|
|
105
|
+
text: this._contextualizeJson(JSON.stringify(json, null, 2)),
|
|
106
|
+
}
|
|
107
|
+
: {
|
|
108
|
+
type: "paragraph",
|
|
109
|
+
text: "No trip update JSON was attached to this trip.",
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
type: "section",
|
|
113
|
+
title: "Trip update JSON",
|
|
114
|
+
content: [content],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
_contextualizeJson(json) {
|
|
118
|
+
const stopIdRegex = /^\s*"stopId": "([^"]*)",?$/;
|
|
119
|
+
const timestampRegex = /^\s*"time": ([0-9]+),?$/;
|
|
120
|
+
const helper = this._system.debugContextualizationHelpers;
|
|
121
|
+
return json
|
|
122
|
+
.split("\n")
|
|
123
|
+
.map((l) => {
|
|
124
|
+
// Show the stop and position name if possible.
|
|
125
|
+
const stopIdMatch = l.match(stopIdRegex);
|
|
126
|
+
if (stopIdMatch != null) {
|
|
127
|
+
const stopId = itsOk(stopIdMatch[1]);
|
|
128
|
+
const context = helper.getGtfsIdContext(stopId);
|
|
129
|
+
return `${l} // ${context}`;
|
|
130
|
+
}
|
|
131
|
+
// Show the timestamp in a human-readable format if possible.
|
|
132
|
+
const timestampMatch = l.match(timestampRegex);
|
|
133
|
+
if (timestampMatch != null) {
|
|
134
|
+
const timestamp = parseIntThrow(itsOk(timestampMatch[1]));
|
|
135
|
+
const context = helper.formatGtfsTripUpdateTimestamp(timestamp);
|
|
136
|
+
return `${l} // ${context}`;
|
|
137
|
+
}
|
|
138
|
+
return l;
|
|
139
|
+
})
|
|
140
|
+
.join("\n");
|
|
141
|
+
}
|
|
142
|
+
_getTripType() {
|
|
143
|
+
if (this._trip instanceof GtfsScheduledTrip) {
|
|
144
|
+
return "Scheduled";
|
|
145
|
+
}
|
|
146
|
+
else if (this._trip instanceof GtfsUpdatedTrip) {
|
|
147
|
+
return "Updated";
|
|
148
|
+
}
|
|
149
|
+
else if (this._trip instanceof GtfsAddedTrip) {
|
|
150
|
+
return "Added";
|
|
151
|
+
}
|
|
152
|
+
else if (this._trip instanceof GtfsReplacedTrip) {
|
|
153
|
+
return "Replaced";
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
assertNever(this._trip);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
_getTripGtfsRouteId() {
|
|
160
|
+
if (this._trip instanceof GtfsScheduledTrip) {
|
|
161
|
+
return this._trip.gtfsRouteId;
|
|
162
|
+
}
|
|
163
|
+
else if (this._trip instanceof GtfsUpdatedTrip) {
|
|
164
|
+
return this._trip.gtfsRouteId;
|
|
165
|
+
}
|
|
166
|
+
else if (this._trip instanceof GtfsAddedTrip) {
|
|
167
|
+
return "None (added trip)";
|
|
168
|
+
}
|
|
169
|
+
else if (this._trip instanceof GtfsReplacedTrip) {
|
|
170
|
+
const scheduled = this._trip.scheduledTrip.gtfsRouteId;
|
|
171
|
+
return `None (scheduled with: ${scheduled})`;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
assertNever(this._trip);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_formatTransferCount(count) {
|
|
178
|
+
if (count === 0)
|
|
179
|
+
return "None";
|
|
180
|
+
return count === 1 ? `1 transfer` : `${count} transfers`;
|
|
181
|
+
}
|
|
182
|
+
_addEmptyMessageIfEmpty(content, message) {
|
|
183
|
+
if (content.length === 0) {
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
type: "paragraph",
|
|
187
|
+
text: message,
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
return content;
|
|
192
|
+
}
|
|
193
|
+
_formatScheduledTransfer(transfer) {
|
|
194
|
+
return {
|
|
195
|
+
type: "field-table",
|
|
196
|
+
fields: this._formatTransfer(transfer),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
_formatBrokenTransfer(transfer) {
|
|
200
|
+
const reason = {
|
|
201
|
+
"trip-cancelled": "Trip cancelled",
|
|
202
|
+
"connecting-stop-or-position-changed": "Connecting stop or position changed",
|
|
203
|
+
}[transfer.reason];
|
|
204
|
+
return {
|
|
205
|
+
type: "field-table",
|
|
206
|
+
fields: [
|
|
207
|
+
...this._formatTransfer(transfer.transfer),
|
|
208
|
+
{
|
|
209
|
+
key: "Reason",
|
|
210
|
+
value: reason,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
_formatAddedTransfer(transfer) {
|
|
216
|
+
return {
|
|
217
|
+
type: "field-table",
|
|
218
|
+
fields: this._formatTransfer(transfer.transfer),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
_formatTransfer(transfer) {
|
|
222
|
+
if (transfer instanceof GtfsEntireVehicleFormsServiceTransfer) {
|
|
223
|
+
return this._formatGtfsEntireVehicleFormsServiceTransfer(transfer);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return assertNever(transfer);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
_formatGtfsEntireVehicleFormsServiceTransfer(transfer) {
|
|
230
|
+
const otherTripId = transfer.fromTripId === this._trip.gtfsTripId
|
|
231
|
+
? transfer.toTripId
|
|
232
|
+
: transfer.fromTripId;
|
|
233
|
+
const otherTripLabel = otherTripId === transfer.fromTripId ? "From" : "To";
|
|
234
|
+
const otherTrip = this._system.getFeed()?.getTrip(otherTripId, this._serviceDay) ?? null;
|
|
235
|
+
const suffix = this._getSuffixForOtherTripInTransfer(otherTrip);
|
|
236
|
+
const id = new CorequeryIntrasourceId(otherTripId, this._serviceDay);
|
|
237
|
+
return [
|
|
238
|
+
{
|
|
239
|
+
key: "Type",
|
|
240
|
+
value: "Entire vehicle forms service",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
key: otherTripLabel,
|
|
244
|
+
value: `${otherTripId}${suffix}`,
|
|
245
|
+
valueStyle: "code",
|
|
246
|
+
link: {
|
|
247
|
+
type: "service",
|
|
248
|
+
sourceId: this._sourceId,
|
|
249
|
+
intrasourceId: id.toString(),
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
_getSuffixForOtherTripInTransfer(trip) {
|
|
255
|
+
if (trip == null) {
|
|
256
|
+
// I don't think can happen at the moment, because the other trip is
|
|
257
|
+
// probably just cancelled at worst, right? I don't think we have a
|
|
258
|
+
// mechanism (yet) to enable real-time updates to delete trips entirely. I
|
|
259
|
+
// suppose we might one day though, since I think deleting trips is within
|
|
260
|
+
// the GTFS-RT spec.
|
|
261
|
+
return " (no longer exists)";
|
|
262
|
+
}
|
|
263
|
+
else if (trip instanceof GtfsUpdatedTrip && trip.isCancelled) {
|
|
264
|
+
return " (cancelled)";
|
|
265
|
+
}
|
|
266
|
+
else if (trip instanceof GtfsAddedTrip) {
|
|
267
|
+
return " (added)";
|
|
268
|
+
}
|
|
269
|
+
else if (trip instanceof GtfsReplacedTrip) {
|
|
270
|
+
return " (replaced)";
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
return "";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=debug-service-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-service-page.js","sourceRoot":"","sources":["../../../src/debug-pages/pages/debug-service-page.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,GACd,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAErF,OAAO,EA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AI,sBAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAErE,OAAO;YACL;gBACE,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,8BAA8B;aACtC;YACD;gBACE,GAAG,EAAE,cAAc;gBACnB,KAAK,EAAE,GAAG,WAAW,GAAG,MAAM,EAAE;gBAChC,UAAU,EAAE,MAAM;gBAClB,IAAI,EAAE;oBACJ,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI,CAAC,SAAS;oBACxB,aAAa,EAAE,EAAE,CAAC,QAAQ,EAAE;iBAC7B;aACF;SACF,CAAC;IACJ,CAAC;IAEO,gCAAgC,CAAC,IAAqB;QAC5D,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,oEAAoE;YACpE,mEAAmE;YACnE,0EAA0E;YAC1E,0EAA0E;YAC1E,oBAAoB;YACpB,OAAO,qBAAqB,CAAC;QAC/B,CAAC;aAAM,IAAI,IAAI,YAAY,eAAe,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC/D,OAAO,cAAc,CAAC;QACxB,CAAC;aAAM,IAAI,IAAI,YAAY,aAAa,EAAE,CAAC;YACzC,OAAO,UAAU,CAAC;QACpB,CAAC;aAAM,IAAI,IAAI,YAAY,gBAAgB,EAAE,CAAC;YAC5C,OAAO,aAAa,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { DepartureFields, DeparturesIterationDirection, DeparturesIterator, EntireVehicleFormsServiceConnectionFields, GenericServiceConnectionFields, LightweightDeparture, ServiceFields, ServiceOriginatingMovementFields, ServicePassingMovementFields, ServiceRegularMovementFields, ServiceSource, ServiceTerminatingMovementFields } from "./corequery-types.js";
|
|
1
|
+
import type { DepartureFields, DeparturesIterationDirection, DeparturesIterator, DynamicPageSystem, EntireVehicleFormsServiceConnectionFields, GenericServiceConnectionFields, LightweightDeparture, ServiceFields, ServiceOriginatingMovementFields, ServicePassingMovementFields, ServiceRegularMovementFields, ServiceSource, ServiceTerminatingMovementFields } from "./corequery-types.js";
|
|
2
2
|
import type { GtfsSystem } from "./gtfs-system.js";
|
|
3
3
|
export type GtfsTimeRounding = "no-rounding" | "nearest-minute";
|
|
4
4
|
type GtfsServiceSourceFields<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryEntireVehicleFormsServiceConnectionClass, CorequeryGenericServiceConnectionClass> = {
|
|
5
5
|
readonly sourceId: string;
|
|
6
|
+
readonly name: string;
|
|
6
7
|
readonly gtfsSystem: GtfsSystem;
|
|
7
8
|
readonly departureIterationLimitHours: number | null;
|
|
8
9
|
readonly timeRounding?: GtfsTimeRounding;
|
|
@@ -18,11 +19,14 @@ type GtfsServiceSourceFields<CorequeryDepartureClass, CorequeryServiceClass, Cor
|
|
|
18
19
|
};
|
|
19
20
|
export declare class GtfsServiceSource<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryEntireVehicleFormsServiceConnectionClass, CorequeryGenericServiceConnectionClass> implements ServiceSource<CorequeryDepartureClass, CorequeryServiceClass, LightweightDeparture<CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass>> {
|
|
20
21
|
readonly sourceId: string;
|
|
22
|
+
readonly name: string;
|
|
21
23
|
readonly gtfsSystem: GtfsSystem;
|
|
22
24
|
readonly departureIterationLimitHours: number | null;
|
|
23
25
|
private readonly _converter;
|
|
24
26
|
constructor(fields: GtfsServiceSourceFields<CorequeryDepartureClass, CorequeryServiceClass, CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass, CorequeryServicePassingMovementClass, CorequeryEntireVehicleFormsServiceConnectionClass, CorequeryGenericServiceConnectionClass>);
|
|
25
27
|
getService(intrasourceId: string): Promise<CorequeryServiceClass | null>;
|
|
26
28
|
getDeparturesIterator(stopId: number, instant: Temporal.Instant, direction: DeparturesIterationDirection): DeparturesIterator<CorequeryDepartureClass, LightweightDeparture<CorequeryTagsClass, CorequeryServiceOriginatingMovementClass, CorequeryServiceRegularMovementClass, CorequeryServiceTerminatingMovementClass>>;
|
|
29
|
+
get debugPageSystemPath(): string;
|
|
30
|
+
getDebugPageSystem(): DynamicPageSystem;
|
|
27
31
|
}
|
|
28
32
|
export {};
|
|
@@ -6,13 +6,16 @@ import { GtfsUpdatedTrip } from "./data/trip/updated/gtfs-updated-trip.js";
|
|
|
6
6
|
import { ServiceConversionIterator } from "./conversion/service-conversion-iterator.js";
|
|
7
7
|
import { GtfsAddedTrip } from "./data/trip/added/gtfs-added-trip.js";
|
|
8
8
|
import { GtfsReplacedTrip } from "./data/trip/replaced/gtfs-replaced-trip.js";
|
|
9
|
+
import { DebugPageSystem } from "./debug-pages/debug-page-system.js";
|
|
9
10
|
export class GtfsServiceSource {
|
|
10
11
|
sourceId;
|
|
12
|
+
name;
|
|
11
13
|
gtfsSystem;
|
|
12
14
|
departureIterationLimitHours;
|
|
13
15
|
_converter;
|
|
14
16
|
constructor(fields) {
|
|
15
17
|
this.sourceId = fields.sourceId;
|
|
18
|
+
this.name = fields.name;
|
|
16
19
|
this.gtfsSystem = fields.gtfsSystem;
|
|
17
20
|
this.departureIterationLimitHours = fields.departureIterationLimitHours;
|
|
18
21
|
this._converter = new ServiceConverter({
|
|
@@ -64,5 +67,11 @@ export class GtfsServiceSource {
|
|
|
64
67
|
iterator.set(instant, direction);
|
|
65
68
|
return new ServiceConversionIterator(iterator, this._converter, feed.timezoneConfig.timezone);
|
|
66
69
|
}
|
|
70
|
+
get debugPageSystemPath() {
|
|
71
|
+
return DebugPageSystem.HOME;
|
|
72
|
+
}
|
|
73
|
+
getDebugPageSystem() {
|
|
74
|
+
return new DebugPageSystem(this.sourceId, this.name, this.gtfsSystem);
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
//# sourceMappingURL=gtfs-service-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtfs-service-source.js","sourceRoot":"","sources":["../src/gtfs-service-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"gtfs-service-source.js","sourceRoot":"","sources":["../src/gtfs-service-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAgBlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAiErE,MAAM,OAAO,iBAAiB;IAoBnB,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,UAAU,CAAa;IAEvB,4BAA4B,CAAgB;IAEpC,UAAU,CAUzB;IAEF,YACE,MAUC;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAEpC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CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;CACF"}
|
package/dist/gtfs-system.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GtfsConfig, GtfsInterpolationMode, TimezoneConfig } from "./config/index.js";
|
|
1
|
+
import type { DebugContextualizationHelpersConfig, GtfsConfig, GtfsInterpolationMode, TimezoneConfig } from "./config/index.js";
|
|
2
2
|
import type { GtfsFeed } from "./data/gtfs-feed.js";
|
|
3
3
|
import { LineGtfsIdMapping } from "./data/ids/line-gtfs-id-mapping.js";
|
|
4
4
|
import { StopGtfsIdMapping } from "./data/ids/stop-gtfs-id-mapping.js";
|
|
@@ -7,17 +7,23 @@ import { LineRoutesMapping } from "./data/route/line-routes-mapping.js";
|
|
|
7
7
|
import type { GtfsScheduleParsingError } from "./parser/error-types.js";
|
|
8
8
|
import type { RealtimeDataJson } from "./data/raw/realtime-data-json.js";
|
|
9
9
|
import type { GtfsFeedCsv } from "./data/raw/schedule-csvs.js";
|
|
10
|
+
import { DebugContextualizationHelpers } from "./debug-pages/debug-contextualization-helpers.js";
|
|
10
11
|
export declare class GtfsSystem {
|
|
11
12
|
private readonly _parser;
|
|
12
13
|
private _feed;
|
|
13
14
|
private _scheduleParsingErrors;
|
|
14
15
|
private _realtimeParsingErrors;
|
|
15
|
-
|
|
16
|
+
private _scheduledDataParsedAt;
|
|
17
|
+
private _realtimeDataParsedAt;
|
|
18
|
+
readonly debugContextualizationHelpers: DebugContextualizationHelpers;
|
|
19
|
+
constructor(lineGtfsIdMapping: LineGtfsIdMapping, stopGtfsIdMapping: StopGtfsIdMapping, lineRoutesMapping: LineRoutesMapping, bonusLinesMapping: BonusLinesMapping, timezoneConfig: TimezoneConfig, interpolationMode: GtfsInterpolationMode, debugContextualizationHelpers: DebugContextualizationHelpersConfig | null);
|
|
16
20
|
static build(config: GtfsConfig): GtfsSystem;
|
|
17
21
|
getFeed(): GtfsFeed | null;
|
|
18
22
|
requireFeed(): GtfsFeed;
|
|
19
23
|
get realtimeParsingErrors(): import("./parser/error-types.js").GtfsTripUpdateParsingError[];
|
|
20
24
|
get scheduleParsingErrors(): GtfsScheduleParsingError[];
|
|
25
|
+
get scheduledDataParsedAt(): Temporal.Instant | null;
|
|
26
|
+
get realtimeDataParsedAt(): Temporal.Instant | null;
|
|
21
27
|
onNewScheduleData(scheduleCsvs: GtfsFeedCsv, realtimeJson: RealtimeDataJson): void;
|
|
22
28
|
onNewRealtimeData(realtimeJson: RealtimeDataJson): void;
|
|
23
29
|
setFeed(feed: GtfsFeed): void;
|
package/dist/gtfs-system.js
CHANGED
|
@@ -3,12 +3,21 @@ import { StopGtfsIdMapping } from "./data/ids/stop-gtfs-id-mapping.js";
|
|
|
3
3
|
import { BonusLinesMapping } from "./data/route/bonus-lines-mapping.js";
|
|
4
4
|
import { LineRoutesMapping } from "./data/route/line-routes-mapping.js";
|
|
5
5
|
import { GtfsFeedParser } from "./parser/gtfs-feed-parser.js";
|
|
6
|
+
import { DebugContextualizationHelpers } from "./debug-pages/debug-contextualization-helpers.js";
|
|
6
7
|
export class GtfsSystem {
|
|
7
8
|
_parser;
|
|
8
9
|
_feed;
|
|
9
10
|
_scheduleParsingErrors;
|
|
10
11
|
_realtimeParsingErrors;
|
|
11
|
-
|
|
12
|
+
// TODO: These are useful, but could be _more_ useful if combined with the age
|
|
13
|
+
// of the actual data itself, i.e. what VTAR reports. Maybe this isn't on
|
|
14
|
+
// `corequery-gtfs` to handle though. I think we'll want a debug page that
|
|
15
|
+
// `trainquery-melbourne` generates for the status of its integrations, e.g.
|
|
16
|
+
// the last time it failed to poll data from VTAR, etc.
|
|
17
|
+
_scheduledDataParsedAt;
|
|
18
|
+
_realtimeDataParsedAt;
|
|
19
|
+
debugContextualizationHelpers;
|
|
20
|
+
constructor(lineGtfsIdMapping, stopGtfsIdMapping, lineRoutesMapping, bonusLinesMapping, timezoneConfig, interpolationMode, debugContextualizationHelpers) {
|
|
12
21
|
this._parser = new GtfsFeedParser({
|
|
13
22
|
lineRoutesMapping,
|
|
14
23
|
bonusLinesMapping,
|
|
@@ -22,9 +31,16 @@ export class GtfsSystem {
|
|
|
22
31
|
this._feed = null;
|
|
23
32
|
this._scheduleParsingErrors = [];
|
|
24
33
|
this._realtimeParsingErrors = [];
|
|
34
|
+
this._scheduledDataParsedAt = null;
|
|
35
|
+
this._realtimeDataParsedAt = null;
|
|
36
|
+
this.debugContextualizationHelpers = new DebugContextualizationHelpers({
|
|
37
|
+
config: debugContextualizationHelpers,
|
|
38
|
+
timezoneConfig,
|
|
39
|
+
stopGtfsIdMapping,
|
|
40
|
+
});
|
|
25
41
|
}
|
|
26
42
|
static build(config) {
|
|
27
|
-
return new GtfsSystem(LineGtfsIdMapping.build(config.lineGtfsIds), StopGtfsIdMapping.build(config.stopGtfsIds), LineRoutesMapping.build(config.lineRoutesMapping), BonusLinesMapping.build(config.bonusLinesMapping ?? {}), config.timezoneConfig, config.interpolationMode ?? "follow-spec");
|
|
43
|
+
return new GtfsSystem(LineGtfsIdMapping.build(config.lineGtfsIds), StopGtfsIdMapping.build(config.stopGtfsIds), LineRoutesMapping.build(config.lineRoutesMapping, config.applyServiceTagSuccession), BonusLinesMapping.build(config.bonusLinesMapping ?? {}), config.timezoneConfig, config.interpolationMode ?? "follow-spec", config.debugContextualizationHelpers ?? null);
|
|
28
44
|
}
|
|
29
45
|
getFeed() {
|
|
30
46
|
return this._feed;
|
|
@@ -40,11 +56,19 @@ export class GtfsSystem {
|
|
|
40
56
|
get scheduleParsingErrors() {
|
|
41
57
|
return this._scheduleParsingErrors;
|
|
42
58
|
}
|
|
59
|
+
get scheduledDataParsedAt() {
|
|
60
|
+
return this._scheduledDataParsedAt;
|
|
61
|
+
}
|
|
62
|
+
get realtimeDataParsedAt() {
|
|
63
|
+
return this._realtimeDataParsedAt;
|
|
64
|
+
}
|
|
43
65
|
onNewScheduleData(scheduleCsvs, realtimeJson) {
|
|
44
66
|
this._scheduleParsingErrors = [];
|
|
45
67
|
this._realtimeParsingErrors = [];
|
|
46
68
|
const result = this._parser.parse(scheduleCsvs, realtimeJson);
|
|
47
69
|
this._feed = result;
|
|
70
|
+
this._scheduledDataParsedAt = Temporal.Now.instant();
|
|
71
|
+
this._realtimeDataParsedAt = Temporal.Now.instant();
|
|
48
72
|
}
|
|
49
73
|
onNewRealtimeData(realtimeJson) {
|
|
50
74
|
if (this._feed == null)
|
|
@@ -52,9 +76,14 @@ export class GtfsSystem {
|
|
|
52
76
|
this._realtimeParsingErrors = [];
|
|
53
77
|
const result = this._parser.updateWithNewRealtimeData(this._feed, realtimeJson);
|
|
54
78
|
this._feed = result;
|
|
79
|
+
this._realtimeDataParsedAt = Temporal.Now.instant();
|
|
55
80
|
}
|
|
56
81
|
setFeed(feed) {
|
|
57
82
|
this._feed = feed;
|
|
83
|
+
this._scheduleParsingErrors = [];
|
|
84
|
+
this._realtimeParsingErrors = [];
|
|
85
|
+
this._scheduledDataParsedAt = null;
|
|
86
|
+
this._realtimeDataParsedAt = null;
|
|
58
87
|
}
|
|
59
88
|
_onScheduledParsingError(error) {
|
|
60
89
|
this._scheduleParsingErrors.push(error);
|
package/dist/gtfs-system.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtfs-system.js","sourceRoot":"","sources":["../src/gtfs-system.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gtfs-system.js","sourceRoot":"","sources":["../src/gtfs-system.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAO9D,OAAO,EAAE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