@azrico/webobject 1.5.69 → 1.5.71

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.
Files changed (31) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/src/WebObjects/ParentWebObject.d.ts +24 -24
  3. package/dist/src/WebObjects/ParentWebObject.js +7 -7
  4. package/dist/src/WebObjects/WebObject.d.ts +153 -153
  5. package/dist/src/WebObjects/WebObject.js +476 -561
  6. package/dist/src/WebObjects/WebObjectHelper.d.ts +9 -9
  7. package/dist/src/WebObjects/WebObjectHelper.js +4 -4
  8. package/dist/src/WebObjects/WebObjectHelper.test.d.ts +1 -1
  9. package/dist/src/WebObjects/WebObjectHelper.test.js +1 -1
  10. package/dist/src/WebObjects/WebObjectManager.d.ts +68 -68
  11. package/dist/src/WebObjects/WebObjectManager.js +303 -350
  12. package/dist/src/WebObjects/WebObjectPathHelper.d.ts +36 -36
  13. package/dist/src/WebObjects/WebObjectPathHelper.js +31 -39
  14. package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +1 -1
  15. package/dist/src/WebObjects/WebObjectPathHelper.test.js +55 -61
  16. package/dist/src/index.d.ts +10 -10
  17. package/dist/src/structs/DummyObject.d.ts +5 -5
  18. package/dist/src/structs/DummyObject.js +1 -1
  19. package/dist/src/structs/MapableObject.d.ts +43 -43
  20. package/dist/src/structs/MapableObject.js +3 -3
  21. package/dist/src/structs/MetaObject.d.ts +15 -15
  22. package/dist/src/structs/MetaObject.js +19 -25
  23. package/dist/src/structs/ObjectArray.d.ts +10 -10
  24. package/dist/src/structs/ObjectArray.js +1 -1
  25. package/dist/src/structs/ObjectManager.d.ts +140 -140
  26. package/dist/src/structs/ObjectManager.js +202 -223
  27. package/dist/src/structs/ObjectWithTemp.d.ts +17 -17
  28. package/dist/src/structs/ObjectWithTemp.js +13 -17
  29. package/dist/src/structs/SimpleObject.d.ts +318 -303
  30. package/dist/src/structs/SimpleObject.js +423 -467
  31. package/package.json +63 -82
@@ -1,303 +1,318 @@
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<MKey extends PropOf<this>>(key: MKey): PropType<this, MKey>;
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
- set_temp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
138
- setTemp: (key: string, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
139
- /**
140
- * Push a single value to array property
141
- * @param key
142
- * @param value
143
- * @param sendChanges
144
- * @returns
145
- */
146
- pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
147
- /**
148
- * Push a list of values to array property
149
- * @param key
150
- * @param values
151
- * @param sendChanges
152
- * @returns
153
- */
154
- pushValues<MKey extends PropOf<this>>(key: MKey, values: any[], sendChanges?: sendChangesType): Promise<this[MKey] | false>;
155
- /**
156
- * load all properties in `initObject` into the current object
157
- * @param initObject
158
- * @param fullUpdate
159
- * @returns
160
- */
161
- loadValues(initObject: any, fullUpdate?: boolean): boolean;
162
- static loadValues(obj: SimpleObject, initObject: any, fullUpdate?: boolean): boolean;
163
- clearRefreshFunction(): Promise<void>;
164
- setRefreshFunction(new_fnc: any): Promise<any>;
165
- addRefreshFunction(new_fnc: any): any;
166
- runRefreshFunction(...params: any): Promise<void>;
167
- /**
168
- *
169
- * @param type
170
- * @param key
171
- * @param value
172
- * @param subvalue
173
- * @returns true if manager was notified. false otherwise
174
- */
175
- notifyChanged<MKey extends PropOf<this>>(type: string, key: MKey | string, value: any, subvalue?: any): Promise<false | any[]>;
176
- /**
177
- * get a list of all keys that can be changed in given objcet
178
- * @param object
179
- * @param options
180
- * @returns
181
- */
182
- static getChangeableKeys(object: SimpleObject, options: deltaParams): any[];
183
- /**
184
- * check if a key can be changed on an object
185
- * @param object the object we are checking
186
- * @param key key of the object
187
- * @param useExtraProps should we check extra props?
188
- * @returns
189
- */
190
- static canChangeKey(object: SimpleObject, key: string, options: deltaParams): boolean;
191
- static hasIllegalChanges(referenceObject: any, changesObject: any, updaterUser: any): boolean;
192
- /**
193
- * Apply all the changes and empty the delta object
194
- */
195
- apply_changes(): boolean;
196
- /**
197
- * apply changes for the given fields
198
- * @param key
199
- * @returns
200
- */
201
- apply(keylist: PropOf<this> | Array<PropOf<this>>): boolean;
202
- /**
203
- * set the value to its original
204
- * @param key
205
- */
206
- discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
207
- /**
208
- * reset all values back to their original
209
- *
210
- * this function also calls `on_change` and then `clear_changes`
211
- * @param key
212
- */
213
- discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
214
- /**
215
- * clear and discard all changes
216
- *
217
- * does not call `on_change` functions
218
- * @returns
219
- */
220
- clear_changes(): boolean;
221
- /**
222
- * Sets readonly property on given objects
223
- * @param objs array of given objects or a single object
224
- * @param readonlyval readonly
225
- * @param clearChanges should we clean the changes after setting readonly
226
- */
227
- static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
228
- static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
229
- get __object_name(): string;
230
- get __db_name(): string;
231
- get isChanged(): boolean;
232
- get isArchived(): boolean;
233
- set isArchived(v: boolean);
234
- get isDeleted(): boolean;
235
- get isLocked(): boolean;
236
- get objectColor(): string;
237
- set isLocked(v: boolean);
238
- set isDeleted(v: boolean);
239
- get d(): Partial<this>;
240
- get allproperties(): Partial<this>;
241
- get canModify(): boolean;
242
- get __changeables(): string[];
243
- get __unchangeables(): string[];
244
- get __use_delta(): boolean;
245
- get isSaved(): boolean;
246
- get isNew(): boolean;
247
- get lastChanged(): string;
248
- get manager(): ObjectManager<any> | undefined;
249
- get_managerClass: () => ObjectManager<any> | undefined;
250
- /**
251
- * @deprecated use setManager
252
- * @param mng
253
- */
254
- set_managerClass(mng: any): boolean | undefined;
255
- /**
256
- * update the manager class for this object
257
- * @param mng
258
- */
259
- setManager(mng: any): boolean | undefined;
260
- static isDeleted<T extends SimpleObject>(obj: T): boolean;
261
- getIndexOrID(): number | string;
262
- getIndex(): number;
263
- getID(): string;
264
- static getIndexOrID(o: any): number;
265
- static getIndex(o: any): number;
266
- static getID(obj: any): string;
267
- event_run(eventName: string, ...params: any): Promise<any[] | undefined>;
268
- event_use(name: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): any;
269
- event_remove(name: string, uname: string): Promise<boolean | undefined> | undefined;
270
- event_add(name: string, uname: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): Promise<void>;
271
- getOriginal(): this | undefined;
272
- setOriginal(toObj?: null | 0 | any): this | undefined;
273
- static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
274
- static getOriginal<T extends SimpleObject>(obj: T): T | undefined;
275
- addError(title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
276
- clearErrors(): boolean;
277
- getErrors(): any[];
278
- static addError(o?: SimpleObject, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
279
- static getErrors(o: SimpleObject): any[];
280
- static clearErrors(o: SimpleObject): boolean;
281
- /**
282
- * Checks if the given object is a valid and truthy save result
283
- * @param result_object
284
- * @returns
285
- */
286
- static isResultValid(result_object: any, depth?: number): boolean;
287
- /**
288
- * set the response of last save from site
289
- * and its type
290
- * @param toObj
291
- */
292
- setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): saveResultType;
293
- getSaveResult(original?: boolean): any;
294
- getSaveResultType(): saveResultType;
295
- /** did we create on the last save */
296
- getIsLastSaveCreate(): boolean;
297
- static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<boolean | undefined>;
298
- static factoryClear(obj: SimpleObject): void;
299
- static delete_cache(context?: string): Promise<void>;
300
- static get_canModify(o: SimpleObject): boolean;
301
- static equals(a?: SimpleObject | any, b?: SimpleObject | any): boolean;
302
- }
303
- export default SimpleObject;
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
+ static readonly __db_name: string;
25
+ static readonly __object_name: string;
26
+ static readonly __unchangeables: string[];
27
+ static readonly __changeables: string[];
28
+ static readonly __extraProperties: string[];
29
+ static readonly __tempProperties: string[];
30
+ static readonly __protectedProperties: string[];
31
+ static readonly __functionProperties: string[];
32
+ static readonly __formatList?: formatObject;
33
+ static readonly __childTypes?: any[];
34
+ static readonly __importColumns?: string[];
35
+ static readonly __checkProperties: string[];
36
+ static readonly __use_delta: boolean;
37
+ _static(): Function;
38
+ protected __originalobject?: this;
39
+ protected __delta: Partial<this>;
40
+ protected __lastChanged?: string;
41
+ protected __is_readonly?: boolean;
42
+ protected __throw_errors?: boolean;
43
+ _deleted?: boolean;
44
+ _archived?: boolean;
45
+ _deletedBy?: string;
46
+ _locked?: boolean;
47
+ protected __errors?: any[];
48
+ protected __showErrors?: boolean;
49
+ protected __refresh_functions?: {
50
+ [key: string]: any;
51
+ };
52
+ protected __saveResultObject?: any;
53
+ protected __saveResultIsSuccess: boolean;
54
+ protected __saveResultType?: saveResultType;
55
+ readonly __initialized?: boolean;
56
+ protected __objectColor?: string;
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<MKey extends PropOf<this>>(key: MKey): PropType<this, MKey>;
79
+ protected getSubProperty(key: PropOf<this>, subkey: string, original?: boolean): any;
80
+ getSubValue: (key: PropOf<this>, subkey: string, original?: boolean) => any;
81
+ /**
82
+ * set value of a key only if the value is empty (null,undef,"")
83
+ * @param key
84
+ * @param value
85
+ * @returns
86
+ */
87
+ setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
88
+ setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
89
+ setDefaultPropertyNow(key: PropOf<this>): boolean;
90
+ protected setSubProperty(key: PropOf<this>, subkey: string, value: any): void;
91
+ /**
92
+ * update a property on this object by updating the `__delta`
93
+ * or update the object property directly depending on `__use_delta` setting
94
+ *
95
+ * @param key
96
+ * @param value
97
+ */
98
+ protected setProperty(key: PropOf<this>, value: any): boolean;
99
+ /**
100
+ * run the `set` for every key in the given object
101
+ * @return true if all are changed , false otherwise
102
+
103
+ */
104
+ set<MKey extends WriteablePropOf<this>>(setObj: Partial<{
105
+ [key in MKey]: any;
106
+ }>, changeablesOnly?: boolean, shouldNotify?: sendChangesType, autoApply?: any): Promise<boolean>;
107
+ /**
108
+ * set value and run the event handlers if needed
109
+ * @param key
110
+ * @param value
111
+ * @param shouldNotify
112
+ * @param autoApply if the field is not in delta, instantly calls the `apply` function to remove from delta
113
+ * @returns
114
+ */
115
+ set<MKey extends PropPrefixedOf<this>>(key: MKey, value: any, shouldNotify?: sendChangesType, autoApply?: any): Promise<boolean>;
116
+ /**
117
+ * @deprecated use `set`
118
+ * set value and run the event handlers if needed
119
+ * @return true if changed , false otherwise
120
+ */
121
+ setValue<MKey extends PropPrefixedOf<this>>(key: MKey | Partial<{
122
+ [key in MKey]: any;
123
+ }>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
124
+ /**
125
+ * @deprecated use set function
126
+ */
127
+ setAll<MKey extends PropPrefixedOf<this>>(key: MKey | Partial<{
128
+ [key in MKey]: any;
129
+ }>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
130
+ /**
131
+ * set value and run the event handlers if needed
132
+ *
133
+ * if the field is not in delta instantly calls the `apply` function to remove from delta
134
+ * @param key
135
+ * @param value
136
+ */
137
+ setPreferApply(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
138
+ /**
139
+ * set key of subObject
140
+ * @param key
141
+ * @param value
142
+ * @param subvalue
143
+ * @param sendChanges
144
+ * @return true if changed , false otherwise
145
+ */
146
+ setSubValue<MKey extends PropOf<this>>(key: MKey, objKey: string, subvalue: any, sendChanges?: sendChangesType): Promise<boolean>;
147
+ set_temp(key: string, value: any, sendChanges?: sendChangesType): Promise<boolean>;
148
+ setTemp: (key: string, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
149
+ /**
150
+ * Push a single value to array property
151
+ * @param key
152
+ * @param value
153
+ * @param sendChanges
154
+ * @returns
155
+ */
156
+ pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
157
+ /**
158
+ * Push a list of values to array property
159
+ * @param key
160
+ * @param values
161
+ * @param sendChanges
162
+ * @returns
163
+ */
164
+ pushValues<MKey extends PropOf<this>>(key: MKey, values: any[], sendChanges?: sendChangesType): Promise<this[MKey] | false>;
165
+ /**
166
+ * load all properties in `initObject` into the current object
167
+ * @param initObject
168
+ * @param fullUpdate
169
+ * @returns
170
+ */
171
+ loadValues(initObject: any, fullUpdate?: boolean): boolean;
172
+ static loadValues(obj: SimpleObject, initObject: any, fullUpdate?: boolean): boolean;
173
+ clearRefreshFunction(): Promise<void>;
174
+ setRefreshFunction(new_fnc: any): Promise<any>;
175
+ addRefreshFunction(new_fnc: any): any;
176
+ runRefreshFunction(...params: any): Promise<void>;
177
+ /**
178
+ *
179
+ * @param type
180
+ * @param key
181
+ * @param value
182
+ * @param subvalue
183
+ * @returns true if manager was notified. false otherwise
184
+ */
185
+ notifyChanged<MKey extends PropOf<this>>(type: string, key: MKey | string, value: any, subvalue?: any): Promise<false | any[]>;
186
+ /**
187
+ * get a list of all keys that can be changed in given objcet
188
+ * @param object
189
+ * @param options
190
+ * @returns
191
+ */
192
+ static getChangeableKeys(object: SimpleObject, options: deltaParams): any[];
193
+ /**
194
+ * check if a key can be changed on an object
195
+ * @param object the object we are checking
196
+ * @param key key of the object
197
+ * @param useExtraProps should we check extra props?
198
+ * @returns
199
+ */
200
+ static canChangeKey(object: SimpleObject, key: string, options: deltaParams): boolean;
201
+ static hasIllegalChanges(referenceObject: any, changesObject: any, updaterUser: any): boolean;
202
+ /**
203
+ * Apply all the changes and empty the delta object
204
+ */
205
+ apply_changes(): boolean;
206
+ /**
207
+ * apply changes for the given fields
208
+ * @param key
209
+ * @returns
210
+ */
211
+ apply(keylist: PropOf<this> | Array<PropOf<this>>): boolean;
212
+ /**
213
+ * set the value to its original
214
+ * @param key
215
+ */
216
+ discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
217
+ /**
218
+ * reset all values back to their original
219
+ *
220
+ * this function also calls `on_change` and then `clear_changes`
221
+ * @param key
222
+ */
223
+ discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
224
+ /**
225
+ * clear and discard all changes
226
+ *
227
+ * does not call `on_change` functions
228
+ * @returns
229
+ */
230
+ clear_changes(): boolean;
231
+ /**
232
+ * Sets readonly property on given objects
233
+ * @param objs array of given objects or a single object
234
+ * @param readonlyval readonly
235
+ * @param clearChanges should we clean the changes after setting readonly
236
+ */
237
+ static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
238
+ static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
239
+ get __object_name(): string;
240
+ get __db_name(): string;
241
+ get isChanged(): boolean;
242
+ get isArchived(): boolean;
243
+ set isArchived(v: boolean);
244
+ get isDeleted(): boolean;
245
+ get isLocked(): boolean;
246
+ get objectColor(): string;
247
+ set isLocked(v: boolean);
248
+ set isDeleted(v: boolean);
249
+ get d(): Partial<this>;
250
+ get allproperties(): Partial<this>;
251
+ get canModify(): boolean;
252
+ get __changeables(): string[];
253
+ get __unchangeables(): string[];
254
+ get __use_delta(): boolean;
255
+ get isSaved(): boolean;
256
+ get isNew(): boolean;
257
+ get lastChanged(): string;
258
+ get manager(): ObjectManager<any> | undefined;
259
+ get_managerClass: () => ObjectManager<any> | undefined;
260
+ /**
261
+ * @deprecated use setManager
262
+ * @param mng
263
+ */
264
+ set_managerClass(mng: any): boolean | undefined;
265
+ /**
266
+ * update the manager class for this object
267
+ * @param mng
268
+ */
269
+ setManager(mng: any): boolean | undefined;
270
+ static isDeleted<T extends SimpleObject>(obj: T): boolean;
271
+ getIndexOrID(): number | string;
272
+ getIndex(): number;
273
+ getID(): string;
274
+ static getIndexOrID(o: any): number;
275
+ static getIndex(o: any): number;
276
+ static getID(obj: any): string;
277
+ event_run(eventName: string, ...params: any): Promise<any[] | undefined>;
278
+ event_use(name: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): any;
279
+ event_remove(name: string, uname: string): Promise<boolean | undefined> | undefined;
280
+ event_add(name: string, uname: string, runEvent: (...inputdata: any) => any, onlyOn?: any, runOnce?: boolean): Promise<void>;
281
+ getOriginal(): this | undefined;
282
+ setOriginal(toObj?: null | 0 | any): this | undefined;
283
+ static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
284
+ static getOriginal<T extends SimpleObject>(obj: T): T | undefined;
285
+ addError(title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
286
+ clearErrors(): boolean;
287
+ getErrors(): any[];
288
+ static addError(o?: SimpleObject, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
289
+ static getErrors(o: SimpleObject): any[];
290
+ static clearErrors(o: SimpleObject): boolean;
291
+ /**
292
+ * Checks if the given object is a valid and truthy save result
293
+ * @param result_object
294
+ * @returns
295
+ */
296
+ static isResultValid(result_object: any, depth?: number): boolean;
297
+ /**
298
+ * set the response of last save from site
299
+ * and its type
300
+ * @param toObj
301
+ */
302
+ setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): saveResultType;
303
+ /**
304
+ * set the response of last save from site
305
+ * @param toObj
306
+ */
307
+ protected setSaveResultObject(toObj: any): boolean;
308
+ getSaveResult(original?: boolean): any;
309
+ getSaveResultType(): saveResultType;
310
+ /** did we create on the last save */
311
+ getIsLastSaveCreate(): boolean;
312
+ static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<boolean | undefined>;
313
+ static factoryClear(obj: SimpleObject): void;
314
+ static delete_cache(context?: string): Promise<void>;
315
+ static get_canModify(o: SimpleObject): boolean;
316
+ static equals(a?: SimpleObject | any, b?: SimpleObject | any): boolean;
317
+ }
318
+ export default SimpleObject;