/** * 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 . */ 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 implements KnapsackDb, CliLifecycle { #private; /** * Full path to file used for storage */ filePath: string; private type; validationSchema: Record; 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; writeFileIfAbsent?: boolean; orderAlphabetically?: boolean; }); init(_opt: Parameters[0]): Promise; 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; parse(fileString: string): ConfigType; read(): Promise; readSync(): ConfigType; savePrep(config?: ConfigType): Promise; getData(): Promise; getDataSync(): ConfigType; } //# sourceMappingURL=file-db.d.ts.map