import type { DashboardStore, QueryFilters, EventFilters, EmailFilters, TraceFilters, LogFilters } from '../dashboard/dashboard_store.js'; import type { DebugStore } from '../debug/debug_store.js'; import type { QueryRecord, EventRecord, TraceRecord, RouteRecord } from '../debug/types.js'; export interface ListOptions { page?: number; perPage?: number; search?: string; sort?: string; sortDir?: 'asc' | 'desc'; filters?: Record; /** * Force the data source for this read. * * - `'memory'` — always read from ring buffers ({@link DebugStore}). * Use this for the debug panel, which expects camelCase field names * matching the {@link QueryRecord}/{@link EventRecord}/etc. interfaces. * - `'auto'` (default) — use SQLite when available, fall back to memory. */ source?: 'memory' | 'auto'; } export interface PaginatedResult> { data: T[]; meta: { total: number; page: number; perPage: number; lastPage: number; }; } /** * Wrap a plain array in the standard {@link PaginatedResult} envelope. * * Applies optional client-side search filtering and pagination so that * ring-buffer results match the same shape returned by the dashboard store. */ export declare function wrapArray(items: T[], opts: ListOptions, searchFn?: (item: T, term: string) => boolean): PaginatedResult; /** * Convert a flat {@link DashboardStore.PaginatedResult} to the nested * `{ data, meta }` shape used by the unified API. */ export declare function fromDashboardResult(result: { data: T[]; total: number; page: number; perPage: number; lastPage: number; }): PaginatedResult; export declare function mapTraceListRow>(row: T): T & { requestId: unknown; statusCode: unknown; totalDuration: unknown; spanCount: unknown; createdAt: unknown; }; /** Normalize SQLite email column names to match the EmailRecord shape. */ export declare function normalizeEmailRow(row: Record): { from: unknown; to: unknown; messageId: unknown; attachmentCount: unknown; timestamp: unknown; }; /** Build dashboard store query/event/email/trace pagination args. */ export declare function buildPaginationArgs(opts: ListOptions): { page: number; perPage: number; }; export declare function buildQueryFilters(opts: ListOptions): QueryFilters; export declare function buildEventFilters(opts: ListOptions): EventFilters; export declare function buildEmailFilters(opts: ListOptions): EmailFilters; export declare function buildTraceFilters(opts: ListOptions): TraceFilters; export declare function buildLogFilters(opts: ListOptions): LogFilters; /** Strip heavy html/text bodies from email records for list view. */ export declare function stripEmailForList(e: { id: number; from: string; to: string; cc?: string | null; bcc?: string | null; subject: string; mailer: string; status: string; messageId?: string | null; attachmentCount?: number; timestamp?: string | number | null; }): { id: number; from: string; to: string; cc: string | null | undefined; bcc: string | null | undefined; subject: string; mailer: string; status: string; messageId: string | null | undefined; attachmentCount: number | undefined; timestamp: string | number | null | undefined; }; /** Strip spans from trace records for list view. */ export declare function stripTraceForList(t: { id: number; method: string; url: string; statusCode: number; totalDuration: number; spanCount: number; warnings: readonly unknown[]; timestamp?: string | number | null; }): { id: number; method: string; url: string; statusCode: number; totalDuration: number; spanCount: number; warningCount: number; timestamp: string | number | null | undefined; }; /** Filter routes by search term across pattern, handler, name, and method. */ export declare function filterRoutes(routes: RouteRecord[], search: string): RouteRecord[]; /** * Read and parse the last 256 KB of a log file. * * Returns an array of enriched log entry objects. If the log file * does not exist or cannot be read, returns an empty array. */ export declare function readLogFile(logPath: string): Promise[]>; export type { DashboardStore, QueryFilters, EventFilters, EmailFilters, TraceFilters, LogFilters }; export type { DebugStore }; export type { QueryRecord, EventRecord, TraceRecord, RouteRecord };