From 883eb8c8deaf4854dbaa687485afc926562d768f Mon Sep 17 00:00:00 2001 From: Traines Date: Fri, 21 Mar 2025 21:13:20 +0000 Subject: [PATCH] refactor --- lib/default-profile.js | 14 +++++--------- p/db/index.js | 2 ++ p/dbregioguide/index.js | 16 ++++++++++++++++ {format => p/dbregioguide}/station-board-req.js | 0 p/dbris/index.js | 3 +-- p/dbweb/index.js | 6 +++++- {format => p/dbweb}/nearby-req.js | 0 {format => p/dbweb}/trip-req.js | 0 8 files changed, 29 insertions(+), 12 deletions(-) rename {format => p/dbregioguide}/station-board-req.js (100%) rename {format => p/dbweb}/nearby-req.js (100%) rename {format => p/dbweb}/trip-req.js (100%) diff --git a/lib/default-profile.js b/lib/default-profile.js index cc8ff089..31a2e491 100644 --- a/lib/default-profile.js +++ b/lib/default-profile.js @@ -2,10 +2,6 @@ import {request} from '../lib/request.js'; import {products} from '../lib/products.js'; import {ageGroup, ageGroupFromAge, ageGroupLabel} from './age-group.js'; -import {formatStationBoardReq} from '../format/station-board-req.js'; -import {formatTripReq} from '../format/trip-req.js'; -import {formatNearbyReq} from '../format/nearby-req.js'; - import {parseDateTime} from '../parse/date-time.js'; import {parsePlatform} from '../parse/platform.js'; import {parseProducts} from '../parse/products.js'; @@ -61,13 +57,13 @@ const defaultProfile = { logRequest, logResponse, - formatStationBoardReq, - formatLocationsReq: notImplemented, - formatStopReq: notImplemented, - formatTripReq, - formatNearbyReq, formatJourneysReq: notImplemented, formatRefreshJourneyReq: notImplemented, + formatTripReq: notImplemented, + formatNearbyReq: notImplemented, + formatLocationsReq: notImplemented, + formatStopReq: notImplemented, + formatStationBoardReq: notImplemented, transformJourneysQuery: id, parseDateTime, diff --git a/p/db/index.js b/p/db/index.js index 5f672fc3..9bdb30d4 100644 --- a/p/db/index.js +++ b/p/db/index.js @@ -30,6 +30,7 @@ const tripEndpoint_dbnav = dbnavBase.tripEndpoint; const tripEndpoint_dbregioguide = dbregioguideBase.tripEndpoint; // arrivals(), departures() +import {formatStationBoardReq} from '../dbregioguide/station-board-req.js'; const {boardEndpoint} = dbregioguideBase; const profile = { @@ -56,6 +57,7 @@ const profile = { formatTripReq, tripEndpoint_dbnav, tripEndpoint_dbregioguide, + formatStationBoardReq, boardEndpoint, }; diff --git a/p/dbregioguide/index.js b/p/dbregioguide/index.js index 3bf479cb..c1409d29 100644 --- a/p/dbregioguide/index.js +++ b/p/dbregioguide/index.js @@ -1,6 +1,7 @@ import baseProfile from './base.json' with { type: 'json' }; import {products} from '../../lib/products.js'; import {formatTripReq} from './trip-req.js'; +import {formatStationBoardReq} from './station-board-req.js'; const profile = { ...baseProfile, @@ -9,6 +10,21 @@ const profile = { products, formatTripReq, + formatStationBoardReq, + + journeysOutFrwd: false, + departuresGetPasslist: false, + departuresStbFltrEquiv: true, + trip: false, + radar: false, + refreshJourney: false, + journeysFromTrip: false, + refreshJourneyUseOutReconL: false, + tripsByName: false, + remarks: false, + remarksGetPolyline: false, + reachableFrom: false, + lines: false, }; export { diff --git a/format/station-board-req.js b/p/dbregioguide/station-board-req.js similarity index 100% rename from format/station-board-req.js rename to p/dbregioguide/station-board-req.js diff --git a/p/dbris/index.js b/p/dbris/index.js index 937a231f..b5764dde 100644 --- a/p/dbris/index.js +++ b/p/dbris/index.js @@ -9,10 +9,9 @@ const profile = { products, - formatStationBoardReq, - journeysOutFrwd: true, + journeysOutFrwd: false, departuresGetPasslist: true, departuresStbFltrEquiv: true, trip: false, diff --git a/p/dbweb/index.js b/p/dbweb/index.js index 7a2cf0e3..5581b38c 100644 --- a/p/dbweb/index.js +++ b/p/dbweb/index.js @@ -4,6 +4,8 @@ import {formatJourneysReq, formatRefreshJourneyReq} from './journeys-req.js'; import {formatLocationFilter} from './location-filter.js'; import {formatLocationsReq} from './locations-req.js'; import {formatStationBoardReq} from './station-board-req.js'; +import {formatTripReq} from './trip-req.js'; +import {formatNearbyReq} from './nearby-req.js'; const profile = { ...baseProfile, @@ -14,9 +16,11 @@ const profile = { formatJourneysReq, formatRefreshJourneyReq, + formatTripReq, + formatNearbyReq, formatLocationsReq, - formatLocationFilter, formatStationBoardReq, + formatLocationFilter, departuresGetPasslist: true, }; diff --git a/format/nearby-req.js b/p/dbweb/nearby-req.js similarity index 100% rename from format/nearby-req.js rename to p/dbweb/nearby-req.js diff --git a/format/trip-req.js b/p/dbweb/trip-req.js similarity index 100% rename from format/trip-req.js rename to p/dbweb/trip-req.js