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

@openish/client

v0.0.1

Published

Sends the request an OpenAPI document describes, and obtains the token it needs. No framework, no dependencies.

Readme

@openish/client

Sends the request an OpenAPI document describes, and obtains the token it needs.

No framework, and no dependencies — it takes a HAR request, the shape @openish/core builds with operationToHar, and a security scheme. It knows nothing about OpenAPI documents, Lit, or the DOM except in the two OAuth transports, which need a browser by definition.

import { sendRequest } from '@openish/client'

const result = await sendRequest(har, { proxyUrl })

if (result.ok) {
  console.log(result.status, result.durationMs, result.body)
} else {
  console.log(result.message) // says what happened, not "Failed to fetch"
}

Every function that reaches the network takes its fetch, which is what makes this testable in Node and lets a host bring its own transport, proxy, or instrumentation.

Sending

sendRequest returns a result rather than throwing. An HTTP error is not a failure — a 404 is an answer, and a reference that hides it behind an error state hides the thing the reader was testing for. What is a failure is the browser refusing to make the request at all, which arrives as TypeError: Failed to fetch with no detail whatsoever; the message you get instead names the origin and the two things that are actually true about it.

Cookie parameters are reported by unsendableCookies rather than dropped quietly: script cannot set Cookie on a fetch, and pretending otherwise produces a request that silently is not the one the documentation describes.

The proxy contract

A host may run a forwarder for APIs that do not allow their origin. openish neither ships nor hosts one: a proxy sees every credential that passes through it, so it has to be the reader's own infrastructure. Point proxyUrl at it and the contract is one line — the request arrives as

POST https://your-proxy.example.com/forward?target=https%3A%2F%2Fapi.example.com%2Fv1%2Faccounts

with its method, headers, and body intact. Return whatever the target answers.

Authentication

Authorization code with PKCE, and OpenID Connect discovery. Other grants are not implemented; a scheme of any type still accepts a token someone already has, through AuthSession.setPasted.

const { configuration } = await discoverOidc(scheme.openIdConnectUrl)
const pkce = await createPkce()
const state = createState()

const outcome = await authorizeInPopup(
  authorizeUrl({ ...configuration, clientId, redirectUri, scopes, state, challenge: pkce.challenge }),
  state,
)

if (outcome.ok) {
  const token = await exchangeCode({ ...configuration, code: outcome.code, verifier: pkce.verifier, clientId, redirectUri })
}

Two rules the code enforces rather than documents:

  • A client secret is only ever sent through proxyUrl. A secret in a page is not a secret. Providers that require one for a browser client are misconfigured for that use, and the honest answer is to refuse and say so rather than to leak it and work.
  • state is verified and the redirect URI must be same-origin. A code that arrives under a state we did not issue was not issued for us, and a redirect URI we do not control is one we cannot read the code from anyway.

AuthSession holds what the reader has, in memory, for the life of the page and nowhere else. Persisting a token is a decision with a threat model attached, so it belongs to the host — which is why @openish/elements re-dispatches every change as an event instead of writing to storage. session.credentials() returns exactly the shape operationToHar's credentials option takes: that is the seam between holding a credential and putting one on a request, and it is deliberately the only way across.