@graphql-tools/utils 7.8.0-alpha-43e9309d.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
@@ -9,19 +9,6 @@ const tslib = require('tslib');
9
9
  const AggregateError = _interopDefault(require('@ardatan/aggregate-error'));
10
10
  const camelCase = require('camel-case');
11
11
 
12
- function makeCacheable(fn, pointer, options) {
13
- if (options === null || options === void 0 ? void 0 : options.cacheable) {
14
- return options.cacheable(fn, pointer, options);
15
- }
16
- return fn(pointer, options);
17
- }
18
- function makeCacheableSync(fn, pointer, options) {
19
- if (options === null || options === void 0 ? void 0 : options.cacheableSync) {
20
- return options.cacheableSync(fn, pointer, options);
21
- }
22
- return fn(pointer, options);
23
- }
24
-
25
12
  var asArray = function (fns) { return (Array.isArray(fns) ? fns : fns ? [fns] : []); };
26
13
  function isEqual(a, b) {
27
14
  if (Array.isArray(a) && Array.isArray(b)) {
@@ -516,6 +503,23 @@ function getDocumentNodeFromSchema(schema, options) {
516
503
  var typesMap = schema.getTypeMap();
517
504
  var schemaNode = astFromSchema(schema, pathToDirectivesInExtensions);
518
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
+ }
519
523
  for (var typeName in typesMap) {
520
524
  var type = typesMap[typeName];
521
525
  var isPredefinedScalar = graphql.isSpecifiedScalarType(type);
@@ -545,23 +549,6 @@ function getDocumentNodeFromSchema(schema, options) {
545
549
  throw new Error("Unknown type " + type + ".");
546
550
  }
547
551
  }
548
- var directives = schema.getDirectives();
549
- try {
550
- for (var directives_1 = tslib.__values(directives), directives_1_1 = directives_1.next(); !directives_1_1.done; directives_1_1 = directives_1.next()) {
551
- var directive = directives_1_1.value;
552
- if (graphql.isSpecifiedDirective(directive)) {
553
- continue;
554
- }
555
- definitions.push(astFromDirective(directive, schema, pathToDirectivesInExtensions));
556
- }
557
- }
558
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
559
- finally {
560
- try {
561
- if (directives_1_1 && !directives_1_1.done && (_a = directives_1.return)) _a.call(directives_1);
562
- }
563
- finally { if (e_1) throw e_1.error; }
564
- }
565
552
  return {
566
553
  kind: graphql.Kind.DOCUMENT,
567
554
  definitions: definitions,
@@ -973,7 +960,7 @@ function makeDirectiveNodes(schema, directiveValues) {
973
960
  var directiveNodes = [];
974
961
  Object.entries(directiveValues).forEach(function (_a) {
975
962
  var _b = tslib.__read(_a, 2), directiveName = _b[0], arrayOrSingleValue = _b[1];
976
- var directive = schema.getDirective(directiveName);
963
+ var directive = schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName);
977
964
  if (Array.isArray(arrayOrSingleValue)) {
978
965
  arrayOrSingleValue.forEach(function (value) {
979
966
  directiveNodes.push(makeDirectiveNode(directiveName, value, directive));
@@ -1801,7 +1788,7 @@ function createNamedStub(name, type) {
1801
1788
  return new constructor({
1802
1789
  name: name,
1803
1790
  fields: {
1804
- __fake: {
1791
+ _fake: {
1805
1792
  type: graphql.GraphQLString,
1806
1793
  },
1807
1794
  },
@@ -1824,7 +1811,7 @@ function isNamedStub(type) {
1824
1811
  if (graphql.isObjectType(type) || graphql.isInterfaceType(type) || graphql.isInputObjectType(type)) {
1825
1812
  var fields = type.getFields();
1826
1813
  var fieldNames = Object.keys(fields);
1827
- return fieldNames.length === 1 && fields[fieldNames[0]].name === '__fake';
1814
+ return fieldNames.length === 1 && fields[fieldNames[0]].name === '_fake';
1828
1815
  }
1829
1816
  return false;
1830
1817
  }
@@ -4433,8 +4420,6 @@ exports.isEqual = isEqual;
4433
4420
  exports.isNamedStub = isNamedStub;
4434
4421
  exports.isNotEqual = isNotEqual;
4435
4422
  exports.isValidPath = isValidPath;
4436
- exports.makeCacheable = makeCacheable;
4437
- exports.makeCacheableSync = makeCacheableSync;
4438
4423
  exports.makeDeprecatedDirective = makeDeprecatedDirective;
4439
4424
  exports.makeDirectiveNode = makeDirectiveNode;
4440
4425
  exports.makeDirectiveNodes = makeDirectiveNodes;