@arkts/image-manager 0.2.3 → 0.3.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/default-product-config.d.cts +1 -1
- package/dist/default-product-config.d.mts +1 -1
- package/dist/index.cjs +269 -210
- package/dist/index.d.cts +266 -43
- package/dist/index.d.mts +266 -43
- package/dist/index.mjs +267 -210
- package/dist/product-config-2xNDbvax.d.cts +72 -0
- package/dist/product-config-CDvEXtfy.d.mts +72 -0
- package/package.json +3 -1
- package/dist/product-config-BwP_DEGj.d.mts +0 -263
- package/dist/product-config-C-0AD84Q.d.cts +0 -263
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as OS, c as Stringifiable, i as DeviceType, n as ProductConfigItem, o as PascalCaseDeviceType, r as Arch, s as SnakecaseDeviceType, t as ProductConfig } from "./product-config-2xNDbvax.cjs";
|
|
2
2
|
import { AxiosProgressEvent } from "axios";
|
|
3
3
|
import { Emitter } from "mitt";
|
|
4
4
|
import * as node_child_process0 from "node:child_process";
|
|
@@ -15,14 +15,14 @@ declare let version: string;
|
|
|
15
15
|
//#region src/images/local-image.d.ts
|
|
16
16
|
interface LocalImage extends BaseImage, Stringifiable<LocalImage.Stringifiable> {
|
|
17
17
|
imageType: 'local';
|
|
18
|
-
createDevice(name: string, config: DeployedImageConfigWithProductName): Device;
|
|
19
|
-
getProductConfig(): Promise<ProductConfigItem[]>;
|
|
20
|
-
delete(): Promise<void | Error>;
|
|
21
|
-
buildStartCommand(deployer: Device): Promise<string>;
|
|
22
|
-
start(deployer: Device): Promise<node_child_process0.ChildProcess>;
|
|
23
|
-
buildStopCommand(deployer: Device): Promise<string>;
|
|
24
|
-
stop(deployer: Device): Promise<node_child_process0.ChildProcess>;
|
|
25
18
|
getDevices(): Promise<Device[]>;
|
|
19
|
+
createDevice(options: Device.Options): Device;
|
|
20
|
+
delete(): Promise<void | Error>;
|
|
21
|
+
start(device: Device): Promise<node_child_process0.ChildProcess>;
|
|
22
|
+
stop(device: Device): Promise<node_child_process0.ChildProcess>;
|
|
23
|
+
buildStartCommand(device: Device): Promise<string>;
|
|
24
|
+
buildStopCommand(device: Device): Promise<string>;
|
|
25
|
+
getProductConfig(): Promise<ProductConfigItem[]>;
|
|
26
26
|
}
|
|
27
27
|
declare namespace LocalImage {
|
|
28
28
|
interface Stringifiable extends Omit<BaseImage.Stringifiable, 'imageType'> {
|
|
@@ -187,6 +187,10 @@ interface ImageManager {
|
|
|
187
187
|
* Get the architecture.
|
|
188
188
|
*/
|
|
189
189
|
getArch(): Arch;
|
|
190
|
+
/**
|
|
191
|
+
* Check if the emulator is compatible with current image manager.
|
|
192
|
+
*/
|
|
193
|
+
isCompatible(): Promise<boolean>;
|
|
190
194
|
}
|
|
191
195
|
declare function createImageManager(options?: ImageManagerOptions): Promise<ImageManager>;
|
|
192
196
|
//#endregion
|
|
@@ -196,6 +200,7 @@ declare class DeployError extends Error {
|
|
|
196
200
|
readonly message: string;
|
|
197
201
|
readonly cause?: Error;
|
|
198
202
|
constructor(code: DeployError.Code, message: string, cause?: Error);
|
|
203
|
+
getCode(): DeployError.Code;
|
|
199
204
|
}
|
|
200
205
|
declare namespace DeployError {
|
|
201
206
|
enum Code {
|
|
@@ -221,6 +226,7 @@ interface BaseImage {
|
|
|
221
226
|
getPath(): string;
|
|
222
227
|
getArch(): 'arm' | 'x86' | (string & {});
|
|
223
228
|
getChecksum(): string;
|
|
229
|
+
getReleaseType(): string;
|
|
224
230
|
getVersion(): string;
|
|
225
231
|
getApiVersion(): string;
|
|
226
232
|
getTargetOS(): string;
|
|
@@ -250,58 +256,275 @@ declare namespace BaseImage {
|
|
|
250
256
|
type Image = LocalImage | RemoteImage;
|
|
251
257
|
type ImageType = 'local' | 'remote';
|
|
252
258
|
//#endregion
|
|
253
|
-
//#region src/
|
|
254
|
-
interface
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
259
|
+
//#region src/screens/screen.d.ts
|
|
260
|
+
interface Screen {
|
|
261
|
+
getDiagonal(): number;
|
|
262
|
+
setDiagonal(diagonal: number): this;
|
|
263
|
+
getDensity(): number;
|
|
264
|
+
setDensity(density: number): this;
|
|
265
|
+
getHeight(): number;
|
|
266
|
+
setHeight(height: number): this;
|
|
267
|
+
getWidth(): number;
|
|
268
|
+
setWidth(width: number): this;
|
|
269
|
+
toJSON(): Screen.Options;
|
|
270
|
+
}
|
|
271
|
+
declare namespace Screen {
|
|
272
|
+
interface Options {
|
|
273
|
+
diagonal: number;
|
|
274
|
+
density: number;
|
|
275
|
+
height: number;
|
|
276
|
+
width: number;
|
|
277
|
+
}
|
|
278
|
+
interface Stringifiable extends Options {}
|
|
279
|
+
}
|
|
280
|
+
declare function createScreen(options: Screen.Options): Screen;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/screens/product-preset.d.ts
|
|
283
|
+
interface ProductPreset {
|
|
284
|
+
getProductConfig(): ProductConfigItem;
|
|
285
|
+
getDeviceType(): PascalCaseDeviceType;
|
|
286
|
+
toScreen(): Screen;
|
|
287
|
+
toJSON(): ProductPreset.Stringifiable;
|
|
288
|
+
}
|
|
289
|
+
declare namespace ProductPreset {
|
|
290
|
+
interface Stringifiable {
|
|
291
|
+
product: ProductConfigItem;
|
|
292
|
+
deviceType: PascalCaseDeviceType;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
declare function createProductPreset(productConfig: ProductConfigItem, deviceType: PascalCaseDeviceType): Promise<ProductPreset>;
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/devices/list.d.ts
|
|
298
|
+
declare enum DevModel {
|
|
299
|
+
MCHEMU_AL00CN = "MCHEMU-AL00CN",
|
|
300
|
+
PHEMU_FD00 = "PHEMU-FD00",
|
|
301
|
+
PHEMU_FD01 = "PHEMU-FD01",
|
|
302
|
+
PHEMU_FD02 = "PHEMU-FD02",
|
|
303
|
+
PHEMU_FD06 = "PHEMU-FD06",
|
|
304
|
+
PCEMU_FD00 = "PCEMU-FD00",
|
|
305
|
+
PCEMU_FD05 = "PCEMU-FD05"
|
|
306
|
+
}
|
|
307
|
+
type DeployedDevModel = 'MCHEMU-AL00CN' | 'PHEMU-FD00' | 'PHEMU-FD01' | 'PHEMU-FD02' | 'PHEMU-FD06' | 'PCEMU-FD00' | 'PCEMU-FD05' | DevModel | (string & {});
|
|
308
|
+
type ProductNameable<T> = T & {
|
|
269
309
|
/**
|
|
270
|
-
*
|
|
310
|
+
* The name of the product.
|
|
271
311
|
*
|
|
272
|
-
* @
|
|
312
|
+
* @example 'Mate 80 Pro Max、Mate 80 RS'
|
|
273
313
|
*/
|
|
274
|
-
|
|
314
|
+
productName: string;
|
|
315
|
+
};
|
|
316
|
+
interface DeployedImageConfig {
|
|
275
317
|
/**
|
|
276
|
-
*
|
|
318
|
+
* Diagonal size.
|
|
277
319
|
*
|
|
278
|
-
* @
|
|
320
|
+
* @example '1.6'
|
|
279
321
|
*/
|
|
280
|
-
|
|
322
|
+
diagonalSize: string;
|
|
281
323
|
/**
|
|
282
|
-
*
|
|
324
|
+
* Density.
|
|
283
325
|
*
|
|
284
|
-
* @
|
|
326
|
+
* @example '320'
|
|
285
327
|
*/
|
|
286
|
-
|
|
328
|
+
density: string;
|
|
287
329
|
/**
|
|
288
|
-
*
|
|
330
|
+
* Resolution height.
|
|
289
331
|
*
|
|
290
|
-
* @
|
|
332
|
+
* @example '466'
|
|
291
333
|
*/
|
|
292
|
-
|
|
334
|
+
resolutionHeight: string;
|
|
293
335
|
/**
|
|
294
|
-
*
|
|
336
|
+
* Resolution width.
|
|
295
337
|
*
|
|
296
|
-
* @
|
|
338
|
+
* @example '466'
|
|
297
339
|
*/
|
|
298
|
-
|
|
340
|
+
resolutionWidth: string;
|
|
341
|
+
}
|
|
342
|
+
interface DeployedImageConfigWithProductName extends DeployedImageConfig {
|
|
299
343
|
/**
|
|
300
|
-
*
|
|
344
|
+
* The name of the product.
|
|
301
345
|
*
|
|
302
|
-
* @
|
|
346
|
+
* @example 'Mate 80 Pro Max、Mate 80 RS'
|
|
303
347
|
*/
|
|
304
|
-
|
|
348
|
+
productName: string;
|
|
349
|
+
}
|
|
350
|
+
interface DeployedImageOptions extends DeployedImageConfig {
|
|
351
|
+
/**
|
|
352
|
+
* RAM size.
|
|
353
|
+
*
|
|
354
|
+
* @example '4096'
|
|
355
|
+
*/
|
|
356
|
+
'memoryRamSize': string;
|
|
357
|
+
/**
|
|
358
|
+
* CPU number.
|
|
359
|
+
*
|
|
360
|
+
* @example '4'
|
|
361
|
+
*/
|
|
362
|
+
'cpuNumber': string;
|
|
363
|
+
/**
|
|
364
|
+
* Data disk size.
|
|
365
|
+
*
|
|
366
|
+
* @example '6144'
|
|
367
|
+
*/
|
|
368
|
+
'dataDiskSize': string;
|
|
369
|
+
/**
|
|
370
|
+
* Deployed name.
|
|
371
|
+
*
|
|
372
|
+
* @example 'Huawei_Wearable'
|
|
373
|
+
*/
|
|
374
|
+
'name': string;
|
|
375
|
+
/**
|
|
376
|
+
* UUID.
|
|
377
|
+
*
|
|
378
|
+
* @example 'ce454934-3a1b-4770-9838-dc85c5d7b6c1'
|
|
379
|
+
*/
|
|
380
|
+
'uuid': string;
|
|
381
|
+
/**
|
|
382
|
+
* OpenHarmony/HarmonyOS version.
|
|
383
|
+
*
|
|
384
|
+
* @example '6.0.1'
|
|
385
|
+
*/
|
|
386
|
+
'hw.apiName': string;
|
|
387
|
+
/**
|
|
388
|
+
* Device model.
|
|
389
|
+
*
|
|
390
|
+
* @example 'MCHEMU-AL00CN'
|
|
391
|
+
*/
|
|
392
|
+
'devModel'?: DeployedDevModel;
|
|
393
|
+
/**
|
|
394
|
+
* Model.
|
|
395
|
+
*
|
|
396
|
+
* @example 'Mate 80 Pro Max、Mate 80 RS'
|
|
397
|
+
*/
|
|
398
|
+
'model'?: string;
|
|
399
|
+
}
|
|
400
|
+
interface FullDeployedImageOptions extends DeployedImageOptions {
|
|
401
|
+
/**
|
|
402
|
+
* Image directory.
|
|
403
|
+
*
|
|
404
|
+
* @example 'system-image/HarmonyOS-6.0.1/wearable_arm/'
|
|
405
|
+
*/
|
|
406
|
+
'imageDir': string;
|
|
407
|
+
/**
|
|
408
|
+
* Image SDK version.
|
|
409
|
+
*
|
|
410
|
+
* @example '6.0.0.112'
|
|
411
|
+
*/
|
|
412
|
+
'version': string;
|
|
413
|
+
/**
|
|
414
|
+
* Device type.
|
|
415
|
+
*
|
|
416
|
+
* @example 'wearable', 'phone', 'tablet'
|
|
417
|
+
*/
|
|
418
|
+
'type': 'wearable' | 'phone' | 'tablet' | '2in1' | 'tv' | (string & {});
|
|
419
|
+
/**
|
|
420
|
+
* Architecture.
|
|
421
|
+
*
|
|
422
|
+
* @example 'arm'
|
|
423
|
+
*/
|
|
424
|
+
'abi': string;
|
|
425
|
+
/**
|
|
426
|
+
* API version.
|
|
427
|
+
*
|
|
428
|
+
* @example '21'
|
|
429
|
+
*/
|
|
430
|
+
'apiVersion': string;
|
|
431
|
+
/**
|
|
432
|
+
* Deployed path.
|
|
433
|
+
*
|
|
434
|
+
* @example '/Users/xxx/.Huawei/Emulator/deployed/Huawei_Wearable'
|
|
435
|
+
*/
|
|
436
|
+
'path': string;
|
|
437
|
+
/**
|
|
438
|
+
* Show version.
|
|
439
|
+
*
|
|
440
|
+
* @example 'HarmonyOS 6.0.1(21)'
|
|
441
|
+
*/
|
|
442
|
+
'showVersion': string;
|
|
443
|
+
/**
|
|
444
|
+
* HarmonyOS version.
|
|
445
|
+
*
|
|
446
|
+
* @example 'HarmonyOS-6.0.1'
|
|
447
|
+
*/
|
|
448
|
+
'harmonyOSVersion'?: string;
|
|
449
|
+
/**
|
|
450
|
+
* Guest version.
|
|
451
|
+
*
|
|
452
|
+
* @example 'HarmonyOS 6.0.1(21)'
|
|
453
|
+
*/
|
|
454
|
+
'guestVersion'?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Cover resolution width.
|
|
457
|
+
*
|
|
458
|
+
* @example '2472'
|
|
459
|
+
*/
|
|
460
|
+
'coverResolutionWidth'?: string;
|
|
461
|
+
/**
|
|
462
|
+
* Cover resolution height.
|
|
463
|
+
*
|
|
464
|
+
* @example '1648'
|
|
465
|
+
*/
|
|
466
|
+
'coverResolutionHeight'?: string;
|
|
467
|
+
/**
|
|
468
|
+
* Cover diagonal size.
|
|
469
|
+
*
|
|
470
|
+
* @example '13.0'
|
|
471
|
+
*/
|
|
472
|
+
'coverDiagonalSize'?: string;
|
|
473
|
+
/**
|
|
474
|
+
* HarmonyOS SDK path.
|
|
475
|
+
*
|
|
476
|
+
* @example '/Applications/DevEco-Studio.app/Contents/sdk'
|
|
477
|
+
*/
|
|
478
|
+
'harmonyos.sdk.path': string;
|
|
479
|
+
/**
|
|
480
|
+
* HarmonyOS config path.
|
|
481
|
+
*
|
|
482
|
+
* @example '/Users/xxx/Library/Application Support/Huawei/DevEcoStudio6.0'
|
|
483
|
+
*/
|
|
484
|
+
'harmonyos.config.path': string;
|
|
485
|
+
/**
|
|
486
|
+
* HarmonyOS log path.
|
|
487
|
+
*
|
|
488
|
+
* @example '/Users/xxx/Library/Logs/Huawei/DevEcoStudio6.0'
|
|
489
|
+
*/
|
|
490
|
+
'harmonyos.log.path': string;
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/devices/device.d.ts
|
|
494
|
+
interface Device {
|
|
495
|
+
getOptions(): Device.Options;
|
|
496
|
+
getImage(): LocalImage;
|
|
497
|
+
setUuid(uuid: Device.UUID): this;
|
|
498
|
+
getUuid(): Device.UUID;
|
|
499
|
+
buildList(): FullDeployedImageOptions;
|
|
500
|
+
buildIni(): Record<string, string | undefined>;
|
|
501
|
+
toIniString(): Promise<string>;
|
|
502
|
+
deploy(): Promise<void>;
|
|
503
|
+
delete(): Promise<void>;
|
|
504
|
+
isDeployed(): Promise<boolean>;
|
|
505
|
+
toJSON(): Device.Stringifiable;
|
|
506
|
+
}
|
|
507
|
+
declare namespace Device {
|
|
508
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
509
|
+
interface Options {
|
|
510
|
+
name: string;
|
|
511
|
+
cpuNumber: number;
|
|
512
|
+
diskSize: number;
|
|
513
|
+
memorySize: number;
|
|
514
|
+
screen: Screen | ProductPreset;
|
|
515
|
+
}
|
|
516
|
+
interface IniOptions {
|
|
517
|
+
/** @default CN */
|
|
518
|
+
vendorCountry?: string;
|
|
519
|
+
/** @default true */
|
|
520
|
+
isPublic?: boolean;
|
|
521
|
+
/** Override the ini options. */
|
|
522
|
+
overrides?: Record<string, string | undefined>;
|
|
523
|
+
}
|
|
524
|
+
interface Stringifiable extends Omit<Options, 'screen'> {
|
|
525
|
+
list: FullDeployedImageOptions;
|
|
526
|
+
ini: Record<string, string | undefined>;
|
|
527
|
+
}
|
|
305
528
|
}
|
|
306
529
|
//#endregion
|
|
307
|
-
export { Arch, DeployError, DeployedDevModel, DeployedImageConfig, DeployedImageConfigWithProductName, DeployedImageOptions, DevModel, Device, DeviceType, FullDeployedImageOptions, Image, type ImageManager, type ImageManagerOptions, ImageType, LocalImage, OS, PascalCaseDeviceType, type ProductConfig, type ProductConfigItem, ProductNameable, RemoteImage, RequestUrlError, SnakecaseDeviceType, Stringifiable,
|
|
530
|
+
export { Arch, DeployError, DeployedDevModel, DeployedImageConfig, DeployedImageConfigWithProductName, DeployedImageOptions, DevModel, Device, DeviceType, FullDeployedImageOptions, Image, type ImageManager, type ImageManagerOptions, ImageType, LocalImage, OS, PascalCaseDeviceType, type ProductConfig, type ProductConfigItem, ProductNameable, ProductPreset, RemoteImage, RequestUrlError, Screen, SnakecaseDeviceType, Stringifiable, createImageManager, createProductPreset, createScreen, version };
|