@graphql-tools/utils 7.8.0-alpha-4fedab51.0 → 7.8.0

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.cjs.js CHANGED
@@ -503,6 +503,23 @@ function getDocumentNodeFromSchema(schema, options) {
503
503
  var typesMap = schema.getTypeMap();
504
504
  var schemaNode = astFromSchema(schema, pathToDirectivesInExtensions);
505
505
  var definitions = schemaNode != null ? [schemaNode] : [];
506
+ var directives = schema.getDirectives();
507
+ try {
508
+ for (var directives_1 = tslib.__values(directives), directives_1_1 = directives_1.next(); !directives_1_1.done; directives_1_1 = directives_1.next()) {
509
+ var directive = directives_1_1.value;
510
+ if (graphql.isSpecifiedDirective(directive)) {
511
+ continue;
512
+ }
513
+ definitions.push(astFromDirective(directive, schema, pathToDirectivesInExtensions));
514
+ }
515
+ }
516
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
517
+ finally {
518
+ try {
519
+ if (directives_1_1 && !directives_1_1.done && (_a = directives_1.return)) _a.call(directives_1);
520
+ }
521
+ finally { if (e_1) throw e_1.error; }
522
+ }
506
523
  for (var typeName in typesMap) {
507
524
  var type = typesMap[typeName];
508
525
  var isPredefinedScalar = graphql.isSpecifiedScalarType(type);
@@ -532,23 +549,6 @@ function getDocumentNodeFromSchema(schema, options) {
532
549
  throw new Error("Unknown type " + type + ".");
533
550
  }
534
551
  }
535
- var directives = schema.getDirectives();
536
- try {
537
- for (var directives_1 = tslib.__values(directives), directives_1_1 = directives_1.next(); !directives_1_1.done; directives_1_1 = directives_1.next()) {
538
- var directive = directives_1_1.value;
539
- if (graphql.isSpecifiedDirective(directive)) {
540
- continue;
541
- }
542
- definitions.push(astFromDirective(directive, schema, pathToDirectivesInExtensions));
543
- }
544
- }
545
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
546
- finally {
547
- try {
548
- if (directives_1_1 && !directives_1_1.done && (_a = directives_1.return)) _a.call(directives_1);
549
- }
550
- finally { if (e_1) throw e_1.error; }
551
- }
552
552
  return {
553
553
  kind: graphql.Kind.DOCUMENT,
554
554
  definitions: definitions,
@@ -960,7 +960,7 @@ function makeDirectiveNodes(schema, directiveValues) {
960
960
  var directiveNodes = [];
961
961
  Object.entries(directiveValues).forEach(function (_a) {
962
962
  var _b = tslib.__read(_a, 2), directiveName = _b[0], arrayOrSingleValue = _b[1];
963
- var directive = schema.getDirective(directiveName);
963
+ var directive = schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName);
964
964
  if (Array.isArray(arrayOrSingleValue)) {
965
965
  arrayOrSingleValue.forEach(function (value) {
966
966
  directiveNodes.push(makeDirectiveNode(directiveName, value, directive));
@@ -1788,7 +1788,7 @@ function createNamedStub(name, type) {
1788
1788
  return new constructor({
1789
1789
  name: name,
1790
1790
  fields: {
1791
- __fake: {
1791
+ _fake: {
1792
1792
  type: graphql.GraphQLString,
1793
1793
  },
1794
1794
  },
@@ -1811,7 +1811,7 @@ function isNamedStub(type) {
1811
1811
  if (graphql.isObjectType(type) || graphql.isInterfaceType(type) || graphql.isInputObjectType(type)) {
1812
1812
  var fields = type.getFields();
1813
1813
  var fieldNames = Object.keys(fields);
1814
- return fieldNames.length === 1 && fields[fieldNames[0]].name === '__fake';
1814
+ return fieldNames.length === 1 && fields[fieldNames[0]].name === '_fake';
1815
1815
  }
1816
1816
  return false;
1817
1817
  }