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/agent.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { BaseHookClass } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { BaseHookClass } from "./lib/core/base_hook_class.js";
|
|
2
|
+
|
|
3
|
+
//#region src/agent.d.ts
|
|
4
|
+
declare class EggAgentHook extends BaseHookClass {
|
|
5
|
+
configDidLoad(): void;
|
|
4
6
|
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { EggAgentHook as default };
|
package/dist/agent.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { BaseHookClass } from "./lib/core/base_hook_class.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/agent.ts
|
|
4
|
+
var EggAgentHook = class extends BaseHookClass {
|
|
5
|
+
configDidLoad() {
|
|
6
|
+
this.agent._wrapMessenger();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { EggAgentHook as default };
|
package/dist/ajv.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "@eggjs/tegg/ajv";
|
package/dist/ajv.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
|
|
1
|
+
export * from "@eggjs/tegg/ajv"
|
|
2
|
+
|
|
3
|
+
export { };
|
package/dist/aop.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "@eggjs/tegg/aop";
|
package/dist/aop.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
|
|
1
|
+
export * from "@eggjs/tegg/aop"
|
|
2
|
+
|
|
3
|
+
export { };
|
|
@@ -1,180 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { EggContextHttpClient as HttpClient, HttpClientRequestOptions, HttpClientRequestURL } from "../../lib/core/httpclient.js";
|
|
2
|
+
import { IService } from "../../lib/types.js";
|
|
3
|
+
import Response$1 from "./response.js";
|
|
4
|
+
import Request$1 from "./request.js";
|
|
5
|
+
import { Application } from "../../lib/application.js";
|
|
6
|
+
import Helper from "./helper.js";
|
|
7
|
+
import { Context as Context$1, Router } from "@eggjs/core";
|
|
8
|
+
import { Cookies } from "@eggjs/cookies";
|
|
9
|
+
import { EggLogger } from "egg-logger";
|
|
10
|
+
|
|
11
|
+
//#region src/app/extend/context.d.ts
|
|
12
|
+
interface Cookies$1 extends Cookies {
|
|
13
|
+
request: any;
|
|
14
|
+
response: any;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
16
|
+
declare class Context extends Context$1 {
|
|
17
|
+
app: Application;
|
|
18
|
+
request: Request$1;
|
|
19
|
+
response: Response$1;
|
|
20
|
+
service: IService;
|
|
21
|
+
proxy: any;
|
|
22
|
+
/**
|
|
23
|
+
* Request start time
|
|
24
|
+
* @member {Number} Context#starttime
|
|
25
|
+
*/
|
|
26
|
+
starttime: number;
|
|
27
|
+
/**
|
|
28
|
+
* Request start timer using `performance.now()`
|
|
29
|
+
* @member {Number} Context#performanceStarttime
|
|
30
|
+
*/
|
|
31
|
+
performanceStarttime: number;
|
|
32
|
+
/**
|
|
33
|
+
* Get the current visitor's cookies.
|
|
34
|
+
*/
|
|
35
|
+
get cookies(): Cookies$1;
|
|
36
|
+
/**
|
|
37
|
+
* Get a wrapper httpclient instance contain ctx in the hold request process
|
|
38
|
+
*
|
|
39
|
+
* @return {HttpClient} the wrapper httpclient instance
|
|
40
|
+
*/
|
|
41
|
+
get httpclient(): HttpClient;
|
|
42
|
+
/**
|
|
43
|
+
* Alias to {@link Context#httpclient}
|
|
44
|
+
*/
|
|
45
|
+
get httpClient(): HttpClient;
|
|
46
|
+
/**
|
|
47
|
+
* Shortcut for httpclient.curl
|
|
48
|
+
*
|
|
49
|
+
* @function Context#curl
|
|
50
|
+
* @param {String|Object} url - request url address.
|
|
51
|
+
* @param {Object} [options] - options for request.
|
|
52
|
+
* @return {Object} see {@link ContextHttpClient#curl}
|
|
53
|
+
*/
|
|
54
|
+
curl(url: HttpClientRequestURL, options?: HttpClientRequestOptions): ReturnType<HttpClient["request"]>;
|
|
55
|
+
/**
|
|
56
|
+
* Alias to {@link Application#router}
|
|
57
|
+
*
|
|
58
|
+
* @member {Router} Context#router
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
* @example
|
|
61
|
+
* ```js
|
|
62
|
+
* this.router.pathFor('post', { id: 12 });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
get router(): Router;
|
|
66
|
+
/**
|
|
67
|
+
* Set router to Context, only use on EggRouter
|
|
68
|
+
* @param {Router} val router instance
|
|
69
|
+
*/
|
|
70
|
+
set router(val: Router);
|
|
71
|
+
/**
|
|
72
|
+
* Get helper instance from {@link Application#Helper}
|
|
73
|
+
*
|
|
74
|
+
* @member {Helper} Context#helper
|
|
75
|
+
* @since 1.0.0
|
|
76
|
+
*/
|
|
77
|
+
get helper(): Helper;
|
|
78
|
+
/**
|
|
79
|
+
* Wrap app.loggers with context information,
|
|
80
|
+
* if a custom logger is defined by naming aLogger, then you can `ctx.getLogger('aLogger')`
|
|
81
|
+
*
|
|
82
|
+
* @param {String} name - logger name
|
|
83
|
+
*/
|
|
84
|
+
getLogger(name: string): EggLogger;
|
|
85
|
+
/**
|
|
86
|
+
* Logger for Application
|
|
87
|
+
*
|
|
88
|
+
* @member {Logger} Context#logger
|
|
89
|
+
* @since 1.0.0
|
|
90
|
+
* @example
|
|
91
|
+
* ```js
|
|
92
|
+
* this.logger.info('some request data: %j', this.request.body);
|
|
93
|
+
* this.logger.warn('WARNING!!!!');
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
get logger(): EggLogger;
|
|
97
|
+
/**
|
|
98
|
+
* Logger for frameworks and plugins
|
|
99
|
+
*
|
|
100
|
+
* @member {Logger} Context#coreLogger
|
|
101
|
+
* @since 1.0.0
|
|
102
|
+
*/
|
|
103
|
+
get coreLogger(): EggLogger;
|
|
104
|
+
/**
|
|
105
|
+
* locals is an object for view, you can use `app.locals` and `ctx.locals` to set variables,
|
|
106
|
+
* which will be used as data when view is rendering.
|
|
107
|
+
* The difference between `app.locals` and `ctx.locals` is the context level, `app.locals` is global level, and `ctx.locals` is request level. when you get `ctx.locals`, it will merge `app.locals`.
|
|
108
|
+
*
|
|
109
|
+
* when you set locals, only object is available
|
|
110
|
+
*
|
|
111
|
+
* ```js
|
|
112
|
+
* this.locals = {
|
|
113
|
+
* a: 1
|
|
114
|
+
* };
|
|
115
|
+
* this.locals = {
|
|
116
|
+
* b: 1
|
|
117
|
+
* };
|
|
118
|
+
* this.locals.c = 1;
|
|
119
|
+
* console.log(this.locals);
|
|
120
|
+
* {
|
|
121
|
+
* a: 1,
|
|
122
|
+
* b: 1,
|
|
123
|
+
* c: 1,
|
|
124
|
+
* };
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* `ctx.locals` has cache, it only merges `app.locals` once in one request.
|
|
128
|
+
*
|
|
129
|
+
* @member {Object} Context#locals
|
|
130
|
+
*/
|
|
131
|
+
get locals(): Record<string, any>;
|
|
132
|
+
set locals(val: Record<string, any>);
|
|
133
|
+
/**
|
|
134
|
+
* alias to {@link Context#locals}, compatible with koa that use this variable
|
|
135
|
+
* @member {Object} state
|
|
136
|
+
* @see Context#locals
|
|
137
|
+
*/
|
|
138
|
+
get state(): Record<string, any>;
|
|
139
|
+
set state(val: Record<string, any>);
|
|
140
|
+
/**
|
|
141
|
+
* Run async function in the background
|
|
142
|
+
* @param {Function} scope - the first args is ctx
|
|
143
|
+
* ```js
|
|
144
|
+
* this.body = 'hi';
|
|
145
|
+
*
|
|
146
|
+
* this.runInBackground(async ctx => {
|
|
147
|
+
* await ctx.mysql.query(sql);
|
|
148
|
+
* await ctx.curl(url);
|
|
149
|
+
* });
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
runInBackground(scope: (ctx: Context) => Promise<void>, taskName?: string): void;
|
|
153
|
+
_runInBackground(scope: (ctx: Context) => Promise<void>, taskName: string): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* @member {Boolean} Context#acceptJSON
|
|
156
|
+
* @see Request#acceptJSON
|
|
157
|
+
* @since 1.0.0
|
|
158
|
+
*/
|
|
159
|
+
get acceptJSON(): boolean;
|
|
160
|
+
get query(): Record<string, string>;
|
|
161
|
+
/**
|
|
162
|
+
* @member {Array} Context#queries
|
|
163
|
+
* @see Request#queries
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
*/
|
|
166
|
+
get queries(): Record<string, string[]>;
|
|
167
|
+
/**
|
|
168
|
+
* @member {string} Context#ip
|
|
169
|
+
* @see Request#ip
|
|
170
|
+
* @since 1.0.0
|
|
171
|
+
*/
|
|
172
|
+
get ip(): string;
|
|
173
|
+
set ip(val: string);
|
|
174
|
+
/**
|
|
175
|
+
* @member {Number} Context#realStatus
|
|
176
|
+
* @see Response#realStatus
|
|
177
|
+
* @since 1.0.0
|
|
178
|
+
*/
|
|
179
|
+
get realStatus(): number;
|
|
180
|
+
set realStatus(val: number);
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
//#endregion
|
|
183
|
+
export { Context as default };
|