Carry the per-vault view overrides (#292) through the round-trip, keeping * only known keys. The renderer validates the values strictly; here we just * preserve a clean object (or undefined when there are no overrides).
(raw: unknown)
| 957 | * only known keys. The renderer validates the values strictly; here we just |
| 958 | * preserve a clean object (or undefined when there are no overrides). */ |
| 959 | function normalizeVaultViewSettings(raw: unknown): VaultViewSettings | undefined { |
| 960 | if (!raw || typeof raw !== 'object') return undefined |
| 961 | const c = raw as Record<string, unknown> |
| 962 | const view: VaultViewSettings = {} |
| 963 | if (typeof c.noteSortOrder === 'string') view.noteSortOrder = c.noteSortOrder |
| 964 | if (typeof c.groupByKind === 'boolean') view.groupByKind = c.groupByKind |
| 965 | if (typeof c.tasksViewMode === 'string') view.tasksViewMode = c.tasksViewMode |
| 966 | if (typeof c.kanbanGroupBy === 'string') view.kanbanGroupBy = c.kanbanGroupBy |
| 967 | if (c.kanbanColumnTitles && typeof c.kanbanColumnTitles === 'object') { |
| 968 | view.kanbanColumnTitles = c.kanbanColumnTitles as Record<string, string> |
| 969 | } |
| 970 | if (typeof c.autoReveal === 'boolean') view.autoReveal = c.autoReveal |
| 971 | if (c.systemFolderLabels && typeof c.systemFolderLabels === 'object') { |
| 972 | view.systemFolderLabels = c.systemFolderLabels as Record<string, unknown> |
| 973 | } |
| 974 | if (typeof c.unifiedSidebar === 'boolean') view.unifiedSidebar = c.unifiedSidebar |
| 975 | return Object.keys(view).length > 0 ? view : undefined |
| 976 | } |
| 977 | |
| 978 | function normalizeFavorites(value: unknown): string[] { |
| 979 | if (!Array.isArray(value)) return [] |
no outgoing calls
no test coverage detected