/** * Reactive dependency graph for FeltDB collections * * Tracks relationships between collections (base → derived → further derived) * and propagates mutations automatically without polling. */ /** * Represents a change in the collection */ export interface CollectionChange { type: 'insert' | 'update' | 'delete'; key: string; value: T | null; timestamp: number; } /** * Tracks dependencies between collections and propagates changes */ export declare class ReactiveDependencyGraph { /** Map of collection name to its dependents (derived collections) */ private dependencies; /** Map of collection name to its subscribers (callbacks) */ private subscribers; /** Recent changes for each collection (for differential updates) */ private recentChanges; /** * Register a dependency: when sourceCollection changes, notify dependentCollection */ registerDependency(sourceCollection: string, dependentCollection: string): void; /** * Subscribe to changes for a collection */ subscribe(collectionName: string, callback: (change: CollectionChange) => void | Promise): () => void; /** * Emit a change for a collection, triggering all subscribers */ emitChange(collectionName: string, change: CollectionChange): Promise; /** * Get recent changes for a collection (for differential updates) */ getRecentChanges(collectionName: string): CollectionChange[]; /** * Clear recent changes for a collection */ clearRecentChanges(collectionName: string): void; /** * Get the number of active subscribers for a collection */ getSubscriberCount(collectionName: string): number; /** * Check if a collection has any dependents */ hasDependents(collectionName: string): boolean; /** * Get all dependents of a collection */ getDependents(collectionName: string): string[]; } /** * Get the global reactive dependency graph */ export declare function getReactiveDependencyGraph(): ReactiveDependencyGraph; /** * Reset the global graph (useful for testing) */ export declare function resetReactiveDependencyGraph(): void; //# sourceMappingURL=reactive-graph.d.ts.map