@azrico/webobject 1.4.17 → 1.4.18
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.
|
@@ -52,7 +52,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
52
52
|
* @returns value or undefined
|
|
53
53
|
*/
|
|
54
54
|
static getMetaValue(o: WebObject | null | undefined, key: string): any;
|
|
55
|
-
static saveList(itemList: WebObject[]): Promise<boolean>;
|
|
55
|
+
static saveList(itemList: WebObject[], extraOptions?: {}): Promise<boolean>;
|
|
56
56
|
Save(): Promise<boolean>;
|
|
57
57
|
Delete(): Promise<boolean>;
|
|
58
58
|
canSave(deltaObj?: any): true | string;
|
|
@@ -536,94 +536,110 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
536
536
|
key: "saveList",
|
|
537
537
|
value: function () {
|
|
538
538
|
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(itemList) {
|
|
539
|
-
var
|
|
539
|
+
var extraOptions,
|
|
540
|
+
chunks,
|
|
541
|
+
putAddress,
|
|
542
|
+
index,
|
|
543
|
+
items_to_save,
|
|
544
|
+
save_array,
|
|
545
|
+
k,
|
|
546
|
+
item,
|
|
547
|
+
dlt,
|
|
548
|
+
resultObject,
|
|
549
|
+
_index,
|
|
550
|
+
res,
|
|
551
|
+
_item,
|
|
552
|
+
_index2,
|
|
553
|
+
_item2,
|
|
554
|
+
_args10 = arguments;
|
|
540
555
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
541
556
|
while (1) switch (_context10.prev = _context10.next) {
|
|
542
557
|
case 0:
|
|
558
|
+
extraOptions = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
|
|
543
559
|
chunks = (0, _object.array_chunks)(itemList, 30);
|
|
544
560
|
putAddress = this.get_webname();
|
|
545
561
|
index = 0;
|
|
546
|
-
case
|
|
562
|
+
case 4:
|
|
547
563
|
if (!(index < chunks.length)) {
|
|
548
|
-
_context10.next =
|
|
564
|
+
_context10.next = 34;
|
|
549
565
|
break;
|
|
550
566
|
}
|
|
551
567
|
items_to_save = chunks[index];
|
|
552
568
|
save_array = [];
|
|
553
569
|
k = 0;
|
|
554
|
-
case
|
|
570
|
+
case 8:
|
|
555
571
|
if (!(k < items_to_save.length)) {
|
|
556
|
-
_context10.next =
|
|
572
|
+
_context10.next = 17;
|
|
557
573
|
break;
|
|
558
574
|
}
|
|
559
575
|
item = items_to_save[k];
|
|
560
|
-
_context10.next =
|
|
576
|
+
_context10.next = 12;
|
|
561
577
|
return item.get_deltaObject();
|
|
562
|
-
case
|
|
578
|
+
case 12:
|
|
563
579
|
dlt = _context10.sent;
|
|
564
580
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
565
581
|
_id: item.getID()
|
|
566
582
|
}, dlt));
|
|
567
|
-
case
|
|
583
|
+
case 14:
|
|
568
584
|
k++;
|
|
569
|
-
_context10.next =
|
|
585
|
+
_context10.next = 8;
|
|
570
586
|
break;
|
|
571
|
-
case
|
|
572
|
-
_context10.next =
|
|
573
|
-
return _global.gfunc.run_action("post", putAddress, {
|
|
587
|
+
case 17:
|
|
588
|
+
_context10.next = 19;
|
|
589
|
+
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
574
590
|
__save_list: save_array
|
|
575
|
-
});
|
|
576
|
-
case
|
|
591
|
+
}, extraOptions));
|
|
592
|
+
case 19:
|
|
577
593
|
resultObject = _context10.sent;
|
|
578
594
|
if (!Array.isArray(resultObject)) {
|
|
579
|
-
_context10.next =
|
|
595
|
+
_context10.next = 31;
|
|
580
596
|
break;
|
|
581
597
|
}
|
|
582
598
|
_index = 0;
|
|
583
|
-
case
|
|
599
|
+
case 22:
|
|
584
600
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
585
|
-
_context10.next =
|
|
601
|
+
_context10.next = 31;
|
|
586
602
|
break;
|
|
587
603
|
}
|
|
588
604
|
res = resultObject[_index];
|
|
589
605
|
_item = items_to_save[_index];
|
|
590
606
|
_item.setSaveResult(res);
|
|
591
|
-
_context10.next =
|
|
607
|
+
_context10.next = 28;
|
|
592
608
|
return _item.onSave();
|
|
593
|
-
case
|
|
609
|
+
case 28:
|
|
594
610
|
_index++;
|
|
595
|
-
_context10.next =
|
|
611
|
+
_context10.next = 22;
|
|
596
612
|
break;
|
|
597
|
-
case
|
|
613
|
+
case 31:
|
|
598
614
|
index++;
|
|
599
|
-
_context10.next =
|
|
615
|
+
_context10.next = 4;
|
|
600
616
|
break;
|
|
601
|
-
case 33:
|
|
602
|
-
_index2 = 0;
|
|
603
617
|
case 34:
|
|
618
|
+
_index2 = 0;
|
|
619
|
+
case 35:
|
|
604
620
|
if (!(_index2 < itemList.length)) {
|
|
605
|
-
_context10.next =
|
|
621
|
+
_context10.next = 44;
|
|
606
622
|
break;
|
|
607
623
|
}
|
|
608
624
|
_item2 = itemList[_index2];
|
|
609
625
|
if (_item2.isSaved) {
|
|
610
|
-
_context10.next =
|
|
626
|
+
_context10.next = 39;
|
|
611
627
|
break;
|
|
612
628
|
}
|
|
613
629
|
return _context10.abrupt("return", false);
|
|
614
|
-
case
|
|
630
|
+
case 39:
|
|
615
631
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
616
|
-
_context10.next =
|
|
632
|
+
_context10.next = 41;
|
|
617
633
|
break;
|
|
618
634
|
}
|
|
619
635
|
return _context10.abrupt("return", false);
|
|
620
|
-
case
|
|
636
|
+
case 41:
|
|
621
637
|
_index2++;
|
|
622
|
-
_context10.next =
|
|
638
|
+
_context10.next = 35;
|
|
623
639
|
break;
|
|
624
|
-
case 43:
|
|
625
|
-
return _context10.abrupt("return", true);
|
|
626
640
|
case 44:
|
|
641
|
+
return _context10.abrupt("return", true);
|
|
642
|
+
case 45:
|
|
627
643
|
case "end":
|
|
628
644
|
return _context10.stop();
|
|
629
645
|
}
|
|
@@ -792,9 +792,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
|
|
|
792
792
|
key: "getSaveResult",
|
|
793
793
|
value: function getSaveResult() {
|
|
794
794
|
var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
795
|
-
if (this.isSaved)
|
|
796
|
-
return this.__saveResultObject;
|
|
797
|
-
}
|
|
795
|
+
if (this.isSaved) return this.__saveResultObject;
|
|
798
796
|
return false;
|
|
799
797
|
}
|
|
800
798
|
}, {
|