Expand description
WebAssembly bindings for dataflow-rs workflow engine.
This crate provides WASM bindings that allow using dataflow-rs from JavaScript/TypeScript.
§Usage
import init, { WasmEngine } from 'dataflow-wasm';
await init();
// Define workflows
const workflows = JSON.stringify([{
id: "example",
name: "Example Workflow",
priority: 1,
tasks: [{
id: "parse_payload",
name: "Parse Payload",
function: {
name: "parse",
input: {}
}
}, {
id: "task1",
name: "Transform Data",
function: {
name: "map",
input: {
mappings: [{
path: "data.result",
logic: { "var": "data.input" }
}]
}
}
}]
}]);
// Create engine
const engine = new WasmEngine(workflows);
// Process a payload (raw string, parsed by the parse plugin)
const payload = '{"input": "hello"}';
const result = await engine.process(payload);
console.log(JSON.parse(result));Structs§
- Wasm
Engine - A WebAssembly-compatible workflow engine.
Functions§
- init
- Initialize the WASM module.
- process_
message - Process a payload through a one-off engine (convenience function).