badmfck-api-server 3.9.89 → 3.9.91
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.
@@ -204,6 +204,8 @@ class DBService extends BaseService_1.BaseService {
|
|
204
204
|
};
|
205
205
|
};
|
206
206
|
exports.REQ_DB.listener = async (req) => {
|
207
|
+
if (req.fields)
|
208
|
+
req.fields = JSON.parse(JSON.stringify(req.fields));
|
207
209
|
const executionStartTime = Date.now();
|
208
210
|
if (!req.dbid && DBService.allInstances.length === 1 && DBService.allInstances[0].adapter) {
|
209
211
|
const result = await DBService.allInstances[0].adapter.query(req);
|
@@ -153,6 +153,20 @@ class Validator {
|
|
153
153
|
else
|
154
154
|
object[i] = num;
|
155
155
|
}
|
156
|
+
if (typeof structure[i] === "boolean") {
|
157
|
+
if (typeof object[i] === "number") {
|
158
|
+
if (object[i] === 1)
|
159
|
+
object[i] = true;
|
160
|
+
if (object[i] === 0)
|
161
|
+
object[i] = false;
|
162
|
+
}
|
163
|
+
if (typeof object[i] === "string") {
|
164
|
+
if (object[i].trim().toLowerCase() === "true")
|
165
|
+
object[i] = true;
|
166
|
+
if (object[i].trim().toLowerCase() === "false")
|
167
|
+
object[i] = false;
|
168
|
+
}
|
169
|
+
}
|
156
170
|
if (typeof object[i] !== typeof structure[i])
|
157
171
|
errors.push("wrong datatype for field '" + i + "' expected " + typeof structure[i] + " got " + typeof object[i]);
|
158
172
|
if (typeof structure[i] === "object" || typeof structure[i] === "function") {
|