c2-mongoose 2.1.163 → 2.1.164
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/ConvertToSearchResponseFlowItem.d.ts +6 -0
- package/dist/flow/item/ConvertToSearchResponseFlowItem.js +28 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -5
- package/package.json +1 -1
- package/src/flow/item/ConvertToSearchResponseFlowItem.ts +31 -0
- package/src/index.ts +4 -6
- package/src/types/SearchResponse.d.ts +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var ConvertToSearchResponseFlowItem = /** @class */ (function () {
|
|
4
|
+
function ConvertToSearchResponseFlowItem() {
|
|
5
|
+
}
|
|
6
|
+
ConvertToSearchResponseFlowItem.prototype.convert = function (response) {
|
|
7
|
+
var searchResponse = {};
|
|
8
|
+
for (var key in response[0]) {
|
|
9
|
+
if (key.startsWith('metadata-')) {
|
|
10
|
+
var metadataName = key.replace("metadata-", "");
|
|
11
|
+
if (response[key].length === 1) {
|
|
12
|
+
searchResponse[metadataName] = response[0][key][0];
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
searchResponse[metadataName] = response[0][key];
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (key === 'paging') {
|
|
19
|
+
searchResponse[key] = response[0][key][0];
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
searchResponse[key] = response[0][key];
|
|
23
|
+
}
|
|
24
|
+
return searchResponse;
|
|
25
|
+
};
|
|
26
|
+
return ConvertToSearchResponseFlowItem;
|
|
27
|
+
}());
|
|
28
|
+
exports.default = new ConvertToSearchResponseFlowItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import C2Flow from "./flow/C2Flow";
|
|
2
2
|
import CrudFlow from "./flow/CrudFlow";
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow";
|
|
4
|
-
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem";
|
|
5
|
-
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem";
|
|
6
4
|
import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem";
|
|
7
5
|
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem";
|
|
6
|
+
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem";
|
|
7
|
+
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem";
|
|
8
|
+
import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponseFlowItem";
|
|
8
9
|
import { IFacet } from "./model/Facet";
|
|
9
10
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger";
|
|
10
11
|
import { Options } from "./types/Options";
|
|
11
12
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
12
13
|
import { initialize } from "./utils/Utils";
|
|
13
|
-
export { C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize
|
|
14
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, IFacet, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize };
|
package/dist/index.js
CHANGED
|
@@ -3,21 +3,23 @@ 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.initialize = exports.TypeOfOperation = exports.SearchFlow = exports.LoggerSearch = exports.LoggerModel = exports.CrudFlow = exports.ConvertToSearchResponseFlowItem = exports.C2Flow = exports.BuildPipelineToJoinFlowItem = exports.BuildPipelineToCountJoinFlowItem = exports.AddStageSortFlowItem = exports.AddStagePaginationFlowItem = 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"));
|
|
10
10
|
exports.CrudFlow = CrudFlow_1.default;
|
|
11
11
|
var SearchFlow_1 = __importDefault(require("./flow/SearchFlow"));
|
|
12
12
|
exports.SearchFlow = SearchFlow_1.default;
|
|
13
|
-
var BuildPipelineToCountJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToCountJoinFlowItem"));
|
|
14
|
-
exports.BuildPipelineToCountJoinFlowItem = BuildPipelineToCountJoinFlowItem_1.default;
|
|
15
|
-
var BuildPipelineToJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToJoinFlowItem"));
|
|
16
|
-
exports.BuildPipelineToJoinFlowItem = BuildPipelineToJoinFlowItem_1.default;
|
|
17
13
|
var AddStagePaginationFlowItem_1 = __importDefault(require("./flow/item/AddStagePaginationFlowItem"));
|
|
18
14
|
exports.AddStagePaginationFlowItem = AddStagePaginationFlowItem_1.default;
|
|
19
15
|
var AddStageSortFlowItem_1 = __importDefault(require("./flow/item/AddStageSortFlowItem"));
|
|
20
16
|
exports.AddStageSortFlowItem = AddStageSortFlowItem_1.default;
|
|
17
|
+
var BuildPipelineToCountJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToCountJoinFlowItem"));
|
|
18
|
+
exports.BuildPipelineToCountJoinFlowItem = BuildPipelineToCountJoinFlowItem_1.default;
|
|
19
|
+
var BuildPipelineToJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToJoinFlowItem"));
|
|
20
|
+
exports.BuildPipelineToJoinFlowItem = BuildPipelineToJoinFlowItem_1.default;
|
|
21
|
+
var ConvertToSearchResponseFlowItem_1 = __importDefault(require("./flow/item/ConvertToSearchResponseFlowItem"));
|
|
22
|
+
exports.ConvertToSearchResponseFlowItem = ConvertToSearchResponseFlowItem_1.default;
|
|
21
23
|
var Logger_1 = require("./model/Logger");
|
|
22
24
|
Object.defineProperty(exports, "LoggerModel", { enumerable: true, get: function () { return Logger_1.LoggerModel; } });
|
|
23
25
|
Object.defineProperty(exports, "LoggerSearch", { enumerable: true, get: function () { return Logger_1.LoggerSearch; } });
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SearchResponse } from "../../types/SearchResponse";
|
|
2
|
+
|
|
3
|
+
class ConvertToSearchResponseFlowItem {
|
|
4
|
+
|
|
5
|
+
convert(response: any[]): SearchResponse<any> {
|
|
6
|
+
const searchResponse: SearchResponse<any> = {};
|
|
7
|
+
|
|
8
|
+
for (const key in response[0]) {
|
|
9
|
+
if (key.startsWith('metadata-')) {
|
|
10
|
+
let metadataName = key.replace("metadata-", "")
|
|
11
|
+
if (response[key as any].length === 1) {
|
|
12
|
+
searchResponse[metadataName] = response[0][key as any][0]
|
|
13
|
+
continue
|
|
14
|
+
}
|
|
15
|
+
searchResponse[metadataName] = response[0][key as any]
|
|
16
|
+
continue
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (key === 'paging') {
|
|
20
|
+
searchResponse[key] = response[0][key][0];
|
|
21
|
+
continue
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
searchResponse[key] = response[0][key];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return searchResponse
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default new ConvertToSearchResponseFlowItem
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import C2Flow from "./flow/C2Flow"
|
|
2
2
|
import CrudFlow from "./flow/CrudFlow"
|
|
3
3
|
import SearchFlow from "./flow/SearchFlow"
|
|
4
|
-
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem"
|
|
5
|
-
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem"
|
|
6
4
|
import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem"
|
|
7
5
|
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem"
|
|
6
|
+
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem"
|
|
7
|
+
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem"
|
|
8
|
+
import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponseFlowItem"
|
|
8
9
|
import { IFacet } from "./model/Facet"
|
|
9
10
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger"
|
|
10
11
|
import { Options } from "./types/Options"
|
|
@@ -13,8 +14,5 @@ import { initialize } from "./utils/Utils"
|
|
|
13
14
|
|
|
14
15
|
(global as any).LoggerRepository = undefined
|
|
15
16
|
|
|
16
|
-
export {
|
|
17
|
-
C2Flow, CrudFlow, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize,
|
|
18
|
-
BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, IFacet, AddStagePaginationFlowItem, AddStageSortFlowItem
|
|
19
|
-
}
|
|
17
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, IFacet, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, TypeOfOperation, initialize }
|
|
20
18
|
|