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

angular-wakanda

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-wakanda - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

bower.json
{
"name": "angular-wakanda",
"version": "1.0.1",
"version": "1.0.2",
"keywords": [

@@ -5,0 +5,0 @@ "angular",

{
"name": "angular-wakanda",
"version": "1.0.1",
"version": "1.0.2",
"description": "Connector between Wakanda Server and Angular Framework",

@@ -5,0 +5,0 @@ "main": "angular-wakanda.js",

angular-wakanda.js - release notes
===================================================
##V1.0.2
* Fix issue with image upload
* Fix issue with $toJSON method
* Fix issue with with object attribute update on entity
* Fix entity creation with related entity on $create parameter
##v1.0.1

@@ -5,0 +11,0 @@ * Correct license in package.json

@@ -507,6 +507,29 @@ var wakanda = angular.module('wakanda', []);

*/
var $$create = function(pojo) {
return createNgWakEntity(new WAF.Entity(this, pojo || {}), { expend: true });
};
var $$create = function(pojo) {
//Removing related attributes from pojo to avoid creation attempt on WAF side
//We will affect them to the entity when it's created
var i;
var relatedAttributes = {};
for (i = 0; i < this.$_relatedAttributes.length; i++) {
var attr = this.$_relatedAttributes[i];
if (pojo.hasOwnProperty(attr.name) && pojo[attr.name] !== undefined) {
relatedAttributes[attr.name] = pojo[attr.name];
delete pojo[attr.name];
}
}
var entity = createNgWakEntity(new WAF.Entity(this, pojo || {}), {
expend: true
});
var keys = Object.keys(relatedAttributes);
for (i = 0; i < keys.length; i++) {
entity[keys[i]] = relatedAttributes[keys];
}
return entity;
};
/**

@@ -953,3 +976,3 @@ *

} else if(attr.type === 'image') {
var attribute = this.$_entity[attr.name];
var that = this;
var value = {};

@@ -960,2 +983,3 @@ Object.defineProperty(this, attr.name, {

get: function() {
var attribute = that.$_entity[attr.name];
if(! attribute.resolvedID) {

@@ -972,2 +996,3 @@ var val = attribute.getValue();

set: function(value) {
var attribute = that.$_entity[attr.name];
attribute.setValue(value);

@@ -1000,3 +1025,5 @@ }

timeout: 300 // seconds
};
},
attribute = that.$_entity[attr.name];
deferred.promise.$promise = deferred.promise;

@@ -1025,6 +1052,11 @@

}
//@warn specific case for object ? @warn check date types
else {
} else if(attr.type === 'object' && attr.kind === 'storage') {
//Store object attributes to compare them when saving (wakanda-issues #6)
//Storing only a stringified version to avoid reference comparison on $save method
if (!(typeof this.$_objectAttributesOriginalValueStr === 'object')) {
this.$_objectAttributesOriginalValueStr = {};
}
this.$_objectAttributesOriginalValueStr[attr.name] = JSON.stringify(this.$_entity[attr.name].getValue());;
Object.defineProperty(this, attr.name, {

@@ -1034,5 +1066,24 @@ enumerable: true,

get: function() {
if (this.$_entity) {
return this.$_entity[attr.name].getValue();
}
},
set: function(newValue) {
if(this.$_entity) {
return this.$_entity[attr.name].getValue();
rootScopeSafeApply(function() {
this.$_entity[attr.name].setValue(newValue);
}.bind(this));
}
}
});
}
//@warn check date types
else {
Object.defineProperty(this, attr.name, {
enumerable: true,
configurable: true,
get: function() {
if (this.$_entity) {
return this.$_entity[attr.name].getValue();
}
},

@@ -1072,2 +1123,13 @@ set: function(newValue) {

}
var _this = this;
this.$_dataClass.getAttributes().forEach(function (attr) {
//Touching non-touched object attributes if the existing object has been modified (but not erased by a new object)
if (attr.type === 'object' && attr.kind === 'storage' && _this.$_entity[attr.name].isTouched() === false) {
if (_this.$_objectAttributesOriginalValueStr[attr.name] !== JSON.stringify(_this.$_entity[attr.name].value)) {
_this.$_entity[attr.name].touch();
}
}
});
console.group('$save');

@@ -1214,2 +1276,35 @@ var deferred, wakOptions = {}, that = this;

return deferred.promise;
},
toJSON: function () {
var ret = {};
for (var i = 0; i < this.$_dataClass._private.attributes.length; i++) {
var attrMeta = this.$_dataClass._private.attributes[i];
var attr = this.$_entity[attrMeta.name];
switch(attrMeta.kind) {
case 'relatedEntity':
/**
* If $_key is present, the related entity is not fetched.
* - if it's a string, we have a key, so there is a related entity
* - if it's null, no entity is link to this one, so we return a null
*
* In other cases, we have a fetched entity, so we return it entirely.
*/
if (typeof this[attrMeta.name].$_key === 'string') {
ret[attrMeta.name] = {ID: parseInt(attr.relKey)};
}
else if (this[attrMeta.name].$_key === null) {
ret[attrMeta.name] = null;
}
else {
ret[attrMeta.name] = this[attrMeta.name];
}
break;
default:
ret[attrMeta.name] = this[attrMeta.name];
}
}
return ret;
}

@@ -1216,0 +1311,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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