The semver string to persist (typically __APP_VERSION__).
Resolves once the write completes; errors are logged, not thrown.
await setStoredAppVersion("1.1.0");
await getStoredAppVersion(); // => "1.1.0"
export async function setStoredAppVersion(appVersion: string): Promise<void> {
try {
const db = await getDB();
await db.put(IDB_STORE.APP_META, {
id: APP_META_KEY,
appVersion,
updatedAt: Date.now(),
});
} catch (error) {
logger.error('Failed to set stored app version in IndexedDB', { error });
}
}
Record the app version that now owns the cache, overwriting the single
app_metarow. Called after migrations complete, after a fresh-install seed, and after a Cancel/reset, so the stored marker always reflects the version whose data shape is currently in IndexedDB.