import type { TStorageObject } from './types.js'; /** Both providers already cap an unqualified list at 1,000, so stating it leaves * single-page directories byte-identical. */ export declare const LIST_PAGE_SIZE = 1000; export type TListPageRequest = { cursor?: string; /** Overridable so a test can page without seeding 2,000 objects. */ pageSize?: number; }; /** Keyed by tree path. */ export type TDirectoryListing = { /** Present ⇒ more entries exist and the provider can resume from here. */ cursor?: string | undefined; /** 0 ⇒ never listed, which is what tells "empty" apart from "not asked yet". */ pagesLoaded: number; /** Not `loadingPaths`, which swaps the whole table for a skeleton and would blank * the rows being read. */ loadingMore: boolean; /** The storage-level error surfaces only on an empty folder, so without this a * failure mid-folder is invisible. */ error?: string | undefined; /** The error's own text, shown under `error` as technical detail. */ errorDetail?: string | undefined; /** A new array per page, never mutated: the builder reuses work by identity. */ entries: readonly TStorageObject[]; }; /** Uncapped, opening a 200k-object folder and scrolling would walk all of it. */ export declare const MAX_AUTO_PAGES = 5; export type TListings = ReadonlyMap; export declare function isListed(listings: TListings, path: string): boolean; /** True even while a request is in flight, so the sentinel stays put. */ export declare function hasMore(listings: TListings, path: string): boolean; /** Auto-load stops at the cap; past it the user asks for each page. */ export declare function canAutoLoadMore(listings: TListings, path: string): boolean; export declare function isLoadingMore(listings: TListings, path: string): boolean; export declare function loadMoreError(listings: TListings, path: string): string | undefined; export declare function beginLoadingMore(listings: TListings, path: string): TListings; type TListPage = { cursor?: string | undefined; entries: readonly TStorageObject[]; }; export declare function advanceListing(listings: TListings, path: string, page: TListPage): TListings; /** Subfolders the page no longer names lose their records, or a re-created folder * would show old contents; the rest keep theirs, since a refresh lists them * alongside this one and a parent landing later must not undo a child's page. */ export declare function replaceListing(listings: TListings, path: string, page: TListPage): TListings; /** `pagesLoaded` stays put, so a failed first page still reads as unlisted. */ export declare function recordListingError(listings: TListings, path: string, error: string, errorDetail?: string): TListings; export declare function loadMoreErrorDetail(listings: TListings, path: string): string | undefined; /** Keeps the cursor and pages, so a retry resumes paging instead of starting over. */ export declare function clearListingError(listings: TListings, path: string): TListings; export declare function clearListingsUnder(listings: TListings, path: string): TListings; export declare function retainListings(listings: TListings, paths: ReadonlySet): TListings; /** Tree paths whose children should keep arrival order, since sorting them would * reshuffle rows under the user mid-scroll. */ export declare function incompletePaths(listings: TListings): Set; /** Reached only when the target is deep inside a directory of well over 20,000 * entries, where the alternative is draining it all. */ export declare const MAX_HYDRATION_PAGES = 20; type THydrationStep = /** List this directory's first page. */ { kind: 'fetch'; path: string; } /** Pull another page; the target is not in what we have. */ | { kind: 'more'; path: string; } /** The deepest directory reached. */ | { kind: 'stuck'; path: string; } /** Either resolved, or a request is already in flight. */ | { kind: 'done'; }; /** What a deep link needs next. Pure so the walk is table-testable. */ export declare function nextHydrationStep({ targetResolved, ancestors, isListableDir, listings, inFlight, pagesPulled, }: { targetResolved: boolean; /** Directory paths from the storage root down to the target. */ ancestors: readonly string[]; /** False above the storage root, and false for a directory a page has not * introduced yet. */ isListableDir: (path: string) => boolean; listings: TListings; /** Must not be a state value: it would lag the claim by a render and make an * in-flight ancestor read as stuck. */ inFlight: { has(path: string): boolean; }; pagesPulled: number; }): THydrationStep; export {};