0.1.16 • Published 10 months ago

rootsby v0.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Rootsby

This package enables you to create and execute workflows with built-in decision-making logic. Simply define your workflows through a config. The package supports event-driven execution, making it easy to integrate with external services for seamless automation.

// Example of how to use the library
import { Rootsby } from "rootsby/workflow";
import { 
    WorkflowConfig, 
    WorkflowType, 
    WorkflowFunctionInput, 
    ExprOp, 
    WorkflowEvent 
} from "rootsby/types";

const id1 = crypto.randomUUID();
const id2 = crypto.randomUUID();

const someValue = "test-value-to-evaluate";
const configuration: WorkflowConfig = {
  id: crypto.randomUUID(),
  name: "test-workflow",
  type: WorkflowType.ShortRunning,
  functions: [
    {
      id: id1,
      name: "test-function-1",
      executor: (input: WorkflowFunctionInput) => {
        console.log(input);
        return input.data;
      },
      next: [
        {
          functionId: id2,
          values: [{ operator: ExprOp.eq, value: someValue }],
        },
      ],
    },
    {
      id: id2,
      name: "test-function-2",
      next: [],
    },
  ],
};

const workflow = new Rootsby();
workflow.progress({
  events: [
      WorkflowEvent.startWorkflow,
      WorkflowEvent.endWorkflow,
      WorkflowEvent.startStep,
      WorkflowEvent.endStep
],
  handler: (eventName: WorkflowEvent, data: any) => {
    console.log(eventName, data);
  },
});
workflow.runWorkflow(configuration, { currentStepData: "test-value-to-evaluate" });
0.1.10

10 months ago

0.1.11

10 months ago

0.1.12

10 months ago

0.1.13

10 months ago

0.1.14

10 months ago

0.1.15

10 months ago

0.1.16

10 months ago

0.1.9

10 months ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago