db-vendo-client
Advanced tools
Comparing version 6.3.0 to 6.3.1
@@ -37,3 +37,3 @@ import {createClient} from './index.js'; | ||
homepage: 'https://github.com/public-transport/db-vendo-client', | ||
version: '6.3.0', | ||
version: '6', | ||
docsLink: 'https://github.com/public-transport/db-vendo-client', | ||
@@ -40,0 +40,0 @@ openapiSpec: true, |
@@ -325,3 +325,3 @@ import isObj from 'lodash/isObject.js'; | ||
const trip = profile.parseTrip(ctx, res); | ||
const trip = profile.parseTrip(ctx, res, id); | ||
@@ -328,0 +328,0 @@ return { |
@@ -6,3 +6,3 @@ import {inspect} from 'util' | ||
// Pick a descriptive user agent! hafas-client won't work with this string. | ||
const client = createClient(dbProfile, 'hafas-client-example') | ||
const client = createClient(dbProfile, 'hafas-client-example', {enrichStations: true}) | ||
@@ -9,0 +9,0 @@ const berlinJungfernheide = '8011167' |
{ | ||
"name": "db-vendo-client", | ||
"description": "Client for bahn.de public transport APIs.", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -5,8 +5,8 @@ import slugg from 'slugg'; | ||
const profile = ctx.profile; | ||
const fahrtNr = p.verkehrsmittel?.nummer || p.transport?.number || p.train?.no || p.verkehrsmittelNummer || ((p.mitteltext || '') + ' ').split(' ')[1]; | ||
const fahrtNr = p.verkehrsmittel?.nummer || p.transport?.number || p.train?.no || ((p.risZuglaufId || '') + '_').split('_')[1] || p.verkehrsmittelNummer || ((p.mitteltext || '') + ' ').split(' ')[1] || ((p.zugName || '') + ' ').split(' ')[1]; | ||
const res = { | ||
type: 'line', | ||
id: slugg(p.verkehrsmittel?.langText || p.transport?.journeyDescription || p.train && p.train.category + ' ' + p.train.lineName + ' ' + p.train.no || p.langtext || p.mitteltext), // TODO terrible | ||
id: slugg(p.verkehrsmittel?.langText || p.transport?.journeyDescription || p.risZuglaufId || p.train && p.train.category + ' ' + p.train.lineName + ' ' + p.train.no || p.langtext || p.mitteltext || p.zugName), // TODO terrible | ||
fahrtNr: String(fahrtNr), | ||
name: p.verkehrsmittel?.langText || p.verkehrsmittel?.name || p.zugName || p.transport?.journeyDescription || p.train && p.train.category + ' ' + p.train.lineName || p.langtext || p.mitteltext, | ||
name: p.verkehrsmittel?.langText || p.verkehrsmittel?.name || p.zugName || p.transport && p.transport.category + ' ' + p.transport.line || p.train && p.train.category + ' ' + p.train.lineName || p.mitteltext || p.langtext, | ||
public: true, | ||
@@ -13,0 +13,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
const parseTrip = (ctx, t) => { // t = raw trip | ||
const parseTrip = (ctx, t, id) => { // t = raw trip | ||
const {profile} = ctx; | ||
@@ -6,3 +6,3 @@ | ||
const trip = profile.parseJourneyLeg(ctx, t); | ||
trip.id = trip.tripId; // TODO journeyId | ||
trip.id = trip.tripId || id; // TODO journeyId | ||
delete trip.tripId; | ||
@@ -9,0 +9,0 @@ delete trip.reachable; |
@@ -34,4 +34,4 @@ # db-vendo-client | ||
| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | | ||
| line.id/fahrtNr used | unreliable/route id for journeys, actual fahrtNr for boards | unreliable/route id | | ||
| adminCode/operator | adminCode only for boards | only for `journeys()` | | ||
| line.id/fahrtNr used | unreliable/route id for journeys/`trip()`, actual fahrtNr for boards | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | | ||
| adminCode/operator | adminCode only for boards | only for journeys | | ||
| `stop()` | ❌ | ✅ | | ||
@@ -38,0 +38,0 @@ | assumed backend API stability | less stable | more stable | |
2037530