badmfck-api-server 2.8.1 → 2.8.3

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.
@@ -88,7 +88,7 @@ async function Initializer(services) {
88
88
  exports.Initializer = Initializer;
89
89
  class APIService extends BaseService_1.BaseService {
90
90
  static nextLogID = 0;
91
- version = "2.8.1";
91
+ version = "2.8.3";
92
92
  options;
93
93
  monitor;
94
94
  monitorIndexFile;
@@ -18,6 +18,7 @@ export interface IDBQuery {
18
18
  throwable?: boolean;
19
19
  transactionID?: number;
20
20
  calculateCount?: boolean;
21
+ parseQueryOnly?: boolean;
21
22
  }
22
23
  export interface IDBError {
23
24
  code: string;
@@ -155,6 +155,12 @@ class MysqlAdapter {
155
155
  }
156
156
  async query(request) {
157
157
  const query = this.prepareQuery(request);
158
+ if (request.parseQueryOnly) {
159
+ return {
160
+ data: [{ query }],
161
+ error: null,
162
+ };
163
+ }
158
164
  if (!this.pool) {
159
165
  (0, LogService_1.logError)("${MysqlAdapter.js}", "No pool created, can't execute query");
160
166
  const error = {
@@ -263,13 +269,13 @@ class MysqlAdapter {
263
269
  for (let i in fields) {
264
270
  const name = i;
265
271
  const value = fields[i];
266
- if (typeof value === "string")
272
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
267
273
  fields[i] = { value: value, system: false };
268
274
  if (value === undefined)
269
275
  continue;
270
276
  if (value === null)
271
277
  fields[i] = { value: null, system: true };
272
- const parsed = MysqlAdapter.prepareQueryFieldValue(value);
278
+ const parsed = MysqlAdapter.prepareQueryFieldValue(fields[i]);
273
279
  query = query.replaceAll("@" + name, parsed + "");
274
280
  }
275
281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "2.8.1",
3
+ "version": "2.8.3",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",