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

shipengine

v1.0.7

Published

The official ShipEngine JavaScript SDK for Node.js

Downloads

11,821

Readme

ShipEngine

ShipEngine JavaScript SDK

The official ShipEngine JavaScript SDK for Node.js

npm License

Build Status Coverage Status Dependencies

OS Compatibility

Quick Start

Install ShipEngine JavaScript SDK via npm.

npm install shipengine

The only configuration requirement is an API key.

const ShipEngine = require("shipengine");

const shipengine = new ShipEngine("___YOUR_API_KEY_HERE__");

Configuring the ShipEngine SDK

  • Be sure to configure the SDK if you would like to update things like retries, timeouts, and page sizes using the ShipEngine Config interface. Alternatively, you can simply pass in your ShipEngine API Key and use the default configuration.
export interface ShipEngineConfig {
  /**
   * Your ShipEngine API key.
   *
   * This can be a production or sandbox key. Sandbox keys start with "TEST_".
   */
  apiKey: string;

  /**
   * ShipEngine child account API key (partner API)
   *
   * This can be a production or sandbox key. Sandbox keys start with "TEST_".
   */
  onBehalfOf?: string;

  /**
   * The URL of the ShipEngine API. You can usually leave this unset and it will
   * default to our public API.
   */
  baseURL?: string | URL;

  /**
   * Some ShipEngine API endpoints return paged data. This lets you control the
   * number of items returned per request. Larger numbers will use more memory
   * but will require fewer HTTP requests.
   *
   * Defaults to 50.
   */
  pageSize?: number;

  /**
   * If the ShipEngine client receives a rate limit error it can automatically
   * retry the request after a few seconds. This setting lets you control how
   * many times it will retry before giving up.
   *
   * Defaults to 1, which means up to 2 attempts will be made (the original
   * attempt, plus one retry).
   */
  retries?: number;

  /**
   * The maximum amount of time (in milliseconds) to wait for a response from
   * the ShipEngine server.
   *
   * Defaults to 60000 (60 seconds).
   */
  timeout?: number;
}

Methods

  • createLabelFromRate - When retrieving rates for shipments using the getRatesWithShipmentDetails method, the returned information contains a rateId property that can be used to purchase a label without having to refill in the shipment information repeatedly.
  • createLabelFromShipmentDetails - Purchase and print a label for shipment.
  • getRatesWithShipmentDetails - Given some shipment details and rate options, this method returns a list of rate quotes.
  • listCarriers - Returns a list of carrier accounts that have been connected through the ShipEngine dashboard.
  • trackUsingLabelId - Track a package by its associated label ID.
  • trackUsingCarrierCodeAndTrackingNumber - Track a package for a given carrier and tracking number.
  • validateAddresses - Indicates whether the provided addresses are valid. If the addresses are valid, the method returns a normalized version based on the standards of the country in which the address resides. If an address cannot be normalized, an error is returned.
  • voidLabelWithLabelId - Void a label with its Label ID.

Contributing

Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.

Building

To build the project locally on your computer:

  1. Clone this repo git clone https://github.com/ShipEngine/shipengine-js.git

  2. Install dependencies npm install

  3. Build the code npm run build Or you can use npm run watch to automatically re-build whenever source files change.

  4. Lint the code npm run lint Or you can use npm run lint:fix to automatically fix most linting errors.

  5. Run the tests npm test This runs tests in both Node.js and web browsers. Use npm run test:node to only run Node.js tests, or npm run test:browser to only run browser tests.

Committing

This project adheres to the Conventional Commits specification.

Publishing

Publishing new versions of the SDK to NPM is handled on GitHub via the Release Please GitHub Actions workflow. Learn more about about Release PRs, updating the changelog, and commit messages here.