awaitly-visualizer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +1677 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.d.cts +166 -0
- package/dist/index.browser.d.ts +166 -0
- package/dist/index.browser.js +1677 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +1680 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +242 -0
- package/dist/index.d.ts +242 -0
- package/dist/index.js +1680 -0
- package/dist/index.js.map +1 -0
- package/dist/kroki/fetch.cjs +3 -0
- package/dist/kroki/fetch.cjs.map +1 -0
- package/dist/kroki/fetch.d.cts +86 -0
- package/dist/kroki/fetch.d.ts +86 -0
- package/dist/kroki/fetch.js +3 -0
- package/dist/kroki/fetch.js.map +1 -0
- package/dist/notifiers/discord.cjs +3 -0
- package/dist/notifiers/discord.cjs.map +1 -0
- package/dist/notifiers/discord.d.cts +70 -0
- package/dist/notifiers/discord.d.ts +70 -0
- package/dist/notifiers/discord.js +3 -0
- package/dist/notifiers/discord.js.map +1 -0
- package/dist/notifiers/slack.cjs +38 -0
- package/dist/notifiers/slack.cjs.map +1 -0
- package/dist/notifiers/slack.d.cts +95 -0
- package/dist/notifiers/slack.d.ts +95 -0
- package/dist/notifiers/slack.js +38 -0
- package/dist/notifiers/slack.js.map +1 -0
- package/dist/notifiers/webhook.cjs +3 -0
- package/dist/notifiers/webhook.cjs.map +1 -0
- package/dist/notifiers/webhook.d.cts +115 -0
- package/dist/notifiers/webhook.d.ts +115 -0
- package/dist/notifiers/webhook.js +3 -0
- package/dist/notifiers/webhook.js.map +1 -0
- package/dist/performance-analyzer-B5VF5b1F.d.ts +663 -0
- package/dist/performance-analyzer-BNwE4AiO.d.cts +663 -0
- package/dist/types-BIZSmXif.d.ts +350 -0
- package/dist/types-BnWc9Wlr.d.cts +350 -0
- package/dist/url-PkfQz4V5.d.cts +750 -0
- package/dist/url-PkfQz4V5.d.ts +750 -0
- package/package.json +105 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { WorkflowEvent } from 'awaitly/workflow';
|
|
2
|
+
export { ScopeType } from 'awaitly/workflow';
|
|
3
|
+
import { b as DecisionStartEvent, c as DecisionBranchEvent, d as DecisionEndEvent, S as ScopeStartEvent, e as ScopeEndEvent, W as WorkflowIR, O as OutputFormat, V as VisualizerOptions } from './url-PkfQz4V5.cjs';
|
|
4
|
+
export { A as ActiveStepSnapshot, B as BaseNode, C as ColorScheme, f as DecisionBranch, g as DecisionEvent, h as DecisionNode, D as DiagramSource, i as EnhancedRenderOptions, E as ExportFormat, a as ExportOptions, F as FlowNode, j as FlowchartRenderOptions, H as HTMLRenderOptions, k as HTMLTheme, l as HeatLevel, m as HeatmapData, n as HookExecution, o as HookState, I as IRSnapshot, K as KrokiExportOptions, p as KrokiFormat, L as LayoutDirection, q as LiveVisualizerOptions, M as MermaidInkExportOptions, r as MermaidRenderOptions, N as NodePerformance, P as ParallelNode, R as RaceNode, s as RenderOptions, t as Renderer, u as ScopeEvent, v as SequenceNode, w as ServerMessage, x as StepNode, y as StepSkippedEvent, z as StepState, G as StreamNode, T as TimeTravelState, U as UrlGeneratorOptions, J as VisualizingWorkflowOptions, Q as WebVisualizerMessage, X as WorkflowHooks, Y as WorkflowNode, Z as createUrlGenerator, _ as hasChildren, $ as isDecisionNode, a0 as isParallelNode, a1 as isRaceNode, a2 as isSequenceNode, a3 as isStepNode, a4 as isStreamNode, a5 as toKrokiPngUrl, a6 as toKrokiSvgUrl, a7 as toKrokiUrl } from './url-PkfQz4V5.cjs';
|
|
5
|
+
export { D as DecisionTracker, H as HookLog, I as IRBuilderOptions, a as IfTracker, L as LiveVisualizer, b as LoggerOutput, c as LoggerRenderOptions, P as ParallelDetectorOptions, d as PerformanceAnalyzer, S as StepLog, e as SwitchTracker, T as TimeTravelController, f as TimeTravelOptions, W as WorkflowRun, g as WorkflowSummary, h as asciiRenderer, i as createIRBuilder, k as createParallelDetector, l as createPerformanceAnalyzer, m as createTimeTravelController, n as defaultColorScheme, o as detectParallelGroups, p as flowchartRenderer, q as getHeatLevel, r as htmlRenderer, s as loggerRenderer, t as mermaidRenderer, u as renderToHTML, v as trackDecision, w as trackIf, x as trackSwitch } from './performance-analyzer-BNwE4AiO.cjs';
|
|
6
|
+
export { D as DiagramProvider, K as KrokiProviderOptions, M as MermaidInkFormat, a as MermaidInkGenerator, b as MermaidInkImageType, c as MermaidInkOptions, d as MermaidInkPaperSize, e as MermaidInkProviderOptions, f as MermaidInkTheme, P as ProviderOptions, g as buildMermaidInkUrl, h as createMermaidInkGenerator, i as encodeForMermaidInk, t as toMermaidInkJpegUrl, j as toMermaidInkPdfUrl, k as toMermaidInkPngUrl, l as toMermaidInkSvgUrl, m as toMermaidInkUrl, n as toMermaidInkWebpUrl } from './types-BnWc9Wlr.cjs';
|
|
7
|
+
import 'awaitly/core';
|
|
8
|
+
import 'awaitly';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Browser-safe Workflow Visualization Module
|
|
12
|
+
*
|
|
13
|
+
* Excludes Node.js-specific features:
|
|
14
|
+
* - createLiveVisualizer (requires process.stdout)
|
|
15
|
+
* - fetchKroki* functions (requires Node.js fetch with Buffer)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createVisualizer } from 'awaitly-visualizer';
|
|
20
|
+
*
|
|
21
|
+
* const viz = createVisualizer({ workflowName: 'checkout' });
|
|
22
|
+
* const workflow = createWorkflow(deps, { onEvent: viz.handleEvent });
|
|
23
|
+
*
|
|
24
|
+
* await workflow(async (step) => {
|
|
25
|
+
* await step(() => validateCart(cart), 'Validate cart');
|
|
26
|
+
* await step(() => processPayment(payment), 'Process payment');
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* console.log(viz.render());
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a live terminal visualizer.
|
|
35
|
+
*
|
|
36
|
+
* @throws Error - Not available in browser environments
|
|
37
|
+
*/
|
|
38
|
+
declare const createLiveVisualizer: () => never;
|
|
39
|
+
/**
|
|
40
|
+
* Workflow visualizer that processes events and renders output.
|
|
41
|
+
*/
|
|
42
|
+
interface WorkflowVisualizer {
|
|
43
|
+
/** Process a workflow event */
|
|
44
|
+
handleEvent: (event: WorkflowEvent<unknown>) => void;
|
|
45
|
+
/** Process a scope event (parallel/race) */
|
|
46
|
+
handleScopeEvent: (event: ScopeStartEvent | ScopeEndEvent) => void;
|
|
47
|
+
/** Process a decision event (conditional branches) */
|
|
48
|
+
handleDecisionEvent: (event: DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent) => void;
|
|
49
|
+
/** Get current IR state */
|
|
50
|
+
getIR: () => WorkflowIR;
|
|
51
|
+
/** Render current state using the default renderer */
|
|
52
|
+
render: () => string;
|
|
53
|
+
/** Render to a specific format */
|
|
54
|
+
renderAs: (format: OutputFormat) => string;
|
|
55
|
+
/** Reset state for a new workflow */
|
|
56
|
+
reset: () => void;
|
|
57
|
+
/** Subscribe to IR updates (for live visualization) */
|
|
58
|
+
onUpdate: (callback: (ir: WorkflowIR) => void) => () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a workflow visualizer.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const viz = createVisualizer({ workflowName: 'my-workflow' });
|
|
66
|
+
*
|
|
67
|
+
* const workflow = createWorkflow(deps, {
|
|
68
|
+
* onEvent: viz.handleEvent,
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* await workflow(async (step) => { ... });
|
|
72
|
+
*
|
|
73
|
+
* console.log(viz.render());
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function createVisualizer(options?: VisualizerOptions): WorkflowVisualizer;
|
|
77
|
+
/**
|
|
78
|
+
* Combine multiple event handlers into one.
|
|
79
|
+
* Use when you need visualization + logging + custom handlers.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const viz = createVisualizer({ workflowName: 'checkout' });
|
|
84
|
+
* const workflow = createWorkflow(deps, {
|
|
85
|
+
* onEvent: combineEventHandlers(
|
|
86
|
+
* viz.handleEvent,
|
|
87
|
+
* (e) => console.log(e.type),
|
|
88
|
+
* (e) => metrics.track(e),
|
|
89
|
+
* ),
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare function combineEventHandlers<E = unknown, C = void>(...handlers: Array<(event: WorkflowEvent<E, C>, ctx?: C) => void>): (event: WorkflowEvent<E, C>, ctx: C) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Union type for all collectable/visualizable events (workflow + decision).
|
|
96
|
+
*/
|
|
97
|
+
type CollectableEvent = WorkflowEvent<unknown> | DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent;
|
|
98
|
+
/**
|
|
99
|
+
* Visualize collected events (post-execution).
|
|
100
|
+
*
|
|
101
|
+
* Supports both workflow events (from onEvent) and decision events
|
|
102
|
+
* (from trackDecision/trackIf/trackSwitch).
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const events: CollectableEvent[] = [];
|
|
107
|
+
* const workflow = createWorkflow(deps, {
|
|
108
|
+
* onEvent: (e) => events.push(e),
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* await workflow(async (step) => {
|
|
112
|
+
* const decision = trackIf('check', condition, {
|
|
113
|
+
* emit: (e) => events.push(e),
|
|
114
|
+
* });
|
|
115
|
+
* // ...
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* console.log(visualizeEvents(events));
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
declare function visualizeEvents(events: CollectableEvent[], options?: VisualizerOptions): string;
|
|
122
|
+
/**
|
|
123
|
+
* Create an event collector for later visualization.
|
|
124
|
+
*
|
|
125
|
+
* Supports both workflow events (from onEvent) and decision events
|
|
126
|
+
* (from trackDecision/trackIf/trackSwitch).
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const collector = createEventCollector();
|
|
131
|
+
*
|
|
132
|
+
* const workflow = createWorkflow(deps, {
|
|
133
|
+
* onEvent: collector.handleEvent,
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* await workflow(async (step) => {
|
|
137
|
+
* // Decision events can also be collected
|
|
138
|
+
* const decision = trackIf('check', condition, {
|
|
139
|
+
* emit: collector.handleDecisionEvent,
|
|
140
|
+
* });
|
|
141
|
+
* // ...
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* console.log(collector.visualize());
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function createEventCollector(options?: VisualizerOptions): {
|
|
148
|
+
/** Handle a workflow event */
|
|
149
|
+
handleEvent: (event: WorkflowEvent<unknown>) => void;
|
|
150
|
+
/** Handle a decision event */
|
|
151
|
+
handleDecisionEvent: (event: DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent) => void;
|
|
152
|
+
/** Get all collected events */
|
|
153
|
+
getEvents: () => CollectableEvent[];
|
|
154
|
+
/** Get workflow events only */
|
|
155
|
+
getWorkflowEvents: () => WorkflowEvent<unknown>[];
|
|
156
|
+
/** Get decision events only */
|
|
157
|
+
getDecisionEvents: () => (DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent)[];
|
|
158
|
+
/** Clear collected events */
|
|
159
|
+
clear: () => void;
|
|
160
|
+
/** Visualize collected events */
|
|
161
|
+
visualize: () => string;
|
|
162
|
+
/** Visualize in a specific format */
|
|
163
|
+
visualizeAs: (format: OutputFormat) => string;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export { type CollectableEvent, DecisionBranchEvent, DecisionEndEvent, DecisionStartEvent, OutputFormat, ScopeEndEvent, ScopeStartEvent, VisualizerOptions, WorkflowIR, type WorkflowVisualizer, combineEventHandlers, createEventCollector, createLiveVisualizer, createVisualizer, visualizeEvents };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { WorkflowEvent } from 'awaitly/workflow';
|
|
2
|
+
export { ScopeType } from 'awaitly/workflow';
|
|
3
|
+
import { b as DecisionStartEvent, c as DecisionBranchEvent, d as DecisionEndEvent, S as ScopeStartEvent, e as ScopeEndEvent, W as WorkflowIR, O as OutputFormat, V as VisualizerOptions } from './url-PkfQz4V5.js';
|
|
4
|
+
export { A as ActiveStepSnapshot, B as BaseNode, C as ColorScheme, f as DecisionBranch, g as DecisionEvent, h as DecisionNode, D as DiagramSource, i as EnhancedRenderOptions, E as ExportFormat, a as ExportOptions, F as FlowNode, j as FlowchartRenderOptions, H as HTMLRenderOptions, k as HTMLTheme, l as HeatLevel, m as HeatmapData, n as HookExecution, o as HookState, I as IRSnapshot, K as KrokiExportOptions, p as KrokiFormat, L as LayoutDirection, q as LiveVisualizerOptions, M as MermaidInkExportOptions, r as MermaidRenderOptions, N as NodePerformance, P as ParallelNode, R as RaceNode, s as RenderOptions, t as Renderer, u as ScopeEvent, v as SequenceNode, w as ServerMessage, x as StepNode, y as StepSkippedEvent, z as StepState, G as StreamNode, T as TimeTravelState, U as UrlGeneratorOptions, J as VisualizingWorkflowOptions, Q as WebVisualizerMessage, X as WorkflowHooks, Y as WorkflowNode, Z as createUrlGenerator, _ as hasChildren, $ as isDecisionNode, a0 as isParallelNode, a1 as isRaceNode, a2 as isSequenceNode, a3 as isStepNode, a4 as isStreamNode, a5 as toKrokiPngUrl, a6 as toKrokiSvgUrl, a7 as toKrokiUrl } from './url-PkfQz4V5.js';
|
|
5
|
+
export { D as DecisionTracker, H as HookLog, I as IRBuilderOptions, a as IfTracker, L as LiveVisualizer, b as LoggerOutput, c as LoggerRenderOptions, P as ParallelDetectorOptions, d as PerformanceAnalyzer, S as StepLog, e as SwitchTracker, T as TimeTravelController, f as TimeTravelOptions, W as WorkflowRun, g as WorkflowSummary, h as asciiRenderer, i as createIRBuilder, k as createParallelDetector, l as createPerformanceAnalyzer, m as createTimeTravelController, n as defaultColorScheme, o as detectParallelGroups, p as flowchartRenderer, q as getHeatLevel, r as htmlRenderer, s as loggerRenderer, t as mermaidRenderer, u as renderToHTML, v as trackDecision, w as trackIf, x as trackSwitch } from './performance-analyzer-B5VF5b1F.js';
|
|
6
|
+
export { D as DiagramProvider, K as KrokiProviderOptions, M as MermaidInkFormat, a as MermaidInkGenerator, b as MermaidInkImageType, c as MermaidInkOptions, d as MermaidInkPaperSize, e as MermaidInkProviderOptions, f as MermaidInkTheme, P as ProviderOptions, g as buildMermaidInkUrl, h as createMermaidInkGenerator, i as encodeForMermaidInk, t as toMermaidInkJpegUrl, j as toMermaidInkPdfUrl, k as toMermaidInkPngUrl, l as toMermaidInkSvgUrl, m as toMermaidInkUrl, n as toMermaidInkWebpUrl } from './types-BIZSmXif.js';
|
|
7
|
+
import 'awaitly/core';
|
|
8
|
+
import 'awaitly';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Browser-safe Workflow Visualization Module
|
|
12
|
+
*
|
|
13
|
+
* Excludes Node.js-specific features:
|
|
14
|
+
* - createLiveVisualizer (requires process.stdout)
|
|
15
|
+
* - fetchKroki* functions (requires Node.js fetch with Buffer)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createVisualizer } from 'awaitly-visualizer';
|
|
20
|
+
*
|
|
21
|
+
* const viz = createVisualizer({ workflowName: 'checkout' });
|
|
22
|
+
* const workflow = createWorkflow(deps, { onEvent: viz.handleEvent });
|
|
23
|
+
*
|
|
24
|
+
* await workflow(async (step) => {
|
|
25
|
+
* await step(() => validateCart(cart), 'Validate cart');
|
|
26
|
+
* await step(() => processPayment(payment), 'Process payment');
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* console.log(viz.render());
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a live terminal visualizer.
|
|
35
|
+
*
|
|
36
|
+
* @throws Error - Not available in browser environments
|
|
37
|
+
*/
|
|
38
|
+
declare const createLiveVisualizer: () => never;
|
|
39
|
+
/**
|
|
40
|
+
* Workflow visualizer that processes events and renders output.
|
|
41
|
+
*/
|
|
42
|
+
interface WorkflowVisualizer {
|
|
43
|
+
/** Process a workflow event */
|
|
44
|
+
handleEvent: (event: WorkflowEvent<unknown>) => void;
|
|
45
|
+
/** Process a scope event (parallel/race) */
|
|
46
|
+
handleScopeEvent: (event: ScopeStartEvent | ScopeEndEvent) => void;
|
|
47
|
+
/** Process a decision event (conditional branches) */
|
|
48
|
+
handleDecisionEvent: (event: DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent) => void;
|
|
49
|
+
/** Get current IR state */
|
|
50
|
+
getIR: () => WorkflowIR;
|
|
51
|
+
/** Render current state using the default renderer */
|
|
52
|
+
render: () => string;
|
|
53
|
+
/** Render to a specific format */
|
|
54
|
+
renderAs: (format: OutputFormat) => string;
|
|
55
|
+
/** Reset state for a new workflow */
|
|
56
|
+
reset: () => void;
|
|
57
|
+
/** Subscribe to IR updates (for live visualization) */
|
|
58
|
+
onUpdate: (callback: (ir: WorkflowIR) => void) => () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a workflow visualizer.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const viz = createVisualizer({ workflowName: 'my-workflow' });
|
|
66
|
+
*
|
|
67
|
+
* const workflow = createWorkflow(deps, {
|
|
68
|
+
* onEvent: viz.handleEvent,
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* await workflow(async (step) => { ... });
|
|
72
|
+
*
|
|
73
|
+
* console.log(viz.render());
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function createVisualizer(options?: VisualizerOptions): WorkflowVisualizer;
|
|
77
|
+
/**
|
|
78
|
+
* Combine multiple event handlers into one.
|
|
79
|
+
* Use when you need visualization + logging + custom handlers.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const viz = createVisualizer({ workflowName: 'checkout' });
|
|
84
|
+
* const workflow = createWorkflow(deps, {
|
|
85
|
+
* onEvent: combineEventHandlers(
|
|
86
|
+
* viz.handleEvent,
|
|
87
|
+
* (e) => console.log(e.type),
|
|
88
|
+
* (e) => metrics.track(e),
|
|
89
|
+
* ),
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare function combineEventHandlers<E = unknown, C = void>(...handlers: Array<(event: WorkflowEvent<E, C>, ctx?: C) => void>): (event: WorkflowEvent<E, C>, ctx: C) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Union type for all collectable/visualizable events (workflow + decision).
|
|
96
|
+
*/
|
|
97
|
+
type CollectableEvent = WorkflowEvent<unknown> | DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent;
|
|
98
|
+
/**
|
|
99
|
+
* Visualize collected events (post-execution).
|
|
100
|
+
*
|
|
101
|
+
* Supports both workflow events (from onEvent) and decision events
|
|
102
|
+
* (from trackDecision/trackIf/trackSwitch).
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const events: CollectableEvent[] = [];
|
|
107
|
+
* const workflow = createWorkflow(deps, {
|
|
108
|
+
* onEvent: (e) => events.push(e),
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* await workflow(async (step) => {
|
|
112
|
+
* const decision = trackIf('check', condition, {
|
|
113
|
+
* emit: (e) => events.push(e),
|
|
114
|
+
* });
|
|
115
|
+
* // ...
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* console.log(visualizeEvents(events));
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
declare function visualizeEvents(events: CollectableEvent[], options?: VisualizerOptions): string;
|
|
122
|
+
/**
|
|
123
|
+
* Create an event collector for later visualization.
|
|
124
|
+
*
|
|
125
|
+
* Supports both workflow events (from onEvent) and decision events
|
|
126
|
+
* (from trackDecision/trackIf/trackSwitch).
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const collector = createEventCollector();
|
|
131
|
+
*
|
|
132
|
+
* const workflow = createWorkflow(deps, {
|
|
133
|
+
* onEvent: collector.handleEvent,
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* await workflow(async (step) => {
|
|
137
|
+
* // Decision events can also be collected
|
|
138
|
+
* const decision = trackIf('check', condition, {
|
|
139
|
+
* emit: collector.handleDecisionEvent,
|
|
140
|
+
* });
|
|
141
|
+
* // ...
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* console.log(collector.visualize());
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function createEventCollector(options?: VisualizerOptions): {
|
|
148
|
+
/** Handle a workflow event */
|
|
149
|
+
handleEvent: (event: WorkflowEvent<unknown>) => void;
|
|
150
|
+
/** Handle a decision event */
|
|
151
|
+
handleDecisionEvent: (event: DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent) => void;
|
|
152
|
+
/** Get all collected events */
|
|
153
|
+
getEvents: () => CollectableEvent[];
|
|
154
|
+
/** Get workflow events only */
|
|
155
|
+
getWorkflowEvents: () => WorkflowEvent<unknown>[];
|
|
156
|
+
/** Get decision events only */
|
|
157
|
+
getDecisionEvents: () => (DecisionStartEvent | DecisionBranchEvent | DecisionEndEvent)[];
|
|
158
|
+
/** Clear collected events */
|
|
159
|
+
clear: () => void;
|
|
160
|
+
/** Visualize collected events */
|
|
161
|
+
visualize: () => string;
|
|
162
|
+
/** Visualize in a specific format */
|
|
163
|
+
visualizeAs: (format: OutputFormat) => string;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export { type CollectableEvent, DecisionBranchEvent, DecisionEndEvent, DecisionStartEvent, OutputFormat, ScopeEndEvent, ScopeStartEvent, VisualizerOptions, WorkflowIR, type WorkflowVisualizer, combineEventHandlers, createEventCollector, createLiveVisualizer, createVisualizer, visualizeEvents };
|