///
///
///
import stream from "stream";
import { TransactionBaseService } from "./transaction-base-service";
export type FileServiceUploadResult = {
url: string;
};
export type FileServiceGetUploadStreamResult = {
writeStream: stream.PassThrough;
promise: Promise;
url: string;
fileKey: string;
[x: string]: unknown;
};
export type GetUploadedFileType = {
fileKey: string;
[x: string]: unknown;
};
export type DeleteFileType = {
fileKey: string;
[x: string]: unknown;
};
export type UploadStreamDescriptorType = {
name: string;
ext?: string;
acl?: string;
[x: string]: unknown;
};
export interface IFileService extends TransactionBaseService {
/**
* upload file to fileservice
* @param file Multer file from express multipart/form-data
* */
upload(file: Express.Multer.File): Promise;
/**
* upload private file to fileservice
* @param file Multer file from express multipart/form-data
* */
uploadProtected(file: Express.Multer.File): Promise;
/**
* remove file from fileservice
* @param fileData Remove file described by record
* */
delete(fileData: DeleteFileType): Promise;
/**
* upload file to fileservice from stream
* @param fileData file metadata relevant for fileservice to create and upload the file
* @param fileStream readable stream of the file to upload
* */
getUploadStreamDescriptor(fileData: UploadStreamDescriptorType): Promise;
/**
* download file from fileservice as stream
* @param fileData file metadata relevant for fileservice to download the file
* @returns readable stream of the file to download
* */
getDownloadStream(fileData: GetUploadedFileType): Promise;
/**
* Generate a presigned download url to obtain a file
* @param fileData file metadata relevant for fileservice to download the file
* @returns presigned url to download the file
* */
getPresignedDownloadUrl(fileData: GetUploadedFileType): Promise;
}
export declare abstract class AbstractFileService extends TransactionBaseService implements IFileService {
abstract upload(fileData: Express.Multer.File): Promise;
abstract uploadProtected(fileData: Express.Multer.File): Promise;
abstract delete(fileData: DeleteFileType): Promise;
abstract getUploadStreamDescriptor(fileData: UploadStreamDescriptorType): Promise;
abstract getDownloadStream(fileData: GetUploadedFileType): Promise;
abstract getPresignedDownloadUrl(fileData: GetUploadedFileType): Promise;
}
export declare const isFileService: (object: unknown) => boolean;