ScalarTypeComposer
ScalarTypeComposer
is a class which helps to create and modify GraphQLScalarType
.
Static methods
static create()
static create<TCtx = any>(
typeDef: ScalarTypeComposerDefinition,
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: ScalarTypeComposerDefinition,
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(): ListComposer<ScalarTypeComposer<TContext>>
getTypeNonNull()
getTypeNonNull(): NonNullComposer<ScalarTypeComposer<TContext>>
getTypeName()
getTypeName(): string
setTypeName()
setTypeName(
name: string
): this
getDescription()
getDescription(): string
setDescription()
setDescription(
description: string
): this
clone()
clone(
newTypeNameOrTC: string | ScalarTypeComposer<any>
): ScalarTypeComposer<TContext>
You may clone this type with a new provided name as string. Or you may provide a new TypeComposer which will get all clonned settings from this type.
merge()
merge(
type: GraphQLScalarType | ScalarTypeComposer<any>
): this
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
Directive methods
getDirectives()
getDirectives(): ExtensionsDirective[]
getDirectiveNames()
getDirectiveNames(): string[]
getDirectiveByName()
getDirectiveByName(
directiveName: string
): DirectiveArgs | void
getDirectiveById()
getDirectiveById(
idx: number
): DirectiveArgs | void
Internal type definitions
ScalarTypeComposerDefinition
export type ScalarTypeComposerDefinition =
| TypeAsString
| Readonly<ScalarTypeComposerAsObjectDefinition>
| Readonly<GraphQLScalarType>;
ScalarTypeComposerAsObjectDefinition
export type ScalarTypeComposerAsObjectDefinition = GraphQLScalarTypeConfig<any, any> & {
extensions?: Extensions;
};