MCPcopy Index your code
hub / github.com/massCodeIO/massCode / applyNotesImportResult

Function applyNotesImportResult

src/main/import/notes/persist.ts:166–206  ·  view source on GitHub ↗
(
  result: NoteImportParseResult,
)

Source from the content-addressed store, hash-verified

164}
165
166export function applyNotesImportResult(
167 result: NoteImportParseResult,
168): ImportApplySummary {
169 if (!result.notes.length) {
170 return {
171 createdRootFolderName: '',
172 createdSnippetNames: [],
173 folders: 0,
174 notes: 0,
175 snippets: 0,
176 source: 'obsidian',
177 tags: 0,
178 warnings: result.warnings,
179 }
180 }
181
182 const runFolder = createImportRunFolder(null)
183 const createdNoteNames: string[] = []
184 let folders = 1
185 let tags = 0
186
187 result.notes.forEach((candidate) => {
188 const targetFolder = ensureFolderPath(runFolder.id, candidate.folderPath)
189 folders += targetFolder.created
190
191 const note = createNote(candidate, targetFolder.folderId)
192 createdNoteNames.push(note.name)
193 tags += note.tagCount
194 })
195
196 return {
197 createdRootFolderName: runFolder.name,
198 createdSnippetNames: [],
199 folders,
200 notes: createdNoteNames.length,
201 snippets: 0,
202 source: 'obsidian',
203 tags,
204 warnings: result.warnings,
205 }
206}

Callers 2

applyObsidianImportFunction · 0.90
persist.test.tsFile · 0.90

Calls 3

createImportRunFolderFunction · 0.70
ensureFolderPathFunction · 0.70
createNoteFunction · 0.70

Tested by

no test coverage detected