export declare type Action = ContinueAction_2 | ErrorAction_2 | FailedAction_2 | PendingAction | PauseAction_2 | SuccessAction_2; export declare type Action_alias_1 = ContinueAction | ErrorAction | FailedAction | FetchAction | InvalidateAction | PauseAction | SetStateAction | SuccessAction; export declare function addConsumeAwareSignal(object: T, getSignal: () => AbortSignal, onCancelled: VoidFunction): T & { signal: AbortSignal; }; export declare function addToEnd(items: Array, item: T, max?: number): Array; export declare function addToStart(items: Array, item: T, max?: number): Array; declare type AnyDataTag = { [dataTagSymbol]: any; [dataTagErrorSymbol]: any; }; export { AnyDataTag } export { AnyDataTag as AnyDataTag_alias_1 } declare type BaseStreamedQueryParams = { streamFn: (context: QueryFunctionContext) => AsyncIterable | Promise>; refetchMode?: 'append' | 'reset' | 'replace'; }; declare type BatchCallsCallback> = (...args: T) => void; declare type BatchNotifyFunction = (callback: () => void) => void; declare class CancelledError extends Error { revert?: boolean; silent?: boolean; constructor(options?: CancelOptions); } export { CancelledError } export { CancelledError as CancelledError_alias_1 } declare interface CancelOptions { revert?: boolean; silent?: boolean; } export { CancelOptions } export { CancelOptions as CancelOptions_alias_1 } export declare function canFetch(networkMode: NetworkMode | undefined): boolean; declare type CombineFn = (result: Array) => TCombinedResult; declare interface ContinueAction { type: 'continue'; } declare interface ContinueAction_2 { type: 'continue'; } export declare function createNotifyManager(): { readonly batch: (callback: () => T) => T; /** * All calls to the wrapped function will be batched. */ readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; readonly schedule: (callback: NotifyCallback) => void; /** * Use this method to set a custom notify function. * This can be used to for example wrap notifications with `React.act` while running tests. */ readonly setNotifyFunction: (fn: NotifyFunction) => void; /** * Use this method to set a custom function to batch notifications together into a single tick. * By default React Query will use the batch function provided by ReactDOM or React Native. */ readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; readonly setScheduler: (fn: ScheduleFunction) => void; }; export declare function createRetryer(config: RetryerConfig): Retryer; declare type DataTag = TType extends AnyDataTag ? TType : TType & { [dataTagSymbol]: TValue; [dataTagErrorSymbol]: TError; }; export { DataTag } export { DataTag as DataTag_alias_1 } declare const dataTagErrorSymbol: unique symbol; declare type dataTagErrorSymbol = typeof dataTagErrorSymbol; export { dataTagErrorSymbol } export { dataTagErrorSymbol as dataTagErrorSymbol_alias_1 } declare const dataTagSymbol: unique symbol; declare type dataTagSymbol = typeof dataTagSymbol; export { dataTagSymbol } export { dataTagSymbol as dataTagSymbol_alias_1 } declare type DefaultedInfiniteQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; export { DefaultedInfiniteQueryObserverOptions } export { DefaultedInfiniteQueryObserverOptions as DefaultedInfiniteQueryObserverOptions_alias_1 } declare type DefaultedQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; export { DefaultedQueryObserverOptions } export { DefaultedQueryObserverOptions as DefaultedQueryObserverOptions_alias_1 } declare type DefaultError = Register extends { defaultError: infer TError; } ? TError : Error; export { DefaultError } export { DefaultError as DefaultError_alias_1 } declare interface DefaultOptions { queries?: OmitKeyof, 'suspense' | 'queryKey'>; mutations?: MutationObserverOptions; hydrate?: HydrateOptions['defaultOptions']; dehydrate?: DehydrateOptions; } export { DefaultOptions } export { DefaultOptions as DefaultOptions_alias_1 } declare const defaultScheduler: ScheduleFunction; export { defaultScheduler } export { defaultScheduler as defaultScheduler_alias_1 } declare function defaultShouldDehydrateMutation(mutation: Mutation): boolean; export { defaultShouldDehydrateMutation } export { defaultShouldDehydrateMutation as defaultShouldDehydrateMutation_alias_1 } declare function defaultShouldDehydrateQuery(query: Query): boolean; export { defaultShouldDehydrateQuery } export { defaultShouldDehydrateQuery as defaultShouldDehydrateQuery_alias_1 } export declare const defaultTimeoutProvider: TimeoutProvider; declare type DefinedInfiniteQueryObserverResult = InfiniteQueryObserverRefetchErrorResult | InfiniteQueryObserverSuccessResult; export { DefinedInfiniteQueryObserverResult } export { DefinedInfiniteQueryObserverResult as DefinedInfiniteQueryObserverResult_alias_1 } declare type DefinedQueryObserverResult = QueryObserverRefetchErrorResult | QueryObserverSuccessResult; export { DefinedQueryObserverResult } export { DefinedQueryObserverResult as DefinedQueryObserverResult_alias_1 } declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState; export { dehydrate } export { dehydrate as dehydrate_alias_1 } declare interface DehydratedMutation { mutationKey?: MutationKey; state: MutationState; meta?: MutationMeta; scope?: MutationScope; } declare interface DehydratedQuery { queryHash: string; queryKey: QueryKey; state: QueryState; promise?: Promise; meta?: QueryMeta; dehydratedAt?: number; } declare interface DehydratedState { mutations: Array; queries: Array; } export { DehydratedState } export { DehydratedState as DehydratedState_alias_1 } declare interface DehydrateOptions { serializeData?: TransformerFn; shouldDehydrateMutation?: (mutation: Mutation) => boolean; shouldDehydrateQuery?: (query: Query) => boolean; shouldRedactErrors?: (error: unknown) => boolean; } export { DehydrateOptions } export { DehydrateOptions as DehydrateOptions_alias_1 } declare type DistributiveOmit = TObject extends any ? Omit : never; export { DistributiveOmit } export { DistributiveOmit as DistributiveOmit_alias_1 } declare type DropLast> = T extends readonly [ ...infer R, unknown ] ? readonly [...R] : never; declare type Enabled = boolean | ((query: Query) => boolean); export { Enabled } export { Enabled as Enabled_alias_1 } declare type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { revalidateIfStale?: boolean; }; export { EnsureInfiniteQueryDataOptions } export { EnsureInfiniteQueryDataOptions as EnsureInfiniteQueryDataOptions_alias_1 } declare interface EnsureQueryDataOptions extends FetchQueryOptions { revalidateIfStale?: boolean; } export { EnsureQueryDataOptions } export { EnsureQueryDataOptions as EnsureQueryDataOptions_alias_1 } export declare function ensureQueryFn(options: { queryFn?: QueryFunction | SkipToken; queryHash?: string; }, fetchOptions?: FetchOptions): QueryFunction; /** * Manages environment detection used by TanStack Query internals. */ declare const environmentManager: { /** * Returns whether the current runtime should be treated as a server environment. */ isServer(): boolean; /** * Overrides the server check globally. */ setIsServer(isServerValue: IsServerValue): void; }; export { environmentManager } export { environmentManager as environmentManager_alias_1 } declare interface ErrorAction { type: 'error'; error: TError; } declare interface ErrorAction_2 { type: 'error'; error: TError; } declare interface FailedAction { type: 'failed'; failureCount: number; error: TError; } declare interface FailedAction_2 { type: 'failed'; failureCount: number; error: TError | null; } declare interface FetchAction { type: 'fetch'; meta?: FetchMeta; } export declare interface FetchContext { fetchFn: () => unknown | Promise; fetchOptions?: FetchOptions; signal: AbortSignal; options: QueryOptions; client: QueryClient; queryKey: TQueryKey; state: QueryState; } export declare type FetchDirection = 'forward' | 'backward'; declare type FetchInfiniteQueryOptions = Omit, TQueryKey, TPageParam>, 'initialPageParam'> & InitialPageParam & FetchInfiniteQueryPages; export { FetchInfiniteQueryOptions } export { FetchInfiniteQueryOptions as FetchInfiniteQueryOptions_alias_1 } declare type FetchInfiniteQueryPages = { pages?: never; } | { pages: number; getNextPageParam: GetNextPageParamFunction; }; export declare interface FetchMeta { fetchMore?: { direction: FetchDirection; }; } declare interface FetchNextPageOptions extends ResultOptions { /** * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time, * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. * * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved. * * Defaults to `true`. */ cancelRefetch?: boolean; } export { FetchNextPageOptions } export { FetchNextPageOptions as FetchNextPageOptions_alias_1 } export declare interface FetchOptions { cancelRefetch?: boolean; meta?: FetchMeta; initialPromise?: Promise; } declare interface FetchPreviousPageOptions extends ResultOptions { /** * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time, * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. * * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved. * * Defaults to `true`. */ cancelRefetch?: boolean; } export { FetchPreviousPageOptions } export { FetchPreviousPageOptions as FetchPreviousPageOptions_alias_1 } declare interface FetchQueryOptions extends WithRequired, 'queryKey'> { initialPageParam?: never; /** * The time in milliseconds after data is considered stale. * If the data is fresh it will be returned from the cache. */ staleTime?: StaleTimeFunction; } export { FetchQueryOptions } export { FetchQueryOptions as FetchQueryOptions_alias_1 } export declare function fetchState(data: TData | undefined, options: QueryOptions): { readonly error?: null | undefined; readonly status?: "pending" | undefined; readonly fetchFailureCount: 0; readonly fetchFailureReason: null; readonly fetchStatus: "fetching" | "paused"; }; declare type FetchStatus = 'fetching' | 'paused' | 'idle'; export { FetchStatus } export { FetchStatus as FetchStatus_alias_1 } export declare class FocusManager extends Subscribable { #private; constructor(); protected onSubscribe(): void; protected onUnsubscribe(): void; setEventListener(setup: SetupFn): void; setFocused(focused?: boolean): void; onFocus(): void; isFocused(): boolean; } declare const focusManager: FocusManager; export { focusManager } export { focusManager as focusManager_alias_1 } /** * Thenable types which matches React's types for promises * * React seemingly uses `.status`, `.value` and `.reason` properties on a promises to optimistically unwrap data from promises * * @see https://github.com/facebook/react/blob/main/packages/shared/ReactTypes.js#L112-L138 * @see https://github.com/facebook/react/blob/4f604941569d2e8947ce1460a0b2997e835f37b9/packages/react-debug-tools/src/ReactDebugHooks.js#L224-L227 */ declare interface Fulfilled { status: 'fulfilled'; value: T; } export declare type FulfilledThenable = Promise & Fulfilled; export declare function functionalUpdate(updater: Updater, input: TInput): TOutput; export declare function getDefaultState(): MutationState; declare type GetNextPageParamFunction = (lastPage: TQueryFnData, allPages: Array, lastPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; export { GetNextPageParamFunction } export { GetNextPageParamFunction as GetNextPageParamFunction_alias_1 } declare type GetPreviousPageParamFunction = (firstPage: TQueryFnData, allPages: Array, firstPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; export { GetPreviousPageParamFunction } export { GetPreviousPageParamFunction as GetPreviousPageParamFunction_alias_1 } /** * Default query & mutation keys hash function. * Hashes the value into a stable hash. */ declare function hashKey(queryKey: QueryKey | MutationKey): string; export { hashKey } export { hashKey as hashKey_alias_1 } export declare function hashQueryKeyByOptions(queryKey: TQueryKey, options?: Pick, 'queryKeyHashFn'>): string; /** * Checks if there is a next page. */ export declare function hasNextPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; /** * Checks if there is a previous page. */ export declare function hasPreviousPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void; export { hydrate } export { hydrate as hydrate_alias_1 } declare interface HydrateOptions { defaultOptions?: { deserializeData?: TransformerFn; queries?: QueryOptions; mutations?: MutationOptions; }; } export { HydrateOptions } export { HydrateOptions as HydrateOptions_alias_1 } declare type InferDataFromTag = TTaggedQueryKey extends DataTag ? TaggedValue : TQueryFnData; export { InferDataFromTag } export { InferDataFromTag as InferDataFromTag_alias_1 } declare type InferErrorFromTag = TTaggedQueryKey extends DataTag ? TaggedError extends UnsetMarker ? TError : TaggedError : TError; export { InferErrorFromTag } export { InferErrorFromTag as InferErrorFromTag_alias_1 } declare interface InfiniteData { pages: Array; pageParams: Array; } export { InfiniteData } export { InfiniteData as InfiniteData_alias_1 } export declare function infiniteQueryBehavior(pages?: number): QueryBehavior>; declare class InfiniteQueryObserver, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends QueryObserver, TQueryKey> { subscribe: Subscribable>['subscribe']; getCurrentResult: ReplaceReturnType, TQueryKey>['getCurrentResult'], InfiniteQueryObserverResult>; protected fetch: ReplaceReturnType, TQueryKey>['fetch'], Promise>>; constructor(client: QueryClient, options: InfiniteQueryObserverOptions); protected bindMethods(): void; setOptions(options: InfiniteQueryObserverOptions): void; getOptimisticResult(options: DefaultedInfiniteQueryObserverOptions): InfiniteQueryObserverResult; fetchNextPage(options?: FetchNextPageOptions): Promise>; fetchPreviousPage(options?: FetchPreviousPageOptions): Promise>; protected createResult(query: Query, TQueryKey>, options: InfiniteQueryObserverOptions): InfiniteQueryObserverResult; } export { InfiniteQueryObserver } export { InfiniteQueryObserver as InfiniteQueryObserver_alias_1 } declare interface InfiniteQueryObserverBaseResult extends QueryObserverBaseResult { /** * This function allows you to fetch the next "page" of results. */ fetchNextPage: (options?: FetchNextPageOptions) => Promise>; /** * This function allows you to fetch the previous "page" of results. */ fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise>; /** * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). */ hasNextPage: boolean; /** * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). */ hasPreviousPage: boolean; /** * Will be `true` if the query failed while fetching the next page. */ isFetchNextPageError: boolean; /** * Will be `true` while fetching the next page with `fetchNextPage`. */ isFetchingNextPage: boolean; /** * Will be `true` if the query failed while fetching the previous page. */ isFetchPreviousPageError: boolean; /** * Will be `true` while fetching the previous page with `fetchPreviousPage`. */ isFetchingPreviousPage: boolean; } export { InfiniteQueryObserverBaseResult } export { InfiniteQueryObserverBaseResult as InfiniteQueryObserverBaseResult_alias_1 } declare type InfiniteQueryObserverListener = (result: InfiniteQueryObserverResult) => void; declare interface InfiniteQueryObserverLoadingErrorResult extends InfiniteQueryObserverBaseResult { data: undefined; error: TError; isError: true; isPending: false; isLoading: false; isLoadingError: true; isRefetchError: false; isFetchNextPageError: false; isFetchPreviousPageError: false; isSuccess: false; isPlaceholderData: false; status: 'error'; } export { InfiniteQueryObserverLoadingErrorResult } export { InfiniteQueryObserverLoadingErrorResult as InfiniteQueryObserverLoadingErrorResult_alias_1 } declare interface InfiniteQueryObserverLoadingResult extends InfiniteQueryObserverBaseResult { data: undefined; error: null; isError: false; isPending: true; isLoading: true; isLoadingError: false; isRefetchError: false; isFetchNextPageError: false; isFetchPreviousPageError: false; isSuccess: false; isPlaceholderData: false; status: 'pending'; } export { InfiniteQueryObserverLoadingResult } export { InfiniteQueryObserverLoadingResult as InfiniteQueryObserverLoadingResult_alias_1 } declare interface InfiniteQueryObserverOptions extends QueryObserverOptions, TQueryKey, TPageParam>, InfiniteQueryPageParamsOptions { } export { InfiniteQueryObserverOptions } export { InfiniteQueryObserverOptions as InfiniteQueryObserverOptions_alias_1 } declare interface InfiniteQueryObserverPendingResult extends InfiniteQueryObserverBaseResult { data: undefined; error: null; isError: false; isPending: true; isLoadingError: false; isRefetchError: false; isFetchNextPageError: false; isFetchPreviousPageError: false; isSuccess: false; isPlaceholderData: false; status: 'pending'; } export { InfiniteQueryObserverPendingResult } export { InfiniteQueryObserverPendingResult as InfiniteQueryObserverPendingResult_alias_1 } declare interface InfiniteQueryObserverPlaceholderResult extends InfiniteQueryObserverBaseResult { data: TData; isError: false; error: null; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: true; isFetchNextPageError: false; isFetchPreviousPageError: false; status: 'success'; } export { InfiniteQueryObserverPlaceholderResult } export { InfiniteQueryObserverPlaceholderResult as InfiniteQueryObserverPlaceholderResult_alias_1 } declare interface InfiniteQueryObserverRefetchErrorResult extends InfiniteQueryObserverBaseResult { data: TData; error: TError; isError: true; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; isPlaceholderData: false; status: 'error'; } export { InfiniteQueryObserverRefetchErrorResult } export { InfiniteQueryObserverRefetchErrorResult as InfiniteQueryObserverRefetchErrorResult_alias_1 } declare type InfiniteQueryObserverResult = DefinedInfiniteQueryObserverResult | InfiniteQueryObserverLoadingErrorResult | InfiniteQueryObserverLoadingResult | InfiniteQueryObserverPendingResult | InfiniteQueryObserverPlaceholderResult; export { InfiniteQueryObserverResult } export { InfiniteQueryObserverResult as InfiniteQueryObserverResult_alias_1 } declare interface InfiniteQueryObserverSuccessResult extends InfiniteQueryObserverBaseResult { data: TData; error: null; isError: false; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isFetchNextPageError: false; isFetchPreviousPageError: false; isSuccess: true; isPlaceholderData: false; status: 'success'; } export { InfiniteQueryObserverSuccessResult } export { InfiniteQueryObserverSuccessResult as InfiniteQueryObserverSuccessResult_alias_1 } declare interface InfiniteQueryPageParamsOptions extends InitialPageParam { /** * This function can be set to automatically get the previous cursor for infinite queries. * The result will also be used to determine the value of `hasPreviousPage`. */ getPreviousPageParam?: GetPreviousPageParamFunction; /** * This function can be set to automatically get the next cursor for infinite queries. * The result will also be used to determine the value of `hasNextPage`. */ getNextPageParam: GetNextPageParamFunction; } export { InfiniteQueryPageParamsOptions } export { InfiniteQueryPageParamsOptions as InfiniteQueryPageParamsOptions_alias_1 } declare type InitialDataFunction = () => T | undefined; export { InitialDataFunction } export { InitialDataFunction as InitialDataFunction_alias_1 } declare interface InitialPageParam { initialPageParam: TPageParam; } export { InitialPageParam } export { InitialPageParam as InitialPageParam_alias_1 } declare interface InvalidateAction { type: 'invalidate'; } declare interface InvalidateOptions extends RefetchOptions { } export { InvalidateOptions } export { InvalidateOptions as InvalidateOptions_alias_1 } declare interface InvalidateQueryFilters extends QueryFilters { refetchType?: QueryTypeFilter | 'none'; } export { InvalidateQueryFilters } export { InvalidateQueryFilters as InvalidateQueryFilters_alias_1 } /** * @deprecated Use instanceof `CancelledError` instead. */ declare function isCancelledError(value: any): value is CancelledError; export { isCancelledError } export { isCancelledError as isCancelledError_alias_1 } export declare function isPlainArray(value: unknown): value is Array; export declare function isPlainObject(o: any): o is Record; /** @deprecated * use `environmentManager.isServer()` instead. */ declare const isServer: boolean; export { isServer } export { isServer as isServer_alias_1 } export declare type IsServerValue = () => boolean; export declare function isValidTimeout(value: unknown): value is number; declare function keepPreviousData(previousData: T | undefined): T | undefined; export { keepPreviousData } export { keepPreviousData as keepPreviousData_alias_1 } declare type Listener = (focused: boolean) => void; declare type Listener_2 = (online: boolean) => void; /** * Wrapping `setTimeout` is awkward from a typing perspective because platform * typings may extend the return type of `setTimeout`. For example, NodeJS * typings add `NodeJS.Timeout`; but a non-default `timeoutManager` may not be * able to return such a type. */ declare type ManagedTimerId = number | { [Symbol.toPrimitive]: () => number; }; export { ManagedTimerId } export { ManagedTimerId as ManagedTimerId_alias_1 } declare function matchMutation(filters: MutationFilters, mutation: Mutation): boolean; export { matchMutation } export { matchMutation as matchMutation_alias_1 } declare function matchQuery(filters: QueryFilters, query: Query): boolean; export { matchQuery } export { matchQuery as matchQuery_alias_1 } declare type MutateFunction = (variables: TVariables, options?: MutateOptions) => Promise; export { MutateFunction } export { MutateFunction as MutateFunction_alias_1 } declare interface MutateOptions { onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; } export { MutateOptions } export { MutateOptions as MutateOptions_alias_1 } declare class Mutation extends Removable { #private; state: MutationState; options: MutationOptions; readonly mutationId: number; constructor(config: MutationConfig); setOptions(options: MutationOptions): void; get meta(): MutationMeta | undefined; addObserver(observer: MutationObserver_2): void; removeObserver(observer: MutationObserver_2): void; protected optionalRemove(): void; continue(): Promise; execute(variables: TVariables): Promise; } export { Mutation } export { Mutation as Mutation_alias_1 } declare class MutationCache extends Subscribable { #private; config: MutationCacheConfig; constructor(config?: MutationCacheConfig); build(client: QueryClient, options: MutationOptions, state?: MutationState): Mutation; add(mutation: Mutation): void; remove(mutation: Mutation): void; canRun(mutation: Mutation): boolean; runNext(mutation: Mutation): Promise; clear(): void; getAll(): Array; find(filters: MutationFilters): Mutation | undefined; findAll(filters?: MutationFilters): Array; notify(event: MutationCacheNotifyEvent): void; resumePausedMutations(): Promise; } export { MutationCache } export { MutationCache as MutationCache_alias_1 } declare interface MutationCacheConfig { onError?: (error: DefaultError, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; onSuccess?: (data: unknown, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; onMutate?: (variables: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; onSettled?: (data: unknown | undefined, error: DefaultError | null, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; } declare type MutationCacheListener = (event: MutationCacheNotifyEvent) => void; declare type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated; export { MutationCacheNotifyEvent } export { MutationCacheNotifyEvent as MutationCacheNotifyEvent_alias_1 } declare interface MutationConfig { client: QueryClient; mutationId: number; mutationCache: MutationCache; options: MutationOptions; state?: MutationState; } declare interface MutationFilters { /** * Match mutation key exactly */ exact?: boolean; /** * Include mutations matching this predicate function */ predicate?: (mutation: Mutation) => boolean; /** * Include mutations matching this mutation key */ mutationKey?: TuplePrefixes; /** * Filter by mutation status */ status?: MutationStatus; } export { MutationFilters } export { MutationFilters as MutationFilters_alias_1 } declare type MutationFunction = (variables: TVariables, context: MutationFunctionContext) => Promise; export { MutationFunction } export { MutationFunction as MutationFunction_alias_1 } declare type MutationFunctionContext = { client: QueryClient; meta: MutationMeta | undefined; mutationKey?: MutationKey; }; export { MutationFunctionContext } export { MutationFunctionContext as MutationFunctionContext_alias_1 } declare type MutationKey = Register extends { mutationKey: infer TMutationKey; } ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends Array ? TMutationKey : ReadonlyArray : ReadonlyArray; export { MutationKey } export { MutationKey as MutationKey_alias_1 } declare type MutationMeta = Register extends { mutationMeta: infer TMutationMeta; } ? TMutationMeta extends Record ? TMutationMeta : Record : Record; export { MutationMeta } export { MutationMeta as MutationMeta_alias_1 } declare class MutationObserver_2 extends Subscribable> { #private; options: MutationObserverOptions; constructor(client: QueryClient, options: MutationObserverOptions); protected bindMethods(): void; setOptions(options: MutationObserverOptions): void; protected onUnsubscribe(): void; onMutationUpdate(action: Action): void; getCurrentResult(): MutationObserverResult; reset(): void; mutate(variables: TVariables, options?: MutateOptions): Promise; } export { MutationObserver_2 as MutationObserver } export { MutationObserver_2 as MutationObserver_alias_1 } declare interface MutationObserverBaseResult extends MutationState { /** * The last successfully resolved data for the mutation. */ data: TData | undefined; /** * The variables object passed to the `mutationFn`. */ variables: TVariables | undefined; /** * The error object for the mutation, if an error was encountered. * - Defaults to `null`. */ error: TError | null; /** * A boolean variable derived from `status`. * - `true` if the last mutation attempt resulted in an error. */ isError: boolean; /** * A boolean variable derived from `status`. * - `true` if the mutation is in its initial state prior to executing. */ isIdle: boolean; /** * A boolean variable derived from `status`. * - `true` if the mutation is currently executing. */ isPending: boolean; /** * A boolean variable derived from `status`. * - `true` if the last mutation attempt was successful. */ isSuccess: boolean; /** * The status of the mutation. * - Will be: * - `idle` initial status prior to the mutation function executing. * - `pending` if the mutation is currently executing. * - `error` if the last mutation attempt resulted in an error. * - `success` if the last mutation attempt was successful. */ status: MutationStatus; /** * The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * @param variables - The variables object to pass to the `mutationFn`. * @param options.onSuccess - This function will fire when the mutation is successful and will be passed the mutation's result. * @param options.onError - This function will fire if the mutation encounters an error and will be passed the error. * @param options.onSettled - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error. * @remarks * - If you make multiple requests, `onSuccess` will fire only after the latest call you've made. * - All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored. */ mutate: MutateFunction; /** * A function to clean the mutation internal state (i.e., it resets the mutation to its initial state). */ reset: () => void; } export { MutationObserverBaseResult } export { MutationObserverBaseResult as MutationObserverBaseResult_alias_1 } declare interface MutationObserverErrorResult extends MutationObserverBaseResult { data: undefined; error: TError; variables: TVariables; isError: true; isIdle: false; isPending: false; isSuccess: false; status: 'error'; } export { MutationObserverErrorResult } export { MutationObserverErrorResult as MutationObserverErrorResult_alias_1 } declare interface MutationObserverIdleResult extends MutationObserverBaseResult { data: undefined; variables: undefined; error: null; isError: false; isIdle: true; isPending: false; isSuccess: false; status: 'idle'; } export { MutationObserverIdleResult } export { MutationObserverIdleResult as MutationObserverIdleResult_alias_1 } declare type MutationObserverListener = (result: MutationObserverResult) => void; declare interface MutationObserverLoadingResult extends MutationObserverBaseResult { data: undefined; variables: TVariables; error: null; isError: false; isIdle: false; isPending: true; isSuccess: false; status: 'pending'; } export { MutationObserverLoadingResult } export { MutationObserverLoadingResult as MutationObserverLoadingResult_alias_1 } declare interface MutationObserverOptions extends MutationOptions { throwOnError?: boolean | ((error: TError) => boolean); } export { MutationObserverOptions } export { MutationObserverOptions as MutationObserverOptions_alias_1 } declare type MutationObserverResult = MutationObserverIdleResult | MutationObserverLoadingResult | MutationObserverErrorResult | MutationObserverSuccessResult; export { MutationObserverResult } export { MutationObserverResult as MutationObserverResult_alias_1 } declare interface MutationObserverSuccessResult extends MutationObserverBaseResult { data: TData; error: null; variables: TVariables; isError: false; isIdle: false; isPending: false; isSuccess: true; status: 'success'; } export { MutationObserverSuccessResult } export { MutationObserverSuccessResult as MutationObserverSuccessResult_alias_1 } declare interface MutationOptions { mutationFn?: MutationFunction; mutationKey?: MutationKey; onMutate?: (variables: TVariables, context: MutationFunctionContext) => Promise | TOnMutateResult; onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => Promise | unknown; onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; retry?: RetryValue; retryDelay?: RetryDelayValue; networkMode?: NetworkMode; gcTime?: number; _defaulted?: boolean; meta?: MutationMeta; scope?: MutationScope; } export { MutationOptions } export { MutationOptions as MutationOptions_alias_1 } declare type MutationScope = { id: string; }; export { MutationScope } export { MutationScope as MutationScope_alias_1 } declare interface MutationState { context: TOnMutateResult | undefined; data: TData | undefined; error: TError | null; failureCount: number; failureReason: TError | null; isPaused: boolean; status: MutationStatus; variables: TVariables | undefined; submittedAt: number; } export { MutationState } export { MutationState as MutationState_alias_1 } declare type MutationStatus = 'idle' | 'pending' | 'success' | 'error'; export { MutationStatus } export { MutationStatus as MutationStatus_alias_1 } declare type NetworkMode = 'online' | 'always' | 'offlineFirst'; export { NetworkMode } export { NetworkMode as NetworkMode_alias_1 } declare type NoInfer_2 = [T][T extends any ? 0 : never]; export { NoInfer_2 as NoInfer } export { NoInfer_2 as NoInfer_alias_1 } declare type NonFunctionGuard = T extends Function ? never : T; declare type NonUndefinedGuard = T extends undefined ? never : T; export { NonUndefinedGuard } export { NonUndefinedGuard as NonUndefinedGuard_alias_1 } declare function noop(): void; declare function noop(): undefined; export { noop } export { noop as noop_alias_1 } declare type NotifyCallback = () => void; declare interface NotifyEvent { type: NotifyEventType; } export { NotifyEvent } export { NotifyEvent as NotifyEvent_alias_1 } declare interface NotifyEventMutationAdded extends NotifyEvent { type: 'added'; mutation: Mutation; } declare interface NotifyEventMutationObserverAdded extends NotifyEvent { type: 'observerAdded'; mutation: Mutation; observer: MutationObserver_2; } declare interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent { type: 'observerOptionsUpdated'; mutation?: Mutation; observer: MutationObserver_2; } declare interface NotifyEventMutationObserverRemoved extends NotifyEvent { type: 'observerRemoved'; mutation: Mutation; observer: MutationObserver_2; } declare interface NotifyEventMutationRemoved extends NotifyEvent { type: 'removed'; mutation: Mutation; } declare interface NotifyEventMutationUpdated extends NotifyEvent { type: 'updated'; mutation: Mutation; action: Action; } declare interface NotifyEventQueryAdded extends NotifyEvent { type: 'added'; query: Query; } declare interface NotifyEventQueryObserverAdded extends NotifyEvent { type: 'observerAdded'; query: Query; observer: QueryObserver; } declare interface NotifyEventQueryObserverOptionsUpdated extends NotifyEvent { type: 'observerOptionsUpdated'; query: Query; observer: QueryObserver; } declare interface NotifyEventQueryObserverRemoved extends NotifyEvent { type: 'observerRemoved'; query: Query; observer: QueryObserver; } declare interface NotifyEventQueryObserverResultsUpdated extends NotifyEvent { type: 'observerResultsUpdated'; query: Query; } declare interface NotifyEventQueryRemoved extends NotifyEvent { type: 'removed'; query: Query; } declare interface NotifyEventQueryUpdated extends NotifyEvent { type: 'updated'; query: Query; action: Action_alias_1; } declare type NotifyEventType = 'added' | 'removed' | 'updated' | 'observerAdded' | 'observerRemoved' | 'observerResultsUpdated' | 'observerOptionsUpdated'; export { NotifyEventType } export { NotifyEventType as NotifyEventType_alias_1 } declare type NotifyFunction = (callback: () => void) => void; declare const notifyManager: { readonly batch: (callback: () => T) => T; /** * All calls to the wrapped function will be batched. */ readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; readonly schedule: (callback: NotifyCallback) => void; /** * Use this method to set a custom notify function. * This can be used to for example wrap notifications with `React.act` while running tests. */ readonly setNotifyFunction: (fn: NotifyFunction) => void; /** * Use this method to set a custom function to batch notifications together into a single tick. * By default React Query will use the batch function provided by ReactDOM or React Native. */ readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; readonly setScheduler: (fn: ScheduleFunction) => void; }; export { notifyManager } export { notifyManager as notifyManager_alias_1 } declare type NotifyOnChangeProps = Array | 'all' | undefined | (() => Array | 'all' | undefined); export { NotifyOnChangeProps } export { NotifyOnChangeProps as NotifyOnChangeProps_alias_1 } declare interface ObserverFetchOptions extends FetchOptions { throwOnError?: boolean; } declare type OmitKeyof) | (number & Record) | (symbol & Record) : keyof TObject, TStrictly extends 'strictly' | 'safely' = 'strictly'> = Omit; export { OmitKeyof } export { OmitKeyof as OmitKeyof_alias_1 } export declare class OnlineManager extends Subscribable { #private; constructor(); protected onSubscribe(): void; protected onUnsubscribe(): void; setEventListener(setup: SetupFn_2): void; setOnline(online: boolean): void; isOnline(): boolean; } declare const onlineManager: OnlineManager; export { onlineManager } export { onlineManager as onlineManager_alias_1 } declare type Override = { [AKey in keyof TTargetA]: AKey extends keyof TTargetB ? TTargetB[AKey] : TTargetA[AKey]; }; export { Override } export { Override as Override_alias_1 } /** * Checks if key `b` partially matches with key `a`. */ declare function partialMatchKey(a: QueryKey, b: QueryKey): boolean; export { partialMatchKey } export { partialMatchKey as partialMatchKey_alias_1 } declare interface PauseAction { type: 'pause'; } declare interface PauseAction_2 { type: 'pause'; } declare interface Pending { status: 'pending'; /** * Resolve the promise with a value. * Will remove the `resolve` and `reject` properties from the promise. */ resolve: (value: T) => void; /** * Reject the promise with a reason. * Will remove the `resolve` and `reject` properties from the promise. */ reject: (reason: unknown) => void; } declare interface PendingAction { type: 'pending'; isPaused: boolean; variables?: TVariables; context?: TOnMutateResult; } export declare type PendingThenable = Promise & Pending; export declare function pendingThenable(): PendingThenable; declare type PlaceholderDataFunction = (previousData: TQueryData | undefined, previousQuery: Query | undefined) => TQueryData | undefined; export { PlaceholderDataFunction } export { PlaceholderDataFunction as PlaceholderDataFunction_alias_1 } declare class QueriesObserver> extends Subscribable { #private; constructor(client: QueryClient, queries: Array>, options?: QueriesObserverOptions); protected onSubscribe(): void; protected onUnsubscribe(): void; destroy(): void; setQueries(queries: Array, options?: QueriesObserverOptions): void; getCurrentResult(): Array; getQueries(): Query[]; getObservers(): QueryObserver[]; getOptimisticResult(queries: Array, combine: CombineFn | undefined): [ rawResult: Array, combineResult: (r?: Array) => TCombinedResult, trackResult: () => Array ]; } export { QueriesObserver } export { QueriesObserver as QueriesObserver_alias_1 } declare type QueriesObserverListener = (result: Array) => void; declare interface QueriesObserverOptions> { combine?: CombineFn; } export { QueriesObserverOptions } export { QueriesObserverOptions as QueriesObserverOptions_alias_1 } declare type QueriesPlaceholderDataFunction = (previousData: undefined, previousQuery: undefined) => TQueryData | undefined; export { QueriesPlaceholderDataFunction } export { QueriesPlaceholderDataFunction as QueriesPlaceholderDataFunction_alias_1 } declare class Query extends Removable { #private; queryKey: TQueryKey; queryHash: string; options: QueryOptions; state: QueryState; observers: Array>; constructor(config: QueryConfig); get meta(): QueryMeta | undefined; get promise(): Promise | undefined; setOptions(options?: QueryOptions): void; protected optionalRemove(): void; setData(newData: TData, options?: SetDataOptions & { manual: boolean; }): TData; setState(state: Partial>, setStateOptions?: SetStateOptions): void; cancel(options?: CancelOptions): Promise; destroy(): void; get resetState(): QueryState; reset(): void; isActive(): boolean; isDisabled(): boolean; isFetched(): boolean; isStatic(): boolean; isStale(): boolean; isStaleByTime(staleTime?: StaleTime): boolean; onFocus(): void; onOnline(): void; addObserver(observer: QueryObserver): void; removeObserver(observer: QueryObserver): void; getObserversCount(): number; invalidate(): void; fetch(options?: QueryOptions, fetchOptions?: FetchOptions): Promise; } export { Query } export { Query as Query_alias_1 } export declare interface QueryBehavior { onFetch: (context: FetchContext, query: Query) => void; } declare class QueryCache extends Subscribable { #private; config: QueryCacheConfig; constructor(config?: QueryCacheConfig); build(client: QueryClient, options: WithRequired, 'queryKey'>, state?: QueryState): Query; add(query: Query): void; remove(query: Query): void; clear(): void; get(queryHash: string): Query | undefined; getAll(): Array; find(filters: WithRequired): Query | undefined; findAll(filters?: QueryFilters): Array; notify(event: QueryCacheNotifyEvent): void; onFocus(): void; onOnline(): void; } export { QueryCache } export { QueryCache as QueryCache_alias_1 } declare interface QueryCacheConfig { onError?: (error: DefaultError, query: Query) => void; onSuccess?: (data: unknown, query: Query) => void; onSettled?: (data: unknown | undefined, error: DefaultError | null, query: Query) => void; } declare type QueryCacheListener = (event: QueryCacheNotifyEvent) => void; declare type QueryCacheNotifyEvent = NotifyEventQueryAdded | NotifyEventQueryRemoved | NotifyEventQueryUpdated | NotifyEventQueryObserverAdded | NotifyEventQueryObserverRemoved | NotifyEventQueryObserverResultsUpdated | NotifyEventQueryObserverOptionsUpdated; export { QueryCacheNotifyEvent } export { QueryCacheNotifyEvent as QueryCacheNotifyEvent_alias_1 } declare class QueryClient { #private; constructor(config?: QueryClientConfig); mount(): void; unmount(): void; isFetching = QueryFilters>(filters?: TQueryFilters): number; isMutating = MutationFilters>(filters?: TMutationFilters): number; /** * Imperative (non-reactive) way to retrieve data for a QueryKey. * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates. * * Hint: Do not use this function inside a component, because it won't receive updates. * Use `useQuery` to create a `QueryObserver` that subscribes to changes. */ getQueryData>(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined; ensureQueryData(options: EnsureQueryDataOptions): Promise; getQueriesData = QueryFilters>(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]>; setQueryData>(queryKey: TTaggedQueryKey, updater: Updater | undefined, NoInfer_2 | undefined>, options?: SetDataOptions): NoInfer_2 | undefined; setQueriesData = QueryFilters>(filters: TQueryFilters, updater: Updater | undefined, NoInfer_2 | undefined>, options?: SetDataOptions): Array<[QueryKey, TQueryFnData | undefined]>; getQueryState, TInferredError = InferErrorFromTag>(queryKey: TTaggedQueryKey): QueryState | undefined; removeQueries(filters?: QueryFilters): void; resetQueries(filters?: QueryFilters, options?: ResetOptions): Promise; cancelQueries(filters?: QueryFilters, cancelOptions?: CancelOptions): Promise; invalidateQueries(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise; refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; fetchQuery(options: FetchQueryOptions): Promise; prefetchQuery(options: FetchQueryOptions): Promise; fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; resumePausedMutations(): Promise; getQueryCache(): QueryCache; getMutationCache(): MutationCache; getDefaultOptions(): DefaultOptions; setDefaultOptions(options: DefaultOptions): void; setQueryDefaults(queryKey: QueryKey, options: Partial, 'queryKey'>>): void; getQueryDefaults(queryKey: QueryKey): OmitKeyof, 'queryKey'>; setMutationDefaults(mutationKey: MutationKey, options: OmitKeyof, 'mutationKey'>): void; getMutationDefaults(mutationKey: MutationKey): OmitKeyof, 'mutationKey'>; defaultQueryOptions(options: QueryObserverOptions | DefaultedQueryObserverOptions): DefaultedQueryObserverOptions; defaultMutationOptions>(options?: T): T; clear(): void; } export { QueryClient } export { QueryClient as QueryClient_alias_1 } declare interface QueryClientConfig { queryCache?: QueryCache; mutationCache?: MutationCache; defaultOptions?: DefaultOptions; } export { QueryClientConfig } export { QueryClientConfig as QueryClientConfig_alias_1 } declare interface QueryConfig { client: QueryClient; queryKey: TQueryKey; queryHash: string; options?: QueryOptions; defaultOptions?: QueryOptions; state?: QueryState; } declare interface QueryFilters { /** * Filter to active queries, inactive queries or all queries */ type?: QueryTypeFilter; /** * Match query key exactly */ exact?: boolean; /** * Include queries matching this predicate function */ predicate?: (query: Query) => boolean; /** * Include queries matching this query key */ queryKey?: TQueryKey | TuplePrefixes; /** * Include or exclude stale queries */ stale?: boolean; /** * Include queries matching their fetchStatus */ fetchStatus?: FetchStatus; } export { QueryFilters } export { QueryFilters as QueryFilters_alias_1 } declare type QueryFunction = (context: QueryFunctionContext) => T | Promise; export { QueryFunction } export { QueryFunction as QueryFunction_alias_1 } declare type QueryFunctionContext = [TPageParam] extends [never] ? { client: QueryClient; queryKey: TQueryKey; signal: AbortSignal; meta: QueryMeta | undefined; pageParam?: unknown; /** * @deprecated * if you want access to the direction, you can add it to the pageParam */ direction?: unknown; } : { client: QueryClient; queryKey: TQueryKey; signal: AbortSignal; pageParam: TPageParam; /** * @deprecated * if you want access to the direction, you can add it to the pageParam */ direction: FetchDirection; meta: QueryMeta | undefined; }; export { QueryFunctionContext } export { QueryFunctionContext as QueryFunctionContext_alias_1 } declare type QueryKey = Register extends { queryKey: infer TQueryKey; } ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends Array ? TQueryKey : ReadonlyArray : ReadonlyArray; export { QueryKey } export { QueryKey as QueryKey_alias_1 } declare type QueryKeyHashFunction = (queryKey: TQueryKey) => string; export { QueryKeyHashFunction } export { QueryKeyHashFunction as QueryKeyHashFunction_alias_1 } declare type QueryMeta = Register extends { queryMeta: infer TQueryMeta; } ? TQueryMeta extends Record ? TQueryMeta : Record : Record; export { QueryMeta } export { QueryMeta as QueryMeta_alias_1 } declare class QueryObserver extends Subscribable> { #private; options: QueryObserverOptions; constructor(client: QueryClient, options: QueryObserverOptions); protected bindMethods(): void; protected onSubscribe(): void; protected onUnsubscribe(): void; shouldFetchOnReconnect(): boolean; shouldFetchOnWindowFocus(): boolean; destroy(): void; setOptions(options: QueryObserverOptions): void; getOptimisticResult(options: DefaultedQueryObserverOptions): QueryObserverResult; getCurrentResult(): QueryObserverResult; trackResult(result: QueryObserverResult, onPropTracked?: (key: keyof QueryObserverResult) => void): QueryObserverResult; trackProp(key: keyof QueryObserverResult): void; getCurrentQuery(): Query; refetch({ ...options }?: RefetchOptions): Promise>; fetchOptimistic(options: QueryObserverOptions): Promise>; protected fetch(fetchOptions: ObserverFetchOptions): Promise>; protected createResult(query: Query, options: QueryObserverOptions): QueryObserverResult; updateResult(): void; onQueryUpdate(): void; } export { QueryObserver } export { QueryObserver as QueryObserver_alias_1 } declare interface QueryObserverBaseResult { /** * The last successfully resolved data for the query. */ data: TData | undefined; /** * The timestamp for when the query most recently returned the `status` as `"success"`. */ dataUpdatedAt: number; /** * The error object for the query, if an error was thrown. * - Defaults to `null`. */ error: TError | null; /** * The timestamp for when the query most recently returned the `status` as `"error"`. */ errorUpdatedAt: number; /** * The failure count for the query. * - Incremented every time the query fails. * - Reset to `0` when the query succeeds. */ failureCount: number; /** * The failure reason for the query retry. * - Reset to `null` when the query succeeds. */ failureReason: TError | null; /** * The sum of all errors. */ errorUpdateCount: number; /** * A derived boolean from the `status` variable, provided for convenience. * - `true` if the query attempt resulted in an error. */ isError: boolean; /** * Will be `true` if the query has been fetched. */ isFetched: boolean; /** * Will be `true` if the query has been fetched after the component mounted. * - This property can be used to not show any previously cached data. */ isFetchedAfterMount: boolean; /** * A derived boolean from the `fetchStatus` variable, provided for convenience. * - `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch. */ isFetching: boolean; /** * Is `true` whenever the first fetch for a query is in-flight. * - Is the same as `isFetching && isPending`. */ isLoading: boolean; /** * Will be `pending` if there's no cached data and no query attempt was finished yet. */ isPending: boolean; /** * Will be `true` if the query failed while fetching for the first time. */ isLoadingError: boolean; /** * @deprecated `isInitialLoading` is being deprecated in favor of `isLoading` * and will be removed in the next major version. */ isInitialLoading: boolean; /** * A derived boolean from the `fetchStatus` variable, provided for convenience. * - The query wanted to fetch, but has been `paused`. */ isPaused: boolean; /** * Will be `true` if the data shown is the placeholder data. */ isPlaceholderData: boolean; /** * Will be `true` if the query failed while refetching. */ isRefetchError: boolean; /** * Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`. * - Is the same as `isFetching && !isPending`. */ isRefetching: boolean; /** * Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. */ isStale: boolean; /** * A derived boolean from the `status` variable, provided for convenience. * - `true` if the query has received a response with no errors and is ready to display its data. */ isSuccess: boolean; /** * `true` if this observer is enabled, `false` otherwise. */ isEnabled: boolean; /** * A function to manually refetch the query. */ refetch: (options?: RefetchOptions) => Promise>; /** * The status of the query. * - Will be: * - `pending` if there's no cached data and no query attempt was finished yet. * - `error` if the query attempt resulted in an error. * - `success` if the query has received a response with no errors and is ready to display its data. */ status: QueryStatus; /** * The fetch status of the query. * - `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch. * - `paused`: The query wanted to fetch, but has been `paused`. * - `idle`: The query is not fetching. * - See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. */ fetchStatus: FetchStatus; /** * A stable promise that will be resolved with the data of the query. * Requires the `experimental_prefetchInRender` feature flag to be enabled. * @example * * ### Enabling the feature flag * ```ts * const client = new QueryClient({ * defaultOptions: { * queries: { * experimental_prefetchInRender: true, * }, * }, * }) * ``` * * ### Usage * ```tsx * import { useQuery } from '@tanstack/react-query' * import React from 'react' * import { fetchTodos, type Todo } from './api' * * function TodoList({ query }: { query: UseQueryResult }) { * const data = React.use(query.promise) * * return ( *
    * {data.map(todo => ( *
  • {todo.title}
  • * ))} *
* ) * } * * export function App() { * const query = useQuery({ queryKey: ['todos'], queryFn: fetchTodos }) * * return ( * <> *

Todos

* Loading...}> * * * * ) * } * ``` */ promise: Promise; } export { QueryObserverBaseResult } export { QueryObserverBaseResult as QueryObserverBaseResult_alias_1 } declare type QueryObserverListener = (result: QueryObserverResult) => void; declare interface QueryObserverLoadingErrorResult extends QueryObserverBaseResult { data: undefined; error: TError; isError: true; isPending: false; isLoading: false; isLoadingError: true; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: 'error'; } export { QueryObserverLoadingErrorResult } export { QueryObserverLoadingErrorResult as QueryObserverLoadingErrorResult_alias_1 } declare interface QueryObserverLoadingResult extends QueryObserverBaseResult { data: undefined; error: null; isError: false; isPending: true; isLoading: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: 'pending'; } export { QueryObserverLoadingResult } export { QueryObserverLoadingResult as QueryObserverLoadingResult_alias_1 } declare interface QueryObserverOptions extends WithRequired, 'queryKey'> { /** * Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys. * To refetch the query, use the `refetch` method returned from the `useQuery` instance. * Accepts a boolean or function that returns a boolean. * Defaults to `true`. */ enabled?: Enabled; /** * The time in milliseconds after data is considered stale. * If set to `Infinity`, the data will never be considered stale. * If set to a function, the function will be executed with the query to compute a `staleTime`. * Defaults to `0`. */ staleTime?: StaleTimeFunction; /** * If set to a number, the query will continuously refetch at this frequency in milliseconds. * If set to a function, the function will be executed with the latest data and query to compute a frequency * Defaults to `false`. */ refetchInterval?: number | false | ((query: Query) => number | false | undefined); /** * If set to `true`, the query will continue to refetch while their tab/window is in the background. * Defaults to `false`. */ refetchIntervalInBackground?: boolean; /** * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the latest data and query to compute the value. * Defaults to `true`. */ refetchOnWindowFocus?: boolean | 'always' | ((query: Query) => boolean | 'always'); /** * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the latest data and query to compute the value. * Defaults to the value of `networkOnline` (`true`) */ refetchOnReconnect?: boolean | 'always' | ((query: Query) => boolean | 'always'); /** * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, will disable additional instances of a query to trigger background refetch. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the latest data and query to compute the value * Defaults to `true`. */ refetchOnMount?: boolean | 'always' | ((query: Query) => boolean | 'always'); /** * If set to `false`, the query will not be retried on mount if it contains an error. * Defaults to `true`. */ retryOnMount?: boolean; /** * If set, the component will only re-render if any of the listed properties change. * When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. * When set to `'all'`, the component will re-render whenever a query is updated. * When set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. */ notifyOnChangeProps?: NotifyOnChangeProps; /** * Whether errors should be thrown instead of setting the `error` property. * If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary. * If set to `false` and `suspense` is `false`, errors are returned as state. * If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`). * Defaults to `false`. */ throwOnError?: ThrowOnError; /** * This option can be used to transform or select a part of the data returned by the query function. */ select?: (data: TQueryData) => TData; /** * If set to `true`, the query will suspend when `status === 'pending'` * and throw errors when `status === 'error'`. * Defaults to `false`. */ suspense?: boolean; /** * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. */ placeholderData?: NonFunctionGuard | PlaceholderDataFunction, TError, NonFunctionGuard, TQueryKey>; _optimisticResults?: 'optimistic' | 'isRestoring'; /** * Enable prefetching during rendering */ experimental_prefetchInRender?: boolean; } export { QueryObserverOptions } export { QueryObserverOptions as QueryObserverOptions_alias_1 } declare interface QueryObserverPendingResult extends QueryObserverBaseResult { data: undefined; error: null; isError: false; isPending: true; isLoadingError: false; isRefetchError: false; isSuccess: false; isPlaceholderData: false; status: 'pending'; } export { QueryObserverPendingResult } export { QueryObserverPendingResult as QueryObserverPendingResult_alias_1 } declare interface QueryObserverPlaceholderResult extends QueryObserverBaseResult { data: TData; isError: false; error: null; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: true; status: 'success'; } export { QueryObserverPlaceholderResult } export { QueryObserverPlaceholderResult as QueryObserverPlaceholderResult_alias_1 } declare interface QueryObserverRefetchErrorResult extends QueryObserverBaseResult { data: TData; error: TError; isError: true; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; isPlaceholderData: false; status: 'error'; } export { QueryObserverRefetchErrorResult } export { QueryObserverRefetchErrorResult as QueryObserverRefetchErrorResult_alias_1 } declare type QueryObserverResult = DefinedQueryObserverResult | QueryObserverLoadingErrorResult | QueryObserverLoadingResult | QueryObserverPendingResult | QueryObserverPlaceholderResult; export { QueryObserverResult } export { QueryObserverResult as QueryObserverResult_alias_1 } declare interface QueryObserverSuccessResult extends QueryObserverBaseResult { data: TData; error: null; isError: false; isPending: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; isPlaceholderData: false; status: 'success'; } export { QueryObserverSuccessResult } export { QueryObserverSuccessResult as QueryObserverSuccessResult_alias_1 } declare interface QueryOptions { /** * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely., failureCount: num * If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. * If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. */ retry?: RetryValue; retryDelay?: RetryDelayValue; networkMode?: NetworkMode; /** * The time in milliseconds that unused/inactive cache data remains in memory. * When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. * When different garbage collection times are specified, the longest one will be used. * Setting it to `Infinity` will disable garbage collection. */ gcTime?: number; queryFn?: QueryFunction | SkipToken; persister?: QueryPersister, NoInfer_2, NoInfer_2>; queryHash?: string; queryKey?: TQueryKey; queryKeyHashFn?: QueryKeyHashFunction; initialData?: TData | InitialDataFunction; initialDataUpdatedAt?: number | (() => number | undefined); behavior?: QueryBehavior; /** * Set this to `false` to disable structural sharing between query results. * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic. * Defaults to `true`. */ structuralSharing?: boolean | ((oldData: unknown | undefined, newData: unknown) => unknown); _defaulted?: boolean; /** * Additional payload to be stored on each query. * Use this property to pass information that can be used in other places. */ meta?: QueryMeta; /** * Maximum number of pages to store in the data of an infinite query. */ maxPages?: number; } export { QueryOptions } export { QueryOptions as QueryOptions_alias_1 } declare type QueryPersister = [TPageParam] extends [never] ? (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise : (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise; export { QueryPersister } export { QueryPersister as QueryPersister_alias_1 } declare interface QueryState { data: TData | undefined; dataUpdateCount: number; dataUpdatedAt: number; error: TError | null; errorUpdateCount: number; errorUpdatedAt: number; fetchFailureCount: number; fetchFailureReason: TError | null; fetchMeta: FetchMeta | null; isInvalidated: boolean; status: QueryStatus; fetchStatus: FetchStatus; } export { QueryState } export { QueryState as QueryState_alias_1 } declare type QueryStatus = 'pending' | 'error' | 'success'; export { QueryStatus } export { QueryStatus as QueryStatus_alias_1 } export declare interface QueryStore { has: (queryHash: string) => boolean; set: (queryHash: string, query: Query) => void; get: (queryHash: string) => Query | undefined; delete: (queryHash: string) => void; values: () => IterableIterator; } export declare type QueryTypeFilter = 'all' | 'active' | 'inactive'; declare type ReducibleStreamedQueryParams = BaseStreamedQueryParams & { reducer: (acc: TData, chunk: TQueryFnData) => TData; initialValue: TData; }; declare interface RefetchOptions extends ResultOptions { /** * If set to `true`, a currently running request will be cancelled before a new request is made * * If set to `false`, no refetch will be made if there is already a request running. * * Defaults to `true`. */ cancelRefetch?: boolean; } export { RefetchOptions } export { RefetchOptions as RefetchOptions_alias_1 } declare interface RefetchQueryFilters extends QueryFilters { } export { RefetchQueryFilters } export { RefetchQueryFilters as RefetchQueryFilters_alias_1 } declare interface Register { } export { Register } export { Register as Register_alias_1 } declare interface Rejected { status: 'rejected'; reason: unknown; } export declare type RejectedThenable = Promise & Rejected; export declare abstract class Removable { #private; gcTime: number; destroy(): void; protected scheduleGc(): void; protected updateGcTime(newGcTime: number | undefined): void; protected clearGcTimeout(): void; protected abstract optionalRemove(): void; } export declare function replaceData>(prevData: TData | undefined, data: TData, options: TOptions): TData; /** * This function returns `a` if `b` is deeply equal. * If not, it will replace any deeply equal children of `b` with those of `a`. * This can be used for structural sharing between JSON values for example. */ declare function replaceEqualDeep(a: unknown, b: T, depth?: number): T; export { replaceEqualDeep } export { replaceEqualDeep as replaceEqualDeep_alias_1 } declare type ReplaceReturnType) => unknown, TReturn> = (...args: Parameters) => TReturn; declare interface ResetOptions extends RefetchOptions { } export { ResetOptions } export { ResetOptions as ResetOptions_alias_1 } export declare function resolveEnabled(enabled: undefined | Enabled, query: Query): boolean | undefined; export declare function resolveStaleTime(staleTime: undefined | StaleTimeFunction, query: Query): StaleTime | undefined; declare interface ResultOptions { throwOnError?: boolean; } export { ResultOptions } export { ResultOptions as ResultOptions_alias_1 } declare type RetryDelayFunction = (failureCount: number, error: TError) => number; export declare type RetryDelayValue = number | RetryDelayFunction; export declare interface Retryer { promise: Promise; cancel: (cancelOptions?: CancelOptions) => void; continue: () => Promise; cancelRetry: () => void; continueRetry: () => void; canStart: () => boolean; start: () => Promise; status: () => 'pending' | 'resolved' | 'rejected'; } declare interface RetryerConfig { fn: () => TData | Promise; initialPromise?: Promise; onCancel?: (error: TError) => void; onFail?: (failureCount: number, error: TError) => void; onPause?: () => void; onContinue?: () => void; retry?: RetryValue; retryDelay?: RetryDelayValue; networkMode: NetworkMode | undefined; canRun: () => boolean; } export declare type RetryValue = boolean | number | ShouldRetryFunction; declare type ScheduleFunction = (callback: () => void) => void; declare interface SetDataOptions { updatedAt?: number; } export { SetDataOptions } export { SetDataOptions as SetDataOptions_alias_1 } declare interface SetStateAction { type: 'setState'; state: Partial>; setStateOptions?: SetStateOptions; } export declare interface SetStateOptions { meta?: any; } declare type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined; declare type SetupFn_2 = (setOnline: Listener_2) => (() => void) | undefined; /** * Shallow compare objects. */ export declare function shallowEqualObjects>(a: T, b: T | undefined): boolean; declare type ShouldRetryFunction = (failureCount: number, error: TError) => boolean; declare function shouldThrowError) => boolean>(throwOnError: boolean | T | undefined, params: Parameters): boolean; export { shouldThrowError } export { shouldThrowError as shouldThrowError_alias_1 } declare type SimpleStreamedQueryParams = BaseStreamedQueryParams & { reducer?: never; initialValue?: never; }; declare type SkipToken = typeof skipToken; export { SkipToken } export { SkipToken as SkipToken_alias_1 } declare const skipToken: unique symbol; export { skipToken } export { skipToken as skipToken_alias_1 } export declare function sleep(timeout: number): Promise; declare type StaleTime = number | 'static'; export { StaleTime } export { StaleTime as StaleTime_alias_1 } declare type StaleTimeFunction = StaleTime | ((query: Query) => StaleTime); export { StaleTimeFunction } export { StaleTimeFunction as StaleTimeFunction_alias_1 } /** * This is a helper function to create a query function that streams data from an AsyncIterable. * Data will be an Array of all the chunks received. * The query will be in a 'pending' state until the first chunk of data is received, but will go to 'success' after that. * The query will stay in fetchStatus 'fetching' until the stream ends. * @param queryFn - The function that returns an AsyncIterable to stream data from. * @param refetchMode - Defines how re-fetches are handled. * Defaults to `'reset'`, erases all data and puts the query back into `pending` state. * Set to `'append'` to append new data to the existing data. * Set to `'replace'` to write all data to the cache once the stream ends. * @param reducer - A function to reduce the streamed chunks into the final data. * Defaults to a function that appends chunks to the end of the array. * @param initialValue - Initial value to be used while the first chunk is being fetched, and returned if the stream yields no values. */ declare function streamedQuery, TQueryKey extends QueryKey = QueryKey>({ streamFn, refetchMode, reducer, initialValue, }: StreamedQueryParams): QueryFunction; export { streamedQuery as experimental_streamedQuery } export { streamedQuery } declare type StreamedQueryParams = SimpleStreamedQueryParams | ReducibleStreamedQueryParams; export declare class Subscribable { protected listeners: Set; constructor(); subscribe(listener: TListener): () => void; hasListeners(): boolean; protected onSubscribe(): void; protected onUnsubscribe(): void; } declare interface SuccessAction { data: TData | undefined; type: 'success'; dataUpdatedAt?: number; manual?: boolean; } declare interface SuccessAction_2 { type: 'success'; data: TData; } /** * In many cases code wants to delay to the next event loop tick; this is not * mediated by {@link timeoutManager}. * * This function is provided to make auditing the `tanstack/query-core` for * incorrect use of system `setTimeout` easier. */ export declare function systemSetTimeoutZero(callback: TimeoutCallback): void; export declare type Thenable = FulfilledThenable | RejectedThenable | PendingThenable; declare type ThrowOnError = boolean | ((error: TError, query: Query) => boolean); export { ThrowOnError } export { ThrowOnError as ThrowOnError_alias_1 } /** * {@link TimeoutManager} does not support passing arguments to the callback. * * `(_: void)` is the argument type inferred by TypeScript's default typings for * `setTimeout(cb, number)`. * If we don't accept a single void argument, then * `new Promise(resolve => timeoutManager.setTimeout(resolve, N))` is a type error. */ declare type TimeoutCallback = (_: void) => void; export { TimeoutCallback } export { TimeoutCallback as TimeoutCallback_alias_1 } /** * Allows customization of how timeouts are created. * * @tanstack/query-core makes liberal use of timeouts to implement `staleTime` * and `gcTime`. The default TimeoutManager provider uses the platform's global * `setTimeout` implementation, which is known to have scalability issues with * thousands of timeouts on the event loop. * * If you hit this limitation, consider providing a custom TimeoutProvider that * coalesces timeouts. */ export declare class TimeoutManager implements Omit { #private; setTimeoutProvider(provider: TimeoutProvider): void; setTimeout(callback: TimeoutCallback, delay: number): ManagedTimerId; clearTimeout(timeoutId: ManagedTimerId | undefined): void; setInterval(callback: TimeoutCallback, delay: number): ManagedTimerId; clearInterval(intervalId: ManagedTimerId | undefined): void; } declare const timeoutManager: TimeoutManager; export { timeoutManager } export { timeoutManager as timeoutManager_alias_1 } /** * Backend for timer functions. */ declare type TimeoutProvider = { readonly setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; readonly clearTimeout: (timeoutId: TTimerId | undefined) => void; readonly setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; readonly clearInterval: (intervalId: TTimerId | undefined) => void; }; export { TimeoutProvider } export { TimeoutProvider as TimeoutProvider_alias_1 } export declare function timeUntilStale(updatedAt: number, staleTime?: number): number; declare type TransformerFn = (data: any) => any; /** * This function takes a Promise-like input and detects whether the data * is synchronously available or not. * * It does not inspect .status, .value or .reason properties of the promise, * as those are not always available, and the .status of React's promises * should not be considered part of the public API. */ export declare function tryResolveSync(promise: Promise | Thenable): { data: {} | null; } | undefined; declare type TuplePrefixes> = T extends readonly [] ? readonly [] : TuplePrefixes> | T; declare type UnsetMarker = typeof unsetMarker; export { UnsetMarker } export { UnsetMarker as UnsetMarker_alias_1 } declare const unsetMarker: unique symbol; export { unsetMarker } export { unsetMarker as unsetMarker_alias_1 } declare type Updater = TOutput | ((input: TInput) => TOutput); export { Updater } export { Updater as Updater_alias_1 } declare type WithRequired = TTarget & { [_ in TKey]: {}; }; export { WithRequired } export { WithRequired as WithRequired_alias_1 } export { }