/** * Canonical mapper between PluginUpdateInfo and CachedUpdateResult. * * Before v2.11.3 this logic existed in two places — src/workflows/update-check.ts * (with Plugin context for sourceId fallback + sha-length inference) and * src/ui/hooks/useUpdates.ts (without Plugin context, no length inference) — * which caused the cache to be written twice per check with subtly different * values, the second write strictly worse than the first. * * Single source of truth lives here; both call sites import from this module. * * ## Single-writer rule * * Only one site should call `cache.mergeUpdateResults` per check run. * The workflow class (UpdateChecker.checkAllAndCache) is the canonical writer because * it carries Plugin context. UI hooks should NOT re-save the same data. * (Phase 4: the batch write merges by plugin — `saveUpdateResults` replace * semantics wiped entries for plugins not re-checked in a partial run.) */ import type { Plugin, PluginUpdateInfo } from '../core/types/index.js'; import type { CachedUpdateResult } from './types.js'; /** * Map a hash string to its named field by length. Used on the load path so * cached checksums can be re-attached to the correct field on PluginInfo. */ export declare function inferChecksumField(hash: string | undefined): Record; /** * Convert a PluginUpdateInfo to a CachedUpdateResult for storage. * * @param info - The update info to cache. * @param plugin - Optional Plugin context. When provided, source/sourceId fall * back to plugin.type / getSourceIdentifier(plugin) for stronger identity. * Workflow callers (UpdateChecker) always pass this; UI callers can omit it. */ export declare function toCachedResult(info: PluginUpdateInfo, plugin?: Plugin): CachedUpdateResult; /** * Convert a CachedUpdateResult back to a PluginUpdateInfo on the load path. * Uses {@link inferChecksumField} to attach the cached checksum to the right * named field. */ export declare function fromCachedResult(pluginName: string, cached: CachedUpdateResult): PluginUpdateInfo; //# sourceMappingURL=update-result-mapper.d.ts.map