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

Method runtimePredicateToFilterNode

src/api/TaskNotesAPI.ts:1511–1555  ·  view source on GitHub ↗
(
		predicate: TaskNotesRuntimeNormalizedPredicate | undefined,
		path: string,
		issues: TaskNotesRuntimeQueryIssue[]
	)

Source from the content-addressed store, hash-verified

1509 }
1510
1511 private runtimePredicateToFilterNode(
1512 predicate: TaskNotesRuntimeNormalizedPredicate | undefined,
1513 path: string,
1514 issues: TaskNotesRuntimeQueryIssue[]
1515 ): FilterNode | null {
1516 if (!predicate) return null;
1517 if ("all" in predicate) {
1518 return {
1519 type: "group",
1520 id: runtimeNodeId(path),
1521 conjunction: "and",
1522 children: predicate.all
1523 .map((child, index) =>
1524 this.runtimePredicateToFilterNode(child, `${path}.all.${index}`, issues)
1525 )
1526 .filter(isDefined),
1527 };
1528 }
1529 if ("any" in predicate) {
1530 return {
1531 type: "group",
1532 id: runtimeNodeId(path),
1533 conjunction: "or",
1534 children: predicate.any
1535 .map((child, index) =>
1536 this.runtimePredicateToFilterNode(child, `${path}.any.${index}`, issues)
1537 )
1538 .filter(isDefined),
1539 };
1540 }
1541 if ("not" in predicate) {
1542 const inverted = invertRuntimePredicate(predicate.not);
1543 if (!inverted) {
1544 issues.push({
1545 path: `${path}.not`,
1546 code: "not_unsupported",
1547 message: "Unable to invert runtime query predicate.",
1548 });
1549 return null;
1550 }
1551 return this.runtimePredicateToFilterNode(inverted, `${path}.not`, issues);
1552 }
1553
1554 return this.runtimeConditionToFilterNode(predicate, path);
1555 }
1556
1557 private runtimeConditionToFilterNode(
1558 condition: TaskNotesRuntimeNormalizedCondition,

Callers 1

Calls 3

runtimeNodeIdFunction · 0.85
invertRuntimePredicateFunction · 0.85

Tested by

no test coverage detected