@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
20 lines • 999 B
TypeScript
import { DirListing, type FileStat, type PathSpec } from '../../types.ts';
import type { DirRows, LoadRows } from './types.ts';
/**
* A backend's whole document list, served as a directory tree.
*
* Every listing of the mount comes from one fetch, so a folder's listing
* carries every folder below it as seeds. The members are arrow properties so
* they can be handed around as ops without losing `this`.
*/
export declare class SlugTree<A> {
readonly load: LoadRows<A>;
constructor(load: LoadRows<A>);
/** A folder's rows, with every folder below it as seeds. */
readonly readdir: (accessor: A, path: PathSpec, _entry?: FileStat | null) => Promise<DirListing>;
}
/** The tree path of `path`; a glob word keys the folder it lists. */
export declare function treeKey(path: PathSpec): string;
/** The listing of the folder at `path` out of the whole tree's rows. */
export declare function listingAt(rows: DirRows, path: PathSpec): DirListing;
//# sourceMappingURL=tree.d.ts.map