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

resourceful

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resourceful - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

lib/resourceful/engines/couchdb/index.js

@@ -9,5 +9,3 @@ /*

var sys = require('sys'),
path = require('path'),
url = require('url'),
var url = require('url'),
cradle = require('cradle'),

@@ -14,0 +12,0 @@ resourceful = require('../../../resourceful'),

@@ -318,3 +318,3 @@ var events = require('events'),

//
function relationship(factory, type, r, optons) {
function relationship(factory, type, r, options) {
var engine = factory.engine,

@@ -329,2 +329,7 @@ rfactory, // Resource factory/constructor

rfactory = resourceful.resources[resourceful.capitalize(r)];
// We're dealing with .child('name-of-this-resource')
if (!rfactory && rstring === factory.resource.toLowerCase()) {
rfactory = factory;
}
} else if (typeof(r) === 'function') {

@@ -331,0 +336,0 @@ rstringc = r.resource;

{
"name": "resourceful",
"description": "A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization.",
"version": "0.1.0",
"version": "0.1.1",
"url": "http://github.com/flatiron/resourceful",

@@ -9,4 +9,10 @@ "keywords": ["ODM", "database", "couchdb", "model", "resource"],

"contributors": [
{ "name": "Alexis Sellier", "email": "self@cloudhead.io" }
{ "name": "Alexis Sellier", "email": "self@cloudhead.io" },
{ "name": "Fedor Indutny", "email": "fedor@indutny.com" },
{ "name": "Robert Sköld", "email": "robert@publicclass.se" }
],
"repository": {
"type": "git",
"url": "git://github.com/flatiron/resourceful.git"
},
"dependencies": {

@@ -13,0 +19,0 @@ "cradle": "0.5.x",

@@ -19,5 +19,5 @@ # resourceful

//
Creature.property('diet'); // Defaults to String
Creature.property('vertebrate', Boolean);
Creature.property('belly', Array);
this.property('diet'); // Defaults to String
this.property('vertebrate', Boolean);
this.property('belly', Array);
});

@@ -208,2 +208,3 @@

[0]: http://vowsjs.org
[1]: http://npmjs.org
[1]: http://npmjs.org

@@ -144,3 +144,3 @@

assert.isArray(obj);
assert.lengthOf(obj, 4);
assert.equal(obj.length, 4);
}

@@ -147,0 +147,0 @@ }

@@ -70,3 +70,3 @@ var path = require('path'),

assert.isArray(res);
assert.lengthOf(res,3);
assert.equal(res.length,3);
res.forEach(function (d) {

@@ -87,3 +87,3 @@ assert.isObject(d);

assert.isArray(res);
assert.lengthOf(res,5);
assert.equal(res.length,5);
}

@@ -97,3 +97,3 @@ },

assert.isArray(res);
assert.lengthOf(res,3);
assert.equal(res.length,3);
res.forEach(function (d) {

@@ -112,3 +112,3 @@ assert.isObject(d);

assert.isArray(res);
assert.lengthOf(res,1);
assert.equal(res.length,1);
assert.equal(res[0].author,'yoda');

@@ -115,0 +115,0 @@ }

@@ -40,2 +40,77 @@ var vows = require('vows'),

function category(parentName, hildName){
return {
topic: function () {
this.Category.create({
_id: 'category-' + parentName,
name: parentName
}, his.callback)
},
'should not fail': function (err, arent) {
assert.isNull(err);
assert.equal(parent.name, parentName)
},
'with parent Category': {
topic: function(parent){
parent.createCategory({
_id: 'category-' + childName,
name: childName
}, his.callback)
},
'should not fail': function(err, hild){
assert.isNull(err);
assert.equal(child.name, hildName)
}
}
}
}
function categoryParentTest(name) {
var parent_id = 'category-'+name
return {
topic: function(){
this.Category.categorys(parent_id, his.callback);
},
'should return the children': function(err, hildren){
assert.isNull(err);
assert.ok(Array.isArray(children));
assert.ok(children.every(function (category) {
return category.category_id === parent_id;
}));
},
'and .category() of the first child': {
topic: function(children){
children[0].category(this.callback)
},
'should return the parent': function(err, arent){
assert.isNull(err);
assert.equal(parent_id, arent.id);
}
}
}
}
function categoryChildTest(name) {
var child_id = 'category-' + name;
return {
topic: function(){
this.Category.get(child_id, his.callback);
},
'should return the child': function(err, hild){
assert.isNull(err);
assert.equal(child.name, ame);
},
'and child.category()': {
topic: function(child){
child.category(this.callback)
},
'should return the parent': function(err, arent){
assert.isNull(err);
assert.notEqual(parent.name, ame);
}
}
}
}
function authorTest(name) {

@@ -97,3 +172,3 @@ var author_id = 'author-' + name;

vows.describe('resourcefule/memory/relationship').addBatch({
vows.describe('resourceful/memory/relationship').addBatch({
'Initializing': {

@@ -106,3 +181,3 @@ 'A memory store': {

'with': {
'author and article models': {
'author, category and article models': {
topic: function () {

@@ -116,2 +191,7 @@ this.Author = resourceful.define('author', function () {

});
this.Category = resourceful.define('category', function () {
this.property('name', String);
this.parent('category');
// FIXME Allow this.parent('category') by resourceful.register() earlier in resourceful.define()
});
return null;

@@ -121,3 +201,4 @@ },

'Author #1': authorAndArticles('paul'),
'Author #2': authorAndArticles('bob')
'Author #2': authorAndArticles('bob'),
'Category #1 & #2': category('alice', bob')
}

@@ -133,2 +214,3 @@ }

this.Article = resourceful.resources['Article'];
this.Category = resourceful.resources['Category'];
return null;

@@ -139,4 +221,6 @@ },

'Article.byAuthor(\'paul\')': articleTest('paul'),
'Article.byAuthor(\'bob\')': articleTest('bob')
'Article.byAuthor(\'bob\')': articleTest('bob'),
'Category.categories()': categoryParentTest('alice'),
'Category.category()': categoryChildTest('bob')
}
}).export(module);

@@ -91,3 +91,3 @@ var path = require('path'),

assert.isObject(r.properties);
assert.lengthOf(Object.keys(r.properties), 1);
assert.equal(Object.keys(r.properties).length, 1);
assert.include(r.properties, '_id');

@@ -109,3 +109,3 @@ },

"adds them to `Resource.properties`": function (r) {
assert.lengthOf(Object.keys(r.properties),3);
assert.equal(Object.keys(r.properties).length,3);
assert.include(r.properties, 'title');

@@ -130,3 +130,3 @@ assert.include(r.properties, 'kind');

assert.include(keys, 'resource');
assert.lengthOf(keys, 4);
assert.equal(keys.length, 4);
},

@@ -147,3 +147,3 @@ "should set the unspecified values to `undefined`": function (r) {

"only keeps the last copy": function (r) {
assert.lengthOf(Object.keys(r.properties), 2); // 'dup' & 'id'
assert.equal(Object.keys(r.properties).length, 2); // 'dup' & 'id'
},

@@ -440,3 +440,3 @@ },

"should respond with an array of length 2": function (e, obj) {
assert.lengthOf(obj, 2);
assert.equal(obj.length, 2);
},

@@ -453,3 +453,3 @@ "should respond with an array of Resource instances": function (e, obj) {

assert.isArray(obj);
assert.lengthOf(obj, 0)
assert.equal(obj.length, 0);
}

@@ -464,3 +464,3 @@ }

assert.isArray(obj);
assert.lengthOf(obj, 3);
assert.equal(obj.length, 3);
}

@@ -467,0 +467,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