@resolveio/server-lib 4.6.6 → 4.6.8

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.
@@ -87,20 +87,28 @@ function loadReportBuilderMethods(methodManager) {
87
87
  function: function (treeLeaf) {
88
88
  var _this = this;
89
89
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
90
- var _a;
91
- return __generator(this, function (_b) {
92
- switch (_b.label) {
90
+ var _a, _b;
91
+ return __generator(this, function (_c) {
92
+ switch (_c.label) {
93
93
  case 0:
94
- if (!(treeLeaf.fieldType === 'String')) return [3 /*break*/, 2];
94
+ if (!(treeLeaf.fieldType === 'String')) return [3 /*break*/, 5];
95
+ if (!treeLeaf.fieldPath.includes('(Lookup)')) return [3 /*break*/, 2];
95
96
  _a = resolve;
96
- return [4 /*yield*/, schema_report_builder_1.mongoCommand('distinct', treeLeaf.collection_name, treeLeaf.fieldPath.replace(/\.\$/g, ''))];
97
+ return [4 /*yield*/, schema_report_builder_1.mongoCommand('distinct', treeLeaf.collection_name, treeLeaf.fieldPath.replace(/^.+\(Lookup\)\.\$\./g, '').replace(/\.\$/g, ''))];
97
98
  case 1:
98
- _a.apply(void 0, [_b.sent()]);
99
- return [3 /*break*/, 3];
99
+ _a.apply(void 0, [_c.sent()]);
100
+ return [3 /*break*/, 4];
100
101
  case 2:
102
+ _b = resolve;
103
+ return [4 /*yield*/, schema_report_builder_1.mongoCommand('distinct', treeLeaf.collection_name, treeLeaf.fieldPath.replace(/\.\$/g, ''))];
104
+ case 3:
105
+ _b.apply(void 0, [_c.sent()]);
106
+ _c.label = 4;
107
+ case 4: return [3 /*break*/, 6];
108
+ case 5:
101
109
  resolve([]);
102
- _b.label = 3;
103
- case 3: return [2 /*return*/];
110
+ _c.label = 6;
111
+ case 6: return [2 /*return*/];
104
112
  }
105
113
  });
106
114
  }); });
@@ -200,7 +208,7 @@ function loadReportBuilderMethods(methodManager) {
200
208
  if (date_interval === void 0) { date_interval = ''; }
201
209
  if (tabularDisplayType === void 0) { tabularDisplayType = ''; }
202
210
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
203
- var uniqueSelectedFieldCollections, modelCollection, query, initialQueryMatchCondition, sizes, divFields, queryGroup, queryProjection_1, queryTotals_1, res, err_1, tmpTotals, tmpRes;
211
+ var uniqueSelectedFieldCollections, modelCollection, query, initialQueryMatchCondition, sizes, divFields, queryGroup, queryProjection_1, res, err_1, tmpTotals, tmpRes;
204
212
  var _this = this;
205
213
  return __generator(this, function (_a) {
206
214
  switch (_a.label) {
@@ -473,15 +481,18 @@ function loadReportBuilderMethods(methodManager) {
473
481
  queryProjection_1[field.id] = '$' + field.fieldPath.replace(/\.\$/g, '');
474
482
  }
475
483
  });
476
- queryTotals_1 = null;
484
+ //Links
485
+ // if (fieldsLink.length) {
486
+ // fieldsLink.filter(a => a.field_first && a.field_second).forEach(link => {
487
+ // queryProjection[link.id] = {$cmp: ['$' + link.field_first.replace(/\.\$/g, ''), '$' + link.field_second.replace(/\.\$/g, '')]};
488
+ // });
489
+ // }
490
+ //Totals
477
491
  if (fieldsTotal.length && (reportType === 'Tabular' || reportType === 'Dated')) {
478
492
  fieldsTotal.forEach(function (total) {
479
493
  selectedFields.filter(function (a) { return a.fieldType === 'Number'; }).forEach(function (field) {
480
494
  var _a;
481
- if (!queryTotals_1) {
482
- queryTotals_1 = {};
483
- }
484
- queryTotals_1[total.id + '_' + field.id] = (_a = {}, _a['$' + total.type] = '$results.' + total.id + '_' + field.id, _a);
495
+ queryProjection_1[total.id + '_' + field.id] = (_a = {}, _a['$' + total.type] = '$' + total.id + '_' + field.id, _a);
485
496
  });
486
497
  });
487
498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.6.6",
3
+ "version": "4.6.8",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/server-app.js CHANGED
@@ -328,6 +328,11 @@ var ResolveIOMainServer = /** @class */ (function () {
328
328
  ws.on('close', function () {
329
329
  _this.unsubscribeWS(ws);
330
330
  });
331
+ ws.on('error', function (error) {
332
+ console.log(error);
333
+ _this.unsubscribeWS(ws);
334
+ ws.terminate();
335
+ });
331
336
  });
332
337
  // Keep alive timer to ping/pong
333
338
  setInterval(function () {