Clean up diff

This commit is contained in:
Andras Schmelczer 2025-03-16 19:49:09 +00:00
parent 8d695999c6
commit 10568efebe
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 25 additions and 57 deletions

View file

@ -107,7 +107,7 @@ export class FileOperations {
currentText = currentText.replace(/\r\n/g, "\n");
if (currentText !== expectedText) {
this.logger.debug(
`Performing a 3-way merge for ${path} with the expected content:\n${expectedText}`
`Performing a 3-way merge for ${path} with the expected content`
);
return mergeText(expectedText, currentText, newText);

View file

@ -452,7 +452,10 @@ export interface components {
Array_of_uint8: number[];
CreateDocumentVersion: {
contentBase64: string;
/** Format: uuid */
/**
* Format: uuid
* @description The client can decide the document id (if it wishes to) in order to help with syncing. If the client does not provide a document id, the server will generate one. If the client provides a document id it must not already exist in the database.
*/
documentId?: string | null;
relativePath: string;
};
@ -476,7 +479,6 @@ export interface components {
type: "FastForwardUpdate";
/** Format: date-time */
updatedDate: string;
vaultId: string;
/** Format: int64 */
vaultUpdateId: number;
}
@ -490,7 +492,6 @@ export interface components {
type: "MergingUpdate";
/** Format: date-time */
updatedDate: string;
vaultId: string;
/** Format: int64 */
vaultUpdateId: number;
};
@ -502,7 +503,6 @@ export interface components {
relativePath: string;
/** Format: date-time */
updatedDate: string;
vaultId: string;
/** Format: int64 */
vaultUpdateId: number;
};
@ -513,7 +513,6 @@ export interface components {
relativePath: string;
/** Format: date-time */
updatedDate: string;
vaultId: string;
/** Format: int64 */
vaultUpdateId: number;
};

View file

@ -60,24 +60,6 @@ export class Syncer {
);
}
private static async forgivingFileNotFoundWrapper<T>(
fn: () => Promise<T>,
logger: Logger
): Promise<T | undefined> {
try {
return await fn();
} catch (e) {
if (e instanceof FileNotFoundError) {
logger.debug(
`File has been deleted or moved before we had a chance to inspect it, skipping`
);
return undefined;
}
throw e;
}
}
public addRemainingOperationsListener(
listener: (remainingOperations: number) => void
): void {
@ -355,13 +337,7 @@ export class Syncer {
// Perhaps the file has been moved; let's check by looking at the deleted files
const contentHash = await this.syncQueue.add(async () => {
const contentBytes =
await Syncer.forgivingFileNotFoundWrapper(
async () => this.operations.read(relativePath),
this.logger
);
if (contentBytes === undefined) {
return;
}
await this.operations.read(relativePath); // this can throw FileNotFoundError
return hash(contentBytes);
});