1 | import { GraphQLUnionType, GraphQLObjectType, GraphQLResolveInfo, GraphQLTypeResolver } from './graphql';
|
2 | import { ObjectTypeComposer, ObjectTypeComposerDefinition, ObjectTypeComposerThunked } from './ObjectTypeComposer';
|
3 | import type { TypeDefinitionString, TypeNameString } from './TypeMapper';
|
4 | import { SchemaComposer } from './SchemaComposer';
|
5 | import { ListComposer } from './ListComposer';
|
6 | import { NonNullComposer } from './NonNullComposer';
|
7 | import { ThunkComposer } from './ThunkComposer';
|
8 | import type { Thunk, Extensions, MaybePromise, Directive, DirectiveArgs } from './utils/definitions';
|
9 | import { NamedTypeComposer } from './utils/typeHelpers';
|
10 | import { SchemaPrinterOptions } from './utils/schemaPrinter';
|
11 | export declare type UnionTypeComposerDefinition<TSource, TContext> = TypeDefinitionString | TypeNameString | UnionTypeComposerAsObjectDefinition<TSource, TContext> | GraphQLUnionType;
|
12 | export declare type UnionTypeComposerAsObjectDefinition<TSource, TContext> = {
|
13 | name: string;
|
14 | types?: Thunk<ReadonlyArray<ObjectTypeComposerDefinition<any, TContext>> | null>;
|
15 | resolveType?: GraphQLTypeResolver<TSource, TContext> | null;
|
16 | description?: string | null;
|
17 | extensions?: Extensions;
|
18 | directives?: Directive[];
|
19 | };
|
20 | export declare type UnionTypeComposerResolversMap<TSource, TContext> = Map<ObjectTypeComposerThunked<TSource, TContext>, UnionTypeComposerResolverCheckFn<TSource, TContext>>;
|
21 | export declare type UnionTypeComposerResolversMapDefinition<TSource, TContext> = Map<ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>, UnionTypeComposerResolverCheckFn<TSource, TContext>> | Readonly<UnionTypeComposerResolversMap<TSource, TContext>>;
|
22 | export declare type UnionTypeComposerResolverCheckFn<TSource, TContext> = (value: TSource, context: TContext, info: GraphQLResolveInfo) => MaybePromise<boolean | null | undefined>;
|
23 | export declare type UnionTypeComposerThunked<TReturn, TContext> = UnionTypeComposer<TReturn, TContext> | ThunkComposer<UnionTypeComposer<TReturn, TContext>, GraphQLUnionType>;
|
24 | export declare class UnionTypeComposer<TSource = any, TContext = any> {
|
25 | schemaComposer: SchemaComposer<TContext>;
|
26 | _gqType: GraphQLUnionType;
|
27 | _gqcTypes: Set<ObjectTypeComposerThunked<any, TContext>>;
|
28 | _gqcTypeResolvers: UnionTypeComposerResolversMap<TSource, TContext>;
|
29 | _gqcFallbackResolveType: ObjectTypeComposer<any, TContext> | GraphQLObjectType | null;
|
30 | _gqcExtensions?: Extensions;
|
31 | _gqcDirectives?: Directive[];
|
32 | _gqcIsModified?: boolean;
|
33 | static create<TSrc = any, TCtx = any>(typeDef: UnionTypeComposerDefinition<TSrc, TCtx>, schemaComposer: SchemaComposer<TCtx>): UnionTypeComposer<TSrc, TCtx>;
|
34 | static createTemp<TSrc = any, TCtx = any>(typeDef: UnionTypeComposerDefinition<TSrc, TCtx>, schemaComposer?: SchemaComposer<TCtx>): UnionTypeComposer<TSrc, TCtx>;
|
35 | constructor(graphqlType: GraphQLUnionType, schemaComposer: SchemaComposer<TContext>);
|
36 | hasType(name: ObjectTypeComposerDefinition<any, TContext>): boolean;
|
37 | getTypes(): Array<ObjectTypeComposerThunked<TSource, TContext>>;
|
38 | getTypeComposers(): Array<ObjectTypeComposer<TSource, TContext>>;
|
39 | getTypeNames(): string[];
|
40 | clearTypes(): this;
|
41 | setTypes(types: ReadonlyArray<ObjectTypeComposerThunked<TSource, TContext> | ObjectTypeComposerDefinition<any, TContext>>): this;
|
42 | addType(type: ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>): this;
|
43 | addTypes(types: ReadonlyArray<ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>>): this;
|
44 | removeType(nameOrArray: string | string[]): this;
|
45 | removeOtherTypes(nameOrArray: string | string[]): this;
|
46 | getType(): GraphQLUnionType;
|
47 | getTypePlural(): ListComposer<UnionTypeComposer<TSource, TContext>>;
|
48 | getTypeNonNull(): NonNullComposer<UnionTypeComposer<TSource, TContext>>;
|
49 | get List(): ListComposer<UnionTypeComposer<TSource, TContext>>;
|
50 | get NonNull(): NonNullComposer<UnionTypeComposer<TSource, TContext>>;
|
51 | getTypeName(): string;
|
52 | setTypeName(name: string): this;
|
53 | getDescription(): string;
|
54 | setDescription(description: string): this;
|
55 | clone(newTypeNameOrTC: string | UnionTypeComposer<any, any>): UnionTypeComposer<any, TContext>;
|
56 | cloneTo(anotherSchemaComposer: SchemaComposer<any>, cloneMap?: Map<any, any>): UnionTypeComposer<any, any>;
|
57 | merge(type: GraphQLUnionType | UnionTypeComposer<any, any>): this;
|
58 | getResolveType(): GraphQLTypeResolver<TSource, TContext> | undefined | null;
|
59 | setResolveType(fn: GraphQLTypeResolver<TSource, TContext> | undefined | null): this;
|
60 | hasTypeResolver(type: ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>): boolean;
|
61 | getTypeResolvers(): UnionTypeComposerResolversMap<TSource, TContext>;
|
62 | getTypeResolverCheckFn(type: ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>): UnionTypeComposerResolverCheckFn<any, TContext>;
|
63 | getTypeResolverNames(): string[];
|
64 | getTypeResolverTypes(): Array<ObjectTypeComposerThunked<any, TContext>>;
|
65 | setTypeResolvers(typeResolversMap: UnionTypeComposerResolversMapDefinition<TSource, TContext>): this;
|
66 | _initResolveTypeFn(): this;
|
67 | _convertObjectType(type: ObjectTypeComposerThunked<any, TContext> | ObjectTypeComposerDefinition<any, TContext>): ObjectTypeComposerThunked<any, TContext>;
|
68 | _convertTypeResolvers(typeResolversMap: UnionTypeComposerResolversMapDefinition<any, TContext>): UnionTypeComposerResolversMap<any, TContext>;
|
69 | _isTypeResolversAsync(typeResolversMap: UnionTypeComposerResolversMap<any, TContext>): boolean;
|
70 | addTypeResolver(type: ObjectTypeComposerDefinition<any, TContext>, checkFn: UnionTypeComposerResolverCheckFn<TSource, TContext>): this;
|
71 | removeTypeResolver(type: ObjectTypeComposerDefinition<any, TContext>): this;
|
72 | setTypeResolverFallback(type: ObjectTypeComposer<any, TContext> | GraphQLObjectType | null): this;
|
73 | getExtensions(): Extensions;
|
74 | setExtensions(extensions: Extensions | undefined): this;
|
75 | extendExtensions(extensions: Extensions): this;
|
76 | clearExtensions(): this;
|
77 | getExtension(extensionName: string): unknown;
|
78 | hasExtension(extensionName: string): boolean;
|
79 | setExtension(extensionName: string, value: unknown): this;
|
80 | removeExtension(extensionName: string): this;
|
81 | getDirectives(): Array<Directive>;
|
82 | setDirectives(directives: Array<Directive>): this;
|
83 | getDirectiveNames(): string[];
|
84 | getDirectiveByName(directiveName: string): DirectiveArgs | undefined;
|
85 | setDirectiveByName(directiveName: string, args?: DirectiveArgs): this;
|
86 | getDirectiveById(idx: number): DirectiveArgs | undefined;
|
87 | getNestedTCs(opts?: {
|
88 | exclude?: string[] | undefined;
|
89 | }, passedTypes?: Set<NamedTypeComposer<any>>): Set<NamedTypeComposer<any>>;
|
90 | toSDL(opts?: SchemaPrinterOptions & {
|
91 | deep?: boolean;
|
92 | exclude?: string[];
|
93 | }): string;
|
94 | }
|
95 | //# sourceMappingURL=UnionTypeComposer.d.ts.map |
\ | No newline at end of file |