@resolveio/server-lib 4.4.22 → 4.4.23

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.
@@ -414,7 +414,12 @@ function loadCronJobMethods(methodManager) {
414
414
  result[field.id] = result[field.id] === true ? 'Yes' : 'No';
415
415
  });
416
416
  }
417
- else if (field.fieldType === 'Boolean' && field.leafFormatType === 'Number') {
417
+ else if (field.fieldType === 'Boolean' && (!field.leafFormatType || field.leafFormatType === 'Boolean')) {
418
+ results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
419
+ result[field.id] = result[field.id] === true ? 'True' : 'False';
420
+ });
421
+ }
422
+ else if (field.fieldType === 'Boolean' && field.leafFormatType === 'Boolean_Number') {
418
423
  results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
419
424
  result[field.id] = result[field.id] === true ? 1 : 0;
420
425
  });
@@ -187,7 +187,7 @@ function loadReportBuilderMethods(methodManager) {
187
187
  if (date_field === void 0) { date_field = ''; }
188
188
  if (date_interval === void 0) { date_interval = ''; }
189
189
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
190
- var _a, _b, uniqueSelectedFieldCollections, modelCollection, queryMatchCondition, queryLookups, queryUnwindCollectionPaths, queryGroups, queryGroupUnwind, queryGroup_1, correctSort_1, _loop_1, i, queryProjection, queryTotals, query, queryMatchConditionLookup, tmpProj_1, tmpAnds_1, res, err_1;
190
+ var _a, _b, uniqueSelectedFieldCollections, modelCollection, queryMatchCondition, queryLookups, queryUnwindCollectionPaths, queryGroupUnwindCollectionPaths, queryGroups, queryGroupUnwind, queryGroup_1, correctSort_1, _loop_1, i, queryProjection, queryTotals, query, queryMatchConditionLookup, tmpProj_1, tmpAnds_1, res, err_1;
191
191
  var _this = this;
192
192
  return __generator(this, function (_c) {
193
193
  switch (_c.label) {
@@ -255,13 +255,14 @@ function loadReportBuilderMethods(methodManager) {
255
255
  }
256
256
  }
257
257
  });
258
+ queryGroupUnwindCollectionPaths = [];
258
259
  groupsRow.filter(function (a) { return a.treeItem.fieldPath.includes('$'); }).forEach(function (field) {
259
260
  var arrayPartData = field.treeItem.fieldPath.split('.$');
260
261
  var path = '$';
261
262
  for (var i = 0; i < arrayPartData.length - 1; i++) {
262
263
  path += arrayPartData[i];
263
- if (!queryUnwindCollectionPaths.filter(function (a) { return a === path; })[0]) {
264
- queryUnwindCollectionPaths.push(path);
264
+ if (!queryGroupUnwindCollectionPaths.filter(function (a) { return a === path; })[0]) {
265
+ queryGroupUnwindCollectionPaths.push(path);
265
266
  }
266
267
  }
267
268
  });
@@ -471,6 +472,14 @@ function loadReportBuilderMethods(methodManager) {
471
472
  }
472
473
  });
473
474
  });
475
+ queryGroupUnwindCollectionPaths.filter(function (a) { return !a.includes('(Lookup)'); }).forEach(function (path) {
476
+ query.push({
477
+ $unwind: {
478
+ path: path,
479
+ preserveNullAndEmptyArrays: false
480
+ }
481
+ });
482
+ });
474
483
  // Look Ups
475
484
  queryLookups.forEach(function (lookup) {
476
485
  query.push({
@@ -488,6 +497,16 @@ function loadReportBuilderMethods(methodManager) {
488
497
  });
489
498
  }
490
499
  });
500
+ queryGroupUnwindCollectionPaths.filter(function (a) { return a.includes('(Lookup)'); }).forEach(function (path) {
501
+ if (!query.filter(function (a) { return a.$unwind && a.$unwind.path === path; }).length) {
502
+ query.push({
503
+ $unwind: {
504
+ path: path,
505
+ preserveNullAndEmptyArrays: false
506
+ }
507
+ });
508
+ }
509
+ });
491
510
  // Group Unwinds
492
511
  if (groupsRow.length) {
493
512
  query = query.concat(queryGroupUnwind.filter(function (a) { return !query.some(function (b) { return b.$unwind && (b.$unwind.path === a.$unwind.path); }); }));
@@ -29,6 +29,7 @@ export interface ReportBuilderReportFieldsTotal {
29
29
  }
30
30
  export interface ReportBuilderGroupsRow {
31
31
  field: string;
32
+ fieldPathName: string;
32
33
  id: string;
33
34
  columnName: string;
34
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.4.22",
3
+ "version": "4.4.23",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {