graphql-http
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
@@ -12,2 +16,6 @@ | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
@@ -25,8 +33,4 @@ | ||
var _promise2 = require('babel-runtime/core-js/promise'); | ||
var _promise3 = _interopRequireDefault(_promise2); | ||
var _makeRequest = function () { | ||
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ax, config) { | ||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ax, config) { | ||
var result, response, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, err; | ||
@@ -56,3 +60,3 @@ | ||
if (!_context.t0.data.hasOwnProperty('errors')) { | ||
if (!(_context.t0 && _context.t0.data && _context.t0.data.hasOwnProperty('errors'))) { | ||
_context.next = 33; | ||
@@ -110,3 +114,3 @@ break; | ||
case 33: | ||
console.error('[GQLHTTP] Error: ' + _context.t0.data); | ||
console.error('[GQLHTTP] Error: ' + _context.t0); | ||
@@ -123,4 +127,5 @@ case 34: | ||
})); | ||
return function _makeRequest(_x, _x2) { | ||
return ref.apply(this, arguments); | ||
return _ref.apply(this, arguments); | ||
}; | ||
@@ -150,10 +155,2 @@ }(); | ||
function _promise(fn) { | ||
return new _promise3.default(function (res, rej) { | ||
fn(function (err, succ) { | ||
return err ? rej(err) : res(succ); | ||
}); | ||
}); | ||
} | ||
function graphQLClient(host, config) { | ||
@@ -168,3 +165,5 @@ if (config === undefined) { | ||
query: function query(_query, variables, opName) { | ||
return _makeRequest(ax, { | ||
var extra = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
return _makeRequest(ax, (0, _extends3.default)({ | ||
params: { | ||
@@ -175,32 +174,23 @@ query: _query, | ||
} | ||
}); | ||
}, extra)); | ||
}, | ||
mutate: function mutate(query, variables, opName) { | ||
var _this = this; | ||
var _ref2 = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; | ||
return (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2() { | ||
return _regenerator2.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
return _context2.abrupt('return', _makeRequest(ax, { | ||
data: { | ||
query: query, | ||
variables: variables, | ||
opName: opName | ||
}, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
// 'Content-Encoding': 'gzip' | ||
method: 'POST' | ||
})); | ||
var _ref2$headers = _ref2.headers; | ||
var headers = _ref2$headers === undefined ? {} : _ref2$headers; | ||
var restExtra = (0, _objectWithoutProperties3.default)(_ref2, ['headers']); | ||
case 1: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, _this); | ||
}))(); | ||
// @TODO Get Gzip support working | ||
return _makeRequest(ax, (0, _extends3.default)({ | ||
data: { | ||
query: query, | ||
variables: variables, | ||
opName: opName | ||
}, | ||
headers: (0, _extends3.default)({ | ||
'Content-Type': 'application/json' | ||
}, headers), | ||
method: 'POST' | ||
}, restExtra)); | ||
} | ||
@@ -207,0 +197,0 @@ }; |
{ | ||
"name": "graphql-http", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A GraphQL client for executing GraphQL queries over HTTP.", | ||
@@ -5,0 +5,0 @@ "main": "index.dist.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
7796
142
1