@oniroproject/core 0.10.0 → 0.12.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/README.md CHANGED
@@ -99,7 +99,7 @@ The injection points every frontend implements, plus their defaults.
99
99
  | `getInstalledSdks` | `(config) => string[]` | Versions with at least one OS-folder install. |
100
100
  | `removeSdk` | `(config, api) => boolean` | Remove an installed SDK by API level across OS folders. |
101
101
  | `detectProjectSdkVersion` | `(projectRoot, logger?) => number \| undefined` | Read `compileSdkVersion` from a project's `build-profile.json5`. |
102
- | `ALL_SDKS` / `SdkRelease` | — | Catalog of known releases (`version`, `api`, `tarballStrip`). |
102
+ | `ALL_SDKS` / `SdkRelease` | — | Catalog of known releases (`version`, `api`, `tarballStrip`, optional `archiveSuffix`). |
103
103
  | `OHOS_URL_BASE` | — | Default SDK mirror base URL. |
104
104
  | `getOsFolder()` / `getSdkFilename(version?)` | — | Map the host platform to its OS folder / SDK archive (`SdkArchiveInfo`). |
105
105
 
@@ -182,7 +182,7 @@ The injection-safe primitives every device operation builds on (`spawn` with `sh
182
182
 
183
183
  | Export | Signature | Description |
184
184
  | --- | --- | --- |
185
- | `reboot` | `(RebootOptions) => Promise<void>` | `system` (via `param set ohos.startup.powerctrl reboot`), `bootloader`, or `recovery`. Optionally waits for a bundle to return (and reconnects a TCP target across the reboot). |
185
+ | `reboot` | `(RebootOptions) => Promise<void>` | `system` (via `param set ohos.startup.powerctrl reboot`), `bootloader`, or `recovery`. Optionally waits for a bundle to return (and reconnects a TCP target across the reboot, restarting the hdc server if it keeps the dead session). |
186
186
  | `waitForBundle` | `(WaitForBundleOptions) => Promise<void>` | Poll `pidof <bundle>` until it has a clean numeric pid. |
187
187
  | `waitForBoot` | `(WaitForBootOptions) => Promise<void>` | Poll until reachable (and optionally `untilPidOf` has a pid). Tolerant of the reboot disconnect. |
188
188
  | `waitForCondition` | `(WaitForConditionOptions) => Promise<void>` | Generic deadline + poll + heartbeat loop. A throwing probe counts as "not yet". |
@@ -265,6 +265,39 @@ The injection-safe primitives every device operation builds on (`spawn` with `sh
265
265
  | `decideInstallMethod` / `decideReboot` | — | The pure (tested) decision functions behind `applyChanges`. |
266
266
  | `diffHapAssets` / `diffEntryNames` | — | Diff two HAP archives' file manifests (drives the cache-invalidation reboot). |
267
267
 
268
+ ### HarmonyOS
269
+
270
+ HarmonyOS support is additive: a project is HarmonyOS only when its product declares
271
+ `runtimeOS: "HarmonyOS"`, and every OpenHarmony API behaves as before. `buildHap`,
272
+ `runHvigorw` and `createScaffold` pick the HarmonyOS SDK for such projects themselves.
273
+
274
+ | Export | Description |
275
+ | --- | --- |
276
+ | `detectRuntimeOs(projectDir, productName?)` | `'HarmonyOS'` or `'OpenHarmony'`, from `build-profile.json5`. |
277
+ | `findHarmonyOsSdk({ config, logger? })` / `requireHarmonyOsSdk(...)` | Locate a HarmonyOS SDK (`harmonyosSdkPath`, then DevEco Studio's default location, then `cmdToolsPath` when it is the HarmonyOS edition), with its release as `version`, e.g. `6.1.1(24)`; `null` or an actionable error when there is none. |
278
+ | `harmonyOsSdkLabelForApi(api)`, `HARMONYOS_SDK_VERSIONS` | The `"<version>(<api>)"` label HarmonyOS products declare. |
279
+ | `createHarmonyOsSession(opts)` | `login` / `logout` / `getUserInfo` / `listTeams` / `resolveAgcAuth` / `getDeveloperAgreement` for a Huawei developer account. The token is stored encrypted, with the account's region. |
280
+ | `harmonyOsAutoSign(opts)` | Keystore + CSR → AGC debug certificate → device registration → debug profile → `build-profile.json5`, reusing still-valid material. |
281
+ | `readProvisionProfile(path)` | Bundle name, team, expiry, devices and ACLs of a `.p7b`. |
282
+ | `HUAWEI_SITES` | Each region's sign-in and AppGallery Connect hosts. |
283
+
284
+ ```ts
285
+ import { createHarmonyOsSession, harmonyOsAutoSign, staticConfig } from '@oniroproject/core';
286
+
287
+ const config = staticConfig();
288
+ const session = createHarmonyOsSession({ config, onLoginUrl: (url) => console.log(url) });
289
+ if (!(await session.getUserInfo())) await session.login();
290
+
291
+ const result = await harmonyOsAutoSign({ config, session, projectDir: '/path/to/project' });
292
+ console.log(result.paths.profilePath, result.deviceIds);
293
+ ```
294
+
295
+ Signing calls private, undocumented AppGallery Connect APIs, and needs a Huawei developer
296
+ account that is real-name verified or has accepted the HUAWEI Developer Basic Service
297
+ Agreement. Accounts from every region work: calls go to the account's own region, as in
298
+ DevEco Studio. Parts of this subtree are adapted from the MIT-licensed
299
+ `openharmony-sig/deveco-cli`; see [`src/harmonyos/NOTICE.md`](src/harmonyos/NOTICE.md).
300
+
268
301
  ## Conventions
269
302
 
270
303
  - **Configuration.** Pass a `ConfigProvider`. `staticConfig({...})` is the quick path; a frontend can read settings, env vars, etc. Unset keys fall back to `defaultPaths`.