declare module 'spc-geo' { // Watch Type definitions export interface WatchTypeConfig { code: string; event: string; } export const WatchType: { Tornado: WatchTypeConfig; SevereThunderstorm: WatchTypeConfig; FlashFlood: WatchTypeConfig; Flood: WatchTypeConfig; Hurricane: WatchTypeConfig; TropicalStorm: WatchTypeConfig; WinterStorm: WatchTypeConfig; Blizzard: WatchTypeConfig; HighWind: WatchTypeConfig; ExcessiveHeat: WatchTypeConfig; WindChill: WatchTypeConfig; FreezingRain: WatchTypeConfig; FireWeather: WatchTypeConfig; ExtremeHeat: WatchTypeConfig; All: WatchTypeConfig; }; // VTEC parsing types export interface VTECData { operationalMode: string; action: string; office: string; phenomena: string; significance: string; eventTrackingNumber: string; startTimeRaw: string; endTimeRaw: string; startTime: string; endTime: string; } export function parseVTEC(vtecString: string): VTECData; export function parseVTECTime(timeStr: string): string; // Zone data types export interface ZoneInfo { url: string; type: 'fire' | 'forecast' | 'county'; id: string; data: any; // Zone geometry and properties } // Watch details types export interface WatchDetails { text?: string; maxProbs?: { combined?: string; sigtor?: string; tor?: string; sigwind?: string; wind?: string; sighail?: string; hail?: string; }; } // GeoJSON types export interface GeoJSONFeature { type: 'Feature'; geometry: { type: string; coordinates: number[][][] | number[][]; }; properties: { '@id'?: string; id?: string; type?: string; name?: string; state?: string; watchid?: string; stroke?: string; fill?: string; [key: string]: any; }; } export interface GeoJSONCollection { type: 'FeatureCollection'; features: GeoJSONFeature[]; } // Watch object types export interface WatchObject { id?: string; states?: string[]; ugc?: string[]; counties?: string[]; zones?: ZoneInfo[]; headline?: string; details?: () => Promise; start?: string; to?: string; geojson: (colorFn?: (watch: WatchObject, feature: GeoJSONFeature) => { stroke?: string; fill?: string }) => GeoJSONCollection; } // Client options export interface GetOperationalWatchesOptions { type: WatchTypeConfig; method?: 'query' | 'filter'; vtecFilter?: (vtec: VTECData) => boolean; } export type IncludeOption = | 'id' | 'states' | 'ugc' | 'counties' | 'zones' | 'headline' | 'details' | 'start' | 'to' | 'geojson'; // Subscription types export interface SubscriptionDiff { added: WatchObject[]; removed: string[]; } export type SubscriptionHandler = (diff: SubscriptionDiff) => void; // Main client class export class NWSClient { /** * @param optionsOrFeedBaseUrl If object, may include feedBaseUrl and zoneDataPath. If string, treated as feedBaseUrl (legacy). If two arguments, (feedBaseUrl, zoneDataPath) (legacy). * @param zoneDataPath Optional path for zone data (legacy, discouraged) * @example * new NWSClient() // uses default feed and default zone data path * new NWSClient({ feedBaseUrl: '...', zoneDataPath: '/my/path' }) * new NWSClient('https://api.weather.gov/alerts/active', '/my/custom/path') // legacy * new NWSClient('https://api.weather.gov/alerts/active') // legacy */ constructor(optionsOrFeedBaseUrl?: { feedBaseUrl?: string, zoneDataPath?: string } | string, zoneDataPath?: string); /** * Get raw operational watches data */ GetOperationalWatchesRaw(options: GetOperationalWatchesOptions): Promise>; /** * Get processed operational watches */ GetOperationalWatches( options: GetOperationalWatchesOptions, include?: IncludeOption[] ): Promise; /** * Get merged GeoJSON by watch type */ GJByWatchType( type: WatchTypeConfig, colorFn?: (watch: WatchObject, feature: GeoJSONFeature) => { stroke?: string; fill?: string }, include?: IncludeOption[] ): Promise; /** * Fetch raw data from NWS API */ fetchData(params?: Record): Promise; /** * Set custom fetch function for testing */ setFetchData(f: (params?: Record) => Promise): Promise; /** * Subscribe to watch updates * @param interval Interval in seconds (minimum 15) * @param outputHandler Callback function for updates */ subscribe(interval: number, outputHandler: SubscriptionHandler): Promise; } }