@graphql-tools/executor
Version:
Fork of GraphQL.js' execute function
39 lines (38 loc) • 1.77 kB
text/typescript
import type { FieldNode, FragmentDefinitionNode, GraphQLObjectType, GraphQLSchema, SelectionSetNode } from 'graphql';
import { Path } from '@graphql-tools/utils';
export interface DeferUsage {
label: string | undefined;
parentDeferUsage: DeferUsage | undefined;
depth: number;
}
export interface FieldDetails {
node: FieldNode;
deferUsage: DeferUsage | undefined;
}
export type FieldGroup = ReadonlyArray<FieldDetails>;
export type GroupedFieldSet = ReadonlyMap<string, FieldGroup> & {
encounteredDefer?: boolean;
};
/**
* Given a selectionSet, collects all of the fields and returns them.
*
* CollectFields requires the "runtime type" of an object. For a field that
* returns an Interface or Union type, the "runtime type" will be the actual
* object type returned by that field.
*
* @internal
*/
export declare function collectFields<TVariables = any>(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode, errorOnSubscriptionWithIncrementalDelivery: boolean): GroupedFieldSet;
/**
* Given an array of field nodes, collects all of the subfields of the passed
* in fields, and returns them at the end.
*
* CollectSubFields requires the "return type" of an object. For a field that
* returns an Interface or Union type, the "return type" will be the actual
* object type returned by that field.
*
* @internal
*/
export declare function collectSubfields(schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: {
[variable: string]: unknown;
}, errorOnSubscriptionWithIncrementalDelivery: boolean, returnType: GraphQLObjectType, fieldGroup: FieldGroup, path: Path): GroupedFieldSet;