Compare commits

..

No commits in common. "14b80dbf33d5a47ae0ca6527ea2004ff82239fd3" and "9975a6c9accb67f0902a1aadcd218b853bc1bfab" have entirely different histories.

4 changed files with 1528 additions and 573 deletions

2082
package-lock.json generated

File diff suppressed because it is too large Load diff

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.6.2", "version": "6.6.1",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"files": [ "files": [
@ -60,7 +60,7 @@
"dependencies": { "dependencies": {
"content-type": "^1.0.5", "content-type": "^1.0.5",
"cross-fetch": "^4.1.0", "cross-fetch": "^4.1.0",
"db-hafas-stations": "^1.1.0", "db-hafas-stations": "^1.0.0",
"gps-distance": "0.0.4", "gps-distance": "0.0.4",
"https-proxy-agent": "^7.0.6", "https-proxy-agent": "^7.0.6",
"luxon": "^3.5.0", "luxon": "^3.5.0",

View file

@ -7,7 +7,7 @@ const ADDRESS = 'ADR';
const leadingZeros = /^0+/; const leadingZeros = /^0+/;
const parseLocation = (ctx, l) => { const parseLocation = (ctx, l) => {
const {profile} = ctx; const {profile, common} = ctx;
if (!l) { if (!l) {
return null; return null;
@ -53,6 +53,16 @@ const parseLocation = (ctx, l) => {
return stop; return stop;
} }
if (name && common?.locations?.[name] && res.id === null) {
delete res.type;
delete res.id;
return {
...common.locations[name],
...res,
};
}
res.name = name; res.name = name;
res = profile.enrichStation(ctx, res); res = profile.enrichStation(ctx, res);
@ -77,7 +87,6 @@ const enrichStation = (ctx, stop, locations) => {
...rich, ...rich,
...stop, ...stop,
}; };
delete stop.lines;
} }
return stop; return stop;
}; };

View file

@ -26,7 +26,7 @@ Depending on the configured profile, db-vendo-client will use multiple different
| | `db` Profile | `dbnav` Profile | `dbweb` Profile | | `db` Profile | `dbnav` Profile | `dbweb` Profile
| ------------- | ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- | ------------- |
| no API key required | ✅ | ✅ | ✅ | | no API key required | ✅ | ✅ | ✅ |
| duration for boards | up to 12h | always 1h | always 1h | | max duration boards | 12h | 1h | 1h |
| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys | | remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys |
| cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag | | cancelled trips | contained with cancelled flag in journeys, not contained in boards | 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 |