From c2492eb1a15ce36fc4db3352665d05f9674076bc Mon Sep 17 00:00:00 2001 From: Aleksandr Grenishin Date: Thu, 29 Feb 2024 17:20:20 +0300 Subject: [PATCH] feat(lr-upload-ctx-provider): add method `removeFileByInternalId` (#618) Co-authored-by: nd0ut --- abstract/UploaderBlock.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/abstract/UploaderBlock.js b/abstract/UploaderBlock.js index 64a8b69d8..1ac3ed87b 100644 --- a/abstract/UploaderBlock.js +++ b/abstract/UploaderBlock.js @@ -260,6 +260,14 @@ export class UploaderBlock extends ActivityBlock { }); } + /** @param {string} internalId */ + removeFileByInternalId(internalId) { + if (!this.uploadCollection.read(internalId)) { + throw new Error(`File with internalId ${internalId} not found`); + } + this.uploadCollection.remove(internalId); + } + uploadAll = () => { const itemsToUpload = this.uploadCollection.items().filter((id) => { const entry = this.uploadCollection.read(id);