@midscene/ios 1.0.1-beta-20251103074550.0 → 1.0.1-beta-20251104101357.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/dist/es/bin.mjs CHANGED
@@ -12283,22 +12283,6 @@ class device_IOSDevice {
12283
12283
  defineActionKeyboardPress(async (param)=>{
12284
12284
  await this.pressKey(param.keyName);
12285
12285
  }),
12286
- defineAction({
12287
- name: 'IOSHomeButton',
12288
- description: 'Trigger the system "home" operation on iOS devices',
12289
- paramSchema: z.object({}),
12290
- call: async ()=>{
12291
- await this.home();
12292
- }
12293
- }),
12294
- defineAction({
12295
- name: 'IOSAppSwitcher',
12296
- description: 'Trigger the system "app switcher" operation on iOS devices',
12297
- paramSchema: z.object({}),
12298
- call: async ()=>{
12299
- await this.appSwitcher();
12300
- }
12301
- }),
12302
12286
  defineAction({
12303
12287
  name: 'IOSLongPress',
12304
12288
  description: 'Trigger a long press on the screen at specified coordinates on iOS devices',
@@ -12771,6 +12755,22 @@ const createPlatformActions = (device)=>({
12771
12755
  call: async (param)=>{
12772
12756
  await device.launch(param);
12773
12757
  }
12758
+ }),
12759
+ IOSHomeButton: defineAction({
12760
+ name: 'IOSHomeButton',
12761
+ description: 'Trigger the system "home" operation on iOS devices',
12762
+ paramSchema: z["void"]().describe('No parameters required'),
12763
+ call: async ()=>{
12764
+ await device.home();
12765
+ }
12766
+ }),
12767
+ IOSAppSwitcher: defineAction({
12768
+ name: 'IOSAppSwitcher',
12769
+ description: 'Trigger the system "app switcher" operation on iOS devices',
12770
+ paramSchema: z["void"]().describe('No parameters required'),
12771
+ call: async ()=>{
12772
+ await device.appSwitcher();
12773
+ }
12774
12774
  })
12775
12775
  });
12776
12776
  promisify(exec);
@@ -12787,10 +12787,16 @@ function agent_define_property(obj, key, value) {
12787
12787
  }
12788
12788
  getDebug('ios:agent');
12789
12789
  class IOSAgent extends Agent {
12790
+ createActionWrapper(name) {
12791
+ const action = this.wrapActionInActionSpace(name);
12792
+ return (...args)=>action(args[0]);
12793
+ }
12790
12794
  constructor(device, opts){
12791
- super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0);
12792
- this.launch = this.wrapActionInActionSpace('Launch');
12793
- this.runWdaRequest = this.wrapActionInActionSpace('RunWdaRequest');
12795
+ super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0), agent_define_property(this, "home", void 0), agent_define_property(this, "appSwitcher", void 0);
12796
+ this.launch = this.createActionWrapper('Launch');
12797
+ this.runWdaRequest = this.createActionWrapper('RunWdaRequest');
12798
+ this.home = this.createActionWrapper('IOSHomeButton');
12799
+ this.appSwitcher = this.createActionWrapper('IOSAppSwitcher');
12794
12800
  }
12795
12801
  }
12796
12802
  async function isPortAvailable(port) {
package/dist/es/index.mjs CHANGED
@@ -434,22 +434,6 @@ class IOSDevice {
434
434
  defineActionKeyboardPress(async (param)=>{
435
435
  await this.pressKey(param.keyName);
436
436
  }),
437
- defineAction({
438
- name: 'IOSHomeButton',
439
- description: 'Trigger the system "home" operation on iOS devices',
440
- paramSchema: z.object({}),
441
- call: async ()=>{
442
- await this.home();
443
- }
444
- }),
445
- defineAction({
446
- name: 'IOSAppSwitcher',
447
- description: 'Trigger the system "app switcher" operation on iOS devices',
448
- paramSchema: z.object({}),
449
- call: async ()=>{
450
- await this.appSwitcher();
451
- }
452
- }),
453
437
  defineAction({
454
438
  name: 'IOSLongPress',
455
439
  description: 'Trigger a long press on the screen at specified coordinates on iOS devices',
@@ -922,6 +906,22 @@ const createPlatformActions = (device)=>({
922
906
  call: async (param)=>{
923
907
  await device.launch(param);
924
908
  }
909
+ }),
910
+ IOSHomeButton: defineAction({
911
+ name: 'IOSHomeButton',
912
+ description: 'Trigger the system "home" operation on iOS devices',
913
+ paramSchema: z["void"]().describe('No parameters required'),
914
+ call: async ()=>{
915
+ await device.home();
916
+ }
917
+ }),
918
+ IOSAppSwitcher: defineAction({
919
+ name: 'IOSAppSwitcher',
920
+ description: 'Trigger the system "app switcher" operation on iOS devices',
921
+ paramSchema: z["void"]().describe('No parameters required'),
922
+ call: async ()=>{
923
+ await device.appSwitcher();
924
+ }
925
925
  })
926
926
  });
927
927
  const execAsync = promisify(exec);
@@ -982,10 +982,16 @@ function agent_define_property(obj, key, value) {
982
982
  }
983
983
  const debugAgent = getDebug('ios:agent');
984
984
  class IOSAgent extends Agent {
985
+ createActionWrapper(name) {
986
+ const action = this.wrapActionInActionSpace(name);
987
+ return (...args)=>action(args[0]);
988
+ }
985
989
  constructor(device, opts){
986
- super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0);
987
- this.launch = this.wrapActionInActionSpace('Launch');
988
- this.runWdaRequest = this.wrapActionInActionSpace('RunWdaRequest');
990
+ super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0), agent_define_property(this, "home", void 0), agent_define_property(this, "appSwitcher", void 0);
991
+ this.launch = this.createActionWrapper('Launch');
992
+ this.runWdaRequest = this.createActionWrapper('RunWdaRequest');
993
+ this.home = this.createActionWrapper('IOSHomeButton');
994
+ this.appSwitcher = this.createActionWrapper('IOSAppSwitcher');
989
995
  }
990
996
  }
991
997
  async function agentFromWebDriverAgent(opts) {
package/dist/lib/bin.js CHANGED
@@ -12421,22 +12421,6 @@ var __webpack_exports__ = {};
12421
12421
  (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
12422
12422
  await this.pressKey(param.keyName);
12423
12423
  }),
12424
- (0, device_namespaceObject.defineAction)({
12425
- name: 'IOSHomeButton',
12426
- description: 'Trigger the system "home" operation on iOS devices',
12427
- paramSchema: core_namespaceObject.z.object({}),
12428
- call: async ()=>{
12429
- await this.home();
12430
- }
12431
- }),
12432
- (0, device_namespaceObject.defineAction)({
12433
- name: 'IOSAppSwitcher',
12434
- description: 'Trigger the system "app switcher" operation on iOS devices',
12435
- paramSchema: core_namespaceObject.z.object({}),
12436
- call: async ()=>{
12437
- await this.appSwitcher();
12438
- }
12439
- }),
12440
12424
  (0, device_namespaceObject.defineAction)({
12441
12425
  name: 'IOSLongPress',
12442
12426
  description: 'Trigger a long press on the screen at specified coordinates on iOS devices',
@@ -12909,6 +12893,22 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
12909
12893
  call: async (param)=>{
12910
12894
  await device.launch(param);
12911
12895
  }
12896
+ }),
12897
+ IOSHomeButton: (0, device_namespaceObject.defineAction)({
12898
+ name: 'IOSHomeButton',
12899
+ description: 'Trigger the system "home" operation on iOS devices',
12900
+ paramSchema: core_namespaceObject.z["void"]().describe('No parameters required'),
12901
+ call: async ()=>{
12902
+ await device.home();
12903
+ }
12904
+ }),
12905
+ IOSAppSwitcher: (0, device_namespaceObject.defineAction)({
12906
+ name: 'IOSAppSwitcher',
12907
+ description: 'Trigger the system "app switcher" operation on iOS devices',
12908
+ paramSchema: core_namespaceObject.z["void"]().describe('No parameters required'),
12909
+ call: async ()=>{
12910
+ await device.appSwitcher();
12911
+ }
12912
12912
  })
12913
12913
  });
12914
12914
  require("node:os");
@@ -12927,10 +12927,16 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
12927
12927
  }
12928
12928
  (0, logger_namespaceObject.getDebug)('ios:agent');
12929
12929
  class IOSAgent extends agent_namespaceObject.Agent {
12930
+ createActionWrapper(name) {
12931
+ const action = this.wrapActionInActionSpace(name);
12932
+ return (...args)=>action(args[0]);
12933
+ }
12930
12934
  constructor(device, opts){
12931
- super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0);
12932
- this.launch = this.wrapActionInActionSpace('Launch');
12933
- this.runWdaRequest = this.wrapActionInActionSpace('RunWdaRequest');
12935
+ super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0), agent_define_property(this, "home", void 0), agent_define_property(this, "appSwitcher", void 0);
12936
+ this.launch = this.createActionWrapper('Launch');
12937
+ this.runWdaRequest = this.createActionWrapper('RunWdaRequest');
12938
+ this.home = this.createActionWrapper('IOSHomeButton');
12939
+ this.appSwitcher = this.createActionWrapper('IOSAppSwitcher');
12934
12940
  }
12935
12941
  }
12936
12942
  async function isPortAvailable(port) {
package/dist/lib/index.js CHANGED
@@ -472,22 +472,6 @@ class IOSDevice {
472
472
  (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
473
473
  await this.pressKey(param.keyName);
474
474
  }),
475
- (0, device_namespaceObject.defineAction)({
476
- name: 'IOSHomeButton',
477
- description: 'Trigger the system "home" operation on iOS devices',
478
- paramSchema: core_namespaceObject.z.object({}),
479
- call: async ()=>{
480
- await this.home();
481
- }
482
- }),
483
- (0, device_namespaceObject.defineAction)({
484
- name: 'IOSAppSwitcher',
485
- description: 'Trigger the system "app switcher" operation on iOS devices',
486
- paramSchema: core_namespaceObject.z.object({}),
487
- call: async ()=>{
488
- await this.appSwitcher();
489
- }
490
- }),
491
475
  (0, device_namespaceObject.defineAction)({
492
476
  name: 'IOSLongPress',
493
477
  description: 'Trigger a long press on the screen at specified coordinates on iOS devices',
@@ -960,6 +944,22 @@ const createPlatformActions = (device)=>({
960
944
  call: async (param)=>{
961
945
  await device.launch(param);
962
946
  }
947
+ }),
948
+ IOSHomeButton: (0, device_namespaceObject.defineAction)({
949
+ name: 'IOSHomeButton',
950
+ description: 'Trigger the system "home" operation on iOS devices',
951
+ paramSchema: core_namespaceObject.z["void"]().describe('No parameters required'),
952
+ call: async ()=>{
953
+ await device.home();
954
+ }
955
+ }),
956
+ IOSAppSwitcher: (0, device_namespaceObject.defineAction)({
957
+ name: 'IOSAppSwitcher',
958
+ description: 'Trigger the system "app switcher" operation on iOS devices',
959
+ paramSchema: core_namespaceObject.z["void"]().describe('No parameters required'),
960
+ call: async ()=>{
961
+ await device.appSwitcher();
962
+ }
963
963
  })
964
964
  });
965
965
  const agent_namespaceObject = require("@midscene/core/agent");
@@ -1024,10 +1024,16 @@ function agent_define_property(obj, key, value) {
1024
1024
  }
1025
1025
  const debugAgent = (0, logger_namespaceObject.getDebug)('ios:agent');
1026
1026
  class IOSAgent extends agent_namespaceObject.Agent {
1027
+ createActionWrapper(name) {
1028
+ const action = this.wrapActionInActionSpace(name);
1029
+ return (...args)=>action(args[0]);
1030
+ }
1027
1031
  constructor(device, opts){
1028
- super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0);
1029
- this.launch = this.wrapActionInActionSpace('Launch');
1030
- this.runWdaRequest = this.wrapActionInActionSpace('RunWdaRequest');
1032
+ super(device, opts), agent_define_property(this, "launch", void 0), agent_define_property(this, "runWdaRequest", void 0), agent_define_property(this, "home", void 0), agent_define_property(this, "appSwitcher", void 0);
1033
+ this.launch = this.createActionWrapper('Launch');
1034
+ this.runWdaRequest = this.createActionWrapper('RunWdaRequest');
1035
+ this.home = this.createActionWrapper('IOSHomeButton');
1036
+ this.appSwitcher = this.createActionWrapper('IOSAppSwitcher');
1031
1037
  }
1032
1038
  }
1033
1039
  async function agentFromWebDriverAgent(opts) {
@@ -14,6 +14,8 @@ import { Size } from '@midscene/core';
14
14
  import { WebDriverClient } from '@midscene/webdriver';
15
15
  import { z } from '@midscene/core';
16
16
 
17
+ declare type ActionArgs<T extends DeviceAction> = [ActionParam<T>] extends [undefined] ? [] : [ActionParam<T>];
18
+
17
19
  export declare function agentFromWebDriverAgent(opts?: IOSAgentOpt & IOSDeviceOpt): Promise<IOSAgent>;
18
20
 
19
21
  export declare function checkIOSEnvironment(): Promise<{
@@ -21,6 +23,10 @@ export declare function checkIOSEnvironment(): Promise<{
21
23
  error?: string;
22
24
  }>;
23
25
 
26
+ declare type DeviceActionIOSAppSwitcher = DeviceAction<void, void>;
27
+
28
+ declare type DeviceActionIOSHomeButton = DeviceAction<void, void>;
29
+
24
30
  declare type DeviceActionLaunch = DeviceAction<LaunchParam, void>;
25
31
 
26
32
  declare type DeviceActionRunWdaRequest = DeviceAction<RunWdaRequestParam, RunWdaRequestReturn>;
@@ -36,7 +42,16 @@ export declare class IOSAgent extends Agent<IOSDevice> {
36
42
  * Type-safe wrapper around the RunWdaRequest action from actionSpace
37
43
  */
38
44
  runWdaRequest: WrappedAction<DeviceActionRunWdaRequest>;
45
+ /**
46
+ * Trigger the system home operation on iOS devices
47
+ */
48
+ home: WrappedAction<DeviceActionIOSHomeButton>;
49
+ /**
50
+ * Trigger the system app switcher operation on iOS devices
51
+ */
52
+ appSwitcher: WrappedAction<DeviceActionIOSAppSwitcher>;
39
53
  constructor(device: IOSDevice, opts?: IOSAgentOpt);
54
+ private createActionWrapper;
40
55
  }
41
56
 
42
57
  declare type IOSAgentOpt = AgentOpt;
@@ -201,6 +216,6 @@ declare type WDAHttpMethod = (typeof WDA_HTTP_METHODS)[number];
201
216
  /**
202
217
  * Helper type to convert DeviceAction to wrapped method signature
203
218
  */
204
- declare type WrappedAction<T extends DeviceAction> = (param: ActionParam<T>) => Promise<ActionReturn<T>>;
219
+ declare type WrappedAction<T extends DeviceAction> = (...args: ActionArgs<T>) => Promise<ActionReturn<T>>;
205
220
 
206
221
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/ios",
3
- "version": "1.0.1-beta-20251103074550.0",
3
+ "version": "1.0.1-beta-20251104101357.0",
4
4
  "description": "iOS automation library for Midscene",
5
5
  "keywords": [
6
6
  "iOS UI automation",
@@ -38,9 +38,9 @@
38
38
  "dependencies": {
39
39
  "@inquirer/prompts": "^7.8.6",
40
40
  "open": "10.1.0",
41
- "@midscene/core": "1.0.1-beta-20251103074550.0",
42
- "@midscene/shared": "1.0.1-beta-20251103074550.0",
43
- "@midscene/webdriver": "1.0.1-beta-20251103074550.0"
41
+ "@midscene/core": "1.0.1-beta-20251104101357.0",
42
+ "@midscene/webdriver": "1.0.1-beta-20251104101357.0",
43
+ "@midscene/shared": "1.0.1-beta-20251104101357.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@rslib/core": "^0.11.2",
@@ -50,7 +50,7 @@
50
50
  "tsx": "^4.19.2",
51
51
  "vitest": "3.0.5",
52
52
  "zod": "3.24.3",
53
- "@midscene/playground": "1.0.1-beta-20251103074550.0"
53
+ "@midscene/playground": "1.0.1-beta-20251104101357.0"
54
54
  },
55
55
  "license": "MIT",
56
56
  "scripts": {
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.88bfef40.js"></script><script defer src="/static/js/63.b6f8c5e5.js"></script><script defer src="/static/js/index.44fb18ac.js"></script><link href="/static/css/index.07da784d.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.88bfef40.js"></script><script defer src="/static/js/63.b6f8c5e5.js"></script><script defer src="/static/js/index.84ebfe98.js"></script><link href="/static/css/index.07da784d.css" rel="stylesheet"></head><body><div id="root"></div></body></html>