dflow
v0.45.0
Published
A minimal Dataflow programming engine
Readme
Dflow
A minimal Dataflow programming engine
See:
Usage
You can run the "Hello World" example described below by cloning dflow repository and launching
npm run example:hello_worldIt defines a single DflowNode that outputs "Hello, World!"
and creates a dflow instance that runs it.
import { Dflow, type DflowNode } from "../../dflow.ts";
// Define a node.
const helloWorld: DflowNode = {
kind: "hello",
run: () => console.log("Hello, World!")
};
const nodeDefinitions = [helloWorld];
// Create a dflow instance.
const dflow = new Dflow(nodeDefinitions);
// Add a node to the graph.
dflow.node("hello");
// Run the dflow graph.
dflow.run();[!IMPORTANT] The recommended way to run a graph is with
await, wrapped in a try/catch block.
try {
await dflow.run();
} catch (error) {
// Here `error` should be an instance of `AggregateError`.
}More examples available in the documentation, see the "Usage" section.
