1 | import { GraphQLInterfaceType, GraphQLObjectType } from './graphql';
|
2 | import { ObjectTypeComposer } from './ObjectTypeComposer';
|
3 | import type { GraphQLFieldConfig, GraphQLOutputType, GraphQLInputObjectType, GraphQLInputType, GraphQLResolveInfo, GraphQLTypeResolver } from './graphql';
|
4 | import { InputTypeComposer } from './InputTypeComposer';
|
5 | import type { TypeAsString, TypeDefinitionString } from './TypeMapper';
|
6 | import { SchemaComposer } from './SchemaComposer';
|
7 | import type { ObjectTypeComposerFieldConfigMap, ObjectTypeComposerFieldConfig, ObjectTypeComposerFieldConfigDefinition, ObjectTypeComposerFieldConfigAsObjectDefinition, ObjectTypeComposerFieldConfigMapDefinition, ObjectTypeComposerArgumentConfigMapDefinition, ObjectTypeComposerArgumentConfig, ObjectTypeComposerArgumentConfigDefinition, ObjectTypeComposerArgumentConfigMap } from './ObjectTypeComposer';
|
8 | import { ListComposer } from './ListComposer';
|
9 | import { NonNullComposer } from './NonNullComposer';
|
10 | import { ThunkComposer } from './ThunkComposer';
|
11 | import type { Extensions, MaybePromise, DirectiveArgs, Directive, ThunkWithSchemaComposer } from './utils/definitions';
|
12 | import type { ToInputTypeOpts } from './utils/toInputType';
|
13 | import { TypeInPath } from './utils/typeByPath';
|
14 | import { NamedTypeComposer } from './utils/typeHelpers';
|
15 | import type { ComposeNamedInputType, ComposeNamedOutputType } from './utils/typeHelpers';
|
16 | import { SchemaPrinterOptions } from './utils/schemaPrinter';
|
17 | export declare type InterfaceTypeComposerDefinition<TSource, TContext> = TypeAsString | TypeDefinitionString | InterfaceTypeComposerAsObjectDefinition<TSource, TContext> | GraphQLInterfaceType | Readonly<InterfaceTypeComposerThunked<any, TContext>>;
|
18 | export declare type InterfaceTypeComposerAsObjectDefinition<TSource, TContext> = {
|
19 | name: string;
|
20 | fields?: ObjectTypeComposerFieldConfigMapDefinition<TSource, TContext>;
|
21 | interfaces?: null | ThunkWithSchemaComposer<ReadonlyArray<InterfaceTypeComposerDefinition<any, TContext>>, SchemaComposer<TContext>>;
|
22 | resolveType?: null | GraphQLTypeResolver<TSource, TContext>;
|
23 | description?: null | string;
|
24 | extensions?: Extensions;
|
25 | directives?: Directive[];
|
26 | };
|
27 | export declare type InterfaceTypeComposerResolversMap<TContext> = Map<ObjectTypeComposer<any, TContext> | GraphQLObjectType, InterfaceTypeComposerResolverCheckFn<any, TContext>>;
|
28 | export declare type InterfaceTypeComposerResolverCheckFn<TSource, TContext> = (value: TSource, context: TContext, info: GraphQLResolveInfo) => MaybePromise<boolean | null | void>;
|
29 | export declare type InterfaceTypeComposerThunked<TReturn, TContext> = InterfaceTypeComposer<TReturn, TContext> | ThunkComposer<InterfaceTypeComposer<any, any>, GraphQLInterfaceType>;
|
30 | export declare class InterfaceTypeComposer<TSource = any, TContext = any> {
|
31 | schemaComposer: SchemaComposer<TContext>;
|
32 | _gqType: GraphQLInterfaceType;
|
33 | _gqcFields: ObjectTypeComposerFieldConfigMap<TSource, TContext>;
|
34 | _gqcInputTypeComposer: undefined | InputTypeComposer<TContext>;
|
35 | _gqcInterfaces: Array<InterfaceTypeComposerThunked<TSource, TContext>>;
|
36 | _gqcTypeResolvers: undefined | InterfaceTypeComposerResolversMap<TContext>;
|
37 | _gqcFallbackResolveType: ObjectTypeComposer<any, TContext> | GraphQLObjectType | null;
|
38 | _gqcExtensions?: Extensions;
|
39 | _gqcDirectives?: Directive[];
|
40 | _gqcIsModified?: boolean;
|
41 | static create<TSrc = any, TCtx = any>(typeDef: InterfaceTypeComposerDefinition<TSrc, TCtx>, schemaComposer: SchemaComposer<TCtx>): InterfaceTypeComposer<TSrc, TCtx>;
|
42 | static createTemp<TSrc = any, TCtx = any>(typeDef: InterfaceTypeComposerDefinition<TSrc, TCtx>, schemaComposer?: SchemaComposer<TCtx>): InterfaceTypeComposer<TSrc, TCtx>;
|
43 | constructor(graphqlType: GraphQLInterfaceType, schemaComposer: SchemaComposer<TContext>);
|
44 | getFields(): ObjectTypeComposerFieldConfigMap<TSource, TContext>;
|
45 | getFieldNames(): string[];
|
46 | getField(fieldName: string): ObjectTypeComposerFieldConfig<TSource, TContext>;
|
47 | hasField(fieldName: string): boolean;
|
48 | setFields(fields: ObjectTypeComposerFieldConfigMapDefinition<TSource, TContext>): this;
|
49 | setField(fieldName: string, fieldConfig: ObjectTypeComposerFieldConfigDefinition<TSource, TContext>): this;
|
50 | addFields(newFields: ObjectTypeComposerFieldConfigMapDefinition<TSource, TContext>): this;
|
51 | removeField(fieldNameOrArray: string | string[]): this;
|
52 | removeOtherFields(fieldNameOrArray: string | string[]): this;
|
53 | reorderFields(names: string[]): this;
|
54 | extendField(fieldName: string, partialFieldConfig: Partial<ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext>>): this;
|
55 | getFieldConfig(fieldName: string): GraphQLFieldConfig<TSource, TContext>;
|
56 | getFieldType(fieldName: string): GraphQLOutputType;
|
57 | getFieldTypeName(fieldName: string): string;
|
58 | getFieldTC(fieldName: string): ComposeNamedOutputType<TContext>;
|
59 | getFieldOTC(fieldName: string): ObjectTypeComposer<TSource, TContext>;
|
60 | isFieldNonNull(fieldName: string): boolean;
|
61 | makeFieldNonNull(fieldNameOrArray: string | string[]): this;
|
62 | makeFieldNullable(fieldNameOrArray: string | string[]): this;
|
63 | isFieldPlural(fieldName: string): boolean;
|
64 | makeFieldPlural(fieldNameOrArray: string | string[]): this;
|
65 | makeFieldNonPlural(fieldNameOrArray: string | string[]): this;
|
66 | deprecateFields(fields: {
|
67 | [fieldName: string]: string;
|
68 | } | string[] | string): this;
|
69 | getFieldArgs<TArgs = any>(fieldName: string): ObjectTypeComposerArgumentConfigMap<TArgs>;
|
70 | getFieldArgNames(fieldName: string): string[];
|
71 | hasFieldArg(fieldName: string, argName: string): boolean;
|
72 | getFieldArg(fieldName: string, argName: string): ObjectTypeComposerArgumentConfig;
|
73 | getFieldArgType(fieldName: string, argName: string): GraphQLInputType;
|
74 | getFieldArgTypeName(fieldName: string, argName: string): string;
|
75 | getFieldArgTC(fieldName: string, argName: string): ComposeNamedInputType<TContext>;
|
76 | getFieldArgITC(fieldName: string, argName: string): InputTypeComposer<TContext>;
|
77 | setFieldArgs(fieldName: string, args: ObjectTypeComposerArgumentConfigMapDefinition<any>): this;
|
78 | addFieldArgs(fieldName: string, newArgs: ObjectTypeComposerArgumentConfigMapDefinition<any>): this;
|
79 | setFieldArg(fieldName: string, argName: string, argConfig: ObjectTypeComposerArgumentConfigDefinition): this;
|
80 | isFieldArgPlural(fieldName: string, argName: string): boolean;
|
81 | makeFieldArgPlural(fieldName: string, argNameOrArray: string | string[]): this;
|
82 | makeFieldArgNonPlural(fieldName: string, argNameOrArray: string | string[]): this;
|
83 | isFieldArgNonNull(fieldName: string, argName: string): boolean;
|
84 | makeFieldArgNonNull(fieldName: string, argNameOrArray: string | string[]): this;
|
85 | makeFieldArgNullable(fieldName: string, argNameOrArray: string | string[]): this;
|
86 | getType(): GraphQLInterfaceType;
|
87 | getTypePlural(): ListComposer<InterfaceTypeComposer<TSource, TContext>>;
|
88 | getTypeNonNull(): NonNullComposer<InterfaceTypeComposer<TSource, TContext>>;
|
89 | get List(): ListComposer<InterfaceTypeComposer<TSource, TContext>>;
|
90 | get NonNull(): NonNullComposer<InterfaceTypeComposer<TSource, TContext>>;
|
91 | getTypeName(): string;
|
92 | setTypeName(name: string): this;
|
93 | getDescription(): string;
|
94 | setDescription(description: string): this;
|
95 | clone(newTypeNameOrTC: string | InterfaceTypeComposer<any, any>): InterfaceTypeComposer<TSource, TContext>;
|
96 | cloneTo(anotherSchemaComposer: SchemaComposer<any>, cloneMap?: Map<any, any>): InterfaceTypeComposer<any, any>;
|
97 | merge(type: GraphQLInterfaceType | GraphQLObjectType | InterfaceTypeComposer<any, any> | ObjectTypeComposer<any, any>): this;
|
98 | getInputType(): GraphQLInputObjectType;
|
99 | hasInputTypeComposer(): boolean;
|
100 | setInputTypeComposer(itc: InputTypeComposer<TContext>): this;
|
101 | getInputTypeComposer(opts?: ToInputTypeOpts): InputTypeComposer<TContext>;
|
102 | getITC(opts?: ToInputTypeOpts): InputTypeComposer<TContext>;
|
103 | removeInputTypeComposer(): this;
|
104 | getResolveType(): GraphQLTypeResolver<TSource, TContext> | undefined | null;
|
105 | setResolveType(fn: GraphQLTypeResolver<TSource, TContext> | undefined | null): this;
|
106 | hasTypeResolver(type: ObjectTypeComposer<any, TContext> | GraphQLObjectType): boolean;
|
107 | getTypeResolvers(): InterfaceTypeComposerResolversMap<TContext>;
|
108 | getTypeResolverCheckFn(type: ObjectTypeComposer<any, TContext> | GraphQLObjectType): InterfaceTypeComposerResolverCheckFn<TSource, TContext>;
|
109 | getTypeResolverNames(): string[];
|
110 | getTypeResolverTypes(): GraphQLObjectType[];
|
111 | setTypeResolvers(typeResolversMap: InterfaceTypeComposerResolversMap<TContext>): this;
|
112 | _initResolveTypeFn(): this;
|
113 | _isTypeResolversValid(typeResolversMap: InterfaceTypeComposerResolversMap<TContext>): true;
|
114 | _isTypeResolverValid(composeType: ObjectTypeComposer<any, TContext> | GraphQLObjectType, checkFn: InterfaceTypeComposerResolverCheckFn<any, TContext>): true;
|
115 | _isTypeResolversAsync(typeResolversMap: InterfaceTypeComposerResolversMap<TContext>): boolean;
|
116 | addTypeResolver<TSrc>(type: ObjectTypeComposer<TSrc, TContext> | GraphQLObjectType, checkFn: InterfaceTypeComposerResolverCheckFn<TSrc, TContext>): this;
|
117 | removeTypeResolver(type: ObjectTypeComposer<any, TContext> | GraphQLObjectType): this;
|
118 | setTypeResolverFallback(type: ObjectTypeComposer<any, TContext> | GraphQLObjectType | null): this;
|
119 | getInterfaces(): Array<InterfaceTypeComposerThunked<TSource, TContext>>;
|
120 | getInterfacesTypes(): Array<GraphQLInterfaceType>;
|
121 | setInterfaces(interfaces: ReadonlyArray<InterfaceTypeComposerDefinition<any, TContext>>): this;
|
122 | hasInterface(iface: InterfaceTypeComposerDefinition<any, TContext>): boolean;
|
123 | addInterface(iface: InterfaceTypeComposerDefinition<any, TContext> | InterfaceTypeComposerThunked<any, TContext>): this;
|
124 | addInterfaces(ifaces: ReadonlyArray<InterfaceTypeComposerDefinition<any, TContext> | InterfaceTypeComposerThunked<any, TContext>>): this;
|
125 | removeInterface(iface: InterfaceTypeComposerDefinition<any, TContext>): this;
|
126 | getExtensions(): Extensions;
|
127 | setExtensions(extensions: Extensions | undefined): this;
|
128 | extendExtensions(extensions: Extensions): this;
|
129 | clearExtensions(): this;
|
130 | getExtension(extensionName: string): unknown;
|
131 | hasExtension(extensionName: string): boolean;
|
132 | setExtension(extensionName: string, value: unknown): this;
|
133 | removeExtension(extensionName: string): this;
|
134 | getFieldExtensions(fieldName: string): Extensions;
|
135 | setFieldExtensions(fieldName: string, extensions: Extensions): this;
|
136 | extendFieldExtensions(fieldName: string, extensions: Extensions): this;
|
137 | clearFieldExtensions(fieldName: string): this;
|
138 | getFieldExtension(fieldName: string, extensionName: string): unknown;
|
139 | hasFieldExtension(fieldName: string, extensionName: string): boolean;
|
140 | setFieldExtension(fieldName: string, extensionName: string, value: unknown): this;
|
141 | removeFieldExtension(fieldName: string, extensionName: string): this;
|
142 | getFieldArgExtensions(fieldName: string, argName: string): Extensions;
|
143 | setFieldArgExtensions(fieldName: string, argName: string, extensions: Extensions): this;
|
144 | extendFieldArgExtensions(fieldName: string, argName: string, extensions: Extensions): this;
|
145 | clearFieldArgExtensions(fieldName: string, argName: string): this;
|
146 | getFieldArgExtension(fieldName: string, argName: string, extensionName: string): unknown;
|
147 | hasFieldArgExtension(fieldName: string, argName: string, extensionName: string): boolean;
|
148 | setFieldArgExtension(fieldName: string, argName: string, extensionName: string, value: unknown): this;
|
149 | removeFieldArgExtension(fieldName: string, argName: string, extensionName: string): this;
|
150 | getDirectives(): Array<Directive>;
|
151 | setDirectives(directives: Array<Directive>): this;
|
152 | getDirectiveNames(): string[];
|
153 | getDirectiveByName(directiveName: string): DirectiveArgs | undefined;
|
154 | setDirectiveByName(directiveName: string, args?: DirectiveArgs): this;
|
155 | getDirectiveById(idx: number): DirectiveArgs | undefined;
|
156 | getFieldDirectives(fieldName: string): Array<Directive>;
|
157 | setFieldDirectives(fieldName: string, directives: Array<Directive> | undefined): this;
|
158 | getFieldDirectiveNames(fieldName: string): string[];
|
159 | getFieldDirectiveByName(fieldName: string, directiveName: string): DirectiveArgs | undefined;
|
160 | setFieldDirectiveByName(fieldName: string, directiveName: string, args?: DirectiveArgs): this;
|
161 | getFieldDirectiveById(fieldName: string, idx: number): DirectiveArgs | undefined;
|
162 | getFieldArgDirectives(fieldName: string, argName: string): Array<Directive>;
|
163 | setFieldArgDirectives(fieldName: string, argName: string, directives: Array<Directive>): this;
|
164 | getFieldArgDirectiveNames(fieldName: string, argName: string): string[];
|
165 | getFieldArgDirectiveByName(fieldName: string, argName: string, directiveName: string): DirectiveArgs | undefined;
|
166 | setFieldArgDirectiveByName(fieldName: string, argName: string, directiveName: string, args?: DirectiveArgs): this;
|
167 | getFieldArgDirectiveById(fieldName: string, argName: string, idx: number): DirectiveArgs | undefined;
|
168 | get(path: string | string[]): TypeInPath<TContext> | void;
|
169 | getNestedTCs(opts?: {
|
170 | exclude?: string[];
|
171 | }, passedTypes?: Set<NamedTypeComposer<any>>): Set<NamedTypeComposer<any>>;
|
172 | toSDL(opts?: SchemaPrinterOptions & {
|
173 | deep?: boolean;
|
174 | exclude?: string[];
|
175 | }): string;
|
176 | }
|
177 | //# sourceMappingURL=InterfaceTypeComposer.d.ts.map |
\ | No newline at end of file |