triangulum 0.0.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +58 -16
- data/lib/triangulum/js/single-validation.js +173681 -0
- data/lib/triangulum/validation.rb +102 -0
- data/lib/triangulum/version.rb +1 -1
- data/lib/triangulum.rb +6 -2
- metadata +86 -11
- data/.rspec +0 -3
- data/.rubocop.yml +0 -16
- data/Rakefile +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf5f529931bcb2ad36e67d227429e8e1c73a3b05e1161d74533ad60c62044537
|
|
4
|
+
data.tar.gz: 8113c4b5b1237d029e0a0aeb49bd5b5ec308e2a2aca19d9f8efb8db0d8b369db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '00835fcec65ae4bad82405a93f4e42783aae5cd632559d48ea7bd5d52bd98a958b0c84d5bac7acd74384250af8d231a8d71b3b281faa9edc3fdf9751256672c6'
|
|
7
|
+
data.tar.gz: 83ecacc5887b723fc182cab4deddd71df57c31e79b024fa87135d4e055906c132a51b9950a877b2c73442d9c670c7215421b0e0016bc70f62a2fc36910c43a99
|
data/README.md
CHANGED
|
@@ -1,35 +1,77 @@
|
|
|
1
|
-
# Triangulum
|
|
1
|
+
# Triangulum Ruby Gem
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/triangulum`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
Ruby bindings for the [Triangulum](https://github.com/code0-tech/triangulum) validation layer. This gem wraps the TypeScript library and a bundled [Bun](https://bun.sh) runtime to validate flows using the TypeScript compiler.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
|
7
|
+
Add to your Gemfile:
|
|
12
8
|
|
|
13
|
-
```
|
|
14
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'triangulum'
|
|
15
11
|
```
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
Platform-specific gems are published for:
|
|
14
|
+
|
|
15
|
+
- `arm64-darwin` (macOS Apple Silicon)
|
|
16
|
+
- `x86_64-darwin` (macOS Intel)
|
|
17
|
+
- `x86_64-linux-gnu` (Linux x64)
|
|
18
|
+
- `x86_64-linux-musl` (Linux x64 musl)
|
|
19
|
+
- `aarch64-linux-gnu` (Linux ARM64)
|
|
20
|
+
- `aarch64-linux-musl` (Linux ARM64 musl)
|
|
21
|
+
|
|
22
|
+
If Bundler doesn't automatically select the correct platform gem, add your platform:
|
|
18
23
|
|
|
19
24
|
```bash
|
|
20
|
-
|
|
25
|
+
bundle lock --add-platform x86_64-linux-gnu
|
|
21
26
|
```
|
|
22
27
|
|
|
23
28
|
## Usage
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
```ruby
|
|
31
|
+
result = Triangulum::Validation.new(flow, runtime_function_definitions, data_types).validate
|
|
32
|
+
|
|
33
|
+
result.valid? # => true / false
|
|
34
|
+
result.return_type # => "void"
|
|
35
|
+
result.diagnostics # => [Triangulum::Validation::Diagnostic, ...]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The arguments are [Tucana](https://github.com/code0-tech/tucana) protobuf objects:
|
|
39
|
+
|
|
40
|
+
- `flow` — `Tucana::Shared::ValidationFlow`
|
|
41
|
+
- `runtime_function_definitions` — `Array<Tucana::Shared::RuntimeFunctionDefinition>`
|
|
42
|
+
- `data_types` — `Array<Tucana::Shared::DefinitionDataType>`
|
|
43
|
+
|
|
44
|
+
### Diagnostics
|
|
45
|
+
|
|
46
|
+
Each diagnostic contains:
|
|
47
|
+
|
|
48
|
+
| Field | Description |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `message` | Human-readable error description |
|
|
51
|
+
| `code` | TypeScript diagnostic code |
|
|
52
|
+
| `severity` | `"error"` or `"warning"` |
|
|
53
|
+
| `node_id` | ID of the node that caused the error |
|
|
54
|
+
| `parameter_index` | Index of the parameter that caused the error |
|
|
26
55
|
|
|
27
56
|
## Development
|
|
28
57
|
|
|
29
|
-
|
|
58
|
+
Prerequisites: [Bun](https://bun.sh) installed locally for building the entrypoint.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd gem
|
|
62
|
+
bundle install
|
|
63
|
+
bundle exec rake prepare_build # downloads bun binaries + builds JS entrypoint
|
|
64
|
+
bundle exec rake # run tests and rubocop
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Building platform gems
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bundle exec rake package
|
|
71
|
+
```
|
|
30
72
|
|
|
31
|
-
|
|
73
|
+
This will download bun binaries (with SHA256 checksum verification) for all supported platforms and build a `.gem` file for each.
|
|
32
74
|
|
|
33
|
-
##
|
|
75
|
+
## License
|
|
34
76
|
|
|
35
|
-
|
|
77
|
+
See [LICENSE](../LICENSE).
|