drapcode-utility 1.2.1 → 1.2.2-beta

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.
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -35,14 +35,10 @@ 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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
- if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
43
- }
44
- }
45
- return to.concat(ar || Array.prototype.slice.call(from));
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
39
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
40
+ to[j] = from[i];
41
+ return to;
46
42
  };
47
43
  Object.defineProperty(exports, "__esModule", { value: true });
48
44
  exports.queryParserNew = void 0;
@@ -85,11 +81,11 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
85
81
  if (searchQueryTypeObj[key]) {
86
82
  aggregateQuery.push({
87
83
  $addFields: (_b = {},
88
- _b["_".concat(key)] = { $toString: "$".concat(key) },
84
+ _b["_" + key] = { $toString: "$" + key },
89
85
  _b),
90
86
  });
91
87
  searchQueryObj_1.push((_c = {},
92
- _c["_".concat(key)] = {
88
+ _c["_" + key] = {
93
89
  $regex: value,
94
90
  $options: "i",
95
91
  },
@@ -123,11 +119,11 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
123
119
  // if input is string and db field type is boolean
124
120
  aggregateQuery.push({
125
121
  $addFields: (_b = {},
126
- _b["_".concat(key)] = "$".concat(key),
122
+ _b["_" + key] = "$" + key,
127
123
  _b),
128
124
  });
129
125
  likeQuery_1.push((_c = {},
130
- _c["_".concat(key)] = toBoolean(value),
126
+ _c["_" + key] = toBoolean(value),
131
127
  _c));
132
128
  }
133
129
  else if ([
@@ -139,22 +135,22 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
139
135
  // if input is string and db field type is array
140
136
  aggregateQuery.push({
141
137
  $addFields: (_d = {},
142
- _d["_".concat(key)] = "$".concat(key),
138
+ _d["_" + key] = "$" + key,
143
139
  _d),
144
140
  });
145
141
  likeQuery_1.push((_e = {},
146
- _e["_".concat(key)] = { $all: [value] },
142
+ _e["_" + key] = { $all: [value] },
147
143
  _e));
148
144
  }
149
145
  else if (searchQueryTypeObj[key] === "tel") {
150
146
  // handling value when db field type is tel
151
147
  aggregateQuery.push({
152
148
  $addFields: (_f = {},
153
- _f["_".concat(key)] = { $toString: "$".concat(key) },
149
+ _f["_" + key] = { $toString: "$" + key },
154
150
  _f),
155
151
  });
156
152
  likeQuery_1.push((_g = {},
157
- _g["_".concat(key)] = {
153
+ _g["_" + key] = {
158
154
  $regex: value.startsWith("+") ? value.replace("+", "") : value,
159
155
  $options: "i",
160
156
  },
@@ -164,11 +160,11 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
164
160
  // handling value when db field type is Double/Int
165
161
  aggregateQuery.push({
166
162
  $addFields: (_h = {},
167
- _h["_".concat(key)] = { $toString: { $toLong: "$".concat(key) } },
163
+ _h["_" + key] = { $toString: { $toLong: "$" + key } },
168
164
  _h),
169
165
  });
170
166
  likeQuery_1.push((_j = {},
171
- _j["_".concat(key)] = {
167
+ _j["_" + key] = {
172
168
  $regex: value,
173
169
  $options: "i",
174
170
  },
@@ -179,11 +175,11 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
179
175
  // converting db field to string first
180
176
  aggregateQuery.push({
181
177
  $addFields: (_k = {},
182
- _k["_".concat(key)] = { $toString: "$".concat(key) },
178
+ _k["_" + key] = { $toString: "$" + key },
183
179
  _k),
184
180
  });
185
181
  likeQuery_1.push((_l = {},
186
- _l["_".concat(key)] = {
182
+ _l["_" + key] = {
187
183
  $regex: value,
188
184
  $options: "i",
189
185
  },
@@ -209,21 +205,21 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
209
205
  finder = query.finder, sortBy = query.sortBy, orderBy = query.orderBy, aggregateFunctionField = query.aggregateFunctionField;
210
206
  if (!(finder != "COUNT" && refCollectionFieldsInItems)) return [3 /*break*/, 2];
211
207
  return [4 /*yield*/, Promise.all(refCollectionFieldsInItems.map(function (field) {
212
- var _a, _b, _c;
208
+ var _a;
213
209
  if (["reference", "multi_reference", "belongsTo"].includes(field.type)) {
214
210
  var collectionName_1 = field.refCollection
215
211
  ? field.refCollection["collectionName"]
216
212
  : null;
217
213
  if (collectionName_1) {
218
214
  if (field.type === "belongsTo") {
219
- aggregateQuery.push({
220
- $lookup: {
221
- from: "".concat(collectionName_1),
222
- localField: field.fieldName,
223
- foreignField: "uuid",
224
- as: field.fieldName,
225
- },
226
- });
215
+ // aggregateQuery.push({
216
+ // $lookup: {
217
+ // from: `${collectionName}`,
218
+ // localField: field.fieldName,
219
+ // foreignField: "uuid",
220
+ // as: field.fieldName,
221
+ // },
222
+ // });
227
223
  aggregateQuery.push({
228
224
  $addFields: (_a = {},
229
225
  _a["_$belongsToMetaData"] = field,
@@ -231,72 +227,73 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
231
227
  });
232
228
  }
233
229
  else {
234
- aggregateQuery.push({
235
- $lookup: {
236
- from: "".concat(collectionName_1),
237
- let: (_b = {}, _b["".concat(field.fieldName)] = "$".concat(field.fieldName), _b),
238
- pipeline: [
239
- {
240
- $match: {
241
- $expr: {
242
- $in: [
243
- "$uuid",
244
- {
245
- $cond: {
246
- if: {
247
- $in: ["$$".concat(field.fieldName), ["", null]],
248
- },
249
- then: [],
250
- else: { $ifNull: ["$$".concat(field.fieldName), []] },
251
- },
252
- },
253
- ],
254
- },
255
- },
256
- },
257
- {
258
- $lookup: {
259
- from: "user",
260
- let: { createdBy: "$createdBy" },
261
- pipeline: [
262
- {
263
- $match: {
264
- $expr: { $eq: ["$uuid", "$$createdBy"] },
265
- },
266
- },
267
- { $project: { _id: 0, password: 0 } },
268
- ],
269
- as: "createdBy",
270
- },
271
- },
272
- ],
273
- as: field.fieldName,
274
- },
275
- });
230
+ // aggregateQuery.push({
231
+ // $lookup: {
232
+ // from: `${collectionName}`,
233
+ // let: { [`${field.fieldName}`]: `$${field.fieldName}` },
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
+ // });
276
272
  }
277
273
  }
278
274
  }
279
- if (field.type === "createdBy")
280
- aggregateQuery.push({
281
- $lookup: {
282
- from: "user",
283
- let: (_c = {}, _c["".concat(field.fieldName)] = "$".concat(field.fieldName), _c),
284
- pipeline: [
285
- {
286
- $match: { $expr: { $eq: ["$uuid", "$$".concat(field.fieldName)] } },
287
- },
288
- { $project: { _id: 0, password: 0 } },
289
- ],
290
- as: field.fieldName,
291
- },
292
- });
275
+ if (field.type === "createdBy") {
276
+ }
277
+ // aggregateQuery.push({
278
+ // $lookup: {
279
+ // from: `user`,
280
+ // let: { [`${field.fieldName}`]: `$${field.fieldName}` },
281
+ // pipeline: [
282
+ // {
283
+ // $match: { $expr: { $eq: ["$uuid", `$$${field.fieldName}`] } },
284
+ // },
285
+ // { $project: { _id: 0, password: 0 } },
286
+ // ],
287
+ // as: field.fieldName,
288
+ // },
289
+ // });
293
290
  }))];
294
291
  case 1:
295
292
  _b.sent();
296
293
  _b.label = 2;
297
294
  case 2:
298
295
  if (!["COUNT", "SUM", "AVG", "MIN", "MAX"].includes(finder) &&
299
- !(0, util_1.isEmpty)(projection)) {
296
+ !util_1.isEmpty(projection)) {
300
297
  aggregateQuery.push({ $project: projection });
301
298
  }
302
299
  if (finder === "COUNT") {
@@ -304,22 +301,22 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
304
301
  }
305
302
  else if (finder === "SUM") {
306
303
  aggregateQuery.push({
307
- $group: { _id: null, total: { $sum: "$".concat(aggregateFunctionField) } },
304
+ $group: { _id: null, total: { $sum: "$" + aggregateFunctionField } },
308
305
  });
309
306
  }
310
307
  else if (finder === "AVG") {
311
308
  aggregateQuery.push({
312
- $group: { _id: null, average: { $avg: "$".concat(aggregateFunctionField) } },
309
+ $group: { _id: null, average: { $avg: "$" + aggregateFunctionField } },
313
310
  });
314
311
  }
315
312
  else if (finder === "MIN") {
316
313
  aggregateQuery.push({
317
- $group: { _id: null, minimum: { $min: "$".concat(aggregateFunctionField) } },
314
+ $group: { _id: null, minimum: { $min: "$" + aggregateFunctionField } },
318
315
  });
319
316
  }
320
317
  else if (finder === "MAX") {
321
318
  aggregateQuery.push({
322
- $group: { _id: null, maximum: { $max: "$".concat(aggregateFunctionField) } },
319
+ $group: { _id: null, maximum: { $max: "$" + aggregateFunctionField } },
323
320
  });
324
321
  }
325
322
  offset = externalParams.offset || 0;
@@ -335,8 +332,8 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
335
332
  if (finder != "COUNT" && limit) {
336
333
  aggregateQuery.push({ $skip: +offset }, { $limit: +limit });
337
334
  }
338
- queryStr = ".aggregate(".concat(JSON.stringify(aggregateQuery), ", { collation: { locale: \"en\" } })");
339
- str = "req.db.collection('".concat(collectionName, "')").concat(queryStr);
335
+ queryStr = ".aggregate(" + JSON.stringify(aggregateQuery) + ", { collation: { locale: \"en\" } })";
336
+ str = "req.db.collection('" + collectionName + "')" + queryStr;
340
337
  str += ".toArray()";
341
338
  return [2 /*return*/, str];
342
339
  }
@@ -373,7 +370,7 @@ var mongoFilterQuery = function (query, externalParams, constants, currentUser)
373
370
  filterQuery[lastKey].push(mongoQuery);
374
371
  }
375
372
  else {
376
- filterQuery["$or".concat(index)] = [mongoQuery];
373
+ filterQuery["$or" + index] = [mongoQuery];
377
374
  }
378
375
  }
379
376
  else if (queryObj.conjunctionType == "AND") {
@@ -382,11 +379,11 @@ var mongoFilterQuery = function (query, externalParams, constants, currentUser)
382
379
  filterQuery[lastKey].push(mongoQuery);
383
380
  }
384
381
  else {
385
- filterQuery["$and".concat(index)] = [mongoQuery];
382
+ filterQuery["$and" + index] = [mongoQuery];
386
383
  }
387
384
  }
388
385
  else {
389
- filterQuery["$or".concat(index)] = [mongoQuery];
386
+ filterQuery["$or" + index] = [mongoQuery];
390
387
  }
391
388
  });
392
389
  console.log("==> *** filterQuery #2 :>> ", filterQuery);
@@ -402,13 +399,13 @@ var mongoSelectQuery = function (query) {
402
399
  if (fieldsInclude[0] === "*") {
403
400
  fieldsExclude.map(function (field) {
404
401
  if (field)
405
- return (projection["".concat(field)] = 0);
402
+ return (projection["" + field] = 0);
406
403
  });
407
404
  }
408
405
  else {
409
406
  fieldsInclude.map(function (field) {
410
407
  if (field)
411
- return (projection["".concat(field)] = 1);
408
+ return (projection["" + field] = 1);
412
409
  });
413
410
  }
414
411
  return projection;
@@ -499,7 +496,7 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
499
496
  return _r = {},
500
497
  _r[field] = {
501
498
  $gte: fieldValue,
502
- $lt: new Date((0, date_util_1.nextDayDate)(fieldValue)),
499
+ $lt: new Date(date_util_1.nextDayDate(fieldValue)),
503
500
  },
504
501
  _r;
505
502
  }
@@ -523,11 +520,12 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
523
520
  };
524
521
  if (key == drapcode_constant_1.EQUALS)
525
522
  return _y = {},
523
+ // TODO:Handle Based of Field Type
526
524
  _y[field] = fieldType === "boolean" && fieldValue
527
525
  ? JSON.parse(fieldValue)
528
- : !isNaN(fieldValue)
529
- ? +fieldValue
530
- : fieldValue,
526
+ : // : !isNaN(fieldValue)
527
+ // ? +fieldValue
528
+ fieldValue,
531
529
  _y;
532
530
  if (key == drapcode_constant_1.NOT_EQUAL)
533
531
  return _z = {},
@@ -577,11 +575,11 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
577
575
  if (key === drapcode_constant_1.BETWEEN) {
578
576
  var _a = getMinMaxValue(value), startValue_1 = _a.startValue, endValue_1 = _a.endValue, isInteger = _a.isInteger;
579
577
  if (requiredExternal) {
580
- startValue_1 = "".concat(externalParams[startValue_1]);
581
- endValue_1 = "".concat(externalParams[endValue_1]);
578
+ startValue_1 = "" + externalParams[startValue_1];
579
+ endValue_1 = "" + externalParams[endValue_1];
582
580
  }
583
581
  else {
584
- if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant, true).some(function (cnst) {
582
+ if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) {
585
583
  return startValue_1.includes(cnst);
586
584
  })) {
587
585
  startValue_1 = getValueOfProjectConstant(startValue_1, currentUser);
@@ -589,7 +587,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
589
587
  else {
590
588
  startValue_1 = constants.filter(function (constant) { return constant.name == startValue_1; });
591
589
  }
592
- if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant, true).some(function (cnst) { return endValue_1.includes(cnst); })) {
590
+ if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) { return endValue_1.includes(cnst); })) {
593
591
  endValue_1 = getValueOfProjectConstant(endValue_1, currentUser);
594
592
  }
595
593
  else {
@@ -606,10 +604,10 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
606
604
  //TODO: Need to figure out the params should be treated as number/string
607
605
  if (!isNaN(startValue_1)) {
608
606
  console.log("I am Number");
609
- return "".concat(startValue_1, "---").concat(endValue_1, "^");
607
+ return startValue_1 + "---" + endValue_1 + "^";
610
608
  }
611
609
  else
612
- return "".concat(startValue_1, "---").concat(endValue_1);
610
+ return startValue_1 + "---" + endValue_1;
613
611
  }
614
612
  if (value.includes(drapcode_constant_1.CURRENT_USER)) {
615
613
  if (value === drapcode_constant_1.CURRENT_USER) {
@@ -647,11 +645,12 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
647
645
  //TODO: This is just to confirm if external then it should be get from externalParams
648
646
  if (requiredExternal) {
649
647
  //TODO: Value returns from here undefined.
650
- var externalParamValue = externalParams["".concat(value)];
651
- if (!isNaN(externalParamValue)) {
652
- return +externalParamValue;
653
- }
654
- return externalParams["".concat(value)];
648
+ var externalParamValue = externalParams["" + value];
649
+ // TODO:Handle Based of Field Type
650
+ // if (!isNaN(externalParamValue)) {
651
+ // return +externalParamValue;
652
+ // }
653
+ return externalParams["" + value];
655
654
  }
656
655
  var constantArr = constants.filter(function (constant) { return constant.name == value; });
657
656
  return constantArr.length ? "" + constantArr[0].value : "";
@@ -678,9 +677,9 @@ var getValueOfProjectConstant = function (value, currentUser) {
678
677
  if (value === drapcode_constant_1.CURRENT_USER)
679
678
  return currentUser["uuid"];
680
679
  if (value === drapcode_constant_1.CURRENT_DATE)
681
- return (0, date_util_1.createLoggerDateFormat)();
680
+ return date_util_1.createLoggerDateFormat();
682
681
  if ([drapcode_constant_1.CURRENT_TIME, drapcode_constant_1.CURRENT_DATE_TIME].includes(value))
683
- return (0, date_util_1.createLogsDateFormat)();
682
+ return date_util_1.createLogsDateFormat();
684
683
  if (drapcode_constant_1.DateTimeUnit.some(function (cnst) { return value.includes(cnst); }))
685
- return (0, date_util_1.getDateValue)(value);
684
+ return date_util_1.getDateValue(value);
686
685
  };
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ while (_) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -75,9 +75,9 @@ exports.createS3Client = createS3Client;
75
75
  var fileUploadToS3 = function (files, s3Client, s3Config, encryption, options) {
76
76
  if (options === void 0) { options = {}; }
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var awsConfig, encryptionType, dataKey, accessKeyId, secretAccessKey, region, config, plainTextData, fileOptions, s3Key, _a, _b, _c, _i, index, file, fileObj, fileObj;
79
- return __generator(this, function (_d) {
80
- switch (_d.label) {
78
+ var awsConfig, encryptionType, dataKey, accessKeyId, secretAccessKey, region, config, plainTextData, fileOptions, s3Key, _a, _b, _i, index, file, fileObj, fileObj;
79
+ return __generator(this, function (_c) {
80
+ switch (_c.label) {
81
81
  case 0:
82
82
  if (!encryption) return [3 /*break*/, 2];
83
83
  awsConfig = encryption.awsConfig, encryptionType = encryption.encryptionType, dataKey = encryption.dataKey;
@@ -88,41 +88,38 @@ var fileUploadToS3 = function (files, s3Client, s3Config, encryption, options) {
88
88
  accessKeyId: accessKeyId,
89
89
  secretAccessKey: secretAccessKey,
90
90
  };
91
- return [4 /*yield*/, (0, encryption_2.processKMSDecryption)(config, dataKey, {})];
91
+ return [4 /*yield*/, encryption_2.processKMSDecryption(config, dataKey, {})];
92
92
  case 1:
93
- plainTextData = _d.sent();
93
+ plainTextData = _c.sent();
94
94
  if (plainTextData.status === "FAILED") {
95
95
  return [2 /*return*/, plainTextData];
96
96
  }
97
97
  encryption.dataKey = plainTextData.data;
98
- _d.label = 2;
98
+ _c.label = 2;
99
99
  case 2:
100
100
  if (!Array.isArray(files)) return [3 /*break*/, 7];
101
101
  console.log("I have multiple file");
102
102
  fileOptions = [];
103
103
  s3Key = s3Config.key;
104
- _a = files;
105
- _b = [];
106
- for (_c in _a)
107
- _b.push(_c);
104
+ _a = [];
105
+ for (_b in files)
106
+ _a.push(_b);
108
107
  _i = 0;
109
- _d.label = 3;
108
+ _c.label = 3;
110
109
  case 3:
111
- if (!(_i < _b.length)) return [3 /*break*/, 6];
112
- _c = _b[_i];
113
- if (!(_c in _a)) return [3 /*break*/, 5];
114
- index = _c;
110
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
111
+ index = _a[_i];
115
112
  file = files[index];
116
113
  if (s3Config.append) {
117
- s3Config.key = "".concat(s3Key, "/").concat(file.originalname);
114
+ s3Config.key = s3Key + "/" + file.originalname;
118
115
  }
119
116
  return [4 /*yield*/, processFileUploadToS3(file, s3Client, s3Config, encryption, options, encryption ? true : false)];
120
117
  case 4:
121
- fileObj = _d.sent();
118
+ fileObj = _c.sent();
122
119
  if (fileObj) {
123
120
  fileOptions.push(fileObj);
124
121
  }
125
- _d.label = 5;
122
+ _c.label = 5;
126
123
  case 5:
127
124
  _i++;
128
125
  return [3 /*break*/, 3];
@@ -130,11 +127,11 @@ var fileUploadToS3 = function (files, s3Client, s3Config, encryption, options) {
130
127
  case 7:
131
128
  console.log("I have single file");
132
129
  if (s3Config.append) {
133
- s3Config.key = "".concat(s3Config.key, "/").concat(files.originalname);
130
+ s3Config.key = s3Config.key + "/" + files.originalname;
134
131
  }
135
132
  return [4 /*yield*/, processFileUploadToS3(files, s3Client, s3Config, encryption, options, encryption ? true : false)];
136
133
  case 8:
137
- fileObj = _d.sent();
134
+ fileObj = _c.sent();
138
135
  return [2 /*return*/, fileObj];
139
136
  }
140
137
  });
@@ -154,7 +151,7 @@ var processFileUploadToS3 = function (file, s3Client, s3Config, encryption, opti
154
151
  acl = s3Config.acl, key = s3Config.key, bucket = s3Config.bucket;
155
152
  params = null;
156
153
  if (!encrypt) return [3 /*break*/, 2];
157
- return [4 /*yield*/, (0, encryption_1.cryptFile)(file.path, encryption, false)];
154
+ return [4 /*yield*/, encryption_1.cryptFile(file.path, encryption, false)];
158
155
  case 1:
159
156
  encryptedBody = _a.sent();
160
157
  params = __assign({ Bucket: bucket, ACL: acl, Key: key,
@@ -1,6 +1,6 @@
1
1
  export declare const validateString: (str: string) => false | "String should not contain special characters" | "String should not contain any number";
2
2
  export declare const camelize: (str: string) => string;
3
- export declare const clearSpaceAndReformat: (text: string, separator?: string) => string;
3
+ export declare const clearSpaceAndReformat: (text: string, separator?: string | undefined) => string;
4
4
  export declare const isEmpty: (obj: any) => boolean;
5
5
  export declare const isEmptyObject: (object: any) => boolean;
6
6
  export declare const isObject: (item: any) => any;
@@ -38,7 +38,7 @@ var validateString = function (str) {
38
38
  };
39
39
  exports.validateString = validateString;
40
40
  var camelize = function (str) {
41
- str = (0, exports.clearSpaceAndReformat)(str);
41
+ str = exports.clearSpaceAndReformat(str);
42
42
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
43
43
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
44
44
  });
@@ -165,8 +165,8 @@ var cleanCollectionAndFieldName = function (str) {
165
165
  };
166
166
  exports.cleanCollectionAndFieldName = cleanCollectionAndFieldName;
167
167
  var formatCollectionAndFieldName = function (str) {
168
- var updateString = (0, exports.cleanCollectionAndFieldName)(str);
169
- return (0, exports.clearSpaceAndReformat)(updateString.trim(), "_");
168
+ var updateString = exports.cleanCollectionAndFieldName(str);
169
+ return exports.clearSpaceAndReformat(updateString.trim(), "_");
170
170
  };
171
171
  exports.formatCollectionAndFieldName = formatCollectionAndFieldName;
172
172
  var restructureData = function (data) {
@@ -197,7 +197,7 @@ var restructureData = function (data) {
197
197
  exports.restructureData = restructureData;
198
198
  var checkAndCompareValue = function (input1, input2) {
199
199
  return Array.isArray(input2)
200
- ? (0, exports.arraysEqual)(input1, input2.map(function (key) { return key.value; }))
200
+ ? exports.arraysEqual(input1, input2.map(function (key) { return key.value; }))
201
201
  : input1 === input2.value;
202
202
  };
203
203
  exports.checkAndCompareValue = checkAndCompareValue;
@@ -207,7 +207,7 @@ var arraysEqual = function (array1, array2) {
207
207
  return false;
208
208
  for (var i = 0; i < array1.length; i++ // assert each element equal
209
209
  )
210
- if (!(0, exports.arraysEqual)(array1[i], array2[i]))
210
+ if (!exports.arraysEqual(array1[i], array2[i]))
211
211
  return false;
212
212
  return true;
213
213
  }
@@ -242,7 +242,7 @@ var formatCustomCSSClasses = function (projectCustomCSSClasses) {
242
242
  .replace(/"([^"]+)"/g, "$1")
243
243
  .split(",")
244
244
  .join(";");
245
- projectCustomCSSClassesData += "".concat(element.class.startsWith(".") ? element.class : "." + element.class).concat(element.pseudoClass ? ":" + element.pseudoClass : "").concat(unquotedClassWithProp, " ");
245
+ projectCustomCSSClassesData += "" + (element.class.startsWith(".") ? element.class : "." + element.class) + (element.pseudoClass ? ":" + element.pseudoClass : "") + unquotedClassWithProp + " ";
246
246
  }
247
247
  });
248
248
  return projectCustomCSSClassesData;
@@ -253,18 +253,18 @@ var replaceDataValueIntoExpression = function (expression, data, user, tenant, s
253
253
  var contentList = (_a = expression
254
254
  .match(/{{(.*?)}}/g)) === null || _a === void 0 ? void 0 : _a.map(function (b) { return b.replace(/{{(.*?)}}/g, "$1"); });
255
255
  contentList === null || contentList === void 0 ? void 0 : contentList.forEach(function (prop) {
256
- var needle = "{{".concat(prop, "}}");
256
+ var needle = "{{" + prop + "}}";
257
257
  var dataOfItem = "";
258
258
  if (prop.includes("current_user")) {
259
259
  prop = prop.replace("current_user.", "");
260
260
  if (Object.keys(user).length > 0) {
261
- dataOfItem = (0, exports.parseValueFromData)(user, prop);
261
+ dataOfItem = exports.parseValueFromData(user, prop);
262
262
  }
263
263
  }
264
264
  else if (prop.includes("current_tenant")) {
265
265
  prop = prop.replace("current_tenant.", "");
266
266
  if (Object.keys(tenant).length > 0) {
267
- dataOfItem = (0, exports.parseValueFromData)(tenant, prop);
267
+ dataOfItem = exports.parseValueFromData(tenant, prop);
268
268
  }
269
269
  }
270
270
  else if (prop.includes("current_session")) {
@@ -290,7 +290,7 @@ var replaceDataValueIntoExpression = function (expression, data, user, tenant, s
290
290
  }
291
291
  else {
292
292
  if (Object.keys(data).length > 0) {
293
- dataOfItem = (0, exports.parseValueFromData)(data, prop);
293
+ dataOfItem = exports.parseValueFromData(data, prop);
294
294
  //TODO: Need better way
295
295
  delete data[prop];
296
296
  }
@@ -390,7 +390,7 @@ var replaceTransferObjectValueIntoExpression = function (expression, transferObj
390
390
  var contentList = (_a = expression
391
391
  .match(/{{(.*?)}}/g)) === null || _a === void 0 ? void 0 : _a.map(function (b) { return b.replace(/{{(.*?)}}/g, "$1"); });
392
392
  contentList === null || contentList === void 0 ? void 0 : contentList.forEach(function (prop) {
393
- var needle = "{{".concat(prop, "}}");
393
+ var needle = "{{" + prop + "}}";
394
394
  var dataOfItem = "";
395
395
  dataOfItem = transferObject[prop] ? transferObject[prop] : "";
396
396
  expression = dataOfItem