import type { DisposableInterface, SubscriberInterface } from "./interfaces"; import type { DataHandler } from "./types"; /** * Wraps an unsubscribe callback into a managed subscription with active-state tracking and lifecycle hooks. * @category Helpers */ export declare class Subscriber implements SubscriberInterface { private readonly _unsubscribe; private readonly _onUnsubscribeHandlers; private _active; constructor(unsubscribe: (subscriber: SubscriberInterface) => void); get active(): boolean; unsubscribe(): void; onUnsubscribe(handler: DataHandler): SubscriberInterface; offUnsubscribe(handler: DataHandler): SubscriberInterface; } /** * Manages a set of subscribers backed by a ProxyReference — notifies all listeners on sendState(). * @category Helpers */ export declare class SubscriptionManager implements DisposableInterface { private _state; protected _listeners: Set>; protected _subscribers: Set; constructor(valueRef: ProxyReference); sendState(): boolean; subscribe(handler: DataHandler): SubscriberInterface; destroy(): void; } /** * Subscription manager for object state changes. * * Reuses ProxyReference and SubscriptionManager from helpers.ts. * The value (usually the owner object itself) is set once in the constructor * and never becomes undefined, so every notify() is guaranteed to * notify all subscribers with that value. * * Used to implement GateInterface.onStateChange(). * * @category Helpers */ export declare class StateSubscriptionManager implements DisposableInterface { private readonly _ref; private readonly _manager; constructor(value: T); subscribe(handler: DataHandler): SubscriberInterface; notify(): void; destroy(): void; } /** * Adapts a SubscriberInterface into a DisposableInterface — destroy() delegates to unsubscribe(). * @category Helpers */ export declare class DisposableSubscriberAdapter implements DisposableInterface { private _subscriber; constructor(subscriber: SubscriberInterface); destroy(): void; } /** * Mutable reference wrapper — holds a single value with clear/extract semantics. * @category Helpers */ export declare class ProxyReference { value: T | undefined; constructor(initialValue?: T); clear(): void; pop(): T | undefined; } /** * Ordered result queue for parallel-then-emit patterns. * * Used by AsyncConvertTransfer and AsyncConditionTransfer when * maxConcurrency > 1. Multiple async operations run in * parallel, but their results are emitted to subscribers strictly in * arrival order: a result with a higher sequence number waits in the * queue until all lower-numbered results have been emitted. * * Mechanics: * - nextSeq() — assigns a monotonically increasing sequence number * - submit(seq, value) — stores a completed result * - drain(handler) — emits all consecutively-numbered results starting * from the expected sequence number * - clear() — discards all pending results (used on destroy) * * @category Helpers */ export declare class PendingResultQueue { private _nextSeq; private _expectedSeq; private _pending; /** Assigns the next sequence number for a new operation. */ nextSeq(): number; /** Stores a completed result indexed by its sequence number. */ submit(seq: number, value: T): void; /** * Emits all consecutively-numbered results starting from the expected * sequence number. Stops at the first gap (a not-yet-completed operation). */ drain(handler: (value: T) => void): void; /** Discards all pending results and resets sequence counters. */ clear(): void; } /** * Sequential async task executor for ordered side-effect patterns. * * Used by AsyncSinkTransfer and AsyncWriteTransfer when the `ordered` * config option is enabled. Tasks are queued and executed one at a time * in submission order, regardless of their internal async duration. * * Mechanics: * - submit(task) — appends an async task to a promise chain * - reset() — discards the chain (used on destroy) * * Error handling: * - Tasks are responsible for their own error handling (via handleError). * - The chain wraps each task in .catch(() => undefined) so that a * throwing task does not break the chain for subsequent tasks. * * @category Helpers */ export declare class OrderedExecutor { private _chain; private _generation; /** * Appends an async task to the sequential execution chain. * Returns a promise that resolves/rejects with the task's own outcome. * The chain itself never rejects (errors are caught) so subsequent * tasks always run. */ submit(task: () => Promise): Promise; /** Resets the executor, discarding any pending (not yet started) tasks. */ reset(): void; } //# sourceMappingURL=helpers.d.ts.map