c2-mongoose 2.1.258 → 2.1.260
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/SearchFlow.js
CHANGED
|
@@ -165,10 +165,11 @@ var SearchFlow = /** @class */ (function () {
|
|
|
165
165
|
return new RegExp("".concat(regexExpression), 'i');
|
|
166
166
|
};
|
|
167
167
|
SearchFlow.prototype.searchNoPageable = function (model, options) {
|
|
168
|
+
var _a;
|
|
168
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
-
var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result,
|
|
170
|
-
return __generator(this, function (
|
|
171
|
-
switch (
|
|
170
|
+
var stagesItems, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result, _b, _c, populate, _d, resultAux;
|
|
171
|
+
return __generator(this, function (_e) {
|
|
172
|
+
switch (_e.label) {
|
|
172
173
|
case 0:
|
|
173
174
|
stagesItems = [];
|
|
174
175
|
if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
|
|
@@ -199,26 +200,26 @@ var SearchFlow = /** @class */ (function () {
|
|
|
199
200
|
$facet: facet
|
|
200
201
|
},
|
|
201
202
|
], {
|
|
202
|
-
collation: {
|
|
203
|
+
collation: (_a = options === null || options === void 0 ? void 0 : options.collaction) !== null && _a !== void 0 ? _a : {
|
|
203
204
|
locale: "pt",
|
|
204
205
|
numericOrdering: true
|
|
205
206
|
}
|
|
206
207
|
}).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
207
208
|
case 1:
|
|
208
|
-
result =
|
|
209
|
+
result = _e.sent();
|
|
209
210
|
if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
_b = 0, _c = this.populate;
|
|
212
|
+
_e.label = 2;
|
|
212
213
|
case 2:
|
|
213
|
-
if (!(
|
|
214
|
-
populate = _b
|
|
215
|
-
|
|
214
|
+
if (!(_b < _c.length)) return [3 /*break*/, 5];
|
|
215
|
+
populate = _c[_b];
|
|
216
|
+
_d = result[0];
|
|
216
217
|
return [4 /*yield*/, model.populate(result[0].items, populate)];
|
|
217
218
|
case 3:
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
_d.items = _e.sent();
|
|
220
|
+
_e.label = 4;
|
|
220
221
|
case 4:
|
|
221
|
-
|
|
222
|
+
_b++;
|
|
222
223
|
return [3 /*break*/, 2];
|
|
223
224
|
case 5:
|
|
224
225
|
resultAux = this.transformObject(result[0]);
|
|
@@ -228,10 +229,11 @@ var SearchFlow = /** @class */ (function () {
|
|
|
228
229
|
});
|
|
229
230
|
};
|
|
230
231
|
SearchFlow.prototype.searchPageable = function (model, options) {
|
|
232
|
+
var _a;
|
|
231
233
|
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
-
var stagesItems, stagesPaging, stagesMetadata, facet, _i, stagesMetadata_2, metadata, result,
|
|
233
|
-
return __generator(this, function (
|
|
234
|
-
switch (
|
|
234
|
+
var stagesItems, stagesPaging, stagesMetadata, facet, _i, stagesMetadata_2, metadata, result, _b, _c, populate, _d, resultAux;
|
|
235
|
+
return __generator(this, function (_e) {
|
|
236
|
+
switch (_e.label) {
|
|
235
237
|
case 0:
|
|
236
238
|
stagesItems = [];
|
|
237
239
|
if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
|
|
@@ -293,26 +295,26 @@ var SearchFlow = /** @class */ (function () {
|
|
|
293
295
|
$facet: facet
|
|
294
296
|
},
|
|
295
297
|
], {
|
|
296
|
-
collation: {
|
|
298
|
+
collation: (_a = options === null || options === void 0 ? void 0 : options.collaction) !== null && _a !== void 0 ? _a : {
|
|
297
299
|
locale: "pt",
|
|
298
300
|
numericOrdering: true
|
|
299
301
|
}
|
|
300
302
|
}).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
301
303
|
case 1:
|
|
302
|
-
result =
|
|
304
|
+
result = _e.sent();
|
|
303
305
|
if (!((0, Utils_1.isNotEmpty)(this.populate) && Array.isArray(this.populate))) return [3 /*break*/, 5];
|
|
304
|
-
|
|
305
|
-
|
|
306
|
+
_b = 0, _c = this.populate;
|
|
307
|
+
_e.label = 2;
|
|
306
308
|
case 2:
|
|
307
|
-
if (!(
|
|
308
|
-
populate = _b
|
|
309
|
-
|
|
309
|
+
if (!(_b < _c.length)) return [3 /*break*/, 5];
|
|
310
|
+
populate = _c[_b];
|
|
311
|
+
_d = result[0];
|
|
310
312
|
return [4 /*yield*/, model.populate(result[0].items, populate)];
|
|
311
313
|
case 3:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
_d.items = _e.sent();
|
|
315
|
+
_e.label = 4;
|
|
314
316
|
case 4:
|
|
315
|
-
|
|
317
|
+
_b++;
|
|
316
318
|
return [3 /*break*/, 2];
|
|
317
319
|
case 5:
|
|
318
320
|
resultAux = this.transformObject(result[0]);
|
|
@@ -86,10 +86,11 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
86
86
|
this.limit = Number(this.limit);
|
|
87
87
|
};
|
|
88
88
|
SearcherFlow.prototype.search = function (options) {
|
|
89
|
+
var _a;
|
|
89
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
var stagesItems, stagesPaging, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result,
|
|
91
|
-
return __generator(this, function (
|
|
92
|
-
switch (
|
|
91
|
+
var stagesItems, stagesPaging, stagesMetadata, facet, _i, stagesMetadata_1, metadata, result, _b, resultAux;
|
|
92
|
+
return __generator(this, function (_c) {
|
|
93
|
+
switch (_c.label) {
|
|
93
94
|
case 0:
|
|
94
95
|
stagesItems = [];
|
|
95
96
|
if ((0, Utils_1.isNotEmpty)(options.pipelines)) {
|
|
@@ -156,19 +157,19 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
156
157
|
$facet: facet
|
|
157
158
|
},
|
|
158
159
|
], {
|
|
159
|
-
collation: {
|
|
160
|
+
collation: (_a = options === null || options === void 0 ? void 0 : options.collaction) !== null && _a !== void 0 ? _a : {
|
|
160
161
|
locale: "pt",
|
|
161
162
|
numericOrdering: true
|
|
162
163
|
}
|
|
163
164
|
}).session(options === null || options === void 0 ? void 0 : options.session)];
|
|
164
165
|
case 1:
|
|
165
|
-
result =
|
|
166
|
+
result = _c.sent();
|
|
166
167
|
if (!(0, Utils_1.isNotEmpty)(this.populate)) return [3 /*break*/, 3];
|
|
167
|
-
|
|
168
|
+
_b = result[0];
|
|
168
169
|
return [4 /*yield*/, this.model.populate(result[0].items, BuildPopulateSingleFlowItem_1.default.buildPopulate(this.model, this.populate, this.select))];
|
|
169
170
|
case 2:
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
_b.items = _c.sent();
|
|
172
|
+
_c.label = 3;
|
|
172
173
|
case 3:
|
|
173
174
|
resultAux = this.transformObject(result[0]);
|
|
174
175
|
return [2 /*return*/, resultAux];
|
package/dist/model/Logger.js
CHANGED
|
@@ -65,6 +65,10 @@ var LoggerModel = new mongoose_1.Schema({
|
|
|
65
65
|
});
|
|
66
66
|
exports.LoggerModel = LoggerModel;
|
|
67
67
|
LoggerModel.index({ "data._id": 1 }, { unique: false });
|
|
68
|
+
LoggerModel.index({ owner: 1 }, { unique: false });
|
|
69
|
+
LoggerModel.index({ user: 1 }, { unique: false });
|
|
70
|
+
LoggerModel.index({ collectionName: 1 }, { unique: false });
|
|
71
|
+
LoggerModel.index({ operation: 1 }, { unique: false });
|
|
68
72
|
var LoggerSearch = /** @class */ (function (_super) {
|
|
69
73
|
__extends(LoggerSearch, _super);
|
|
70
74
|
function LoggerSearch(params) {
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -194,7 +194,7 @@ abstract class SearchFlow {
|
|
|
194
194
|
$facet: facet
|
|
195
195
|
},
|
|
196
196
|
], {
|
|
197
|
-
collation: {
|
|
197
|
+
collation: options?.collaction ?? {
|
|
198
198
|
locale: "pt",
|
|
199
199
|
numericOrdering: true
|
|
200
200
|
}
|
|
@@ -285,7 +285,7 @@ abstract class SearchFlow {
|
|
|
285
285
|
$facet: facet
|
|
286
286
|
},
|
|
287
287
|
], {
|
|
288
|
-
collation: {
|
|
288
|
+
collation: options?.collaction ?? {
|
|
289
289
|
locale: "pt",
|
|
290
290
|
numericOrdering: true
|
|
291
291
|
}
|
package/src/flow/SearcherFlow.ts
CHANGED
package/src/model/Logger.ts
CHANGED
|
@@ -33,6 +33,10 @@ const LoggerModel = new Schema({
|
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
LoggerModel.index({ "data._id": 1 }, { unique: false })
|
|
36
|
+
LoggerModel.index({ owner: 1 }, { unique: false })
|
|
37
|
+
LoggerModel.index({ user: 1 }, { unique: false })
|
|
38
|
+
LoggerModel.index({ collectionName: 1 }, { unique: false })
|
|
39
|
+
LoggerModel.index({ operation: 1 }, { unique: false })
|
|
36
40
|
|
|
37
41
|
class LoggerSearch extends SearchFlow {
|
|
38
42
|
model: Partial<ILogger>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClientSession } from "mongoose";
|
|
2
|
+
import { CollationOptions } from "mongodb";
|
|
2
3
|
|
|
3
4
|
declare interface SearchResponse<T> {
|
|
4
5
|
[key: string]: any;
|
|
@@ -21,7 +22,8 @@ declare interface SearchOptions {
|
|
|
21
22
|
pipelines: PipelineStage[],
|
|
22
23
|
paging: PipelineStage[],
|
|
23
24
|
metadata: PipelineStage[],
|
|
24
|
-
session?: ClientSession
|
|
25
|
+
session?: ClientSession,
|
|
26
|
+
collaction?: CollationOptions
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export { SearchResponse, Pagination, PipelineStage, SearchOptions };
|