API Reference
@domphy/query is a 1-1 port of @tanstack/query-core v5.90.20 — every export below has identical behavior to upstream, so the TanStack Query reference documents each item in full detail.
Client And Caches
QueryClient— the entry point.fetchQuery,prefetchQuery,getQueryData,setQueryData,ensureQueryData,invalidateQueries,refetchQueries,cancelQueries,removeQueries,resetQueries,setQueryDefaults,setMutationDefaults,getQueryCache,getMutationCache,mount,unmount,clearQueryCache— holds allQueryinstances.find,findAll,subscribe,clearMutationCache— holds allMutationinstances.find,findAll,subscribe,clearQuery— one cache entry (advanced; usually accessed viaQueryCache)Mutation— one mutation instance (advanced)
Observers
QueryObserver— subscribe to one query.subscribe,setOptions,getCurrentResult,refetchQueriesObserver— subscribe to a dynamic array of queriesInfiniteQueryObserver— paginated queries. AddsfetchNextPage,fetchPreviousPageMutationObserver— run mutations.mutate,reset,subscribe,getCurrentResult
Managers
focusManager— window focus tracking;setFocused,setEventListener,subscribeonlineManager— online/offline tracking;setOnline,setEventListener,subscribenotifyManager— update batching;batch,schedule,setScheduler, plusdefaultSchedulertimeoutManager— pluggable timer provider (TimeoutProvider,TimeoutCallback,ManagedTimerId)
Hydration
dehydrate(client, options?)— serialize the cache toDehydratedStatehydrate(client, state, options?)— restore a serialized cachedefaultShouldDehydrateQuery,defaultShouldDehydrateMutation— the default include rules
Utilities
hashKey(queryKey)— structural hash, stable across object key ordermatchQuery(filters, query)/matchMutation(filters, mutation)— filter predicatespartialMatchKey(a, b)— prefix key matchingreplaceEqualDeep(a, b)— structural sharing helper (keeps referential identity for unchanged parts)keepPreviousData— pass asplaceholderDatato keep data across key changesskipToken— pass asqueryFnto disable a query type-safelyisCancelledError(error)/CancelledError— cancellation detectionshouldThrowError,isServer,noopexperimental_streamedQuery— build a query from anAsyncIterable(streamed chunks)
Types
All public types are re-exported, including:
- options:
QueryObserverOptions,InfiniteQueryObserverOptions,MutationObserverOptions,QueryOptions,FetchQueryOptions,DefaultOptions - results:
QueryObserverResult,InfiniteQueryObserverResult,MutationObserverResult - keys & functions:
QueryKey,QueryFunction,QueryFunctionContext,MutationFunction - state:
QueryState,MutationState,QueryStatus,FetchStatus,MutationStatus - data shapes:
InfiniteData,GetNextPageParamFunction,DehydratedState - filters:
QueryFilters,MutationFilters,SkipToken,Updater - cache events:
QueryCacheNotifyEvent,MutationCacheNotifyEvent,QueriesObserverOptions
CDN Global
The IIFE bundle exposes everything under Domphy.query: