c2-mongoose 2.1.431 → 2.1.433
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.js +2 -2
- package/dist/flow/searcher/v3/item/BuildPaginationDataV3FlowItem.d.ts +5 -0
- package/dist/flow/searcher/v3/item/BuildPaginationDataV3FlowItem.js +35 -0
- package/dist/flow/searcher/v3/item/ProjectV3FlowItem.d.ts +1 -1
- package/dist/flow/searcher/v3/item/ProjectV3FlowItem.js +3 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +9 -7
- package/package.json +1 -1
- package/src/flow/searcher/v3/SearcherV3Flow.ts +2 -2
- package/src/flow/searcher/v3/item/{BuildPaginationDataFlowItem.ts → BuildPaginationDataV3FlowItem.ts} +2 -2
- package/src/flow/searcher/v3/item/ProjectV3FlowItem.ts +5 -1
- package/src/index.ts +5 -4
|
@@ -48,7 +48,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
var
|
|
51
|
+
var BuildPaginationDataV3FlowItem_1 = __importDefault(require("./item/BuildPaginationDataV3FlowItem"));
|
|
52
52
|
var GroupV3FlowItem_1 = __importDefault(require("./item/GroupV3FlowItem"));
|
|
53
53
|
var MatchV3FlowItem_1 = __importDefault(require("./item/MatchV3FlowItem"));
|
|
54
54
|
var OneToManyV3FlowItem_1 = __importDefault(require("./item/OneToManyV3FlowItem"));
|
|
@@ -88,7 +88,7 @@ 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([], GroupV3FlowItem_1.default.execute(params.groupBy, params.sumFields, params.groupDetailed, model), true), PopulateV3FlowItem_1.default.execute(params.populate, model), true), OneToManyV3FlowItem_1.default.execute(oneToMany, params.populate), true), MatchV3FlowItem_1.default.execute(params, model), true),
|
|
91
|
+
pipelineFacetPaging = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], GroupV3FlowItem_1.default.execute(params.groupBy, params.sumFields, params.groupDetailed, model), true), PopulateV3FlowItem_1.default.execute(params.populate, model), true), OneToManyV3FlowItem_1.default.execute(oneToMany, params.populate), true), MatchV3FlowItem_1.default.execute(params, model), true), BuildPaginationDataV3FlowItem_1.default.execute(params.page, params.limit), true);
|
|
92
92
|
facet.paging = pipelineFacetPaging;
|
|
93
93
|
}
|
|
94
94
|
facet.items = pipelineFacetItems;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BuildPaginationDataV3FlowItem = /** @class */ (function () {
|
|
4
|
+
function BuildPaginationDataV3FlowItem() {
|
|
5
|
+
}
|
|
6
|
+
BuildPaginationDataV3FlowItem.prototype.execute = function (page, limit) {
|
|
7
|
+
return [
|
|
8
|
+
{ $count: "total" },
|
|
9
|
+
{
|
|
10
|
+
$addFields: {
|
|
11
|
+
page: page,
|
|
12
|
+
limit: limit,
|
|
13
|
+
total: "$total",
|
|
14
|
+
totalPages: {
|
|
15
|
+
$cond: {
|
|
16
|
+
if: { $eq: ['$total', 0] },
|
|
17
|
+
then: 0,
|
|
18
|
+
else: { $ceil: { $divide: ['$total', limit] } }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
startIndex: { $subtract: [{ $multiply: [page, limit] }, limit - 1] },
|
|
22
|
+
endIndex: {
|
|
23
|
+
$cond: {
|
|
24
|
+
if: { $gt: [{ $multiply: [page, limit] }, "$total"] },
|
|
25
|
+
then: "$total",
|
|
26
|
+
else: { $multiply: [page, limit] }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
return BuildPaginationDataV3FlowItem;
|
|
34
|
+
}());
|
|
35
|
+
exports.default = new BuildPaginationDataV3FlowItem;
|
|
@@ -30,6 +30,9 @@ var ProjectV3FlowItem = /** @class */ (function () {
|
|
|
30
30
|
var selectClauses = {
|
|
31
31
|
$project: {}
|
|
32
32
|
};
|
|
33
|
+
if (typeof select === "string") {
|
|
34
|
+
select = select.split(',').map(function (field) { return field.trim(); }).filter(function (field) { return field.length > 0; });
|
|
35
|
+
}
|
|
33
36
|
select.forEach(function (selectField) {
|
|
34
37
|
var include = selectField.startsWith("-") ? false : true;
|
|
35
38
|
selectField = selectField.replace("-", "");
|
package/dist/index.d.ts
CHANGED
|
@@ -18,15 +18,16 @@ import GetOneByFilterV3Flow from "./flow/searcher/v3/GetOneByFilterV3Flow";
|
|
|
18
18
|
import SearcherV3Flow from "./flow/searcher/v3/SearcherV3Flow";
|
|
19
19
|
import BuildAndQueriesFlowItem from "./flow/searcher/v3/item/BuildAndQueriesFlowItem";
|
|
20
20
|
import BuildOrQueriesFlowItem from "./flow/searcher/v3/item/BuildOrQueriesFlowItem";
|
|
21
|
+
import BuildPaginationDataV3FlowItem from "./flow/searcher/v3/item/BuildPaginationDataV3FlowItem";
|
|
22
|
+
import GroupV3FlowItem from "./flow/searcher/v3/item/GroupV3FlowItem";
|
|
21
23
|
import MatchV3FlowItem from "./flow/searcher/v3/item/MatchV3FlowItem";
|
|
22
24
|
import OneToManyV3FlowItem from "./flow/searcher/v3/item/OneToManyV3FlowItem";
|
|
23
25
|
import PopulateV3FlowItem from "./flow/searcher/v3/item/PopulateV3FlowItem";
|
|
26
|
+
import ProjectV3FlowItem from "./flow/searcher/v3/item/ProjectV3FlowItem";
|
|
27
|
+
import SortV3FlowItem from "./flow/searcher/v3/item/SortV3FlowItem";
|
|
24
28
|
import { IFacet } from "./model/Facet";
|
|
25
29
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger";
|
|
26
30
|
import { Options } from "./types/Options";
|
|
27
31
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
28
32
|
import { initialize } from "./utils/Utils";
|
|
29
|
-
|
|
30
|
-
import ProjectV3FlowItem from "./flow/searcher/v3/item/ProjectV3FlowItem";
|
|
31
|
-
import GroupV3FlowItem from "./flow/searcher/v3/item/GroupV3FlowItem";
|
|
32
|
-
export { AddStagePaginationFlowItem, GroupV3FlowItem, ProjectV3FlowItem, SortV3FlowItem, AddStageSortFlowItem, BuildAndQueriesFlowItem, BuildOrQueriesFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, GetHighestNumberFlow, GetOneByFilterFlow, GetOneByFilterV3Flow, IFacet, ILogger, initialize, LoggerModel, LoggerSearch, MatchFlowItem, MatchV3FlowItem, mongoose, OneToManyV3FlowItem, Options, Pagination, PopulateV3FlowItem, SearcherFlow, SearcherV2Flow, SearcherV3Flow, SearchFlow, SearchResponse, TypeOfOperation };
|
|
33
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildAndQueriesFlowItem, BuildOrQueriesFlowItem, BuildPaginationDataV3FlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, GetHighestNumberFlow, GetOneByFilterFlow, GetOneByFilterV3Flow, GroupV3FlowItem, IFacet, ILogger, initialize, LoggerModel, LoggerSearch, MatchFlowItem, MatchV3FlowItem, mongoose, OneToManyV3FlowItem, Options, Pagination, PopulateV3FlowItem, ProjectV3FlowItem, SearcherFlow, SearcherV2Flow, SearcherV3Flow, SearchFlow, SearchResponse, SortV3FlowItem, TypeOfOperation };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TypeOfOperation = exports.SearchFlow = exports.SearcherV3Flow = exports.SearcherV2Flow = exports.SearcherFlow = exports.PopulateV3FlowItem = exports.OneToManyV3FlowItem = exports.mongoose = exports.MatchV3FlowItem = exports.MatchFlowItem = exports.LoggerSearch = exports.LoggerModel = exports.initialize = exports.GetOneByFilterV3Flow = exports.GetOneByFilterFlow = exports.GetHighestNumberFlow = exports.CrudFlow = exports.ConvertToSearchResponseFlowItem = exports.C2Flow = exports.BuildSelectSingleFlowItem = exports.BuildPopulateSingleFlowItem = exports.BuildPipelineToJoinFlowItem = exports.BuildPipelineToCountJoinFlowItem = exports.
|
|
6
|
+
exports.TypeOfOperation = exports.SortV3FlowItem = exports.SearchFlow = exports.SearcherV3Flow = exports.SearcherV2Flow = exports.SearcherFlow = exports.ProjectV3FlowItem = exports.PopulateV3FlowItem = exports.OneToManyV3FlowItem = exports.mongoose = exports.MatchV3FlowItem = exports.MatchFlowItem = exports.LoggerSearch = exports.LoggerModel = exports.initialize = exports.GroupV3FlowItem = exports.GetOneByFilterV3Flow = exports.GetOneByFilterFlow = exports.GetHighestNumberFlow = exports.CrudFlow = exports.ConvertToSearchResponseFlowItem = exports.C2Flow = exports.BuildSelectSingleFlowItem = exports.BuildPopulateSingleFlowItem = exports.BuildPipelineToJoinFlowItem = exports.BuildPipelineToCountJoinFlowItem = exports.BuildPaginationDataV3FlowItem = exports.BuildOrQueriesFlowItem = exports.BuildAndQueriesFlowItem = exports.AddStageSortFlowItem = exports.AddStagePaginationFlowItem = void 0;
|
|
7
7
|
var mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
exports.mongoose = mongoose_1.default;
|
|
9
9
|
var C2Flow_1 = __importDefault(require("./flow/C2Flow"));
|
|
@@ -44,22 +44,24 @@ var BuildAndQueriesFlowItem_1 = __importDefault(require("./flow/searcher/v3/item
|
|
|
44
44
|
exports.BuildAndQueriesFlowItem = BuildAndQueriesFlowItem_1.default;
|
|
45
45
|
var BuildOrQueriesFlowItem_1 = __importDefault(require("./flow/searcher/v3/item/BuildOrQueriesFlowItem"));
|
|
46
46
|
exports.BuildOrQueriesFlowItem = BuildOrQueriesFlowItem_1.default;
|
|
47
|
+
var BuildPaginationDataV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/BuildPaginationDataV3FlowItem"));
|
|
48
|
+
exports.BuildPaginationDataV3FlowItem = BuildPaginationDataV3FlowItem_1.default;
|
|
49
|
+
var GroupV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/GroupV3FlowItem"));
|
|
50
|
+
exports.GroupV3FlowItem = GroupV3FlowItem_1.default;
|
|
47
51
|
var MatchV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/MatchV3FlowItem"));
|
|
48
52
|
exports.MatchV3FlowItem = MatchV3FlowItem_1.default;
|
|
49
53
|
var OneToManyV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/OneToManyV3FlowItem"));
|
|
50
54
|
exports.OneToManyV3FlowItem = OneToManyV3FlowItem_1.default;
|
|
51
55
|
var PopulateV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/PopulateV3FlowItem"));
|
|
52
56
|
exports.PopulateV3FlowItem = PopulateV3FlowItem_1.default;
|
|
57
|
+
var ProjectV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/ProjectV3FlowItem"));
|
|
58
|
+
exports.ProjectV3FlowItem = ProjectV3FlowItem_1.default;
|
|
59
|
+
var SortV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/SortV3FlowItem"));
|
|
60
|
+
exports.SortV3FlowItem = SortV3FlowItem_1.default;
|
|
53
61
|
var Logger_1 = require("./model/Logger");
|
|
54
62
|
Object.defineProperty(exports, "LoggerModel", { enumerable: true, get: function () { return Logger_1.LoggerModel; } });
|
|
55
63
|
Object.defineProperty(exports, "LoggerSearch", { enumerable: true, get: function () { return Logger_1.LoggerSearch; } });
|
|
56
64
|
Object.defineProperty(exports, "TypeOfOperation", { enumerable: true, get: function () { return Logger_1.TypeOfOperation; } });
|
|
57
65
|
var Utils_1 = require("./utils/Utils");
|
|
58
66
|
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return Utils_1.initialize; } });
|
|
59
|
-
var SortV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/SortV3FlowItem"));
|
|
60
|
-
exports.SortV3FlowItem = SortV3FlowItem_1.default;
|
|
61
|
-
var ProjectV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/ProjectV3FlowItem"));
|
|
62
|
-
exports.ProjectV3FlowItem = ProjectV3FlowItem_1.default;
|
|
63
|
-
var GroupV3FlowItem_1 = __importDefault(require("./flow/searcher/v3/item/GroupV3FlowItem"));
|
|
64
|
-
exports.GroupV3FlowItem = GroupV3FlowItem_1.default;
|
|
65
67
|
global.LoggerRepository = undefined;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose"
|
|
2
|
-
import
|
|
2
|
+
import BuildPaginationDataV3FlowItem from "./item/BuildPaginationDataV3FlowItem"
|
|
3
3
|
import GroupV3FlowItem from "./item/GroupV3FlowItem"
|
|
4
4
|
import MatchV3FlowItem from "./item/MatchV3FlowItem"
|
|
5
5
|
import OneToManyV3FlowItem, { IForeingData } from "./item/OneToManyV3FlowItem"
|
|
@@ -53,7 +53,7 @@ class SearcherV3Flow {
|
|
|
53
53
|
...PopulateV3FlowItem.execute(params.populate, model),
|
|
54
54
|
...OneToManyV3FlowItem.execute(oneToMany, params.populate),
|
|
55
55
|
...MatchV3FlowItem.execute(params, model),
|
|
56
|
-
...
|
|
56
|
+
...BuildPaginationDataV3FlowItem.execute(params.page, params.limit),
|
|
57
57
|
]
|
|
58
58
|
facet.paging = pipelineFacetPaging
|
|
59
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class BuildPaginationDataV3FlowItem {
|
|
2
2
|
execute(page: number, limit: number): any[] {
|
|
3
3
|
return [
|
|
4
4
|
{ $count: "total" },
|
|
@@ -28,4 +28,4 @@ class BuildPaginationDataFlowItem {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export default new
|
|
31
|
+
export default new BuildPaginationDataV3FlowItem
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class ProjectV3FlowItem {
|
|
2
|
-
execute(select:
|
|
2
|
+
execute(select: string | string[] = []): any {
|
|
3
3
|
const nested = (projectCurrent: any, field: string, include: boolean) => {
|
|
4
4
|
let [first, ...rest] = field.split('.')
|
|
5
5
|
|
|
@@ -21,6 +21,10 @@ class ProjectV3FlowItem {
|
|
|
21
21
|
$project: {}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
if (typeof select === "string") {
|
|
25
|
+
select = select.split(',').map((field: string) => field.trim()).filter((field: string) => field.length > 0);
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
select.forEach((selectField: string) => {
|
|
25
29
|
let include = selectField.startsWith("-") ? false : true
|
|
26
30
|
selectField = selectField.replace("-", "")
|
package/src/index.ts
CHANGED
|
@@ -18,19 +18,20 @@ import GetOneByFilterV3Flow from "./flow/searcher/v3/GetOneByFilterV3Flow"
|
|
|
18
18
|
import SearcherV3Flow from "./flow/searcher/v3/SearcherV3Flow"
|
|
19
19
|
import BuildAndQueriesFlowItem from "./flow/searcher/v3/item/BuildAndQueriesFlowItem"
|
|
20
20
|
import BuildOrQueriesFlowItem from "./flow/searcher/v3/item/BuildOrQueriesFlowItem"
|
|
21
|
+
import BuildPaginationDataV3FlowItem from "./flow/searcher/v3/item/BuildPaginationDataV3FlowItem"
|
|
22
|
+
import GroupV3FlowItem from "./flow/searcher/v3/item/GroupV3FlowItem"
|
|
21
23
|
import MatchV3FlowItem from "./flow/searcher/v3/item/MatchV3FlowItem"
|
|
22
24
|
import OneToManyV3FlowItem from "./flow/searcher/v3/item/OneToManyV3FlowItem"
|
|
23
25
|
import PopulateV3FlowItem from "./flow/searcher/v3/item/PopulateV3FlowItem"
|
|
26
|
+
import ProjectV3FlowItem from "./flow/searcher/v3/item/ProjectV3FlowItem"
|
|
27
|
+
import SortV3FlowItem from "./flow/searcher/v3/item/SortV3FlowItem"
|
|
24
28
|
import { IFacet } from "./model/Facet"
|
|
25
29
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger"
|
|
26
30
|
import { Options } from "./types/Options"
|
|
27
31
|
import { Pagination, SearchResponse } from "./types/SearchResponse"
|
|
28
32
|
import { initialize } from "./utils/Utils"
|
|
29
|
-
import SortV3FlowItem from "./flow/searcher/v3/item/SortV3FlowItem"
|
|
30
|
-
import ProjectV3FlowItem from "./flow/searcher/v3/item/ProjectV3FlowItem"
|
|
31
|
-
import GroupV3FlowItem from "./flow/searcher/v3/item/GroupV3FlowItem"
|
|
32
33
|
|
|
33
34
|
(global as any).LoggerRepository = undefined
|
|
34
35
|
|
|
35
|
-
export { AddStagePaginationFlowItem,
|
|
36
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildAndQueriesFlowItem, BuildOrQueriesFlowItem, BuildPaginationDataV3FlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, GetHighestNumberFlow, GetOneByFilterFlow, GetOneByFilterV3Flow, GroupV3FlowItem, IFacet, ILogger, initialize, LoggerModel, LoggerSearch, MatchFlowItem, MatchV3FlowItem, mongoose, OneToManyV3FlowItem, Options, Pagination, PopulateV3FlowItem, ProjectV3FlowItem, SearcherFlow, SearcherV2Flow, SearcherV3Flow, SearchFlow, SearchResponse, SortV3FlowItem, TypeOfOperation }
|
|
36
37
|
|