@graphql-codegen/visitor-plugin-common 5.3.1 → 5.4.0-alpha-20240728124515-0e7e51fbc250f3e96f346caed708834ffc0a8ddf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -165,6 +165,8 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
165
165
|
return node.value;
|
|
166
166
|
}
|
|
167
167
|
FieldDefinition(node) {
|
|
168
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
169
|
+
return '';
|
|
168
170
|
if (this.config.onlyEnums)
|
|
169
171
|
return '';
|
|
170
172
|
const typeString = node.type;
|
|
@@ -173,6 +175,8 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
173
175
|
return comment + (0, utils_js_1.indent)(`${node.name}: ${typeString}${this.getPunctuation(type)}`);
|
|
174
176
|
}
|
|
175
177
|
UnionTypeDefinition(node, key, parent) {
|
|
178
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
179
|
+
return '';
|
|
176
180
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
177
181
|
return '';
|
|
178
182
|
const originalNode = parent[key];
|
|
@@ -226,6 +230,8 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
226
230
|
return allFields.join('\n');
|
|
227
231
|
}
|
|
228
232
|
ObjectTypeDefinition(node, key, parent) {
|
|
233
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
234
|
+
return '';
|
|
229
235
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
230
236
|
return '';
|
|
231
237
|
const originalNode = parent[key];
|
|
@@ -242,6 +248,8 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
242
248
|
return declarationBlock.withBlock(node.fields.join('\n'));
|
|
243
249
|
}
|
|
244
250
|
InterfaceTypeDefinition(node, key, parent) {
|
|
251
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
252
|
+
return '';
|
|
245
253
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
246
254
|
return '';
|
|
247
255
|
const originalNode = parent[key];
|
|
@@ -162,6 +162,8 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
162
162
|
return node.value;
|
|
163
163
|
}
|
|
164
164
|
FieldDefinition(node) {
|
|
165
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
166
|
+
return '';
|
|
165
167
|
if (this.config.onlyEnums)
|
|
166
168
|
return '';
|
|
167
169
|
const typeString = node.type;
|
|
@@ -170,6 +172,8 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
170
172
|
return comment + indent(`${node.name}: ${typeString}${this.getPunctuation(type)}`);
|
|
171
173
|
}
|
|
172
174
|
UnionTypeDefinition(node, key, parent) {
|
|
175
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
176
|
+
return '';
|
|
173
177
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
174
178
|
return '';
|
|
175
179
|
const originalNode = parent[key];
|
|
@@ -223,6 +227,8 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
223
227
|
return allFields.join('\n');
|
|
224
228
|
}
|
|
225
229
|
ObjectTypeDefinition(node, key, parent) {
|
|
230
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
231
|
+
return '';
|
|
226
232
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
227
233
|
return '';
|
|
228
234
|
const originalNode = parent[key];
|
|
@@ -239,6 +245,8 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
239
245
|
return declarationBlock.withBlock(node.fields.join('\n'));
|
|
240
246
|
}
|
|
241
247
|
InterfaceTypeDefinition(node, key, parent) {
|
|
248
|
+
if (this.config.onlyTypescriptOperationTypes)
|
|
249
|
+
return '';
|
|
242
250
|
if (this.config.onlyOperationTypes || this.config.onlyEnums)
|
|
243
251
|
return '';
|
|
244
252
|
const originalNode = parent[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-alpha-20240728124515-0e7e51fbc250f3e96f346caed708834ffc0a8ddf",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
6
|
},
|
|
@@ -17,6 +17,7 @@ export interface ParsedTypesConfig extends ParsedConfig {
|
|
|
17
17
|
wrapEntireDefinitions: boolean;
|
|
18
18
|
ignoreEnumValuesFromSchema: boolean;
|
|
19
19
|
directiveArgumentAndInputFieldMappings: ParsedDirectiveArgumentAndInputFieldMappings;
|
|
20
|
+
onlyTypescriptOperationTypes: boolean;
|
|
20
21
|
}
|
|
21
22
|
export interface RawTypesConfig extends RawConfig {
|
|
22
23
|
/**
|
|
@@ -17,6 +17,7 @@ export interface ParsedTypesConfig extends ParsedConfig {
|
|
|
17
17
|
wrapEntireDefinitions: boolean;
|
|
18
18
|
ignoreEnumValuesFromSchema: boolean;
|
|
19
19
|
directiveArgumentAndInputFieldMappings: ParsedDirectiveArgumentAndInputFieldMappings;
|
|
20
|
+
onlyTypescriptOperationTypes: boolean;
|
|
20
21
|
}
|
|
21
22
|
export interface RawTypesConfig extends RawConfig {
|
|
22
23
|
/**
|