remove SBB profile 💥

closes #246
This commit is contained in:
Jannis R 2021-08-24 00:41:33 +02:00
parent c2a228a73a
commit 1e8b5982a2
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
10 changed files with 0 additions and 7567 deletions

View file

@ -9,7 +9,6 @@ There are built-in profiles for these public transportation networks:
HAFAS endpoint | wrapper library | docs | example code | profile name HAFAS endpoint | wrapper library | docs | example code | profile name
-|-|-|-|- -|-|-|-|-
[Deutsche Bahn (DB)](https://en.wikipedia.org/wiki/Deutsche_Bahn) | [`db-hafas`](https://github.com/public-transport/db-hafas) | [docs](db/readme.md) | [example](db/example.js) | [`db`](db) [Deutsche Bahn (DB)](https://en.wikipedia.org/wiki/Deutsche_Bahn) | [`db-hafas`](https://github.com/public-transport/db-hafas) | [docs](db/readme.md) | [example](db/example.js) | [`db`](db)
[Swiss Railways (SBB)](https://en.wikipedia.org/wiki/Swiss_Federal_Railways) | - | [docs](sbb/readme.md) | [example](sbb/example.js) | [`sbb`](sbb)
[Polskie Koleje Państwowe (PKP)](https://en.wikipedia.org/wiki/Polish_State_Railways) | [`pkp-hafas`](https://github.com/juliuste/pkp-hafas) | [docs](pkp/readme.md) | [example](pkp/example.js) | [`pkp`](pkp) [Polskie Koleje Państwowe (PKP)](https://en.wikipedia.org/wiki/Polish_State_Railways) | [`pkp-hafas`](https://github.com/juliuste/pkp-hafas) | [docs](pkp/readme.md) | [example](pkp/example.js) | [`pkp`](pkp)
[Belgian National Railways (SNCB/NMBS)](https://en.wikipedia.org/wiki/National_Railway_Company_of_Belgium) | - | [docs](sncb/readme.md) | [example](sncb/example.js) | [`sncb`](sncb) [Belgian National Railways (SNCB/NMBS)](https://en.wikipedia.org/wiki/National_Railway_Company_of_Belgium) | - | [docs](sncb/readme.md) | [example](sncb/example.js) | [`sncb`](sncb)
[*Iarnród Éireann* (Irish Rail)](https://en.wikipedia.org/wiki/Iarnród_Éireann) | - | [docs](irish-rail/readme.md) | [example](irish-rail/example.js) | [`irish-rail`](irish-rail) [*Iarnród Éireann* (Irish Rail)](https://en.wikipedia.org/wiki/Iarnród_Éireann) | - | [docs](irish-rail/readme.md) | [example](irish-rail/example.js) | [`irish-rail`](irish-rail)

View file

@ -1,14 +0,0 @@
{
"auth": {
"type": "AID",
"aid": "hf7mcf9bv3nv8g5f"
},
"client": {
"type": "AND",
"id": "DBZUGRADARNETZ",
"v": ""
},
"endpoint": "http://fahrplan.sbb.ch/bin/mgate.exe",
"ver": "1.44",
"defaultLanguage": "de"
}

View file

@ -1,53 +0,0 @@
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile} from './index.js'
const client = createClient(profile, 'hafas-client-example')
const zurich1 = '8530813' // Zürich Kreuzplatz
const zurich2 = '8503000' // Zürich HB
const basel1 = '8500073' // Basel Aeschenplatz
const basel2 = '8500010' // Basel SBB
const baden1 = '8590197'
const baden2 = '8590173'
const locBaden = { type: 'location', latitude: 47.476, longitude: 8.30613 }
// client.journeys(zurich1, basel1, { results: 1 })
// client.journeys(zurich2, basel2, { results: 1 })
client.journeys(baden1, baden2, { results: 1 })
// .then(({journeys}) => {
// const leg = journeys[0].legs[0]
// return client.trip(leg.tripId, {polyline: true})
// })
// .then(({journeys}) => {
// return client.refreshJourney(journeys[0].refreshToken, {remarks: true})
// })
// client.departures(zurich2, {duration: 1})
// client.arrivals(zurich2, {duration: 10, linesOfStops: true})
// client.locations('Basel', { results: 2 })
// client.locations('Luzern', { poi: true, stops: false })
// client.stop(basel2)
// client.nearby(locBaden, { distance: 100 })
// client.radar({
// north: 47.5,
// west: 8.2,
// south: 47.3,
// east: 8.5,
// }, { results: 10 })
// client.reachableFrom({
// type: 'location',
// id: '980023031',
// latitude: 47.052417,
// longitude: 8.304487,
// name: 'Luzern, Adlun',
// poi: true
// }, {
// maxDuration: 20
// })
.then((data) => {
console.log(inspect(data, {depth: null, colors: true}))
})
.catch(console.error)

View file

@ -1,27 +0,0 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
import {createRequire} from 'module'
const require = createRequire(import.meta.url)
const baseProfile = require('./base.json')
import {products} from './products.js'
const profile = {
...baseProfile,
locale: 'de-CH',
timezone: 'Europe/Zurich',
products: products,
refreshJourneyUseOutReconL: true,
trip: true,
radar: true,
reachableFrom: true,
}
const withLocale = (locale) => ({...profile, locale})
export {
profile,
withLocale,
}

View file

@ -1,87 +0,0 @@
const products = [
{
id: 'express-train',
mode: 'train',
bitmasks: [1],
name: 'ICE/EN/CNL/ES/RJ/TGV/THA',
short: 'ICE/TGV/RJ',
default: true,
},
{
id: 'international-train',
mode: 'train',
bitmasks: [2],
name: 'EC/IC/ICN/OEC',
short: 'EC/IC',
default: true,
},
{
id: 'interregional-train',
mode: 'train',
bitmasks: [4],
name: 'IR/PE',
short: 'IR',
default: true,
},
{
id: 'regional-express-train',
mode: 'train',
bitmasks: [8],
name: 'RE/D',
short: 'RE',
default: true,
},
{
id: 'watercraft',
mode: 'watercraft',
bitmasks: [16],
name: 'Schiff/Fähre/Dampfschiff',
short: 'Schiff',
default: true,
},
{
id: 'suburban-train',
mode: 'train',
bitmasks: [32],
name: 'S/SN/R/TER/RB',
short: 'S',
default: true,
},
{
id: 'bus-taxi',
mode: 'bus',
bitmasks: [64],
name: 'Bus/Taxi',
short: 'Bus',
default: true,
},
{
id: 'gondola',
mode: 'gondola',
// e.g. `FUN 13` ("Gurtenbahn") at Gurten Kulm (ID `8507099`)
bitmasks: [128],
name: 'Standseilbahn/Gondelbahn/Luftseilbahn/Sesselbahn',
short: 'Seilbahn/Zahnradbahn',
default: true,
},
{
id: 'car-train',
mode: 'train',
bitmasks: [256], // todo: correct?
name: 'Autoreisezug/Extrazug',
short: 'ARZ/EXT',
default: true,
},
{
id: 'tram',
mode: 'train',
bitmasks: [512],
name: 'Tram/Metro',
short: 'Tram/Metro',
default: true,
},
]
export {
products,
}

View file

@ -1,23 +0,0 @@
# SBB profile for `hafas-client`
[*Schweizerische Bundesbahnen (SBB)*](https://en.wikipedia.org/wiki/Swiss_Federal_Railways) is the largest Swiss long-distance public transport company. This profile adds *SBB*-specific customizations to `hafas-client`.
## Usage
```js
import {createClient} from 'hafas-client'
import {sbbProfile} from 'hafas-client/p/sbb/index.js'
// create a client with SBB profile
const client = createClient(sbbProfile, 'my-awesome-program')
```
By default, the `de_CH` locale is being used. You can customize it using `withLocale()`:
```js
// create a client with SBB profile and fr_CH locale
const client = createClient(sbbProfile.withLocale('fr_CH'), 'my-awesome-program')
```
## Customisations

View file

@ -1,686 +0,0 @@
const baselSBB = {
type: 'stop',
id: '8500010',
name: 'Basel SBB',
location: {
type: 'location',
id: '8500010',
latitude: 47.547408,
longitude: 7.589548
},
products: {
'express-train': true,
'international-train': true,
'interregional-train': true,
'regional-express-train': true,
watercraft: false,
'suburban-train': true,
'bus-taxi': true,
gondola: false,
'car-train': true,
tram: true,
},
}
const biel = {
type: 'stop',
id: '8504300',
name: 'Biel/Bienne',
location: {
type: 'location',
id: '8504300',
latitude: 47.132889,
longitude: 7.242906
},
products: {
'express-train': false,
'international-train': true,
'interregional-train': true,
'regional-express-train': true,
watercraft: true,
'suburban-train': true,
'bus-taxi': true,
gondola: false,
'car-train': true,
tram: false,
},
}
const bern = {
type: 'stop',
id: '8507000',
name: 'Bern',
location: {
type: 'location',
id: '8507000',
latitude: 46.948825,
longitude: 7.439122
},
products: {
'express-train': true,
'international-train': true,
'interregional-train': true,
'regional-express-train': true,
watercraft: false,
'suburban-train': true,
'bus-taxi': true,
gondola: true,
'car-train': true,
tram: true,
},
}
const lausanne = {
type: 'stop',
id: '8501120',
name: 'Lausanne',
location: {
type: 'location',
id: '8501120',
latitude: 46.516777,
longitude: 6.629095
},
products: {
'express-train': true,
'international-train': true,
'interregional-train': true,
'regional-express-train': true,
watercraft: false,
'suburban-train': true,
'bus-taxi': true,
gondola: false,
'car-train': true,
tram: true,
},
}
const yverdonLesBains = {
type: 'stop',
id: '8504200',
name: 'Yverdon-les-Bains',
location: {
type: 'location',
id: '8504200',
latitude: 46.781878,
longitude: 6.641141
},
products: {
'express-train': false,
'international-train': true,
'interregional-train': true,
'regional-express-train': true,
watercraft: true,
'suburban-train': true,
'bus-taxi': true,
gondola: false,
'car-train': false,
tram: false,
},
}
const sbbJourneys = [{
type: 'journey',
legs: [{
origin: baselSBB,
destination: biel,
departure: '2020-12-14T10:03:00+01:00',
plannedDeparture: '2020-12-14T10:03:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T11:10:00+01:00',
plannedArrival: '2020-12-14T11:10:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|33571|3|95|14122020',
line: {
type: 'line',
id: '1-000011-51',
fahrtNr: '1616',
name: 'IC 51',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Biel/Bienne',
arrivalPlatform: '4',
plannedArrivalPlatform: '4',
departurePlatform: '14',
plannedDeparturePlatform: '14',
cycle: {min: 3600, max: 3600, nr: 3},
}, {
origin: biel,
destination: yverdonLesBains,
departure: '2020-12-14T11:16:00+01:00',
plannedDeparture: '2020-12-14T11:16:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T11:52:00+01:00',
plannedArrival: '2020-12-14T11:52:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|155150|2|95|14122020',
line: {
type: 'line',
id: '1-000011-5',
fahrtNr: '516',
name: 'IC 5',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Genève-Aéroport',
arrivalPlatform: '2',
plannedArrivalPlatform: '2',
departurePlatform: '5',
plannedDeparturePlatform: '5',
cycle: {min: 1740, max: 1860, nr: 5},
}, {
origin: yverdonLesBains,
destination: lausanne,
departure: '2020-12-14T11:57:00+01:00',
plannedDeparture: '2020-12-14T11:57:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T12:27:00+01:00',
plannedArrival: '2020-12-14T12:27:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|70708|0|95|14122020',
line: {
type: 'line',
id: '5-000011-5',
fahrtNr: '24539',
name: 'S 5',
public: true,
adminCode: '000011',
productName: 'S',
mode: 'train',
product: 'suburban-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Aigle',
arrivalPlatform: '1',
plannedArrivalPlatform: '1',
departurePlatform: '2',
plannedDeparturePlatform: '2',
cycle: {min: 1740, max: 1860, nr: 5},
}],
refreshToken: '¶HKI¶T$A=1@O=Basel SBB@X=7589566@Y=47547408@L=8500010@a=128@$A=1@O=Biel/Bienne@X=7242906@Y=47132898@L=8504300@a=128@$202012141003$202012141110$IC 51 $$1$$$$§T$A=1@O=Biel/Bienne@X=7242906@Y=47132898@L=8504300@a=128@$A=1@O=Yverdon-les-Bains@X=6640943@Y=46781545@L=8504200@a=128@$202012141116$202012141152$IC 5 $$1$$$$§T$A=1@O=Yverdon-les-Bains@X=6640943@Y=46781545@L=8504200@a=128@$A=1@O=Lausanne@X=6629095@Y=46516795@L=8501120@a=128@$202012141157$202012141227$S 5 $$1$$$$',
cycle: {min: 3600},
remarks: [
{type: 'hint', code: 'cap1st_11', text: '1.'},
{type: 'hint', code: 'cap2nd_11', text: '2.'}]
}, {
type: 'journey',
legs: [{
origin: baselSBB,
destination: bern,
departure: '2020-12-14T10:28:00+01:00',
plannedDeparture: '2020-12-14T10:28:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T11:26:00+01:00',
plannedArrival: '2020-12-14T11:26:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|5522|0|95|14122020',
line: {
type: 'line',
id: '1-000011-6',
fahrtNr: '1067',
name: 'IC 6',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Domodossola (I)',
arrivalPlatform: '6',
plannedArrivalPlatform: '6',
departurePlatform: '10',
plannedDeparturePlatform: '10',
cycle: {min: 1800, max: 3600, nr: 4},
alternatives: [{
tripId: '1|259027|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '967',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|5612|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '1069',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|168184|0|95|14122020',
line: {
type: 'line',
id: 'ec-57',
fahrtNr: '57',
name: 'EC 57',
public: true,
adminCode: '000011',
productName: 'EC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Brig',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|259357|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '971',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}]
}, {
origin: bern,
destination: lausanne,
departure: '2020-12-14T11:34:00+01:00',
plannedDeparture: '2020-12-14T11:34:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T12:40:00+01:00',
plannedArrival: '2020-12-14T12:40:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|201862|0|95|14122020',
line: {
type: 'line',
id: '1-000011-1',
fahrtNr: '714',
name: 'IC 1',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Genève-Aéroport',
arrivalPlatform: '5',
plannedArrivalPlatform: '5',
departurePlatform: '5',
plannedDeparturePlatform: '5',
cycle: {min: 3600, max: 3600, nr: 3},
}],
refreshToken: '¶HKI¶T$A=1@O=Basel SBB@X=7589566@Y=47547408@L=8500010@a=128@$A=1@O=Bern@X=7439131@Y=46948834@L=8507000@a=128@$202012141028$202012141126$IC 6 $$1$$$$§T$A=1@O=Bern@X=7439131@Y=46948834@L=8507000@a=128@$A=1@O=Lausanne@X=6629095@Y=46516795@L=8501120@a=128@$202012141134$202012141240$IC 1 $$1$$$$',
cycle: {min: 3600},
remarks: [
{type: 'hint', code: 'cap1st_11', text: '1.'},
{type: 'hint', code: 'cap2nd_11', text: '2.'}]
}, {
type: 'journey',
legs: [{
origin: baselSBB,
destination: bern,
departure: '2020-12-14T10:58:00+01:00',
plannedDeparture: '2020-12-14T10:58:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T11:56:00+01:00',
plannedArrival: '2020-12-14T11:56:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|259027|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '967',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
arrivalPlatform: '4',
plannedArrivalPlatform: '4',
departurePlatform: '7',
plannedDeparturePlatform: '7',
cycle: {min: 1800, max: 3600, nr: 4},
alternatives: [{
tripId: '1|5612|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '1069',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|168184|0|95|14122020',
line: {
type: 'line',
id: 'ec-57',
fahrtNr: '57',
name: 'EC 57',
public: true,
adminCode: '000011',
productName: 'EC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Brig',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|259357|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '971',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}, {
tripId: '1|5887|0|95|14122020',
line: {
type: 'line',
id: '1-000011-61',
fahrtNr: '1073',
name: 'IC 61',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Interlaken Ost',
when: null,
plannedWhen: null,
delay: null,
}]
}, {
origin: bern,
destination: lausanne,
departure: '2020-12-14T12:04:00+01:00',
plannedDeparture: '2020-12-14T12:04:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T13:16:00+01:00',
plannedArrival: '2020-12-14T13:16:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|73704|0|95|14122020',
line: {
type: 'line',
id: '2-000011-15',
fahrtNr: '2518',
name: 'IR 15',
public: true,
adminCode: '000011',
productName: 'IR',
mode: 'train',
product: 'interregional-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Genève-Aéroport',
arrivalPlatform: '6',
plannedArrivalPlatform: '6',
departurePlatform: '3',
plannedDeparturePlatform: '3',
cycle: {min: 3600, max: 3600, nr: 3},
}],
refreshToken: '¶HKI¶T$A=1@O=Basel SBB@X=7589566@Y=47547408@L=8500010@a=128@$A=1@O=Bern@X=7439131@Y=46948834@L=8507000@a=128@$202012141058$202012141156$IC 61 $$1$$$$§T$A=1@O=Bern@X=7439131@Y=46948834@L=8507000@a=128@$A=1@O=Lausanne@X=6629095@Y=46516795@L=8501120@a=128@$202012141204$202012141316$IR 15 $$1$$$$',
cycle: {min: 3600},
remarks: [
{type: 'hint', code: 'cap1st_11', text: '1.'},
{type: 'hint', code: 'cap2nd_11', text: '2.'}]
}, {
type: 'journey',
legs: [{
origin: baselSBB,
destination: biel,
departure: '2020-12-14T11:03:00+01:00',
plannedDeparture: '2020-12-14T11:03:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T12:10:00+01:00',
plannedArrival: '2020-12-14T12:10:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|33571|4|95|14122020',
line: {
type: 'line',
id: '1-000011-51',
fahrtNr: '1618',
name: 'IC 51',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Biel/Bienne',
arrivalPlatform: '4',
plannedArrivalPlatform: '4',
departurePlatform: '14',
plannedDeparturePlatform: '14',
cycle: {min: 3600, max: 3600, nr: 3},
}, {
origin: biel,
destination: yverdonLesBains,
departure: '2020-12-14T12:16:00+01:00',
plannedDeparture: '2020-12-14T12:16:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T12:52:00+01:00',
plannedArrival: '2020-12-14T12:52:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|156563|0|95|14122020',
line: {
type: 'line',
id: '1-000011-5',
fahrtNr: '518',
name: 'IC 5',
public: true,
adminCode: '000011',
productName: 'IC',
mode: 'train',
product: 'international-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Genève-Aéroport',
arrivalPlatform: '2',
plannedArrivalPlatform: '2',
departurePlatform: '5',
plannedDeparturePlatform: '5',
cycle: {min: 1740, max: 1860, nr: 5},
}, {
origin: yverdonLesBains,
destination: lausanne,
departure: '2020-12-14T12:57:00+01:00',
plannedDeparture: '2020-12-14T12:57:00+01:00',
departureDelay: null,
departurePrognosisType: 'prognosed',
arrival: '2020-12-14T13:27:00+01:00',
plannedArrival: '2020-12-14T13:27:00+01:00',
arrivalDelay: null,
arrivalPrognosisType: 'prognosed',
reachable: true,
tripId: '1|70657|2|95|14122020',
line: {
type: 'line',
id: '5-000011-5',
fahrtNr: '24545',
name: 'S 5',
public: true,
adminCode: '000011',
productName: 'S',
mode: 'train',
product: 'suburban-train',
operator: {
type: 'operator',
id: 'schweizerische-bundesbahnen-sbb',
name: 'Schweizerische Bundesbahnen SBB'
},
},
direction: 'Aigle',
arrivalPlatform: '1',
plannedArrivalPlatform: '1',
departurePlatform: '2',
plannedDeparturePlatform: '2',
cycle: {min: 1740, max: 1860, nr: 5},
}],
refreshToken: '¶HKI¶T$A=1@O=Basel SBB@X=7589566@Y=47547408@L=8500010@a=128@$A=1@O=Biel/Bienne@X=7242906@Y=47132898@L=8504300@a=128@$202012141103$202012141210$IC 51 $$1$$$$§T$A=1@O=Biel/Bienne@X=7242906@Y=47132898@L=8504300@a=128@$A=1@O=Yverdon-les-Bains@X=6640943@Y=46781545@L=8504200@a=128@$202012141216$202012141252$IC 5 $$1$$$$§T$A=1@O=Yverdon-les-Bains@X=6640943@Y=46781545@L=8504200@a=128@$A=1@O=Lausanne@X=6629095@Y=46516795@L=8501120@a=128@$202012141257$202012141327$S 5 $$1$$$$',
cycle: {min: 3600},
remarks: [
{type: 'hint', code: 'cap1st_11', text: '1.'},
{type: 'hint', code: 'cap2nd_11', text: '2.'},
],
}]
export {
sbbJourneys,
}

File diff suppressed because it is too large Load diff

View file

@ -1,43 +0,0 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
import {createRequire} from 'module'
const require = createRequire(import.meta.url)
import tap from 'tap'
import {createClient} from '../index.js'
import {profile as rawProfile} from '../p/sbb/index.js'
const res = require('./fixtures/sbb-journeys.json')
import {sbbJourneys as expected} from './fixtures/sbb-journeys.js'
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
const {profile} = client
const opt = {
results: null,
via: null,
stopovers: false,
transfers: -1,
transferTime: 0,
accessibility: 'none',
bike: false,
walkingSpeed: 'normal',
startWithWalking: true,
tickets: false,
polylines: false,
subStops: true,
entrances: true,
remarks: true,
scheduledDays: false,
departure: '2020-12-07T13:29+01:00',
products: {},
}
tap.test('parses a journeys() response correctly (SBB)', (t) => {
const common = profile.parseCommon({profile, opt, res})
const ctx = {profile, opt, common, res}
const journeys = res.outConL.map(j => profile.parseJourney(ctx, j))
t.same(journeys, expected)
t.end()
})

View file

@ -50,7 +50,6 @@ node -p "$query" "$src/de/rmv-hafas-mgate.json" >../p/rmv/base.json
node -p "$query" "$src/de/rsag-hafas-mgate.json" >../p/rsag/base.json node -p "$query" "$src/de/rsag-hafas-mgate.json" >../p/rsag/base.json
node -p "$query" "$src/de/saarvv-hafas-mgate.json" >../p/saarfahrplan/base.json node -p "$query" "$src/de/saarvv-hafas-mgate.json" >../p/saarfahrplan/base.json
node -p "$query" "$src/de/db-sbahn-muenchen-hafas-mgate.json" >../p/sbahn-muenchen/base.json node -p "$query" "$src/de/db-sbahn-muenchen-hafas-mgate.json" >../p/sbahn-muenchen/base.json
node -p "$query" "$src/ch/sbb-cff-ffs-hafas-mgate.json" >../p/sbb/base.json
node -p "$query" "$src/be/nmbs-sncb-hafas-mgate.json" >../p/sncb/base.json node -p "$query" "$src/be/nmbs-sncb-hafas-mgate.json" >../p/sncb/base.json
node -p "$query" "$src/at/svv-hafas-mgate.json" >../p/svv/base.json node -p "$query" "$src/at/svv-hafas-mgate.json" >../p/svv/base.json
node -p "$query" "$src/de/vbb-hafas-mgate.json" >../p/vbb/base.json node -p "$query" "$src/de/vbb-hafas-mgate.json" >../p/vbb/base.json