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

@andco/sdk

v0.0.8

Published

Andco SDK: OAuth authorization, sessions and API access for browser and server.

Readme

@andco/sdk

OAuth, credentials, typed resource access, and Intent lifecycle for browser, server, and CLI applications. The runtime factories select the appropriate authorization and session behavior.

Developer preview: APIs may change before 1.0.

Install

pnpm add @andco/sdk @andco/bank-sdk

Use ES module imports. Browser integrations need a registered public client and a callback route that loads the app with the same SDK configuration. Server integrations require Node.js 24 or newer and a confidential client; keep its secret in the server environment.

Sign in and read accounts

import { Bank } from "@andco/bank-sdk";
import { createAndcoInstanceForBrowser } from "@andco/sdk/browser";

const andco = createAndcoInstanceForBrowser({
  clientId: "your-public-client-id",
  redirectTo: "https://app.example.com/auth/callback",
});
const bank = new Bank();
const { error: signInError } = await andco.auth.signIn({
  scopes: ["openid", "email"],
  authorizations: [bank.accounts.authorization({ actions: ["read"], subject: { type: "profile" } })],
});
if (signInError) throw signInError;
const { data: accounts, error } = await bank.use(andco.authorized()).client.http.GET("/accounts");
if (error) throw error;
console.log(accounts.edges);

Register the callback URL exactly and run signIn from a user click. OIDC scopes identify the person; the Bank builder requests access to their accounts.

Server OAuth

Set ANDCO_CLIENT_ID and ANDCO_CLIENT_SECRET on the server. Register https://app.example.com/auth/callback for this confidential client. In the login handler:

import { Bank } from "@andco/bank-sdk";
import type { AndcoAuthorizationRequest, AndcoSession } from "@andco/sdk";
import { createAndcoInstanceForServer } from "@andco/sdk/server";

const server = createAndcoInstanceForServer({
  clientId: process.env.ANDCO_CLIENT_ID!,
  clientSecret: process.env.ANDCO_CLIENT_SECRET!,
});
export async function startSignIn() {
  const { data: request, error } = await server.oauth.createAuthorizationRequest({
    redirectTo: "https://app.example.com/auth/callback",
    scopes: ["openid", "email"],
    authorizations: [
      new Bank().accounts.authorization({
        actions: ["read", "read_balance"],
        subject: { type: "profile" },
      }),
    ],
  });
  if (error) throw error;
  return request; // Store privately, then redirect to request.authorizationUrl.
}

// In the callback handler, recover that request and pass the complete callback URL:
export async function finishSignIn(callbackUrl: string, request: AndcoAuthorizationRequest) {
  const { data: session, error } = await server.oauth.exchangeCallback({ callbackUrl, request });
  if (error) throw error;
  return session; // Save privately before making further API calls.
}

// In an authenticated request, load that session from your server-side store:
export async function readAccounts(session: AndcoSession) {
  const { data: page, error } = await new Bank(server.with(session)).client.http.GET("/accounts");
  if (error) throw error;
  return page;
}

These are handler fragments: recover the transaction from your login store in each callback instead of sharing it between requests. Save the returned session privately. A session passed to with is a snapshot; your session layer also owns renewal and storage of rotated tokens. Your application owns the HTTP routes and session persistence; see the server guide for a complete handler.

End the browser session

const { error } = await andco.auth.signOut({ revoke: true });
if (error) throw error;

revoke: true revokes the Resource Grants and Identity Session before clearing local state. Plain signOut() only forgets the local session. Handle a failed revocation before discarding credentials needed to retry it.

Other capabilities

  • @andco/sdk/server: confidential OAuth, approved Service credentials, and request-local andco.with(credentials).
  • @andco/sdk/cli: terminal authorization with a registered loopback callback.
  • andco.intents: read, present, approve, reject, cancel, and follow Intents created by a Resource Server.
  • andco.resource: protect an application-owned Resource Server with audience-specific credentials and a live Grant.
  • andco.grants: inspect or revoke delegated access.

Each Resource Server resolves its own Resource Token through accessTokenFor(resource). The Identity Session is for UserInfo and sign-out. Keep confidential client secrets on the server.

Learn more

Method contracts, options, and lifecycle details are documented in the exported JSDoc and API reference.

Collection traversal

See REST pagination for pagination.listIterator, pagination.cursor, backward cursors, offsets, cancellation and stable Grant selection.

Bun and Deno smoke test

The runtime smoke test exercises the built public exports of @andco/sdk and @andco/sdk/server. It checks server client construction, bearer authentication on REST requests, traversal of two pages with opaque cursors, stopping at the terminal page, and UUID generation with the runtime's Web Crypto implementation.

Run these commands from the andco-sdk-js workspace root after installing dependencies with pnpm install. Build first so the test uses the current package code:

pnpm build

bun packages/sdk/tests/runtime-smoke.mjs

deno run --node-modules-dir=manual --no-config --no-lock \
  packages/sdk/tests/runtime-smoke.mjs

If Deno is not installed, replace deno run with pnpm dlx deno run. Manual node_modules mode uses the dependencies already installed by pnpm. The Deno command does not create a lockfile or require network permissions; the test injects a simulated fetch and needs no backend, credentials, or environment variables.

Both runtimes should print:

PASS: public imports, server client, authenticated REST, cursor pagination, Web Crypto

This test passed with Bun 1.3.14 and Deno 2.9.6 on macOS arm64 on October 5, 2026. It checks the local built packages; it does not test installation from npm, a complete OAuth flow against an Authorization Server, or browser and CLI adapters. Run it separately from pnpm test: it is a standalone script, not a Vitest suite.