@azrico/webobject 1.4.111 → 1.4.112

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.
@@ -1,8 +1,9 @@
1
+ import ObjectWithTemp from "./ObjectWithTemp";
1
2
  declare type FirstInTuple<T extends any[]> = ((...args: T) => any) extends (arg: infer R, ...rest: infer U) => any ? R : T;
2
3
  /**
3
4
  * This object can be mapped and converted
4
5
  */
5
- export declare class MapableObject {
6
+ export declare class MapableObject extends ObjectWithTemp {
6
7
  readonly __uid: string;
7
8
  __data_id?: string;
8
9
  __table_id?: string;
@@ -8,27 +8,40 @@ var _object = require("@azrico/object");
8
8
  var _ObjectArray = _interopRequireDefault(require("./ObjectArray"));
9
9
  var _string = require("@azrico/string");
10
10
  var _uid = require("@azrico/uid");
11
+ var _ObjectWithTemp2 = _interopRequireDefault(require("./ObjectWithTemp"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
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); }
13
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
15
  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); } }
15
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
19
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
21
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
23
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
24
  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; }
17
25
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
26
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
27
  /**
20
28
  * This object can be mapped and converted
21
29
  */
22
- var MapableObject = /*#__PURE__*/function () {
30
+ var MapableObject = /*#__PURE__*/function (_ObjectWithTemp) {
31
+ _inherits(MapableObject, _ObjectWithTemp);
32
+ var _super = _createSuper(MapableObject);
23
33
  function MapableObject() {
34
+ var _this;
24
35
  _classCallCheck(this, MapableObject);
25
- _defineProperty(this, "__uid", void 0);
26
- _defineProperty(this, "__data_id", void 0);
27
- _defineProperty(this, "__table_id", void 0);
28
- _defineProperty(this, "__parent__table_id", void 0);
29
- _defineProperty(this, "__row_number", void 0);
30
- this.__uid = _uid.uid.localuid();
31
- this.__table_id = this.__uid;
36
+ _this = _super.call(this);
37
+ _defineProperty(_assertThisInitialized(_this), "__uid", void 0);
38
+ _defineProperty(_assertThisInitialized(_this), "__data_id", void 0);
39
+ _defineProperty(_assertThisInitialized(_this), "__table_id", void 0);
40
+ _defineProperty(_assertThisInitialized(_this), "__parent__table_id", void 0);
41
+ _defineProperty(_assertThisInitialized(_this), "__row_number", void 0);
42
+ _this.__uid = _uid.uid.localuid();
43
+ _this.__table_id = _this.__uid;
44
+ return _this;
32
45
  }
33
46
  _createClass(MapableObject, [{
34
47
  key: "getUID",
@@ -44,7 +57,7 @@ var MapableObject = /*#__PURE__*/function () {
44
57
  }, {
45
58
  key: "mapto",
46
59
  value: function mapto(maptoType, objectlist) {
47
- var _this = this;
60
+ var _this2 = this;
48
61
  var is_readonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
49
62
  for (var _len = arguments.length, p = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
50
63
  p[_key - 3] = arguments[_key];
@@ -61,7 +74,7 @@ var MapableObject = /*#__PURE__*/function () {
61
74
  objectlist = [objectlist];
62
75
  }
63
76
  return objectlist.map(function (r) {
64
- return _this.ensure.apply(_this, [maptoType, r, is_readonly].concat(p));
77
+ return _this2.ensure.apply(_this2, [maptoType, r, is_readonly].concat(p));
65
78
  });
66
79
  }
67
80
  }, {
@@ -109,7 +122,7 @@ var MapableObject = /*#__PURE__*/function () {
109
122
  }
110
123
  }]);
111
124
  return MapableObject;
112
- }();
125
+ }(_ObjectWithTemp2["default"]);
113
126
  exports.MapableObject = MapableObject;
114
127
  var _default = MapableObject;
115
128
  exports["default"] = _default;
@@ -2,10 +2,11 @@ import { PropOf, WriteablePropOf } from "./SimpleObject";
2
2
  import SimpleObject from "./SimpleObject";
3
3
  import { saveResultType, sendChangesType } from "./SimpleObject";
4
4
  import { ClassType } from "@azrico/types";
5
+ import RawObject from "./MapableObject";
5
6
  /**
6
7
  * This class manages the events of an Simple Object
7
8
  */
8
- export declare class ObjectManager<ObjType extends SimpleObject> {
9
+ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObject {
9
10
  __eventList: any;
10
11
  __eventPrefix?: string;
11
12
  __stopEvents?: boolean;
@@ -60,6 +61,7 @@ export declare class ObjectManager<ObjType extends SimpleObject> {
60
61
  */
61
62
  setSubValue(key: PropOf<ObjType>, objKey: string, subvalue: any): Promise<boolean>;
62
63
  pushValue(key: PropOf<ObjType>, value: any): Promise<false | NonNullable<Awaited<ObjType[any]>>>;
64
+ setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
63
65
  setObjectTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
64
66
  getObjectTemp(key: string): any;
65
67
  getIndexOrID(): number | string;
@@ -9,6 +9,7 @@ var _SimpleObject = _interopRequireDefault(require("./SimpleObject"));
9
9
  var _string = require("@azrico/string");
10
10
  var _global = require("@azrico/global");
11
11
  var _object = require("@azrico/object");
12
+ var _MapableObject = _interopRequireDefault(require("./MapableObject"));
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
14
  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
15
  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; }
@@ -17,23 +18,40 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
17
18
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
19
  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); } }
19
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
22
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
23
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
24
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
26
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
27
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
30
  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; }
21
31
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
32
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
23
33
  /**
24
34
  * This class manages the events of an Simple Object
25
35
  */
26
- var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubValue, _pushValue, _setObjectTemp, _event_run, _event_add, _toggleOption, _setOption, _holdOption) {
36
+ var ObjectManager = /*#__PURE__*/function (_RawObject, _notifyChanged, _setValue, _setSubValue, _pushValue, _setTemp, _setObjectTemp, _event_run, _event_add, _toggleOption, _setOption, _holdOption) {
37
+ _inherits(ObjectManager, _RawObject);
38
+ var _super = _createSuper(ObjectManager);
27
39
  function ObjectManager() {
40
+ var _this;
28
41
  _classCallCheck(this, ObjectManager);
29
- _defineProperty(this, "__eventList", void 0);
30
- _defineProperty(this, "__eventPrefix", void 0);
31
- _defineProperty(this, "__stopEvents", void 0);
32
- _defineProperty(this, "__currentObject", void 0);
33
- _defineProperty(this, "__options", void 0);
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+ _this = _super.call.apply(_super, [this].concat(args));
46
+ _defineProperty(_assertThisInitialized(_this), "__eventList", void 0);
47
+ _defineProperty(_assertThisInitialized(_this), "__eventPrefix", void 0);
48
+ _defineProperty(_assertThisInitialized(_this), "__stopEvents", void 0);
49
+ _defineProperty(_assertThisInitialized(_this), "__currentObject", void 0);
50
+ _defineProperty(_assertThisInitialized(_this), "__options", void 0);
34
51
  //can the current object be set to null safely?
35
- _defineProperty(this, "__object_nullable", false);
36
- _defineProperty(this, "get", this.getValue);
52
+ _defineProperty(_assertThisInitialized(_this), "__object_nullable", false);
53
+ _defineProperty(_assertThisInitialized(_this), "get", _this.getValue);
54
+ return _this;
37
55
  }
38
56
  _createClass(ObjectManager, [{
39
57
  key: "notifyChanged",
@@ -306,10 +324,9 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
306
324
  }))).apply(this, arguments);
307
325
  } //set temp value of object
308
326
  }, {
309
- key: "setObjectTemp",
310
- value: function setObjectTemp(_x12, _x13) {
311
- return (_setObjectTemp = _setObjectTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
312
- var _yield$this$obj$setTe, _this$obj11;
327
+ key: "setTemp",
328
+ value: function setTemp(_x12, _x13) {
329
+ return (_setTemp = _setTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
313
330
  var sendChanges,
314
331
  _args5 = arguments;
315
332
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -317,32 +334,57 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
317
334
  case 0:
318
335
  sendChanges = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : false;
319
336
  _context5.next = 3;
337
+ return this.setObjectTemp(key, value, sendChanges);
338
+ case 3:
339
+ _context5.next = 5;
340
+ return _get(_getPrototypeOf(ObjectManager.prototype), "setTemp", this).call(this, key, value);
341
+ case 5:
342
+ return _context5.abrupt("return", _context5.sent);
343
+ case 6:
344
+ case "end":
345
+ return _context5.stop();
346
+ }
347
+ }, _callee5, this);
348
+ }))).apply(this, arguments);
349
+ } //set temp value of object
350
+ }, {
351
+ key: "setObjectTemp",
352
+ value: function setObjectTemp(_x14, _x15) {
353
+ return (_setObjectTemp = _setObjectTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, value) {
354
+ var _yield$this$obj$setTe, _this$obj11;
355
+ var sendChanges,
356
+ _args6 = arguments;
357
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
358
+ while (1) switch (_context6.prev = _context6.next) {
359
+ case 0:
360
+ sendChanges = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : false;
361
+ _context6.next = 3;
320
362
  return (_this$obj11 = this.obj) === null || _this$obj11 === void 0 ? void 0 : _this$obj11.setTemp(key, value, sendChanges);
321
363
  case 3:
322
- _context5.t1 = _yield$this$obj$setTe = _context5.sent;
323
- _context5.t0 = _context5.t1 !== null;
324
- if (!_context5.t0) {
325
- _context5.next = 7;
364
+ _context6.t1 = _yield$this$obj$setTe = _context6.sent;
365
+ _context6.t0 = _context6.t1 !== null;
366
+ if (!_context6.t0) {
367
+ _context6.next = 7;
326
368
  break;
327
369
  }
328
- _context5.t0 = _yield$this$obj$setTe !== void 0;
370
+ _context6.t0 = _yield$this$obj$setTe !== void 0;
329
371
  case 7:
330
- if (!_context5.t0) {
331
- _context5.next = 11;
372
+ if (!_context6.t0) {
373
+ _context6.next = 11;
332
374
  break;
333
375
  }
334
- _context5.t2 = _yield$this$obj$setTe;
335
- _context5.next = 12;
376
+ _context6.t2 = _yield$this$obj$setTe;
377
+ _context6.next = 12;
336
378
  break;
337
379
  case 11:
338
- _context5.t2 = false;
380
+ _context6.t2 = false;
339
381
  case 12:
340
- return _context5.abrupt("return", _context5.t2);
382
+ return _context6.abrupt("return", _context6.t2);
341
383
  case 13:
342
384
  case "end":
343
- return _context5.stop();
385
+ return _context6.stop();
344
386
  }
345
- }, _callee5, this);
387
+ }, _callee6, this);
346
388
  }))).apply(this, arguments);
347
389
  } //get temp value of object
348
390
  }, {
@@ -375,33 +417,33 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
375
417
  /* -------------------------------------------------------------------------- */
376
418
  }, {
377
419
  key: "event_run",
378
- value: function event_run(_x14) {
379
- return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(eventName) {
380
- var _len,
420
+ value: function event_run(_x16) {
421
+ return (_event_run = _event_run || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventName) {
422
+ var _len2,
381
423
  params,
382
- _key,
383
- _args6 = arguments;
384
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
385
- while (1) switch (_context6.prev = _context6.next) {
424
+ _key2,
425
+ _args7 = arguments;
426
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
427
+ while (1) switch (_context7.prev = _context7.next) {
386
428
  case 0:
387
429
  if (!(this.__stopEvents === true)) {
388
- _context6.next = 2;
430
+ _context7.next = 2;
389
431
  break;
390
432
  }
391
- return _context6.abrupt("return");
433
+ return _context7.abrupt("return");
392
434
  case 2:
393
- for (_len = _args6.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
394
- params[_key - 1] = _args6[_key];
435
+ for (_len2 = _args7.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
436
+ params[_key2 - 1] = _args7[_key2];
395
437
  }
396
- _context6.next = 5;
438
+ _context7.next = 5;
397
439
  return _event.EventManager.run.apply(_event.EventManager, [this, eventName].concat(params));
398
440
  case 5:
399
- return _context6.abrupt("return", _context6.sent);
441
+ return _context7.abrupt("return", _context7.sent);
400
442
  case 6:
401
443
  case "end":
402
- return _context6.stop();
444
+ return _context7.stop();
403
445
  }
404
- }, _callee6, this);
446
+ }, _callee7, this);
405
447
  }))).apply(this, arguments);
406
448
  }
407
449
  }, {
@@ -431,23 +473,23 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
431
473
  }
432
474
  }, {
433
475
  key: "event_add",
434
- value: function event_add(_x15, _x16, _x17) {
435
- return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(name, uname, runEvent) {
476
+ value: function event_add(_x17, _x18, _x19) {
477
+ return (_event_add = _event_add || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(name, uname, runEvent) {
436
478
  var onlyOn,
437
479
  runOnce,
438
- _args7 = arguments;
439
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
440
- while (1) switch (_context7.prev = _context7.next) {
480
+ _args8 = arguments;
481
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
482
+ while (1) switch (_context8.prev = _context8.next) {
441
483
  case 0:
442
- onlyOn = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : null;
443
- runOnce = _args7.length > 4 && _args7[4] !== undefined ? _args7[4] : false;
444
- _context7.next = 4;
484
+ onlyOn = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
485
+ runOnce = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : false;
486
+ _context8.next = 4;
445
487
  return _event.EventManager.add(this, name, uname, runEvent, onlyOn, runOnce);
446
488
  case 4:
447
489
  case "end":
448
- return _context7.stop();
490
+ return _context8.stop();
449
491
  }
450
- }, _callee7, this);
492
+ }, _callee8, this);
451
493
  }))).apply(this, arguments);
452
494
  }
453
495
  }, {
@@ -489,38 +531,38 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
489
531
  * @param value
490
532
  * @returns
491
533
  */
492
- function toggleOption(_x18, _x19) {
493
- return (_toggleOption = _toggleOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
534
+ function toggleOption(_x20, _x21) {
535
+ return (_toggleOption = _toggleOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
494
536
  var oldval;
495
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
496
- while (1) switch (_context8.prev = _context8.next) {
537
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
538
+ while (1) switch (_context9.prev = _context9.next) {
497
539
  case 0:
498
540
  oldval = this.getOption(key);
499
541
  if (!(0, _object.object_equals_loose)(oldval, value)) {
500
- _context8.next = 6;
542
+ _context9.next = 6;
501
543
  break;
502
544
  }
503
- _context8.next = 4;
545
+ _context9.next = 4;
504
546
  return this.setOption(key, null);
505
547
  case 4:
506
- _context8.next = 8;
548
+ _context9.next = 8;
507
549
  break;
508
550
  case 6:
509
- _context8.next = 8;
551
+ _context9.next = 8;
510
552
  return this.setOption(key, value);
511
553
  case 8:
512
554
  case "end":
513
- return _context8.stop();
555
+ return _context9.stop();
514
556
  }
515
- }, _callee8, this);
557
+ }, _callee9, this);
516
558
  }))).apply(this, arguments);
517
559
  }
518
560
  }, {
519
561
  key: "setOption",
520
- value: function setOption(_x20, _x21) {
521
- return (_setOption = _setOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
522
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
523
- while (1) switch (_context9.prev = _context9.next) {
562
+ value: function setOption(_x22, _x23) {
563
+ return (_setOption = _setOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value) {
564
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
565
+ while (1) switch (_context10.prev = _context10.next) {
524
566
  case 0:
525
567
  if (this.__options == null) this.__options = {};
526
568
  if (value == null) {
@@ -528,15 +570,15 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
528
570
  } else {
529
571
  this.__options[key] = value;
530
572
  }
531
- _context9.next = 4;
573
+ _context10.next = 4;
532
574
  return this.event_run("on_option_change", key, value);
533
575
  case 4:
534
- return _context9.abrupt("return", _context9.sent);
576
+ return _context10.abrupt("return", _context10.sent);
535
577
  case 5:
536
578
  case "end":
537
- return _context9.stop();
579
+ return _context10.stop();
538
580
  }
539
- }, _callee9, this);
581
+ }, _callee10, this);
540
582
  }))).apply(this, arguments);
541
583
  }
542
584
  /**
@@ -547,9 +589,9 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
547
589
  }, {
548
590
  key: "useOption",
549
591
  value: function useOption(key) {
550
- var _this = this;
592
+ var _this2 = this;
551
593
  return this.event_use_getter("on_option_change", function () {
552
- return _this.getOption(key);
594
+ return _this2.getOption(key);
553
595
  }, [key]);
554
596
  }
555
597
  /**
@@ -562,28 +604,28 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
562
604
  */
563
605
  }, {
564
606
  key: "holdOption",
565
- value: function holdOption(_x22, _x23, _x24, _x25) {
566
- return (_holdOption = _holdOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(key, value, nextvalue, action) {
567
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
568
- while (1) switch (_context10.prev = _context10.next) {
607
+ value: function holdOption(_x24, _x25, _x26, _x27) {
608
+ return (_holdOption = _holdOption || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(key, value, nextvalue, action) {
609
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
610
+ while (1) switch (_context11.prev = _context11.next) {
569
611
  case 0:
570
- _context10.prev = 0;
612
+ _context11.prev = 0;
571
613
  this.setOption(key, value);
572
614
  if (!(typeof action === "function")) {
573
- _context10.next = 5;
615
+ _context11.next = 5;
574
616
  break;
575
617
  }
576
- _context10.next = 5;
618
+ _context11.next = 5;
577
619
  return action();
578
620
  case 5:
579
- _context10.prev = 5;
621
+ _context11.prev = 5;
580
622
  this.setOption(key, nextvalue);
581
- return _context10.finish(5);
623
+ return _context11.finish(5);
582
624
  case 8:
583
625
  case "end":
584
- return _context10.stop();
626
+ return _context11.stop();
585
627
  }
586
- }, _callee10, this, [[0,, 5, 8]]);
628
+ }, _callee11, this, [[0,, 5, 8]]);
587
629
  }))).apply(this, arguments);
588
630
  }
589
631
  }, {
@@ -644,7 +686,7 @@ var ObjectManager = /*#__PURE__*/function (_notifyChanged, _setValue, _setSubVal
644
686
  }
645
687
  }]);
646
688
  return ObjectManager;
647
- }();
689
+ }(_MapableObject["default"]);
648
690
  exports.ObjectManager = ObjectManager;
649
691
  _defineProperty(ObjectManager, "__object_type", void 0);
650
692
  var _default = ObjectManager;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This object can be mapped and converted
3
+ */
4
+ export declare class ObjectWithTemp {
5
+ #private;
6
+ protected __temp: any;
7
+ constructor();
8
+ getTemp: (key: string) => any;
9
+ setTemp(key: string, value: any): Promise<boolean>;
10
+ }
11
+ export default ObjectWithTemp;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.ObjectWithTemp = void 0;
8
+ var _object = require("@azrico/object");
9
+ 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; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+ 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); } }
14
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
15
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
16
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
17
+ 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; }
18
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
21
+ /**
22
+ * This object can be mapped and converted
23
+ */
24
+ var _getTempProperty = /*#__PURE__*/new WeakSet();
25
+ var _setTempProperty = /*#__PURE__*/new WeakSet();
26
+ var ObjectWithTemp = /*#__PURE__*/function (_setTemp) {
27
+ function ObjectWithTemp() {
28
+ _classCallCheck(this, ObjectWithTemp);
29
+ _classPrivateMethodInitSpec(this, _setTempProperty);
30
+ /* ---------------------------------- temp ---------------------------------- */
31
+ _classPrivateMethodInitSpec(this, _getTempProperty);
32
+ _defineProperty(this, "__temp", undefined);
33
+ _defineProperty(this, "getTemp", _classPrivateMethodGet(this, _getTempProperty, _getTempProperty2));
34
+ }
35
+ _createClass(ObjectWithTemp, [{
36
+ key: "setTemp",
37
+ value: function setTemp(_x, _x2) {
38
+ return (_setTemp = _setTemp || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
39
+ var isValueChanged;
40
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ isValueChanged = false;
44
+ isValueChanged = _classPrivateMethodGet(this, _getTempProperty, _getTempProperty2).call(this, key) != value;
45
+ _classPrivateMethodGet(this, _setTempProperty, _setTempProperty2).call(this, key, value);
46
+ return _context.abrupt("return", isValueChanged);
47
+ case 4:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }, _callee, this);
52
+ }))).apply(this, arguments);
53
+ }
54
+ }]);
55
+ return ObjectWithTemp;
56
+ }();
57
+ exports.ObjectWithTemp = ObjectWithTemp;
58
+ function _getTempProperty2(key) {
59
+ if (this.__temp == null) return undefined;
60
+ return (0, _object.object_get)(this.__temp, key);
61
+ }
62
+ function _setTempProperty2(key, value) {
63
+ if (this.__temp == null) this.__temp = {};
64
+ return (0, _object.object_set)(this.__temp, key, value);
65
+ }
66
+ var _default = ObjectWithTemp;
67
+ exports["default"] = _default;
@@ -23,7 +23,6 @@ export declare class SimpleObject extends MapableObject {
23
23
  _static(): Function;
24
24
  protected __originalobject?: this;
25
25
  protected __delta: Partial<this>;
26
- protected __temp: any;
27
26
  protected __changed: boolean;
28
27
  protected __lastChanged?: string;
29
28
  protected __is_readonly?: boolean;
@@ -44,7 +43,6 @@ export declare class SimpleObject extends MapableObject {
44
43
  static getValue<T extends SimpleObject, MKey extends PropOf<T>>(o: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
45
44
  getValue: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
46
45
  get: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
47
- getTemp: (key: string) => any;
48
46
  /**
49
47
  * set value
50
48
  * @param key
@@ -53,7 +51,7 @@ export declare class SimpleObject extends MapableObject {
53
51
  */
54
52
  setValue(key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType): Promise<boolean>;
55
53
  set: (key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
56
- setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<void>;
54
+ setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
57
55
  setAll<K extends WriteablePropOf<this>>(setObj: {
58
56
  [key in K]: any;
59
57
  }): Promise<boolean>;
@@ -196,7 +194,7 @@ export declare class SimpleObject extends MapableObject {
196
194
  getSaveResultType(): saveResultType;
197
195
  /** did we create on the last save */
198
196
  getIsLastSaveCreate(): boolean;
199
- static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<void>;
197
+ static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<boolean | undefined>;
200
198
  static factoryClear(obj: SimpleObject): void;
201
199
  static delete_cache(context?: string): Promise<void>;
202
200
  static get_canModify(o: SimpleObject): boolean;
@@ -25,6 +25,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
25
25
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
26
  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); } }
27
27
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
28
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
29
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
28
30
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
31
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
32
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -43,8 +45,6 @@ var _getSubProperty = /*#__PURE__*/new WeakSet();
43
45
  var _setProperty = /*#__PURE__*/new WeakSet();
44
46
  var _setDefaultProperty = /*#__PURE__*/new WeakSet();
45
47
  var _getProperty = /*#__PURE__*/new WeakSet();
46
- var _getTempProperty = /*#__PURE__*/new WeakSet();
47
- var _setTempProperty = /*#__PURE__*/new WeakSet();
48
48
  var _setSaveResultObject = /*#__PURE__*/new WeakSet();
49
49
  var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _setAll, _setSubValue, _pushValue, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
50
50
  _inherits(SimpleObject, _MapableObject);
@@ -59,8 +59,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
59
59
  * @param toObj
60
60
  */
61
61
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSaveResultObject);
62
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setTempProperty);
63
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getTempProperty);
64
62
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
65
63
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
66
64
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
@@ -70,7 +68,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
70
68
  _defineProperty(_assertThisInitialized(_this), "__originalobject", void 0);
71
69
  //changes are saved here
72
70
  _defineProperty(_assertThisInitialized(_this), "__delta", {});
73
- _defineProperty(_assertThisInitialized(_this), "__temp", undefined);
74
71
  _defineProperty(_assertThisInitialized(_this), "__changed", false);
75
72
  //the last thing that was changed on this object
76
73
  _defineProperty(_assertThisInitialized(_this), "__lastChanged", void 0);
@@ -96,7 +93,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
96
93
  _defineProperty(_assertThisInitialized(_this), "_index_value", -1);
97
94
  _defineProperty(_assertThisInitialized(_this), "getValue", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
98
95
  _defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
99
- _defineProperty(_assertThisInitialized(_this), "getTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _getTempProperty, _getTempProperty2));
100
96
  _defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
101
97
  /**
102
98
  * set value of a key only if the value is empty
@@ -199,26 +195,23 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
199
195
  while (1) switch (_context2.prev = _context2.next) {
200
196
  case 0:
201
197
  sendChanges = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
202
- isValueChanged = false;
203
- _context2.prev = 2;
204
- isValueChanged = _classPrivateMethodGet(this, _getTempProperty, _getTempProperty2).call(this, key) != value;
205
- _classPrivateMethodGet(this, _setTempProperty, _setTempProperty2).call(this, key, value);
206
- //console.log("SV:", isValueChanged, oldval, key, value);
207
- case 5:
208
- _context2.prev = 5;
198
+ _context2.next = 3;
199
+ return _get(_getPrototypeOf(SimpleObject.prototype), "setTemp", this).call(this, key, value);
200
+ case 3:
201
+ isValueChanged = _context2.sent;
209
202
  if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
210
- _context2.next = 9;
203
+ _context2.next = 7;
211
204
  break;
212
205
  }
213
- _context2.next = 9;
206
+ _context2.next = 7;
214
207
  return this.notifyChanged("temp", key, value);
215
- case 9:
216
- return _context2.finish(5);
217
- case 10:
208
+ case 7:
209
+ return _context2.abrupt("return", isValueChanged);
210
+ case 8:
218
211
  case "end":
219
212
  return _context2.stop();
220
213
  }
221
- }, _callee2, this, [[2,, 5, 10]]);
214
+ }, _callee2, this);
222
215
  }))).apply(this, arguments);
223
216
  }
224
217
  }, {
@@ -1287,14 +1280,6 @@ function _getProperty2(key) {
1287
1280
  if (use_orig) return this[key];
1288
1281
  return this.__delta[key];
1289
1282
  }
1290
- function _getTempProperty2(key) {
1291
- if (this.__temp == null) return undefined;
1292
- return (0, _object.object_get)(this.__temp, key);
1293
- }
1294
- function _setTempProperty2(key, value) {
1295
- if (this.__temp == null) this.__temp = {};
1296
- return (0, _object.object_set)(this.__temp, key, value);
1297
- }
1298
1283
  function _setSaveResultObject2(toObj) {
1299
1284
  if (toObj == null) toObj = null; //null or undefined
1300
1285
  this.__saveResultObject = toObj;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.111",
3
+ "version": "1.4.112",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",