update api
This commit is contained in:
parent
53b9b51f5f
commit
d5ff50a1b0
5 changed files with 4 additions and 48 deletions
|
|
@ -49,10 +49,6 @@ export class FileOperations {
|
||||||
return this.fs.getFileSize(path);
|
return this.fs.getFileSize(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getModificationTime(path: RelativePath): Promise<Date> {
|
|
||||||
return this.fs.getModificationTime(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async exists(path: RelativePath): Promise<boolean> {
|
public async exists(path: RelativePath): Promise<boolean> {
|
||||||
return this.fs.exists(path);
|
return this.fs.exists(path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ export interface FileSystemOperations {
|
||||||
updater: (currentContent: string) => string
|
updater: (currentContent: string) => string
|
||||||
) => Promise<string>;
|
) => Promise<string>;
|
||||||
getFileSize: (path: RelativePath) => Promise<number>;
|
getFileSize: (path: RelativePath) => Promise<number>;
|
||||||
getModificationTime: (path: RelativePath) => Promise<Date>;
|
|
||||||
exists: (path: RelativePath) => Promise<boolean>;
|
exists: (path: RelativePath) => Promise<boolean>;
|
||||||
createDirectory: (path: RelativePath) => Promise<void>;
|
createDirectory: (path: RelativePath) => Promise<void>;
|
||||||
delete: (path: RelativePath) => Promise<void>;
|
delete: (path: RelativePath) => Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -69,17 +69,6 @@ export class SafeFileSystemOperations implements FileSystemOperations {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getModificationTime(path: RelativePath): Promise<Date> {
|
|
||||||
this.logger.debug(`Getting modification time: ${path}`);
|
|
||||||
return this.safeOperation(
|
|
||||||
path,
|
|
||||||
this.decorateToHoldLock(path, async () =>
|
|
||||||
this.fs.getModificationTime(path)
|
|
||||||
),
|
|
||||||
"getModificationTime"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async exists(path: RelativePath): Promise<boolean> {
|
public async exists(path: RelativePath): Promise<boolean> {
|
||||||
this.logger.debug(`Checking if file exists: ${path}`);
|
this.logger.debug(`Checking if file exists: ${path}`);
|
||||||
return this.decorateToHoldLock(path, async () =>
|
return this.decorateToHoldLock(path, async () =>
|
||||||
|
|
|
||||||
|
|
@ -452,25 +452,17 @@ export interface components {
|
||||||
Array_of_uint8: number[];
|
Array_of_uint8: number[];
|
||||||
CreateDocumentVersion: {
|
CreateDocumentVersion: {
|
||||||
contentBase64: string;
|
contentBase64: string;
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
relativePath: string;
|
relativePath: string;
|
||||||
};
|
};
|
||||||
CreateDocumentVersionMultipart: {
|
CreateDocumentVersionMultipart: {
|
||||||
content: components["schemas"]["Array_of_uint8"];
|
content: components["schemas"]["Array_of_uint8"];
|
||||||
/** Format: date-time */
|
|
||||||
created_date: string;
|
|
||||||
relative_path: string;
|
relative_path: string;
|
||||||
};
|
};
|
||||||
DeleteDocumentVersion: {
|
DeleteDocumentVersion: {
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
relativePath: string;
|
relativePath: string;
|
||||||
};
|
};
|
||||||
/** @description Response to an update document request. */
|
/** @description Response to an update document request. */
|
||||||
DocumentUpdateResponse: {
|
DocumentUpdateResponse: {
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: uuid */
|
/** Format: uuid */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
|
|
@ -484,8 +476,6 @@ export interface components {
|
||||||
vaultUpdateId: number;
|
vaultUpdateId: number;
|
||||||
} | {
|
} | {
|
||||||
contentBase64: string;
|
contentBase64: string;
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: uuid */
|
/** Format: uuid */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
|
|
@ -500,8 +490,6 @@ export interface components {
|
||||||
};
|
};
|
||||||
DocumentVersion: {
|
DocumentVersion: {
|
||||||
contentBase64: string;
|
contentBase64: string;
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: uuid */
|
/** Format: uuid */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
|
|
@ -513,8 +501,6 @@ export interface components {
|
||||||
vaultUpdateId: number;
|
vaultUpdateId: number;
|
||||||
};
|
};
|
||||||
DocumentVersionWithoutContent: {
|
DocumentVersionWithoutContent: {
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: uuid */
|
/** Format: uuid */
|
||||||
documentId: string;
|
documentId: string;
|
||||||
isDeleted: boolean;
|
isDeleted: boolean;
|
||||||
|
|
@ -586,16 +572,12 @@ export interface components {
|
||||||
};
|
};
|
||||||
UpdateDocumentVersion: {
|
UpdateDocumentVersion: {
|
||||||
contentBase64: string;
|
contentBase64: string;
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: int64 */
|
/** Format: int64 */
|
||||||
parentVersionId: number;
|
parentVersionId: number;
|
||||||
relativePath: string;
|
relativePath: string;
|
||||||
};
|
};
|
||||||
UpdateDocumentVersionMultipart: {
|
UpdateDocumentVersionMultipart: {
|
||||||
content: components["schemas"]["Array_of_uint8"];
|
content: components["schemas"]["Array_of_uint8"];
|
||||||
/** Format: date-time */
|
|
||||||
createdDate: string;
|
|
||||||
/** Format: int64 */
|
/** Format: int64 */
|
||||||
parentVersionId: number;
|
parentVersionId: number;
|
||||||
relativePath: string;
|
relativePath: string;
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,6 @@ export class MockClient implements FileSystemOperations {
|
||||||
return (await this.read(path)).length;
|
return (await this.read(path)).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getModificationTime(path: RelativePath): Promise<Date> {
|
|
||||||
if (!this.localFiles.has(path)) {
|
|
||||||
throw new Error(`File ${path} does not exist`);
|
|
||||||
}
|
|
||||||
return new Date();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async exists(path: RelativePath): Promise<boolean> {
|
public async exists(path: RelativePath): Promise<boolean> {
|
||||||
return this.localFiles.has(path);
|
return this.localFiles.has(path);
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +61,7 @@ export class MockClient implements FileSystemOperations {
|
||||||
`Creating file ${path} with content ${new TextDecoder().decode(newContent)}`
|
`Creating file ${path} with content ${new TextDecoder().decode(newContent)}`
|
||||||
);
|
);
|
||||||
this.localFiles.set(path, newContent);
|
this.localFiles.set(path, newContent);
|
||||||
void this.client.syncer.syncLocallyCreatedFile(path, new Date());
|
void this.client.syncer.syncLocallyCreatedFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createDirectory(_path: RelativePath): Promise<void> {
|
public async createDirectory(_path: RelativePath): Promise<void> {
|
||||||
|
|
@ -93,8 +86,7 @@ export class MockClient implements FileSystemOperations {
|
||||||
);
|
);
|
||||||
|
|
||||||
void this.client.syncer.syncLocallyUpdatedFile({
|
void this.client.syncer.syncLocallyUpdatedFile({
|
||||||
relativePath: path,
|
relativePath: path
|
||||||
updateTime: new Date()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return newContent;
|
return newContent;
|
||||||
|
|
@ -108,8 +100,7 @@ export class MockClient implements FileSystemOperations {
|
||||||
);
|
);
|
||||||
|
|
||||||
void this.client.syncer.syncLocallyUpdatedFile({
|
void this.client.syncer.syncLocallyUpdatedFile({
|
||||||
relativePath: path,
|
relativePath: path
|
||||||
updateTime: new Date()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,8 +131,7 @@ export class MockClient implements FileSystemOperations {
|
||||||
|
|
||||||
void this.client.syncer.syncLocallyUpdatedFile({
|
void this.client.syncer.syncLocallyUpdatedFile({
|
||||||
oldPath,
|
oldPath,
|
||||||
relativePath: newPath,
|
relativePath: newPath
|
||||||
updateTime: new Date()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue