Comparing version 0.6.0 to 0.6.1
@@ -550,50 +550,6 @@ /** | ||
GraphiQL.prototype.componentDidMount = function componentDidMount() { | ||
var _this2 = this; | ||
// Ensure a form of a schema exists (including `null`) and | ||
// if not, fetch one using an introspection query. | ||
this._ensureOfSchema(); | ||
// If there is no schema provided via props, fetch one using introspection. | ||
if (this.state.schema !== undefined) { | ||
return; | ||
} | ||
var fetcher = this.props.fetcher; | ||
var fetch = fetcher({ query: _utilityIntrospectionQueries.introspectionQuery }); | ||
if (!isPromise(fetch)) { | ||
console.error('Fetcher did not return a Promise for introspection.'); | ||
return; | ||
} | ||
fetch.then(function (result) { | ||
if (result.data) { | ||
return result; | ||
} | ||
// Try the stock introspection query first, falling back on the | ||
// sans-subscriptions query for services which do not yet support it. | ||
var fetch2 = fetcher({ query: _utilityIntrospectionQueries.introspectionQuerySansSubscriptions }); | ||
if (!isPromise(fetch)) { | ||
console.error('Fetcher did not return a Promise for introspection.'); | ||
return; | ||
} | ||
return fetch2; | ||
}).then(function (result) { | ||
// If a schema was provided while this fetch was underway, then | ||
// satisfy the race condition by respecting the already | ||
// provided schema. | ||
if (_this2.state.schema !== undefined) { | ||
return; | ||
} | ||
if (result.data) { | ||
var schema = _graphql.buildClientSchema(result.data); | ||
var queryFacts = _utilityGetQueryFacts2['default'](_this2.state, schema, _this2.state.query); | ||
_this2.setState(_extends({ schema: schema }, queryFacts)); | ||
} else { | ||
var responseString = typeof result === 'string' ? result : JSON.stringify(result, null, 2); | ||
_this2.setState({ response: responseString }); | ||
} | ||
})['catch'](function (error) { | ||
_this2.setState({ response: error && (error.stack || String(error)) }); | ||
}); | ||
// Add shortcut for running a query. | ||
@@ -748,2 +704,52 @@ document.addEventListener('keydown', this._keyHandler, true); | ||
GraphiQL.prototype._ensureOfSchema = function _ensureOfSchema() { | ||
var _this2 = this; | ||
// Only perform introspection if a schema is not provided (undefined) | ||
if (this.state.schema !== undefined) { | ||
return; | ||
} | ||
var fetcher = this.props.fetcher; | ||
var fetch = fetcher({ query: _utilityIntrospectionQueries.introspectionQuery }); | ||
if (!isPromise(fetch)) { | ||
console.error('Fetcher did not return a Promise for introspection.'); | ||
return; | ||
} | ||
fetch.then(function (result) { | ||
if (result.data) { | ||
return result; | ||
} | ||
// Try the stock introspection query first, falling back on the | ||
// sans-subscriptions query for services which do not yet support it. | ||
var fetch2 = fetcher({ query: _utilityIntrospectionQueries.introspectionQuerySansSubscriptions }); | ||
if (!isPromise(fetch)) { | ||
console.error('Fetcher did not return a Promise for introspection.'); | ||
return; | ||
} | ||
return fetch2; | ||
}).then(function (result) { | ||
// If a schema was provided while this fetch was underway, then | ||
// satisfy the race condition by respecting the already | ||
// provided schema. | ||
if (_this2.state.schema !== undefined) { | ||
return; | ||
} | ||
if (result.data) { | ||
var schema = _graphql.buildClientSchema(result.data); | ||
var queryFacts = _utilityGetQueryFacts2['default'](_this2.state, schema, _this2.state.query); | ||
_this2.setState(_extends({ schema: schema }, queryFacts)); | ||
} else { | ||
var responseString = typeof result === 'string' ? result : JSON.stringify(result, null, 2); | ||
_this2.setState({ response: responseString }); | ||
} | ||
})['catch'](function (error) { | ||
_this2.setState({ response: error && (error.stack || String(error)) }); | ||
}); | ||
}; | ||
GraphiQL.prototype._storageGet = function _storageGet(name) { | ||
@@ -750,0 +756,0 @@ return this._storage.getItem('graphiql:' + name); |
{ | ||
"name": "graphiql", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "An graphical interactive in-browser GraphQL IDE.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1727441
32649