New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deepjs

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepjs - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

84

lib/stores.js

@@ -293,3 +293,3 @@ /**

deep.store.CachedSheet = {
deep.store.CachedStoreSheet = {
"dq.up::./get":deep.compose.around(function(old){

@@ -340,3 +340,3 @@ return function(id, opt)

deep.store.ObjectSheet = {
deep.store.FullJSONStoreSheet = {
"dq.up::./post":deep.compose.after(function(result){

@@ -352,25 +352,23 @@ //console.log("private check : ", this, result);

})
.around(function(old){
return function (content, opt) {
opt = opt || {};
var schema = this.schema;
if(schema)
.before(function (content, opt) {
opt = opt || {};
var schema = this.schema;
if(schema)
{
if(schema._deep_ocm_)
schema = schema("post");
if(opt.ownerRestiction || schema.ownerRestiction)
{
if(schema._deep_ocm_)
schema = schema("post");
if(opt.ownerRestiction || schema.ownerRestiction)
{
if(!deep.context || !deep.context.session || !deep.context.session.remoteUser)
return deep.when(deep.errors.Owner());
if(!content[opt.ownerRestiction || schema.ownerRestiction])
content[opt.ownerRestiction || schema.ownerRestiction] = deep.context.session.remoteUser.id;
else if(content[opt.ownerRestiction || schema.ownerRestiction] !== deep.context.session.remoteUser.id)
return deep.when(deep.errors.Owner());
}
var report = deep.validate(content, schema);
if(!report.valid)
return deep.when(deep.errors.PreconditionFail("post failed", report));
if(!deep.context || !deep.context.session || !deep.context.session.remoteUser)
return deep.when(deep.errors.Owner());
if(!content[opt.ownerRestiction || schema.ownerRestiction])
content[opt.ownerRestiction || schema.ownerRestiction] = deep.context.session.remoteUser.id;
else if(content[opt.ownerRestiction || schema.ownerRestiction] !== deep.context.session.remoteUser.id)
return deep.when(deep.errors.Owner());
}
return old.call(this, content, opt);
};
var report = deep.validate(content, schema);
if(!report.valid)
return deep.when(deep.errors.PreconditionFail("post failed", report));
}
return [content, opt];
}),

@@ -388,3 +386,3 @@ "dq.up::./put":deep.compose.before(function (object, options)

options.noPrivates = true;
return deep.when(this.get(id, options)) // check ownership at get
return deep.when(this.get(id, options)) // check ownership + filter at get
.done(function(r){

@@ -426,2 +424,3 @@ var old = deep.utils.copy(r);

var self = this;
var schema = self.schema;
var id = opt.id = opt.id || content.id;

@@ -431,3 +430,3 @@ if(!opt.id)

opt.noPrivates = true;
return deep.when(this.get(id, opt)) // check ownership at get
return deep.when(this.get(id, opt)) // check ownership + filter at get
.done(function(datas){

@@ -449,3 +448,2 @@ var data = deep.utils.copy(datas);

data.id = id;
var schema = self.schema;
if(schema)

@@ -464,3 +462,3 @@ {

if(self.collection._deep_ocm_)
col = self.collection();
col = self.collection();
return [data,opt];

@@ -481,5 +479,17 @@ });

options = options || {};
var q = "";
var schema = this.schema;
if(schema && schema._deep_ocm_)
schema = schema("get");
if (schema) {
if (schema._deep_ocm_)
schema = schema("get");
if (schema.ownerRestriction)
if (deep.context.session && deep.context.session.remoteUser)
q += "&" + schema.ownerRestriction + "=" + deep.context.session.remoteUser.id;
else
return deep.when(deep.errors.Owner());
}
var filter = schema && schema.filter;
if (filter)
q += filter;
options.filter = q;
return deep.when(old.apply(this, [id, options]))

@@ -547,18 +557,2 @@ .done(function(res){

},
checkOwnership:function(object){
if(!this.schema)
return true;
var schema = this.schema;
if(schema._deep_ocm_)
schema = schema("get");
if(schema.ownerRestriction)
if(deep.context.session && deep.context.session.remoteUser)
{
if(object[schema.ownerRestriction] !== deep.context.session.remoteUser.id)
return deep.errors.Owner();
}
else
return deep.errors.Owner();
return true;
},
rpc:function(method, args, id, options){

@@ -565,0 +559,0 @@ var self = this;

@@ -63,15 +63,4 @@ if (typeof define !== 'function') {

q = "./*?id=" + id;
var schema = this.schema;
if (schema) {
if (schema._deep_ocm_)
schema = schema("get");
if (schema.ownerRestriction)
if (deep.context.session && deep.context.session.remoteUser)
q += "&" + schema.ownerRestriction + "=" + deep.context.session.remoteUser.id;
else
return deep.when(deep.errors.Owner());
}
var filter = options.filter || schema && schema.filter;
if (filter)
q += filter;
if(options.filter)
q += options.filter;
//console.log("deep.store.Collection.get : q :",q);

@@ -86,5 +75,4 @@ var col = this.collection;

if (typeof r === 'undefined')
return deep.when(deep.errors.NotFound(q));
return deep.when(deep.utils.copy(r));
return deep.errors.NotFound(q);
return deep.utils.copy(r);
},

@@ -111,3 +99,2 @@ /**

*/
patch: function(object, options) {

@@ -142,3 +129,3 @@ id = object.id || options.id;

col.push(object);
return deep.when(object);
return object;
},

@@ -165,4 +152,4 @@ /**

if (!removed || removed.length === 0)
return deep.when(false);
return deep.when(true);
return false;
return true;
},

@@ -177,21 +164,15 @@ /**

range: function(start, end, query) {
//console.log("deep.store.Collection.range : ", start, end);
var col = this.collection;
if (this.collection._deep_ocm_)
col = this.collection();
//console.log("deep.store.Collection.range : ", start, end, query);
var res = null;
var total = 0;
query = query || "";
if (query) {
res = deep.query(col, "./*" + query);
return deep.when(this.get(query))
.done(function(res){
total = res.length;
start = Math.min(start,total);
res = res.slice(start, end + 1);
end = start + res.length - 1;
} else {
res = col.slice(start, end + 1);
total = col.length;
}
query += "&limit(" + (res.length) + "," + start + ")";
return deep.utils.createRangeObject(start, end, total, res.length, deep.utils.copy(res), query);
query += "&limit(" + (res.length) + "," + start + ")";
return deep.utils.createRangeObject(start, end, total, res.length, deep.utils.copy(res), query);
});
},

@@ -205,5 +186,5 @@ flush: function() {

};
deep.sheet(deep.store.ObjectSheet, deep.store.Collection.prototype);
deep.sheet(deep.store.FullJSONStoreSheet, deep.store.Collection.prototype);
return deep.store.Collection;
};
});

@@ -147,3 +147,3 @@

deep.sheet(deep.store.ObjectSheet, deep.store.Object.prototype);
deep.sheet(deep.store.FullJSONStoreSheet, deep.store.Object.prototype);

@@ -150,0 +150,0 @@ return deep.store.Object;

{
"name" : "deepjs",
"version" : "0.10.1",
"version" : "0.10.2",
"author" : "Gilles Coomans <gilles.coomans@gmail.com>",

@@ -5,0 +5,0 @@ "description" : "Powerful atomic tools for managing objects, functions and promises",

@@ -72,3 +72,3 @@ ## Questions

- Clean BaseChain/Chain construction OK
- no more requirejs pattern
- no more requirejs pattern

@@ -83,3 +83,3 @@ DO

- test context and modes
- Emitter and Context ?
- Emitter and Context ?

@@ -86,0 +86,0 @@ Write

@@ -8,3 +8,3 @@ # usage

// run all deep cores tests
require("deep/unit").run();
require("deepjs/unit").run();

@@ -17,4 +17,4 @@ ```

deep("js::deep/unit")
.done(function(){
deep("js::deepjs/unit")
.done(function(Unit){
// run all deep cores tests

@@ -21,0 +21,0 @@ deep.Unit.run();

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