Comparing version 0.9.3 to 0.9.5
@@ -18,2 +18,8 @@ // Generated by CoffeeScript 1.6.3 | ||
Adapter = (function() { | ||
Adapter.prototype.esVersion = { | ||
major: 0, | ||
minor: 0, | ||
patch: 0 | ||
}; | ||
Adapter.make = function(configuration) { | ||
@@ -35,3 +41,18 @@ return new this(configuration); | ||
_this.client = new ElasticSearchClient(options); | ||
return _this.events.emit("ready", _this); | ||
return _this.client.createCall({ | ||
path: "", | ||
method: "GET" | ||
}, options).on("data", function(data) { | ||
var versionString, versionTokens; | ||
versionString = JSON.parse(data).version.number; | ||
versionTokens = versionString.split("."); | ||
_this.esVersion = { | ||
major: parseInt(versionTokens[0]), | ||
minor: parseInt(versionTokens[1]), | ||
patch: parseInt(versionTokens[2]) | ||
}; | ||
return _this.events.emit("ready", _this); | ||
}).on("error", function(err) { | ||
return _this.events.emit("error", err); | ||
}).exec(); | ||
}); | ||
@@ -74,7 +95,20 @@ } | ||
return events.safely(function() { | ||
return _this.adapter.client.count(_this.index, _this.type, { | ||
terms: { | ||
_id: keys | ||
} | ||
}).on("data", function(data) { | ||
var countQueryJSON; | ||
countQueryJSON = null; | ||
if (_this.adapter.esVersion.major >= 1 && _this.adapter.esVersion.minor >= 0 && _this.adapter.esVersion.patch >= 1) { | ||
countQueryJSON = { | ||
query: { | ||
terms: { | ||
_id: keys | ||
} | ||
} | ||
}; | ||
} else { | ||
countQueryJSON = { | ||
terms: { | ||
_id: keys | ||
} | ||
}; | ||
} | ||
return _this.adapter.client.count(_this.index, _this.type, countQueryJSON).on("data", function(data) { | ||
var findEvents, jsonData; | ||
@@ -297,5 +331,16 @@ jsonData = JSON.parse(data); | ||
return this.events.source(function(events) { | ||
return _this.adapter.client.count(_this.index, _this.type, { | ||
match_all: {} | ||
}).on("data", function(data) { | ||
var countQueryJSON; | ||
countQueryJSON = null; | ||
if (_this.adapter.esVersion.major >= 1 && _this.adapter.esVersion.minor >= 0 && _this.adapter.esVersion.patch >= 1) { | ||
countQueryJSON = { | ||
query: { | ||
match_all: {} | ||
} | ||
}; | ||
} else { | ||
countQueryJSON = { | ||
match_all: {} | ||
}; | ||
} | ||
return _this.adapter.client.count(_this.index, _this.type, countQueryJSON).on("data", function(data) { | ||
var jsonData; | ||
@@ -302,0 +347,0 @@ jsonData = JSON.parse(data); |
{ | ||
"name": "pirate", | ||
"version": "0.9.3", | ||
"version": "0.9.5", | ||
"description": "A simple storage interface with adapters for different storage systems", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25248
644
0