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

ee-orm

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-orm - npm Package Compare versions

Comparing version 0.5.14 to 0.5.15

58

lib/Model.js

@@ -39,2 +39,5 @@ !function(){

Class.define(this, '_busy' , Class(false).Writable());
Class.define(this, '_queue' , Class([]));
// require the orm if not already set, cannot load at

@@ -344,6 +347,12 @@ // the begin of the file because the orm includes this file

, callback = args.getFunction(function(){})
, transaction = args.getObject();
, transaction = args.getObject();
// we need to get a lock, else the orm will fail
if (!this._getLock('delete', arguments)) return;
if (transaction || this._getDatabase().isTransaction()) {
this._delete(transaction || this._getDatabase().getTransaction(), callback);
this._delete(transaction || this._getDatabase().getTransaction(), function(err) {
callback(err);
this._freeLock();
}.bind(this));
}

@@ -358,2 +367,3 @@ else {

else callback(err);
this._freeLock();
}.bind(this));

@@ -370,2 +380,3 @@ }

}
this._freeLock();
}.bind(this));

@@ -423,2 +434,35 @@ }

/*
* tries to get a lock for the model becaus eparallel
* asynchronous actions will let the orm fail.
* if the item is locked already the action will executed
* as soon as the lock is removed.
*/
, _getLock: function(fn, args) {
if (this._busy) {
this._queue.push({
fn : fn
, args : args
});
return false;
}
this._busy = true;
return true;
}
/*
* removes the lock, executes queried items
*/
, _freeLock: function() {
this._busy = false;
if (this._queue.length) {
var item = this._queue.shift();
this[item.fn].apply(this, Array.prototype.slice.call(item.args));
}
}
/*
* public save method, saves all referveces, this model, all mappings

@@ -438,2 +482,6 @@ * inverse references (belongs to). will create a transaction when none

// we need to get a lock, else the orm will fail
if (!this._getLock('save', arguments)) return;
// either we get a transaction from the outside or

@@ -444,5 +492,6 @@ // we have to create our own

callback(err, this);
this._freeLock();
}.bind(this));
}
else {
else {
// create a new transaction

@@ -457,2 +506,3 @@ transaction = this._getDatabase().createTransaction();

else callback(err);
this._freeLock();
}.bind(this));

@@ -470,2 +520,3 @@ }

else callback(null, this);
this._freeLock();
}.bind(this));

@@ -534,3 +585,2 @@ }

// tell the db which keys to return

@@ -537,0 +587,0 @@ if (this._defintion.primaryKeys.length) query.returning = this._defintion.primaryKeys;

2

lib/RelatingSet.js

@@ -173,3 +173,3 @@ !function(){

// new item
removed.Push(originalMap[oldItemKey]);
removed.push(originalMap[oldItemKey]);
}

@@ -176,0 +176,0 @@ }.bind(this));

{
"name" : "ee-orm"
, "description" : "An easy to use ORM for node.js. Supports eager loading, complex queries, joins, transactions, complex database clusters & connection pooling."
, "version" : "0.5.14"
, "version" : "0.5.15"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)"

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