import { ObjectTypeOptions , ObjectType } from '@nestjs/graphql' ; import { isString } from 'util' ; import { NodeInterface } from './node.interface' ; import { MetadataStorage , AnyConstructor } from '../../common' ; export function NodeType ( ) ; export function NodeType ( options ) ; export function NodeType ( name , options ? ) ; export function NodeType < T extends AnyConstructor < T > > ( nameOrOptions ? , objectTypeOptions ? ) { return ( target ) => { const [ name , options = { } ] = isString ( nameOrOptions ) ? [ nameOrOptions , objectTypeOptions ] : [ target . name , nameOrOptions ] ; const interfaces = options . implements ? [ ] . concat ( options . implements as never ) : [ ] ; const nodeOptions = { ... options , implements : interfaces . concat ( NodeInterface as never ) , } ; MetadataStorage . addClassMetadata ( { name , target } ) ; ObjectType ( name , nodeOptions ) ( target ) ; } ; }