import { EventEmitter } from "eventemitter3"; import { type TaggedNostrEvent } from "."; export declare const EmptySnapshot: NoteStoreSnapshotData; export type NoteStoreSnapshotData = Array; export type NoteStoreHook = () => void; export type NoteStoreHookRelease = () => void; export type OnEventCallback = (e: Readonly>) => void; export type OnEventCallbackRelease = () => void; export type OnEoseCallback = (c: string) => void; export type OnEoseCallbackRelease = () => void; export interface NosteStoreEvents { event: (evs: Array) => void; } /** * Generic note store interface */ export declare abstract class NoteStore extends EventEmitter { abstract add(ev: Readonly | Readonly>): void; abstract clear(): void; abstract get snapshot(): NoteStoreSnapshotData; } export declare abstract class HookedNoteStore extends NoteStore { #private; /** * Interval to emit changes in milli-seconds */ protected emitInterval: number; /** * Snapshot is computed lazily: only materialised when first read after a change. * This avoids the O(n²) GC pressure of copying all events on every addition. */ get snapshot(): NoteStoreSnapshotData; abstract add(ev: Readonly | Readonly>): void; abstract clear(): void; protected abstract takeSnapshot(): NoteStoreSnapshotData | undefined; protected onChange(changes: Array): void; flushEmit(): void; /** * Cancel any pending buffered emit and immediately notify listeners with an * empty array, signalling that the store has been cleared. */ protected onClear(): void; } /** * A note store that holds a single replaceable event for a given user defined key generator function */ export declare class KeyedReplaceableNoteStore extends HookedNoteStore { #private; constructor(fn: (ev: TaggedNostrEvent) => string); add(ev: TaggedNostrEvent | Array): number; clear(): void; takeSnapshot(): TaggedNostrEvent[]; } /** * General use note store based on kind ranges */ export declare class NoteCollection extends KeyedReplaceableNoteStore { constructor(); } //# sourceMappingURL=note-collection.d.ts.map