Comparing version 4.0.1 to 4.1.0
17
index.js
@@ -52,3 +52,3 @@ var InfluxRequest = require('./lib/InfluxRequest.js') | ||
}) | ||
tmp = _.chain(tmp).concat(rows).sort('time').value() | ||
tmp = _.chain(tmp).concat(rows).value() | ||
}) | ||
@@ -68,3 +68,3 @@ } | ||
if (res.statusCode < 200 || res.statusCode >= 300) { | ||
return callback(new Error(body)) | ||
return callback(new Error(body.error || body)) | ||
} | ||
@@ -79,2 +79,5 @@ | ||
} | ||
if (body === undefined) { | ||
return callback(new Error('body is undefined')) | ||
} | ||
return callback(null, body.results) | ||
@@ -261,3 +264,7 @@ } | ||
return _.map(object, function (value, key) { | ||
return key + '=' + value | ||
if (typeof value === 'string') { | ||
return key + '=' + value.replace(/ /g, '\\ ').replace(/,/g, '\\,') | ||
} else { | ||
return key + '=' + value | ||
} | ||
}).join(',') | ||
@@ -376,3 +383,3 @@ } | ||
var query = 'CREATE CONTINUOUS QUERY ' + queryName + ' ON ' + databaseName + ' BEGIN ' + | ||
var query = 'CREATE CONTINUOUS QUERY ' + queryName + ' ON "' + databaseName + '" BEGIN ' + | ||
queryString + | ||
@@ -412,3 +419,3 @@ ' END' | ||
InfluxDB.prototype.getRetentionPolicies = function (databaseName, callback) { | ||
this.queryDB('show retention policies "' + databaseName + '"', callback) | ||
this.queryDB('show retention policies on "' + databaseName + '"', callback) | ||
} | ||
@@ -415,0 +422,0 @@ |
@@ -50,2 +50,6 @@ var request = require('request') | ||
InfluxRequest.prototype.hostIsAvailable = function () { | ||
return !!this.hostsAvailable[this.index] | ||
} | ||
InfluxRequest.prototype.getHost = function () { | ||
@@ -115,3 +119,3 @@ var host = this.hostsAvailable[this.index] | ||
this.disableHost(requestOptions.host) | ||
if (this.options.maxRetries >= requestOptions.retries) { | ||
if (this.options.maxRetries >= requestOptions.retries && this.hostIsAvailable()) { | ||
return this._request(requestOptions, callback) | ||
@@ -118,0 +122,0 @@ } |
{ | ||
"name": "influx", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "InfluxDB Client", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha -R dot", | ||
"travis-test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec && standard" | ||
"lint": "standard", | ||
"test": "./node_modules/.bin/mocha -R spec", | ||
"travis-test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec && npm run lint" | ||
}, | ||
@@ -10,0 +11,0 @@ "repository": { |
@@ -5,13 +5,15 @@ # node-influx | ||
[![npm](http://img.shields.io/npm/v/influx.svg)](https://www.npmjs.org/package/influx) | ||
[![build](http://img.shields.io/travis/node-influx/node-influx/master.svg)](https://travis-ci.org/node-influx/node-influx) | ||
[![coverage](http://img.shields.io/coveralls/bencevans/node-influx/master.svg)](https://coveralls.io/r/node-influx/node-influx?branch=master) | ||
[![code climate](http://img.shields.io/codeclimate/github/bencevans/node-influx.svg)](https://codeclimate.com/github/node-influx/node-influx) | ||
[![Dependency Status](https://david-dm.org/node-influx/node-influx.png)](https://david-dm.org/node-influx/node-influx) | ||
[![Github Releases](https://img.shields.io/npm/dm/influx.svg)](https://github.com/node-influx/node-influx) | ||
[![npm](http://img.shields.io/npm/v/influx.svg?style=flat-square)](https://www.npmjs.org/package/influx) | ||
[![build](http://img.shields.io/travis/node-influx/node-influx/master.svg?style=flat-square)](https://travis-ci.org/node-influx/node-influx) | ||
[![coverage](http://img.shields.io/coveralls/node-influx/node-influx/master.svg?style=flat-square)](https://coveralls.io/r/node-influx/node-influx?branch=master) | ||
[![code climate](http://img.shields.io/codeclimate/github/node-influx/node-influx.svg?style=flat-square)](https://codeclimate.com/github/node-influx/node-influx) | ||
[![Dependency Status](https://img.shields.io/david/node-influx/node-influx.svg?style=flat-square)](https://david-dm.org/node-influx/node-influx) | ||
[![Github Releases](https://img.shields.io/npm/dm/influx.svg?style=flat-square)](https://github.com/node-influx/node-influx) | ||
[![Bountysource](https://img.shields.io/bountysource/team/node-influx/activity.svg)](https://www.bountysource.com/teams/node-influx) - Reward the contributors for their efforts on upcoming tasks. | ||
[![Bountysource](https://img.shields.io/bountysource/team/node-influx/activity.svg?style=flat-square)](https://www.bountysource.com/teams/node-influx) - Reward the contributors for their efforts on upcoming tasks. | ||
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
Interested in becoming a maintainer? Please help out with issues and pull-requests and open an [issue introducing yourself](https://github.com/node-influx/node-influx/issues/new)! After we've seen you're involved with the project, we'll add you up :+1: | ||
## Installation | ||
@@ -23,5 +25,5 @@ | ||
Version 3.x.x is compatible with InfluxDB 0.8.x | ||
Version 4.x.x is compatible with InfluxDB 0.9.x | ||
Version 4.x.x is compatible with InfluxDB 0.9.x | ||
Version 3.x.x is compatible with InfluxDB 0.8.x - 3.x will no longer have updates by core contributers, please consider upgrading. | ||
@@ -396,3 +398,3 @@ | ||
```js | ||
client.createRetentionPolicy('my_ret_pol_name', 'my_database, '1d', 1, true, function (err,resonse) {}) | ||
client.createRetentionPolicy('my_ret_pol_name', 'my_database', '1d', 1, true, function (err,resonse) {}) | ||
``` | ||
@@ -399,0 +401,0 @@ |
21
test.js
@@ -81,2 +81,9 @@ /* eslint-env mocha */ | ||
describe('#_createKeyTagString', function () { | ||
it('should build a properly formatted string', function () { | ||
var str = client._createKeyTagString({tag_1: 'value', tag2: 'value value', tag3: 'value,value'}) | ||
assert.equal(str, 'tag_1=value,tag2=value\\ value,tag3=value\\,value') | ||
}) | ||
}) | ||
describe('#_createKeyValueString', function () { | ||
@@ -473,8 +480,3 @@ it('should build a properly formatted string', function () { | ||
}) | ||
it('should bubble errors through', function (done) { | ||
client.getSeries(info.db.name, function (err) { | ||
assert(err instanceof Error) | ||
done() | ||
}) | ||
}) | ||
it('should bubble errors through') | ||
}) | ||
@@ -499,8 +501,3 @@ | ||
}) | ||
it('should bubble errors through', function (done) { | ||
client.getSeriesNames(info.db.name, function (err) { | ||
assert(err instanceof Error) | ||
done() | ||
}) | ||
}) | ||
it('should bubble errors through') | ||
}) | ||
@@ -507,0 +504,0 @@ |
Sorry, the diff of this file is not supported yet
54666
1110
436