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

@danmat/query-server

v0.1.2

Published

Framework-agnostic server helpers for the HTTP QUERY method (RFC 10008): validate requests, negotiate content types, and advertise Accept-Query. Built on Web-standard Request/Response.

Readme

@danmat/query-server

CI npm version minified + gzip size License: MIT

Framework-agnostic server helpers for the HTTP QUERY method (RFC 10008). Validate incoming QUERY requests, enforce the RFC's Content-Type rule, negotiate accepted query formats, and advertise them with Accept-Query.

Built on Web-standard Request/Response, so it runs anywhere they do — Hono, Deno, Bun, Cloudflare Workers, and Node (via a web adapter). Its only dependency is @danmat/accept-query.

import { checkQueryRequest, readQueryJson, withAcceptQuery } from "@danmat/query-server";

const ACCEPTED = ["application/json", "application/sql"];

async function handler(request: Request): Promise<Response> {
  // Reject non-QUERY, missing/unsupported Content-Type — with correct status codes.
  const rejection = checkQueryRequest(request, { accept: ACCEPTED });
  if (rejection) return withAcceptQuery(rejection, ACCEPTED);

  const query = await readQueryJson<{ filter: unknown }>(request);
  const results = await runQuery(query);

  return withAcceptQuery(Response.json(results), ACCEPTED);
}

Why?

RFC 10008 puts real obligations on the server: it MUST reject a QUERY whose Content-Type is missing, it should tell clients which query formats it accepts (via Accept-Query), and it needs to answer the method-override fallback that clients use when they're unsure the server speaks QUERY. This library packages those rules so your handler stays about your query logic.

Install

npm install @danmat/query-server

API

isQueryRequest(request, options?): boolean

Whether a request should be handled as a QUERY. Recognizes the QUERY method and, by default, POST + X-HTTP-Method-Override: QUERY (the fallback used by clients like @danmat/query-fetch). Disable with { allowMethodOverride: false }.

assertQueryRequest(request, options?): void

Throws a QueryRequestError (carrying the correct HTTP status and headers) when the request isn't a valid QUERY:

| Condition | Status | Extra | | --- | --- | --- | | Not a QUERY request | 405 | Allow: QUERY | | Missing Content-Type | 400 | — | | Content-Type not in accept | 415 | Accept-Query: … |

Pass { accept: ["application/json", …] } to enable media-type negotiation (wildcards and parameters supported).

checkQueryRequest(request, options?): Response | null

Non-throwing companion — returns a ready-to-send error Response, or null when the request is valid.

readQueryJson<T>(request): Promise<T>

Reads the body as JSON, guarding the content type (415 for a non-JSON type, 400 for malformed JSON).

acceptQueryHeader(mediaTypes): string

Builds an Accept-Query header value from the media types you accept (strings and/or structured ranges with q weights).

withAcceptQuery(response, mediaTypes): Response

Returns a copy of response with the Accept-Query header set — handy on both success and 415 responses.

QueryRequestError

Error subclass with status: number, headers: Record<string,string>, and toResponse(): Response.

The @danmat QUERY suite

▶️ See them work together: query-suite-example — a runnable demo using all four, with a 🌐 live playground.

License

MIT © Dan Matthew