c2-mongoose 2.1.66 → 2.1.68
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 +13 -4
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +7 -2
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -121,7 +121,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
if (Array.isArray(this.populate)) {
|
|
124
|
-
return
|
|
124
|
+
return this.buildPopulateArray();
|
|
125
125
|
}
|
|
126
126
|
var propertiesArray = this.populate.toString().split(',');
|
|
127
127
|
var populates = [];
|
|
@@ -135,11 +135,20 @@ var SearchFlow = /** @class */ (function () {
|
|
|
135
135
|
};
|
|
136
136
|
SearchFlow.prototype.buildPopulateArray = function () {
|
|
137
137
|
var populates = [];
|
|
138
|
-
|
|
139
|
-
var property = _a[_i];
|
|
138
|
+
var _loop_1 = function () {
|
|
140
139
|
var _b = property.split('.'), first = _b[0], rest = _b.slice(1);
|
|
141
140
|
var nested = rest.join('.');
|
|
142
|
-
|
|
141
|
+
var populate = this_1.buildPath(first, nested);
|
|
142
|
+
if (Array.isArray(this_1.select)) {
|
|
143
|
+
var selects = this_1.select.filter(function (sel) { return sel.startsWith("".concat(first, ".")); });
|
|
144
|
+
populate.select = selects.join(" ");
|
|
145
|
+
}
|
|
146
|
+
populates.push(populate);
|
|
147
|
+
};
|
|
148
|
+
var this_1 = this;
|
|
149
|
+
for (var _i = 0, _a = this.populate; _i < _a.length; _i++) {
|
|
150
|
+
var property = _a[_i];
|
|
151
|
+
_loop_1();
|
|
143
152
|
}
|
|
144
153
|
this.populate = populates;
|
|
145
154
|
};
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -50,7 +50,7 @@ abstract class SearchFlow {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (Array.isArray(this.populate)) {
|
|
53
|
-
return
|
|
53
|
+
return this.buildPopulateArray()
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
var propertiesArray = (this.populate as string).toString().split(',')
|
|
@@ -69,7 +69,12 @@ abstract class SearchFlow {
|
|
|
69
69
|
for (var property of this.populate) {
|
|
70
70
|
let [first, ...rest] = property.split('.')
|
|
71
71
|
let nested = rest.join('.')
|
|
72
|
-
|
|
72
|
+
let populate = this.buildPath(first, nested)
|
|
73
|
+
if (Array.isArray(this.select)) {
|
|
74
|
+
let selects = (this.select as []).filter((sel: string) => sel.startsWith(`${first}.`))
|
|
75
|
+
populate.select = selects.join(" ")
|
|
76
|
+
}
|
|
77
|
+
populates.push(populate)
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
this.populate = populates
|