feat: BSH-Pegelauswahl und Fix für Eintragstag beim Gezeiten-Abruf
Bei fehlgeschlagenem Auto-Abruf nächste BSH-Stationen anbieten; Reisetag korrekt aus dem Eintrag parsen und Vergangenheitshinweis anzeigen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { fetchBshTidesForCoordinates, MAX_BSH_DISTANCE_KM } from './bshTides.js'
|
||||
import {
|
||||
fetchBshTidesForCoordinates,
|
||||
fetchBshTidesForStation,
|
||||
listNearbyBshStations,
|
||||
MAX_BSH_DISTANCE_KM,
|
||||
type BshStationSuggestion
|
||||
} from './bshTides.js'
|
||||
import {
|
||||
fetchTidesForCoordinates as fetchOpenMeteoTidesForCoordinates,
|
||||
fetchTidesForPlace as fetchOpenMeteoTidesForPlace,
|
||||
@@ -43,6 +49,34 @@ export async function fetchTidesForCoordinates(
|
||||
}
|
||||
}
|
||||
|
||||
export async function listNearbyTideStations(
|
||||
lat: number,
|
||||
lon: number,
|
||||
limit = 8
|
||||
): Promise<BshStationSuggestion[]> {
|
||||
try {
|
||||
return await listNearbyBshStations(lat, lon, limit)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchTidesForStation(
|
||||
stationId: string,
|
||||
options?: { queryLat?: number; queryLon?: number }
|
||||
): Promise<TideProviderResult> {
|
||||
try {
|
||||
return await fetchBshTidesForStation(stationId, options)
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof Error ? error.message : ''
|
||||
if (message === 'bsh_invalid_station' || message === 'no_tide_data') {
|
||||
throw error
|
||||
}
|
||||
console.warn('BSH station tide lookup failed:', error)
|
||||
throw new Error('no_tide_data')
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchTidesForPlace(query: string): Promise<TideProviderResult> {
|
||||
const place = await geocodePlace(query)
|
||||
if (!place) {
|
||||
|
||||
Reference in New Issue
Block a user