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