/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ /** * API compatibility layer for dataflow execution. * * Maps e3-core internal event/status types to API-compatible types * used by e3-api-server and e3-api-client. This ensures consumers * of the API see a stable interface regardless of internal changes. * * Vocabulary mappings: * - e3-core 'cancelled' -> API 'aborted' * - e3-core 'task_started' -> API 'start' * - e3-core 'task_completed' (cached: false) -> API 'complete' * - e3-core 'task_completed' (cached: true) -> API 'cached' * - e3-core 'task_failed' -> API 'failed' or 'error' * - e3-core 'task_skipped' -> API 'input_unavailable' */ import type { ExecutionEvent, DataflowExecutionStatus, DataflowExecutionState } from './types.js'; /** * API-compatible event types for dataflow execution polling. * These match the DataflowEventType from e3-api-server/types.ts. */ export type ApiDataflowEventType = 'start' | 'complete' | 'cached' | 'failed' | 'error' | 'input_unavailable'; /** * API-compatible event structure. */ export interface ApiDataflowEvent { type: ApiDataflowEventType; task: string; timestamp: string; duration?: number; exitCode?: bigint; message?: string; reason?: string; } /** * API-compatible execution status. */ export type ApiExecutionStatus = 'running' | 'completed' | 'failed' | 'aborted'; /** * API-compatible execution summary. */ export interface ApiExecutionSummary { executed: bigint; cached: bigint; failed: bigint; skipped: bigint; duration: number; } /** * API-compatible execution state (matches DataflowExecutionStateType). */ export interface ApiExecutionState { status: ApiExecutionStatus; startedAt: string; completedAt: string | null; summary: ApiExecutionSummary | null; events: ApiDataflowEvent[]; totalEvents: bigint; } /** * Convert e3-core execution event to API-compatible event. * * Returns null for events that don't have an API equivalent * (e.g., execution_started, task_ready, execution_completed, execution_cancelled). * * @param event - The e3-core execution event (variant format) * @returns API-compatible event or null if no mapping exists */ export declare function coreEventToApiEvent(event: ExecutionEvent): ApiDataflowEvent | null; /** * Convert e3-core execution status to API status. * * @param status - The e3-core execution status * @returns API-compatible status string */ export declare function coreStatusToApiStatus(status: DataflowExecutionStatus): ApiExecutionStatus; /** * Convert e3-core execution state to API-compatible state. * * @param state - The e3-core execution state * @param events - Events to include (already filtered by offset/limit) * @param totalApiEvents - Total number of API-visible events (for pagination) * @param duration - Total execution duration in milliseconds * @returns API-compatible execution state */ export declare function coreStateToApiState(state: DataflowExecutionState, events: ExecutionEvent[], totalApiEvents: number, duration: number): ApiExecutionState; //# sourceMappingURL=api-compat.d.ts.map