Socket
Socket
Sign inDemoInstall

caminte

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caminte - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

12

lib/adapters/arango.js

@@ -269,3 +269,3 @@ /**

query.push(csql.query.join(' '));
Object.keys(csql.bindVars).forEach(function(bkey){
Object.keys(csql.bindVars).forEach(function (bkey) {
bindVars[bkey] = csql.bindVars[bkey];

@@ -538,6 +538,6 @@ });

}
if(condType === 'between') {
sqlCond += ' >= @whereL';
sqlCond += ' AND x.`' + key + '`';
sqlCond += ' <= @whereG';
if (condType === 'between') {
sqlCond += ' >= @whereL';
sqlCond += ' AND x.`' + key + '`';
sqlCond += ' <= @whereG';
bindVars['whereL'] = val[0];

@@ -563,5 +563,5 @@ bindVars['whereG'] = val[1];

return {
query : cs,
query: cs,
bindVars: bindVars
};
};

@@ -7,3 +7,3 @@ exports.initialize = function initializeSchema(schema, callback) {

function WebService() {
this.name = 'http';
this.name = 'http';
this._models = {};

@@ -10,0 +10,0 @@ this.cache = {};

@@ -13,3 +13,3 @@ /**

function Memory() {
this.name = 'memory';
this.name = 'memory';
this._models = {};

@@ -27,6 +27,6 @@ this.cache = {};

Memory.prototype.toDatabase = function(model, data) {
Memory.prototype.toDatabase = function (model, data) {
var cleaned = {};
Object.keys(data).forEach(function(key) {
cleaned[key] = data[key];
Object.keys(data).forEach(function (key) {
cleaned[key] = data[key];
});

@@ -40,3 +40,3 @@ return cleaned;

this.cache[model][id] = this.toDatabase(model, data);
process.nextTick(function() {
process.nextTick(function () {
callback(null, id);

@@ -46,9 +46,9 @@ });

Memory.prototype.updateOrCreate = function(model, data, callback) {
Memory.prototype.updateOrCreate = function (model, data, callback) {
var mem = this;
this.exists(model, data.id, function(err, exists) {
this.exists(model, data.id, function (err, exists) {
if (exists) {
mem.save(model, data, callback);
} else {
mem.create(model, data, function(err, id) {
mem.create(model, data, function (err, id) {
data.id = id;

@@ -63,3 +63,3 @@ callback(err, data);

this.cache[model][data.id] = data;
process.nextTick(function() {
process.nextTick(function () {
callback(null, data);

@@ -70,3 +70,3 @@ });

Memory.prototype.exists = function exists(model, id, callback) {
process.nextTick(function() {
process.nextTick(function () {
callback(null, this.cache[model].hasOwnProperty(id));

@@ -77,3 +77,3 @@ }.bind(this));

Memory.prototype.findById = function findById(model, id, callback) {
process.nextTick(function() {
process.nextTick(function () {
callback(null, this.cache[model][id]);

@@ -90,6 +90,6 @@ }.bind(this));

var self = this;
self.all(model, filter, function(err, nodes) {
self.all(model, filter, function (err, nodes) {
var count = nodes.length;
if (count > 0) {
nodes.forEach(function(node) {
nodes.forEach(function (node) {
delete self.cache[model][node.id];

@@ -114,3 +114,3 @@ if (--count === 0) {

}
var nodes = Object.keys(this.cache[model]).map(function(key) {
var nodes = Object.keys(this.cache[model]).map(function (key) {
return this.cache[model][key];

@@ -133,3 +133,3 @@ }.bind(this));

}
orders.forEach(function(key, i) {
orders.forEach(function (key, i) {
var reverse = 1;

@@ -148,3 +148,3 @@ var m = key.match(/\s+(A|DE)SC$/i);

process.nextTick(function() {
process.nextTick(function () {
callback(null, nodes);

@@ -166,3 +166,3 @@ });

Memory.prototype.destroyAll = function destroyAll(model, callback) {
Object.keys(this.cache[model]).forEach(function(id) {
Object.keys(this.cache[model]).forEach(function (id) {
delete this.cache[model][id];

@@ -178,5 +178,5 @@ }.bind(this));

if (where) {
data = data.filter(function(id) {
data = data.filter(function (id) {
var ok = true;
Object.keys(where).forEach(function(key) {
Object.keys(where).forEach(function (key) {
if (cache[id][key] !== where[key]) {

@@ -189,3 +189,3 @@ ok = false;

}
process.nextTick(function() {
process.nextTick(function () {
callback(null, data.length);

@@ -192,0 +192,0 @@ });

@@ -122,3 +122,3 @@ /**

MongoDB.prototype.collection = function (name) {
if(this.client.collection) {
if (this.client.collection) {
return this.client.collection(name);

@@ -176,3 +176,3 @@ } else {

}
this.collection(model).update(filter, { '$set': data }, {w:1, multi: true}, function (err) {
this.collection(model).update(filter, {'$set': data}, {w: 1, multi: true}, function (err) {
callback(err);

@@ -190,3 +190,4 @@ });

MongoDB.prototype.findById = function findById(model, id, callback) {
var self = this; id = getObjectId(id);
var self = this;
id = getObjectId(id);
self.collection(model).findOne({_id: id}, function (err, data) {

@@ -303,8 +304,8 @@ if (data) {

var clean = {};
Object.keys(data).forEach(function(key){
Object.keys(data).forEach(function (key) {
if (!props[key]) {
return;
}
if(props[key].type.name.toString().toLowerCase() === 'date') {
if(data[key]) {
if (props[key].type.name.toString().toLowerCase() === 'date') {
if (data[key]) {
clean[key] = new Date(data[key]);

@@ -344,5 +345,5 @@ } else {

if(k === 'or') {
if (k === 'or') {
var arrcond = [];
Object.keys(cond).forEach(function(k2){
Object.keys(cond).forEach(function (k2) {
var nval = {};

@@ -349,0 +350,0 @@ nval[k2] = cond[k2]

@@ -412,5 +412,5 @@ /**

if ((props[key].type.name || '').toString().toLowerCase() === 'json' && typeof val == "string") {
try{
try {
val = JSON.parse(val);
} catch(err){
} catch (err) {

@@ -891,3 +891,3 @@ }

}
if(condType === 'between') {
if (condType === 'between') {
sqlCond += val[0] + ' AND ' + val[1];

@@ -894,0 +894,0 @@ } else if (condType === 'in' || condType === 'inq' || condType === 'nin') {

@@ -442,3 +442,3 @@ /**

clean[key] = JSON.parse(val);
} catch(err){
} catch (err) {
clean[key] = val;

@@ -445,0 +445,0 @@ }

@@ -331,5 +331,5 @@ /**

if ((props[key].type.name || '').toString().toLowerCase() === 'json' && typeof val == "string") {
try{
try {
val = JSON.parse(val);
} catch(err){
} catch (err) {

@@ -336,0 +336,0 @@ }

@@ -38,3 +38,6 @@ /**

);
schema.client.auth(schema.settings.password);
if (schema.settings.password) {
schema.client.auth(schema.settings.password);
}
}

@@ -206,4 +209,4 @@

if (typeof data[i] === 'undefined' || data[i] === null) {
if(p[i].default || p[i].default === 0) {
if(typeof p[i].default === 'function') {
if (p[i].default || p[i].default === 0) {
if (typeof p[i].default === 'function') {
data[i] = p[i].default();

@@ -236,3 +239,3 @@ } else {

case "json":
if(typeof data[i] === 'object') {
if (typeof data[i] === 'object') {
data[i] = JSON.stringify(data[i]);

@@ -257,4 +260,4 @@ }

if (typeof data[i] === 'undefined' || data[i] === null) {
if(p[i].default || p[i].default === 0) {
if(typeof p[i].default === 'function') {
if (p[i].default || p[i].default === 0) {
if (typeof p[i].default === 'function') {
data[i] = p[i].default();

@@ -273,6 +276,6 @@ } else {

try {
if(typeof data[i] === 'string') {
if (typeof data[i] === 'string') {
data[i] = JSON.parse(data[i]);
}
} catch(err) {
} catch (err) {
}

@@ -385,3 +388,3 @@ break;

if (!filter.where) {
filter = {where : filter};
filter = {where: filter};
}

@@ -617,6 +620,4 @@ var self = this;

}
if (key !== 'id') {
if (props[key].type.name !== 'Number' && props[key].type.name !== 'Date') {
allNumeric = false;
}
if (props[key].type.name !== 'Number' && props[key].type.name !== 'Date') {
allNumeric = false;
}

@@ -670,3 +671,3 @@ sortCmd.push("BY", model + ":*->" + key);

function handleKeys(err, keys) {
if(err) {
if (err) {
console.log(err);

@@ -673,0 +674,0 @@ }

@@ -233,3 +233,3 @@ /**

if (!error) {
if (cursor.hasNext()) {
if (cursor.next()) {
cursor.toArray(function (error, list) {

@@ -236,0 +236,0 @@ if (error) {

@@ -16,3 +16,3 @@ /**

var instrument = {
'riak.request.start': function(event) {
'riak.request.start': function (event) {
console.log('[riak-js] ' + event.method.toUpperCase() + ' ' + event.path);

@@ -38,3 +38,3 @@ }

Riak.prototype.define = function(descr) {
Riak.prototype.define = function (descr) {
var self = this;

@@ -50,3 +50,3 @@ var prop = descr.properties || {};

}
self.client.getBucket(descr.model.modelName, function(err, properties) {
self.client.getBucket(descr.model.modelName, function (err, properties) {
self.client.saveBucket(descr.model.modelName, {

@@ -60,3 +60,3 @@ allow_mult: false,

Riak.prototype.save = function(model, data, callback) {
Riak.prototype.save = function (model, data, callback) {
var self = this;

@@ -67,3 +67,3 @@ var opts = self.buildIndexes(model, data);

} else {
self.client.save(model, null, data, function(err, obj, meta) {
self.client.save(model, null, data, function (err, obj, meta) {
data.id = meta.key;

@@ -75,4 +75,4 @@ self.client.save(model, data.id, data, opts, callback);

Riak.prototype.create = function(model, data, callback) {
this.save(model, data, function(err) {
Riak.prototype.create = function (model, data, callback) {
this.save(model, data, function (err) {
if (callback) {

@@ -84,4 +84,4 @@ callback(err, data.id);

Riak.prototype.exists = function(model, id, callback) {
this.client.exists(model, id, function(err, exists, meta) {
Riak.prototype.exists = function (model, id, callback) {
this.client.exists(model, id, function (err, exists, meta) {
if (callback) {

@@ -101,5 +101,5 @@ callback(err, exists);

Riak.prototype.remove = function(model, filter, callback) {
Riak.prototype.remove = function (model, filter, callback) {
var self = this;
self.all(model, filter, function(err, docs) {
self.all(model, filter, function (err, docs) {
if (docs) {

@@ -147,3 +147,3 @@ removeOne();

}
self.client.getAll(model, {}, opts, function(err, result, meta) {
self.client.getAll(model, {}, opts, function (err, result, meta) {
if (err) {

@@ -165,3 +165,3 @@ return callback(err, []);

var self = this;
self.all(model, {}, function(err, recs) {
self.all(model, {}, function (err, recs) {
if (err) {

@@ -218,3 +218,3 @@ callback(err);

var val = data[key];
if (idx[key] === 'Number' || idx[key] === 'Date') {
if (idx[key] === 'Number' || idx[key] === 'Date') {
if (typeof val === 'object') {

@@ -244,5 +244,5 @@ var cond = this.buildCond(key, val);

console.log(conds)
Object.keys(conds).forEach(function(condType) {
Object.keys(conds).forEach(function (condType) {
var val = conds[condType];
val = (val.getTime)? val.getTime(): val;
val = (val.getTime) ? val.getTime() : val;
switch (condType) {

@@ -249,0 +249,0 @@ case 'gt':

@@ -245,5 +245,5 @@ /**

if ((props[key].type.name || '').toString().toLowerCase() === 'json' && typeof val == "string") {
try{
try {
data[key] = JSON.parse(val);
} catch(err){
} catch (err) {
data[key] = val;

@@ -250,0 +250,0 @@ }

{
"name": "caminte",
"description": "ORM for every database: redis, mysql, neo4j, mongodb, rethinkdb, postgres, sqlite, tingodb",
"version": "0.2.7",
"version": "0.2.8",
"author": {

@@ -60,2 +60,6 @@ "name": "Aleksej Gordejev",

"email": ""
},
{
"name": "Tyrone Dougherty",
"email": "email@tyronedougherty.com"
}

@@ -62,0 +66,0 @@ ],

@@ -248,4 +248,3 @@ [![Build Status](https://travis-ci.org/biggora/caminte.png?branch=master)](https://travis-ci.org/biggora/caminte)

[![Analytics](https://ga-beacon.appspot.com/UA-22788134-5/caminte/readme)](https://github.com/igrigorik/ga-beacon)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/biggora/caminte/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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