@midwayjs/koa 3.12.8 → 3.13.0

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.
@@ -3,14 +3,16 @@ import { IConfigurationOptions, IMidwayApplication, IMidwayContext } from '@midw
3
3
  import * as koa from 'koa';
4
4
  import { Context as KoaContext, DefaultState, Middleware, Next } from 'koa';
5
5
  import { RouterParamValue } from '@midwayjs/core';
6
+ export interface State extends DefaultState {
7
+ }
6
8
  export type IMidwayKoaContext = IMidwayContext<KoaContext>;
7
- export type IMidwayKoaApplication = IMidwayApplication<IMidwayKoaContext, koa<DefaultState, IMidwayKoaContext> & {
8
- generateController(controllerMapping: string, routeArgsInfo?: RouterParamValue[], routerResponseData?: any[]): Middleware<DefaultState, IMidwayKoaContext>;
9
+ export type IMidwayKoaApplication = IMidwayApplication<IMidwayKoaContext, koa<State, IMidwayKoaContext> & {
10
+ generateController(controllerMapping: string, routeArgsInfo?: RouterParamValue[], routerResponseData?: any[]): Middleware<State, IMidwayKoaContext>;
9
11
  /**
10
12
  * @deprecated
11
13
  * @param middlewareId
12
14
  */
13
- generateMiddleware(middlewareId: any): Promise<Middleware<DefaultState, IMidwayKoaContext>>;
15
+ generateMiddleware(middlewareId: any): Promise<Middleware<State, IMidwayKoaContext>>;
14
16
  }>;
15
17
  /**
16
18
  * @deprecated use NextFunction definition
@@ -81,6 +83,7 @@ export interface IWebMiddleware {
81
83
  }
82
84
  export type Application = IMidwayKoaApplication;
83
85
  export interface Context extends IMidwayKoaContext {
86
+ state: State;
84
87
  }
85
88
  export interface BodyParserOptions {
86
89
  enable?: boolean;
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  IMidwayKoaConfigurationOptions,
4
4
  Context as KoaContext,
5
5
  BodyParserOptions,
6
+ State,
6
7
  } from './dist';
7
8
  import { CookieSetOptions, Cookies } from '@midwayjs/cookies';
8
9
  import '@midwayjs/session';
@@ -41,5 +42,6 @@ declare module 'koa' {
41
42
  cookies: Cookies;
42
43
  app: Application;
43
44
  forward: (url: string) => void;
45
+ state: State;
44
46
  }
45
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/koa",
3
- "version": "3.12.8",
3
+ "version": "3.13.0",
4
4
  "description": "Midway Web Framework for KOA",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -24,18 +24,17 @@
24
24
  ],
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@midwayjs/logger": "^2.15.0",
28
- "@midwayjs/mock": "^3.12.8",
29
- "@types/koa": "2.13.6",
30
- "@types/koa-router": "7.4.6",
27
+ "@midwayjs/mock": "^3.13.0",
28
+ "@types/koa": "2.13.11",
29
+ "@types/koa-router": "7.4.7",
31
30
  "fs-extra": "11.1.1"
32
31
  },
33
32
  "dependencies": {
34
33
  "@koa/router": "^11.0.0",
35
34
  "@midwayjs/cookies": "^1.0.2",
36
- "@midwayjs/core": "^3.12.3",
37
- "@midwayjs/session": "^3.12.8",
38
- "koa": "2.14.1",
35
+ "@midwayjs/core": "^3.13.0",
36
+ "@midwayjs/session": "^3.13.0",
37
+ "koa": "2.14.2",
39
38
  "koa-bodyparser": "4.4.1"
40
39
  },
41
40
  "author": "Harry Chen <czy88840616@gmail.com>",
@@ -46,5 +45,5 @@
46
45
  "engines": {
47
46
  "node": ">=12"
48
47
  },
49
- "gitHead": "598bf3584d655d41889237010edd8b3223d8f059"
48
+ "gitHead": "9f55734afa5b08dcf46bc89493ec8edaa8c6202b"
50
49
  }