badmfck-api-server 2.8.2 → 2.8.4
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.
@@ -225,6 +225,8 @@ class MysqlAdapter {
|
|
225
225
|
this.finalizeConnection(conn);
|
226
226
|
}
|
227
227
|
const error = this.createMysqlQueryError(e);
|
228
|
+
if (`${e}`.indexOf('ECONNREFUSED') !== -1)
|
229
|
+
this.recreatePool();
|
228
230
|
if (request.throwable)
|
229
231
|
throw { ...DefaultErrors_1.default.DB_ERROR, details: error.message, stack: error };
|
230
232
|
return {
|
@@ -275,7 +277,7 @@ class MysqlAdapter {
|
|
275
277
|
continue;
|
276
278
|
if (value === null)
|
277
279
|
fields[i] = { value: null, system: true };
|
278
|
-
const parsed = MysqlAdapter.prepareQueryFieldValue(
|
280
|
+
const parsed = MysqlAdapter.prepareQueryFieldValue(fields[i]);
|
279
281
|
query = query.replaceAll("@" + name, parsed + "");
|
280
282
|
}
|
281
283
|
}
|
@@ -16,7 +16,9 @@ export interface IExternalServiceOptions {
|
|
16
16
|
privateKey: string;
|
17
17
|
publicKey: string;
|
18
18
|
requests: Req<any, any>[];
|
19
|
+
executors?: Req<any, any>[];
|
19
20
|
url: string;
|
21
|
+
password?: string;
|
20
22
|
}
|
21
23
|
export declare class ExternalService extends BaseService {
|
22
24
|
static allInstances: ExternalService[];
|
@@ -69,6 +69,17 @@ class ExternalService extends BaseService_1.BaseService {
|
|
69
69
|
}
|
70
70
|
ExternalService.allInstances.push(this);
|
71
71
|
this.options = opt;
|
72
|
+
if (this.options.executors) {
|
73
|
+
for (let r of this.options.executors) {
|
74
|
+
r.listener = async (req) => {
|
75
|
+
return await this.requestExternalCall({
|
76
|
+
id: opt.id,
|
77
|
+
requestName: r.name,
|
78
|
+
requestData: req
|
79
|
+
});
|
80
|
+
};
|
81
|
+
}
|
82
|
+
}
|
72
83
|
this.init();
|
73
84
|
}
|
74
85
|
init() {
|
@@ -157,7 +168,7 @@ class ExternalService extends BaseService_1.BaseService {
|
|
157
168
|
}
|
158
169
|
encrypt(req) {
|
159
170
|
const data = JSON.stringify(req);
|
160
|
-
const password = "UDhFUREQRm1IN4ACRuH5";
|
171
|
+
const password = this.options.password ?? "UDhFUREQRm1IN4ACRuH5";
|
161
172
|
const iv = crypto_1.default.randomBytes(16);
|
162
173
|
const salt = "2b8869f12dd9d562";
|
163
174
|
const key = crypto_1.default.pbkdf2Sync(password, Buffer.from(salt, "hex"), 1000, 24, "sha1");
|