@azrico/webobject 1.5.42 → 1.5.44
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.
|
@@ -88,7 +88,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
88
88
|
get_fullObject(p?: deltaParams): Promise<any>;
|
|
89
89
|
/**
|
|
90
90
|
* You will post this to the server for saving
|
|
91
|
-
* automatically removes
|
|
91
|
+
* automatically removes unchangeable fields
|
|
92
92
|
* @returns
|
|
93
93
|
*/
|
|
94
94
|
get_deltaObject(p?: deltaParams): Promise<any>;
|
|
@@ -576,7 +576,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
576
576
|
}()
|
|
577
577
|
/**
|
|
578
578
|
* You will post this to the server for saving
|
|
579
|
-
* automatically removes
|
|
579
|
+
* automatically removes unchangeable fields
|
|
580
580
|
* @returns
|
|
581
581
|
*/
|
|
582
582
|
)
|
|
@@ -584,13 +584,13 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
584
584
|
key: "get_deltaObject",
|
|
585
585
|
value: (function () {
|
|
586
586
|
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(p) {
|
|
587
|
-
var final_object, useDelta, changedFields, key,
|
|
587
|
+
var final_object, useDelta, changedFields, key, changeableKeys, functionProps, index, fp, parseObj, _parseObj, _iterator, _step, _key, gotIndex, gotId, tempusers;
|
|
588
588
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
589
589
|
while (1) switch (_context13.prev = _context13.next) {
|
|
590
590
|
case 0:
|
|
591
591
|
_parseObj = function _parseObj3() {
|
|
592
592
|
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key, obj) {
|
|
593
|
-
var _p,
|
|
593
|
+
var _p, keydot, child_changeableKeys, newobj_dlt;
|
|
594
594
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
595
595
|
while (1) switch (_context12.prev = _context12.next) {
|
|
596
596
|
case 0:
|
|
@@ -611,7 +611,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
611
611
|
while (1) switch (_context11.prev = _context11.next) {
|
|
612
612
|
case 0:
|
|
613
613
|
_context11.next = 2;
|
|
614
|
-
return parseObj(
|
|
614
|
+
return parseObj(key, r);
|
|
615
615
|
case 2:
|
|
616
616
|
return _context11.abrupt("return", _context11.sent);
|
|
617
617
|
case 3:
|
|
@@ -628,30 +628,33 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
628
628
|
return _context12.abrupt("return", _context12.sent);
|
|
629
629
|
case 6:
|
|
630
630
|
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
631
|
-
_context12.next =
|
|
631
|
+
_context12.next = 17;
|
|
632
632
|
break;
|
|
633
633
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
/* -------------------- parse changeableKeys for children -------------------- */
|
|
635
|
+
keydot = "".concat(key, ".");
|
|
636
|
+
child_changeableKeys = (_p = p) === null || _p === void 0 || (_p = _p.changeableKeys) === null || _p === void 0 ? void 0 : _p.filter(function (s) {
|
|
637
|
+
return s.startsWith(keydot);
|
|
638
|
+
}).map(function (r) {
|
|
639
|
+
return r.substring(keydot.length);
|
|
640
|
+
}); //child elements have different kind of delta
|
|
641
|
+
_context12.next = 11;
|
|
639
642
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
640
643
|
isChild: true,
|
|
641
|
-
|
|
644
|
+
changeableKeys: child_changeableKeys
|
|
642
645
|
}));
|
|
643
|
-
case
|
|
646
|
+
case 11:
|
|
644
647
|
newobj_dlt = _context12.sent;
|
|
645
648
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
646
|
-
_context12.next =
|
|
649
|
+
_context12.next = 16;
|
|
647
650
|
break;
|
|
648
651
|
}
|
|
649
652
|
return _context12.abrupt("return", newobj_dlt);
|
|
650
|
-
case 15:
|
|
651
|
-
return _context12.abrupt("return", obj);
|
|
652
653
|
case 16:
|
|
653
654
|
return _context12.abrupt("return", obj);
|
|
654
655
|
case 17:
|
|
656
|
+
return _context12.abrupt("return", obj);
|
|
657
|
+
case 18:
|
|
655
658
|
case "end":
|
|
656
659
|
return _context12.stop();
|
|
657
660
|
}
|
|
@@ -699,16 +702,16 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
699
702
|
* get keys that can be changed.
|
|
700
703
|
* intersection of keys in delta and keys that are defined as changeable
|
|
701
704
|
*/
|
|
702
|
-
|
|
703
|
-
if (p.
|
|
704
|
-
|
|
705
|
+
changeableKeys = (0, _object.array_intersection)(Object.keys(changedFields), WebObject.getChangeableKeys(this, p));
|
|
706
|
+
if (p.changeableKeys) {
|
|
707
|
+
changeableKeys = (0, _object.array_intersection)(changeableKeys, p.changeableKeys);
|
|
705
708
|
}
|
|
706
709
|
_convert["default"].format({
|
|
707
710
|
original: this,
|
|
708
711
|
inputobject: changedFields,
|
|
709
712
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
710
713
|
isNew: this.isNew,
|
|
711
|
-
|
|
714
|
+
changeableKeys: changeableKeys,
|
|
712
715
|
applyDefaults: true
|
|
713
716
|
});
|
|
714
717
|
/* -------------------------------------------------------------------------- */
|
|
@@ -720,9 +723,9 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
720
723
|
if (changedFields[fp]) changedFields[fp] = (0, _object.fn_eval_this)(this, changedFields[fp]);
|
|
721
724
|
}
|
|
722
725
|
/* -------------------------------------------------------------------------- */
|
|
723
|
-
/* parse all
|
|
726
|
+
/* parse all changeableKeys */
|
|
724
727
|
/* -------------------------------------------------------------------------- */
|
|
725
|
-
_iterator = _createForOfIteratorHelper(
|
|
728
|
+
_iterator = _createForOfIteratorHelper(changeableKeys);
|
|
726
729
|
_context13.prev = 20;
|
|
727
730
|
_iterator.s();
|
|
728
731
|
case 22:
|
|
@@ -916,7 +916,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
916
916
|
if (!orig) return false; //we dont know if anything has changed
|
|
917
917
|
/**
|
|
918
918
|
* if object is not using delta mode,
|
|
919
|
-
* check changes by comparing
|
|
919
|
+
* check changes by comparing changeable fields with original object
|
|
920
920
|
*/
|
|
921
921
|
if (Array.isArray(this.__changeables)) {
|
|
922
922
|
return this.__changeables.find(function (c) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/webobject",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.44",
|
|
4
4
|
"description": "Stateful object",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@azrico/uid": "*"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@azrico/convert": "^1.1.
|
|
72
|
+
"@azrico/convert": "^1.1.7",
|
|
73
73
|
"@azrico/event": "^1.2.67",
|
|
74
74
|
"@azrico/global": "^1.3.85",
|
|
75
75
|
"@azrico/math": "^1.0.5",
|