import { InfiniteData, NoInfer, QueryClient, QueryFilters, QueryKey, SetDataOptions } from '@tanstack/query-core';
import { PlainObjectType } from '../types/generic.types';
import { InfiniteQueryResultType, QueryResultType } from '../types/query.types';
import { MsgType } from '../types/msg.types';
export declare function findAnyExistingItem<TDataItem extends PlainObjectType>(queryData: InfiniteData<InfiniteQueryResultType<TDataItem>> | QueryResultType<TDataItem> | undefined, propertyName: string, value: string, copy?: boolean): boolean | TDataItem | undefined;
export declare function addToQueryData<TDataItem extends PlainObjectType, TQueryData extends InfiniteData<InfiniteQueryResultType<TDataItem>, unknown> | QueryResultType<TDataItem> = InfiniteData<InfiniteQueryResultType<TDataItem>, unknown> | QueryResultType<TDataItem>>(queryData: NoInfer<TQueryData> | undefined, item: TDataItem, sorting?: {
    by?: string;
    descending?: boolean;
}, previousId?: number): NoInfer<TQueryData> | {
    pages: InfiniteQueryResultType<TDataItem>[];
    pageParams: unknown[];
    data?: undefined;
    count?: undefined;
} | {
    data: TDataItem[];
    count: number;
    pages?: undefined;
    pageParams?: undefined;
} | undefined;
export declare function updateQueryData<TDataItem extends PlainObjectType>(queryData: InfiniteData<InfiniteQueryResultType<TDataItem>> | InfiniteQueryResultType<TDataItem> | QueryResultType<TDataItem> | undefined, select: number | ((item: TDataItem & PlainObjectType) => boolean) | undefined, fnUpdater: (item: TDataItem & PlainObjectType) => void): InfiniteQueryResultType<TDataItem> | InfiniteData<InfiniteQueryResultType<TDataItem>, unknown> | {
    data: TDataItem[];
    pages: InfiniteQueryResultType<TDataItem>[];
    pageParams: unknown[];
} | undefined;
export declare function removeQueryData<TDataItem extends PlainObjectType>(queryData: InfiniteData<InfiniteQueryResultType<TDataItem>> | QueryResultType<TDataItem> | undefined, select: number | ((item: TDataItem & PlainObjectType) => boolean)): InfiniteData<InfiniteQueryResultType<TDataItem>, unknown> | QueryResultType<TDataItem> | undefined;
export declare const addCacheItem: <T extends PlainObjectType, TQueryFnData extends InfiniteData<InfiniteQueryResultType<T>, unknown> | QueryResultType<T> | undefined = InfiniteData<InfiniteQueryResultType<T>, unknown> | QueryResultType<T> | undefined>(queryClient: QueryClient, key: QueryKey, item: T, sorting?: {
    by?: string;
    descending?: boolean;
}) => TQueryFnData | undefined;
export declare const addCacheItems: <T extends PlainObjectType, TQueryFnData extends InfiniteData<InfiniteQueryResultType<T>, unknown> | QueryResultType<T> = InfiniteData<InfiniteQueryResultType<T>, unknown> | QueryResultType<T>, TQueryKey extends QueryKey = readonly unknown[]>(queryClient: QueryClient, filters: QueryFilters<TQueryKey>, item: T, sorting?: {
    by?: string;
    descending?: boolean;
}) => T | void;
export declare const updateCacheItem: <T extends PlainObjectType>(queryClient: QueryClient, key: QueryKey, select: number | ((item: T) => boolean) | undefined, fnUpdater: (item: T) => void) => T | void;
export declare const updateCacheItems: <T extends PlainObjectType>(queryClient: QueryClient, filters: QueryFilters, select: number | ((item: T) => boolean) | undefined, fnUpdater: (item: T) => void) => T | void;
export declare const removeCacheItem: <T extends PlainObjectType>(queryClient: QueryClient, key: QueryKey, select: number | ((item: T) => boolean)) => T | void;
export declare const removeCacheItems: <T extends PlainObjectType>(queryClient: QueryClient, filters: QueryFilters, select: number | ((item: T) => boolean)) => T | void;
export declare const updateCacheItemCount: <T extends PlainObjectType>(queryClient: QueryClient, key: QueryKey, fnUpdater: (count: number) => number) => T | void;
export declare const updateCacheItemsCount: <T extends PlainObjectType>(queryClient: QueryClient, filters: QueryFilters, fnUpdater: (count: number) => number) => T | void;
export declare function keepPages(queryClient: QueryClient | undefined, queryKey: QueryKey, options?: SetDataOptions, pagesLength?: number): void;
/**
 * Get a pending/placeholder item from (infinite) data in query cache (pending messages are identified by negative ids).
 *
 * @param {QueryClient} queryClient
 * @param {QueryKey} queryKey
 * @param {boolean} oldest - true to return the oldest pending item, false to return the most recent.
 */
export declare function getPendingCacheItem<T extends MsgType>(queryClient: QueryClient, queryKey: QueryKey, oldest: boolean): T | null | undefined;
/**
 * Get item with specified id from (infinite) data in query cache.
 *
 * @param {QueryClient} queryClient
 * @param {QueryKey} queryKey
 * @param {number} id - id of the item to find.
 */
export declare function getCacheItem<T extends PlainObjectType>(queryClient: QueryClient, queryKey: QueryKey, id: number): T | null | undefined;
/**
 * Flattens a paged infinite query result to an array.
 *
 * @param data Infinite query result data
 * @returns Flattened Array of the infinite query paged result
 */
export declare function getFlatInfiniteResultData<T extends PlainObjectType>(data: InfiniteData<InfiniteQueryResultType<T>, unknown> | undefined): T[];
/**
 * Checks if infinite query result is empty.
 *
 * @param data Infinite query result data
 * @returns boolean
 */
export declare function isInfiniteResultDataEmpty<T extends PlainObjectType>(data: InfiniteData<InfiniteQueryResultType<T>, unknown> | undefined): boolean;
//# sourceMappingURL=query-cache.d.ts.map