npm.io
0.3.0 • Published 2d ago

@pocketflow/viz

Licence
MIT
Version
0.3.0
Deps
3
Size
16 kB
Vulns
0
Weekly
0
Stars
4

PocketFlow.js Viz

Helper for @pocketflow/core to visualize the workflow.

Installation

npm install @pocketflow/viz

Usage

import { visualize } from '@pocketflow/viz';
import { Flow, Node } from '@pocketflow/core';

class Node1 extends Node {
  async exec(shared: any): Promise<any> {
    return shared;
  }
}

class Node2 extends Node {
  async exec(shared: any): Promise<any> {
    return shared;
  }
}

const node1 = new Node1();
const node2 = new Node2();
node1.connect(node2);

(async () => {
  await visualize(new Flow(node1));
})();

For the example below, refer to the code from essay.ts.

Flow visualization