@aicoin/opendata-mcp 1.0.23 → 1.0.24
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/build/index.js +47 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -170,6 +170,31 @@ function okList(data, max = 50) {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
return ok(data);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const inner = obj.data;
|
|
177
|
+
if (inner && typeof inner === "object") {
|
|
178
|
+
const d = inner;
|
|
179
|
+
for (const k of LIST_KEYS) {
|
|
180
|
+
if (Array.isArray(d[k])) {
|
|
181
|
+
const arr = d[k];
|
|
182
|
+
if (arr.length > max) {
|
|
183
|
+
return ok({
|
|
184
|
+
...obj,
|
|
185
|
+
data: {
|
|
186
|
+
...d,
|
|
187
|
+
[k]: arr.slice(0, max)
|
|
188
|
+
},
|
|
189
|
+
_truncated: {
|
|
190
|
+
field: `data.${k}`,
|
|
191
|
+
total: arr.length,
|
|
192
|
+
showing: max
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return ok(data);
|
|
197
|
+
}
|
|
173
198
|
}
|
|
174
199
|
}
|
|
175
200
|
}
|
|
@@ -263,6 +288,28 @@ function okListDeep(data, max = 5, innerMax = 20) {
|
|
|
263
288
|
});
|
|
264
289
|
}
|
|
265
290
|
}
|
|
291
|
+
const inner = obj.data;
|
|
292
|
+
if (inner && typeof inner === "object") {
|
|
293
|
+
const d = inner;
|
|
294
|
+
for (const k of LIST_KEYS) {
|
|
295
|
+
if (Array.isArray(d[k])) {
|
|
296
|
+
const arr = d[k];
|
|
297
|
+
const result = truncDeep(arr);
|
|
298
|
+
return ok({
|
|
299
|
+
...obj,
|
|
300
|
+
data: {
|
|
301
|
+
...d,
|
|
302
|
+
[k]: Array.isArray(result) ? result : result.data
|
|
303
|
+
},
|
|
304
|
+
_truncated: Array.isArray(result) ? void 0 : {
|
|
305
|
+
field: `data.${k}`,
|
|
306
|
+
total: arr.length,
|
|
307
|
+
showing: max
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
266
313
|
}
|
|
267
314
|
return ok(data);
|
|
268
315
|
}
|