Comparing version 1.0.3 to 2.0.0
32
index.js
@@ -7,11 +7,11 @@ | ||
var defaultOptions = { | ||
hosts : [], | ||
disabled_hosts : [], | ||
username : 'root', | ||
password : 'root', | ||
port : 8086, | ||
depreciatedLogging : (process.env.NODE_ENV === undefined || 'development') ? console.log : false, | ||
failoverTimeout : 60000, | ||
requestTimeout : null, | ||
maxRetries : 2 | ||
hosts : [], | ||
disabled_hosts : [], | ||
username : 'root', | ||
password : 'root', | ||
port : 8086, | ||
depreciatedLogging : (process.env.NODE_ENV === undefined || 'development') ? console.log : false, | ||
failoverTimeout : 60000, | ||
requestTimeout : null, | ||
maxRetries : 2 | ||
}; | ||
@@ -29,3 +29,3 @@ | ||
if ( (!_.isArray(this.options.hosts) || 0 == this.options.hosts.length ) && 'string' === typeof this.options.host) | ||
if ( (!_.isArray(this.options.hosts) || 0 === this.options.hosts.length ) && 'string' === typeof this.options.host) | ||
{ | ||
@@ -47,2 +47,3 @@ this.request.addHost(this.options.host,this.options.port); | ||
return function(err, res, body) { | ||
if ('undefined' === typeof callback) return; | ||
if(err) { | ||
@@ -122,7 +123,7 @@ return callback(err); | ||
json: true | ||
}, this._parseCallback(function(err, series) { | ||
}, this._parseCallback(function(err, results) { | ||
if(err) { | ||
return callback(err, series); | ||
return callback(err, results); | ||
} | ||
return callback(err, _.map(series, function(series) { return series.name; })); | ||
return callback(err, _.map(results[0].points, function(series) { return series[1]; })); | ||
})); | ||
@@ -162,2 +163,3 @@ }; | ||
} | ||
if ('undefined' === typeof options) options = {}; | ||
@@ -184,3 +186,3 @@ var query = options.query || {}; | ||
v = v.valueOf(); | ||
query.time_precision = 'm'; | ||
query.time_precision = 'ms'; | ||
} | ||
@@ -273,3 +275,3 @@ point.push(v); | ||
{ | ||
return this.request.getHostsAvailable(); | ||
return this.request.getHostsAvailable(); | ||
}; | ||
@@ -276,0 +278,0 @@ |
{ | ||
"name": "influx", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "InfluxDB Client", | ||
@@ -26,9 +26,9 @@ "main": "index.js", | ||
"request": "2.x", | ||
"underscore": "~1.6.0" | ||
"underscore": "^1.7.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.17.1", | ||
"istanbul": "~0.2.4", | ||
"coveralls": "~2.8.0" | ||
"coveralls": "^2.11.1", | ||
"istanbul": "^0.3.2", | ||
"mocha": "^1.21.4" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # node-influx | ||
[![Bountysource](https://www.bountysource.com/badge/issue?issue_id=3370228)](https://www.bountysource.com/issues/3370228-handle-chunked-query-responses?utm_source=3370228&utm_medium=shield&utm_campaign=ISSUE_BADGE) - Reward the contributors for there efforts on upcoming tasks. | ||
[![Bountysource](https://www.bountysource.com/badge/issue?issue_id=3370228)](https://www.bountysource.com/issues/3370228-handle-chunked-query-responses?utm_source=3370228&utm_medium=shield&utm_campaign=ISSUE_BADGE) - Reward the contributors for their efforts on upcoming tasks. | ||
@@ -16,0 +16,0 @@ ## Installation |
10
test.js
@@ -37,5 +37,5 @@ var influx = require('./'); | ||
it('should create an instance without error', function () { | ||
client = influx({host : info.server.host, port: info.server.port, username: info.server.username, passwort : info.server.password, database : info.db.name}); | ||
dbClient = influx({host : info.server.host, port: info.server.port, username: info.server.username, passwort : info.server.password, database : info.db.name}); | ||
failClient = influx({host : info.server.host, port: 6543, username: info.server.username, passwort : info.server.password, database : info.db.name}); | ||
client = influx({host : info.server.host, port: info.server.port, username: info.server.username, password : info.server.password, database : info.db.name}); | ||
dbClient = influx({host : info.server.host, port: info.server.port, username: info.server.username, password : info.server.password, database : info.db.name}); | ||
failClient = influx({host : info.server.host, port: 6543, username: info.server.username, password : info.server.password, database : info.db.name}); | ||
failoverClient = influx({hosts : [ | ||
@@ -56,4 +56,4 @@ {host : '192.168.1.1'}, | ||
it('should set the default request timeout value', function () { | ||
var timeout= failoverClient.setRequestTimeout(2000); | ||
assert.equal(timeout,2000); | ||
var timeout= failoverClient.setRequestTimeout(5000); | ||
assert.equal(timeout,5000); | ||
}); | ||
@@ -60,0 +60,0 @@ }); |
Sorry, the diff of this file is not supported yet
34370
774
+ Addedunderscore@1.13.7(transitive)
- Removedunderscore@1.6.0(transitive)
Updatedunderscore@^1.7.0