@azrico/webobject 1.4.114 → 1.4.116

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.
@@ -23,15 +23,15 @@ export declare class WebObject extends SimpleObject {
23
23
  _users?: string[];
24
24
  constructor(is_readonly?: boolean);
25
25
  /**
26
- * get a list of all users that work on this object
26
+ * get a list of all user ids that work on the given object
27
27
  * _creator + _users + attentions(old)
28
- * @returns
28
+ * @returns array of ids
29
29
  */
30
30
  getAllUsers(): string[];
31
31
  /**
32
- * get a list of all users that work on the given object
32
+ * get a list of all user ids that work on the given object
33
33
  * _creator + _users + attentions(old)
34
- * @returns
34
+ * @returns array of ids
35
35
  */
36
36
  static getAllUsers(obj: any): string[];
37
37
  /**
@@ -62,8 +62,8 @@ export declare class WebObject extends SimpleObject {
62
62
  }): Promise<boolean>;
63
63
  Save(): Promise<any>;
64
64
  Delete(): Promise<any>;
65
- Archive(): Promise<boolean>;
66
- UnArchive(): Promise<boolean>;
65
+ Archive(): Promise<any>;
66
+ UnArchive(): Promise<any>;
67
67
  canSave(deltaObj?: any): true | string;
68
68
  canDelete(): boolean;
69
69
  canArchive(): boolean;
@@ -53,9 +53,9 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
53
53
  return _this;
54
54
  }
55
55
  /**
56
- * get a list of all users that work on this object
56
+ * get a list of all user ids that work on the given object
57
57
  * _creator + _users + attentions(old)
58
- * @returns
58
+ * @returns array of ids
59
59
  */
60
60
  _createClass(WebObject, [{
61
61
  key: "getAllUsers",
@@ -63,9 +63,9 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
63
63
  return WebObject.getAllUsers(this);
64
64
  }
65
65
  /**
66
- * get a list of all users that work on the given object
66
+ * get a list of all user ids that work on the given object
67
67
  * _creator + _users + attentions(old)
68
- * @returns
68
+ * @returns array of ids
69
69
  */
70
70
  }, {
71
71
  key: "setMetaValue",
@@ -249,19 +249,26 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
249
249
  key: "Archive",
250
250
  value: function Archive() {
251
251
  return (_Archive = _Archive || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
252
+ var resultObject;
252
253
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
253
254
  while (1) switch (_context4.prev = _context4.next) {
254
255
  case 0:
255
- if (!(this.__throw_errors !== false)) {
256
+ if (!(this.isNew || this.isArchived)) {
256
257
  _context4.next = 2;
257
258
  break;
258
259
  }
259
- throw new Error("Archive not implented");
260
+ return _context4.abrupt("return");
260
261
  case 2:
261
- WebObject.addError(this, "Archive not implented", "NOSAVE", true);
262
- this.setSaveResult(false, "canceled");
263
- return _context4.abrupt("return", false);
264
- case 5:
262
+ _context4.next = 4;
263
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/archive"));
264
+ case 4:
265
+ resultObject = _context4.sent;
266
+ this.setSaveResult(resultObject, "auto", true);
267
+ _context4.next = 8;
268
+ return this.onArchive();
269
+ case 8:
270
+ return _context4.abrupt("return", resultObject);
271
+ case 9:
265
272
  case "end":
266
273
  return _context4.stop();
267
274
  }
@@ -272,19 +279,26 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
272
279
  key: "UnArchive",
273
280
  value: function UnArchive() {
274
281
  return (_UnArchive = _UnArchive || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
282
+ var resultObject;
275
283
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
276
284
  while (1) switch (_context5.prev = _context5.next) {
277
285
  case 0:
278
- if (!(this.__throw_errors !== false)) {
286
+ if (!(this.isNew || !this.isArchived)) {
279
287
  _context5.next = 2;
280
288
  break;
281
289
  }
282
- throw new Error("UnArchive not implented");
290
+ return _context5.abrupt("return");
283
291
  case 2:
284
- WebObject.addError(this, "UnArchive not implented", "NOSAVE", true);
285
- this.setSaveResult(false, "canceled");
286
- return _context5.abrupt("return", false);
287
- case 5:
292
+ _context5.next = 4;
293
+ return _global.gfunc.run_action("post", "".concat(this.get_webname(), "/").concat(this.getID(), "/unarchive"));
294
+ case 4:
295
+ resultObject = _context5.sent;
296
+ this.setSaveResult(resultObject, "auto", true);
297
+ _context5.next = 8;
298
+ return this.onUnArchive();
299
+ case 8:
300
+ return _context5.abrupt("return", resultObject);
301
+ case 9:
288
302
  case "end":
289
303
  return _context5.stop();
290
304
  }
@@ -735,7 +749,9 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
735
749
  }], [{
736
750
  key: "getAllUsers",
737
751
  value: function getAllUsers(obj) {
738
- return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)));
752
+ return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)).map(function (r) {
753
+ return String(_typeof(r) === "object" ? WebObject.getID(r) : r);
754
+ }));
739
755
  }
740
756
  }, {
741
757
  key: "getMetaValue",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.114",
3
+ "version": "1.4.116",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",