egg 4.1.0-beta.3 → 4.1.0-beta.31

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