@json-eval-rs/webcore 0.0.74 → 0.0.76
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 +9 -39
- package/dist/index.js +8 -51
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -135,6 +135,8 @@ export interface EvaluateDependentsOptions {
|
|
|
135
135
|
context?: any;
|
|
136
136
|
/** If true, performs full evaluation after processing dependents */
|
|
137
137
|
reEvaluate?: boolean;
|
|
138
|
+
/** If true, also evaluates dependents in all registered subforms and appends their schema values (default: true) */
|
|
139
|
+
includeSubforms?: boolean;
|
|
138
140
|
}
|
|
139
141
|
/**
|
|
140
142
|
* Options for getting evaluated schema
|
|
@@ -190,17 +192,6 @@ export interface ReloadSchemaOptions {
|
|
|
190
192
|
/** Optional new data */
|
|
191
193
|
data?: any;
|
|
192
194
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Cache statistics
|
|
195
|
-
*/
|
|
196
|
-
export interface CacheStats {
|
|
197
|
-
/** Number of cache hits */
|
|
198
|
-
hits: number;
|
|
199
|
-
/** Number of cache misses */
|
|
200
|
-
misses: number;
|
|
201
|
-
/** Number of cached entries */
|
|
202
|
-
entries: number;
|
|
203
|
-
}
|
|
204
195
|
/**
|
|
205
196
|
* Options for evaluating a subform
|
|
206
197
|
*/
|
|
@@ -239,6 +230,8 @@ export interface EvaluateDependentsSubformOptions {
|
|
|
239
230
|
context?: any;
|
|
240
231
|
/** If true, performs full evaluation after processing dependents */
|
|
241
232
|
reEvaluate?: boolean;
|
|
233
|
+
/** If true, also evaluates dependents in sub-subforms and appends their schema values (default: true) */
|
|
234
|
+
includeSubforms?: boolean;
|
|
242
235
|
}
|
|
243
236
|
/**
|
|
244
237
|
* Options for resolving layout in a subform
|
|
@@ -426,16 +419,17 @@ export declare class JSONEvalCore {
|
|
|
426
419
|
/**
|
|
427
420
|
* Evaluate dependent fields (returns parsed JavaScript object, processes transitively)
|
|
428
421
|
*/
|
|
429
|
-
evaluateDependents({ changedPaths, data, context, reEvaluate, }: EvaluateDependentsOptions): Promise<DependentChange[]>;
|
|
422
|
+
evaluateDependents({ changedPaths, data, context, reEvaluate, includeSubforms, }: EvaluateDependentsOptions): Promise<DependentChange[]>;
|
|
430
423
|
/**
|
|
431
424
|
* Evaluate dependents (returns JSON string)
|
|
432
425
|
* Maps to WASM evaluateDependents()
|
|
433
426
|
*/
|
|
434
|
-
evaluateDependentsString({ changedPath, data, context, reEvaluate, }: {
|
|
427
|
+
evaluateDependentsString({ changedPath, data, context, reEvaluate, includeSubforms, }: {
|
|
435
428
|
changedPath: string;
|
|
436
429
|
data?: any;
|
|
437
430
|
context?: any;
|
|
438
431
|
reEvaluate?: boolean;
|
|
432
|
+
includeSubforms?: boolean;
|
|
439
433
|
}): Promise<string>;
|
|
440
434
|
/**
|
|
441
435
|
* Get evaluated schema
|
|
@@ -498,30 +492,6 @@ export declare class JSONEvalCore {
|
|
|
498
492
|
* Reload schema from ParsedSchemaCache using a cache key
|
|
499
493
|
*/
|
|
500
494
|
reloadSchemaFromCache(cacheKey: string, context?: any, data?: any): Promise<void>;
|
|
501
|
-
/**
|
|
502
|
-
* Get cache statistics
|
|
503
|
-
*/
|
|
504
|
-
cacheStats(): Promise<CacheStats>;
|
|
505
|
-
/**
|
|
506
|
-
* Clear the evaluation cache
|
|
507
|
-
*/
|
|
508
|
-
clearCache(): Promise<void>;
|
|
509
|
-
/**
|
|
510
|
-
* Get the number of cached entries
|
|
511
|
-
*/
|
|
512
|
-
cacheLen(): Promise<number>;
|
|
513
|
-
/**
|
|
514
|
-
* Enable evaluation caching
|
|
515
|
-
*/
|
|
516
|
-
enableCache(): Promise<void>;
|
|
517
|
-
/**
|
|
518
|
-
* Disable evaluation caching
|
|
519
|
-
*/
|
|
520
|
-
disableCache(): Promise<void>;
|
|
521
|
-
/**
|
|
522
|
-
* Check if evaluation caching is enabled
|
|
523
|
-
*/
|
|
524
|
-
isCacheEnabled(): boolean;
|
|
525
495
|
/**
|
|
526
496
|
* Resolve layout with optional evaluation
|
|
527
497
|
*/
|
|
@@ -571,12 +541,12 @@ export declare class JSONEvalCore {
|
|
|
571
541
|
/**
|
|
572
542
|
* Evaluate dependent fields in subform
|
|
573
543
|
*/
|
|
574
|
-
evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate, }: EvaluateDependentsSubformOptions): Promise<DependentChange[]>;
|
|
544
|
+
evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate, includeSubforms, }: EvaluateDependentsSubformOptions): Promise<DependentChange[]>;
|
|
575
545
|
/**
|
|
576
546
|
* Evaluate dependent fields in subform (returns JSON string)
|
|
577
547
|
* Maps to WASM evaluateDependentsSubform()
|
|
578
548
|
*/
|
|
579
|
-
evaluateDependentsSubformString({ subformPath, changedPaths, data, context, }: EvaluateDependentsSubformOptions): Promise<string>;
|
|
549
|
+
evaluateDependentsSubformString({ subformPath, changedPaths, data, context, includeSubforms, }: EvaluateDependentsSubformOptions): Promise<string>;
|
|
580
550
|
/**
|
|
581
551
|
* Resolve layout for subform
|
|
582
552
|
*/
|
package/dist/index.js
CHANGED
|
@@ -218,12 +218,12 @@ export class JSONEvalCore {
|
|
|
218
218
|
/**
|
|
219
219
|
* Evaluate dependent fields (returns parsed JavaScript object, processes transitively)
|
|
220
220
|
*/
|
|
221
|
-
async evaluateDependents({ changedPaths, data, context, reEvaluate = true, }) {
|
|
221
|
+
async evaluateDependents({ changedPaths, data, context, reEvaluate = true, includeSubforms = true, }) {
|
|
222
222
|
await this.init();
|
|
223
223
|
try {
|
|
224
224
|
// Ensure paths is an array for WASM
|
|
225
225
|
const paths = Array.isArray(changedPaths) ? changedPaths : [changedPaths];
|
|
226
|
-
return this._instance.evaluateDependentsJS(typeof paths === "string" ? paths : JSONStringify(paths), data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate);
|
|
226
|
+
return this._instance.evaluateDependentsJS(typeof paths === "string" ? paths : JSONStringify(paths), data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate, includeSubforms);
|
|
227
227
|
}
|
|
228
228
|
catch (error) {
|
|
229
229
|
throw new Error(`Dependent evaluation failed: ${error.message || error}`);
|
|
@@ -233,10 +233,10 @@ export class JSONEvalCore {
|
|
|
233
233
|
* Evaluate dependents (returns JSON string)
|
|
234
234
|
* Maps to WASM evaluateDependents()
|
|
235
235
|
*/
|
|
236
|
-
async evaluateDependentsString({ changedPath, data, context, reEvaluate = true, }) {
|
|
236
|
+
async evaluateDependentsString({ changedPath, data, context, reEvaluate = true, includeSubforms = true, }) {
|
|
237
237
|
await this.init();
|
|
238
238
|
try {
|
|
239
|
-
return this._instance.evaluateDependents(changedPath, data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate);
|
|
239
|
+
return this._instance.evaluateDependents(changedPath, data ? typeof data === "string" ? data : JSONStringify(data) : null, context ? typeof context === "string" ? context : JSONStringify(context) : null, reEvaluate, includeSubforms);
|
|
240
240
|
}
|
|
241
241
|
catch (error) {
|
|
242
242
|
throw new Error(`Dependent evaluation failed: ${error.message || error}`);
|
|
@@ -384,49 +384,6 @@ export class JSONEvalCore {
|
|
|
384
384
|
throw new Error(`Failed to reload schema from cache: ${error.message || error}`);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Get cache statistics
|
|
389
|
-
*/
|
|
390
|
-
async cacheStats() {
|
|
391
|
-
await this.init();
|
|
392
|
-
return this._instance.cacheStats();
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Clear the evaluation cache
|
|
396
|
-
*/
|
|
397
|
-
async clearCache() {
|
|
398
|
-
await this.init();
|
|
399
|
-
this._instance.clearCache();
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Get the number of cached entries
|
|
403
|
-
*/
|
|
404
|
-
async cacheLen() {
|
|
405
|
-
await this.init();
|
|
406
|
-
return this._instance.cacheLen();
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Enable evaluation caching
|
|
410
|
-
*/
|
|
411
|
-
async enableCache() {
|
|
412
|
-
await this.init();
|
|
413
|
-
this._instance.enableCache();
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Disable evaluation caching
|
|
417
|
-
*/
|
|
418
|
-
async disableCache() {
|
|
419
|
-
await this.init();
|
|
420
|
-
this._instance.disableCache();
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Check if evaluation caching is enabled
|
|
424
|
-
*/
|
|
425
|
-
isCacheEnabled() {
|
|
426
|
-
if (!this._instance)
|
|
427
|
-
return true; // Default is enabled
|
|
428
|
-
return this._instance.isCacheEnabled();
|
|
429
|
-
}
|
|
430
387
|
/**
|
|
431
388
|
* Resolve layout with optional evaluation
|
|
432
389
|
*/
|
|
@@ -526,20 +483,20 @@ export class JSONEvalCore {
|
|
|
526
483
|
/**
|
|
527
484
|
* Evaluate dependent fields in subform
|
|
528
485
|
*/
|
|
529
|
-
async evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate = true, }) {
|
|
486
|
+
async evaluateDependentsSubform({ subformPath, changedPaths, data, context, reEvaluate = true, includeSubforms = true, }) {
|
|
530
487
|
await this.init();
|
|
531
488
|
// For backward compatibility, accept single changedPath too (though types say array)
|
|
532
489
|
const paths = Array.isArray(changedPaths) ? changedPaths : [changedPaths];
|
|
533
|
-
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);
|
|
490
|
+
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, includeSubforms);
|
|
534
491
|
}
|
|
535
492
|
/**
|
|
536
493
|
* Evaluate dependent fields in subform (returns JSON string)
|
|
537
494
|
* Maps to WASM evaluateDependentsSubform()
|
|
538
495
|
*/
|
|
539
|
-
async evaluateDependentsSubformString({ subformPath, changedPaths, data, context, }) {
|
|
496
|
+
async evaluateDependentsSubformString({ subformPath, changedPaths, data, context, includeSubforms = true, }) {
|
|
540
497
|
await this.init();
|
|
541
498
|
const paths = Array.isArray(changedPaths) ? changedPaths : [changedPaths];
|
|
542
|
-
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);
|
|
499
|
+
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, false, includeSubforms);
|
|
543
500
|
}
|
|
544
501
|
/**
|
|
545
502
|
* Resolve layout for subform
|