@graphql-tools/utils 8.2.0 → 8.2.4

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.
Files changed (59) hide show
  1. package/comments.d.ts +3 -1
  2. package/fixSchemaAst.d.ts +3 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +53 -23
  5. package/index.mjs +53 -25
  6. package/package.json +1 -1
  7. package/es5/AggregateError.d.ts +0 -10
  8. package/es5/Interfaces.d.ts +0 -242
  9. package/es5/addTypes.d.ts +0 -2
  10. package/es5/astFromType.d.ts +0 -2
  11. package/es5/astFromValueUntyped.d.ts +0 -17
  12. package/es5/build-operation-for-field.d.ts +0 -18
  13. package/es5/collectFields.d.ts +0 -5
  14. package/es5/comments.d.ts +0 -28
  15. package/es5/errors.d.ts +0 -2
  16. package/es5/executor.d.ts +0 -7
  17. package/es5/fields.d.ts +0 -5
  18. package/es5/filterSchema.d.ts +0 -12
  19. package/es5/forEachDefaultValue.d.ts +0 -3
  20. package/es5/forEachField.d.ts +0 -3
  21. package/es5/get-directives.d.ts +0 -11
  22. package/es5/get-fields-with-directives.d.ts +0 -16
  23. package/es5/get-implementing-types.d.ts +0 -2
  24. package/es5/getArgumentValues.d.ts +0 -10
  25. package/es5/getObjectTypeFromTypeMap.d.ts +0 -3
  26. package/es5/getResolversFromSchema.d.ts +0 -3
  27. package/es5/getResponseKeyFromInfo.d.ts +0 -7
  28. package/es5/heal.d.ts +0 -3
  29. package/es5/helpers.d.ts +0 -9
  30. package/es5/implementsAbstractType.d.ts +0 -3
  31. package/es5/index.d.ts +0 -48
  32. package/es5/index.js +0 -4818
  33. package/es5/index.mjs +0 -4712
  34. package/es5/inspect.d.ts +0 -4
  35. package/es5/isAsyncIterable.d.ts +0 -1
  36. package/es5/isDocumentNode.d.ts +0 -2
  37. package/es5/loaders.d.ts +0 -18
  38. package/es5/mapAsyncIterator.d.ts +0 -5
  39. package/es5/mapSchema.d.ts +0 -7
  40. package/es5/memoize.d.ts +0 -6
  41. package/es5/mergeDeep.d.ts +0 -9
  42. package/es5/observableToAsyncIterable.d.ts +0 -12
  43. package/es5/package.json +0 -35
  44. package/es5/parse-graphql-json.d.ts +0 -4
  45. package/es5/parse-graphql-sdl.d.ts +0 -13
  46. package/es5/print-schema-with-directives.d.ts +0 -21
  47. package/es5/prune.d.ts +0 -8
  48. package/es5/renameType.d.ts +0 -8
  49. package/es5/rewire.d.ts +0 -5
  50. package/es5/rootTypes.d.ts +0 -5
  51. package/es5/selectionSets.d.ts +0 -3
  52. package/es5/stub.d.ts +0 -9
  53. package/es5/transformInputValue.d.ts +0 -6
  54. package/es5/types.d.ts +0 -49
  55. package/es5/updateArgument.d.ts +0 -3
  56. package/es5/validate-documents.d.ts +0 -9
  57. package/es5/valueMatchesCriteria.d.ts +0 -1
  58. package/es5/visitResult.d.ts +0 -15
  59. package/es5/withCancel.d.ts +0 -3
package/comments.d.ts CHANGED
@@ -17,8 +17,10 @@ export declare function getDescription(node: {
17
17
  }, options?: {
18
18
  commentDescriptions?: boolean;
19
19
  }): string | undefined;
20
+ export declare function getComment(node: {
21
+ loc?: Location;
22
+ }): undefined | string;
20
23
  export declare function getLeadingCommentBlock(node: {
21
- description?: StringValueNode;
22
24
  loc?: Location;
23
25
  }): void | string;
24
26
  export declare function dedentBlockStringValue(rawString: string): string;
@@ -0,0 +1,3 @@
1
+ import { GraphQLSchema, BuildSchemaOptions } from 'graphql';
2
+ import { SchemaPrintOptions } from './types';
3
+ export declare function fixSchemaAst(schema: GraphQLSchema, options: BuildSchemaOptions & SchemaPrintOptions): GraphQLSchema;
package/index.d.ts CHANGED
@@ -46,3 +46,4 @@ export * from './comments';
46
46
  export * from './collectFields';
47
47
  export * from './inspect';
48
48
  export * from './memoize';
49
+ export * from './fixSchemaAst';
package/index.js CHANGED
@@ -1013,7 +1013,8 @@ function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
1013
1013
  const directives = directivesInExtensions
1014
1014
  ? makeDirectiveNodes(schema, directivesInExtensions)
1015
1015
  : ((_a = type.astNode) === null || _a === void 0 ? void 0 : _a.directives) || [];
1016
- if ('specifiedBy' in type && !directives.some(directiveNode => directiveNode.name.value === 'specifiedBy')) {
1016
+ if (type['specifiedByUrl'] &&
1017
+ !directives.some(directiveNode => directiveNode.name.value === 'specifiedBy')) {
1017
1018
  const specifiedByArgs = {
1018
1019
  url: type['specifiedByUrl'],
1019
1020
  };
@@ -1323,7 +1324,7 @@ function collectComment(node) {
1323
1324
  }
1324
1325
  }
1325
1326
  function pushComment(node, entity, field, argument) {
1326
- const comment = getDescription(node, { commentDescriptions: true });
1327
+ const comment = getComment(node);
1327
1328
  if (typeof comment !== 'string' || comment.length === 0) {
1328
1329
  return;
1329
1330
  }
@@ -1459,7 +1460,12 @@ const printDocASTReducer = {
1459
1460
  IntValue: { leave: ({ value }) => value },
1460
1461
  FloatValue: { leave: ({ value }) => value },
1461
1462
  StringValue: {
1462
- leave: ({ value, block: isBlockString }) => (isBlockString ? printBlockString(value) : JSON.stringify(value)),
1463
+ leave: ({ value, block: isBlockString }) => {
1464
+ if (isBlockString) {
1465
+ return printBlockString(value);
1466
+ }
1467
+ return JSON.stringify(value);
1468
+ },
1463
1469
  },
1464
1470
  BooleanValue: { leave: ({ value }) => (value ? 'true' : 'false') },
1465
1471
  NullValue: { leave: () => 'null' },
@@ -1477,21 +1483,19 @@ const printDocASTReducer = {
1477
1483
  NonNullType: { leave: ({ type }) => type + '!' },
1478
1484
  // Type System Definitions
1479
1485
  SchemaDefinition: {
1480
- leave: ({ description, directives, operationTypes }) => wrap('', description, '\n') + join(['schema', join(directives, ' '), block(operationTypes)], ' '),
1486
+ leave: ({ directives, operationTypes }) => join(['schema', join(directives, ' '), block(operationTypes)], ' '),
1481
1487
  },
1482
1488
  OperationTypeDefinition: {
1483
1489
  leave: ({ operation, type }) => operation + ': ' + type,
1484
1490
  },
1485
1491
  ScalarTypeDefinition: {
1486
- leave: ({ description, name, directives }) => wrap('', description, '\n') + join(['scalar', name, join(directives, ' ')], ' '),
1492
+ leave: ({ name, directives }) => join(['scalar', name, join(directives, ' ')], ' '),
1487
1493
  },
1488
1494
  ObjectTypeDefinition: {
1489
- leave: ({ description, name, interfaces, directives, fields }) => wrap('', description, '\n') +
1490
- join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1495
+ leave: ({ name, interfaces, directives, fields }) => join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1491
1496
  },
1492
1497
  FieldDefinition: {
1493
- leave: ({ description, name, arguments: args, type, directives }) => wrap('', description, '\n') +
1494
- name +
1498
+ leave: ({ name, arguments: args, type, directives }) => name +
1495
1499
  (hasMultilineItems(args)
1496
1500
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
1497
1501
  : wrap('(', join(args, ', '), ')')) +
@@ -1500,27 +1504,25 @@ const printDocASTReducer = {
1500
1504
  wrap(' ', join(directives, ' ')),
1501
1505
  },
1502
1506
  InputValueDefinition: {
1503
- leave: ({ description, name, type, defaultValue, directives }) => wrap('', description, '\n') + join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '),
1507
+ leave: ({ name, type, defaultValue, directives }) => join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '),
1504
1508
  },
1505
1509
  InterfaceTypeDefinition: {
1506
- leave: ({ description, name, interfaces, directives, fields }) => wrap('', description, '\n') +
1507
- join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1510
+ leave: ({ name, interfaces, directives, fields }) => join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1508
1511
  },
1509
1512
  UnionTypeDefinition: {
1510
- leave: ({ description, name, directives, types }) => wrap('', description, '\n') + join(['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], ' '),
1513
+ leave: ({ name, directives, types }) => join(['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], ' '),
1511
1514
  },
1512
1515
  EnumTypeDefinition: {
1513
- leave: ({ description, name, directives, values }) => wrap('', description, '\n') + join(['enum', name, join(directives, ' '), block(values)], ' '),
1516
+ leave: ({ name, directives, values }) => join(['enum', name, join(directives, ' '), block(values)], ' '),
1514
1517
  },
1515
1518
  EnumValueDefinition: {
1516
- leave: ({ description, name, directives }) => wrap('', description, '\n') + join([name, join(directives, ' ')], ' '),
1519
+ leave: ({ name, directives }) => join([name, join(directives, ' ')], ' '),
1517
1520
  },
1518
1521
  InputObjectTypeDefinition: {
1519
- leave: ({ description, name, directives, fields }) => wrap('', description, '\n') + join(['input', name, join(directives, ' '), block(fields)], ' '),
1522
+ leave: ({ name, directives, fields }) => join(['input', name, join(directives, ' '), block(fields)], ' '),
1520
1523
  },
1521
1524
  DirectiveDefinition: {
1522
- leave: ({ description, name, arguments: args, repeatable, locations }) => wrap('', description, '\n') +
1523
- 'directive @' +
1525
+ leave: ({ name, arguments: args, repeatable, locations }) => 'directive @' +
1524
1526
  name +
1525
1527
  (hasMultilineItems(args)
1526
1528
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
@@ -1573,10 +1575,13 @@ function getDescription(node, options) {
1573
1575
  return node.description.value;
1574
1576
  }
1575
1577
  if (options === null || options === void 0 ? void 0 : options.commentDescriptions) {
1576
- const rawValue = getLeadingCommentBlock(node);
1577
- if (rawValue !== undefined) {
1578
- return dedentBlockStringValue(`\n${rawValue}`);
1579
- }
1578
+ return getComment(node);
1579
+ }
1580
+ }
1581
+ function getComment(node) {
1582
+ const rawValue = getLeadingCommentBlock(node);
1583
+ if (rawValue !== undefined) {
1584
+ return dedentBlockStringValue(`\n${rawValue}`);
1580
1585
  }
1581
1586
  }
1582
1587
  function getLeadingCommentBlock(node) {
@@ -3925,7 +3930,9 @@ function visitData(data, enter, leave) {
3925
3930
  if (newData != null) {
3926
3931
  for (const key in newData) {
3927
3932
  const value = newData[key];
3928
- newData[key] = visitData(value, enter, leave);
3933
+ Object.defineProperty(newData, key, {
3934
+ value: visitData(value, enter, leave),
3935
+ });
3929
3936
  }
3930
3937
  }
3931
3938
  return leave != null ? leave(newData) : newData;
@@ -4153,6 +4160,27 @@ function withCancel(asyncIteratorLike, onCancel) {
4153
4160
  return asyncIterator;
4154
4161
  }
4155
4162
 
4163
+ function buildFixedSchema(schema, options) {
4164
+ const document = getDocumentNodeFromSchema(schema);
4165
+ return graphql.buildASTSchema(document, {
4166
+ ...(options || {}),
4167
+ });
4168
+ }
4169
+ function fixSchemaAst(schema, options) {
4170
+ // eslint-disable-next-line no-undef-init
4171
+ let schemaWithValidAst = undefined;
4172
+ if (!schema.astNode || !schema.extensionASTNodes) {
4173
+ schemaWithValidAst = buildFixedSchema(schema, options);
4174
+ }
4175
+ if (!schema.astNode && (schemaWithValidAst === null || schemaWithValidAst === void 0 ? void 0 : schemaWithValidAst.astNode)) {
4176
+ schema.astNode = schemaWithValidAst.astNode;
4177
+ }
4178
+ if (!schema.extensionASTNodes && (schemaWithValidAst === null || schemaWithValidAst === void 0 ? void 0 : schemaWithValidAst.astNode)) {
4179
+ schema.extensionASTNodes = schemaWithValidAst.extensionASTNodes;
4180
+ }
4181
+ return schema;
4182
+ }
4183
+
4156
4184
  exports.addTypes = addTypes;
4157
4185
  exports.appendObjectFields = appendObjectFields;
4158
4186
  exports.asArray = asArray;
@@ -4183,11 +4211,13 @@ exports.createStub = createStub;
4183
4211
  exports.createVariableNameGenerator = createVariableNameGenerator;
4184
4212
  exports.dedentBlockStringValue = dedentBlockStringValue;
4185
4213
  exports.filterSchema = filterSchema;
4214
+ exports.fixSchemaAst = fixSchemaAst;
4186
4215
  exports.forEachDefaultValue = forEachDefaultValue;
4187
4216
  exports.forEachField = forEachField;
4188
4217
  exports.getArgumentValues = getArgumentValues;
4189
4218
  exports.getBlockStringIndentation = getBlockStringIndentation;
4190
4219
  exports.getBuiltInForStub = getBuiltInForStub;
4220
+ exports.getComment = getComment;
4191
4221
  exports.getDefinedRootType = getDefinedRootType;
4192
4222
  exports.getDeprecatableDirectiveNodes = getDeprecatableDirectiveNodes;
4193
4223
  exports.getDescription = getDescription;
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, getOperationAST, getOperationRootType, TypeNameMetaFieldDef } from 'graphql';
1
+ import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, getOperationAST, getOperationRootType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
2
2
 
3
3
  const asArray = (fns) => (Array.isArray(fns) ? fns : fns ? [fns] : []);
4
4
  const invalidDocRegex = /\.[a-z0-9]+$/i;
@@ -1009,7 +1009,8 @@ function astFromScalarType(type, schema, pathToDirectivesInExtensions) {
1009
1009
  const directives = directivesInExtensions
1010
1010
  ? makeDirectiveNodes(schema, directivesInExtensions)
1011
1011
  : ((_a = type.astNode) === null || _a === void 0 ? void 0 : _a.directives) || [];
1012
- if ('specifiedBy' in type && !directives.some(directiveNode => directiveNode.name.value === 'specifiedBy')) {
1012
+ if (type['specifiedByUrl'] &&
1013
+ !directives.some(directiveNode => directiveNode.name.value === 'specifiedBy')) {
1013
1014
  const specifiedByArgs = {
1014
1015
  url: type['specifiedByUrl'],
1015
1016
  };
@@ -1319,7 +1320,7 @@ function collectComment(node) {
1319
1320
  }
1320
1321
  }
1321
1322
  function pushComment(node, entity, field, argument) {
1322
- const comment = getDescription(node, { commentDescriptions: true });
1323
+ const comment = getComment(node);
1323
1324
  if (typeof comment !== 'string' || comment.length === 0) {
1324
1325
  return;
1325
1326
  }
@@ -1455,7 +1456,12 @@ const printDocASTReducer = {
1455
1456
  IntValue: { leave: ({ value }) => value },
1456
1457
  FloatValue: { leave: ({ value }) => value },
1457
1458
  StringValue: {
1458
- leave: ({ value, block: isBlockString }) => (isBlockString ? printBlockString(value) : JSON.stringify(value)),
1459
+ leave: ({ value, block: isBlockString }) => {
1460
+ if (isBlockString) {
1461
+ return printBlockString(value);
1462
+ }
1463
+ return JSON.stringify(value);
1464
+ },
1459
1465
  },
1460
1466
  BooleanValue: { leave: ({ value }) => (value ? 'true' : 'false') },
1461
1467
  NullValue: { leave: () => 'null' },
@@ -1473,21 +1479,19 @@ const printDocASTReducer = {
1473
1479
  NonNullType: { leave: ({ type }) => type + '!' },
1474
1480
  // Type System Definitions
1475
1481
  SchemaDefinition: {
1476
- leave: ({ description, directives, operationTypes }) => wrap('', description, '\n') + join(['schema', join(directives, ' '), block(operationTypes)], ' '),
1482
+ leave: ({ directives, operationTypes }) => join(['schema', join(directives, ' '), block(operationTypes)], ' '),
1477
1483
  },
1478
1484
  OperationTypeDefinition: {
1479
1485
  leave: ({ operation, type }) => operation + ': ' + type,
1480
1486
  },
1481
1487
  ScalarTypeDefinition: {
1482
- leave: ({ description, name, directives }) => wrap('', description, '\n') + join(['scalar', name, join(directives, ' ')], ' '),
1488
+ leave: ({ name, directives }) => join(['scalar', name, join(directives, ' ')], ' '),
1483
1489
  },
1484
1490
  ObjectTypeDefinition: {
1485
- leave: ({ description, name, interfaces, directives, fields }) => wrap('', description, '\n') +
1486
- join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1491
+ leave: ({ name, interfaces, directives, fields }) => join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1487
1492
  },
1488
1493
  FieldDefinition: {
1489
- leave: ({ description, name, arguments: args, type, directives }) => wrap('', description, '\n') +
1490
- name +
1494
+ leave: ({ name, arguments: args, type, directives }) => name +
1491
1495
  (hasMultilineItems(args)
1492
1496
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
1493
1497
  : wrap('(', join(args, ', '), ')')) +
@@ -1496,27 +1500,25 @@ const printDocASTReducer = {
1496
1500
  wrap(' ', join(directives, ' ')),
1497
1501
  },
1498
1502
  InputValueDefinition: {
1499
- leave: ({ description, name, type, defaultValue, directives }) => wrap('', description, '\n') + join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '),
1503
+ leave: ({ name, type, defaultValue, directives }) => join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '),
1500
1504
  },
1501
1505
  InterfaceTypeDefinition: {
1502
- leave: ({ description, name, interfaces, directives, fields }) => wrap('', description, '\n') +
1503
- join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1506
+ leave: ({ name, interfaces, directives, fields }) => join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '),
1504
1507
  },
1505
1508
  UnionTypeDefinition: {
1506
- leave: ({ description, name, directives, types }) => wrap('', description, '\n') + join(['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], ' '),
1509
+ leave: ({ name, directives, types }) => join(['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], ' '),
1507
1510
  },
1508
1511
  EnumTypeDefinition: {
1509
- leave: ({ description, name, directives, values }) => wrap('', description, '\n') + join(['enum', name, join(directives, ' '), block(values)], ' '),
1512
+ leave: ({ name, directives, values }) => join(['enum', name, join(directives, ' '), block(values)], ' '),
1510
1513
  },
1511
1514
  EnumValueDefinition: {
1512
- leave: ({ description, name, directives }) => wrap('', description, '\n') + join([name, join(directives, ' ')], ' '),
1515
+ leave: ({ name, directives }) => join([name, join(directives, ' ')], ' '),
1513
1516
  },
1514
1517
  InputObjectTypeDefinition: {
1515
- leave: ({ description, name, directives, fields }) => wrap('', description, '\n') + join(['input', name, join(directives, ' '), block(fields)], ' '),
1518
+ leave: ({ name, directives, fields }) => join(['input', name, join(directives, ' '), block(fields)], ' '),
1516
1519
  },
1517
1520
  DirectiveDefinition: {
1518
- leave: ({ description, name, arguments: args, repeatable, locations }) => wrap('', description, '\n') +
1519
- 'directive @' +
1521
+ leave: ({ name, arguments: args, repeatable, locations }) => 'directive @' +
1520
1522
  name +
1521
1523
  (hasMultilineItems(args)
1522
1524
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
@@ -1569,10 +1571,13 @@ function getDescription(node, options) {
1569
1571
  return node.description.value;
1570
1572
  }
1571
1573
  if (options === null || options === void 0 ? void 0 : options.commentDescriptions) {
1572
- const rawValue = getLeadingCommentBlock(node);
1573
- if (rawValue !== undefined) {
1574
- return dedentBlockStringValue(`\n${rawValue}`);
1575
- }
1574
+ return getComment(node);
1575
+ }
1576
+ }
1577
+ function getComment(node) {
1578
+ const rawValue = getLeadingCommentBlock(node);
1579
+ if (rawValue !== undefined) {
1580
+ return dedentBlockStringValue(`\n${rawValue}`);
1576
1581
  }
1577
1582
  }
1578
1583
  function getLeadingCommentBlock(node) {
@@ -3922,7 +3927,9 @@ function visitData(data, enter, leave) {
3922
3927
  if (newData != null) {
3923
3928
  for (const key in newData) {
3924
3929
  const value = newData[key];
3925
- newData[key] = visitData(value, enter, leave);
3930
+ Object.defineProperty(newData, key, {
3931
+ value: visitData(value, enter, leave),
3932
+ });
3926
3933
  }
3927
3934
  }
3928
3935
  return leave != null ? leave(newData) : newData;
@@ -4150,4 +4157,25 @@ function withCancel(asyncIteratorLike, onCancel) {
4150
4157
  return asyncIterator;
4151
4158
  }
4152
4159
 
4153
- export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
4160
+ function buildFixedSchema(schema, options) {
4161
+ const document = getDocumentNodeFromSchema(schema);
4162
+ return buildASTSchema(document, {
4163
+ ...(options || {}),
4164
+ });
4165
+ }
4166
+ function fixSchemaAst(schema, options) {
4167
+ // eslint-disable-next-line no-undef-init
4168
+ let schemaWithValidAst = undefined;
4169
+ if (!schema.astNode || !schema.extensionASTNodes) {
4170
+ schemaWithValidAst = buildFixedSchema(schema, options);
4171
+ }
4172
+ if (!schema.astNode && (schemaWithValidAst === null || schemaWithValidAst === void 0 ? void 0 : schemaWithValidAst.astNode)) {
4173
+ schema.astNode = schemaWithValidAst.astNode;
4174
+ }
4175
+ if (!schema.extensionASTNodes && (schemaWithValidAst === null || schemaWithValidAst === void 0 ? void 0 : schemaWithValidAst.astNode)) {
4176
+ schema.extensionASTNodes = schemaWithValidAst.extensionASTNodes;
4177
+ }
4178
+ return schema;
4179
+ }
4180
+
4181
+ export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "8.2.0",
3
+ "version": "8.2.4",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -1,10 +0,0 @@
1
- interface AggregateError extends Error {
2
- errors: any[];
3
- }
4
- interface AggregateErrorConstructor {
5
- new (errors: Iterable<any>, message?: string): AggregateError;
6
- (errors: Iterable<any>, message?: string): AggregateError;
7
- readonly prototype: AggregateError;
8
- }
9
- declare let AggregateErrorImpl: AggregateErrorConstructor;
10
- export { AggregateErrorImpl as AggregateError };
@@ -1,242 +0,0 @@
1
- import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLResolveInfo, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLDirective, FragmentDefinitionNode, SelectionNode, ExecutionResult as GraphQLExecutionResult, GraphQLOutputType, FieldDefinitionNode, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLArgumentConfig, GraphQLEnumValueConfig, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, GraphQLIsTypeOfFn, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, InterfaceTypeDefinitionNode, GraphQLTypeResolver, UnionTypeDefinitionNode, UnionTypeExtensionNode, InputObjectTypeExtensionNode, InputObjectTypeDefinitionNode, GraphQLType, Source, DefinitionNode, OperationTypeNode } from 'graphql';
2
- export declare type ExecutionResult<TData = Record<string, any>> = GraphQLExecutionResult & {
3
- data?: TData | null;
4
- extensions?: Record<string, any>;
5
- };
6
- export interface ExecutionRequest<TArgs extends Record<string, any> = Record<string, any>, TContext = any, TRootValue = any, TExtensions = Record<string, any>> {
7
- document: DocumentNode;
8
- operationType: OperationTypeNode;
9
- variables?: TArgs;
10
- operationName?: string;
11
- extensions?: TExtensions;
12
- rootValue?: TRootValue;
13
- context?: TContext;
14
- info?: GraphQLResolveInfo;
15
- }
16
- export interface GraphQLParseOptions {
17
- noLocation?: boolean;
18
- allowLegacySDLEmptyFields?: boolean;
19
- allowLegacySDLImplementsInterfaces?: boolean;
20
- experimentalFragmentVariables?: boolean;
21
- /**
22
- * Set to `true` in order to convert all GraphQL comments (marked with # sign) to descriptions (""")
23
- * GraphQL has built-in support for transforming descriptions to comments (with `print`), but not while
24
- * parsing. Turning the flag on will support the other way as well (`parse`)
25
- */
26
- commentDescriptions?: boolean;
27
- }
28
- export declare type ValidatorBehavior = 'error' | 'warn' | 'ignore';
29
- /**
30
- * Options for validating resolvers
31
- */
32
- export interface IResolverValidationOptions {
33
- /**
34
- * Enable to require a resolver to be defined for any field that has
35
- * arguments. Defaults to `ignore`.
36
- */
37
- requireResolversForArgs?: ValidatorBehavior;
38
- /**
39
- * Enable to require a resolver to be defined for any field which has
40
- * a return type that isn't a scalar. Defaults to `ignore`.
41
- */
42
- requireResolversForNonScalar?: ValidatorBehavior;
43
- /**
44
- * Enable to require a resolver for be defined for all fields defined
45
- * in the schema. Defaults to `ignore`.
46
- */
47
- requireResolversForAllFields?: ValidatorBehavior;
48
- /**
49
- * Enable to require a `resolveType()` for Interface and Union types.
50
- * Defaults to `ignore`.
51
- */
52
- requireResolversForResolveType?: ValidatorBehavior;
53
- /**
54
- * Enable to require all defined resolvers to match fields that
55
- * actually exist in the schema. Defaults to `error` to catch common errors.
56
- */
57
- requireResolversToMatchSchema?: ValidatorBehavior;
58
- }
59
- /**
60
- * Configuration object for adding resolvers to a schema
61
- */
62
- export interface IAddResolversToSchemaOptions {
63
- /**
64
- * The schema to which to add resolvers
65
- */
66
- schema: GraphQLSchema;
67
- /**
68
- * Object describing the field resolvers to add to the provided schema
69
- */
70
- resolvers: IResolvers;
71
- /**
72
- * Override the default field resolver provided by `graphql-js`
73
- */
74
- defaultFieldResolver?: IFieldResolver<any, any>;
75
- /**
76
- * Additional options for validating the provided resolvers
77
- */
78
- resolverValidationOptions?: IResolverValidationOptions;
79
- /**
80
- * GraphQL object types that implement interfaces will inherit any missing
81
- * resolvers from their interface types defined in the `resolvers` object
82
- */
83
- inheritResolversFromInterfaces?: boolean;
84
- /**
85
- * Set to `true` to modify the existing schema instead of creating a new one
86
- */
87
- updateResolversInPlace?: boolean;
88
- }
89
- export declare type IScalarTypeResolver = GraphQLScalarType & {
90
- __name?: string;
91
- __description?: string;
92
- __serialize?: GraphQLScalarSerializer<any>;
93
- __parseValue?: GraphQLScalarValueParser<any>;
94
- __parseLiteral?: GraphQLScalarLiteralParser<any>;
95
- __extensions?: Record<string, any>;
96
- __astNode?: ScalarTypeDefinitionNode;
97
- __extensionASTNodes?: Array<ScalarTypeExtensionNode>;
98
- };
99
- export declare type IEnumTypeResolver = Record<string, any> & {
100
- __name?: string;
101
- __description?: string;
102
- __extensions?: Record<string, any>;
103
- __astNode?: EnumTypeDefinitionNode;
104
- __extensionASTNodes?: Array<EnumTypeExtensionNode>;
105
- };
106
- export interface IFieldResolverOptions<TSource = any, TContext = any, TArgs = any> {
107
- name?: string;
108
- description?: string;
109
- type?: GraphQLOutputType;
110
- args?: Array<GraphQLArgument>;
111
- resolve?: IFieldResolver<TSource, TContext, TArgs>;
112
- subscribe?: IFieldResolver<TSource, TContext, TArgs>;
113
- isDeprecated?: boolean;
114
- deprecationReason?: string;
115
- extensions?: Record<string, any>;
116
- astNode?: FieldDefinitionNode;
117
- }
118
- export declare type FieldNodeMapper = (fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>, transformationContext: Record<string, any>) => SelectionNode | Array<SelectionNode>;
119
- export declare type FieldNodeMappers = Record<string, Record<string, FieldNodeMapper>>;
120
- export declare type InputFieldFilter = (typeName?: string, fieldName?: string, inputFieldConfig?: GraphQLInputFieldConfig) => boolean;
121
- export declare type FieldFilter = (typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig) => boolean;
122
- export declare type ObjectFieldFilter = (typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => boolean;
123
- export declare type RootFieldFilter = (operation: 'Query' | 'Mutation' | 'Subscription', rootFieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => boolean;
124
- export declare type TypeFilter = (typeName: string, type: GraphQLType) => boolean;
125
- export declare type ArgumentFilter = (typeName?: string, fieldName?: string, argName?: string, argConfig?: GraphQLArgumentConfig) => boolean;
126
- export declare type RenameTypesOptions = {
127
- renameBuiltins: boolean;
128
- renameScalars: boolean;
129
- };
130
- export declare type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TReturn;
131
- export declare type TypeSource = string | Source | DocumentNode | GraphQLSchema | DefinitionNode | Array<TypeSource> | (() => TypeSource);
132
- export declare type IObjectTypeResolver<TSource = any, TContext = any, TArgs = any> = {
133
- [key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>;
134
- } & {
135
- __name?: string;
136
- __description?: string;
137
- __isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
138
- __extensions?: Record<string, any>;
139
- __astNode?: ObjectTypeDefinitionNode;
140
- __extensionASTNodes?: ObjectTypeExtensionNode;
141
- };
142
- export declare type IInterfaceTypeResolver<TSource = any, TContext = any, TArgs = any> = {
143
- [key: string]: IFieldResolver<TSource, TContext, TArgs> | IFieldResolverOptions<TSource, TContext>;
144
- } & {
145
- __name?: string;
146
- __description?: string;
147
- __resolveType?: GraphQLTypeResolver<any, any>;
148
- __extensions?: Record<string, any>;
149
- __astNode?: InterfaceTypeDefinitionNode;
150
- __extensionASTNodes?: Array<InterfaceTypeExtensionNode>;
151
- };
152
- export declare type IUnionTypeResolver = {
153
- __name?: string;
154
- __description?: string;
155
- __resolveType?: GraphQLTypeResolver<any, any>;
156
- __extensions?: Record<string, any>;
157
- __astNode?: UnionTypeDefinitionNode;
158
- __extensionASTNodes?: Array<UnionTypeExtensionNode>;
159
- };
160
- export declare type IInputObjectTypeResolver = {
161
- __name?: string;
162
- __description?: string;
163
- __extensions?: Record<string, any>;
164
- __astNode?: InputObjectTypeDefinitionNode;
165
- __extensionASTNodes?: Array<InputObjectTypeExtensionNode>;
166
- };
167
- export declare type ISchemaLevelResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = IFieldResolver<TSource, TContext, TArgs, TReturn>;
168
- export declare type IResolvers<TSource = any, TContext = any, TArgs = Record<string, any>, TReturn = any> = Record<string, ISchemaLevelResolver<TSource, TContext, TArgs, TReturn> | IObjectTypeResolver<TSource, TContext> | IInterfaceTypeResolver<TSource, TContext> | IUnionTypeResolver | IScalarTypeResolver | IEnumTypeResolver | IInputObjectTypeResolver>;
169
- export declare type IFieldIteratorFn = (fieldDef: GraphQLField<any, any>, typeName: string, fieldName: string) => void;
170
- export declare type IDefaultValueIteratorFn = (type: GraphQLInputType, value: any) => void;
171
- export declare type NextResolverFn = () => Promise<any>;
172
- export declare type VisitableSchemaType = GraphQLSchema | GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType | GraphQLNamedType | GraphQLScalarType | GraphQLField<any, any> | GraphQLInputField | GraphQLArgument | GraphQLUnionType | GraphQLEnumType | GraphQLEnumValue;
173
- export declare enum MapperKind {
174
- TYPE = "MapperKind.TYPE",
175
- SCALAR_TYPE = "MapperKind.SCALAR_TYPE",
176
- ENUM_TYPE = "MapperKind.ENUM_TYPE",
177
- COMPOSITE_TYPE = "MapperKind.COMPOSITE_TYPE",
178
- OBJECT_TYPE = "MapperKind.OBJECT_TYPE",
179
- INPUT_OBJECT_TYPE = "MapperKind.INPUT_OBJECT_TYPE",
180
- ABSTRACT_TYPE = "MapperKind.ABSTRACT_TYPE",
181
- UNION_TYPE = "MapperKind.UNION_TYPE",
182
- INTERFACE_TYPE = "MapperKind.INTERFACE_TYPE",
183
- ROOT_OBJECT = "MapperKind.ROOT_OBJECT",
184
- QUERY = "MapperKind.QUERY",
185
- MUTATION = "MapperKind.MUTATION",
186
- SUBSCRIPTION = "MapperKind.SUBSCRIPTION",
187
- DIRECTIVE = "MapperKind.DIRECTIVE",
188
- FIELD = "MapperKind.FIELD",
189
- COMPOSITE_FIELD = "MapperKind.COMPOSITE_FIELD",
190
- OBJECT_FIELD = "MapperKind.OBJECT_FIELD",
191
- ROOT_FIELD = "MapperKind.ROOT_FIELD",
192
- QUERY_ROOT_FIELD = "MapperKind.QUERY_ROOT_FIELD",
193
- MUTATION_ROOT_FIELD = "MapperKind.MUTATION_ROOT_FIELD",
194
- SUBSCRIPTION_ROOT_FIELD = "MapperKind.SUBSCRIPTION_ROOT_FIELD",
195
- INTERFACE_FIELD = "MapperKind.INTERFACE_FIELD",
196
- INPUT_OBJECT_FIELD = "MapperKind.INPUT_OBJECT_FIELD",
197
- ARGUMENT = "MapperKind.ARGUMENT",
198
- ENUM_VALUE = "MapperKind.ENUM_VALUE"
199
- }
200
- export interface SchemaMapper {
201
- [MapperKind.TYPE]?: NamedTypeMapper;
202
- [MapperKind.SCALAR_TYPE]?: ScalarTypeMapper;
203
- [MapperKind.ENUM_TYPE]?: EnumTypeMapper;
204
- [MapperKind.COMPOSITE_TYPE]?: CompositeTypeMapper;
205
- [MapperKind.OBJECT_TYPE]?: ObjectTypeMapper;
206
- [MapperKind.INPUT_OBJECT_TYPE]?: InputObjectTypeMapper;
207
- [MapperKind.ABSTRACT_TYPE]?: AbstractTypeMapper;
208
- [MapperKind.UNION_TYPE]?: UnionTypeMapper;
209
- [MapperKind.INTERFACE_TYPE]?: InterfaceTypeMapper;
210
- [MapperKind.ROOT_OBJECT]?: ObjectTypeMapper;
211
- [MapperKind.QUERY]?: ObjectTypeMapper;
212
- [MapperKind.MUTATION]?: ObjectTypeMapper;
213
- [MapperKind.SUBSCRIPTION]?: ObjectTypeMapper;
214
- [MapperKind.ENUM_VALUE]?: EnumValueMapper;
215
- [MapperKind.FIELD]?: GenericFieldMapper<GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig>;
216
- [MapperKind.OBJECT_FIELD]?: FieldMapper;
217
- [MapperKind.ROOT_FIELD]?: FieldMapper;
218
- [MapperKind.QUERY_ROOT_FIELD]?: FieldMapper;
219
- [MapperKind.MUTATION_ROOT_FIELD]?: FieldMapper;
220
- [MapperKind.SUBSCRIPTION_ROOT_FIELD]?: FieldMapper;
221
- [MapperKind.INTERFACE_FIELD]?: FieldMapper;
222
- [MapperKind.COMPOSITE_FIELD]?: FieldMapper;
223
- [MapperKind.ARGUMENT]?: ArgumentMapper;
224
- [MapperKind.INPUT_OBJECT_FIELD]?: InputFieldMapper;
225
- [MapperKind.DIRECTIVE]?: DirectiveMapper;
226
- }
227
- export declare type SchemaFieldMapperTypes = Array<MapperKind.FIELD | MapperKind.COMPOSITE_FIELD | MapperKind.OBJECT_FIELD | MapperKind.ROOT_FIELD | MapperKind.QUERY_ROOT_FIELD | MapperKind.MUTATION_ROOT_FIELD | MapperKind.SUBSCRIPTION_ROOT_FIELD | MapperKind.INTERFACE_FIELD | MapperKind.INPUT_OBJECT_FIELD>;
228
- export declare type NamedTypeMapper = (type: GraphQLNamedType, schema: GraphQLSchema) => GraphQLNamedType | null | undefined;
229
- export declare type ScalarTypeMapper = (type: GraphQLScalarType, schema: GraphQLSchema) => GraphQLScalarType | null | undefined;
230
- export declare type EnumTypeMapper = (type: GraphQLEnumType, schema: GraphQLSchema) => GraphQLEnumType | null | undefined;
231
- export declare type EnumValueMapper = (valueConfig: GraphQLEnumValueConfig, typeName: string, schema: GraphQLSchema, externalValue: string) => GraphQLEnumValueConfig | [string, GraphQLEnumValueConfig] | null | undefined;
232
- export declare type CompositeTypeMapper = (type: GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType, schema: GraphQLSchema) => GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | null | undefined;
233
- export declare type ObjectTypeMapper = (type: GraphQLObjectType, schema: GraphQLSchema) => GraphQLObjectType | null | undefined;
234
- export declare type InputObjectTypeMapper = (type: GraphQLInputObjectType, schema: GraphQLSchema) => GraphQLInputObjectType | null | undefined;
235
- export declare type AbstractTypeMapper = (type: GraphQLInterfaceType | GraphQLUnionType, schema: GraphQLSchema) => GraphQLInterfaceType | GraphQLUnionType | null | undefined;
236
- export declare type UnionTypeMapper = (type: GraphQLUnionType, schema: GraphQLSchema) => GraphQLUnionType | null | undefined;
237
- export declare type InterfaceTypeMapper = (type: GraphQLInterfaceType, schema: GraphQLSchema) => GraphQLInterfaceType | null | undefined;
238
- export declare type DirectiveMapper = (directive: GraphQLDirective, schema: GraphQLSchema) => GraphQLDirective | null | undefined;
239
- export declare type GenericFieldMapper<F extends GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig> = (fieldConfig: F, fieldName: string, typeName: string, schema: GraphQLSchema) => F | [string, F] | null | undefined;
240
- export declare type FieldMapper = GenericFieldMapper<GraphQLFieldConfig<any, any>>;
241
- export declare type ArgumentMapper = (argumentConfig: GraphQLArgumentConfig, fieldName: string, typeName: string, schema: GraphQLSchema) => GraphQLArgumentConfig | [string, GraphQLArgumentConfig] | null | undefined;
242
- export declare type InputFieldMapper = GenericFieldMapper<GraphQLInputFieldConfig>;
package/es5/addTypes.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { GraphQLSchema, GraphQLNamedType, GraphQLDirective } from 'graphql';
2
- export declare function addTypes(schema: GraphQLSchema, newTypesOrDirectives: Array<GraphQLNamedType | GraphQLDirective>): GraphQLSchema;
@@ -1,2 +0,0 @@
1
- import { GraphQLType, TypeNode } from 'graphql';
2
- export declare function astFromType(type: GraphQLType): TypeNode;
@@ -1,17 +0,0 @@
1
- import { ValueNode } from 'graphql';
2
- /**
3
- * Produces a GraphQL Value AST given a JavaScript object.
4
- * Function will match JavaScript/JSON values to GraphQL AST schema format
5
- * by using the following mapping.
6
- *
7
- * | JSON Value | GraphQL Value |
8
- * | ------------- | -------------------- |
9
- * | Object | Input Object |
10
- * | Array | List |
11
- * | Boolean | Boolean |
12
- * | String | String |
13
- * | Number | Int / Float |
14
- * | null | NullValue |
15
- *
16
- */
17
- export declare function astFromValueUntyped(value: any): ValueNode | null;