@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
23 lines • 1.2 kB
TypeScript
import { FileStat } from '../../types.ts';
import type { DirRows } from './types.ts';
/** A metadata scalar as text; null for anything that is not one. */
export declare function scalarString(value: unknown): string | null;
/**
* Turn a backend slug into an absolute tree path.
*
* Args:
* value: the slug as the backend stores it.
* noun: what the backend calls a slug, for the error wording.
*/
export declare function normalizeSlug(value: string, noun: string): string;
/**
* Drop every file that another file needs as its directory. A backend that
* refuses such a tree throws from `onCollision`, which hears
* `(ancestor, path)` for each path dropped, `ancestor` being the file.
*/
export declare function dropCollisions<V>(files: ReadonlyMap<string, V>, onCollision: (ancestor: string, path: string) => void): Map<string, V>;
/** Lay files out as each folder's rows, keyed by the folder's tree path. */
export declare function dirRows<V>(files: ReadonlyMap<string, V>, fileRow: (path: string, value: V) => FileStat): DirRows;
/** A folder of the tree, which exists only as its listing. */
export declare function folderRow(name: string): FileStat;
//# sourceMappingURL=rows.d.ts.map