@graphql-mesh/compose-cli
Version:
39 lines (38 loc) • 1.43 kB
text/typescript
import type { DocumentNode, GraphQLSchema } from 'graphql';
import type { ComposeSubgraphsOptions } from '@graphql-mesh/fusion-composition';
import type { Logger, MeshFetch } from '@graphql-mesh/types';
import type { MaybePromise } from '@graphql-tools/utils';
export interface MeshComposeCLIConfig extends ComposeSubgraphsOptions {
/**
* The output destination of the resulting composed GraphQL schema.
* By default, the CLI will write the result to stdout.
*/
output?: string;
subgraphs: MeshComposeCLISubgraphConfig[];
/**
* TODO: Implement root level transforms later
transforms?: MeshComposeCLITransformConfig[];
*/
additionalTypeDefs?: string | DocumentNode | (string | DocumentNode)[];
subgraph?: string;
fetch?: MeshFetch;
cwd?: string;
}
export interface MeshComposeCLISubgraphConfig {
sourceHandler: MeshComposeCLISourceHandlerDef;
transforms?: MeshComposeCLITransformConfig[];
}
export type MeshComposeCLISourceHandlerDef = (ctx: LoaderContext) => {
name: string;
schema$: MaybePromise<GraphQLSchema>;
};
export type MeshComposeCLITransformConfig = (input: GraphQLSchema, ...args: any[]) => GraphQLSchema;
export interface LoaderContext {
fetch: MeshFetch;
cwd: string;
logger: Logger;
}
/**
* Type helper for defining the config.
*/
export declare function defineConfig(config: MeshComposeCLIConfig): MeshComposeCLIConfig;