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-adapters

v0.1.1

Published

Client data sources for Tally: HTTP, TanStack Query, TanStack DB and Supabase.

Downloads

67

Readme

tally-adapters

Client data sources for Tally. Each one implements the DataSource contract from tally-core, so a grid does not care whether rows come from an array, an HTTP endpoint, a query cache or a sync engine.

Not published yet.

Install

npm install tally-adapters tally-core

HTTP

Talks to any server that speaks the Tally Query Protocol, such as tally-server. One round trip fetches the schema and the capabilities, and the returned source handles /query, /rows and the /events stream.

import { connectHttpSource } from 'tally-adapters'
import { Tally, useGrid } from 'tally-react'

const { schema, source } = await connectHttpSource({
  url: '/api/tally',
  headers: () => ({ authorization: `Bearer ${token()}` }),
})

const grid = useGrid({ schema, source })

| Option | Type | Notes | | ---------- | ------------------------------------------------ | ------------------------------------------------ | | url | string | Base URL of the handler, relative or absolute. | | headers | HeadersInit \| () => HeadersInit \| Promise<…> | Sent with every request and the event stream. | | fetch | typeof fetch | Defaults to the global fetch. | | registry | TypeRegistry | Custom column types the server schema refers to. |

createHttpSource builds a source without the schema round trip when the capabilities are already known, and fetchSchema returns the raw SchemaResponse.

Responses are validated against the protocol schemas. Protocol failures surface as HttpSourceError with status, code, message and details, matching the error body of the handler. Query requests pass the grid's AbortSignal through, so a superseded request is cancelled on the wire.

Live patches arrive over server sent events. The stream reconnects on its own and is closed when the grid disposes. Sources whose server reports live: false expose no subscribe, and read only servers expose no mutate.

TanStack Query

Wraps any source so its requests go through a QueryClient: identical requests are deduped, results are cached by request, and the devtools show every grid query. Import from tally-adapters/query.

import { QueryClient } from '@tanstack/query-core'
import { createQuerySource } from 'tally-adapters/query'

const client = new QueryClient()
const source = createQuerySource({
  client,
  source: remote,
  queryKey: ['accounts'],
  staleTime: 30_000,
})

Queries are keyed [...queryKey, 'query', request] and the schema [...queryKey, 'schema']. An accepted mutation or a live patch invalidates every query under the key, so the next request refetches. source.invalidate() does the same by hand.

TanStack DB

Runs the grid over a collection: filters, sorts, groups, aggregates and facets execute locally with the reference engine, collection changes arrive as live patches, and edits go through insert, update and delete so the collection's own persistence handlers and optimistic state apply. Import from tally-adapters/db.

import { createCollection } from '@tanstack/db'
import { queryCollectionOptions } from '@tanstack/query-db-collection'
import { createCollectionSource } from 'tally-adapters/db'

const accounts = createCollection(
  queryCollectionOptions({ queryKey: ['accounts'], queryFn, queryClient, getKey: (row) => row.id }),
)
const source = createCollectionSource(accounts, schema)

| Option | Type | Notes | | --------- | --------------------------- | -------------------------------------------------------------- | | mutable | boolean | Default true. | | item | (row: RowData) => RowData | Maps a new grid row to a collection item before insert. | | today | string | Reference date for relative ranges, as in createArraySource. |

Virtual properties the collection adds to items, such as $hasPendingWrites, are stripped from rows.

Supabase

Runs the grid straight against a Supabase table with no server of your own. Filters, search, sorts and pages compile to PostgREST query strings, edits go through the table API, and Supabase Realtime delivers live patches. Import from tally-adapters/supabase.

import { createClient } from '@supabase/supabase-js'
import { createSupabaseSource } from 'tally-adapters/supabase'

const client = createClient(url, key)
const source = createSupabaseSource({ client, table: 'accounts', schema })

| Option | Type | Notes | | ------------ | ------------------------ | ------------------------------------------------------------------------- | | client | SupabaseClient | | | table | string | | | schema | Schema | The key must be a field name. It need not be a column. | | dbSchema | string | Default public. | | columns | Record<string, string> | Column id to database column name. | | pagination | 'offset' \| 'cursor' | Default offset. Cursors encode an offset. | | maxLimit | number | Default 1000. | | mutable | boolean | Default true. | | realtime | boolean | Default true. The table must be in the supabase_realtime publication. | | today | string | Reference date for relative ranges. |

Groups, aggregates and facets are computed in the grid from the loaded page, since PostgREST exposes no grouping. Text comparisons are case insensitive through ilike with wildcards escaped, and % and _ in values match literally. Negation is pushed down to each condition so empty cells behave like the reference engine. A mutation runs as one request per statement, not as a transaction. Sorting follows the database collation, so text order can differ from the reference engine for mixed case values, and enum columns sort by value rather than option order.

The integration tests run against a local stack: supabase start inside packages/adapters, then pnpm test:supabase.

Conformance

Every adapter in this package runs the tally-protocol conformance suite against the reference executor, so a filter means the same thing on every backend.

import { runConformance } from 'tally-protocol'

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