@midwayjs/koa 3.5.3 → 3.6.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/configuration.js
CHANGED
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.KoaConfiguration = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
13
|
const core_1 = require("@midwayjs/core");
|
|
15
14
|
const session = require("@midwayjs/session");
|
|
16
15
|
const framework_1 = require("./framework");
|
|
@@ -20,7 +19,7 @@ const fav_middleware_1 = require("./middleware/fav.middleware");
|
|
|
20
19
|
let KoaConfiguration = class KoaConfiguration {
|
|
21
20
|
init() {
|
|
22
21
|
// register param decorator
|
|
23
|
-
this.decoratorService.registerParameterHandler(
|
|
22
|
+
this.decoratorService.registerParameterHandler(core_1.WEB_ROUTER_PARAM_KEY, options => {
|
|
24
23
|
return (0, core_1.extractKoaLikeValue)(options.metadata.type, options.metadata.propertyData, options.originParamType)(options.originArgs[0], options.originArgs[1]);
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -29,25 +28,25 @@ let KoaConfiguration = class KoaConfiguration {
|
|
|
29
28
|
}
|
|
30
29
|
};
|
|
31
30
|
__decorate([
|
|
32
|
-
(0,
|
|
31
|
+
(0, core_1.Inject)(),
|
|
33
32
|
__metadata("design:type", core_1.MidwayDecoratorService)
|
|
34
33
|
], KoaConfiguration.prototype, "decoratorService", void 0);
|
|
35
34
|
__decorate([
|
|
36
|
-
(0,
|
|
35
|
+
(0, core_1.Inject)(),
|
|
37
36
|
__metadata("design:type", framework_1.MidwayKoaFramework)
|
|
38
37
|
], KoaConfiguration.prototype, "koaFramework", void 0);
|
|
39
38
|
__decorate([
|
|
40
|
-
(0,
|
|
39
|
+
(0, core_1.Inject)(),
|
|
41
40
|
__metadata("design:type", core_1.MidwayConfigService)
|
|
42
41
|
], KoaConfiguration.prototype, "configService", void 0);
|
|
43
42
|
__decorate([
|
|
44
|
-
(0,
|
|
43
|
+
(0, core_1.Init)(),
|
|
45
44
|
__metadata("design:type", Function),
|
|
46
45
|
__metadata("design:paramtypes", []),
|
|
47
46
|
__metadata("design:returntype", void 0)
|
|
48
47
|
], KoaConfiguration.prototype, "init", null);
|
|
49
48
|
KoaConfiguration = __decorate([
|
|
50
|
-
(0,
|
|
49
|
+
(0, core_1.Configuration)({
|
|
51
50
|
namespace: 'koa',
|
|
52
51
|
imports: [session],
|
|
53
52
|
importConfigs: [
|
package/dist/framework.js
CHANGED
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.MidwayKoaFramework = void 0;
|
|
10
10
|
const core_1 = require("@midwayjs/core");
|
|
11
11
|
const cookies_1 = require("@midwayjs/cookies");
|
|
12
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
13
12
|
const Router = require("@koa/router");
|
|
14
13
|
const koa = require("koa");
|
|
15
14
|
const onerror_1 = require("./onerror");
|
|
@@ -189,7 +188,7 @@ let MidwayKoaFramework = class MidwayKoaFramework extends core_1.BaseFramework {
|
|
|
189
188
|
}
|
|
190
189
|
};
|
|
191
190
|
MidwayKoaFramework = __decorate([
|
|
192
|
-
(0,
|
|
191
|
+
(0, core_1.Framework)()
|
|
193
192
|
], MidwayKoaFramework);
|
|
194
193
|
exports.MidwayKoaFramework = MidwayKoaFramework;
|
|
195
194
|
//# sourceMappingURL=framework.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { IConfigurationOptions, IMidwayApplication, IMidwayContext } from '@midwayjs/core';
|
|
3
3
|
import * as koa from 'koa';
|
|
4
4
|
import { Context as KoaContext, DefaultState, Middleware, Next } from 'koa';
|
|
5
|
-
import { RouterParamValue } from '@midwayjs/
|
|
5
|
+
import { RouterParamValue } from '@midwayjs/core';
|
|
6
6
|
export declare type IMidwayKoaContext = IMidwayContext<KoaContext>;
|
|
7
7
|
export declare type IMidwayKoaApplication = IMidwayApplication<IMidwayKoaContext, koa<DefaultState, IMidwayKoaContext> & {
|
|
8
8
|
generateController(controllerMapping: string, routeArgsInfo?: RouterParamValue[], routerResponseData?: any[]): Middleware<DefaultState, IMidwayKoaContext>;
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BodyParserMiddleware = void 0;
|
|
13
13
|
const koaBodyParser = require("koa-bodyparser");
|
|
14
|
-
const
|
|
14
|
+
const core_1 = require("@midwayjs/core");
|
|
15
15
|
let BodyParserMiddleware = class BodyParserMiddleware {
|
|
16
16
|
resolve() {
|
|
17
17
|
// use bodyparser middleware
|
|
@@ -24,11 +24,11 @@ let BodyParserMiddleware = class BodyParserMiddleware {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
__decorate([
|
|
27
|
-
(0,
|
|
27
|
+
(0, core_1.Config)('bodyParser'),
|
|
28
28
|
__metadata("design:type", Object)
|
|
29
29
|
], BodyParserMiddleware.prototype, "bodyparserConfig", void 0);
|
|
30
30
|
BodyParserMiddleware = __decorate([
|
|
31
|
-
(0,
|
|
31
|
+
(0, core_1.Middleware)()
|
|
32
32
|
], BodyParserMiddleware);
|
|
33
33
|
exports.BodyParserMiddleware = BodyParserMiddleware;
|
|
34
34
|
//# sourceMappingURL=bodyparser.middleware.js.map
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SiteFileMiddleware = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const MAX_AGE = 'public, max-age=2592000'; // 30 days
|
|
16
16
|
let SiteFileMiddleware = class SiteFileMiddleware {
|
|
@@ -52,11 +52,11 @@ let SiteFileMiddleware = class SiteFileMiddleware {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
__decorate([
|
|
55
|
-
(0,
|
|
55
|
+
(0, core_1.Config)('siteFile'),
|
|
56
56
|
__metadata("design:type", Object)
|
|
57
57
|
], SiteFileMiddleware.prototype, "siteFileConfig", void 0);
|
|
58
58
|
SiteFileMiddleware = __decorate([
|
|
59
|
-
(0,
|
|
59
|
+
(0, core_1.Middleware)()
|
|
60
60
|
], SiteFileMiddleware);
|
|
61
61
|
exports.SiteFileMiddleware = SiteFileMiddleware;
|
|
62
62
|
//# sourceMappingURL=fav.middleware.js.map
|
package/dist/onerror.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupOnError = void 0;
|
|
4
4
|
const http = require("http");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@midwayjs/core");
|
|
7
7
|
function setupOnError(app, config, logger) {
|
|
8
8
|
const errorOptions = Object.assign({
|
|
9
9
|
// support customize accepts function
|
|
@@ -117,7 +117,7 @@ function setupOnError(app, config, logger) {
|
|
|
117
117
|
let errMsg = err;
|
|
118
118
|
if (typeof err === 'object') {
|
|
119
119
|
try {
|
|
120
|
-
errMsg =
|
|
120
|
+
errMsg = core_1.Utils.safeStringify(err);
|
|
121
121
|
// eslint-disable-next-line no-empty
|
|
122
122
|
}
|
|
123
123
|
catch (e) { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/koa",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Midway Web Framework for KOA",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@midwayjs/decorator": "^3.4.11",
|
|
28
27
|
"@midwayjs/logger": "^2.15.0",
|
|
29
|
-
"@midwayjs/mock": "^3.
|
|
28
|
+
"@midwayjs/mock": "^3.6.0",
|
|
30
29
|
"@types/koa": "2.13.5",
|
|
31
30
|
"@types/koa-router": "7.4.4",
|
|
32
31
|
"fs-extra": "10.0.1"
|
|
@@ -34,8 +33,8 @@
|
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@koa/router": "^11.0.0",
|
|
36
35
|
"@midwayjs/cookies": "^1.0.2",
|
|
37
|
-
"@midwayjs/core": "^3.
|
|
38
|
-
"@midwayjs/session": "^3.
|
|
36
|
+
"@midwayjs/core": "^3.6.0",
|
|
37
|
+
"@midwayjs/session": "^3.6.0",
|
|
39
38
|
"koa": "2.13.4",
|
|
40
39
|
"koa-bodyparser": "4.3.0"
|
|
41
40
|
},
|
|
@@ -47,5 +46,5 @@
|
|
|
47
46
|
"engines": {
|
|
48
47
|
"node": ">=12"
|
|
49
48
|
},
|
|
50
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "22643b0e8519766bb7c68b975930199fc136336e"
|
|
51
50
|
}
|