@maiyunnet/kebab 5.0.1 → 5.0.3
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.
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/db/conn.js +8 -2
- package/lib/db/pool.js +1 -1
- package/package.json +1 -1
- package/sys/child.js +5 -4
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '5.0.
|
|
9
|
+
export const VER = '5.0.3';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/db/conn.js
CHANGED
|
@@ -20,6 +20,12 @@ pg.types.setTypeParser(pg.types.builtins.POLYGON, val => {
|
|
|
20
20
|
// --- 返回 [{x: 1, y: 1}, {x :2, y: 2}, ... ] ---
|
|
21
21
|
return points;
|
|
22
22
|
});
|
|
23
|
+
pg.types.setTypeParser(pg.types.builtins.INT8, val => {
|
|
24
|
+
if (val === null) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return parseInt(val);
|
|
28
|
+
});
|
|
23
29
|
/** --- 数据库连接对象 --- */
|
|
24
30
|
export class Connection {
|
|
25
31
|
constructor(etc, link) {
|
|
@@ -174,7 +180,7 @@ export class Connection {
|
|
|
174
180
|
catch (e) {
|
|
175
181
|
rtn.error = {
|
|
176
182
|
'message': e.message,
|
|
177
|
-
'errno': e.errno ?? Number(e.code),
|
|
183
|
+
'errno': e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, '')),
|
|
178
184
|
};
|
|
179
185
|
rtn.result = -500;
|
|
180
186
|
}
|
|
@@ -241,7 +247,7 @@ export class Connection {
|
|
|
241
247
|
}
|
|
242
248
|
}
|
|
243
249
|
catch (e) {
|
|
244
|
-
let errno = e.errno ?? Number(e.code.replace(/[a-
|
|
250
|
+
let errno = e.errno ?? Number(e.code.replace(/[a-zA-Z]/g, ''));
|
|
245
251
|
if (errno === 23505) {
|
|
246
252
|
errno = 1062;
|
|
247
253
|
}
|
package/lib/db/pool.js
CHANGED
|
@@ -217,7 +217,7 @@ export class Pool {
|
|
|
217
217
|
c.using();
|
|
218
218
|
link.on('error', function (err) {
|
|
219
219
|
c.setLost();
|
|
220
|
-
if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
|
|
220
|
+
if (err.code !== 'PROTOCOL_CONNECTION_LOST' && err.code !== 'ECONNRESET') {
|
|
221
221
|
lCore.debug('[DB][_getConnection][MYSQL][error]', err);
|
|
222
222
|
lCore.log({}, '[DB][_getConnection][MYSQL][error] ' + err.message, '-error');
|
|
223
223
|
}
|
package/package.json
CHANGED
package/sys/child.js
CHANGED
|
@@ -227,11 +227,12 @@ async function requestHandler(req, res, https) {
|
|
|
227
227
|
let host = req.headers[':authority'];
|
|
228
228
|
if (host === undefined || typeof host !== 'string') {
|
|
229
229
|
host = req.headers['host'];
|
|
230
|
-
if (host === undefined) {
|
|
231
|
-
res.end();
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
230
|
}
|
|
231
|
+
if (host === undefined) {
|
|
232
|
+
res.end();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
host = host.split(':')[0] + ':' + (req.socket.localPort ?? (https ? '443' : '80'));
|
|
235
236
|
const uri = lText.parseUrl(`http${https ? 's' : ''}://${host}${req.url ?? ''}`);
|
|
236
237
|
/** --- 当前的 vhost 配置文件 --- */
|
|
237
238
|
const vhost = await getVhostByHostname(uri.hostname ?? '');
|