ScalarTypeComposer
ScalarTypeComposer
is a class which helps to create and modify GraphQLScalarType
.
Static methods
static create()
static create<TCtx = any>(
typeDef: ScalarTypeComposeDefinition,
schemaComposer: SchemaComposer<TCtx>
): ScalarTypeComposer<TCtx>
Create ScalarTypeComposer
with adding it by name to the SchemaComposer
. This type became avaliable in SDL by its name.
static createTemp()
static createTemp<TCtx = any>(
typeDef: ScalarTypeComposeDefinition,
schemaComposer: SchemaComposer<TCtx>
): ScalarTypeComposer<TCtx>
Create ScalarTypeComposer
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>;
Serialize methods
setSerialize()
setSerialize(
fn: GraphQLScalarSerializer<any>
): void
getSerialize()
getSerialize(): GraphQLScalarSerializer<any>
setParseValue()
setParseValue(
fn: GraphQLScalarValueParser<any> | void
): void
getParseValue()
getParseValue(): GraphQLScalarValueParser<any>
setParseLiteral()
setParseLiteral(
fn: GraphQLScalarLiteralParser<any> | void
): void
getParseLiteral()
getParseLiteral(): GraphQLScalarLiteralParser<any>
Type methods
getType()
getType(): GraphQLScalarType
getTypePlural()
getTypePlural(): GraphQLList<GraphQLScalarType>
getTypeNonNull()
getTypeNonNull(): GraphQLNonNull<GraphQLScalarType>
getTypeName()
getTypeName(): string
setTypeName()
setTypeName(
name: string
): this
getDescription()
getDescription(): string
setDescription()
setDescription(
description: string
): this
clone()
clone(
newTypeName: string
): ScalarTypeComposer<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
Internal type definitions
ComposeScalarTypeConfig
export type ComposeScalarTypeConfig = GraphQLScalarTypeConfig<any, any> & {
extensions?: Extensions;
};
ScalarTypeComposeDefinition
export type ScalarTypeComposeDefinition =
| TypeAsString
| ComposeScalarTypeConfig
| GraphQLScalarType;
GraphQLScalarTypeExtended
export type GraphQLScalarTypeExtended = GraphQLScalarType & {
_gqcExtensions?: Extensions;
};