@azrico/webobject 1.2.30 → 1.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -52
- package/dist/index.js +0 -2
- package/dist/src/WebObjects/ParentWebObject.js +5 -29
- package/dist/src/WebObjects/WebObject.d.ts +1 -1
- package/dist/src/WebObjects/WebObject.js +284 -462
- package/dist/src/WebObjects/WebObjectManager.d.ts +1 -0
- package/dist/src/WebObjects/WebObjectManager.js +134 -209
- package/dist/src/index.js +0 -18
- package/dist/src/structs/DummyObject.js +3 -22
- package/dist/src/structs/MapableObject.js +4 -35
- package/dist/src/structs/MetaObject.js +28 -74
- package/dist/src/structs/ObjectArray.d.ts +1 -1
- package/dist/src/structs/ObjectArray.js +5 -17
- package/dist/src/structs/ObjectManager.d.ts +4 -4
- package/dist/src/structs/ObjectManager.js +152 -295
- package/dist/src/structs/SimpleObject.d.ts +9 -9
- package/dist/src/structs/SimpleObject.js +186 -415
- package/package.json +1 -1
|
@@ -4,159 +4,97 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleObject = void 0;
|
|
7
|
-
|
|
8
7
|
var _global = require("@azrico/global");
|
|
9
|
-
|
|
10
8
|
var _object = require("@azrico/object");
|
|
11
|
-
|
|
12
9
|
var _MapableObject2 = require("./MapableObject");
|
|
13
|
-
|
|
14
10
|
var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
|
|
15
|
-
|
|
16
11
|
var _string = require("@azrico/string");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
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); }
|
|
21
|
-
|
|
22
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; }
|
|
23
|
-
|
|
24
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; }
|
|
25
|
-
|
|
26
|
-
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, $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 generator._invoke = function (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); } }; }(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; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), 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 (object) { var 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; }
|
|
27
|
-
|
|
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; }
|
|
28
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); } }
|
|
29
|
-
|
|
30
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); }); }; }
|
|
31
|
-
|
|
32
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
|
|
34
|
-
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, descriptor.key, descriptor); } }
|
|
35
|
-
|
|
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); } }
|
|
36
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; }
|
|
37
|
-
|
|
38
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); }
|
|
39
|
-
|
|
40
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
-
|
|
42
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); }; }
|
|
43
|
-
|
|
44
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); }
|
|
45
|
-
|
|
46
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
-
|
|
48
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; } }
|
|
49
|
-
|
|
50
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
-
|
|
52
29
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
53
|
-
|
|
54
30
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
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); }
|
|
58
34
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
59
|
-
|
|
60
35
|
var _setSubProperty = /*#__PURE__*/new WeakSet();
|
|
61
|
-
|
|
62
36
|
var _getSubProperty = /*#__PURE__*/new WeakSet();
|
|
63
|
-
|
|
64
37
|
var _setProperty = /*#__PURE__*/new WeakSet();
|
|
65
|
-
|
|
66
38
|
var _setDefaultProperty = /*#__PURE__*/new WeakSet();
|
|
67
|
-
|
|
68
39
|
var _getProperty = /*#__PURE__*/new WeakSet();
|
|
69
|
-
|
|
70
40
|
var _getTempProperty = /*#__PURE__*/new WeakSet();
|
|
71
|
-
|
|
72
41
|
var _setTempProperty = /*#__PURE__*/new WeakSet();
|
|
73
|
-
|
|
74
42
|
var _setSaveResultObject = /*#__PURE__*/new WeakSet();
|
|
75
|
-
|
|
76
43
|
var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
77
44
|
_inherits(SimpleObject, _MapableObject);
|
|
78
|
-
|
|
79
45
|
var _super = _createSuper(SimpleObject);
|
|
80
|
-
|
|
81
46
|
function SimpleObject() {
|
|
82
47
|
var _this;
|
|
83
|
-
|
|
84
48
|
var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
85
|
-
|
|
86
49
|
_classCallCheck(this, SimpleObject);
|
|
87
|
-
|
|
88
50
|
_this = _super.call(this);
|
|
89
|
-
|
|
51
|
+
/**
|
|
52
|
+
* set the response of last save from site
|
|
53
|
+
* @param toObj
|
|
54
|
+
*/
|
|
90
55
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSaveResultObject);
|
|
91
|
-
|
|
92
56
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setTempProperty);
|
|
93
|
-
|
|
94
57
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _getTempProperty);
|
|
95
|
-
|
|
96
58
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
|
|
97
|
-
|
|
98
59
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
|
|
99
|
-
|
|
100
60
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
|
|
101
|
-
|
|
102
61
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
|
|
103
|
-
|
|
104
62
|
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSubProperty);
|
|
105
|
-
|
|
106
63
|
_defineProperty(_assertThisInitialized(_this), "__originalobject", void 0);
|
|
107
|
-
|
|
64
|
+
//changes
|
|
108
65
|
_defineProperty(_assertThisInitialized(_this), "__delta", void 0);
|
|
109
|
-
|
|
110
66
|
_defineProperty(_assertThisInitialized(_this), "__temp", void 0);
|
|
111
|
-
|
|
112
67
|
_defineProperty(_assertThisInitialized(_this), "__changed", false);
|
|
113
|
-
|
|
114
68
|
_defineProperty(_assertThisInitialized(_this), "__lastChanged", "");
|
|
115
|
-
|
|
116
69
|
_defineProperty(_assertThisInitialized(_this), "__is_readonly", void 0);
|
|
117
|
-
|
|
118
70
|
_defineProperty(_assertThisInitialized(_this), "__throw_errors", void 0);
|
|
119
|
-
|
|
71
|
+
//errors
|
|
120
72
|
_defineProperty(_assertThisInitialized(_this), "__errors", void 0);
|
|
121
|
-
|
|
122
73
|
_defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
|
|
123
|
-
|
|
74
|
+
//save results
|
|
124
75
|
_defineProperty(_assertThisInitialized(_this), "__saveResultObject", void 0);
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", void 0);
|
|
127
|
-
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", true);
|
|
128
77
|
_defineProperty(_assertThisInitialized(_this), "__saveResultType", void 0);
|
|
129
|
-
|
|
78
|
+
//sequence key
|
|
130
79
|
_defineProperty(_assertThisInitialized(_this), "_index_key", "");
|
|
131
|
-
|
|
80
|
+
//sequence value , used to index the object with increasing numbers
|
|
132
81
|
_defineProperty(_assertThisInitialized(_this), "_index_value", -1);
|
|
133
|
-
|
|
134
82
|
_defineProperty(_assertThisInitialized(_this), "getValue", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
|
|
135
|
-
|
|
136
83
|
_defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
|
|
137
|
-
|
|
138
84
|
_defineProperty(_assertThisInitialized(_this), "getTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _getTempProperty, _getTempProperty2));
|
|
139
|
-
|
|
140
85
|
_defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
|
|
141
|
-
|
|
142
86
|
_defineProperty(_assertThisInitialized(_this), "setTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _setTempProperty, _setTempProperty2));
|
|
143
|
-
|
|
144
87
|
_defineProperty(_assertThisInitialized(_this), "setDefault", _this.setDefaultValue);
|
|
145
|
-
|
|
146
88
|
_defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
|
|
147
89
|
return null;
|
|
148
90
|
});
|
|
149
|
-
|
|
150
91
|
_this.__delta = {};
|
|
151
92
|
_this.__temp = {};
|
|
152
93
|
_this.__is_readonly = is_readonly;
|
|
153
94
|
_this.__throw_errors = true;
|
|
154
|
-
|
|
155
95
|
_this.clear_changes();
|
|
156
|
-
|
|
157
96
|
return _this;
|
|
158
97
|
}
|
|
159
|
-
|
|
160
98
|
_createClass(SimpleObject, [{
|
|
161
99
|
key: "_static",
|
|
162
100
|
value: function _static() {
|
|
@@ -164,11 +102,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
164
102
|
}
|
|
165
103
|
}, {
|
|
166
104
|
key: "loadValues",
|
|
167
|
-
value:
|
|
168
|
-
/* -------------------------------------------------------------------------- */
|
|
169
|
-
|
|
105
|
+
value: /* -------------------------------------------------------------------------- */
|
|
170
106
|
/* Load */
|
|
171
|
-
|
|
172
107
|
/* -------------------------------------------------------------------------- */
|
|
173
108
|
function loadValues(initObject) {
|
|
174
109
|
var fullUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -186,73 +121,56 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
186
121
|
function () {
|
|
187
122
|
var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
|
|
188
123
|
var sendChanges,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
124
|
+
isValueChanged,
|
|
125
|
+
oldval,
|
|
126
|
+
_args = arguments;
|
|
192
127
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
193
|
-
while (1) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, value);
|
|
222
|
-
|
|
223
|
-
isValueChanged = true;
|
|
224
|
-
} else isValueChanged = false; //console.log("SV:", isValueChanged, oldval, key, value);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
case 11:
|
|
228
|
-
_context.prev = 11;
|
|
229
|
-
|
|
230
|
-
if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
|
|
231
|
-
_context.next = 15;
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
|
|
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)) {
|
|
235
156
|
_context.next = 15;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
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();
|
|
248
168
|
}
|
|
249
169
|
}, _callee, this, [[8,, 11, 16]]);
|
|
250
170
|
}));
|
|
251
|
-
|
|
252
171
|
function setValue(_x, _x2) {
|
|
253
172
|
return _setValue.apply(this, arguments);
|
|
254
173
|
}
|
|
255
|
-
|
|
256
174
|
return setValue;
|
|
257
175
|
}()
|
|
258
176
|
}, {
|
|
@@ -273,162 +191,122 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
273
191
|
function () {
|
|
274
192
|
var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, objKey, subvalue) {
|
|
275
193
|
var sendChanges,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
194
|
+
isValueChanged,
|
|
195
|
+
subval,
|
|
196
|
+
_args2 = arguments;
|
|
279
197
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
280
|
-
while (1) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
})) {
|
|
309
|
-
_classPrivateMethodGet(this, _setSubProperty, _setSubProperty2).call(this, key, objKey, subvalue);
|
|
310
|
-
|
|
311
|
-
isValueChanged = true;
|
|
312
|
-
} else isValueChanged = false;
|
|
313
|
-
|
|
314
|
-
case 11:
|
|
315
|
-
_context2.prev = 11;
|
|
316
|
-
|
|
317
|
-
if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
|
|
318
|
-
_context2.next = 15;
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
|
|
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)) {
|
|
322
226
|
_context2.next = 15;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
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();
|
|
335
238
|
}
|
|
336
239
|
}, _callee2, this, [[8,, 11, 16]]);
|
|
337
240
|
}));
|
|
338
|
-
|
|
339
241
|
function setSubValue(_x3, _x4, _x5) {
|
|
340
242
|
return _setSubValue.apply(this, arguments);
|
|
341
243
|
}
|
|
342
|
-
|
|
343
244
|
return setSubValue;
|
|
344
245
|
}() //Push value on array
|
|
345
|
-
|
|
346
246
|
}, {
|
|
347
247
|
key: "pushValue",
|
|
348
248
|
value: function () {
|
|
349
249
|
var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
350
250
|
var sendChanges,
|
|
351
|
-
|
|
352
|
-
|
|
251
|
+
tempArray,
|
|
252
|
+
_args3 = arguments;
|
|
353
253
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
354
|
-
while (1) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (!this.__throw_errors) {
|
|
395
|
-
_context3.next = 16;
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
throw Error("Cant use pushValue on non Array keys");
|
|
400
|
-
|
|
401
|
-
case 16:
|
|
402
|
-
return _context3.abrupt("return", false);
|
|
403
|
-
|
|
404
|
-
case 17:
|
|
405
|
-
tempArray.push(value);
|
|
406
|
-
|
|
407
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, tempArray);
|
|
408
|
-
|
|
409
|
-
if (!(sendChanges === true || sendChanges === "auto")) {
|
|
410
|
-
_context3.next = 22;
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
|
|
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")) {
|
|
414
294
|
_context3.next = 22;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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();
|
|
424
304
|
}
|
|
425
305
|
}, _callee3, this);
|
|
426
306
|
}));
|
|
427
|
-
|
|
428
307
|
function pushValue(_x6, _x7) {
|
|
429
308
|
return _pushValue.apply(this, arguments);
|
|
430
309
|
}
|
|
431
|
-
|
|
432
310
|
return pushValue;
|
|
433
311
|
}()
|
|
434
312
|
}, {
|
|
@@ -437,74 +315,58 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
437
315
|
var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(type, key, value, subvalue) {
|
|
438
316
|
var lc, manager_class;
|
|
439
317
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
440
|
-
while (1) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
/* --------------------------- notify the manager --------------------------- */
|
|
456
|
-
|
|
457
|
-
manager_class = this.get_managerClass();
|
|
458
|
-
|
|
459
|
-
if (!(manager_class instanceof _ObjectManager["default"])) {
|
|
460
|
-
_context4.next = 10;
|
|
461
|
-
break;
|
|
462
|
-
}
|
|
463
|
-
|
|
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"])) {
|
|
464
333
|
_context4.next = 10;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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();
|
|
471
341
|
}
|
|
472
342
|
}, _callee4, this);
|
|
473
343
|
}));
|
|
474
|
-
|
|
475
344
|
function notifyChanged(_x8, _x9, _x10, _x11) {
|
|
476
345
|
return _notifyChanged.apply(this, arguments);
|
|
477
346
|
}
|
|
478
|
-
|
|
479
347
|
return notifyChanged;
|
|
480
348
|
}()
|
|
481
349
|
}, {
|
|
482
350
|
key: "apply_changes",
|
|
483
|
-
value:
|
|
484
|
-
/* -------------------------------------------------------------------------- */
|
|
485
|
-
|
|
351
|
+
value: /* -------------------------------------------------------------------------- */
|
|
486
352
|
/* Changes */
|
|
487
|
-
|
|
488
353
|
/* -------------------------------------------------------------------------- */
|
|
489
|
-
|
|
490
354
|
/**
|
|
491
355
|
* Apply the changes and empty the delta object
|
|
492
356
|
*/
|
|
493
357
|
function apply_changes() {
|
|
494
358
|
if (!this.__use_delta) {
|
|
495
|
-
|
|
496
|
-
|
|
359
|
+
//in this mode , we track changes by updating the original product
|
|
360
|
+
this.setOriginal();
|
|
361
|
+
return true;
|
|
497
362
|
}
|
|
498
|
-
|
|
499
363
|
if (!this.isChanged) {
|
|
500
364
|
console.warn("No changes to apply");
|
|
501
365
|
}
|
|
502
|
-
|
|
503
366
|
for (var key in this.__delta) {
|
|
504
367
|
var nv = this.__delta[key];
|
|
505
368
|
this[key] = nv;
|
|
506
369
|
}
|
|
507
|
-
|
|
508
370
|
this.clear_changes();
|
|
509
371
|
}
|
|
510
372
|
}, {
|
|
@@ -524,24 +386,17 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
524
386
|
* @param readonlyval readonly
|
|
525
387
|
* @param clearChanges should we clean the changes after setting readonly
|
|
526
388
|
*/
|
|
527
|
-
|
|
528
389
|
}, {
|
|
529
390
|
key: "isChanged",
|
|
530
|
-
get:
|
|
531
|
-
/* -------------------------------------------------------------------------- */
|
|
532
|
-
|
|
391
|
+
get: /* -------------------------------------------------------------------------- */
|
|
533
392
|
/* Get/Check */
|
|
534
|
-
|
|
535
393
|
/* -------------------------------------------------------------------------- */
|
|
536
394
|
function get() {
|
|
537
395
|
var _this2 = this;
|
|
538
|
-
|
|
539
396
|
if (this.__use_delta) return !(0, _object.object_isEmpty)(this.__delta);else {
|
|
540
397
|
var orig = this.getOriginal();
|
|
541
398
|
if (!orig) return false; //we dont know if anything has changed
|
|
542
|
-
|
|
543
399
|
/* if object is not using delta mode, check changes by comparing changable fields with original object */
|
|
544
|
-
|
|
545
400
|
if (Array.isArray(this.__changeables)) {
|
|
546
401
|
//console.log("chk", this.__changeables, "for changes");
|
|
547
402
|
return this.__changeables.find(function (c) {
|
|
@@ -553,7 +408,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
553
408
|
if (key.startsWith("__")) continue;
|
|
554
409
|
if (!(0, _object.object_equals)(this[key], orig[key])) return true;
|
|
555
410
|
}
|
|
556
|
-
|
|
557
411
|
return false;
|
|
558
412
|
}
|
|
559
413
|
}
|
|
@@ -570,12 +424,10 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
570
424
|
return this.__use_delta ? this.__delta : this;
|
|
571
425
|
}
|
|
572
426
|
/* all updated properties */
|
|
573
|
-
|
|
574
427
|
}, {
|
|
575
428
|
key: "allproperties",
|
|
576
429
|
get: function get() {
|
|
577
430
|
var result = _objectSpread(_objectSpread({}, this), this.__delta);
|
|
578
|
-
|
|
579
431
|
result.__delta = {};
|
|
580
432
|
return result;
|
|
581
433
|
}
|
|
@@ -608,7 +460,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
608
460
|
key: "isSaved",
|
|
609
461
|
get: function get() {
|
|
610
462
|
var _this$__saveResultIsS;
|
|
611
|
-
|
|
612
463
|
return Boolean((_this$__saveResultIsS = this.__saveResultIsSuccess) !== null && _this$__saveResultIsS !== void 0 ? _this$__saveResultIsS : false);
|
|
613
464
|
}
|
|
614
465
|
}, {
|
|
@@ -647,11 +498,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
647
498
|
}
|
|
648
499
|
}, {
|
|
649
500
|
key: "getOriginal",
|
|
650
|
-
value:
|
|
651
|
-
/* -------------------------------------------------------------------------- */
|
|
652
|
-
|
|
501
|
+
value: /* -------------------------------------------------------------------------- */
|
|
653
502
|
/* Original */
|
|
654
|
-
|
|
655
503
|
/* -------------------------------------------------------------------------- */
|
|
656
504
|
function getOriginal() {
|
|
657
505
|
return this.__originalobject || undefined;
|
|
@@ -660,22 +508,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
660
508
|
key: "setOriginal",
|
|
661
509
|
value: function setOriginal() {
|
|
662
510
|
var toObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
663
|
-
|
|
664
511
|
if (toObj === null) {
|
|
665
512
|
delete this.__originalobject;
|
|
666
513
|
return;
|
|
667
514
|
}
|
|
668
|
-
|
|
669
515
|
if (!this.canModify) {
|
|
670
516
|
console.warn("Cant use setOriginal on non original OR readonly objects ! this will create an infinite loop");
|
|
671
517
|
delete this.__originalobject;
|
|
672
518
|
return;
|
|
673
519
|
}
|
|
674
|
-
|
|
675
520
|
if (toObj === 0) {
|
|
676
521
|
toObj = this;
|
|
677
522
|
}
|
|
678
|
-
|
|
679
523
|
var cloneObject = (0, _object.object_clone)(toObj);
|
|
680
524
|
SimpleObject.setReadonly(cloneObject, true);
|
|
681
525
|
this.__originalobject = (0, _object.object_removeKeys)(cloneObject, ["__"]);
|
|
@@ -694,25 +538,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
694
538
|
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
|
|
695
539
|
} else {
|
|
696
540
|
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, null);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
541
|
+
}
|
|
542
|
+
//check if the given object is a valid save result
|
|
700
543
|
if (type === "error") this.__saveResultIsSuccess = false;else this.__saveResultIsSuccess = Boolean(type === "nothing" || this.constructor["isResultValid"](toObj));
|
|
701
|
-
|
|
702
544
|
if (type === "auto") {
|
|
703
545
|
type = this.__saveResultIsSuccess ? "normal" : "error";
|
|
704
546
|
}
|
|
705
|
-
|
|
706
547
|
this.__saveResultType = type;
|
|
707
548
|
}
|
|
708
|
-
/**
|
|
709
|
-
* set the response of last save from site
|
|
710
|
-
* @param toObj
|
|
711
|
-
*/
|
|
712
|
-
|
|
713
549
|
}, {
|
|
714
550
|
key: "getSaveResult",
|
|
715
551
|
value: function getSaveResult() {
|
|
552
|
+
var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
716
553
|
if (this.isSaved) return this.__saveResultObject;
|
|
717
554
|
return false;
|
|
718
555
|
}
|
|
@@ -722,17 +559,13 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
722
559
|
return this.__saveResultType || "nothing";
|
|
723
560
|
}
|
|
724
561
|
/* -------------------------------------------------------------------------- */
|
|
725
|
-
|
|
726
562
|
/* statics */
|
|
727
|
-
|
|
728
563
|
/* -------------------------------------------------------------------------- */
|
|
729
|
-
|
|
730
564
|
}], [{
|
|
731
565
|
key: "loadValues",
|
|
732
566
|
value: function loadValues(obj, initObject) {
|
|
733
567
|
var fullUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
734
568
|
SimpleObject.factoryClear(obj);
|
|
735
|
-
|
|
736
569
|
if (initObject == null) {
|
|
737
570
|
for (var key in obj) {
|
|
738
571
|
if (typeof obj[key] === "function") continue;
|
|
@@ -742,41 +575,34 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
742
575
|
} else if (_typeof(initObject) == "object") {
|
|
743
576
|
for (var _key in initObject) {
|
|
744
577
|
if (_key.startsWith("__")) continue;
|
|
745
|
-
|
|
746
578
|
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key)) {
|
|
747
579
|
obj[_key] = initObject[_key];
|
|
748
580
|
}
|
|
749
581
|
}
|
|
750
582
|
}
|
|
751
|
-
|
|
752
583
|
return true;
|
|
753
584
|
}
|
|
754
585
|
/* -------------------------------------------------------------------------- */
|
|
755
|
-
|
|
756
586
|
}, {
|
|
757
587
|
key: "getValue",
|
|
758
588
|
value: function getValue(o, key) {
|
|
759
589
|
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
760
590
|
if (o == null) return undefined;
|
|
761
591
|
if (o instanceof SimpleObject && typeof o.getValue === "function") return o.getValue(key, original);
|
|
762
|
-
|
|
763
592
|
if (!original && o.__use_delta != false && _typeof(o.__delta) === "object" && key in o.__delta) {
|
|
764
593
|
//@ts-ignore
|
|
765
594
|
return o.__delta[key];
|
|
766
595
|
}
|
|
767
|
-
|
|
768
596
|
return o[key];
|
|
769
597
|
}
|
|
770
598
|
}, {
|
|
771
599
|
key: "canChangeKey",
|
|
772
600
|
value: function canChangeKey(object, key, useExtraProps) {
|
|
773
601
|
if (!object || !key) return false;
|
|
774
|
-
|
|
775
602
|
if (useExtraProps) {
|
|
776
603
|
var __extraProperties = object.constructor["__extraProperties"];
|
|
777
604
|
if (__extraProperties != null && __extraProperties.includes(key)) return true;
|
|
778
605
|
}
|
|
779
|
-
|
|
780
606
|
var __changeables = object.constructor["__changeables"];
|
|
781
607
|
var __unchangeables = object.constructor["__unchangeables"];
|
|
782
608
|
if (__changeables != null && !__changeables.includes(key)) return false;
|
|
@@ -791,17 +617,15 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
791
617
|
var checkObjs = [];
|
|
792
618
|
if (!objs) objs = [];
|
|
793
619
|
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
794
|
-
|
|
795
620
|
for (var index = 0; index < checkObjs.length; index++) {
|
|
796
621
|
var obj = checkObjs[index];
|
|
797
622
|
obj.__is_readonly = readonlyval;
|
|
798
|
-
|
|
799
623
|
if (obj instanceof SimpleObject) {
|
|
800
624
|
if (obj.canModify) {
|
|
801
625
|
if (!obj.getOriginal()) obj.setOriginal();
|
|
802
626
|
} else {
|
|
803
|
-
if (clearChanges) obj.clear_changes();
|
|
804
|
-
|
|
627
|
+
if (clearChanges) obj.clear_changes();
|
|
628
|
+
//we dont need the original object in readonly mode
|
|
805
629
|
obj.setOriginal(null);
|
|
806
630
|
}
|
|
807
631
|
}
|
|
@@ -814,7 +638,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
814
638
|
var checkObjs = [];
|
|
815
639
|
if (!objs) objs = [];
|
|
816
640
|
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
817
|
-
|
|
818
641
|
for (var index = 0; index < checkObjs.length; index++) {
|
|
819
642
|
var element = checkObjs[index];
|
|
820
643
|
element.__throw_errors = throwErr;
|
|
@@ -837,36 +660,29 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
837
660
|
key: "getIndex",
|
|
838
661
|
value: function getIndex(o) {
|
|
839
662
|
if (o == null || o == undefined) return -1;
|
|
840
|
-
|
|
841
663
|
switch (_typeof(o)) {
|
|
842
664
|
case "object":
|
|
843
665
|
return o._index_value || -1;
|
|
844
|
-
|
|
845
666
|
case "number":
|
|
846
667
|
case "string":
|
|
847
668
|
return Number(o);
|
|
848
669
|
}
|
|
849
|
-
|
|
850
670
|
return -1;
|
|
851
671
|
}
|
|
852
672
|
}, {
|
|
853
673
|
key: "getID",
|
|
854
674
|
value: function getID(o) {
|
|
855
675
|
if (o == null || o == undefined) return "";
|
|
856
|
-
|
|
857
676
|
switch (_typeof(o)) {
|
|
858
677
|
case "object":
|
|
859
678
|
if (o._bsontype == "ObjectID" && typeof o.toString === "function") {
|
|
860
679
|
return o.toString();
|
|
861
680
|
}
|
|
862
|
-
|
|
863
681
|
return String(o._id || o.ID || o.id || o.__data_id || "");
|
|
864
|
-
|
|
865
682
|
case "string":
|
|
866
683
|
case "number":
|
|
867
684
|
return String(o);
|
|
868
685
|
}
|
|
869
|
-
|
|
870
686
|
return "";
|
|
871
687
|
}
|
|
872
688
|
}, {
|
|
@@ -883,28 +699,20 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
883
699
|
return obj === null || obj === void 0 ? void 0 : obj.__originalobject;
|
|
884
700
|
}
|
|
885
701
|
/* -------------------------------------------------------------------------- */
|
|
886
|
-
|
|
887
702
|
/* Errors */
|
|
888
|
-
|
|
889
703
|
/* -------------------------------------------------------------------------- */
|
|
890
|
-
|
|
891
704
|
}, {
|
|
892
705
|
key: "addError",
|
|
893
706
|
value: function addError(o, title, message) {
|
|
894
707
|
var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
895
708
|
var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
|
|
896
|
-
|
|
897
709
|
if (o) {
|
|
898
710
|
if (!Array.isArray(o.__errors)) o.__errors = [];
|
|
899
|
-
|
|
900
711
|
o.__errors.push(errStr);
|
|
901
|
-
|
|
902
712
|
if (o.__showErrors === false) return;
|
|
903
713
|
} else if (sendToRegister === "auto") sendToRegister = true;
|
|
904
|
-
|
|
905
714
|
if (sendToRegister === true) {
|
|
906
715
|
console.error("[REGISTER-ERROR]", errStr);
|
|
907
|
-
|
|
908
716
|
_global.gfunc.run_action("add_error", {
|
|
909
717
|
title: title,
|
|
910
718
|
message: message,
|
|
@@ -913,7 +721,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
913
721
|
} else {
|
|
914
722
|
console.error("[ERROR]", errStr);
|
|
915
723
|
}
|
|
916
|
-
|
|
917
724
|
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
918
725
|
}
|
|
919
726
|
}, {
|
|
@@ -928,23 +735,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
928
735
|
return true;
|
|
929
736
|
}
|
|
930
737
|
/* -------------------------------------------------------------------------- */
|
|
931
|
-
|
|
932
738
|
/* Save Results */
|
|
933
|
-
|
|
934
739
|
/* -------------------------------------------------------------------------- */
|
|
935
|
-
|
|
936
740
|
/**
|
|
937
741
|
* Checks if the given object is a valid and truthy save result
|
|
938
742
|
* @param result_object
|
|
939
743
|
* @returns
|
|
940
744
|
*/
|
|
941
|
-
|
|
942
745
|
}, {
|
|
943
746
|
key: "isResultValid",
|
|
944
747
|
value: function isResultValid(result_object) {
|
|
945
748
|
var sub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
946
749
|
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
947
|
-
|
|
948
750
|
switch (_typeof(result_object)) {
|
|
949
751
|
case "string":
|
|
950
752
|
try {
|
|
@@ -953,25 +755,19 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
953
755
|
} catch (_unused) {
|
|
954
756
|
return false;
|
|
955
757
|
}
|
|
956
|
-
|
|
957
758
|
case "object":
|
|
958
759
|
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|
|
959
760
|
return true;
|
|
960
761
|
}
|
|
961
|
-
|
|
962
762
|
if (result_object.expected && result_object.result) {
|
|
963
763
|
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
964
764
|
}
|
|
965
|
-
|
|
966
765
|
return Number(this.getID(result_object)) >= 0;
|
|
967
|
-
|
|
968
766
|
case "number":
|
|
969
767
|
return result_object > 0;
|
|
970
|
-
|
|
971
768
|
case "boolean":
|
|
972
769
|
return result_object === true;
|
|
973
770
|
}
|
|
974
|
-
|
|
975
771
|
return false;
|
|
976
772
|
}
|
|
977
773
|
}, {
|
|
@@ -984,7 +780,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
984
780
|
key: "delete_cache",
|
|
985
781
|
value: function delete_cache() {
|
|
986
782
|
if (!this.__cache_name) return;
|
|
987
|
-
|
|
988
783
|
_global.gcache.delete_cache(this.__cache_name);
|
|
989
784
|
}
|
|
990
785
|
}, {
|
|
@@ -994,7 +789,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
994
789
|
return false;
|
|
995
790
|
}
|
|
996
791
|
/* -------------------------------------------------------------------------- */
|
|
997
|
-
|
|
998
792
|
}, {
|
|
999
793
|
key: "equals",
|
|
1000
794
|
value: function equals(a, b) {
|
|
@@ -1003,81 +797,58 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
1003
797
|
return a === b;
|
|
1004
798
|
}
|
|
1005
799
|
}]);
|
|
1006
|
-
|
|
1007
800
|
return SimpleObject;
|
|
1008
801
|
}(_MapableObject2.MapableObject);
|
|
1009
|
-
|
|
1010
802
|
exports.SimpleObject = SimpleObject;
|
|
1011
|
-
|
|
1012
803
|
function _setSubProperty2(key, subkey, value) {
|
|
1013
|
-
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
1014
|
-
|
|
1015
|
-
|
|
804
|
+
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
805
|
+
//@ts-ignore
|
|
1016
806
|
if (subobj == null || _typeof(subobj) !== "object") subobj = {};
|
|
1017
807
|
subobj[subkey] = value;
|
|
1018
|
-
|
|
1019
808
|
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, subobj);
|
|
1020
809
|
}
|
|
1021
|
-
|
|
1022
810
|
function _getSubProperty2(key, subkey) {
|
|
1023
811
|
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1024
|
-
|
|
1025
812
|
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key, original);
|
|
1026
|
-
|
|
1027
813
|
if (subobj == null || _typeof(subobj) !== "object") return undefined;
|
|
1028
814
|
return subobj[subkey];
|
|
1029
815
|
}
|
|
1030
|
-
|
|
1031
816
|
function _setProperty2(key, value) {
|
|
1032
817
|
if (this.__use_delta) this.__delta[key] = value;else this[key] = value;
|
|
1033
818
|
return true;
|
|
1034
819
|
}
|
|
1035
|
-
|
|
1036
820
|
function _setDefaultProperty2(key, value) {
|
|
1037
821
|
//@ts-ignore
|
|
1038
822
|
if (this[key] == undefined || this[key] === "" || this[key] === 0) {
|
|
1039
823
|
this[key] = value;
|
|
1040
824
|
return true;
|
|
1041
825
|
}
|
|
1042
|
-
|
|
1043
826
|
return false;
|
|
1044
827
|
}
|
|
1045
|
-
|
|
1046
828
|
function _getProperty2(key) {
|
|
1047
829
|
var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1048
|
-
|
|
1049
830
|
//check if we should use delta version or normal version for this property
|
|
1050
831
|
if (this.__use_delta && !original && key in this.__delta) {
|
|
1051
832
|
//@ts-ignore
|
|
1052
833
|
return this.__delta[key];
|
|
1053
834
|
}
|
|
1054
|
-
|
|
1055
835
|
return this[key];
|
|
1056
836
|
}
|
|
1057
|
-
|
|
1058
837
|
function _getTempProperty2(key) {
|
|
1059
838
|
if (!this.__temp) return undefined;
|
|
1060
839
|
return this.__temp[key];
|
|
1061
840
|
}
|
|
1062
|
-
|
|
1063
841
|
function _setTempProperty2(key, value) {
|
|
1064
842
|
if (!this.__temp) this.__temp = {};
|
|
1065
843
|
this.__temp[key] = value;
|
|
1066
844
|
}
|
|
1067
|
-
|
|
1068
845
|
function _setSaveResultObject2(toObj) {
|
|
1069
846
|
this.__saveResultObject = toObj;
|
|
1070
847
|
}
|
|
1071
|
-
|
|
1072
848
|
_defineProperty(SimpleObject, "__cache_name", void 0);
|
|
1073
|
-
|
|
1074
849
|
_defineProperty(SimpleObject, "__unchangeables", void 0);
|
|
1075
|
-
|
|
1076
850
|
_defineProperty(SimpleObject, "__changeables", void 0);
|
|
1077
|
-
|
|
1078
851
|
_defineProperty(SimpleObject, "__extraProperties", void 0);
|
|
1079
|
-
|
|
1080
852
|
_defineProperty(SimpleObject, "__use_delta", true);
|
|
1081
|
-
|
|
1082
853
|
var _default = SimpleObject;
|
|
1083
854
|
exports["default"] = _default;
|