Comparing version 3.7.1 to 3.8.0
'use strict'; | ||
var promisify = require('./util/promisify'); | ||
var inherits = require('util').inherits; | ||
@@ -60,6 +59,6 @@ var extend = require('extend'); | ||
var _promisify = promisify(cb); | ||
var _connection$promisify = this._connection.promisify(cb); | ||
var promise = _promisify.promise; | ||
var callback = _promisify.callback; | ||
var promise = _connection$promisify.promise; | ||
var callback = _connection$promisify.callback; | ||
@@ -80,6 +79,6 @@ var self = this; | ||
_put: function _put(path, data, update, cb) { | ||
var _promisify2 = promisify(cb); | ||
var _connection$promisify2 = this._connection.promisify(cb); | ||
var promise = _promisify2.promise; | ||
var callback = _promisify2.callback; | ||
var promise = _connection$promisify2.promise; | ||
var callback = _connection$promisify2.callback; | ||
@@ -133,6 +132,6 @@ var self = this; | ||
drop: function drop(cb) { | ||
var _promisify3 = promisify(cb); | ||
var _connection$promisify3 = this._connection.promisify(cb); | ||
var promise = _promisify3.promise; | ||
var callback = _promisify3.callback; | ||
var promise = _connection$promisify3.promise; | ||
var callback = _connection$promisify3.callback; | ||
@@ -151,6 +150,6 @@ var self = this; | ||
var _promisify4 = promisify(cb); | ||
var _connection$promisify4 = this._connection.promisify(cb); | ||
var promise = _promisify4.promise; | ||
var callback = _promisify4.callback; | ||
var promise = _connection$promisify4.promise; | ||
var callback = _connection$promisify4.callback; | ||
@@ -169,6 +168,6 @@ opts = extend({}, opts, { collection: this.name }); | ||
var _promisify5 = promisify(cb); | ||
var _connection$promisify5 = this._connection.promisify(cb); | ||
var promise = _promisify5.promise; | ||
var callback = _promisify5.callback; | ||
var promise = _connection$promisify5.promise; | ||
var callback = _connection$promisify5.callback; | ||
@@ -187,6 +186,6 @@ opts = extend({}, opts, { collection: this.name }); | ||
var _promisify6 = promisify(cb); | ||
var _connection$promisify6 = this._connection.promisify(cb); | ||
var promise = _promisify6.promise; | ||
var callback = _promisify6.callback; | ||
var promise = _connection$promisify6.promise; | ||
var callback = _connection$promisify6.callback; | ||
@@ -205,6 +204,6 @@ opts = extend({}, opts, { collection: this.name }); | ||
var _promisify7 = promisify(cb); | ||
var _connection$promisify7 = this._connection.promisify(cb); | ||
var promise = _promisify7.promise; | ||
var callback = _promisify7.callback; | ||
var promise = _connection$promisify7.promise; | ||
var callback = _connection$promisify7.callback; | ||
@@ -225,6 +224,6 @@ this._api.get('document', { | ||
var _promisify8 = promisify(cb); | ||
var _connection$promisify8 = this._connection.promisify(cb); | ||
var promise = _promisify8.promise; | ||
var callback = _promisify8.callback; | ||
var promise = _connection$promisify8.promise; | ||
var callback = _connection$promisify8.callback; | ||
@@ -247,6 +246,6 @@ this._api.request({ | ||
indexes: function indexes(cb) { | ||
var _promisify9 = promisify(cb); | ||
var _connection$promisify9 = this._connection.promisify(cb); | ||
var promise = _promisify9.promise; | ||
var callback = _promisify9.callback; | ||
var promise = _connection$promisify9.promise; | ||
var callback = _connection$promisify9.callback; | ||
@@ -259,6 +258,6 @@ this._api.get('index', { collection: this.name }, function (err, res) { | ||
index: function index(indexHandle, cb) { | ||
var _promisify10 = promisify(cb); | ||
var _connection$promisify10 = this._connection.promisify(cb); | ||
var promise = _promisify10.promise; | ||
var callback = _promisify10.callback; | ||
var promise = _connection$promisify10.promise; | ||
var callback = _connection$promisify10.callback; | ||
@@ -271,6 +270,6 @@ this._api.get('index/' + this._indexHandle(indexHandle), function (err, res) { | ||
createIndex: function createIndex(details, cb) { | ||
var _promisify11 = promisify(cb); | ||
var _connection$promisify11 = this._connection.promisify(cb); | ||
var promise = _promisify11.promise; | ||
var callback = _promisify11.callback; | ||
var promise = _connection$promisify11.promise; | ||
var callback = _connection$promisify11.callback; | ||
@@ -285,6 +284,6 @@ this._api.post('index', details, { | ||
dropIndex: function dropIndex(indexHandle, cb) { | ||
var _promisify12 = promisify(cb); | ||
var _connection$promisify12 = this._connection.promisify(cb); | ||
var promise = _promisify12.promise; | ||
var callback = _promisify12.callback; | ||
var promise = _connection$promisify12.promise; | ||
var callback = _connection$promisify12.callback; | ||
@@ -301,6 +300,6 @@ this._api['delete']('index/' + this._indexHandle(indexHandle), function (err, res) { | ||
var _promisify13 = promisify(cb); | ||
var _connection$promisify13 = this._connection.promisify(cb); | ||
var promise = _promisify13.promise; | ||
var callback = _promisify13.callback; | ||
var promise = _connection$promisify13.promise; | ||
var callback = _connection$promisify13.callback; | ||
@@ -323,6 +322,6 @@ this._api.post('index', extend({}, size, { | ||
var _promisify14 = promisify(cb); | ||
var _connection$promisify14 = this._connection.promisify(cb); | ||
var promise = _promisify14.promise; | ||
var callback = _promisify14.callback; | ||
var promise = _connection$promisify14.promise; | ||
var callback = _connection$promisify14.callback; | ||
@@ -347,6 +346,6 @@ this._api.post('index', { | ||
var _promisify15 = promisify(cb); | ||
var _connection$promisify15 = this._connection.promisify(cb); | ||
var promise = _promisify15.promise; | ||
var callback = _promisify15.callback; | ||
var promise = _connection$promisify15.promise; | ||
var callback = _connection$promisify15.callback; | ||
@@ -371,6 +370,6 @@ this._api.post('index', { | ||
var _promisify16 = promisify(cb); | ||
var _connection$promisify16 = this._connection.promisify(cb); | ||
var promise = _promisify16.promise; | ||
var callback = _promisify16.callback; | ||
var promise = _connection$promisify16.promise; | ||
var callback = _connection$promisify16.callback; | ||
@@ -394,6 +393,6 @@ this._api.post('index', extend({}, opts, { | ||
var _promisify17 = promisify(cb); | ||
var _connection$promisify17 = this._connection.promisify(cb); | ||
var promise = _promisify17.promise; | ||
var callback = _promisify17.callback; | ||
var promise = _connection$promisify17.promise; | ||
var callback = _connection$promisify17.callback; | ||
@@ -419,6 +418,6 @@ this._api.post('index', { | ||
var _promisify18 = promisify(cb); | ||
var _connection$promisify18 = this._connection.promisify(cb); | ||
var promise = _promisify18.promise; | ||
var callback = _promisify18.callback; | ||
var promise = _connection$promisify18.promise; | ||
var callback = _connection$promisify18.callback; | ||
@@ -445,6 +444,6 @@ var self = this; | ||
var _promisify19 = promisify(cb); | ||
var _connection$promisify19 = this._connection.promisify(cb); | ||
var promise = _promisify19.promise; | ||
var callback = _promisify19.callback; | ||
var promise = _connection$promisify19.promise; | ||
var callback = _connection$promisify19.callback; | ||
@@ -471,6 +470,6 @@ var self = this; | ||
var _promisify20 = promisify(cb); | ||
var _connection$promisify20 = this._connection.promisify(cb); | ||
var promise = _promisify20.promise; | ||
var callback = _promisify20.callback; | ||
var promise = _connection$promisify20.promise; | ||
var callback = _connection$promisify20.callback; | ||
@@ -498,6 +497,6 @@ var self = this; | ||
document: function document(documentHandle, cb) { | ||
var _promisify21 = promisify(cb); | ||
var _connection$promisify21 = this._connection.promisify(cb); | ||
var promise = _promisify21.promise; | ||
var callback = _promisify21.callback; | ||
var promise = _connection$promisify21.promise; | ||
var callback = _connection$promisify21.callback; | ||
@@ -510,6 +509,6 @@ this._api.get('document/' + this._documentHandle(documentHandle), function (err, res) { | ||
save: function save(data, cb) { | ||
var _promisify22 = promisify(cb); | ||
var _connection$promisify22 = this._connection.promisify(cb); | ||
var promise = _promisify22.promise; | ||
var callback = _promisify22.callback; | ||
var promise = _connection$promisify22.promise; | ||
var callback = _connection$promisify22.callback; | ||
@@ -533,6 +532,6 @@ this._api.post('document/', data, { | ||
edge: function edge(documentHandle, cb) { | ||
var _promisify23 = promisify(cb); | ||
var _connection$promisify23 = this._connection.promisify(cb); | ||
var promise = _promisify23.promise; | ||
var callback = _promisify23.callback; | ||
var promise = _connection$promisify23.promise; | ||
var callback = _connection$promisify23.callback; | ||
@@ -545,6 +544,6 @@ this._api.get('edge/' + this._documentHandle(documentHandle), function (err, res) { | ||
save: function save(data, fromId, toId, cb) { | ||
var _promisify24 = promisify(cb); | ||
var _connection$promisify24 = this._connection.promisify(cb); | ||
var promise = _promisify24.promise; | ||
var callback = _promisify24.callback; | ||
var promise = _connection$promisify24.promise; | ||
var callback = _connection$promisify24.callback; | ||
@@ -561,6 +560,6 @@ this._api.post('edge/', data, { | ||
_edges: function _edges(documentHandle, direction, cb) { | ||
var _promisify25 = promisify(cb); | ||
var _connection$promisify25 = this._connection.promisify(cb); | ||
var promise = _promisify25.promise; | ||
var callback = _promisify25.callback; | ||
var promise = _connection$promisify25.promise; | ||
var callback = _connection$promisify25.callback; | ||
@@ -590,6 +589,6 @@ this._api.get('edges/' + this.name, { | ||
var _promisify26 = promisify(cb); | ||
var _connection$promisify26 = this._connection.promisify(cb); | ||
var promise = _promisify26.promise; | ||
var callback = _promisify26.callback; | ||
var promise = _connection$promisify26.promise; | ||
var callback = _connection$promisify26.callback; | ||
@@ -596,0 +595,0 @@ this._api.post('traversal', extend({}, opts, { |
@@ -22,3 +22,4 @@ 'use strict'; | ||
} | ||
this._request = createRequest(this.config.agent, this.config.agentOptions); | ||
this._request = createRequest(this.config.url, this.config.agent, this.config.agentOptions); | ||
this.promisify = promisify(this.config.promise); | ||
} | ||
@@ -39,9 +40,9 @@ | ||
_resolveUrl: function _resolveUrl(opts) { | ||
var url = this.config.url; | ||
var url = { pathname: '' }; | ||
if (!opts.absolutePath) { | ||
url += '/_db/' + this.config.databaseName; | ||
if (opts.basePath) url += '/' + opts.basePath; | ||
url.pathname += '/_db/' + this.config.databaseName; | ||
if (opts.basePath) url.pathname += '/' + opts.basePath; | ||
} | ||
url += opts.path ? (opts.path.charAt(0) === '/' ? '' : '/') + opts.path : ''; | ||
if (opts.qs) url += '?' + (typeof opts.qs === 'string' ? opts.qs : qs.stringify(opts.qs)); | ||
url.pathname += opts.path ? (opts.path.charAt(0) === '/' ? '' : '/') + opts.path : ''; | ||
if (opts.qs) url.search = '?' + (typeof opts.qs === 'string' ? opts.qs : qs.stringify(opts.qs)); | ||
return url; | ||
@@ -53,3 +54,3 @@ }, | ||
request: function request(opts, cb) { | ||
var _promisify = promisify(cb); | ||
var _promisify = this.promisify(cb); | ||
@@ -56,0 +57,0 @@ var promise = _promisify.promise; |
'use strict'; | ||
var promisify = require('./util/promisify'); | ||
var extend = require('extend'); | ||
@@ -19,6 +18,6 @@ | ||
_drain: function _drain(cb) { | ||
var _promisify = promisify(cb); | ||
var _connection$promisify = this._connection.promisify(cb); | ||
var promise = _promisify.promise; | ||
var callback = _promisify.callback; | ||
var promise = _connection$promisify.promise; | ||
var callback = _connection$promisify.callback; | ||
@@ -44,6 +43,6 @@ var self = this; | ||
all: function all(cb) { | ||
var _promisify2 = promisify(cb); | ||
var _connection$promisify2 = this._connection.promisify(cb); | ||
var promise = _promisify2.promise; | ||
var callback = _promisify2.callback; | ||
var promise = _connection$promisify2.promise; | ||
var callback = _connection$promisify2.callback; | ||
@@ -58,6 +57,6 @@ var self = this; | ||
next: function next(cb) { | ||
var _promisify3 = promisify(cb); | ||
var _connection$promisify3 = this._connection.promisify(cb); | ||
var promise = _promisify3.promise; | ||
var callback = _promisify3.callback; | ||
var promise = _connection$promisify3.promise; | ||
var callback = _connection$promisify3.callback; | ||
@@ -83,6 +82,6 @@ var self = this; | ||
each: function each(fn, cb) { | ||
var _promisify4 = promisify(cb); | ||
var _connection$promisify4 = this._connection.promisify(cb); | ||
var promise = _promisify4.promise; | ||
var callback = _promisify4.callback; | ||
var promise = _connection$promisify4.promise; | ||
var callback = _connection$promisify4.callback; | ||
@@ -107,6 +106,6 @@ var self = this; | ||
every: function every(fn, cb) { | ||
var _promisify5 = promisify(cb); | ||
var _connection$promisify5 = this._connection.promisify(cb); | ||
var promise = _promisify5.promise; | ||
var callback = _promisify5.callback; | ||
var promise = _connection$promisify5.promise; | ||
var callback = _connection$promisify5.callback; | ||
@@ -136,6 +135,6 @@ var self = this; | ||
some: function some(fn, cb) { | ||
var _promisify6 = promisify(cb); | ||
var _connection$promisify6 = this._connection.promisify(cb); | ||
var promise = _promisify6.promise; | ||
var callback = _promisify6.callback; | ||
var promise = _connection$promisify6.promise; | ||
var callback = _connection$promisify6.callback; | ||
@@ -165,6 +164,6 @@ var self = this; | ||
map: function map(fn, cb) { | ||
var _promisify7 = promisify(cb); | ||
var _connection$promisify7 = this._connection.promisify(cb); | ||
var promise = _promisify7.promise; | ||
var callback = _promisify7.callback; | ||
var promise = _connection$promisify7.promise; | ||
var callback = _connection$promisify7.callback; | ||
@@ -199,6 +198,6 @@ var self = this, | ||
var _promisify8 = promisify(cb); | ||
var _connection$promisify8 = this._connection.promisify(cb); | ||
var promise = _promisify8.promise; | ||
var callback = _promisify8.callback; | ||
var promise = _connection$promisify8.promise; | ||
var callback = _connection$promisify8.callback; | ||
@@ -205,0 +204,0 @@ var self = this; |
'use strict'; | ||
var promisify = require('./util/promisify'); | ||
var extend = require('extend'); | ||
@@ -29,6 +28,6 @@ var Connection = require('./connection'); | ||
createCollection: function createCollection(properties, cb) { | ||
var _promisify = promisify(cb); | ||
var _connection$promisify = this._connection.promisify(cb); | ||
var promise = _promisify.promise; | ||
var callback = _promisify.callback; | ||
var promise = _connection$promisify.promise; | ||
var callback = _connection$promisify.callback; | ||
@@ -47,6 +46,6 @@ if (typeof properties === 'string') { | ||
createEdgeCollection: function createEdgeCollection(properties, cb) { | ||
var _promisify2 = promisify(cb); | ||
var _connection$promisify2 = this._connection.promisify(cb); | ||
var promise = _promisify2.promise; | ||
var callback = _promisify2.callback; | ||
var promise = _connection$promisify2.promise; | ||
var callback = _connection$promisify2.callback; | ||
@@ -68,6 +67,6 @@ if (typeof properties === 'string') { | ||
var _promisify3 = promisify(cb); | ||
var _connection$promisify3 = this._connection.promisify(cb); | ||
var promise = _promisify3.promise; | ||
var callback = _promisify3.callback; | ||
var promise = _connection$promisify3.promise; | ||
var callback = _connection$promisify3.callback; | ||
@@ -94,6 +93,6 @@ var self = this; | ||
var _promisify4 = promisify(cb); | ||
var _connection$promisify4 = this._connection.promisify(cb); | ||
var promise = _promisify4.promise; | ||
var callback = _promisify4.callback; | ||
var promise = _connection$promisify4.promise; | ||
var callback = _connection$promisify4.callback; | ||
@@ -121,6 +120,6 @@ var self = this; | ||
collections: function collections(cb) { | ||
var _promisify5 = promisify(cb); | ||
var _connection$promisify5 = this._connection.promisify(cb); | ||
var promise = _promisify5.promise; | ||
var callback = _promisify5.callback; | ||
var promise = _connection$promisify5.promise; | ||
var callback = _connection$promisify5.callback; | ||
@@ -140,6 +139,6 @@ var self = this; | ||
allCollections: function allCollections(cb) { | ||
var _promisify6 = promisify(cb); | ||
var _connection$promisify6 = this._connection.promisify(cb); | ||
var promise = _promisify6.promise; | ||
var callback = _promisify6.callback; | ||
var promise = _connection$promisify6.promise; | ||
var callback = _connection$promisify6.callback; | ||
@@ -159,6 +158,6 @@ var self = this; | ||
dropCollection: function dropCollection(collectionName, cb) { | ||
var _promisify7 = promisify(cb); | ||
var _connection$promisify7 = this._connection.promisify(cb); | ||
var promise = _promisify7.promise; | ||
var callback = _promisify7.callback; | ||
var promise = _connection$promisify7.promise; | ||
var callback = _connection$promisify7.callback; | ||
@@ -172,6 +171,6 @@ var self = this; | ||
createGraph: function createGraph(properties, cb) { | ||
var _promisify8 = promisify(cb); | ||
var _connection$promisify8 = this._connection.promisify(cb); | ||
var promise = _promisify8.promise; | ||
var callback = _promisify8.callback; | ||
var promise = _connection$promisify8.promise; | ||
var callback = _connection$promisify8.callback; | ||
@@ -190,6 +189,6 @@ var self = this; | ||
var _promisify9 = promisify(cb); | ||
var _connection$promisify9 = this._connection.promisify(cb); | ||
var promise = _promisify9.promise; | ||
var callback = _promisify9.callback; | ||
var promise = _connection$promisify9.promise; | ||
var callback = _connection$promisify9.callback; | ||
@@ -211,6 +210,6 @@ var self = this; | ||
graphs: function graphs(cb) { | ||
var _promisify10 = promisify(cb); | ||
var _connection$promisify10 = this._connection.promisify(cb); | ||
var promise = _promisify10.promise; | ||
var callback = _promisify10.callback; | ||
var promise = _connection$promisify10.promise; | ||
var callback = _connection$promisify10.callback; | ||
@@ -233,6 +232,6 @@ var self = this; | ||
var _promisify11 = promisify(cb); | ||
var _connection$promisify11 = this._connection.promisify(cb); | ||
var promise = _promisify11.promise; | ||
var callback = _promisify11.callback; | ||
var promise = _connection$promisify11.promise; | ||
var callback = _connection$promisify11.callback; | ||
@@ -248,6 +247,6 @@ this._api['delete']('graph/' + graphName, { dropCollections: dropCollections }, callback); | ||
var _promisify12 = promisify(cb); | ||
var _connection$promisify12 = this._connection.promisify(cb); | ||
var promise = _promisify12.promise; | ||
var callback = _promisify12.callback; | ||
var promise = _connection$promisify12.promise; | ||
var callback = _connection$promisify12.callback; | ||
@@ -271,6 +270,6 @@ var self = this; | ||
var _promisify13 = promisify(cb); | ||
var _connection$promisify13 = this._connection.promisify(cb); | ||
var promise = _promisify13.promise; | ||
var callback = _promisify13.callback; | ||
var promise = _connection$promisify13.promise; | ||
var callback = _connection$promisify13.callback; | ||
@@ -298,6 +297,6 @@ var self = this; | ||
databases: function databases(cb) { | ||
var _promisify14 = promisify(cb); | ||
var _connection$promisify14 = this._connection.promisify(cb); | ||
var promise = _promisify14.promise; | ||
var callback = _promisify14.callback; | ||
var promise = _connection$promisify14.promise; | ||
var callback = _connection$promisify14.callback; | ||
@@ -315,6 +314,6 @@ var self = this; | ||
dropDatabase: function dropDatabase(databaseName, cb) { | ||
var _promisify15 = promisify(cb); | ||
var _connection$promisify15 = this._connection.promisify(cb); | ||
var promise = _promisify15.promise; | ||
var callback = _promisify15.callback; | ||
var promise = _connection$promisify15.promise; | ||
var callback = _connection$promisify15.callback; | ||
@@ -328,6 +327,6 @@ var self = this; | ||
truncate: function truncate(cb) { | ||
var _promisify16 = promisify(cb); | ||
var _connection$promisify16 = this._connection.promisify(cb); | ||
var promise = _promisify16.promise; | ||
var callback = _promisify16.callback; | ||
var promise = _connection$promisify16.promise; | ||
var callback = _connection$promisify16.callback; | ||
@@ -351,6 +350,6 @@ var self = this; | ||
truncateAll: function truncateAll(cb) { | ||
var _promisify17 = promisify(cb); | ||
var _connection$promisify17 = this._connection.promisify(cb); | ||
var promise = _promisify17.promise; | ||
var callback = _promisify17.callback; | ||
var promise = _connection$promisify17.promise; | ||
var callback = _connection$promisify17.callback; | ||
@@ -390,6 +389,6 @@ var self = this; | ||
var _promisify18 = promisify(cb); | ||
var _connection$promisify18 = this._connection.promisify(cb); | ||
var promise = _promisify18.promise; | ||
var callback = _promisify18.callback; | ||
var promise = _connection$promisify18.promise; | ||
var callback = _connection$promisify18.callback; | ||
@@ -412,6 +411,6 @@ this._api.post('transaction', { | ||
var _promisify19 = promisify(cb); | ||
var _connection$promisify19 = this._connection.promisify(cb); | ||
var promise = _promisify19.promise; | ||
var callback = _promisify19.callback; | ||
var promise = _connection$promisify19.promise; | ||
var callback = _connection$promisify19.callback; | ||
@@ -431,6 +430,6 @@ if (_query && typeof _query.toAQL === 'function') { | ||
functions: function functions(cb) { | ||
var _promisify20 = promisify(cb); | ||
var _connection$promisify20 = this._connection.promisify(cb); | ||
var promise = _promisify20.promise; | ||
var callback = _promisify20.callback; | ||
var promise = _connection$promisify20.promise; | ||
var callback = _connection$promisify20.callback; | ||
@@ -443,6 +442,6 @@ this._api.get('aqlfunction', function (err, res) { | ||
createFunction: function createFunction(name, code, cb) { | ||
var _promisify21 = promisify(cb); | ||
var _connection$promisify21 = this._connection.promisify(cb); | ||
var promise = _promisify21.promise; | ||
var callback = _promisify21.callback; | ||
var promise = _connection$promisify21.promise; | ||
var callback = _connection$promisify21.callback; | ||
@@ -463,6 +462,6 @@ this._api.post('aqlfunction', { | ||
var _promisify22 = promisify(cb); | ||
var _connection$promisify22 = this._connection.promisify(cb); | ||
var promise = _promisify22.promise; | ||
var callback = _promisify22.callback; | ||
var promise = _connection$promisify22.promise; | ||
var callback = _connection$promisify22.callback; | ||
@@ -469,0 +468,0 @@ this._api['delete']('aqlfunction/' + name, { |
'use strict'; | ||
var promisify = require('./util/promisify'); | ||
var extend = require('extend'); | ||
@@ -26,6 +25,6 @@ var inherits = require('util').inherits; | ||
var _promisify = promisify(cb); | ||
var _connection$promisify = this._connection.promisify(cb); | ||
var promise = _promisify.promise; | ||
var callback = _promisify.callback; | ||
var promise = _connection$promisify.promise; | ||
var callback = _connection$promisify.callback; | ||
@@ -40,6 +39,6 @@ this._gharial['delete']({ | ||
vertexCollection: function vertexCollection(collectionName, cb) { | ||
var _promisify2 = promisify(cb); | ||
var _connection$promisify2 = this._connection.promisify(cb); | ||
var promise = _promisify2.promise; | ||
var callback = _promisify2.callback; | ||
var promise = _connection$promisify2.promise; | ||
var callback = _connection$promisify2.callback; | ||
@@ -53,6 +52,6 @@ var self = this; | ||
addVertexCollection: function addVertexCollection(collectionName, cb) { | ||
var _promisify3 = promisify(cb); | ||
var _connection$promisify3 = this._connection.promisify(cb); | ||
var promise = _promisify3.promise; | ||
var callback = _promisify3.callback; | ||
var promise = _connection$promisify3.promise; | ||
var callback = _connection$promisify3.callback; | ||
@@ -70,6 +69,6 @@ this._gharial.post('vertex', { collection: collectionName }, function (err, res) { | ||
var _promisify4 = promisify(cb); | ||
var _connection$promisify4 = this._connection.promisify(cb); | ||
var promise = _promisify4.promise; | ||
var callback = _promisify4.callback; | ||
var promise = _connection$promisify4.promise; | ||
var callback = _connection$promisify4.callback; | ||
@@ -82,6 +81,6 @@ this._gharial['delete']('vertex/' + collectionName, { dropCollection: dropCollection }, function (err, res) { | ||
edgeCollection: function edgeCollection(collectionName, cb) { | ||
var _promisify5 = promisify(cb); | ||
var _connection$promisify5 = this._connection.promisify(cb); | ||
var promise = _promisify5.promise; | ||
var callback = _promisify5.callback; | ||
var promise = _connection$promisify5.promise; | ||
var callback = _connection$promisify5.callback; | ||
@@ -95,6 +94,6 @@ var self = this; | ||
addEdgeDefinition: function addEdgeDefinition(definition, cb) { | ||
var _promisify6 = promisify(cb); | ||
var _connection$promisify6 = this._connection.promisify(cb); | ||
var promise = _promisify6.promise; | ||
var callback = _promisify6.callback; | ||
var promise = _connection$promisify6.promise; | ||
var callback = _connection$promisify6.callback; | ||
@@ -107,6 +106,6 @@ this._gharial.post('edge', definition, function (err, res) { | ||
replaceEdgeDefinition: function replaceEdgeDefinition(definitionName, definition, cb) { | ||
var _promisify7 = promisify(cb); | ||
var _connection$promisify7 = this._connection.promisify(cb); | ||
var promise = _promisify7.promise; | ||
var callback = _promisify7.callback; | ||
var promise = _connection$promisify7.promise; | ||
var callback = _connection$promisify7.callback; | ||
@@ -124,6 +123,6 @@ this._api.put('gharial/' + this.name + '/edge/' + definitionName, definition, function (err, res) { | ||
var _promisify8 = promisify(cb); | ||
var _connection$promisify8 = this._connection.promisify(cb); | ||
var promise = _promisify8.promise; | ||
var callback = _promisify8.callback; | ||
var promise = _connection$promisify8.promise; | ||
var callback = _connection$promisify8.callback; | ||
@@ -141,6 +140,6 @@ this._gharial['delete']('edge/' + definitionName, { dropCollection: dropCollection }, function (err, res) { | ||
var _promisify9 = promisify(cb); | ||
var _connection$promisify9 = this._connection.promisify(cb); | ||
var promise = _promisify9.promise; | ||
var callback = _promisify9.callback; | ||
var promise = _connection$promisify9.promise; | ||
var callback = _connection$promisify9.callback; | ||
@@ -166,6 +165,6 @@ this._api.post('traversal', extend({}, opts, { | ||
vertex: function vertex(documentHandle, cb) { | ||
var _promisify10 = promisify(cb); | ||
var _connection$promisify10 = this._connection.promisify(cb); | ||
var promise = _promisify10.promise; | ||
var callback = _promisify10.callback; | ||
var promise = _connection$promisify10.promise; | ||
var callback = _connection$promisify10.callback; | ||
@@ -178,6 +177,6 @@ this._gharial.get(documentHandle, function (err, res) { | ||
save: function save(data, cb) { | ||
var _promisify11 = promisify(cb); | ||
var _connection$promisify11 = this._connection.promisify(cb); | ||
var promise = _promisify11.promise; | ||
var callback = _promisify11.callback; | ||
var promise = _connection$promisify11.promise; | ||
var callback = _connection$promisify11.callback; | ||
@@ -202,6 +201,6 @@ this._gharial.post(data, { | ||
edge: function edge(documentHandle, cb) { | ||
var _promisify12 = promisify(cb); | ||
var _connection$promisify12 = this._connection.promisify(cb); | ||
var promise = _promisify12.promise; | ||
var callback = _promisify12.callback; | ||
var promise = _connection$promisify12.promise; | ||
var callback = _connection$promisify12.callback; | ||
@@ -222,6 +221,6 @@ this._gharial.get(documentHandle, function (err, res) { | ||
var _promisify13 = promisify(cb); | ||
var _connection$promisify13 = this._connection.promisify(cb); | ||
var promise = _promisify13.promise; | ||
var callback = _promisify13.callback; | ||
var promise = _connection$promisify13.promise; | ||
var callback = _connection$promisify13.callback; | ||
@@ -228,0 +227,0 @@ this._gharial.post(data, function (err, res) { |
'use strict'; | ||
module.exports = function promisify(callback) { | ||
if (typeof Promise !== 'function') { | ||
return { callback: callback || function () {} }; | ||
} | ||
var cb = callback; | ||
var promise = new Promise(function (resolve, reject) { | ||
callback = function (err, res) { | ||
if (err) reject(err);else resolve(res); | ||
module.exports = function (PromiseCtor) { | ||
if (PromiseCtor === false) { | ||
return function (callback) { | ||
return { callback: callback || function () {} }; | ||
}; | ||
}); | ||
if (cb) { | ||
promise.then(function (result) { | ||
return cb(null, result); | ||
}, function (reason) { | ||
return cb(reason); | ||
}); | ||
} | ||
return { callback: callback, promise: promise }; | ||
return function (callback) { | ||
if (!PromiseCtor && typeof Promise !== 'function') { | ||
return { callback: callback || function () {} }; | ||
} | ||
function defer(resolve, reject) { | ||
callback = function (err, res) { | ||
if (err) reject(err);else resolve(res); | ||
}; | ||
} | ||
var cb = callback; | ||
var promise = PromiseCtor ? new PromiseCtor(defer) : new Promise(defer); | ||
if (cb) { | ||
promise.then(function (result) { | ||
return cb(null, result); | ||
}, function (reason) { | ||
return cb(reason); | ||
}); | ||
} | ||
return { callback: callback, promise: promise }; | ||
}; | ||
}; |
'use strict'; | ||
var http = require('http'); | ||
var parseUrl = require('url').parse; | ||
var extend = require('extend'); | ||
var once = require('./once'); | ||
var joinPath = require('path').join; | ||
var LinkedList = require('linkedlist'); | ||
module.exports = function (agent, agentOptions) { | ||
function rawCopy(obj) { | ||
var data = {}; | ||
for (var k in obj) { | ||
if (obj.hasOwnProperty(k)) { | ||
data[k] = obj[k]; | ||
} | ||
} | ||
return data; | ||
} | ||
module.exports = function (baseUrl, agent, agentOptions) { | ||
if (!agent && http.Agent) agent = new http.Agent(agentOptions); // server only | ||
var queue = new LinkedList(); | ||
var maxTasks = typeof agent.maxSockets === 'number' ? agent.maxSockets * 2 : Infinity; | ||
var activeTasks = 0; | ||
var baseUrlParts = rawCopy(parseUrl(baseUrl)); | ||
function drainQueue() { | ||
if (!queue.length || activeTasks >= maxTasks) return; | ||
var task = queue.shift(); | ||
activeTasks += 1; | ||
task(function () { | ||
activeTasks -= 1; | ||
drainQueue(); | ||
}); | ||
} | ||
return function request(_ref, cb) { | ||
@@ -15,20 +42,34 @@ var method = _ref.method; | ||
var options = extend(parseUrl(url), { method: method, headers: headers, agent: agent }); | ||
var callback = once(cb); | ||
var req = http.request(options, function (res) { | ||
var data = []; | ||
res.on('data', function (b) { | ||
data.push(b); | ||
}).on('end', function () { | ||
res.body = data.join(''); | ||
callback(null, res); | ||
var path = baseUrlParts.pathname ? url.pathname ? joinPath(baseUrlParts.pathname, url.pathname) : baseUrlParts.pathname : url.pathname; | ||
var search = url.search ? baseUrlParts.search ? baseUrlParts.search + '&' + url.search.slice(1) : url.search : baseUrlParts.search; | ||
if (search) path += search; | ||
var options = { path: path, method: method, headers: headers, agent: agent }; | ||
options.hostname = baseUrlParts.hostname; | ||
options.port = baseUrlParts.port; | ||
options.auth = baseUrlParts.auth; | ||
queue.push(function (next) { | ||
var callback = once(function () { | ||
next(); | ||
cb.apply(this, arguments); | ||
}); | ||
var req = http.request(options, function (res) { | ||
var data = []; | ||
res.on('data', function (b) { | ||
data.push(b); | ||
}).on('end', function () { | ||
res.body = data.join(''); | ||
callback(null, res); | ||
}); | ||
}); | ||
req.on('error', function (err) { | ||
err.request = req; | ||
callback(err); | ||
}); | ||
if (body) req.write(body); | ||
req.end(); | ||
}); | ||
req.on('error', function (err) { | ||
err.request = req; | ||
callback(err); | ||
}); | ||
if (body) req.write(body); | ||
req.end(); | ||
drainQueue(); | ||
}; | ||
}; |
{ | ||
"name": "arangojs", | ||
"version": "3.7.1", | ||
"version": "3.8.0", | ||
"description": "The official ArangoDB JavaScript driver.", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"test-only": "mocha -t 30000 --growl -R spec", | ||
"cover": "npm run lint && istanbul cover --report lcov _mocha -- -t 30000 -R spec", | ||
"cover": "npm run lint && npm run babel && istanbul cover --report lcov _mocha -- -t 30000 -R spec", | ||
"coveralls": "npm run cover && cat ./coverage/lcov.info | coveralls ; rm -rf ./coverage", | ||
@@ -53,2 +53,3 @@ "watch": "watch 'npm run test-only && npm run lint && npm run dist' ./lib ./test", | ||
"devDependencies": { | ||
"async": "^0.9.2", | ||
"babel": "^5.2.17", | ||
@@ -66,4 +67,5 @@ "browserify": "^10.1.3", | ||
"dependencies": { | ||
"extend": "^2.0.1" | ||
"extend": "^2.0.1", | ||
"linkedlist": "^1.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
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
161780
1649
2820
2
11
+ Addedlinkedlist@^1.0.1
+ Addedlinkedlist@1.0.1(transitive)