(csvPath: string, title: string, body: string)
| 865 | } |
| 866 | |
| 867 | async function createRecordPage(csvPath: string, title: string, body: string): Promise<string> { |
| 868 | const formDir = formDirFromCsvPath(dbToPosix(csvPath)) |
| 869 | if (!formDir) throw new Error(`Not a database folder: ${csvPath}`) |
| 870 | const safe = (title.trim() || 'Untitled').replace(/[\\/]/g, '-') |
| 871 | let finalTitle = safe |
| 872 | let n = 2 |
| 873 | while ((await readFileTextOrNull(`${formDir}/${finalTitle}.md`)) !== null) { |
| 874 | finalTitle = `${safe} ${n++}` |
| 875 | } |
| 876 | const noteRel = `${formDir}/${finalTitle}.md` |
| 877 | await writeNote(noteRel, body) |
| 878 | return noteRel |
| 879 | } |
| 880 | |
| 881 | async function renameDatabase(csvPath: string, newTitle: string): Promise<string> { |
| 882 | const oldFormDir = formDirFromCsvPath(dbToPosix(csvPath)) |
nothing calls this directly
no test coverage detected