@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.
- package/dist/index.d.ts +1 -1
- package/dist/src/WebObjects/ParentWebObject.d.ts +24 -24
- package/dist/src/WebObjects/ParentWebObject.js +7 -7
- package/dist/src/WebObjects/WebObject.d.ts +153 -153
- package/dist/src/WebObjects/WebObject.js +476 -561
- package/dist/src/WebObjects/WebObjectHelper.d.ts +9 -9
- package/dist/src/WebObjects/WebObjectHelper.js +4 -4
- package/dist/src/WebObjects/WebObjectHelper.test.d.ts +1 -1
- package/dist/src/WebObjects/WebObjectHelper.test.js +1 -1
- package/dist/src/WebObjects/WebObjectManager.d.ts +68 -68
- package/dist/src/WebObjects/WebObjectManager.js +303 -350
- package/dist/src/WebObjects/WebObjectPathHelper.d.ts +36 -36
- package/dist/src/WebObjects/WebObjectPathHelper.js +31 -39
- package/dist/src/WebObjects/WebObjectPathHelper.test.d.ts +1 -1
- package/dist/src/WebObjects/WebObjectPathHelper.test.js +55 -61
- package/dist/src/index.d.ts +10 -10
- package/dist/src/structs/DummyObject.d.ts +5 -5
- package/dist/src/structs/DummyObject.js +1 -1
- package/dist/src/structs/MapableObject.d.ts +43 -43
- package/dist/src/structs/MapableObject.js +3 -3
- package/dist/src/structs/MetaObject.d.ts +15 -15
- package/dist/src/structs/MetaObject.js +19 -25
- package/dist/src/structs/ObjectArray.d.ts +10 -10
- package/dist/src/structs/ObjectArray.js +1 -1
- package/dist/src/structs/ObjectManager.d.ts +140 -140
- package/dist/src/structs/ObjectManager.js +202 -223
- package/dist/src/structs/ObjectWithTemp.d.ts +17 -17
- package/dist/src/structs/ObjectWithTemp.js +13 -17
- package/dist/src/structs/SimpleObject.d.ts +318 -303
- package/dist/src/structs/SimpleObject.js +423 -467
- 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
|
-
|
|
25
|
-
static readonly
|
|
26
|
-
static readonly
|
|
27
|
-
static readonly
|
|
28
|
-
static readonly
|
|
29
|
-
static readonly
|
|
30
|
-
static readonly
|
|
31
|
-
static readonly
|
|
32
|
-
static readonly
|
|
33
|
-
static readonly
|
|
34
|
-
static readonly
|
|
35
|
-
static readonly
|
|
36
|
-
static readonly
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
protected
|
|
40
|
-
protected
|
|
41
|
-
protected
|
|
42
|
-
protected
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
protected
|
|
49
|
-
protected
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
protected
|
|
54
|
-
protected
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
* @param
|
|
84
|
-
* @
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* set value and run the event handlers if needed
|
|
109
|
-
* @
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
* @
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* @
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
* @param
|
|
142
|
-
* @param
|
|
143
|
-
* @param sendChanges
|
|
144
|
-
* @
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
* @param
|
|
152
|
-
* @
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
*
|
|
159
|
-
* @
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
169
|
-
* @
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
* @param
|
|
180
|
-
* @
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
*
|
|
188
|
-
* @
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*
|
|
198
|
-
* @
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
*
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
*
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
get
|
|
240
|
-
get
|
|
241
|
-
get
|
|
242
|
-
get
|
|
243
|
-
|
|
244
|
-
get
|
|
245
|
-
get
|
|
246
|
-
get
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
static
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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;
|