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

@simpleworkjs/directory-schema

v1.1.0

Published

The shared sso<->client directory contract: resource kinds, metadata convention keys, the { results } envelope, the security projection (strips secrets), and a thin discovery HTTP client. Consumed by sso-manager-node (projection + schema) and jump-host (c

Readme

@simpleworkjs/directory-schema

The shared contract between the SSO directory (sso-manager-node) and its clients (jump-host, and anything else querying who-can-reach-what). Pure JS, no runtime dependencies.

It provides:

  • The schema — the resource kind enum (site | host | service | oauth), the metadata convention keys (with admin/secret flags), and the ORM field definitions for Resource / ResourceEdge / ResourceGroup.
  • The { results } envelopeenvelope(x) / unwrapEnvelope(body). The discovery API returns { results: [...] } for every list/detail endpoint; the client validates it on every call.
  • The security projectionprojectResource(r, {fullMetadata}) / projectResources(arr, opts) / isDirectoryAdmin(user). Unconditionally strips secrets (e.g. an OAuth client's client_secret_hash) and, for non-admins, restricts metadata to a public allowlist.
  • The discovery clientcreateDirectoryClient({baseUrl, apiToken, fetch?}) with getResourcesByGroup, getResourceBySlug, getGraph, getMyAccess, getAccess.

Why

Two real problems this exists to fix:

  1. SecurityResource.getGraph() / Resource.list() serialize metadata wholesale, so /api/discovery/* returned the OAuth client_secret_hash to any authenticated caller. projectResource strips it (and any key flagged secret: true, plus unknown secret-ish keys) in every response path.
  2. Contract drift — the discovery autoRouter returned a bare array, but jump-host did data.results || [], which silently collapsed to []: no user could bridge. The envelope + the validating client turn that drift into a loud error.

Install

npm install @simpleworkjs/directory-schema

Usage — server side (sso-manager-node)

const { projectResources, projectResource, isDirectoryAdmin } = require('@simpleworkjs/directory-schema');

// GET /api/discovery/resources
const full = isDirectoryAdmin(req.user);          // admin? -> keep all non-secret metadata
const resources = await Resource.search(req.query);
res.json({ results: projectResources(resources, { fullMetadata: full }) });

Usage — client side (jump-host)

const { createDirectoryClient } = require('@simpleworkjs/directory-schema');
const conf = require('@simpleworkjs/conf');

const directory = createDirectoryClient({
  baseUrl: conf.sso.url,
  apiToken: conf.sso.apiToken,
});

// Resources granted to a group (validates the { results } envelope)
const hosts = await directory.getResourcesByGroup('host_web01_access', { kind: 'host' });

Declaring a new secret field

Add it to METADATA_KEYS in lib/schema.js with secret: true. The projection strips it in both the admin and non-admin paths. Unknown keys matching /secret|password|privatekey/i are also stripped as defense in depth.

License

MIT © William Mantly