From 9445bbd21ff7e97c3b4d9804711d204969a38d1a Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 27 Sep 2026 19:30:56 +0100 Subject: [PATCH] Remove clutter --- frontend/sync-client/src/errors/errors.ts | 16 +++--------- .../sync-operations/file-change-notifier.ts | 12 --------- .../src/types/vault-history-status.ts | 4 --- .../sync-client/src/utils/create-promise.ts | 25 ------------------- 4 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 frontend/sync-client/src/sync-operations/file-change-notifier.ts delete mode 100644 frontend/sync-client/src/types/vault-history-status.ts delete mode 100644 frontend/sync-client/src/utils/create-promise.ts diff --git a/frontend/sync-client/src/errors/errors.ts b/frontend/sync-client/src/errors/errors.ts index 6026d692..1169453d 100644 --- a/frontend/sync-client/src/errors/errors.ts +++ b/frontend/sync-client/src/errors/errors.ts @@ -19,19 +19,9 @@ export class AuthenticationError extends Error { } } -export class FileNotFoundError extends Error { - public constructor( - message: string, - public readonly filePath: string - ) { - super(message); - this.name = "FileNotFoundError"; - } -} +export class PermanentSyncError extends Error {} -export class PermanentSyncError extends Error { } - -export class LocalChangesDuringReconciliation extends Error { } +export class LocalChangesDuringReconciliation extends Error {} /** The server rejected a checkpoint from a discarded/restored history. */ -export class ServerHistoryChangedError extends Error { } +export class ServerHistoryChangedError extends Error {} diff --git a/frontend/sync-client/src/sync-operations/file-change-notifier.ts b/frontend/sync-client/src/sync-operations/file-change-notifier.ts deleted file mode 100644 index d1e49d62..00000000 --- a/frontend/sync-client/src/sync-operations/file-change-notifier.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { RelativePath } from "../persistence/database"; -import { EventListeners } from "../utils/data-structures/event-listeners"; - -export class FileChangeNotifier { - public readonly onFileChanged = new EventListeners< - (filePath: RelativePath) => unknown - >(); - - public notifyOfFileChange(filePath: RelativePath): void { - this.onFileChanged.trigger(filePath); - } -} diff --git a/frontend/sync-client/src/types/vault-history-status.ts b/frontend/sync-client/src/types/vault-history-status.ts deleted file mode 100644 index 74478822..00000000 --- a/frontend/sync-client/src/types/vault-history-status.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum VaultHistoryStatus { - MISSING = "missing", - STORED = "stored" -} \ No newline at end of file diff --git a/frontend/sync-client/src/utils/create-promise.ts b/frontend/sync-client/src/utils/create-promise.ts deleted file mode 100644 index a49196ee..00000000 --- a/frontend/sync-client/src/utils/create-promise.ts +++ /dev/null @@ -1,25 +0,0 @@ -type ResolveFunction = undefined extends T - ? (value?: T) => unknown - : (value: T) => unknown; - -/** - * A type-safe utility function to create a Promise with resolve and reject functions. - * @returns A tuple containing a Promise, a resolve function, and a reject function. - */ -export function createPromise(): [ - Promise, - ResolveFunction, - (error: unknown) => unknown -] { - let resolve: undefined | ResolveFunction = undefined; - let reject: undefined | ((error: unknown) => unknown) = undefined; - - const creationPromise = new Promise( - (resolve_, reject_) => - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion - ((resolve = resolve_ as ResolveFunction), (reject = reject_)) - ); - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return [creationPromise, resolve!, reject!]; -}