@arkts/image-manager 0.4.3 → 0.5.1

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/index.d.cts CHANGED
@@ -1,685 +1,1261 @@
1
- import { a as ParentEmulatorSnakecaseDeviceType, c as SnakecaseDeviceType, d as isPhoneAllSnakecaseDeviceType, i as PCAllSnakecaseDeviceType, l as Stringifiable, n as DeviceType, o as PascalCaseDeviceType, r as OS, s as PhoneAllSnakecaseDeviceType, t as Arch, u as isPCAllSnakecaseDeviceType } from "./types-CayFonNb.cjs";
2
- import { a as GroupPhoneAllEmulatorConfigItem, c as PhoneAllEmulatorConfigItem, i as GroupPCAllEmulatorConfigItem, n as EmulatorConfig, o as PCAllEmulatorConfigItem, r as EmulatorConfigItem, s as ParentEmulatorConfigItem, t as BaseEmulatorConfigItem } from "./emulator-config-HeXlMqZ-.cjs";
3
- import { n as ProductConfigItem, t as ProductConfig } from "./product-config-DuzOJEvZ.cjs";
4
- import { AxiosProgressEvent } from "axios";
5
- import { Emitter } from "mitt";
6
- import * as node_child_process0 from "node:child_process";
7
- import progress from "progress-stream";
1
+ import * as vscode_uri0 from "vscode-uri";
8
2
  import * as node_os0 from "node:os";
9
- import * as node_fs0 from "node:fs";
10
- import * as node_path0 from "node:path";
3
+ import * as node_stream0 from "node:stream";
4
+ import { Readable } from "node:stream";
11
5
  import * as node_process0 from "node:process";
12
6
  import * as node_crypto0 from "node:crypto";
7
+ import * as node_child_process0 from "node:child_process";
8
+ import child_process from "node:child_process";
9
+ import * as axios from "axios";
10
+ import * as unzipper from "unzipper";
11
+ import { Disposable, FileSystem, FileSystemWatcher } from "vscode-fs";
13
12
 
14
13
  //#region package.json.d.ts
15
14
  declare let version: string;
16
15
  //#endregion
17
- //#region src/images/local-image.d.ts
18
- interface LocalImage extends BaseImage, Stringifiable<LocalImage.Stringifiable> {
19
- imageType: 'local';
20
- getDevices(): Promise<Device[]>;
21
- createDevice(options: Device.Options): Device;
22
- delete(): Promise<void | Error>;
23
- start(device: Device): Promise<node_child_process0.ChildProcess>;
24
- stop(device: Device): Promise<node_child_process0.ChildProcess>;
25
- buildStartCommand(device: Device): Promise<string>;
26
- buildStopCommand(device: Device): Promise<string>;
27
- getPascalCaseDeviceType(): Promise<PascalCaseDeviceType | undefined>;
28
- getProductConfig(): Promise<ProductConfigItem[]>;
29
- }
30
- declare namespace LocalImage {
31
- interface Stringifiable extends Omit<BaseImage.Stringifiable, 'imageType'> {
32
- imageType: 'local';
33
- executablePath: string;
34
- }
35
- }
36
- //#endregion
37
- //#region src/images/remote-image.d.ts
38
- interface RemoteImage extends BaseImage, Stringifiable<RemoteImage.Stringifiable> {
39
- imageType: 'remote';
40
- }
41
- declare namespace RemoteImage {
42
- interface Stringifiable extends Omit<BaseImage.Stringifiable, 'imageType'> {
43
- imageType: 'remote';
44
- }
45
- }
46
- //#endregion
47
- //#region src/image-downloader.d.ts
48
- interface ImageDownloadProgressEvent extends AxiosProgressEvent {
49
- /**
50
- * The network speed of the download.
51
- */
52
- network: number;
53
- /**
54
- * The unit of the network speed.
55
- */
56
- unit: 'KB' | 'MB';
16
+ //#region src/types/utils.d.ts
17
+ type BaseSerializable<T extends Record<PropertyKey, any>> = { [K in keyof T as K extends `get${infer GetterName}` ? T[K] extends (() => infer R) ? R extends Promise<any> ? never : Uncapitalize<GetterName> : never : never]: K extends `get${string}` ? T[K] extends (() => infer R) ? R extends Promise<any> ? never : R extends Serializable<infer R2> ? R2 : R extends Array<Serializable<infer R2>> ? R2[] : R : never : never };
18
+ /**
19
+ * A serializable object.
20
+ */
21
+ interface Serializable<T extends BaseSerializable<T>> {
57
22
  /**
58
- * The increment of the {@linkcode ImageDownloadProgressEvent.percentage}.
23
+ * Serialize the object to a JSON object.
59
24
  */
60
- increment: number;
25
+ toJSON(): T;
61
26
  }
62
- interface ExtractProgressEvent extends progress.Progress {}
63
- type ImageDownloadEventMap = {
64
- 'download-progress': ImageDownloadProgressEvent;
65
- 'extract-progress': ExtractProgressEvent;
66
- };
67
- interface ImageDownloader<T extends BaseImage> extends Emitter<ImageDownloadEventMap> {
68
- /**
69
- * Start downloading the image.
70
- *
71
- * @param signal - The abort signal.
72
- */
73
- startDownload(signal?: AbortSignal): Promise<void>;
74
- /**
75
- * Check the checksum of the image.
76
- *
77
- * @param signal - The abort signal.
78
- */
79
- checkChecksum(signal?: AbortSignal): Promise<boolean>;
80
- /**
81
- * Extract the image.
82
- *
83
- * @param signal - The abort signal.
84
- * @param symlinkOpenHarmonySdk - If true, symlink the OpenHarmony SDK to the image. Default is `true`.
85
- */
86
- extract(signal?: AbortSignal, symlinkOpenHarmonySdk?: boolean): Promise<void>;
87
- /**
88
- * Clean the cache of the image.
89
- */
90
- clean(): Promise<void>;
91
- /**
92
- * Get the image.
93
- */
94
- getImage(): T;
95
- /**
96
- * Get the URL of the image.
97
- */
98
- getUrl(): string;
27
+ type DeepPartial<T extends Record<PropertyKey, any>> = { [K in keyof T]?: T[K] extends Record<PropertyKey, any> ? DeepPartial<T[K]> : T[K] };
28
+ //#endregion
29
+ //#region src/common/serializable-content.d.ts
30
+ interface SerializableContent<T extends SerializableContent.Content = SerializableContent.Content> extends Serializable<SerializableContent.Serializable> {
31
+ getImageManager(): ImageManager;
32
+ getContent(): T;
33
+ }
34
+ declare namespace SerializableContent {
35
+ type Content = Record<PropertyKey, any> | Content[];
36
+ interface Serializable extends BaseSerializable<SerializableContent> {}
99
37
  }
100
38
  //#endregion
101
- //#region src/options.d.ts
102
- interface ImageManagerOptions {
103
- /**
104
- * The base path to store the images.
105
- */
106
- imageBasePath?: string;
39
+ //#region src/configs/product/product.d.ts
40
+ interface ProductConfigFile extends Serializable<ProductConfigFile.Serializable>, Omit<SerializableFile, 'toJSON'> {
107
41
  /**
108
- * The path to store the deployed images.
109
- */
110
- deployedPath?: string;
111
- /**
112
- * The base path to store the downloaded images zip files.
42
+ * Find the product config items by the options.
113
43
  *
114
- * @default `imageBasePath/cache`
115
- */
116
- cachePath?: string;
117
- /**
118
- * The path to store the HarmonyOS SDK.
44
+ * @param options - The options to find the product config items.
45
+ * @template DeviceType - The device type to find. Example: `Foldable`, `Phone`.
46
+ * @template Name - The name to find. Example: `Mate X7`, `Customize`.
47
+ * @template OtherName - The name to find from other device types. Example: `nova 15 Pro、nova 15 Ultra`, `Customize`.
48
+ * @description The name is strictly matched with the name in the `productConfig.json` file,
49
+ * so if your device type and name are not corresponding, you will get a type error on the `name` property.
50
+ * Sometimes there are some device names that the library hasn't adapted yet, you can still define it in the `name` property,
51
+ * and it will not trigger a type error. Only when your device name and device type do not correspond to the library, will it trigger a type error.
119
52
  *
120
- * - In macOS, it will be `/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony` by default;
121
- * - In Windows, it will be `C:\Program Files\Huawei\DevEco Studio\sdk\default\openharmony` by default;
122
- * - In other platforms, it will be `~/.huawei/Sdk/default/openharmony` by default.
53
+ * It is useful to prevent you from using the wrong name.
54
+ * @returns The product config items.
123
55
  */
124
- sdkPath?: string;
56
+ findProductConfigItems<DeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, Name extends ProductConfigFile.GenericContent<DeviceType>['name'] = ProductConfigFile.GenericContent<DeviceType>['name'], OtherName extends ProductConfigFile.OtherDeviceTypeNames<DeviceType> = ProductConfigFile.OtherDeviceTypeNames<DeviceType>>(options: ProductConfigFile.FindOptions<DeviceType, Name, OtherName>): ProductConfigItem<DeviceType, Name>[];
125
57
  /**
126
- * The path to store the HarmonyOS configuration files.
58
+ * Find the product config item by the options.
127
59
  *
128
- * - In macOS, it will be `~/Library/Application Support/Huawei/DevEcoStudio6.0` by default;
129
- * - In Windows, it will be `%APPDATA%\Roaming\Huawei\DevEcoStudio6.0` by default;
130
- * - In other platforms, it will be `~/.huawei/DevEcoStudio6.0` by default.
131
- */
132
- configPath?: string;
133
- /**
134
- * The path to store the HarmonyOS log files.
60
+ * @param options - The options to find the product config item.
61
+ * @template DeviceType - The device type to find. Example: `Foldable`, `Phone`.
62
+ * @template Name - The name to find. Example: `Mate X7`, `Customize`.
63
+ * @template OtherName - The name to find from other device types. Example: `nova 15 Pro、nova 15 Ultra`, `Customize`.
64
+ * @description The name is strictly matched with the name in the `productConfig.json` file,
65
+ * so if your device type and name are not corresponding, you will get a type error on the `name` property.
66
+ * Sometimes there are some device names that the library hasn't adapted yet, you can still define it in the `name` property,
67
+ * and it will not trigger a type error. Only when your device name and device type do not correspond to the library, will it trigger a type error.
135
68
  *
136
- * - In macOS, it will be `~/Library/Logs/Huawei/DevEcoStudio6.0` by default;
137
- * - In Windows, it will be `%APPDATA%\Local\Huawei\DevEcoStudio6.0\log` by default;
138
- * - In other platforms, it will be `~/.huawei/DevEcoStudio6.0/log` by default.
69
+ * It is useful to prevent you from using the wrong name.
70
+ * @returns The product config item. If not found will return `undefined`.
139
71
  */
140
- logPath?: string;
141
- /**
142
- * The folder to store the emulator executable files.
143
- *
144
- * It must contain the `Emulator` (In windows, it will be `Emulator.exe`) executable file.
145
- *
146
- * - In macOS, it will be `/Applications/DevEco-Studio.app/Contents/tools/emulator`;
147
- * - In Windows, it will be `C:\Program Files\Huawei\DevEco Studio\tools\emulator`;
148
- * - In other platforms, it will be `~/.huawei/Emulator`.
149
- */
150
- emulatorPath?: string;
151
- os?: typeof node_os0;
152
- fs?: typeof node_fs0;
153
- path?: typeof node_path0;
154
- process?: typeof node_process0;
155
- crypto?: typeof node_crypto0;
156
- child_process?: typeof node_child_process0;
157
- }
158
- type ResolvedImageManagerOptions = Required<ImageManagerOptions>;
72
+ findProductConfigItem<DeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, Name extends ProductConfigFile.GenericContent<DeviceType>['name'] = ProductConfigFile.GenericContent<DeviceType>['name'], OtherName extends ProductConfigFile.OtherDeviceTypeNames<DeviceType> = ProductConfigFile.OtherDeviceTypeNames<DeviceType>>(options: ProductConfigFile.FindOptions<DeviceType, Name, OtherName>): ProductConfigItem<DeviceType, Name> | undefined;
73
+ }
74
+ declare namespace ProductConfigFile {
75
+ type DeviceType = 'Phone' | 'Tablet' | '2in1' | 'Foldable' | 'WideFold' | 'TripleFold' | '2in1 Foldable' | 'TV' | 'Wearable';
76
+ type DeviceTypeWithString = DeviceType | (string & {});
77
+ type PhoneContent = Record<'Phone', ProductConfigItem.PhoneContent[]>;
78
+ type TabletContent = Record<'Tablet', ProductConfigItem.TabletContent[]>;
79
+ type TwoInOneContent = Record<'2in1', ProductConfigItem.TwoInOneContent[]>;
80
+ type FoldableContent = Record<'Foldable', ProductConfigItem.FoldableContent[]>;
81
+ type WideFoldContent = Record<'WideFold', ProductConfigItem.WideFoldContent[]>;
82
+ type TripleFoldContent = Record<'TripleFold', ProductConfigItem.TripleFoldContent[]>;
83
+ type TwoInOneFoldableContent = Record<'2in1 Foldable', ProductConfigItem.TwoInOneFoldableContent[]>;
84
+ type TVContent = Record<'TV', ProductConfigItem.TVContent[]>;
85
+ type WearableContent = Record<'Wearable', ProductConfigItem.WearableContent[]>;
86
+ type WearableKidContent = Record<'WearableKid', ProductConfigItem.WearableKidContent[]>;
87
+ type Content = PhoneContent & TabletContent & TwoInOneContent & FoldableContent & WideFoldContent & TripleFoldContent & TwoInOneFoldableContent & TVContent & WearableContent & WearableKidContent;
88
+ type GenericContent<DeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, Name extends ProductConfigItem.NameWithString = Content[DeviceType][number]['name']> = Content[DeviceType][number] extends {
89
+ name: Name;
90
+ } ? Content[DeviceType][number] : Content[DeviceType][number];
91
+ /** Names from device types other than DeviceType. Used to detect ambiguous names like "Customize". */
92
+ type OtherDeviceTypeNames<DeviceType extends ProductConfigFile.DeviceType> = Exclude<ProductConfigItem.Name, Content[DeviceType][number]['name']>;
93
+ interface Serializable extends BaseSerializable<ProductConfigFile> {}
94
+ interface Generic {
95
+ readonly deviceType: DeviceType;
96
+ readonly name: ProductConfigItem.NameWithString;
97
+ }
98
+ interface FindOptions<DeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, Name extends ProductConfigFile.GenericContent<DeviceType>['name'] = ProductConfigFile.GenericContent<DeviceType>['name'], OtherName extends OtherDeviceTypeNames<DeviceType> = OtherDeviceTypeNames<DeviceType>> {
99
+ /**
100
+ * The device type to find.
101
+ */
102
+ readonly deviceType?: DeviceType;
103
+ /**
104
+ * The name to find.
105
+ *
106
+ * @notes
107
+ *
108
+ * - Known wrong name (from other device type) → `never` (type error)
109
+ * - Known correct name → `Name` or `NameWithString` if ambiguous
110
+ * - Arbitrary string (not in predefined list) → `NameWithString` (allowed)
111
+ */
112
+ readonly name?: Name extends OtherName ? never : Name extends Content[DeviceType][number]['name'] ? Name extends OtherName ? ProductConfigItem.NameWithString : Name : ProductConfigItem.NameWithString;
113
+ }
114
+ function is(value: unknown): value is ProductConfigFile;
115
+ }
159
116
  //#endregion
160
- //#region src/image-manager.d.ts
161
- interface ImageManager {
117
+ //#region src/configs/product/item.d.ts
118
+ interface ProductConfigItem<DeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, Name extends ProductConfigFile.GenericContent<DeviceType>['name'] = ProductConfigFile.GenericContent<DeviceType>['name']> extends Serializable<ProductConfigItem.Serializable>, Omit<SerializableContent<ProductConfigFile.GenericContent<DeviceType, Name>>, 'toJSON'> {
162
119
  /**
163
- * Get the resolved options.
164
- */
165
- getOptions(): ResolvedImageManagerOptions;
166
- /**
167
- * Get the images.
120
+ * Get the product config file of the product.
168
121
  *
169
- * @param supportVersion - The support version of the images. Default is `6.0-hos-single-9`.
122
+ * @returns The product config file of the product.
170
123
  */
171
- getImages(supportVersion?: string): Promise<Image[]>;
124
+ getProductConfigFile(): ProductConfigFile;
172
125
  /**
173
- * Get the product config.
126
+ * Get the camel-case device type of the product.
174
127
  *
175
- * It will automatically read from the `imageBasePath/productConfig.json` file if it exists.
176
- * If the file does not exist, it will use the default product config.
128
+ * @returns The camel-case device type of the product.
177
129
  */
178
- getProductConfig(): Promise<ProductConfig>;
130
+ getDeviceType(): DeviceType;
179
131
  /**
180
- * Write the product config.
132
+ * Get the dev model of the product.
181
133
  *
182
- * @param existSkip - If the file exists, skip writing. Defaults to `false`.
183
- */
184
- writeDefaultProductConfig(existSkip?: boolean): Promise<void>;
185
- /**
186
- * Get the emulator config.
134
+ * - `Phone` `PHEMU-FD00`
135
+ * - `Foldable` → `PHEMU-FD01`
136
+ * - `WideFold` → `PHEMU-FD02`
137
+ * - `TripleFold` → `PHEMU-FD06`
138
+ * - `2in1 Foldable` → `PCEMU-FD05`
139
+ * - `Wearable` → `MCHEMU-AL00CN`
187
140
  *
188
- * It will automatically read from the `imageBasePath/emulatorConfig.json` file if it exists.
189
- * If the file does not exist, it will use the default emulator config.
190
- */
191
- getEmulatorConfig(): Promise<EmulatorConfig>;
192
- /**
193
- * Get the operating system.
141
+ * Other cases will return `undefined`. It is very important to emulator to identify the device type.
142
+ * If the dev model is no correct the emulator screen and features maybe have some problems (e.g. the
143
+ * screen width and height is not correct、the foldable screen cannot be folded, etc.).
194
144
  */
195
- getOS(): OS;
196
- /**
197
- * Get the architecture.
198
- */
199
- getArch(): Arch;
200
- /**
201
- * Check if the emulator is compatible with current image manager.
202
- */
203
- isCompatible(): Promise<boolean>;
145
+ getDevModel(): ProductConfigItem.DevModelWithString | undefined;
204
146
  }
205
- declare function createImageManager(options?: ImageManagerOptions): Promise<ImageManager>;
206
- //#endregion
207
- //#region src/errors/deploy-error.d.ts
208
- declare class DeployError extends Error {
209
- readonly code: DeployError.Code;
210
- readonly message: string;
211
- readonly cause?: Error;
212
- constructor(code: DeployError.Code, message: string, cause?: Error);
213
- getCode(): DeployError.Code;
214
- }
215
- declare namespace DeployError {
216
- enum Code {
217
- DEVICE_ALREADY_DEPLOYED = "DEVICE_ALREADY_DEPLOYED",
218
- LIST_JSON_NOT_AN_ARRAY = "LIST_JSON_NOT_AN_ARRAY",
219
- CATCHED_ERROR = "CATCHED_ERROR",
220
- MAYBE_OPENED_DEVICE_MANAGER_IN_DEVECO_STUDIO = "MAYBE_OPENED_DEVICE_MANAGER_IN_DEVECO_STUDIO",
221
- SYMLINK_SDK_PATH_EXISTS = "SYMLINK_SDK_PATH_EXISTS"
147
+ declare namespace ProductConfigItem {
148
+ type Customize = 'Customize';
149
+ type PhoneName = 'nova 15 Pro、nova 15 Ultra' | 'nova 15' | 'Mate 80 Pro Max、Mate 80 RS' | 'Mate 80、Mate 80 Pro' | 'Mate 70 Pro、Mate 70 Pro+、Mate 70 RS' | 'Mate 70' | 'Mate 70 Air' | 'Mate 60 Pro、Mate 60 Pro+、Mate 60 RS' | 'Mate 60' | 'Pura 80 Pro、Pura 80 Pro+、Pura 80 Ultra' | 'Pura 80' | 'Pura 70 Pro、Pura 70 Pro+、Pura 70 Ultra' | 'Pura 70' | 'nova 14 Ultra' | 'nova 14 Pro' | 'nova 14' | 'nova 13 Pro' | 'nova 13' | 'nova 12 Pro、nova 12 Ultra' | 'nova 12' | 'Pocket 2' | 'nova flip、nova flip S';
150
+ type TabletName = 'MatePad Pro 11' | 'MatePad Pro 12' | 'MatePad Pro 13' | 'MatePad 11 S' | 'MatePad Air 12';
151
+ type TwoInOneName = 'MateBook Pro';
152
+ type FoldableName = 'Mate X5' | 'Mate X6' | 'Mate X7';
153
+ type WideFoldName = 'Pura X';
154
+ type TripleFoldName = 'Mate XT';
155
+ type TVName = 'TV';
156
+ type WearableName = 'Wearable';
157
+ type WearableKidName = 'WearableKid';
158
+ type TwoInOneFoldableName = 'MateBook Fold';
159
+ type Name = PhoneName | TabletName | TwoInOneName | FoldableName | WideFoldName | TripleFoldName | TVName | WearableName | TwoInOneFoldableName | WearableKidName | Customize;
160
+ type NameWithString = Name | (string & {});
161
+ interface BaseContent {
162
+ /**
163
+ * The name of the product.
164
+ */
165
+ readonly name: NameWithString;
166
+ /**
167
+ * The screen width of the product.
168
+ */
169
+ readonly screenWidth: string;
170
+ /**
171
+ * The screen height of the product.
172
+ */
173
+ readonly screenHeight: string;
174
+ /**
175
+ * The screen diagonal of the product.
176
+ */
177
+ readonly screenDiagonal: string;
178
+ /**
179
+ * The screen density of the product.
180
+ */
181
+ readonly screenDensity: string;
182
+ /**
183
+ * Whether the product is visible.
184
+ */
185
+ readonly visible: boolean;
186
+ /**
187
+ * The dev model of the product.
188
+ */
189
+ readonly devModel?: string;
190
+ }
191
+ interface BaseFoldContent extends BaseContent {
192
+ /**
193
+ * The name of the product.
194
+ */
195
+ readonly name: FoldableName | WideFoldName | TripleFoldName | TwoInOneFoldableName | Customize;
196
+ /**
197
+ * The outer screen width of the product.
198
+ */
199
+ readonly outerScreenWidth: string;
200
+ /**
201
+ * The outer screen height of the product.
202
+ */
203
+ readonly outerScreenHeight: string;
204
+ /**
205
+ * The outer screen diagonal of the product.
206
+ */
207
+ readonly outerScreenDiagonal: string;
222
208
  }
209
+ interface PhoneContent extends BaseContent {
210
+ /**
211
+ * The name of the product.
212
+ */
213
+ readonly name: PhoneName | Customize;
214
+ /**
215
+ * The one cutout path of the product.
216
+ */
217
+ readonly oneCutoutPath?: string;
218
+ }
219
+ interface TabletContent extends BaseContent {
220
+ /**
221
+ * The name of the product.
222
+ */
223
+ readonly name: TabletName | Customize;
224
+ }
225
+ interface TwoInOneContent extends BaseContent {
226
+ /**
227
+ * The name of the product.
228
+ */
229
+ readonly name: TwoInOneName | Customize;
230
+ }
231
+ interface FoldableContent extends BaseFoldContent {
232
+ /**
233
+ * The name of the product.
234
+ */
235
+ readonly name: FoldableName | Customize;
236
+ }
237
+ interface WideFoldContent extends BaseFoldContent {
238
+ /**
239
+ * The name of the product.
240
+ */
241
+ readonly name: WideFoldName;
242
+ /**
243
+ * The outer screen width of the product.
244
+ */
245
+ readonly outerScreenWidth: string;
246
+ /**
247
+ * The outer screen height of the product.
248
+ */
249
+ readonly outerScreenHeight: string;
250
+ /**
251
+ * The outer screen diagonal of the product.
252
+ */
253
+ readonly outerScreenDiagonal: string;
254
+ }
255
+ interface TripleFoldContent extends BaseFoldContent {
256
+ /**
257
+ * The name of the product.
258
+ */
259
+ readonly name: TripleFoldName;
260
+ /**
261
+ * The outer screen height of the product.
262
+ */
263
+ readonly outerDoubleScreenWidth: string;
264
+ /**
265
+ * The outer double screen height of the product.
266
+ */
267
+ readonly outerDoubleScreenHeight: string;
268
+ /**
269
+ * The outer double screen diagonal of the product.
270
+ */
271
+ readonly outerDoubleScreenDiagonal: string;
272
+ }
273
+ interface TwoInOneFoldableContent extends BaseFoldContent {
274
+ /**
275
+ * The name of the product.
276
+ */
277
+ readonly name: TwoInOneFoldableName;
278
+ }
279
+ interface TVContent extends BaseContent {
280
+ /**
281
+ * The name of the product.
282
+ */
283
+ readonly name: TVName;
284
+ }
285
+ interface WearableContent extends BaseContent {
286
+ /**
287
+ * The name of the product.
288
+ */
289
+ readonly name: WearableName;
290
+ }
291
+ interface WearableKidContent extends BaseContent {
292
+ /**
293
+ * The name of the product.
294
+ */
295
+ readonly name: WearableKidName;
296
+ }
297
+ type Content = PhoneContent | TabletContent | TwoInOneContent | FoldableContent | WideFoldContent | TripleFoldContent | TwoInOneFoldableContent | TVContent | WearableContent | WearableKidContent;
298
+ interface Serializable extends BaseSerializable<ProductConfigItem> {}
299
+ type DevModel = 'MCHEMU-AL00CN' | 'PHEMU-FD00' | 'PHEMU-FD01' | 'PHEMU-FD02' | 'PCEMU-FD05' | 'PHEMU-FD06';
300
+ type DevModelWithString = DevModel | (string & {});
301
+ function is(value: unknown): value is ProductConfigItem;
223
302
  }
224
303
  //#endregion
225
- //#region src/errors/request-url-error.d.ts
226
- declare class RequestUrlError extends Error {
227
- readonly message: string;
228
- readonly code: number;
229
- readonly cause?: Error;
230
- constructor(message: string, code: number, cause?: Error);
304
+ //#region src/configs/lists/lists.d.ts
305
+ interface ListsFile extends Serializable<ListsFile.Serializable>, Omit<SerializableFile, 'toJSON'> {
306
+ getListsFileItems(): ListsFileItem[];
307
+ addListsFileItem(listsFileItem: ListsFileItem.Content): ListsFileItem;
308
+ deleteListsFileItem(listsFileItem: ListsFileItem): this;
309
+ }
310
+ declare namespace ListsFile {
311
+ type Content = ListsFileItem.Content[];
312
+ interface Serializable extends BaseSerializable<ListsFile> {}
313
+ function is(value: unknown): value is ListsFile;
231
314
  }
232
315
  //#endregion
233
- //#region src/images/image.d.ts
234
- interface BaseImage {
235
- getImageManager(): ImageManager;
236
- getPath(): string;
237
- getArch(): 'arm' | 'x86' | (string & {});
238
- getChecksum(): string;
239
- getReleaseType(): string;
240
- getVersion(): string;
241
- getApiVersion(): string;
242
- getTargetOS(): string;
243
- getTargetVersion(): string;
244
- getFsPath(): string;
245
- getDeviceType(): DeviceType | (string & {});
246
- getSnakecaseDeviceType(): SnakecaseDeviceType | (string & {});
247
- getUrl(): Promise<string | RequestUrlError>;
248
- isDownloaded(): Promise<boolean>;
249
- createDownloader(signal?: AbortSignal): Promise<ImageDownloader<this> | RequestUrlError>;
316
+ //#region src/configs/lists/item.d.ts
317
+ interface ListsFileItem<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Serializable<ListsFileItem.Serializable>, Omit<SerializableContent<ListsFileItem.Content<ProductDeviceType, ProductName>>, 'toJSON'> {
318
+ getListsFile(): ListsFile;
250
319
  }
251
- declare namespace BaseImage {
252
- interface Stringifiable {
253
- imageType: ImageType;
254
- arch: 'arm' | 'x86' | (string & {});
255
- path: string;
256
- checksum: string;
257
- fsPath: string;
258
- version: string;
259
- apiVersion: string;
260
- targetOS: string;
261
- targetVersion: string;
262
- deviceType: DeviceType | (string & {});
263
- snakecaseDeviceType: SnakecaseDeviceType | (string & {});
320
+ declare namespace ListsFileItem {
321
+ interface Serializable extends BaseSerializable<ListsFileItem> {}
322
+ type DeviceType = 'phone' | 'tablet' | '2in1' | 'foldable' | 'widefold' | 'triplefold' | '2in1_foldable' | 'tv' | 'wearable';
323
+ type DeviceTypeWithString = DeviceType | (string & {});
324
+ interface Content<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
325
+ /**
326
+ * Diagonal size.
327
+ *
328
+ * @example '1.6'
329
+ */
330
+ readonly 'diagonalSize': string;
331
+ /**
332
+ * Density.
333
+ *
334
+ * @example '320'
335
+ */
336
+ readonly 'density': string;
337
+ /**
338
+ * Resolution height.
339
+ *
340
+ * @example '466'
341
+ */
342
+ readonly 'resolutionHeight': string;
343
+ /**
344
+ * Resolution width.
345
+ *
346
+ * @example '466'
347
+ */
348
+ readonly 'resolutionWidth': string;
349
+ /**
350
+ * RAM size.
351
+ *
352
+ * @example '4096'
353
+ */
354
+ readonly 'memoryRamSize': string;
355
+ /**
356
+ * CPU number.
357
+ *
358
+ * @example '4'
359
+ */
360
+ readonly 'cpuNumber': string;
361
+ /**
362
+ * Data disk size.
363
+ *
364
+ * @example '6144'
365
+ */
366
+ readonly 'dataDiskSize': string;
367
+ /**
368
+ * Deployed name.
369
+ *
370
+ * @example 'Huawei_Wearable'
371
+ */
372
+ readonly 'name': string;
373
+ /**
374
+ * UUID.
375
+ *
376
+ * @example 'ce454934-3a1b-4770-9838-dc85c5d7b6c1'
377
+ */
378
+ readonly 'uuid': string;
379
+ /**
380
+ * OpenHarmony/HarmonyOS version.
381
+ *
382
+ * @example '6.0.1'
383
+ */
384
+ readonly 'hw.apiName': string;
385
+ /**
386
+ * Device model.
387
+ *
388
+ * @example 'MCHEMU-AL00CN'
389
+ */
390
+ readonly 'devModel'?: ProductConfigItem.DevModelWithString;
391
+ /**
392
+ * Model.
393
+ *
394
+ * @example 'Mate 80 Pro Max、Mate 80 RS'
395
+ */
396
+ readonly 'model'?: ProductName;
397
+ /**
398
+ * Image directory.
399
+ *
400
+ * @example 'system-image/HarmonyOS-6.0.1/wearable_arm/'
401
+ */
402
+ readonly 'imageDir': string;
403
+ /**
404
+ * Image SDK version.
405
+ *
406
+ * @example '6.0.0.112'
407
+ */
408
+ readonly 'version': string;
409
+ /**
410
+ * Device type.
411
+ *
412
+ * @example 'wearable', 'phone', 'tablet'
413
+ */
414
+ readonly 'type': DeviceTypeWithString;
415
+ /**
416
+ * Architecture.
417
+ *
418
+ * @example 'arm'
419
+ */
420
+ readonly 'abi': string;
421
+ /**
422
+ * API version.
423
+ *
424
+ * @example '21'
425
+ */
426
+ readonly 'apiVersion': string;
427
+ /**
428
+ * Deployed path.
429
+ *
430
+ * @example '/Users/xxx/.Huawei/Emulator/deployed/Huawei_Wearable'
431
+ */
432
+ readonly 'path': string;
433
+ /**
434
+ * Show version.
435
+ *
436
+ * @example 'HarmonyOS 6.0.1(21)'
437
+ */
438
+ readonly 'showVersion': string;
439
+ /**
440
+ * HarmonyOS version.
441
+ *
442
+ * @example 'HarmonyOS-6.0.1'
443
+ */
444
+ readonly 'harmonyOSVersion'?: string;
445
+ /**
446
+ * Guest version.
447
+ *
448
+ * @example 'HarmonyOS 6.0.1(21)'
449
+ */
450
+ readonly 'guestVersion'?: string;
451
+ /**
452
+ * Cover resolution width.
453
+ *
454
+ * @example '2472'
455
+ */
456
+ readonly 'coverResolutionWidth'?: string;
457
+ /**
458
+ * Cover resolution height.
459
+ *
460
+ * @example '1648'
461
+ */
462
+ readonly 'coverResolutionHeight'?: string;
463
+ /**
464
+ * Cover diagonal size.
465
+ *
466
+ * @example '13.0'
467
+ */
468
+ readonly 'coverDiagonalSize'?: string;
469
+ /**
470
+ * HarmonyOS SDK path.
471
+ *
472
+ * @example '/Applications/DevEco-Studio.app/Contents/sdk'
473
+ */
474
+ readonly 'harmonyos.sdk.path': string;
475
+ /**
476
+ * HarmonyOS config path.
477
+ *
478
+ * @example '/Users/xxx/Library/Application Support/Huawei/DevEcoStudio6.0'
479
+ */
480
+ readonly 'harmonyos.config.path': string;
481
+ /**
482
+ * HarmonyOS log path.
483
+ *
484
+ * @example '/Users/xxx/Library/Logs/Huawei/DevEcoStudio6.0'
485
+ */
486
+ readonly 'harmonyos.log.path': string;
487
+ /**
488
+ * Additional properties.
489
+ */
490
+ readonly [key: string]: any;
264
491
  }
492
+ function is(value: unknown): value is ListsFileItem;
265
493
  }
266
- type Image = LocalImage | RemoteImage;
267
- type ImageType = 'local' | 'remote';
268
494
  //#endregion
269
- //#region src/screens/base-screen.d.ts
270
- interface BaseScreen<T extends BaseScreen.Options = BaseScreen.Options> extends Stringifiable<T> {
271
- getWidth(): number;
272
- setWidth(width: number): this;
273
- getHeight(): number;
274
- setHeight(height: number): this;
275
- getDiagonal(): number;
276
- setDiagonal(diagonal: number): this;
277
- }
278
- declare namespace BaseScreen {
495
+ //#region src/screens/customize-screen.d.ts
496
+ interface CustomizeScreen extends Serializable<CustomizeScreen.Serializable> {
497
+ /**
498
+ * Get the screen preset.
499
+ *
500
+ * @returns The screen preset.
501
+ */
502
+ getScreenPreset(): ScreenPreset;
503
+ }
504
+ declare namespace CustomizeScreen {
279
505
  interface Options {
280
- width: number;
281
- height: number;
282
- diagonal: number;
506
+ configName: string;
507
+ diagonalSize: number;
508
+ resolutionWidth: number;
509
+ resolutionHeight: number;
510
+ density: number;
283
511
  }
512
+ interface Serializable extends Omit<BaseSerializable<CustomizeScreen>, 'screenPreset'>, CustomizeScreen.Options {}
513
+ function is(value: unknown): value is CustomizeScreen;
284
514
  }
285
515
  //#endregion
286
- //#region src/screens/cover-screen.d.ts
287
- interface CoverScreen<T extends CoverScreen.Options = CoverScreen.Options> extends BaseScreen<T> {
288
- getScreen(): Screen;
516
+ //#region src/screens/customize-foldable-screen.d.ts
517
+ interface CustomizeFoldableScreen extends Serializable<CustomizeFoldableScreen.Serializable>, Omit<CustomizeScreen, 'toJSON'> {
518
+ getCoverResolutionWidth(): number;
519
+ getCoverResolutionHeight(): number;
520
+ getCoverDiagonalSize(): number;
289
521
  }
290
- declare namespace CoverScreen {
291
- interface Options extends BaseScreen.Options {}
292
- interface Stringifiable extends Options {}
293
- function is(value: unknown): value is CoverScreen;
294
- }
295
- declare function createCoverScreen(options: CoverScreen.Options, screen: Screen): CoverScreen;
296
- //#endregion
297
- //#region src/screens/double-screen.d.ts
298
- interface DoubleScreen {
299
- getScreen(): Screen;
300
- }
301
- declare namespace DoubleScreen {
302
- interface Options extends BaseScreen.Options {}
303
- interface Stringifiable extends Options {}
304
- function is(value: unknown): value is DoubleScreen;
522
+ declare namespace CustomizeFoldableScreen {
523
+ interface Options {
524
+ coverResolutionWidth: number;
525
+ coverResolutionHeight: number;
526
+ coverDiagonalSize: number;
527
+ }
528
+ interface Serializable extends CustomizeScreen.Serializable, CustomizeFoldableScreen.Options {}
529
+ function is(value: unknown): value is CustomizeFoldableScreen;
305
530
  }
306
- declare function createDoubleScreen(options: DoubleScreen.Options, screen: Screen): DoubleScreen;
307
531
  //#endregion
308
- //#region src/screens/outer-double-screen.d.ts
309
- interface OuterDoubleScreen extends OuterScreen {
310
- getOuterScreen(): OuterScreen;
532
+ //#region src/configs/emulator/emulator-basic-item.d.ts
533
+ interface EmulatorBasicItem extends SerializableContent<EmulatorBasicItem.Content> {
534
+ getEmulatorFile(): EmulatorFile;
311
535
  }
312
- declare namespace OuterDoubleScreen {
313
- interface Options extends OuterScreen.Options {}
314
- interface Stringifiable extends Options {}
315
- function is(value: unknown): value is OuterDoubleScreen;
536
+ declare namespace EmulatorBasicItem {
537
+ type DeviceType = '2in1' | 'tablet' | 'tv' | 'wearable' | 'phone';
538
+ type DeviceTypeWithString = DeviceType | (string & {});
539
+ interface Content {
540
+ readonly name: string;
541
+ readonly deviceType: DeviceType;
542
+ readonly resolutionWidth: number;
543
+ readonly resolutionHeight: number;
544
+ readonly physicalWidth: number;
545
+ readonly physicalHeight: number;
546
+ readonly diagonalSize: number;
547
+ readonly density: number;
548
+ readonly memoryRamSize: number;
549
+ readonly datadiskSize: number;
550
+ readonly procNumber: number;
551
+ readonly api: number;
552
+ }
553
+ function is(value: unknown): value is EmulatorBasicItem;
554
+ function isDeviceType(value: unknown): value is DeviceType;
555
+ function isContent(value: unknown): value is Content;
316
556
  }
317
- declare function createOuterDoubleScreen(options: OuterDoubleScreen.Options, outerScreen: OuterScreen): OuterDoubleScreen;
318
557
  //#endregion
319
- //#region src/screens/outer-screen.d.ts
320
- interface OuterScreen<T extends OuterScreen.Options = OuterScreen.Options> extends BaseScreen<T> {
321
- getScreen(): Screen;
322
- getOuterDoubleScreen(): OuterDoubleScreen | undefined;
323
- setOuterDoubleScreen(outerDoubleScreen: OuterDoubleScreen | OuterDoubleScreen.Options): this;
558
+ //#region src/configs/emulator/emulator-fold-item.d.ts
559
+ interface EmulatorFoldItem extends SerializableContent<EmulatorFoldItem.Content> {
560
+ getEmulatorFile(): EmulatorFile;
324
561
  }
325
- declare namespace OuterScreen {
326
- interface Options extends BaseScreen.Options {
327
- double?: OuterDoubleScreen | OuterDoubleScreen.Options;
562
+ declare namespace EmulatorFoldItem {
563
+ type DeviceType = 'foldable' | '2in1_foldable' | 'triplefold' | 'widefold';
564
+ interface Content extends Omit<EmulatorBasicItem.Content, 'deviceType'> {
565
+ readonly deviceType: DeviceType;
566
+ readonly coverResolutionWidth: number;
567
+ readonly coverResolutionHeight: number;
568
+ readonly coverDiagonalSize: number;
328
569
  }
329
- interface Stringifiable extends Options {}
330
- function is(value: unknown): value is OuterScreen;
570
+ function is(value: unknown): value is EmulatorFoldItem;
571
+ function isDeviceType(value: unknown): value is DeviceType;
572
+ function isContent(value: unknown): value is Content;
331
573
  }
332
- declare function createOuterScreen(options: OuterScreen.Options, screen: Screen): OuterScreen;
333
574
  //#endregion
334
- //#region src/screens/single-screen.d.ts
335
- interface SingleScreen<T extends SingleScreen.Options = SingleScreen.Options> extends BaseScreen<T> {
336
- getScreen(): Screen;
337
- }
338
- declare namespace SingleScreen {
339
- interface Options extends BaseScreen.Options {}
340
- interface Stringifiable extends Options {}
341
- function is(value: unknown): value is SingleScreen;
575
+ //#region src/configs/emulator/emulator-triplefold-item.d.ts
576
+ interface EmulatorTripleFoldItem extends SerializableContent<EmulatorTripleFoldItem.Content> {
577
+ getEmulatorFile(): EmulatorFile;
342
578
  }
343
- declare function createSingleScreen(options: SingleScreen.Options, screen: Screen): SingleScreen;
344
- //#endregion
345
- //#region src/screens/screen.d.ts
346
- interface Screen<T extends Screen.Options = Screen.Options> extends BaseScreen<T> {
347
- getScreen(): this;
348
- getApiVersion(): number;
349
- getSnakecaseDeviceType(): SnakecaseDeviceType;
350
- getOuterScreen(): OuterScreen | undefined;
351
- setOuterScreen(outerScreen: OuterScreen | OuterScreen.Options): this;
352
- getCoverScreen(): CoverScreen | undefined;
353
- setCoverScreen(coverScreen: CoverScreen | CoverScreen.Options): this;
354
- getSingleScreen(): SingleScreen | undefined;
355
- setSingleScreen(singleScreen: SingleScreen | SingleScreen.Options): this;
356
- getDoubleScreen(): DoubleScreen | undefined;
357
- setDoubleScreen(doubleScreen: DoubleScreen | DoubleScreen.Options): this;
358
- getDensity(): number;
359
- setDensity(density: number): this;
360
- }
361
- declare namespace Screen {
362
- interface Options extends BaseScreen.Options {
363
- density: number;
364
- apiVersion: number;
365
- deviceType: SnakecaseDeviceType;
366
- outer?: OuterScreen | OuterScreen.Options;
367
- cover?: CoverScreen | CoverScreen.Options;
368
- single?: SingleScreen | SingleScreen.Options;
369
- double?: DoubleScreen | DoubleScreen.Options;
579
+ declare namespace EmulatorTripleFoldItem {
580
+ type DeviceType = 'triplefold';
581
+ type DeviceTypeWithString = DeviceType;
582
+ interface Content extends Omit<EmulatorBasicItem.Content, 'deviceType'> {
583
+ readonly deviceType: DeviceType;
584
+ readonly singleResolutionWidth: number;
585
+ readonly singleResolutionHeight: number;
586
+ readonly singleDiagonalSize: number;
587
+ readonly doubleResolutionWidth: number;
588
+ readonly doubleResolutionHeight: number;
589
+ readonly doubleDiagonalSize: number;
370
590
  }
371
- interface Stringifiable extends Options {}
372
- function is(value: unknown): value is Screen;
591
+ function is(value: unknown): value is EmulatorTripleFoldItem;
592
+ function isDeviceType(value: unknown): value is DeviceType;
593
+ function isContent(value: unknown): value is Content;
373
594
  }
374
- declare function createScreen(options: Screen.Options): Screen;
375
595
  //#endregion
376
- //#region src/screens/emulator-preset.d.ts
377
- interface EmulatorPreset extends Stringifiable<EmulatorPreset.Stringifiable> {
378
- getScreenPreset(): ScreenPreset;
379
- getEmulatorConfig(): EmulatorConfigItem;
596
+ //#region src/configs/emulator/group-item.d.ts
597
+ interface EmulatorGroupItem extends SerializableContent<EmulatorGroupItem.Content> {
598
+ getEmulatorFile(): EmulatorFile;
599
+ getChildren(): EmulatorFile.DeviceItem[];
380
600
  }
381
- declare namespace EmulatorPreset {
382
- interface Stringifiable {
383
- emulatorConfig: EmulatorConfigItem;
601
+ declare namespace EmulatorGroupItem {
602
+ type DeviceType = 'phone_all' | 'pc_all';
603
+ type DeviceTypeWithString = DeviceType | (string & {});
604
+ interface Content {
605
+ readonly name: string;
606
+ readonly deviceType: DeviceTypeWithString;
607
+ readonly api: number;
608
+ readonly children: EmulatorFile.ItemContent[];
384
609
  }
610
+ function is(value: unknown): value is EmulatorGroupItem;
611
+ function isContent(value: unknown): value is EmulatorGroupItem.Content;
385
612
  }
386
613
  //#endregion
387
- //#region src/screens/product-preset.d.ts
388
- interface ProductPreset extends Stringifiable<ProductPreset.Stringifiable> {
389
- getScreenPreset(): ScreenPreset;
390
- getProductConfig(): ProductConfigItem;
391
- getDeviceType(): PascalCaseDeviceType;
614
+ //#region src/configs/emulator/emulator.d.ts
615
+ interface EmulatorFile extends Serializable<EmulatorFile.Serializable>, Omit<SerializableFile, 'toJSON'> {
616
+ findDeviceItems<DeviceType extends EmulatorFile.DeviceType>(options?: EmulatorFile.FindDeviceItemOptions<DeviceType extends EmulatorGroupItem.DeviceType ? never : DeviceType>): EmulatorFile.DeviceItem[];
617
+ findDeviceItem<DeviceType extends EmulatorFile.DeviceType>(options?: EmulatorFile.FindDeviceItemOptions<DeviceType extends EmulatorGroupItem.DeviceType ? never : DeviceType>): EmulatorFile.DeviceItem | undefined;
618
+ findItems(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item[];
619
+ findItem(options?: EmulatorFile.FindItemOptions): EmulatorFile.Item | undefined;
620
+ getItems(): EmulatorFile.Item[];
392
621
  }
393
- declare namespace ProductPreset {
394
- interface Stringifiable {
395
- product: ProductConfigItem;
396
- deviceType: PascalCaseDeviceType;
622
+ declare namespace EmulatorFile {
623
+ interface Serializable extends BaseSerializable<EmulatorFile> {}
624
+ type ItemContent = EmulatorBasicItem.Content | EmulatorFoldItem.Content | EmulatorTripleFoldItem.Content;
625
+ type Content = Array<ContentItem>;
626
+ type ContentItem = EmulatorGroupItem.Content | ItemContent;
627
+ type DeviceItem = EmulatorBasicItem | EmulatorFoldItem | EmulatorTripleFoldItem;
628
+ type Item = EmulatorGroupItem | DeviceItem;
629
+ type DeviceType = EmulatorBasicItem.DeviceType | EmulatorFoldItem.DeviceType | EmulatorTripleFoldItem.DeviceType;
630
+ type DeviceTypeWithString = DeviceType | (string & {});
631
+ type FullDeviceType = DeviceType | EmulatorGroupItem.DeviceType;
632
+ type FullDeviceTypeWithString = FullDeviceType | (string & {});
633
+ function is(value: unknown): value is EmulatorFile;
634
+ function isItemContent(value: unknown): value is EmulatorFile.ItemContent;
635
+ function isContentItem(value: unknown): value is EmulatorFile.ContentItem;
636
+ interface FindDeviceItemOptions<DeviceType extends DeviceTypeWithString = DeviceTypeWithString> {
637
+ /**
638
+ * The API version to find.
639
+ */
640
+ readonly apiVersion?: number;
641
+ /**
642
+ * The device type to find.
643
+ */
644
+ readonly deviceType?: DeviceType;
645
+ }
646
+ interface FindItemOptions {
647
+ /**
648
+ * The API version to find.
649
+ */
650
+ readonly apiVersion?: number;
651
+ /**
652
+ * The device type to find.
653
+ */
654
+ readonly fullDeviceType?: FullDeviceTypeWithString;
397
655
  }
398
656
  }
399
657
  //#endregion
400
658
  //#region src/screens/screen-preset.d.ts
401
- interface ScreenPreset extends Stringifiable<ScreenPreset.Stringifiable> {
402
- getScreen(): Screen;
403
- getEmulatorPreset(): EmulatorPreset | undefined;
404
- getProductPreset(): ProductPreset | undefined;
659
+ interface ScreenPreset<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
660
+ /**
661
+ * Get the emulator item content.
662
+ *
663
+ * @returns The emulator item content.
664
+ */
665
+ getEmulatorDeviceItem(): EmulatorFile.DeviceItem;
666
+ /**
667
+ * Get the product config item content.
668
+ *
669
+ * @returns The product config item content.
670
+ */
671
+ getProductConfigItem(): ProductConfigItem<ProductDeviceType, ProductName>;
672
+ /**
673
+ * Get the customize screen config.
674
+ *
675
+ * @returns The customize screen config.
676
+ */
677
+ getCustomizeScreenConfig(): CustomizeScreen | CustomizeFoldableScreen | undefined;
405
678
  }
406
679
  declare namespace ScreenPreset {
407
- interface ScreenOptions {
408
- screen: Screen;
409
- productConfig?: Partial<ProductConfig>;
410
- emulatorConfig?: EmulatorConfig;
411
- }
412
- namespace ScreenOptions {
413
- function is(value: unknown): value is ScreenOptions;
680
+ interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends BaseSerializable<ScreenPreset<ProductDeviceType, ProductName>> {}
681
+ interface PresetOptions<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
682
+ /**
683
+ * The emulator item content.
684
+ */
685
+ readonly emulatorDeviceItem: EmulatorFile.DeviceItem;
686
+ /**
687
+ * The product config item content.
688
+ */
689
+ readonly productConfigItem: ProductConfigItem<ProductDeviceType, ProductName>;
414
690
  }
415
- interface ProductOptions {
416
- image: LocalImage;
417
- productConfig: ProductConfigItem;
418
- pascalCaseDeviceType: PascalCaseDeviceType;
691
+ interface CustomizeOptions<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends PresetOptions<ProductDeviceType, ProductName> {
692
+ /**
693
+ * The customize screen options.
694
+ */
695
+ readonly customizeScreen: CustomizeScreen.Options;
419
696
  }
420
- namespace ProductOptions {
421
- function is(value: unknown): value is ProductOptions;
422
- }
423
- interface EmulatorOptions {
424
- image: LocalImage;
425
- emulatorConfig: EmulatorConfigItem;
426
- }
427
- namespace EmulatorOptions {
428
- function is(value: unknown): value is EmulatorOptions;
429
- }
430
- type Options = ScreenOptions | ProductOptions | EmulatorOptions;
431
- interface Stringifiable {
432
- emulatorPreset?: EmulatorPreset.Stringifiable;
433
- productPreset?: ProductPreset.Stringifiable;
697
+ interface CustomizeFoldableOptions<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends CustomizeOptions<ProductDeviceType, ProductName> {
698
+ /**
699
+ * The customize foldable screen options.
700
+ */
701
+ readonly customizeFoldableScreen: CustomizeFoldableScreen.Options;
434
702
  }
703
+ type Options<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> = ProductName extends ProductConfigItem.Customize ? ProductDeviceType extends 'Foldable' ? CustomizeFoldableOptions<ProductDeviceType, ProductName> : CustomizeOptions<ProductDeviceType, ProductName> : PresetOptions<ProductDeviceType, ProductName>;
435
704
  function is(value: unknown): value is ScreenPreset;
436
705
  }
706
+ //#endregion
707
+ //#region src/devices/device.d.ts
708
+ interface Device<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Serializable<Device.Serializable<ProductDeviceType, ProductName>> {
709
+ /** Get the screen of the device. */
710
+ getScreen(): ScreenPreset<ProductDeviceType, ProductName>;
711
+ /** Get the image manager of the device. */
712
+ getImageManager(): ImageManager;
713
+ /** Get the lists file of the device. */
714
+ getListsFile(): ListsFile;
715
+ /** Get the lists file item of the device. */
716
+ getListsFileItem(): ListsFileItem;
717
+ /** Get the config INI file of the device. */
718
+ getConfigIniFile(): ConfigIniFile<ProductDeviceType, ProductName>;
719
+ /** Get the named INI file of the device. */
720
+ getNamedIniFile(): NamedIniFile<ProductDeviceType, ProductName>;
721
+ /** Get the executable URI of the device. */
722
+ getExecutableUri(): vscode_uri0.URI;
723
+ /** Get the snapshot URI of the device. */
724
+ getSnapshotUri(): vscode_uri0.URI;
725
+ /** Get the snapshot base64 string of the device. */
726
+ getSnapshot(): Promise<string>;
727
+ /** Get the start command of the device. */
728
+ getStartCommand(): [string, string[]];
729
+ /** Get the stop command of the device. */
730
+ getStopCommand(): [string, string[]];
731
+ /** Start the device. */
732
+ start(): Promise<child_process.ChildProcessByStdio<null, Readable, Readable>>;
733
+ /** Stop the device. */
734
+ stop(): Promise<child_process.ChildProcessByStdio<null, Readable, Readable>>;
735
+ /** Delete the device. */
736
+ delete(): Promise<void>;
737
+ /** Get the storage size of the device. */
738
+ getStorageSize(): Promise<number>;
739
+ /**
740
+ * Get the watcher of the device.
741
+ *
742
+ * - If the watcher is already created, it will return the existing watcher.
743
+ * - If the watcher is disposed, it will create a new watcher.
744
+ * - If the watcher is already created but disposed, it will create a new watcher.
745
+ */
746
+ getWatcher(): Promise<FileSystemWatcher>;
747
+ }
748
+ declare namespace Device {
749
+ interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<Device<ProductDeviceType, ProductName>>, 'imageManager'> {}
750
+ function is(value: unknown): value is Device;
751
+ }
752
+ //#endregion
753
+ //#region src/event-emitter.d.ts
437
754
  /**
438
- * Create a screen preset with product options and local image.
755
+ * Represents a typed event.
439
756
  *
440
- * @param options - The options to create a screen preset.
441
- */
442
- declare function createScreenPreset(options: ScreenPreset.ProductOptions): ScreenPreset;
443
- /**
444
- * Create a screen preset with emulator options and local image.
757
+ * A function that represents an event to which you subscribe by calling it with
758
+ * a listener function as argument.
445
759
  *
446
- * @param options - The options to create a screen preset.
760
+ * @example
761
+ * item.onDidChange(function(event) { console.log("Event happened: " + event); });
447
762
  */
448
- declare function createScreenPreset(options: ScreenPreset.EmulatorOptions): ScreenPreset;
449
- //#endregion
450
- //#region src/devices/list.d.ts
451
- declare enum DevModel {
452
- MCHEMU_AL00CN = "MCHEMU-AL00CN",
453
- PHEMU_FD00 = "PHEMU-FD00",
454
- PHEMU_FD01 = "PHEMU-FD01",
455
- PHEMU_FD02 = "PHEMU-FD02",
456
- PHEMU_FD06 = "PHEMU-FD06",
457
- PCEMU_FD00 = "PCEMU-FD00",
458
- PCEMU_FD05 = "PCEMU-FD05"
459
- }
460
- type DeployedDevModel = 'MCHEMU-AL00CN' | 'PHEMU-FD00' | 'PHEMU-FD01' | 'PHEMU-FD02' | 'PHEMU-FD06' | 'PCEMU-FD00' | 'PCEMU-FD05' | DevModel | (string & {});
461
- type ProductNameable<T> = T & {
462
- /**
463
- * The name of the product.
464
- *
465
- * @example 'Mate 80 Pro Max、Mate 80 RS'
466
- */
467
- productName: string;
468
- };
469
- interface DeployedImageConfig {
763
+ interface Event<T> {
470
764
  /**
471
- * Diagonal size.
765
+ * A function that represents an event to which you subscribe by calling it with
766
+ * a listener function as argument.
472
767
  *
473
- * @example '1.6'
768
+ * @param listener The listener function will be called when the event happens.
769
+ * @param thisArgs The `this`-argument which will be used when calling the event listener.
770
+ * @param disposables An array to which a {@link Disposable} will be added.
771
+ * @returns A disposable which unsubscribes the event listener.
474
772
  */
475
- diagonalSize: string;
773
+ (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
774
+ }
775
+ //#endregion
776
+ //#region src/image-downloader.d.ts
777
+ interface ImageDownloader {
778
+ getRemoteImage(): RemoteImage;
779
+ getUrl(): string;
780
+ getCacheUri(): vscode_uri0.URI;
781
+ startDownload(): Promise<void>;
782
+ checkChecksum(): Promise<boolean>;
783
+ extract(): Promise<void>;
784
+ onDownloadProgress: Event<ImageDownloader.DownloadProgress>;
785
+ onExtractProgress: Event<ImageDownloader.ExtractProgress>;
786
+ onChecksumProgress: Event<ImageDownloader.ChecksumProgress>;
787
+ }
788
+ declare namespace ImageDownloader {
789
+ type ProgressType = 'download' | 'extract';
790
+ interface BaseProgress {
791
+ /** Relative progress increment since last report, 0~100. */
792
+ increment: number;
793
+ /** Cureent progress, 0~100. */
794
+ progress: number;
795
+ }
796
+ interface DownloadProgress extends BaseProgress {
797
+ progressType: 'download';
798
+ /** Current network speed. */
799
+ network: number;
800
+ /** Current network speed unit, 'KB' or 'MB'. */
801
+ unit: 'KB' | 'MB';
802
+ /**
803
+ * When true, indicates resume from a previous session. Consumer should set
804
+ * accumulated progress to this event's `progress` instead of adding `increment`.
805
+ */
806
+ reset?: boolean;
807
+ }
808
+ interface ExtractProgress extends BaseProgress {
809
+ progressType: 'extract';
810
+ }
811
+ interface ChecksumProgress extends BaseProgress {
812
+ progressType: 'checksum';
813
+ }
814
+ }
815
+ //#endregion
816
+ //#region src/sdk-list.d.ts
817
+ declare namespace SDKList {
818
+ type OS = 'windows' | 'mac' | 'linux';
819
+ type Arch = 'x86' | 'arm64';
820
+ interface Request {
821
+ /**
822
+ * The architecture of the operating system.
823
+ */
824
+ readonly osArch: Arch;
825
+ /**
826
+ * The type of the operating system.
827
+ */
828
+ readonly osType: OS;
829
+ /**
830
+ * The support version of the SDK.
831
+ */
832
+ readonly supportVersion: string;
833
+ }
834
+ interface RemoteImageSDK {
835
+ /** @example 'system-image,HarmonyOS-6.0.2,pc_all_x86' */
836
+ readonly path: `${string},${string},${string}`;
837
+ /** @example '22' */
838
+ readonly apiVersion: string;
839
+ /** @example 'HarmonyOS-SDK' */
840
+ readonly license: string;
841
+ /** @example '6.0.0.129' */
842
+ readonly version: string;
843
+ /** @example 'System-image-pc_all' */
844
+ readonly displayName: string;
845
+ /** @example 'HarmonyOS emulator image for pc_all' */
846
+ readonly description: string;
847
+ /** @example '0' */
848
+ readonly experimentalFlag: string;
849
+ /** @example 'Beta1' */
850
+ readonly releaseType: string;
851
+ /** @example '1.0.0' */
852
+ readonly metaVersion: string;
853
+ readonly archive: {
854
+ complete: {
855
+ size: '2234888400';
856
+ checksum: 'd4541e398b61cae48545a95e0fe5bb946d18fd497cd57892e8f8a311568ac8fe';
857
+ osArch: 'x64';
858
+ };
859
+ };
860
+ /** The additional properties. */
861
+ readonly [key: string]: unknown;
862
+ }
863
+ namespace RemoteImageSDK {
864
+ interface Archive {
865
+ complete: Archive.Complete;
866
+ }
867
+ namespace Archive {
868
+ interface Complete {
869
+ size: string;
870
+ checksum: string;
871
+ osArch: string;
872
+ }
873
+ }
874
+ }
875
+ type OptionalRemoteImageSDK = Partial<RemoteImageSDK>;
876
+ type OKResponse = RemoteImageSDK[];
877
+ interface ErrorResponse {
878
+ /**
879
+ * The error code.
880
+ */
881
+ readonly code: number;
882
+ /**
883
+ * The error message.
884
+ */
885
+ readonly body: string;
886
+ }
887
+ type AxiosResponse = axios.AxiosResponse<OKResponse>;
888
+ type AxiosError = axios.AxiosError<ErrorResponse>;
889
+ type Result = AxiosResponse | AxiosError;
890
+ function isOKResponse(result: Result): result is AxiosResponse;
891
+ class SDKListError extends Error {
892
+ readonly code: SDKListError.Code;
893
+ readonly message: string;
894
+ readonly cause?: (AxiosError | AxiosResponse) | undefined;
895
+ constructor(code: SDKListError.Code, message: string, cause?: (AxiosError | AxiosResponse) | undefined);
896
+ }
897
+ namespace SDKListError {
898
+ enum Code {
899
+ VALIDATION_ERROR = 400,
900
+ REQUEST_ERROR = 500
901
+ }
902
+ }
903
+ }
904
+ //#endregion
905
+ //#region src/images/remote-image.d.ts
906
+ interface RemoteImage extends Serializable<RemoteImage.Serializable>, Omit<BaseImage, 'toJSON'> {
907
+ readonly imageType: 'remote';
476
908
  /**
477
- * Density.
909
+ * Get the remote image SDK.
478
910
  *
479
- * @example '320'
911
+ * @returns The remote image SDK.
480
912
  */
481
- density: string;
913
+ getRemoteImageSDK(): SDKList.OptionalRemoteImageSDK;
482
914
  /**
483
- * Resolution height.
915
+ * Get the local image if it is already downloaded.
484
916
  *
485
- * @example '466'
917
+ * @param force - If `true` will reload the local image from the image manager and file system again. Default is `false`.
918
+ * @returns The local image if it is already downloaded, otherwise `undefined`.
486
919
  */
487
- resolutionHeight: string;
920
+ getLocalImage(force?: boolean): Promise<LocalImage | undefined>;
488
921
  /**
489
- * Resolution width.
922
+ * Create a downloader for the remote image.
490
923
  *
491
- * @example '466'
924
+ * @param signals - The signals to abort the download.
492
925
  */
493
- resolutionWidth: string;
926
+ createDownloader(signals?: AbortController): Promise<ImageDownloader>;
494
927
  }
495
- interface DeployedImageConfigWithProductName extends DeployedImageConfig {
496
- /**
497
- * The name of the product.
498
- *
499
- * @example 'Mate 80 Pro Max、Mate 80 RS'
500
- */
501
- productName: string;
928
+ declare namespace RemoteImage {
929
+ interface Serializable extends BaseImage.Serializable, BaseSerializable<RemoteImage> {}
930
+ function is(value: unknown): value is RemoteImage;
502
931
  }
503
- interface DeployedImageOptions extends DeployedImageConfig {
504
- /**
505
- * RAM size.
506
- *
507
- * @example '4096'
508
- */
509
- 'memoryRamSize': string;
932
+ //#endregion
933
+ //#region src/images/image.d.ts
934
+ type Image = LocalImage | RemoteImage;
935
+ declare namespace Image {
936
+ type RelativePath = `system-image/${string}/${string}`;
937
+ function is(value: unknown): value is Image;
938
+ }
939
+ //#endregion
940
+ //#region src/images/base-image.d.ts
941
+ interface BaseImage extends Serializable<BaseImage.Serializable> {
510
942
  /**
511
- * CPU number.
512
- *
513
- * @example '4'
943
+ * The type of the image.
514
944
  */
515
- 'cpuNumber': string;
945
+ readonly imageType: 'local' | 'remote';
516
946
  /**
517
- * Data disk size.
518
- *
519
- * @example '6144'
947
+ * Get the image manager.
520
948
  */
521
- 'dataDiskSize': string;
949
+ getImageManager(): ImageManager;
522
950
  /**
523
- * Deployed name.
524
- *
525
- * @example 'Huawei_Wearable'
951
+ * Get the relative path of the image.
526
952
  */
527
- 'name': string;
953
+ getRelativePath(): Image.RelativePath;
528
954
  /**
529
- * UUID.
530
- *
531
- * @example 'ce454934-3a1b-4770-9838-dc85c5d7b6c1'
955
+ * Get the full path of the image.
532
956
  */
533
- 'uuid': string;
957
+ getFullPath(): vscode_uri0.URI;
534
958
  /**
535
- * OpenHarmony/HarmonyOS version.
536
- *
537
- * @example '6.0.1'
959
+ * Check if the image is downloaded.
538
960
  */
539
- 'hw.apiName': string;
961
+ isDownloaded(): Promise<boolean>;
540
962
  /**
541
- * Device model.
542
- *
543
- * @example 'MCHEMU-AL00CN'
963
+ * Get the API version of the image.
544
964
  */
545
- 'devModel'?: DeployedDevModel;
965
+ getApiVersion(): number;
546
966
  /**
547
- * Model.
548
- *
549
- * @example 'Mate 80 Pro Max、Mate 80 RS'
967
+ * Get the device type of the image.
550
968
  */
551
- 'model'?: string;
969
+ getFullDeviceType(): EmulatorFile.FullDeviceTypeWithString;
552
970
  }
553
- interface FullDeployedImageOptions extends DeployedImageOptions {
554
- /**
555
- * Image directory.
556
- *
557
- * @example 'system-image/HarmonyOS-6.0.1/wearable_arm/'
558
- */
559
- 'imageDir': string;
971
+ declare namespace BaseImage {
972
+ interface Serializable extends BaseSerializable<BaseImage> {
973
+ imageType: 'local' | 'remote';
974
+ }
975
+ function is(value: unknown): value is BaseImage;
976
+ }
977
+ //#endregion
978
+ //#region src/images/local-image.d.ts
979
+ interface LocalImage extends Serializable<LocalImage.Serializable>, Omit<BaseImage, 'toJSON'> {
980
+ readonly imageType: 'local';
560
981
  /**
561
- * Image SDK version.
982
+ * Get the SDK package file.
562
983
  *
563
- * @example '6.0.0.112'
984
+ * @returns The SDK package file.
564
985
  */
565
- 'version': string;
986
+ getSdkPkgFile(): LocalImage.OptionalSdkPkgFile;
566
987
  /**
567
- * Device type.
988
+ * Create a device from the local image.
568
989
  *
569
- * @example 'wearable', 'phone', 'tablet'
990
+ * @param options - The options to create the device.
570
991
  */
571
- 'type': SnakecaseDeviceType;
992
+ createDevice<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']>(options: LocalImage.CreateDeviceOptions<ProductDeviceType, ProductName>): Promise<Device<ProductDeviceType, ProductName>>;
993
+ }
994
+ declare namespace LocalImage {
995
+ interface Serializable extends BaseImage.Serializable, BaseSerializable<LocalImage> {}
996
+ interface SdkPkgFile {
997
+ /**
998
+ * The SDK package file data.
999
+ */
1000
+ readonly data: SdkPkgFile.Data;
1001
+ }
1002
+ namespace SdkPkgFile {
1003
+ interface Data {
1004
+ /** @example '13' */
1005
+ readonly apiVersion: string;
1006
+ /** @example 'System-image-foldable' */
1007
+ readonly displayName: string;
1008
+ /** @example 'system-image,HarmonyOS-5.0.1,foldable_arm' */
1009
+ readonly path: string;
1010
+ /** @example '5.0.1' */
1011
+ readonly platformVersion: string;
1012
+ /** @example 'Release' */
1013
+ readonly releaseType: string;
1014
+ /** @example '5.0.0.112' */
1015
+ readonly version: string;
1016
+ /** @example 'HarmonyOS 5.0.0.112(SP2)' */
1017
+ readonly guestVersion: string;
1018
+ /** @example 'Release' */
1019
+ readonly stage: string;
1020
+ }
1021
+ }
1022
+ type OptionalSdkPkgFile = DeepPartial<SdkPkgFile>;
1023
+ interface InfoFile {
1024
+ /** @example '21' */
1025
+ apiVersion: string;
1026
+ /** @example 'arm' */
1027
+ abi: string;
1028
+ /** @example '6.0.0.112' */
1029
+ version: string;
1030
+ }
1031
+ interface CreateDeviceOptions<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> {
1032
+ /**
1033
+ * The name of the device.
1034
+ *
1035
+ * @example 'Huawei_Wearable'
1036
+ */
1037
+ readonly name: string;
1038
+ /**
1039
+ * The CPU number.
1040
+ *
1041
+ * @example 4
1042
+ */
1043
+ readonly cpuNumber: number;
1044
+ /**
1045
+ * The memory RAM size. (in MB)
1046
+ *
1047
+ * @example 4096
1048
+ */
1049
+ readonly memoryRamSize: number;
1050
+ /**
1051
+ * The data disk size. (in MB)
1052
+ *
1053
+ * @example 6144
1054
+ */
1055
+ readonly dataDiskSize: number;
1056
+ /**
1057
+ * The screen.
1058
+ */
1059
+ readonly screen: ScreenPreset.Options<ProductDeviceType, ProductName>;
1060
+ /**
1061
+ * The vendor country.
1062
+ *
1063
+ * @example 'CN'
1064
+ */
1065
+ readonly vendorCountry?: string;
1066
+ /**
1067
+ * @default true
1068
+ */
1069
+ readonly isPublic?: boolean;
1070
+ }
1071
+ function is(value: unknown): value is LocalImage;
1072
+ }
1073
+ //#endregion
1074
+ //#region src/options.d.ts
1075
+ type ResolvedImageManagerAdapter = Required<ImageManager.Adapter>;
1076
+ type ResolvedImageManagerOptions = Omit<Required<ImageManager.Options>, 'imageBasePath' | 'deployedPath' | 'cachePath' | 'sdkPath' | 'configPath' | 'logPath' | 'emulatorPath'> & {
1077
+ adapter: ResolvedImageManagerAdapter;
1078
+ imageBasePath: vscode_uri0.URI;
1079
+ deployedPath: vscode_uri0.URI;
1080
+ cachePath: vscode_uri0.URI;
1081
+ sdkPath: vscode_uri0.URI;
1082
+ configPath: vscode_uri0.URI;
1083
+ logPath: vscode_uri0.URI;
1084
+ emulatorPath: vscode_uri0.URI;
1085
+ };
1086
+ //#endregion
1087
+ //#region src/image-manager.d.ts
1088
+ declare namespace ImageManager {
1089
+ interface Adapter {
1090
+ os?: Pick<typeof node_os0, 'homedir'>;
1091
+ fs?: FileSystem;
1092
+ join?: typeof vscode_uri0.Utils.joinPath;
1093
+ URI?: typeof vscode_uri0.URI;
1094
+ dirname?: typeof vscode_uri0.Utils.dirname;
1095
+ basename?: typeof vscode_uri0.Utils.basename;
1096
+ toWeb?: typeof node_stream0.Readable.toWeb;
1097
+ fromWeb?: typeof node_stream0.Readable.fromWeb;
1098
+ process?: Pick<typeof node_process0, 'platform' | 'env' | 'arch'>;
1099
+ crypto?: Pick<typeof node_crypto0, 'createHash' | 'randomUUID'>;
1100
+ child_process?: Pick<typeof node_child_process0, 'spawn'>;
1101
+ axios?: axios.AxiosInstance;
1102
+ isAxiosError?(error: unknown): error is axios.AxiosError;
1103
+ unzipper?: typeof unzipper;
1104
+ }
1105
+ interface Options {
1106
+ /**
1107
+ * The base path to store the images.
1108
+ */
1109
+ imageBasePath?: string | vscode_uri0.URI;
1110
+ /**
1111
+ * The path to store the deployed images.
1112
+ */
1113
+ deployedPath?: string | vscode_uri0.URI;
1114
+ /**
1115
+ * The base path to store the downloaded images zip files.
1116
+ *
1117
+ * @default `imageBasePath/cache`
1118
+ */
1119
+ cachePath?: string | vscode_uri0.URI;
1120
+ /**
1121
+ * The path to store the HarmonyOS SDK.
1122
+ *
1123
+ * - In macOS, it will be `/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony` by default;
1124
+ * - In Windows, it will be `C:\Program Files\Huawei\DevEco Studio\sdk\default\openharmony` by default;
1125
+ * - In other platforms, it will be `~/.huawei/Sdk/default/openharmony` by default.
1126
+ */
1127
+ sdkPath?: string | vscode_uri0.URI;
1128
+ /**
1129
+ * The path to store the HarmonyOS configuration files.
1130
+ *
1131
+ * - In macOS, it will be `~/Library/Application Support/Huawei/DevEcoStudio6.0` by default;
1132
+ * - In Windows, it will be `%APPDATA%\Roaming\Huawei\DevEcoStudio6.0` by default;
1133
+ * - In other platforms, it will be `~/.huawei/DevEcoStudio6.0` by default.
1134
+ */
1135
+ configPath?: string | vscode_uri0.URI;
1136
+ /**
1137
+ * The path to store the HarmonyOS log files.
1138
+ *
1139
+ * - In macOS, it will be `~/Library/Logs/Huawei/DevEcoStudio6.0` by default;
1140
+ * - In Windows, it will be `%APPDATA%\Local\Huawei\DevEcoStudio6.0\log` by default;
1141
+ * - In other platforms, it will be `~/.huawei/DevEcoStudio6.0/log` by default.
1142
+ */
1143
+ logPath?: string | vscode_uri0.URI;
1144
+ /**
1145
+ * The folder to store the emulator executable files.
1146
+ *
1147
+ * It must contain the `Emulator` (In windows, it will be `Emulator.exe`) executable file.
1148
+ *
1149
+ * - In macOS, it will be `/Applications/DevEco-Studio.app/Contents/tools/emulator`;
1150
+ * - In Windows, it will be `C:\Program Files\Huawei\DevEco Studio\tools\emulator`;
1151
+ * - In other platforms, it will be `~/.huawei/Emulator`.
1152
+ */
1153
+ emulatorPath?: string | vscode_uri0.URI;
1154
+ /**
1155
+ * The platform-specific adapters.
1156
+ */
1157
+ adapter?: ImageManager.Adapter;
1158
+ }
1159
+ interface Serializable extends BaseSerializable<ImageManager> {}
1160
+ }
1161
+ interface ImageManager extends Serializable<ImageManager.Serializable> {
572
1162
  /**
573
- * Architecture.
574
- *
575
- * @example 'arm'
1163
+ * Get the resolved image manager options.
576
1164
  */
577
- 'abi': string;
1165
+ getOptions(): ResolvedImageManagerOptions;
578
1166
  /**
579
- * API version.
580
- *
581
- * @example '21'
1167
+ * Get the operating system of the current image manager.
582
1168
  */
583
- 'apiVersion': string;
1169
+ getOperatingSystem(): SDKList.OS;
584
1170
  /**
585
- * Deployed path.
586
- *
587
- * @example '/Users/xxx/.Huawei/Emulator/deployed/Huawei_Wearable'
1171
+ * Get the architecture of the current image manager.
588
1172
  */
589
- 'path': string;
1173
+ getArch(): SDKList.Arch;
590
1174
  /**
591
- * Show version.
592
- *
593
- * @example 'HarmonyOS 6.0.1(21)'
1175
+ * Get local images.
594
1176
  */
595
- 'showVersion': string;
1177
+ getLocalImages(): Promise<LocalImage[]>;
596
1178
  /**
597
- * HarmonyOS version.
1179
+ * Get remote images.
598
1180
  *
599
- * @example 'HarmonyOS-6.0.1'
1181
+ * @param supportVersion - The support version of the SDK. If not provided, the default value is `6.0-hos-single-9`.
600
1182
  */
601
- 'harmonyOSVersion'?: string;
1183
+ getRemoteImages(supportVersion?: string): Promise<RemoteImage[] | SDKList.SDKListError>;
602
1184
  /**
603
- * Guest version.
1185
+ * Get downloaded remote images.
604
1186
  *
605
- * @example 'HarmonyOS 6.0.1(21)'
1187
+ * @param supportVersion - The support version of the SDK. If not provided, the default value is `6.0-hos-single-9`.
606
1188
  */
607
- 'guestVersion'?: string;
1189
+ getDownloadedRemoteImages(supportVersion?: string): Promise<RemoteImage[] | SDKList.SDKListError>;
608
1190
  /**
609
- * Cover resolution width.
610
- *
611
- * @example '2472'
1191
+ * Check if the emulator is compatible with current image manager.
612
1192
  */
613
- 'coverResolutionWidth'?: string;
1193
+ isCompatible(): Promise<boolean>;
614
1194
  /**
615
- * Cover resolution height.
616
- *
617
- * @example '1648'
1195
+ * Get the `lists.json` file path.
618
1196
  */
619
- 'coverResolutionHeight'?: string;
1197
+ getListsFilePath(): vscode_uri0.URI;
620
1198
  /**
621
- * Cover diagonal size.
1199
+ * Read the `lists.json` file.
622
1200
  *
623
- * @example '13.0'
1201
+ * @returns The `lists.json` file.
624
1202
  */
625
- 'coverDiagonalSize'?: string;
1203
+ readListsFile(): Promise<ListsFile>;
626
1204
  /**
627
- * HarmonyOS SDK path.
1205
+ * Read the `emulator.json` file.
628
1206
  *
629
- * @example '/Applications/DevEco-Studio.app/Contents/sdk'
1207
+ * @returns The `emulator.json` file.
630
1208
  */
631
- 'harmonyos.sdk.path': string;
1209
+ readEmulatorFile(): Promise<EmulatorFile>;
632
1210
  /**
633
- * HarmonyOS config path.
1211
+ * Read the `product-config.json` file.
634
1212
  *
635
- * @example '/Users/xxx/Library/Application Support/Huawei/DevEcoStudio6.0'
1213
+ * @returns The `product-config.json` file.
636
1214
  */
637
- 'harmonyos.config.path': string;
1215
+ readProductConfigFile(): Promise<ProductConfigFile>;
638
1216
  /**
639
- * HarmonyOS log path.
640
- *
641
- * @example '/Users/xxx/Library/Logs/Huawei/DevEcoStudio6.0'
1217
+ * Get deployed devices.
642
1218
  */
643
- 'harmonyos.log.path': string;
1219
+ getDeployedDevices(): Promise<Device[]>;
644
1220
  }
1221
+ declare function createImageManager(options: ImageManager.Options): Promise<ImageManager>;
645
1222
  //#endregion
646
- //#region src/devices/device.d.ts
647
- interface Device {
648
- getOptions(): Device.Options;
649
- getScreen(): Screen;
650
- getScreenPreset(): ScreenPreset | undefined;
651
- getImage(): LocalImage;
652
- setUuid(uuid: Device.UUID): this;
653
- getUuid(): Device.UUID;
654
- buildList(): FullDeployedImageOptions;
655
- buildIni(): Record<string, string | undefined>;
656
- toIniString(): string;
657
- deploy(): Promise<void>;
658
- delete(): Promise<void>;
659
- isDeployed(): Promise<boolean>;
660
- toJSON(): Device.Stringifiable;
1223
+ //#region src/common/serializable-file.d.ts
1224
+ interface SerializableFile extends Serializable<SerializableFile.Serializable>, SerializableContent<SerializableFile.Content> {
1225
+ getImageManager(): ImageManager;
1226
+ /** Serialize the serializable file to a string. */
1227
+ serialize(): Promise<string>;
1228
+ /** Write the serialized content to the file system. */
1229
+ write(): Promise<void>;
661
1230
  }
662
- declare namespace Device {
663
- type UUID = `${string}-${string}-${string}-${string}-${string}`;
664
- interface Options {
665
- name: string;
666
- cpuNumber: number;
667
- diskSize: number;
668
- memorySize: number;
669
- screen: Screen | ScreenPreset;
670
- }
671
- interface IniOptions {
672
- /** @default CN */
673
- vendorCountry?: string;
674
- /** @default true */
675
- isPublic?: boolean;
676
- /** Override the ini options. */
677
- overrides?: Record<string, string | undefined>;
678
- }
679
- interface Stringifiable extends Omit<Options, 'screen'> {
680
- list: FullDeployedImageOptions;
681
- ini: Record<string, string | undefined>;
682
- }
1231
+ declare namespace SerializableFile {
1232
+ type Content = SerializableContent.Content;
1233
+ interface Serializable extends BaseSerializable<SerializableFile> {}
1234
+ }
1235
+ //#endregion
1236
+ //#region src/configs/config-ini/config-ini.d.ts
1237
+ interface ConfigIniFile<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Serializable<ConfigIniFile.Serializable>, Omit<SerializableFile, 'toJSON'> {
1238
+ getDevice(): Device<ProductDeviceType, ProductName>;
1239
+ getFileUri(): vscode_uri0.URI;
1240
+ }
1241
+ declare namespace ConfigIniFile {
1242
+ type Content = Record<string, string | undefined>;
1243
+ type GenericContent<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> = Content & {
1244
+ productModel: ProductName;
1245
+ };
1246
+ interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<ConfigIniFile<ProductDeviceType, ProductName>>, 'device'> {}
1247
+ function is(value: unknown): value is ConfigIniFile;
1248
+ }
1249
+ //#endregion
1250
+ //#region src/configs/named-ini/named-ini.d.ts
1251
+ interface NamedIniFile<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Serializable<NamedIniFile.Serializable>, Omit<SerializableFile, 'toJSON'> {
1252
+ getDevice(): Device<ProductDeviceType, ProductName>;
1253
+ getFileUri(): vscode_uri0.URI;
1254
+ }
1255
+ declare namespace NamedIniFile {
1256
+ type Content = Record<string, string>;
1257
+ interface Serializable<ProductDeviceType extends ProductConfigFile.DeviceType = ProductConfigFile.DeviceType, ProductName extends ProductConfigFile.GenericContent<ProductDeviceType>['name'] = ProductConfigFile.GenericContent<ProductDeviceType>['name']> extends Omit<BaseSerializable<NamedIniFile<ProductDeviceType, ProductName>>, 'device'> {}
1258
+ function is(value: unknown): value is NamedIniFile;
683
1259
  }
684
1260
  //#endregion
685
- export { Arch, BaseEmulatorConfigItem, CoverScreen, DeployError, DeployedDevModel, DeployedImageConfig, DeployedImageConfigWithProductName, DeployedImageOptions, DevModel, Device, DeviceType, DoubleScreen, EmulatorConfig, EmulatorConfigItem, EmulatorPreset, FullDeployedImageOptions, GroupPCAllEmulatorConfigItem, GroupPhoneAllEmulatorConfigItem, Image, type ImageManager, type ImageManagerOptions, ImageType, LocalImage, OS, OuterDoubleScreen, OuterScreen, PCAllEmulatorConfigItem, PCAllSnakecaseDeviceType, ParentEmulatorConfigItem, ParentEmulatorSnakecaseDeviceType, PascalCaseDeviceType, PhoneAllEmulatorConfigItem, PhoneAllSnakecaseDeviceType, type ProductConfig, ProductConfigItem, ProductNameable, ProductPreset, RemoteImage, RequestUrlError, Screen, ScreenPreset, SingleScreen, SnakecaseDeviceType, Stringifiable, createCoverScreen, createDoubleScreen, createImageManager, createOuterDoubleScreen, createOuterScreen, createScreen, createScreenPreset, createSingleScreen, isPCAllSnakecaseDeviceType, isPhoneAllSnakecaseDeviceType, version };
1261
+ export { BaseImage, BaseSerializable, ConfigIniFile, CustomizeFoldableScreen, CustomizeScreen, DeepPartial, Device, EmulatorBasicItem, EmulatorFile, EmulatorFoldItem, EmulatorGroupItem, EmulatorTripleFoldItem, Image, type ImageManager, ListsFile, ListsFileItem, LocalImage, NamedIniFile, ProductConfigFile, ProductConfigItem, RemoteImage, SDKList, ScreenPreset, Serializable, createImageManager, version };