@punks/backend-entity-manager 0.0.456 → 0.0.457

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ export type FileReference = {
19
19
  };
20
20
  export interface IFileManager {
21
21
  uploadFile(file: FileData): Promise<FileReference>;
22
+ removeFile(fileId: string): Promise<void>;
22
23
  getFileContent(fileId: string): Promise<FileData>;
23
24
  getFileDownloadUrl(fileId: string): Promise<FileDownloadUrl>;
24
25
  }
@@ -4,6 +4,7 @@ export declare class FilesManager implements IFileManager {
4
4
  private readonly registry;
5
5
  constructor(registry: EntityManagerRegistry);
6
6
  uploadFile(file: FileData): Promise<FileReference>;
7
+ removeFile(fileId: string): Promise<void>;
7
8
  getFileContent(fileId: string): Promise<FileData>;
8
9
  getFileDownloadUrl(fileId: string): Promise<FileDownloadUrl>;
9
10
  getFileReferenceDownloadUrl({ reference, providerId, }: {
package/dist/esm/index.js CHANGED
@@ -23011,6 +23011,13 @@ let FilesManager = class FilesManager {
23011
23011
  reference: record.reference,
23012
23012
  };
23013
23013
  }
23014
+ async removeFile(fileId) {
23015
+ const ref = await this.referencesRepo.getReference(fileId);
23016
+ await this.getFileProvider(ref.providerId).deleteFile({
23017
+ reference: ref.reference,
23018
+ });
23019
+ await this.referencesRepo.deleteReference(fileId);
23020
+ }
23014
23021
  async getFileContent(fileId) {
23015
23022
  const ref = await this.referencesRepo.getReference(fileId);
23016
23023
  const content = await this.getFileProvider(ref.providerId).downloadFile({