Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Docs
API Reference
Packages
federation

@graphql-tools/federation

Interfaces

Variables

Functions

Variables

SubgraphBaseSDL

Const SubgraphBaseSDL: "\n scalar _Any\n scalar _FieldSet\n scalar link__Import\n\n enum link__Purpose {\n SECURITY\n EXECUTION\n }\n\n type _Service {\n sdl: String!\n }\n\n type Query {\n _service: _Service!\n }\n\n directive @external on FIELD_DEFINITION | OBJECT\n directive @requires(fields: _FieldSet!) on FIELD_DEFINITION\n directive @provides(fields: _FieldSet!) on FIELD_DEFINITION\n directive @key(fields: _FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE\n directive @link(\n url: String!\n as: String\n for: link__Purpose\n import: [link__Import]\n ) repeatable on SCHEMA\n directive @shareable repeatable on OBJECT | FIELD_DEFINITION\n directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION\n directive @tag(\n name: String!\n ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION\n directive @override(from: String!) on FIELD_DEFINITION\n directive @composeDirective(name: String!) repeatable on SCHEMA\n\n directive @extends on OBJECT | INTERFACE\n"

Defined in

packages/federation/src/subgraph.ts:14


SubgraphSDLQuery

Const SubgraphSDLQuery: "\n query SubgraphSDL {\n _service {\n sdl\n }\n }\n"

Defined in

packages/federation/src/gateway.ts:32

Functions

buildSubgraphSchema

buildSubgraphSchema<TContext>(optsOrModules): GraphQLSchema

Type parameters

NameType
TContextany

Parameters

NameType
optsOrModulesIExecutableSchemaDefinition<TContext> | Pick<IExecutableSchemaDefinition<TContext>, "resolvers" | "typeDefs">[]

Returns

GraphQLSchema

Defined in

packages/federation/src/subgraph.ts:53


federationSubschemaTransformer

federationSubschemaTransformer(subschemaConfig): SubschemaConfig<any, any, any, Record<string, any>> | SubschemaConfig<any, any, any, Record<string, any>>[]

Parameters

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

Returns

SubschemaConfig<any, any, any, Record<string, any>> | SubschemaConfig<any, any, any, Record<string, any>>[]

Defined in

packages/federation/src/gateway.ts:222


filterInternalFieldsAndTypes

filterInternalFieldsAndTypes(finalSchema): GraphQLSchema

Parameters

NameType
finalSchemaGraphQLSchema

Returns

GraphQLSchema

Defined in

packages/federation/src/utils.ts:43


getArgsFromKeysForFederation

getArgsFromKeysForFederation(representations): Object

Parameters

NameType
representationsreadonly any[]

Returns

Object

NameType
representationsreadonly any[]

Defined in

packages/federation/src/utils.ts:4


getCacheKeyFnFromKey

getCacheKeyFnFromKey(key): (root: any) => any

Parameters

NameType
keystring

Returns

fn

▸ (root): any

Parameters
NameType
rootany
Returns

any

Defined in

packages/federation/src/utils.ts:29


getKeyFnForFederation

getKeyFnForFederation(typeName, keys): (root: any) => any

Parameters

NameType
typeNamestring
keysstring[]

Returns

fn

▸ (root): any

Parameters
NameType
rootany
Returns

any

Defined in

packages/federation/src/utils.ts:12


getKeyForFederation

getKeyForFederation<TRoot>(root): TRoot

Type parameters

Name
TRoot

Parameters

NameType
rootTRoot

Returns

TRoot

Defined in

packages/federation/src/utils.ts:8


getNamedTypeNode

getNamedTypeNode(typeNode): NamedTypeNode

Parameters

NameType
typeNodeTypeNode

Returns

NamedTypeNode

Defined in

packages/federation/src/utils.ts:66


getStitchedSchemaFromSupergraphSdl

getStitchedSchemaFromSupergraphSdl(opts): GraphQLSchema

Parameters

NameType
optsGetSubschemasFromSupergraphSdlOpts

Returns

GraphQLSchema

Defined in

packages/federation/src/supergraph.ts:535


getStitchedSchemaWithUrls

getStitchedSchemaWithUrls(configs): Promise<GraphQLSchema>

Parameters

NameType
configsHTTPExecutorOptions[]

Returns

Promise<GraphQLSchema>

Defined in

packages/federation/src/gateway.ts:212


getSubschemaForFederationWithExecutor

getSubschemaForFederationWithExecutor(executor): Promise<{ batch?: boolean ; batchingOptions?: BatchingOptions<any, any, any> ; createProxyingResolver?: CreateProxyingResolverFn<Record<string, any>> ; executor: Executor ; merge?: Record<string, MergedTypeConfig<any, any, Record<string, any>>> ; rootValue?: any ; schema: GraphQLSchema ; transforms?: Transform<any, Record<string, any>>[] }>

Parameters

NameType
executorExecutor

Returns

Promise<{ batch?: boolean ; batchingOptions?: BatchingOptions<any, any, any> ; createProxyingResolver?: CreateProxyingResolverFn<Record<string, any>> ; executor: Executor ; merge?: Record<string, MergedTypeConfig<any, any, Record<string, any>>> ; rootValue?: any ; schema: GraphQLSchema ; transforms?: Transform<any, Record<string, any>>[] }>

Defined in

packages/federation/src/gateway.ts:183


getSubschemaForFederationWithSchema

getSubschemaForFederationWithSchema(schema): Promise<{ batch?: boolean ; batchingOptions?: BatchingOptions<any, any, any> ; createProxyingResolver?: CreateProxyingResolverFn<Record<string, any>> ; executor: Executor ; merge?: Record<string, MergedTypeConfig<any, any, Record<string, any>>> ; rootValue?: any ; schema: GraphQLSchema ; transforms?: Transform<any, Record<string, any>>[] }>

Parameters

NameType
schemaGraphQLSchema

Returns

Promise<{ batch?: boolean ; batchingOptions?: BatchingOptions<any, any, any> ; createProxyingResolver?: CreateProxyingResolverFn<Record<string, any>> ; executor: Executor ; merge?: Record<string, MergedTypeConfig<any, any, Record<string, any>>> ; rootValue?: any ; schema: GraphQLSchema ; transforms?: Transform<any, Record<string, any>>[] }>

Defined in

packages/federation/src/gateway.ts:207


getSubschemaForFederationWithTypeDefs

getSubschemaForFederationWithTypeDefs(typeDefs): SubschemaConfig

Parameters

NameType
typeDefsDocumentNode

Returns

SubschemaConfig

Defined in

packages/federation/src/gateway.ts:51


getSubschemaForFederationWithURL

getSubschemaForFederationWithURL(config): Promise<SubschemaConfig>

Parameters

NameType
configHTTPExecutorOptions

Returns

Promise<SubschemaConfig>

Defined in

packages/federation/src/gateway.ts:40


getSubschemasFromSupergraphSdl

getSubschemasFromSupergraphSdl(«destructured»): Map<string, SubschemaConfig<any, any, any, Record<string, any>>>

Parameters

NameType
«destructured»GetSubschemasFromSupergraphSdlOpts

Returns

Map<string, SubschemaConfig<any, any, any, Record<string, any>>>

Defined in

packages/federation/src/supergraph.ts:41