airport-data-js 3.1.0 → 4.0.0
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.
- package/README.md +35 -24
- package/dist/airport-data.min.js +1 -1
- package/lib/index.js +1 -1
- package/lib/tools.js +1 -1
- package/package.json +34 -25
- package/types/index.d.ts +15 -18
package/lib/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";
|
|
1
|
+
(()=>{"use strict";let e={};(()=>{let t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.airportTools=void 0,t.airportTools=[{name:"getAirportByIata",description:'Look up an airport by its 3-letter IATA code (e.g., "LHR" for London Heathrow, "JFK" for New York JFK, "SIN" for Singapore Changi). Returns full airport details including location, timezone, and links.',parameters:{type:"object",properties:{iataCode:{type:"string",description:'3-letter uppercase IATA airport code (e.g., "LHR", "JFK", "SIN")'}},required:["iataCode"]}},{name:"getAirportByIcao",description:'Look up an airport by its 4-character ICAO code (e.g., "EGLL" for London Heathrow, "KJFK" for New York JFK). Returns full airport details.',parameters:{type:"object",properties:{icaoCode:{type:"string",description:'4-character uppercase ICAO airport code (e.g., "EGLL", "KJFK", "WSSS")'}},required:["icaoCode"]}},{name:"getAirportByCountryCode",description:'Get all airports in a country by its ISO 3166-1 alpha-2 code (e.g., "US" for United States, "GB" for United Kingdom, "SG" for Singapore).',parameters:{type:"object",properties:{countryCode:{type:"string",description:'2-letter uppercase ISO country code (e.g., "US", "GB", "SG")'}},required:["countryCode"]}},{name:"getAirportByContinent",description:"Get all airports on a continent. Valid codes: AF (Africa), AN (Antarctica), AS (Asia), EU (Europe), NA (North America), OC (Oceania), SA (South America).",parameters:{type:"object",properties:{continentCode:{type:"string",description:"2-letter continent code",enum:["AF","AN","AS","EU","NA","OC","SA"]}},required:["continentCode"]}},{name:"searchByName",description:'Search for airports by name using case-insensitive partial matching. Use this when you have an airport name but not its code (e.g., "Heathrow", "Changi", "Charles de Gaulle").',parameters:{type:"object",properties:{query:{type:"string",description:"Airport name or partial name to search for (2-100 characters)"}},required:["query"]}},{name:"findNearbyAirports",description:"Find all airports within a radius of a geographic point. Useful for finding airports near a city or location.",parameters:{type:"object",properties:{lat:{type:"number",description:"Latitude in decimal degrees (-90 to 90)",minimum:-90,maximum:90},lon:{type:"number",description:"Longitude in decimal degrees (-180 to 180)",minimum:-180,maximum:180},radiusKm:{type:"number",description:"Search radius in kilometers",default:100}},required:["lat","lon"]}},{name:"getAirportsByType",description:'Filter airports by classification type. Types: "large_airport", "medium_airport", "small_airport", "heliport", "seaplane_base", "closed". Pass "airport" to get all airport types.',parameters:{type:"object",properties:{type:{type:"string",description:"Airport type classification",enum:["large_airport","medium_airport","small_airport","heliport","seaplane_base","closed","airport"]}},required:["type"]}},{name:"getAutocompleteSuggestions",description:"Get autocomplete suggestions for airports based on partial input. Searches by airport name and IATA code. Returns up to 10 results.",parameters:{type:"object",properties:{query:{type:"string",description:"Partial search query (2-100 characters)"}},required:["query"]}},{name:"calculateDistance",description:"Calculate the great-circle (Haversine) distance in kilometers between two airports. Accepts either IATA or ICAO codes.",parameters:{type:"object",properties:{code1:{type:"string",description:"IATA or ICAO code of the first airport"},code2:{type:"string",description:"IATA or ICAO code of the second airport"}},required:["code1","code2"]}},{name:"getAirportLinks",description:"Get external links for an airport including Wikipedia, official website, FlightRadar24, RadarBox, and FlightAware URLs.",parameters:{type:"object",properties:{code:{type:"string",description:"IATA or ICAO code of the airport"}},required:["code"]}},{name:"getAirportsByTimezone",description:'Get all airports in a specific IANA timezone (e.g., "Europe/London", "Asia/Singapore", "America/New_York").',parameters:{type:"object",properties:{timezone:{type:"string",description:'IANA timezone identifier (e.g., "Europe/London")'}},required:["timezone"]}},{name:"findAirports",description:"Advanced multi-criteria airport search. Combine filters with AND logic. Supports country, continent, type, timezone, scheduled service, and minimum runway length filters.",parameters:{type:"object",properties:{country_code:{type:"string",description:"2-letter ISO country code filter"},continent:{type:"string",description:"2-letter continent code filter",enum:["AF","AN","AS","EU","NA","OC","SA"]},type:{type:"string",description:"Airport type filter",enum:["large_airport","medium_airport","small_airport","heliport","seaplane_base","closed"]},has_scheduled_service:{type:"boolean",description:"Filter by scheduled commercial service availability"},min_runway_ft:{type:"number",description:"Minimum runway length in feet"},time:{type:"string",description:"IANA timezone filter"}},required:[]}},{name:"getAirportStatsByCountry",description:"Get aggregated airport statistics for a country: total count, breakdown by type, scheduled service count, average runway length, average elevation, and timezones.",parameters:{type:"object",properties:{countryCode:{type:"string",description:"2-letter uppercase ISO country code"}},required:["countryCode"]}},{name:"getAirportStatsByContinent",description:"Get aggregated airport statistics for a continent: total count, breakdown by type and country, scheduled service count, average runway length, and average elevation.",parameters:{type:"object",properties:{continentCode:{type:"string",description:"2-letter continent code",enum:["AF","AN","AS","EU","NA","OC","SA"]}},required:["continentCode"]}},{name:"getLargestAirportsByContinent",description:"Get the top airports on a continent ranked by runway length or elevation.",parameters:{type:"object",properties:{continentCode:{type:"string",description:"2-letter continent code",enum:["AF","AN","AS","EU","NA","OC","SA"]},limit:{type:"number",description:"Number of results to return (1-1000)",default:10},sortBy:{type:"string",description:"Ranking criteria",enum:["runway","elevation"]}},required:["continentCode"]}},{name:"getMultipleAirports",description:"Fetch multiple airports in a single call by their IATA or ICAO codes. Returns null for unresolved codes. Maximum 500 codes.",parameters:{type:"object",properties:{codes:{type:"array",description:"Array of IATA or ICAO codes",items:{type:"string"}}},required:["codes"]}},{name:"calculateDistanceMatrix",description:"Calculate distances between all pairs of airports. Returns a symmetric distance matrix. Maximum 100 codes.",parameters:{type:"object",properties:{codes:{type:"array",description:"Array of 2-100 IATA or ICAO codes",items:{type:"string"}}},required:["codes"]}},{name:"findNearestAirport",description:"Find the single closest airport to a geographic point, optionally filtered by type, country, or other criteria.",parameters:{type:"object",properties:{lat:{type:"number",description:"Latitude in decimal degrees (-90 to 90)",minimum:-90,maximum:90},lon:{type:"number",description:"Longitude in decimal degrees (-180 to 180)",minimum:-180,maximum:180},type:{type:"string",description:"Optional airport type filter",enum:["large_airport","medium_airport","small_airport","heliport","seaplane_base"]},country_code:{type:"string",description:"Optional 2-letter country code filter"}},required:["lat","lon"]}},{name:"validateIataCode",description:"Check whether a 3-letter IATA code exists in the airport database. Returns true/false.",parameters:{type:"object",properties:{code:{type:"string",description:"3-letter IATA code to validate"}},required:["code"]}},{name:"validateIcaoCode",description:"Check whether a 4-character ICAO code exists in the airport database. Returns true/false.",parameters:{type:"object",properties:{code:{type:"string",description:"4-character ICAO code to validate"}},required:["code"]}},{name:"getAirportCount",description:"Get the count of airports matching optional filters. Call with no filters for the total number of airports in the database.",parameters:{type:"object",properties:{country_code:{type:"string",description:"Optional country code filter"},type:{type:"string",description:"Optional airport type filter"},continent:{type:"string",description:"Optional continent code filter"}},required:[]}},{name:"isAirportOperational",description:"Check whether an airport has scheduled commercial service (is operational). Accepts IATA or ICAO code.",parameters:{type:"object",properties:{code:{type:"string",description:"IATA or ICAO code of the airport"}},required:["code"]}}]})(),module.exports=e})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airport-data-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "A comprehensive TypeScript library providing easy retrieval of airport data based on IATA, ICAO, city codes, country codes, and continents. Includes LLM tool definitions for AI integration.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -26,17 +26,22 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "
|
|
29
|
+
"test": "vitest run",
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
31
|
"build:types": "tsc --emitDeclarationOnly",
|
|
32
|
+
"build:transpile": "tsc -p tsconfig.build.json",
|
|
32
33
|
"build:lib": "webpack --config webpack.node.cjs",
|
|
33
34
|
"build:dist": "webpack --config webpack.browser.cjs",
|
|
34
35
|
"build:tools": "webpack --config webpack.tools.cjs",
|
|
35
|
-
"build": "npm run build:types && npm run build:lib && npm run build:dist && npm run build:tools",
|
|
36
|
-
"check:duplicates": "
|
|
36
|
+
"build": "npm run build:types && npm run build:transpile && npm run build:lib && npm run build:dist && npm run build:tools",
|
|
37
|
+
"check:duplicates": "tsx scripts/check_duplicates.ts",
|
|
38
|
+
"generate:json": "tsx scripts/csv_to_json.ts",
|
|
39
|
+
"generate:compressed": "tsx scripts/compress_json.ts",
|
|
40
|
+
"benchmark": "tsx scripts/benchmark.ts",
|
|
41
|
+
"changelog:extract": "tsx scripts/extract_latest_changelog.ts"
|
|
37
42
|
},
|
|
38
43
|
"dependencies": {
|
|
39
|
-
"
|
|
44
|
+
"pako": "^3.0.2"
|
|
40
45
|
},
|
|
41
46
|
"repository": {
|
|
42
47
|
"type": "git",
|
|
@@ -66,31 +71,35 @@
|
|
|
66
71
|
],
|
|
67
72
|
"author": "Aashish Vivekanand",
|
|
68
73
|
"license": "CC BY 4.0",
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
76
|
+
},
|
|
69
77
|
"bugs": {
|
|
70
78
|
"url": "https://github.com/aashishvanand/airport-data-js/issues"
|
|
71
79
|
},
|
|
72
80
|
"homepage": "https://airportdata.dev/",
|
|
81
|
+
"overrides": {
|
|
82
|
+
"brace-expansion@1": "^1.1.14",
|
|
83
|
+
"brace-expansion@2": "^2.1.0",
|
|
84
|
+
"ajv@8": "^8.18.0",
|
|
85
|
+
"fast-uri": "^3.1.4",
|
|
86
|
+
"postcss": "^8.5.18",
|
|
87
|
+
"browserslist": "^4.28.7",
|
|
88
|
+
"baseline-browser-mapping": "^2.11.0"
|
|
89
|
+
},
|
|
73
90
|
"devDependencies": {
|
|
74
|
-
"@babel/core": "^
|
|
75
|
-
"@babel/plugin-transform-modules-commonjs": "^
|
|
76
|
-
"@babel/preset-env": "^
|
|
77
|
-
"@types/
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"countries-and-timezones": "^3.8.0",
|
|
82
|
-
"countries-list": "^3.2.2",
|
|
83
|
-
"csv-parse": "^6.1.0",
|
|
84
|
-
"csv-stringify": "^6.6.0",
|
|
85
|
-
"fs-extra": "^11.3.3",
|
|
86
|
-
"geo-tz": "^8.1.5",
|
|
87
|
-
"jest": "^30.2.0",
|
|
91
|
+
"@babel/core": "^8.0.5",
|
|
92
|
+
"@babel/plugin-transform-modules-commonjs": "^8.0.1",
|
|
93
|
+
"@babel/preset-env": "^8.0.5",
|
|
94
|
+
"@types/node": "^26.1.1",
|
|
95
|
+
"babel-loader": "^10.1.1",
|
|
96
|
+
"csv-parse": "^7.0.2",
|
|
97
|
+
"fs-extra": "^11.4.0",
|
|
88
98
|
"path-browserify": "^1.0.1",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"webpack": "^
|
|
94
|
-
"webpack-cli": "^7.0.2"
|
|
99
|
+
"tsx": "^4.23.13",
|
|
100
|
+
"typescript": "^7.0.2",
|
|
101
|
+
"vitest": "^5.0.0",
|
|
102
|
+
"webpack": "^5.110.3",
|
|
103
|
+
"webpack-cli": "^7.2.3"
|
|
95
104
|
}
|
|
96
105
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -15,22 +15,20 @@ export interface Airport {
|
|
|
15
15
|
icao: string;
|
|
16
16
|
/** IANA timezone identifier (e.g., "Asia/Singapore") */
|
|
17
17
|
time: string;
|
|
18
|
-
/** UTC offset
|
|
19
|
-
utc:
|
|
18
|
+
/** UTC offset in hours (e.g., 8, 5.5, -3.5). A DST-aware snapshot, not a fixed standard offset. */
|
|
19
|
+
utc: number;
|
|
20
20
|
/** ISO 3166-1 alpha-2 country code (e.g., "SG", "GB", "US") */
|
|
21
21
|
country_code: string;
|
|
22
22
|
/** 2-letter continent code: AF, AN, AS, EU, NA, OC, SA */
|
|
23
23
|
continent: string;
|
|
24
24
|
/** Full airport name (e.g., "Singapore Changi Airport") */
|
|
25
25
|
airport: string;
|
|
26
|
-
/** Latitude in decimal degrees
|
|
27
|
-
latitude:
|
|
28
|
-
/** Longitude in decimal degrees
|
|
29
|
-
longitude:
|
|
30
|
-
/** Elevation above sea level in feet
|
|
31
|
-
|
|
32
|
-
/** Elevation in feet (string, same as elevation) */
|
|
33
|
-
elevation_ft: string;
|
|
26
|
+
/** Latitude in decimal degrees */
|
|
27
|
+
latitude: number;
|
|
28
|
+
/** Longitude in decimal degrees */
|
|
29
|
+
longitude: number;
|
|
30
|
+
/** Elevation above sea level in feet, or null when unknown */
|
|
31
|
+
elevation_ft: number | null;
|
|
34
32
|
/** Airport classification: "large_airport" | "medium_airport" | "small_airport" | "heliport" | "seaplane_base" | "closed" */
|
|
35
33
|
type: string;
|
|
36
34
|
/** Whether the airport has scheduled commercial service */
|
|
@@ -39,8 +37,8 @@ export interface Airport {
|
|
|
39
37
|
wikipedia?: string;
|
|
40
38
|
/** Airport official website URL */
|
|
41
39
|
website?: string;
|
|
42
|
-
/** Longest runway length in feet
|
|
43
|
-
runway_length?:
|
|
40
|
+
/** Longest runway length in feet, or null when unknown */
|
|
41
|
+
runway_length?: number | null;
|
|
44
42
|
/** FlightRadar24 tracking URL */
|
|
45
43
|
flightradar24_url?: string;
|
|
46
44
|
/** RadarBox tracking URL */
|
|
@@ -78,19 +76,18 @@ export interface AirportFilters {
|
|
|
78
76
|
iata?: string;
|
|
79
77
|
icao?: string;
|
|
80
78
|
time?: string;
|
|
81
|
-
utc?:
|
|
79
|
+
utc?: number;
|
|
82
80
|
country_code?: string;
|
|
83
81
|
continent?: string;
|
|
84
82
|
airport?: string;
|
|
85
|
-
latitude?:
|
|
86
|
-
longitude?:
|
|
87
|
-
elevation_ft?:
|
|
88
|
-
elevation?: string;
|
|
83
|
+
latitude?: number;
|
|
84
|
+
longitude?: number;
|
|
85
|
+
elevation_ft?: number | null;
|
|
89
86
|
type?: string;
|
|
90
87
|
scheduled_service?: boolean | string;
|
|
91
88
|
wikipedia?: string;
|
|
92
89
|
website?: string;
|
|
93
|
-
runway_length?:
|
|
90
|
+
runway_length?: number | null;
|
|
94
91
|
flightradar24_url?: string;
|
|
95
92
|
radarbox_url?: string;
|
|
96
93
|
flightaware_url?: string;
|