1 | import type { GraphQLFieldConfigArgumentMap, GraphQLArgumentConfig, GraphQLOutputType, GraphQLFieldConfig, GraphQLInputType, GraphQLResolveInfo, GraphQLFieldResolver } from './graphql';
|
2 | import { ObjectTypeComposer } from './ObjectTypeComposer';
|
3 | import type { ObjectTypeComposerArgumentConfigMap, ObjectTypeComposerArgumentConfigMapDefinition, ObjectTypeComposerArgumentConfig, ObjectTypeComposerArgumentConfigDefinition, ObjectTypeComposerArgumentConfigAsObjectDefinition } from './ObjectTypeComposer';
|
4 | import { InputTypeComposer } from './InputTypeComposer';
|
5 | import { SchemaComposer } from './SchemaComposer';
|
6 | import type { ProjectionType } from './utils/projection';
|
7 | import { TypeInPath } from './utils/typeByPath';
|
8 | import type { ComposeOutputType, ComposeOutputTypeDefinition, ComposeNamedOutputType, ComposeNamedInputType, ComposeInputTypeDefinition } from './utils/typeHelpers';
|
9 | import type { Thunk, ThunkWithSchemaComposer, Extensions, Directive } from './utils/definitions';
|
10 | export declare type ResolverKinds = 'query' | 'mutation' | 'subscription';
|
11 | export declare type ResolverDefinition<TSource, TContext, TArgs = any> = {
|
12 | type?: ThunkWithSchemaComposer<Readonly<ComposeOutputType<TContext>> | ComposeOutputTypeDefinition<TContext> | Readonly<Resolver<any, TContext, any>>, SchemaComposer<TContext>>;
|
13 | resolve?: ResolverRpCb<TSource, TContext, TArgs>;
|
14 | args?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>;
|
15 | name?: string;
|
16 | displayName?: string;
|
17 | kind?: ResolverKinds;
|
18 | description?: string;
|
19 | deprecationReason?: string | null;
|
20 | projection?: ProjectionType;
|
21 | parent?: Resolver<any, TContext, any>;
|
22 | extensions?: Extensions;
|
23 | directives?: Directive[];
|
24 | };
|
25 | export declare type ResolverResolveParams<TSource, TContext, TArgs = any> = {
|
26 | source: TSource;
|
27 | args: TArgs;
|
28 | context: TContext;
|
29 | info: GraphQLResolveInfo;
|
30 | projection: Partial<ProjectionType>;
|
31 | [opt: string]: any;
|
32 | };
|
33 | export declare type ResolverFilterArgFn<TSource, TContext, TArgs = any> = (query: any, value: any, resolveParams: ResolverResolveParams<TSource, TContext, TArgs>) => any;
|
34 | export declare type ResolverFilterArgConfigDefinition<TSource, TContext, TArgs = any> = {
|
35 | name: string;
|
36 | type: ComposeInputTypeDefinition;
|
37 | description?: string | null | void;
|
38 | query?: ResolverFilterArgFn<TSource, TContext, TArgs>;
|
39 | filterTypeNameFallback?: string;
|
40 | defaultValue?: any;
|
41 | };
|
42 | export declare type ResolverSortArgFn<TSource, TContext, TArgs = any> = (resolveParams: ResolverResolveParams<TSource, TContext, TArgs>) => any;
|
43 | export declare type ResolverSortArgConfig<TSource, TContext, TArgs = any> = {
|
44 | name: string;
|
45 | sortTypeNameFallback?: string;
|
46 | value: {
|
47 | [key: string]: any;
|
48 | } | ResolverSortArgFn<TSource, TContext, TArgs> | string | number | boolean | any[];
|
49 | deprecationReason?: string | null;
|
50 | description?: string | null;
|
51 | };
|
52 | export declare type ResolverWrapCb<TNewSource, TPrevSource, TContext, TNewArgs = any, TPrevArgs = any> = (newResolver: Resolver<TNewSource, TContext, TNewArgs>, prevResolver: Resolver<TPrevSource, TContext, TPrevArgs>) => Resolver<TNewSource, TContext, TNewArgs>;
|
53 | export declare type ResolverRpCb<TSource, TContext, TArgs = any> = (resolveParams: ResolverResolveParams<TSource, TContext, TArgs>) => Promise<any> | any;
|
54 | export declare type ResolverRpCbPartial<TSource, TContext, TArgs = any> = (resolveParams: Partial<ResolverResolveParams<TSource, TContext, TArgs>>) => Promise<any> | any;
|
55 | export declare type ResolverNextRpCb<TSource, TContext, TArgs = any> = (next: ResolverRpCb<TSource, TContext, TArgs>) => ResolverRpCb<TSource, TContext, TArgs>;
|
56 | export declare type ResolverDebugOpts = {
|
57 | showHidden?: boolean;
|
58 | depth?: number;
|
59 | colors?: boolean;
|
60 | };
|
61 | export declare type ResolverMiddleware<TSource, TContext, TArgs = any> = (resolve: (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => any, source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => any;
|
62 | export declare class Resolver<TSource = any, TContext = any, TArgs = any, TReturn = any> {
|
63 | schemaComposer: SchemaComposer<TContext>;
|
64 | type: ComposeOutputType<TContext>;
|
65 | args: ObjectTypeComposerArgumentConfigMap<any>;
|
66 | name: string;
|
67 | displayName: string | undefined;
|
68 | kind: ResolverKinds | undefined;
|
69 | description: string | undefined;
|
70 | deprecationReason: string | null | undefined;
|
71 | projection: ProjectionType;
|
72 | parent: Resolver<TSource, TContext, any> | undefined;
|
73 | extensions: Extensions | undefined;
|
74 | directives: Directive[] | undefined;
|
75 | resolve: ResolverRpCbPartial<TSource, TContext, TArgs>;
|
76 | constructor(opts: ResolverDefinition<TSource, TContext, TArgs>, schemaComposer: SchemaComposer<TContext>);
|
77 | getType(): GraphQLOutputType;
|
78 | getTypeName(): string;
|
79 | getTypeComposer(): ComposeNamedOutputType<TContext>;
|
80 | getOTC(): ObjectTypeComposer<TReturn, TContext>;
|
81 | setType<TNewReturn>(typeDef: ThunkWithSchemaComposer<Readonly<ComposeOutputType<TContext>> | ComposeOutputTypeDefinition<TContext> | Readonly<Resolver<any, TContext, any>>, SchemaComposer<TContext>>): Resolver<TSource, TContext, TArgs, TNewReturn>;
|
82 | hasArg(argName: string): boolean;
|
83 | getArg(argName: string): ObjectTypeComposerArgumentConfig;
|
84 | getArgConfig(argName: string): GraphQLArgumentConfig;
|
85 | getArgType(argName: string): GraphQLInputType;
|
86 | getArgTypeName(fieldName: string): string;
|
87 | getArgs(): ObjectTypeComposerArgumentConfigMap<TArgs>;
|
88 | getArgNames(): string[];
|
89 | setArgs<TNewArgs>(args: ObjectTypeComposerArgumentConfigMapDefinition<TNewArgs>): Resolver<TSource, TContext, TNewArgs>;
|
90 | setArg(argName: string, argConfig: ObjectTypeComposerArgumentConfigDefinition): this;
|
91 | setArgType(argName: string, typeDef: Thunk<ComposeInputTypeDefinition>): this;
|
92 | extendArg(argName: string, partialArgConfig: Partial<ObjectTypeComposerArgumentConfigAsObjectDefinition>): this;
|
93 | addArgs(newArgs: ObjectTypeComposerArgumentConfigMapDefinition<any>): this;
|
94 | removeArg(argNameOrArray: string | string[]): this;
|
95 | removeOtherArgs(argNameOrArray: string | string[]): this;
|
96 | reorderArgs(names: string[]): this;
|
97 | getArgTC(argName: string): ComposeNamedInputType<TContext>;
|
98 | getArgITC(argName: string): InputTypeComposer<TContext>;
|
99 | isArgNonNull(argName: string): boolean;
|
100 | makeArgNonNull(argNameOrArray: string | string[]): this;
|
101 | makeRequired(argNameOrArray: string | string[]): this;
|
102 | makeArgNullable(argNameOrArray: string | string[]): this;
|
103 | makeOptional(argNameOrArray: string | string[]): this;
|
104 | isArgPlural(argName: string): boolean;
|
105 | makeArgPlural(argNameOrArray: string | string[]): this;
|
106 | makeArgNonPlural(argNameOrArray: string | string[]): this;
|
107 | cloneArg(argName: string, newTypeName: string): this;
|
108 | addFilterArg(opts: ResolverFilterArgConfigDefinition<TSource, TContext, TArgs>): this;
|
109 | addSortArg(opts: ResolverSortArgConfig<TSource, TContext, TArgs>): this;
|
110 | getResolve(): ResolverRpCb<TSource, TContext, TArgs>;
|
111 | setResolve(resolve: ResolverRpCb<TSource, TContext, TArgs>): this;
|
112 | withMiddlewares(middlewares: Array<ResolverMiddleware<TSource, TContext, TArgs>>): Resolver<TSource, TContext, TArgs>;
|
113 | wrap<TNewSource, TNewArgs>(cb?: ResolverWrapCb<TNewSource, TSource, TContext, TNewArgs, TArgs> | null, newResolverOpts?: Partial<ResolverDefinition<TNewSource, TContext, TNewArgs>>): Resolver<TNewSource, TContext, TNewArgs>;
|
114 | wrapResolve(cb: ResolverNextRpCb<TSource, TContext, TArgs>, wrapperName?: string): Resolver<TSource, TContext, TArgs>;
|
115 | wrapArgs<TNewArgs>(cb: (prevArgs: GraphQLFieldConfigArgumentMap) => ObjectTypeComposerArgumentConfigMapDefinition<TArgs>, wrapperName?: string): Resolver<TSource, TContext, TNewArgs>;
|
116 | wrapCloneArg(argName: string, newTypeName: string): Resolver<TSource, TContext, TArgs>;
|
117 | wrapType(cb: (prevType: ComposeOutputType<TContext>) => ComposeOutputTypeDefinition<TContext>, wrapperName?: string): Resolver<TSource, TContext, TArgs>;
|
118 | getFieldConfig(opts?: {
|
119 | projection?: ProjectionType;
|
120 | }): GraphQLFieldConfig<TSource, TContext, TArgs>;
|
121 | getFieldResolver(opts?: {
|
122 | projection?: ProjectionType;
|
123 | }): GraphQLFieldResolver<TSource, TContext, TArgs>;
|
124 | getKind(): ResolverKinds | void;
|
125 | setKind(kind: string): this;
|
126 | getDescription(): string | undefined;
|
127 | setDescription(description: string | undefined): this;
|
128 | getDeprecationReason(): string | undefined | null;
|
129 | setDeprecationReason(reason: string | undefined): this;
|
130 | get(path: string | string[]): TypeInPath<TContext> | void;
|
131 | clone<TNewSource, TNewArgs>(opts?: Partial<ResolverDefinition<TNewSource, TContext, TNewArgs>>): Resolver<TNewSource, TContext, TNewArgs>;
|
132 | cloneTo(anotherSchemaComposer: SchemaComposer<any>, cloneMap?: Map<any, any>): Resolver<any, any, any>;
|
133 | getExtensions(): Extensions;
|
134 | setExtensions(extensions: Extensions): this;
|
135 | extendExtensions(extensions: Extensions): this;
|
136 | clearExtensions(): this;
|
137 | getExtension(extensionName: string): unknown;
|
138 | hasExtension(extensionName: string): boolean;
|
139 | setExtension(extensionName: string, value: unknown): this;
|
140 | removeExtension(extensionName: string): this;
|
141 | getNestedName(): string;
|
142 | toString(): string;
|
143 | setDisplayName(name: string): this;
|
144 | toDebugStructure(): Record<string, any>;
|
145 | debugExecTime(): Resolver<TSource, TContext, TArgs>;
|
146 | debugParams(filterPaths?: string | string[] | undefined | null, opts?: ResolverDebugOpts): Resolver<TSource, TContext, TArgs>;
|
147 | debugPayload(filterPaths?: string | string[] | undefined | null, opts?: ResolverDebugOpts): Resolver<TSource, TContext, TArgs>;
|
148 | debug(filterDotPaths?: {
|
149 | params?: string | string[] | undefined | null;
|
150 | payload?: string | string[] | undefined | null;
|
151 | }, opts?: ResolverDebugOpts): Resolver<TSource, TContext, TArgs>;
|
152 | }
|
153 | //# sourceMappingURL=Resolver.d.ts.map |
\ | No newline at end of file |