/** * Workflow Result Type * * Standardized result type for workflows that can have partial failures. * Workflows that process multiple items (e.g., syncing plugins, checking updates) * should use this pattern to report both successes and failures. */ import type { PluginatorError } from './error-types.js'; /** * Workflow result with typed data and error handling */ export interface WorkflowResult { /** Whether the workflow completed successfully (no critical errors) */ success: boolean; /** Result data (may be partial if some items failed) */ data?: T; /** Errors that occurred during execution */ errors: PluginatorError[]; /** Non-critical warnings */ warnings: string[]; /** Duration in milliseconds */ duration: number; } /** * Item-level result for batch operations */ export interface ItemResult { /** Item identifier (e.g., plugin name) */ id: string; /** Whether this item succeeded */ success: boolean; /** Item data if successful */ data?: T; /** Error if failed */ error?: PluginatorError; /** Warning message if applicable */ warning?: string; } /** * Batch workflow result for operations on multiple items */ export interface BatchWorkflowResult extends WorkflowResult { /** Results for each item */ items: ItemResult[]; /** Count of successful items */ successCount: number; /** Count of failed items */ failureCount: number; /** Count of skipped items */ skippedCount: number; } /** * Create a successful workflow result */ export declare function successResult(data: T, duration: number, warnings?: string[]): WorkflowResult; /** * Create a failed workflow result */ export declare function failureResult(errors: PluginatorError[], duration: number, partialData?: T, warnings?: string[]): WorkflowResult; /** * Create a batch workflow result from item results */ export declare function batchResult(items: ItemResult[], duration: number): BatchWorkflowResult; /** * Process items in batch with error handling * Executes the processor for each item and collects results */ export declare function processBatch(items: TInput[], getId: (item: TInput) => string, processor: (item: TInput) => Promise, options?: { /** Continue processing remaining items after an error */ continueOnError?: boolean; /** Called for each item with progress */ onProgress?: (current: number, total: number, id: string) => void; }): Promise>; /** * Combine multiple workflow results into one */ export declare function combineResults(results: WorkflowResult[]): WorkflowResult; /** * Get a summary of workflow result for logging/display */ export declare function getResultSummary(result: WorkflowResult): string; /** * Get batch result summary */ export declare function getBatchSummary(result: BatchWorkflowResult): string; //# sourceMappingURL=workflow-result.d.ts.map