alinea
Version:
Headless git-based CMS
43 lines (42 loc) • 998 B
TypeScript
import type { UploadResponse } from 'alinea/core/Connection';
import { Entry } from 'alinea/core/Entry';
export declare enum UploadStatus {
Queued = 0,
CreatingPreview = 1,
Uploading = 2,
Uploaded = 3,
Done = 4
}
export interface UploadDestination {
entryId?: string;
parentId?: string;
workspace: string;
root: string;
directory: string;
}
export interface Upload {
id: string;
file: File;
to: UploadDestination;
status: UploadStatus;
info?: UploadResponse;
preview?: string;
averageColor?: string;
focus?: {
x: number;
y: number;
};
thumbHash?: string;
width?: number;
height?: number;
result?: Entry;
error?: Error;
replace?: {
entry: Entry;
entryFile: string;
};
}
export declare function useUploads(onSelect?: (entry: Entry) => void): {
upload: (files: Array<File>, to: UploadDestination, replaceId?: string) => Promise<void>;
uploads: Upload[];
};