@resolveio/server-lib 20.12.40 → 20.12.42
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/collections/report-builder-report.collection.js +13 -2
- package/collections/report-builder-report.collection.js.map +1 -1
- package/fixtures/init.js +95 -8
- package/fixtures/init.js.map +1 -1
- package/models/report-builder-report.model.d.ts +17 -2
- package/models/report-builder-report.model.js.map +1 -1
- package/package.json +1 -1
|
@@ -38,10 +38,12 @@ var schema = {
|
|
|
38
38
|
optional: true
|
|
39
39
|
},
|
|
40
40
|
'collection_joins.$.local_key': {
|
|
41
|
-
type: String
|
|
41
|
+
type: String,
|
|
42
|
+
optional: true
|
|
42
43
|
},
|
|
43
44
|
'collection_joins.$.foreign_key': {
|
|
44
|
-
type: String
|
|
45
|
+
type: String,
|
|
46
|
+
optional: true
|
|
45
47
|
},
|
|
46
48
|
report_name: {
|
|
47
49
|
type: String
|
|
@@ -128,6 +130,15 @@ var schema = {
|
|
|
128
130
|
group_type: {
|
|
129
131
|
type: String
|
|
130
132
|
},
|
|
133
|
+
fields_layout: {
|
|
134
|
+
type: Array,
|
|
135
|
+
optional: true
|
|
136
|
+
},
|
|
137
|
+
'fields_layout.$': {
|
|
138
|
+
type: Object,
|
|
139
|
+
blackbox: true,
|
|
140
|
+
optional: true
|
|
141
|
+
},
|
|
131
142
|
id_date_field: {
|
|
132
143
|
type: String,
|
|
133
144
|
optional: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collections/report-builder-report.collection.ts"],"names":[],"mappings":";;;AAAA,2DAAsF;AAEtF,gEAA0D;AAE1D,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAA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CAAC,EAAC,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAC,CAAC,CAAC;QACvE,mCAA2B,GAAG,KAAK,CAAC,kBAAkB,CAAC;IACxD,CAAC;SACI,CAAC;QACL,YAAY,CAAC;YACZ,oBAAoB,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC","file":"report-builder-report.collection.js","sourcesContent":["import { MongoManagerCollection, MongoManagerModel } from '../managers/mongo.manager';\nimport { ReportBuilderReportModel } from '../models/report-builder-report.model';\nimport { ResolveIOServer } from '../resolveio-server-app';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcollection_root: {\n\t\ttype: String\n\t},\n\tcollection_joins: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'collection_joins.$': {\n\t\ttype: Object\n\t},\n\t'collection_joins.$.collection': {\n\t\ttype: String\n\t},\n\t'collection_joins.$.alias': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'collection_joins.$.local_key': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'collection_joins.$.foreign_key': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\treport_name: {\n\t\ttype: String\n\t},\n\tfields_sort: {\n\t\ttype: Array\n\t},\n\t'fields_sort.$': {\n\t\ttype: Object\n\t},\n\t'fields_sort.$.field': {\n\t\ttype: String\n\t},\n\t'fields_sort.$.order': {\n\t\ttype: String\n\t},\n\tfields_filter: {\n\t\ttype: Array\n\t},\n\t'fields_filter.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tfields_custom: {\n\t\ttype: Array\n\t},\n\t'fields_custom.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tfields_selected: {\n\t\ttype: Array\n\t},\n\t'fields_selected.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tfields_total: {\n\t\ttype: Array\n\t},\n\t'fields_total.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tfields_link: {\n\t\ttype: Array\n\t},\n\t'fields_link.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tid_user: {\n\t\ttype: String\n\t},\n\tuser: {\n\t\ttype: String\n\t},\n\tdate_created: {\n\t\ttype: Date\n\t},\n\tshared_users: {\n\t\ttype: Array\n\t},\n\t'shared_users.$': {\n\t\ttype: String\n\t},\n\ttype: {\n\t\ttype: String\n\t},\n\tgroups_row: {\n\t\ttype: Array\n\t},\n\t'groups_row.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tgroups_column: {\n\t\ttype: Array\n\t},\n\t'groups_column.$': {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tgroup_type: {\n\t\ttype: String\n\t},\n\tfields_layout: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'fields_layout.$': {\n\t\ttype: Object,\n\t\tblackbox: true,\n\t\toptional: true\n\t},\n\tid_date_field: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdate_interval: {\n\t\ttype: String,\n\t\toptional: true\n\t}\n};\n\nexport let ReportBuilderReports: MongoManagerCollection<ReportBuilderReportModel> = null;\nexport let ReportBuilderReportVersions: MongoManagerCollection<ReportBuilderReportModel> = null;\n\ninitializeCollection();\n\nfunction initializeCollection() {\n\tif (ResolveIOServer && ResolveIOServer.getMainDB() && MongoManagerModel) {\n\t\tconst model = MongoManagerModel.create<ReportBuilderReportModel>({\n\t\t\tcollectionName: 'report-builder-reports',\n\t\t\tschema: schema,\n\t\t\tuseVersionCollection: true,\n\t\t\tuseReportBuilder: false,\n\t\t\treportBuilderLookupTables: [],\n\t\t\ttimestamps: true,\n\t\t\tcreateLogs: true,\n\t\t\tcheckSchema: true,\n\t\t\tcollectionOptions: null\n\t\t});\n\t\tReportBuilderReports = model.collection_main;\n\t\tReportBuilderReports.createIndex({id_user: 1});\n\t\tReportBuilderReports.createIndex({shared_users: 1});\n\t\tReportBuilderReports.createIndex({report_name: 1, collection_root: 1});\n\t\tReportBuilderReportVersions = model.collection_version;\n\t}\n\telse {\n\t\tsetImmediate(() => {\n\t\t\tinitializeCollection();\n\t\t});\n\t}\n}\n"]}
|
package/fixtures/init.js
CHANGED
|
@@ -35,41 +35,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
50
|
exports.loadServerInit = loadServerInit;
|
|
40
|
-
var
|
|
51
|
+
var email_history_collection_1 = require("../collections/email-history.collection");
|
|
52
|
+
var flag_collection_1 = require("../collections/flag.collection");
|
|
53
|
+
var report_builder_report_collection_1 = require("../collections/report-builder-report.collection");
|
|
41
54
|
var resolveio_server_app_1 = require("../resolveio-server-app");
|
|
42
55
|
function loadServerInit() {
|
|
43
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
44
57
|
var enableDebugFlag, enableDebugFlagPDF;
|
|
45
58
|
return __generator(this, function (_a) {
|
|
46
59
|
switch (_a.label) {
|
|
47
|
-
case 0: return [4 /*yield*/,
|
|
60
|
+
case 0: return [4 /*yield*/, email_history_collection_1.EmailHistories.updateMany({ status: 'processing' }, { $set: { status: 'pending' } })];
|
|
48
61
|
case 1:
|
|
49
62
|
_a.sent();
|
|
50
|
-
return [4 /*yield*/,
|
|
63
|
+
return [4 /*yield*/, flag_collection_1.Flags.findOne({ type: 'Enable Debug' })];
|
|
51
64
|
case 2:
|
|
52
65
|
enableDebugFlag = _a.sent();
|
|
53
66
|
if (!!enableDebugFlag) return [3 /*break*/, 4];
|
|
54
|
-
return [4 /*yield*/,
|
|
67
|
+
return [4 /*yield*/, flag_collection_1.Flags.insertOne({ type: 'Enable Debug', value: false })];
|
|
55
68
|
case 3:
|
|
56
69
|
_a.sent();
|
|
57
70
|
_a.label = 4;
|
|
58
|
-
case 4: return [4 /*yield*/,
|
|
71
|
+
case 4: return [4 /*yield*/, flag_collection_1.Flags.findOne({ type: 'Enable Debug PDF' })];
|
|
59
72
|
case 5:
|
|
60
73
|
enableDebugFlagPDF = _a.sent();
|
|
61
74
|
if (!!enableDebugFlagPDF) return [3 /*break*/, 7];
|
|
62
|
-
return [4 /*yield*/,
|
|
75
|
+
return [4 /*yield*/, flag_collection_1.Flags.insertOne({ type: 'Enable Debug PDF', value: false })];
|
|
63
76
|
case 6:
|
|
64
77
|
_a.sent();
|
|
65
78
|
return [3 /*break*/, 9];
|
|
66
79
|
case 7:
|
|
67
80
|
if (!(enableDebugFlagPDF.value && resolveio_server_app_1.ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200')) return [3 /*break*/, 9];
|
|
68
|
-
return [4 /*yield*/,
|
|
81
|
+
return [4 /*yield*/, flag_collection_1.Flags.updateOne({ _id: enableDebugFlagPDF._id }, { $set: { value: false } })];
|
|
69
82
|
case 8:
|
|
70
83
|
_a.sent();
|
|
71
84
|
_a.label = 9;
|
|
72
|
-
case 9: return [
|
|
85
|
+
case 9: return [4 /*yield*/, backfillReportBuilderLayouts()];
|
|
86
|
+
case 10:
|
|
87
|
+
_a.sent();
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function backfillReportBuilderLayouts() {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var reports, ops, _loop_1, reports_1, reports_1_1, report;
|
|
96
|
+
var e_1, _a;
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (!report_builder_report_collection_1.ReportBuilderReports) {
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
return [4 /*yield*/, report_builder_report_collection_1.ReportBuilderReports.find({
|
|
104
|
+
$or: [
|
|
105
|
+
{ fields_layout: { $exists: false } },
|
|
106
|
+
{ fields_layout: { $size: 0 } }
|
|
107
|
+
]
|
|
108
|
+
})];
|
|
109
|
+
case 1:
|
|
110
|
+
reports = _b.sent();
|
|
111
|
+
ops = [];
|
|
112
|
+
_loop_1 = function (report) {
|
|
113
|
+
var fieldsSelected = report.fields_selected || [];
|
|
114
|
+
var layout = fieldsSelected.map(function (field, index) { return ({
|
|
115
|
+
id: field.id ? "layout_".concat(field.id) : "layout_".concat(index),
|
|
116
|
+
header: field.columnName || field.fieldName || "Column ".concat(index + 1),
|
|
117
|
+
mappings: [
|
|
118
|
+
{
|
|
119
|
+
collection: field.collection_name || report.collection_root,
|
|
120
|
+
mode: 'variable',
|
|
121
|
+
fieldPath: field.fieldPath || '',
|
|
122
|
+
fieldId: field.id || "f_layout_".concat(index),
|
|
123
|
+
text: '',
|
|
124
|
+
leafValueType: field.leafValueType || 'Value',
|
|
125
|
+
leafFormatType: field.leafFormatType || ''
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}); });
|
|
129
|
+
ops.push({
|
|
130
|
+
updateOne: {
|
|
131
|
+
filter: { _id: report._id },
|
|
132
|
+
update: {
|
|
133
|
+
$set: {
|
|
134
|
+
collection_joins: report.collection_joins || [],
|
|
135
|
+
fields_layout: layout
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
try {
|
|
142
|
+
for (reports_1 = __values(reports), reports_1_1 = reports_1.next(); !reports_1_1.done; reports_1_1 = reports_1.next()) {
|
|
143
|
+
report = reports_1_1.value;
|
|
144
|
+
_loop_1(report);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
148
|
+
finally {
|
|
149
|
+
try {
|
|
150
|
+
if (reports_1_1 && !reports_1_1.done && (_a = reports_1.return)) _a.call(reports_1);
|
|
151
|
+
}
|
|
152
|
+
finally { if (e_1) throw e_1.error; }
|
|
153
|
+
}
|
|
154
|
+
if (!ops.length) return [3 /*break*/, 3];
|
|
155
|
+
return [4 /*yield*/, report_builder_report_collection_1.ReportBuilderReports.bulkWrite(ops, { ordered: false }, false, true, true, true)];
|
|
156
|
+
case 2:
|
|
157
|
+
_b.sent();
|
|
158
|
+
_b.label = 3;
|
|
159
|
+
case 3: return [2 /*return*/];
|
|
73
160
|
}
|
|
74
161
|
});
|
|
75
162
|
});
|
package/fixtures/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fixtures/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/fixtures/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wCAmBC;AAxBD,oFAAyE;AACzE,kEAAuD;AACvD,oGAAuF;AACvF,gEAA0D;AAE1D,SAAsB,cAAc;;;;;wBACnC,qBAAM,yCAAc,CAAC,UAAU,CAAC,EAAC,MAAM,EAAE,YAAY,EAAC,EAAE,EAAC,IAAI,EAAE,EAAC,MAAM,EAAE,SAAS,EAAC,EAAC,CAAC,EAAA;;oBAApF,SAAoF,CAAC;oBAE/D,qBAAM,uBAAK,CAAC,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uDAAoB,CAAC,SAAS,CAAC,GAAG,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAA;;oBAApF,SAAoF,CAAC;;;;;;CAEtF","file":"init.js","sourcesContent":["import { EmailHistories } from '../collections/email-history.collection';\nimport { Flags } from '../collections/flag.collection';\nimport { ReportBuilderReports } from '../collections/report-builder-report.collection';\nimport { ResolveIOServer } from '../resolveio-server-app';\n\nexport async function loadServerInit() {\n\tawait EmailHistories.updateMany({status: 'processing'}, {$set: {status: 'pending'}});\n\n\tlet enableDebugFlag = await Flags.findOne({type: 'Enable Debug'});\n\n\tif (!enableDebugFlag) {\n\t\tawait Flags.insertOne({type: 'Enable Debug', value: false});\n\t}\n\n\tlet enableDebugFlagPDF = await Flags.findOne({type: 'Enable Debug PDF'});\n\n\tif (!enableDebugFlagPDF) {\n\t\tawait Flags.insertOne({type: 'Enable Debug PDF', value: false});\n\t}\n\telse if (enableDebugFlagPDF.value && ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200') {\n\t\tawait Flags.updateOne({_id: enableDebugFlagPDF._id}, {$set: {value: false}});\n\t}\n\n\tawait backfillReportBuilderLayouts();\n}\n\nasync function backfillReportBuilderLayouts() {\n\tif (!ReportBuilderReports) {\n\t\treturn;\n\t}\n\n\tconst reports = await ReportBuilderReports.find({\n\t\t$or: [\n\t\t\t{fields_layout: {$exists: false}},\n\t\t\t{fields_layout: {$size: 0}}\n\t\t]\n\t});\n\n\tconst ops = [];\n\n\tfor (const report of reports) {\n\t\tconst fieldsSelected = report.fields_selected || [];\n\t\tconst layout = fieldsSelected.map((field, index) => ({\n\t\t\tid: field.id ? `layout_${field.id}` : `layout_${index}`,\n\t\t\theader: field.columnName || field.fieldName || `Column ${index + 1}`,\n\t\t\tmappings: [\n\t\t\t\t{\n\t\t\t\t\tcollection: field.collection_name || report.collection_root,\n\t\t\t\t\tmode: 'variable',\n\t\t\t\t\tfieldPath: field.fieldPath || '',\n\t\t\t\t\tfieldId: field.id || `f_layout_${index}`,\n\t\t\t\t\ttext: '',\n\t\t\t\t\tleafValueType: field.leafValueType || 'Value',\n\t\t\t\t\tleafFormatType: field.leafFormatType || ''\n\t\t\t\t}\n\t\t\t]\n\t\t}));\n\n\t\tops.push({\n\t\t\tupdateOne: {\n\t\t\t\tfilter: {_id: report._id},\n\t\t\t\tupdate: {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tcollection_joins: report.collection_joins || [],\n\t\t\t\t\t\tfields_layout: layout\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (ops.length) {\n\t\tawait ReportBuilderReports.bulkWrite(ops, {ordered: false}, false, true, true, true);\n\t}\n}\n"]}
|
|
@@ -2,8 +2,8 @@ import { CollectionDocument } from '../models/collection-document.model';
|
|
|
2
2
|
export interface ReportBuilderCollectionJoin {
|
|
3
3
|
collection: string;
|
|
4
4
|
alias?: string;
|
|
5
|
-
local_key
|
|
6
|
-
foreign_key
|
|
5
|
+
local_key?: string;
|
|
6
|
+
foreign_key?: string;
|
|
7
7
|
}
|
|
8
8
|
export interface ReportBuilderReportModel extends CollectionDocument {
|
|
9
9
|
collection_root: string;
|
|
@@ -25,6 +25,7 @@ export interface ReportBuilderReportModel extends CollectionDocument {
|
|
|
25
25
|
groups_column: ReportBuilderGroupsRow[];
|
|
26
26
|
id_date_field?: string;
|
|
27
27
|
date_interval?: string;
|
|
28
|
+
fields_layout?: ReportBuilderLayoutColumn[];
|
|
28
29
|
}
|
|
29
30
|
export interface ReportBuilderReportFieldsLink {
|
|
30
31
|
field_first: string;
|
|
@@ -103,3 +104,17 @@ export interface ReportBuilderReportCustomOp {
|
|
|
103
104
|
export interface ReportBuilderReportCustomOpField {
|
|
104
105
|
field: string;
|
|
105
106
|
}
|
|
107
|
+
export interface ReportBuilderLayoutColumn {
|
|
108
|
+
id?: string;
|
|
109
|
+
header: string;
|
|
110
|
+
mappings: ReportBuilderLayoutMapping[];
|
|
111
|
+
}
|
|
112
|
+
export interface ReportBuilderLayoutMapping {
|
|
113
|
+
collection: string;
|
|
114
|
+
mode: 'variable' | 'text';
|
|
115
|
+
fieldPath?: string;
|
|
116
|
+
fieldId?: string;
|
|
117
|
+
text?: string;
|
|
118
|
+
leafValueType?: string;
|
|
119
|
+
leafFormatType?: string;
|
|
120
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/report-builder-report.model.ts"],"names":[],"mappings":"","file":"report-builder-report.model.js","sourcesContent":["import { CollectionDocument } from '../models/collection-document.model';\n\nexport interface ReportBuilderCollectionJoin {\n\tcollection: string;\n\talias?: string;\n\tlocal_key
|
|
1
|
+
{"version":3,"sources":["../../src/models/report-builder-report.model.ts"],"names":[],"mappings":"","file":"report-builder-report.model.js","sourcesContent":["import { CollectionDocument } from '../models/collection-document.model';\n\nexport interface ReportBuilderCollectionJoin {\n\tcollection: string;\n\talias?: string;\n\tlocal_key?: string;\n\tforeign_key?: string;\n}\n\nexport interface ReportBuilderReportModel extends CollectionDocument {\n\tcollection_root: string;\n\tcollection_joins?: ReportBuilderCollectionJoin[];\n\treport_name: string;\n\tfields_sort: ReportBuilderReportFieldsSort[];\n\tfields_filter: ReportBuilderReportFieldsFilterOrs[];\n\tfields_custom?: ReportBuilderReportCustomField[];\n\tfields_selected: ReportBuilderReportFieldsSelected[];\n\tfields_total: ReportBuilderReportFieldsTotal[];\n\tfields_link: ReportBuilderReportFieldsLink[];\n\tid_user: string;\n\tuser: string;\n\tdate_created: Date;\n\tshared_users: string[];\n\ttype: ReportBuilderReportType;\n\tgroup_type: string;\n\tgroups_row: ReportBuilderGroupsRow[];\n\tgroups_column: ReportBuilderGroupsRow[];\n\tid_date_field?: string;\n\tdate_interval?: string;\n\tfields_layout?: ReportBuilderLayoutColumn[];\n}\n\nexport interface ReportBuilderReportFieldsLink {\n\tfield_first: string;\n\tfield_second: string;\n\tid: number;\n}\n\nexport interface ReportBuilderReportFieldsTotal {\n\ttype: string;\n\tfields: string[];\n\tid: number;\n}\n\nexport interface ReportBuilderGroupsRow {\n\tfield: string;\n\tfieldPathName: string;\n\tid: string;\n\tcolumnName: string;\n\tfill_color?: string;\n\tfont_color?: string;\n\ttreeItem?: any;\n}\n\nexport type ReportBuilderReportType = 'List' | 'Group' | 'Dated';\n\nexport interface ReportBuilderReportFieldsSort { \n\tfield: string;\n\torder: string;\n}\n\nexport interface ReportBuilderReportFieldsFilterOrs {\n\tors: ReportBuilderReportFieldsFilter[];\n}\n\nexport interface ReportBuilderReportFieldsFilter {\n\tfield: string;\n\tfieldType: string;\n\tcondition: string;\n\tvalue: any;\n\thighValue: any;\n\tdateValue: any;\n\thighDateValue: any;\n\tbooleanValue: string;\n\tis_rolling: boolean;\n\trolling_interval: string;\n}\n\nexport interface ReportBuilderReportFieldsSelected {\n\tcollection_name: string;\n\tcolumnName: string;\n\tfieldName: string;\n\tfieldType: string;\n\tdistinctFieldValues: string[];\n\tfieldPath: string;\n\tlookup_collection: string;\n\tlookup_local_key: string;\n\tlookup_foreign_key: string;\n\tlookup_as: string;\n\ttext: string;\n\tvalue: string;\n\tisLeaf: boolean;\n\tisActive: boolean;\n\tisSelected: boolean;\n\tdepth: number;\n\tleafValueType: string;\n\tleafValueTypes: string[];\n\tleafFormatType: string;\n\tleafFormatTypes: string[];\n\tid?: string;\n\tshow: boolean;\n}\n\nexport interface ReportBuilderReportCustomField {\n\tid: string;\n\tcolumnName: string;\n\tselFieldId: string;\n\tleafValueType: string;\n\toperations: ReportBuilderReportCustomOp[];\n}\n\nexport interface ReportBuilderReportCustomOp {\n\tfields: ReportBuilderReportCustomOpField[];\n\toperation: string;\n}\n\nexport interface ReportBuilderReportCustomOpField {\n\tfield: string;\n}\n\nexport interface ReportBuilderLayoutColumn {\n\tid?: string;\n\theader: string;\n\tmappings: ReportBuilderLayoutMapping[];\n}\n\nexport interface ReportBuilderLayoutMapping {\n\tcollection: string;\n\tmode: 'variable' | 'text';\n\tfieldPath?: string;\n\tfieldId?: string;\n\ttext?: string;\n\tleafValueType?: string;\n\tleafFormatType?: string;\n}\n"]}
|