UNPKG

4.78 kBTypeScriptView Raw
1import { SpawnOptions, SpawnResult } from '@expo/spawn-async';
2declare type DeviceState = 'Shutdown' | 'Booted';
3export declare type SimulatorDevice = {
4 availabilityError: 'runtime profile not found';
5 /**
6 * '/Users/name/Library/Developer/CoreSimulator/Devices/00E55DC0-0364-49DF-9EC6-77BE587137D4/data'
7 */
8 dataPath: string;
9 /**
10 * '/Users/name/Library/Logs/CoreSimulator/00E55DC0-0364-49DF-9EC6-77BE587137D4'
11 */
12 logPath: string;
13 /**
14 * '00E55DC0-0364-49DF-9EC6-77BE587137D4'
15 */
16 udid: string;
17 /**
18 * com.apple.CoreSimulator.SimRuntime.tvOS-13-4
19 */
20 runtime: string;
21 isAvailable: boolean;
22 /**
23 * 'com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p'
24 */
25 deviceTypeIdentifier: string;
26 state: DeviceState;
27 /**
28 * 'Apple TV'
29 */
30 name: string;
31 osType: OSType;
32 /**
33 * '13.4'
34 */
35 osVersion: string;
36 /**
37 * 'iPhone 11 (13.6)'
38 */
39 windowName: string;
40};
41export declare type XCTraceDevice = {
42 /**
43 * '00E55DC0-0364-49DF-9EC6-77BE587137D4'
44 */
45 udid: string;
46 /**
47 * 'Apple TV'
48 */
49 name: string;
50 deviceType: 'device' | 'catalyst';
51 /**
52 * '13.4'
53 */
54 osVersion: string;
55};
56declare type OSType = 'iOS' | 'tvOS' | 'watchOS' | 'macOS';
57declare type PermissionName = 'all' | 'calendar' | 'contacts-limited' | 'contacts' | 'location' | 'location-always' | 'photos-add' | 'photos' | 'media-library' | 'microphone' | 'motion' | 'reminders' | 'siri';
58declare type SimulatorDeviceList = {
59 devices: {
60 [runtime: string]: SimulatorDevice[];
61 };
62};
63export declare function getDefaultSimulatorDeviceUDIDAsync(): Promise<string | null>;
64/**
65 * Returns the local path for the installed tar.app. Returns null when the app isn't installed.
66 *
67 * @param props.udid device udid.
68 * @param props.bundleIdentifier bundle identifier for app
69 * @returns local file path to installed app binary, e.g. '/Users/evanbacon/Library/Developer/CoreSimulator/Devices/EFEEA6EF-E3F5-4EDE-9B72-29EAFA7514AE/data/Containers/Bundle/Application/FA43A0C6-C2AD-442D-B8B1-EAF3E88CF3BF/Exponent-2.21.3.tar.app'
70 */
71export declare function getContainerPathAsync({ udid, bundleIdentifier, }: {
72 udid: string;
73 bundleIdentifier: string;
74}): Promise<string | null>;
75export declare function waitForDeviceToBootAsync({ udid, }: Pick<SimulatorDevice, 'udid'>): Promise<SimulatorDevice | null>;
76export declare function openURLAsync(options: {
77 udid?: string;
78 url: string;
79}): Promise<void>;
80export declare function openBundleIdAsync(options: {
81 udid?: string;
82 bundleIdentifier: string;
83}): Promise<SpawnResult>;
84export declare function bootAsync({ udid }: {
85 udid: string;
86}): Promise<SimulatorDevice | null>;
87export declare function runBootAsync({ udid }: {
88 udid: string;
89}): Promise<void>;
90export declare function installAsync(options: {
91 udid: string;
92 dir: string;
93}): Promise<any>;
94export declare function uninstallAsync(options: {
95 udid?: string;
96 bundleIdentifier: string;
97}): Promise<any>;
98export declare function listAsync(type: 'devices' | 'devicetypes' | 'runtimes' | 'pairs', query?: string | 'available'): Promise<SimulatorDeviceList>;
99export declare function listSimulatorDevicesAsync(): Promise<SimulatorDevice[]>;
100/**
101 * Get a list of all connected devices.
102 */
103export declare function listDevicesAsync(): Promise<XCTraceDevice[]>;
104export declare function shutdownAsync(udid?: string): Promise<SpawnResult | null>;
105export declare function updatePermissionsAsync(udid: string, action: 'grant' | 'revoke' | 'reset', permission: PermissionName, bundleIdentifier?: string): Promise<SpawnResult>;
106export declare function setAppearanceAsync(udid: string, theme: 'light' | 'dark'): Promise<SpawnResult>;
107export declare function eraseAsync(udid: string): Promise<SpawnResult>;
108export declare function eraseAllAsync(): Promise<SpawnResult>;
109export declare function addMediaAsync(udid: string, mediaPath: string): Promise<SpawnResult>;
110export declare function captureScreenAsync(udid: string, captureType: 'screenshot' | 'recordVideo', outputFilePath: string): Promise<SpawnResult>;
111export declare function deleteUnavailableAsync(): Promise<SpawnResult>;
112export declare function simctlAsync([command, ...args]: (string | undefined)[], options?: SpawnOptions): Promise<SpawnResult>;
113export declare function isLicenseOutOfDate(text: string): boolean;
114export declare function isXcrunInstalledAsync(): Promise<boolean>;
115export declare function xcrunAsync(args: string[], options?: SpawnOptions): Promise<SpawnResult>;
116export declare function parseXcrunError(e: any): Error;
117export declare function xcrunWithLogging(args: string[], options?: SpawnOptions): Promise<SpawnResult>;
118export {};