@azrico/webobject 1.4.161 → 1.4.162
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 -122
- package/dist/src/WebObjects/WebObject.d.ts +0 -120
- package/dist/src/WebObjects/WebObject.js +0 -1319
- package/dist/src/WebObjects/WebObjectManager.d.ts +0 -65
- package/dist/src/WebObjects/WebObjectManager.js +0 -807
- package/dist/src/WebObjects/WebObjectPathHelper.d.ts +0 -36
- package/dist/src/WebObjects/WebObjectPathHelper.js +0 -156
- 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 -124
- package/dist/src/structs/MetaObject.d.ts +0 -15
- package/dist/src/structs/MetaObject.js +0 -122
- package/dist/src/structs/ObjectArray.d.ts +0 -10
- package/dist/src/structs/ObjectArray.js +0 -69
- package/dist/src/structs/ObjectManager.d.ts +0 -123
- package/dist/src/structs/ObjectManager.js +0 -738
- package/dist/src/structs/ObjectWithTemp.d.ts +0 -11
- package/dist/src/structs/ObjectWithTemp.js +0 -69
- package/dist/src/structs/SimpleObject.d.ts +0 -266
- package/dist/src/structs/SimpleObject.js +0 -1599
|
@@ -1,1319 +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
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
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); }
|
|
15
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
16
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
-
function _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; }
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
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); } }
|
|
22
|
-
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); }); }; }
|
|
23
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
|
-
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); } }
|
|
25
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
26
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
27
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
30
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
31
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
34
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
37
|
-
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); }
|
|
38
|
-
var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
39
|
-
_inherits(WebObject, _SimpleObject);
|
|
40
|
-
function WebObject() {
|
|
41
|
-
var _this;
|
|
42
|
-
var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
43
|
-
_classCallCheck(this, WebObject);
|
|
44
|
-
_this = _callSuper(this, WebObject, [is_readonly]);
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "meta_data", void 0);
|
|
46
|
-
//created date
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "_created_date", void 0);
|
|
48
|
-
//the owner of the object
|
|
49
|
-
_defineProperty(_assertThisInitialized(_this), "_creator", void 0);
|
|
50
|
-
//multiple users can work on one object
|
|
51
|
-
_defineProperty(_assertThisInitialized(_this), "_users", void 0);
|
|
52
|
-
_this.meta_data = {};
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* get a list of all user ids that work on the given object
|
|
57
|
-
* _creator + _users + attentions(old)
|
|
58
|
-
* removes duplicates
|
|
59
|
-
* @returns array of ids
|
|
60
|
-
*/
|
|
61
|
-
_createClass(WebObject, [{
|
|
62
|
-
key: "getAllUsers",
|
|
63
|
-
value: function getAllUsers() {
|
|
64
|
-
return WebObject.getAllUsers(this);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* get a list of all user ids that work on the given object
|
|
68
|
-
* _creator + _users + attentions(old)
|
|
69
|
-
* removes duplicates
|
|
70
|
-
* @returns array of ids
|
|
71
|
-
*/
|
|
72
|
-
}, {
|
|
73
|
-
key: "setMetaValue",
|
|
74
|
-
value: (
|
|
75
|
-
/* -------------------------------------------------------------------------- */
|
|
76
|
-
/* Meta data */
|
|
77
|
-
/* -------------------------------------------------------------------------- */
|
|
78
|
-
/**
|
|
79
|
-
* Update meta value of this object , meta data is stored in meta_data variable
|
|
80
|
-
* @param key
|
|
81
|
-
* @param value
|
|
82
|
-
* @param sendChange
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
function () {
|
|
86
|
-
var _setMetaValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
|
|
87
|
-
var sendChange,
|
|
88
|
-
old_value,
|
|
89
|
-
new_metalist,
|
|
90
|
-
_args = arguments;
|
|
91
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
92
|
-
while (1) switch (_context.prev = _context.next) {
|
|
93
|
-
case 0:
|
|
94
|
-
sendChange = _args.length > 2 && _args[2] !== undefined ? _args[2] : "auto";
|
|
95
|
-
if (this.canModify) {
|
|
96
|
-
_context.next = 7;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (!(this.__throw_errors !== false)) {
|
|
100
|
-
_context.next = 6;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
throw Error("Cant use setMetaValue on ".concat(key, " when on readonly mode"));
|
|
104
|
-
case 6:
|
|
105
|
-
return _context.abrupt("return", false);
|
|
106
|
-
case 7:
|
|
107
|
-
if (!(!key || typeof key != "string")) {
|
|
108
|
-
_context.next = 13;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
if (!(this.__throw_errors !== false)) {
|
|
112
|
-
_context.next = 12;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
throw Error("Bad key at setMetaValue");
|
|
116
|
-
case 12:
|
|
117
|
-
return _context.abrupt("return", false);
|
|
118
|
-
case 13:
|
|
119
|
-
old_value = WebObject.getMetaValue(this, key);
|
|
120
|
-
if (!(0, _object.object_equals)(old_value, value)) {
|
|
121
|
-
_context.next = 16;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
return _context.abrupt("return", false);
|
|
125
|
-
case 16:
|
|
126
|
-
//same value, no changes
|
|
127
|
-
new_metalist = _objectSpread({}, this.getValue("meta_data"));
|
|
128
|
-
new_metalist[key] = value;
|
|
129
|
-
_context.next = 20;
|
|
130
|
-
return this.setValue("meta_data", new_metalist);
|
|
131
|
-
case 20:
|
|
132
|
-
if (!(sendChange !== false)) {
|
|
133
|
-
_context.next = 23;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
_context.next = 23;
|
|
137
|
-
return this.notifyChanged("meta", key, value);
|
|
138
|
-
case 23:
|
|
139
|
-
return _context.abrupt("return", true);
|
|
140
|
-
case 24:
|
|
141
|
-
case "end":
|
|
142
|
-
return _context.stop();
|
|
143
|
-
}
|
|
144
|
-
}, _callee, this);
|
|
145
|
-
}));
|
|
146
|
-
function setMetaValue(_x, _x2) {
|
|
147
|
-
return _setMetaValue.apply(this, arguments);
|
|
148
|
-
}
|
|
149
|
-
return setMetaValue;
|
|
150
|
-
}()
|
|
151
|
-
/**
|
|
152
|
-
* Get meta value by key
|
|
153
|
-
* @param key
|
|
154
|
-
* @returns value or undefined
|
|
155
|
-
*/
|
|
156
|
-
)
|
|
157
|
-
}, {
|
|
158
|
-
key: "getMetaValue",
|
|
159
|
-
value: function getMetaValue(key) {
|
|
160
|
-
return WebObject.getMetaValue(this, key);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Get meta value by key
|
|
164
|
-
* @param o
|
|
165
|
-
* @param key
|
|
166
|
-
* @returns value or undefined
|
|
167
|
-
*/
|
|
168
|
-
}, {
|
|
169
|
-
key: "Save",
|
|
170
|
-
value: function () {
|
|
171
|
-
var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
172
|
-
var deltaObject, putAction, usepath, canSaveResult, resultObject;
|
|
173
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
174
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
175
|
-
case 0:
|
|
176
|
-
_context2.next = 2;
|
|
177
|
-
return this.get_deltaObject();
|
|
178
|
-
case 2:
|
|
179
|
-
deltaObject = _context2.sent;
|
|
180
|
-
putAction = "post";
|
|
181
|
-
_context2.next = 6;
|
|
182
|
-
return _WebObjectPathHelper["default"].get_path(this, this.isNew ? "new" : "save");
|
|
183
|
-
case 6:
|
|
184
|
-
usepath = _context2.sent;
|
|
185
|
-
if ((0, _object.object_isEmpty)(deltaObject)) {
|
|
186
|
-
_context2.next = 20;
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
canSaveResult = this.canSave(deltaObject);
|
|
190
|
-
if (!(canSaveResult !== true)) {
|
|
191
|
-
_context2.next = 13;
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
WebObject.addError(this, "Save not allowed", String(canSaveResult), true);
|
|
195
|
-
this.setSaveResult(false, "canceled");
|
|
196
|
-
return _context2.abrupt("return", false);
|
|
197
|
-
case 13:
|
|
198
|
-
_context2.next = 15;
|
|
199
|
-
return _global.gfunc.run_action(putAction, usepath, deltaObject);
|
|
200
|
-
case 15:
|
|
201
|
-
resultObject = _context2.sent;
|
|
202
|
-
this.setSaveResult(resultObject, "auto");
|
|
203
|
-
if (!this.__saveResultIsSuccess) {
|
|
204
|
-
console.error("bad save result : ", resultObject);
|
|
205
|
-
WebObject.addError(this, "Save result is not valid", "the response from server was not a valid saveresult object !", true);
|
|
206
|
-
}
|
|
207
|
-
_context2.next = 21;
|
|
208
|
-
break;
|
|
209
|
-
case 20:
|
|
210
|
-
/* nothing to save */
|
|
211
|
-
this.setSaveResult(null, "nothing");
|
|
212
|
-
case 21:
|
|
213
|
-
if (!this.isSaved) {
|
|
214
|
-
_context2.next = 25;
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
_context2.next = 24;
|
|
218
|
-
return this.onSave();
|
|
219
|
-
case 24:
|
|
220
|
-
return _context2.abrupt("return", this.getSaveResult());
|
|
221
|
-
case 25:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context2.stop();
|
|
224
|
-
}
|
|
225
|
-
}, _callee2, this);
|
|
226
|
-
}));
|
|
227
|
-
function Save() {
|
|
228
|
-
return _Save.apply(this, arguments);
|
|
229
|
-
}
|
|
230
|
-
return Save;
|
|
231
|
-
}()
|
|
232
|
-
}, {
|
|
233
|
-
key: "Delete",
|
|
234
|
-
value: function () {
|
|
235
|
-
var _Delete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
236
|
-
var usepath, resultObject;
|
|
237
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
238
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
239
|
-
case 0:
|
|
240
|
-
if (!this.isNew) {
|
|
241
|
-
_context3.next = 2;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
return _context3.abrupt("return");
|
|
245
|
-
case 2:
|
|
246
|
-
_context3.next = 4;
|
|
247
|
-
return _WebObjectPathHelper["default"].get_path(this, "delete");
|
|
248
|
-
case 4:
|
|
249
|
-
usepath = _context3.sent;
|
|
250
|
-
_context3.next = 7;
|
|
251
|
-
return _global.gfunc.run_action("delete", usepath);
|
|
252
|
-
case 7:
|
|
253
|
-
resultObject = _context3.sent;
|
|
254
|
-
this.setSaveResult(resultObject, "auto", true);
|
|
255
|
-
_context3.next = 11;
|
|
256
|
-
return this.onDelete();
|
|
257
|
-
case 11:
|
|
258
|
-
return _context3.abrupt("return", resultObject);
|
|
259
|
-
case 12:
|
|
260
|
-
case "end":
|
|
261
|
-
return _context3.stop();
|
|
262
|
-
}
|
|
263
|
-
}, _callee3, this);
|
|
264
|
-
}));
|
|
265
|
-
function Delete() {
|
|
266
|
-
return _Delete.apply(this, arguments);
|
|
267
|
-
}
|
|
268
|
-
return Delete;
|
|
269
|
-
}()
|
|
270
|
-
}, {
|
|
271
|
-
key: "Lock",
|
|
272
|
-
value: function () {
|
|
273
|
-
var _Lock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
274
|
-
var usepath, resultObject;
|
|
275
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
276
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
277
|
-
case 0:
|
|
278
|
-
if (!(this.isNew || this.isArchived)) {
|
|
279
|
-
_context4.next = 2;
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
return _context4.abrupt("return");
|
|
283
|
-
case 2:
|
|
284
|
-
_context4.next = 4;
|
|
285
|
-
return _WebObjectPathHelper["default"].get_path(this, "lock");
|
|
286
|
-
case 4:
|
|
287
|
-
usepath = _context4.sent;
|
|
288
|
-
_context4.next = 7;
|
|
289
|
-
return _global.gfunc.run_action("post", usepath);
|
|
290
|
-
case 7:
|
|
291
|
-
resultObject = _context4.sent;
|
|
292
|
-
this.setSaveResult(resultObject, "auto", true);
|
|
293
|
-
_context4.next = 11;
|
|
294
|
-
return this.onLock();
|
|
295
|
-
case 11:
|
|
296
|
-
return _context4.abrupt("return", resultObject);
|
|
297
|
-
case 12:
|
|
298
|
-
case "end":
|
|
299
|
-
return _context4.stop();
|
|
300
|
-
}
|
|
301
|
-
}, _callee4, this);
|
|
302
|
-
}));
|
|
303
|
-
function Lock() {
|
|
304
|
-
return _Lock.apply(this, arguments);
|
|
305
|
-
}
|
|
306
|
-
return Lock;
|
|
307
|
-
}()
|
|
308
|
-
}, {
|
|
309
|
-
key: "UnLock",
|
|
310
|
-
value: function () {
|
|
311
|
-
var _UnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
312
|
-
var usepath, resultObject;
|
|
313
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
314
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
315
|
-
case 0:
|
|
316
|
-
if (!(this.isNew || this.isArchived)) {
|
|
317
|
-
_context5.next = 2;
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
return _context5.abrupt("return");
|
|
321
|
-
case 2:
|
|
322
|
-
_context5.next = 4;
|
|
323
|
-
return _WebObjectPathHelper["default"].get_path(this, "unlock");
|
|
324
|
-
case 4:
|
|
325
|
-
usepath = _context5.sent;
|
|
326
|
-
_context5.next = 7;
|
|
327
|
-
return _global.gfunc.run_action("post", usepath);
|
|
328
|
-
case 7:
|
|
329
|
-
resultObject = _context5.sent;
|
|
330
|
-
this.setSaveResult(resultObject, "auto", true);
|
|
331
|
-
_context5.next = 11;
|
|
332
|
-
return this.onUnLock();
|
|
333
|
-
case 11:
|
|
334
|
-
return _context5.abrupt("return", resultObject);
|
|
335
|
-
case 12:
|
|
336
|
-
case "end":
|
|
337
|
-
return _context5.stop();
|
|
338
|
-
}
|
|
339
|
-
}, _callee5, this);
|
|
340
|
-
}));
|
|
341
|
-
function UnLock() {
|
|
342
|
-
return _UnLock.apply(this, arguments);
|
|
343
|
-
}
|
|
344
|
-
return UnLock;
|
|
345
|
-
}()
|
|
346
|
-
}, {
|
|
347
|
-
key: "Archive",
|
|
348
|
-
value: function () {
|
|
349
|
-
var _Archive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
350
|
-
var usepath, resultObject;
|
|
351
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
352
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
353
|
-
case 0:
|
|
354
|
-
if (!(this.isNew || this.isArchived)) {
|
|
355
|
-
_context6.next = 2;
|
|
356
|
-
break;
|
|
357
|
-
}
|
|
358
|
-
return _context6.abrupt("return");
|
|
359
|
-
case 2:
|
|
360
|
-
_context6.next = 4;
|
|
361
|
-
return _WebObjectPathHelper["default"].get_path(this, "archive");
|
|
362
|
-
case 4:
|
|
363
|
-
usepath = _context6.sent;
|
|
364
|
-
_context6.next = 7;
|
|
365
|
-
return _global.gfunc.run_action("post", usepath);
|
|
366
|
-
case 7:
|
|
367
|
-
resultObject = _context6.sent;
|
|
368
|
-
this.setSaveResult(resultObject, "auto", true);
|
|
369
|
-
_context6.next = 11;
|
|
370
|
-
return this.onArchive();
|
|
371
|
-
case 11:
|
|
372
|
-
return _context6.abrupt("return", resultObject);
|
|
373
|
-
case 12:
|
|
374
|
-
case "end":
|
|
375
|
-
return _context6.stop();
|
|
376
|
-
}
|
|
377
|
-
}, _callee6, this);
|
|
378
|
-
}));
|
|
379
|
-
function Archive() {
|
|
380
|
-
return _Archive.apply(this, arguments);
|
|
381
|
-
}
|
|
382
|
-
return Archive;
|
|
383
|
-
}()
|
|
384
|
-
}, {
|
|
385
|
-
key: "UnArchive",
|
|
386
|
-
value: function () {
|
|
387
|
-
var _UnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
388
|
-
var usepath, resultObject;
|
|
389
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
390
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
391
|
-
case 0:
|
|
392
|
-
if (!(this.isNew || !this.isArchived)) {
|
|
393
|
-
_context7.next = 2;
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
return _context7.abrupt("return");
|
|
397
|
-
case 2:
|
|
398
|
-
_context7.next = 4;
|
|
399
|
-
return _WebObjectPathHelper["default"].get_path(this, "unarchive");
|
|
400
|
-
case 4:
|
|
401
|
-
usepath = _context7.sent;
|
|
402
|
-
_context7.next = 7;
|
|
403
|
-
return _global.gfunc.run_action("post", usepath);
|
|
404
|
-
case 7:
|
|
405
|
-
resultObject = _context7.sent;
|
|
406
|
-
_context7.next = 10;
|
|
407
|
-
return this.onUnArchive();
|
|
408
|
-
case 10:
|
|
409
|
-
return _context7.abrupt("return", resultObject);
|
|
410
|
-
case 11:
|
|
411
|
-
case "end":
|
|
412
|
-
return _context7.stop();
|
|
413
|
-
}
|
|
414
|
-
}, _callee7, this);
|
|
415
|
-
}));
|
|
416
|
-
function UnArchive() {
|
|
417
|
-
return _UnArchive.apply(this, arguments);
|
|
418
|
-
}
|
|
419
|
-
return UnArchive;
|
|
420
|
-
}() /* -------------------------------------------------------------------------- */
|
|
421
|
-
}, {
|
|
422
|
-
key: "canSave",
|
|
423
|
-
value: function canSave(deltaObj) {
|
|
424
|
-
var deltaRes = this.deltaIsValid(deltaObj);
|
|
425
|
-
if (deltaRes !== true) return deltaRes;
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
}, {
|
|
429
|
-
key: "canDelete",
|
|
430
|
-
value: function canDelete() {
|
|
431
|
-
return true;
|
|
432
|
-
}
|
|
433
|
-
}, {
|
|
434
|
-
key: "canArchive",
|
|
435
|
-
value: function canArchive() {
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
}, {
|
|
439
|
-
key: "deltaIsValid",
|
|
440
|
-
value: function deltaIsValid(d) {
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* calls the `get_deltaObject` with `allProperties=true` `extraProperties=true`
|
|
445
|
-
*
|
|
446
|
-
* useful in server applications
|
|
447
|
-
* @returns
|
|
448
|
-
*/
|
|
449
|
-
}, {
|
|
450
|
-
key: "get_fullDeltaObject",
|
|
451
|
-
value: (function () {
|
|
452
|
-
var _get_fullDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(p) {
|
|
453
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
454
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
455
|
-
case 0:
|
|
456
|
-
_context8.next = 2;
|
|
457
|
-
return this.get_deltaObject({
|
|
458
|
-
allProperties: true,
|
|
459
|
-
extraProperties: true
|
|
460
|
-
});
|
|
461
|
-
case 2:
|
|
462
|
-
return _context8.abrupt("return", _context8.sent);
|
|
463
|
-
case 3:
|
|
464
|
-
case "end":
|
|
465
|
-
return _context8.stop();
|
|
466
|
-
}
|
|
467
|
-
}, _callee8, this);
|
|
468
|
-
}));
|
|
469
|
-
function get_fullDeltaObject(_x3) {
|
|
470
|
-
return _get_fullDeltaObject.apply(this, arguments);
|
|
471
|
-
}
|
|
472
|
-
return get_fullDeltaObject;
|
|
473
|
-
}()
|
|
474
|
-
/**
|
|
475
|
-
* You will post this to the server for saving
|
|
476
|
-
* automatically removes unchangable fields
|
|
477
|
-
* @returns
|
|
478
|
-
*/
|
|
479
|
-
)
|
|
480
|
-
}, {
|
|
481
|
-
key: "get_deltaObject",
|
|
482
|
-
value: (function () {
|
|
483
|
-
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(p) {
|
|
484
|
-
var _this2 = this;
|
|
485
|
-
var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _parseObj, _iterator, _step, key, tempusers;
|
|
486
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
487
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
488
|
-
case 0:
|
|
489
|
-
_parseObj = function _parseObj3() {
|
|
490
|
-
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(obj) {
|
|
491
|
-
var newobj_dlt;
|
|
492
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
493
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
494
|
-
case 0:
|
|
495
|
-
if (!(obj == null)) {
|
|
496
|
-
_context10.next = 2;
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
return _context10.abrupt("return", undefined);
|
|
500
|
-
case 2:
|
|
501
|
-
if (!Array.isArray(obj)) {
|
|
502
|
-
_context10.next = 6;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
_context10.next = 5;
|
|
506
|
-
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
507
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
|
|
508
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
509
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
510
|
-
case 0:
|
|
511
|
-
_context9.next = 2;
|
|
512
|
-
return parseObj(r);
|
|
513
|
-
case 2:
|
|
514
|
-
return _context9.abrupt("return", _context9.sent);
|
|
515
|
-
case 3:
|
|
516
|
-
case "end":
|
|
517
|
-
return _context9.stop();
|
|
518
|
-
}
|
|
519
|
-
}, _callee9);
|
|
520
|
-
}));
|
|
521
|
-
return function (_x6) {
|
|
522
|
-
return _ref.apply(this, arguments);
|
|
523
|
-
};
|
|
524
|
-
}()));
|
|
525
|
-
case 5:
|
|
526
|
-
return _context10.abrupt("return", _context10.sent);
|
|
527
|
-
case 6:
|
|
528
|
-
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
529
|
-
_context10.next = 15;
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
_context10.next = 9;
|
|
533
|
-
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
534
|
-
isChild: true
|
|
535
|
-
}));
|
|
536
|
-
case 9:
|
|
537
|
-
newobj_dlt = _context10.sent;
|
|
538
|
-
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
539
|
-
_context10.next = 14;
|
|
540
|
-
break;
|
|
541
|
-
}
|
|
542
|
-
return _context10.abrupt("return", newobj_dlt);
|
|
543
|
-
case 14:
|
|
544
|
-
return _context10.abrupt("return", obj);
|
|
545
|
-
case 15:
|
|
546
|
-
return _context10.abrupt("return", obj);
|
|
547
|
-
case 16:
|
|
548
|
-
case "end":
|
|
549
|
-
return _context10.stop();
|
|
550
|
-
}
|
|
551
|
-
}, _callee10);
|
|
552
|
-
}));
|
|
553
|
-
return _parseObj.apply(this, arguments);
|
|
554
|
-
};
|
|
555
|
-
parseObj = function _parseObj2(_x5) {
|
|
556
|
-
return _parseObj.apply(this, arguments);
|
|
557
|
-
};
|
|
558
|
-
if (!p) p = {};
|
|
559
|
-
final_object = {}; //@ts-ignore
|
|
560
|
-
isChild = Boolean(p.isChild || p.ischild); //@ts-ignore
|
|
561
|
-
useDelta = this.__use_delta || Boolean(p.useDelta || p.usedelta); //@ts-ignore
|
|
562
|
-
allProperties = Boolean(p.allProperties || p.allproperties); //@ts-ignore
|
|
563
|
-
needId = Boolean(p.needId || p.needid);
|
|
564
|
-
chkChangables = this.__changeables != null || this.__unchangeables != null;
|
|
565
|
-
useExtraProps = Boolean(p.extraProperties); //child objects usually dont update their __delta, so we read info from all of its properties
|
|
566
|
-
dlt = allProperties || !useDelta && isChild && chkChangables ? _objectSpread({}, this.allproperties) : _objectSpread({}, this.__delta);
|
|
567
|
-
allkeys = Object.keys(dlt);
|
|
568
|
-
changableKeys = chkChangables ? allkeys.filter(function (s) {
|
|
569
|
-
return _index3.SimpleObject.canChangeKey(_this2, s, {
|
|
570
|
-
useExtraProps: useExtraProps,
|
|
571
|
-
ignoreProtected: allProperties
|
|
572
|
-
});
|
|
573
|
-
}) : allkeys;
|
|
574
|
-
_context11.next = 15;
|
|
575
|
-
return _convert["default"].applyFormats({
|
|
576
|
-
inputobject: dlt,
|
|
577
|
-
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
578
|
-
changableKeys: changableKeys
|
|
579
|
-
});
|
|
580
|
-
case 15:
|
|
581
|
-
/* -------------------------------------------------------------------------- */
|
|
582
|
-
/* __functionProperties */
|
|
583
|
-
/* -------------------------------------------------------------------------- */
|
|
584
|
-
functionProps = (0, _object.object_getStatic)(this, "__functionProperties");
|
|
585
|
-
if (Array.isArray(functionProps)) {
|
|
586
|
-
for (index = 0; index < functionProps.length; index++) {
|
|
587
|
-
fp = functionProps[index];
|
|
588
|
-
if (dlt[fp]) dlt[fp] = (0, _object.fn_eval_this)(this, dlt[fp]);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
/* -------------------------------------------------------------------------- */
|
|
592
|
-
/* parse all changableKeys */
|
|
593
|
-
/* -------------------------------------------------------------------------- */
|
|
594
|
-
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
595
|
-
_context11.prev = 18;
|
|
596
|
-
_iterator.s();
|
|
597
|
-
case 20:
|
|
598
|
-
if ((_step = _iterator.n()).done) {
|
|
599
|
-
_context11.next = 27;
|
|
600
|
-
break;
|
|
601
|
-
}
|
|
602
|
-
key = _step.value;
|
|
603
|
-
_context11.next = 24;
|
|
604
|
-
return parseObj(dlt[key]);
|
|
605
|
-
case 24:
|
|
606
|
-
final_object[key] = _context11.sent;
|
|
607
|
-
case 25:
|
|
608
|
-
_context11.next = 20;
|
|
609
|
-
break;
|
|
610
|
-
case 27:
|
|
611
|
-
_context11.next = 32;
|
|
612
|
-
break;
|
|
613
|
-
case 29:
|
|
614
|
-
_context11.prev = 29;
|
|
615
|
-
_context11.t0 = _context11["catch"](18);
|
|
616
|
-
_iterator.e(_context11.t0);
|
|
617
|
-
case 32:
|
|
618
|
-
_context11.prev = 32;
|
|
619
|
-
_iterator.f();
|
|
620
|
-
return _context11.finish(32);
|
|
621
|
-
case 35:
|
|
622
|
-
/* -------------------------------------------------------------------------- */
|
|
623
|
-
/* add id properties */
|
|
624
|
-
/* -------------------------------------------------------------------------- */
|
|
625
|
-
if (allProperties) {
|
|
626
|
-
final_object["_created_date"] = this["_created_date"];
|
|
627
|
-
final_object["_archived"] = this.isArchived;
|
|
628
|
-
final_object["_deleted"] = this.isDeleted;
|
|
629
|
-
}
|
|
630
|
-
if (allProperties || needId) {
|
|
631
|
-
if (this["_index_key"]) final_object["_index_key"] = this["_index_key"];
|
|
632
|
-
if (this.getIndex()) final_object["_index_value"] = this.getIndex();
|
|
633
|
-
if (this.getID()) final_object["_id"] = this.getID();
|
|
634
|
-
}
|
|
635
|
-
/* -------------------------------------------------------------------------- */
|
|
636
|
-
/* fix _user property */
|
|
637
|
-
/* -------------------------------------------------------------------------- */
|
|
638
|
-
if (final_object["_users"]) {
|
|
639
|
-
tempusers = final_object["_users"];
|
|
640
|
-
if (typeof tempusers === "string") tempusers = tempusers.split(",").filter(function (s) {
|
|
641
|
-
return s;
|
|
642
|
-
});
|
|
643
|
-
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
644
|
-
}
|
|
645
|
-
return _context11.abrupt("return", final_object);
|
|
646
|
-
case 39:
|
|
647
|
-
case "end":
|
|
648
|
-
return _context11.stop();
|
|
649
|
-
}
|
|
650
|
-
}, _callee11, this, [[18, 29, 32, 35]]);
|
|
651
|
-
}));
|
|
652
|
-
function get_deltaObject(_x4) {
|
|
653
|
-
return _get_deltaObject.apply(this, arguments);
|
|
654
|
-
}
|
|
655
|
-
return get_deltaObject;
|
|
656
|
-
}() /* --------------------------------- Getters -------------------------------- */)
|
|
657
|
-
}, {
|
|
658
|
-
key: "manager",
|
|
659
|
-
get: function get() {
|
|
660
|
-
return this.get_managerClass() || undefined;
|
|
661
|
-
}
|
|
662
|
-
}, {
|
|
663
|
-
key: "__web_path",
|
|
664
|
-
get: function get() {
|
|
665
|
-
return this.constructor["__web_path"] || this.__db_name;
|
|
666
|
-
}
|
|
667
|
-
}, {
|
|
668
|
-
key: "get_webpath",
|
|
669
|
-
value: function get_webpath() {
|
|
670
|
-
return this.__web_path || this.__db_name || "";
|
|
671
|
-
}
|
|
672
|
-
}, {
|
|
673
|
-
key: "onDelete",
|
|
674
|
-
value: ( /* -------------------------------------------------------------------------- */function () {
|
|
675
|
-
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
676
|
-
var _this$manager;
|
|
677
|
-
var _len,
|
|
678
|
-
p,
|
|
679
|
-
_key,
|
|
680
|
-
_args12 = arguments;
|
|
681
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
682
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
683
|
-
case 0:
|
|
684
|
-
if (this.isSaved) this.isDeleted = true;
|
|
685
|
-
for (_len = _args12.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
686
|
-
p[_key] = _args12[_key];
|
|
687
|
-
}
|
|
688
|
-
_context12.next = 4;
|
|
689
|
-
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
|
|
690
|
-
case 4:
|
|
691
|
-
return _context12.abrupt("return", _context12.sent);
|
|
692
|
-
case 5:
|
|
693
|
-
case "end":
|
|
694
|
-
return _context12.stop();
|
|
695
|
-
}
|
|
696
|
-
}, _callee12, this);
|
|
697
|
-
}));
|
|
698
|
-
function onDelete() {
|
|
699
|
-
return _onDelete.apply(this, arguments);
|
|
700
|
-
}
|
|
701
|
-
return onDelete;
|
|
702
|
-
}())
|
|
703
|
-
}, {
|
|
704
|
-
key: "onArchive",
|
|
705
|
-
value: function () {
|
|
706
|
-
var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
707
|
-
var _this$manager2;
|
|
708
|
-
var _len2,
|
|
709
|
-
p,
|
|
710
|
-
_key2,
|
|
711
|
-
_args13 = arguments;
|
|
712
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
713
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
714
|
-
case 0:
|
|
715
|
-
if (this.isSaved) this.isArchived = true;
|
|
716
|
-
for (_len2 = _args13.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
717
|
-
p[_key2] = _args13[_key2];
|
|
718
|
-
}
|
|
719
|
-
_context13.next = 4;
|
|
720
|
-
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onArchive.apply(_this$manager2, p);
|
|
721
|
-
case 4:
|
|
722
|
-
return _context13.abrupt("return", _context13.sent);
|
|
723
|
-
case 5:
|
|
724
|
-
case "end":
|
|
725
|
-
return _context13.stop();
|
|
726
|
-
}
|
|
727
|
-
}, _callee13, this);
|
|
728
|
-
}));
|
|
729
|
-
function onArchive() {
|
|
730
|
-
return _onArchive.apply(this, arguments);
|
|
731
|
-
}
|
|
732
|
-
return onArchive;
|
|
733
|
-
}()
|
|
734
|
-
}, {
|
|
735
|
-
key: "onUnArchive",
|
|
736
|
-
value: function () {
|
|
737
|
-
var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
738
|
-
var _this$manager3;
|
|
739
|
-
var _len3,
|
|
740
|
-
p,
|
|
741
|
-
_key3,
|
|
742
|
-
_args14 = arguments;
|
|
743
|
-
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
744
|
-
while (1) switch (_context14.prev = _context14.next) {
|
|
745
|
-
case 0:
|
|
746
|
-
if (this.isSaved) this.isArchived = false;
|
|
747
|
-
for (_len3 = _args14.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
748
|
-
p[_key3] = _args14[_key3];
|
|
749
|
-
}
|
|
750
|
-
_context14.next = 4;
|
|
751
|
-
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onUnArchive.apply(_this$manager3, p);
|
|
752
|
-
case 4:
|
|
753
|
-
return _context14.abrupt("return", _context14.sent);
|
|
754
|
-
case 5:
|
|
755
|
-
case "end":
|
|
756
|
-
return _context14.stop();
|
|
757
|
-
}
|
|
758
|
-
}, _callee14, this);
|
|
759
|
-
}));
|
|
760
|
-
function onUnArchive() {
|
|
761
|
-
return _onUnArchive.apply(this, arguments);
|
|
762
|
-
}
|
|
763
|
-
return onUnArchive;
|
|
764
|
-
}()
|
|
765
|
-
}, {
|
|
766
|
-
key: "onLock",
|
|
767
|
-
value: function () {
|
|
768
|
-
var _onLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
769
|
-
var _this$manager4;
|
|
770
|
-
var _len4,
|
|
771
|
-
p,
|
|
772
|
-
_key4,
|
|
773
|
-
_args15 = arguments;
|
|
774
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
775
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
776
|
-
case 0:
|
|
777
|
-
if (this.isSaved) this.isLocked = true;
|
|
778
|
-
for (_len4 = _args15.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
779
|
-
p[_key4] = _args15[_key4];
|
|
780
|
-
}
|
|
781
|
-
_context15.next = 4;
|
|
782
|
-
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onLock.apply(_this$manager4, p);
|
|
783
|
-
case 4:
|
|
784
|
-
return _context15.abrupt("return", _context15.sent);
|
|
785
|
-
case 5:
|
|
786
|
-
case "end":
|
|
787
|
-
return _context15.stop();
|
|
788
|
-
}
|
|
789
|
-
}, _callee15, this);
|
|
790
|
-
}));
|
|
791
|
-
function onLock() {
|
|
792
|
-
return _onLock.apply(this, arguments);
|
|
793
|
-
}
|
|
794
|
-
return onLock;
|
|
795
|
-
}()
|
|
796
|
-
}, {
|
|
797
|
-
key: "onUnLock",
|
|
798
|
-
value: function () {
|
|
799
|
-
var _onUnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
800
|
-
var _this$manager5;
|
|
801
|
-
var _len5,
|
|
802
|
-
p,
|
|
803
|
-
_key5,
|
|
804
|
-
_args16 = arguments;
|
|
805
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
806
|
-
while (1) switch (_context16.prev = _context16.next) {
|
|
807
|
-
case 0:
|
|
808
|
-
if (this.isSaved) this.isLocked = false;
|
|
809
|
-
for (_len5 = _args16.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
810
|
-
p[_key5] = _args16[_key5];
|
|
811
|
-
}
|
|
812
|
-
_context16.next = 4;
|
|
813
|
-
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onUnLock.apply(_this$manager5, p);
|
|
814
|
-
case 4:
|
|
815
|
-
return _context16.abrupt("return", _context16.sent);
|
|
816
|
-
case 5:
|
|
817
|
-
case "end":
|
|
818
|
-
return _context16.stop();
|
|
819
|
-
}
|
|
820
|
-
}, _callee16, this);
|
|
821
|
-
}));
|
|
822
|
-
function onUnLock() {
|
|
823
|
-
return _onUnLock.apply(this, arguments);
|
|
824
|
-
}
|
|
825
|
-
return onUnLock;
|
|
826
|
-
}()
|
|
827
|
-
}, {
|
|
828
|
-
key: "onLoad",
|
|
829
|
-
value: function () {
|
|
830
|
-
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
831
|
-
var _this$manager6;
|
|
832
|
-
var _len6,
|
|
833
|
-
p,
|
|
834
|
-
_key6,
|
|
835
|
-
_args17 = arguments;
|
|
836
|
-
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
837
|
-
while (1) switch (_context17.prev = _context17.next) {
|
|
838
|
-
case 0:
|
|
839
|
-
this.isDeleted = false;
|
|
840
|
-
for (_len6 = _args17.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
841
|
-
p[_key6] = _args17[_key6];
|
|
842
|
-
}
|
|
843
|
-
_context17.next = 4;
|
|
844
|
-
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onLoad.apply(_this$manager6, p);
|
|
845
|
-
case 4:
|
|
846
|
-
return _context17.abrupt("return", _context17.sent);
|
|
847
|
-
case 5:
|
|
848
|
-
case "end":
|
|
849
|
-
return _context17.stop();
|
|
850
|
-
}
|
|
851
|
-
}, _callee17, this);
|
|
852
|
-
}));
|
|
853
|
-
function onLoad() {
|
|
854
|
-
return _onLoad.apply(this, arguments);
|
|
855
|
-
}
|
|
856
|
-
return onLoad;
|
|
857
|
-
}()
|
|
858
|
-
}, {
|
|
859
|
-
key: "onSave",
|
|
860
|
-
value: function () {
|
|
861
|
-
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
862
|
-
var _this$manager8;
|
|
863
|
-
var srObject,
|
|
864
|
-
_this$manager7,
|
|
865
|
-
_len7,
|
|
866
|
-
p,
|
|
867
|
-
_key7,
|
|
868
|
-
_args18 = arguments;
|
|
869
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
870
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
871
|
-
case 0:
|
|
872
|
-
if (!this.isSaved) {
|
|
873
|
-
_context18.next = 7;
|
|
874
|
-
break;
|
|
875
|
-
}
|
|
876
|
-
this.apply_changes();
|
|
877
|
-
srObject = this.getSaveResult(true);
|
|
878
|
-
if (!this.saveResultHasID(srObject)) {
|
|
879
|
-
_context18.next = 7;
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
882
|
-
/* -------------------------------------------------------------------------- */
|
|
883
|
-
WebObject.LoadIdsFromSaveResult(this, srObject);
|
|
884
|
-
_context18.next = 7;
|
|
885
|
-
return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.event_run("on_id_change");
|
|
886
|
-
case 7:
|
|
887
|
-
for (_len7 = _args18.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
888
|
-
p[_key7] = _args18[_key7];
|
|
889
|
-
}
|
|
890
|
-
_context18.next = 10;
|
|
891
|
-
return (_this$manager8 = this.manager) === null || _this$manager8 === void 0 ? void 0 : _this$manager8.onSave.apply(_this$manager8, p);
|
|
892
|
-
case 10:
|
|
893
|
-
_context18.next = 12;
|
|
894
|
-
return this.onAfterSave();
|
|
895
|
-
case 12:
|
|
896
|
-
return _context18.abrupt("return", true);
|
|
897
|
-
case 13:
|
|
898
|
-
case "end":
|
|
899
|
-
return _context18.stop();
|
|
900
|
-
}
|
|
901
|
-
}, _callee18, this);
|
|
902
|
-
}));
|
|
903
|
-
function onSave() {
|
|
904
|
-
return _onSave.apply(this, arguments);
|
|
905
|
-
}
|
|
906
|
-
return onSave;
|
|
907
|
-
}()
|
|
908
|
-
}, {
|
|
909
|
-
key: "onAfterSave",
|
|
910
|
-
value: function () {
|
|
911
|
-
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
912
|
-
var _this$manager9;
|
|
913
|
-
var _len8,
|
|
914
|
-
p,
|
|
915
|
-
_key8,
|
|
916
|
-
_args19 = arguments;
|
|
917
|
-
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
918
|
-
while (1) switch (_context19.prev = _context19.next) {
|
|
919
|
-
case 0:
|
|
920
|
-
for (_len8 = _args19.length, p = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
921
|
-
p[_key8] = _args19[_key8];
|
|
922
|
-
}
|
|
923
|
-
_context19.next = 3;
|
|
924
|
-
return (_this$manager9 = this.manager) === null || _this$manager9 === void 0 ? void 0 : _this$manager9.onAfterSave.apply(_this$manager9, p);
|
|
925
|
-
case 3:
|
|
926
|
-
return _context19.abrupt("return", true);
|
|
927
|
-
case 4:
|
|
928
|
-
case "end":
|
|
929
|
-
return _context19.stop();
|
|
930
|
-
}
|
|
931
|
-
}, _callee19, this);
|
|
932
|
-
}));
|
|
933
|
-
function onAfterSave() {
|
|
934
|
-
return _onAfterSave.apply(this, arguments);
|
|
935
|
-
}
|
|
936
|
-
return onAfterSave;
|
|
937
|
-
}()
|
|
938
|
-
}, {
|
|
939
|
-
key: "getSaveResult",
|
|
940
|
-
value: function getSaveResult() {
|
|
941
|
-
var _this3 = this;
|
|
942
|
-
var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
943
|
-
var srObject = _get(_getPrototypeOf(WebObject.prototype), "getSaveResult", this).call(this, original);
|
|
944
|
-
if (!srObject) return false;
|
|
945
|
-
if (Array.isArray(srObject)) {
|
|
946
|
-
var actual_sr = srObject.find(function (s) {
|
|
947
|
-
return _this3.saveResultHasID(s);
|
|
948
|
-
});
|
|
949
|
-
if (actual_sr) srObject = actual_sr;
|
|
950
|
-
}
|
|
951
|
-
return srObject;
|
|
952
|
-
}
|
|
953
|
-
}, {
|
|
954
|
-
key: "onNew",
|
|
955
|
-
value: function () {
|
|
956
|
-
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
957
|
-
var _this$manager10;
|
|
958
|
-
var _len9,
|
|
959
|
-
p,
|
|
960
|
-
_key9,
|
|
961
|
-
_args20 = arguments;
|
|
962
|
-
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
963
|
-
while (1) switch (_context20.prev = _context20.next) {
|
|
964
|
-
case 0:
|
|
965
|
-
for (_len9 = _args20.length, p = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
966
|
-
p[_key9] = _args20[_key9];
|
|
967
|
-
}
|
|
968
|
-
_context20.next = 3;
|
|
969
|
-
return (_this$manager10 = this.manager) === null || _this$manager10 === void 0 ? void 0 : _this$manager10.onNew.apply(_this$manager10, p);
|
|
970
|
-
case 3:
|
|
971
|
-
return _context20.abrupt("return", _context20.sent);
|
|
972
|
-
case 4:
|
|
973
|
-
case "end":
|
|
974
|
-
return _context20.stop();
|
|
975
|
-
}
|
|
976
|
-
}, _callee20, this);
|
|
977
|
-
}));
|
|
978
|
-
function onNew() {
|
|
979
|
-
return _onNew.apply(this, arguments);
|
|
980
|
-
}
|
|
981
|
-
return onNew;
|
|
982
|
-
}() /* -------------------------------------------------------------------------- */
|
|
983
|
-
}, {
|
|
984
|
-
key: "saveResultHasID",
|
|
985
|
-
value: function saveResultHasID(s) {
|
|
986
|
-
return WebObject.saveResultHasID(s);
|
|
987
|
-
}
|
|
988
|
-
}], [{
|
|
989
|
-
key: "getAllUsers",
|
|
990
|
-
value: function getAllUsers(obj) {
|
|
991
|
-
if (_typeof(obj) != "object") return [];
|
|
992
|
-
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) {
|
|
993
|
-
return String(_typeof(r) === "object" ? WebObject.getID(r) : r);
|
|
994
|
-
}).filter(function (s) {
|
|
995
|
-
return s;
|
|
996
|
-
}));
|
|
997
|
-
}
|
|
998
|
-
}, {
|
|
999
|
-
key: "getMetaValue",
|
|
1000
|
-
value: function getMetaValue(o, key) {
|
|
1001
|
-
if (o == null) return null;
|
|
1002
|
-
if (!key || typeof key != "string") return undefined;
|
|
1003
|
-
var metalist = {};
|
|
1004
|
-
if (_typeof(o) === "object") {
|
|
1005
|
-
metalist = typeof o.getValue === "function" ? o.getValue("meta_data") : o.meta_data;
|
|
1006
|
-
}
|
|
1007
|
-
return metalist[key];
|
|
1008
|
-
}
|
|
1009
|
-
/* -------------------------------------------------------------------------- */
|
|
1010
|
-
/* Save */
|
|
1011
|
-
/* -------------------------------------------------------------------------- */
|
|
1012
|
-
}, {
|
|
1013
|
-
key: "zipSaveList",
|
|
1014
|
-
value: function zipSaveList(svlist) {
|
|
1015
|
-
if (_typeof(svlist) === "object") svlist = JSON.stringify(svlist);
|
|
1016
|
-
return (0, _string.string_compress)(svlist);
|
|
1017
|
-
}
|
|
1018
|
-
}, {
|
|
1019
|
-
key: "unzipSaveList",
|
|
1020
|
-
value: function unzipSaveList(svlist) {
|
|
1021
|
-
try {
|
|
1022
|
-
if (_typeof(svlist) === "object") {
|
|
1023
|
-
if (Array.isArray(svlist)) return svlist;
|
|
1024
|
-
if (svlist.__save_list) return this.unzipSaveList(svlist.__save_list);
|
|
1025
|
-
} else if (typeof svlist === "string") return (0, _object.wrap_array)(JSON.parse((0, _string.string_decompress)(svlist)));
|
|
1026
|
-
} catch (_unused) {}
|
|
1027
|
-
return (0, _object.wrap_array)(svlist);
|
|
1028
|
-
}
|
|
1029
|
-
}, {
|
|
1030
|
-
key: "saveList",
|
|
1031
|
-
value: function () {
|
|
1032
|
-
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(itemList) {
|
|
1033
|
-
var _extraOptions$chunksi;
|
|
1034
|
-
var extraOptions,
|
|
1035
|
-
chunks,
|
|
1036
|
-
putAddress,
|
|
1037
|
-
index,
|
|
1038
|
-
items_to_save,
|
|
1039
|
-
save_array,
|
|
1040
|
-
k,
|
|
1041
|
-
item,
|
|
1042
|
-
dlt,
|
|
1043
|
-
resultObject,
|
|
1044
|
-
_index,
|
|
1045
|
-
res,
|
|
1046
|
-
_item,
|
|
1047
|
-
_index2,
|
|
1048
|
-
_item2,
|
|
1049
|
-
_args21 = arguments;
|
|
1050
|
-
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1051
|
-
while (1) switch (_context21.prev = _context21.next) {
|
|
1052
|
-
case 0:
|
|
1053
|
-
extraOptions = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
|
|
1054
|
-
if (!extraOptions) extraOptions = {};
|
|
1055
|
-
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
1056
|
-
delete extraOptions.chunksize;
|
|
1057
|
-
putAddress = this.get_webpath();
|
|
1058
|
-
index = 0;
|
|
1059
|
-
case 6:
|
|
1060
|
-
if (!(index < chunks.length)) {
|
|
1061
|
-
_context21.next = 36;
|
|
1062
|
-
break;
|
|
1063
|
-
}
|
|
1064
|
-
items_to_save = chunks[index];
|
|
1065
|
-
save_array = [];
|
|
1066
|
-
k = 0;
|
|
1067
|
-
case 10:
|
|
1068
|
-
if (!(k < items_to_save.length)) {
|
|
1069
|
-
_context21.next = 19;
|
|
1070
|
-
break;
|
|
1071
|
-
}
|
|
1072
|
-
item = items_to_save[k];
|
|
1073
|
-
_context21.next = 14;
|
|
1074
|
-
return item.get_deltaObject();
|
|
1075
|
-
case 14:
|
|
1076
|
-
dlt = _context21.sent;
|
|
1077
|
-
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
1078
|
-
_id: item.getID()
|
|
1079
|
-
}, dlt));
|
|
1080
|
-
case 16:
|
|
1081
|
-
k++;
|
|
1082
|
-
_context21.next = 10;
|
|
1083
|
-
break;
|
|
1084
|
-
case 19:
|
|
1085
|
-
_context21.next = 21;
|
|
1086
|
-
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
1087
|
-
__save_list: WebObject.zipSaveList(save_array)
|
|
1088
|
-
}, extraOptions));
|
|
1089
|
-
case 21:
|
|
1090
|
-
resultObject = _context21.sent;
|
|
1091
|
-
if (!Array.isArray(resultObject)) {
|
|
1092
|
-
_context21.next = 33;
|
|
1093
|
-
break;
|
|
1094
|
-
}
|
|
1095
|
-
_index = 0;
|
|
1096
|
-
case 24:
|
|
1097
|
-
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
1098
|
-
_context21.next = 33;
|
|
1099
|
-
break;
|
|
1100
|
-
}
|
|
1101
|
-
res = resultObject[_index];
|
|
1102
|
-
_item = items_to_save[_index];
|
|
1103
|
-
_item.setSaveResult(res);
|
|
1104
|
-
_context21.next = 30;
|
|
1105
|
-
return _item.onSave();
|
|
1106
|
-
case 30:
|
|
1107
|
-
_index++;
|
|
1108
|
-
_context21.next = 24;
|
|
1109
|
-
break;
|
|
1110
|
-
case 33:
|
|
1111
|
-
index++;
|
|
1112
|
-
_context21.next = 6;
|
|
1113
|
-
break;
|
|
1114
|
-
case 36:
|
|
1115
|
-
_index2 = 0;
|
|
1116
|
-
case 37:
|
|
1117
|
-
if (!(_index2 < itemList.length)) {
|
|
1118
|
-
_context21.next = 46;
|
|
1119
|
-
break;
|
|
1120
|
-
}
|
|
1121
|
-
_item2 = itemList[_index2];
|
|
1122
|
-
if (_item2.isSaved) {
|
|
1123
|
-
_context21.next = 41;
|
|
1124
|
-
break;
|
|
1125
|
-
}
|
|
1126
|
-
return _context21.abrupt("return", false);
|
|
1127
|
-
case 41:
|
|
1128
|
-
if (!(_item2.getSaveResultType() != "normal")) {
|
|
1129
|
-
_context21.next = 43;
|
|
1130
|
-
break;
|
|
1131
|
-
}
|
|
1132
|
-
return _context21.abrupt("return", false);
|
|
1133
|
-
case 43:
|
|
1134
|
-
_index2++;
|
|
1135
|
-
_context21.next = 37;
|
|
1136
|
-
break;
|
|
1137
|
-
case 46:
|
|
1138
|
-
return _context21.abrupt("return", true);
|
|
1139
|
-
case 47:
|
|
1140
|
-
case "end":
|
|
1141
|
-
return _context21.stop();
|
|
1142
|
-
}
|
|
1143
|
-
}, _callee21, this);
|
|
1144
|
-
}));
|
|
1145
|
-
function saveList(_x7) {
|
|
1146
|
-
return _saveList.apply(this, arguments);
|
|
1147
|
-
}
|
|
1148
|
-
return saveList;
|
|
1149
|
-
}()
|
|
1150
|
-
}, {
|
|
1151
|
-
key: "get_webpath",
|
|
1152
|
-
value: function get_webpath() {
|
|
1153
|
-
return this.__web_path || this.__db_name || "";
|
|
1154
|
-
}
|
|
1155
|
-
}, {
|
|
1156
|
-
key: "saveResultHasID",
|
|
1157
|
-
value: function saveResultHasID(s) {
|
|
1158
|
-
if (_typeof(s) !== "object" || s == null || !s) return false;
|
|
1159
|
-
return s.insertedId || s._id || s._index_value && !Number.isNaN(s._index_value);
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Load Id and _index_value from the given save result into our object
|
|
1163
|
-
* @param o
|
|
1164
|
-
* @param srObject
|
|
1165
|
-
* @returns
|
|
1166
|
-
*/
|
|
1167
|
-
}, {
|
|
1168
|
-
key: "LoadIdsFromSaveResult",
|
|
1169
|
-
value: function LoadIdsFromSaveResult(o, srObject) {
|
|
1170
|
-
if (_typeof(o) !== "object" || _typeof(srObject) !== "object") return;
|
|
1171
|
-
/* -------------------------------------------------------------------------- */
|
|
1172
|
-
var srID = srObject.insertedId || srObject._id || WebObject.getID(srObject);
|
|
1173
|
-
if (srID) {
|
|
1174
|
-
o._id = srID;
|
|
1175
|
-
}
|
|
1176
|
-
/* -------------------------------------------------------------------------- */
|
|
1177
|
-
if (srObject._index_value && !Number.isNaN(srObject._index_value)) {
|
|
1178
|
-
o._index_value = Number(srObject._index_value);
|
|
1179
|
-
}
|
|
1180
|
-
/* -------------------------------------------------------------------------- */
|
|
1181
|
-
if (srObject._index_key) {
|
|
1182
|
-
o._index_key = srObject._index_key;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
/* -------------------------------------------------------------------------- */
|
|
1186
|
-
/**
|
|
1187
|
-
* get a single web object
|
|
1188
|
-
* default order of parameters : search,readonly,fetchID
|
|
1189
|
-
*/
|
|
1190
|
-
}, {
|
|
1191
|
-
key: "get_single",
|
|
1192
|
-
value: (function () {
|
|
1193
|
-
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1194
|
-
var _len10,
|
|
1195
|
-
p,
|
|
1196
|
-
_key10,
|
|
1197
|
-
search,
|
|
1198
|
-
readonly,
|
|
1199
|
-
fetchID,
|
|
1200
|
-
res,
|
|
1201
|
-
params,
|
|
1202
|
-
_args22 = arguments;
|
|
1203
|
-
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1204
|
-
while (1) switch (_context22.prev = _context22.next) {
|
|
1205
|
-
case 0:
|
|
1206
|
-
for (_len10 = _args22.length, p = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
1207
|
-
p[_key10] = _args22[_key10];
|
|
1208
|
-
}
|
|
1209
|
-
search = p.shift();
|
|
1210
|
-
readonly = p.shift();
|
|
1211
|
-
fetchID = p.shift();
|
|
1212
|
-
if (!(0, _object.object_isEmpty)(search)) {
|
|
1213
|
-
_context22.next = 6;
|
|
1214
|
-
break;
|
|
1215
|
-
}
|
|
1216
|
-
return _context22.abrupt("return", undefined);
|
|
1217
|
-
case 6:
|
|
1218
|
-
params = {};
|
|
1219
|
-
params.context = readonly ? "view" : "edit";
|
|
1220
|
-
_context22.t0 = _typeof(search);
|
|
1221
|
-
_context22.next = _context22.t0 === "string" ? 11 : _context22.t0 === "number" ? 11 : _context22.t0 === "object" ? 19 : 19;
|
|
1222
|
-
break;
|
|
1223
|
-
case 11:
|
|
1224
|
-
search = String(search);
|
|
1225
|
-
_context22.t1 = this;
|
|
1226
|
-
_context22.t2 = this;
|
|
1227
|
-
_context22.next = 16;
|
|
1228
|
-
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
1229
|
-
fetchID: fetchID
|
|
1230
|
-
});
|
|
1231
|
-
case 16:
|
|
1232
|
-
_context22.t3 = _context22.sent;
|
|
1233
|
-
res = _context22.t1.ensure.call(_context22.t1, _context22.t2, _context22.t3);
|
|
1234
|
-
return _context22.abrupt("break", 25);
|
|
1235
|
-
case 19:
|
|
1236
|
-
_context22.t4 = _object.object_first;
|
|
1237
|
-
_context22.next = 22;
|
|
1238
|
-
return this.get_list(search, readonly, fetchID);
|
|
1239
|
-
case 22:
|
|
1240
|
-
_context22.t5 = _context22.sent;
|
|
1241
|
-
res = (0, _context22.t4)(_context22.t5);
|
|
1242
|
-
return _context22.abrupt("break", 25);
|
|
1243
|
-
case 25:
|
|
1244
|
-
WebObject.setReadonly(res, readonly);
|
|
1245
|
-
return _context22.abrupt("return", res);
|
|
1246
|
-
case 27:
|
|
1247
|
-
case "end":
|
|
1248
|
-
return _context22.stop();
|
|
1249
|
-
}
|
|
1250
|
-
}, _callee22, this);
|
|
1251
|
-
}));
|
|
1252
|
-
function get_single() {
|
|
1253
|
-
return _get_single.apply(this, arguments);
|
|
1254
|
-
}
|
|
1255
|
-
return get_single;
|
|
1256
|
-
}()
|
|
1257
|
-
/**
|
|
1258
|
-
* Get a list of web objects
|
|
1259
|
-
* default order of parameters : search,readonly,fetchID
|
|
1260
|
-
*/
|
|
1261
|
-
)
|
|
1262
|
-
}, {
|
|
1263
|
-
key: "get_list",
|
|
1264
|
-
value: (function () {
|
|
1265
|
-
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1266
|
-
var _len11,
|
|
1267
|
-
p,
|
|
1268
|
-
_key11,
|
|
1269
|
-
search,
|
|
1270
|
-
readonly,
|
|
1271
|
-
fetchID,
|
|
1272
|
-
usepath,
|
|
1273
|
-
result_items,
|
|
1274
|
-
res,
|
|
1275
|
-
_args23 = arguments;
|
|
1276
|
-
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1277
|
-
while (1) switch (_context23.prev = _context23.next) {
|
|
1278
|
-
case 0:
|
|
1279
|
-
for (_len11 = _args23.length, p = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
|
1280
|
-
p[_key11] = _args23[_key11];
|
|
1281
|
-
}
|
|
1282
|
-
search = p.shift();
|
|
1283
|
-
readonly = p.shift();
|
|
1284
|
-
fetchID = p.shift();
|
|
1285
|
-
if (!search) search = {};
|
|
1286
|
-
_context23.next = 7;
|
|
1287
|
-
return _WebObjectPathHelper["default"].get_path(this, "get");
|
|
1288
|
-
case 7:
|
|
1289
|
-
usepath = _context23.sent;
|
|
1290
|
-
_context23.next = 10;
|
|
1291
|
-
return _global.gfunc.run_action("get", usepath, search, {
|
|
1292
|
-
fetchID: fetchID
|
|
1293
|
-
});
|
|
1294
|
-
case 10:
|
|
1295
|
-
result_items = _context23.sent;
|
|
1296
|
-
// const selftype = (this.constructor ||
|
|
1297
|
-
// Object.getPrototypeOf(this)) as any;
|
|
1298
|
-
res = WebObject.map_rowindex(WebObject.mapto(this, result_items, readonly));
|
|
1299
|
-
WebObject.setReadonly(res, readonly);
|
|
1300
|
-
return _context23.abrupt("return", res);
|
|
1301
|
-
case 14:
|
|
1302
|
-
case "end":
|
|
1303
|
-
return _context23.stop();
|
|
1304
|
-
}
|
|
1305
|
-
}, _callee23, this);
|
|
1306
|
-
}));
|
|
1307
|
-
function get_list() {
|
|
1308
|
-
return _get_list.apply(this, arguments);
|
|
1309
|
-
}
|
|
1310
|
-
return get_list;
|
|
1311
|
-
}())
|
|
1312
|
-
}]);
|
|
1313
|
-
return WebObject;
|
|
1314
|
-
}(_index3.SimpleObject);
|
|
1315
|
-
_defineProperty(WebObject, "__web_path", "");
|
|
1316
|
-
_defineProperty(WebObject, "__protectedProperties", ["_users"]);
|
|
1317
|
-
//you cant create a new weboject without these properties
|
|
1318
|
-
_defineProperty(WebObject, "__requiredProperties", []);
|
|
1319
|
-
var _default = exports["default"] = WebObject;
|