UNPKG

execution-engine

Version:

A TypeScript library for tracing and visualizing code execution workflows.

19 lines 1.04 kB
import { TraceContext } from './trace'; /** * Method decorator to trace function execution, capturing metadata, inputs, outputs, and errors. * * @param onTraceEvent - handle function of the trace context. * @param additionalContext - Additional metadata to attach to the trace context. * @param options - Configuration options: * - `contextKey`: Key to store trace context on the instance. * - `errorStrategy`: Determines whether errors should be caught (`'catch'`) or thrown (`'throw'`). * - `injectContextInArgs` (boolean): Whether to inject the context (from `contextKey`) into the function arguments. Defaults to `false`. * * @returns A method decorator that wraps the original function with execution tracing. */ export declare function trace<O>(onTraceEvent: (traceContext: TraceContext<O>) => void, additionalContext?: Record<string, any>, options?: { contextKey?: string; errorStrategy?: 'catch' | 'throw'; injectContextInArgs?: boolean; }): MethodDecorator; //# sourceMappingURL=trace.decorator.d.ts.map