import type { PluginBuilderLens } from './builder'; import type { InputDefinitionBlock, OutputDefinitionBlock } from './definitions/definitionBlocks'; import type { NexusWrapKind } from './definitions/wrapping'; export declare type OutputFactoryConfig = { /** The name of the type this field is being declared on */ typeName: string; stage: 'walk' | 'build'; args: any[]; builder: PluginBuilderLens; typeDef: OutputDefinitionBlock; /** The list of chained wrapping calls leading up to this dynamic method */ wrapping?: NexusWrapKind[]; }; export declare type InputFactoryConfig = { args: any[]; builder: PluginBuilderLens; typeDef: InputDefinitionBlock; /** The name of the type this field is being declared on */ typeName: string; /** The list of chained wrapping calls leading up to this dynamic method */ wrapping?: NexusWrapKind[]; }; export interface BaseExtensionConfig { /** The name of the "extension", the field made available on the builders */ name: T; /** The full type definition for the options, including generic signature for the type */ typeDefinition?: string; /** Description inserted above the typeDefinition for the field, will be formatted as JSDOC by Nexus */ typeDescription?: string; } export interface DynamicOutputMethodConfig extends BaseExtensionConfig { /** Invoked when the field is called */ factory(config: OutputFactoryConfig): any; } export interface DynamicInputMethodConfig extends BaseExtensionConfig { /** Invoked when the field is called */ factory(config: InputFactoryConfig): any; } export declare class DynamicInputMethodDef { readonly name: Name; protected config: DynamicInputMethodConfig; constructor(name: Name, config: DynamicInputMethodConfig); get value(): DynamicInputMethodConfig; } export declare class DynamicOutputMethodDef { readonly name: Name; protected config: DynamicOutputMethodConfig; constructor(name: Name, config: DynamicOutputMethodConfig); get value(): DynamicOutputMethodConfig; } /** * Defines a new property on the object definition block for an output type, taking arbitrary input to define * additional types. See the connectionPlugin: * * T.connectionField('posts', { nullable: true, totalCount(root, args, ctx, info) { return * ctx.user.getTotalPostCount(root.id, args) }, nodes(root, args, ctx, info) { return * ctx.user.getPosts(root.id, args) } }) */ export declare function dynamicOutputMethod(config: DynamicOutputMethodConfig): DynamicOutputMethodDef; /** Same as the outputFieldExtension, but for fields that should be added on as input types. */ export declare function dynamicInputMethod(config: DynamicInputMethodConfig): DynamicInputMethodDef;