awaitly-visualizer 12.0.0 → 14.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/README.md CHANGED
@@ -26,7 +26,7 @@ const workflow = createWorkflow(
26
26
  { onEvent: viz.handleEvent }
27
27
  );
28
28
 
29
- await workflow(async (step, { validateCart, processPayment }) => {
29
+ await workflow(async ({ step, deps: { validateCart, processPayment } }) => {
30
30
  await step("Validate cart", () => validateCart(cart));
31
31
  await step("Process payment", () => processPayment(payment));
32
32
  return result;
@@ -104,14 +104,14 @@ const collector = createEventCollector({ workflowName: "checkout" });
104
104
  const workflow = createWorkflow("checkout", deps, {
105
105
  onEvent: collector.handleEvent,
106
106
  });
107
- await workflow(async (step) => { /* ... */ });
107
+ await workflow(async ({ step }) => { /* ... */ });
108
108
  console.log(collector.visualize());
109
109
  console.log(collector.visualizeAs("mermaid"));
110
110
 
111
111
  // Option 2: Visualize a list of events
112
112
  const events = []; // push from onEvent
113
113
  const workflow2 = createWorkflow("checkout", deps, { onEvent: (e) => events.push(e) });
114
- await workflow2(async (step) => { /* ... */ });
114
+ await workflow2(async ({ step }) => { /* ... */ });
115
115
  console.log(visualizeEvents(events, { workflowName: "checkout" }));
116
116
 
117
117
  // Option 3: Combine visualization with logging or metrics
@@ -130,7 +130,7 @@ import { createVisualizer, trackIf, trackSwitch } from "awaitly-visualizer";
130
130
 
131
131
  const viz = createVisualizer({ workflowName: "checkout" });
132
132
 
133
- await workflow(async (step) => {
133
+ await workflow(async ({ step }) => {
134
134
  const decision = trackIf("discount-check", hasCoupon, {
135
135
  emit: viz.handleDecisionEvent,
136
136
  });
@@ -157,7 +157,7 @@ const live = createLiveVisualizer(); // uses process.stdout
157
157
  const workflow = createWorkflow("checkout", deps, {
158
158
  onEvent: live.handleEvent,
159
159
  });
160
- await workflow(async (step) => { /* ... */ });
160
+ await workflow(async ({ step }) => { /* ... */ });
161
161
  ```
162
162
 
163
163
  Not available in browser builds; use the main entry in browsers.