@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,36 +1,763 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.WebObject=void 0;var _SimpleObject2=_interopRequireDefault(require("../structs/SimpleObject")),_object=require("@azrico/object"),_global=require("@azrico/global");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 _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}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 _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var WebObject=/*#__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,d),_defineProperty(_assertThisInitialized(a),"meta_data",void 0),_defineProperty(_assertThisInitialized(a),"_id",""),_defineProperty(_assertThisInitialized(a),"_created_date",""),_defineProperty(_assertThisInitialized(a),"get_type",function(){return a.__web_type||a.get_webpath()}),_defineProperty(_assertThisInitialized(a),"get_webpath",function(){return a.__web_path}),_defineProperty(_assertThisInitialized(a),"get_managerClass",function(){return null}),a.meta_data=[],a}/* -------------------------------------------------------------------------- */ /* Meta data */ /* -------------------------------------------------------------------------- */ /**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.WebObject = void 0;
|
|
7
|
+
|
|
8
|
+
var _SimpleObject2 = _interopRequireDefault(require("../structs/SimpleObject"));
|
|
9
|
+
|
|
10
|
+
var _object = require("@azrico/object");
|
|
11
|
+
|
|
12
|
+
var _global = require("@azrico/global");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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); } }
|
|
31
|
+
|
|
32
|
+
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); }); }; }
|
|
33
|
+
|
|
34
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
+
|
|
36
|
+
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); } }
|
|
37
|
+
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
+
|
|
44
|
+
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); }; }
|
|
45
|
+
|
|
46
|
+
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); }
|
|
47
|
+
|
|
48
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
+
|
|
50
|
+
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; } }
|
|
51
|
+
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
+
|
|
54
|
+
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; }
|
|
55
|
+
|
|
56
|
+
var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
57
|
+
_inherits(WebObject, _SimpleObject);
|
|
58
|
+
|
|
59
|
+
var _super = _createSuper(WebObject);
|
|
60
|
+
|
|
61
|
+
function WebObject() {
|
|
62
|
+
var _this;
|
|
63
|
+
|
|
64
|
+
var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
65
|
+
|
|
66
|
+
_classCallCheck(this, WebObject);
|
|
67
|
+
|
|
68
|
+
_this = _super.call(this, is_readonly);
|
|
69
|
+
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "meta_data", void 0);
|
|
71
|
+
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "_id", "");
|
|
73
|
+
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "_created_date", "");
|
|
75
|
+
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "get_type", function () {
|
|
77
|
+
return _this.__web_type || _this.get_webpath();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "get_webpath", function () {
|
|
81
|
+
return _this.__web_path;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
|
|
85
|
+
return null;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
_this.meta_data = [];
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
/* -------------------------------------------------------------------------- */
|
|
92
|
+
|
|
93
|
+
/* Meta data */
|
|
94
|
+
|
|
95
|
+
/* -------------------------------------------------------------------------- */
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Update meta value of this object , meta data is stored in meta_data variable
|
|
99
|
+
* @param key
|
|
100
|
+
* @param value
|
|
101
|
+
* @param createIfNotExists should we create a new meta if key does not exist
|
|
102
|
+
* @param sendChange
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
_createClass(WebObject, [{
|
|
108
|
+
key: "setMetaValue",
|
|
109
|
+
value: function setMetaValue(key, value) {
|
|
110
|
+
var createIfNotExists = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
111
|
+
var sendChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
112
|
+
|
|
113
|
+
if (!this.canModify) {
|
|
114
|
+
if (this.__throw_errors) throw Error("Cant use setMetaValue on ".concat(key, " when on readonly mode"));else return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var old_value = WebObject.getMetaValue(this, key);
|
|
118
|
+
if ((0, _object.object_equals)(old_value, value)) return false;
|
|
119
|
+
var old_metalist = (0, _object.to_array)(this.getValue("meta_data")).map(function (s) {
|
|
120
|
+
return (0, _object.object_shallow_clone)(s);
|
|
121
|
+
});
|
|
122
|
+
var new_metalist = (0, _object.setInArray)(old_metalist, "key", key, "value", value, createIfNotExists);
|
|
123
|
+
this.setValue("meta_data", new_metalist);
|
|
124
|
+
if (sendChange !== false) this.notifyChanged("meta", key, value);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
9
128
|
* Get meta object by key
|
|
10
129
|
* @param key
|
|
11
130
|
* @returns meta object
|
|
12
|
-
*/
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
}, {
|
|
134
|
+
key: "getMeta",
|
|
135
|
+
value: function getMeta(key) {
|
|
136
|
+
return WebObject.getMeta(this, key);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
13
139
|
* Get meta value by key
|
|
14
140
|
* @param key
|
|
15
141
|
* @returns value or undefined
|
|
16
|
-
*/
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
}, {
|
|
145
|
+
key: "getMetaValue",
|
|
146
|
+
value: function getMetaValue(key) {
|
|
147
|
+
return WebObject.getMetaValue(this, key);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
17
150
|
* Get meta object by key
|
|
18
151
|
* @param o
|
|
19
152
|
* @param key
|
|
20
153
|
* @returns meta object
|
|
21
|
-
*/
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
}, {
|
|
157
|
+
key: "Save",
|
|
158
|
+
value:
|
|
159
|
+
/* -------------------------------------------------------------------------- */
|
|
160
|
+
|
|
161
|
+
/* Save */
|
|
162
|
+
|
|
163
|
+
/* -------------------------------------------------------------------------- */
|
|
164
|
+
function () {
|
|
165
|
+
var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
166
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
167
|
+
while (1) {
|
|
168
|
+
switch (_context.prev = _context.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
if (!this.__throw_errors) {
|
|
171
|
+
_context.next = 2;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
throw new Error("Save not implented");
|
|
176
|
+
|
|
177
|
+
case 2:
|
|
178
|
+
WebObject.addError(this, "Save not implented", "NOSAVE", true);
|
|
179
|
+
this.setSaveResult(false, "canceled");
|
|
180
|
+
return _context.abrupt("return", false);
|
|
181
|
+
|
|
182
|
+
case 5:
|
|
183
|
+
case "end":
|
|
184
|
+
return _context.stop();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, _callee, this);
|
|
188
|
+
}));
|
|
189
|
+
|
|
190
|
+
function Save() {
|
|
191
|
+
return _Save.apply(this, arguments);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return Save;
|
|
195
|
+
}()
|
|
196
|
+
}, {
|
|
197
|
+
key: "Delete",
|
|
198
|
+
value: function () {
|
|
199
|
+
var _Delete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
200
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
201
|
+
while (1) {
|
|
202
|
+
switch (_context2.prev = _context2.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
if (!this.__throw_errors) {
|
|
205
|
+
_context2.next = 2;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
throw new Error("Delete not implented");
|
|
210
|
+
|
|
211
|
+
case 2:
|
|
212
|
+
WebObject.addError(this, "Delete not implented", "NOSAVE", true);
|
|
213
|
+
this.setSaveResult(false, "canceled");
|
|
214
|
+
return _context2.abrupt("return", false);
|
|
215
|
+
|
|
216
|
+
case 5:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context2.stop();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}, _callee2, this);
|
|
222
|
+
}));
|
|
223
|
+
|
|
224
|
+
function Delete() {
|
|
225
|
+
return _Delete.apply(this, arguments);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return Delete;
|
|
229
|
+
}()
|
|
230
|
+
/* -------------------------------------------------------------------------- */
|
|
231
|
+
|
|
232
|
+
}, {
|
|
233
|
+
key: "canSave",
|
|
234
|
+
value: function canSave(deltaObj) {
|
|
235
|
+
var deltaRes = this.deltaIsValid(deltaObj);
|
|
236
|
+
if (deltaRes !== true) return deltaRes;
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "deltaIsValid",
|
|
241
|
+
value: function deltaIsValid(d) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
key: "get_deltaObject",
|
|
246
|
+
value:
|
|
247
|
+
/**
|
|
22
248
|
* You will post this to the server for saving
|
|
23
249
|
* automatically removes unchangable fields
|
|
24
250
|
* @returns
|
|
25
|
-
*/
|
|
251
|
+
*/
|
|
252
|
+
function () {
|
|
253
|
+
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(p) {
|
|
254
|
+
var _this2 = this;
|
|
255
|
+
|
|
256
|
+
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, parseObj, _parseObj, _iterator, _step, key;
|
|
257
|
+
|
|
258
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
259
|
+
while (1) {
|
|
260
|
+
switch (_context5.prev = _context5.next) {
|
|
261
|
+
case 0:
|
|
262
|
+
_parseObj = function _parseObj3() {
|
|
263
|
+
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(obj) {
|
|
264
|
+
var newobj_dlt;
|
|
265
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
266
|
+
while (1) {
|
|
267
|
+
switch (_context4.prev = _context4.next) {
|
|
268
|
+
case 0:
|
|
269
|
+
if (!(obj == null)) {
|
|
270
|
+
_context4.next = 2;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return _context4.abrupt("return", undefined);
|
|
275
|
+
|
|
276
|
+
case 2:
|
|
277
|
+
if (!Array.isArray(obj)) {
|
|
278
|
+
_context4.next = 6;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
_context4.next = 5;
|
|
283
|
+
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
284
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(r) {
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
286
|
+
while (1) {
|
|
287
|
+
switch (_context3.prev = _context3.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
_context3.next = 2;
|
|
290
|
+
return parseObj(r);
|
|
291
|
+
|
|
292
|
+
case 2:
|
|
293
|
+
return _context3.abrupt("return", _context3.sent);
|
|
294
|
+
|
|
295
|
+
case 3:
|
|
296
|
+
case "end":
|
|
297
|
+
return _context3.stop();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}, _callee3);
|
|
301
|
+
}));
|
|
302
|
+
|
|
303
|
+
return function (_x3) {
|
|
304
|
+
return _ref.apply(this, arguments);
|
|
305
|
+
};
|
|
306
|
+
}()));
|
|
307
|
+
|
|
308
|
+
case 5:
|
|
309
|
+
return _context4.abrupt("return", _context4.sent);
|
|
310
|
+
|
|
311
|
+
case 6:
|
|
312
|
+
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
313
|
+
_context4.next = 15;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
_context4.next = 9;
|
|
318
|
+
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
319
|
+
isChild: true
|
|
320
|
+
}));
|
|
321
|
+
|
|
322
|
+
case 9:
|
|
323
|
+
newobj_dlt = _context4.sent;
|
|
324
|
+
|
|
325
|
+
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
326
|
+
_context4.next = 14;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return _context4.abrupt("return", newobj_dlt);
|
|
331
|
+
|
|
332
|
+
case 14:
|
|
333
|
+
return _context4.abrupt("return", obj);
|
|
334
|
+
|
|
335
|
+
case 15:
|
|
336
|
+
return _context4.abrupt("return", obj);
|
|
337
|
+
|
|
338
|
+
case 16:
|
|
339
|
+
case "end":
|
|
340
|
+
return _context4.stop();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}, _callee4);
|
|
344
|
+
}));
|
|
345
|
+
return _parseObj.apply(this, arguments);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
parseObj = function _parseObj2(_x2) {
|
|
349
|
+
return _parseObj.apply(this, arguments);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
if (!p) p = {};
|
|
353
|
+
final_object = {}; //@ts-ignore
|
|
354
|
+
|
|
355
|
+
isChild = Boolean(p.isChild || p.ischild); //@ts-ignore
|
|
356
|
+
|
|
357
|
+
useDelta = Boolean(p.useDelta || p.usedelta); //@ts-ignore
|
|
358
|
+
|
|
359
|
+
allProperties = Boolean(p.allProperties || p.allproperties);
|
|
360
|
+
chkChangables = this.__changeables != null || this.__unchangeables != null;
|
|
361
|
+
useExtraProps = Boolean(p.extraProperties); //child objects usually dont update their __delta, so we read info from all of its properties
|
|
362
|
+
|
|
363
|
+
dlt = allProperties || !useDelta && isChild && chkChangables ? _objectSpread({}, this.allproperties) : _objectSpread({}, this.__delta);
|
|
364
|
+
allkeys = Object.keys(dlt);
|
|
365
|
+
changableKeys = chkChangables ? allkeys.filter(function (s) {
|
|
366
|
+
return _SimpleObject2["default"].canChangeKey(_this2, s, useExtraProps);
|
|
367
|
+
}) : allkeys;
|
|
368
|
+
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
369
|
+
_context5.prev = 13;
|
|
370
|
+
|
|
371
|
+
_iterator.s();
|
|
372
|
+
|
|
373
|
+
case 15:
|
|
374
|
+
if ((_step = _iterator.n()).done) {
|
|
375
|
+
_context5.next = 22;
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
key = _step.value;
|
|
380
|
+
_context5.next = 19;
|
|
381
|
+
return parseObj(dlt[key]);
|
|
382
|
+
|
|
383
|
+
case 19:
|
|
384
|
+
final_object[key] = _context5.sent;
|
|
385
|
+
|
|
386
|
+
case 20:
|
|
387
|
+
_context5.next = 15;
|
|
388
|
+
break;
|
|
389
|
+
|
|
390
|
+
case 22:
|
|
391
|
+
_context5.next = 27;
|
|
392
|
+
break;
|
|
393
|
+
|
|
394
|
+
case 24:
|
|
395
|
+
_context5.prev = 24;
|
|
396
|
+
_context5.t0 = _context5["catch"](13);
|
|
397
|
+
|
|
398
|
+
_iterator.e(_context5.t0);
|
|
399
|
+
|
|
400
|
+
case 27:
|
|
401
|
+
_context5.prev = 27;
|
|
402
|
+
|
|
403
|
+
_iterator.f();
|
|
404
|
+
|
|
405
|
+
return _context5.finish(27);
|
|
406
|
+
|
|
407
|
+
case 30:
|
|
408
|
+
if (allProperties) {
|
|
409
|
+
final_object["_id"] = this.getID();
|
|
410
|
+
final_object["_index_value"] = this.getIndex();
|
|
411
|
+
final_object["_index_key"] = this["_index_key"];
|
|
412
|
+
final_object["_created_date"] = this["_created_date"];
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return _context5.abrupt("return", final_object);
|
|
416
|
+
|
|
417
|
+
case 32:
|
|
418
|
+
case "end":
|
|
419
|
+
return _context5.stop();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}, _callee5, this, [[13, 24, 27, 30]]);
|
|
423
|
+
}));
|
|
424
|
+
|
|
425
|
+
function get_deltaObject(_x) {
|
|
426
|
+
return _get_deltaObject.apply(this, arguments);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return get_deltaObject;
|
|
430
|
+
}()
|
|
431
|
+
/* --------------------------------- Getters -------------------------------- */
|
|
432
|
+
|
|
433
|
+
}, {
|
|
434
|
+
key: "__web_path",
|
|
435
|
+
get: function get() {
|
|
436
|
+
return this.constructor["__web_path"];
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "__web_type",
|
|
440
|
+
get: function get() {
|
|
441
|
+
return this.constructor["__web_type"];
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "manager",
|
|
445
|
+
get: function get() {
|
|
446
|
+
return this.get_managerClass();
|
|
447
|
+
}
|
|
448
|
+
}, {
|
|
449
|
+
key: "onLoad",
|
|
450
|
+
value:
|
|
451
|
+
/* -------------------------------------------------------------------------- */
|
|
452
|
+
function () {
|
|
453
|
+
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
454
|
+
var _this$manager;
|
|
455
|
+
|
|
456
|
+
var _len,
|
|
457
|
+
p,
|
|
458
|
+
_key,
|
|
459
|
+
_args6 = arguments;
|
|
460
|
+
|
|
461
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
462
|
+
while (1) {
|
|
463
|
+
switch (_context6.prev = _context6.next) {
|
|
464
|
+
case 0:
|
|
465
|
+
for (_len = _args6.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
466
|
+
p[_key] = _args6[_key];
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
_context6.next = 3;
|
|
470
|
+
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onLoad.apply(_this$manager, p);
|
|
471
|
+
|
|
472
|
+
case 3:
|
|
473
|
+
return _context6.abrupt("return", _context6.sent);
|
|
474
|
+
|
|
475
|
+
case 4:
|
|
476
|
+
case "end":
|
|
477
|
+
return _context6.stop();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}, _callee6, this);
|
|
481
|
+
}));
|
|
482
|
+
|
|
483
|
+
function onLoad() {
|
|
484
|
+
return _onLoad.apply(this, arguments);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return onLoad;
|
|
488
|
+
}()
|
|
489
|
+
}, {
|
|
490
|
+
key: "onSave",
|
|
491
|
+
value: function () {
|
|
492
|
+
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
493
|
+
var _this$manager2;
|
|
494
|
+
|
|
495
|
+
var _len2,
|
|
496
|
+
p,
|
|
497
|
+
_key2,
|
|
498
|
+
_args7 = arguments;
|
|
499
|
+
|
|
500
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
501
|
+
while (1) {
|
|
502
|
+
switch (_context7.prev = _context7.next) {
|
|
503
|
+
case 0:
|
|
504
|
+
for (_len2 = _args7.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
505
|
+
p[_key2] = _args7[_key2];
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
_context7.next = 3;
|
|
509
|
+
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onSave.apply(_this$manager2, p);
|
|
510
|
+
|
|
511
|
+
case 3:
|
|
512
|
+
return _context7.abrupt("return", _context7.sent);
|
|
513
|
+
|
|
514
|
+
case 4:
|
|
515
|
+
case "end":
|
|
516
|
+
return _context7.stop();
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}, _callee7, this);
|
|
520
|
+
}));
|
|
521
|
+
|
|
522
|
+
function onSave() {
|
|
523
|
+
return _onSave.apply(this, arguments);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
return onSave;
|
|
527
|
+
}()
|
|
528
|
+
}, {
|
|
529
|
+
key: "onNew",
|
|
530
|
+
value: function () {
|
|
531
|
+
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
532
|
+
var _this$manager3;
|
|
533
|
+
|
|
534
|
+
var _len3,
|
|
535
|
+
p,
|
|
536
|
+
_key3,
|
|
537
|
+
_args8 = arguments;
|
|
538
|
+
|
|
539
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
540
|
+
while (1) {
|
|
541
|
+
switch (_context8.prev = _context8.next) {
|
|
542
|
+
case 0:
|
|
543
|
+
for (_len3 = _args8.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
544
|
+
p[_key3] = _args8[_key3];
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
_context8.next = 3;
|
|
548
|
+
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onNew.apply(_this$manager3, p);
|
|
549
|
+
|
|
550
|
+
case 3:
|
|
551
|
+
return _context8.abrupt("return", _context8.sent);
|
|
552
|
+
|
|
553
|
+
case 4:
|
|
554
|
+
case "end":
|
|
555
|
+
return _context8.stop();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}, _callee8, this);
|
|
559
|
+
}));
|
|
560
|
+
|
|
561
|
+
function onNew() {
|
|
562
|
+
return _onNew.apply(this, arguments);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return onNew;
|
|
566
|
+
}()
|
|
567
|
+
/* -------------------------------------------------------------------------- */
|
|
568
|
+
|
|
569
|
+
/**
|
|
26
570
|
* get a single web object
|
|
27
571
|
* default order of parameters : search,readonly,fetchID
|
|
28
|
-
*/
|
|
572
|
+
*/
|
|
573
|
+
|
|
574
|
+
}], [{
|
|
575
|
+
key: "getMeta",
|
|
576
|
+
value: function getMeta(o, key) {
|
|
577
|
+
if (o == null) return null;
|
|
578
|
+
var metalist = [];
|
|
579
|
+
|
|
580
|
+
if (_typeof(o) === "object") {
|
|
581
|
+
metalist = typeof o.getValue === "function" ? o.getValue("meta_data") : o.meta_data;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
return (0, _object.getInArray)(metalist, "key", key);
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
29
587
|
* Get meta value by key
|
|
30
588
|
* @param o
|
|
31
589
|
* @param key
|
|
32
590
|
* @returns value or undefined
|
|
33
|
-
*/
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
}, {
|
|
594
|
+
key: "getMetaValue",
|
|
595
|
+
value: function getMetaValue(o, key) {
|
|
596
|
+
var _WebObject$getMeta;
|
|
597
|
+
|
|
598
|
+
return (_WebObject$getMeta = WebObject.getMeta(o, key)) === null || _WebObject$getMeta === void 0 ? void 0 : _WebObject$getMeta.value;
|
|
599
|
+
}
|
|
600
|
+
}, {
|
|
601
|
+
key: "isResultValid",
|
|
602
|
+
value: function isResultValid(result_object) {
|
|
603
|
+
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
604
|
+
|
|
605
|
+
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
}, {
|
|
612
|
+
key: "get_single",
|
|
613
|
+
value: function () {
|
|
614
|
+
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
615
|
+
var _len4,
|
|
616
|
+
p,
|
|
617
|
+
_key4,
|
|
618
|
+
search,
|
|
619
|
+
readonly,
|
|
620
|
+
fetchID,
|
|
621
|
+
res,
|
|
622
|
+
params,
|
|
623
|
+
_args9 = arguments;
|
|
624
|
+
|
|
625
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
626
|
+
while (1) {
|
|
627
|
+
switch (_context9.prev = _context9.next) {
|
|
628
|
+
case 0:
|
|
629
|
+
for (_len4 = _args9.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
630
|
+
p[_key4] = _args9[_key4];
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
search = p.shift();
|
|
634
|
+
readonly = p.shift();
|
|
635
|
+
fetchID = p.shift();
|
|
636
|
+
|
|
637
|
+
if (!(0, _object.object_isEmpty)(search)) {
|
|
638
|
+
_context9.next = 6;
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
return _context9.abrupt("return", undefined);
|
|
643
|
+
|
|
644
|
+
case 6:
|
|
645
|
+
params = {};
|
|
646
|
+
params.context = readonly ? "view" : "edit";
|
|
647
|
+
_context9.t0 = _typeof(search);
|
|
648
|
+
_context9.next = _context9.t0 === "string" ? 11 : _context9.t0 === "number" ? 11 : _context9.t0 === "object" ? 19 : 19;
|
|
649
|
+
break;
|
|
650
|
+
|
|
651
|
+
case 11:
|
|
652
|
+
search = String(search);
|
|
653
|
+
_context9.t1 = this;
|
|
654
|
+
_context9.t2 = this;
|
|
655
|
+
_context9.next = 16;
|
|
656
|
+
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
657
|
+
fetchID: fetchID
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
case 16:
|
|
661
|
+
_context9.t3 = _context9.sent;
|
|
662
|
+
res = _context9.t1.ensure.call(_context9.t1, _context9.t2, _context9.t3);
|
|
663
|
+
return _context9.abrupt("break", 25);
|
|
664
|
+
|
|
665
|
+
case 19:
|
|
666
|
+
_context9.t4 = _object.object_first;
|
|
667
|
+
_context9.next = 22;
|
|
668
|
+
return this.get_list(search, readonly, fetchID);
|
|
669
|
+
|
|
670
|
+
case 22:
|
|
671
|
+
_context9.t5 = _context9.sent;
|
|
672
|
+
res = (0, _context9.t4)(_context9.t5);
|
|
673
|
+
return _context9.abrupt("break", 25);
|
|
674
|
+
|
|
675
|
+
case 25:
|
|
676
|
+
WebObject.setReadonly(res, readonly);
|
|
677
|
+
return _context9.abrupt("return", res);
|
|
678
|
+
|
|
679
|
+
case 27:
|
|
680
|
+
case "end":
|
|
681
|
+
return _context9.stop();
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}, _callee9, this);
|
|
685
|
+
}));
|
|
686
|
+
|
|
687
|
+
function get_single() {
|
|
688
|
+
return _get_single.apply(this, arguments);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return get_single;
|
|
692
|
+
}()
|
|
693
|
+
/**
|
|
34
694
|
* Get a list of web objects
|
|
35
695
|
* default order of parameters : search,readonly,fetchID
|
|
36
|
-
*/
|
|
696
|
+
*/
|
|
697
|
+
|
|
698
|
+
}, {
|
|
699
|
+
key: "get_list",
|
|
700
|
+
value: function () {
|
|
701
|
+
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
702
|
+
var _len5,
|
|
703
|
+
p,
|
|
704
|
+
_key5,
|
|
705
|
+
search,
|
|
706
|
+
readonly,
|
|
707
|
+
fetchID,
|
|
708
|
+
result_items,
|
|
709
|
+
selftype,
|
|
710
|
+
res,
|
|
711
|
+
_args10 = arguments;
|
|
712
|
+
|
|
713
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
714
|
+
while (1) {
|
|
715
|
+
switch (_context10.prev = _context10.next) {
|
|
716
|
+
case 0:
|
|
717
|
+
for (_len5 = _args10.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
718
|
+
p[_key5] = _args10[_key5];
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
search = p.shift();
|
|
722
|
+
readonly = p.shift();
|
|
723
|
+
fetchID = p.shift();
|
|
724
|
+
if (!search) search = {};
|
|
725
|
+
_context10.next = 7;
|
|
726
|
+
return _global.gfunc.run_action("get", this.__web_path, search, {
|
|
727
|
+
fetchID: fetchID
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
case 7:
|
|
731
|
+
result_items = _context10.sent;
|
|
732
|
+
selftype = this.prototype;
|
|
733
|
+
res = WebObject.map_rowindex(WebObject.mapto(selftype, result_items, readonly));
|
|
734
|
+
WebObject.setReadonly(res, readonly);
|
|
735
|
+
return _context10.abrupt("return", res);
|
|
736
|
+
|
|
737
|
+
case 12:
|
|
738
|
+
case "end":
|
|
739
|
+
return _context10.stop();
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}, _callee10, this);
|
|
743
|
+
}));
|
|
744
|
+
|
|
745
|
+
function get_list() {
|
|
746
|
+
return _get_list.apply(this, arguments);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
return get_list;
|
|
750
|
+
}()
|
|
751
|
+
}]);
|
|
752
|
+
|
|
753
|
+
return WebObject;
|
|
754
|
+
}(_SimpleObject2["default"]);
|
|
755
|
+
|
|
756
|
+
exports.WebObject = WebObject;
|
|
757
|
+
|
|
758
|
+
_defineProperty(WebObject, "__web_path", "");
|
|
759
|
+
|
|
760
|
+
_defineProperty(WebObject, "__web_type", "");
|
|
761
|
+
|
|
762
|
+
var _default = WebObject;
|
|
763
|
+
exports["default"] = _default;
|