@gorules/zen-engine 0.48.0 → 0.49.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.
- package/index.d.ts +13 -25
- package/package.json +11 -10
package/index.d.ts
CHANGED
|
@@ -5,22 +5,23 @@
|
|
|
5
5
|
|
|
6
6
|
export interface ZenConfig {
|
|
7
7
|
nodesInContext?: boolean
|
|
8
|
+
functionTimeoutMillis?: number
|
|
8
9
|
}
|
|
9
|
-
export function overrideConfig(config: ZenConfig): void
|
|
10
|
+
export declare function overrideConfig(config: ZenConfig): void
|
|
10
11
|
export interface ZenEvaluateOptions {
|
|
11
12
|
maxDepth?: number
|
|
12
|
-
trace?: boolean
|
|
13
|
+
trace?: boolean | 'string' | 'reference' | 'referenceString'
|
|
13
14
|
}
|
|
14
15
|
export interface ZenEngineOptions {
|
|
15
16
|
loader?: (key: string) => Promise<Buffer | ZenDecisionContent>
|
|
16
17
|
customHandler?: (request: ZenEngineHandlerRequest) => Promise<ZenEngineHandlerResponse>
|
|
17
18
|
}
|
|
18
|
-
export function evaluateExpressionSync(expression: string, context?: any | undefined | null): any
|
|
19
|
-
export function evaluateUnaryExpressionSync(expression: string, context: any): boolean
|
|
20
|
-
export function renderTemplateSync(template: string, context: any): any
|
|
21
|
-
export function evaluateExpression(expression: string, context?: any | undefined | null): Promise<any>
|
|
22
|
-
export function evaluateUnaryExpression(expression: string, context: any): Promise<boolean>
|
|
23
|
-
export function renderTemplate(template: string, context: any): Promise<any>
|
|
19
|
+
export declare function evaluateExpressionSync(expression: string, context?: any | undefined | null): any
|
|
20
|
+
export declare function evaluateUnaryExpressionSync(expression: string, context: any): boolean
|
|
21
|
+
export declare function renderTemplateSync(template: string, context: any): any
|
|
22
|
+
export declare function evaluateExpression(expression: string, context?: any | undefined | null): Promise<any>
|
|
23
|
+
export declare function evaluateUnaryExpression(expression: string, context: any): Promise<boolean>
|
|
24
|
+
export declare function renderTemplate(template: string, context: any): Promise<any>
|
|
24
25
|
export interface ZenEngineTrace {
|
|
25
26
|
id: string
|
|
26
27
|
name: string
|
|
@@ -45,17 +46,17 @@ export interface DecisionNode {
|
|
|
45
46
|
kind: string
|
|
46
47
|
config: any
|
|
47
48
|
}
|
|
48
|
-
export class ZenDecisionContent {
|
|
49
|
+
export declare class ZenDecisionContent {
|
|
49
50
|
constructor(content: Buffer | object)
|
|
50
51
|
toBuffer(): Buffer
|
|
51
52
|
}
|
|
52
|
-
export class ZenDecision {
|
|
53
|
+
export declare class ZenDecision {
|
|
53
54
|
constructor()
|
|
54
55
|
evaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<ZenEngineResponse>
|
|
55
56
|
safeEvaluate(context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<SafeResult<ZenEngineResponse>>
|
|
56
57
|
validate(): void
|
|
57
58
|
}
|
|
58
|
-
export class ZenEngine {
|
|
59
|
+
export declare class ZenEngine {
|
|
59
60
|
constructor(options?: ZenEngineOptions | undefined | null)
|
|
60
61
|
evaluate(key: string, context: any, opts?: ZenEvaluateOptions | undefined | null): Promise<ZenEngineResponse>
|
|
61
62
|
createDecision(content: ZenDecisionContent | Buffer | object): ZenDecision
|
|
@@ -68,23 +69,10 @@ export class ZenEngine {
|
|
|
68
69
|
*/
|
|
69
70
|
dispose(): void
|
|
70
71
|
}
|
|
71
|
-
export class ZenEngineHandlerRequest {
|
|
72
|
+
export declare class ZenEngineHandlerRequest {
|
|
72
73
|
input: any
|
|
73
74
|
node: DecisionNode
|
|
74
75
|
constructor()
|
|
75
76
|
getField(path: string): unknown
|
|
76
77
|
getFieldRaw(path: string): unknown
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
// Custom definitions
|
|
80
|
-
type SafeResultSuccess<T> = {
|
|
81
|
-
success: true;
|
|
82
|
-
data: T;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
type SafeResultError = {
|
|
86
|
-
success: false;
|
|
87
|
-
error: any;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export type SafeResult<T> = SafeResultSuccess<T> | SafeResultError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gorules/zen-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@types/express": "^5.0.1",
|
|
56
56
|
"@types/node": "^22.14.1",
|
|
57
57
|
"babel-jest": "^29.7.0",
|
|
58
|
+
"cross-env": "^10.0.0",
|
|
58
59
|
"express": "^5.1.0",
|
|
59
60
|
"jest": "^29.7.0",
|
|
60
61
|
"lerna": "6",
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
"build": "napi build --dts temp.d.ts --platform --release",
|
|
79
80
|
"build:debug": "napi build --platform --js index.js --dts index.d.ts",
|
|
80
81
|
"watch": "cargo watch --ignore '{index.js,index.d.ts}' -- npm run build:debug",
|
|
81
|
-
"test": "jest",
|
|
82
|
+
"test": "cross-env __ZEN_MOCK_UTC_TIME=2025-08-19T16:55:02.078Z jest",
|
|
82
83
|
"artifacts": "napi artifacts -d ../../artifacts",
|
|
83
84
|
"prepublishOnly": "napi prepublish",
|
|
84
85
|
"version": "napi version"
|
|
@@ -86,14 +87,14 @@
|
|
|
86
87
|
"resolutions": {
|
|
87
88
|
"form-data@^4.0.0": "4.0.4"
|
|
88
89
|
},
|
|
89
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "33fe2a42c2c2ffb2f9cf218501d821ddad49a477",
|
|
90
91
|
"optionalDependencies": {
|
|
91
|
-
"@gorules/zen-engine-darwin-x64": "0.
|
|
92
|
-
"@gorules/zen-engine-linux-x64-gnu": "0.
|
|
93
|
-
"@gorules/zen-engine-linux-x64-musl": "0.
|
|
94
|
-
"@gorules/zen-engine-win32-x64-msvc": "0.
|
|
95
|
-
"@gorules/zen-engine-linux-arm64-gnu": "0.
|
|
96
|
-
"@gorules/zen-engine-linux-arm64-musl": "0.
|
|
97
|
-
"@gorules/zen-engine-darwin-arm64": "0.
|
|
92
|
+
"@gorules/zen-engine-darwin-x64": "0.49.0",
|
|
93
|
+
"@gorules/zen-engine-linux-x64-gnu": "0.49.0",
|
|
94
|
+
"@gorules/zen-engine-linux-x64-musl": "0.49.0",
|
|
95
|
+
"@gorules/zen-engine-win32-x64-msvc": "0.49.0",
|
|
96
|
+
"@gorules/zen-engine-linux-arm64-gnu": "0.49.0",
|
|
97
|
+
"@gorules/zen-engine-linux-arm64-musl": "0.49.0",
|
|
98
|
+
"@gorules/zen-engine-darwin-arm64": "0.49.0"
|
|
98
99
|
}
|
|
99
100
|
}
|