@azrico/webobject 1.4.50 → 1.4.53

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.
@@ -11,12 +11,25 @@ export type deltaParams = {
11
11
  export declare class WebObject extends SimpleObject {
12
12
  static readonly __web_path: string;
13
13
  static readonly __web_type: string;
14
+ static readonly __protectedProperties: string[];
14
15
  meta_data: MetaObject[];
15
16
  _id: string;
16
17
  _created_date?: string | Date;
17
18
  _creator?: string;
18
19
  _users?: string[];
19
20
  constructor(is_readonly?: boolean);
21
+ /**
22
+ * get a list of all users that work on this object
23
+ * _creator + _users + attentions(old)
24
+ * @returns
25
+ */
26
+ getAllUsers(): string[];
27
+ /**
28
+ * get a list of all users that work on the given object
29
+ * _creator + _users + attentions(old)
30
+ * @returns
31
+ */
32
+ static getAllUsers(obj: any): string[];
20
33
  /**
21
34
  * Update meta value of this object , meta data is stored in meta_data variable
22
35
  * @param key
@@ -57,20 +57,35 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
57
57
  _this.meta_data = [];
58
58
  return _this;
59
59
  }
60
- /* -------------------------------------------------------------------------- */
61
- /* Meta data */
62
- /* -------------------------------------------------------------------------- */
63
60
  /**
64
- * Update meta value of this object , meta data is stored in meta_data variable
65
- * @param key
66
- * @param value
67
- * @param createIfNotExists should we create a new meta if key does not exist
68
- * @param sendChange
61
+ * get a list of all users that work on this object
62
+ * _creator + _users + attentions(old)
69
63
  * @returns
70
64
  */
71
65
  _createClass(WebObject, [{
66
+ key: "getAllUsers",
67
+ value: function getAllUsers() {
68
+ return WebObject.getAllUsers(this);
69
+ }
70
+ /**
71
+ * get a list of all users that work on the given object
72
+ * _creator + _users + attentions(old)
73
+ * @returns
74
+ */
75
+ }, {
72
76
  key: "setMetaValue",
73
- value: function setMetaValue(key, value) {
77
+ value: /* -------------------------------------------------------------------------- */
78
+ /* Meta data */
79
+ /* -------------------------------------------------------------------------- */
80
+ /**
81
+ * Update meta value of this object , meta data is stored in meta_data variable
82
+ * @param key
83
+ * @param value
84
+ * @param createIfNotExists should we create a new meta if key does not exist
85
+ * @param sendChange
86
+ * @returns
87
+ */
88
+ function setMetaValue(key, value) {
74
89
  var createIfNotExists = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
75
90
  var sendChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
76
91
  if (!this.canModify) {
@@ -548,6 +563,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
548
563
  return WebObject.saveResultHasID(s);
549
564
  }
550
565
  }], [{
566
+ key: "getAllUsers",
567
+ value: function getAllUsers(obj) {
568
+ return (0, _object.array_remove_duplicates)((0, _object.array_merge)(obj._creator, (0, _object.wrap_array)(obj._users), (0, _object.wrap_array)(obj.attentions)));
569
+ }
570
+ }, {
551
571
  key: "getMeta",
552
572
  value: function getMeta(o, key) {
553
573
  if (o == null) return null;
@@ -873,5 +893,6 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
873
893
  exports.WebObject = WebObject;
874
894
  _defineProperty(WebObject, "__web_path", "");
875
895
  _defineProperty(WebObject, "__web_type", "");
896
+ _defineProperty(WebObject, "__protectedProperties", ["_users"]);
876
897
  var _default = WebObject;
877
898
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.50",
3
+ "version": "1.4.53",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",
@@ -65,7 +65,7 @@
65
65
  "@azrico/global": "*",
66
66
  "@azrico/object": "*",
67
67
  "@azrico/string": "*",
68
- "@azrico/uid": "^*",
68
+ "@azrico/uid": "*",
69
69
  "lodash.clonedeep": "*"
70
70
  },
71
71
  "dependencies": {