import { Mutation } from './mutation'; import { Query } from './query'; import { EnsuredQueryKey } from './types'; import { MutationFunction, MutationKey, MutationOptions, QueryFunction, QueryKey, QueryOptions } from './types'; export interface QueryFilters { /** * Include or exclude active queries */ active?: boolean; /** * Match query key exactly */ exact?: boolean; /** * Include or exclude inactive queries */ inactive?: boolean; /** * Include queries matching this predicate function */ predicate?: (query: Query) => boolean; /** * Include queries matching this query key */ queryKey?: QueryKey; /** * Include or exclude stale queries */ stale?: boolean; /** * Include or exclude fetching queries */ fetching?: boolean; } export 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?: MutationKey; /** * Include or exclude fetching mutations */ fetching?: boolean; } export declare type DataUpdateFunction = (input: TInput) => TOutput; export declare type Updater = TOutput | DataUpdateFunction; export declare type QueryStatusFilter = 'all' | 'active' | 'inactive' | 'none'; export declare const isServer: boolean; export declare function noop(): undefined; export declare function functionalUpdate(updater: Updater, input: TInput): TOutput; export declare function isValidTimeout(value: unknown): value is number; export declare function ensureQueryKeyArray(value: T): EnsuredQueryKey; export declare function difference(array1: T[], array2: T[]): T[]; export declare function replaceAt(array: T[], index: number, value: T): T[]; export declare function timeUntilStale(updatedAt: number, staleTime?: number): number; export declare function parseQueryArgs, TQueryKey extends QueryKey = QueryKey>(arg1: TQueryKey | TOptions, arg2?: QueryFunction | TOptions, arg3?: TOptions): TOptions; export declare function parseMutationArgs>(arg1: MutationKey | MutationFunction | TOptions, arg2?: MutationFunction | TOptions, arg3?: TOptions): TOptions; export declare function parseFilterArgs(arg1?: QueryKey | TFilters, arg2?: TFilters | TOptions, arg3?: TOptions): [TFilters, TOptions | undefined]; export declare function parseMutationFilterArgs(arg1?: QueryKey | MutationFilters, arg2?: MutationFilters): MutationFilters | undefined; export declare function mapQueryStatusFilter(active?: boolean, inactive?: boolean): QueryStatusFilter; export declare function matchQuery(filters: QueryFilters, query: Query): boolean; export declare function matchMutation(filters: MutationFilters, mutation: Mutation): boolean; export declare function hashQueryKeyByOptions(queryKey: TQueryKey, options?: QueryOptions): string; /** * Default query keys hash function. */ export declare function hashQueryKey(queryKey: QueryKey): string; /** * Hashes the value into a stable hash. */ export declare function stableValueHash(value: any): string; /** * Checks if key `b` partially matches with key `a`. */ export declare function partialMatchKey(a: QueryKey, b: QueryKey): boolean; /** * Checks if `b` partially matches with `a`. */ export declare function partialDeepEqual(a: any, b: any): boolean; /** * 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. */ export declare function replaceEqualDeep(a: unknown, b: T): T; /** * Shallow compare objects. Only works with objects that always have the same properties. */ export declare function shallowEqualObjects(a: T, b: T): boolean; export declare function isPlainObject(o: any): o is Object; export declare function isQueryKey(value: any): value is QueryKey; export declare function isError(value: any): value is Error; export declare function sleep(timeout: number): Promise; /** * Schedules a microtask. * This can be useful to schedule state updates after rendering. */ export declare function scheduleMicrotask(callback: () => void): void; export declare function getAbortController(): AbortController | undefined;