2026-01-17 00:34:46 +00:00
|
|
|
import type { FeedItem } from "@aris/core"
|
|
|
|
|
|
|
|
|
|
import type { Certainty, ConditionCode, PrecipitationType, Severity, Urgency } from "./weatherkit"
|
|
|
|
|
|
|
|
|
|
export const WeatherFeedItemType = {
|
2026-03-01 22:10:34 +00:00
|
|
|
Current: "weather-current",
|
|
|
|
|
Hourly: "weather-hourly",
|
|
|
|
|
Daily: "weather-daily",
|
|
|
|
|
Alert: "weather-alert",
|
2026-01-17 00:34:46 +00:00
|
|
|
} as const
|
|
|
|
|
|
|
|
|
|
export type WeatherFeedItemType = (typeof WeatherFeedItemType)[keyof typeof WeatherFeedItemType]
|
|
|
|
|
|
|
|
|
|
export type CurrentWeatherData = {
|
|
|
|
|
conditionCode: ConditionCode
|
|
|
|
|
daylight: boolean
|
|
|
|
|
humidity: number
|
|
|
|
|
precipitationIntensity: number
|
|
|
|
|
pressure: number
|
|
|
|
|
pressureTrend: "rising" | "falling" | "steady"
|
|
|
|
|
temperature: number
|
|
|
|
|
temperatureApparent: number
|
|
|
|
|
uvIndex: number
|
|
|
|
|
visibility: number
|
|
|
|
|
windDirection: number
|
|
|
|
|
windGust: number
|
|
|
|
|
windSpeed: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CurrentWeatherFeedItem extends FeedItem<
|
2026-03-01 22:10:34 +00:00
|
|
|
typeof WeatherFeedItemType.Current,
|
2026-01-17 00:34:46 +00:00
|
|
|
CurrentWeatherData
|
|
|
|
|
> {}
|
|
|
|
|
|
|
|
|
|
export type HourlyWeatherData = {
|
|
|
|
|
forecastTime: Date
|
|
|
|
|
conditionCode: ConditionCode
|
|
|
|
|
daylight: boolean
|
|
|
|
|
humidity: number
|
|
|
|
|
precipitationAmount: number
|
|
|
|
|
precipitationChance: number
|
|
|
|
|
precipitationType: PrecipitationType
|
|
|
|
|
temperature: number
|
|
|
|
|
temperatureApparent: number
|
|
|
|
|
uvIndex: number
|
|
|
|
|
windDirection: number
|
|
|
|
|
windGust: number
|
|
|
|
|
windSpeed: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface HourlyWeatherFeedItem extends FeedItem<
|
2026-03-01 22:10:34 +00:00
|
|
|
typeof WeatherFeedItemType.Hourly,
|
2026-01-17 00:34:46 +00:00
|
|
|
HourlyWeatherData
|
|
|
|
|
> {}
|
|
|
|
|
|
|
|
|
|
export type DailyWeatherData = {
|
|
|
|
|
forecastDate: Date
|
|
|
|
|
conditionCode: ConditionCode
|
|
|
|
|
maxUvIndex: number
|
|
|
|
|
precipitationAmount: number
|
|
|
|
|
precipitationChance: number
|
|
|
|
|
precipitationType: PrecipitationType
|
|
|
|
|
snowfallAmount: number
|
|
|
|
|
sunrise: Date
|
|
|
|
|
sunset: Date
|
|
|
|
|
temperatureMax: number
|
|
|
|
|
temperatureMin: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DailyWeatherFeedItem extends FeedItem<
|
2026-03-01 22:10:34 +00:00
|
|
|
typeof WeatherFeedItemType.Daily,
|
2026-01-17 00:34:46 +00:00
|
|
|
DailyWeatherData
|
|
|
|
|
> {}
|
|
|
|
|
|
|
|
|
|
export type WeatherAlertData = {
|
|
|
|
|
alertId: string
|
|
|
|
|
areaName: string
|
|
|
|
|
certainty: Certainty
|
|
|
|
|
description: string
|
|
|
|
|
detailsUrl: string
|
|
|
|
|
effectiveTime: Date
|
|
|
|
|
expireTime: Date
|
|
|
|
|
severity: Severity
|
|
|
|
|
source: string
|
|
|
|
|
urgency: Urgency
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface WeatherAlertFeedItem extends FeedItem<
|
2026-03-01 22:10:34 +00:00
|
|
|
typeof WeatherFeedItemType.Alert,
|
2026-01-17 00:34:46 +00:00
|
|
|
WeatherAlertData
|
|
|
|
|
> {}
|
|
|
|
|
|
|
|
|
|
export type WeatherFeedItem =
|
|
|
|
|
| CurrentWeatherFeedItem
|
|
|
|
|
| HourlyWeatherFeedItem
|
|
|
|
|
| DailyWeatherFeedItem
|
|
|
|
|
| WeatherAlertFeedItem
|