@azrico/webobject 1.4.117 → 1.4.119

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.
@@ -751,6 +751,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
751
751
  }], [{
752
752
  key: "getAllUsers",
753
753
  value: function getAllUsers(obj) {
754
+ if (_typeof(obj) != "object") return [];
754
755
  return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)).map(function (r) {
755
756
  return String(_typeof(r) === "object" ? WebObject.getID(r) : r);
756
757
  }).filter(function (s) {
@@ -32,6 +32,9 @@ export declare class SimpleObject extends MapableObject {
32
32
  _deletedBy?: string;
33
33
  protected __errors?: any[];
34
34
  protected __showErrors?: boolean;
35
+ protected __refresh_functions?: {
36
+ [key: string]: any;
37
+ };
35
38
  protected __saveResultObject?: any;
36
39
  protected __saveResultIsSuccess: boolean;
37
40
  protected __saveResultType?: saveResultType;
@@ -52,6 +55,9 @@ export declare class SimpleObject extends MapableObject {
52
55
  setValue(key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType): Promise<boolean>;
53
56
  set: (key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
54
57
  setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
58
+ clearRefreshFunction(): Promise<void>;
59
+ addRefreshFunction(key: string, new_fnc: any): Promise<void>;
60
+ runRefreshFunction(...params: any): Promise<void>;
55
61
  setAll<K extends WriteablePropOf<this>>(setObj: {
56
62
  [key in K]: any;
57
63
  }): Promise<boolean>;
@@ -10,7 +10,6 @@ var _global = require("@azrico/global");
10
10
  var _MapableObject2 = require("./MapableObject");
11
11
  var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
- 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); }
14
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
15
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -19,6 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
19
18
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
19
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
20
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
+ 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); }
22
22
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
23
23
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
24
24
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -46,7 +46,7 @@ var _setProperty = /*#__PURE__*/new WeakSet();
46
46
  var _setDefaultProperty = /*#__PURE__*/new WeakSet();
47
47
  var _getProperty = /*#__PURE__*/new WeakSet();
48
48
  var _setSaveResultObject = /*#__PURE__*/new WeakSet();
49
- var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _setAll, _setSubValue, _pushValue, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
49
+ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _clearRefreshFunction, _addRefreshFunction, _runRefreshFunction, _setAll, _setSubValue, _pushValue, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
50
50
  _inherits(SimpleObject, _MapableObject);
51
51
  var _super = _createSuper(SimpleObject);
52
52
  function SimpleObject() {
@@ -83,6 +83,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
83
83
  //errors
84
84
  _defineProperty(_assertThisInitialized(_this), "__errors", void 0);
85
85
  _defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
86
+ //refresh func
87
+ _defineProperty(_assertThisInitialized(_this), "__refresh_functions", void 0);
86
88
  //save results
87
89
  _defineProperty(_assertThisInitialized(_this), "__saveResultObject", void 0);
88
90
  _defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", true);
@@ -213,41 +215,116 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
213
215
  }
214
216
  }, _callee2, this);
215
217
  }))).apply(this, arguments);
218
+ } /* ---------------------------- refresh functions --------------------------- */
219
+ }, {
220
+ key: "clearRefreshFunction",
221
+ value: function clearRefreshFunction() {
222
+ return (_clearRefreshFunction = _clearRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
223
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
224
+ while (1) switch (_context3.prev = _context3.next) {
225
+ case 0:
226
+ this.__refresh_functions = {};
227
+ case 1:
228
+ case "end":
229
+ return _context3.stop();
230
+ }
231
+ }, _callee3, this);
232
+ }))).apply(this, arguments);
216
233
  }
234
+ }, {
235
+ key: "addRefreshFunction",
236
+ value: function addRefreshFunction(_x5, _x6) {
237
+ return (_addRefreshFunction = _addRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, new_fnc) {
238
+ var oldFunctions;
239
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
240
+ while (1) switch (_context4.prev = _context4.next) {
241
+ case 0:
242
+ oldFunctions = this.__refresh_functions;
243
+ if (oldFunctions == null || _typeof(oldFunctions) !== "object") oldFunctions = {};
244
+ oldFunctions[key] = new_fnc;
245
+ this.__refresh_functions = oldFunctions;
246
+ case 4:
247
+ case "end":
248
+ return _context4.stop();
249
+ }
250
+ }, _callee4, this);
251
+ }))).apply(this, arguments);
252
+ }
253
+ }, {
254
+ key: "runRefreshFunction",
255
+ value: function runRefreshFunction() {
256
+ return (_runRefreshFunction = _runRefreshFunction || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
257
+ var oldFunctions,
258
+ fncArray,
259
+ _len,
260
+ params,
261
+ _key,
262
+ index,
263
+ fnc,
264
+ _args5 = arguments;
265
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
266
+ while (1) switch (_context5.prev = _context5.next) {
267
+ case 0:
268
+ oldFunctions = this.__refresh_functions;
269
+ if (oldFunctions == null || _typeof(oldFunctions) !== "object") oldFunctions = {};
270
+ fncArray = Object.values(oldFunctions);
271
+ for (_len = _args5.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
272
+ params[_key] = _args5[_key];
273
+ }
274
+ index = 0;
275
+ case 5:
276
+ if (!(index < fncArray.length)) {
277
+ _context5.next = 12;
278
+ break;
279
+ }
280
+ fnc = fncArray[index];
281
+ _context5.next = 9;
282
+ return _object.fn_eval.apply(void 0, [fnc].concat(params));
283
+ case 9:
284
+ index++;
285
+ _context5.next = 5;
286
+ break;
287
+ case 12:
288
+ case "end":
289
+ return _context5.stop();
290
+ }
291
+ }, _callee5, this);
292
+ }))).apply(this, arguments);
293
+ } /* -------------------------------------------------------------------------- */
217
294
  }, {
218
295
  key: "setAll",
219
- value: function setAll(_x5) {
220
- return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(setObj) {
296
+ value: function setAll(_x7) {
297
+ return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(setObj) {
221
298
  var finalRes, key;
222
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
223
- while (1) switch (_context3.prev = _context3.next) {
299
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
300
+ while (1) switch (_context6.prev = _context6.next) {
224
301
  case 0:
225
302
  finalRes = true;
226
- _context3.t0 = _regeneratorRuntime().keys(setObj);
303
+ _context6.t0 = _regeneratorRuntime().keys(setObj);
227
304
  case 2:
228
- if ((_context3.t1 = _context3.t0()).done) {
229
- _context3.next = 10;
305
+ if ((_context6.t1 = _context6.t0()).done) {
306
+ _context6.next = 10;
230
307
  break;
231
308
  }
232
- key = _context3.t1.value;
233
- _context3.next = 6;
309
+ key = _context6.t1.value;
310
+ _context6.next = 6;
234
311
  return this.setValue(key, setObj[key]);
235
312
  case 6:
236
- if (_context3.sent) {
237
- _context3.next = 8;
313
+ if (_context6.sent) {
314
+ _context6.next = 8;
238
315
  break;
239
316
  }
240
317
  finalRes = false;
241
318
  case 8:
242
- _context3.next = 2;
319
+ _context6.next = 2;
243
320
  break;
244
321
  case 10:
245
- return _context3.abrupt("return", finalRes);
322
+ return _context6.abrupt("return", finalRes);
246
323
  case 11:
247
324
  case "end":
248
- return _context3.stop();
325
+ return _context6.stop();
249
326
  }
250
- }, _callee3, this);
327
+ }, _callee6, this);
251
328
  }))).apply(this, arguments);
252
329
  }
253
330
  /**
@@ -271,30 +348,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
271
348
  * @param subvalue
272
349
  * @return true if changed , false otherwise
273
350
  */
274
- function setSubValue(_x6, _x7, _x8) {
275
- return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, objKey, subvalue) {
351
+ function setSubValue(_x8, _x9, _x10) {
352
+ return (_setSubValue = _setSubValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, objKey, subvalue) {
276
353
  var sendChanges,
277
354
  isValueChanged,
278
355
  subval,
279
- _args4 = arguments;
280
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
281
- while (1) switch (_context4.prev = _context4.next) {
356
+ _args7 = arguments;
357
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
358
+ while (1) switch (_context7.prev = _context7.next) {
282
359
  case 0:
283
- sendChanges = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : "auto";
360
+ sendChanges = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : "auto";
284
361
  if (this.canModify) {
285
- _context4.next = 7;
362
+ _context7.next = 7;
286
363
  break;
287
364
  }
288
365
  if (!(this.__throw_errors !== false)) {
289
- _context4.next = 6;
366
+ _context7.next = 6;
290
367
  break;
291
368
  }
292
369
  throw Error("Cant use setValue when on readonly mode");
293
370
  case 6:
294
- return _context4.abrupt("return", false);
371
+ return _context7.abrupt("return", false);
295
372
  case 7:
296
373
  isValueChanged = false;
297
- _context4.prev = 8;
374
+ _context7.prev = 8;
298
375
  //if accessing subval of an object, make sure the object is not null
299
376
  subval = _classPrivateMethodGet(this, _getSubProperty, _getSubProperty2).call(this, key, objKey);
300
377
  if (!(0, _object.object_equals)(subval, subvalue, {
@@ -305,22 +382,22 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
305
382
  isValueChanged = true;
306
383
  } else isValueChanged = false;
307
384
  case 11:
308
- _context4.prev = 11;
385
+ _context7.prev = 11;
309
386
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
310
- _context4.next = 15;
387
+ _context7.next = 15;
311
388
  break;
312
389
  }
313
- _context4.next = 15;
390
+ _context7.next = 15;
314
391
  return this.notifyChanged("", key, objKey, subvalue);
315
392
  case 15:
316
- return _context4.finish(11);
393
+ return _context7.finish(11);
317
394
  case 16:
318
- return _context4.abrupt("return", isValueChanged);
395
+ return _context7.abrupt("return", isValueChanged);
319
396
  case 17:
320
397
  case "end":
321
- return _context4.stop();
398
+ return _context7.stop();
322
399
  }
323
- }, _callee4, this, [[8,, 11, 16]]);
400
+ }, _callee7, this, [[8,, 11, 16]]);
324
401
  }))).apply(this, arguments);
325
402
  }
326
403
  }, {
@@ -333,72 +410,72 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
333
410
  * @param sendChanges
334
411
  * @returns
335
412
  */
336
- function pushValue(_x9, _x10) {
337
- return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
413
+ function pushValue(_x11, _x12) {
414
+ return (_pushValue = _pushValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
338
415
  var sendChanges,
339
416
  tempArray,
340
- _args5 = arguments;
341
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
342
- while (1) switch (_context5.prev = _context5.next) {
417
+ _args8 = arguments;
418
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
419
+ while (1) switch (_context8.prev = _context8.next) {
343
420
  case 0:
344
- sendChanges = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : "auto";
421
+ sendChanges = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : "auto";
345
422
  if (!(value == null)) {
346
- _context5.next = 3;
423
+ _context8.next = 3;
347
424
  break;
348
425
  }
349
- return _context5.abrupt("return", false);
426
+ return _context8.abrupt("return", false);
350
427
  case 3:
351
428
  if (this.canModify) {
352
- _context5.next = 9;
429
+ _context8.next = 9;
353
430
  break;
354
431
  }
355
432
  if (!(this.__throw_errors !== false)) {
356
- _context5.next = 8;
433
+ _context8.next = 8;
357
434
  break;
358
435
  }
359
436
  throw Error("Cant use pushValue when on readonly mode");
360
437
  case 8:
361
- return _context5.abrupt("return", false);
438
+ return _context8.abrupt("return", false);
362
439
  case 9:
363
440
  if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
364
441
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, []);
365
442
  }
366
443
  tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
367
444
  if (Array.isArray(tempArray)) {
368
- _context5.next = 17;
445
+ _context8.next = 17;
369
446
  break;
370
447
  }
371
448
  if (!(this.__throw_errors !== false)) {
372
- _context5.next = 16;
449
+ _context8.next = 16;
373
450
  break;
374
451
  }
375
452
  throw Error("Cant use pushValue on non Array keys");
376
453
  case 16:
377
- return _context5.abrupt("return", false);
454
+ return _context8.abrupt("return", false);
378
455
  case 17:
379
456
  _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, [].concat(_toConsumableArray(tempArray), [value]));
380
457
  if (!(sendChanges === true || sendChanges === "auto")) {
381
- _context5.next = 21;
458
+ _context8.next = 21;
382
459
  break;
383
460
  }
384
- _context5.next = 21;
461
+ _context8.next = 21;
385
462
  return this.notifyChanged("", key, value);
386
463
  case 21:
387
- return _context5.abrupt("return", tempArray);
464
+ return _context8.abrupt("return", tempArray);
388
465
  case 22:
389
466
  case "end":
390
- return _context5.stop();
467
+ return _context8.stop();
391
468
  }
392
- }, _callee5, this);
469
+ }, _callee8, this);
393
470
  }))).apply(this, arguments);
394
471
  }
395
472
  }, {
396
473
  key: "notifyChanged",
397
- value: function notifyChanged(_x11, _x12, _x13, _x14) {
398
- return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(type, key, value, subvalue) {
474
+ value: function notifyChanged(_x13, _x14, _x15, _x16) {
475
+ return (_notifyChanged = _notifyChanged || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type, key, value, subvalue) {
399
476
  var lc, manager_class;
400
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
401
- while (1) switch (_context6.prev = _context6.next) {
477
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
478
+ while (1) switch (_context9.prev = _context9.next) {
402
479
  case 0:
403
480
  if (value === undefined && type == "") value = this.getValue(key);
404
481
  this.__changed = true;
@@ -413,16 +490,16 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
413
490
  /* --------------------------- notify the manager --------------------------- */
414
491
  manager_class = this.manager;
415
492
  if (!(manager_class instanceof _ObjectManager["default"])) {
416
- _context6.next = 10;
493
+ _context9.next = 10;
417
494
  break;
418
495
  }
419
- _context6.next = 10;
496
+ _context9.next = 10;
420
497
  return manager_class.notifyChanged(type, key, value, subvalue);
421
498
  case 10:
422
499
  case "end":
423
- return _context6.stop();
500
+ return _context9.stop();
424
501
  }
425
- }, _callee6, this);
502
+ }, _callee9, this);
426
503
  }))).apply(this, arguments);
427
504
  }
428
505
  /**
@@ -486,23 +563,23 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
486
563
  */
487
564
  }, {
488
565
  key: "reset",
489
- value: function reset(_x15) {
490
- return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key) {
566
+ value: function reset(_x17) {
567
+ return (_reset = _reset || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key) {
491
568
  var notifyChanged,
492
- _args7 = arguments;
493
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
494
- while (1) switch (_context7.prev = _context7.next) {
569
+ _args10 = arguments;
570
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
571
+ while (1) switch (_context10.prev = _context10.next) {
495
572
  case 0:
496
- notifyChanged = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : "auto";
497
- _context7.next = 3;
573
+ notifyChanged = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : "auto";
574
+ _context10.next = 3;
498
575
  return this.setValue(key, this[key], notifyChanged);
499
576
  case 3:
500
- return _context7.abrupt("return", _context7.sent);
577
+ return _context10.abrupt("return", _context10.sent);
501
578
  case 4:
502
579
  case "end":
503
- return _context7.stop();
580
+ return _context10.stop();
504
581
  }
505
- }, _callee7, this);
582
+ }, _callee10, this);
506
583
  }))).apply(this, arguments);
507
584
  }
508
585
  /**
@@ -513,43 +590,43 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
513
590
  }, {
514
591
  key: "resetAll",
515
592
  value: function resetAll() {
516
- return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
593
+ return (_resetAll = _resetAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
517
594
  var notifyChanged,
518
595
  fr,
519
596
  key,
520
- _args8 = arguments;
521
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
522
- while (1) switch (_context8.prev = _context8.next) {
597
+ _args11 = arguments;
598
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
599
+ while (1) switch (_context11.prev = _context11.next) {
523
600
  case 0:
524
- notifyChanged = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : "auto";
601
+ notifyChanged = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : "auto";
525
602
  fr = true;
526
- _context8.t0 = _regeneratorRuntime().keys(this.__delta);
603
+ _context11.t0 = _regeneratorRuntime().keys(this.__delta);
527
604
  case 3:
528
- if ((_context8.t1 = _context8.t0()).done) {
529
- _context8.next = 13;
605
+ if ((_context11.t1 = _context11.t0()).done) {
606
+ _context11.next = 13;
530
607
  break;
531
608
  }
532
- key = _context8.t1.value;
533
- _context8.t2 = fr;
534
- if (!_context8.t2) {
535
- _context8.next = 10;
609
+ key = _context11.t1.value;
610
+ _context11.t2 = fr;
611
+ if (!_context11.t2) {
612
+ _context11.next = 10;
536
613
  break;
537
614
  }
538
- _context8.next = 9;
615
+ _context11.next = 9;
539
616
  return this.reset(key, notifyChanged);
540
617
  case 9:
541
- _context8.t2 = _context8.sent;
618
+ _context11.t2 = _context11.sent;
542
619
  case 10:
543
- fr = _context8.t2;
544
- _context8.next = 3;
620
+ fr = _context11.t2;
621
+ _context11.next = 3;
545
622
  break;
546
623
  case 13:
547
- return _context8.abrupt("return", fr);
624
+ return _context11.abrupt("return", fr);
548
625
  case 14:
549
626
  case "end":
550
- return _context8.stop();
627
+ return _context11.stop();
551
628
  }
552
- }, _callee8, this);
629
+ }, _callee11, this);
553
630
  }))).apply(this, arguments);
554
631
  }
555
632
  /**
@@ -721,35 +798,35 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
721
798
  /* -------------------------------------------------------------------------- */
722
799
  /* Events */
723
800
  /* -------------------------------------------------------------------------- */
724
- function event_run(_x16) {
725
- return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(eventName) {
801
+ function event_run(_x18) {
802
+ return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(eventName) {
726
803
  var _this$manager;
727
- var _len,
804
+ var _len2,
728
805
  params,
729
- _key,
730
- _args9 = arguments;
731
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
732
- while (1) switch (_context9.prev = _context9.next) {
806
+ _key2,
807
+ _args12 = arguments;
808
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
809
+ while (1) switch (_context12.prev = _context12.next) {
733
810
  case 0:
734
811
  if (this.manager) {
735
- _context9.next = 3;
812
+ _context12.next = 3;
736
813
  break;
737
814
  }
738
815
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
739
- return _context9.abrupt("return");
816
+ return _context12.abrupt("return");
740
817
  case 3:
741
- for (_len = _args9.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
742
- params[_key - 1] = _args9[_key];
818
+ for (_len2 = _args12.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
819
+ params[_key2 - 1] = _args12[_key2];
743
820
  }
744
- _context9.next = 6;
821
+ _context12.next = 6;
745
822
  return (_this$manager = this.manager).event_run.apply(_this$manager, [eventName].concat(params));
746
823
  case 6:
747
- return _context9.abrupt("return", _context9.sent);
824
+ return _context12.abrupt("return", _context12.sent);
748
825
  case 7:
749
826
  case "end":
750
- return _context9.stop();
827
+ return _context12.stop();
751
828
  }
752
- }, _callee9, this);
829
+ }, _callee12, this);
753
830
  }))).apply(this, arguments);
754
831
  }
755
832
  }, {
@@ -774,30 +851,30 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
774
851
  }
775
852
  }, {
776
853
  key: "event_add",
777
- value: function event_add(_x17, _x18, _x19) {
778
- return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(name, uname, runEvent) {
854
+ value: function event_add(_x19, _x20, _x21) {
855
+ return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(name, uname, runEvent) {
779
856
  var onlyOn,
780
857
  runOnce,
781
- _args10 = arguments;
782
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
783
- while (1) switch (_context10.prev = _context10.next) {
858
+ _args13 = arguments;
859
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
860
+ while (1) switch (_context13.prev = _context13.next) {
784
861
  case 0:
785
- onlyOn = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : null;
786
- runOnce = _args10.length > 4 && _args10[4] !== undefined ? _args10[4] : false;
862
+ onlyOn = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : null;
863
+ runOnce = _args13.length > 4 && _args13[4] !== undefined ? _args13[4] : false;
787
864
  if (this.manager) {
788
- _context10.next = 5;
865
+ _context13.next = 5;
789
866
  break;
790
867
  }
791
868
  if (this.__showErrors === true) console.error("you cant use events if your object has no manager");
792
- return _context10.abrupt("return");
869
+ return _context13.abrupt("return");
793
870
  case 5:
794
- _context10.next = 7;
871
+ _context13.next = 7;
795
872
  return this.manager.event_add(name, uname, runEvent, onlyOn, runOnce);
796
873
  case 7:
797
874
  case "end":
798
- return _context10.stop();
875
+ return _context13.stop();
799
876
  }
800
- }, _callee10, this);
877
+ }, _callee13, this);
801
878
  }))).apply(this, arguments);
802
879
  }
803
880
  /* -------------------------------------------------------------------------- */
@@ -905,10 +982,10 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
905
982
  delete obj[key];
906
983
  }
907
984
  } else if (_typeof(initObject) == "object") {
908
- for (var _key2 in initObject) {
909
- if (_key2.startsWith("__")) continue;
910
- if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key2)) {
911
- obj[_key2] = initObject[_key2];
985
+ for (var _key3 in initObject) {
986
+ if (_key3.startsWith("__")) continue;
987
+ if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key3)) {
988
+ obj[_key3] = initObject[_key3];
912
989
  }
913
990
  }
914
991
  }
@@ -1137,37 +1214,37 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1137
1214
  }
1138
1215
  }, {
1139
1216
  key: "setTemp",
1140
- value: function setTemp(_x20, _x21, _x22) {
1141
- return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(obj, key, value) {
1217
+ value: function setTemp(_x22, _x23, _x24) {
1218
+ return (_setTemp2 = _setTemp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(obj, key, value) {
1142
1219
  var sendChanges,
1143
- _args11 = arguments;
1144
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1145
- while (1) switch (_context11.prev = _context11.next) {
1220
+ _args14 = arguments;
1221
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1222
+ while (1) switch (_context14.prev = _context14.next) {
1146
1223
  case 0:
1147
- sendChanges = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : false;
1224
+ sendChanges = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : false;
1148
1225
  if (!(_typeof(obj) !== "object" || !obj || Array.isArray(obj))) {
1149
- _context11.next = 3;
1226
+ _context14.next = 3;
1150
1227
  break;
1151
1228
  }
1152
- return _context11.abrupt("return");
1229
+ return _context14.abrupt("return");
1153
1230
  case 3:
1154
1231
  if (!(obj instanceof SimpleObject)) {
1155
- _context11.next = 7;
1232
+ _context14.next = 7;
1156
1233
  break;
1157
1234
  }
1158
- _context11.next = 6;
1235
+ _context14.next = 6;
1159
1236
  return obj.setTemp(key, value, sendChanges);
1160
1237
  case 6:
1161
- return _context11.abrupt("return", _context11.sent);
1238
+ return _context14.abrupt("return", _context14.sent);
1162
1239
  case 7:
1163
1240
  //
1164
1241
  if (obj.__temp == null) obj.__temp = {};
1165
1242
  (0, _object.object_set)(obj.__temp, key, value);
1166
1243
  case 9:
1167
1244
  case "end":
1168
- return _context11.stop();
1245
+ return _context14.stop();
1169
1246
  }
1170
- }, _callee11);
1247
+ }, _callee14);
1171
1248
  }))).apply(this, arguments);
1172
1249
  }
1173
1250
  }, {
@@ -1178,36 +1255,36 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
1178
1255
  }
1179
1256
  }, {
1180
1257
  key: "delete_cache",
1181
- value: function delete_cache(_x23) {
1182
- return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(context) {
1258
+ value: function delete_cache(_x25) {
1259
+ return (_delete_cache = _delete_cache || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(context) {
1183
1260
  var cacheKey;
1184
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1185
- while (1) switch (_context12.prev = _context12.next) {
1261
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1262
+ while (1) switch (_context15.prev = _context15.next) {
1186
1263
  case 0:
1187
1264
  if (this.__cache_name) {
1188
- _context12.next = 2;
1265
+ _context15.next = 2;
1189
1266
  break;
1190
1267
  }
1191
- return _context12.abrupt("return");
1268
+ return _context15.abrupt("return");
1192
1269
  case 2:
1193
1270
  if (context) {
1194
- _context12.next = 7;
1271
+ _context15.next = 7;
1195
1272
  break;
1196
1273
  }
1197
- _context12.next = 5;
1274
+ _context15.next = 5;
1198
1275
  return _global.gcache.delete_session_cache(this.__cache_name);
1199
1276
  case 5:
1200
- _context12.next = 10;
1277
+ _context15.next = 10;
1201
1278
  break;
1202
1279
  case 7:
1203
1280
  cacheKey = "".concat(this.__cache_name, "-").concat(context);
1204
- _context12.next = 10;
1281
+ _context15.next = 10;
1205
1282
  return _global.gcache.delete_session_cache(cacheKey);
1206
1283
  case 10:
1207
1284
  case "end":
1208
- return _context12.stop();
1285
+ return _context15.stop();
1209
1286
  }
1210
- }, _callee12, this);
1287
+ }, _callee15, this);
1211
1288
  }))).apply(this, arguments);
1212
1289
  }
1213
1290
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.117",
3
+ "version": "1.4.119",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",