@midwayjs/web 3.3.5 → 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.
@@ -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
- export declare type IMidwayWebContext<ResponseBodyT = unknown> = IMidwayContext<EggContext<ResponseBodyT>>;
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/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<Context>,
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.5",
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",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=12"
63
63
  },
64
- "gitHead": "5a835008aaa26e1b3c7d99c525f4a9fdaa3e41d1"
64
+ "gitHead": "cede47c56635e5f687528f6c8ed77d49ce9842a7"
65
65
  }