egg 4.1.0-beta.35 → 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 +199 -249
- 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/egg.d.ts
CHANGED
|
@@ -1,284 +1,286 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { EggContextHttpClient as HttpClient, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse } from "./core/httpclient.js";
|
|
2
|
+
import { EggAppConfig as EggAppConfig$1 } from "./types.js";
|
|
3
|
+
import Response from "../app/extend/response.js";
|
|
4
|
+
import Request from "../app/extend/request.js";
|
|
5
|
+
import Context from "../app/extend/context.js";
|
|
6
|
+
import { EggApplicationLoader } from "./loader/EggApplicationLoader.js";
|
|
7
|
+
import "./loader/index.js";
|
|
8
|
+
import { Agent } from "./agent.js";
|
|
9
|
+
import { ContextHttpClient } from "./core/context_httpclient.js";
|
|
10
|
+
import { IMessenger } from "./core/messenger/IMessenger.js";
|
|
11
|
+
import "./core/messenger/index.js";
|
|
12
|
+
import { Application } from "./application.js";
|
|
13
|
+
import { BaseContextClass as BaseContextClass$1 } from "./core/base_context_class.js";
|
|
14
|
+
import { BaseHookClass } from "./core/base_hook_class.js";
|
|
15
|
+
import { EggCore, EggCoreOptions, ILifecycleBoot, MiddlewareFunc as MiddlewareFunc$1, Next, Router } from "@eggjs/core";
|
|
16
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
17
|
+
import { Cookies } from "@eggjs/cookies";
|
|
18
|
+
import { EggContextLogger, EggLogger, EggLoggers } from "egg-logger";
|
|
19
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
20
|
+
|
|
21
|
+
//#region src/lib/egg.d.ts
|
|
22
|
+
interface EggApplicationCoreOptions extends Omit<EggCoreOptions, "baseDir"> {
|
|
23
|
+
mode?: "cluster" | "single";
|
|
24
|
+
clusterPort?: number;
|
|
25
|
+
baseDir?: string;
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type EggContext = Context;
|
|
27
|
-
export type MiddlewareFunc<T extends Context = Context> = EggCoreMiddlewareFunc<T>;
|
|
28
|
-
export { Context, Router };
|
|
27
|
+
type EggContext = Context;
|
|
28
|
+
type MiddlewareFunc<T extends Context = Context> = MiddlewareFunc$1<T>;
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
30
|
+
* Based on koa's Application
|
|
31
|
+
* @see https://github.com/eggjs/egg-core
|
|
32
|
+
* @see https://github.com/eggjs/koa/blob/master/src/application.ts
|
|
33
|
+
* @augments EggCore
|
|
34
|
+
*/
|
|
35
|
+
declare class EggApplicationCore extends EggCore {
|
|
36
|
+
#private;
|
|
37
|
+
ctxStorage: AsyncLocalStorage<Context>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the current request context from AsyncLocalStorage.
|
|
40
|
+
* This provides access to the context object for the current request lifecycle.
|
|
41
|
+
* @returns {Context | undefined} The current request context, or undefined if not in a request scope.
|
|
42
|
+
*/
|
|
43
|
+
get currentContext(): Context | undefined;
|
|
44
|
+
ContextCookies: typeof Cookies;
|
|
45
|
+
ContextLogger: typeof EggContextLogger;
|
|
46
|
+
ContextHttpClient: typeof ContextHttpClient;
|
|
47
|
+
HttpClient: typeof HttpClient;
|
|
48
|
+
HttpClientNext: typeof HttpClient;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieve base context class
|
|
51
|
+
* @member {BaseContextClass} BaseContextClass
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
*/
|
|
54
|
+
BaseContextClass: typeof BaseContextClass$1;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieve base controller
|
|
57
|
+
* @member {Controller} Controller
|
|
58
|
+
* @since 1.0.0
|
|
59
|
+
*/
|
|
60
|
+
Controller: typeof BaseContextClass$1;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieve base service
|
|
63
|
+
* @member {Service} Service
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
*/
|
|
66
|
+
Service: typeof BaseContextClass$1;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve base subscription
|
|
69
|
+
* @member {Subscription} Subscription
|
|
70
|
+
* @since 2.12.0
|
|
71
|
+
*/
|
|
72
|
+
Subscription: typeof BaseContextClass$1;
|
|
73
|
+
/**
|
|
74
|
+
* Retrieve base context class
|
|
75
|
+
* @member {BaseHookClass} BaseHookClass
|
|
76
|
+
*/
|
|
77
|
+
BaseHookClass: typeof BaseHookClass;
|
|
78
|
+
/**
|
|
79
|
+
* Retrieve base boot
|
|
80
|
+
* @member {Boot}
|
|
81
|
+
* @alias BaseHookClass
|
|
82
|
+
*/
|
|
83
|
+
Boot: typeof BaseHookClass;
|
|
84
|
+
options: Required<EggApplicationCoreOptions>;
|
|
85
|
+
readonly messenger: IMessenger;
|
|
86
|
+
agent?: Agent;
|
|
87
|
+
application?: Application;
|
|
88
|
+
loader: EggApplicationLoader;
|
|
89
|
+
/**
|
|
90
|
+
* @class
|
|
91
|
+
* @param {Object} options
|
|
92
|
+
* - {Object} [type] - type of instance, Agent and Application both extend koa, type can determine what it is.
|
|
93
|
+
* - {String} [baseDir] - app root dir, default is `process.cwd()`
|
|
94
|
+
* - {Object} [plugins] - custom plugin config, use it in unittest
|
|
95
|
+
* - {String} [mode] - process mode, can be cluster / single, default is `cluster`
|
|
96
|
+
*/
|
|
97
|
+
constructor(options?: EggApplicationCoreOptions);
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated please use `options` property instead
|
|
100
|
+
*/
|
|
101
|
+
get _options(): Required<EggApplicationCoreOptions>;
|
|
102
|
+
protected loadConfig(): Promise<void>;
|
|
103
|
+
protected load(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Usage: new ApiClient({ cluster: app.cluster })
|
|
106
|
+
*/
|
|
107
|
+
get cluster(): (clientClass: unknown, options?: object) => any;
|
|
108
|
+
/**
|
|
109
|
+
* Wrap the Client with Leader/Follower Pattern
|
|
110
|
+
*
|
|
111
|
+
* @description almost the same as Agent.cluster API, the only different is that this method create Follower.
|
|
112
|
+
*
|
|
113
|
+
* @see https://github.com/node-modules/cluster-client
|
|
114
|
+
* @param {Function} clientClass - client class function
|
|
115
|
+
* @param {Object} [options]
|
|
116
|
+
* - {Boolean} [autoGenerate] - whether generate delegate rule automatically, default is true
|
|
117
|
+
* - {Function} [formatKey] - a method to transform the subscription info into a string,default is JSON.stringify
|
|
118
|
+
* - {Object} [transcode|JSON.stringify/parse]
|
|
119
|
+
* - {Function} encode - custom serialize method
|
|
120
|
+
* - {Function} decode - custom deserialize method
|
|
121
|
+
* - {Boolean} [isBroadcast] - whether broadcast subscription result to all followers or just one, default is true
|
|
122
|
+
* - {Number} [responseTimeout] - response timeout, default is 3 seconds
|
|
123
|
+
* - {Number} [maxWaitTime|30000] - leader startup max time, default is 30 seconds
|
|
124
|
+
* @return {ClientWrapper} wrapper
|
|
125
|
+
*/
|
|
126
|
+
clusterWrapper(clientClass: unknown, options?: object): any;
|
|
127
|
+
/**
|
|
128
|
+
* print the information when console.log(app)
|
|
129
|
+
* @return {Object} inspected app.
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
* @example
|
|
132
|
+
* ```js
|
|
133
|
+
* console.log(app);
|
|
134
|
+
* =>
|
|
135
|
+
* {
|
|
136
|
+
* name: 'mock-app',
|
|
137
|
+
* env: 'test',
|
|
138
|
+
* subdomainOffset: 2,
|
|
139
|
+
* config: '<egg config>',
|
|
140
|
+
* controller: '<egg controller>',
|
|
141
|
+
* service: '<egg service>',
|
|
142
|
+
* middlewares: '<egg middlewares>',
|
|
143
|
+
* urllib: '<egg urllib>',
|
|
144
|
+
* loggers: '<egg loggers>'
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
inspect(): any;
|
|
149
|
+
toJSON(): any;
|
|
150
|
+
/**
|
|
151
|
+
* http request helper base on {@link httpclient}, it will auto save httpclient log.
|
|
152
|
+
* Keep the same api with `httpclient.request(url, args)`.
|
|
153
|
+
*
|
|
154
|
+
* See https://github.com/node-modules/urllib#api-doc for more details.
|
|
155
|
+
*
|
|
156
|
+
* @param {String} url request url address.
|
|
157
|
+
* @param {Object} options
|
|
158
|
+
* - method {String} - Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'.
|
|
159
|
+
* - data {Object} - Data to be sent. Will be stringify automatically.
|
|
160
|
+
* - dataType {String} - String - Type of response data. Could be `text` or `json`.
|
|
161
|
+
* If it's `text`, the callback data would be a String.
|
|
162
|
+
* If it's `json`, the data of callback would be a parsed JSON Object.
|
|
163
|
+
* Default callback data would be a Buffer.
|
|
164
|
+
* - headers {Object} - Request headers.
|
|
165
|
+
* - timeout {Number} - Request timeout in milliseconds. Defaults to exports.TIMEOUT.
|
|
166
|
+
* Include remote server connecting timeout and response timeout.
|
|
167
|
+
* When timeout happen, will return ConnectionTimeout or ResponseTimeout.
|
|
168
|
+
* - auth {String} - `username:password` used in HTTP Basic Authorization.
|
|
169
|
+
* - followRedirect {Boolean} - follow HTTP 3xx responses as redirects. defaults to false.
|
|
170
|
+
* - gzip {Boolean} - let you get the res object when request connected, default false. alias customResponse
|
|
171
|
+
* - nestedQuerystring {Boolean} - urllib default use querystring to stringify form data which don't
|
|
172
|
+
* support nested object, will use qs instead of querystring to support nested object by set this option to true.
|
|
173
|
+
* - more options see https://github.com/node-modules/urllib
|
|
174
|
+
* @return {Object}
|
|
175
|
+
* - status {Number} - HTTP response status
|
|
176
|
+
* - headers {Object} - HTTP response headers
|
|
177
|
+
* - res {Object} - HTTP response meta
|
|
178
|
+
* - data {Object} - HTTP response body
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```js
|
|
182
|
+
* const result = await app.curl('http://example.com/foo.json', {
|
|
183
|
+
* method: 'GET',
|
|
184
|
+
* dataType: 'json',
|
|
185
|
+
* });
|
|
186
|
+
* console.log(result.status, result.headers, result.data);
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
curl<T = any>(url: HttpClientRequestURL, options?: HttpClientRequestOptions): Promise<HttpClientResponse<T>>;
|
|
190
|
+
/**
|
|
191
|
+
* Create a new HttpClient instance with custom options
|
|
192
|
+
* @param {Object} [options] HttpClient init options
|
|
193
|
+
*/
|
|
194
|
+
createHttpClient(options?: HttpClientOptions): HttpClient;
|
|
195
|
+
/**
|
|
196
|
+
* HttpClient instance
|
|
197
|
+
* @see https://github.com/node-modules/urllib
|
|
198
|
+
* @member {HttpClient}
|
|
199
|
+
*/
|
|
200
|
+
get httpClient(): HttpClient;
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated please use httpClient instead
|
|
203
|
+
* @alias httpClient
|
|
204
|
+
* @member {HttpClient}
|
|
205
|
+
*/
|
|
206
|
+
get httpclient(): HttpClient;
|
|
207
|
+
/**
|
|
208
|
+
* All loggers contain logger, coreLogger and customLogger
|
|
209
|
+
* @member {Object}
|
|
210
|
+
* @since 1.0.0
|
|
211
|
+
*/
|
|
212
|
+
get loggers(): EggLoggers;
|
|
213
|
+
/**
|
|
214
|
+
* Get logger by name, it's equal to app.loggers['name'],
|
|
215
|
+
* but you can extend it with your own logical.
|
|
216
|
+
* @param {String} name - logger name
|
|
217
|
+
* @return {Logger} logger
|
|
218
|
+
*/
|
|
219
|
+
getLogger(name: string): EggLogger;
|
|
220
|
+
/**
|
|
221
|
+
* application logger, log file is `$HOME/logs/{appname}/{appname}-web`
|
|
222
|
+
* @member {Logger}
|
|
223
|
+
* @since 1.0.0
|
|
224
|
+
*/
|
|
225
|
+
get logger(): EggLogger;
|
|
226
|
+
/**
|
|
227
|
+
* core logger for framework and plugins, log file is `$HOME/logs/{appname}/egg-web`
|
|
228
|
+
* @member {Logger}
|
|
229
|
+
* @since 1.0.0
|
|
230
|
+
*/
|
|
231
|
+
get coreLogger(): EggLogger;
|
|
232
|
+
_unhandledRejectionHandler(err: any): void;
|
|
233
|
+
/**
|
|
234
|
+
* dump out the config and meta object
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
dumpConfigToObject(): {
|
|
238
|
+
config: any;
|
|
239
|
+
meta: any;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* save app.config to `run/${type}_config.json`
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
dumpConfig(): void;
|
|
246
|
+
dumpTiming(): void;
|
|
247
|
+
protected customEggPaths(): string[];
|
|
248
|
+
get config(): EggAppConfig$1;
|
|
249
|
+
/**
|
|
250
|
+
* app.env delegate app.config.env
|
|
251
|
+
* @deprecated
|
|
252
|
+
*/
|
|
253
|
+
get env(): string;
|
|
254
|
+
set env(_: any);
|
|
255
|
+
/**
|
|
256
|
+
* app.proxy delegate app.config.proxy
|
|
257
|
+
* @deprecated
|
|
258
|
+
*/
|
|
259
|
+
get proxy(): boolean;
|
|
260
|
+
set proxy(_: any);
|
|
261
|
+
/**
|
|
262
|
+
* Create an anonymous context, the context isn't request level, so the request is mocked.
|
|
263
|
+
* then you can use context level API like `ctx.service`
|
|
264
|
+
* @member {String} EggApplication#createAnonymousContext
|
|
265
|
+
* @param {Request} [req] - if you want to mock request like querystring, you can pass an object to this function.
|
|
266
|
+
* @return {Context} context
|
|
267
|
+
*/
|
|
268
|
+
createAnonymousContext(req?: any): EggContext;
|
|
269
|
+
/**
|
|
270
|
+
* Run async function in the anonymous context scope
|
|
271
|
+
* @see Context#runInAnonymousContextScope
|
|
272
|
+
* @param {Function} scope - the first args is an anonymous ctx, scope should be async function
|
|
273
|
+
* @param {Request} [req] - if you want to mock request like querystring, you can pass an object to this function.
|
|
274
|
+
*/
|
|
275
|
+
runInAnonymousContextScope<T = void>(scope: (ctx: Context) => Promise<T>, req?: unknown): Promise<T>;
|
|
276
|
+
/**
|
|
277
|
+
* Create egg context
|
|
278
|
+
* @function EggApplication#createContext
|
|
279
|
+
* @param {Req} req - node native Request object
|
|
280
|
+
* @param {Res} res - node native Response object
|
|
281
|
+
* @return {Context} context object
|
|
282
|
+
*/
|
|
283
|
+
createContext(req: IncomingMessage, res: ServerResponse): Context;
|
|
284
284
|
}
|
|
285
|
+
//#endregion
|
|
286
|
+
export { Context, EggApplicationCore, EggApplicationCoreOptions, EggContext, type ILifecycleBoot as IBoot, type ILifecycleBoot, MiddlewareFunc, type Next, Request, Response, Router };
|