c2-mongoose 2.1.166 → 2.1.168
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/C2Flow.js +1 -1
- package/dist/flow/SearchFlow.d.ts +1 -0
- package/dist/flow/SearchFlow.js +14 -7
- package/package.json +1 -1
- package/src/flow/C2Flow.ts +1 -1
- package/src/flow/SearchFlow.ts +13 -8
package/dist/flow/C2Flow.js
CHANGED
|
@@ -85,7 +85,7 @@ var C2Flow = /** @class */ (function () {
|
|
|
85
85
|
case 1:
|
|
86
86
|
dataAfter = _a.sent();
|
|
87
87
|
if (options.logger === false) {
|
|
88
|
-
return [2 /*return*/, dataAfter
|
|
88
|
+
return [2 /*return*/, dataAfter];
|
|
89
89
|
}
|
|
90
90
|
log = BuildLogFlowItem_1.default.build(options, dataAfter[0]._doc, Logger_1.TypeOfOperation.CREATE, this.repository);
|
|
91
91
|
return [4 /*yield*/, global.LoggerRepository.create([log], { session: options.session })];
|
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -62,6 +62,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
62
62
|
this.populate = params.populate;
|
|
63
63
|
this.page = Number(params.page || 1);
|
|
64
64
|
this.limit = Number(params.limit || 25);
|
|
65
|
+
this.onlyMetadata = params.onlyMetadata;
|
|
65
66
|
this.pageable = params.pageable == false || params.pageable == 'false' ? false : true;
|
|
66
67
|
this.projection = this.buildProjections();
|
|
67
68
|
this.populate = this.buildPopulate();
|
|
@@ -173,9 +174,10 @@ var SearchFlow = /** @class */ (function () {
|
|
|
173
174
|
if ((0, Utils_1.isNotEmpty)(options.metadata)) {
|
|
174
175
|
stagesMetadata.push.apply(stagesMetadata, options.metadata);
|
|
175
176
|
}
|
|
176
|
-
facet = {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
facet = {};
|
|
178
|
+
if (this.onlyMetadata === false || this.onlyMetadata === undefined) {
|
|
179
|
+
facet.items = stagesItems;
|
|
180
|
+
}
|
|
179
181
|
for (_i = 0, stagesMetadata_1 = stagesMetadata; _i < stagesMetadata_1.length; _i++) {
|
|
180
182
|
metadata = stagesMetadata_1[_i];
|
|
181
183
|
facet[metadata.id] = metadata.conditions;
|
|
@@ -242,10 +244,15 @@ var SearchFlow = /** @class */ (function () {
|
|
|
242
244
|
if ((0, Utils_1.isNotEmpty)(options.metadata)) {
|
|
243
245
|
stagesMetadata.push.apply(stagesMetadata, options.metadata);
|
|
244
246
|
}
|
|
245
|
-
facet = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
facet = {};
|
|
248
|
+
if (this.onlyMetadata === false || this.onlyMetadata === undefined) {
|
|
249
|
+
facet.items = stagesItems;
|
|
250
|
+
facet.paging = stagesPaging;
|
|
251
|
+
}
|
|
252
|
+
// const facet: { [key: string]: any } = {
|
|
253
|
+
// items: stagesItems,
|
|
254
|
+
// paging: stagesPaging,
|
|
255
|
+
// }
|
|
249
256
|
for (_i = 0, stagesMetadata_2 = stagesMetadata; _i < stagesMetadata_2.length; _i++) {
|
|
250
257
|
metadata = stagesMetadata_2[_i];
|
|
251
258
|
facet[metadata.id] = metadata.conditions;
|
package/package.json
CHANGED
package/src/flow/C2Flow.ts
CHANGED
|
@@ -30,7 +30,7 @@ class C2Flow<D> {
|
|
|
30
30
|
let dataAfter = await this.repository.create(data, { session: options.session })
|
|
31
31
|
|
|
32
32
|
if (options.logger === false) {
|
|
33
|
-
return dataAfter
|
|
33
|
+
return dataAfter
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
let log: Partial<ILogger> = BuildLogFlowItem.build(options, dataAfter[0]._doc, TypeOfOperation.CREATE, this.repository)
|
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -14,6 +14,7 @@ abstract class SearchFlow {
|
|
|
14
14
|
filters: any
|
|
15
15
|
sort: any
|
|
16
16
|
pageable: boolean
|
|
17
|
+
onlyMetadata: boolean
|
|
17
18
|
projection: { [key: string]: number } | undefined
|
|
18
19
|
|
|
19
20
|
constructor(params: any) {
|
|
@@ -24,6 +25,7 @@ abstract class SearchFlow {
|
|
|
24
25
|
this.populate = params.populate
|
|
25
26
|
this.page = Number(params.page || 1)
|
|
26
27
|
this.limit = Number(params.limit || 25)
|
|
28
|
+
this.onlyMetadata = params.onlyMetadata
|
|
27
29
|
this.pageable = params.pageable == false || params.pageable == 'false' ? false : true
|
|
28
30
|
this.projection = this.buildProjections()
|
|
29
31
|
this.populate = this.buildPopulate()
|
|
@@ -143,9 +145,7 @@ abstract class SearchFlow {
|
|
|
143
145
|
stagesItems.push({ $project: this.projection })
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
|
|
147
148
|
stagesItems.push({ $sort: this.sort })
|
|
148
|
-
// stagesItems.push({ $limit: this.limit ?? 50 })
|
|
149
149
|
|
|
150
150
|
let stagesMetadata: any[] = []
|
|
151
151
|
if (isNotEmpty(options.metadata)) {
|
|
@@ -153,8 +153,9 @@ abstract class SearchFlow {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
const facet: { [key: string]: any } = {
|
|
157
|
-
|
|
156
|
+
const facet: { [key: string]: any } = {}
|
|
157
|
+
if (this.onlyMetadata === false || this.onlyMetadata === undefined) {
|
|
158
|
+
facet.items = stagesItems
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
for (let metadata of stagesMetadata) {
|
|
@@ -218,11 +219,15 @@ abstract class SearchFlow {
|
|
|
218
219
|
stagesMetadata.push(...options.metadata)
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
items
|
|
224
|
-
paging
|
|
222
|
+
const facet: { [key: string]: any } = {}
|
|
223
|
+
if (this.onlyMetadata === false || this.onlyMetadata === undefined) {
|
|
224
|
+
facet.items = stagesItems
|
|
225
|
+
facet.paging = stagesPaging
|
|
225
226
|
}
|
|
227
|
+
// const facet: { [key: string]: any } = {
|
|
228
|
+
// items: stagesItems,
|
|
229
|
+
// paging: stagesPaging,
|
|
230
|
+
// }
|
|
226
231
|
|
|
227
232
|
for (let metadata of stagesMetadata) {
|
|
228
233
|
facet[metadata.id] = metadata.conditions
|