airport-data-js 4.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,710 @@
1
+ /**
2
+ * Represents a single airport record from the database.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * const [airport] = await getAirportByIata('SIN');
7
+ * console.log(airport.airport); // "Singapore Changi Airport"
8
+ * console.log(airport.country_code); // "SG"
9
+ * ```
10
+ */
11
+ export interface Airport {
12
+ /** 3-letter IATA airport code (e.g., "SIN", "LHR", "JFK") */
13
+ iata: string;
14
+ /** 4-letter ICAO airport code (e.g., "WSSS", "EGLL", "KJFK"). Empty when unknown. */
15
+ icao: string;
16
+ /** FAA location identifier for US airports whose FAA code is not a 4-character ICAO code (e.g., "80F"). */
17
+ faa_code?: string;
18
+ /** IANA timezone identifier (e.g., "Asia/Singapore") */
19
+ time: string;
20
+ /**
21
+ * UTC offset in hours (e.g., 8, 5.5, -3.5), captured as a July snapshot.
22
+ * It does not follow daylight saving time, so it is wrong for roughly half the year
23
+ * in DST regions. Use {@link getUtcOffset} or {@link getLocalTime} for the real offset at a given moment.
24
+ * @deprecated Use getUtcOffset(code, date) instead.
25
+ */
26
+ utc: number;
27
+ /** ISO 3166-1 alpha-2 country code (e.g., "SG", "GB", "US") */
28
+ country_code: string;
29
+ /** 2-letter continent code: AF, AN, AS, EU, NA, OC, SA */
30
+ continent: string;
31
+ /** Full airport name (e.g., "Singapore Changi Airport") */
32
+ airport: string;
33
+ /** City or municipality served (e.g., "Singapore", "New York"). Empty string when unknown. */
34
+ city: string;
35
+ /**
36
+ * IATA city/metropolitan area code (e.g., "NYC" for JFK/LGA/EWR, "LON" for LHR/LGW).
37
+ * Equals the airport's own IATA code for single-airport cities. Empty string when unknown.
38
+ */
39
+ city_code: string;
40
+ /** Latitude in decimal degrees */
41
+ latitude: number;
42
+ /** Longitude in decimal degrees */
43
+ longitude: number;
44
+ /** Elevation above sea level in feet, or null when unknown */
45
+ elevation_ft: number | null;
46
+ /** Airport classification: "large_airport" | "medium_airport" | "small_airport" | "heliport" | "seaplane_base" | "closed" */
47
+ type: string;
48
+ /** Whether the airport has scheduled commercial service */
49
+ scheduled_service: boolean | string;
50
+ /** Wikipedia article URL */
51
+ wikipedia?: string;
52
+ /** Airport official website URL */
53
+ website?: string;
54
+ /** Longest runway length in feet, or null when unknown */
55
+ runway_length?: number | null;
56
+ /** FlightRadar24 tracking URL */
57
+ flightradar24_url?: string;
58
+ /** RadarBox tracking URL */
59
+ radarbox_url?: string;
60
+ /** FlightAware tracking URL */
61
+ flightaware_url?: string;
62
+ }
63
+ /**
64
+ * An airport record with distance from a reference point, returned by proximity search functions.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const nearest = await findNearestAirport(1.35, 103.99);
69
+ * console.log(nearest.distance); // 0.52 (km)
70
+ * ```
71
+ */
72
+ export interface AirportWithDistance extends Airport {
73
+ /** Distance from the search point in kilometers */
74
+ distance: number;
75
+ }
76
+ /**
77
+ * Filter criteria for searching airports. All fields are optional and combined with AND logic.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * // Find large airports in the US with scheduled service
82
+ * const airports = await findAirports({
83
+ * country_code: 'US',
84
+ * type: 'large_airport',
85
+ * has_scheduled_service: true
86
+ * });
87
+ * ```
88
+ */
89
+ export interface AirportFilters {
90
+ iata?: string;
91
+ icao?: string;
92
+ /** FAA location identifier (US airports without a 4-character ICAO code). */
93
+ faa_code?: string;
94
+ time?: string;
95
+ utc?: number;
96
+ country_code?: string;
97
+ continent?: string;
98
+ airport?: string;
99
+ city?: string;
100
+ city_code?: string;
101
+ latitude?: number;
102
+ longitude?: number;
103
+ elevation_ft?: number | null;
104
+ type?: string;
105
+ scheduled_service?: boolean | string;
106
+ wikipedia?: string;
107
+ website?: string;
108
+ runway_length?: number | null;
109
+ flightradar24_url?: string;
110
+ radarbox_url?: string;
111
+ flightaware_url?: string;
112
+ /** Filter by scheduled service availability (true = has scheduled service) */
113
+ has_scheduled_service?: boolean;
114
+ /** Minimum runway length in feet */
115
+ min_runway_ft?: number;
116
+ }
117
+ /**
118
+ * External links associated with an airport.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const links = await getAirportLinks('LHR');
123
+ * console.log(links.wikipedia); // "https://en.wikipedia.org/wiki/Heathrow_Airport"
124
+ * ```
125
+ */
126
+ export interface AirportLinks {
127
+ website?: string;
128
+ wikipedia?: string;
129
+ flightradar24?: string;
130
+ radarbox?: string;
131
+ flightaware?: string;
132
+ }
133
+ /**
134
+ * Aggregated statistics for airports in a country.
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * const stats = await getAirportStatsByCountry('US');
139
+ * console.log(stats.total); // 19000+
140
+ * console.log(stats.byType.large_airport); // 180+
141
+ * ```
142
+ */
143
+ export interface AirportCountryStats {
144
+ /** Total number of airports */
145
+ total: number;
146
+ /** Count of airports grouped by type */
147
+ byType: Record<string, number>;
148
+ /** Number of airports with scheduled commercial service */
149
+ withScheduledService: number;
150
+ /** Average runway length in feet across airports that have runway data */
151
+ averageRunwayLength: number;
152
+ /** Average elevation in feet */
153
+ averageElevation: number;
154
+ /** List of unique IANA timezones */
155
+ timezones: string[];
156
+ }
157
+ /**
158
+ * Aggregated statistics for airports on a continent.
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const stats = await getAirportStatsByContinent('EU');
163
+ * console.log(stats.byCountry['GB']); // number of UK airports
164
+ * ```
165
+ */
166
+ export interface AirportContinentStats extends AirportCountryStats {
167
+ /** Count of airports grouped by country code */
168
+ byCountry: Record<string, number>;
169
+ }
170
+ /**
171
+ * Result of a distance matrix calculation between multiple airports.
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const matrix = await calculateDistanceMatrix(['SIN', 'LHR', 'JFK']);
176
+ * console.log(matrix.distances['SIN']['LHR']); // 10846
177
+ * ```
178
+ */
179
+ export interface DistanceMatrix {
180
+ /** Summary info for each airport in the matrix */
181
+ airports: Array<{
182
+ code: string;
183
+ name: string;
184
+ iata: string;
185
+ icao: string;
186
+ }>;
187
+ /** Symmetric distance matrix: distances[codeA][codeB] = km (rounded) */
188
+ distances: Record<string, Record<string, number>>;
189
+ }
190
+ /** Sort criteria for ranking airports */
191
+ export type SortBy = 'runway' | 'elevation';
192
+ /** Which field a {@link search} result matched on. */
193
+ export type SearchMatchType = 'iata' | 'icao' | 'city_code' | 'city' | 'name' | 'fuzzy';
194
+ /** Options for {@link search}. */
195
+ export interface SearchOptions {
196
+ /** Maximum number of results (1-100, default: 10). */
197
+ limit?: number;
198
+ /** Only return airports with scheduled commercial service. */
199
+ scheduledOnly?: boolean;
200
+ /** Restrict to these airport types (e.g., ['large_airport', 'medium_airport']). */
201
+ types?: string[];
202
+ /** Restrict to a 2-letter country code. */
203
+ country_code?: string;
204
+ /** Allow typo-tolerant matching (default: true). */
205
+ fuzzy?: boolean;
206
+ }
207
+ /**
208
+ * An airport returned by {@link search}, with ranking details.
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * const [best] = await search('new york');
213
+ * console.log(best.iata, best.matchType); // "JFK" "city"
214
+ * ```
215
+ */
216
+ export interface AirportSearchResult extends Airport {
217
+ /** Relevance score; higher is better. Only meaningful for ordering. */
218
+ score: number;
219
+ /** The field that produced the match. */
220
+ matchType: SearchMatchType;
221
+ }
222
+ /** A date input accepted by the time functions: a Date, epoch milliseconds, or an ISO string. */
223
+ export type DateInput = Date | number | string;
224
+ /**
225
+ * The local time at an airport for a given instant.
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const t = await getLocalTime('JFK', '2026-11-10T12:00:00Z');
230
+ * console.log(t?.iso); // "2026-11-10T07:00:00-05:00"
231
+ * console.log(t?.utcOffset); // -5
232
+ * console.log(t?.isDst); // false
233
+ * ```
234
+ */
235
+ export interface AirportLocalTime {
236
+ /** IANA time zone of the airport (e.g., "America/New_York") */
237
+ timeZone: string;
238
+ /** Local date-time with offset in ISO 8601 form (e.g., "2026-11-10T07:00:00-05:00") */
239
+ iso: string;
240
+ /** Local calendar date, "YYYY-MM-DD" */
241
+ date: string;
242
+ /** Local wall-clock time, "HH:mm:ss" (24-hour) */
243
+ time: string;
244
+ /** UTC offset in hours at that instant (e.g., -5, 5.5) */
245
+ utcOffset: number;
246
+ /** UTC offset as a string (e.g., "-05:00", "+05:30") */
247
+ utcOffsetString: string;
248
+ /** Whether daylight saving time is in effect at that instant */
249
+ isDst: boolean;
250
+ }
251
+ /** Options for {@link formatAirportTime}: any Intl.DateTimeFormat option plus `date` and `locale`. */
252
+ export interface FormatAirportTimeOptions extends Intl.DateTimeFormatOptions {
253
+ /** The instant to format (default: now). */
254
+ date?: DateInput;
255
+ /** BCP 47 locale (default: "en-US"). */
256
+ locale?: string | string[];
257
+ dateStyle?: 'full' | 'long' | 'medium' | 'short';
258
+ timeStyle?: 'full' | 'long' | 'medium' | 'short';
259
+ }
260
+ /**
261
+ * Finds airports by their 3-letter IATA code.
262
+ *
263
+ * @param iataCode - The IATA code of the airport (e.g., 'LHR').
264
+ * @returns Array of matching airport objects.
265
+ * @throws If the IATA code format is invalid or no data is found.
266
+ *
267
+ * @example
268
+ * ```typescript
269
+ * const [airport] = await getAirportByIata('LHR');
270
+ * console.log(airport.airport); // "London Heathrow Airport"
271
+ * console.log(airport.country_code); // "GB"
272
+ * ```
273
+ */
274
+ export declare function getAirportByIata(iataCode?: string): Promise<Airport[]>;
275
+ /**
276
+ * Finds airports by their 4-character ICAO code.
277
+ *
278
+ * @param icaoCode - The ICAO code of the airport (e.g., 'EGLL').
279
+ * @returns Array of matching airport objects.
280
+ * @throws If the ICAO code format is invalid or no data is found.
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const [airport] = await getAirportByIcao('EGLL');
285
+ * console.log(airport.airport); // "London Heathrow Airport"
286
+ * ```
287
+ */
288
+ export declare function getAirportByIcao(icaoCode?: string): Promise<Airport[]>;
289
+ /**
290
+ * Finds airports by their 2-letter ISO country code.
291
+ * Uses a pre-built index for O(1) lookup.
292
+ *
293
+ * @param countryCode - The ISO 3166-1 alpha-2 country code (e.g., 'US').
294
+ * @returns Array of matching airport objects.
295
+ * @throws If the country code format is invalid or no data is found.
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * const airports = await getAirportByCountryCode('US');
300
+ * console.log(airports.length); // 19000+
301
+ * ```
302
+ */
303
+ export declare function getAirportByCountryCode(countryCode?: string): Promise<Airport[]>;
304
+ /**
305
+ * Finds airports by their 2-letter continent code.
306
+ * Uses a pre-built index for O(1) lookup.
307
+ *
308
+ * Valid continent codes: AF (Africa), AN (Antarctica), AS (Asia),
309
+ * EU (Europe), NA (North America), OC (Oceania), SA (South America).
310
+ *
311
+ * @param continentCode - The continent code (e.g., 'AS' for Asia).
312
+ * @returns Array of matching airport objects.
313
+ * @throws If the continent code format is invalid or no data is found.
314
+ *
315
+ * @example
316
+ * ```typescript
317
+ * const airports = await getAirportByContinent('EU');
318
+ * console.log(airports.every(a => a.continent === 'EU')); // true
319
+ * ```
320
+ */
321
+ export declare function getAirportByContinent(continentCode?: string): Promise<Airport[]>;
322
+ /**
323
+ * Searches for airports by name. Case- and accent-insensitive partial matching
324
+ * ("Zurich" matches "Zürich"). For city-aware, ranked results use {@link search}.
325
+ *
326
+ * @param query - The name or partial name to search for (2-100 characters).
327
+ * @returns Array of matching airport objects.
328
+ * @throws If the query is too short or too long.
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * const airports = await searchByName('Heathrow');
333
+ * console.log(airports[0].iata); // "LHR"
334
+ * ```
335
+ */
336
+ export declare function searchByName(query?: string): Promise<Airport[]>;
337
+ /**
338
+ * Finds airports within a specified radius of a geographic point.
339
+ * Uses a bounding-box pre-filter to skip expensive Haversine calculations for distant airports.
340
+ *
341
+ * @param lat - Latitude of the center point (-90 to 90).
342
+ * @param lon - Longitude of the center point (-180 to 180).
343
+ * @param radiusKm - The search radius in kilometers (default: 100).
344
+ * @param limit - Optional maximum number of results to return (nearest first).
345
+ * @returns Airports within the radius, nearest first, each with its `distance` in kilometers.
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * // Find airports within 50km of central London
350
+ * const airports = await findNearbyAirports(51.5074, -0.1278, 50);
351
+ * console.log(airports[0].iata, airports[0].distance); // "LHR" 23.3
352
+ * ```
353
+ */
354
+ export declare function findNearbyAirports(lat: number, lon: number, radiusKm?: number, limit?: number): Promise<AirportWithDistance[]>;
355
+ /**
356
+ * Finds airports by their type classification.
357
+ * Uses a pre-built index for O(1) lookup on exact matches.
358
+ *
359
+ * Valid types: "large_airport", "medium_airport", "small_airport", "heliport",
360
+ * "seaplane_base", "closed". Pass "airport" to match all airport types.
361
+ *
362
+ * @param type - The type of airport to filter by (case-insensitive).
363
+ * @returns Array of matching airport objects.
364
+ * @throws If the type is not a non-empty string.
365
+ *
366
+ * @example
367
+ * ```typescript
368
+ * const largeAirports = await getAirportsByType('large_airport');
369
+ * console.log(largeAirports.length); // 300+
370
+ * ```
371
+ */
372
+ export declare function getAirportsByType(type?: string, limit?: number): Promise<Airport[]>;
373
+ /**
374
+ * Calculates the great-circle distance between two airports using the Haversine formula.
375
+ *
376
+ * @param code1 - The IATA or ICAO code of the first airport.
377
+ * @param code2 - The IATA or ICAO code of the second airport.
378
+ * @returns The distance in kilometers, or null if an airport is not found.
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * const km = await calculateDistance('LHR', 'JFK');
383
+ * console.log(Math.round(km!)); // 5541
384
+ * ```
385
+ */
386
+ export declare function calculateDistance(code1: string, code2: string): Promise<number | null>;
387
+ /**
388
+ * Provides autocomplete suggestions based on a partial query.
389
+ * Matches IATA/ICAO codes, city names, city codes, and airport names, ranked like {@link search}
390
+ * (major airports with scheduled service first). Returns up to 10 results.
391
+ *
392
+ * @param query - The partial query string (2-100 characters).
393
+ * @returns Array of up to 10 matching airports.
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * const suggestions = await getAutocompleteSuggestions('Lon');
398
+ * // Returns airports matching "Lon" (London Heathrow, London Gatwick, etc.)
399
+ * ```
400
+ */
401
+ export declare function getAutocompleteSuggestions(query?: string): Promise<Airport[]>;
402
+ /**
403
+ * Unified, ranked airport search across codes, cities, and names.
404
+ *
405
+ * Ranking: exact IATA > exact ICAO > IATA city/metro code ("NYC", "LON") > exact city >
406
+ * city prefix > name prefix > name word prefix > substring > typo-tolerant match.
407
+ * Within each tier, large airports with scheduled service rank first.
408
+ * Matching is case- and accent-insensitive ("zurich" finds "Zürich").
409
+ *
410
+ * @param query - Search text (2-100 characters): a code, a city, or part of a name.
411
+ * @param options - Optional limit and filters.
412
+ * @returns Ranked results, each with a `score` and `matchType`.
413
+ * @throws If the query is too short/long or the limit is out of range.
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * const results = await search('New York');
418
+ * console.log(results.map(a => a.iata)); // ["JFK", "LGA", ...]
419
+ *
420
+ * await search('LON'); // LHR, LGW, STN, LTN, LCY...
421
+ * await search('heathrow'); // LHR
422
+ * await search('frankfrut'); // typo-tolerant: FRA
423
+ * await search('paris', { scheduledOnly: true, limit: 3 });
424
+ * ```
425
+ */
426
+ export declare function search(query?: string, options?: SearchOptions): Promise<AirportSearchResult[]>;
427
+ /**
428
+ * Finds airports serving a city. Case- and accent-insensitive exact match on the city name,
429
+ * ordered with major scheduled-service airports first. Common former and alternative names
430
+ * are recognized ("Bombay", "Bangalore", "Peking", "Athens", "Roma").
431
+ *
432
+ * Note that some airports list the municipality they sit in rather than the metro area they
433
+ * serve (e.g., EWR is "Newark"). Use {@link getAirportsByCityCode} for metro-area lookups.
434
+ *
435
+ * @param city - City name (e.g., "London", "São Paulo", "sao paulo").
436
+ * @returns Array of matching airports (empty if none).
437
+ * @throws If the city is not a non-empty string.
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * const airports = await getAirportsByCity('London');
442
+ * console.log(airports[0].iata); // "LHR"
443
+ * ```
444
+ */
445
+ export declare function getAirportsByCity(city?: string): Promise<Airport[]>;
446
+ /**
447
+ * Finds all airports sharing an IATA city/metropolitan area code
448
+ * (e.g., "NYC" → JFK, LGA, EWR; "LON" → LHR, LGW, STN, LTN, LCY, SEN).
449
+ * Ordered with major scheduled-service airports first.
450
+ *
451
+ * @param cityCode - 3-letter uppercase IATA city code.
452
+ * @returns Array of matching airports (empty if none).
453
+ * @throws If the code format is invalid.
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * const nyc = await getAirportsByCityCode('NYC');
458
+ * console.log(nyc.map(a => a.iata)); // ["JFK", "EWR", "LGA", ...]
459
+ * ```
460
+ */
461
+ export declare function getAirportsByCityCode(cityCode?: string): Promise<Airport[]>;
462
+ /**
463
+ * Gets an airport's real UTC offset at a given moment, accounting for daylight saving time.
464
+ * Prefer this over the static `utc` field, which is a July snapshot.
465
+ *
466
+ * @param code - IATA or ICAO code.
467
+ * @param date - The instant to evaluate (default: now).
468
+ * @returns Offset in hours (e.g., -5, 5.5), or null if the airport is not found.
469
+ * @throws If the date is invalid.
470
+ *
471
+ * @example
472
+ * ```typescript
473
+ * await getUtcOffset('JFK', '2026-07-01T12:00:00Z'); // -4 (EDT)
474
+ * await getUtcOffset('JFK', '2026-12-01T12:00:00Z'); // -5 (EST)
475
+ * await getUtcOffset('DEL'); // 5.5
476
+ * ```
477
+ */
478
+ export declare function getUtcOffset(code: string, date?: DateInput): Promise<number | null>;
479
+ /**
480
+ * Gets the local date and time at an airport, accounting for daylight saving time.
481
+ *
482
+ * @param code - IATA or ICAO code.
483
+ * @param date - The instant to convert (default: now).
484
+ * @returns Local time details, or null if the airport is not found.
485
+ * @throws If the date is invalid.
486
+ *
487
+ * @example
488
+ * ```typescript
489
+ * const t = await getLocalTime('LHR', '2026-07-01T12:00:00Z');
490
+ * console.log(t?.iso); // "2026-07-01T13:00:00+01:00"
491
+ * console.log(t?.isDst); // true
492
+ * ```
493
+ */
494
+ export declare function getLocalTime(code: string, date?: DateInput): Promise<AirportLocalTime | null>;
495
+ /**
496
+ * Formats an instant in an airport's local time using `Intl.DateTimeFormat`.
497
+ *
498
+ * @param code - IATA or ICAO code.
499
+ * @param options - `date` (default: now), `locale` (default: "en-US"), and any
500
+ * Intl.DateTimeFormat options. Defaults to `{ dateStyle: 'medium', timeStyle: 'short' }`
501
+ * when no date/time fields are given.
502
+ * @returns The formatted string, or null if the airport is not found.
503
+ * @throws If the date is invalid.
504
+ *
505
+ * @example
506
+ * ```typescript
507
+ * await formatAirportTime('NRT', { date: '2026-11-10T00:00:00Z' });
508
+ * // "Nov 10, 2026, 9:00 AM"
509
+ * await formatAirportTime('CDG', { locale: 'fr-FR', timeStyle: 'short' });
510
+ * // "14:05"
511
+ * ```
512
+ */
513
+ export declare function formatAirportTime(code: string, options?: FormatAirportTimeOptions): Promise<string | null>;
514
+ /**
515
+ * Finds airports that match multiple filter criteria (combined with AND logic).
516
+ * Uses indexed lookups where possible for performance.
517
+ *
518
+ * @param filters - An object of filter criteria to apply.
519
+ * @returns Array of matching airports.
520
+ * @throws If an unrecognized filter key is provided.
521
+ *
522
+ * @example
523
+ * ```typescript
524
+ * const airports = await findAirports({
525
+ * country_code: 'GB',
526
+ * type: 'large_airport',
527
+ * has_scheduled_service: true
528
+ * });
529
+ * ```
530
+ */
531
+ export declare function findAirports(filters?: AirportFilters): Promise<Airport[]>;
532
+ /**
533
+ * Finds all airports within a specific IANA timezone.
534
+ * Uses a pre-built index for O(1) lookup.
535
+ *
536
+ * @param timezone - The IANA timezone identifier (e.g., 'Europe/London', 'Asia/Singapore').
537
+ * @returns Array of matching airports.
538
+ * @throws If the timezone string is empty.
539
+ *
540
+ * @example
541
+ * ```typescript
542
+ * const airports = await getAirportsByTimezone('Europe/London');
543
+ * console.log(airports.every(a => a.time === 'Europe/London')); // true
544
+ * ```
545
+ */
546
+ export declare function getAirportsByTimezone(timezone?: string): Promise<Airport[]>;
547
+ /**
548
+ * Gets a map of external links (Wikipedia, FlightRadar24, etc.) for an airport.
549
+ *
550
+ * @param code - The IATA or ICAO code of the airport.
551
+ * @returns An object of links, or null if the airport is not found.
552
+ *
553
+ * @example
554
+ * ```typescript
555
+ * const links = await getAirportLinks('LHR');
556
+ * console.log(links?.wikipedia); // "https://en.wikipedia.org/wiki/Heathrow_Airport"
557
+ * ```
558
+ */
559
+ export declare function getAirportLinks(code: string): Promise<AirportLinks | null>;
560
+ /**
561
+ * Gets comprehensive statistics about airports in a specific country.
562
+ * Includes counts by type, average runway length, average elevation, and timezones.
563
+ *
564
+ * @param countryCode - The 2-letter ISO country code (e.g., 'US').
565
+ * @returns Aggregated statistics object.
566
+ * @throws If the country code format is invalid or no airports are found.
567
+ *
568
+ * @example
569
+ * ```typescript
570
+ * const stats = await getAirportStatsByCountry('US');
571
+ * console.log(stats.total); // 19000+
572
+ * console.log(stats.byType.large_airport); // 180+
573
+ * console.log(stats.withScheduledService); // number
574
+ * ```
575
+ */
576
+ export declare function getAirportStatsByCountry(countryCode?: string): Promise<AirportCountryStats>;
577
+ /**
578
+ * Gets comprehensive statistics about airports on a specific continent.
579
+ * Includes counts by type, by country, average runway length, average elevation, and timezones.
580
+ *
581
+ * @param continentCode - The 2-letter continent code (e.g., 'AS' for Asia).
582
+ * @returns Aggregated statistics object with country breakdown.
583
+ * @throws If the continent code format is invalid or no airports are found.
584
+ *
585
+ * @example
586
+ * ```typescript
587
+ * const stats = await getAirportStatsByContinent('EU');
588
+ * console.log(stats.byCountry['GB']); // number of UK airports
589
+ * console.log(stats.byCountry['FR']); // number of French airports
590
+ * ```
591
+ */
592
+ export declare function getAirportStatsByContinent(continentCode?: string): Promise<AirportContinentStats>;
593
+ /**
594
+ * Gets the largest airports on a continent, ranked by runway length or elevation.
595
+ *
596
+ * @param continentCode - The 2-letter continent code (e.g., 'AS').
597
+ * @param limit - Maximum number of airports to return (1-1000, default: 10).
598
+ * @param sortBy - Sort criteria: 'runway' or 'elevation' (default: 'runway').
599
+ * @returns Array of airports sorted by the specified criteria (descending).
600
+ * @throws If the continent code format is invalid.
601
+ *
602
+ * @example
603
+ * ```typescript
604
+ * const top5 = await getLargestAirportsByContinent('AS', 5, 'runway');
605
+ * console.log(top5[0].runway_length); // longest runway in Asia
606
+ * ```
607
+ */
608
+ export declare function getLargestAirportsByContinent(continentCode?: string, limit?: number, sortBy?: SortBy): Promise<Airport[]>;
609
+ /**
610
+ * Fetches multiple airports by their IATA or ICAO codes in a single call.
611
+ * Returns null for codes that don't match any airport.
612
+ *
613
+ * @param codes - Array of IATA or ICAO codes (max 500).
614
+ * @returns Array of airport objects (null for unresolved codes), in the same order as input.
615
+ * @throws If codes is not an array or exceeds 500 entries.
616
+ *
617
+ * @example
618
+ * ```typescript
619
+ * const airports = await getMultipleAirports(['SIN', 'LHR', 'JFK']);
620
+ * console.log(airports[0]?.iata); // "SIN"
621
+ * console.log(airports[1]?.iata); // "LHR"
622
+ * ```
623
+ */
624
+ export declare function getMultipleAirports(codes?: string[]): Promise<(Airport | null)[]>;
625
+ /**
626
+ * Calculates the great-circle distance between all pairs of airports.
627
+ * Exploits distance symmetry (d(A,B) === d(B,A)) to halve calculations.
628
+ *
629
+ * @param codes - Array of IATA or ICAO codes (2-100).
630
+ * @returns Distance matrix with airport summaries and symmetric distance table.
631
+ * @throws If fewer than 2 codes or any code is invalid.
632
+ *
633
+ * @example
634
+ * ```typescript
635
+ * const matrix = await calculateDistanceMatrix(['SIN', 'LHR', 'JFK']);
636
+ * console.log(matrix.distances['SIN']['LHR']); // distance in km
637
+ * console.log(matrix.distances['LHR']['SIN']); // same value (symmetric)
638
+ * ```
639
+ */
640
+ export declare function calculateDistanceMatrix(codes?: string[]): Promise<DistanceMatrix>;
641
+ /**
642
+ * Finds the single nearest airport to given coordinates, optionally filtered.
643
+ *
644
+ * @param lat - Latitude of the search point (-90 to 90).
645
+ * @param lon - Longitude of the search point (-180 to 180).
646
+ * @param filters - Optional filter criteria (e.g., `{ type: 'large_airport' }`).
647
+ * @returns The nearest airport with a `distance` field (km), or null if none found.
648
+ *
649
+ * @example
650
+ * ```typescript
651
+ * // Nearest large airport to central NYC
652
+ * const nearest = await findNearestAirport(40.7128, -74.006, { type: 'large_airport' });
653
+ * console.log(nearest?.iata); // e.g., "EWR"
654
+ * console.log(nearest?.distance); // distance in km
655
+ * ```
656
+ */
657
+ export declare function findNearestAirport(lat: number, lon: number, filters?: AirportFilters): Promise<AirportWithDistance | null>;
658
+ /**
659
+ * Validates whether an IATA code exists in the airport database.
660
+ *
661
+ * @param code - The 3-letter IATA code to validate.
662
+ * @returns True if the code exists, false otherwise.
663
+ *
664
+ * @example
665
+ * ```typescript
666
+ * await validateIataCode('SIN'); // true
667
+ * await validateIataCode('ZZZ'); // false
668
+ * ```
669
+ */
670
+ export declare function validateIataCode(code?: string): Promise<boolean>;
671
+ /**
672
+ * Validates whether an ICAO code exists in the airport database.
673
+ *
674
+ * @param code - The 4-character ICAO code to validate.
675
+ * @returns True if the code exists, false otherwise.
676
+ *
677
+ * @example
678
+ * ```typescript
679
+ * await validateIcaoCode('WSSS'); // true
680
+ * await validateIcaoCode('XXXX'); // false
681
+ * ```
682
+ */
683
+ export declare function validateIcaoCode(code?: string): Promise<boolean>;
684
+ /**
685
+ * Gets the count of airports matching the given filters without returning full airport data.
686
+ *
687
+ * @param filters - Optional filter criteria. Omit for total count.
688
+ * @returns Count of matching airports.
689
+ *
690
+ * @example
691
+ * ```typescript
692
+ * const total = await getAirportCount(); // all airports
693
+ * const usLarge = await getAirportCount({ country_code: 'US', type: 'large_airport' });
694
+ * ```
695
+ */
696
+ export declare function getAirportCount(filters?: AirportFilters): Promise<number>;
697
+ /**
698
+ * Checks if an airport has scheduled commercial service.
699
+ *
700
+ * @param code - The IATA or ICAO code of the airport.
701
+ * @returns True if the airport has scheduled service.
702
+ * @throws If the airport is not found.
703
+ *
704
+ * @example
705
+ * ```typescript
706
+ * await isAirportOperational('SIN'); // true (Changi has scheduled flights)
707
+ * await isAirportOperational('WSSS'); // true (same airport, ICAO code)
708
+ * ```
709
+ */
710
+ export declare function isAirportOperational(code: string): Promise<boolean>;