feat(KB-086): complete Step 5 — add activity log API client functions
This commit is contained in:
@@ -10,6 +10,8 @@ import type {
|
||||
BatchStatusResult,
|
||||
BatchStatusResponse,
|
||||
BatchStatusEntry,
|
||||
ActivityLogEntry,
|
||||
ActivityEventType,
|
||||
} from "@kb/core";
|
||||
import type { PlanningQuestion, PlanningSummary, PlanningResponse } from "@kb/core";
|
||||
import type { ScheduledTask, ScheduledTaskCreateInput, ScheduledTaskUpdateInput, AutomationRunResult } from "@kb/core";
|
||||
@@ -944,3 +946,23 @@ export function toggleAutomation(id: string): Promise<ScheduledTask> {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
// ── Activity Log API ────────────────────────────────────────────
|
||||
|
||||
/** Re-export ActivityLogEntry type from core for convenience */
|
||||
export type { ActivityLogEntry, ActivityEventType } from "@kb/core";
|
||||
|
||||
/** Fetch activity log entries */
|
||||
export function fetchActivityLog(options?: { limit?: number; since?: string; type?: ActivityEventType }): Promise<ActivityLogEntry[]> {
|
||||
const search = new URLSearchParams();
|
||||
if (options?.limit !== undefined) search.set("limit", String(options.limit));
|
||||
if (options?.since !== undefined) search.set("since", options.since);
|
||||
if (options?.type !== undefined) search.set("type", options.type);
|
||||
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
||||
return api<ActivityLogEntry[]>(`/activity${suffix}`);
|
||||
}
|
||||
|
||||
/** Clear all activity log entries */
|
||||
export function clearActivityLog(): Promise<{ success: boolean }> {
|
||||
return api<{ success: boolean }>("/activity", { method: "DELETE" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user