@midwayjs/web 3.3.3 → 3.3.6
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/interface.d.ts +44 -1
- package/dist/logger.js +11 -1
- package/index.d.ts +4 -1
- package/package.json +5 -5
package/dist/interface.d.ts
CHANGED
|
@@ -10,12 +10,55 @@ export interface IMidwayWebBaseApplication {
|
|
|
10
10
|
generateMiddleware?(middlewareId: any): Promise<Middleware<DefaultState, EggContext>>;
|
|
11
11
|
createLogger(name: string, options: LoggerOptions): ILogger;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated since version 3.0.0
|
|
15
|
+
* Please use Application from '@midwayjs/web'
|
|
16
|
+
*/
|
|
13
17
|
export declare type IMidwayWebApplication = IMidwayApplication<Context, EggApplication & IMidwayWebBaseApplication>;
|
|
14
18
|
export interface Application extends IMidwayWebApplication {
|
|
15
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated since version 3.0.0
|
|
22
|
+
* Please use Context from '@midwayjs/web'
|
|
23
|
+
*/
|
|
24
|
+
export declare type IMidwayWebContext<ResponseBodyT = unknown> = IMidwayContext<EggContext<ResponseBodyT>>;
|
|
16
25
|
export interface Context<ResponseBodyT = unknown> extends IMidwayWebContext<ResponseBodyT> {
|
|
26
|
+
session: {
|
|
27
|
+
/**
|
|
28
|
+
* JSON representation of the session.
|
|
29
|
+
*/
|
|
30
|
+
toJSON(): object;
|
|
31
|
+
/**
|
|
32
|
+
* Return how many values there are in the session object.
|
|
33
|
+
* Used to see if it"s "populated".
|
|
34
|
+
*/
|
|
35
|
+
readonly length: number;
|
|
36
|
+
/**
|
|
37
|
+
* populated flag, which is just a boolean alias of .length.
|
|
38
|
+
*/
|
|
39
|
+
readonly populated: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* get/set session maxAge
|
|
42
|
+
*/
|
|
43
|
+
maxAge: number | 'session' | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* commit this session's headers if autoCommit is set to false.
|
|
46
|
+
*/
|
|
47
|
+
manuallyCommit(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* save this session no matter whether it is populated
|
|
50
|
+
*/
|
|
51
|
+
save(): void;
|
|
52
|
+
/**
|
|
53
|
+
* allow to put any value on session object
|
|
54
|
+
*/
|
|
55
|
+
[_: string]: any;
|
|
56
|
+
};
|
|
17
57
|
}
|
|
18
|
-
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated since version 3.0.0
|
|
60
|
+
* Please use NextFunction from '@midwayjs/web'
|
|
61
|
+
*/
|
|
19
62
|
export declare type IMidwayWebNext = BaseNextFunction;
|
|
20
63
|
export declare type NextFunction = BaseNextFunction;
|
|
21
64
|
export interface IMidwayWebConfigurationOptions extends IConfigurationOptions {
|
package/dist/logger.js
CHANGED
|
@@ -126,11 +126,21 @@ class MidwayLoggers extends Map {
|
|
|
126
126
|
* 提前备份 egg 日志
|
|
127
127
|
*/
|
|
128
128
|
checkEggLoggerExistsAndBackup(options.dir, options.fileLogName);
|
|
129
|
-
|
|
129
|
+
let logger = logger_1.loggers.createLogger(loggerKey, options);
|
|
130
130
|
// overwrite values for pandora collect
|
|
131
131
|
logger.values = () => {
|
|
132
132
|
return [];
|
|
133
133
|
};
|
|
134
|
+
if (process.env['EGG_CLUSTER_MODE'] !== 'true') {
|
|
135
|
+
logger = new Proxy(logger, {
|
|
136
|
+
get(target, prop, receiver) {
|
|
137
|
+
if (prop === 'close') {
|
|
138
|
+
return () => { };
|
|
139
|
+
}
|
|
140
|
+
return target[prop];
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
134
144
|
this[loggerKey] = logger;
|
|
135
145
|
this.set(loggerKey, logger);
|
|
136
146
|
return logger;
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
IMidwayWebBaseApplication,
|
|
7
7
|
IMidwayWebConfigurationOptions,
|
|
8
|
+
Context as EggContext,
|
|
8
9
|
} from './dist';
|
|
10
|
+
import { ILogger, LoggerOptions } from '@midwayjs/logger';
|
|
11
|
+
import { EggAppConfig } from 'egg';
|
|
9
12
|
|
|
10
13
|
export * from './dist/index';
|
|
11
14
|
|
|
@@ -16,7 +19,7 @@ declare module 'egg' {
|
|
|
16
19
|
|
|
17
20
|
// 这里再次覆盖和 egg 不同的定义,不然 egg 插件里可能会报错
|
|
18
21
|
interface Application
|
|
19
|
-
extends IMidwayBaseApplication<
|
|
22
|
+
extends IMidwayBaseApplication<EggContext>,
|
|
20
23
|
IMidwayWebBaseApplication {
|
|
21
24
|
createAnonymousContext(...args: any[]): EggContext;
|
|
22
25
|
getCoreLogger(): EggLogger & ILogger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/web",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "Midway Web Framework for Egg.js",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@midwayjs/decorator": "^3.
|
|
31
|
+
"@midwayjs/decorator": "^3.3.4",
|
|
32
32
|
"@midwayjs/logger": "^2.15.0",
|
|
33
|
-
"@midwayjs/mock": "^3.3.
|
|
33
|
+
"@midwayjs/mock": "^3.3.5",
|
|
34
34
|
"axios": "0.26.1",
|
|
35
35
|
"dayjs": "1.10.8",
|
|
36
36
|
"egg-logger": "2.7.1",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@eggjs/router": "^2.0.0",
|
|
50
|
-
"@midwayjs/core": "^3.3.
|
|
50
|
+
"@midwayjs/core": "^3.3.5",
|
|
51
51
|
"egg": "^2.28.0",
|
|
52
52
|
"egg-cluster": "^1.27.1",
|
|
53
53
|
"find-up": "5.0.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=12"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cede47c56635e5f687528f6c8ed77d49ce9842a7"
|
|
65
65
|
}
|