egg 4.1.0-beta.19 → 4.1.0-beta.20
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/AgentWorkerLoader-DG_hAClt.d.ts +17 -0
- package/dist/AgentWorkerLoader-D_hceBRW.js +24 -0
- package/dist/AppWorkerLoader-CAtxJvGl.js +37 -0
- package/dist/AppWorkerLoader-CT875rYM.d.ts +22 -0
- package/dist/CookieLimitExceedError-CAW0HYJw.d.ts +8 -0
- package/dist/CookieLimitExceedError-DLGakbeu.js +15 -0
- package/dist/EggApplicationLoader-CMe1VQt1.js +7 -0
- package/dist/EggApplicationLoader-PnIvd5oV.d.ts +8 -0
- package/dist/IMessenger-C9g6ypSI.d.ts +54 -0
- package/dist/MessageUnhandledRejectionError-Lq5fWw24.d.ts +8 -0
- package/dist/MessageUnhandledRejectionError-oD_E1Ewl.js +15 -0
- package/dist/agent-BfFWeJj4.js +55 -0
- package/dist/agent.d.ts +11 -1
- package/dist/agent.js +1 -1
- package/dist/app/extend/context.d.ts +11 -182
- package/dist/app/extend/context.js +1 -242
- package/dist/app/extend/helper.d.ts +11 -41
- package/dist/app/extend/helper.js +3 -45
- package/dist/app/extend/request.d.ts +11 -135
- package/dist/app/extend/request.js +2 -224
- package/dist/app/extend/response.d.ts +1 -28
- package/dist/app/extend/response.js +1 -34
- package/dist/app/middleware/meta.d.ts +11 -10
- package/dist/app/middleware/notfound.d.ts +11 -10
- package/dist/app/middleware/site_file.d.ts +11 -12
- package/dist/application-DVwFQSa9.js +208 -0
- package/dist/base-KLVtlzUD.d.ts +12 -0
- package/dist/base_context_class-Xc1OZql9.js +19 -0
- package/dist/base_context_logger-CZU59PGA.js +58 -0
- package/dist/base_hook_class-D0Gu2p8r.js +26 -0
- package/dist/base_hook_class-R8A8gm1s.d.ts +1109 -0
- package/dist/config/config.default.d.ts +11 -2
- package/dist/config/config.default.js +26 -2
- package/dist/context-D1Wg7CXs.js +244 -0
- package/dist/context_httpclient-BpRMdJhf.js +29 -0
- package/dist/egg-DVo5e_lr.js +800 -0
- package/dist/error-BYo_LRnd.js +1 -0
- package/dist/helper-B3PKMPXq.js +47 -0
- package/dist/httpclient-C1QPc_R7.js +36 -0
- package/dist/index-CUPkUUOR.d.ts +1 -0
- package/dist/index-CkgLZdB4.d.ts +1 -0
- package/dist/index.d.ts +12 -20
- package/dist/index.js +26 -19
- package/dist/lib/agent.d.ts +11 -21
- package/dist/lib/agent.js +20 -54
- package/dist/lib/application.d.ts +11 -59
- package/dist/lib/application.js +21 -207
- package/dist/lib/core/base_context_class.d.ts +11 -22
- package/dist/lib/core/base_context_class.js +2 -17
- package/dist/lib/core/base_context_logger.d.ts +11 -39
- package/dist/lib/core/base_context_logger.js +1 -56
- package/dist/lib/core/base_hook_class.d.ts +11 -17
- package/dist/lib/core/base_hook_class.js +1 -24
- package/dist/lib/core/context_httpclient.d.ts +11 -21
- package/dist/lib/core/context_httpclient.js +1 -27
- package/dist/lib/core/httpclient.d.ts +12 -17
- package/dist/lib/core/httpclient.js +1 -34
- package/dist/lib/core/logger.d.ts +11 -1
- package/dist/lib/core/logger.js +1 -29
- package/dist/lib/core/messenger/IMessenger.d.ts +1 -53
- package/dist/lib/core/messenger/base.d.ts +12 -11
- package/dist/lib/core/messenger/base.js +15 -27
- package/dist/lib/core/messenger/index.d.ts +12 -11
- package/dist/lib/core/messenger/index.js +15 -11
- package/dist/lib/core/messenger/ipc.d.ts +12 -4
- package/dist/lib/core/messenger/ipc.js +15 -128
- package/dist/lib/core/messenger/local.d.ts +12 -4
- package/dist/lib/core/messenger/local.js +15 -124
- package/dist/lib/core/utils.js +1 -46
- package/dist/lib/egg.d.ts +12 -285
- package/dist/lib/egg.js +15 -518
- package/dist/lib/error/CookieLimitExceedError.d.ts +1 -7
- package/dist/lib/error/CookieLimitExceedError.js +1 -13
- package/dist/lib/error/MessageUnhandledRejectionError.d.ts +1 -7
- package/dist/lib/error/MessageUnhandledRejectionError.js +1 -13
- package/dist/lib/error/index.d.ts +3 -2
- package/dist/lib/error/index.js +3 -2
- package/dist/lib/loader/AgentWorkerLoader.d.ts +2 -16
- package/dist/lib/loader/AgentWorkerLoader.js +2 -22
- package/dist/lib/loader/AppWorkerLoader.d.ts +2 -21
- package/dist/lib/loader/AppWorkerLoader.js +2 -35
- package/dist/lib/loader/EggApplicationLoader.d.ts +1 -7
- package/dist/lib/loader/EggApplicationLoader.js +1 -5
- package/dist/lib/loader/index.d.ts +4 -3
- package/dist/lib/loader/index.js +4 -3
- package/dist/lib/start.d.ts +11 -27
- package/dist/lib/start.js +25 -34
- package/dist/lib/types.d.ts +12 -283
- package/dist/lib/types.js +2 -32
- package/dist/lib/types.plugin.d.ts +1 -12
- package/dist/lib/types.plugin.js +1 -12
- package/dist/lib/utils.js +1 -12
- package/dist/loader-3myZ-rpm.js +1 -0
- package/dist/logger-C4tIcO3S.js +31 -0
- package/dist/request-Cy_1DlaX.js +225 -0
- package/dist/response-CDeQ9Sx2.js +36 -0
- package/dist/response-DlNYDj00.d.ts +29 -0
- package/dist/src-BuOjXSrB.js +3 -0
- package/dist/start-4E84z796.js +35 -0
- package/dist/types-dKSyDnVp.js +32 -0
- package/dist/types.plugin-B2v0K0I8.js +14 -0
- package/dist/types.plugin-C3D5I7VD.d.ts +12 -0
- package/dist/utils-B1Rjsoi9.js +48 -0
- package/dist/utils-BDoYg6z6.js +14 -0
- package/package.json +22 -22
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
constructor(ctx: EggContext, pathName?: string);
|
|
13
|
-
protected _log(method: 'info' | 'warn' | 'error' | 'debug', args: any[]): void;
|
|
14
|
-
/**
|
|
15
|
-
* @member {Function} BaseContextLogger#debug
|
|
16
|
-
* @param {...any} args - log msg
|
|
17
|
-
* @since 1.2.0
|
|
18
|
-
*/
|
|
19
|
-
debug(...args: any[]): void;
|
|
20
|
-
/**
|
|
21
|
-
* @member {Function} BaseContextLogger#info
|
|
22
|
-
* @param {...any} args - log msg
|
|
23
|
-
* @since 1.2.0
|
|
24
|
-
*/
|
|
25
|
-
info(...args: any[]): void;
|
|
26
|
-
/**
|
|
27
|
-
* @member {Function} BaseContextLogger#warn
|
|
28
|
-
* @param {...any} args - log msg
|
|
29
|
-
* @since 1.2.0
|
|
30
|
-
*/
|
|
31
|
-
warn(...args: any[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* @member {Function} BaseContextLogger#error
|
|
34
|
-
* @param {...any} args - log msg
|
|
35
|
-
* @since 1.2.0
|
|
36
|
-
*/
|
|
37
|
-
error(...args: any[]): void;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
1
|
+
import "../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../index-CUPkUUOR.js";
|
|
5
|
+
import { BaseContextLogger } from "../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../response-DlNYDj00.js";
|
|
7
|
+
import "../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../index-CkgLZdB4.js";
|
|
40
12
|
export { BaseContextLogger };
|
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
var BaseContextLogger = class {
|
|
3
|
-
#ctx;
|
|
4
|
-
#pathName;
|
|
5
|
-
/**
|
|
6
|
-
* @class
|
|
7
|
-
* @param {Context} ctx - context instance
|
|
8
|
-
* @param {String} pathName - class path name
|
|
9
|
-
* @since 1.0.0
|
|
10
|
-
*/
|
|
11
|
-
constructor(ctx, pathName) {
|
|
12
|
-
/**
|
|
13
|
-
* @member {Context} BaseContextLogger#ctx
|
|
14
|
-
* @since 1.2.0
|
|
15
|
-
*/
|
|
16
|
-
this.#ctx = ctx;
|
|
17
|
-
this.#pathName = pathName;
|
|
18
|
-
}
|
|
19
|
-
_log(method, args) {
|
|
20
|
-
if (this.#pathName && typeof args[0] === "string") args[0] = `[${this.#pathName}] ${args[0]}`;
|
|
21
|
-
this.#ctx.app.logger[method](...args);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @member {Function} BaseContextLogger#debug
|
|
25
|
-
* @param {...any} args - log msg
|
|
26
|
-
* @since 1.2.0
|
|
27
|
-
*/
|
|
28
|
-
debug(...args) {
|
|
29
|
-
this._log("debug", args);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @member {Function} BaseContextLogger#info
|
|
33
|
-
* @param {...any} args - log msg
|
|
34
|
-
* @since 1.2.0
|
|
35
|
-
*/
|
|
36
|
-
info(...args) {
|
|
37
|
-
this._log("info", args);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @member {Function} BaseContextLogger#warn
|
|
41
|
-
* @param {...any} args - log msg
|
|
42
|
-
* @since 1.2.0
|
|
43
|
-
*/
|
|
44
|
-
warn(...args) {
|
|
45
|
-
this._log("warn", args);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @member {Function} BaseContextLogger#error
|
|
49
|
-
* @param {...any} args - log msg
|
|
50
|
-
* @since 1.2.0
|
|
51
|
-
*/
|
|
52
|
-
error(...args) {
|
|
53
|
-
this._log("error", args);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
1
|
+
import { BaseContextLogger } from "../../base_context_logger-CZU59PGA.js";
|
|
56
2
|
|
|
57
|
-
//#endregion
|
|
58
3
|
export { BaseContextLogger };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
get logger(): egg_logger0.EggLogger;
|
|
13
|
-
get config(): EggAppConfig$1;
|
|
14
|
-
get app(): Application;
|
|
15
|
-
get agent(): Agent;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
1
|
+
import "../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../index-CUPkUUOR.js";
|
|
5
|
+
import { BaseHookClass } from "../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../response-DlNYDj00.js";
|
|
7
|
+
import "../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../index-CkgLZdB4.js";
|
|
18
12
|
export { BaseHookClass };
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseHookClass } from "../../base_hook_class-D0Gu2p8r.js";
|
|
2
2
|
|
|
3
|
-
//#region src/lib/core/base_hook_class.ts
|
|
4
|
-
var BaseHookClass = class {
|
|
5
|
-
#instance;
|
|
6
|
-
constructor(instance) {
|
|
7
|
-
this.#instance = instance;
|
|
8
|
-
}
|
|
9
|
-
get logger() {
|
|
10
|
-
return this.#instance.logger;
|
|
11
|
-
}
|
|
12
|
-
get config() {
|
|
13
|
-
return this.#instance.config;
|
|
14
|
-
}
|
|
15
|
-
get app() {
|
|
16
|
-
assert(this.#instance.type === "application", "agent boot should not use app instance");
|
|
17
|
-
return this.#instance;
|
|
18
|
-
}
|
|
19
|
-
get agent() {
|
|
20
|
-
assert(this.#instance.type === "agent", "app boot should not use agent instance");
|
|
21
|
-
return this.#instance;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
3
|
export { BaseHookClass };
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* http request helper base on {@link HttpClient}, it will auto save httpclient log.
|
|
13
|
-
* Keep the same api with {@link Application#curl}.
|
|
14
|
-
*
|
|
15
|
-
* @param {String|Object} url - request url address.
|
|
16
|
-
* @param {Object} [options] - options for request.
|
|
17
|
-
*/
|
|
18
|
-
curl<T = any>(url: HttpClientRequestURL, options?: HttpClientRequestOptions): Promise<node_modules_urllib_dist_esm_Response_js0.HttpClientResponse<T>>;
|
|
19
|
-
request<T = any>(url: HttpClientRequestURL, options?: HttpClientRequestOptions): Promise<node_modules_urllib_dist_esm_Response_js0.HttpClientResponse<T>>;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
1
|
+
import "../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../index-CUPkUUOR.js";
|
|
5
|
+
import { ContextHttpClient } from "../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../response-DlNYDj00.js";
|
|
7
|
+
import "../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../index-CkgLZdB4.js";
|
|
22
12
|
export { ContextHttpClient };
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
var ContextHttpClient = class {
|
|
3
|
-
ctx;
|
|
4
|
-
app;
|
|
5
|
-
constructor(ctx) {
|
|
6
|
-
this.ctx = ctx;
|
|
7
|
-
this.app = ctx.app;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* http request helper base on {@link HttpClient}, it will auto save httpclient log.
|
|
11
|
-
* Keep the same api with {@link Application#curl}.
|
|
12
|
-
*
|
|
13
|
-
* @param {String|Object} url - request url address.
|
|
14
|
-
* @param {Object} [options] - options for request.
|
|
15
|
-
*/
|
|
16
|
-
async curl(url, options) {
|
|
17
|
-
options = {
|
|
18
|
-
...options,
|
|
19
|
-
ctx: this.ctx
|
|
20
|
-
};
|
|
21
|
-
return await this.app.curl(url, options);
|
|
22
|
-
}
|
|
23
|
-
async request(url, options) {
|
|
24
|
-
return await this.curl(url, options);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
1
|
+
import { ContextHttpClient } from "../../context_httpclient-BpRMdJhf.js";
|
|
27
2
|
|
|
28
|
-
//#endregion
|
|
29
3
|
export { ContextHttpClient };
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
request<T = any>(url: RequestURL, options?: HttpClientRequestOptions): Promise<urllib0.HttpClientResponse<T>>;
|
|
14
|
-
curl<T = any>(url: RequestURL, options?: HttpClientRequestOptions): Promise<urllib0.HttpClientResponse<T>>;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { type HttpClient as EggContextHttpClient, type HttpClient as EggHttpClient, HttpClient, type HttpClientOptions, HttpClientRequestOptions, type HttpClientRequestURL, type HttpClientResponse };
|
|
1
|
+
import "../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../index-CUPkUUOR.js";
|
|
5
|
+
import { HttpClient, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse } from "../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../response-DlNYDj00.js";
|
|
7
|
+
import "../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../index-CkgLZdB4.js";
|
|
12
|
+
export { HttpClient as EggContextHttpClient, HttpClient as EggHttpClient, HttpClient, HttpClientOptions, HttpClientRequestOptions, HttpClientRequestURL, HttpClientResponse };
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import { HttpClient
|
|
2
|
-
import { ms } from "humanize-ms";
|
|
1
|
+
import { HttpClient } from "../../httpclient-C1QPc_R7.js";
|
|
3
2
|
|
|
4
|
-
//#region src/lib/core/httpclient.ts
|
|
5
|
-
var HttpClient = class extends HttpClient$1 {
|
|
6
|
-
#app;
|
|
7
|
-
constructor(app, options = {}) {
|
|
8
|
-
normalizeConfig(app);
|
|
9
|
-
const config = app.config.httpclient;
|
|
10
|
-
const initOptions = {
|
|
11
|
-
...options,
|
|
12
|
-
defaultArgs: {
|
|
13
|
-
...config.request,
|
|
14
|
-
...options.defaultArgs
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
super(initOptions);
|
|
18
|
-
this.#app = app;
|
|
19
|
-
}
|
|
20
|
-
async request(url, options) {
|
|
21
|
-
options = options ?? {};
|
|
22
|
-
if (options.ctx?.tracer) options.tracer = options.ctx.tracer;
|
|
23
|
-
else options.tracer = options.tracer ?? this.#app.tracer;
|
|
24
|
-
return await super.request(url, options);
|
|
25
|
-
}
|
|
26
|
-
async curl(url, options) {
|
|
27
|
-
return await this.request(url, options);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
function normalizeConfig(app) {
|
|
31
|
-
const config = app.config.httpclient;
|
|
32
|
-
if (typeof config.request?.timeout === "string") config.request.timeout = ms(config.request.timeout);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
3
|
export { HttpClient };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../index-CUPkUUOR.js";
|
|
5
|
+
import { EggApplicationCore } from "../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../response-DlNYDj00.js";
|
|
7
|
+
import "../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../index-CkgLZdB4.js";
|
|
2
12
|
import { EggLoggers } from "egg-logger";
|
|
3
13
|
|
|
4
14
|
//#region src/lib/core/logger.d.ts
|
package/dist/lib/core/logger.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { setCustomLogger } from "onelogger";
|
|
1
|
+
import { createLoggers } from "../../logger-C4tIcO3S.js";
|
|
3
2
|
|
|
4
|
-
//#region src/lib/core/logger.ts
|
|
5
|
-
function createLoggers(app) {
|
|
6
|
-
const loggerOptions = {
|
|
7
|
-
...app.config.logger,
|
|
8
|
-
type: app.type,
|
|
9
|
-
localStorage: app.ctxStorage
|
|
10
|
-
};
|
|
11
|
-
if (app.config.env === "prod" && loggerOptions.level === "DEBUG" && !app.config.logger.allowDebugAtProd) loggerOptions.level = "INFO";
|
|
12
|
-
const loggers = new EggLoggers({
|
|
13
|
-
logger: loggerOptions,
|
|
14
|
-
customLogger: app.config.customLogger
|
|
15
|
-
});
|
|
16
|
-
app.ready(() => {
|
|
17
|
-
if (app.config.logger.disableConsoleAfterReady) {
|
|
18
|
-
loggers.disableConsole();
|
|
19
|
-
loggers.coreLogger.info("[egg:lib:core:logger] disable console log after app ready");
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
for (const loggerName of Object.keys(loggers)) setCustomLogger(loggerName, loggers[loggerName]);
|
|
23
|
-
app.lifecycle.registerBeforeClose(() => {
|
|
24
|
-
for (const loggerName of Object.keys(loggers)) setCustomLogger(loggerName, void 0);
|
|
25
|
-
});
|
|
26
|
-
loggers.coreLogger.info("[egg:lib:core:logger] init all loggers with options: %j", loggerOptions);
|
|
27
|
-
return loggers;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
3
|
export { createLoggers };
|
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/lib/core/messenger/IMessenger.d.ts
|
|
4
|
-
interface IMessenger extends EventEmitter {
|
|
5
|
-
/**
|
|
6
|
-
* Send message to all agent and app
|
|
7
|
-
* @param {String} action - message key
|
|
8
|
-
* @param {Object} data - message value
|
|
9
|
-
* @return {Messenger} this
|
|
10
|
-
*/
|
|
11
|
-
broadcast(action: string, data?: unknown): IMessenger;
|
|
12
|
-
/**
|
|
13
|
-
* send message to the specified process
|
|
14
|
-
* @param {String} workerId - the workerId of the receiver
|
|
15
|
-
* @param {String} action - message key
|
|
16
|
-
* @param {Object} data - message value
|
|
17
|
-
* @return {Messenger} this
|
|
18
|
-
*/
|
|
19
|
-
sendTo(workerId: string, action: string, data?: unknown): IMessenger;
|
|
20
|
-
/**
|
|
21
|
-
* send message to one app worker by random
|
|
22
|
-
* - if it's running in agent, it will send to one of app workers
|
|
23
|
-
* - if it's running in app, it will send to agent
|
|
24
|
-
* @param {String} action - message key
|
|
25
|
-
* @param {Object} data - message value
|
|
26
|
-
* @return {Messenger} this
|
|
27
|
-
*/
|
|
28
|
-
sendRandom(action: string, data?: unknown): IMessenger;
|
|
29
|
-
/**
|
|
30
|
-
* send message to app
|
|
31
|
-
* @param {String} action - message key
|
|
32
|
-
* @param {Object} data - message value
|
|
33
|
-
* @return {Messenger} this
|
|
34
|
-
*/
|
|
35
|
-
sendToApp(action: string, data?: unknown): IMessenger;
|
|
36
|
-
/**
|
|
37
|
-
* send message to agent
|
|
38
|
-
* @param {String} action - message key
|
|
39
|
-
* @param {Object} data - message value
|
|
40
|
-
* @return {Messenger} this
|
|
41
|
-
*/
|
|
42
|
-
sendToAgent(action: string, data?: unknown): IMessenger;
|
|
43
|
-
/**
|
|
44
|
-
* @param {String} action - message key
|
|
45
|
-
* @param {Object} data - message value
|
|
46
|
-
* @param {String} to - let master know how to send message
|
|
47
|
-
* @return {Messenger} this
|
|
48
|
-
*/
|
|
49
|
-
send(action: string, data: unknown, to?: string): IMessenger;
|
|
50
|
-
close(): void;
|
|
51
|
-
onMessage(message: any): void;
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
1
|
+
import { IMessenger } from "../../../IMessenger-C9g6ypSI.js";
|
|
54
2
|
export { IMessenger };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import "../../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../../index-CUPkUUOR.js";
|
|
5
|
+
import "../../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../../response-DlNYDj00.js";
|
|
7
|
+
import "../../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import "../../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../../index-CkgLZdB4.js";
|
|
12
|
+
import { BaseMessenger } from "../../../base-KLVtlzUD.js";
|
|
12
13
|
export { BaseMessenger };
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
1
|
+
import "../../../base_hook_class-D0Gu2p8r.js";
|
|
2
|
+
import "../../../base_context_logger-CZU59PGA.js";
|
|
3
|
+
import "../../../base_context_class-Xc1OZql9.js";
|
|
4
|
+
import "../../../context-D1Wg7CXs.js";
|
|
5
|
+
import "../../../response-CDeQ9Sx2.js";
|
|
6
|
+
import "../../../request-Cy_1DlaX.js";
|
|
7
|
+
import "../../../CookieLimitExceedError-DLGakbeu.js";
|
|
8
|
+
import "../../../MessageUnhandledRejectionError-oD_E1Ewl.js";
|
|
9
|
+
import "../../../error-BYo_LRnd.js";
|
|
10
|
+
import { BaseMessenger } from "../../../egg-DVo5e_lr.js";
|
|
11
|
+
import "../../../context_httpclient-BpRMdJhf.js";
|
|
12
|
+
import "../../../httpclient-C1QPc_R7.js";
|
|
13
|
+
import "../../../logger-C4tIcO3S.js";
|
|
14
|
+
import "../../../utils-B1Rjsoi9.js";
|
|
15
|
+
import "../../../utils-BDoYg6z6.js";
|
|
4
16
|
|
|
5
|
-
//#region src/lib/core/messenger/base.ts
|
|
6
|
-
var BaseMessenger = class extends EventEmitter {
|
|
7
|
-
egg;
|
|
8
|
-
constructor(egg) {
|
|
9
|
-
super({ captureRejections: true });
|
|
10
|
-
this.egg = egg;
|
|
11
|
-
}
|
|
12
|
-
[captureRejectionSymbol](err, event, ...args) {
|
|
13
|
-
this.egg.coreLogger.error(new MessageUnhandledRejectionError(err, event, args));
|
|
14
|
-
}
|
|
15
|
-
emit(eventName, ...args) {
|
|
16
|
-
const hasListeners = this.listenerCount(eventName) > 0;
|
|
17
|
-
try {
|
|
18
|
-
return super.emit(eventName, ...args);
|
|
19
|
-
} catch (e) {
|
|
20
|
-
let err = e;
|
|
21
|
-
if (!(err instanceof Error)) err = new Error(String(err));
|
|
22
|
-
this.egg.coreLogger.error(new MessageUnhandledRejectionError(err, eventName, args));
|
|
23
|
-
return hasListeners;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
17
|
export { BaseMessenger };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import "../../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../../index-CUPkUUOR.js";
|
|
5
|
+
import { create } from "../../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../../response-DlNYDj00.js";
|
|
7
|
+
import "../../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import { IMessenger } from "../../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../../index-CkgLZdB4.js";
|
|
12
|
+
export { IMessenger, create };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "../../../base_hook_class-D0Gu2p8r.js";
|
|
2
|
+
import "../../../base_context_logger-CZU59PGA.js";
|
|
3
|
+
import "../../../base_context_class-Xc1OZql9.js";
|
|
4
|
+
import "../../../context-D1Wg7CXs.js";
|
|
5
|
+
import "../../../response-CDeQ9Sx2.js";
|
|
6
|
+
import "../../../request-Cy_1DlaX.js";
|
|
7
|
+
import "../../../CookieLimitExceedError-DLGakbeu.js";
|
|
8
|
+
import "../../../MessageUnhandledRejectionError-oD_E1Ewl.js";
|
|
9
|
+
import "../../../error-BYo_LRnd.js";
|
|
10
|
+
import { create } from "../../../egg-DVo5e_lr.js";
|
|
11
|
+
import "../../../context_httpclient-BpRMdJhf.js";
|
|
12
|
+
import "../../../httpclient-C1QPc_R7.js";
|
|
13
|
+
import "../../../logger-C4tIcO3S.js";
|
|
14
|
+
import "../../../utils-B1Rjsoi9.js";
|
|
15
|
+
import "../../../utils-BDoYg6z6.js";
|
|
3
16
|
|
|
4
|
-
//#region src/lib/core/messenger/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* @class Messenger
|
|
7
|
-
*/
|
|
8
|
-
function create(egg) {
|
|
9
|
-
return egg.options.mode === "single" ? new Messenger(egg) : new Messenger$1(egg);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
17
|
export { create };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import "../../../EggApplicationLoader-PnIvd5oV.js";
|
|
2
|
+
import "../../../AppWorkerLoader-CT875rYM.js";
|
|
3
|
+
import "../../../AgentWorkerLoader-DG_hAClt.js";
|
|
4
|
+
import "../../../index-CUPkUUOR.js";
|
|
5
|
+
import { EggApplicationCore } from "../../../base_hook_class-R8A8gm1s.js";
|
|
6
|
+
import "../../../response-DlNYDj00.js";
|
|
7
|
+
import "../../../types.plugin-C3D5I7VD.js";
|
|
8
|
+
import { IMessenger } from "../../../IMessenger-C9g6ypSI.js";
|
|
9
|
+
import "../../../CookieLimitExceedError-CAW0HYJw.js";
|
|
10
|
+
import "../../../MessageUnhandledRejectionError-Lq5fWw24.js";
|
|
11
|
+
import "../../../index-CkgLZdB4.js";
|
|
12
|
+
import { BaseMessenger } from "../../../base-KLVtlzUD.js";
|
|
4
13
|
|
|
5
14
|
//#region src/lib/core/messenger/ipc.d.ts
|
|
6
|
-
|
|
7
15
|
/**
|
|
8
16
|
* Communication between app worker and agent worker by IPC channel
|
|
9
17
|
*/
|