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

@gomagentic/verdict-sdk

v0.1.1

Published

Verdict client SDK for JavaScript/TypeScript: one interface (check, batchCheck, authorize, explain, simulate) over embedded engines, hybrid SyncedVerdict, or a remote PDP.

Readme

@gomagentic/verdict-sdk

One client interface over embedded, hybrid, and remote authorization.

Part of Verdict — a serverless-first authorization engine. Policies (RBAC / ABAC / ReBAC) compile once and decide in microseconds, embedded in your app, behind a central PDP, or synced to the edge.

Install

npm install @gomagentic/verdict-sdk

The client interface

Every deployment mode satisfies one interface, VerdictClient. Application code depends on it and never on the mode, so you swap the implementation and keep the call sites:

interface VerdictClient {
  check(request: CheckRequest): Promise<Decision>;
  batchCheck(request: BatchCheckRequest): Promise<BatchDecision>;
  authorize(input: AuthorizeInput): Promise<boolean>;   // one action, default-deny boolean
  explain(request: CheckRequest): Promise<Decision>;     // check() plus the full trace
  simulate(policyId: string, request: CheckRequest, options?: SimulateOptions): Promise<Decision>;
}
  • check / batchCheck — evaluate one or many requests and return the Decision / BatchDecision shapes from @gomagentic/verdict-core.
  • authorize — a convenience over check for exactly one action: takes { principal, resource, action, context?, tenantId? } and returns a default-deny boolean.
  • explain — the same evaluation as check, carrying the full trace (matched rule, conditions, missing attributes).
  • simulate — a control-plane dry run against a policy's draft (default) or published state via SimulateOptions.useDraft. It requires the PDP; embedded clients reject it.

Two helpers back the boolean path and are exported directly: toCheckRequest(input) turns an AuthorizeInput into a CheckRequest, and decisionAllows(decision, action) reads a single action's effect off a Decision.

Remote PDP

RemoteClient talks to a PDP over HTTP. It uses the global fetch unless you pass fetchImpl:

import { RemoteClient, decisionAllows } from "@gomagentic/verdict-sdk";

const client = new RemoteClient({
  baseUrl: "https://pdp.example.com",
  token: process.env.VERDICT_TOKEN!, // API key (check scope) or OIDC bearer
  retries: 2,                         // network errors and 5xx retry; 4xx never does
});

const decision = await client.check({
  principal: { id: "u_42", roles: ["employee"], attr: { department: "eng" } },
  resource: { kind: "leave", id: "lv_9", attr: { managerId: "u_42" } },
  actions: ["approve"],
});
decisionAllows(decision, "approve"); // true | false

// Or the single-action boolean shortcut:
const ok = await client.authorize({
  principal: { id: "u_42", roles: ["employee"] },
  resource: { kind: "leave", id: "lv_9" },
  action: "approve",
});

Network errors and 5xx retry with linear backoff (decision calls are idempotent); 4xx is authoritative, never retried, and surfaces the PDP's error taxonomy as a VerdictError. retryDelayMs, sleep, and fetchImpl are injectable for tuning, testing, and exotic runtimes. Pass tenant only when using tenantless (admin) credentials.

Embedded

EmbeddedClient wraps an in-process engine — anything satisfying LocalEvaluator (synchronous check / batchCheck / explain). A Verdict instance from @gomagentic/verdict-engine satisfies it structurally, so the SDK depends on no engine package:

import { Verdict } from "@gomagentic/verdict-engine";
import { EmbeddedClient } from "@gomagentic/verdict-sdk";

const engine = await Verdict.fromBundle(bundle);
const client = new EmbeddedClient(engine); // same VerdictClient interface

simulate() rejects on embedded clients — drafts live in the control plane. For local what-if runs, compile an ephemeral program with @gomagentic/verdict-dsl.

Hybrid

For hybrid and edge deployments, back an EmbeddedClient with a SyncedVerdict from @gomagentic/verdict-sync instead of a plain Verdict. It also satisfies LocalEvaluator structurally, so decisions stay local and zero-network while policy bundles sync from a control plane. The call sites are unchanged.

Documentation

License

Apache-2.0