Skip to main content
zerotal

Documentation


Documentation / @zerotal/devtools / index / TraceStore

Class: TraceStore

Defined in: devtools/src/TraceStore.ts:46

The in-memory ring of recent request traces, optionally backed by SQLite so history survives a restart.

Nothing happens until the store is used. Opening a database — or starting a prune timer — from a constructor would mean that merely importing @zerotal/devtools writes a file to the working directory, in every environment including production, whether or not the provider ever activates. The database is therefore opened on first write or read.

Constructors

Constructor

new TraceStore(options?): TraceStore

Defined in: devtools/src/TraceStore.ts:63

Parameters

options?

number | TraceStoreOptions

Returns

TraceStore

Accessors

persisting

Get Signature

get persisting(): boolean

Defined in: devtools/src/TraceStore.ts:137

Whether this store is persisting to SQLite. Exposed for tests and diagnostics.

Returns

boolean

Methods

push()

push(trace): void

Defined in: devtools/src/TraceStore.ts:75

Parameters

trace

RequestTrace

Returns

void


all()

all(): RequestTrace[]

Defined in: devtools/src/TraceStore.ts:83

Returns

RequestTrace[]


clear()

clear(): void

Defined in: devtools/src/TraceStore.ts:88

Returns

void


subscribe()

subscribe(fn): () => void

Defined in: devtools/src/TraceStore.ts:107

Subscribing does not open the database — a listener is not a read.

Parameters

fn

Subscriber

Returns

() => void


dispose()

dispose(): void

Defined in: devtools/src/TraceStore.ts:113

Flush anything pending, stop the timers, and close the database.

Returns

void