@graphql-tools/merge

Interfaces

Type aliases

Functions

Type aliases

EnumTypeExtensions

Ƭ EnumTypeExtensions: object

Defined in packages/merge/src/extensions.ts:49

Type declaration:


ExtensionsObject

Ƭ ExtensionsObject: Record‹string, any›

Defined in packages/merge/src/extensions.ts:24


InputTypeExtensions

Ƭ InputTypeExtensions: object

Defined in packages/merge/src/extensions.ts:31

Type declaration:

  • fields: Record‹string, object›

  • type: "input"


InterfaceTypeExtensions

Ƭ InterfaceTypeExtensions: object

Defined in packages/merge/src/extensions.ts:36

Type declaration:

  • fields: Record‹string, object›

  • type: "interface"


MergedResultMap

Ƭ MergedResultMap: object

Defined in packages/merge/src/typedefs-mergers/merge-nodes.ts:26

Type declaration:

  • [ name: string]: DefinitionNode

ObjectTypeExtensions

Ƭ ObjectTypeExtensions: object

Defined in packages/merge/src/extensions.ts:26

Type declaration:

  • fields: Record‹string, object›

  • type: "object"


PossibleTypeExtensions

Ƭ PossibleTypeExtensions: InputTypeExtensions | InterfaceTypeExtensions | ObjectTypeExtensions | UnionTypeExtensions | ScalarTypeExtensions | EnumTypeExtensions

Defined in packages/merge/src/extensions.ts:54


ResolversDefinition

Ƭ ResolversDefinition: IResolvers‹any, TContext› | ResolversFactory‹TContext›

Defined in packages/merge/src/merge-resolvers.ts:4


ResolversFactory

Ƭ ResolversFactory: function

Defined in packages/merge/src/merge-resolvers.ts:3

Type declaration:

▸ (...args: any[]): IResolvers‹any, TContext›

Parameters:

NameType
...argsany[]

ScalarTypeExtensions

Ƭ ScalarTypeExtensions: object

Defined in packages/merge/src/extensions.ts:45

Type declaration:

  • type: "scalar"

SchemaExtensions

Ƭ SchemaExtensions: object

Defined in packages/merge/src/extensions.ts:61

Type declaration:


UnionTypeExtensions

Ƭ UnionTypeExtensions: object

Defined in packages/merge/src/extensions.ts:41

Type declaration:

  • type: "union"

Functions

applyExtensions

applyExtensions(schema: GraphQLSchema, extensions: SchemaExtensions): GraphQLSchema

Defined in packages/merge/src/extensions.ts:157

Parameters:

NameType
schemaGraphQLSchema
extensionsSchemaExtensions

Returns: GraphQLSchema


collectComment

collectComment(node: TypeDefinitionNode): void

Defined in packages/merge/src/typedefs-mergers/comments.ts:22

Parameters:

NameType
nodeTypeDefinitionNode

Returns: void


extractExtensionsFromSchema

extractExtensionsFromSchema(schema: GraphQLSchema): SchemaExtensions

Defined in packages/merge/src/extensions.ts:198

Parameters:

NameType
schemaGraphQLSchema

Returns: SchemaExtensions


extractType

extractType(type: TypeNode): NamedTypeNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:85

Parameters:

NameType
typeTypeNode

Returns: NamedTypeNode


isGraphQLDirective

isGraphQLDirective(definition: DefinitionNode): definition is DirectiveDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:81

Parameters:

NameType
definitionDefinitionNode

Returns: definition is DirectiveDefinitionNode


isGraphQLEnum

isGraphQLEnum(definition: DefinitionNode): definition is EnumTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:41

Parameters:

NameType
definitionDefinitionNode

Returns: definition is EnumTypeDefinitionNode


isGraphQLEnumExtension

isGraphQLEnumExtension(definition: DefinitionNode): definition is EnumTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:45

Parameters:

NameType
definitionDefinitionNode

Returns: definition is EnumTypeExtensionNode


isGraphQLInputType

isGraphQLInputType(definition: DefinitionNode): definition is InputObjectTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:65

Parameters:

NameType
definitionDefinitionNode

Returns: definition is InputObjectTypeDefinitionNode


isGraphQLInputTypeExtension

isGraphQLInputTypeExtension(definition: DefinitionNode): definition is InputObjectTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:69

Parameters:

NameType
definitionDefinitionNode

Returns: definition is InputObjectTypeExtensionNode


isGraphQLInterface

isGraphQLInterface(definition: DefinitionNode): definition is InterfaceTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:73

Parameters:

NameType
definitionDefinitionNode

Returns: definition is InterfaceTypeDefinitionNode


isGraphQLInterfaceExtension

isGraphQLInterfaceExtension(definition: DefinitionNode): definition is InterfaceTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:77

Parameters:

NameType
definitionDefinitionNode

Returns: definition is InterfaceTypeExtensionNode


isGraphQLScalar

isGraphQLScalar(definition: DefinitionNode): definition is ScalarTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:57

Parameters:

NameType
definitionDefinitionNode

Returns: definition is ScalarTypeDefinitionNode


isGraphQLScalarExtension

isGraphQLScalarExtension(definition: DefinitionNode): definition is ScalarTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:61

Parameters:

NameType
definitionDefinitionNode

Returns: definition is ScalarTypeExtensionNode


isGraphQLType

isGraphQLType(definition: DefinitionNode): definition is ObjectTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:33

Parameters:

NameType
definitionDefinitionNode

Returns: definition is ObjectTypeDefinitionNode


isGraphQLTypeExtension

isGraphQLTypeExtension(definition: DefinitionNode): definition is ObjectTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:37

Parameters:

NameType
definitionDefinitionNode

Returns: definition is ObjectTypeExtensionNode


isGraphQLUnion

isGraphQLUnion(definition: DefinitionNode): definition is UnionTypeDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:49

Parameters:

NameType
definitionDefinitionNode

Returns: definition is UnionTypeDefinitionNode


isGraphQLUnionExtension

isGraphQLUnionExtension(definition: DefinitionNode): definition is UnionTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:53

Parameters:

NameType
definitionDefinitionNode

Returns: definition is UnionTypeExtensionNode


isListTypeNode

isListTypeNode(type: TypeNode): type is ListTypeNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:101

Parameters:

NameType
typeTypeNode

Returns: type is ListTypeNode


isNonNullTypeNode

isNonNullTypeNode(type: TypeNode): type is NonNullTypeNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:105

Parameters:

NameType
typeTypeNode

Returns: type is NonNullTypeNode


isSchemaDefinition

isSchemaDefinition(node: DefinitionNode): node is SchemaDefinitionNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:93

Parameters:

NameType
nodeDefinitionNode

Returns: node is SchemaDefinitionNode


isSourceTypes

isSourceTypes(types: any): types is Source

Defined in packages/merge/src/typedefs-mergers/utils.ts:29

Parameters:

NameType
typesany

Returns: types is Source


isStringTypes

isStringTypes(types: any): types is string

Defined in packages/merge/src/typedefs-mergers/utils.ts:25

Parameters:

NameType
typesany

Returns: types is string


isWrappingTypeNode

isWrappingTypeNode(type: TypeNode): type is ListTypeNode | NonNullTypeNode

Defined in packages/merge/src/typedefs-mergers/utils.ts:97

Parameters:

NameType
typeTypeNode

Returns: type is ListTypeNode | NonNullTypeNode


mergeArguments

mergeArguments(args1: InputValueDefinitionNode[], args2: InputValueDefinitionNode[], config: Config): InputValueDefinitionNode[]

Defined in packages/merge/src/typedefs-mergers/arguments.ts:5

Parameters:

NameType
args1InputValueDefinitionNode[]
args2InputValueDefinitionNode[]
configConfig

Returns: InputValueDefinitionNode[]


mergeDirective

mergeDirective(node: DirectiveDefinitionNode, existingNode?: DirectiveDefinitionNode): DirectiveDefinitionNode

Defined in packages/merge/src/typedefs-mergers/directives.ts:98

Parameters:

NameType
nodeDirectiveDefinitionNode
existingNode?DirectiveDefinitionNode

Returns: DirectiveDefinitionNode


mergeDirectives

mergeDirectives(d1: ReadonlyArray‹DirectiveNode›, d2: ReadonlyArray‹DirectiveNode›, config?: Config): DirectiveNode[]

Defined in packages/merge/src/typedefs-mergers/directives.ts:59

Parameters:

NameTypeDefault
d1ReadonlyArray‹DirectiveNode›[]
d2ReadonlyArray‹DirectiveNode›[]
config?Config-

Returns: DirectiveNode[]


mergeEnum

mergeEnum(e1: EnumTypeDefinitionNode | EnumTypeExtensionNode, e2: EnumTypeDefinitionNode | EnumTypeExtensionNode, config?: Config): EnumTypeDefinitionNode | EnumTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/enum.ts:6

Parameters:

NameType
e1EnumTypeDefinitionNode | EnumTypeExtensionNode
e2EnumTypeDefinitionNode | EnumTypeExtensionNode
config?Config

Returns: EnumTypeDefinitionNode | EnumTypeExtensionNode


mergeEnumValues

mergeEnumValues(first: ReadonlyArray‹EnumValueDefinitionNode›, second: ReadonlyArray‹EnumValueDefinitionNode›, config: Config): EnumValueDefinitionNode[]

Defined in packages/merge/src/typedefs-mergers/enum-values.ts:6

Parameters:

NameType
firstReadonlyArray‹EnumValueDefinitionNode›
secondReadonlyArray‹EnumValueDefinitionNode›
configConfig

Returns: EnumValueDefinitionNode[]


mergeExtensions

mergeExtensions(extensions: SchemaExtensions[]): SchemaExtensions

Defined in packages/merge/src/extensions.ts:142

Parameters:

NameType
extensionsSchemaExtensions[]

Returns: SchemaExtensions


mergeFields

mergeFieldsT›(type: object, f1: ReadonlyArray‹T›, f2: ReadonlyArray‹T›, config: Config): T[]

Defined in packages/merge/src/typedefs-mergers/fields.ts:25

Type parameters:

T: FieldDefinitionNode | InputValueDefinitionNode

Parameters:

type: object

NameType
nameNameNode

f1: ReadonlyArray‹T›

f2: ReadonlyArray‹T›

config: Config

Returns: T[]


mergeGraphQLNodes

mergeGraphQLNodes(nodes: ReadonlyArray‹DefinitionNode›, config?: Config): MergedResultMap

Defined in packages/merge/src/typedefs-mergers/merge-nodes.ts:28

Parameters:

NameType
nodesReadonlyArray‹DefinitionNode›
config?Config

Returns: MergedResultMap


mergeGraphQLTypes

mergeGraphQLTypes(types: Array‹string | Source | DocumentNode | GraphQLSchema›, config: Config): DefinitionNode[]

Defined in packages/merge/src/typedefs-mergers/merge-typedefs.ts:105

Parameters:

NameType
typesArray‹string | Source | DocumentNode | GraphQLSchema›
configConfig

Returns: DefinitionNode[]


mergeInputType

mergeInputType(node: InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode, existingNode: InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode, config?: Config): InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/input-type.ts:7

Parameters:

NameType
nodeInputObjectTypeDefinitionNode | InputObjectTypeExtensionNode
existingNodeInputObjectTypeDefinitionNode | InputObjectTypeExtensionNode
config?Config

Returns: InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode


mergeInterface

mergeInterface(node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode, existingNode: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode, config: Config): InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/interface.ts:6

Parameters:

NameType
nodeInterfaceTypeDefinitionNode | InterfaceTypeExtensionNode
existingNodeInterfaceTypeDefinitionNode | InterfaceTypeExtensionNode
configConfig

Returns: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode


mergeNamedTypeArray

mergeNamedTypeArray(first: ReadonlyArray‹NamedTypeNode›, second: ReadonlyArray‹NamedTypeNode›, config: Config): NamedTypeNode[]

Defined in packages/merge/src/typedefs-mergers/merge-named-type-array.ts:9

Parameters:

NameType
firstReadonlyArray‹NamedTypeNode›
secondReadonlyArray‹NamedTypeNode›
configConfig

Returns: NamedTypeNode[]


mergeResolvers

mergeResolversTContext, T›(resolversDefinitions: T[], options?: MergeResolversOptions): T

Defined in packages/merge/src/merge-resolvers.ts:42

Deep merges multiple resolver definition objects into a single definition.

Type parameters:

TContext

T: ResolversDefinition‹TContext›

Parameters:

NameTypeDescription
resolversDefinitionsT[]Resolver definitions to be merged
options?MergeResolversOptionsAdditional options js const { mergeResolvers } = require('@graphql-tools/merge'); const clientResolver = require('./clientResolver'); const productResolver = require('./productResolver'); const resolvers = mergeResolvers([ clientResolver, productResolver, ]); If you don't want to manually create the array of resolver objects, you can also use this function along with loadFiles: js const path = require('path'); const { mergeResolvers } = require('@graphql-tools/merge'); const { loadFilesSync } = require('@graphql-tools/load-files'); const resolversArray = loadFilesSync(path.join(__dirname, './resolvers')); const resolvers = mergeResolvers(resolversArray)

Returns: T


mergeSchemas

mergeSchemas(config: MergeSchemasConfig): GraphQLSchema‹›

Defined in packages/merge/src/merge-schemas.ts:56

Synchronously merges multiple schemas, typeDefinitions and/or resolvers into a single schema.

Parameters:

NameTypeDescription
configMergeSchemasConfigConfiguration object

Returns: GraphQLSchema‹›


mergeSchemasAsync

mergeSchemasAsync(config: MergeSchemasConfig): Promise‹GraphQLSchema‹››

Defined in packages/merge/src/merge-schemas.ts:76

Synchronously merges multiple schemas, typeDefinitions and/or resolvers into a single schema.

Parameters:

NameTypeDescription
configMergeSchemasConfigConfiguration object

Returns: Promise‹GraphQLSchema‹››


mergeType

mergeType(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode, existingNode: ObjectTypeDefinitionNode | ObjectTypeExtensionNode, config?: Config): ObjectTypeDefinitionNode | ObjectTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/type.ts:7

Parameters:

NameType
nodeObjectTypeDefinitionNode | ObjectTypeExtensionNode
existingNodeObjectTypeDefinitionNode | ObjectTypeExtensionNode
config?Config

Returns: ObjectTypeDefinitionNode | ObjectTypeExtensionNode


mergeTypeDefs

mergeTypeDefs(types: Array‹string | Source | DocumentNode | GraphQLSchema›): DocumentNode

Defined in packages/merge/src/typedefs-mergers/merge-typedefs.ts:66

Merges multiple type definitions into a single DocumentNode

Parameters:

NameTypeDescription
typesArray‹string | Source | DocumentNode | GraphQLSchema›The type definitions to be merged

Returns: DocumentNode

mergeTypeDefs(types: Array‹string | Source | DocumentNode | GraphQLSchema›, config?: Partial‹Config› & object): string

Defined in packages/merge/src/typedefs-mergers/merge-typedefs.ts:67

Parameters:

NameType
typesArray‹string | Source | DocumentNode | GraphQLSchema›
config?Partial‹Config› & object

Returns: string

mergeTypeDefs(types: Array‹string | Source | DocumentNode | GraphQLSchema›, config?: Omit‹Partial‹Config›, "commentDescriptions"›): DocumentNode

Defined in packages/merge/src/typedefs-mergers/merge-typedefs.ts:71

Parameters:

NameType
typesArray‹string | Source | DocumentNode | GraphQLSchema›
config?Omit‹Partial‹Config›, "commentDescriptions"›

Returns: DocumentNode


mergeUnion

mergeUnion(first: UnionTypeDefinitionNode | UnionTypeExtensionNode, second: UnionTypeDefinitionNode | UnionTypeExtensionNode, config?: Config): UnionTypeDefinitionNode | UnionTypeExtensionNode

Defined in packages/merge/src/typedefs-mergers/union.ts:6

Parameters:

NameType
firstUnionTypeDefinitionNode | UnionTypeExtensionNode
secondUnionTypeDefinitionNode | UnionTypeExtensionNode
config?Config

Returns: UnionTypeDefinitionNode | UnionTypeExtensionNode


printComment

printComment(comment: string): string

Defined in packages/merge/src/typedefs-mergers/comments.ts:82

Parameters:

NameType
commentstring

Returns: string


printTypeNode

printTypeNode(type: TypeNode): string

Defined in packages/merge/src/typedefs-mergers/utils.ts:109

Parameters:

NameType
typeTypeNode

Returns: string


printWithComments

printWithComments(ast: ASTNode): any

Defined in packages/merge/src/typedefs-mergers/comments.ts:172

Converts an AST into a string, using one set of reasonable formatting rules.

Parameters:

NameType
astASTNode

Returns: any


pushComment

pushComment(node: object, entity: string, field?: string, argument?: string): void

Defined in packages/merge/src/typedefs-mergers/comments.ts:51

Parameters:

node: object

NameType
description?StringValueNode

entity: string

Optional field: string

Optional argument: string

Returns: void


resetComments

resetComments(): void

Defined in packages/merge/src/typedefs-mergers/comments.ts:18

Returns: void


travelSchemaPossibleExtensions

travelSchemaPossibleExtensions(schema: GraphQLSchema, hooks: object): void

Defined in packages/merge/src/extensions.ts:66

Parameters:

schema: GraphQLSchema

hooks: object

NameType
onEnumfunction
onEnumValuefunction
onInputFieldTypefunction
onInputTypefunction
onInterfacefunction
onInterfaceFieldfunction
onInterfaceFieldArgfunction
onObjectFieldfunction
onObjectFieldArgfunction
onObjectTypefunction
onScalarfunction
onSchemafunction
onUnionfunction

Returns: void