MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / createRecordPage

Function createRecordPage

apps/web/src/bridge/http-bridge.ts:867–879  ·  view source on GitHub ↗
(csvPath: string, title: string, body: string)

Source from the content-addressed store, hash-verified

865}
866
867async 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
881async function renameDatabase(csvPath: string, newTitle: string): Promise<string> {
882 const oldFormDir = formDirFromCsvPath(dbToPosix(csvPath))

Callers

nothing calls this directly

Calls 4

formDirFromCsvPathFunction · 0.90
dbToPosixFunction · 0.85
readFileTextOrNullFunction · 0.85
writeNoteFunction · 0.70

Tested by

no test coverage detected