Triangulum Ruby Gem
Ruby bindings for the Triangulum validation layer. This gem wraps the TypeScript library and a bundled Bun runtime to validate flows using the TypeScript compiler.
Installation
Add to your Gemfile:
gem 'triangulum'
Platform-specific gems are published for:
arm64-darwin(macOS Apple Silicon)x86_64-darwin(macOS Intel)x86_64-linux-gnu(Linux x64)x86_64-linux-musl(Linux x64 musl)aarch64-linux-gnu(Linux ARM64)aarch64-linux-musl(Linux ARM64 musl)
If Bundler doesn't automatically select the correct platform gem, add your platform:
bundle lock --add-platform x86_64-linux-gnu
Usage
result = Triangulum::Validation.new(flow, function_definitions, data_types).validate
result.valid? # => true / false
result.return_type # => "void"
result.diagnostics # => [Triangulum::Validation::Diagnostic, ...]
The arguments are Tucana protobuf objects:
flow—Tucana::Shared::ValidationFlowruntime_function_definitions—Array<Tucana::Shared::RuntimeFunctionDefinition>data_types—Array<Tucana::Shared::DefinitionDataType>
Diagnostics
Each diagnostic contains:
| Field | Description |
|---|---|
message |
Human-readable error description |
code |
TypeScript diagnostic code |
severity |
"error" or "warning" |
node_id |
ID of the node that caused the error |
parameter_index |
Index of the parameter that caused the error |
Development
Prerequisites: Bun installed locally for building the entrypoint.
cd gem
bundle install
bundle exec rake prepare_build # downloads bun binaries + builds JS entrypoint
bundle exec rake # run tests and rubocop
Building platform gems
bundle exec rake package
This will download bun binaries (with SHA256 checksum verification) for all supported platforms and build a .gem file for each.
License
See LICENSE.