Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pothos/packages/core/mod.ts>BasePlugin

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

Constructors

new
BasePlugin(buildCache: BuildCache<Types>, name: keyof PothosSchemaTypes.Plugins<Types>)

Type Parameters

Types extends SchemaTypes
optional
T extends object = object

Properties

private
requestDataMap
buildCache
builder
name
options

Methods

protected
createRequestData(context: Types["Context"]): T

Creates a data object unique to the current request for use by this plugin

protected
requestData(context: Types["Context"]): T

Returns a data object for the current request. requires createRequestData to be implemented

protected
runUnique<R>(key: unknown, cb: () => R): R

Called after all fields and types have been built during builder.toSchema()

Called before builder.toSchema() schema is called

Called for each Enum value defined in your schema

Called for each argument or field on an Input object defined in your schema

Called for each field on an Object or Interface type

Called for each type defined with the SchemaBuilder

wrapIsTypeOf(isTypeOf: GraphQLIsTypeOfFn<unknown, Types["Context"]> | undefined, typeConfig: PothosObjectTypeConfig): GraphQLIsTypeOfFn<unknown, Types["Context"]> | undefined

Called with the isTypeOf for each Object type

wrapResolve(resolver: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>

Called with the resolver for each field in the schema

wrapResolveType(resolveType: GraphQLTypeResolver<unknown, Types["Context"]>, typeConfig: PothosInterfaceTypeConfig | PothosUnionTypeConfig): GraphQLTypeResolver<unknown, Types["Context"]>

Called with the resolveType for each Interface or Union type

wrapSubscribe(subscribe: GraphQLFieldResolver<unknown, Types["Context"], object> | undefined, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object> | undefined

Called with the subscribe for each field on the Subscription type