airport-db 0.1.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/dist/bin/airport-db.d.ts +3 -0
  4. package/dist/bin/airport-db.d.ts.map +1 -0
  5. package/dist/bin/airport-db.js +5 -0
  6. package/dist/bin/airport-db.js.map +1 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +406 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/database.d.ts +8 -0
  12. package/dist/database.d.ts.map +1 -0
  13. package/dist/database.js +48 -0
  14. package/dist/database.js.map +1 -0
  15. package/dist/index.d.ts +7 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +10 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/queries.d.ts +42 -0
  20. package/dist/queries.d.ts.map +1 -0
  21. package/dist/queries.js +231 -0
  22. package/dist/queries.js.map +1 -0
  23. package/dist/types/airport.d.ts +62 -0
  24. package/dist/types/airport.d.ts.map +1 -0
  25. package/dist/types/airport.js +2 -0
  26. package/dist/types/airport.js.map +1 -0
  27. package/dist/types/index.d.ts +5 -0
  28. package/dist/types/index.d.ts.map +1 -0
  29. package/dist/types/index.js +2 -0
  30. package/dist/types/index.js.map +1 -0
  31. package/dist/types/infrastructure.d.ts +69 -0
  32. package/dist/types/infrastructure.d.ts.map +1 -0
  33. package/dist/types/infrastructure.js +2 -0
  34. package/dist/types/infrastructure.js.map +1 -0
  35. package/dist/types/operational.d.ts +30 -0
  36. package/dist/types/operational.d.ts.map +1 -0
  37. package/dist/types/operational.js +2 -0
  38. package/dist/types/operational.js.map +1 -0
  39. package/dist/types/search.d.ts +32 -0
  40. package/dist/types/search.d.ts.map +1 -0
  41. package/dist/types/search.js +2 -0
  42. package/dist/types/search.js.map +1 -0
  43. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tabletop ANDROID
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # airport-db
2
+
3
+ **Type-safe TypeScript library for querying airport data.** Comprehensive global coverage with ICAO, IATA, and FAA codes. Runway, tower, and operational data included.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install airport-db @tabletopandroid/airport-db-data-sqlite
9
+ ```
10
+
11
+ ## Use
12
+
13
+ ```typescript
14
+ import { getAirportByICAO, getAirportsByCountry } from "airport-db";
15
+
16
+ const airport = getAirportByICAO("KLZU");
17
+ console.log(airport?.identity.name); // Gwinnett County Airport
18
+
19
+ const us = getAirportsByCountry("US");
20
+ console.log(`${us.length} airports in the US`);
21
+ ```
22
+
23
+ ## Get Started
24
+
25
+ - **[Quick Start](./docs/quick-start.md)** — Installation & first query
26
+ - **[API Reference](./docs/api-reference.md)** — All functions & types
27
+ - **[Examples](./docs/examples.md)** — Common use cases
28
+ - **[CLI](./docs/cli.md)** — Command-line tool
29
+ - **[Data Structure](./docs/data-structure.md)** — Type definitions
30
+
31
+ ## Features
32
+
33
+ ✅ **40k+ airports** worldwide
34
+ ✅ **Type-safe** TypeScript first
35
+ ✅ **Runway data** dimensions, surfaces, lighting
36
+ ✅ **Operational** AIRAC cycles, frequencies
37
+ ✅ **Fast queries** SQLite-backed
38
+ ✅ **Simple API** Find by name, code, location, type
39
+
40
+ ## License
41
+
42
+ [MIT](./LICENSE) — Use freely, modify, and share
43
+
44
+ ---
45
+
46
+ Built with ✈️ for aviation developers
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=airport-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airport-db.d.ts","sourceRoot":"","sources":["../../src/bin/airport-db.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { runCLI } from "../cli.js";
3
+ // Pass command-line arguments (skip node path and script path)
4
+ runCLI(process.argv.slice(2));
5
+ //# sourceMappingURL=airport-db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airport-db.js","sourceRoot":"","sources":["../../src/bin/airport-db.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,+DAA+D;AAC/D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function runCLI(args: string[]): void;
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAqdA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAE3C"}
package/dist/cli.js ADDED
@@ -0,0 +1,406 @@
1
+ import { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import { getAirportByICAO, getAirportByIATA, getAirportByFAA, getAirportsByCountry, getAirportsByState, getAirportsByCity, getAirportsByType, getAirportsWithTowers, searchAirports, countAirports, closeDatabase, } from "./index.js";
4
+ const program = new Command();
5
+ program
6
+ .name("airport-db")
7
+ .description("Query airport data from the command line")
8
+ .version("0.1.0")
9
+ .option("--icao <code>", "Get airport by ICAO code")
10
+ .option("--iata <code>", "Get airport by IATA code")
11
+ .option("--faa <code>", "Get airport by FAA code")
12
+ .option("--stats", "Show database statistics")
13
+ .action((options) => {
14
+ // Handle option-based queries at the root level
15
+ if (options.icao) {
16
+ try {
17
+ const airport = getAirportByICAO(options.icao.toUpperCase());
18
+ if (airport) {
19
+ printAirport(airport);
20
+ }
21
+ else {
22
+ console.log(chalk.yellow(`No airport found with ICAO code: ${options.icao}`));
23
+ }
24
+ }
25
+ catch (error) {
26
+ console.error(chalk.red("Error:"), error.message);
27
+ }
28
+ finally {
29
+ closeDatabase();
30
+ }
31
+ }
32
+ else if (options.iata) {
33
+ try {
34
+ const airport = getAirportByIATA(options.iata.toUpperCase());
35
+ if (airport) {
36
+ printAirport(airport);
37
+ }
38
+ else {
39
+ console.log(chalk.yellow(`No airport found with IATA code: ${options.iata}`));
40
+ }
41
+ }
42
+ catch (error) {
43
+ console.error(chalk.red("Error:"), error.message);
44
+ }
45
+ finally {
46
+ closeDatabase();
47
+ }
48
+ }
49
+ else if (options.faa) {
50
+ try {
51
+ const airport = getAirportByFAA(options.faa.toUpperCase());
52
+ if (airport) {
53
+ printAirport(airport);
54
+ }
55
+ else {
56
+ console.log(chalk.yellow(`No airport found with FAA code: ${options.faa}`));
57
+ }
58
+ }
59
+ catch (error) {
60
+ console.error(chalk.red("Error:"), error.message);
61
+ }
62
+ finally {
63
+ closeDatabase();
64
+ }
65
+ }
66
+ else if (options.stats) {
67
+ try {
68
+ const total = countAirports();
69
+ console.log(chalk.blue("Airport Database Statistics"));
70
+ console.log("");
71
+ console.log(`Total Airports: ${chalk.cyan(total)}`);
72
+ }
73
+ catch (error) {
74
+ console.error(chalk.red("Error:"), error.message);
75
+ }
76
+ finally {
77
+ closeDatabase();
78
+ }
79
+ }
80
+ });
81
+ // Get airport by ICAO
82
+ program
83
+ .command("icao <code>")
84
+ .description("Get airport by ICAO code")
85
+ .action((code) => {
86
+ try {
87
+ const airport = getAirportByICAO(code.toUpperCase());
88
+ if (airport) {
89
+ printAirport(airport);
90
+ }
91
+ else {
92
+ console.log(chalk.yellow(`No airport found with ICAO code: ${code}`));
93
+ }
94
+ }
95
+ catch (error) {
96
+ console.error(chalk.red("Error:"), error.message);
97
+ }
98
+ finally {
99
+ closeDatabase();
100
+ }
101
+ });
102
+ // Get airport by IATA
103
+ program
104
+ .command("iata <code>")
105
+ .description("Get airport by IATA code")
106
+ .action((code) => {
107
+ try {
108
+ const airport = getAirportByIATA(code.toUpperCase());
109
+ if (airport) {
110
+ printAirport(airport);
111
+ }
112
+ else {
113
+ console.log(chalk.yellow(`No airport found with IATA code: ${code}`));
114
+ }
115
+ }
116
+ catch (error) {
117
+ console.error(chalk.red("Error:"), error.message);
118
+ }
119
+ finally {
120
+ closeDatabase();
121
+ }
122
+ });
123
+ // Get airports by country
124
+ program
125
+ .command("country <code>")
126
+ .description("Get all airports in a country by ISO code")
127
+ .option("-l, --limit <n>", "Limit results", "20")
128
+ .action((code, options) => {
129
+ try {
130
+ const airports = getAirportsByCountry(code.toUpperCase());
131
+ const limit = parseInt(options.limit);
132
+ console.log(chalk.blue(`Found ${airports.length} airports in ${code.toUpperCase()}`));
133
+ console.log("");
134
+ airports.slice(0, limit).forEach((airport, index) => {
135
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} ${chalk.gray(airport.identity.iata || "N/A")} - ${airport.identity.name}`);
136
+ console.log(` Type: ${airport.identity.type}`);
137
+ console.log(` Location: ${airport.location.city}, ${airport.location.state}`);
138
+ console.log("");
139
+ });
140
+ if (airports.length > limit) {
141
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
142
+ }
143
+ }
144
+ catch (error) {
145
+ console.error(chalk.red("Error:"), error.message);
146
+ }
147
+ finally {
148
+ closeDatabase();
149
+ }
150
+ });
151
+ // Get airports by state
152
+ program
153
+ .command("state <state> [countryCode]")
154
+ .description("Get airports by state/province")
155
+ .option("-l, --limit <n>", "Limit results", "20")
156
+ .action((state, countryCode, options) => {
157
+ try {
158
+ const airports = getAirportsByState(state, countryCode);
159
+ const limit = parseInt(options.limit);
160
+ console.log(chalk.blue(`Found ${airports.length} airports in ${state}${countryCode ? ` (${countryCode})` : ""}`));
161
+ console.log("");
162
+ airports.slice(0, limit).forEach((airport, index) => {
163
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} - ${airport.identity.name}`);
164
+ console.log(` City: ${airport.location.city || "N/A"}`);
165
+ console.log("");
166
+ });
167
+ if (airports.length > limit) {
168
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
169
+ }
170
+ }
171
+ catch (error) {
172
+ console.error(chalk.red("Error:"), error.message);
173
+ }
174
+ finally {
175
+ closeDatabase();
176
+ }
177
+ });
178
+ // Get airports by city
179
+ program
180
+ .command("city <city>")
181
+ .description("Get airports in a city")
182
+ .option("-l, --limit <n>", "Limit results", "20")
183
+ .action((city, options) => {
184
+ try {
185
+ const airports = getAirportsByCity(city);
186
+ const limit = parseInt(options.limit);
187
+ console.log(chalk.blue(`Found ${airports.length} airports in ${city}`));
188
+ console.log("");
189
+ airports.slice(0, limit).forEach((airport, index) => {
190
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} - ${airport.identity.name}`);
191
+ console.log(` Country: ${airport.location.country}`);
192
+ console.log("");
193
+ });
194
+ if (airports.length > limit) {
195
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
196
+ }
197
+ }
198
+ catch (error) {
199
+ console.error(chalk.red("Error:"), error.message);
200
+ }
201
+ finally {
202
+ closeDatabase();
203
+ }
204
+ });
205
+ // Get airports by type
206
+ program
207
+ .command("type <type>")
208
+ .description("Get airports by type (e.g., large_airport, small_airport)")
209
+ .option("-l, --limit <n>", "Limit results", "20")
210
+ .action((type, options) => {
211
+ try {
212
+ const airports = getAirportsByType(type);
213
+ const limit = parseInt(options.limit);
214
+ console.log(chalk.blue(`Found ${airports.length} ${type} airports`));
215
+ console.log("");
216
+ airports.slice(0, limit).forEach((airport, index) => {
217
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} - ${airport.identity.name}`);
218
+ console.log(` Country: ${airport.location.country}`);
219
+ console.log("");
220
+ });
221
+ if (airports.length > limit) {
222
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
223
+ }
224
+ }
225
+ catch (error) {
226
+ console.error(chalk.red("Error:"), error.message);
227
+ }
228
+ finally {
229
+ closeDatabase();
230
+ }
231
+ });
232
+ // Get airports with towers
233
+ program
234
+ .command("towers")
235
+ .description("Get all airports with control towers")
236
+ .option("-l, --limit <n>", "Limit results", "20")
237
+ .action((options) => {
238
+ try {
239
+ const airports = getAirportsWithTowers();
240
+ const limit = parseInt(options.limit);
241
+ console.log(chalk.blue(`Found ${airports.length} airports with towers`));
242
+ console.log("");
243
+ airports.slice(0, limit).forEach((airport, index) => {
244
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} - ${airport.identity.name}`);
245
+ console.log(` Country: ${airport.location.country}`);
246
+ console.log("");
247
+ });
248
+ if (airports.length > limit) {
249
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
250
+ }
251
+ }
252
+ catch (error) {
253
+ console.error(chalk.red("Error:"), error.message);
254
+ }
255
+ finally {
256
+ closeDatabase();
257
+ }
258
+ });
259
+ // Advanced search
260
+ program
261
+ .command("search")
262
+ .description("Advanced search with multiple criteria")
263
+ .option("-i, --icao <code>", "ICAO code")
264
+ .option("-a, --iata <code>", "IATA code")
265
+ .option("-n, --name <name>", "Airport name (partial match)")
266
+ .option("-c, --country <country>", "Country")
267
+ .option("-cc, --country-code <code>", "ISO country code")
268
+ .option("-s, --state <state>", "State/province")
269
+ .option("-y, --city <city>", "City")
270
+ .option("-t, --type <type>", "Airport type")
271
+ .option("-T, --towers", "Only airports with towers")
272
+ .option("-l, --limit <n>", "Limit results", "20")
273
+ .action((options) => {
274
+ try {
275
+ const searchOpts = {};
276
+ if (options.icao)
277
+ searchOpts.icao = options.icao;
278
+ if (options.iata)
279
+ searchOpts.iata = options.iata;
280
+ if (options.name)
281
+ searchOpts.name = options.name;
282
+ if (options.country)
283
+ searchOpts.country = options.country;
284
+ if (options.countryCode)
285
+ searchOpts.countryCode = options.countryCode;
286
+ if (options.state)
287
+ searchOpts.state = options.state;
288
+ if (options.city)
289
+ searchOpts.city = options.city;
290
+ if (options.type)
291
+ searchOpts.type = options.type;
292
+ if (options.towers)
293
+ searchOpts.hasTower = true;
294
+ const airports = searchAirports(searchOpts);
295
+ const limit = parseInt(options.limit);
296
+ console.log(chalk.blue(`Found ${airports.length} matching airports`));
297
+ console.log("");
298
+ airports.slice(0, limit).forEach((airport, index) => {
299
+ console.log(`${index + 1}. ${chalk.cyan(airport.identity.icao)} ${chalk.gray(airport.identity.iata || "N/A")} - ${airport.identity.name}`);
300
+ console.log(` Type: ${airport.identity.type}`);
301
+ console.log(` Location: ${airport.location.city || "N/A"}, ${airport.location.state || "N/A"}`);
302
+ console.log("");
303
+ });
304
+ if (airports.length > limit) {
305
+ console.log(chalk.gray(`... and ${airports.length - limit} more results`));
306
+ }
307
+ }
308
+ catch (error) {
309
+ console.error(chalk.red("Error:"), error.message);
310
+ }
311
+ finally {
312
+ closeDatabase();
313
+ }
314
+ });
315
+ // Statistics
316
+ program
317
+ .command("stats")
318
+ .description("Show database statistics")
319
+ .action(() => {
320
+ try {
321
+ const total = countAirports();
322
+ console.log(chalk.blue("Airport Database Statistics"));
323
+ console.log("");
324
+ console.log(`Total Airports: ${chalk.cyan(total)}`);
325
+ }
326
+ catch (error) {
327
+ console.error(chalk.red("Error:"), error.message);
328
+ }
329
+ finally {
330
+ closeDatabase();
331
+ }
332
+ });
333
+ // Helper function to print airport details
334
+ function printAirport(airport) {
335
+ console.log("");
336
+ console.log(chalk.cyan("═".repeat(60)));
337
+ console.log(chalk.bold.cyan(airport.identity.name));
338
+ console.log(chalk.cyan("═".repeat(60)));
339
+ console.log("");
340
+ console.log(chalk.bold("Identity:"));
341
+ console.log(` ICAO: ${airport.identity.icao}`);
342
+ if (airport.identity.iata)
343
+ console.log(` IATA: ${airport.identity.iata}`);
344
+ if (airport.identity.faa)
345
+ console.log(` FAA: ${airport.identity.faa}`);
346
+ console.log(` Type: ${airport.identity.type}`);
347
+ if (airport.identity.status)
348
+ console.log(` Status: ${airport.identity.status}`);
349
+ console.log("");
350
+ console.log(chalk.bold("Location:"));
351
+ console.log(` Coordinates: ${airport.location.latitude.toFixed(4)}, ${airport.location.longitude.toFixed(4)}`);
352
+ console.log(` Elevation: ${airport.location.elevationFt.toLocaleString()} ft`);
353
+ console.log(` Country: ${airport.location.country}`);
354
+ if (airport.location.state)
355
+ console.log(` State: ${airport.location.state}`);
356
+ if (airport.location.city)
357
+ console.log(` City: ${airport.location.city}`);
358
+ if (airport.location.timezone)
359
+ console.log(` Timezone: ${airport.location.timezone}`);
360
+ console.log("");
361
+ console.log(chalk.bold("Infrastructure:"));
362
+ console.log(` Runways: ${airport.infrastructure.runways.length || "Unknown"}`);
363
+ if (airport.infrastructure.runways.length > 0) {
364
+ airport.infrastructure.runways.forEach((rwy) => {
365
+ console.log(` - ${rwy.id}: ${rwy.lengthFt}x${rwy.widthFt} ft, ${rwy.surface}${rwy.lighting ? " (Lit)" : ""}`);
366
+ });
367
+ }
368
+ console.log(` Control Tower: ${airport.infrastructure.hasTower ? "Yes" : "No"}`);
369
+ if (airport.infrastructure.fuelTypes &&
370
+ airport.infrastructure.fuelTypes.length > 0) {
371
+ console.log(` Fuel Types: ${airport.infrastructure.fuelTypes.join(", ")}`);
372
+ }
373
+ console.log(` FBO: ${airport.infrastructure.hasFBO ? "Yes" : "No"}`);
374
+ console.log(` Hangars: ${airport.infrastructure.hasHangars ? "Yes" : "No"}`);
375
+ console.log(` Tie-downs: ${airport.infrastructure.hasTieDowns ? "Yes" : "No"}`);
376
+ if (airport.operational) {
377
+ console.log("");
378
+ console.log(chalk.bold("Operational:"));
379
+ console.log(` AIRAC Cycle: ${airport.operational.airacCycle}`);
380
+ if (airport.operational.frequencies) {
381
+ const freq = airport.operational.frequencies;
382
+ console.log(" Frequencies:");
383
+ if (freq.atis)
384
+ console.log(` ATIS: ${freq.atis}`);
385
+ if (freq.tower)
386
+ console.log(` Tower: ${freq.tower}`);
387
+ if (freq.ground)
388
+ console.log(` Ground: ${freq.ground}`);
389
+ if (freq.clearance)
390
+ console.log(` Clearance: ${freq.clearance}`);
391
+ if (freq.unicom)
392
+ console.log(` UNICOM: ${freq.unicom}`);
393
+ if (freq.approach)
394
+ console.log(` Approach: ${freq.approach}`);
395
+ if (freq.departure)
396
+ console.log(` Departure: ${freq.departure}`);
397
+ }
398
+ }
399
+ console.log("");
400
+ console.log(chalk.cyan("═".repeat(60)));
401
+ console.log("");
402
+ }
403
+ export function runCLI(args) {
404
+ program.parse(args, { from: "user" });
405
+ }
406
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KACl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AAG,CAAC,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3D,IAAI,IAAI,CAAC,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YACpE,IAAI,IAAI,CAAC,MAAM;gBAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3D,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACjE,IAAI,IAAI,CAAC,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAc;IACnC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import Database from "better-sqlite3";
2
+ export declare function getDatabase(): Database.Database;
3
+ /**
4
+ * Close the database connection
5
+ */
6
+ export declare function closeDatabase(): void;
7
+ export default getDatabase;
8
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAyCtC,wBAAgB,WAAW,IAAI,QAAQ,CAAC,QAAQ,CAM/C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,48 @@
1
+ import Database from "better-sqlite3";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { createRequire } from "module";
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ const require = createRequire(import.meta.url);
8
+ /**
9
+ * Get the path to the airports.sqlite database file
10
+ * Since this project uses local file reference, we construct the path
11
+ */
12
+ function getDatabasePath() {
13
+ // Get path from node_modules/.pnpm or similar structure
14
+ try {
15
+ // Try resolving the data-sqlite package
16
+ const dataPkgPath = require.resolve("@tabletopandroid/airport-db-data-sqlite");
17
+ const pkgRoot = path.dirname(dataPkgPath);
18
+ return path.join(pkgRoot, "data", "airports.sqlite");
19
+ }
20
+ catch (err) {
21
+ console.error("Error resolving database path:", err);
22
+ // Fallback to relative path (for development or direct usage)
23
+ return path.join(__dirname, "..", "..", "airport-db-data-sqlite", "data", "airports.sqlite");
24
+ }
25
+ }
26
+ /**
27
+ * Get or create the SQLite database connection
28
+ * The database is opened in read-only mode
29
+ */
30
+ let dbInstance = null;
31
+ export function getDatabase() {
32
+ if (!dbInstance) {
33
+ const dbPath = getDatabasePath();
34
+ dbInstance = new Database(dbPath, { readonly: true });
35
+ }
36
+ return dbInstance;
37
+ }
38
+ /**
39
+ * Close the database connection
40
+ */
41
+ export function closeDatabase() {
42
+ if (dbInstance) {
43
+ dbInstance.close();
44
+ dbInstance = null;
45
+ }
46
+ }
47
+ export default getDatabase;
48
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,UAA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@@ -0,0 +1,7 @@
1
+ export * from "./types/airport.js";
2
+ export * from "./types/infrastructure.js";
3
+ export * from "./types/operational.js";
4
+ export * from "./types/search.js";
5
+ export { getDatabase, closeDatabase } from "./database.js";
6
+ export { getAirportByICAO, getAirportByIATA, getAirportByFAA, getAirportsByCountry, getAirportsByState, getAirportsByCity, getAirportsByType, getAirportsWithTowers, searchAirports, countAirports, } from "./queries.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // Export types
2
+ export * from "./types/airport.js";
3
+ export * from "./types/infrastructure.js";
4
+ export * from "./types/operational.js";
5
+ export * from "./types/search.js";
6
+ // Export database functions
7
+ export { getDatabase, closeDatabase } from "./database.js";
8
+ // Export query functions
9
+ export { getAirportByICAO, getAirportByIATA, getAirportByFAA, getAirportsByCountry, getAirportsByState, getAirportsByCity, getAirportsByType, getAirportsWithTowers, searchAirports, countAirports, } from "./queries.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE3D,yBAAyB;AACzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { Airport, SearchOptions } from "./types";
2
+ /**
3
+ * Get an airport by ICAO code
4
+ */
5
+ export declare function getAirportByICAO(icao: string): Airport | undefined;
6
+ /**
7
+ * Get an airport by IATA code
8
+ */
9
+ export declare function getAirportByIATA(iata: string): Airport | undefined;
10
+ /**
11
+ * Get an airport by FAA identifier
12
+ */
13
+ export declare function getAirportByFAA(faa: string): Airport | undefined;
14
+ /**
15
+ * Search airports by country code
16
+ */
17
+ export declare function getAirportsByCountry(countryCode: string): Airport[];
18
+ /**
19
+ * Search airports by state/province
20
+ */
21
+ export declare function getAirportsByState(state: string, countryCode?: string): Airport[];
22
+ /**
23
+ * Search airports by city
24
+ */
25
+ export declare function getAirportsByCity(city: string): Airport[];
26
+ /**
27
+ * Search airports by type
28
+ */
29
+ export declare function getAirportsByType(type: string): Airport[];
30
+ /**
31
+ * Get all airports with control towers
32
+ */
33
+ export declare function getAirportsWithTowers(): Airport[];
34
+ /**
35
+ * Advanced search with multiple criteria
36
+ */
37
+ export declare function searchAirports(options: SearchOptions): Airport[];
38
+ /**
39
+ * Get total number of airports in the database
40
+ */
41
+ export declare function countAirports(): number;
42
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EAKP,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAkClE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAQlE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAQhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,CASnE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,EAAE,CAmBX;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CASzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CASzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,EAAE,CASjD;AAwED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,EAAE,CA0DhE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAMtC"}
@@ -0,0 +1,231 @@
1
+ import { getDatabase } from "./database.js";
2
+ /**
3
+ * Get an airport by ICAO code
4
+ */
5
+ export function getAirportByICAO(icao) {
6
+ const db = getDatabase();
7
+ const identity = db
8
+ .prepare(`SELECT
9
+ icao, iata, faa, local, name, type, type_source as typeSource,
10
+ status, is_public_use as isPublicUse
11
+ FROM airports WHERE icao = ?`)
12
+ .get(icao);
13
+ if (!identity)
14
+ return undefined;
15
+ const location = db
16
+ .prepare(`SELECT
17
+ latitude, longitude, elevation_ft as elevationFt, country, country_code as countryCode,
18
+ state, county, city, zip, timezone, magnetic_variation as magneticVariation
19
+ FROM airports WHERE icao = ?`)
20
+ .get(icao);
21
+ const infrastructure = getInfrastructureByICAO(icao);
22
+ const operational = getOperationalByICAO(icao);
23
+ if (!location)
24
+ return undefined;
25
+ return {
26
+ identity,
27
+ location,
28
+ infrastructure: infrastructure || { runways: [], hasTower: false },
29
+ operational,
30
+ };
31
+ }
32
+ /**
33
+ * Get an airport by IATA code
34
+ */
35
+ export function getAirportByIATA(iata) {
36
+ const db = getDatabase();
37
+ const icao = db
38
+ .prepare("SELECT icao FROM airports WHERE iata = ?")
39
+ .get(iata);
40
+ if (!icao)
41
+ return undefined;
42
+ return getAirportByICAO(icao.icao);
43
+ }
44
+ /**
45
+ * Get an airport by FAA identifier
46
+ */
47
+ export function getAirportByFAA(faa) {
48
+ const db = getDatabase();
49
+ const icao = db
50
+ .prepare("SELECT icao FROM airports WHERE faa = ?")
51
+ .get(faa);
52
+ if (!icao)
53
+ return undefined;
54
+ return getAirportByICAO(icao.icao);
55
+ }
56
+ /**
57
+ * Search airports by country code
58
+ */
59
+ export function getAirportsByCountry(countryCode) {
60
+ const db = getDatabase();
61
+ const results = db
62
+ .prepare("SELECT icao FROM airports WHERE country_code = ? ORDER BY name")
63
+ .all(countryCode);
64
+ return results
65
+ .map((r) => getAirportByICAO(r.icao))
66
+ .filter(Boolean);
67
+ }
68
+ /**
69
+ * Search airports by state/province
70
+ */
71
+ export function getAirportsByState(state, countryCode) {
72
+ const db = getDatabase();
73
+ let results;
74
+ if (countryCode) {
75
+ results = db
76
+ .prepare("SELECT icao FROM airports WHERE state = ? AND country_code = ? ORDER BY name")
77
+ .all(state, countryCode);
78
+ }
79
+ else {
80
+ results = db
81
+ .prepare("SELECT icao FROM airports WHERE state = ? ORDER BY name")
82
+ .all(state);
83
+ }
84
+ return results
85
+ .map((r) => getAirportByICAO(r.icao))
86
+ .filter(Boolean);
87
+ }
88
+ /**
89
+ * Search airports by city
90
+ */
91
+ export function getAirportsByCity(city) {
92
+ const db = getDatabase();
93
+ const results = db
94
+ .prepare("SELECT icao FROM airports WHERE city = ? ORDER BY name")
95
+ .all(city);
96
+ return results
97
+ .map((r) => getAirportByICAO(r.icao))
98
+ .filter(Boolean);
99
+ }
100
+ /**
101
+ * Search airports by type
102
+ */
103
+ export function getAirportsByType(type) {
104
+ const db = getDatabase();
105
+ const results = db
106
+ .prepare("SELECT icao FROM airports WHERE type = ? ORDER BY name")
107
+ .all(type);
108
+ return results
109
+ .map((r) => getAirportByICAO(r.icao))
110
+ .filter(Boolean);
111
+ }
112
+ /**
113
+ * Get all airports with control towers
114
+ */
115
+ export function getAirportsWithTowers() {
116
+ const db = getDatabase();
117
+ const results = db
118
+ .prepare("SELECT icao FROM airports WHERE has_tower = 1 ORDER BY name")
119
+ .all();
120
+ return results
121
+ .map((r) => getAirportByICAO(r.icao))
122
+ .filter(Boolean);
123
+ }
124
+ /**
125
+ * Get infrastructure details for an airport
126
+ */
127
+ function getInfrastructureByICAO(icao) {
128
+ const db = getDatabase();
129
+ const runways = db
130
+ .prepare(`SELECT
131
+ id, length_ft as lengthFt, width_ft as widthFt, surface, lighting
132
+ FROM runways WHERE airport_icao = ?`)
133
+ .all(icao);
134
+ const hasTower = db
135
+ .prepare("SELECT has_tower FROM airports WHERE icao = ?")
136
+ .get(icao);
137
+ const infra = db
138
+ .prepare(`SELECT has_fbo as hasFBO, has_hangars as hasHangars, has_tie_downs as hasTieDowns
139
+ FROM infrastructure WHERE airport_icao = ?`)
140
+ .get(icao);
141
+ const fuelTypes = db
142
+ .prepare("SELECT fuel_type FROM fuel_available WHERE airport_icao = ?")
143
+ .all(icao);
144
+ if (!hasTower)
145
+ return undefined;
146
+ return {
147
+ runways: runways,
148
+ hasTower: hasTower.has_tower,
149
+ fuelTypes: fuelTypes.map((f) => f.fuel_type),
150
+ hasFBO: infra?.hasFBO,
151
+ hasHangars: infra?.hasHangars,
152
+ hasTieDowns: infra?.hasTieDowns,
153
+ };
154
+ }
155
+ /**
156
+ * Get operational data for an airport
157
+ */
158
+ function getOperationalByICAO(icao) {
159
+ const db = getDatabase();
160
+ const operational = db
161
+ .prepare(`SELECT airac_cycle as airacCycle FROM operational WHERE airport_icao = ?`)
162
+ .get(icao);
163
+ if (!operational)
164
+ return undefined;
165
+ const frequencies = db
166
+ .prepare(`SELECT atis, tower, ground, clearance, unicom, approach, departure
167
+ FROM frequencies WHERE airport_icao = ?`)
168
+ .get(icao);
169
+ return {
170
+ airacCycle: operational.airacCycle,
171
+ frequencies: frequencies || undefined,
172
+ };
173
+ }
174
+ /**
175
+ * Advanced search with multiple criteria
176
+ */
177
+ export function searchAirports(options) {
178
+ const db = getDatabase();
179
+ let query = "SELECT icao FROM airports WHERE 1=1";
180
+ const params = [];
181
+ if (options.icao) {
182
+ query += " AND icao = ?";
183
+ params.push(options.icao.toUpperCase());
184
+ }
185
+ if (options.iata) {
186
+ query += " AND iata = ?";
187
+ params.push(options.iata.toUpperCase());
188
+ }
189
+ if (options.name) {
190
+ query += " AND name LIKE ?";
191
+ params.push(`%${options.name}%`);
192
+ }
193
+ if (options.country) {
194
+ query += " AND country LIKE ?";
195
+ params.push(`%${options.country}%`);
196
+ }
197
+ if (options.countryCode) {
198
+ query += " AND country_code = ?";
199
+ params.push(options.countryCode.toUpperCase());
200
+ }
201
+ if (options.state) {
202
+ query += " AND state = ?";
203
+ params.push(options.state);
204
+ }
205
+ if (options.city) {
206
+ query += " AND city = ?";
207
+ params.push(options.city);
208
+ }
209
+ if (options.type) {
210
+ query += " AND type = ?";
211
+ params.push(options.type);
212
+ }
213
+ if (options.hasTower !== undefined) {
214
+ query += " AND has_tower = ?";
215
+ params.push(options.hasTower ? 1 : 0);
216
+ }
217
+ query += " ORDER BY name LIMIT 100";
218
+ const results = db.prepare(query).all(...params);
219
+ return results
220
+ .map((r) => getAirportByICAO(r.icao))
221
+ .filter(Boolean);
222
+ }
223
+ /**
224
+ * Get total number of airports in the database
225
+ */
226
+ export function countAirports() {
227
+ const db = getDatabase();
228
+ const result = db.prepare("SELECT COUNT(*) as count FROM airports").get();
229
+ return result.count;
230
+ }
231
+ //# sourceMappingURL=queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,IAAI,0BAA0B,CAAC;IAEpC,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAA4B,CAAC;IAE5E,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACpC,MAAM,CAAC,OAAO,CAAc,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC,GAAG,EAEtE,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { AirportLocation } from "./infrastructure.js";
2
+ import { AirportInfrastructure } from "./infrastructure.js";
3
+ import { AirportOperational } from "./operational.js";
4
+ /**
5
+ * Airport classification types
6
+ */
7
+ export type AirportType = "large_airport" | "medium_airport" | "small_airport" | "heliport" | "seaplane_base" | "balloonport" | "ultralight_park" | "gliderport" | "closed" | "other";
8
+ /**
9
+ * Data source for airport type classification
10
+ */
11
+ export type AirportTypeSource = "ourairports" | "openflights" | "faa" | "icao" | "derived" | "unknown";
12
+ /**
13
+ * Operational status of an airport
14
+ */
15
+ export type AirportStatus = "operational" | "closed" | "military" | "private";
16
+ /**
17
+ * Stable identifiers and classification for an airport
18
+ */
19
+ export interface AirportIdentity {
20
+ /** ICAO code - primary lookup key */
21
+ icao: string;
22
+ /** IATA code (optional) */
23
+ iata?: string;
24
+ /** FAA identifier (optional) */
25
+ faa?: string;
26
+ /** Local identifier (optional) */
27
+ local?: string;
28
+ /** Airport name */
29
+ name: string;
30
+ /** Airport classification type */
31
+ type: AirportType;
32
+ /** Source of the type classification */
33
+ typeSource?: AirportTypeSource;
34
+ /** Operational status */
35
+ status?: AirportStatus;
36
+ /** Whether the airport is available for public use */
37
+ isPublicUse?: boolean;
38
+ }
39
+ /**
40
+ * Complete airport record combining identity, location, infrastructure, and operational data
41
+ */
42
+ export interface Airport {
43
+ /** Identity and classification data */
44
+ identity: AirportIdentity;
45
+ /** Geographic and regional metadata */
46
+ location: AirportLocation;
47
+ /** Physical airport characteristics */
48
+ infrastructure: AirportInfrastructure;
49
+ /** Optional AIRAC-aware operational metadata */
50
+ operational?: AirportOperational;
51
+ }
52
+ /**
53
+ * Base interface for extending airport data
54
+ */
55
+ export interface AirportExtension {
56
+ }
57
+ /**
58
+ * Airport record with custom extensions
59
+ * @template T - Extension type
60
+ */
61
+ export type ExtendedAirport<T = AirportExtension> = Airport & T;
62
+ //# sourceMappingURL=airport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airport.d.ts","sourceRoot":"","sources":["../../src/types/airport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,UAAU,GACV,eAAe,GACf,aAAa,GACb,iBAAiB,GACjB,YAAY,GACZ,QAAQ,GACR,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,aAAa,GACb,KAAK,GACL,MAAM,GACN,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,wCAAwC;IACxC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,yBAAyB;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,uCAAuC;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,uCAAuC;IACvC,cAAc,EAAE,qBAAqB,CAAC;IACtC,gDAAgD;IAChD,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;CAAG;AAEpC;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,gBAAgB,IAAI,OAAO,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=airport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airport.js","sourceRoot":"","sources":["../../src/types/airport.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type { Airport, AirportIdentity, AirportType, AirportTypeSource, AirportStatus, AirportExtension, ExtendedAirport, } from "./airport";
2
+ export type { AirportInfrastructure, AirportLocation, Runway, RunwaySurface, FuelType, } from "./infrastructure";
3
+ export type { AirportOperational, AirportFrequencies } from "./operational";
4
+ export type { SearchOptions } from "./search";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,OAAO,EACP,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,MAAM,EACN,aAAa,EACb,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG5E,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Runway surface material types
3
+ */
4
+ export type RunwaySurface = "asphalt" | "concrete" | "grass" | "gravel" | "water" | "dirt" | "unknown";
5
+ /**
6
+ * Runway specifications and characteristics
7
+ */
8
+ export interface Runway {
9
+ /** Unique runway identifier */
10
+ id: string;
11
+ /** Runway length in feet */
12
+ lengthFt: number;
13
+ /** Runway width in feet */
14
+ widthFt: number;
15
+ /** Surface material type */
16
+ surface: RunwaySurface;
17
+ /** Whether the runway has lighting */
18
+ lighting: boolean;
19
+ }
20
+ /**
21
+ * Available fuel types at an airport
22
+ * Extensible to support region-specific or emerging classifications
23
+ */
24
+ export type FuelType = "100LL" | "JetA" | "MOGAS" | "UL94" | "SAF" | string;
25
+ /**
26
+ * Physical airport infrastructure characteristics
27
+ */
28
+ export interface AirportInfrastructure {
29
+ /** Array of runways at the airport */
30
+ runways: Runway[];
31
+ /** Whether the airport has an air traffic control tower */
32
+ hasTower: boolean;
33
+ /** Available fuel types */
34
+ fuelTypes?: FuelType[];
35
+ /** Whether the airport has a Fixed Base Operator */
36
+ hasFBO?: boolean;
37
+ /** Whether the airport has hangars */
38
+ hasHangars?: boolean;
39
+ /** Whether the airport has tie-down facilities */
40
+ hasTieDowns?: boolean;
41
+ }
42
+ /**
43
+ * Geographic and regional metadata for an airport
44
+ */
45
+ export interface AirportLocation {
46
+ /** Latitude in decimal degrees */
47
+ latitude: number;
48
+ /** Longitude in decimal degrees */
49
+ longitude: number;
50
+ /** Elevation above mean sea level in feet */
51
+ elevationFt: number;
52
+ /** Country name */
53
+ country: string;
54
+ /** ISO 3166-1 alpha-2 country code */
55
+ countryCode: string;
56
+ /** State or province name */
57
+ state?: string;
58
+ /** County or district name */
59
+ county?: string;
60
+ /** City name */
61
+ city?: string;
62
+ /** Postal code or ZIP code */
63
+ zip?: string;
64
+ /** IANA timezone identifier */
65
+ timezone?: string;
66
+ /** Magnetic variation in degrees (may be AIRAC-dependent) */
67
+ magneticVariation?: number;
68
+ }
69
+ //# sourceMappingURL=infrastructure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infrastructure.d.ts","sourceRoot":"","sources":["../../src/types/infrastructure.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,UAAU,GACV,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,OAAO,EAAE,aAAa,CAAC;IACvB,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2DAA2D;IAC3D,QAAQ,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,oDAAoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=infrastructure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infrastructure.js","sourceRoot":"","sources":["../../src/types/infrastructure.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Radio frequencies for airport communication
3
+ */
4
+ export interface AirportFrequencies {
5
+ /** ATIS (Automatic Terminal Information Service) frequency */
6
+ atis?: string;
7
+ /** Air Traffic Control tower frequency */
8
+ tower?: string;
9
+ /** Ground control frequency */
10
+ ground?: string;
11
+ /** Clearance delivery frequency */
12
+ clearance?: string;
13
+ /** UNICOM frequency for general aviation */
14
+ unicom?: string;
15
+ /** Approach control frequency */
16
+ approach?: string;
17
+ /** Departure control frequency */
18
+ departure?: string;
19
+ }
20
+ /**
21
+ * Operational metadata that may update per AIRAC cycle
22
+ * AIRAC (Aeronautical Information Regulation and Control) cycles occur every 28 days
23
+ */
24
+ export interface AirportOperational {
25
+ /** AIRAC cycle identifier formatted as "YYCC" (e.g., "2601") */
26
+ airacCycle: string;
27
+ /** Radio frequencies for airport communication */
28
+ frequencies?: AirportFrequencies;
29
+ }
30
+ //# sourceMappingURL=operational.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operational.d.ts","sourceRoot":"","sources":["../../src/types/operational.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=operational.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operational.js","sourceRoot":"","sources":["../../src/types/operational.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import { AirportType } from "./airport.js";
2
+ import { RunwaySurface } from "./infrastructure.js";
3
+ /**
4
+ * Query options for searching airports
5
+ */
6
+ export interface SearchOptions {
7
+ /** Search by ICAO code */
8
+ icao?: string;
9
+ /** Search by IATA code */
10
+ iata?: string;
11
+ /** Search by airport name (partial match) */
12
+ name?: string;
13
+ /** Filter by country name */
14
+ country?: string;
15
+ /** Filter by ISO country code */
16
+ countryCode?: string;
17
+ /** Filter by state or province */
18
+ state?: string;
19
+ /** Filter by city */
20
+ city?: string;
21
+ /** Filter by airport type */
22
+ type?: AirportType;
23
+ /** Filter airports with control tower */
24
+ hasTower?: boolean;
25
+ /** Minimum runway length in feet */
26
+ minRunwayLengthFt?: number;
27
+ /** Maximum runway length in feet */
28
+ maxRunwayLengthFt?: number;
29
+ /** Filter by runway surface material */
30
+ surface?: RunwaySurface;
31
+ }
32
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/types/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/types/search.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "airport-db",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript query library for airport data",
5
+ "type": "module",
6
+ "bin": {
7
+ "airport-db": "./dist/bin/airport-db.js"
8
+ },
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "homepage": "https://github.com/tabletop-android/airport-db",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/tabletop-android/airport-db.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/tabletop-android/airport-db/issues"
18
+ },
19
+ "engines": {
20
+ "node": ">=18.0.0"
21
+ },
22
+ "sideEffects": false,
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "dev": "ts-node src/index.ts",
37
+ "prepublishOnly": "npm run build",
38
+ "watch": "tsc --watch"
39
+ },
40
+ "keywords": [
41
+ "airport",
42
+ "database",
43
+ "query",
44
+ "sqlite",
45
+ "typescript",
46
+ "aviation",
47
+ "airac"
48
+ ],
49
+ "author": "tabletop ANDROID",
50
+ "license": "MIT",
51
+ "dependencies": {
52
+ "@tabletopandroid/airport-db-data-sqlite": "^0.1.0",
53
+ "better-sqlite3": "^12.6.2",
54
+ "chalk": "^5.3.0",
55
+ "commander": "^11.1.0"
56
+ },
57
+ "devDependencies": {
58
+ "@types/better-sqlite3": "^7.6.13",
59
+ "@types/node": "^20.10.5",
60
+ "ts-node": "^10.9.2",
61
+ "typescript": "^5.3.3"
62
+ }
63
+ }