node-devicectl 1.0.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -0,0 +1,21 @@
1
+ ## [1.1.0](https://github.com/appium/node-devicectl/compare/v1.0.1...v1.1.0) (2025-11-02)
2
+
3
+ ### Features
4
+
5
+ * Add a possibility to list connected devices ([#3](https://github.com/appium/node-devicectl/issues/3)) ([ffce717](https://github.com/appium/node-devicectl/commit/ffce717c46d314f221bbc33b4b4ad363562b7c3c))
6
+
7
+ ## [1.0.1](https://github.com/appium/node-devicectl/compare/v1.0.0...v1.0.1) (2025-10-23)
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * Prettify ([0b44180](https://github.com/appium/node-devicectl/commit/0b441806c2803231861260424bc82f2fb3a42224))
12
+
13
+ ## 1.0.0 (2025-10-23)
14
+
15
+ ### Features
16
+
17
+ * Initial release ([#1](https://github.com/appium/node-devicectl/issues/1)) ([59ba0bb](https://github.com/appium/node-devicectl/commit/59ba0bb4a002b21e5b3cdd78a6f7be21362f4ac1))
18
+
19
+ ### Bug Fixes
20
+
21
+ * Update buidling logic ([#2](https://github.com/appium/node-devicectl/issues/2)) ([2b6dbd5](https://github.com/appium/node-devicectl/commit/2b6dbd50878940e60152e3850b8d7aa480663bb0))
@@ -0,0 +1,39 @@
1
+ import type { ExecuteOptions, ExecuteResult } from './types';
2
+ import * as processMixins from './mixins/process';
3
+ import * as infoMixins from './mixins/info';
4
+ import * as copyMixins from './mixins/copy';
5
+ import * as listMixins from './mixins/list';
6
+ /**
7
+ * Node.js wrapper around Apple's devicectl tool
8
+ *
9
+ * This class provides methods to interact with iOS devices using the devicectl command-line tool.
10
+ * It requires Xcode 15+ and iOS 17+ to function properly.
11
+ *
12
+ */
13
+ export declare class Devicectl {
14
+ /** The unique device identifier */
15
+ readonly udid: string;
16
+ /**
17
+ * Creates a new Devicectl instance
18
+ *
19
+ * @param udid - The unique device identifier
20
+ */
21
+ constructor(udid: string);
22
+ /**
23
+ * Executes a devicectl command
24
+ *
25
+ * @param subcommand - The devicectl subcommand to execute
26
+ * @param opts - Execution options
27
+ * @returns Promise that resolves to the command result
28
+ */
29
+ execute<T extends ExecuteOptions>(subcommand: string[], opts?: T): Promise<ExecuteResult<T>>;
30
+ sendMemoryWarning: typeof processMixins.sendMemoryWarning;
31
+ sendSignalToProcess: typeof processMixins.sendSignalToProcess;
32
+ launchApp: typeof processMixins.launchApp;
33
+ listProcesses: typeof infoMixins.listProcesses;
34
+ listApps: typeof infoMixins.listApps;
35
+ listFiles: typeof copyMixins.listFiles;
36
+ pullFile: typeof copyMixins.pullFile;
37
+ listDevices: typeof listMixins.listDevices;
38
+ }
39
+ //# sourceMappingURL=devicectl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devicectl.d.ts","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAK5C;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,mCAAmC;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;gBACS,IAAI,EAAE,MAAM;IAIxB;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,SAAS,cAAc,EACpC,UAAU,EAAE,MAAM,EAAE,EACpB,IAAI,CAAC,EAAE,CAAC,GACP,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IA4C5B,iBAAiB,yCAAmC;IACpD,mBAAmB,2CAAqC;IACxD,SAAS,iCAA2B;IAEpC,aAAa,kCAA4B;IACzC,QAAQ,6BAAuB;IAE/B,SAAS,8BAAwB;IACjC,QAAQ,6BAAuB;IAE/B,WAAW,gCAA0B;CACtC"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Devicectl = void 0;
40
+ const teen_process_1 = require("teen_process");
41
+ const lodash_1 = __importDefault(require("lodash"));
42
+ const logger_1 = __importDefault(require("@appium/logger"));
43
+ const processMixins = __importStar(require("./mixins/process"));
44
+ const infoMixins = __importStar(require("./mixins/info"));
45
+ const copyMixins = __importStar(require("./mixins/copy"));
46
+ const listMixins = __importStar(require("./mixins/list"));
47
+ const XCRUN = 'xcrun';
48
+ const LOG_TAG = 'Devicectl';
49
+ /**
50
+ * Node.js wrapper around Apple's devicectl tool
51
+ *
52
+ * This class provides methods to interact with iOS devices using the devicectl command-line tool.
53
+ * It requires Xcode 15+ and iOS 17+ to function properly.
54
+ *
55
+ */
56
+ class Devicectl {
57
+ /** The unique device identifier */
58
+ udid;
59
+ /**
60
+ * Creates a new Devicectl instance
61
+ *
62
+ * @param udid - The unique device identifier
63
+ */
64
+ constructor(udid) {
65
+ this.udid = udid;
66
+ }
67
+ /**
68
+ * Executes a devicectl command
69
+ *
70
+ * @param subcommand - The devicectl subcommand to execute
71
+ * @param opts - Execution options
72
+ * @returns Promise that resolves to the command result
73
+ */
74
+ async execute(subcommand, opts) {
75
+ const { logStdout = false, asynchronous = false, asJson = true, noDevice = false, subcommandOptions, timeout, } = opts ?? {};
76
+ const finalArgs = ['devicectl', ...subcommand, ...(noDevice ? [] : ['--device', this.udid])];
77
+ if (subcommandOptions && !lodash_1.default.isEmpty(subcommandOptions)) {
78
+ finalArgs.push(...(Array.isArray(subcommandOptions) ? subcommandOptions : [subcommandOptions]));
79
+ }
80
+ if (asJson) {
81
+ finalArgs.push('--quiet', '--json-output', '-');
82
+ }
83
+ const cmdStr = [XCRUN, ...finalArgs].map((arg) => `"${arg}"`).join(' ');
84
+ logger_1.default.debug(LOG_TAG, `Executing ${cmdStr}`);
85
+ try {
86
+ if (asynchronous) {
87
+ const result = new teen_process_1.SubProcess(XCRUN, finalArgs);
88
+ await result.start(0);
89
+ return result;
90
+ }
91
+ const result = await (0, teen_process_1.exec)(XCRUN, finalArgs, ...(lodash_1.default.isNumber(timeout) ? [{ timeout }] : []));
92
+ if (logStdout) {
93
+ logger_1.default.debug(LOG_TAG, `Command output: ${result.stdout}`);
94
+ }
95
+ return result;
96
+ }
97
+ catch (e) {
98
+ throw new Error(`'${cmdStr}' failed. Original error: ${e.stderr || e.stdout || e.message}`);
99
+ }
100
+ }
101
+ sendMemoryWarning = processMixins.sendMemoryWarning;
102
+ sendSignalToProcess = processMixins.sendSignalToProcess;
103
+ launchApp = processMixins.launchApp;
104
+ listProcesses = infoMixins.listProcesses;
105
+ listApps = infoMixins.listApps;
106
+ listFiles = copyMixins.listFiles;
107
+ pullFile = copyMixins.pullFile;
108
+ listDevices = listMixins.listDevices;
109
+ }
110
+ exports.Devicectl = Devicectl;
111
+ //# sourceMappingURL=devicectl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devicectl.js","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAC9C,oDAAuB;AACvB,4DAAoC;AAEpC,gEAAkD;AAClD,0DAA4C;AAC5C,0DAA4C;AAC5C,0DAA4C;AAE5C,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,WAAW,CAAC;AAE5B;;;;;;GAMG;AACH,MAAa,SAAS;IACpB,mCAAmC;IACnB,IAAI,CAAS;IAE7B;;;;OAIG;IACH,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CACX,UAAoB,EACpB,IAAQ;QAER,MAAM,EACJ,SAAS,GAAG,KAAK,EACjB,YAAY,GAAG,KAAK,EACpB,MAAM,GAAG,IAAI,EACb,QAAQ,GAAG,KAAK,EAChB,iBAAiB,EACjB,OAAO,GACR,GAAG,IAAI,IAAI,EAAE,CAAC;QAEf,MAAM,SAAS,GAAG,CAAC,WAAW,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE7F,IAAI,iBAAiB,IAAI,CAAC,g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AAC,IAAI,MAAM,6BAA6B,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IAED,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC;IACpD,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC;IACxD,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;IAEpC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;IACzC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAE/B,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IACjC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAE/B,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;CACtC;AA9ED,8BA8EC"}
@@ -0,0 +1,3 @@
1
+ export { Devicectl } from './devicectl';
2
+ export type * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Devicectl = void 0;
4
+ var devicectl_1 = require("./devicectl");
5
+ Object.defineProperty(exports, "Devicectl", { enumerable: true, get: function () { return devicectl_1.Devicectl; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAA9B,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { ListFilesOptions, PullFileOptions } from '../types';
2
+ import type { Devicectl } from '../devicectl';
3
+ /**
4
+ * Lists files at a specified path on the device
5
+ */
6
+ export declare function listFiles(this: Devicectl, domainType: string, domainIdentifier: string, opts?: ListFilesOptions): Promise<string[]>;
7
+ /**
8
+ * Pulls a file from the specified path on the device to a local file system
9
+ */
10
+ export declare function pullFile(this: Devicectl, from: string, to: string, opts: PullFileOptions): Promise<string>;
11
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../lib/mixins/copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listFiles = listFiles;
4
+ exports.pullFile = pullFile;
5
+ /**
6
+ * Lists files at a specified path on the device
7
+ */
8
+ async function listFiles(domainType, domainIdentifier, opts = {}) {
9
+ const subcommandOptions = ['--domain-type', domainType, '--domain-identifier', domainIdentifier];
10
+ if (opts.username) {
11
+ subcommandOptions.push('--username', opts.username);
12
+ }
13
+ if (opts.subdirectory) {
14
+ subcommandOptions.push('--subdirectory', opts.subdirectory);
15
+ }
16
+ const { stdout } = await this.execute(['device', 'info', 'files'], {
17
+ subcommandOptions,
18
+ });
19
+ return JSON.parse(stdout).result.files.map(({ name }) => name);
20
+ }
21
+ /**
22
+ * Pulls a file from the specified path on the device to a local file system
23
+ */
24
+ async function pullFile(from, to, opts) {
25
+ const subcommandOptions = [
26
+ '--domain-type',
27
+ opts.domainType,
28
+ '--domain-identifier',
29
+ opts.domainIdentifier,
30
+ '--source',
31
+ from,
32
+ '--destination',
33
+ to,
34
+ ];
35
+ if (opts.username) {
36
+ subcommandOptions.push('--user', opts.username);
37
+ }
38
+ await this.execute(['device', 'copy', 'from'], {
39
+ subcommandOptions,
40
+ timeout: opts.timeout ?? 120000,
41
+ asJson: false,
42
+ });
43
+ return to;
44
+ }
45
+ //# sourceMappingURL=copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../lib/mixins/copy.ts"],"names":[],"mappings":";;AAMA,8BAqBC;AAKD,4BA4BC;AAzDD;;GAEG;AACI,KAAK,UAAU,SAAS,CAE7B,UAAkB,EAClB,gBAAwB,EACxB,OAAyB,EAAE;IAE3B,MAAM,iBAAiB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;IAEjG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,iBAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC/D,iBAAiB;KAClB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,QAAQ,CAE5B,IAAY,EACZ,EAAU,EACV,IAAqB;IAErB,MAAM,iBAAiB,GAAG;QACxB,eAAe;QACf,IAAI,CAAC,UAAU;QACf,qBAAqB;QACrB,IAAI,CAAC,gBAAgB;QACrB,UAAU;QACV,IAAI;QACJ,eAAe;QACf,EAAE;KACH,CAAC;IAEF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAC7C,iBAAiB;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { AppInfo, ProcessInfo } from '../types';
2
+ import type { Devicectl } from '../devicectl';
3
+ /**
4
+ * Retrieves the list of installed apps from the device
5
+ */
6
+ export declare function listApps(this: Devicectl, bundleId?: string): Promise<AppInfo[]>;
7
+ /**
8
+ * Lists running processes on the device
9
+ */
10
+ export declare function listProcesses(this: Devicectl): Promise<ProcessInfo[]>;
11
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../lib/mixins/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAYrF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAG3E"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listApps = listApps;
4
+ exports.listProcesses = listProcesses;
5
+ /**
6
+ * Retrieves the list of installed apps from the device
7
+ */
8
+ async function listApps(bundleId) {
9
+ const subcommandOptions = ['--include-all-apps'];
10
+ if (bundleId) {
11
+ subcommandOptions.push('--bundle-id', bundleId);
12
+ }
13
+ const { stdout } = await this.execute(['device', 'info', 'apps'], {
14
+ subcommandOptions,
15
+ });
16
+ return JSON.parse(stdout).result.apps;
17
+ }
18
+ /**
19
+ * Lists running processes on the device
20
+ */
21
+ async function listProcesses() {
22
+ const { stdout } = await this.execute(['device', 'info', 'processes']);
23
+ return JSON.parse(stdout).result.runningProcesses;
24
+ }
25
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../../lib/mixins/info.ts"],"names":[],"mappings":";;AAMA,4BAYC;AAKD,sCAGC;AAvBD;;GAEG;AACI,KAAK,UAAU,QAAQ,CAAkB,QAAiB;IAC/D,MAAM,iBAAiB,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAEjD,IAAI,QAAQ,EAAE,CAAC;QACb,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAC9D,iBAAiB;KAClB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AACxC,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa;IACjC,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;AACpD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { DeviceInfo } from '../types';
2
+ import type { Devicectl } from '../devicectl';
3
+ /**
4
+ * Retrieves the list of connected device infos.
5
+ * Might be empty if no devices are connected.
6
+ */
7
+ export declare function listDevices(this: Devicectl): Promise<DeviceInfo[]>;
8
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../lib/mixins/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAKxE"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listDevices = listDevices;
4
+ /**
5
+ * Retrieves the list of connected device infos.
6
+ * Might be empty if no devices are connected.
7
+ */
8
+ async function listDevices() {
9
+ const { stdout } = await this.execute(['list', 'devices'], {
10
+ noDevice: true,
11
+ });
12
+ return JSON.parse(stdout).result.devices;
13
+ }
14
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../lib/mixins/list.ts"],"names":[],"mappings":";;AAOA,kCAKC;AATD;;;GAGG;AACI,KAAK,UAAU,WAAW;IAC/B,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;QACvD,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { LaunchAppOptions } from '../types';
2
+ import type { Devicectl } from '../devicectl';
3
+ /**
4
+ * Simulates memory warning for the process with the given PID
5
+ */
6
+ export declare function sendMemoryWarning(this: Devicectl, pid: number | string): Promise<void>;
7
+ /**
8
+ * Send POSIX signal to the running process
9
+ */
10
+ export declare function sendSignalToProcess(this: Devicectl, pid: number | string, signal: number | string): Promise<void>;
11
+ /**
12
+ * Launch the given bundle id application with the given environment variable.
13
+ * This method is over devicectl command, this it may take additional seconds to launch the app.
14
+ * Please use via WDA or via appium-ios-device as primary method to launch app if possible.
15
+ */
16
+ export declare function launchApp(this: Devicectl, bundleId: string, opts?: LaunchAppOptions): Promise<void>;
17
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5F;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sendMemoryWarning = sendMemoryWarning;
7
+ exports.sendSignalToProcess = sendSignalToProcess;
8
+ exports.launchApp = launchApp;
9
+ const lodash_1 = __importDefault(require("lodash"));
10
+ /**
11
+ * Simulates memory warning for the process with the given PID
12
+ */
13
+ async function sendMemoryWarning(pid) {
14
+ await this.execute(['device', 'process', 'sendMemoryWarning'], {
15
+ subcommandOptions: ['--pid', `${pid}`],
16
+ });
17
+ }
18
+ /**
19
+ * Send POSIX signal to the running process
20
+ */
21
+ async function sendSignalToProcess(pid, signal) {
22
+ await this.execute(['device', 'process', 'signal'], {
23
+ subcommandOptions: ['--signal', `${signal}`, '--pid', `${pid}`],
24
+ });
25
+ }
26
+ /**
27
+ * Launch the given bundle id application with the given environment variable.
28
+ * This method is over devicectl command, this it may take additional seconds to launch the app.
29
+ * Please use via WDA or via appium-ios-device as primary method to launch app if possible.
30
+ */
31
+ async function launchApp(bundleId, opts = {}) {
32
+ const { env, terminateExisting = false } = opts;
33
+ const subcommandOptions = [];
34
+ if (terminateExisting) {
35
+ subcommandOptions.push('--terminate-existing');
36
+ }
37
+ if (!lodash_1.default.isEmpty(env)) {
38
+ subcommandOptions.push('--environment-variables', JSON.stringify(lodash_1.default.mapValues(env, (v) => lodash_1.default.toString(v))));
39
+ }
40
+ // The bundle id should be the last to apply arguments properly.
41
+ // devicectl command might not raise exception while the order is wrong.
42
+ subcommandOptions.push(bundleId);
43
+ await this.execute(['device', 'process', 'launch'], {
44
+ subcommandOptions,
45
+ asJson: false,
46
+ });
47
+ }
48
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":";;;;;AAOA,8CAIC;AAKD,kDAQC;AAOD,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