@json-eval-rs/react-native 0.0.28 → 0.0.29

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.
@@ -347,14 +347,16 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeGetEvaluatedSchemaByPathsAsync(
347
347
  jstring handle,
348
348
  jstring pathsJson,
349
349
  jboolean skipLayout,
350
+ jint format,
350
351
  jobject promise
351
352
  ) {
352
353
  std::string handleStr = jstringToString(env, handle);
353
354
  std::string pathsJsonStr = jstringToString(env, pathsJson);
354
355
  bool skipLayoutBool = (skipLayout == JNI_TRUE);
356
+ int formatInt = static_cast<int>(format);
355
357
 
356
- runAsyncWithPromise(env, promise, "GET_EVALUATED_SCHEMA_BY_PATHS_ERROR", [handleStr, pathsJsonStr, skipLayoutBool](auto callback) {
357
- JsonEvalBridge::getEvaluatedSchemaByPathsAsync(handleStr, pathsJsonStr, skipLayoutBool, callback);
358
+ runAsyncWithPromise(env, promise, "GET_EVALUATED_SCHEMA_BY_PATHS_ERROR", [handleStr, pathsJsonStr, skipLayoutBool, formatInt](auto callback) {
359
+ JsonEvalBridge::getEvaluatedSchemaByPathsAsync(handleStr, pathsJsonStr, skipLayoutBool, formatInt, callback);
358
360
  });
359
361
  }
360
362
 
@@ -380,13 +382,15 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeGetSchemaByPathsAsync(
380
382
  jobject /* this */,
381
383
  jstring handle,
382
384
  jstring pathsJson,
385
+ jint format,
383
386
  jobject promise
384
387
  ) {
385
388
  std::string handleStr = jstringToString(env, handle);
386
389
  std::string pathsJsonStr = jstringToString(env, pathsJson);
390
+ int formatInt = static_cast<int>(format);
387
391
 
388
- runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_ERROR", [handleStr, pathsJsonStr](auto callback) {
389
- JsonEvalBridge::getSchemaByPathsAsync(handleStr, pathsJsonStr, callback);
392
+ runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_ERROR", [handleStr, pathsJsonStr, formatInt](auto callback) {
393
+ JsonEvalBridge::getSchemaByPathsAsync(handleStr, pathsJsonStr, formatInt, callback);
390
394
  });
391
395
  }
392
396
 
@@ -794,15 +798,17 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeGetEvaluatedSchemaByPathsSubformAsync
794
798
  jstring subformPath,
795
799
  jstring schemaPathsJson,
796
800
  jboolean skipLayout,
801
+ jint format,
797
802
  jobject promise
798
803
  ) {
799
804
  std::string handleStr = jstringToString(env, handle);
800
805
  std::string subformPathStr = jstringToString(env, subformPath);
801
806
  std::string schemaPathsJsonStr = jstringToString(env, schemaPathsJson);
802
807
  bool skipLayoutBool = (skipLayout == JNI_TRUE);
808
+ int formatInt = static_cast<int>(format);
803
809
 
804
- runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_SUBFORM_ERROR", [handleStr, subformPathStr, schemaPathsJsonStr, skipLayoutBool](auto callback) {
805
- JsonEvalBridge::getEvaluatedSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, skipLayoutBool, callback);
810
+ runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_SUBFORM_ERROR", [handleStr, subformPathStr, schemaPathsJsonStr, skipLayoutBool, formatInt](auto callback) {
811
+ JsonEvalBridge::getEvaluatedSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, skipLayoutBool, formatInt, callback);
806
812
  });
807
813
  }
808
814
 
@@ -845,14 +851,16 @@ Java_com_jsonevalrs_JsonEvalRsModule_nativeGetSchemaByPathsSubformAsync(
845
851
  jstring handle,
846
852
  jstring subformPath,
847
853
  jstring schemaPathsJson,
854
+ jint format,
848
855
  jobject promise
849
856
  ) {
850
857
  std::string handleStr = jstringToString(env, handle);
851
858
  std::string subformPathStr = jstringToString(env, subformPath);
852
859
  std::string schemaPathsJsonStr = jstringToString(env, schemaPathsJson);
860
+ int formatInt = static_cast<int>(format);
853
861
 
854
- runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_SUBFORM_ERROR", [handleStr, subformPathStr, schemaPathsJsonStr](auto callback) {
855
- JsonEvalBridge::getSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, callback);
862
+ runAsyncWithPromise(env, promise, "GET_SCHEMA_BY_PATHS_SUBFORM_ERROR", [handleStr, subformPathStr, schemaPathsJsonStr, formatInt](auto callback) {
863
+ JsonEvalBridge::getSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, formatInt, callback);
856
864
  });
857
865
  }
858
866
 
@@ -106,9 +106,10 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
106
106
  handle: String,
107
107
  pathsJson: String,
108
108
  skipLayout: Boolean,
109
+ format: Int,
109
110
  promise: Promise
110
111
  ) {
111
- nativeGetEvaluatedSchemaByPathsAsync(handle, pathsJson, skipLayout, promise)
112
+ nativeGetEvaluatedSchemaByPathsAsync(handle, pathsJson, skipLayout, format, promise)
112
113
  }
113
114
 
114
115
  @ReactMethod
@@ -124,9 +125,10 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
124
125
  fun getSchemaByPaths(
125
126
  handle: String,
126
127
  pathsJson: String,
128
+ format: Int,
127
129
  promise: Promise
128
130
  ) {
129
- nativeGetSchemaByPathsAsync(handle, pathsJson, promise)
131
+ nativeGetSchemaByPathsAsync(handle, pathsJson, format, promise)
130
132
  }
131
133
 
132
134
  @ReactMethod
@@ -404,17 +406,17 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
404
406
  subformPath: String,
405
407
  schemaPathsJson: String,
406
408
  skipLayout: Boolean,
409
+ format: Int,
407
410
  promise: Promise
408
411
  ) {
409
- nativeGetEvaluatedSchemaByPathsSubformAsync(handle, subformPath, schemaPathsJson, skipLayout, promise)
410
- }
411
-
412
- @ReactMethod
413
- fun getSubformPaths(
414
- handle: String,
415
- promise: Promise
416
- ) {
417
- nativeGetSubformPathsAsync(handle, promise)
412
+ nativeGetEvaluatedSchemaByPathsSubformAsync(
413
+ handle,
414
+ subformPath,
415
+ schemaPathsJson,
416
+ skipLayout,
417
+ format,
418
+ promise
419
+ )
418
420
  }
419
421
 
420
422
  @ReactMethod
@@ -432,9 +434,24 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
432
434
  handle: String,
433
435
  subformPath: String,
434
436
  schemaPathsJson: String,
437
+ format: Int,
435
438
  promise: Promise
436
439
  ) {
437
- nativeGetSchemaByPathsSubformAsync(handle, subformPath, schemaPathsJson, promise)
440
+ nativeGetSchemaByPathsSubformAsync(
441
+ handle,
442
+ subformPath,
443
+ schemaPathsJson,
444
+ format,
445
+ promise
446
+ )
447
+ }
448
+
449
+ @ReactMethod
450
+ fun getSubformPaths(
451
+ handle: String,
452
+ promise: Promise
453
+ ) {
454
+ nativeGetSubformPathsAsync(handle, promise)
438
455
  }
439
456
 
440
457
  @ReactMethod
@@ -494,9 +511,9 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
494
511
  private external fun nativeGetSchemaValueAsync(handle: String, promise: Promise)
495
512
  private external fun nativeGetEvaluatedSchemaWithoutParamsAsync(handle: String, skipLayout: Boolean, promise: Promise)
496
513
  private external fun nativeGetEvaluatedSchemaByPathAsync(handle: String, path: String, skipLayout: Boolean, promise: Promise)
497
- private external fun nativeGetEvaluatedSchemaByPathsAsync(handle: String, pathsJson: String, skipLayout: Boolean, promise: Promise)
514
+ private external fun nativeGetEvaluatedSchemaByPathsAsync(handle: String, pathsJson: String, skipLayout: Boolean, format: Int, promise: Promise)
498
515
  private external fun nativeGetSchemaByPathAsync(handle: String, path: String, promise: Promise)
499
- private external fun nativeGetSchemaByPathsAsync(handle: String, pathsJson: String, promise: Promise)
516
+ private external fun nativeGetSchemaByPathsAsync(handle: String, pathsJson: String, format: Int, promise: Promise)
500
517
  private external fun nativeReloadSchemaAsync(handle: String, schema: String, context: String, data: String, promise: Promise)
501
518
  private external fun nativeReloadSchemaMsgpackAsync(handle: String, schemaMsgpack: ByteArray, context: String, data: String, promise: Promise)
502
519
  private external fun nativeReloadSchemaFromCacheAsync(handle: String, cacheKey: String, context: String, data: String, promise: Promise)
@@ -521,9 +538,9 @@ class JsonEvalRsModule(reactContext: ReactApplicationContext) :
521
538
  private external fun nativeGetSchemaValueSubformAsync(handle: String, subformPath: String, promise: Promise)
522
539
  private external fun nativeGetEvaluatedSchemaWithoutParamsSubformAsync(handle: String, subformPath: String, resolveLayout: Boolean, promise: Promise)
523
540
  private external fun nativeGetEvaluatedSchemaByPathSubformAsync(handle: String, subformPath: String, schemaPath: String, skipLayout: Boolean, promise: Promise)
524
- private external fun nativeGetEvaluatedSchemaByPathsSubformAsync(handle: String, subformPath: String, schemaPathsJson: String, skipLayout: Boolean, promise: Promise)
541
+ private external fun nativeGetEvaluatedSchemaByPathsSubformAsync(handle: String, subformPath: String, schemaPathsJson: String, skipLayout: Boolean, format: Int, promise: Promise)
525
542
  private external fun nativeGetSchemaByPathSubformAsync(handle: String, subformPath: String, schemaPath: String, promise: Promise)
526
- private external fun nativeGetSchemaByPathsSubformAsync(handle: String, subformPath: String, schemaPathsJson: String, promise: Promise)
543
+ private external fun nativeGetSchemaByPathsSubformAsync(handle: String, subformPath: String, schemaPathsJson: String, format: Int, promise: Promise)
527
544
  private external fun nativeGetSubformPathsAsync(handle: String, promise: Promise)
528
545
  private external fun nativeHasSubformAsync(handle: String, subformPath: String, promise: Promise)
529
546
 
@@ -27,9 +27,9 @@ extern "C" {
27
27
  FFIResult json_eval_get_schema_value(JSONEvalHandle* handle);
28
28
  FFIResult json_eval_get_evaluated_schema_without_params(JSONEvalHandle* handle, bool skip_layout);
29
29
  FFIResult json_eval_get_evaluated_schema_by_path(JSONEvalHandle* handle, const char* path, bool skip_layout);
30
- FFIResult json_eval_get_evaluated_schema_by_paths(JSONEvalHandle* handle, const char* paths_json, bool skip_layout);
30
+ FFIResult json_eval_get_evaluated_schema_by_paths(JSONEvalHandle* handle, const char* paths_json, bool skip_layout, uint8_t format);
31
31
  FFIResult json_eval_get_schema_by_path(JSONEvalHandle* handle, const char* path);
32
- FFIResult json_eval_get_schema_by_paths(JSONEvalHandle* handle, const char* paths_json);
32
+ FFIResult json_eval_get_schema_by_paths(JSONEvalHandle* handle, const char* paths_json, uint8_t format);
33
33
  FFIResult json_eval_resolve_layout(JSONEvalHandle* handle, bool evaluate);
34
34
  FFIResult json_eval_compile_and_run_logic(JSONEvalHandle* handle, const char* logic_str, const char* data, const char* context);
35
35
  uint64_t json_eval_compile_logic(JSONEvalHandle* handle, const char* logic_str);
@@ -55,9 +55,9 @@ extern "C" {
55
55
  FFIResult json_eval_get_schema_value_subform(JSONEvalHandle* handle, const char* subform_path);
56
56
  FFIResult json_eval_get_evaluated_schema_without_params_subform(JSONEvalHandle* handle, const char* subform_path, bool resolve_layout);
57
57
  FFIResult json_eval_get_evaluated_schema_by_path_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_path, bool skip_layout);
58
- FFIResult json_eval_get_evaluated_schema_by_paths_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_paths_json, bool skip_layout);
58
+ FFIResult json_eval_get_evaluated_schema_by_paths_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_paths_json, bool skip_layout, uint8_t format);
59
59
  FFIResult json_eval_get_schema_by_path_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_path);
60
- FFIResult json_eval_get_schema_by_paths_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_paths_json);
60
+ FFIResult json_eval_get_schema_by_paths_subform(JSONEvalHandle* handle, const char* subform_path, const char* schema_paths_json, uint8_t format);
61
61
  FFIResult json_eval_get_subform_paths(JSONEvalHandle* handle);
62
62
  FFIResult json_eval_has_subform(JSONEvalHandle* handle, const char* subform_path);
63
63
 
@@ -501,16 +501,17 @@ void JsonEvalBridge::getEvaluatedSchemaByPathsAsync(
501
501
  const std::string& handleId,
502
502
  const std::string& pathsJson,
503
503
  bool skipLayout,
504
+ int format,
504
505
  std::function<void(const std::string&, const std::string&)> callback
505
506
  ) {
506
- runAsync([handleId, pathsJson, skipLayout]() -> std::string {
507
+ runAsync([handleId, pathsJson, skipLayout, format]() -> std::string {
507
508
  std::lock_guard<std::mutex> lock(handlesMutex);
508
509
  auto it = handles.find(handleId);
509
510
  if (it == handles.end()) {
510
511
  throw std::runtime_error("Invalid handle");
511
512
  }
512
513
 
513
- FFIResult result = json_eval_get_evaluated_schema_by_paths(it->second, pathsJson.c_str(), skipLayout);
514
+ FFIResult result = json_eval_get_evaluated_schema_by_paths(it->second, pathsJson.c_str(), skipLayout, static_cast<uint8_t>(format));
514
515
 
515
516
  if (!result.success) {
516
517
  std::string error = result.error ? result.error : "Unknown error";
@@ -565,16 +566,17 @@ void JsonEvalBridge::getSchemaByPathAsync(
565
566
  void JsonEvalBridge::getSchemaByPathsAsync(
566
567
  const std::string& handleId,
567
568
  const std::string& pathsJson,
569
+ int format,
568
570
  std::function<void(const std::string&, const std::string&)> callback
569
571
  ) {
570
- runAsync([handleId, pathsJson]() -> std::string {
572
+ runAsync([handleId, pathsJson, format]() -> std::string {
571
573
  std::lock_guard<std::mutex> lock(handlesMutex);
572
574
  auto it = handles.find(handleId);
573
575
  if (it == handles.end()) {
574
576
  throw std::runtime_error("Invalid handle");
575
577
  }
576
578
 
577
- FFIResult result = json_eval_get_schema_by_paths(it->second, pathsJson.c_str());
579
+ FFIResult result = json_eval_get_schema_by_paths(it->second, pathsJson.c_str(), static_cast<uint8_t>(format));
578
580
 
579
581
  if (!result.success) {
580
582
  std::string error = result.error ? result.error : "Unknown error";
@@ -1195,16 +1197,17 @@ void JsonEvalBridge::getEvaluatedSchemaByPathsSubformAsync(
1195
1197
  const std::string& subformPath,
1196
1198
  const std::string& schemaPathsJson,
1197
1199
  bool skipLayout,
1200
+ int format,
1198
1201
  std::function<void(const std::string&, const std::string&)> callback
1199
1202
  ) {
1200
- runAsync([handleId, subformPath, schemaPathsJson, skipLayout]() -> std::string {
1203
+ runAsync([handleId, subformPath, schemaPathsJson, skipLayout, format]() -> std::string {
1201
1204
  std::lock_guard<std::mutex> lock(handlesMutex);
1202
1205
  auto it = handles.find(handleId);
1203
1206
  if (it == handles.end()) {
1204
1207
  throw std::runtime_error("Invalid handle");
1205
1208
  }
1206
1209
 
1207
- FFIResult result = json_eval_get_evaluated_schema_by_paths_subform(it->second, subformPath.c_str(), schemaPathsJson.c_str(), skipLayout);
1210
+ FFIResult result = json_eval_get_evaluated_schema_by_paths_subform(it->second, subformPath.c_str(), schemaPathsJson.c_str(), skipLayout, static_cast<uint8_t>(format));
1208
1211
 
1209
1212
  if (!result.success) {
1210
1213
  std::string error = result.error ? result.error : "Unknown error";
@@ -1289,16 +1292,17 @@ void JsonEvalBridge::getSchemaByPathsSubformAsync(
1289
1292
  const std::string& handleId,
1290
1293
  const std::string& subformPath,
1291
1294
  const std::string& schemaPathsJson,
1295
+ int format,
1292
1296
  std::function<void(const std::string&, const std::string&)> callback
1293
1297
  ) {
1294
- runAsync([handleId, subformPath, schemaPathsJson]() -> std::string {
1298
+ runAsync([handleId, subformPath, schemaPathsJson, format]() -> std::string {
1295
1299
  std::lock_guard<std::mutex> lock(handlesMutex);
1296
1300
  auto it = handles.find(handleId);
1297
1301
  if (it == handles.end()) {
1298
1302
  throw std::runtime_error("Invalid handle");
1299
1303
  }
1300
1304
 
1301
- FFIResult result = json_eval_get_schema_by_paths_subform(it->second, subformPath.c_str(), schemaPathsJson.c_str());
1305
+ FFIResult result = json_eval_get_schema_by_paths_subform(it->second, subformPath.c_str(), schemaPathsJson.c_str(), static_cast<uint8_t>(format));
1302
1306
 
1303
1307
  if (!result.success) {
1304
1308
  std::string error = result.error ? result.error : "Unknown error";
@@ -163,12 +163,14 @@ public:
163
163
  * @param handle Instance handle
164
164
  * @param pathsJson JSON array of dotted paths to retrieve
165
165
  * @param skipLayout Whether to skip layout resolution
166
+ * @param format Return format (0=Nested, 1=Flat, 2=Array)
166
167
  * @param callback Result callback
167
168
  */
168
169
  static void getEvaluatedSchemaByPathsAsync(
169
170
  const std::string& handle,
170
171
  const std::string& pathsJson,
171
172
  bool skipLayout,
173
+ int format,
172
174
  std::function<void(const std::string&, const std::string&)> callback
173
175
  );
174
176
 
@@ -188,11 +190,13 @@ public:
188
190
  * Get values from schema using multiple dotted path notations (async)
189
191
  * @param handle Instance handle
190
192
  * @param pathsJson JSON array of dotted paths to retrieve
193
+ * @param format Return format (0=Nested, 1=Flat, 2=Array)
191
194
  * @param callback Result callback
192
195
  */
193
196
  static void getSchemaByPathsAsync(
194
197
  const std::string& handle,
195
198
  const std::string& pathsJson,
199
+ int format,
196
200
  std::function<void(const std::string&, const std::string&)> callback
197
201
  );
198
202
 
@@ -502,6 +506,7 @@ public:
502
506
  * @param subformPath Path to the subform
503
507
  * @param schemaPathsJson JSON array of dotted paths to retrieve within the subform
504
508
  * @param skipLayout Whether to skip layout resolution
509
+ * @param format Return format (0=Nested, 1=Flat, 2=Array)
505
510
  * @param callback Result callback
506
511
  */
507
512
  static void getEvaluatedSchemaByPathsSubformAsync(
@@ -509,6 +514,7 @@ public:
509
514
  const std::string& subformPath,
510
515
  const std::string& schemaPathsJson,
511
516
  bool skipLayout,
517
+ int format,
512
518
  std::function<void(const std::string&, const std::string&)> callback
513
519
  );
514
520
 
@@ -541,12 +547,14 @@ public:
541
547
  * @param handleId Instance handle
542
548
  * @param subformPath Path to the subform
543
549
  * @param schemaPathsJson JSON array of dotted paths to retrieve within the subform
550
+ * @param format Return format (0=Nested, 1=Flat, 2=Array)
544
551
  * @param callback Result callback
545
552
  */
546
553
  static void getSchemaByPathsSubformAsync(
547
554
  const std::string& handleId,
548
555
  const std::string& subformPath,
549
556
  const std::string& schemaPathsJson,
557
+ int format,
550
558
  std::function<void(const std::string&, const std::string&)> callback
551
559
  );
552
560
 
package/ios/JsonEvalRs.mm CHANGED
@@ -260,13 +260,14 @@ RCT_EXPORT_METHOD(getEvaluatedSchemaByPath:(NSString *)handle
260
260
  RCT_EXPORT_METHOD(getEvaluatedSchemaByPaths:(NSString *)handle
261
261
  pathsJson:(NSString *)pathsJson
262
262
  skipLayout:(BOOL)skipLayout
263
+ format:(NSInteger)format
263
264
  resolver:(RCTPromiseResolveBlock)resolve
264
265
  rejecter:(RCTPromiseRejectBlock)reject)
265
266
  {
266
267
  std::string handleStr = [self stdStringFromNSString:handle];
267
268
  std::string pathsJsonStr = [self stdStringFromNSString:pathsJson];
268
269
 
269
- JsonEvalBridge::getEvaluatedSchemaByPathsAsync(handleStr, pathsJsonStr, skipLayout,
270
+ JsonEvalBridge::getEvaluatedSchemaByPathsAsync(handleStr, pathsJsonStr, skipLayout, static_cast<int>(format),
270
271
  [resolve, reject](const std::string& result, const std::string& error) {
271
272
  if (error.empty()) {
272
273
  resolve([NSString stringWithUTF8String:result.c_str()]);
@@ -298,13 +299,14 @@ RCT_EXPORT_METHOD(getSchemaByPath:(NSString *)handle
298
299
 
299
300
  RCT_EXPORT_METHOD(getSchemaByPaths:(NSString *)handle
300
301
  pathsJson:(NSString *)pathsJson
302
+ format:(NSInteger)format
301
303
  resolver:(RCTPromiseResolveBlock)resolve
302
304
  rejecter:(RCTPromiseRejectBlock)reject)
303
305
  {
304
306
  std::string handleStr = [self stdStringFromNSString:handle];
305
307
  std::string pathsJsonStr = [self stdStringFromNSString:pathsJson];
306
308
 
307
- JsonEvalBridge::getSchemaByPathsAsync(handleStr, pathsJsonStr,
309
+ JsonEvalBridge::getSchemaByPathsAsync(handleStr, pathsJsonStr, static_cast<int>(format),
308
310
  [resolve, reject](const std::string& result, const std::string& error) {
309
311
  if (error.empty()) {
310
312
  resolve([NSString stringWithUTF8String:result.c_str()]);
@@ -727,6 +729,7 @@ RCT_EXPORT_METHOD(getEvaluatedSchemaByPathsSubform:(NSString *)handle
727
729
  subformPath:(NSString *)subformPath
728
730
  schemaPathsJson:(NSString *)schemaPathsJson
729
731
  skipLayout:(BOOL)skipLayout
732
+ format:(NSInteger)format
730
733
  resolver:(RCTPromiseResolveBlock)resolve
731
734
  rejecter:(RCTPromiseRejectBlock)reject)
732
735
  {
@@ -734,7 +737,7 @@ RCT_EXPORT_METHOD(getEvaluatedSchemaByPathsSubform:(NSString *)handle
734
737
  std::string subformPathStr = [self stdStringFromNSString:subformPath];
735
738
  std::string schemaPathsJsonStr = [self stdStringFromNSString:schemaPathsJson];
736
739
 
737
- JsonEvalBridge::getEvaluatedSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, skipLayout,
740
+ JsonEvalBridge::getEvaluatedSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, skipLayout, static_cast<int>(format),
738
741
  [resolve, reject](const std::string& result, const std::string& error) {
739
742
  if (error.empty()) {
740
743
  resolve([NSString stringWithUTF8String:result.c_str()]);
@@ -786,6 +789,7 @@ RCT_EXPORT_METHOD(getSchemaByPathSubform:(NSString *)handle
786
789
  RCT_EXPORT_METHOD(getSchemaByPathsSubform:(NSString *)handle
787
790
  subformPath:(NSString *)subformPath
788
791
  schemaPathsJson:(NSString *)schemaPathsJson
792
+ format:(NSInteger)format
789
793
  resolver:(RCTPromiseResolveBlock)resolve
790
794
  rejecter:(RCTPromiseRejectBlock)reject)
791
795
  {
@@ -793,7 +797,7 @@ RCT_EXPORT_METHOD(getSchemaByPathsSubform:(NSString *)handle
793
797
  std::string subformPathStr = [self stdStringFromNSString:subformPath];
794
798
  std::string schemaPathsJsonStr = [self stdStringFromNSString:schemaPathsJson];
795
799
 
796
- JsonEvalBridge::getSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr,
800
+ JsonEvalBridge::getSchemaByPathsSubformAsync(handleStr, subformPathStr, schemaPathsJsonStr, static_cast<int>(format),
797
801
  [resolve, reject](const std::string& result, const std::string& error) {
798
802
  if (error.empty()) {
799
803
  resolve([NSString stringWithUTF8String:result.c_str()]);
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libjson_eval_rs.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_x86_64-simulator</string>
11
+ <string>ios-arm64</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libjson_eval_rs.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
- <string>x86_64</string>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>libjson_eval_rs.a</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>libjson_eval_rs.a</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.multiply = exports.default = exports.JSONEval = void 0;
6
+ exports.multiply = exports.default = exports.ReturnFormat = exports.JSONEval = void 0;
7
7
  exports.useJSONEval = useJSONEval;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactNative = require("react-native");
@@ -18,78 +18,72 @@ const JsonEvalRs = _reactNative.NativeModules.JsonEvalRs ? _reactNative.NativeMo
18
18
  }
19
19
  });
20
20
 
21
+ /**
22
+ * Return format for path-based methods
23
+ */
24
+ let ReturnFormat = exports.ReturnFormat = /*#__PURE__*/function (ReturnFormat) {
25
+ /** Nested object preserving the path hierarchy (default) */
26
+ ReturnFormat[ReturnFormat["Nested"] = 0] = "Nested";
27
+ /** Flat object with dotted keys */
28
+ ReturnFormat[ReturnFormat["Flat"] = 1] = "Flat";
29
+ /** Array of values in the order of requested paths */
30
+ ReturnFormat[ReturnFormat["Array"] = 2] = "Array";
31
+ return ReturnFormat;
32
+ }({});
21
33
  /**
22
34
  * Validation error for a specific field
23
35
  */
24
-
25
36
  /**
26
37
  * Result of validation operation
27
38
  */
28
-
29
39
  /**
30
40
  * Dependent field change from evaluateDependents
31
41
  */
32
-
33
42
  /**
34
43
  * Options for creating a JSONEval instance
35
44
  */
36
-
37
45
  /**
38
46
  * Options for evaluation
39
47
  */
40
-
41
48
  /**
42
49
  * Options for validation with path filtering
43
50
  */
44
-
45
51
  /**
46
52
  * Cache statistics
47
53
  */
48
-
49
54
  /**
50
55
  * Options for evaluating dependents
51
56
  */
52
-
53
57
  /**
54
58
  * Options for evaluating a subform
55
59
  */
56
-
57
60
  /**
58
61
  * Options for validating a subform
59
62
  */
60
-
61
63
  /**
62
64
  * Options for evaluating dependents in a subform
63
65
  */
64
-
65
66
  /**
66
67
  * Options for resolving layout in a subform
67
68
  */
68
-
69
69
  /**
70
70
  * Options for getting evaluated schema from a subform
71
71
  */
72
-
73
72
  /**
74
73
  * Options for getting schema value from a subform
75
74
  */
76
-
77
75
  /**
78
76
  * Options for getting evaluated schema by path from a subform
79
77
  */
80
-
81
78
  /**
82
79
  * Options for getting evaluated schema by multiple paths from a subform
83
80
  */
84
-
85
81
  /**
86
82
  * Options for getting schema by path from a subform
87
83
  */
88
-
89
84
  /**
90
85
  * Options for getting schema by multiple paths from a subform
91
86
  */
92
-
93
87
  /**
94
88
  * High-performance JSON Logic evaluator with schema validation for React Native
95
89
  *
@@ -315,16 +309,17 @@ class JSONEval {
315
309
 
316
310
  /**
317
311
  * Get values from the evaluated schema using multiple dotted path notations
318
- * Returns a merged object containing all requested paths (skips paths that are not found)
312
+ * Returns data in the specified format (skips paths that are not found)
319
313
  * @param paths - Array of dotted paths to retrieve
320
314
  * @param skipLayout - Whether to skip layout resolution
321
- * @returns Promise resolving to merged object containing all found paths
315
+ * @param format - Return format (Nested, Flat, or Array)
316
+ * @returns Promise resolving to data in the specified format
322
317
  * @throws {Error} If operation fails
323
318
  */
324
- async getEvaluatedSchemaByPaths(paths, skipLayout = false) {
319
+ async getEvaluatedSchemaByPaths(paths, skipLayout = false, format = ReturnFormat.Nested) {
325
320
  this.throwIfDisposed();
326
321
  const pathsJson = JSON.stringify(paths);
327
- const resultStr = await JsonEvalRs.getEvaluatedSchemaByPaths(this.handle, pathsJson, skipLayout);
322
+ const resultStr = await JsonEvalRs.getEvaluatedSchemaByPaths(this.handle, pathsJson, skipLayout, format);
328
323
  return JSON.parse(resultStr);
329
324
  }
330
325
 
@@ -342,15 +337,16 @@ class JSONEval {
342
337
 
343
338
  /**
344
339
  * Get values from the schema using multiple dotted path notations
345
- * Returns a merged object containing all requested paths (skips paths that are not found)
340
+ * Returns data in the specified format (skips paths that are not found)
346
341
  * @param paths - Array of dotted paths to retrieve
347
- * @returns Promise resolving to merged object containing all found paths
342
+ * @param format - Return format (Nested, Flat, or Array)
343
+ * @returns Promise resolving to data in the specified format
348
344
  * @throws {Error} If operation fails
349
345
  */
350
- async getSchemaByPaths(paths) {
346
+ async getSchemaByPaths(paths, format = ReturnFormat.Nested) {
351
347
  this.throwIfDisposed();
352
348
  const pathsJson = JSON.stringify(paths);
353
- const resultStr = await JsonEvalRs.getSchemaByPaths(this.handle, pathsJson);
349
+ const resultStr = await JsonEvalRs.getSchemaByPaths(this.handle, pathsJson, format);
354
350
  return JSON.parse(resultStr);
355
351
  }
356
352
 
@@ -661,15 +657,15 @@ class JSONEval {
661
657
 
662
658
  /**
663
659
  * Get evaluated schema by multiple paths from subform
664
- * Returns a merged object containing all requested paths (skips paths that are not found)
665
- * @param options - Options including subform path, array of schema paths, and skipLayout flag
666
- * @returns Promise resolving to merged object containing all found paths
660
+ * Returns data in the specified format (skips paths that are not found)
661
+ * @param options - Options including subform path, array of schema paths, skipLayout flag, and format
662
+ * @returns Promise resolving to data in the specified format
667
663
  * @throws {Error} If operation fails
668
664
  */
669
665
  async getEvaluatedSchemaByPathsSubform(options) {
670
666
  this.throwIfDisposed();
671
667
  const pathsJson = JSON.stringify(options.schemaPaths);
672
- const resultStr = await JsonEvalRs.getEvaluatedSchemaByPathsSubform(this.handle, options.subformPath, pathsJson, options.skipLayout || false);
668
+ const resultStr = await JsonEvalRs.getEvaluatedSchemaByPathsSubform(this.handle, options.subformPath, pathsJson, options.skipLayout || false, options.format !== undefined ? options.format : ReturnFormat.Nested);
673
669
  return JSON.parse(resultStr);
674
670
  }
675
671
 
@@ -698,15 +694,15 @@ class JSONEval {
698
694
 
699
695
  /**
700
696
  * Get schema values by multiple paths from subform
701
- * Returns a merged object containing all requested paths (skips paths that are not found)
702
- * @param options - Options including subform path and array of schema paths
703
- * @returns Promise resolving to merged object containing all found paths
697
+ * Returns data in the specified format (skips paths that are not found)
698
+ * @param options - Options including subform path, array of schema paths, and format
699
+ * @returns Promise resolving to data in the specified format
704
700
  * @throws {Error} If operation fails
705
701
  */
706
702
  async getSchemaByPathsSubform(options) {
707
703
  this.throwIfDisposed();
708
704
  const pathsJson = JSON.stringify(options.schemaPaths);
709
- const resultStr = await JsonEvalRs.getSchemaByPathsSubform(this.handle, options.subformPath, pathsJson);
705
+ const resultStr = await JsonEvalRs.getSchemaByPathsSubform(this.handle, options.subformPath, pathsJson, options.format !== undefined ? options.format : ReturnFormat.Nested);
710
706
  return JSON.parse(resultStr);
711
707
  }
712
708