Comparing version 3.6.0 to 3.7.0
@@ -5,3 +5,3 @@ 'use strict'; | ||
var qs = require('querystring'); | ||
var xhr = require('request'); | ||
var createRequest = require('./util/request'); | ||
var ArangoError = require('./error'); | ||
@@ -18,2 +18,3 @@ var Route = require('./route'); | ||
this.config = extend({}, Connection.defaults, config); | ||
this.config.agentOptions = extend({}, Connection.agentDefaults, this.config.agentOptions); | ||
if (!this.config.headers) this.config.headers = {}; | ||
@@ -23,2 +24,3 @@ if (!this.config.headers['x-arango-version']) { | ||
} | ||
this._request = createRequest(this.config.agent, this.config.agentOptions); | ||
} | ||
@@ -31,2 +33,7 @@ | ||
}; | ||
Connection.agentDefaults = { | ||
maxSockets: 3, | ||
keepAlive: true, | ||
keepAliveMsecs: 1000 | ||
}; | ||
@@ -69,3 +76,3 @@ extend(Connection.prototype, { | ||
xhr({ | ||
this._request({ | ||
url: this._resolveUrl(opts), | ||
@@ -75,12 +82,12 @@ headers: extend(headers, this.config.headers, opts.headers), | ||
body: body | ||
}, function (err, response, rawBody) { | ||
response.rawBody = rawBody; | ||
if (err) callback(err, response);else if (response.headers['content-type'].match(jsonMime)) { | ||
}, function (err, res) { | ||
if (err) callback(err);else if (res.headers['content-type'].match(jsonMime)) { | ||
try { | ||
response.body = JSON.parse(rawBody); | ||
res.rawBody = res.body; | ||
res.body = JSON.parse(res.rawBody); | ||
} catch (e) { | ||
return callback(extend(e, { response: response })); | ||
return callback(extend(e, { response: res })); | ||
} | ||
if (!response.body.error) callback(null, response);else callback(extend(new ArangoError(response.body), { response: response })); | ||
} else callback(null, extend(response, { body: rawBody })); | ||
if (!res.body.error) callback(null, res);else callback(extend(new ArangoError(res.body), { response: res })); | ||
} else callback(null, extend(res, { rawBody: res.body })); | ||
}); | ||
@@ -87,0 +94,0 @@ return promise; |
@@ -388,13 +388,3 @@ 'use strict'; | ||
}, | ||
query: (function (_query) { | ||
function query(_x, _x2, _x3) { | ||
return _query.apply(this, arguments); | ||
} | ||
query.toString = function () { | ||
return _query.toString(); | ||
}; | ||
return query; | ||
})(function (query, bindVars, cb) { | ||
query: function query(_query, bindVars, cb) { | ||
if (typeof bindVars === 'function') { | ||
@@ -410,8 +400,8 @@ cb = bindVars; | ||
if (query && typeof query.toAQL === 'function') { | ||
query = query.toAQL(); | ||
if (_query && typeof _query.toAQL === 'function') { | ||
_query = _query.toAQL(); | ||
} | ||
var self = this; | ||
self._api.post('cursor', { | ||
query: query, | ||
query: _query, | ||
bindVars: bindVars | ||
@@ -422,3 +412,3 @@ }, function (err, res) { | ||
return promise; | ||
}), | ||
}, | ||
functions: function functions(cb) { | ||
@@ -425,0 +415,0 @@ var _promisify20 = promisify(cb); |
@@ -7,5 +7,5 @@ 'use strict'; | ||
if (arr.length === 0) { | ||
return callback(null, result); | ||
}function step(i) { | ||
if (arr.length === 0) return callback(null, result); | ||
function step(i) { | ||
return function (err, res) { | ||
@@ -12,0 +12,0 @@ pending -= 1; |
{ | ||
"name": "arangojs", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "The official ArangoDB JavaScript driver.", | ||
@@ -29,5 +29,5 @@ "main": "index.js", | ||
"coveralls": "npm run cover && cat ./coverage/lcov.info | coveralls ; rm -rf ./coverage", | ||
"watch": "dirwatch -d 500 -c 'npm run test-only && npm run lint && npm run dist' ./lib ./test", | ||
"watch": "watch 'npm run test-only && npm run lint && npm run dist' ./lib ./test", | ||
"dist": "npm run babel && npm run bundle && npm run minify", | ||
"babel": "babel --optional utility.deadCodeElimination --compact false -d lib src", | ||
"babel": "babel --compact false -d lib src", | ||
"bundle": "npm run all-bundle && npm run raw-bundle", | ||
@@ -53,22 +53,16 @@ "minify": "npm run all-minify && npm run raw-minify", | ||
"devDependencies": { | ||
"async": "^0.9.0", | ||
"babel": "^5.1.10", | ||
"browserify": "^7.0.2", | ||
"babel": "^5.2.17", | ||
"browserify": "^10.1.3", | ||
"coveralls": "^2.11.2", | ||
"dekeywordify": "^0.2.0", | ||
"dirwatch": "^1.1.0", | ||
"eslint": "^0.19.0", | ||
"expect.js": "^0.3", | ||
"istanbul": "^0.3.5", | ||
"mocha": "^2.0.1", | ||
"uglify-js": "^2.4.15", | ||
"xhr": "^2.0.0" | ||
"dekeywordify": "^0.2.1", | ||
"eslint": "^0.21.0", | ||
"expect.js": "^0.3.1", | ||
"istanbul": "^0.3.14", | ||
"mocha": "^2.2.4", | ||
"uglify-js": "^2.4.21", | ||
"watch": "^0.16.0" | ||
}, | ||
"browser": { | ||
"request": "xhr" | ||
}, | ||
"dependencies": { | ||
"extend": "^2.0.0", | ||
"request": "^2.42.0" | ||
"extend": "^2.0.1" | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
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
156507
1
10
15
1604
2819
1
- Removedrequest@^2.42.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
Updatedextend@^2.0.1