1 | import type { GraphQLFormattedError } from "graphql";
|
2 | import type { DocumentNode } from "graphql";
|
3 | import type { DefaultContext } from "../../core/index.js";
|
4 | export type { DocumentNode };
|
5 | import type { Observable } from "../../utilities/index.js";
|
6 | export type Path = ReadonlyArray<string | number>;
|
7 | interface ExecutionPatchResultBase {
|
8 | hasNext?: boolean;
|
9 | }
|
10 | export interface ExecutionPatchInitialResult<TData = Record<string, any>, TExtensions = Record<string, any>> extends ExecutionPatchResultBase {
|
11 | data: TData | null | undefined;
|
12 | incremental?: never;
|
13 | errors?: ReadonlyArray<GraphQLFormattedError>;
|
14 | extensions?: TExtensions;
|
15 | }
|
16 | export interface IncrementalPayload<TData, TExtensions> {
|
17 | data: TData | null;
|
18 | label?: string;
|
19 | path: Path;
|
20 | errors?: ReadonlyArray<GraphQLFormattedError>;
|
21 | extensions?: TExtensions;
|
22 | }
|
23 | export interface ExecutionPatchIncrementalResult<TData = Record<string, any>, TExtensions = Record<string, any>> extends ExecutionPatchResultBase {
|
24 | incremental?: IncrementalPayload<TData, TExtensions>[];
|
25 | data?: never;
|
26 | errors?: never;
|
27 | extensions?: never;
|
28 | }
|
29 | export interface ApolloPayloadResult<TData = Record<string, any>, TExtensions = Record<string, any>> {
|
30 | payload: SingleExecutionResult | ExecutionPatchResult | null;
|
31 | errors?: ReadonlyArray<Error | string>;
|
32 | }
|
33 | export type ExecutionPatchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = ExecutionPatchInitialResult<TData, TExtensions> | ExecutionPatchIncrementalResult<TData, TExtensions>;
|
34 | export interface GraphQLRequest<TVariables = Record<string, any>> {
|
35 | query: DocumentNode;
|
36 | variables?: TVariables;
|
37 | operationName?: string;
|
38 | context?: DefaultContext;
|
39 | extensions?: Record<string, any>;
|
40 | }
|
41 | export interface Operation {
|
42 | query: DocumentNode;
|
43 | variables: Record<string, any>;
|
44 | operationName: string;
|
45 | extensions: Record<string, any>;
|
46 | setContext: {
|
47 | (context: Partial<DefaultContext>): void;
|
48 | (updateContext: (previousContext: DefaultContext) => Partial<DefaultContext>): void;
|
49 | };
|
50 | getContext: () => DefaultContext;
|
51 | }
|
52 | export interface SingleExecutionResult<TData = Record<string, any>, TContext = DefaultContext, TExtensions = Record<string, any>> {
|
53 | data?: TData | null;
|
54 | context?: TContext;
|
55 | errors?: ReadonlyArray<GraphQLFormattedError>;
|
56 | extensions?: TExtensions;
|
57 | }
|
58 | export type FetchResult<TData = Record<string, any>, TContext = Record<string, any>, TExtensions = Record<string, any>> = SingleExecutionResult<TData, TContext, TExtensions> | ExecutionPatchResult<TData, TExtensions>;
|
59 | export type NextLink = (operation: Operation) => Observable<FetchResult>;
|
60 | export type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;
|
61 |
|
\ | No newline at end of file |