c2-mongoose 2.1.378 → 2.1.379
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 +7 -0
- package/dist/flow/searcher/v3/GetOneByFilterV3Flow.js +84 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/flow/searcher/v3/{GetOneByFilterFlow.ts → GetOneByFilterV3Flow.ts} +2 -2
- package/src/index.ts +2 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { IForeingData } from "./item/OneToManyFlowItem";
|
|
3
|
+
declare class GetOneByFilterV3Flow {
|
|
4
|
+
exec(params: any, model: mongoose.Model<any>, oneToMany?: IForeingData[]): Promise<any>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: GetOneByFilterV3Flow;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
var OneToManyFlowItem_1 = __importDefault(require("./item/OneToManyFlowItem"));
|
|
52
|
+
var PopulateFlowItem_1 = __importDefault(require("./item/PopulateFlowItem"));
|
|
53
|
+
var ProjectFlowItem_1 = __importDefault(require("./item/ProjectFlowItem"));
|
|
54
|
+
var MatchFlowItem_1 = __importDefault(require("./item/MatchFlowItem"));
|
|
55
|
+
var GetOneByFilterV3Flow = /** @class */ (function () {
|
|
56
|
+
function GetOneByFilterV3Flow() {
|
|
57
|
+
}
|
|
58
|
+
GetOneByFilterV3Flow.prototype.exec = function (params, model, oneToMany) {
|
|
59
|
+
if (oneToMany === void 0) { oneToMany = []; }
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
var pipeline, result;
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
pipeline = [];
|
|
66
|
+
pipeline = __spreadArray(__spreadArray([], pipeline, true), PopulateFlowItem_1.default.execute(params.populate, model), true);
|
|
67
|
+
pipeline = __spreadArray(__spreadArray([], pipeline, true), OneToManyFlowItem_1.default.execute(oneToMany), true);
|
|
68
|
+
pipeline = __spreadArray(__spreadArray([], pipeline, true), ProjectFlowItem_1.default.execute(params.select), true);
|
|
69
|
+
return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray([], MatchFlowItem_1.default.execute(params, model), true), pipeline, true), {
|
|
70
|
+
collation: {
|
|
71
|
+
locale: "pt",
|
|
72
|
+
numericOrdering: true
|
|
73
|
+
}
|
|
74
|
+
}).read('secondaryPreferred')];
|
|
75
|
+
case 1:
|
|
76
|
+
result = _a.sent();
|
|
77
|
+
return [2 /*return*/, result[0]];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return GetOneByFilterV3Flow;
|
|
83
|
+
}());
|
|
84
|
+
exports.default = new GetOneByFilterV3Flow;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,11 @@ import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponse
|
|
|
13
13
|
import GetHighestNumberFlow from "./flow/searcher/v2/GetHighestNumberFlow";
|
|
14
14
|
import GetOneByFilterFlow from "./flow/searcher/v2/GetOneByFilterFlow";
|
|
15
15
|
import SearcherV2Flow from "./flow/searcher/v2/SearcherV2Flow";
|
|
16
|
+
import GetOneByFilterV3Flow from "./flow/searcher/v3/GetOneByFilterV3Flow";
|
|
16
17
|
import SearcherV3Flow from "./flow/searcher/v3/SearcherV3Flow";
|
|
17
18
|
import { IFacet } from "./model/Facet";
|
|
18
19
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger";
|
|
19
20
|
import { Options } from "./types/Options";
|
|
20
21
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
21
22
|
import { initialize } from "./utils/Utils";
|
|
22
|
-
export {
|
|
23
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, GetHighestNumberFlow, GetOneByFilterFlow, GetOneByFilterV3Flow, IFacet, ILogger, initialize, LoggerModel, LoggerSearch, mongoose, Options, Pagination, SearcherFlow, SearcherV2Flow, SearcherV3Flow, SearchFlow, SearchResponse, 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.
|
|
6
|
+
exports.TypeOfOperation = exports.SearchFlow = exports.SearcherV3Flow = exports.SearcherV2Flow = exports.SearcherFlow = exports.mongoose = 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.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"));
|
|
@@ -34,6 +34,8 @@ var GetOneByFilterFlow_1 = __importDefault(require("./flow/searcher/v2/GetOneByF
|
|
|
34
34
|
exports.GetOneByFilterFlow = GetOneByFilterFlow_1.default;
|
|
35
35
|
var SearcherV2Flow_1 = __importDefault(require("./flow/searcher/v2/SearcherV2Flow"));
|
|
36
36
|
exports.SearcherV2Flow = SearcherV2Flow_1.default;
|
|
37
|
+
var GetOneByFilterV3Flow_1 = __importDefault(require("./flow/searcher/v3/GetOneByFilterV3Flow"));
|
|
38
|
+
exports.GetOneByFilterV3Flow = GetOneByFilterV3Flow_1.default;
|
|
37
39
|
var SearcherV3Flow_1 = __importDefault(require("./flow/searcher/v3/SearcherV3Flow"));
|
|
38
40
|
exports.SearcherV3Flow = SearcherV3Flow_1.default;
|
|
39
41
|
var Logger_1 = require("./model/Logger");
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import MatchFlowItem from "./item/MatchFlowItem"
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class GetOneByFilterV3Flow {
|
|
10
10
|
|
|
11
11
|
async exec(params: any, model: mongoose.Model<any>, oneToMany: IForeingData[] = []) {
|
|
12
12
|
|
|
@@ -29,4 +29,4 @@ class GetOneByFilterFlow {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export default new
|
|
32
|
+
export default new GetOneByFilterV3Flow
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponse
|
|
|
13
13
|
import GetHighestNumberFlow from "./flow/searcher/v2/GetHighestNumberFlow"
|
|
14
14
|
import GetOneByFilterFlow from "./flow/searcher/v2/GetOneByFilterFlow"
|
|
15
15
|
import SearcherV2Flow from "./flow/searcher/v2/SearcherV2Flow"
|
|
16
|
+
import GetOneByFilterV3Flow from "./flow/searcher/v3/GetOneByFilterV3Flow"
|
|
16
17
|
import SearcherV3Flow from "./flow/searcher/v3/SearcherV3Flow"
|
|
17
18
|
import { IFacet } from "./model/Facet"
|
|
18
19
|
import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Logger"
|
|
@@ -22,6 +23,5 @@ import { initialize } from "./utils/Utils"
|
|
|
22
23
|
|
|
23
24
|
(global as any).LoggerRepository = undefined
|
|
24
25
|
|
|
25
|
-
export {
|
|
26
|
-
SearcherV2Flow, SearcherV3Flow, GetOneByFilterFlow }
|
|
26
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, GetHighestNumberFlow, GetOneByFilterFlow, GetOneByFilterV3Flow, IFacet, ILogger, initialize, LoggerModel, LoggerSearch, mongoose, Options, Pagination, SearcherFlow, SearcherV2Flow, SearcherV3Flow, SearchFlow, SearchResponse, TypeOfOperation }
|
|
27
27
|
|