Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pirate

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pirate - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

lib/base-adapter.js

38

lib/elasticsearch-adapter.js
// Generated by CoffeeScript 1.6.3
(function() {
var Adapter, Collection, ElasticSearchClient, defaults, merge, overload, type, _ref;
var Adapter, BaseAdapter, Collection, ElasticSearchClient, defaults, merge, overload, type, _ref,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

@@ -9,4 +11,6 @@ _ref = require("fairmont"), type = _ref.type, merge = _ref.merge;

ElasticSearchClient = require('elasticsearchclient');
ElasticSearchClient = require("elasticsearchclient");
BaseAdapter = require("./base-adapter");
defaults = {

@@ -18,3 +22,5 @@ port: 9200,

Adapter = (function() {
Adapter = (function(_super) {
__extends(Adapter, _super);
Adapter.prototype.esVersion = {

@@ -31,17 +37,12 @@ major: 0,

function Adapter(configuration) {
var options,
_this = this;
configuration = merge(defaults, configuration);
this.events = configuration.events;
options = {
host: configuration.host,
port: configuration.port,
secure: configuration.secure
};
var _this = this;
this.configuration = configuration;
this.configuration = merge(defaults, this.configuration);
Adapter.__super__.constructor.call(this, this.configuration);
this.events.safely(function() {
_this.client = new ElasticSearchClient(options);
_this.client = new ElasticSearchClient(_this.configuration);
return _this.client.createCall({
path: "",
method: "GET"
}, options).on("data", function(data) {
}, _this.configuration).on("data", function(data) {
var versionString, versionTokens;

@@ -55,4 +56,6 @@ versionString = JSON.parse(data).version.number;

};
_this.log("ElasticsearchAdapter: Connected to Elasticsearch server @ " + _this.configuration.host + ":" + _this.configuration.port + " v" + versionString);
return _this.events.emit("ready", _this);
}).on("error", function(err) {
_this.log("ElasticsearchAdapter: Error connecting to Elasticsearch server @ " + _this.configuration.host + ":" + _this.configuration.port + " - " + err);
return _this.events.emit("error", err);

@@ -71,3 +74,4 @@ }).exec();

events: _this.events,
adapter: _this
adapter: _this,
log: _this.log
});

@@ -82,3 +86,3 @@ return events.emit("success", result);

})();
})(BaseAdapter);

@@ -91,3 +95,3 @@ Collection = (function() {

function Collection(_arg) {
this.index = _arg.index, this.type = _arg.type, this.events = _arg.events, this.adapter = _arg.adapter;
this.index = _arg.index, this.type = _arg.type, this.events = _arg.events, this.adapter = _arg.adapter, this.log = _arg.log;
}

@@ -94,0 +98,0 @@

@@ -6,5 +6,6 @@ // Generated by CoffeeScript 1.6.3

Memory: require("./memory-adapter"),
ElasticSearch: require("./elasticsearch-adapter")
ElasticSearch: require("./elasticsearch-adapter"),
Redis: require("./redis-adapter")
};
}).call(this);
// Generated by CoffeeScript 1.6.3
(function() {
var Adapter, Collection, MongoDB, type;
var Adapter, BaseAdapter, Collection, type,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
type = require("fairmont").type;
MongoDB = require("mongodb");
BaseAdapter = require("./base-adapter");
Adapter = (function() {
Adapter = (function(_super) {
__extends(Adapter, _super);
Adapter.make = function(configuration) {

@@ -16,3 +20,3 @@ return new this(configuration);

this.configuration = configuration;
this.events = this.configuration.events;
Adapter.__super__.constructor.call(this, this.configuration);
this.database = {};

@@ -28,3 +32,4 @@ this.events.emit("ready", this);

events: _this.events,
adapter: _this
adapter: _this,
log: _this.log
});

@@ -39,3 +44,3 @@ return events.emit("success", _this.database[name]);

})();
})(BaseAdapter);

@@ -49,3 +54,3 @@ Collection = (function() {

var events;
events = _arg.events, this.collection = _arg.collection, this.adapter = _arg.adapter;
events = _arg.events, this.collection = _arg.collection, this.adapter = _arg.adapter, this.log = _arg.log;
this.events = events.source();

@@ -52,0 +57,0 @@ }

// Generated by CoffeeScript 1.6.3
(function() {
var Adapter, Collection, MongoDB, defaults, merge, overload, type, _ref;
var Adapter, BaseAdapter, Collection, MongoDB, defaults, merge, overload, type, _ref,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

@@ -11,2 +13,4 @@ _ref = require("fairmont"), type = _ref.type, merge = _ref.merge;

BaseAdapter = require("./base-adapter");
defaults = {

@@ -20,3 +24,5 @@ port: 27017,

Adapter = (function() {
Adapter = (function(_super) {
__extends(Adapter, _super);
Adapter.make = function(configuration) {

@@ -27,7 +33,8 @@ return new this(configuration);

function Adapter(configuration) {
var database, host, options, port,
var database, host, options, port, _ref1,
_this = this;
configuration = merge(defaults, configuration);
this.events = configuration.events;
host = configuration.host, port = configuration.port, options = configuration.options, database = configuration.database;
this.configuration = configuration;
this.configuration = merge(defaults, this.configuration);
Adapter.__super__.constructor.call(this, this.configuration);
_ref1 = this.configuration, host = _ref1.host, port = _ref1.port, options = _ref1.options, database = _ref1.database;
this.events.safely(function() {

@@ -41,4 +48,6 @@ var server;

if (error == null) {
_this.log("MongoAdapter: Connected to MongoDB server @ " + _this.host + ":" + port);
return _this.events.emit("ready", _this);
} else {
_this.log("MongoAdapter: Error connecting to MongoDB server @ " + host + ":" + port + " - " + error);
return _this.events.emit("error", error);

@@ -58,3 +67,4 @@ }

events: _this.events,
adapter: _this
adapter: _this,
log: _this.log
}));

@@ -74,3 +84,3 @@ } else {

})();
})(BaseAdapter);

@@ -83,3 +93,3 @@ Collection = (function() {

function Collection(_arg) {
this.events = _arg.events, this.collection = _arg.collection, this.adapter = _arg.adapter;
this.events = _arg.events, this.collection = _arg.collection, this.adapter = _arg.adapter, this.log = _arg.log;
}

@@ -86,0 +96,0 @@

{
"name": "pirate",
"version": "0.9.5",
"version": "0.9.6",
"description": "A simple storage interface with adapters for different storage systems",

@@ -14,2 +14,3 @@ "main": "lib/index.js",

"mutual": "0.4.x",
"redis": "~0.10.1",
"sleep": "1.1.1",

@@ -32,3 +33,5 @@ "typely": "0.0.0"

"interface",
"mongo"
"mongo",
"elasticsearch",
"redis"
],

@@ -35,0 +38,0 @@ "author": "Dan Yoder",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc