feat: add global weather support
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m54s

This commit is contained in:
zv
2026-06-14 15:53:34 +02:00
parent d572c9cc53
commit 2182297adc
45 changed files with 739 additions and 212 deletions

53
types/weather-region.ts Normal file
View File

@@ -0,0 +1,53 @@
export type WeatherRegion = "PL" | "GLOBAL";
export type WeatherSource = "IMGW" | "ALARO" | "OPEN_METEO";
export type WeatherSourceType = "observation" | "model" | "hybrid" | "official_warning";
export interface WeatherCapabilities {
current: boolean;
forecastHourly: boolean;
forecastDaily: boolean;
officialWarnings: boolean;
countyFiltering: boolean;
brief: boolean;
pushOfficialAlerts: boolean;
}
export interface WeatherSourceMetadata {
source: WeatherSource;
sourceLabel: string;
sourceType: WeatherSourceType;
isOfficial: boolean;
fetchedAt?: string;
generatedAt?: string;
}
export const WEATHER_CAPABILITIES: Record<WeatherRegion, WeatherCapabilities> = {
PL: {
current: true,
forecastHourly: true,
forecastDaily: true,
officialWarnings: true,
countyFiltering: true,
brief: true,
pushOfficialAlerts: true,
},
GLOBAL: {
current: true,
forecastHourly: true,
forecastDaily: true,
officialWarnings: false,
countyFiltering: false,
brief: true,
pushOfficialAlerts: false,
},
};
export function getWeatherRegionForCountryCode(countryCode?: string | null): WeatherRegion {
return countryCode?.trim().toUpperCase() === "PL" ? "PL" : "GLOBAL";
}
export function getWeatherCapabilities(region?: WeatherRegion | null) {
return WEATHER_CAPABILITIES[region ?? "PL"];
}