@json-eval-rs/react-native 0.0.74 → 0.0.75

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.
@@ -9,8 +9,6 @@ using namespace jsoneval;
9
9
  static jclass gPromiseClass = nullptr;
10
10
  static jmethodID gResolveMethodID = nullptr;
11
11
  static jmethodID gRejectMethodID = nullptr;
12
- static jclass gIntegerClass = nullptr;
13
- static jmethodID gIntegerValueOfMethodID = nullptr;
14
12
 
15
13
  // Helper functions (C++ linkage - internal use only)
16
14
  // Helper to convert jstring to std::string
@@ -51,13 +49,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
51
49
  gRejectMethodID = env->GetMethodID(gPromiseClass, "reject", "(Ljava/lang/String;Ljava/lang/String;)V");
52
50
  env->DeleteLocalRef(promiseClass);
53
51
 
54
- // Cache Integer class for cacheLenAsync optimization
55
- jclass integerClass = env->FindClass("java/lang/Integer");
56
- if (integerClass == nullptr) return JNI_ERR;
57
- gIntegerClass = reinterpret_cast<jclass>(env->NewGlobalRef(integerClass));
58
- gIntegerValueOfMethodID = env->GetStaticMethodID(gIntegerClass, "valueOf", "(I)Ljava/lang/Integer;");
59
- env->DeleteLocalRef(integerClass);
60
-
61
52
  return JNI_VERSION_1_6;
62
53
  }
63
54
 
@@ -298,6 +289,26 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeValidateAsync(
298
289
  });
299
290
  }
300
291
 
292
+ JNIEXPORT void JNICALL
293
+ Java_com_jsonevalrs_JsonEvalRsModule_nativeValidatePathsAsync(
294
+ JNIEnv* env,
295
+ jobject /* this */,
296
+ jstring handle,
297
+ jstring data,
298
+ jstring context,
299
+ jstring pathsJson,
300
+ jobject promise
301
+ ) {
302
+ std::string handleStr = jstringToString(env, handle);
303
+ std::string dataStr = jstringToString(env, data);
304
+ std::string contextStr = jstringToString(env, context);
305
+ std::string pathsJsonStr = jstringToString(env, pathsJson);
306
+
307
+ runAsyncWithPromise(env, promise, "VALIDATE_PATHS_ERROR", [handleStr, dataStr, contextStr, pathsJsonStr](auto callback) {
308
+ JsonEvalBridge::validatePathsAsync(handleStr, dataStr, contextStr, pathsJsonStr, callback);
309
+ });
310
+ }
311
+
301
312
  JNIEXPORT void JNICALL
302
313
  Java_com_jsonevalrs_JsonEvalRsModule_nativeEvaluateDependentsAsync(
303
314
  JNIEnv* env,
@@ -307,6 +318,7 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeEvaluateDependentsAsync(
307
318
  jstring data,
308
319
  jstring context,
309
320
  jboolean reEvaluate,
321
+ jboolean includeSubforms,
310
322
  jobject promise
311
323
  ) {
312
324
  std::string handleStr = jstringToString(env, handle);
@@ -314,9 +326,10 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeEvaluateDependentsAsync(
314
326
  std::string dataStr = jstringToString(env, data);
315
327
  std::string contextStr = jstringToString(env, context);
316
328
  bool reEval = static_cast<bool>(reEvaluate);
329
+ bool includeSubf = static_cast<bool>(includeSubforms);
317
330
 
318
- runAsyncWithPromise(env, promise, "EVALUATE_DEPENDENTS_ERROR", [handleStr, pathStr, dataStr, contextStr, reEval](auto callback) {
319
- JsonEvalBridge::evaluateDependentsAsync(handleStr, pathStr, dataStr, contextStr, reEval, callback);
331
+ runAsyncWithPromise(env, promise, "EVALUATE_DEPENDENTS_ERROR", [handleStr, pathStr, dataStr, contextStr, reEval, includeSubf](auto callback) {
332
+ JsonEvalBridge::evaluateDependentsAsync(handleStr, pathStr, dataStr, contextStr, reEval, includeSubf, callback);
320
333
  });
321
334
  }
322
335
 
@@ -578,127 +591,6 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeReloadSchemaFromCacheAsync(
578
591
  });
579
592
  }
580
593
 
581
- JNIEXPORT void JNICALL
582
- Java_com_jsonevalrs_JsonEvalRsModule_nativeCacheStatsAsync(
583
- JNIEnv* env,
584
- jobject /* this */,
585
- jstring handle,
586
- jobject promise
587
- ) {
588
- std::string handleStr = jstringToString(env, handle);
589
-
590
- runAsyncWithPromise(env, promise, "CACHE_STATS_ERROR", [handleStr](auto callback) {
591
- JsonEvalBridge::cacheStatsAsync(handleStr, callback);
592
- });
593
- }
594
-
595
- JNIEXPORT void JNICALL
596
- Java_com_jsonevalrs_JsonEvalRsModule_nativeClearCacheAsync(
597
- JNIEnv* env,
598
- jobject /* this */,
599
- jstring handle,
600
- jobject promise
601
- ) {
602
- std::string handleStr = jstringToString(env, handle);
603
-
604
- runAsyncWithPromise(env, promise, "CLEAR_CACHE_ERROR", [handleStr](auto callback) {
605
- JsonEvalBridge::clearCacheAsync(handleStr, callback);
606
- });
607
- }
608
-
609
- JNIEXPORT void JNICALL
610
- Java_com_jsonevalrs_JsonEvalRsModule_nativeCacheLenAsync(
611
- JNIEnv* env,
612
- jobject /* this */,
613
- jstring handle,
614
- jobject promise
615
- ) {
616
- std::string handleStr = jstringToString(env, handle);
617
-
618
- JavaVM* jvm;
619
- env->GetJavaVM(&jvm);
620
- jobject globalPromise = env->NewGlobalRef(promise);
621
-
622
- JsonEvalBridge::cacheLenAsync(handleStr,
623
- [jvm, globalPromise](const std::string& result, const std::string& error) {
624
- JNIEnv* env = nullptr;
625
- jvm->AttachCurrentThread(&env, nullptr);
626
-
627
- if (error.empty()) {
628
- // Optimized: Direct parse and box using cached method IDs
629
- jint intValue = std::stoi(result);
630
- jobject integerObj = env->CallStaticObjectMethod(gIntegerClass, gIntegerValueOfMethodID, intValue);
631
- env->CallVoidMethod(globalPromise, gResolveMethodID, integerObj);
632
- env->DeleteLocalRef(integerObj);
633
- } else {
634
- rejectPromise(env, globalPromise, "CACHE_LEN_ERROR", error);
635
- }
636
-
637
- env->DeleteGlobalRef(globalPromise);
638
- jvm->DetachCurrentThread();
639
- }
640
- );
641
- }
642
-
643
- JNIEXPORT void JNICALL
644
- Java_com_jsonevalrs_JsonEvalRsModule_nativeValidatePathsAsync(
645
- JNIEnv* env,
646
- jobject /* this */,
647
- jstring handle,
648
- jstring data,
649
- jstring context,
650
- jstring pathsJson,
651
- jobject promise
652
- ) {
653
- std::string handleStr = jstringToString(env, handle);
654
- std::string dataStr = jstringToString(env, data);
655
- std::string contextStr = jstringToString(env, context);
656
- std::string pathsStr = jstringToString(env, pathsJson);
657
-
658
- runAsyncWithPromise(env, promise, "VALIDATE_PATHS_ERROR", [handleStr, dataStr, contextStr, pathsStr](auto callback) {
659
- JsonEvalBridge::validatePathsAsync(handleStr, dataStr, contextStr, pathsStr, callback);
660
- });
661
- }
662
-
663
- JNIEXPORT void JNICALL
664
- Java_com_jsonevalrs_JsonEvalRsModule_nativeEnableCacheAsync(
665
- JNIEnv* env,
666
- jobject /* this */,
667
- jstring handle,
668
- jobject promise
669
- ) {
670
- std::string handleStr = jstringToString(env, handle);
671
-
672
- runAsyncWithPromise(env, promise, "ENABLE_CACHE_ERROR", [handleStr](auto callback) {
673
- JsonEvalBridge::enableCacheAsync(handleStr, callback);
674
- });
675
- }
676
-
677
- JNIEXPORT void JNICALL
678
- Java_com_jsonevalrs_JsonEvalRsModule_nativeDisableCacheAsync(
679
- JNIEnv* env,
680
- jobject /* this */,
681
- jstring handle,
682
- jobject promise
683
- ) {
684
- std::string handleStr = jstringToString(env, handle);
685
-
686
- runAsyncWithPromise(env, promise, "DISABLE_CACHE_ERROR", [handleStr](auto callback) {
687
- JsonEvalBridge::disableCacheAsync(handleStr, callback);
688
- });
689
- }
690
-
691
- JNIEXPORT jboolean JNICALL
692
- Java_com_jsonevalrs_JsonEvalRsModule_nativeIsCacheEnabled(
693
- JNIEnv* env,
694
- jobject /* this */,
695
- jstring handle
696
- ) {
697
- std::string handleStr = jstringToString(env, handle);
698
- bool enabled = JsonEvalBridge::isCacheEnabled(handleStr);
699
- return enabled ? JNI_TRUE : JNI_FALSE;
700
- }
701
-
702
594
  JNIEXPORT void JNICALL
703
595
  Java_com_jsonevalrs_JsonEvalRsModule_nativeDispose(
704
596
  JNIEnv* env,
@@ -834,6 +726,7 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeEvaluateDependentsSubformAsync(
834
726
  jstring data,
835
727
  jstring context,
836
728
  jboolean reEvaluate,
729
+ jboolean includeSubforms,
837
730
  jobject promise
838
731
  ) {
839
732
  std::string handleStr = jstringToString(env, handle);
@@ -842,9 +735,10 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeEvaluateDependentsSubformAsync(
842
735
  std::string dataStr = jstringToString(env, data);
843
736
  std::string contextStr = jstringToString(env, context);
844
737
  bool reEval = static_cast<bool>(reEvaluate);
738
+ bool includeSubf = static_cast<bool>(includeSubforms);
845
739
 
846
- runAsyncWithPromise(env, promise, "EVALUATE_DEPENDENTS_SUBFORM_ERROR", [handleStr, subformPathStr, changedPathStr, dataStr, contextStr, reEval](auto callback) {
847
- JsonEvalBridge::evaluateDependentsSubformAsync(handleStr, subformPathStr, changedPathStr, dataStr, contextStr, reEval, callback);
740
+ runAsyncWithPromise(env, promise, "EVALUATE_DEPENDENTS_SUBFORM_ERROR", [handleStr, subformPathStr, changedPathStr, dataStr, contextStr, reEval, includeSubf](auto callback) {
741
+ JsonEvalBridge::evaluateDependentsSubformAsync(handleStr, subformPathStr, changedPathStr, dataStr, contextStr, reEval, includeSubf, callback);
848
742
  });
849
743
  }
850
744
 
@@ -72,9 +72,10 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
72
72
  data: String?,
73
73
  context: String?,
74
74
  reEvaluate: Boolean,
75
+ includeSubforms: Boolean,
75
76
  promise: Promise
76
77
  ) {
77
- nativeEvaluateDependentsAsync(handle, changedPathsJson, data ?: "", context ?: "", reEvaluate, promise)
78
+ nativeEvaluateDependentsAsync(handle, changedPathsJson, data ?: "", context ?: "", reEvaluate, includeSubforms, promise)
78
79
  }
79
80
 
80
81
  @ReactMethod
@@ -232,53 +233,6 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
232
233
  }
233
234
  }
234
235
 
235
- @ReactMethod
236
- fun cacheStats(
237
- handle: String,
238
- promise: Promise
239
- ) {
240
- nativeCacheStatsAsync(handle, promise)
241
- }
242
-
243
- @ReactMethod
244
- fun clearCache(
245
- handle: String,
246
- promise: Promise
247
- ) {
248
- nativeClearCacheAsync(handle, promise)
249
- }
250
-
251
- @ReactMethod
252
- fun cacheLen(
253
- handle: String,
254
- promise: Promise
255
- ) {
256
- nativeCacheLenAsync(handle, promise)
257
- }
258
-
259
- @ReactMethod
260
- fun enableCache(
261
- handle: String,
262
- promise: Promise
263
- ) {
264
- nativeEnableCacheAsync(handle, promise)
265
- }
266
-
267
- @ReactMethod
268
- fun disableCache(
269
- handle: String,
270
- promise: Promise
271
- ) {
272
- nativeDisableCacheAsync(handle, promise)
273
- }
274
-
275
- @ReactMethod(isBlockingSynchronousMethod = true)
276
- fun isCacheEnabled(
277
- handle: String
278
- ): Boolean {
279
- return nativeIsCacheEnabled(handle)
280
- }
281
-
282
236
  @ReactMethod
283
237
  fun setTimezoneOffset(
284
238
  handle: String,
@@ -390,9 +344,10 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
390
344
  data: String?,
391
345
  context: String?,
392
346
  reEvaluate: Boolean,
347
+ includeSubforms: Boolean,
393
348
  promise: Promise
394
349
  ) {
395
- nativeEvaluateDependentsSubformAsync(handle, subformPath, changedPath, data ?: "", context ?: "", reEvaluate, promise)
350
+ nativeEvaluateDependentsSubformAsync(handle, subformPath, changedPath, data ?: "", context ?: "", reEvaluate, includeSubforms, promise)
396
351
  }
397
352
 
398
353
  @ReactMethod
@@ -576,6 +531,7 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
576
531
  data: String,
577
532
  context: String,
578
533
  reEvaluate: Boolean,
534
+ includeSubforms: Boolean,
579
535
  promise: Promise
580
536
  )
581
537
  private external fun nativeGetEvaluatedSchemaAsync(handle: String, skipLayout: Boolean, promise: Promise)
@@ -590,12 +546,6 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
590
546
  private external fun nativeReloadSchemaAsync(handle: String, schema: String, context: String, data: String, promise: Promise)
591
547
  private external fun nativeReloadSchemaMsgpackAsync(handle: String, schemaMsgpack: ByteArray, context: String, data: String, promise: Promise)
592
548
  private external fun nativeReloadSchemaFromCacheAsync(handle: String, cacheKey: String, context: String, data: String, promise: Promise)
593
- private external fun nativeCacheStatsAsync(handle: String, promise: Promise)
594
- private external fun nativeClearCacheAsync(handle: String, promise: Promise)
595
- private external fun nativeCacheLenAsync(handle: String, promise: Promise)
596
- private external fun nativeEnableCacheAsync(handle: String, promise: Promise)
597
- private external fun nativeDisableCacheAsync(handle: String, promise: Promise)
598
- private external fun nativeIsCacheEnabled(handle: String): Boolean
599
549
  private external fun nativeValidatePathsAsync(handle: String, data: String, context: String, pathsJson: String, promise: Promise)
600
550
  private external fun nativeResolveLayoutAsync(handle: String, evaluate: Boolean, promise: Promise)
601
551
  private external fun nativeCompileAndRunLogicAsync(handle: String, logicStr: String, data: String, context: String, promise: Promise)
@@ -648,7 +598,7 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
648
598
 
649
599
  private external fun nativeEvaluateSubform(handle: String, subformPath: String, data: String, context: String, pathsJson: String, promise: Promise)
650
600
  private external fun nativeValidateSubformAsync(handle: String, subformPath: String, data: String, context: String, promise: Promise)
651
- private external fun nativeEvaluateDependentsSubformAsync(handle: String, subformPath: String, changedPath: String, data: String, context: String, reEvaluate: Boolean, promise: Promise)
601
+ private external fun nativeEvaluateDependentsSubformAsync(handle: String, subformPath: String, changedPath: String, data: String, context: String, reEvaluate: Boolean, includeSubforms: Boolean, promise: Promise)
652
602
  private external fun nativeResolveLayoutSubformAsync(handle: String, subformPath: String, evaluate: Boolean, promise: Promise)
653
603
  private external fun nativeGetEvaluatedSchemaSubformAsync(handle: String, subformPath: String, resolveLayout: Boolean, promise: Promise)
654
604
  private external fun nativeGetSchemaValueSubformAsync(handle: String, subformPath: String, promise: Promise)
@@ -22,7 +22,7 @@ extern "C" {
22
22
  FFIResult json_eval_evaluate(JSONEvalHandle* handle, const char* data, const char* context, const char* paths_json);
23
23
  FFIResult json_eval_get_evaluated_schema_msgpack(JSONEvalHandle* handle, bool skip_layout);
24
24
  FFIResult json_eval_validate(JSONEvalHandle* handle, const char* data, const char* context);
25
- FFIResult json_eval_evaluate_dependents(JSONEvalHandle* handle, const char* changed_path, const char* data, const char* context, int re_evaluate);
25
+ FFIResult json_eval_evaluate_dependents(JSONEvalHandle* handle, const char* changed_path, const char* data, const char* context, int re_evaluate, int include_subforms);
26
26
  FFIResult json_eval_get_evaluated_schema(JSONEvalHandle* handle, bool skip_layout);
27
27
  FFIResult json_eval_get_schema_value(JSONEvalHandle* handle);
28
28
  FFIResult json_eval_get_schema_value_array(JSONEvalHandle* handle);
@@ -40,19 +40,13 @@ extern "C" {
40
40
  FFIResult json_eval_reload_schema_msgpack(JSONEvalHandle* handle, const uint8_t* schema_msgpack, size_t schema_len, const char* context, const char* data);
41
41
  FFIResult json_eval_reload_schema_from_cache(JSONEvalHandle* handle, const char* cache_key, const char* context, const char* data);
42
42
  JSONEvalHandle* json_eval_new_from_cache(const char* cache_key, const char* context, const char* data);
43
- FFIResult json_eval_cache_stats(JSONEvalHandle* handle);
44
- FFIResult json_eval_clear_cache(JSONEvalHandle* handle);
45
- FFIResult json_eval_cache_len(JSONEvalHandle* handle);
46
- FFIResult json_eval_enable_cache(JSONEvalHandle* handle);
47
- FFIResult json_eval_disable_cache(JSONEvalHandle* handle);
48
- int json_eval_is_cache_enabled(JSONEvalHandle* handle);
49
43
  FFIResult json_eval_validate_paths(JSONEvalHandle* handle, const char* data, const char* context, const char* paths_json);
50
44
  FFIResult json_eval_evaluate_logic_pure(const char* logic_str, const char* data, const char* context);
51
45
 
52
46
  // Subform FFI methods
53
47
  FFIResult json_eval_evaluate_subform(JSONEvalHandle* handle, const char* subform_path, const char* data, const char* context, const char* paths_json);
54
48
  FFIResult json_eval_validate_subform(JSONEvalHandle* handle, const char* subform_path, const char* data, const char* context);
55
- FFIResult json_eval_evaluate_dependents_subform(JSONEvalHandle* handle, const char* subform_path, const char* changed_path, const char* data, const char* context, int re_evaluate);
49
+ FFIResult json_eval_evaluate_dependents_subform(JSONEvalHandle* handle, const char* subform_path, const char* changed_path, const char* data, const char* context, int re_evaluate, int include_subforms);
56
50
  FFIResult json_eval_resolve_layout_subform(JSONEvalHandle* handle, const char* subform_path, bool evaluate);
57
51
  FFIResult json_eval_get_evaluated_schema_subform(JSONEvalHandle* handle, const char* subform_path, bool resolve_layout);
58
52
  FFIResult json_eval_get_schema_value_subform(JSONEvalHandle* handle, const char* subform_path);
@@ -370,9 +364,10 @@ void JsonEvalBridge::evaluateDependentsAsync(
370
364
  const std::string& data,
371
365
  const std::string& context,
372
366
  bool reEvaluate,
367
+ bool includeSubforms,
373
368
  std::function<void(const std::string&, const std::string&)> callback
374
369
  ) {
375
- runAsync([handleId, changedPathsJson, data, context, reEvaluate]() -> std::string {
370
+ runAsync([handleId, changedPathsJson, data, context, reEvaluate, includeSubforms]() -> std::string {
376
371
  std::lock_guard<std::mutex> lock(handlesMutex);
377
372
  auto it = handles.find(handleId);
378
373
  if (it == handles.end()) {
@@ -386,7 +381,8 @@ void JsonEvalBridge::evaluateDependentsAsync(
386
381
  changedPathsJson.c_str(),
387
382
  dataPtr,
388
383
  ctx,
389
- reEvaluate ? 1 : 0
384
+ reEvaluate ? 1 : 0,
385
+ includeSubforms ? 1 : 0
390
386
  );
391
387
 
392
388
  if (!result.success) {
@@ -824,151 +820,6 @@ void JsonEvalBridge::reloadSchemaFromCacheAsync(
824
820
  }, callback);
825
821
  }
826
822
 
827
- void JsonEvalBridge::cacheStatsAsync(
828
- const std::string& handleId,
829
- std::function<void(const std::string&, const std::string&)> callback
830
- ) {
831
- runAsync([handleId]() -> std::string {
832
- std::lock_guard<std::mutex> lock(handlesMutex);
833
- auto it = handles.find(handleId);
834
- if (it == handles.end()) {
835
- throw std::runtime_error("Invalid handle");
836
- }
837
-
838
- FFIResult result = json_eval_cache_stats(it->second);
839
-
840
- if (!result.success) {
841
- std::string error = result.error ? result.error : "Unknown error";
842
- json_eval_free_result(result);
843
- throw std::runtime_error(error);
844
- }
845
-
846
- // Zero-copy: construct string directly from raw pointer
847
- std::string resultStr;
848
- if (result.data_ptr && result.data_len > 0) {
849
- resultStr.assign(reinterpret_cast<const char*>(result.data_ptr), result.data_len);
850
- } else {
851
- resultStr = "{}";
852
- }
853
- json_eval_free_result(result);
854
- return resultStr;
855
- }, callback);
856
- }
857
-
858
- void JsonEvalBridge::clearCacheAsync(
859
- const std::string& handleId,
860
- std::function<void(const std::string&, const std::string&)> callback
861
- ) {
862
- runAsync([handleId]() -> std::string {
863
- std::lock_guard<std::mutex> lock(handlesMutex);
864
- auto it = handles.find(handleId);
865
- if (it == handles.end()) {
866
- throw std::runtime_error("Invalid handle");
867
- }
868
-
869
- FFIResult result = json_eval_clear_cache(it->second);
870
-
871
- if (!result.success) {
872
- std::string error = result.error ? result.error : "Unknown error";
873
- json_eval_free_result(result);
874
- throw std::runtime_error(error);
875
- }
876
-
877
- json_eval_free_result(result);
878
- return "{}";
879
- }, callback);
880
- }
881
-
882
- void JsonEvalBridge::cacheLenAsync(
883
- const std::string& handleId,
884
- std::function<void(const std::string&, const std::string&)> callback
885
- ) {
886
- runAsync([handleId]() -> std::string {
887
- std::lock_guard<std::mutex> lock(handlesMutex);
888
- auto it = handles.find(handleId);
889
- if (it == handles.end()) {
890
- throw std::runtime_error("Invalid handle");
891
- }
892
-
893
- FFIResult result = json_eval_cache_len(it->second);
894
-
895
- if (!result.success) {
896
- std::string error = result.error ? result.error : "Unknown error";
897
- json_eval_free_result(result);
898
- throw std::runtime_error(error);
899
- }
900
-
901
- // Zero-copy: construct string directly from raw pointer
902
- std::string resultStr;
903
- if (result.data_ptr && result.data_len > 0) {
904
- resultStr.assign(reinterpret_cast<const char*>(result.data_ptr), result.data_len);
905
- } else {
906
- resultStr = "0";
907
- }
908
- json_eval_free_result(result);
909
- return resultStr;
910
- }, callback);
911
- }
912
-
913
- void JsonEvalBridge::enableCacheAsync(
914
- const std::string& handleId,
915
- std::function<void(const std::string&, const std::string&)> callback
916
- ) {
917
- runAsync([handleId]() -> std::string {
918
- std::lock_guard<std::mutex> lock(handlesMutex);
919
- auto it = handles.find(handleId);
920
- if (it == handles.end()) {
921
- throw std::runtime_error("Invalid handle");
922
- }
923
-
924
- FFIResult result = json_eval_enable_cache(it->second);
925
-
926
- if (!result.success) {
927
- std::string error = result.error ? result.error : "Unknown error";
928
- json_eval_free_result(result);
929
- throw std::runtime_error(error);
930
- }
931
-
932
- json_eval_free_result(result);
933
- return "";
934
- }, callback);
935
- }
936
-
937
- void JsonEvalBridge::disableCacheAsync(
938
- const std::string& handleId,
939
- std::function<void(const std::string&, const std::string&)> callback
940
- ) {
941
- runAsync([handleId]() -> std::string {
942
- std::lock_guard<std::mutex> lock(handlesMutex);
943
- auto it = handles.find(handleId);
944
- if (it == handles.end()) {
945
- throw std::runtime_error("Invalid handle");
946
- }
947
-
948
- FFIResult result = json_eval_disable_cache(it->second);
949
-
950
- if (!result.success) {
951
- std::string error = result.error ? result.error : "Unknown error";
952
- json_eval_free_result(result);
953
- throw std::runtime_error(error);
954
- }
955
-
956
- json_eval_free_result(result);
957
- return "";
958
- }, callback);
959
- }
960
-
961
- bool JsonEvalBridge::isCacheEnabled(const std::string& handleId) {
962
- std::lock_guard<std::mutex> lock(handlesMutex);
963
- auto it = handles.find(handleId);
964
- if (it == handles.end()) {
965
- return false;
966
- }
967
-
968
- int result = json_eval_is_cache_enabled(it->second);
969
- return result != 0;
970
- }
971
-
972
823
  void JsonEvalBridge::resolveLayoutAsync(
973
824
  const std::string& handleId,
974
825
  bool evaluate,
@@ -1147,9 +998,10 @@ void JsonEvalBridge::evaluateDependentsSubformAsync(
1147
998
  const std::string& data,
1148
999
  const std::string& context,
1149
1000
  bool reEvaluate,
1001
+ bool includeSubforms,
1150
1002
  std::function<void(const std::string&, const std::string&)> callback
1151
1003
  ) {
1152
- runAsync([handleId, subformPath, changedPath, data, context, reEvaluate]() -> std::string {
1004
+ runAsync([handleId, subformPath, changedPath, data, context, reEvaluate, includeSubforms]() -> std::string {
1153
1005
  std::lock_guard<std::mutex> lock(handlesMutex);
1154
1006
  auto it = handles.find(handleId);
1155
1007
  if (it == handles.end()) {
@@ -1158,7 +1010,10 @@ void JsonEvalBridge::evaluateDependentsSubformAsync(
1158
1010
 
1159
1011
  const char* dt = data.empty() ? nullptr : data.c_str();
1160
1012
  const char* ctx = context.empty() ? nullptr : context.c_str();
1161
- FFIResult result = json_eval_evaluate_dependents_subform(it->second, subformPath.c_str(), changedPath.c_str(), dt, ctx, reEvaluate ? 1 : 0);
1013
+ FFIResult result = json_eval_evaluate_dependents_subform(
1014
+ it->second, subformPath.c_str(), changedPath.c_str(), dt, ctx,
1015
+ reEvaluate ? 1 : 0, includeSubforms ? 1 : 0
1016
+ );
1162
1017
 
1163
1018
  if (!result.success) {
1164
1019
  std::string error = result.error ? result.error : "Unknown error";
@@ -114,6 +114,7 @@ public:
114
114
  const std::string& data,
115
115
  const std::string& context,
116
116
  bool reEvaluate,
117
+ bool includeSubforms,
117
118
  std::function<void(const std::string&, const std::string&)> callback
118
119
  );
119
120
 
@@ -289,63 +290,6 @@ public:
289
290
  std::function<void(const std::string&, const std::string&)> callback
290
291
  );
291
292
 
292
- /**
293
- * Get cache stats (async)
294
- * @param handle Instance handle
295
- * @param callback Result callback
296
- */
297
- static void cacheStatsAsync(
298
- const std::string& handle,
299
- std::function<void(const std::string&, const std::string&)> callback
300
- );
301
-
302
- /**
303
- * Clear cache (async)
304
- * @param handle Instance handle
305
- * @param callback Result callback
306
- */
307
- static void clearCacheAsync(
308
- const std::string& handle,
309
- std::function<void(const std::string&, const std::string&)> callback
310
- );
311
-
312
- /**
313
- * Get cache length (async)
314
- * @param handle Instance handle
315
- * @param callback Result callback
316
- */
317
- static void cacheLenAsync(
318
- const std::string& handle,
319
- std::function<void(const std::string&, const std::string&)> callback
320
- );
321
-
322
- /**
323
- * Enable evaluation caching (async)
324
- * @param handle Instance handle
325
- * @param callback Result callback
326
- */
327
- static void enableCacheAsync(
328
- const std::string& handle,
329
- std::function<void(const std::string&, const std::string&)> callback
330
- );
331
-
332
- /**
333
- * Disable evaluation caching (async)
334
- * @param handle Instance handle
335
- * @param callback Result callback
336
- */
337
- static void disableCacheAsync(
338
- const std::string& handle,
339
- std::function<void(const std::string&, const std::string&)> callback
340
- );
341
-
342
- /**
343
- * Check if caching is enabled (synchronous)
344
- * @param handle Instance handle
345
- * @returns true if caching is enabled, false otherwise
346
- */
347
- static bool isCacheEnabled(const std::string& handle);
348
-
349
293
  /**
350
294
  * Resolve layout with optional evaluation (async)
351
295
  * @param handle Instance handle
@@ -484,6 +428,7 @@ public:
484
428
  const std::string& data,
485
429
  const std::string& context,
486
430
  bool reEvaluate,
431
+ bool includeSubforms,
487
432
  std::function<void(const std::string&, const std::string&)> callback
488
433
  );
489
434