corequery-gtfs 0.10.4 → 0.12.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.
Files changed (144) hide show
  1. package/dist/conversion/service-converter.d.ts +7 -3
  2. package/dist/conversion/service-converter.js +60 -98
  3. package/dist/conversion/service-converter.js.map +1 -1
  4. package/dist/data/gtfs-feed.d.ts +3 -4
  5. package/dist/data/gtfs-feed.js.map +1 -1
  6. package/dist/data/gtfs-realtime-data.d.ts +6 -7
  7. package/dist/data/gtfs-realtime-data.js +7 -11
  8. package/dist/data/gtfs-realtime-data.js.map +1 -1
  9. package/dist/data/gtfs-schedule-data.d.ts +1 -1
  10. package/dist/data/trip/added/gtfs-added-trip-originating-movement.d.ts +24 -0
  11. package/dist/data/trip/added/gtfs-added-trip-originating-movement.js +40 -0
  12. package/dist/data/trip/added/gtfs-added-trip-originating-movement.js.map +1 -0
  13. package/dist/data/trip/added/gtfs-added-trip-passing-movement.d.ts +14 -0
  14. package/dist/data/trip/added/gtfs-added-trip-passing-movement.js +24 -0
  15. package/dist/data/trip/added/gtfs-added-trip-passing-movement.js.map +1 -0
  16. package/dist/data/trip/added/gtfs-added-trip-regular-movement.d.ts +30 -0
  17. package/dist/data/trip/added/gtfs-added-trip-regular-movement.js +51 -0
  18. package/dist/data/trip/added/gtfs-added-trip-regular-movement.js.map +1 -0
  19. package/dist/data/trip/added/gtfs-added-trip-terminating-movement.d.ts +24 -0
  20. package/dist/data/trip/added/gtfs-added-trip-terminating-movement.js +40 -0
  21. package/dist/data/trip/added/gtfs-added-trip-terminating-movement.js.map +1 -0
  22. package/dist/data/trip/added/gtfs-added-trip.d.ts +26 -0
  23. package/dist/data/trip/added/gtfs-added-trip.js +52 -0
  24. package/dist/data/trip/added/gtfs-added-trip.js.map +1 -0
  25. package/dist/data/trip/added/types.d.ts +20 -0
  26. package/dist/data/trip/added/types.js +2 -0
  27. package/dist/data/trip/added/types.js.map +1 -0
  28. package/dist/data/trip/replaced/gtfs-replaced-trip-originating-movement.d.ts +24 -0
  29. package/dist/data/trip/replaced/gtfs-replaced-trip-originating-movement.js +40 -0
  30. package/dist/data/trip/replaced/gtfs-replaced-trip-originating-movement.js.map +1 -0
  31. package/dist/data/trip/replaced/gtfs-replaced-trip-passing-movement.d.ts +14 -0
  32. package/dist/data/trip/replaced/gtfs-replaced-trip-passing-movement.js +24 -0
  33. package/dist/data/trip/replaced/gtfs-replaced-trip-passing-movement.js.map +1 -0
  34. package/dist/data/trip/replaced/gtfs-replaced-trip-regular-movement.d.ts +30 -0
  35. package/dist/data/trip/replaced/gtfs-replaced-trip-regular-movement.js +51 -0
  36. package/dist/data/trip/replaced/gtfs-replaced-trip-regular-movement.js.map +1 -0
  37. package/dist/data/trip/replaced/gtfs-replaced-trip-terminating-movement.d.ts +24 -0
  38. package/dist/data/trip/replaced/gtfs-replaced-trip-terminating-movement.js +40 -0
  39. package/dist/data/trip/replaced/gtfs-replaced-trip-terminating-movement.js.map +1 -0
  40. package/dist/data/trip/replaced/gtfs-replaced-trip.d.ts +28 -0
  41. package/dist/data/trip/replaced/gtfs-replaced-trip.js +70 -0
  42. package/dist/data/trip/replaced/gtfs-replaced-trip.js.map +1 -0
  43. package/dist/data/trip/replaced/types.d.ts +20 -0
  44. package/dist/data/trip/replaced/types.js +2 -0
  45. package/dist/data/trip/replaced/types.js.map +1 -0
  46. package/dist/data/trip/scheduled/gtfs-scheduled-trip-originating-movement.d.ts +29 -0
  47. package/dist/data/trip/scheduled/gtfs-scheduled-trip-originating-movement.js +74 -0
  48. package/dist/data/trip/scheduled/gtfs-scheduled-trip-originating-movement.js.map +1 -0
  49. package/dist/data/trip/scheduled/gtfs-scheduled-trip-passing-movement.d.ts +17 -0
  50. package/dist/data/trip/scheduled/gtfs-scheduled-trip-passing-movement.js +35 -0
  51. package/dist/data/trip/scheduled/gtfs-scheduled-trip-passing-movement.js.map +1 -0
  52. package/dist/data/trip/scheduled/gtfs-scheduled-trip-regular-movement.d.ts +35 -0
  53. package/dist/data/trip/scheduled/gtfs-scheduled-trip-regular-movement.js +98 -0
  54. package/dist/data/trip/scheduled/gtfs-scheduled-trip-regular-movement.js.map +1 -0
  55. package/dist/data/trip/scheduled/gtfs-scheduled-trip-terminating-movement.d.ts +29 -0
  56. package/dist/data/trip/scheduled/gtfs-scheduled-trip-terminating-movement.js +74 -0
  57. package/dist/data/trip/scheduled/gtfs-scheduled-trip-terminating-movement.js.map +1 -0
  58. package/dist/data/{gtfs-scheduled-trip.d.ts → trip/scheduled/gtfs-scheduled-trip.d.ts} +6 -4
  59. package/dist/data/{gtfs-scheduled-trip.js → trip/scheduled/gtfs-scheduled-trip.js} +3 -2
  60. package/dist/data/trip/scheduled/gtfs-scheduled-trip.js.map +1 -0
  61. package/dist/data/trip/scheduled/types.d.ts +33 -0
  62. package/dist/data/trip/scheduled/types.js +2 -0
  63. package/dist/data/trip/scheduled/types.js.map +1 -0
  64. package/dist/data/trip/types.d.ts +14 -0
  65. package/dist/data/trip/types.js +2 -0
  66. package/dist/data/trip/types.js.map +1 -0
  67. package/dist/data/trip/updated/gtfs-updated-trip-originating-movement.d.ts +36 -0
  68. package/dist/data/trip/updated/gtfs-updated-trip-originating-movement.js +82 -0
  69. package/dist/data/trip/updated/gtfs-updated-trip-originating-movement.js.map +1 -0
  70. package/dist/data/trip/updated/gtfs-updated-trip-passing-movement.d.ts +15 -0
  71. package/dist/data/trip/updated/gtfs-updated-trip-passing-movement.js +27 -0
  72. package/dist/data/trip/updated/gtfs-updated-trip-passing-movement.js.map +1 -0
  73. package/dist/data/trip/updated/gtfs-updated-trip-regular-movement.d.ts +48 -0
  74. package/dist/data/trip/updated/gtfs-updated-trip-regular-movement.js +129 -0
  75. package/dist/data/trip/updated/gtfs-updated-trip-regular-movement.js.map +1 -0
  76. package/dist/data/trip/updated/gtfs-updated-trip-terminating-movement.d.ts +36 -0
  77. package/dist/data/trip/updated/gtfs-updated-trip-terminating-movement.js +82 -0
  78. package/dist/data/trip/updated/gtfs-updated-trip-terminating-movement.js.map +1 -0
  79. package/dist/data/{gtfs-updated-trip.d.ts → trip/updated/gtfs-updated-trip.d.ts} +5 -3
  80. package/dist/data/{gtfs-updated-trip.js → trip/updated/gtfs-updated-trip.js} +0 -18
  81. package/dist/data/trip/updated/gtfs-updated-trip.js.map +1 -0
  82. package/dist/data/trip/updated/types.d.ts +24 -0
  83. package/dist/data/trip/updated/types.js +2 -0
  84. package/dist/data/trip/updated/types.js.map +1 -0
  85. package/dist/departures/gtfs-scheduled-movements-index.d.ts +2 -2
  86. package/dist/departures/iterator/departures-iterator.d.ts +3 -5
  87. package/dist/departures/iterator/departures-iterator.js.map +1 -1
  88. package/dist/departures/iterator/scheduled-departures-block-iterator.js +2 -2
  89. package/dist/departures/iterator/scheduled-departures-block-iterator.js.map +1 -1
  90. package/dist/departures/realtime-departures-block.d.ts +3 -4
  91. package/dist/departures/realtime-departures-block.js.map +1 -1
  92. package/dist/gtfs-service-source.js +12 -2
  93. package/dist/gtfs-service-source.js.map +1 -1
  94. package/dist/parser/gtfs-feed-parser.js +3 -0
  95. package/dist/parser/gtfs-feed-parser.js.map +1 -1
  96. package/dist/parser/gtfs-route-matcher.d.ts +31 -0
  97. package/dist/parser/gtfs-route-matcher.js +114 -0
  98. package/dist/parser/gtfs-route-matcher.js.map +1 -0
  99. package/dist/parser/realtime/gtfs-added-trip-update-parser.d.ts +49 -0
  100. package/dist/parser/realtime/gtfs-added-trip-update-parser.js +207 -0
  101. package/dist/parser/realtime/gtfs-added-trip-update-parser.js.map +1 -0
  102. package/dist/parser/realtime/gtfs-cancelled-trip-update-parser.d.ts +16 -0
  103. package/dist/parser/realtime/gtfs-cancelled-trip-update-parser.js +24 -0
  104. package/dist/parser/realtime/gtfs-cancelled-trip-update-parser.js.map +1 -0
  105. package/dist/parser/realtime/gtfs-realtime-data-parser.d.ts +6 -0
  106. package/dist/parser/realtime/gtfs-realtime-data-parser.js +16 -12
  107. package/dist/parser/realtime/gtfs-realtime-data-parser.js.map +1 -1
  108. package/dist/parser/realtime/{gtfs-trip-update-trip-identifier.d.ts → gtfs-scheduled-trip-identifier.d.ts} +6 -6
  109. package/dist/parser/realtime/{gtfs-trip-update-trip-identifier.js → gtfs-scheduled-trip-identifier.js} +2 -2
  110. package/dist/parser/realtime/gtfs-scheduled-trip-identifier.js.map +1 -0
  111. package/dist/parser/realtime/gtfs-trip-movements-interpolator.d.ts +7 -0
  112. package/dist/parser/realtime/gtfs-trip-movements-interpolator.js +183 -0
  113. package/dist/parser/realtime/gtfs-trip-movements-interpolator.js.map +1 -0
  114. package/dist/parser/realtime/gtfs-trip-update-parser-common-error-types.d.ts +25 -0
  115. package/dist/parser/realtime/gtfs-trip-update-parser-common-error-types.js +37 -0
  116. package/dist/parser/realtime/gtfs-trip-update-parser-common-error-types.js.map +1 -0
  117. package/dist/parser/realtime/gtfs-trip-update-parser.d.ts +15 -81
  118. package/dist/parser/realtime/gtfs-trip-update-parser.js +30 -272
  119. package/dist/parser/realtime/gtfs-trip-update-parser.js.map +1 -1
  120. package/dist/parser/realtime/gtfs-updated-trip-update-parser.d.ts +76 -0
  121. package/dist/parser/realtime/gtfs-updated-trip-update-parser.js +264 -0
  122. package/dist/parser/realtime/gtfs-updated-trip-update-parser.js.map +1 -0
  123. package/dist/parser/schedule/gtfs-transfer-parser.d.ts +1 -1
  124. package/dist/parser/schedule/gtfs-transfer-parser.js +1 -1
  125. package/dist/parser/schedule/gtfs-transfer-parser.js.map +1 -1
  126. package/dist/parser/schedule/gtfs-trip-parser.d.ts +24 -8
  127. package/dist/parser/schedule/gtfs-trip-parser.js +120 -51
  128. package/dist/parser/schedule/gtfs-trip-parser.js.map +1 -1
  129. package/package.json +1 -1
  130. package/dist/data/gtfs-scheduled-trip-movements.d.ts +0 -118
  131. package/dist/data/gtfs-scheduled-trip-movements.js +0 -233
  132. package/dist/data/gtfs-scheduled-trip-movements.js.map +0 -1
  133. package/dist/data/gtfs-scheduled-trip.js.map +0 -1
  134. package/dist/data/gtfs-updated-trip-movements.d.ts +0 -124
  135. package/dist/data/gtfs-updated-trip-movements.js +0 -150
  136. package/dist/data/gtfs-updated-trip-movements.js.map +0 -1
  137. package/dist/data/gtfs-updated-trip.js.map +0 -1
  138. package/dist/data/utils.d.ts +0 -3
  139. package/dist/data/utils.js +0 -2
  140. package/dist/data/utils.js.map +0 -1
  141. package/dist/parser/realtime/gtfs-trip-update-trip-identifier.js.map +0 -1
  142. package/dist/parser/schedule/gtfs-route-matcher.d.ts +0 -53
  143. package/dist/parser/schedule/gtfs-route-matcher.js +0 -197
  144. package/dist/parser/schedule/gtfs-route-matcher.js.map +0 -1
@@ -1,182 +1,50 @@
1
- import { GtfsUpdatedTrip } from "../../data/gtfs-updated-trip.js";
2
- import { GtfsTripUpdateTripIdentifier, } from "./gtfs-trip-update-trip-identifier.js";
3
- import { itsOk } from "@dan-schel/js-utils";
1
+ import { GtfsAddedTripUpdateParser, } from "./gtfs-added-trip-update-parser.js";
2
+ import { GtfsCancelledTripUpdateParser, } from "./gtfs-cancelled-trip-update-parser.js";
3
+ import { GtfsUpdatedTripUpdateParser, } from "./gtfs-updated-trip-update-parser.js";
4
4
  const TRIP_UPDATE_SCHEDULE_RELATIONSHIP_SCHEDULED = "SCHEDULED";
5
5
  const TRIP_UPDATE_SCHEDULE_RELATIONSHIP_CANCELLED = "CANCELED";
6
- const STOP_TIME_UPDATE_ENTRY_SCHEDULE_RELATIONSHIP_SCHEDULED = "SCHEDULED";
6
+ const TRIP_UPDATE_SCHEDULE_RELATIONSHIP_ADDED = "ADDED";
7
+ const TRIP_UPDATE_SCHEDULE_RELATIONSHIP_NEW = "NEW";
7
8
  export class GtfsTripUpdateParser {
8
- _timezone;
9
- _stopGtfsIdMapping;
10
9
  _onError;
11
- _tripIdentifier;
10
+ _updatedTripParser;
11
+ _cancelledTripParser;
12
+ _addedTripParser;
12
13
  constructor(fields) {
13
- this._timezone = fields.timezone;
14
- this._stopGtfsIdMapping = fields.stopGtfsIdMapping;
15
14
  this._onError = fields.onError;
16
- this._tripIdentifier = new GtfsTripUpdateTripIdentifier({
15
+ this._updatedTripParser = new GtfsUpdatedTripUpdateParser({
16
+ timezone: fields.timezone,
17
+ stopGtfsIdMapping: fields.stopGtfsIdMapping,
18
+ onError: this._onError,
19
+ });
20
+ this._cancelledTripParser = new GtfsCancelledTripUpdateParser({
21
+ timezone: fields.timezone,
22
+ onError: this._onError,
23
+ });
24
+ this._addedTripParser = new GtfsAddedTripUpdateParser({
25
+ stopGtfsIdMapping: fields.stopGtfsIdMapping,
26
+ lineGtfsIdMapping: fields.lineGtfsIdMapping,
27
+ lineRoutesMapping: fields.lineRoutesMapping,
28
+ bonusLinesMapping: fields.bonusLinesMapping,
17
29
  onError: this._onError,
18
30
  });
19
31
  }
20
32
  parse(tripUpdate, scheduleData) {
21
33
  const sr = tripUpdate.trip.scheduleRelationship;
22
34
  if (sr === TRIP_UPDATE_SCHEDULE_RELATIONSHIP_SCHEDULED) {
23
- return this._parseForScheduledTrip(tripUpdate, scheduleData);
35
+ return this._updatedTripParser.parse(tripUpdate, scheduleData);
24
36
  }
25
37
  else if (sr === TRIP_UPDATE_SCHEDULE_RELATIONSHIP_CANCELLED) {
26
- return this._parseForCancelledTrip(tripUpdate, scheduleData);
38
+ return this._cancelledTripParser.parse(tripUpdate, scheduleData);
27
39
  }
28
- else {
29
- this._onError(new UnsupportedTripUpdateScheduleRelationshipError(tripUpdate));
30
- return null;
31
- }
32
- }
33
- _parseForScheduledTrip(tripUpdate, scheduleData) {
34
- const result = this._tripIdentifier.identify(tripUpdate.trip, scheduleData);
35
- if (result == null)
36
- return null;
37
- const { trip, serviceDay } = result;
38
- if (tripUpdate.stopTimeUpdate == null) {
39
- this._onError(new NoStopTimeUpdateFieldGivenError(tripUpdate));
40
- return null;
41
- }
42
- const updatedMovementsByIndex = new Map();
43
- for (const entry of tripUpdate.stopTimeUpdate) {
44
- // This `scheduleRelationship` field is probably how altered routes work.
45
- const sr = entry.scheduleRelationship;
46
- if (sr !== STOP_TIME_UPDATE_ENTRY_SCHEDULE_RELATIONSHIP_SCHEDULED) {
47
- const Err = UnsupportedStopTimeUpdateEntryScheduleRelationshipError;
48
- this._onError(new Err(tripUpdate, entry));
49
- return null;
50
- }
51
- // Check the fields we're gonna rely on (that PTV seems to reliably give
52
- // but are technically optional in the GTFS-RT spec) are actually present.
53
- if (entry.stopSequence == null) {
54
- const Err = NecessaryFieldNotInStopTimeUpdateEntryError;
55
- this._onError(new Err(tripUpdate, entry, "stopSequence"));
56
- return null;
57
- }
58
- if (entry.stopId == null) {
59
- const Err = NecessaryFieldNotInStopTimeUpdateEntryError;
60
- this._onError(new Err(tripUpdate, entry, "stopId"));
61
- return null;
62
- }
63
- if (entry.arrival == null && entry.departure == null) {
64
- const Err = NeitherArrivalNorDepartureGivenError;
65
- this._onError(new Err(tripUpdate, entry));
66
- return null;
67
- }
68
- // Find the stop in the scheduled trip that this update is supposed to be
69
- // for.
70
- const movementIndex = trip.movements.findIndex((m) => m.isServicing && m.gtfsStopSequence === entry.stopSequence);
71
- if (movementIndex === -1) {
72
- const Err = StopTimeUpdateEntryReferencesNonExistentStopSequenceError;
73
- this._onError(new Err(tripUpdate, entry, trip));
74
- return null;
75
- }
76
- // Enforced by findIndex above.
77
- const scheduledMovement = itsOk(trip.movements[movementIndex]);
78
- if (!scheduledMovement.isServicing)
79
- throw new Error();
80
- // Check that we haven't already matched a stop time update entry to this
81
- // movement index. (Would happen if `stopSequence` was the same value
82
- // twice, I guess.)
83
- if (updatedMovementsByIndex.has(movementIndex)) {
84
- const Err = MultipleStopTimeUpdateEntriesForSameMovementIndexError;
85
- this._onError(new Err(tripUpdate, entry, trip, movementIndex));
86
- return null;
87
- }
88
- // Look up the stop GTFS ID given in the stop time update entry, and check
89
- // whether it still maps to the same (CoreQuery) stop. In this way, we
90
- // allow the platform/position ID to change, not the overall stop/station.
91
- const gtfsIdMetadata = this._stopGtfsIdMapping.tryResolve(entry.stopId);
92
- if (gtfsIdMetadata == null) {
93
- const Err = StopTimeUpdateEntryReferencesUnmappedStopIdError;
94
- this._onError(new Err(tripUpdate, entry));
95
- return null;
96
- }
97
- if (gtfsIdMetadata.stopId !== scheduledMovement.gtfsIdMetadata.stopId) {
98
- const Err = StopTimeUpdateEntryChangesStopError;
99
- this._onError(new Err(tripUpdate, entry, trip, movementIndex));
100
- return null;
101
- }
102
- const updatedPositionId = gtfsIdMetadata.type === "positional" ? gtfsIdMetadata.positionId : null;
103
- // Parse the updated times from the `arrivalTime` and `departureTime`
104
- // fields.
105
- const realtimeArrivalTime = "arrivalTime" in scheduledMovement
106
- ? this._parseUpdatedTime(entry.arrival ?? null, scheduledMovement.arrivalTime, serviceDay, tripUpdate, entry)
107
- : null;
108
- const realtimeDepartureTime = "departureTime" in scheduledMovement
109
- ? this._parseUpdatedTime(entry.departure ?? null, scheduledMovement.departureTime, serviceDay, tripUpdate, entry)
110
- : null;
111
- updatedMovementsByIndex.set(movementIndex, scheduledMovement.asUpdatedTripMovement({
112
- arrivalTime: realtimeArrivalTime,
113
- departureTime: realtimeDepartureTime,
114
- updatedPositionId,
115
- updatedGtfsIdMetadata: gtfsIdMetadata,
116
- serviceDay,
117
- timezone: this._timezone,
118
- }));
119
- }
120
- let movements = trip.movements.map((m) => m.asHollowUpdatedTripMovement(serviceDay, this._timezone));
121
- movements = movements.map((movement, i) => {
122
- return updatedMovementsByIndex.get(i) ?? movement;
123
- });
124
- return new GtfsUpdatedTrip({
125
- scheduledTrip: trip,
126
- serviceDay,
127
- movements,
128
- isCancelled: false,
129
- });
130
- }
131
- _parseForCancelledTrip(tripUpdate, scheduleData) {
132
- const result = this._tripIdentifier.identify(tripUpdate.trip, scheduleData);
133
- if (result == null)
134
- return null;
135
- const { trip, serviceDay } = result;
136
- return GtfsUpdatedTrip.unmodified(trip, serviceDay, this._timezone).with({
137
- isCancelled: true,
138
- });
139
- }
140
- _parseUpdatedTime(updatedTime, scheduledTime, serviceDay, tripUpdate, stopTimeUpdateEntry) {
141
- if (updatedTime == null) {
142
- return null;
143
- }
144
- const { time, delay } = updatedTime;
145
- const fromTime = time != null ? Temporal.Instant.fromEpochMilliseconds(time * 1000) : null;
146
- const fromDelay = delay != null
147
- ? scheduledTime
148
- .toInstant(serviceDay, this._timezone)
149
- .add({ seconds: delay })
150
- : null;
151
- // Most/all trips in PTV's realtime feed have both time and delay. If using
152
- // both of those methods gives us different results, then I've probably
153
- // messed something up (e.g. maybe my service day assumption in the trip
154
- // identifier is wrong)... or PTV has.
155
- //
156
- // We'll press on (this check is only meant for reporting/my interest), but
157
- // the something's probably gonna be very broken for this trip!
158
- if (fromTime != null && fromDelay != null && !fromTime.equals(fromDelay)) {
159
- this._onError(new TimeAndDelayDisagreeWithEachOtherError(tripUpdate, stopTimeUpdateEntry, updatedTime, fromTime, fromDelay));
160
- }
161
- // I don't think it really matters which of `delay` or `time` we preference,
162
- // since they're either identical, or we've (probably) messed up the service
163
- // day, in which case we're either applying the right time to the wrong
164
- // service (`time`), or the we've calculated the time assuming the wrong
165
- // service day (`delay`).
166
- //
167
- // It'll probably be clearer to me trying to debug this if we apply this
168
- // realtime update to yesterday/tomorrow's service and it makes it look like
169
- // there's two departures of the same service happening at/near to the same
170
- // time, so I'll pick `time`.
171
- if (fromTime != null) {
172
- return fromTime;
173
- }
174
- else if (fromDelay != null) {
175
- return fromDelay;
40
+ else if (
41
+ // ADDED is deprecated in favour of NEW, but PTV still uses ADDED.
42
+ sr === TRIP_UPDATE_SCHEDULE_RELATIONSHIP_ADDED ||
43
+ sr === TRIP_UPDATE_SCHEDULE_RELATIONSHIP_NEW) {
44
+ return this._addedTripParser.parse(tripUpdate, scheduleData);
176
45
  }
177
46
  else {
178
- const Err = NeitherTimeNorDelayGivenError;
179
- this._onError(new Err(tripUpdate, stopTimeUpdateEntry, updatedTime));
47
+ this._onError(new UnsupportedTripUpdateScheduleRelationshipError(tripUpdate));
180
48
  return null;
181
49
  }
182
50
  }
@@ -188,114 +56,4 @@ export class UnsupportedTripUpdateScheduleRelationshipError {
188
56
  this.tripUpdate = tripUpdate;
189
57
  }
190
58
  }
191
- export class NoStopTimeUpdateFieldGivenError {
192
- tripUpdate;
193
- type = "no-stop-time-update-field-given";
194
- constructor(tripUpdate) {
195
- this.tripUpdate = tripUpdate;
196
- }
197
- }
198
- export class UnsupportedStopTimeUpdateEntryScheduleRelationshipError {
199
- tripUpdate;
200
- stopTimeUpdateEntry;
201
- type = "unsupported-stop-time-update-entry-schedule-relationship";
202
- constructor(tripUpdate, stopTimeUpdateEntry) {
203
- this.tripUpdate = tripUpdate;
204
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
205
- }
206
- }
207
- export class NecessaryFieldNotInStopTimeUpdateEntryError {
208
- tripUpdate;
209
- stopTimeUpdateEntry;
210
- field;
211
- type = "necessary-field-not-in-stop-time-update-entry";
212
- constructor(tripUpdate, stopTimeUpdateEntry, field) {
213
- this.tripUpdate = tripUpdate;
214
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
215
- this.field = field;
216
- }
217
- }
218
- export class StopTimeUpdateEntryReferencesNonExistentStopSequenceError {
219
- tripUpdate;
220
- stopTimeUpdateEntry;
221
- matchedTrip;
222
- type = "stop-time-update-entry-references-non-existent-stop-sequence";
223
- constructor(tripUpdate, stopTimeUpdateEntry, matchedTrip) {
224
- this.tripUpdate = tripUpdate;
225
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
226
- this.matchedTrip = matchedTrip;
227
- }
228
- }
229
- export class MultipleStopTimeUpdateEntriesForSameMovementIndexError {
230
- tripUpdate;
231
- stopTimeUpdateEntry;
232
- matchedTrip;
233
- matchedMovementIndex;
234
- type = "multiple-stop-time-update-entries-for-same-movement-index";
235
- constructor(tripUpdate, stopTimeUpdateEntry, matchedTrip, matchedMovementIndex) {
236
- this.tripUpdate = tripUpdate;
237
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
238
- this.matchedTrip = matchedTrip;
239
- this.matchedMovementIndex = matchedMovementIndex;
240
- }
241
- }
242
- export class StopTimeUpdateEntryReferencesUnmappedStopIdError {
243
- tripUpdate;
244
- stopTimeUpdateEntry;
245
- type = "stop-time-update-entry-references-unmapped-stop-id";
246
- constructor(tripUpdate, stopTimeUpdateEntry) {
247
- this.tripUpdate = tripUpdate;
248
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
249
- }
250
- }
251
- // i.e. It doesn't just change the position/platform (which we're fine with),
252
- // but the entire stop.
253
- export class StopTimeUpdateEntryChangesStopError {
254
- tripUpdate;
255
- stopTimeUpdateEntry;
256
- matchedTrip;
257
- matchedMovementIndex;
258
- type = "stop-time-update-entry-changes-stop";
259
- constructor(tripUpdate, stopTimeUpdateEntry, matchedTrip, matchedMovementIndex) {
260
- this.tripUpdate = tripUpdate;
261
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
262
- this.matchedTrip = matchedTrip;
263
- this.matchedMovementIndex = matchedMovementIndex;
264
- }
265
- }
266
- export class NeitherTimeNorDelayGivenError {
267
- tripUpdate;
268
- stopTimeUpdateEntry;
269
- updatedTime;
270
- type = "neither-time-nor-delay-given";
271
- constructor(tripUpdate, stopTimeUpdateEntry, updatedTime) {
272
- this.tripUpdate = tripUpdate;
273
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
274
- this.updatedTime = updatedTime;
275
- }
276
- }
277
- export class TimeAndDelayDisagreeWithEachOtherError {
278
- tripUpdate;
279
- stopTimeUpdateEntry;
280
- updatedTime;
281
- parsedFromTime;
282
- parsedFromDelay;
283
- type = "time-and-delay-disagree-with-each-other";
284
- constructor(tripUpdate, stopTimeUpdateEntry, updatedTime, parsedFromTime, parsedFromDelay) {
285
- this.tripUpdate = tripUpdate;
286
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
287
- this.updatedTime = updatedTime;
288
- this.parsedFromTime = parsedFromTime;
289
- this.parsedFromDelay = parsedFromDelay;
290
- }
291
- }
292
- export class NeitherArrivalNorDepartureGivenError {
293
- tripUpdate;
294
- stopTimeUpdateEntry;
295
- type = "neither-arrival-nor-departure-given";
296
- constructor(tripUpdate, stopTimeUpdateEntry) {
297
- this.tripUpdate = tripUpdate;
298
- this.stopTimeUpdateEntry = stopTimeUpdateEntry;
299
- }
300
- }
301
59
  //# sourceMappingURL=gtfs-trip-update-parser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gtfs-trip-update-parser.js","sourceRoot":"","sources":["../../../src/parser/realtime/gtfs-trip-update-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAMlE,OAAO,EACL,4BAA4B,GAE7B,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,MAAM,2CAA2C,GAAG,WAAW,CAAC;AAChE,MAAM,2CAA2C,GAAG,UAAU,CAAC;AAC/D,MAAM,sDAAsD,GAAG,WAAW,CAAC;AAQ3E,MAAM,OAAO,oBAAoB;IACd,SAAS,CAAS;IAClB,kBAAkB,CAAoB;IACtC,QAAQ,CAA8C;IAEtD,eAAe,CAA+B;IAE/D,YAAY,MAAkC;QAC5C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;QAE/B,IAAI,CAAC,eAAe,GAAG,IAAI,4BAA4B,CAAC;YACtD,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAA0B,EAAE,YAA8B;QAC9D,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC;QAEhD,IAAI,EAAE,KAAK,2CAA2C,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAC/D,CAAC;aAAM,IAAI,EAAE,KAAK,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1,76 @@
1
+ import type { StopGtfsIdMapping } from "../../data/ids/stop-gtfs-id-mapping.js";
2
+ import type { StopTimeUpdateJson, TripUpdateJson, UpdatedTimeJson } from "../../data/raw/realtime-data-json.js";
3
+ import type { GtfsScheduleData } from "../../data/gtfs-schedule-data.js";
4
+ import type { GtfsScheduledTrip } from "../../data/trip/scheduled/gtfs-scheduled-trip.js";
5
+ import { GtfsUpdatedTrip } from "../../data/trip/updated/gtfs-updated-trip.js";
6
+ import type { GtfsUpdatedTripMovement } from "../../data/trip/updated/types.js";
7
+ import { type GtfsScheduledTripIdentificationError } from "./gtfs-scheduled-trip-identifier.js";
8
+ import { NecessaryFieldNotInStopTimeUpdateEntryError, NoStopTimeUpdateFieldGivenError, StopTimeUpdateEntryReferencesUnmappedStopIdError, UnsupportedStopTimeUpdateEntryScheduleRelationshipError } from "./gtfs-trip-update-parser-common-error-types.js";
9
+ export type GtfsUpdatedTripUpdateParserFields = {
10
+ readonly timezone: string;
11
+ readonly stopGtfsIdMapping: StopGtfsIdMapping;
12
+ readonly onError: (error: GtfsUpdatedTripUpdateParsingError) => void;
13
+ };
14
+ export declare class GtfsUpdatedTripUpdateParser {
15
+ private readonly _timezone;
16
+ private readonly _stopGtfsIdMapping;
17
+ private readonly _onError;
18
+ private readonly _tripIdentifier;
19
+ private readonly _movementsInterpolator;
20
+ constructor(fields: GtfsUpdatedTripUpdateParserFields);
21
+ parse(tripUpdate: TripUpdateJson, scheduleData: GtfsScheduleData): GtfsUpdatedTrip | null;
22
+ private _parseUpdatedTime;
23
+ }
24
+ export type GtfsUpdatedTripUpdateParsingError = GtfsScheduledTripIdentificationError | NoStopTimeUpdateFieldGivenError | UnsupportedStopTimeUpdateEntryScheduleRelationshipError | NecessaryFieldNotInStopTimeUpdateEntryError | StopTimeUpdateEntryReferencesNonExistentStopSequenceError | MultipleStopTimeUpdateEntriesForSameMovementIndexError | StopTimeUpdateEntryReferencesUnmappedStopIdError | StopTimeUpdateEntryChangesStopError | NeitherTimeNorDelayGivenError | TimeAndDelayDisagreeWithEachOtherError | NeitherArrivalNorDepartureGivenError | KnownDepartureTimesEntailTimeTravelError;
25
+ export declare class StopTimeUpdateEntryReferencesNonExistentStopSequenceError {
26
+ readonly tripUpdate: TripUpdateJson;
27
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
28
+ readonly matchedTrip: GtfsScheduledTrip;
29
+ readonly type = "stop-time-update-entry-references-non-existent-stop-sequence";
30
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson, matchedTrip: GtfsScheduledTrip);
31
+ }
32
+ export declare class MultipleStopTimeUpdateEntriesForSameMovementIndexError {
33
+ readonly tripUpdate: TripUpdateJson;
34
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
35
+ readonly matchedTrip: GtfsScheduledTrip;
36
+ readonly matchedMovementIndex: number;
37
+ readonly type = "multiple-stop-time-update-entries-for-same-movement-index";
38
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson, matchedTrip: GtfsScheduledTrip, matchedMovementIndex: number);
39
+ }
40
+ export declare class StopTimeUpdateEntryChangesStopError {
41
+ readonly tripUpdate: TripUpdateJson;
42
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
43
+ readonly matchedTrip: GtfsScheduledTrip;
44
+ readonly matchedMovementIndex: number;
45
+ readonly type = "stop-time-update-entry-changes-stop";
46
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson, matchedTrip: GtfsScheduledTrip, matchedMovementIndex: number);
47
+ }
48
+ export declare class NeitherTimeNorDelayGivenError {
49
+ readonly tripUpdate: TripUpdateJson;
50
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
51
+ readonly updatedTime: UpdatedTimeJson;
52
+ readonly type = "neither-time-nor-delay-given";
53
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson, updatedTime: UpdatedTimeJson);
54
+ }
55
+ export declare class TimeAndDelayDisagreeWithEachOtherError {
56
+ readonly tripUpdate: TripUpdateJson;
57
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
58
+ readonly updatedTime: UpdatedTimeJson;
59
+ readonly parsedFromTime: Temporal.Instant;
60
+ readonly parsedFromDelay: Temporal.Instant;
61
+ readonly type = "time-and-delay-disagree-with-each-other";
62
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson, updatedTime: UpdatedTimeJson, parsedFromTime: Temporal.Instant, parsedFromDelay: Temporal.Instant);
63
+ }
64
+ export declare class NeitherArrivalNorDepartureGivenError {
65
+ readonly tripUpdate: TripUpdateJson;
66
+ readonly stopTimeUpdateEntry: StopTimeUpdateJson;
67
+ readonly type = "neither-arrival-nor-departure-given";
68
+ constructor(tripUpdate: TripUpdateJson, stopTimeUpdateEntry: StopTimeUpdateJson);
69
+ }
70
+ declare class KnownDepartureTimesEntailTimeTravelError {
71
+ readonly tripUpdate: TripUpdateJson;
72
+ readonly movements: readonly GtfsUpdatedTripMovement[];
73
+ readonly type = "known-departure-times-entail-time-travel";
74
+ constructor(tripUpdate: TripUpdateJson, movements: readonly GtfsUpdatedTripMovement[]);
75
+ }
76
+ export {};