diff --git a/docs/changelog.md b/docs/changelog.md index 95b0e004..a15661a2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -18,6 +18,7 @@ This version is not fully backwords-compatible. Check out [the migration guide]( - 3e672ee `journeys()`/`journeyLeg()`: `stopover.station` → `stopover.stop` 💥 - 021ae45: `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms - 85e0bdf `journeys()`: `startWithWalking` option with default `true` ✨ +- 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId` 💥 ## `2.7.0` diff --git a/docs/departures.md b/docs/departures.md index 25953889..7277255c 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -34,7 +34,7 @@ With `opt`, you can override the default options, which look like this: *Note:* As stated in the [*Friendly Public Transport Format* `1.0.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.0.1), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule. -You may pass the `journeyId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey. +You may pass the `tripId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey. As an example, we're going to use the [VBB profile](../p/vbb): @@ -54,7 +54,7 @@ The response may look like this: ```js [ { - journeyId: '1|31431|28|86|17122017', + tripId: '1|31431|28|86|17122017', trip: 31431, station: { type: 'station', @@ -98,7 +98,7 @@ The response may look like this: }, direction: 'S Spandau' }, { - journeyId: '1|30977|8|86|17122017', + tripId: '1|30977|8|86|17122017', trip: 30977, station: { /* … */ }, when: null, @@ -121,7 +121,7 @@ The response may look like this: }, direction: 'S Westkreuz' }, { - journeyId: '1|28671|4|86|17122017', + tripId: '1|28671|4|86|17122017', trip: 28671, station: { type: 'station', diff --git a/parse/departure.js b/parse/departure.js index 26173e00..7835767a 100644 --- a/parse/departure.js +++ b/parse/departure.js @@ -14,7 +14,7 @@ const createParseDeparture = (profile, opt, data) => { const parseDeparture = (d) => { const when = profile.parseDateTime(profile, d.date, d.stbStop.dTimeR || d.stbStop.dTimeS) const res = { - journeyId: d.jid, + tripId: d.jid, station: locations[parseInt(d.stbStop.locX)] || null, when: when.toISO(), direction: profile.parseStationName(d.dirTxt), diff --git a/parse/hint.js b/parse/hint.js index 40b69d4a..03f7d277 100644 --- a/parse/hint.js +++ b/parse/hint.js @@ -151,7 +151,7 @@ const parseHint = (profile, h) => { type: 'status', code: 'alternative-trip', text, - journeyId: h.jid + tripId: h.jid } } if (h.type === 'A') { diff --git a/parse/movement.js b/parse/movement.js index 49012026..81166d1d 100644 --- a/parse/movement.js +++ b/parse/movement.js @@ -14,7 +14,7 @@ const createParseMovement = (profile, opt, data) => { const res = { direction: profile.parseStationName(m.dirTxt), - journeyId: m.jid || null, + tripId: m.jid || null, trip: m.jid && +m.jid.split('|')[1] || null, // todo: this seems brittle line: lines[m.prodX] || null, location: m.pos ? { diff --git a/test/lib/validators.js b/test/lib/validators.js index b3c5bd5d..4a7c9bbb 100644 --- a/test/lib/validators.js +++ b/test/lib/validators.js @@ -231,8 +231,8 @@ const createValidateDeparture = (cfg) => { a.ok(isObj(dep), name + ' must be an object') // todo: let hafas-client add a .type field - a.strictEqual(typeof dep.journeyId, 'string', name + '.journeyId must be a string') - a.ok(dep.journeyId, name + '.journeyId must not be empty') + a.strictEqual(typeof dep.tripId, 'string', name + '.tripId must be a string') + a.ok(dep.tripId, name + '.tripId must not be empty') a.strictEqual(typeof dep.trip, 'number', name + '.trip must be a number') val.station(val, dep.station, name + '.station')