@maiyunnet/kebab 3.1.4 → 3.1.6
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 +147 -1
- package/index.js +2 -1
- package/lib/core.d.ts +5 -5
- package/lib/core.js +1 -1
- package/lib/db.d.ts +12 -12
- package/lib/db.js +0 -1
- package/lib/jwt.d.ts +8 -8
- package/lib/jwt.js +0 -1
- package/lib/kv.d.ts +41 -41
- package/lib/kv.js +0 -1
- package/lib/net/request.d.ts +5 -5
- package/lib/net/request.js +2 -2
- package/lib/net/response.d.ts +5 -5
- package/lib/net.d.ts +79 -62
- package/lib/net.js +20 -20
- package/lib/sql.d.ts +20 -20
- package/lib/sql.js +0 -5
- package/lib/text.d.ts +9 -4
- package/lib/text.js +3 -3
- package/lib/ws.d.ts +8 -7
- package/lib/ws.js +0 -1
- package/lib/zip.d.ts +55 -11
- package/package.json +5 -4
- package/sys/child.js +1 -1
- package/sys/ctr.d.ts +24 -24
- package/sys/ctr.js +15 -15
- package/sys/mod.d.ts +40 -26
- package/sys/mod.js +1 -1
- package/sys/route.d.ts +7 -7
- package/sys/route.js +2 -2
- package/www/example/ctr/main.d.ts +2 -2
- package/www/example/ctr/main.js +2 -2
- package/www/example/ctr/middle.d.ts +4 -4
- package/www/example/ctr/middle.js +2 -2
- package/www/example/ctr/test.d.ts +24 -24
- package/www/example/ctr/test.js +2 -2
- package/www/example/mod/test.d.ts +2 -2
- package/www/example/ws/test.js +1 -0
- package/types/index.d.ts +0 -284
package/types/index.d.ts
DELETED
|
@@ -1,284 +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
|
-
'miniprogram': '' | 'wechat';
|
|
166
|
-
'https': boolean;
|
|
167
|
-
'host': string;
|
|
168
|
-
'hostname': string;
|
|
169
|
-
'hostport': number;
|
|
170
|
-
'uri': IUrlParse;
|
|
171
|
-
|
|
172
|
-
// --- 服务端用的路径 ---
|
|
173
|
-
|
|
174
|
-
'rootPath': string;
|
|
175
|
-
'modPath': string;
|
|
176
|
-
'ctrPath': string;
|
|
177
|
-
'viewPath': string;
|
|
178
|
-
'dataPath': string;
|
|
179
|
-
'wsPath': string;
|
|
180
|
-
|
|
181
|
-
// --- 前端用的路径 ---
|
|
182
|
-
|
|
183
|
-
'urlBase': string;
|
|
184
|
-
'urlStc': string;
|
|
185
|
-
'urlFull': string;
|
|
186
|
-
'urlStcFull': string;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** --- http headers --- */
|
|
190
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
191
|
-
export type THttpHeaders = http.IncomingHttpHeaders & {
|
|
192
|
-
'http-version'?: '1.1' | '2.0';
|
|
193
|
-
'http-code'?: number;
|
|
194
|
-
'http-url'?: string;
|
|
195
|
-
};
|
|
196
|
-
/* eslint-enable */
|
|
197
|
-
|
|
198
|
-
/** --- Net Cookie 对象 --- */
|
|
199
|
-
export interface ICookie {
|
|
200
|
-
'name': string;
|
|
201
|
-
'value': string;
|
|
202
|
-
/** --- 有效期秒级时间戳 --- */
|
|
203
|
-
'exp': number;
|
|
204
|
-
'path': string;
|
|
205
|
-
'domain': string;
|
|
206
|
-
'secure': boolean;
|
|
207
|
-
'httponly': boolean;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface IUrlParse {
|
|
211
|
-
'protocol': string | null;
|
|
212
|
-
'auth': string | null;
|
|
213
|
-
'user': string | null;
|
|
214
|
-
'pass': string | null;
|
|
215
|
-
'host': string | null;
|
|
216
|
-
'hostname': string | null;
|
|
217
|
-
'port': string | null;
|
|
218
|
-
'pathname': string;
|
|
219
|
-
'path': string | null;
|
|
220
|
-
'query': string | null;
|
|
221
|
-
'hash': string | null;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export interface IModUnionItem {
|
|
225
|
-
'field': string;
|
|
226
|
-
'where'?: any;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// -------------------------
|
|
230
|
-
// -------- zip lib --------
|
|
231
|
-
// -------------------------
|
|
232
|
-
|
|
233
|
-
export interface IZipItem {
|
|
234
|
-
'name': string;
|
|
235
|
-
'compressedSize': number;
|
|
236
|
-
'uncompressedSize': number;
|
|
237
|
-
'date': Date;
|
|
238
|
-
'isFile': boolean;
|
|
239
|
-
'isDirectory': boolean;
|
|
240
|
-
'path': string;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export interface IZipStats {
|
|
244
|
-
'compressedSize': number;
|
|
245
|
-
'uncompressedSize': number;
|
|
246
|
-
'date': Date;
|
|
247
|
-
'isFile': boolean;
|
|
248
|
-
'isDirectory': boolean;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export interface IZipOutputByType {
|
|
252
|
-
'base64': string;
|
|
253
|
-
'string': string;
|
|
254
|
-
'text': string;
|
|
255
|
-
'binarystring': string;
|
|
256
|
-
'array': number[];
|
|
257
|
-
'uint8array': Uint8Array;
|
|
258
|
-
'arraybuffer': ArrayBuffer;
|
|
259
|
-
'blob': Blob;
|
|
260
|
-
'nodebuffer': Buffer;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export type TZipOutputType = keyof IZipOutputByType;
|
|
264
|
-
|
|
265
|
-
export interface IZipInputByType {
|
|
266
|
-
'base64': string;
|
|
267
|
-
'string': string;
|
|
268
|
-
'text': string;
|
|
269
|
-
'binarystring': string;
|
|
270
|
-
'array': number[];
|
|
271
|
-
'uint8array': Uint8Array;
|
|
272
|
-
'arraybuffer': ArrayBuffer;
|
|
273
|
-
'blob': Blob;
|
|
274
|
-
'nodebuffer': Buffer;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export type TZipInputType = keyof IZipInputByType;
|
|
278
|
-
|
|
279
|
-
export type TZipInputFileFormat = IZipInputByType[keyof IZipInputByType];
|
|
280
|
-
|
|
281
|
-
export interface IZipMetadata {
|
|
282
|
-
'percent': number;
|
|
283
|
-
'currentFile': string | null;
|
|
284
|
-
}
|