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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sabre-rest

v0.13.0

Published

A Sabre REST API client for Node.js

Readme

sabre-rest

A Sabre REST API client for Node.js, written in TypeScript.

Status: Early development. The API surface is unstable and subject to change until we reach 1.0. See CHANGELOG.md for releases.

Requirements

  • Node.js 22 or later

Install

npm install sabre-rest

Usage

import { createSabreClient, createOAuthV2, SabreBaseUrls } from 'sabre-rest';

const client = createSabreClient({
  baseUrl: SabreBaseUrls.cert,
  auth: createOAuthV2({
    clientId: process.env.SABRE_CLIENT_ID!,
    clientSecret: process.env.SABRE_CLIENT_SECRET!,
  }),
});

// Service calls coming soon as APIs are added.

CLI

The package ships a sabre-rest bin for testing the library against real Sabre servers. It is provisional — flag names and output shapes can change without notice while the library is at 0.x.

You can run the CLI either via npx sabre-rest <command> (works whether sabre-rest is installed locally in a project, installed globally, or not installed at all — npx will fetch it on demand), or by installing globally and dropping the prefix:

npm install -g sabre-rest
sabre-rest --help

Examples below use npx, but bare sabre-rest … works identically once you've installed globally.

npx sabre-rest --help
npx sabre-rest airline-lookup --codes AA,BA
npx sabre-rest airline-alliance-lookup --codes "*A,*O" --format table
npx sabre-rest bargain-finder-max \
  --from JFK --to LHR --departure-date 2025-12-25 \
  --pax ADT:1 --cabin Business --non-stop

Every command supports --body <json> to pass a complete input JSON object instead of using the per-flag ergonomics.

Output formats

The CLI emits indented JSON to stdout by default. Pass --format table for a compact human-readable summary:

  • airline-lookup — one row per airline (code, name, alternativeName)
  • airline-alliance-lookup — one row per alliance (code, name, members)
  • bargain-finder-max — one row per priced itinerary (id, legs, total, carrier, model)

The BFM table is a quick-eyeballing summary, not a full view; switch back to --format json (the default) when you need everything in the response. Since the JSON output is valid JSON, you can pipe it through any external tool you prefer for filtering — e.g., if you have jq installed and want to pull out a single field:

# Optional — only useful if you happen to use jq
npx sabre-rest bargain-finder-max --from JFK --to LHR --departure-date 2025-12-25 \
  | jq '.itineraries[0].totalFare'

The CLI itself does not require jq or any other external tool to be useful — both formats are designed to stand on their own.

Environment

The CLI reads credentials from environment variables and automatically loads a .env file from the current working directory if one exists (via Node's built-in process.loadEnvFile, no dotenv dependency). Copy .env.sample from this repo to .env to get started.

| Variable | Required | Notes | |-----------------------|-----------------------------------------|---------------------------------------------| | SABRE_CLIENT_ID | yes (every command) | OAuth v2 client id | | SABRE_CLIENT_SECRET | yes (every command) | OAuth v2 client secret | | SABRE_BASE_URL | yes (every command) | e.g. https://api.cert.platform.sabre.com | | SABRE_COMPANY_CODE | no (defaults to TN, optional for bargain-finder-max) | Agency company code. CLI defaults to TN (Sabre's Travel Network channel) — set explicitly only if your account needs a different value. | | SABRE_PCC | no (optional for bargain-finder-max) | Pseudo city code |

License

MIT