assistsx-js 0.0.2026 → 0.0.2028

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.
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export declare class AppInfo {
5
+ /**
6
+ * 是否为系统应用
7
+ */
8
+ isSystem: boolean;
9
+ /**
10
+ * 最低SDK版本
11
+ */
12
+ minSdkVersion: number;
13
+ /**
14
+ * 应用名称
15
+ */
16
+ name: string;
17
+ /**
18
+ * 应用包名
19
+ */
20
+ packageName: string;
21
+ /**
22
+ * 目标SDK版本
23
+ */
24
+ targetSdkVersion: number;
25
+ /**
26
+ * 版本号
27
+ */
28
+ versionCode: number;
29
+ /**
30
+ * 版本名称
31
+ */
32
+ versionName: string;
33
+ constructor(isSystem?: boolean, minSdkVersion?: number, name?: string, packageName?: string, targetSdkVersion?: number, versionCode?: number, versionName?: string);
34
+ /**
35
+ * 从JSON对象创建AppInfo实例
36
+ * @param data JSON对象
37
+ * @returns AppInfo实例
38
+ */
39
+ static fromJSON(data: any): AppInfo;
40
+ /**
41
+ * 转换为JSON对象
42
+ * @returns JSON对象
43
+ */
44
+ toJSON(): any;
45
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export class AppInfo {
5
+ constructor(isSystem = false, minSdkVersion = 0, name = "", packageName = "", targetSdkVersion = 0, versionCode = 0, versionName = "") {
6
+ this.isSystem = isSystem;
7
+ this.minSdkVersion = minSdkVersion;
8
+ this.name = name;
9
+ this.packageName = packageName;
10
+ this.targetSdkVersion = targetSdkVersion;
11
+ this.versionCode = versionCode;
12
+ this.versionName = versionName;
13
+ }
14
+ /**
15
+ * 从JSON对象创建AppInfo实例
16
+ * @param data JSON对象
17
+ * @returns AppInfo实例
18
+ */
19
+ static fromJSON(data) {
20
+ var _a, _b, _c, _d, _e, _f, _g;
21
+ return new AppInfo((_a = data.isSystem) !== null && _a !== void 0 ? _a : false, (_b = data.minSdkVersion) !== null && _b !== void 0 ? _b : 0, (_c = data.name) !== null && _c !== void 0 ? _c : "", (_d = data.packageName) !== null && _d !== void 0 ? _d : "", (_e = data.targetSdkVersion) !== null && _e !== void 0 ? _e : 0, (_f = data.versionCode) !== null && _f !== void 0 ? _f : 0, (_g = data.versionName) !== null && _g !== void 0 ? _g : "");
22
+ }
23
+ /**
24
+ * 转换为JSON对象
25
+ * @returns JSON对象
26
+ */
27
+ toJSON() {
28
+ return {
29
+ isSystem: this.isSystem,
30
+ minSdkVersion: this.minSdkVersion,
31
+ name: this.name,
32
+ packageName: this.packageName,
33
+ targetSdkVersion: this.targetSdkVersion,
34
+ versionCode: this.versionCode,
35
+ versionName: this.versionName,
36
+ };
37
+ }
38
+ }
@@ -6,6 +6,7 @@ import { Node } from "./Node";
6
6
  import { CallResponse } from "./CallResponse";
7
7
  import { Bounds } from "./Bounds";
8
8
  import { AccessibilityEventFilter } from "AccessibilityEventFilter";
9
+ import { AppInfo } from "./AppInfo";
9
10
  /**
10
11
  * 无障碍事件数据结构
11
12
  */
@@ -120,6 +121,11 @@ export declare class AssistsX {
120
121
  * @returns 是否设置成功
121
122
  */
122
123
  static setNodeText(node: Node, text: string): boolean;
124
+ /**
125
+ * 获取剪贴板最新文本
126
+ * @returns 剪贴板最新文本
127
+ */
128
+ static getClipboardLatestText(): any;
123
129
  static isAppInstalled(packageName: string): boolean;
124
130
  /**
125
131
  * 对指定节点进行截图
@@ -394,7 +400,7 @@ export declare class AssistsX {
394
400
  longPressDuration?: number;
395
401
  timeout?: number;
396
402
  }): Promise<boolean>;
397
- static getAppInfo(packageName: string, timeout?: number): Promise<any>;
403
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
398
404
  static getUniqueDeviceId(): any;
399
405
  static getAndroidID(): any;
400
406
  static getMacAddress(timeout?: number): Promise<any>;
package/dist/AssistsX.js CHANGED
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { decodeBase64UTF8, generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  // 回调函数存储对象
11
12
  export const callbacks = new Map();
12
13
  // 无障碍事件监听器存储
@@ -159,6 +160,14 @@ export class AssistsX {
159
160
  });
160
161
  return response.getDataOrDefault(false);
161
162
  }
163
+ /**
164
+ * 获取剪贴板最新文本
165
+ * @returns 剪贴板最新文本
166
+ */
167
+ static getClipboardLatestText() {
168
+ const response = this.call(CallMethod.getClipboardLatestText);
169
+ return response.getDataOrDefault({});
170
+ }
162
171
  static isAppInstalled(packageName) {
163
172
  const response = this.call(CallMethod.isAppInstalled, {
164
173
  args: { packageName },
@@ -573,7 +582,7 @@ export class AssistsX {
573
582
  args: { packageName },
574
583
  timeout,
575
584
  });
576
- return response.getDataOrDefault({});
585
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
577
586
  }
578
587
  static getUniqueDeviceId() {
579
588
  const response = this.call(CallMethod.getUniqueDeviceId);
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { Node } from "./Node";
6
6
  import { Bounds } from "./Bounds";
7
+ import { AppInfo } from "./AppInfo";
7
8
  import { WebFloatingWindowOptions } from "./AssistsX";
8
9
  export declare class AssistsXAsync {
9
10
  /**
@@ -354,7 +355,7 @@ export declare class AssistsXAsync {
354
355
  longPressDuration?: number;
355
356
  timeout?: number;
356
357
  }): Promise<boolean>;
357
- static getAppInfo(packageName: string, timeout?: number): Promise<any>;
358
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
358
359
  static getUniqueDeviceId(timeout?: number): Promise<any>;
359
360
  static getAndroidID(timeout?: number): Promise<any>;
360
361
  static getMacAddress(timeout?: number): Promise<any>;
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  import { callbacks, } from "./AssistsX";
11
12
  export class AssistsXAsync {
12
13
  /**
@@ -577,7 +578,7 @@ export class AssistsXAsync {
577
578
  args: { packageName },
578
579
  timeout,
579
580
  });
580
- return response.getDataOrDefault({});
581
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
581
582
  }
582
583
  static async getUniqueDeviceId(timeout) {
583
584
  const response = await this.asyncCall(CallMethod.getUniqueDeviceId, {
@@ -48,5 +48,6 @@ export declare const CallMethod: {
48
48
  readonly getDeviceInfo: "getDeviceInfo";
49
49
  readonly getNetworkType: "getNetworkType";
50
50
  readonly isAppInstalled: "isAppInstalled";
51
+ readonly getClipboardLatestText: "getClipboardLatestText";
51
52
  };
52
53
  export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
@@ -49,4 +49,5 @@ export const CallMethod = {
49
49
  getDeviceInfo: "getDeviceInfo",
50
50
  getNetworkType: "getNetworkType",
51
51
  isAppInstalled: "isAppInstalled",
52
+ getClipboardLatestText: "getClipboardLatestText",
52
53
  };
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";
package/dist/index.js CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2026",
3
+ "version": "0.0.2028",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AppInfo.ts ADDED
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export class AppInfo {
5
+ /**
6
+ * 是否为系统应用
7
+ */
8
+ isSystem: boolean;
9
+
10
+ /**
11
+ * 最低SDK版本
12
+ */
13
+ minSdkVersion: number;
14
+
15
+ /**
16
+ * 应用名称
17
+ */
18
+ name: string;
19
+
20
+ /**
21
+ * 应用包名
22
+ */
23
+ packageName: string;
24
+
25
+ /**
26
+ * 目标SDK版本
27
+ */
28
+ targetSdkVersion: number;
29
+
30
+ /**
31
+ * 版本号
32
+ */
33
+ versionCode: number;
34
+
35
+ /**
36
+ * 版本名称
37
+ */
38
+ versionName: string;
39
+
40
+ constructor(
41
+ isSystem: boolean = false,
42
+ minSdkVersion: number = 0,
43
+ name: string = "",
44
+ packageName: string = "",
45
+ targetSdkVersion: number = 0,
46
+ versionCode: number = 0,
47
+ versionName: string = ""
48
+ ) {
49
+ this.isSystem = isSystem;
50
+ this.minSdkVersion = minSdkVersion;
51
+ this.name = name;
52
+ this.packageName = packageName;
53
+ this.targetSdkVersion = targetSdkVersion;
54
+ this.versionCode = versionCode;
55
+ this.versionName = versionName;
56
+ }
57
+
58
+ /**
59
+ * 从JSON对象创建AppInfo实例
60
+ * @param data JSON对象
61
+ * @returns AppInfo实例
62
+ */
63
+ static fromJSON(data: any): AppInfo {
64
+ return new AppInfo(
65
+ data.isSystem ?? false,
66
+ data.minSdkVersion ?? 0,
67
+ data.name ?? "",
68
+ data.packageName ?? "",
69
+ data.targetSdkVersion ?? 0,
70
+ data.versionCode ?? 0,
71
+ data.versionName ?? ""
72
+ );
73
+ }
74
+
75
+ /**
76
+ * 转换为JSON对象
77
+ * @returns JSON对象
78
+ */
79
+ toJSON(): any {
80
+ return {
81
+ isSystem: this.isSystem,
82
+ minSdkVersion: this.minSdkVersion,
83
+ name: this.name,
84
+ packageName: this.packageName,
85
+ targetSdkVersion: this.targetSdkVersion,
86
+ versionCode: this.versionCode,
87
+ versionName: this.versionName,
88
+ };
89
+ }
90
+ }
package/src/AssistsX.ts CHANGED
@@ -8,6 +8,7 @@ import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { decodeBase64UTF8, generateUUID } from "./Utils";
10
10
  import { AccessibilityEventFilter } from "AccessibilityEventFilter";
11
+ import { AppInfo } from "./AppInfo";
11
12
 
12
13
  /**
13
14
  * 无障碍事件数据结构
@@ -255,6 +256,15 @@ export class AssistsX {
255
256
  });
256
257
  return response.getDataOrDefault(false);
257
258
  }
259
+ /**
260
+ * 获取剪贴板最新文本
261
+ * @returns 剪贴板最新文本
262
+ */
263
+ public static getClipboardLatestText(): any {
264
+ const response = this.call(CallMethod.getClipboardLatestText);
265
+ return response.getDataOrDefault({});
266
+ }
267
+
258
268
  public static isAppInstalled(packageName: string): boolean {
259
269
  const response = this.call(CallMethod.isAppInstalled, {
260
270
  args: { packageName },
@@ -841,12 +851,12 @@ export class AssistsX {
841
851
  public static async getAppInfo(
842
852
  packageName: string,
843
853
  timeout?: number
844
- ): Promise<any> {
854
+ ): Promise<AppInfo> {
845
855
  const response = await this.asyncCall(CallMethod.getAppInfo, {
846
856
  args: { packageName },
847
857
  timeout,
848
858
  });
849
- return response.getDataOrDefault({});
859
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
850
860
  }
851
861
  public static getUniqueDeviceId(): any {
852
862
  const response = this.call(CallMethod.getUniqueDeviceId);
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  import {
11
12
  AssistsX,
12
13
  callbacks,
@@ -843,12 +844,12 @@ export class AssistsXAsync {
843
844
  public static async getAppInfo(
844
845
  packageName: string,
845
846
  timeout?: number
846
- ): Promise<any> {
847
+ ): Promise<AppInfo> {
847
848
  const response = await this.asyncCall(CallMethod.getAppInfo, {
848
849
  args: { packageName },
849
850
  timeout,
850
851
  });
851
- return response.getDataOrDefault({});
852
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
852
853
  }
853
854
  public static async getUniqueDeviceId(timeout?: number): Promise<any> {
854
855
  const response = await this.asyncCall(CallMethod.getUniqueDeviceId, {
package/src/CallMethod.ts CHANGED
@@ -53,6 +53,7 @@ export const CallMethod = {
53
53
  getDeviceInfo: "getDeviceInfo",
54
54
  getNetworkType: "getNetworkType",
55
55
  isAppInstalled: "isAppInstalled",
56
+ getClipboardLatestText: "getClipboardLatestText",
56
57
  } as const;
57
58
 
58
59
  // 导出类型定义
package/src/index.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";