@maiyunnet/kebab 3.2.4 → 3.2.5

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.4";
8
+ export declare const VER = "3.2.5";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  export declare const LIB_PATH: string;
@@ -159,10 +159,10 @@ export interface IConfigConst {
159
159
  }
160
160
  /** --- 虚拟机配置对象 --- */
161
161
  export interface IVhost {
162
- readonly 'name': string;
162
+ readonly 'name'?: string;
163
163
  readonly 'domains': string[];
164
164
  readonly 'root': string;
165
- readonly 'remark': string;
165
+ readonly 'remark'?: string;
166
166
  }
167
167
  /** --- 上传的文件信息对象 --- */
168
168
  export interface IPostFile {
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '3.2.4';
9
+ export const VER = '3.2.5';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/s3.d.ts CHANGED
@@ -60,7 +60,7 @@ export declare class S3 {
60
60
  * @param key 对象路径
61
61
  * @param bucket bucket 名
62
62
  */
63
- getObject(key: string, bucket?: string): Promise<false | (stream.Readable & import("@smithy/types").SdkStreamMixin) | (Blob & import("@smithy/types").SdkStreamMixin) | (ReadableStream<any> & import("@smithy/types").SdkStreamMixin) | undefined>;
63
+ getObject(key: string, bucket?: string): Promise<any>;
64
64
  /**
65
65
  * --- 删除对象 ---
66
66
  * @param key 对象路径
package/lib/ws.d.ts CHANGED
@@ -111,7 +111,7 @@ export declare class Socket {
111
111
  end(): void;
112
112
  destroy(): void;
113
113
  /** --- 发送文本 --- */
114
- writeText(data: string): boolean;
114
+ writeText(data: Buffer | string | Array<Buffer | string>): boolean;
115
115
  /** --- 发送结果对象字符串 --- */
116
116
  writeResult(data: kebab.Json): boolean;
117
117
  /** --- 发送二进制 --- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
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,25 +19,25 @@
19
19
  "#kebab/*": "./*"
20
20
  },
21
21
  "dependencies": {
22
- "@aws-sdk/client-s3": "^3.894.0",
23
- "@aws-sdk/lib-storage": "^3.894.0",
22
+ "@aws-sdk/client-s3": "^3.901.0",
23
+ "@aws-sdk/lib-storage": "^3.903.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.3",
27
+ "@litert/websocket": "^0.2.4",
28
28
  "@types/ssh2": "^1.15.5",
29
29
  "ejs": "^3.1.10",
30
30
  "jszip": "^3.10.1",
31
- "mysql2": "^3.15.0",
31
+ "mysql2": "^3.15.1",
32
32
  "ssh2": "^1.17.0",
33
33
  "svg-captcha": "^1.4.0",
34
- "tencentcloud-sdk-nodejs": "^4.1.120"
34
+ "tencentcloud-sdk-nodejs": "^4.1.126"
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.5.2",
39
+ "@types/node": "^24.7.0",
40
40
  "tsc-alias": "^1.8.16",
41
- "typescript": "^5.9.2"
41
+ "typescript": "^5.9.3"
42
42
  }
43
43
  }
package/sys/ctr.d.ts CHANGED
@@ -124,6 +124,10 @@ export declare class Ctr {
124
124
  * --- WebSocket 下连接恢复可写入状态后会调用此事件,可重写此方法 ---
125
125
  */
126
126
  onDrain(): void | Promise<void>;
127
+ /**
128
+ * --- WebSocket 下连接被 end 后会自动被调用的事件,可重写此方法 ---
129
+ */
130
+ onEnd(): void | Promise<void>;
127
131
  /**
128
132
  * --- WebSocket 下连接被终止后会自动被调用的事件,可重写此方法 ---
129
133
  */
@@ -231,7 +235,7 @@ export declare class Ctr {
231
235
  * --- 发送 socket 文本 ---
232
236
  * @param data 要发送的信息
233
237
  */
234
- protected _writeText(data: string): boolean;
238
+ protected _writeText(data: Buffer | string | Array<Buffer | string>): boolean;
235
239
  /**
236
240
  * --- 发送结果对象文本 ---
237
241
  * @param data 要发送的结果对象,如 [0, 'Failed.']
package/sys/ctr.js CHANGED
@@ -163,6 +163,12 @@ export class Ctr {
163
163
  onDrain() {
164
164
  return;
165
165
  }
166
+ /**
167
+ * --- WebSocket 下连接被 end 后会自动被调用的事件,可重写此方法 ---
168
+ */
169
+ onEnd() {
170
+ return;
171
+ }
166
172
  /**
167
173
  * --- WebSocket 下连接被终止后会自动被调用的事件,可重写此方法 ---
168
174
  */
package/sys/route.js CHANGED
@@ -339,6 +339,13 @@ export async function run(data) {
339
339
  }
340
340
  }).on('error', (e) => {
341
341
  lCore.log(cctr, lText.stringifyJson(e.stack).slice(1, -1), '-error');
342
+ }).on('end', async () => {
343
+ try {
344
+ await cctr['onEnd']();
345
+ }
346
+ catch (e) {
347
+ lCore.log(cctr, lText.stringifyJson(e.stack).slice(1, -1), '-error');
348
+ }
342
349
  }).on('close', async () => {
343
350
  try {
344
351
  await cctr['onClose']();
@@ -476,7 +483,7 @@ export async function run(data) {
476
483
  return true;
477
484
  }
478
485
  // --- 检测 action 是否存在,以及排除内部方法 ---
479
- if (pathRight.startsWith('_') || pathRight === 'onUpgrade' || pathRight === 'onLoad' || pathRight === 'onData' || pathRight === 'onDrain' || pathRight === 'onClose' || pathRight === 'setPrototype' || pathRight === 'getPrototype' || pathRight === 'getAuthorization') {
486
+ if (pathRight.startsWith('_') || pathRight === 'onUpgrade' || pathRight === 'onLoad' || pathRight === 'onData' || pathRight === 'onDrain' || pathRight === 'onEnd' || pathRight === 'onClose' || pathRight === 'setPrototype' || pathRight === 'getPrototype' || pathRight === 'getAuthorization') {
480
487
  // --- _ 开头的 action 是内部方法,不允许访问 ---
481
488
  if (config.route['#404']) {
482
489
  data.res.setHeader('location', lText.urlResolve(config.const.urlBase, config.route['#404']));