mirror of
				https://github.com/public-transport/db-vendo-client.git
				synced 2025-11-04 01:56:33 +02:00 
			
		
		
		
	Compare commits
	
		
			11 commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							 | 
						785f5fcc37 | ||
| 
							 | 
						ca6ceabbed | ||
| 
							 | 
						d0120439e6 | ||
| 
							 | 
						c2216120c9 | ||
| 
							 | 
						bdbf4f3761 | ||
| 
							 | 
						a1ab95c249 | ||
| 
							 | 
						691f07b331 | ||
| 
							 | 
						13351e3977 | ||
| 
							 | 
						2f65f3d05d | ||
| 
							 | 
						f31f56c00d | ||
| 
							 | 
						31ef3ad56a | 
					 33 changed files with 6652 additions and 1451 deletions
				
			
		
							
								
								
									
										9
									
								
								.github/workflows/build.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/build.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -10,6 +10,9 @@ env:
 | 
			
		|||
  REGISTRY: ghcr.io
 | 
			
		||||
  IMAGE_NAME: ${{ github.repository }}
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  id-token: write # for OIDC-based publishing to npm
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-and-push-docker:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
| 
						 | 
				
			
			@ -53,7 +56,9 @@ jobs:
 | 
			
		|||
        with:
 | 
			
		||||
          node-version: '20.x'
 | 
			
		||||
          registry-url: 'https://registry.npmjs.org'
 | 
			
		||||
      # for OIDC-based publishing to npm
 | 
			
		||||
      - name: setup npm v11
 | 
			
		||||
        run: npm install -g npm@11
 | 
			
		||||
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - run: npm publish --provenance --access public
 | 
			
		||||
        env:
 | 
			
		||||
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}      
 | 
			
		||||
| 
						 | 
				
			
			@ -636,7 +636,8 @@
 | 
			
		|||
    "fahrverguenstigungen",
 | 
			
		||||
    "cancelation",
 | 
			
		||||
    "MOTIS",
 | 
			
		||||
    "motis"
 | 
			
		||||
    "motis",
 | 
			
		||||
    "Berechnung"
 | 
			
		||||
  ],
 | 
			
		||||
  "ignorePaths": [
 | 
			
		||||
    "docs/dumps/**",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ Notes:
 | 
			
		|||
* routing-search returns polylines (!)
 | 
			
		||||
 | 
			
		||||
## Vendo/Movas Navigator API
 | 
			
		||||
https://app.vendo.noncd.db.de/mob/
 | 
			
		||||
https://app.vendo.noncd.db.de/mob/ and/or https://app.services-bahn.de/
 | 
			
		||||
 | 
			
		||||
EPs:
 | 
			
		||||
* bahnhofstafel/abfahrt
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_17_55_08_routesearch.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_17_55_08_routesearch.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/angebote/fahrplan HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
X-Correlation-ID: 599238b3-d1e0-43a0-9534-ebc0dbf30b72_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: 48cce61a-1b80-4dc4-8818-50bbb38ef54d
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
Content-Length: 822
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"autonomeReservierung":false,"einstiegsTypList":["STANDARD"],"fahrverguenstigungen":{"deutschlandTicketVorhanden":true,"nurDeutschlandTicketVerbindungen":false},"klasse":"KLASSE_2","reiseHin":{"wunsch":{"abgangsLocationId":"A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@U\u003d80@L\u003d8000105@B\u003d1@p\u003d1760568530@i\u003dU×008011068@","alternativeHalteBerechnung":true,"verkehrsmittel":["ALL"],"zeitWunsch":{"reiseDatum":"2025-10-21T17:47:34.688151+02:00","zeitPunktArt":"ABFAHRT"},"zielLocationId":"A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@U\u003d80@L\u003d8011160@B\u003d1@p\u003d1760568530@i\u003dU×008065969@"}},"reisendenProfil":{"reisende":[{"ermaessigungen":["KEINE_ERMAESSIGUNG KLASSENLOS"],"reisendenTyp":"ERWACHSENER"}]},"reservierungsKontingenteVorhanden":false}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_17_55_26_routesearch.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_17_55_26_routesearch.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_17_58_35_deticket.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_17_58_35_deticket.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/angebote/fahrplan HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
X-Correlation-ID: 599238b3-d1e0-43a0-9534-ebc0dbf30b72_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: 1f809128-7b90-411d-8fc4-99a329bc3bf6
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
Content-Length: 821
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"autonomeReservierung":false,"einstiegsTypList":["STANDARD"],"fahrverguenstigungen":{"deutschlandTicketVorhanden":true,"nurDeutschlandTicketVerbindungen":true},"klasse":"KLASSE_2","reiseHin":{"wunsch":{"abgangsLocationId":"A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@U\u003d80@L\u003d8000105@B\u003d1@p\u003d1760568530@i\u003dU×008011068@","alternativeHalteBerechnung":true,"verkehrsmittel":["ALL"],"zeitWunsch":{"reiseDatum":"2025-10-21T17:47:34.688151+02:00","zeitPunktArt":"ABFAHRT"},"zielLocationId":"A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@U\u003d80@L\u003d8011160@B\u003d1@p\u003d1760568530@i\u003dU×008065969@"}},"reisendenProfil":{"reisende":[{"ermaessigungen":["KEINE_ERMAESSIGUNG KLASSENLOS"],"reisendenTyp":"ERWACHSENER"}]},"reservierungsKontingenteVorhanden":false}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_17_58_44_deticket.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_17_58_44_deticket.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_18_41_locsearch.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_18_41_locsearch.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/location/search HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.location.v3+json
 | 
			
		||||
X-Correlation-ID: 599238b3-d1e0-43a0-9534-ebc0dbf30b72_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: a0f760ec-0443-4209-b564-e714ea548a16
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.location.v3+json
 | 
			
		||||
Content-Length: 45
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"locationTypes":["ALL"],"searchTerm":"test"}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_18_54_locsearch.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_18_54_locsearch.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_19_55_board.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_19_55_board.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/bahnhofstafel/abfahrt HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.bahnhofstafeln.v2+json
 | 
			
		||||
X-Correlation-ID: 9c9405f1-4792-4ec0-ba1f-ca231a15ac36_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: a8b79643-ab22-472d-ab6e-40d5b888b078
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.bahnhofstafeln.v2+json
 | 
			
		||||
Content-Length: 401
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"anfragezeit":"17:47","datum":"2025-10-21","ursprungsBahnhofId":"A\u003d1@O\u003dTessin@X\u003d12462618@Y\u003d54032020@U\u003d81@L\u003d8013106@B\u003d1@p\u003d1760557009@i\u003dU×008027109@","verkehrsmittel":["HOCHGESCHWINDIGKEITSZUEGE","INTERCITYUNDEUROCITYZUEGE","INTERREGIOUNDSCHNELLZUEGE","NAHVERKEHRSONSTIGEZUEGE","SBAHNEN","BUSSE","SCHIFFE","UBAHN","STRASSENBAHN","ANRUFPFLICHTIGEVERKEHRE"]}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_20_05_board.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_20_05_board.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										15
									
								
								docs/dumps/PCAPdroid_21_Oct_18_20_53_zuglauf.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								docs/dumps/PCAPdroid_21_Oct_18_20_53_zuglauf.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
GET /mob/zuglauf/2%7C%23VN%231%23ST%231760568530%23PI%230%23ZI%23237216%23TA%230%23DA%23211025%231S%238013106%231T%231814%23LS%238010381%23LT%232015%23PU%2380%23RT%231%23CA%23RB%23ZE%2313134%23ZB%23RB%20%20%20%20%20%20%20%20%20%2013134%23PC%233%23FR%238013106%23FT%231814%23TO%238010381%23TT%232015%23 HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.zuglauf.v2+json
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.zuglauf.v2+json
 | 
			
		||||
X-Correlation-ID: 9c9405f1-4792-4ec0-ba1f-ca231a15ac36_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: 1a70c54c-b0a8-4d8a-a23b-d6da23a50423
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_21_01_zuglauf.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_21_01_zuglauf.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_03_reservierung.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_03_reservierung.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/angebote/recon/autonomereservierung HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
X-Correlation-ID: 232a47fb-0827-4e11-aa2e-d141c718f63f_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: 0b0fdc2d-be90-4e00-b5ed-33bf80fe2e23
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
Content-Length: 1862
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"einstiegsTypList":["STANDARD"],"klasse":"KLASSE_2","reisendenProfil":{"reisende":[{"ermaessigungen":["KEINE_ERMAESSIGUNG KLASSENLOS"],"reisendenTyp":"ERWACHSENER"}]},"reservierungsKontingenteVorhanden":false,"suchParameter":{"reisewunschHin":{"abgangsLocationId":"A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@U\u003d80@L\u003d8000105@i\u003dU×008011068@","alternativeHalteBerechnung":true,"verkehrsmittel":["ALL"],"zeitWunsch":{"reiseDatum":"2025-10-21T17:47:34.688151+02:00","zeitPunktArt":"ABFAHRT"},"zielLocationId":"A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@U\u003d80@L\u003d8011160@i\u003dU×008065969@"}},"verbindungHin":{"kontext":"¶HKI¶T$A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@L\u003d8000105@a\u003d128@$A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@L\u003d8011160@a\u003d128@$202510211802$202510212203$ICE          1032$$1$$$$$$¶KC¶#VE#2#CF#100#CA#0#CM#0#SICT#0#AM#81#AM2#0#RT#7#¶KCC¶I1ZFIzEjRVJHIzEjSElOIzAjRUNLIzQ1MDM2Mnw0NTAzNjJ8NDUwNjAzfDQ1MDYwM3wwfDB8NDg1fDQ1MDM0NHwxfDB8MTA1MHwwfDB8LTIxNDc0ODM2NDgjR0FNIzIxMTAyNTE4MDIjClojVk4jMSNTVCMxNzYwNTY4NTMwI1BJIzAjWkkjMjExNTc4I1RBIzAjREEjMjExMDI1IzFTIzgwMDAxMDUjMVQjMTgwMiNMUyM4MDEwMjU1I0xUIzIyMTUjUFUjODAjUlQjMSNDQSNJQ0UjWkUjMTAzMiNaQiNJQ0UgICAgICAgICAgMTAzMiNQQyMwI0ZSIzgwMDAxMDUjRlQjMTgwMiNUTyM4MDExMTYwI1RUIzIyMDMj¶KRCC¶#VE#1#¶SC¶1_H4sIAAAAAAACA32P4UrDMBSFX0XuL4U6knTJ0kKhdqWoTDfGJor4I67prHbtTFOxlD6HD+SLmbaKgiKBkHM493w3DbxIBS7gER+DBfJVGxEGo6twhIkxlHwGt4G82kXgUqt7BOAiC4pKh0JLkyaIUIwIht5cpbvOxJPxBCFjJX3DMbbgMa+jTKsZuLcN6HrfxRbLeWhCuyLu1Nnl1IgXkVV9BSI2tHf9UtOH7VBsyLHcz4rNUJOlsUmeeNife5ES+VNSKX14IdL86PQ+8a89zhjhtu3feBRhxBgn/trjyJ+ZCxmH+oEZ3nt4whBlnNrIT731+xtCHGEzwH2zUamHn0b9OkKpP/mBVFmaHwxcbNvMoWOnAxNzKHe+wRhjhv4BM+ow5zd4K3W4XIGrVSV7tSiy2iDlD+u8qFQu66Co8rgENxFZ+ZkVZZmlpf7Kyk2xEErsTKhp2/YDhSDWlQgCAAA\u003d"}}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_16_reservierung.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_16_reservierung.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_42_recon.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_42_recon.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
POST /mob/angebote/recon HTTP/1.1
 | 
			
		||||
Accept: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
X-Correlation-ID: 232a47fb-0827-4e11-aa2e-d141c718f63f_339465f1-2b99-4c6e-b739-c8ad0efed49a
 | 
			
		||||
X-Device-Os-Name: Android
 | 
			
		||||
X-Device-Os-Version: 32
 | 
			
		||||
X-Device-Model: Google Pixel 3a
 | 
			
		||||
X-App-Version: 25.18.2
 | 
			
		||||
User-Agent: DBNavigator/Android/25.18.2
 | 
			
		||||
Accept-Language: en,de
 | 
			
		||||
X-INSTANA-ANDROID: 746aa2dd-bc0c-450c-a444-f6036963caf9
 | 
			
		||||
Content-Type: application/x.db.vendo.mob.verbindungssuche.v9+json
 | 
			
		||||
Content-Length: 1962
 | 
			
		||||
Host: app.services-bahn.de
 | 
			
		||||
Connection: Keep-Alive
 | 
			
		||||
Accept-Encoding: gzip
 | 
			
		||||
 | 
			
		||||
{"einstiegsTypList":["STANDARD"],"fahrverguenstigungen":{"deutschlandTicketVorhanden":true,"nurDeutschlandTicketVerbindungen":false},"klasse":"KLASSE_2","reisendenProfil":{"reisende":[{"ermaessigungen":["KEINE_ERMAESSIGUNG KLASSENLOS"],"reisendenTyp":"ERWACHSENER"}]},"reservierungsKontingenteVorhanden":false,"suchParameter":{"reisewunschHin":{"abgangsLocationId":"A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@U\u003d80@L\u003d8000105@i\u003dU×008011068@","alternativeHalteBerechnung":true,"verkehrsmittel":["ALL"],"zeitWunsch":{"reiseDatum":"2025-10-21T17:47:34.688151+02:00","zeitPunktArt":"ABFAHRT"},"zielLocationId":"A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@U\u003d80@L\u003d8011160@i\u003dU×008065969@"}},"verbindungHin":{"kontext":"¶HKI¶T$A\u003d1@O\u003dFrankfurt(Main)Hbf@X\u003d8662833@Y\u003d50106682@L\u003d8000105@a\u003d128@$A\u003d1@O\u003dBerlin Hbf@X\u003d13369549@Y\u003d52525589@L\u003d8011160@a\u003d128@$202510211802$202510212203$ICE          1032$$1$$$$$$¶KC¶#VE#2#CF#100#CA#0#CM#0#SICT#0#AM#81#AM2#0#RT#7#¶KCC¶I1ZFIzEjRVJHIzEjSElOIzAjRUNLIzQ1MDM2Mnw0NTAzNjJ8NDUwNjAzfDQ1MDYwM3wwfDB8NDg1fDQ1MDM0NHwxfDB8MTA1MHwwfDB8LTIxNDc0ODM2NDgjR0FNIzIxMTAyNTE4MDIjClojVk4jMSNTVCMxNzYwNTY4NTMwI1BJIzAjWkkjMjExNTc4I1RBIzAjREEjMjExMDI1IzFTIzgwMDAxMDUjMVQjMTgwMiNMUyM4MDEwMjU1I0xUIzIyMTUjUFUjODAjUlQjMSNDQSNJQ0UjWkUjMTAzMiNaQiNJQ0UgICAgICAgICAgMTAzMiNQQyMwI0ZSIzgwMDAxMDUjRlQjMTgwMiNUTyM4MDExMTYwI1RUIzIyMDMj¶KRCC¶#VE#1#¶SC¶1_H4sIAAAAAAACA32P4UrDMBSFX0XuL4U6knTJ0kKhdqWoTDfGJor4I67prHbtTFOxlD6HD+SLmbaKgiKBkHM493w3DbxIBS7gER+DBfJVGxEGo6twhIkxlHwGt4G82kXgUqt7BOAiC4pKh0JLkyaIUIwIht5cpbvOxJPxBCFjJX3DMbbgMa+jTKsZuLcN6HrfxRbLeWhCuyLu1Nnl1IgXkVV9BSI2tHf9UtOH7VBsyLHcz4rNUJOlsUmeeNife5ES+VNSKX14IdL86PQ+8a89zhjhtu3feBRhxBgn/trjyJ+ZCxmH+oEZ3nt4whBlnNrIT731+xtCHGEzwH2zUamHn0b9OkKpP/mBVFmaHwxcbNvMoWOnAxNzKHe+wRhjhv4BM+ow5zd4K3W4XIGrVSV7tSiy2iDlD+u8qFQu66Co8rgENxFZ+ZkVZZmlpf7Kyk2xEErsTKhp2/YDhSDWlQgCAAA\u003d"}}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_50_recon.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_23_50_recon.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_24_19_routesearch_delay.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/dumps/PCAPdroid_21_Oct_18_24_19_routesearch_delay.txt
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								p/db/base.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								p/db/base.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
{
 | 
			
		||||
	"journeysEndpoint": "https://app.vendo.noncd.db.de/mob/angebote/fahrplan",
 | 
			
		||||
	"bestpriceEndpoint": "https://app.vendo.noncd.db.de/mob/angebote/tagesbestpreis",
 | 
			
		||||
	"refreshJourneysEndpointTickets": "https://app.vendo.noncd.db.de/mob/angebote/recon",
 | 
			
		||||
	"refreshJourneysEndpointPolyline": "https://app.vendo.noncd.db.de/mob/trip/recon",
 | 
			
		||||
	"locationsEndpoint": "https://app.vendo.noncd.db.de/mob/location/search",
 | 
			
		||||
	"stopEndpoint": "https://app.vendo.noncd.db.de/mob/location/details/",
 | 
			
		||||
	"nearbyEndpoint": "https://app.vendo.noncd.db.de/mob/location/nearby",
 | 
			
		||||
	"tripEndpoint": "https://app.vendo.noncd.db.de/mob/zuglauf/",
 | 
			
		||||
	"boardEndpoint": "https://app.vendo.noncd.db.de/mob/bahnhofstafel/",
 | 
			
		||||
	"defaultLanguage": "en"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,35 +1,36 @@
 | 
			
		|||
import dbnavBase from '../dbnav/base.json' with { type: 'json' };
 | 
			
		||||
import base from './base.json' with { type: 'json' };
 | 
			
		||||
import {products} from '../../lib/products.js';
 | 
			
		||||
 | 
			
		||||
// journeys()
 | 
			
		||||
import {formatJourneysReq} from '../dbnav/journeys-req.js';
 | 
			
		||||
const {journeysEndpoint} = dbnavBase;
 | 
			
		||||
const {journeysEndpoint} = base;
 | 
			
		||||
const {bestpriceEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
// refreshJourneys()
 | 
			
		||||
import {formatRefreshJourneyReq} from '../dbnav/journeys-req.js';
 | 
			
		||||
const {refreshJourneysEndpointTickets, refreshJourneysEndpointPolyline} = dbnavBase;
 | 
			
		||||
const {refreshJourneysEndpointTickets, refreshJourneysEndpointPolyline} = base;
 | 
			
		||||
 | 
			
		||||
// locations()
 | 
			
		||||
import {formatLocationsReq} from '../dbnav/locations-req.js';
 | 
			
		||||
import {formatLocationFilter} from '../dbnav/location-filter.js';
 | 
			
		||||
const {locationsEndpoint} = dbnavBase;
 | 
			
		||||
const {locationsEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
// stop()
 | 
			
		||||
import {formatStopReq} from '../dbnav/stop-req.js';
 | 
			
		||||
import {parseStop} from '../dbnav/parse-stop.js';
 | 
			
		||||
const {stopEndpoint} = dbnavBase;
 | 
			
		||||
const {stopEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
// nearby()
 | 
			
		||||
import {formatNearbyReq} from '../dbnav/nearby-req.js';
 | 
			
		||||
const {nearbyEndpoint} = dbnavBase;
 | 
			
		||||
const {nearbyEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
// trip()
 | 
			
		||||
import {formatTripReq} from './trip-req.js';
 | 
			
		||||
const {tripEndpoint} = dbnavBase;
 | 
			
		||||
const {tripEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
// arrivals(), departures()
 | 
			
		||||
import {formatStationBoardReq} from '../dbnav/station-board-req.js';
 | 
			
		||||
const {boardEndpoint} = dbnavBase;
 | 
			
		||||
const {boardEndpoint} = base;
 | 
			
		||||
 | 
			
		||||
const profile = {
 | 
			
		||||
	locale: 'de-DE',
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +40,7 @@ const profile = {
 | 
			
		|||
 | 
			
		||||
	formatJourneysReq,
 | 
			
		||||
	journeysEndpoint,
 | 
			
		||||
	bestpriceEndpoint,
 | 
			
		||||
 | 
			
		||||
	formatRefreshJourneyReq,
 | 
			
		||||
	refreshJourneysEndpointTickets, refreshJourneysEndpointPolyline,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
{
 | 
			
		||||
	"journeysEndpoint": "https://app.vendo.noncd.db.de/mob/angebote/fahrplan",
 | 
			
		||||
	"bestpriceEndpoint": "https://app.vendo.noncd.db.de/mob/angebote/tagesbestpreis",
 | 
			
		||||
	"refreshJourneysEndpointTickets": "https://app.vendo.noncd.db.de/mob/angebote/recon",
 | 
			
		||||
	"refreshJourneysEndpointPolyline": "https://app.vendo.noncd.db.de/mob/trip/recon",
 | 
			
		||||
	"locationsEndpoint": "https://app.vendo.noncd.db.de/mob/location/search",
 | 
			
		||||
	"stopEndpoint": "https://app.vendo.noncd.db.de/mob/location/details/",
 | 
			
		||||
	"nearbyEndpoint": "https://app.vendo.noncd.db.de/mob/location/nearby",
 | 
			
		||||
	"tripEndpoint": "https://app.vendo.noncd.db.de/mob/zuglauf/",
 | 
			
		||||
	"boardEndpoint": "https://app.vendo.noncd.db.de/mob/bahnhofstafel/",
 | 
			
		||||
	"journeysEndpoint": "https://app.services-bahn.de/mob/angebote/fahrplan",
 | 
			
		||||
	"bestpriceEndpoint": "https://app.services-bahn.de/mob/angebote/tagesbestpreis",
 | 
			
		||||
	"refreshJourneysEndpointTickets": "https://app.services-bahn.de/mob/angebote/recon",
 | 
			
		||||
	"refreshJourneysEndpointPolyline": "https://app.services-bahn.de/mob/trip/recon",
 | 
			
		||||
	"locationsEndpoint": "https://app.services-bahn.de/mob/location/search",
 | 
			
		||||
	"stopEndpoint": "https://app.services-bahn.de/mob/location/details/",
 | 
			
		||||
	"nearbyEndpoint": "https://app.services-bahn.de/mob/location/nearby",
 | 
			
		||||
	"tripEndpoint": "https://app.services-bahn.de/mob/zuglauf/",
 | 
			
		||||
	"boardEndpoint": "https://app.services-bahn.de/mob/bahnhofstafel/",
 | 
			
		||||
	"defaultLanguage": "en"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,7 @@ const formatJourneysReq = (ctx, from, to, when, outFrwd, journeysRef) => {
 | 
			
		|||
		wunsch: {
 | 
			
		||||
			abgangsLocationId: from.lid,
 | 
			
		||||
			verkehrsmittel: filters,
 | 
			
		||||
			alternativeHalteBerechnung: true, // what is this?
 | 
			
		||||
			zeitWunsch: {
 | 
			
		||||
				reiseDatum: profile.formatTime(profile, when, true),
 | 
			
		||||
				zeitPunktArt: outFrwd ? 'ABFAHRT' : 'ANKUNFT',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2900
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										2900
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
{
 | 
			
		||||
	"name": "db-vendo-client",
 | 
			
		||||
	"description": "Client for bahn.de public transport APIs.",
 | 
			
		||||
	"version": "6.10.2",
 | 
			
		||||
	"version": "6.10.5",
 | 
			
		||||
	"type": "module",
 | 
			
		||||
	"main": "index.js",
 | 
			
		||||
	"files": [
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@
 | 
			
		|||
		"test-e2e": "VCR_OFF=true tap -t60 -j16 test/e2e/*.js",
 | 
			
		||||
		"test-spelling": "cspell .",
 | 
			
		||||
		"test": "npm run test-unit && npm run test-integration && npm run test-spelling",
 | 
			
		||||
		"prepublishOnly": "npm run lint",
 | 
			
		||||
		"prepublishOnly": "npm run lint && npm test",
 | 
			
		||||
		"api": "node api.js"
 | 
			
		||||
	},
 | 
			
		||||
	"tap": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,9 @@ const parseTickets = (ctx, j) => {
 | 
			
		|||
				.flatMap(p => [
 | 
			
		||||
					p.einfacheFahrt?.standard?.reisePosition,
 | 
			
		||||
					p.einfacheFahrt?.upsellEntgelt?.einfacheFahrt?.reisePosition,
 | 
			
		||||
				].filter(p => p)
 | 
			
		||||
					p.einfacheFahrt?.upsellAngebote?.map(a => a.upsellEntgelt?.einfacheFahrt?.reisePosition),
 | 
			
		||||
				].flatMap(p => p)
 | 
			
		||||
					.filter(p => p)
 | 
			
		||||
					.map(p => {
 | 
			
		||||
						p.reisePosition.teilpreis = Boolean(p.teilpreisInformationen?.length);
 | 
			
		||||
						return p.reisePosition;
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +46,7 @@ const parseTickets = (ctx, j) => {
 | 
			
		|||
						amount: Math.round(s.preis?.betrag * 100),
 | 
			
		||||
						currency: s.preis?.waehrung,
 | 
			
		||||
					},
 | 
			
		||||
					firstClass: s.klasse == 'KLASSE_1' || s.premium || Boolean(s.nutzungsInformationen?.find(i => i.klasse == 'KLASSE_1')),
 | 
			
		||||
					firstClass: s.klasse == 'KLASSE_1' || Boolean(s.nutzungsInformationen?.find(i => i.klasse == 'KLASSE_1')),
 | 
			
		||||
					partialFare: s.teilpreis,
 | 
			
		||||
				};
 | 
			
		||||
				if (s.teilpreis) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								readme.md
									
										
									
									
									
								
							
							
						
						
									
										32
									
								
								readme.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -23,25 +23,25 @@ What doesn't work:
 | 
			
		|||
 | 
			
		||||
Depending on the configured profile, db-vendo-client will use multiple different DB APIs that offer varying functionality, so choose wisely:
 | 
			
		||||
 | 
			
		||||
| Profile               | `db`              | `dbnav` | `dbweb` | `dbbahnhof` | `dbris` |
 | 
			
		||||
| -------------         | -------------     | ------------- | ------------- | ------------- | ------------- |
 | 
			
		||||
| no API key required   | ✅                | ✅ |  ✅ | ✅ | ❌ |
 | 
			
		||||
| all above endpoints supported | ✅              | ✅ | except `stop()` | only boards | only boards |
 | 
			
		||||
| 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()/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 (IPv4) | 60 requests per minute (IPv4) | aggressive blocking (IPv4/IPv6) | ? | depends on API key |
 | 
			
		||||
| Profile               | `db`              | `dbnav` | `dbweb` | `dbris` |
 | 
			
		||||
| -------------         | -------------     | ------------- | ------------- | ------------- |
 | 
			
		||||
| no API key required   | ✅                | ✅ |  ✅ | ❌ |
 | 
			
		||||
| all above endpoints supported | ✅              | ✅ | except `stop()` | only boards |
 | 
			
		||||
| duration for boards   | always 1h         | always 1h | always 1h | up to 12h |
 | 
			
		||||
| remarks               | for boards only most important remarks    | for boards only most important remarks | all remarks on boards and journeys | all  remarks |
 | 
			
		||||
| cancelled trips       | 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()/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 | 
 | 
			
		||||
| 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 | ✅ |
 | 
			
		||||
| adminCode/operator    | only for journeys | only for journeys | only operator | ✅ |
 | 
			
		||||
| stopovers             | not in boards | not in boards | ✅ | ✅ |
 | 
			
		||||
| assumed backend API stability | less stable | more stable | less stable | more stable |
 | 
			
		||||
| quotas | 60 requests per minute (IPv4), current backend possibly shut off soon | 60 requests per minute (IPv4), possibly aggressive blocking | 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), 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.
 | 
			
		||||
> 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 (please consider the [usage policy](https://transitous.org/api/) there) 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 :)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
 | 
			
		|||
const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
 | 
			
		||||
const minute = 60 * 1000;
 | 
			
		||||
 | 
			
		||||
const T_MOCK = 1747040400 * 1000; // 2025-05-12T08:00:00+01:00
 | 
			
		||||
const T_MOCK = 1764831628 * 1000; // Thu Dec 04 2025 07:00:28 GMT+0000
 | 
			
		||||
const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
 | 
			
		||||
const cfg = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ import isRoughlyEqual from 'is-roughly-equal';
 | 
			
		|||
 | 
			
		||||
import {createWhen} from './lib/util.js';
 | 
			
		||||
import {createClient} from '../../index.js';
 | 
			
		||||
import {profile as dbProfile} from '../../p/dbregioguide/index.js';
 | 
			
		||||
import {profile as dbProfile} from '../../p/dbbahnhof/index.js';
 | 
			
		||||
import {
 | 
			
		||||
	createValidateStation,
 | 
			
		||||
	createValidateTrip,
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
 | 
			
		|||
const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
 | 
			
		||||
const minute = 60 * 1000;
 | 
			
		||||
 | 
			
		||||
const T_MOCK = 1747040400 * 1000; // 2025-05-12T08:00:00+01:00
 | 
			
		||||
const T_MOCK = 1764831628 * 1000; // Thu Dec 04 2025 07:00:28 GMT+0000
 | 
			
		||||
const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
 | 
			
		||||
const cfg = {
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ const berlinSüdkreuz = '8011113';
 | 
			
		|||
const kölnHbf = '8000207';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
tap.test('departures at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
tap.skip('departures at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
	const res = await client.departures(blnSchwedterStr, {
 | 
			
		||||
		duration: 5, when,
 | 
			
		||||
	});
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ tap.test('departures at Berlin Schwedter Str.', async (t) => {
 | 
			
		|||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('departures with station object', async (t) => {
 | 
			
		||||
tap.skip('departures with station object', async (t) => {
 | 
			
		||||
	const res = await client.departures({
 | 
			
		||||
		type: 'station',
 | 
			
		||||
		id: jungfernheide,
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +130,7 @@ tap.test('departures with station object', async (t) => {
 | 
			
		|||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
tap.skip('arrivals at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
	const res = await client.arrivals(blnSchwedterStr, {
 | 
			
		||||
		duration: 5, when,
 | 
			
		||||
	});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
 | 
			
		|||
const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
 | 
			
		||||
const minute = 60 * 1000;
 | 
			
		||||
 | 
			
		||||
const T_MOCK = 1747040400 * 1000; // 2025-05-12T08:00:00+01:00
 | 
			
		||||
const T_MOCK = 1764831628 * 1000; // Thu Dec 04 2025 07:00:28 GMT+0000
 | 
			
		||||
const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
 | 
			
		||||
const cfg = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,499 +0,0 @@
 | 
			
		|||
import tap from 'tap';
 | 
			
		||||
import isRoughlyEqual from 'is-roughly-equal';
 | 
			
		||||
 | 
			
		||||
import {createWhen} from './lib/util.js';
 | 
			
		||||
import {createClient} from '../../index.js';
 | 
			
		||||
import {profile as dbProfile} from '../../p/dbregioguide/index.js';
 | 
			
		||||
import {
 | 
			
		||||
	createValidateStation,
 | 
			
		||||
	createValidateTrip,
 | 
			
		||||
} from './lib/validators.js';
 | 
			
		||||
import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
 | 
			
		||||
import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
 | 
			
		||||
import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
 | 
			
		||||
import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
 | 
			
		||||
import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
 | 
			
		||||
import {testLegCycleAlternatives} from './lib/leg-cycle-alternatives.js';
 | 
			
		||||
import {testRefreshJourney} from './lib/refresh-journey.js';
 | 
			
		||||
import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
 | 
			
		||||
import {testDepartures} from './lib/departures.js';
 | 
			
		||||
import {testArrivals} from './lib/arrivals.js';
 | 
			
		||||
import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
 | 
			
		||||
 | 
			
		||||
const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
 | 
			
		||||
const minute = 60 * 1000;
 | 
			
		||||
 | 
			
		||||
const T_MOCK = 1747040400 * 1000; // 2025-05-12T08:00:00+01:00
 | 
			
		||||
const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
 | 
			
		||||
const cfg = {
 | 
			
		||||
	when,
 | 
			
		||||
	stationCoordsOptional: true, // TODO
 | 
			
		||||
	products: dbProfile.products,
 | 
			
		||||
	minLatitude: 46.673100,
 | 
			
		||||
	maxLatitude: 55.030671,
 | 
			
		||||
	minLongitude: 6.896517,
 | 
			
		||||
	maxLongitude: 16.180237,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const validate = createValidate(cfg);
 | 
			
		||||
 | 
			
		||||
const assertValidPrice = (t, p) => {
 | 
			
		||||
	t.ok(p);
 | 
			
		||||
	if (p.amount !== null) {
 | 
			
		||||
		t.equal(typeof p.amount, 'number');
 | 
			
		||||
		t.ok(p.amount > 0);
 | 
			
		||||
	}
 | 
			
		||||
	if (p.hint !== null) {
 | 
			
		||||
		t.equal(typeof p.hint, 'string');
 | 
			
		||||
		t.ok(p.hint);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const assertValidTickets = (test, tickets) => {
 | 
			
		||||
	test.ok(Array.isArray(tickets));
 | 
			
		||||
	for (let fare of tickets) {
 | 
			
		||||
		test.equal(typeof fare.name, 'string', 'Mandatory field "name" is missing or not a string');
 | 
			
		||||
		test.ok(fare.name);
 | 
			
		||||
 | 
			
		||||
		test.ok(isObj(fare.priceObj), 'Mandatory field "priceObj" is missing or not an object');
 | 
			
		||||
		test.equal(typeof fare.priceObj.amount, 'number', 'Mandatory field "amount" in "priceObj" is missing or not a number');
 | 
			
		||||
		test.ok(fare.priceObj.amount > 0);
 | 
			
		||||
		if ('currency' in fare.priceObj) {
 | 
			
		||||
			test.equal(typeof fare.priceObj.currency, 'string');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Check optional fields
 | 
			
		||||
		if ('addData' in fare) {
 | 
			
		||||
			test.equal(typeof fare.addData, 'string');
 | 
			
		||||
		}
 | 
			
		||||
		if ('addDataTicketInfo' in fare) {
 | 
			
		||||
			test.equal(typeof fare.addDataTicketInfo, 'string');
 | 
			
		||||
		}
 | 
			
		||||
		if ('addDataTicketDetails' in fare) {
 | 
			
		||||
			test.equal(typeof fare.addDataTicketDetails, 'string');
 | 
			
		||||
		}
 | 
			
		||||
		if ('addDataTravelInfo' in fare) {
 | 
			
		||||
			test.equal(typeof fare.addDataTravelInfo, 'string');
 | 
			
		||||
		}
 | 
			
		||||
		if ('addDataTravelDetails' in fare) {
 | 
			
		||||
			test.equal(typeof fare.firstClass, 'boolean');
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const client = createClient(dbProfile, 'public-transport/hafas-client:test', {enrichStations: false});
 | 
			
		||||
 | 
			
		||||
const berlinHbf = '8011160';
 | 
			
		||||
const münchenHbf = '8000261';
 | 
			
		||||
const jungfernheide = '8011167';
 | 
			
		||||
const blnSchwedterStr = '732652';
 | 
			
		||||
const westhafen = '8089116';
 | 
			
		||||
const wedding = '8089131';
 | 
			
		||||
const württembergallee = '731084';
 | 
			
		||||
const regensburgHbf = '8000309';
 | 
			
		||||
const blnOstbahnhof = '8010255';
 | 
			
		||||
const blnTiergarten = '8089091';
 | 
			
		||||
const blnJannowitzbrücke = '8089019';
 | 
			
		||||
const potsdamHbf = '8012666';
 | 
			
		||||
const berlinSüdkreuz = '8011113';
 | 
			
		||||
const kölnHbf = '8000207';
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
tap.test('journeys – Berlin Schwedter Str. to München Hbf', async (t) => {
 | 
			
		||||
	const res = await client.journeys(blnSchwedterStr, münchenHbf, {
 | 
			
		||||
		results: 4,
 | 
			
		||||
		departure: when,
 | 
			
		||||
		stopovers: true,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testJourneysStationToStation({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		fromId: blnSchwedterStr,
 | 
			
		||||
		toId: münchenHbf,
 | 
			
		||||
	});
 | 
			
		||||
	// todo: find a journey where there pricing info is always available
 | 
			
		||||
	for (let journey of res.journeys) {
 | 
			
		||||
		if (journey.price) {
 | 
			
		||||
			assertValidPrice(t, journey.price);
 | 
			
		||||
		}
 | 
			
		||||
		if (journey.tickets) {
 | 
			
		||||
			assertValidTickets(t, journey.tickets);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('refreshJourney – valid tickets', async (t) => {
 | 
			
		||||
	const T_MOCK = 1710831600 * 1000; // 2024-03-19T08:00:00+01:00
 | 
			
		||||
	const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
 | 
			
		||||
	const journeysRes = await client.journeys(berlinHbf, münchenHbf, {
 | 
			
		||||
		results: 4,
 | 
			
		||||
		departure: when,
 | 
			
		||||
		stopovers: true,
 | 
			
		||||
	});
 | 
			
		||||
	const refreshWithoutTicketsRes = await client.refreshJourney(journeysRes.journeys[0].refreshToken, {
 | 
			
		||||
		tickets: false,
 | 
			
		||||
	});
 | 
			
		||||
	const refreshWithTicketsRes = await client.refreshJourney(journeysRes.journeys[0].refreshToken, {
 | 
			
		||||
		tickets: true,
 | 
			
		||||
	});
 | 
			
		||||
	for (let res of [refreshWithoutTicketsRes, refreshWithTicketsRes]) {
 | 
			
		||||
		if (res.journey.tickets !== undefined) {
 | 
			
		||||
			assertValidTickets(t, res.journey.tickets);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// todo: journeys, only one product
 | 
			
		||||
 | 
			
		||||
tap.test('journeys – fails with no product', async (t) => {
 | 
			
		||||
	await journeysFailsWithNoProduct({
 | 
			
		||||
		test: t,
 | 
			
		||||
		fetchJourneys: client.journeys,
 | 
			
		||||
		fromId: blnSchwedterStr,
 | 
			
		||||
		toId: münchenHbf,
 | 
			
		||||
		when,
 | 
			
		||||
		products: dbProfile.products,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('Berlin Schwedter Str. to Torfstraße 17', async (t) => {
 | 
			
		||||
	const torfstr = {
 | 
			
		||||
		type: 'location',
 | 
			
		||||
		address: 'Torfstraße 17',
 | 
			
		||||
		latitude: 52.5416823,
 | 
			
		||||
		longitude: 13.3491223,
 | 
			
		||||
	};
 | 
			
		||||
	const res = await client.journeys(blnSchwedterStr, torfstr, {
 | 
			
		||||
		results: 3,
 | 
			
		||||
		departure: when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testJourneysStationToAddress({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		fromId: blnSchwedterStr,
 | 
			
		||||
		to: torfstr,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
 | 
			
		||||
	const atze = {
 | 
			
		||||
		type: 'location',
 | 
			
		||||
		id: '991598902',
 | 
			
		||||
		poi: true,
 | 
			
		||||
		name: 'Berlin, Atze Musiktheater für Kinder (Kultur und U',
 | 
			
		||||
		latitude: 52.542417,
 | 
			
		||||
		longitude: 13.350437,
 | 
			
		||||
	};
 | 
			
		||||
	const res = await client.journeys(blnSchwedterStr, atze, {
 | 
			
		||||
		results: 3,
 | 
			
		||||
		departure: when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testJourneysStationToPoi({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		fromId: blnSchwedterStr,
 | 
			
		||||
		to: atze,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('journeys: via works – with detour', async (t) => {
 | 
			
		||||
	// Going from Westhafen to Wedding via Württembergallee without detour
 | 
			
		||||
	// is currently impossible. We check if the routing engine computes a detour.
 | 
			
		||||
	const res = await client.journeys(westhafen, wedding, {
 | 
			
		||||
		via: württembergallee,
 | 
			
		||||
		results: 1,
 | 
			
		||||
		departure: when,
 | 
			
		||||
		stopovers: true,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testJourneysWithDetour({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		detourIds: [württembergallee],
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// todo: walkingSpeed "Berlin - Charlottenburg, Hallerstraße" -> jungfernheide
 | 
			
		||||
// todo: without detour
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// todo: with the DB endpoint, earlierRef/laterRef is missing queries many days in the future
 | 
			
		||||
tap.skip('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
 | 
			
		||||
	await testEarlierLaterJourneys({
 | 
			
		||||
		test: t,
 | 
			
		||||
		fetchJourneys: client.journeys,
 | 
			
		||||
		validate,
 | 
			
		||||
		fromId: jungfernheide,
 | 
			
		||||
		toId: münchenHbf,
 | 
			
		||||
		when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
if (!process.env.VCR_MODE) {
 | 
			
		||||
	tap.test('journeys – leg cycle & alternatives', async (t) => {
 | 
			
		||||
		await testLegCycleAlternatives({
 | 
			
		||||
			test: t,
 | 
			
		||||
			fetchJourneys: client.journeys,
 | 
			
		||||
			fromId: blnTiergarten,
 | 
			
		||||
			toId: blnJannowitzbrücke,
 | 
			
		||||
			when,
 | 
			
		||||
		});
 | 
			
		||||
		t.end();
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
tap.test('refreshJourney', async (t) => {
 | 
			
		||||
	const T_MOCK = 1710831600 * 1000; // 2024-03-19T08:00:00+01:00
 | 
			
		||||
	const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
 | 
			
		||||
	const validate = createValidate({...cfg, when});
 | 
			
		||||
 | 
			
		||||
	await testRefreshJourney({
 | 
			
		||||
		test: t,
 | 
			
		||||
		fetchJourneys: client.journeys,
 | 
			
		||||
		refreshJourney: client.refreshJourney,
 | 
			
		||||
		validate,
 | 
			
		||||
		fromId: jungfernheide,
 | 
			
		||||
		toId: münchenHbf,
 | 
			
		||||
		when,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.skip('journeysFromTrip – U Mehringdamm to U Naturkundemuseum, reroute to Spittelmarkt.', async (t) => {
 | 
			
		||||
	const blnMehringdamm = '730939';
 | 
			
		||||
	const blnStadtmitte = '732541';
 | 
			
		||||
	const blnNaturkundemuseum = '732539';
 | 
			
		||||
	const blnSpittelmarkt = '732543';
 | 
			
		||||
 | 
			
		||||
	const isU6Leg = leg => leg.line && leg.line.name
 | 
			
		||||
		&& leg.line.name.toUpperCase()
 | 
			
		||||
			.replace(/\s+/g, '') === 'U6';
 | 
			
		||||
 | 
			
		||||
	const sameStopOrStation = (stopA) => (stopB) => {
 | 
			
		||||
		if (stopA.id && stopB.id && stopA.id === stopB.id) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		const statA = stopA.stat && stopA.stat.id || NaN;
 | 
			
		||||
		const statB = stopB.stat && stopB.stat.id || NaN;
 | 
			
		||||
		return statA === statB || stopA.id === statB || stopB.id === statA;
 | 
			
		||||
	};
 | 
			
		||||
	const departureOf = st => Number(new Date(st.departure || st.scheduledDeparture));
 | 
			
		||||
	const arrivalOf = st => Number(new Date(st.arrival || st.scheduledArrival));
 | 
			
		||||
 | 
			
		||||
	// `journeysFromTrip` only supports queries *right now*, so we can't use `when` as in all
 | 
			
		||||
	// other tests. To make the test less brittle, we pick a connection that is served all night. 🙄
 | 
			
		||||
	const when = new Date();
 | 
			
		||||
	const validate = createValidate({...cfg, when});
 | 
			
		||||
 | 
			
		||||
	const findTripBetween = async (stopAId, stopBId, products = {}) => {
 | 
			
		||||
		const {journeys} = await client.journeys(stopAId, stopBId, {
 | 
			
		||||
			departure: new Date(when - 10 * minute),
 | 
			
		||||
			transfers: 0, products,
 | 
			
		||||
			results: 8, stopovers: false, remarks: false,
 | 
			
		||||
		});
 | 
			
		||||
		for (const j of journeys) {
 | 
			
		||||
			const l = j.legs.find(isU6Leg);
 | 
			
		||||
			if (!l) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			const t = await client.trip(l.tripId, {
 | 
			
		||||
				stopovers: true, remarks: false,
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			const pastStopovers = t.stopovers
 | 
			
		||||
				.filter(st => departureOf(st) < Date.now()); // todo: <= ?
 | 
			
		||||
			const hasStoppedAtA = pastStopovers
 | 
			
		||||
				.find(sameStopOrStation({id: stopAId}));
 | 
			
		||||
			const willStopAtB = t.stopovers
 | 
			
		||||
				.filter(st => arrivalOf(st) > Date.now()) // todo: >= ?
 | 
			
		||||
				.find(sameStopOrStation({id: stopBId}));
 | 
			
		||||
 | 
			
		||||
			if (hasStoppedAtA && willStopAtB) {
 | 
			
		||||
				const prevStopover = maxBy(pastStopovers, departureOf);
 | 
			
		||||
				return {trip: t, prevStopover};
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return {trip: null, prevStopover: null};
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// Find a vehicle from U Mehringdamm to U Stadtmitte (to the north) that is currently
 | 
			
		||||
	// between these two stations.
 | 
			
		||||
	const {trip, prevStopover} = await findTripBetween(blnMehringdamm, blnStadtmitte, {
 | 
			
		||||
		regionalExpress: false, regional: false, suburban: false,
 | 
			
		||||
	});
 | 
			
		||||
	t.ok(trip, 'precondition failed: trip not found');
 | 
			
		||||
	t.ok(prevStopover, 'precondition failed: previous stopover missing');
 | 
			
		||||
 | 
			
		||||
	// todo: "Error: Suche aus dem Zug: Vor Abfahrt des Zuges"
 | 
			
		||||
	const newJourneys = await client.journeysFromTrip(trip.id, prevStopover, blnSpittelmarkt, {
 | 
			
		||||
		results: 3, stopovers: true, remarks: false,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// Validate with fake prices.
 | 
			
		||||
	const withFakePrice = (j) => {
 | 
			
		||||
		const clone = Object.assign({}, j);
 | 
			
		||||
		clone.price = {amount: 123, currency: 'EUR'};
 | 
			
		||||
		return clone;
 | 
			
		||||
	};
 | 
			
		||||
	// todo: there is no such validator!
 | 
			
		||||
	validate(t, newJourneys.map(withFakePrice), 'journeysFromTrip', 'newJourneys');
 | 
			
		||||
 | 
			
		||||
	for (let i = 0; i < newJourneys.length; i++) {
 | 
			
		||||
		const j = newJourneys[i];
 | 
			
		||||
		const n = `newJourneys[${i}]`;
 | 
			
		||||
 | 
			
		||||
		const legOnTrip = j.legs.find(l => l.tripId === trip.id);
 | 
			
		||||
		t.ok(legOnTrip, n + ': leg with trip ID not found');
 | 
			
		||||
		t.equal(last(legOnTrip.stopovers).stop.id, blnStadtmitte);
 | 
			
		||||
	}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('trip details', async (t) => {
 | 
			
		||||
	const res = await client.journeys(berlinHbf, münchenHbf, {
 | 
			
		||||
		results: 1, departure: when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	const p = res.journeys[0].legs.find(l => !l.walking);
 | 
			
		||||
	t.ok(p.tripId, 'precondition failed');
 | 
			
		||||
	t.ok(p.line.name, 'precondition failed');
 | 
			
		||||
 | 
			
		||||
	const tripRes = await client.trip(p.tripId, {when});
 | 
			
		||||
 | 
			
		||||
	const validate = createValidate(cfg, {
 | 
			
		||||
		trip: (cfg) => {
 | 
			
		||||
			const validateTrip = createValidateTrip(cfg);
 | 
			
		||||
			const validateTripWithFakeDirection = (val, trip, name) => {
 | 
			
		||||
				validateTrip(val, {
 | 
			
		||||
					...trip,
 | 
			
		||||
					direction: trip.direction || 'foo', // todo, see #49
 | 
			
		||||
				}, name);
 | 
			
		||||
			};
 | 
			
		||||
			return validateTripWithFakeDirection;
 | 
			
		||||
		},
 | 
			
		||||
	});
 | 
			
		||||
	validate(t, tripRes, 'tripResult', 'tripRes');
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
tap.test('departures at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
	const res = await client.departures(blnSchwedterStr, {
 | 
			
		||||
		duration: 5, when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testDepartures({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		id: blnSchwedterStr,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('departures with station object', async (t) => {
 | 
			
		||||
	const res = await client.departures({
 | 
			
		||||
		type: 'station',
 | 
			
		||||
		id: jungfernheide,
 | 
			
		||||
		name: 'Berlin Jungfernheide',
 | 
			
		||||
		location: {
 | 
			
		||||
			type: 'location',
 | 
			
		||||
			latitude: 1.23,
 | 
			
		||||
			longitude: 2.34,
 | 
			
		||||
		},
 | 
			
		||||
	}, {when});
 | 
			
		||||
 | 
			
		||||
	validate(t, res, 'departuresResponse', 'res');
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
 | 
			
		||||
	const res = await client.arrivals(blnSchwedterStr, {
 | 
			
		||||
		duration: 5, when,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await testArrivals({
 | 
			
		||||
		test: t,
 | 
			
		||||
		res,
 | 
			
		||||
		validate,
 | 
			
		||||
		id: blnSchwedterStr,
 | 
			
		||||
	});
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
tap.test('nearby Berlin Jungfernheide', async (t) => {
 | 
			
		||||
	const nearby = await client.nearby({
 | 
			
		||||
		type: 'location',
 | 
			
		||||
		latitude: 52.530273,
 | 
			
		||||
		longitude: 13.299433,
 | 
			
		||||
	}, {
 | 
			
		||||
		results: 2, distance: 400,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	validate(t, nearby, 'locations', 'nearby');
 | 
			
		||||
 | 
			
		||||
	t.equal(nearby.length, 2);
 | 
			
		||||
 | 
			
		||||
	const s0 = nearby[0];
 | 
			
		||||
	t.equal(s0.id, jungfernheide);
 | 
			
		||||
	t.equal(s0.name, 'Berlin Jungfernheide');
 | 
			
		||||
	t.ok(isRoughlyEqual(0.0005, s0.location.latitude, 52.530408));
 | 
			
		||||
	t.ok(isRoughlyEqual(0.0005, s0.location.longitude, 13.299424));
 | 
			
		||||
	t.ok(s0.distance >= 0);
 | 
			
		||||
	t.ok(s0.distance <= 100);
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('locations named Jungfernheide', async (t) => {
 | 
			
		||||
	const locations = await client.locations('Jungfernheide', {
 | 
			
		||||
		results: 10,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	validate(t, locations, 'locations', 'locations');
 | 
			
		||||
	t.ok(locations.length <= 10);
 | 
			
		||||
	t.ok(locations.some((l) => {
 | 
			
		||||
		return l.station && l.station.id === jungfernheide || l.id === jungfernheide;
 | 
			
		||||
	}), 'Jungfernheide not found');
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('stop', async (t) => {
 | 
			
		||||
	const s = await client.stop(regensburgHbf);
 | 
			
		||||
 | 
			
		||||
	validate(t, s, ['stop', 'station'], 'stop');
 | 
			
		||||
	t.equal(s.id, regensburgHbf);
 | 
			
		||||
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
tap.test('line with additionalName', async (t) => {
 | 
			
		||||
	const {departures} = await client.departures(potsdamHbf, {
 | 
			
		||||
		when,
 | 
			
		||||
		duration: 12 * 60, // 12 minutes
 | 
			
		||||
		products: {bus: false, suburban: false, tram: false},
 | 
			
		||||
	});
 | 
			
		||||
	t.ok(departures.some(d => d.line && d.line.additionalName));
 | 
			
		||||
	t.end();
 | 
			
		||||
});
 | 
			
		||||
*/
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -3,7 +3,7 @@ const simplify = j => j.legs.map(l => {
 | 
			
		|||
		origin: l.origin,
 | 
			
		||||
		destination: l.destination,
 | 
			
		||||
		departure: l.plannedDeparture || l.departure,
 | 
			
		||||
		arrival: l.plannedArrival || l.arrival,
 | 
			
		||||
		// arrival: l.plannedArrival || l.arrival, // sometimes differs on older journeys
 | 
			
		||||
		line: l.line,
 | 
			
		||||
	};
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,6 +52,7 @@ const berlinWienQuery0 = Object.freeze(
 | 
			
		|||
				verkehrsmittel: [
 | 
			
		||||
					'ALL',
 | 
			
		||||
				],
 | 
			
		||||
				alternativeHalteBerechnung: true,
 | 
			
		||||
				zeitWunsch: {
 | 
			
		||||
					reiseDatum: '2024-12-07T23:50:12+01:00',
 | 
			
		||||
					zeitPunktArt: 'ABFAHRT',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue