@json-eval-rs/webcore 0.0.67 → 0.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +25 -0
- package/dist/index.js +48 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -400,10 +400,25 @@ export declare class JSONEvalCore {
|
|
|
400
400
|
* Evaluate schema with data (returns parsed JavaScript object)
|
|
401
401
|
*/
|
|
402
402
|
evaluate({ data, context, paths }: EvaluateOptions): Promise<any>;
|
|
403
|
+
/**
|
|
404
|
+
* Evaluate schema with data (only updates internal state, returns void)
|
|
405
|
+
* Maps to WASM evaluate()
|
|
406
|
+
*/
|
|
407
|
+
evaluateOnly({ data, context, paths }: EvaluateOptions): Promise<void>;
|
|
403
408
|
/**
|
|
404
409
|
* Evaluate dependent fields (returns parsed JavaScript object, processes transitively)
|
|
405
410
|
*/
|
|
406
411
|
evaluateDependents({ changedPaths, data, context, reEvaluate, }: EvaluateDependentsOptions): Promise<DependentChange[]>;
|
|
412
|
+
/**
|
|
413
|
+
* Evaluate dependents (returns JSON string)
|
|
414
|
+
* Maps to WASM evaluateDependents()
|
|
415
|
+
*/
|
|
416
|
+
evaluateDependentsString({ changedPath, data, context, reEvaluate, }: {
|
|
417
|
+
changedPath: string;
|
|
418
|
+
data?: any;
|
|
419
|
+
context?: any;
|
|
420
|
+
reEvaluate?: boolean;
|
|
421
|
+
}): Promise<string>;
|
|
407
422
|
/**
|
|
408
423
|
* Get evaluated schema
|
|
409
424
|
*/
|
|
@@ -513,6 +528,11 @@ export declare class JSONEvalCore {
|
|
|
513
528
|
* Validate data against schema rules with optional path filtering
|
|
514
529
|
*/
|
|
515
530
|
validatePaths({ data, context, paths, }: EvaluateOptions): Promise<ValidationResult>;
|
|
531
|
+
/**
|
|
532
|
+
* Validate data with path filtering (returns WASM ValidationResult object)
|
|
533
|
+
* Note: You must call .free() on the returned object when done.
|
|
534
|
+
*/
|
|
535
|
+
validatePathsOnly({ data, context, paths, }: EvaluateOptions): Promise<any>;
|
|
516
536
|
/**
|
|
517
537
|
* Cancel any running evaluation
|
|
518
538
|
*/
|
|
@@ -529,6 +549,11 @@ export declare class JSONEvalCore {
|
|
|
529
549
|
* Evaluate dependent fields in subform
|
|
530
550
|
*/
|
|
531
551
|
evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate, }: EvaluateDependentsSubformOptions): Promise<DependentChange[]>;
|
|
552
|
+
/**
|
|
553
|
+
* Evaluate dependent fields in subform (returns JSON string)
|
|
554
|
+
* Maps to WASM evaluateDependentsSubform()
|
|
555
|
+
*/
|
|
556
|
+
evaluateDependentsSubformString({ subformPath, changedPaths, data, context, }: EvaluateDependentsSubformOptions): Promise<string>;
|
|
532
557
|
/**
|
|
533
558
|
* Resolve layout for subform
|
|
534
559
|
*/
|
package/dist/index.js
CHANGED
|
@@ -176,6 +176,19 @@ export class JSONEvalCore {
|
|
|
176
176
|
throw new Error(`Evaluation failed: ${error.message || error}`);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Evaluate schema with data (only updates internal state, returns void)
|
|
181
|
+
* Maps to WASM evaluate()
|
|
182
|
+
*/
|
|
183
|
+
async evaluateOnly({ data, context, paths }) {
|
|
184
|
+
await this.init();
|
|
185
|
+
try {
|
|
186
|
+
this._instance.evaluate(typeof data === "string" ? data : JSONStringify(data), context ? typeof context === "string" ? context : JSONStringify(context) : null, paths || null);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
throw new Error(`Evaluation failed: ${error.message || error}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
179
192
|
/**
|
|
180
193
|
* Evaluate dependent fields (returns parsed JavaScript object, processes transitively)
|
|
181
194
|
*/
|
|
@@ -190,6 +203,19 @@ export class JSONEvalCore {
|
|
|
190
203
|
throw new Error(`Dependent evaluation failed: ${error.message || error}`);
|
|
191
204
|
}
|
|
192
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Evaluate dependents (returns JSON string)
|
|
208
|
+
* Maps to WASM evaluateDependents()
|
|
209
|
+
*/
|
|
210
|
+
async evaluateDependentsString({ changedPath, data, context, reEvaluate = true, }) {
|
|
211
|
+
await this.init();
|
|
212
|
+
try {
|
|
213
|
+
return this._instance.evaluateDependents(changedPath, data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate);
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
throw new Error(`Dependent evaluation failed: ${error.message || error}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
193
219
|
/**
|
|
194
220
|
* Get evaluated schema
|
|
195
221
|
*/
|
|
@@ -426,6 +452,19 @@ export class JSONEvalCore {
|
|
|
426
452
|
throw new Error(`Validation failed: ${error.message || error}`);
|
|
427
453
|
}
|
|
428
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* Validate data with path filtering (returns WASM ValidationResult object)
|
|
457
|
+
* Note: You must call .free() on the returned object when done.
|
|
458
|
+
*/
|
|
459
|
+
async validatePathsOnly({ data, context, paths, }) {
|
|
460
|
+
await this.init();
|
|
461
|
+
try {
|
|
462
|
+
return this._instance.validatePaths(typeof data === "string" ? data : JSONStringify(data), context ? typeof context === "string" ? context : JSONStringify(context) : null, paths || null);
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
throw new Error(`Validation failed: ${error.message || error}`);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
429
468
|
/**
|
|
430
469
|
* Cancel any running evaluation
|
|
431
470
|
*/
|
|
@@ -460,6 +499,15 @@ export class JSONEvalCore {
|
|
|
460
499
|
const paths = Array.isArray(changedPaths) ? changedPaths : [changedPaths];
|
|
461
500
|
return this._instance.evaluateDependentsSubformJS(subformPath, typeof paths === "string" ? paths : JSONStringify(paths), data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate);
|
|
462
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Evaluate dependent fields in subform (returns JSON string)
|
|
504
|
+
* Maps to WASM evaluateDependentsSubform()
|
|
505
|
+
*/
|
|
506
|
+
async evaluateDependentsSubformString({ subformPath, changedPaths, data, context, }) {
|
|
507
|
+
await this.init();
|
|
508
|
+
const paths = Array.isArray(changedPaths) ? changedPaths : [changedPaths];
|
|
509
|
+
return this._instance.evaluateDependentsSubform(subformPath, typeof paths === "string" ? paths : JSONStringify(paths), data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null);
|
|
510
|
+
}
|
|
463
511
|
/**
|
|
464
512
|
* Resolve layout for subform
|
|
465
513
|
*/
|