1 | import type { DocumentNode, GraphQLFormattedError } from "graphql";
|
2 | import type { ApolloCache } from "../cache/index.js";
|
3 | import type { FetchResult } from "../link/core/index.js";
|
4 | import type { ApolloError } from "../errors/index.js";
|
5 | import type { QueryInfo } from "./QueryInfo.js";
|
6 | import type { NetworkStatus } from "./networkStatus.js";
|
7 | import type { Resolver } from "./LocalState.js";
|
8 | import type { ObservableQuery } from "./ObservableQuery.js";
|
9 | import type { QueryOptions } from "./watchQueryOptions.js";
|
10 | import type { Cache } from "../cache/index.js";
|
11 | import type { IsStrictlyAny } from "../utilities/index.js";
|
12 | export type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
13 | export type MethodKeys<T> = {
|
14 | [P in keyof T]: T[P] extends Function ? P : never;
|
15 | }[keyof T];
|
16 | export interface DefaultContext extends Record<string, any> {
|
17 | }
|
18 | export type QueryListener = (queryInfo: QueryInfo) => void;
|
19 | export type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache.DiffResult<any>, lastDiff: Cache.DiffResult<any> | undefined) => boolean | TResult;
|
20 | export type RefetchQueryDescriptor = string | DocumentNode;
|
21 | export type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions;
|
22 | type RefetchQueriesIncludeShorthand = "all" | "active";
|
23 | export type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
|
24 | export type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand;
|
25 | export interface RefetchQueriesOptions<TCache extends ApolloCache<any>, TResult> {
|
26 | updateCache?: (cache: TCache) => void;
|
27 | include?: RefetchQueriesInclude;
|
28 | optimistic?: boolean;
|
29 | onQueryUpdated?: OnQueryUpdated<TResult> | null;
|
30 | }
|
31 | export type RefetchQueriesPromiseResults<TResult> = IsStrictlyAny<TResult> extends true ? any[] : TResult extends boolean ? ApolloQueryResult<any>[] : TResult extends PromiseLike<infer U> ? U[] : TResult[];
|
32 | export interface RefetchQueriesResult<TResult> extends Promise<RefetchQueriesPromiseResults<TResult>> {
|
33 | queries: ObservableQuery<any>[];
|
34 | results: InternalRefetchQueriesResult<TResult>[];
|
35 | }
|
36 | export interface InternalRefetchQueriesOptions<TCache extends ApolloCache<any>, TResult> extends Omit<RefetchQueriesOptions<TCache, TResult>, "include"> {
|
37 | include?: InternalRefetchQueriesInclude;
|
38 | removeOptimistic?: string;
|
39 | }
|
40 | export type InternalRefetchQueriesResult<TResult> = TResult extends boolean ? Promise<ApolloQueryResult<any>> : TResult;
|
41 | export type InternalRefetchQueriesMap<TResult> = Map<ObservableQuery<any>, InternalRefetchQueriesResult<TResult>>;
|
42 | export type { QueryOptions as PureQueryOptions };
|
43 | export type OperationVariables = Record<string, any>;
|
44 | export interface ApolloQueryResult<T> {
|
45 | data: T;
|
46 | |
47 |
|
48 |
|
49 |
|
50 | errors?: ReadonlyArray<GraphQLFormattedError>;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 | error?: ApolloError;
|
57 | loading: boolean;
|
58 | networkStatus: NetworkStatus;
|
59 | partial?: boolean;
|
60 | }
|
61 | export type MutationQueryReducer<T> = (previousResult: Record<string, any>, options: {
|
62 | mutationResult: FetchResult<T>;
|
63 | queryName: string | undefined;
|
64 | queryVariables: Record<string, any>;
|
65 | }) => Record<string, any>;
|
66 | export type MutationQueryReducersMap<T = {
|
67 | [key: string]: any;
|
68 | }> = {
|
69 | [queryName: string]: MutationQueryReducer<T>;
|
70 | };
|
71 |
|
72 |
|
73 |
|
74 | export type MutationUpdaterFn<T = {
|
75 | [key: string]: any;
|
76 | }> = (cache: ApolloCache<T>, mutationResult: FetchResult<T>) => void;
|
77 | export type MutationUpdaterFunction<TData, TVariables, TContext, TCache extends ApolloCache<any>> = (cache: TCache, result: Omit<FetchResult<TData>, "context">, options: {
|
78 | context?: TContext;
|
79 | variables?: TVariables;
|
80 | }) => void;
|
81 | export interface Resolvers {
|
82 | [key: string]: {
|
83 | [field: string]: Resolver;
|
84 | };
|
85 | }
|
86 |
|
\ | No newline at end of file |