@midwayjs/koa 3.1.6 → 3.2.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.
@@ -3,7 +3,6 @@ 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/decorator';
6
- import { Cookies, CookieSetOptions } from '@midwayjs/cookies';
7
6
  export declare type IMidwayKoaContext = IMidwayContext<KoaContext>;
8
7
  export declare type IMidwayKoaApplication = IMidwayApplication<IMidwayKoaContext, koa<DefaultState, IMidwayKoaContext> & {
9
8
  generateController(controllerMapping: string, routeArgsInfo?: RouterParamValue[], routerResponseData?: any[]): Middleware<DefaultState, IMidwayKoaContext>;
@@ -59,7 +58,7 @@ export interface IWebMiddleware {
59
58
  export declare type Application = IMidwayKoaApplication;
60
59
  export interface Context extends IMidwayKoaContext {
61
60
  }
62
- interface BodyParserOptions {
61
+ export interface BodyParserOptions {
63
62
  enable?: boolean;
64
63
  /**
65
64
  * parser will only parse when request type hits enableTypes, default is ['json', 'form'].
@@ -107,37 +106,4 @@ interface BodyParserOptions {
107
106
  */
108
107
  onerror?: ((err: Error, ctx: IMidwayKoaContext) => void);
109
108
  }
110
- declare module '@midwayjs/core/dist/interface' {
111
- interface MidwayConfig {
112
- keys?: string | string[];
113
- koa?: IMidwayKoaConfigurationOptions;
114
- cookies?: CookieSetOptions;
115
- /**
116
- * onerror middleware options
117
- */
118
- onerror?: {
119
- text?: (err: Error, ctx: IMidwayKoaContext) => void;
120
- json?: (err: Error, ctx: IMidwayKoaContext) => void;
121
- html?: (err: Error, ctx: IMidwayKoaContext) => void;
122
- redirect?: string;
123
- accepts?: (...args: any[]) => any;
124
- };
125
- bodyParser?: BodyParserOptions;
126
- siteFile?: {
127
- enable?: boolean;
128
- favicon?: undefined | string | Buffer;
129
- };
130
- }
131
- }
132
- declare module 'koa' {
133
- interface Request {
134
- body?: any;
135
- rawBody: string;
136
- }
137
- interface Context {
138
- cookies: Cookies;
139
- app: Application;
140
- }
141
- }
142
- export {};
143
109
  //# sourceMappingURL=interface.d.ts.map
package/index.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ import {
2
+ Application,
3
+ IMidwayKoaConfigurationOptions,
4
+ IMidwayKoaContext,
5
+ } from './dist';
6
+
7
+ export * from './dist/index';
8
+
9
+ declare module '@midwayjs/core/dist/interface' {
10
+ interface MidwayConfig {
11
+ keys?: string | string[];
12
+ koa?: IMidwayKoaConfigurationOptions;
13
+ cookies?: CookieSetOptions;
14
+ /**
15
+ * onerror middleware options
16
+ */
17
+ onerror?: {
18
+ text?: (err: Error, ctx: IMidwayKoaContext) => void;
19
+ json?: (err: Error, ctx: IMidwayKoaContext) => void;
20
+ html?: (err: Error, ctx: IMidwayKoaContext) => void;
21
+ redirect?: string;
22
+ accepts?: (...args) => any;
23
+ };
24
+ bodyParser?: BodyParserOptions;
25
+ siteFile?: {
26
+ enable?: boolean;
27
+ favicon?: undefined | string | Buffer;
28
+ };
29
+ }
30
+ }
31
+
32
+ declare module 'koa' {
33
+ interface Request {
34
+ body?: any;
35
+ rawBody: string;
36
+ }
37
+ interface Context {
38
+ cookies: Cookies;
39
+ app: Application;
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@midwayjs/koa",
3
- "version": "3.1.6",
3
+ "version": "3.2.1",
4
4
  "description": "Midway Web Framework for KOA",
5
5
  "main": "dist/index",
6
- "typings": "dist/index.d.ts",
6
+ "typings": "index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
9
  "test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
@@ -19,13 +19,14 @@
19
19
  ],
20
20
  "files": [
21
21
  "dist/**/*.js",
22
- "dist/**/*.d.ts"
22
+ "dist/**/*.d.ts",
23
+ "index.d.ts"
23
24
  ],
24
25
  "license": "MIT",
25
26
  "devDependencies": {
26
27
  "@midwayjs/decorator": "^3.1.6",
27
28
  "@midwayjs/logger": "^2.15.0",
28
- "@midwayjs/mock": "^3.1.6",
29
+ "@midwayjs/mock": "^3.2.0",
29
30
  "@types/koa": "2.13.4",
30
31
  "@types/koa-router": "7.4.4",
31
32
  "fs-extra": "10.0.1"
@@ -33,8 +34,8 @@
33
34
  "dependencies": {
34
35
  "@koa/router": "^10.0.0",
35
36
  "@midwayjs/cookies": "^1.0.2",
36
- "@midwayjs/core": "^3.1.6",
37
- "@midwayjs/session": "^3.1.6",
37
+ "@midwayjs/core": "^3.2.0",
38
+ "@midwayjs/session": "^3.2.1",
38
39
  "koa": "2.13.4",
39
40
  "koa-bodyparser": "4.3.0"
40
41
  },
@@ -46,5 +47,5 @@
46
47
  "engines": {
47
48
  "node": ">=12"
48
49
  },
49
- "gitHead": "8c157a2b1a23ca2360522dc0de58513098952391"
50
+ "gitHead": "e957e25e353a2e4c56d5ddcce24bb55a10f007ca"
50
51
  }