/* eslint-disable max-classes-per-file */ import { InputRef, inputShapeKey } from '../types'; import BaseTypeRef from './base'; import { InputFieldsFromShape, RecursivelyNormalizeNullableFields, SchemaTypes } from '..'; export default class InputObjectRef extends BaseTypeRef implements InputRef, GiraphQLSchemaTypes.InputObjectRef { override kind = 'InputObject' as const; [inputShapeKey]: T; constructor(name: string) { super('InputObject', name); } } export class ImplementableInputObjectRef< Types extends SchemaTypes, T extends object, > extends InputObjectRef> { private builder: GiraphQLSchemaTypes.SchemaBuilder; constructor(builder: GiraphQLSchemaTypes.SchemaBuilder, name: string) { super(name); this.builder = builder; } implement( options: GiraphQLSchemaTypes.InputObjectTypeOptions< Types, InputFieldsFromShape> >, ) { this.builder.inputType< ImplementableInputObjectRef, InputFieldsFromShape> >(this, options); return this as InputObjectRef; } }