Files
zen/bindings/nodejs/index.d.ts
T
stefan-gorules daecf901e6 feat: custom node (#138)
* feat: custom node

* add zen template, expose $nodes and $root

* add custom handler to go and nodejs

* add support for python, improve bindings, add error to zen template

* fix: correct binding exports for nodejs and python

* fix benchmark

* improve rust api, trim template in zen templates

* update cargo action

* update expression version

* compile action

* fix action format
2024-04-03 16:09:51 +02:00

61 lines
1.8 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface ZenEvaluateOptions {
maxDepth?: number
trace?: boolean
}
export interface ZenEngineOptions {
loader?: (key: string) => Promise<Buffer>
customHandler?: (request: ZenEngineHandlerRequest) => Promise<ZenEngineHandlerResponse>
}
export function evaluateExpressionSync(expression: string, context?: any | undefined | null): any
export function evaluateUnaryExpressionSync(expression: string, context: any): boolean
export function renderTemplateSync(template: string, context: any): any
export function evaluateExpression(expression: string, context?: any | undefined | null): Promise<any>
export function evaluateUnaryExpression(expression: string, context: any): Promise<boolean>
export function renderTemplate(template: string, context: any): Promise<any>
export interface ZenEngineTrace {
id: string
name: string
input: any
output: any
performance?: string
traceData?: any
}
export interface ZenEngineResponse {
performance: string
result: any
trace?: Record<string, ZenEngineTrace>
}
export interface ZenEngineHandlerResponse {
output: any
traceData?: any
}
export interface DecisionNode {
id: string
name: string
kind: string
config: any
}
export class ZenDecision {
constructor()
evaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<ZenEngineResponse>
validate(): void
}
export class ZenEngine {
constructor(options?: ZenEngineOptions | undefined | null)
evaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<ZenEngineResponse>
createDecision(content: Buffer): ZenDecision
getDecision(key: string): Promise<ZenDecision>
}
export class ZenEngineHandlerRequest {
input: any
node: DecisionNode
constructor()
getField(path: string): unknown
getFieldRaw(path: string): unknown
}