dataflow-rs 0.1.7

A lightweight, rule-driven workflow engine for building powerful data processing pipelines and nanoservices in Rust. Extend it with your custom tasks to create robust, maintainable services.
Documentation
{
  "id": "complete_workflow",
  "name": "Complete Workflow Example",
  "description": "Demonstrates fetch -> enrich -> validate flow",
  "condition": { "==": [true, true] },
  "tasks": [
      {
          "id": "fetch_user_data",
          "name": "Fetch User Data",
          "description": "Get user data from a public API",
          "condition": { "==": [true, true] },
          "function": {
              "name": "http",
              "input": {
                  "url": "https://jsonplaceholder.typicode.com/users/1",
                  "method": "GET",
                  "headers": {
                      "Accept": "application/json"
                  }
              }
          }
      },
      {
          "id": "initialize_user",
          "name": "Initialize User Structure",
          "description": "Create empty user object in data",
          "condition": { "==": [true, true] },
          "function": {
              "name": "map",
              "input": {
                  "mappings": [
                      {
                          "path": "data",
                          "logic": { "preserve": {"user": {}} }
                      }
                  ]
              }
          }
      },
      {
          "id": "transform_data",
          "name": "Transform Data",
          "description": "Map API response to our data model",
          "condition": { "==": [true, true] },
          "function": {
              "name": "map",
              "input": {
                  "mappings": [
                      {
                          "path": "data.user.id", 
                          "logic": { "var": "temp_data.body.id" }
                      },
                      {
                          "path": "data.user.name", 
                          "logic": { "var": "temp_data.body.name" }
                      },
                      {
                          "path": "data.user.email", 
                          "logic": { "var": "temp_data.body.email" }
                      },
                      {
                          "path": "data.user.address", 
                          "logic": {
                              "cat": [
                                  { "var": "temp_data.body.address.street" },
                                  ", ",
                                  { "var": "temp_data.body.address.city" }
                              ]
                          }
                      },
                      {
                          "path": "data.user.company", 
                          "logic": { "var": "temp_data.body.company.name" }
                      }
                  ]
              }
          }
      },
      {
          "id": "validate_user_data",
          "name": "Validate User Data",
          "description": "Ensure the user data meets our requirements",
          "condition": { "==": [true, true] },
          "function": {
              "name": "validate",
              "input": {
                  "rules": [
                      {
                          "path": "data",
                          "logic": { "!!": { "var": "data.user.id" } },
                          "message": "User ID is required"
                      },
                      {
                          "path": "data",
                          "logic": { "!!": { "var": "data.user.name" } },
                          "message": "User name is required"
                      },
                      {
                          "path": "data",
                          "logic": { "!!": { "var": "data.user.email" } },
                          "message": "User email is required"
                      },
                      {
                          "path": "data",
                          "logic": {
                              "in": [
                                  "@",
                                  { "var": "data.user.email" }
                              ]
                          },
                          "message": "Email must be valid format"
                      }
                  ]
              }
          }
      }
  ]
}