ms-types 0.3.15 → 0.3.16
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/package.json +1 -1
- package/types/config.d.ts +36 -0
- package/types/file.d.ts +2 -2
- package/types/system.d.ts +0 -51
- package/types/ui.d.ts +0 -12
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +0 -51
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +0 -90
- package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +37 -1
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -2,8 +2,38 @@
|
|
|
2
2
|
* 配置模块 包含读取配置、更新配置、删除配置等功能
|
|
3
3
|
*/
|
|
4
4
|
declare namespace config {
|
|
5
|
+
/**
|
|
6
|
+
* 获取所有配置
|
|
7
|
+
* @returns 所有配置
|
|
8
|
+
* @example config.all()
|
|
9
|
+
*/
|
|
10
|
+
function all(): Record<string, any>;
|
|
11
|
+
/**
|
|
12
|
+
* 设置配置
|
|
13
|
+
* @param key 配置key
|
|
14
|
+
* @param value 配置值
|
|
15
|
+
* @returns 设置是否成功
|
|
16
|
+
* @example config.set("key", 100)
|
|
17
|
+
*/
|
|
18
|
+
function set(key: string, value: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 获取配置
|
|
21
|
+
* @param key 配置key
|
|
22
|
+
* @returns 配置值
|
|
23
|
+
* @example config.get("key")
|
|
24
|
+
*/
|
|
25
|
+
function get(key: string): any | null;
|
|
26
|
+
/**
|
|
27
|
+
* 删除配置
|
|
28
|
+
* @param key 配置key
|
|
29
|
+
* @returns 删除是否成功
|
|
30
|
+
* @example config.remove("key")
|
|
31
|
+
*/
|
|
32
|
+
function remove(key: string): boolean;
|
|
33
|
+
|
|
5
34
|
/**
|
|
6
35
|
* 读取配置Int
|
|
36
|
+
* @deprecated 请使用 config.get(key) 替代
|
|
7
37
|
* @param key 配置key
|
|
8
38
|
* @returns 配置值
|
|
9
39
|
* @example config.readConfigInt("key")
|
|
@@ -11,6 +41,7 @@ declare namespace config {
|
|
|
11
41
|
function readConfigInt(key: string): number;
|
|
12
42
|
/**
|
|
13
43
|
* 读取配置Double
|
|
44
|
+
* @deprecated 请使用 config.get(key) 替代
|
|
14
45
|
* @param key 配置key
|
|
15
46
|
* @returns 配置值
|
|
16
47
|
* @example config.readConfigDouble("key")
|
|
@@ -18,6 +49,7 @@ declare namespace config {
|
|
|
18
49
|
function readConfigDouble(key: string): number;
|
|
19
50
|
/**
|
|
20
51
|
* 读取配置String
|
|
52
|
+
* @deprecated 请使用 config.get(key) 替代
|
|
21
53
|
* @param key 配置key
|
|
22
54
|
* @returns 配置值,如果不存在返回 null
|
|
23
55
|
* @example config.readConfigString("key")
|
|
@@ -25,6 +57,7 @@ declare namespace config {
|
|
|
25
57
|
function readConfigString(key: string): string | null;
|
|
26
58
|
/**
|
|
27
59
|
* 读取配置Bool
|
|
60
|
+
* @deprecated 请使用 config.get(key) 替代
|
|
28
61
|
* @param key 配置key
|
|
29
62
|
* @returns 配置值
|
|
30
63
|
* @example config.readConfigBool("key")
|
|
@@ -32,12 +65,14 @@ declare namespace config {
|
|
|
32
65
|
function readConfigBool(key: string): boolean;
|
|
33
66
|
/**
|
|
34
67
|
* 获取所有配置JSON
|
|
68
|
+
* @deprecated 请使用 config.all() 替代
|
|
35
69
|
* @returns 所有配置JSON
|
|
36
70
|
* @example config.getConfigJSON()
|
|
37
71
|
*/
|
|
38
72
|
function getConfigJSON(): Record<string, any>;
|
|
39
73
|
/**
|
|
40
74
|
* 更新配置
|
|
75
|
+
* @deprecated 请使用 config.set(key, value) 替代
|
|
41
76
|
* @param key 配置key
|
|
42
77
|
* @param value 配置值
|
|
43
78
|
* @returns 更新是否成功
|
|
@@ -46,6 +81,7 @@ declare namespace config {
|
|
|
46
81
|
function updateConfig(key: string, value: any): boolean;
|
|
47
82
|
/**
|
|
48
83
|
* 删除配置
|
|
84
|
+
* @deprecated 请使用 config.remove(key) 替代
|
|
49
85
|
* @param key 配置key
|
|
50
86
|
* @returns 删除是否成功
|
|
51
87
|
* @example config.deleteConfig("key")
|
package/types/file.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ declare namespace file {
|
|
|
82
82
|
* @param path 文件路径
|
|
83
83
|
* @param content 文件内容
|
|
84
84
|
* @returns 是否写入成功
|
|
85
|
-
* @example file.writeFile("config.json", "name=
|
|
85
|
+
* @example file.writeFile("config.json", "name=agent")
|
|
86
86
|
*/
|
|
87
87
|
function writeFile(path: string, content: string): boolean;
|
|
88
88
|
/**
|
|
@@ -90,7 +90,7 @@ declare namespace file {
|
|
|
90
90
|
* @param path 文件路径
|
|
91
91
|
* @param content 文件内容
|
|
92
92
|
* @returns 是否追加成功
|
|
93
|
-
* @example file.appendLine("config.json", "name=
|
|
93
|
+
* @example file.appendLine("config.json", "name=agent")
|
|
94
94
|
*/
|
|
95
95
|
function appendLine(path: string, content: string): boolean;
|
|
96
96
|
/**
|
package/types/system.d.ts
CHANGED
|
@@ -170,57 +170,6 @@ declare namespace system {
|
|
|
170
170
|
* logi(`系统总内存: ${totalMemory}MB`)
|
|
171
171
|
*/
|
|
172
172
|
function getTotalMemory(): number;
|
|
173
|
-
/**
|
|
174
|
-
* 启动 WDA 服务
|
|
175
|
-
* @returns 是否启动成功
|
|
176
|
-
* @example
|
|
177
|
-
* const started = system.startWDA()
|
|
178
|
-
* if (started) {
|
|
179
|
-
* logi("WDA 启动成功")
|
|
180
|
-
* }
|
|
181
|
-
*/
|
|
182
|
-
function startWDA(): boolean;
|
|
183
|
-
/**
|
|
184
|
-
* 获取 WDA 状态
|
|
185
|
-
* @returns WDA 是否正在运行
|
|
186
|
-
* @example
|
|
187
|
-
* const isRunning = system.getWDAStatus()
|
|
188
|
-
* if (isRunning) {
|
|
189
|
-
* logi("WDA 服务正在运行")
|
|
190
|
-
* } else {
|
|
191
|
-
* logi("WDA 服务未运行")
|
|
192
|
-
* }
|
|
193
|
-
*/
|
|
194
|
-
function getWDAStatus(): boolean;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* 设置 WDA 设置项
|
|
198
|
-
* @param params WDA 设置项参数
|
|
199
|
-
* @returns 是否设置成功
|
|
200
|
-
* @example
|
|
201
|
-
* const set = system.setWDASettings({
|
|
202
|
-
* mjpegServerScreenshotQuality: 50,
|
|
203
|
-
* mjpegServerFramerate: 20,
|
|
204
|
-
* screenshotQuality: 1,
|
|
205
|
-
* })
|
|
206
|
-
* if (set) {
|
|
207
|
-
* logi("WDA 设置成功")
|
|
208
|
-
* }
|
|
209
|
-
*/
|
|
210
|
-
function setWDASettings(params: {
|
|
211
|
-
/**
|
|
212
|
-
* 视频截图质量,范围 1-100,默认 25
|
|
213
|
-
*/
|
|
214
|
-
mjpegServerScreenshotQuality?: number;
|
|
215
|
-
/**
|
|
216
|
-
* 视频截图帧率,范围 1-60,默认 10
|
|
217
|
-
*/
|
|
218
|
-
mjpegServerFramerate?: number;
|
|
219
|
-
/**
|
|
220
|
-
* 截图质量,范围 0 PNG 高质量 1 JPEG 高质量 2 JPEG 低质量
|
|
221
|
-
*/
|
|
222
|
-
screenshotQuality?: number;
|
|
223
|
-
}): boolean;
|
|
224
173
|
|
|
225
174
|
/**
|
|
226
175
|
* 启动 Agent 服务
|
package/types/ui.d.ts
CHANGED
|
@@ -68,18 +68,6 @@ declare namespace ms {
|
|
|
68
68
|
*/
|
|
69
69
|
function getServerDeviceId(): Promise<string>;
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* 获取WDA状态
|
|
73
|
-
* @returns 如果WDA正在运行返回true,否则返回false
|
|
74
|
-
*/
|
|
75
|
-
function getWDAStatus(): Promise<boolean>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 启动WDA服务
|
|
79
|
-
* @returns 如果调用成功返回true,否则返回false。注意:返回值仅表示调用是否成功,不代表WDA服务是否启动成功
|
|
80
|
-
*/
|
|
81
|
-
function startWDA(): Promise<boolean>;
|
|
82
|
-
|
|
83
71
|
/**
|
|
84
72
|
* 获取Agent状态
|
|
85
73
|
* @returns 如果Agent正在运行返回true,否则返回false
|
|
@@ -169,57 +169,6 @@ declare namespace $系统 {
|
|
|
169
169
|
* $打印信息日志(`系统总内存: ${总内存}MB`)
|
|
170
170
|
*/
|
|
171
171
|
function 获取系统总内存(): 数字;
|
|
172
|
-
/**
|
|
173
|
-
* 启动 WDA 服务
|
|
174
|
-
* @returns 是否启动成功
|
|
175
|
-
* @example
|
|
176
|
-
* const 是否启动成功 = $系统.启动WDA服务()
|
|
177
|
-
* if (是否启动成功) {
|
|
178
|
-
* $打印信息日志("WDA 启动成功")
|
|
179
|
-
* }
|
|
180
|
-
*/
|
|
181
|
-
function 启动WDA服务(): 布尔值;
|
|
182
|
-
/**
|
|
183
|
-
* 获取 WDA 状态
|
|
184
|
-
* @returns WDA 是否正在运行
|
|
185
|
-
* @example
|
|
186
|
-
* const 是否运行 = $系统.获取WDA状态()
|
|
187
|
-
* if (是否运行) {
|
|
188
|
-
* $打印信息日志("WDA 服务正在运行")
|
|
189
|
-
* } else {
|
|
190
|
-
* $打印信息日志("WDA 服务未运行")
|
|
191
|
-
* }
|
|
192
|
-
*/
|
|
193
|
-
function 获取WDA状态(): 布尔值;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* 设置 WDA 设置项
|
|
197
|
-
* @param params WDA 设置项参数
|
|
198
|
-
* @returns 是否设置成功
|
|
199
|
-
* @example
|
|
200
|
-
* const 是否设置成功 = $系统.设置WDA设置项({
|
|
201
|
-
* mjpegServerScreenshotQuality: 50,
|
|
202
|
-
* mjpegServerFramerate: 20,
|
|
203
|
-
* screenshotQuality: 1,
|
|
204
|
-
* })
|
|
205
|
-
* if (是否设置成功) {
|
|
206
|
-
* $打印信息日志("WDA 设置成功")
|
|
207
|
-
* }
|
|
208
|
-
*/
|
|
209
|
-
function 设置WDA设置项(params: {
|
|
210
|
-
/**
|
|
211
|
-
* 视频截图质量,范围 1-100,默认 25
|
|
212
|
-
*/
|
|
213
|
-
mjpegServerScreenshotQuality?: number;
|
|
214
|
-
/**
|
|
215
|
-
* 视频截图帧率,范围 1-60,默认 10
|
|
216
|
-
*/
|
|
217
|
-
mjpegServerFramerate?: number;
|
|
218
|
-
/**
|
|
219
|
-
* 截图质量,范围 0 PNG 高质量 1 JPEG 高质量 2 JPEG 低质量
|
|
220
|
-
*/
|
|
221
|
-
screenshotQuality?: number;
|
|
222
|
-
}): 布尔值;
|
|
223
172
|
|
|
224
173
|
/**
|
|
225
174
|
* 启动 Agent 服务
|
|
@@ -1,95 +1,5 @@
|
|
|
1
1
|
/// <reference path="全局模块.d.ts" />
|
|
2
2
|
|
|
3
|
-
declare namespace $快点 {
|
|
4
|
-
/**
|
|
5
|
-
* 注册UI函数 网页页面使用,给主进程调用
|
|
6
|
-
* @param name 函数名称
|
|
7
|
-
* @param func 函数
|
|
8
|
-
*/
|
|
9
|
-
function registerUIFunc(
|
|
10
|
-
name: string,
|
|
11
|
-
func: (data: Record<string, any>) => void
|
|
12
|
-
): void;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 发送事件 网页页面使用 给主进程发送事件
|
|
16
|
-
* @param event 事件名称
|
|
17
|
-
* @param data 事件参数
|
|
18
|
-
*/
|
|
19
|
-
function emitEvent(event: string, data: Record<string, any>): void;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 启动脚本 网页页面使用
|
|
23
|
-
* @returns 如果启动成功返回true,否则返回false
|
|
24
|
-
*/
|
|
25
|
-
function startTask(): Promise<boolean>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 停止脚本 网页页面使用
|
|
29
|
-
* @returns 如果停止成功返回false,否则返回true
|
|
30
|
-
*/
|
|
31
|
-
function stopTask(): Promise<boolean>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 检查脚本是否正在运行 网页页面使用
|
|
35
|
-
* @returns 如果脚本正在运行返回true,否则返回false
|
|
36
|
-
*/
|
|
37
|
-
function isTaskRunning(): Promise<boolean>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 设置配置项
|
|
41
|
-
* @param key 配置项键
|
|
42
|
-
* @param value 配置项值
|
|
43
|
-
* @returns 如果设置成功返回true,否则返回false
|
|
44
|
-
*/
|
|
45
|
-
function setConfig(key: string, value: any): Promise<boolean>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 获取配置项
|
|
49
|
-
* @param key 配置项键
|
|
50
|
-
* @returns 配置项值
|
|
51
|
-
*/
|
|
52
|
-
function getConfig(key: string): Promise<any>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 移除配置项
|
|
56
|
-
* @param key 配置项键
|
|
57
|
-
* @returns 如果移除成功返回true,否则返回false
|
|
58
|
-
*/
|
|
59
|
-
function removeConfig(key: string): Promise<boolean>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 获取所有配置的字典
|
|
63
|
-
* @returns 包含所有配置的字典
|
|
64
|
-
*/
|
|
65
|
-
function getAllConfig(): Promise<Record<string, any>>;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 获取服务器设备ID
|
|
69
|
-
* @returns 服务器设备ID
|
|
70
|
-
*/
|
|
71
|
-
function getServerDeviceId(): Promise<string>;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* 获取WDA状态
|
|
75
|
-
* @returns 如果WDA正在运行返回true,否则返回false
|
|
76
|
-
*/
|
|
77
|
-
function getWDAStatus(): Promise<boolean>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 启动WDA服务
|
|
81
|
-
* @returns 如果调用成功返回true,否则返回false。注意:返回值仅表示调用是否成功,不代表WDA服务是否启动成功
|
|
82
|
-
*/
|
|
83
|
-
function startWDA(): Promise<boolean>;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 打开URL
|
|
87
|
-
* @param url URL地址
|
|
88
|
-
* @returns 如果调用成功返回true,否则返回false
|
|
89
|
-
*/
|
|
90
|
-
function openURL(url: string): Promise<boolean>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
3
|
/**
|
|
94
4
|
* UI模块 提供WebView相关功能
|
|
95
5
|
*/
|
|
@@ -4,8 +4,38 @@
|
|
|
4
4
|
* 配置模块 包含读取配置、更新配置、删除配置等功能
|
|
5
5
|
*/
|
|
6
6
|
declare namespace $配置 {
|
|
7
|
+
/**
|
|
8
|
+
* 获取所有配置
|
|
9
|
+
* @returns 所有配置
|
|
10
|
+
* @example $配置.所有配置()
|
|
11
|
+
*/
|
|
12
|
+
function 所有配置(): 字典<任意类型>;
|
|
13
|
+
/**
|
|
14
|
+
* 设置配置
|
|
15
|
+
* @param 配置键 配置key
|
|
16
|
+
* @param 配置值 配置值
|
|
17
|
+
* @returns 设置是否成功
|
|
18
|
+
* @example $配置.设置("key", 100)
|
|
19
|
+
*/
|
|
20
|
+
function 设置(配置键: 字符串, 配置值: 任意类型): 布尔值;
|
|
21
|
+
/**
|
|
22
|
+
* 获取配置
|
|
23
|
+
* @param 配置键 配置key
|
|
24
|
+
* @returns 配置值
|
|
25
|
+
* @example $配置.获取("key")
|
|
26
|
+
*/
|
|
27
|
+
function 获取(配置键: 字符串): 任意类型 | null;
|
|
28
|
+
/**
|
|
29
|
+
* 删除配置
|
|
30
|
+
* @param 配置键 配置key
|
|
31
|
+
* @returns 删除是否成功
|
|
32
|
+
* @example $配置.删除("key")
|
|
33
|
+
*/
|
|
34
|
+
function 删除(配置键: 字符串): 布尔值;
|
|
35
|
+
|
|
7
36
|
/**
|
|
8
37
|
* 读取配置Int
|
|
38
|
+
* @deprecated 请使用 $配置.获取(配置键) 替代
|
|
9
39
|
* @param 配置键 配置key
|
|
10
40
|
* @returns 配置值
|
|
11
41
|
* @example $配置.读取整数("key")
|
|
@@ -13,6 +43,7 @@ declare namespace $配置 {
|
|
|
13
43
|
function 读取整数(配置键: 字符串): 数字;
|
|
14
44
|
/**
|
|
15
45
|
* 读取配置Double
|
|
46
|
+
* @deprecated 请使用 $配置.获取(配置键) 替代
|
|
16
47
|
* @param 配置键 配置key
|
|
17
48
|
* @returns 配置值
|
|
18
49
|
* @example $配置.读取浮点数("key")
|
|
@@ -20,6 +51,7 @@ declare namespace $配置 {
|
|
|
20
51
|
function 读取浮点数(配置键: 字符串): 数字;
|
|
21
52
|
/**
|
|
22
53
|
* 读取配置String
|
|
54
|
+
* @deprecated 请使用 $配置.获取(配置键) 替代
|
|
23
55
|
* @param 配置键 配置key
|
|
24
56
|
* @returns 配置值,如果不存在返回 null
|
|
25
57
|
* @example $配置.读取字符串("key")
|
|
@@ -27,6 +59,7 @@ declare namespace $配置 {
|
|
|
27
59
|
function 读取字符串(配置键: 字符串): 字符串 | null;
|
|
28
60
|
/**
|
|
29
61
|
* 读取配置Bool
|
|
62
|
+
* @deprecated 请使用 $配置.获取(配置键) 替代
|
|
30
63
|
* @param 配置键 配置key
|
|
31
64
|
* @returns 配置值
|
|
32
65
|
* @example $配置.读取布尔值("key")
|
|
@@ -34,12 +67,14 @@ declare namespace $配置 {
|
|
|
34
67
|
function 读取布尔值(配置键: 字符串): 布尔值;
|
|
35
68
|
/**
|
|
36
69
|
* 获取所有配置JSON
|
|
70
|
+
* @deprecated 请使用 $配置.所有配置() 替代
|
|
37
71
|
* @returns 所有配置JSON
|
|
38
72
|
* @example $配置.读取所有配置()
|
|
39
73
|
*/
|
|
40
74
|
function 读取所有配置(): 字典<任意类型>;
|
|
41
75
|
/**
|
|
42
76
|
* 更新配置
|
|
77
|
+
* @deprecated 请使用 $配置.设置(配置键, 配置值) 替代
|
|
43
78
|
* @param 配置键 配置key
|
|
44
79
|
* @param 配置值 配置值
|
|
45
80
|
* @returns 更新是否成功
|
|
@@ -48,7 +83,8 @@ declare namespace $配置 {
|
|
|
48
83
|
function 更新配置(配置键: 字符串, 配置值: 任意类型): 布尔值;
|
|
49
84
|
/**
|
|
50
85
|
* 删除配置
|
|
51
|
-
* @
|
|
86
|
+
* @deprecated 请使用 $配置.删除(配置键) 替代
|
|
87
|
+
* @param 配置键 配置key
|
|
52
88
|
* @returns 删除是否成功
|
|
53
89
|
* @example $配置.删除配置("key")
|
|
54
90
|
*/
|