UNPKG

execution-engine

Version:

A TypeScript library for tracing and visualizing code execution workflows.

66 lines 2.37 kB
import { TraceableEngine } from './traceableEngine'; import { EngineTrace } from '../common/models/engineTrace.model'; /** * Represents a Contextual Execution with traceability features. * * @template CXT - Type of the context object. */ export declare class ExecutionEngine<CXT extends { [key: string]: unknown; } = { [key: string]: unknown; }> extends TraceableEngine { protected context: CXT; protected executionDate: Date; protected executionId: string; /** * Creates an instance of ContextualExecution. * * @param {Object} [options] - Options for initializing the execution. * @param {Date} [options.executionDate] - Date of the execution. * @param {string} [options.executionId] - Unique identifier for the execution. * @param {string} [options.initialTrace] - The initial trace for the execution. */ constructor(options?: { executionDate?: Date; executionId?: string; initialTrace?: EngineTrace; }); /** * Get the current options of the Execution Engine. * * @returns {Object} An object containing the execution date and ID. * @public */ getOptions(): { executionDate: Date; executionId: string; }; setContext(value: CXT): ExecutionEngine<CXT>; getContext(): CXT; /** * Update the context of the execution with partial information. * * @param {Partial<CXT>} partialContext - Partial context information to update. * @returns {ExecutionEngine} - The updated ContextualExecution instance. */ updateContext(partialContext: Partial<CXT>): ExecutionEngine; /** * Update a specific attribute of the context object. * * @param {K} key - The key of the attribute to update. * @param {CXT[K]} partialContextAttribute - Partial information to update for the attribute. * @returns {ExecutionEngine} - The updated ContextualExecution instance. */ updateContextAttribute<K extends keyof CXT>(key: K, partialContextAttribute: CXT[K]): ExecutionEngine; /** * Deep clone function to copy nested objects. * * @private * @template T - Type of the object to clone. * @param {T} obj - The object to clone. * @returns {T} - The cloned object. */ private deepClone; } //# sourceMappingURL=executionEngine.d.ts.map