assistsx-js 0.1.41 → 0.2.0
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/README.md +32 -0
- package/dist/index.cjs +7957 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +4231 -0
- package/dist/index.d.ts +4231 -30
- package/dist/index.global.js +46 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +7879 -30
- package/dist/index.js.map +1 -0
- package/package.json +11 -5
- package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
- package/src/{AssistsX.ts → assistsx.ts} +8 -8
- package/src/barutils/bar-utils.ts +3 -3
- package/src/filesystem/fileio/file-io.ts +2 -2
- package/src/filesystem/fileutils/file-utils.ts +2 -2
- package/src/filesystem/path.ts +2 -2
- package/src/floatingwindow/float.ts +4 -4
- package/src/gallery/gallery.ts +2 -2
- package/src/global.d.ts +6 -1
- package/src/imageutils/image-utils.ts +2 -2
- package/src/ime/ime.ts +2 -2
- package/src/index.ts +21 -20
- package/src/log/log-call-method.ts +28 -0
- package/src/log/log.ts +445 -0
- package/src/mlkit/mlkit.ts +3 -3
- package/src/network/http.ts +2 -2
- package/src/{NodeAsync.ts → node-async.ts} +5 -5
- package/src/{Node.ts → node.ts} +5 -5
- package/src/{StepAsync.ts → step-async.ts} +8 -8
- package/src/{Step.ts → step.ts} +7 -7
- package/dist/AccessibilityEventFilter.d.ts +0 -105
- package/dist/AccessibilityEventFilter.js +0 -89
- package/dist/AppInfo.d.ts +0 -45
- package/dist/AppInfo.js +0 -38
- package/dist/AssistsX.d.ts +0 -484
- package/dist/AssistsX.js +0 -828
- package/dist/AssistsXAsync.d.ts +0 -532
- package/dist/AssistsXAsync.js +0 -874
- package/dist/Bounds.d.ts +0 -48
- package/dist/Bounds.js +0 -68
- package/dist/CallMethod.d.ts +0 -69
- package/dist/CallMethod.js +0 -71
- package/dist/CallResponse.d.ts +0 -10
- package/dist/CallResponse.js +0 -28
- package/dist/DeviceInfo.d.ts +0 -69
- package/dist/DeviceInfo.js +0 -50
- package/dist/Node.d.ts +0 -334
- package/dist/Node.js +0 -369
- package/dist/NodeAsync.d.ts +0 -213
- package/dist/NodeAsync.js +0 -313
- package/dist/NodeClassValue.d.ts +0 -15
- package/dist/NodeClassValue.js +0 -15
- package/dist/Step.d.ts +0 -355
- package/dist/Step.js +0 -689
- package/dist/StepAsync.d.ts +0 -162
- package/dist/StepAsync.js +0 -264
- package/dist/StepError.d.ts +0 -35
- package/dist/StepError.js +0 -26
- package/dist/StepStateStore.d.ts +0 -14
- package/dist/StepStateStore.js +0 -37
- package/dist/Utils.d.ts +0 -3
- package/dist/Utils.js +0 -20
- package/dist/WindowFlags.d.ts +0 -75
- package/dist/WindowFlags.js +0 -97
- package/dist/barutils/BarUtilsCallMethod.d.ts +0 -24
- package/dist/barutils/BarUtilsCallMethod.js +0 -26
- package/dist/barutils/bar-utils.d.ts +0 -41
- package/dist/barutils/bar-utils.js +0 -205
- package/dist/filesystem/fileio/file-io.d.ts +0 -101
- package/dist/filesystem/fileio/file-io.js +0 -235
- package/dist/filesystem/fileutils/file-utils.d.ts +0 -242
- package/dist/filesystem/fileutils/file-utils.js +0 -493
- package/dist/filesystem/path.d.ts +0 -252
- package/dist/filesystem/path.js +0 -589
- package/dist/floatingwindow/FloatCallMethod.d.ts +0 -19
- package/dist/floatingwindow/FloatCallMethod.js +0 -18
- package/dist/floatingwindow/float.d.ts +0 -29
- package/dist/floatingwindow/float.js +0 -149
- package/dist/gallery/gallery.d.ts +0 -60
- package/dist/gallery/gallery.js +0 -142
- package/dist/imageutils/image-utils.d.ts +0 -442
- package/dist/imageutils/image-utils.js +0 -543
- package/dist/ime/ime.d.ts +0 -80
- package/dist/ime/ime.js +0 -141
- package/dist/mlkit/MlkitCallMethod.d.ts +0 -27
- package/dist/mlkit/MlkitCallMethod.js +0 -26
- package/dist/mlkit/mlkit.d.ts +0 -86
- package/dist/mlkit/mlkit.js +0 -169
- package/dist/network/http.d.ts +0 -127
- package/dist/network/http.js +0 -202
- /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
- /package/src/{AppInfo.ts → app-info.ts} +0 -0
- /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
- /package/src/{Bounds.ts → bounds.ts} +0 -0
- /package/src/{CallMethod.ts → call-method.ts} +0 -0
- /package/src/{CallResponse.ts → call-response.ts} +0 -0
- /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
- /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
- /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
- /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
- /package/src/{StepError.ts → step-error.ts} +0 -0
- /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
- /package/src/{Utils.ts → utils.ts} +0 -0
- /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
package/dist/Step.d.ts
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { Node } from "./Node";
|
|
2
|
-
import { StepError } from "./StepError";
|
|
3
|
-
import { StepAsync } from "./StepAsync";
|
|
4
|
-
export type StepResult = Step | undefined;
|
|
5
|
-
export type StepImpl = (step: Step) => Promise<StepResult>;
|
|
6
|
-
export type StepInterceptor = (step: Step) => StepResult | Promise<StepResult>;
|
|
7
|
-
export declare class Step {
|
|
8
|
-
static delayMsDefault: number;
|
|
9
|
-
static readonly repeatCountInfinite: number;
|
|
10
|
-
static repeatCountMaxDefault: number;
|
|
11
|
-
static showLog: boolean;
|
|
12
|
-
static exceptionRetryCountMaxDefault: number;
|
|
13
|
-
/**
|
|
14
|
-
* 当前执行步骤的ID
|
|
15
|
-
*/
|
|
16
|
-
private static _stepId;
|
|
17
|
-
/**
|
|
18
|
-
* 步骤拦截器列表
|
|
19
|
-
*/
|
|
20
|
-
private static _interceptors;
|
|
21
|
-
/**
|
|
22
|
-
* 步骤异常变量,默认为空
|
|
23
|
-
*/
|
|
24
|
-
static exception: StepError | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* 运行步骤实现
|
|
27
|
-
* @param impl 步骤实现函数
|
|
28
|
-
* @param tag 步骤标签
|
|
29
|
-
* @param data 步骤数据
|
|
30
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
31
|
-
*/
|
|
32
|
-
static run(impl: StepImpl, { stepId, tag, data, delayMs, exceptionRetryCountMax, }?: {
|
|
33
|
-
stepId?: string | undefined;
|
|
34
|
-
tag?: string | undefined;
|
|
35
|
-
data?: any | undefined;
|
|
36
|
-
delayMs?: number;
|
|
37
|
-
exceptionRetryCountMax?: number;
|
|
38
|
-
}): Promise<Step | undefined>;
|
|
39
|
-
/**
|
|
40
|
-
* 获取当前步骤ID
|
|
41
|
-
*/
|
|
42
|
-
static get stepId(): string | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* 验证步骤ID是否匹配,如果不匹配则表示停止
|
|
45
|
-
* @param stepId 要验证的步骤ID
|
|
46
|
-
*/
|
|
47
|
-
static assert(stepId: string | undefined): void;
|
|
48
|
-
/**
|
|
49
|
-
* 为节点数组分配步骤ID
|
|
50
|
-
* @param nodes 节点数组
|
|
51
|
-
* @param stepId 步骤ID
|
|
52
|
-
*/
|
|
53
|
-
static assignIdsToNodes(nodes: Node[], stepId: string | undefined): void;
|
|
54
|
-
/**
|
|
55
|
-
* 停止当前步骤执行
|
|
56
|
-
* @param exception 可选的异常对象,如果传入则使用该异常,否则使用默认的StepStopError
|
|
57
|
-
*/
|
|
58
|
-
static stop(exception?: StepError): void;
|
|
59
|
-
/**
|
|
60
|
-
* 添加步骤拦截器
|
|
61
|
-
* @param interceptor 拦截器函数
|
|
62
|
-
*/
|
|
63
|
-
static addInterceptor(interceptor: StepInterceptor): void;
|
|
64
|
-
/**
|
|
65
|
-
* 移除步骤拦截器
|
|
66
|
-
* @param interceptor 要移除的拦截器函数
|
|
67
|
-
* @returns 是否成功删除
|
|
68
|
-
*/
|
|
69
|
-
static removeInterceptor(interceptor: StepInterceptor): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* 按索引移除步骤拦截器
|
|
72
|
-
* @param index 要移除的拦截器索引
|
|
73
|
-
* @returns 是否成功删除
|
|
74
|
-
*/
|
|
75
|
-
static removeInterceptorByIndex(index: number): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* 移除所有匹配的步骤拦截器
|
|
78
|
-
* @param interceptor 要移除的拦截器函数
|
|
79
|
-
* @returns 删除的拦截器数量
|
|
80
|
-
*/
|
|
81
|
-
static removeAllInterceptors(interceptor: StepInterceptor): number;
|
|
82
|
-
/**
|
|
83
|
-
* 按条件移除步骤拦截器
|
|
84
|
-
* @param predicate 判断是否删除的条件函数
|
|
85
|
-
* @returns 删除的拦截器数量
|
|
86
|
-
*/
|
|
87
|
-
static removeInterceptorByPredicate(predicate: (interceptor: StepInterceptor, index: number) => boolean): number;
|
|
88
|
-
/**
|
|
89
|
-
* 清空所有拦截器
|
|
90
|
-
*/
|
|
91
|
-
static clearInterceptors(): void;
|
|
92
|
-
/**
|
|
93
|
-
* 获取所有拦截器
|
|
94
|
-
* @returns 拦截器数组
|
|
95
|
-
*/
|
|
96
|
-
static getInterceptors(): StepInterceptor[];
|
|
97
|
-
/**
|
|
98
|
-
* 步骤ID
|
|
99
|
-
*/
|
|
100
|
-
stepId: string;
|
|
101
|
-
/**
|
|
102
|
-
* 步骤重复执行次数
|
|
103
|
-
*/
|
|
104
|
-
repeatCount: number;
|
|
105
|
-
/**
|
|
106
|
-
* 步骤重复执行最大次数,默认不限制
|
|
107
|
-
*/
|
|
108
|
-
repeatCountMax: number;
|
|
109
|
-
/**
|
|
110
|
-
* 异常重试次数
|
|
111
|
-
*/
|
|
112
|
-
exceptionRetryCount: number;
|
|
113
|
-
/**
|
|
114
|
-
* 异常重试最大次数,默认3次
|
|
115
|
-
*/
|
|
116
|
-
exceptionRetryCountMax: number;
|
|
117
|
-
/**
|
|
118
|
-
* 步骤标签
|
|
119
|
-
*/
|
|
120
|
-
tag: string | undefined;
|
|
121
|
-
isEnd: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* 步骤数据
|
|
124
|
-
*/
|
|
125
|
-
data: any | undefined;
|
|
126
|
-
/**
|
|
127
|
-
* 步骤延迟时间(毫秒)
|
|
128
|
-
*/
|
|
129
|
-
delayMs: number;
|
|
130
|
-
/**
|
|
131
|
-
* 步骤实现函数
|
|
132
|
-
*/
|
|
133
|
-
impl: StepImpl | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* 构造函数
|
|
136
|
-
* @param stepId 步骤ID
|
|
137
|
-
* @param impl 步骤实现函数
|
|
138
|
-
* @param tag 步骤标签
|
|
139
|
-
* @param data 步骤数据
|
|
140
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
141
|
-
*/
|
|
142
|
-
constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, isEnd, }: {
|
|
143
|
-
stepId: string;
|
|
144
|
-
impl: StepImpl | undefined;
|
|
145
|
-
tag?: string | undefined;
|
|
146
|
-
data?: any | undefined;
|
|
147
|
-
delayMs?: number;
|
|
148
|
-
repeatCountMax?: number;
|
|
149
|
-
exceptionRetryCountMax?: number;
|
|
150
|
-
isEnd?: boolean;
|
|
151
|
-
});
|
|
152
|
-
get async(): StepAsync;
|
|
153
|
-
/**
|
|
154
|
-
* 创建下一个步骤
|
|
155
|
-
* @param impl 下一步骤实现函数
|
|
156
|
-
* @param tag 步骤标签
|
|
157
|
-
* @param data 步骤数据
|
|
158
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
159
|
-
* @returns 新的步骤实例
|
|
160
|
-
*/
|
|
161
|
-
next(impl: StepImpl, { tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
|
|
162
|
-
tag?: string | undefined;
|
|
163
|
-
data?: any | undefined;
|
|
164
|
-
delayMs?: number;
|
|
165
|
-
repeatCountMax?: number;
|
|
166
|
-
exceptionRetryCountMax?: number;
|
|
167
|
-
}): Step;
|
|
168
|
-
end({ tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
|
|
169
|
-
tag?: string | undefined;
|
|
170
|
-
data?: any | undefined;
|
|
171
|
-
delayMs?: number;
|
|
172
|
-
repeatCountMax?: number;
|
|
173
|
-
exceptionRetryCountMax?: number;
|
|
174
|
-
}): Step;
|
|
175
|
-
/**
|
|
176
|
-
* 重复当前步骤
|
|
177
|
-
* @param stepId 步骤ID
|
|
178
|
-
* @param tag 步骤标签
|
|
179
|
-
* @param data 步骤数据
|
|
180
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
181
|
-
* @returns 当前步骤实例
|
|
182
|
-
*/
|
|
183
|
-
repeat({ stepId, tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
|
|
184
|
-
stepId?: string;
|
|
185
|
-
tag?: string | undefined;
|
|
186
|
-
data?: any | undefined;
|
|
187
|
-
delayMs?: number;
|
|
188
|
-
repeatCountMax?: number;
|
|
189
|
-
exceptionRetryCountMax?: number;
|
|
190
|
-
}): Step;
|
|
191
|
-
/**
|
|
192
|
-
* 延迟执行
|
|
193
|
-
* @param ms 延迟时间(毫秒)
|
|
194
|
-
* @returns Promise
|
|
195
|
-
*/
|
|
196
|
-
delay(ms: number): Promise<void>;
|
|
197
|
-
/**
|
|
198
|
-
* 等待异步方法执行完成
|
|
199
|
-
* @param method 异步方法
|
|
200
|
-
* @returns Promise<T>
|
|
201
|
-
*/
|
|
202
|
-
await<T>(method: () => Promise<T>): Promise<T>;
|
|
203
|
-
/**
|
|
204
|
-
* 对单个节点进行截图
|
|
205
|
-
* @param node 目标节点
|
|
206
|
-
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
207
|
-
* @returns 截图路径
|
|
208
|
-
*/
|
|
209
|
-
takeScreenshotByNode(node: Node, overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
|
|
210
|
-
/**
|
|
211
|
-
* 对多个节点进行截图
|
|
212
|
-
* @param nodes 目标节点数组
|
|
213
|
-
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
214
|
-
* @returns 截图路径数组
|
|
215
|
-
*/
|
|
216
|
-
takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
|
|
217
|
-
/**
|
|
218
|
-
* 获取所有符合条件的节点
|
|
219
|
-
* @param filterClass 类名过滤
|
|
220
|
-
* @param filterViewId 视图ID过滤
|
|
221
|
-
* @param filterDes 描述过滤
|
|
222
|
-
* @param filterText 文本过滤
|
|
223
|
-
* @returns 节点数组
|
|
224
|
-
*/
|
|
225
|
-
getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
|
|
226
|
-
filterClass?: string;
|
|
227
|
-
filterViewId?: string;
|
|
228
|
-
filterDes?: string;
|
|
229
|
-
filterText?: string;
|
|
230
|
-
}): Node[];
|
|
231
|
-
/**
|
|
232
|
-
* 启动应用
|
|
233
|
-
* @param packageName 应用包名
|
|
234
|
-
* @returns 是否启动成功
|
|
235
|
-
*/
|
|
236
|
-
launchApp(packageName: string): boolean;
|
|
237
|
-
/**
|
|
238
|
-
* 获取当前应用包名
|
|
239
|
-
* @returns 包名
|
|
240
|
-
*/
|
|
241
|
-
getPackageName(): string;
|
|
242
|
-
/**
|
|
243
|
-
* 通过ID查找节点
|
|
244
|
-
* @param id 节点ID
|
|
245
|
-
* @param filterClass 类名过滤
|
|
246
|
-
* @param filterText 文本过滤
|
|
247
|
-
* @param filterDes 描述过滤
|
|
248
|
-
* @returns 节点数组
|
|
249
|
-
*/
|
|
250
|
-
findById(id: string, { filterClass, filterText, filterDes, }?: {
|
|
251
|
-
filterClass?: string;
|
|
252
|
-
filterText?: string;
|
|
253
|
-
filterDes?: string;
|
|
254
|
-
}): Node[];
|
|
255
|
-
/**
|
|
256
|
-
* 通过文本查找节点
|
|
257
|
-
* @param text 要查找的文本
|
|
258
|
-
* @param filterClass 类名过滤
|
|
259
|
-
* @param filterViewId 视图ID过滤
|
|
260
|
-
* @param filterDes 描述过滤
|
|
261
|
-
* @returns 节点数组
|
|
262
|
-
*/
|
|
263
|
-
findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
|
|
264
|
-
filterClass?: string;
|
|
265
|
-
filterViewId?: string;
|
|
266
|
-
filterDes?: string;
|
|
267
|
-
}): Node[];
|
|
268
|
-
/**
|
|
269
|
-
* 通过标签查找节点
|
|
270
|
-
* @param className 类名
|
|
271
|
-
* @param filterText 文本过滤
|
|
272
|
-
* @param filterViewId 视图ID过滤
|
|
273
|
-
* @param filterDes 描述过滤
|
|
274
|
-
* @returns 节点数组
|
|
275
|
-
*/
|
|
276
|
-
findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
|
|
277
|
-
filterText?: string;
|
|
278
|
-
filterViewId?: string;
|
|
279
|
-
filterDes?: string;
|
|
280
|
-
}): Node[];
|
|
281
|
-
/**
|
|
282
|
-
* 查找所有匹配文本的节点
|
|
283
|
-
* @param text 要查找的文本
|
|
284
|
-
* @returns 节点数组
|
|
285
|
-
*/
|
|
286
|
-
findByTextAllMatch(text: string): Node[];
|
|
287
|
-
/**
|
|
288
|
-
* 检查是否包含指定文本
|
|
289
|
-
* @param text 要检查的文本
|
|
290
|
-
* @returns 是否包含
|
|
291
|
-
*/
|
|
292
|
-
containsText(text: string): boolean;
|
|
293
|
-
/**
|
|
294
|
-
* 获取所有文本
|
|
295
|
-
* @returns 文本数组
|
|
296
|
-
*/
|
|
297
|
-
getAllText(): string[];
|
|
298
|
-
/**
|
|
299
|
-
* 执行点击手势
|
|
300
|
-
* @param x 横坐标
|
|
301
|
-
* @param y 纵坐标
|
|
302
|
-
* @param duration 持续时间(毫秒)
|
|
303
|
-
* @returns 是否成功
|
|
304
|
-
*/
|
|
305
|
-
clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
|
|
306
|
-
longPressGestureAutoPaste(point: {
|
|
307
|
-
x: number;
|
|
308
|
-
y: number;
|
|
309
|
-
}, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
310
|
-
matchedPackageName?: string;
|
|
311
|
-
matchedText?: string;
|
|
312
|
-
timeoutMillis?: number;
|
|
313
|
-
longPressDuration?: number;
|
|
314
|
-
}): Promise<boolean>;
|
|
315
|
-
getAppInfo(packageName: string): Promise<any>;
|
|
316
|
-
performLinearGesture(startPoint: {
|
|
317
|
-
x: number;
|
|
318
|
-
y: number;
|
|
319
|
-
}, endPoint: {
|
|
320
|
-
x: number;
|
|
321
|
-
y: number;
|
|
322
|
-
}, { duration }?: {
|
|
323
|
-
duration?: number;
|
|
324
|
-
}): Promise<boolean>;
|
|
325
|
-
/**
|
|
326
|
-
* 返回操作
|
|
327
|
-
* @returns 是否成功
|
|
328
|
-
*/
|
|
329
|
-
back(): boolean;
|
|
330
|
-
/**
|
|
331
|
-
* 回到主页
|
|
332
|
-
* @returns 是否成功
|
|
333
|
-
*/
|
|
334
|
-
home(): boolean;
|
|
335
|
-
/**
|
|
336
|
-
* 打开通知栏
|
|
337
|
-
* @returns 是否成功
|
|
338
|
-
*/
|
|
339
|
-
notifications(): boolean;
|
|
340
|
-
/**
|
|
341
|
-
* 显示最近应用
|
|
342
|
-
* @returns 是否成功
|
|
343
|
-
*/
|
|
344
|
-
recentApps(): boolean;
|
|
345
|
-
/**
|
|
346
|
-
* 获取屏幕尺寸
|
|
347
|
-
* @returns 屏幕尺寸对象
|
|
348
|
-
*/
|
|
349
|
-
getScreenSize(): any;
|
|
350
|
-
/**
|
|
351
|
-
* 获取应用窗口尺寸
|
|
352
|
-
* @returns 应用窗口尺寸对象
|
|
353
|
-
*/
|
|
354
|
-
getAppScreenSize(): any;
|
|
355
|
-
}
|