drapcode-utility 1.6.1 → 1.6.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.
@@ -63,7 +63,7 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
63
63
  if (currentUserSetting === void 0) { currentUserSetting = {}; }
64
64
  if (lookupConfig === void 0) { lookupConfig = []; }
65
65
  return __awaiter(void 0, void 0, void 0, function () {
66
- var filterQuery, rlsFilterQuery, aggregateQuery, queryStr, searchQueryObj, _a, searchAggregateQuery, likeQuery, finalQuery, _b, searchAggregateQuery, likeQuery, projection, finder, sortBy, orderBy, offset, limit, direction, str;
66
+ var filterQuery, rlsFilterQuery, aggregateQuery, queryStr, searchQueryObj, _a, searchAggregateQuery, likeQuery, finalQuery, _b, searchAggregateQuery, likeQuery, projection, finder, sortBy, orderBy, offset, limit, resetLimit, direction, str;
67
67
  var _c, _d, _e;
68
68
  return __generator(this, function (_f) {
69
69
  switch (_f.label) {
@@ -148,10 +148,16 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
148
148
  }
149
149
  offset = externalParams.offset || 0;
150
150
  limit = externalParams.limit || 20000;
151
+ resetLimit = externalParams.resetLimit || false;
151
152
  if (externalParams.pagination == "false") {
152
153
  limit = 0;
153
154
  sortBy = 0;
154
155
  }
156
+ // Reset limit value to 1 in case filter is of type FIND or when it's a COUNT finder for FIND filter
157
+ if (finder === "FIND" || (finder === "COUNT" && resetLimit)) {
158
+ offset = 0;
159
+ limit = 1;
160
+ }
155
161
  if (finder != "COUNT" && sortBy) {
156
162
  direction = orderBy && orderBy == "asc" ? 1 : -1;
157
163
  aggregateQuery.push({ $sort: (_e = {}, _e[sortBy] = direction, _e._id = 1, _e) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",