Lint & format

This commit is contained in:
Andras Schmelczer 2025-02-23 10:13:34 +00:00
parent 0bf5f024ea
commit f8dcd33d3e
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 7 additions and 10 deletions

View file

@ -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<RelativePath[]> {
public async listAllFiles(): Promise<RelativePath[]> {
return this.fs.listAllFiles();
}
public async read(path: RelativePath): Promise<Uint8Array> {
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<void> {
@ -29,17 +29,17 @@ export class SafeFileSystemOperations implements FileSystemOperations {
path: RelativePath,
updater: (currentContent: string) => string
): Promise<string> {
return this.safeOperation(path, () =>
return this.safeOperation(path, async () =>
this.fs.atomicUpdateText(path, updater)
);
}
public async getFileSize(path: RelativePath): Promise<number> {
return this.safeOperation(path, () => this.fs.getFileSize(path));
return this.safeOperation(path, async () => this.fs.getFileSize(path));
}
public async getModificationTime(path: RelativePath): Promise<Date> {
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<void> {
return this.safeOperation(oldPath, () =>
return this.safeOperation(oldPath, async () =>
this.fs.rename(oldPath, newPath)
);
}

View file

@ -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";