graphql-composer
Version:
Create your GraphQL API using composition!
32 lines (31 loc) • 1.73 kB
TypeScript
import { InputField, ObjectType, InterfaceType, Removable, ClassType, InstanceOf, StringKeyOf, Args } from "../../../..";
import { GraphQLInputObjectType, InputObjectTypeDefinitionNode } from "graphql";
import { GQLType } from "../GQLType";
export declare class InputType<T extends ClassType = any, ExtensionsType = any> extends GQLType<GraphQLInputObjectType, T, ExtensionsType> {
protected _fields: InputField<StringKeyOf<InstanceOf<T>>>[];
get fields(): InputField<StringKeyOf<InstanceOf<T>>, any>[];
protected constructor(name: string);
get definitionNode(): InputObjectTypeDefinitionNode;
/**
* Create a new InputType
*/
static create<T = any>(name: string): InputType<ClassType<T>>;
static create<T = any>(inputType: InputType): InputType<ClassType<T>>;
static create<T = any>(objectType: ObjectType): InputType<ClassType<T>>;
static create<T = any>(interfaceType: InterfaceType): InputType<ClassType<T>>;
static create<T = any>(classType: ClassType<T>): InputType<ClassType<T>>;
build(): GraphQLInputObjectType;
setFields(...fields: InputField<StringKeyOf<InstanceOf<T>>>[]): InputType<T>;
addFields(...fields: InputField<StringKeyOf<InstanceOf<T>>>[]): InputType<T>;
removeFields(...fields: Removable<InputField<StringKeyOf<InstanceOf<T>>>>): InputType<T>;
/**
* Add a suffix to the name of your type ("Input" by default)
* @param suffix The suffix to add to the name
*/
suffix(suffix?: string): this;
copy(): InputType<T>;
convert(to: typeof ObjectType): ObjectType<T>;
convert(to: typeof InterfaceType): InterfaceType<T>;
convert(to: typeof Args): Args<T>;
transformFields(cb: (field: InputField) => void): this;
}