drapcode-utility 1.0.9 → 1.1.1
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 +0 -2
- package/build/errors/bad-request-error.js +0 -2
- package/build/errors/custom-error.js +0 -2
- package/build/errors/not-found.js +0 -2
- package/build/format-fields/index.js +2 -1
- package/build/utils/check-error.js +7 -5
- package/build/utils/query-parser.js +10 -8
- package/build/utils/query-paser-new.js +8 -6
- package/package.json +4 -4
|
@@ -7,8 +7,6 @@ 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");
|
|
12
10
|
extendStatics(d, b);
|
|
13
11
|
function __() { this.constructor = d; }
|
|
14
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,8 +7,6 @@ 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");
|
|
12
10
|
extendStatics(d, b);
|
|
13
11
|
function __() { this.constructor = d; }
|
|
14
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,8 +7,6 @@ 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");
|
|
12
10
|
extendStatics(d, b);
|
|
13
11
|
function __() { this.constructor = d; }
|
|
14
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -7,8 +7,6 @@ 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");
|
|
12
10
|
extendStatics(d, b);
|
|
13
11
|
function __() { this.constructor = d; }
|
|
14
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -26,7 +26,7 @@ var formatField = function (itemData, fields) {
|
|
|
26
26
|
return newItemData;
|
|
27
27
|
};
|
|
28
28
|
var getFormatFieldData = function (fieldData, fieldType) {
|
|
29
|
-
var createdAt = drapcode_constant_1.FieldTypes.createdAt, text = drapcode_constant_1.FieldTypes.text, large_text = drapcode_constant_1.FieldTypes.large_text, date = drapcode_constant_1.FieldTypes.date, password = drapcode_constant_1.FieldTypes.password, uuid = drapcode_constant_1.FieldTypes.uuid, custom_uuid = drapcode_constant_1.FieldTypes.custom_uuid, email = drapcode_constant_1.FieldTypes.email, url = drapcode_constant_1.FieldTypes.url, number = drapcode_constant_1.FieldTypes.number, unix_timestamp = drapcode_constant_1.FieldTypes.unix_timestamp, reference = drapcode_constant_1.FieldTypes.reference, belongsTo = drapcode_constant_1.FieldTypes.belongsTo, multi_reference = drapcode_constant_1.FieldTypes.multi_reference, dynamic_option = drapcode_constant_1.FieldTypes.dynamic_option, static_option = drapcode_constant_1.FieldTypes.static_option, boolean = drapcode_constant_1.FieldTypes.boolean, time_slot = drapcode_constant_1.FieldTypes.time_slot, slug = drapcode_constant_1.FieldTypes.slug, json = drapcode_constant_1.FieldTypes.json;
|
|
29
|
+
var createdAt = drapcode_constant_1.FieldTypes.createdAt, text = drapcode_constant_1.FieldTypes.text, large_text = drapcode_constant_1.FieldTypes.large_text, date = drapcode_constant_1.FieldTypes.date, password = drapcode_constant_1.FieldTypes.password, uuid = drapcode_constant_1.FieldTypes.uuid, custom_uuid = drapcode_constant_1.FieldTypes.custom_uuid, email = drapcode_constant_1.FieldTypes.email, url = drapcode_constant_1.FieldTypes.url, number = drapcode_constant_1.FieldTypes.number, unix_timestamp = drapcode_constant_1.FieldTypes.unix_timestamp, reference = drapcode_constant_1.FieldTypes.reference, belongsTo = drapcode_constant_1.FieldTypes.belongsTo, multi_reference = drapcode_constant_1.FieldTypes.multi_reference, dynamic_option = drapcode_constant_1.FieldTypes.dynamic_option, static_option = drapcode_constant_1.FieldTypes.static_option, boolean = drapcode_constant_1.FieldTypes.boolean, time_slot = drapcode_constant_1.FieldTypes.time_slot, slug = drapcode_constant_1.FieldTypes.slug, json = drapcode_constant_1.FieldTypes.json, markdown = drapcode_constant_1.FieldTypes.markdown;
|
|
30
30
|
var stringType = [
|
|
31
31
|
createdAt.id,
|
|
32
32
|
text.id,
|
|
@@ -40,6 +40,7 @@ var getFormatFieldData = function (fieldData, fieldType) {
|
|
|
40
40
|
time_slot.id,
|
|
41
41
|
slug.id,
|
|
42
42
|
json.id,
|
|
43
|
+
markdown.id,
|
|
43
44
|
];
|
|
44
45
|
var numberType = [number.id, unix_timestamp.id];
|
|
45
46
|
var arrayType = [
|
|
@@ -35,10 +35,12 @@ 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
|
-
|
|
38
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
39
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
40
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
41
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
42
|
+
r[k] = a[j];
|
|
43
|
+
return r;
|
|
42
44
|
};
|
|
43
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -181,7 +183,7 @@ var nestedValue = function (data, messages) {
|
|
|
181
183
|
messages.push(value);
|
|
182
184
|
}
|
|
183
185
|
else if (Array.isArray(value)) {
|
|
184
|
-
messages =
|
|
186
|
+
messages = __spreadArrays(messages, value);
|
|
185
187
|
}
|
|
186
188
|
else {
|
|
187
189
|
if (Object.keys(value).length) {
|
|
@@ -35,10 +35,12 @@ 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
|
-
|
|
38
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
39
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
40
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
41
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
42
|
+
r[k] = a[j];
|
|
43
|
+
return r;
|
|
42
44
|
};
|
|
43
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -85,7 +87,7 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
85
87
|
searchQueryObj = null;
|
|
86
88
|
if (searchObj) {
|
|
87
89
|
_a = getSearchObjQuery(searchObj, searchQueryTypeObj, timezone), searchAggregateQuery = _a.searchAggregateQuery, likeQuery = _a.likeQuery;
|
|
88
|
-
aggregateQuery =
|
|
90
|
+
aggregateQuery = __spreadArrays(aggregateQuery, searchAggregateQuery);
|
|
89
91
|
console.log("likeQuery after getSearchObjQuery", JSON.stringify(likeQuery));
|
|
90
92
|
if (likeQuery && likeQuery.length > 0) {
|
|
91
93
|
searchQueryObj = likeQuery;
|
|
@@ -103,7 +105,7 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
103
105
|
else if (searchObj) {
|
|
104
106
|
console.log("I donot have filter query");
|
|
105
107
|
_b = getSearchObjQuery(searchObj, searchQueryTypeObj, timezone), searchAggregateQuery = _b.searchAggregateQuery, likeQuery = _b.likeQuery;
|
|
106
|
-
aggregateQuery =
|
|
108
|
+
aggregateQuery = __spreadArrays(aggregateQuery, searchAggregateQuery);
|
|
107
109
|
if (likeQuery.length) {
|
|
108
110
|
// aggregateQuery.push({ $match: { $or: likeQuery } });
|
|
109
111
|
aggregateQuery.push({ $match: { $and: likeQuery } });
|
|
@@ -513,7 +515,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
513
515
|
endValue_1 = "" + externalParams[endValue_1];
|
|
514
516
|
}
|
|
515
517
|
else {
|
|
516
|
-
if (
|
|
518
|
+
if (__spreadArrays([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) {
|
|
517
519
|
return startValue_1.includes(cnst);
|
|
518
520
|
})) {
|
|
519
521
|
startValue_1 = getValueOfProjectConstant(startValue_1, currentUser, timezone);
|
|
@@ -521,7 +523,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
521
523
|
else {
|
|
522
524
|
startValue_1 = constants.filter(function (constant) { return constant.name == startValue_1; });
|
|
523
525
|
}
|
|
524
|
-
if (
|
|
526
|
+
if (__spreadArrays([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) { return endValue_1.includes(cnst); })) {
|
|
525
527
|
endValue_1 = getValueOfProjectConstant(endValue_1, currentUser, timezone);
|
|
526
528
|
}
|
|
527
529
|
else {
|
|
@@ -35,10 +35,12 @@ 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
|
-
|
|
38
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
39
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
40
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
41
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
42
|
+
r[k] = a[j];
|
|
43
|
+
return r;
|
|
42
44
|
};
|
|
43
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
46
|
exports.queryParserNew = void 0;
|
|
@@ -577,7 +579,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
577
579
|
endValue_1 = "" + externalParams[endValue_1];
|
|
578
580
|
}
|
|
579
581
|
else {
|
|
580
|
-
if (
|
|
582
|
+
if (__spreadArrays([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) {
|
|
581
583
|
return startValue_1.includes(cnst);
|
|
582
584
|
})) {
|
|
583
585
|
startValue_1 = getValueOfProjectConstant(startValue_1, currentUser);
|
|
@@ -585,7 +587,7 @@ var replaceExternalParams = function (query, requiredExternal, externalParams, c
|
|
|
585
587
|
else {
|
|
586
588
|
startValue_1 = constants.filter(function (constant) { return constant.name == startValue_1; });
|
|
587
589
|
}
|
|
588
|
-
if (
|
|
590
|
+
if (__spreadArrays([drapcode_constant_1.CURRENT_USER], drapcode_constant_1.DateConstant).some(function (cnst) { return endValue_1.includes(cnst); })) {
|
|
589
591
|
endValue_1 = getValueOfProjectConstant(endValue_1, currentUser);
|
|
590
592
|
}
|
|
591
593
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drapcode-utility",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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.
|
|
35
|
-
"drapcode-logger": "^1.0.
|
|
36
|
-
"drapcode-redis": "^1.0.
|
|
34
|
+
"drapcode-constant": "^1.2.2",
|
|
35
|
+
"drapcode-logger": "^1.0.1",
|
|
36
|
+
"drapcode-redis": "^1.0.1",
|
|
37
37
|
"express": "^4.17.1",
|
|
38
38
|
"express-rate-limit": "^5.1.3",
|
|
39
39
|
"express-validator": "^6.6.1",
|