c2-mongoose 2.1.402 → 2.1.404
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/GetOneByFilterV3Flow.d.ts +2 -1
- package/dist/flow/searcher/v3/GetOneByFilterV3Flow.js +10 -3
- package/dist/flow/searcher/v3/SearcherV3Flow.d.ts +1 -1
- package/dist/flow/searcher/v3/SearcherV3Flow.js +2 -2
- package/dist/flow/searcher/v3/item/BuildAndQueriesFlowItem.js +3 -1
- package/package.json +1 -1
- package/src/flow/searcher/v3/GetOneByFilterV3Flow.ts +9 -1
- package/src/flow/searcher/v3/SearcherV3Flow.ts +3 -3
- package/src/flow/searcher/v3/item/BuildAndQueriesFlowItem.ts +4 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
2
|
import { IForeingData } from "./item/OneToManyFlowItem";
|
|
3
|
+
import { IParams } from "./SearcherV3Flow";
|
|
3
4
|
declare class GetOneByFilterV3Flow {
|
|
4
|
-
exec(params:
|
|
5
|
+
exec(params: IParams, model: mongoose.Model<any>, oneToMany?: IForeingData[]): Promise<any>;
|
|
5
6
|
}
|
|
6
7
|
declare const _default: GetOneByFilterV3Flow;
|
|
7
8
|
export default _default;
|
|
@@ -56,16 +56,23 @@ var GetOneByFilterV3Flow = /** @class */ (function () {
|
|
|
56
56
|
function GetOneByFilterV3Flow() {
|
|
57
57
|
}
|
|
58
58
|
GetOneByFilterV3Flow.prototype.exec = function (params, model, oneToMany) {
|
|
59
|
+
var _a, _b;
|
|
59
60
|
if (oneToMany === void 0) { oneToMany = []; }
|
|
60
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
62
|
var pipeline, result;
|
|
62
|
-
return __generator(this, function (
|
|
63
|
-
switch (
|
|
63
|
+
return __generator(this, function (_c) {
|
|
64
|
+
switch (_c.label) {
|
|
64
65
|
case 0:
|
|
65
66
|
pipeline = [];
|
|
67
|
+
if ((_a = params.preSteps) === null || _a === void 0 ? void 0 : _a.length) {
|
|
68
|
+
pipeline = __spreadArray(__spreadArray([], pipeline, true), params.preSteps, true);
|
|
69
|
+
}
|
|
66
70
|
pipeline = __spreadArray(__spreadArray([], pipeline, true), PopulateFlowItem_1.default.execute(params.populate, model), true);
|
|
67
71
|
pipeline = __spreadArray(__spreadArray([], pipeline, true), OneToManyFlowItem_1.default.execute(oneToMany, params.populate), true);
|
|
68
72
|
pipeline = __spreadArray(__spreadArray([], pipeline, true), ProjectFlowItem_1.default.execute(params.select), true);
|
|
73
|
+
if ((_b = params.posSteps) === null || _b === void 0 ? void 0 : _b.length) {
|
|
74
|
+
pipeline = __spreadArray(__spreadArray([], pipeline, true), params.posSteps, true);
|
|
75
|
+
}
|
|
69
76
|
return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray([], MatchFlowItem_1.default.execute(params, model), true), pipeline, true), {
|
|
70
77
|
collation: {
|
|
71
78
|
locale: "pt",
|
|
@@ -73,7 +80,7 @@ var GetOneByFilterV3Flow = /** @class */ (function () {
|
|
|
73
80
|
}
|
|
74
81
|
}).read('secondaryPreferred')];
|
|
75
82
|
case 1:
|
|
76
|
-
result =
|
|
83
|
+
result = _c.sent();
|
|
77
84
|
return [2 /*return*/, result[0]];
|
|
78
85
|
}
|
|
79
86
|
});
|
|
@@ -80,8 +80,8 @@ var SearcherV3Flow = /** @class */ (function () {
|
|
|
80
80
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), MatchFlowItem_1.default.execute(params, model), true);
|
|
81
81
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), SortFlowItem_1.default.execute(params.orderBy, params.orderSense), true);
|
|
82
82
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), ProjectFlowItem_1.default.execute(params.select), true);
|
|
83
|
-
if ((_d = params.
|
|
84
|
-
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), params.
|
|
83
|
+
if ((_d = params.posSteps) === null || _d === void 0 ? void 0 : _d.length) {
|
|
84
|
+
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), params.posSteps, true);
|
|
85
85
|
}
|
|
86
86
|
if (params.pageable !== false) {
|
|
87
87
|
pipelineFacetItems = __spreadArray(__spreadArray([], pipelineFacetItems, true), [
|
package/package.json
CHANGED
|
@@ -3,18 +3,26 @@ import OneToManyFlowItem, { IForeingData } from "./item/OneToManyFlowItem"
|
|
|
3
3
|
import PopulateFlowItem from "./item/PopulateFlowItem"
|
|
4
4
|
import ProjectFlowItem from "./item/ProjectFlowItem"
|
|
5
5
|
import MatchFlowItem from "./item/MatchFlowItem"
|
|
6
|
+
import { IParams } from "./SearcherV3Flow"
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class GetOneByFilterV3Flow {
|
|
10
11
|
|
|
11
|
-
async exec(params:
|
|
12
|
+
async exec(params: IParams, model: mongoose.Model<any>, oneToMany: IForeingData[] = []) {
|
|
12
13
|
|
|
13
14
|
let pipeline: any[] = []
|
|
15
|
+
if (params.preSteps?.length) {
|
|
16
|
+
pipeline = [...pipeline, ...params.preSteps]
|
|
17
|
+
}
|
|
14
18
|
pipeline = [...pipeline, ...PopulateFlowItem.execute(params.populate, model)]
|
|
15
19
|
pipeline = [...pipeline, ...OneToManyFlowItem.execute(oneToMany, params.populate)]
|
|
16
20
|
pipeline = [...pipeline, ...ProjectFlowItem.execute(params.select)]
|
|
17
21
|
|
|
22
|
+
if (params.posSteps?.length) {
|
|
23
|
+
pipeline = [...pipeline, ...params.posSteps]
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
let result = await model.aggregate([
|
|
19
27
|
...MatchFlowItem.execute(params, model),
|
|
20
28
|
...pipeline
|
|
@@ -11,7 +11,7 @@ export interface IParams {
|
|
|
11
11
|
[key: string]: any
|
|
12
12
|
mainFilter: any
|
|
13
13
|
preSteps?: any[]
|
|
14
|
-
|
|
14
|
+
posSteps?: any[]
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
class SearcherV3Flow {
|
|
@@ -36,8 +36,8 @@ class SearcherV3Flow {
|
|
|
36
36
|
pipelineFacetItems = [...pipelineFacetItems, ...SortFlowItem.execute(params.orderBy, params.orderSense)]
|
|
37
37
|
pipelineFacetItems = [...pipelineFacetItems, ...ProjectFlowItem.execute(params.select)]
|
|
38
38
|
|
|
39
|
-
if (params.
|
|
40
|
-
pipelineFacetItems = [...pipelineFacetItems, ...params.
|
|
39
|
+
if (params.posSteps?.length) {
|
|
40
|
+
pipelineFacetItems = [...pipelineFacetItems, ...params.posSteps]
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (params.pageable !== false) {
|