@gleanql/client
v0.1.7
Published
Glean's runtime: normalized cache, fine-grained reactivity, mutations, subscriptions and React hooks
Downloads
1,215
Maintainers
Readme
@gleanql/client
The runtime for GleanQL — GraphQL without
writing GraphQL. Install this in your app; the @gleanql/vite
plugin generates the schema-specific pieces (the typed glean accessor,
compiled operations, framework glue) into it at build time.
import { glean } from "@gleanql/client";
export function ProductPage({ params }: { params: { handle: string } }) {
const product = glean.product({ handle: params.handle });
return <h1>{product.title}</h1>; // compiled into one operation per route
}What lives here
- Normalized reactive cache — entity + path identity, field-level re-rendering, Suspense-aware reads, batched missing-field fetches, reference-counted retention, LRU + staleness-aware GC.
- Hooks (via the generated
@gleanql/client/cliententry) —useGlean,useMutation(optimistic fields and list membership, auto-rollback),useSubscription(SSE orgraphql-ws),usePaginated,refresh,runOperation(typed by the generatedGleanOperationsinterface),onEvent(one channel for every runtime incident — wire it to Sentry). - Transports — a fetch adapter with persisted-operation mode (hash-only
requests, APQ wire shape) and a
graphql-wsadapter; anything else plugs in behind the two-methodGraphClientAdapterinterface. - Server pieces — request-scoped runtimes for SSR/RSC, hydration
serialization,
runMutation, andcreatePersistedResolver(the server-side persisted-operation allowlist).
Docs
Full documentation lives in the GleanQL repo
— run pnpm docs there, or start with the Get Started guide.
MIT
