egg 4.1.0-beta.34 → 4.1.0-beta.36
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/dist/agent.d.ts +7 -3
- package/dist/agent.js +10 -6
- package/dist/ajv.d.ts +1 -1
- package/dist/ajv.js +3 -2
- package/dist/aop.d.ts +1 -1
- package/dist/aop.js +3 -2
- package/dist/app/extend/context.d.ts +181 -178
- package/dist/app/extend/context.js +244 -259
- package/dist/app/extend/helper.d.ts +40 -35
- package/dist/app/extend/helper.js +45 -41
- package/dist/app/extend/request.d.ts +135 -131
- package/dist/app/extend/request.js +219 -258
- package/dist/app/extend/response.d.ts +28 -24
- package/dist/app/extend/response.js +36 -34
- package/dist/app/middleware/body_parser.d.ts +2 -2
- package/dist/app/middleware/body_parser.js +7 -3
- package/dist/app/middleware/meta.d.ts +8 -8
- package/dist/app/middleware/meta.js +15 -18
- package/dist/app/middleware/notfound.d.ts +8 -5
- package/dist/app/middleware/notfound.js +25 -28
- package/dist/app/middleware/override_method.d.ts +2 -2
- package/dist/app/middleware/override_method.js +7 -3
- package/dist/app/middleware/site_file.d.ts +11 -7
- package/dist/app/middleware/site_file.js +37 -52
- package/dist/config/config.default.d.ts +11 -6
- package/dist/config/config.default.js +258 -375
- package/dist/config/config.local.d.ts +6 -3
- package/dist/config/config.local.js +7 -8
- package/dist/config/config.unittest.d.ts +6 -3
- package/dist/config/config.unittest.js +10 -8
- package/dist/config/plugin.d.ts +6 -2
- package/dist/config/plugin.js +67 -131
- package/dist/dal.d.ts +1 -1
- package/dist/dal.js +3 -2
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +3 -2
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +3 -2
- package/dist/index.d.ts +24 -106
- package/dist/index.js +23 -89
- package/dist/lib/agent.d.ts +21 -15
- package/dist/lib/agent.js +53 -45
- package/dist/lib/application.d.ts +60 -54
- package/dist/lib/application.js +200 -250
- package/dist/lib/core/base_context_class.d.ts +23 -17
- package/dist/lib/core/base_context_class.js +17 -15
- package/dist/lib/core/base_context_logger.d.ts +39 -35
- package/dist/lib/core/base_context_logger.js +58 -60
- package/dist/lib/core/base_hook_class.d.ts +18 -11
- package/dist/lib/core/base_hook_class.js +26 -22
- package/dist/lib/core/context_httpclient.d.ts +21 -16
- package/dist/lib/core/context_httpclient.js +29 -26
- package/dist/lib/core/httpclient.d.ts +14 -12
- package/dist/lib/core/httpclient.js +34 -37
- package/dist/lib/core/logger.d.ts +7 -3
- package/dist/lib/core/logger.js +30 -36
- package/dist/lib/core/messenger/IMessenger.d.ts +53 -49
- package/dist/lib/core/messenger/IMessenger.js +1 -2
- package/dist/lib/core/messenger/base.d.ts +11 -7
- package/dist/lib/core/messenger/base.js +30 -29
- package/dist/lib/core/messenger/index.d.ts +10 -6
- package/dist/lib/core/messenger/index.js +11 -8
- package/dist/lib/core/messenger/ipc.d.ts +62 -57
- package/dist/lib/core/messenger/ipc.js +126 -138
- package/dist/lib/core/messenger/local.d.ts +63 -58
- package/dist/lib/core/messenger/local.js +126 -131
- package/dist/lib/core/utils.d.ts +5 -2
- package/dist/lib/core/utils.js +44 -66
- package/dist/lib/define.d.ts +72 -67
- package/dist/lib/define.js +54 -53
- package/dist/lib/egg.d.ts +283 -281
- package/dist/lib/egg.js +512 -573
- package/dist/lib/error/CookieLimitExceedError.d.ts +7 -4
- package/dist/lib/error/CookieLimitExceedError.js +15 -12
- package/dist/lib/error/MessageUnhandledRejectionError.d.ts +7 -4
- package/dist/lib/error/MessageUnhandledRejectionError.js +15 -12
- package/dist/lib/error/index.d.ts +3 -2
- package/dist/lib/error/index.js +4 -3
- package/dist/lib/loader/AgentWorkerLoader.d.ts +15 -10
- package/dist/lib/loader/AgentWorkerLoader.js +22 -18
- package/dist/lib/loader/AppWorkerLoader.d.ts +20 -15
- package/dist/lib/loader/AppWorkerLoader.js +35 -37
- package/dist/lib/loader/EggApplicationLoader.d.ts +7 -3
- package/dist/lib/loader/EggApplicationLoader.js +7 -4
- package/dist/lib/loader/index.d.ts +4 -3
- package/dist/lib/loader/index.js +5 -4
- package/dist/lib/start.d.ts +24 -20
- package/dist/lib/start.js +32 -42
- package/dist/lib/types.d.ts +288 -286
- package/dist/lib/types.js +2 -2
- package/dist/lib/types.plugin.d.ts +21 -21
- package/dist/lib/types.plugin.js +23 -24
- package/dist/orm.d.ts +1 -1
- package/dist/orm.js +3 -2
- package/dist/schedule.d.ts +2 -2
- package/dist/schedule.js +5 -5
- package/dist/transaction.d.ts +1 -1
- package/dist/transaction.js +3 -2
- package/dist/urllib.d.ts +1 -1
- package/dist/urllib.js +3 -2
- package/package.json +60 -64
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,306 +1,308 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { MetaMiddlewareOptions } from "../app/middleware/meta.js";
|
|
2
|
+
import { NotFoundMiddlewareOptions } from "../app/middleware/notfound.js";
|
|
3
|
+
import { SiteFileMiddlewareOptions } from "../app/middleware/site_file.js";
|
|
4
|
+
import "./types.plugin.js";
|
|
5
|
+
import Context$1 from "../app/extend/context.js";
|
|
6
|
+
import "./egg.js";
|
|
7
|
+
import { Application } from "./application.js";
|
|
8
|
+
import { EggAppConfig as EggAppConfig$1, EggAppInfo, FileLoaderOptions } from "@eggjs/core";
|
|
9
|
+
import { EggLoggerOptions, EggLoggersOptions } from "egg-logger";
|
|
10
|
+
import { RequestOptions } from "urllib";
|
|
11
|
+
import { Socket } from "node:net";
|
|
12
|
+
import { PartialDeep } from "type-fest";
|
|
13
|
+
|
|
14
|
+
//#region src/lib/types.d.ts
|
|
15
|
+
type IgnoreItem = string | RegExp | ((ctx: Context$1) => boolean);
|
|
14
16
|
type IgnoreOrMatch = IgnoreItem | IgnoreItem[];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
interface ClientErrorResponse {
|
|
18
|
+
body: string | Buffer;
|
|
19
|
+
status: number;
|
|
20
|
+
headers: {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
21
23
|
}
|
|
22
24
|
/** egg env type */
|
|
23
|
-
|
|
25
|
+
type EggEnvType = "local" | "unittest" | "prod" | string;
|
|
24
26
|
/** logger config of egg */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
interface EggLoggerConfig extends Omit<EggLoggersOptions, "type"> {
|
|
28
|
+
/** custom config of coreLogger */
|
|
29
|
+
coreLogger?: Partial<EggLoggerOptions>;
|
|
30
|
+
/** allow debug log at prod, defaults to `false` */
|
|
31
|
+
allowDebugAtProd?: boolean;
|
|
32
|
+
/** disable logger console after app ready. defaults to `false` on local and unittest env, others is `true`. */
|
|
33
|
+
disableConsoleAfterReady?: boolean;
|
|
34
|
+
/** [deprecated] Defaults to `true`. */
|
|
35
|
+
enablePerformanceTimer?: boolean;
|
|
36
|
+
/** using the app logger instead of EggContextLogger, defaults to `false` */
|
|
37
|
+
enableFastContextLogger?: boolean;
|
|
36
38
|
}
|
|
37
39
|
/** Custom Loader Configuration */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
interface CustomLoaderConfig extends Omit<FileLoaderOptions, "inject" | "target"> {
|
|
41
|
+
/**
|
|
42
|
+
* an object you wanner load to, value can only be 'ctx' or 'app'. default to app
|
|
43
|
+
*/
|
|
44
|
+
inject?: "ctx" | "app";
|
|
45
|
+
/**
|
|
46
|
+
* whether need to load files in plugins or framework, default to false
|
|
47
|
+
*/
|
|
48
|
+
loadunit?: boolean;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
interface HttpClientConfig {
|
|
51
|
+
/** Request timeout */
|
|
52
|
+
timeout?: number;
|
|
53
|
+
/** Default request args for httpclient */
|
|
54
|
+
request?: RequestOptions;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated keep compatible with egg 3.x, no more used
|
|
57
|
+
*/
|
|
58
|
+
useHttpClientNext?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Allow http2
|
|
61
|
+
*/
|
|
62
|
+
allowH2?: boolean;
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
ignore?: IgnoreOrMatch;
|
|
110
|
-
match?: IgnoreOrMatch;
|
|
111
|
-
enableTypes?: string[];
|
|
112
|
-
extendTypes?: {
|
|
113
|
-
json: string[];
|
|
114
|
-
form: string[];
|
|
115
|
-
text: string[];
|
|
116
|
-
};
|
|
117
|
-
/** Default is `'error'`, it will return `400` response when `Prototype-Poisoning` happen. */
|
|
118
|
-
onProtoPoisoning: 'error' | 'remove' | 'ignore';
|
|
119
|
-
onerror(err: any, ctx: Context): void;
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* logger options
|
|
123
|
-
* @member Config#logger
|
|
124
|
-
* @property {String} dir - directory of log files
|
|
125
|
-
* @property {String} encoding - log file encoding, defaults to utf8
|
|
126
|
-
* @property {String} level - default log level, could be: DEBUG, INFO, WARN, ERROR or NONE, defaults to INFO in production
|
|
127
|
-
* @property {String} consoleLevel - log level of stdout, defaults to `INFO` in local serverEnv, defaults to `WARN` in unittest, others is `NONE`
|
|
128
|
-
* @property {Boolean} disableConsoleAfterReady - disable logger console after app ready. defaults to `false` on local and unittest env, others is `true`.
|
|
129
|
-
* @property {Boolean} outputJSON - log as JSON or not, defaults to `false`
|
|
130
|
-
* @property {Boolean} buffer - if enabled, flush logs to disk at a certain frequency to improve performance, defaults to true
|
|
131
|
-
* @property {String} errorLogName - file name of errorLogger
|
|
132
|
-
* @property {String} coreLogName - file name of coreLogger
|
|
133
|
-
* @property {String} agentLogName - file name of agent worker log
|
|
134
|
-
* @property {Object} coreLogger - custom config of coreLogger
|
|
135
|
-
* @property {Boolean} allowDebugAtProd - allow debug log at prod, defaults to false
|
|
136
|
-
* @property {Boolean} enableFastContextLogger - using the app logger instead of EggContextLogger, defaults to false
|
|
137
|
-
*/
|
|
138
|
-
logger: EggLoggerConfig;
|
|
139
|
-
/** custom logger of egg */
|
|
140
|
-
customLogger: {
|
|
141
|
-
[key: string]: EggLoggerOptions;
|
|
142
|
-
};
|
|
143
|
-
/** Configuration of httpclient in egg. */
|
|
144
|
-
httpclient: HttpClientConfig;
|
|
145
|
-
/**
|
|
146
|
-
* customLoader config
|
|
147
|
-
*/
|
|
148
|
-
/**
|
|
149
|
-
* It will ignore special keys when dumpConfig
|
|
150
|
-
*/
|
|
151
|
-
dump: {
|
|
152
|
-
ignore: Set<string | RegExp>;
|
|
153
|
-
timing: {
|
|
154
|
-
slowBootActionMinDuration: number;
|
|
155
|
-
};
|
|
65
|
+
* Powerful Partial, Support adding ? modifier to a mapped property in deep level
|
|
66
|
+
* @example
|
|
67
|
+
* import { PowerPartial, EggAppConfig } from 'egg';
|
|
68
|
+
*
|
|
69
|
+
* // { view: { defaultEngines: string } } => { view?: { defaultEngines?: string } }
|
|
70
|
+
* type EggConfig = PowerPartial<EggAppConfig>
|
|
71
|
+
*
|
|
72
|
+
* @deprecated use `PartialDeep` instead
|
|
73
|
+
*/
|
|
74
|
+
type PowerPartial<T> = PartialDeep<T>;
|
|
75
|
+
interface EggAppConfig extends EggAppConfig$1 {
|
|
76
|
+
workerStartTimeout: number;
|
|
77
|
+
baseDir: string;
|
|
78
|
+
middleware: string[];
|
|
79
|
+
coreMiddleware: string[];
|
|
80
|
+
/**
|
|
81
|
+
* The option of `bodyParser` middleware
|
|
82
|
+
*
|
|
83
|
+
* @member Config#bodyParser
|
|
84
|
+
* @property {Boolean} enable - enable bodyParser or not, default to true
|
|
85
|
+
* @property {String | RegExp | Function | Array} ignore - won't parse request body when url path hit ignore pattern, can not set `ignore` when `match` presented
|
|
86
|
+
* @property {String | RegExp | Function | Array} match - will parse request body only when url path hit match pattern
|
|
87
|
+
* @property {String} encoding - body encoding config, default utf8
|
|
88
|
+
* @property {String} formLimit - form body size limit, default 1mb
|
|
89
|
+
* @property {String} jsonLimit - json body size limit, default 1mb
|
|
90
|
+
* @property {String} textLimit - json body size limit, default 1mb
|
|
91
|
+
* @property {Boolean} strict - json body strict mode, if set strict value true, then only receive object and array json body
|
|
92
|
+
* @property {Number} queryString.arrayLimit - from item array length limit, default 100
|
|
93
|
+
* @property {Number} queryString.depth - json value deep length, default 5
|
|
94
|
+
* @property {Number} queryString.parameterLimit - parameter number limit, default 1000
|
|
95
|
+
* @property {String[]} enableTypes - parser will only parse when request type hits enableTypes, default is ['json', 'form']
|
|
96
|
+
* @property {Object} extendTypes - support extend types
|
|
97
|
+
* @property {String} onProtoPoisoning - Defines what action must take when parsing a JSON object with `__proto__`. Possible values are `'error'`, `'remove'` and `'ignore'`. Default is `'error'`, it will return `400` response when `Prototype-Poisoning` happen.
|
|
98
|
+
*/
|
|
99
|
+
bodyParser: {
|
|
100
|
+
enable: boolean;
|
|
101
|
+
encoding: string;
|
|
102
|
+
formLimit: string;
|
|
103
|
+
jsonLimit: string;
|
|
104
|
+
textLimit: string;
|
|
105
|
+
strict: boolean;
|
|
106
|
+
queryString: {
|
|
107
|
+
arrayLimit: number;
|
|
108
|
+
depth: number;
|
|
109
|
+
parameterLimit: number;
|
|
156
110
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
HOME: string;
|
|
165
|
-
hostHeaders: string;
|
|
166
|
-
/**
|
|
167
|
-
* Detect request' ip from specified headers, not case-sensitive. Only worked when config.proxy set to true.
|
|
168
|
-
*/
|
|
169
|
-
ipHeaders: string;
|
|
170
|
-
protocolHeaders: string;
|
|
171
|
-
maxProxyCount: number;
|
|
172
|
-
maxIpsCount: number;
|
|
173
|
-
proxy: boolean;
|
|
174
|
-
cookies: {
|
|
175
|
-
sameSite?: string;
|
|
176
|
-
httpOnly?: boolean;
|
|
111
|
+
ignore?: IgnoreOrMatch;
|
|
112
|
+
match?: IgnoreOrMatch;
|
|
113
|
+
enableTypes?: string[];
|
|
114
|
+
extendTypes?: {
|
|
115
|
+
json: string[];
|
|
116
|
+
form: string[];
|
|
117
|
+
text: string[];
|
|
177
118
|
};
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
119
|
+
/** Default is `'error'`, it will return `400` response when `Prototype-Poisoning` happen. */
|
|
120
|
+
onProtoPoisoning: "error" | "remove" | "ignore";
|
|
121
|
+
onerror(err: any, ctx: Context$1): void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* logger options
|
|
125
|
+
* @member Config#logger
|
|
126
|
+
* @property {String} dir - directory of log files
|
|
127
|
+
* @property {String} encoding - log file encoding, defaults to utf8
|
|
128
|
+
* @property {String} level - default log level, could be: DEBUG, INFO, WARN, ERROR or NONE, defaults to INFO in production
|
|
129
|
+
* @property {String} consoleLevel - log level of stdout, defaults to `INFO` in local serverEnv, defaults to `WARN` in unittest, others is `NONE`
|
|
130
|
+
* @property {Boolean} disableConsoleAfterReady - disable logger console after app ready. defaults to `false` on local and unittest env, others is `true`.
|
|
131
|
+
* @property {Boolean} outputJSON - log as JSON or not, defaults to `false`
|
|
132
|
+
* @property {Boolean} buffer - if enabled, flush logs to disk at a certain frequency to improve performance, defaults to true
|
|
133
|
+
* @property {String} errorLogName - file name of errorLogger
|
|
134
|
+
* @property {String} coreLogName - file name of coreLogger
|
|
135
|
+
* @property {String} agentLogName - file name of agent worker log
|
|
136
|
+
* @property {Object} coreLogger - custom config of coreLogger
|
|
137
|
+
* @property {Boolean} allowDebugAtProd - allow debug log at prod, defaults to false
|
|
138
|
+
* @property {Boolean} enableFastContextLogger - using the app logger instead of EggContextLogger, defaults to false
|
|
139
|
+
*/
|
|
140
|
+
logger: EggLoggerConfig;
|
|
141
|
+
/** custom logger of egg */
|
|
142
|
+
customLogger: {
|
|
143
|
+
[key: string]: EggLoggerOptions;
|
|
144
|
+
};
|
|
145
|
+
/** Configuration of httpclient in egg. */
|
|
146
|
+
httpclient: HttpClientConfig;
|
|
147
|
+
/**
|
|
148
|
+
* customLoader config
|
|
149
|
+
*/
|
|
150
|
+
/**
|
|
151
|
+
* It will ignore special keys when dumpConfig
|
|
152
|
+
*/
|
|
153
|
+
dump: {
|
|
154
|
+
ignore: Set<string | RegExp>;
|
|
155
|
+
timing: {
|
|
156
|
+
slowBootActionMinDuration: number;
|
|
210
157
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The environment of egg
|
|
161
|
+
*/
|
|
162
|
+
env: EggEnvType;
|
|
163
|
+
/**
|
|
164
|
+
* The current HOME directory
|
|
165
|
+
*/
|
|
166
|
+
HOME: string;
|
|
167
|
+
hostHeaders: string;
|
|
168
|
+
/**
|
|
169
|
+
* Detect request' ip from specified headers, not case-sensitive. Only worked when config.proxy set to true.
|
|
170
|
+
*/
|
|
171
|
+
ipHeaders: string;
|
|
172
|
+
protocolHeaders: string;
|
|
173
|
+
maxProxyCount: number;
|
|
174
|
+
maxIpsCount: number;
|
|
175
|
+
proxy: boolean;
|
|
176
|
+
cookies: {
|
|
177
|
+
sameSite?: string;
|
|
178
|
+
httpOnly?: boolean;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* The key that signing cookies. It can contain multiple keys separated by `.`
|
|
182
|
+
* @requires Cookie secret key to sign and encrypt, see https://eggjs.org/core/cookie-and-session#cookie-secret-key
|
|
183
|
+
*/
|
|
184
|
+
keys: string;
|
|
185
|
+
/**
|
|
186
|
+
* The name of the application
|
|
187
|
+
*/
|
|
188
|
+
name: string;
|
|
189
|
+
/**
|
|
190
|
+
* package.json
|
|
191
|
+
*/
|
|
192
|
+
pkg: Record<string, any>;
|
|
193
|
+
rundir: string;
|
|
194
|
+
/**
|
|
195
|
+
* siteFile middleware options
|
|
196
|
+
*/
|
|
197
|
+
siteFile: SiteFileMiddlewareOptions;
|
|
198
|
+
/**
|
|
199
|
+
* meta middleware options
|
|
200
|
+
*/
|
|
201
|
+
meta: MetaMiddlewareOptions;
|
|
202
|
+
/**
|
|
203
|
+
* notfound middleware options
|
|
204
|
+
*/
|
|
205
|
+
notfound: NotFoundMiddlewareOptions;
|
|
206
|
+
/**
|
|
207
|
+
* overrideMethod middleware options
|
|
208
|
+
*/
|
|
209
|
+
overrideMethod: {
|
|
210
|
+
enable: boolean;
|
|
211
|
+
allowedMethods: string[];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* onClientError handler
|
|
215
|
+
*/
|
|
216
|
+
onClientError?(err: Error, socket: Socket, app: Application): ClientErrorResponse | Promise<ClientErrorResponse>;
|
|
217
|
+
/**
|
|
218
|
+
* server timeout in milliseconds, default to 0 (no timeout).
|
|
219
|
+
*
|
|
220
|
+
* for special request, just use `ctx.req.setTimeout(ms)`
|
|
221
|
+
*
|
|
222
|
+
* @see https://nodejs.org/api/http.html#http_server_timeout
|
|
223
|
+
*/
|
|
224
|
+
serverTimeout: number | null;
|
|
225
|
+
cluster: {
|
|
226
|
+
listen: {
|
|
227
|
+
path: string;
|
|
228
|
+
port: number;
|
|
229
|
+
hostname: string;
|
|
229
230
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
231
|
+
};
|
|
232
|
+
clusterClient: {
|
|
233
|
+
maxWaitTime: number;
|
|
234
|
+
responseTimeout: number;
|
|
235
|
+
};
|
|
236
|
+
[prop: string]: any;
|
|
235
237
|
}
|
|
236
|
-
|
|
238
|
+
type RequestObjectBody = Record<string, any>;
|
|
237
239
|
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
* plugin config item interface
|
|
241
|
+
*/
|
|
242
|
+
interface IEggPluginItem {
|
|
243
|
+
env?: EggEnvType[];
|
|
244
|
+
path?: string;
|
|
245
|
+
package?: string;
|
|
246
|
+
enable?: boolean;
|
|
245
247
|
}
|
|
246
|
-
|
|
248
|
+
type EggPluginItem = IEggPluginItem | boolean;
|
|
247
249
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
250
|
+
* build-in plugin list
|
|
251
|
+
*/
|
|
252
|
+
interface EggPlugin {
|
|
253
|
+
[key: string]: EggPluginItem | undefined;
|
|
254
|
+
onerror?: EggPluginItem;
|
|
255
|
+
session?: EggPluginItem;
|
|
256
|
+
i18n?: EggPluginItem;
|
|
257
|
+
watcher?: EggPluginItem;
|
|
258
|
+
multipart?: EggPluginItem;
|
|
259
|
+
security?: EggPluginItem;
|
|
260
|
+
development?: EggPluginItem;
|
|
261
|
+
logrotator?: EggPluginItem;
|
|
262
|
+
schedule?: EggPluginItem;
|
|
263
|
+
static?: EggPluginItem;
|
|
264
|
+
jsonp?: EggPluginItem;
|
|
265
|
+
view?: EggPluginItem;
|
|
264
266
|
}
|
|
265
267
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
268
|
+
* The empty interface `IService` is a placeholder, for egg
|
|
269
|
+
* to auto injection service to ctx.service
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
*
|
|
273
|
+
* import { Service } from 'egg';
|
|
274
|
+
* class FooService extends Service {
|
|
275
|
+
* async bar() {}
|
|
276
|
+
* }
|
|
277
|
+
*
|
|
278
|
+
* declare module 'egg' {
|
|
279
|
+
* export interface IService {
|
|
280
|
+
* foo: FooService;
|
|
281
|
+
* }
|
|
282
|
+
* }
|
|
283
|
+
*
|
|
284
|
+
* Now I can get ctx.service.foo at controller and other service file.
|
|
285
|
+
*/
|
|
286
|
+
interface IService extends Record<string, any> {}
|
|
286
287
|
/**
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
* The empty interface `IController` is a placeholder, for egg
|
|
289
|
+
* to auto injection controller to app.controller
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
*
|
|
293
|
+
* import { Controller } from 'egg';
|
|
294
|
+
* class HomeController extends Controller {
|
|
295
|
+
* async index() {}
|
|
296
|
+
* }
|
|
297
|
+
*
|
|
298
|
+
* declare module 'egg' {
|
|
299
|
+
* export interface IController {
|
|
300
|
+
* home: HomeController;
|
|
301
|
+
* }
|
|
302
|
+
* }
|
|
303
|
+
*
|
|
304
|
+
* Now I can get app.controller.home in the application.
|
|
305
|
+
*/
|
|
306
|
+
interface IController extends Record<string, any> {}
|
|
307
|
+
//#endregion
|
|
308
|
+
export { ClientErrorResponse, CustomLoaderConfig, EggAppConfig, type EggAppInfo, EggEnvType, EggLoggerConfig, EggPlugin, EggPluginItem, HttpClientConfig, IController, IEggPluginItem, IService, type PartialDeep, PowerPartial, RequestObjectBody };
|
package/dist/lib/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// import plugins types
|
|
2
1
|
import "./types.plugin.js";
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export { };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
1
|
+
import "@eggjs/development/types";
|
|
2
|
+
import "@eggjs/i18n/types";
|
|
3
|
+
import "@eggjs/jsonp/types";
|
|
4
|
+
import "@eggjs/logrotator/types";
|
|
5
|
+
import "@eggjs/multipart/types";
|
|
6
|
+
import "@eggjs/onerror/types";
|
|
7
|
+
import "@eggjs/schedule/types";
|
|
8
|
+
import "@eggjs/security/types";
|
|
9
|
+
import "@eggjs/session/types";
|
|
10
|
+
import "@eggjs/static/types";
|
|
11
|
+
import "@eggjs/view/types";
|
|
12
|
+
import "@eggjs/watcher/types";
|
|
13
|
+
import "@eggjs/ajv-plugin/types";
|
|
14
|
+
import "@eggjs/aop-plugin/types";
|
|
15
|
+
import "@eggjs/tegg-config/types";
|
|
16
|
+
import "@eggjs/controller-plugin/types";
|
|
17
|
+
import "@eggjs/dal-plugin/types";
|
|
18
|
+
import "@eggjs/eventbus-plugin/types";
|
|
19
|
+
import "@eggjs/orm-plugin/types";
|
|
20
|
+
import "@eggjs/schedule-plugin/types";
|
|
21
|
+
import "@eggjs/tegg-plugin/types";
|