egg 4.1.0-beta.9 → 4.1.1-beta.0

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 (70) hide show
  1. package/dist/ajv.d.ts +1 -0
  2. package/dist/ajv.js +3 -0
  3. package/dist/aop.d.ts +1 -0
  4. package/dist/aop.js +3 -0
  5. package/dist/app/extend/context.d.ts +122 -146
  6. package/dist/app/extend/helper.d.ts +29 -29
  7. package/dist/app/extend/request.d.ts +103 -112
  8. package/dist/app/extend/response.d.ts +18 -24
  9. package/dist/app/middleware/meta.d.ts +2 -3
  10. package/dist/app/middleware/meta.js +3 -0
  11. package/dist/app/middleware/notfound.d.ts +2 -3
  12. package/dist/app/middleware/site_file.d.ts +2 -2
  13. package/dist/app/middleware/site_file.js +1 -1
  14. package/dist/config/config.default.d.ts +8 -8
  15. package/dist/config/config.default.js +16 -9
  16. package/dist/config/config.local.d.ts +4 -8
  17. package/dist/config/config.local.js +4 -3
  18. package/dist/config/config.unittest.d.ts +4 -7
  19. package/dist/config/config.unittest.js +7 -6
  20. package/dist/config/favicon.png +0 -0
  21. package/dist/config/plugin.d.ts +5 -122
  22. package/dist/config/plugin.js +63 -48
  23. package/dist/dal.d.ts +1 -0
  24. package/dist/dal.js +3 -0
  25. package/dist/errors.d.ts +1 -0
  26. package/dist/errors.js +3 -0
  27. package/dist/helper.d.ts +1 -0
  28. package/dist/helper.js +3 -0
  29. package/dist/index.d.ts +13 -8
  30. package/dist/index.js +9 -5
  31. package/dist/lib/agent.d.ts +10 -9
  32. package/dist/lib/agent.js +1 -2
  33. package/dist/lib/application.d.ts +32 -41
  34. package/dist/lib/application.js +8 -6
  35. package/dist/lib/core/base_context_class.d.ts +9 -7
  36. package/dist/lib/core/base_context_logger.d.ts +22 -22
  37. package/dist/lib/core/base_hook_class.d.ts +4 -3
  38. package/dist/lib/core/context_httpclient.d.ts +12 -12
  39. package/dist/lib/core/httpclient.d.ts +3 -4
  40. package/dist/lib/core/httpclient.js +3 -2
  41. package/dist/lib/core/messenger/IMessenger.d.ts +33 -33
  42. package/dist/lib/core/messenger/base.d.ts +2 -2
  43. package/dist/lib/core/messenger/base.js +2 -1
  44. package/dist/lib/core/messenger/index.d.ts +2 -2
  45. package/dist/lib/core/messenger/index.js +3 -3
  46. package/dist/lib/core/messenger/ipc.d.ts +36 -35
  47. package/dist/lib/core/messenger/ipc.js +9 -3
  48. package/dist/lib/core/messenger/local.d.ts +38 -38
  49. package/dist/lib/core/messenger/local.js +5 -3
  50. package/dist/lib/define.d.ts +81 -0
  51. package/dist/lib/define.js +60 -0
  52. package/dist/lib/egg.d.ts +197 -217
  53. package/dist/lib/egg.js +22 -16
  54. package/dist/lib/loader/AgentWorkerLoader.d.ts +5 -5
  55. package/dist/lib/loader/AppWorkerLoader.d.ts +9 -9
  56. package/dist/lib/start.d.ts +4 -4
  57. package/dist/lib/start.js +1 -1
  58. package/dist/lib/types.d.ts +154 -98
  59. package/dist/lib/types.js +1 -12
  60. package/dist/lib/types.plugin.d.ts +21 -0
  61. package/dist/lib/types.plugin.js +23 -0
  62. package/dist/orm.d.ts +1 -0
  63. package/dist/orm.js +3 -0
  64. package/dist/schedule.d.ts +2 -0
  65. package/dist/schedule.js +5 -0
  66. package/dist/transaction.d.ts +1 -0
  67. package/dist/transaction.js +3 -0
  68. package/package.json +73 -60
  69. package/dist/lib/utils.d.ts +0 -5
  70. package/dist/lib/utils.js +0 -14
package/dist/ajv.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@eggjs/tegg/ajv";
package/dist/ajv.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "@eggjs/tegg/ajv"
2
+
3
+ export { };
package/dist/aop.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@eggjs/tegg/aop";
package/dist/aop.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "@eggjs/tegg/aop"
2
+
3
+ export { };
@@ -1,12 +1,12 @@
1
- import Helper from "./helper.js";
2
- import { Application } from "../../lib/application.js";
3
1
  import { EggContextHttpClient as HttpClient, HttpClientRequestOptions, HttpClientRequestURL } from "../../lib/core/httpclient.js";
2
+ import { IService } from "../../lib/types.js";
4
3
  import Response$1 from "./response.js";
5
4
  import Request$1 from "./request.js";
6
- import { BaseContextClass as BaseContextClass$1 } from "../../lib/core/base_context_class.js";
5
+ import { Application } from "../../lib/application.js";
6
+ import Helper from "./helper.js";
7
7
  import { Context as Context$1, Router } from "@eggjs/core";
8
- import { EggLogger } from "egg-logger";
9
8
  import { Cookies } from "@eggjs/cookies";
9
+ import { EggLogger } from "egg-logger";
10
10
 
11
11
  //#region src/app/extend/context.d.ts
12
12
  interface Cookies$1 extends Cookies {
@@ -17,191 +17,167 @@ declare class Context extends Context$1 {
17
17
  app: Application;
18
18
  request: Request$1;
19
19
  response: Response$1;
20
- service: BaseContextClass$1;
20
+ service: IService;
21
21
  proxy: any;
22
22
  /**
23
- * Request start time
24
- * @member {Number} Context#starttime
25
- */
23
+ * Request start time
24
+ * @member {Number} Context#starttime
25
+ */
26
26
  starttime: number;
27
27
  /**
28
- * Request start timer using `performance.now()`
29
- * @member {Number} Context#performanceStarttime
30
- */
28
+ * Request start timer using `performance.now()`
29
+ * @member {Number} Context#performanceStarttime
30
+ */
31
31
  performanceStarttime: number;
32
32
  /**
33
- * Get the current visitor's cookies.
34
- */
33
+ * Get the current visitor's cookies.
34
+ */
35
35
  get cookies(): Cookies$1;
36
36
  /**
37
- * Get a wrapper httpclient instance contain ctx in the hold request process
38
- *
39
- * @return {HttpClient} the wrapper httpclient instance
40
- */
37
+ * Get a wrapper httpclient instance contain ctx in the hold request process
38
+ *
39
+ * @return {HttpClient} the wrapper httpclient instance
40
+ */
41
41
  get httpclient(): HttpClient;
42
42
  /**
43
- * Alias to {@link Context#httpclient}
44
- */
43
+ * Alias to {@link Context#httpclient}
44
+ */
45
45
  get httpClient(): HttpClient;
46
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
- */
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
65
  get router(): Router;
66
66
  /**
67
- * Set router to Context, only use on EggRouter
68
- * @param {Router} val router instance
69
- */
67
+ * Set router to Context, only use on EggRouter
68
+ * @param {Router} val router instance
69
+ */
70
70
  set router(val: Router);
71
71
  /**
72
- * Get helper instance from {@link Application#Helper}
73
- *
74
- * @member {Helper} Context#helper
75
- * @since 1.0.0
76
- */
72
+ * Get helper instance from {@link Application#Helper}
73
+ *
74
+ * @member {Helper} Context#helper
75
+ * @since 1.0.0
76
+ */
77
77
  get helper(): Helper;
78
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
- */
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
84
  getLogger(name: string): EggLogger;
85
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
- */
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
96
  get logger(): EggLogger;
97
97
  /**
98
- * Logger for frameworks and plugins
99
- *
100
- * @member {Logger} Context#coreLogger
101
- * @since 1.0.0
102
- */
98
+ * Logger for frameworks and plugins
99
+ *
100
+ * @member {Logger} Context#coreLogger
101
+ * @since 1.0.0
102
+ */
103
103
  get coreLogger(): EggLogger;
104
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
- */
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
131
  get locals(): Record<string, any>;
132
132
  set locals(val: Record<string, any>);
133
133
  /**
134
- * alias to {@link Context#locals}, compatible with koa that use this variable
135
- * @member {Object} state
136
- * @see Context#locals
137
- */
134
+ * alias to {@link Context#locals}, compatible with koa that use this variable
135
+ * @member {Object} state
136
+ * @see Context#locals
137
+ */
138
138
  get state(): Record<string, any>;
139
139
  set state(val: Record<string, any>);
140
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
- */
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
152
  runInBackground(scope: (ctx: Context) => Promise<void>, taskName?: string): void;
153
153
  _runInBackground(scope: (ctx: Context) => Promise<void>, taskName: string): Promise<void>;
154
154
  /**
155
- * @member {Boolean} Context#acceptJSON
156
- * @see Request#acceptJSON
157
- * @since 1.0.0
158
- */
155
+ * @member {Boolean} Context#acceptJSON
156
+ * @see Request#acceptJSON
157
+ * @since 1.0.0
158
+ */
159
159
  get acceptJSON(): boolean;
160
160
  get query(): Record<string, string>;
161
161
  /**
162
- * @member {Array} Context#queries
163
- * @see Request#queries
164
- * @since 1.0.0
165
- */
162
+ * @member {Array} Context#queries
163
+ * @see Request#queries
164
+ * @since 1.0.0
165
+ */
166
166
  get queries(): Record<string, string[]>;
167
167
  /**
168
- * @member {string} Context#ip
169
- * @see Request#ip
170
- * @since 1.0.0
171
- */
168
+ * @member {string} Context#ip
169
+ * @see Request#ip
170
+ * @since 1.0.0
171
+ */
172
172
  get ip(): string;
173
173
  set ip(val: string);
174
174
  /**
175
- * @member {Number} Context#realStatus
176
- * @see Response#realStatus
177
- * @since 1.0.0
178
- */
175
+ * @member {Number} Context#realStatus
176
+ * @see Response#realStatus
177
+ * @since 1.0.0
178
+ */
179
179
  get realStatus(): number;
180
180
  set realStatus(val: number);
181
181
  }
182
- declare module '@eggjs/core' {
183
- interface Context {
184
- proxy: any;
185
- performanceStarttime: number;
186
- starttime: number;
187
- runInBackground(scope: (ctx: Context) => Promise<void>, taskName?: string): void;
188
- _runInBackground(scope: (ctx: Context) => Promise<void>, taskName: string): void;
189
- get acceptJSON(): boolean;
190
- get query(): Record<string, string>;
191
- get queries(): Record<string, string[]>;
192
- curl(url: HttpClientRequestURL, options?: HttpClientRequestOptions): ReturnType<HttpClient['request']>;
193
- get router(): Router;
194
- set router(val: Router);
195
- get helper(): Helper;
196
- get httpclient(): HttpClient;
197
- get httpClient(): HttpClient;
198
- getLogger(name: string): EggLogger;
199
- get logger(): EggLogger;
200
- get coreLogger(): EggLogger;
201
- get locals(): Record<string, any>;
202
- get realStatus(): number;
203
- set realStatus(val: number);
204
- }
205
- }
206
182
  //#endregion
207
183
  export { Context as default };
@@ -3,39 +3,39 @@ import { BaseContextClass } from "../../lib/core/base_context_class.js";
3
3
  //#region src/app/extend/helper.d.ts
4
4
 
5
5
  /**
6
- * The Helper class which can be used as utility function.
7
- * We support developers to extend Helper through ${baseDir}/app/extend/helper.js ,
8
- * then you can use all method on `ctx.helper` that is a instance of Helper.
9
- */
6
+ * The Helper class which can be used as utility function.
7
+ * We support developers to extend Helper through ${baseDir}/app/extend/helper.js ,
8
+ * then you can use all method on `ctx.helper` that is a instance of Helper.
9
+ */
10
10
  declare class Helper extends BaseContextClass {
11
11
  /**
12
- * Generate URL path(without host) for route. Takes the route name and a map of named params.
13
- * @function Helper#pathFor
14
- * @param {String} name - Router Name
15
- * @param {Object} params - Other params
16
- *
17
- * @example
18
- * ```js
19
- * app.get('home', '/index.htm', 'home.index');
20
- * ctx.helper.pathFor('home', { by: 'recent', limit: 20 })
21
- * => /index.htm?by=recent&limit=20
22
- * ```
23
- * @return {String} url path(without host)
24
- */
12
+ * Generate URL path(without host) for route. Takes the route name and a map of named params.
13
+ * @function Helper#pathFor
14
+ * @param {String} name - Router Name
15
+ * @param {Object} params - Other params
16
+ *
17
+ * @example
18
+ * ```js
19
+ * app.get('home', '/index.htm', 'home.index');
20
+ * ctx.helper.pathFor('home', { by: 'recent', limit: 20 })
21
+ * => /index.htm?by=recent&limit=20
22
+ * ```
23
+ * @return {String} url path(without host)
24
+ */
25
25
  pathFor(name: string, params: Record<string, any>): string;
26
26
  /**
27
- * Generate full URL(with host) for route. Takes the route name and a map of named params.
28
- * @function Helper#urlFor
29
- * @param {String} name - Router name
30
- * @param {Object} params - Other params
31
- * @example
32
- * ```js
33
- * app.get('home', '/index.htm', 'home.index');
34
- * ctx.helper.urlFor('home', { by: 'recent', limit: 20 })
35
- * => http://127.0.0.1:7001/index.htm?by=recent&limit=20
36
- * ```
37
- * @return {String} full url(with host)
38
- */
27
+ * Generate full URL(with host) for route. Takes the route name and a map of named params.
28
+ * @function Helper#urlFor
29
+ * @param {String} name - Router name
30
+ * @param {Object} params - Other params
31
+ * @example
32
+ * ```js
33
+ * app.get('home', '/index.htm', 'home.index');
34
+ * ctx.helper.urlFor('home', { by: 'recent', limit: 20 })
35
+ * => http://127.0.0.1:7001/index.htm?by=recent&limit=20
36
+ * ```
37
+ * @return {String} full url(with host)
38
+ */
39
39
  urlFor(name: string, params: Record<string, any>): string;
40
40
  }
41
41
  //#endregion
@@ -1,6 +1,6 @@
1
- import { Application } from "../../lib/application.js";
2
1
  import Response$1 from "./response.js";
3
2
  import Context$1 from "./context.js";
3
+ import { Application } from "../../lib/application.js";
4
4
  import { Request as Request$1 } from "@eggjs/core";
5
5
 
6
6
  //#region src/app/extend/request.d.ts
@@ -9,137 +9,128 @@ declare class Request extends Request$1 {
9
9
  ctx: Context$1;
10
10
  response: Response$1;
11
11
  /**
12
- * Request body, parsed from koa-bodyparser or @eggjs/multipart
13
- */
12
+ * Request body, parsed from koa-bodyparser or @eggjs/multipart
13
+ */
14
14
  body: any;
15
15
  /**
16
- * Parse the "Host" header field host
17
- * and support X-Forwarded-Host when a
18
- * proxy is enabled.
19
- * @member {String} Request#host
20
- * @example
21
- * ip + port
22
- * ```js
23
- * this.request.host
24
- * => '127.0.0.1:7001'
25
- * ```
26
- * or domain
27
- * ```js
28
- * this.request.host
29
- * => 'demo.eggjs.org'
30
- * ```
31
- */
16
+ * Parse the "Host" header field host
17
+ * and support X-Forwarded-Host when a
18
+ * proxy is enabled.
19
+ * @member {String} Request#host
20
+ * @example
21
+ * ip + port
22
+ * ```js
23
+ * this.request.host
24
+ * => '127.0.0.1:7001'
25
+ * ```
26
+ * or domain
27
+ * ```js
28
+ * this.request.host
29
+ * => 'demo.eggjs.org'
30
+ * ```
31
+ */
32
32
  get host(): string;
33
33
  /**
34
- * @member {String} Request#protocol
35
- * @example
36
- * ```js
37
- * this.request.protocol
38
- * => 'https'
39
- * ```
40
- */
34
+ * @member {String} Request#protocol
35
+ * @example
36
+ * ```js
37
+ * this.request.protocol
38
+ * => 'https'
39
+ * ```
40
+ */
41
41
  get protocol(): string;
42
42
  /**
43
- * Get all pass through ip addresses from the request.
44
- * Enable only on `app.config.proxy = true`
45
- *
46
- * @member {Array} Request#ips
47
- * @example
48
- * ```js
49
- * this.request.ips
50
- * => ['100.23.1.2', '201.10.10.2']
51
- * ```
52
- */
43
+ * Get all pass through ip addresses from the request.
44
+ * Enable only on `app.config.proxy = true`
45
+ *
46
+ * @member {Array} Request#ips
47
+ * @example
48
+ * ```js
49
+ * this.request.ips
50
+ * => ['100.23.1.2', '201.10.10.2']
51
+ * ```
52
+ */
53
53
  get ips(): string[];
54
54
  /**
55
- * Get the request remote IPv4 address
56
- * @member {String} Request#ip
57
- * @return {String} IPv4 address
58
- * @example
59
- * ```js
60
- * this.request.ip
61
- * => '127.0.0.1'
62
- * => '111.10.2.1'
63
- * ```
64
- */
55
+ * Get the request remote IPv4 address
56
+ * @member {String} Request#ip
57
+ * @return {String} IPv4 address
58
+ * @example
59
+ * ```js
60
+ * this.request.ip
61
+ * => '127.0.0.1'
62
+ * => '111.10.2.1'
63
+ * ```
64
+ */
65
65
  get ip(): string;
66
66
  /**
67
- * Set the request remote IPv4 address
68
- * @member {String} Request#ip
69
- * @param {String} ip - IPv4 address
70
- * @example
71
- * ```js
72
- * this.request.ip
73
- * => '127.0.0.1'
74
- * => '111.10.2.1'
75
- * ```
76
- */
67
+ * Set the request remote IPv4 address
68
+ * @member {String} Request#ip
69
+ * @param {String} ip - IPv4 address
70
+ * @example
71
+ * ```js
72
+ * this.request.ip
73
+ * => '127.0.0.1'
74
+ * => '111.10.2.1'
75
+ * ```
76
+ */
77
77
  set ip(ip: string);
78
78
  /**
79
- * detect if response should be json
80
- * 1. url path ends with `.json`
81
- * 2. response type is set to json
82
- * 3. detect by request accept header
83
- *
84
- * @member {Boolean} Request#acceptJSON
85
- * @since 1.0.0
86
- */
79
+ * detect if response should be json
80
+ * 1. url path ends with `.json`
81
+ * 2. response type is set to json
82
+ * 3. detect by request accept header
83
+ *
84
+ * @member {Boolean} Request#acceptJSON
85
+ * @since 1.0.0
86
+ */
87
87
  get acceptJSON(): boolean;
88
88
  _customQuery(cacheName: symbol, filter: (value: string | string[]) => string | string[]): Record<string, string | string[]>;
89
89
  /**
90
- * get params pass by querystring, all values are of string type.
91
- * @member {Object} Request#query
92
- * @example
93
- * ```js
94
- * GET http://127.0.0.1:7001?name=Foo&age=20&age=21
95
- * this.query
96
- * => { 'name': 'Foo', 'age': '20' }
97
- *
98
- * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val
99
- * this.query
100
- * =>
101
- * {
102
- * "a": "b",
103
- * "o[foo]": "bar",
104
- * "b[]": "1",
105
- * "e": "val"
106
- * }
107
- * ```
108
- */
90
+ * get params pass by querystring, all values are of string type.
91
+ * @member {Object} Request#query
92
+ * @example
93
+ * ```js
94
+ * GET http://127.0.0.1:7001?name=Foo&age=20&age=21
95
+ * this.query
96
+ * => { 'name': 'Foo', 'age': '20' }
97
+ *
98
+ * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val
99
+ * this.query
100
+ * =>
101
+ * {
102
+ * "a": "b",
103
+ * "o[foo]": "bar",
104
+ * "b[]": "1",
105
+ * "e": "val"
106
+ * }
107
+ * ```
108
+ */
109
109
  get query(): Record<string, string>;
110
110
  /**
111
- * get params pass by querystring, all value are Array type. {@link Request#query}
112
- * @member {Array} Request#queries
113
- * @example
114
- * ```js
115
- * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val
116
- * this.queries
117
- * =>
118
- * {
119
- * "a": ["b", "c"],
120
- * "o[foo]": ["bar"],
121
- * "b[]": ["1", "2"],
122
- * "e": ["val"]
123
- * }
124
- * ```
125
- */
111
+ * get params pass by querystring, all value are Array type. {@link Request#query}
112
+ * @member {Array} Request#queries
113
+ * @example
114
+ * ```js
115
+ * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val
116
+ * this.queries
117
+ * =>
118
+ * {
119
+ * "a": ["b", "c"],
120
+ * "o[foo]": ["bar"],
121
+ * "b[]": ["1", "2"],
122
+ * "e": ["val"]
123
+ * }
124
+ * ```
125
+ */
126
126
  get queries(): Record<string, string[]>;
127
127
  /**
128
- * Set query-string as an object.
129
- *
130
- * @function Request#query
131
- * @param {Object} obj set querystring and query object for request.
132
- */
128
+ * Set query-string as an object.
129
+ *
130
+ * @function Request#query
131
+ * @param {Object} obj set querystring and query object for request.
132
+ */
133
133
  set query(obj: Record<string, string>);
134
134
  }
135
- declare module '@eggjs/core' {
136
- interface Request {
137
- body: any;
138
- get acceptJSON(): boolean;
139
- get query(): Record<string, string>;
140
- set query(obj: Record<string, string>);
141
- get queries(): Record<string, string[]>;
142
- }
143
- }
144
135
  //#endregion
145
136
  export { Request as default };