assistsx-js 0.0.2053 → 0.0.2054

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/AssistsX.js CHANGED
@@ -214,7 +214,7 @@ export class AssistsX {
214
214
  args: { overlayHiddenScreenshotDelayMillis },
215
215
  timeout,
216
216
  });
217
- const data = response.getDataOrDefault("");
217
+ const data = response.getDataOrDefault({ images: [] });
218
218
  return data.images;
219
219
  }
220
220
  static async scanQR(timeout) {
@@ -373,7 +373,7 @@ export class AssistsX {
373
373
  args: { className },
374
374
  node,
375
375
  });
376
- return Node.create(response.getDataOrDefault("{}"));
376
+ return Node.create(response.getDataOrDefault({}));
377
377
  }
378
378
  /**
379
379
  * 获取节点的所有子节点
@@ -400,7 +400,7 @@ export class AssistsX {
400
400
  */
401
401
  static findFirstParentClickable(node) {
402
402
  const response = this.call(CallMethod.findFirstParentClickable, { node });
403
- return Node.create(response.getDataOrDefault("{}"));
403
+ return Node.create(response.getDataOrDefault({}));
404
404
  }
405
405
  /**
406
406
  * 获取节点在屏幕中的边界
@@ -677,7 +677,7 @@ export class AssistsX {
677
677
  */
678
678
  static getScreenSize() {
679
679
  const response = this.call(CallMethod.getScreenSize);
680
- return response.getDataOrDefault("{}");
680
+ return response.getDataOrDefault({});
681
681
  }
682
682
  /**
683
683
  * 获取应用窗口尺寸
@@ -685,7 +685,7 @@ export class AssistsX {
685
685
  */
686
686
  static getAppScreenSize() {
687
687
  const response = this.call(CallMethod.getAppScreenSize);
688
- return response.getDataOrDefault("{}");
688
+ return response.getDataOrDefault({});
689
689
  }
690
690
  /**
691
691
  * 添加无障碍事件监听器
@@ -116,7 +116,7 @@ export class AssistsXAsync {
116
116
  args: { overlayHiddenScreenshotDelayMillis },
117
117
  timeout,
118
118
  });
119
- const data = response.getDataOrDefault("");
119
+ const data = response.getDataOrDefault({ images: [] });
120
120
  return data.images;
121
121
  }
122
122
  /**
@@ -327,7 +327,7 @@ export class AssistsXAsync {
327
327
  node,
328
328
  timeout,
329
329
  });
330
- return Node.create(response.getDataOrDefault("{}"));
330
+ return Node.create(response.getDataOrDefault({}));
331
331
  }
332
332
  /**
333
333
  * 获取节点的所有子节点
@@ -366,7 +366,7 @@ export class AssistsXAsync {
366
366
  node,
367
367
  timeout,
368
368
  });
369
- return Node.create(response.getDataOrDefault("{}"));
369
+ return Node.create(response.getDataOrDefault({}));
370
370
  }
371
371
  /**
372
372
  * 获取节点在屏幕中的边界
@@ -635,7 +635,7 @@ export class AssistsXAsync {
635
635
  const response = await this.asyncCall(CallMethod.getScreenSize, {
636
636
  timeout,
637
637
  });
638
- return response.getDataOrDefault("{}");
638
+ return response.getDataOrDefault({});
639
639
  }
640
640
  /**
641
641
  * 获取应用窗口尺寸
@@ -646,7 +646,7 @@ export class AssistsXAsync {
646
646
  const response = await this.asyncCall(CallMethod.getAppScreenSize, {
647
647
  timeout,
648
648
  });
649
- return response.getDataOrDefault("{}");
649
+ return response.getDataOrDefault({});
650
650
  }
651
651
  /**
652
652
  * 在浏览器中打开URL
package/dist/Bounds.js CHANGED
@@ -34,6 +34,10 @@ export class Bounds {
34
34
  return Bounds.from(data);
35
35
  }
36
36
  static fromData(data) {
37
+ // 如果 data 为 null 或 undefined,返回一个空的 Bounds
38
+ if (data == null) {
39
+ return new Bounds(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true);
40
+ }
37
41
  return new Bounds(data.left, data.top, data.right, data.bottom, data.width, data.height, data.centerX, data.centerY, data.exactCenterX, data.exactCenterY, data.isEmpty);
38
42
  }
39
43
  // 转换为普通对象
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2053",
3
+ "version": "0.0.2054",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -317,7 +317,7 @@ export class AssistsX {
317
317
  args: { overlayHiddenScreenshotDelayMillis },
318
318
  timeout,
319
319
  });
320
- const data = response.getDataOrDefault("");
320
+ const data = response.getDataOrDefault({ images: [] });
321
321
  return data.images;
322
322
  }
323
323
  public static async scanQR(timeout?: number): Promise<string> {
@@ -539,7 +539,7 @@ export class AssistsX {
539
539
  args: { className },
540
540
  node,
541
541
  });
542
- return Node.create(response.getDataOrDefault("{}"));
542
+ return Node.create(response.getDataOrDefault({}));
543
543
  }
544
544
 
545
545
  /**
@@ -569,7 +569,7 @@ export class AssistsX {
569
569
  */
570
570
  public static findFirstParentClickable(node: Node): Node {
571
571
  const response = this.call(CallMethod.findFirstParentClickable, { node });
572
- return Node.create(response.getDataOrDefault("{}"));
572
+ return Node.create(response.getDataOrDefault({}));
573
573
  }
574
574
 
575
575
  /**
@@ -957,7 +957,7 @@ export class AssistsX {
957
957
  */
958
958
  public static getScreenSize(): any {
959
959
  const response = this.call(CallMethod.getScreenSize);
960
- return response.getDataOrDefault("{}");
960
+ return response.getDataOrDefault({});
961
961
  }
962
962
 
963
963
  /**
@@ -966,7 +966,7 @@ export class AssistsX {
966
966
  */
967
967
  public static getAppScreenSize(): any {
968
968
  const response = this.call(CallMethod.getAppScreenSize);
969
- return response.getDataOrDefault("{}");
969
+ return response.getDataOrDefault({});
970
970
  }
971
971
 
972
972
  /**
@@ -209,7 +209,7 @@ export class AssistsXAsync {
209
209
  args: { overlayHiddenScreenshotDelayMillis },
210
210
  timeout,
211
211
  });
212
- const data = response.getDataOrDefault("");
212
+ const data = response.getDataOrDefault({ images: [] });
213
213
  return data.images;
214
214
  }
215
215
  /**
@@ -528,7 +528,7 @@ export class AssistsXAsync {
528
528
  node,
529
529
  timeout,
530
530
  });
531
- return Node.create(response.getDataOrDefault("{}"));
531
+ return Node.create(response.getDataOrDefault({}));
532
532
  }
533
533
 
534
534
  /**
@@ -576,7 +576,7 @@ export class AssistsXAsync {
576
576
  node,
577
577
  timeout,
578
578
  });
579
- return Node.create(response.getDataOrDefault("{}"));
579
+ return Node.create(response.getDataOrDefault({}));
580
580
  }
581
581
 
582
582
  /**
@@ -971,7 +971,7 @@ export class AssistsXAsync {
971
971
  const response = await this.asyncCall(CallMethod.getScreenSize, {
972
972
  timeout,
973
973
  });
974
- return response.getDataOrDefault("{}");
974
+ return response.getDataOrDefault({});
975
975
  }
976
976
 
977
977
  /**
@@ -983,7 +983,7 @@ export class AssistsXAsync {
983
983
  const response = await this.asyncCall(CallMethod.getAppScreenSize, {
984
984
  timeout,
985
985
  });
986
- return response.getDataOrDefault("{}");
986
+ return response.getDataOrDefault({});
987
987
  }
988
988
 
989
989
  /**
package/src/Bounds.ts CHANGED
@@ -63,6 +63,10 @@ export class Bounds {
63
63
  }
64
64
 
65
65
  static fromData(data: any): Bounds {
66
+ // 如果 data 为 null 或 undefined,返回一个空的 Bounds
67
+ if (data == null) {
68
+ return new Bounds(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true);
69
+ }
66
70
  return new Bounds(
67
71
  data.left,
68
72
  data.top,