MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / buildTaskListGroupDropPlan

Function buildTaskListGroupDropPlan

src/bases/taskListDropPlanning.ts:51–80  ·  view source on GitHub ↗
({
	groupByPropertyId,
	sourceGroupKey,
	targetGroupKey,
	lookupMappingKey,
	isListTypeProperty,
}: BuildTaskListGroupDropPlanOptions)

Source from the content-addressed store, hash-verified

49}
50
51export function buildTaskListGroupDropPlan({
52 groupByPropertyId,
53 sourceGroupKey,
54 targetGroupKey,
55 lookupMappingKey,
56 isListTypeProperty,
57}: BuildTaskListGroupDropPlanOptions): TaskListGroupDropPlan {
58 const cleanGroupBy = groupByPropertyId ? stripPropertyPrefix(groupByPropertyId) : null;
59 const isFormulaGrouping = !!groupByPropertyId?.startsWith("formula.");
60 const normalizedTargetGroupKey = targetGroupKey === "None" ? null : targetGroupKey;
61 const needsGroupUpdate =
62 !!groupByPropertyId && normalizedTargetGroupKey !== sourceGroupKey;
63 const groupByTaskProp = cleanGroupBy ? lookupMappingKey(cleanGroupBy) : null;
64 const isListGrouping = !!cleanGroupBy && isListTypeProperty(cleanGroupBy);
65 const frontmatterKey = groupByPropertyId
66 ? groupByPropertyId.replace(/^(note\.|file\.|task\.)/, "")
67 : null;
68
69 return {
70 groupByPropertyId,
71 cleanGroupBy,
72 frontmatterKey,
73 groupByTaskProp,
74 isFormulaGrouping,
75 isListGrouping,
76 needsGroupUpdate,
77 normalizedTargetGroupKey,
78 sourceGroupKey,
79 };
80}
81
82export function applyTaskListDropFrontmatterMutation({
83 frontmatter,

Callers 2

handleSortOrderDropMethod · 0.90

Calls 3

stripPropertyPrefixFunction · 0.90
lookupMappingKeyFunction · 0.85
isListTypePropertyFunction · 0.85

Tested by

no test coverage detected