@hcmai/sdk 0.25.0 → 0.25.2

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 CHANGED
@@ -4533,10 +4533,21 @@ async function listWorkspaceFiles(http, workspaceKey, options = {}) {
4533
4533
  order: "relativePath:asc"
4534
4534
  }
4535
4535
  });
4536
- const content = Array.isArray(resp.data?.content) ? resp.data.content : [];
4536
+ const content = resp.data?.content;
4537
+ const total = resp.data?.totalElements;
4538
+ if (!Array.isArray(content) || !Number.isSafeInteger(total) || total < content.length) {
4539
+ throw new CliError({
4540
+ code: "NETWORK_ERROR" /* NETWORK_ERROR */,
4541
+ message: "\u5DE5\u4F5C\u533A\u6587\u4EF6\u5217\u8868\u7F3A\u5C11\u6709\u6548\u7684 content / totalElements\uFF0C\u65E0\u6CD5\u786E\u8BA4\u8FDC\u7AEF\u6587\u4EF6\u3002",
4542
+ context: {
4543
+ reason: "INVALID_WORKSPACE_FILE_LIST",
4544
+ nextStep: "\u68C0\u67E5\u670D\u52A1\u7AEF\u6587\u4EF6\u5217\u8868\u54CD\u5E94\u540E\u91CD\u8BD5\uFF1B\u4E0D\u80FD\u5C06\u65E0\u6548\u54CD\u5E94\u5F53\u4F5C\u7A7A\u5DE5\u4F5C\u533A\u7EE7\u7EED\u540C\u6B65\u3002"
4545
+ }
4546
+ });
4547
+ }
4537
4548
  return {
4538
4549
  data: content.map(toWorkspaceFileItem),
4539
- total: numberOr(resp.data?.totalElements, content.length)
4550
+ total
4540
4551
  };
4541
4552
  }
4542
4553
  async function loadWorkspaceFileContent(http, fileId) {