1- # TraceableExecution
1+ # TraceableEngine
22
3- The ` TraceableExecution ` class is a TypeScript utility that facilitates tracing and logging of function executions. It
3+ The ` TraceableEngine ` class is a TypeScript utility that facilitates tracing and logging of function executions. It
44captures detailed information about the inputs, outputs, errors, and execution time for each function call, allowing for
55the creation of a trace graph.
66
@@ -10,7 +10,7 @@ scenarios.
1010
1111## Overview
1212
13- The ` TraceableExecution ` class allows users to run functions in a traceable manner, capturing detailed information about
13+ The ` TraceableEngine ` class allows users to run functions in a traceable manner, capturing detailed information about
1414each execution step. The key features include:
1515
1616- ** Execution Trace:**
@@ -26,16 +26,16 @@ each execution step. The key features include:
2626
2727## Usage
2828
29- 1 . Import the ` TraceableExecution ` class:
29+ 1 . Import the ` TraceableEngine ` class:
3030
3131 ``` typescript
32- import { TraceableExecution } from " execution-engine" ;
32+ import { TraceableEngine } from " execution-engine" ;
3333 ```
3434
35- 2. Create an instance of ` TraceableExecution ` :
35+ 2. Create an instance of ` TraceableEngine ` :
3636
3737 ` ` ` typescript
38- const traceableExecution = new TraceableExecution ();
38+ const traceableExecution = new TraceableEngine ();
3939 ` ` `
4040
4141
@@ -101,15 +101,15 @@ each execution step. The key features include:
101101
102102## Advanced Configuration
103103
104- The ` TraceableExecution ` class provides flexibility for advanced configurations , including custom trace options and
104+ The ` TraceableEngine ` class provides flexibility for advanced configurations , including custom trace options and
105105narratives . Explore the class methods and options for a more tailored usage .
106106
107107## Examples
108108
109109### 1. Here 's a basic example :
110110
111111```typescript
112- const traceableExecution = new TraceableExecution ();
112+ const traceableExecution = new TraceableEngine ();
113113
114114const result = await traceableExecution .run (
115115 async (param1 , param2 ) => {
@@ -125,7 +125,7 @@ const trace = traceableExecution.getTrace();
125125console .log (' Trace:' , trace );
126126```
127127
128- ### 2. How to use ` TraceableExecution ` consecutive calls
128+ ### 2. How to use ` TraceableEngine ` consecutive calls
129129
130130In this example, we showcase the trace functionality by sequentially executing ` registerUser ` , ` loginUser ` ,
131131and ` getUserInformation ` functions within the context of ` traceableExecution ` .
@@ -170,16 +170,16 @@ const finalTrace = traceableExecution.getTrace();
170170console .log (JSON .stringify (finalTrace , null , 2 ));
171171```
172172
173- ### 3. How to use ` TraceableExecution ` with asynchronous functions and parallel execution
173+ ### 3. How to use ` TraceableEngine ` with asynchronous functions and parallel execution
174174
175175In this example, ` fetchCurrentTemperature ` and ` fetchDailyForecast ` simulate asynchronous operations,
176176while ` getWeatherInformation ` showcases running them in parallel with ` Promise.all `
177- within the context of ` TraceableExecution ` . The resulting trace will capture the parallel execution relationships.
177+ within the context of ` TraceableEngine ` . The resulting trace will capture the parallel execution relationships.
178178
179179``` typescript
180- import { NodeData , TraceableExecution } from " ./TraceableExecution " ;
180+ import { NodeData , TraceableEngine } from " ./TraceableEngine " ;
181181
182- const traceableExecution = new TraceableExecution ();
182+ const traceableExecution = new TraceableEngine ();
183183
184184async function fetchCurrentTemperature(city : string ) {
185185 return Promise .resolve (` Current Temperature in ${city }: 25°C ` );
@@ -223,7 +223,7 @@ console.log(JSON.stringify(finalTrace, null, 2));
223223
224224### ` constructor(initialTrace?: Trace) `
225225
226- Initializes a new instance of the ` TraceableExecution ` class.
226+ Initializes a new instance of the ` TraceableEngine ` class.
227227
228228- ` initialTrace ` (optional): The initial trace to be used.
229229
@@ -247,7 +247,7 @@ Gets the nodes of the execution trace.
247247
248248Returns an array containing nodes of the execution trace.
249249
250- ### ` run<O>(blockFunction: (...params) => O | Promise<O>, inputs?: Array<unknown>, options?: TraceOptions<Array<any>, O>): Promise<NodeExecutionTrace <Array<unknown>, Awaited<O>>> | NodeExecutionTrace <Array<unknown>, O> `
250+ ### ` run<O>(blockFunction: (...params) => O | Promise<O>, inputs?: Array<unknown>, options?: TraceOptions<Array<any>, O>): Promise<ExecutionTrace <Array<unknown>, Awaited<O>>> | ExecutionTrace <Array<unknown>, O> `
251251
252252Executes a function and captures the trace.
253253
@@ -257,14 +257,14 @@ Executes a function and captures the trace.
257257
258258Returns a promise that resolves to the execution trace.
259259
260- ### ` pushNarratives(nodeId: NodeTrace['id'], narratives: string | string[]): TraceableExecution `
260+ ### ` pushNarratives(nodeId: NodeTrace['id'], narratives: string | string[]): TraceableEngine `
261261
262262Pushes or appends narratives to a trace node.
263263
264264- ` nodeId ` : The ID of the node.
265265- ` narratives ` : The narrative or array of narratives to be processed.
266266
267- Returns the updated instance of ` TraceableExecution ` .
267+ Returns the updated instance of ` TraceableEngine ` .
268268
269269### ` getNarratives(): Array<string> `
270270
0 commit comments