InputTypeComposer
Static methods
static create()
static create<TCtx = any>(
typeDef: InputTypeComposeDefinition,
schemaComposer: SchemaComposer<TCtx>
): InputTypeComposer<TCtx>
Create InputTypeComposer
with adding it by name to the SchemaComposer
.
static createTemp()
static createTemp<TCtx = any>(
typeDef: InputTypeComposeDefinition,
schemaComposer: SchemaComposer<TCtx>
): InputTypeComposer<TCtx>
Create InputTypeComposer
without adding it to the SchemaComposer
. This method may be usefull in plugins, when you need to create type temporary.
Properties
schemaComposer
schemaComposer: SchemaComposer<TContext>;
Field methods
getFields()
getFields(): ComposeInputFieldConfigMap
getFieldNames()
getFieldNames(): string[]
hasField()
hasField(
fieldName: string
): boolean
setFields()
setFields(
fields: ComposeInputFieldConfigMap
): this
setField()
setField(
fieldName: string,
fieldConfig: ComposeInputFieldConfig
): this
addFields()
addFields(
newFields: ComposeInputFieldConfigMap
): this
Add new fields or replace existed in a GraphQL type
addNestedFields()
addNestedFields(
newFields: ComposeInputFieldConfigMap
): this
Add new fields or replace existed (where field name may have dots)
getField()
getField(
fieldName: string
): ComposeInputFieldConfig
removeField()
removeField(
fieldNameOrArray: string | string[]
): this
removeOtherFields()
removeOtherFields(
fieldNameOrArray: string | string[]
): this
extendField()
extendField(
fieldName: string,
partialFieldConfig: Partial<ComposeInputFieldConfig>
): this
reorderFields()
reorderFields(
names: string[]
): this
isFieldNonNull()
isFieldNonNull(
fieldName: string
): boolean
isRequired()
isRequired(
fieldName: string
): boolean
An alias for isFieldNonNull
getFieldConfig()
getFieldConfig(
fieldName: string
): GraphQLInputFieldConfig
getFieldType()
getFieldType(
fieldName: string
): GraphQLInputType
getFieldTC()
getFieldTC(
fieldName: string
):
| InputTypeComposer<TContext>
| EnumTypeComposer<TContext>
| ScalarTypeComposer<TContext>
makeFieldNonNull()
makeFieldNonNull(
fieldNameOrArray: string | string[]
): this
makeRequired()
makeRequired(
fieldNameOrArray: string | string[]
): this
An alias for makeFieldNonNull
makeFieldNullable()
makeFieldNullable(
fieldNameOrArray: string | string[]
): this
makeOptional()
makeOptional(
fieldNameOrArray: string | string[]
): this
An alias for makeFieldNullable
Type methods
getType()
getType(): GraphQLInputObjectType
getTypePlural()
getTypePlural(): GraphQLList<GraphQLInputObjectType>
getTypeNonNull()
getTypeNonNull(): GraphQLNonNull<GraphQLInputObjectType>
getTypeName()
getTypeName(): string
setTypeName()
setTypeName(
name: string
): this
getDescription()
getDescription(): string
setDescription()
setDescription(
description: string
): this
clone()
clone(
newTypeName: string
): InputTypeComposer<TContext>
Extensions methods
getExtensions()
getExtensions(): Extensions
setExtensions()
setExtensions(
extensions: Extensions
): this
extendExtensions()
extendExtensions(
extensions: Extensions
): this
clearExtensions()
clearExtensions(): this
getExtension()
getExtension(
extensionName: string
): any
hasExtension()
hasExtension(
extensionName: string
): boolean
setExtension()
setExtension(
extensionName: string,
value: any
): this
removeExtension()
removeExtension(
extensionName: string
): this
getFieldExtensions()
getFieldExtensions(
fieldName: string
): Extensions
setFieldExtensions()
setFieldExtensions(
fieldName: string,
extensions: Extensions
): this
extendFieldExtensions()
extendFieldExtensions(
fieldName: string,
extensions: Extensions
): this
clearFieldExtensions()
clearFieldExtensions(
fieldName: string
): this
getFieldExtension()
getFieldExtension(
fieldName: string,
extensionName: string
): any
hasFieldExtension()
hasFieldExtension(
fieldName: string,
extensionName: string
): boolean
setFieldExtension()
setFieldExtension(
fieldName: string,
extensionName: string,
value: any
): this
removeFieldExtension()
removeFieldExtension(
fieldName: string,
extensionName: string
): this
Misc methods
get()
get(
path: string | string[]
): any
Internal type definitions
GraphQLInputObjectTypeExtended
export type GraphQLInputObjectTypeExtended = GraphQLInputObjectType & {
_gqcFields?: ComposeInputFieldConfigMap;
_gqcExtensions?: Extensions;
};
ComposeInputFieldConfigMap
export type ComposeInputFieldConfigMap = ObjMap<ComposeInputFieldConfig>;
ComposeInputFieldConfig
export type ComposeInputFieldConfig =
| ComposeInputFieldConfigAsObject
| ComposeInputType
| (() => ComposeInputFieldConfigAsObject | ComposeInputType);
ComposeInputFieldConfigAsObject
export type ComposeInputFieldConfigAsObject = {
type: Thunk<ComposeInputType> | GraphQLInputType;
defaultValue?: any;
description?: string | null;
astNode?: InputValueDefinitionNode | null;
extensions?: Extensions;
[key: string]: any;
};
ComposeInputType
export type ComposeInputType =
| InputTypeComposer<any>
| EnumTypeComposer<any>
| ScalarTypeComposer<any>
| GraphQLInputType
| TypeAsString
| Array<
| InputTypeComposer<any>
| EnumTypeComposer<any>
| ScalarTypeComposer<any>
| GraphQLInputType
| TypeAsString
>;
ComposeInputObjectTypeConfig
export type ComposeInputObjectTypeConfig = {
name: string;
fields: Thunk<ComposeInputFieldConfigMap>;
description?: string | null;
extensions?: Extensions;
};
InputTypeComposeDefinition
export type InputTypeComposeDefinition =
| TypeAsString
| ComposeInputObjectTypeConfig
| GraphQLInputObjectType;