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

Method normalizeRuntimePredicate

src/api/TaskNotesAPI.ts:1254–1296  ·  view source on GitHub ↗
(
		predicate: unknown,
		path: string,
		issues: TaskNotesRuntimeQueryIssue[]
	)

Source from the content-addressed store, hash-verified

1252 }
1253
1254 private normalizeRuntimePredicate(
1255 predicate: unknown,
1256 path: string,
1257 issues: TaskNotesRuntimeQueryIssue[]
1258 ): TaskNotesRuntimeNormalizedPredicate | undefined {
1259 if (!isRecord(predicate)) {
1260 issues.push({
1261 path,
1262 code: "predicate_not_object",
1263 message: "Runtime query predicate must be an object.",
1264 });
1265 return undefined;
1266 }
1267
1268 if (Array.isArray(predicate["all"])) {
1269 return {
1270 all: predicate["all"]
1271 .map((child, index) =>
1272 this.normalizeRuntimePredicate(child, `${path}.all.${index}`, issues)
1273 )
1274 .filter(isDefined),
1275 };
1276 }
1277 if (Array.isArray(predicate["any"])) {
1278 return {
1279 any: predicate["any"]
1280 .map((child, index) =>
1281 this.normalizeRuntimePredicate(child, `${path}.any.${index}`, issues)
1282 )
1283 .filter(isDefined),
1284 };
1285 }
1286 if (typeof predicate["not"] !== "undefined") {
1287 const normalized = this.normalizeRuntimePredicate(
1288 predicate["not"],
1289 `${path}.not`,
1290 issues
1291 );
1292 return normalized ? { not: normalized } : undefined;
1293 }
1294
1295 return this.normalizeRuntimeCondition(predicate, path, issues);
1296 }
1297
1298 private normalizeRuntimeCondition(
1299 condition: Record<string, unknown>,

Callers 1

Calls 2

isRecordFunction · 0.70

Tested by

no test coverage detected