import { JobStatusClient } from "@aics/job-status-client"; import { JSSJob } from "@aics/job-status-client/type-declarations/types"; import { FSSConnection, LabKeyConnection, MMSConnection } from "./connections"; import { CustomMetadataQuerier } from "./custom-metadata-querier"; import { FileManagementSystemConfig, FileMetadata, FileToFileMetadata, ImageModelMetadata, StartUploadResponse, UploadResponse, Uploads } from "./types"; import { Uploader } from "./uploader"; export declare const getDuplicateFilesError: (name: string) => string; export declare const getFileDoesNotExistError: (fullpath: string) => string; export declare const getFilePropertyMissingError: (fullpath: string) => string; export declare const getFileTypePropertyMissingError: (fullpath: string) => string; export declare const noFilesError = "No files were included in the request"; export declare const getOriginalPathPropertyMissingError: (fullpath: string) => string; export declare const getOriginalPathPropertyDoesntMatch: (fullpath: string, originalPath: string) => string; export declare const AICSFILES_LOGGER = "aicsfiles"; export declare const getCopyChildJobName: (filepath: string) => string; export declare class FileManagementSystem { readonly fss: FSSConnection; readonly mms: MMSConnection; readonly lk: LabKeyConnection; readonly jobStatusClient: JobStatusClient; private readonly logger; readonly uploader: Uploader; readonly customMetadataQuerier: CustomMetadataQuerier; static innerJoinFileMetadata(fileMetadata1: FileToFileMetadata, fileMetadata2: FileToFileMetadata): FileToFileMetadata; get port(): string; set port(port: string); get host(): string; set host(host: string); get username(): string; set username(username: string); get mountPoint(): string; setMountPoint: (mountPoint: string) => Promise; constructor(config: FileManagementSystemConfig); /*** * Check for duplicate file names in a metadata mapping. FSS will allow multiple files with the same name to be uploaded, but ultimately only the most recently added will have precedence. This will raise an exception if a file with a duplicate name (but in a different folder) is found * @param metadata * @param uploadJobName * Throws InvalidMetadataError if a file was not found or if more than one files have the same name * returns StartUploadResponse */ validateMetadataAndGetUploadDirectory(metadata: Uploads, uploadJobName: string): Promise; /*** * Uploads one or more files and saves metadata associated with each file * @param startUploadResponse * @param uploads an object where the keys are fullpaths of the files to upload and the values are * metadata objects whose structures are defined by * http://confluence.corp.alleninstitute.org/display/SF/Metadata+Structure+for+Files+in+FMS * @param jobName Used to identify messages sent by aicsfiles. * @param copyProgressCb Optional callback that takes total bytes copied as param and does something with it * @param copyProgressCbThrottleMs minimum amount of ms between calls to copyProgressCb */ uploadFiles(startUploadResponse: StartUploadResponse, uploads: Uploads, jobName: string, copyProgressCb?: (originalFilePath: string, bytesCopied: number, totalBytes: number) => void, copyProgressCbThrottleMs?: number): Promise; retryUpload(uploadJob: JSSJob, copyProgressCb?: (originalFilePath: string, bytesCopied: number, totalBytes: number) => void, copyProgressCbThrottleMs?: number): Promise; /** * Marks a job and its children as failed in JSS. * @param jobId - ID of the JSS Job to fail. * @param failureMessage - Optional message that will be written to * `serviceFields.mostRecentFailure`. Defaults to "Job failed". * @param failureStatus - Optional status to fail the job with. Defaults to * "FAILED". * @param setError - Also set `serviceFields.error` to `failureMessage`. */ failUpload(jobId: string, failureMessage?: string, failureStatus?: "FAILED" | "UNRECOVERABLE", setError?: boolean): Promise; getFilesByAnnotation(annotationName: string, searchValue: string): Promise; getCustomMetadataForFile(fileId: string): Promise; getFilesByUser(userName: string): Promise; getFilesByTemplate(templateId: number): Promise; transformFileMetadataIntoTable(fileToFileMetadata: FileToFileMetadata, transformDates?: boolean): Promise; transformTableIntoCSV(header: string[], rows: ImageModelMetadata[], separator?: string): string; }