fix(cli): report live connections in auth session list#23277

open6
main
fix/issue-21236
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2d ago
0 / 2 viewed2 files changedLine totals unavailable

apps/server/src/scheduledTasks/webhookFilter.ts · Earlier revision 7523f932 · right 38–41

Original diff
@@ -27,9 +23,29 @@ function matchesWebhookFilter(filter: ScheduledTaskWebhookFilter, value: unknown
       return filter.value.includes(text);
     case "startsWith":
       return text.startsWith(filter.value);
+    case "exists":
+      return true;
   }
 }
 
+/**
+ * Placeholders render null as missing, so filters treat it the same way. A
+ * path with a `[]` wildcard resolves to a list: `equals`, `in` and
+ * `startsWith` match when any element does, `notEquals` only when none equals
+ * the value, and `exists` when the list has an element.
+ */
+function matchesWebhookFilter(filter: ScheduledTaskWebhookFilter, value: unknown): boolean {
+  if (Array.isArray(value) && /\[\]/.test(filter.path)) {
+    const texts = value.map(scalarText).filter((text): text is string => text !== undefined);
+    if (filter.op === "notEquals") return texts.every((text) => text !== filter.value);
+    return texts.some((text) => matchesScalar(filter, text));

apps/server/src/scheduledTasks/webhookFilter.ts · right 38–41