@graphql-tools/utils 8.1.0 → 8.1.1

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.
package/es5/index.js CHANGED
@@ -1537,19 +1537,21 @@ function resetFieldMap() {
1537
1537
  fieldTypeMap = new Map();
1538
1538
  }
1539
1539
  function buildOperationNodeForField(_a) {
1540
- var schema = _a.schema, kind = _a.kind, field = _a.field, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, _b = _a.selectedFields, selectedFields = _b === void 0 ? true : _b;
1540
+ var schema = _a.schema, kind = _a.kind, field = _a.field, models = _a.models, _b = _a.ignore, ignore = _b === void 0 ? [] : _b, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, _c = _a.selectedFields, selectedFields = _c === void 0 ? true : _c;
1541
1541
  resetOperationVariables();
1542
1542
  resetFieldMap();
1543
+ var rootTypeNames = getRootTypeNames(schema);
1543
1544
  var operationNode = buildOperationAndCollectVariables({
1544
1545
  schema: schema,
1545
1546
  fieldName: field,
1546
1547
  kind: kind,
1547
1548
  models: models || [],
1548
- ignore: ignore || [],
1549
+ ignore: ignore,
1549
1550
  depthLimit: depthLimit || Infinity,
1550
1551
  circularReferenceDepth: circularReferenceDepth || 1,
1551
1552
  argNames: argNames,
1552
1553
  selectedFields: selectedFields,
1554
+ rootTypeNames: rootTypeNames,
1553
1555
  });
1554
1556
  // attach variables
1555
1557
  operationNode.variableDefinitions = tslib.__spreadArray([], tslib.__read(operationVariables));
@@ -1559,7 +1561,7 @@ function buildOperationNodeForField(_a) {
1559
1561
  }
1560
1562
  function buildOperationAndCollectVariables(_a) {
1561
1563
  var e_1, _b;
1562
- var schema = _a.schema, fieldName = _a.fieldName, kind = _a.kind, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1564
+ var schema = _a.schema, fieldName = _a.fieldName, kind = _a.kind, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1563
1565
  var type = getDefinedRootType(schema, kind);
1564
1566
  var field = type.getFields()[fieldName];
1565
1567
  var operationName = fieldName + "_" + kind;
@@ -1606,13 +1608,14 @@ function buildOperationAndCollectVariables(_a) {
1606
1608
  depth: 0,
1607
1609
  argNames: argNames,
1608
1610
  selectedFields: selectedFields,
1611
+ rootTypeNames: rootTypeNames,
1609
1612
  }),
1610
1613
  ],
1611
1614
  },
1612
1615
  };
1613
1616
  }
1614
1617
  function resolveSelectionSet(_a) {
1615
- var parent = _a.parent, type = _a.type, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1618
+ var parent = _a.parent, type = _a.type, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1616
1619
  if (typeof selectedFields === 'boolean' && depth > depthLimit) {
1617
1620
  return;
1618
1621
  }
@@ -1649,6 +1652,7 @@ function resolveSelectionSet(_a) {
1649
1652
  depth: depth,
1650
1653
  argNames: argNames,
1651
1654
  selectedFields: selectedFields,
1655
+ rootTypeNames: rootTypeNames,
1652
1656
  }),
1653
1657
  };
1654
1658
  })
@@ -1688,13 +1692,14 @@ function resolveSelectionSet(_a) {
1688
1692
  depth: depth,
1689
1693
  argNames: argNames,
1690
1694
  selectedFields: selectedFields,
1695
+ rootTypeNames: rootTypeNames,
1691
1696
  }),
1692
1697
  };
1693
1698
  })
1694
1699
  .filter(function (fragmentNode) { var _a, _b; return ((_b = (_a = fragmentNode === null || fragmentNode === void 0 ? void 0 : fragmentNode.selectionSet) === null || _a === void 0 ? void 0 : _a.selections) === null || _b === void 0 ? void 0 : _b.length) > 0; }),
1695
1700
  };
1696
1701
  }
1697
- if (graphql.isObjectType(type)) {
1702
+ if (graphql.isObjectType(type) && !rootTypeNames.has(type.name)) {
1698
1703
  var isIgnored = ignore.includes(type.name) || ignore.includes(parent.name + "." + path[path.length - 1]);
1699
1704
  var isModel = models.includes(type.name);
1700
1705
  if (!firstCall && isModel && !isIgnored) {
@@ -1736,6 +1741,7 @@ function resolveSelectionSet(_a) {
1736
1741
  depth: depth,
1737
1742
  argNames: argNames,
1738
1743
  selectedFields: selectedSubFields,
1744
+ rootTypeNames: rootTypeNames,
1739
1745
  });
1740
1746
  }
1741
1747
  return null;
@@ -1791,7 +1797,7 @@ function getArgumentName(name, path) {
1791
1797
  return tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(path)), [name]).join('_');
1792
1798
  }
1793
1799
  function resolveField(_a) {
1794
- var type = _a.type, field = _a.field, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1800
+ var type = _a.type, field = _a.field, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1795
1801
  var namedType = graphql.getNamedType(field.type);
1796
1802
  var args = [];
1797
1803
  var removeField = false;
@@ -1853,6 +1859,7 @@ function resolveField(_a) {
1853
1859
  depth: depth + 1,
1854
1860
  argNames: argNames,
1855
1861
  selectedFields: selectedFields,
1862
+ rootTypeNames: rootTypeNames,
1856
1863
  }) || undefined, arguments: args });
1857
1864
  }
1858
1865
  return tslib.__assign(tslib.__assign({ kind: graphql.Kind.FIELD, name: {
package/es5/index.mjs CHANGED
@@ -1531,19 +1531,21 @@ function resetFieldMap() {
1531
1531
  fieldTypeMap = new Map();
1532
1532
  }
1533
1533
  function buildOperationNodeForField(_a) {
1534
- var schema = _a.schema, kind = _a.kind, field = _a.field, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, _b = _a.selectedFields, selectedFields = _b === void 0 ? true : _b;
1534
+ var schema = _a.schema, kind = _a.kind, field = _a.field, models = _a.models, _b = _a.ignore, ignore = _b === void 0 ? [] : _b, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, _c = _a.selectedFields, selectedFields = _c === void 0 ? true : _c;
1535
1535
  resetOperationVariables();
1536
1536
  resetFieldMap();
1537
+ var rootTypeNames = getRootTypeNames(schema);
1537
1538
  var operationNode = buildOperationAndCollectVariables({
1538
1539
  schema: schema,
1539
1540
  fieldName: field,
1540
1541
  kind: kind,
1541
1542
  models: models || [],
1542
- ignore: ignore || [],
1543
+ ignore: ignore,
1543
1544
  depthLimit: depthLimit || Infinity,
1544
1545
  circularReferenceDepth: circularReferenceDepth || 1,
1545
1546
  argNames: argNames,
1546
1547
  selectedFields: selectedFields,
1548
+ rootTypeNames: rootTypeNames,
1547
1549
  });
1548
1550
  // attach variables
1549
1551
  operationNode.variableDefinitions = __spreadArray([], __read(operationVariables));
@@ -1553,7 +1555,7 @@ function buildOperationNodeForField(_a) {
1553
1555
  }
1554
1556
  function buildOperationAndCollectVariables(_a) {
1555
1557
  var e_1, _b;
1556
- var schema = _a.schema, fieldName = _a.fieldName, kind = _a.kind, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1558
+ var schema = _a.schema, fieldName = _a.fieldName, kind = _a.kind, models = _a.models, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1557
1559
  var type = getDefinedRootType(schema, kind);
1558
1560
  var field = type.getFields()[fieldName];
1559
1561
  var operationName = fieldName + "_" + kind;
@@ -1600,13 +1602,14 @@ function buildOperationAndCollectVariables(_a) {
1600
1602
  depth: 0,
1601
1603
  argNames: argNames,
1602
1604
  selectedFields: selectedFields,
1605
+ rootTypeNames: rootTypeNames,
1603
1606
  }),
1604
1607
  ],
1605
1608
  },
1606
1609
  };
1607
1610
  }
1608
1611
  function resolveSelectionSet(_a) {
1609
- var parent = _a.parent, type = _a.type, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1612
+ var parent = _a.parent, type = _a.type, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1610
1613
  if (typeof selectedFields === 'boolean' && depth > depthLimit) {
1611
1614
  return;
1612
1615
  }
@@ -1643,6 +1646,7 @@ function resolveSelectionSet(_a) {
1643
1646
  depth: depth,
1644
1647
  argNames: argNames,
1645
1648
  selectedFields: selectedFields,
1649
+ rootTypeNames: rootTypeNames,
1646
1650
  }),
1647
1651
  };
1648
1652
  })
@@ -1682,13 +1686,14 @@ function resolveSelectionSet(_a) {
1682
1686
  depth: depth,
1683
1687
  argNames: argNames,
1684
1688
  selectedFields: selectedFields,
1689
+ rootTypeNames: rootTypeNames,
1685
1690
  }),
1686
1691
  };
1687
1692
  })
1688
1693
  .filter(function (fragmentNode) { var _a, _b; return ((_b = (_a = fragmentNode === null || fragmentNode === void 0 ? void 0 : fragmentNode.selectionSet) === null || _a === void 0 ? void 0 : _a.selections) === null || _b === void 0 ? void 0 : _b.length) > 0; }),
1689
1694
  };
1690
1695
  }
1691
- if (isObjectType(type)) {
1696
+ if (isObjectType(type) && !rootTypeNames.has(type.name)) {
1692
1697
  var isIgnored = ignore.includes(type.name) || ignore.includes(parent.name + "." + path[path.length - 1]);
1693
1698
  var isModel = models.includes(type.name);
1694
1699
  if (!firstCall && isModel && !isIgnored) {
@@ -1730,6 +1735,7 @@ function resolveSelectionSet(_a) {
1730
1735
  depth: depth,
1731
1736
  argNames: argNames,
1732
1737
  selectedFields: selectedSubFields,
1738
+ rootTypeNames: rootTypeNames,
1733
1739
  });
1734
1740
  }
1735
1741
  return null;
@@ -1785,7 +1791,7 @@ function getArgumentName(name, path) {
1785
1791
  return __spreadArray(__spreadArray([], __read(path)), [name]).join('_');
1786
1792
  }
1787
1793
  function resolveField(_a) {
1788
- var type = _a.type, field = _a.field, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields;
1794
+ var type = _a.type, field = _a.field, models = _a.models, firstCall = _a.firstCall, path = _a.path, ancestors = _a.ancestors, ignore = _a.ignore, depthLimit = _a.depthLimit, circularReferenceDepth = _a.circularReferenceDepth, schema = _a.schema, depth = _a.depth, argNames = _a.argNames, selectedFields = _a.selectedFields, rootTypeNames = _a.rootTypeNames;
1789
1795
  var namedType = getNamedType(field.type);
1790
1796
  var args = [];
1791
1797
  var removeField = false;
@@ -1847,6 +1853,7 @@ function resolveField(_a) {
1847
1853
  depth: depth + 1,
1848
1854
  argNames: argNames,
1849
1855
  selectedFields: selectedFields,
1856
+ rootTypeNames: rootTypeNames,
1850
1857
  }) || undefined, arguments: args });
1851
1858
  }
1852
1859
  return __assign(__assign({ kind: Kind.FIELD, name: {
package/es5/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils/es5",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
package/index.js CHANGED
@@ -1257,19 +1257,21 @@ function resetOperationVariables() {
1257
1257
  function resetFieldMap() {
1258
1258
  fieldTypeMap = new Map();
1259
1259
  }
1260
- function buildOperationNodeForField({ schema, kind, field, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields = true, }) {
1260
+ function buildOperationNodeForField({ schema, kind, field, models, ignore = [], depthLimit, circularReferenceDepth, argNames, selectedFields = true, }) {
1261
1261
  resetOperationVariables();
1262
1262
  resetFieldMap();
1263
+ const rootTypeNames = getRootTypeNames(schema);
1263
1264
  const operationNode = buildOperationAndCollectVariables({
1264
1265
  schema,
1265
1266
  fieldName: field,
1266
1267
  kind,
1267
1268
  models: models || [],
1268
- ignore: ignore || [],
1269
+ ignore,
1269
1270
  depthLimit: depthLimit || Infinity,
1270
1271
  circularReferenceDepth: circularReferenceDepth || 1,
1271
1272
  argNames,
1272
1273
  selectedFields,
1274
+ rootTypeNames,
1273
1275
  });
1274
1276
  // attach variables
1275
1277
  operationNode.variableDefinitions = [...operationVariables];
@@ -1277,7 +1279,7 @@ function buildOperationNodeForField({ schema, kind, field, models, ignore, depth
1277
1279
  resetFieldMap();
1278
1280
  return operationNode;
1279
1281
  }
1280
- function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields, }) {
1282
+ function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields, rootTypeNames, }) {
1281
1283
  const type = getDefinedRootType(schema, kind);
1282
1284
  const field = type.getFields()[fieldName];
1283
1285
  const operationName = `${fieldName}_${kind}`;
@@ -1314,12 +1316,13 @@ function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ig
1314
1316
  depth: 0,
1315
1317
  argNames,
1316
1318
  selectedFields,
1319
+ rootTypeNames,
1317
1320
  }),
1318
1321
  ],
1319
1322
  },
1320
1323
  };
1321
1324
  }
1322
- function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, }) {
1325
+ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, rootTypeNames, }) {
1323
1326
  if (typeof selectedFields === 'boolean' && depth > depthLimit) {
1324
1327
  return;
1325
1328
  }
@@ -1354,6 +1357,7 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1354
1357
  depth,
1355
1358
  argNames,
1356
1359
  selectedFields,
1360
+ rootTypeNames,
1357
1361
  }),
1358
1362
  };
1359
1363
  })
@@ -1391,13 +1395,14 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1391
1395
  depth,
1392
1396
  argNames,
1393
1397
  selectedFields,
1398
+ rootTypeNames,
1394
1399
  }),
1395
1400
  };
1396
1401
  })
1397
1402
  .filter(fragmentNode => { var _a, _b; return ((_b = (_a = fragmentNode === null || fragmentNode === void 0 ? void 0 : fragmentNode.selectionSet) === null || _a === void 0 ? void 0 : _a.selections) === null || _b === void 0 ? void 0 : _b.length) > 0; }),
1398
1403
  };
1399
1404
  }
1400
- if (graphql.isObjectType(type)) {
1405
+ if (graphql.isObjectType(type) && !rootTypeNames.has(type.name)) {
1401
1406
  const isIgnored = ignore.includes(type.name) || ignore.includes(`${parent.name}.${path[path.length - 1]}`);
1402
1407
  const isModel = models.includes(type.name);
1403
1408
  if (!firstCall && isModel && !isIgnored) {
@@ -1439,6 +1444,7 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1439
1444
  depth,
1440
1445
  argNames,
1441
1446
  selectedFields: selectedSubFields,
1447
+ rootTypeNames,
1442
1448
  });
1443
1449
  }
1444
1450
  return null;
@@ -1493,7 +1499,7 @@ function resolveVariable(arg, name) {
1493
1499
  function getArgumentName(name, path) {
1494
1500
  return [...path, name].join('_');
1495
1501
  }
1496
- function resolveField({ type, field, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, }) {
1502
+ function resolveField({ type, field, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, rootTypeNames, }) {
1497
1503
  const namedType = graphql.getNamedType(field.type);
1498
1504
  let args = [];
1499
1505
  let removeField = false;
@@ -1559,6 +1565,7 @@ function resolveField({ type, field, models, firstCall, path, ancestors, ignore,
1559
1565
  depth: depth + 1,
1560
1566
  argNames,
1561
1567
  selectedFields,
1568
+ rootTypeNames,
1562
1569
  }) || undefined,
1563
1570
  arguments: args,
1564
1571
  };
package/index.mjs CHANGED
@@ -1251,19 +1251,21 @@ function resetOperationVariables() {
1251
1251
  function resetFieldMap() {
1252
1252
  fieldTypeMap = new Map();
1253
1253
  }
1254
- function buildOperationNodeForField({ schema, kind, field, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields = true, }) {
1254
+ function buildOperationNodeForField({ schema, kind, field, models, ignore = [], depthLimit, circularReferenceDepth, argNames, selectedFields = true, }) {
1255
1255
  resetOperationVariables();
1256
1256
  resetFieldMap();
1257
+ const rootTypeNames = getRootTypeNames(schema);
1257
1258
  const operationNode = buildOperationAndCollectVariables({
1258
1259
  schema,
1259
1260
  fieldName: field,
1260
1261
  kind,
1261
1262
  models: models || [],
1262
- ignore: ignore || [],
1263
+ ignore,
1263
1264
  depthLimit: depthLimit || Infinity,
1264
1265
  circularReferenceDepth: circularReferenceDepth || 1,
1265
1266
  argNames,
1266
1267
  selectedFields,
1268
+ rootTypeNames,
1267
1269
  });
1268
1270
  // attach variables
1269
1271
  operationNode.variableDefinitions = [...operationVariables];
@@ -1271,7 +1273,7 @@ function buildOperationNodeForField({ schema, kind, field, models, ignore, depth
1271
1273
  resetFieldMap();
1272
1274
  return operationNode;
1273
1275
  }
1274
- function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields, }) {
1276
+ function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ignore, depthLimit, circularReferenceDepth, argNames, selectedFields, rootTypeNames, }) {
1275
1277
  const type = getDefinedRootType(schema, kind);
1276
1278
  const field = type.getFields()[fieldName];
1277
1279
  const operationName = `${fieldName}_${kind}`;
@@ -1308,12 +1310,13 @@ function buildOperationAndCollectVariables({ schema, fieldName, kind, models, ig
1308
1310
  depth: 0,
1309
1311
  argNames,
1310
1312
  selectedFields,
1313
+ rootTypeNames,
1311
1314
  }),
1312
1315
  ],
1313
1316
  },
1314
1317
  };
1315
1318
  }
1316
- function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, }) {
1319
+ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, rootTypeNames, }) {
1317
1320
  if (typeof selectedFields === 'boolean' && depth > depthLimit) {
1318
1321
  return;
1319
1322
  }
@@ -1348,6 +1351,7 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1348
1351
  depth,
1349
1352
  argNames,
1350
1353
  selectedFields,
1354
+ rootTypeNames,
1351
1355
  }),
1352
1356
  };
1353
1357
  })
@@ -1385,13 +1389,14 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1385
1389
  depth,
1386
1390
  argNames,
1387
1391
  selectedFields,
1392
+ rootTypeNames,
1388
1393
  }),
1389
1394
  };
1390
1395
  })
1391
1396
  .filter(fragmentNode => { var _a, _b; return ((_b = (_a = fragmentNode === null || fragmentNode === void 0 ? void 0 : fragmentNode.selectionSet) === null || _a === void 0 ? void 0 : _a.selections) === null || _b === void 0 ? void 0 : _b.length) > 0; }),
1392
1397
  };
1393
1398
  }
1394
- if (isObjectType(type)) {
1399
+ if (isObjectType(type) && !rootTypeNames.has(type.name)) {
1395
1400
  const isIgnored = ignore.includes(type.name) || ignore.includes(`${parent.name}.${path[path.length - 1]}`);
1396
1401
  const isModel = models.includes(type.name);
1397
1402
  if (!firstCall && isModel && !isIgnored) {
@@ -1433,6 +1438,7 @@ function resolveSelectionSet({ parent, type, models, firstCall, path, ancestors,
1433
1438
  depth,
1434
1439
  argNames,
1435
1440
  selectedFields: selectedSubFields,
1441
+ rootTypeNames,
1436
1442
  });
1437
1443
  }
1438
1444
  return null;
@@ -1487,7 +1493,7 @@ function resolveVariable(arg, name) {
1487
1493
  function getArgumentName(name, path) {
1488
1494
  return [...path, name].join('_');
1489
1495
  }
1490
- function resolveField({ type, field, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, }) {
1496
+ function resolveField({ type, field, models, firstCall, path, ancestors, ignore, depthLimit, circularReferenceDepth, schema, depth, argNames, selectedFields, rootTypeNames, }) {
1491
1497
  const namedType = getNamedType(field.type);
1492
1498
  let args = [];
1493
1499
  let removeField = false;
@@ -1553,6 +1559,7 @@ function resolveField({ type, field, models, firstCall, path, ancestors, ignore,
1553
1559
  depth: depth + 1,
1554
1560
  argNames,
1555
1561
  selectedFields,
1562
+ rootTypeNames,
1556
1563
  }) || undefined,
1557
1564
  arguments: args,
1558
1565
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {