@tsed/platform-koa 8.18.1 → 8.19.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/lib/esm/services/PlatformKoaResponse.js +3 -2
- package/lib/types/components/PlatformKoa.d.ts +2 -4
- package/lib/types/interfaces/PlatformKoaSettings.d.ts +0 -1
- package/lib/types/services/PlatformKoaRequest.d.ts +0 -1
- package/lib/types/services/PlatformKoaResponse.d.ts +1 -3
- package/package.json +8 -8
|
@@ -4,6 +4,7 @@ import { PlatformResponse } from "@tsed/platform-http";
|
|
|
4
4
|
* @koa
|
|
5
5
|
*/
|
|
6
6
|
export class PlatformKoaResponse extends PlatformResponse {
|
|
7
|
+
#statusCode;
|
|
7
8
|
get ctx() {
|
|
8
9
|
return this.raw.ctx;
|
|
9
10
|
}
|
|
@@ -20,8 +21,7 @@ export class PlatformKoaResponse extends PlatformResponse {
|
|
|
20
21
|
return this.raw.res;
|
|
21
22
|
}
|
|
22
23
|
hasStatus() {
|
|
23
|
-
|
|
24
|
-
return this.statusCode !== 404;
|
|
24
|
+
return this.#statusCode !== undefined || this.statusCode !== 404;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Sets the HTTP status for the response.
|
|
@@ -30,6 +30,7 @@ export class PlatformKoaResponse extends PlatformResponse {
|
|
|
30
30
|
*/
|
|
31
31
|
status(status) {
|
|
32
32
|
this.raw.status = status;
|
|
33
|
+
this.#statusCode = status;
|
|
33
34
|
return this;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import "@tsed/platform-multer/koa";
|
|
4
2
|
import { Type } from "@tsed/core";
|
|
5
3
|
import { PlatformAdapter, PlatformBuilder, PlatformStaticsOptions } from "@tsed/platform-http";
|
|
6
4
|
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
7
|
-
import Koa
|
|
5
|
+
import Koa from "koa";
|
|
8
6
|
import send from "koa-send";
|
|
9
7
|
declare global {
|
|
10
8
|
namespace TsED {
|
|
@@ -40,7 +38,7 @@ export declare class PlatformKoa extends PlatformAdapter<Koa> {
|
|
|
40
38
|
useContext(): void;
|
|
41
39
|
createApp(): {
|
|
42
40
|
app: Koa<Koa.DefaultState, Koa.DefaultContext>;
|
|
43
|
-
callback(): (req: import("http").IncomingMessage | import("http2").Http2ServerRequest, res: import("http").ServerResponse
|
|
41
|
+
callback(): (req: import("http").IncomingMessage | import("http2").Http2ServerRequest, res: import("http").ServerResponse | import("http2").Http2ServerResponse) => Promise<void>;
|
|
44
42
|
};
|
|
45
43
|
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
46
44
|
bodyParser(_: "json" | "urlencoded" | "raw" | "text", additionalOptions?: any): any;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
4
1
|
import { ServerResponse } from "node:http";
|
|
5
2
|
import { PlatformResponse } from "@tsed/platform-http";
|
|
6
3
|
import Koa from "koa";
|
|
@@ -15,6 +12,7 @@ declare global {
|
|
|
15
12
|
* @koa
|
|
16
13
|
*/
|
|
17
14
|
export declare class PlatformKoaResponse extends PlatformResponse<Koa.Response> {
|
|
15
|
+
#private;
|
|
18
16
|
get ctx(): Koa.Context;
|
|
19
17
|
get statusCode(): number;
|
|
20
18
|
get locals(): Koa.DefaultState;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/platform-koa",
|
|
3
3
|
"description": "Koa package for Ts.ED framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.19.0",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"repository": "https://github.com/tsedio/tsed",
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@koa/cors": "5.0.0",
|
|
57
|
-
"@tsed/barrels": "8.
|
|
58
|
-
"@tsed/core": "8.
|
|
59
|
-
"@tsed/di": "8.
|
|
60
|
-
"@tsed/platform-http": "8.
|
|
61
|
-
"@tsed/platform-test-sdk": "8.
|
|
62
|
-
"@tsed/typescript": "8.
|
|
57
|
+
"@tsed/barrels": "8.19.0",
|
|
58
|
+
"@tsed/core": "8.19.0",
|
|
59
|
+
"@tsed/di": "8.19.0",
|
|
60
|
+
"@tsed/platform-http": "8.19.0",
|
|
61
|
+
"@tsed/platform-test-sdk": "8.19.0",
|
|
62
|
+
"@tsed/typescript": "8.19.0",
|
|
63
63
|
"@types/koa": "2.15.0",
|
|
64
64
|
"@types/koa-bodyparser": "4.3.12",
|
|
65
65
|
"@types/koa-compose": "3.2.8",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"koa-override": "4.0.0",
|
|
77
77
|
"koa-qs": "^3.0.0",
|
|
78
78
|
"koa-session": "6.4.0",
|
|
79
|
-
"typescript": "5.
|
|
79
|
+
"typescript": "5.9.3",
|
|
80
80
|
"vitest": "3.2.4"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|