@azrico/webobject 1.2.10 → 1.2.12
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/dist/index.js +18 -1
- package/dist/src/WebObjects/ParentWebObject.js +96 -1
- package/dist/src/WebObjects/WebObject.js +742 -15
- package/dist/src/WebObjects/WebObjectManager.js +356 -6
- package/dist/src/index.js +109 -1
- package/dist/src/structs/DummyObject.js +54 -1
- package/dist/src/structs/MapableObject.d.ts +2 -0
- package/dist/src/structs/MapableObject.js +142 -2
- package/dist/src/structs/MetaObject.js +171 -1
- package/dist/src/structs/ObjectArray.js +84 -1
- package/dist/src/structs/ObjectManager.js +659 -9
- package/dist/src/structs/SimpleObject.js +970 -8
- package/package.json +2 -2
- package/dist/index.js.map +0 -1
- package/dist/src/WebObjects/ParentWebObject.js.map +0 -1
- package/dist/src/WebObjects/WebObject.js.map +0 -1
- package/dist/src/WebObjects/WebObjectManager.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/structs/DummyObject.js.map +0 -1
- package/dist/src/structs/MapableObject.js.map +0 -1
- package/dist/src/structs/MetaObject.js.map +0 -1
- package/dist/src/structs/ObjectArray.js.map +0 -1
- package/dist/src/structs/ObjectManager.js.map +0 -1
- package/dist/src/structs/SimpleObject.js.map +0 -1
|
@@ -1,22 +1,984 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.SimpleObject=void 0;var _global=require("@azrico/global"),_object=require("@azrico/object"),_MapableObject2=require("./MapableObject"),_ObjectManager=_interopRequireDefault(require("./ObjectManager")),_string=require("@azrico/string");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,e,f){var g=b&&b.prototype instanceof d?b:d,h=Object.create(g.prototype),j=new l(f||[]);return h._invoke=function(a,b,d){var e="suspendedStart";return function(f,g){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return n()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var j=i(h,d);if(j){if(j===v)continue;return j}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===v)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}(a,e,j),h}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&q.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;this._invoke=function(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}}function i(a,b){var d=a.iterator[b.method];if(void 0===d){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,i(a,b),"throw"===b.method))return v;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,v;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,v):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,v)}function j(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function k(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function l(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(j,this),this.reset(!0)}function m(a){if(a){var b=a[s];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(q.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:n}}function n(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return o};var o={},p=Object.prototype,q=p.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",t=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}o.wrap=b;var v={},w={};a(w,s,function(){return this});var x=Object.getPrototypeOf,y=x&&x(x(m([])));y&&y!==p&&q.call(y,s)&&(w=y);var z=f.prototype=d.prototype=Object.create(w);return e.prototype=f,a(z,"constructor",f),a(f,"constructor",e),e.displayName=a(f,u,"GeneratorFunction"),o.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},o.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,u,"GeneratorFunction")),b.prototype=Object.create(z),b},o.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,t,function(){return this}),o.AsyncIterator=h,o.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return o.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(z),a(z,u,"Generator"),a(z,s,function(){return this}),a(z,"toString",function(){return"[object Generator]"}),o.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},o.values=m,l.prototype={constructor:l,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!a)for(var b in this)"t"===b.charAt(0)&&q.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=q.call(e,"catchLoc"),h=q.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&q.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,v):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),v},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),k(b),v},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;k(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:m(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),v}},o}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}var _setSubProperty=/*#__PURE__*/new WeakSet,_getSubProperty=/*#__PURE__*/new WeakSet,_setProperty=/*#__PURE__*/new WeakSet,_getProperty=/*#__PURE__*/new WeakSet,_setSaveResultObject=/*#__PURE__*/new WeakSet,SimpleObject=/*#__PURE__*/function(a){function b(){var a,d=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0];return _classCallCheck(this,b),a=c.call(this),_classPrivateMethodInitSpec(_assertThisInitialized(a),_setSaveResultObject),_classPrivateMethodInitSpec(_assertThisInitialized(a),_getProperty),_classPrivateMethodInitSpec(_assertThisInitialized(a),_setProperty),_classPrivateMethodInitSpec(_assertThisInitialized(a),_getSubProperty),_classPrivateMethodInitSpec(_assertThisInitialized(a),_setSubProperty),_defineProperty(_assertThisInitialized(a),"__originalobject",void 0),_defineProperty(_assertThisInitialized(a),"__delta",void 0),_defineProperty(_assertThisInitialized(a),"__changed",!1),_defineProperty(_assertThisInitialized(a),"__lastChanged",""),_defineProperty(_assertThisInitialized(a),"__is_readonly",void 0),_defineProperty(_assertThisInitialized(a),"__throw_errors",void 0),_defineProperty(_assertThisInitialized(a),"__errors",void 0),_defineProperty(_assertThisInitialized(a),"__showErrors",void 0),_defineProperty(_assertThisInitialized(a),"__saveResultObject",void 0),_defineProperty(_assertThisInitialized(a),"__saveResultIsSuccess",void 0),_defineProperty(_assertThisInitialized(a),"__saveResultType",null),_defineProperty(_assertThisInitialized(a),"_index_key",""),_defineProperty(_assertThisInitialized(a),"_index_value",-1),_defineProperty(_assertThisInitialized(a),"getValue",_classPrivateMethodGet(_assertThisInitialized(a),_getProperty,_getProperty2)),_defineProperty(_assertThisInitialized(a),"get",_classPrivateMethodGet(_assertThisInitialized(a),_getProperty,_getProperty2)),_defineProperty(_assertThisInitialized(a),"set",a.setValue),_defineProperty(_assertThisInitialized(a),"get_managerClass",function(){return null}),a.__delta={},a.__is_readonly=d,a.__throw_errors=!0,a.clear_changes(),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"_static",value:function _static(){return this.constructor}},{key:"loadValues",value:/* -------------------------------------------------------------------------- */ /* Load */ /* -------------------------------------------------------------------------- */function loadValues(a){var c=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];return b.loadValues(this,a,c)}},{key:"setValue",value:/**
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.SimpleObject = void 0;
|
|
7
|
+
|
|
8
|
+
var _global = require("@azrico/global");
|
|
9
|
+
|
|
10
|
+
var _object = require("@azrico/object");
|
|
11
|
+
|
|
12
|
+
var _MapableObject2 = require("./MapableObject");
|
|
13
|
+
|
|
14
|
+
var _ObjectManager = _interopRequireDefault(require("./ObjectManager"));
|
|
15
|
+
|
|
16
|
+
var _string = require("@azrico/string");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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
|
+
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
|
+
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
|
+
|
|
28
|
+
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
|
+
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
|
+
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
|
+
|
|
36
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
+
|
|
48
|
+
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
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
+
|
|
52
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
53
|
+
|
|
54
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
55
|
+
|
|
56
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
+
|
|
58
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
59
|
+
|
|
60
|
+
var _setSubProperty = /*#__PURE__*/new WeakSet();
|
|
61
|
+
|
|
62
|
+
var _getSubProperty = /*#__PURE__*/new WeakSet();
|
|
63
|
+
|
|
64
|
+
var _setProperty = /*#__PURE__*/new WeakSet();
|
|
65
|
+
|
|
66
|
+
var _getProperty = /*#__PURE__*/new WeakSet();
|
|
67
|
+
|
|
68
|
+
var _setSaveResultObject = /*#__PURE__*/new WeakSet();
|
|
69
|
+
|
|
70
|
+
var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
71
|
+
_inherits(SimpleObject, _MapableObject);
|
|
72
|
+
|
|
73
|
+
var _super = _createSuper(SimpleObject);
|
|
74
|
+
|
|
75
|
+
function SimpleObject() {
|
|
76
|
+
var _this;
|
|
77
|
+
|
|
78
|
+
var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
79
|
+
|
|
80
|
+
_classCallCheck(this, SimpleObject);
|
|
81
|
+
|
|
82
|
+
_this = _super.call(this);
|
|
83
|
+
|
|
84
|
+
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSaveResultObject);
|
|
85
|
+
|
|
86
|
+
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
|
|
87
|
+
|
|
88
|
+
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
|
|
89
|
+
|
|
90
|
+
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
|
|
91
|
+
|
|
92
|
+
_classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSubProperty);
|
|
93
|
+
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "__originalobject", void 0);
|
|
95
|
+
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "__delta", void 0);
|
|
97
|
+
|
|
98
|
+
_defineProperty(_assertThisInitialized(_this), "__changed", false);
|
|
99
|
+
|
|
100
|
+
_defineProperty(_assertThisInitialized(_this), "__lastChanged", "");
|
|
101
|
+
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "__is_readonly", void 0);
|
|
103
|
+
|
|
104
|
+
_defineProperty(_assertThisInitialized(_this), "__throw_errors", void 0);
|
|
105
|
+
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "__errors", void 0);
|
|
107
|
+
|
|
108
|
+
_defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
|
|
109
|
+
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "__saveResultObject", void 0);
|
|
111
|
+
|
|
112
|
+
_defineProperty(_assertThisInitialized(_this), "__saveResultIsSuccess", void 0);
|
|
113
|
+
|
|
114
|
+
_defineProperty(_assertThisInitialized(_this), "__saveResultType", null);
|
|
115
|
+
|
|
116
|
+
_defineProperty(_assertThisInitialized(_this), "_index_key", "");
|
|
117
|
+
|
|
118
|
+
_defineProperty(_assertThisInitialized(_this), "_index_value", -1);
|
|
119
|
+
|
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "getValue", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
|
|
121
|
+
|
|
122
|
+
_defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
|
|
123
|
+
|
|
124
|
+
_defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
|
|
125
|
+
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
|
|
127
|
+
return null;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
_this.__delta = {};
|
|
131
|
+
_this.__is_readonly = is_readonly;
|
|
132
|
+
_this.__throw_errors = true;
|
|
133
|
+
|
|
134
|
+
_this.clear_changes();
|
|
135
|
+
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
_createClass(SimpleObject, [{
|
|
140
|
+
key: "_static",
|
|
141
|
+
value: function _static() {
|
|
142
|
+
return this.constructor;
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "loadValues",
|
|
146
|
+
value:
|
|
147
|
+
/* -------------------------------------------------------------------------- */
|
|
148
|
+
|
|
149
|
+
/* Load */
|
|
150
|
+
|
|
151
|
+
/* -------------------------------------------------------------------------- */
|
|
152
|
+
function loadValues(initObject) {
|
|
153
|
+
var fullUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
154
|
+
return SimpleObject.loadValues(this, initObject, fullUpdate);
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "setValue",
|
|
158
|
+
value:
|
|
159
|
+
/**
|
|
2
160
|
* set value
|
|
3
161
|
* @param key
|
|
4
162
|
* @param value
|
|
5
163
|
* @return true if changed , false otherwise
|
|
6
|
-
*/
|
|
164
|
+
*/
|
|
165
|
+
function () {
|
|
166
|
+
var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
|
|
167
|
+
var sendChanges,
|
|
168
|
+
isValueChanged,
|
|
169
|
+
oldval,
|
|
170
|
+
_args = arguments;
|
|
171
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
172
|
+
while (1) {
|
|
173
|
+
switch (_context.prev = _context.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
sendChanges = _args.length > 2 && _args[2] !== undefined ? _args[2] : "auto";
|
|
176
|
+
|
|
177
|
+
if (this.canModify) {
|
|
178
|
+
_context.next = 7;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!this.__throw_errors) {
|
|
183
|
+
_context.next = 6;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
throw Error("Cant use setValue when on readonly mode");
|
|
188
|
+
|
|
189
|
+
case 6:
|
|
190
|
+
return _context.abrupt("return", false);
|
|
191
|
+
|
|
192
|
+
case 7:
|
|
193
|
+
isValueChanged = false;
|
|
194
|
+
_context.prev = 8;
|
|
195
|
+
oldval = this.getValue(key);
|
|
196
|
+
|
|
197
|
+
if (!(0, _object.object_equals)(oldval, value, {
|
|
198
|
+
ignoredStartingWords: "_"
|
|
199
|
+
})) {
|
|
200
|
+
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, value);
|
|
201
|
+
|
|
202
|
+
isValueChanged = true;
|
|
203
|
+
} else isValueChanged = false; //console.log("SV:", isValueChanged, oldval, key, value);
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
case 11:
|
|
207
|
+
_context.prev = 11;
|
|
208
|
+
|
|
209
|
+
if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
|
|
210
|
+
_context.next = 15;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_context.next = 15;
|
|
215
|
+
return this.notifyChanged("", String(key), value);
|
|
216
|
+
|
|
217
|
+
case 15:
|
|
218
|
+
return _context.finish(11);
|
|
219
|
+
|
|
220
|
+
case 16:
|
|
221
|
+
return _context.abrupt("return", isValueChanged);
|
|
222
|
+
|
|
223
|
+
case 17:
|
|
224
|
+
case "end":
|
|
225
|
+
return _context.stop();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}, _callee, this, [[8,, 11, 16]]);
|
|
229
|
+
}));
|
|
230
|
+
|
|
231
|
+
function setValue(_x, _x2) {
|
|
232
|
+
return _setValue.apply(this, arguments);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return setValue;
|
|
236
|
+
}()
|
|
237
|
+
}, {
|
|
238
|
+
key: "setSubValue",
|
|
239
|
+
value:
|
|
240
|
+
/**
|
|
7
241
|
* set key of subObject
|
|
8
242
|
* @param key
|
|
9
243
|
* @param value
|
|
10
244
|
* @param subvalue
|
|
11
245
|
* @return true if changed , false otherwise
|
|
12
|
-
*/
|
|
13
|
-
|
|
246
|
+
*/
|
|
247
|
+
function () {
|
|
248
|
+
var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, objKey, subvalue) {
|
|
249
|
+
var sendChanges,
|
|
250
|
+
isValueChanged,
|
|
251
|
+
subval,
|
|
252
|
+
_args2 = arguments;
|
|
253
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
254
|
+
while (1) {
|
|
255
|
+
switch (_context2.prev = _context2.next) {
|
|
256
|
+
case 0:
|
|
257
|
+
sendChanges = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : "auto";
|
|
258
|
+
|
|
259
|
+
if (this.canModify) {
|
|
260
|
+
_context2.next = 7;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (!this.__throw_errors) {
|
|
265
|
+
_context2.next = 6;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
throw Error("Cant use setValue when on readonly mode");
|
|
270
|
+
|
|
271
|
+
case 6:
|
|
272
|
+
return _context2.abrupt("return", false);
|
|
273
|
+
|
|
274
|
+
case 7:
|
|
275
|
+
isValueChanged = false;
|
|
276
|
+
_context2.prev = 8;
|
|
277
|
+
//if accessing subval of an object, make sure the object is not null
|
|
278
|
+
subval = _classPrivateMethodGet(this, _getSubProperty, _getSubProperty2).call(this, key, objKey);
|
|
279
|
+
|
|
280
|
+
if (!(0, _object.object_equals)(subval, subvalue, {
|
|
281
|
+
ignoredStartingWords: "_"
|
|
282
|
+
})) {
|
|
283
|
+
_classPrivateMethodGet(this, _setSubProperty, _setSubProperty2).call(this, key, objKey, subvalue);
|
|
284
|
+
|
|
285
|
+
isValueChanged = true;
|
|
286
|
+
} else isValueChanged = false;
|
|
287
|
+
|
|
288
|
+
case 11:
|
|
289
|
+
_context2.prev = 11;
|
|
290
|
+
|
|
291
|
+
if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
|
|
292
|
+
_context2.next = 15;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
_context2.next = 15;
|
|
297
|
+
return this.notifyChanged("", String(key), objKey, subvalue);
|
|
298
|
+
|
|
299
|
+
case 15:
|
|
300
|
+
return _context2.finish(11);
|
|
301
|
+
|
|
302
|
+
case 16:
|
|
303
|
+
return _context2.abrupt("return", isValueChanged);
|
|
304
|
+
|
|
305
|
+
case 17:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context2.stop();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}, _callee2, this, [[8,, 11, 16]]);
|
|
311
|
+
}));
|
|
312
|
+
|
|
313
|
+
function setSubValue(_x3, _x4, _x5) {
|
|
314
|
+
return _setSubValue.apply(this, arguments);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return setSubValue;
|
|
318
|
+
}() //Push value on array
|
|
319
|
+
|
|
320
|
+
}, {
|
|
321
|
+
key: "pushValue",
|
|
322
|
+
value: function () {
|
|
323
|
+
var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
324
|
+
var sendChanges,
|
|
325
|
+
tempArray,
|
|
326
|
+
_args3 = arguments;
|
|
327
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
328
|
+
while (1) {
|
|
329
|
+
switch (_context3.prev = _context3.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
sendChanges = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : "auto";
|
|
332
|
+
|
|
333
|
+
if (!(value == null)) {
|
|
334
|
+
_context3.next = 3;
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return _context3.abrupt("return", false);
|
|
339
|
+
|
|
340
|
+
case 3:
|
|
341
|
+
if (this.canModify) {
|
|
342
|
+
_context3.next = 9;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (!this.__throw_errors) {
|
|
347
|
+
_context3.next = 8;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
throw Error("Cant use pushValue when on readonly mode");
|
|
352
|
+
|
|
353
|
+
case 8:
|
|
354
|
+
return _context3.abrupt("return", false);
|
|
355
|
+
|
|
356
|
+
case 9:
|
|
357
|
+
if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
|
|
358
|
+
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, this.getValue(key));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
362
|
+
|
|
363
|
+
if (Array.isArray(tempArray)) {
|
|
364
|
+
_context3.next = 17;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (!this.__throw_errors) {
|
|
369
|
+
_context3.next = 16;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
throw Error("Cant use pushValue on non Array keys");
|
|
374
|
+
|
|
375
|
+
case 16:
|
|
376
|
+
return _context3.abrupt("return", false);
|
|
377
|
+
|
|
378
|
+
case 17:
|
|
379
|
+
tempArray.push(value);
|
|
380
|
+
|
|
381
|
+
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, tempArray);
|
|
382
|
+
|
|
383
|
+
if (!(sendChanges === true || sendChanges === "auto")) {
|
|
384
|
+
_context3.next = 22;
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
_context3.next = 22;
|
|
389
|
+
return this.notifyChanged("", String(key), value);
|
|
390
|
+
|
|
391
|
+
case 22:
|
|
392
|
+
return _context3.abrupt("return", tempArray);
|
|
393
|
+
|
|
394
|
+
case 23:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context3.stop();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, _callee3, this);
|
|
400
|
+
}));
|
|
401
|
+
|
|
402
|
+
function pushValue(_x6, _x7) {
|
|
403
|
+
return _pushValue.apply(this, arguments);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return pushValue;
|
|
407
|
+
}()
|
|
408
|
+
}, {
|
|
409
|
+
key: "notifyChanged",
|
|
410
|
+
value: function () {
|
|
411
|
+
var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(type, key, value, subvalue) {
|
|
412
|
+
var lc, manager_class;
|
|
413
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
414
|
+
while (1) {
|
|
415
|
+
switch (_context4.prev = _context4.next) {
|
|
416
|
+
case 0:
|
|
417
|
+
if (value === undefined && type != "meta") value = this.getValue(key);
|
|
418
|
+
this.__changed = true;
|
|
419
|
+
lc = "";
|
|
420
|
+
if (type) lc += "[".concat(String(type), "] ");
|
|
421
|
+
|
|
422
|
+
if (subvalue) {
|
|
423
|
+
lc += "".concat(String(key), "->").concat(value, " = ").concat(subvalue);
|
|
424
|
+
} else {
|
|
425
|
+
lc += "".concat(String(key), " = ").concat(value);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
this.__lastChanged = lc;
|
|
429
|
+
/* --------------------------- notify the manager --------------------------- */
|
|
430
|
+
|
|
431
|
+
manager_class = this.get_managerClass();
|
|
432
|
+
|
|
433
|
+
if (!(manager_class instanceof _ObjectManager["default"])) {
|
|
434
|
+
_context4.next = 10;
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
_context4.next = 10;
|
|
439
|
+
return manager_class.notifyChanged(type, key, value, subvalue);
|
|
440
|
+
|
|
441
|
+
case 10:
|
|
442
|
+
case "end":
|
|
443
|
+
return _context4.stop();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}, _callee4, this);
|
|
447
|
+
}));
|
|
448
|
+
|
|
449
|
+
function notifyChanged(_x8, _x9, _x10, _x11) {
|
|
450
|
+
return _notifyChanged.apply(this, arguments);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return notifyChanged;
|
|
454
|
+
}()
|
|
455
|
+
}, {
|
|
456
|
+
key: "apply_changes",
|
|
457
|
+
value:
|
|
458
|
+
/* -------------------------------------------------------------------------- */
|
|
459
|
+
|
|
460
|
+
/* Changes */
|
|
461
|
+
|
|
462
|
+
/* -------------------------------------------------------------------------- */
|
|
463
|
+
|
|
464
|
+
/**
|
|
14
465
|
* Apply the changes and empty the delta object
|
|
15
|
-
*/
|
|
466
|
+
*/
|
|
467
|
+
function apply_changes() {
|
|
468
|
+
if (!this.__use_delta) {
|
|
469
|
+
console.warn("you cant use apply_changes if you are not using Delta mode");
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (!this.isChanged) {
|
|
474
|
+
console.warn("No changes to apply");
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
for (var key in this.__delta) {
|
|
478
|
+
var nv = this.__delta[key];
|
|
479
|
+
this[key] = nv;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
this.clear_changes();
|
|
483
|
+
}
|
|
484
|
+
}, {
|
|
485
|
+
key: "clear_changes",
|
|
486
|
+
value: function clear_changes() {
|
|
487
|
+
this.__delta = {};
|
|
488
|
+
this.__changed = false;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
16
491
|
* Sets readonly property on given objects
|
|
17
492
|
* @param objs array of given objects or a single object
|
|
18
493
|
* @param readonlyval readonly
|
|
19
494
|
* @param clearChanges should we clean the changes after setting readonly
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
|
|
495
|
+
*/
|
|
496
|
+
|
|
497
|
+
}, {
|
|
498
|
+
key: "isChanged",
|
|
499
|
+
get:
|
|
500
|
+
/* -------------------------------------------------------------------------- */
|
|
501
|
+
|
|
502
|
+
/* Get/Check */
|
|
503
|
+
|
|
504
|
+
/* -------------------------------------------------------------------------- */
|
|
505
|
+
function get() {
|
|
506
|
+
return this.__use_delta ? !(0, _object.object_isEmpty)(this.__delta) : false;
|
|
507
|
+
}
|
|
508
|
+
}, {
|
|
509
|
+
key: "isDeleted",
|
|
510
|
+
get: function get() {
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
}, {
|
|
514
|
+
key: "d",
|
|
515
|
+
get: function get() {
|
|
516
|
+
return this.__use_delta ? this.__delta : this;
|
|
517
|
+
}
|
|
518
|
+
/* all updated properties */
|
|
519
|
+
|
|
520
|
+
}, {
|
|
521
|
+
key: "allproperties",
|
|
522
|
+
get: function get() {
|
|
523
|
+
var result = _objectSpread(_objectSpread({}, this), this.__delta);
|
|
524
|
+
|
|
525
|
+
result.__delta = {};
|
|
526
|
+
return result;
|
|
527
|
+
}
|
|
528
|
+
}, {
|
|
529
|
+
key: "canModify",
|
|
530
|
+
get: function get() {
|
|
531
|
+
return !Boolean(this.__is_readonly);
|
|
532
|
+
}
|
|
533
|
+
}, {
|
|
534
|
+
key: "__cache_name",
|
|
535
|
+
get: function get() {
|
|
536
|
+
return this.constructor["__cache_name"];
|
|
537
|
+
}
|
|
538
|
+
}, {
|
|
539
|
+
key: "__changeables",
|
|
540
|
+
get: function get() {
|
|
541
|
+
return this.constructor["__changeables"];
|
|
542
|
+
}
|
|
543
|
+
}, {
|
|
544
|
+
key: "__unchangeables",
|
|
545
|
+
get: function get() {
|
|
546
|
+
return this.constructor["__unchangeables"];
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "__use_delta",
|
|
550
|
+
get: function get() {
|
|
551
|
+
return this.constructor["__use_delta"];
|
|
552
|
+
}
|
|
553
|
+
}, {
|
|
554
|
+
key: "isSaved",
|
|
555
|
+
get: function get() {
|
|
556
|
+
var _this$__saveResultIsS;
|
|
557
|
+
|
|
558
|
+
return Boolean((_this$__saveResultIsS = this.__saveResultIsSuccess) !== null && _this$__saveResultIsS !== void 0 ? _this$__saveResultIsS : false);
|
|
559
|
+
}
|
|
560
|
+
}, {
|
|
561
|
+
key: "isNew",
|
|
562
|
+
get: function get() {
|
|
563
|
+
var mid = this.getID();
|
|
564
|
+
if (!mid) return true;
|
|
565
|
+
if (typeof mid === "string") return mid === "" || mid === "-1";
|
|
566
|
+
if (typeof mid === "number") return mid === -1;
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
}, {
|
|
570
|
+
key: "get_lastChanged",
|
|
571
|
+
value: function get_lastChanged() {
|
|
572
|
+
return !this.__lastChanged;
|
|
573
|
+
}
|
|
574
|
+
}, {
|
|
575
|
+
key: "manager",
|
|
576
|
+
get: function get() {
|
|
577
|
+
return this.get_managerClass();
|
|
578
|
+
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "getIndexOrID",
|
|
581
|
+
value: function getIndexOrID() {
|
|
582
|
+
return SimpleObject.getIndexOrID(this);
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "getIndex",
|
|
586
|
+
value: function getIndex() {
|
|
587
|
+
return SimpleObject.getIndex(this);
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
key: "getID",
|
|
591
|
+
value: function getID() {
|
|
592
|
+
return SimpleObject.getID(this);
|
|
593
|
+
}
|
|
594
|
+
}, {
|
|
595
|
+
key: "getOriginal",
|
|
596
|
+
value:
|
|
597
|
+
/* -------------------------------------------------------------------------- */
|
|
598
|
+
|
|
599
|
+
/* Original */
|
|
600
|
+
|
|
601
|
+
/* -------------------------------------------------------------------------- */
|
|
602
|
+
function getOriginal() {
|
|
603
|
+
return this.__originalobject || undefined;
|
|
604
|
+
}
|
|
605
|
+
}, {
|
|
606
|
+
key: "setOriginal",
|
|
607
|
+
value: function setOriginal() {
|
|
608
|
+
var toObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
609
|
+
|
|
610
|
+
if (toObj === null) {
|
|
611
|
+
delete this.__originalobject;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (!this.canModify) {
|
|
616
|
+
console.warn("Cant use setOriginal on non original OR readonly objects ! this will create an infinite loop");
|
|
617
|
+
delete this.__originalobject;
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (toObj === 0) {
|
|
622
|
+
toObj = this;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
var cloneObject = (0, _object.object_clone)(toObj);
|
|
626
|
+
SimpleObject.setReadonly(cloneObject, true);
|
|
627
|
+
this.__originalobject = (0, _object.object_removeKeys)(cloneObject, ["__"]);
|
|
628
|
+
return this;
|
|
629
|
+
}
|
|
630
|
+
}, {
|
|
631
|
+
key: "setSaveResult",
|
|
632
|
+
value: function setSaveResult(toObj, type) {
|
|
633
|
+
this.__saveResultType = type;
|
|
634
|
+
|
|
635
|
+
if (toObj === true) {} else if (toObj === false) {} else {
|
|
636
|
+
if (toObj) {
|
|
637
|
+
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
|
|
638
|
+
} else {
|
|
639
|
+
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, null);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
this.__saveResultIsSuccess = (type === "normal" || type === "nothing") && toObj != null;
|
|
644
|
+
}
|
|
645
|
+
}, {
|
|
646
|
+
key: "getSaveResult",
|
|
647
|
+
value: function getSaveResult() {
|
|
648
|
+
if (this.isSaved) return this.__saveResultObject;
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
}, {
|
|
652
|
+
key: "getSaveResultType",
|
|
653
|
+
value: function getSaveResultType() {
|
|
654
|
+
return this.__saveResultType || null;
|
|
655
|
+
}
|
|
656
|
+
/* -------------------------------------------------------------------------- */
|
|
657
|
+
|
|
658
|
+
/* statics */
|
|
659
|
+
|
|
660
|
+
/* -------------------------------------------------------------------------- */
|
|
661
|
+
|
|
662
|
+
}], [{
|
|
663
|
+
key: "loadValues",
|
|
664
|
+
value: function loadValues(obj, initObject) {
|
|
665
|
+
var fullUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
666
|
+
SimpleObject.factoryClear(obj);
|
|
667
|
+
|
|
668
|
+
if (initObject == null) {
|
|
669
|
+
for (var key in obj) {
|
|
670
|
+
if (typeof obj[key] === "function") continue;
|
|
671
|
+
if (key.startsWith("__")) continue;
|
|
672
|
+
delete obj[key];
|
|
673
|
+
}
|
|
674
|
+
} else if (_typeof(initObject) == "object") {
|
|
675
|
+
for (var _key in initObject) {
|
|
676
|
+
if (_key.startsWith("__")) continue;
|
|
677
|
+
|
|
678
|
+
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key)) {
|
|
679
|
+
obj[_key] = initObject[_key];
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return true;
|
|
685
|
+
}
|
|
686
|
+
/* -------------------------------------------------------------------------- */
|
|
687
|
+
|
|
688
|
+
}, {
|
|
689
|
+
key: "getValue",
|
|
690
|
+
value: function getValue(o, key) {
|
|
691
|
+
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
692
|
+
if (o == null) return undefined;
|
|
693
|
+
if (o instanceof SimpleObject && typeof o.getValue === "function") return o.getValue(key, original);
|
|
694
|
+
|
|
695
|
+
if (!original && o.__use_delta != false && _typeof(o.__delta) === "object" && key in o.__delta) {
|
|
696
|
+
//@ts-ignore
|
|
697
|
+
return o.__delta[key];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
return o[key];
|
|
701
|
+
}
|
|
702
|
+
}, {
|
|
703
|
+
key: "canChangeKey",
|
|
704
|
+
value: function canChangeKey(object, key, useExtraProps) {
|
|
705
|
+
if (!object || !key) return false;
|
|
706
|
+
|
|
707
|
+
if (useExtraProps) {
|
|
708
|
+
var __extraProperties = object.constructor["__extraProperties"];
|
|
709
|
+
if (__extraProperties != null && __extraProperties.includes(key)) return true;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
var __changeables = object.constructor["__changeables"];
|
|
713
|
+
var __unchangeables = object.constructor["__unchangeables"];
|
|
714
|
+
if (__changeables != null && !__changeables.includes(key)) return false;
|
|
715
|
+
if (__unchangeables != null && __unchangeables.includes(key)) return false;
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
}, {
|
|
719
|
+
key: "setReadonly",
|
|
720
|
+
value: function setReadonly(objs) {
|
|
721
|
+
var readonlyval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
722
|
+
var clearChanges = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
723
|
+
var checkObjs = [];
|
|
724
|
+
if (!objs) objs = [];
|
|
725
|
+
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
726
|
+
|
|
727
|
+
for (var index = 0; index < checkObjs.length; index++) {
|
|
728
|
+
var obj = checkObjs[index];
|
|
729
|
+
obj.__is_readonly = readonlyval;
|
|
730
|
+
|
|
731
|
+
if (obj instanceof SimpleObject) {
|
|
732
|
+
if (obj.canModify) {
|
|
733
|
+
if (!obj.getOriginal()) obj.setOriginal();
|
|
734
|
+
} else {
|
|
735
|
+
if (clearChanges) obj.clear_changes(); //we dont need the original object in readonly mode
|
|
736
|
+
|
|
737
|
+
obj.setOriginal(null);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}, {
|
|
743
|
+
key: "setThrowErrors",
|
|
744
|
+
value: function setThrowErrors(objs) {
|
|
745
|
+
var throwErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
746
|
+
var checkObjs = [];
|
|
747
|
+
if (!objs) objs = [];
|
|
748
|
+
if (!Array.isArray(objs)) checkObjs = [objs];else checkObjs = objs;
|
|
749
|
+
|
|
750
|
+
for (var index = 0; index < checkObjs.length; index++) {
|
|
751
|
+
var element = checkObjs[index];
|
|
752
|
+
element.__throw_errors = throwErr;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}, {
|
|
756
|
+
key: "isDeleted",
|
|
757
|
+
value: function isDeleted(obj) {
|
|
758
|
+
if (obj instanceof SimpleObject) return obj.isDeleted === true;
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
}, {
|
|
762
|
+
key: "getIndexOrID",
|
|
763
|
+
value: function getIndexOrID(o) {
|
|
764
|
+
var res = SimpleObject.getIndex(o);
|
|
765
|
+
if (!res || res == -1) res = SimpleObject.getID(o);
|
|
766
|
+
return res || -1;
|
|
767
|
+
}
|
|
768
|
+
}, {
|
|
769
|
+
key: "getIndex",
|
|
770
|
+
value: function getIndex(o) {
|
|
771
|
+
if (o == null || o == undefined) return -1;
|
|
772
|
+
|
|
773
|
+
switch (_typeof(o)) {
|
|
774
|
+
case "object":
|
|
775
|
+
return o._index_value || -1;
|
|
776
|
+
|
|
777
|
+
case "number":
|
|
778
|
+
case "string":
|
|
779
|
+
return Number(o);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return -1;
|
|
783
|
+
}
|
|
784
|
+
}, {
|
|
785
|
+
key: "getID",
|
|
786
|
+
value: function getID(o) {
|
|
787
|
+
if (o == null || o == undefined) return "";
|
|
788
|
+
|
|
789
|
+
switch (_typeof(o)) {
|
|
790
|
+
case "object":
|
|
791
|
+
return o.__data_id || o._id || o.id || o.ID || "";
|
|
792
|
+
|
|
793
|
+
case "string":
|
|
794
|
+
case "number":
|
|
795
|
+
return String(o);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
return "";
|
|
799
|
+
}
|
|
800
|
+
}, {
|
|
801
|
+
key: "setOriginal",
|
|
802
|
+
value: function setOriginal(obj) {
|
|
803
|
+
var toObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
804
|
+
if (!(obj instanceof SimpleObject)) return undefined;
|
|
805
|
+
return obj.setOriginal(toObj);
|
|
806
|
+
}
|
|
807
|
+
}, {
|
|
808
|
+
key: "getOriginal",
|
|
809
|
+
value: function getOriginal(obj) {
|
|
810
|
+
if (obj instanceof SimpleObject) return obj.getOriginal();
|
|
811
|
+
return obj === null || obj === void 0 ? void 0 : obj.__originalobject;
|
|
812
|
+
}
|
|
813
|
+
/* -------------------------------------------------------------------------- */
|
|
814
|
+
|
|
815
|
+
/* Errors */
|
|
816
|
+
|
|
817
|
+
/* -------------------------------------------------------------------------- */
|
|
818
|
+
|
|
819
|
+
}, {
|
|
820
|
+
key: "addError",
|
|
821
|
+
value: function addError(o, title, message) {
|
|
822
|
+
var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
823
|
+
var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
|
|
824
|
+
|
|
825
|
+
if (o) {
|
|
826
|
+
if (!Array.isArray(o.__errors)) o.__errors = [];
|
|
827
|
+
|
|
828
|
+
o.__errors.push(errStr);
|
|
829
|
+
|
|
830
|
+
if (o.__showErrors === false) return;
|
|
831
|
+
} else if (sendToRegister === "auto") sendToRegister = true;
|
|
832
|
+
|
|
833
|
+
if (sendToRegister === true) {
|
|
834
|
+
console.error("[REGISTER-ERROR]", errStr);
|
|
835
|
+
|
|
836
|
+
_global.gfunc.run_action("add_error", {
|
|
837
|
+
title: title,
|
|
838
|
+
message: message,
|
|
839
|
+
type: "error"
|
|
840
|
+
});
|
|
841
|
+
} else {
|
|
842
|
+
console.error("[ERROR]", errStr);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
846
|
+
}
|
|
847
|
+
}, {
|
|
848
|
+
key: "getErrors",
|
|
849
|
+
value: function getErrors(o) {
|
|
850
|
+
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
851
|
+
}
|
|
852
|
+
}, {
|
|
853
|
+
key: "clearErrors",
|
|
854
|
+
value: function clearErrors(o) {
|
|
855
|
+
if (o) o.__errors = [];
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
/* -------------------------------------------------------------------------- */
|
|
859
|
+
|
|
860
|
+
/* Save Results */
|
|
861
|
+
|
|
862
|
+
/* -------------------------------------------------------------------------- */
|
|
863
|
+
|
|
864
|
+
}, {
|
|
865
|
+
key: "isResultValid",
|
|
866
|
+
value: function isResultValid(result_object) {
|
|
867
|
+
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
868
|
+
|
|
869
|
+
switch (_typeof(result_object)) {
|
|
870
|
+
case "string":
|
|
871
|
+
try {
|
|
872
|
+
result_object = JSON.parse(result_object);
|
|
873
|
+
return this.isResultValid(result_object);
|
|
874
|
+
} catch (_unused) {
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
case "object":
|
|
879
|
+
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
if (result_object.expected && result_object.result) {
|
|
884
|
+
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
return Number(this.getID(result_object)) >= 0;
|
|
888
|
+
|
|
889
|
+
case "number":
|
|
890
|
+
return result_object > 0;
|
|
891
|
+
|
|
892
|
+
case "boolean":
|
|
893
|
+
return result_object === true;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
}, {
|
|
899
|
+
key: "factoryClear",
|
|
900
|
+
value: function factoryClear(obj) {
|
|
901
|
+
obj.clear_changes();
|
|
902
|
+
SimpleObject.clearErrors(obj);
|
|
903
|
+
}
|
|
904
|
+
}, {
|
|
905
|
+
key: "delete_cache",
|
|
906
|
+
value: function delete_cache() {
|
|
907
|
+
if (!this.__cache_name) return;
|
|
908
|
+
|
|
909
|
+
_global.gcache.delete_cache(this.__cache_name);
|
|
910
|
+
}
|
|
911
|
+
}, {
|
|
912
|
+
key: "get_canModify",
|
|
913
|
+
value: function get_canModify(o) {
|
|
914
|
+
if (o instanceof SimpleObject) return o.canModify;
|
|
915
|
+
return false;
|
|
916
|
+
}
|
|
917
|
+
/* -------------------------------------------------------------------------- */
|
|
918
|
+
|
|
919
|
+
}, {
|
|
920
|
+
key: "equals",
|
|
921
|
+
value: function equals(a, b) {
|
|
922
|
+
console.warn("Dont use the default equals method !");
|
|
923
|
+
if (a == undefined || b == undefined) return false;
|
|
924
|
+
return a === b;
|
|
925
|
+
}
|
|
926
|
+
}]);
|
|
927
|
+
|
|
928
|
+
return SimpleObject;
|
|
929
|
+
}(_MapableObject2.MapableObject);
|
|
930
|
+
|
|
931
|
+
exports.SimpleObject = SimpleObject;
|
|
932
|
+
|
|
933
|
+
function _setSubProperty2(key, subkey, value) {
|
|
934
|
+
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key); //@ts-ignore
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
if (subobj == null || _typeof(subobj) !== "object") subobj = {};
|
|
938
|
+
subobj[subkey] = value;
|
|
939
|
+
|
|
940
|
+
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, subobj);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
function _getSubProperty2(key, subkey) {
|
|
944
|
+
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
945
|
+
|
|
946
|
+
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key, original);
|
|
947
|
+
|
|
948
|
+
if (subobj == null || _typeof(subobj) !== "object") return undefined;
|
|
949
|
+
return subobj[subkey];
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function _setProperty2(key, value) {
|
|
953
|
+
if (this.__use_delta) this.__delta[key] = value;else this[key] = value;
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function _getProperty2(key) {
|
|
958
|
+
var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
959
|
+
|
|
960
|
+
//check if we should use delta version or normal version for this property
|
|
961
|
+
if (this.__use_delta && !original && key in this.__delta) {
|
|
962
|
+
//@ts-ignore
|
|
963
|
+
return this.__delta[key];
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
return this[key];
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function _setSaveResultObject2(toObj) {
|
|
970
|
+
this.__saveResultObject = toObj;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
_defineProperty(SimpleObject, "__cache_name", void 0);
|
|
974
|
+
|
|
975
|
+
_defineProperty(SimpleObject, "__unchangeables", void 0);
|
|
976
|
+
|
|
977
|
+
_defineProperty(SimpleObject, "__changeables", void 0);
|
|
978
|
+
|
|
979
|
+
_defineProperty(SimpleObject, "__extraProperties", void 0);
|
|
980
|
+
|
|
981
|
+
_defineProperty(SimpleObject, "__use_delta", true);
|
|
982
|
+
|
|
983
|
+
var _default = SimpleObject;
|
|
984
|
+
exports["default"] = _default;
|