diff --git a/cspell.config.json b/cspell.config.json index fb6e073f..f0875b69 100644 --- a/cspell.config.json +++ b/cspell.config.json @@ -634,7 +634,9 @@ "dbbahnhof", "Deutschlandticket", "fahrverguenstigungen", - "cancelation" + "cancelation", + "MOTIS", + "motis" ], "ignorePaths": [ "docs/dumps/**", diff --git a/p/db/index.js b/p/db/index.js index 9bdb30d4..8673b075 100644 --- a/p/db/index.js +++ b/p/db/index.js @@ -26,12 +26,11 @@ const {nearbyEndpoint} = dbnavBase; // trip() import {formatTripReq} from './trip-req.js'; -const tripEndpoint_dbnav = dbnavBase.tripEndpoint; -const tripEndpoint_dbregioguide = dbregioguideBase.tripEndpoint; +const {tripEndpoint} = dbnavBase; // arrivals(), departures() -import {formatStationBoardReq} from '../dbregioguide/station-board-req.js'; -const {boardEndpoint} = dbregioguideBase; +import {formatStationBoardReq} from '../dbnav/station-board-req.js'; +const {boardEndpoint} = dbnavBase; const profile = { locale: 'de-DE', @@ -55,7 +54,7 @@ const profile = { nearbyEndpoint, formatTripReq, - tripEndpoint_dbnav, tripEndpoint_dbregioguide, + tripEndpoint, formatStationBoardReq, boardEndpoint, diff --git a/p/db/trip-req.js b/p/db/trip-req.js index 3cc2f5a4..e8b6c663 100644 --- a/p/db/trip-req.js +++ b/p/db/trip-req.js @@ -1,16 +1,9 @@ import {formatTripReq as hafasFormatTripReq} from '../dbnav/trip-req.js'; -import {formatTripReq as risTripReq} from '../dbregioguide/trip-req.js'; - const formatTripReq = ({profile, opt}, id) => { const _profile = {...profile}; - if (id.includes('#')) { - _profile['tripEndpoint'] = profile.tripEndpoint_dbnav; - return hafasFormatTripReq({profile: _profile, opt}, id); - } - - _profile['tripEndpoint'] = profile.tripEndpoint_dbregioguide; - return risTripReq({profile: _profile, opt}, id); + _profile['tripEndpoint'] = profile.tripEndpoint; + return hafasFormatTripReq({profile: _profile, opt}, id); }; export { diff --git a/p/dbregioguide/index.js b/p/dbregioguide/index.js index c1409d29..b39505ab 100644 --- a/p/dbregioguide/index.js +++ b/p/dbregioguide/index.js @@ -15,7 +15,7 @@ const profile = { journeysOutFrwd: false, departuresGetPasslist: false, departuresStbFltrEquiv: true, - trip: false, + trip: true, radar: false, refreshJourney: false, journeysFromTrip: false, diff --git a/package-lock.json b/package-lock.json index cee4984a..47d49487 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "db-vendo-client", - "version": "6.9.0", + "version": "6.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "db-vendo-client", - "version": "6.9.0", + "version": "6.10.0", "license": "ISC", "dependencies": { "content-type": "^1.0.5", diff --git a/package.json b/package.json index 51ae19d1..d0008a68 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "db-vendo-client", "description": "Client for bahn.de public transport APIs.", - "version": "6.9.0", + "version": "6.10.0", "type": "module", "main": "index.js", "files": [ diff --git a/readme.md b/readme.md index 7c2a6e69..f18dec24 100644 --- a/readme.md +++ b/readme.md @@ -27,21 +27,21 @@ Depending on the configured profile, db-vendo-client will use multiple different | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | | no API key required | ✅ | ✅ | ✅ | ✅ | ❌ | | all above endpoints supported | ✅ | ✅ | except `stop()` | only boards | only boards | -| duration for boards | up to 12h | always 1h | always 1h | up to 6h, only from current time | up to 12h | -| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys | most remarks | all remarks | -| cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | +| duration for boards | always 1h | always 1h | always 1h | up to 6h, only from current time | up to 12h | +| remarks | for boards only most important remarks | for boards only most important remarks | all remarks on boards and journeys | most remarks | all remarks | +| cancelled trips | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | | tickets | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | ❌ | ❌ | -| polylines | only for `refreshJourney()` (mutually exclusive with tickets) and for `trip()` (only for HAFAS trip ids) | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | ❌ | ❌ | -| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | HAFAS trip ids | RIS trip ids | RIS trip ids | -| line.id/fahrtNr used | actual fahrtNr | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | unreliable/route id | ✅ | -| adminCode/operator | ✅ | only for journeys | only operator | only adminCode | ✅ | +| polylines | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | ❌ | ❌ | +| trip ids used | HAFAS trip ids | HAFAS trip ids | HAFAS trip ids | RIS trip ids | RIS trip ids | +| line.id/fahrtNr used | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | unreliable/route id | ✅ | +| adminCode/operator | only for journeys | only for journeys | only operator | only adminCode | ✅ | | stopovers | not in boards | not in boards | ✅ | some | ✅ | | assumed backend API stability | less stable | more stable | less stable | less stable | more stable | -| quotas | 60 requests per minute for journeys, unknown for boards (IPv4) | 60 requests per minute (IPv4) | aggressive blocking (IPv4/IPv6) | ? | depends on API key | +| quotas | 60 requests per minute (IPv4) | 60 requests per minute (IPv4) | aggressive blocking (IPv4/IPv6) | ? | depends on API key | > [!IMPORTANT] -> If you think that for your project, quotas may become an issue, [consider alternative ways to obtain the data you need.](https://github.com/derhuerst/db-rest/blob/6/docs/readme.md#why-not-to-use-this-api). +> If you think that for your project, quotas may become an issue, [consider alternative ways to obtain the data you need.](https://github.com/derhuerst/db-rest/blob/6/docs/readme.md#why-not-to-use-this-api), e.g. [motis-fptf-client](https://github.com/motis-project/motis-fptf-client) (a drop-in replacement for db-vendo-client/hafas-client) in conjunction with https://transitous.org or a self-hosted [MOTIS](https://github.com/motis-project/motis) instance. Feel free to report anything that you stumble upon via Issues or create a PR :) @@ -92,6 +92,7 @@ There are [community-maintained TypeScript typings available as `@types/hafas-cl - [hafas-client](https://github.com/public-transport/hafas-client/) – including further related projects - [hafas-rest-api](https://github.com/public-transport/hafas-rest-api/) – expose a hafas-client or db-vendo-client instance as a REST API - [db-rest](https://github.com/derhuerst/db-rest/) – for the legacy DB HAFAS endpoint +- [motis-fptf-client](https://github.com/motis-project/motis-fptf-client) – a drop-in replacement for db-vendo-client/hafas-client wrapping a [MOTIS](https://github.com/motis-project/motis) instance - [`*.transport.rest`](https://transport.rest/) – Public APIs wrapping some HAFAS endpoints. ## Contributing diff --git a/test/format/db-trip.js b/test/format/db-trip.js index e220c04a..6480d87b 100644 --- a/test/format/db-trip.js +++ b/test/format/db-trip.js @@ -38,10 +38,10 @@ tap.test('db trip(): dynamic request formatting', (t) => { const reqDbNav = profile.formatTripReq(ctx, tripIdHafas); delete reqDbNav.headers['X-Correlation-ID']; - const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis); + //const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis); t.same(reqDbNav, reqDbNavExpected); - t.same(reqDbRegioGuide, reqDbRegioGuideExpected); + //t.same(reqDbRegioGuide, reqDbRegioGuideExpected); t.end(); });