1 | import type { ApolloClient, ApolloQueryResult, DocumentNode, OperationVariables, TypedDocumentNode, FetchMoreQueryOptions, WatchQueryOptions } from "../../core/index.js";
|
2 | import { ApolloError, NetworkStatus } from "../../core/index.js";
|
3 | import type { DeepPartial } from "../../utilities/index.js";
|
4 | import type { SuspenseQueryHookOptions, ObservableQueryFields, NoInfer } from "../types/types.js";
|
5 | import type { SkipToken } from "./constants.js";
|
6 | export interface UseSuspenseQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
7 | client: ApolloClient<any>;
|
8 | data: TData;
|
9 | error: ApolloError | undefined;
|
10 | fetchMore: FetchMoreFunction<TData, TVariables>;
|
11 | networkStatus: NetworkStatus;
|
12 | refetch: RefetchFunction<TData, TVariables>;
|
13 | subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
14 | }
|
15 | export type FetchMoreFunction<TData, TVariables extends OperationVariables> = (fetchMoreOptions: FetchMoreQueryOptions<TVariables, TData> & {
|
16 | updateQuery?: (previousQueryResult: TData, options: {
|
17 | fetchMoreResult: TData;
|
18 | variables: TVariables;
|
19 | }) => TData;
|
20 | }) => Promise<ApolloQueryResult<TData>>;
|
21 | export type RefetchFunction<TData, TVariables extends OperationVariables> = ObservableQueryFields<TData, TVariables>["refetch"];
|
22 | export type SubscribeToMoreFunction<TData, TVariables extends OperationVariables> = ObservableQueryFields<TData, TVariables>["subscribeToMore"];
|
23 | export declare function useSuspenseQuery<TData, TVariables extends OperationVariables, TOptions extends Omit<SuspenseQueryHookOptions<TData>, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & TOptions): UseSuspenseQueryResult<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? TOptions["skip"] extends boolean ? DeepPartial<TData> | undefined : DeepPartial<TData> : TOptions["skip"] extends boolean ? TData | undefined : TData, TVariables>;
|
24 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
25 | returnPartialData: true;
|
26 | errorPolicy: "ignore" | "all";
|
27 | }): UseSuspenseQueryResult<DeepPartial<TData> | undefined, TVariables>;
|
28 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
29 | errorPolicy: "ignore" | "all";
|
30 | }): UseSuspenseQueryResult<TData | undefined, TVariables>;
|
31 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
32 | skip: boolean;
|
33 | returnPartialData: true;
|
34 | }): UseSuspenseQueryResult<DeepPartial<TData> | undefined, TVariables>;
|
35 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
36 | returnPartialData: true;
|
37 | }): UseSuspenseQueryResult<DeepPartial<TData>, TVariables>;
|
38 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
39 | skip: boolean;
|
40 | }): UseSuspenseQueryResult<TData | undefined, TVariables>;
|
41 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): UseSuspenseQueryResult<TData, TVariables>;
|
42 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
|
43 | returnPartialData: true;
|
44 | })): UseSuspenseQueryResult<DeepPartial<TData> | undefined, TVariables>;
|
45 | export declare function useSuspenseQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SkipToken | SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>): UseSuspenseQueryResult<TData | undefined, TVariables>;
|
46 | export declare function toApolloError(result: ApolloQueryResult<any>): ApolloError | undefined;
|
47 | interface UseWatchQueryOptionsHookOptions<TData, TVariables extends OperationVariables> {
|
48 | client: ApolloClient<unknown>;
|
49 | query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
50 | options: SkipToken | SuspenseQueryHookOptions<TData, TVariables>;
|
51 | }
|
52 | export declare function useWatchQueryOptions<TData, TVariables extends OperationVariables>({ client, query, options, }: UseWatchQueryOptionsHookOptions<TData, TVariables>): WatchQueryOptions<TVariables, TData>;
|
53 | export {};
|
54 |
|
\ | No newline at end of file |