@graphql-tools/merge
Enumerations
Interfaces
Type Aliases
Variables
Functions
- applyExtensions
- defaultStringComparator
- extractExtensionsFromSchema
- extractType
- isListTypeNode
- isNamedDefinitionNode
- isNonNullTypeNode
- isSourceTypes
- isStringTypes
- isWrappingTypeNode
- mergeArguments
- mergeDirective
- mergeDirectives
- mergeEnum
- mergeEnumValues
- mergeExtensions
- mergeFields
- mergeGraphQLNodes
- mergeGraphQLTypes
- mergeInputType
- mergeInterface
- mergeNamedTypeArray
- mergeResolvers
- mergeScalar
- mergeType
- mergeTypeDefs
- mergeUnion
- printTypeNode
Type Aliases
CompareFn
Ƭ CompareFn<T
>: (a
: T
| undefined
, b
: T
| undefined
) => -1
| 0
| 1
Type parameters
Name |
---|
T |
Type declaration
▸ (a
, b
): -1
| 0
| 1
Parameters
Name | Type |
---|---|
a | T | undefined |
b | T | undefined |
Returns
-1
| 0
| 1
Defined in
packages/merge/src/typedefs-mergers/utils.ts:48
MergedResultMap
Ƭ MergedResultMap: Record
<string
, NamedDefinitionNode
> & { SCHEMA_DEF_SYMBOL
: SchemaDefinitionNode
| SchemaExtensionNode
}
Defined in
packages/merge/src/typedefs-mergers/merge-nodes.ts:22
OnFieldTypeConflict
Ƭ OnFieldTypeConflict: (existingField
: FieldDefNode
, otherField
: FieldDefNode
, type
: NamedDefNode
, ignoreNullability
: boolean
| undefined
) => FieldDefNode
Type declaration
▸ (existingField
, otherField
, type
, ignoreNullability
): FieldDefNode
Parameters
Name | Type |
---|---|
existingField | FieldDefNode |
otherField | FieldDefNode |
type | NamedDefNode |
ignoreNullability | boolean | undefined |
Returns
FieldDefNode
Defined in
packages/merge/src/typedefs-mergers/fields.ts:23
Variables
schemaDefSymbol
• Const
schemaDefSymbol: "SCHEMA_DEF_SYMBOL"
Defined in
packages/merge/src/typedefs-mergers/merge-nodes.ts:20
Functions
applyExtensions
▸ applyExtensions(schema
, extensions
): GraphQLSchema
Parameters
Name | Type |
---|---|
schema | GraphQLSchema |
extensions | SchemaExtensions |
Returns
GraphQLSchema
Defined in
packages/merge/src/extensions.ts:24
defaultStringComparator
▸ defaultStringComparator(a
, b
): CompareVal
Parameters
Name | Type |
---|---|
a | undefined | string |
b | undefined | string |
Returns
Defined in
packages/merge/src/typedefs-mergers/utils.ts:50
extractExtensionsFromSchema
▸ extractExtensionsFromSchema(schema
, removeDirectives?
): SchemaExtensions
Parameters
Name | Type | Default value |
---|---|---|
schema | GraphQLSchema | undefined |
removeDirectives | boolean | false |
Returns
Defined in
packages/utils/src/extractExtensionsFromSchema.ts:30
extractType
▸ extractType(type
): NamedTypeNode
Parameters
Name | Type |
---|---|
type | TypeNode |
Returns
NamedTypeNode
Defined in
packages/merge/src/typedefs-mergers/utils.ts:11
isListTypeNode
▸ isListTypeNode(type
): type is ListTypeNode
Parameters
Name | Type |
---|---|
type | TypeNode |
Returns
type is ListTypeNode
Defined in
packages/merge/src/typedefs-mergers/utils.ts:23
isNamedDefinitionNode
▸ isNamedDefinitionNode(definitionNode
): definitionNode is NamedDefinitionNode
Parameters
Name | Type |
---|---|
definitionNode | DefinitionNode |
Returns
definitionNode is NamedDefinitionNode
Defined in
packages/merge/src/typedefs-mergers/merge-nodes.ts:26
isNonNullTypeNode
▸ isNonNullTypeNode(type
): type is NonNullTypeNode
Parameters
Name | Type |
---|---|
type | TypeNode |
Returns
type is NonNullTypeNode
Defined in
packages/merge/src/typedefs-mergers/utils.ts:27
isSourceTypes
▸ isSourceTypes(types
): types is Source
Parameters
Name | Type |
---|---|
types | any |
Returns
types is Source
Defined in
packages/merge/src/typedefs-mergers/utils.ts:7
isStringTypes
▸ isStringTypes(types
): types is string
Parameters
Name | Type |
---|---|
types | any |
Returns
types is string
Defined in
packages/merge/src/typedefs-mergers/utils.ts:3
isWrappingTypeNode
▸ isWrappingTypeNode(type
): type is ListTypeNode | NonNullTypeNode
Parameters
Name | Type |
---|---|
type | TypeNode |
Returns
type is ListTypeNode | NonNullTypeNode
Defined in
packages/merge/src/typedefs-mergers/utils.ts:19
mergeArguments
▸ mergeArguments(args1
, args2
, config?
): InputValueDefinitionNode
[]
Parameters
Name | Type |
---|---|
args1 | InputValueDefinitionNode [] |
args2 | InputValueDefinitionNode [] |
config? | Config |
Returns
InputValueDefinitionNode
[]
Defined in
packages/merge/src/typedefs-mergers/arguments.ts:5
mergeDirective
▸ mergeDirective(node
, existingNode?
): DirectiveDefinitionNode
Parameters
Name | Type |
---|---|
node | DirectiveDefinitionNode |
existingNode? | DirectiveDefinitionNode |
Returns
DirectiveDefinitionNode
Defined in
packages/merge/src/typedefs-mergers/directives.ts:115
mergeDirectives
▸ mergeDirectives(d1?
, d2?
, config?
, directives?
): DirectiveNode
[]
Parameters
Name | Type | Default value |
---|---|---|
d1 | readonly DirectiveNode [] | [] |
d2 | readonly DirectiveNode [] | [] |
config? | Config | undefined |
directives? | Record <string , DirectiveDefinitionNode > | undefined |
Returns
DirectiveNode
[]
Defined in
packages/merge/src/typedefs-mergers/directives.ts:85
mergeEnum
▸ mergeEnum(e1
, e2
, config?
, directives?
): EnumTypeDefinitionNode
| EnumTypeExtensionNode
Parameters
Name | Type |
---|---|
e1 | EnumTypeDefinitionNode | EnumTypeExtensionNode |
e2 | EnumTypeDefinitionNode | EnumTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
EnumTypeDefinitionNode
| EnumTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/enum.ts:11
mergeEnumValues
▸ mergeEnumValues(first
, second
, config?
, directives?
): EnumValueDefinitionNode
[]
Parameters
Name | Type |
---|---|
first | undefined | readonly EnumValueDefinitionNode [] |
second | undefined | readonly EnumValueDefinitionNode [] |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
EnumValueDefinitionNode
[]
Defined in
packages/merge/src/typedefs-mergers/enum-values.ts:6
mergeExtensions
▸ mergeExtensions(extensions
): SchemaExtensions
Parameters
Name | Type |
---|---|
extensions | SchemaExtensions [] |
Returns
Defined in
packages/merge/src/extensions.ts:6
mergeFields
▸ mergeFields<T
>(type
, f1
, f2
, config?
, directives?
): T
[]
Type parameters
Name | Type |
---|---|
T | extends FieldDefNode |
Parameters
Name | Type |
---|---|
type | Object |
type.name | NameNode |
f1 | undefined | readonly T [] |
f2 | undefined | readonly T [] |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
T
[]
Defined in
packages/merge/src/typedefs-mergers/fields.ts:41
mergeGraphQLNodes
▸ mergeGraphQLNodes(nodes
, config?
, directives?
): MergedResultMap
Parameters
Name | Type |
---|---|
nodes | readonly DefinitionNode [] |
config? | Config |
directives | Record <string , DirectiveDefinitionNode > |
Returns
Defined in
packages/merge/src/typedefs-mergers/merge-nodes.ts:32
mergeGraphQLTypes
▸ mergeGraphQLTypes(typeSource
, config
): DefinitionNode
[]
Parameters
Name | Type |
---|---|
typeSource | TypeSource |
config | Config |
Returns
DefinitionNode
[]
Defined in
packages/merge/src/typedefs-mergers/merge-typedefs.ts:198
mergeInputType
▸ mergeInputType(node
, existingNode
, config?
, directives?
): InputObjectTypeDefinitionNode
| InputObjectTypeExtensionNode
Parameters
Name | Type |
---|---|
node | InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode |
existingNode | InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
InputObjectTypeDefinitionNode
| InputObjectTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/input-type.ts:12
mergeInterface
▸ mergeInterface(node
, existingNode
, config?
, directives?
): InterfaceTypeDefinitionNode
| InterfaceTypeExtensionNode
Parameters
Name | Type |
---|---|
node | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode |
existingNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
InterfaceTypeDefinitionNode
| InterfaceTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/interface.ts:12
mergeNamedTypeArray
▸ mergeNamedTypeArray(first?
, second?
, config?
): NamedTypeNode
[]
Parameters
Name | Type | Default value |
---|---|---|
first | readonly NamedTypeNode [] | [] |
second | readonly NamedTypeNode [] | [] |
config | Config | {} |
Returns
NamedTypeNode
[]
Defined in
packages/merge/src/typedefs-mergers/merge-named-type-array.ts:9
mergeResolvers
▸ mergeResolvers<TSource
, TContext
>(resolversDefinitions
, options?
): IResolvers
<TSource
, TContext
>
Deep merges multiple resolver definition objects into a single definition.
Type parameters
Name |
---|
TSource |
TContext |
Parameters
Name | Type | Description |
---|---|---|
resolversDefinitions | undefined | null | IResolvers <TSource , TContext > | Maybe <IResolvers <TSource , TContext >>[] | Resolver definitions to be merged |
options? | MergeResolversOptions | Additional 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
IResolvers
<TSource
, TContext
>
Defined in
packages/merge/src/merge-resolvers.ts:39
mergeScalar
▸ mergeScalar(node
, existingNode
, config?
, directives?
): ScalarTypeDefinitionNode
| ScalarTypeExtensionNode
Parameters
Name | Type |
---|---|
node | ScalarTypeDefinitionNode | ScalarTypeExtensionNode |
existingNode | ScalarTypeDefinitionNode | ScalarTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
ScalarTypeDefinitionNode
| ScalarTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/scalar.ts:10
mergeType
▸ mergeType(node
, existingNode
, config?
, directives?
): ObjectTypeDefinitionNode
| ObjectTypeExtensionNode
Parameters
Name | Type |
---|---|
node | ObjectTypeDefinitionNode | ObjectTypeExtensionNode |
existingNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
ObjectTypeDefinitionNode
| ObjectTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/type.ts:12
mergeTypeDefs
▸ mergeTypeDefs(typeSource
): DocumentNode
Merges multiple type definitions into a single DocumentNode
Parameters
Name | Type |
---|---|
typeSource | TypeSource |
Returns
DocumentNode
Defined in
packages/merge/src/typedefs-mergers/merge-typedefs.ts:103
▸ mergeTypeDefs(typeSource
, config?
): string
Parameters
Name | Type |
---|---|
typeSource | TypeSource |
config? | Partial <Config > & { commentDescriptions : true } |
Returns
string
Defined in
packages/merge/src/typedefs-mergers/merge-typedefs.ts:104
▸ mergeTypeDefs(typeSource
, config?
): DocumentNode
Parameters
Name | Type |
---|---|
typeSource | TypeSource |
config? | Omit <Partial <Config >, "commentDescriptions" > |
Returns
DocumentNode
Defined in
packages/merge/src/typedefs-mergers/merge-typedefs.ts:108
mergeUnion
▸ mergeUnion(first
, second
, config?
, directives?
): UnionTypeDefinitionNode
| UnionTypeExtensionNode
Parameters
Name | Type |
---|---|
first | UnionTypeDefinitionNode | UnionTypeExtensionNode |
second | UnionTypeDefinitionNode | UnionTypeExtensionNode |
config? | Config |
directives? | Record <string , DirectiveDefinitionNode > |
Returns
UnionTypeDefinitionNode
| UnionTypeExtensionNode
Defined in
packages/merge/src/typedefs-mergers/union.ts:11
printTypeNode
▸ printTypeNode(type
): string
Parameters
Name | Type |
---|---|
type | TypeNode |
Returns
string