/** * Coordinates the *lifecycle* of Server-Side Row Model requests: cancellation, * race-condition safety, and retries. It knows nothing about the grid — it just * drives a {@link ServerSideDatasource} — so it stays framework-free and * unit-testable. * * Guarantees: * - **One in-flight request:** issuing a new request aborts the previous one via * `AbortController` (rapid scroll/sort/filter never pile up). * - **Latest-wins:** a response is discarded (`execute` resolves `null`) if a * newer request started while it was in flight, so stale data is never applied. * - **Retry:** failed attempts are retried up to `maxRetries` (with `retryDelay`), * surfacing each attempt through {@link ExecuteHooks.onRetry}. * * The `AbortController` bridging pattern mirrors the AI provider's * `fetchWithTimeout`. * * @packageDocumentation */ import type { ServerSideDatasource, ServerSideRequest, ServerSideResult } from '../../types/server-side.types'; /** Optional callbacks fired during {@link ServerRequestController.execute}. */ export interface ExecuteHooks { /** Invoked before each retry attempt (1-based) with the previous error. */ onRetry?(attempt: number, error: unknown): void; } /** Manages abort / race / retry for datasource requests. */ export declare class ServerRequestController { private readonly maxRetries; private readonly retryDelay; private currentController; private latestRequestId; constructor(maxRetries?: number, retryDelay?: number); /** Aborts any in-flight request (e.g. on grid destroy or when superseded). */ abort(): void; /** * Runs a request against the datasource with abort + retry, returning its * result — or `null` if it was aborted or superseded by a newer request. */ execute(request: ServerSideRequest, datasource: ServerSideDatasource, hooks?: ExecuteHooks): Promise | null>; /** Aborts and forgets any in-flight request. */ destroy(): void; private isSuperseded; /** Invokes the datasource once, resolving on `success`, rejecting on `fail`/abort/throw. */ private runOnce; /** A cancellable delay used between retries. */ private delay; } //# sourceMappingURL=server-request-controller.d.ts.map