( dataItems: BasesDataItem[], plugin?: TaskNotesPlugin, toTaskInfo?: (item: BasesDataItem, plugin?: TaskNotesPlugin) => TaskInfo | null )
| 344 | * Identify TaskNotes from Bases data by converting all items to TaskInfo |
| 345 | */ |
| 346 | export async function identifyTaskNotesFromBasesData( |
| 347 | dataItems: BasesDataItem[], |
| 348 | plugin?: TaskNotesPlugin, |
| 349 | toTaskInfo?: (item: BasesDataItem, plugin?: TaskNotesPlugin) => TaskInfo | null |
| 350 | ): Promise<TaskInfo[]> { |
| 351 | const taskInfoConverter = toTaskInfo || createTaskInfoFromBasesData; |
| 352 | const taskNotes: TaskInfo[] = []; |
| 353 | for (const item of dataItems) { |
| 354 | if (!item?.path) continue; |
| 355 | try { |
| 356 | const taskInfo = taskInfoConverter(item, plugin); |
| 357 | if (taskInfo) taskNotes.push(taskInfo); |
| 358 | } catch (error) { |
| 359 | tasknotesLogger.warn("[TaskNotes][BasesPOC] Error converting Bases item to TaskInfo:", { |
| 360 | category: "validation", |
| 361 | operation: "converting-bases-item-taskinfo", |
| 362 | error: error, |
| 363 | }); |
| 364 | } |
| 365 | } |
| 366 | return taskNotes; |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * Render TaskNotes using TaskCard component into a container |
no test coverage detected