Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/pothos/packages/core/builder.ts>default

Pothos GraphQL is library for creating GraphQL schemas in typescript using a strongly typed code first approach
Go to Latest
class default
import { default } from "https://deno.land/x/pothos@release-1670043728/packages/core/builder.ts";

Constructors

new
default(options: NormalizeSchemeBuilderOptions<Types>)

Type Parameters

Types extends SchemaTypes

Properties

configStore: ConfigStore<Types>
defaultFieldNullability: boolean
defaultInputFieldRequiredness: boolean
options: NormalizeSchemeBuilderOptions<Types>

Methods

addScalarType<Name extends ScalarName<Types>>(
name: Name,
scalar: GraphQLScalarType,
options: Omit<PothosSchemaTypes.ScalarTypeOptions<Types, InputShape<Types, Name>, OutputShape<Types, Name>>, "serialize"> & { serialize?: GraphQLScalarSerializer<OutputShape<Types, Name>>; },
)
args<Shape extends InputFieldMap>(fields: (t: PothosSchemaTypes.InputFieldBuilder<Types, "Arg">) => Shape): Shape
enumType<Param extends EnumParam, Values extends EnumValues<Types>>(param: Param, options: EnumTypeOptions<Types, Param, Values>)
inputRef<T extends object>(name: string): ImplementableInputObjectRef<Types, T>
inputType<Param extends InputObjectRef<unknown> | string, Fields extends Param extends PothosSchemaTypes.InputObjectRef<unknown> ? InputFieldsFromShape<InputShape<Types, Param> & { }> : InputFieldMap>(param: Param, options: PothosSchemaTypes.InputObjectTypeOptions<Types, Fields>): PothosSchemaTypes.InputObjectRef<InputShapeFromFields<Fields>>
interfaceField<Type extends InterfaceParam<Types>>(
ref: Type,
fieldName: string,
field: InterfaceFieldThunk<Types, ParentShape<Types, Type>>,
)
interfaceFields<Type extends InterfaceParam<Types>>(ref: Type, fields: InterfaceFieldsShape<Types, ParentShape<Types, Type>>)
interfaceRef<T>(name: string): ImplementableInterfaceRef<Types, T>
interfaceType<Param extends InterfaceParam<Types>, Interfaces extends InterfaceParam<Types>[], ResolveType>(
param: Param,
options: InterfaceTypeOptions<Types, Param, ParentShape<Types, Param>, Interfaces, ResolveType>,
fields?: InterfaceFieldsShape<Types, ParentShape<Types, Param>>,
)
mutationField(name: string, field: MutationFieldThunk<Types>)
mutationFields(fields: MutationFieldsShape<Types>)
mutationType(...args: NormalizeArgs<[PothosSchemaTypes.MutationTypeOptions<Types>, MutationFieldsShape<Types>], 0>)
objectField<Type extends ObjectParam<Types>>(
ref: Type,
fieldName: string,
field: ObjectFieldThunk<Types, ParentShape<Types, Type>>,
)
objectFields<Type extends ObjectParam<Types>>(ref: Type, fields: ObjectFieldsShape<Types, ParentShape<Types, Type>>)
objectRef<T>(name: string): ImplementableObjectRef<Types, T>
objectType<Interfaces extends InterfaceParam<Types>[], Param extends ObjectParam<Types>>(
param: Param,
options: ObjectTypeOptions<Types, Param, ParentShape<Types, Param>, Interfaces>,
fields?: ObjectFieldsShape<Types, ParentShape<Types, Param>>,
)
queryField(name: string, field: QueryFieldThunk<Types>)
queryFields(fields: QueryFieldsShape<Types>)
queryType(...args: NormalizeArgs<[PothosSchemaTypes.QueryTypeOptions<Types>, QueryFieldsShape<Types>], 0>)
scalarType<Name extends ScalarName<Types>>(name: Name, options: PothosSchemaTypes.ScalarTypeOptions<Types, InputShape<Types, Name>, ParentShape<Types, Name>>)
subscriptionField(name: string, field: SubscriptionFieldThunk<Types>)
subscriptionFields(fields: SubscriptionFieldsShape<Types>)
subscriptionType(...args: NormalizeArgs<[PothosSchemaTypes.SubscriptionTypeOptions<Types>, SubscriptionFieldsShape<Types>], 0>)
toSchema(...args: NormalizeArgs<[PothosSchemaTypes.BuildSchemaOptions<Types>]>)
unionType<Member extends ObjectParam<Types>, ResolveType>(name: string, options: PothosSchemaTypes.UnionTypeOptions<Types, Member, ResolveType>)

Static Properties

allowPluginReRegistration: boolean
plugins: Partial<PluginConstructorMap<SchemaTypes>>

Static Methods

registerPlugin<T extends keyof PluginConstructorMap<SchemaTypes>>(name: T, plugin: PluginConstructorMap<SchemaTypes>[T])