badmfck-api-server 1.9.8 → 1.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,8 +56,8 @@ export declare class MysqlService extends BaseService {
56
56
  init(): Promise<void>;
57
57
  recreatePool(): Promise<void>;
58
58
  onApplicationReady(): Promise<void>;
59
- static fieldsToObject(fields: MysqlQueryField[]): MysqlQueryFieldObject;
60
- static objectToFields(obj: MysqlQueryFieldObject): MysqlQueryField[];
59
+ static fieldsToObject(fields: MysqlQueryField[] | MysqlQueryFieldObject): MysqlQueryFieldObject;
60
+ static objectToFields(obj: MysqlQueryFieldObject | MysqlQueryField[]): MysqlQueryField[];
61
61
  static prepareQuery(query: string, fields: MysqlQueryField[] | MysqlQueryFieldObject): string;
62
62
  static prepareQueryFieldValue(value: string | number | boolean | null | undefined, system?: boolean): string | number | boolean | null | undefined;
63
63
  execute(query: string): Promise<MysqlResult>;
@@ -89,6 +89,8 @@ class MysqlService extends BaseService_1.BaseService {
89
89
  }
90
90
  async onApplicationReady() { }
91
91
  static fieldsToObject(fields) {
92
+ if (!Array.isArray(fields))
93
+ return fields;
92
94
  const obj = {};
93
95
  for (let i of fields) {
94
96
  if (!i.name)
@@ -108,6 +110,8 @@ class MysqlService extends BaseService_1.BaseService {
108
110
  return obj;
109
111
  }
110
112
  static objectToFields(obj) {
113
+ if (Array.isArray(obj))
114
+ return obj;
111
115
  const fields = [];
112
116
  for (let i in obj) {
113
117
  if (typeof obj[i] === "object") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",