@azrico/webobject 1.2.31 → 1.2.33
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 +10 -10
- package/dist/src/structs/SimpleObject.js +190 -414
- 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
76
|
_defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", true);
|
|
127
|
-
|
|
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,86 +315,75 @@ 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");
|
|
365
|
+
this.clear_changes();
|
|
366
|
+
return false;
|
|
501
367
|
}
|
|
502
|
-
|
|
503
368
|
for (var key in this.__delta) {
|
|
504
369
|
var nv = this.__delta[key];
|
|
505
370
|
this[key] = nv;
|
|
506
371
|
}
|
|
507
|
-
|
|
508
372
|
this.clear_changes();
|
|
373
|
+
return true;
|
|
509
374
|
}
|
|
510
375
|
}, {
|
|
511
376
|
key: "clear_changes",
|
|
512
377
|
value: function clear_changes() {
|
|
513
378
|
this.__delta = {};
|
|
514
379
|
this.__changed = false;
|
|
380
|
+
return true;
|
|
515
381
|
}
|
|
516
382
|
}, {
|
|
517
383
|
key: "clear_cache",
|
|
518
384
|
value: function clear_cache() {
|
|
519
385
|
this.__temp = {};
|
|
386
|
+
return true;
|
|
520
387
|
}
|
|
521
388
|
/**
|
|
522
389
|
* Sets readonly property on given objects
|
|
@@ -524,24 +391,17 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
524
391
|
* @param readonlyval readonly
|
|
525
392
|
* @param clearChanges should we clean the changes after setting readonly
|
|
526
393
|
*/
|
|
527
|
-
|
|
528
394
|
}, {
|
|
529
395
|
key: "isChanged",
|
|
530
|
-
get:
|
|
531
|
-
/* -------------------------------------------------------------------------- */
|
|
532
|
-
|
|
396
|
+
get: /* -------------------------------------------------------------------------- */
|
|
533
397
|
/* Get/Check */
|
|
534
|
-
|
|
535
398
|
/* -------------------------------------------------------------------------- */
|
|
536
399
|
function get() {
|
|
537
400
|
var _this2 = this;
|
|
538
|
-
|
|
539
401
|
if (this.__use_delta) return !(0, _object.object_isEmpty)(this.__delta);else {
|
|
540
402
|
var orig = this.getOriginal();
|
|
541
403
|
if (!orig) return false; //we dont know if anything has changed
|
|
542
|
-
|
|
543
404
|
/* if object is not using delta mode, check changes by comparing changable fields with original object */
|
|
544
|
-
|
|
545
405
|
if (Array.isArray(this.__changeables)) {
|
|
546
406
|
//console.log("chk", this.__changeables, "for changes");
|
|
547
407
|
return this.__changeables.find(function (c) {
|
|
@@ -553,7 +413,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
553
413
|
if (key.startsWith("__")) continue;
|
|
554
414
|
if (!(0, _object.object_equals)(this[key], orig[key])) return true;
|
|
555
415
|
}
|
|
556
|
-
|
|
557
416
|
return false;
|
|
558
417
|
}
|
|
559
418
|
}
|
|
@@ -570,12 +429,10 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
570
429
|
return this.__use_delta ? this.__delta : this;
|
|
571
430
|
}
|
|
572
431
|
/* all updated properties */
|
|
573
|
-
|
|
574
432
|
}, {
|
|
575
433
|
key: "allproperties",
|
|
576
434
|
get: function get() {
|
|
577
435
|
var result = _objectSpread(_objectSpread({}, this), this.__delta);
|
|
578
|
-
|
|
579
436
|
result.__delta = {};
|
|
580
437
|
return result;
|
|
581
438
|
}
|
|
@@ -608,7 +465,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
608
465
|
key: "isSaved",
|
|
609
466
|
get: function get() {
|
|
610
467
|
var _this$__saveResultIsS;
|
|
611
|
-
|
|
612
468
|
return Boolean((_this$__saveResultIsS = this.__saveResultIsSuccess) !== null && _this$__saveResultIsS !== void 0 ? _this$__saveResultIsS : false);
|
|
613
469
|
}
|
|
614
470
|
}, {
|
|
@@ -647,11 +503,8 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
647
503
|
}
|
|
648
504
|
}, {
|
|
649
505
|
key: "getOriginal",
|
|
650
|
-
value:
|
|
651
|
-
/* -------------------------------------------------------------------------- */
|
|
652
|
-
|
|
506
|
+
value: /* -------------------------------------------------------------------------- */
|
|
653
507
|
/* Original */
|
|
654
|
-
|
|
655
508
|
/* -------------------------------------------------------------------------- */
|
|
656
509
|
function getOriginal() {
|
|
657
510
|
return this.__originalobject || undefined;
|
|
@@ -660,22 +513,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
660
513
|
key: "setOriginal",
|
|
661
514
|
value: function setOriginal() {
|
|
662
515
|
var toObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
663
|
-
|
|
664
516
|
if (toObj === null) {
|
|
665
517
|
delete this.__originalobject;
|
|
666
518
|
return;
|
|
667
519
|
}
|
|
668
|
-
|
|
669
520
|
if (!this.canModify) {
|
|
670
521
|
console.warn("Cant use setOriginal on non original OR readonly objects ! this will create an infinite loop");
|
|
671
522
|
delete this.__originalobject;
|
|
672
523
|
return;
|
|
673
524
|
}
|
|
674
|
-
|
|
675
525
|
if (toObj === 0) {
|
|
676
526
|
toObj = this;
|
|
677
527
|
}
|
|
678
|
-
|
|
679
528
|
var cloneObject = (0, _object.object_clone)(toObj);
|
|
680
529
|
SimpleObject.setReadonly(cloneObject, true);
|
|
681
530
|
this.__originalobject = (0, _object.object_removeKeys)(cloneObject, ["__"]);
|
|
@@ -694,25 +543,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
694
543
|
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
|
|
695
544
|
} else {
|
|
696
545
|
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, null);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
546
|
+
}
|
|
547
|
+
//check if the given object is a valid save result
|
|
700
548
|
if (type === "error") this.__saveResultIsSuccess = false;else this.__saveResultIsSuccess = Boolean(type === "nothing" || this.constructor["isResultValid"](toObj));
|
|
701
|
-
|
|
702
549
|
if (type === "auto") {
|
|
703
550
|
type = this.__saveResultIsSuccess ? "normal" : "error";
|
|
704
551
|
}
|
|
705
|
-
|
|
706
552
|
this.__saveResultType = type;
|
|
707
553
|
}
|
|
708
|
-
/**
|
|
709
|
-
* set the response of last save from site
|
|
710
|
-
* @param toObj
|
|
711
|
-
*/
|
|
712
|
-
|
|
713
554
|
}, {
|
|
714
555
|
key: "getSaveResult",
|
|
715
556
|
value: function getSaveResult() {
|
|
557
|
+
var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
716
558
|
if (this.isSaved) return this.__saveResultObject;
|
|
717
559
|
return false;
|
|
718
560
|
}
|
|
@@ -722,17 +564,13 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
722
564
|
return this.__saveResultType || "nothing";
|
|
723
565
|
}
|
|
724
566
|
/* -------------------------------------------------------------------------- */
|
|
725
|
-
|
|
726
567
|
/* statics */
|
|
727
|
-
|
|
728
568
|
/* -------------------------------------------------------------------------- */
|
|
729
|
-
|
|
730
569
|
}], [{
|
|
731
570
|
key: "loadValues",
|
|
732
571
|
value: function loadValues(obj, initObject) {
|
|
733
572
|
var fullUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
734
573
|
SimpleObject.factoryClear(obj);
|
|
735
|
-
|
|
736
574
|
if (initObject == null) {
|
|
737
575
|
for (var key in obj) {
|
|
738
576
|
if (typeof obj[key] === "function") continue;
|
|
@@ -742,41 +580,34 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
742
580
|
} else if (_typeof(initObject) == "object") {
|
|
743
581
|
for (var _key in initObject) {
|
|
744
582
|
if (_key.startsWith("__")) continue;
|
|
745
|
-
|
|
746
583
|
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key)) {
|
|
747
584
|
obj[_key] = initObject[_key];
|
|
748
585
|
}
|
|
749
586
|
}
|
|
750
587
|
}
|
|
751
|
-
|
|
752
588
|
return true;
|
|
753
589
|
}
|
|
754
590
|
/* -------------------------------------------------------------------------- */
|
|
755
|
-
|
|
756
591
|
}, {
|
|
757
592
|
key: "getValue",
|
|
758
593
|
value: function getValue(o, key) {
|
|
759
594
|
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
760
595
|
if (o == null) return undefined;
|
|
761
596
|
if (o instanceof SimpleObject && typeof o.getValue === "function") return o.getValue(key, original);
|
|
762
|
-
|
|
763
597
|
if (!original && o.__use_delta != false && _typeof(o.__delta) === "object" && key in o.__delta) {
|
|
764
598
|
//@ts-ignore
|
|
765
599
|
return o.__delta[key];
|
|
766
600
|
}
|
|
767
|
-
|
|
768
601
|
return o[key];
|
|
769
602
|
}
|
|
770
603
|
}, {
|
|
771
604
|
key: "canChangeKey",
|
|
772
605
|
value: function canChangeKey(object, key, useExtraProps) {
|
|
773
606
|
if (!object || !key) return false;
|
|
774
|
-
|
|
775
607
|
if (useExtraProps) {
|
|
776
608
|
var __extraProperties = object.constructor["__extraProperties"];
|
|
777
609
|
if (__extraProperties != null && __extraProperties.includes(key)) return true;
|
|
778
610
|
}
|
|
779
|
-
|
|
780
611
|
var __changeables = object.constructor["__changeables"];
|
|
781
612
|
var __unchangeables = object.constructor["__unchangeables"];
|
|
782
613
|
if (__changeables != null && !__changeables.includes(key)) return false;
|
|
@@ -791,17 +622,15 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
791
622
|
var checkObjs = [];
|
|
792
623
|
if (!objs) objs = [];
|
|
793
624
|
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
794
|
-
|
|
795
625
|
for (var index = 0; index < checkObjs.length; index++) {
|
|
796
626
|
var obj = checkObjs[index];
|
|
797
627
|
obj.__is_readonly = readonlyval;
|
|
798
|
-
|
|
799
628
|
if (obj instanceof SimpleObject) {
|
|
800
629
|
if (obj.canModify) {
|
|
801
630
|
if (!obj.getOriginal()) obj.setOriginal();
|
|
802
631
|
} else {
|
|
803
|
-
if (clearChanges) obj.clear_changes();
|
|
804
|
-
|
|
632
|
+
if (clearChanges) obj.clear_changes();
|
|
633
|
+
//we dont need the original object in readonly mode
|
|
805
634
|
obj.setOriginal(null);
|
|
806
635
|
}
|
|
807
636
|
}
|
|
@@ -814,7 +643,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
814
643
|
var checkObjs = [];
|
|
815
644
|
if (!objs) objs = [];
|
|
816
645
|
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
817
|
-
|
|
818
646
|
for (var index = 0; index < checkObjs.length; index++) {
|
|
819
647
|
var element = checkObjs[index];
|
|
820
648
|
element.__throw_errors = throwErr;
|
|
@@ -837,36 +665,29 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
837
665
|
key: "getIndex",
|
|
838
666
|
value: function getIndex(o) {
|
|
839
667
|
if (o == null || o == undefined) return -1;
|
|
840
|
-
|
|
841
668
|
switch (_typeof(o)) {
|
|
842
669
|
case "object":
|
|
843
670
|
return o._index_value || -1;
|
|
844
|
-
|
|
845
671
|
case "number":
|
|
846
672
|
case "string":
|
|
847
673
|
return Number(o);
|
|
848
674
|
}
|
|
849
|
-
|
|
850
675
|
return -1;
|
|
851
676
|
}
|
|
852
677
|
}, {
|
|
853
678
|
key: "getID",
|
|
854
679
|
value: function getID(o) {
|
|
855
680
|
if (o == null || o == undefined) return "";
|
|
856
|
-
|
|
857
681
|
switch (_typeof(o)) {
|
|
858
682
|
case "object":
|
|
859
683
|
if (o._bsontype == "ObjectID" && typeof o.toString === "function") {
|
|
860
684
|
return o.toString();
|
|
861
685
|
}
|
|
862
|
-
|
|
863
686
|
return String(o._id || o.ID || o.id || o.__data_id || "");
|
|
864
|
-
|
|
865
687
|
case "string":
|
|
866
688
|
case "number":
|
|
867
689
|
return String(o);
|
|
868
690
|
}
|
|
869
|
-
|
|
870
691
|
return "";
|
|
871
692
|
}
|
|
872
693
|
}, {
|
|
@@ -883,28 +704,20 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
883
704
|
return obj === null || obj === void 0 ? void 0 : obj.__originalobject;
|
|
884
705
|
}
|
|
885
706
|
/* -------------------------------------------------------------------------- */
|
|
886
|
-
|
|
887
707
|
/* Errors */
|
|
888
|
-
|
|
889
708
|
/* -------------------------------------------------------------------------- */
|
|
890
|
-
|
|
891
709
|
}, {
|
|
892
710
|
key: "addError",
|
|
893
711
|
value: function addError(o, title, message) {
|
|
894
712
|
var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
895
713
|
var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
|
|
896
|
-
|
|
897
714
|
if (o) {
|
|
898
715
|
if (!Array.isArray(o.__errors)) o.__errors = [];
|
|
899
|
-
|
|
900
716
|
o.__errors.push(errStr);
|
|
901
|
-
|
|
902
717
|
if (o.__showErrors === false) return;
|
|
903
718
|
} else if (sendToRegister === "auto") sendToRegister = true;
|
|
904
|
-
|
|
905
719
|
if (sendToRegister === true) {
|
|
906
720
|
console.error("[REGISTER-ERROR]", errStr);
|
|
907
|
-
|
|
908
721
|
_global.gfunc.run_action("add_error", {
|
|
909
722
|
title: title,
|
|
910
723
|
message: message,
|
|
@@ -913,7 +726,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
913
726
|
} else {
|
|
914
727
|
console.error("[ERROR]", errStr);
|
|
915
728
|
}
|
|
916
|
-
|
|
917
729
|
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
918
730
|
}
|
|
919
731
|
}, {
|
|
@@ -928,23 +740,18 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
928
740
|
return true;
|
|
929
741
|
}
|
|
930
742
|
/* -------------------------------------------------------------------------- */
|
|
931
|
-
|
|
932
743
|
/* Save Results */
|
|
933
|
-
|
|
934
744
|
/* -------------------------------------------------------------------------- */
|
|
935
|
-
|
|
936
745
|
/**
|
|
937
746
|
* Checks if the given object is a valid and truthy save result
|
|
938
747
|
* @param result_object
|
|
939
748
|
* @returns
|
|
940
749
|
*/
|
|
941
|
-
|
|
942
750
|
}, {
|
|
943
751
|
key: "isResultValid",
|
|
944
752
|
value: function isResultValid(result_object) {
|
|
945
753
|
var sub = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
946
754
|
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
947
|
-
|
|
948
755
|
switch (_typeof(result_object)) {
|
|
949
756
|
case "string":
|
|
950
757
|
try {
|
|
@@ -953,25 +760,19 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
953
760
|
} catch (_unused) {
|
|
954
761
|
return false;
|
|
955
762
|
}
|
|
956
|
-
|
|
957
763
|
case "object":
|
|
958
764
|
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|
|
959
765
|
return true;
|
|
960
766
|
}
|
|
961
|
-
|
|
962
767
|
if (result_object.expected && result_object.result) {
|
|
963
768
|
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
964
769
|
}
|
|
965
|
-
|
|
966
770
|
return Number(this.getID(result_object)) >= 0;
|
|
967
|
-
|
|
968
771
|
case "number":
|
|
969
772
|
return result_object > 0;
|
|
970
|
-
|
|
971
773
|
case "boolean":
|
|
972
774
|
return result_object === true;
|
|
973
775
|
}
|
|
974
|
-
|
|
975
776
|
return false;
|
|
976
777
|
}
|
|
977
778
|
}, {
|
|
@@ -984,7 +785,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
984
785
|
key: "delete_cache",
|
|
985
786
|
value: function delete_cache() {
|
|
986
787
|
if (!this.__cache_name) return;
|
|
987
|
-
|
|
988
788
|
_global.gcache.delete_cache(this.__cache_name);
|
|
989
789
|
}
|
|
990
790
|
}, {
|
|
@@ -994,7 +794,6 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
994
794
|
return false;
|
|
995
795
|
}
|
|
996
796
|
/* -------------------------------------------------------------------------- */
|
|
997
|
-
|
|
998
797
|
}, {
|
|
999
798
|
key: "equals",
|
|
1000
799
|
value: function equals(a, b) {
|
|
@@ -1003,81 +802,58 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
1003
802
|
return a === b;
|
|
1004
803
|
}
|
|
1005
804
|
}]);
|
|
1006
|
-
|
|
1007
805
|
return SimpleObject;
|
|
1008
806
|
}(_MapableObject2.MapableObject);
|
|
1009
|
-
|
|
1010
807
|
exports.SimpleObject = SimpleObject;
|
|
1011
|
-
|
|
1012
808
|
function _setSubProperty2(key, subkey, value) {
|
|
1013
|
-
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
1014
|
-
|
|
1015
|
-
|
|
809
|
+
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
810
|
+
//@ts-ignore
|
|
1016
811
|
if (subobj == null || _typeof(subobj) !== "object") subobj = {};
|
|
1017
812
|
subobj[subkey] = value;
|
|
1018
|
-
|
|
1019
813
|
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, subobj);
|
|
1020
814
|
}
|
|
1021
|
-
|
|
1022
815
|
function _getSubProperty2(key, subkey) {
|
|
1023
816
|
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1024
|
-
|
|
1025
817
|
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key, original);
|
|
1026
|
-
|
|
1027
818
|
if (subobj == null || _typeof(subobj) !== "object") return undefined;
|
|
1028
819
|
return subobj[subkey];
|
|
1029
820
|
}
|
|
1030
|
-
|
|
1031
821
|
function _setProperty2(key, value) {
|
|
1032
822
|
if (this.__use_delta) this.__delta[key] = value;else this[key] = value;
|
|
1033
823
|
return true;
|
|
1034
824
|
}
|
|
1035
|
-
|
|
1036
825
|
function _setDefaultProperty2(key, value) {
|
|
1037
826
|
//@ts-ignore
|
|
1038
827
|
if (this[key] == undefined || this[key] === "" || this[key] === 0) {
|
|
1039
828
|
this[key] = value;
|
|
1040
829
|
return true;
|
|
1041
830
|
}
|
|
1042
|
-
|
|
1043
831
|
return false;
|
|
1044
832
|
}
|
|
1045
|
-
|
|
1046
833
|
function _getProperty2(key) {
|
|
1047
834
|
var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1048
|
-
|
|
1049
835
|
//check if we should use delta version or normal version for this property
|
|
1050
836
|
if (this.__use_delta && !original && key in this.__delta) {
|
|
1051
837
|
//@ts-ignore
|
|
1052
838
|
return this.__delta[key];
|
|
1053
839
|
}
|
|
1054
|
-
|
|
1055
840
|
return this[key];
|
|
1056
841
|
}
|
|
1057
|
-
|
|
1058
842
|
function _getTempProperty2(key) {
|
|
1059
843
|
if (!this.__temp) return undefined;
|
|
1060
844
|
return this.__temp[key];
|
|
1061
845
|
}
|
|
1062
|
-
|
|
1063
846
|
function _setTempProperty2(key, value) {
|
|
1064
847
|
if (!this.__temp) this.__temp = {};
|
|
1065
848
|
this.__temp[key] = value;
|
|
1066
849
|
}
|
|
1067
|
-
|
|
1068
850
|
function _setSaveResultObject2(toObj) {
|
|
1069
851
|
this.__saveResultObject = toObj;
|
|
1070
852
|
}
|
|
1071
|
-
|
|
1072
853
|
_defineProperty(SimpleObject, "__cache_name", void 0);
|
|
1073
|
-
|
|
1074
854
|
_defineProperty(SimpleObject, "__unchangeables", void 0);
|
|
1075
|
-
|
|
1076
855
|
_defineProperty(SimpleObject, "__changeables", void 0);
|
|
1077
|
-
|
|
1078
856
|
_defineProperty(SimpleObject, "__extraProperties", void 0);
|
|
1079
|
-
|
|
1080
857
|
_defineProperty(SimpleObject, "__use_delta", true);
|
|
1081
|
-
|
|
1082
858
|
var _default = SimpleObject;
|
|
1083
859
|
exports["default"] = _default;
|