text: Object.defineProperty(exports, "__esModule", { value: true });
  var graphql_1 = require("graphql");
  var index_1 = require("../utils/index");
  /**
   * Polyfill for graphql < v14.2 which does not support subscriptions
   */
  function extendSchema(schema, extension, options) {
      var subscriptionType = schema.getSubscriptionType();
      if (subscriptionType == null) {
          return graphql_1.extendSchema(schema, extension, options);
      }
      var resolvers = index_1.getResolversFromSchema(schema);
      var subscriptionTypeName = subscriptionType.name;
      var subscriptionResolvers = resolvers[subscriptionTypeName];
      var extendedSchema = graphql_1.extendSchema(schema, extension, options);
      var fields = extendedSchema.getSubscriptionType().getFields();
      Object.keys(subscriptionResolvers).forEach(function (fieldName) {
          fields[fieldName].subscribe = subscriptionResolvers[fieldName].subscribe;
      });
      return extendedSchema;
  }
  exports.extendSchema = extendSchema;
  //# sourceMappingURL=extendSchema.js.map