@azrico/webobject 1.5.62 → 1.5.63

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,35 +1,76 @@
1
- import { object_get, object_set } from "@azrico/object";
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.ObjectWithTemp = void 0;
8
+ var _object = require("@azrico/object");
9
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
10
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
11
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
12
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
14
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
15
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
16
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ 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); }
20
+ 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"); }
2
21
  /**
3
22
  * This object supports temp values
4
- */
5
- export class ObjectWithTemp {
6
- __temp = undefined;
7
- constructor() { }
8
- /* ---------------------------------- temp ---------------------------------- */
9
- #getTempProperty(key) {
10
- if (this.__temp == null)
11
- return undefined;
12
- return object_get(this.__temp, key);
13
- }
14
- #setTempProperty(key, value) {
15
- if (this.__temp == null)
16
- this.__temp = {};
17
- return object_set(this.__temp, key, value);
18
- }
19
- getTemp = this.#getTempProperty;
20
- async setTemp(key, value) {
21
- let isValueChanged = false;
22
- isValueChanged = this.#getTempProperty(key) != value;
23
- this.#setTempProperty(key, value);
24
- return isValueChanged;
25
- }
23
+ */
24
+ var _ObjectWithTemp_brand = /*#__PURE__*/new WeakSet();
25
+ var ObjectWithTemp = exports.ObjectWithTemp = /*#__PURE__*/function () {
26
+ function ObjectWithTemp() {
27
+ _classCallCheck(this, ObjectWithTemp);
28
+ /* ---------------------------------- temp ---------------------------------- */
29
+ _classPrivateMethodInitSpec(this, _ObjectWithTemp_brand);
30
+ _defineProperty(this, "__temp", undefined);
31
+ _defineProperty(this, "getTemp", _assertClassBrand(_ObjectWithTemp_brand, this, _getTempProperty));
32
+ }
33
+ return _createClass(ObjectWithTemp, [{
34
+ key: "setTemp",
35
+ value: function () {
36
+ var _setTemp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
37
+ var isValueChanged;
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ isValueChanged = false;
42
+ isValueChanged = _assertClassBrand(_ObjectWithTemp_brand, this, _getTempProperty).call(this, key) != value;
43
+ _assertClassBrand(_ObjectWithTemp_brand, this, _setTempProperty).call(this, key, value);
44
+ return _context.abrupt("return", isValueChanged);
45
+ case 4:
46
+ case "end":
47
+ return _context.stop();
48
+ }
49
+ }, _callee, this);
50
+ }));
51
+ function setTemp(_x, _x2) {
52
+ return _setTemp.apply(this, arguments);
53
+ }
54
+ return setTemp;
55
+ }()
26
56
  /**
27
57
  * clear and discard all temp values
28
58
  * @returns
29
- */
30
- clear_cache() {
31
- delete this.__temp;
32
- return true;
33
- }
34
- }
35
- export default ObjectWithTemp;
59
+ */
60
+ }, {
61
+ key: "clear_cache",
62
+ value: function clear_cache() {
63
+ delete this.__temp;
64
+ return true;
65
+ }
66
+ }]);
67
+ }();
68
+ function _getTempProperty(key) {
69
+ if (this.__temp == null) return undefined;
70
+ return (0, _object.object_get)(this.__temp, key);
71
+ }
72
+ function _setTempProperty(key, value) {
73
+ if (this.__temp == null) this.__temp = {};
74
+ return (0, _object.object_set)(this.__temp, key, value);
75
+ }
76
+ var _default = exports["default"] = ObjectWithTemp;
@@ -0,0 +1,302 @@
1
+ import { PropType, WriteablePropOf, PropOf, Ensure, PropPrefixedOf, PropOnlyPrefixedOf } from "@azrico/types";
2
+ import { formatObject } from "@azrico/convert";
3
+ import { MapableObject } from "./MapableObject";
4
+ import ObjectManager from "./ObjectManager";
5
+ export type saveResultType = "normal" | "nothing" | "error" | "canceled";
6
+ export type saveType = "normal" | "quick";
7
+ export type sendChangesType = boolean | "auto";
8
+ export type WithManager<T extends SimpleObject> = Ensure<T, "manager">;
9
+ export type WithManagerOrNot<T extends SimpleObject> = T | WithManager<T>;
10
+ export type deltaParams = {
11
+ type?: string;
12
+ useDelta?: boolean;
13
+ isChild?: boolean;
14
+ changeableKeys?: string[];
15
+ allProperties?: boolean;
16
+ extraProperties?: boolean;
17
+ tempProperties?: boolean;
18
+ bypassProtected?: boolean;
19
+ needId?: boolean;
20
+ clean?: boolean;
21
+ applyFilter?: boolean;
22
+ };
23
+ export declare class SimpleObject extends MapableObject {
24
+ #private;
25
+ static readonly __db_name: string;
26
+ static readonly __object_name: string;
27
+ static readonly __unchangeables: string[];
28
+ static readonly __changeables: string[];
29
+ static readonly __extraProperties: string[];
30
+ static readonly __tempProperties: string[];
31
+ static readonly __protectedProperties: string[];
32
+ static readonly __functionProperties: string[];
33
+ static readonly __formatList?: formatObject;
34
+ static readonly __childTypes?: any[];
35
+ static readonly __importColumns?: string[];
36
+ static readonly __checkProperties: string[];
37
+ static readonly __use_delta: boolean;
38
+ _static(): Function;
39
+ protected __originalobject?: this;
40
+ protected __delta: Partial<this>;
41
+ protected __lastChanged?: string;
42
+ protected __is_readonly?: boolean;
43
+ protected __throw_errors?: boolean;
44
+ _deleted?: boolean;
45
+ _archived?: boolean;
46
+ _deletedBy?: string;
47
+ _locked?: boolean;
48
+ protected __errors?: any[];
49
+ protected __showErrors?: boolean;
50
+ protected __refresh_functions?: {
51
+ [key: string]: any;
52
+ };
53
+ protected __saveResultObject?: any;
54
+ protected __saveResultIsSuccess: boolean;
55
+ protected __saveResultType?: saveResultType;
56
+ readonly __initialized?: boolean;
57
+ _id: string;
58
+ _index_key: string;
59
+ _index_value: number;
60
+ constructor(is_readonly?: boolean);
61
+ init(...p: any[]): void;
62
+ get<MKey extends PropOf<this>>(key: MKey, original?: boolean): PropType<this, MKey>;
63
+ get<MKey extends PropOnlyPrefixedOf<this>>(key: MKey, original?: boolean): any;
64
+ /**
65
+ * static get method for SimpleObject
66
+ * @param obj
67
+ * @param key
68
+ * @param original
69
+ * @returns
70
+ */
71
+ static get<T extends SimpleObject, MKey extends PropOf<T>>(obj: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
72
+ /**
73
+ * use a property from the object, this will return latest value of the property
74
+ * uses `EventManager` to detect changes
75
+ *
76
+ * Only objects with a manager can use this function
77
+ */
78
+ use(key: PropOf<this>): PropType<this, keyof this> | Pick<ObjectManager<any>, any>;
79
+ getSubValue: (key: PropOf<this>, subkey: string, original?: boolean) => any;
80
+ /**
81
+ * set value of a key only if the value is empty (null,undef,"")
82
+ * @param key
83
+ * @param value
84
+ * @returns
85
+ */
86
+ setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
87
+ setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
88
+ setDefaultPropertyNow(key: PropOf<this>): boolean;
89
+ /**
90
+ * run the `set` for every key in the given object
91
+ * @return true if all are changed , false otherwise
92
+
93
+ */
94
+ set<MKey extends WriteablePropOf<this>>(setObj: Partial<{
95
+ [key in MKey]: any;
96
+ }>, changeablesOnly?: boolean, shouldNotify?: sendChangesType, autoApply?: any): Promise<boolean>;
97
+ /**
98
+ * set value and run the event handlers if needed
99
+ * @param key
100
+ * @param value
101
+ * @param shouldNotify
102
+ * @param autoApply if the field is not in delta, instantly calls the `apply` function to remove from delta
103
+ * @returns
104
+ */
105
+ set<MKey extends PropPrefixedOf<this>>(key: MKey, value: any, shouldNotify?: sendChangesType, autoApply?: any): Promise<boolean>;
106
+ /**
107
+ * @deprecated use `set`
108
+ * set value and run the event handlers if needed
109
+ * @return true if changed , false otherwise
110
+ */
111
+ setValue<MKey extends PropPrefixedOf<this>>(key: MKey | Partial<{
112
+ [key in MKey]: any;
113
+ }>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
114
+ /**
115
+ * @deprecated use set function
116
+ */
117
+ setAll<MKey extends PropPrefixedOf<this>>(key: MKey | Partial<{
118
+ [key in MKey]: any;
119
+ }>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
120
+ /**
121
+ * set value and run the event handlers if needed
122
+ *
123
+ * if the field is not in delta instantly calls the `apply` function to remove from delta
124
+ * @param key
125
+ * @param value
126
+ */
127
+ setPreferApply(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
128
+ /**
129
+ * set key of subObject
130
+ * @param key
131
+ * @param value
132
+ * @param subvalue
133
+ * @param sendChanges
134
+ * @return true if changed , false otherwise
135
+ */
136
+ setSubValue<MKey extends PropOf<this>>(key: MKey, objKey: string, subvalue: any, sendChanges?: sendChangesType): Promise<boolean>;
137
+ setTemp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
138
+ /**
139
+ * Push a single value to array property
140
+ * @param key
141
+ * @param value
142
+ * @param sendChanges
143
+ * @returns
144
+ */
145
+ pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
146
+ /**
147
+ * Push a list of values to array property
148
+ * @param key
149
+ * @param values
150
+ * @param sendChanges
151
+ * @returns
152
+ */
153
+ pushValues<MKey extends PropOf<this>>(key: MKey, values: any[], sendChanges?: sendChangesType): Promise<this[MKey] | false>;
154
+ /**
155
+ * load all properties in `initObject` into the current object
156
+ * @param initObject
157
+ * @param fullUpdate
158
+ * @returns
159
+ */
160
+ loadValues(initObject: any, fullUpdate?: boolean): boolean;
161
+ static loadValues(obj: SimpleObject, initObject: any, fullUpdate?: boolean): boolean;
162
+ clearRefreshFunction(): Promise<void>;
163
+ setRefreshFunction(new_fnc: any): Promise<any>;
164
+ addRefreshFunction(new_fnc: any): any;
165
+ runRefreshFunction(...params: any): Promise<void>;
166
+ /**
167
+ *
168
+ * @param type
169
+ * @param key
170
+ * @param value
171
+ * @param subvalue
172
+ * @returns true if manager was notified. false otherwise
173
+ */
174
+ notifyChanged<MKey extends PropOf<this>>(type: string, key: MKey | string, value: any, subvalue?: any): Promise<false | any[] | undefined>;
175
+ /**
176
+ * get a list of all keys that can be changed in given objcet
177
+ * @param object
178
+ * @param options
179
+ * @returns
180
+ */
181
+ static getChangeableKeys(object: SimpleObject, options: deltaParams): any[];
182
+ /**
183
+ * check if a key can be changed on an object
184
+ * @param object the object we are checking
185
+ * @param key key of the object
186
+ * @param useExtraProps should we check extra props?
187
+ * @returns
188
+ */
189
+ static canChangeKey(object: SimpleObject, key: string, options: deltaParams): boolean;
190
+ static hasIllegalChanges(referenceObject: any, changesObject: any, updaterUser: any): boolean;
191
+ /**
192
+ * Apply all the changes and empty the delta object
193
+ */
194
+ apply_changes(): boolean;
195
+ /**
196
+ * apply changes for the given fields
197
+ * @param key
198
+ * @returns
199
+ */
200
+ apply(keylist: PropOf<this> | Array<PropOf<this>>): boolean;
201
+ /**
202
+ * set the value to its original
203
+ * @param key
204
+ */
205
+ discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
206
+ /**
207
+ * reset all values back to their original
208
+ *
209
+ * this function also calls `on_change` and then `clear_changes`
210
+ * @param key
211
+ */
212
+ discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
213
+ /**
214
+ * clear and discard all changes
215
+ *
216
+ * does not call `on_change` functions
217
+ * @returns
218
+ */
219
+ clear_changes(): boolean;
220
+ /**
221
+ * Sets readonly property on given objects
222
+ * @param objs array of given objects or a single object
223
+ * @param readonlyval readonly
224
+ * @param clearChanges should we clean the changes after setting readonly
225
+ */
226
+ static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
227
+ static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
228
+ get __object_name(): string;
229
+ get __db_name(): string;
230
+ get isChanged(): boolean;
231
+ get isArchived(): boolean;
232
+ set isArchived(v: boolean);
233
+ get isDeleted(): boolean;
234
+ get isLocked(): boolean;
235
+ get objectColor(): string;
236
+ set isLocked(v: boolean);
237
+ set isDeleted(v: boolean);
238
+ get d(): Partial<this>;
239
+ get allproperties(): Partial<this>;
240
+ get canModify(): boolean;
241
+ get __changeables(): string[];
242
+ get __unchangeables(): string[];
243
+ get __use_delta(): boolean;
244
+ get isSaved(): boolean;
245
+ get isNew(): boolean;
246
+ get lastChanged(): string;
247
+ get manager(): ObjectManager<any> | undefined;
248
+ get_managerClass: () => ObjectManager<any> | undefined;
249
+ /**
250
+ * @deprecated use setManager
251
+ * @param mng
252
+ */
253
+ set_managerClass(mng: any): boolean | undefined;
254
+ /**
255
+ * update the manager class for this object
256
+ * @param mng
257
+ */
258
+ setManager(mng: any): boolean | undefined;
259
+ static isDeleted<T extends SimpleObject>(obj: T): boolean;
260
+ getIndexOrID(): number | string;
261
+ getIndex(): number;
262
+ getID(): string;
263
+ static getIndexOrID(o: any): number;
264
+ static getIndex(o: any): number;
265
+ static getID(obj: any): string;
266
+ event_run(eventName: string, ...params: any): Promise<any[] | undefined>;
267
+ event_use(name: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): any;
268
+ event_remove(name: string, uname: string): boolean | undefined;
269
+ event_add(name: string, uname: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): Promise<void>;
270
+ getOriginal(): this | undefined;
271
+ setOriginal(toObj?: null | 0 | any): this | undefined;
272
+ static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
273
+ static getOriginal<T extends SimpleObject>(obj: T): T | undefined;
274
+ addError(title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
275
+ clearErrors(): boolean;
276
+ getErrors(): any[];
277
+ static addError(o?: SimpleObject, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
278
+ static getErrors(o: SimpleObject): any[];
279
+ static clearErrors(o: SimpleObject): boolean;
280
+ /**
281
+ * Checks if the given object is a valid and truthy save result
282
+ * @param result_object
283
+ * @returns
284
+ */
285
+ static isResultValid(result_object: any, depth?: number): boolean;
286
+ /**
287
+ * set the response of last save from site
288
+ * and its type
289
+ * @param toObj
290
+ */
291
+ setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): saveResultType;
292
+ getSaveResult(original?: boolean): any;
293
+ getSaveResultType(): saveResultType;
294
+ /** did we create on the last save */
295
+ getIsLastSaveCreate(): boolean;
296
+ static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<boolean | undefined>;
297
+ static factoryClear(obj: SimpleObject): void;
298
+ static delete_cache(context?: string): Promise<void>;
299
+ static get_canModify(o: SimpleObject): boolean;
300
+ static equals(a?: SimpleObject | any, b?: SimpleObject | any): boolean;
301
+ }
302
+ export default SimpleObject;