InterfaceTypeComposer
Class that helps to create GraphQLInterfaceType
s and provide ability to modify them.
Static methods
static create()
Create InterfaceTypeComposer
with adding it by name to the SchemaComposer
.
static create<TCtx>(
opts:
| TypeAsString
| ComposeInterfaceTypeConfig<any, TCtx>
| GraphQLInterfaceType
): InterfaceTypeComposer<TCtx>
static createTemp()
Create InterfaceTypeComposer
without adding it to the SchemaComposer
. This method may be usefull in plugins, when you need to create type temporary.
static createTemp<TCtx>(
opts:
| TypeAsString
| ComposeInterfaceTypeConfig<any, TCtx>
| GraphQLInterfaceType
): InterfaceTypeComposer<TCtx>
Properties
schemaComposer
Current SchemaComposer
instance which is used for storing types created by InterfaceTypeComposer
.
SomeIFTC.schemaComposer: SchemaComposer
Field methods
hasField()
hasField(
name: string
): boolean
getFields()
getFields(): ComposeFieldConfigMap<any, TContext>
getField()
getField(
name: string
): ComposeFieldConfig<any, TContext>
getFieldNames()
getFieldNames(): string[]
setFields()
setFields(
fields: ComposeFieldConfigMap<any, TContext>
): InterfaceTypeComposer<TContext>
setField()
setField(
name: string,
fieldConfig: ComposeFieldConfig<any, TContext>
): InterfaceTypeComposer<TContext>
addFields()
Add new fields or replace existed in a GraphQL type
addFields(
newValues: ComposeFieldConfigMap<any, TContext>
): InterfaceTypeComposer<TContext>
removeField()
removeField(
nameOrArray: string | string[]
): InterfaceTypeComposer<TContext>
removeOtherFields()
removeOtherFields(
fieldNameOrArray: string | string[]
): InterfaceTypeComposer<TContext>
reorderFields()
reorderFields(
names: string[]
): InterfaceTypeComposer<TContext>
extendField()
extendField(
fieldName: string,
parialFieldConfig: ComposeFieldConfig<any, TContext>
): InterfaceTypeComposer<TContext>
isFieldNonNull()
isFieldNonNull(
fieldName: string
): boolean
getFieldConfig()
getFieldConfig(
fieldName: string
): GraphQLFieldConfig<any, TContext>
getFieldType()
getFieldType(
fieldName: string
): GraphQLOutputType
getFieldTC()
getFieldTC(
fieldName: string
): TypeComposer<TContext>
makeFieldNonNull()
makeFieldNonNull(
fieldNameOrArray: string | string[]
): InterfaceTypeComposer<TContext>
makeFieldNullable()
makeFieldNullable(
fieldNameOrArray: string | string[]
): InterfaceTypeComposer<TContext>
deprecateFields()
deprecateFields(
fields: { [fieldName: string]: string } | string[] | string
): this
getFieldArgs()
getFieldArgs(
fieldName: string
): GraphQLFieldConfigArgumentMap
hasFieldArg()
hasFieldArg(
fieldName: string,
argName: string
): boolean
getFieldArg()
getFieldArg(
fieldName: string,
argName: string
): GraphQLArgumentConfig
getFieldArgType()
getFieldArgType(
fieldName: string,
argName: string
): GraphQLInputType
Type methods
getType()
getType(): GraphQLInterfaceType
getTypePlural()
getTypePlural(): GraphQLList<GraphQLInterfaceType>
getTypeNonNull()
getTypeNonNull(): GraphQLNonNull<GraphQLInterfaceType>
getTypeName()
getTypeName(): string
setTypeName()
setTypeName(
name: string
): InterfaceTypeComposer<TContext>
getDescription()
getDescription(): string
setDescription()
setDescription(
description: string
): InterfaceTypeComposer<TContext>
clone()
clone(
newTypeName: string
): InterfaceTypeComposer<TContext>
InputType methods
getInputType()
getInputType(): GraphQLInputObjectType;
hasInputTypeComposer()
hasInputTypeComposer(): boolean;
setInputTypeComposer()
setInputTypeComposer(
itc: InputTypeComposer
): this;
getInputTypeComposer()
getInputTypeComposer(): InputTypeComposer;
getITC()
An alias for getInputTypeComposer
.
getITC(): InputTypeComposer;
removeInputTypeComposer()
removeInputTypeComposer(): this;
ResolveType methods
hasTypeResolver()
hasTypeResolver(
type: TypeComposer<TContext> | GraphQLObjectType
): boolean
getTypeResolvers()
getTypeResolvers(): InterfaceTypeResolversMap<any, TContext>
getTypeResolverCheckFn()
getTypeResolverCheckFn(
type: TypeComposer<TContext> | GraphQLObjectType
): InterfaceTypeResolverCheckFn<any, TContext>
getTypeResolverNames()
getTypeResolverNames(): string[]
getTypeResolverTypes()
getTypeResolverTypes(): GraphQLObjectType[]
setTypeResolvers()
setTypeResolvers(
typeResolversMap: InterfaceTypeResolversMap<any, TContext>
): InterfaceTypeComposer<TContext>
addTypeResolver()
addTypeResolver(
type: TypeComposer<TContext> | GraphQLObjectType,
checkFn: InterfaceTypeResolverCheckFn<any, TContext>
): InterfaceTypeComposer<TContext>
removeTypeResolver()
removeTypeResolver(
type: TypeComposer<TContext> | GraphQLObjectType
): InterfaceTypeComposer<TContext>
Misc methods
get()
get(
path: string | string[]
): any
Internal type definitions
Flowtype definitions which are used in this class.
type InterfaceTypeComposerDefinition<TContext> =
| TypeAsString
| ComposeInterfaceTypeConfig<any, TContext>
InterfaceTypeResolversMap<TSource, TContext>
type InterfaceTypeResolversMap<TSource, TContext> = Map<
TypeComposer<TContext> | GraphQLObjectType,
InterfaceTypeResolverCheckFn<TSource, TContext>
>;
MaybePromise<+T>
type MaybePromise<+T> = Promise<T> | T;
InterfaceTypeResolverCheckFn<TSource, TContext>
type InterfaceTypeResolverCheckFn<TSource, TContext> = (
value: TSource,
context: TContext,
info: GraphQLResolveInfo
) => MaybePromise<?boolean>;
ComposeInterfaceTypeConfig<TSource, TContext>
type ComposeInterfaceTypeConfig<TSource, TContext> = {
+name: string,
+fields?: Thunk<ComposeFieldConfigMap<TSource, TContext>>,
+resolveType?: ?GraphQLTypeResolver<TSource, TContext>,
+description?: ?string,
};