1 | import type { ApolloClient, DefaultOptions, OperationVariables, WatchQueryFetchPolicy } from "../../core/index.js";
|
2 | import { ApolloError } from "../../errors/index.js";
|
3 | import type { ApolloQueryResult, ObservableQuery, DocumentNode, TypedDocumentNode, WatchQueryOptions } from "../../core/index.js";
|
4 | import type { QueryHookOptions, QueryResult, ObservableQueryFields, NoInfer } from "../types/types.js";
|
5 | import { useApolloClient } from "./useApolloClient.js";
|
6 | type InternalQueryResult<TData, TVariables extends OperationVariables> = Omit<QueryResult<TData, TVariables>, Exclude<keyof ObservableQueryFields<TData, TVariables>, "variables">>;
|
7 | export declare const lastWatchOptions: unique symbol;
|
8 | export interface ObsQueryWithMeta<TData, TVariables extends OperationVariables> extends ObservableQuery<TData, TVariables> {
|
9 | [lastWatchOptions]?: WatchQueryOptions<TVariables, TData>;
|
10 | }
|
11 | export interface InternalResult<TData, TVariables extends OperationVariables> {
|
12 | current?: undefined | InternalQueryResult<TData, TVariables>;
|
13 | previousData?: undefined | TData;
|
14 | }
|
15 | interface InternalState<TData, TVariables extends OperationVariables> {
|
16 | client: ReturnType<typeof useApolloClient>;
|
17 | query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
18 | observable: ObsQueryWithMeta<TData, TVariables>;
|
19 | resultData: InternalResult<TData, TVariables>;
|
20 | }
|
21 | export type UpdateInternalState<TData, TVariables extends OperationVariables> = (state: InternalState<TData, TVariables>) => void;
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | export declare function useQuery<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): QueryResult<TData, TVariables>;
|
57 | export declare function useQueryInternals<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): {
|
58 | result: InternalQueryResult<TData, TVariables> | InternalQueryResult<any, TVariables>;
|
59 | obsQueryFields: Omit<ObservableQueryFields<TData, TVariables>, "variables">;
|
60 | observable: ObsQueryWithMeta<TData, TVariables>;
|
61 | resultData: InternalResult<TData, TVariables>;
|
62 | client: ApolloClient<object>;
|
63 | onQueryExecuted: (watchQueryOptions: WatchQueryOptions<TVariables, TData>) => void;
|
64 | };
|
65 | export declare function createMakeWatchQueryOptions<TData = any, TVariables extends OperationVariables = OperationVariables>(client: ApolloClient<object>, query: DocumentNode | TypedDocumentNode<TData, TVariables>, { skip, ssr, onCompleted, onError, defaultOptions, ...otherOptions }: QueryHookOptions<TData, TVariables> | undefined, isSyncSSR: boolean): (observable?: ObservableQuery<TData, TVariables>) => WatchQueryOptions<TVariables, TData>;
|
66 | export declare function getObsQueryOptions<TData, TVariables extends OperationVariables>(observable: ObservableQuery<TData, TVariables> | undefined, client: ApolloClient<object>, queryHookOptions: QueryHookOptions<TData, TVariables>, watchQueryOptions: Partial<WatchQueryOptions<TVariables, TData>>): WatchQueryOptions<TVariables, TData>;
|
67 | export declare function getDefaultFetchPolicy<TData, TVariables extends OperationVariables>(queryHookDefaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>, clientDefaultOptions?: DefaultOptions): WatchQueryFetchPolicy;
|
68 | export declare function toApolloError<TData>(result: Pick<ApolloQueryResult<TData>, "errors" | "error">): ApolloError | undefined;
|
69 | export declare function toQueryResult<TData, TVariables extends OperationVariables>(result: ApolloQueryResult<TData>, previousData: TData | undefined, observable: ObservableQuery<TData, TVariables>, client: ApolloClient<object>): InternalQueryResult<TData, TVariables>;
|
70 | export {};
|
71 |
|
\ | No newline at end of file |