import { LocalNode } from "cojson"; import { type CoValue, MaybeLoaded, NotLoaded, type RefEncoded, type RefsToResolve, CoValueCursor, DecodedCoValueCursor } from "../internal.js"; import { JazzError } from "./JazzError.js"; import type { BranchDefinition, SubscriptionValue, SubscriptionValueLoading } from "./types.js"; import { PromiseWithStatus } from "./utils.js"; export declare class SubscriptionScope { node: LocalNode; id: string; schema: RefEncoded; skipRetry: boolean; bestEffortResolution: boolean; unstable_branch?: BranchDefinition | undefined; static isProfilingEnabled: boolean; static setProfilingEnabled(enabled: boolean): void; static enableProfiling(): void; private performanceUuid; private performanceSource; childNodes: Map>; childValues: Map>; /** * Explicitly-loaded child ids that are unloaded */ pendingLoadedChildren: Set; /** * Autoloaded child ids that are unloaded */ private pendingAutoloadedChildren; value: SubscriptionValue | SubscriptionValueLoading; private childErrors; private validationErrors; errorFromChildren: JazzError | undefined; private subscription; private dirty; private resolve; private initialResolve; private idsSubscribed; private autoloaded; private autoloadedKeys; private skipInvalidKeys; private totalValidTransactions; private version; private migrated; private migrating; private migrationFailed; closed: boolean; private _cursor; private silenceUpdates; /** * Stack trace captured at subscription creation time. * This helps identify which component/hook created the subscription * when debugging "value unavailable" errors. */ callerStack: Error | undefined; constructor(node: LocalNode, resolve: RefsToResolve, id: string, schema: RefEncoded, skipRetry?: boolean, bestEffortResolution?: boolean, unstable_branch?: BranchDefinition | undefined, cursor?: CoValueCursor | { encoded: CoValueCursor; decoded: DecodedCoValueCursor; }); trackLoadingPerformance(source: string): void; private emitLoadingComplete; updateValue(value: SubscriptionValue): void; private handleUpdate; private computeChildErrors; handleChildUpdate(id: string, value: SubscriptionValue | SubscriptionValueLoading, key?: string): void; private shouldSendUpdates; unloadedValue: NotLoaded | undefined; private lastPromise; private getErrorOpts; getPromise(): PromiseWithStatus; getCachedPromise(): PromiseWithStatus; private getUnloadedValue; private lastErrorLogged; getCurrentValue(): MaybeLoaded; private getCurrentRawValue; private getCreationStackLines; private getError; private logError; private triggerUpdate; subscribers: Set<(value: SubscriptionValue) => void>; subscriberChangeCallbacks: Set<(count: number) => void>; /** * Subscribe to subscriber count changes * Callback receives the total number of subscribers * Returns an unsubscribe function */ onSubscriberChange(callback: (count: number) => void): () => void; private notifySubscriberChange; subscribe(listener: (value: SubscriptionValue) => void): () => void; setListener(listener: (value: SubscriptionValue) => void): void; subscribeToKey(key: string): void; isSubscribedToId(id: string): boolean; /** * Checks if the currently unloaded value has got some updates * * Used to make the autoload work on closed subscription scopes */ pullValue(listener: (value: SubscriptionValue) => void): void; subscribeToId(id: string, descriptor: RefEncoded): void; private loadChildren; private loadCoMapKey; private loadCoListKey; private loadChildNode; private selfAndChildrenFrontiers; get cursor(): `cursor_z${string}` | undefined; createCursor(): `cursor_z${string}`; destroy(): void; } //# sourceMappingURL=SubscriptionScope.d.ts.map