drapcode-utility 1.3.4 → 1.3.6
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 +19 -16
- package/build/utils/query-paser-new.js +20 -17
- package/package.json +1 -1
|
@@ -252,7 +252,7 @@ var modifyQuery = function (obj, hasAndQueryConjunction) {
|
|
|
252
252
|
return arr;
|
|
253
253
|
};
|
|
254
254
|
var queryToMongo = function (query, requiredExternal, externalParams, constants, currentUser, currentTenant, timezone) {
|
|
255
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
255
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
256
256
|
if (currentUser === void 0) { currentUser = {}; }
|
|
257
257
|
if (currentTenant === void 0) { currentTenant = {}; }
|
|
258
258
|
var fieldValue = replaceExternalParams(query, requiredExternal, externalParams, constants, currentUser, currentTenant, timezone);
|
|
@@ -368,31 +368,34 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
|
|
|
368
368
|
],
|
|
369
369
|
};
|
|
370
370
|
if (key == drapcode_constant_1.EQUALS) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
371
|
+
console.log("I am query parser");
|
|
372
|
+
console.log("fieldType", fieldType);
|
|
373
|
+
if (fieldType === "boolean") {
|
|
374
|
+
return _x = {}, _x[field] = !!fieldValue, _x;
|
|
375
|
+
}
|
|
376
|
+
if (fieldType === "number") {
|
|
377
|
+
return _y = {}, _y[field] = +fieldValue, _y;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
return _z = {}, _z[field] = fieldValue, _z;
|
|
381
|
+
}
|
|
379
382
|
}
|
|
380
383
|
if (key == drapcode_constant_1.NOT_EQUAL)
|
|
381
|
-
return
|
|
382
|
-
|
|
384
|
+
return _0 = {},
|
|
385
|
+
_0[field] = {
|
|
383
386
|
$ne: fieldType === "boolean" && fieldValue
|
|
384
387
|
? JSON.parse(fieldValue)
|
|
385
388
|
: fieldValue,
|
|
386
389
|
},
|
|
387
|
-
|
|
390
|
+
_0;
|
|
388
391
|
if (key == drapcode_constant_1.BETWEEN) {
|
|
389
|
-
var
|
|
390
|
-
return
|
|
391
|
-
|
|
392
|
+
var _2 = (0, exports.getMinMaxValue)(fieldValue), startValue = _2.startValue, endValue = _2.endValue, isInteger = _2.isInteger;
|
|
393
|
+
return _1 = {},
|
|
394
|
+
_1[field] = {
|
|
392
395
|
$gte: isInteger ? +startValue : startValue,
|
|
393
396
|
$lte: isInteger ? +endValue : endValue,
|
|
394
397
|
},
|
|
395
|
-
|
|
398
|
+
_1;
|
|
396
399
|
}
|
|
397
400
|
};
|
|
398
401
|
var isEntityInCondition = function (value) {
|
|
@@ -354,7 +354,7 @@ var modifyQuery = function (obj, hasAndQueryConjunction) {
|
|
|
354
354
|
return arr;
|
|
355
355
|
};
|
|
356
356
|
var queryToMongo = function (query, requiredExternal, externalParams, constants, currentUser) {
|
|
357
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
357
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
358
358
|
if (currentUser === void 0) { currentUser = {}; }
|
|
359
359
|
var fieldValue = replaceExternalParams(query, requiredExternal, externalParams, constants, currentUser);
|
|
360
360
|
var isDate = checkDate(fieldValue);
|
|
@@ -444,31 +444,34 @@ var queryToMongo = function (query, requiredExternal, externalParams, constants,
|
|
|
444
444
|
(_x = {}, _x[field] = { $exists: false }, _x),
|
|
445
445
|
],
|
|
446
446
|
};
|
|
447
|
-
if (key == drapcode_constant_1.EQUALS)
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
447
|
+
if (key == drapcode_constant_1.EQUALS) {
|
|
448
|
+
console.log("I am query parser new");
|
|
449
|
+
if (fieldType === "boolean") {
|
|
450
|
+
return _y = {}, _y[field] = !!fieldValue, _y;
|
|
451
|
+
}
|
|
452
|
+
if (fieldType === "number") {
|
|
453
|
+
return _z = {}, _z[field] = +fieldValue, _z;
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
return _0 = {}, _0[field] = fieldValue, _0;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
456
459
|
if (key == drapcode_constant_1.NOT_EQUAL)
|
|
457
|
-
return
|
|
458
|
-
|
|
460
|
+
return _1 = {},
|
|
461
|
+
_1[field] = {
|
|
459
462
|
$ne: fieldType === "boolean" && fieldValue
|
|
460
463
|
? JSON.parse(fieldValue)
|
|
461
464
|
: fieldValue,
|
|
462
465
|
},
|
|
463
|
-
|
|
466
|
+
_1;
|
|
464
467
|
if (key == drapcode_constant_1.BETWEEN) {
|
|
465
|
-
var
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
+
var _3 = getMinMaxValue(fieldValue), startValue = _3.startValue, endValue = _3.endValue, isInteger = _3.isInteger;
|
|
469
|
+
return _2 = {},
|
|
470
|
+
_2[field] = {
|
|
468
471
|
$gte: isInteger ? +startValue : startValue,
|
|
469
472
|
$lte: isInteger ? +endValue : endValue,
|
|
470
473
|
},
|
|
471
|
-
|
|
474
|
+
_2;
|
|
472
475
|
}
|
|
473
476
|
};
|
|
474
477
|
var replaceExternalParams = function (query, requiredExternal, externalParams, constants, currentUser) {
|