badmfck-api-server 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,8 @@
1
1
  import { FieldInfo, MysqlError, Pool, PoolConnection } from "mysql";
2
2
  import { BaseService } from "./BaseService";
3
+ import { Req } from "badmfck-signal";
4
+ export declare const REQ_MYSQL_QUERY: Req<MySqlQuery | MySqlQuery[], MysqlResult[]>;
5
+ export declare const executeQuery: (query: MySqlQuery | MySqlQuery[]) => Promise<MysqlResult[]>;
3
6
  export interface MysqlServiceOptions {
4
7
  connectionLimit: number;
5
8
  host: string;
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MysqlService = void 0;
6
+ exports.MysqlService = exports.executeQuery = exports.REQ_MYSQL_QUERY = void 0;
7
7
  const mysql_1 = __importDefault(require("mysql"));
8
8
  const BaseService_1 = require("./BaseService");
9
9
  const badmfck_signal_1 = require("badmfck-signal");
10
- const REQ_MYSQL_QUERY = new badmfck_signal_1.Req();
10
+ exports.REQ_MYSQL_QUERY = new badmfck_signal_1.Req();
11
+ const executeQuery = async (query) => { return await exports.REQ_MYSQL_QUERY.request(query); };
12
+ exports.executeQuery = executeQuery;
11
13
  class MysqlService extends BaseService_1.BaseService {
12
14
  reconnectionTimeout = 1000 * 3;
13
15
  reconnecting = false;
@@ -25,7 +27,7 @@ class MysqlService extends BaseService_1.BaseService {
25
27
  if (this.options.onLog)
26
28
  this.options.onLog(2, "Mysql server not connected");
27
29
  }
28
- REQ_MYSQL_QUERY.listener = async (data) => {
30
+ exports.REQ_MYSQL_QUERY.listener = async (data) => {
29
31
  if (!Array.isArray(data))
30
32
  data = [data];
31
33
  const promises = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",