@azrico/webobject 1.5.54 → 1.5.56

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.
@@ -1,5 +1,10 @@
1
1
  import { SimpleObject, deltaParams, sendChangesType } from "../index";
2
2
  import { WebObjectManager } from "../index";
3
+ export type ObjectWithUsers = Partial<{
4
+ _creator: string;
5
+ _users: string[];
6
+ attentions: string[];
7
+ }>;
3
8
  export declare class WebObject extends SimpleObject {
4
9
  static readonly __web_path: string;
5
10
  static readonly __protectedProperties: string[];
@@ -19,12 +24,11 @@ export declare class WebObject extends SimpleObject {
19
24
  */
20
25
  getAllUsers(): string[];
21
26
  /**
22
- * get a list of all user ids that work on the given object
23
- * _creator + _users + attentions(old)
24
- * removes duplicates
27
+ * get a unique list of all user ids that work on the given object
28
+ * `_creator + _users + attentions`
25
29
  * @returns array of ids
26
30
  */
27
- static getAllUsers(obj: any): string[];
31
+ static getAllUsers(obj: ObjectWithUsers): string[];
28
32
  /**
29
33
  * Update meta value of this object , meta data is stored in meta_data variable
30
34
  * @param key
@@ -66,9 +66,8 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
66
66
  return WebObject.getAllUsers(this);
67
67
  }
68
68
  /**
69
- * get a list of all user ids that work on the given object
70
- * _creator + _users + attentions(old)
71
- * removes duplicates
69
+ * get a unique list of all user ids that work on the given object
70
+ * `_creator + _users + attentions`
72
71
  * @returns array of ids
73
72
  */
74
73
  }, {
@@ -235,6 +235,7 @@ export declare class SimpleObject extends MapableObject {
235
235
  set isArchived(v: boolean);
236
236
  get isDeleted(): boolean;
237
237
  get isLocked(): boolean;
238
+ get objectColor(): string;
238
239
  set isLocked(v: boolean);
239
240
  set isDeleted(v: boolean);
240
241
  get d(): Partial<this>;
@@ -36,11 +36,15 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
36
36
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
37
37
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
38
38
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
39
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
39
40
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
40
41
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
41
42
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
42
43
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
44
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
45
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
43
46
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
47
+ var _objectColor = /*#__PURE__*/new WeakMap();
44
48
  var _SimpleObject_brand = /*#__PURE__*/new WeakSet();
45
49
  var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject) {
46
50
  function SimpleObject() {
@@ -78,6 +82,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
78
82
  _defineProperty(_this, "__saveResultType", void 0);
79
83
  //init function
80
84
  _defineProperty(_this, "__initialized", void 0);
85
+ _classPrivateFieldInitSpec(_this, _objectColor, void 0);
81
86
  //id in the database
82
87
  _defineProperty(_this, "_id", "");
83
88
  //sequence key (usually managed by the database)
@@ -963,6 +968,14 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
963
968
  set: function set(v) {
964
969
  this._locked = v;
965
970
  }
971
+ }, {
972
+ key: "objectColor",
973
+ get: function get() {
974
+ if (!_classPrivateFieldGet(_objectColor, this)) {
975
+ _classPrivateFieldSet(_objectColor, this, (0, _string.string_to_color)(this.getID()));
976
+ }
977
+ return _classPrivateFieldGet(_objectColor, this);
978
+ }
966
979
  }, {
967
980
  key: "d",
968
981
  get: function get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.5.54",
3
+ "version": "1.5.56",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",