@azrico/webobject 1.5.42 → 1.5.45
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, _child_changeableKeys, 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,42 @@ 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 = 18;
|
|
632
632
|
break;
|
|
633
633
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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);
|
|
637
640
|
});
|
|
638
|
-
|
|
641
|
+
/**
|
|
642
|
+
* if no key is set for children consider it as undefined
|
|
643
|
+
* if we send the empty array to get_delta we get no keys
|
|
644
|
+
*/
|
|
645
|
+
if (child_changeableKeys == null || ((_child_changeableKeys = child_changeableKeys) === null || _child_changeableKeys === void 0 ? void 0 : _child_changeableKeys.length) === 0) {
|
|
646
|
+
child_changeableKeys = undefined;
|
|
647
|
+
}
|
|
648
|
+
/* -------------------------------------------------------------------------- */
|
|
649
|
+
//child elements have different kind of delta
|
|
650
|
+
_context12.next = 12;
|
|
639
651
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
640
652
|
isChild: true,
|
|
641
|
-
|
|
653
|
+
changeableKeys: child_changeableKeys
|
|
642
654
|
}));
|
|
643
|
-
case
|
|
655
|
+
case 12:
|
|
644
656
|
newobj_dlt = _context12.sent;
|
|
645
657
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
646
|
-
_context12.next =
|
|
658
|
+
_context12.next = 17;
|
|
647
659
|
break;
|
|
648
660
|
}
|
|
649
661
|
return _context12.abrupt("return", newobj_dlt);
|
|
650
|
-
case
|
|
662
|
+
case 17:
|
|
651
663
|
return _context12.abrupt("return", obj);
|
|
652
|
-
case
|
|
664
|
+
case 18:
|
|
653
665
|
return _context12.abrupt("return", obj);
|
|
654
|
-
case
|
|
666
|
+
case 19:
|
|
655
667
|
case "end":
|
|
656
668
|
return _context12.stop();
|
|
657
669
|
}
|
|
@@ -699,16 +711,16 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
699
711
|
* get keys that can be changed.
|
|
700
712
|
* intersection of keys in delta and keys that are defined as changeable
|
|
701
713
|
*/
|
|
702
|
-
|
|
703
|
-
if (p.
|
|
704
|
-
|
|
714
|
+
changeableKeys = (0, _object.array_intersection)(Object.keys(changedFields), WebObject.getChangeableKeys(this, p));
|
|
715
|
+
if (p.changeableKeys) {
|
|
716
|
+
changeableKeys = (0, _object.array_intersection)(changeableKeys, p.changeableKeys);
|
|
705
717
|
}
|
|
706
718
|
_convert["default"].format({
|
|
707
719
|
original: this,
|
|
708
720
|
inputobject: changedFields,
|
|
709
721
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
710
722
|
isNew: this.isNew,
|
|
711
|
-
|
|
723
|
+
changeableKeys: changeableKeys,
|
|
712
724
|
applyDefaults: true
|
|
713
725
|
});
|
|
714
726
|
/* -------------------------------------------------------------------------- */
|
|
@@ -720,9 +732,9 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
720
732
|
if (changedFields[fp]) changedFields[fp] = (0, _object.fn_eval_this)(this, changedFields[fp]);
|
|
721
733
|
}
|
|
722
734
|
/* -------------------------------------------------------------------------- */
|
|
723
|
-
/* parse all
|
|
735
|
+
/* parse all changeableKeys */
|
|
724
736
|
/* -------------------------------------------------------------------------- */
|
|
725
|
-
_iterator = _createForOfIteratorHelper(
|
|
737
|
+
_iterator = _createForOfIteratorHelper(changeableKeys);
|
|
726
738
|
_context13.prev = 20;
|
|
727
739
|
_iterator.s();
|
|
728
740
|
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.45",
|
|
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",
|