Comparing version 0.1.0 to 0.1.1
/** | ||
* @fileOverview The bare CRUD command implementations | ||
* | ||
* | ||
*/ | ||
@@ -14,8 +14,19 @@ var Promise = require('bluebird'); | ||
* | ||
* @param {Entity} entity An Entity instance. | ||
* @param {Entity} Entity An Entity instance or ctor. | ||
* @contructor | ||
* @extends {crude.Controller} | ||
*/ | ||
var CrudCmd = module.exports = Controller.extend(function(entity){ | ||
this.entity = entity; | ||
var CrudCmd = module.exports = Controller.extend(function(Entity){ | ||
var ent; | ||
if (typeof Entity === 'function' && Entity.prototype) { | ||
if (Entity.getInstance) { | ||
ent = Entity.getInstance(); | ||
} else { | ||
ent = new Entity(); | ||
} | ||
} else { | ||
ent = Entity; | ||
} | ||
/** @type {Entity} An instance of Entity with CRUD methods */ | ||
this.entity = ent; | ||
@@ -36,3 +47,3 @@ // prep pagination | ||
this._prepResponse.bind(this), | ||
paginationMidd.paginate(entity), | ||
paginationMidd.paginate(this.entity), | ||
this._readList.bind(this), | ||
@@ -263,3 +274,3 @@ ]; | ||
* Handle an error properly depending on request Content-Type | ||
* | ||
* | ||
* @param {Object} req The request Object. | ||
@@ -266,0 +277,0 @@ * @param {Object} res The response Object. |
@@ -15,3 +15,3 @@ /** | ||
* | ||
* @param {crude.Entity} Entity The Entity class Ctor. | ||
* @param {Entity} Entity An Entity instance or ctor. | ||
* @param {string} baseUrl The base url. | ||
@@ -22,6 +22,5 @@ * @param {Object=} optOpts Optionally define options. | ||
*/ | ||
var CrudCtrl = module.exports = CrudCmd.extend(function(Entity, baseUrl, optOpts){ | ||
this.baseUrl = baseUrl; | ||
this._schemaViews = null; | ||
var defaultOpts = { | ||
var CrudCtrl = module.exports = CrudCmd.extend(function(Entity, baseUrl, optOpts) { | ||
/** @type {Object} define default options */ | ||
this.opts = { | ||
baseUrl: baseUrl, | ||
@@ -42,3 +41,9 @@ urlField: 'localUrl', | ||
}; | ||
this.opts = __.defaults(optOpts, defaultOpts); | ||
/** @type {?string} The base url for the resource */ | ||
this.baseUrl = baseUrl; | ||
if (__.isObject(optOpts)) { | ||
this.opts = __.defaults(optOpts, this.opts); | ||
} | ||
// set default view template locations | ||
@@ -45,0 +50,0 @@ this.views = { |
{ | ||
"name": "crude", | ||
"description": "Seamless CRUD control operations for node.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/talksession/node-crude", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -32,12 +32,14 @@ # node-crude | ||
## Release History | ||
- **v0.1.1**, *12 Feb 2014* | ||
- Now accepts both an instance and a constructor for Entity DI. | ||
- Ctor optimizations. | ||
- **v0.1.0**, *12 Feb 2014* | ||
- Updated to Entity 0.1.x | ||
- Updated to Entity 0.1.x | ||
- **v0.0.12**, *10 Oct 2013* Bug fixes. | ||
- **v0.0.11**, *10 Oct 2013* Entities moved to [their own repo](https://github.com/thanpolas/entity) | ||
- **v0.0.3**, *15 Jul 2013* | ||
- Integrated [Middlewarify](https://github.com/thanpolas/middlewarify) and made all Entity primitive methods middleware. | ||
- Added Entity tests | ||
- Integrated [Middlewarify](https://github.com/thanpolas/middlewarify) and made all Entity primitive methods middleware. | ||
- Added Entity tests | ||
- **v0.0.2**, *21 Jun 2013* | ||
- Big Bang | ||
- Big Bang | ||
@@ -44,0 +46,0 @@ ## License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29523
724
56
0