/**
 *  Copyright (C) 2018 Basalt
    This file is part of Knapsack.
    Knapsack is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the Free
    Software Foundation; either version 2 of the License, or (at your option)
    any later version.

    Knapsack is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
    more details.

    You should have received a copy of the GNU General Public License along
    with Knapsack; if not, see <https://www.gnu.org/licenses>.
 */
import { type KnapsackFile } from '@knapsack/types';
import chokidar from 'chokidar';
import { type KnapsackDb } from '../../types/knapsack-db';
import { type CliLifecycle } from '../../types/cli-lifecycle';
export declare class FileDb<ConfigType> implements KnapsackDb<ConfigType>, CliLifecycle {
    #private;
    /**
     * Full path to file used for storage
     */
    filePath: string;
    private type;
    validationSchema: Record<string, unknown>;
    defaults?: ConfigType;
    orderAlphabetically: boolean;
    private fileHashes;
    constructor({ filePath, type, defaults, validationSchema, writeFileIfAbsent, orderAlphabetically, }: {
        filePath: string;
        type?: 'json' | 'yml';
        /**
         * Shallow merge
         */
        defaults?: ConfigType;
        /**
         * JSON Schema to validate read & writes with at run time
         */
        validationSchema?: Record<string, unknown>;
        writeFileIfAbsent?: boolean;
        orderAlphabetically?: boolean;
    });
    init(_opt: Parameters<CliLifecycle['init']>[0]): Promise<void>;
    watchFiles({ handleChange, extraPaths, }: {
        handleChange: (filePath: string) => void;
        extraPaths?: string[];
    }): chokidar.FSWatcher | void;
    /**
     * Ensure the data is good during run-time by using provided JSON Schemas to validate
     * Requires `validationSchema` to be passed in during initial creation
     * @throws Error if it's not valid
     */
    validateConfig(config: ConfigType): void;
    serialize(config: ConfigType): Pick<KnapsackFile, 'contents' | 'encoding'>;
    parse(fileString: string): ConfigType;
    read(): Promise<ConfigType>;
    readSync(): ConfigType;
    savePrep(config?: ConfigType): Promise<KnapsackFile[]>;
    getData(): Promise<ConfigType>;
    getDataSync(): ConfigType;
}
//# sourceMappingURL=file-db.d.ts.map