badmfck-api-server 3.9.88 → 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.
@@ -92,7 +92,7 @@ async function Initializer(services) {
92
92
  }
93
93
  exports.Initializer = Initializer;
94
94
  class APIService extends BaseService_1.BaseService {
95
- version = "3.9.86";
95
+ version = "3.9.9";
96
96
  options;
97
97
  monitor = null;
98
98
  started = new Date();
@@ -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") {
@@ -188,8 +202,10 @@ class Validator {
188
202
  if (!structureOptions.values.includes(object[i])) {
189
203
  let caseValue = null;
190
204
  for (let i of structureOptions.values) {
191
- const v = i.toLowerCase();
192
- if (v === (object[i] + "").toLowerCase()) {
205
+ if (i === null || i === undefined)
206
+ continue;
207
+ const v = (i + "").toLowerCase().trim();
208
+ if (v === (object[i] + "").toLowerCase().trim()) {
193
209
  caseValue = object[i];
194
210
  break;
195
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.9.88",
3
+ "version": "3.9.91",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",