@json-eval-rs/node 0.0.29 → 0.0.32
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 +1 -1
- package/pkg/json_eval_rs.d.ts +228 -228
- package/pkg/json_eval_rs.js +747 -747
- package/pkg/json_eval_rs_bg.wasm +0 -0
- package/pkg/json_eval_rs_bg.wasm.d.ts +51 -51
package/pkg/json_eval_rs.js
CHANGED
|
@@ -198,15 +198,22 @@ function isLikeNone(x) {
|
|
|
198
198
|
return x === undefined || x === null;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
function
|
|
202
|
-
ptr =
|
|
201
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
202
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
203
203
|
const mem = getDataViewMemory0();
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
result.push(takeObject(mem.getUint32(i, true)));
|
|
204
|
+
for (let i = 0; i < array.length; i++) {
|
|
205
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
207
206
|
}
|
|
208
|
-
|
|
207
|
+
WASM_VECTOR_LEN = array.length;
|
|
208
|
+
return ptr;
|
|
209
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Initialize the library (sets up panic hook)
|
|
212
|
+
*/
|
|
213
|
+
exports.init = function() {
|
|
214
|
+
wasm.init();
|
|
215
|
+
};
|
|
216
|
+
|
|
210
217
|
/**
|
|
211
218
|
* Get the library version
|
|
212
219
|
* @returns {string}
|
|
@@ -249,13 +256,6 @@ exports.version = function() {
|
|
|
249
256
|
}
|
|
250
257
|
};
|
|
251
258
|
|
|
252
|
-
/**
|
|
253
|
-
* Initialize the library (sets up panic hook)
|
|
254
|
-
*/
|
|
255
|
-
exports.init = function() {
|
|
256
|
-
wasm.init();
|
|
257
|
-
};
|
|
258
|
-
|
|
259
259
|
function passArray8ToWasm0(arg, malloc) {
|
|
260
260
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
261
261
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -263,14 +263,14 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
263
263
|
return ptr;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
function
|
|
267
|
-
|
|
266
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
267
|
+
ptr = ptr >>> 0;
|
|
268
268
|
const mem = getDataViewMemory0();
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
const result = [];
|
|
270
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
271
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
271
272
|
}
|
|
272
|
-
|
|
273
|
-
return ptr;
|
|
273
|
+
return result;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
const JSONEvalWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -301,98 +301,163 @@ class JSONEvalWasm {
|
|
|
301
301
|
wasm.__wbg_jsonevalwasm_free(ptr, 0);
|
|
302
302
|
}
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
304
|
+
* Evaluate and return as JsValue for direct JavaScript object access
|
|
305
305
|
*
|
|
306
|
-
* @param
|
|
306
|
+
* @param data - JSON data string
|
|
307
307
|
* @param context - Optional context data JSON string
|
|
308
|
-
* @
|
|
309
|
-
* @param {string}
|
|
308
|
+
* @returns Evaluated schema as JavaScript object
|
|
309
|
+
* @param {string} data
|
|
310
310
|
* @param {string | null} [context]
|
|
311
|
-
* @
|
|
311
|
+
* @returns {any}
|
|
312
312
|
*/
|
|
313
|
-
|
|
313
|
+
evaluateJS(data, context) {
|
|
314
314
|
try {
|
|
315
315
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
316
|
-
const ptr0 = passStringToWasm0(
|
|
316
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
317
317
|
const len0 = WASM_VECTOR_LEN;
|
|
318
318
|
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
319
319
|
var len1 = WASM_VECTOR_LEN;
|
|
320
|
-
|
|
321
|
-
var len2 = WASM_VECTOR_LEN;
|
|
322
|
-
wasm.jsonevalwasm_new(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
320
|
+
wasm.jsonevalwasm_evaluateJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
323
321
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
324
322
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
325
323
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
326
324
|
if (r2) {
|
|
327
325
|
throw takeObject(r1);
|
|
328
326
|
}
|
|
329
|
-
|
|
330
|
-
JSONEvalWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
331
|
-
return this;
|
|
327
|
+
return takeObject(r0);
|
|
332
328
|
} finally {
|
|
333
329
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
334
330
|
}
|
|
335
331
|
}
|
|
336
332
|
/**
|
|
337
|
-
*
|
|
333
|
+
* Compile JSON logic and return a global ID
|
|
334
|
+
* @param logic_str - JSON logic expression as a string
|
|
335
|
+
* @returns Compiled logic ID as number (u64)
|
|
336
|
+
* @param {string} logic_str
|
|
337
|
+
* @returns {number}
|
|
338
|
+
*/
|
|
339
|
+
compileLogic(logic_str) {
|
|
340
|
+
try {
|
|
341
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
342
|
+
const ptr0 = passStringToWasm0(logic_str, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
343
|
+
const len0 = WASM_VECTOR_LEN;
|
|
344
|
+
wasm.jsonevalwasm_compileLogic(retptr, this.__wbg_ptr, ptr0, len0);
|
|
345
|
+
var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
|
|
346
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
347
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
348
|
+
if (r3) {
|
|
349
|
+
throw takeObject(r2);
|
|
350
|
+
}
|
|
351
|
+
return r0;
|
|
352
|
+
} finally {
|
|
353
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Evaluate dependents when a field changes (returns array of changes as JSON string)
|
|
338
358
|
*
|
|
339
|
-
* @param
|
|
359
|
+
* @param changedPath - Path of the field that changed
|
|
360
|
+
* @param data - Optional updated JSON data string
|
|
340
361
|
* @param context - Optional context data JSON string
|
|
341
|
-
* @
|
|
342
|
-
* @param {
|
|
362
|
+
* @returns Array of dependent change objects as JSON string
|
|
363
|
+
* @param {string} changed_path
|
|
364
|
+
* @param {string | null} [data]
|
|
343
365
|
* @param {string | null} [context]
|
|
366
|
+
* @returns {string}
|
|
367
|
+
*/
|
|
368
|
+
evaluateDependents(changed_path, data, context) {
|
|
369
|
+
let deferred5_0;
|
|
370
|
+
let deferred5_1;
|
|
371
|
+
try {
|
|
372
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
373
|
+
const ptr0 = passStringToWasm0(changed_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
374
|
+
const len0 = WASM_VECTOR_LEN;
|
|
375
|
+
var ptr1 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
376
|
+
var len1 = WASM_VECTOR_LEN;
|
|
377
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
378
|
+
var len2 = WASM_VECTOR_LEN;
|
|
379
|
+
wasm.jsonevalwasm_evaluateDependents(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
380
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
381
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
382
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
383
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
384
|
+
var ptr4 = r0;
|
|
385
|
+
var len4 = r1;
|
|
386
|
+
if (r3) {
|
|
387
|
+
ptr4 = 0; len4 = 0;
|
|
388
|
+
throw takeObject(r2);
|
|
389
|
+
}
|
|
390
|
+
deferred5_0 = ptr4;
|
|
391
|
+
deferred5_1 = len4;
|
|
392
|
+
return getStringFromWasm0(ptr4, len4);
|
|
393
|
+
} finally {
|
|
394
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
395
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Compile and run JSON logic from a JSON logic string
|
|
400
|
+
* @param logic_str - JSON logic expression as a string
|
|
401
|
+
* @param data - Optional JSON data string
|
|
402
|
+
* @param context - Optional JSON context string
|
|
403
|
+
* @returns Result as JavaScript object
|
|
404
|
+
* @param {string} logic_str
|
|
344
405
|
* @param {string | null} [data]
|
|
345
|
-
* @
|
|
406
|
+
* @param {string | null} [context]
|
|
407
|
+
* @returns {any}
|
|
346
408
|
*/
|
|
347
|
-
|
|
409
|
+
compileAndRunLogic(logic_str, data, context) {
|
|
348
410
|
try {
|
|
349
411
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
350
|
-
const ptr0 =
|
|
412
|
+
const ptr0 = passStringToWasm0(logic_str, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
351
413
|
const len0 = WASM_VECTOR_LEN;
|
|
352
|
-
var ptr1 = isLikeNone(
|
|
414
|
+
var ptr1 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
353
415
|
var len1 = WASM_VECTOR_LEN;
|
|
354
|
-
var ptr2 = isLikeNone(
|
|
416
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
355
417
|
var len2 = WASM_VECTOR_LEN;
|
|
356
|
-
wasm.
|
|
418
|
+
wasm.jsonevalwasm_compileAndRunLogic(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
357
419
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
358
420
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
359
421
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
360
422
|
if (r2) {
|
|
361
423
|
throw takeObject(r1);
|
|
362
424
|
}
|
|
363
|
-
return
|
|
425
|
+
return takeObject(r0);
|
|
364
426
|
} finally {
|
|
365
427
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
366
428
|
}
|
|
367
429
|
}
|
|
368
430
|
/**
|
|
369
|
-
*
|
|
431
|
+
* Evaluate dependents and return as JavaScript object
|
|
370
432
|
*
|
|
371
|
-
* @param
|
|
433
|
+
* @param changedPathsJson - JSON array of field paths that changed
|
|
434
|
+
* @param data - Optional updated JSON data string
|
|
372
435
|
* @param context - Optional context data JSON string
|
|
373
|
-
* @param
|
|
374
|
-
* @
|
|
375
|
-
* @param {string
|
|
376
|
-
* @param {string | null}
|
|
377
|
-
* @
|
|
436
|
+
* @param reEvaluate - If true, performs full evaluation after processing dependents
|
|
437
|
+
* @returns Array of dependent change objects as JavaScript object
|
|
438
|
+
* @param {string} changed_paths_json
|
|
439
|
+
* @param {string | null | undefined} data
|
|
440
|
+
* @param {string | null | undefined} context
|
|
441
|
+
* @param {boolean} re_evaluate
|
|
442
|
+
* @returns {any}
|
|
378
443
|
*/
|
|
379
|
-
|
|
444
|
+
evaluateDependentsJS(changed_paths_json, data, context, re_evaluate) {
|
|
380
445
|
try {
|
|
381
446
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
382
|
-
const ptr0 = passStringToWasm0(
|
|
447
|
+
const ptr0 = passStringToWasm0(changed_paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
383
448
|
const len0 = WASM_VECTOR_LEN;
|
|
384
|
-
var ptr1 = isLikeNone(
|
|
449
|
+
var ptr1 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
385
450
|
var len1 = WASM_VECTOR_LEN;
|
|
386
|
-
var ptr2 = isLikeNone(
|
|
451
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
387
452
|
var len2 = WASM_VECTOR_LEN;
|
|
388
|
-
wasm.
|
|
453
|
+
wasm.jsonevalwasm_evaluateDependentsJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, re_evaluate);
|
|
389
454
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
390
455
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
391
456
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
392
457
|
if (r2) {
|
|
393
458
|
throw takeObject(r1);
|
|
394
459
|
}
|
|
395
|
-
return
|
|
460
|
+
return takeObject(r0);
|
|
396
461
|
} finally {
|
|
397
462
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
398
463
|
}
|
|
@@ -424,23 +489,53 @@ class JSONEvalWasm {
|
|
|
424
489
|
}
|
|
425
490
|
}
|
|
426
491
|
/**
|
|
427
|
-
*
|
|
492
|
+
* Run pre-compiled logic by ID
|
|
493
|
+
* @param logic_id - Compiled logic ID from compileLogic
|
|
494
|
+
* @param data - Optional JSON data string
|
|
495
|
+
* @param context - Optional JSON context string
|
|
496
|
+
* @returns Result as JavaScript object
|
|
497
|
+
* @param {number} logic_id
|
|
498
|
+
* @param {string | null} [data]
|
|
499
|
+
* @param {string | null} [context]
|
|
500
|
+
* @returns {any}
|
|
501
|
+
*/
|
|
502
|
+
runLogic(logic_id, data, context) {
|
|
503
|
+
try {
|
|
504
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
505
|
+
var ptr0 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
506
|
+
var len0 = WASM_VECTOR_LEN;
|
|
507
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
508
|
+
var len1 = WASM_VECTOR_LEN;
|
|
509
|
+
wasm.jsonevalwasm_runLogic(retptr, this.__wbg_ptr, logic_id, ptr0, len0, ptr1, len1);
|
|
510
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
511
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
512
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
513
|
+
if (r2) {
|
|
514
|
+
throw takeObject(r1);
|
|
515
|
+
}
|
|
516
|
+
return takeObject(r0);
|
|
517
|
+
} finally {
|
|
518
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Validate data and return as plain JavaScript object (Worker-safe)
|
|
428
523
|
*
|
|
429
524
|
* @param data - JSON data string
|
|
430
525
|
* @param context - Optional context data JSON string
|
|
431
|
-
* @returns
|
|
526
|
+
* @returns Plain JavaScript object with validation result
|
|
432
527
|
* @param {string} data
|
|
433
528
|
* @param {string | null} [context]
|
|
434
529
|
* @returns {any}
|
|
435
530
|
*/
|
|
436
|
-
|
|
531
|
+
validateJS(data, context) {
|
|
437
532
|
try {
|
|
438
533
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
439
534
|
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
440
535
|
const len0 = WASM_VECTOR_LEN;
|
|
441
536
|
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
442
537
|
var len1 = WASM_VECTOR_LEN;
|
|
443
|
-
wasm.
|
|
538
|
+
wasm.jsonevalwasm_validateJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
444
539
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
445
540
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
446
541
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -453,71 +548,60 @@ class JSONEvalWasm {
|
|
|
453
548
|
}
|
|
454
549
|
}
|
|
455
550
|
/**
|
|
456
|
-
*
|
|
551
|
+
* Validate data against schema rules with optional path filtering
|
|
457
552
|
*
|
|
458
|
-
* @param
|
|
459
|
-
* @param data - Optional updated JSON data string
|
|
553
|
+
* @param data - JSON data string
|
|
460
554
|
* @param context - Optional context data JSON string
|
|
461
|
-
* @
|
|
462
|
-
* @
|
|
463
|
-
* @param {string
|
|
555
|
+
* @param paths - Optional array of paths to validate (null for all)
|
|
556
|
+
* @returns ValidationResult
|
|
557
|
+
* @param {string} data
|
|
464
558
|
* @param {string | null} [context]
|
|
465
|
-
* @
|
|
559
|
+
* @param {string[] | null} [paths]
|
|
560
|
+
* @returns {ValidationResult}
|
|
466
561
|
*/
|
|
467
|
-
|
|
468
|
-
let deferred5_0;
|
|
469
|
-
let deferred5_1;
|
|
562
|
+
validatePaths(data, context, paths) {
|
|
470
563
|
try {
|
|
471
564
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
472
|
-
const ptr0 = passStringToWasm0(
|
|
565
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
473
566
|
const len0 = WASM_VECTOR_LEN;
|
|
474
|
-
var ptr1 = isLikeNone(
|
|
567
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
475
568
|
var len1 = WASM_VECTOR_LEN;
|
|
476
|
-
var ptr2 = isLikeNone(
|
|
569
|
+
var ptr2 = isLikeNone(paths) ? 0 : passArrayJsValueToWasm0(paths, wasm.__wbindgen_export_0);
|
|
477
570
|
var len2 = WASM_VECTOR_LEN;
|
|
478
|
-
wasm.
|
|
571
|
+
wasm.jsonevalwasm_validatePaths(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
479
572
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
480
573
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
481
574
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
var len4 = r1;
|
|
485
|
-
if (r3) {
|
|
486
|
-
ptr4 = 0; len4 = 0;
|
|
487
|
-
throw takeObject(r2);
|
|
575
|
+
if (r2) {
|
|
576
|
+
throw takeObject(r1);
|
|
488
577
|
}
|
|
489
|
-
|
|
490
|
-
deferred5_1 = len4;
|
|
491
|
-
return getStringFromWasm0(ptr4, len4);
|
|
578
|
+
return ValidationResult.__wrap(r0);
|
|
492
579
|
} finally {
|
|
493
580
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
494
|
-
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
495
581
|
}
|
|
496
582
|
}
|
|
497
583
|
/**
|
|
498
|
-
*
|
|
584
|
+
* Validate with path filtering and return as plain JavaScript object (Worker-safe)
|
|
499
585
|
*
|
|
500
|
-
* @param
|
|
501
|
-
* @param data - Optional updated JSON data string
|
|
586
|
+
* @param data - JSON data string
|
|
502
587
|
* @param context - Optional context data JSON string
|
|
503
|
-
* @param
|
|
504
|
-
* @returns
|
|
505
|
-
* @param {string}
|
|
506
|
-
* @param {string | null
|
|
507
|
-
* @param {string | null
|
|
508
|
-
* @param {boolean} re_evaluate
|
|
588
|
+
* @param paths - Optional array of paths to validate (null for all)
|
|
589
|
+
* @returns Plain JavaScript object with validation result
|
|
590
|
+
* @param {string} data
|
|
591
|
+
* @param {string | null} [context]
|
|
592
|
+
* @param {string[] | null} [paths]
|
|
509
593
|
* @returns {any}
|
|
510
594
|
*/
|
|
511
|
-
|
|
595
|
+
validatePathsJS(data, context, paths) {
|
|
512
596
|
try {
|
|
513
597
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
514
|
-
const ptr0 = passStringToWasm0(
|
|
598
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
515
599
|
const len0 = WASM_VECTOR_LEN;
|
|
516
|
-
var ptr1 = isLikeNone(
|
|
600
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
517
601
|
var len1 = WASM_VECTOR_LEN;
|
|
518
|
-
var ptr2 = isLikeNone(
|
|
602
|
+
var ptr2 = isLikeNone(paths) ? 0 : passArrayJsValueToWasm0(paths, wasm.__wbindgen_export_0);
|
|
519
603
|
var len2 = WASM_VECTOR_LEN;
|
|
520
|
-
wasm.
|
|
604
|
+
wasm.jsonevalwasm_validatePathsJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
521
605
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
522
606
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
523
607
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -530,251 +614,253 @@ class JSONEvalWasm {
|
|
|
530
614
|
}
|
|
531
615
|
}
|
|
532
616
|
/**
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
* @param data -
|
|
536
|
-
* @param context - Optional JSON
|
|
537
|
-
* @returns
|
|
538
|
-
* @param {string}
|
|
539
|
-
* @param {string | null} [data]
|
|
617
|
+
* Validate data against schema rules
|
|
618
|
+
*
|
|
619
|
+
* @param data - JSON data string
|
|
620
|
+
* @param context - Optional context data JSON string
|
|
621
|
+
* @returns ValidationResult
|
|
622
|
+
* @param {string} data
|
|
540
623
|
* @param {string | null} [context]
|
|
541
|
-
* @returns {
|
|
624
|
+
* @returns {ValidationResult}
|
|
542
625
|
*/
|
|
543
|
-
|
|
626
|
+
validate(data, context) {
|
|
544
627
|
try {
|
|
545
628
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
546
|
-
const ptr0 = passStringToWasm0(
|
|
629
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
547
630
|
const len0 = WASM_VECTOR_LEN;
|
|
548
|
-
var ptr1 = isLikeNone(
|
|
631
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
549
632
|
var len1 = WASM_VECTOR_LEN;
|
|
550
|
-
|
|
551
|
-
var len2 = WASM_VECTOR_LEN;
|
|
552
|
-
wasm.jsonevalwasm_compileAndRunLogic(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
633
|
+
wasm.jsonevalwasm_validate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
553
634
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
554
635
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
555
636
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
556
637
|
if (r2) {
|
|
557
638
|
throw takeObject(r1);
|
|
558
639
|
}
|
|
559
|
-
return
|
|
560
|
-
} finally {
|
|
561
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Compile JSON logic and return a global ID
|
|
566
|
-
* @param logic_str - JSON logic expression as a string
|
|
567
|
-
* @returns Compiled logic ID as number (u64)
|
|
568
|
-
* @param {string} logic_str
|
|
569
|
-
* @returns {number}
|
|
570
|
-
*/
|
|
571
|
-
compileLogic(logic_str) {
|
|
572
|
-
try {
|
|
573
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
574
|
-
const ptr0 = passStringToWasm0(logic_str, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
575
|
-
const len0 = WASM_VECTOR_LEN;
|
|
576
|
-
wasm.jsonevalwasm_compileLogic(retptr, this.__wbg_ptr, ptr0, len0);
|
|
577
|
-
var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
|
|
578
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
579
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
580
|
-
if (r3) {
|
|
581
|
-
throw takeObject(r2);
|
|
582
|
-
}
|
|
583
|
-
return r0;
|
|
640
|
+
return ValidationResult.__wrap(r0);
|
|
584
641
|
} finally {
|
|
585
642
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
586
643
|
}
|
|
587
644
|
}
|
|
588
645
|
/**
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
* @param
|
|
592
|
-
* @param context - Optional JSON
|
|
593
|
-
* @
|
|
594
|
-
* @param {
|
|
595
|
-
* @param {string | null} [data]
|
|
646
|
+
* Create a new JSONEval instance from a cached ParsedSchema
|
|
647
|
+
*
|
|
648
|
+
* @param cacheKey - Cache key to lookup in the global ParsedSchemaCache
|
|
649
|
+
* @param context - Optional context data JSON string
|
|
650
|
+
* @param data - Optional initial data JSON string
|
|
651
|
+
* @param {string} cache_key
|
|
596
652
|
* @param {string | null} [context]
|
|
597
|
-
* @
|
|
653
|
+
* @param {string | null} [data]
|
|
654
|
+
* @returns {JSONEvalWasm}
|
|
598
655
|
*/
|
|
599
|
-
|
|
656
|
+
static newFromCache(cache_key, context, data) {
|
|
600
657
|
try {
|
|
601
658
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
602
|
-
|
|
603
|
-
|
|
659
|
+
const ptr0 = passStringToWasm0(cache_key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
660
|
+
const len0 = WASM_VECTOR_LEN;
|
|
604
661
|
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
605
662
|
var len1 = WASM_VECTOR_LEN;
|
|
606
|
-
|
|
663
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
664
|
+
var len2 = WASM_VECTOR_LEN;
|
|
665
|
+
wasm.jsonevalwasm_newFromCache(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
607
666
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
608
667
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
609
668
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
610
669
|
if (r2) {
|
|
611
670
|
throw takeObject(r1);
|
|
612
671
|
}
|
|
613
|
-
return
|
|
672
|
+
return JSONEvalWasm.__wrap(r0);
|
|
614
673
|
} finally {
|
|
615
674
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
675
|
}
|
|
617
676
|
}
|
|
618
677
|
/**
|
|
619
|
-
*
|
|
678
|
+
* Create a new JSONEval instance from MessagePack-encoded schema
|
|
620
679
|
*
|
|
621
|
-
* @param
|
|
680
|
+
* @param schemaMsgpack - MessagePack-encoded schema bytes (Uint8Array)
|
|
622
681
|
* @param context - Optional context data JSON string
|
|
623
|
-
* @
|
|
624
|
-
* @param {
|
|
682
|
+
* @param data - Optional initial data JSON string
|
|
683
|
+
* @param {Uint8Array} schema_msgpack
|
|
625
684
|
* @param {string | null} [context]
|
|
626
|
-
* @
|
|
685
|
+
* @param {string | null} [data]
|
|
686
|
+
* @returns {JSONEvalWasm}
|
|
627
687
|
*/
|
|
628
|
-
|
|
688
|
+
static newFromMsgpack(schema_msgpack, context, data) {
|
|
629
689
|
try {
|
|
630
690
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
631
|
-
const ptr0 =
|
|
691
|
+
const ptr0 = passArray8ToWasm0(schema_msgpack, wasm.__wbindgen_export_0);
|
|
632
692
|
const len0 = WASM_VECTOR_LEN;
|
|
633
693
|
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
634
694
|
var len1 = WASM_VECTOR_LEN;
|
|
635
|
-
|
|
695
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
696
|
+
var len2 = WASM_VECTOR_LEN;
|
|
697
|
+
wasm.jsonevalwasm_newFromMsgpack(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
636
698
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
637
699
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
638
700
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
639
701
|
if (r2) {
|
|
640
702
|
throw takeObject(r1);
|
|
641
703
|
}
|
|
642
|
-
return
|
|
704
|
+
return JSONEvalWasm.__wrap(r0);
|
|
643
705
|
} finally {
|
|
644
706
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
645
707
|
}
|
|
646
708
|
}
|
|
647
709
|
/**
|
|
648
|
-
*
|
|
710
|
+
* Create a new JSONEval instance
|
|
649
711
|
*
|
|
650
|
-
* @param
|
|
712
|
+
* @param schema - JSON schema string
|
|
651
713
|
* @param context - Optional context data JSON string
|
|
652
|
-
* @
|
|
653
|
-
* @param {string}
|
|
714
|
+
* @param data - Optional initial data JSON string
|
|
715
|
+
* @param {string} schema
|
|
654
716
|
* @param {string | null} [context]
|
|
655
|
-
* @
|
|
717
|
+
* @param {string | null} [data]
|
|
656
718
|
*/
|
|
657
|
-
|
|
719
|
+
constructor(schema, context, data) {
|
|
658
720
|
try {
|
|
659
721
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
660
|
-
const ptr0 = passStringToWasm0(
|
|
722
|
+
const ptr0 = passStringToWasm0(schema, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
661
723
|
const len0 = WASM_VECTOR_LEN;
|
|
662
724
|
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
663
725
|
var len1 = WASM_VECTOR_LEN;
|
|
664
|
-
|
|
726
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
727
|
+
var len2 = WASM_VECTOR_LEN;
|
|
728
|
+
wasm.jsonevalwasm_new(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
665
729
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
666
730
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
667
731
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
668
732
|
if (r2) {
|
|
669
733
|
throw takeObject(r1);
|
|
670
734
|
}
|
|
671
|
-
|
|
735
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
736
|
+
JSONEvalWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
737
|
+
return this;
|
|
672
738
|
} finally {
|
|
673
739
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
674
740
|
}
|
|
675
741
|
}
|
|
676
742
|
/**
|
|
677
|
-
*
|
|
743
|
+
* Get cache statistics
|
|
678
744
|
*
|
|
679
|
-
* @
|
|
680
|
-
* @
|
|
681
|
-
* @param paths - Optional array of paths to validate (null for all)
|
|
682
|
-
* @returns ValidationResult
|
|
683
|
-
* @param {string} data
|
|
684
|
-
* @param {string | null} [context]
|
|
685
|
-
* @param {string[] | null} [paths]
|
|
686
|
-
* @returns {ValidationResult}
|
|
745
|
+
* @returns Cache statistics as JavaScript object with hits, misses, and entries
|
|
746
|
+
* @returns {any}
|
|
687
747
|
*/
|
|
688
|
-
|
|
748
|
+
cacheStats() {
|
|
689
749
|
try {
|
|
690
750
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
691
|
-
|
|
692
|
-
const len0 = WASM_VECTOR_LEN;
|
|
693
|
-
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
694
|
-
var len1 = WASM_VECTOR_LEN;
|
|
695
|
-
var ptr2 = isLikeNone(paths) ? 0 : passArrayJsValueToWasm0(paths, wasm.__wbindgen_export_0);
|
|
696
|
-
var len2 = WASM_VECTOR_LEN;
|
|
697
|
-
wasm.jsonevalwasm_validatePaths(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
751
|
+
wasm.jsonevalwasm_cacheStats(retptr, this.__wbg_ptr);
|
|
698
752
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
699
753
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
700
754
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
701
755
|
if (r2) {
|
|
702
756
|
throw takeObject(r1);
|
|
703
757
|
}
|
|
704
|
-
return
|
|
758
|
+
return takeObject(r0);
|
|
705
759
|
} finally {
|
|
706
760
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
707
761
|
}
|
|
708
762
|
}
|
|
709
763
|
/**
|
|
710
|
-
*
|
|
764
|
+
* Clear the evaluation cache
|
|
765
|
+
*/
|
|
766
|
+
clearCache() {
|
|
767
|
+
wasm.jsonevalwasm_clearCache(this.__wbg_ptr);
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Enable evaluation caching
|
|
771
|
+
* Useful for reusing JSONEval instances with different data
|
|
772
|
+
*/
|
|
773
|
+
enableCache() {
|
|
774
|
+
wasm.jsonevalwasm_enableCache(this.__wbg_ptr);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Disable evaluation caching
|
|
778
|
+
* Useful for web API usage where each request creates a new JSONEval instance
|
|
779
|
+
* Improves performance by skipping cache operations that have no benefit for single-use instances
|
|
780
|
+
*/
|
|
781
|
+
disableCache() {
|
|
782
|
+
wasm.jsonevalwasm_disableCache(this.__wbg_ptr);
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Check if evaluation caching is enabled
|
|
711
786
|
*
|
|
712
|
-
* @
|
|
713
|
-
* @
|
|
714
|
-
* @param paths - Optional array of paths to validate (null for all)
|
|
715
|
-
* @returns Plain JavaScript object with validation result
|
|
716
|
-
* @param {string} data
|
|
717
|
-
* @param {string | null} [context]
|
|
718
|
-
* @param {string[] | null} [paths]
|
|
719
|
-
* @returns {any}
|
|
787
|
+
* @returns true if caching is enabled, false otherwise
|
|
788
|
+
* @returns {boolean}
|
|
720
789
|
*/
|
|
721
|
-
|
|
790
|
+
isCacheEnabled() {
|
|
791
|
+
const ret = wasm.jsonevalwasm_isCacheEnabled(this.__wbg_ptr);
|
|
792
|
+
return ret !== 0;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Get the number of cached entries
|
|
796
|
+
*
|
|
797
|
+
* @returns Number of cached entries
|
|
798
|
+
* @returns {number}
|
|
799
|
+
*/
|
|
800
|
+
cacheLen() {
|
|
801
|
+
const ret = wasm.jsonevalwasm_cacheLen(this.__wbg_ptr);
|
|
802
|
+
return ret >>> 0;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Resolve layout with optional evaluation
|
|
806
|
+
*
|
|
807
|
+
* @param evaluate - If true, runs evaluation before resolving layout
|
|
808
|
+
* @throws Error if resolve fails
|
|
809
|
+
* @param {boolean} evaluate
|
|
810
|
+
*/
|
|
811
|
+
resolveLayout(evaluate) {
|
|
722
812
|
try {
|
|
723
813
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
724
|
-
|
|
725
|
-
const len0 = WASM_VECTOR_LEN;
|
|
726
|
-
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
727
|
-
var len1 = WASM_VECTOR_LEN;
|
|
728
|
-
var ptr2 = isLikeNone(paths) ? 0 : passArrayJsValueToWasm0(paths, wasm.__wbindgen_export_0);
|
|
729
|
-
var len2 = WASM_VECTOR_LEN;
|
|
730
|
-
wasm.jsonevalwasm_validatePathsJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
814
|
+
wasm.jsonevalwasm_resolveLayout(retptr, this.__wbg_ptr, evaluate);
|
|
731
815
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
732
816
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
throw takeObject(r1);
|
|
817
|
+
if (r1) {
|
|
818
|
+
throw takeObject(r0);
|
|
736
819
|
}
|
|
737
|
-
return takeObject(r0);
|
|
738
820
|
} finally {
|
|
739
821
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
740
822
|
}
|
|
741
823
|
}
|
|
742
824
|
/**
|
|
743
|
-
*
|
|
825
|
+
* Reload schema with new data
|
|
744
826
|
*
|
|
745
|
-
* @param
|
|
746
|
-
* @
|
|
747
|
-
* @param
|
|
748
|
-
* @
|
|
827
|
+
* @param schema - New JSON schema string
|
|
828
|
+
* @param context - Optional context data JSON string
|
|
829
|
+
* @param data - Optional initial data JSON string
|
|
830
|
+
* @param {string} schema
|
|
831
|
+
* @param {string | null} [context]
|
|
832
|
+
* @param {string | null} [data]
|
|
749
833
|
*/
|
|
750
|
-
|
|
751
|
-
let deferred1_0;
|
|
752
|
-
let deferred1_1;
|
|
834
|
+
reloadSchema(schema, context, data) {
|
|
753
835
|
try {
|
|
754
836
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
755
|
-
|
|
837
|
+
const ptr0 = passStringToWasm0(schema, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
838
|
+
const len0 = WASM_VECTOR_LEN;
|
|
839
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
840
|
+
var len1 = WASM_VECTOR_LEN;
|
|
841
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
842
|
+
var len2 = WASM_VECTOR_LEN;
|
|
843
|
+
wasm.jsonevalwasm_reloadSchema(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
756
844
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
757
845
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
846
|
+
if (r1) {
|
|
847
|
+
throw takeObject(r0);
|
|
848
|
+
}
|
|
761
849
|
} finally {
|
|
762
850
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
763
|
-
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
764
851
|
}
|
|
765
852
|
}
|
|
766
853
|
/**
|
|
767
|
-
* Get
|
|
854
|
+
* Get all schema values (evaluations ending with .value)
|
|
855
|
+
* Mutates internal data by overriding with values from value evaluations
|
|
768
856
|
*
|
|
769
|
-
* @
|
|
770
|
-
* @returns Evaluated schema as JavaScript object
|
|
771
|
-
* @param {boolean} skip_layout
|
|
857
|
+
* @returns Modified data as JavaScript object
|
|
772
858
|
* @returns {any}
|
|
773
859
|
*/
|
|
774
|
-
|
|
860
|
+
getSchemaValue() {
|
|
775
861
|
try {
|
|
776
862
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
777
|
-
wasm.
|
|
863
|
+
wasm.jsonevalwasm_getSchemaValue(retptr, this.__wbg_ptr);
|
|
778
864
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
779
865
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
780
866
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -787,76 +873,80 @@ class JSONEvalWasm {
|
|
|
787
873
|
}
|
|
788
874
|
}
|
|
789
875
|
/**
|
|
790
|
-
* Get the
|
|
791
|
-
*
|
|
792
|
-
* @param skipLayout - Whether to skip layout resolution
|
|
793
|
-
* @returns Evaluated schema as MessagePack bytes (Uint8Array)
|
|
794
|
-
*
|
|
795
|
-
* # Zero-Copy Optimization
|
|
796
|
-
*
|
|
797
|
-
* This method returns MessagePack binary data with minimal copying:
|
|
798
|
-
* 1. Serializes schema to Vec<u8> in Rust (unavoidable)
|
|
799
|
-
* 2. wasm-bindgen transfers Vec<u8> to JS as Uint8Array (optimized)
|
|
800
|
-
* 3. Result is a Uint8Array view (minimal overhead)
|
|
876
|
+
* Get a value from the schema using dotted path notation
|
|
801
877
|
*
|
|
802
|
-
*
|
|
803
|
-
* @
|
|
804
|
-
* @
|
|
878
|
+
* @param path - Dotted path to the value (e.g., "properties.field.value")
|
|
879
|
+
* @returns Value as JSON string or null if not found
|
|
880
|
+
* @param {string} path
|
|
881
|
+
* @returns {string | undefined}
|
|
805
882
|
*/
|
|
806
|
-
|
|
883
|
+
getSchemaByPath(path) {
|
|
807
884
|
try {
|
|
808
885
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
809
|
-
|
|
886
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
887
|
+
const len0 = WASM_VECTOR_LEN;
|
|
888
|
+
wasm.jsonevalwasm_getSchemaByPath(retptr, this.__wbg_ptr, ptr0, len0);
|
|
810
889
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
811
890
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
891
|
+
let v2;
|
|
892
|
+
if (r0 !== 0) {
|
|
893
|
+
v2 = getStringFromWasm0(r0, r1).slice();
|
|
894
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
816
895
|
}
|
|
817
|
-
|
|
818
|
-
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
819
|
-
return v1;
|
|
896
|
+
return v2;
|
|
820
897
|
} finally {
|
|
821
898
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
822
899
|
}
|
|
823
900
|
}
|
|
824
901
|
/**
|
|
825
|
-
* Get
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
* @returns
|
|
829
|
-
* @
|
|
902
|
+
* Get values from schema using multiple dotted paths
|
|
903
|
+
* @param pathsJson - JSON array of dotted paths
|
|
904
|
+
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
905
|
+
* @returns Data in specified format as JSON string
|
|
906
|
+
* @param {string} paths_json
|
|
907
|
+
* @param {number} format
|
|
908
|
+
* @returns {string}
|
|
830
909
|
*/
|
|
831
|
-
|
|
910
|
+
getSchemaByPaths(paths_json, format) {
|
|
911
|
+
let deferred3_0;
|
|
912
|
+
let deferred3_1;
|
|
832
913
|
try {
|
|
833
914
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
834
|
-
wasm.
|
|
915
|
+
const ptr0 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
916
|
+
const len0 = WASM_VECTOR_LEN;
|
|
917
|
+
wasm.jsonevalwasm_getSchemaByPaths(retptr, this.__wbg_ptr, ptr0, len0, format);
|
|
835
918
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
836
919
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
837
920
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
838
|
-
|
|
839
|
-
|
|
921
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
922
|
+
var ptr2 = r0;
|
|
923
|
+
var len2 = r1;
|
|
924
|
+
if (r3) {
|
|
925
|
+
ptr2 = 0; len2 = 0;
|
|
926
|
+
throw takeObject(r2);
|
|
840
927
|
}
|
|
841
|
-
|
|
928
|
+
deferred3_0 = ptr2;
|
|
929
|
+
deferred3_1 = len2;
|
|
930
|
+
return getStringFromWasm0(ptr2, len2);
|
|
842
931
|
} finally {
|
|
843
932
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
933
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
844
934
|
}
|
|
845
935
|
}
|
|
846
936
|
/**
|
|
847
|
-
* Get the evaluated schema
|
|
937
|
+
* Get the evaluated schema with optional layout resolution
|
|
848
938
|
*
|
|
849
939
|
* @param skipLayout - Whether to skip layout resolution
|
|
850
940
|
* @returns Evaluated schema as JSON string
|
|
851
941
|
* @param {boolean} skip_layout
|
|
852
942
|
* @returns {string}
|
|
853
943
|
*/
|
|
854
|
-
|
|
944
|
+
getEvaluatedSchema(skip_layout) {
|
|
855
945
|
let deferred1_0;
|
|
856
946
|
let deferred1_1;
|
|
857
947
|
try {
|
|
858
948
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
859
|
-
wasm.
|
|
949
|
+
wasm.jsonevalwasm_getEvaluatedSchema(retptr, this.__wbg_ptr, skip_layout);
|
|
860
950
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
861
951
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
862
952
|
deferred1_0 = r0;
|
|
@@ -868,17 +958,19 @@ class JSONEvalWasm {
|
|
|
868
958
|
}
|
|
869
959
|
}
|
|
870
960
|
/**
|
|
871
|
-
* Get the
|
|
961
|
+
* Get a value from the schema using dotted path notation as JavaScript object
|
|
872
962
|
*
|
|
873
|
-
* @param
|
|
874
|
-
* @returns
|
|
875
|
-
* @param {
|
|
963
|
+
* @param path - Dotted path to the value (e.g., "properties.field.value")
|
|
964
|
+
* @returns Value as JavaScript object or null if not found
|
|
965
|
+
* @param {string} path
|
|
876
966
|
* @returns {any}
|
|
877
967
|
*/
|
|
878
|
-
|
|
968
|
+
getSchemaByPathJS(path) {
|
|
879
969
|
try {
|
|
880
970
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
881
|
-
|
|
971
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
972
|
+
const len0 = WASM_VECTOR_LEN;
|
|
973
|
+
wasm.jsonevalwasm_getSchemaByPathJS(retptr, this.__wbg_ptr, ptr0, len0);
|
|
882
974
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
883
975
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
884
976
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -891,49 +983,49 @@ class JSONEvalWasm {
|
|
|
891
983
|
}
|
|
892
984
|
}
|
|
893
985
|
/**
|
|
894
|
-
*
|
|
986
|
+
* Reload schema from MessagePack-encoded bytes
|
|
895
987
|
*
|
|
896
|
-
* @param
|
|
897
|
-
* @param
|
|
898
|
-
* @
|
|
899
|
-
* @param {
|
|
900
|
-
* @param {
|
|
901
|
-
* @
|
|
988
|
+
* @param schemaMsgpack - MessagePack-encoded schema bytes (Uint8Array)
|
|
989
|
+
* @param context - Optional context data JSON string
|
|
990
|
+
* @param data - Optional initial data JSON string
|
|
991
|
+
* @param {Uint8Array} schema_msgpack
|
|
992
|
+
* @param {string | null} [context]
|
|
993
|
+
* @param {string | null} [data]
|
|
902
994
|
*/
|
|
903
|
-
|
|
995
|
+
reloadSchemaMsgpack(schema_msgpack, context, data) {
|
|
904
996
|
try {
|
|
905
997
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
906
|
-
const ptr0 =
|
|
998
|
+
const ptr0 = passArray8ToWasm0(schema_msgpack, wasm.__wbindgen_export_0);
|
|
907
999
|
const len0 = WASM_VECTOR_LEN;
|
|
908
|
-
|
|
1000
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1001
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1002
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1003
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1004
|
+
wasm.jsonevalwasm_reloadSchemaMsgpack(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
909
1005
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
910
1006
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
v2 = getStringFromWasm0(r0, r1).slice();
|
|
914
|
-
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1007
|
+
if (r1) {
|
|
1008
|
+
throw takeObject(r0);
|
|
915
1009
|
}
|
|
916
|
-
return v2;
|
|
917
1010
|
} finally {
|
|
918
1011
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
919
1012
|
}
|
|
920
1013
|
}
|
|
921
1014
|
/**
|
|
922
|
-
* Get
|
|
923
|
-
*
|
|
924
|
-
* @param
|
|
925
|
-
* @
|
|
926
|
-
* @
|
|
927
|
-
* @param {
|
|
928
|
-
* @param {boolean} skip_layout
|
|
1015
|
+
* Get values from schema using multiple dotted paths (JS object)
|
|
1016
|
+
* @param pathsJson - JSON array of dotted paths
|
|
1017
|
+
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1018
|
+
* @returns Data in specified format as JavaScript object
|
|
1019
|
+
* @param {string} paths_json
|
|
1020
|
+
* @param {number} format
|
|
929
1021
|
* @returns {any}
|
|
930
1022
|
*/
|
|
931
|
-
|
|
1023
|
+
getSchemaByPathsJS(paths_json, format) {
|
|
932
1024
|
try {
|
|
933
1025
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
934
|
-
const ptr0 = passStringToWasm0(
|
|
1026
|
+
const ptr0 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
935
1027
|
const len0 = WASM_VECTOR_LEN;
|
|
936
|
-
wasm.
|
|
1028
|
+
wasm.jsonevalwasm_getSchemaByPathsJS(retptr, this.__wbg_ptr, ptr0, len0, format);
|
|
937
1029
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
938
1030
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
939
1031
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -946,84 +1038,73 @@ class JSONEvalWasm {
|
|
|
946
1038
|
}
|
|
947
1039
|
}
|
|
948
1040
|
/**
|
|
949
|
-
* Get
|
|
950
|
-
*
|
|
1041
|
+
* Get the evaluated schema as JavaScript object
|
|
1042
|
+
*
|
|
951
1043
|
* @param skipLayout - Whether to skip layout resolution
|
|
952
|
-
* @
|
|
953
|
-
* @returns Data in specified format as JSON string
|
|
954
|
-
* @param {string} paths_json
|
|
1044
|
+
* @returns Evaluated schema as JavaScript object
|
|
955
1045
|
* @param {boolean} skip_layout
|
|
956
|
-
* @
|
|
957
|
-
* @returns {string}
|
|
1046
|
+
* @returns {any}
|
|
958
1047
|
*/
|
|
959
|
-
|
|
960
|
-
let deferred3_0;
|
|
961
|
-
let deferred3_1;
|
|
1048
|
+
getEvaluatedSchemaJS(skip_layout) {
|
|
962
1049
|
try {
|
|
963
1050
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
964
|
-
|
|
965
|
-
const len0 = WASM_VECTOR_LEN;
|
|
966
|
-
wasm.jsonevalwasm_getEvaluatedSchemaByPaths(retptr, this.__wbg_ptr, ptr0, len0, skip_layout, format);
|
|
1051
|
+
wasm.jsonevalwasm_getEvaluatedSchemaJS(retptr, this.__wbg_ptr, skip_layout);
|
|
967
1052
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
968
1053
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
969
1054
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
var len2 = r1;
|
|
973
|
-
if (r3) {
|
|
974
|
-
ptr2 = 0; len2 = 0;
|
|
975
|
-
throw takeObject(r2);
|
|
1055
|
+
if (r2) {
|
|
1056
|
+
throw takeObject(r1);
|
|
976
1057
|
}
|
|
977
|
-
|
|
978
|
-
deferred3_1 = len2;
|
|
979
|
-
return getStringFromWasm0(ptr2, len2);
|
|
1058
|
+
return takeObject(r0);
|
|
980
1059
|
} finally {
|
|
981
1060
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
982
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
983
1061
|
}
|
|
984
1062
|
}
|
|
985
1063
|
/**
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
* @param
|
|
989
|
-
* @param
|
|
990
|
-
* @
|
|
991
|
-
* @param {string}
|
|
992
|
-
* @param {
|
|
993
|
-
* @param {
|
|
994
|
-
* @returns {any}
|
|
1064
|
+
* Reload schema from ParsedSchemaCache using a cache key
|
|
1065
|
+
*
|
|
1066
|
+
* @param cacheKey - Cache key to lookup in the global ParsedSchemaCache
|
|
1067
|
+
* @param context - Optional context data JSON string
|
|
1068
|
+
* @param data - Optional initial data JSON string
|
|
1069
|
+
* @param {string} cache_key
|
|
1070
|
+
* @param {string | null} [context]
|
|
1071
|
+
* @param {string | null} [data]
|
|
995
1072
|
*/
|
|
996
|
-
|
|
1073
|
+
reloadSchemaFromCache(cache_key, context, data) {
|
|
997
1074
|
try {
|
|
998
1075
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
999
|
-
const ptr0 = passStringToWasm0(
|
|
1076
|
+
const ptr0 = passStringToWasm0(cache_key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1000
1077
|
const len0 = WASM_VECTOR_LEN;
|
|
1001
|
-
|
|
1078
|
+
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1079
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1080
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1081
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1082
|
+
wasm.jsonevalwasm_reloadSchemaFromCache(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1002
1083
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1003
1084
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
throw takeObject(r1);
|
|
1085
|
+
if (r1) {
|
|
1086
|
+
throw takeObject(r0);
|
|
1007
1087
|
}
|
|
1008
|
-
return takeObject(r0);
|
|
1009
1088
|
} finally {
|
|
1010
1089
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1011
1090
|
}
|
|
1012
1091
|
}
|
|
1013
1092
|
/**
|
|
1014
|
-
* Get a value from the schema using dotted path notation
|
|
1093
|
+
* Get a value from the evaluated schema using dotted path notation
|
|
1015
1094
|
*
|
|
1016
1095
|
* @param path - Dotted path to the value (e.g., "properties.field.value")
|
|
1096
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1017
1097
|
* @returns Value as JSON string or null if not found
|
|
1018
1098
|
* @param {string} path
|
|
1099
|
+
* @param {boolean} skip_layout
|
|
1019
1100
|
* @returns {string | undefined}
|
|
1020
1101
|
*/
|
|
1021
|
-
|
|
1102
|
+
getEvaluatedSchemaByPath(path, skip_layout) {
|
|
1022
1103
|
try {
|
|
1023
1104
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1024
1105
|
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1025
1106
|
const len0 = WASM_VECTOR_LEN;
|
|
1026
|
-
wasm.
|
|
1107
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPath(retptr, this.__wbg_ptr, ptr0, len0, skip_layout);
|
|
1027
1108
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1028
1109
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1029
1110
|
let v2;
|
|
@@ -1037,47 +1118,59 @@ class JSONEvalWasm {
|
|
|
1037
1118
|
}
|
|
1038
1119
|
}
|
|
1039
1120
|
/**
|
|
1040
|
-
* Get
|
|
1121
|
+
* Get the evaluated schema in MessagePack format
|
|
1041
1122
|
*
|
|
1042
|
-
* @param
|
|
1043
|
-
* @returns
|
|
1044
|
-
*
|
|
1045
|
-
*
|
|
1123
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1124
|
+
* @returns Evaluated schema as MessagePack bytes (Uint8Array)
|
|
1125
|
+
*
|
|
1126
|
+
* # Zero-Copy Optimization
|
|
1127
|
+
*
|
|
1128
|
+
* This method returns MessagePack binary data with minimal copying:
|
|
1129
|
+
* 1. Serializes schema to Vec<u8> in Rust (unavoidable)
|
|
1130
|
+
* 2. wasm-bindgen transfers Vec<u8> to JS as Uint8Array (optimized)
|
|
1131
|
+
* 3. Result is a Uint8Array view (minimal overhead)
|
|
1132
|
+
*
|
|
1133
|
+
* MessagePack format is 20-50% smaller than JSON, ideal for web/WASM.
|
|
1134
|
+
* @param {boolean} skip_layout
|
|
1135
|
+
* @returns {Uint8Array}
|
|
1046
1136
|
*/
|
|
1047
|
-
|
|
1137
|
+
getEvaluatedSchemaMsgpack(skip_layout) {
|
|
1048
1138
|
try {
|
|
1049
1139
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1050
|
-
|
|
1051
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1052
|
-
wasm.jsonevalwasm_getSchemaByPathJS(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1140
|
+
wasm.jsonevalwasm_getEvaluatedSchemaMsgpack(retptr, this.__wbg_ptr, skip_layout);
|
|
1053
1141
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1054
1142
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1055
1143
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1056
|
-
|
|
1057
|
-
|
|
1144
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1145
|
+
if (r3) {
|
|
1146
|
+
throw takeObject(r2);
|
|
1058
1147
|
}
|
|
1059
|
-
|
|
1148
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1149
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1150
|
+
return v1;
|
|
1060
1151
|
} finally {
|
|
1061
1152
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1062
1153
|
}
|
|
1063
1154
|
}
|
|
1064
1155
|
/**
|
|
1065
|
-
* Get values from schema using multiple dotted paths
|
|
1156
|
+
* Get values from evaluated schema using multiple dotted paths
|
|
1066
1157
|
* @param pathsJson - JSON array of dotted paths
|
|
1158
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1067
1159
|
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1068
1160
|
* @returns Data in specified format as JSON string
|
|
1069
1161
|
* @param {string} paths_json
|
|
1162
|
+
* @param {boolean} skip_layout
|
|
1070
1163
|
* @param {number} format
|
|
1071
1164
|
* @returns {string}
|
|
1072
1165
|
*/
|
|
1073
|
-
|
|
1166
|
+
getEvaluatedSchemaByPaths(paths_json, skip_layout, format) {
|
|
1074
1167
|
let deferred3_0;
|
|
1075
1168
|
let deferred3_1;
|
|
1076
1169
|
try {
|
|
1077
1170
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1078
1171
|
const ptr0 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1079
1172
|
const len0 = WASM_VECTOR_LEN;
|
|
1080
|
-
wasm.
|
|
1173
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPaths(retptr, this.__wbg_ptr, ptr0, len0, skip_layout, format);
|
|
1081
1174
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1082
1175
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1083
1176
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1097,20 +1190,49 @@ class JSONEvalWasm {
|
|
|
1097
1190
|
}
|
|
1098
1191
|
}
|
|
1099
1192
|
/**
|
|
1100
|
-
* Get
|
|
1193
|
+
* Get a value from the evaluated schema using dotted path notation as JavaScript object
|
|
1194
|
+
*
|
|
1195
|
+
* @param path - Dotted path to the value (e.g., "properties.field.value")
|
|
1196
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1197
|
+
* @returns Value as JavaScript object or null if not found
|
|
1198
|
+
* @param {string} path
|
|
1199
|
+
* @param {boolean} skip_layout
|
|
1200
|
+
* @returns {any}
|
|
1201
|
+
*/
|
|
1202
|
+
getEvaluatedSchemaByPathJS(path, skip_layout) {
|
|
1203
|
+
try {
|
|
1204
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1205
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1206
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1207
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPathJS(retptr, this.__wbg_ptr, ptr0, len0, skip_layout);
|
|
1208
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1209
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1210
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1211
|
+
if (r2) {
|
|
1212
|
+
throw takeObject(r1);
|
|
1213
|
+
}
|
|
1214
|
+
return takeObject(r0);
|
|
1215
|
+
} finally {
|
|
1216
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Get values from evaluated schema using multiple dotted paths (JS object)
|
|
1101
1221
|
* @param pathsJson - JSON array of dotted paths
|
|
1222
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1102
1223
|
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1103
1224
|
* @returns Data in specified format as JavaScript object
|
|
1104
1225
|
* @param {string} paths_json
|
|
1226
|
+
* @param {boolean} skip_layout
|
|
1105
1227
|
* @param {number} format
|
|
1106
1228
|
* @returns {any}
|
|
1107
1229
|
*/
|
|
1108
|
-
|
|
1230
|
+
getEvaluatedSchemaByPathsJS(paths_json, skip_layout, format) {
|
|
1109
1231
|
try {
|
|
1110
1232
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1111
1233
|
const ptr0 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1112
1234
|
const len0 = WASM_VECTOR_LEN;
|
|
1113
|
-
wasm.
|
|
1235
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPathsJS(retptr, this.__wbg_ptr, ptr0, len0, skip_layout, format);
|
|
1114
1236
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1115
1237
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1116
1238
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1123,83 +1245,87 @@ class JSONEvalWasm {
|
|
|
1123
1245
|
}
|
|
1124
1246
|
}
|
|
1125
1247
|
/**
|
|
1126
|
-
*
|
|
1248
|
+
* Get the evaluated schema without $params field
|
|
1127
1249
|
*
|
|
1128
|
-
* @param
|
|
1129
|
-
* @
|
|
1130
|
-
* @param
|
|
1131
|
-
* @
|
|
1132
|
-
* @param {string | null} [context]
|
|
1133
|
-
* @param {string | null} [data]
|
|
1250
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1251
|
+
* @returns Evaluated schema as JSON string
|
|
1252
|
+
* @param {boolean} skip_layout
|
|
1253
|
+
* @returns {string}
|
|
1134
1254
|
*/
|
|
1135
|
-
|
|
1255
|
+
getEvaluatedSchemaWithoutParams(skip_layout) {
|
|
1256
|
+
let deferred1_0;
|
|
1257
|
+
let deferred1_1;
|
|
1136
1258
|
try {
|
|
1137
1259
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1138
|
-
|
|
1139
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1140
|
-
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1141
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1142
|
-
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1143
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1144
|
-
wasm.jsonevalwasm_reloadSchema(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1260
|
+
wasm.jsonevalwasm_getEvaluatedSchemaWithoutParams(retptr, this.__wbg_ptr, skip_layout);
|
|
1145
1261
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1146
1262
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1263
|
+
deferred1_0 = r0;
|
|
1264
|
+
deferred1_1 = r1;
|
|
1265
|
+
return getStringFromWasm0(r0, r1);
|
|
1150
1266
|
} finally {
|
|
1151
1267
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1268
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1152
1269
|
}
|
|
1153
1270
|
}
|
|
1154
1271
|
/**
|
|
1155
|
-
*
|
|
1272
|
+
* Get the evaluated schema without $params as JavaScript object
|
|
1156
1273
|
*
|
|
1157
|
-
* @param
|
|
1158
|
-
* @
|
|
1159
|
-
* @param
|
|
1160
|
-
* @
|
|
1161
|
-
* @param {string | null} [context]
|
|
1162
|
-
* @param {string | null} [data]
|
|
1274
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1275
|
+
* @returns Evaluated schema as JavaScript object
|
|
1276
|
+
* @param {boolean} skip_layout
|
|
1277
|
+
* @returns {any}
|
|
1163
1278
|
*/
|
|
1164
|
-
|
|
1279
|
+
getEvaluatedSchemaWithoutParamsJS(skip_layout) {
|
|
1165
1280
|
try {
|
|
1166
1281
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1167
|
-
|
|
1168
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1169
|
-
var ptr1 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1170
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1171
|
-
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1172
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1173
|
-
wasm.jsonevalwasm_reloadSchemaMsgpack(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1282
|
+
wasm.jsonevalwasm_getEvaluatedSchemaWithoutParamsJS(retptr, this.__wbg_ptr, skip_layout);
|
|
1174
1283
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1175
1284
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1176
|
-
|
|
1177
|
-
|
|
1285
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1286
|
+
if (r2) {
|
|
1287
|
+
throw takeObject(r1);
|
|
1178
1288
|
}
|
|
1289
|
+
return takeObject(r0);
|
|
1179
1290
|
} finally {
|
|
1180
1291
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1181
1292
|
}
|
|
1182
1293
|
}
|
|
1183
1294
|
/**
|
|
1184
|
-
*
|
|
1295
|
+
* Check if a subform exists at the given path
|
|
1185
1296
|
*
|
|
1186
|
-
* @param
|
|
1297
|
+
* @param subformPath - Path to check
|
|
1298
|
+
* @returns True if subform exists, false otherwise
|
|
1299
|
+
* @param {string} subform_path
|
|
1300
|
+
* @returns {boolean}
|
|
1301
|
+
*/
|
|
1302
|
+
hasSubform(subform_path) {
|
|
1303
|
+
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1304
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1305
|
+
const ret = wasm.jsonevalwasm_hasSubform(this.__wbg_ptr, ptr0, len0);
|
|
1306
|
+
return ret !== 0;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Evaluate a subform with data
|
|
1310
|
+
*
|
|
1311
|
+
* @param subformPath - Path to the subform (e.g., "#/riders")
|
|
1312
|
+
* @param data - JSON data string for the subform
|
|
1187
1313
|
* @param context - Optional context data JSON string
|
|
1188
|
-
* @
|
|
1189
|
-
* @param {string}
|
|
1314
|
+
* @throws Error if evaluation fails
|
|
1315
|
+
* @param {string} subform_path
|
|
1316
|
+
* @param {string} data
|
|
1190
1317
|
* @param {string | null} [context]
|
|
1191
|
-
* @param {string | null} [data]
|
|
1192
1318
|
*/
|
|
1193
|
-
|
|
1319
|
+
evaluateSubform(subform_path, data, context) {
|
|
1194
1320
|
try {
|
|
1195
1321
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1196
|
-
const ptr0 = passStringToWasm0(
|
|
1322
|
+
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1197
1323
|
const len0 = WASM_VECTOR_LEN;
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
var ptr2 = isLikeNone(
|
|
1324
|
+
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1325
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1326
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1201
1327
|
var len2 = WASM_VECTOR_LEN;
|
|
1202
|
-
wasm.
|
|
1328
|
+
wasm.jsonevalwasm_evaluateSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1203
1329
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1204
1330
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1205
1331
|
if (r1) {
|
|
@@ -1210,78 +1336,72 @@ class JSONEvalWasm {
|
|
|
1210
1336
|
}
|
|
1211
1337
|
}
|
|
1212
1338
|
/**
|
|
1213
|
-
*
|
|
1339
|
+
* Validate subform data against its schema rules
|
|
1214
1340
|
*
|
|
1215
|
-
* @
|
|
1216
|
-
* @
|
|
1341
|
+
* @param subformPath - Path to the subform
|
|
1342
|
+
* @param data - JSON data string for the subform
|
|
1343
|
+
* @param context - Optional context data JSON string
|
|
1344
|
+
* @returns ValidationResult
|
|
1345
|
+
* @param {string} subform_path
|
|
1346
|
+
* @param {string} data
|
|
1347
|
+
* @param {string | null} [context]
|
|
1348
|
+
* @returns {ValidationResult}
|
|
1217
1349
|
*/
|
|
1218
|
-
|
|
1350
|
+
validateSubform(subform_path, data, context) {
|
|
1219
1351
|
try {
|
|
1220
1352
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1221
|
-
wasm.
|
|
1353
|
+
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1354
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1355
|
+
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1356
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1357
|
+
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1358
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1359
|
+
wasm.jsonevalwasm_validateSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1222
1360
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1223
1361
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1224
1362
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1225
1363
|
if (r2) {
|
|
1226
1364
|
throw takeObject(r1);
|
|
1227
1365
|
}
|
|
1228
|
-
return
|
|
1366
|
+
return ValidationResult.__wrap(r0);
|
|
1229
1367
|
} finally {
|
|
1230
1368
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* Clear the evaluation cache
|
|
1235
|
-
*/
|
|
1236
|
-
clearCache() {
|
|
1237
|
-
wasm.jsonevalwasm_clearCache(this.__wbg_ptr);
|
|
1238
|
-
}
|
|
1239
|
-
/**
|
|
1240
|
-
* Get the number of cached entries
|
|
1241
|
-
*
|
|
1242
|
-
* @returns Number of cached entries
|
|
1243
|
-
* @returns {number}
|
|
1244
|
-
*/
|
|
1245
|
-
cacheLen() {
|
|
1246
|
-
const ret = wasm.jsonevalwasm_cacheLen(this.__wbg_ptr);
|
|
1247
|
-
return ret >>> 0;
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Enable evaluation caching
|
|
1251
|
-
* Useful for reusing JSONEval instances with different data
|
|
1252
|
-
*/
|
|
1253
|
-
enableCache() {
|
|
1254
|
-
wasm.jsonevalwasm_enableCache(this.__wbg_ptr);
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Disable evaluation caching
|
|
1258
|
-
* Useful for web API usage where each request creates a new JSONEval instance
|
|
1259
|
-
* Improves performance by skipping cache operations that have no benefit for single-use instances
|
|
1260
|
-
*/
|
|
1261
|
-
disableCache() {
|
|
1262
|
-
wasm.jsonevalwasm_disableCache(this.__wbg_ptr);
|
|
1369
|
+
}
|
|
1263
1370
|
}
|
|
1264
1371
|
/**
|
|
1265
|
-
*
|
|
1372
|
+
* Get list of available subform paths
|
|
1266
1373
|
*
|
|
1267
|
-
* @returns
|
|
1268
|
-
* @returns {
|
|
1374
|
+
* @returns Array of subform paths
|
|
1375
|
+
* @returns {string[]}
|
|
1269
1376
|
*/
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1377
|
+
getSubformPaths() {
|
|
1378
|
+
try {
|
|
1379
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1380
|
+
wasm.jsonevalwasm_getSubformPaths(retptr, this.__wbg_ptr);
|
|
1381
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1382
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1383
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1384
|
+
wasm.__wbindgen_export_2(r0, r1 * 4, 4);
|
|
1385
|
+
return v1;
|
|
1386
|
+
} finally {
|
|
1387
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1388
|
+
}
|
|
1273
1389
|
}
|
|
1274
1390
|
/**
|
|
1275
|
-
* Resolve layout
|
|
1391
|
+
* Resolve layout for subform
|
|
1276
1392
|
*
|
|
1393
|
+
* @param subformPath - Path to the subform
|
|
1277
1394
|
* @param evaluate - If true, runs evaluation before resolving layout
|
|
1278
1395
|
* @throws Error if resolve fails
|
|
1396
|
+
* @param {string} subform_path
|
|
1279
1397
|
* @param {boolean} evaluate
|
|
1280
1398
|
*/
|
|
1281
|
-
|
|
1399
|
+
resolveLayoutSubform(subform_path, evaluate) {
|
|
1282
1400
|
try {
|
|
1283
1401
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1284
|
-
|
|
1402
|
+
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1403
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1404
|
+
wasm.jsonevalwasm_resolveLayoutSubform(retptr, this.__wbg_ptr, ptr0, len0, evaluate);
|
|
1285
1405
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1286
1406
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1287
1407
|
if (r1) {
|
|
@@ -1292,64 +1412,55 @@ class JSONEvalWasm {
|
|
|
1292
1412
|
}
|
|
1293
1413
|
}
|
|
1294
1414
|
/**
|
|
1295
|
-
*
|
|
1415
|
+
* Get schema value from subform (all .value fields)
|
|
1296
1416
|
*
|
|
1297
|
-
* @param subformPath - Path to the subform
|
|
1298
|
-
* @
|
|
1299
|
-
* @param context - Optional context data JSON string
|
|
1300
|
-
* @throws Error if evaluation fails
|
|
1417
|
+
* @param subformPath - Path to the subform
|
|
1418
|
+
* @returns Modified data as JavaScript object
|
|
1301
1419
|
* @param {string} subform_path
|
|
1302
|
-
* @
|
|
1303
|
-
* @param {string | null} [context]
|
|
1420
|
+
* @returns {any}
|
|
1304
1421
|
*/
|
|
1305
|
-
|
|
1422
|
+
getSchemaValueSubform(subform_path) {
|
|
1306
1423
|
try {
|
|
1307
1424
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1308
1425
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1309
1426
|
const len0 = WASM_VECTOR_LEN;
|
|
1310
|
-
|
|
1311
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1312
|
-
var ptr2 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1313
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1314
|
-
wasm.jsonevalwasm_evaluateSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1427
|
+
wasm.jsonevalwasm_getSchemaValueSubform(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1315
1428
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1316
1429
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1317
|
-
|
|
1318
|
-
|
|
1430
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1431
|
+
if (r2) {
|
|
1432
|
+
throw takeObject(r1);
|
|
1319
1433
|
}
|
|
1434
|
+
return takeObject(r0);
|
|
1320
1435
|
} finally {
|
|
1321
1436
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1322
1437
|
}
|
|
1323
1438
|
}
|
|
1324
1439
|
/**
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1440
|
+
* Get schema by specific path from subform (returns JSON string)
|
|
1327
1441
|
* @param subformPath - Path to the subform
|
|
1328
|
-
* @param
|
|
1329
|
-
* @
|
|
1330
|
-
* @returns ValidationResult
|
|
1442
|
+
* @param schemaPath - Path within the subform
|
|
1443
|
+
* @returns Value as JSON string or null if not found
|
|
1331
1444
|
* @param {string} subform_path
|
|
1332
|
-
* @param {string}
|
|
1333
|
-
* @
|
|
1334
|
-
* @returns {ValidationResult}
|
|
1445
|
+
* @param {string} schema_path
|
|
1446
|
+
* @returns {string | undefined}
|
|
1335
1447
|
*/
|
|
1336
|
-
|
|
1448
|
+
getSchemaByPathSubform(subform_path, schema_path) {
|
|
1337
1449
|
try {
|
|
1338
1450
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1339
1451
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1340
1452
|
const len0 = WASM_VECTOR_LEN;
|
|
1341
|
-
const ptr1 = passStringToWasm0(
|
|
1453
|
+
const ptr1 = passStringToWasm0(schema_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1342
1454
|
const len1 = WASM_VECTOR_LEN;
|
|
1343
|
-
|
|
1344
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1345
|
-
wasm.jsonevalwasm_validateSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1455
|
+
wasm.jsonevalwasm_getSchemaByPathSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1346
1456
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1347
1457
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1348
|
-
|
|
1349
|
-
if (
|
|
1350
|
-
|
|
1458
|
+
let v3;
|
|
1459
|
+
if (r0 !== 0) {
|
|
1460
|
+
v3 = getStringFromWasm0(r0, r1).slice();
|
|
1461
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1351
1462
|
}
|
|
1352
|
-
return
|
|
1463
|
+
return v3;
|
|
1353
1464
|
} finally {
|
|
1354
1465
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1355
1466
|
}
|
|
@@ -1401,64 +1512,42 @@ class JSONEvalWasm {
|
|
|
1401
1512
|
}
|
|
1402
1513
|
}
|
|
1403
1514
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1515
|
+
* Get schema by multiple paths from subform
|
|
1406
1516
|
* @param subformPath - Path to the subform
|
|
1407
|
-
* @param
|
|
1408
|
-
* @param
|
|
1409
|
-
* @
|
|
1410
|
-
* @returns Array of dependent change objects as JavaScript object
|
|
1517
|
+
* @param pathsJson - JSON array of dotted paths
|
|
1518
|
+
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1519
|
+
* @returns Data in specified format as JSON string
|
|
1411
1520
|
* @param {string} subform_path
|
|
1412
|
-
* @param {string}
|
|
1413
|
-
* @param {
|
|
1414
|
-
* @
|
|
1415
|
-
* @returns {any}
|
|
1521
|
+
* @param {string} paths_json
|
|
1522
|
+
* @param {number} format
|
|
1523
|
+
* @returns {string}
|
|
1416
1524
|
*/
|
|
1417
|
-
|
|
1525
|
+
getSchemaByPathsSubform(subform_path, paths_json, format) {
|
|
1526
|
+
let deferred4_0;
|
|
1527
|
+
let deferred4_1;
|
|
1418
1528
|
try {
|
|
1419
1529
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1420
1530
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1421
1531
|
const len0 = WASM_VECTOR_LEN;
|
|
1422
|
-
const ptr1 = passStringToWasm0(
|
|
1532
|
+
const ptr1 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1423
1533
|
const len1 = WASM_VECTOR_LEN;
|
|
1424
|
-
|
|
1425
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1426
|
-
var ptr3 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1427
|
-
var len3 = WASM_VECTOR_LEN;
|
|
1428
|
-
wasm.jsonevalwasm_evaluateDependentsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1534
|
+
wasm.jsonevalwasm_getSchemaByPathsSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, format);
|
|
1429
1535
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1430
1536
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1431
1537
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
/**
|
|
1441
|
-
* Resolve layout for subform
|
|
1442
|
-
*
|
|
1443
|
-
* @param subformPath - Path to the subform
|
|
1444
|
-
* @param evaluate - If true, runs evaluation before resolving layout
|
|
1445
|
-
* @throws Error if resolve fails
|
|
1446
|
-
* @param {string} subform_path
|
|
1447
|
-
* @param {boolean} evaluate
|
|
1448
|
-
*/
|
|
1449
|
-
resolveLayoutSubform(subform_path, evaluate) {
|
|
1450
|
-
try {
|
|
1451
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1452
|
-
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1453
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1454
|
-
wasm.jsonevalwasm_resolveLayoutSubform(retptr, this.__wbg_ptr, ptr0, len0, evaluate);
|
|
1455
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1456
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1457
|
-
if (r1) {
|
|
1458
|
-
throw takeObject(r0);
|
|
1538
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1539
|
+
var ptr3 = r0;
|
|
1540
|
+
var len3 = r1;
|
|
1541
|
+
if (r3) {
|
|
1542
|
+
ptr3 = 0; len3 = 0;
|
|
1543
|
+
throw takeObject(r2);
|
|
1459
1544
|
}
|
|
1545
|
+
deferred4_0 = ptr3;
|
|
1546
|
+
deferred4_1 = len3;
|
|
1547
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1460
1548
|
} finally {
|
|
1461
1549
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1550
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
1462
1551
|
}
|
|
1463
1552
|
}
|
|
1464
1553
|
/**
|
|
@@ -1490,21 +1579,22 @@ class JSONEvalWasm {
|
|
|
1490
1579
|
}
|
|
1491
1580
|
}
|
|
1492
1581
|
/**
|
|
1493
|
-
* Get
|
|
1494
|
-
*
|
|
1582
|
+
* Get schema by specific path from subform (returns JS object)
|
|
1495
1583
|
* @param subformPath - Path to the subform
|
|
1496
|
-
* @param
|
|
1497
|
-
* @returns
|
|
1584
|
+
* @param schemaPath - Path within the subform
|
|
1585
|
+
* @returns Value as JavaScript object or null if not found
|
|
1498
1586
|
* @param {string} subform_path
|
|
1499
|
-
* @param {
|
|
1587
|
+
* @param {string} schema_path
|
|
1500
1588
|
* @returns {any}
|
|
1501
1589
|
*/
|
|
1502
|
-
|
|
1590
|
+
getSchemaByPathSubformJS(subform_path, schema_path) {
|
|
1503
1591
|
try {
|
|
1504
1592
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1505
1593
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1506
1594
|
const len0 = WASM_VECTOR_LEN;
|
|
1507
|
-
|
|
1595
|
+
const ptr1 = passStringToWasm0(schema_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1596
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1597
|
+
wasm.jsonevalwasm_getSchemaByPathSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1508
1598
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1509
1599
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1510
1600
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1517,19 +1607,31 @@ class JSONEvalWasm {
|
|
|
1517
1607
|
}
|
|
1518
1608
|
}
|
|
1519
1609
|
/**
|
|
1520
|
-
*
|
|
1610
|
+
* Evaluate dependents in subform and return as JavaScript object
|
|
1521
1611
|
*
|
|
1522
1612
|
* @param subformPath - Path to the subform
|
|
1523
|
-
* @
|
|
1613
|
+
* @param changedPath - Path of the field that changed
|
|
1614
|
+
* @param data - Optional updated JSON data string
|
|
1615
|
+
* @param context - Optional context data JSON string
|
|
1616
|
+
* @returns Array of dependent change objects as JavaScript object
|
|
1524
1617
|
* @param {string} subform_path
|
|
1618
|
+
* @param {string} changed_path
|
|
1619
|
+
* @param {string | null} [data]
|
|
1620
|
+
* @param {string | null} [context]
|
|
1525
1621
|
* @returns {any}
|
|
1526
1622
|
*/
|
|
1527
|
-
|
|
1623
|
+
evaluateDependentsSubformJS(subform_path, changed_path, data, context) {
|
|
1528
1624
|
try {
|
|
1529
1625
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1530
1626
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1531
1627
|
const len0 = WASM_VECTOR_LEN;
|
|
1532
|
-
|
|
1628
|
+
const ptr1 = passStringToWasm0(changed_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1629
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1630
|
+
var ptr2 = isLikeNone(data) ? 0 : passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1631
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1632
|
+
var ptr3 = isLikeNone(context) ? 0 : passStringToWasm0(context, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1633
|
+
var len3 = WASM_VECTOR_LEN;
|
|
1634
|
+
wasm.jsonevalwasm_evaluateDependentsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1533
1635
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1534
1636
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1535
1637
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1542,35 +1644,37 @@ class JSONEvalWasm {
|
|
|
1542
1644
|
}
|
|
1543
1645
|
}
|
|
1544
1646
|
/**
|
|
1545
|
-
* Get
|
|
1546
|
-
*
|
|
1647
|
+
* Get schema by multiple paths from subform (JS object)
|
|
1547
1648
|
* @param subformPath - Path to the subform
|
|
1548
|
-
* @param
|
|
1549
|
-
* @
|
|
1649
|
+
* @param pathsJson - JSON array of dotted paths
|
|
1650
|
+
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1651
|
+
* @returns Data in specified format as JavaScript object
|
|
1550
1652
|
* @param {string} subform_path
|
|
1551
|
-
* @param {
|
|
1552
|
-
* @
|
|
1653
|
+
* @param {string} paths_json
|
|
1654
|
+
* @param {number} format
|
|
1655
|
+
* @returns {any}
|
|
1553
1656
|
*/
|
|
1554
|
-
|
|
1555
|
-
let deferred2_0;
|
|
1556
|
-
let deferred2_1;
|
|
1657
|
+
getSchemaByPathsSubformJS(subform_path, paths_json, format) {
|
|
1557
1658
|
try {
|
|
1558
1659
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1559
1660
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1560
1661
|
const len0 = WASM_VECTOR_LEN;
|
|
1561
|
-
|
|
1662
|
+
const ptr1 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1663
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1664
|
+
wasm.jsonevalwasm_getSchemaByPathsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, format);
|
|
1562
1665
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1563
1666
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1667
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1668
|
+
if (r2) {
|
|
1669
|
+
throw takeObject(r1);
|
|
1670
|
+
}
|
|
1671
|
+
return takeObject(r0);
|
|
1567
1672
|
} finally {
|
|
1568
1673
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1569
|
-
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
1570
1674
|
}
|
|
1571
1675
|
}
|
|
1572
1676
|
/**
|
|
1573
|
-
* Get evaluated schema
|
|
1677
|
+
* Get evaluated schema from subform as JavaScript object
|
|
1574
1678
|
*
|
|
1575
1679
|
* @param subformPath - Path to the subform
|
|
1576
1680
|
* @param resolveLayout - Whether to resolve layout
|
|
@@ -1579,12 +1683,12 @@ class JSONEvalWasm {
|
|
|
1579
1683
|
* @param {boolean} resolve_layout
|
|
1580
1684
|
* @returns {any}
|
|
1581
1685
|
*/
|
|
1582
|
-
|
|
1686
|
+
getEvaluatedSchemaSubformJS(subform_path, resolve_layout) {
|
|
1583
1687
|
try {
|
|
1584
1688
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1585
1689
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1586
1690
|
const len0 = WASM_VECTOR_LEN;
|
|
1587
|
-
wasm.
|
|
1691
|
+
wasm.jsonevalwasm_getEvaluatedSchemaSubformJS(retptr, this.__wbg_ptr, ptr0, len0, resolve_layout);
|
|
1588
1692
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1589
1693
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1590
1694
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1623,38 +1727,7 @@ class JSONEvalWasm {
|
|
|
1623
1727
|
v3 = getStringFromWasm0(r0, r1).slice();
|
|
1624
1728
|
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1625
1729
|
}
|
|
1626
|
-
return v3;
|
|
1627
|
-
} finally {
|
|
1628
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
/**
|
|
1632
|
-
* Get evaluated schema by specific path from subform as JavaScript object
|
|
1633
|
-
*
|
|
1634
|
-
* @param subformPath - Path to the subform
|
|
1635
|
-
* @param schemaPath - Dotted path to the value within the subform
|
|
1636
|
-
* @param skipLayout - Whether to skip layout resolution
|
|
1637
|
-
* @returns Value as JavaScript object or null if not found
|
|
1638
|
-
* @param {string} subform_path
|
|
1639
|
-
* @param {string} schema_path
|
|
1640
|
-
* @param {boolean} skip_layout
|
|
1641
|
-
* @returns {any}
|
|
1642
|
-
*/
|
|
1643
|
-
getEvaluatedSchemaByPathSubformJS(subform_path, schema_path, skip_layout) {
|
|
1644
|
-
try {
|
|
1645
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1646
|
-
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1647
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1648
|
-
const ptr1 = passStringToWasm0(schema_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1649
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1650
|
-
wasm.jsonevalwasm_getEvaluatedSchemaByPathSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, skip_layout);
|
|
1651
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1652
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1653
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1654
|
-
if (r2) {
|
|
1655
|
-
throw takeObject(r1);
|
|
1656
|
-
}
|
|
1657
|
-
return takeObject(r0);
|
|
1730
|
+
return v3;
|
|
1658
1731
|
} finally {
|
|
1659
1732
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1660
1733
|
}
|
|
@@ -1701,26 +1774,25 @@ class JSONEvalWasm {
|
|
|
1701
1774
|
}
|
|
1702
1775
|
}
|
|
1703
1776
|
/**
|
|
1704
|
-
* Get
|
|
1777
|
+
* Get evaluated schema by specific path from subform as JavaScript object
|
|
1778
|
+
*
|
|
1705
1779
|
* @param subformPath - Path to the subform
|
|
1706
|
-
* @param
|
|
1780
|
+
* @param schemaPath - Dotted path to the value within the subform
|
|
1707
1781
|
* @param skipLayout - Whether to skip layout resolution
|
|
1708
|
-
* @
|
|
1709
|
-
* @returns Data in specified format as JavaScript object
|
|
1782
|
+
* @returns Value as JavaScript object or null if not found
|
|
1710
1783
|
* @param {string} subform_path
|
|
1711
|
-
* @param {string}
|
|
1784
|
+
* @param {string} schema_path
|
|
1712
1785
|
* @param {boolean} skip_layout
|
|
1713
|
-
* @param {number} format
|
|
1714
1786
|
* @returns {any}
|
|
1715
1787
|
*/
|
|
1716
|
-
|
|
1788
|
+
getEvaluatedSchemaByPathSubformJS(subform_path, schema_path, skip_layout) {
|
|
1717
1789
|
try {
|
|
1718
1790
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1719
1791
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1720
1792
|
const len0 = WASM_VECTOR_LEN;
|
|
1721
|
-
const ptr1 = passStringToWasm0(
|
|
1793
|
+
const ptr1 = passStringToWasm0(schema_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1722
1794
|
const len1 = WASM_VECTOR_LEN;
|
|
1723
|
-
wasm.
|
|
1795
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPathSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, skip_layout);
|
|
1724
1796
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1725
1797
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1726
1798
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1733,51 +1805,26 @@ class JSONEvalWasm {
|
|
|
1733
1805
|
}
|
|
1734
1806
|
}
|
|
1735
1807
|
/**
|
|
1736
|
-
* Get schema
|
|
1737
|
-
* @param subformPath - Path to the subform
|
|
1738
|
-
* @param schemaPath - Path within the subform
|
|
1739
|
-
* @returns Value as JSON string or null if not found
|
|
1740
|
-
* @param {string} subform_path
|
|
1741
|
-
* @param {string} schema_path
|
|
1742
|
-
* @returns {string | undefined}
|
|
1743
|
-
*/
|
|
1744
|
-
getSchemaByPathSubform(subform_path, schema_path) {
|
|
1745
|
-
try {
|
|
1746
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1747
|
-
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1748
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1749
|
-
const ptr1 = passStringToWasm0(schema_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1750
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1751
|
-
wasm.jsonevalwasm_getSchemaByPathSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1752
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1753
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1754
|
-
let v3;
|
|
1755
|
-
if (r0 !== 0) {
|
|
1756
|
-
v3 = getStringFromWasm0(r0, r1).slice();
|
|
1757
|
-
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1758
|
-
}
|
|
1759
|
-
return v3;
|
|
1760
|
-
} finally {
|
|
1761
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
/**
|
|
1765
|
-
* Get schema by specific path from subform (returns JS object)
|
|
1808
|
+
* Get values from the evaluated schema of a subform using multiple dotted path notations (returns JS object)
|
|
1766
1809
|
* @param subformPath - Path to the subform
|
|
1767
|
-
* @param
|
|
1768
|
-
* @
|
|
1810
|
+
* @param pathsJson - JSON array of dotted paths
|
|
1811
|
+
* @param skipLayout - Whether to skip layout resolution
|
|
1812
|
+
* @param format - Return format (0=Nested, 1=Flat, 2=Array)
|
|
1813
|
+
* @returns Data in specified format as JavaScript object
|
|
1769
1814
|
* @param {string} subform_path
|
|
1770
|
-
* @param {string}
|
|
1815
|
+
* @param {string} paths_json
|
|
1816
|
+
* @param {boolean} skip_layout
|
|
1817
|
+
* @param {number} format
|
|
1771
1818
|
* @returns {any}
|
|
1772
1819
|
*/
|
|
1773
|
-
|
|
1820
|
+
getEvaluatedSchemaByPathsSubformJS(subform_path, paths_json, skip_layout, format) {
|
|
1774
1821
|
try {
|
|
1775
1822
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1776
1823
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1777
1824
|
const len0 = WASM_VECTOR_LEN;
|
|
1778
|
-
const ptr1 = passStringToWasm0(
|
|
1825
|
+
const ptr1 = passStringToWasm0(paths_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1779
1826
|
const len1 = WASM_VECTOR_LEN;
|
|
1780
|
-
wasm.
|
|
1827
|
+
wasm.jsonevalwasm_getEvaluatedSchemaByPathsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, skip_layout, format);
|
|
1781
1828
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1782
1829
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1783
1830
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1790,63 +1837,49 @@ class JSONEvalWasm {
|
|
|
1790
1837
|
}
|
|
1791
1838
|
}
|
|
1792
1839
|
/**
|
|
1793
|
-
* Get schema
|
|
1840
|
+
* Get evaluated schema without $params from subform
|
|
1841
|
+
*
|
|
1794
1842
|
* @param subformPath - Path to the subform
|
|
1795
|
-
* @param
|
|
1796
|
-
* @
|
|
1797
|
-
* @returns Data in specified format as JSON string
|
|
1843
|
+
* @param resolveLayout - Whether to resolve layout
|
|
1844
|
+
* @returns Evaluated schema as JSON string
|
|
1798
1845
|
* @param {string} subform_path
|
|
1799
|
-
* @param {
|
|
1800
|
-
* @param {number} format
|
|
1846
|
+
* @param {boolean} resolve_layout
|
|
1801
1847
|
* @returns {string}
|
|
1802
1848
|
*/
|
|
1803
|
-
|
|
1804
|
-
let
|
|
1805
|
-
let
|
|
1849
|
+
getEvaluatedSchemaWithoutParamsSubform(subform_path, resolve_layout) {
|
|
1850
|
+
let deferred2_0;
|
|
1851
|
+
let deferred2_1;
|
|
1806
1852
|
try {
|
|
1807
1853
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1808
1854
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1809
1855
|
const len0 = WASM_VECTOR_LEN;
|
|
1810
|
-
|
|
1811
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1812
|
-
wasm.jsonevalwasm_getSchemaByPathsSubform(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, format);
|
|
1856
|
+
wasm.jsonevalwasm_getEvaluatedSchemaWithoutParamsSubform(retptr, this.__wbg_ptr, ptr0, len0, resolve_layout);
|
|
1813
1857
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1814
1858
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
var len3 = r1;
|
|
1819
|
-
if (r3) {
|
|
1820
|
-
ptr3 = 0; len3 = 0;
|
|
1821
|
-
throw takeObject(r2);
|
|
1822
|
-
}
|
|
1823
|
-
deferred4_0 = ptr3;
|
|
1824
|
-
deferred4_1 = len3;
|
|
1825
|
-
return getStringFromWasm0(ptr3, len3);
|
|
1859
|
+
deferred2_0 = r0;
|
|
1860
|
+
deferred2_1 = r1;
|
|
1861
|
+
return getStringFromWasm0(r0, r1);
|
|
1826
1862
|
} finally {
|
|
1827
1863
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1828
|
-
wasm.__wbindgen_export_2(
|
|
1864
|
+
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
1829
1865
|
}
|
|
1830
1866
|
}
|
|
1831
1867
|
/**
|
|
1832
|
-
* Get schema
|
|
1868
|
+
* Get evaluated schema without $params from subform as JavaScript object
|
|
1869
|
+
*
|
|
1833
1870
|
* @param subformPath - Path to the subform
|
|
1834
|
-
* @param
|
|
1835
|
-
* @
|
|
1836
|
-
* @returns Data in specified format as JavaScript object
|
|
1871
|
+
* @param resolveLayout - Whether to resolve layout
|
|
1872
|
+
* @returns Evaluated schema as JavaScript object
|
|
1837
1873
|
* @param {string} subform_path
|
|
1838
|
-
* @param {
|
|
1839
|
-
* @param {number} format
|
|
1874
|
+
* @param {boolean} resolve_layout
|
|
1840
1875
|
* @returns {any}
|
|
1841
1876
|
*/
|
|
1842
|
-
|
|
1877
|
+
getEvaluatedSchemaWithoutParamsSubformJS(subform_path, resolve_layout) {
|
|
1843
1878
|
try {
|
|
1844
1879
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1845
1880
|
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1846
1881
|
const len0 = WASM_VECTOR_LEN;
|
|
1847
|
-
|
|
1848
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1849
|
-
wasm.jsonevalwasm_getSchemaByPathsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, format);
|
|
1882
|
+
wasm.jsonevalwasm_getEvaluatedSchemaWithoutParamsSubformJS(retptr, this.__wbg_ptr, ptr0, len0, resolve_layout);
|
|
1850
1883
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1851
1884
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1852
1885
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1858,39 +1891,6 @@ class JSONEvalWasm {
|
|
|
1858
1891
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1859
1892
|
}
|
|
1860
1893
|
}
|
|
1861
|
-
/**
|
|
1862
|
-
* Get list of available subform paths
|
|
1863
|
-
*
|
|
1864
|
-
* @returns Array of subform paths
|
|
1865
|
-
* @returns {string[]}
|
|
1866
|
-
*/
|
|
1867
|
-
getSubformPaths() {
|
|
1868
|
-
try {
|
|
1869
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1870
|
-
wasm.jsonevalwasm_getSubformPaths(retptr, this.__wbg_ptr);
|
|
1871
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1872
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1873
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1874
|
-
wasm.__wbindgen_export_2(r0, r1 * 4, 4);
|
|
1875
|
-
return v1;
|
|
1876
|
-
} finally {
|
|
1877
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
/**
|
|
1881
|
-
* Check if a subform exists at the given path
|
|
1882
|
-
*
|
|
1883
|
-
* @param subformPath - Path to check
|
|
1884
|
-
* @returns True if subform exists, false otherwise
|
|
1885
|
-
* @param {string} subform_path
|
|
1886
|
-
* @returns {boolean}
|
|
1887
|
-
*/
|
|
1888
|
-
hasSubform(subform_path) {
|
|
1889
|
-
const ptr0 = passStringToWasm0(subform_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1890
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1891
|
-
const ret = wasm.jsonevalwasm_hasSubform(this.__wbg_ptr, ptr0, len0);
|
|
1892
|
-
return ret !== 0;
|
|
1893
|
-
}
|
|
1894
1894
|
}
|
|
1895
1895
|
if (Symbol.dispose) JSONEvalWasm.prototype[Symbol.dispose] = JSONEvalWasm.prototype.free;
|
|
1896
1896
|
|
|
@@ -1924,52 +1924,59 @@ class ValidationError {
|
|
|
1924
1924
|
wasm.__wbg_validationerror_free(ptr, 0);
|
|
1925
1925
|
}
|
|
1926
1926
|
/**
|
|
1927
|
-
* @returns {string}
|
|
1927
|
+
* @returns {string | undefined}
|
|
1928
1928
|
*/
|
|
1929
|
-
get
|
|
1930
|
-
let deferred1_0;
|
|
1931
|
-
let deferred1_1;
|
|
1929
|
+
get field_value() {
|
|
1932
1930
|
try {
|
|
1933
1931
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1934
|
-
wasm.
|
|
1932
|
+
wasm.validationerror_field_value(retptr, this.__wbg_ptr);
|
|
1935
1933
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1936
1934
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1935
|
+
let v1;
|
|
1936
|
+
if (r0 !== 0) {
|
|
1937
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1938
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1939
|
+
}
|
|
1940
|
+
return v1;
|
|
1940
1941
|
} finally {
|
|
1941
1942
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1942
|
-
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
1945
|
/**
|
|
1946
|
-
* @returns {string}
|
|
1946
|
+
* @returns {string | undefined}
|
|
1947
1947
|
*/
|
|
1948
|
-
get
|
|
1949
|
-
let deferred1_0;
|
|
1950
|
-
let deferred1_1;
|
|
1948
|
+
get code() {
|
|
1951
1949
|
try {
|
|
1952
1950
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1953
|
-
wasm.
|
|
1951
|
+
wasm.validationerror_code(retptr, this.__wbg_ptr);
|
|
1954
1952
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1955
1953
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1954
|
+
let v1;
|
|
1955
|
+
if (r0 !== 0) {
|
|
1956
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1957
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1958
|
+
}
|
|
1959
|
+
return v1;
|
|
1959
1960
|
} finally {
|
|
1960
1961
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1961
|
-
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1962
1962
|
}
|
|
1963
1963
|
}
|
|
1964
|
+
/**
|
|
1965
|
+
* @returns {any}
|
|
1966
|
+
*/
|
|
1967
|
+
get data() {
|
|
1968
|
+
const ret = wasm.validationerror_data(this.__wbg_ptr);
|
|
1969
|
+
return takeObject(ret);
|
|
1970
|
+
}
|
|
1964
1971
|
/**
|
|
1965
1972
|
* @returns {string}
|
|
1966
1973
|
*/
|
|
1967
|
-
get
|
|
1974
|
+
get path() {
|
|
1968
1975
|
let deferred1_0;
|
|
1969
1976
|
let deferred1_1;
|
|
1970
1977
|
try {
|
|
1971
1978
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1972
|
-
wasm.
|
|
1979
|
+
wasm.validationerror_path(retptr, this.__wbg_ptr);
|
|
1973
1980
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1974
1981
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1975
1982
|
deferred1_0 = r0;
|
|
@@ -1981,22 +1988,22 @@ class ValidationError {
|
|
|
1981
1988
|
}
|
|
1982
1989
|
}
|
|
1983
1990
|
/**
|
|
1984
|
-
* @returns {string
|
|
1991
|
+
* @returns {string}
|
|
1985
1992
|
*/
|
|
1986
|
-
get
|
|
1993
|
+
get message() {
|
|
1994
|
+
let deferred1_0;
|
|
1995
|
+
let deferred1_1;
|
|
1987
1996
|
try {
|
|
1988
1997
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1989
|
-
wasm.
|
|
1998
|
+
wasm.validationerror_message(retptr, this.__wbg_ptr);
|
|
1990
1999
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1991
2000
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
1996
|
-
}
|
|
1997
|
-
return v1;
|
|
2001
|
+
deferred1_0 = r0;
|
|
2002
|
+
deferred1_1 = r1;
|
|
2003
|
+
return getStringFromWasm0(r0, r1);
|
|
1998
2004
|
} finally {
|
|
1999
2005
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2006
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2000
2007
|
}
|
|
2001
2008
|
}
|
|
2002
2009
|
/**
|
|
@@ -2019,31 +2026,24 @@ class ValidationError {
|
|
|
2019
2026
|
}
|
|
2020
2027
|
}
|
|
2021
2028
|
/**
|
|
2022
|
-
* @returns {string
|
|
2029
|
+
* @returns {string}
|
|
2023
2030
|
*/
|
|
2024
|
-
get
|
|
2031
|
+
get rule_type() {
|
|
2032
|
+
let deferred1_0;
|
|
2033
|
+
let deferred1_1;
|
|
2025
2034
|
try {
|
|
2026
2035
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2027
|
-
wasm.
|
|
2036
|
+
wasm.validationerror_rule_type(retptr, this.__wbg_ptr);
|
|
2028
2037
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2029
2038
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
2034
|
-
}
|
|
2035
|
-
return v1;
|
|
2039
|
+
deferred1_0 = r0;
|
|
2040
|
+
deferred1_1 = r1;
|
|
2041
|
+
return getStringFromWasm0(r0, r1);
|
|
2036
2042
|
} finally {
|
|
2037
2043
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2044
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
2038
2045
|
}
|
|
2039
2046
|
}
|
|
2040
|
-
/**
|
|
2041
|
-
* @returns {any}
|
|
2042
|
-
*/
|
|
2043
|
-
get data() {
|
|
2044
|
-
const ret = wasm.validationerror_data(this.__wbg_ptr);
|
|
2045
|
-
return takeObject(ret);
|
|
2046
|
-
}
|
|
2047
2047
|
}
|
|
2048
2048
|
if (Symbol.dispose) ValidationError.prototype[Symbol.dispose] = ValidationError.prototype.free;
|
|
2049
2049
|
|
|
@@ -2076,13 +2076,6 @@ class ValidationResult {
|
|
|
2076
2076
|
const ptr = this.__destroy_into_raw();
|
|
2077
2077
|
wasm.__wbg_validationresult_free(ptr, 0);
|
|
2078
2078
|
}
|
|
2079
|
-
/**
|
|
2080
|
-
* @returns {boolean}
|
|
2081
|
-
*/
|
|
2082
|
-
get has_error() {
|
|
2083
|
-
const ret = wasm.validationresult_has_error(this.__wbg_ptr);
|
|
2084
|
-
return ret !== 0;
|
|
2085
|
-
}
|
|
2086
2079
|
/**
|
|
2087
2080
|
* @returns {ValidationError[]}
|
|
2088
2081
|
*/
|
|
@@ -2117,6 +2110,13 @@ class ValidationResult {
|
|
|
2117
2110
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2118
2111
|
}
|
|
2119
2112
|
}
|
|
2113
|
+
/**
|
|
2114
|
+
* @returns {boolean}
|
|
2115
|
+
*/
|
|
2116
|
+
get has_error() {
|
|
2117
|
+
const ret = wasm.validationresult_has_error(this.__wbg_ptr);
|
|
2118
|
+
return ret !== 0;
|
|
2119
|
+
}
|
|
2120
2120
|
}
|
|
2121
2121
|
if (Symbol.dispose) ValidationResult.prototype[Symbol.dispose] = ValidationResult.prototype.free;
|
|
2122
2122
|
|
|
@@ -2156,7 +2156,7 @@ exports.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
|
|
|
2156
2156
|
return ret;
|
|
2157
2157
|
};
|
|
2158
2158
|
|
|
2159
|
-
exports.
|
|
2159
|
+
exports.__wbg_log_ec39d4fa397181b8 = function(arg0, arg1) {
|
|
2160
2160
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
2161
2161
|
};
|
|
2162
2162
|
|