@leanmcp/ui 0.2.0 → 0.2.1
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.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -459,7 +459,14 @@ function extractResultData(result) {
|
|
|
459
459
|
const textContent = result.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|
|
460
460
|
if (textContent) {
|
|
461
461
|
try {
|
|
462
|
-
|
|
462
|
+
const parsed = JSON.parse(textContent);
|
|
463
|
+
if (parsed && typeof parsed === "object" && "content" in parsed && Array.isArray(parsed.content)) {
|
|
464
|
+
const nested = extractResultData(parsed);
|
|
465
|
+
if (nested !== null) {
|
|
466
|
+
return nested;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return parsed;
|
|
463
470
|
} catch {
|
|
464
471
|
return textContent;
|
|
465
472
|
}
|
|
@@ -1840,6 +1847,9 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
1840
1847
|
50,
|
|
1841
1848
|
100
|
|
1842
1849
|
], defaultPageSize = 10, defaultSort, refreshInterval, showRefresh = true, onDataLoaded, onError, onRowClick, getRowKey, emptyContent, loadingContent, className }) {
|
|
1850
|
+
if (!dataTool) {
|
|
1851
|
+
throw new Error("ToolDataGrid: dataTool prop is required");
|
|
1852
|
+
}
|
|
1843
1853
|
const toolConfig = typeof dataTool === "string" ? {
|
|
1844
1854
|
name: dataTool
|
|
1845
1855
|
} : dataTool;
|
|
@@ -2069,6 +2079,9 @@ function ToolDataGrid({ dataTool, columns, transformData, rowActions = [], pagin
|
|
|
2069
2079
|
}
|
|
2070
2080
|
__name(ToolDataGrid, "ToolDataGrid");
|
|
2071
2081
|
function RowActionButton({ action, row, onRefresh }) {
|
|
2082
|
+
if (!action.tool) {
|
|
2083
|
+
throw new Error("ToolDataGrid: rowAction.tool is required");
|
|
2084
|
+
}
|
|
2072
2085
|
const toolConfig = typeof action.tool === "string" ? {
|
|
2073
2086
|
name: action.tool
|
|
2074
2087
|
} : action.tool;
|