@json-eval-rs/vanilla 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/vanilla",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "description": "JSON Eval RS for direct browser usage (vanilla JS) or manual WASM loading (Next.js Turbopack compat)",
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,7 +547,7 @@ 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
  }
522
553
 
@@ -570,6 +601,10 @@ export interface InitOutput {
570
601
  readonly jsonevalwasm_getSchemaByPathsSubform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
571
602
  readonly jsonevalwasm_getSchemaByPathsSubformJS: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
572
603
  readonly jsonevalwasm_getSchemaValue: (a: number, b: number) => void;
604
+ readonly jsonevalwasm_getSchemaValueArray: (a: number, b: number) => void;
605
+ readonly jsonevalwasm_getSchemaValueArraySubform: (a: number, b: number, c: number, d: number) => void;
606
+ readonly jsonevalwasm_getSchemaValueObject: (a: number, b: number) => void;
607
+ readonly jsonevalwasm_getSchemaValueObjectSubform: (a: number, b: number, c: number, d: number) => void;
573
608
  readonly jsonevalwasm_getSchemaValueSubform: (a: number, b: number, c: number, d: number) => void;
574
609
  readonly jsonevalwasm_getSubformPaths: (a: number, b: number) => void;
575
610
  readonly jsonevalwasm_hasSubform: (a: number, b: number, c: number) => number;
@@ -596,7 +631,7 @@ export interface InitOutput {
596
631
  readonly validationerror_path: (a: number, b: number) => void;
597
632
  readonly validationerror_pattern: (a: number, b: number) => void;
598
633
  readonly validationerror_rule_type: (a: number, b: number) => void;
599
- readonly validationresult_errors: (a: number, b: number) => void;
634
+ readonly validationresult_error: (a: number) => number;
600
635
  readonly validationresult_has_error: (a: number) => number;
601
636
  readonly validationresult_toJSON: (a: number, b: number) => void;
602
637
  readonly init: () => void;
@@ -149,10 +149,17 @@ function passArrayJsValueToWasm0(array, malloc) {
149
149
  return ptr;
150
150
  }
151
151
  /**
152
- * Get library version (alias)
152
+ * Initialize the library (sets up panic hook)
153
+ */
154
+ export function init() {
155
+ wasm.init();
156
+ }
157
+
158
+ /**
159
+ * Get the library version
153
160
  * @returns {string}
154
161
  */
155
- export function version() {
162
+ export function getVersion() {
156
163
  let deferred1_0;
157
164
  let deferred1_1;
158
165
  try {
@@ -170,10 +177,10 @@ export function version() {
170
177
  }
171
178
 
172
179
  /**
173
- * Get the library version
180
+ * Get library version (alias)
174
181
  * @returns {string}
175
182
  */
176
- export function getVersion() {
183
+ export function version() {
177
184
  let deferred1_0;
178
185
  let deferred1_1;
179
186
  try {
@@ -190,13 +197,6 @@ export function getVersion() {
190
197
  }
191
198
  }
192
199
 
193
- /**
194
- * Initialize the library (sets up panic hook)
195
- */
196
- export function init() {
197
- wasm.init();
198
- }
199
-
200
200
  function passArray8ToWasm0(arg, malloc) {
201
201
  const ptr = malloc(arg.length * 1, 1) >>> 0;
202
202
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -1033,6 +1033,28 @@ export class JSONEvalWasm {
1033
1033
  wasm.__wbindgen_add_to_stack_pointer(16);
1034
1034
  }
1035
1035
  }
1036
+ /**
1037
+ * Get all schema values as array of path-value pairs
1038
+ * Returns [{path: "", value: ""}, ...]
1039
+ *
1040
+ * @returns Array of {path, value} objects as JavaScript array
1041
+ * @returns {any}
1042
+ */
1043
+ getSchemaValueArray() {
1044
+ try {
1045
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1046
+ wasm.jsonevalwasm_getSchemaValueArray(retptr, this.__wbg_ptr);
1047
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1048
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1049
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1050
+ if (r2) {
1051
+ throw takeObject(r1);
1052
+ }
1053
+ return takeObject(r0);
1054
+ } finally {
1055
+ wasm.__wbindgen_add_to_stack_pointer(16);
1056
+ }
1057
+ }
1036
1058
  /**
1037
1059
  * Get the evaluated schema as JavaScript object
1038
1060
  *
@@ -1056,6 +1078,28 @@ export class JSONEvalWasm {
1056
1078
  wasm.__wbindgen_add_to_stack_pointer(16);
1057
1079
  }
1058
1080
  }
1081
+ /**
1082
+ * Get all schema values as object with dotted path keys
1083
+ * Returns {path: value, ...}
1084
+ *
1085
+ * @returns Flat object with dotted paths as keys
1086
+ * @returns {any}
1087
+ */
1088
+ getSchemaValueObject() {
1089
+ try {
1090
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1091
+ wasm.jsonevalwasm_getSchemaValueObject(retptr, this.__wbg_ptr);
1092
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1093
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1094
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1095
+ if (r2) {
1096
+ throw takeObject(r1);
1097
+ }
1098
+ return takeObject(r0);
1099
+ } finally {
1100
+ wasm.__wbindgen_add_to_stack_pointer(16);
1101
+ }
1102
+ }
1059
1103
  /**
1060
1104
  * Reload schema from ParsedSchemaCache using a cache key
1061
1105
  *
@@ -1412,10 +1456,11 @@ export class JSONEvalWasm {
1412
1456
  }
1413
1457
  }
1414
1458
  /**
1415
- * Get schema value from subform (all .value fields)
1459
+ * Get schema value from subform in nested object format (all .value fields).
1460
+ * Returns a hierarchical object structure mimicking the schema.
1416
1461
  *
1417
1462
  * @param subformPath - Path to the subform
1418
- * @returns Modified data as JavaScript object
1463
+ * @returns Modified data as JavaScript object (Nested)
1419
1464
  * @param {string} subform_path
1420
1465
  * @returns {any}
1421
1466
  */
@@ -1675,6 +1720,32 @@ export class JSONEvalWasm {
1675
1720
  wasm.__wbindgen_add_to_stack_pointer(16);
1676
1721
  }
1677
1722
  }
1723
+ /**
1724
+ * Get schema values from subform as a flat array of path-value pairs.
1725
+ * Returns an array like `[{path: "field.sub", value: 123}, ...]`.
1726
+ *
1727
+ * @param subformPath - Path to the subform
1728
+ * @returns Array of {path, value} objects
1729
+ * @param {string} subform_path
1730
+ * @returns {any}
1731
+ */
1732
+ getSchemaValueArraySubform(subform_path) {
1733
+ try {
1734
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1735
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1736
+ const len0 = WASM_VECTOR_LEN;
1737
+ wasm.jsonevalwasm_getSchemaValueArraySubform(retptr, this.__wbg_ptr, ptr0, len0);
1738
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1739
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1740
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1741
+ if (r2) {
1742
+ throw takeObject(r1);
1743
+ }
1744
+ return takeObject(r0);
1745
+ } finally {
1746
+ wasm.__wbindgen_add_to_stack_pointer(16);
1747
+ }
1748
+ }
1678
1749
  /**
1679
1750
  * Get evaluated schema from subform as JavaScript object
1680
1751
  *
@@ -1702,6 +1773,32 @@ export class JSONEvalWasm {
1702
1773
  wasm.__wbindgen_add_to_stack_pointer(16);
1703
1774
  }
1704
1775
  }
1776
+ /**
1777
+ * Get schema values from subform as a flat object with dotted path keys.
1778
+ * Returns an object like `{"field.sub": 123, ...}`.
1779
+ *
1780
+ * @param subformPath - Path to the subform
1781
+ * @returns Flat object with dotted paths as keys
1782
+ * @param {string} subform_path
1783
+ * @returns {any}
1784
+ */
1785
+ getSchemaValueObjectSubform(subform_path) {
1786
+ try {
1787
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1788
+ const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1789
+ const len0 = WASM_VECTOR_LEN;
1790
+ wasm.jsonevalwasm_getSchemaValueObjectSubform(retptr, this.__wbg_ptr, ptr0, len0);
1791
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1792
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1793
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1794
+ if (r2) {
1795
+ throw takeObject(r1);
1796
+ }
1797
+ return takeObject(r0);
1798
+ } finally {
1799
+ wasm.__wbindgen_add_to_stack_pointer(16);
1800
+ }
1801
+ }
1705
1802
  /**
1706
1803
  * Get evaluated schema by specific path from subform
1707
1804
  *
@@ -1904,14 +2001,6 @@ const ValidationErrorFinalization = (typeof FinalizationRegistry === 'undefined'
1904
2001
  */
1905
2002
  export class ValidationError {
1906
2003
 
1907
- static __wrap(ptr) {
1908
- ptr = ptr >>> 0;
1909
- const obj = Object.create(ValidationError.prototype);
1910
- obj.__wbg_ptr = ptr;
1911
- ValidationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1912
- return obj;
1913
- }
1914
-
1915
2004
  __destroy_into_raw() {
1916
2005
  const ptr = this.__wbg_ptr;
1917
2006
  this.__wbg_ptr = 0;
@@ -2075,20 +2164,11 @@ export class ValidationResult {
2075
2164
  wasm.__wbg_validationresult_free(ptr, 0);
2076
2165
  }
2077
2166
  /**
2078
- * @returns {ValidationError[]}
2167
+ * @returns {any}
2079
2168
  */
2080
- get errors() {
2081
- try {
2082
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2083
- wasm.validationresult_errors(retptr, this.__wbg_ptr);
2084
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2085
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2086
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2087
- wasm.__wbindgen_export_2(r0, r1 * 4, 4);
2088
- return v1;
2089
- } finally {
2090
- wasm.__wbindgen_add_to_stack_pointer(16);
2091
- }
2169
+ get error() {
2170
+ const ret = wasm.validationresult_error(this.__wbg_ptr);
2171
+ return takeObject(ret);
2092
2172
  }
2093
2173
  /**
2094
2174
  * @returns {any}
@@ -2185,7 +2265,7 @@ function __wbg_get_imports() {
2185
2265
  const ret = getObject(arg0).getTime();
2186
2266
  return ret;
2187
2267
  };
2188
- imports.wbg.__wbg_log_81520727e210fff2 = function(arg0, arg1) {
2268
+ imports.wbg.__wbg_log_c5bf37a3dcf4677e = function(arg0, arg1) {
2189
2269
  console.log(getStringFromWasm0(arg0, arg1));
2190
2270
  };
2191
2271
  imports.wbg.__wbg_new0_b0a0a38c201e6df5 = function() {
@@ -2225,10 +2305,6 @@ function __wbg_get_imports() {
2225
2305
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2226
2306
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2227
2307
  };
2228
- imports.wbg.__wbg_validationerror_new = function(arg0) {
2229
- const ret = ValidationError.__wrap(arg0);
2230
- return addHeapObject(ret);
2231
- };
2232
2308
  imports.wbg.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
2233
2309
  const ret = typeof(getObject(arg0)) === 'string';
2234
2310
  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;