@transportme/load-ptv-gtfs 1.4.10 → 1.4.12

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.
@@ -57,7 +57,7 @@ export default class GTFSRoute {
57
57
  */
58
58
  static create(data, mode) {
59
59
  let { routeGTFSID } = data
60
- let routeTypes = [ RailGTFSRoute, NewGTFSRoute, SmartrakGTFSRoute, MTMRailRoute, GTFSRoute ]
60
+ let routeTypes = [ RailGTFSRoute, NewGTFSRoute, SmartrakGTFSRoute, GTFSRoute ]
61
61
  for (let type of routeTypes) {
62
62
  if (type.canProcess(routeGTFSID, mode)) return new type(data)
63
63
  }
@@ -121,22 +121,4 @@ class RailGTFSRoute extends NewGTFSRoute {
121
121
  return super.canProcess(routeGTFSID, mode) && (mode === TRANSIT_MODES.metroTrain || mode === TRANSIT_MODES.regionalTrain)
122
122
  }
123
123
 
124
- }
125
-
126
- class MTMRailRoute extends GTFSRoute {
127
-
128
- constructor(data) {
129
- super(data)
130
- this.routeName = 'Rail Replacement Bus'
131
- this.routeNumber = null
132
- }
133
-
134
- static canProcess(routeGTFSID, mode) {
135
- return !routeGTFSID.match(/^\d+-\w{1,3}/) && mode === 'metro train'
136
- }
137
-
138
- parseRouteID(routeGTFSID) {
139
- return '2-RRB'
140
- }
141
-
142
124
  }
@@ -50,7 +50,7 @@ export default class GTFSTrip {
50
50
  * @returns {GTFSTrip} A trip instance representing the data being passed in
51
51
  */
52
52
  static create(data, mode) {
53
- let types = [ SmartrakTrip, MetroTrip, MTMRailTrip, GTFSTrip ]
53
+ let types = [ SmartrakTrip, MetroTrip, GTFSTrip ]
54
54
  for (let type of types) {
55
55
  if (type.canProcess(data, mode)) return new type(data)
56
56
  }
@@ -183,38 +183,4 @@ export class MetroTrip extends GTFSTrip {
183
183
  return this.#runID
184
184
  }
185
185
 
186
- }
187
-
188
- export class MetroRRBTrip extends MetroTrip {
189
-
190
- constructor(data) {
191
- super(data)
192
- }
193
-
194
- static canProcess(data, mode) {
195
- return super.canProcess(data, mode) && data.id.match(/^02-\w{3}-R-/)
196
- }
197
-
198
- }
199
-
200
- export class MTMRailTrip extends GTFSTrip {
201
-
202
- constructor(data) {
203
- if (data.headsign && data.headsign.length === 6 && data.headsign.match(/[A-Z]{3}\d{3}/)) {
204
- data.block = data.headsign
205
- }
206
-
207
- super(data)
208
- }
209
-
210
- static canProcess(data, mode) {
211
- return mode === TRANSIT_MODES.metroTrain && data.routeGTFSID === '2-RRB'
212
- }
213
-
214
- getTripData() {
215
- return {
216
- ...super.getTripData(),
217
- isRailReplacementBus: true
218
- }
219
- }
220
186
  }
@@ -35,5 +35,5 @@ export default class GTFSRouteReader extends GTFSReader {
35
35
  }
36
36
 
37
37
  return GTFSRoute.create(routeData, this.getMode())
38
- }
38
+ }
39
39
  }
@@ -247,13 +247,20 @@ export default class TripLoader {
247
247
  await this.writeTrips()
248
248
  }
249
249
 
250
- async writeTrips() {
251
- if (this.#tripsToLoad.length) {
252
- this.#routeCache = {}
253
- this.#stopCache = {}
250
+ getTripsToLoad() {
251
+ return this.#tripsToLoad
252
+ }
254
253
 
254
+ clearTripsToLoad() {
255
+ this.#routeCache = {}
256
+ this.#stopCache = {}
257
+ this.#tripsToLoad = []
258
+ }
259
+
260
+ async writeTrips() {
261
+ if (this.getTripsToLoad().length) {
255
262
  await this.#trips.createDocuments(this.#tripsToLoad)
256
- this.#tripsToLoad = []
263
+ this.clearTripsToLoad()
257
264
  }
258
265
  }
259
266
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {