import { CoValueCore, LocalNode, RawCoValue } from "cojson"; import type { BranchDefinition, DecodedCoValueCursor } from "./types.js"; import { CoValueLoadingState } from "./types.js"; /** * Manages subscriptions to CoValue cores, handling both direct subscriptions * and branch-based subscriptions with automatic loading and error handling. * * It tries to resolve the value immediately if already available in memory. */ export declare class CoValueCoreSubscription { private _unsubscribe; private unsubscribed; private branchOwnerId?; private branchName?; private source; private localNode; private listener; private skipRetry?; private frontier?; constructor(localNode: LocalNode, id: string, listener: (value: RawCoValue | typeof CoValueLoadingState.UNAVAILABLE) => void, skipRetry?: boolean, branch?: BranchDefinition, decodedCursor?: DecodedCoValueCursor); /** * Rehydrates the subscription by resetting the unsubscribed flag and initializing the subscription again */ pullValue(): void; /** * Main entry point for subscription initialization. * Determines the subscription strategy based on current availability and branch requirements. */ private initializeSubscription; private handleBranching; /** * Loads a CoValue core and emits an unavailable event if it is still unavailable after the retries. */ load(value: CoValueCore): void; /** * Waits for the source to become available and then tries to branch. */ private waitForSourceToBecomeAvailable; /** * Subscribes to a specific CoValue and notifies the listener. * This is the final step where we actually start receiving updates. */ private subscribe; lastState: CoValueLoadingState | undefined; emit(value: CoValueCore | typeof CoValueLoadingState.UNAVAILABLE): void; /** * Unsubscribes from all active subscriptions and marks the instance as unsubscribed. * This prevents any further operations and ensures proper cleanup. */ unsubscribe(): void; } //# sourceMappingURL=CoValueCoreSubscription.d.ts.map