@azrico/webobject 1.5.37 → 1.5.40
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.
|
@@ -695,15 +695,14 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
695
695
|
* intersection of keys in delta and keys that are defined as changeable
|
|
696
696
|
*/
|
|
697
697
|
changableKeys = (0, _object.array_intersection)(Object.keys(changedFields), WebObject.getChangeableKeys(this, p));
|
|
698
|
-
|
|
699
|
-
|
|
698
|
+
_convert["default"].format({
|
|
699
|
+
original: this,
|
|
700
700
|
inputobject: changedFields,
|
|
701
701
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
702
702
|
isNew: this.isNew,
|
|
703
703
|
changableKeys: changableKeys,
|
|
704
704
|
applyDefaults: true
|
|
705
705
|
});
|
|
706
|
-
case 17:
|
|
707
706
|
/* -------------------------------------------------------------------------- */
|
|
708
707
|
/* __functionProperties */
|
|
709
708
|
/* -------------------------------------------------------------------------- */
|
|
@@ -716,33 +715,33 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
716
715
|
/* parse all changableKeys */
|
|
717
716
|
/* -------------------------------------------------------------------------- */
|
|
718
717
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
719
|
-
_context13.prev =
|
|
718
|
+
_context13.prev = 19;
|
|
720
719
|
_iterator.s();
|
|
721
|
-
case
|
|
720
|
+
case 21:
|
|
722
721
|
if ((_step = _iterator.n()).done) {
|
|
723
|
-
_context13.next =
|
|
722
|
+
_context13.next = 28;
|
|
724
723
|
break;
|
|
725
724
|
}
|
|
726
725
|
_key = _step.value;
|
|
727
|
-
_context13.next =
|
|
726
|
+
_context13.next = 25;
|
|
728
727
|
return parseObj(changedFields[_key]);
|
|
729
|
-
case
|
|
728
|
+
case 25:
|
|
730
729
|
final_object[_key] = _context13.sent;
|
|
731
|
-
case
|
|
732
|
-
_context13.next =
|
|
730
|
+
case 26:
|
|
731
|
+
_context13.next = 21;
|
|
733
732
|
break;
|
|
734
|
-
case
|
|
735
|
-
_context13.next =
|
|
733
|
+
case 28:
|
|
734
|
+
_context13.next = 33;
|
|
736
735
|
break;
|
|
737
|
-
case
|
|
738
|
-
_context13.prev =
|
|
739
|
-
_context13.t2 = _context13["catch"](
|
|
736
|
+
case 30:
|
|
737
|
+
_context13.prev = 30;
|
|
738
|
+
_context13.t2 = _context13["catch"](19);
|
|
740
739
|
_iterator.e(_context13.t2);
|
|
741
|
-
case
|
|
742
|
-
_context13.prev =
|
|
740
|
+
case 33:
|
|
741
|
+
_context13.prev = 33;
|
|
743
742
|
_iterator.f();
|
|
744
|
-
return _context13.finish(
|
|
745
|
-
case
|
|
743
|
+
return _context13.finish(33);
|
|
744
|
+
case 36:
|
|
746
745
|
/* -------------------- add acrhived and date properties -------------------- */
|
|
747
746
|
if (p.allProperties) {
|
|
748
747
|
final_object["_created_date"] = this["_created_date"];
|
|
@@ -768,17 +767,17 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
768
767
|
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
769
768
|
}
|
|
770
769
|
if (!p.clean) {
|
|
771
|
-
_context13.next =
|
|
770
|
+
_context13.next = 41;
|
|
772
771
|
break;
|
|
773
772
|
}
|
|
774
773
|
return _context13.abrupt("return", (0, _object.object_clean)(final_object, false, true));
|
|
775
|
-
case
|
|
774
|
+
case 41:
|
|
776
775
|
return _context13.abrupt("return", final_object);
|
|
777
|
-
case
|
|
776
|
+
case 42:
|
|
778
777
|
case "end":
|
|
779
778
|
return _context13.stop();
|
|
780
779
|
}
|
|
781
|
-
}, _callee13, this, [[
|
|
780
|
+
}, _callee13, this, [[19, 30, 33, 36]]);
|
|
782
781
|
}));
|
|
783
782
|
function get_deltaObject(_x5) {
|
|
784
783
|
return _get_deltaObject.apply(this, arguments);
|
|
@@ -197,16 +197,18 @@ export declare class SimpleObject extends MapableObject {
|
|
|
197
197
|
* set the value to its original
|
|
198
198
|
* @param key
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
|
|
201
201
|
/**
|
|
202
202
|
* reset all values back to their original
|
|
203
|
-
*
|
|
203
|
+
*
|
|
204
|
+
* this function also calls `on_change` and then `clear_changes`
|
|
204
205
|
* @param key
|
|
205
206
|
*/
|
|
206
|
-
|
|
207
|
+
discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
|
|
207
208
|
/**
|
|
208
209
|
* clear and discard all changes
|
|
209
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* does not call `on_change` functions
|
|
210
212
|
* @returns
|
|
211
213
|
*/
|
|
212
214
|
clear_changes(): boolean;
|
|
@@ -772,49 +772,54 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
772
772
|
* @param key
|
|
773
773
|
*/
|
|
774
774
|
}, {
|
|
775
|
-
key: "
|
|
775
|
+
key: "discard",
|
|
776
776
|
value: (function () {
|
|
777
|
-
var
|
|
777
|
+
var _discard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(key) {
|
|
778
778
|
var shouldNotify,
|
|
779
|
+
originalValue,
|
|
779
780
|
_args13 = arguments;
|
|
780
781
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
781
782
|
while (1) switch (_context13.prev = _context13.next) {
|
|
782
783
|
case 0:
|
|
783
784
|
shouldNotify = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : "auto";
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
785
|
+
if (this.__use_delta) {
|
|
786
|
+
originalValue = this[key];
|
|
787
|
+
} else if (this.__originalobject) originalValue = this.__originalobject[key];else originalValue = this[key];
|
|
788
|
+
_context13.next = 4;
|
|
789
|
+
return this.set(key, originalValue, shouldNotify);
|
|
788
790
|
case 4:
|
|
791
|
+
return _context13.abrupt("return", _context13.sent);
|
|
792
|
+
case 5:
|
|
789
793
|
case "end":
|
|
790
794
|
return _context13.stop();
|
|
791
795
|
}
|
|
792
796
|
}, _callee13, this);
|
|
793
797
|
}));
|
|
794
|
-
function
|
|
795
|
-
return
|
|
798
|
+
function discard(_x22) {
|
|
799
|
+
return _discard.apply(this, arguments);
|
|
796
800
|
}
|
|
797
|
-
return
|
|
801
|
+
return discard;
|
|
798
802
|
}()
|
|
799
803
|
/**
|
|
800
804
|
* reset all values back to their original
|
|
801
|
-
*
|
|
805
|
+
*
|
|
806
|
+
* this function also calls `on_change` and then `clear_changes`
|
|
802
807
|
* @param key
|
|
803
808
|
*/
|
|
804
809
|
)
|
|
805
810
|
}, {
|
|
806
|
-
key: "
|
|
811
|
+
key: "discardAll",
|
|
807
812
|
value: (function () {
|
|
808
|
-
var
|
|
813
|
+
var _discardAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
809
814
|
var shouldNotify,
|
|
810
|
-
|
|
815
|
+
final_result,
|
|
811
816
|
key,
|
|
812
817
|
_args14 = arguments;
|
|
813
818
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
814
819
|
while (1) switch (_context14.prev = _context14.next) {
|
|
815
820
|
case 0:
|
|
816
821
|
shouldNotify = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : "auto";
|
|
817
|
-
|
|
822
|
+
final_result = true;
|
|
818
823
|
_context14.t0 = _regeneratorRuntime().keys(this.__delta);
|
|
819
824
|
case 3:
|
|
820
825
|
if ((_context14.t1 = _context14.t0()).done) {
|
|
@@ -822,35 +827,37 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
822
827
|
break;
|
|
823
828
|
}
|
|
824
829
|
key = _context14.t1.value;
|
|
825
|
-
_context14.t2 =
|
|
830
|
+
_context14.t2 = final_result;
|
|
826
831
|
if (!_context14.t2) {
|
|
827
832
|
_context14.next = 10;
|
|
828
833
|
break;
|
|
829
834
|
}
|
|
830
835
|
_context14.next = 9;
|
|
831
|
-
return this.
|
|
836
|
+
return this.discard(key, shouldNotify);
|
|
832
837
|
case 9:
|
|
833
838
|
_context14.t2 = _context14.sent;
|
|
834
839
|
case 10:
|
|
835
|
-
|
|
840
|
+
final_result = _context14.t2;
|
|
836
841
|
_context14.next = 3;
|
|
837
842
|
break;
|
|
838
843
|
case 13:
|
|
839
|
-
|
|
840
|
-
|
|
844
|
+
if (final_result) this.clear_changes();
|
|
845
|
+
return _context14.abrupt("return", final_result);
|
|
846
|
+
case 15:
|
|
841
847
|
case "end":
|
|
842
848
|
return _context14.stop();
|
|
843
849
|
}
|
|
844
850
|
}, _callee14, this);
|
|
845
851
|
}));
|
|
846
|
-
function
|
|
847
|
-
return
|
|
852
|
+
function discardAll() {
|
|
853
|
+
return _discardAll.apply(this, arguments);
|
|
848
854
|
}
|
|
849
|
-
return
|
|
855
|
+
return discardAll;
|
|
850
856
|
}()
|
|
851
857
|
/**
|
|
852
858
|
* clear and discard all changes
|
|
853
|
-
*
|
|
859
|
+
*
|
|
860
|
+
* does not call `on_change` functions
|
|
854
861
|
* @returns
|
|
855
862
|
*/
|
|
856
863
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/webobject",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.40",
|
|
4
4
|
"description": "Stateful object",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"@azrico/uid": "*"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@azrico/convert": "^1.
|
|
73
|
-
"@azrico/event": "^1.2.
|
|
72
|
+
"@azrico/convert": "^1.1.3",
|
|
73
|
+
"@azrico/event": "^1.2.67",
|
|
74
74
|
"@azrico/global": "^1.3.85",
|
|
75
75
|
"@azrico/math": "^1.0.5",
|
|
76
|
-
"@azrico/object": "^1.4.
|
|
77
|
-
"@azrico/string": "^1.3.
|
|
76
|
+
"@azrico/object": "^1.4.135",
|
|
77
|
+
"@azrico/string": "^1.3.7",
|
|
78
78
|
"@azrico/types": "^1.0.11",
|
|
79
79
|
"@azrico/uid": "^1.0.8"
|
|
80
80
|
},
|