UNPKG

5.51 kBTypeScriptView Raw
1import { GraphQLEnumType } from './graphql';
2import type { EnumValueDefinitionNode } from './graphql';
3import type { TypeAsString } from './TypeMapper';
4import { SchemaComposer } from './SchemaComposer';
5import { ListComposer } from './ListComposer';
6import { NonNullComposer } from './NonNullComposer';
7import type { ObjMap, ObjMapReadOnly, Extensions, Directive, DirectiveArgs } from './utils/definitions';
8import { SchemaPrinterOptions } from './utils/schemaPrinter';
9export declare type EnumTypeComposerDefinition = TypeAsString | EnumTypeComposerAsObjectDefinition | GraphQLEnumType;
10export declare type EnumTypeComposerAsObjectDefinition = {
11 name: string;
12 values?: EnumTypeComposerValueConfigMapDefinition;
13 description?: string | null;
14 extensions?: Extensions;
15 directives?: Directive[];
16};
17export declare type EnumTypeComposerValueConfig = {
18 value: any;
19 deprecationReason?: string | null;
20 description?: string | null;
21 astNode?: EnumValueDefinitionNode | null | undefined;
22 extensions?: Extensions;
23 directives?: Directive[];
24 [key: string]: any;
25};
26export declare type EnumTypeComposerValueConfigDefinition = {
27 value?: any;
28 deprecationReason?: string | null;
29 description?: string | null;
30 extensions?: Extensions;
31 directives?: Directive[];
32 [key: string]: any;
33};
34export declare type EnumTypeComposerValueConfigMap = ObjMap<EnumTypeComposerValueConfig>;
35export declare type EnumTypeComposerValueConfigMapDefinition = ObjMapReadOnly<EnumTypeComposerValueConfigDefinition>;
36export declare class EnumTypeComposer<TContext = any> {
37 schemaComposer: SchemaComposer<TContext>;
38 _gqType: GraphQLEnumType;
39 _gqcExtensions?: Extensions;
40 _gqcDirectives?: Directive[];
41 _gqcIsModified?: boolean;
42 _gqcFields: EnumTypeComposerValueConfigMap;
43 static create<TCtx = any>(typeDef: EnumTypeComposerDefinition, schemaComposer: SchemaComposer<TCtx>): EnumTypeComposer<TCtx>;
44 static createTemp<TCtx = any>(typeDef: EnumTypeComposerDefinition, schemaComposer?: SchemaComposer<TCtx>): EnumTypeComposer<TCtx>;
45 constructor(graphqlType: GraphQLEnumType, schemaComposer: SchemaComposer<TContext>);
46 hasField(name: string): boolean;
47 getFields(): EnumTypeComposerValueConfigMap;
48 getField(name: string): EnumTypeComposerValueConfig;
49 getFieldNames(): string[];
50 setFields(values: EnumTypeComposerValueConfigMapDefinition): this;
51 setField(name: string, valueConfig: EnumTypeComposerValueConfigDefinition): this;
52 addFields(newValues: EnumTypeComposerValueConfigMapDefinition): this;
53 removeField(nameOrArray: string | string[]): this;
54 removeOtherFields(fieldNameOrArray: string | string[]): this;
55 reorderFields(names: string[]): this;
56 extendField(name: string, partialValueConfig: Partial<EnumTypeComposerValueConfigDefinition>): this;
57 deprecateFields(fields: {
58 [fieldName: string]: string;
59 } | string[] | string): this;
60 getType(): GraphQLEnumType;
61 getTypePlural(): ListComposer<EnumTypeComposer<TContext>>;
62 getTypeNonNull(): NonNullComposer<EnumTypeComposer<TContext>>;
63 get List(): ListComposer<EnumTypeComposer<TContext>>;
64 get NonNull(): NonNullComposer<EnumTypeComposer<TContext>>;
65 getTypeName(): string;
66 setTypeName(name: string): this;
67 getDescription(): string;
68 setDescription(description: string): this;
69 clone(newTypeNameOrTC: string | EnumTypeComposer<any>): EnumTypeComposer<any>;
70 cloneTo(anotherSchemaComposer: SchemaComposer<any>, cloneMap?: Map<any, any>): EnumTypeComposer<any>;
71 merge(type: GraphQLEnumType | EnumTypeComposer<any>): this;
72 getExtensions(): Extensions;
73 setExtensions(extensions: Extensions | undefined): this;
74 extendExtensions(extensions: Extensions): this;
75 clearExtensions(): this;
76 getExtension(extensionName: string): unknown;
77 hasExtension(extensionName: string): boolean;
78 setExtension(extensionName: string, value: unknown): this;
79 removeExtension(extensionName: string): this;
80 getFieldExtensions(fieldName: string): Extensions;
81 setFieldExtensions(fieldName: string, extensions: Extensions): this;
82 extendFieldExtensions(fieldName: string, extensions: Extensions): this;
83 clearFieldExtensions(fieldName: string): this;
84 getFieldExtension(fieldName: string, extensionName: string): unknown;
85 hasFieldExtension(fieldName: string, extensionName: string): boolean;
86 setFieldExtension(fieldName: string, extensionName: string, value: unknown): this;
87 removeFieldExtension(fieldName: string, extensionName: string): this;
88 getDirectives(): Array<Directive>;
89 setDirectives(directives: Array<Directive>): this;
90 getDirectiveNames(): string[];
91 getDirectiveByName(directiveName: string): DirectiveArgs | undefined;
92 setDirectiveByName(directiveName: string, args?: DirectiveArgs): this;
93 getDirectiveById(idx: number): DirectiveArgs | undefined;
94 getFieldDirectives(fieldName: string): Array<Directive>;
95 setFieldDirectives(fieldName: string, directives: Array<Directive> | undefined): this;
96 getFieldDirectiveNames(fieldName: string): string[];
97 getFieldDirectiveByName(fieldName: string, directiveName: string): DirectiveArgs | undefined;
98 setFieldDirectiveByName(fieldName: string, directiveName: string, args?: DirectiveArgs): this;
99 getFieldDirectiveById(fieldName: string, idx: number): DirectiveArgs | undefined;
100 toSDL(opts?: SchemaPrinterOptions): string;
101}
102//# sourceMappingURL=EnumTypeComposer.d.ts.map
\No newline at end of file