@maiyunnet/kebab 3.2.10 → 3.2.12

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "3.2.10";
8
+ export declare const VER = "3.2.12";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '3.2.10';
9
+ export const VER = '3.2.12';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.js CHANGED
@@ -360,6 +360,9 @@ export async function passThroughAppend(passThrough, data, end = true) {
360
360
  for (const item of data) {
361
361
  if (item instanceof stream.Readable || item instanceof lResponse.Response) {
362
362
  const stm = item instanceof stream.Readable ? item : item.getStream();
363
+ if (!stm) {
364
+ continue;
365
+ }
363
366
  // --- 读取流、Net 库 Response 对象 ---
364
367
  stm.pipe(passThrough, {
365
368
  'end': false
@@ -27,9 +27,9 @@ export declare class Response {
27
27
  /**
28
28
  * --- 获取响应读取流对象 ---
29
29
  */
30
- getStream(): stream.Readable;
30
+ getStream(): stream.Readable | null;
31
31
  /**
32
32
  * --- 获取原生响应读取流对象 ---
33
33
  */
34
- getRawStream(): stream.Readable;
34
+ getRawStream(): stream.Readable | null;
35
35
  }
@@ -29,12 +29,12 @@ export class Response {
29
29
  * --- 获取响应读取流对象 ---
30
30
  */
31
31
  getStream() {
32
- return this._req.getStream();
32
+ return this._req ? this._req.getStream() : null;
33
33
  }
34
34
  /**
35
35
  * --- 获取原生响应读取流对象 ---
36
36
  */
37
37
  getRawStream() {
38
- return this._req.getRawStream();
38
+ return this._req ? this._req.getRawStream() : null;
39
39
  }
40
40
  }
package/lib/net.js CHANGED
@@ -494,6 +494,10 @@ export async function mproxy(ctr, auth, opt = {}) {
494
494
  ...opt,
495
495
  headers
496
496
  });
497
+ const stream = rres.getRawStream();
498
+ if (!stream) {
499
+ return -3;
500
+ }
497
501
  if (rres.error) {
498
502
  return -2;
499
503
  }
@@ -502,7 +506,7 @@ export async function mproxy(ctr, auth, opt = {}) {
502
506
  }
503
507
  res.writeHead(rres.headers?.['http-code'] ?? 200);
504
508
  await new Promise((resolve) => {
505
- rres.getRawStream().pipe(res).on('finish', () => {
509
+ stream.pipe(res).on('finish', () => {
506
510
  resolve();
507
511
  });
508
512
  });
@@ -554,6 +558,10 @@ export async function rproxy(ctr, route, opt = {}) {
554
558
  ...opt,
555
559
  headers
556
560
  });
561
+ const stream = rres.getRawStream();
562
+ if (!stream) {
563
+ return false;
564
+ }
557
565
  if (rres.error) {
558
566
  return false;
559
567
  }
@@ -562,7 +570,7 @@ export async function rproxy(ctr, route, opt = {}) {
562
570
  }
563
571
  res.writeHead(rres.headers?.['http-code'] ?? 200);
564
572
  await new Promise((resolve) => {
565
- rres.getRawStream().pipe(res).on('finish', () => {
573
+ stream.pipe(res).on('finish', () => {
566
574
  resolve();
567
575
  });
568
576
  });
package/lib/ws.js CHANGED
@@ -107,7 +107,7 @@ export class Socket {
107
107
  'auth': opt.mproxy?.auth ?? ''
108
108
  }) : uri.path;
109
109
  const cli = ca ?
110
- await liws.wssConnect({
110
+ liws.createSecureClient({
111
111
  'hostname': (typeof hosts === 'string' ? hosts : hosts[host]) || host,
112
112
  'port': port,
113
113
  'path': path,
@@ -116,20 +116,21 @@ export class Socket {
116
116
  'connectTimeout': timeout * 1000,
117
117
  'frameReceiveMode': mode,
118
118
  'localAddress': local,
119
- 'ca': ca
119
+ 'ca': ca,
120
120
  }) :
121
- await liws.wsConnect({
121
+ liws.createClient({
122
122
  'hostname': (typeof hosts === 'string' ? hosts : hosts[host]) || host,
123
123
  'port': port,
124
124
  'path': path,
125
125
  'headers': headers,
126
126
  'connectTimeout': timeout * 1000,
127
127
  'frameReceiveMode': mode,
128
- 'localAddress': local
128
+ 'localAddress': local,
129
129
  });
130
130
  cli.setMasking(masking);
131
131
  this._ws = cli;
132
132
  this._bindEvent();
133
+ await cli.connect();
133
134
  return this;
134
135
  }
135
136
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.2.10",
3
+ "version": "3.2.12",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -19,24 +19,24 @@
19
19
  "#kebab/*": "./*"
20
20
  },
21
21
  "dependencies": {
22
- "@aws-sdk/client-s3": "^3.901.0",
23
- "@aws-sdk/lib-storage": "^3.903.0",
22
+ "@aws-sdk/client-s3": "^3.908.0",
23
+ "@aws-sdk/lib-storage": "^3.908.0",
24
24
  "@litert/http-client": "^1.1.2",
25
25
  "@litert/mime": "^0.1.3",
26
26
  "@litert/redis": "^3.0.5",
27
- "@litert/websocket": "^0.2.4",
27
+ "@litert/websocket": "^0.2.6",
28
28
  "@types/ssh2": "^1.15.5",
29
29
  "ejs": "^3.1.10",
30
30
  "jszip": "^3.10.1",
31
- "mysql2": "^3.15.1",
31
+ "mysql2": "^3.15.2",
32
32
  "ssh2": "^1.17.0",
33
33
  "svg-captcha": "^1.4.0",
34
- "tencentcloud-sdk-nodejs": "^4.1.126"
34
+ "tencentcloud-sdk-nodejs": "^4.1.128"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@litert/eslint-plugin-rules": "^0.3.1",
38
38
  "@types/ejs": "^3.1.5",
39
- "@types/node": "^24.7.0",
39
+ "@types/node": "^24.7.2",
40
40
  "tsc-alias": "^1.8.16",
41
41
  "typescript": "^5.9.3"
42
42
  }
package/sys/mod.d.ts CHANGED
@@ -198,6 +198,7 @@ export default class Mod {
198
198
  'raw'?: boolean;
199
199
  'pre'?: string;
200
200
  'index'?: string | string[];
201
+ 'alias'?: string;
201
202
  'contain'?: {
202
203
  'key': string;
203
204
  'list': string[];
package/sys/mod.js CHANGED
@@ -115,11 +115,9 @@ class Mod {
115
115
  }
116
116
  /** --- 是否有 select --- */
117
117
  const select = opt.select ?? (opt.where ? '*' : '');
118
- if (select) {
119
- this._sql.select(select, this.constructor._$table +
120
- (this._index !== null ? ('_' + this._index[0]) : '') +
121
- (opt.alias ? ' ' + opt.alias : ''));
122
- }
118
+ this._sql.select(select, this.constructor._$table +
119
+ (this._index !== null ? ('_' + this._index[0]) : '') +
120
+ (opt.alias ? ' ' + opt.alias : ''));
123
121
  if (opt.where !== undefined) {
124
122
  if (this.constructor._soft && !opt.raw) {
125
123
  if (typeof opt.where === 'string') {
@@ -417,7 +415,8 @@ class Mod {
417
415
  'where': s,
418
416
  'raw': opt.raw,
419
417
  'index': opt.index,
420
- 'contain': opt.contain
418
+ 'contain': opt.contain,
419
+ 'alias': opt.alias,
421
420
  });
422
421
  }
423
422
  /**
package/sys/route.js CHANGED
@@ -579,12 +579,7 @@ export async function run(data) {
579
579
  // --- 已经自行输出过 writeHead,可能自行处理了内容,如 pipe,则不再 writeHead ---
580
580
  }
581
581
  else {
582
- if (data.res.getHeader('location')) {
583
- data.res.writeHead(302);
584
- }
585
- else {
586
- data.res.writeHead(httpCode);
587
- }
582
+ data.res.writeHead(data.res.getHeader('location') ? 302 : httpCode);
588
583
  }
589
584
  if (!data.res.writableEnded) {
590
585
  // --- 如果当前还没结束,则强制关闭连接,一切 pipe 请自行在方法中 await,否则会被中断 ---
@@ -623,6 +618,11 @@ export async function run(data) {
623
618
  else if (rtn instanceof stream.Readable || rtn instanceof lResponse.Response) {
624
619
  // --- 返回的是流,那就以管道的形式输出 ---
625
620
  const stm = rtn instanceof stream.Readable ? rtn : rtn.getStream();
621
+ if (!stm) {
622
+ data.res.end('');
623
+ await waitCtr(cctr ?? middle);
624
+ return true;
625
+ }
626
626
  /** --- 当前的压缩对象 --- */
627
627
  let compress = null;
628
628
  if (!data.res.headersSent) {