@graphql-mesh/fusion-composition
Version:
Basic composition utility for Fusion spec
31 lines (30 loc) • 1.02 kB
text/typescript
import { GraphQLDirective } from 'graphql';
import type { SubgraphTransform } from '../compose.cjs';
export interface CreateHoistFieldTransformOpts {
mapping?: HoistFieldMappingObject[];
}
export interface HoistFieldMappingObject {
/**
* Type name that defines where field should be hoisted to
*/
typeName: string;
/**
* Array of field names to reach the field to be hoisted
*/
pathConfig: (string | HoistFieldTransformFieldPathConfigObject)[];
/**
* Name the hoisted field should have when hoisted to the type specified in typeName
*/
newFieldName: string;
alias?: string;
/**
* Defines if args in path are filtered (default = false)
*/
filterArgsInPath?: boolean;
}
export interface HoistFieldTransformFieldPathConfigObject {
fieldName: string;
filterArgs?: string[];
}
export declare const hoistDirective: GraphQLDirective;
export declare function createHoistFieldTransform(opts: CreateHoistFieldTransformOpts): SubgraphTransform;