@maiyunnet/kebab 3.2.26 → 3.2.27

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.26";
8
+ export declare const VER = "3.2.27";
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.26';
9
+ export const VER = '3.2.27';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/ws.d.ts CHANGED
@@ -81,7 +81,7 @@ export interface IRproxyOptions {
81
81
  export declare class Socket {
82
82
  /** --- 当前的 ws 对象 --- */
83
83
  private _ws;
84
- constructor(request?: http.IncomingMessage, socket?: net.Socket, options?: {
84
+ constructor(request?: http.IncomingMessage, socket?: net.Socket, head?: Buffer, options?: {
85
85
  'headers'?: http.OutgoingHttpHeaders;
86
86
  'timeout'?: number;
87
87
  });
@@ -142,7 +142,7 @@ export declare function connect(u: string, opt?: IConnectOptions): Promise<Socke
142
142
  * @param request Http 请求端
143
143
  * @param socket 响应双向 socket
144
144
  */
145
- export declare function createServer(request: http.IncomingMessage, socket: net.Socket, options?: {
145
+ export declare function createServer(request: http.IncomingMessage, socket: net.Socket, head?: Buffer, options?: {
146
146
  'headers'?: http.OutgoingHttpHeaders;
147
147
  'timeout'?: number;
148
148
  }): Socket;
package/lib/ws.js CHANGED
@@ -24,7 +24,7 @@ const liwsServer = liws.createServer({
24
24
  'frameReceiveMode': EFrameReceiveMode.SIMPLE,
25
25
  });
26
26
  export class Socket {
27
- constructor(request, socket, options = {}) {
27
+ constructor(request, socket, head, options = {}) {
28
28
  /** --- 还未开启监听时来的数据将存在这里 --- */
29
29
  this._waitMsg = [];
30
30
  /** --- 还未开启 error 监听时产生的 error 错误对象 --- */
@@ -62,6 +62,7 @@ export class Socket {
62
62
  'socket': socket,
63
63
  'headers': options.headers,
64
64
  'timeout': options.timeout,
65
+ 'clientEarlyDataPayload': head,
65
66
  });
66
67
  this._bindEvent();
67
68
  }
@@ -279,8 +280,8 @@ export function connect(u, opt = {}) {
279
280
  * @param request Http 请求端
280
281
  * @param socket 响应双向 socket
281
282
  */
282
- export function createServer(request, socket, options = {}) {
283
- return new Socket(request, socket, options);
283
+ export function createServer(request, socket, head, options = {}) {
284
+ return new Socket(request, socket, head, options);
284
285
  }
285
286
  /**
286
287
  * --- 绑定 socket 管道 ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.2.26",
3
+ "version": "3.2.27",
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,26 +19,26 @@
19
19
  "#kebab/*": "./*"
20
20
  },
21
21
  "dependencies": {
22
- "@aws-sdk/client-s3": "^3.917.0",
23
- "@aws-sdk/lib-storage": "^3.917.0",
22
+ "@aws-sdk/client-s3": "^3.922.0",
23
+ "@aws-sdk/lib-storage": "^3.922.0",
24
24
  "@litert/http-client": "^1.1.2",
25
25
  "@litert/mime": "^0.1.3",
26
26
  "@litert/redis": "^3.0.5",
27
27
  "@litert/websocket": "^0.2.7",
28
28
  "@types/ssh2": "^1.15.5",
29
- "@zilliz/milvus2-sdk-node": "^2.6.2",
29
+ "@zilliz/milvus2-sdk-node": "^2.6.3",
30
30
  "ejs": "^3.1.10",
31
31
  "jszip": "^3.10.1",
32
32
  "mysql2": "^3.15.3",
33
33
  "openai": "^6.7.0",
34
34
  "ssh2": "^1.17.0",
35
35
  "svg-captcha": "^1.4.0",
36
- "tencentcloud-sdk-nodejs": "^4.1.135"
36
+ "tencentcloud-sdk-nodejs": "^4.1.136"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@litert/eslint-plugin-rules": "^0.3.1",
40
40
  "@types/ejs": "^3.1.5",
41
- "@types/node": "^24.9.1",
41
+ "@types/node": "^24.9.2",
42
42
  "tsc-alias": "^1.8.16",
43
43
  "typescript": "^5.9.3"
44
44
  }
package/sys/child.js CHANGED
@@ -113,7 +113,7 @@ async function run() {
113
113
  });
114
114
  }).on('tlsClientError', (err, socket) => {
115
115
  socket.destroy();
116
- }).on('upgrade', function (req, socket) {
116
+ }).on('upgrade', function (req, socket, head) {
117
117
  const host = (req.headers['host'] ?? '');
118
118
  if (!host) {
119
119
  socket.destroy();
@@ -125,7 +125,7 @@ async function run() {
125
125
  linkCount[key] = 0;
126
126
  }
127
127
  ++linkCount[key];
128
- await upgradeHandler(req, socket, true);
128
+ await upgradeHandler(req, socket, true, head);
129
129
  --linkCount[key];
130
130
  if (!linkCount[key]) {
131
131
  delete linkCount[key];
@@ -164,7 +164,7 @@ async function run() {
164
164
  delete linkCount[key];
165
165
  }
166
166
  });
167
- }).on('upgrade', function (req, socket) {
167
+ }).on('upgrade', function (req, socket, head) {
168
168
  const host = (req.headers['host'] ?? '');
169
169
  if (!host) {
170
170
  socket.destroy();
@@ -176,7 +176,7 @@ async function run() {
176
176
  linkCount[key] = 0;
177
177
  }
178
178
  ++linkCount[key];
179
- await upgradeHandler(req, socket, false);
179
+ await upgradeHandler(req, socket, false, head);
180
180
  --linkCount[key];
181
181
  if (!linkCount[key]) {
182
182
  delete linkCount[key];
@@ -373,8 +373,9 @@ async function requestHandler(req, res, https) {
373
373
  * @param req 请求对象
374
374
  * @param socket socket 对象
375
375
  * @param https 是否是 https
376
+ * @param head head 数据
376
377
  */
377
- async function upgradeHandler(req, socket, https) {
378
+ async function upgradeHandler(req, socket, https, head) {
378
379
  socket.removeAllListeners('error');
379
380
  // --- 当前 uri ---
380
381
  const uri = lText.parseUrl(`ws${https ? 's' : ''}://${req.headers['host'] ?? ''}${req.url ?? ''}`);
@@ -413,10 +414,11 @@ async function upgradeHandler(req, socket, https) {
413
414
  if (await sRoute.run({
414
415
  'req': req,
415
416
  'socket': socket,
417
+ 'head': head,
416
418
  'uri': uri,
417
419
  'rootPath': vhost.real + now,
418
420
  'urlBase': '/' + now,
419
- 'path': path.slice(('/' + pathList.slice(0, i).join('/')).length + 1)
421
+ 'path': path.slice(('/' + pathList.slice(0, i).join('/')).length + 1),
420
422
  })) {
421
423
  return;
422
424
  }
@@ -440,6 +442,7 @@ async function upgradeHandler(req, socket, https) {
440
442
  if (await sRoute.run({
441
443
  'req': req,
442
444
  'socket': socket,
445
+ 'head': head,
443
446
  'uri': uri,
444
447
  'rootPath': vhost.real + now,
445
448
  'urlBase': '/' + now,
package/sys/route.d.ts CHANGED
@@ -19,7 +19,10 @@ export declare function clearKebabConfigs(): void;
19
19
  export declare function run(data: {
20
20
  'req': http2.Http2ServerRequest | http.IncomingMessage;
21
21
  'res'?: http2.Http2ServerResponse | http.ServerResponse;
22
+ /** --- WebSocket 连接的 socket 对象 --- */
22
23
  'socket'?: net.Socket;
24
+ /** --- WebSocket 的 head 数据 --- */
25
+ 'head'?: Buffer;
23
26
  'uri': kebab.IUrlParse;
24
27
  /** --- 虚拟主机当前动态目录的绝对根目录,末尾带 / --- */
25
28
  'rootPath': string;
package/sys/route.js CHANGED
@@ -239,7 +239,7 @@ export async function run(data) {
239
239
  const options = cctr.onUpgrade();
240
240
  // --- 默认无消息发送 3 分钟 ---
241
241
  options.timeout ??= 60_000 * 3;
242
- wsSocket = lWs.createServer(data.req, data.socket, options);
242
+ wsSocket = lWs.createServer(data.req, data.socket, data.head, options);
243
243
  cctr.setPrototype('_socket', wsSocket);
244
244
  }
245
245
  catch (e) {