@midscene/ios 1.0.1-beta-20251030070226.0 → 1.0.1-beta-20251103074550.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 +53 -3
- package/dist/es/index.mjs +53 -3
- package/dist/lib/bin.js +53 -3
- package/dist/lib/index.js +53 -3
- package/dist/types/index.d.ts +70 -1
- package/package.json +6 -5
- package/static/index.html +1 -1
- package/static/static/js/index.44fb18ac.js +19 -0
- package/static/static/js/index.44fb18ac.js.map +1 -0
- package/static/static/js/index.9dc611eb.js +0 -19
- package/static/static/js/index.9dc611eb.js.map +0 -1
- /package/static/static/js/{index.9dc611eb.js.LICENSE.txt → index.44fb18ac.js.LICENSE.txt} +0 -0
package/dist/es/bin.mjs
CHANGED
|
@@ -12189,6 +12189,10 @@ class IOSWebDriverClient extends WebDriverClient {
|
|
|
12189
12189
|
debugIOS(`Failed to apply iOS session configuration: ${error}`);
|
|
12190
12190
|
}
|
|
12191
12191
|
}
|
|
12192
|
+
async executeRequest(method, endpoint, data) {
|
|
12193
|
+
this.ensureSession();
|
|
12194
|
+
return this.makeRequest(method, endpoint, data);
|
|
12195
|
+
}
|
|
12192
12196
|
}
|
|
12193
12197
|
function device_define_property(obj, key, value) {
|
|
12194
12198
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -12201,6 +12205,12 @@ function device_define_property(obj, key, value) {
|
|
|
12201
12205
|
return obj;
|
|
12202
12206
|
}
|
|
12203
12207
|
const debugDevice = getDebug('ios:device');
|
|
12208
|
+
const WDA_HTTP_METHODS = [
|
|
12209
|
+
'GET',
|
|
12210
|
+
'POST',
|
|
12211
|
+
'DELETE',
|
|
12212
|
+
'PUT'
|
|
12213
|
+
];
|
|
12204
12214
|
class device_IOSDevice {
|
|
12205
12215
|
actionSpace() {
|
|
12206
12216
|
const defaultActions = [
|
|
@@ -12309,9 +12319,11 @@ class device_IOSDevice {
|
|
|
12309
12319
|
await this.clearInput(element);
|
|
12310
12320
|
})
|
|
12311
12321
|
];
|
|
12322
|
+
const platformSpecificActions = Object.values(createPlatformActions(this));
|
|
12312
12323
|
const customActions = this.customActions || [];
|
|
12313
12324
|
return [
|
|
12314
12325
|
...defaultActions,
|
|
12326
|
+
...platformSpecificActions,
|
|
12315
12327
|
...customActions
|
|
12316
12328
|
];
|
|
12317
12329
|
}
|
|
@@ -12699,6 +12711,9 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
12699
12711
|
throw new Error(`Failed to open URL via Safari: ${error}`);
|
|
12700
12712
|
}
|
|
12701
12713
|
}
|
|
12714
|
+
async runWdaRequest(method, endpoint, data) {
|
|
12715
|
+
return await this.wdaBackend.executeRequest(method, endpoint, data);
|
|
12716
|
+
}
|
|
12702
12717
|
async destroy() {
|
|
12703
12718
|
if (this.destroyed) return;
|
|
12704
12719
|
try {
|
|
@@ -12734,13 +12749,48 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
12734
12749
|
this.wdaManager = WDAManager.getInstance(wdaPort, wdaHost);
|
|
12735
12750
|
}
|
|
12736
12751
|
}
|
|
12752
|
+
const runWdaRequestParamSchema = z.object({
|
|
12753
|
+
method: z["enum"](WDA_HTTP_METHODS).describe('HTTP method (GET, POST, DELETE, PUT)'),
|
|
12754
|
+
endpoint: z.string().describe('WebDriver API endpoint'),
|
|
12755
|
+
data: z.object({}).passthrough().optional().describe('Optional request body data as JSON object')
|
|
12756
|
+
});
|
|
12757
|
+
const launchParamSchema = z.string().describe('App bundle ID or URL to launch');
|
|
12758
|
+
const createPlatformActions = (device)=>({
|
|
12759
|
+
RunWdaRequest: defineAction({
|
|
12760
|
+
name: 'RunWdaRequest',
|
|
12761
|
+
description: 'Execute WebDriverAgent API request directly on iOS device',
|
|
12762
|
+
interfaceAlias: 'runWdaRequest',
|
|
12763
|
+
paramSchema: runWdaRequestParamSchema,
|
|
12764
|
+
call: async (param)=>await device.runWdaRequest(param.method, param.endpoint, param.data)
|
|
12765
|
+
}),
|
|
12766
|
+
Launch: defineAction({
|
|
12767
|
+
name: 'Launch',
|
|
12768
|
+
description: 'Launch an iOS app or URL',
|
|
12769
|
+
interfaceAlias: 'launch',
|
|
12770
|
+
paramSchema: launchParamSchema,
|
|
12771
|
+
call: async (param)=>{
|
|
12772
|
+
await device.launch(param);
|
|
12773
|
+
}
|
|
12774
|
+
})
|
|
12775
|
+
});
|
|
12737
12776
|
promisify(exec);
|
|
12738
12777
|
getDebug('ios:utils');
|
|
12778
|
+
function agent_define_property(obj, key, value) {
|
|
12779
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
12780
|
+
value: value,
|
|
12781
|
+
enumerable: true,
|
|
12782
|
+
configurable: true,
|
|
12783
|
+
writable: true
|
|
12784
|
+
});
|
|
12785
|
+
else obj[key] = value;
|
|
12786
|
+
return obj;
|
|
12787
|
+
}
|
|
12739
12788
|
getDebug('ios:agent');
|
|
12740
12789
|
class IOSAgent extends Agent {
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12790
|
+
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');
|
|
12744
12794
|
}
|
|
12745
12795
|
}
|
|
12746
12796
|
async function isPortAvailable(port) {
|
package/dist/es/index.mjs
CHANGED
|
@@ -340,6 +340,10 @@ class IOSWebDriverClient extends WebDriverClient {
|
|
|
340
340
|
debugIOS(`Failed to apply iOS session configuration: ${error}`);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
+
async executeRequest(method, endpoint, data) {
|
|
344
|
+
this.ensureSession();
|
|
345
|
+
return this.makeRequest(method, endpoint, data);
|
|
346
|
+
}
|
|
343
347
|
}
|
|
344
348
|
function _define_property(obj, key, value) {
|
|
345
349
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -352,6 +356,12 @@ function _define_property(obj, key, value) {
|
|
|
352
356
|
return obj;
|
|
353
357
|
}
|
|
354
358
|
const debugDevice = getDebug('ios:device');
|
|
359
|
+
const WDA_HTTP_METHODS = [
|
|
360
|
+
'GET',
|
|
361
|
+
'POST',
|
|
362
|
+
'DELETE',
|
|
363
|
+
'PUT'
|
|
364
|
+
];
|
|
355
365
|
class IOSDevice {
|
|
356
366
|
actionSpace() {
|
|
357
367
|
const defaultActions = [
|
|
@@ -460,9 +470,11 @@ class IOSDevice {
|
|
|
460
470
|
await this.clearInput(element);
|
|
461
471
|
})
|
|
462
472
|
];
|
|
473
|
+
const platformSpecificActions = Object.values(createPlatformActions(this));
|
|
463
474
|
const customActions = this.customActions || [];
|
|
464
475
|
return [
|
|
465
476
|
...defaultActions,
|
|
477
|
+
...platformSpecificActions,
|
|
466
478
|
...customActions
|
|
467
479
|
];
|
|
468
480
|
}
|
|
@@ -850,6 +862,9 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
850
862
|
throw new Error(`Failed to open URL via Safari: ${error}`);
|
|
851
863
|
}
|
|
852
864
|
}
|
|
865
|
+
async runWdaRequest(method, endpoint, data) {
|
|
866
|
+
return await this.wdaBackend.executeRequest(method, endpoint, data);
|
|
867
|
+
}
|
|
853
868
|
async destroy() {
|
|
854
869
|
if (this.destroyed) return;
|
|
855
870
|
try {
|
|
@@ -885,6 +900,30 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
885
900
|
this.wdaManager = WDAManager.getInstance(wdaPort, wdaHost);
|
|
886
901
|
}
|
|
887
902
|
}
|
|
903
|
+
const runWdaRequestParamSchema = z.object({
|
|
904
|
+
method: z["enum"](WDA_HTTP_METHODS).describe('HTTP method (GET, POST, DELETE, PUT)'),
|
|
905
|
+
endpoint: z.string().describe('WebDriver API endpoint'),
|
|
906
|
+
data: z.object({}).passthrough().optional().describe('Optional request body data as JSON object')
|
|
907
|
+
});
|
|
908
|
+
const launchParamSchema = z.string().describe('App bundle ID or URL to launch');
|
|
909
|
+
const createPlatformActions = (device)=>({
|
|
910
|
+
RunWdaRequest: defineAction({
|
|
911
|
+
name: 'RunWdaRequest',
|
|
912
|
+
description: 'Execute WebDriverAgent API request directly on iOS device',
|
|
913
|
+
interfaceAlias: 'runWdaRequest',
|
|
914
|
+
paramSchema: runWdaRequestParamSchema,
|
|
915
|
+
call: async (param)=>await device.runWdaRequest(param.method, param.endpoint, param.data)
|
|
916
|
+
}),
|
|
917
|
+
Launch: defineAction({
|
|
918
|
+
name: 'Launch',
|
|
919
|
+
description: 'Launch an iOS app or URL',
|
|
920
|
+
interfaceAlias: 'launch',
|
|
921
|
+
paramSchema: launchParamSchema,
|
|
922
|
+
call: async (param)=>{
|
|
923
|
+
await device.launch(param);
|
|
924
|
+
}
|
|
925
|
+
})
|
|
926
|
+
});
|
|
888
927
|
const execAsync = promisify(exec);
|
|
889
928
|
const debugUtils = getDebug('ios:utils');
|
|
890
929
|
function checkMacOSPlatform() {
|
|
@@ -931,11 +970,22 @@ async function checkIOSEnvironment() {
|
|
|
931
970
|
};
|
|
932
971
|
}
|
|
933
972
|
}
|
|
973
|
+
function agent_define_property(obj, key, value) {
|
|
974
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
975
|
+
value: value,
|
|
976
|
+
enumerable: true,
|
|
977
|
+
configurable: true,
|
|
978
|
+
writable: true
|
|
979
|
+
});
|
|
980
|
+
else obj[key] = value;
|
|
981
|
+
return obj;
|
|
982
|
+
}
|
|
934
983
|
const debugAgent = getDebug('ios:agent');
|
|
935
984
|
class IOSAgent extends Agent {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
985
|
+
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');
|
|
939
989
|
}
|
|
940
990
|
}
|
|
941
991
|
async function agentFromWebDriverAgent(opts) {
|
package/dist/lib/bin.js
CHANGED
|
@@ -12327,6 +12327,10 @@ var __webpack_exports__ = {};
|
|
|
12327
12327
|
debugIOS(`Failed to apply iOS session configuration: ${error}`);
|
|
12328
12328
|
}
|
|
12329
12329
|
}
|
|
12330
|
+
async executeRequest(method, endpoint, data) {
|
|
12331
|
+
this.ensureSession();
|
|
12332
|
+
return this.makeRequest(method, endpoint, data);
|
|
12333
|
+
}
|
|
12330
12334
|
}
|
|
12331
12335
|
function device_define_property(obj, key, value) {
|
|
12332
12336
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -12339,6 +12343,12 @@ var __webpack_exports__ = {};
|
|
|
12339
12343
|
return obj;
|
|
12340
12344
|
}
|
|
12341
12345
|
const debugDevice = (0, logger_namespaceObject.getDebug)('ios:device');
|
|
12346
|
+
const WDA_HTTP_METHODS = [
|
|
12347
|
+
'GET',
|
|
12348
|
+
'POST',
|
|
12349
|
+
'DELETE',
|
|
12350
|
+
'PUT'
|
|
12351
|
+
];
|
|
12342
12352
|
class device_IOSDevice {
|
|
12343
12353
|
actionSpace() {
|
|
12344
12354
|
const defaultActions = [
|
|
@@ -12447,9 +12457,11 @@ var __webpack_exports__ = {};
|
|
|
12447
12457
|
await this.clearInput(element);
|
|
12448
12458
|
})
|
|
12449
12459
|
];
|
|
12460
|
+
const platformSpecificActions = Object.values(createPlatformActions(this));
|
|
12450
12461
|
const customActions = this.customActions || [];
|
|
12451
12462
|
return [
|
|
12452
12463
|
...defaultActions,
|
|
12464
|
+
...platformSpecificActions,
|
|
12453
12465
|
...customActions
|
|
12454
12466
|
];
|
|
12455
12467
|
}
|
|
@@ -12837,6 +12849,9 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
12837
12849
|
throw new Error(`Failed to open URL via Safari: ${error}`);
|
|
12838
12850
|
}
|
|
12839
12851
|
}
|
|
12852
|
+
async runWdaRequest(method, endpoint, data) {
|
|
12853
|
+
return await this.wdaBackend.executeRequest(method, endpoint, data);
|
|
12854
|
+
}
|
|
12840
12855
|
async destroy() {
|
|
12841
12856
|
if (this.destroyed) return;
|
|
12842
12857
|
try {
|
|
@@ -12872,15 +12887,50 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
12872
12887
|
this.wdaManager = webdriver_namespaceObject.WDAManager.getInstance(wdaPort, wdaHost);
|
|
12873
12888
|
}
|
|
12874
12889
|
}
|
|
12890
|
+
const runWdaRequestParamSchema = core_namespaceObject.z.object({
|
|
12891
|
+
method: core_namespaceObject.z["enum"](WDA_HTTP_METHODS).describe('HTTP method (GET, POST, DELETE, PUT)'),
|
|
12892
|
+
endpoint: core_namespaceObject.z.string().describe('WebDriver API endpoint'),
|
|
12893
|
+
data: core_namespaceObject.z.object({}).passthrough().optional().describe('Optional request body data as JSON object')
|
|
12894
|
+
});
|
|
12895
|
+
const launchParamSchema = core_namespaceObject.z.string().describe('App bundle ID or URL to launch');
|
|
12896
|
+
const createPlatformActions = (device)=>({
|
|
12897
|
+
RunWdaRequest: (0, device_namespaceObject.defineAction)({
|
|
12898
|
+
name: 'RunWdaRequest',
|
|
12899
|
+
description: 'Execute WebDriverAgent API request directly on iOS device',
|
|
12900
|
+
interfaceAlias: 'runWdaRequest',
|
|
12901
|
+
paramSchema: runWdaRequestParamSchema,
|
|
12902
|
+
call: async (param)=>await device.runWdaRequest(param.method, param.endpoint, param.data)
|
|
12903
|
+
}),
|
|
12904
|
+
Launch: (0, device_namespaceObject.defineAction)({
|
|
12905
|
+
name: 'Launch',
|
|
12906
|
+
description: 'Launch an iOS app or URL',
|
|
12907
|
+
interfaceAlias: 'launch',
|
|
12908
|
+
paramSchema: launchParamSchema,
|
|
12909
|
+
call: async (param)=>{
|
|
12910
|
+
await device.launch(param);
|
|
12911
|
+
}
|
|
12912
|
+
})
|
|
12913
|
+
});
|
|
12875
12914
|
require("node:os");
|
|
12876
12915
|
const external_node_util_namespaceObject = require("node:util");
|
|
12877
12916
|
(0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec);
|
|
12878
12917
|
(0, logger_namespaceObject.getDebug)('ios:utils');
|
|
12918
|
+
function agent_define_property(obj, key, value) {
|
|
12919
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
12920
|
+
value: value,
|
|
12921
|
+
enumerable: true,
|
|
12922
|
+
configurable: true,
|
|
12923
|
+
writable: true
|
|
12924
|
+
});
|
|
12925
|
+
else obj[key] = value;
|
|
12926
|
+
return obj;
|
|
12927
|
+
}
|
|
12879
12928
|
(0, logger_namespaceObject.getDebug)('ios:agent');
|
|
12880
12929
|
class IOSAgent extends agent_namespaceObject.Agent {
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12930
|
+
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');
|
|
12884
12934
|
}
|
|
12885
12935
|
}
|
|
12886
12936
|
async function isPortAvailable(port) {
|
package/dist/lib/index.js
CHANGED
|
@@ -378,6 +378,10 @@ class IOSWebDriverClient extends webdriver_namespaceObject.WebDriverClient {
|
|
|
378
378
|
debugIOS(`Failed to apply iOS session configuration: ${error}`);
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
+
async executeRequest(method, endpoint, data) {
|
|
382
|
+
this.ensureSession();
|
|
383
|
+
return this.makeRequest(method, endpoint, data);
|
|
384
|
+
}
|
|
381
385
|
}
|
|
382
386
|
function _define_property(obj, key, value) {
|
|
383
387
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -390,6 +394,12 @@ function _define_property(obj, key, value) {
|
|
|
390
394
|
return obj;
|
|
391
395
|
}
|
|
392
396
|
const debugDevice = (0, logger_namespaceObject.getDebug)('ios:device');
|
|
397
|
+
const WDA_HTTP_METHODS = [
|
|
398
|
+
'GET',
|
|
399
|
+
'POST',
|
|
400
|
+
'DELETE',
|
|
401
|
+
'PUT'
|
|
402
|
+
];
|
|
393
403
|
class IOSDevice {
|
|
394
404
|
actionSpace() {
|
|
395
405
|
const defaultActions = [
|
|
@@ -498,9 +508,11 @@ class IOSDevice {
|
|
|
498
508
|
await this.clearInput(element);
|
|
499
509
|
})
|
|
500
510
|
];
|
|
511
|
+
const platformSpecificActions = Object.values(createPlatformActions(this));
|
|
501
512
|
const customActions = this.customActions || [];
|
|
502
513
|
return [
|
|
503
514
|
...defaultActions,
|
|
515
|
+
...platformSpecificActions,
|
|
504
516
|
...customActions
|
|
505
517
|
];
|
|
506
518
|
}
|
|
@@ -888,6 +900,9 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
888
900
|
throw new Error(`Failed to open URL via Safari: ${error}`);
|
|
889
901
|
}
|
|
890
902
|
}
|
|
903
|
+
async runWdaRequest(method, endpoint, data) {
|
|
904
|
+
return await this.wdaBackend.executeRequest(method, endpoint, data);
|
|
905
|
+
}
|
|
891
906
|
async destroy() {
|
|
892
907
|
if (this.destroyed) return;
|
|
893
908
|
try {
|
|
@@ -923,6 +938,30 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
923
938
|
this.wdaManager = webdriver_namespaceObject.WDAManager.getInstance(wdaPort, wdaHost);
|
|
924
939
|
}
|
|
925
940
|
}
|
|
941
|
+
const runWdaRequestParamSchema = core_namespaceObject.z.object({
|
|
942
|
+
method: core_namespaceObject.z["enum"](WDA_HTTP_METHODS).describe('HTTP method (GET, POST, DELETE, PUT)'),
|
|
943
|
+
endpoint: core_namespaceObject.z.string().describe('WebDriver API endpoint'),
|
|
944
|
+
data: core_namespaceObject.z.object({}).passthrough().optional().describe('Optional request body data as JSON object')
|
|
945
|
+
});
|
|
946
|
+
const launchParamSchema = core_namespaceObject.z.string().describe('App bundle ID or URL to launch');
|
|
947
|
+
const createPlatformActions = (device)=>({
|
|
948
|
+
RunWdaRequest: (0, device_namespaceObject.defineAction)({
|
|
949
|
+
name: 'RunWdaRequest',
|
|
950
|
+
description: 'Execute WebDriverAgent API request directly on iOS device',
|
|
951
|
+
interfaceAlias: 'runWdaRequest',
|
|
952
|
+
paramSchema: runWdaRequestParamSchema,
|
|
953
|
+
call: async (param)=>await device.runWdaRequest(param.method, param.endpoint, param.data)
|
|
954
|
+
}),
|
|
955
|
+
Launch: (0, device_namespaceObject.defineAction)({
|
|
956
|
+
name: 'Launch',
|
|
957
|
+
description: 'Launch an iOS app or URL',
|
|
958
|
+
interfaceAlias: 'launch',
|
|
959
|
+
paramSchema: launchParamSchema,
|
|
960
|
+
call: async (param)=>{
|
|
961
|
+
await device.launch(param);
|
|
962
|
+
}
|
|
963
|
+
})
|
|
964
|
+
});
|
|
926
965
|
const agent_namespaceObject = require("@midscene/core/agent");
|
|
927
966
|
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
928
967
|
const external_node_os_namespaceObject = require("node:os");
|
|
@@ -973,11 +1012,22 @@ async function checkIOSEnvironment() {
|
|
|
973
1012
|
};
|
|
974
1013
|
}
|
|
975
1014
|
}
|
|
1015
|
+
function agent_define_property(obj, key, value) {
|
|
1016
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
1017
|
+
value: value,
|
|
1018
|
+
enumerable: true,
|
|
1019
|
+
configurable: true,
|
|
1020
|
+
writable: true
|
|
1021
|
+
});
|
|
1022
|
+
else obj[key] = value;
|
|
1023
|
+
return obj;
|
|
1024
|
+
}
|
|
976
1025
|
const debugAgent = (0, logger_namespaceObject.getDebug)('ios:agent');
|
|
977
1026
|
class IOSAgent extends agent_namespaceObject.Agent {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1027
|
+
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');
|
|
981
1031
|
}
|
|
982
1032
|
}
|
|
983
1033
|
async function agentFromWebDriverAgent(opts) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AbstractInterface } from '@midscene/core/device';
|
|
2
|
+
import type { ActionParam } from '@midscene/core';
|
|
3
|
+
import type { ActionReturn } from '@midscene/core';
|
|
2
4
|
import { Agent } from '@midscene/core/agent';
|
|
3
5
|
import { AgentOpt } from '@midscene/core/agent';
|
|
4
6
|
import { DeviceAction } from '@midscene/core';
|
|
@@ -10,6 +12,7 @@ import { overrideAIConfig } from '@midscene/shared/env';
|
|
|
10
12
|
import { Point } from '@midscene/core';
|
|
11
13
|
import { Size } from '@midscene/core';
|
|
12
14
|
import { WebDriverClient } from '@midscene/webdriver';
|
|
15
|
+
import { z } from '@midscene/core';
|
|
13
16
|
|
|
14
17
|
export declare function agentFromWebDriverAgent(opts?: IOSAgentOpt & IOSDeviceOpt): Promise<IOSAgent>;
|
|
15
18
|
|
|
@@ -18,8 +21,22 @@ export declare function checkIOSEnvironment(): Promise<{
|
|
|
18
21
|
error?: string;
|
|
19
22
|
}>;
|
|
20
23
|
|
|
24
|
+
declare type DeviceActionLaunch = DeviceAction<LaunchParam, void>;
|
|
25
|
+
|
|
26
|
+
declare type DeviceActionRunWdaRequest = DeviceAction<RunWdaRequestParam, RunWdaRequestReturn>;
|
|
27
|
+
|
|
21
28
|
export declare class IOSAgent extends Agent<IOSDevice> {
|
|
22
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Launch an iOS app or URL
|
|
31
|
+
* Type-safe wrapper around the Launch action from actionSpace
|
|
32
|
+
*/
|
|
33
|
+
launch: WrappedAction<DeviceActionLaunch>;
|
|
34
|
+
/**
|
|
35
|
+
* Execute WebDriverAgent API request directly
|
|
36
|
+
* Type-safe wrapper around the RunWdaRequest action from actionSpace
|
|
37
|
+
*/
|
|
38
|
+
runWdaRequest: WrappedAction<DeviceActionRunWdaRequest>;
|
|
39
|
+
constructor(device: IOSDevice, opts?: IOSAgentOpt);
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
declare type IOSAgentOpt = AgentOpt;
|
|
@@ -93,6 +110,15 @@ export declare class IOSDevice implements AbstractInterface {
|
|
|
93
110
|
* @param url The URL to open
|
|
94
111
|
*/
|
|
95
112
|
openUrlViaSafari(url: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Execute a WebDriverAgent API request directly
|
|
115
|
+
* This is the iOS equivalent of Android's runAdbShell
|
|
116
|
+
* @param method HTTP method (GET, POST, DELETE, PUT)
|
|
117
|
+
* @param endpoint WebDriver API endpoint
|
|
118
|
+
* @param data Optional request body data
|
|
119
|
+
* @returns Response from the WebDriver API
|
|
120
|
+
*/
|
|
121
|
+
runWdaRequest<TResult = any>(method: WDAHttpMethod, endpoint: string, data?: any): Promise<TResult>;
|
|
96
122
|
destroy(): Promise<void>;
|
|
97
123
|
}
|
|
98
124
|
|
|
@@ -130,8 +156,51 @@ export declare class IOSWebDriverClient extends WebDriverClient {
|
|
|
130
156
|
getScreenScale(): Promise<number | null>;
|
|
131
157
|
createSession(capabilities?: any): Promise<any>;
|
|
132
158
|
private setupIOSSession;
|
|
159
|
+
/**
|
|
160
|
+
* Execute a WebDriverAgent API request directly
|
|
161
|
+
* This is the iOS equivalent of Android's runAdbShell
|
|
162
|
+
* @param method HTTP method (GET, POST, DELETE, etc.)
|
|
163
|
+
* @param endpoint WebDriver API endpoint
|
|
164
|
+
* @param data Optional request body data
|
|
165
|
+
* @returns Response from the WebDriver API
|
|
166
|
+
*/
|
|
167
|
+
executeRequest<TResult = any>(method: string, endpoint: string, data?: any): Promise<TResult>;
|
|
133
168
|
}
|
|
134
169
|
|
|
170
|
+
declare type LaunchParam = z.infer<typeof launchParamSchema>;
|
|
171
|
+
|
|
172
|
+
declare const launchParamSchema: z.ZodString;
|
|
173
|
+
|
|
135
174
|
export { overrideAIConfig }
|
|
136
175
|
|
|
176
|
+
declare type RunWdaRequestParam = z.infer<typeof runWdaRequestParamSchema>;
|
|
177
|
+
|
|
178
|
+
declare const runWdaRequestParamSchema: z.ZodObject<{
|
|
179
|
+
method: z.ZodEnum<["GET", "POST", "DELETE", "PUT"]>;
|
|
180
|
+
endpoint: z.ZodString;
|
|
181
|
+
data: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
method: "POST" | "GET" | "DELETE" | "PUT";
|
|
184
|
+
endpoint: string;
|
|
185
|
+
data?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
method: "POST" | "GET" | "DELETE" | "PUT";
|
|
188
|
+
endpoint: string;
|
|
189
|
+
data?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
190
|
+
}>;
|
|
191
|
+
|
|
192
|
+
declare type RunWdaRequestReturn = Awaited<ReturnType<IOSDevice['runWdaRequest']>>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* HTTP methods supported by WebDriverAgent API
|
|
196
|
+
*/
|
|
197
|
+
declare const WDA_HTTP_METHODS: readonly ["GET", "POST", "DELETE", "PUT"];
|
|
198
|
+
|
|
199
|
+
declare type WDAHttpMethod = (typeof WDA_HTTP_METHODS)[number];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Helper type to convert DeviceAction to wrapped method signature
|
|
203
|
+
*/
|
|
204
|
+
declare type WrappedAction<T extends DeviceAction> = (param: ActionParam<T>) => Promise<ActionReturn<T>>;
|
|
205
|
+
|
|
137
206
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/ios",
|
|
3
|
-
"version": "1.0.1-beta-
|
|
3
|
+
"version": "1.0.1-beta-20251103074550.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-
|
|
42
|
-
"@midscene/
|
|
43
|
-
"@midscene/
|
|
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"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rslib/core": "^0.11.2",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"typescript": "^5.8.3",
|
|
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
54
|
},
|
|
54
55
|
"license": "MIT",
|
|
55
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.
|
|
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>
|