@etsoo/shared 1.2.52 → 1.2.54
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/.github/workflows/main.yml +6 -5
- package/lib/cjs/ActionResult.d.ts +1 -1
- package/lib/cjs/ActionResult.js +3 -3
- package/lib/cjs/ArrayUtils.d.ts +1 -1
- package/lib/cjs/ArrayUtils.js +4 -4
- package/lib/cjs/ColorUtils.d.ts +1 -1
- package/lib/cjs/ColorUtils.js +2 -2
- package/lib/cjs/DataTypes.d.ts +6 -6
- package/lib/cjs/DataTypes.js +50 -51
- package/lib/cjs/DateUtils.d.ts +1 -1
- package/lib/cjs/DateUtils.js +27 -28
- package/lib/cjs/DomUtils.d.ts +3 -3
- package/lib/cjs/DomUtils.js +64 -73
- package/lib/cjs/ExtendUtils.d.ts +1 -1
- package/lib/cjs/ExtendUtils.js +6 -6
- package/lib/cjs/IActionResult.d.ts +1 -1
- package/lib/cjs/NumberUtils.d.ts +1 -1
- package/lib/cjs/NumberUtils.js +9 -9
- package/lib/cjs/StorageUtils.js +2 -2
- package/lib/cjs/Utils.d.ts +4 -4
- package/lib/cjs/Utils.js +58 -62
- package/lib/cjs/index.d.ts +22 -22
- package/lib/cjs/storage/WindowStorage.d.ts +1 -1
- package/lib/cjs/types/ContentDisposition.d.ts +2 -2
- package/lib/cjs/types/ContentDisposition.js +11 -13
- package/lib/cjs/types/EColor.js +5 -7
- package/lib/cjs/types/EHistory.d.ts +3 -3
- package/lib/cjs/types/EHistory.js +4 -4
- package/lib/cjs/types/ErrorData.d.ts +1 -1
- package/lib/cjs/types/EventClass.js +1 -1
- package/lib/mjs/ActionResult.d.ts +1 -1
- package/lib/mjs/ActionResult.js +3 -3
- package/lib/mjs/ArrayUtils.d.ts +1 -1
- package/lib/mjs/ArrayUtils.js +5 -5
- package/lib/mjs/ColorUtils.d.ts +1 -1
- package/lib/mjs/ColorUtils.js +3 -3
- package/lib/mjs/DataTypes.d.ts +6 -6
- package/lib/mjs/DataTypes.js +50 -51
- package/lib/mjs/DateUtils.d.ts +1 -1
- package/lib/mjs/DateUtils.js +27 -28
- package/lib/mjs/DomUtils.d.ts +3 -3
- package/lib/mjs/DomUtils.js +67 -76
- package/lib/mjs/ExtendUtils.d.ts +1 -1
- package/lib/mjs/ExtendUtils.js +6 -6
- package/lib/mjs/IActionResult.d.ts +1 -1
- package/lib/mjs/NumberUtils.d.ts +1 -1
- package/lib/mjs/NumberUtils.js +9 -9
- package/lib/mjs/StorageUtils.js +4 -4
- package/lib/mjs/Utils.d.ts +4 -4
- package/lib/mjs/Utils.js +61 -65
- package/lib/mjs/index.d.ts +22 -22
- package/lib/mjs/index.js +22 -22
- package/lib/mjs/storage/WindowStorage.d.ts +1 -1
- package/lib/mjs/storage/WindowStorage.js +2 -2
- package/lib/mjs/types/ContentDisposition.d.ts +2 -2
- package/lib/mjs/types/ContentDisposition.js +12 -14
- package/lib/mjs/types/EColor.js +5 -7
- package/lib/mjs/types/EHistory.d.ts +3 -3
- package/lib/mjs/types/EHistory.js +5 -5
- package/lib/mjs/types/ErrorData.d.ts +1 -1
- package/lib/mjs/types/EventClass.js +1 -1
- package/package.json +61 -63
- package/src/ActionResult.ts +23 -23
- package/src/ArrayUtils.ts +164 -172
- package/src/ColorUtils.ts +80 -82
- package/src/DataTypes.ts +745 -754
- package/src/DateUtils.ts +266 -268
- package/src/DomUtils.ts +806 -831
- package/src/ExtendUtils.ts +191 -191
- package/src/IActionResult.ts +42 -42
- package/src/Keyboard.ts +258 -258
- package/src/NumberUtils.ts +135 -135
- package/src/StorageUtils.ts +117 -117
- package/src/Utils.ts +908 -930
- package/src/index.ts +22 -22
- package/src/node/Storage.ts +53 -53
- package/src/storage/IStorage.ts +62 -62
- package/src/storage/WindowStorage.ts +140 -140
- package/src/types/ContentDisposition.ts +59 -63
- package/src/types/DataError.ts +15 -15
- package/src/types/DelayedExecutorType.ts +15 -15
- package/src/types/EColor.ts +241 -248
- package/src/types/EHistory.ts +151 -151
- package/src/types/ErrorData.ts +11 -11
- package/src/types/EventClass.ts +220 -220
- package/src/types/FormData.ts +25 -25
- package/src/types/ParsedPath.ts +5 -5
- package/tsconfig.cjs.json +16 -16
- package/tsconfig.json +16 -16
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -29
- package/.prettierignore +0 -5
- package/.prettierrc +0 -6
package/src/ExtendUtils.ts
CHANGED
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
import { DelayedExecutorType } from
|
|
1
|
+
import { DelayedExecutorType } from "./types/DelayedExecutorType";
|
|
2
2
|
|
|
3
|
-
const hasRequestAnimationFrame = typeof requestAnimationFrame ===
|
|
3
|
+
const hasRequestAnimationFrame = typeof requestAnimationFrame === "function";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Extend utilities
|
|
7
7
|
*/
|
|
8
8
|
export namespace ExtendUtils {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Apply mixins, official suggested method
|
|
11
|
+
* https://www.typescriptlang.org/docs/handbook/mixins.html#understanding-the-sample
|
|
12
|
+
* @param derivedCtor Mixin target class
|
|
13
|
+
* @param baseCtors Mixin base classes
|
|
14
|
+
*/
|
|
15
|
+
export function applyMixins(derivedCtor: any, baseCtors: any[]) {
|
|
16
|
+
baseCtors.forEach((baseCtor) => {
|
|
17
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
18
|
+
if (name !== "constructor") {
|
|
19
|
+
// eslint-disable-next-line no-param-reassign
|
|
20
|
+
derivedCtor.prototype[name] = baseCtor.prototype[name];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create delayed executor
|
|
28
|
+
* @param func Function
|
|
29
|
+
* @param delayMiliseconds Delay miliseconds
|
|
30
|
+
* @returns Result
|
|
31
|
+
*/
|
|
32
|
+
export function delayedExecutor<P extends any[]>(
|
|
33
|
+
func: (...args: P) => void,
|
|
34
|
+
delayMiliseconds: number
|
|
35
|
+
): DelayedExecutorType<P> {
|
|
36
|
+
let cancel: (() => void) | undefined;
|
|
37
|
+
return {
|
|
38
|
+
/**
|
|
39
|
+
* Call the function
|
|
40
|
+
* @param miliseconds Delayed miliseconds for this call
|
|
41
|
+
* @param args Args
|
|
42
|
+
*/
|
|
43
|
+
call(miliseconds?: number, ...args: P) {
|
|
44
|
+
this.clear();
|
|
45
|
+
cancel = waitFor(() => {
|
|
46
|
+
func(...args);
|
|
47
|
+
cancel = undefined;
|
|
48
|
+
}, miliseconds ?? delayMiliseconds);
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Clear
|
|
53
|
+
*/
|
|
54
|
+
clear() {
|
|
55
|
+
if (this.isRunning()) {
|
|
56
|
+
if (cancel) cancel();
|
|
57
|
+
cancel = undefined;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Is running or not
|
|
63
|
+
* @returns Result
|
|
64
|
+
*/
|
|
65
|
+
isRunning() {
|
|
66
|
+
return cancel != null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Promise handler to catch error
|
|
73
|
+
* @param promise Promise
|
|
74
|
+
*/
|
|
75
|
+
export const promiseHandler = (promise: Promise<unknown>) =>
|
|
76
|
+
promise
|
|
77
|
+
.then((value) => [value, undefined])
|
|
78
|
+
.catch((reason) => Promise.resolve([undefined, reason]));
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Delay promise
|
|
82
|
+
* @param delay Delay miniseconds
|
|
83
|
+
*/
|
|
84
|
+
export function sleep(delay = 0) {
|
|
85
|
+
return new Promise<void>((resolve) => {
|
|
86
|
+
waitFor(resolve, delay);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Wait for condition meets and execute callback
|
|
92
|
+
* requestAnimationFrame to replace setTimeout
|
|
93
|
+
* @param callback Callback
|
|
94
|
+
* @param checkReady Check ready, when it's a number as miliseconds, similar to setTimeout
|
|
95
|
+
* @returns cancel callback
|
|
96
|
+
*/
|
|
97
|
+
export function waitFor(
|
|
98
|
+
callback: () => void,
|
|
99
|
+
checkReady: ((spanTime: number) => boolean) | number
|
|
100
|
+
) {
|
|
101
|
+
let requestID: number | undefined | NodeJS.Timeout;
|
|
102
|
+
|
|
103
|
+
if (hasRequestAnimationFrame) {
|
|
104
|
+
let lastTime: number | undefined;
|
|
105
|
+
function loop(timestamp: number) {
|
|
106
|
+
// Cancelled
|
|
107
|
+
if (requestID == null) return;
|
|
108
|
+
|
|
109
|
+
if (lastTime === undefined) {
|
|
110
|
+
lastTime = timestamp;
|
|
111
|
+
}
|
|
25
112
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export function delayedExecutor<P extends any[]>(
|
|
33
|
-
func: (...args: P) => void,
|
|
34
|
-
delayMiliseconds: number
|
|
35
|
-
): DelayedExecutorType<P> {
|
|
36
|
-
let cancel: (() => void) | undefined;
|
|
37
|
-
return {
|
|
38
|
-
/**
|
|
39
|
-
* Call the function
|
|
40
|
-
* @param miliseconds Delayed miliseconds for this call
|
|
41
|
-
* @param args Args
|
|
42
|
-
*/
|
|
43
|
-
call(miliseconds?: number, ...args: P) {
|
|
44
|
-
this.clear();
|
|
45
|
-
cancel = waitFor(() => {
|
|
46
|
-
func(...args);
|
|
47
|
-
cancel = undefined;
|
|
48
|
-
}, miliseconds ?? delayMiliseconds);
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Clear
|
|
53
|
-
*/
|
|
54
|
-
clear() {
|
|
55
|
-
if (this.isRunning()) {
|
|
56
|
-
if (cancel) cancel();
|
|
57
|
-
cancel = undefined;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Is running or not
|
|
63
|
-
* @returns Result
|
|
64
|
-
*/
|
|
65
|
-
isRunning() {
|
|
66
|
-
return cancel != null;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
113
|
+
const elapsed = timestamp - lastTime;
|
|
114
|
+
|
|
115
|
+
const isReady =
|
|
116
|
+
typeof checkReady === "number"
|
|
117
|
+
? elapsed >= checkReady
|
|
118
|
+
: checkReady(elapsed);
|
|
70
119
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
120
|
+
if (isReady) {
|
|
121
|
+
callback();
|
|
122
|
+
} else if (requestID != null) {
|
|
123
|
+
// May also be cancelled in callback or somewhere
|
|
124
|
+
requestID = requestAnimationFrame(loop);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
requestID = requestAnimationFrame(loop);
|
|
128
|
+
} else if (typeof checkReady === "number") {
|
|
129
|
+
requestID = setTimeout(callback, checkReady);
|
|
130
|
+
} else {
|
|
131
|
+
// Bad practice to use setTimeout in this way, only for compatibility
|
|
132
|
+
const ms = 20;
|
|
133
|
+
let spanTime = 0;
|
|
134
|
+
let cr = checkReady;
|
|
135
|
+
function loop() {
|
|
136
|
+
// Cancelled
|
|
137
|
+
if (requestID == null) return;
|
|
138
|
+
|
|
139
|
+
spanTime += ms;
|
|
140
|
+
|
|
141
|
+
if (cr(spanTime)) {
|
|
142
|
+
callback();
|
|
143
|
+
} else if (requestID != null) {
|
|
144
|
+
// May also be cancelled in callback or somewhere
|
|
145
|
+
requestID = setTimeout(loop, ms);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
requestID = setTimeout(loop, ms);
|
|
88
149
|
}
|
|
89
150
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* @param checkReady Check ready, when it's a number as miliseconds, similar to setTimeout
|
|
95
|
-
* @returns cancel callback
|
|
96
|
-
*/
|
|
97
|
-
export function waitFor(
|
|
98
|
-
callback: () => void,
|
|
99
|
-
checkReady: ((spanTime: number) => boolean) | number
|
|
100
|
-
) {
|
|
101
|
-
let requestID: number | undefined | NodeJS.Timeout;
|
|
102
|
-
|
|
103
|
-
if (hasRequestAnimationFrame) {
|
|
104
|
-
let lastTime: number | undefined;
|
|
105
|
-
function loop(timestamp: number) {
|
|
106
|
-
// Cancelled
|
|
107
|
-
if (requestID == null) return;
|
|
108
|
-
|
|
109
|
-
if (lastTime === undefined) {
|
|
110
|
-
lastTime = timestamp;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const elapsed = timestamp - lastTime;
|
|
114
|
-
|
|
115
|
-
const isReady =
|
|
116
|
-
typeof checkReady === 'number'
|
|
117
|
-
? elapsed >= checkReady
|
|
118
|
-
: checkReady(elapsed);
|
|
119
|
-
|
|
120
|
-
if (isReady) {
|
|
121
|
-
callback();
|
|
122
|
-
} else if (requestID != null) {
|
|
123
|
-
// May also be cancelled in callback or somewhere
|
|
124
|
-
requestID = requestAnimationFrame(loop);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
requestID = requestAnimationFrame(loop);
|
|
128
|
-
} else if (typeof checkReady === 'number') {
|
|
129
|
-
requestID = setTimeout(callback, checkReady);
|
|
151
|
+
return () => {
|
|
152
|
+
if (requestID) {
|
|
153
|
+
if (hasRequestAnimationFrame && typeof requestID === "number") {
|
|
154
|
+
cancelAnimationFrame(requestID);
|
|
130
155
|
} else {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
156
|
+
clearTimeout(requestID);
|
|
157
|
+
}
|
|
158
|
+
requestID = undefined;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Repeat interval for callback
|
|
165
|
+
* @param callback Callback
|
|
166
|
+
* @param miliseconds Miliseconds
|
|
167
|
+
* @returns cancel callback
|
|
168
|
+
*/
|
|
169
|
+
export function intervalFor(callback: () => void, miliseconds: number) {
|
|
170
|
+
let requestID: number | undefined | NodeJS.Timeout;
|
|
171
|
+
|
|
172
|
+
if (hasRequestAnimationFrame) {
|
|
173
|
+
let lastTime: number | undefined;
|
|
174
|
+
function loop(timestamp: number) {
|
|
175
|
+
// Cancelled
|
|
176
|
+
if (requestID == null) return;
|
|
177
|
+
|
|
178
|
+
if (lastTime === undefined) {
|
|
179
|
+
lastTime = timestamp;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const elapsed = timestamp - lastTime;
|
|
183
|
+
if (elapsed >= miliseconds) {
|
|
184
|
+
lastTime = timestamp;
|
|
185
|
+
callback();
|
|
149
186
|
}
|
|
150
187
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
};
|
|
188
|
+
if (requestID != null) {
|
|
189
|
+
// May also be cancelled in callback or somewhere
|
|
190
|
+
requestID = requestAnimationFrame(loop);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
requestID = requestAnimationFrame(loop);
|
|
194
|
+
} else {
|
|
195
|
+
requestID = setInterval(callback, miliseconds);
|
|
161
196
|
}
|
|
162
197
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* @returns cancel callback
|
|
168
|
-
*/
|
|
169
|
-
export function intervalFor(callback: () => void, miliseconds: number) {
|
|
170
|
-
let requestID: number | undefined | NodeJS.Timer;
|
|
171
|
-
|
|
172
|
-
if (hasRequestAnimationFrame) {
|
|
173
|
-
let lastTime: number | undefined;
|
|
174
|
-
function loop(timestamp: number) {
|
|
175
|
-
// Cancelled
|
|
176
|
-
if (requestID == null) return;
|
|
177
|
-
|
|
178
|
-
if (lastTime === undefined) {
|
|
179
|
-
lastTime = timestamp;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const elapsed = timestamp - lastTime;
|
|
183
|
-
if (elapsed >= miliseconds) {
|
|
184
|
-
lastTime = timestamp;
|
|
185
|
-
callback();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (requestID != null) {
|
|
189
|
-
// May also be cancelled in callback or somewhere
|
|
190
|
-
requestID = requestAnimationFrame(loop);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
requestID = requestAnimationFrame(loop);
|
|
198
|
+
return () => {
|
|
199
|
+
if (requestID) {
|
|
200
|
+
if (hasRequestAnimationFrame && typeof requestID === "number") {
|
|
201
|
+
cancelAnimationFrame(requestID);
|
|
194
202
|
} else {
|
|
195
|
-
|
|
203
|
+
clearInterval(requestID);
|
|
196
204
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
cancelAnimationFrame(requestID);
|
|
202
|
-
} else {
|
|
203
|
-
clearInterval(requestID);
|
|
204
|
-
}
|
|
205
|
-
requestID = undefined;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
205
|
+
requestID = undefined;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
209
|
}
|
package/src/IActionResult.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { IdType } from
|
|
1
|
+
import { IdType } from "./DataTypes";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Result errors
|
|
5
5
|
* Indexable type
|
|
6
6
|
*/
|
|
7
7
|
export interface IResultErrors {
|
|
8
|
-
|
|
8
|
+
readonly [key: string]: string[];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Operation result interface
|
|
13
13
|
*/
|
|
14
14
|
export interface IActionResult<D extends object = {}> {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Status code
|
|
17
|
+
*/
|
|
18
|
+
readonly status?: number;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Result data
|
|
22
|
+
*/
|
|
23
|
+
readonly data?: D;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Result errors
|
|
27
|
+
*/
|
|
28
|
+
readonly errors?: IResultErrors;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Title
|
|
32
|
+
*/
|
|
33
|
+
title?: string;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Detail
|
|
37
|
+
*/
|
|
38
|
+
detail?: string;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Trace id
|
|
42
|
+
*/
|
|
43
|
+
traceId?: string;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Type
|
|
47
|
+
*/
|
|
48
|
+
type?: string;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Field name
|
|
52
|
+
*/
|
|
53
|
+
field?: string;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Success or not
|
|
57
|
+
*/
|
|
58
|
+
readonly ok: boolean;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Action result with id
|
|
63
63
|
*/
|
|
64
64
|
export type IdActionResult<T extends IdType = number> = IActionResult<{
|
|
65
|
-
|
|
65
|
+
id: T;
|
|
66
66
|
}>;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Action result with message data
|
|
70
70
|
*/
|
|
71
71
|
export type MsgActionResult = IActionResult<{
|
|
72
|
-
|
|
72
|
+
msg: string;
|
|
73
73
|
}>;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Action result with id, message data
|
|
77
77
|
*/
|
|
78
78
|
export type IdMsgActionResult = IActionResult<{
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
id: number;
|
|
80
|
+
msg: string;
|
|
81
81
|
}>;
|
|
82
82
|
|
|
83
83
|
/**
|