text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.unknownTypeMessage = unknownTypeMessage;
  exports.KnownTypeNames = KnownTypeNames;
  
  var _GraphQLError = require("../../error/GraphQLError");
  
  var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
  
  var _quotedOrList = _interopRequireDefault(require("../../jsutils/quotedOrList"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  /**
   * Copyright (c) 2015-present, Facebook, Inc.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *
   *  strict
   */
  function unknownTypeMessage(typeName, suggestedTypes) {
    var message = "Unknown type \"".concat(typeName, "\".");
  
    if (suggestedTypes.length) {
      message += " Did you mean ".concat((0, _quotedOrList.default)(suggestedTypes), "?");
    }
  
    return message;
  }
  /**
   * Known type names
   *
   * A GraphQL document is only valid if referenced types (specifically
   * variable definitions and fragment conditions) are defined by the type schema.
   */
  
  
  function KnownTypeNames(context) {
    return {
      // TODO: when validating IDL, re-enable these. Experimental version does not
      // add unreferenced types, resulting in false-positive errors. Squelched
      // errors for now.
      ObjectTypeDefinition: function ObjectTypeDefinition() {
        return false;
      },
      InterfaceTypeDefinition: function InterfaceTypeDefinition() {
        return false;
      },
      UnionTypeDefinition: function UnionTypeDefinition() {
        return false;
      },
      InputObjectTypeDefinition: function InputObjectTypeDefinition() {
        return false;
      },
      NamedType: function NamedType(node) {
        var schema = context.getSchema();
        var typeName = node.name.value;
        var type = schema.getType(typeName);
  
        if (!type) {
          context.reportError(new _GraphQLError.GraphQLError(unknownTypeMessage(typeName, (0, _suggestionList.default)(typeName, Object.keys(schema.getTypeMap()))), [node]));
        }
      }
    };
  }