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 | }
|
15 | export interface RawTypesConfig extends RawConfig {
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | addUnderscoreToArgsType?: boolean;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | enumValues?: EnumValuesMap;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | declarationKind?: DeclarationKind | DeclarationKindConfig;
|
73 | |
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | enumPrefix?: boolean;
|
86 | |
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | fieldWrapperValue?: string;
|
103 | |
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | wrapFieldDefinitions?: boolean;
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | onlyOperationTypes?: boolean;
|
136 | }
|
137 | export declare class BaseTypesVisitor<TRawConfig extends RawTypesConfig = RawTypesConfig, TPluginConfig extends ParsedTypesConfig = ParsedTypesConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
138 | protected _schema: GraphQLSchema;
|
139 | protected _argumentsTransformer: OperationVariablesToObject;
|
140 | constructor(_schema: GraphQLSchema, rawConfig: TRawConfig, additionalConfig: TPluginConfig, defaultScalars?: NormalizedScalarsMap);
|
141 | protected getExportPrefix(): string;
|
142 | getFieldWrapperValue(): string;
|
143 | getScalarsImports(): string[];
|
144 | get scalarsDefinition(): string;
|
145 | setDeclarationBlockConfig(config: DeclarationBlockConfig): void;
|
146 | setArgumentsTransformer(argumentsTransfomer: OperationVariablesToObject): void;
|
147 | NonNullType(node: NonNullTypeNode): string;
|
148 | getInputObjectDeclarationBlock(node: InputObjectTypeDefinitionNode): DeclarationBlock;
|
149 | InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
|
150 | InputValueDefinition(node: InputValueDefinitionNode): string;
|
151 | Name(node: NameNode): string;
|
152 | FieldDefinition(node: FieldDefinitionNode): string;
|
153 | UnionTypeDefinition(node: UnionTypeDefinitionNode, key: string | number | undefined, parent: any): string;
|
154 | protected mergeInterfaces(interfaces: string[], hasOtherFields: boolean): string;
|
155 | appendInterfacesAndFieldsToBlock(block: DeclarationBlock, interfaces: string[], fields: string[]): void;
|
156 | getObjectTypeDeclarationBlock(node: ObjectTypeDefinitionNode, originalNode: ObjectTypeDefinitionNode): DeclarationBlock;
|
157 | getFieldComment(node: FieldDefinitionNode): string;
|
158 | protected mergeAllFields(allFields: string[], hasInterfaces: boolean): string;
|
159 | ObjectTypeDefinition(node: ObjectTypeDefinitionNode, key: number | string | undefined, parent: any): string;
|
160 | getInterfaceTypeDeclarationBlock(node: InterfaceTypeDefinitionNode, originalNode: InterfaceTypeDefinitionNode): DeclarationBlock;
|
161 | InterfaceTypeDefinition(node: InterfaceTypeDefinitionNode, key: number | string | undefined, parent: any): string;
|
162 | ScalarTypeDefinition(node: ScalarTypeDefinitionNode): string;
|
163 | protected _buildTypeImport(identifier: string, source: string, asDefault?: boolean): string;
|
164 | protected handleEnumValueMapper(typeIdentifier: string, importIdentifier: string | null, sourceIdentifier: string | null, sourceFile: string | null): string[];
|
165 | getEnumsImports(): string[];
|
166 | EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
|
167 | StringValue(node: StringValueNode): string;
|
168 | protected buildEnumValuesBlock(typeName: string, values: ReadonlyArray<EnumValueDefinitionNode>): string;
|
169 | DirectiveDefinition(node: DirectiveDefinitionNode): string;
|
170 | getArgumentsObjectDeclarationBlock(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode): DeclarationBlock;
|
171 | getArgumentsObjectTypeDefinition(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode): string;
|
172 | protected buildArgumentsBlock(node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode): string;
|
173 | protected _getScalar(name: string): string;
|
174 | protected _getTypeForNode(node: NamedTypeNode): string;
|
175 | NamedType(node: NamedTypeNode, key: any, parent: any, path: any, ancestors: any): string;
|
176 | ListType(node: ListTypeNode): string;
|
177 | SchemaDefinition(): any;
|
178 | protected getDeprecationReason(directive: DirectiveNode): string | void;
|
179 | protected wrapWithListType(str: string): string;
|
180 | }
|