* Create TaskInfo object from a single Bases data item
( props: Record<string, unknown>, basesItem: BasesDataItem, plugin?: TaskNotesPlugin )
| 166 | * Create TaskInfo object from a single Bases data item |
| 167 | */ |
| 168 | function createTaskInfoFromProperties( |
| 169 | props: Record<string, unknown>, |
| 170 | basesItem: BasesDataItem, |
| 171 | plugin?: TaskNotesPlugin |
| 172 | ): TaskInfo { |
| 173 | const knownProperties = new Set([ |
| 174 | "title", |
| 175 | "status", |
| 176 | "priority", |
| 177 | "archived", |
| 178 | "due", |
| 179 | "scheduled", |
| 180 | "contexts", |
| 181 | "projects", |
| 182 | "tags", |
| 183 | "timeEstimate", |
| 184 | "completedDate", |
| 185 | "recurrence", |
| 186 | "recurrence_parent", |
| 187 | "occurrence_date", |
| 188 | "occurrence_materialization", |
| 189 | "occurrence_next_trigger", |
| 190 | "occurrence_template", |
| 191 | "occurrence_past_horizon", |
| 192 | "occurrence_future_horizon", |
| 193 | "dateCreated", |
| 194 | "dateModified", |
| 195 | "timeEntries", |
| 196 | "reminders", |
| 197 | "icsEventId", |
| 198 | "complete_instances", |
| 199 | "skipped_instances", |
| 200 | "blockedBy", |
| 201 | "blocking", |
| 202 | "sortOrder", |
| 203 | // Prevent double-nesting: when this function is called with a Partial<TaskInfo> |
| 204 | // that already has customProperties populated (e.g. from mapFromFrontmatter), |
| 205 | // we must not re-classify it as an unknown property. |
| 206 | "customProperties", |
| 207 | ]); |
| 208 | |
| 209 | const customProperties: Record<string, unknown> = {}; |
| 210 | Object.keys(props).forEach((key) => { |
| 211 | if (!knownProperties.has(key)) { |
| 212 | customProperties[key] = props[key]; |
| 213 | } |
| 214 | }); |
| 215 | |
| 216 | const timeEntries = toTimeEntries(props.timeEntries); |
| 217 | const totalTrackedTime = timeEntries ? calculateTotalTimeSpent(timeEntries) : 0; |
| 218 | |
| 219 | // Get dependency information from DependencyCache if plugin is available |
| 220 | let isBlocked = false; |
| 221 | let blockingTasks: string[] = []; |
| 222 | let isBlocking = false; |
| 223 | if (plugin?.dependencyCache && basesItem.path) { |
| 224 | // Use DependencyCache for status-aware blocking check |
| 225 | isBlocked = plugin.dependencyCache.isTaskBlocked(basesItem.path); |
no test coverage detected