@maiyunnet/kebab 2.0.6 → 2.0.8

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.
Files changed (83) hide show
  1. package/index.d.ts +11 -1
  2. package/index.js +13 -1
  3. package/lib/buffer.d.ts +25 -0
  4. package/lib/buffer.js +30 -5
  5. package/lib/captcha.d.ts +15 -0
  6. package/lib/captcha.js +20 -0
  7. package/lib/consistent.d.ts +51 -0
  8. package/lib/consistent.js +59 -0
  9. package/lib/core.d.ts +134 -0
  10. package/lib/core.js +176 -0
  11. package/lib/crypto.d.ts +75 -6
  12. package/lib/crypto.js +206 -38
  13. package/lib/db.d.ts +104 -0
  14. package/lib/db.js +126 -0
  15. package/lib/dns.d.ts +51 -0
  16. package/lib/dns.js +54 -2
  17. package/lib/fs.d.ts +100 -0
  18. package/lib/fs.js +118 -0
  19. package/lib/jwt.d.ts +43 -0
  20. package/lib/jwt.js +45 -0
  21. package/lib/kv.d.ts +362 -0
  22. package/lib/kv.js +377 -0
  23. package/lib/lan.d.ts +6 -0
  24. package/lib/lan.js +7 -0
  25. package/lib/net/formdata.d.ts +38 -0
  26. package/lib/net/formdata.js +43 -0
  27. package/lib/net/request.d.ts +62 -0
  28. package/lib/net/request.js +57 -0
  29. package/lib/net/response.d.ts +21 -0
  30. package/lib/net/response.js +16 -0
  31. package/lib/net.d.ts +86 -0
  32. package/lib/net.js +140 -0
  33. package/lib/s3.d.ts +52 -0
  34. package/lib/s3.js +51 -0
  35. package/lib/scan.d.ts +52 -0
  36. package/lib/scan.js +84 -0
  37. package/lib/session.d.ts +31 -0
  38. package/lib/session.js +52 -1
  39. package/lib/sql.d.ts +176 -0
  40. package/lib/sql.js +287 -2
  41. package/lib/ssh/sftp.d.ts +106 -0
  42. package/lib/ssh/sftp.js +106 -0
  43. package/lib/ssh/shell.d.ts +37 -0
  44. package/lib/ssh/shell.js +31 -0
  45. package/lib/ssh.d.ts +32 -0
  46. package/lib/ssh.js +32 -0
  47. package/lib/text.d.ts +131 -0
  48. package/lib/text.js +188 -0
  49. package/lib/time.d.ts +53 -0
  50. package/lib/time.js +55 -0
  51. package/lib/ws.d.ts +68 -0
  52. package/lib/ws.js +74 -0
  53. package/lib/zip.d.ts +53 -0
  54. package/lib/zip.js +73 -0
  55. package/lib/zlib.d.ts +76 -0
  56. package/lib/zlib.js +78 -0
  57. package/main.d.ts +6 -1
  58. package/main.js +11 -1
  59. package/package.json +2 -2
  60. package/sys/child.js +104 -0
  61. package/sys/cmd.js +28 -0
  62. package/sys/ctr.d.ts +166 -0
  63. package/sys/ctr.js +177 -0
  64. package/sys/master.js +63 -0
  65. package/sys/mod.d.ts +266 -0
  66. package/sys/mod.js +335 -0
  67. package/sys/route.d.ts +34 -0
  68. package/sys/route.js +164 -0
  69. package/www/example/ctr/test.d.ts +3 -0
  70. package/www/example/ctr/test.js +63 -1
  71. package/www/example/mod/test.js +14 -0
  72. package/www/example/mod/testdata.js +9 -0
  73. package/www/example/ws/test.js +1 -0
  74. package/.VSCodeCounter/2025-02-14_14-46-44/details.md +0 -82
  75. package/.VSCodeCounter/2025-02-14_14-46-44/diff-details.md +0 -15
  76. package/.VSCodeCounter/2025-02-14_14-46-44/diff.csv +0 -2
  77. package/.VSCodeCounter/2025-02-14_14-46-44/diff.md +0 -19
  78. package/.VSCodeCounter/2025-02-14_14-46-44/diff.txt +0 -22
  79. package/.VSCodeCounter/2025-02-14_14-46-44/results.csv +0 -69
  80. package/.VSCodeCounter/2025-02-14_14-46-44/results.json +0 -1
  81. package/.VSCodeCounter/2025-02-14_14-46-44/results.md +0 -48
  82. package/.VSCodeCounter/2025-02-14_14-46-44/results.txt +0 -118
  83. package/.vscode/tasks.json +0 -15
package/sys/route.d.ts CHANGED
@@ -1,26 +1,60 @@
1
+ /**
2
+ * Project: Kebab, User: JianSuoQiYue
3
+ * Date: 2019-4-15 13:40
4
+ * Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53
5
+ */
1
6
  import * as http from 'http';
2
7
  import * as http2 from 'http2';
3
8
  import * as net from 'net';
4
9
  import * as sCtr from './ctr';
5
10
  import * as types from '../types';
11
+ /**
12
+ * --- 清除已经加载的虚拟主机配置文件 ---
13
+ */
6
14
  export declare function clearKebabConfigs(): void;
15
+ /**
16
+ * --- 若为动态路径则执行此函数,此函数不进行判断 kebab.json 是否存在 ---
17
+ * @param data 传导的数据
18
+ */
7
19
  export declare function run(data: {
8
20
  'req': http2.Http2ServerRequest | http.IncomingMessage;
9
21
  'res'?: http2.Http2ServerResponse | http.ServerResponse;
10
22
  'socket'?: net.Socket;
11
23
  'uri': types.IUrlParse;
24
+ /** --- 虚拟主机当前动态目录的绝对根目录,末尾带 / --- */
12
25
  'rootPath': string;
26
+ /** --- base url,如 /abc/vhost/,前后都带 / --- */
13
27
  'urlBase': string;
28
+ /** --- 前面不带 /,末尾不一定,以用户请求为准 --- */
14
29
  'path': string;
30
+ /** --- timeout timer --- */
15
31
  'timer'?: {
16
32
  'timer': NodeJS.Timeout;
17
33
  'timeout': number;
18
34
  'callback': () => void;
19
35
  };
20
36
  }): Promise<boolean>;
37
+ /**
38
+ * --- 删除本次请求所有已上传的临时文件, Mutton: false, Kebab: true ---
39
+ * @param cctr Ctr 对象 或 files
40
+ */
21
41
  export declare function unlinkUploadFiles(cctr: sCtr.Ctr | Record<string, types.IPostFile | types.IPostFile[]>): Promise<void>;
42
+ /**
43
+ * --- 等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件 ---
44
+ * --- 此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间 ---
45
+ * @param cctr 要等待的控制器 ---
46
+ */
22
47
  export declare function waitCtr(cctr: sCtr.Ctr): Promise<void>;
48
+ /**
49
+ * --- 将 POST 数据的值执行 trim ---
50
+ * @param post
51
+ */
23
52
  export declare function trimPost(post: Record<string, types.Json>): void;
53
+ /**
54
+ * --- 获取 formdata 的 post ---
55
+ * @param req 请求头
56
+ * @param events 文件处理情况
57
+ */
24
58
  export declare function getFormData(req: http2.Http2ServerRequest | http.IncomingMessage, events?: {
25
59
  onfilestart?: (name: string) => boolean | undefined;
26
60
  onfiledata?: (chunk: Buffer) => void;