npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@patrickisgreat/fbw-api-client-fork

v0.17.0

Published

Client library for the BeefSupreme Simulations API

Downloads

3

Readme

FlyByWire Simulations API Client

The official JavaScript client for the FBW API. The library supports both JavaScript and TypeScript.

Installation

Install the client library using npm:

$ npm install --save @flybywiresim/api-client

Usage

Initializing the client

import { NXApi } from '@flybywiresim/api-client';

NXApi.url = new URL('http://localhost:3000');

By default, the URL is set to https://api.flybywiresim.com. If this is the desired URL this step can be omitted.

METAR

import { Metar } from '@flybywiresim/api-client';

Metar.get(icao, source)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • icao is a string of the the airport ICAO code to get the METAR for.
  • source is the selected datasource for the METAR and is optional. Valid sources are:
    • vatsim
    • ms
    • ivao
    • pilotedge

TAF

import { Taf } from '@flybywiresim/api-client';

Taf.get(icao, source)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • icao is a string of the the airport ICAO code to get the TAF for.
  • source is the selected datasource for the TAF and is optional. Valid sources are:
    • aviationweather
    • faa

ATIS

import { Atis } from '@flybywiresim/api-client';

Atis.get(icao, source)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • icao is a string of the the airport ICAO code to get the ATIS for.
  • source is the selected datasource for the ATIS and is optional. Valid sources are:
    • faa
    • vatsim
    • ivao
    • pilotedge

Airport

import { Airport } from '@flybywiresim/api-client';

Airport.get(icao)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • icao is a string of the the airport ICAO code to search for.

ATC

import { Atis } from '@flybywiresim/api-client';

ATC.get(source)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • source is the selected datasource for the ATC. Valid sources are:
    • vatsim
    • ivao

TELEX connection handling

Connect to TELEX system

import { Telex } from '@flybywiresim/api-client';

Telex.connect(status)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • status is of type AircraftStatus and contains information about the current flight.

The backend might block certain flight numbers from being used for various reasons.

Update the TELEX status

import { Telex } from '@flybywiresim/api-client';

Telex.update(status)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • status is of type AircraftStatus and contains information about the current flight.

The status has to updated every 6 minutes for the connection to stay alive. It is recommended to update the status every 15 seconds for a usable live map. The status can only be updated once a connection has been established.

Disconnect from TELEX system

import { Telex } from '@flybywiresim/api-client';

Telex.disconnect()
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});

The connection can only be disconnected once it has been established. This releases the flight number for reuse and removes the flight from the live map.

TELEX message handling

Sending a message

import { Telex } from '@flybywiresim/api-client';

Telex.sendMessage(recipient, message)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • recipient is a string containing the flight number of the recipient flight.
  • message is a string containing the message to send.

Messages will be filtered for profanity in the backend.

Receiving messages

import { Telex } from '@flybywiresim/api-client';

Telex.fetchMessages()
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});

Messages can only be received once and will be acknowledged by this transaction.

TELEX Querying

Fetch a single page of active connections

import { Telex } from '@flybywiresim/api-client';

Telex.fetchConnections(skip, take, bounds)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • skip is a number and tells the backend to skip the first n connections.
  • take is a number and tells the backend how many connections to send.
  • bounds is an optional bounding box. Query only connections within this area.

take and skip are used to control the pagination. A maximum of 100 entries can be fetched at a time.

Fetch all active connections

import { Telex } from '@flybywiresim/api-client';

Telex.fetchAllConnections(bounds, callback)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • bounds is an optional bounding box. Query only connections within this area.
  • callback gets called after every fetched page.

Fetch a certain connection

import { Telex } from '@flybywiresim/api-client';

Telex.fetchConnection(id)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • id is the unique identifier of the connection.

Find all active connections matching a flight number

import { Telex } from '@flybywiresim/api-client';

Telex.findConnection(flight)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • flight is the flight number to search for.

Count active connections

import { Telex } from '@flybywiresim/api-client';

Telex.countConnections()
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});

Github

Get the newest commit for a branch

import { GitVersions } from '@flybywiresim/api-client';

GitVersions.getNewestCommit(user, repo, branch)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • user the owner of the repository.
  • repo the repository.
  • branch the requested branch.

Get all releases for a repository

import { GitVersions } from '@flybywiresim/api-client';

GitVersions.getReleases(user, repo)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • user the owner of the repository.
  • repo the repository.

Get open pull requests for a repository

import { GitVersions } from '@flybywiresim/api-client';

GitVersions.getPulls(user, repo)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • user the owner of the repository.
  • repo the repository.

Get the artifact URL for a pull request

import { GitVersions } from '@flybywiresim/api-client';

GitVersions.getArtifact(user, repo, pull)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • user the owner of the repository.
  • repo the repository.
  • pull the number of the pull request.

Charts

Get the charts for an airport

import { Charts } from '@flybywiresim/api-client';

Charts.get(icao, source)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});
  • icao is a string of the the airport ICAO code to search for.

GNSS

Fetch data for all GNSS satellites

import { Atis } from '@flybywiresim/api-client';

GNSS.get()
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});

Hoppie

Send the request

import { Hoppie } from '@flybywiresim/api-client';

const body {
  logon: 'XXXXXXXXX',
  from: 'TEST0',
  to: 'TEST0',
  type: 'poll'
}
Hoppie.post(body)
  .then(data => {
    console.log(data);
  }).catch(err => {
    console.error(err);
});

License

This software is licensed under the MIT license.