@maiyunnet/kebab 2.0.2 → 2.0.4

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 (49) hide show
  1. package/index.js +1 -1
  2. package/lib/sql.js +1 -3
  3. package/lib/text.js +5 -1
  4. package/package.json +1 -1
  5. package/tsconfig.json +1 -1
  6. package/index.ts +0 -33
  7. package/lib/buffer.ts +0 -152
  8. package/lib/captcha.ts +0 -63
  9. package/lib/consistent.ts +0 -219
  10. package/lib/core.ts +0 -880
  11. package/lib/crypto.ts +0 -384
  12. package/lib/db.ts +0 -719
  13. package/lib/dns.ts +0 -405
  14. package/lib/fs.ts +0 -527
  15. package/lib/jwt.ts +0 -276
  16. package/lib/kv.ts +0 -1489
  17. package/lib/lan.ts +0 -87
  18. package/lib/net/formdata.ts +0 -166
  19. package/lib/net/request.ts +0 -150
  20. package/lib/net/response.ts +0 -59
  21. package/lib/net.ts +0 -662
  22. package/lib/s3.ts +0 -235
  23. package/lib/scan.ts +0 -364
  24. package/lib/session.ts +0 -230
  25. package/lib/sql.ts +0 -1151
  26. package/lib/ssh/sftp.ts +0 -508
  27. package/lib/ssh/shell.ts +0 -123
  28. package/lib/ssh.ts +0 -191
  29. package/lib/text.ts +0 -615
  30. package/lib/time.ts +0 -254
  31. package/lib/ws.ts +0 -523
  32. package/lib/zip.ts +0 -447
  33. package/lib/zlib.ts +0 -350
  34. package/main.ts +0 -27
  35. package/sys/child.ts +0 -678
  36. package/sys/cmd.ts +0 -225
  37. package/sys/ctr.ts +0 -904
  38. package/sys/master.ts +0 -355
  39. package/sys/mod.ts +0 -1871
  40. package/sys/route.ts +0 -1113
  41. package/types/index.d.ts +0 -283
  42. package/www/example/ctr/main.ts +0 -9
  43. package/www/example/ctr/middle.ts +0 -26
  44. package/www/example/ctr/test.ts +0 -3218
  45. package/www/example/mod/test.ts +0 -47
  46. package/www/example/mod/testdata.ts +0 -30
  47. package/www/example/ws/mproxy.ts +0 -16
  48. package/www/example/ws/rproxy.ts +0 -14
  49. package/www/example/ws/test.ts +0 -36
package/types/index.d.ts DELETED
@@ -1,283 +0,0 @@
1
- /**
2
- * Project: Kebab, User: JianSuoQiYue
3
- * Date: 2022-07-22 13:44:12
4
- * Last: 2022-07-22 13:44:12, 2023-5-2 21:12:32, 2023-12-14 11:43:09
5
- */
6
- import * as http from 'http';
7
-
8
- /* eslint-disable @typescript-eslint/no-explicit-any */
9
-
10
- /** --- 除非确定是不可知的 Json,否则不能使用 --- */
11
- export type Json = any;
12
-
13
- /* eslint-enable */
14
-
15
- /** --- 数据库值的类型 --- */
16
- export type DbValue = string | number | null | Record<string, Json>;
17
-
18
- /** --- mod ls 对象 --- */
19
- export declare class Rows<T> implements Iterable<T> {
20
-
21
- /** --- 总行数 --- */
22
- public get length(): number;
23
-
24
- /** --- 通过索引获取一个对象 --- */
25
- public item(index: number): T;
26
-
27
- /** --- 转换为数组对象 --- */
28
- public toArray(): Array<Record<string, DbValue>>;
29
-
30
- public [Symbol.iterator](): Iterator<T>;
31
-
32
- }
33
-
34
- /** --- 虚拟机配置对象 --- */
35
- export interface IVhost {
36
- readonly 'name': string;
37
- readonly 'domains': string[];
38
- readonly 'root': string;
39
- readonly 'remark': string;
40
- }
41
-
42
- /** --- 上传的文件信息对象 --- */
43
- export interface IPostFile {
44
- readonly 'name': string;
45
- readonly 'origin': string;
46
- readonly 'size': number;
47
- readonly 'path': string;
48
- }
49
-
50
- /** --- 动态目录配置文件 --- */
51
- export interface IConfig {
52
- 'set': {
53
- 'timezone': number;
54
- 'mustHttps': boolean;
55
- 'cacheTtl': number;
56
-
57
- 'staticVer': string;
58
- 'staticPath': string;
59
- 'staticPathFull': string;
60
-
61
- [key: string]: Json;
62
- };
63
- 'const': IConfigConst;
64
- 'db': IConfigDb;
65
- 'jwt': IConfigJwt;
66
- 'kv': IConfigKv;
67
- 'route': Record<string, string>;
68
- 'session': {
69
- 'name': string;
70
- 'ttl': number;
71
- 'ssl': boolean;
72
- };
73
- 'sql': IConfigSql;
74
- 'dns': Record<string, IConfigDns>;
75
- 'lang': IConfigLang;
76
- 's3': Record<string, IConfigS3>;
77
- 'turnstile': IConfigTurnstile;
78
-
79
- [key: string]: Record<string, Json>;
80
- }
81
-
82
- /** --- 动配数据库 --- */
83
- export interface IConfigLang {
84
- 'list': string[];
85
- 'direct': string[];
86
- }
87
-
88
- /** --- 动配对象存储信息 --- */
89
- export interface IConfigS3 {
90
- /** --- cf r2 要用 --- */
91
- 'account'?: string;
92
- 'sid': string;
93
- 'skey': string;
94
- 'region': string;
95
- 'bucket': string;
96
- }
97
-
98
- /** --- 动配对象存储信息 --- */
99
- export interface IConfigTurnstile {
100
- 'CF': {
101
- 'sid': string;
102
- 'skey': string;
103
- },
104
- 'TENCENT': {
105
- 'sid': string;
106
- 'skey': string;
107
- 'aid': string;
108
- 'akey': string;
109
- }
110
- }
111
-
112
- /** --- 动配数据库 --- */
113
- export interface IConfigDb {
114
- 'host': string;
115
- 'port': number;
116
- 'charset': string;
117
- 'name': string;
118
-
119
- 'user': string;
120
- 'pwd': string;
121
- }
122
-
123
- /** --- Jwt 信息 --- */
124
- export interface IConfigJwt {
125
- 'name': string;
126
- 'ttl': number;
127
- 'ssl': boolean;
128
- 'secret': string;
129
- 'auth': boolean;
130
- }
131
-
132
- /** --- DNS --- */
133
- export interface IConfigDns {
134
- 'sid': string;
135
- 'skey': string;
136
- }
137
-
138
- /** --- 动配 kv --- */
139
- export interface IConfigKv {
140
- 'host': string;
141
- 'port': number;
142
- 'index': number;
143
- 'pre': string;
144
-
145
- 'user': string;
146
- 'pwd': string;
147
- }
148
-
149
- /** --- 动配 sql --- */
150
- export interface IConfigSql {
151
- 'pre': string;
152
- }
153
-
154
- /** --- 动配常量 --- */
155
- export interface IConfigConst {
156
- 'path': string;
157
- 'qs': string;
158
- 'startTime': bigint;
159
- 'startMemory': number;
160
-
161
- // --- 环境判断 ---
162
-
163
- 'mobile': boolean;
164
- 'wechat': boolean;
165
- 'https': boolean;
166
- 'host': string;
167
- 'hostname': string;
168
- 'hostport': number;
169
- 'uri': IUrlParse;
170
-
171
- // --- 服务端用的路径 ---
172
-
173
- 'rootPath': string;
174
- 'modPath': string;
175
- 'ctrPath': string;
176
- 'viewPath': string;
177
- 'dataPath': string;
178
- 'wsPath': string;
179
-
180
- // --- 前端用的路径 ---
181
-
182
- 'urlBase': string;
183
- 'urlStc': string;
184
- 'urlFull': string;
185
- 'urlStcFull': string;
186
- }
187
-
188
- /** --- http headers --- */
189
- /* eslint-disable @typescript-eslint/naming-convention */
190
- export type THttpHeaders = http.IncomingHttpHeaders & {
191
- 'http-version'?: '1.1' | '2.0';
192
- 'http-code'?: number;
193
- 'http-url'?: string;
194
- };
195
- /* eslint-enable */
196
-
197
- /** --- Net Cookie 对象 --- */
198
- export interface ICookie {
199
- 'name': string;
200
- 'value': string;
201
- /** --- 有效期秒级时间戳 --- */
202
- 'exp': number;
203
- 'path': string;
204
- 'domain': string;
205
- 'secure': boolean;
206
- 'httponly': boolean;
207
- }
208
-
209
- export interface IUrlParse {
210
- 'protocol': string | null;
211
- 'auth': string | null;
212
- 'user': string | null;
213
- 'pass': string | null;
214
- 'host': string | null;
215
- 'hostname': string | null;
216
- 'port': string | null;
217
- 'pathname': string;
218
- 'path': string | null;
219
- 'query': string | null;
220
- 'hash': string | null;
221
- }
222
-
223
- export interface IModUnionItem {
224
- 'field': string;
225
- 'where'?: any;
226
- }
227
-
228
- // -------------------------
229
- // -------- zip lib --------
230
- // -------------------------
231
-
232
- export interface IZipItem {
233
- 'name': string;
234
- 'compressedSize': number;
235
- 'uncompressedSize': number;
236
- 'date': Date;
237
- 'isFile': boolean;
238
- 'isDirectory': boolean;
239
- 'path': string;
240
- }
241
-
242
- export interface IZipStats {
243
- 'compressedSize': number;
244
- 'uncompressedSize': number;
245
- 'date': Date;
246
- 'isFile': boolean;
247
- 'isDirectory': boolean;
248
- }
249
-
250
- export interface IZipOutputByType {
251
- 'base64': string;
252
- 'string': string;
253
- 'text': string;
254
- 'binarystring': string;
255
- 'array': number[];
256
- 'uint8array': Uint8Array;
257
- 'arraybuffer': ArrayBuffer;
258
- 'blob': Blob;
259
- 'nodebuffer': Buffer;
260
- }
261
-
262
- export type TZipOutputType = keyof IZipOutputByType;
263
-
264
- export interface IZipInputByType {
265
- 'base64': string;
266
- 'string': string;
267
- 'text': string;
268
- 'binarystring': string;
269
- 'array': number[];
270
- 'uint8array': Uint8Array;
271
- 'arraybuffer': ArrayBuffer;
272
- 'blob': Blob;
273
- 'nodebuffer': Buffer;
274
- }
275
-
276
- export type TZipInputType = keyof IZipInputByType;
277
-
278
- export type TZipInputFileFormat = IZipInputByType[keyof IZipInputByType];
279
-
280
- export interface IZipMetadata {
281
- 'percent': number;
282
- 'currentFile': string | null;
283
- }
@@ -1,9 +0,0 @@
1
- import * as ctr from '~/sys/ctr';
2
-
3
- export default class extends ctr.Ctr {
4
-
5
- public index(): string {
6
- return `<a href="${this._config.const.urlBase}test">Hello world! Click here to visit demo.</a>`;
7
- }
8
-
9
- }
@@ -1,26 +0,0 @@
1
- import * as ctr from '~/sys/ctr';
2
- import * as types from '~/types';
3
-
4
- export default class extends ctr.Ctr {
5
-
6
- public onLoad(): string | boolean {
7
- if (this._config.const.path !== 'test/middle') {
8
- return true;
9
- }
10
- return '_action: ' + this._action + "<br><br>In fact, the middle method does not exist in the test controller, which uses Kebab's middle structure to preprocess requests.";
11
- }
12
-
13
- public onUnload(rtn: string | boolean | types.DbValue[]): string | boolean | types.DbValue[] {
14
- if (!Array.isArray(rtn)) {
15
- return rtn;
16
- }
17
- if (rtn[0] !== -101) {
18
- return rtn;
19
- }
20
- rtn.push({
21
- 'middle': 'unload'
22
- });
23
- return rtn;
24
- }
25
-
26
- }