1 | import { Mutation } from './mutation';
|
2 | import { Query } from './query';
|
3 | import { EnsuredQueryKey } from './types';
|
4 | import { MutationFunction, MutationKey, MutationOptions, QueryFunction, QueryKey, QueryOptions } from './types';
|
5 | export interface QueryFilters {
|
6 | |
7 |
|
8 |
|
9 | active?: boolean;
|
10 | |
11 |
|
12 |
|
13 | exact?: boolean;
|
14 | |
15 |
|
16 |
|
17 | inactive?: boolean;
|
18 | |
19 |
|
20 |
|
21 | predicate?: (query: Query) => boolean;
|
22 | |
23 |
|
24 |
|
25 | queryKey?: QueryKey;
|
26 | |
27 |
|
28 |
|
29 | stale?: boolean;
|
30 | |
31 |
|
32 |
|
33 | fetching?: boolean;
|
34 | }
|
35 | export interface MutationFilters {
|
36 | |
37 |
|
38 |
|
39 | exact?: boolean;
|
40 | |
41 |
|
42 |
|
43 | predicate?: (mutation: Mutation<any, any, any>) => boolean;
|
44 | |
45 |
|
46 |
|
47 | mutationKey?: MutationKey;
|
48 | |
49 |
|
50 |
|
51 | fetching?: boolean;
|
52 | }
|
53 | export declare type DataUpdateFunction<TInput, TOutput> = (input: TInput) => TOutput;
|
54 | export declare type Updater<TInput, TOutput> = TOutput | DataUpdateFunction<TInput, TOutput>;
|
55 | export declare type QueryStatusFilter = 'all' | 'active' | 'inactive' | 'none';
|
56 | export declare const isServer: boolean;
|
57 | export declare function noop(): undefined;
|
58 | export declare function functionalUpdate<TInput, TOutput>(updater: Updater<TInput, TOutput>, input: TInput): TOutput;
|
59 | export declare function isValidTimeout(value: unknown): value is number;
|
60 | export declare function ensureQueryKeyArray<T extends QueryKey>(value: T): EnsuredQueryKey<T>;
|
61 | export declare function difference<T>(array1: T[], array2: T[]): T[];
|
62 | export declare function replaceAt<T>(array: T[], index: number, value: T): T[];
|
63 | export declare function timeUntilStale(updatedAt: number, staleTime?: number): number;
|
64 | export declare function parseQueryArgs<TOptions extends QueryOptions<any, any, any, TQueryKey>, TQueryKey extends QueryKey = QueryKey>(arg1: TQueryKey | TOptions, arg2?: QueryFunction<any, TQueryKey> | TOptions, arg3?: TOptions): TOptions;
|
65 | export declare function parseMutationArgs<TOptions extends MutationOptions<any, any, any, any>>(arg1: MutationKey | MutationFunction<any, any> | TOptions, arg2?: MutationFunction<any, any> | TOptions, arg3?: TOptions): TOptions;
|
66 | export declare function parseFilterArgs<TFilters extends QueryFilters, TOptions = unknown>(arg1?: QueryKey | TFilters, arg2?: TFilters | TOptions, arg3?: TOptions): [TFilters, TOptions | undefined];
|
67 | export declare function parseMutationFilterArgs(arg1?: QueryKey | MutationFilters, arg2?: MutationFilters): MutationFilters | undefined;
|
68 | export declare function mapQueryStatusFilter(active?: boolean, inactive?: boolean): QueryStatusFilter;
|
69 | export declare function matchQuery(filters: QueryFilters, query: Query<any, any, any, any>): boolean;
|
70 | export declare function matchMutation(filters: MutationFilters, mutation: Mutation<any, any>): boolean;
|
71 | export declare function hashQueryKeyByOptions<TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, options?: QueryOptions<any, any, any, TQueryKey>): string;
|
72 | /**
|
73 | * Default query keys hash function.
|
74 | */
|
75 | export declare function hashQueryKey(queryKey: QueryKey): string;
|
76 | /**
|
77 | * Hashes the value into a stable hash.
|
78 | */
|
79 | export declare function stableValueHash(value: any): string;
|
80 | /**
|
81 | * Checks if key `b` partially matches with key `a`.
|
82 | */
|
83 | export declare function partialMatchKey(a: QueryKey, b: QueryKey): boolean;
|
84 | /**
|
85 | * Checks if `b` partially matches with `a`.
|
86 | */
|
87 | export declare function partialDeepEqual(a: any, b: any): boolean;
|
88 | /**
|
89 | * This function returns `a` if `b` is deeply equal.
|
90 | * If not, it will replace any deeply equal children of `b` with those of `a`.
|
91 | * This can be used for structural sharing between JSON values for example.
|
92 | */
|
93 | export declare function replaceEqualDeep<T>(a: unknown, b: T): T;
|
94 | /**
|
95 | * Shallow compare objects. Only works with objects that always have the same properties.
|
96 | */
|
97 | export declare function shallowEqualObjects<T>(a: T, b: T): boolean;
|
98 | export declare function isPlainObject(o: any): o is Object;
|
99 | export declare function isQueryKey(value: any): value is QueryKey;
|
100 | export declare function isError(value: any): value is Error;
|
101 | export declare function sleep(timeout: number): Promise<void>;
|
102 | /**
|
103 | * Schedules a microtask.
|
104 | * This can be useful to schedule state updates after rendering.
|
105 | */
|
106 | export declare function scheduleMicrotask(callback: () => void): void;
|
107 | export declare function getAbortController(): AbortController | undefined;
|
108 |
|
\ | No newline at end of file |