import { assertValidName } from 'graphql' import { GetGen } from '../typegenTypeHelpers' import { InputDefinitionBlock } from './definitionBlocks' import { NexusTypes, withNexusSymbol } from './_types' export interface NexusExtendInputTypeConfig { type: TypeName definition(t: InputDefinitionBlock): void } export class NexusExtendInputTypeDef { constructor(readonly name: TypeName, protected config: NexusExtendInputTypeConfig & { name: string }) { assertValidName(name) } get value() { return this.config } } withNexusSymbol(NexusExtendInputTypeDef, NexusTypes.ExtendInputObject) /** * Adds new fields to an existing inputObjectType in the schema. Useful when * splitting your schema across several domains. * * @see https://nexusjs.org/docs/api/extend-type */ export function extendInputType>( config: NexusExtendInputTypeConfig ) { return new NexusExtendInputTypeDef(config.type, { ...config, name: config.type, }) }