@renai-labs/sdk 0.1.19 → 0.1.21
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/error.js +11 -0
- package/dist/generated/@tanstack/react-query.gen.d.ts +635 -107
- package/dist/generated/@tanstack/react-query.gen.js +510 -60
- package/dist/generated/internal/types.gen.d.ts +328 -21
- package/dist/generated/sdk.gen.d.ts +175 -33
- package/dist/generated/sdk.gen.js +349 -68
- package/dist/generated/types.gen.d.ts +2153 -1621
- package/dist/generated/zod.gen.d.ts +7375 -3891
- package/dist/generated/zod.gen.js +1004 -868
- package/package.json +2 -2
package/dist/error.js
CHANGED
|
@@ -17,11 +17,22 @@ export class ApiError extends Error {
|
|
|
17
17
|
export function isApiError(value) {
|
|
18
18
|
return value instanceof ApiError;
|
|
19
19
|
}
|
|
20
|
+
function formatIssues(issues) {
|
|
21
|
+
const parts = issues
|
|
22
|
+
.filter((issue) => issue && typeof issue === "object")
|
|
23
|
+
.map((issue) => {
|
|
24
|
+
const where = issue.path && issue.path.length > 0 ? issue.path.join(".") : "body";
|
|
25
|
+
return `${where}: ${issue.message ?? "invalid"}`;
|
|
26
|
+
});
|
|
27
|
+
return parts.length > 0 ? `validation failed — ${parts.join("; ")}` : undefined;
|
|
28
|
+
}
|
|
20
29
|
function extractDetail(body) {
|
|
21
30
|
if (body && typeof body === "object" && "error" in body) {
|
|
22
31
|
const detail = body.error;
|
|
23
32
|
if (typeof detail === "string" && detail.trim())
|
|
24
33
|
return detail;
|
|
34
|
+
if (Array.isArray(detail))
|
|
35
|
+
return formatIssues(detail);
|
|
25
36
|
}
|
|
26
37
|
return undefined;
|
|
27
38
|
}
|