c2-mongoose 2.1.103 → 2.1.104
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.
- package/dist/flow/SearchFlow.d.ts +1 -0
- package/dist/flow/SearchFlow.js +13 -12
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +2 -1
|
@@ -26,6 +26,7 @@ declare abstract class SearchFlow {
|
|
|
26
26
|
searchPageable(model: mongoose.Model<any>, options: SearchOptions): Promise<{
|
|
27
27
|
items: any;
|
|
28
28
|
paging: any;
|
|
29
|
+
metadata: any;
|
|
29
30
|
}>;
|
|
30
31
|
search(model: mongoose.Model<any>, options?: SearchOptions): Promise<SearchResponse<any>>;
|
|
31
32
|
/**
|
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -185,11 +185,11 @@ var SearchFlow = /** @class */ (function () {
|
|
|
185
185
|
return new RegExp("".concat(regexExpression), 'i');
|
|
186
186
|
};
|
|
187
187
|
SearchFlow.prototype.searchPageable = function (model, options) {
|
|
188
|
-
var _a;
|
|
188
|
+
var _a, _b;
|
|
189
189
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
var stagesItems, stagesPaging, stagesMetadata, result, items, _i,
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
190
|
+
var stagesItems, stagesPaging, stagesMetadata, result, items, _i, _c, populate;
|
|
191
|
+
return __generator(this, function (_d) {
|
|
192
|
+
switch (_d.label) {
|
|
193
193
|
case 0:
|
|
194
194
|
stagesItems = [{ $match: this.filters }];
|
|
195
195
|
if ((0, Utils_1.isNotEmpty)(options.unions)) {
|
|
@@ -224,24 +224,25 @@ var SearchFlow = /** @class */ (function () {
|
|
|
224
224
|
}
|
|
225
225
|
]).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
226
226
|
case 1:
|
|
227
|
-
result =
|
|
227
|
+
result = _d.sent();
|
|
228
228
|
items = result[0].items;
|
|
229
229
|
if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
|
|
230
|
-
_i = 0,
|
|
231
|
-
|
|
230
|
+
_i = 0, _c = this.populate;
|
|
231
|
+
_d.label = 2;
|
|
232
232
|
case 2:
|
|
233
|
-
if (!(_i <
|
|
234
|
-
populate =
|
|
233
|
+
if (!(_i < _c.length)) return [3 /*break*/, 5];
|
|
234
|
+
populate = _c[_i];
|
|
235
235
|
return [4 /*yield*/, model.populate(result[0].items, populate)];
|
|
236
236
|
case 3:
|
|
237
|
-
items =
|
|
238
|
-
|
|
237
|
+
items = _d.sent();
|
|
238
|
+
_d.label = 4;
|
|
239
239
|
case 4:
|
|
240
240
|
_i++;
|
|
241
241
|
return [3 /*break*/, 2];
|
|
242
242
|
case 5: return [2 /*return*/, {
|
|
243
243
|
items: items,
|
|
244
|
-
paging: ((_a = result[0]) === null || _a === void 0 ? void 0 : _a.paging[0]) || { total: 0, page: 1, limit: this.limit }
|
|
244
|
+
paging: ((_a = result[0]) === null || _a === void 0 ? void 0 : _a.paging[0]) || { total: 0, page: 1, limit: this.limit },
|
|
245
|
+
metadata: ((_b = result[0]) === null || _b === void 0 ? void 0 : _b.metadata[0]) || undefined
|
|
245
246
|
}];
|
|
246
247
|
}
|
|
247
248
|
});
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -177,7 +177,8 @@ abstract class SearchFlow {
|
|
|
177
177
|
|
|
178
178
|
return {
|
|
179
179
|
items,
|
|
180
|
-
paging: result[0]?.paging[0] || { total: 0, page: 1, limit: this.limit }
|
|
180
|
+
paging: result[0]?.paging[0] || { total: 0, page: 1, limit: this.limit },
|
|
181
|
+
metadata: result[0]?.metadata[0] || undefined
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
|