drapcode-utility 1.2.2-beta → 1.2.2
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/build/utils/query-parser.js +74 -75
- package/build/utils/query-paser-new.js +74 -75
- package/build/utils/util.d.ts +1 -0
- package/build/utils/util.js +85 -1
- package/package.json +1 -1
|
@@ -115,21 +115,21 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
115
115
|
finder = query.finder, sortBy = query.sortBy, orderBy = query.orderBy;
|
|
116
116
|
if (!(finder != "COUNT" && refCollectionFieldsInItems)) return [3 /*break*/, 2];
|
|
117
117
|
return [4 /*yield*/, Promise.all(refCollectionFieldsInItems.map(function (field) {
|
|
118
|
-
var _a;
|
|
118
|
+
var _a, _b, _c;
|
|
119
119
|
if (["reference", "multi_reference", "belongsTo"].includes(field.type)) {
|
|
120
120
|
var collectionName_1 = field.refCollection
|
|
121
121
|
? field.refCollection["collectionName"]
|
|
122
122
|
: null;
|
|
123
123
|
if (collectionName_1) {
|
|
124
124
|
if (field.type === "belongsTo") {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
aggregateQuery.push({
|
|
126
|
+
$lookup: {
|
|
127
|
+
from: "" + collectionName_1,
|
|
128
|
+
localField: field.fieldName,
|
|
129
|
+
foreignField: "uuid",
|
|
130
|
+
as: field.fieldName,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
133
|
aggregateQuery.push({
|
|
134
134
|
$addFields: (_a = {},
|
|
135
135
|
_a["_$belongsToMetaData"] = field,
|
|
@@ -137,66 +137,65 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
140
|
+
aggregateQuery.push({
|
|
141
|
+
$lookup: {
|
|
142
|
+
from: "" + collectionName_1,
|
|
143
|
+
let: (_b = {}, _b["" + field.fieldName] = "$" + field.fieldName, _b),
|
|
144
|
+
pipeline: [
|
|
145
|
+
{
|
|
146
|
+
$match: {
|
|
147
|
+
$expr: {
|
|
148
|
+
$in: [
|
|
149
|
+
"$uuid",
|
|
150
|
+
{
|
|
151
|
+
$cond: {
|
|
152
|
+
if: {
|
|
153
|
+
$in: ["$$" + field.fieldName, ["", null]],
|
|
154
|
+
},
|
|
155
|
+
then: [],
|
|
156
|
+
else: { $ifNull: ["$$" + field.fieldName, []] },
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
$lookup: {
|
|
165
|
+
from: "user",
|
|
166
|
+
let: { createdBy: "$createdBy" },
|
|
167
|
+
pipeline: [
|
|
168
|
+
{
|
|
169
|
+
$match: {
|
|
170
|
+
$expr: { $eq: ["$uuid", "$$createdBy"] },
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{ $project: { _id: 0, password: 0 } },
|
|
174
|
+
],
|
|
175
|
+
as: "createdBy",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
as: field.fieldName,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
if (field.type === "createdBy")
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
// });
|
|
185
|
+
if (field.type === "createdBy")
|
|
186
|
+
aggregateQuery.push({
|
|
187
|
+
$lookup: {
|
|
188
|
+
from: "user",
|
|
189
|
+
let: (_c = {}, _c["" + field.fieldName] = "$" + field.fieldName, _c),
|
|
190
|
+
pipeline: [
|
|
191
|
+
{
|
|
192
|
+
$match: { $expr: { $eq: ["$uuid", "$$" + field.fieldName] } },
|
|
193
|
+
},
|
|
194
|
+
{ $project: { _id: 0, password: 0 } },
|
|
195
|
+
],
|
|
196
|
+
as: field.fieldName,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
200
199
|
}))];
|
|
201
200
|
case 1:
|
|
202
201
|
_e.sent();
|
|
@@ -290,7 +289,7 @@ var mongoFilterQuery = function (query, externalParams, constants, currentUser,
|
|
|
290
289
|
var mongoSelectQuery = function (query) {
|
|
291
290
|
if (query === void 0) { query = {}; }
|
|
292
291
|
var projection = {};
|
|
293
|
-
var fieldsInclude = query.fieldsInclude, fieldsExclude = query.fieldsExclude;
|
|
292
|
+
var fieldsInclude = query.fieldsInclude, fieldsExclude = query.fieldsExclude, finder = query.finder;
|
|
294
293
|
if (!fieldsExclude)
|
|
295
294
|
fieldsExclude = [];
|
|
296
295
|
if (fieldsInclude[0] === "*") {
|
|
@@ -300,6 +299,8 @@ var mongoSelectQuery = function (query) {
|
|
|
300
299
|
});
|
|
301
300
|
}
|
|
302
301
|
else {
|
|
302
|
+
if (["FIND_ALL", "FIND"].includes(finder))
|
|
303
|
+
fieldsInclude = util_1.processFieldsInlcude(fieldsInclude);
|
|
303
304
|
fieldsInclude.map(function (field) {
|
|
304
305
|
if (field)
|
|
305
306
|
return (projection["" + field] = 1);
|
|
@@ -442,12 +443,11 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
|
|
|
442
443
|
};
|
|
443
444
|
if (key == drapcode_constant_1.EQUALS) {
|
|
444
445
|
return _x = {},
|
|
445
|
-
// TODO:Handle Based of Field Type
|
|
446
446
|
_x[field] = fieldType === "boolean" && fieldValue
|
|
447
447
|
? JSON.parse(fieldValue)
|
|
448
|
-
:
|
|
449
|
-
|
|
450
|
-
fieldValue,
|
|
448
|
+
: !isNaN(fieldValue)
|
|
449
|
+
? +fieldValue
|
|
450
|
+
: fieldValue,
|
|
451
451
|
_x;
|
|
452
452
|
}
|
|
453
453
|
if (key == drapcode_constant_1.NOT_EQUAL)
|
|
@@ -646,10 +646,9 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
646
646
|
if (requiredExternal) {
|
|
647
647
|
//TODO: Value returns from here undefined.
|
|
648
648
|
var externalParamValue = externalParams["" + value];
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
// }
|
|
649
|
+
if (!isNaN(externalParamValue)) {
|
|
650
|
+
return +externalParamValue;
|
|
651
|
+
}
|
|
653
652
|
return externalParams["" + value];
|
|
654
653
|
}
|
|
655
654
|
var constantArr = constants.filter(function (constant) { return constant.name == value; });
|
|
@@ -205,21 +205,21 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
|
|
|
205
205
|
finder = query.finder, sortBy = query.sortBy, orderBy = query.orderBy, aggregateFunctionField = query.aggregateFunctionField;
|
|
206
206
|
if (!(finder != "COUNT" && refCollectionFieldsInItems)) return [3 /*break*/, 2];
|
|
207
207
|
return [4 /*yield*/, Promise.all(refCollectionFieldsInItems.map(function (field) {
|
|
208
|
-
var _a;
|
|
208
|
+
var _a, _b, _c;
|
|
209
209
|
if (["reference", "multi_reference", "belongsTo"].includes(field.type)) {
|
|
210
210
|
var collectionName_1 = field.refCollection
|
|
211
211
|
? field.refCollection["collectionName"]
|
|
212
212
|
: null;
|
|
213
213
|
if (collectionName_1) {
|
|
214
214
|
if (field.type === "belongsTo") {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
215
|
+
aggregateQuery.push({
|
|
216
|
+
$lookup: {
|
|
217
|
+
from: "" + collectionName_1,
|
|
218
|
+
localField: field.fieldName,
|
|
219
|
+
foreignField: "uuid",
|
|
220
|
+
as: field.fieldName,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
223
|
aggregateQuery.push({
|
|
224
224
|
$addFields: (_a = {},
|
|
225
225
|
_a["_$belongsToMetaData"] = field,
|
|
@@ -227,66 +227,65 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
230
|
+
aggregateQuery.push({
|
|
231
|
+
$lookup: {
|
|
232
|
+
from: "" + collectionName_1,
|
|
233
|
+
let: (_b = {}, _b["" + field.fieldName] = "$" + field.fieldName, _b),
|
|
234
|
+
pipeline: [
|
|
235
|
+
{
|
|
236
|
+
$match: {
|
|
237
|
+
$expr: {
|
|
238
|
+
$in: [
|
|
239
|
+
"$uuid",
|
|
240
|
+
{
|
|
241
|
+
$cond: {
|
|
242
|
+
if: {
|
|
243
|
+
$in: ["$$" + field.fieldName, ["", null]],
|
|
244
|
+
},
|
|
245
|
+
then: [],
|
|
246
|
+
else: { $ifNull: ["$$" + field.fieldName, []] },
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
$lookup: {
|
|
255
|
+
from: "user",
|
|
256
|
+
let: { createdBy: "$createdBy" },
|
|
257
|
+
pipeline: [
|
|
258
|
+
{
|
|
259
|
+
$match: {
|
|
260
|
+
$expr: { $eq: ["$uuid", "$$createdBy"] },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{ $project: { _id: 0, password: 0 } },
|
|
264
|
+
],
|
|
265
|
+
as: "createdBy",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
as: field.fieldName,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
if (field.type === "createdBy")
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
// });
|
|
275
|
+
if (field.type === "createdBy")
|
|
276
|
+
aggregateQuery.push({
|
|
277
|
+
$lookup: {
|
|
278
|
+
from: "user",
|
|
279
|
+
let: (_c = {}, _c["" + field.fieldName] = "$" + field.fieldName, _c),
|
|
280
|
+
pipeline: [
|
|
281
|
+
{
|
|
282
|
+
$match: { $expr: { $eq: ["$uuid", "$$" + field.fieldName] } },
|
|
283
|
+
},
|
|
284
|
+
{ $project: { _id: 0, password: 0 } },
|
|
285
|
+
],
|
|
286
|
+
as: field.fieldName,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
290
289
|
}))];
|
|
291
290
|
case 1:
|
|
292
291
|
_b.sent();
|
|
@@ -393,7 +392,7 @@ var mongoFilterQuery = function (query, externalParams, constants, currentUser)
|
|
|
393
392
|
var mongoSelectQuery = function (query) {
|
|
394
393
|
if (query === void 0) { query = {}; }
|
|
395
394
|
var projection = {};
|
|
396
|
-
var fieldsInclude = query.fieldsInclude, fieldsExclude = query.fieldsExclude;
|
|
395
|
+
var fieldsInclude = query.fieldsInclude, fieldsExclude = query.fieldsExclude, finder = query.finder;
|
|
397
396
|
if (!fieldsExclude)
|
|
398
397
|
fieldsExclude = [];
|
|
399
398
|
if (fieldsInclude[0] === "*") {
|
|
@@ -403,6 +402,8 @@ var mongoSelectQuery = function (query) {
|
|
|
403
402
|
});
|
|
404
403
|
}
|
|
405
404
|
else {
|
|
405
|
+
if (["FIND_ALL", "FIND"].includes(finder))
|
|
406
|
+
fieldsInclude = util_1.processFieldsInlcude(fieldsInclude);
|
|
406
407
|
fieldsInclude.map(function (field) {
|
|
407
408
|
if (field)
|
|
408
409
|
return (projection["" + field] = 1);
|
|
@@ -520,12 +521,11 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
|
|
|
520
521
|
};
|
|
521
522
|
if (key == drapcode_constant_1.EQUALS)
|
|
522
523
|
return _y = {},
|
|
523
|
-
// TODO:Handle Based of Field Type
|
|
524
524
|
_y[field] = fieldType === "boolean" && fieldValue
|
|
525
525
|
? JSON.parse(fieldValue)
|
|
526
|
-
:
|
|
527
|
-
|
|
528
|
-
fieldValue,
|
|
526
|
+
: !isNaN(fieldValue)
|
|
527
|
+
? +fieldValue
|
|
528
|
+
: fieldValue,
|
|
529
529
|
_y;
|
|
530
530
|
if (key == drapcode_constant_1.NOT_EQUAL)
|
|
531
531
|
return _z = {},
|
|
@@ -646,10 +646,9 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
646
646
|
if (requiredExternal) {
|
|
647
647
|
//TODO: Value returns from here undefined.
|
|
648
648
|
var externalParamValue = externalParams["" + value];
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
// }
|
|
649
|
+
if (!isNaN(externalParamValue)) {
|
|
650
|
+
return +externalParamValue;
|
|
651
|
+
}
|
|
653
652
|
return externalParams["" + value];
|
|
654
653
|
}
|
|
655
654
|
var constantArr = constants.filter(function (constant) { return constant.name == value; });
|
package/build/utils/util.d.ts
CHANGED
|
@@ -26,3 +26,4 @@ export declare const parseValueFromData: (data: any, fieldName: string) => any;
|
|
|
26
26
|
export declare const unflattenObject: (obj: any) => {};
|
|
27
27
|
export declare const replaceTransferObjectValueIntoExpression: (expression: string, transferObject: any) => string;
|
|
28
28
|
export declare const removeMongoDbId: (result: any[]) => any[];
|
|
29
|
+
export declare const processFieldsInlcude: (fieldsInclude: any) => any;
|
package/build/utils/util.js
CHANGED
|
@@ -21,11 +21,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
25
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
26
|
+
to[j] = from[i];
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
24
29
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
31
|
};
|
|
27
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.removeMongoDbId = exports.replaceTransferObjectValueIntoExpression = exports.unflattenObject = exports.parseValueFromData = exports.parseJsonString = exports.replaceDataValueIntoExpression = exports.formatCustomCSSClasses = exports.validateAlphanumericString = exports.convertItemToArray = exports.arraysEqual = exports.checkAndCompareValue = exports.restructureData = exports.formatCollectionAndFieldName = exports.cleanCollectionAndFieldName = exports.stringToExpression = exports.expressionToString = exports.getSpecialCharectorReplacedExpression = exports.validateUuidString = exports.validateEmail = exports.snakeCaseToTitleCase = exports.dynamicSort = exports.checkValidArray = exports.isObject = exports.isEmptyObject = exports.isEmpty = exports.clearSpaceAndReformat = exports.camelize = exports.validateString = void 0;
|
|
33
|
+
exports.processFieldsInlcude = exports.removeMongoDbId = exports.replaceTransferObjectValueIntoExpression = exports.unflattenObject = exports.parseValueFromData = exports.parseJsonString = exports.replaceDataValueIntoExpression = exports.formatCustomCSSClasses = exports.validateAlphanumericString = exports.convertItemToArray = exports.arraysEqual = exports.checkAndCompareValue = exports.restructureData = exports.formatCollectionAndFieldName = exports.cleanCollectionAndFieldName = exports.stringToExpression = exports.expressionToString = exports.getSpecialCharectorReplacedExpression = exports.validateUuidString = exports.validateEmail = exports.snakeCaseToTitleCase = exports.dynamicSort = exports.checkValidArray = exports.isObject = exports.isEmptyObject = exports.isEmpty = exports.clearSpaceAndReformat = exports.camelize = exports.validateString = void 0;
|
|
29
34
|
var lodash_1 = __importDefault(require("lodash"));
|
|
30
35
|
var validateString = function (str) {
|
|
31
36
|
var specialChar = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
|
|
@@ -425,3 +430,82 @@ var removeMongoDbId = function (result) {
|
|
|
425
430
|
return result.map(moveUuidToTopLevel);
|
|
426
431
|
};
|
|
427
432
|
exports.removeMongoDbId = removeMongoDbId;
|
|
433
|
+
// TODO: Refactor
|
|
434
|
+
var derivedFieldExcludes = [
|
|
435
|
+
"formatType",
|
|
436
|
+
"restToLower",
|
|
437
|
+
"whitespace",
|
|
438
|
+
"type",
|
|
439
|
+
"noSplitopt",
|
|
440
|
+
"length",
|
|
441
|
+
"endopt",
|
|
442
|
+
"startLength",
|
|
443
|
+
"endLength",
|
|
444
|
+
"startString",
|
|
445
|
+
"endString",
|
|
446
|
+
"separator",
|
|
447
|
+
"expression",
|
|
448
|
+
"unixType",
|
|
449
|
+
"currency",
|
|
450
|
+
"maxFraction",
|
|
451
|
+
"position",
|
|
452
|
+
"refField",
|
|
453
|
+
"condition",
|
|
454
|
+
"match",
|
|
455
|
+
"refFieldType",
|
|
456
|
+
"index",
|
|
457
|
+
"positionOfRecords",
|
|
458
|
+
"numberOfRecords",
|
|
459
|
+
"elementToRender",
|
|
460
|
+
"indexNum",
|
|
461
|
+
];
|
|
462
|
+
var processFieldsInlcude = function (fieldsInclude) {
|
|
463
|
+
var result = fieldsInclude;
|
|
464
|
+
var refFieldsInclude = fieldsInclude.filter(function (field) {
|
|
465
|
+
return field.startsWith("RF::");
|
|
466
|
+
});
|
|
467
|
+
var derivedFieldsInclude = fieldsInclude.filter(function (field) {
|
|
468
|
+
return field.startsWith("DF::");
|
|
469
|
+
});
|
|
470
|
+
fieldsInclude = fieldsInclude.filter(function (field) { return !(field.startsWith("RF::") || field.startsWith("DF::")); });
|
|
471
|
+
var refFields = processReferenceFieldInclude(refFieldsInclude);
|
|
472
|
+
var derivedFields = processDerivedFieldInclude(derivedFieldsInclude);
|
|
473
|
+
var extraField = __spreadArray(__spreadArray([], refFields), derivedFields).filter(function (value, index, array) { return array.indexOf(value) === index; });
|
|
474
|
+
result = __spreadArray(__spreadArray([], fieldsInclude), extraField);
|
|
475
|
+
return result;
|
|
476
|
+
};
|
|
477
|
+
exports.processFieldsInlcude = processFieldsInlcude;
|
|
478
|
+
var processReferenceFieldInclude = function (refFieldsInclude) {
|
|
479
|
+
var refFields = [];
|
|
480
|
+
refFieldsInclude.forEach(function (exField) {
|
|
481
|
+
var field = exField.replace("RF::", "");
|
|
482
|
+
field = field.split(".")[0];
|
|
483
|
+
refFields.push(field);
|
|
484
|
+
});
|
|
485
|
+
return refFields;
|
|
486
|
+
};
|
|
487
|
+
var processDerivedFieldInclude = function (derivedFieldsInclude) {
|
|
488
|
+
var derivedFields = [];
|
|
489
|
+
derivedFieldsInclude.forEach(function (exField) {
|
|
490
|
+
var derivedFieldStr = exField.replace("DF::", "");
|
|
491
|
+
derivedFieldStr = derivedFieldStr.replaceAll("*#*#", '"');
|
|
492
|
+
var derivedFieldObj = JSON.parse(derivedFieldStr);
|
|
493
|
+
var fields = [];
|
|
494
|
+
derivedFieldObj.args.forEach(function (arg) {
|
|
495
|
+
var _a;
|
|
496
|
+
if (arg.name === "expression") {
|
|
497
|
+
var needleList = (_a = arg.key
|
|
498
|
+
.match(/{{(.*?)}}/g)) === null || _a === void 0 ? void 0 : _a.map(function (b) { return b.replace(/{{(.*?)}}/g, "$1"); });
|
|
499
|
+
var tempFields = exports.processFieldsInlcude(needleList);
|
|
500
|
+
fields = __spreadArray(__spreadArray([], fields), tempFields);
|
|
501
|
+
}
|
|
502
|
+
else if (!derivedFieldExcludes.includes(arg.name)) {
|
|
503
|
+
var tempFields = Array.isArray(arg.key) ? arg.key : [arg.key];
|
|
504
|
+
tempFields = exports.processFieldsInlcude(tempFields);
|
|
505
|
+
fields = __spreadArray(__spreadArray([], fields), tempFields);
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
derivedFields = __spreadArray(__spreadArray([], derivedFields), fields);
|
|
509
|
+
});
|
|
510
|
+
return derivedFields;
|
|
511
|
+
};
|