@azrico/webobject 1.2.28 → 1.2.30

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.
@@ -3,6 +3,7 @@ import WebObject from "./WebObject";
3
3
  * This web object contains some more webobjects
4
4
  */
5
5
  export declare class ParentWebObject extends WebObject {
6
+ constructor(is_readonly?: boolean);
6
7
  __children: WebObject[] | undefined;
7
8
  set_children(val: WebObject[] | undefined): void;
8
9
  }
@@ -44,13 +44,11 @@ var ParentWebObject = /*#__PURE__*/function (_WebObject) {
44
44
  function ParentWebObject() {
45
45
  var _this;
46
46
 
47
- _classCallCheck(this, ParentWebObject);
47
+ var is_readonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
48
48
 
49
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
- args[_key] = arguments[_key];
51
- }
49
+ _classCallCheck(this, ParentWebObject);
52
50
 
53
- _this = _super.call.apply(_super, [this].concat(args));
51
+ _this = _super.call(this, is_readonly);
54
52
 
55
53
  _defineProperty(_assertThisInitialized(_this), "__children", undefined);
56
54
 
@@ -114,8 +114,13 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
114
114
  if (this.__throw_errors) throw Error("Cant use setMetaValue on ".concat(key, " when on readonly mode"));else return false;
115
115
  }
116
116
 
117
+ if (!key || typeof key != "string") {
118
+ if (this.__throw_errors) throw Error("Bad key at setMetaValue");else return false;
119
+ }
120
+
117
121
  var old_value = WebObject.getMetaValue(this, key);
118
- if ((0, _object.object_equals)(old_value, value)) return false;
122
+ if ((0, _object.object_equals)(old_value, value)) return false; //same value, no changes
123
+
119
124
  var old_metalist = (0, _object.to_array)(this.getValue("meta_data")).map(function (s) {
120
125
  return (0, _object.object_shallow_clone)(s);
121
126
  });
@@ -575,6 +580,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
575
580
  key: "getMeta",
576
581
  value: function getMeta(o, key) {
577
582
  if (o == null) return null;
583
+ if (!key || typeof key != "string") return undefined;
578
584
  var metalist = [];
579
585
 
580
586
  if (_typeof(o) === "object") {
@@ -34,8 +34,8 @@ export declare class ObjectManager<ObjType extends SimpleObject> {
34
34
  getSaveResultType(): saveResultType | null;
35
35
  setSaveResult(toObj: any, type: saveResultType): void | undefined;
36
36
  apply_changes(): false | undefined;
37
- getValue(key: PropOf<ObjType>, original?: boolean): NonNullable<ObjType>[any] | undefined;
38
- get: (key: PropOf<ObjType>, original?: boolean) => NonNullable<ObjType>[any] | undefined;
37
+ getValue(key: PropOf<ObjType>, original?: boolean): import("./SimpleObject").PropType<NonNullable<ObjType>, any> | undefined;
38
+ get: (key: PropOf<ObjType>, original?: boolean) => import("./SimpleObject").PropType<NonNullable<ObjType>, any> | undefined;
39
39
  /**
40
40
  * set value
41
41
  * @param key
@@ -3,9 +3,9 @@ import ObjectManager from "./ObjectManager";
3
3
  export declare type saveResultType = "normal" | "nothing" | "error" | "canceled";
4
4
  export declare type saveType = "normal" | "quick";
5
5
  export declare type sendChangesType = boolean | "auto";
6
- declare type PropType<obj, prop extends keyof obj> = obj[prop];
7
6
  export declare type PropOf<obj> = keyof obj;
8
7
  export declare type WriteablePropOf<obj> = keyof obj;
8
+ export declare type PropType<obj, prop extends keyof obj> = obj[prop];
9
9
  export declare class SimpleObject extends MapableObject {
10
10
  #private;
11
11
  static readonly __cache_name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",