@tsed/platform-koa 7.0.0-beta.18 → 7.0.0-beta.19
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/coverage.json +3 -3
- package/lib/cjs/services/PlatformKoaHandler.js +3 -16
- package/lib/cjs/services/PlatformKoaHandler.js.map +1 -1
- package/lib/esm/services/PlatformKoaHandler.js +3 -16
- package/lib/esm/services/PlatformKoaHandler.js.map +1 -1
- package/lib/types/services/PlatformKoaHandler.d.ts +2 -4
- package/package.json +11 -11
package/coverage.json
CHANGED
|
@@ -2,30 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlatformKoaHandler = void 0;
|
|
4
4
|
const common_1 = require("@tsed/common");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
5
|
require("./PlatformKoaRequest");
|
|
7
6
|
class PlatformKoaHandler extends common_1.PlatformHandler {
|
|
8
7
|
async flush($ctx) {
|
|
8
|
+
if ($ctx.error) {
|
|
9
|
+
throw $ctx.error;
|
|
10
|
+
}
|
|
9
11
|
if ($ctx.data === undefined && $ctx.getResponse().body) {
|
|
10
12
|
$ctx.data = $ctx.getResponse().body;
|
|
11
13
|
}
|
|
12
14
|
return super.flush($ctx);
|
|
13
15
|
}
|
|
14
|
-
async onRequest(handler, $ctx) {
|
|
15
|
-
if ($ctx.error instanceof Error && !$ctx.handlerMetadata.hasErrorParam) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
return super.onRequest(handler, $ctx);
|
|
19
|
-
}
|
|
20
|
-
next(error, next, $ctx) {
|
|
21
|
-
if ((0, core_1.isStream)($ctx.data) || $ctx.isDone()) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (error && !($ctx.handlerMetadata.isEndpoint() && !$ctx.handlerMetadata.isFinal())) {
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
return !$ctx.handlerMetadata.isFinal() && next();
|
|
28
|
-
}
|
|
29
16
|
}
|
|
30
17
|
exports.PlatformKoaHandler = PlatformKoaHandler;
|
|
31
18
|
//# sourceMappingURL=PlatformKoaHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformKoaHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformKoaHandler.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"PlatformKoaHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformKoaHandler.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;AAC9D,gCAA8B;AAE9B,MAAa,kBAAmB,SAAQ,wBAAe;IAC9C,KAAK,CAAC,KAAK,CAAC,IAAqB;QACtC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,MAAM,IAAI,CAAC,KAAK,CAAC;SAClB;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE;YACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;SACrC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF;AAZD,gDAYC","sourcesContent":["import {PlatformContext, PlatformHandler} from \"@tsed/common\";\nimport \"./PlatformKoaRequest\";\n\nexport class PlatformKoaHandler extends PlatformHandler {\n public async flush($ctx: PlatformContext) {\n if ($ctx.error) {\n throw $ctx.error;\n }\n\n if ($ctx.data === undefined && $ctx.getResponse().body) {\n $ctx.data = $ctx.getResponse().body;\n }\n\n return super.flush($ctx);\n }\n}\n"]}
|
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
import { PlatformHandler } from "@tsed/common";
|
|
2
|
-
import { isStream } from "@tsed/core";
|
|
3
2
|
import "./PlatformKoaRequest.js";
|
|
4
3
|
export class PlatformKoaHandler extends PlatformHandler {
|
|
5
4
|
async flush($ctx) {
|
|
5
|
+
if ($ctx.error) {
|
|
6
|
+
throw $ctx.error;
|
|
7
|
+
}
|
|
6
8
|
if ($ctx.data === undefined && $ctx.getResponse().body) {
|
|
7
9
|
$ctx.data = $ctx.getResponse().body;
|
|
8
10
|
}
|
|
9
11
|
return super.flush($ctx);
|
|
10
12
|
}
|
|
11
|
-
async onRequest(handler, $ctx) {
|
|
12
|
-
if ($ctx.error instanceof Error && !$ctx.handlerMetadata.hasErrorParam) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
return super.onRequest(handler, $ctx);
|
|
16
|
-
}
|
|
17
|
-
next(error, next, $ctx) {
|
|
18
|
-
if (isStream($ctx.data) || $ctx.isDone()) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (error && !($ctx.handlerMetadata.isEndpoint() && !$ctx.handlerMetadata.isFinal())) {
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
return !$ctx.handlerMetadata.isFinal() && next();
|
|
25
|
-
}
|
|
26
13
|
}
|
|
27
14
|
//# sourceMappingURL=PlatformKoaHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformKoaHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformKoaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,
|
|
1
|
+
{"version":3,"file":"PlatformKoaHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformKoaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,sBAAsB,CAAC;AAE9B,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IAC9C,KAAK,CAAC,KAAK,CAAC,IAAqB;QACtC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,MAAM,IAAI,CAAC,KAAK,CAAC;SAClB;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE;YACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;SACrC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import {PlatformContext, PlatformHandler} from \"@tsed/common\";\nimport \"./PlatformKoaRequest\";\n\nexport class PlatformKoaHandler extends PlatformHandler {\n public async flush($ctx: PlatformContext) {\n if ($ctx.error) {\n throw $ctx.error;\n }\n\n if ($ctx.data === undefined && $ctx.getResponse().body) {\n $ctx.data = $ctx.getResponse().body;\n }\n\n return super.flush($ctx);\n }\n}\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { PlatformContext, PlatformHandler
|
|
1
|
+
import { PlatformContext, PlatformHandler } from "@tsed/common";
|
|
2
2
|
import "./PlatformKoaRequest";
|
|
3
3
|
export declare class PlatformKoaHandler extends PlatformHandler {
|
|
4
|
-
flush($ctx: PlatformContext): Promise<
|
|
5
|
-
onRequest(handler: PlatformParamsCallback, $ctx: PlatformContext): Promise<any>;
|
|
6
|
-
next(error: unknown, next: any, $ctx: PlatformContext): any;
|
|
4
|
+
flush($ctx: PlatformContext): Promise<void>;
|
|
7
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-koa",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.19",
|
|
4
4
|
"description": "Koa package for Ts.ED framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"repository": "https://github.com/tsedio/tsed",
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@koa/cors": "3.3.0",
|
|
55
|
-
"@tsed/common": "7.0.0-beta.
|
|
56
|
-
"@tsed/core": "7.0.0-beta.
|
|
57
|
-
"@tsed/di": "7.0.0-beta.
|
|
58
|
-
"@tsed/platform-test-utils": "7.0.0-beta.
|
|
55
|
+
"@tsed/common": "7.0.0-beta.19",
|
|
56
|
+
"@tsed/core": "7.0.0-beta.19",
|
|
57
|
+
"@tsed/di": "7.0.0-beta.19",
|
|
58
|
+
"@tsed/platform-test-utils": "7.0.0-beta.19",
|
|
59
59
|
"@types/koa": "2.13.4",
|
|
60
60
|
"@types/koa-bodyparser": "4.3.7",
|
|
61
61
|
"@types/koa-compose": "3.2.5",
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"tslib": "2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
|
-
"@tsed/common": "^7.0.0-beta.
|
|
84
|
-
"@tsed/core": "^7.0.0-beta.
|
|
85
|
-
"@tsed/di": "^7.0.0-beta.
|
|
86
|
-
"@tsed/json-mapper": "^7.0.0-beta.
|
|
83
|
+
"@tsed/common": "^7.0.0-beta.19",
|
|
84
|
+
"@tsed/core": "^7.0.0-beta.19",
|
|
85
|
+
"@tsed/di": "^7.0.0-beta.19",
|
|
86
|
+
"@tsed/json-mapper": "^7.0.0-beta.19",
|
|
87
87
|
"@tsed/logger": ">=6.2.0",
|
|
88
|
-
"@tsed/openspec": "^7.0.0-beta.
|
|
89
|
-
"@tsed/schema": "^7.0.0-beta.
|
|
88
|
+
"@tsed/openspec": "^7.0.0-beta.19",
|
|
89
|
+
"@tsed/schema": "^7.0.0-beta.19",
|
|
90
90
|
"koa": ">=2.13.0",
|
|
91
91
|
"koa-bodyparser": ">=4.3.0",
|
|
92
92
|
"koa-compress": ">=5.0.1",
|