UNPKG

@makolabs/ripple

Version:

Simple Svelte 5 powered component library ✨

103 lines (102 loc) 2.74 kB
/** * Storage adapter interfaces for the unified FileBrowser component */ export interface FileItem { key: string; name: string; lastModified: Date; createdAt?: Date; size: number; isFolder: boolean; id?: string; mimeType?: string; parentId?: string; } export interface FileActionSingle { label: (file: FileItem) => string; action: (file: FileItem) => void | Promise<void>; isAllowed: (file: FileItem) => boolean; batchAction?: never; } export interface FileActionBatch { label: (files: FileItem[]) => string; batchAction: (files: FileItem[]) => void | Promise<void>; isAllowed: (files: FileItem[]) => boolean; action?: never; } export type FileAction = FileActionSingle | FileActionBatch; export interface Breadcrumb { name: string; path: string; id?: string; current: boolean; clickable: boolean; } export interface FileListResult { files: FileItem[]; currentPath: string; parentPath?: string; breadcrumbs?: Breadcrumb[]; } export interface ImportOptions { contentType: string; fileFormat: string; reference?: string; insurer?: string; } export interface ImportResult { success: boolean; message: string; fileId?: string; error?: string; status?: string; progress?: number; } export interface BatchImportResult { success: boolean; message: string; summary: { total: number; succeeded: number; failed: number; }; results: { key: string; success: boolean; fileId?: string; error?: string; }[]; } export interface ImportStatus { fileId: string; status: string; progress: number; processedRows?: number; totalRows?: number; detailedStatus?: string; error?: string; created_at?: string; } export interface ErrorReportOptions { errorType: string; errorMessage: string; errorDetails?: string; clientInfo?: Record<string, string>; userAction?: string; } type URLString = string; export interface StorageAdapter { getName(): string; list(path: string, searchQuery?: string): Promise<FileListResult>; download(file: FileItem): Promise<URLString>; import(file: FileItem, options: ImportOptions): Promise<ImportResult>; batchImport(files: FileItem[], options: ImportOptions): Promise<BatchImportResult>; getImportStatus(importId: string, fileKey: string): Promise<ImportStatus>; reportError?(importId: string, options: ErrorReportOptions): Promise<boolean>; isConfigured(): Promise<boolean>; authenticate?(): Promise<boolean>; setReopenFlag(): void; shouldReopenBrowser(): boolean; clearReopenFlag(): void; } export {};