@azrico/webobject 1.5.15 → 1.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,275 +1,473 @@
1
- import { SimpleObject } from "../index";
2
- import { array_chunks, array_first, array_intersection, array_merge, array_remove_duplicates, fn_eval_this, object_equals, object_getStatic, object_isEmpty, wrap_array, } from "@azrico/object";
3
- import { string_compress, string_decompress } from "@azrico/string";
4
- import { gcache, gfunc } from "@azrico/global";
5
- import FormatHelper from "@azrico/convert";
6
- import WebObjectPathHelper from "./WebObjectPathHelper";
7
- import WebObjectHelper from "./WebObjectHelper";
8
- export class WebObject extends SimpleObject {
9
- static __web_path = "";
10
- static __protectedProperties = ["_users"];
11
- //you cant create a new weboject without these properties
12
- static __requiredProperties = [];
13
- meta_data;
14
- //created date
15
- _created_date;
16
- //the owner of the object
17
- _creator;
18
- //multiple users can work on one object
19
- _users;
20
- constructor(is_readonly = false) {
21
- super(is_readonly);
22
- this.meta_data = {};
23
- }
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.WebObject = void 0;
7
+ var _index3 = require("../index");
8
+ var _object = require("@azrico/object");
9
+ var _string = require("@azrico/string");
10
+ var _global = require("@azrico/global");
11
+ var _convert = _interopRequireDefault(require("@azrico/convert"));
12
+ var _WebObjectPathHelper = _interopRequireDefault(require("./WebObjectPathHelper"));
13
+ var _WebObjectHelper = _interopRequireDefault(require("./WebObjectHelper"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+ 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; } } }; }
16
+ 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); }
17
+ 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; }
18
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
+ 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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ 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); } }
23
+ 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); }); }; }
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
28
+ 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); }
29
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
32
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
33
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
+ 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); }
35
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
36
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
38
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
39
+ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
40
+ function WebObject() {
41
+ var _this;
42
+ var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
43
+ _classCallCheck(this, WebObject);
44
+ _this = _callSuper(this, WebObject, [is_readonly]);
45
+ _defineProperty(_this, "meta_data", void 0);
46
+ //created date
47
+ _defineProperty(_this, "_created_date", void 0);
48
+ //the owner of the object
49
+ _defineProperty(_this, "_creator", void 0);
50
+ //multiple users can work on one object
51
+ _defineProperty(_this, "_users", void 0);
52
+ _this.meta_data = {};
53
+ return _this;
54
+ }
55
+ /**
56
+ * get a list of all user ids that work on the given object
57
+ * _creator + _users + attentions(old)
58
+ * removes duplicates
59
+ * @returns array of ids
60
+ */
61
+ _inherits(WebObject, _SimpleObject);
62
+ return _createClass(WebObject, [{
63
+ key: "getAllUsers",
64
+ value: function getAllUsers() {
65
+ return WebObject.getAllUsers(this);
66
+ }
24
67
  /**
25
68
  * get a list of all user ids that work on the given object
26
69
  * _creator + _users + attentions(old)
27
70
  * removes duplicates
28
71
  * @returns array of ids
29
- */
30
- getAllUsers() {
31
- return WebObject.getAllUsers(this);
32
- }
33
- /**
34
- * get a list of all user ids that work on the given object
35
- * _creator + _users + attentions(old)
36
- * removes duplicates
37
- * @returns array of ids
38
- */
39
- static getAllUsers(obj) {
40
- if (typeof obj != "object")
41
- return [];
42
- return array_remove_duplicates(array_merge(obj._creator, wrap_array(obj._users), wrap_array(obj.attentions))
43
- .map((r) => String(typeof r === "object" ? WebObject.getID(r) : r))
44
- .filter((s) => s));
45
- }
46
- /* -------------------------------------------------------------------------- */
47
- /* Meta data */
48
- /* -------------------------------------------------------------------------- */
72
+ */
73
+ }, {
74
+ key: "setMetaValue",
75
+ value: (
76
+ /* -------------------------------------------------------------------------- */
77
+ /* Meta data */
78
+ /* -------------------------------------------------------------------------- */
49
79
  /**
50
80
  * Update meta value of this object , meta data is stored in meta_data variable
51
81
  * @param key
52
82
  * @param value
53
83
  * @param sendChange
54
84
  * @returns
55
- */
56
- async setMetaValue(key, value, sendChange = "auto") {
57
- if (!this.canModify) {
58
- if (this.__throw_errors !== false)
59
- throw Error(`Cant use setMetaValue on ${key} when on readonly mode`);
60
- else
61
- return false;
62
- }
63
- if (!key || typeof key != "string") {
64
- if (this.__throw_errors !== false)
65
- throw Error(`Bad key at setMetaValue`);
66
- else
67
- return false;
68
- }
69
- const old_value = WebObject.getMetaValue(this, key);
70
- if (object_equals(old_value, value))
71
- return false; //same value, no changes
72
- const new_metalist = { ...this.get("meta_data") };
73
- new_metalist[key] = value;
74
- await this.set("meta_data", new_metalist);
75
- if (sendChange !== false)
76
- await this.notifyChanged("meta", key, value);
77
- return true;
78
- }
85
+ */
86
+ function () {
87
+ var _setMetaValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
88
+ var sendChange,
89
+ old_value,
90
+ new_metalist,
91
+ _args = arguments;
92
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
93
+ while (1) switch (_context.prev = _context.next) {
94
+ case 0:
95
+ sendChange = _args.length > 2 && _args[2] !== undefined ? _args[2] : "auto";
96
+ if (this.canModify) {
97
+ _context.next = 7;
98
+ break;
99
+ }
100
+ if (!(this.__throw_errors !== false)) {
101
+ _context.next = 6;
102
+ break;
103
+ }
104
+ throw Error("Cant use setMetaValue on ".concat(key, " when on readonly mode"));
105
+ case 6:
106
+ return _context.abrupt("return", false);
107
+ case 7:
108
+ if (!(!key || typeof key != "string")) {
109
+ _context.next = 13;
110
+ break;
111
+ }
112
+ if (!(this.__throw_errors !== false)) {
113
+ _context.next = 12;
114
+ break;
115
+ }
116
+ throw Error("Bad key at setMetaValue");
117
+ case 12:
118
+ return _context.abrupt("return", false);
119
+ case 13:
120
+ old_value = WebObject.getMetaValue(this, key);
121
+ if (!(0, _object.object_equals)(old_value, value)) {
122
+ _context.next = 16;
123
+ break;
124
+ }
125
+ return _context.abrupt("return", false);
126
+ case 16:
127
+ //same value, no changes
128
+ new_metalist = _objectSpread({}, this.get("meta_data"));
129
+ new_metalist[key] = value;
130
+ _context.next = 20;
131
+ return this.set("meta_data", new_metalist);
132
+ case 20:
133
+ if (!(sendChange !== false)) {
134
+ _context.next = 23;
135
+ break;
136
+ }
137
+ _context.next = 23;
138
+ return this.notifyChanged("meta", key, value);
139
+ case 23:
140
+ return _context.abrupt("return", true);
141
+ case 24:
142
+ case "end":
143
+ return _context.stop();
144
+ }
145
+ }, _callee, this);
146
+ }));
147
+ function setMetaValue(_x, _x2) {
148
+ return _setMetaValue.apply(this, arguments);
149
+ }
150
+ return setMetaValue;
151
+ }()
79
152
  /**
80
153
  * Get meta value by key
81
154
  * @param key
82
155
  * @returns value or undefined
83
- */
84
- getMetaValue(key) {
85
- return WebObject.getMetaValue(this, key);
86
- }
156
+ */
157
+ )
158
+ }, {
159
+ key: "getMetaValue",
160
+ value: function getMetaValue(key) {
161
+ return WebObject.getMetaValue(this, key);
162
+ }
87
163
  /**
88
164
  * Get meta value by key
89
165
  * @param o
90
166
  * @param key
91
167
  * @returns value or undefined
92
- */
93
- static getMetaValue(o, key) {
94
- if (o == null)
95
- return null;
96
- if (!key || typeof key != "string")
97
- return undefined;
98
- let metalist = {};
99
- if (typeof o === "object") {
100
- metalist =
101
- typeof o.get === "function" ? o.get("meta_data") : o.meta_data;
102
- }
103
- return metalist[key];
104
- }
105
- /* -------------------------------------------------------------------------- */
106
- /* Save */
107
- /* -------------------------------------------------------------------------- */
108
- static zipSaveList(svlist) {
109
- if (typeof svlist === "object")
110
- svlist = JSON.stringify(svlist);
111
- return string_compress(svlist);
112
- }
113
- static unzipSaveList(svlist) {
114
- try {
115
- if (typeof svlist === "object") {
116
- if (Array.isArray(svlist))
117
- return svlist;
118
- if (svlist.__save_list)
119
- return this.unzipSaveList(svlist.__save_list);
120
- }
121
- else if (typeof svlist === "string")
122
- return wrap_array(JSON.parse(string_decompress(svlist)));
123
- }
124
- catch { }
125
- return wrap_array(svlist);
126
- }
127
- static async saveList(itemList, extraOptions = {}) {
128
- if (!extraOptions)
129
- extraOptions = {};
130
- const chunks = array_chunks(itemList, extraOptions.chunksize ?? 50);
131
- delete extraOptions.chunksize;
132
- const putAddress = this.get_webpath();
133
- for (let index = 0; index < chunks.length; index++) {
134
- const items_to_save = chunks[index];
135
- const save_array = [];
136
- for (let k = 0; k < items_to_save.length; k++) {
137
- const item = items_to_save[k];
138
- const dlt = await item.get_deltaObject();
139
- save_array.push(item.isNew
140
- ? {
141
- ...dlt,
142
- }
143
- : {
144
- _id: item.getID(),
145
- ...dlt,
146
- });
147
- }
148
- const resultObject = await gfunc.run_action("post", putAddress, {
149
- __save_list: WebObject.zipSaveList(save_array),
150
- ...extraOptions,
151
- });
152
- if (Array.isArray(resultObject)) {
153
- for (let index = 0; index < Math.min(resultObject.length, items_to_save.length); index++) {
154
- const res = resultObject[index];
155
- const item = items_to_save[index];
156
- item.setSaveResult(res);
157
- await item.onSave();
158
- }
159
- }
160
- }
161
- for (let index = 0; index < itemList.length; index++) {
162
- const item = itemList[index];
163
- if (!item.isSaved)
164
- return false;
165
- if (item.getSaveResultType() != "normal")
166
- return false;
167
- }
168
- return true;
169
- }
170
- async Save() {
171
- try {
172
- if (this.manager) {
173
- await this.manager.setOption("saving", true);
174
- await this.manager.setOption("loading", true);
175
- }
176
- const deltaObject = await this.get_deltaObject();
177
- const putAction = "post";
178
- const usepath = await WebObjectPathHelper.get_path(this, this.isNew ? "new" : "save");
179
- /* ---------------------------------- save ---------------------------------- */
180
- if (!object_isEmpty(deltaObject)) {
181
- const canSaveResult = this.canSave(deltaObject);
182
- if (canSaveResult !== true) {
183
- WebObject.addError(this, "Save not allowed", String(canSaveResult), true);
184
- this.setSaveResult(false, "canceled");
185
- return false;
186
- }
187
- const resultObject = await gfunc.run_action(putAction, usepath, deltaObject);
188
- this.setSaveResult(resultObject, "auto");
189
- if (!this.__saveResultIsSuccess) {
190
- console.error("bad save result : ", resultObject);
191
- WebObject.addError(this, "Save result is not valid", "the response from server was not a valid saveresult object !", true);
192
- }
193
- }
194
- else {
195
- /* nothing to save */
196
- this.setSaveResult(null, "nothing");
197
- }
198
- if (this.isSaved) {
199
- await this.onSave();
200
- return this.getSaveResult();
201
- }
202
- }
203
- finally {
204
- if (this.manager) {
205
- await this.manager.setOption("saving", false);
206
- await this.manager.setOption("loading", false);
207
- }
208
- }
209
- }
210
- async Delete() {
211
- if (this.isNew)
212
- return;
213
- const usepath = await WebObjectPathHelper.get_path(this, "delete");
214
- const resultObject = await gfunc.run_action("delete", usepath);
215
- this.setSaveResult(resultObject, "auto", true);
216
- await this.onDelete();
217
- return resultObject;
218
- }
219
- async Lock() {
220
- if (this.isNew || this.isArchived)
221
- return;
222
- const usepath = await WebObjectPathHelper.get_path(this, "lock");
223
- const resultObject = await gfunc.run_action("post", usepath);
224
- this.setSaveResult(resultObject, "auto", true);
225
- await this.onLock();
226
- return resultObject;
227
- }
228
- async UnLock() {
229
- if (this.isNew || this.isArchived)
230
- return;
231
- const usepath = await WebObjectPathHelper.get_path(this, "unlock");
232
- const resultObject = await gfunc.run_action("post", usepath);
233
- this.setSaveResult(resultObject, "auto", true);
234
- await this.onUnLock();
235
- return resultObject;
236
- }
237
- async Archive() {
238
- if (this.isNew || this.isArchived)
239
- return;
240
- const usepath = await WebObjectPathHelper.get_path(this, "archive");
241
- const resultObject = await gfunc.run_action("post", usepath);
242
- this.setSaveResult(resultObject, "auto", true);
243
- await this.onArchive();
244
- return resultObject;
245
- }
246
- async UnArchive() {
247
- if (this.isNew || !this.isArchived)
248
- return;
249
- const usepath = await WebObjectPathHelper.get_path(this, "unarchive");
250
- const resultObject = await gfunc.run_action("post", usepath);
251
- await this.onUnArchive();
252
- return resultObject;
253
- }
254
- /* -------------------------------------------------------------------------- */
255
- canSave(deltaObj) {
256
- const deltaRes = this.deltaIsValid(deltaObj);
257
- if (deltaRes !== true)
258
- return deltaRes;
259
- return true;
260
- }
261
- canDelete() {
262
- return true;
263
- }
264
- canArchive() {
265
- return true;
266
- }
267
- deltaIsValid(d) {
268
- return true;
269
- }
270
- /* -------------------------------------------------------------------------- */
271
- /* get delta */
272
- /* -------------------------------------------------------------------------- */
168
+ */
169
+ }, {
170
+ key: "Save",
171
+ value: function () {
172
+ var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
173
+ var deltaObject, putAction, usepath, canSaveResult, resultObject;
174
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
175
+ while (1) switch (_context2.prev = _context2.next) {
176
+ case 0:
177
+ _context2.prev = 0;
178
+ if (!this.manager) {
179
+ _context2.next = 6;
180
+ break;
181
+ }
182
+ _context2.next = 4;
183
+ return this.manager.setOption("saving", true);
184
+ case 4:
185
+ _context2.next = 6;
186
+ return this.manager.setOption("loading", true);
187
+ case 6:
188
+ _context2.next = 8;
189
+ return this.get_deltaObject();
190
+ case 8:
191
+ deltaObject = _context2.sent;
192
+ putAction = "post";
193
+ _context2.next = 12;
194
+ return _WebObjectPathHelper["default"].get_path(this, this.isNew ? "new" : "save");
195
+ case 12:
196
+ usepath = _context2.sent;
197
+ if ((0, _object.object_isEmpty)(deltaObject)) {
198
+ _context2.next = 26;
199
+ break;
200
+ }
201
+ canSaveResult = this.canSave(deltaObject);
202
+ if (!(canSaveResult !== true)) {
203
+ _context2.next = 19;
204
+ break;
205
+ }
206
+ WebObject.addError(this, "Save not allowed", String(canSaveResult), true);
207
+ this.setSaveResult(false, "canceled");
208
+ return _context2.abrupt("return", false);
209
+ case 19:
210
+ _context2.next = 21;
211
+ return _global.gfunc.run_action(putAction, usepath, deltaObject);
212
+ case 21:
213
+ resultObject = _context2.sent;
214
+ this.setSaveResult(resultObject, "auto");
215
+ if (!this.__saveResultIsSuccess) {
216
+ console.error("bad save result : ", resultObject);
217
+ WebObject.addError(this, "Save result is not valid", "the response from server was not a valid saveresult object !", true);
218
+ }
219
+ _context2.next = 27;
220
+ break;
221
+ case 26:
222
+ /* nothing to save */
223
+ this.setSaveResult(null, "nothing");
224
+ case 27:
225
+ if (!this.isSaved) {
226
+ _context2.next = 31;
227
+ break;
228
+ }
229
+ _context2.next = 30;
230
+ return this.onSave();
231
+ case 30:
232
+ return _context2.abrupt("return", this.getSaveResult());
233
+ case 31:
234
+ _context2.prev = 31;
235
+ if (!this.manager) {
236
+ _context2.next = 37;
237
+ break;
238
+ }
239
+ _context2.next = 35;
240
+ return this.manager.setOption("saving", false);
241
+ case 35:
242
+ _context2.next = 37;
243
+ return this.manager.setOption("loading", false);
244
+ case 37:
245
+ return _context2.finish(31);
246
+ case 38:
247
+ case "end":
248
+ return _context2.stop();
249
+ }
250
+ }, _callee2, this, [[0,, 31, 38]]);
251
+ }));
252
+ function Save() {
253
+ return _Save.apply(this, arguments);
254
+ }
255
+ return Save;
256
+ }()
257
+ }, {
258
+ key: "Delete",
259
+ value: function () {
260
+ var _Delete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
261
+ var usepath, resultObject;
262
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
263
+ while (1) switch (_context3.prev = _context3.next) {
264
+ case 0:
265
+ if (!this.isNew) {
266
+ _context3.next = 2;
267
+ break;
268
+ }
269
+ return _context3.abrupt("return");
270
+ case 2:
271
+ _context3.next = 4;
272
+ return _WebObjectPathHelper["default"].get_path(this, "delete");
273
+ case 4:
274
+ usepath = _context3.sent;
275
+ _context3.next = 7;
276
+ return _global.gfunc.run_action("delete", usepath);
277
+ case 7:
278
+ resultObject = _context3.sent;
279
+ this.setSaveResult(resultObject, "auto", true);
280
+ _context3.next = 11;
281
+ return this.onDelete();
282
+ case 11:
283
+ return _context3.abrupt("return", resultObject);
284
+ case 12:
285
+ case "end":
286
+ return _context3.stop();
287
+ }
288
+ }, _callee3, this);
289
+ }));
290
+ function Delete() {
291
+ return _Delete.apply(this, arguments);
292
+ }
293
+ return Delete;
294
+ }()
295
+ }, {
296
+ key: "Lock",
297
+ value: function () {
298
+ var _Lock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
299
+ var usepath, resultObject;
300
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
301
+ while (1) switch (_context4.prev = _context4.next) {
302
+ case 0:
303
+ if (!(this.isNew || this.isArchived)) {
304
+ _context4.next = 2;
305
+ break;
306
+ }
307
+ return _context4.abrupt("return");
308
+ case 2:
309
+ _context4.next = 4;
310
+ return _WebObjectPathHelper["default"].get_path(this, "lock");
311
+ case 4:
312
+ usepath = _context4.sent;
313
+ _context4.next = 7;
314
+ return _global.gfunc.run_action("post", usepath);
315
+ case 7:
316
+ resultObject = _context4.sent;
317
+ this.setSaveResult(resultObject, "auto", true);
318
+ _context4.next = 11;
319
+ return this.onLock();
320
+ case 11:
321
+ return _context4.abrupt("return", resultObject);
322
+ case 12:
323
+ case "end":
324
+ return _context4.stop();
325
+ }
326
+ }, _callee4, this);
327
+ }));
328
+ function Lock() {
329
+ return _Lock.apply(this, arguments);
330
+ }
331
+ return Lock;
332
+ }()
333
+ }, {
334
+ key: "UnLock",
335
+ value: function () {
336
+ var _UnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
337
+ var usepath, resultObject;
338
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
339
+ while (1) switch (_context5.prev = _context5.next) {
340
+ case 0:
341
+ if (!(this.isNew || this.isArchived)) {
342
+ _context5.next = 2;
343
+ break;
344
+ }
345
+ return _context5.abrupt("return");
346
+ case 2:
347
+ _context5.next = 4;
348
+ return _WebObjectPathHelper["default"].get_path(this, "unlock");
349
+ case 4:
350
+ usepath = _context5.sent;
351
+ _context5.next = 7;
352
+ return _global.gfunc.run_action("post", usepath);
353
+ case 7:
354
+ resultObject = _context5.sent;
355
+ this.setSaveResult(resultObject, "auto", true);
356
+ _context5.next = 11;
357
+ return this.onUnLock();
358
+ case 11:
359
+ return _context5.abrupt("return", resultObject);
360
+ case 12:
361
+ case "end":
362
+ return _context5.stop();
363
+ }
364
+ }, _callee5, this);
365
+ }));
366
+ function UnLock() {
367
+ return _UnLock.apply(this, arguments);
368
+ }
369
+ return UnLock;
370
+ }()
371
+ }, {
372
+ key: "Archive",
373
+ value: function () {
374
+ var _Archive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
375
+ var usepath, resultObject;
376
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
377
+ while (1) switch (_context6.prev = _context6.next) {
378
+ case 0:
379
+ if (!(this.isNew || this.isArchived)) {
380
+ _context6.next = 2;
381
+ break;
382
+ }
383
+ return _context6.abrupt("return");
384
+ case 2:
385
+ _context6.next = 4;
386
+ return _WebObjectPathHelper["default"].get_path(this, "archive");
387
+ case 4:
388
+ usepath = _context6.sent;
389
+ _context6.next = 7;
390
+ return _global.gfunc.run_action("post", usepath);
391
+ case 7:
392
+ resultObject = _context6.sent;
393
+ this.setSaveResult(resultObject, "auto", true);
394
+ _context6.next = 11;
395
+ return this.onArchive();
396
+ case 11:
397
+ return _context6.abrupt("return", resultObject);
398
+ case 12:
399
+ case "end":
400
+ return _context6.stop();
401
+ }
402
+ }, _callee6, this);
403
+ }));
404
+ function Archive() {
405
+ return _Archive.apply(this, arguments);
406
+ }
407
+ return Archive;
408
+ }()
409
+ }, {
410
+ key: "UnArchive",
411
+ value: function () {
412
+ var _UnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
413
+ var usepath, resultObject;
414
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
415
+ while (1) switch (_context7.prev = _context7.next) {
416
+ case 0:
417
+ if (!(this.isNew || !this.isArchived)) {
418
+ _context7.next = 2;
419
+ break;
420
+ }
421
+ return _context7.abrupt("return");
422
+ case 2:
423
+ _context7.next = 4;
424
+ return _WebObjectPathHelper["default"].get_path(this, "unarchive");
425
+ case 4:
426
+ usepath = _context7.sent;
427
+ _context7.next = 7;
428
+ return _global.gfunc.run_action("post", usepath);
429
+ case 7:
430
+ resultObject = _context7.sent;
431
+ _context7.next = 10;
432
+ return this.onUnArchive();
433
+ case 10:
434
+ return _context7.abrupt("return", resultObject);
435
+ case 11:
436
+ case "end":
437
+ return _context7.stop();
438
+ }
439
+ }, _callee7, this);
440
+ }));
441
+ function UnArchive() {
442
+ return _UnArchive.apply(this, arguments);
443
+ }
444
+ return UnArchive;
445
+ }() /* -------------------------------------------------------------------------- */
446
+ }, {
447
+ key: "canSave",
448
+ value: function canSave(deltaObj) {
449
+ var deltaRes = this.deltaIsValid(deltaObj);
450
+ if (deltaRes !== true) return deltaRes;
451
+ return true;
452
+ }
453
+ }, {
454
+ key: "canDelete",
455
+ value: function canDelete() {
456
+ return true;
457
+ }
458
+ }, {
459
+ key: "canArchive",
460
+ value: function canArchive() {
461
+ return true;
462
+ }
463
+ }, {
464
+ key: "deltaIsValid",
465
+ value: function deltaIsValid(d) {
466
+ return true;
467
+ }
468
+ /* -------------------------------------------------------------------------- */
469
+ /* get delta */
470
+ /* -------------------------------------------------------------------------- */
273
471
  /**
274
472
  * converts this object to an basic object
275
473
  * that can be passed into client components from server components
@@ -277,353 +475,1119 @@ export class WebObject extends SimpleObject {
277
475
  * uses `get_fullDeltaObject`
278
476
  * @param p
279
477
  * @returns
280
- */
281
- async get_basicObject() {
282
- const fullobject = await this.get_fullObject();
283
- for (const key in fullobject) {
284
- const element = fullobject[key];
285
- /* --------------------------- check for id fields -------------------------- */
286
- if (element != null && typeof element === "object") {
287
- if ((key === "id" || key.endsWith("_id")) &&
288
- typeof element.toString === "function") {
289
- fullobject[key] = String(element);
290
- }
291
- else {
292
- fullobject[key] = JSON.parse(JSON.stringify(element));
293
- }
294
- }
295
- }
296
- return fullobject;
297
- }
478
+ */
479
+ }, {
480
+ key: "get_basicObject",
481
+ value: (function () {
482
+ var _get_basicObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
483
+ var fullobject, key, element;
484
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
485
+ while (1) switch (_context8.prev = _context8.next) {
486
+ case 0:
487
+ _context8.next = 2;
488
+ return this.get_fullObject();
489
+ case 2:
490
+ fullobject = _context8.sent;
491
+ for (key in fullobject) {
492
+ element = fullobject[key];
493
+ /* --------------------------- check for id fields -------------------------- */
494
+ if (element != null && _typeof(element) === "object") {
495
+ if ((key === "id" || key.endsWith("_id")) && typeof element.toString === "function") {
496
+ fullobject[key] = String(element);
497
+ } else {
498
+ fullobject[key] = JSON.parse(JSON.stringify(element));
499
+ }
500
+ }
501
+ }
502
+ return _context8.abrupt("return", fullobject);
503
+ case 5:
504
+ case "end":
505
+ return _context8.stop();
506
+ }
507
+ }, _callee8, this);
508
+ }));
509
+ function get_basicObject() {
510
+ return _get_basicObject.apply(this, arguments);
511
+ }
512
+ return get_basicObject;
513
+ }()
298
514
  /**
299
515
  * calls the `get_deltaObject` with
300
516
  * `allProperties` `extraProperties`
301
517
  * set to true
302
518
  *
303
519
  * @returns
304
- */
305
- async get_fullDeltaObject(p) {
306
- return await this.get_deltaObject({
307
- allProperties: true,
308
- extraProperties: true,
309
- ...p,
310
- });
311
- }
520
+ */
521
+ )
522
+ }, {
523
+ key: "get_fullDeltaObject",
524
+ value: (function () {
525
+ var _get_fullDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(p) {
526
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
527
+ while (1) switch (_context9.prev = _context9.next) {
528
+ case 0:
529
+ _context9.next = 2;
530
+ return this.get_deltaObject(_objectSpread({
531
+ allProperties: true,
532
+ extraProperties: true
533
+ }, p));
534
+ case 2:
535
+ return _context9.abrupt("return", _context9.sent);
536
+ case 3:
537
+ case "end":
538
+ return _context9.stop();
539
+ }
540
+ }, _callee9, this);
541
+ }));
542
+ function get_fullDeltaObject(_x3) {
543
+ return _get_fullDeltaObject.apply(this, arguments);
544
+ }
545
+ return get_fullDeltaObject;
546
+ }()
312
547
  /**
313
548
  * calls the `get_deltaObject` with
314
549
  * `allProperties` `extraProperties` `tempProperties`
315
550
  * set to true
316
551
  *
317
552
  * @returns
318
- */
319
- async get_fullObject(p) {
320
- return await this.get_deltaObject({
321
- allProperties: true,
322
- extraProperties: true,
323
- tempProperties: true,
324
- ...p,
325
- });
326
- }
553
+ */
554
+ )
555
+ }, {
556
+ key: "get_fullObject",
557
+ value: (function () {
558
+ var _get_fullObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(p) {
559
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
560
+ while (1) switch (_context10.prev = _context10.next) {
561
+ case 0:
562
+ _context10.next = 2;
563
+ return this.get_deltaObject(_objectSpread({
564
+ allProperties: true,
565
+ extraProperties: true,
566
+ tempProperties: true
567
+ }, p));
568
+ case 2:
569
+ return _context10.abrupt("return", _context10.sent);
570
+ case 3:
571
+ case "end":
572
+ return _context10.stop();
573
+ }
574
+ }, _callee10, this);
575
+ }));
576
+ function get_fullObject(_x4) {
577
+ return _get_fullObject.apply(this, arguments);
578
+ }
579
+ return get_fullObject;
580
+ }()
327
581
  /**
328
582
  * You will post this to the server for saving
329
583
  * automatically removes unchangable fields
330
584
  * @returns
331
- */
332
- async get_deltaObject(p) {
333
- if (!p)
334
- p = {};
335
- const final_object = {};
336
- //@ts-ignore
337
- const useDelta = this.__use_delta || p.useDelta;
338
- const chkChangables = this.__changeables != null || this.__unchangeables != null;
339
- /**
340
- * child objects usually dont update their __delta
341
- * so we read info from all of its properties
342
- */
343
- const changedFields = p.allProperties || (!useDelta && p.isChild && chkChangables)
344
- ? { ...this.allproperties }
345
- : { ...this.__delta };
346
- /* ------------- parse children that have WebObject as delta ------------- */
347
- for (const key in this) {
348
- if (key.startsWith("__") || key in changedFields)
349
- continue;
350
- if (WebObjectHelper.isChangedWebObjectField(this[key])) {
585
+ */
586
+ )
587
+ }, {
588
+ key: "get_deltaObject",
589
+ value: (function () {
590
+ var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(p) {
591
+ var final_object, useDelta, chkChangables, changedFields, key, changableKeys, functionProps, index, fp, parseObj, _parseObj, _iterator, _step, _key, gotIndex, gotId, tempusers;
592
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
593
+ while (1) switch (_context13.prev = _context13.next) {
594
+ case 0:
595
+ _parseObj = function _parseObj3() {
596
+ _parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(obj) {
597
+ var newobj_dlt;
598
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
599
+ while (1) switch (_context12.prev = _context12.next) {
600
+ case 0:
601
+ if (!(obj == null)) {
602
+ _context12.next = 2;
603
+ break;
604
+ }
605
+ return _context12.abrupt("return", undefined);
606
+ case 2:
607
+ if (!Array.isArray(obj)) {
608
+ _context12.next = 6;
609
+ break;
610
+ }
611
+ _context12.next = 5;
612
+ return Promise.all(obj.map( /*#__PURE__*/function () {
613
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(r) {
614
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
615
+ while (1) switch (_context11.prev = _context11.next) {
616
+ case 0:
617
+ _context11.next = 2;
618
+ return parseObj(r);
619
+ case 2:
620
+ return _context11.abrupt("return", _context11.sent);
621
+ case 3:
622
+ case "end":
623
+ return _context11.stop();
624
+ }
625
+ }, _callee11);
626
+ }));
627
+ return function (_x7) {
628
+ return _ref.apply(this, arguments);
629
+ };
630
+ }()));
631
+ case 5:
632
+ return _context12.abrupt("return", _context12.sent);
633
+ case 6:
634
+ if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
635
+ _context12.next = 15;
636
+ break;
637
+ }
638
+ _context12.next = 9;
639
+ return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
640
+ isChild: true
641
+ }));
642
+ case 9:
643
+ newobj_dlt = _context12.sent;
644
+ if ((0, _object.object_isEmpty)(newobj_dlt)) {
645
+ _context12.next = 14;
646
+ break;
647
+ }
648
+ return _context12.abrupt("return", newobj_dlt);
649
+ case 14:
650
+ return _context12.abrupt("return", obj);
651
+ case 15:
652
+ return _context12.abrupt("return", obj);
653
+ case 16:
654
+ case "end":
655
+ return _context12.stop();
656
+ }
657
+ }, _callee12);
658
+ }));
659
+ return _parseObj.apply(this, arguments);
660
+ };
661
+ parseObj = function _parseObj2(_x6) {
662
+ return _parseObj.apply(this, arguments);
663
+ };
664
+ if (!p) p = {};
665
+ final_object = {}; //@ts-ignore
666
+ useDelta = this.__use_delta || p.useDelta;
667
+ chkChangables = this.__changeables != null || this.__unchangeables != null;
668
+ /**
669
+ * child objects usually dont update their __delta
670
+ * so we read info from all of its properties
671
+ */
672
+ changedFields = p.allProperties || !useDelta && p.isChild && chkChangables ? _objectSpread({}, this.allproperties) : _objectSpread({}, this.__delta);
673
+ /* ------------- parse children that have WebObject as delta ------------- */
674
+ _context13.t0 = _regeneratorRuntime().keys(this);
675
+ case 8:
676
+ if ((_context13.t1 = _context13.t0()).done) {
677
+ _context13.next = 15;
678
+ break;
679
+ }
680
+ key = _context13.t1.value;
681
+ if (!(key.startsWith("__") || key in changedFields)) {
682
+ _context13.next = 12;
683
+ break;
684
+ }
685
+ return _context13.abrupt("continue", 8);
686
+ case 12:
687
+ if (_WebObjectHelper["default"].isChangedWebObjectField(this[key])) {
351
688
  /**
352
689
  * if a child has any change we must add it into our delta
353
690
  * notice that the changes may not be saved to database depending on __changeables
354
691
  * but they are changes nevertheless
355
- */
356
- changedFields[key] = this[key];
357
- }
358
- }
359
- /* ------------------------- get all changeable keys ------------------------ */
360
- const changableKeys = array_intersection(Object.keys(changedFields), WebObject.getChangeableKeys(this, p));
361
- await FormatHelper.applyFormats({
362
- inputobject: changedFields,
363
- formats: object_getStatic(this, "__formatList"),
364
- changableKeys: changableKeys,
365
- applyDefaults: true,
366
- });
367
- /* -------------------------------------------------------------------------- */
368
- /* __functionProperties */
369
- /* -------------------------------------------------------------------------- */
370
- const functionProps = object_getStatic(this, "__functionProperties");
371
- for (let index = 0; index < functionProps.length; index++) {
372
- const fp = functionProps[index];
373
- if (changedFields[fp])
374
- changedFields[fp] = fn_eval_this(this, changedFields[fp]);
375
- }
376
- /* -------------------------------------------------------------------------- */
377
- /* parse all changableKeys */
378
- /* -------------------------------------------------------------------------- */
379
- async function parseObj(obj) {
380
- if (obj == null)
381
- return undefined;
382
- if (Array.isArray(obj))
383
- return await Promise.all(obj.map(async (r) => await parseObj(r)));
384
- if (obj instanceof WebObject &&
385
- typeof obj.get_deltaObject === "function") {
386
- //child elements have different kind of delta
387
- const newobj_dlt = await obj.get_deltaObject({
388
- ...p,
389
- isChild: true,
390
- });
391
- if (!object_isEmpty(newobj_dlt))
392
- return newobj_dlt;
393
- else
394
- return obj;
395
- }
396
- return obj;
397
- }
398
- for (const key of changableKeys) {
399
- final_object[key] = await parseObj(changedFields[key]);
400
- }
401
- /* -------------------- add acrhived and date properties -------------------- */
402
- if (p.allProperties) {
403
- final_object["_created_date"] = this["_created_date"];
404
- final_object["_archived"] = this.isArchived;
405
- final_object["_deleted"] = this.isDeleted;
406
- }
407
- /* ---------------------------- add id properties --------------------------- */
408
- if (p.allProperties || p.needId) {
409
- if (this["_index_key"])
410
- final_object["_index_key"] = this["_index_key"];
411
- const gotIndex = this.getIndex();
412
- const gotId = this.getID();
413
- if (gotIndex && gotIndex >= 0)
414
- final_object["_index_value"] = gotIndex;
415
- if (gotId)
416
- final_object["_id"] = gotId;
417
- }
418
- /* -------------------------------------------------------------------------- */
419
- /* fix _user property */
420
- /* -------------------------------------------------------------------------- */
421
- if (final_object["_users"]) {
422
- let tempusers = final_object["_users"];
423
- if (typeof tempusers === "string")
424
- tempusers = tempusers.split(",").filter((s) => s);
425
- final_object["_users"] = wrap_array(tempusers);
426
- }
427
- return final_object;
428
- }
429
- /* --------------------------------- Getters -------------------------------- */
430
- get manager() {
431
- return this.get_managerClass() || undefined;
432
- }
433
- get __web_path() {
434
- return this.constructor["__web_path"] || this.__db_name;
435
- }
436
- get_webpath() {
437
- return this.__web_path || this.__db_name || "";
438
- }
439
- static get_webpath() {
440
- return this.__web_path || this.__db_name || "";
441
- }
442
- static get_dbname() {
443
- return this.__db_name || this.__web_path || "";
444
- }
445
- /* -------------------------------------------------------------------------- */
446
- async onDelete(...p) {
447
- if (this.isSaved)
448
- this.isDeleted = true;
449
- return await this.manager?.onDelete(...p); //events are handled by the manager
450
- }
451
- async onArchive(...p) {
452
- if (this.isSaved)
453
- this.isArchived = true;
454
- return await this.manager?.onArchive(...p); //events are handled by the manager
455
- }
456
- async onUnArchive(...p) {
457
- if (this.isSaved)
458
- this.isArchived = false;
459
- return await this.manager?.onUnArchive(...p); //events are handled by the manager
460
- }
461
- async onLock(...p) {
462
- if (this.isSaved)
463
- this.isLocked = true;
464
- return await this.manager?.onLock(...p); //events are handled by the manager
465
- }
466
- async onUnLock(...p) {
467
- if (this.isSaved)
468
- this.isLocked = false;
469
- return await this.manager?.onUnLock(...p); //events are handled by the manager
470
- }
471
- async onLoad(...p) {
472
- this.isDeleted = false;
473
- return await this.manager?.onLoad(...p); //events are handled by the manager
474
- }
475
- async onSave(...p) {
476
- if (this.isSaved) {
477
- this.apply_changes();
478
- var srObject = this.getSaveResult(true);
479
- if (this.saveResultHasID(srObject)) {
480
- /* -------------------------------------------------------------------------- */
481
- WebObject.LoadIdsFromSaveResult(this, srObject);
482
- await this.manager?.event_run("on_id_change");
483
- }
484
- }
485
- await this.manager?.onSave(...p); //events are handled by the manager
486
- await this.onAfterSave();
487
- return true;
488
- }
489
- async onAfterSave(...p) {
490
- await this.manager?.onAfterSave(...p); //events are handled by the manager
491
- return true;
492
- }
493
- getSaveResult(original = false) {
494
- let srObject = super.getSaveResult(original);
495
- if (!srObject)
496
- return false;
497
- if (Array.isArray(srObject)) {
498
- const actual_sr = srObject.find((s) => this.saveResultHasID(s));
499
- if (actual_sr)
500
- srObject = actual_sr;
501
- }
502
- return srObject;
503
- }
504
- async onNew(...p) {
505
- return await this.manager?.onNew(...p); //events are handled by the manager
506
- }
507
- /* -------------------------------------------------------------------------- */
508
- saveResultHasID(s) {
509
- return WebObject.saveResultHasID(s);
510
- }
511
- static saveResultHasID(s) {
512
- if (typeof s !== "object" || s == null || !s)
513
- return false;
514
- return (s.insertedId ||
515
- s._id ||
516
- (s._index_value && !Number.isNaN(s._index_value)));
517
- }
692
+ */
693
+ changedFields[key] = this[key];
694
+ }
695
+ _context13.next = 8;
696
+ break;
697
+ case 15:
698
+ /* ------------------------- get all changeable keys ------------------------ */
699
+ changableKeys = (0, _object.array_intersection)(Object.keys(changedFields), WebObject.getChangeableKeys(this, p));
700
+ _context13.next = 18;
701
+ return _convert["default"].applyFormats({
702
+ inputobject: changedFields,
703
+ formats: (0, _object.object_getStatic)(this, "__formatList"),
704
+ changableKeys: changableKeys,
705
+ applyDefaults: true
706
+ });
707
+ case 18:
708
+ /* -------------------------------------------------------------------------- */
709
+ /* __functionProperties */
710
+ /* -------------------------------------------------------------------------- */
711
+ functionProps = (0, _object.object_getStatic)(this, "__functionProperties");
712
+ for (index = 0; index < functionProps.length; index++) {
713
+ fp = functionProps[index];
714
+ if (changedFields[fp]) changedFields[fp] = (0, _object.fn_eval_this)(this, changedFields[fp]);
715
+ }
716
+ /* -------------------------------------------------------------------------- */
717
+ /* parse all changableKeys */
718
+ /* -------------------------------------------------------------------------- */
719
+ _iterator = _createForOfIteratorHelper(changableKeys);
720
+ _context13.prev = 21;
721
+ _iterator.s();
722
+ case 23:
723
+ if ((_step = _iterator.n()).done) {
724
+ _context13.next = 30;
725
+ break;
726
+ }
727
+ _key = _step.value;
728
+ _context13.next = 27;
729
+ return parseObj(changedFields[_key]);
730
+ case 27:
731
+ final_object[_key] = _context13.sent;
732
+ case 28:
733
+ _context13.next = 23;
734
+ break;
735
+ case 30:
736
+ _context13.next = 35;
737
+ break;
738
+ case 32:
739
+ _context13.prev = 32;
740
+ _context13.t2 = _context13["catch"](21);
741
+ _iterator.e(_context13.t2);
742
+ case 35:
743
+ _context13.prev = 35;
744
+ _iterator.f();
745
+ return _context13.finish(35);
746
+ case 38:
747
+ /* -------------------- add acrhived and date properties -------------------- */
748
+ if (p.allProperties) {
749
+ final_object["_created_date"] = this["_created_date"];
750
+ final_object["_archived"] = this.isArchived;
751
+ final_object["_deleted"] = this.isDeleted;
752
+ }
753
+ /* ---------------------------- add id properties --------------------------- */
754
+ if (p.allProperties || p.needId) {
755
+ if (this["_index_key"]) final_object["_index_key"] = this["_index_key"];
756
+ gotIndex = this.getIndex();
757
+ gotId = this.getID();
758
+ if (gotIndex && gotIndex >= 0) final_object["_index_value"] = gotIndex;
759
+ if (gotId) final_object["_id"] = gotId;
760
+ }
761
+ /* -------------------------------------------------------------------------- */
762
+ /* fix _user property */
763
+ /* -------------------------------------------------------------------------- */
764
+ if (final_object["_users"]) {
765
+ tempusers = final_object["_users"];
766
+ if (typeof tempusers === "string") tempusers = tempusers.split(",").filter(function (s) {
767
+ return s;
768
+ });
769
+ final_object["_users"] = (0, _object.wrap_array)(tempusers);
770
+ }
771
+ return _context13.abrupt("return", final_object);
772
+ case 42:
773
+ case "end":
774
+ return _context13.stop();
775
+ }
776
+ }, _callee13, this, [[21, 32, 35, 38]]);
777
+ }));
778
+ function get_deltaObject(_x5) {
779
+ return _get_deltaObject.apply(this, arguments);
780
+ }
781
+ return get_deltaObject;
782
+ }() /* --------------------------------- Getters -------------------------------- */)
783
+ }, {
784
+ key: "manager",
785
+ get: function get() {
786
+ return this.get_managerClass() || undefined;
787
+ }
788
+ }, {
789
+ key: "__web_path",
790
+ get: function get() {
791
+ return this.constructor["__web_path"] || this.__db_name;
792
+ }
793
+ }, {
794
+ key: "get_webpath",
795
+ value: function get_webpath() {
796
+ return this.__web_path || this.__db_name || "";
797
+ }
798
+ }, {
799
+ key: "onDelete",
800
+ value: ( /* -------------------------------------------------------------------------- */function () {
801
+ var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
802
+ var _this$manager;
803
+ var _len,
804
+ p,
805
+ _key2,
806
+ _args14 = arguments;
807
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
808
+ while (1) switch (_context14.prev = _context14.next) {
809
+ case 0:
810
+ if (this.isSaved) this.isDeleted = true;
811
+ for (_len = _args14.length, p = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
812
+ p[_key2] = _args14[_key2];
813
+ }
814
+ _context14.next = 4;
815
+ return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
816
+ case 4:
817
+ return _context14.abrupt("return", _context14.sent);
818
+ case 5:
819
+ case "end":
820
+ return _context14.stop();
821
+ }
822
+ }, _callee14, this);
823
+ }));
824
+ function onDelete() {
825
+ return _onDelete.apply(this, arguments);
826
+ }
827
+ return onDelete;
828
+ }())
829
+ }, {
830
+ key: "onArchive",
831
+ value: function () {
832
+ var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
833
+ var _this$manager2;
834
+ var _len2,
835
+ p,
836
+ _key3,
837
+ _args15 = arguments;
838
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
839
+ while (1) switch (_context15.prev = _context15.next) {
840
+ case 0:
841
+ if (this.isSaved) this.isArchived = true;
842
+ for (_len2 = _args15.length, p = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
843
+ p[_key3] = _args15[_key3];
844
+ }
845
+ _context15.next = 4;
846
+ return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onArchive.apply(_this$manager2, p);
847
+ case 4:
848
+ return _context15.abrupt("return", _context15.sent);
849
+ case 5:
850
+ case "end":
851
+ return _context15.stop();
852
+ }
853
+ }, _callee15, this);
854
+ }));
855
+ function onArchive() {
856
+ return _onArchive.apply(this, arguments);
857
+ }
858
+ return onArchive;
859
+ }()
860
+ }, {
861
+ key: "onUnArchive",
862
+ value: function () {
863
+ var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
864
+ var _this$manager3;
865
+ var _len3,
866
+ p,
867
+ _key4,
868
+ _args16 = arguments;
869
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
870
+ while (1) switch (_context16.prev = _context16.next) {
871
+ case 0:
872
+ if (this.isSaved) this.isArchived = false;
873
+ for (_len3 = _args16.length, p = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {
874
+ p[_key4] = _args16[_key4];
875
+ }
876
+ _context16.next = 4;
877
+ return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onUnArchive.apply(_this$manager3, p);
878
+ case 4:
879
+ return _context16.abrupt("return", _context16.sent);
880
+ case 5:
881
+ case "end":
882
+ return _context16.stop();
883
+ }
884
+ }, _callee16, this);
885
+ }));
886
+ function onUnArchive() {
887
+ return _onUnArchive.apply(this, arguments);
888
+ }
889
+ return onUnArchive;
890
+ }()
891
+ }, {
892
+ key: "onLock",
893
+ value: function () {
894
+ var _onLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
895
+ var _this$manager4;
896
+ var _len4,
897
+ p,
898
+ _key5,
899
+ _args17 = arguments;
900
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
901
+ while (1) switch (_context17.prev = _context17.next) {
902
+ case 0:
903
+ if (this.isSaved) this.isLocked = true;
904
+ for (_len4 = _args17.length, p = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
905
+ p[_key5] = _args17[_key5];
906
+ }
907
+ _context17.next = 4;
908
+ return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onLock.apply(_this$manager4, p);
909
+ case 4:
910
+ return _context17.abrupt("return", _context17.sent);
911
+ case 5:
912
+ case "end":
913
+ return _context17.stop();
914
+ }
915
+ }, _callee17, this);
916
+ }));
917
+ function onLock() {
918
+ return _onLock.apply(this, arguments);
919
+ }
920
+ return onLock;
921
+ }()
922
+ }, {
923
+ key: "onUnLock",
924
+ value: function () {
925
+ var _onUnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
926
+ var _this$manager5;
927
+ var _len5,
928
+ p,
929
+ _key6,
930
+ _args18 = arguments;
931
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
932
+ while (1) switch (_context18.prev = _context18.next) {
933
+ case 0:
934
+ if (this.isSaved) this.isLocked = false;
935
+ for (_len5 = _args18.length, p = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) {
936
+ p[_key6] = _args18[_key6];
937
+ }
938
+ _context18.next = 4;
939
+ return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onUnLock.apply(_this$manager5, p);
940
+ case 4:
941
+ return _context18.abrupt("return", _context18.sent);
942
+ case 5:
943
+ case "end":
944
+ return _context18.stop();
945
+ }
946
+ }, _callee18, this);
947
+ }));
948
+ function onUnLock() {
949
+ return _onUnLock.apply(this, arguments);
950
+ }
951
+ return onUnLock;
952
+ }()
953
+ }, {
954
+ key: "onLoad",
955
+ value: function () {
956
+ var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
957
+ var _this$manager6;
958
+ var _len6,
959
+ p,
960
+ _key7,
961
+ _args19 = arguments;
962
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
963
+ while (1) switch (_context19.prev = _context19.next) {
964
+ case 0:
965
+ this.isDeleted = false;
966
+ for (_len6 = _args19.length, p = new Array(_len6), _key7 = 0; _key7 < _len6; _key7++) {
967
+ p[_key7] = _args19[_key7];
968
+ }
969
+ _context19.next = 4;
970
+ return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onLoad.apply(_this$manager6, p);
971
+ case 4:
972
+ return _context19.abrupt("return", _context19.sent);
973
+ case 5:
974
+ case "end":
975
+ return _context19.stop();
976
+ }
977
+ }, _callee19, this);
978
+ }));
979
+ function onLoad() {
980
+ return _onLoad.apply(this, arguments);
981
+ }
982
+ return onLoad;
983
+ }()
984
+ }, {
985
+ key: "onSave",
986
+ value: function () {
987
+ var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
988
+ var _this$manager8;
989
+ var srObject,
990
+ _this$manager7,
991
+ _len7,
992
+ p,
993
+ _key8,
994
+ _args20 = arguments;
995
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
996
+ while (1) switch (_context20.prev = _context20.next) {
997
+ case 0:
998
+ if (!this.isSaved) {
999
+ _context20.next = 7;
1000
+ break;
1001
+ }
1002
+ this.apply_changes();
1003
+ srObject = this.getSaveResult(true);
1004
+ if (!this.saveResultHasID(srObject)) {
1005
+ _context20.next = 7;
1006
+ break;
1007
+ }
1008
+ /* -------------------------------------------------------------------------- */
1009
+ WebObject.LoadIdsFromSaveResult(this, srObject);
1010
+ _context20.next = 7;
1011
+ return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.event_run("on_id_change");
1012
+ case 7:
1013
+ for (_len7 = _args20.length, p = new Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {
1014
+ p[_key8] = _args20[_key8];
1015
+ }
1016
+ _context20.next = 10;
1017
+ return (_this$manager8 = this.manager) === null || _this$manager8 === void 0 ? void 0 : _this$manager8.onSave.apply(_this$manager8, p);
1018
+ case 10:
1019
+ _context20.next = 12;
1020
+ return this.onAfterSave();
1021
+ case 12:
1022
+ return _context20.abrupt("return", true);
1023
+ case 13:
1024
+ case "end":
1025
+ return _context20.stop();
1026
+ }
1027
+ }, _callee20, this);
1028
+ }));
1029
+ function onSave() {
1030
+ return _onSave.apply(this, arguments);
1031
+ }
1032
+ return onSave;
1033
+ }()
1034
+ }, {
1035
+ key: "onAfterSave",
1036
+ value: function () {
1037
+ var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1038
+ var _this$manager9;
1039
+ var _len8,
1040
+ p,
1041
+ _key9,
1042
+ _args21 = arguments;
1043
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1044
+ while (1) switch (_context21.prev = _context21.next) {
1045
+ case 0:
1046
+ for (_len8 = _args21.length, p = new Array(_len8), _key9 = 0; _key9 < _len8; _key9++) {
1047
+ p[_key9] = _args21[_key9];
1048
+ }
1049
+ _context21.next = 3;
1050
+ return (_this$manager9 = this.manager) === null || _this$manager9 === void 0 ? void 0 : _this$manager9.onAfterSave.apply(_this$manager9, p);
1051
+ case 3:
1052
+ return _context21.abrupt("return", true);
1053
+ case 4:
1054
+ case "end":
1055
+ return _context21.stop();
1056
+ }
1057
+ }, _callee21, this);
1058
+ }));
1059
+ function onAfterSave() {
1060
+ return _onAfterSave.apply(this, arguments);
1061
+ }
1062
+ return onAfterSave;
1063
+ }()
1064
+ }, {
1065
+ key: "getSaveResult",
1066
+ value: function getSaveResult() {
1067
+ var _this2 = this;
1068
+ var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1069
+ var srObject = _get(_getPrototypeOf(WebObject.prototype), "getSaveResult", this).call(this, original);
1070
+ if (!srObject) return false;
1071
+ if (Array.isArray(srObject)) {
1072
+ var actual_sr = srObject.find(function (s) {
1073
+ return _this2.saveResultHasID(s);
1074
+ });
1075
+ if (actual_sr) srObject = actual_sr;
1076
+ }
1077
+ return srObject;
1078
+ }
1079
+ }, {
1080
+ key: "onNew",
1081
+ value: function () {
1082
+ var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1083
+ var _this$manager10;
1084
+ var _len9,
1085
+ p,
1086
+ _key10,
1087
+ _args22 = arguments;
1088
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1089
+ while (1) switch (_context22.prev = _context22.next) {
1090
+ case 0:
1091
+ for (_len9 = _args22.length, p = new Array(_len9), _key10 = 0; _key10 < _len9; _key10++) {
1092
+ p[_key10] = _args22[_key10];
1093
+ }
1094
+ _context22.next = 3;
1095
+ return (_this$manager10 = this.manager) === null || _this$manager10 === void 0 ? void 0 : _this$manager10.onNew.apply(_this$manager10, p);
1096
+ case 3:
1097
+ return _context22.abrupt("return", _context22.sent);
1098
+ case 4:
1099
+ case "end":
1100
+ return _context22.stop();
1101
+ }
1102
+ }, _callee22, this);
1103
+ }));
1104
+ function onNew() {
1105
+ return _onNew.apply(this, arguments);
1106
+ }
1107
+ return onNew;
1108
+ }() /* -------------------------------------------------------------------------- */
1109
+ }, {
1110
+ key: "saveResultHasID",
1111
+ value: function saveResultHasID(s) {
1112
+ return WebObject.saveResultHasID(s);
1113
+ }
1114
+ }], [{
1115
+ key: "getAllUsers",
1116
+ value: function getAllUsers(obj) {
1117
+ if (_typeof(obj) != "object") return [];
1118
+ return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)).map(function (r) {
1119
+ return String(_typeof(r) === "object" ? WebObject.getID(r) : r);
1120
+ }).filter(function (s) {
1121
+ return s;
1122
+ }));
1123
+ }
1124
+ }, {
1125
+ key: "getMetaValue",
1126
+ value: function getMetaValue(o, key) {
1127
+ if (o == null) return null;
1128
+ if (!key || typeof key != "string") return undefined;
1129
+ var metalist = {};
1130
+ if (_typeof(o) === "object") {
1131
+ metalist = typeof o.get === "function" ? o.get("meta_data") : o.meta_data;
1132
+ }
1133
+ return metalist[key];
1134
+ }
1135
+ /* -------------------------------------------------------------------------- */
1136
+ /* Save */
1137
+ /* -------------------------------------------------------------------------- */
1138
+ }, {
1139
+ key: "zipSaveList",
1140
+ value: function zipSaveList(svlist) {
1141
+ if (_typeof(svlist) === "object") svlist = JSON.stringify(svlist);
1142
+ return (0, _string.string_compress)(svlist);
1143
+ }
1144
+ }, {
1145
+ key: "unzipSaveList",
1146
+ value: function unzipSaveList(svlist) {
1147
+ try {
1148
+ if (_typeof(svlist) === "object") {
1149
+ if (Array.isArray(svlist)) return svlist;
1150
+ if (svlist.__save_list) return this.unzipSaveList(svlist.__save_list);
1151
+ } else if (typeof svlist === "string") return (0, _object.wrap_array)(JSON.parse((0, _string.string_decompress)(svlist)));
1152
+ } catch (_unused) {}
1153
+ return (0, _object.wrap_array)(svlist);
1154
+ }
1155
+ }, {
1156
+ key: "saveList",
1157
+ value: function () {
1158
+ var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(itemList) {
1159
+ var _extraOptions$chunksi;
1160
+ var extraOptions,
1161
+ chunks,
1162
+ putAddress,
1163
+ index,
1164
+ items_to_save,
1165
+ save_array,
1166
+ k,
1167
+ item,
1168
+ dlt,
1169
+ resultObject,
1170
+ _index,
1171
+ res,
1172
+ _item,
1173
+ _index2,
1174
+ _item2,
1175
+ _args23 = arguments;
1176
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1177
+ while (1) switch (_context23.prev = _context23.next) {
1178
+ case 0:
1179
+ extraOptions = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {};
1180
+ if (!extraOptions) extraOptions = {};
1181
+ chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
1182
+ delete extraOptions.chunksize;
1183
+ putAddress = this.get_webpath();
1184
+ index = 0;
1185
+ case 6:
1186
+ if (!(index < chunks.length)) {
1187
+ _context23.next = 36;
1188
+ break;
1189
+ }
1190
+ items_to_save = chunks[index];
1191
+ save_array = [];
1192
+ k = 0;
1193
+ case 10:
1194
+ if (!(k < items_to_save.length)) {
1195
+ _context23.next = 19;
1196
+ break;
1197
+ }
1198
+ item = items_to_save[k];
1199
+ _context23.next = 14;
1200
+ return item.get_deltaObject();
1201
+ case 14:
1202
+ dlt = _context23.sent;
1203
+ save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
1204
+ _id: item.getID()
1205
+ }, dlt));
1206
+ case 16:
1207
+ k++;
1208
+ _context23.next = 10;
1209
+ break;
1210
+ case 19:
1211
+ _context23.next = 21;
1212
+ return _global.gfunc.run_action("post", putAddress, _objectSpread({
1213
+ __save_list: WebObject.zipSaveList(save_array)
1214
+ }, extraOptions));
1215
+ case 21:
1216
+ resultObject = _context23.sent;
1217
+ if (!Array.isArray(resultObject)) {
1218
+ _context23.next = 33;
1219
+ break;
1220
+ }
1221
+ _index = 0;
1222
+ case 24:
1223
+ if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
1224
+ _context23.next = 33;
1225
+ break;
1226
+ }
1227
+ res = resultObject[_index];
1228
+ _item = items_to_save[_index];
1229
+ _item.setSaveResult(res);
1230
+ _context23.next = 30;
1231
+ return _item.onSave();
1232
+ case 30:
1233
+ _index++;
1234
+ _context23.next = 24;
1235
+ break;
1236
+ case 33:
1237
+ index++;
1238
+ _context23.next = 6;
1239
+ break;
1240
+ case 36:
1241
+ _index2 = 0;
1242
+ case 37:
1243
+ if (!(_index2 < itemList.length)) {
1244
+ _context23.next = 46;
1245
+ break;
1246
+ }
1247
+ _item2 = itemList[_index2];
1248
+ if (_item2.isSaved) {
1249
+ _context23.next = 41;
1250
+ break;
1251
+ }
1252
+ return _context23.abrupt("return", false);
1253
+ case 41:
1254
+ if (!(_item2.getSaveResultType() != "normal")) {
1255
+ _context23.next = 43;
1256
+ break;
1257
+ }
1258
+ return _context23.abrupt("return", false);
1259
+ case 43:
1260
+ _index2++;
1261
+ _context23.next = 37;
1262
+ break;
1263
+ case 46:
1264
+ return _context23.abrupt("return", true);
1265
+ case 47:
1266
+ case "end":
1267
+ return _context23.stop();
1268
+ }
1269
+ }, _callee23, this);
1270
+ }));
1271
+ function saveList(_x8) {
1272
+ return _saveList.apply(this, arguments);
1273
+ }
1274
+ return saveList;
1275
+ }()
1276
+ }, {
1277
+ key: "get_webpath",
1278
+ value: function get_webpath() {
1279
+ return this.__web_path || this.__db_name || "";
1280
+ }
1281
+ }, {
1282
+ key: "get_dbname",
1283
+ value: function get_dbname() {
1284
+ return this.__db_name || this.__web_path || "";
1285
+ }
1286
+ }, {
1287
+ key: "saveResultHasID",
1288
+ value: function saveResultHasID(s) {
1289
+ if (_typeof(s) !== "object" || s == null || !s) return false;
1290
+ return s.insertedId || s._id || s._index_value && !Number.isNaN(s._index_value);
1291
+ }
518
1292
  /**
519
1293
  * Load Id and _index_value from the given save result into our object
520
1294
  * @param o
521
1295
  * @param srObject
522
1296
  * @returns
523
- */
524
- static LoadIdsFromSaveResult(o, srObject) {
525
- if (typeof o !== "object" || typeof srObject !== "object")
526
- return;
527
- /* -------------------------------------------------------------------------- */
528
- const srID = srObject.insertedId || srObject._id || WebObject.getID(srObject);
529
- if (srID) {
530
- o._id = srID;
531
- }
532
- /* -------------------------------------------------------------------------- */
533
- if (srObject._index_value && !Number.isNaN(srObject._index_value)) {
534
- o._index_value = Number(srObject._index_value);
535
- }
536
- /* -------------------------------------------------------------------------- */
537
- if (srObject._index_key) {
538
- o._index_key = srObject._index_key;
539
- }
540
- }
541
- /* -------------------------------------------------------------------------- */
1297
+ */
1298
+ }, {
1299
+ key: "LoadIdsFromSaveResult",
1300
+ value: function LoadIdsFromSaveResult(o, srObject) {
1301
+ if (_typeof(o) !== "object" || _typeof(srObject) !== "object") return;
1302
+ /* -------------------------------------------------------------------------- */
1303
+ var srID = srObject.insertedId || srObject._id || WebObject.getID(srObject);
1304
+ if (srID) {
1305
+ o._id = srID;
1306
+ }
1307
+ /* -------------------------------------------------------------------------- */
1308
+ if (srObject._index_value && !Number.isNaN(srObject._index_value)) {
1309
+ o._index_value = Number(srObject._index_value);
1310
+ }
1311
+ /* -------------------------------------------------------------------------- */
1312
+ if (srObject._index_key) {
1313
+ o._index_key = srObject._index_key;
1314
+ }
1315
+ }
1316
+ /* -------------------------------------------------------------------------- */
542
1317
  /**
543
1318
  * get a single web object
544
1319
  * default order of parameters : search,readonly,fetchID
545
- */
546
- static async get_single(...p) {
547
- let search = p.shift();
548
- let readonly = p.shift() ?? false;
549
- let fetchID = p.shift();
550
- if (object_isEmpty(search))
551
- return undefined;
552
- let res;
553
- const params = {};
554
- params.__context = readonly ? "view" : "edit";
555
- switch (typeof search) {
556
- case "string":
557
- case "number":
558
- search = String(search);
559
- // const usepath =
560
- // (await WebObjectPathHelper.get_path(this, "get")) +
561
- // "/" +
562
- // search;
563
- // res = await gfunc.run_action("get", usepath, params, {
564
- // fetchID: fetchID,
565
- // });
566
- res = await this.get_list({ __searchid: search }, readonly, fetchID);
567
- break;
568
- case "object":
569
- default:
570
- res = await this.get_list(search, readonly, fetchID);
571
- break;
572
- }
573
- if (res)
574
- res = array_first(res);
575
- if (!object_isEmpty(res)) {
576
- res = this.ensure(this, res);
577
- WebObject.setReadonly(res, readonly);
578
- }
579
- return res;
580
- }
1320
+ */
1321
+ }, {
1322
+ key: "get_single",
1323
+ value: (function () {
1324
+ var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1325
+ var _p$shift;
1326
+ var _len10,
1327
+ p,
1328
+ _key11,
1329
+ search,
1330
+ readonly,
1331
+ fetchID,
1332
+ result,
1333
+ params,
1334
+ _args24 = arguments;
1335
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1336
+ while (1) switch (_context24.prev = _context24.next) {
1337
+ case 0:
1338
+ for (_len10 = _args24.length, p = new Array(_len10), _key11 = 0; _key11 < _len10; _key11++) {
1339
+ p[_key11] = _args24[_key11];
1340
+ }
1341
+ search = p.shift();
1342
+ readonly = (_p$shift = p.shift()) !== null && _p$shift !== void 0 ? _p$shift : false;
1343
+ fetchID = p.shift();
1344
+ if (!(0, _object.object_isEmpty)(search)) {
1345
+ _context24.next = 6;
1346
+ break;
1347
+ }
1348
+ return _context24.abrupt("return", undefined);
1349
+ case 6:
1350
+ params = {};
1351
+ params.__context = readonly ? "view" : "edit";
1352
+ _context24.t0 = _typeof(search);
1353
+ _context24.next = _context24.t0 === "string" ? 11 : _context24.t0 === "number" ? 11 : _context24.t0 === "object" ? 16 : 16;
1354
+ break;
1355
+ case 11:
1356
+ search = String(search);
1357
+ // const usepath =
1358
+ // (await WebObjectPathHelper.get_path(this, "get")) +
1359
+ // "/" +
1360
+ // search;
1361
+ // res = await gfunc.run_action("get", usepath, params, {
1362
+ // fetchID: fetchID,
1363
+ // });
1364
+ _context24.next = 14;
1365
+ return this.get_list({
1366
+ __searchid: search
1367
+ }, readonly, fetchID);
1368
+ case 14:
1369
+ result = _context24.sent;
1370
+ return _context24.abrupt("break", 20);
1371
+ case 16:
1372
+ _context24.next = 18;
1373
+ return this.get_list(search, readonly, fetchID);
1374
+ case 18:
1375
+ result = _context24.sent;
1376
+ return _context24.abrupt("break", 20);
1377
+ case 20:
1378
+ if (result) result = (0, _object.array_first)(result);
1379
+ if (!(0, _object.object_isEmpty)(result)) {
1380
+ result = this.ensure(this, result);
1381
+ WebObject.setReadonly(result, readonly);
1382
+ }
1383
+ return _context24.abrupt("return", result);
1384
+ case 23:
1385
+ case "end":
1386
+ return _context24.stop();
1387
+ }
1388
+ }, _callee24, this);
1389
+ }));
1390
+ function get_single() {
1391
+ return _get_single.apply(this, arguments);
1392
+ }
1393
+ return get_single;
1394
+ }()
581
1395
  /**
582
1396
  * Get a list of web objects
583
1397
  * default order of parameters : search,readonly,fetchID
584
- */
585
- static async get_list(...p) {
586
- let search = p.shift();
587
- let readonly = p.shift() ?? false;
588
- let fetchID = p.shift();
589
- if (!search)
590
- search = {};
591
- const usepath = await WebObjectPathHelper.get_path(this, "get");
592
- let result_items = await gfunc.run_action("get", usepath, search, { fetchID: fetchID });
593
- // const selftype = (this.constructor ||
594
- // Object.getPrototypeOf(this)) as any;
595
- const res = WebObject.map_rowindex(WebObject.mapto(this, result_items, readonly));
596
- WebObject.setReadonly(res, readonly);
597
- return res;
598
- }
1398
+ */
1399
+ )
1400
+ }, {
1401
+ key: "get_list",
1402
+ value: (function () {
1403
+ var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1404
+ var _p$shift2;
1405
+ var _len11,
1406
+ p,
1407
+ _key12,
1408
+ search,
1409
+ readonly,
1410
+ fetchID,
1411
+ usepath,
1412
+ result_items,
1413
+ res,
1414
+ _args25 = arguments;
1415
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1416
+ while (1) switch (_context25.prev = _context25.next) {
1417
+ case 0:
1418
+ for (_len11 = _args25.length, p = new Array(_len11), _key12 = 0; _key12 < _len11; _key12++) {
1419
+ p[_key12] = _args25[_key12];
1420
+ }
1421
+ search = p.shift();
1422
+ readonly = (_p$shift2 = p.shift()) !== null && _p$shift2 !== void 0 ? _p$shift2 : false;
1423
+ fetchID = p.shift();
1424
+ if (!search) search = {};
1425
+ _context25.next = 7;
1426
+ return _WebObjectPathHelper["default"].get_path(this, "get");
1427
+ case 7:
1428
+ usepath = _context25.sent;
1429
+ _context25.next = 10;
1430
+ return _global.gfunc.run_action("get", usepath, search, {
1431
+ fetchID: fetchID
1432
+ });
1433
+ case 10:
1434
+ result_items = _context25.sent;
1435
+ // const selftype = (this.constructor ||
1436
+ // Object.getPrototypeOf(this)) as any;
1437
+ res = WebObject.map_rowindex(WebObject.mapto(this, result_items, readonly));
1438
+ WebObject.setReadonly(res, readonly);
1439
+ return _context25.abrupt("return", res);
1440
+ case 14:
1441
+ case "end":
1442
+ return _context25.stop();
1443
+ }
1444
+ }, _callee25, this);
1445
+ }));
1446
+ function get_list() {
1447
+ return _get_list.apply(this, arguments);
1448
+ }
1449
+ return get_list;
1450
+ }()
599
1451
  /**
600
1452
  * uses `get_list` and then saves the result to `gcache`
601
1453
  * then uses the `equals` function to return matched results
602
1454
  * @param search
603
1455
  * @returns
604
- */
605
- static async get_list_cache(search) {
606
- const all_data = await gcache.get_temp_cache(this.get_webpath(), async () => await this.get_list());
607
- if (!search)
608
- return all_data;
609
- return all_data.filter((s) => this.equals(s, search));
610
- }
1456
+ */
1457
+ )
1458
+ }, {
1459
+ key: "get_list_cache",
1460
+ value: (function () {
1461
+ var _get_list_cache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(search) {
1462
+ var _this3 = this;
1463
+ var all_data;
1464
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1465
+ while (1) switch (_context27.prev = _context27.next) {
1466
+ case 0:
1467
+ _context27.next = 2;
1468
+ return _global.gcache.get_temp_cache(this.get_webpath(), /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1469
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1470
+ while (1) switch (_context26.prev = _context26.next) {
1471
+ case 0:
1472
+ _context26.next = 2;
1473
+ return _this3.get_list();
1474
+ case 2:
1475
+ return _context26.abrupt("return", _context26.sent);
1476
+ case 3:
1477
+ case "end":
1478
+ return _context26.stop();
1479
+ }
1480
+ }, _callee26);
1481
+ })));
1482
+ case 2:
1483
+ all_data = _context27.sent;
1484
+ if (search) {
1485
+ _context27.next = 5;
1486
+ break;
1487
+ }
1488
+ return _context27.abrupt("return", all_data);
1489
+ case 5:
1490
+ return _context27.abrupt("return", all_data.filter(function (s) {
1491
+ return _this3.equals(s, search);
1492
+ }));
1493
+ case 6:
1494
+ case "end":
1495
+ return _context27.stop();
1496
+ }
1497
+ }, _callee27, this);
1498
+ }));
1499
+ function get_list_cache(_x9) {
1500
+ return _get_list_cache.apply(this, arguments);
1501
+ }
1502
+ return get_list_cache;
1503
+ }()
611
1504
  /**
612
- * uses `get_list_cache` then uses the `equals` function to return matched result
1505
+ * uses `get_list_cache` then the `equals` function to return matched result
613
1506
  * @param search
614
1507
  * @returns
615
- */
616
- static async get_single_cache(search) {
617
- return (await this.get_list_cache()).find((s) => this.equals(s, search));
618
- }
1508
+ */
1509
+ )
1510
+ }, {
1511
+ key: "get_single_cache",
1512
+ value: (function () {
1513
+ var _get_single_cache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(search) {
1514
+ var _this4 = this;
1515
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1516
+ while (1) switch (_context28.prev = _context28.next) {
1517
+ case 0:
1518
+ _context28.next = 2;
1519
+ return this.get_list_cache();
1520
+ case 2:
1521
+ return _context28.abrupt("return", _context28.sent.find(function (s) {
1522
+ return _this4.equals(s, search);
1523
+ }));
1524
+ case 3:
1525
+ case "end":
1526
+ return _context28.stop();
1527
+ }
1528
+ }, _callee28, this);
1529
+ }));
1530
+ function get_single_cache(_x10) {
1531
+ return _get_single_cache.apply(this, arguments);
1532
+ }
1533
+ return get_single_cache;
1534
+ }()
619
1535
  /**
620
1536
  * Get a list of web objects and convert them to basic objects
621
1537
  * can be passed to client components
622
1538
  * default order of parameters : search,readonly,fetchID
623
- */
624
- static async get_basicList(...p) {
625
- const itemlist = await this.get_list(...p);
626
- return await Promise.all(itemlist.map(async (r) => await r.get_basicObject()));
627
- }
628
- }
629
- export default WebObject;
1539
+ */
1540
+ )
1541
+ }, {
1542
+ key: "get_basicList",
1543
+ value: (function () {
1544
+ var _get_basicList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
1545
+ var itemlist,
1546
+ _args30 = arguments;
1547
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1548
+ while (1) switch (_context30.prev = _context30.next) {
1549
+ case 0:
1550
+ _context30.next = 2;
1551
+ return this.get_list.apply(this, _args30);
1552
+ case 2:
1553
+ itemlist = _context30.sent;
1554
+ _context30.next = 5;
1555
+ return Promise.all(itemlist.map( /*#__PURE__*/function () {
1556
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(r) {
1557
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1558
+ while (1) switch (_context29.prev = _context29.next) {
1559
+ case 0:
1560
+ _context29.next = 2;
1561
+ return r.get_basicObject();
1562
+ case 2:
1563
+ return _context29.abrupt("return", _context29.sent);
1564
+ case 3:
1565
+ case "end":
1566
+ return _context29.stop();
1567
+ }
1568
+ }, _callee29);
1569
+ }));
1570
+ return function (_x11) {
1571
+ return _ref3.apply(this, arguments);
1572
+ };
1573
+ }()));
1574
+ case 5:
1575
+ return _context30.abrupt("return", _context30.sent);
1576
+ case 6:
1577
+ case "end":
1578
+ return _context30.stop();
1579
+ }
1580
+ }, _callee30, this);
1581
+ }));
1582
+ function get_basicList() {
1583
+ return _get_basicList.apply(this, arguments);
1584
+ }
1585
+ return get_basicList;
1586
+ }())
1587
+ }]);
1588
+ }(_index3.SimpleObject);
1589
+ _defineProperty(WebObject, "__web_path", "");
1590
+ _defineProperty(WebObject, "__protectedProperties", ["_users"]);
1591
+ //you cant create a new weboject without these properties
1592
+ _defineProperty(WebObject, "__requiredProperties", []);
1593
+ var _default = exports["default"] = WebObject;