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

ifnode

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ifnode - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

.idea/dbnavigator.xml

2

core/Application.js

@@ -225,3 +225,3 @@ 'use strict';

* @param {Object} model_config
* @param {Object} options
* @param {Object} [options]
* @returns {Function}

@@ -228,0 +228,0 @@ * @constructor

@@ -19,4 +19,5 @@ /**

this._schemas_list = schemas_list;
this._schemas = {};
this._default_creator = '';
this._daos = {};
this._daos_drivers = {};
this._default_dao_name = '';

@@ -31,3 +32,3 @@ this._initialize_schemas(db);

DAOList.prototype.get_default_dao_name = function() {
return this._default_creator;
return this._default_dao_name;
};

@@ -41,16 +42,26 @@

DAOList.prototype.get_dao = function get_dao(name) {
return this._schemas[name] || null;
return this._daos[name] || null;
};
/**
*
* @param {string} name
* @returns {?Function}
*/
DAOList.prototype.get_dao_driver = function get_dao_driver(name) {
return this._daos_drivers[name] || null;
};
DAOList.prototype._initialize_schemas = function _initialize_schemas(db) {
var self = this;
var db_connections_names = Object.keys(db);
this._default_creator = db_connections_names[0];
this._default_dao_name = db_connections_names[0];
db_connections_names.forEach(function(db_connection_name) {
var db_config = db[db_connection_name];
var schema_driver = this._schemas_list.get_schema(db_config.schema);
var schema_driver = self._schemas_list.get_schema(db_config.schema);
if(db_config.default) {
this._default_creator = db_connection_name;
self._default_dao_name = db_connection_name;
}

@@ -63,9 +74,10 @@

schema_driver.fn._driver = driver;
self._daos_drivers[db_connection_name] = driver;
}
}
this._schemas[db_connection_name] = schema_driver;
}.bind(this));
self._daos[db_connection_name] = schema_driver;
});
};
module.exports = DAOList;

@@ -42,4 +42,14 @@ 'use strict';

var DAO = this._dao_list.get_dao(options.db);
var model_prototype = DAO(model_config);
var db_name = options.db;
var dao_list = this._dao_list;
var DAO = dao_list.get_dao(db_name);
/**
* @todo Hack for backward compatibility. Will be removed in 2.0
* @type {Function}
* @private
*/
DAO.prototype._driver = dao_list.get_dao_driver(db_name);
var model_prototype = new DAO(model_config);
var model_unique_name = model_prototype.name || model_prototype.table || model_prototype.collection;

@@ -52,2 +62,3 @@

this._model_prototypes[model_unique_name] = {
db_name: db_name,
model_prototype: model_prototype,

@@ -65,2 +76,3 @@ options: options

ModelBuilder.prototype.compile_models = function compile_models() {
var dao_list = this._dao_list;
var model_prototypes = this._model_prototypes;

@@ -70,3 +82,14 @@

var model_prototype = model_prototypes[model_unique_name];
var compiled_model = model_prototype.model_prototype.compile();
var dao_driver = dao_list.get_dao_driver(model_prototype.db_name);
var prototype = model_prototype.model_prototype;
/**
* @todo Hack for backward compatibility. Will be removed in 2.0
* @type {Function}
* @private
*/
prototype._driver = dao_driver;
var compiled_model = prototype.compile();
var options = model_prototype.options;

@@ -73,0 +96,0 @@

@@ -19,6 +19,2 @@ 'use strict';

function Schema(model_config) {
if(!(this instanceof Schema)) {
return new Schema(model_config);
}
var initialize_method = this.initialize || this.init;

@@ -25,0 +21,0 @@

{
"name": "ifnode",
"version": "1.5.2",
"version": "1.5.3",
"description": "Node.js MVC Framework",

@@ -5,0 +5,0 @@ "main": "index.js",

'use strict';
var app = require('../examples/extensions/app'),
should = require('should');
var Should = require('should');
var app = require('../examples/models/app');
describe('Models', function() {
describe('app.Model(model_config: Object, [options: Object])', function() {
it('should exists', function() {
app.Model.should.be.an.Function;
});
it('should creates models', function() {
app.load();
Should.equal(app.models.FirstModel.sameMethod(), 1);
Should.equal(app.models.SecondModel.sameMethod(), 2);
});
});
});

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