/** * @file * * Pure helpers for resolving which GitHub release asset is the desktop * **installer** for a given Obsidian version and platform. * * Obsidian changed its installer asset naming convention partway through its * history, so a version cannot be turned into an asset name by string * templating alone: * * - **Dot** separator on older releases: `Obsidian..exe` (verified 0.14.5 * through 1.5.12), with a `-universal` infix on the macOS dmg * (`Obsidian--universal.dmg`). * - **Hyphen** separator on newer releases: `Obsidian-.exe`, * `Obsidian-.dmg` (verified 1.6.7 onward; the transition is around 1.6.0). * * The integration-time downloader (`obsidian-installer.ts`) queries the * release's real asset list and picks the platform-correct one with * {@link selectInstallerAssetName}; if that network call is unavailable it * falls back to trying every {@link buildInstallerAssetNameCandidates} form. * Both helpers are pure so the separator/arch matrix stays unit-tested (the * downloader itself needs the network and is excluded from unit tests). * * Only the x64 installer is resolved — the extraction path is x64-only — so the * 32-bit / arm64 / all-users sibling assets are deliberately rejected. * * When the version is present in the baked `metadata.json` catalog (from * the `obsidianmd/obsidian-releases` release assets), its exact installer URL is already known; * {@link selectInstallerDownloadUrl} picks the platform-correct one and the * downloader uses it directly, skipping the release-API lookup and the * name-templating fallback entirely. */ import type { ObsidianVersionDownloads } from './obsidian-metadata.mjs'; /** * Parameters for {@link buildInstallerAssetNameCandidates}. */ export interface BuildInstallerAssetNameCandidatesParams { /** The platform to build candidate names for. */ readonly platform: NodeJS.Platform; /** The concrete `x.y.z` version. */ readonly version: string; } /** * Parameters for {@link selectInstallerAssetName}. */ export interface SelectInstallerAssetNameParams { /** The release's asset names (e.g. from the GitHub release API). */ readonly assetNames: readonly string[]; /** The platform whose installer asset to select. */ readonly platform: NodeJS.Platform; /** The concrete `x.y.z` version. */ readonly version: string; } /** * Parameters for {@link selectInstallerDownloadUrl}. */ export interface SelectInstallerDownloadUrlParams { /** The version's baked download URLs, or `undefined` when it is absent from the catalog. */ readonly downloads: ObsidianVersionDownloads | undefined; /** The platform whose installer URL to select. */ readonly platform: NodeJS.Platform; } /** * Builds the fallback list of installer asset names to try when the release's * real asset list cannot be fetched, covering both separator forms (and, on * macOS, the `-universal` infix). * * @param params - The platform and version. * @returns Candidate asset names, hyphen-separated forms first. */ export declare function buildInstallerAssetNameCandidates(params: BuildInstallerAssetNameCandidatesParams): string[]; /** * Selects the platform-correct x64 installer asset name from a release's asset * list, tolerating both the dot- and hyphen-separated naming conventions and * rejecting the 32-bit / arm64 / all-users sibling assets. * * @param params - The asset list, platform, and version. * @returns The matching asset name, or `undefined` if none matches (e.g. a * catalyst release that ships no installer). */ export declare function selectInstallerAssetName(params: SelectInstallerAssetNameParams): string | undefined; /** * Selects the platform-correct x64 installer download URL from a version's * baked catalog entry. * * @param params - The baked download URLs and the platform. * @returns The installer URL for the platform, or `undefined` when the version * has no catalog entry or ships no desktop installer for it (e.g. a catalyst * build, or a Linux `.tar.gz` that was never published). */ export declare function selectInstallerDownloadUrl(params: SelectInstallerDownloadUrlParams): string | undefined;