UNPKG

1.45 kBTypeScriptView Raw
1import { GraphQLSchema, FieldNode, GraphQLArgument } from 'graphql';
2import { Request, ExecutionResult } from '@graphql-tools/utils';
3import { Transform, DelegationContext, SubschemaConfig } from '@graphql-tools/delegate';
4export default class HoistField implements Transform {
5 private readonly typeName;
6 private readonly newFieldName;
7 private readonly pathToField;
8 private readonly oldFieldName;
9 private readonly argFilters;
10 private readonly argLevels;
11 private readonly transformer;
12 constructor(typeName: string, pathConfig: Array<string | {
13 fieldName: string;
14 argFilter?: (arg: GraphQLArgument) => boolean;
15 }>, newFieldName: string, alias?: string);
16 transformSchema(originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig, transformedSchema?: GraphQLSchema): GraphQLSchema;
17 transformRequest(originalRequest: Request, delegationContext: DelegationContext, transformationContext: Record<string, any>): Request;
18 transformResult(originalResult: ExecutionResult, delegationContext: DelegationContext, transformationContext: Record<string, any>): ExecutionResult;
19}
20export declare function wrapFieldNode(fieldNode: FieldNode, path: Array<string>, alias: string, argLevels: Record<string, number>): FieldNode;
21export declare function renameFieldNode(fieldNode: FieldNode, name: string): FieldNode;
22export declare function unwrapValue(originalValue: any, alias: string): any;