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.
Files changed (101) hide show
  1. package/dist/agent.d.ts +7 -3
  2. package/dist/agent.js +10 -6
  3. package/dist/ajv.d.ts +1 -1
  4. package/dist/ajv.js +3 -2
  5. package/dist/aop.d.ts +1 -1
  6. package/dist/aop.js +3 -2
  7. package/dist/app/extend/context.d.ts +181 -178
  8. package/dist/app/extend/context.js +244 -259
  9. package/dist/app/extend/helper.d.ts +40 -35
  10. package/dist/app/extend/helper.js +45 -41
  11. package/dist/app/extend/request.d.ts +135 -131
  12. package/dist/app/extend/request.js +219 -258
  13. package/dist/app/extend/response.d.ts +28 -24
  14. package/dist/app/extend/response.js +36 -34
  15. package/dist/app/middleware/body_parser.d.ts +2 -2
  16. package/dist/app/middleware/body_parser.js +7 -3
  17. package/dist/app/middleware/meta.d.ts +8 -8
  18. package/dist/app/middleware/meta.js +15 -18
  19. package/dist/app/middleware/notfound.d.ts +8 -5
  20. package/dist/app/middleware/notfound.js +25 -28
  21. package/dist/app/middleware/override_method.d.ts +2 -2
  22. package/dist/app/middleware/override_method.js +7 -3
  23. package/dist/app/middleware/site_file.d.ts +11 -7
  24. package/dist/app/middleware/site_file.js +37 -52
  25. package/dist/config/config.default.d.ts +11 -6
  26. package/dist/config/config.default.js +258 -375
  27. package/dist/config/config.local.d.ts +6 -3
  28. package/dist/config/config.local.js +7 -8
  29. package/dist/config/config.unittest.d.ts +6 -3
  30. package/dist/config/config.unittest.js +10 -8
  31. package/dist/config/plugin.d.ts +6 -2
  32. package/dist/config/plugin.js +67 -131
  33. package/dist/dal.d.ts +1 -1
  34. package/dist/dal.js +3 -2
  35. package/dist/errors.d.ts +1 -1
  36. package/dist/errors.js +3 -2
  37. package/dist/helper.d.ts +1 -1
  38. package/dist/helper.js +3 -2
  39. package/dist/index.d.ts +24 -106
  40. package/dist/index.js +23 -89
  41. package/dist/lib/agent.d.ts +21 -15
  42. package/dist/lib/agent.js +53 -45
  43. package/dist/lib/application.d.ts +60 -54
  44. package/dist/lib/application.js +199 -249
  45. package/dist/lib/core/base_context_class.d.ts +23 -17
  46. package/dist/lib/core/base_context_class.js +17 -15
  47. package/dist/lib/core/base_context_logger.d.ts +39 -35
  48. package/dist/lib/core/base_context_logger.js +58 -60
  49. package/dist/lib/core/base_hook_class.d.ts +18 -11
  50. package/dist/lib/core/base_hook_class.js +26 -22
  51. package/dist/lib/core/context_httpclient.d.ts +21 -16
  52. package/dist/lib/core/context_httpclient.js +29 -26
  53. package/dist/lib/core/httpclient.d.ts +14 -12
  54. package/dist/lib/core/httpclient.js +34 -37
  55. package/dist/lib/core/logger.d.ts +7 -3
  56. package/dist/lib/core/logger.js +30 -36
  57. package/dist/lib/core/messenger/IMessenger.d.ts +53 -49
  58. package/dist/lib/core/messenger/IMessenger.js +1 -2
  59. package/dist/lib/core/messenger/base.d.ts +11 -7
  60. package/dist/lib/core/messenger/base.js +30 -29
  61. package/dist/lib/core/messenger/index.d.ts +10 -6
  62. package/dist/lib/core/messenger/index.js +11 -8
  63. package/dist/lib/core/messenger/ipc.d.ts +62 -57
  64. package/dist/lib/core/messenger/ipc.js +126 -138
  65. package/dist/lib/core/messenger/local.d.ts +63 -58
  66. package/dist/lib/core/messenger/local.js +126 -131
  67. package/dist/lib/core/utils.d.ts +5 -2
  68. package/dist/lib/core/utils.js +44 -66
  69. package/dist/lib/define.d.ts +72 -67
  70. package/dist/lib/define.js +54 -53
  71. package/dist/lib/egg.d.ts +283 -281
  72. package/dist/lib/egg.js +512 -573
  73. package/dist/lib/error/CookieLimitExceedError.d.ts +7 -4
  74. package/dist/lib/error/CookieLimitExceedError.js +15 -12
  75. package/dist/lib/error/MessageUnhandledRejectionError.d.ts +7 -4
  76. package/dist/lib/error/MessageUnhandledRejectionError.js +15 -12
  77. package/dist/lib/error/index.d.ts +3 -2
  78. package/dist/lib/error/index.js +4 -3
  79. package/dist/lib/loader/AgentWorkerLoader.d.ts +15 -10
  80. package/dist/lib/loader/AgentWorkerLoader.js +22 -18
  81. package/dist/lib/loader/AppWorkerLoader.d.ts +20 -15
  82. package/dist/lib/loader/AppWorkerLoader.js +35 -37
  83. package/dist/lib/loader/EggApplicationLoader.d.ts +7 -3
  84. package/dist/lib/loader/EggApplicationLoader.js +7 -4
  85. package/dist/lib/loader/index.d.ts +4 -3
  86. package/dist/lib/loader/index.js +5 -4
  87. package/dist/lib/start.d.ts +24 -20
  88. package/dist/lib/start.js +32 -42
  89. package/dist/lib/types.d.ts +288 -286
  90. package/dist/lib/types.js +2 -2
  91. package/dist/lib/types.plugin.d.ts +21 -21
  92. package/dist/lib/types.plugin.js +23 -24
  93. package/dist/orm.d.ts +1 -1
  94. package/dist/orm.js +3 -2
  95. package/dist/schedule.d.ts +2 -2
  96. package/dist/schedule.js +5 -5
  97. package/dist/transaction.d.ts +1 -1
  98. package/dist/transaction.js +3 -2
  99. package/dist/urllib.d.ts +1 -1
  100. package/dist/urllib.js +3 -2
  101. package/package.json +60 -64
@@ -1,306 +1,308 @@
1
- import type { Socket } from 'node:net';
2
- import type { FileLoaderOptions, EggAppConfig as EggCoreAppConfig, EggAppInfo } from '@eggjs/core';
3
- import type { EggLoggerOptions, EggLoggersOptions } from 'egg-logger';
4
- import type { PartialDeep } from 'type-fest';
5
- import type { RequestOptions as HttpClientRequestOptions } from 'urllib';
6
- import type { MetaMiddlewareOptions } from '../app/middleware/meta.ts';
7
- import type { NotFoundMiddlewareOptions } from '../app/middleware/notfound.ts';
8
- import type { SiteFileMiddlewareOptions } from '../app/middleware/site_file.ts';
9
- import type { Application } from './application.ts';
10
- import type { Context } from './egg.ts';
11
- import './types.plugin.ts';
12
- export type { EggAppInfo, PartialDeep };
13
- type IgnoreItem = string | RegExp | ((ctx: Context) => boolean);
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
- export interface ClientErrorResponse {
16
- body: string | Buffer;
17
- status: number;
18
- headers: {
19
- [key: string]: string;
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
- export type EggEnvType = 'local' | 'unittest' | 'prod' | string;
25
+ type EggEnvType = "local" | "unittest" | "prod" | string;
24
26
  /** logger config of egg */
25
- export interface EggLoggerConfig extends Omit<EggLoggersOptions, 'type'> {
26
- /** custom config of coreLogger */
27
- coreLogger?: Partial<EggLoggerOptions>;
28
- /** allow debug log at prod, defaults to `false` */
29
- allowDebugAtProd?: boolean;
30
- /** disable logger console after app ready. defaults to `false` on local and unittest env, others is `true`. */
31
- disableConsoleAfterReady?: boolean;
32
- /** [deprecated] Defaults to `true`. */
33
- enablePerformanceTimer?: boolean;
34
- /** using the app logger instead of EggContextLogger, defaults to `false` */
35
- enableFastContextLogger?: boolean;
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
- export interface CustomLoaderConfig extends Omit<FileLoaderOptions, 'inject' | 'target'> {
39
- /**
40
- * an object you wanner load to, value can only be 'ctx' or 'app'. default to app
41
- */
42
- inject?: 'ctx' | 'app';
43
- /**
44
- * whether need to load files in plugins or framework, default to false
45
- */
46
- loadunit?: boolean;
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
- export interface HttpClientConfig {
49
- /** Request timeout */
50
- timeout?: number;
51
- /** Default request args for httpclient */
52
- request?: HttpClientRequestOptions;
53
- /**
54
- * @deprecated keep compatible with egg 3.x, no more used
55
- */
56
- useHttpClientNext?: boolean;
57
- /**
58
- * Allow http2
59
- */
60
- allowH2?: boolean;
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
- * Powerful Partial, Support adding ? modifier to a mapped property in deep level
64
- * @example
65
- * import { PowerPartial, EggAppConfig } from 'egg';
66
- *
67
- * // { view: { defaultEngines: string } } => { view?: { defaultEngines?: string } }
68
- * type EggConfig = PowerPartial<EggAppConfig>
69
- *
70
- * @deprecated use `PartialDeep` instead
71
- */
72
- export type PowerPartial<T> = PartialDeep<T>;
73
- export interface EggAppConfig extends EggCoreAppConfig {
74
- workerStartTimeout: number;
75
- baseDir: string;
76
- middleware: string[];
77
- coreMiddleware: string[];
78
- /**
79
- * The option of `bodyParser` middleware
80
- *
81
- * @member Config#bodyParser
82
- * @property {Boolean} enable - enable bodyParser or not, default to true
83
- * @property {String | RegExp | Function | Array} ignore - won't parse request body when url path hit ignore pattern, can not set `ignore` when `match` presented
84
- * @property {String | RegExp | Function | Array} match - will parse request body only when url path hit match pattern
85
- * @property {String} encoding - body encoding config, default utf8
86
- * @property {String} formLimit - form body size limit, default 1mb
87
- * @property {String} jsonLimit - json body size limit, default 1mb
88
- * @property {String} textLimit - json body size limit, default 1mb
89
- * @property {Boolean} strict - json body strict mode, if set strict value true, then only receive object and array json body
90
- * @property {Number} queryString.arrayLimit - from item array length limit, default 100
91
- * @property {Number} queryString.depth - json value deep length, default 5
92
- * @property {Number} queryString.parameterLimit - parameter number limit, default 1000
93
- * @property {String[]} enableTypes - parser will only parse when request type hits enableTypes, default is ['json', 'form']
94
- * @property {Object} extendTypes - support extend types
95
- * @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.
96
- */
97
- bodyParser: {
98
- enable: boolean;
99
- encoding: string;
100
- formLimit: string;
101
- jsonLimit: string;
102
- textLimit: string;
103
- strict: boolean;
104
- queryString: {
105
- arrayLimit: number;
106
- depth: number;
107
- parameterLimit: number;
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
- * The environment of egg
159
- */
160
- env: EggEnvType;
161
- /**
162
- * The current HOME directory
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
- * The key that signing cookies. It can contain multiple keys separated by `.`
180
- * @requires Cookie secret key to sign and encrypt, see https://eggjs.org/core/cookie-and-session#cookie-secret-key
181
- */
182
- keys: string;
183
- /**
184
- * The name of the application
185
- */
186
- name: string;
187
- /**
188
- * package.json
189
- */
190
- pkg: Record<string, any>;
191
- rundir: string;
192
- /**
193
- * siteFile middleware options
194
- */
195
- siteFile: SiteFileMiddlewareOptions;
196
- /**
197
- * meta middleware options
198
- */
199
- meta: MetaMiddlewareOptions;
200
- /**
201
- * notfound middleware options
202
- */
203
- notfound: NotFoundMiddlewareOptions;
204
- /**
205
- * overrideMethod middleware options
206
- */
207
- overrideMethod: {
208
- enable: boolean;
209
- allowedMethods: string[];
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
- * onClientError handler
213
- */
214
- onClientError?(err: Error, socket: Socket, app: Application): ClientErrorResponse | Promise<ClientErrorResponse>;
215
- /**
216
- * server timeout in milliseconds, default to 0 (no timeout).
217
- *
218
- * for special request, just use `ctx.req.setTimeout(ms)`
219
- *
220
- * @see https://nodejs.org/api/http.html#http_server_timeout
221
- */
222
- serverTimeout: number | null;
223
- cluster: {
224
- listen: {
225
- path: string;
226
- port: number;
227
- hostname: string;
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
- clusterClient: {
231
- maxWaitTime: number;
232
- responseTimeout: number;
233
- };
234
- [prop: string]: any;
231
+ };
232
+ clusterClient: {
233
+ maxWaitTime: number;
234
+ responseTimeout: number;
235
+ };
236
+ [prop: string]: any;
235
237
  }
236
- export type RequestObjectBody = Record<string, any>;
238
+ type RequestObjectBody = Record<string, any>;
237
239
  /**
238
- * plugin config item interface
239
- */
240
- export interface IEggPluginItem {
241
- env?: EggEnvType[];
242
- path?: string;
243
- package?: string;
244
- enable?: boolean;
240
+ * plugin config item interface
241
+ */
242
+ interface IEggPluginItem {
243
+ env?: EggEnvType[];
244
+ path?: string;
245
+ package?: string;
246
+ enable?: boolean;
245
247
  }
246
- export type EggPluginItem = IEggPluginItem | boolean;
248
+ type EggPluginItem = IEggPluginItem | boolean;
247
249
  /**
248
- * build-in plugin list
249
- */
250
- export interface EggPlugin {
251
- [key: string]: EggPluginItem | undefined;
252
- onerror?: EggPluginItem;
253
- session?: EggPluginItem;
254
- i18n?: EggPluginItem;
255
- watcher?: EggPluginItem;
256
- multipart?: EggPluginItem;
257
- security?: EggPluginItem;
258
- development?: EggPluginItem;
259
- logrotator?: EggPluginItem;
260
- schedule?: EggPluginItem;
261
- static?: EggPluginItem;
262
- jsonp?: EggPluginItem;
263
- view?: EggPluginItem;
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
- * The empty interface `IService` is a placeholder, for egg
267
- * to auto injection service to ctx.service
268
- *
269
- * @example
270
- *
271
- * import { Service } from 'egg';
272
- * class FooService extends Service {
273
- * async bar() {}
274
- * }
275
- *
276
- * declare module 'egg' {
277
- * export interface IService {
278
- * foo: FooService;
279
- * }
280
- * }
281
- *
282
- * Now I can get ctx.service.foo at controller and other service file.
283
- */
284
- export interface IService extends Record<string, any> {
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
- * The empty interface `IController` is a placeholder, for egg
288
- * to auto injection controller to app.controller
289
- *
290
- * @example
291
- *
292
- * import { Controller } from 'egg';
293
- * class HomeController extends Controller {
294
- * async index() {}
295
- * }
296
- *
297
- * declare module 'egg' {
298
- * export interface IController {
299
- * home: HomeController;
300
- * }
301
- * }
302
- *
303
- * Now I can get app.controller.home in the application.
304
- */
305
- export interface IController extends Record<string, any> {
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
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlBLHVCQUF1QjtBQUN2QixPQUFPLG1CQUFtQixDQUFDIn0=
2
+
3
+ export { };
@@ -1,21 +1,21 @@
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';
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";