MCPcopy
hub / github.com/cita-777/metapi / importPreferencesSection

Function importPreferencesSection

src/server/services/backupService.ts:1836–1849  ·  view source on GitHub ↗
(section: PreferencesBackupSection)

Source from the content-addressed store, hash-verified

1834}
1835
1836async 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
1851export async function importBackup(data: RawBackupData): Promise<BackupImportResult> {
1852 if (!isRecord(data)) {

Callers 1

importBackupFunction · 0.85

Calls 3

isSettingValueAcceptableFunction · 0.85
upsertSettingFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected