1 | import { NetworkStatus } from "./networkStatus.js";
|
2 | import type { Concast, Observer, ObservableSubscription } from "../utilities/index.js";
|
3 | import { Observable } from "../utilities/index.js";
|
4 | import { ApolloError } from "../errors/index.js";
|
5 | import type { QueryManager } from "./QueryManager.js";
|
6 | import type { ApolloQueryResult, OperationVariables, TypedDocumentNode } from "./types.js";
|
7 | import type { WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions } from "./watchQueryOptions.js";
|
8 | import type { QueryInfo } from "./QueryInfo.js";
|
9 | import type { MissingFieldError } from "../cache/index.js";
|
10 | import type { MissingTree } from "../cache/core/types/common.js";
|
11 | export interface FetchMoreOptions<TData = any, TVariables = OperationVariables> {
|
12 | updateQuery?: (previousQueryResult: TData, options: {
|
13 | fetchMoreResult?: TData;
|
14 | variables?: TVariables;
|
15 | }) => TData;
|
16 | }
|
17 | export interface UpdateQueryOptions<TVariables> {
|
18 | variables?: TVariables;
|
19 | }
|
20 | export declare class ObservableQuery<TData = any, TVariables extends OperationVariables = OperationVariables> extends Observable<ApolloQueryResult<TData>> {
|
21 | readonly options: WatchQueryOptions<TVariables, TData>;
|
22 | readonly queryId: string;
|
23 | readonly queryName?: string;
|
24 | get query(): TypedDocumentNode<TData, TVariables>;
|
25 | |
26 |
|
27 |
|
28 | get variables(): TVariables | undefined;
|
29 | private isTornDown;
|
30 | private queryManager;
|
31 | private observers;
|
32 | private subscriptions;
|
33 | private waitForOwnResult;
|
34 | private last?;
|
35 | private lastQuery?;
|
36 | private queryInfo;
|
37 | private concast?;
|
38 | private observer?;
|
39 | private pollingInfo?;
|
40 | constructor({ queryManager, queryInfo, options, }: {
|
41 | queryManager: QueryManager<any>;
|
42 | queryInfo: QueryInfo;
|
43 | options: WatchQueryOptions<TVariables, TData>;
|
44 | });
|
45 | result(): Promise<ApolloQueryResult<TData>>;
|
46 | /** @internal */
|
47 | resetDiff(): void;
|
48 | getCurrentResult(saveAsLastResult?: boolean): ApolloQueryResult<TData>;
|
49 | isDifferentFromLastResult(newResult: ApolloQueryResult<TData>, variables?: TVariables): boolean | undefined;
|
50 | private getLast;
|
51 | getLastResult(variablesMustMatch?: boolean): ApolloQueryResult<TData> | undefined;
|
52 | getLastError(variablesMustMatch?: boolean): ApolloError | undefined;
|
53 | resetLastResults(): void;
|
54 | resetQueryStoreErrors(): void;
|
55 | /**
|
56 | * Update the variables of this observable query, and fetch the new results.
|
57 | * This method should be preferred over `setVariables` in most use cases.
|
58 | *
|
59 | * @param variables - The new set of variables. If there are missing variables,
|
60 | * the previous values of those variables will be used.
|
61 | */
|
62 | refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
|
63 | /**
|
64 | * A function that helps you fetch the next set of results for a [paginated list field](https:
|
65 | */
|
66 | fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
67 | updateQuery?: (previousQueryResult: TData, options: {
|
68 | fetchMoreResult: TFetchData;
|
69 | variables: TFetchVars;
|
70 | }) => TData;
|
71 | }): Promise<ApolloQueryResult<TFetchData>>;
|
72 | |
73 |
|
74 |
|
75 |
|
76 |
|
77 | subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
|
78 | setOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): Promise<ApolloQueryResult<TData>>;
|
79 | silentSetOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): void;
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | setVariables(variables: TVariables): Promise<ApolloQueryResult<TData> | void>;
|
99 | |
100 |
|
101 |
|
102 |
|
103 |
|
104 | updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
|
105 | |
106 |
|
107 |
|
108 | startPolling(pollInterval: number): void;
|
109 | |
110 |
|
111 |
|
112 | stopPolling(): void;
|
113 | private applyNextFetchPolicy;
|
114 | private fetch;
|
115 | private updatePolling;
|
116 | private updateLastResult;
|
117 | reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
|
118 | reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
|
119 | resubscribeAfterError(onNext: (value: ApolloQueryResult<TData>) => void, onError?: (error: any) => void, onComplete?: () => void): ObservableSubscription;
|
120 | resubscribeAfterError(observer: Observer<ApolloQueryResult<TData>>): ObservableSubscription;
|
121 | private observe;
|
122 | private reportResult;
|
123 | private reportError;
|
124 | hasObservers(): boolean;
|
125 | private tearDownQuery;
|
126 | private transformDocument;
|
127 | }
|
128 | export declare function reobserveCacheFirst<TData, TVars extends OperationVariables>(obsQuery: ObservableQuery<TData, TVars>): Promise<ApolloQueryResult<TData>>;
|
129 | export declare function logMissingFieldErrors(missing: MissingFieldError[] | MissingTree | undefined): void;
|
130 |
|
\ | No newline at end of file |