import { CollectionSubscription } from './subscription.js'; import { StandardSchemaV1 } from '@standard-schema/spec'; import { ChangeMessage, SubscribeChangesOptions } from '../types.js'; import { CollectionLifecycleManager } from './lifecycle.js'; import { CollectionSyncManager } from './sync.js'; import { CollectionEventsManager } from './events.js'; import { CollectionImpl } from './index.js'; import { CollectionStateManager } from './state.js'; import { WithVirtualProps } from '../virtual-props.js'; export declare class CollectionChangesManager, TKey extends string | number = string | number, TSchema extends StandardSchemaV1 = StandardSchemaV1, TInput extends object = TOutput> { private lifecycle; private sync; private events; private collection; private state; activeSubscribersCount: number; changeSubscriptions: Set; batchedEvents: Array>; shouldBatchEvents: boolean; /** * Creates a new CollectionChangesManager instance */ constructor(); setDeps(deps: { lifecycle: CollectionLifecycleManager; sync: CollectionSyncManager; events: CollectionEventsManager; collection: CollectionImpl; state: CollectionStateManager; }): void; /** * Emit an empty ready event to notify subscribers that the collection is ready * This bypasses the normal empty array check in emitEvents */ emitEmptyReadyEvent(): void; /** * Enriches a change message with virtual properties ($synced, $origin, $key, $collectionId). * Uses the "add-if-missing" pattern to preserve virtual properties from upstream collections. */ private enrichChangeWithVirtualProps; /** * Emit events either immediately or batch them for later emission */ emitEvents(changes: Array>, forceEmit?: boolean): void; /** * Subscribe to changes in the collection */ subscribeChanges(callback: (changes: Array>>) => void, options?: SubscribeChangesOptions): CollectionSubscription; /** * Increment the active subscribers count and start sync if needed */ private addSubscriber; /** * Decrement the active subscribers count and start GC timer if needed */ private removeSubscriber; /** * Clean up the collection by stopping sync and clearing data * This can be called manually or automatically by garbage collection */ cleanup(): void; }