badmfck-api-server 4.0.76 → 4.0.78

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.
@@ -31,6 +31,8 @@ export interface APIServiceOptions<TInterceptor = unknown> {
31
31
  corsHostWhiteList: string[];
32
32
  projectName: string;
33
33
  endpoints: IBaseEndpoint[];
34
+ keepAliveTimeout?: number;
35
+ headersTimeout?: number;
34
36
  jsonLimit: string;
35
37
  isProductionEnvironment: boolean;
36
38
  interceptor?: IInterceptor<TInterceptor>;
@@ -66,6 +66,8 @@ function defaultOptions() {
66
66
  appVersion: undefined,
67
67
  fileTempDir: "/tmp",
68
68
  fileLimit: 10_000_000,
69
+ keepAliveTimeout: 25 * 1000,
70
+ headersTimeout: 26 * 1000,
69
71
  };
70
72
  }
71
73
  const getDefaultOptions = (overrides) => {
@@ -95,7 +97,7 @@ async function Initializer(services) {
95
97
  }
96
98
  exports.Initializer = Initializer;
97
99
  class APIService extends BaseService_1.BaseService {
98
- version = "4.0.76";
100
+ version = "4.0.78";
99
101
  options;
100
102
  monitor = null;
101
103
  started = new Date();
@@ -159,6 +161,10 @@ class APIService extends BaseService_1.BaseService {
159
161
  };
160
162
  const app = (0, express_1.default)();
161
163
  const server = http_1.default.createServer(app);
164
+ if (this.options.keepAliveTimeout !== undefined)
165
+ server.keepAliveTimeout = this.options.keepAliveTimeout;
166
+ if (this.options.headersTimeout !== undefined)
167
+ server.headersTimeout = this.options.headersTimeout;
162
168
  exports.REQ_HTTP_SERVER.listener = async (_) => { return { express: app, http: server }; };
163
169
  if (this.options.isProductionEnvironment)
164
170
  app.set("env", 'production');
@@ -12,7 +12,7 @@ export interface IDBQueryField {
12
12
  fields?: Record<string, number | boolean | string | null>;
13
13
  }
14
14
  export interface IDBQueryFields {
15
- [key: string]: string | number | boolean | IDBQueryField | null | undefined;
15
+ [key: string]: string | number | boolean | Date | IDBQueryField | null | undefined;
16
16
  }
17
17
  export interface IDBQuery {
18
18
  dbid?: string;
@@ -628,6 +628,10 @@ class MysqlAdapter {
628
628
  }
629
629
  if (typeof value === "boolean")
630
630
  value = value ? 1 : 0;
631
+ if (typeof value === "object" && value instanceof Date) {
632
+ const utcString = value.toISOString().slice(0, 19).replace('T', ' ');
633
+ value = promise_1.default.escape(utcString);
634
+ }
631
635
  if (field.fields && typeof field.fields === "object" && value && typeof value === "string" && value.indexOf("@") !== -1) {
632
636
  for (let key in field.fields) {
633
637
  if (!field.fields[key])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.0.76",
3
+ "version": "4.0.78",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",