Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-simctl

Package Overview
Dependencies
Maintainers
8
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-simctl - npm Package Compare versions

Comparing version 7.3.3 to 7.3.4

9

build/lib/helpers.d.ts

@@ -1,4 +0,1 @@

export function getXcrunBinary(): string;
export const DEFAULT_EXEC_TIMEOUT: number;
export const SIM_RUNTIME_NAME: "com.apple.CoreSimulator.SimRuntime.";
/**

@@ -13,2 +10,8 @@ * "Normalize" the version, since iOS uses 'major.minor' but the runtimes can

export function normalizeVersion(version: string): string;
/**
* @returns {string}
*/
export function getXcrunBinary(): string;
export const DEFAULT_EXEC_TIMEOUT: number;
export const SIM_RUNTIME_NAME: "com.apple.CoreSimulator.SimRuntime.";
//# sourceMappingURL=helpers.d.ts.map

@@ -8,6 +8,4 @@ "use strict";

const semver_1 = __importDefault(require("semver"));
const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
exports.DEFAULT_EXEC_TIMEOUT = DEFAULT_EXEC_TIMEOUT;
const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
exports.SIM_RUNTIME_NAME = SIM_RUNTIME_NAME;
exports.DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
exports.SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
/**

@@ -29,4 +27,9 @@ * "Normalize" the version, since iOS uses 'major.minor' but the runtimes can

exports.normalizeVersion = normalizeVersion;
const getXcrunBinary = () => process.env.XCRUN_BINARY || 'xcrun';
/**
* @returns {string}
*/
function getXcrunBinary() {
return process.env.XCRUN_BINARY || 'xcrun';
}
exports.getXcrunBinary = getXcrunBinary;
//# sourceMappingURL=helpers.js.map
export default Simctl;
export type XCRun = {
/**
* Full path to the xcrun script
*/
path: string | null;
};
export type ExecOpts = {
/**
* [[]] - The list of additional subcommand arguments.
* - The list of additional subcommand arguments.
* It's empty by default.
*/
args: string[];
args?: string[] | undefined;
/**
* [{}] - Environment variables mapping. All these variables
* - Environment variables mapping. All these variables
* will be passed Simulator and used in the executing function.
*/
env: any;
env?: Record<string, any> | undefined;
/**
* [true] - Set it to _false_ to throw execution errors
* - Set it to _false_ to throw execution errors
* immediately without logging any additional information.
*/
logErrors: boolean;
logErrors?: boolean | undefined;
/**
* [false] - Whether to execute the given command
* - Whether to execute the given command
* 'synchronously' or 'asynchronously'. Affects the returned result of the function.
*/
asynchronous: boolean;
asynchronous?: boolean | undefined;
/**

@@ -27,3 +33,3 @@ * - Explicitly sets streams encoding for the executed

*/
encoding: string | null;
encoding?: string | undefined;
/**

@@ -33,3 +39,3 @@ * - One or more architecture names to be enforced while

*/
architectures: string | string[];
architectures?: string | string[] | undefined;
};

@@ -44,13 +50,13 @@ export type SimctlOpts = {

*/
xcrun: any | null;
xcrun?: XCRun | undefined;
/**
* [600000] - The maximum number of milliseconds
* - The maximum number of milliseconds
* to wait for single synchronous xcrun command.
*/
execTimeout: number;
execTimeout?: number | undefined;
/**
* [true] - Whether to wire xcrun error messages
* - Whether to wire xcrun error messages
* into debug log before throwing them.
*/
logErrors: boolean;
logErrors?: boolean | undefined;
/**

@@ -62,3 +68,3 @@ * - The unique identifier of the current device, which is

*/
udid: string | null;
udid?: string | null | undefined;
/**

@@ -68,17 +74,21 @@ * - Full path to the set of devices that you want to manage.

*/
devicesSetPath: string | null;
devicesSetPath?: string | null | undefined;
};
/**
* @typedef {Object} XCRun
* @property {string?} path Full path to the xcrun script
*/
/**
* @typedef {Object} ExecOpts
* @property {string[]} args [[]] - The list of additional subcommand arguments.
* @property {string[]} [args=[]] - The list of additional subcommand arguments.
* It's empty by default.
* @property {Object} env [{}] - Environment variables mapping. All these variables
* @property {Record<string, any>} [env={}] - Environment variables mapping. All these variables
* will be passed Simulator and used in the executing function.
* @property {boolean} logErrors [true] - Set it to _false_ to throw execution errors
* @property {boolean} [logErrors=true] - Set it to _false_ to throw execution errors
* immediately without logging any additional information.
* @property {boolean} asynchronous [false] - Whether to execute the given command
* @property {boolean} [asynchronous=false] - Whether to execute the given command
* 'synchronously' or 'asynchronously'. Affects the returned result of the function.
* @property {string?} encoding - Explicitly sets streams encoding for the executed
* @property {string} [encoding] - Explicitly sets streams encoding for the executed
* command input and outputs.
* @property {string|string[]} architectures - One or more architecture names to be enforced while
* @property {string|string[]} [architectures] - One or more architecture names to be enforced while
* executing xcrun. See https://github.com/appium/appium/issues/18966 for more details.

@@ -88,3 +98,3 @@ */

* @typedef {Object} SimctlOpts
* @property {Object?} xcrun - The xcrun properties. Currently only one property
* @property {XCRun} [xcrun] - The xcrun properties. Currently only one property
* is supported, which is `path` and it by default contains `null`, which enforces

@@ -94,11 +104,11 @@ * the instance to automatically detect the full path to `xcrun` tool and to throw

* then it is going to be used by `exec` and no autodetection will happen.
* @property {number} execTimeout [600000] - The maximum number of milliseconds
* @property {number} [execTimeout=600000] - The maximum number of milliseconds
* to wait for single synchronous xcrun command.
* @property {boolean} logErrors [true] - Whether to wire xcrun error messages
* @property {boolean} [logErrors=true] - Whether to wire xcrun error messages
* into debug log before throwing them.
* @property {string?} udid - The unique identifier of the current device, which is
* @property {string?} [udid] - The unique identifier of the current device, which is
* going to be implicitly passed to all methods, which require it. It can either be set
* upon instance creation if it is already known in advance or later when/if needed via the
* corresponding instance setter.
* @property {string?} devicesSetPath - Full path to the set of devices that you want to manage.
* @property {string?} [devicesSetPath] - Full path to the set of devices that you want to manage.
* By default this path usually equals to ~/Library/Developer/CoreSimulator/Devices

@@ -108,7 +118,7 @@ */

/**
* @param {Partial<SimctlOpts>} opts
* @param {SimctlOpts} [opts={}]
*/
constructor(opts?: Partial<SimctlOpts>);
/** @type {any?} */
xcrun: any | null;
constructor(opts?: SimctlOpts | undefined);
/** @type {XCRun} */
xcrun: XCRun;
/** @type {number} */

@@ -118,3 +128,5 @@ execTimeout: number;

logErrors: boolean;
/** @type {string?} */
_udid: string | null;
/** @type {string?} */
_devicesSetPath: string | null;

@@ -126,3 +138,3 @@ set udid(arg: string | null);

requireUdid(commandName?: null): string;
requireXcrun(): Promise<any>;
requireXcrun(): Promise<string>;
/**

@@ -132,11 +144,11 @@ * Execute the particular simctl command.

* @param {string} subcommand - One of available simctl subcommands.
* Execute `xcrun simctl` in Terminal to see the full list
* of available subcommands.
* @param {Partial<ExecOpts>} opts
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>} Either the result of teen process's `exec` or
* Execute `xcrun simctl` in Terminal to see the full list of available subcommands.
* @param {ExecOpts} [opts={}]
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>}
* Either the result of teen process's `exec` or
* `SubProcess` instance depending of `opts.asynchronous` value.
* @throws {Error} If the simctl subcommand command returns non-zero return code.
*/
exec(subcommand: string, opts?: Partial<ExecOpts>): Promise<import("teen_process").TeenProcessExecResult<any> | import('teen_process').SubProcess>;
exec(subcommand: string, opts?: ExecOpts | undefined): Promise<import("teen_process").TeenProcessExecResult<any> | import('teen_process').SubProcess>;
}
//# sourceMappingURL=simctl.d.ts.map

@@ -45,14 +45,18 @@ "use strict";

/**
* @typedef {Object} XCRun
* @property {string?} path Full path to the xcrun script
*/
/**
* @typedef {Object} ExecOpts
* @property {string[]} args [[]] - The list of additional subcommand arguments.
* @property {string[]} [args=[]] - The list of additional subcommand arguments.
* It's empty by default.
* @property {Object} env [{}] - Environment variables mapping. All these variables
* @property {Record<string, any>} [env={}] - Environment variables mapping. All these variables
* will be passed Simulator and used in the executing function.
* @property {boolean} logErrors [true] - Set it to _false_ to throw execution errors
* @property {boolean} [logErrors=true] - Set it to _false_ to throw execution errors
* immediately without logging any additional information.
* @property {boolean} asynchronous [false] - Whether to execute the given command
* @property {boolean} [asynchronous=false] - Whether to execute the given command
* 'synchronously' or 'asynchronously'. Affects the returned result of the function.
* @property {string?} encoding - Explicitly sets streams encoding for the executed
* @property {string} [encoding] - Explicitly sets streams encoding for the executed
* command input and outputs.
* @property {string|string[]} architectures - One or more architecture names to be enforced while
* @property {string|string[]} [architectures] - One or more architecture names to be enforced while
* executing xcrun. See https://github.com/appium/appium/issues/18966 for more details.

@@ -62,3 +66,3 @@ */

* @typedef {Object} SimctlOpts
* @property {Object?} xcrun - The xcrun properties. Currently only one property
* @property {XCRun} [xcrun] - The xcrun properties. Currently only one property
* is supported, which is `path` and it by default contains `null`, which enforces

@@ -68,11 +72,11 @@ * the instance to automatically detect the full path to `xcrun` tool and to throw

* then it is going to be used by `exec` and no autodetection will happen.
* @property {number} execTimeout [600000] - The maximum number of milliseconds
* @property {number} [execTimeout=600000] - The maximum number of milliseconds
* to wait for single synchronous xcrun command.
* @property {boolean} logErrors [true] - Whether to wire xcrun error messages
* @property {boolean} [logErrors=true] - Whether to wire xcrun error messages
* into debug log before throwing them.
* @property {string?} udid - The unique identifier of the current device, which is
* @property {string?} [udid] - The unique identifier of the current device, which is
* going to be implicitly passed to all methods, which require it. It can either be set
* upon instance creation if it is already known in advance or later when/if needed via the
* corresponding instance setter.
* @property {string?} devicesSetPath - Full path to the set of devices that you want to manage.
* @property {string?} [devicesSetPath] - Full path to the set of devices that you want to manage.
* By default this path usually equals to ~/Library/Developer/CoreSimulator/Devices

@@ -82,3 +86,3 @@ */

/**
* @param {Partial<SimctlOpts>} opts
* @param {SimctlOpts} [opts={}]
*/

@@ -91,3 +95,5 @@ constructor(opts = {}) {

}
/** @type {string?} */
this._udid = lodash_1.default.isNil(opts.udid) ? null : opts.udid;
/** @type {string?} */
this._devicesSetPath = lodash_1.default.isNil(opts.devicesSetPath) ? null : opts.devicesSetPath;

@@ -131,6 +137,6 @@ }

* @param {string} subcommand - One of available simctl subcommands.
* Execute `xcrun simctl` in Terminal to see the full list
* of available subcommands.
* @param {Partial<ExecOpts>} opts
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>} Either the result of teen process's `exec` or
* Execute `xcrun simctl` in Terminal to see the full list of available subcommands.
* @param {ExecOpts} [opts={}]
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>}
* Either the result of teen process's `exec` or
* `SubProcess` instance depending of `opts.asynchronous` value.

@@ -142,3 +148,4 @@ * @throws {Error} If the simctl subcommand command returns non-zero return code.

// run a particular simctl command
args = ['simctl',
args = [
'simctl',
...(this.devicesSetPath ? ['--set', this.devicesSetPath] : []),

@@ -161,3 +168,3 @@ subcommand,

let execArgs = [xcrun, args, execOpts];
if (!lodash_1.default.isEmpty(architectures)) {
if (architectures?.length) {
const archArgs = lodash_1.default.flatMap((lodash_1.default.isArray(architectures) ? architectures : [architectures]).map((arch) => ['-arch', arch]));

@@ -164,0 +171,0 @@ execArgs = ['arch', [...archArgs, xcrun, ...args], execOpts];

export default commands;
export type BootMonitorOptions = {
/**
* [240000] - Simulator booting timeout in ms.
* - Simulator booting timeout in ms.
*/
timeout: number;
timeout?: number | undefined;
/**
* - This event is fired when data migration stage starts.
*/
onWaitingDataMigration: Function | null;
onWaitingDataMigration?: Function | undefined;
/**
* - This event is fired when system app wait stage starts.
*/
onWaitingSystemApp: Function | null;
onWaitingSystemApp?: Function | undefined;
/**
* - This event is fired when Simulator is fully booted.
*/
onFinished: Function | null;
onFinished?: Function | undefined;
/**

@@ -23,8 +23,8 @@ * - This event is fired when there was an error while monitoring the booting process

*/
onError: Function | null;
onError?: Function | undefined;
/**
* [false] Whether to preboot the Simulator
* Whether to preboot the Simulator
* if this command is called and it is not already in booted or booting state.
*/
shouldPreboot: boolean;
shouldPreboot?: boolean | undefined;
};

@@ -34,9 +34,9 @@ declare namespace commands {

* @typedef {Object} BootMonitorOptions
* @property {number} timeout [240000] - Simulator booting timeout in ms.
* @property {Function?} onWaitingDataMigration - This event is fired when data migration stage starts.
* @property {Function?} onWaitingSystemApp - This event is fired when system app wait stage starts.
* @property {Function?} onFinished - This event is fired when Simulator is fully booted.
* @property {Function?} onError - This event is fired when there was an error while monitoring the booting process
* @property {number} [timeout=240000] - Simulator booting timeout in ms.
* @property {Function} [onWaitingDataMigration] - This event is fired when data migration stage starts.
* @property {Function} [onWaitingSystemApp] - This event is fired when system app wait stage starts.
* @property {Function} [onFinished] - This event is fired when Simulator is fully booted.
* @property {Function} [onError] - This event is fired when there was an error while monitoring the booting process
* or when the timeout has expired.
* @property {boolean} shouldPreboot [false] Whether to preboot the Simulator
* @property {boolean} [shouldPreboot=false] Whether to preboot the Simulator
* if this command is called and it is not already in booted or booting state.

@@ -50,3 +50,3 @@ */

*
* @param {Partial<BootMonitorOptions>} opts - Monitoring options.
* @param {BootMonitorOptions} [opts={}] - Monitoring options.
* @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process.

@@ -57,4 +57,4 @@ * @throws {Error} If the Simulator fails to finish booting within the given timeout and onFinished

*/
function startBootMonitor(opts?: Partial<BootMonitorOptions>): Promise<import("teen_process").SubProcess>;
function startBootMonitor(opts?: BootMonitorOptions | undefined): Promise<import("teen_process").SubProcess>;
}
//# sourceMappingURL=bootstatus.d.ts.map

@@ -11,9 +11,9 @@ "use strict";

* @typedef {Object} BootMonitorOptions
* @property {number} timeout [240000] - Simulator booting timeout in ms.
* @property {Function?} onWaitingDataMigration - This event is fired when data migration stage starts.
* @property {Function?} onWaitingSystemApp - This event is fired when system app wait stage starts.
* @property {Function?} onFinished - This event is fired when Simulator is fully booted.
* @property {Function?} onError - This event is fired when there was an error while monitoring the booting process
* @property {number} [timeout=240000] - Simulator booting timeout in ms.
* @property {Function} [onWaitingDataMigration] - This event is fired when data migration stage starts.
* @property {Function} [onWaitingSystemApp] - This event is fired when system app wait stage starts.
* @property {Function} [onFinished] - This event is fired when Simulator is fully booted.
* @property {Function} [onError] - This event is fired when there was an error while monitoring the booting process
* or when the timeout has expired.
* @property {boolean} shouldPreboot [false] Whether to preboot the Simulator
* @property {boolean} [shouldPreboot=false] Whether to preboot the Simulator
* if this command is called and it is not already in booted or booting state.

@@ -27,3 +27,3 @@ */

*
* @param {Partial<BootMonitorOptions>} opts - Monitoring options.
* @param {BootMonitorOptions} [opts={}] - Monitoring options.
* @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process.

@@ -30,0 +30,0 @@ * @throws {Error} If the Simulator fails to finish booting within the given timeout and onFinished

export default commands;
export type SimCreationOpts = {
/**
* [iOS] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
*/
platform: string;
platform?: string | undefined;
/**
* [10000] - The maximum number of milliseconds to wait
* unit device creation is completed.
* - The maximum number of milliseconds to wait
* unit device creation is completed.
*/
timeout: number;
timeout?: number | undefined;
};

@@ -16,4 +16,4 @@ declare namespace commands {

* @typedef {Object} SimCreationOpts
* @property {string} platform [iOS] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} timeout [10000] - The maximum number of milliseconds to wait
* @property {string} [platform='iOS'] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device creation is completed.

@@ -28,3 +28,3 @@ */

* @param {string} platformVersion - Platform version, for example '10.3'.
* @param {Partial<SimCreationOpts>} opts - Simulator options for creating devices.
* @param {SimCreationOpts} [opts={}] - Simulator options for creating devices.
* @return {Promise<string>} The UDID of the newly created device.

@@ -34,4 +34,4 @@ * @throws {Error} If the corresponding simctl subcommand command

*/
function createDevice(name: string, deviceTypeId: string, platformVersion: string, opts?: Partial<SimCreationOpts>): Promise<string>;
function createDevice(name: string, deviceTypeId: string, platformVersion: string, opts?: SimCreationOpts | undefined): Promise<string>;
}
//# sourceMappingURL=create.d.ts.map

@@ -38,4 +38,4 @@ "use strict";

* @typedef {Object} SimCreationOpts
* @property {string} platform [iOS] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} timeout [10000] - The maximum number of milliseconds to wait
* @property {string} [platform='iOS'] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device creation is completed.

@@ -50,3 +50,3 @@ */

* @param {string} platformVersion - Platform version, for example '10.3'.
* @param {Partial<SimCreationOpts>} opts - Simulator options for creating devices.
* @param {SimCreationOpts} [opts={}] - Simulator options for creating devices.
* @return {Promise<string>} The UDID of the newly created device.

@@ -53,0 +53,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -7,3 +7,3 @@ export default commands;

*
* @param {number} timeout [10000] - The maximum number of milliseconds to wait
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device reset is completed.

@@ -14,4 +14,4 @@ * @throws {Error} If the corresponding simctl subcommand command

*/
function eraseDevice(timeout?: number): Promise<void>;
function eraseDevice(timeout?: number | undefined): Promise<void>;
}
//# sourceMappingURL=erase.d.ts.map

@@ -9,3 +9,3 @@ "use strict";

*
* @param {number} timeout [10000] - The maximum number of milliseconds to wait
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device reset is completed.

@@ -12,0 +12,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -11,3 +11,3 @@ export default commands;

* @param {string} bundleId - Bundle identifier of an application.
* @param {string?} containerType - Which container type to return. Possible values
* @param {string?} [containerType=null] - Which container type to return. Possible values
* are 'app', 'data', 'groups', '<A specific App Group container>'.

@@ -21,4 +21,4 @@ * The default value is 'app'.

*/
function getAppContainer(bundleId: string, containerType?: string | null): Promise<string>;
function getAppContainer(bundleId: string, containerType?: string | null | undefined): Promise<string>;
}
//# sourceMappingURL=get_app_container.d.ts.map

@@ -12,3 +12,3 @@ "use strict";

* @param {string} bundleId - Bundle identifier of an application.
* @param {string?} containerType - Which container type to return. Possible values
* @param {string?} [containerType=null] - Which container type to return. Possible values
* are 'app', 'data', 'groups', '<A specific App Group container>'.

@@ -15,0 +15,0 @@ * The default value is 'app'.

export default commands;
export type CertOptions = {
/**
* [false] - whether the `cert` argument
* - whether the `cert` argument
* is the path to the certificate on the local file system or
* a raw certificate content
*/
raw: boolean;
raw?: boolean | undefined;
};

@@ -13,3 +13,3 @@ declare namespace commands {

* @typedef {Object} CertOptions
* @property {boolean} raw [false] - whether the `cert` argument
* @property {boolean} [raw=false] - whether the `cert` argument
* is the path to the certificate on the local file system or

@@ -25,3 +25,3 @@ * a raw certificate content

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -31,3 +31,3 @@ * or there was an error while adding the certificate

*/
function addRootCertificate(cert: string, opts?: Partial<CertOptions>): Promise<void>;
function addRootCertificate(cert: string, opts?: CertOptions | undefined): Promise<void>;
/**

@@ -40,3 +40,3 @@ * Adds the given certificate to the Keychain Store on the simulator

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -46,3 +46,3 @@ * or there was an error while adding the certificate

*/
function addCertificate(cert: string, opts?: Partial<CertOptions>): Promise<void>;
function addCertificate(cert: string, opts?: CertOptions | undefined): Promise<void>;
/**

@@ -49,0 +49,0 @@ * Resets the simulator keychain

@@ -30,3 +30,3 @@ "use strict";

* @typedef {Object} CertOptions
* @property {boolean} raw [false] - whether the `cert` argument
* @property {boolean} [raw=false] - whether the `cert` argument
* is the path to the certificate on the local file system or

@@ -42,3 +42,3 @@ * a raw certificate content

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -67,3 +67,3 @@ * or there was an error while adding the certificate

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -70,0 +70,0 @@ * or there was an error while adding the certificate

@@ -10,3 +10,3 @@ export default commands;

* which is going to be removed.
* @param {number} tries [5] - The maximum number of retries before
* @param {number} [tries=5] - The maximum number of retries before
* throwing an exception.

@@ -18,4 +18,4 @@ * @return {Promise<string>} the actual command output

*/
function launchApp(bundleId: string, tries?: number): Promise<string>;
function launchApp(bundleId: string, tries?: number | undefined): Promise<string>;
}
//# sourceMappingURL=launch.d.ts.map

@@ -16,3 +16,3 @@ "use strict";

* which is going to be removed.
* @param {number} tries [5] - The maximum number of retries before
* @param {number} [tries=5] - The maximum number of retries before
* throwing an exception.

@@ -19,0 +19,0 @@ * @return {Promise<string>} the actual command output

@@ -32,3 +32,3 @@ export default commands;

*
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,

@@ -40,3 +40,3 @@ * for example '10.3' and the corresponding value is an

*/
function getDevicesByParsing(platform: string | null): Promise<Record<string, any>>;
function getDevicesByParsing(platform?: string | null | undefined): Promise<Record<string, any>>;
/**

@@ -46,6 +46,6 @@ * Parse the list of existing Simulator devices to represent

*
* @param {string?} forSdk - The sdk version,
* @param {string?} [forSdk] - The sdk version,
* for which the devices list should be parsed,
* for example '10.3'.
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Object|DeviceInfo[]>} If _forSdk_ is set then the list

@@ -59,3 +59,3 @@ * of devices for the particular platform version.

*/
function getDevices(forSdk: string | null, platform: string | null): Promise<any>;
function getDevices(forSdk?: string | null | undefined, platform?: string | null | undefined): Promise<any>;
/**

@@ -66,7 +66,7 @@ * Get the runtime for the particular platform version using --json flag

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given
* platform version.
*/
function getRuntimeForPlatformVersionViaJson(platformVersion: string, platform?: string): Promise<string>;
function getRuntimeForPlatformVersionViaJson(platformVersion: string, platform?: string | undefined): Promise<string>;
/**

@@ -77,7 +77,7 @@ * Get the runtime for the particular platform version.

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given
* platform version.
*/
function getRuntimeForPlatformVersion(platformVersion: string, platform?: string): Promise<string>;
function getRuntimeForPlatformVersion(platformVersion: string, platform?: string | undefined): Promise<string>;
/**

@@ -84,0 +84,0 @@ * Get the list of device types available in the current Xcode installation

@@ -44,3 +44,3 @@ "use strict";

*
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,

@@ -115,6 +115,6 @@ * for example '10.3' and the corresponding value is an

*
* @param {string?} forSdk - The sdk version,
* @param {string?} [forSdk] - The sdk version,
* for which the devices list should be parsed,
* for example '10.3'.
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Object|DeviceInfo[]>} If _forSdk_ is set then the list

@@ -198,3 +198,3 @@ * of devices for the particular platform version.

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given

@@ -220,3 +220,3 @@ * platform version.

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given

@@ -223,0 +223,0 @@ * platform version.

@@ -9,3 +9,3 @@ export default commands;

* @param {string} content - The actual string content to be set.
* @param {string} encoding [utf8] - The encoding of the given pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content.
* UTF-8 by default.

@@ -16,4 +16,4 @@ * @throws {Error} If the corresponding simctl subcommand command

*/
function setPasteboard(content: string, encoding?: string): Promise<void>;
function setPasteboard(content: string, encoding?: string | undefined): Promise<void>;
}
//# sourceMappingURL=pbcopy.d.ts.map

@@ -10,3 +10,3 @@ "use strict";

* @param {string} content - The actual string content to be set.
* @param {string} encoding [utf8] - The encoding of the given pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content.
* UTF-8 by default.

@@ -13,0 +13,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -8,3 +8,3 @@ export default commands;

* @since Xcode 8.1 SDK
* @param {string} encoding ['utf-8'] - The encoding of the returned pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content.
* UTF-8 by default.

@@ -16,4 +16,4 @@ * @return {Promise<string>} Current content of Simulator pasteboard or an empty string.

*/
function getPasteboard(encoding?: string): Promise<string>;
function getPasteboard(encoding?: string | undefined): Promise<string>;
}
//# sourceMappingURL=pbpaste.d.ts.map

@@ -9,3 +9,3 @@ "use strict";

* @since Xcode 8.1 SDK
* @param {string} encoding ['utf-8'] - The encoding of the returned pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content.
* UTF-8 by default.

@@ -12,0 +12,0 @@ * @return {Promise<string>} Current content of Simulator pasteboard or an empty string.

@@ -8,3 +8,3 @@ export default commands;

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.

@@ -21,3 +21,3 @@ * @throws {Error} If the corresponding simctl subcommand command

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.

@@ -24,0 +24,0 @@ * @throws {Error} If the `udid` instance property is unset

@@ -13,3 +13,3 @@ "use strict";

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.

@@ -34,3 +34,3 @@ * @throws {Error} If the corresponding simctl subcommand command

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.

@@ -37,0 +37,0 @@ * @throws {Error} If the `udid` instance property is unset

@@ -0,1 +1,8 @@

## [7.3.4](https://github.com/appium/node-simctl/compare/v7.3.3...v7.3.4) (2023-09-01)
### Miscellaneous Chores
* Improve type declarations ([#198](https://github.com/appium/node-simctl/issues/198)) ([314df12](https://github.com/appium/node-simctl/commit/314df12dfa9f2e7afa06d67f211b3dffe84755dc))
## [7.3.3](https://github.com/appium/node-simctl/compare/v7.3.2...v7.3.3) (2023-08-31)

@@ -2,0 +9,0 @@

import semver from 'semver';
const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
export const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
export const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';

@@ -14,3 +14,3 @@ /**

*/
function normalizeVersion (version) {
export function normalizeVersion (version) {
const semverVersion = semver.coerce(version);

@@ -23,7 +23,7 @@ if (!semverVersion) {

export {
DEFAULT_EXEC_TIMEOUT, SIM_RUNTIME_NAME,
normalizeVersion,
};
export const getXcrunBinary = () => process.env.XCRUN_BINARY || 'xcrun';
/**
* @returns {string}
*/
export function getXcrunBinary () {
return process.env.XCRUN_BINARY || 'xcrun';
}

@@ -20,14 +20,19 @@ import _ from 'lodash';

/**
* @typedef {Object} XCRun
* @property {string?} path Full path to the xcrun script
*/
/**
* @typedef {Object} ExecOpts
* @property {string[]} args [[]] - The list of additional subcommand arguments.
* @property {string[]} [args=[]] - The list of additional subcommand arguments.
* It's empty by default.
* @property {Object} env [{}] - Environment variables mapping. All these variables
* @property {Record<string, any>} [env={}] - Environment variables mapping. All these variables
* will be passed Simulator and used in the executing function.
* @property {boolean} logErrors [true] - Set it to _false_ to throw execution errors
* @property {boolean} [logErrors=true] - Set it to _false_ to throw execution errors
* immediately without logging any additional information.
* @property {boolean} asynchronous [false] - Whether to execute the given command
* @property {boolean} [asynchronous=false] - Whether to execute the given command
* 'synchronously' or 'asynchronously'. Affects the returned result of the function.
* @property {string?} encoding - Explicitly sets streams encoding for the executed
* @property {string} [encoding] - Explicitly sets streams encoding for the executed
* command input and outputs.
* @property {string|string[]} architectures - One or more architecture names to be enforced while
* @property {string|string[]} [architectures] - One or more architecture names to be enforced while
* executing xcrun. See https://github.com/appium/appium/issues/18966 for more details.

@@ -39,3 +44,3 @@ */

* @typedef {Object} SimctlOpts
* @property {Object?} xcrun - The xcrun properties. Currently only one property
* @property {XCRun} [xcrun] - The xcrun properties. Currently only one property
* is supported, which is `path` and it by default contains `null`, which enforces

@@ -45,11 +50,11 @@ * the instance to automatically detect the full path to `xcrun` tool and to throw

* then it is going to be used by `exec` and no autodetection will happen.
* @property {number} execTimeout [600000] - The maximum number of milliseconds
* @property {number} [execTimeout=600000] - The maximum number of milliseconds
* to wait for single synchronous xcrun command.
* @property {boolean} logErrors [true] - Whether to wire xcrun error messages
* @property {boolean} [logErrors=true] - Whether to wire xcrun error messages
* into debug log before throwing them.
* @property {string?} udid - The unique identifier of the current device, which is
* @property {string?} [udid] - The unique identifier of the current device, which is
* going to be implicitly passed to all methods, which require it. It can either be set
* upon instance creation if it is already known in advance or later when/if needed via the
* corresponding instance setter.
* @property {string?} devicesSetPath - Full path to the set of devices that you want to manage.
* @property {string?} [devicesSetPath] - Full path to the set of devices that you want to manage.
* By default this path usually equals to ~/Library/Developer/CoreSimulator/Devices

@@ -60,3 +65,3 @@ */

class Simctl {
/** @type {any?} */
/** @type {XCRun} */
xcrun;

@@ -71,3 +76,3 @@

/**
* @param {Partial<SimctlOpts>} opts
* @param {SimctlOpts} [opts={}]
*/

@@ -80,3 +85,5 @@ constructor (opts = {}) {

}
/** @type {string?} */
this._udid = _.isNil(opts.udid) ? null : opts.udid;
/** @type {string?} */
this._devicesSetPath = _.isNil(opts.devicesSetPath) ? null : opts.devicesSetPath;

@@ -127,6 +134,6 @@ }

* @param {string} subcommand - One of available simctl subcommands.
* Execute `xcrun simctl` in Terminal to see the full list
* of available subcommands.
* @param {Partial<ExecOpts>} opts
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>} Either the result of teen process's `exec` or
* Execute `xcrun simctl` in Terminal to see the full list of available subcommands.
* @param {ExecOpts} [opts={}]
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>}
* Either the result of teen process's `exec` or
* `SubProcess` instance depending of `opts.asynchronous` value.

@@ -145,3 +152,4 @@ * @throws {Error} If the simctl subcommand command returns non-zero return code.

// run a particular simctl command
args = ['simctl',
args = [
'simctl',
...(this.devicesSetPath ? ['--set', this.devicesSetPath] : []),

@@ -156,3 +164,4 @@ subcommand,

(value, key) => _.startsWith(key, SIMCTL_ENV_PREFIX) ? key : `${SIMCTL_ENV_PREFIX}${key}`),
process.env);
process.env
);

@@ -169,3 +178,3 @@ const execOpts = {

let execArgs = [xcrun, args, execOpts];
if (!_.isEmpty(architectures)) {
if (architectures?.length) {
const archArgs = _.flatMap(

@@ -172,0 +181,0 @@ (_.isArray(architectures) ? architectures : [architectures]).map((arch) => ['-arch', arch])

@@ -9,9 +9,9 @@ import log from '../logger';

* @typedef {Object} BootMonitorOptions
* @property {number} timeout [240000] - Simulator booting timeout in ms.
* @property {Function?} onWaitingDataMigration - This event is fired when data migration stage starts.
* @property {Function?} onWaitingSystemApp - This event is fired when system app wait stage starts.
* @property {Function?} onFinished - This event is fired when Simulator is fully booted.
* @property {Function?} onError - This event is fired when there was an error while monitoring the booting process
* @property {number} [timeout=240000] - Simulator booting timeout in ms.
* @property {Function} [onWaitingDataMigration] - This event is fired when data migration stage starts.
* @property {Function} [onWaitingSystemApp] - This event is fired when system app wait stage starts.
* @property {Function} [onFinished] - This event is fired when Simulator is fully booted.
* @property {Function} [onError] - This event is fired when there was an error while monitoring the booting process
* or when the timeout has expired.
* @property {boolean} shouldPreboot [false] Whether to preboot the Simulator
* @property {boolean} [shouldPreboot=false] Whether to preboot the Simulator
* if this command is called and it is not already in booted or booting state.

@@ -26,3 +26,3 @@ */

*
* @param {Partial<BootMonitorOptions>} opts - Monitoring options.
* @param {BootMonitorOptions} [opts={}] - Monitoring options.
* @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process.

@@ -29,0 +29,0 @@ * @throws {Error} If the Simulator fails to finish booting within the given timeout and onFinished

@@ -14,4 +14,4 @@ import _ from 'lodash';

* @typedef {Object} SimCreationOpts
* @property {string} platform [iOS] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} timeout [10000] - The maximum number of milliseconds to wait
* @property {string} [platform='iOS'] - Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
* @property {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device creation is completed.

@@ -27,3 +27,3 @@ */

* @param {string} platformVersion - Platform version, for example '10.3'.
* @param {Partial<SimCreationOpts>} opts - Simulator options for creating devices.
* @param {SimCreationOpts} [opts={}] - Simulator options for creating devices.
* @return {Promise<string>} The UDID of the newly created device.

@@ -30,0 +30,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -9,3 +9,3 @@ import { retryInterval } from 'asyncbox';

*
* @param {number} timeout [10000] - The maximum number of milliseconds to wait
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait
* unit device reset is completed.

@@ -12,0 +12,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -11,3 +11,3 @@ const commands = {};

* @param {string} bundleId - Bundle identifier of an application.
* @param {string?} containerType - Which container type to return. Possible values
* @param {string?} [containerType=null] - Which container type to return. Possible values
* are 'app', 'data', 'groups', '<A specific App Group container>'.

@@ -14,0 +14,0 @@ * The default value is 'app'.

@@ -27,3 +27,3 @@ import os from 'os';

* @typedef {Object} CertOptions
* @property {boolean} raw [false] - whether the `cert` argument
* @property {boolean} [raw=false] - whether the `cert` argument
* is the path to the certificate on the local file system or

@@ -40,3 +40,3 @@ * a raw certificate content

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -67,3 +67,3 @@ * or there was an error while adding the certificate

* options
* @param {Partial<CertOptions>} opts
* @param {CertOptions} [opts={}]
* @throws {Error} if the current SDK version does not support the command

@@ -70,0 +70,0 @@ * or there was an error while adding the certificate

@@ -13,3 +13,3 @@ import _ from 'lodash';

* which is going to be removed.
* @param {number} tries [5] - The maximum number of retries before
* @param {number} [tries=5] - The maximum number of retries before
* throwing an exception.

@@ -16,0 +16,0 @@ * @return {Promise<string>} the actual command output

@@ -20,3 +20,3 @@ import _ from 'lodash';

*
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,

@@ -94,6 +94,6 @@ * for example '10.3' and the corresponding value is an

*
* @param {string?} forSdk - The sdk version,
* @param {string?} [forSdk] - The sdk version,
* for which the devices list should be parsed,
* for example '10.3'.
* @param {string?} platform - The platform name, for example 'watchOS'.
* @param {string?} [platform] - The platform name, for example 'watchOS'.
* @return {Promise<Object|DeviceInfo[]>} If _forSdk_ is set then the list

@@ -181,3 +181,3 @@ * of devices for the particular platform version.

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given

@@ -205,3 +205,3 @@ * platform version.

* for example '10.3'.
* @param {string} platform - The platform name, for example 'watchOS'.
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
* @return {Promise<string>} The corresponding runtime name for the given

@@ -208,0 +208,0 @@ * platform version.

@@ -9,3 +9,3 @@ const commands = {};

* @param {string} content - The actual string content to be set.
* @param {string} encoding [utf8] - The encoding of the given pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content.
* UTF-8 by default.

@@ -12,0 +12,0 @@ * @throws {Error} If the corresponding simctl subcommand command

@@ -8,3 +8,3 @@ const commands = {};

* @since Xcode 8.1 SDK
* @param {string} encoding ['utf-8'] - The encoding of the returned pasteboard content.
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content.
* UTF-8 by default.

@@ -11,0 +11,0 @@ * @return {Promise<string>} Current content of Simulator pasteboard or an empty string.

@@ -11,3 +11,3 @@ import _ from 'lodash';

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.

@@ -34,3 +34,3 @@ * @throws {Error} If the corresponding simctl subcommand command

* @param {string|string[]} args - Spawn arguments
* @param {object} env [{}] - Additional environment variables mapping.
* @param {object} [env={}] - Additional environment variables mapping.
* @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.

@@ -37,0 +37,0 @@ * @throws {Error} If the `udid` instance property is unset

@@ -9,3 +9,3 @@ {

],
"version": "7.3.3",
"version": "7.3.4",
"author": "Appium Contributors",

@@ -12,0 +12,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc