1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21import { AbilityInfo } from './AbilityInfo'; 22import { ExtensionAbilityInfo } from './ExtensionAbilityInfo'; 23import { Metadata } from './Metadata'; 24import bundleManager from './../@ohos.bundle.bundleManager'; 25 26/** 27 * Obtains configuration information about a hap module. 28 * 29 * @typedef HapModuleInfo 30 * @syscap SystemCapability.BundleManager.BundleFramework.Core 31 * @since 9 32 */ 33/** 34 * Obtains configuration information about a hap module. 35 * 36 * @typedef HapModuleInfo 37 * @syscap SystemCapability.BundleManager.BundleFramework.Core 38 * @crossplatform 39 * @since 10 40 */ 41/** 42 * Obtains configuration information about a hap module. 43 * 44 * @typedef HapModuleInfo 45 * @syscap SystemCapability.BundleManager.BundleFramework.Core 46 * @crossplatform 47 * @atomicservice 48 * @since 11 49 */ 50export interface HapModuleInfo { 51 /** 52 * Indicates the name of this hap module 53 * 54 * @type { string } 55 * @syscap SystemCapability.BundleManager.BundleFramework.Core 56 * @since 9 57 */ 58 /** 59 * Indicates the name of this hap module 60 * 61 * @type { string } 62 * @syscap SystemCapability.BundleManager.BundleFramework.Core 63 * @crossplatform 64 * @since 10 65 */ 66 /** 67 * Indicates the name of this hap module 68 * 69 * @type { string } 70 * @syscap SystemCapability.BundleManager.BundleFramework.Core 71 * @crossplatform 72 * @atomicservice 73 * @since 11 74 */ 75 readonly name: string; 76 77 /** 78 * Indicates the icon of this hap module 79 * 80 * @type { string } 81 * @syscap SystemCapability.BundleManager.BundleFramework.Core 82 * @since 9 83 */ 84 /** 85 * Indicates the icon of this hap module 86 * 87 * @type { string } 88 * @syscap SystemCapability.BundleManager.BundleFramework.Core 89 * @crossplatform 90 * @since 10 91 */ 92 /** 93 * Indicates the icon of this hap module 94 * 95 * @type { string } 96 * @syscap SystemCapability.BundleManager.BundleFramework.Core 97 * @crossplatform 98 * @atomicservice 99 * @since 11 100 */ 101 readonly icon: string; 102 103 /** 104 * Indicates the icon id of this hap module 105 * 106 * @type { number } 107 * @syscap SystemCapability.BundleManager.BundleFramework.Core 108 * @since 9 109 */ 110 /** 111 * Indicates the icon id of this hap module 112 * 113 * @type { number } 114 * @syscap SystemCapability.BundleManager.BundleFramework.Core 115 * @crossplatform 116 * @since 10 117 */ 118 /** 119 * Indicates the icon id of this hap module 120 * 121 * @type { number } 122 * @syscap SystemCapability.BundleManager.BundleFramework.Core 123 * @crossplatform 124 * @atomicservice 125 * @since 11 126 */ 127 readonly iconId: number; 128 129 /** 130 * Indicates the label of this hap module 131 * 132 * @type { string } 133 * @syscap SystemCapability.BundleManager.BundleFramework.Core 134 * @since 9 135 */ 136 /** 137 * Indicates the label of this hap module 138 * 139 * @type { string } 140 * @syscap SystemCapability.BundleManager.BundleFramework.Core 141 * @crossplatform 142 * @since 10 143 */ 144 /** 145 * Indicates the label of this hap module 146 * 147 * @type { string } 148 * @syscap SystemCapability.BundleManager.BundleFramework.Core 149 * @crossplatform 150 * @atomicservice 151 * @since 11 152 */ 153 readonly label: string; 154 155 /** 156 * Indicates the label id of this hap module 157 * 158 * @type { number } 159 * @syscap SystemCapability.BundleManager.BundleFramework.Core 160 * @since 9 161 */ 162 /** 163 * Indicates the label id of this hap module 164 * 165 * @type { number } 166 * @syscap SystemCapability.BundleManager.BundleFramework.Core 167 * @crossplatform 168 * @since 10 169 */ 170 /** 171 * Indicates the label id of this hap module 172 * 173 * @type { number } 174 * @syscap SystemCapability.BundleManager.BundleFramework.Core 175 * @crossplatform 176 * @atomicservice 177 * @since 11 178 */ 179 readonly labelId: number; 180 181 /** 182 * Describes the hap module 183 * 184 * @type { string } 185 * @syscap SystemCapability.BundleManager.BundleFramework.Core 186 * @since 9 187 */ 188 /** 189 * Describes the hap module 190 * 191 * @type { string } 192 * @syscap SystemCapability.BundleManager.BundleFramework.Core 193 * @crossplatform 194 * @since 10 195 */ 196 /** 197 * Describes the hap module 198 * 199 * @type { string } 200 * @syscap SystemCapability.BundleManager.BundleFramework.Core 201 * @crossplatform 202 * @atomicservice 203 * @since 11 204 */ 205 readonly description: string; 206 207 /** 208 * Indicates the description of this hap module 209 * 210 * @type { number } 211 * @syscap SystemCapability.BundleManager.BundleFramework.Core 212 * @since 9 213 */ 214 /** 215 * Indicates the description of this hap module 216 * 217 * @type { number } 218 * @syscap SystemCapability.BundleManager.BundleFramework.Core 219 * @crossplatform 220 * @since 10 221 */ 222 /** 223 * Indicates the description of this hap module 224 * 225 * @type { number } 226 * @syscap SystemCapability.BundleManager.BundleFramework.Core 227 * @crossplatform 228 * @atomicservice 229 * @since 11 230 */ 231 readonly descriptionId: number; 232 233 /** 234 * Indicates main elementName of the hap module 235 * 236 * @type { string } 237 * @syscap SystemCapability.BundleManager.BundleFramework.Core 238 * @since 9 239 */ 240 /** 241 * Indicates main elementName of the hap module 242 * 243 * @type { string } 244 * @syscap SystemCapability.BundleManager.BundleFramework.Core 245 * @crossplatform 246 * @since 10 247 */ 248 /** 249 * Indicates main elementName of the hap module 250 * 251 * @type { string } 252 * @syscap SystemCapability.BundleManager.BundleFramework.Core 253 * @crossplatform 254 * @atomicservice 255 * @since 11 256 */ 257 readonly mainElementName: string; 258 259 /** 260 * Obtains configuration information about abilities 261 * 262 * @type { Array<AbilityInfo> } 263 * @syscap SystemCapability.BundleManager.BundleFramework.Core 264 * @since 9 265 */ 266 /** 267 * Obtains configuration information about abilities 268 * 269 * @type { Array<AbilityInfo> } 270 * @syscap SystemCapability.BundleManager.BundleFramework.Core 271 * @crossplatform 272 * @since 10 273 */ 274 /** 275 * Obtains configuration information about abilities 276 * 277 * @type { Array<AbilityInfo> } 278 * @syscap SystemCapability.BundleManager.BundleFramework.Core 279 * @crossplatform 280 * @atomicservice 281 * @since 11 282 */ 283 readonly abilitiesInfo: Array<AbilityInfo>; 284 285 /** 286 * Obtains configuration information about extension abilities 287 * 288 * @type { Array<ExtensionAbilityInfo> } 289 * @syscap SystemCapability.BundleManager.BundleFramework.Core 290 * @since 9 291 */ 292 /** 293 * Obtains configuration information about extension abilities 294 * 295 * @type { Array<ExtensionAbilityInfo> } 296 * @syscap SystemCapability.BundleManager.BundleFramework.Core 297 * @atomicservice 298 * @since 11 299 */ 300 readonly extensionAbilitiesInfo: Array<ExtensionAbilityInfo>; 301 302 /** 303 * Indicates the metadata of ability 304 * 305 * @type { Array<Metadata> } 306 * @syscap SystemCapability.BundleManager.BundleFramework.Core 307 * @since 9 308 */ 309 /** 310 * Indicates the metadata of ability 311 * 312 * @type { Array<Metadata> } 313 * @syscap SystemCapability.BundleManager.BundleFramework.Core 314 * @crossplatform 315 * @since 10 316 */ 317 /** 318 * Indicates the metadata of ability 319 * 320 * @type { Array<Metadata> } 321 * @syscap SystemCapability.BundleManager.BundleFramework.Core 322 * @crossplatform 323 * @atomicservice 324 * @since 11 325 */ 326 readonly metadata: Array<Metadata>; 327 328 /** 329 * The device types that this hap module can run on 330 * 331 * @type { Array<string> } 332 * @syscap SystemCapability.BundleManager.BundleFramework.Core 333 * @since 9 334 */ 335 /** 336 * The device types that this hap module can run on 337 * 338 * @type { Array<string> } 339 * @syscap SystemCapability.BundleManager.BundleFramework.Core 340 * @atomicservice 341 * @since 11 342 */ 343 readonly deviceTypes: Array<string>; 344 345 /** 346 * Indicates whether free installation of the hap module is supported 347 * 348 * @type { boolean } 349 * @syscap SystemCapability.BundleManager.BundleFramework.Core 350 * @since 9 351 */ 352 /** 353 * Indicates whether free installation of the hap module is supported 354 * 355 * @type { boolean } 356 * @syscap SystemCapability.BundleManager.BundleFramework.Core 357 * @atomicservice 358 * @since 11 359 */ 360 readonly installationFree: boolean; 361 362 /** 363 * Indicates the hash value of the hap module 364 * 365 * @type { string } 366 * @syscap SystemCapability.BundleManager.BundleFramework.Core 367 * @since 9 368 */ 369 /** 370 * Indicates the hash value of the hap module 371 * 372 * @type { string } 373 * @syscap SystemCapability.BundleManager.BundleFramework.Core 374 * @atomicservice 375 * @since 11 376 */ 377 readonly hashValue: string; 378 379 /** 380 * Indicates the type of the module 381 * 382 * @type { bundleManager.ModuleType } 383 * @syscap SystemCapability.BundleManager.BundleFramework.Core 384 * @since 9 385 */ 386 /** 387 * Indicates the type of the module 388 * 389 * @type { bundleManager.ModuleType } 390 * @syscap SystemCapability.BundleManager.BundleFramework.Core 391 * @atomicservice 392 * @since 11 393 */ 394 readonly type: bundleManager.ModuleType; 395 396 /** 397 * Indicates the dependency module that this module depends on 398 * 399 * @type { Array<Dependency> } 400 * @syscap SystemCapability.BundleManager.BundleFramework.Core 401 * @since 9 402 */ 403 /** 404 * Indicates the dependency module that this module depends on 405 * 406 * @type { Array<Dependency> } 407 * @syscap SystemCapability.BundleManager.BundleFramework.Core 408 * @atomicservice 409 * @since 11 410 */ 411 readonly dependencies: Array<Dependency>; 412 413 /** 414 * Indicates the preload module 415 * 416 * @type { Array<PreloadItem> } 417 * @syscap SystemCapability.BundleManager.BundleFramework.Core 418 * @since 9 419 */ 420 /** 421 * Indicates the preload module 422 * 423 * @type { Array<PreloadItem> } 424 * @syscap SystemCapability.BundleManager.BundleFramework.Core 425 * @atomicservice 426 * @since 11 427 */ 428 readonly preloads: Array<PreloadItem>; 429 430 /** 431 * Indicates the menu configuration 432 * 433 * @type { string } 434 * @readonly 435 * @syscap SystemCapability.BundleManager.BundleFramework.Core 436 * @atomicservice 437 * @since 11 438 */ 439 readonly fileContextMenuConfig: string; 440 441 /** 442 * Indicates the router information of the module 443 * 444 * @type { Array<RouterItem> } 445 * @readonly 446 * @syscap SystemCapability.BundleManager.BundleFramework.Core 447 * @atomicservice 448 * @since 12 449 */ 450 readonly routerMap: Array<RouterItem>; 451 452 /** 453 * Indicates native library path. 454 * 455 * @type { string } 456 * @readonly 457 * @syscap SystemCapability.BundleManager.BundleFramework.Core 458 * @since 12 459 */ 460 readonly nativeLibraryPath: string; 461 462 /** 463 * Indicates the code path 464 * 465 * @type { string } 466 * @readonly 467 * @syscap SystemCapability.BundleManager.BundleFramework.Core 468 * @atomicservice 469 * @since 12 470 */ 471 readonly codePath: string; 472} 473 474/** 475 * Indicates the dependency 476 * 477 * @typedef Dependency 478 * @syscap SystemCapability.BundleManager.BundleFramework.Core 479 * @since 9 480 */ 481/** 482 * Indicates the dependency 483 * 484 * @typedef Dependency 485 * @syscap SystemCapability.BundleManager.BundleFramework.Core 486 * @atomicservice 487 * @since 11 488 */ 489export interface Dependency { 490 /** 491 * Indicates the module name 492 * 493 * @type { string } 494 * @syscap SystemCapability.BundleManager.BundleFramework.Core 495 * @since 9 496 */ 497 /** 498 * Indicates the module name 499 * 500 * @type { string } 501 * @syscap SystemCapability.BundleManager.BundleFramework.Core 502 * @atomicservice 503 * @since 11 504 */ 505 readonly moduleName: string; 506 507 /** 508 * Indicates the bundle name of the dependency 509 * 510 * @type { string } 511 * @syscap SystemCapability.BundleManager.BundleFramework.Core 512 * @since 10 513 */ 514 /** 515 * Indicates the bundle name of the dependency 516 * 517 * @type { string } 518 * @syscap SystemCapability.BundleManager.BundleFramework.Core 519 * @atomicservice 520 * @since 11 521 */ 522 readonly bundleName: string; 523 524 /** 525 * Indicates the version code of the dependency 526 * 527 * @type { number } 528 * @syscap SystemCapability.BundleManager.BundleFramework.Core 529 * @since 10 530 */ 531 /** 532 * Indicates the version code of the dependency 533 * 534 * @type { number } 535 * @syscap SystemCapability.BundleManager.BundleFramework.Core 536 * @atomicservice 537 * @since 11 538 */ 539 readonly versionCode: number; 540} 541 542/** 543 * Indicates the preloadItem 544 * 545 * @typedef PreloadItem 546 * @syscap SystemCapability.BundleManager.BundleFramework.Core 547 * @since 9 548 */ 549/** 550 * Indicates the preloadItem 551 * 552 * @typedef PreloadItem 553 * @syscap SystemCapability.BundleManager.BundleFramework.Core 554 * @atomicservice 555 * @since 11 556 */ 557export interface PreloadItem { 558 /** 559 * Indicates the module name need preload 560 * 561 * @type { string } 562 * @syscap SystemCapability.BundleManager.BundleFramework.Core 563 * @since 9 564 */ 565 /** 566 * Indicates the module name need preload 567 * 568 * @type { string } 569 * @syscap SystemCapability.BundleManager.BundleFramework.Core 570 * @atomicservice 571 * @since 11 572 */ 573 readonly moduleName: string; 574} 575 576/** 577 * Indicates the router item 578 * 579 * @typedef RouterItem 580 * @syscap SystemCapability.BundleManager.BundleFramework.Core 581 * @atomicservice 582 * @since 12 583 */ 584export interface RouterItem { 585 /** 586 * Indicates the name of the module to which the current page belongs 587 * 588 * @type { string } 589 * @readonly 590 * @syscap SystemCapability.BundleManager.BundleFramework.Core 591 * @atomicservice 592 * @since 12 593 */ 594 readonly name: string; 595 /** 596 * Indicates the file path of the current page within the module 597 * 598 * @type { string } 599 * @readonly 600 * @syscap SystemCapability.BundleManager.BundleFramework.Core 601 * @atomicservice 602 * @since 12 603 */ 604 readonly pageSourceFile: string; 605 /** 606 * Indicates the name of the function @Builder decorated 607 * 608 * @type { string } 609 * @readonly 610 * @syscap SystemCapability.BundleManager.BundleFramework.Core 611 * @atomicservice 612 * @since 12 613 */ 614 readonly buildFunction: string; 615 /** 616 * Indicates the json string of custom data 617 * 618 * @type { string } 619 * @readonly 620 * @syscap SystemCapability.BundleManager.BundleFramework.Core 621 * @atomicservice 622 * @since 12 623 */ 624 readonly customData: string; 625 /** 626 * Indicates the data 627 * 628 * @type { Array<DataItem> } 629 * @readonly 630 * @syscap SystemCapability.BundleManager.BundleFramework.Core 631 * @atomicservice 632 * @since 12 633 */ 634 readonly data: Array<DataItem>; 635} 636 637/** 638 * Indicates the data item defined in router item 639 * 640 * @typedef DataItem 641 * @syscap SystemCapability.BundleManager.BundleFramework.Core 642 * @atomicservice 643 * @since 12 644 */ 645export interface DataItem { 646 /** 647 * Indicates the key of the custom data item 648 * 649 * @type { string } 650 * @readonly 651 * @syscap SystemCapability.BundleManager.BundleFramework.Core 652 * @atomicservice 653 * @since 12 654 */ 655 readonly key: string; 656 /** 657 * Indicates the value of the custom data item 658 * 659 * @type { string } 660 * @readonly 661 * @syscap SystemCapability.BundleManager.BundleFramework.Core 662 * @atomicservice 663 * @since 12 664 */ 665 readonly value: string; 666}