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

@askdepth/audience-connector

v0.1.2

Published

The Askdepth Audience SDK connector — a Web-standard Request → Response handler a client deploys inside their own perimeter. Zero runtime dependencies in core; postgres and rest adapters; Express/Fastify/Lambda shims.

Readme

@askdepth/audience-connector

The client-side connector for Askdepth's audience layer. A research on the Askdepth platform sends this connector a signed criteria query; it runs inside your infrastructure, against your database, and answers with counts and a capped, column-mapped, read-only result set. Your raw data and your database credentials never leave your perimeter.

  • Web-standard Request → Response handler; framework shims are thin wrappers.
  • Zero runtime dependencies in core. pg is an optional peer.
  • Mandatory HMAC-SHA256 verification — no local-testing bypass.
  • Dual ESM/CJS.

Full deployment guide: docs/deployment.md. Runtime matrix: docs/runtime-support.md.

Public API

import {
  createConnector,
  postgresAdapter,
  restAdapter,
  CONTRACT_VERSION,
} from '@askdepth/audience-connector';

import { expressHandler } from '@askdepth/audience-connector/express';
import { fastifyPlugin } from '@askdepth/audience-connector/fastify';
import { lambdaHandler } from '@askdepth/audience-connector/lambda';

createConnector(config): { fetch(request: Request): Promise<Response> }

| config field | | | |---|---|---| | secret | string \| Buffer | signing secret issued by Askdepth | | previousSecret? | string \| Buffer | accepted during a rotation overlap | | adapter | Adapter | postgresAdapter(…) or restAdapter(…) | | fieldMapping | Partial<Record<CanonicalField, string>> | canonical field → your column. The whitelist. | | attributes? | { filterable: string[]; returnable?: string[] } | attr.* fields; ≤10 filterable; filter-only unless returnable | | capabilities? | Partial<Record<CapabilityFlag, boolean>> | narrows the adapter's advertised set (cannot widen) | | basePath? | string | default /askdepth/v1 | | timeouts? | { interactiveMs?: number; backgroundMs?: number } | default 5 000 / 30 000 |

postgresAdapter(opts): Adapter

{ pool: pg.Pool, table: string, schema?: string, externalIdColumn?: string, maxStatementTimeoutMs?: number }

Compiles the criteria DSL to parameterised, read-only SELECT over mapped columns only. You pass your own pg.Pool; this package never constructs one or sees a connection string.

restAdapter(opts): Adapter

{ fetchCandidates, declaredSchema, fetchCount?, capabilities? }

For non-Postgres backends. You supply the function that talks to your system; the adapter re-enforces every invariant on its output (strip unmapped keys, 1 000-row cap, per-row canonical-schema validation, abort over partial).

Shims

| import | returns | |---|---| | @askdepth/audience-connector/express → expressHandler(connector) | Express RequestHandler — mount behind express.raw({ type: 'application/json' }) | | @askdepth/audience-connector/fastify → fastifyPlugin(connector) | FastifyPluginAsync — installs a raw-buffer content-type parser | | @askdepth/audience-connector/lambda → lambdaHandler(connector) | API Gateway HTTP API v2 handler; honours isBase64Encoded |

Endpoints

GET /health · GET /schema · POST /candidates/count · POST /candidates/search — all under basePath, all requiring a valid signature. Deterministic cursor pagination, hard 1 000-row cap, random subsample only.