@graphql-mesh/fusion-composition
Version:
Basic composition utility for Fusion spec
49 lines (48 loc) • 1.94 kB
text/typescript
import { GraphQLSchema } from 'graphql';
import type { ServiceDefinition } from '@theguild/federation-composition';
export interface SubgraphConfig {
name: string;
schema: GraphQLSchema;
transforms?: SubgraphTransform[];
url?: string;
}
export type SubgraphTransform = (schema: GraphQLSchema, subgraphConfig: SubgraphConfig) => GraphQLSchema;
export interface GetMeshFederationTypeDefsForDirectivesOpts {
meshDirectiveNames?: string[];
federationDirectiveNames?: string[];
federationVersion?: string;
}
export declare function getUnifiedGraphGracefully(subgraphs: SubgraphConfig[]): string;
export declare function getAnnotatedSubgraphs(subgraphs: SubgraphConfig[], options?: GetAnnotatedSubgraphsOptions): ServiceDefinition[];
export interface GetAnnotatedSubgraphsOptions {
/**
* If set to true, the composition will ignore the semantic conventions and will not add any automatic type merging configuration based on ById and ByIds naming conventions.
*
* @default false
*/
ignoreSemanticConventions?: boolean;
alwaysAddTransportDirective?: boolean;
}
export type ComposeSubgraphsOptions = GetAnnotatedSubgraphsOptions;
export declare function composeSubgraphs(subgraphs: SubgraphConfig[], options?: ComposeSubgraphsOptions): {
subgraphs: SubgraphConfig[];
supergraphSdl: string;
annotatedSubgraphs: ServiceDefinition[];
errors: import("graphql").GraphQLError[];
} | {
subgraphs: SubgraphConfig[];
supergraphSdl: string;
annotatedSubgraphs: ServiceDefinition[];
publicSdl: string;
errors?: undefined;
};
export declare function composeAnnotatedSubgraphs(annotatedSubgraphs: ServiceDefinition[]): {
supergraphSdl: string;
annotatedSubgraphs: ServiceDefinition[];
errors: import("graphql").GraphQLError[];
} | {
supergraphSdl: string;
annotatedSubgraphs: ServiceDefinition[];
publicSdl: string;
errors?: undefined;
};