A framework-agnostic query engine for TypeWire contracts — cache, dedup, staleness, mutations, and declared invalidation — over HTTP and WebSocket alike, because it needs nothing but a callable endpoint carrying a stable id.
It imports no framework and no transport. Pair it with an adapter
(@tahanabavi/typefetch-react) for hooks, or drive it directly
through its Observable contract (subscribe / getSnapshot) — the same seam a
Vue or Angular adapter would bind.
pnpm add @tahanabavi/typefetch-query-coreWhat's in it
Cache & dedup — one entry per endpoint + input; concurrent fetchers for the same key share a single request.
Staleness —
staleTime/gcTime; a stale entry refetches on the next observe, an unused one is garbage-collected.Mutations & declared invalidation — the
relationsmap (static or a function of{ variables, data }), plus per-callinvalidates— never a hand-written key.Retry — configurable
retry/retryDelayon queries and mutations, with aCancelledErrorfor aborted in-flight work.Observablecontract — every observer, and the cache itself, exposesubscribe/getSnapshot, souseSyncExternalStore(or any framework's equivalent) binds without a shim.Filters —
invalidateQueries/refetchQueries/cancelQueries/removeQueriestake{ endpointId, input, predicate }.A cache event bus —
client.subscribe(event => …)powers devtools, persistence, and logging without wrapping the engine.