(section: PreferencesBackupSection)
| 1834 | } |
| 1835 | |
| 1836 | async function importPreferencesSection(section: PreferencesBackupSection): Promise<Array<{ key: string; value: unknown }>> { |
| 1837 | const applied: Array<{ key: string; value: unknown }> = []; |
| 1838 | |
| 1839 | await db.transaction(async (tx) => { |
| 1840 | for (const row of section.settings) { |
| 1841 | if (!isSettingValueAcceptable(row.key, row.value)) continue; |
| 1842 | |
| 1843 | await upsertSetting(row.key, row.value, tx); |
| 1844 | applied.push({ key: row.key, value: row.value }); |
| 1845 | } |
| 1846 | }); |
| 1847 | |
| 1848 | return applied; |
| 1849 | } |
| 1850 | |
| 1851 | export async function importBackup(data: RawBackupData): Promise<BackupImportResult> { |
| 1852 | if (!isRecord(data)) { |
no test coverage detected