c2-mongoose 2.1.415 → 2.1.417
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/searcher/v3/SearcherV3Flow.d.ts +1 -0
- package/dist/flow/searcher/v3/SearcherV3Flow.js +14 -5
- package/dist/flow/searcher/v3/item/BuildAndQueriesFlowItem.js +1 -0
- package/package.json +1 -1
- package/src/flow/searcher/v3/SearcherV3Flow.ts +10 -1
- package/src/flow/searcher/v3/item/BuildAndQueriesFlowItem.ts +1 -0
|
@@ -62,9 +62,9 @@ var SearcherV3Flow = /** @class */ (function () {
|
|
|
62
62
|
var _a, _b, _c, _d, _e;
|
|
63
63
|
if (oneToMany === void 0) { oneToMany = []; }
|
|
64
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var facet, pipelineFacetPaging, pipelineFacetItems, mainFilters, result, ret;
|
|
66
|
-
return __generator(this, function (
|
|
67
|
-
switch (
|
|
65
|
+
var facet, pipelineFacetPaging, pipelineFacetItems, _i, _f, _g, key, value, _h, value_1, item, mainFilters, result, ret;
|
|
66
|
+
return __generator(this, function (_j) {
|
|
67
|
+
switch (_j.label) {
|
|
68
68
|
case 0:
|
|
69
69
|
params.page = Number((_a = params.page) !== null && _a !== void 0 ? _a : 1);
|
|
70
70
|
params.limit = Number((_b = params.limit) !== null && _b !== void 0 ? _b : 50);
|
|
@@ -88,10 +88,19 @@ var SearcherV3Flow = /** @class */ (function () {
|
|
|
88
88
|
{ $skip: (params.page - 1) * (params.limit) },
|
|
89
89
|
{ $limit: params.limit }
|
|
90
90
|
], false);
|
|
91
|
-
pipelineFacetPaging = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], GroupFlowItem_1.default.execute(params.groupBy, params.sumFields, params.groupDetailed, model), true),
|
|
91
|
+
pipelineFacetPaging = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], GroupFlowItem_1.default.execute(params.groupBy, params.sumFields, params.groupDetailed, model), true), PopulateFlowItem_1.default.execute(params.populate, model), true), OneToManyFlowItem_1.default.execute(oneToMany, params.populate), true), MatchFlowItem_1.default.execute(params, model), true), BuildPaginationDataFlowItem_1.default.execute(params.page, params.limit), true);
|
|
92
92
|
facet.paging = pipelineFacetPaging;
|
|
93
93
|
}
|
|
94
94
|
facet.items = pipelineFacetItems;
|
|
95
|
+
if (params.metadata) {
|
|
96
|
+
for (_i = 0, _f = Array.from(params.metadata.entries()); _i < _f.length; _i++) {
|
|
97
|
+
_g = _f[_i], key = _g[0], value = _g[1];
|
|
98
|
+
for (_h = 0, value_1 = value; _h < value_1.length; _h++) {
|
|
99
|
+
item = value_1[_h];
|
|
100
|
+
facet[key] = value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
95
104
|
mainFilters = params.mainFilter ? __spreadArray([], MatchFlowItem_1.default.execute(params.mainFilter, model), true) : [];
|
|
96
105
|
return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray([], mainFilters, true), [
|
|
97
106
|
{
|
|
@@ -104,7 +113,7 @@ var SearcherV3Flow = /** @class */ (function () {
|
|
|
104
113
|
}
|
|
105
114
|
}).read('secondaryPreferred')];
|
|
106
115
|
case 1:
|
|
107
|
-
result =
|
|
116
|
+
result = _j.sent();
|
|
108
117
|
ret = {};
|
|
109
118
|
ret.items = result[0].items;
|
|
110
119
|
if (params.pageable !== false) {
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ export interface IParams {
|
|
|
12
12
|
mainFilter: any
|
|
13
13
|
preSteps?: any[]
|
|
14
14
|
posSteps?: any[]
|
|
15
|
+
metadata?: Map<string, any[]>
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
class SearcherV3Flow {
|
|
@@ -49,8 +50,8 @@ class SearcherV3Flow {
|
|
|
49
50
|
|
|
50
51
|
pipelineFacetPaging = [
|
|
51
52
|
...GroupFlowItem.execute(params.groupBy, params.sumFields, params.groupDetailed, model),
|
|
52
|
-
...OneToManyFlowItem.execute(oneToMany, params.populate),
|
|
53
53
|
...PopulateFlowItem.execute(params.populate, model),
|
|
54
|
+
...OneToManyFlowItem.execute(oneToMany, params.populate),
|
|
54
55
|
...MatchFlowItem.execute(params, model),
|
|
55
56
|
...BuildPaginationDataFlowItem.execute(params.page, params.limit),
|
|
56
57
|
]
|
|
@@ -58,6 +59,14 @@ class SearcherV3Flow {
|
|
|
58
59
|
}
|
|
59
60
|
facet.items = pipelineFacetItems
|
|
60
61
|
|
|
62
|
+
if (params.metadata) {
|
|
63
|
+
for (const [key, value] of Array.from(params.metadata.entries())) {
|
|
64
|
+
for (const item of value) {
|
|
65
|
+
facet[key] = value
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
const mainFilters = params.mainFilter ? [...MatchFlowItem.execute(params.mainFilter, model)] : []
|
|
62
71
|
|
|
63
72
|
let result = await model.aggregate([
|