1 | import { IResolvers, IResolverValidationOptions } from '@graphql-tools/utils';
|
2 | import { Type } from '@nestjs/common';
|
3 | import { ModuleMetadata } from '@nestjs/common/interfaces';
|
4 | import { GraphQLSchema } from 'graphql';
|
5 | import { GraphQLDriver } from '.';
|
6 | import { DefinitionsGeneratorOptions } from '../graphql-ast.explorer';
|
7 | import { BuildSchemaOptions } from './build-schema-options.interface';
|
8 | import { AutoSchemaFileValue } from './schema-file-config.interface';
|
9 | export type Enhancer = 'guards' | 'interceptors' | 'filters';
|
10 |
|
11 |
|
12 |
|
13 | export interface GqlModuleOptions<TDriver extends GraphQLDriver = any> {
|
14 | |
15 |
|
16 |
|
17 | path?: string;
|
18 | |
19 |
|
20 |
|
21 | typeDefs?: string | string[];
|
22 | |
23 |
|
24 |
|
25 | typePaths?: string[];
|
26 | |
27 |
|
28 |
|
29 | driver?: Type<TDriver>;
|
30 | |
31 |
|
32 |
|
33 | include?: Function[];
|
34 | |
35 |
|
36 |
|
37 | directiveResolvers?: any;
|
38 | |
39 |
|
40 |
|
41 | schema?: GraphQLSchema;
|
42 | |
43 |
|
44 |
|
45 | resolvers?: IResolvers | Array<IResolvers>;
|
46 | |
47 |
|
48 |
|
49 | definitions?: {
|
50 | path?: string;
|
51 | outputAs?: 'class' | 'interface';
|
52 | } & DefinitionsGeneratorOptions;
|
53 | |
54 |
|
55 |
|
56 | autoSchemaFile?: AutoSchemaFileValue;
|
57 | |
58 |
|
59 |
|
60 | sortSchema?: boolean;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | buildSchemaOptions?: BuildSchemaOptions;
|
66 | |
67 |
|
68 |
|
69 |
|
70 |
|
71 | useGlobalPrefix?: boolean;
|
72 | |
73 |
|
74 |
|
75 | fieldResolverEnhancers?: Enhancer[];
|
76 | |
77 |
|
78 |
|
79 | resolverValidationOptions?: IResolverValidationOptions;
|
80 | |
81 |
|
82 |
|
83 | inheritResolversFromInterfaces?: boolean;
|
84 | |
85 |
|
86 |
|
87 | transformSchema?: (schema: GraphQLSchema) => GraphQLSchema | Promise<GraphQLSchema>;
|
88 | |
89 |
|
90 |
|
91 | transformAutoSchemaFile?: boolean;
|
92 | |
93 |
|
94 |
|
95 | context?: any;
|
96 | |
97 |
|
98 |
|
99 | metadata?: () => Promise<Record<string, any>>;
|
100 | }
|
101 | export interface GqlOptionsFactory<T extends Record<string, any> = GqlModuleOptions> {
|
102 | createGqlOptions(): Promise<Omit<T, 'driver'>> | Omit<T, 'driver'>;
|
103 | }
|
104 | export interface GqlModuleAsyncOptions<TOptions extends Record<string, any> = GqlModuleOptions, TFactory = GqlOptionsFactory<TOptions>> extends Pick<ModuleMetadata, 'imports'> {
|
105 | |
106 |
|
107 |
|
108 | driver?: TOptions['driver'];
|
109 | useExisting?: Type<TFactory>;
|
110 | useClass?: Type<TFactory>;
|
111 | useFactory?: (...args: any[]) => Promise<Omit<TOptions, 'driver'>> | Omit<TOptions, 'driver'>;
|
112 | inject?: any[];
|
113 | }
|
114 |
|
\ | No newline at end of file |