@graphql-codegen/visitor-plugin-common 3.1.0-alpha-20230323121829-b809ff838 → 3.1.0-alpha-20230323123056-e823c9bbd

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.
@@ -17,13 +17,13 @@ class BaseSelectionSetProcessor {
17
17
  }
18
18
  return `(\n ${pieces.join(`\n & `)}\n)`;
19
19
  }
20
- transformPrimitiveFields(_schemaType, _fields, _unsetTypes) {
20
+ transformPrimitiveFields(_schemaType, _fields) {
21
21
  throw new Error(`Please override "transformPrimitiveFields" as part of your BaseSelectionSetProcessor implementation!`);
22
22
  }
23
- transformAliasesPrimitiveFields(_schemaType, _fields, _unsetTypes) {
23
+ transformAliasesPrimitiveFields(_schemaType, _fields) {
24
24
  throw new Error(`Please override "transformAliasesPrimitiveFields" as part of your BaseSelectionSetProcessor implementation!`);
25
25
  }
26
- transformLinkFields(_fields, _unsetTypes) {
26
+ transformLinkFields(_fields) {
27
27
  throw new Error(`Please override "transformLinkFields" as part of your BaseSelectionSetProcessor implementation!`);
28
28
  }
29
29
  transformTypenameField(_type, _name) {
@@ -13,7 +13,7 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
13
13
  },
14
14
  ];
15
15
  }
16
- transformPrimitiveFields(schemaType, fields, unsetTypes) {
16
+ transformPrimitiveFields(schemaType, fields) {
17
17
  if (fields.length === 0) {
18
18
  return [];
19
19
  }
@@ -23,13 +23,6 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
23
23
  let typeToUse = baseType.name;
24
24
  const useInnerType = field.isConditional && (0, graphql_1.isNonNullType)(fieldObj.type);
25
25
  const innerType = useInnerType ? (0, plugin_helpers_1.removeNonNullWrapper)(fieldObj.type) : undefined;
26
- const name = this.config.formatNamedField(field.fieldName, useInnerType ? innerType : fieldObj.type, field.isConditional, unsetTypes);
27
- if (unsetTypes) {
28
- return {
29
- name,
30
- type: 'never',
31
- };
32
- }
33
26
  if ((0, graphql_1.isEnumType)(baseType)) {
34
27
  typeToUse =
35
28
  (this.config.namespacedImportName ? `${this.config.namespacedImportName}.` : '') +
@@ -38,6 +31,7 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
38
31
  else if (this.config.scalars[baseType.name]) {
39
32
  typeToUse = this.config.scalars[baseType.name];
40
33
  }
34
+ const name = this.config.formatNamedField(field.fieldName, useInnerType ? innerType : fieldObj.type, field.isConditional);
41
35
  const wrappedType = this.config.wrapTypeWithModifiers(typeToUse, fieldObj.type);
42
36
  return {
43
37
  name,
@@ -45,7 +39,7 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
45
39
  };
46
40
  });
47
41
  }
48
- transformAliasesPrimitiveFields(schemaType, fields, unsetTypes) {
42
+ transformAliasesPrimitiveFields(schemaType, fields) {
49
43
  if (fields.length === 0) {
50
44
  return [];
51
45
  }
@@ -65,13 +59,7 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
65
59
  (this.config.namespacedImportName ? `${this.config.namespacedImportName}.` : '') +
66
60
  this.config.convertName(baseType.name, { useTypesPrefix: this.config.enumPrefix });
67
61
  }
68
- const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type, undefined, unsetTypes);
69
- if (unsetTypes) {
70
- return {
71
- type: 'never',
72
- name,
73
- };
74
- }
62
+ const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type);
75
63
  const wrappedType = this.config.wrapTypeWithModifiers(typeToUse, fieldObj.type);
76
64
  return {
77
65
  name,
@@ -79,13 +67,13 @@ class PreResolveTypesProcessor extends base_js_1.BaseSelectionSetProcessor {
79
67
  };
80
68
  });
81
69
  }
82
- transformLinkFields(fields, unsetTypes) {
70
+ transformLinkFields(fields) {
83
71
  if (fields.length === 0) {
84
72
  return [];
85
73
  }
86
74
  return fields.map(field => ({
87
75
  name: field.alias || field.name,
88
- type: unsetTypes ? 'never' : field.selectionSet,
76
+ type: field.selectionSet,
89
77
  }));
90
78
  }
91
79
  }
@@ -48,17 +48,8 @@ class SelectionSetToObject {
48
48
  const { fields, inlines, spreads } = (0, utils_js_1.separateSelectionSet)(node.selectionSet.selections);
49
49
  const spreadsUsage = this.buildFragmentSpreadsUsage(spreads);
50
50
  const directives = node.directives || undefined;
51
- // When we collect the selection sets of inline fragments we need to
52
- // make sure directives on the inline fragments are stored in a way
53
- // that can be associated back to the fields in the fragment, to
54
- // support things like making those fields optional when deferring a
55
- // fragment (using @defer).
56
- const fieldsWithFragmentDirectives = fields.map(field => ({
57
- ...field,
58
- fragmentDirectives: field.fragmentDirectives || directives,
59
- }));
60
51
  if ((0, graphql_1.isObjectType)(typeOnSchema)) {
61
- this._appendToTypeMap(types, typeOnSchema.name, fieldsWithFragmentDirectives);
52
+ this._appendToTypeMap(types, typeOnSchema.name, fields);
62
53
  this._appendToTypeMap(types, typeOnSchema.name, spreadsUsage[typeOnSchema.name]);
63
54
  this._appendToTypeMap(types, typeOnSchema.name, directives);
64
55
  this._collectInlineFragments(typeOnSchema, inlines, types);
@@ -169,7 +160,6 @@ class SelectionSetToObject {
169
160
  typeName: usage,
170
161
  onType: fragmentSpreadObject.onType,
171
162
  selectionNodes: [...fragmentSpreadObject.node.selectionSet.selections],
172
- fragmentDirectives: [...spread.directives],
173
163
  });
174
164
  }
175
165
  }
@@ -231,17 +221,8 @@ class SelectionSetToObject {
231
221
  if (!(0, graphql_1.isObjectType)(schemaType)) {
232
222
  throw new TypeError(`Invalid state! Schema type ${typeName} is not a valid GraphQL object!`);
233
223
  }
234
- const allNodes = selectionNodesByTypeName.get(typeName) || [];
224
+ const selectionNodes = selectionNodesByTypeName.get(typeName) || [];
235
225
  prev[typeName] || (prev[typeName] = []);
236
- const { incrementalNodes, selectionNodes } = allNodes.reduce((acc, node) => {
237
- if ('fragmentDirectives' in node && (0, utils_js_1.hasIncrementalDeliveryDirectives)(node.fragmentDirectives)) {
238
- acc.incrementalNodes.push(node);
239
- }
240
- else {
241
- acc.selectionNodes.push(node);
242
- }
243
- return acc;
244
- }, { selectionNodes: [], incrementalNodes: [] });
245
226
  const { fields } = this.buildSelectionSet(schemaType, selectionNodes);
246
227
  const transformedSet = this.selectionSetStringFromFields(fields);
247
228
  if (transformedSet) {
@@ -250,22 +231,6 @@ class SelectionSetToObject {
250
231
  else {
251
232
  mustAddEmptyObject = true;
252
233
  }
253
- for (const incrementalNode of incrementalNodes) {
254
- if (this._config.inlineFragmentTypes === 'mask' && 'fragmentName' in incrementalNode) {
255
- const { fields: incrementalFields } = this.buildSelectionSet(schemaType, [incrementalNode], {
256
- unsetTypes: true,
257
- });
258
- prev[typeName].push(this.selectionSetStringFromFields(incrementalFields));
259
- continue;
260
- }
261
- const { fields: initialFields } = this.buildSelectionSet(schemaType, [incrementalNode]);
262
- const { fields: subsequentFields } = this.buildSelectionSet(schemaType, [incrementalNode], {
263
- unsetTypes: true,
264
- });
265
- const initialSet = this.selectionSetStringFromFields(initialFields);
266
- const subsequentSet = this.selectionSetStringFromFields(subsequentFields);
267
- prev[typeName].push({ union: [initialSet, subsequentSet] });
268
- }
269
234
  return prev;
270
235
  }, {});
271
236
  return { grouped, mustAddEmptyObject };
@@ -338,7 +303,7 @@ class SelectionSetToObject {
338
303
  const transformedSet = this._processor.buildSelectionSetFromStrings([...allStrings, mergedObjects].filter(Boolean));
339
304
  return transformedSet;
340
305
  }
341
- buildSelectionSet(parentSchemaType, selectionNodes, options) {
306
+ buildSelectionSet(parentSchemaType, selectionNodes) {
342
307
  var _a, _b, _c;
343
308
  const primitiveFields = new Map();
344
309
  const primitiveAliasFields = new Map();
@@ -429,10 +394,9 @@ class SelectionSetToObject {
429
394
  const realSelectedFieldType = (0, plugin_helpers_1.getBaseType)(selectedFieldType);
430
395
  const selectionSet = this.createNext(realSelectedFieldType, field.selectionSet);
431
396
  const isConditional = (0, utils_js_1.hasConditionalDirectives)(field) || inlineFragmentConditional;
432
- const isOptional = options === null || options === void 0 ? void 0 : options.unsetTypes;
433
397
  linkFields.push({
434
398
  alias: field.alias ? this._processor.config.formatNamedField(field.alias.value, selectedFieldType) : undefined,
435
- name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional, isOptional),
399
+ name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional),
436
400
  type: realSelectedFieldType.name,
437
401
  selectionSet: this._processor.config.wrapTypeWithModifiers(selectionSet.transformSelectionSet().split(`\n`).join(`\n `), selectedFieldType),
438
402
  });
@@ -448,12 +412,12 @@ class SelectionSetToObject {
448
412
  ...this._processor.transformPrimitiveFields(parentSchemaType, Array.from(primitiveFields.values()).map(field => ({
449
413
  isConditional: (0, utils_js_1.hasConditionalDirectives)(field),
450
414
  fieldName: field.name.value,
451
- })), options === null || options === void 0 ? void 0 : options.unsetTypes),
415
+ }))),
452
416
  ...this._processor.transformAliasesPrimitiveFields(parentSchemaType, Array.from(primitiveAliasFields.values()).map(field => ({
453
417
  alias: field.alias.value,
454
418
  fieldName: field.name.value,
455
- })), options === null || options === void 0 ? void 0 : options.unsetTypes),
456
- ...this._processor.transformLinkFields(linkFields, options === null || options === void 0 ? void 0 : options.unsetTypes),
419
+ }))),
420
+ ...this._processor.transformLinkFields(linkFields),
457
421
  ].filter(Boolean);
458
422
  const allStrings = transformed.filter(t => typeof t === 'string');
459
423
  const allObjectsMerged = transformed
@@ -469,9 +433,7 @@ class SelectionSetToObject {
469
433
  fields.push(...fragmentsSpreadUsages);
470
434
  }
471
435
  else if (this._config.inlineFragmentTypes === 'mask') {
472
- fields.push(`{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages
473
- .map(name => `'${name}': ${(options === null || options === void 0 ? void 0 : options.unsetTypes) ? `Incremental<${name}>` : name}`)
474
- .join(`;`)} } }`);
436
+ fields.push(`{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages.map(name => `'${name}': ${name}`).join(`;`)} } }`);
475
437
  }
476
438
  }
477
439
  return { typeInfo: typeInfoField, fields };
@@ -509,19 +471,14 @@ class SelectionSetToObject {
509
471
  }
510
472
  return (Object.keys(grouped)
511
473
  .map(typeName => {
512
- const hasUnions = grouped[typeName].filter(s => typeof s !== 'string' && s.union).length > 0;
513
474
  const relevant = grouped[typeName].filter(Boolean);
514
475
  if (relevant.length === 0) {
515
476
  return null;
516
477
  }
517
- const res = relevant
518
- .map(selectionObject => {
519
- if (typeof selectionObject === 'string')
520
- return selectionObject;
521
- return '(' + selectionObject.union.join(' | ') + ')';
522
- })
523
- .join(' & ');
524
- return relevant.length > 1 && !hasUnions ? `( ${res} )` : res;
478
+ if (relevant.length === 1) {
479
+ return relevant[0];
480
+ }
481
+ return `( ${relevant.join(' & ')} )`;
525
482
  })
526
483
  .filter(Boolean)
527
484
  .join(' | ') + this.getEmptyObjectTypeString(mustAddEmptyObject));
package/cjs/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isOneOfInputObjectType = exports.wrapTypeNodeWithModifiers = exports.removeDescription = exports.wrapTypeWithModifiers = exports.hasIncrementalDeliveryDirectives = exports.hasConditionalDirectives = exports.getPossibleTypes = exports.separateSelectionSet = exports.getFieldNodeNameValue = exports.mergeSelectionSets = exports.REQUIRE_FIELDS_TYPE = exports.OMIT_TYPE = exports.stripMapperTypeInterpolation = exports.getRootTypeNames = exports.buildScalars = exports.buildScalarsFromConfig = exports.convertNameParts = exports.getBaseTypeNode = exports.DeclarationBlock = exports.transformComment = exports.indentMultiline = exports.indent = exports.breakLine = exports.wrapWithSingleQuotes = exports.block = exports.quoteIfNeeded = exports.getConfigValue = void 0;
3
+ exports.isOneOfInputObjectType = exports.wrapTypeNodeWithModifiers = exports.removeDescription = exports.wrapTypeWithModifiers = exports.hasConditionalDirectives = exports.getPossibleTypes = exports.separateSelectionSet = exports.getFieldNodeNameValue = exports.mergeSelectionSets = exports.REQUIRE_FIELDS_TYPE = exports.OMIT_TYPE = exports.stripMapperTypeInterpolation = exports.getRootTypeNames = exports.buildScalars = exports.buildScalarsFromConfig = exports.convertNameParts = exports.getBaseTypeNode = exports.DeclarationBlock = exports.transformComment = exports.indentMultiline = exports.indent = exports.breakLine = exports.wrapWithSingleQuotes = exports.block = exports.quoteIfNeeded = exports.getConfigValue = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const mappers_js_1 = require("./mappers.js");
6
6
  const scalars_js_1 = require("./scalars.js");
@@ -342,11 +342,6 @@ function hasConditionalDirectives(field) {
342
342
  return (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(directive => CONDITIONAL_DIRECTIVES.includes(directive.name.value));
343
343
  }
344
344
  exports.hasConditionalDirectives = hasConditionalDirectives;
345
- function hasIncrementalDeliveryDirectives(directives) {
346
- const INCREMENTAL_DELIVERY_DIRECTIVES = ['defer'];
347
- return directives === null || directives === void 0 ? void 0 : directives.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value));
348
- }
349
- exports.hasIncrementalDeliveryDirectives = hasIncrementalDeliveryDirectives;
350
345
  function wrapTypeWithModifiers(baseType, type, options) {
351
346
  let currentType = type;
352
347
  const modifiers = [];
@@ -14,13 +14,13 @@ export class BaseSelectionSetProcessor {
14
14
  }
15
15
  return `(\n ${pieces.join(`\n & `)}\n)`;
16
16
  }
17
- transformPrimitiveFields(_schemaType, _fields, _unsetTypes) {
17
+ transformPrimitiveFields(_schemaType, _fields) {
18
18
  throw new Error(`Please override "transformPrimitiveFields" as part of your BaseSelectionSetProcessor implementation!`);
19
19
  }
20
- transformAliasesPrimitiveFields(_schemaType, _fields, _unsetTypes) {
20
+ transformAliasesPrimitiveFields(_schemaType, _fields) {
21
21
  throw new Error(`Please override "transformAliasesPrimitiveFields" as part of your BaseSelectionSetProcessor implementation!`);
22
22
  }
23
- transformLinkFields(_fields, _unsetTypes) {
23
+ transformLinkFields(_fields) {
24
24
  throw new Error(`Please override "transformLinkFields" as part of your BaseSelectionSetProcessor implementation!`);
25
25
  }
26
26
  transformTypenameField(_type, _name) {
@@ -10,7 +10,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
10
10
  },
11
11
  ];
12
12
  }
13
- transformPrimitiveFields(schemaType, fields, unsetTypes) {
13
+ transformPrimitiveFields(schemaType, fields) {
14
14
  if (fields.length === 0) {
15
15
  return [];
16
16
  }
@@ -20,13 +20,6 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
20
20
  let typeToUse = baseType.name;
21
21
  const useInnerType = field.isConditional && isNonNullType(fieldObj.type);
22
22
  const innerType = useInnerType ? removeNonNullWrapper(fieldObj.type) : undefined;
23
- const name = this.config.formatNamedField(field.fieldName, useInnerType ? innerType : fieldObj.type, field.isConditional, unsetTypes);
24
- if (unsetTypes) {
25
- return {
26
- name,
27
- type: 'never',
28
- };
29
- }
30
23
  if (isEnumType(baseType)) {
31
24
  typeToUse =
32
25
  (this.config.namespacedImportName ? `${this.config.namespacedImportName}.` : '') +
@@ -35,6 +28,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
35
28
  else if (this.config.scalars[baseType.name]) {
36
29
  typeToUse = this.config.scalars[baseType.name];
37
30
  }
31
+ const name = this.config.formatNamedField(field.fieldName, useInnerType ? innerType : fieldObj.type, field.isConditional);
38
32
  const wrappedType = this.config.wrapTypeWithModifiers(typeToUse, fieldObj.type);
39
33
  return {
40
34
  name,
@@ -42,7 +36,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
42
36
  };
43
37
  });
44
38
  }
45
- transformAliasesPrimitiveFields(schemaType, fields, unsetTypes) {
39
+ transformAliasesPrimitiveFields(schemaType, fields) {
46
40
  if (fields.length === 0) {
47
41
  return [];
48
42
  }
@@ -62,13 +56,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
62
56
  (this.config.namespacedImportName ? `${this.config.namespacedImportName}.` : '') +
63
57
  this.config.convertName(baseType.name, { useTypesPrefix: this.config.enumPrefix });
64
58
  }
65
- const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type, undefined, unsetTypes);
66
- if (unsetTypes) {
67
- return {
68
- type: 'never',
69
- name,
70
- };
71
- }
59
+ const name = this.config.formatNamedField(aliasedField.alias, fieldObj.type);
72
60
  const wrappedType = this.config.wrapTypeWithModifiers(typeToUse, fieldObj.type);
73
61
  return {
74
62
  name,
@@ -76,13 +64,13 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor {
76
64
  };
77
65
  });
78
66
  }
79
- transformLinkFields(fields, unsetTypes) {
67
+ transformLinkFields(fields) {
80
68
  if (fields.length === 0) {
81
69
  return [];
82
70
  }
83
71
  return fields.map(field => ({
84
72
  name: field.alias || field.name,
85
- type: unsetTypes ? 'never' : field.selectionSet,
73
+ type: field.selectionSet,
86
74
  }));
87
75
  }
88
76
  }
@@ -3,7 +3,7 @@ import { getBaseType } from '@graphql-codegen/plugin-helpers';
3
3
  import { getRootTypes } from '@graphql-tools/utils';
4
4
  import autoBind from 'auto-bind';
5
5
  import { isInterfaceType, isListType, isNonNullType, isObjectType, isTypeSubTypeOf, isUnionType, Kind, SchemaMetaFieldDef, TypeMetaFieldDef, } from 'graphql';
6
- import { DeclarationBlock, getFieldNodeNameValue, getPossibleTypes, hasConditionalDirectives, hasIncrementalDeliveryDirectives, mergeSelectionSets, separateSelectionSet, } from './utils.js';
6
+ import { DeclarationBlock, getFieldNodeNameValue, getPossibleTypes, hasConditionalDirectives, mergeSelectionSets, separateSelectionSet, } from './utils.js';
7
7
  function isMetadataFieldName(name) {
8
8
  return ['__schema', '__type'].includes(name);
9
9
  }
@@ -44,17 +44,8 @@ export class SelectionSetToObject {
44
44
  const { fields, inlines, spreads } = separateSelectionSet(node.selectionSet.selections);
45
45
  const spreadsUsage = this.buildFragmentSpreadsUsage(spreads);
46
46
  const directives = node.directives || undefined;
47
- // When we collect the selection sets of inline fragments we need to
48
- // make sure directives on the inline fragments are stored in a way
49
- // that can be associated back to the fields in the fragment, to
50
- // support things like making those fields optional when deferring a
51
- // fragment (using @defer).
52
- const fieldsWithFragmentDirectives = fields.map(field => ({
53
- ...field,
54
- fragmentDirectives: field.fragmentDirectives || directives,
55
- }));
56
47
  if (isObjectType(typeOnSchema)) {
57
- this._appendToTypeMap(types, typeOnSchema.name, fieldsWithFragmentDirectives);
48
+ this._appendToTypeMap(types, typeOnSchema.name, fields);
58
49
  this._appendToTypeMap(types, typeOnSchema.name, spreadsUsage[typeOnSchema.name]);
59
50
  this._appendToTypeMap(types, typeOnSchema.name, directives);
60
51
  this._collectInlineFragments(typeOnSchema, inlines, types);
@@ -165,7 +156,6 @@ export class SelectionSetToObject {
165
156
  typeName: usage,
166
157
  onType: fragmentSpreadObject.onType,
167
158
  selectionNodes: [...fragmentSpreadObject.node.selectionSet.selections],
168
- fragmentDirectives: [...spread.directives],
169
159
  });
170
160
  }
171
161
  }
@@ -227,17 +217,8 @@ export class SelectionSetToObject {
227
217
  if (!isObjectType(schemaType)) {
228
218
  throw new TypeError(`Invalid state! Schema type ${typeName} is not a valid GraphQL object!`);
229
219
  }
230
- const allNodes = selectionNodesByTypeName.get(typeName) || [];
220
+ const selectionNodes = selectionNodesByTypeName.get(typeName) || [];
231
221
  prev[typeName] || (prev[typeName] = []);
232
- const { incrementalNodes, selectionNodes } = allNodes.reduce((acc, node) => {
233
- if ('fragmentDirectives' in node && hasIncrementalDeliveryDirectives(node.fragmentDirectives)) {
234
- acc.incrementalNodes.push(node);
235
- }
236
- else {
237
- acc.selectionNodes.push(node);
238
- }
239
- return acc;
240
- }, { selectionNodes: [], incrementalNodes: [] });
241
222
  const { fields } = this.buildSelectionSet(schemaType, selectionNodes);
242
223
  const transformedSet = this.selectionSetStringFromFields(fields);
243
224
  if (transformedSet) {
@@ -246,22 +227,6 @@ export class SelectionSetToObject {
246
227
  else {
247
228
  mustAddEmptyObject = true;
248
229
  }
249
- for (const incrementalNode of incrementalNodes) {
250
- if (this._config.inlineFragmentTypes === 'mask' && 'fragmentName' in incrementalNode) {
251
- const { fields: incrementalFields } = this.buildSelectionSet(schemaType, [incrementalNode], {
252
- unsetTypes: true,
253
- });
254
- prev[typeName].push(this.selectionSetStringFromFields(incrementalFields));
255
- continue;
256
- }
257
- const { fields: initialFields } = this.buildSelectionSet(schemaType, [incrementalNode]);
258
- const { fields: subsequentFields } = this.buildSelectionSet(schemaType, [incrementalNode], {
259
- unsetTypes: true,
260
- });
261
- const initialSet = this.selectionSetStringFromFields(initialFields);
262
- const subsequentSet = this.selectionSetStringFromFields(subsequentFields);
263
- prev[typeName].push({ union: [initialSet, subsequentSet] });
264
- }
265
230
  return prev;
266
231
  }, {});
267
232
  return { grouped, mustAddEmptyObject };
@@ -334,7 +299,7 @@ export class SelectionSetToObject {
334
299
  const transformedSet = this._processor.buildSelectionSetFromStrings([...allStrings, mergedObjects].filter(Boolean));
335
300
  return transformedSet;
336
301
  }
337
- buildSelectionSet(parentSchemaType, selectionNodes, options) {
302
+ buildSelectionSet(parentSchemaType, selectionNodes) {
338
303
  var _a, _b, _c;
339
304
  const primitiveFields = new Map();
340
305
  const primitiveAliasFields = new Map();
@@ -425,10 +390,9 @@ export class SelectionSetToObject {
425
390
  const realSelectedFieldType = getBaseType(selectedFieldType);
426
391
  const selectionSet = this.createNext(realSelectedFieldType, field.selectionSet);
427
392
  const isConditional = hasConditionalDirectives(field) || inlineFragmentConditional;
428
- const isOptional = options === null || options === void 0 ? void 0 : options.unsetTypes;
429
393
  linkFields.push({
430
394
  alias: field.alias ? this._processor.config.formatNamedField(field.alias.value, selectedFieldType) : undefined,
431
- name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional, isOptional),
395
+ name: this._processor.config.formatNamedField(field.name.value, selectedFieldType, isConditional),
432
396
  type: realSelectedFieldType.name,
433
397
  selectionSet: this._processor.config.wrapTypeWithModifiers(selectionSet.transformSelectionSet().split(`\n`).join(`\n `), selectedFieldType),
434
398
  });
@@ -444,12 +408,12 @@ export class SelectionSetToObject {
444
408
  ...this._processor.transformPrimitiveFields(parentSchemaType, Array.from(primitiveFields.values()).map(field => ({
445
409
  isConditional: hasConditionalDirectives(field),
446
410
  fieldName: field.name.value,
447
- })), options === null || options === void 0 ? void 0 : options.unsetTypes),
411
+ }))),
448
412
  ...this._processor.transformAliasesPrimitiveFields(parentSchemaType, Array.from(primitiveAliasFields.values()).map(field => ({
449
413
  alias: field.alias.value,
450
414
  fieldName: field.name.value,
451
- })), options === null || options === void 0 ? void 0 : options.unsetTypes),
452
- ...this._processor.transformLinkFields(linkFields, options === null || options === void 0 ? void 0 : options.unsetTypes),
415
+ }))),
416
+ ...this._processor.transformLinkFields(linkFields),
453
417
  ].filter(Boolean);
454
418
  const allStrings = transformed.filter(t => typeof t === 'string');
455
419
  const allObjectsMerged = transformed
@@ -465,9 +429,7 @@ export class SelectionSetToObject {
465
429
  fields.push(...fragmentsSpreadUsages);
466
430
  }
467
431
  else if (this._config.inlineFragmentTypes === 'mask') {
468
- fields.push(`{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages
469
- .map(name => `'${name}': ${(options === null || options === void 0 ? void 0 : options.unsetTypes) ? `Incremental<${name}>` : name}`)
470
- .join(`;`)} } }`);
432
+ fields.push(`{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages.map(name => `'${name}': ${name}`).join(`;`)} } }`);
471
433
  }
472
434
  }
473
435
  return { typeInfo: typeInfoField, fields };
@@ -505,19 +467,14 @@ export class SelectionSetToObject {
505
467
  }
506
468
  return (Object.keys(grouped)
507
469
  .map(typeName => {
508
- const hasUnions = grouped[typeName].filter(s => typeof s !== 'string' && s.union).length > 0;
509
470
  const relevant = grouped[typeName].filter(Boolean);
510
471
  if (relevant.length === 0) {
511
472
  return null;
512
473
  }
513
- const res = relevant
514
- .map(selectionObject => {
515
- if (typeof selectionObject === 'string')
516
- return selectionObject;
517
- return '(' + selectionObject.union.join(' | ') + ')';
518
- })
519
- .join(' & ');
520
- return relevant.length > 1 && !hasUnions ? `( ${res} )` : res;
474
+ if (relevant.length === 1) {
475
+ return relevant[0];
476
+ }
477
+ return `( ${relevant.join(' & ')} )`;
521
478
  })
522
479
  .filter(Boolean)
523
480
  .join(' | ') + this.getEmptyObjectTypeString(mustAddEmptyObject));
package/esm/utils.js CHANGED
@@ -319,10 +319,6 @@ export function hasConditionalDirectives(field) {
319
319
  const CONDITIONAL_DIRECTIVES = ['skip', 'include'];
320
320
  return (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(directive => CONDITIONAL_DIRECTIVES.includes(directive.name.value));
321
321
  }
322
- export function hasIncrementalDeliveryDirectives(directives) {
323
- const INCREMENTAL_DELIVERY_DIRECTIVES = ['defer'];
324
- return directives === null || directives === void 0 ? void 0 : directives.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value));
325
- }
326
322
  export function wrapTypeWithModifiers(baseType, type, options) {
327
323
  let currentType = type;
328
324
  const modifiers = [];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-codegen/visitor-plugin-common",
3
- "version": "3.1.0-alpha-20230323121829-b809ff838",
3
+ "version": "3.1.0-alpha-20230323123056-e823c9bbd",
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
  },
7
7
  "dependencies": {
8
8
  "@graphql-tools/optimize": "^1.3.0",
9
- "@graphql-codegen/plugin-helpers": "4.2.0-alpha-20230323121829-b809ff838",
9
+ "@graphql-codegen/plugin-helpers": "4.2.0-alpha-20230323123056-e823c9bbd",
10
10
  "@graphql-tools/relay-operation-optimizer": "^6.5.0",
11
11
  "@graphql-tools/utils": "^9.0.0",
12
12
  "auto-bind": "~4.0.0",
@@ -24,7 +24,7 @@ export type SelectionSetProcessorConfig = {
24
24
  convertName: ConvertNameFn<any>;
25
25
  enumPrefix: boolean | null;
26
26
  scalars: ScalarsMap;
27
- formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean, isOptional?: boolean): string;
27
+ formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean): string;
28
28
  wrapTypeWithModifiers(baseType: string, type: GraphQLOutputType | GraphQLNamedType): string;
29
29
  avoidOptionals?: AvoidOptionalsConfig | boolean;
30
30
  };
@@ -33,8 +33,8 @@ export declare class BaseSelectionSetProcessor<Config extends SelectionSetProces
33
33
  constructor(config: Config);
34
34
  buildFieldsIntoObject(allObjectsMerged: string[]): string;
35
35
  buildSelectionSetFromStrings(pieces: string[]): string;
36
- transformPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[], _unsetTypes?: boolean): ProcessResult;
37
- transformAliasesPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[], _unsetTypes?: boolean): ProcessResult;
38
- transformLinkFields(_fields: LinkField[], _unsetTypes?: boolean): ProcessResult;
36
+ transformPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[]): ProcessResult;
37
+ transformAliasesPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[]): ProcessResult;
38
+ transformLinkFields(_fields: LinkField[]): ProcessResult;
39
39
  transformTypenameField(_type: string, _name: string): ProcessResult;
40
40
  }
@@ -24,7 +24,7 @@ export type SelectionSetProcessorConfig = {
24
24
  convertName: ConvertNameFn<any>;
25
25
  enumPrefix: boolean | null;
26
26
  scalars: ScalarsMap;
27
- formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean, isOptional?: boolean): string;
27
+ formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean): string;
28
28
  wrapTypeWithModifiers(baseType: string, type: GraphQLOutputType | GraphQLNamedType): string;
29
29
  avoidOptionals?: AvoidOptionalsConfig | boolean;
30
30
  };
@@ -33,8 +33,8 @@ export declare class BaseSelectionSetProcessor<Config extends SelectionSetProces
33
33
  constructor(config: Config);
34
34
  buildFieldsIntoObject(allObjectsMerged: string[]): string;
35
35
  buildSelectionSetFromStrings(pieces: string[]): string;
36
- transformPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[], _unsetTypes?: boolean): ProcessResult;
37
- transformAliasesPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[], _unsetTypes?: boolean): ProcessResult;
38
- transformLinkFields(_fields: LinkField[], _unsetTypes?: boolean): ProcessResult;
36
+ transformPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[]): ProcessResult;
37
+ transformAliasesPrimitiveFields(_schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[]): ProcessResult;
38
+ transformLinkFields(_fields: LinkField[]): ProcessResult;
39
39
  transformTypenameField(_type: string, _name: string): ProcessResult;
40
40
  }
@@ -2,7 +2,7 @@ import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
2
  import { BaseSelectionSetProcessor, LinkField, PrimitiveAliasedFields, PrimitiveField, ProcessResult, SelectionSetProcessorConfig } from './base.cjs';
3
3
  export declare class PreResolveTypesProcessor extends BaseSelectionSetProcessor<SelectionSetProcessorConfig> {
4
4
  transformTypenameField(type: string, name: string): ProcessResult;
5
- transformPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveField[], unsetTypes?: boolean): ProcessResult;
6
- transformAliasesPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveAliasedFields[], unsetTypes?: boolean): ProcessResult;
7
- transformLinkFields(fields: LinkField[], unsetTypes?: boolean): ProcessResult;
5
+ transformPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveField[]): ProcessResult;
6
+ transformAliasesPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveAliasedFields[]): ProcessResult;
7
+ transformLinkFields(fields: LinkField[]): ProcessResult;
8
8
  }
@@ -2,7 +2,7 @@ import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
2
  import { BaseSelectionSetProcessor, LinkField, PrimitiveAliasedFields, PrimitiveField, ProcessResult, SelectionSetProcessorConfig } from './base.js';
3
3
  export declare class PreResolveTypesProcessor extends BaseSelectionSetProcessor<SelectionSetProcessorConfig> {
4
4
  transformTypenameField(type: string, name: string): ProcessResult;
5
- transformPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveField[], unsetTypes?: boolean): ProcessResult;
6
- transformAliasesPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveAliasedFields[], unsetTypes?: boolean): ProcessResult;
7
- transformLinkFields(fields: LinkField[], unsetTypes?: boolean): ProcessResult;
5
+ transformPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveField[]): ProcessResult;
6
+ transformAliasesPrimitiveFields(schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveAliasedFields[]): ProcessResult;
7
+ transformLinkFields(fields: LinkField[]): ProcessResult;
8
8
  }
@@ -2,18 +2,13 @@ import { DirectiveNode, FieldNode, FragmentSpreadNode, GraphQLNamedType, GraphQL
2
2
  import { ParsedDocumentsConfig } from './base-documents-visitor.cjs';
3
3
  import { BaseVisitorConvertOptions } from './base-visitor.cjs';
4
4
  import { BaseSelectionSetProcessor, LinkField, NameAndType, PrimitiveAliasedFields, PrimitiveField } from './selection-set-processor/base.cjs';
5
- import { ConvertNameFn, FragmentDirectives, GetFragmentSuffixFn, LoadedFragment, NormalizedScalarsMap } from './types.cjs';
5
+ import { ConvertNameFn, GetFragmentSuffixFn, LoadedFragment, NormalizedScalarsMap } from './types.cjs';
6
6
  type FragmentSpreadUsage = {
7
7
  fragmentName: string;
8
8
  typeName: string;
9
9
  onType: string;
10
10
  selectionNodes: Array<SelectionNode>;
11
- fragmentDirectives?: DirectiveNode[];
12
11
  };
13
- type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives;
14
- type GroupedStringifedTypes = Record<string, Array<string | {
15
- union: string[];
16
- }>>;
17
12
  export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedDocumentsConfig> {
18
13
  protected _processor: BaseSelectionSetProcessor<any>;
19
14
  protected _scalars: NormalizedScalarsMap;
@@ -33,7 +28,7 @@ export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig =
33
28
  /**
34
29
  * traverse the inline fragment nodes recursively for collecting the selectionSets on each type
35
30
  */
36
- _collectInlineFragments(parentType: GraphQLNamedType, nodes: Array<InlineFragmentNode & FragmentDirectives>, types: Map<string, Array<CollectedFragmentNode>>): any;
31
+ _collectInlineFragments(parentType: GraphQLNamedType, nodes: InlineFragmentNode[], types: Map<string, Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>>): any;
37
32
  protected _createInlineFragmentForFieldNodes(parentType: GraphQLNamedType, fieldNodes: FieldNode[]): InlineFragmentNode;
38
33
  protected buildFragmentSpreadsUsage(spreads: FragmentSpreadNode[]): Record<string, FragmentSpreadUsage[]>;
39
34
  protected flattenSelectionSet(selections: ReadonlyArray<SelectionNode>, parentSchemaType?: GraphQLObjectType<any, any>): Map<string, Array<SelectionNode | FragmentSpreadUsage>>;
@@ -42,13 +37,11 @@ export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig =
42
37
  * mustAddEmptyObject indicates that not all possible types on a union or interface field are covered.
43
38
  */
44
39
  protected _buildGroupedSelections(): {
45
- grouped: GroupedStringifedTypes;
40
+ grouped: Record<string, string[]>;
46
41
  mustAddEmptyObject: boolean;
47
42
  };
48
43
  protected selectionSetStringFromFields(fields: (string | NameAndType)[]): string | null;
49
- protected buildSelectionSet(parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>, options?: {
50
- unsetTypes: boolean;
51
- }): {
44
+ protected buildSelectionSet(parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>): {
52
45
  typeInfo: {
53
46
  name: string;
54
47
  type: string;
@@ -2,18 +2,13 @@ import { DirectiveNode, FieldNode, FragmentSpreadNode, GraphQLNamedType, GraphQL
2
2
  import { ParsedDocumentsConfig } from './base-documents-visitor.js';
3
3
  import { BaseVisitorConvertOptions } from './base-visitor.js';
4
4
  import { BaseSelectionSetProcessor, LinkField, NameAndType, PrimitiveAliasedFields, PrimitiveField } from './selection-set-processor/base.js';
5
- import { ConvertNameFn, FragmentDirectives, GetFragmentSuffixFn, LoadedFragment, NormalizedScalarsMap } from './types.js';
5
+ import { ConvertNameFn, GetFragmentSuffixFn, LoadedFragment, NormalizedScalarsMap } from './types.js';
6
6
  type FragmentSpreadUsage = {
7
7
  fragmentName: string;
8
8
  typeName: string;
9
9
  onType: string;
10
10
  selectionNodes: Array<SelectionNode>;
11
- fragmentDirectives?: DirectiveNode[];
12
11
  };
13
- type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives;
14
- type GroupedStringifedTypes = Record<string, Array<string | {
15
- union: string[];
16
- }>>;
17
12
  export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedDocumentsConfig> {
18
13
  protected _processor: BaseSelectionSetProcessor<any>;
19
14
  protected _scalars: NormalizedScalarsMap;
@@ -33,7 +28,7 @@ export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig =
33
28
  /**
34
29
  * traverse the inline fragment nodes recursively for collecting the selectionSets on each type
35
30
  */
36
- _collectInlineFragments(parentType: GraphQLNamedType, nodes: Array<InlineFragmentNode & FragmentDirectives>, types: Map<string, Array<CollectedFragmentNode>>): any;
31
+ _collectInlineFragments(parentType: GraphQLNamedType, nodes: InlineFragmentNode[], types: Map<string, Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>>): any;
37
32
  protected _createInlineFragmentForFieldNodes(parentType: GraphQLNamedType, fieldNodes: FieldNode[]): InlineFragmentNode;
38
33
  protected buildFragmentSpreadsUsage(spreads: FragmentSpreadNode[]): Record<string, FragmentSpreadUsage[]>;
39
34
  protected flattenSelectionSet(selections: ReadonlyArray<SelectionNode>, parentSchemaType?: GraphQLObjectType<any, any>): Map<string, Array<SelectionNode | FragmentSpreadUsage>>;
@@ -42,13 +37,11 @@ export declare class SelectionSetToObject<Config extends ParsedDocumentsConfig =
42
37
  * mustAddEmptyObject indicates that not all possible types on a union or interface field are covered.
43
38
  */
44
39
  protected _buildGroupedSelections(): {
45
- grouped: GroupedStringifedTypes;
40
+ grouped: Record<string, string[]>;
46
41
  mustAddEmptyObject: boolean;
47
42
  };
48
43
  protected selectionSetStringFromFields(fields: (string | NameAndType)[]): string | null;
49
- protected buildSelectionSet(parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>, options?: {
50
- unsetTypes: boolean;
51
- }): {
44
+ protected buildSelectionSet(parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>): {
52
45
  typeInfo: {
53
46
  name: string;
54
47
  type: string;
@@ -1,4 +1,4 @@
1
- import { ASTNode, FragmentDefinitionNode, DirectiveNode } from 'graphql';
1
+ import { ASTNode, FragmentDefinitionNode } from 'graphql';
2
2
  import { ParsedMapper } from './mappers.cjs';
3
3
  /**
4
4
  * A map between the GraphQL directive name and the identifier that should be used
@@ -99,9 +99,6 @@ export interface ParsedImport {
99
99
  moduleName: string | null;
100
100
  propName: string;
101
101
  }
102
- export type FragmentDirectives = {
103
- fragmentDirectives?: Array<DirectiveNode>;
104
- };
105
102
  export interface ResolversNonOptionalTypenameConfig {
106
103
  unionMember?: boolean;
107
104
  }
@@ -1,4 +1,4 @@
1
- import { ASTNode, FragmentDefinitionNode, DirectiveNode } from 'graphql';
1
+ import { ASTNode, FragmentDefinitionNode } from 'graphql';
2
2
  import { ParsedMapper } from './mappers.js';
3
3
  /**
4
4
  * A map between the GraphQL directive name and the identifier that should be used
@@ -99,9 +99,6 @@ export interface ParsedImport {
99
99
  moduleName: string | null;
100
100
  propName: string;
101
101
  }
102
- export type FragmentDirectives = {
103
- fragmentDirectives?: Array<DirectiveNode>;
104
- };
105
102
  export interface ResolversNonOptionalTypenameConfig {
106
103
  unionMember?: boolean;
107
104
  }
@@ -1,6 +1,6 @@
1
- import { FieldNode, FragmentSpreadNode, GraphQLInputObjectType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, InlineFragmentNode, NamedTypeNode, NameNode, SelectionNode, SelectionSetNode, StringValueNode, TypeNode, DirectiveNode } from 'graphql';
1
+ import { FieldNode, FragmentSpreadNode, GraphQLInputObjectType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, InlineFragmentNode, NamedTypeNode, NameNode, SelectionNode, SelectionSetNode, StringValueNode, TypeNode } from 'graphql';
2
2
  import { RawConfig } from './base-visitor.cjs';
3
- import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap, FragmentDirectives } from './types.cjs';
3
+ import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap } from './types.cjs';
4
4
  export declare const getConfigValue: <T = any>(value: T, defaultValue: T) => T;
5
5
  export declare function quoteIfNeeded(array: string[], joinWith?: string): string;
6
6
  export declare function block(array: any): string;
@@ -52,13 +52,12 @@ export declare const REQUIRE_FIELDS_TYPE = "export type RequireFields<T, K exten
52
52
  export declare function mergeSelectionSets(selectionSet1: SelectionSetNode, selectionSet2: SelectionSetNode): SelectionSetNode;
53
53
  export declare const getFieldNodeNameValue: (node: FieldNode) => string;
54
54
  export declare function separateSelectionSet(selections: ReadonlyArray<SelectionNode>): {
55
- fields: (FieldNode & FragmentDirectives)[];
55
+ fields: FieldNode[];
56
56
  spreads: FragmentSpreadNode[];
57
57
  inlines: InlineFragmentNode[];
58
58
  };
59
59
  export declare function getPossibleTypes(schema: GraphQLSchema, type: GraphQLNamedType): GraphQLObjectType[];
60
60
  export declare function hasConditionalDirectives(field: FieldNode): boolean;
61
- export declare function hasIncrementalDeliveryDirectives(directives: DirectiveNode[]): boolean;
62
61
  type WrapModifiersOptions = {
63
62
  wrapOptional(type: string): string;
64
63
  wrapArray(type: string): string;
@@ -1,6 +1,6 @@
1
- import { FieldNode, FragmentSpreadNode, GraphQLInputObjectType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, InlineFragmentNode, NamedTypeNode, NameNode, SelectionNode, SelectionSetNode, StringValueNode, TypeNode, DirectiveNode } from 'graphql';
1
+ import { FieldNode, FragmentSpreadNode, GraphQLInputObjectType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, InlineFragmentNode, NamedTypeNode, NameNode, SelectionNode, SelectionSetNode, StringValueNode, TypeNode } from 'graphql';
2
2
  import { RawConfig } from './base-visitor.js';
3
- import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap, FragmentDirectives } from './types.js';
3
+ import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap } from './types.js';
4
4
  export declare const getConfigValue: <T = any>(value: T, defaultValue: T) => T;
5
5
  export declare function quoteIfNeeded(array: string[], joinWith?: string): string;
6
6
  export declare function block(array: any): string;
@@ -52,13 +52,12 @@ export declare const REQUIRE_FIELDS_TYPE = "export type RequireFields<T, K exten
52
52
  export declare function mergeSelectionSets(selectionSet1: SelectionSetNode, selectionSet2: SelectionSetNode): SelectionSetNode;
53
53
  export declare const getFieldNodeNameValue: (node: FieldNode) => string;
54
54
  export declare function separateSelectionSet(selections: ReadonlyArray<SelectionNode>): {
55
- fields: (FieldNode & FragmentDirectives)[];
55
+ fields: FieldNode[];
56
56
  spreads: FragmentSpreadNode[];
57
57
  inlines: InlineFragmentNode[];
58
58
  };
59
59
  export declare function getPossibleTypes(schema: GraphQLSchema, type: GraphQLNamedType): GraphQLObjectType[];
60
60
  export declare function hasConditionalDirectives(field: FieldNode): boolean;
61
- export declare function hasIncrementalDeliveryDirectives(directives: DirectiveNode[]): boolean;
62
61
  type WrapModifiersOptions = {
63
62
  wrapOptional(type: string): string;
64
63
  wrapArray(type: string): string;