@json-eval-rs/node 0.0.54 → 0.0.55
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/dist/index.d.ts +8 -0
- package/dist/index.js +10 -0
- package/package.json +1 -1
- package/pkg/json_eval_rs.d.ts +12 -4
- package/pkg/json_eval_rs.js +40 -8
- package/pkg/json_eval_rs_bg.wasm +0 -0
- package/pkg/json_eval_rs_bg.wasm.d.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ export declare class JSONEval extends JSONEvalCore {
|
|
|
16
16
|
* @returns New instance
|
|
17
17
|
*/
|
|
18
18
|
static fromCache(cacheKey: string, context?: any, data?: any): JSONEval;
|
|
19
|
+
/**
|
|
20
|
+
* Evaluate logic expression without creating an instance
|
|
21
|
+
* @param logicStr - JSON Logic expression (string or object)
|
|
22
|
+
* @param data - Optional data (string or object)
|
|
23
|
+
* @param context - Optional context (string or object)
|
|
24
|
+
* @returns Evaluation result
|
|
25
|
+
*/
|
|
26
|
+
static evaluateLogic(logicStr: string | object, data?: any, context?: any): any;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* Get library version
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,16 @@ export class JSONEval extends JSONEvalCore {
|
|
|
27
27
|
fromCache: true
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Evaluate logic expression without creating an instance
|
|
32
|
+
* @param logicStr - JSON Logic expression (string or object)
|
|
33
|
+
* @param data - Optional data (string or object)
|
|
34
|
+
* @param context - Optional context (string or object)
|
|
35
|
+
* @returns Evaluation result
|
|
36
|
+
*/
|
|
37
|
+
static evaluateLogic(logicStr, data, context) {
|
|
38
|
+
return JSONEvalCore.evaluateLogic(wasm, logicStr, data, context);
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* Get library version
|
package/package.json
CHANGED
package/pkg/json_eval_rs.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Initialize the library (sets up panic hook)
|
|
5
|
-
*/
|
|
6
|
-
export function init(): void;
|
|
7
3
|
/**
|
|
8
4
|
* Get library version (alias)
|
|
9
5
|
*/
|
|
@@ -12,6 +8,10 @@ export function version(): string;
|
|
|
12
8
|
* Get the library version
|
|
13
9
|
*/
|
|
14
10
|
export function getVersion(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize the library (sets up panic hook)
|
|
13
|
+
*/
|
|
14
|
+
export function init(): void;
|
|
15
15
|
/**
|
|
16
16
|
* WebAssembly wrapper for JSONEval
|
|
17
17
|
*/
|
|
@@ -49,6 +49,14 @@ export class JSONEvalWasm {
|
|
|
49
49
|
* @returns Result as JavaScript object
|
|
50
50
|
*/
|
|
51
51
|
compileAndRunLogic(logic_str: string, data?: string | null, context?: string | null): any;
|
|
52
|
+
/**
|
|
53
|
+
* Static helper to evaluate logic without creating an instance
|
|
54
|
+
* @param logic_str - JSON logic expression string
|
|
55
|
+
* @param data - Optional JSON data string
|
|
56
|
+
* @param context - Optional JSON context string
|
|
57
|
+
* @returns Result as JavaScript object
|
|
58
|
+
*/
|
|
59
|
+
static evaluateLogic(logic_str: string, data?: string | null, context?: string | null): any;
|
|
52
60
|
/**
|
|
53
61
|
* Evaluate dependents and return as JavaScript object
|
|
54
62
|
*
|
package/pkg/json_eval_rs.js
CHANGED
|
@@ -142,13 +142,6 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
142
142
|
WASM_VECTOR_LEN = array.length;
|
|
143
143
|
return ptr;
|
|
144
144
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Initialize the library (sets up panic hook)
|
|
147
|
-
*/
|
|
148
|
-
exports.init = function() {
|
|
149
|
-
wasm.init();
|
|
150
|
-
};
|
|
151
|
-
|
|
152
145
|
/**
|
|
153
146
|
* Get library version (alias)
|
|
154
147
|
* @returns {string}
|
|
@@ -191,6 +184,13 @@ exports.getVersion = function() {
|
|
|
191
184
|
}
|
|
192
185
|
};
|
|
193
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Initialize the library (sets up panic hook)
|
|
189
|
+
*/
|
|
190
|
+
exports.init = function() {
|
|
191
|
+
wasm.init();
|
|
192
|
+
};
|
|
193
|
+
|
|
194
194
|
function passArray8ToWasm0(arg, malloc) {
|
|
195
195
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
196
196
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -366,6 +366,38 @@ class JSONEvalWasm {
|
|
|
366
366
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Static helper to evaluate logic without creating an instance
|
|
371
|
+
* @param logic_str - JSON logic expression string
|
|
372
|
+
* @param data - Optional JSON data string
|
|
373
|
+
* @param context - Optional JSON context string
|
|
374
|
+
* @returns Result as JavaScript object
|
|
375
|
+
* @param {string} logic_str
|
|
376
|
+
* @param {string | null} [data]
|
|
377
|
+
* @param {string | null} [context]
|
|
378
|
+
* @returns {any}
|
|
379
|
+
*/
|
|
380
|
+
static evaluateLogic(logic_str, data, context) {
|
|
381
|
+
try {
|
|
382
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
383
|
+
const ptr0 = passStringToWasm0(logic_str, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
384
|
+
const len0 = WASM_VECTOR_LEN;
|
|
385
|
+
var ptr1 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
386
|
+
var len1 = WASM_VECTOR_LEN;
|
|
387
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
388
|
+
var len2 = WASM_VECTOR_LEN;
|
|
389
|
+
wasm.jsonevalwasm_evaluateLogic(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
390
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
391
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
392
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
393
|
+
if (r2) {
|
|
394
|
+
throw takeObject(r1);
|
|
395
|
+
}
|
|
396
|
+
return takeObject(r0);
|
|
397
|
+
} finally {
|
|
398
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
369
401
|
/**
|
|
370
402
|
* Evaluate dependents and return as JavaScript object
|
|
371
403
|
*
|
|
@@ -2120,7 +2152,7 @@ exports.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
|
|
|
2120
2152
|
return ret;
|
|
2121
2153
|
};
|
|
2122
2154
|
|
|
2123
|
-
exports.
|
|
2155
|
+
exports.__wbg_log_81520727e210fff2 = function(arg0, arg1) {
|
|
2124
2156
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
2125
2157
|
};
|
|
2126
2158
|
|
package/pkg/json_eval_rs_bg.wasm
CHANGED
|
Binary file
|
|
@@ -19,6 +19,7 @@ export const jsonevalwasm_evaluateDependentsJS: (a: number, b: number, c: number
|
|
|
19
19
|
export const jsonevalwasm_evaluateDependentsSubform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
20
20
|
export const jsonevalwasm_evaluateDependentsSubformJS: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
21
21
|
export const jsonevalwasm_evaluateJS: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
22
|
+
export const jsonevalwasm_evaluateLogic: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
22
23
|
export const jsonevalwasm_evaluateSubform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
23
24
|
export const jsonevalwasm_getEvaluatedSchema: (a: number, b: number, c: number) => void;
|
|
24
25
|
export const jsonevalwasm_getEvaluatedSchemaByPath: (a: number, b: number, c: number, d: number, e: number) => void;
|