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