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

weconnect-3pl

v0.2.6

Published

Official TypeScript/JavaScript SDK for the WeConnect 3PL API (REST /api/v1).

Readme

weconnect-3pl

Official TypeScript/JavaScript SDK for the WeConnect 3PL API. A thin, fully-typed wrapper over the REST API (/api/v1) — authenticate with your tenant API key and call typed methods instead of writing fetch by hand.

  • ✅ Works in Node 18+ and modern browsers (uses global fetch)
  • ✅ Full TypeScript types for every request and response
  • ✅ Throws a typed WeConnectApiError (code, status, message)
  • ✅ Helper to verify inbound webhook signatures

Install

npm install weconnect-3pl

Local development install

Working against a local checkout instead? Build (npm run build) then install the folder directly — matching your consumer's package manager (npm install <path> / pnpm add <path> / yarn add <path>) — or npm pack and install the tarball.

Quick start

import { WeConnectClient } from "weconnect-3pl";

const client = new WeConnectClient({
  apiKey: process.env.WECONNECT_API_KEY!, // wc_live_…
  baseUrl: "https://app.weconnect3pl.com", // your API origin
});

// List fulfillment centers
const centers = await client.centers.list();

// Register a product
const product = await client.products.create({ sku: "MUG-WHT", name: "White Mug" });

// Set on-hand quantity for a SKU at a center (writes the immutable ledger)
const item = await client.inventory.adjust({
  centerId: centers[0].id,
  sku: "MUG-WHT",
  mode: "SET", // or "ADJUST" with `delta`
  quantity: 100,
  reason: "cycle count",
});

// Read that product's history
const history = await client.inventory.history({ productId: product.id, limit: 50 });
console.log(history.totalCount, history.items);

API surface

| Group | Methods | | ----- | ------- | | client.centers | list(), get(id), create(input), update(id, input) | | client.products | list({ search? }), get(id), create(input), update(id, input) | | client.inventory | list({ centerId?, productId?, search? }), adjust(input), history({ centerId?, productId?, type?, from?, to?, limit?, offset? }) | | client.shipments | list({ direction?, status? }), get(id), create(input), updateStatus(id, status), refreshTracking(id) | | client.transfers | list({ status? }), create(input), updateStatus(id, status) | | client.tracking | list({ shipmentId? }) |

GraphQL

Prefer GraphQL? The same client exposes a typed GraphQL client at client.graphql (talking to POST /api/graphql with the same API key), or import WeConnectGraphQLClient directly:

import { WeConnectClient, WeConnectGraphQLClient } from "weconnect-3pl";

const client = new WeConnectClient({ apiKey, baseUrl });

// Typed convenience methods
const centers = await client.graphql.centers();
const metrics = await client.graphql.overviewMetrics();
const item = await client.graphql.adjustInventory({ centerId, sku: "MUG-WHT", mode: "ADJUST", delta: 7 });
const history = await client.graphql.inventoryHistory({ productId, limit: 50 });

// Or run any custom operation with your own types
const gql = new WeConnectGraphQLClient({ apiKey, baseUrl });
const { products } = await gql.request<{ products: { sku: string }[] }>(
  `query { products { sku name } }`,
);

Available on client.graphql / WeConnectGraphQLClient: centers, products, inventory, inventoryHistory, shipments, transfers, trackingEvents, overviewMetrics, plus mutations createCenter, updateCenter, createProduct, updateProduct, adjustInventory, createShipment, updateShipmentStatus, refreshShipmentTracking, createTransfer, updateTransferStatus, and the generic request<TData, TVariables>(query, variables?). GraphQL result types are exported as Gql* (e.g. GqlShipment).

Error handling

import { WeConnectApiError } from "weconnect-3pl";

try {
  await client.centers.get("does-not-exist");
} catch (err) {
  if (err instanceof WeConnectApiError) {
    console.error(err.status, err.code, err.message); // e.g. 404 NOT_FOUND "Not found"
  }
}

Verifying webhooks (Node)

When WeConnect forwards events to your endpoint it signs the body with your endpoint secret. Verify it before trusting the payload:

import { verifyWebhookSignature, SIGNATURE_HEADER } from "weconnect-3pl";

// e.g. inside an Express handler with the RAW body
const ok = verifyWebhookSignature(
  process.env.WEBHOOK_SECRET!,
  rawBody, // the exact bytes, not parsed JSON
  req.headers[SIGNATURE_HEADER] as string,
);
if (!ok) return res.status(401).end();

Node < 18

Global fetch isn't available before Node 18 — pass your own:

import fetch from "node-fetch";
const client = new WeConnectClient({ apiKey, baseUrl, fetch: fetch as any });

License

MIT