@geekbears/gb-mongoose-query-parser 1.3.13 → 1.3.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.
@@ -337,16 +337,20 @@ exports.QueryParser = QueryParser;
337
337
  */
338
338
  function transformFilter(filter) {
339
339
  var walk = function (obj) {
340
- var _loop_1 = function (key) {
340
+ var _loop_1 = function (i, key) {
341
341
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
342
342
  var value = obj[key];
343
343
  var validId = (0, mongoose_1.isValidObjectId)(value);
344
344
  if (validId && (0, class_validator_1.isMongoId)(value))
345
345
  obj[key] = mongoose_1.Types.ObjectId.createFromHexString(value.toString());
346
346
  else {
347
- setTimeout(function () {
347
+ if (i % 1000 === 0) {
348
+ setImmediate(function () {
349
+ walk(obj[key]);
350
+ });
351
+ }
352
+ else
348
353
  walk(obj[key]);
349
- }, 0);
350
354
  }
351
355
  // if (typeof value === 'object') {
352
356
  // console.log('walking......');
@@ -354,8 +358,9 @@ function transformFilter(filter) {
354
358
  // } else obj[key] = Types.ObjectId.isValid(value) ? new Types.ObjectId(value) : value;
355
359
  }
356
360
  };
357
- for (var key in obj) {
358
- _loop_1(key);
361
+ for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) {
362
+ var _a = obj_1[_i], i = _a[0], key = _a[1][0];
363
+ _loop_1(i, key);
359
364
  }
360
365
  return obj;
361
366
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbears/gb-mongoose-query-parser",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "Convert url query string to MongooseJs friendly query object including advanced filtering, sorting, population, deep population, string template, type casting and many more...",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",