import { Kv } from "@e280/kv";
export type HyId = string;
export type HyItem = {
    parent: HyId | null;
    children: HyId[];
};
type HyRecord = [parent: HyId | null, children: HyId[]];
/**
 * Async hierarchy of nestable items.
 *  - items can have multiple children.
 *  - items can only have one parent.
 *  - items can be orphans (bring your own concept of a "root").
 */
export declare class HyTree {
    private records;
    constructor(records: Kv<HyRecord>);
    has(id: HyId): Promise<boolean>;
    get(id: HyId): Promise<HyItem | undefined>;
    gets(...ids: HyId[]): Promise<(HyItem | undefined)[]>;
    require(id: HyId): Promise<HyItem>;
    requires(...ids: HyId[]): Promise<HyItem[]>;
    /** establish an id as a root with no parents, but ready to accept children */
    establishRoot(root: HyId): Promise<void>;
    /** give a parent some children  */
    attach(parent: HyId, ...children: HyId[]): Promise<void>;
    /** detach this id from its parent in the hierarchy */
    detach(id: HyId): Promise<undefined>;
    /** destroy all relations associated with this id, and all its descendants */
    destroy(id: HyId): Promise<void>;
    /** delete absolutely everything */
    clear(): Promise<void>;
    /** iterate over all root items */
    roots(): AsyncGenerator<{
        id: HyId;
        item: HyItem;
    }, void, unknown>;
    /** iterate over this id and all its descendants */
    crawl(id: HyId, predicate?: (id: HyId, path: HyId[]) => Promise<boolean>): AsyncGenerator<{
        id: HyId;
        item: HyItem;
        path: HyId[];
    }, void, unknown>;
}
export {};
