@headwindsimulations/api-client 0.1.0 → 1.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.
- package/README.md +33 -28
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
# <img src="https://
|
|
2
|
-
#
|
|
1
|
+
# <img src="https://headwindsim.net/assets/images/headwind-logo-light.png" placeholder="HeadwindSimulations" width="400"/>
|
|
2
|
+
# Headwind Simulations API Client for FlyByWire API
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
This is a unofficial JavaScript client for the FlyByWire API and changed for Headwind Simulations needs.
|
|
5
5
|
The library supports both JavaScript and TypeScript.
|
|
6
|
+
If you want to use the FlyByWire API stick to the Official API-Client: https://github.com/flybywiresim/api-client
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
9
11
|
Install the client library using npm:
|
|
10
12
|
|
|
11
|
-
$ npm install --save @
|
|
13
|
+
$ npm install --save @headwindsimulations/api-client
|
|
12
14
|
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
15
17
|
### Initializing the client
|
|
16
18
|
```ts
|
|
17
|
-
import { NXApi } from '@
|
|
19
|
+
import { NXApi } from '@headwindsimulations/api-client';
|
|
18
20
|
|
|
19
21
|
NXApi.url = new URL('http://localhost:3000');
|
|
20
22
|
```
|
|
@@ -23,7 +25,7 @@ By default, the URL is set to `https://api.flybywiresim.com`. If this is the des
|
|
|
23
25
|
|
|
24
26
|
### METAR
|
|
25
27
|
```ts
|
|
26
|
-
import { Metar } from '@
|
|
28
|
+
import { Metar } from '@headwindsimulations/api-client';
|
|
27
29
|
|
|
28
30
|
Metar.get(icao, source)
|
|
29
31
|
.then(data => {
|
|
@@ -43,7 +45,7 @@ Metar.get(icao, source)
|
|
|
43
45
|
|
|
44
46
|
### TAF
|
|
45
47
|
```ts
|
|
46
|
-
import { Taf } from '@
|
|
48
|
+
import { Taf } from '@headwindsimulations/api-client';
|
|
47
49
|
|
|
48
50
|
Taf.get(icao, source)
|
|
49
51
|
.then(data => {
|
|
@@ -61,7 +63,7 @@ Taf.get(icao, source)
|
|
|
61
63
|
|
|
62
64
|
### ATIS
|
|
63
65
|
```ts
|
|
64
|
-
import { Atis } from '@
|
|
66
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
65
67
|
|
|
66
68
|
Atis.get(icao, source)
|
|
67
69
|
.then(data => {
|
|
@@ -81,7 +83,7 @@ Atis.get(icao, source)
|
|
|
81
83
|
|
|
82
84
|
### Airport
|
|
83
85
|
```ts
|
|
84
|
-
import { Airport } from '@
|
|
86
|
+
import { Airport } from '@headwindsimulations/api-client';
|
|
85
87
|
|
|
86
88
|
Airport.get(icao)
|
|
87
89
|
.then(data => {
|
|
@@ -96,7 +98,7 @@ Airport.get(icao)
|
|
|
96
98
|
|
|
97
99
|
### ATC
|
|
98
100
|
```ts
|
|
99
|
-
import { Atis } from '@
|
|
101
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
100
102
|
|
|
101
103
|
ATC.get(source)
|
|
102
104
|
.then(data => {
|
|
@@ -116,7 +118,7 @@ ATC.get(source)
|
|
|
116
118
|
|
|
117
119
|
#### Connect to TELEX system
|
|
118
120
|
```ts
|
|
119
|
-
import { Telex } from '@
|
|
121
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
120
122
|
|
|
121
123
|
Telex.connect(status)
|
|
122
124
|
.then(data => {
|
|
@@ -132,7 +134,7 @@ The backend might block certain flight numbers from being used for various reaso
|
|
|
132
134
|
|
|
133
135
|
#### Update the TELEX status
|
|
134
136
|
```ts
|
|
135
|
-
import { Telex } from '@
|
|
137
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
136
138
|
|
|
137
139
|
Telex.update(status)
|
|
138
140
|
.then(data => {
|
|
@@ -150,7 +152,7 @@ The status can only be updated once a connection has been established.
|
|
|
150
152
|
|
|
151
153
|
#### Disconnect from TELEX system
|
|
152
154
|
```ts
|
|
153
|
-
import { Telex } from '@
|
|
155
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
154
156
|
|
|
155
157
|
Telex.disconnect()
|
|
156
158
|
.then(data => {
|
|
@@ -167,7 +169,7 @@ This releases the flight number for reuse and removes the flight from the live m
|
|
|
167
169
|
|
|
168
170
|
#### Sending a message
|
|
169
171
|
```ts
|
|
170
|
-
import { Telex } from '@
|
|
172
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
171
173
|
|
|
172
174
|
Telex.sendMessage(recipient, message)
|
|
173
175
|
.then(data => {
|
|
@@ -184,7 +186,7 @@ Messages will be filtered for profanity in the backend.
|
|
|
184
186
|
|
|
185
187
|
#### Receiving messages
|
|
186
188
|
```ts
|
|
187
|
-
import { Telex } from '@
|
|
189
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
188
190
|
|
|
189
191
|
Telex.fetchMessages()
|
|
190
192
|
.then(data => {
|
|
@@ -200,7 +202,7 @@ Messages can only be received once and will be acknowledged by this transaction.
|
|
|
200
202
|
|
|
201
203
|
#### Fetch a single page of active connections
|
|
202
204
|
```ts
|
|
203
|
-
import { Telex } from '@
|
|
205
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
204
206
|
|
|
205
207
|
Telex.fetchConnections(skip, take, bounds)
|
|
206
208
|
.then(data => {
|
|
@@ -218,7 +220,7 @@ Telex.fetchConnections(skip, take, bounds)
|
|
|
218
220
|
|
|
219
221
|
#### Fetch all active connections
|
|
220
222
|
```ts
|
|
221
|
-
import { Telex } from '@
|
|
223
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
222
224
|
|
|
223
225
|
Telex.fetchAllConnections(bounds, callback)
|
|
224
226
|
.then(data => {
|
|
@@ -233,7 +235,7 @@ Telex.fetchAllConnections(bounds, callback)
|
|
|
233
235
|
|
|
234
236
|
#### Fetch a certain connection
|
|
235
237
|
```ts
|
|
236
|
-
import { Telex } from '@
|
|
238
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
237
239
|
|
|
238
240
|
Telex.fetchConnection(id)
|
|
239
241
|
.then(data => {
|
|
@@ -247,7 +249,7 @@ Telex.fetchConnection(id)
|
|
|
247
249
|
|
|
248
250
|
#### Find all active connections matching a flight number
|
|
249
251
|
```ts
|
|
250
|
-
import { Telex } from '@
|
|
252
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
251
253
|
|
|
252
254
|
Telex.findConnection(flight)
|
|
253
255
|
.then(data => {
|
|
@@ -261,7 +263,7 @@ Telex.findConnection(flight)
|
|
|
261
263
|
|
|
262
264
|
#### Count active connections
|
|
263
265
|
```ts
|
|
264
|
-
import { Telex } from '@
|
|
266
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
265
267
|
|
|
266
268
|
Telex.countConnections()
|
|
267
269
|
.then(data => {
|
|
@@ -275,7 +277,7 @@ Telex.countConnections()
|
|
|
275
277
|
|
|
276
278
|
#### Get the newest commit for a branch
|
|
277
279
|
```ts
|
|
278
|
-
import { GitVersions } from '@
|
|
280
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
279
281
|
|
|
280
282
|
GitVersions.getNewestCommit(user, repo, branch)
|
|
281
283
|
.then(data => {
|
|
@@ -291,7 +293,7 @@ GitVersions.getNewestCommit(user, repo, branch)
|
|
|
291
293
|
|
|
292
294
|
#### Get all releases for a repository
|
|
293
295
|
```ts
|
|
294
|
-
import { GitVersions } from '@
|
|
296
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
295
297
|
|
|
296
298
|
GitVersions.getReleases(user, repo)
|
|
297
299
|
.then(data => {
|
|
@@ -306,7 +308,7 @@ GitVersions.getReleases(user, repo)
|
|
|
306
308
|
|
|
307
309
|
#### Get open pull requests for a repository
|
|
308
310
|
```ts
|
|
309
|
-
import { GitVersions } from '@
|
|
311
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
310
312
|
|
|
311
313
|
GitVersions.getPulls(user, repo)
|
|
312
314
|
.then(data => {
|
|
@@ -321,7 +323,7 @@ GitVersions.getPulls(user, repo)
|
|
|
321
323
|
|
|
322
324
|
#### Get the artifact URL for a pull request
|
|
323
325
|
```ts
|
|
324
|
-
import { GitVersions } from '@
|
|
326
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
325
327
|
|
|
326
328
|
GitVersions.getArtifact(user, repo, pull)
|
|
327
329
|
.then(data => {
|
|
@@ -340,7 +342,7 @@ GitVersions.getArtifact(user, repo, pull)
|
|
|
340
342
|
|
|
341
343
|
#### Get the charts for an airport
|
|
342
344
|
```ts
|
|
343
|
-
import { Charts } from '@
|
|
345
|
+
import { Charts } from '@headwindsimulations/api-client';
|
|
344
346
|
|
|
345
347
|
Charts.get(icao, source)
|
|
346
348
|
.then(data => {
|
|
@@ -357,7 +359,7 @@ Charts.get(icao, source)
|
|
|
357
359
|
|
|
358
360
|
#### Fetch data for all GNSS satellites
|
|
359
361
|
```ts
|
|
360
|
-
import { Atis } from '@
|
|
362
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
361
363
|
|
|
362
364
|
GNSS.get()
|
|
363
365
|
.then(data => {
|
|
@@ -371,7 +373,7 @@ GNSS.get()
|
|
|
371
373
|
|
|
372
374
|
#### Send the request
|
|
373
375
|
```ts
|
|
374
|
-
import { Hoppie } from '@
|
|
376
|
+
import { Hoppie } from '@headwindsimulations/api-client';
|
|
375
377
|
|
|
376
378
|
const body {
|
|
377
379
|
logon: 'XXXXXXXXX',
|
|
@@ -390,4 +392,7 @@ Hoppie.post(body)
|
|
|
390
392
|
|
|
391
393
|
## License
|
|
392
394
|
|
|
393
|
-
This software is licensed under the [MIT license](https://github.com/
|
|
395
|
+
This software is licensed under the [MIT license](https://github.com/headwindsimulations/api-client/blob/main/LICENSE).
|
|
396
|
+
|
|
397
|
+
## Credits
|
|
398
|
+
Based on the Open-Source [FlyByWire Simulations API-Client](https://github.com/flybywiresim/api-client).
|
package/dist/index.esm.js
CHANGED
|
@@ -466,7 +466,7 @@ var Hoppie = /** @class */ (function () {
|
|
|
466
466
|
var NXApi = /** @class */ (function () {
|
|
467
467
|
function NXApi() {
|
|
468
468
|
}
|
|
469
|
-
NXApi.url = new URL('https://api.
|
|
469
|
+
NXApi.url = new URL('https://api.headwindsim.net');
|
|
470
470
|
return NXApi;
|
|
471
471
|
}());
|
|
472
472
|
|
package/dist/index.esm.js.map
CHANGED
|
@@ -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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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 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\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 };\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,IA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KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAChE,YAAC;CAFD;;;;"}
|
|
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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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 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\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 };\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.headwindsim.net');\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,EAAE,CAAC;SAC3D,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAA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KACL;IAEc,gBAAU,GAAzB;QACI,OAAO,YAAU,KAAK,CAAC,WAAa,CAAC;KACxC;IAEc,uBAAiB,GAAhC;QACI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,sBAAsB,EAAE,CAAC;SACtC;KACJ;IAEc,mBAAa,GAA5B,UAA6B,UAA2B;QACpD,6BACO,UAAU,KACb,YAAY,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAC/C,WAAW,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAC/C;KACL;IAEc,gBAAU,GAAzB,UAA0B,OAAqB;QAC3C,IAAM,GAAG,yBACF,OAAO,KACV,SAAS,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GACzC,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAChD;QAED,IAAI,OAAO,CAAC,EAAE,EAAE;YACZ,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SAC5C;QAED,OAAO,GAAG,CAAC;KACd;IACL,YAAC;AAAD,CAAC;;;ICnQD;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;;;ICXD;KAEC;IADiB,SAAG,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC/D,YAAC;CAFD;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -474,7 +474,7 @@ var Hoppie = /** @class */ (function () {
|
|
|
474
474
|
var NXApi = /** @class */ (function () {
|
|
475
475
|
function NXApi() {
|
|
476
476
|
}
|
|
477
|
-
NXApi.url = new URL('https://api.
|
|
477
|
+
NXApi.url = new URL('https://api.headwindsim.net');
|
|
478
478
|
return NXApi;
|
|
479
479
|
}());
|
|
480
480
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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 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\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 };\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":["axios","AtcType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgB,GAAG,CAAI,GAAQ,EAAE,OAAa;IAC1C,OAAOA,yBAAK,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,OAAOA,yBAAK,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,OAAOA,yBAAK,CAAC,IAAI,CAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE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"index.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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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/v1/git-versions/${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 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\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 };\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.headwindsim.net');\n}\n\nexport * from './apis';\n"],"names":["axios","AtcType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAEgB,GAAG,CAAI,GAAQ,EAAE,OAAa;IAC1C,OAAOA,yBAAK,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,OAAOA,yBAAK,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,OAAOA,yBAAK,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,CAAC;SAEe,GAAG,CAAI,GAAQ,EAAE,IAAS,EAAE,OAAa;IACrD,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