c2-mongoose 2.1.230 → 2.1.231

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.
@@ -26,5 +26,6 @@ declare class SearcherFlow<D> {
26
26
  isValidObjectId(value: string): boolean;
27
27
  buildOrdenation(): any;
28
28
  buildRegex(searchText: string): RegExp;
29
+ private reset;
29
30
  }
30
31
  export default SearcherFlow;
@@ -155,6 +155,7 @@ var SearcherFlow = /** @class */ (function () {
155
155
  _b.label = 3;
156
156
  case 3:
157
157
  resultAux = this.transformObject(result[0]);
158
+ this.reset();
158
159
  return [2 /*return*/, resultAux];
159
160
  }
160
161
  });
@@ -314,6 +315,20 @@ var SearcherFlow = /** @class */ (function () {
314
315
  .replace(/[u|ü|ú|ù|U|Ú|Ü|Ù]/g, '[u,ü,ú,ù,U,Ú,Ü,Ù]');
315
316
  return new RegExp("".concat(regexExpression), 'i');
316
317
  };
318
+ SearcherFlow.prototype.reset = function () {
319
+ for (var key in this) {
320
+ delete this[key];
321
+ }
322
+ this.searchText = "";
323
+ this.orderSense = "desc";
324
+ this.orderBy = "_id";
325
+ this.page = 1;
326
+ this.limit = 50;
327
+ this.pageable = true;
328
+ this.select = [""];
329
+ this.populate = [""];
330
+ this.filters = undefined;
331
+ };
317
332
  return SearcherFlow;
318
333
  }());
319
334
  exports.default = SearcherFlow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.230",
3
+ "version": "2.1.231",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,7 +2,6 @@ import moment from "moment"
2
2
  import mongoose, { ClientSession, Types } from "mongoose"
3
3
  import { SearchOptions, SearchResponse } from "../types/SearchResponse"
4
4
  import { isNotEmpty } from "../utils/Utils"
5
- import SearchFlow from "./SearchFlow"
6
5
  import BuildPopulateSingleFlowItem from "./item/BuildPopulateSingleFlowItem"
7
6
  import BuildSelectSingleFlowItem from "./item/BuildSelectSingleFlowItem"
8
7
  export interface IPopulate {
@@ -125,6 +124,7 @@ class SearcherFlow<D> {
125
124
  }
126
125
 
127
126
  let resultAux = this.transformObject(result[0])
127
+ this.reset()
128
128
  return resultAux
129
129
  }
130
130
 
@@ -304,6 +304,22 @@ class SearcherFlow<D> {
304
304
  .replace(/[u|ü|ú|ù|U|Ú|Ü|Ù]/g, '[u,ü,ú,ù,U,Ú,Ü,Ù]')
305
305
  return new RegExp(`${regexExpression}`, 'i');
306
306
  }
307
+
308
+ private reset() {
309
+ for (const key in this) {
310
+ delete this[key];
311
+ }
312
+ this.searchText = ""
313
+ this.orderSense = "desc"
314
+ this.orderBy = "_id"
315
+ this.page = 1
316
+ this.limit = 50
317
+ this.pageable = true
318
+
319
+ this.select = [""]
320
+ this.populate = [""]
321
+ this.filters = undefined
322
+ }
307
323
  }
308
324
 
309
325
  export default SearcherFlow