@azrico/webobject 1.4.67 → 1.4.69
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,11 +1,12 @@
|
|
|
1
1
|
import SimpleObject, { sendChangesType } from "../structs/SimpleObject";
|
|
2
|
-
import {
|
|
2
|
+
import { WebObjectManager } from "../index";
|
|
3
3
|
export type deltaParams = {
|
|
4
4
|
type?: string;
|
|
5
5
|
isChild?: boolean;
|
|
6
6
|
useDelta?: boolean;
|
|
7
7
|
allProperties?: boolean;
|
|
8
8
|
extraProperties?: boolean;
|
|
9
|
+
needId?: boolean;
|
|
9
10
|
applyFilter?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare class WebObject extends SimpleObject {
|
|
@@ -13,7 +14,9 @@ export declare class WebObject extends SimpleObject {
|
|
|
13
14
|
static readonly __web_type: string;
|
|
14
15
|
static readonly __protectedProperties: string[];
|
|
15
16
|
static readonly __requiredProperties: never[];
|
|
16
|
-
meta_data:
|
|
17
|
+
meta_data: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
17
20
|
_id: string;
|
|
18
21
|
_created_date?: string | Date;
|
|
19
22
|
_creator?: string;
|
|
@@ -39,33 +42,20 @@ export declare class WebObject extends SimpleObject {
|
|
|
39
42
|
* @param sendChange
|
|
40
43
|
* @returns
|
|
41
44
|
*/
|
|
42
|
-
setMetaValue(key: string, value: any,
|
|
43
|
-
/**
|
|
44
|
-
* Get meta object by key
|
|
45
|
-
* @param key
|
|
46
|
-
* @returns meta object
|
|
47
|
-
*/
|
|
48
|
-
getMeta(key: string): any;
|
|
45
|
+
setMetaValue(key: string, value: any, sendChange?: sendChangesType): boolean;
|
|
49
46
|
/**
|
|
50
47
|
* Get meta value by key
|
|
51
48
|
* @param key
|
|
52
49
|
* @returns value or undefined
|
|
53
50
|
*/
|
|
54
51
|
getMetaValue(key: string): any;
|
|
55
|
-
/**
|
|
56
|
-
* Get meta object by key
|
|
57
|
-
* @param o
|
|
58
|
-
* @param key
|
|
59
|
-
* @returns meta object
|
|
60
|
-
*/
|
|
61
|
-
static getMeta(o: WebObject | null | undefined, key: string): any;
|
|
62
52
|
/**
|
|
63
53
|
* Get meta value by key
|
|
64
54
|
* @param o
|
|
65
55
|
* @param key
|
|
66
56
|
* @returns value or undefined
|
|
67
57
|
*/
|
|
68
|
-
static getMetaValue(o: WebObject | null | undefined, key: string): any;
|
|
58
|
+
static getMetaValue(o: WebObject | null | undefined, key: string): any | undefined;
|
|
69
59
|
static zipSaveList(svlist: any): string;
|
|
70
60
|
static unzipSaveList(svlist: any): any[];
|
|
71
61
|
static saveList(itemList: WebObject[], extraOptions?: {
|
|
@@ -14,11 +14,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
14
14
|
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; } } }; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
17
|
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 new 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 new 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 new 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
18
|
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); } }
|
|
21
19
|
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); }); }; }
|
|
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
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
23
|
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); } }
|
|
24
24
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -55,7 +55,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
55
55
|
_defineProperty(_assertThisInitialized(_this), "get_webpath", function () {
|
|
56
56
|
return _this.__web_path;
|
|
57
57
|
});
|
|
58
|
-
_this.meta_data =
|
|
58
|
+
_this.meta_data = {};
|
|
59
59
|
return _this;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -87,8 +87,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
87
87
|
* @returns
|
|
88
88
|
*/
|
|
89
89
|
function setMetaValue(key, value) {
|
|
90
|
-
var
|
|
91
|
-
var sendChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
90
|
+
var sendChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "auto";
|
|
92
91
|
if (!this.canModify) {
|
|
93
92
|
if (this.__throw_errors !== false) throw Error("Cant use setMetaValue on ".concat(key, " when on readonly mode"));else return false;
|
|
94
93
|
}
|
|
@@ -97,24 +96,12 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
97
96
|
}
|
|
98
97
|
var old_value = WebObject.getMetaValue(this, key);
|
|
99
98
|
if ((0, _object.object_equals)(old_value, value)) return false; //same value, no changes
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
var new_metalist = (0, _object.setInArray)(old_metalist, "key", key, "value", value, createIfNotExists);
|
|
99
|
+
var new_metalist = _objectSpread({}, this.getValue("meta_data"));
|
|
100
|
+
new_metalist[key] = value;
|
|
104
101
|
this.setValue("meta_data", new_metalist);
|
|
105
102
|
if (sendChange !== false) this.notifyChanged("meta", key, value);
|
|
106
103
|
return true;
|
|
107
104
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Get meta object by key
|
|
110
|
-
* @param key
|
|
111
|
-
* @returns meta object
|
|
112
|
-
*/
|
|
113
|
-
}, {
|
|
114
|
-
key: "getMeta",
|
|
115
|
-
value: function getMeta(key) {
|
|
116
|
-
return WebObject.getMeta(this, key);
|
|
117
|
-
}
|
|
118
105
|
/**
|
|
119
106
|
* Get meta value by key
|
|
120
107
|
* @param key
|
|
@@ -126,10 +113,10 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
126
113
|
return WebObject.getMetaValue(this, key);
|
|
127
114
|
}
|
|
128
115
|
/**
|
|
129
|
-
* Get meta
|
|
116
|
+
* Get meta value by key
|
|
130
117
|
* @param o
|
|
131
118
|
* @param key
|
|
132
|
-
* @returns
|
|
119
|
+
* @returns value or undefined
|
|
133
120
|
*/
|
|
134
121
|
}, {
|
|
135
122
|
key: "Save",
|
|
@@ -200,7 +187,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
200
187
|
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(p) {
|
|
201
188
|
var _this2 = this,
|
|
202
189
|
_parseObj;
|
|
203
|
-
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _iterator, _step, key, tempusers;
|
|
190
|
+
var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _iterator, _step, key, tempusers;
|
|
204
191
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
205
192
|
while (1) switch (_context5.prev = _context5.next) {
|
|
206
193
|
case 0:
|
|
@@ -271,7 +258,8 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
271
258
|
final_object = {}; //@ts-ignore
|
|
272
259
|
isChild = Boolean(p.isChild || p.ischild); //@ts-ignore
|
|
273
260
|
useDelta = this.__use_delta || Boolean(p.useDelta || p.usedelta); //@ts-ignore
|
|
274
|
-
allProperties = Boolean(p.allProperties || p.allproperties);
|
|
261
|
+
allProperties = Boolean(p.allProperties || p.allproperties); //@ts-ignore
|
|
262
|
+
needId = Boolean(p.needId || p.needid);
|
|
275
263
|
chkChangables = this.__changeables != null || this.__unchangeables != null;
|
|
276
264
|
useExtraProps = Boolean(p.extraProperties); //child objects usually dont update their __delta, so we read info from all of its properties
|
|
277
265
|
dlt = allProperties || !useDelta && isChild && chkChangables ? _objectSpread({}, this.allproperties) : _objectSpread({}, this.__delta);
|
|
@@ -282,13 +270,13 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
282
270
|
ignoreProtected: allProperties
|
|
283
271
|
});
|
|
284
272
|
}) : allkeys;
|
|
285
|
-
_context5.next =
|
|
273
|
+
_context5.next = 14;
|
|
286
274
|
return _convert["default"].applyFormats({
|
|
287
275
|
inputobject: dlt,
|
|
288
276
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
289
277
|
changableKeys: changableKeys
|
|
290
278
|
});
|
|
291
|
-
case
|
|
279
|
+
case 14:
|
|
292
280
|
/* -------------------------------------------------------------------------- */
|
|
293
281
|
/* __functionProperties */
|
|
294
282
|
/* -------------------------------------------------------------------------- */
|
|
@@ -303,42 +291,44 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
303
291
|
/* parse all changableKeys */
|
|
304
292
|
/* -------------------------------------------------------------------------- */
|
|
305
293
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
306
|
-
_context5.prev =
|
|
294
|
+
_context5.prev = 17;
|
|
307
295
|
_iterator.s();
|
|
308
|
-
case
|
|
296
|
+
case 19:
|
|
309
297
|
if ((_step = _iterator.n()).done) {
|
|
310
|
-
_context5.next =
|
|
298
|
+
_context5.next = 26;
|
|
311
299
|
break;
|
|
312
300
|
}
|
|
313
301
|
key = _step.value;
|
|
314
|
-
_context5.next =
|
|
302
|
+
_context5.next = 23;
|
|
315
303
|
return parseObj(dlt[key]);
|
|
316
|
-
case 22:
|
|
317
|
-
final_object[key] = _context5.sent;
|
|
318
304
|
case 23:
|
|
319
|
-
|
|
305
|
+
final_object[key] = _context5.sent;
|
|
306
|
+
case 24:
|
|
307
|
+
_context5.next = 19;
|
|
320
308
|
break;
|
|
321
|
-
case
|
|
322
|
-
_context5.next =
|
|
309
|
+
case 26:
|
|
310
|
+
_context5.next = 31;
|
|
323
311
|
break;
|
|
324
|
-
case
|
|
325
|
-
_context5.prev =
|
|
326
|
-
_context5.t0 = _context5["catch"](
|
|
312
|
+
case 28:
|
|
313
|
+
_context5.prev = 28;
|
|
314
|
+
_context5.t0 = _context5["catch"](17);
|
|
327
315
|
_iterator.e(_context5.t0);
|
|
328
|
-
case
|
|
329
|
-
_context5.prev =
|
|
316
|
+
case 31:
|
|
317
|
+
_context5.prev = 31;
|
|
330
318
|
_iterator.f();
|
|
331
|
-
return _context5.finish(
|
|
332
|
-
case
|
|
319
|
+
return _context5.finish(31);
|
|
320
|
+
case 34:
|
|
333
321
|
/* -------------------------------------------------------------------------- */
|
|
334
322
|
/* add id properties */
|
|
335
323
|
/* -------------------------------------------------------------------------- */
|
|
336
324
|
if (allProperties) {
|
|
337
|
-
final_object["_id"] = this.getID();
|
|
338
|
-
final_object["_index_key"] = this["_index_key"];
|
|
339
|
-
final_object["_index_value"] = this.getIndex();
|
|
340
325
|
final_object["_created_date"] = this["_created_date"];
|
|
341
326
|
}
|
|
327
|
+
if (allProperties || needId) {
|
|
328
|
+
if (this["_index_key"]) final_object["_index_key"] = this["_index_key"];
|
|
329
|
+
if (this.getIndex()) final_object["_index_value"] = this.getIndex();
|
|
330
|
+
if (this.getID()) final_object["_id"] = this.getID();
|
|
331
|
+
}
|
|
342
332
|
/* -------------------------------------------------------------------------- */
|
|
343
333
|
/* fix _user property */
|
|
344
334
|
/* -------------------------------------------------------------------------- */
|
|
@@ -350,11 +340,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
350
340
|
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
351
341
|
}
|
|
352
342
|
return _context5.abrupt("return", final_object);
|
|
353
|
-
case
|
|
343
|
+
case 38:
|
|
354
344
|
case "end":
|
|
355
345
|
return _context5.stop();
|
|
356
346
|
}
|
|
357
|
-
}, _callee5, this, [[
|
|
347
|
+
}, _callee5, this, [[17, 28, 31, 34]]);
|
|
358
348
|
}))).apply(this, arguments);
|
|
359
349
|
} /* --------------------------------- Getters -------------------------------- */
|
|
360
350
|
}, {
|
|
@@ -551,27 +541,15 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _Save, _Delete, _get_delta
|
|
|
551
541
|
return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)));
|
|
552
542
|
}
|
|
553
543
|
}, {
|
|
554
|
-
key: "
|
|
555
|
-
value: function
|
|
544
|
+
key: "getMetaValue",
|
|
545
|
+
value: function getMetaValue(o, key) {
|
|
556
546
|
if (o == null) return null;
|
|
557
547
|
if (!key || typeof key != "string") return undefined;
|
|
558
|
-
var metalist =
|
|
548
|
+
var metalist = {};
|
|
559
549
|
if (_typeof(o) === "object") {
|
|
560
550
|
metalist = typeof o.getValue === "function" ? o.getValue("meta_data") : o.meta_data;
|
|
561
551
|
}
|
|
562
|
-
return
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Get meta value by key
|
|
566
|
-
* @param o
|
|
567
|
-
* @param key
|
|
568
|
-
* @returns value or undefined
|
|
569
|
-
*/
|
|
570
|
-
}, {
|
|
571
|
-
key: "getMetaValue",
|
|
572
|
-
value: function getMetaValue(o, key) {
|
|
573
|
-
var _WebObject$getMeta;
|
|
574
|
-
return (_WebObject$getMeta = WebObject.getMeta(o, key)) === null || _WebObject$getMeta === void 0 ? void 0 : _WebObject$getMeta.value;
|
|
552
|
+
return metalist[key];
|
|
575
553
|
}
|
|
576
554
|
/* -------------------------------------------------------------------------- */
|
|
577
555
|
/* Save */
|
|
@@ -17,8 +17,7 @@ export declare class WebObjectManager<T extends WebObject> extends ObjectManager
|
|
|
17
17
|
* @param sendChange
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
setMetaValue(key: string, value: any,
|
|
21
|
-
getMeta(key: string): any;
|
|
20
|
+
setMetaValue(key: string, value: any, sendChange?: sendChangesType): boolean | undefined;
|
|
22
21
|
getMetaValue(key: string): any;
|
|
23
22
|
get_deltaObject(): Promise<any>;
|
|
24
23
|
Save(): Promise<boolean>;
|
|
@@ -92,33 +92,26 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
92
92
|
key: "setMetaValue",
|
|
93
93
|
value: function setMetaValue(key, value) {
|
|
94
94
|
var _this$obj;
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
return (_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.setMetaValue(key, value, createIfNotExists, sendChange);
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
key: "getMeta",
|
|
101
|
-
value: function getMeta(key) {
|
|
102
|
-
var _this$obj2;
|
|
103
|
-
return (_this$obj2 = this.obj) === null || _this$obj2 === void 0 ? void 0 : _this$obj2.getMeta(key);
|
|
95
|
+
var sendChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "auto";
|
|
96
|
+
return (_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.setMetaValue(key, value, sendChange);
|
|
104
97
|
}
|
|
105
98
|
}, {
|
|
106
99
|
key: "getMetaValue",
|
|
107
100
|
value: function getMetaValue(key) {
|
|
108
|
-
var _this$
|
|
109
|
-
return (_this$
|
|
101
|
+
var _this$obj2;
|
|
102
|
+
return (_this$obj2 = this.obj) === null || _this$obj2 === void 0 ? void 0 : _this$obj2.getMetaValue(key);
|
|
110
103
|
}
|
|
111
104
|
/* -------------------------------------------------------------------------- */
|
|
112
105
|
}, {
|
|
113
106
|
key: "get_deltaObject",
|
|
114
107
|
value: function get_deltaObject() {
|
|
115
108
|
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
116
|
-
var _this$
|
|
109
|
+
var _this$obj3;
|
|
117
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
118
111
|
while (1) switch (_context2.prev = _context2.next) {
|
|
119
112
|
case 0:
|
|
120
113
|
_context2.next = 2;
|
|
121
|
-
return (_this$
|
|
114
|
+
return (_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.get_deltaObject();
|
|
122
115
|
case 2:
|
|
123
116
|
_context2.t0 = _context2.sent;
|
|
124
117
|
if (_context2.t0) {
|
|
@@ -139,12 +132,12 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
139
132
|
key: "Save",
|
|
140
133
|
value: function Save() {
|
|
141
134
|
return (_Save = _Save || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
142
|
-
var _this$
|
|
135
|
+
var _this$obj4;
|
|
143
136
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
144
137
|
while (1) switch (_context3.prev = _context3.next) {
|
|
145
138
|
case 0:
|
|
146
139
|
_context3.next = 2;
|
|
147
|
-
return (_this$
|
|
140
|
+
return (_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.Save();
|
|
148
141
|
case 2:
|
|
149
142
|
_context3.t0 = _context3.sent;
|
|
150
143
|
if (_context3.t0) {
|
|
@@ -182,14 +175,14 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
182
175
|
}, {
|
|
183
176
|
key: "__web_path",
|
|
184
177
|
get: function get() {
|
|
185
|
-
var _this$
|
|
186
|
-
return ((_this$
|
|
178
|
+
var _this$obj5;
|
|
179
|
+
return ((_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.__web_path) || this.constructor["__web_path"] || "";
|
|
187
180
|
}
|
|
188
181
|
}, {
|
|
189
182
|
key: "__web_type",
|
|
190
183
|
get: function get() {
|
|
191
|
-
var _this$
|
|
192
|
-
return ((_this$
|
|
184
|
+
var _this$obj6;
|
|
185
|
+
return ((_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.__web_type) || this.constructor["__web_type"] || "";
|
|
193
186
|
}
|
|
194
187
|
}, {
|
|
195
188
|
key: "get_webname",
|
|
@@ -208,12 +201,12 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
208
201
|
key: "onNew",
|
|
209
202
|
value: function onNew() {
|
|
210
203
|
return (_onNew = _onNew || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
211
|
-
var _this$
|
|
204
|
+
var _this$obj7;
|
|
212
205
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
213
206
|
while (1) switch (_context5.prev = _context5.next) {
|
|
214
207
|
case 0:
|
|
215
208
|
if (this.canModify) {
|
|
216
|
-
(_this$
|
|
209
|
+
(_this$obj7 = this.obj) === null || _this$obj7 === void 0 || _this$obj7.setOriginal();
|
|
217
210
|
}
|
|
218
211
|
_context5.next = 3;
|
|
219
212
|
return this.event_run("on_new");
|