Skip to content
TypeWire

@tahanabavi/typefetch-query-core

v1.1.0

Framework-agnostic query engine for TypeFetch contracts (cache, dedup, staleness, mutations, invalidation).

Reading

ts
// Imperative: fetch (dedups an in-flight request for the same key), or read the
// cache without triggering one.
await client.prefetchQuery(api.modules.user.getUser, { path: { id: "1" } });
const user = client.getQueryData(api.modules.user.getUser, { path: { id: "1" } });

// Reactive: an observer is what an adapter wraps — subscribe + getSnapshot.
const observer = client.watchQuery(api.modules.user.getUser, { path: { id: "1" } });
const unsubscribe = observer.subscribe(() => render(observer.getSnapshot()));

Two arguments — endpoint and input — no query key, no query function.