UNPKG

@pothos/plugin-add-graphql

Version:

A Pothos plugin for adding existing GraphQL types to a Pothos schema

36 lines (35 loc) 2.11 kB
import type { NormalizeArgs, SchemaTypes } from '@pothos/core'; import type { GraphQLEnumType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLSchema, GraphQLUnionType } from 'graphql'; import type { PothosAddGraphQLPlugin } from './index.js'; import type { AddGraphQLEnumTypeOptions, AddGraphQLInputTypeOptions, AddGraphQLInterfaceTypeOptions, AddGraphQLObjectTypeOptions, AddGraphQLUnionTypeOptions, EnumValuesWithShape } from './types.js'; declare global { export namespace PothosSchemaTypes { interface Plugins<Types extends SchemaTypes> { addGraphQL: PothosAddGraphQLPlugin<Types>; } interface SchemaBuilderOptions<Types extends SchemaTypes> { add?: { schema?: GraphQLSchema; types?: GraphQLNamedType[] | Record<string, GraphQLNamedType>; }; } interface SchemaBuilder<Types extends SchemaTypes> { addGraphQLObject: <Shape>(type: GraphQLObjectType<Shape>, ...args: NormalizeArgs<[ options: AddGraphQLObjectTypeOptions<Types, Shape> ]>) => ObjectRef<Types, Shape>; addGraphQLInterface: <Shape>(type: GraphQLInterfaceType, ...args: NormalizeArgs<[ options: AddGraphQLInterfaceTypeOptions<Types, Shape> ]>) => InterfaceRef<Types, Shape>; addGraphQLUnion: <Shape>(type: GraphQLUnionType, ...args: NormalizeArgs<[ options: AddGraphQLUnionTypeOptions<Types, ObjectRef<Types, Shape>> ]>) => UnionRef<Types, Shape>; addGraphQLEnum: <Shape extends number | string>(type: GraphQLEnumType, ...args: NormalizeArgs<[ options: AddGraphQLEnumTypeOptions<Types, EnumValuesWithShape<Types, Shape>> ]>) => EnumRef<Types, Shape>; addGraphQLInput: <Shape extends {}>(type: GraphQLInputObjectType, ...args: NormalizeArgs<[ options: AddGraphQLInputTypeOptions<Types, Shape> ]>) => InputObjectRef<Types, Shape>; } } } //# sourceMappingURL=global-types.d.ts.map