feat: expose trash entry size metadata
This commit is contained in:
@@ -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 }),
|
||||
]);
|
||||
|
||||
@@ -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]) => ({
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user