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

ab-ecosystem-node

v0.1.4

Published

Node SDK for the Partner Ecosystem: JWKS-based auth middleware and server-to-server actions.

Downloads

228

Readme

@partner-ecosystem/node

Node SDK for the Partner Ecosystem. Initialise it once at application start-up, then use its middlewares (e.g. JWKS-based auth) and actions (server-to-server API calls).

Install

npm install @partner-ecosystem/node

express is a peer dependency (only needed if you use the middlewares).

Initialise

import { init } from '@partner-ecosystem/node';

export const partner = init({
  apiUrl: process.env.PARTNER_API_URL!,        // e.g. https://api.example.com
  projectId: process.env.PARTNER_PROJECT_ID!,
  projectSecret: process.env.PARTNER_PROJECT_SECRET!,
});

| Option | Required | Default | Description | | --------------- | -------- | --------------------------- | -------------------------------------------------------- | | apiUrl | yes | — | Base URL of the Partner Ecosystem API. | | projectId | yes | — | Public project identifier (also default token aud). | | projectSecret | yes | — | Secret used to authenticate action calls. | | jwksPath | no | /.well-known/jwks.json | JWKS endpoint relative to apiUrl. | | issuer | no | (unchecked) | Expected iss claim of incoming tokens. | | audience | no | projectId | Expected aud claim of incoming tokens. | | jwks | no | — | cacheMaxAge / cooldownDuration / timeoutDuration. |

Middlewares

auth() — JWKS bearer-token authentication

Verifies the Authorization: Bearer <jwt> header. The token's kid selects the public key from <apiUrl>/.well-known/jwks.json; on success the decoded payload is attached as req.user and the request continues to the next handler.

import express from 'express';
import { partner } from './partner';

const app = express();

// Global
app.use(partner.middlewares.auth());

// Per-route
app.get('/me', partner.middlewares.auth(), (req, res) => {
  res.json({ user: req.user });
});

// Optional auth (sets req.user when a valid token is present, never 401s)
app.get('/feed', partner.middlewares.auth({ optional: true }), handler);

On a missing or invalid token the middleware responds 401 with { error, message } (unless optional: true).

req.user is typed via AuthUser. Add your own claims with declaration merging:

declare module '@partner-ecosystem/node' {
  interface AuthUser {
    orgId: string;
    roles: string[];
  }
}

Actions

Server-to-server calls authenticated with the project credentials. Results are delivered through a node-style callback (error, result).

partner.actions.ping((err, result) => {
  if (err) return console.error('partner API unreachable', err);
  console.log('partner API ok:', result?.ok);
});

Development

npm install
npm run build       # compile to dist/ (+ .d.ts)
npm run typecheck   # type-check without emitting