dataflux 1.18.5 → 1.18.7

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/dist/Obj.js CHANGED
@@ -74,22 +74,26 @@ var Obj = exports["default"] = /*#__PURE__*/function (_BasicObj) {
74
74
  _defineProperty(_this, "shouldLoad", function () {
75
75
  var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
76
76
  if (reset === null) {
77
- return !!_classPrivateFieldGet(_loaded, _this);
77
+ return !_classPrivateFieldGet(_loaded, _this);
78
78
  } else {
79
79
  _classPrivateFieldSet(_loaded, _this, false);
80
80
  }
81
81
  });
82
82
  _defineProperty(_this, "load", function () {
83
- if (!_classPrivateFieldGet(_loaded, _this)) {
84
- var model = _this.getModel();
85
- _classPrivateFieldSet(_loaded, _this, model.load(_this).then(function () {
86
- return model.getStore().update([_this], true);
87
- }) // Propagate update
88
- .then(function () {
89
- return _this;
90
- })); // return always this
83
+ if (_this.isMock()) {
84
+ return Promise.reject("You cannot perform load on a mock object. Use factory instead.");
85
+ } else {
86
+ if (!_classPrivateFieldGet(_loaded, _this)) {
87
+ var model = _this.getModel();
88
+ _classPrivateFieldSet(_loaded, _this, model.load(_this).then(function () {
89
+ return model.getStore().update([_this], true);
90
+ }) // Propagate update
91
+ .then(function () {
92
+ return _this;
93
+ })); // return always this
94
+ }
95
+ return _classPrivateFieldGet(_loaded, _this);
91
96
  }
92
- return _classPrivateFieldGet(_loaded, _this);
93
97
  });
94
98
  _defineProperty(_this, "getFingerprint", function () {
95
99
  return (0, _objectFingerprint["default"])(_this.toJSON()).toString();