mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
add todos & comments
This commit is contained in:
parent
dd5e436892
commit
a7cb71c870
8 changed files with 23 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
const formatStopReq = (ctx, stopRef) => {
|
||||
return {
|
||||
// todo: there's also `StationDetails`, are there differences?
|
||||
meth: 'LocDetails',
|
||||
req: {
|
||||
locL: [stopRef]
|
||||
|
|
4
index.js
4
index.js
|
@ -342,7 +342,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
|||
|
||||
const query = {
|
||||
// https://github.com/marudor/BahnhofsAbfahrten/blob/49ebf8b36576547112e61a6273bee770f0769660/packages/types/HAFAS/SearchOnTrip.ts#L16-L30
|
||||
// todo: support search by `journey.refreshToken` (a.k.a. `ctxRecon`)?
|
||||
// todo: support search by `journey.refreshToken` (a.k.a. `ctxRecon`) via `sotMode: RC`?
|
||||
sotMode: 'JI', // seach by trip ID (a.k.a. "JID")
|
||||
jid: fromTripId,
|
||||
locData: { // when & where the trip has been entered
|
||||
|
@ -465,6 +465,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
|||
.then(({common, res}) => {
|
||||
if (!Array.isArray(res.locL)) return []
|
||||
|
||||
// todo: parse `.dur` – walking duration?
|
||||
const ctx = {profile, opt, common, res}
|
||||
const results = res.locL.map(loc => profile.parseNearby(ctx, loc))
|
||||
return Number.isInteger(opt.results) ? results.slice(0, opt.results) : results
|
||||
|
@ -569,6 +570,7 @@ const createClient = (profile, userAgent, opt = {}) => {
|
|||
meth: 'JourneyMatch',
|
||||
req,
|
||||
})
|
||||
// todo [breaking]: catch `NO_MATCH` errors, return []
|
||||
.then(({res, common}) => {
|
||||
const ctx = {profile, opt, common, res}
|
||||
return res.jnyL.map(t => profile.parseTrip(ctx, t))
|
||||
|
|
|
@ -103,6 +103,7 @@ const defaultProfile = {
|
|||
filters,
|
||||
|
||||
journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
|
||||
// todo: https://github.com/KDE/kpublictransport/commit/c7c54304160d8f22eab0c91812a107aca82304b7
|
||||
departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field?
|
||||
departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field?
|
||||
trip: false,
|
||||
|
@ -112,6 +113,7 @@ const defaultProfile = {
|
|||
refreshJourneyUseOutReconL: false,
|
||||
tripsByName: true,
|
||||
remarks: true,
|
||||
// `remarks()` method: support for `getPolyline` field?
|
||||
remarksGetPolyline: true, // `remarks()` method: support for `getPolyline` field?
|
||||
lines: true,
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ const SERVER_ERROR = 'SERVER_ERROR'
|
|||
// https://gist.github.com/derhuerst/79d49c0f04c1c192a5d15756e5af575f/edit
|
||||
// todo:
|
||||
// `code: 'METHOD_NA', message: 'HCI Service: service method disabled'`
|
||||
// "err": "PARAMETER", "errTxt": "HCI Service: parameter invalid"
|
||||
const byErrorCode = Object.assign(Object.create(null), {
|
||||
H_UNKNOWN: {
|
||||
isServer: false,
|
||||
|
|
|
@ -169,6 +169,17 @@ const transformJourneysQuery = ({opt}, query) => {
|
|||
return query
|
||||
}
|
||||
|
||||
// todo: fix this
|
||||
// line: {
|
||||
// type: 'line',
|
||||
// id: '5-vbbbvb-x9',
|
||||
// fahrtNr: '52496',
|
||||
// name: 'X9',
|
||||
// public: true,
|
||||
// mode: 'bus',
|
||||
// product: 'bus',
|
||||
// operator: {type: 'operator', id: 'nahreisezug', name: 'Nahreisezug'}
|
||||
// }
|
||||
const parseLineWithAdditionalName = ({parsed}, l) => {
|
||||
if (l.nameS && ['bus', 'tram', 'ferry'].includes(l.product)) {
|
||||
parsed.name = l.nameS
|
||||
|
|
|
@ -25,6 +25,7 @@ const linkTypesByCode = Object.assign(Object.create(null), {
|
|||
// ]
|
||||
// todo: https://github.com/public-transport/hafas-client/issues/5
|
||||
// todo: expose h.type somehow
|
||||
// todo: https://github.com/KDE/kpublictransport/blob/39ac8f9586b9300fa8a9ba0dec010e96fab9ab08/src/lib/backends/hafasmgateparser.cpp#L56-L72
|
||||
const parseHint = (ctx, h) => {
|
||||
// todo: C
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ const parseTrip = (ctx, t) => { // t = raw trip
|
|||
const trip = profile.parseJourneyLeg(ctx, fakeLeg, date)
|
||||
trip.id = trip.tripId
|
||||
delete trip.tripId
|
||||
// todo [breaking]: delete trip.reachable
|
||||
|
||||
return trip
|
||||
}
|
||||
|
|
|
@ -123,9 +123,9 @@ tap.test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
|
|||
tap.skip('journeys: via works – with detour', async (t) => {
|
||||
// Going from Stephansplatz to Schottenring via Donauinsel without detour
|
||||
// is currently impossible. We check if the routing engine computes a detour.
|
||||
const stephansplatz = '1390167'
|
||||
const schottenring = '1390163'
|
||||
const donauinsel = '1392277'
|
||||
const stephansplatz = '1390167' // todo: does not exist anymore?
|
||||
const schottenring = '1390163' // todo: does not exist anymore?
|
||||
const donauinsel = '1392277' // todo: does not exist anymore?
|
||||
const donauinselPassed = '922001'
|
||||
const res = await client.journeys(stephansplatz, schottenring, {
|
||||
via: donauinsel,
|
||||
|
|
Loading…
Add table
Reference in a new issue