c2-mongoose 2.1.64 → 2.1.66
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.js +22 -8
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +10 -1
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -173,9 +173,9 @@ var SearchFlow = /** @class */ (function () {
|
|
|
173
173
|
SearchFlow.prototype.searchPageable = function (model, options) {
|
|
174
174
|
var _a;
|
|
175
175
|
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
-
var stagesItems, result;
|
|
177
|
-
return __generator(this, function (
|
|
178
|
-
switch (
|
|
176
|
+
var stagesItems, result, items, _i, _b, populate;
|
|
177
|
+
return __generator(this, function (_c) {
|
|
178
|
+
switch (_c.label) {
|
|
179
179
|
case 0:
|
|
180
180
|
stagesItems = __spreadArray([
|
|
181
181
|
{ $match: this.filters },
|
|
@@ -202,11 +202,25 @@ var SearchFlow = /** @class */ (function () {
|
|
|
202
202
|
}
|
|
203
203
|
]).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
204
204
|
case 1:
|
|
205
|
-
result =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
result = _c.sent();
|
|
206
|
+
items = result[0].items;
|
|
207
|
+
if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
|
|
208
|
+
_i = 0, _b = this.populate;
|
|
209
|
+
_c.label = 2;
|
|
210
|
+
case 2:
|
|
211
|
+
if (!(_i < _b.length)) return [3 /*break*/, 5];
|
|
212
|
+
populate = _b[_i];
|
|
213
|
+
return [4 /*yield*/, model.populate(result[0].items, populate)];
|
|
214
|
+
case 3:
|
|
215
|
+
items = _c.sent();
|
|
216
|
+
_c.label = 4;
|
|
217
|
+
case 4:
|
|
218
|
+
_i++;
|
|
219
|
+
return [3 /*break*/, 2];
|
|
220
|
+
case 5: return [2 /*return*/, {
|
|
221
|
+
items: items,
|
|
222
|
+
paging: ((_a = result[0]) === null || _a === void 0 ? void 0 : _a.paging[0]) || { total: 0, page: 1, limit: this.limit }
|
|
223
|
+
}];
|
|
210
224
|
}
|
|
211
225
|
});
|
|
212
226
|
});
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -134,8 +134,17 @@ abstract class SearchFlow {
|
|
|
134
134
|
}
|
|
135
135
|
]
|
|
136
136
|
).session(options?.session as ClientSession)
|
|
137
|
+
|
|
138
|
+
var items = result[0].items
|
|
139
|
+
|
|
140
|
+
if (isNotEmpty(this.populate) && Array.isArray(this.populate)) {
|
|
141
|
+
for (var populate of this.populate) {
|
|
142
|
+
items = await model.populate(result[0].items, populate)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
return {
|
|
138
|
-
items
|
|
147
|
+
items,
|
|
139
148
|
paging: result[0]?.paging[0] || { total: 0, page: 1, limit: this.limit }
|
|
140
149
|
}
|
|
141
150
|
}
|