@nhost/hasura-storage-js
Version:
Hasura-storage client
103 lines (102 loc) • 2.38 kB
TypeScript
import { FileUploadConfig, StorageErrorPayload } from '../utils';
export type FileUploadContext = {
progress: number | null;
loaded: number;
error: StorageErrorPayload | null;
id?: string;
bucketId?: string;
file?: File;
};
export type FileUploadEventPayload = {};
export type FileUploadEvents = {
type: 'ADD';
file: File;
id?: string;
bucketId?: string;
name?: string;
} | ({
type: 'UPLOAD';
file?: File;
id?: string;
name?: string;
bucketId?: string;
} & FileUploadConfig) | {
type: 'UPLOAD_PROGRESS';
progress: number;
loaded: number;
additions: number;
} | {
type: 'UPLOAD_DONE';
id: string;
bucketId: string;
} | {
type: 'UPLOAD_ERROR';
error: StorageErrorPayload;
} | {
type: 'CANCEL';
} | {
type: 'DESTROY';
};
export declare const INITIAL_FILE_CONTEXT: FileUploadContext;
export type FileUploadMachine = ReturnType<typeof createFileUploadMachine>;
export declare const createFileUploadMachine: () => import('xstate').StateMachine<FileUploadContext, any, {
type: "ADD";
file: File;
id?: string;
bucketId?: string;
name?: string;
} | ({
type: "UPLOAD";
file?: File;
id?: string;
name?: string;
bucketId?: string;
} & FileUploadConfig) | {
type: "UPLOAD_PROGRESS";
progress: number;
loaded: number;
additions: number;
} | {
type: "UPLOAD_DONE";
id: string;
bucketId: string;
} | {
type: "UPLOAD_ERROR";
error: StorageErrorPayload;
} | {
type: "CANCEL";
} | {
type: "DESTROY";
}, {
value: any;
context: FileUploadContext;
}, import('xstate').BaseActionObject, import('xstate').ServiceMap, import('xstate').ResolveTypegenMeta<import('./file-upload.typegen').Typegen0, {
type: "ADD";
file: File;
id?: string;
bucketId?: string;
name?: string;
} | ({
type: "UPLOAD";
file?: File;
id?: string;
name?: string;
bucketId?: string;
} & FileUploadConfig) | {
type: "UPLOAD_PROGRESS";
progress: number;
loaded: number;
additions: number;
} | {
type: "UPLOAD_DONE";
id: string;
bucketId: string;
} | {
type: "UPLOAD_ERROR";
error: StorageErrorPayload;
} | {
type: "CANCEL";
} | {
type: "DESTROY";
}, import('xstate').BaseActionObject, import('xstate').ServiceMap>>;
//# sourceMappingURL=file-upload.d.ts.map