badmfck-api-server 3.6.3 → 3.6.5

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.
@@ -95,7 +95,7 @@ async function Initializer(services) {
95
95
  exports.Initializer = Initializer;
96
96
  class APIService extends BaseService_1.BaseService {
97
97
  static nextLogID = 0;
98
- version = "3.6.1";
98
+ version = "3.6.5";
99
99
  options;
100
100
  monitor = null;
101
101
  started = new Date();
@@ -193,7 +193,7 @@ class MysqlAdapter {
193
193
  trxRequest.queries.push({ sql: "START TRANSACTION", status: "ok" });
194
194
  this.transactions.push(trxRequest);
195
195
  if (this.options.debug)
196
- (0, LogService_1.logDB)("Transactions pool: ", this.transactions);
196
+ (0, LogService_1.logDB)("Transactions pool: ", this.transactions.map(t => "id:" + t.id + ", queries: " + t.queries.length));
197
197
  return { data: { transactionId: trxid } };
198
198
  }
199
199
  async tCommit(trxid) {
@@ -472,8 +472,18 @@ class MysqlAdapter {
472
472
  let system = field.system;
473
473
  if (value === null || value === undefined)
474
474
  return "NULL";
475
- if (!system && typeof value === "string")
476
- value = '"' + value.replaceAll('"', '\\"') + '"';
475
+ if (!system && typeof value === "object") {
476
+ try {
477
+ value = JSON.stringify(value);
478
+ }
479
+ catch (e) {
480
+ console.error("Can't prepare JSON object", e);
481
+ value = "{}";
482
+ }
483
+ }
484
+ if (!system && typeof value === "string") {
485
+ value = promise_1.default.escape(value);
486
+ }
477
487
  if (typeof value === "boolean")
478
488
  value = value ? 1 : 0;
479
489
  field.__parsedValue = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.6.3",
3
+ "version": "3.6.5",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",