Something went wrong. Try again.
Full document, spreadsheet, slideshow, and diagram tooling
Something went wrong. Try again.
1.1 kB · 41 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142/** * Backup Archive — export/import documents as JSON bundles. * * Phase 1: Delegates to local-store's export/import functions. * Documents are stored in IndexedDB with AES-256-GCM encryption keys. */
import { exportAll as localExportAll, importAll as localImportAll, EXPORT_MAGIC, EXPORT_VERSION,} from './lib/local-store.js';
export const BACKUP_MAGIC = EXPORT_MAGIC;export const BACKUP_VERSION = EXPORT_VERSION;
/** * Export all documents as a backup archive and trigger download. */export async function exportBackup(): Promise<void> { const blob = await localExportAll();
const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; const date = new Date().toISOString().slice(0, 10); a.download = `atmos-backup-${date}.json`; a.click(); URL.revokeObjectURL(url);}
/** * Import documents from a backup archive. */export async function importBackup( json: string, _keyMap?: Record<string, string>,): Promise<{ imported: number; skipped: number }> { return localImportAll(json);}