@resolveio/server-lib 4.4.21 → 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.
package/methods/cron-jobs.js
CHANGED
|
@@ -395,57 +395,62 @@ function loadCronJobMethods(methodManager) {
|
|
|
395
395
|
if (report.type === 'Tabular') {
|
|
396
396
|
report.fields_selected.forEach(function (field) {
|
|
397
397
|
if (field.fieldType === 'Number' && field.leafFormatType === 'Number') {
|
|
398
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
398
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
399
399
|
result[field.id] = result[field.id].toLocaleString();
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
else if ((field.fieldType === 'Number' || field.leafValueType === 'Count') && field.leafFormatType === 'String') {
|
|
403
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
403
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
404
404
|
result[field.id] = result[field.id].toString();
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
407
|
else if ((field.fieldType === 'Number' || field.leafValueType === 'Count') && field.leafFormatType === 'Currency') {
|
|
408
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
408
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
409
409
|
result[field.id] = result[field.id].toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
else if (field.fieldType === 'Boolean' && field.leafFormatType === 'String') {
|
|
413
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
413
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
414
414
|
result[field.id] = result[field.id] === true ? 'Yes' : 'No';
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
-
else if (field.fieldType === 'Boolean' && field.leafFormatType === '
|
|
418
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
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') {
|
|
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
|
});
|
|
421
426
|
}
|
|
422
427
|
else if (field.fieldType === 'Date' && (field.leafFormatType === 'Date')) {
|
|
423
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
428
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
424
429
|
result[field.id] = moment(result[field.id]).format('L');
|
|
425
430
|
});
|
|
426
431
|
}
|
|
427
432
|
else if (field.fieldType === 'Date' && field.leafFormatType === 'Time') {
|
|
428
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
433
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
429
434
|
result[field.id] = moment(result[field.id]).format('LT');
|
|
430
435
|
});
|
|
431
436
|
}
|
|
432
437
|
else if (field.fieldType === 'Date' && field.leafFormatType === 'DateTime') {
|
|
433
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
438
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
434
439
|
result[field.id] = moment(result[field.id]).format('MM/DD/YYYY h:mm A');
|
|
435
440
|
});
|
|
436
441
|
}
|
|
437
442
|
else if (field.fieldType === 'Date' && field.leafFormatType === 'Date_long') {
|
|
438
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
443
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
439
444
|
result[field.id] = moment(result[field.id]).format('LL');
|
|
440
445
|
});
|
|
441
446
|
}
|
|
442
447
|
else if (field.fieldType === 'Date' && field.leafFormatType === 'DateTime_long') {
|
|
443
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
448
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
444
449
|
result[field.id] = moment(result[field.id]).format('LLL');
|
|
445
450
|
});
|
|
446
451
|
}
|
|
447
452
|
else if (field.fieldType === 'Date' && field.leafFormatType === 'Timestamp') {
|
|
448
|
-
results_1.filter(function (a) { return a[field.id]; }).forEach(function (result) {
|
|
453
|
+
results_1.filter(function (a) { return a[field.id] !== null; }).forEach(function (result) {
|
|
449
454
|
result[field.id] = moment(result[field.id]).toDate().getTime();
|
|
450
455
|
});
|
|
451
456
|
}
|
|
@@ -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 (!
|
|
264
|
-
|
|
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); }); }));
|