@ogygia/devtools · API
@ogygia/devtools/profiler/storage/postgres
PostgresStore, a profiler report store every instance can share, with reports as jsonb.
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 PostgresStore
import { … } from '@ogygia/devtools/profiler/storage/postgres';PostgresStore
class
A report store on Postgres, durable and shared by a team. Reports go in ogygia_reports (the
dump as jsonb, so a dashboard can query inside it, plus summary columns), visits in ogygia_visits, the newest 2000 per page. schema puts the tables in a named schema; table replaces the ogygia base name. Pass a connection string (pg is imported on demand) or a pg Pool already made; after close(), the next call opens a new pool.
// src/hooks.server.ts import { setProfilerStore } from '@ogygia/devtools/profiler/storage'; import { PostgresStore } from '@ogygia/devtools/profiler/storage/postgres'; setProfilerStore(new PostgresStore(process.env.DATABASE_URL!)); // or your own pool setProfilerStore(new PostgresStore(myPool));
PostgresStore.kind
A name for the dashboard ("sqlite", "redis", "postgres", "memory").
PostgresStore.constructor
PostgresStore.init
Called once before first use — create tables, connect, etc. Optional.
PostgresStore.putReport
Write (or overwrite) a report.
PostgresStore.getReport
Read a report's full dump JSON, or null when absent.
PostgresStore.listReports
The most recent reports (summaries), newest first.
PostgresStore.deleteReport
Remove a report.
PostgresStore.prune
Keep at most keep reports, dropping the oldest — the store's own LRU, called after a put.
PostgresStore.putVisit
PostgresStore.listVisits
PostgresStore.close
Release connections. Optional.
class PostgresStore implements ProfilerStore {/*…*/}readonly kind: string;constructor(client: PgLike | string, opts?: {
schema?: string;
table?: string;
});init(): Promise<void>;putReport(rec: ProfilerRecord): Promise<void>;getReport(id: string): Promise<string | null>;listReports(limit?: number): Promise<ProfilerSummary[]>;deleteReport(id: string): Promise<void>;prune(keep: number): Promise<void>;putVisit(rec: ProfilerVisitRecord): Promise<void>;listVisits(page: string, limit?: number): Promise<ProfilerVisitRecord[]>;close(): Promise<void>;