@byted-apaas/server-sdk-node 1.1.14-beta.2 → 1.1.14

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.
@@ -151,6 +151,9 @@ export interface _IKQuery<T> {
151
151
  findAll(): Promise<_Record<T>[]>;
152
152
  /**
153
153
  * 遍历全部符合条件的记录
154
+ * 注:
155
+ * 如果未设置排序字段,默认以 _id 增序查询;
156
+ * 如果有设置排序字段,必须设置具有唯一属性的字段,否则会有数据重复的风险;
154
157
  * @param handler 业务处理函数
155
158
  * @example
156
159
  * ```
@@ -535,6 +535,10 @@ class _KQuery {
535
535
  selectFields = queryBuilder.getSelect();
536
536
  orders = queryBuilder.getOrder();
537
537
  }
538
+ // 当用户未设置排序字段时,强制指定为主键增序,避免数据重复
539
+ if (!orders || orders.length === 0) {
540
+ orders = [{ field: '_id', direction: 'asc', type: '' }];
541
+ }
538
542
  let maxId = 0, queryCount = 0;
539
543
  for (let i = offset; !limit || i < offset + limit; i += queryBuilder_1.defaultLimit) {
540
544
  let newLimit = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.14-beta.2",
3
+ "version": "1.1.14",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",
@@ -13,7 +13,7 @@
13
13
  "clean": "tsc --build --clean && rm -rf **/*.js.map"
14
14
  },
15
15
  "dependencies": {
16
- "@byted-apaas/server-common-node": "^2.0.2-beta.1",
16
+ "@byted-apaas/server-common-node": "^2.0.2",
17
17
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
18
18
  "dayjs": "^1.9.6",
19
19
  "form-data": "^3.0.0",
@@ -11,6 +11,7 @@ const constants_3 = require("@byted-apaas/server-common-node/constants/constants
11
11
  const common_1 = require("./common");
12
12
  const utils_1 = require("@byted-apaas/server-common-node/utils/utils");
13
13
  const permissionUtils = require("@byted-apaas/server-common-node/utils/permissionUtils");
14
+ const { URLSearchParams } = require('url');
14
15
  // eslint-disable-next-line @typescript-eslint/no-require-imports
15
16
  const nodeCls = require('node-cls'); //nolint:byted_s_ts_no_require_imports
16
17
  const fs = require('fs');
@@ -977,18 +978,14 @@ class RequestHttp {
977
978
  let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getApprovalInstance);
978
979
  let urlPath = options._reqPath.replace(replaceKeys.id, String(params.approvalInstanceId));
979
980
  // 设置参数
980
- const searchParams = {
981
- includes: "",
982
- };
983
- const includes = [];
981
+ const searchParams = new URLSearchParams();
984
982
  if (params && params.includeContent) {
985
- includes.push('ApprovalComment_Content');
983
+ searchParams.append('includes', 'ApprovalComment_Content');
986
984
  }
987
985
  if (params && params.includeFormData) {
988
- includes.push('ApprovalTask_FormData');
986
+ searchParams.append('includes', 'ApprovalTask_FormData');
989
987
  }
990
- searchParams.includes = includes.join(",");
991
- options.searchParams = searchParams;
988
+ urlPath = urlPath + '?' + searchParams.toString();
992
989
  // 发起请求
993
990
  let resp = await openapi.doRequest(null, urlPath, options);
994
991
  if (!resp || !resp.approval_instance) {