@midwayjs/koa 3.1.5 → 3.2.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.
- package/dist/interface.d.ts +1 -35
- package/index.d.ts +41 -0
- package/package.json +10 -9
package/dist/interface.d.ts
CHANGED
|
@@ -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' {
|
|
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.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Midway Web Framework for KOA",
|
|
5
5
|
"main": "dist/index",
|
|
6
|
-
"typings": "
|
|
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,22 +19,23 @@
|
|
|
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
|
-
"@midwayjs/decorator": "^3.
|
|
27
|
+
"@midwayjs/decorator": "^3.1.6",
|
|
27
28
|
"@midwayjs/logger": "^2.15.0",
|
|
28
|
-
"@midwayjs/mock": "^3.
|
|
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"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@koa/router": "^10.0.0",
|
|
35
|
-
"@midwayjs/cookies": "1.0.2",
|
|
36
|
-
"@midwayjs/core": "^3.
|
|
37
|
-
"@midwayjs/session": "^3.
|
|
36
|
+
"@midwayjs/cookies": "^1.0.2",
|
|
37
|
+
"@midwayjs/core": "^3.2.0",
|
|
38
|
+
"@midwayjs/session": "^3.2.0",
|
|
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": "
|
|
50
|
+
"gitHead": "cee3e5ddbb4f0cc5f80176a7b1e271e809686a97"
|
|
50
51
|
}
|