From f8dcd33d3eee77bf8d5bcb6fe1d51dc95c9c7616 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 23 Feb 2025 10:13:34 +0000 Subject: [PATCH] Lint & format --- .../file-operations/safe-filesystem-operations.ts | 14 +++++++------- frontend/sync-client/src/sync-operations/syncer.ts | 3 --- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts b/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts index 3776e63..e7c1d29 100644 --- a/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts +++ b/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts @@ -1,4 +1,4 @@ -import { FileSystemOperations } from "dist/types"; +import type { FileSystemOperations } from "dist/types"; import type { RelativePath } from "src/persistence/database"; export class FileNotFoundError extends Error { @@ -13,12 +13,12 @@ export class FileNotFoundError extends Error { export class SafeFileSystemOperations implements FileSystemOperations { public constructor(private readonly fs: FileSystemOperations) {} - public listAllFiles(): Promise { + public async listAllFiles(): Promise { return this.fs.listAllFiles(); } public async read(path: RelativePath): Promise { - return this.safeOperation(path, () => this.fs.read(path)); + return this.safeOperation(path, async () => this.fs.read(path)); } public async write(path: RelativePath, content: Uint8Array): Promise { @@ -29,17 +29,17 @@ export class SafeFileSystemOperations implements FileSystemOperations { path: RelativePath, updater: (currentContent: string) => string ): Promise { - return this.safeOperation(path, () => + return this.safeOperation(path, async () => this.fs.atomicUpdateText(path, updater) ); } public async getFileSize(path: RelativePath): Promise { - return this.safeOperation(path, () => this.fs.getFileSize(path)); + return this.safeOperation(path, async () => this.fs.getFileSize(path)); } public async getModificationTime(path: RelativePath): Promise { - return this.safeOperation(path, () => + return this.safeOperation(path, async () => this.fs.getModificationTime(path) ); } @@ -60,7 +60,7 @@ export class SafeFileSystemOperations implements FileSystemOperations { oldPath: RelativePath, newPath: RelativePath ): Promise { - return this.safeOperation(oldPath, () => + return this.safeOperation(oldPath, async () => this.fs.rename(oldPath, newPath) ); } diff --git a/frontend/sync-client/src/sync-operations/syncer.ts b/frontend/sync-client/src/sync-operations/syncer.ts index 68d1c96..0c764c3 100644 --- a/frontend/sync-client/src/sync-operations/syncer.ts +++ b/frontend/sync-client/src/sync-operations/syncer.ts @@ -3,12 +3,9 @@ import type { Database, RelativePath } from "../persistence/database"; import type { SyncService } from "src/services/sync-service"; import type { Logger } from "src/tracing/logger"; import type { SyncHistory } from "src/tracing/sync-history"; -import { SyncSource, SyncStatus, SyncType } from "src/tracing/sync-history"; -import { unlockDocument, waitForDocumentLock } from "./document-lock"; import PQueue from "p-queue"; import { hash } from "src/utils/hash"; import type { components } from "src/services/types"; -import { deserialize } from "src/utils/deserialize"; import type { Settings } from "src/persistence/settings"; import type { FileOperations } from "src/file-operations/file-operations"; import { findMatchingFileBasedOnHash } from "src/utils/find-matching-file-based-on-hash";