@dudousxd/nestjs-telescope
Version:
Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.
30 lines • 1.66 kB
TypeScript
import type { Entry } from '../entry/entry.js';
import type { EntryQuery, StorageProvider } from '../storage/storage-provider.js';
/**
* Entries fetched per storage page (default). Large on purpose: the analytics
* window scan is the only caller, and paginating in small pages turns one scan
* into many sequential round-trips — which dominates latency against a REMOTE
* SQL store (e.g. each 500-row page over a remote RDS adds a full RTT). A big
* page collapses a typical window into one or two queries. Paired with
* `omitContent`, each page stays cheap on the wire regardless of content size.
*/
export declare const DEFAULT_PAGE_SIZE = 5000;
/** Safety cap on entries scanned per request; surfaced via `truncated` (default). */
export declare const DEFAULT_SCAN_CAP = 50000;
export interface WindowReadOptions {
pageSize?: number;
scanCap?: number;
}
export interface WindowReadResult {
entries: Entry[];
/** Number of entries returned (<= scanCap). */
scanned: number;
/** True if the scan hit the cap (older entries in the window were not read). */
truncated: boolean;
}
/** Page through `storage.get` for all entries matching `baseQuery`, newest-first,
* bounded by `scanCap`. Terminates safely even against a non-compliant store:
* an empty page or a non-advancing cursor ends the scan (the cap alone cannot
* catch an empty-page-with-cursor loop, since `entries` would never grow). */
export declare function collectEntriesInWindow(storage: StorageProvider, baseQuery: Omit<EntryQuery, 'cursor' | 'limit'>, options?: WindowReadOptions): Promise<WindowReadResult>;
//# sourceMappingURL=collect-window.d.ts.map