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

@terminal49/sdk

v0.2.0

Published

Terminal49 TypeScript SDK (JSON:API, openapi-fetch)

Readme

Terminal49 TypeScript SDK

Typed, server-side client for the Terminal49 JSON:API, built with openapi-fetch, generated OpenAPI types, and JSONA deserialization. Can be used standalone or inside the MCP server.

Installation

# install from npm (recommended)
npm install @terminal49/sdk

# or inside this repo
cd sdks/typescript-sdk
npm install

Usage

import { Terminal49Client } from '@terminal49/sdk';

const client = new Terminal49Client({ apiToken: process.env.T49_API_TOKEN! });
const container = await client.getContainer('container-uuid', ['shipment']);
console.log(container); // raw JSON:API document

// Optional: deserialize JSON:API to plain objects
const simplified = client.deserialize<any>(container);

Guide

For a full walkthrough (track a container, list shipments, pull events, and routing), see the SDK quickstart in the docs site: docs/api-docs/getting-started/sdk-quickstart.mdx.

Methods

  • search(query)
  • getContainer(id, include?)
  • trackContainer({ containerNumber?, bookingNumber?, scac?, refNumbers? })
  • createTrackingRequest({ requestType, requestNumber, scac?, refNumbers?, shipmentTags? })
  • inferTrackingNumber(number)
  • createTrackingRequestFromInfer(number, { scac?, numberType?, refNumbers?, shipmentTags? })
  • getShipment(id, includeContainers?)
  • listShipments(filters?, options?)
  • listContainers(filters?, options?)
  • listTrackingRequests(filters?, options?) / listTrackRequests(filters?, options?)
  • getContainerTransportEvents(id)
  • getContainerRoute(id)
  • listShippingLines(search?)
  • getDemurrage(containerId) (helper)
  • getRailMilestones(containerId) (helper)
  • deserialize<T>(document) → JSONA-based plain objects

Examples

After building, run:

cd sdks/typescript-sdk
export T49_API_TOKEN=your_token
export T49_CONTAINER_ID=valid_container_uuid
npm run build
npm run example

example.ts prints the raw JSON:API response and a simplified view using deserialize.

Development

# Generate types from OpenAPI
npm run generate:types

# Generate Mintlify-compatible TypeDoc pages
npm run docs

# Type-check
npm run type-check

# Tests
npm test

# Lint (Biome)
npm run lint

# Build
npm run build

Testing

Unit tests:

cd sdks/typescript-sdk
npm test

Type checks and lint:

cd sdks/typescript-sdk
npm run type-check
npm run lint

Smoke tests (optional, require a token):

cd sdks/typescript-sdk
export T49_API_TOKEN=your_token
export T49_API_BASE_URL=https://api.terminal49.com/v2
export T49_INFER_NUMBER=your_tracking_number
export T49_RUN_SMOKE=1
npm run smoke

Fixtures

Generate sanitized, production-based fixtures for tests:

cd sdks/typescript-sdk
export T49_API_TOKEN=your_token
export T49_API_BASE_URL=https://api.terminal49.com/v2
npm run fixtures:generate

This writes JSON:API fixtures to src/fixtures/ with redacted IDs and numbers. Numeric identifiers keep their original prefix while the last few characters are obfuscated to preserve shape without exposing real values. List endpoints are captured without include for performance guidance. Single-resource fixtures include both base and include variants where supported.

Documentation generation

The SDK uses TypeDoc with typedoc-plugin-markdown to generate Mintlify-compatible MDX pages.

cd sdks/typescript-sdk
npm run docs

Generated files are written to ../../docs/sdk/reference/ and are included in the Mintlify navigation in docs/docs.json.

From the repo root, you can also run:

npm run sdk:docs

Releasing a new version

Releases are automated via release-please.

Automated flow (default)

  1. Merge PRs to main with conventional commit prefixes (feat:, fix:, docs:, chore:, etc.) that touch sdks/typescript-sdk/.
  2. Release-please automatically opens a release PR that bumps package.json, updates CHANGELOG.md, and updates the manifest.
  3. Merge the release PR.
  4. Release-please creates a GitHub release with the sdk-v-v<version> tag.
  5. The publish workflow builds, tests, and publishes to npm automatically via npm Trusted Publishing.

Manual release (fallback)

If you need to release without release-please:

  1. Update CHANGELOG.md and bump version:
    cd sdks/typescript-sdk
    npm version patch   # or minor / major
  2. Commit and push:
    git add package.json package-lock.json CHANGELOG.md
    git commit -m "chore: release @terminal49/sdk v$(node -p "require('./package.json').version")"
    git push
  3. Create a GitHub release with tag sdk-v<version> (e.g. sdk-v0.2.0). The publish workflow will build, test, and publish to npm via npm Trusted Publishing.

Post-release

Regenerate docs if the public API changed:

npm run sdk:docs

Notes

  • Server-only: uses Node fetch (undici types) and targets Node 18+.
  • Returns raw JSON:API documents by default; use deserialize for flattened objects or add your own mappers.