Skip to content

@ogygia/devtools · API

@ogygia/devtools/profiler/storage/sqlite

SqliteStore, a profiler report store in one SQLite file.

On this page

This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source.

Exports SqliteStore

import { … } from '@ogygia/devtools/profiler/storage/sqlite';

SqliteStore

class

A report store in one SQLite file (or :memory:): no server, and it survives a restart. It opens the file with the built-in node:sqlite, or better-sqlite3 when that is not there; a driver that is there and cannot open the file fails with its own error. It makes the file's folders, and keeps the newest 2000 visits per page.

// src/hooks.server.ts import { setProfilerStore } from '@ogygia/devtools/profiler/storage'; import { SqliteStore } from '@ogygia/devtools/profiler/storage/sqlite'; setProfilerStore(new SqliteStore('.ogygia/profiles.db'));

SqliteStore.kind

A name for the dashboard ("sqlite", "redis", "postgres", "memory").

SqliteStore.constructor

SqliteStore.init

Called once before first use — create tables, connect, etc. Optional.

SqliteStore.putReport

Write (or overwrite) a report.

SqliteStore.getReport

Read a report's full dump JSON, or null when absent.

SqliteStore.listReports

The most recent reports (summaries), newest first.

SqliteStore.deleteReport

Remove a report.

SqliteStore.prune

Keep at most keep reports, dropping the oldest — the store's own LRU, called after a put.

SqliteStore.putVisit

SqliteStore.listVisits

SqliteStore.close

Release connections. Optional.

class SqliteStore implements ProfilerStore {/*…*/}
readonly kind: string;
constructor(filename?: string);
init(): void;
putReport(rec: ProfilerRecord): void;
getReport(id: string): string | null;
listReports(limit?: number): ProfilerSummary[];
deleteReport(id: string): void;
prune(keep: number): void;
putVisit(rec: ProfilerVisitRecord): void;
listVisits(page: string, limit?: number): ProfilerVisitRecord[];
close(): void;