Documentation
API Reference
Packages
delegate

@graphql-tools/delegate

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

CreateProxyingResolverFn

Ƭ CreateProxyingResolverFn<TContext>: (options: ICreateProxyingResolverOptions<TContext>) => GraphQLFieldResolver<any, TContext>

Type parameters

NameType
TContextRecord<string, any>

Type declaration

▸ (options): GraphQLFieldResolver<any, TContext>

Parameters
NameType
optionsICreateProxyingResolverOptions<TContext>
Returns

GraphQLFieldResolver<any, TContext>

Defined in

packages/delegate/src/types.ts:141


Deferred

Ƭ Deferred<T>: PromiseWithResolvers<T>

Type parameters

NameType
Tunknown

Defined in

packages/delegate/src/leftOver.ts:5


DelegationPlanBuilder

Ƭ DelegationPlanBuilder: (schema: GraphQLSchema, sourceSubschema: Subschema<any, any, any, any>, variableValues: Record<string, any>, fragments: Record<string, FragmentDefinitionNode>, fieldNodes: FieldNode[]) => Map<Subschema, SelectionSetNode>[]

Type declaration

▸ (schema, sourceSubschema, variableValues, fragments, fieldNodes): Map<Subschema, SelectionSetNode>[]

Parameters
NameType
schemaGraphQLSchema
sourceSubschemaSubschema<any, any, any, any>
variableValuesRecord<string, any>
fragmentsRecord<string, FragmentDefinitionNode>
fieldNodesFieldNode[]
Returns

Map<Subschema, SelectionSetNode>[]

Defined in

packages/delegate/src/types.ts:108


MergedTypeResolver

Ƭ MergedTypeResolver<TContext>: (originalResult: any, context: TContext, info: GraphQLResolveInfo, subschema: Subschema<any, any, any, TContext>, selectionSet: SelectionSetNode, key: any | undefined, type: GraphQLOutputType) => any

Type parameters

NameType
TContextRecord<string, any>

Type declaration

▸ (originalResult, context, info, subschema, selectionSet, key, type): any

Parameters
NameType
originalResultany
contextTContext
infoGraphQLResolveInfo
subschemaSubschema<any, any, any, TContext>
selectionSetSelectionSetNode
keyany | undefined
typeGraphQLOutputType
Returns

any

Defined in

packages/delegate/src/types.ts:193


RequestTransform

Ƭ RequestTransform<T, TContext>: (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest

Type parameters

NameType
TRecord<string, any>
TContextRecord<any, string>

Type declaration

▸ (originalRequest, delegationContext, transformationContext): ExecutionRequest

Parameters
NameType
originalRequestExecutionRequest
delegationContextDelegationContext<TContext>
transformationContextT
Returns

ExecutionRequest

Defined in

packages/delegate/src/types.ts:28


ResultTransform

Ƭ ResultTransform<T, TContext>: (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult

Type parameters

NameType
TRecord<string, any>
TContextRecord<any, string>

Type declaration

▸ (originalResult, delegationContext, transformationContext): ExecutionResult

Parameters
NameType
originalResultExecutionResult
delegationContextDelegationContext<TContext>
transformationContextT
Returns

ExecutionResult

Defined in

packages/delegate/src/types.ts:33


SchemaTransform

Ƭ SchemaTransform<TContext>: (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>) => GraphQLSchema

Type parameters

NameType
TContextRecord<any, string>

Type declaration

▸ (originalWrappingSchema, subschemaConfig): GraphQLSchema

Parameters
NameType
originalWrappingSchemaGraphQLSchema
subschemaConfigSubschemaConfig<any, any, any, TContext>
Returns

GraphQLSchema

Defined in

packages/delegate/src/types.ts:24

Variables

PLAN_LEFT_OVER

Const PLAN_LEFT_OVER: typeof PLAN_LEFT_OVER

Defined in

packages/delegate/src/leftOver.ts:31


leftOverByDelegationPlan

Const leftOverByDelegationPlan: WeakMap<Map<Subschema<any, any, any, Record<string, any>>, SelectionSetNode>[], DelegationPlanLeftOver>

Defined in

packages/delegate/src/leftOver.ts:27

Functions

annotateExternalObject

annotateExternalObject<TContext>(object, errors, subschema, subschemaMap): ExternalObject

Type parameters

Name
TContext

Parameters

NameType
objectany
errorsGraphQLError[]
subschemaundefined | GraphQLSchema | SubschemaConfig<any, any, any, TContext>
subschemaMapRecord<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>

Returns

ExternalObject

Defined in

packages/delegate/src/mergeFields.ts:33


applySchemaTransforms

applySchemaTransforms(originalWrappingSchema, subschemaConfig): GraphQLSchema

Parameters

NameType
originalWrappingSchemaGraphQLSchema
subschemaConfigSubschemaConfig<any, any, any, any>

Returns

GraphQLSchema

Defined in

packages/delegate/src/applySchemaTransforms.ts:6


cloneSubschemaConfig

cloneSubschemaConfig(subschemaConfig): SubschemaConfig

Parameters

NameType
subschemaConfigSubschemaConfig<any, any, any, Record<string, any>>

Returns

SubschemaConfig

Defined in

packages/delegate/src/subschemaConfig.ts:7


createDefaultExecutor

createDefaultExecutor(schema): Executor

Parameters

NameType
schemaGraphQLSchema

Returns

Executor

Defined in

packages/delegate/src/delegateToSchema.ts:236


createDeferred

createDeferred<T>(): Deferred<T>

Type parameters

Name
T

Returns

Deferred<T>

Defined in

packages/delegate/src/leftOver.ts:8


createRequest

createRequest(«destructured»): ExecutionRequest

Parameters

NameType
«destructured»ICreateRequest

Returns

ExecutionRequest

Defined in

packages/delegate/src/createRequest.ts:40


defaultMergedResolver

defaultMergedResolver(parent, args, context, info): any

Resolver that knows how to: a) handle aliases for proxied schemas b) handle errors from proxied schemas c) handle external to internal enum conversion

Parameters

NameType
parentExternalObject<Record<string, any>>
argsRecord<string, any>
contextRecord<string, any>
infoGraphQLResolveInfo

Returns

any

Defined in

packages/delegate/src/defaultMergedResolver.ts:27


delegateRequest

delegateRequest<TContext, TArgs>(options): any

Type parameters

NameType
TContextextends Record<string, any> = Record<string, any>
TArgsextends Record<string, any> = any

Parameters

NameType
optionsIDelegateRequestOptions<TContext, TArgs>

Returns

any

Defined in

packages/delegate/src/delegateToSchema.ts:88


delegateToSchema

delegateToSchema<TContext, TArgs>(options): any

Type parameters

NameType
TContextextends Record<string, any> = Record<string, any>
TArgsextends Record<string, any> = any

Parameters

NameType
optionsIDelegateToSchemaOptions<TContext, TArgs>

Returns

any

Defined in

packages/delegate/src/delegateToSchema.ts:37


extractUnavailableFields

extractUnavailableFields(schema, field, fieldNode, shouldAdd): SelectionNode[]

Parameters

NameType
schemaGraphQLSchema
fieldGraphQLField<any, any, any>
fieldNodeFieldNode
shouldAdd(fieldType: GraphQLInterfaceType | GraphQLObjectType<any, any>, selection: FieldNode) => boolean

Returns

SelectionNode[]

Defined in

packages/delegate/src/extractUnavailableFields.ts:122


extractUnavailableFieldsFromSelectionSet

extractUnavailableFieldsFromSelectionSet(schema, fieldType, fieldSelectionSet, shouldAdd): SelectionNode[]

Parameters

NameType
schemaGraphQLSchema
fieldTypeGraphQLNamedOutputType
fieldSelectionSetSelectionSetNode
shouldAdd(fieldType: GraphQLInterfaceType | GraphQLObjectType<any, any>, selection: FieldNode) => boolean

Returns

SelectionNode[]

Defined in

packages/delegate/src/extractUnavailableFields.ts:23


getActualFieldNodes

getActualFieldNodes(fieldNode): FieldNode[]

Parameters

NameType
fieldNodeFieldNode

Returns

FieldNode[]

Defined in

packages/delegate/src/mergeFields.ts:61


getDelegatingOperation

getDelegatingOperation(parentType, schema): OperationTypeNode

Parameters

NameType
parentTypeGraphQLObjectType<any, any>
schemaGraphQLSchema

Returns

OperationTypeNode

Defined in

packages/delegate/src/createRequest.ts:27


getPlanLeftOverFromParent

getPlanLeftOverFromParent(parent): DelegationPlanLeftOver | undefined

Parameters

NameType
parentunknown

Returns

DelegationPlanLeftOver | undefined

Defined in

packages/delegate/src/leftOver.ts:32


getSubschema

getSubschema(object, responseKey): GraphQLSchema | SubschemaConfig

Parameters

NameType
objectExternalObject<Record<string, any>>
responseKeystring

Returns

GraphQLSchema | SubschemaConfig

Defined in

packages/delegate/src/mergeFields.ts:47


getUnpathedErrors

getUnpathedErrors(object): GraphQLError[]

Parameters

NameType
objectExternalObject<Record<string, any>>

Returns

GraphQLError[]

Defined in

packages/delegate/src/mergeFields.ts:54


handleResolverResult

handleResolverResult(resolverResult, subschema, selectionSet, object, combinedFieldSubschemaMap, info, path, combinedErrors): void

Parameters

NameType
resolverResultany
subschemaSubschema<any, any, any, Record<string, any>>
selectionSetSelectionSetNode
objectExternalObject<Record<string, any>>
combinedFieldSubschemaMapRecord<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>
infoGraphQLResolveInfo
path(string | number)[]
combinedErrorsGraphQLError[]

Returns

void

Defined in

packages/delegate/src/mergeFields.ts:114


isExternalObject

isExternalObject(data): data is ExternalObject<Record<string, any>>

Parameters

NameType
dataany

Returns

data is ExternalObject<Record<string, any>>

Defined in

packages/delegate/src/mergeFields.ts:29


isSubschema

isSubschema(value): value is Subschema<any, any, any, Record<string, any>>

Parameters

NameType
valueany

Returns

value is Subschema<any, any, any, Record<string, any>>

Defined in

packages/delegate/src/Subschema.ts:12


isSubschemaConfig

isSubschemaConfig(value): value is SubschemaConfig<any, any, any, any>

Parameters

NameType
valueany

Returns

value is SubschemaConfig<any, any, any, any>

Defined in

packages/delegate/src/subschemaConfig.ts:3


mergeFields

mergeFields<TContext>(mergedTypeInfo, object, sourceSubschema, context, info): MaybePromise<any>

Type parameters

Name
TContext

Parameters

NameType
mergedTypeInfoMergedTypeInfo<Record<string, any>>
objectany
sourceSubschemaSubschema<any, any, any, TContext>
contextany
infoGraphQLResolveInfo

Returns

MaybePromise<any>

Defined in

packages/delegate/src/mergeFields.ts:65


resolveExternalValue

resolveExternalValue<TContext>(result, unpathedErrors, subschema, context?, info?, returnType?, skipTypeMerging?): any

Type parameters

NameType
TContextextends Record<string, any>

Parameters

NameType
resultany
unpathedErrorsGraphQLError[]
subschemaGraphQLSchema | SubschemaConfig<any, any, any, TContext>
context?Record<string, any>
info?GraphQLResolveInfo
returnTypeGraphQLOutputType
skipTypeMerging?boolean

Returns

any

Defined in

packages/delegate/src/resolveExternalValue.ts:18


subtractSelectionSets

subtractSelectionSets(selectionSetA, selectionSetB): SelectionSetNode

Parameters

NameType
selectionSetASelectionSetNode
selectionSetBSelectionSetNode

Returns

SelectionSetNode

Defined in

packages/delegate/src/extractUnavailableFields.ts:151