graphql
Version:
A Query Language and Runtime which can target any service.
66 lines (65 loc) • 2.81 kB
text/typescript
import type { ObjMap, ReadOnlyObjMap } from "../jsutils/ObjMap.mjs";
import type { DirectiveNode, FieldNode, FragmentDefinitionNode, SelectionSetNode, ValueNode } from "../language/ast.mjs";
import type { GraphQLObjectType } from "../type/definition.mjs";
import type { GraphQLSchema } from "../type/schema.mjs";
import type { GraphQLVariableSignature } from "./getVariableSignature.mjs";
import type { VariableValues } from "./values.mjs";
/** @internal */
export interface DeferUsage {
label: string | undefined;
parentDeferUsage: DeferUsage | undefined;
}
/** @internal */
export interface FragmentVariableValues {
readonly sources: ReadOnlyObjMap<FragmentVariableValueSource>;
readonly coerced: ReadOnlyObjMap<unknown>;
}
/** @internal */
export interface FragmentVariableValueSource {
readonly signature: GraphQLVariableSignature;
readonly value?: ValueNode;
readonly fragmentVariableValues?: FragmentVariableValues;
}
/** @internal */
export interface FieldDetails {
node: FieldNode;
deferUsage?: DeferUsage | undefined;
fragmentVariableValues?: FragmentVariableValues | undefined;
}
/** @internal */
export type FieldDetailsList = ReadonlyArray<FieldDetails>;
/** @internal */
export type GroupedFieldSet = ReadonlyMap<string, FieldDetailsList>;
/** @internal */
export interface FragmentDetails {
definition: FragmentDefinitionNode;
variableSignatures?: ObjMap<GraphQLVariableSignature> | undefined;
}
/**
* 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(schema: GraphQLSchema, fragments: ObjMap<FragmentDetails>, variableValues: VariableValues, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode, hideSuggestions: boolean, forbidSkipAndInclude?: boolean): {
groupedFieldSet: GroupedFieldSet;
newDeferUsages: ReadonlyArray<DeferUsage>;
forbiddenDirectiveInstances: ReadonlyArray<DirectiveNode>;
};
/**
* 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: ObjMap<FragmentDetails>, variableValues: VariableValues, returnType: GraphQLObjectType, fieldDetailsList: FieldDetailsList, hideSuggestions: boolean): {
groupedFieldSet: GroupedFieldSet;
newDeferUsages: ReadonlyArray<DeferUsage>;
};