import * as z from 'zod';
export declare const dir: string;
declare const create: unique symbol;
export declare class Handle<S extends z.ZodObject> {
    private init;
    private _data?;
    readonly path: string;
    get schema(): S;
    private constructor();
    load(): void;
    save(): void;
    update(): Promise<void>;
    isValid(): Promise<boolean>;
    get data(): z.infer<S>;
    static [create]<S extends z.ZodObject>(init: Init<S>): Handle<S>;
}
export interface Init<S extends z.ZodObject> {
    path: string;
    schema: S;
    update(existing?: z.infer<S>): z.infer<S> | Promise<z.infer<S>>;
    isValid(data: z.infer<S>, lastUpdatedTs: number): boolean | Promise<boolean>;
    onLoad?(data: z.infer<S>): unknown;
}
export declare function useAt<S extends z.ZodObject>(init: Init<S>): Handle<S>;
export declare const meta: Handle<z.ZodObject<{
    fetched: z.ZodInt;
    session: z.ZodObject<{
        id: z.ZodUUID;
        userId: z.ZodUUID;
        name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
        expires: z.ZodCoercedDate<unknown>;
        created: z.ZodCoercedDate<unknown>;
        elevated: z.ZodBoolean;
        user: z.ZodObject<{
            id: z.ZodUUID;
            name: z.ZodString;
            email: z.ZodEmail;
            emailVerified: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
            preferences: z.ZodLazy<z.ZodObject<{
                debug: z.ZodDefault<z.ZodBoolean>;
            }, z.core.$strip>>;
            roles: z.ZodArray<z.ZodString>;
            tags: z.ZodArray<z.ZodString>;
            registeredAt: z.ZodCoercedDate<unknown>;
            isAdmin: z.ZodBoolean;
            isSuspended: z.ZodBoolean;
        }, z.core.$strip>;
    }, z.core.$strip>;
    apps: z.ZodArray<z.ZodObject<{
        id: z.ZodString;
        name: z.ZodOptional<z.ZodString>;
        image: z.ZodOptional<z.ZodString>;
        icon: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$loose>>;
export declare const sync: Handle<z.ZodObject<{
    objects: z.ZodArray<z.ZodObject<{
        $type: z.ZodString;
        id: z.ZodUUID;
    }, z.core.$loose>>;
    index: z.ZodCoercedBigInt<unknown>;
}, z.core.$strip>>;
export declare function load(): void;
export declare function update(force?: boolean): Promise<void>;
export declare function clear(): void;
export interface CacheInfo {
    path: string;
    size?: bigint;
    exists: boolean;
}
export interface CacheInfoLocal extends CacheInfo {
    valid: boolean;
    fromAPI?: false;
}
export interface CacheInfoAPI extends CacheInfo {
    entries: number;
    fromAPI: true;
}
export declare function info(): AsyncGenerator<CacheInfoLocal | CacheInfoAPI>;
export {};
