@midwayjs/web 3.10.7 → 3.10.10
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/base.js +6 -0
- package/dist/decorator.d.ts +3 -0
- package/dist/decorator.js +16 -0
- package/dist/interface.d.ts +2 -0
- package/dist/interface.js +3 -0
- package/dist/utils.js +7 -2
- package/package.json +4 -4
package/dist/base.js
CHANGED
|
@@ -10,6 +10,7 @@ const router_1 = require("@eggjs/router");
|
|
|
10
10
|
const util_1 = require("util");
|
|
11
11
|
const lifecycle_1 = require("./framework/lifecycle");
|
|
12
12
|
const web_1 = require("./framework/web");
|
|
13
|
+
const interface_1 = require("./interface");
|
|
13
14
|
const ROUTER = Symbol('EggCore#router');
|
|
14
15
|
const EGG_LOADER = Symbol.for('egg#loader');
|
|
15
16
|
const EGG_PATH = Symbol.for('egg#eggPath');
|
|
@@ -236,6 +237,11 @@ const createAgentWorkerLoader = () => {
|
|
|
236
237
|
debug('[egg]: start "initializeAgentApplicationContext"');
|
|
237
238
|
await (0, utils_1.initializeAgentApplicationContext)(this.app);
|
|
238
239
|
super.load();
|
|
240
|
+
debug('[egg]: start runAgent decorator');
|
|
241
|
+
const runInAgentModules = (0, core_1.listModule)(interface_1.RUN_IN_AGENT_KEY);
|
|
242
|
+
for (const module of runInAgentModules) {
|
|
243
|
+
await this.app.applicationContext.getAsync(module);
|
|
244
|
+
}
|
|
239
245
|
debug('[egg]: agent load run complete');
|
|
240
246
|
});
|
|
241
247
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunInEggAgent = exports.AgentApp = void 0;
|
|
4
|
+
const core_1 = require("@midwayjs/core");
|
|
5
|
+
const interface_1 = require("./interface");
|
|
6
|
+
function AgentApp() {
|
|
7
|
+
return (0, core_1.createCustomPropertyDecorator)(interface_1.EGG_AGENT_APP_KEY, {});
|
|
8
|
+
}
|
|
9
|
+
exports.AgentApp = AgentApp;
|
|
10
|
+
function RunInEggAgent() {
|
|
11
|
+
return function (target) {
|
|
12
|
+
(0, core_1.saveModule)(interface_1.RUN_IN_AGENT_KEY, target);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.RunInEggAgent = RunInEggAgent;
|
|
16
|
+
//# sourceMappingURL=decorator.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { Context as EggContext, Application as EggApplication } from 'egg';
|
|
|
3
3
|
import { IMidwayContainer, IMidwayContext, IMidwayApplication, IConfigurationOptions, NextFunction as BaseNextFunction } from '@midwayjs/core';
|
|
4
4
|
import { DefaultState, Middleware } from 'koa';
|
|
5
5
|
import { ILogger, LoggerOptions } from '@midwayjs/logger';
|
|
6
|
+
export declare const RUN_IN_AGENT_KEY = "egg:run_in_agent";
|
|
7
|
+
export declare const EGG_AGENT_APP_KEY = "egg_agent_app";
|
|
6
8
|
export interface IMidwayWebBaseApplication {
|
|
7
9
|
applicationContext: IMidwayContainer;
|
|
8
10
|
getLogger(name?: string): ILogger;
|
package/dist/interface.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EGG_AGENT_APP_KEY = exports.RUN_IN_AGENT_KEY = void 0;
|
|
4
|
+
exports.RUN_IN_AGENT_KEY = 'egg:run_in_agent';
|
|
5
|
+
exports.EGG_AGENT_APP_KEY = 'egg_agent_app';
|
|
3
6
|
//# sourceMappingURL=interface.js.map
|
package/dist/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ const core_1 = require("@midwayjs/core");
|
|
|
8
8
|
const core_2 = require("@midwayjs/core");
|
|
9
9
|
const web_1 = require("./framework/web");
|
|
10
10
|
const util_1 = require("util");
|
|
11
|
+
const interface_1 = require("./interface");
|
|
11
12
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
12
13
|
function isTypeScriptEnvironment() {
|
|
13
14
|
const TS_MODE_PROCESS_FLAG = process.env.MIDWAY_TS_MODE;
|
|
@@ -77,11 +78,15 @@ async function initializeAgentApplicationContext(agent) {
|
|
|
77
78
|
agentFramework.loggerService = applicationContext.get(core_1.MidwayLoggerService);
|
|
78
79
|
agentFramework.informationService = applicationContext.get(core_1.MidwayInformationService);
|
|
79
80
|
agentFramework.overwriteApplication('agent');
|
|
81
|
+
// init decorator service
|
|
82
|
+
const decoratorService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayDecoratorService);
|
|
83
|
+
// register @Logger decorator handler
|
|
84
|
+
decoratorService.registerPropertyHandler(interface_1.EGG_AGENT_APP_KEY, (propertyName, meta) => {
|
|
85
|
+
return agent;
|
|
86
|
+
});
|
|
80
87
|
if (process.env['EGG_CLUSTER_MODE'] === 'true') {
|
|
81
88
|
// init aop support
|
|
82
89
|
const aspectService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayAspectService);
|
|
83
|
-
// init decorator service
|
|
84
|
-
const decoratorService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayDecoratorService);
|
|
85
90
|
const configService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayConfigService);
|
|
86
91
|
const loggerService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayLoggerService);
|
|
87
92
|
// framework/config/plugin/logger/app decorator support
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/web",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.10",
|
|
4
4
|
"description": "Midway Web Framework for Egg.js",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@midwayjs/logger": "^2.15.0",
|
|
32
|
-
"@midwayjs/mock": "^3.10.
|
|
32
|
+
"@midwayjs/mock": "^3.10.10",
|
|
33
33
|
"dayjs": "1.11.7",
|
|
34
34
|
"egg-logger": "2.9.1",
|
|
35
35
|
"egg-mock": "4.2.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@eggjs/router": "^2.0.0",
|
|
48
|
-
"@midwayjs/core": "^3.10.
|
|
48
|
+
"@midwayjs/core": "^3.10.10",
|
|
49
49
|
"egg": "^2.28.0",
|
|
50
50
|
"egg-cluster": "^1.27.1",
|
|
51
51
|
"find-up": "5.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=12"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "93d333e82e75b6eb44ab83f74a378172508730d6"
|
|
63
63
|
}
|