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

node-entity

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-entity - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

entity-crud.js

2

drivers/mongoose.drv.js

@@ -7,3 +7,3 @@ /**

var __ = require('lodash');
var EntityCrud = require('../entity');
var EntityCrud = require('../entity-crud');

@@ -10,0 +10,0 @@ /**

@@ -0,1 +1,3 @@

/*jshint unused:false */
/**

@@ -9,116 +11,12 @@ * @fileOverview The Entity base class.

var midd = require('middlewarify');
/**
* The base Entity Class all entities extend from.
*
* @param {Object=} optUdo Optionally define the current handling user.
* @constructor
* @extends {events.EventEmitter}
*/
var Entity = module.exports = function(optUdo) {
var Entity = module.exports = function() {
EventEmitter.call(this);
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);
/**
* Set the current user data object
* @param {Object} udo A User Data Object.
*/
Entity.prototype.setUdo = function(udo) {
this.udo = udo;
};
/**
* Create an entity item.
*
* @param {Object} itemData The data to use for creating.
* @param {Function(Error=, Object=)} done callback.
* @protected
*/
Entity.prototype._create = function(itemData, done) {
throw new Error('Not Implemented');
};
/**
* Read one entity item.
*
* @param {string|Object} id the item id or an Object to query against.
* @param {Function(Error=, Object=)} done callback.
* @protected
*/
Entity.prototype._readOne = function(id, done) {
throw new Error('Not Implemented');
};
/**
* Read items based on query or if not defined, read all items.
* Do practice common sense!
*
* @param {Object|string=} optQuery Optionally define a query to limit results.
* @param {Function(Error=, Object=)} done callback.
* @protected
*/
Entity.prototype._read = function(optQuery, done) {
throw new Error('Not Implemented');
};
/**
* Read a limited set of items.
*
* @param {?Object} query Narrow down the set, set to null for all.
* @param {number} skip starting position.
* @param {number} limit how many records to fetch.
* @param {Function(Error=, Array.<Object>=)} done callback.
* @protected
*/
Entity.prototype._readLimit = function(query, skip, limit, done) {
throw new Error('Not Implemented');
};
/**
* Get the count of items.
*
* @param {?Object} query Narrow down the set, set to null for all.
* @param {Function(Error=, number=)} done callback.
* @protected
*/
Entity.prototype._count = function(query, done) {
throw new Error('Not Implemented');
};
/**
* Update an entity item.
*
* @param {string} id the item id.
* @param {Object} itemData The data to use for creating.
* @param {Function(Error=, Object=)} done callback.
* @protected
*/
Entity.prototype._update = function(id, itemData, done) {
throw new Error('Not Implemented');
};
/**
* Remove an entity item.
*
* @param {string} id the item id.
* @param {Function(Error=, Object=)} done callback.
* @protected
*/
Entity.prototype._delete = function(id, done) {
throw new Error('Not Implemented');
};

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

module.exports = require('./entity');
var Entity = module.exports = require('./entity');
Entity.Mongoose = require('./drivers/mongoose.drv');
{
"name": "node-entity",
"description": "The MVCe implementation for Node.js",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/thanpolas/entity",

@@ -34,3 +34,2 @@ "author": {

"lodash": "~1.3.1",
"async": "~0.2.9",
"middlewarify": "~0.0.2"

@@ -43,3 +42,5 @@ },

},
"peerDependencies": {},
"peerDependencies": {
"mongoose": "~3.6.20"
},
"keywords": [

@@ -46,0 +47,0 @@ "entity",

@@ -7,3 +7,2 @@ /**

var Entity = require('../..');
var MongDrv = require('../../drivers/mongoose.drv');
var testEntity = require('./entity.test');

@@ -21,3 +20,3 @@ var testDrivers = require('./drivers.test');

var drivers = [
MongDrv, // test major num: 2
Entity.Mongoose, // test major num: 2
];

@@ -47,7 +46,5 @@

});
};
// ignite
core.init();
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