spice-js 2.5.18 → 2.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/models/SpiceModel.js +14 -0
- package/package.json +1 -1
- package/src/models/SpiceModel.js +17 -1
|
@@ -93,6 +93,20 @@ class SpiceModel {
|
|
|
93
93
|
collection: args.collection,
|
|
94
94
|
scope: args.scope
|
|
95
95
|
});
|
|
96
|
+
|
|
97
|
+
function removeDynamicProps(props) {
|
|
98
|
+
var returnVal = {};
|
|
99
|
+
|
|
100
|
+
for (var i in props) {
|
|
101
|
+
if (!_.has(props[i], "source") || _.get(props[i], "source") == "static") {
|
|
102
|
+
returnVal[i] = props[i];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return returnVal;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
args.props = removeDynamicProps(args.props);
|
|
96
110
|
this[_props] = args.props;
|
|
97
111
|
|
|
98
112
|
for (var i in args.props) {
|
package/package.json
CHANGED
package/src/models/SpiceModel.js
CHANGED
|
@@ -50,7 +50,7 @@ export default class SpiceModel {
|
|
|
50
50
|
before: [],
|
|
51
51
|
after: [],
|
|
52
52
|
},
|
|
53
|
-
update: {
|
|
53
|
+
update: {
|
|
54
54
|
before: [],
|
|
55
55
|
after: [],
|
|
56
56
|
},
|
|
@@ -69,14 +69,30 @@ export default class SpiceModel {
|
|
|
69
69
|
cleaners: [],
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
|
+
|
|
72
73
|
this.deleted = false;
|
|
73
74
|
if (args.args) {
|
|
74
75
|
delete args.args["ctx"];
|
|
75
76
|
}
|
|
77
|
+
|
|
76
78
|
this[_database] = new Database(args.connection || "default", {
|
|
77
79
|
collection: args.collection,
|
|
78
80
|
scope: args.scope,
|
|
79
81
|
});
|
|
82
|
+
|
|
83
|
+
function removeDynamicProps(props) {
|
|
84
|
+
let returnVal = {};
|
|
85
|
+
for (let i in props) {
|
|
86
|
+
if (
|
|
87
|
+
!_.has(props[i], "source") ||
|
|
88
|
+
_.get(props[i], "source") == "static"
|
|
89
|
+
) {
|
|
90
|
+
returnVal[i] = props[i];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return returnVal;
|
|
94
|
+
}
|
|
95
|
+
args.props = removeDynamicProps(args.props);
|
|
80
96
|
this[_props] = args.props;
|
|
81
97
|
for (let i in args.props) {
|
|
82
98
|
if (args.args != undefined) {
|