c2-mongoose 2.1.218 → 2.1.220
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;
|
|
@@ -191,6 +191,7 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
191
191
|
if ((0, Utils_1.isNotEmpty)(value)) {
|
|
192
192
|
var condition = {};
|
|
193
193
|
if ([
|
|
194
|
+
'filters',
|
|
194
195
|
'onlyMetadata',
|
|
195
196
|
'projection',
|
|
196
197
|
'pageable',
|
|
@@ -276,6 +277,10 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
276
277
|
delete filters['$and'];
|
|
277
278
|
return filters;
|
|
278
279
|
};
|
|
280
|
+
SearcherFlow.prototype.isValidObjectId = function (value) {
|
|
281
|
+
var objectIdPattern = /^[0-9a-fA-F]{24}$/;
|
|
282
|
+
return objectIdPattern.test(value);
|
|
283
|
+
};
|
|
279
284
|
return SearcherFlow;
|
|
280
285
|
}());
|
|
281
286
|
exports.default = SearcherFlow;
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -165,6 +165,7 @@ class SearcherFlow<D> {
|
|
|
165
165
|
if (isNotEmpty(value)) {
|
|
166
166
|
let condition = {} as any
|
|
167
167
|
if ([
|
|
168
|
+
'filters',
|
|
168
169
|
'onlyMetadata',
|
|
169
170
|
'projection',
|
|
170
171
|
'pageable',
|
|
@@ -260,6 +261,11 @@ class SearcherFlow<D> {
|
|
|
260
261
|
|
|
261
262
|
return filters
|
|
262
263
|
}
|
|
264
|
+
|
|
265
|
+
public isValidObjectId(value: string) {
|
|
266
|
+
const objectIdPattern = /^[0-9a-fA-F]{24}$/;
|
|
267
|
+
return objectIdPattern.test(value);
|
|
268
|
+
}
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
export default SearcherFlow
|