MCPcopy
hub / github.com/callumalpass/tasknotes / createFilterIndexEntry

Method createFilterIndexEntry

src/utils/TaskManager.ts:456–499  ·  view source on GitHub ↗
(
		path: string,
		frontmatter: Record<string, unknown>
	)

Source from the content-addressed store, hash-verified

454 }
455
456 private createFilterIndexEntry(
457 path: string,
458 frontmatter: Record<string, unknown>
459 ): TaskFilterIndexEntry {
460 const statusField = this.fieldMapper?.toUserField("status") || "status";
461 const priorityField = this.fieldMapper?.toUserField("priority") || "priority";
462 const scheduledField = this.fieldMapper?.toUserField("scheduled") || "scheduled";
463 const dueField = this.fieldMapper?.toUserField("due") || "due";
464 const contextField = this.fieldMapper?.toUserField("contexts") || "context";
465 const projectField = this.fieldMapper?.toUserField("projects") || "project";
466 const timeEstimateField = this.fieldMapper?.toUserField("timeEstimate") || "timeEstimate";
467
468 const status =
469 normalizeStatusConfigValue(frontmatter[statusField], this.settings.customStatuses) ??
470 undefined;
471 const priority =
472 normalizePriorityConfigValue(frontmatter[priorityField], this.settings.customPriorities) ??
473 undefined;
474 const dueDate = this.normalizeDateValue(frontmatter[dueField]);
475 const scheduledDate = this.normalizeDateValue(frontmatter[scheduledField]);
476 const tags = this.normalizeStringValues(frontmatter.tags, false);
477 const contexts = this.normalizeStringValues(frontmatter[contextField], true);
478 const projects = this.normalizeStringValues(frontmatter[projectField], true);
479 const rawTimeEstimate = frontmatter[timeEstimateField];
480 const timeEstimate =
481 typeof rawTimeEstimate === "number" && rawTimeEstimate > 0 ? rawTimeEstimate : undefined;
482
483 const isCompleted =
484 this.settings.customStatuses?.some((s) => s.value === status && s.isCompleted) || false;
485
486 return this.withFilterIndexSignature({
487 path,
488 status,
489 priority,
490 dueDate,
491 scheduledDate,
492 tags,
493 contexts,
494 projects,
495 timeEstimate,
496 isCompleted,
497 signature: "",
498 });
499 }
500
501 private createFilterIndexEntryFromTaskInfo(
502 path: string,

Callers 2

ensureFilterIndexesMethod · 0.95

Calls 4

normalizeDateValueMethod · 0.95
normalizeStringValuesMethod · 0.95
toUserFieldMethod · 0.65

Tested by

no test coverage detected