import type { CommunicationContractInterface, LinkStrategyInterface, SubscriberInterface } from "./interfaces"; import type { AsyncPollingProxy, AsyncPullable, AsyncPushable, InputTransfer, OutputTransfer, PollingProxy, Pullable, Pushable, Subscribable, ErrorHandler } from "./types"; import type { LinkConfig } from "./configs"; /** * Abstract base class for link strategies. * * Provides protected helper methods for each linking strategy (sync and async) * and error helpers. Custom strategies can extend this class and override * only the strategies they need to customize, reusing the rest. * * Subclasses must implement {@link LinkStrategyInterface.link}. * * @category Linking */ export declare abstract class BaseLinkStrategy implements LinkStrategyInterface { abstract link>(lhs: OutputTransfer, rhs: RTransfer, options?: LinkConfig): SubscriberInterface; protected _linkSubscribableToPushable(lhs: Subscribable, rhs: Pushable): SubscriberInterface; protected _linkPullableToPollingProxy(lhs: Pullable, rhs: PollingProxy): SubscriberInterface; protected _linkSubscribableToPollingProxy(lhs: Subscribable, rhs: PollingProxy): SubscriberInterface; protected _linkSubscribableToAsyncPushable(lhs: Subscribable, rhs: AsyncPushable, onError?: ErrorHandler>): SubscriberInterface; protected _linkAsyncPullableToAsyncPollingProxy(lhs: AsyncPullable, rhs: AsyncPollingProxy): SubscriberInterface; protected _linkPullableToAsyncPollingProxy(lhs: Pullable, rhs: AsyncPollingProxy): SubscriberInterface; protected _linkSubscribableToAsyncPollingProxy(lhs: Subscribable, rhs: AsyncPollingProxy): SubscriberInterface; protected _throwLinkUnsupportedError(lhs: CommunicationContractInterface, rhs: CommunicationContractInterface): never; } /** * Default implementation of {@link LinkStrategyInterface}. * * Extends {@link BaseLinkStrategy} and implements {@link link} with * standard capability-based dispatch: inspects flags on both transfers * and selects the matching sync or async linking strategy. * * @example * ```typescript * const linkStrategy = new DefaultLinkStrategy(); * const subscriber = linkStrategy.link(source, target); * ``` * * @category Linking */ export declare class DefaultLinkStrategy extends BaseLinkStrategy { /** * Links an output transfer to an input transfer. * * The strategy is determined by capability flags. Sync strategies take * priority over async ones. See {@link linkTransfers} for the full * strategy matrix. * * @typeParam T — data type flowing through the link * @typeParam RTransfer — type of the input transfer (RHS) * @param lhs — output transfer (source) * @param rhs — input transfer (sink) * @param options — optional link config (onError for async-push rejection) * @returns SubscriberInterface for breaking the link */ link>(lhs: OutputTransfer, rhs: RTransfer, options?: LinkConfig): SubscriberInterface; /** * Throws an error for an unsupported asyncPullable → sync-pollingProxy link. * * @category Linking */ protected _throwLinkAsyncPullableToPollingProxyError(): never; /** * Throws an error for an unsupported pullable/asyncPullable → pushable/asyncPushable link. * * @category Linking */ protected _throwLinkPullableToPushableError(): never; } /** * Links an output transfer (LHS) to an input transfer (RHS). * * Delegates to {@link DefaultLinkStrategy.link}. The strategy is determined * by capability flags. Sync operations take priority: if both transfers * support sync linking, it is used. Async strategies are applied only when * sync is not applicable. * * Sync strategies: * - subscribable → pushable: reactive subscription * - pullable → pollingProxy: active polling via setFetcher * - subscribable → pollingProxy: subscription + last-value buffer * * Async strategies: * - subscribable → asyncPushable: subscription + asyncPush with .catch() * - asyncPullable → asyncPollingProxy: active polling via setAsyncFetcher * - pullable → asyncPollingProxy: sync-pull wrapped in an async fetcher * - subscribable → asyncPollingProxy: subscription + buffer + async fetcher * * Errors: * - asyncPullable → sync-pollingProxy: sync poller cannot await * - pullable/asyncPullable → pushable/asyncPushable: needs a Bridge/Triggerable * * Rejection handling for subscribable → asyncPushable: * .catch() is always called. If options.onError is provided, it is invoked * via handleError() and the rejection is suppressed. * Without onError, handleError() rethrows — resulting in an unhandled promise * rejection (the source's subscription remains active). * * Ordering for subscribable → asyncPushable: * No ordering guarantees — fast sync notifications from LHS can overtake * pending asyncPush calls. A serializer is a separate task (not in this queue). * * @param lhs — output transfer (source) * @param rhs — input transfer (sink) * @param options — optional link config (onError for async-push rejection) * @returns SubscriberInterface for breaking the link * * @category Linking */ export declare function linkTransfers>(lhs: OutputTransfer, rhs: RTransfer, options?: LinkConfig): SubscriberInterface; //# sourceMappingURL=linking.d.ts.map