@stackfactor/agent-utils 1.0.12 → 1.0.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAkSQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAufF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCA5YO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDAisBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CAjwB8B,GAAG,KAAG,MAAM;;AA4zBzD,wBAOE"}
1
+ {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAmSQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
@@ -27,34 +27,36 @@ Do NOT include raw newlines, tabs, or unescaped quotes inside JSON string values
27
27
  * Each failing field is described with its dot-notation path and a contextual message
28
28
  * that depends on the Zod error code (e.g. `invalid_type`, `too_small`, `invalid_enum_value`).
29
29
  * The output is prefixed with `"Schema validation failed:"` followed by a bulleted list.
30
- * @param zodError - The Zod `ZodError` instance whose `errors` array will be formatted
30
+ * @param zodError - The Zod `ZodError` instance whose `issues` array will be formatted
31
31
  * @returns A formatted string describing all validation failures
32
32
  */
33
33
  const formatZodErrors = (zodError) => {
34
- const errors = zodError.errors.map((err) => {
35
- const path = err.path.length > 0 ? err.path.join(".") : "root";
36
- // Provide more context based on error type
37
- switch (err.code) {
38
- case "invalid_type":
39
- return `Field "${path}": Expected ${err.expected}, but received ${err.received}`;
40
- case "invalid_literal":
41
- return `Field "${path}": Expected literal value ${JSON.stringify(err.expected)}, but received ${JSON.stringify(err.received)}`;
42
- case "unrecognized_keys":
43
- return `Field "${path}": Unrecognized keys: ${err.keys.join(", ")}`;
44
- case "invalid_union":
45
- return `Field "${path}": Invalid union - none of the expected types matched`;
46
- case "invalid_enum_value":
47
- return `Field "${path}": Invalid enum value. Expected one of: ${err.options.join(", ")}`;
48
- case "invalid_string":
49
- return `Field "${path}": Invalid string format (${err.validation})`;
50
- case "too_small":
51
- return `Field "${path}": Value is too small (minimum: ${err.minimum})`;
52
- case "too_big":
53
- return `Field "${path}": Value is too large (maximum: ${err.maximum})`;
54
- default:
55
- return `Field "${path}": ${err.message}`;
56
- }
57
- });
34
+ const errors = zodError.issues
35
+ ? zodError.issues.map((err) => {
36
+ const path = err.path.length > 0 ? err.path.join(".") : "root";
37
+ // Provide more context based on error type
38
+ switch (err.code) {
39
+ case "invalid_type":
40
+ return `Field "${path}": Expected ${err.expected}, but received ${err.received}`;
41
+ case "invalid_literal":
42
+ return `Field "${path}": Expected literal value ${JSON.stringify(err.expected)}, but received ${JSON.stringify(err.received)}`;
43
+ case "unrecognized_keys":
44
+ return `Field "${path}": Unrecognized keys: ${err.keys.join(", ")}`;
45
+ case "invalid_union":
46
+ return `Field "${path}": Invalid union - none of the expected types matched`;
47
+ case "invalid_enum_value":
48
+ return `Field "${path}": Invalid enum value. Expected one of: ${err.options.join(", ")}`;
49
+ case "invalid_string":
50
+ return `Field "${path}": Invalid string format (${err.validation})`;
51
+ case "too_small":
52
+ return `Field "${path}": Value is too small (minimum: ${err.minimum})`;
53
+ case "too_big":
54
+ return `Field "${path}": Value is too large (maximum: ${err.maximum})`;
55
+ default:
56
+ return `Field "${path}": ${err.message}`;
57
+ }
58
+ })
59
+ : [];
58
60
  return `Schema validation failed:\n - ${errors.join("\n - ")}`;
59
61
  };
60
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAkSQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAufF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCA5YO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDAisBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CAjwB8B,GAAG,KAAG,MAAM;;AA4zBzD,wBAOE"}
1
+ {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAmSQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
@@ -22,34 +22,36 @@ Do NOT include raw newlines, tabs, or unescaped quotes inside JSON string values
22
22
  * Each failing field is described with its dot-notation path and a contextual message
23
23
  * that depends on the Zod error code (e.g. `invalid_type`, `too_small`, `invalid_enum_value`).
24
24
  * The output is prefixed with `"Schema validation failed:"` followed by a bulleted list.
25
- * @param zodError - The Zod `ZodError` instance whose `errors` array will be formatted
25
+ * @param zodError - The Zod `ZodError` instance whose `issues` array will be formatted
26
26
  * @returns A formatted string describing all validation failures
27
27
  */
28
28
  const formatZodErrors = (zodError) => {
29
- const errors = zodError.errors.map((err) => {
30
- const path = err.path.length > 0 ? err.path.join(".") : "root";
31
- // Provide more context based on error type
32
- switch (err.code) {
33
- case "invalid_type":
34
- return `Field "${path}": Expected ${err.expected}, but received ${err.received}`;
35
- case "invalid_literal":
36
- return `Field "${path}": Expected literal value ${JSON.stringify(err.expected)}, but received ${JSON.stringify(err.received)}`;
37
- case "unrecognized_keys":
38
- return `Field "${path}": Unrecognized keys: ${err.keys.join(", ")}`;
39
- case "invalid_union":
40
- return `Field "${path}": Invalid union - none of the expected types matched`;
41
- case "invalid_enum_value":
42
- return `Field "${path}": Invalid enum value. Expected one of: ${err.options.join(", ")}`;
43
- case "invalid_string":
44
- return `Field "${path}": Invalid string format (${err.validation})`;
45
- case "too_small":
46
- return `Field "${path}": Value is too small (minimum: ${err.minimum})`;
47
- case "too_big":
48
- return `Field "${path}": Value is too large (maximum: ${err.maximum})`;
49
- default:
50
- return `Field "${path}": ${err.message}`;
51
- }
52
- });
29
+ const errors = zodError.issues
30
+ ? zodError.issues.map((err) => {
31
+ const path = err.path.length > 0 ? err.path.join(".") : "root";
32
+ // Provide more context based on error type
33
+ switch (err.code) {
34
+ case "invalid_type":
35
+ return `Field "${path}": Expected ${err.expected}, but received ${err.received}`;
36
+ case "invalid_literal":
37
+ return `Field "${path}": Expected literal value ${JSON.stringify(err.expected)}, but received ${JSON.stringify(err.received)}`;
38
+ case "unrecognized_keys":
39
+ return `Field "${path}": Unrecognized keys: ${err.keys.join(", ")}`;
40
+ case "invalid_union":
41
+ return `Field "${path}": Invalid union - none of the expected types matched`;
42
+ case "invalid_enum_value":
43
+ return `Field "${path}": Invalid enum value. Expected one of: ${err.options.join(", ")}`;
44
+ case "invalid_string":
45
+ return `Field "${path}": Invalid string format (${err.validation})`;
46
+ case "too_small":
47
+ return `Field "${path}": Value is too small (minimum: ${err.minimum})`;
48
+ case "too_big":
49
+ return `Field "${path}": Value is too large (maximum: ${err.maximum})`;
50
+ default:
51
+ return `Field "${path}": ${err.message}`;
52
+ }
53
+ })
54
+ : [];
53
55
  return `Schema validation failed:\n - ${errors.join("\n - ")}`;
54
56
  };
55
57
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "restricted"
5
5
  },
6
- "version": "1.0.12",
6
+ "version": "1.0.13",
7
7
  "description": "",
8
8
  "main": "dist/cjs/index.js",
9
9
  "module": "dist/esm/index.js",