( root: string, csvPath: string, title: string, body: string )
| 302 | * nest under the database in the sidebar. |
| 303 | */ |
| 304 | export async function createRecordPage( |
| 305 | root: string, |
| 306 | csvPath: string, |
| 307 | title: string, |
| 308 | body: string |
| 309 | ): Promise<string> { |
| 310 | const formDir = formDirFromCsvPath(toPosix(csvPath)) |
| 311 | if (!formDir) throw new Error(`Not a database folder: ${csvPath}`) |
| 312 | const dirAbs = databaseDataPath(root, formDir) // resolveSafe + posix |
| 313 | await fs.mkdir(dirAbs, { recursive: true }) |
| 314 | const finalTitle = await uniqueTitle(dirAbs, sanitizeNoteTitle(title)) |
| 315 | const noteRel = `${formDir}/${finalTitle}.md` |
| 316 | await fs.writeFile(databaseDataPath(root, noteRel), body, 'utf8') |
| 317 | return noteRel |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Permanently delete a database: remove its entire `<Name>.base` folder |
no test coverage detected