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