/** * Module dependency resolver + installer — the browser/Helia mirror of the Go * sdn-server `internal/deps` package (WS4.2 / WS4.4a / WS4.4b). * * Given a root module's declared PLG dependencies and a catalog that resolves a * dependency to a concrete manifest, it computes the transitive install closure * (dependency-first, topological) and drives installation so that installing A * recursively pulls and registers everything A needs — the decentralized * package manager, browser side. The same algorithm runs in the Go/Kubo node; * the concrete fetch/decrypt/register wiring is supplied by the browser runtime * (via createModuleInstaller) reusing requestEncryptedModuleBundle. */ export interface ModuleDependency { pluginId: string; /** Inclusive lower bound (semver); undefined/empty = unbounded below. */ minVersion?: string; /** Inclusive upper bound (semver); undefined/empty = unbounded above. */ maxVersion?: string; } export interface ModuleManifest { pluginId: string; version: string; dependencies?: ModuleDependency[]; } export interface ModuleCatalog { /** Resolve a dependency to the best published manifest satisfying its range. */ resolve(dep: ModuleDependency): Promise; } export interface InstalledModules { /** Installed version of pluginId, or undefined if absent. */ installedVersion(pluginId: string): string | undefined; } export interface PlanStep { pluginId: string; version: string; } export type InstallFn = (step: PlanStep) => Promise; export type DependencyErrorCode = 'cycle' | 'not_found' | 'no_satisfying_version' | 'version_conflict' | 'invalid_version'; export declare class DependencyError extends Error { readonly code: DependencyErrorCode; constructor(code: DependencyErrorCode, message: string); } /** compareSemver returns -1/0/1; throws DependencyError('invalid_version') on bad input. */ export declare function compareSemver(a: string, b: string): number; /** satisfies reports whether version is within dep's inclusive [min,max]. Fails closed. */ export declare function satisfies(version: string, dep: ModuleDependency): boolean; /** * resolveClosure walks root's transitive dependency graph and returns the * modules that must be installed, ordered so every dependency precedes its * dependents. Already-installed modules that satisfy are skipped (subtree * trusted). The root itself is never included. Throws DependencyError on a * cycle, missing/unsatisfiable dependency, incompatible diamond, or bad range. */ export declare function resolveClosure(root: ModuleManifest, installed: InstalledModules | null, catalog: ModuleCatalog): Promise; /** * installClosure resolves root's closure and installs every not-yet-installed * module dependency-first, then the root last (unless already installed). * installFn is invoked once per module actually installed. Returns the ordered * list of installed modules; rejects (after installing prior steps) on the first * installFn failure. */ export declare function installClosure(root: ModuleManifest, installed: InstalledModules | null, catalog: ModuleCatalog, installFn: InstallFn): Promise; export declare class MapModuleCatalog implements ModuleCatalog { private readonly byId; constructor(manifests?: ModuleManifest[]); add(m: ModuleManifest): void; resolve(dep: ModuleDependency): Promise; } //# sourceMappingURL=module-dependency-resolver.d.ts.map