c2-mongoose 2.1.167 → 2.1.169
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.d.ts +1 -0
- package/dist/flow/SearchFlow.js +15 -8
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +14 -9
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;
|
|
@@ -499,7 +506,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
499
506
|
if (key.endsWith('Like')) {
|
|
500
507
|
return;
|
|
501
508
|
}
|
|
502
|
-
if (['pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
509
|
+
if (['onlyMetadata', 'pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
503
510
|
return;
|
|
504
511
|
}
|
|
505
512
|
if ((0, Utils_1.isNotEmpty)(value)) {
|
package/package.json
CHANGED
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
|
|
@@ -451,7 +456,7 @@ abstract class SearchFlow {
|
|
|
451
456
|
if (key.endsWith('Like')) {
|
|
452
457
|
return
|
|
453
458
|
}
|
|
454
|
-
if (['pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
459
|
+
if (['onlyMetadata', 'pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
455
460
|
return
|
|
456
461
|
}
|
|
457
462
|
if (isNotEmpty(value)) {
|