@arkts/image-manager 0.4.3 → 0.5.0

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