@azrico/webobject 1.4.17 → 1.4.19

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,9 @@ 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?: {
56
+ [key: string]: any;
57
+ }): Promise<boolean>;
56
58
  Save(): Promise<boolean>;
57
59
  Delete(): Promise<boolean>;
58
60
  canSave(deltaObj?: any): true | string;
@@ -536,94 +536,113 @@ 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 chunks, putAddress, index, items_to_save, save_array, k, item, dlt, resultObject, _index, res, _item, _index2, _item2;
539
+ var _extraOptions$chunksi;
540
+ var extraOptions,
541
+ chunks,
542
+ putAddress,
543
+ index,
544
+ items_to_save,
545
+ save_array,
546
+ k,
547
+ item,
548
+ dlt,
549
+ resultObject,
550
+ _index,
551
+ res,
552
+ _item,
553
+ _index2,
554
+ _item2,
555
+ _args10 = arguments;
540
556
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
541
557
  while (1) switch (_context10.prev = _context10.next) {
542
558
  case 0:
543
- chunks = (0, _object.array_chunks)(itemList, 30);
559
+ extraOptions = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
560
+ if (!extraOptions) extraOptions = {};
561
+ chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
562
+ delete extraOptions.chunksize;
544
563
  putAddress = this.get_webname();
545
564
  index = 0;
546
- case 3:
565
+ case 6:
547
566
  if (!(index < chunks.length)) {
548
- _context10.next = 33;
567
+ _context10.next = 36;
549
568
  break;
550
569
  }
551
570
  items_to_save = chunks[index];
552
571
  save_array = [];
553
572
  k = 0;
554
- case 7:
573
+ case 10:
555
574
  if (!(k < items_to_save.length)) {
556
- _context10.next = 16;
575
+ _context10.next = 19;
557
576
  break;
558
577
  }
559
578
  item = items_to_save[k];
560
- _context10.next = 11;
579
+ _context10.next = 14;
561
580
  return item.get_deltaObject();
562
- case 11:
581
+ case 14:
563
582
  dlt = _context10.sent;
564
583
  save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
565
584
  _id: item.getID()
566
585
  }, dlt));
567
- case 13:
586
+ case 16:
568
587
  k++;
569
- _context10.next = 7;
588
+ _context10.next = 10;
570
589
  break;
571
- case 16:
572
- _context10.next = 18;
573
- return _global.gfunc.run_action("post", putAddress, {
590
+ case 19:
591
+ _context10.next = 21;
592
+ return _global.gfunc.run_action("post", putAddress, _objectSpread({
574
593
  __save_list: save_array
575
- });
576
- case 18:
594
+ }, extraOptions));
595
+ case 21:
577
596
  resultObject = _context10.sent;
578
597
  if (!Array.isArray(resultObject)) {
579
- _context10.next = 30;
598
+ _context10.next = 33;
580
599
  break;
581
600
  }
582
601
  _index = 0;
583
- case 21:
602
+ case 24:
584
603
  if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
585
- _context10.next = 30;
604
+ _context10.next = 33;
586
605
  break;
587
606
  }
588
607
  res = resultObject[_index];
589
608
  _item = items_to_save[_index];
590
609
  _item.setSaveResult(res);
591
- _context10.next = 27;
610
+ _context10.next = 30;
592
611
  return _item.onSave();
593
- case 27:
612
+ case 30:
594
613
  _index++;
595
- _context10.next = 21;
614
+ _context10.next = 24;
596
615
  break;
597
- case 30:
616
+ case 33:
598
617
  index++;
599
- _context10.next = 3;
618
+ _context10.next = 6;
600
619
  break;
601
- case 33:
620
+ case 36:
602
621
  _index2 = 0;
603
- case 34:
622
+ case 37:
604
623
  if (!(_index2 < itemList.length)) {
605
- _context10.next = 43;
624
+ _context10.next = 46;
606
625
  break;
607
626
  }
608
627
  _item2 = itemList[_index2];
609
628
  if (_item2.isSaved) {
610
- _context10.next = 38;
629
+ _context10.next = 41;
611
630
  break;
612
631
  }
613
632
  return _context10.abrupt("return", false);
614
- case 38:
633
+ case 41:
615
634
  if (!(_item2.getSaveResultType() != "normal")) {
616
- _context10.next = 40;
635
+ _context10.next = 43;
617
636
  break;
618
637
  }
619
638
  return _context10.abrupt("return", false);
620
- case 40:
639
+ case 43:
621
640
  _index2++;
622
- _context10.next = 34;
641
+ _context10.next = 37;
623
642
  break;
624
- case 43:
643
+ case 46:
625
644
  return _context10.abrupt("return", true);
626
- case 44:
645
+ case 47:
627
646
  case "end":
628
647
  return _context10.stop();
629
648
  }
@@ -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
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.17",
3
+ "version": "1.4.19",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",