@azrico/webobject 1.5.41 → 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
|
-
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(obj) {
|
|
593
|
-
var newobj_dlt;
|
|
592
|
+
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key, obj) {
|
|
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:
|
|
@@ -606,12 +606,12 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
606
606
|
}
|
|
607
607
|
_context12.next = 5;
|
|
608
608
|
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
609
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(r) {
|
|
609
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(r, i) {
|
|
610
610
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
611
611
|
while (1) switch (_context11.prev = _context11.next) {
|
|
612
612
|
case 0:
|
|
613
613
|
_context11.next = 2;
|
|
614
|
-
return parseObj(r);
|
|
614
|
+
return parseObj(key, r);
|
|
615
615
|
case 2:
|
|
616
616
|
return _context11.abrupt("return", _context11.sent);
|
|
617
617
|
case 3:
|
|
@@ -620,7 +620,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
620
620
|
}
|
|
621
621
|
}, _callee11);
|
|
622
622
|
}));
|
|
623
|
-
return function (
|
|
623
|
+
return function (_x8, _x9) {
|
|
624
624
|
return _ref.apply(this, arguments);
|
|
625
625
|
};
|
|
626
626
|
}()));
|
|
@@ -628,25 +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
|
-
|
|
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;
|
|
635
642
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
636
|
-
isChild: true
|
|
643
|
+
isChild: true,
|
|
644
|
+
changeableKeys: child_changeableKeys
|
|
637
645
|
}));
|
|
638
|
-
case
|
|
646
|
+
case 11:
|
|
639
647
|
newobj_dlt = _context12.sent;
|
|
640
648
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
641
|
-
_context12.next =
|
|
649
|
+
_context12.next = 16;
|
|
642
650
|
break;
|
|
643
651
|
}
|
|
644
652
|
return _context12.abrupt("return", newobj_dlt);
|
|
645
|
-
case
|
|
653
|
+
case 16:
|
|
646
654
|
return _context12.abrupt("return", obj);
|
|
647
|
-
case
|
|
655
|
+
case 17:
|
|
648
656
|
return _context12.abrupt("return", obj);
|
|
649
|
-
case
|
|
657
|
+
case 18:
|
|
650
658
|
case "end":
|
|
651
659
|
return _context12.stop();
|
|
652
660
|
}
|
|
@@ -654,7 +662,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
654
662
|
}));
|
|
655
663
|
return _parseObj.apply(this, arguments);
|
|
656
664
|
};
|
|
657
|
-
parseObj = function _parseObj2(_x6) {
|
|
665
|
+
parseObj = function _parseObj2(_x6, _x7) {
|
|
658
666
|
return _parseObj.apply(this, arguments);
|
|
659
667
|
};
|
|
660
668
|
if (!p) p = {};
|
|
@@ -694,16 +702,16 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
694
702
|
* get keys that can be changed.
|
|
695
703
|
* intersection of keys in delta and keys that are defined as changeable
|
|
696
704
|
*/
|
|
697
|
-
|
|
698
|
-
if (p.
|
|
699
|
-
|
|
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);
|
|
700
708
|
}
|
|
701
709
|
_convert["default"].format({
|
|
702
710
|
original: this,
|
|
703
711
|
inputobject: changedFields,
|
|
704
712
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
705
713
|
isNew: this.isNew,
|
|
706
|
-
|
|
714
|
+
changeableKeys: changeableKeys,
|
|
707
715
|
applyDefaults: true
|
|
708
716
|
});
|
|
709
717
|
/* -------------------------------------------------------------------------- */
|
|
@@ -715,9 +723,9 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
715
723
|
if (changedFields[fp]) changedFields[fp] = (0, _object.fn_eval_this)(this, changedFields[fp]);
|
|
716
724
|
}
|
|
717
725
|
/* -------------------------------------------------------------------------- */
|
|
718
|
-
/* parse all
|
|
726
|
+
/* parse all changeableKeys */
|
|
719
727
|
/* -------------------------------------------------------------------------- */
|
|
720
|
-
_iterator = _createForOfIteratorHelper(
|
|
728
|
+
_iterator = _createForOfIteratorHelper(changeableKeys);
|
|
721
729
|
_context13.prev = 20;
|
|
722
730
|
_iterator.s();
|
|
723
731
|
case 22:
|
|
@@ -727,7 +735,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
727
735
|
}
|
|
728
736
|
_key = _step.value;
|
|
729
737
|
_context13.next = 26;
|
|
730
|
-
return parseObj(changedFields[_key]);
|
|
738
|
+
return parseObj(_key, changedFields[_key]);
|
|
731
739
|
case 26:
|
|
732
740
|
final_object[_key] = _context13.sent;
|
|
733
741
|
case 27:
|
|
@@ -1275,7 +1283,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1275
1283
|
}
|
|
1276
1284
|
}, _callee23, this);
|
|
1277
1285
|
}));
|
|
1278
|
-
function saveList(
|
|
1286
|
+
function saveList(_x10) {
|
|
1279
1287
|
return _saveList.apply(this, arguments);
|
|
1280
1288
|
}
|
|
1281
1289
|
return saveList;
|
|
@@ -1503,7 +1511,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1503
1511
|
}
|
|
1504
1512
|
}, _callee27, this);
|
|
1505
1513
|
}));
|
|
1506
|
-
function get_list_cache(
|
|
1514
|
+
function get_list_cache(_x11) {
|
|
1507
1515
|
return _get_list_cache.apply(this, arguments);
|
|
1508
1516
|
}
|
|
1509
1517
|
return get_list_cache;
|
|
@@ -1534,7 +1542,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1534
1542
|
}
|
|
1535
1543
|
}, _callee28, this);
|
|
1536
1544
|
}));
|
|
1537
|
-
function get_single_cache(
|
|
1545
|
+
function get_single_cache(_x12) {
|
|
1538
1546
|
return _get_single_cache.apply(this, arguments);
|
|
1539
1547
|
}
|
|
1540
1548
|
return get_single_cache;
|
|
@@ -1574,7 +1582,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1574
1582
|
}
|
|
1575
1583
|
}, _callee29);
|
|
1576
1584
|
}));
|
|
1577
|
-
return function (
|
|
1585
|
+
return function (_x13) {
|
|
1578
1586
|
return _ref3.apply(this, arguments);
|
|
1579
1587
|
};
|
|
1580
1588
|
}()));
|
|
@@ -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",
|