c2-mongoose 2.1.13 → 2.1.17
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/README.md +18 -18
- package/dist/configuration/Environment.d.ts +4 -4
- package/dist/configuration/Environment.js +5 -5
- package/dist/flow/CrudFlow.d.ts +19 -18
- package/dist/flow/CrudFlow.js +170 -149
- package/dist/flow/SearchFlow.d.ts +28 -28
- package/dist/flow/SearchFlow.js +308 -308
- package/dist/index.d.ts +4 -4
- package/dist/index.js +10 -10
- package/dist/utils/Utils.d.ts +6 -6
- package/dist/utils/Utils.js +56 -56
- package/package.json +1 -1
- package/src/configuration/Environment.ts +2 -2
- package/src/flow/CrudFlow.ts +66 -54
- package/src/flow/SearchFlow.ts +237 -237
- package/src/index.ts +5 -5
- package/src/types/SearchResponse.d.ts +9 -9
- package/src/utils/Utils.ts +56 -56
- package/tsconfig.json +12 -12
- package/dist/model/Search.d.ts +0 -26
- package/dist/model/Search.js +0 -265
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# c2-mongoose
|
|
2
|
-
|
|
3
|
-
## Guide to publish
|
|
4
|
-
|
|
5
|
-
Commit all changes with:
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
git add .
|
|
9
|
-
git commit -m 'your changes details'
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Running one of below, according with your changes:
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
npm run publish-patch --force -m "Message to tag publish" // to a new patch
|
|
16
|
-
npm run publish-minor --force -m "Message to tag publish" // to a new minor
|
|
17
|
-
npm run publish-major --force -m "Message to tag publish" // to a new major
|
|
18
|
-
```
|
|
1
|
+
# c2-mongoose
|
|
2
|
+
|
|
3
|
+
## Guide to publish
|
|
4
|
+
|
|
5
|
+
Commit all changes with:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
git add .
|
|
9
|
+
git commit -m 'your changes details'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Running one of below, according with your changes:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm run publish-patch --force -m "Message to tag publish" // to a new patch
|
|
16
|
+
npm run publish-minor --force -m "Message to tag publish" // to a new minor
|
|
17
|
+
npm run publish-major --force -m "Message to tag publish" // to a new major
|
|
18
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare const dbCollation: string;
|
|
3
|
-
declare const _default: NodeJS.ProcessEnv;
|
|
4
|
-
export default _default;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const dbCollation: string;
|
|
3
|
+
declare const _default: NodeJS.ProcessEnv;
|
|
4
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dbCollation = void 0;
|
|
4
|
-
exports.dbCollation = process.env.DB_COLLACTION;
|
|
5
|
-
exports.default = process.env;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dbCollation = void 0;
|
|
4
|
+
exports.dbCollation = process.env.DB_COLLACTION;
|
|
5
|
+
exports.default = process.env;
|
package/dist/flow/CrudFlow.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import mongoose, { ClientSession } from "mongoose";
|
|
2
|
-
import { SearchResponse } from "../types/SearchResponse";
|
|
3
|
-
import SearchFlow from "./SearchFlow";
|
|
4
|
-
declare class CrudFlow<D> {
|
|
5
|
-
private repository;
|
|
6
|
-
private search;
|
|
7
|
-
constructor(repository: mongoose.Model<any>, search?: SearchFlow);
|
|
8
|
-
prepareSearch(search: SearchFlow): void;
|
|
9
|
-
create(data: any, session?: any): Promise<any[]>;
|
|
10
|
-
delete(id: string, session?: any): Promise<void>;
|
|
11
|
-
deleteMany(conditions: {}, session?: any): Promise<void>;
|
|
12
|
-
update(id: string, data: D, session?: any): Promise<D>;
|
|
13
|
-
find(): Promise<SearchResponse<D>>;
|
|
14
|
-
getOne(model: D, params?: any): Promise<D>;
|
|
15
|
-
get(id: string, pop?: string, sel?: string, session?: ClientSession): Promise<D>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import mongoose, { ClientSession } from "mongoose";
|
|
2
|
+
import { SearchResponse } from "../types/SearchResponse";
|
|
3
|
+
import SearchFlow from "./SearchFlow";
|
|
4
|
+
declare class CrudFlow<D> {
|
|
5
|
+
private repository;
|
|
6
|
+
private search;
|
|
7
|
+
constructor(repository: mongoose.Model<any>, search?: SearchFlow);
|
|
8
|
+
prepareSearch(search: SearchFlow): void;
|
|
9
|
+
create(data: any, session?: any): Promise<any[]>;
|
|
10
|
+
delete(id: string, session?: any): Promise<void>;
|
|
11
|
+
deleteMany(conditions: {}, session?: any): Promise<void>;
|
|
12
|
+
update(id: string, data: D, session?: any): Promise<D>;
|
|
13
|
+
find(): Promise<SearchResponse<D>>;
|
|
14
|
+
getOne(model: D, params?: any): Promise<D>;
|
|
15
|
+
get(id: string, pop?: string, sel?: string, session?: ClientSession): Promise<D>;
|
|
16
|
+
getById(id: string, session?: ClientSession): Promise<Partial<D>>;
|
|
17
|
+
sumBy(fieldToSum: string, fieldToGroup: string): Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
export default CrudFlow;
|
package/dist/flow/CrudFlow.js
CHANGED
|
@@ -1,149 +1,170 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
case
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
case
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
case
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
case
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
case
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var Utils_1 = require("../utils/Utils");
|
|
40
|
+
var CrudFlow = /** @class */ (function () {
|
|
41
|
+
function CrudFlow(repository, search) {
|
|
42
|
+
this.repository = repository;
|
|
43
|
+
this.search = search;
|
|
44
|
+
}
|
|
45
|
+
CrudFlow.prototype.prepareSearch = function (search) {
|
|
46
|
+
this.search = search;
|
|
47
|
+
};
|
|
48
|
+
CrudFlow.prototype.create = function (data, session) {
|
|
49
|
+
if (session === void 0) { session = undefined; }
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, this.repository.create([data], { session: session })];
|
|
54
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
CrudFlow.prototype.delete = function (id, session) {
|
|
60
|
+
if (session === void 0) { session = undefined; }
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0: return [4 /*yield*/, this.repository.findByIdAndRemove(id, { session: session })];
|
|
65
|
+
case 1:
|
|
66
|
+
_a.sent();
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
CrudFlow.prototype.deleteMany = function (conditions, session) {
|
|
73
|
+
if (session === void 0) { session = undefined; }
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, this.repository.deleteMany(conditions).session(session)];
|
|
78
|
+
case 1:
|
|
79
|
+
_a.sent();
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
CrudFlow.prototype.update = function (id, data, session) {
|
|
86
|
+
if (session === void 0) { session = undefined; }
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var dataAfter;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, this.repository.findByIdAndUpdate(id, { $set: data }, { returnDocument: 'after', session: session })];
|
|
92
|
+
case 1:
|
|
93
|
+
dataAfter = _a.sent();
|
|
94
|
+
return [2 /*return*/, dataAfter];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
CrudFlow.prototype.find = function () {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0: return [4 /*yield*/, this.search.search(this.repository)];
|
|
104
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
CrudFlow.prototype.getOne = function (model, params) {
|
|
110
|
+
if (params === void 0) { params = {}; }
|
|
111
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
112
|
+
var data;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0: return [4 /*yield*/, this.search.findOne(this.repository, model, params)];
|
|
116
|
+
case 1:
|
|
117
|
+
data = _a.sent();
|
|
118
|
+
return [2 /*return*/, data];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
CrudFlow.prototype.get = function (id, pop, sel, session) {
|
|
124
|
+
if (pop === void 0) { pop = ""; }
|
|
125
|
+
if (sel === void 0) { sel = ""; }
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
+
var data;
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0: return [4 /*yield*/, this.repository.findById(id).populate(pop).select(sel).session(session)];
|
|
131
|
+
case 1:
|
|
132
|
+
data = _a.sent();
|
|
133
|
+
return [2 /*return*/, data];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
CrudFlow.prototype.getById = function (id, session) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var data;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
if ((0, Utils_1.isEmpty)(this.search)) {
|
|
145
|
+
throw new Error("Search params not informed");
|
|
146
|
+
}
|
|
147
|
+
return [4 /*yield*/, this.repository.findById(id)
|
|
148
|
+
.populate(this.search.populate)
|
|
149
|
+
.select(this.search.select)
|
|
150
|
+
.session(session)];
|
|
151
|
+
case 1:
|
|
152
|
+
data = _a.sent();
|
|
153
|
+
return [2 /*return*/, data];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
CrudFlow.prototype.sumBy = function (fieldToSum, fieldToGroup) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
+
return __generator(this, function (_a) {
|
|
161
|
+
switch (_a.label) {
|
|
162
|
+
case 0: return [4 /*yield*/, this.search.sumBy(this.repository, fieldToSum, fieldToGroup)];
|
|
163
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
return CrudFlow;
|
|
169
|
+
}());
|
|
170
|
+
exports.default = CrudFlow;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
import { SearchResponse } from "../types/SearchResponse";
|
|
3
|
-
declare abstract class SearchFlow {
|
|
4
|
-
searchText: string;
|
|
5
|
-
order: string;
|
|
6
|
-
orderBy: string;
|
|
7
|
-
page: number;
|
|
8
|
-
limit: number;
|
|
9
|
-
select: string;
|
|
10
|
-
populate: any;
|
|
11
|
-
filters: any;
|
|
12
|
-
constructor(params: any);
|
|
13
|
-
buildPopulate(): any;
|
|
14
|
-
buildPath(target: string, nested?: string): any;
|
|
15
|
-
buildOrdenation(): any;
|
|
16
|
-
private isPageable;
|
|
17
|
-
diacriticSensitiveRegex(string?: string): string;
|
|
18
|
-
search(model: mongoose.Model<any>): Promise<SearchResponse<any>>;
|
|
19
|
-
private searchPageable;
|
|
20
|
-
private searchNoPageable;
|
|
21
|
-
private result;
|
|
22
|
-
count(model: mongoose.Model<any>): Promise<number>;
|
|
23
|
-
findOne(repository: mongoose.Model<any>, model: any, params?: any): Promise<any>;
|
|
24
|
-
sumBy(model: mongoose.Model<any>, _sum: any, _by: any): Promise<any[]>;
|
|
25
|
-
buildDefaultFilters(objectSearch: any): any;
|
|
26
|
-
addFilterModel(model: any, filters: any): void;
|
|
27
|
-
}
|
|
28
|
-
export default SearchFlow;
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { SearchResponse } from "../types/SearchResponse";
|
|
3
|
+
declare abstract class SearchFlow {
|
|
4
|
+
searchText: string;
|
|
5
|
+
order: string;
|
|
6
|
+
orderBy: string;
|
|
7
|
+
page: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
select: string;
|
|
10
|
+
populate: any;
|
|
11
|
+
filters: any;
|
|
12
|
+
constructor(params: any);
|
|
13
|
+
buildPopulate(): any;
|
|
14
|
+
buildPath(target: string, nested?: string): any;
|
|
15
|
+
buildOrdenation(): any;
|
|
16
|
+
private isPageable;
|
|
17
|
+
diacriticSensitiveRegex(string?: string): string;
|
|
18
|
+
search(model: mongoose.Model<any>): Promise<SearchResponse<any>>;
|
|
19
|
+
private searchPageable;
|
|
20
|
+
private searchNoPageable;
|
|
21
|
+
private result;
|
|
22
|
+
count(model: mongoose.Model<any>): Promise<number>;
|
|
23
|
+
findOne(repository: mongoose.Model<any>, model: any, params?: any): Promise<any>;
|
|
24
|
+
sumBy(model: mongoose.Model<any>, _sum: any, _by: any): Promise<any[]>;
|
|
25
|
+
buildDefaultFilters(objectSearch: any): any;
|
|
26
|
+
addFilterModel(model: any, filters: any): void;
|
|
27
|
+
}
|
|
28
|
+
export default SearchFlow;
|