@azrico/webobject 1.4.58 → 1.4.60
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.
|
@@ -75,6 +75,15 @@ export declare class WebObject extends SimpleObject {
|
|
|
75
75
|
Delete(): Promise<boolean>;
|
|
76
76
|
canSave(deltaObj?: any): true | string;
|
|
77
77
|
deltaIsValid(d: any): true | string;
|
|
78
|
+
/**
|
|
79
|
+
* filter fields of the delta object and prepare them for saving into db
|
|
80
|
+
* this is usually used on SERVER after client sends get_deltaObject result to them
|
|
81
|
+
* so server parses the deltaObject again to make sure data is not broken during send
|
|
82
|
+
* @param inputobject
|
|
83
|
+
* @param p
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
filterDeltaObject(inputobject: any, p?: deltaParams): Promise<any>;
|
|
78
87
|
/**
|
|
79
88
|
* You will post this to the server for saving
|
|
80
89
|
* automatically removes unchangable fields
|
|
@@ -196,6 +196,44 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
196
196
|
value: function deltaIsValid(d) {
|
|
197
197
|
return true;
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* filter fields of the delta object and prepare them for saving into db
|
|
201
|
+
* this is usually used on SERVER after client sends get_deltaObject result to them
|
|
202
|
+
* so server parses the deltaObject again to make sure data is not broken during send
|
|
203
|
+
* @param inputobject
|
|
204
|
+
* @param p
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
}, {
|
|
208
|
+
key: "filterDeltaObject",
|
|
209
|
+
value: function () {
|
|
210
|
+
var _filterDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(inputobject, p) {
|
|
211
|
+
var tempusers;
|
|
212
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
213
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
214
|
+
case 0:
|
|
215
|
+
/* -------------------------------------------------------------------------- */
|
|
216
|
+
/* fix _user property */
|
|
217
|
+
/* -------------------------------------------------------------------------- */
|
|
218
|
+
if (inputobject["_users"]) {
|
|
219
|
+
tempusers = inputobject["_users"];
|
|
220
|
+
if (typeof tempusers === "string") tempusers = tempusers.split(",").filter(function (s) {
|
|
221
|
+
return s;
|
|
222
|
+
});
|
|
223
|
+
inputobject["_users"] = (0, _object.wrap_array)(tempusers);
|
|
224
|
+
}
|
|
225
|
+
return _context3.abrupt("return", inputobject);
|
|
226
|
+
case 2:
|
|
227
|
+
case "end":
|
|
228
|
+
return _context3.stop();
|
|
229
|
+
}
|
|
230
|
+
}, _callee3);
|
|
231
|
+
}));
|
|
232
|
+
function filterDeltaObject(_x, _x2) {
|
|
233
|
+
return _filterDeltaObject.apply(this, arguments);
|
|
234
|
+
}
|
|
235
|
+
return filterDeltaObject;
|
|
236
|
+
}()
|
|
199
237
|
/**
|
|
200
238
|
* You will post this to the server for saving
|
|
201
239
|
* automatically removes unchangable fields
|
|
@@ -204,79 +242,79 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
204
242
|
}, {
|
|
205
243
|
key: "get_deltaObject",
|
|
206
244
|
value: function () {
|
|
207
|
-
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
245
|
+
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(p) {
|
|
208
246
|
var _this2 = this;
|
|
209
|
-
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, formats, use_formats, simpleProps, _loop, formatname, parseObj, _parseObj, _iterator, _step, key
|
|
210
|
-
return _regeneratorRuntime().wrap(function
|
|
211
|
-
while (1) switch (
|
|
247
|
+
var final_object, isChild, useDelta, allProperties, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, formats, use_formats, simpleProps, _loop, formatname, parseObj, _parseObj, _iterator, _step, key;
|
|
248
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
249
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
212
250
|
case 0:
|
|
213
251
|
_parseObj = function _parseObj3() {
|
|
214
|
-
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
252
|
+
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(obj) {
|
|
215
253
|
var newobj_dlt;
|
|
216
|
-
return _regeneratorRuntime().wrap(function
|
|
217
|
-
while (1) switch (
|
|
254
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
255
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
218
256
|
case 0:
|
|
219
257
|
if (!(obj == null)) {
|
|
220
|
-
|
|
258
|
+
_context6.next = 2;
|
|
221
259
|
break;
|
|
222
260
|
}
|
|
223
|
-
return
|
|
261
|
+
return _context6.abrupt("return", undefined);
|
|
224
262
|
case 2:
|
|
225
263
|
if (!Array.isArray(obj)) {
|
|
226
|
-
|
|
264
|
+
_context6.next = 6;
|
|
227
265
|
break;
|
|
228
266
|
}
|
|
229
|
-
|
|
267
|
+
_context6.next = 5;
|
|
230
268
|
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
231
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
232
|
-
return _regeneratorRuntime().wrap(function
|
|
233
|
-
while (1) switch (
|
|
269
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(r) {
|
|
270
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
271
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
234
272
|
case 0:
|
|
235
|
-
|
|
273
|
+
_context5.next = 2;
|
|
236
274
|
return parseObj(r);
|
|
237
275
|
case 2:
|
|
238
|
-
return
|
|
276
|
+
return _context5.abrupt("return", _context5.sent);
|
|
239
277
|
case 3:
|
|
240
278
|
case "end":
|
|
241
|
-
return
|
|
279
|
+
return _context5.stop();
|
|
242
280
|
}
|
|
243
|
-
},
|
|
281
|
+
}, _callee4);
|
|
244
282
|
}));
|
|
245
|
-
return function (
|
|
283
|
+
return function (_x5) {
|
|
246
284
|
return _ref.apply(this, arguments);
|
|
247
285
|
};
|
|
248
286
|
}()));
|
|
249
287
|
case 5:
|
|
250
|
-
return
|
|
288
|
+
return _context6.abrupt("return", _context6.sent);
|
|
251
289
|
case 6:
|
|
252
290
|
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
253
|
-
|
|
291
|
+
_context6.next = 15;
|
|
254
292
|
break;
|
|
255
293
|
}
|
|
256
|
-
|
|
294
|
+
_context6.next = 9;
|
|
257
295
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
258
296
|
isChild: true
|
|
259
297
|
}));
|
|
260
298
|
case 9:
|
|
261
|
-
newobj_dlt =
|
|
299
|
+
newobj_dlt = _context6.sent;
|
|
262
300
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
263
|
-
|
|
301
|
+
_context6.next = 14;
|
|
264
302
|
break;
|
|
265
303
|
}
|
|
266
|
-
return
|
|
304
|
+
return _context6.abrupt("return", newobj_dlt);
|
|
267
305
|
case 14:
|
|
268
|
-
return
|
|
306
|
+
return _context6.abrupt("return", obj);
|
|
269
307
|
case 15:
|
|
270
|
-
return
|
|
308
|
+
return _context6.abrupt("return", obj);
|
|
271
309
|
case 16:
|
|
272
310
|
case "end":
|
|
273
|
-
return
|
|
311
|
+
return _context6.stop();
|
|
274
312
|
}
|
|
275
|
-
},
|
|
313
|
+
}, _callee5);
|
|
276
314
|
}));
|
|
277
315
|
return _parseObj.apply(this, arguments);
|
|
278
316
|
};
|
|
279
|
-
parseObj = function _parseObj2(
|
|
317
|
+
parseObj = function _parseObj2(_x4) {
|
|
280
318
|
return _parseObj.apply(this, arguments);
|
|
281
319
|
};
|
|
282
320
|
if (!p) p = {};
|
|
@@ -309,7 +347,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
309
347
|
/* -------------------------------------------------------------------------- */
|
|
310
348
|
formats = (0, _object.object_getStatic)(this, "__formatList");
|
|
311
349
|
if (!formats) {
|
|
312
|
-
|
|
350
|
+
_context7.next = 27;
|
|
313
351
|
break;
|
|
314
352
|
}
|
|
315
353
|
use_formats = _objectSpread({}, formats);
|
|
@@ -317,8 +355,8 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
317
355
|
delete use_formats.simple;
|
|
318
356
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(formatname) {
|
|
319
357
|
var formatKeys;
|
|
320
|
-
return _regeneratorRuntime().wrap(function _loop$(
|
|
321
|
-
while (1) switch (
|
|
358
|
+
return _regeneratorRuntime().wrap(function _loop$(_context4) {
|
|
359
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
322
360
|
case 0:
|
|
323
361
|
formatKeys = use_formats[formatname];
|
|
324
362
|
if (Array.isArray(formatKeys)) {
|
|
@@ -330,20 +368,20 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
330
368
|
}
|
|
331
369
|
case 2:
|
|
332
370
|
case "end":
|
|
333
|
-
return
|
|
371
|
+
return _context4.stop();
|
|
334
372
|
}
|
|
335
373
|
}, _loop);
|
|
336
374
|
});
|
|
337
|
-
|
|
375
|
+
_context7.t0 = _regeneratorRuntime().keys(use_formats);
|
|
338
376
|
case 21:
|
|
339
|
-
if ((
|
|
340
|
-
|
|
377
|
+
if ((_context7.t1 = _context7.t0()).done) {
|
|
378
|
+
_context7.next = 26;
|
|
341
379
|
break;
|
|
342
380
|
}
|
|
343
|
-
formatname =
|
|
344
|
-
return
|
|
381
|
+
formatname = _context7.t1.value;
|
|
382
|
+
return _context7.delegateYield(_loop(formatname), "t2", 24);
|
|
345
383
|
case 24:
|
|
346
|
-
|
|
384
|
+
_context7.next = 21;
|
|
347
385
|
break;
|
|
348
386
|
case 26:
|
|
349
387
|
/* -------------------------------------------------------------------------- */
|
|
@@ -362,32 +400,32 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
362
400
|
}
|
|
363
401
|
case 27:
|
|
364
402
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
365
|
-
|
|
403
|
+
_context7.prev = 28;
|
|
366
404
|
_iterator.s();
|
|
367
405
|
case 30:
|
|
368
406
|
if ((_step = _iterator.n()).done) {
|
|
369
|
-
|
|
407
|
+
_context7.next = 37;
|
|
370
408
|
break;
|
|
371
409
|
}
|
|
372
410
|
key = _step.value;
|
|
373
|
-
|
|
411
|
+
_context7.next = 34;
|
|
374
412
|
return parseObj(dlt[key]);
|
|
375
413
|
case 34:
|
|
376
|
-
final_object[key] =
|
|
414
|
+
final_object[key] = _context7.sent;
|
|
377
415
|
case 35:
|
|
378
|
-
|
|
416
|
+
_context7.next = 30;
|
|
379
417
|
break;
|
|
380
418
|
case 37:
|
|
381
|
-
|
|
419
|
+
_context7.next = 42;
|
|
382
420
|
break;
|
|
383
421
|
case 39:
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
_iterator.e(
|
|
422
|
+
_context7.prev = 39;
|
|
423
|
+
_context7.t3 = _context7["catch"](28);
|
|
424
|
+
_iterator.e(_context7.t3);
|
|
387
425
|
case 42:
|
|
388
|
-
|
|
426
|
+
_context7.prev = 42;
|
|
389
427
|
_iterator.f();
|
|
390
|
-
return
|
|
428
|
+
return _context7.finish(42);
|
|
391
429
|
case 45:
|
|
392
430
|
/* -------------------------------------------------------------------------- */
|
|
393
431
|
/* add id properties */
|
|
@@ -398,24 +436,17 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
398
436
|
final_object["_index_value"] = this.getIndex();
|
|
399
437
|
final_object["_created_date"] = this["_created_date"];
|
|
400
438
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
/* -------------------------------------------------------------------------- */
|
|
404
|
-
if (final_object["_users"]) {
|
|
405
|
-
tempusers = final_object["_users"];
|
|
406
|
-
if (typeof tempusers === "string") tempusers = tempusers.split(",").filter(function (s) {
|
|
407
|
-
return s;
|
|
408
|
-
});
|
|
409
|
-
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
410
|
-
}
|
|
411
|
-
return _context6.abrupt("return", final_object);
|
|
439
|
+
_context7.next = 48;
|
|
440
|
+
return this.filterDeltaObject(final_object, p);
|
|
412
441
|
case 48:
|
|
442
|
+
return _context7.abrupt("return", _context7.sent);
|
|
443
|
+
case 49:
|
|
413
444
|
case "end":
|
|
414
|
-
return
|
|
445
|
+
return _context7.stop();
|
|
415
446
|
}
|
|
416
|
-
},
|
|
447
|
+
}, _callee6, this, [[28, 39, 42, 45]]);
|
|
417
448
|
}));
|
|
418
|
-
function get_deltaObject(
|
|
449
|
+
function get_deltaObject(_x3) {
|
|
419
450
|
return _get_deltaObject.apply(this, arguments);
|
|
420
451
|
}
|
|
421
452
|
return get_deltaObject;
|
|
@@ -439,28 +470,28 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
439
470
|
}, {
|
|
440
471
|
key: "onDelete",
|
|
441
472
|
value: function () {
|
|
442
|
-
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
473
|
+
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
443
474
|
var _this$manager;
|
|
444
475
|
var _len,
|
|
445
476
|
p,
|
|
446
477
|
_key,
|
|
447
|
-
|
|
448
|
-
return _regeneratorRuntime().wrap(function
|
|
449
|
-
while (1) switch (
|
|
478
|
+
_args8 = arguments;
|
|
479
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
480
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
450
481
|
case 0:
|
|
451
482
|
this.isDeleted = true;
|
|
452
|
-
for (_len =
|
|
453
|
-
p[_key] =
|
|
483
|
+
for (_len = _args8.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
484
|
+
p[_key] = _args8[_key];
|
|
454
485
|
}
|
|
455
|
-
|
|
486
|
+
_context8.next = 4;
|
|
456
487
|
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
|
|
457
488
|
case 4:
|
|
458
|
-
return
|
|
489
|
+
return _context8.abrupt("return", _context8.sent);
|
|
459
490
|
case 5:
|
|
460
491
|
case "end":
|
|
461
|
-
return
|
|
492
|
+
return _context8.stop();
|
|
462
493
|
}
|
|
463
|
-
},
|
|
494
|
+
}, _callee7, this);
|
|
464
495
|
}));
|
|
465
496
|
function onDelete() {
|
|
466
497
|
return _onDelete.apply(this, arguments);
|
|
@@ -470,28 +501,28 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
470
501
|
}, {
|
|
471
502
|
key: "onLoad",
|
|
472
503
|
value: function () {
|
|
473
|
-
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
504
|
+
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
474
505
|
var _this$manager2;
|
|
475
506
|
var _len2,
|
|
476
507
|
p,
|
|
477
508
|
_key2,
|
|
478
|
-
|
|
479
|
-
return _regeneratorRuntime().wrap(function
|
|
480
|
-
while (1) switch (
|
|
509
|
+
_args9 = arguments;
|
|
510
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
511
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
481
512
|
case 0:
|
|
482
513
|
this.isDeleted = false;
|
|
483
|
-
for (_len2 =
|
|
484
|
-
p[_key2] =
|
|
514
|
+
for (_len2 = _args9.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
515
|
+
p[_key2] = _args9[_key2];
|
|
485
516
|
}
|
|
486
|
-
|
|
517
|
+
_context9.next = 4;
|
|
487
518
|
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onLoad.apply(_this$manager2, p);
|
|
488
519
|
case 4:
|
|
489
|
-
return
|
|
520
|
+
return _context9.abrupt("return", _context9.sent);
|
|
490
521
|
case 5:
|
|
491
522
|
case "end":
|
|
492
|
-
return
|
|
523
|
+
return _context9.stop();
|
|
493
524
|
}
|
|
494
|
-
},
|
|
525
|
+
}, _callee8, this);
|
|
495
526
|
}));
|
|
496
527
|
function onLoad() {
|
|
497
528
|
return _onLoad.apply(this, arguments);
|
|
@@ -501,47 +532,47 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
501
532
|
}, {
|
|
502
533
|
key: "onSave",
|
|
503
534
|
value: function () {
|
|
504
|
-
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
535
|
+
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
505
536
|
var _this$manager4;
|
|
506
537
|
var srObject,
|
|
507
538
|
_this$manager3,
|
|
508
539
|
_len3,
|
|
509
540
|
p,
|
|
510
541
|
_key3,
|
|
511
|
-
|
|
512
|
-
return _regeneratorRuntime().wrap(function
|
|
513
|
-
while (1) switch (
|
|
542
|
+
_args10 = arguments;
|
|
543
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
544
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
514
545
|
case 0:
|
|
515
546
|
if (!this.isSaved) {
|
|
516
|
-
|
|
547
|
+
_context10.next = 7;
|
|
517
548
|
break;
|
|
518
549
|
}
|
|
519
550
|
this.apply_changes();
|
|
520
551
|
srObject = this.getSaveResult(true);
|
|
521
552
|
if (!this.saveResultHasID(srObject)) {
|
|
522
|
-
|
|
553
|
+
_context10.next = 7;
|
|
523
554
|
break;
|
|
524
555
|
}
|
|
525
556
|
/* -------------------------------------------------------------------------- */
|
|
526
557
|
WebObject.LoadIdsFromSaveResult(this, srObject);
|
|
527
|
-
|
|
558
|
+
_context10.next = 7;
|
|
528
559
|
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.event_run("on_id_change");
|
|
529
560
|
case 7:
|
|
530
|
-
for (_len3 =
|
|
531
|
-
p[_key3] =
|
|
561
|
+
for (_len3 = _args10.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
562
|
+
p[_key3] = _args10[_key3];
|
|
532
563
|
}
|
|
533
|
-
|
|
564
|
+
_context10.next = 10;
|
|
534
565
|
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onSave.apply(_this$manager4, p);
|
|
535
566
|
case 10:
|
|
536
|
-
|
|
567
|
+
_context10.next = 12;
|
|
537
568
|
return this.onAfterSave();
|
|
538
569
|
case 12:
|
|
539
|
-
return
|
|
570
|
+
return _context10.abrupt("return", true);
|
|
540
571
|
case 13:
|
|
541
572
|
case "end":
|
|
542
|
-
return
|
|
573
|
+
return _context10.stop();
|
|
543
574
|
}
|
|
544
|
-
},
|
|
575
|
+
}, _callee9, this);
|
|
545
576
|
}));
|
|
546
577
|
function onSave() {
|
|
547
578
|
return _onSave.apply(this, arguments);
|
|
@@ -551,27 +582,27 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
551
582
|
}, {
|
|
552
583
|
key: "onAfterSave",
|
|
553
584
|
value: function () {
|
|
554
|
-
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
585
|
+
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
555
586
|
var _this$manager5;
|
|
556
587
|
var _len4,
|
|
557
588
|
p,
|
|
558
589
|
_key4,
|
|
559
|
-
|
|
560
|
-
return _regeneratorRuntime().wrap(function
|
|
561
|
-
while (1) switch (
|
|
590
|
+
_args11 = arguments;
|
|
591
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
592
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
562
593
|
case 0:
|
|
563
|
-
for (_len4 =
|
|
564
|
-
p[_key4] =
|
|
594
|
+
for (_len4 = _args11.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
595
|
+
p[_key4] = _args11[_key4];
|
|
565
596
|
}
|
|
566
|
-
|
|
597
|
+
_context11.next = 3;
|
|
567
598
|
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onAfterSave.apply(_this$manager5, p);
|
|
568
599
|
case 3:
|
|
569
|
-
return
|
|
600
|
+
return _context11.abrupt("return", true);
|
|
570
601
|
case 4:
|
|
571
602
|
case "end":
|
|
572
|
-
return
|
|
603
|
+
return _context11.stop();
|
|
573
604
|
}
|
|
574
|
-
},
|
|
605
|
+
}, _callee10, this);
|
|
575
606
|
}));
|
|
576
607
|
function onAfterSave() {
|
|
577
608
|
return _onAfterSave.apply(this, arguments);
|
|
@@ -596,27 +627,27 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
596
627
|
}, {
|
|
597
628
|
key: "onNew",
|
|
598
629
|
value: function () {
|
|
599
|
-
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
630
|
+
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
600
631
|
var _this$manager6;
|
|
601
632
|
var _len5,
|
|
602
633
|
p,
|
|
603
634
|
_key5,
|
|
604
|
-
|
|
605
|
-
return _regeneratorRuntime().wrap(function
|
|
606
|
-
while (1) switch (
|
|
635
|
+
_args12 = arguments;
|
|
636
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
637
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
607
638
|
case 0:
|
|
608
|
-
for (_len5 =
|
|
609
|
-
p[_key5] =
|
|
639
|
+
for (_len5 = _args12.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
640
|
+
p[_key5] = _args12[_key5];
|
|
610
641
|
}
|
|
611
|
-
|
|
642
|
+
_context12.next = 3;
|
|
612
643
|
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onNew.apply(_this$manager6, p);
|
|
613
644
|
case 3:
|
|
614
|
-
return
|
|
645
|
+
return _context12.abrupt("return", _context12.sent);
|
|
615
646
|
case 4:
|
|
616
647
|
case "end":
|
|
617
|
-
return
|
|
648
|
+
return _context12.stop();
|
|
618
649
|
}
|
|
619
|
-
},
|
|
650
|
+
}, _callee11, this);
|
|
620
651
|
}));
|
|
621
652
|
function onNew() {
|
|
622
653
|
return _onNew.apply(this, arguments);
|
|
@@ -679,7 +710,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
679
710
|
}, {
|
|
680
711
|
key: "saveList",
|
|
681
712
|
value: function () {
|
|
682
|
-
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
713
|
+
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(itemList) {
|
|
683
714
|
var _extraOptions$chunksi;
|
|
684
715
|
var extraOptions,
|
|
685
716
|
chunks,
|
|
@@ -696,11 +727,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
696
727
|
_item,
|
|
697
728
|
_index2,
|
|
698
729
|
_item2,
|
|
699
|
-
|
|
700
|
-
return _regeneratorRuntime().wrap(function
|
|
701
|
-
while (1) switch (
|
|
730
|
+
_args13 = arguments;
|
|
731
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
732
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
702
733
|
case 0:
|
|
703
|
-
extraOptions =
|
|
734
|
+
extraOptions = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
|
|
704
735
|
if (!extraOptions) extraOptions = {};
|
|
705
736
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
706
737
|
delete extraOptions.chunksize;
|
|
@@ -708,7 +739,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
708
739
|
index = 0;
|
|
709
740
|
case 6:
|
|
710
741
|
if (!(index < chunks.length)) {
|
|
711
|
-
|
|
742
|
+
_context13.next = 36;
|
|
712
743
|
break;
|
|
713
744
|
}
|
|
714
745
|
items_to_save = chunks[index];
|
|
@@ -716,83 +747,83 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
716
747
|
k = 0;
|
|
717
748
|
case 10:
|
|
718
749
|
if (!(k < items_to_save.length)) {
|
|
719
|
-
|
|
750
|
+
_context13.next = 19;
|
|
720
751
|
break;
|
|
721
752
|
}
|
|
722
753
|
item = items_to_save[k];
|
|
723
|
-
|
|
754
|
+
_context13.next = 14;
|
|
724
755
|
return item.get_deltaObject();
|
|
725
756
|
case 14:
|
|
726
|
-
dlt =
|
|
757
|
+
dlt = _context13.sent;
|
|
727
758
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
728
759
|
_id: item.getID()
|
|
729
760
|
}, dlt));
|
|
730
761
|
case 16:
|
|
731
762
|
k++;
|
|
732
|
-
|
|
763
|
+
_context13.next = 10;
|
|
733
764
|
break;
|
|
734
765
|
case 19:
|
|
735
|
-
|
|
766
|
+
_context13.next = 21;
|
|
736
767
|
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
737
768
|
__save_list: WebObject.zipSaveList(save_array)
|
|
738
769
|
}, extraOptions));
|
|
739
770
|
case 21:
|
|
740
|
-
resultObject =
|
|
771
|
+
resultObject = _context13.sent;
|
|
741
772
|
if (!Array.isArray(resultObject)) {
|
|
742
|
-
|
|
773
|
+
_context13.next = 33;
|
|
743
774
|
break;
|
|
744
775
|
}
|
|
745
776
|
_index = 0;
|
|
746
777
|
case 24:
|
|
747
778
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
748
|
-
|
|
779
|
+
_context13.next = 33;
|
|
749
780
|
break;
|
|
750
781
|
}
|
|
751
782
|
res = resultObject[_index];
|
|
752
783
|
_item = items_to_save[_index];
|
|
753
784
|
_item.setSaveResult(res);
|
|
754
|
-
|
|
785
|
+
_context13.next = 30;
|
|
755
786
|
return _item.onSave();
|
|
756
787
|
case 30:
|
|
757
788
|
_index++;
|
|
758
|
-
|
|
789
|
+
_context13.next = 24;
|
|
759
790
|
break;
|
|
760
791
|
case 33:
|
|
761
792
|
index++;
|
|
762
|
-
|
|
793
|
+
_context13.next = 6;
|
|
763
794
|
break;
|
|
764
795
|
case 36:
|
|
765
796
|
_index2 = 0;
|
|
766
797
|
case 37:
|
|
767
798
|
if (!(_index2 < itemList.length)) {
|
|
768
|
-
|
|
799
|
+
_context13.next = 46;
|
|
769
800
|
break;
|
|
770
801
|
}
|
|
771
802
|
_item2 = itemList[_index2];
|
|
772
803
|
if (_item2.isSaved) {
|
|
773
|
-
|
|
804
|
+
_context13.next = 41;
|
|
774
805
|
break;
|
|
775
806
|
}
|
|
776
|
-
return
|
|
807
|
+
return _context13.abrupt("return", false);
|
|
777
808
|
case 41:
|
|
778
809
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
779
|
-
|
|
810
|
+
_context13.next = 43;
|
|
780
811
|
break;
|
|
781
812
|
}
|
|
782
|
-
return
|
|
813
|
+
return _context13.abrupt("return", false);
|
|
783
814
|
case 43:
|
|
784
815
|
_index2++;
|
|
785
|
-
|
|
816
|
+
_context13.next = 37;
|
|
786
817
|
break;
|
|
787
818
|
case 46:
|
|
788
|
-
return
|
|
819
|
+
return _context13.abrupt("return", true);
|
|
789
820
|
case 47:
|
|
790
821
|
case "end":
|
|
791
|
-
return
|
|
822
|
+
return _context13.stop();
|
|
792
823
|
}
|
|
793
|
-
},
|
|
824
|
+
}, _callee12, this);
|
|
794
825
|
}));
|
|
795
|
-
function saveList(
|
|
826
|
+
function saveList(_x6) {
|
|
796
827
|
return _saveList.apply(this, arguments);
|
|
797
828
|
}
|
|
798
829
|
return saveList;
|
|
@@ -840,7 +871,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
840
871
|
}, {
|
|
841
872
|
key: "get_single",
|
|
842
873
|
value: function () {
|
|
843
|
-
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
874
|
+
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
844
875
|
var _len6,
|
|
845
876
|
p,
|
|
846
877
|
_key6,
|
|
@@ -849,55 +880,55 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
849
880
|
fetchID,
|
|
850
881
|
res,
|
|
851
882
|
params,
|
|
852
|
-
|
|
853
|
-
return _regeneratorRuntime().wrap(function
|
|
854
|
-
while (1) switch (
|
|
883
|
+
_args14 = arguments;
|
|
884
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context14) {
|
|
885
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
855
886
|
case 0:
|
|
856
|
-
for (_len6 =
|
|
857
|
-
p[_key6] =
|
|
887
|
+
for (_len6 = _args14.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
888
|
+
p[_key6] = _args14[_key6];
|
|
858
889
|
}
|
|
859
890
|
search = p.shift();
|
|
860
891
|
readonly = p.shift();
|
|
861
892
|
fetchID = p.shift();
|
|
862
893
|
if (!(0, _object.object_isEmpty)(search)) {
|
|
863
|
-
|
|
894
|
+
_context14.next = 6;
|
|
864
895
|
break;
|
|
865
896
|
}
|
|
866
|
-
return
|
|
897
|
+
return _context14.abrupt("return", undefined);
|
|
867
898
|
case 6:
|
|
868
899
|
params = {};
|
|
869
900
|
params.context = readonly ? "view" : "edit";
|
|
870
|
-
|
|
871
|
-
|
|
901
|
+
_context14.t0 = _typeof(search);
|
|
902
|
+
_context14.next = _context14.t0 === "string" ? 11 : _context14.t0 === "number" ? 11 : _context14.t0 === "object" ? 19 : 19;
|
|
872
903
|
break;
|
|
873
904
|
case 11:
|
|
874
905
|
search = String(search);
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
906
|
+
_context14.t1 = this;
|
|
907
|
+
_context14.t2 = this;
|
|
908
|
+
_context14.next = 16;
|
|
878
909
|
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
879
910
|
fetchID: fetchID
|
|
880
911
|
});
|
|
881
912
|
case 16:
|
|
882
|
-
|
|
883
|
-
res =
|
|
884
|
-
return
|
|
913
|
+
_context14.t3 = _context14.sent;
|
|
914
|
+
res = _context14.t1.ensure.call(_context14.t1, _context14.t2, _context14.t3);
|
|
915
|
+
return _context14.abrupt("break", 25);
|
|
885
916
|
case 19:
|
|
886
|
-
|
|
887
|
-
|
|
917
|
+
_context14.t4 = _object.object_first;
|
|
918
|
+
_context14.next = 22;
|
|
888
919
|
return this.get_list(search, readonly, fetchID);
|
|
889
920
|
case 22:
|
|
890
|
-
|
|
891
|
-
res = (0,
|
|
892
|
-
return
|
|
921
|
+
_context14.t5 = _context14.sent;
|
|
922
|
+
res = (0, _context14.t4)(_context14.t5);
|
|
923
|
+
return _context14.abrupt("break", 25);
|
|
893
924
|
case 25:
|
|
894
925
|
WebObject.setReadonly(res, readonly);
|
|
895
|
-
return
|
|
926
|
+
return _context14.abrupt("return", res);
|
|
896
927
|
case 27:
|
|
897
928
|
case "end":
|
|
898
|
-
return
|
|
929
|
+
return _context14.stop();
|
|
899
930
|
}
|
|
900
|
-
},
|
|
931
|
+
}, _callee13, this);
|
|
901
932
|
}));
|
|
902
933
|
function get_single() {
|
|
903
934
|
return _get_single.apply(this, arguments);
|
|
@@ -911,7 +942,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
911
942
|
}, {
|
|
912
943
|
key: "get_list",
|
|
913
944
|
value: function () {
|
|
914
|
-
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
945
|
+
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
915
946
|
var _len7,
|
|
916
947
|
p,
|
|
917
948
|
_key7,
|
|
@@ -921,32 +952,32 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
921
952
|
result_items,
|
|
922
953
|
selftype,
|
|
923
954
|
res,
|
|
924
|
-
|
|
925
|
-
return _regeneratorRuntime().wrap(function
|
|
926
|
-
while (1) switch (
|
|
955
|
+
_args15 = arguments;
|
|
956
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context15) {
|
|
957
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
927
958
|
case 0:
|
|
928
|
-
for (_len7 =
|
|
929
|
-
p[_key7] =
|
|
959
|
+
for (_len7 = _args15.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
960
|
+
p[_key7] = _args15[_key7];
|
|
930
961
|
}
|
|
931
962
|
search = p.shift();
|
|
932
963
|
readonly = p.shift();
|
|
933
964
|
fetchID = p.shift();
|
|
934
965
|
if (!search) search = {};
|
|
935
|
-
|
|
966
|
+
_context15.next = 7;
|
|
936
967
|
return _global.gfunc.run_action("get", this.__web_path, search, {
|
|
937
968
|
fetchID: fetchID
|
|
938
969
|
});
|
|
939
970
|
case 7:
|
|
940
|
-
result_items =
|
|
971
|
+
result_items = _context15.sent;
|
|
941
972
|
selftype = this.prototype;
|
|
942
973
|
res = WebObject.map_rowindex(WebObject.mapto(selftype, result_items, readonly));
|
|
943
974
|
WebObject.setReadonly(res, readonly);
|
|
944
|
-
return
|
|
975
|
+
return _context15.abrupt("return", res);
|
|
945
976
|
case 12:
|
|
946
977
|
case "end":
|
|
947
|
-
return
|
|
978
|
+
return _context15.stop();
|
|
948
979
|
}
|
|
949
|
-
},
|
|
980
|
+
}, _callee14, this);
|
|
950
981
|
}));
|
|
951
982
|
function get_list() {
|
|
952
983
|
return _get_list.apply(this, arguments);
|
|
@@ -890,7 +890,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
890
890
|
key: "hasIllegalChanges",
|
|
891
891
|
value: function hasIllegalChanges(referenceObject, changesObject, updaterUser) {
|
|
892
892
|
var __protectedProperties = (0, _object.object_getStatic)(referenceObject, "__protectedProperties");
|
|
893
|
-
if (
|
|
893
|
+
if ((0, _object.object_isEmpty)(__protectedProperties)) return false;
|
|
894
894
|
var referenceUser = (0, _object.object_isClass)(referenceObject) ? (0, _object.object_get)(changesObject, "__user", "_creator") : (0, _object.object_get)(referenceObject, "__user", "_creator");
|
|
895
895
|
if (Boolean(SimpleObject.getID(referenceUser) == SimpleObject.getID(updaterUser))) {
|
|
896
896
|
return false;
|