From 9546dc2aa39ab096ccc723786e718a739d0bdaf9 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 27 Jan 2022 00:17:22 +0100 Subject: refactor: Coding conventions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that files have a default import with the same name as the file whenever possible to reduce surprise. Also shuffles around some file names for better legibility. Signed-off-by: Kristóf Marussy --- .../src/infrastructure/config/ConfigRepository.ts | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/main/src/infrastructure/config/ConfigRepository.ts (limited to 'packages/main/src/infrastructure/config/ConfigRepository.ts') diff --git a/packages/main/src/infrastructure/config/ConfigRepository.ts b/packages/main/src/infrastructure/config/ConfigRepository.ts new file mode 100644 index 0000000..0ce7fc1 --- /dev/null +++ b/packages/main/src/infrastructure/config/ConfigRepository.ts @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021-2022 Kristóf Marussy + * + * This file is part of Sophie. + * + * Sophie is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, version 3. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import type { Config } from '../../stores/SharedStore'; +import type Disposer from '../../utils/Disposer'; + +export type ReadConfigResult = + | { found: true; data: unknown } + | { found: false }; + +export default interface ConfigPersistence { + readConfig(): Promise; + + writeConfig(config: Config): Promise; + + watchConfig(callback: () => Promise, throttleMs: number): Disposer; +} -- cgit v1.2.3-70-g09d2