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

tally-protocol

v0.1.1

Published

Tally Query Protocol: wire schemas, request validation, JSON Schema and the adapter conformance suite.

Readme

tally-protocol

The wire contract between a Tally grid and a data source: Zod schemas for every request and response, validation of a request against a Schema, generated JSON Schema files, and the conformance suite an adapter runs to prove it answers queries exactly like the in-memory engine.

Not published yet.

Install

npm install tally-protocol tally-core

Wire types

| Schema | Type | Direction | | ----------------------- | ----------------------------------------- | ---------------------- | | queryRequestSchema | QueryRequest from core | POST /query body | | queryResponseSchema | QueryResponse from core | POST /query response | | mutationRequestSchema | { version: 1, mutations } | PATCH /rows body | | mutationResultSchema | MutationResult from core | PATCH /rows response | | rowPatchSchema | RowPatch from core | live events | | schemaResponseSchema | { version, columns, capabilities, key } | GET /schema response |

Every schema is a z.ZodType of the matching tally-core type, so the client and the server share one definition.

Validating a request

import { createSchema } from 'tally-core'
import { validateQueryRequest } from 'tally-protocol'

const schema = createSchema({ columns, key: 'id' })

const request = validateQueryRequest(await req.json(), schema)

validateQueryRequest parses the shape, then checks it against the schema: columns exist and allow the operation, operators are supported by the column type, values match the operator arity and the value kind, aggregates and facets are available for the column. It throws a TallyError with code invalid_query and one detail per problem. queryIssues returns the same list without throwing. validateMutationRequest and mutationIssues do the same for mutations.

JSON Schema

schemas/*.json are generated from the Zod schemas and shipped with the package for adapters written in other languages:

import queryRequest from 'tally-protocol/schemas/query-request.json' with { type: 'json' }

toJsonSchema(name) returns the same document at runtime.

Conformance

An adapter is conformant when it returns the same rows, totals, groups, aggregates and facets as tally-core's executor for the fixture dataset.

import { runConformance } from 'tally-protocol'

const report = await runConformance((request) => adapter.query(request), {
  capabilities: adapter.capabilities,
})

expect(report.failures).toEqual([])

conformanceRows and conformanceSchema cover every built-in column type with empty values in each column. Relative date filters resolve against CONFORMANCE_TODAY, so the adapter under test must be created with that date as its today. Cases that need a capability the adapter does not declare are skipped. Offset adapters also run the page cases, cursor adapters are walked page by page until the cursor runs out. Every failure lists what differed, by path.