Compare commits

..

2 commits
v6.9.0 ... main

Author SHA1 Message Date
Traines
b2d9a4e53e linting
Some checks failed
test / lint-and-spellcheck (push) Has been cancelled
test / unit-tests (18.x) (push) Has been cancelled
test / unit-tests (20.x) (push) Has been cancelled
test / unit-tests (22.x) (push) Has been cancelled
test / integration-tests (18.x) (push) Has been cancelled
test / integration-tests (20.x) (push) Has been cancelled
test / integration-tests (22.x) (push) Has been cancelled
test / e2e-tests (18.x) (push) Has been cancelled
2025-08-25 20:18:26 +00:00
Traines
8e9d6ea67a switch db profile to db nav for boards (regioguide deprecation) 2025-08-25 19:55:25 +00:00
8 changed files with 25 additions and 31 deletions

View file

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

View file

@ -1,5 +1,4 @@
import dbnavBase from '../dbnav/base.json' with { type: 'json' };
import dbregioguideBase from '../dbregioguide/base.json' with { type: 'json' };
import {products} from '../../lib/products.js';
// journeys()
@ -26,12 +25,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 +53,7 @@ const profile = {
nearbyEndpoint,
formatTripReq,
tripEndpoint_dbnav, tripEndpoint_dbregioguide,
tripEndpoint,
formatStationBoardReq,
boardEndpoint,

View file

@ -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 {

View file

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

4
package-lock.json generated
View file

@ -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",

View file

@ -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": [

View file

@ -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

View file

@ -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();
});