c2-mongoose 2.1.222 → 2.1.224

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.
@@ -25,13 +25,16 @@ var BuildPopulateSingleFlowItem = /** @class */ (function () {
25
25
  var _e = property.split('.'), first = _e[0], rest = _e.slice(1);
26
26
  var nested = rest.join('.');
27
27
  var populateLocal = this_1.buildPath(first, nested);
28
+ //EXISTE UMA LIMITACAO DE SELECT A PARTIR DO 3 NIVEL DENTRO DOS CAMPO POPULATE, MELHORAR O CODIGO ABAIXO PARA PERCORRER MAIS NIVEIS
28
29
  if (Array.isArray(selectsStr)) {
29
- var selects = selectsStr.filter(function (sel) { return sel.startsWith("".concat(first, ".")); });
30
- var select = Array.from(new Set(selects)).map(function (sel) { return sel.split(".")[1]; }).join(" ").trim();
30
+ var allSelectOfPopulate = selectsStr.filter(function (sel) { return sel.startsWith("".concat(first, ".").concat(populateLocal.path)); });
31
+ var firstLevelSelect = allSelectOfPopulate.map(function (sel) { return sel.split(".")[1].trim(); });
32
+ var select = Array.from(new Set(firstLevelSelect)).join(" ").trim();
31
33
  if ((0, Utils_1.isNotEmpty)(select)) {
32
34
  populateLocal.select = select;
33
35
  }
34
36
  }
37
+ //FIM
35
38
  var existing = populate.find(function (populateAux) { return populateAux.path === populateLocal.path; });
36
39
  if (existing) {
37
40
  var populateAux = __assign(__assign({}, existing === null || existing === void 0 ? void 0 : existing.populate), { path: "".concat((_b = (_a = existing.populate) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : "", " ").concat((_d = (_c = populateLocal.populate) === null || _c === void 0 ? void 0 : _c.path) !== null && _d !== void 0 ? _d : "").trim() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.222",
3
+ "version": "2.1.224",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,13 +16,16 @@ class BuildPopulateSingleFlowItem {
16
16
 
17
17
  let populateLocal = this.buildPath(first, nested)
18
18
 
19
+ //EXISTE UMA LIMITACAO DE SELECT A PARTIR DO 3 NIVEL DENTRO DOS CAMPO POPULATE, MELHORAR O CODIGO ABAIXO PARA PERCORRER MAIS NIVEIS
19
20
  if (Array.isArray(selectsStr)) {
20
- let selects = (selectsStr as []).filter((sel: string) => sel.startsWith(`${first}.`))
21
- let select = Array.from(new Set(selects)).map((sel: string) => sel.split(".")[1]).join(" ").trim()
21
+ let allSelectOfPopulate = (selectsStr as []).filter((sel: string) => sel.startsWith(`${first}.${populateLocal.path}`))
22
+ let firstLevelSelect = allSelectOfPopulate.map((sel: string) => sel.split(".")[1].trim())
23
+ let select = Array.from(new Set(firstLevelSelect)).join(" ").trim()
22
24
  if (isNotEmpty(select)) {
23
25
  populateLocal.select = select
24
26
  }
25
27
  }
28
+ //FIM
26
29
 
27
30
  const existing = populate.find((populateAux: IPopulate) => populateAux.path === populateLocal.path)
28
31
  if (existing) {