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.3.19 to 0.3.20

1

lib/Entity.js

@@ -11,3 +11,2 @@ !function(){

, QueryBuilderBuilder = require('./QueryBuilderBuilder')
, clone = require('clone')
, log = require('ee-log');

@@ -14,0 +13,0 @@

64

lib/QueryBuilder.js

@@ -6,3 +6,2 @@ !function(){

, log = require('ee-log')
, clone = require('clone')
, Arguments = require('ee-arguments')

@@ -19,4 +18,20 @@ , type = require('ee-types')

// clone the filter object but not its contents
var clone = function(input) {
var copy;
if (type.object(input)) {
copy = {};
Object.keys(input).forEach(function(key){
copy[key] = input[key];
});
return copy;
}
else return input;
}
module.exports = new Class({

@@ -382,7 +397,52 @@

Object.keys(filter).forEach(function(property){
var queryColum;
if (!query.filter[tablename]) query.filter[tablename] = {};
query.filter[tablename][property] = filter[property];
if (filter[property] && type.function(filter[property].isQuery)) {
// get the corret identifier for the subquery
queryColum = this._findColumnForIdentifier(property);
query.filter[tablename][queryColum.name] = filter[property];
// select the first primary if nothing was selected by the user
if (!filter[property]._resource.query.select.length) {
filter[property]._resource.query.select.push(filter[property]._definition.primaryKeys[0]);
}
}
else query.filter[tablename][property] = filter[property];
}.bind(this));
}
, _findColumnForIdentifier: function(propertyName) {
var resultingColumn;
Object.keys(this._definition.columns).some(function(colName) {
column = this._definition.columns[colName];
if (column.name === propertyName) return resultingColumn = column, true;
if (column.referencedTable === propertyName) return resultingColumn = column, true;
if (column.mapsTo && column.mapsTo.length) {
column.mapsTo.some(function(mapping){
var id = mapping.aliasName || mapping.name;
if(id === propertyName) return resultingColumn = column, true;
}.bind(this));
if (resultingColumn) return true;
}
if (column.belongsTo && column.belongsTo.length) {
column.belongsTo.some(function(belongsTo){
var id = belongsTo.aliasName || belongsTo.name;
if(id === propertyName) return resultingColumn = column, true;
}.bind(this));
if (resultingColumn) return true;
}
}.bind(this));
return resultingColumn;
}
, _parseSelect: function(query, tablename, select) {

@@ -389,0 +449,0 @@ select.forEach(function(item){

{
"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.3.19"
, "version" : "0.3.20"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

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

, "ee-arguments" : "1.0.x"
, "clone" : "0.1.x"
, "ee-db-cluster" : "0.1.x"

@@ -29,0 +28,0 @@ }

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