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

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.
@@ -481,12 +481,15 @@ class _KQuery {
481
481
  let criterion;
482
482
  if (appCtx) {
483
483
  criterionV2 = (0, logicV2_1.buildCriterionV2)(queryV2.filter);
484
+ criterionV2.push({ leftValue: '_id', operator: operator_1.operates.GT, rightValue: maxId });
484
485
  }
485
486
  else {
486
487
  criterion = (0, logic_1.buildCriterion)(queryBuilder.getLogic(), apiName);
487
488
  if (queryBuilder.getLogic().logics.length > 0) { // 有自定义搜索条件时,需要获取 fields
488
489
  criterion = await (0, logic_1.handleCriterion)(criterion);
489
490
  }
491
+ // 在最后,添加 _id>maxId 条件
492
+ criterion = (0, logic_1.addIDCriterion)(criterion, apiName, maxId);
490
493
  }
491
494
  while (true) {
492
495
  let newLimit = pageLimit;
@@ -498,7 +501,7 @@ class _KQuery {
498
501
  }
499
502
  let rs;
500
503
  if (appCtx) {
501
- criterionV2.push({ leftValue: '_id', operator: operator_1.operates.GT, rightValue: maxId });
504
+ criterionV2[criterionV2.length - 1].rightValue = maxId;
502
505
  const param = {
503
506
  limit: newLimit,
504
507
  offset: 0,
@@ -512,8 +515,8 @@ class _KQuery {
512
515
  });
513
516
  }
514
517
  else {
515
- // 添加 _id>maxId 条件
516
- criterion = (0, logic_1.addIDCriterion)(criterion, apiName, maxId);
518
+ // 更新 maxId
519
+ criterion.conditions[criterion.conditions.length - 1].right.settings.data = maxId;
517
520
  // 发起请求
518
521
  rs = await Request.GetInstance().getRecordsOrCountByCriterion(apiName, criterion, queryBuilder.fuzzySearch, [new order_1.Order('_id', 'asc')], false, queryBuilder.getSelect(), 0, newLimit, false, this.authType);
519
522
  }
@@ -562,12 +565,15 @@ class _KQuery {
562
565
  let criterion;
563
566
  if (appCtx) {
564
567
  criterionV2 = (0, logicV2_1.buildCriterionV2)(queryV2.filter);
568
+ criterionV2.push({ leftValue: '_id', operator: operator_1.operates.GT, rightValue: maxId });
565
569
  }
566
570
  else {
567
571
  criterion = (0, logic_1.buildCriterion)(queryBuilder.getLogic(), apiName);
568
- if (queryBuilder.getLogic().logics.length > 0) {
572
+ if (queryBuilder.getLogic().logics.length > 0) { // 有自定义搜索条件时,需要获取 fields
569
573
  criterion = await (0, logic_1.handleCriterion)(criterion);
570
574
  }
575
+ // 在最后,添加 _id>maxId 条件
576
+ criterion = (0, logic_1.addIDCriterion)(criterion, apiName, maxId);
571
577
  }
572
578
  for (let i = offset; !limit || i < offset + limit; i += pageLimit) {
573
579
  let newLimit = function () {
@@ -584,7 +590,7 @@ class _KQuery {
584
590
  }
585
591
  let rs;
586
592
  if (appCtx) {
587
- criterionV2.push({ leftValue: '_id', operator: operator_1.operates.GT, rightValue: maxId });
593
+ criterionV2[criterionV2.length - 1].rightValue = maxId;
588
594
  const param = {
589
595
  limit: newLimit,
590
596
  offset: i,
@@ -598,8 +604,8 @@ class _KQuery {
598
604
  });
599
605
  }
600
606
  else {
601
- // 添加 _id>maxId 条件
602
- criterion = (0, logic_1.addIDCriterion)(criterion, apiName, maxId);
607
+ // 更新 maxId
608
+ criterion.conditions[criterion.conditions.length - 1].right.settings.data = maxId;
603
609
  // 发起请求
604
610
  rs = await Request.GetInstance().getRecordsOrCountByCriterion(apiName, criterion, queryBuilder.fuzzySearch, orders, false, selectFields, i, newLimit, false, this.authType);
605
611
  }
@@ -117,6 +117,7 @@ function buildCriterion(logic, objectApiName) {
117
117
  f(logic);
118
118
  // 如果未设置filter,默认添加: _isDeleted = false
119
119
  if (expressions.length < 1) {
120
+ logics = [];
120
121
  expressions.push(buildExpression(objectApiName, '_isDeleted', false, expressions.length + 1));
121
122
  logics.push('1');
122
123
  return { conditions: expressions, logic: logics.join('') };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.17-beta.2",
3
+ "version": "1.1.17-beta.4",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",