/** * @file * * Integration-time helpers for provisioning a specific Obsidian **asar** (the * app code) into an isolated user-data directory. * * Obsidian's bootstrap loads the highest of (its shell's bundled * `resources/obsidian.asar`, the `obsidian-.asar` files in the * user-data directory). So placing an asar here only takes effect when its version is * **>= the shell's bundled version** (upgrade-only — confirmed by the Phase 0 * spike). Running an older version requires pinning the installer/shell instead * (see `obsidian-installer.ts`). */ import type { DesktopReleasesManifest } from './obsidian-version.cjs'; /** * A discovered `obsidian-.asar` file. */ export interface DiscoveredAsar { /** Absolute path to the asar file. */ readonly path: string; /** The `x.y.z` version parsed from the file name. */ readonly version: string; } /** * Copies an asar file into a user-data directory under its canonical * `obsidian-.asar` name. * * @param asarPath - Source asar path. * @param version - The asar's version (used for the destination file name). * @param userDataDirectory - Destination user-data directory. */ export declare function copyAsarIntoUserData(asarPath: string, version: string, userDataDirectory: string): void; /** * Ensures the asar for a concrete version is present in the local cache, * downloading and decompressing it if necessary. * * @param version - A concrete `x.y.z` version. * @returns The absolute path to the cached asar. * @throws Error if the download fails. */ export declare function ensureAsarCached(version: string): Promise; /** * Fetches and parses Obsidian's desktop releases manifest. * * @returns The parsed manifest. * @throws Error if the manifest cannot be fetched. */ export declare function fetchDesktopReleasesManifest(): Promise; /** * Finds the newest `obsidian-.asar` in a directory. * * @param directory - The directory to scan (e.g. the user's Obsidian config directory). * @returns The newest discovered asar, or `undefined` if none / the directory is unreadable. */ export declare function findNewestAsar(directory: string): DiscoveredAsar | undefined; /** * Returns the local cache path for a concrete version's asar (the file may not * yet exist). * * @param version - A concrete `x.y.z` version. * @returns The absolute path the asar is cached at. */ export declare function getCachedAsarPath(version: string): string; /** * Resolves a version specifier (explicit or channel alias) to a concrete * `x.y.z` version, fetching the manifest only when a channel alias is used. * * @param spec - The version specifier. * @returns The concrete version. */ export declare function resolveConcreteVersion(spec: string): Promise;