@maiyunnet/kebab 9.17.3 → 9.18.1
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/doc/kebab-rag.md +5824 -2744
- package/index.d.ts +3 -1
- package/index.js +1 -1
- package/lib/ws.d.ts +92 -5
- package/lib/ws.js +460 -132
- package/package.json +17 -16
- package/sys/ctr.d.ts +3 -1
- package/sys/ctr.js +4 -2
- package/sys/route.js +6 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.1",
|
|
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": [
|
|
@@ -22,46 +22,47 @@
|
|
|
22
22
|
"#kebab/*": "./*"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/client-s3": "^3.
|
|
26
|
-
"@aws-sdk/lib-storage": "^3.
|
|
25
|
+
"@aws-sdk/client-s3": "^3.1131.0",
|
|
26
|
+
"@aws-sdk/lib-storage": "^3.1131.0",
|
|
27
27
|
"@litert/http-client": "^1.1.2",
|
|
28
28
|
"@litert/mime": "^2.0.0",
|
|
29
29
|
"@litert/redis": "^3.2.1",
|
|
30
|
-
"@litert/websocket": "^0.2.8",
|
|
31
30
|
"@radix-ui/react-checkbox": "^1.3.11",
|
|
32
31
|
"@radix-ui/react-label": "^2.1.15",
|
|
33
32
|
"@radix-ui/react-slot": "^1.3.3",
|
|
34
33
|
"@radix-ui/react-switch": "^1.3.7",
|
|
35
34
|
"@tailwindcss/cli": "^4.3.3",
|
|
36
|
-
"@types/ssh2": "^1.15.
|
|
35
|
+
"@types/ssh2": "^1.15.6",
|
|
37
36
|
"ajv": "^8.20.0",
|
|
38
37
|
"ajv-formats": "^3.0.1",
|
|
39
38
|
"class-variance-authority": "^0.7.1",
|
|
40
39
|
"clsx": "^2.1.1",
|
|
41
40
|
"ejs": "^6.0.1",
|
|
42
41
|
"esbuild": "^0.28.2",
|
|
43
|
-
"jszip": "^3.10.
|
|
44
|
-
"mysql2": "^3.24.
|
|
42
|
+
"jszip": "^3.10.2",
|
|
43
|
+
"mysql2": "^3.24.4",
|
|
45
44
|
"node-cron": "^4.6.0",
|
|
46
|
-
"openai": "^7.
|
|
45
|
+
"openai": "^7.15.0",
|
|
47
46
|
"pg": "^8.23.0",
|
|
48
|
-
"react": "^19.
|
|
49
|
-
"react-dom": "^19.
|
|
50
|
-
"react-router-dom": "^7.18.
|
|
47
|
+
"react": "^19.3.0",
|
|
48
|
+
"react-dom": "^19.3.0",
|
|
49
|
+
"react-router-dom": "^7.18.3",
|
|
51
50
|
"ssh2": "^1.17.0",
|
|
52
51
|
"svg-captcha": "^1.4.0",
|
|
53
52
|
"tailwind-merge": "^3.6.0",
|
|
54
|
-
"tencentcloud-sdk-nodejs": "^4.1.
|
|
55
|
-
"undici": "^8.10.
|
|
56
|
-
"valibot": "^1.
|
|
53
|
+
"tencentcloud-sdk-nodejs": "^4.1.311",
|
|
54
|
+
"undici": "^8.10.2",
|
|
55
|
+
"valibot": "^1.5.0",
|
|
56
|
+
"ws": "^8.21.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@litert/eslint-plugin-rules": "^0.3.1",
|
|
60
60
|
"@types/ejs": "^3.1.5",
|
|
61
61
|
"@types/node": "^26.4.0",
|
|
62
62
|
"@types/pg": "^8.23.1",
|
|
63
|
-
"@types/react": "^19.
|
|
64
|
-
"@types/react-dom": "^19.
|
|
63
|
+
"@types/react": "^19.3.0",
|
|
64
|
+
"@types/react-dom": "^19.3.0",
|
|
65
|
+
"@types/ws": "^8.18.1",
|
|
65
66
|
"typedoc": "^0.28.20",
|
|
66
67
|
"typedoc-plugin-markdown": "^4.13.0",
|
|
67
68
|
"typescript": "^6.0.3"
|
package/sys/ctr.d.ts
CHANGED
|
@@ -411,8 +411,10 @@ export declare class Ctr {
|
|
|
411
411
|
protected _pong(data?: Buffer | string): boolean;
|
|
412
412
|
/**
|
|
413
413
|
* --- 主动关闭当前 socket 连接 ---
|
|
414
|
+
* @param code WebSocket 关闭码
|
|
415
|
+
* @param reason 关闭原因
|
|
414
416
|
*/
|
|
415
|
-
protected _end(): void;
|
|
417
|
+
protected _end(code?: number, reason?: string): void;
|
|
416
418
|
/**
|
|
417
419
|
* --- 获取 formdata 的信息 ---
|
|
418
420
|
* @param events 文件处理情况
|
package/sys/ctr.js
CHANGED
|
@@ -1010,9 +1010,11 @@ export class Ctr {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
/**
|
|
1012
1012
|
* --- 主动关闭当前 socket 连接 ---
|
|
1013
|
+
* @param code WebSocket 关闭码
|
|
1014
|
+
* @param reason 关闭原因
|
|
1013
1015
|
*/
|
|
1014
|
-
_end() {
|
|
1015
|
-
this._socket.end();
|
|
1016
|
+
_end(code = 1000, reason = '') {
|
|
1017
|
+
this._socket.end(code, reason);
|
|
1016
1018
|
}
|
|
1017
1019
|
/**
|
|
1018
1020
|
* --- 获取 formdata 的信息 ---
|
package/sys/route.js
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import * as stream from 'stream';
|
|
8
|
-
// --- 第三方 ---
|
|
9
|
-
import * as ws from '@litert/websocket';
|
|
10
8
|
// --- 库和定义 ---
|
|
11
9
|
import * as lFs from '#kebab/lib/fs.js';
|
|
12
10
|
import * as lZlib from '#kebab/lib/zlib.js';
|
|
@@ -147,6 +145,7 @@ export async function run(data) {
|
|
|
147
145
|
'host': data.uri.host ?? '',
|
|
148
146
|
'hostname': data.uri.hostname ?? '',
|
|
149
147
|
'hostport': data.uri.port ? parseInt(data.uri.port) : (data.uri.protocol === 'https:' ? 443 : 80),
|
|
148
|
+
'urlOrigin': (data.uri.protocol ?? '') + '//' + (data.uri.host ?? ''),
|
|
150
149
|
'uri': data.uri,
|
|
151
150
|
// --- 服务端用的路径 ---
|
|
152
151
|
'rootPath': data.rootPath,
|
|
@@ -331,7 +330,7 @@ export async function run(data) {
|
|
|
331
330
|
await new Promise(function (resolve) {
|
|
332
331
|
wsSocket.on('message', async function (msg) {
|
|
333
332
|
switch (msg.opcode) {
|
|
334
|
-
case
|
|
333
|
+
case lWs.EOpcode.CLOSE: {
|
|
335
334
|
const r = await cctr['onMessage'](msg.data, msg.opcode);
|
|
336
335
|
if (r === false) {
|
|
337
336
|
break;
|
|
@@ -339,7 +338,7 @@ export async function run(data) {
|
|
|
339
338
|
wsSocket.end();
|
|
340
339
|
break;
|
|
341
340
|
}
|
|
342
|
-
case
|
|
341
|
+
case lWs.EOpcode.PING: {
|
|
343
342
|
const r = await cctr['onMessage'](msg.data, msg.opcode);
|
|
344
343
|
if (r === false) {
|
|
345
344
|
break;
|
|
@@ -347,14 +346,14 @@ export async function run(data) {
|
|
|
347
346
|
wsSocket.pong();
|
|
348
347
|
break;
|
|
349
348
|
}
|
|
350
|
-
case
|
|
351
|
-
case
|
|
349
|
+
case lWs.EOpcode.BINARY:
|
|
350
|
+
case lWs.EOpcode.TEXT: {
|
|
352
351
|
try {
|
|
353
352
|
const r = await cctr['onMessage'](msg.data, msg.opcode);
|
|
354
353
|
if (r === false) {
|
|
355
354
|
break;
|
|
356
355
|
}
|
|
357
|
-
const wrtn = await cctr['onData'](msg.opcode ===
|
|
356
|
+
const wrtn = await cctr['onData'](msg.opcode === lWs.EOpcode.TEXT ? msg.data.toString() : msg.data, msg.opcode);
|
|
358
357
|
if (wrtn === false) {
|
|
359
358
|
wsSocket.end();
|
|
360
359
|
return;
|