UNPKG

@giraphql/plugin-simple-objects

Version:

A GiraphQL plugin for defining objects and interfaces without ts definitions for those types

29 lines 2.41 kB
import { FieldMap, FieldNullability, InputFieldMap, InterfaceParam, Normalize, ParentShape, SchemaTypes, TypeParam } from '@giraphql/core'; import { OutputShapeFromFields, SimpleObjectFieldsShape } from './types'; import { GiraphQLSimpleObjectsPlugin } from '.'; declare global { export namespace GiraphQLSchemaTypes { interface Plugins<Types extends SchemaTypes> { simpleObjects: GiraphQLSimpleObjectsPlugin<Types>; } interface SchemaBuilder<Types extends SchemaTypes> { simpleObject: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & ParentShape<Types, Interfaces[number]>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>) => ObjectRef<Shape>; simpleInterface: <Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<SchemaTypes>[]>(name: string, options: SimpleInterfaceTypeOptions<Types, Fields, Shape, Interfaces>) => InterfaceRef<Shape>; } interface GiraphQLKindToGraphQLType { SimpleObject: 'Object'; SimpleInterface: 'Interface'; } interface FieldOptionsByKind<Types extends SchemaTypes, ParentShape, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, Args extends InputFieldMap, ResolveShape, ResolveReturnShape> { SimpleObject: Omit<ObjectFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveReturnShape>, 'resolve'>; SimpleInterface: Omit<InterfaceFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveReturnShape>, 'resolve'>; } type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, 'fields'> & { fields?: SimpleObjectFieldsShape<Types, Fields>; }; interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<SchemaTypes>[]> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'args' | 'fields'> { fields?: SimpleObjectFieldsShape<Types, Fields>; } } } //# sourceMappingURL=global-types.d.ts.map