(root: string, rel: string)
| 3323 | } |
| 3324 | |
| 3325 | export async function deleteAsset(root: string, rel: string): Promise<DeletedAsset> { |
| 3326 | const source = await assertAssetFile(root, rel) |
| 3327 | const undoToken = randomUUID() |
| 3328 | const trashDir = resolveSafe(root, `${INTERNAL_VAULT_DIR}/${DELETED_ASSETS_DIR}/${undoToken}`) |
| 3329 | await fs.mkdir(trashDir, { recursive: true }) |
| 3330 | const name = path.basename(source.abs) |
| 3331 | await fs.rename(source.abs, path.join(trashDir, name)) |
| 3332 | return { path: source.rel, name, undoToken } |
| 3333 | } |
| 3334 | |
| 3335 | export async function restoreDeletedAsset(root: string, deleted: DeletedAsset): Promise<AssetMeta> { |
| 3336 | const targetRel = cleanDeletedAssetPath(deleted.path) |
no test coverage detected