@headwindsimulations/api-client 1.1.4 → 1.2.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.
@@ -0,0 +1,6 @@
1
+ export declare class SayIntentionsResponse {
2
+ response: string;
3
+ }
4
+ export declare class SayIntentions {
5
+ static sendRequest(body: any): Promise<SayIntentionsResponse>;
6
+ }
@@ -1,10 +1,2 @@
1
- export * from './airport';
2
- export * from './atc';
3
- export * from './atis';
4
- export * from './charts';
5
- export * from './git-versions';
6
- export * from './gnss';
7
- export * from './metar';
8
- export * from './taf';
9
- export * from './telex';
10
1
  export * from './Hoppie';
2
+ export * from './SayIntentions';
package/dist/index.esm.js CHANGED
@@ -14,22 +14,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
14
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
15
  PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
- /* global Reflect, Promise */
18
-
19
- var extendStatics = function(d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
-
26
- function __extends(d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- }
33
17
 
34
18
  var __assign = function() {
35
19
  __assign = Object.assign || function __assign(t) {
@@ -40,421 +24,14 @@ var __assign = function() {
40
24
  return t;
41
25
  };
42
26
  return __assign.apply(this, arguments);
43
- };
44
-
45
- function __awaiter(thisArg, _arguments, P, generator) {
46
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
- return new (P || (P = Promise))(function (resolve, reject) {
48
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
49
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
50
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
51
- step((generator = generator.apply(thisArg, _arguments || [])).next());
52
- });
53
- }
54
-
55
- function __generator(thisArg, body) {
56
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
57
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
- function verb(n) { return function (v) { return step([n, v]); }; }
59
- function step(op) {
60
- if (f) throw new TypeError("Generator is already executing.");
61
- while (_) try {
62
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
- if (y = 0, t) op = [op[0] & 2, t.value];
64
- switch (op[0]) {
65
- case 0: case 1: t = op; break;
66
- case 4: _.label++; return { value: op[1], done: false };
67
- case 5: _.label++; y = op[1]; op = [0]; continue;
68
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
- default:
70
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
- if (t[2]) _.ops.pop();
75
- _.trys.pop(); continue;
76
- }
77
- op = body.call(thisArg, _);
78
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
- }
81
- }
27
+ };
82
28
 
83
- function get(url, headers) {
84
- return axios.get(url.href, { headers: headers })
85
- .then(function (res) { return res.data; });
86
- }
87
- function del(url, headers) {
88
- return axios["delete"](url.href, { headers: headers })
89
- .then(function (res) { return res.data; });
90
- }
91
29
  function post(url, body, headers) {
92
30
  var headersToSend = __assign({ 'Content-Type': 'application/json' }, headers);
93
31
  return axios.post(url.href, body, { headers: headersToSend })
94
32
  .then(function (res) { return res.data; });
95
- }
96
- function put(url, body, headers) {
97
- var headersToSend = __assign({ 'Content-Type': 'application/json' }, headers);
98
- return axios.put(url.href, body, { headers: headersToSend })
99
- .then(function (res) { return res.data; });
100
33
  }
101
34
 
102
- var Airport = /** @class */ (function () {
103
- function Airport() {
104
- }
105
- Airport.get = function (icao) {
106
- if (!icao) {
107
- throw new Error('No ICAO provided');
108
- }
109
- return get(new URL("/api/v1/airport/" + icao, NXApi.url));
110
- };
111
- Airport.getBatch = function (icaos) {
112
- if (!icaos) {
113
- throw new Error('No ICAOs provided');
114
- }
115
- return post(new URL('/api/v1/airport/_batch', NXApi.url), { icaos: icaos });
116
- };
117
- return Airport;
118
- }());
119
-
120
- var AtcType;
121
- (function (AtcType) {
122
- AtcType[AtcType["UNKNOWN"] = 0] = "UNKNOWN";
123
- AtcType[AtcType["DELIVERY"] = 1] = "DELIVERY";
124
- AtcType[AtcType["GROUND"] = 2] = "GROUND";
125
- AtcType[AtcType["TOWER"] = 3] = "TOWER";
126
- AtcType[AtcType["DEPARTURE"] = 4] = "DEPARTURE";
127
- AtcType[AtcType["APPROACH"] = 5] = "APPROACH";
128
- AtcType[AtcType["RADAR"] = 6] = "RADAR";
129
- AtcType[AtcType["ATIS"] = 7] = "ATIS";
130
- })(AtcType || (AtcType = {}));
131
- var ATC = /** @class */ (function () {
132
- function ATC() {
133
- }
134
- ATC.get = function (source) {
135
- return __awaiter(this, void 0, void 0, function () {
136
- var url;
137
- return __generator(this, function (_a) {
138
- if (!source) {
139
- throw new Error('No source provided');
140
- }
141
- url = new URL("/api/v1/atc?source=" + source, NXApi.url);
142
- return [2 /*return*/, get(url)];
143
- });
144
- });
145
- };
146
- return ATC;
147
- }());
148
-
149
- var Atis = /** @class */ (function () {
150
- function Atis() {
151
- }
152
- Atis.get = function (icao, source) {
153
- return __awaiter(this, void 0, void 0, function () {
154
- var url;
155
- return __generator(this, function (_a) {
156
- if (!icao) {
157
- throw new Error('No ICAO provided');
158
- }
159
- url = new URL("/atis/" + icao, NXApi.url);
160
- if (source) {
161
- url.searchParams.set('source', source);
162
- }
163
- return [2 /*return*/, get(url)];
164
- });
165
- });
166
- };
167
- return Atis;
168
- }());
169
-
170
- var Charts = /** @class */ (function () {
171
- function Charts() {
172
- }
173
- Charts.get = function (icao) {
174
- return __awaiter(this, void 0, void 0, function () {
175
- var url;
176
- return __generator(this, function (_a) {
177
- if (!icao) {
178
- throw new Error('No ICAO provided');
179
- }
180
- url = new URL("/api/v1/charts/" + icao, NXApi.url);
181
- return [2 /*return*/, get(url)];
182
- });
183
- });
184
- };
185
- return Charts;
186
- }());
187
-
188
- var GitVersions = /** @class */ (function () {
189
- function GitVersions() {
190
- }
191
- GitVersions.getNewestCommit = function (user, repo, branch) {
192
- return __awaiter(this, void 0, void 0, function () {
193
- return __generator(this, function (_a) {
194
- if (!user || !repo || !branch) {
195
- throw new Error('Missing argument');
196
- }
197
- return [2 /*return*/, get(new URL("/api/GitHub/" + user + "/" + repo + "/branches/" + branch, NXApi.url))
198
- .then(function (res) { return (__assign(__assign({}, res), { timestamp: new Date(res.timestamp) })); })];
199
- });
200
- });
201
- };
202
- GitVersions.getReleases = function (user, repo, includePreReleases, skip, take) {
203
- return __awaiter(this, void 0, void 0, function () {
204
- var takePreReleasesArg, skipArg, takeArg;
205
- return __generator(this, function (_a) {
206
- if (!user || !repo) {
207
- throw new Error('Missing argument');
208
- }
209
- if (skip < 0 || take < 0) {
210
- throw new Error("skip or take cannot be negative");
211
- }
212
- takePreReleasesArg = "?includePreReleases=" + (includePreReleases === true);
213
- skipArg = skip !== undefined ? "&skip=" + skip : "";
214
- takeArg = take !== undefined ? "&take=" + take : "";
215
- return [2 /*return*/, get(new URL("/api/GitHub/" + user + "/" + repo + "/releases" + takePreReleasesArg + skipArg + takeArg, NXApi.url))
216
- .then(function (res) { return res.map(function (rel) { return (__assign(__assign({}, rel), { publishedAt: new Date(rel.publishedAt) })); }); })];
217
- });
218
- });
219
- };
220
- GitVersions.getPulls = function (user, repo) {
221
- return __awaiter(this, void 0, void 0, function () {
222
- return __generator(this, function (_a) {
223
- if (!user || !repo) {
224
- throw new Error('Missing argument');
225
- }
226
- return [2 /*return*/, get(new URL("/api/GitHub/" + user + "/" + repo + "/pulls", NXApi.url))];
227
- });
228
- });
229
- };
230
- GitVersions.getArtifact = function (user, repo, pull) {
231
- return __awaiter(this, void 0, void 0, function () {
232
- return __generator(this, function (_a) {
233
- if (!user || !repo || !pull) {
234
- throw new Error('Missing argument');
235
- }
236
- return [2 /*return*/, get(new URL("/api/GitHub/" + user + "/" + repo + "/pulls/" + pull + "/artifact", NXApi.url))];
237
- });
238
- });
239
- };
240
- return GitVersions;
241
- }());
242
-
243
- var GNSS = /** @class */ (function () {
244
- function GNSS() {
245
- }
246
- GNSS.get = function () {
247
- var url = new URL('/api/v1/gnss', NXApi.url);
248
- return get(url)
249
- .then(function (res) { return res.map(GNSS.mapResult); });
250
- };
251
- GNSS.mapResult = function (response) {
252
- return __assign(__assign({}, response), { epoch: new Date(response.epoch) });
253
- };
254
- return GNSS;
255
- }());
256
-
257
- var Metar = /** @class */ (function () {
258
- function Metar() {
259
- }
260
- Metar.get = function (icao, source) {
261
- return __awaiter(this, void 0, void 0, function () {
262
- var url;
263
- return __generator(this, function (_a) {
264
- if (!icao) {
265
- throw new Error('No ICAO provided');
266
- }
267
- url = new URL("/metar/" + icao, NXApi.url);
268
- if (source) {
269
- url.searchParams.set('source', source);
270
- }
271
- return [2 /*return*/, get(url)];
272
- });
273
- });
274
- };
275
- return Metar;
276
- }());
277
-
278
- var Taf = /** @class */ (function () {
279
- function Taf() {
280
- }
281
- Taf.get = function (icao, source) {
282
- return __awaiter(this, void 0, void 0, function () {
283
- var url;
284
- return __generator(this, function (_a) {
285
- if (!icao) {
286
- throw new Error('No ICAO provided');
287
- }
288
- url = new URL("/taf/" + icao, NXApi.url);
289
- if (source) {
290
- url.searchParams.set('source', source);
291
- }
292
- return [2 /*return*/, get(url)];
293
- });
294
- });
295
- };
296
- return Taf;
297
- }());
298
-
299
- var TelexNotConnectedError = /** @class */ (function (_super) {
300
- __extends(TelexNotConnectedError, _super);
301
- function TelexNotConnectedError() {
302
- return _super.call(this, 'TELEX is not connected') || this;
303
- }
304
- return TelexNotConnectedError;
305
- }(Error));
306
- var Telex = /** @class */ (function () {
307
- function Telex() {
308
- }
309
- Telex.connect = function (status) {
310
- return post(new URL('/txcxn', NXApi.url), Telex.buildBody(status))
311
- .then(function (res) {
312
- Telex.accessToken = res.accessToken;
313
- return res;
314
- });
315
- };
316
- Telex.update = function (status) {
317
- return __awaiter(this, void 0, void 0, function () {
318
- return __generator(this, function (_a) {
319
- Telex.connectionOrThrow();
320
- return [2 /*return*/, put(new URL('/txcxn', NXApi.url), Telex.buildBody(status), { Authorization: Telex.buildToken() })
321
- .then(Telex.mapConnection)];
322
- });
323
- });
324
- };
325
- Telex.disconnect = function () {
326
- return __awaiter(this, void 0, void 0, function () {
327
- return __generator(this, function (_a) {
328
- Telex.connectionOrThrow();
329
- return [2 /*return*/, del(new URL('/txcxn', NXApi.url), { Authorization: Telex.buildToken() })
330
- .then(function () {
331
- Telex.accessToken = '';
332
- })];
333
- });
334
- });
335
- };
336
- Telex.sendMessage = function (recipientFlight, message) {
337
- return __awaiter(this, void 0, void 0, function () {
338
- return __generator(this, function (_a) {
339
- Telex.connectionOrThrow();
340
- return [2 /*return*/, post(new URL('/txmsg', NXApi.url), {
341
- to: recipientFlight,
342
- message: message,
343
- }, { Authorization: Telex.buildToken() })
344
- .then(Telex.mapMessage)];
345
- });
346
- });
347
- };
348
- Telex.fetchMessages = function () {
349
- return __awaiter(this, void 0, void 0, function () {
350
- return __generator(this, function (_a) {
351
- Telex.connectionOrThrow();
352
- return [2 /*return*/, get(new URL('/txmsg', NXApi.url), { Authorization: Telex.buildToken() })
353
- .then(function (res) { return res.map(Telex.mapMessage); })];
354
- });
355
- });
356
- };
357
- Telex.fetchConnections = function (skip, take, bounds) {
358
- var url = new URL('/txcxn', NXApi.url);
359
- if (skip) {
360
- url.searchParams.set('skip', skip.toString());
361
- }
362
- if (take) {
363
- url.searchParams.append('take', take.toString());
364
- }
365
- if (bounds) {
366
- url.searchParams.append('north', bounds.north.toString());
367
- url.searchParams.append('east', bounds.east.toString());
368
- url.searchParams.append('south', bounds.south.toString());
369
- url.searchParams.append('west', bounds.west.toString());
370
- }
371
- return get(url)
372
- .then(function (res) { return (__assign(__assign({}, res), { results: res.results.map(Telex.mapConnection) })); });
373
- };
374
- Telex.fetchAllConnections = function (bounds, stageCallback) {
375
- return __awaiter(this, void 0, void 0, function () {
376
- var flights, skip, total, data;
377
- return __generator(this, function (_a) {
378
- switch (_a.label) {
379
- case 0:
380
- flights = [];
381
- skip = 0;
382
- total = 0;
383
- _a.label = 1;
384
- case 1: return [4 /*yield*/, Telex.fetchConnections(skip, 100, bounds)];
385
- case 2:
386
- data = _a.sent();
387
- total = data.total;
388
- skip += data.count;
389
- flights = flights.concat(data.results);
390
- if (stageCallback) {
391
- stageCallback(flights);
392
- }
393
- _a.label = 3;
394
- case 3:
395
- if (total > skip) return [3 /*break*/, 1];
396
- _a.label = 4;
397
- case 4: return [2 /*return*/, flights];
398
- }
399
- });
400
- });
401
- };
402
- Telex.fetchConnection = function (id) {
403
- return get(new URL("/txcxn/" + id, NXApi.url))
404
- .then(Telex.mapConnection);
405
- };
406
- Telex.findConnections = function (flightNumber) {
407
- var url = new URL('/txcxn/_find', NXApi.url);
408
- url.searchParams.set('flight', flightNumber);
409
- return get(url)
410
- .then(function (res) { return ({
411
- matches: res.matches.map(Telex.mapConnection),
412
- fullMatch: res.fullMatch ? Telex.mapConnection(res.fullMatch) : undefined,
413
- }); });
414
- };
415
- Telex.countConnections = function () {
416
- return get(new URL('/txcxn/_count', NXApi.url));
417
- };
418
- Telex.buildBody = function (status) {
419
- return {
420
- location: {
421
- x: status.location.long,
422
- y: status.location.lat,
423
- },
424
- trueAltitude: status.trueAltitude,
425
- heading: status.heading,
426
- origin: status.origin,
427
- destination: status.destination,
428
- freetextEnabled: status.freetextEnabled,
429
- flight: status.flight,
430
- aircraftType: status.aircraftType,
431
- airline: status.airline
432
- };
433
- };
434
- Telex.buildToken = function () {
435
- return "Bearer " + Telex.accessToken;
436
- };
437
- Telex.connectionOrThrow = function () {
438
- if (!Telex.accessToken) {
439
- throw new TelexNotConnectedError();
440
- }
441
- };
442
- Telex.mapConnection = function (connection) {
443
- return __assign(__assign({}, connection), { firstContact: new Date(connection.firstContact), lastContact: new Date(connection.lastContact) });
444
- };
445
- Telex.mapMessage = function (message) {
446
- var msg = __assign(__assign({}, message), { createdAt: new Date(message.createdAt) });
447
- if (message.from) {
448
- msg.from = Telex.mapConnection(message.from);
449
- }
450
- if (message.to) {
451
- msg.to = Telex.mapConnection(message.to);
452
- }
453
- return msg;
454
- };
455
- return Telex;
456
- }());
457
-
458
35
  var Hoppie = /** @class */ (function () {
459
36
  function Hoppie() {
460
37
  }
@@ -464,12 +41,21 @@ var Hoppie = /** @class */ (function () {
464
41
  return Hoppie;
465
42
  }());
466
43
 
44
+ var SayIntentions = /** @class */ (function () {
45
+ function SayIntentions() {
46
+ }
47
+ SayIntentions.sendRequest = function (body) {
48
+ return post(new URL('/api/v1/sayintentions', NXApi.url), body);
49
+ };
50
+ return SayIntentions;
51
+ }());
52
+
467
53
  var NXApi = /** @class */ (function () {
468
54
  function NXApi() {
469
55
  }
470
- NXApi.url = new URL('https://api.flybywiresim.com');
56
+ NXApi.url = new URL('https://api.headwindsim.net');
471
57
  return NXApi;
472
58
  }());
473
59
 
474
- export { ATC, Airport, AtcType, Atis, Charts, GNSS, GitVersions, Hoppie, Metar, NXApi, Taf, Telex, TelexNotConnectedError };
60
+ export { Hoppie, NXApi, SayIntentions };
475
61
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/apis/airport.ts","../src/apis/atc.ts","../src/apis/atis.ts","../src/apis/charts.ts","../src/apis/git-versions.ts","../src/apis/gnss.ts","../src/apis/metar.ts","../src/apis/taf.ts","../src/apis/telex.ts","../src/apis/Hoppie.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { get, post } from '../utils';\n\nexport declare class AirportResponse {\n icao: string;\n\n iata: string;\n\n type: string;\n\n name: string;\n\n lat: number;\n\n lon: number;\n\n elevation: number;\n\n continent: string;\n\n country: string;\n\n transAlt: number;\n}\n\nexport class Airport {\n public static get(icao: string): Promise<AirportResponse> {\n if (!icao) {\n throw new Error('No ICAO provided');\n }\n\n return get<AirportResponse>(new URL(`/api/v1/airport/${icao}`, NXApi.url));\n }\n\n public static getBatch(icaos: string[]): Promise<AirportResponse[]> {\n if (!icaos) {\n throw new Error('No ICAOs provided');\n }\n\n return post<AirportResponse[]>(new URL('/api/v1/airport/_batch', NXApi.url), { icaos });\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport enum AtcType {\n UNKNOWN,\n DELIVERY,\n GROUND,\n TOWER,\n DEPARTURE,\n APPROACH,\n RADAR,\n ATIS\n}\n\nexport declare class ATCInfo {\n callsign: string;\n\n frequency: string;\n\n visualRange: number;\n\n textAtis: string[];\n\n type: AtcType;\n\n latitude?: number;\n\n longitude?: number;\n}\n\nexport class ATC {\n public static async get(source: string): Promise<ATCInfo[]> {\n if (!source) {\n throw new Error('No source provided');\n }\n\n const url = new URL(`/api/v1/atc?source=${source}`, NXApi.url);\n return get<ATCInfo[]>(url);\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class AtisResponse {\n icao: string;\n\n source: string;\n\n combined?: string;\n\n arr?: string;\n\n dep?: string;\n}\n\nexport class Atis {\n public static async get(icao: string, source?: string): Promise<AtisResponse> {\n if (!icao) {\n throw new Error('No ICAO provided');\n }\n\n const url = new URL(`/atis/${icao}`, NXApi.url);\n if (source) {\n url.searchParams.set('source', source);\n }\n\n return get<AtisResponse>(url);\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class Chart {\n url: string;\n\n name: string;\n}\n\nexport declare class ChartsResponse {\n icao: string;\n\n charts?: Chart[];\n}\n\nexport class Charts {\n public static async get(icao: string): Promise<ChartsResponse> {\n if (!icao) {\n throw new Error('No ICAO provided');\n }\n\n const url = new URL(`/api/v1/charts/${icao}`, NXApi.url);\n\n return get<ChartsResponse>(url);\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class CommitInfo {\n sha: string;\n\n shortSha: string;\n\n timestamp: Date;\n}\n\nexport declare class ReleaseInfo {\n name: string;\n\n isPreRelease: boolean;\n\n publishedAt: Date;\n\n htmlUrl: string;\n\n body: string;\n}\n\nexport declare class PullLabel {\n id: string;\n\n name: string;\n\n color: string;\n}\n\nexport declare class PullInfo {\n number: number;\n\n title: string;\n\n author: string;\n\n labels: PullLabel[];\n\n isDraft: boolean;\n}\n\nexport declare class ArtifactInfo {\n artifactUrl: string;\n}\n\nexport class GitVersions {\n public static async getNewestCommit(user: string, repo: string, branch: string): Promise<CommitInfo> {\n if (!user || !repo || !branch) {\n throw new Error('Missing argument');\n }\n\n return get<CommitInfo>(new URL(`/api/GitHub/${user}/${repo}/branches/${branch}`, NXApi.url))\n .then((res: CommitInfo) => ({\n ...res,\n timestamp: new Date(res.timestamp),\n }));\n }\n\n public static async getReleases(user: string, repo: string, includePreReleases?: boolean, skip?: number, take?: number): Promise<ReleaseInfo[]> {\n if (!user || !repo) {\n throw new Error('Missing argument');\n }\n\n if (skip < 0 || take < 0) {\n throw new Error(\"skip or take cannot be negative\");\n }\n\n const takePreReleasesArg = `?includePreReleases=${includePreReleases === true}`;\n const skipArg = skip !== undefined ? `&skip=` + skip : \"\";\n const takeArg = take !== undefined ? `&take=` + take : \"\";\n\n return get<ReleaseInfo[]>(\n new URL(`/api/GitHub/${user}/${repo}/releases${takePreReleasesArg}${skipArg}${takeArg}`, NXApi.url),\n )\n .then((res) => res.map((rel) => ({\n ...rel,\n publishedAt: new Date(rel.publishedAt),\n })));\n }\n\n public static async getPulls(user: string, repo: string): Promise<PullInfo[]> {\n if (!user || !repo) {\n throw new Error('Missing argument');\n }\n\n return get<PullInfo[]>(new URL(`/api/GitHub/${user}/${repo}/pulls`, NXApi.url));\n }\n\n public static async getArtifact(user: string, repo: string, pull: string): Promise<ArtifactInfo> {\n if (!user || !repo || !pull) {\n throw new Error('Missing argument');\n }\n\n return get<ArtifactInfo>(new URL(`/api/GitHub/${user}/${repo}/pulls/${pull}/artifact`, NXApi.url));\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class GNSSResponse {\n name: string;\n\n id: string;\n\n epoch: Date;\n\n meanMotion: number;\n\n eccentricity: number;\n\n inclination: number;\n\n raOfAscNode: number;\n\n argOfPericenter: number;\n\n meanAnomaly: number;\n\n ephemerisType: number;\n\n classificationType: string;\n\n noradCatId: number;\n\n elementSetNo: number;\n\n revAtEpoch: number;\n\n bstar: number;\n\n meanMotionDot: number;\n\n meanMotionDdot: number;\n}\n\nexport class GNSS {\n public static get(): Promise<GNSSResponse[]> {\n const url = new URL('/api/v1/gnss', NXApi.url);\n\n return get<GNSSResponse[]>(url)\n .then((res) => res.map(GNSS.mapResult));\n }\n\n private static mapResult(response: GNSSResponse): GNSSResponse {\n return {\n ...response,\n epoch: new Date(response.epoch),\n };\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class MetarResponse {\n icao: string;\n\n source: string;\n\n metar: string;\n}\n\nexport class Metar {\n public static async get(icao: string, source?: string): Promise<MetarResponse> {\n if (!icao) {\n throw new Error('No ICAO provided');\n }\n\n const url = new URL(`/metar/${icao}`, NXApi.url);\n if (source) {\n url.searchParams.set('source', source);\n }\n\n return get<MetarResponse>(url);\n }\n}\n","import { NXApi } from '../index';\nimport { get } from '../utils';\n\nexport declare class TafResponse {\n icao: string;\n\n source: string;\n\n taf: string;\n}\n\nexport class Taf {\n public static async get(icao: string, source?: string): Promise<TafResponse> {\n if (!icao) {\n throw new Error('No ICAO provided');\n }\n\n const url = new URL(`/taf/${icao}`, NXApi.url);\n if (source) {\n url.searchParams.set('source', source);\n }\n\n return get<TafResponse>(url);\n }\n}\n","import { NXApi } from '../index';\nimport { del, get, post, put } from '../utils';\n\nexport declare class TelexConnection {\n id: string;\n\n isActive: boolean;\n\n firstContact: Date;\n\n lastContact: Date;\n\n flight: string;\n\n location: {\n x: number;\n y: number;\n };\n\n trueAltitude: number;\n\n heading: number;\n\n freetextEnabled: boolean;\n\n aircraftType: string;\n \n airline: string;\n\n origin: string;\n\n destination: string;\n}\n\nexport declare class SearchResult<T> {\n fullMatch?: T;\n\n matches: T[];\n}\n\nexport declare class TelexMessage {\n id: string;\n\n createdAt: Date;\n\n received: boolean;\n\n message: string;\n\n isProfane: boolean;\n\n from: TelexConnection;\n\n to?: TelexConnection;\n}\n\nexport declare class Token {\n accessToken: string;\n\n connection: string;\n\n flight: string;\n}\n\nexport declare class AircraftStatus {\n location: {\n long: number;\n lat: number;\n };\n\n trueAltitude: number;\n\n heading: number;\n\n origin: string;\n\n destination: string;\n\n freetextEnabled: boolean;\n\n flight: string;\n\n aircraftType: string;\n \n airline: string;\n}\n\nexport declare class Paginated<T> {\n results: T[];\n\n count: number;\n\n total: number;\n}\n\nexport declare class Bounds {\n north: number;\n\n east: number;\n\n south: number;\n\n west: number;\n}\n\nexport declare type StageCallback = (flights: TelexConnection[]) => void;\n\nexport class TelexNotConnectedError extends Error {\n constructor() {\n super('TELEX is not connected');\n }\n}\n\nexport class Telex {\n private static accessToken: string;\n\n public static connect(status: AircraftStatus): Promise<Token> {\n return post<Token>(new URL('/txcxn', NXApi.url), Telex.buildBody(status))\n .then((res) => {\n Telex.accessToken = res.accessToken;\n return res;\n });\n }\n\n public static async update(status: AircraftStatus): Promise<TelexConnection> {\n Telex.connectionOrThrow();\n\n return put<TelexConnection>(new URL('/txcxn', NXApi.url), Telex.buildBody(status), { Authorization: Telex.buildToken() })\n .then(Telex.mapConnection);\n }\n\n public static async disconnect(): Promise<void> {\n Telex.connectionOrThrow();\n\n return del(new URL('/txcxn', NXApi.url), { Authorization: Telex.buildToken() })\n .then(() => {\n Telex.accessToken = '';\n });\n }\n\n public static async sendMessage(recipientFlight: string, message: string): Promise<TelexMessage> {\n Telex.connectionOrThrow();\n\n return post<TelexMessage>(new URL('/txmsg', NXApi.url), {\n to: recipientFlight,\n message,\n }, { Authorization: Telex.buildToken() })\n .then(Telex.mapMessage);\n }\n\n public static async fetchMessages(): Promise<TelexMessage[]> {\n Telex.connectionOrThrow();\n\n return get<TelexMessage[]>(new URL('/txmsg', NXApi.url), { Authorization: Telex.buildToken() })\n .then((res) => res.map(Telex.mapMessage));\n }\n\n public static fetchConnections(skip?: number, take?: number, bounds?: Bounds): Promise<Paginated<TelexConnection>> {\n const url = new URL('/txcxn', NXApi.url);\n if (skip) {\n url.searchParams.set('skip', skip.toString());\n }\n if (take) {\n url.searchParams.append('take', take.toString());\n }\n if (bounds) {\n url.searchParams.append('north', bounds.north.toString());\n url.searchParams.append('east', bounds.east.toString());\n url.searchParams.append('south', bounds.south.toString());\n url.searchParams.append('west', bounds.west.toString());\n }\n\n return get<Paginated<TelexConnection>>(url)\n .then((res) => ({\n ...res,\n results: res.results.map(Telex.mapConnection),\n }));\n }\n\n public static async fetchAllConnections(bounds?: Bounds, stageCallback?: StageCallback): Promise<TelexConnection[]> {\n let flights: TelexConnection[] = [];\n let skip = 0;\n let total = 0;\n\n do {\n const data = await Telex.fetchConnections(skip, 100, bounds);\n\n total = data.total;\n skip += data.count;\n flights = flights.concat(data.results);\n\n if (stageCallback) {\n stageCallback(flights);\n }\n }\n while (total > skip);\n\n return flights;\n }\n\n public static fetchConnection(id: string): Promise<TelexConnection> {\n return get<TelexConnection>(new URL(`/txcxn/${id}`, NXApi.url))\n .then(Telex.mapConnection);\n }\n\n public static findConnections(flightNumber: string): Promise<SearchResult<TelexConnection>> {\n const url = new URL('/txcxn/_find', NXApi.url);\n url.searchParams.set('flight', flightNumber);\n\n return get<SearchResult<TelexConnection>>(url)\n .then((res) => ({\n matches: res.matches.map(Telex.mapConnection),\n fullMatch: res.fullMatch ? Telex.mapConnection(res.fullMatch) : undefined,\n }));\n }\n\n public static countConnections(): Promise<number> {\n return get<number>(new URL('/txcxn/_count', NXApi.url));\n }\n\n private static buildBody(status: AircraftStatus) {\n return {\n location: {\n x: status.location.long,\n y: status.location.lat,\n },\n trueAltitude: status.trueAltitude,\n heading: status.heading,\n origin: status.origin,\n destination: status.destination,\n freetextEnabled: status.freetextEnabled,\n flight: status.flight,\n aircraftType: status.aircraftType,\n airline: status.airline\n };\n }\n\n private static buildToken(): string {\n return `Bearer ${Telex.accessToken}`;\n }\n\n private static connectionOrThrow() {\n if (!Telex.accessToken) {\n throw new TelexNotConnectedError();\n }\n }\n\n private static mapConnection(connection: TelexConnection): TelexConnection {\n return {\n ...connection,\n firstContact: new Date(connection.firstContact),\n lastContact: new Date(connection.lastContact),\n };\n }\n\n private static mapMessage(message: TelexMessage): TelexMessage {\n const msg: TelexMessage = {\n ...message,\n createdAt: new Date(message.createdAt),\n };\n\n if (message.from) {\n msg.from = Telex.mapConnection(message.from);\n }\n\n if (message.to) {\n msg.to = Telex.mapConnection(message.to);\n }\n\n return msg;\n }\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.flybywiresim.com');\n}\n\nexport * from './apis';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgB,GAAG,CAAI,GAAQ,EAAE,OAAa;IAC1C,OAAO,KAAK,CAAC,GAAG,CAAI,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC;SACrC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC,CAAC;SAEe,GAAG,CAAC,GAAQ,EAAE,OAAa;IACvC,OAAO,KAAK,CAAC,QAAM,CAAA,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC;SACrC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC,CAAC;SAEe,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAA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","../src/apis/Hoppie.ts","../src/apis/SayIntentions.ts","../src/index.ts"],"sourcesContent":["import axios from 'axios';\n\nexport function get<T>(url: URL, headers?: any): Promise<T> {\n return axios.get<T>(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function del(url: URL, headers?: any): Promise<void> {\n return axios.delete(url.href, { headers })\n .then((res) => res.data);\n}\n\nexport function post<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.post<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n\nexport function put<T>(url: URL, body: any, headers?: any): Promise<T> {\n const headersToSend = {\n 'Content-Type': 'application/json',\n ...headers,\n };\n\n return axios.put<T>(url.href, body, { headers: headersToSend })\n .then((res) => res.data);\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class HoppieResponse {\n response: string;\n}\n\nexport class Hoppie {\n public static sendRequest(body: any): Promise<HoppieResponse> {\n return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);\n }\n}\n","import { NXApi } from '../index';\nimport { post } from '../utils';\n\nexport declare class SayIntentionsResponse {\n response: string;\n}\n\nexport class SayIntentions {\n public static sendRequest(body: any): Promise<SayIntentionsResponse> {\n return post<SayIntentionsResponse>(new URL('/api/v1/sayintentions', NXApi.url), body);\n }\n}\n","export class NXApi {\n public static url = new URL('https://api.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;SAYgB,IAAI,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACtD,IAAM,aAAa,cACf,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACb,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,GAAA,CAAC,CAAC;AACjC;;;ICbA;KAIC;IAHiB,kBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAiB,IAAI,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KAC3E;IACL,aAAC;AAAD,CAAC;;;ICJD;KAIC;IAHiB,yBAAW,GAAzB,UAA0B,IAAS;QAC/B,OAAO,IAAI,CAAwB,IAAI,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KACzF;IACL,oBAAC;AAAD,CAAC;;;ICXD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;"}