switch db profile to db nav for boards (regioguide deprecation)

This commit is contained in:
Traines 2025-08-25 19:55:25 +00:00
parent d15369406d
commit 8e9d6ea67a
8 changed files with 25 additions and 30 deletions

View file

@ -634,7 +634,9 @@
"dbbahnhof", "dbbahnhof",
"Deutschlandticket", "Deutschlandticket",
"fahrverguenstigungen", "fahrverguenstigungen",
"cancelation" "cancelation",
"MOTIS",
"motis"
], ],
"ignorePaths": [ "ignorePaths": [
"docs/dumps/**", "docs/dumps/**",

View file

@ -26,12 +26,11 @@ const {nearbyEndpoint} = dbnavBase;
// trip() // trip()
import {formatTripReq} from './trip-req.js'; import {formatTripReq} from './trip-req.js';
const tripEndpoint_dbnav = dbnavBase.tripEndpoint; const {tripEndpoint} = dbnavBase;
const tripEndpoint_dbregioguide = dbregioguideBase.tripEndpoint;
// arrivals(), departures() // arrivals(), departures()
import {formatStationBoardReq} from '../dbregioguide/station-board-req.js'; import {formatStationBoardReq} from '../dbnav/station-board-req.js';
const {boardEndpoint} = dbregioguideBase; const {boardEndpoint} = dbnavBase;
const profile = { const profile = {
locale: 'de-DE', locale: 'de-DE',
@ -55,7 +54,7 @@ const profile = {
nearbyEndpoint, nearbyEndpoint,
formatTripReq, formatTripReq,
tripEndpoint_dbnav, tripEndpoint_dbregioguide, tripEndpoint,
formatStationBoardReq, formatStationBoardReq,
boardEndpoint, boardEndpoint,

View file

@ -1,16 +1,9 @@
import {formatTripReq as hafasFormatTripReq} from '../dbnav/trip-req.js'; import {formatTripReq as hafasFormatTripReq} from '../dbnav/trip-req.js';
import {formatTripReq as risTripReq} from '../dbregioguide/trip-req.js';
const formatTripReq = ({profile, opt}, id) => { const formatTripReq = ({profile, opt}, id) => {
const _profile = {...profile}; const _profile = {...profile};
if (id.includes('#')) { _profile['tripEndpoint'] = profile.tripEndpoint;
_profile['tripEndpoint'] = profile.tripEndpoint_dbnav;
return hafasFormatTripReq({profile: _profile, opt}, id); return hafasFormatTripReq({profile: _profile, opt}, id);
}
_profile['tripEndpoint'] = profile.tripEndpoint_dbregioguide;
return risTripReq({profile: _profile, opt}, id);
}; };
export { export {

View file

@ -15,7 +15,7 @@ const profile = {
journeysOutFrwd: false, journeysOutFrwd: false,
departuresGetPasslist: false, departuresGetPasslist: false,
departuresStbFltrEquiv: true, departuresStbFltrEquiv: true,
trip: false, trip: true,
radar: false, radar: false,
refreshJourney: false, refreshJourney: false,
journeysFromTrip: false, journeysFromTrip: false,

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "db-vendo-client", "name": "db-vendo-client",
"version": "6.9.0", "version": "6.10.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "db-vendo-client", "name": "db-vendo-client",
"version": "6.9.0", "version": "6.10.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"content-type": "^1.0.5", "content-type": "^1.0.5",

View file

@ -1,7 +1,7 @@
{ {
"name": "db-vendo-client", "name": "db-vendo-client",
"description": "Client for bahn.de public transport APIs.", "description": "Client for bahn.de public transport APIs.",
"version": "6.9.0", "version": "6.10.0",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"files": [ "files": [

View file

@ -27,21 +27,21 @@ Depending on the configured profile, db-vendo-client will use multiple different
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
| no API key required | ✅ | ✅ | ✅ | ✅ | ❌ | | no API key required | ✅ | ✅ | ✅ | ✅ | ❌ |
| all above endpoints supported | ✅ | ✅ | except `stop()` | only boards | only boards | | 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 | | duration for boards | always 1h | 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 | | 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 in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | | 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 | ❌ | ❌ | | 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 | ❌ | ❌ | | 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 for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | HAFAS trip ids | RIS trip ids | RIS trip ids | | trip ids used | HAFAS trip ids | 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 | ✅ | | 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 operator | only adminCode | ✅ | | adminCode/operator | only for journeys | only for journeys | only operator | only adminCode | ✅ |
| stopovers | not in boards | not in boards | ✅ | some | ✅ | | stopovers | not in boards | not in boards | ✅ | some | ✅ |
| assumed backend API stability | less stable | more stable | less stable | less stable | more stable | | 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] > [!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 :) 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-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 - [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 - [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. - [`*.transport.rest`](https://transport.rest/)  Public APIs wrapping some HAFAS endpoints.
## Contributing ## Contributing

View file

@ -38,10 +38,10 @@ tap.test('db trip(): dynamic request formatting', (t) => {
const reqDbNav = profile.formatTripReq(ctx, tripIdHafas); const reqDbNav = profile.formatTripReq(ctx, tripIdHafas);
delete reqDbNav.headers['X-Correlation-ID']; delete reqDbNav.headers['X-Correlation-ID'];
const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis); //const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis);
t.same(reqDbNav, reqDbNavExpected); t.same(reqDbNav, reqDbNavExpected);
t.same(reqDbRegioGuide, reqDbRegioGuideExpected); //t.same(reqDbRegioGuide, reqDbRegioGuideExpected);
t.end(); t.end();
}); });