@tsed/platform-koa 8.5.1 → 8.6.0-beta.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.
|
@@ -2,7 +2,7 @@ import KoaRouter from "@koa/router";
|
|
|
2
2
|
import { catchAsyncError, isFunction } from "@tsed/core";
|
|
3
3
|
import { constant, inject, runInContext } from "@tsed/di";
|
|
4
4
|
import { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
5
|
-
import { adapter, application, createContext,
|
|
5
|
+
import { adapter, application, createContext, PlatformAdapter, PlatformBuilder, PlatformHandler, PlatformRequest, PlatformResponse } from "@tsed/platform-http";
|
|
6
6
|
import { PlatformHandlerType } from "@tsed/platform-router";
|
|
7
7
|
import Koa from "koa";
|
|
8
8
|
import koaBodyParser from "koa-bodyparser";
|
|
@@ -32,22 +32,6 @@ export class PlatformKoa extends PlatformAdapter {
|
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.NAME = "koa";
|
|
35
|
-
this.providers = [
|
|
36
|
-
{
|
|
37
|
-
token: PlatformResponse,
|
|
38
|
-
useClass: PlatformKoaResponse
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
token: PlatformRequest,
|
|
42
|
-
useClass: PlatformKoaRequest
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
token: PlatformHandler,
|
|
46
|
-
useClass: PlatformKoaHandler
|
|
47
|
-
},
|
|
48
|
-
{ token: PlatformApplication },
|
|
49
|
-
{ token: Platform }
|
|
50
|
-
];
|
|
51
35
|
}
|
|
52
36
|
/**
|
|
53
37
|
* Create new serverless application. In this mode, the component scan are disabled.
|
|
@@ -155,5 +139,18 @@ export class PlatformKoa extends PlatformAdapter {
|
|
|
155
139
|
return parser({ ...options, ...additionalOptions });
|
|
156
140
|
}
|
|
157
141
|
}
|
|
158
|
-
adapter(PlatformKoa
|
|
142
|
+
adapter(PlatformKoa, [
|
|
143
|
+
{
|
|
144
|
+
token: PlatformResponse,
|
|
145
|
+
useClass: PlatformKoaResponse
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
token: PlatformRequest,
|
|
149
|
+
useClass: PlatformKoaRequest
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
token: PlatformHandler,
|
|
153
|
+
useClass: PlatformKoaHandler
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
159
156
|
//# sourceMappingURL=PlatformKoa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformKoa.js","sourceRoot":"","sources":["../../../src/components/PlatformKoa.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,eAAe,EAAE,UAAU,EAAO,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"PlatformKoa.js","sourceRoot":"","sources":["../../../src/components/PlatformKoa.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,eAAe,EAAE,UAAU,EAAO,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EAGf,eAAe,EACf,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA0B,mBAAmB,EAAgB,MAAM,uBAAuB,CAAC;AAClG,OAAO,GAAoB,MAAM,KAAK,CAAC;AACvC,OAAO,aAAwB,MAAM,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GAAG,EAAE,CAAC;QAC9D,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvB,OAAO;YACL,GAAG;YACH,QAAQ;gBACN,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,OAA+B;QACvC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAA+B;QACvD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,UAAU,CAAC,CAAyC,EAAE,oBAAyB,EAAE;QAC/E,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACxC,IAAI,MAAM,GAAQ,aAAa,CAAC;QAEhC,IAAI,OAAO,GAAY,EAAE,CAAC;QAE1B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QAED,OAAO,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,GAAG,iBAAiB,EAAC,CAAC,CAAC;IACpD,CAAC;CACF;AAED,OAAO,CAAC,WAAW,EAAE;IACnB;QACE,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,mBAAmB;KAC9B;IACD;QACE,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,kBAAkB;KAC7B;IACD;QACE,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,kBAAkB;KAC7B;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { Type } from "@tsed/core";
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAdapter, PlatformBuilder, PlatformMulter, PlatformMulterSettings, PlatformStaticsOptions } from "@tsed/platform-http";
|
|
5
5
|
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
6
6
|
import Koa, { Context, Next } from "koa";
|
|
7
7
|
import send from "koa-send";
|
|
8
|
-
import { PlatformKoaHandler } from "../services/PlatformKoaHandler.js";
|
|
9
|
-
import { PlatformKoaRequest } from "../services/PlatformKoaRequest.js";
|
|
10
|
-
import { PlatformKoaResponse } from "../services/PlatformKoaResponse.js";
|
|
11
8
|
declare global {
|
|
12
9
|
namespace TsED {
|
|
13
10
|
interface Application extends Koa {
|
|
@@ -24,22 +21,6 @@ declare global {
|
|
|
24
21
|
*/
|
|
25
22
|
export declare class PlatformKoa extends PlatformAdapter<Koa> {
|
|
26
23
|
readonly NAME = "koa";
|
|
27
|
-
readonly providers: ({
|
|
28
|
-
token: typeof PlatformResponse;
|
|
29
|
-
useClass: typeof PlatformKoaResponse;
|
|
30
|
-
} | {
|
|
31
|
-
token: typeof PlatformRequest;
|
|
32
|
-
useClass: typeof PlatformKoaRequest;
|
|
33
|
-
} | {
|
|
34
|
-
token: typeof PlatformHandler;
|
|
35
|
-
useClass: typeof PlatformKoaHandler;
|
|
36
|
-
} | {
|
|
37
|
-
token: typeof PlatformApplication;
|
|
38
|
-
useClass?: undefined;
|
|
39
|
-
} | {
|
|
40
|
-
token: typeof Platform;
|
|
41
|
-
useClass?: undefined;
|
|
42
|
-
})[];
|
|
43
24
|
/**
|
|
44
25
|
* Create new serverless application. In this mode, the component scan are disabled.
|
|
45
26
|
* @param module
|
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.6.0-beta.1",
|
|
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.6.0-beta.1",
|
|
58
|
+
"@tsed/core": "8.6.0-beta.1",
|
|
59
|
+
"@tsed/di": "8.6.0-beta.1",
|
|
60
|
+
"@tsed/platform-http": "8.6.0-beta.1",
|
|
61
|
+
"@tsed/platform-test-sdk": "8.6.0-beta.1",
|
|
62
|
+
"@tsed/typescript": "8.6.0-beta.1",
|
|
63
63
|
"@types/koa": "2.15.0",
|
|
64
64
|
"@types/koa-bodyparser": "4.3.12",
|
|
65
65
|
"@types/koa-compose": "3.2.8",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/koa-session": "6.4.5",
|
|
71
71
|
"@types/koa__router": "12.0.4",
|
|
72
72
|
"eslint": "9.12.0",
|
|
73
|
-
"koa": "2.15.
|
|
73
|
+
"koa": "2.15.3",
|
|
74
74
|
"koa-bodyparser": "4.4.1",
|
|
75
75
|
"koa-compress": "5.1.1",
|
|
76
76
|
"koa-override": "4.0.0",
|
|
@@ -87,13 +87,13 @@
|
|
|
87
87
|
"tslib": "2.7.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@tsed/core": ">=8.
|
|
91
|
-
"@tsed/di": ">=8.
|
|
92
|
-
"@tsed/json-mapper": ">=8.
|
|
90
|
+
"@tsed/core": ">=8.6.0-beta.1",
|
|
91
|
+
"@tsed/di": ">=8.6.0-beta.1",
|
|
92
|
+
"@tsed/json-mapper": ">=8.6.0-beta.1",
|
|
93
93
|
"@tsed/logger": ">=7.0.1",
|
|
94
|
-
"@tsed/openspec": ">=8.
|
|
95
|
-
"@tsed/platform-http": ">=8.
|
|
96
|
-
"@tsed/schema": ">=8.
|
|
94
|
+
"@tsed/openspec": ">=8.6.0-beta.1",
|
|
95
|
+
"@tsed/platform-http": ">=8.6.0-beta.1",
|
|
96
|
+
"@tsed/schema": ">=8.6.0-beta.1",
|
|
97
97
|
"cross-env": "7.0.3",
|
|
98
98
|
"koa": ">=2.13.0",
|
|
99
99
|
"koa-bodyparser": ">=4.3.0",
|
|
@@ -128,5 +128,8 @@
|
|
|
128
128
|
"multer": {
|
|
129
129
|
"optional": false
|
|
130
130
|
}
|
|
131
|
+
},
|
|
132
|
+
"publishConfig": {
|
|
133
|
+
"tag": "beta"
|
|
131
134
|
}
|
|
132
135
|
}
|
|
@@ -6,9 +6,7 @@ import {
|
|
|
6
6
|
adapter,
|
|
7
7
|
application,
|
|
8
8
|
createContext,
|
|
9
|
-
Platform,
|
|
10
9
|
PlatformAdapter,
|
|
11
|
-
PlatformApplication,
|
|
12
10
|
PlatformBuilder,
|
|
13
11
|
PlatformHandler,
|
|
14
12
|
PlatformMulter,
|
|
@@ -59,22 +57,6 @@ KoaRouter.prototype.match = function match(...args: any[]) {
|
|
|
59
57
|
*/
|
|
60
58
|
export class PlatformKoa extends PlatformAdapter<Koa> {
|
|
61
59
|
readonly NAME = "koa";
|
|
62
|
-
readonly providers = [
|
|
63
|
-
{
|
|
64
|
-
token: PlatformResponse,
|
|
65
|
-
useClass: PlatformKoaResponse
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
token: PlatformRequest,
|
|
69
|
-
useClass: PlatformKoaRequest
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
token: PlatformHandler,
|
|
73
|
-
useClass: PlatformKoaHandler
|
|
74
|
-
},
|
|
75
|
-
{token: PlatformApplication},
|
|
76
|
-
{token: Platform}
|
|
77
|
-
];
|
|
78
60
|
|
|
79
61
|
/**
|
|
80
62
|
* Create new serverless application. In this mode, the component scan are disabled.
|
|
@@ -204,4 +186,17 @@ export class PlatformKoa extends PlatformAdapter<Koa> {
|
|
|
204
186
|
}
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
adapter(PlatformKoa
|
|
189
|
+
adapter(PlatformKoa, [
|
|
190
|
+
{
|
|
191
|
+
token: PlatformResponse,
|
|
192
|
+
useClass: PlatformKoaResponse
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
token: PlatformRequest,
|
|
196
|
+
useClass: PlatformKoaRequest
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
token: PlatformHandler,
|
|
200
|
+
useClass: PlatformKoaHandler
|
|
201
|
+
}
|
|
202
|
+
]);
|
package/vitest.config.mts
CHANGED