( root: string, pages?: Record<string, string> )
| 150 | } |
| 151 | |
| 152 | async function readPageContentFlags( |
| 153 | root: string, |
| 154 | pages?: Record<string, string> |
| 155 | ): Promise<Record<string, boolean> | undefined> { |
| 156 | if (!pages || Object.keys(pages).length === 0) return undefined |
| 157 | const flags: Record<string, boolean> = {} |
| 158 | await Promise.all( |
| 159 | Object.entries(pages).map(async ([rowId, notePath]) => { |
| 160 | try { |
| 161 | flags[rowId] = noteHasBody(await fs.readFile(databaseDataPath(root, notePath), 'utf8')) |
| 162 | } catch { |
| 163 | /* missing note → leave unset (treated as empty) */ |
| 164 | } |
| 165 | }) |
| 166 | ) |
| 167 | return flags |
| 168 | } |
| 169 | |
| 170 | async function persistSidecar(root: string, rel: string, sidecar: DatabaseSidecar): Promise<void> { |
| 171 | // Store record-page paths relative to the database folder (so a folder rename |
no test coverage detected