@azrico/webobject 1.3.3 → 1.3.4

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,867 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.SimpleObject = void 0;
7
- var _global = require("@azrico/global");
8
- var _object = require("@azrico/object");
9
- var _MapableObject2 = require("./MapableObject");
10
- var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
11
- var _string = require("@azrico/string");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
17
- 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); } }
18
- 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); }); }; }
19
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
- 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); } }
21
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
- 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); }
23
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
24
- 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); }; }
25
- 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); }
26
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
- 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; } }
28
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
30
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
31
- 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; }
32
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
33
- 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); }
34
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
35
- var _setSubProperty = /*#__PURE__*/new WeakSet();
36
- var _getSubProperty = /*#__PURE__*/new WeakSet();
37
- var _setProperty = /*#__PURE__*/new WeakSet();
38
- var _setDefaultProperty = /*#__PURE__*/new WeakSet();
39
- var _getProperty = /*#__PURE__*/new WeakSet();
40
- var _getTempProperty = /*#__PURE__*/new WeakSet();
41
- var _setTempProperty = /*#__PURE__*/new WeakSet();
42
- var _setSaveResultObject = /*#__PURE__*/new WeakSet();
43
- var SimpleObject = /*#__PURE__*/function (_MapableObject) {
44
- _inherits(SimpleObject, _MapableObject);
45
- var _super = _createSuper(SimpleObject);
46
- function SimpleObject() {
47
- var _this;
48
- var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
49
- _classCallCheck(this, SimpleObject);
50
- _this = _super.call(this);
51
- /**
52
- * set the response of last save from site
53
- * @param toObj
54
- */
55
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSaveResultObject);
56
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setTempProperty);
57
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getTempProperty);
58
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
59
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
60
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
61
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
62
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSubProperty);
63
- _defineProperty(_assertThisInitialized(_this), "__originalobject", void 0);
64
- //changes
65
- _defineProperty(_assertThisInitialized(_this), "__delta", void 0);
66
- _defineProperty(_assertThisInitialized(_this), "__temp", void 0);
67
- _defineProperty(_assertThisInitialized(_this), "__changed", false);
68
- _defineProperty(_assertThisInitialized(_this), "__lastChanged", "");
69
- _defineProperty(_assertThisInitialized(_this), "__is_readonly", void 0);
70
- _defineProperty(_assertThisInitialized(_this), "__throw_errors", void 0);
71
- //errors
72
- _defineProperty(_assertThisInitialized(_this), "__errors", void 0);
73
- _defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
74
- //save results
75
- _defineProperty(_assertThisInitialized(_this), "__saveResultObject", void 0);
76
- _defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", true);
77
- _defineProperty(_assertThisInitialized(_this), "__saveResultType", void 0);
78
- //sequence key
79
- _defineProperty(_assertThisInitialized(_this), "_index_key", "");
80
- //sequence value , used to index the object with increasing numbers
81
- _defineProperty(_assertThisInitialized(_this), "_index_value", -1);
82
- _defineProperty(_assertThisInitialized(_this), "getValue", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
83
- _defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
84
- _defineProperty(_assertThisInitialized(_this), "getTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _getTempProperty, _getTempProperty2));
85
- _defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
86
- _defineProperty(_assertThisInitialized(_this), "setTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _setTempProperty, _setTempProperty2));
87
- _defineProperty(_assertThisInitialized(_this), "setDefault", _this.setDefaultValue);
88
- _defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
89
- return null;
90
- });
91
- _this.__delta = {};
92
- _this.__temp = {};
93
- _this.__is_readonly = is_readonly;
94
- _this.__throw_errors = true;
95
- _this.clear_changes();
96
- return _this;
97
- }
98
- _createClass(SimpleObject, [{
99
- key: "_static",
100
- value: function _static() {
101
- return this.constructor;
102
- }
103
- }, {
104
- key: "loadValues",
105
- value: /* -------------------------------------------------------------------------- */
106
- /* Load */
107
- /* -------------------------------------------------------------------------- */
108
- function loadValues(initObject) {
109
- var fullUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
110
- return SimpleObject.loadValues(this, initObject, fullUpdate);
111
- }
112
- }, {
113
- key: "setValue",
114
- value:
115
- /**
116
- * set value
117
- * @param key
118
- * @param value
119
- * @return true if changed , false otherwise
120
- */
121
- function () {
122
- var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
123
- var sendChanges,
124
- isValueChanged,
125
- oldval,
126
- _args = arguments;
127
- return _regeneratorRuntime().wrap(function _callee$(_context) {
128
- while (1) switch (_context.prev = _context.next) {
129
- case 0:
130
- sendChanges = _args.length > 2 && _args[2] !== undefined ? _args[2] : "auto";
131
- if (this.canModify) {
132
- _context.next = 7;
133
- break;
134
- }
135
- if (!this.__throw_errors) {
136
- _context.next = 6;
137
- break;
138
- }
139
- throw Error("Cant use setValue when on readonly mode");
140
- case 6:
141
- return _context.abrupt("return", false);
142
- case 7:
143
- isValueChanged = false;
144
- _context.prev = 8;
145
- oldval = this.getValue(key);
146
- if (!(0, _object.object_equals)(oldval, value, {
147
- ignoredStartingWords: "_"
148
- })) {
149
- _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, value);
150
- isValueChanged = true;
151
- } else isValueChanged = false;
152
- //console.log("SV:", isValueChanged, oldval, key, value);
153
- case 11:
154
- _context.prev = 11;
155
- if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
156
- _context.next = 15;
157
- break;
158
- }
159
- _context.next = 15;
160
- return this.notifyChanged("", String(key), value);
161
- case 15:
162
- return _context.finish(11);
163
- case 16:
164
- return _context.abrupt("return", isValueChanged);
165
- case 17:
166
- case "end":
167
- return _context.stop();
168
- }
169
- }, _callee, this, [[8,, 11, 16]]);
170
- }));
171
- function setValue(_x, _x2) {
172
- return _setValue.apply(this, arguments);
173
- }
174
- return setValue;
175
- }()
176
- }, {
177
- key: "setDefaultValue",
178
- value: function setDefaultValue(key, value) {
179
- return _classPrivateMethodGet(this, _setDefaultProperty, _setDefaultProperty2).call(this, key, value);
180
- }
181
- }, {
182
- key: "setSubValue",
183
- value:
184
- /**
185
- * set key of subObject
186
- * @param key
187
- * @param value
188
- * @param subvalue
189
- * @return true if changed , false otherwise
190
- */
191
- function () {
192
- var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, objKey, subvalue) {
193
- var sendChanges,
194
- isValueChanged,
195
- subval,
196
- _args2 = arguments;
197
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
198
- while (1) switch (_context2.prev = _context2.next) {
199
- case 0:
200
- sendChanges = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : "auto";
201
- if (this.canModify) {
202
- _context2.next = 7;
203
- break;
204
- }
205
- if (!this.__throw_errors) {
206
- _context2.next = 6;
207
- break;
208
- }
209
- throw Error("Cant use setValue when on readonly mode");
210
- case 6:
211
- return _context2.abrupt("return", false);
212
- case 7:
213
- isValueChanged = false;
214
- _context2.prev = 8;
215
- //if accessing subval of an object, make sure the object is not null
216
- subval = _classPrivateMethodGet(this, _getSubProperty, _getSubProperty2).call(this, key, objKey);
217
- if (!(0, _object.object_equals)(subval, subvalue, {
218
- ignoredStartingWords: "_"
219
- })) {
220
- _classPrivateMethodGet(this, _setSubProperty, _setSubProperty2).call(this, key, objKey, subvalue);
221
- isValueChanged = true;
222
- } else isValueChanged = false;
223
- case 11:
224
- _context2.prev = 11;
225
- if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
226
- _context2.next = 15;
227
- break;
228
- }
229
- _context2.next = 15;
230
- return this.notifyChanged("", String(key), objKey, subvalue);
231
- case 15:
232
- return _context2.finish(11);
233
- case 16:
234
- return _context2.abrupt("return", isValueChanged);
235
- case 17:
236
- case "end":
237
- return _context2.stop();
238
- }
239
- }, _callee2, this, [[8,, 11, 16]]);
240
- }));
241
- function setSubValue(_x3, _x4, _x5) {
242
- return _setSubValue.apply(this, arguments);
243
- }
244
- return setSubValue;
245
- }() //Push value on array
246
- }, {
247
- key: "pushValue",
248
- value: function () {
249
- var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
250
- var sendChanges,
251
- tempArray,
252
- _args3 = arguments;
253
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
254
- while (1) switch (_context3.prev = _context3.next) {
255
- case 0:
256
- sendChanges = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : "auto";
257
- if (!(value == null)) {
258
- _context3.next = 3;
259
- break;
260
- }
261
- return _context3.abrupt("return", false);
262
- case 3:
263
- if (this.canModify) {
264
- _context3.next = 9;
265
- break;
266
- }
267
- if (!this.__throw_errors) {
268
- _context3.next = 8;
269
- break;
270
- }
271
- throw Error("Cant use pushValue when on readonly mode");
272
- case 8:
273
- return _context3.abrupt("return", false);
274
- case 9:
275
- if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
276
- _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, this.getValue(key));
277
- }
278
- tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
279
- if (Array.isArray(tempArray)) {
280
- _context3.next = 17;
281
- break;
282
- }
283
- if (!this.__throw_errors) {
284
- _context3.next = 16;
285
- break;
286
- }
287
- throw Error("Cant use pushValue on non Array keys");
288
- case 16:
289
- return _context3.abrupt("return", false);
290
- case 17:
291
- tempArray.push(value);
292
- _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, tempArray);
293
- if (!(sendChanges === true || sendChanges === "auto")) {
294
- _context3.next = 22;
295
- break;
296
- }
297
- _context3.next = 22;
298
- return this.notifyChanged("", String(key), value);
299
- case 22:
300
- return _context3.abrupt("return", tempArray);
301
- case 23:
302
- case "end":
303
- return _context3.stop();
304
- }
305
- }, _callee3, this);
306
- }));
307
- function pushValue(_x6, _x7) {
308
- return _pushValue.apply(this, arguments);
309
- }
310
- return pushValue;
311
- }()
312
- }, {
313
- key: "notifyChanged",
314
- value: function () {
315
- var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(type, key, value, subvalue) {
316
- var lc, manager_class;
317
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
318
- while (1) switch (_context4.prev = _context4.next) {
319
- case 0:
320
- if (value === undefined && type != "meta") value = this.getValue(key);
321
- this.__changed = true;
322
- lc = "";
323
- if (type) lc += "[".concat(String(type), "] ");
324
- if (subvalue) {
325
- lc += "".concat(String(key), "->").concat(value, " = ").concat(subvalue);
326
- } else {
327
- lc += "".concat(String(key), " = ").concat(value);
328
- }
329
- this.__lastChanged = lc;
330
- /* --------------------------- notify the manager --------------------------- */
331
- manager_class = this.get_managerClass();
332
- if (!(manager_class instanceof _ObjectManager["default"])) {
333
- _context4.next = 10;
334
- break;
335
- }
336
- _context4.next = 10;
337
- return manager_class.notifyChanged(type, key, value, subvalue);
338
- case 10:
339
- case "end":
340
- return _context4.stop();
341
- }
342
- }, _callee4, this);
343
- }));
344
- function notifyChanged(_x8, _x9, _x10, _x11) {
345
- return _notifyChanged.apply(this, arguments);
346
- }
347
- return notifyChanged;
348
- }()
349
- }, {
350
- key: "apply_changes",
351
- value: /* -------------------------------------------------------------------------- */
352
- /* Changes */
353
- /* -------------------------------------------------------------------------- */
354
- /**
355
- * Apply the changes and empty the delta object
356
- */
357
- function apply_changes() {
358
- try {
359
- if (!this.__use_delta) {
360
- //in this mode , we track changes by updating the original product
361
- this.setOriginal();
362
- return true;
363
- }
364
- if (!this.isChanged) {
365
- console.warn("No changes to apply");
366
- return false;
367
- }
368
- for (var key in this.__delta) {
369
- var nv = this.__delta[key];
370
- this[key] = nv;
371
- }
372
- return true;
373
- } finally {
374
- this.clear_changes();
375
- }
376
- }
377
- }, {
378
- key: "clear_changes",
379
- value: function clear_changes() {
380
- this.__delta = {};
381
- this.__changed = false;
382
- return true;
383
- }
384
- }, {
385
- key: "clear_cache",
386
- value: function clear_cache() {
387
- this.__temp = {};
388
- return true;
389
- }
390
- /**
391
- * Sets readonly property on given objects
392
- * @param objs array of given objects or a single object
393
- * @param readonlyval readonly
394
- * @param clearChanges should we clean the changes after setting readonly
395
- */
396
- }, {
397
- key: "isChanged",
398
- get: /* -------------------------------------------------------------------------- */
399
- /* Get/Check */
400
- /* -------------------------------------------------------------------------- */
401
- function get() {
402
- var _this2 = this;
403
- ////const deltaIsBlank = object_isEmpty(this.__delta);
404
- ////if (!deltaIsBlank) return true; //delta is not blank, definitely changed
405
- ////if (this.__use_delta) return !deltaIsBlank; //trust the delta.
406
- if (this.__use_delta) return !(0, _object.object_isEmpty)(this.__delta);
407
- /* -------------------------------------------------------------------------- */
408
- /* check the properties one by one */
409
- /* -------------------------------------------------------------------------- */
410
- var orig = this.getOriginal();
411
- if (!orig) return false; //we dont know if anything has changed
412
- /* if object is not using delta mode, check changes by comparing changable fields with original object */
413
- if (Array.isArray(this.__changeables)) {
414
- //console.log("chk", this.__changeables, "for changes");
415
- return this.__changeables.find(function (c) {
416
- return !(0, _object.object_equals)(_this2[c], orig[c]);
417
- }) != undefined;
418
- } else {
419
- /* check all fields */
420
- for (var key in this) {
421
- if (key.startsWith("__")) continue;
422
- if (!(0, _object.object_equals)(this[key], orig[key])) return true;
423
- }
424
- return false;
425
- }
426
- return false;
427
- }
428
- }, {
429
- key: "isDeleted",
430
- get: function get() {
431
- return false;
432
- }
433
- }, {
434
- key: "d",
435
- get: function get() {
436
- return this.__use_delta ? this.__delta : this;
437
- }
438
- /* all updated properties */
439
- }, {
440
- key: "allproperties",
441
- get: function get() {
442
- var result = _objectSpread(_objectSpread({}, this), this.__delta);
443
- result.__delta = {};
444
- return result;
445
- }
446
- }, {
447
- key: "canModify",
448
- get: function get() {
449
- return !Boolean(this.__is_readonly);
450
- }
451
- }, {
452
- key: "__cache_name",
453
- get: function get() {
454
- return this.constructor["__cache_name"];
455
- }
456
- }, {
457
- key: "__changeables",
458
- get: function get() {
459
- return this.constructor["__changeables"];
460
- }
461
- }, {
462
- key: "__unchangeables",
463
- get: function get() {
464
- return this.constructor["__unchangeables"];
465
- }
466
- }, {
467
- key: "__use_delta",
468
- get: function get() {
469
- return this.constructor["__use_delta"];
470
- }
471
- }, {
472
- key: "isSaved",
473
- get: function get() {
474
- var _this$__saveResultIsS;
475
- return Boolean((_this$__saveResultIsS = this.__saveResultIsSuccess) !== null && _this$__saveResultIsS !== void 0 ? _this$__saveResultIsS : false);
476
- }
477
- }, {
478
- key: "isNew",
479
- get: function get() {
480
- var mid = this.getID();
481
- if (!mid) return true;
482
- if (typeof mid === "string") return mid === "" || mid === "-1";
483
- if (typeof mid === "number") return mid === -1;
484
- return false;
485
- }
486
- }, {
487
- key: "get_lastChanged",
488
- value: function get_lastChanged() {
489
- return !this.__lastChanged;
490
- }
491
- }, {
492
- key: "manager",
493
- get: function get() {
494
- return this.get_managerClass();
495
- }
496
- }, {
497
- key: "getIndexOrID",
498
- value: function getIndexOrID() {
499
- return SimpleObject.getIndexOrID(this);
500
- }
501
- }, {
502
- key: "getIndex",
503
- value: function getIndex() {
504
- return SimpleObject.getIndex(this);
505
- }
506
- }, {
507
- key: "getID",
508
- value: function getID() {
509
- return SimpleObject.getID(this);
510
- }
511
- }, {
512
- key: "getOriginal",
513
- value: /* -------------------------------------------------------------------------- */
514
- /* Original */
515
- /* -------------------------------------------------------------------------- */
516
- function getOriginal() {
517
- return this.__originalobject || undefined;
518
- }
519
- }, {
520
- key: "setOriginal",
521
- value: function setOriginal() {
522
- var toObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
523
- if (toObj === null) {
524
- delete this.__originalobject;
525
- return;
526
- }
527
- if (!this.canModify) {
528
- console.warn("Cant use setOriginal on non original OR readonly objects ! this will create an infinite loop");
529
- delete this.__originalobject;
530
- return;
531
- }
532
- if (toObj === 0) {
533
- toObj = this;
534
- }
535
- var cloneObject = (0, _object.object_clone)(toObj);
536
- SimpleObject.setReadonly(cloneObject, true);
537
- this.__originalobject = (0, _object.object_removeKeys)(cloneObject, ["__"]);
538
- return this;
539
- }
540
- }, {
541
- key: "setSaveResult",
542
- value:
543
- /**
544
- * set the response of last save from site
545
- * and its type
546
- * @param toObj
547
- */
548
- function setSaveResult(toObj, type) {
549
- if (toObj != null) {
550
- _classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
551
- } else {
552
- _classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, null);
553
- }
554
- //check if the given object is a valid save result
555
- if (type === "error") this.__saveResultIsSuccess = false;else this.__saveResultIsSuccess = Boolean(type === "nothing" || this.constructor["isResultValid"](toObj));
556
- if (type === "auto") {
557
- type = this.__saveResultIsSuccess ? "normal" : "error";
558
- }
559
- this.__saveResultType = type;
560
- }
561
- }, {
562
- key: "getSaveResult",
563
- value: function getSaveResult() {
564
- var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
565
- if (this.isSaved) return this.__saveResultObject;
566
- return false;
567
- }
568
- }, {
569
- key: "getSaveResultType",
570
- value: function getSaveResultType() {
571
- return this.__saveResultType || "nothing";
572
- }
573
- /* -------------------------------------------------------------------------- */
574
- /* statics */
575
- /* -------------------------------------------------------------------------- */
576
- }], [{
577
- key: "loadValues",
578
- value: function loadValues(obj, initObject) {
579
- var fullUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
580
- SimpleObject.factoryClear(obj);
581
- if (initObject == null) {
582
- for (var key in obj) {
583
- if (typeof obj[key] === "function") continue;
584
- if (key.startsWith("__")) continue;
585
- delete obj[key];
586
- }
587
- } else if (_typeof(initObject) == "object") {
588
- for (var _key in initObject) {
589
- if (_key.startsWith("__")) continue;
590
- if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key)) {
591
- obj[_key] = initObject[_key];
592
- }
593
- }
594
- }
595
- return true;
596
- }
597
- /* -------------------------------------------------------------------------- */
598
- }, {
599
- key: "getValue",
600
- value: function getValue(o, key) {
601
- var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
602
- if (o == null) return undefined;
603
- if (o instanceof SimpleObject && typeof o.getValue === "function") return o.getValue(key, original);
604
- if (!original && o.__use_delta != false && _typeof(o.__delta) === "object" && key in o.__delta) {
605
- //@ts-ignore
606
- return o.__delta[key];
607
- }
608
- return o[key];
609
- }
610
- }, {
611
- key: "canChangeKey",
612
- value: function canChangeKey(object, key, useExtraProps) {
613
- if (!object || !key) return false;
614
- if (useExtraProps) {
615
- var __extraProperties = object.constructor["__extraProperties"];
616
- if (__extraProperties != null && __extraProperties.includes(key)) return true;
617
- }
618
- var __changeables = object.constructor["__changeables"];
619
- var __unchangeables = object.constructor["__unchangeables"];
620
- if (__changeables != null && !__changeables.includes(key)) return false;
621
- if (__unchangeables != null && __unchangeables.includes(key)) return false;
622
- return true;
623
- }
624
- }, {
625
- key: "setReadonly",
626
- value: function setReadonly(objs) {
627
- var readonlyval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
628
- var clearChanges = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
629
- var checkObjs = [];
630
- if (!objs) objs = [];
631
- if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
632
- for (var index = 0; index < checkObjs.length; index++) {
633
- var obj = checkObjs[index];
634
- obj.__is_readonly = readonlyval;
635
- if (obj instanceof SimpleObject) {
636
- if (obj.canModify) {
637
- if (!obj.getOriginal()) obj.setOriginal();
638
- } else {
639
- if (clearChanges) obj.clear_changes();
640
- //we dont need the original object in readonly mode
641
- obj.setOriginal(null);
642
- }
643
- }
644
- }
645
- }
646
- }, {
647
- key: "setThrowErrors",
648
- value: function setThrowErrors(objs) {
649
- var throwErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
650
- var checkObjs = [];
651
- if (!objs) objs = [];
652
- if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
653
- for (var index = 0; index < checkObjs.length; index++) {
654
- var element = checkObjs[index];
655
- element.__throw_errors = throwErr;
656
- }
657
- }
658
- }, {
659
- key: "isDeleted",
660
- value: function isDeleted(obj) {
661
- if (obj instanceof SimpleObject) return obj.isDeleted === true;
662
- return false;
663
- }
664
- }, {
665
- key: "getIndexOrID",
666
- value: function getIndexOrID(o) {
667
- var res = SimpleObject.getIndex(o);
668
- if (!res || res == -1) res = SimpleObject.getID(o);
669
- return res || -1;
670
- }
671
- }, {
672
- key: "getIndex",
673
- value: function getIndex(o) {
674
- if (o == null || o == undefined) return -1;
675
- switch (_typeof(o)) {
676
- case "object":
677
- return o._index_value || -1;
678
- case "number":
679
- case "string":
680
- return Number(o);
681
- }
682
- return -1;
683
- }
684
- }, {
685
- key: "getID",
686
- value: function getID(o) {
687
- if (o == null || o == undefined) return "";
688
- switch (_typeof(o)) {
689
- case "object":
690
- if (o._bsontype == "ObjectID" && typeof o.toString === "function") {
691
- return o.toString();
692
- }
693
- return String(o._id || o.ID || o.id || o.__data_id || "");
694
- case "string":
695
- case "number":
696
- return String(o);
697
- }
698
- return "";
699
- }
700
- }, {
701
- key: "setOriginal",
702
- value: function setOriginal(obj) {
703
- var toObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
704
- if (!(obj instanceof SimpleObject)) return undefined;
705
- return obj.setOriginal(toObj);
706
- }
707
- }, {
708
- key: "getOriginal",
709
- value: function getOriginal(obj) {
710
- if (obj instanceof SimpleObject) return obj.getOriginal();
711
- return obj === null || obj === void 0 ? void 0 : obj.__originalobject;
712
- }
713
- /* -------------------------------------------------------------------------- */
714
- /* Errors */
715
- /* -------------------------------------------------------------------------- */
716
- }, {
717
- key: "addError",
718
- value: function addError(o, title, message) {
719
- var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
720
- var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
721
- if (o) {
722
- if (!Array.isArray(o.__errors)) o.__errors = [];
723
- o.__errors.push(errStr);
724
- if (o.__showErrors === false) return;
725
- } else if (sendToRegister === "auto") sendToRegister = true;
726
- if (sendToRegister === true) {
727
- console.error("[REGISTER-ERROR]", errStr);
728
- _global.gfunc.run_action("add_error", {
729
- title: title,
730
- message: message,
731
- type: "error"
732
- });
733
- } else {
734
- console.error("[ERROR]", errStr);
735
- }
736
- return (o === null || o === void 0 ? void 0 : o.__errors) || [];
737
- }
738
- }, {
739
- key: "getErrors",
740
- value: function getErrors(o) {
741
- return (o === null || o === void 0 ? void 0 : o.__errors) || [];
742
- }
743
- }, {
744
- key: "clearErrors",
745
- value: function clearErrors(o) {
746
- if (o) o.__errors = [];
747
- return true;
748
- }
749
- /* -------------------------------------------------------------------------- */
750
- /* Save Results */
751
- /* -------------------------------------------------------------------------- */
752
- /**
753
- * Checks if the given object is a valid and truthy save result
754
- * @param result_object
755
- * @returns
756
- */
757
- }, {
758
- key: "isResultValid",
759
- value: function isResultValid(result_object) {
760
- var sub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
761
- if ((0, _object.object_isEmpty)(result_object)) return false;
762
- switch (_typeof(result_object)) {
763
- case "string":
764
- try {
765
- result_object = JSON.parse(result_object);
766
- return this.isResultValid(result_object);
767
- } catch (_unused) {
768
- return false;
769
- }
770
- case "object":
771
- if ((0, _object.object_isTrue)(result_object.acknowledged)) {
772
- return true;
773
- }
774
- if (result_object.expected && result_object.result) {
775
- return (0, _object.object_equals)(result_object.expected, result_object.result);
776
- }
777
- return Number(this.getID(result_object)) >= 0;
778
- case "number":
779
- return result_object > 0;
780
- case "boolean":
781
- return result_object === true;
782
- }
783
- return false;
784
- }
785
- }, {
786
- key: "factoryClear",
787
- value: function factoryClear(obj) {
788
- obj.clear_changes();
789
- SimpleObject.clearErrors(obj);
790
- }
791
- }, {
792
- key: "delete_cache",
793
- value: function delete_cache() {
794
- if (!this.__cache_name) return;
795
- _global.gcache.delete_cache(this.__cache_name);
796
- }
797
- }, {
798
- key: "get_canModify",
799
- value: function get_canModify(o) {
800
- if (o instanceof SimpleObject) return o.canModify;
801
- return false;
802
- }
803
- /* -------------------------------------------------------------------------- */
804
- }, {
805
- key: "equals",
806
- value: function equals(a, b) {
807
- console.warn("Dont use the default equals method !");
808
- if (a == undefined || b == undefined) return false;
809
- return a === b;
810
- }
811
- }]);
812
- return SimpleObject;
813
- }(_MapableObject2.MapableObject);
814
- exports.SimpleObject = SimpleObject;
815
- function _setSubProperty2(key, subkey, value) {
816
- var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
817
- //@ts-ignore
818
- if (subobj == null || _typeof(subobj) !== "object") subobj = {};
819
- subobj[subkey] = value;
820
- _classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, subobj);
821
- }
822
- function _getSubProperty2(key, subkey) {
823
- var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
824
- var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key, original);
825
- if (subobj == null || _typeof(subobj) !== "object") return undefined;
826
- return subobj[subkey];
827
- }
828
- function _setProperty2(key, value) {
829
- this.__delta[key] = value; //always update delta to keep track of changes
830
- if (!this.__use_delta) this[key] = value; //on noDelta mode, also update the obj
831
- return true;
832
- }
833
- function _setDefaultProperty2(key, value) {
834
- //@ts-ignore
835
- if (this[key] == undefined || this[key] === "" || this[key] === 0) {
836
- this[key] = value;
837
- return true;
838
- }
839
- return false;
840
- }
841
- function _getProperty2(key) {
842
- var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
843
- //check if we should use delta version or normal version for this property
844
- if (this.__use_delta && !original && key in this.__delta) {
845
- //@ts-ignore
846
- return this.__delta[key];
847
- }
848
- return this[key];
849
- }
850
- function _getTempProperty2(key) {
851
- if (!this.__temp) return undefined;
852
- return this.__temp[key];
853
- }
854
- function _setTempProperty2(key, value) {
855
- if (!this.__temp) this.__temp = {};
856
- this.__temp[key] = value;
857
- }
858
- function _setSaveResultObject2(toObj) {
859
- this.__saveResultObject = toObj;
860
- }
861
- _defineProperty(SimpleObject, "__cache_name", void 0);
862
- _defineProperty(SimpleObject, "__unchangeables", void 0);
863
- _defineProperty(SimpleObject, "__changeables", void 0);
864
- _defineProperty(SimpleObject, "__extraProperties", void 0);
865
- _defineProperty(SimpleObject, "__use_delta", true);
866
- var _default = SimpleObject;
867
- exports["default"] = _default;