@json-eval-rs/node 0.0.55 → 0.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-eval-rs/node",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "description": "JSON Eval RS for Node.js and Server-Side Rendering 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
- * Get library version (alias)
4
+ * Initialize the library (sets up panic hook)
5
5
  */
6
- export function version(): string;
6
+ export function init(): void;
7
7
  /**
8
8
  * Get the library version
9
9
  */
10
10
  export function getVersion(): string;
11
11
  /**
12
- * Initialize the library (sets up panic hook)
12
+ * Get library version (alias)
13
13
  */
14
- export function init(): void;
14
+ export function version(): string;
15
15
  /**
16
16
  * WebAssembly wrapper for JSONEval
17
17
  */
@@ -250,6 +250,13 @@ export class JSONEvalWasm {
250
250
  * @returns Data in specified format as JavaScript object
251
251
  */
252
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;
253
260
  /**
254
261
  * Get the evaluated schema as JavaScript object
255
262
  *
@@ -257,6 +264,13 @@ export class JSONEvalWasm {
257
264
  * @returns Evaluated schema as JavaScript object
258
265
  */
259
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;
260
274
  /**
261
275
  * Reload schema from ParsedSchemaCache using a cache key
262
276
  *
@@ -368,10 +382,11 @@ export class JSONEvalWasm {
368
382
  */
369
383
  resolveLayoutSubform(subform_path: string, evaluate: boolean): void;
370
384
  /**
371
- * 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.
372
387
  *
373
388
  * @param subformPath - Path to the subform
374
- * @returns Modified data as JavaScript object
389
+ * @returns Modified data as JavaScript object (Nested)
375
390
  */
376
391
  getSchemaValueSubform(subform_path: string): any;
377
392
  /**
@@ -432,6 +447,14 @@ export class JSONEvalWasm {
432
447
  * @returns Data in specified format as JavaScript object
433
448
  */
434
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;
435
458
  /**
436
459
  * Get evaluated schema from subform as JavaScript object
437
460
  *
@@ -440,6 +463,14 @@ export class JSONEvalWasm {
440
463
  * @returns Evaluated schema as JavaScript object
441
464
  */
442
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;
443
474
  /**
444
475
  * Get evaluated schema by specific path from subform
445
476
  *
@@ -516,6 +547,6 @@ export class ValidationResult {
516
547
  free(): void;
517
548
  [Symbol.dispose](): void;
518
549
  toJSON(): any;
519
- readonly errors: ValidationError[];
550
+ readonly error: any;
520
551
  readonly has_error: boolean;
521
552
  }
@@ -143,10 +143,17 @@ function passArrayJsValueToWasm0(array, malloc) {
143
143
  return ptr;
144
144
  }
145
145
  /**
146
- * Get library version (alias)
146
+ * Initialize the library (sets up panic hook)
147
+ */
148
+ exports.init = function() {
149
+ wasm.init();
150
+ };
151
+
152
+ /**
153
+ * Get the library version
147
154
  * @returns {string}
148
155
  */
149
- exports.version = function() {
156
+ exports.getVersion = function() {
150
157
  let deferred1_0;
151
158
  let deferred1_1;
152
159
  try {
@@ -164,10 +171,10 @@ exports.version = function() {
164
171
  };
165
172
 
166
173
  /**
167
- * Get the library version
174
+ * Get library version (alias)
168
175
  * @returns {string}
169
176
  */
170
- exports.getVersion = function() {
177
+ exports.version = function() {
171
178
  let deferred1_0;
172
179
  let deferred1_1;
173
180
  try {
@@ -184,13 +191,6 @@ exports.getVersion = function() {
184
191
  }
185
192
  };
186
193
 
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);
@@ -1027,6 +1027,28 @@ class JSONEvalWasm {
1027
1027
  wasm.__wbindgen_add_to_stack_pointer(16);
1028
1028
  }
1029
1029
  }
1030
+ /**
1031
+ * Get all schema values as array of path-value pairs
1032
+ * Returns [{path: "", value: ""}, ...]
1033
+ *
1034
+ * @returns Array of {path, value} objects as JavaScript array
1035
+ * @returns {any}
1036
+ */
1037
+ getSchemaValueArray() {
1038
+ try {
1039
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1040
+ wasm.jsonevalwasm_getSchemaValueArray(retptr, this.__wbg_ptr);
1041
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1042
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1043
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1044
+ if (r2) {
1045
+ throw takeObject(r1);
1046
+ }
1047
+ return takeObject(r0);
1048
+ } finally {
1049
+ wasm.__wbindgen_add_to_stack_pointer(16);
1050
+ }
1051
+ }
1030
1052
  /**
1031
1053
  * Get the evaluated schema as JavaScript object
1032
1054
  *
@@ -1050,6 +1072,28 @@ class JSONEvalWasm {
1050
1072
  wasm.__wbindgen_add_to_stack_pointer(16);
1051
1073
  }
1052
1074
  }
1075
+ /**
1076
+ * Get all schema values as object with dotted path keys
1077
+ * Returns {path: value, ...}
1078
+ *
1079
+ * @returns Flat object with dotted paths as keys
1080
+ * @returns {any}
1081
+ */
1082
+ getSchemaValueObject() {
1083
+ try {
1084
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1085
+ wasm.jsonevalwasm_getSchemaValueObject(retptr, this.__wbg_ptr);
1086
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1087
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1088
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1089
+ if (r2) {
1090
+ throw takeObject(r1);
1091
+ }
1092
+ return takeObject(r0);
1093
+ } finally {
1094
+ wasm.__wbindgen_add_to_stack_pointer(16);
1095
+ }
1096
+ }
1053
1097
  /**
1054
1098
  * Reload schema from ParsedSchemaCache using a cache key
1055
1099
  *
@@ -1406,10 +1450,11 @@ class JSONEvalWasm {
1406
1450
  }
1407
1451
  }
1408
1452
  /**
1409
- * Get schema value from subform (all .value fields)
1453
+ * Get schema value from subform in nested object format (all .value fields).
1454
+ * Returns a hierarchical object structure mimicking the schema.
1410
1455
  *
1411
1456
  * @param subformPath - Path to the subform
1412
- * @returns Modified data as JavaScript object
1457
+ * @returns Modified data as JavaScript object (Nested)
1413
1458
  * @param {string} subform_path
1414
1459
  * @returns {any}
1415
1460
  */
@@ -1669,6 +1714,32 @@ class JSONEvalWasm {
1669
1714
  wasm.__wbindgen_add_to_stack_pointer(16);
1670
1715
  }
1671
1716
  }
1717
+ /**
1718
+ * Get schema values from subform as a flat array of path-value pairs.
1719
+ * Returns an array like `[{path: "field.sub", value: 123}, ...]`.
1720
+ *
1721
+ * @param subformPath - Path to the subform
1722
+ * @returns Array of {path, value} objects
1723
+ * @param {string} subform_path
1724
+ * @returns {any}
1725
+ */
1726
+ getSchemaValueArraySubform(subform_path) {
1727
+ try {
1728
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1729
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1730
+ const len0 = WASM_VECTOR_LEN;
1731
+ wasm.jsonevalwasm_getSchemaValueArraySubform(retptr, this.__wbg_ptr, ptr0, len0);
1732
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1733
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1734
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1735
+ if (r2) {
1736
+ throw takeObject(r1);
1737
+ }
1738
+ return takeObject(r0);
1739
+ } finally {
1740
+ wasm.__wbindgen_add_to_stack_pointer(16);
1741
+ }
1742
+ }
1672
1743
  /**
1673
1744
  * Get evaluated schema from subform as JavaScript object
1674
1745
  *
@@ -1696,6 +1767,32 @@ class JSONEvalWasm {
1696
1767
  wasm.__wbindgen_add_to_stack_pointer(16);
1697
1768
  }
1698
1769
  }
1770
+ /**
1771
+ * Get schema values from subform as a flat object with dotted path keys.
1772
+ * Returns an object like `{"field.sub": 123, ...}`.
1773
+ *
1774
+ * @param subformPath - Path to the subform
1775
+ * @returns Flat object with dotted paths as keys
1776
+ * @param {string} subform_path
1777
+ * @returns {any}
1778
+ */
1779
+ getSchemaValueObjectSubform(subform_path) {
1780
+ try {
1781
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1782
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1783
+ const len0 = WASM_VECTOR_LEN;
1784
+ wasm.jsonevalwasm_getSchemaValueObjectSubform(retptr, this.__wbg_ptr, ptr0, len0);
1785
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1786
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1787
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1788
+ if (r2) {
1789
+ throw takeObject(r1);
1790
+ }
1791
+ return takeObject(r0);
1792
+ } finally {
1793
+ wasm.__wbindgen_add_to_stack_pointer(16);
1794
+ }
1795
+ }
1699
1796
  /**
1700
1797
  * Get evaluated schema by specific path from subform
1701
1798
  *
@@ -1900,14 +1997,6 @@ const ValidationErrorFinalization = (typeof FinalizationRegistry === 'undefined'
1900
1997
  */
1901
1998
  class ValidationError {
1902
1999
 
1903
- static __wrap(ptr) {
1904
- ptr = ptr >>> 0;
1905
- const obj = Object.create(ValidationError.prototype);
1906
- obj.__wbg_ptr = ptr;
1907
- ValidationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1908
- return obj;
1909
- }
1910
-
1911
2000
  __destroy_into_raw() {
1912
2001
  const ptr = this.__wbg_ptr;
1913
2002
  this.__wbg_ptr = 0;
@@ -2073,20 +2162,11 @@ class ValidationResult {
2073
2162
  wasm.__wbg_validationresult_free(ptr, 0);
2074
2163
  }
2075
2164
  /**
2076
- * @returns {ValidationError[]}
2165
+ * @returns {any}
2077
2166
  */
2078
- get errors() {
2079
- try {
2080
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2081
- wasm.validationresult_errors(retptr, this.__wbg_ptr);
2082
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2083
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2084
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2085
- wasm.__wbindgen_export_2(r0, r1 * 4, 4);
2086
- return v1;
2087
- } finally {
2088
- wasm.__wbindgen_add_to_stack_pointer(16);
2089
- }
2167
+ get error() {
2168
+ const ret = wasm.validationresult_error(this.__wbg_ptr);
2169
+ return takeObject(ret);
2090
2170
  }
2091
2171
  /**
2092
2172
  * @returns {any}
@@ -2152,7 +2232,7 @@ exports.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
2152
2232
  return ret;
2153
2233
  };
2154
2234
 
2155
- exports.__wbg_log_81520727e210fff2 = function(arg0, arg1) {
2235
+ exports.__wbg_log_c5bf37a3dcf4677e = function(arg0, arg1) {
2156
2236
  console.log(getStringFromWasm0(arg0, arg1));
2157
2237
  };
2158
2238
 
@@ -2202,11 +2282,6 @@ exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
2202
2282
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2203
2283
  };
2204
2284
 
2205
- exports.__wbg_validationerror_new = function(arg0) {
2206
- const ret = ValidationError.__wrap(arg0);
2207
- return addHeapObject(ret);
2208
- };
2209
-
2210
2285
  exports.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
2211
2286
  const ret = typeof(getObject(arg0)) === 'string';
2212
2287
  return ret;
Binary file
@@ -47,6 +47,10 @@ export const jsonevalwasm_getSchemaByPathsJS: (a: number, b: number, c: number,
47
47
  export const jsonevalwasm_getSchemaByPathsSubform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
48
48
  export const jsonevalwasm_getSchemaByPathsSubformJS: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
49
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;
50
54
  export const jsonevalwasm_getSchemaValueSubform: (a: number, b: number, c: number, d: number) => void;
51
55
  export const jsonevalwasm_getSubformPaths: (a: number, b: number) => void;
52
56
  export const jsonevalwasm_hasSubform: (a: number, b: number, c: number) => number;
@@ -73,7 +77,7 @@ export const validationerror_message: (a: number, b: number) => void;
73
77
  export const validationerror_path: (a: number, b: number) => void;
74
78
  export const validationerror_pattern: (a: number, b: number) => void;
75
79
  export const validationerror_rule_type: (a: number, b: number) => void;
76
- export const validationresult_errors: (a: number, b: number) => void;
80
+ export const validationresult_error: (a: number) => number;
77
81
  export const validationresult_has_error: (a: number) => number;
78
82
  export const validationresult_toJSON: (a: number, b: number) => void;
79
83
  export const init: () => void;