@tanstack/query-core
Version:
The framework agnostic core that powers TanStack Query
1 lines • 48.4 kB
Source Map (JSON)
{"version":3,"file":"queryClient.cjs","names":["QueryCache","MutationCache","focusManager","onlineManager","resolveQueryValue","functionalUpdate","notifyManager","noop","hashKey","partialMatchKey","hashQueryKeyByOptions","skipToken"],"sources":["../../src/queryClient.ts"],"sourcesContent":["import {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveQueryValue,\n skipToken,\n} from './utils'\nimport { QueryCache } from './queryCache'\nimport { MutationCache } from './mutationCache'\nimport { focusManager } from './focusManager'\nimport { onlineManager } from './onlineManager'\nimport { notifyManager } from './notifyManager'\nimport type {\n CancelOptions,\n DefaultError,\n DefaultOptions,\n DefaultedQueryObserverOptions,\n EnsureInfiniteQueryDataOptions,\n EnsureQueryDataOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InferDataFromTag,\n InferErrorFromTag,\n InfiniteData,\n InfiniteQueryExecuteOptions,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationKey,\n MutationObserverOptions,\n MutationOptions,\n OmitKeyof,\n QueryClientConfig,\n QueryExecuteOptions,\n QueryKey,\n QueryObserverOptions,\n QueryOptions,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n} from './types'\nimport type { QueryState } from './query'\nimport type { MutationFilters, QueryFilters, Updater } from './utils'\n\n// TYPES\n\ninterface QueryDefaults {\n queryKey: QueryKey\n defaultOptions: OmitKeyof<QueryOptions<any, any, any>, 'queryKey'>\n}\n\ninterface MutationDefaults {\n mutationKey: MutationKey\n defaultOptions: MutationOptions<any, any, any, any>\n}\n\n// CLASS\n\n/**\n * `QueryClient` is used to interact with a cache of queries and mutations. It owns a\n * `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds\n * the default options that are applied to queries and mutations created through it.\n * @example\n * ```ts\n * const queryClient = new QueryClient({\n * defaultOptions: {\n * queries: {\n * staleTime: Infinity,\n * },\n * },\n * })\n *\n * await queryClient.query({ queryKey: ['posts'], queryFn: fetchPosts })\n * ```\n */\nexport class QueryClient {\n #queryCache: QueryCache\n #mutationCache: MutationCache\n #defaultOptions: DefaultOptions\n #queryDefaults: Map<string, QueryDefaults>\n #mutationDefaults: Map<string, MutationDefaults>\n #mountCount: number\n #unsubscribeFocus?: () => void\n #unsubscribeOnline?: () => void\n\n constructor(config: QueryClientConfig = {}) {\n this.#queryCache = config.queryCache || new QueryCache()\n this.#mutationCache = config.mutationCache || new MutationCache()\n this.#defaultOptions = config.defaultOptions || {}\n this.#queryDefaults = new Map()\n this.#mutationDefaults = new Map()\n this.#mountCount = 0\n }\n\n /**\n * Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start\n * listening for focus/online events and resume paused mutations. Ref-counted via an internal\n * mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down\n * the shared listeners until the last one unmounts.\n */\n mount(): void {\n this.#mountCount++\n if (this.#mountCount !== 1) return\n\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations()\n this.#queryCache.onFocus()\n }\n })\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations()\n this.#queryCache.onOnline()\n }\n })\n }\n\n /**\n * The inverse of {@link QueryClient#mount} — called by a framework adapter's\n * `QueryClientProvider`-equivalent when it unmounts. Only tears down the focus/online\n * listeners once the mount count returns to `0`.\n */\n unmount(): void {\n this.#mountCount--\n if (this.#mountCount !== 0) return\n\n this.#unsubscribeFocus?.()\n this.#unsubscribeFocus = undefined\n\n this.#unsubscribeOnline?.()\n this.#unsubscribeOnline = undefined\n }\n\n /**\n * Returns the number of queries in the cache that are currently fetching, optionally\n * matching a set of filters. This includes background-fetching, loading new pages, and\n * loading more infinite query results.\n * @param filters - Narrows down which fetching queries are counted. Without filters, every\n * fetching query is counted.\n * @returns The number of matching queries whose `fetchStatus` is `'fetching'`.\n * @example\n * ```ts\n * if (queryClient.isFetching()) {\n * console.log('At least one query is fetching!')\n * }\n * ```\n */\n isFetching<TQueryFilters extends QueryFilters<any> = QueryFilters>(\n filters?: TQueryFilters,\n ): number {\n return this.#queryCache.findAll({ ...filters, fetchStatus: 'fetching' })\n .length\n }\n\n /**\n * Returns the number of mutations in the cache that are currently pending, optionally\n * matching a set of filters.\n * @param filters - Narrows down which pending mutations are counted. Without filters, every\n * pending mutation is counted.\n * @returns The number of matching mutations whose `status` is `'pending'`.\n * @example\n * ```ts\n * if (queryClient.isMutating()) {\n * console.log('At least one mutation is pending!')\n * }\n * ```\n */\n isMutating<\n TMutationFilters extends MutationFilters<any, any> = MutationFilters,\n >(filters?: TMutationFilters): number {\n return this.#mutationCache.findAll({ ...filters, status: 'pending' }).length\n }\n\n /**\n * Imperative (non-reactive) way to retrieve data for a QueryKey.\n * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n *\n * Hint: Do not use this function inside a component, because it won't receive updates.\n * Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n * @param queryKey - The query key of the query to read.\n * @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.\n * @see {@link QueryClient#getQueriesData}\n */\n getQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n\n return this.#queryCache.get<TInferredQueryFnData>(options.queryHash)?.state\n .data\n }\n\n /**\n * Returns the cached data of a query, or fetches it if there is none. With `revalidateIfStale`,\n * stale cached data is also refetched in the background.\n * @param options - The query options. If the query has no cached data yet, it is fetched with\n * these options.\n * @returns A promise that resolves to the cached data, or to the fetched data if nothing was\n * cached yet.\n * @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n const query = this.#queryCache.build(this, defaultedOptions)\n const cachedData = query.state.data\n\n if (cachedData === undefined) {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options)\n }\n\n if (\n options.revalidateIfStale &&\n query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))\n ) {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n void this.prefetchQuery(defaultedOptions)\n }\n\n return Promise.resolve(cachedData)\n }\n\n /**\n * Imperative (non-reactive) way to retrieve the cached data of multiple queries at once.\n * Only queries matching the given filters are returned; if none match, an empty array is\n * returned.\n *\n * Because the matched queries can hold data of different shapes (e.g. a broad filter can match\n * queries with unrelated data types), the `TQueryFnData` generic defaults to `unknown` rather\n * than being inferred. Passing a more specific type is a convenience for call sites that know\n * every matched query holds the same shape — it is not checked against the actual cache\n * contents.\n * @param filters - The filters that select which queries to read.\n * @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.\n * @see {@link QueryClient#getQueryData}\n * @example\n * ```ts\n * const data = queryClient.getQueriesData({ queryKey: ['posts'] })\n * ```\n */\n getQueriesData<\n TQueryFnData = unknown,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]> {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data as TQueryFnData | undefined\n return [queryKey, data]\n })\n }\n\n /**\n * Synchronous way to immediately update a query's cached data. If the updater (or the value\n * passed) resolves to `undefined`, the cache is left untouched and no query is created;\n * otherwise, if the query does not exist yet, it will be created. To update multiple queries\n * at once by partially matching query keys, use {@link QueryClient#setQueriesData} instead.\n *\n * Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved\n * via {@link QueryClient#getQueryData}, in place.\n * @param queryKey - The query key to set data for.\n * @param updater - Either the new data, or a function that receives the current data (which\n * may be `undefined`) and returns the new data.\n * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n * @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case\n * the write is skipped and the cache is left unchanged.\n * @example\n * ```ts\n * queryClient.setQueryData(['posts'], newPosts)\n *\n * // Or, using an updater function that receives the current data:\n * queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost])\n * ```\n */\n setQueryData<\n TQueryFnData = unknown,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n updater: Updater<\n InferDataFromTag<NoInfer<TQueryFnData>, TTaggedQueryKey> | undefined,\n NoInfer<TInferredQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): NoInfer<TInferredQueryFnData> | undefined {\n const defaultedOptions = this.defaultQueryOptions<\n any,\n any,\n unknown,\n any,\n QueryKey\n >({ queryKey })\n\n const query = this.#queryCache.get<\n InferDataFromTag<NoInfer<TQueryFnData>, TTaggedQueryKey>\n >(defaultedOptions.queryHash)\n const prevData = query?.state.data\n const data = functionalUpdate(updater, prevData)\n\n if (data === undefined) {\n return undefined\n }\n\n return this.#queryCache\n .build(this, defaultedOptions)\n .setData(data, { ...options, manual: true })\n }\n\n /**\n * Synchronous way to immediately update the cached data of multiple queries at once, using\n * filters or partial query key matching. Only queries that already exist and match the given\n * filters are updated; no new cache entries are created. Internally this calls\n * {@link QueryClient#setQueryData} for each matching query.\n * @param filters - The filters that select which existing queries to update.\n * @param updater - Either the new data, or a function that receives each matched query's current\n * data (which may be `undefined`) and returns the new data.\n * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n * @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same\n * `undefined` case as {@link QueryClient#setQueryData}.\n * @example\n * ```ts\n * queryClient.setQueriesData({ queryKey: ['posts'] }, (oldPosts) =>\n * oldPosts ? oldPosts.filter((post) => post.id !== deletedId) : oldPosts,\n * )\n * ```\n */\n setQueriesData<\n TQueryFnData,\n TQueryFilters extends QueryFilters<any> = QueryFilters,\n >(\n filters: TQueryFilters,\n updater: Updater<\n NoInfer<TQueryFnData> | undefined,\n NoInfer<TQueryFnData> | undefined\n >,\n options?: SetDataOptions,\n ): Array<[QueryKey, TQueryFnData | undefined]> {\n return notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map(({ queryKey }) => [\n queryKey,\n this.setQueryData<TQueryFnData>(queryKey, updater, options),\n ]),\n )\n }\n\n /**\n * Imperative (non-reactive) way to retrieve an existing query's state. If the query does not\n * exist, `undefined` is returned.\n * @param queryKey - The query key of the query to read.\n * @returns The query's state, or `undefined` if no query with this key exists.\n * @example\n * ```ts\n * const state = queryClient.getQueryState(['posts'])\n * console.log(state?.dataUpdatedAt)\n * ```\n */\n getQueryState<\n TQueryFnData = unknown,\n TError = DefaultError,\n TTaggedQueryKey extends QueryKey = QueryKey,\n TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>,\n TInferredError = InferErrorFromTag<TError, TTaggedQueryKey>,\n >(\n queryKey: TTaggedQueryKey,\n ): QueryState<TInferredQueryFnData, TInferredError> | undefined {\n const options = this.defaultQueryOptions({ queryKey })\n return this.#queryCache.get<TInferredQueryFnData, TInferredError>(\n options.queryHash,\n )?.state\n }\n\n /**\n * Removes queries from the cache that match the given filters. Unlike\n * {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes\n * matching queries from the cache instead of refetching them. Without filters, every query in\n * the cache is removed.\n * @param filters - The filters that select which queries to remove. Without filters, every query\n * is removed.\n * @example\n * ```ts\n * queryClient.removeQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n removeQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n ): void {\n const queryCache = this.#queryCache\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query)\n })\n })\n }\n\n /**\n * Resets queries matching the given filters back to their initial state (e.g. any\n * `initialData`), notifying subscribers rather than removing them. Active queries among the\n * matched set are then refetched, and the returned promise resolves once that refetch settles.\n * @param filters - The filters that select which queries to reset. Without filters, every query\n * is reset.\n * @param options - Passed to the refetch of the active matched queries, e.g. `cancelRefetch` and\n * `throwOnError`.\n * @returns A promise that resolves once the refetch of the active matched queries settles.\n * @example\n * ```ts\n * await queryClient.resetQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n options?: ResetOptions,\n ): Promise<void> {\n const queryCache = this.#queryCache\n\n return notifyManager.batch(() => {\n const matched = queryCache.findAll(filters)\n const queriesToRefetch = new Set(matched)\n matched.forEach((query) => {\n query.reset()\n })\n return this.refetchQueries(\n {\n type: 'active',\n predicate: (query) => queriesToRefetch.has(query),\n },\n options,\n )\n })\n }\n\n /**\n * Cancels outgoing fetches for queries matching the given filters. Most useful when performing\n * optimistic updates, since any outgoing refetch that resolves afterwards would otherwise\n * overwrite the optimistic update. By default (`revert: true`), a cancelled query's data is\n * reverted to its state before the outgoing fetch started.\n *\n * The returned promise never rejects, even if individual cancellations fail.\n * @param filters - The filters that select which queries to cancel. Without filters, every query\n * is cancelled.\n * @param cancelOptions - Passed to each matched query's cancellation. `revert` defaults to\n * `true`.\n * @returns A promise that resolves once every cancellation has settled.\n * @example\n * ```ts\n * await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })\n * ```\n */\n cancelQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: QueryFilters<TTaggedQueryKey>,\n cancelOptions: CancelOptions = {},\n ): Promise<void> {\n const defaultedCancelOptions = { revert: true, ...cancelOptions }\n\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .map((query) => query.cancel(defaultedCancelOptions)),\n )\n\n return Promise.all(promises).then(noop).catch(noop)\n }\n\n /**\n * Marks queries matching the given filters as invalidated. Unlike\n * {@link QueryClient#removeQueries}, invalidated queries stay in the cache.\n *\n * Unless `filters.refetchType` is `'none'`, matching queries are then refetched via\n * {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise\n * `filters.type`, otherwise `'active'`.\n * @param filters - The filters that select which queries to invalidate, plus `refetchType` to\n * control which of them to refetch afterwards. Without filters, every query is invalidated.\n * @param options - Passed to {@link QueryClient#refetchQueries}, e.g. `cancelRefetch` and\n * `throwOnError`.\n * @returns A promise that resolves once the refetch settles, or immediately if `refetchType` is\n * `'none'`.\n * @example\n * ```ts\n * await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })\n * ```\n */\n invalidateQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: InvalidateQueryFilters<TTaggedQueryKey>,\n options: InvalidateOptions = {},\n ): Promise<void> {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate()\n })\n\n if (filters?.refetchType === 'none') {\n return Promise.resolve()\n }\n return this.refetchQueries(\n {\n ...filters,\n type: filters?.refetchType ?? filters?.type ?? 'active',\n },\n options,\n )\n })\n }\n\n /**\n * Refetches queries matching the given filters, regardless of whether they are stale. Without\n * filters, every query in the cache is refetched. Queries that are disabled, or static (only\n * have observers with a static `staleTime`), are never refetched.\n *\n * By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new\n * one starts. The returned promise resolves once all matching queries have settled; it does\n * not reject on individual query failures unless `throwOnError` is set.\n * @param filters - The filters that select which queries to refetch. Without filters, every query\n * in the cache is included.\n * @param options - Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling\n * it, and `throwOnError` to `true` to reject when a refetch fails.\n * @returns A promise that resolves once every matched query has settled.\n * @example\n * ```ts\n * // refetch all active queries partially matching a query key:\n * await queryClient.refetchQueries({ queryKey: ['posts'], type: 'active' })\n * ```\n */\n refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(\n filters?: RefetchQueryFilters<TTaggedQueryKey>,\n options: RefetchOptions = {},\n ): Promise<void> {\n const fetchOptions = {\n ...options,\n cancelRefetch: options.cancelRefetch ?? true,\n }\n const promises = notifyManager.batch(() =>\n this.#queryCache\n .findAll(filters)\n .filter((query) => !query.isDisabled() && !query.isStatic())\n .map((query) => {\n let promise = query.fetch(undefined, fetchOptions)\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop)\n }\n return query.state.fetchStatus === 'paused'\n ? Promise.resolve()\n : promise\n }),\n )\n\n return Promise.all(promises).then(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache a query, resolving with the data or throwing with\n * the error.\n *\n * If the query already exists in the cache and its data is not stale (per the given\n * `staleTime`), the cached data is returned without fetching. Otherwise, the query is fetched\n * and the promise resolves once the fetch settles. If a `select` function is provided, it is\n * applied to the data in both cases (cached or freshly fetched) before it is returned.\n *\n * Unlike a reactive observer, retries are disabled by default here (`retry: false`) unless\n * explicitly configured, since there is no component to catch a thrown error and retry through\n * re-render.\n *\n * The accepted options are `QueryObserverOptions` minus the fields that only make sense for a\n * reactive observer — `enabled`, `refetchInterval`, `refetchIntervalInBackground`,\n * `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchOnMount`, `retryOnMount`,\n * `notifyOnChangeProps`, `throwOnError`, `suspense`, and `placeholderData` are not part of this\n * method's options.\n *\n * This method replaces the deprecated `fetchQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves to the data, or to the result of `select` if provided. It\n * rejects with the error from the fetch or from `select`.\n * @example\n * ```ts\n * try {\n * const data = await queryClient.query({ queryKey, queryFn, staleTime: 10000 })\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n async query<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: QueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n const isStale = query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n\n const queryData = isStale\n ? await query.fetch(defaultedOptions)\n : (query.state.data as TQueryData)\n\n const select = defaultedOptions.select\n\n if (select) {\n return select(queryData)\n }\n\n return queryData as unknown as TData\n }\n\n /**\n * Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers,\n * the fetch isn't retried unless `retry` is set.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves to the cached or fetched data, or rejects with the fetch\n * error.\n * @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.\n */\n fetchQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options: FetchQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<TData> {\n const defaultedOptions = this.defaultQueryOptions(options)\n\n // https://github.com/tannerlinsley/react-query/issues/652\n if (defaultedOptions.retry === undefined) {\n defaultedOptions.retry = false\n }\n\n const query = this.#queryCache.build(this, defaultedOptions)\n\n return query.isStaleByTime(\n resolveQueryValue(defaultedOptions.staleTime, query),\n )\n ? query.fetch(defaultedOptions)\n : Promise.resolve(query.state.data as TData)\n }\n\n /**\n * Fetches and caches a query like {@link QueryClient#fetchQuery}, but ignores the result and any\n * error.\n * @param options - The query options, including the `queryKey` and the `queryFn` used if the\n * query needs to fetch.\n * @returns A promise that resolves once the fetch settles. It never rejects.\n * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n >(\n options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n ): Promise<void> {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options).then(noop).catch(noop)\n }\n\n /**\n * Asynchronous method to fetch and cache an infinite query, resolving with an\n * {@link InfiniteData} object or throwing with the error.\n *\n * Behaves like {@link QueryClient#query}, accepting the same options (minus\n * `initialPageParam`), plus the required `initialPageParam`, and an optional `pages` /\n * `getNextPageParam` pair used to refetch a fixed number of pages from the start.\n *\n * This method replaces the deprecated `fetchInfiniteQuery`, and — combined with\n * `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves to the {@link InfiniteData}, or to the result of `select` if\n * provided. It rejects with the error from the fetch or from `select`.\n * @example\n * ```ts\n * try {\n * const data = await queryClient.infiniteQuery({ queryKey, queryFn, initialPageParam: 0 })\n * console.log(data.pages)\n * } catch (error) {\n * console.log(error)\n * }\n * ```\n */\n infiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: InfiniteQueryExecuteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<\n Array<TData> extends Array<InfiniteData<TQueryFnData>>\n ? InfiniteData<TQueryFnData, TPageParam>\n : TData\n > {\n options._type = 'infinite'\n return this.query(options as any)\n }\n\n /**\n * Fetches and caches an infinite query, or returns its cached data if it isn't stale.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves to the cached or fetched {@link InfiniteData}, or rejects with\n * the fetch error.\n * @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.\n */\n fetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchQuery(options as any)\n }\n\n /**\n * Fetches and caches an infinite query like {@link QueryClient#fetchInfiniteQuery}, but ignores\n * the result and any error.\n * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the\n * `initialPageParam`.\n * @returns A promise that resolves once the fetch settles. It never rejects.\n * @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n */\n prefetchInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<void> {\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.fetchInfiniteQuery(options).then(noop).catch(noop)\n }\n\n /**\n * Returns the cached data of an infinite query, or fetches it if there is none. With\n * `revalidateIfStale`, stale cached data is also refetched in the background.\n * @param options - The infinite query options. If the query has no cached data yet, it is fetched\n * with these options.\n * @returns A promise that resolves to the cached {@link InfiniteData}, or to the fetched data if\n * nothing was cached yet.\n * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n */\n ensureInfiniteQueryData<\n TQueryFnData,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n >(\n options: EnsureInfiniteQueryDataOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n ): Promise<InfiniteData<TData, TPageParam>> {\n options._type = 'infinite'\n\n // oxlint-disable-next-line tanstack-query/no-restricted-syntax\n return this.ensureQueryData(options as any)\n }\n\n /**\n * Resumes mutations that were paused because there was no network connection. Does nothing\n * (resolving immediately) if the client is currently offline.\n * @returns A promise that resolves once the resumed mutations have settled.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * await queryClient.resumePausedMutations()\n * ```\n */\n resumePausedMutations(): Promise<unknown> {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations()\n }\n return Promise.resolve()\n }\n\n /**\n * Returns the query cache this client is connected to.\n * @returns The {@link QueryCache} instance.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const queryCache = queryClient.getQueryCache()\n * const queries = queryCache.findAll({ queryKey: ['posts'] })\n * ```\n */\n getQueryCache(): QueryCache {\n return this.#queryCache\n }\n\n /**\n * Returns the mutation cache this client is connected to.\n * @returns The {@link MutationCache} instance.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const mutationCache = queryClient.getMutationCache()\n * const mutations = mutationCache.findAll({ status: 'pending' })\n * ```\n */\n getMutationCache(): MutationCache {\n return this.#mutationCache\n }\n\n /**\n * Returns the default options that were set when creating the client, or via\n * {@link QueryClient#setDefaultOptions}.\n * @returns The client's current default options.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * const defaultOptions = queryClient.getDefaultOptions()\n * ```\n */\n getDefaultOptions(): DefaultOptions {\n return this.#defaultOptions\n }\n\n /**\n * Dynamically sets the default options for this client, overwriting any previously defined\n * default options.\n * @param options - The new default options for queries and mutations.\n * @see {@link QueryClient#getDefaultOptions}\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.setDefaultOptions({\n * queries: {\n * staleTime: Infinity,\n * },\n * })\n * ```\n */\n setDefaultOptions(options: DefaultOptions): void {\n this.#defaultOptions = options\n }\n\n /**\n * Sets default options for queries whose query key partially matches the given `queryKey`.\n *\n * If several registered query defaults match a given query key, they are merged together in\n * registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the\n * most generic key to the least generic one — more specific defaults should be registered\n * after more generic ones so they take precedence.\n * @param queryKey - The query key that query keys are partially matched against.\n * @param options - The default options applied to matching queries.\n * @example\n * ```ts\n * queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })\n *\n * await queryClient.query({ queryKey: ['posts'] })\n * ```\n */\n setQueryDefaults<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n >(\n queryKey: QueryKey,\n options: Partial<\n OmitKeyof<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData>,\n 'queryKey'\n >\n >,\n ): void {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for queries whose query key partially matches the\n * given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults\n * match, they are merged together in registration order.\n * @param queryKey - The query key to look up registered defaults for.\n * @returns The merged default options of every registration that matches, or an empty object if\n * none match.\n * @example\n * ```ts\n * const defaultOptions = queryClient.getQueryDefaults(['posts'])\n * ```\n */\n getQueryDefaults(\n queryKey: QueryKey,\n ): OmitKeyof<QueryObserverOptions<any, any, any, any, any>, 'queryKey'> {\n const defaults = [...this.#queryDefaults.values()]\n\n const result: OmitKeyof<\n QueryObserverOptions<any, any, any, any, any>,\n 'queryKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n return result\n }\n\n /**\n * Sets default options for mutations whose mutation key partially matches the given\n * `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration\n * matters when several registered defaults match the same mutation key.\n * @param mutationKey - The mutation key that mutation keys are partially matched against.\n * @param options - The default options applied to matching mutations.\n * @see {@link QueryClient#getMutationDefaults}\n * @example\n * ```ts\n * queryClient.setMutationDefaults(['addPost'], { mutationFn: addPost })\n * ```\n */\n setMutationDefaults<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n >(\n mutationKey: MutationKey,\n options: OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n ): void {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options,\n })\n }\n\n /**\n * Returns the default options registered for mutations whose mutation key partially matches\n * the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered\n * defaults match, they are merged together in registration order.\n * @param mutationKey - The mutation key to look up registered defaults for.\n * @returns The merged default options of every registration that matches, or an empty object if\n * none match.\n * @example\n * ```ts\n * const defaultOptions = queryClient.getMutationDefaults(['addPost'])\n * ```\n */\n getMutationDefaults(\n mutationKey: MutationKey,\n ): OmitKeyof<MutationObserverOptions<any, any, any, any>, 'mutationKey'> {\n const defaults = [...this.#mutationDefaults.values()]\n\n const result: OmitKeyof<\n MutationObserverOptions<any, any, any, any>,\n 'mutationKey'\n > = {}\n\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n Object.assign(result, queryDefault.defaultOptions)\n }\n })\n\n return result\n }\n\n /**\n * Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the\n * caller into their final, defaulted form: merging the client's own `defaultOptions.queries`,\n * then `queryClient.setQueryDefaults` for the given `queryKey`, then the caller's options on\n * top. A no-op if the options are already defaulted (`_defaulted: true`).\n * @param options - The query options passed by the caller.\n * @returns The defaulted options, with `queryHash` and dependent defaults (e.g.\n * `refetchOnReconnect`) filled in.\n */\n defaultQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n >(\n options:\n | QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >\n | DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n > {\n if (options._defaulted) {\n return options as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true,\n }\n\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions,\n )\n }\n\n // dependent default values\n if (defaultedOptions.refetchOnReconnect === undefined) {\n defaultedOptions.refetchOnReconnect =\n defaultedOptions.networkMode !== 'always'\n }\n if (defaultedOptions.throwOnError === undefined) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense\n }\n\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = 'offlineFirst'\n }\n\n if (defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false\n }\n\n return defaultedOptions as DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n }\n\n /**\n * The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework\n * adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then\n * `queryClient.setMutationDefaults` for the given `mutationKey`, then the caller's options on\n * top. A no-op if the options are already defaulted (`_defaulted: true`).\n * @param options - The mutation options passed by the caller.\n * @returns The defaulted options.\n */\n defaultMutationOptions<T extends MutationOptions<any, any, any, any>>(\n options?: T,\n ): T {\n if (options?._defaulted) {\n return options\n }\n return {\n ...this.#defaultOptions.mutations,\n ...(options?.mutationKey &&\n this.getMutationDefaults(options.mutationKey)),\n ...options,\n _defaulted: true,\n } as T\n }\n\n /**\n * Clears both the query cache and the mutation cache this client is connected to.\n * @example\n * ```ts\n * import { QueryClient } from '@tanstack/query-core'\n *\n * const queryClient = new QueryClient()\n * queryClient.clear()\n * ```\n */\n clear(): void {\n this.#queryCache.clear()\n this.#mutationCache.clear()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,IAAa,cAAb,MAAyB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA4B,CAAC,GAAG;EAC1C,KAAK,cAAc,OAAO,cAAc,IAAIA,mBAAAA,WAAW;EACvD,KAAK,iBAAiB,OAAO,iBAAiB,IAAIC,sBAAAA,cAAc;EAChE,KAAK,kBAAkB,OAAO,kBAAkB,CAAC;EACjD,KAAK,iCAAiB,IAAI,IAAI;EAC9B,KAAK,oCAAoB,IAAI,IAAI;EACjC,KAAK,cAAc;CACrB;;;;;;;CAQA,QAAc;EACZ,KAAK;EACL,IAAI,KAAK,gBAAgB,GAAG;EAE5B,KAAK,oBAAoBC,qBAAAA,aAAa,UAAU,OAAO,YAAY;GACjE,IAAI,SAAS;IACX,MAAM,KAAK,sBAAsB;IACjC,KAAK,YAAY,QAAQ;GAC3B;EACF,CAAC;EACD,KAAK,qBAAqBC,sBAAAA,cAAc,UAAU,OAAO,WAAW;GAClE,IAAI,QAAQ;IACV,MAAM,KAAK,sBAAsB;IACjC,KAAK,YAAY,SAAS;GAC5B;EACF,CAAC;CACH;;;;;;CAOA,UAAgB;EACd,KAAK;EACL,IAAI,KAAK,gBAAgB,GAAG;EAE5B,KAAK,oBAAoB;EACzB,KAAK,oBAAoB,KAAA;EAEzB,KAAK,qBAAqB;EAC1B,KAAK,qBAAqB,KAAA;CAC5B;;;;;;;;;;;;;;;CAgBA,WACE,SACQ;EACR,OAAO,KAAK,YAAY,QAAQ;GAAE,GAAG;GAAS,aAAa;EAAW,CAA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