c2-mongoose 2.1.218 → 2.1.219

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.
@@ -24,5 +24,6 @@ declare class SearcherFlow<D> {
24
24
  search(model: mongoose.Model<any>, options: SearchOptions): Promise<SearchResponse<D>>;
25
25
  transformObject(originalObject: any): any;
26
26
  buildDefaultFilters(objectSearch: any): any;
27
+ isValidObjectId(value: string): boolean;
27
28
  }
28
29
  export default SearcherFlow;
@@ -276,6 +276,10 @@ var SearcherFlow = /** @class */ (function () {
276
276
  delete filters['$and'];
277
277
  return filters;
278
278
  };
279
+ SearcherFlow.prototype.isValidObjectId = function (value) {
280
+ var objectIdPattern = /^[0-9a-fA-F]{24}$/;
281
+ return objectIdPattern.test(value);
282
+ };
279
283
  return SearcherFlow;
280
284
  }());
281
285
  exports.default = SearcherFlow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.218",
3
+ "version": "2.1.219",
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",
@@ -260,6 +260,11 @@ class SearcherFlow<D> {
260
260
 
261
261
  return filters
262
262
  }
263
+
264
+ public isValidObjectId(value: string) {
265
+ const objectIdPattern = /^[0-9a-fA-F]{24}$/;
266
+ return objectIdPattern.test(value);
267
+ }
263
268
  }
264
269
 
265
270
  export default SearcherFlow