@graphql-tools/federation
Table of contents
Interfaces
Variables
Functions
- buildSubgraphSchema
- federationSubschemaTransformer
- filterInternalFieldsAndTypes
- getArgsFromKeysForFederation
- getCacheKeyFnFromKey
- getKeyFnForFederation
- getKeyForFederation
- getNamedTypeNode
- getStitchedSchemaFromSupergraphSdl
- getStitchedSchemaWithUrls
- getSubschemaForFederationWithExecutor
- getSubschemaForFederationWithSchema
- getSubschemaForFederationWithTypeDefs
- getSubschemaForFederationWithURL
- getSubschemasFromSupergraphSdl
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 _entities(representations: [_Any!]!): [_Entity]!\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:7 (opens in a new tab)
SubgraphSDLQuery
• Const
SubgraphSDLQuery: "\n query SubgraphSDL {\n _service {\n sdl\n }\n }\n"
Defined in
packages/federation/src/gateway.ts:32 (opens in a new tab)
Functions
buildSubgraphSchema
▸ buildSubgraphSchema<TContext
>(opts
): GraphQLSchema
Type parameters
Name | Type |
---|---|
TContext | any |
Parameters
Name | Type |
---|---|
opts | IExecutableSchemaDefinition <TContext > |
Returns
GraphQLSchema
Defined in
packages/federation/src/subgraph.ts:47 (opens in a new tab)
federationSubschemaTransformer
▸ federationSubschemaTransformer(subschemaConfig
): SubschemaConfig
<any
, any
, any
, Record
<string
, any
>> | SubschemaConfig
<any
, any
, any
, Record
<string
, any
>>[]
Parameters
Name | Type |
---|---|
subschemaConfig | SubschemaConfig <any , any , any , Record <string , any >> |
Returns
SubschemaConfig
<any
, any
, any
, Record
<string
, any
>> | SubschemaConfig
<any
, any
, any
, Record
<string
, any
>>[]
Defined in
packages/stitch/src/types.ts:65 (opens in a new tab)
filterInternalFieldsAndTypes
▸ filterInternalFieldsAndTypes(finalSchema
): GraphQLSchema
Parameters
Name | Type |
---|---|
finalSchema | GraphQLSchema |
Returns
GraphQLSchema
Defined in
packages/federation/src/utils.ts:43 (opens in a new tab)
getArgsFromKeysForFederation
▸ getArgsFromKeysForFederation(representations
): Object
Parameters
Name | Type |
---|---|
representations | readonly any [] |
Returns
Object
Name | Type |
---|---|
representations | readonly any [] |
Defined in
packages/federation/src/utils.ts:4 (opens in a new tab)
getCacheKeyFnFromKey
▸ getCacheKeyFnFromKey(key
): (root
: any
) => any
Parameters
Name | Type |
---|---|
key | string |
Returns
fn
▸ (root
): any
Parameters
Name | Type |
---|---|
root | any |
Returns
any
Defined in
packages/federation/src/utils.ts:29 (opens in a new tab)
getKeyFnForFederation
▸ getKeyFnForFederation(typeName
, keys
): (root
: any
) => any
Parameters
Name | Type |
---|---|
typeName | string |
keys | string [] |
Returns
fn
▸ (root
): any
Parameters
Name | Type |
---|---|
root | any |
Returns
any
Defined in
packages/federation/src/utils.ts:12 (opens in a new tab)
getKeyForFederation
▸ getKeyForFederation<TRoot
>(root
): TRoot
Type parameters
Name |
---|
TRoot |
Parameters
Name | Type |
---|---|
root | TRoot |
Returns
TRoot
Defined in
packages/federation/src/utils.ts:8 (opens in a new tab)
getNamedTypeNode
▸ getNamedTypeNode(typeNode
): NamedTypeNode
Parameters
Name | Type |
---|---|
typeNode | TypeNode |
Returns
NamedTypeNode
Defined in
packages/federation/src/utils.ts:66 (opens in a new tab)
getStitchedSchemaFromSupergraphSdl
▸ getStitchedSchemaFromSupergraphSdl(opts
): GraphQLSchema
Parameters
Name | Type |
---|---|
opts | GetSubschemasFromSupergraphSdlOpts |
Returns
GraphQLSchema
Defined in
packages/federation/src/supergraph.ts:582 (opens in a new tab)
getStitchedSchemaWithUrls
▸ getStitchedSchemaWithUrls(configs
): Promise
<GraphQLSchema
>
Parameters
Name | Type |
---|---|
configs | HTTPExecutorOptions [] |
Returns
Promise
<GraphQLSchema
>
Defined in
packages/federation/src/gateway.ts:209 (opens in a new tab)
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
Name | Type |
---|---|
executor | Executor |
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:180 (opens in a new tab)
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
Name | Type |
---|---|
schema | GraphQLSchema |
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:204 (opens in a new tab)
getSubschemaForFederationWithTypeDefs
▸ getSubschemaForFederationWithTypeDefs(typeDefs
): SubschemaConfig
Parameters
Name | Type |
---|---|
typeDefs | DocumentNode |
Returns
Defined in
packages/federation/src/gateway.ts:51 (opens in a new tab)
getSubschemaForFederationWithURL
▸ getSubschemaForFederationWithURL(config
): Promise
<SubschemaConfig
>
Parameters
Name | Type |
---|---|
config | HTTPExecutorOptions |
Returns
Promise
<SubschemaConfig
>
Defined in
packages/federation/src/gateway.ts:40 (opens in a new tab)
getSubschemasFromSupergraphSdl
▸ getSubschemasFromSupergraphSdl(«destructured»
): Map
<string
, SubschemaConfig
<any
, any
, any
, Record
<string
, any
>>>
Parameters
Name | Type |
---|---|
«destructured» | GetSubschemasFromSupergraphSdlOpts |
Returns
Map
<string
, SubschemaConfig
<any
, any
, any
, Record
<string
, any
>>>
Defined in
packages/federation/src/supergraph.ts:36 (opens in a new tab)