feat: expose trash entry size metadata

This commit is contained in:
2026-07-10 08:30:39 +08:00
parent dd9168dad5
commit 5ddf7f2020
9 changed files with 11 additions and 4 deletions
+1
View File
@@ -351,6 +351,7 @@ describe('VerstakPluginAPI contract', () => {
expect(trash.originalPath).toBe('PlatformTest/two.txt');
expect(trash.trashId).toBeTruthy();
expect(trash.trashPath).toMatch(/^\.verstak\/trash\/files\/.+\/two\.txt$/);
expect(trash.size).toBe(5);
await expect(api.files.listTrash()).resolves.toEqual([
expect.objectContaining({ originalPath: 'PlatformTest/two.txt', trashId: trash.trashId }),
]);
+1
View File
@@ -316,6 +316,7 @@ export function createMockPluginAPI(pluginId = 'test.plugin', options: MockPlugi
deletedAt: new Date().toISOString(),
originalType: node.type,
basename: baseName(path),
size: node.type === 'file' ? (node.content || '').length : 0,
};
const moving = Array.from(files.entries()).filter(([candidate]) => candidate === path || candidate.startsWith(`${path}/`));
trashPayloads.set(trashId, moving.map(([candidate, movingNode]) => ({
+2
View File
@@ -154,6 +154,8 @@ export interface TrashResult {
trashPath: string;
trashId: string;
deletedAt: string;
/** Original regular-file size in bytes, when the host can provide it. */
size?: number;
}
export interface TrashEntry extends TrashResult {