TypeMapper
Type storage and type generator from Schema Definition Language
(SDL
).
This is slightly rewritten buildASTSchema
utility from graphql-js
that allows to create type from a string (SDL).
Static methods
static isOutputType()
static isOutputType(
type: unknown
): boolean
static isInputType()
static isInputType(
type: unknown
): boolean
static isTypeNameString()
static isTypeNameString(
str: string
): boolean
static isTypeDefinitionString()
static isTypeDefinitionString(
str: string
): boolean
static isOutputTypeDefinitionString()
static isOutputTypeDefinitionString(
str: string
): boolean
static isInputTypeDefinitionString()
static isInputTypeDefinitionString(
str: string
): boolean
static isEnumTypeDefinitionString()
static isEnumTypeDefinitionString(
str: string
): boolean
static isScalarTypeDefinitionString()
static isScalarTypeDefinitionString(
str: string
): boolean
static isInterfaceTypeDefinitionString()
static isInterfaceTypeDefinitionString(
str: string
): boolean
static isUnionTypeDefinitionString()
static isUnionTypeDefinitionString(
str: string
): boolean
Properties
schemaComposer
schemaComposer: SchemaComposer<TContext>;
Methods
convertGraphQLTypeToComposer()
convertGraphQLTypeToComposer(
type: GraphQLType
): AnyTypeComposer<TContext>
convertSDLWrappedTypeName()
convertSDLWrappedTypeName(
str: TypeWrappedString | TypeNameString
): AnyTypeComposer<TContext>
convertSDLTypeDefinition()
convertSDLTypeDefinition(
str: TypeDefinitionString
): NamedTypeComposer<TContext> | void
convertOutputTypeDefinition()
convertOutputTypeDefinition(
typeDef: ThunkWithSchemaComposer<ComposeOutputTypeDefinition<any> | ObjectTypeComposerDefinition<any, any> | Readonly<Resolver<any, any>>, SchemaComposer<TContext>>,
fieldName: string,
typeName: string
): ComposeOutputType<TContext> | void
convertOutputFieldConfig()
convertOutputFieldConfig<TSource>(
composeFC: ObjectTypeComposerFieldConfigDefinition<TSource, TContext> | Readonly<Resolver<any, TContext>>,
fieldName: string,
typeName: string
): ObjectTypeComposerFieldConfig<TSource, TContext>
convertOutputFieldConfigMap()
convertOutputFieldConfigMap<TSource>(
composeFields: ObjectTypeComposerFieldConfigMapDefinition<TSource, TContext>,
typeName: string
): ObjectTypeComposerFieldConfigMap<TSource, TContext>
convertArgConfig()
convertArgConfig(
composeAC: ObjectTypeComposerArgumentConfigDefinition,
argName: string,
fieldName: string,
typeName: string
): ObjectTypeComposerArgumentConfig
convertArgConfigMap()
convertArgConfigMap(
composeArgsConfigMap: ObjectTypeComposerArgumentConfigMapDefinition<any>,
fieldName: string,
typeName: string
): ObjectTypeComposerArgumentConfigMap<any>
convertInputTypeDefinition()
convertInputTypeDefinition(
typeDef: ThunkWithSchemaComposer<ComposeInputTypeDefinition, SchemaComposer<TContext>>,
fieldName: string,
typeName: string
): ComposeInputType | void
convertInputFieldConfig()
convertInputFieldConfig(
composeIFC: InputTypeComposerFieldConfigDefinition,
fieldName: string,
typeName: string
): InputTypeComposerFieldConfig
convertInputFieldConfigMap()
convertInputFieldConfigMap(
composeFields: InputTypeComposerFieldConfigMapDefinition,
typeName: string
): InputTypeComposerFieldConfigMap
convertInterfaceTypeDefinition()
convertInterfaceTypeDefinition(
typeDef: InterfaceTypeComposerDefinition<any, TContext>
): InterfaceTypeComposerThunked<any, TContext>
parseTypesFromString()
parseTypesFromString(
str: string
): TypeStorage<string, NamedTypeComposer<TContext>>
Internal methods
parseTypes()
parseTypes(
astDocument: DocumentNode
): Array<NamedTypeComposer<TContext>>
typeFromAST()
typeFromAST(
typeNode: TypeNode
): AnyTypeComposer<TContext>
typeFromASTInput()
typeFromASTInput(
typeNode: TypeNode
): ComposeInputType
typeFromASTOutput()
typeFromASTOutput(
typeNode: TypeNode
): ComposeOutputType<TContext>
makeSchemaDef()
makeSchemaDef(
def: DefinitionNode
): NamedTypeComposer<any> | null
makeArguments()
makeArguments(
values: ReadonlyArray<InputValueDefinitionNode>
): ObjectTypeComposerArgumentConfigMap<any>
makeFieldDefMap()
makeFieldDefMap(
def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeExtensionNode
): ObjectTypeComposerFieldConfigMap<any, any>
makeInputFieldDef()
makeInputFieldDef(
def: InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode
): InputTypeComposerFieldConfigMapDefinition
makeEnumDef()
makeEnumDef(
def: EnumTypeDefinitionNode
): EnumTypeComposer<TContext>
makeEnumValuesDef()
makeEnumValuesDef(
def: EnumTypeDefinitionNode | EnumTypeExtensionNode
): EnumTypeComposerValueConfigMapDefinition
makeInputObjectDef()
makeInputObjectDef(
def: InputObjectTypeDefinitionNode
): InputTypeComposer<TContext>
makeDirectiveDef()
makeDirectiveDef(
def: DirectiveDefinitionNode
): GraphQLDirective
getBuiltInType()
getBuiltInType(
name: string
): ScalarTypeComposer<TContext> | undefined
makeScalarDef()
makeScalarDef(
def: ScalarTypeDefinitionNode
): ScalarTypeComposer<TContext>
makeImplementedInterfaces()
makeImplementedInterfaces(
def: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode
): Array<InterfaceTypeComposerThunked<any, TContext>>
makeTypeDef()
makeTypeDef(
def: ObjectTypeDefinitionNode
): ObjectTypeComposer<any, TContext>
makeInterfaceDef()
makeInterfaceDef(
def: InterfaceTypeDefinitionNode
): InterfaceTypeComposer<any, TContext>
makeUnionDef()
makeUnionDef(
def: UnionTypeDefinitionNode
): UnionTypeComposer<any, TContext>
checkSchemaDef()
checkSchemaDef(
def: SchemaDefinitionNode
): void
getNamedTypeAST()
getNamedTypeAST(
typeAST: TypeNode
): NamedTypeNode
buildWrappedTypeDef()
buildWrappedTypeDef(
innerType: AnyTypeComposer<any>,
inputTypeAST: TypeNode
): AnyTypeComposer<TContext>
getDeprecationReason()
getDeprecationReason(
directives: ReadonlyArray<DirectiveNode> | undefined
): string | undefined
parseDirectives()
parseDirectives(
directives: ReadonlyArray<DirectiveNode> | undefined
): Array<Directive>
makeExtendTypeDef()
makeExtendTypeDef(
def: ObjectTypeExtensionNode
): ObjectTypeComposer<any, TContext>
makeExtendInputObjectDef()
makeExtendInputObjectDef(
def: InputObjectTypeExtensionNode
): InputTypeComposer<TContext>
makeExtendInterfaceDef()
makeExtendInterfaceDef(
def: InterfaceTypeExtensionNode
): InterfaceTypeComposer<any, TContext>
makeExtendUnionDef()
makeExtendUnionDef(
def: UnionTypeExtensionNode
): UnionTypeComposer<any, TContext>
makeExtendEnumDef()
makeExtendEnumDef(
def: EnumTypeExtensionNode
): EnumTypeComposer<TContext>
makeExtendScalarDef()
makeExtendScalarDef(
def: ScalarTypeExtensionNode
): ScalarTypeComposer<TContext>
Internal type definitions
TypeDefinitionString
/**
* Eg. `type Name { field: Int }`
*/
export type TypeDefinitionString = string;
TypeWrappedString
/**
* Eg. `Int`, `Int!`, `[Int]`
*/
export type TypeWrappedString = string;
TypeNameString
/**
* Eg. `Int`, `Float`
*/
export type TypeNameString = string;
TypeAsString
export type TypeAsString = TypeDefinitionString | TypeWrappedString | TypeNameString;