c2-mongoose 2.1.159 → 2.1.161
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/item/AddStagePaginationFlowItem.d.ts +7 -0
- package/dist/flow/item/AddStagePaginationFlowItem.js +23 -0
- package/dist/flow/item/AddStageSortFlowItem.d.ts +7 -0
- package/dist/flow/item/AddStageSortFlowItem.js +18 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/flow/item/{GetStagePaginationFlowItem.ts → AddStagePaginationFlowItem.ts} +1 -1
- package/src/flow/item/{GetStageSortFlowItem.ts → AddStageSortFlowItem.ts} +1 -0
- package/src/index.ts +3 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFacet } from "../../model/Facet";
|
|
2
|
+
import SearchFlow from "../SearchFlow";
|
|
3
|
+
declare class GetStagePaginationFlowItem {
|
|
4
|
+
get(facet: IFacet | undefined, searcher: SearchFlow): IFacet;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: GetStagePaginationFlowItem;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var GetStagePaginationFlowItem = /** @class */ (function () {
|
|
4
|
+
function GetStagePaginationFlowItem() {
|
|
5
|
+
}
|
|
6
|
+
GetStagePaginationFlowItem.prototype.get = function (facet, searcher) {
|
|
7
|
+
if (facet === void 0) { facet = { items: [] }; }
|
|
8
|
+
var facetAfter = facet;
|
|
9
|
+
if (searcher.pageable === false) {
|
|
10
|
+
return facetAfter;
|
|
11
|
+
}
|
|
12
|
+
facetAfter.items.push({ $skip: ((searcher.page - 1) * searcher.limit) });
|
|
13
|
+
facetAfter.items.push({ $limit: searcher.limit });
|
|
14
|
+
facetAfter.paging = [
|
|
15
|
+
{ $count: "total" },
|
|
16
|
+
{ $addFields: { page: searcher.page || 1, limit: searcher.limit } }
|
|
17
|
+
];
|
|
18
|
+
facet = facetAfter;
|
|
19
|
+
return facetAfter;
|
|
20
|
+
};
|
|
21
|
+
return GetStagePaginationFlowItem;
|
|
22
|
+
}());
|
|
23
|
+
exports.default = new GetStagePaginationFlowItem;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var GetStageSortFlowItem = /** @class */ (function () {
|
|
4
|
+
function GetStageSortFlowItem() {
|
|
5
|
+
}
|
|
6
|
+
GetStageSortFlowItem.prototype.get = function (facet, searcher) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (facet === void 0) { facet = { items: [] }; }
|
|
9
|
+
var facetAfter = facet;
|
|
10
|
+
var sortByDirection = searcher.order === "desc" ? -1 : 1;
|
|
11
|
+
var sortByField = searcher.orderBy || "_id";
|
|
12
|
+
facetAfter.items.push({ $sort: (_a = {}, _a["".concat(sortByField)] = sortByDirection, _a) });
|
|
13
|
+
facet = facetAfter;
|
|
14
|
+
return facetAfter;
|
|
15
|
+
};
|
|
16
|
+
return GetStageSortFlowItem;
|
|
17
|
+
}());
|
|
18
|
+
exports.default = new GetStageSortFlowItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import CrudFlow from "./flow/CrudFlow";
|
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow";
|
|
4
4
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem";
|
|
5
5
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem";
|
|
7
|
+
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem";
|
|
8
8
|
import { IFacet } from "./model/Facet";
|
|
9
9
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger";
|
|
10
10
|
import { Options } from "./types/Options";
|
|
11
11
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
12
12
|
import { initialize } from "./utils/Utils";
|
|
13
|
-
export { C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet,
|
|
13
|
+
export { C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet, AddStagePaginationFlowItem, AddStageSortFlowItem };
|
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.
|
|
6
|
+
exports.AddStageSortFlowItem = exports.AddStagePaginationFlowItem = exports.BuildPipelineToJoinFlowItem = exports.BuildPipelineToCountJoinFlowItem = exports.initialize = exports.TypeOfOperation = exports.SearchFlow = exports.LoggerSearch = exports.LoggerModel = exports.CrudFlow = exports.C2Flow = void 0;
|
|
7
7
|
var C2Flow_1 = __importDefault(require("./flow/C2Flow"));
|
|
8
8
|
exports.C2Flow = C2Flow_1.default;
|
|
9
9
|
var CrudFlow_1 = __importDefault(require("./flow/CrudFlow"));
|
|
@@ -14,10 +14,10 @@ var BuildPipelineToCountJoinFlowItem_1 = __importDefault(require("./flow/item/Bu
|
|
|
14
14
|
exports.BuildPipelineToCountJoinFlowItem = BuildPipelineToCountJoinFlowItem_1.default;
|
|
15
15
|
var BuildPipelineToJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToJoinFlowItem"));
|
|
16
16
|
exports.BuildPipelineToJoinFlowItem = BuildPipelineToJoinFlowItem_1.default;
|
|
17
|
-
var
|
|
18
|
-
exports.
|
|
19
|
-
var
|
|
20
|
-
exports.
|
|
17
|
+
var AddStagePaginationFlowItem_1 = __importDefault(require("./flow/item/AddStagePaginationFlowItem"));
|
|
18
|
+
exports.AddStagePaginationFlowItem = AddStagePaginationFlowItem_1.default;
|
|
19
|
+
var AddStageSortFlowItem_1 = __importDefault(require("./flow/item/AddStageSortFlowItem"));
|
|
20
|
+
exports.AddStageSortFlowItem = AddStageSortFlowItem_1.default;
|
|
21
21
|
var Logger_1 = require("./model/Logger");
|
|
22
22
|
Object.defineProperty(exports, "LoggerModel", { enumerable: true, get: function () { return Logger_1.LoggerModel; } });
|
|
23
23
|
Object.defineProperty(exports, "LoggerSearch", { enumerable: true, get: function () { return Logger_1.LoggerSearch; } });
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import CrudFlow from "./flow/CrudFlow"
|
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow"
|
|
4
4
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem"
|
|
5
5
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem"
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem"
|
|
7
|
+
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem"
|
|
8
8
|
import { IFacet } from "./model/Facet"
|
|
9
9
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger"
|
|
10
10
|
import { Options } from "./types/Options"
|
|
@@ -15,6 +15,6 @@ import { initialize } from "./utils/Utils"
|
|
|
15
15
|
|
|
16
16
|
export {
|
|
17
17
|
C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize,
|
|
18
|
-
BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet,
|
|
18
|
+
BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet, AddStagePaginationFlowItem, AddStageSortFlowItem
|
|
19
19
|
}
|
|
20
20
|
|