@driftgard/node 1.8.0 → 1.9.0

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.
Files changed (2) hide show
  1. package/README.md +14 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -136,6 +136,20 @@ await dg.reportOutcome(result.evaluation_id, "your-project-id", {
136
136
 
137
137
  For Strands agents, use the `BeforeToolCallEvent` hook — see the integration guide.
138
138
 
139
+ ### Custom expressions
140
+
141
+ Parameter rules support `custom_fn` for advanced validation. The expression is evaluated safely (no `eval`) with access to `value` (current param) and `params` (all params):
142
+
143
+ ```json
144
+ {
145
+ "amount": { "type": "number", "custom_fn": "value > 0 && value <= 10000" },
146
+ "to_account": { "type": "string", "custom_fn": "value !== params.from_account" },
147
+ "message": { "type": "string", "custom_fn": "value.length <= 500" }
148
+ }
149
+ ```
150
+
151
+ Supported: comparisons (`< > <= >= === !==`), logical (`&& || !`), arithmetic (`+ - * /`), string methods (`.length`, `.includes()`, `.startsWith()`, `.endsWith()`), and cross-parameter access via `params.field_name`.
152
+
139
153
  ## Features
140
154
 
141
155
  - Single `evaluate()` method — send prompt/response, get verdict
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftgard/node",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Official Driftgard Node.js SDK — evaluate LLM interactions against your compliance policy",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",