@json-eval-rs/webcore 0.0.78 → 0.0.80
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 +2 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -535,7 +535,8 @@ export declare class JSONEvalCore {
|
|
|
535
535
|
*/
|
|
536
536
|
evaluateSubform({ subformPath, data, context, paths, }: EvaluateSubformOptions): Promise<void>;
|
|
537
537
|
/**
|
|
538
|
-
* Validate subform data against its schema rules
|
|
538
|
+
* Validate subform data against its schema rules (returns parsed JavaScript object)
|
|
539
|
+
* Uses validateSubformJS for Worker-safe serialization
|
|
539
540
|
*/
|
|
540
541
|
validateSubform({ subformPath, data, context, }: ValidateSubformOptions): Promise<ValidationResult>;
|
|
541
542
|
/**
|
package/dist/index.js
CHANGED
|
@@ -474,11 +474,17 @@ export class JSONEvalCore {
|
|
|
474
474
|
return this._instance.evaluateSubform(subformPath, typeof data === "string" ? data : JSONStringify(data), context ? typeof context === "string" ? context : JSONStringify(context) : null, paths || null);
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
|
-
* Validate subform data against its schema rules
|
|
477
|
+
* Validate subform data against its schema rules (returns parsed JavaScript object)
|
|
478
|
+
* Uses validateSubformJS for Worker-safe serialization
|
|
478
479
|
*/
|
|
479
480
|
async validateSubform({ subformPath, data, context, }) {
|
|
480
481
|
await this.init();
|
|
481
|
-
|
|
482
|
+
try {
|
|
483
|
+
return this._instance.validateSubformJS(subformPath, typeof data === "string" ? data : JSONStringify(data), context ? typeof context === "string" ? context : JSONStringify(context) : null);
|
|
484
|
+
}
|
|
485
|
+
catch (error) {
|
|
486
|
+
throw new Error(`Subform validation failed: ${error.message || error}`);
|
|
487
|
+
}
|
|
482
488
|
}
|
|
483
489
|
/**
|
|
484
490
|
* Evaluate dependent fields in subform
|