drapcode-utility 1.1.1 → 1.1.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/errors/app-error.js +2 -0
- package/build/errors/bad-request-error.js +2 -0
- package/build/errors/custom-error.js +2 -0
- package/build/errors/not-found.js +2 -0
- package/build/utils/check-error.js +5 -7
- package/build/utils/query-parser.js +8 -10
- package/build/utils/query-paser-new.js +6 -8
- package/package.json +4 -4
|
@@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -35,12 +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
|
|
39
|
-
for (var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
r[k] = a[j];
|
|
43
|
-
return r;
|
|
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;
|
|
44
42
|
};
|
|
45
43
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -183,7 +181,7 @@ var nestedValue = function (data, messages) {
|
|
|
183
181
|
messages.push(value);
|
|
184
182
|
}
|
|
185
183
|
else if (Array.isArray(value)) {
|
|
186
|
-
messages =
|
|
184
|
+
messages = __spreadArray(__spreadArray([], messages), value);
|
|
187
185
|
}
|
|
188
186
|
else {
|
|
189
187
|
if (Object.keys(value).length) {
|
|
@@ -35,12 +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
|
|
39
|
-
for (var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
r[k] = a[j];
|
|
43
|
-
return r;
|
|
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;
|
|
44
42
|
};
|
|
45
43
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -87,7 +85,7 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
87
85
|
searchQueryObj = null;
|
|
88
86
|
if (searchObj) {
|
|
89
87
|
_a = getSearchObjQuery(searchObj, searchQueryTypeObj, timezone), searchAggregateQuery = _a.searchAggregateQuery, likeQuery = _a.likeQuery;
|
|
90
|
-
aggregateQuery =
|
|
88
|
+
aggregateQuery = __spreadArray(__spreadArray([], aggregateQuery), searchAggregateQuery);
|
|
91
89
|
console.log("likeQuery after getSearchObjQuery", JSON.stringify(likeQuery));
|
|
92
90
|
if (likeQuery && likeQuery.length > 0) {
|
|
93
91
|
searchQueryObj = likeQuery;
|
|
@@ -105,7 +103,7 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
105
103
|
else if (searchObj) {
|
|
106
104
|
console.log("I donot have filter query");
|
|
107
105
|
_b = getSearchObjQuery(searchObj, searchQueryTypeObj, timezone), searchAggregateQuery = _b.searchAggregateQuery, likeQuery = _b.likeQuery;
|
|
108
|
-
aggregateQuery =
|
|
106
|
+
aggregateQuery = __spreadArray(__spreadArray([], aggregateQuery), searchAggregateQuery);
|
|
109
107
|
if (likeQuery.length) {
|
|
110
108
|
// aggregateQuery.push({ $match: { $or: likeQuery } });
|
|
111
109
|
aggregateQuery.push({ $match: { $and: likeQuery } });
|
|
@@ -515,7 +513,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
515
513
|
endValue_1 = "" + externalParams[endValue_1];
|
|
516
514
|
}
|
|
517
515
|
else {
|
|
518
|
-
if (
|
|
516
|
+
if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) {
|
|
519
517
|
return startValue_1.includes(cnst);
|
|
520
518
|
})) {
|
|
521
519
|
startValue_1 = getValueOfProjectConstant(startValue_1, currentUser, timezone);
|
|
@@ -523,7 +521,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
523
521
|
else {
|
|
524
522
|
startValue_1 = constants.filter(function (constant) { return constant.name == startValue_1; });
|
|
525
523
|
}
|
|
526
|
-
if (
|
|
524
|
+
if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) { return endValue_1.includes(cnst); })) {
|
|
527
525
|
endValue_1 = getValueOfProjectConstant(endValue_1, currentUser, timezone);
|
|
528
526
|
}
|
|
529
527
|
else {
|
|
@@ -35,12 +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
|
|
39
|
-
for (var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
r[k] = a[j];
|
|
43
|
-
return r;
|
|
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;
|
|
44
42
|
};
|
|
45
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
44
|
exports.queryParserNew = void 0;
|
|
@@ -579,7 +577,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
579
577
|
endValue_1 = "" + externalParams[endValue_1];
|
|
580
578
|
}
|
|
581
579
|
else {
|
|
582
|
-
if (
|
|
580
|
+
if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) {
|
|
583
581
|
return startValue_1.includes(cnst);
|
|
584
582
|
})) {
|
|
585
583
|
startValue_1 = getValueOfProjectConstant(startValue_1, currentUser);
|
|
@@ -587,7 +585,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
587
585
|
else {
|
|
588
586
|
startValue_1 = constants.filter(function (constant) { return constant.name == startValue_1; });
|
|
589
587
|
}
|
|
590
|
-
if (
|
|
588
|
+
if (__spreadArray([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) { return endValue_1.includes(cnst); })) {
|
|
591
589
|
endValue_1 = getValueOfProjectConstant(endValue_1, currentUser);
|
|
592
590
|
}
|
|
593
591
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drapcode-utility",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@types/voca": "^1.4.2",
|
|
32
32
|
"aws-sdk": "^2.1324.0",
|
|
33
33
|
"axios": "^1.1.2",
|
|
34
|
-
"drapcode-constant": "^1.2.
|
|
35
|
-
"drapcode-logger": "^1.0.
|
|
36
|
-
"drapcode-redis": "^1.0.
|
|
34
|
+
"drapcode-constant": "^1.2.3",
|
|
35
|
+
"drapcode-logger": "^1.0.2",
|
|
36
|
+
"drapcode-redis": "^1.0.2",
|
|
37
37
|
"express": "^4.17.1",
|
|
38
38
|
"express-rate-limit": "^5.1.3",
|
|
39
39
|
"express-validator": "^6.6.1",
|