import { TemporalSupportedObject } from '@mui/x-scheduler-internals/models'; import { Adapter } from '@mui/x-scheduler-internals/use-adapter'; export declare const DEBOUNCE_MS = 150; export declare enum RequestStatus { QUEUED = 0, PENDING = 1, SETTLED = 2, UNKNOWN = 3, } export interface DateRange { start: TemporalSupportedObject; end: TemporalSupportedObject; } /** * Fetches events from the data source with option to limit the number of concurrent requests. * Determines the status of a request based on the enum `RequestStatus`. * Uses date range keys to uniquely identify a request. * * Features: * - Debounces rapid successive requests * - Limits queued requests to prevent queue bloat * - Prioritizes the most recently queued request * - Skips already settled requests */ export declare class SchedulerDataManager { private pendingRequests; private queuedRequests; private settledRequests; private adapter; private maxConcurrentRequests; private maxQueuedRequests; private debounceMs; private timeoutManager; private stagedRanges; private pendingDebounceResolve; private fetchFunction; constructor(adapter: Adapter, fetchFunction: (range: DateRange, adapter: Adapter) => Promise, options?: { maxConcurrentRequests?: number; maxQueuedRequests?: number; debounceMs?: number; }); /** * Helper to safely add ranges to the queue and enforce limits. */ private commitRangesToQueue; private processQueue; /** * The returned promise resolves when the debounce window flushes, NOT when this * specific call's data has been fetched. If a subsequent `queue()` arrives within * the debounce window, the previous promise resolves immediately and the new call * takes over — callers shouldn't treat the resolution as a fetch-completion signal. */ queue: (ranges: DateRange[]) => Promise; /** * Immediately processes the queue without debouncing. * Useful for initial load or forced refresh. */ queueImmediate: (ranges: DateRange[]) => Promise; cancelQueuedRequests: () => void; setRequestSettled: (range: DateRange) => Promise; clear: () => void; clearPendingRequest: (range: DateRange) => Promise; getRequestStatus: (range: DateRange) => RequestStatus; getActiveRequestsCount: () => number; }