byteplan-cli 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "byteplan-cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "BytePlan CLI - Command line tool for BytePlan API",
5
5
  "keywords": [
6
6
  "byteplan",
package/src/cli.js CHANGED
@@ -246,13 +246,15 @@ dataCmd
246
246
  pageSize: parseInt(options.size),
247
247
  });
248
248
 
249
+ // result.data 可能是数组(直接数据)或对象(包含 data 子字段)
250
+ const rows = Array.isArray(result.data) ? result.data : (result.data?.data || []);
249
251
  printJSON({
250
- headers: result.data?.headers || [],
251
- data: result.data?.data || [],
252
+ headers: result.headers || result.data?.headers || [],
253
+ data: rows,
252
254
  pagination: {
253
- pageNum: result.data?.pageNum || parseInt(options.page),
254
- pageSize: result.data?.pageSize || parseInt(options.size),
255
- total: result.data?.total || 0,
255
+ pageNum: result.pageNum || result.data?.pageNum || parseInt(options.page),
256
+ pageSize: result.pageSize || result.data?.pageSize || parseInt(options.size),
257
+ total: result.total || result.data?.total || 0,
256
258
  },
257
259
  });
258
260
  } catch (error) {