@midwayjs/web 3.3.5 → 3.4.0-beta.1

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.4.0-beta.1",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index",
6
6
  "typings": "index.d.ts",
@@ -28,13 +28,13 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@midwayjs/decorator": "^3.3.4",
31
+ "@midwayjs/decorator": "^3.4.0-beta.1",
32
32
  "@midwayjs/logger": "^2.15.0",
33
- "@midwayjs/mock": "^3.3.5",
33
+ "@midwayjs/mock": "^3.4.0-beta.1",
34
34
  "axios": "0.26.1",
35
35
  "dayjs": "1.10.8",
36
36
  "egg-logger": "2.7.1",
37
- "egg-mock": "4.2.0",
37
+ "egg-mock": "4.2.1",
38
38
  "egg-scripts": "2.15.3",
39
39
  "egg-socket.io": "4.1.6",
40
40
  "egg-view-nunjucks": "2.3.0",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@eggjs/router": "^2.0.0",
50
- "@midwayjs/core": "^3.3.5",
50
+ "@midwayjs/core": "^3.4.0-beta.1",
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": "5a835008aaa26e1b3c7d99c525f4a9fdaa3e41d1"
64
+ "gitHead": "a603d2348d6141f8f723901498f03a162a037708"
65
65
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2013 - Now midwayjs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.