MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / runtimeConditionToFilterNode

Method runtimeConditionToFilterNode

src/api/TaskNotesAPI.ts:1557–1590  ·  view source on GitHub ↗
(
		condition: TaskNotesRuntimeNormalizedCondition,
		path: string
	)

Source from the content-addressed store, hash-verified

1555 }
1556
1557 private runtimeConditionToFilterNode(
1558 condition: TaskNotesRuntimeNormalizedCondition,
1559 path: string
1560 ): FilterNode {
1561 const field = this.resolveRuntimeQueryField(condition.field);
1562 const values =
1563 Array.isArray(condition.value) && (condition.op === "in" || condition.op === "notIn")
1564 ? condition.value
1565 : null;
1566 if (values) {
1567 return {
1568 type: "group",
1569 id: runtimeNodeId(path),
1570 conjunction: condition.op === "in" ? "or" : "and",
1571 children: values.map(
1572 (value, index): FilterCondition => ({
1573 type: "condition",
1574 id: runtimeNodeId(`${path}.value.${index}`),
1575 property: field?.internalProperty ?? (condition.field as FilterProperty),
1576 operator: RUNTIME_TO_LEGACY_OPERATOR[condition.op],
1577 value: toFilterConditionValue(normalizeRuntimeValue(value)),
1578 })
1579 ),
1580 };
1581 }
1582
1583 return {
1584 type: "condition",
1585 id: runtimeNodeId(path),
1586 property: field?.internalProperty ?? (condition.field as FilterProperty),
1587 operator: RUNTIME_TO_LEGACY_OPERATOR[condition.op],
1588 value: toFilterConditionValue(condition.value),
1589 };
1590 }
1591
1592 private resolveRuntimeQueryField(field: string): ResolvedRuntimeQueryField | null {
1593 const normalizedField = field.trim();

Callers 1

Calls 4

runtimeNodeIdFunction · 0.85
toFilterConditionValueFunction · 0.85
normalizeRuntimeValueFunction · 0.85

Tested by

no test coverage detected