UNPKG

3.86 kBTypeScriptView Raw
1import { GraphQLScalarType } from './graphql';
2import type { GraphQLScalarTypeConfig, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser } from './graphql';
3import type { TypeAsString } from './TypeMapper';
4import { SchemaComposer } from './SchemaComposer';
5import { ListComposer } from './ListComposer';
6import { NonNullComposer } from './NonNullComposer';
7import type { Extensions, Directive, DirectiveArgs } from './utils/definitions';
8import { SchemaPrinterOptions } from './utils/schemaPrinter';
9export declare type ScalarTypeComposerDefinition<TInternal, TExternal> = TypeAsString | Readonly<ScalarTypeComposerAsObjectDefinition<TInternal, TExternal>> | Readonly<GraphQLScalarType>;
10export declare type ScalarTypeComposerAsObjectDefinition<TInternal, TExternal> = GraphQLScalarTypeConfig<TInternal, TExternal> & {
11 extensions?: Extensions;
12 directives?: Directive[];
13};
14export declare class ScalarTypeComposer<TContext = any> {
15 schemaComposer: SchemaComposer<TContext>;
16 _gqType: GraphQLScalarType;
17 _gqcExtensions: Extensions | undefined;
18 _gqcDirectives: Directive[] | undefined;
19 _gqcIsModified?: boolean;
20 _gqcSerialize: GraphQLScalarSerializer<any>;
21 _gqcParseValue: GraphQLScalarValueParser<any>;
22 _gqcParseLiteral: GraphQLScalarLiteralParser<any>;
23 static create<TCtx = any, TInternal = any, TExternal = any>(typeDef: ScalarTypeComposerDefinition<TInternal, TExternal>, schemaComposer: SchemaComposer<TCtx>): ScalarTypeComposer<TCtx>;
24 static createTemp<TCtx = any, TInternal = any, TExternal = any>(typeDef: ScalarTypeComposerDefinition<TInternal, TExternal>, schemaComposer?: SchemaComposer<TCtx>): ScalarTypeComposer<TCtx>;
25 constructor(graphqlType: GraphQLScalarType, schemaComposer: SchemaComposer<TContext>);
26 setSerialize(fn: GraphQLScalarSerializer<any>): this;
27 getSerialize(): GraphQLScalarSerializer<any>;
28 setParseValue(fn: GraphQLScalarValueParser<any> | undefined): this;
29 getParseValue(): GraphQLScalarValueParser<any> | undefined;
30 setParseLiteral(fn: GraphQLScalarLiteralParser<any> | undefined): this;
31 getParseLiteral(): GraphQLScalarLiteralParser<any> | undefined;
32 getType(): GraphQLScalarType;
33 getTypePlural(): ListComposer<ScalarTypeComposer<TContext>>;
34 getTypeNonNull(): NonNullComposer<ScalarTypeComposer<TContext>>;
35 get List(): ListComposer<ScalarTypeComposer<TContext>>;
36 get NonNull(): NonNullComposer<ScalarTypeComposer<TContext>>;
37 getTypeName(): string;
38 setTypeName(name: string): this;
39 getDescription(): string;
40 setDescription(description: string): this;
41 getSpecifiedByUrl(): string | undefined | null;
42 setSpecifiedByUrl(url: string | undefined | null): this;
43 clone(newTypeNameOrTC: string | ScalarTypeComposer<any>): ScalarTypeComposer<TContext>;
44 cloneTo(anotherSchemaComposer: SchemaComposer<any>, cloneMap?: Map<any, any>): ScalarTypeComposer<any>;
45 merge(type: GraphQLScalarType | ScalarTypeComposer<any>): ScalarTypeComposer<TContext>;
46 getExtensions(): Extensions;
47 setExtensions(extensions: Extensions | undefined | null): this;
48 extendExtensions(extensions: Extensions): this;
49 clearExtensions(): this;
50 getExtension(extensionName: string): unknown;
51 hasExtension(extensionName: string): boolean;
52 setExtension(extensionName: string, value: unknown): this;
53 removeExtension(extensionName: string): this;
54 getDirectives(): Array<Directive>;
55 setDirectives(directives: Array<Directive>): this;
56 getDirectiveNames(): string[];
57 getDirectiveByName(directiveName: string): DirectiveArgs | undefined;
58 setDirectiveByName(directiveName: string, args?: DirectiveArgs): this;
59 getDirectiveById(idx: number): DirectiveArgs | undefined;
60 toSDL(opts?: SchemaPrinterOptions): string;
61}
62//# sourceMappingURL=ScalarTypeComposer.d.ts.map
\No newline at end of file