dataflux 1.14.4 → 1.14.5

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/BasicObj.js CHANGED
@@ -12,15 +12,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
12
12
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
13
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
16
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
17
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
18
18
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
19
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
20
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
21
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
22
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
23
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
19
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
20
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
21
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
24
22
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /*
25
23
  * MIT License
26
24
  *
@@ -76,61 +74,49 @@ var BasicObj = exports.BasicObj = /*#__PURE__*/function () {
76
74
  function BasicObj(values, model) {
77
75
  var _this = this;
78
76
  _classCallCheck(this, BasicObj);
79
- _classPrivateFieldInitSpec(this, _setHidden, {
80
- writable: true,
81
- value: {}
82
- });
83
- _classPrivateFieldInitSpec(this, _id, {
84
- writable: true,
85
- value: null
86
- });
87
- _classPrivateFieldInitSpec(this, _error, {
88
- writable: true,
89
- value: {}
90
- });
91
- _classPrivateFieldInitSpec(this, _model, {
92
- writable: true,
93
- value: void 0
94
- });
77
+ _classPrivateFieldInitSpec(this, _setHidden, {});
78
+ _classPrivateFieldInitSpec(this, _id, null);
79
+ _classPrivateFieldInitSpec(this, _error, {});
80
+ _classPrivateFieldInitSpec(this, _model, void 0);
95
81
  _defineProperty(this, "setId", function (id) {
96
82
  _this.id = id;
97
83
  });
98
84
  _defineProperty(this, "getId", function () {
99
- if (!_classPrivateFieldGet(_this, _id)) {
85
+ if (!_classPrivateFieldGet(_id, _this)) {
100
86
  if (_this.id != null && (typeof _this.id === "string" || typeof _this.id === "number")) {
101
- _classPrivateFieldSet(_this, _id, _this.id.toString());
87
+ _classPrivateFieldSet(_id, _this, _this.id.toString());
102
88
  delete _this.setId;
103
89
  } else {
104
- _classPrivateFieldSet(_this, _id, (0, _uuid.v4)());
90
+ _classPrivateFieldSet(_id, _this, (0, _uuid.v4)());
105
91
  }
106
92
  }
107
- return _classPrivateFieldGet(_this, _id);
93
+ return _classPrivateFieldGet(_id, _this);
108
94
  });
109
95
  _defineProperty(this, "get", function (attribute, defaultValue) {
110
96
  var _ref, _classPrivateFieldGet2;
111
- return (_ref = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this, _setHidden)[attribute]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _this[attribute]) !== null && _ref !== void 0 ? _ref : defaultValue;
97
+ return (_ref = (_classPrivateFieldGet2 = _classPrivateFieldGet(_setHidden, _this)[attribute]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _this[attribute]) !== null && _ref !== void 0 ? _ref : defaultValue;
112
98
  });
113
99
  _defineProperty(this, "getError", function () {
114
100
  var _classPrivateFieldGet3;
115
101
  var attribute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
116
102
  var key = attribute ? attribute : globalError;
117
- return (_classPrivateFieldGet3 = _classPrivateFieldGet(_this, _error)[key]) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : false;
103
+ return (_classPrivateFieldGet3 = _classPrivateFieldGet(_error, _this)[key]) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : false;
118
104
  });
119
105
  _defineProperty(this, "setError", function (error) {
120
106
  var attribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
121
107
  if (error && attribute) {
122
- _classPrivateFieldGet(_this, _error)[attribute] = error;
108
+ _classPrivateFieldGet(_error, _this)[attribute] = error;
123
109
  } else if (error && !attribute) {
124
- _classPrivateFieldGet(_this, _error)[globalError] = error;
110
+ _classPrivateFieldGet(_error, _this)[globalError] = error;
125
111
  } else if (!error && attribute) {
126
- delete _classPrivateFieldGet(_this, _error)[attribute];
112
+ delete _classPrivateFieldGet(_error, _this)[attribute];
127
113
  } else {
128
- _classPrivateFieldSet(_this, _error, {});
114
+ _classPrivateFieldSet(_error, _this, {});
129
115
  }
130
116
  });
131
117
  _defineProperty(this, "setConstant", function (attribute, value) {
132
118
  var _classPrivateFieldGet4;
133
- _classPrivateFieldGet(_this, _setHidden)[attribute] = (_classPrivateFieldGet4 = _classPrivateFieldGet(_this, _setHidden)[attribute]) !== null && _classPrivateFieldGet4 !== void 0 ? _classPrivateFieldGet4 : value;
119
+ _classPrivateFieldGet(_setHidden, _this)[attribute] = (_classPrivateFieldGet4 = _classPrivateFieldGet(_setHidden, _this)[attribute]) !== null && _classPrivateFieldGet4 !== void 0 ? _classPrivateFieldGet4 : value;
134
120
  });
135
121
  _defineProperty(this, "toJSON", function () {
136
122
  var attrs = Object.keys(_this);
@@ -163,22 +149,21 @@ var BasicObj = exports.BasicObj = /*#__PURE__*/function () {
163
149
  _defineProperty(this, "update", function () {
164
150
  return Promise.resolve();
165
151
  });
166
- _classPrivateFieldSet(this, _model, model);
152
+ _classPrivateFieldSet(_model, this, model);
167
153
  }
168
- _createClass(BasicObj, [{
154
+ return _createClass(BasicObj, [{
169
155
  key: "set",
170
156
  value: function set(attribute, value, hidden) {
171
157
  if (hidden) {
172
- _classPrivateFieldGet(this, _setHidden)[attribute] = value;
158
+ _classPrivateFieldGet(_setHidden, this)[attribute] = value;
173
159
  } else {
174
160
  if (attribute === "id") {
175
161
  throw new Error("You cannot change the ID");
176
162
  }
177
163
  this[attribute] = value;
178
- _classPrivateFieldGet(this, _model).validateObjectAttribute(this, attribute);
164
+ _classPrivateFieldGet(_model, this).validateObjectAttribute(this, attribute);
179
165
  }
180
166
  return this.update();
181
167
  }
182
168
  }]);
183
- return BasicObj;
184
169
  }();