@azrico/webobject 1.4.133 → 1.4.135

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/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # deus-object
2
-
3
- > Some useful object functions
4
-
5
- ## Install
6
-
7
- ```bash
8
- yarn add @azrico/webobject
9
- ```
1
+ # deus-object
2
+
3
+ > Some useful object functions
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ yarn add @azrico/webobject
9
+ ```
@@ -64,6 +64,8 @@ export declare class WebObject extends SimpleObject {
64
64
  }): Promise<boolean>;
65
65
  Save(): Promise<any>;
66
66
  Delete(): Promise<any>;
67
+ Lock(): Promise<any>;
68
+ UnLock(): Promise<any>;
67
69
  Archive(): Promise<any>;
68
70
  UnArchive(): Promise<any>;
69
71
  canSave(deltaObj?: any): true | string;
@@ -91,6 +93,8 @@ export declare class WebObject extends SimpleObject {
91
93
  onDelete(...p: any): Promise<any>;
92
94
  onArchive(...p: any): Promise<any>;
93
95
  onUnArchive(...p: any): Promise<any>;
96
+ onLock(...p: any): Promise<any>;
97
+ onUnLock(...p: any): Promise<any>;
94
98
  onLoad(...p: any): Promise<any>;
95
99
  onSave(...p: any): Promise<any>;
96
100
  onAfterSave(...p: any): Promise<any>;
@@ -260,9 +260,9 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
260
260
  return Delete;
261
261
  }()
262
262
  }, {
263
- key: "Archive",
263
+ key: "Lock",
264
264
  value: function () {
265
- var _Archive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
265
+ var _Lock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
266
266
  var resultObject;
267
267
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
268
268
  while (1) switch (_context4.prev = _context4.next) {
@@ -274,12 +274,12 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
274
274
  return _context4.abrupt("return");
275
275
  case 2:
276
276
  _context4.next = 4;
277
- return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/archive"));
277
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/lock"));
278
278
  case 4:
279
279
  resultObject = _context4.sent;
280
280
  this.setSaveResult(resultObject, "auto", true);
281
281
  _context4.next = 8;
282
- return this.onArchive();
282
+ return this.onLock();
283
283
  case 8:
284
284
  return _context4.abrupt("return", resultObject);
285
285
  case 9:
@@ -288,32 +288,32 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
288
288
  }
289
289
  }, _callee4, this);
290
290
  }));
291
- function Archive() {
292
- return _Archive.apply(this, arguments);
291
+ function Lock() {
292
+ return _Lock.apply(this, arguments);
293
293
  }
294
- return Archive;
294
+ return Lock;
295
295
  }()
296
296
  }, {
297
- key: "UnArchive",
297
+ key: "UnLock",
298
298
  value: function () {
299
- var _UnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
299
+ var _UnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
300
300
  var resultObject;
301
301
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
302
302
  while (1) switch (_context5.prev = _context5.next) {
303
303
  case 0:
304
- if (!(this.isNew || !this.isArchived)) {
304
+ if (!(this.isNew || this.isArchived)) {
305
305
  _context5.next = 2;
306
306
  break;
307
307
  }
308
308
  return _context5.abrupt("return");
309
309
  case 2:
310
310
  _context5.next = 4;
311
- return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/unarchive"));
311
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/unlock"));
312
312
  case 4:
313
313
  resultObject = _context5.sent;
314
314
  this.setSaveResult(resultObject, "auto", true);
315
315
  _context5.next = 8;
316
- return this.onUnArchive();
316
+ return this.onUnLock();
317
317
  case 8:
318
318
  return _context5.abrupt("return", resultObject);
319
319
  case 9:
@@ -322,6 +322,74 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
322
322
  }
323
323
  }, _callee5, this);
324
324
  }));
325
+ function UnLock() {
326
+ return _UnLock.apply(this, arguments);
327
+ }
328
+ return UnLock;
329
+ }()
330
+ }, {
331
+ key: "Archive",
332
+ value: function () {
333
+ var _Archive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
334
+ var resultObject;
335
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
336
+ while (1) switch (_context6.prev = _context6.next) {
337
+ case 0:
338
+ if (!(this.isNew || this.isArchived)) {
339
+ _context6.next = 2;
340
+ break;
341
+ }
342
+ return _context6.abrupt("return");
343
+ case 2:
344
+ _context6.next = 4;
345
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/archive"));
346
+ case 4:
347
+ resultObject = _context6.sent;
348
+ this.setSaveResult(resultObject, "auto", true);
349
+ _context6.next = 8;
350
+ return this.onArchive();
351
+ case 8:
352
+ return _context6.abrupt("return", resultObject);
353
+ case 9:
354
+ case "end":
355
+ return _context6.stop();
356
+ }
357
+ }, _callee6, this);
358
+ }));
359
+ function Archive() {
360
+ return _Archive.apply(this, arguments);
361
+ }
362
+ return Archive;
363
+ }()
364
+ }, {
365
+ key: "UnArchive",
366
+ value: function () {
367
+ var _UnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
368
+ var resultObject;
369
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
370
+ while (1) switch (_context7.prev = _context7.next) {
371
+ case 0:
372
+ if (!(this.isNew || !this.isArchived)) {
373
+ _context7.next = 2;
374
+ break;
375
+ }
376
+ return _context7.abrupt("return");
377
+ case 2:
378
+ _context7.next = 4;
379
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/unarchive"));
380
+ case 4:
381
+ resultObject = _context7.sent;
382
+ this.setSaveResult(resultObject, "auto", true);
383
+ _context7.next = 8;
384
+ return this.onUnArchive();
385
+ case 8:
386
+ return _context7.abrupt("return", resultObject);
387
+ case 9:
388
+ case "end":
389
+ return _context7.stop();
390
+ }
391
+ }, _callee7, this);
392
+ }));
325
393
  function UnArchive() {
326
394
  return _UnArchive.apply(this, arguments);
327
395
  }
@@ -358,22 +426,22 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
358
426
  }, {
359
427
  key: "get_fullDeltaObject",
360
428
  value: (function () {
361
- var _get_fullDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(p) {
362
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
363
- while (1) switch (_context6.prev = _context6.next) {
429
+ var _get_fullDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(p) {
430
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
431
+ while (1) switch (_context8.prev = _context8.next) {
364
432
  case 0:
365
- _context6.next = 2;
433
+ _context8.next = 2;
366
434
  return this.get_deltaObject({
367
435
  allProperties: true,
368
436
  extraProperties: true
369
437
  });
370
438
  case 2:
371
- return _context6.abrupt("return", _context6.sent);
439
+ return _context8.abrupt("return", _context8.sent);
372
440
  case 3:
373
441
  case "end":
374
- return _context6.stop();
442
+ return _context8.stop();
375
443
  }
376
- }, _callee6, this);
444
+ }, _callee8, this);
377
445
  }));
378
446
  function get_fullDeltaObject(_x3) {
379
447
  return _get_fullDeltaObject.apply(this, arguments);
@@ -389,75 +457,75 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
389
457
  }, {
390
458
  key: "get_deltaObject",
391
459
  value: (function () {
392
- var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(p) {
460
+ var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(p) {
393
461
  var _this2 = this;
394
462
  var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _parseObj, _iterator, _step, key, tempusers;
395
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
396
- while (1) switch (_context9.prev = _context9.next) {
463
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
464
+ while (1) switch (_context11.prev = _context11.next) {
397
465
  case 0:
398
466
  _parseObj = function _parseObj3() {
399
- _parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(obj) {
467
+ _parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(obj) {
400
468
  var newobj_dlt;
401
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
402
- while (1) switch (_context8.prev = _context8.next) {
469
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
470
+ while (1) switch (_context10.prev = _context10.next) {
403
471
  case 0:
404
472
  if (!(obj == null)) {
405
- _context8.next = 2;
473
+ _context10.next = 2;
406
474
  break;
407
475
  }
408
- return _context8.abrupt("return", undefined);
476
+ return _context10.abrupt("return", undefined);
409
477
  case 2:
410
478
  if (!Array.isArray(obj)) {
411
- _context8.next = 6;
479
+ _context10.next = 6;
412
480
  break;
413
481
  }
414
- _context8.next = 5;
482
+ _context10.next = 5;
415
483
  return Promise.all(obj.map( /*#__PURE__*/function () {
416
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(r) {
417
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
418
- while (1) switch (_context7.prev = _context7.next) {
484
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
485
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
486
+ while (1) switch (_context9.prev = _context9.next) {
419
487
  case 0:
420
- _context7.next = 2;
488
+ _context9.next = 2;
421
489
  return parseObj(r);
422
490
  case 2:
423
- return _context7.abrupt("return", _context7.sent);
491
+ return _context9.abrupt("return", _context9.sent);
424
492
  case 3:
425
493
  case "end":
426
- return _context7.stop();
494
+ return _context9.stop();
427
495
  }
428
- }, _callee7);
496
+ }, _callee9);
429
497
  }));
430
498
  return function (_x6) {
431
499
  return _ref.apply(this, arguments);
432
500
  };
433
501
  }()));
434
502
  case 5:
435
- return _context8.abrupt("return", _context8.sent);
503
+ return _context10.abrupt("return", _context10.sent);
436
504
  case 6:
437
505
  if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
438
- _context8.next = 15;
506
+ _context10.next = 15;
439
507
  break;
440
508
  }
441
- _context8.next = 9;
509
+ _context10.next = 9;
442
510
  return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
443
511
  isChild: true
444
512
  }));
445
513
  case 9:
446
- newobj_dlt = _context8.sent;
514
+ newobj_dlt = _context10.sent;
447
515
  if ((0, _object.object_isEmpty)(newobj_dlt)) {
448
- _context8.next = 14;
516
+ _context10.next = 14;
449
517
  break;
450
518
  }
451
- return _context8.abrupt("return", newobj_dlt);
519
+ return _context10.abrupt("return", newobj_dlt);
452
520
  case 14:
453
- return _context8.abrupt("return", obj);
521
+ return _context10.abrupt("return", obj);
454
522
  case 15:
455
- return _context8.abrupt("return", obj);
523
+ return _context10.abrupt("return", obj);
456
524
  case 16:
457
525
  case "end":
458
- return _context8.stop();
526
+ return _context10.stop();
459
527
  }
460
- }, _callee8);
528
+ }, _callee10);
461
529
  }));
462
530
  return _parseObj.apply(this, arguments);
463
531
  };
@@ -480,7 +548,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
480
548
  ignoreProtected: allProperties
481
549
  });
482
550
  }) : allkeys;
483
- _context9.next = 15;
551
+ _context11.next = 15;
484
552
  return _convert["default"].applyFormats({
485
553
  inputobject: dlt,
486
554
  formats: (0, _object.object_getStatic)(this, "__formatList"),
@@ -501,32 +569,32 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
501
569
  /* parse all changableKeys */
502
570
  /* -------------------------------------------------------------------------- */
503
571
  _iterator = _createForOfIteratorHelper(changableKeys);
504
- _context9.prev = 18;
572
+ _context11.prev = 18;
505
573
  _iterator.s();
506
574
  case 20:
507
575
  if ((_step = _iterator.n()).done) {
508
- _context9.next = 27;
576
+ _context11.next = 27;
509
577
  break;
510
578
  }
511
579
  key = _step.value;
512
- _context9.next = 24;
580
+ _context11.next = 24;
513
581
  return parseObj(dlt[key]);
514
582
  case 24:
515
- final_object[key] = _context9.sent;
583
+ final_object[key] = _context11.sent;
516
584
  case 25:
517
- _context9.next = 20;
585
+ _context11.next = 20;
518
586
  break;
519
587
  case 27:
520
- _context9.next = 32;
588
+ _context11.next = 32;
521
589
  break;
522
590
  case 29:
523
- _context9.prev = 29;
524
- _context9.t0 = _context9["catch"](18);
525
- _iterator.e(_context9.t0);
591
+ _context11.prev = 29;
592
+ _context11.t0 = _context11["catch"](18);
593
+ _iterator.e(_context11.t0);
526
594
  case 32:
527
- _context9.prev = 32;
595
+ _context11.prev = 32;
528
596
  _iterator.f();
529
- return _context9.finish(32);
597
+ return _context11.finish(32);
530
598
  case 35:
531
599
  /* -------------------------------------------------------------------------- */
532
600
  /* add id properties */
@@ -551,12 +619,12 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
551
619
  });
552
620
  final_object["_users"] = (0, _object.wrap_array)(tempusers);
553
621
  }
554
- return _context9.abrupt("return", final_object);
622
+ return _context11.abrupt("return", final_object);
555
623
  case 39:
556
624
  case "end":
557
- return _context9.stop();
625
+ return _context11.stop();
558
626
  }
559
- }, _callee9, this, [[18, 29, 32, 35]]);
627
+ }, _callee11, this, [[18, 29, 32, 35]]);
560
628
  }));
561
629
  function get_deltaObject(_x4) {
562
630
  return _get_deltaObject.apply(this, arguments);
@@ -586,28 +654,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
586
654
  }, {
587
655
  key: "onDelete",
588
656
  value: ( /* -------------------------------------------------------------------------- */function () {
589
- var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
657
+ var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
590
658
  var _this$manager;
591
659
  var _len,
592
660
  p,
593
661
  _key,
594
- _args10 = arguments;
595
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
596
- while (1) switch (_context10.prev = _context10.next) {
662
+ _args12 = arguments;
663
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
664
+ while (1) switch (_context12.prev = _context12.next) {
597
665
  case 0:
598
666
  if (this.isSaved) this.isDeleted = true;
599
- for (_len = _args10.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
600
- p[_key] = _args10[_key];
667
+ for (_len = _args12.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
668
+ p[_key] = _args12[_key];
601
669
  }
602
- _context10.next = 4;
670
+ _context12.next = 4;
603
671
  return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
604
672
  case 4:
605
- return _context10.abrupt("return", _context10.sent);
673
+ return _context12.abrupt("return", _context12.sent);
606
674
  case 5:
607
675
  case "end":
608
- return _context10.stop();
676
+ return _context12.stop();
609
677
  }
610
- }, _callee10, this);
678
+ }, _callee12, this);
611
679
  }));
612
680
  function onDelete() {
613
681
  return _onDelete.apply(this, arguments);
@@ -617,28 +685,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
617
685
  }, {
618
686
  key: "onArchive",
619
687
  value: function () {
620
- var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
688
+ var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
621
689
  var _this$manager2;
622
690
  var _len2,
623
691
  p,
624
692
  _key2,
625
- _args11 = arguments;
626
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
627
- while (1) switch (_context11.prev = _context11.next) {
693
+ _args13 = arguments;
694
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
695
+ while (1) switch (_context13.prev = _context13.next) {
628
696
  case 0:
629
697
  if (this.isSaved) this.isArchived = true;
630
- for (_len2 = _args11.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
631
- p[_key2] = _args11[_key2];
698
+ for (_len2 = _args13.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
699
+ p[_key2] = _args13[_key2];
632
700
  }
633
- _context11.next = 4;
701
+ _context13.next = 4;
634
702
  return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onArchive.apply(_this$manager2, p);
635
703
  case 4:
636
- return _context11.abrupt("return", _context11.sent);
704
+ return _context13.abrupt("return", _context13.sent);
637
705
  case 5:
638
706
  case "end":
639
- return _context11.stop();
707
+ return _context13.stop();
640
708
  }
641
- }, _callee11, this);
709
+ }, _callee13, this);
642
710
  }));
643
711
  function onArchive() {
644
712
  return _onArchive.apply(this, arguments);
@@ -648,28 +716,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
648
716
  }, {
649
717
  key: "onUnArchive",
650
718
  value: function () {
651
- var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
719
+ var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
652
720
  var _this$manager3;
653
721
  var _len3,
654
722
  p,
655
723
  _key3,
656
- _args12 = arguments;
657
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
658
- while (1) switch (_context12.prev = _context12.next) {
724
+ _args14 = arguments;
725
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
726
+ while (1) switch (_context14.prev = _context14.next) {
659
727
  case 0:
660
728
  if (this.isSaved) this.isArchived = false;
661
- for (_len3 = _args12.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
662
- p[_key3] = _args12[_key3];
729
+ for (_len3 = _args14.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
730
+ p[_key3] = _args14[_key3];
663
731
  }
664
- _context12.next = 4;
732
+ _context14.next = 4;
665
733
  return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onUnArchive.apply(_this$manager3, p);
666
734
  case 4:
667
- return _context12.abrupt("return", _context12.sent);
735
+ return _context14.abrupt("return", _context14.sent);
668
736
  case 5:
669
737
  case "end":
670
- return _context12.stop();
738
+ return _context14.stop();
671
739
  }
672
- }, _callee12, this);
740
+ }, _callee14, this);
673
741
  }));
674
742
  function onUnArchive() {
675
743
  return _onUnArchive.apply(this, arguments);
@@ -677,30 +745,92 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
677
745
  return onUnArchive;
678
746
  }()
679
747
  }, {
680
- key: "onLoad",
748
+ key: "onLock",
681
749
  value: function () {
682
- var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
750
+ var _onLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
683
751
  var _this$manager4;
684
752
  var _len4,
685
753
  p,
686
754
  _key4,
687
- _args13 = arguments;
688
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
689
- while (1) switch (_context13.prev = _context13.next) {
755
+ _args15 = arguments;
756
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
757
+ while (1) switch (_context15.prev = _context15.next) {
758
+ case 0:
759
+ if (this.isSaved) this.isLocked = true;
760
+ for (_len4 = _args15.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
761
+ p[_key4] = _args15[_key4];
762
+ }
763
+ _context15.next = 4;
764
+ return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onLock.apply(_this$manager4, p);
765
+ case 4:
766
+ return _context15.abrupt("return", _context15.sent);
767
+ case 5:
768
+ case "end":
769
+ return _context15.stop();
770
+ }
771
+ }, _callee15, this);
772
+ }));
773
+ function onLock() {
774
+ return _onLock.apply(this, arguments);
775
+ }
776
+ return onLock;
777
+ }()
778
+ }, {
779
+ key: "onUnLock",
780
+ value: function () {
781
+ var _onUnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
782
+ var _this$manager5;
783
+ var _len5,
784
+ p,
785
+ _key5,
786
+ _args16 = arguments;
787
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
788
+ while (1) switch (_context16.prev = _context16.next) {
789
+ case 0:
790
+ if (this.isSaved) this.isLocked = false;
791
+ for (_len5 = _args16.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
792
+ p[_key5] = _args16[_key5];
793
+ }
794
+ _context16.next = 4;
795
+ return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onUnLock.apply(_this$manager5, p);
796
+ case 4:
797
+ return _context16.abrupt("return", _context16.sent);
798
+ case 5:
799
+ case "end":
800
+ return _context16.stop();
801
+ }
802
+ }, _callee16, this);
803
+ }));
804
+ function onUnLock() {
805
+ return _onUnLock.apply(this, arguments);
806
+ }
807
+ return onUnLock;
808
+ }()
809
+ }, {
810
+ key: "onLoad",
811
+ value: function () {
812
+ var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
813
+ var _this$manager6;
814
+ var _len6,
815
+ p,
816
+ _key6,
817
+ _args17 = arguments;
818
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
819
+ while (1) switch (_context17.prev = _context17.next) {
690
820
  case 0:
691
821
  this.isDeleted = false;
692
- for (_len4 = _args13.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
693
- p[_key4] = _args13[_key4];
822
+ for (_len6 = _args17.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
823
+ p[_key6] = _args17[_key6];
694
824
  }
695
- _context13.next = 4;
696
- return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onLoad.apply(_this$manager4, p);
825
+ _context17.next = 4;
826
+ return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onLoad.apply(_this$manager6, p);
697
827
  case 4:
698
- return _context13.abrupt("return", _context13.sent);
828
+ return _context17.abrupt("return", _context17.sent);
699
829
  case 5:
700
830
  case "end":
701
- return _context13.stop();
831
+ return _context17.stop();
702
832
  }
703
- }, _callee13, this);
833
+ }, _callee17, this);
704
834
  }));
705
835
  function onLoad() {
706
836
  return _onLoad.apply(this, arguments);
@@ -710,47 +840,47 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
710
840
  }, {
711
841
  key: "onSave",
712
842
  value: function () {
713
- var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
714
- var _this$manager6;
843
+ var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
844
+ var _this$manager8;
715
845
  var srObject,
716
- _this$manager5,
717
- _len5,
846
+ _this$manager7,
847
+ _len7,
718
848
  p,
719
- _key5,
720
- _args14 = arguments;
721
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
722
- while (1) switch (_context14.prev = _context14.next) {
849
+ _key7,
850
+ _args18 = arguments;
851
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
852
+ while (1) switch (_context18.prev = _context18.next) {
723
853
  case 0:
724
854
  if (!this.isSaved) {
725
- _context14.next = 7;
855
+ _context18.next = 7;
726
856
  break;
727
857
  }
728
858
  this.apply_changes();
729
859
  srObject = this.getSaveResult(true);
730
860
  if (!this.saveResultHasID(srObject)) {
731
- _context14.next = 7;
861
+ _context18.next = 7;
732
862
  break;
733
863
  }
734
864
  /* -------------------------------------------------------------------------- */
735
865
  WebObject.LoadIdsFromSaveResult(this, srObject);
736
- _context14.next = 7;
737
- return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.event_run("on_id_change");
866
+ _context18.next = 7;
867
+ return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.event_run("on_id_change");
738
868
  case 7:
739
- for (_len5 = _args14.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
740
- p[_key5] = _args14[_key5];
869
+ for (_len7 = _args18.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
870
+ p[_key7] = _args18[_key7];
741
871
  }
742
- _context14.next = 10;
743
- return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onSave.apply(_this$manager6, p);
872
+ _context18.next = 10;
873
+ return (_this$manager8 = this.manager) === null || _this$manager8 === void 0 ? void 0 : _this$manager8.onSave.apply(_this$manager8, p);
744
874
  case 10:
745
- _context14.next = 12;
875
+ _context18.next = 12;
746
876
  return this.onAfterSave();
747
877
  case 12:
748
- return _context14.abrupt("return", true);
878
+ return _context18.abrupt("return", true);
749
879
  case 13:
750
880
  case "end":
751
- return _context14.stop();
881
+ return _context18.stop();
752
882
  }
753
- }, _callee14, this);
883
+ }, _callee18, this);
754
884
  }));
755
885
  function onSave() {
756
886
  return _onSave.apply(this, arguments);
@@ -760,27 +890,27 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
760
890
  }, {
761
891
  key: "onAfterSave",
762
892
  value: function () {
763
- var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
764
- var _this$manager7;
765
- var _len6,
893
+ var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
894
+ var _this$manager9;
895
+ var _len8,
766
896
  p,
767
- _key6,
768
- _args15 = arguments;
769
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
770
- while (1) switch (_context15.prev = _context15.next) {
897
+ _key8,
898
+ _args19 = arguments;
899
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
900
+ while (1) switch (_context19.prev = _context19.next) {
771
901
  case 0:
772
- for (_len6 = _args15.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
773
- p[_key6] = _args15[_key6];
902
+ for (_len8 = _args19.length, p = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
903
+ p[_key8] = _args19[_key8];
774
904
  }
775
- _context15.next = 3;
776
- return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.onAfterSave.apply(_this$manager7, p);
905
+ _context19.next = 3;
906
+ return (_this$manager9 = this.manager) === null || _this$manager9 === void 0 ? void 0 : _this$manager9.onAfterSave.apply(_this$manager9, p);
777
907
  case 3:
778
- return _context15.abrupt("return", true);
908
+ return _context19.abrupt("return", true);
779
909
  case 4:
780
910
  case "end":
781
- return _context15.stop();
911
+ return _context19.stop();
782
912
  }
783
- }, _callee15, this);
913
+ }, _callee19, this);
784
914
  }));
785
915
  function onAfterSave() {
786
916
  return _onAfterSave.apply(this, arguments);
@@ -805,27 +935,27 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
805
935
  }, {
806
936
  key: "onNew",
807
937
  value: function () {
808
- var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
809
- var _this$manager8;
810
- var _len7,
938
+ var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
939
+ var _this$manager10;
940
+ var _len9,
811
941
  p,
812
- _key7,
813
- _args16 = arguments;
814
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
815
- while (1) switch (_context16.prev = _context16.next) {
942
+ _key9,
943
+ _args20 = arguments;
944
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
945
+ while (1) switch (_context20.prev = _context20.next) {
816
946
  case 0:
817
- for (_len7 = _args16.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
818
- p[_key7] = _args16[_key7];
947
+ for (_len9 = _args20.length, p = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
948
+ p[_key9] = _args20[_key9];
819
949
  }
820
- _context16.next = 3;
821
- return (_this$manager8 = this.manager) === null || _this$manager8 === void 0 ? void 0 : _this$manager8.onNew.apply(_this$manager8, p);
950
+ _context20.next = 3;
951
+ return (_this$manager10 = this.manager) === null || _this$manager10 === void 0 ? void 0 : _this$manager10.onNew.apply(_this$manager10, p);
822
952
  case 3:
823
- return _context16.abrupt("return", _context16.sent);
953
+ return _context20.abrupt("return", _context20.sent);
824
954
  case 4:
825
955
  case "end":
826
- return _context16.stop();
956
+ return _context20.stop();
827
957
  }
828
- }, _callee16, this);
958
+ }, _callee20, this);
829
959
  }));
830
960
  function onNew() {
831
961
  return _onNew.apply(this, arguments);
@@ -881,7 +1011,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
881
1011
  }, {
882
1012
  key: "saveList",
883
1013
  value: function () {
884
- var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(itemList) {
1014
+ var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(itemList) {
885
1015
  var _extraOptions$chunksi;
886
1016
  var extraOptions,
887
1017
  chunks,
@@ -898,11 +1028,11 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
898
1028
  _item,
899
1029
  _index2,
900
1030
  _item2,
901
- _args17 = arguments;
902
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
903
- while (1) switch (_context17.prev = _context17.next) {
1031
+ _args21 = arguments;
1032
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1033
+ while (1) switch (_context21.prev = _context21.next) {
904
1034
  case 0:
905
- extraOptions = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
1035
+ extraOptions = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
906
1036
  if (!extraOptions) extraOptions = {};
907
1037
  chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
908
1038
  delete extraOptions.chunksize;
@@ -910,7 +1040,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
910
1040
  index = 0;
911
1041
  case 6:
912
1042
  if (!(index < chunks.length)) {
913
- _context17.next = 36;
1043
+ _context21.next = 36;
914
1044
  break;
915
1045
  }
916
1046
  items_to_save = chunks[index];
@@ -918,81 +1048,81 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
918
1048
  k = 0;
919
1049
  case 10:
920
1050
  if (!(k < items_to_save.length)) {
921
- _context17.next = 19;
1051
+ _context21.next = 19;
922
1052
  break;
923
1053
  }
924
1054
  item = items_to_save[k];
925
- _context17.next = 14;
1055
+ _context21.next = 14;
926
1056
  return item.get_deltaObject();
927
1057
  case 14:
928
- dlt = _context17.sent;
1058
+ dlt = _context21.sent;
929
1059
  save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
930
1060
  _id: item.getID()
931
1061
  }, dlt));
932
1062
  case 16:
933
1063
  k++;
934
- _context17.next = 10;
1064
+ _context21.next = 10;
935
1065
  break;
936
1066
  case 19:
937
- _context17.next = 21;
1067
+ _context21.next = 21;
938
1068
  return _global.gfunc.run_action("post", putAddress, _objectSpread({
939
1069
  __save_list: WebObject.zipSaveList(save_array)
940
1070
  }, extraOptions));
941
1071
  case 21:
942
- resultObject = _context17.sent;
1072
+ resultObject = _context21.sent;
943
1073
  if (!Array.isArray(resultObject)) {
944
- _context17.next = 33;
1074
+ _context21.next = 33;
945
1075
  break;
946
1076
  }
947
1077
  _index = 0;
948
1078
  case 24:
949
1079
  if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
950
- _context17.next = 33;
1080
+ _context21.next = 33;
951
1081
  break;
952
1082
  }
953
1083
  res = resultObject[_index];
954
1084
  _item = items_to_save[_index];
955
1085
  _item.setSaveResult(res);
956
- _context17.next = 30;
1086
+ _context21.next = 30;
957
1087
  return _item.onSave();
958
1088
  case 30:
959
1089
  _index++;
960
- _context17.next = 24;
1090
+ _context21.next = 24;
961
1091
  break;
962
1092
  case 33:
963
1093
  index++;
964
- _context17.next = 6;
1094
+ _context21.next = 6;
965
1095
  break;
966
1096
  case 36:
967
1097
  _index2 = 0;
968
1098
  case 37:
969
1099
  if (!(_index2 < itemList.length)) {
970
- _context17.next = 46;
1100
+ _context21.next = 46;
971
1101
  break;
972
1102
  }
973
1103
  _item2 = itemList[_index2];
974
1104
  if (_item2.isSaved) {
975
- _context17.next = 41;
1105
+ _context21.next = 41;
976
1106
  break;
977
1107
  }
978
- return _context17.abrupt("return", false);
1108
+ return _context21.abrupt("return", false);
979
1109
  case 41:
980
1110
  if (!(_item2.getSaveResultType() != "normal")) {
981
- _context17.next = 43;
1111
+ _context21.next = 43;
982
1112
  break;
983
1113
  }
984
- return _context17.abrupt("return", false);
1114
+ return _context21.abrupt("return", false);
985
1115
  case 43:
986
1116
  _index2++;
987
- _context17.next = 37;
1117
+ _context21.next = 37;
988
1118
  break;
989
1119
  case 46:
990
- return _context17.abrupt("return", true);
1120
+ return _context21.abrupt("return", true);
991
1121
  case 47:
992
1122
  case "end":
993
- return _context17.stop();
1123
+ return _context21.stop();
994
1124
  }
995
- }, _callee17, this);
1125
+ }, _callee21, this);
996
1126
  }));
997
1127
  function saveList(_x7) {
998
1128
  return _saveList.apply(this, arguments);
@@ -1042,64 +1172,64 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
1042
1172
  }, {
1043
1173
  key: "get_single",
1044
1174
  value: (function () {
1045
- var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1046
- var _len8,
1175
+ var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1176
+ var _len10,
1047
1177
  p,
1048
- _key8,
1178
+ _key10,
1049
1179
  search,
1050
1180
  readonly,
1051
1181
  fetchID,
1052
1182
  res,
1053
1183
  params,
1054
- _args18 = arguments;
1055
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1056
- while (1) switch (_context18.prev = _context18.next) {
1184
+ _args22 = arguments;
1185
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1186
+ while (1) switch (_context22.prev = _context22.next) {
1057
1187
  case 0:
1058
- for (_len8 = _args18.length, p = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
1059
- p[_key8] = _args18[_key8];
1188
+ for (_len10 = _args22.length, p = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
1189
+ p[_key10] = _args22[_key10];
1060
1190
  }
1061
1191
  search = p.shift();
1062
1192
  readonly = p.shift();
1063
1193
  fetchID = p.shift();
1064
1194
  if (!(0, _object.object_isEmpty)(search)) {
1065
- _context18.next = 6;
1195
+ _context22.next = 6;
1066
1196
  break;
1067
1197
  }
1068
- return _context18.abrupt("return", undefined);
1198
+ return _context22.abrupt("return", undefined);
1069
1199
  case 6:
1070
1200
  params = {};
1071
1201
  params.context = readonly ? "view" : "edit";
1072
- _context18.t0 = _typeof(search);
1073
- _context18.next = _context18.t0 === "string" ? 11 : _context18.t0 === "number" ? 11 : _context18.t0 === "object" ? 19 : 19;
1202
+ _context22.t0 = _typeof(search);
1203
+ _context22.next = _context22.t0 === "string" ? 11 : _context22.t0 === "number" ? 11 : _context22.t0 === "object" ? 19 : 19;
1074
1204
  break;
1075
1205
  case 11:
1076
1206
  search = String(search);
1077
- _context18.t1 = this;
1078
- _context18.t2 = this;
1079
- _context18.next = 16;
1207
+ _context22.t1 = this;
1208
+ _context22.t2 = this;
1209
+ _context22.next = 16;
1080
1210
  return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
1081
1211
  fetchID: fetchID
1082
1212
  });
1083
1213
  case 16:
1084
- _context18.t3 = _context18.sent;
1085
- res = _context18.t1.ensure.call(_context18.t1, _context18.t2, _context18.t3);
1086
- return _context18.abrupt("break", 25);
1214
+ _context22.t3 = _context22.sent;
1215
+ res = _context22.t1.ensure.call(_context22.t1, _context22.t2, _context22.t3);
1216
+ return _context22.abrupt("break", 25);
1087
1217
  case 19:
1088
- _context18.t4 = _object.object_first;
1089
- _context18.next = 22;
1218
+ _context22.t4 = _object.object_first;
1219
+ _context22.next = 22;
1090
1220
  return this.get_list(search, readonly, fetchID);
1091
1221
  case 22:
1092
- _context18.t5 = _context18.sent;
1093
- res = (0, _context18.t4)(_context18.t5);
1094
- return _context18.abrupt("break", 25);
1222
+ _context22.t5 = _context22.sent;
1223
+ res = (0, _context22.t4)(_context22.t5);
1224
+ return _context22.abrupt("break", 25);
1095
1225
  case 25:
1096
1226
  WebObject.setReadonly(res, readonly);
1097
- return _context18.abrupt("return", res);
1227
+ return _context22.abrupt("return", res);
1098
1228
  case 27:
1099
1229
  case "end":
1100
- return _context18.stop();
1230
+ return _context22.stop();
1101
1231
  }
1102
- }, _callee18, this);
1232
+ }, _callee22, this);
1103
1233
  }));
1104
1234
  function get_single() {
1105
1235
  return _get_single.apply(this, arguments);
@@ -1114,42 +1244,42 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
1114
1244
  }, {
1115
1245
  key: "get_list",
1116
1246
  value: (function () {
1117
- var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1118
- var _len9,
1247
+ var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1248
+ var _len11,
1119
1249
  p,
1120
- _key9,
1250
+ _key11,
1121
1251
  search,
1122
1252
  readonly,
1123
1253
  fetchID,
1124
1254
  result_items,
1125
1255
  res,
1126
- _args19 = arguments;
1127
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1128
- while (1) switch (_context19.prev = _context19.next) {
1256
+ _args23 = arguments;
1257
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1258
+ while (1) switch (_context23.prev = _context23.next) {
1129
1259
  case 0:
1130
- for (_len9 = _args19.length, p = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
1131
- p[_key9] = _args19[_key9];
1260
+ for (_len11 = _args23.length, p = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
1261
+ p[_key11] = _args23[_key11];
1132
1262
  }
1133
1263
  search = p.shift();
1134
1264
  readonly = p.shift();
1135
1265
  fetchID = p.shift();
1136
1266
  if (!search) search = {};
1137
- _context19.next = 7;
1267
+ _context23.next = 7;
1138
1268
  return _global.gfunc.run_action("get", this.get_webname(), search, {
1139
1269
  fetchID: fetchID
1140
1270
  });
1141
1271
  case 7:
1142
- result_items = _context19.sent;
1272
+ result_items = _context23.sent;
1143
1273
  // const selftype = (this.constructor ||
1144
1274
  // Object.getPrototypeOf(this)) as any;
1145
1275
  res = WebObject.map_rowindex(WebObject.mapto(this, result_items, readonly));
1146
1276
  WebObject.setReadonly(res, readonly);
1147
- return _context19.abrupt("return", res);
1277
+ return _context23.abrupt("return", res);
1148
1278
  case 11:
1149
1279
  case "end":
1150
- return _context19.stop();
1280
+ return _context23.stop();
1151
1281
  }
1152
- }, _callee19, this);
1282
+ }, _callee23, this);
1153
1283
  }));
1154
1284
  function get_list() {
1155
1285
  return _get_list.apply(this, arguments);
@@ -41,6 +41,8 @@ export declare class WebObjectManager<T extends WebObject> extends ObjectManager
41
41
  onDelete(...p: any): Promise<any>;
42
42
  onArchive(...p: any): Promise<any>;
43
43
  onUnArchive(...p: any): Promise<any>;
44
+ onLock(...p: any): Promise<any>;
45
+ onUnLock(...p: any): Promise<any>;
44
46
  /**
45
47
  * Use this when you load data to the object
46
48
  * @param p
@@ -474,6 +474,60 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
474
474
  }
475
475
  return onUnArchive;
476
476
  }()
477
+ }, {
478
+ key: "onLock",
479
+ value: function () {
480
+ var _onLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
481
+ var srt;
482
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
483
+ while (1) switch (_context13.prev = _context13.next) {
484
+ case 0:
485
+ srt = this.getSaveResultType();
486
+ _context13.next = 3;
487
+ return this.event_run("on_lock", srt);
488
+ case 3:
489
+ _context13.next = 5;
490
+ return this.event_run("on_after_lock", srt);
491
+ case 5:
492
+ return _context13.abrupt("return", true);
493
+ case 6:
494
+ case "end":
495
+ return _context13.stop();
496
+ }
497
+ }, _callee13, this);
498
+ }));
499
+ function onLock() {
500
+ return _onLock.apply(this, arguments);
501
+ }
502
+ return onLock;
503
+ }()
504
+ }, {
505
+ key: "onUnLock",
506
+ value: function () {
507
+ var _onUnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
508
+ var srt;
509
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
510
+ while (1) switch (_context14.prev = _context14.next) {
511
+ case 0:
512
+ srt = this.getSaveResultType();
513
+ _context14.next = 3;
514
+ return this.event_run("on_unlock", srt);
515
+ case 3:
516
+ _context14.next = 5;
517
+ return this.event_run("on_after_unlock", srt);
518
+ case 5:
519
+ return _context14.abrupt("return", true);
520
+ case 6:
521
+ case "end":
522
+ return _context14.stop();
523
+ }
524
+ }, _callee14, this);
525
+ }));
526
+ function onUnLock() {
527
+ return _onUnLock.apply(this, arguments);
528
+ }
529
+ return onUnLock;
530
+ }()
477
531
  /**
478
532
  * Use this when you load data to the object
479
533
  * @param p
@@ -482,32 +536,32 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
482
536
  }, {
483
537
  key: "onLoad",
484
538
  value: (function () {
485
- var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
486
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
487
- while (1) switch (_context13.prev = _context13.next) {
539
+ var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
540
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
541
+ while (1) switch (_context15.prev = _context15.next) {
488
542
  case 0:
489
543
  if (this.canModify && this.obj) {
490
544
  this.obj.isDeleted = false;
491
545
  this.obj.setOriginal();
492
546
  }
493
- _context13.next = 3;
547
+ _context15.next = 3;
494
548
  return this.event_run("on_load");
495
549
  case 3:
496
- _context13.next = 5;
550
+ _context15.next = 5;
497
551
  return this.event_run("on_change", true);
498
552
  case 5:
499
- _context13.next = 7;
553
+ _context15.next = 7;
500
554
  return this.event_run("on_after_load");
501
555
  case 7:
502
- _context13.next = 9;
556
+ _context15.next = 9;
503
557
  return this.event_run("on_load_finished");
504
558
  case 9:
505
- return _context13.abrupt("return", true);
559
+ return _context15.abrupt("return", true);
506
560
  case 10:
507
561
  case "end":
508
- return _context13.stop();
562
+ return _context15.stop();
509
563
  }
510
- }, _callee13, this);
564
+ }, _callee15, this);
511
565
  }));
512
566
  function onLoad() {
513
567
  return _onLoad.apply(this, arguments);
@@ -523,27 +577,27 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
523
577
  }, {
524
578
  key: "onSave",
525
579
  value: (function () {
526
- var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
580
+ var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
527
581
  var srt;
528
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
529
- while (1) switch (_context14.prev = _context14.next) {
582
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
583
+ while (1) switch (_context16.prev = _context16.next) {
530
584
  case 0:
531
585
  srt = this.getSaveResultType();
532
- _context14.next = 3;
586
+ _context16.next = 3;
533
587
  return this.event_run("on_save", srt);
534
588
  case 3:
535
- _context14.next = 5;
589
+ _context16.next = 5;
536
590
  return this.event_run("on_change", true);
537
591
  case 5:
538
- _context14.next = 7;
592
+ _context16.next = 7;
539
593
  return Promise.resolve(true);
540
594
  case 7:
541
- return _context14.abrupt("return", _context14.sent);
595
+ return _context16.abrupt("return", _context16.sent);
542
596
  case 8:
543
597
  case "end":
544
- return _context14.stop();
598
+ return _context16.stop();
545
599
  }
546
- }, _callee14, this);
600
+ }, _callee16, this);
547
601
  }));
548
602
  function onSave() {
549
603
  return _onSave.apply(this, arguments);
@@ -553,27 +607,27 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
553
607
  }, {
554
608
  key: "onAfterSave",
555
609
  value: function () {
556
- var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
610
+ var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
557
611
  var srt;
558
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
559
- while (1) switch (_context15.prev = _context15.next) {
612
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
613
+ while (1) switch (_context17.prev = _context17.next) {
560
614
  case 0:
561
615
  srt = this.getSaveResultType();
562
- _context15.next = 3;
616
+ _context17.next = 3;
563
617
  return this.event_run("on_after_save", srt);
564
618
  case 3:
565
- _context15.next = 5;
619
+ _context17.next = 5;
566
620
  return this.event_run("on_save_finished", srt);
567
621
  case 5:
568
- _context15.next = 7;
622
+ _context17.next = 7;
569
623
  return Promise.resolve(true);
570
624
  case 7:
571
- return _context15.abrupt("return", _context15.sent);
625
+ return _context17.abrupt("return", _context17.sent);
572
626
  case 8:
573
627
  case "end":
574
- return _context15.stop();
628
+ return _context17.stop();
575
629
  }
576
- }, _callee15, this);
630
+ }, _callee17, this);
577
631
  }));
578
632
  function onAfterSave() {
579
633
  return _onAfterSave.apply(this, arguments);
@@ -29,6 +29,7 @@ export declare class SimpleObject extends MapableObject {
29
29
  _deleted?: boolean;
30
30
  _archived?: boolean;
31
31
  _deletedBy?: string;
32
+ _locked?: boolean;
32
33
  protected __errors?: any[];
33
34
  protected __showErrors?: boolean;
34
35
  protected __refresh_functions?: {
@@ -170,6 +171,8 @@ export declare class SimpleObject extends MapableObject {
170
171
  get isArchived(): boolean;
171
172
  set isArchived(v: boolean);
172
173
  get isDeleted(): boolean;
174
+ get isLocked(): boolean;
175
+ set isLocked(v: boolean);
173
176
  set isDeleted(v: boolean);
174
177
  get d(): Partial<this>;
175
178
  get allproperties(): Partial<this>;
@@ -75,6 +75,8 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
75
75
  _defineProperty(_assertThisInitialized(_this), "_deleted", void 0);
76
76
  _defineProperty(_assertThisInitialized(_this), "_archived", void 0);
77
77
  _defineProperty(_assertThisInitialized(_this), "_deletedBy", void 0);
78
+ //is this object locked?
79
+ _defineProperty(_assertThisInitialized(_this), "_locked", void 0);
78
80
  //errors
79
81
  _defineProperty(_assertThisInitialized(_this), "__errors", void 0);
80
82
  _defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
@@ -836,6 +838,14 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
836
838
  set: function set(v) {
837
839
  this._deleted = v;
838
840
  }
841
+ }, {
842
+ key: "isLocked",
843
+ get: function get() {
844
+ return this.get("_locked") || false;
845
+ },
846
+ set: function set(v) {
847
+ this._locked = v;
848
+ }
839
849
  }, {
840
850
  key: "d",
841
851
  get: function get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.133",
3
+ "version": "1.4.135",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",