@json-eval-rs/bundler 0.0.54 → 0.0.56

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-eval-rs/bundler",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "JSON Eval RS for bundlers (Webpack, Vite, Next.js, etc.) with ergonomic API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,17 +1,17 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Initialize the library (sets up panic hook)
4
+ * Get the library version
5
5
  */
6
- export function init(): void;
6
+ export function getVersion(): string;
7
7
  /**
8
8
  * Get library version (alias)
9
9
  */
10
10
  export function version(): string;
11
11
  /**
12
- * Get the library version
12
+ * Initialize the library (sets up panic hook)
13
13
  */
14
- export function getVersion(): string;
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
  *
@@ -242,6 +250,13 @@ export class JSONEvalWasm {
242
250
  * @returns Data in specified format as JavaScript object
243
251
  */
244
252
  getSchemaByPathsJS(paths_json: string, format: number): any;
253
+ /**
254
+ * Get all schema values as array of path-value pairs
255
+ * Returns [{path: "", value: ""}, ...]
256
+ *
257
+ * @returns Array of {path, value} objects as JavaScript array
258
+ */
259
+ getSchemaValueArray(): any;
245
260
  /**
246
261
  * Get the evaluated schema as JavaScript object
247
262
  *
@@ -249,6 +264,13 @@ export class JSONEvalWasm {
249
264
  * @returns Evaluated schema as JavaScript object
250
265
  */
251
266
  getEvaluatedSchemaJS(skip_layout: boolean): any;
267
+ /**
268
+ * Get all schema values as object with dotted path keys
269
+ * Returns {path: value, ...}
270
+ *
271
+ * @returns Flat object with dotted paths as keys
272
+ */
273
+ getSchemaValueObject(): any;
252
274
  /**
253
275
  * Reload schema from ParsedSchemaCache using a cache key
254
276
  *
@@ -360,10 +382,11 @@ export class JSONEvalWasm {
360
382
  */
361
383
  resolveLayoutSubform(subform_path: string, evaluate: boolean): void;
362
384
  /**
363
- * Get schema value from subform (all .value fields)
385
+ * Get schema value from subform in nested object format (all .value fields).
386
+ * Returns a hierarchical object structure mimicking the schema.
364
387
  *
365
388
  * @param subformPath - Path to the subform
366
- * @returns Modified data as JavaScript object
389
+ * @returns Modified data as JavaScript object (Nested)
367
390
  */
368
391
  getSchemaValueSubform(subform_path: string): any;
369
392
  /**
@@ -424,6 +447,14 @@ export class JSONEvalWasm {
424
447
  * @returns Data in specified format as JavaScript object
425
448
  */
426
449
  getSchemaByPathsSubformJS(subform_path: string, paths_json: string, format: number): any;
450
+ /**
451
+ * Get schema values from subform as a flat array of path-value pairs.
452
+ * Returns an array like `[{path: "field.sub", value: 123}, ...]`.
453
+ *
454
+ * @param subformPath - Path to the subform
455
+ * @returns Array of {path, value} objects
456
+ */
457
+ getSchemaValueArraySubform(subform_path: string): any;
427
458
  /**
428
459
  * Get evaluated schema from subform as JavaScript object
429
460
  *
@@ -432,6 +463,14 @@ export class JSONEvalWasm {
432
463
  * @returns Evaluated schema as JavaScript object
433
464
  */
434
465
  getEvaluatedSchemaSubformJS(subform_path: string, resolve_layout: boolean): any;
466
+ /**
467
+ * Get schema values from subform as a flat object with dotted path keys.
468
+ * Returns an object like `{"field.sub": 123, ...}`.
469
+ *
470
+ * @param subformPath - Path to the subform
471
+ * @returns Flat object with dotted paths as keys
472
+ */
473
+ getSchemaValueObjectSubform(subform_path: string): any;
435
474
  /**
436
475
  * Get evaluated schema by specific path from subform
437
476
  *
@@ -153,17 +153,10 @@ function passArrayJsValueToWasm0(array, malloc) {
153
153
  return ptr;
154
154
  }
155
155
  /**
156
- * Initialize the library (sets up panic hook)
157
- */
158
- export function init() {
159
- wasm.init();
160
- }
161
-
162
- /**
163
- * Get library version (alias)
156
+ * Get the library version
164
157
  * @returns {string}
165
158
  */
166
- export function version() {
159
+ export function getVersion() {
167
160
  let deferred1_0;
168
161
  let deferred1_1;
169
162
  try {
@@ -181,10 +174,10 @@ export function version() {
181
174
  }
182
175
 
183
176
  /**
184
- * Get the library version
177
+ * Get library version (alias)
185
178
  * @returns {string}
186
179
  */
187
- export function getVersion() {
180
+ export function version() {
188
181
  let deferred1_0;
189
182
  let deferred1_1;
190
183
  try {
@@ -201,6 +194,13 @@ export function getVersion() {
201
194
  }
202
195
  }
203
196
 
197
+ /**
198
+ * Initialize the library (sets up panic hook)
199
+ */
200
+ export function init() {
201
+ wasm.init();
202
+ }
203
+
204
204
  function passArray8ToWasm0(arg, malloc) {
205
205
  const ptr = malloc(arg.length * 1, 1) >>> 0;
206
206
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -376,6 +376,38 @@ export class JSONEvalWasm {
376
376
  wasm.__wbindgen_add_to_stack_pointer(16);
377
377
  }
378
378
  }
379
+ /**
380
+ * Static helper to evaluate logic without creating an instance
381
+ * @param logic_str - JSON logic expression string
382
+ * @param data - Optional JSON data string
383
+ * @param context - Optional JSON context string
384
+ * @returns Result as JavaScript object
385
+ * @param {string} logic_str
386
+ * @param {string | null} [data]
387
+ * @param {string | null} [context]
388
+ * @returns {any}
389
+ */
390
+ static evaluateLogic(logic_str, data, context) {
391
+ try {
392
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
+ const ptr0 = passStringToWasm0(logic_str, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
394
+ const len0 = WASM_VECTOR_LEN;
395
+ var ptr1 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
396
+ var len1 = WASM_VECTOR_LEN;
397
+ var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
398
+ var len2 = WASM_VECTOR_LEN;
399
+ wasm.jsonevalwasm_evaluateLogic(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
400
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
401
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
402
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
403
+ if (r2) {
404
+ throw takeObject(r1);
405
+ }
406
+ return takeObject(r0);
407
+ } finally {
408
+ wasm.__wbindgen_add_to_stack_pointer(16);
409
+ }
410
+ }
379
411
  /**
380
412
  * Evaluate dependents and return as JavaScript object
381
413
  *
@@ -1005,6 +1037,28 @@ export class JSONEvalWasm {
1005
1037
  wasm.__wbindgen_add_to_stack_pointer(16);
1006
1038
  }
1007
1039
  }
1040
+ /**
1041
+ * Get all schema values as array of path-value pairs
1042
+ * Returns [{path: "", value: ""}, ...]
1043
+ *
1044
+ * @returns Array of {path, value} objects as JavaScript array
1045
+ * @returns {any}
1046
+ */
1047
+ getSchemaValueArray() {
1048
+ try {
1049
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1050
+ wasm.jsonevalwasm_getSchemaValueArray(retptr, this.__wbg_ptr);
1051
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1052
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1053
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1054
+ if (r2) {
1055
+ throw takeObject(r1);
1056
+ }
1057
+ return takeObject(r0);
1058
+ } finally {
1059
+ wasm.__wbindgen_add_to_stack_pointer(16);
1060
+ }
1061
+ }
1008
1062
  /**
1009
1063
  * Get the evaluated schema as JavaScript object
1010
1064
  *
@@ -1028,6 +1082,28 @@ export class JSONEvalWasm {
1028
1082
  wasm.__wbindgen_add_to_stack_pointer(16);
1029
1083
  }
1030
1084
  }
1085
+ /**
1086
+ * Get all schema values as object with dotted path keys
1087
+ * Returns {path: value, ...}
1088
+ *
1089
+ * @returns Flat object with dotted paths as keys
1090
+ * @returns {any}
1091
+ */
1092
+ getSchemaValueObject() {
1093
+ try {
1094
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1095
+ wasm.jsonevalwasm_getSchemaValueObject(retptr, this.__wbg_ptr);
1096
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1097
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1098
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1099
+ if (r2) {
1100
+ throw takeObject(r1);
1101
+ }
1102
+ return takeObject(r0);
1103
+ } finally {
1104
+ wasm.__wbindgen_add_to_stack_pointer(16);
1105
+ }
1106
+ }
1031
1107
  /**
1032
1108
  * Reload schema from ParsedSchemaCache using a cache key
1033
1109
  *
@@ -1384,10 +1460,11 @@ export class JSONEvalWasm {
1384
1460
  }
1385
1461
  }
1386
1462
  /**
1387
- * Get schema value from subform (all .value fields)
1463
+ * Get schema value from subform in nested object format (all .value fields).
1464
+ * Returns a hierarchical object structure mimicking the schema.
1388
1465
  *
1389
1466
  * @param subformPath - Path to the subform
1390
- * @returns Modified data as JavaScript object
1467
+ * @returns Modified data as JavaScript object (Nested)
1391
1468
  * @param {string} subform_path
1392
1469
  * @returns {any}
1393
1470
  */
@@ -1647,6 +1724,32 @@ export class JSONEvalWasm {
1647
1724
  wasm.__wbindgen_add_to_stack_pointer(16);
1648
1725
  }
1649
1726
  }
1727
+ /**
1728
+ * Get schema values from subform as a flat array of path-value pairs.
1729
+ * Returns an array like `[{path: "field.sub", value: 123}, ...]`.
1730
+ *
1731
+ * @param subformPath - Path to the subform
1732
+ * @returns Array of {path, value} objects
1733
+ * @param {string} subform_path
1734
+ * @returns {any}
1735
+ */
1736
+ getSchemaValueArraySubform(subform_path) {
1737
+ try {
1738
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1739
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1740
+ const len0 = WASM_VECTOR_LEN;
1741
+ wasm.jsonevalwasm_getSchemaValueArraySubform(retptr, this.__wbg_ptr, ptr0, len0);
1742
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1743
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1744
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1745
+ if (r2) {
1746
+ throw takeObject(r1);
1747
+ }
1748
+ return takeObject(r0);
1749
+ } finally {
1750
+ wasm.__wbindgen_add_to_stack_pointer(16);
1751
+ }
1752
+ }
1650
1753
  /**
1651
1754
  * Get evaluated schema from subform as JavaScript object
1652
1755
  *
@@ -1674,6 +1777,32 @@ export class JSONEvalWasm {
1674
1777
  wasm.__wbindgen_add_to_stack_pointer(16);
1675
1778
  }
1676
1779
  }
1780
+ /**
1781
+ * Get schema values from subform as a flat object with dotted path keys.
1782
+ * Returns an object like `{"field.sub": 123, ...}`.
1783
+ *
1784
+ * @param subformPath - Path to the subform
1785
+ * @returns Flat object with dotted paths as keys
1786
+ * @param {string} subform_path
1787
+ * @returns {any}
1788
+ */
1789
+ getSchemaValueObjectSubform(subform_path) {
1790
+ try {
1791
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1792
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1793
+ const len0 = WASM_VECTOR_LEN;
1794
+ wasm.jsonevalwasm_getSchemaValueObjectSubform(retptr, this.__wbg_ptr, ptr0, len0);
1795
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1796
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1797
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1798
+ if (r2) {
1799
+ throw takeObject(r1);
1800
+ }
1801
+ return takeObject(r0);
1802
+ } finally {
1803
+ wasm.__wbindgen_add_to_stack_pointer(16);
1804
+ }
1805
+ }
1677
1806
  /**
1678
1807
  * Get evaluated schema by specific path from subform
1679
1808
  *
@@ -2124,7 +2253,7 @@ export function __wbg_getTime_6bb3f64e0f18f817(arg0) {
2124
2253
  return ret;
2125
2254
  };
2126
2255
 
2127
- export function __wbg_log_14f17096e508a1ab(arg0, arg1) {
2256
+ export function __wbg_log_2f61091b102ce39d(arg0, arg1) {
2128
2257
  console.log(getStringFromWasm0(arg0, arg1));
2129
2258
  };
2130
2259
 
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;
@@ -46,6 +47,10 @@ export const jsonevalwasm_getSchemaByPathsJS: (a: number, b: number, c: number,
46
47
  export const jsonevalwasm_getSchemaByPathsSubform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
47
48
  export const jsonevalwasm_getSchemaByPathsSubformJS: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
48
49
  export const jsonevalwasm_getSchemaValue: (a: number, b: number) => void;
50
+ export const jsonevalwasm_getSchemaValueArray: (a: number, b: number) => void;
51
+ export const jsonevalwasm_getSchemaValueArraySubform: (a: number, b: number, c: number, d: number) => void;
52
+ export const jsonevalwasm_getSchemaValueObject: (a: number, b: number) => void;
53
+ export const jsonevalwasm_getSchemaValueObjectSubform: (a: number, b: number, c: number, d: number) => void;
49
54
  export const jsonevalwasm_getSchemaValueSubform: (a: number, b: number, c: number, d: number) => void;
50
55
  export const jsonevalwasm_getSubformPaths: (a: number, b: number) => void;
51
56
  export const jsonevalwasm_hasSubform: (a: number, b: number, c: number) => number;