@sellable/mcp 0.1.296 → 0.1.297
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/tools/rows.js +19 -1
- package/package.json +1 -1
package/dist/tools/rows.js
CHANGED
|
@@ -97,7 +97,25 @@ export async function getTableRowsMinimal(tableId, options) {
|
|
|
97
97
|
return api.get(path);
|
|
98
98
|
}
|
|
99
99
|
export function normalizeRowIds(rowIds) {
|
|
100
|
-
|
|
100
|
+
if (Array.isArray(rowIds)) {
|
|
101
|
+
return rowIds.map((rowId) => rowId.trim()).filter(Boolean);
|
|
102
|
+
}
|
|
103
|
+
const trimmed = rowIds.trim();
|
|
104
|
+
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
105
|
+
try {
|
|
106
|
+
const parsed = JSON.parse(trimmed);
|
|
107
|
+
if (Array.isArray(parsed)) {
|
|
108
|
+
return parsed
|
|
109
|
+
.filter((rowId) => typeof rowId === "string")
|
|
110
|
+
.map((rowId) => rowId.trim())
|
|
111
|
+
.filter(Boolean);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Fall through to comma-splitting for malformed JSON-like input.
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const rawIds = rowIds.split(",");
|
|
101
119
|
return rawIds.map((rowId) => rowId.trim()).filter(Boolean);
|
|
102
120
|
}
|
|
103
121
|
export async function getRows(tableId, rowIds) {
|