@kortexya/reasoninglayer 0.7.0 → 0.8.0

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.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // src/config.ts
4
- var SDK_VERSION = "0.7.0";
4
+ var SDK_VERSION = "0.8.0";
5
5
  function resolveConfig(config) {
6
6
  if (!config.baseUrl) {
7
7
  throw new Error("ClientConfig.baseUrl is required");
@@ -530,6 +530,28 @@ var HttpClient = class {
530
530
  };
531
531
 
532
532
  // src/serialization.ts
533
+ var USER_DATA_FIELDS = /* @__PURE__ */ new Set([
534
+ // features — term/query feature maps (Record<string, ValueDto>)
535
+ "features",
536
+ // bindings — variable binding maps
537
+ "bindings",
538
+ // evidence — causal evidence maps
539
+ "evidence",
540
+ // exogenous values — causal intervention values
541
+ "exogenous_values",
542
+ "exogenousValues",
543
+ // modified/suggested params — action review params
544
+ "modified_params",
545
+ "modifiedParams",
546
+ "suggested_params",
547
+ "suggestedParams",
548
+ // match key — row matching keys
549
+ "match_key",
550
+ "matchKey",
551
+ // concept values — RAG concept values
552
+ "concept_values",
553
+ "conceptValues"
554
+ ]);
533
555
  function camelToSnake(str) {
534
556
  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
535
557
  }
@@ -541,6 +563,19 @@ function isPlainObject(value) {
541
563
  const proto = Object.getPrototypeOf(value);
542
564
  return proto === Object.prototype || proto === null;
543
565
  }
566
+ function transformUserDataRecord(input, transformFn) {
567
+ if (Array.isArray(input)) {
568
+ return input.map((item) => transformFn(item));
569
+ }
570
+ if (!isPlainObject(input)) {
571
+ return input;
572
+ }
573
+ const result = {};
574
+ for (const key of Object.keys(input)) {
575
+ result[key] = transformFn(input[key]);
576
+ }
577
+ return result;
578
+ }
544
579
  function toSnakeCase(input) {
545
580
  if (Array.isArray(input)) {
546
581
  return input.map((item) => toSnakeCase(item));
@@ -550,7 +585,12 @@ function toSnakeCase(input) {
550
585
  }
551
586
  const result = {};
552
587
  for (const key of Object.keys(input)) {
553
- result[camelToSnake(key)] = toSnakeCase(input[key]);
588
+ const snakeKey = camelToSnake(key);
589
+ if (USER_DATA_FIELDS.has(key)) {
590
+ result[snakeKey] = transformUserDataRecord(input[key], toSnakeCase);
591
+ } else {
592
+ result[snakeKey] = toSnakeCase(input[key]);
593
+ }
554
594
  }
555
595
  return result;
556
596
  }
@@ -563,7 +603,12 @@ function toCamelCase(input) {
563
603
  }
564
604
  const result = {};
565
605
  for (const key of Object.keys(input)) {
566
- result[snakeToCamel(key)] = toCamelCase(input[key]);
606
+ const camelKey = snakeToCamel(key);
607
+ if (USER_DATA_FIELDS.has(key)) {
608
+ result[camelKey] = transformUserDataRecord(input[key], toCamelCase);
609
+ } else {
610
+ result[camelKey] = toCamelCase(input[key]);
611
+ }
567
612
  }
568
613
  return result;
569
614
  }