@graphql-tools/utils
- Version 10.6.4
- Published
- 512 kB
- 4 dependencies
- MIT license
Install
npm i @graphql-tools/utils
yarn add @graphql-tools/utils
pnpm add @graphql-tools/utils
Overview
Common package containing utils and types for GraphQL tools
Index
Variables
Functions
- addPath()
- addTypes()
- appendObjectFields()
- asArray()
- assertSome()
- astFromArg()
- astFromDirective()
- astFromEnumType()
- astFromEnumValue()
- astFromField()
- astFromInputField()
- astFromInputObjectType()
- astFromInterfaceType()
- astFromObjectType()
- astFromScalarType()
- astFromSchema()
- astFromUnionType()
- astFromValueUntyped()
- buildOperationNodeForField()
- collectComment()
- collectFields()
- collectSubFields()
- compareNodes()
- compareStrings()
- correctASTNodes()
- createDefaultRules()
- createDeferred()
- createGraphQLError()
- createNamedStub()
- createStub()
- createVariableNameGenerator()
- debugTimerEnd()
- debugTimerStart()
- dedentBlockStringValue()
- doesFragmentConditionMatch()
- extractExtensionsFromSchema()
- fakePromise()
- fakeRejectPromise()
- filterSchema()
- fixSchemaAst()
- forEachDefaultValue()
- forEachField()
- getArgumentsWithDirectives()
- getArgumentValues()
- getAsyncIterableWithCancel()
- getAsyncIteratorWithCancel()
- getBuiltInForStub()
- getComment()
- getDeferValues()
- getDefinedRootType()
- getDescription()
- getDirective()
- getDirectiveExtensions()
- getDirectiveInExtensions()
- getDirectiveNodes()
- getDirectives()
- getDirectivesInExtensions()
- getDocumentNodeFromSchema()
- getFieldEntryKey()
- getFieldsWithDirectives()
- getImplementingTypes()
- getLeadingCommentBlock()
- getOperationASTFromDocument()
- getOperationASTFromRequest()
- getResolversFromSchema()
- getResponseKeyFromInfo()
- getRootTypeMap()
- getRootTypeNames()
- getRootTypes()
- hasOwnProperty()
- healSchema()
- healTypes()
- implementsAbstractType()
- isAsyncIterable()
- isDescribable()
- isDocumentNode()
- isDocumentString()
- isIterableObject()
- isNamedStub()
- isObjectLike()
- isPromise()
- isSome()
- isValidPath()
- makeDeprecatedDirective()
- makeDirectiveNode()
- makeDirectiveNodes()
- mapAsyncIterator()
- mapMaybePromise()
- mapSchema()
- memoize1()
- memoize2()
- memoize2of4()
- memoize2of5()
- memoize3()
- memoize4()
- memoize5()
- mergeDeep()
- mergeIncrementalResult()
- modifyObjectFields()
- nodeToString()
- observableToAsyncIterable()
- parseGraphQLJSON()
- parseGraphQLSDL()
- parseInputValue()
- parseInputValueLiteral()
- parseSelectionSet()
- pathToArray()
- printComment()
- printPathArray()
- printSchemaWithDirectives()
- printWithComments()
- promiseReduce()
- pruneSchema()
- pushComment()
- relocatedError()
- removeObjectFields()
- renameType()
- resetComments()
- rewireTypes()
- selectObjectFields()
- serializeInputValue()
- shouldIncludeNode()
- transformCommentsToDescriptions()
- transformInputValue()
- updateArgument()
- validateGraphQlDocuments()
- valueMatchesCriteria()
- visitData()
- visitErrors()
- visitResult()
- withCancel()
Interfaces
SchemaMapper
- [MapperKind.ABSTRACT_TYPE]
- [MapperKind.ARGUMENT]
- [MapperKind.COMPOSITE_FIELD]
- [MapperKind.COMPOSITE_TYPE]
- [MapperKind.DIRECTIVE]
- [MapperKind.ENUM_TYPE]
- [MapperKind.ENUM_VALUE]
- [MapperKind.FIELD]
- [MapperKind.INPUT_OBJECT_FIELD]
- [MapperKind.INPUT_OBJECT_TYPE]
- [MapperKind.INTERFACE_FIELD]
- [MapperKind.INTERFACE_TYPE]
- [MapperKind.MUTATION_ROOT_FIELD]
- [MapperKind.MUTATION]
- [MapperKind.OBJECT_FIELD]
- [MapperKind.OBJECT_TYPE]
- [MapperKind.QUERY_ROOT_FIELD]
- [MapperKind.QUERY]
- [MapperKind.ROOT_FIELD]
- [MapperKind.ROOT_OBJECT]
- [MapperKind.SCALAR_TYPE]
- [MapperKind.SUBSCRIPTION_ROOT_FIELD]
- [MapperKind.SUBSCRIPTION]
- [MapperKind.TYPE]
- [MapperKind.UNION_TYPE]
Enums
Type Aliases
- AbstractTypeMapper
- ArgumentFilter
- ArgumentMapper
- ArgumentToDirectives
- ASTVisitorKeyMap
- AsyncExecutor
- BaseLoaderOptions
- Callback
- CompositeTypeMapper
- Constructor
- DirectableASTNode
- DirectableGraphQLObject
- DirectableObject
- DirectiveArgs
- DirectiveFilter
- DirectiveLocationEnum
- DirectiveMapper
- DirectiveUsage
- DisposableAsyncExecutor
- DisposableExecutor
- DisposableSyncExecutor
- ElementOf
- EnumTypeExtensions
- EnumTypeMapper
- EnumValueFilter
- EnumValueMapper
- ErrorVisitor
- ErrorVisitorMap
- Executor
- ExtensionsObject
- FieldFilter
- FieldMapper
- FieldNodeMapper
- FieldNodeMappers
- Force
- GenericFieldMapper
- IDefaultValueIteratorFn
- IEnumTypeResolver
- IFieldIteratorFn
- IFieldResolver
- Ignore
- IInputObjectTypeResolver
- IInterfaceTypeResolver
- InputFieldFilter
- InputFieldMapper
- InputLeafValueTransformer
- InputObjectTypeMapper
- InputObjectValueTransformer
- InputTypeExtensions
- InterfaceTypeExtensions
- InterfaceTypeMapper
- IObjectTypeResolver
- IResolvers
- IScalarTypeResolver
- ISchemaLevelResolver
- IUnionTypeResolver
- Maybe
- MaybeAsyncIterable
- MaybePromise
- NamedDefinitionNode
- NamedTypeMapper
- NextResolverFn
- ObjectFieldFilter
- ObjectTypeExtensions
- ObjectTypeMapper
- ObjectValueVisitor
- PossibleTypeExtensions
- PrintSchemaWithDirectivesOptions
- PruneSchemaFilter
- RenameTypesOptions
- ResultVisitorMap
- RootFieldFilter
- ScalarTypeExtensions
- ScalarTypeMapper
- SchemaExtensions
- SchemaFieldMapperTypes
- SelectedFields
- Skip
- SyncExecutor
- TypeAndFieldToArgumentDirectives
- TypeAndFieldToDirectives
- TypeFilter
- TypeSource
- UnionTypeExtensions
- UnionTypeMapper
- ValidationRule
- ValidatorBehavior
- ValueVisitor
- VisitableSchemaType
- WithList
Variables
variable GraphQLDeferDirective
const GraphQLDeferDirective: GraphQLDirective;
Used to conditionally defer fragments.
variable GraphQLStreamDirective
const GraphQLStreamDirective: GraphQLDirective;
Used to conditionally stream list fields.
variable T
const T: any;
Functions
function addPath
addPath: ( prev: Readonly<Path> | undefined, key: string | number, typename: string | undefined) => Path;
Given a Path and a key, return a new Path containing the new key.
function addTypes
addTypes: ( schema: GraphQLSchema, newTypesOrDirectives: Array<GraphQLNamedType | GraphQLDirective>) => GraphQLSchema;
function appendObjectFields
appendObjectFields: ( schema: GraphQLSchema, typeName: string, additionalFields: GraphQLFieldConfigMap<any, any>) => GraphQLSchema;
function asArray
asArray: <T>(fns: T | T[]) => T[];
function assertSome
assertSome: <T>(input: T, message?: string) => asserts input is Exclude<T, null>;
function astFromArg
astFromArg: ( arg: GraphQLArgument, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => InputValueDefinitionNode;
function astFromDirective
astFromDirective: ( directive: GraphQLDirective, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => DirectiveDefinitionNode;
function astFromEnumType
astFromEnumType: ( type: GraphQLEnumType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => EnumTypeDefinitionNode;
function astFromEnumValue
astFromEnumValue: ( value: GraphQLEnumValue, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => EnumValueDefinitionNode;
function astFromField
astFromField: ( field: GraphQLField<any, any>, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => FieldDefinitionNode;
function astFromInputField
astFromInputField: ( field: GraphQLInputField, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => InputValueDefinitionNode;
function astFromInputObjectType
astFromInputObjectType: ( type: GraphQLInputObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => InputObjectTypeDefinitionNode;
function astFromInterfaceType
astFromInterfaceType: ( type: GraphQLInterfaceType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => InterfaceTypeDefinitionNode;
function astFromObjectType
astFromObjectType: ( type: GraphQLObjectType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => ObjectTypeDefinitionNode;
function astFromScalarType
astFromScalarType: ( type: GraphQLScalarType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => ScalarTypeDefinitionNode;
function astFromSchema
astFromSchema: ( schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => SchemaDefinitionNode | SchemaExtensionNode | null;
function astFromUnionType
astFromUnionType: ( type: GraphQLUnionType, schema: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => UnionTypeDefinitionNode;
function astFromValueUntyped
astFromValueUntyped: (value: any) => ValueNode | null;
Produces a GraphQL Value AST given a JavaScript object. Function will match JavaScript/JSON values to GraphQL AST schema format by using the following mapping.
| JSON Value | GraphQL Value | | ------------- | -------------------- | | Object | Input Object | | Array | List | | Boolean | Boolean | | String | String | | Number | Int / Float | | BigInt | Int | | null | NullValue |
function buildOperationNodeForField
buildOperationNodeForField: ({ schema, kind, field, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields,}: { schema: GraphQLSchema; kind: OperationTypeNode; field: string; models?: string[]; ignore?: Ignore; depthLimit?: number; circularReferenceDepth?: number; argNames?: string[]; selectedFields?: SelectedFields;}) => OperationDefinitionNode;
function collectComment
collectComment: (node: NamedDefinitionNode) => void;
function collectFields
collectFields: <TVariables = any>( schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: TVariables, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode) => FieldsAndPatches;
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.
function collectSubFields
collectSubFields: ( schema: GraphQLSchema, fragments: Record<string, FragmentDefinitionNode>, variableValues: { [variable: string]: unknown }, returnType: GraphQLObjectType, fieldNodes: Array<FieldNode>) => FieldsAndPatches;
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.
function compareNodes
compareNodes: ( a: ASTNode, b: ASTNode, customFn?: (a: any, b: any) => number) => number;
function compareStrings
compareStrings: <A, B>(a: A, b: B) => 0 | 1 | -1;
function correctASTNodes
correctASTNodes: { (type: GraphQLObjectType): GraphQLObjectType; (type: GraphQLInterfaceType): GraphQLInterfaceType; (type: GraphQLInputObjectType): GraphQLInputObjectType; (type: GraphQLEnumType): GraphQLEnumType;};
function createDefaultRules
createDefaultRules: () => import('graphql').ValidationRule[];
function createDeferred
createDeferred: <T>() => PromiseWithResolvers<T>;
function createGraphQLError
createGraphQLError: ( message: string, options?: GraphQLErrorOptions) => GraphQLError;
function createNamedStub
createNamedStub: { (name: string, type: 'object'): GraphQLObjectType; (name: string, type: 'interface'): GraphQLInterfaceType; (name: string, type: 'input'): GraphQLInputObjectType;};
function createStub
createStub: { (node: TypeNode, type: 'output'): GraphQLOutputType; (node: TypeNode, type: 'input'): GraphQLInputType; (node: TypeNode, type: 'input' | 'output'): GraphQLType;};
function createVariableNameGenerator
createVariableNameGenerator: ( variableDefinitionMap: Record<string, VariableDefinitionNode>) => (argName: string) => string;
function debugTimerEnd
debugTimerEnd: (name: string) => void;
function debugTimerStart
debugTimerStart: (name: string) => void;
function dedentBlockStringValue
dedentBlockStringValue: (rawString: string) => string;
function doesFragmentConditionMatch
doesFragmentConditionMatch: ( schema: GraphQLSchema, fragment: FragmentDefinitionNode | InlineFragmentNode, type: GraphQLObjectType) => boolean;
Determines if a fragment is applicable to the given type.
function extractExtensionsFromSchema
extractExtensionsFromSchema: ( schema: GraphQLSchema, removeDirectives?: boolean) => SchemaExtensions;
function fakePromise
fakePromise: { (): any; <T>(value: T): Promise<T>; (value: void): Promise<void>;};
function fakeRejectPromise
fakeRejectPromise: (error: unknown) => Promise<never>;
function filterSchema
filterSchema: ({ schema, typeFilter, fieldFilter, rootFieldFilter, objectFieldFilter, interfaceFieldFilter, inputObjectFieldFilter, argumentFilter, directiveFilter, enumValueFilter,}: { schema: GraphQLSchema; rootFieldFilter?: RootFieldFilter; typeFilter?: TypeFilter; fieldFilter?: FieldFilter; objectFieldFilter?: FieldFilter; interfaceFieldFilter?: FieldFilter; inputObjectFieldFilter?: FieldFilter; argumentFilter?: ArgumentFilter; directiveFilter?: DirectiveFilter; enumValueFilter?: EnumValueFilter;}) => GraphQLSchema;
function fixSchemaAst
fixSchemaAst: ( schema: GraphQLSchema, options: BuildSchemaOptions & SchemaPrintOptions) => GraphQLSchema;
function forEachDefaultValue
forEachDefaultValue: ( schema: GraphQLSchema, fn: IDefaultValueIteratorFn) => void;
function forEachField
forEachField: (schema: GraphQLSchema, fn: IFieldIteratorFn) => void;
function getArgumentsWithDirectives
getArgumentsWithDirectives: ( documentNode: DocumentNode) => TypeAndFieldToArgumentDirectives;
function getArgumentValues
getArgumentValues: ( def: GraphQLField<any, any> | GraphQLDirective, node: FieldNode | DirectiveNode, variableValues?: Record<string, any>) => Record<string, any>;
Prepares an object map of argument values given a list of argument definitions and list of argument AST nodes.
Note: The returned value is a plain Object with a prototype, since it is exposed to user code. Care should be taken to not pull values from the Object prototype.
function getAsyncIterableWithCancel
getAsyncIterableWithCancel: < T, TAsyncIterable extends AsyncIterable<T>, TReturn = any>( asyncIterable: TAsyncIterable, onCancel: (value?: TReturn) => void | Promise<void>) => TAsyncIterable;
function getAsyncIteratorWithCancel
getAsyncIteratorWithCancel: <T, TReturn = any>( asyncIterator: AsyncIterator<T>, onCancel: (value?: TReturn) => void | Promise<void>) => AsyncIterator<T>;
function getBuiltInForStub
getBuiltInForStub: (type: GraphQLNamedType) => GraphQLNamedType;
function getComment
getComment: (node: { loc?: Location }) => undefined | string;
function getDeferValues
getDeferValues: ( variableValues: any, node: FragmentSpreadNode | InlineFragmentNode) => undefined | { label: string | undefined };
Returns an object containing the
@defer
arguments if a field should be deferred based on the experimental flag, defer directive present and not disabled by the "if" argument.
function getDefinedRootType
getDefinedRootType: ( schema: GraphQLSchema, operation: OperationTypeNode, nodes?: ASTNode[]) => GraphQLObjectType;
function getDescription
getDescription: ( node: { description?: StringValueNode; loc?: Location }, options?: { commentDescriptions?: boolean }) => string | undefined;
function getDirective
getDirective: ( schema: GraphQLSchema, node: DirectableGraphQLObject, directiveName: string, pathToDirectivesInExtensions?: string[]) => Array<Record<string, any>> | undefined;
function getDirectiveExtensions
getDirectiveExtensions: < TDirectiveAnnotationsMap extends { [directiveName: string]: { [paramName: string]: any }; }>( directableObj: DirectableObject, schema?: GraphQLSchema, pathToDirectivesInExtensions?: string[]) => { [directiveName in keyof TDirectiveAnnotationsMap]?: TDirectiveAnnotationsMap[directiveName][];};
function getDirectiveInExtensions
getDirectiveInExtensions: ( node: DirectableGraphQLObject, directiveName: string, pathToDirectivesInExtensions?: string[]) => Array<Record<string, any>> | undefined;
function getDirectiveNodes
getDirectiveNodes: <TDirectiveNode extends DirectiveNode>( entity: DirectableGraphQLObject & { deprecationReason?: string | null; specifiedByUrl?: string | null; specifiedByURL?: string | null; }, schema?: GraphQLSchema, pathToDirectivesInExtensions?: Array<string>) => Array<TDirectiveNode>;
function getDirectives
getDirectives: ( schema: GraphQLSchema, node: DirectableGraphQLObject, pathToDirectivesInExtensions?: string[]) => Array<DirectiveAnnotation>;
function getDirectivesInExtensions
getDirectivesInExtensions: ( node: DirectableGraphQLObject, pathToDirectivesInExtensions?: string[]) => Array<DirectiveAnnotation>;
function getDocumentNodeFromSchema
getDocumentNodeFromSchema: ( schema: GraphQLSchema, options?: GetDocumentNodeFromSchemaOptions) => DocumentNode;
function getFieldEntryKey
getFieldEntryKey: (node: FieldNode) => string;
Implements the logic to compute the key of a given field's entry
function getFieldsWithDirectives
getFieldsWithDirectives: ( documentNode: DocumentNode, options?: Options) => TypeAndFieldToDirectives;
function getImplementingTypes
getImplementingTypes: (interfaceName: string, schema: GraphQLSchema) => string[];
function getLeadingCommentBlock
getLeadingCommentBlock: (node: { loc?: Location }) => void | string;
function getOperationASTFromDocument
getOperationASTFromDocument: ( documentNode: DocumentNode, operationName?: string) => OperationDefinitionNode;
function getOperationASTFromRequest
getOperationASTFromRequest: ( request: ExecutionRequest) => OperationDefinitionNode;
function getResolversFromSchema
getResolversFromSchema: ( schema: GraphQLSchema, includeDefaultMergedResolver?: boolean) => IResolvers;
function getResponseKeyFromInfo
getResponseKeyFromInfo: (info: GraphQLResolveInfo) => string;
Get the key under which the result of this resolver will be placed in the response JSON. Basically, just resolves aliases.
Parameter info
The info argument to the resolver.
function getRootTypeMap
getRootTypeMap: ( schema: GraphQLSchema) => Map<OperationTypeNode, GraphQLObjectType>;
function getRootTypeNames
getRootTypeNames: (schema: GraphQLSchema) => Set<string>;
function getRootTypes
getRootTypes: (schema: GraphQLSchema) => Set<GraphQLObjectType>;
function hasOwnProperty
hasOwnProperty: (obj: unknown, prop: string) => boolean;
function healSchema
healSchema: (schema: GraphQLSchema) => GraphQLSchema;
function healTypes
healTypes: ( originalTypeMap: Record<string, GraphQLNamedType | null>, directives: ReadonlyArray<GraphQLDirective>) => void;
function implementsAbstractType
implementsAbstractType: ( schema: GraphQLSchema, typeA: GraphQLType, typeB: GraphQLType) => boolean;
function isAsyncIterable
isAsyncIterable: <T>(value: any) => value is AsyncIterable<T>;
function isDescribable
isDescribable: (node: ASTNode) => node is any;
function isDocumentNode
isDocumentNode: (object: any) => object is DocumentNode;
function isDocumentString
isDocumentString: (str: any) => boolean;
function isIterableObject
isIterableObject: (value: unknown) => value is Iterable<unknown>;
function isNamedStub
isNamedStub: (type: GraphQLNamedType) => boolean;
function isObjectLike
isObjectLike: (value: unknown) => value is { [key: string]: unknown };
function isPromise
isPromise: <T>(value: any) => value is PromiseLike<T>;
function isSome
isSome: <T>(input: T) => input is Exclude<T, null>;
function isValidPath
isValidPath: (str: any) => boolean;
Checkes whether the
str
contains any path illegal characters.A string may sometimes look like a path but is not (like an SDL of a simple GraphQL schema). To make sure we don't yield false-positives in such cases, we disallow new lines in paths (even though most Unix systems support new lines in file names).
function makeDeprecatedDirective
makeDeprecatedDirective: <TDirectiveNode extends DirectiveNode>( deprecationReason: string) => TDirectiveNode;
function makeDirectiveNode
makeDirectiveNode: <TDirectiveNode extends DirectiveNode>( name: string, args?: Record<string, any>, directive?: GraphQLDirective) => TDirectiveNode;
function makeDirectiveNodes
makeDirectiveNodes: <TDirectiveNode extends DirectiveNode>( schema: GraphQLSchema, directiveValues: DirectiveAnnotation[]) => Array<TDirectiveNode>;
function mapAsyncIterator
mapAsyncIterator: <T, U>( iterator: AsyncIterable<T> | AsyncIterator<T>, onNext: (value: T) => MaybePromise<U>, onError?: any, onEnd?: () => MaybePromise<void>) => AsyncIterableIterator<U>;
Given an AsyncIterable and a callback function, return an AsyncIterator which produces values mapped via calling the callback function.
function mapMaybePromise
mapMaybePromise: <T, R>( value: MaybePromise<T>, mapper: (v: T) => MaybePromise<R>, errorMapper?: (e: any) => MaybePromise<R>) => MaybePromise<R>;
function mapSchema
mapSchema: (schema: GraphQLSchema, schemaMapper?: SchemaMapper) => GraphQLSchema;
function memoize1
memoize1: <F extends (a1: any) => any>(fn: F) => F;
function memoize2
memoize2: <F extends (a1: any, a2: any) => any>(fn: F) => F;
function memoize2of4
memoize2of4: <F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F) => F;
function memoize2of5
memoize2of5: <F extends (a1: any, a2: any, a3: any, a4: any, a5: any) => any>( fn: F) => F;
function memoize3
memoize3: <F extends (a1: any, a2: any, a3: any) => any>(fn: F) => F;
function memoize4
memoize4: <F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F) => F;
function memoize5
memoize5: <F extends (a1: any, a2: any, a3: any, a4: any, a5: any) => any>( fn: F) => F;
function mergeDeep
mergeDeep: <S extends any[]>( sources: S, respectPrototype?: boolean, respectArrays?: boolean, respectArrayLength?: boolean) => UnboxIntersection<UnionToIntersection<BoxedTupleTypes<S>>> & any;
function mergeIncrementalResult
mergeIncrementalResult: ({ incrementalResult, executionResult,}: { incrementalResult: ExecutionResult; executionResult: ExecutionResult;}) => void;
function modifyObjectFields
modifyObjectFields: ( schema: GraphQLSchema, typeName: string, testFn: (fieldName: string, field: GraphQLFieldConfig<any, any>) => boolean, newFields: GraphQLFieldConfigMap<any, any>) => [GraphQLSchema, GraphQLFieldConfigMap<any, any>];
function nodeToString
nodeToString: (a: ASTNode) => string;
function observableToAsyncIterable
observableToAsyncIterable: <T>( observable: Observable<T>) => AsyncIterableIterator<T>;
function parseGraphQLJSON
parseGraphQLJSON: ( location: string, jsonContent: string, options: SchemaPrintOptions & ParseOptions) => Source;
function parseGraphQLSDL
parseGraphQLSDL: ( location: string | undefined, rawSDL: string, options?: GraphQLParseOptions) => { location: string | undefined; document: DocumentNode };
function parseInputValue
parseInputValue: (type: GraphQLInputType, value: any) => any;
function parseInputValueLiteral
parseInputValueLiteral: (type: GraphQLInputType, value: any) => any;
function parseSelectionSet
parseSelectionSet: ( selectionSet: string, options?: GraphQLParseOptions) => SelectionSetNode;
function pathToArray
pathToArray: (path: Maybe<Readonly<Path>>) => Array<string | number>;
Given a Path, return an Array of the path keys.
function printComment
printComment: (comment: string) => string;
function printPathArray
printPathArray: (path: ReadonlyArray<string | number>) => string;
Build a string describing the path.
function printSchemaWithDirectives
printSchemaWithDirectives: ( schema: GraphQLSchema, options?: PrintSchemaWithDirectivesOptions) => string;
function printWithComments
printWithComments: (ast: ASTNode) => string;
Converts an AST into a string, using one set of reasonable formatting rules.
function promiseReduce
promiseReduce: <T, U>( values: Iterable<T>, callbackFn: (accumulator: U, currentValue: T) => MaybePromise<U>, initialValue: MaybePromise<U>) => MaybePromise<U>;
function pruneSchema
pruneSchema: ( schema: GraphQLSchema, options?: PruneSchemaOptions) => GraphQLSchema;
Prunes the provided schema, removing unused and empty types
Parameter schema
The schema to prune
Parameter options
Additional options for removing unused types from the schema
function pushComment
pushComment: ( node: any, entity: string, field?: string, argument?: string) => void;
function relocatedError
relocatedError: ( originalError: GraphQLError, path?: ReadonlyArray<string | number>) => GraphQLError;
function removeObjectFields
removeObjectFields: ( schema: GraphQLSchema, typeName: string, testFn: (fieldName: string, field: GraphQLFieldConfig<any, any>) => boolean) => [GraphQLSchema, GraphQLFieldConfigMap<any, any>];
function renameType
renameType: { (type: GraphQLObjectType, newTypeName: string): GraphQLObjectType; (type: GraphQLInterfaceType, newTypeName: string): GraphQLInterfaceType; (type: GraphQLUnionType, newTypeName: string): GraphQLUnionType; (type: GraphQLEnumType, newTypeName: string): GraphQLEnumType; (type: GraphQLScalarType, newTypeName: string): GraphQLScalarType; (type: GraphQLInputObjectType, newTypeName: string): GraphQLInputObjectType; (type: GraphQLNamedType, newTypeName: string): GraphQLNamedType;};
function resetComments
resetComments: () => void;
function rewireTypes
rewireTypes: ( originalTypeMap: Record<string, GraphQLNamedType | null>, directives: ReadonlyArray<GraphQLDirective>) => { typeMap: Record<string, GraphQLNamedType>; directives: Array<GraphQLDirective>;};
function selectObjectFields
selectObjectFields: ( schema: GraphQLSchema, typeName: string, testFn: (fieldName: string, field: GraphQLFieldConfig<any, any>) => boolean) => GraphQLFieldConfigMap<any, any>;
function serializeInputValue
serializeInputValue: (type: GraphQLInputType, value: any) => any;
function shouldIncludeNode
shouldIncludeNode: ( variableValues: any, node: FragmentSpreadNode | FieldNode | InlineFragmentNode) => boolean;
Determines if a field should be included based on the
@include
and@skip
directives, where@skip
has higher precedence than@include
.
function transformCommentsToDescriptions
transformCommentsToDescriptions: ( sourceSdl: string, options?: GraphQLParseOptions) => DocumentNode;
function transformInputValue
transformInputValue: ( type: GraphQLInputType, value: any, inputLeafValueTransformer?: Maybe<InputLeafValueTransformer>, inputObjectValueTransformer?: Maybe<InputObjectValueTransformer>) => any;
function updateArgument
updateArgument: ( argumentNodes: Record<string, ArgumentNode>, variableDefinitionsMap: Record<string, VariableDefinitionNode>, variableValues: Record<string, any>, argName: string, varName: string, type: GraphQLInputType, value: any) => void;
function validateGraphQlDocuments
validateGraphQlDocuments: ( schema: GraphQLSchema, documents: DocumentNode[], rules?: ValidationRule[]) => readonly import('graphql').GraphQLError[];
function valueMatchesCriteria
valueMatchesCriteria: (value: any, criteria: any) => boolean;
function visitData
visitData: (data: any, enter?: ValueVisitor, leave?: ValueVisitor) => any;
function visitErrors
visitErrors: ( errors: ReadonlyArray<GraphQLError>, visitor: (error: GraphQLError) => GraphQLError) => Array<GraphQLError>;
function visitResult
visitResult: ( result: ExecutionResult, request: ExecutionRequest, schema: GraphQLSchema, resultVisitorMap?: ResultVisitorMap, errorVisitorMap?: ErrorVisitorMap) => any;
function withCancel
withCancel: <T, TAsyncIterable extends AsyncIterable<T>, TReturn = any>( asyncIterable: TAsyncIterable, onCancel: (value?: TReturn) => void | Promise<void>) => TAsyncIterable;
Interfaces
interface DirectiveAnnotation
interface DirectiveAnnotation {}
interface ExecutionRequest
interface ExecutionRequest< TVariables extends Record<string, any> = any, TContext = any, TRootValue = any, TExtensions = Record<string, any>, TReturn = any> {}
property context
context?: TContext;
property document
document: TypedDocumentNode<TReturn, TVariables>;
property extensions
extensions?: TExtensions;
property info
info?: GraphQLResolveInfo;
property operationName
operationName?: string;
property operationType
operationType?: OperationTypeNode;
property rootValue
rootValue?: TRootValue;
property signal
signal?: AbortSignal;
property variables
variables?: TVariables;
interface ExecutionResult
interface ExecutionResult<TData = any, TExtensions = any> {}
The result of GraphQL execution.
-
errors
is included when any errors occurred as a non-empty array. -data
is the result of a successful execution of the query. -hasNext
is true if a future payload is expected. -extensions
is reserved for adding non-standard properties.
property data
data?: TData | null;
property errors
errors?: ReadonlyArray<GraphQLError>;
property extensions
extensions?: TExtensions;
property hasNext
hasNext?: boolean;
property incremental
incremental?: ReadonlyArray<ExecutionResult<TData, TExtensions>>;
property items
items?: TData | null;
property label
label?: string;
property path
path?: ReadonlyArray<string | number>;
interface FieldsAndPatches
interface FieldsAndPatches {}
interface GetDocumentNodeFromSchemaOptions
interface GetDocumentNodeFromSchemaOptions {}
property pathToDirectivesInExtensions
pathToDirectivesInExtensions?: Array<string>;
interface GraphQLParseOptions
interface GraphQLParseOptions {}
property allowLegacySDLEmptyFields
allowLegacySDLEmptyFields?: boolean;
property allowLegacySDLImplementsInterfaces
allowLegacySDLImplementsInterfaces?: boolean;
property commentDescriptions
commentDescriptions?: boolean;
Set to
true
in order to convert all GraphQL comments (marked with # sign) to descriptions (""") GraphQL has built-in support for transforming descriptions to comments (withprint
), but not while parsing. Turning the flag on will support the other way as well (parse
)
property experimentalFragmentVariables
experimentalFragmentVariables?: boolean;
property noLocation
noLocation?: boolean;
interface GraphQLResolveInfo
interface GraphQLResolveInfo extends OrigGraphQLResolveInfo {}
property signal
signal?: AbortSignal;
interface IAddResolversToSchemaOptions
interface IAddResolversToSchemaOptions {}
Configuration object for adding resolvers to a schema
property defaultFieldResolver
defaultFieldResolver?: IFieldResolver<any, any>;
Override the default field resolver provided by
graphql-js
property inheritResolversFromInterfaces
inheritResolversFromInterfaces?: boolean;
GraphQL object types that implement interfaces will inherit any missing resolvers from their interface types defined in the
resolvers
object
property resolvers
resolvers: IResolvers;
Object describing the field resolvers to add to the provided schema
property resolverValidationOptions
resolverValidationOptions?: IResolverValidationOptions;
Additional options for validating the provided resolvers
property schema
schema: GraphQLSchema;
The schema to which to add resolvers
property updateResolversInPlace
updateResolversInPlace?: boolean;
Set to
true
to modify the existing schema instead of creating a new one
interface IFieldResolverOptions
interface IFieldResolverOptions<TSource = any, TContext = any, TArgs = any> {}
property args
args?: Array<GraphQLArgument>;
property astNode
astNode?: FieldDefinitionNode;
property deprecationReason
deprecationReason?: string;
property description
description?: string;
property extensions
extensions?: Record<string, any>;
property isDeprecated
isDeprecated?: boolean;
property name
name?: string;
property resolve
resolve?: IFieldResolver<TSource, TContext, TArgs>;
property subscribe
subscribe?: IFieldResolver<TSource, TContext, TArgs>;
property type
type?: GraphQLOutputType;
interface IResolverValidationOptions
interface IResolverValidationOptions {}
Options for validating resolvers
property requireResolversForAllFields
requireResolversForAllFields?: ValidatorBehavior;
Enable to require a resolver for be defined for all fields defined in the schema. Defaults to
ignore
.
property requireResolversForArgs
requireResolversForArgs?: ValidatorBehavior;
Enable to require a resolver to be defined for any field that has arguments. Defaults to
ignore
.
property requireResolversForNonScalar
requireResolversForNonScalar?: ValidatorBehavior;
Enable to require a resolver to be defined for any field which has a return type that isn't a scalar. Defaults to
ignore
.
property requireResolversForResolveType
requireResolversForResolveType?: ValidatorBehavior;
Enable to require a
resolveType()
for Interface and Union types. Defaults toignore
.
property requireResolversToMatchSchema
requireResolversToMatchSchema?: ValidatorBehavior;
Enable to require all defined resolvers to match fields that actually exist in the schema. Defaults to
error
to catch common errors.
interface Loader
interface Loader<TOptions extends BaseLoaderOptions = BaseLoaderOptions> {}
interface Observable
interface Observable<T> {}
method subscribe
subscribe: (observer: Observer<T>) => { unsubscribe: () => void };
interface Observer
interface Observer<T> {}
interface PatchFields
interface PatchFields {}
interface Path
interface Path {}
interface PromiseWithResolvers
interface PromiseWithResolvers<T> {}
interface PruneSchemaOptions
interface PruneSchemaOptions {}
Options for removing unused types from the schema
property skipEmptyCompositeTypePruning
skipEmptyCompositeTypePruning?: boolean;
Set to
true
to skip pruning object types or interfaces with no no fields
property skipEmptyUnionPruning
skipEmptyUnionPruning?: boolean;
Set to
true
to skip pruning empty unions
property skipPruning
skipPruning?: PruneSchemaFilter;
Return true to skip pruning this type. This check will run first before any other options. This can be helpful for schemas that support type extensions like Apollo Federation.
property skipUnimplementedInterfacesPruning
skipUnimplementedInterfacesPruning?: boolean;
Set to
true
to skip pruning interfaces that are not implemented by any other types
property skipUnusedTypesPruning
skipUnusedTypesPruning?: boolean;
Set to
true
to skip pruning unused types
interface SchemaMapper
interface SchemaMapper {}
property [MapperKind.ABSTRACT_TYPE]
[MapperKind.ABSTRACT_TYPE]?: AbstractTypeMapper;
property [MapperKind.ARGUMENT]
[MapperKind.ARGUMENT]?: ArgumentMapper;
property [MapperKind.COMPOSITE_FIELD]
[MapperKind.COMPOSITE_FIELD]?: FieldMapper;
property [MapperKind.COMPOSITE_TYPE]
[MapperKind.COMPOSITE_TYPE]?: CompositeTypeMapper;
property [MapperKind.DIRECTIVE]
[MapperKind.DIRECTIVE]?: DirectiveMapper;
property [MapperKind.ENUM_TYPE]
[MapperKind.ENUM_TYPE]?: EnumTypeMapper;
property [MapperKind.ENUM_VALUE]
[MapperKind.ENUM_VALUE]?: EnumValueMapper;
property [MapperKind.FIELD]
[MapperKind.FIELD]?: GenericFieldMapper< GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig>;
property [MapperKind.INPUT_OBJECT_FIELD]
[MapperKind.INPUT_OBJECT_FIELD]?: InputFieldMapper;
property [MapperKind.INPUT_OBJECT_TYPE]
[MapperKind.INPUT_OBJECT_TYPE]?: InputObjectTypeMapper;
property [MapperKind.INTERFACE_FIELD]
[MapperKind.INTERFACE_FIELD]?: FieldMapper;
property [MapperKind.INTERFACE_TYPE]
[MapperKind.INTERFACE_TYPE]?: InterfaceTypeMapper;
property [MapperKind.MUTATION_ROOT_FIELD]
[MapperKind.MUTATION_ROOT_FIELD]?: FieldMapper;
property [MapperKind.MUTATION]
[MapperKind.MUTATION]?: ObjectTypeMapper;
property [MapperKind.OBJECT_FIELD]
[MapperKind.OBJECT_FIELD]?: FieldMapper;
property [MapperKind.OBJECT_TYPE]
[MapperKind.OBJECT_TYPE]?: ObjectTypeMapper;
property [MapperKind.QUERY_ROOT_FIELD]
[MapperKind.QUERY_ROOT_FIELD]?: FieldMapper;
property [MapperKind.QUERY]
[MapperKind.QUERY]?: ObjectTypeMapper;
property [MapperKind.ROOT_FIELD]
[MapperKind.ROOT_FIELD]?: FieldMapper;
property [MapperKind.ROOT_OBJECT]
[MapperKind.ROOT_OBJECT]?: ObjectTypeMapper;
property [MapperKind.SCALAR_TYPE]
[MapperKind.SCALAR_TYPE]?: ScalarTypeMapper;
property [MapperKind.SUBSCRIPTION_ROOT_FIELD]
[MapperKind.SUBSCRIPTION_ROOT_FIELD]?: FieldMapper;
property [MapperKind.SUBSCRIPTION]
[MapperKind.SUBSCRIPTION]?: ObjectTypeMapper;
property [MapperKind.TYPE]
[MapperKind.TYPE]?: NamedTypeMapper;
property [MapperKind.UNION_TYPE]
[MapperKind.UNION_TYPE]?: UnionTypeMapper;
interface SchemaPrintOptions
interface SchemaPrintOptions {}
property assumeValid
assumeValid?: boolean;
property commentDescriptions
commentDescriptions?: boolean;
Descriptions are defined as preceding string literals, however an older experimental version of the SDL supported preceding comments as descriptions. Set to true to enable this deprecated behavior. This option is provided to ease adoption and will be removed in v16.
Default: false
Enums
enum DirectiveLocation
enum DirectiveLocation { QUERY = 'QUERY', MUTATION = 'MUTATION', SUBSCRIPTION = 'SUBSCRIPTION', FIELD = 'FIELD', FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION', FRAGMENT_SPREAD = 'FRAGMENT_SPREAD', INLINE_FRAGMENT = 'INLINE_FRAGMENT', VARIABLE_DEFINITION = 'VARIABLE_DEFINITION', SCHEMA = 'SCHEMA', SCALAR = 'SCALAR', OBJECT = 'OBJECT', FIELD_DEFINITION = 'FIELD_DEFINITION', ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION', INTERFACE = 'INTERFACE', UNION = 'UNION', ENUM = 'ENUM', ENUM_VALUE = 'ENUM_VALUE', INPUT_OBJECT = 'INPUT_OBJECT', INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',}
member ARGUMENT_DEFINITION
ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION'
member ENUM
ENUM = 'ENUM'
member ENUM_VALUE
ENUM_VALUE = 'ENUM_VALUE'
member FIELD
FIELD = 'FIELD'
member FIELD_DEFINITION
FIELD_DEFINITION = 'FIELD_DEFINITION'
member FRAGMENT_DEFINITION
FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION'
member FRAGMENT_SPREAD
FRAGMENT_SPREAD = 'FRAGMENT_SPREAD'
member INLINE_FRAGMENT
INLINE_FRAGMENT = 'INLINE_FRAGMENT'
member INPUT_FIELD_DEFINITION
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION'
member INPUT_OBJECT
INPUT_OBJECT = 'INPUT_OBJECT'
member INTERFACE
INTERFACE = 'INTERFACE'
member MUTATION
MUTATION = 'MUTATION'
member OBJECT
OBJECT = 'OBJECT'
member QUERY
QUERY = 'QUERY'
Request Definitions
member SCALAR
SCALAR = 'SCALAR'
member SCHEMA
SCHEMA = 'SCHEMA'
Type System Definitions
member SUBSCRIPTION
SUBSCRIPTION = 'SUBSCRIPTION'
member UNION
UNION = 'UNION'
member VARIABLE_DEFINITION
VARIABLE_DEFINITION = 'VARIABLE_DEFINITION'
enum MapperKind
enum MapperKind { TYPE = 'MapperKind.TYPE', SCALAR_TYPE = 'MapperKind.SCALAR_TYPE', ENUM_TYPE = 'MapperKind.ENUM_TYPE', COMPOSITE_TYPE = 'MapperKind.COMPOSITE_TYPE', OBJECT_TYPE = 'MapperKind.OBJECT_TYPE', INPUT_OBJECT_TYPE = 'MapperKind.INPUT_OBJECT_TYPE', ABSTRACT_TYPE = 'MapperKind.ABSTRACT_TYPE', UNION_TYPE = 'MapperKind.UNION_TYPE', INTERFACE_TYPE = 'MapperKind.INTERFACE_TYPE', ROOT_OBJECT = 'MapperKind.ROOT_OBJECT', QUERY = 'MapperKind.QUERY', MUTATION = 'MapperKind.MUTATION', SUBSCRIPTION = 'MapperKind.SUBSCRIPTION', DIRECTIVE = 'MapperKind.DIRECTIVE', FIELD = 'MapperKind.FIELD', COMPOSITE_FIELD = 'MapperKind.COMPOSITE_FIELD', OBJECT_FIELD = 'MapperKind.OBJECT_FIELD', ROOT_FIELD = 'MapperKind.ROOT_FIELD', QUERY_ROOT_FIELD = 'MapperKind.QUERY_ROOT_FIELD', MUTATION_ROOT_FIELD = 'MapperKind.MUTATION_ROOT_FIELD', SUBSCRIPTION_ROOT_FIELD = 'MapperKind.SUBSCRIPTION_ROOT_FIELD', INTERFACE_FIELD = 'MapperKind.INTERFACE_FIELD', INPUT_OBJECT_FIELD = 'MapperKind.INPUT_OBJECT_FIELD', ARGUMENT = 'MapperKind.ARGUMENT', ENUM_VALUE = 'MapperKind.ENUM_VALUE',}
member ABSTRACT_TYPE
ABSTRACT_TYPE = 'MapperKind.ABSTRACT_TYPE'
member ARGUMENT
ARGUMENT = 'MapperKind.ARGUMENT'
member COMPOSITE_FIELD
COMPOSITE_FIELD = 'MapperKind.COMPOSITE_FIELD'
member COMPOSITE_TYPE
COMPOSITE_TYPE = 'MapperKind.COMPOSITE_TYPE'
member DIRECTIVE
DIRECTIVE = 'MapperKind.DIRECTIVE'
member ENUM_TYPE
ENUM_TYPE = 'MapperKind.ENUM_TYPE'
member ENUM_VALUE
ENUM_VALUE = 'MapperKind.ENUM_VALUE'
member FIELD
FIELD = 'MapperKind.FIELD'
member INPUT_OBJECT_FIELD
INPUT_OBJECT_FIELD = 'MapperKind.INPUT_OBJECT_FIELD'
member INPUT_OBJECT_TYPE
INPUT_OBJECT_TYPE = 'MapperKind.INPUT_OBJECT_TYPE'
member INTERFACE_FIELD
INTERFACE_FIELD = 'MapperKind.INTERFACE_FIELD'
member INTERFACE_TYPE
INTERFACE_TYPE = 'MapperKind.INTERFACE_TYPE'
member MUTATION
MUTATION = 'MapperKind.MUTATION'
member MUTATION_ROOT_FIELD
MUTATION_ROOT_FIELD = 'MapperKind.MUTATION_ROOT_FIELD'
member OBJECT_FIELD
OBJECT_FIELD = 'MapperKind.OBJECT_FIELD'
member OBJECT_TYPE
OBJECT_TYPE = 'MapperKind.OBJECT_TYPE'
member QUERY
QUERY = 'MapperKind.QUERY'
member QUERY_ROOT_FIELD
QUERY_ROOT_FIELD = 'MapperKind.QUERY_ROOT_FIELD'
member ROOT_FIELD
ROOT_FIELD = 'MapperKind.ROOT_FIELD'
member ROOT_OBJECT
ROOT_OBJECT = 'MapperKind.ROOT_OBJECT'
member SCALAR_TYPE
SCALAR_TYPE = 'MapperKind.SCALAR_TYPE'
member SUBSCRIPTION
SUBSCRIPTION = 'MapperKind.SUBSCRIPTION'
member SUBSCRIPTION_ROOT_FIELD
SUBSCRIPTION_ROOT_FIELD = 'MapperKind.SUBSCRIPTION_ROOT_FIELD'
member TYPE
TYPE = 'MapperKind.TYPE'
member UNION_TYPE
UNION_TYPE = 'MapperKind.UNION_TYPE'
Type Aliases
type AbstractTypeMapper
type AbstractTypeMapper = ( type: GraphQLInterfaceType | GraphQLUnionType, schema: GraphQLSchema) => GraphQLInterfaceType | GraphQLUnionType | null | undefined;
type ArgumentFilter
type ArgumentFilter = ( typeName?: string, fieldName?: string, argName?: string, argConfig?: GraphQLArgumentConfig) => boolean;
type ArgumentMapper
type ArgumentMapper = ( argumentConfig: GraphQLArgumentConfig, fieldName: string, typeName: string, schema: GraphQLSchema) => GraphQLArgumentConfig | [string, GraphQLArgumentConfig] | null | undefined;
type ArgumentToDirectives
type ArgumentToDirectives = { [argumentName: string]: DirectiveUsage[];};
type ASTVisitorKeyMap
type ASTVisitorKeyMap = Partial<Parameters<typeof visit>[2]>;
type AsyncExecutor
type AsyncExecutor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = < TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>( request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
type BaseLoaderOptions
type BaseLoaderOptions = GraphQLParseOptions & BuildSchemaOptions & { cwd?: string; ignore?: string | string[]; includeSources?: boolean; };
type Callback
type Callback = (value?: any) => any;
type CompositeTypeMapper
type CompositeTypeMapper = ( type: GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType, schema: GraphQLSchema) => GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | null | undefined;
type Constructor
type Constructor<T> = new (...args: any[]) => T;
type DirectableASTNode
type DirectableASTNode = ASTNode & { directives?: readonly DirectiveNode[] | undefined;};
type DirectableGraphQLObject
type DirectableGraphQLObject = DirectableObject;
type DirectableObject
type DirectableObject = { astNode?: DirectableASTNode | null | undefined; extensionASTNodes?: readonly DirectableASTNode[] | null | undefined; extensions?: | { directives?: Record<string, any> | undefined; } | null | undefined;};
type DirectiveArgs
type DirectiveArgs = { [name: string]: any;};
type DirectiveFilter
type DirectiveFilter = ( directiveName: string, directive: GraphQLDirective) => boolean;
type DirectiveLocationEnum
type DirectiveLocationEnum = typeof DirectiveLocation;
type DirectiveMapper
type DirectiveMapper = ( directive: GraphQLDirective, schema: GraphQLSchema) => GraphQLDirective | null | undefined;
type DirectiveUsage
type DirectiveUsage = { name: string; args: DirectiveArgs;};
type DisposableAsyncExecutor
type DisposableAsyncExecutor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = AsyncExecutor<TBaseContext, TBaseExtensions> & { [Symbol.asyncDispose]: () => PromiseLike<void>;};
type DisposableExecutor
type DisposableExecutor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = | DisposableSyncExecutor<TBaseContext, TBaseExtensions> | DisposableAsyncExecutor<TBaseContext, TBaseExtensions>;
type DisposableSyncExecutor
type DisposableSyncExecutor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = SyncExecutor<TBaseContext, TBaseExtensions> & { [Symbol.dispose]: () => void;};
type ElementOf
type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;
type EnumTypeExtensions
type EnumTypeExtensions = { type: 'enum'; values: Record<string, ExtensionsObject>;};
type EnumTypeMapper
type EnumTypeMapper = ( type: GraphQLEnumType, schema: GraphQLSchema) => GraphQLEnumType | null | undefined;
type EnumValueFilter
type EnumValueFilter = ( typeName: string, valueName: string, valueConfig: GraphQLEnumValueConfig) => boolean;
type EnumValueMapper
type EnumValueMapper = ( valueConfig: GraphQLEnumValueConfig, typeName: string, schema: GraphQLSchema, externalValue: string) => GraphQLEnumValueConfig | [string, GraphQLEnumValueConfig] | null | undefined;
type ErrorVisitor
type ErrorVisitor = (error: GraphQLError, pathIndex: number) => GraphQLError;
type ErrorVisitorMap
type ErrorVisitorMap = { __unpathed?: (error: GraphQLError) => GraphQLError;} & Record<string, Record<string, ErrorVisitor>>;
type Executor
type Executor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = < TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>( request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
type ExtensionsObject
type ExtensionsObject = Record<string, any>;
type FieldFilter
type FieldFilter = ( typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig) => boolean;
type FieldMapper
type FieldMapper = GenericFieldMapper<GraphQLFieldConfig<any, any>>;
type FieldNodeMapper
type FieldNodeMapper = ( fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>, transformationContext: Record<string, any>) => SelectionNode | Array<SelectionNode>;
type FieldNodeMappers
type FieldNodeMappers = Record<string, Record<string, FieldNodeMapper>>;
type Force
type Force = string[];
type GenericFieldMapper
type GenericFieldMapper< F extends GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig> = ( fieldConfig: F, fieldName: string, typeName: string, schema: GraphQLSchema) => F | [string, F] | null | undefined;
type IDefaultValueIteratorFn
type IDefaultValueIteratorFn = (type: GraphQLInputType, value: any) => void;
type IEnumTypeResolver
type IEnumTypeResolver = Record<string, any> & { __name?: string; __description?: string; __extensions?: Record<string, any>; __astNode?: EnumTypeDefinitionNode; __extensionASTNodes?: Array<EnumTypeExtensionNode>;};
type IFieldIteratorFn
type IFieldIteratorFn = ( fieldDef: GraphQLField<any, any>, typeName: string, fieldName: string) => void;
type IFieldResolver
type IFieldResolver< TSource, TContext, TArgs = Record<string, any>, TReturn = any> = ( source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TReturn;
type Ignore
type Ignore = string[];
type IInputObjectTypeResolver
type IInputObjectTypeResolver = { __name?: string; __description?: string; __extensions?: Record<string, any>; __astNode?: InputObjectTypeDefinitionNode; __extensionASTNodes?: Array<InputObjectTypeExtensionNode>;};
type IInterfaceTypeResolver
type IInterfaceTypeResolver<TSource = any, TContext = any, TArgs = any> = { [key: string]: | IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>;} & { __name?: string; __description?: string; __resolveType?: GraphQLTypeResolver<any, any>; __extensions?: Record<string, any>; __astNode?: InterfaceTypeDefinitionNode; __extensionASTNodes?: Array<InterfaceTypeExtensionNode>;};
type InputFieldFilter
type InputFieldFilter = ( typeName?: string, fieldName?: string, inputFieldConfig?: GraphQLInputFieldConfig) => boolean;
type InputFieldMapper
type InputFieldMapper = GenericFieldMapper<GraphQLInputFieldConfig>;
type InputLeafValueTransformer
type InputLeafValueTransformer = ( type: GraphQLEnumType | GraphQLScalarType, originalValue: any) => any;
type InputObjectTypeMapper
type InputObjectTypeMapper = ( type: GraphQLInputObjectType, schema: GraphQLSchema) => GraphQLInputObjectType | null | undefined;
type InputObjectValueTransformer
type InputObjectValueTransformer = ( type: GraphQLInputObjectType, originalValue: Record<string, any>) => Record<string, any>;
type InputTypeExtensions
type InputTypeExtensions = { type: 'input'; fields: Record< string, { extensions: ExtensionsObject; } >;};
type InterfaceTypeExtensions
type InterfaceTypeExtensions = { type: 'interface'; fields: Record< string, { extensions: ExtensionsObject; arguments: Record<string, ExtensionsObject>; } >;};
type InterfaceTypeMapper
type InterfaceTypeMapper = ( type: GraphQLInterfaceType, schema: GraphQLSchema) => GraphQLInterfaceType | null | undefined;
type IObjectTypeResolver
type IObjectTypeResolver<TSource = any, TContext = any, TArgs = any> = { [key: string]: | IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>;} & { __name?: string; __description?: string; __isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>; __extensions?: Record<string, any>; __astNode?: ObjectTypeDefinitionNode; __extensionASTNodes?: ObjectTypeExtensionNode;};
type IResolvers
type IResolvers< TSource = any, TContext = any, TArgs = Record<string, any>, TReturn = any> = Record< string, | ISchemaLevelResolver<TSource, TContext, TArgs, TReturn> | IObjectTypeResolver<TSource, TContext> | IInterfaceTypeResolver<TSource, TContext> | IUnionTypeResolver | IScalarTypeResolver | IEnumTypeResolver | IInputObjectTypeResolver>;
type IScalarTypeResolver
type IScalarTypeResolver = GraphQLScalarType & { __name?: string; __description?: string; __serialize?: GraphQLScalarSerializer<any>; __parseValue?: GraphQLScalarValueParser<any>; __parseLiteral?: GraphQLScalarLiteralParser<any>; __extensions?: Record<string, any>; __astNode?: ScalarTypeDefinitionNode; __extensionASTNodes?: Array<ScalarTypeExtensionNode>;};
type ISchemaLevelResolver
type ISchemaLevelResolver< TSource, TContext, TArgs = Record<string, any>, TReturn = any> = IFieldResolver<TSource, TContext, TArgs, TReturn>;
type IUnionTypeResolver
type IUnionTypeResolver = { __name?: string; __description?: string; __resolveType?: GraphQLTypeResolver<any, any>; __extensions?: Record<string, any>; __astNode?: UnionTypeDefinitionNode; __extensionASTNodes?: Array<UnionTypeExtensionNode>;};
type Maybe
type Maybe<T> = null | undefined | T;
type MaybeAsyncIterable
type MaybeAsyncIterable<T> = AsyncIterable<T> | T;
type MaybePromise
type MaybePromise<T> = PromiseLike<T> | T;
type NamedDefinitionNode
type NamedDefinitionNode = DefinitionNode & { name?: NameNode;};
type NamedTypeMapper
type NamedTypeMapper = ( type: GraphQLNamedType, schema: GraphQLSchema) => GraphQLNamedType | null | undefined;
type NextResolverFn
type NextResolverFn = () => Promise<any>;
type ObjectFieldFilter
type ObjectFieldFilter = ( typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => boolean;
type ObjectTypeExtensions
type ObjectTypeExtensions = { type: 'object'; fields: Record< string, { extensions: ExtensionsObject; arguments: Record<string, ExtensionsObject>; } >;};
type ObjectTypeMapper
type ObjectTypeMapper = ( type: GraphQLObjectType, schema: GraphQLSchema) => GraphQLObjectType | null | undefined;
type ObjectValueVisitor
type ObjectValueVisitor = { __enter?: ValueVisitor; __leave?: ValueVisitor;} & Record<string, ValueVisitor>;
type PossibleTypeExtensions
type PossibleTypeExtensions = | InputTypeExtensions | InterfaceTypeExtensions | ObjectTypeExtensions | UnionTypeExtensions | ScalarTypeExtensions | EnumTypeExtensions;
type PrintSchemaWithDirectivesOptions
type PrintSchemaWithDirectivesOptions = SchemaPrintOptions & GetDocumentNodeFromSchemaOptions;
type PruneSchemaFilter
type PruneSchemaFilter = (type: GraphQLNamedType) => boolean;
type RenameTypesOptions
type RenameTypesOptions = { renameBuiltins: boolean; renameScalars: boolean;};
type ResultVisitorMap
type ResultVisitorMap = Record<string, ValueVisitor | ObjectValueVisitor>;
type RootFieldFilter
type RootFieldFilter = ( operation: 'Query' | 'Mutation' | 'Subscription', rootFieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => boolean;
type ScalarTypeExtensions
type ScalarTypeExtensions = { type: 'scalar';};
type ScalarTypeMapper
type ScalarTypeMapper = ( type: GraphQLScalarType, schema: GraphQLSchema) => GraphQLScalarType | null | undefined;
type SchemaExtensions
type SchemaExtensions = { schemaExtensions: ExtensionsObject; types: Record< string, { extensions: ExtensionsObject; } & PossibleTypeExtensions >;};
type SchemaFieldMapperTypes
type SchemaFieldMapperTypes = Array< | MapperKind.FIELD | MapperKind.COMPOSITE_FIELD | MapperKind.OBJECT_FIELD | MapperKind.ROOT_FIELD | MapperKind.QUERY_ROOT_FIELD | MapperKind.MUTATION_ROOT_FIELD | MapperKind.SUBSCRIPTION_ROOT_FIELD | MapperKind.INTERFACE_FIELD | MapperKind.INPUT_OBJECT_FIELD>;
type SelectedFields
type SelectedFields = | { [key: string]: SelectedFields; } | boolean;
type Skip
type Skip = string[];
type SyncExecutor
type SyncExecutor< TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = < TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>( request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => ExecutionResult<TReturn>;
type TypeAndFieldToArgumentDirectives
type TypeAndFieldToArgumentDirectives = { [typeAndField: string]: ArgumentToDirectives;};
type TypeAndFieldToDirectives
type TypeAndFieldToDirectives = { [typeAndField: string]: DirectiveUsage[];};
type TypeFilter
type TypeFilter = (typeName: string, type: GraphQLType) => boolean;
type TypeSource
type TypeSource = | string | Source | DocumentNode | GraphQLSchema | DefinitionNode | Array<TypeSource> | (() => TypeSource);
type UnionTypeExtensions
type UnionTypeExtensions = { type: 'union';};
type UnionTypeMapper
type UnionTypeMapper = ( type: GraphQLUnionType, schema: GraphQLSchema) => GraphQLUnionType | null | undefined;
type ValidationRule
type ValidationRule = (context: ValidationContext) => ASTVisitor;
type ValidatorBehavior
type ValidatorBehavior = 'error' | 'warn' | 'ignore';
type ValueVisitor
type ValueVisitor = (value: any) => any;
type VisitableSchemaType
type VisitableSchemaType = | GraphQLSchema | GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType | GraphQLNamedType | GraphQLScalarType | GraphQLField<any, any> | GraphQLInputField | GraphQLArgument | GraphQLUnionType | GraphQLEnumType | GraphQLEnumValue;
type WithList
type WithList<T> = T | T[];
Package Files (59)
- typings/Interfaces.d.ts
- typings/Path.d.ts
- typings/addTypes.d.ts
- typings/astFromValueUntyped.d.ts
- typings/build-operation-for-field.d.ts
- typings/collectFields.d.ts
- typings/comments.d.ts
- typings/createDeferred.d.ts
- typings/debugTimer.d.ts
- typings/directives.d.ts
- typings/errors.d.ts
- typings/executor.d.ts
- typings/extractExtensionsFromSchema.d.ts
- typings/fakePromise.d.ts
- typings/fields.d.ts
- typings/filterSchema.d.ts
- typings/fixSchemaAst.d.ts
- typings/forEachDefaultValue.d.ts
- typings/forEachField.d.ts
- typings/get-arguments-with-directives.d.ts
- typings/get-directives.d.ts
- typings/get-fields-with-directives.d.ts
- typings/get-implementing-types.d.ts
- typings/getArgumentValues.d.ts
- typings/getDirectiveExtensions.d.ts
- typings/getOperationASTFromRequest.d.ts
- typings/getResolversFromSchema.d.ts
- typings/getResponseKeyFromInfo.d.ts
- typings/heal.d.ts
- typings/helpers.d.ts
- typings/implementsAbstractType.d.ts
- typings/index.d.ts
- typings/isAsyncIterable.d.ts
- typings/isDocumentNode.d.ts
- typings/jsutils.d.ts
- typings/loaders.d.ts
- typings/map-maybe-promise.d.ts
- typings/mapAsyncIterator.d.ts
- typings/mapSchema.d.ts
- typings/memoize.d.ts
- typings/mergeDeep.d.ts
- typings/mergeIncrementalResult.d.ts
- typings/observableToAsyncIterable.d.ts
- typings/parse-graphql-json.d.ts
- typings/parse-graphql-sdl.d.ts
- typings/print-schema-with-directives.d.ts
- typings/prune.d.ts
- typings/renameType.d.ts
- typings/rewire.d.ts
- typings/rootTypes.d.ts
- typings/selectionSets.d.ts
- typings/stub.d.ts
- typings/transformInputValue.d.ts
- typings/types.d.ts
- typings/updateArgument.d.ts
- typings/validate-documents.d.ts
- typings/valueMatchesCriteria.d.ts
- typings/visitResult.d.ts
- typings/withCancel.d.ts
Dependencies (4)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@graphql-tools/utils
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@graphql-tools/utils)
- HTML<a href="https://www.jsdocs.io/package/@graphql-tools/utils"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7166 ms. - Missing or incorrect documentation? Open an issue for this package.