import { GraphQLField, FieldDefinitionNode } from "graphql"; import { Args, ResolveFunction, FieldType, StringKeyOf, InputField, KeyValue, ClassType, InputType, Context } from "../.."; import { GQLField } from "./GQLField"; export declare type SubscriptionFunction = (args: ArgsType, context: Context) => Promise | ReturnType; export declare class Field extends GQLField, NameType, ExtensionsType> { private _args; private _doParseArgs; private _resolver; private _subscription; private _middlewares; get args(): Args[]; get flatArgs(): import("./Arg").Arg[]; get doParseArgs(): boolean; get resolver(): ResolveFunction; get subscription(): SubscriptionFunction; get middlewares(): ResolveFunction[]; get definitionNode(): FieldDefinitionNode; protected constructor(name: NameType & string, type: FieldType); /** * Create a new Field for ObjectType and InterfaceType */ static create(name: StringKeyOf, type: FieldType): Field>; static create(name: string, type: FieldType): Field; static create(field: InputField): Field>; static create(field: Field): Field>; build(): GraphQLField; /** * Set the middlewares to your field * A middleware is executed before your main function * @param middlewares The middlewares list */ setMiddlewares(...middlewares: ResolveFunction[]): this; /** * Add some middlewares to your field * A middleware is executed before your main function * @param middlewares The middlewares list */ addMiddlewares(...middlewares: ResolveFunction[]): this; /** * Remove some middlewares from your field * @param middlewares The middlewares list */ removeMiddlewares(...middlewares: ResolveFunction[]): this; /** * If you don't want to parse your aguments objects into the specified class (enabled by default) */ disableArgsParsing(): this; /** * If you want to parse your aguments objects into the specified class (enabled by default) */ enableArgsParsing(): this; /** * Set the arguments of your field * @param args The aguments */ setArgs(...args: Args[]): this; /** * Add arguments to your field * @param args The aguments */ addArgs(...args: Args[]): this; /** * Set the resolver function to your field * @param args The aguments */ setResolver(resolver: ResolveFunction, ...args: Args>[]): this; /** * Set the resolver function to your field * @param args The aguments */ setSubscription(subscription: SubscriptionFunction): this; /** * Copy the field and return a new one */ copy(): Field; /** * Convert your field into a new field type * @param to The target type */ convert(to: typeof InputField): InputField; protected parseArgs(args: (Args | InputType)[], values: KeyValue): any; private resolveField; private subscribe; private next; }