arvo-event-handler
Version:
Type-safe event handler system with versioning, telemetry, and contract validation for distributed Arvo event-driven architectures, featuring routing and multi-handler support.
30 lines (29 loc) • 1.28 kB
TypeScript
import type { IMachineExectionEngine } from './interface';
import type { ExecuteMachineInput, ExecuteMachineOutput } from './types';
import type { ArvoEventHandlerOpenTelemetryOptions } from '../types';
/**
* Handles state machine execution, event processing, and lifecycle management.
*/
export declare class MachineExecutionEngine implements IMachineExectionEngine {
/**
* Executes a state machine and manages its lifecycle.
*
* @description
* Handles machine initialization/resumption, event processing, and state transitions.
* Manages event queues and volatile context during execution.
*
* @param params Configuration parameters:
* - machine: State machine definition
* - state: Optional existing state to resume from
* - event: Event triggering the execution
* @param opentelemetry Telemetry configuration for tracing
*
* @returns Object containing:
* - state: Final machine state
* - events: Generated events
* - finalOutput: Machine output or null
*
* @throws Error on invalid initialization events or execution failures
*/
execute({ machine, state, event }: ExecuteMachineInput, opentelemetry?: ArvoEventHandlerOpenTelemetryOptions): ExecuteMachineOutput;
}