UNPKG

svelte-firebase-upload

Version:

Enterprise-grade file upload manager for Svelte with Firebase Storage integration, featuring concurrent uploads, resumable transfers, validation, health monitoring, and plugin system

35 lines (34 loc) 1.72 kB
import type { UploadManagerInterface, UploadPlugin, PluginConfig } from '../types.js'; export type PluginEventType = 'initialize' | 'destroy' | 'beforeFileAdd' | 'afterFileAdd' | 'beforeValidation' | 'afterValidation' | 'beforeUpload' | 'onUploadStart' | 'onUploadProgress' | 'onUploadComplete' | 'onUploadError' | 'beforeQueueProcess' | 'afterQueueProcess' | 'onStatusChange' | 'onManagerStateChange' | 'onError'; export declare class PluginSystem { private _plugins; private _manager; private readonly _PLUGIN_TIMEOUT; constructor(manager: UploadManagerInterface); registerPlugin(plugin: UploadPlugin, config?: Partial<PluginConfig>): Promise<void>; unregisterPlugin(pluginName: string): Promise<void>; setPluginEnabled(pluginName: string, enabled: boolean): Promise<void>; getPlugin(pluginName: string): UploadPlugin | null; getAllPlugins(): Array<{ name: string; plugin: UploadPlugin; config: PluginConfig; }>; getEnabledPlugins(): Array<{ name: string; plugin: UploadPlugin; config: PluginConfig; }>; /** * Execute a plugin method with timeout protection. * * @param operation - The async operation to execute * @param timeoutMs - Timeout in milliseconds * @param context - Context for error messages * @returns Promise that resolves with the operation result or rejects on timeout */ private _withTimeout; callPluginMethod(plugin: UploadPlugin, methodName: string, args: any[]): Promise<any>; emitEvent(eventType: PluginEventType, ...args: any[]): Promise<void>; executePipeline<T>(eventType: PluginEventType, initialValue: T, ...args: any[]): Promise<T>; }