Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphiql

Package Overview
Dependencies
Maintainers
1
Versions
559
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphiql - npm Package Compare versions

Comparing version 0.7.8 to 0.8.0

32

dist/components/DocExplorer.js

@@ -110,13 +110,17 @@ 'use strict';

title = navItem.name;
content = (0, _graphql.isType)(navItem) ? _react2.default.createElement(TypeDoc, {
key: navItem.name,
schema: schema,
type: navItem,
onClickType: this.handleClickTypeOrField,
onClickField: this.handleClickTypeOrField
}) : _react2.default.createElement(FieldDoc, {
key: navItem.name,
field: navItem,
onClickType: this.handleClickTypeOrField
});
if ((0, _graphql.isType)(navItem)) {
content = _react2.default.createElement(TypeDoc, {
key: navItem.name,
schema: schema,
type: navItem,
onClickType: this.handleClickTypeOrField,
onClickField: this.handleClickTypeOrField
});
} else {
content = _react2.default.createElement(FieldDoc, {
key: navItem.name,
field: navItem,
onClickType: this.handleClickTypeOrField
});
}
}

@@ -567,3 +571,3 @@ } else if (schema) {

value: function shouldComponentUpdate(nextProps) {
return this.props.type !== nextProps.type;
return this.props.type !== nextProps.type || this.props.schema !== nextProps.schema;
}

@@ -666,3 +670,3 @@ }, {

_react2.default.createElement(TypeLink, { type: field.type, onClick: onClickType }),
field.isDeprecated && _react2.default.createElement(
(field.isDeprecated || field.deprecationReason) && _react2.default.createElement(
'span',

@@ -696,3 +700,3 @@ { className: 'doc-alert-text' },

value.name,
value.isDeprecated && _react2.default.createElement(
(value.isDeprecated || value.deprecationReason) && _react2.default.createElement(
'span',

@@ -699,0 +703,0 @@ { className: 'doc-alert-text' },

@@ -136,2 +136,4 @@ 'use strict';

var pathJSX = this.props.isRunning ? _react2.default.createElement('path', { d: 'M 10 10 L 23 10 L 23 23 L 10 23 z' }) : _react2.default.createElement('path', { d: 'M 11 9 L 24 16 L 11 23 z' });
return _react2.default.createElement(

@@ -150,3 +152,3 @@ 'div',

{ width: '34', height: '34' },
this.props.isRunning ? _react2.default.createElement('path', { d: 'M 10 10 L 23 10 L 23 23 L 10 23 z' }) : _react2.default.createElement('path', { d: 'M 11 9 L 24 16 L 11 23 z' })
pathJSX
)

@@ -153,0 +155,0 @@ ),

@@ -8,3 +8,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -186,3 +186,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

variableEditorHeight: Number(_this._storageGet('variableEditorHeight')) || 200,
docExplorerOpen: false,
docExplorerOpen: _this._storageGet('docExplorerOpen') === 'true' || false,
docExplorerWidth: Number(_this._storageGet('docExplorerWidth')) || 350,

@@ -266,3 +266,3 @@ isWaitingForResponse: false,

this._storageSet('query', this.state.query);
this._storageSet('variables', this.state.variables);
this._storageSet('variables', this.state.variables || '');
this._storageSet('operationName', this.state.operationName);

@@ -272,2 +272,3 @@ this._storageSet('editorFlex', this.state.editorFlex);

this._storageSet('docExplorerWidth', this.state.docExplorerWidth);
this._storageSet('docExplorerOpen', this.state.docExplorerOpen);
}

@@ -421,3 +422,3 @@ }, {

{ className: 'docExplorerHide', onClick: this.handleToggleDocs },
'✕'
'\u2715'
)

@@ -441,7 +442,6 @@ )

var _fillLeafs = (0, _fillLeafs2.fillLeafs)(this.state.schema, this.state.query, this.props.getDefaultFieldNames);
var _fillLeafs = (0, _fillLeafs2.fillLeafs)(this.state.schema, this.state.query, this.props.getDefaultFieldNames),
insertions = _fillLeafs.insertions,
result = _fillLeafs.result;
var insertions = _fillLeafs.insertions;
var result = _fillLeafs.result;
if (insertions && insertions.length > 0) {

@@ -456,4 +456,4 @@ (function () {

var markers = insertions.map(function (_ref) {
var index = _ref.index;
var string = _ref.string;
var index = _ref.index,
string = _ref.string;
return editor.markText(editor.posFromIndex(index + added), editor.posFromIndex(index + (added += string.length)), {

@@ -472,4 +472,4 @@ className: 'autoInsertedLeaf',

insertions.forEach(function (_ref2) {
var index = _ref2.index;
var string = _ref2.string;
var index = _ref2.index,
string = _ref2.string;

@@ -502,3 +502,3 @@ if (index < cursorIndex) {

var fetch = fetcher({ query: _introspectionQueries.introspectionQuery });
var fetch = observableToPromise(fetcher({ query: _introspectionQueries.introspectionQuery }));
if (!isPromise(fetch)) {

@@ -518,3 +518,5 @@ this.setState({

// sans-subscriptions query for services which do not yet support it.
var fetch2 = fetcher({ query: _introspectionQueries.introspectionQuerySansSubscriptions });
var fetch2 = observableToPromise(fetcher({
query: _introspectionQueries.introspectionQuerySansSubscriptions
}));
if (!isPromise(fetch)) {

@@ -562,4 +564,20 @@ throw new Error('Fetcher did not return a Promise for introspection.');

var fetcher = this.props.fetcher;
var fetch = fetcher({ query: query, variables: variables, operationName: operationName });
var jsonVariables = null;
try {
jsonVariables = variables && variables.trim() !== '' ? JSON.parse(variables) : null;
} catch (error) {
throw new Error('Variables are invalid JSON: ' + error.message + '.');
}
if ((typeof jsonVariables === 'undefined' ? 'undefined' : _typeof(jsonVariables)) !== 'object') {
throw new Error('Variables are not a JSON object.');
}
var fetch = fetcher({
query: query,
variables: jsonVariables,
operationName: operationName
});
if (isPromise(fetch)) {

@@ -597,6 +615,3 @@ // If fetcher returned a Promise, then call the callback when the promise

} else {
this.setState({
isWaitingForResponse: false,
response: 'Fetcher did not return Promise or Observable.'
});
throw new Error('Fetcher did not return Promise or Observable.');
}

@@ -706,18 +721,26 @@ }

// _fetchQuery may return a subscription.
var subscription = _this6._fetchQuery(editedQuery, variables, operationName, function (result) {
if (queryID === _this6._editorQueryID) {
_this6.setState({
isWaitingForResponse: false,
response: JSON.stringify(result, null, 2)
});
}
});
try {
_this6.setState({
isWaitingForResponse: true,
response: null,
operationName: operationName
});
_this6.setState({
isWaitingForResponse: true,
response: null,
subscription: subscription,
operationName: operationName
});
// _fetchQuery may return a subscription.
var subscription = _this6._fetchQuery(editedQuery, variables, operationName, function (result) {
if (queryID === _this6._editorQueryID) {
_this6.setState({
isWaitingForResponse: false,
response: JSON.stringify(result, null, 2)
});
}
});
_this6.setState({ subscription: subscription });
} catch (error) {
_this6.setState({
isWaitingForResponse: false,
response: error.message
});
}
};

@@ -734,3 +757,2 @@

}
return;
};

@@ -1011,2 +1033,17 @@

// Duck-type Observable.take(1).toPromise()
function observableToPromise(observable) {
if (!isObservable(observable)) {
return observable;
}
return new Promise(function (resolve, reject) {
var subscription = observable.subscribe(function (v) {
resolve(v);
subscription.unsubscribe();
}, reject, function () {
reject(new Error('no value resolved'));
});
});
}
// Duck-type observable detection.

@@ -1013,0 +1050,0 @@ function isObservable(value) {

@@ -59,2 +59,4 @@ 'use strict';

require('codemirror/addon/fold/brace-fold');
require('codemirror/addon/dialog/dialog');
require('codemirror/addon/search/search');
require('codemirror/keymap/sublime');

@@ -61,0 +63,0 @@ require('codemirror-graphql/results/mode');

@@ -153,4 +153,4 @@ 'use strict';

insertions.forEach(function (_ref) {
var index = _ref.index;
var string = _ref.string;
var index = _ref.index,
string = _ref.string;

@@ -157,0 +157,0 @@ edited += initial.slice(prevIndex, index) + string;

@@ -60,4 +60,4 @@ 'use strict';

variableDefinitions.forEach(function (_ref) {
var variable = _ref.variable;
var type = _ref.type;
var variable = _ref.variable,
type = _ref.type;

@@ -64,0 +64,0 @@ var inputType = (0, _graphql.typeFromAST)(schema, type);

{
"name": "graphiql",
"version": "0.7.8",
"version": "0.8.0",
"description": "An graphical interactive in-browser GraphQL IDE.",

@@ -45,7 +45,7 @@ "contributors": [

"codemirror": "^5.15.2",
"codemirror-graphql": "^0.5.7",
"codemirror-graphql": "^0.5.8",
"marked": "^0.3.5"
},
"peerDependencies": {
"graphql": "^0.6.0 || ^0.7.0",
"graphql": "^0.6.0 || ^0.7.0 || ^0.8.0-b",
"react": ">=0.14.8",

@@ -55,23 +55,23 @@ "react-dom": ">=0.14.8"

"devDependencies": {
"babel-cli": "6.6.5",
"babel-eslint": "6.0.4",
"babel-plugin-syntax-async-functions": "6.5.0",
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-plugin-transform-object-rest-spread": "6.6.5",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"browserify": "13.0.0",
"babel-cli": "6.18.0",
"babel-eslint": "7.1.0",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-class-properties": "6.18.0",
"babel-plugin-transform-object-rest-spread": "6.16.0",
"babel-preset-es2015": "6.18.0",
"babel-preset-react": "6.16.0",
"browserify": "13.1.1",
"browserify-shim": "3.8.12",
"chai": "3.5.0",
"chai-subset": "1.2.2",
"eslint": "2.7.0",
"eslint-plugin-babel": "3.2.0",
"eslint-plugin-react": "4.3.0",
"flow-bin": "0.22.1",
"graphql": "0.7.0",
"jsdom": "8.3.0",
"mocha": "2.4.5",
"react": "15.3.0",
"react-addons-test-utils": "15.3.0",
"react-dom": "15.3.0",
"chai-subset": "1.3.0",
"eslint": "3.10.0",
"eslint-plugin-babel": "3.3.0",
"eslint-plugin-react": "6.6.0",
"flow-bin": "0.35.0",
"graphql": "0.8.1",
"jsdom": "9.8.3",
"mocha": "3.1.2",
"react": "15.3.2",
"react-addons-test-utils": "15.3.2",
"react-dom": "15.3.2",
"uglify-js": "^2.4.24",

@@ -78,0 +78,0 @@ "uglifyify": "^3.0.1"

@@ -141,2 +141,3 @@ GraphiQL

constructor(props) {
super(props);
this.state = {

@@ -143,0 +144,0 @@ // REQUIRED:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc