New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

waterline

Package Overview
Dependencies
Maintainers
4
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

waterline - npm Package Compare versions

Comparing version 0.1.0 to 0.1.3

1

adapter.js

@@ -220,3 +220,2 @@ var async = require('async');

if (self.config.updatedAt) values.updatedAt = new Date();
adapter.update(collectionName, criteria, values, cb);

@@ -223,0 +222,0 @@ };

44

collection.js

@@ -42,3 +42,3 @@ var _ = require('underscore');

if(definition.globalize) {
var globalName = _.str.capitalize(this.identity);
var globalName = this.globalId || this.identity;
global[globalName] = this;

@@ -171,5 +171,14 @@ }

var usage = _.str.capitalize(this.identity) + '.create({someAttr: "someValue"},callback)';
if(!_.isFunction(cb)) usageError('Invalid callback specified!', usage);
return this.adapter.create(this.identity, values, cb);
// If no callback specified, return deferred object
if(!_.isFunction(cb)) {
return new Deferred({
method: 'create',
collection: this,
args: { values: values },
argsKeys: ['values']
});
}
else return this.adapter.create(this.identity, values, cb);
};

@@ -281,3 +290,12 @@

return this.adapter.update(this.identity, options, newValues, cb);
// If no callback specified, return deferred object
if(!_.isFunction(cb)) {
return new Deferred({
method: 'update',
collection: this,
args: { options: options, newValues: newValues },
argsKeys: ['options', 'newValues']
});
}
else return this.adapter.update(this.identity, options, newValues, cb);
};

@@ -294,4 +312,14 @@ this.updateWhere = this.update;

var usage = _.str.capitalize(this.identity) + '.destroy([options], callback)';
if(!_.isFunction(cb)) usageError('Invalid callback specified!', usage);
return this.adapter.destroy(this.identity, options, cb);
// If no callback specified, return deferred object
if(!_.isFunction(cb)) {
return new Deferred({
method: 'destroy',
collection: this,
args: { options: options },
argsKeys: ['options']
});
}
else return this.adapter.destroy(this.identity, options, cb);
};

@@ -359,5 +387,5 @@ this.destroyWhere = this.destroy;

this.filter = function(params) {
// If attributes aren't defined, send back
// If attributes aren't defined, send back empty obj
if (!this.attributes) return {};
var trimmedParams = util.objFilter(params, function(value, name) {

@@ -364,0 +392,0 @@ return _.contains(_.keys(this.attributes), name);

@@ -136,13 +136,4 @@ var _ = require('underscore');

if (err) return cb(err);
// Manage result set differently dependending on the method
if (isFindish(methodName)) {
if (resultSet) {
err = methodName + " cannot be called more than once in the same chain!";
}
else resultSet = data;
return cb(err,data);
}
else throw new Error ('Unknown chained method: '+methodName);
resultSet = data;
return cb(err,data);
}

@@ -149,0 +140,0 @@ },

@@ -42,10 +42,9 @@ var _ = require('underscore');

// NOTE: This is dangeros
// TODO: Think about this more and add back in if it makes sense
// If any item in criteria is a parsable finite number, use that
// for(var attrName in criteria.where) {
// if(Math.pow(+criteria.where[attrName], 2) > 0) {
// criteria.where[attrName] = +criteria.where[attrName];
// }
// }
// If any item in criteria is a parsable finite number,
// search for both the INTEGER and STRING versions
for(var attrName in criteria.where) {
if(Math.pow(+criteria.where[attrName], 2) > 0) {
criteria.where[attrName] = [+criteria.where[attrName], criteria.where[attrName]];
}
}

@@ -52,0 +51,0 @@ // If WHERE is {}, always change it back to null

{
"name": "waterline",
"version": "0.1.0",
"version": "0.1.03",
"description": "Adaptable data access layer for Node.js",

@@ -10,7 +10,7 @@ "main": "waterline.js",

"scripts": {
"test": "mocha --globals ___transaction --globals User -b -R landing"
"test": "mocha --globals ___transaction --globals User -b -R landing -t 8000"
},
"repository": {
"type": "git",
"url": "git://github.com/mikermcneil/waterline.git"
"url": "git://github.com/balderdashy/waterline.git"
},

@@ -42,3 +42,4 @@ "keywords": [

"waterline-dirty": "~0.1.2",
"sails-moduleloader": "~1.1.0",
"waterline-mysql": "0.1.0",
"sails-moduleloader": "~1.1.5",
"async": "~0.1.22",

@@ -45,0 +46,0 @@ "underscore.string": "~2.3.1"

@@ -8,32 +8,36 @@ # Waterline

At the same time, Waterline aims to learn lessons and maintain the best features from both Rails' ActiveRecord and Grails' Hibernate ORMs.
Waterline also comes with built-in transaction support, as well as a configurable migration schemes.
Waterline also comes with built-in transaction support which takes advantage of any API the datstore you're using offers, but falls back to maintaining a separate atomic commit log (i.e. the same way Mongo does transactions).
> NOTE: Waterline is currently in unreleased alpha-- that means it's not production ready! If you want to use waterline in a production app, awesome! Currentliy, the plan is for an open alpha release early next year (2013). Thanks!
## Adapters currently supported
(* not yet complete)
### Datastores:
* Dirty (in memory and simple disk JSON store)
* mySQL*
* mongoDB*
* redis*
* cassandra*
* oracle*
* postgres*
* db2*
* mssql*
* mySQL
### Misc:
* HTTP ( client for api integrations and unit testing )*
* Socket.io / WebSockets ( client for api integrations and unit testing )*
* LDAP*
* Active Directory*
* Mandril (hosted email from MailChimp)*
* Facebook friends*
* Tweets*
* SMTP*
* IMAP*
## In development
* mongoDB (Jan)
* redis (March)
* OpenStack (Feb)
* Amazon S3 (Feb)
## Roadmap
### SQL Datastores
* postgres
* oracle
* db2
* mssql
### NoSQL Datastores
* Cassandra
* Neo4J
* CouchDB
### Misc
* LDAP
* Active Directory
*
*
## Writing adapters

@@ -40,0 +44,0 @@

@@ -27,7 +27,39 @@ /*---------------------

// (this is optional and normally automatically populated based on file name)
exports.identity = 'user';
exports.identity = 'User';
// The adapter to test
exports.adapter = {
identity: 'waterline-mysql'
};
// For testing purposes, the following adapter configurations are provided:
////////////////////////////////////////////////////////
// development: temporal (in-memory dirtydb)
////////////////////////////////////////////////////////
exports.adapter = 'waterline-dirty';
////////////////////////////////////////////////////////
// development: stateful (on-disk dirtydb)
////////////////////////////////////////////////////////
// exports.adapter = {
// identity : 'waterline-dirty',
// inMemory : false
// };
////////////////////////////////////////////////////////
// mySQL
////////////////////////////////////////////////////////
//exports.adapter = {
// identity : 'waterline-mysql',
// database : 'waterline',
// user : 'waterline',
// password : 'abc123'
//};
////////////////////////////////////////////////////////
// mySQL: connection pooling enabled
////////////////////////////////////////////////////////
// exports.adapter = {
// identity : 'waterline-mysql',
// database : 'waterline',
// user : 'waterline',
// password : 'abc123',
// pool : true
// };

@@ -82,3 +82,10 @@ /**

if (users.length < 1) return done('Dynamic finder did not return anything!');
if (users[0].name !== testName || users[1].name !== testName2) return done('Dynamic finder returned incorrect user!');
if ( !(
(users[0].name === testName && users[1].name === testName2) ||
(users[0].name === testName2 && users[1].name === testName)
)) {
console.error("IS: ",'('+users[0].name+','+users[1].name+')');
console.error("Should be:",testName,testName2);
return done(new Error('Dynamic finder returned incorrect user!'));
}
done(err);

@@ -125,3 +132,10 @@ });

if (users.length < 1) return done('Dynamic finder did not return anything!');
if (users[0].name !== testName || users[1].name !== testName2) return done('Dynamic finder returned incorrect user!');
if ( !(
(users[0].name === testName && users[1].name === testName2) ||
(users[0].name === testName2 && users[1].name === testName)
)) {
console.error("Should be:",testName,testName2);
console.error("IS: ",'('+users[0].name+','+users[1].name+')');
return done(new Error('Dynamic finder returned incorrect user!'));
}
done(err);

@@ -128,0 +142,0 @@ });

@@ -50,3 +50,10 @@ describe('findByLike', function() {

if (users.length < 1) return done(new Error('findAllLike() did not return anything!'));
if (users[0].name !== testName || users[1].name !== testName2) return done(new Error('findAllLike() returned incorrect user!'));
if ( !(
(users[0].name === testName && users[1].name === testName2) ||
(users[0].name === testName2 && users[1].name === testName)
)) {
console.error("\n\n","IS: ",users[0].name,"\n",users[1].name,"\n\n");
console.error("Should be:",testName,"\n",testName2,"\n\n");
return done(new Error('findAllLike() returned incorrect user!'));
}
done(err);

@@ -71,3 +78,10 @@ });

if (users.length < 1) return done(new Error('findAllLike() did not return anything!'));
if (users[0].name !== testName || users[1].name !== testName2) return done(new Error('findAllLike() returned incorrect user!'));
if ( !(
(users[0].name === testName && users[1].name === testName2) ||
(users[0].name === testName2 && users[1].name === testName)
)) {
console.error("\n\n","IS: ",users[0].name,"\n",users[1].name,"\n\n");
console.error("Should be:",testName,"\n",testName2,"\n\n");
return done(new Error('findAllLike() returned incorrect user!'));
}
done(err);

@@ -74,0 +88,0 @@ });

@@ -12,5 +12,2 @@ // Dependencies

// Read global config
var config = require('./config.js');
// Util

@@ -49,2 +46,6 @@ var modules = require('sails-moduleloader');

// Read global config
// Extend default config with user options
var config = require('./config.js');
config = _.extend(config, options);

@@ -51,0 +52,0 @@ // Error aggregator obj

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