madapes

runtime-function (0.2.6)

Published 2026-03-27 05:44:16 +00:00 by vlad

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add runtime-function@0.2.6

About this package

Pure Function Runtime System - Deterministic DAG-based data transformations

Pure Function Runtime System

A high-performance, deterministic execution engine for DAG-based data transformations. Define complex logic as JSON-serialized graphs and execute them with built-in safety, gas metering, and zero-copy data passing.

Features

  • Deterministic — Same inputs + context always produce identical outputs
  • Zero-CopyArc and CoW for efficient data passing between nodes
  • Financial Grade — 128-bit fixed-point decimal math (rust_decimal)
  • Sandboxed — ES5-subset expressions with no host access
  • Gas Metered — Prevents CPU exhaustion via granular resource limits
  • Multi-Language — Native Rust, Node.js (napi-rs), Go (CGO) bindings

Quick Start

Rust

[dependencies]
runtime-function = { version = "0.2", registry = "madapes" }
use runtime_function::{Engine, Program, Context, Value};

let engine = Engine::new();
let program: Program = serde_json::from_str(json_program)?;
let result = engine.execute(&program, inputs, Context::now());

Node.js

npm install @madapes/runtime-function
import { RuntimeEngine } from '@madapes/runtime-function';

const engine = new RuntimeEngine();
const result = engine.execute(JSON.stringify(program), JSON.stringify(inputs));
console.log(JSON.parse(result));

Go

import runtimefunction "github.com/madapes/runtime-function/bindings/go"

engine := runtimefunction.NewEngine()
program, _ := runtimefunction.ParseProgram(jsonStr)
result, _ := engine.Execute(program, inputs, nil)

Documentation

Full documentation is available on the Wiki:

Page Description
Getting Started Prerequisites, installation, quick start
Architecture DAG execution model, type system, expression sandbox
Node Types Complete reference for all node types
Builtin Functions String, math, datetime, collection, object operations
JSON Programs Program schema, examples, advanced patterns
Language Bindings Rust, Node.js, and Go usage guides
Contributing Developer workflow, CI/CD, code standards

Development

# Build
cargo build

# Test
cargo test --all-features

# Lint
cargo clippy --all-features -- -D warnings

# Format
cargo fmt --all

# Set up git hooks
./scripts/setup-hooks.sh

# Build Node.js bindings
cd bindings/nodejs && npm install && npm run build:debug

# Build & test Go bindings
cargo build -p runtime-function-ffi
cd bindings/go && go test -v .

cd bindings/go && go test -v .


## Files

- `AGENTS.md` - Context for AI agents
- `Cargo.toml` - Workspace configuration
- `README.md` - Project overview
- `ROADMAP.md` - implementation status and plan
- `clippy.toml` - Linting configuration
- `rustfmt.toml` - Formatting configuration

## License

MIT

Dependencies

ID Version
axum ^0.7
bincode ^1.3
chrono ^0.4
chrono-tz ^0.10
fancy-regex ^0.14
jsonschema ^0.18
oxc_allocator ^0.44
oxc_ast ^0.44
oxc_parser ^0.44
oxc_span ^0.44
oxc_syntax ^0.44
rand ^0.8
rand_chacha ^0.3
rayon ^1.10
rust_decimal ^1.36
schemars ^0.8
seahash ^4.1
serde ^1.0
serde_json ^1.0
sha2 ^0.10
thiserror ^2.0
tokio ^1.43
tower-http ^0.5
tracing ^0.1
tracing-subscriber ^0.3
uuid ^1.11
criterion ^0.5
pretty_assertions ^1.4
proptest ^1.5
tempfile ^3.14
tower ^0.5

Keywords

runtime pure-function dag deterministic
Details
Cargo
2026-03-27 05:44:16 +00:00
63
MIT
108 KiB
Assets (1)
Versions (4) View all
0.2.6 2026-03-27
0.2.3 2026-02-15
0.2.1 2026-02-15
0.1.3 2026-02-14