@nhost/hasura-storage-js
Version:
Hasura-storage client
36 lines (35 loc) • 1.22 kB
TypeScript
import { InterpreterFrom } from 'xstate';
import { FileItemRef, FileUploadMachine } from '../machines';
import { FileUploadConfig, StorageActionErrorState, StorageUploadFileParams } from '../utils';
export interface UploadProgressState {
/**
* Returns `true` when the file is being uploaded.
*/
isUploading: boolean;
/**
* Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
*/
progress: number | null;
}
export interface UploadFileHandlerResult extends StorageActionErrorState {
/**
* Returns `true` when the file has been successfully uploaded.
*/
isUploaded: boolean;
/**
* Returns the id of the file.
*/
id?: string;
/**
* Returns the bucket id.
*/
bucketId?: string;
/**
* Returns the name of the file.
*/
name?: string;
}
export interface FileUploadState extends UploadFileHandlerResult, UploadProgressState {
}
export declare const uploadFilePromise: (params: FileUploadConfig & Partial<StorageUploadFileParams>, interpreter: FileItemRef | InterpreterFrom<FileUploadMachine>) => Promise<UploadFileHandlerResult>;
//# sourceMappingURL=file-upload.d.ts.map