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

puffer

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puffer - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

.groc.json

71

build/main.js
(function() {
var Boom, CB, Couchbase, Database;
var Boom, CB, Couchbase, Database, Q, errorHandler;

@@ -8,7 +8,9 @@ CB = require('couchbase');

Couchbase = (function() {
Couchbase.bucket = null;
Q = require('q');
Couchbase.couchbase = null;
errorHandler = function(ex) {
return Boom.serverTimeout(ex.message);
};
Couchbase = (function() {
function Couchbase(options) {

@@ -19,45 +21,44 @@ var cluster, host;

this.bucket = cluster.openBucket(options.name);
this.couchbase = CB;
}
Couchbase.prototype._execute = function(method) {
var args, callback, ex;
try {
args = Array.prototype.slice.call(arguments).slice(1);
callback = args[args.length - 1];
args[args.length - 1] = function(err, data) {
if (err) {
return callback(Boom.badRequest(err));
} else {
return callback(data);
}
};
return this.bucket[method].apply(this.bucket, args);
} catch (_error) {
ex = _error;
console.log("[database] '" + method + "' function caused this error.");
console.trace(ex);
return callback(Boom.serverTimeout(ex.message));
}
Couchbase.prototype._exec = function(name) {
return Q.npost(this.bucket, name, Array.prototype.slice.call(arguments, 1)).fail(errorHandler);
};
Couchbase.prototype.get = function(id, callback) {
if (typeof id === 'string') {
return this._execute('get', id, callback);
Couchbase.prototype.create = function(id, doc) {
return this._exec("insert", id, doc);
};
Couchbase.prototype.get = function(id) {
if (id.constructor === Array) {
return this._exec("getMulti", id);
} else {
return this._execute('getMulti', id, callback);
return this._exec("get", id);
}
};
Couchbase.prototype.list = function(design, view, callback) {
var query, viewQuery;
viewQuery = CB.ViewQuery;
query = viewQuery.from(design, view);
return this._execute('query', query, callback);
Couchbase.prototype.replace = function(id, doc) {
return this._exec("replace", id, doc);
};
Couchbase.prototype.create = function(id, doc, callback) {
return this._execute('insert', id, doc, callback);
Couchbase.prototype.upsert = function(id, doc) {
return this._exec("upsert", id, doc);
};
Couchbase.prototype.remove = function(id) {
return this._exec("remove", id);
};
Couchbase.prototype.counter = function(id, step) {
return this._exec("counter", id, step);
};
Couchbase.prototype.from = function(design, view) {
return CB.ViewQuery.from(design, view);
};
Couchbase.prototype.commit = function(query) {
return this._exec("query", query);
};
return Couchbase;

@@ -64,0 +65,0 @@

{
"name": "puffer",
"description": "Extendable Couchbase ODM for Hapi js",
"version": "0.1.9",
"version": "0.2.0",
"main": "build/main",

@@ -25,5 +25,7 @@ "dependencies": {

"coffee-script": "^1.8.0",
"groc": "^0.8.0",
"gulp": "^3.8.10",
"gulp-coffee": "^2.2.0",
"mocha": "^2.0.1"
"mocha": "^2.0.1",
"node-uuid": "^1.4.2"
},

@@ -30,0 +32,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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