badmfck-api-server 3.7.0 → 3.7.2

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.9";
98
+ version = "3.7.2";
99
99
  options;
100
100
  monitor = null;
101
101
  started = new Date();
@@ -80,6 +80,7 @@ type ILongQuery = {
80
80
  type IQueriesStat = {
81
81
  failed: number;
82
82
  success: number;
83
+ failedQueries: string[];
83
84
  };
84
85
  export interface IPoolStatus {
85
86
  lastSuccessQueryTime: string;
@@ -37,7 +37,7 @@ exports.S_DB_STAT = new badmfck_signal_1.default();
37
37
  class DBService extends BaseService_1.BaseService {
38
38
  static allInstances = [];
39
39
  longQueries = [];
40
- queriesStat = { hour: "00", stat: { failed: 0, success: 0 } };
40
+ queriesStat = { hour: "00", stat: { failed: 0, success: 0, failedQueries: [] } };
41
41
  options;
42
42
  adapter = null;
43
43
  constructor(options) {
@@ -256,10 +256,12 @@ class DBService extends BaseService_1.BaseService {
256
256
  const hour = (new Date().getHours() + 1).toString().padStart(2, "0");
257
257
  if (this.queriesStat.hour !== hour) {
258
258
  this.queriesStat.hour = hour;
259
- this.queriesStat.stat = { failed: 0, success: 0 };
259
+ this.queriesStat.stat = { failed: 0, success: 0, failedQueries: [] };
260
260
  }
261
- if (result.error)
261
+ if (result.error) {
262
262
  this.queriesStat.stat.failed++;
263
+ this.queriesStat.stat.failedQueries.push(req.query);
264
+ }
263
265
  else
264
266
  this.queriesStat.stat.success++;
265
267
  const execTime = result.execution.finished_at - result.execution.started_at;
@@ -506,11 +506,15 @@ class MysqlAdapter {
506
506
  continue;
507
507
  let queryField = fields[i];
508
508
  if (queryField === undefined)
509
- continue;
509
+ queryField = { value: null, system: true };
510
510
  if (typeof queryField === "string" || typeof queryField === "number" || typeof queryField === "boolean")
511
511
  queryField = { value: queryField, system: false };
512
512
  if (queryField === null)
513
513
  queryField = { value: null, system: true };
514
+ if (queryField.value === undefined) {
515
+ queryField.value = null;
516
+ queryField.system = true;
517
+ }
514
518
  if (!queryField.name)
515
519
  queryField.name = name.replaceAll("`", '').replaceAll('\"', "").replaceAll('\'', "");
516
520
  fields[i] = queryField;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",