1 | import { DirectiveDefinitionNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ListTypeNode, NamedTypeNode, NameNode, NonNullTypeNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, UnionTypeDefinitionNode, StringValueNode, DirectiveNode } from 'graphql';
|
2 | import { BaseVisitor, ParsedConfig, RawConfig } from './base-visitor';
|
3 | import { EnumValuesMap, NormalizedScalarsMap, DeclarationKindConfig, DeclarationKind, ParsedEnumValuesMap } from './types';
|
4 | import { DeclarationBlock, DeclarationBlockConfig } from './utils';
|
5 | import { OperationVariablesToObject } from './variables-to-object';
|
6 | export interface ParsedTypesConfig extends ParsedConfig {
|
7 | enumValues: ParsedEnumValuesMap;
|
8 | declarationKind: DeclarationKindConfig;
|
9 | addUnderscoreToArgsType: boolean;
|
10 | onlyOperationTypes: boolean;
|
11 | enumPrefix: boolean;
|
12 | fieldWrapperValue: string;
|
13 | wrapFieldDefinitions: boolean;
|
14 | entireFieldWrapperValue: string;
|
15 | wrapEntireDefinitions: boolean;
|
16 | ignoreEnumValuesFromSchema: boolean;
|
17 | }
|
18 | export interface RawTypesConfig extends RawConfig {
|
19 | |
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | addUnderscoreToArgsType?: boolean;
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | enumValues?: EnumValuesMap;
|
57 | |
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | declarationKind?: DeclarationKind | DeclarationKindConfig;
|
76 | |
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | enumPrefix?: boolean;
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | fieldWrapperValue?: string;
|
106 | |
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | wrapFieldDefinitions?: boolean;
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | onlyOperationTypes?: boolean;
|
139 | |
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 | ignoreEnumValuesFromSchema?: boolean;
|
155 | |
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | wrapEntireFieldDefinitions?: boolean;
|
175 | |
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | entireFieldWrapperValue?: string;
|
193 | }
|
194 | export declare class BaseTypesVisitor<TRawConfig extends RawTypesConfig = RawTypesConfig, TPluginConfig extends ParsedTypesConfig = ParsedTypesConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
195 | protected _schema: GraphQLSchema;
|
196 | protected _argumentsTransformer: OperationVariablesToObject;
|
197 | constructor(_schema: GraphQLSchema, rawConfig: TRawConfig, additionalConfig: TPluginConfig, defaultScalars?: NormalizedScalarsMap);
|
198 | protected getExportPrefix(): string;
|
199 | getFieldWrapperValue(): string;
|
200 | getEntireFieldWrapperValue(): string;
|
201 | getScalarsImports(): string[];
|
202 | get scalarsDefinition(): string;
|
203 | setDeclarationBlockConfig(config: DeclarationBlockConfig): void;
|
204 | setArgumentsTransformer(argumentsTransfomer: OperationVariablesToObject): void;
|
205 | NonNullType(node: NonNullTypeNode): string;
|
206 | getInputObjectDeclarationBlock(node: InputObjectTypeDefinitionNode): DeclarationBlock;
|
207 | InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
|
208 | InputValueDefinition(node: InputValueDefinitionNode): string;
|
209 | Name(node: NameNode): string;
|
210 | FieldDefinition(node: FieldDefinitionNode): string;
|
211 | UnionTypeDefinition(node: UnionTypeDefinitionNode, key: string | number | undefined, parent: any): string;
|
212 | protected mergeInterfaces(interfaces: string[], hasOtherFields: boolean): string;
|
213 | appendInterfacesAndFieldsToBlock(block: DeclarationBlock, interfaces: string[], fields: string[]): void;
|
214 | getObjectTypeDeclarationBlock(node: ObjectTypeDefinitionNode, originalNode: ObjectTypeDefinitionNode): DeclarationBlock;
|
215 | getFieldComment(node: FieldDefinitionNode): string;
|
216 | protected mergeAllFields(allFields: string[], _hasInterfaces: boolean): string;
|
217 | ObjectTypeDefinition(node: ObjectTypeDefinitionNode, key: number | string, parent: any): string;
|
218 | getInterfaceTypeDeclarationBlock(node: InterfaceTypeDefinitionNode, _originalNode: InterfaceTypeDefinitionNode): DeclarationBlock;
|
219 | InterfaceTypeDefinition(node: InterfaceTypeDefinitionNode, key: number | string, parent: any): string;
|
220 | ScalarTypeDefinition(_node: ScalarTypeDefinitionNode): string;
|
221 | protected _buildTypeImport(identifier: string, source: string, asDefault?: boolean): string;
|
222 | protected handleEnumValueMapper(typeIdentifier: string, importIdentifier: string | null, sourceIdentifier: string | null, sourceFile: string | null): string[];
|
223 | getEnumsImports(): string[];
|
224 | EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
|
225 | StringValue(node: StringValueNode): string;
|
226 | protected makeValidEnumIdentifier(identifier: string): string;
|
227 | protected buildEnumValuesBlock(typeName: string, values: ReadonlyArray<EnumValueDefinitionNode>): string;
|
228 | DirectiveDefinition(_node: DirectiveDefinitionNode): string;
|
229 | getArgumentsObjectDeclarationBlock(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode): DeclarationBlock;
|
230 | getArgumentsObjectTypeDefinition(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode): string;
|
231 | protected buildArgumentsBlock(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode): string;
|
232 | protected _getScalar(name: string): string;
|
233 | protected _getTypeForNode(node: NamedTypeNode): string;
|
234 | NamedType(node: NamedTypeNode, key: any, parent: any, path: any, ancestors: any): string;
|
235 | ListType(node: ListTypeNode): string;
|
236 | SchemaDefinition(): any;
|
237 | protected getDeprecationReason(directive: DirectiveNode): string | void;
|
238 | protected wrapWithListType(str: string): string;
|
239 | }
|