c2-mongoose 2.1.379 → 2.1.381
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 +2 -1
- package/dist/flow/searcher/v3/SearcherV3Flow.js +4 -1
- package/dist/flow/searcher/v3/item/LookupArrayFlowItem.js +4 -1
- package/package.json +1 -1
- package/src/flow/searcher/v3/SearcherV3Flow.ts +2 -1
- package/src/flow/searcher/v3/item/LookupArrayFlowItem.ts +4 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import { IForeingData } from "./item/OneToManyFlowItem";
|
|
2
3
|
export interface IParams {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
mainFilter: any;
|
|
5
6
|
}
|
|
6
7
|
declare class SearcherV3Flow {
|
|
7
|
-
exec(params: IParams, model: mongoose.Model<any
|
|
8
|
+
exec(params: IParams, model: mongoose.Model<any>, oneToMany?: IForeingData[]): Promise<any>;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: SearcherV3Flow;
|
|
10
11
|
export default _default;
|
|
@@ -54,11 +54,13 @@ var PopulateFlowItem_1 = __importDefault(require("./item/PopulateFlowItem"));
|
|
|
54
54
|
var SortFlowItem_1 = __importDefault(require("./item/SortFlowItem"));
|
|
55
55
|
var ProjectFlowItem_1 = __importDefault(require("./item/ProjectFlowItem"));
|
|
56
56
|
var BuildPaginationDataFlowItem_1 = __importDefault(require("./item/BuildPaginationDataFlowItem"));
|
|
57
|
+
var OneToManyFlowItem_1 = __importDefault(require("./item/OneToManyFlowItem"));
|
|
57
58
|
var SearcherV3Flow = /** @class */ (function () {
|
|
58
59
|
function SearcherV3Flow() {
|
|
59
60
|
}
|
|
60
|
-
SearcherV3Flow.prototype.exec = function (params, model) {
|
|
61
|
+
SearcherV3Flow.prototype.exec = function (params, model, oneToMany) {
|
|
61
62
|
var _a, _b, _c;
|
|
63
|
+
if (oneToMany === void 0) { oneToMany = []; }
|
|
62
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
65
|
var facet, pipelineFacetPaging, pipelineFacetItems, mainFilters, result, ret;
|
|
64
66
|
return __generator(this, function (_d) {
|
|
@@ -71,6 +73,7 @@ var SearcherV3Flow = /** @class */ (function () {
|
|
|
71
73
|
pipelineFacetItems = [];
|
|
72
74
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), GroupFlowItem_1.default.execute(params.groupBy, params.sumFields, params.groupDetailed, model), true);
|
|
73
75
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), PopulateFlowItem_1.default.execute(params.populate, model), true);
|
|
76
|
+
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), OneToManyFlowItem_1.default.execute(oneToMany), true);
|
|
74
77
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), MatchFlowItem_1.default.execute(params, model), true);
|
|
75
78
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), SortFlowItem_1.default.execute(params.orderBy, params.orderSense), true);
|
|
76
79
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), ProjectFlowItem_1.default.execute(params.select), true);
|
|
@@ -22,7 +22,10 @@ var LookupArrayFlowItem = /** @class */ (function () {
|
|
|
22
22
|
var populateClauseLookup = [];
|
|
23
23
|
try {
|
|
24
24
|
populateClauseLookup.push({
|
|
25
|
-
$unwind:
|
|
25
|
+
$unwind: {
|
|
26
|
+
path: "$".concat(previousPath),
|
|
27
|
+
preserveNullAndEmptyArrays: true
|
|
28
|
+
}
|
|
26
29
|
});
|
|
27
30
|
//init code here
|
|
28
31
|
var currentField_1 = remainingPath[0], othersFields = remainingPath.slice(1);
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export interface IParams {
|
|
|
14
14
|
|
|
15
15
|
class SearcherV3Flow {
|
|
16
16
|
|
|
17
|
-
async exec(params: IParams, model: mongoose.Model<any
|
|
17
|
+
async exec(params: IParams, model: mongoose.Model<any>, oneToMany: IForeingData[] = []) {
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
params.page = Number(params.page ?? 1)
|
|
@@ -25,6 +25,7 @@ class SearcherV3Flow {
|
|
|
25
25
|
let pipelineFacetItems: any[] = []
|
|
26
26
|
pipelineFacetItems = [...pipelineFacetItems, ...GroupFlowItem.execute(params.groupBy, params.sumFields, params.groupDetailed, model)]
|
|
27
27
|
pipelineFacetItems = [...pipelineFacetItems, ...PopulateFlowItem.execute(params.populate, model)]
|
|
28
|
+
pipelineFacetItems = [...pipelineFacetItems, ...OneToManyFlowItem.execute(oneToMany)]
|
|
28
29
|
pipelineFacetItems = [...pipelineFacetItems, ...MatchFlowItem.execute(params, model)]
|
|
29
30
|
pipelineFacetItems = [...pipelineFacetItems, ...SortFlowItem.execute(params.orderBy, params.orderSense)]
|
|
30
31
|
pipelineFacetItems = [...pipelineFacetItems, ...ProjectFlowItem.execute(params.select)]
|